|
1 |
| -// #region Vue 2 |
2 |
| -declare module 'vue/types/vue' { |
3 |
| - interface Vue { |
4 |
| - $t: (key: string, values?: Record<string, unknown>) => string |
5 |
| - $ta: (key: string, values?: Record<string, unknown>) => Record<string, string> |
| 1 | +import { PropType, DefineComponent, FunctionDirective } from 'vue-demi' |
| 2 | +import { FluentVariable } from '@fluent/bundle' |
| 3 | + |
| 4 | +type ComponentType = DefineComponent<{ |
| 5 | + /** |
| 6 | + * The key of the translation. |
| 7 | + */ |
| 8 | + path: { |
| 9 | + type: StringConstructor, |
| 10 | + required: true, |
| 11 | + }, |
| 12 | + /** |
| 13 | + * Arguments to pass to the translation. |
| 14 | + */ |
| 15 | + args: { |
| 16 | + type: PropType<Record<string, FluentVariable>>, |
| 17 | + default: () => Record<string, FluentVariable>, |
| 18 | + }, |
| 19 | + /** |
| 20 | + * The tag to use as a root element. |
| 21 | + */ |
| 22 | + tag: { |
| 23 | + type: StringConstructor, |
| 24 | + default: 'span', |
| 25 | + }, |
| 26 | + /** |
| 27 | + * Whether to render translation as html. |
| 28 | + */ |
| 29 | + html: { |
| 30 | + type: BooleanConstructor, |
| 31 | + default: false, |
| 32 | + }, |
| 33 | + /** |
| 34 | + * Whether to render translation without a root element. |
| 35 | + */ |
| 36 | + noTag: { |
| 37 | + type: BooleanConstructor, |
| 38 | + default: false, |
6 | 39 | }
|
7 |
| -} |
8 |
| -// #endregion |
| 40 | +}> |
9 | 41 |
|
10 |
| -// #region Vue 3 |
11 |
| -declare module '@vue/runtime-core' { |
| 42 | +declare module 'vue' { |
12 | 43 | interface ComponentCustomProperties {
|
13 | 44 | $t: (key: string, values?: Record<string, unknown>) => string
|
14 | 45 | $ta: (key: string, values?: Record<string, unknown>) => Record<string, string>
|
15 | 46 | }
|
| 47 | + |
| 48 | + interface ComponentCustomProperties { |
| 49 | + vT: FunctionDirective<HTMLElement, Record<string, FluentVariable>> |
| 50 | + } |
| 51 | + |
| 52 | + interface GlobalComponents { |
| 53 | + i18n: ComponentType |
| 54 | + } |
16 | 55 | }
|
17 |
| -// #endregion |
18 | 56 |
|
19 | 57 | export * from './dist'
|
0 commit comments