langsys-js-vue 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,338 @@
1
+ import * as langsys_js_typescript from 'langsys-js-typescript';
2
+ import { Signal, TFunction, iCategories, ParamPrimitive, iLangsysInitConfig as iLangsysInitConfig$1, iLangsysResponse, iCountryList, iCurrencyList, iCountryDialCode, iLocaleDefault, iLocaleFlat, iLocaleData } from 'langsys-js-typescript';
3
+ export { ExtractParamKeys, LangsysAppAPI, ParamPrimitive, ParamsFor, Signal, TArgs, TFunction, TranslationParams, canonicalizeLocale, createSignal, currentlyLoadedLocale, iCategories, iContentBlock, iCountry, iCountryDialCode, iCountryList, iCurrency, iCurrencyList, iLangsysResponse, iLanguageName, iLocaleData, iLocaleDefault, iLocaleFlat, iProject, iTranslations, sTranslations, tSignal as t } from 'langsys-js-typescript';
4
+ import * as vue from 'vue';
5
+ import { Ref, ShallowRef, PropType } from 'vue';
6
+
7
+ /**
8
+ * Subscribe the current effect scope to a base-SDK `Signal<T>` and return its
9
+ * value as a read-only shallow ref, updating whenever the signal changes.
10
+ *
11
+ * This is the Vue mirror of Svelte's `$store` auto-subscription and React's
12
+ * `useSignal` (`useSyncExternalStore`). The base SDK's `subscribe` fires
13
+ * synchronously with the current value and returns an unsubscribe function, so
14
+ * the ref is seeded immediately — server-side rendering sees the value the SDK
15
+ * seeded from `initialTranslations` with no flash of untranslated content.
16
+ *
17
+ * `shallowRef` is deliberate: signal payloads (`TFunction`, the catalog) must
18
+ * not be deeply proxied — the signal replaces the whole value on every change,
19
+ * which is exactly what a shallow ref tracks.
20
+ *
21
+ * When called inside a component `setup()` or an `effectScope`, the
22
+ * subscription is disposed with the scope. Outside any scope (module level),
23
+ * the subscription lives for the app's lifetime — fine for the SDK's global
24
+ * singletons, but prefer calling from `setup()`.
25
+ */
26
+ declare function useSignal<T>(signal: Signal<T>): Readonly<ShallowRef<T>>;
27
+ /**
28
+ * Create a reactive `Signal<string>` to hold the user's selected locale — the
29
+ * Vue analog of Svelte's `writable('en-US')`.
30
+ *
31
+ * Pass the result as `UserLocaleStore` to `LangsysApp.init`, read it reactively
32
+ * with `useSignal(store)` (or use the all-in-one `useLocaleStore` composable),
33
+ * and switch locale with `store.set('fr-FR')`. The base SDK only ever reads and
34
+ * subscribes to it — it never writes.
35
+ *
36
+ * Locale identifiers are canonicalized to BCP 47 by the base SDK (v0.3.0+), so
37
+ * `'en-us'` still works on input — but `currentlyLoadedLocale` always emits the
38
+ * canonical form (`'en-US'`), so prefer canonical casing to keep comparisons
39
+ * against it straightforward.
40
+ */
41
+ declare function createLocaleStore(initial?: string): Signal<string>;
42
+ /**
43
+ * Adapt an existing Vue `Ref<string>` into the SDK's `Signal<string>` contract
44
+ * — the Vue analog of the Svelte wrapper's `adaptStore(writable)`.
45
+ *
46
+ * Use this when your app already owns the locale in a ref (Pinia state, a
47
+ * composable, Nuxt's `useState`) and you want the SDK to react to it directly:
48
+ *
49
+ * const locale = ref('en-US');
50
+ * LangsysApp.init({ ..., UserLocaleStore: refToLocaleSource(locale) });
51
+ * locale.value = 'fr-FR'; // SDK loads French
52
+ *
53
+ * The watcher uses `flush: 'sync'` to preserve the Signal contract the SDK
54
+ * relies on (synchronous notification, immediate first fire). The returned
55
+ * unsubscriber stops the watcher.
56
+ */
57
+ declare function refToLocaleSource(localeRef: Ref<string>): Signal<string>;
58
+
59
+ /**
60
+ * The current translation function as a reactive ref, updating whenever
61
+ * translations or the loaded locale change. This is the Vue analog of Svelte's
62
+ * `$t` store read and React's `useT()`.
63
+ *
64
+ * const t = useT();
65
+ * // template: <h1>{{ t('Welcome to my app', 'UI') }}</h1> (auto-unwrapped)
66
+ * // script: t.value('Welcome to my app', 'UI')
67
+ *
68
+ * The phrase is both the lookup key and the base-language default. Signature:
69
+ * `t(phrase, category?, params?)`. Placeholder names in the phrase are
70
+ * type-checked against the params object at the call site.
71
+ */
72
+ declare function useT(): Readonly<ShallowRef<TFunction>>;
73
+ /**
74
+ * The locale whose translations are currently loaded. This lags the
75
+ * user-selected locale (`UserLocaleStore`) until the fetch for the new locale
76
+ * settles, which makes it the right value to gate "translations are ready" UI on.
77
+ */
78
+ declare function useCurrentLocale(): Readonly<ShallowRef<string>>;
79
+ /**
80
+ * The raw translation catalog. Rarely needed in app code — prefer `useT()`.
81
+ * Exposed for advanced cases (inspecting which categories/phrases are loaded).
82
+ */
83
+ declare function useTranslations(): Readonly<ShallowRef<iCategories>>;
84
+ /**
85
+ * All-in-one convenience for the user-locale store. Creates one
86
+ * `Signal<string>` (the Vue analog of Svelte's `writable`), subscribes the
87
+ * current scope to it, and returns `{ locale, setLocale, store }`.
88
+ *
89
+ * const { locale, setLocale, store } = useLocaleStore('en-US');
90
+ * onMounted(() => {
91
+ * LangsysApp.init({ projectid, key, UserLocaleStore: store });
92
+ * });
93
+ *
94
+ * // template: <select :value="locale" @change="setLocale($event.target.value)">…
95
+ *
96
+ * `setup()` runs once per component instance, so the store is stable for the
97
+ * component's lifetime and safe to hand to `LangsysApp.init`.
98
+ */
99
+ declare function useLocaleStore(initial?: string): {
100
+ locale: Readonly<ShallowRef<string>>;
101
+ setLocale: (locale: string) => void;
102
+ store: Signal<string>;
103
+ };
104
+
105
+ /**
106
+ * Props for the Vue `Translate` component. Mirrors the React/Svelte components
107
+ * 1:1 — Vue passes `class` through native attribute fallthrough, so no
108
+ * `class`/`className` prop is declared.
109
+ */
110
+ interface TranslateProps {
111
+ /** Optional category under which tokens are registered. Helps translators disambiguate. */
112
+ category?: string;
113
+ /** Optional stable id for the content block. If omitted, the SDK hashes category + tokens. */
114
+ custom_id?: string;
115
+ /** Optional human-readable label shown in the Translation Manager. */
116
+ label?: string;
117
+ /** Host element tag. Defaults to a `<translate>` custom element. */
118
+ tag?: string;
119
+ /**
120
+ * Interpolation params for `{name}`-style placeholders in the content —
121
+ * same single-brace syntax as `t()`. In markup, author the placeholders as
122
+ * `%name%` (the base SDK normalizes `%name%` → `{name}` at capture); a bare
123
+ * `{name}` also works in Vue templates but collides with `{{ }}` and other
124
+ * frameworks, so `%name%` is the portable form.
125
+ */
126
+ params?: Record<string, ParamPrimitive>;
127
+ }
128
+ /**
129
+ * Vue wrapper around the vanilla `Translate` DOM class from
130
+ * `langsys-js-typescript`. It renders a host element, then on mount lets the
131
+ * vanilla class walk and tokenize the rendered children (text nodes plus
132
+ * translatable attributes), register the content block, and re-translate on
133
+ * locale change. On unmount it tears the instance down.
134
+ *
135
+ * This is the Vue analog of the React/Svelte `<Translate>` components — pure
136
+ * mount/destroy glue. The DOM walking, content-block registration, attribute
137
+ * harvesting, `%name%`→`{name}` normalization, and re-translation lifecycle all
138
+ * live in the base SDK.
139
+ *
140
+ * The SDK mutates the rendered DOM in place, so keep the children static:
141
+ * prose, marketing copy, CMS-rendered HTML — the content-block use case. For
142
+ * dynamic per-string values that Vue owns and re-renders, use `useT()` instead.
143
+ */
144
+ declare const Translate: vue.DefineComponent<vue.ExtractPropTypes<{
145
+ category: {
146
+ type: StringConstructor;
147
+ default: string;
148
+ };
149
+ custom_id: {
150
+ type: StringConstructor;
151
+ default: string;
152
+ };
153
+ label: {
154
+ type: StringConstructor;
155
+ default: string;
156
+ };
157
+ tag: {
158
+ type: StringConstructor;
159
+ default: string;
160
+ };
161
+ params: {
162
+ type: PropType<Record<string, ParamPrimitive>>;
163
+ default: undefined;
164
+ };
165
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
166
+ [key: string]: any;
167
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
168
+ category: {
169
+ type: StringConstructor;
170
+ default: string;
171
+ };
172
+ custom_id: {
173
+ type: StringConstructor;
174
+ default: string;
175
+ };
176
+ label: {
177
+ type: StringConstructor;
178
+ default: string;
179
+ };
180
+ tag: {
181
+ type: StringConstructor;
182
+ default: string;
183
+ };
184
+ params: {
185
+ type: PropType<Record<string, ParamPrimitive>>;
186
+ default: undefined;
187
+ };
188
+ }>> & Readonly<{}>, {
189
+ category: string;
190
+ custom_id: string;
191
+ label: string;
192
+ tag: string;
193
+ params: Record<string, ParamPrimitive>;
194
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
195
+
196
+ /**
197
+ * Props for the Vue `Phrase` component. Mirrors the React/Svelte components —
198
+ * `class` flows through native attribute fallthrough.
199
+ */
200
+ interface PhraseProps {
201
+ /** Category the phrase registers under (disambiguation for translators). */
202
+ category?: string;
203
+ /** Interpolation params — `{n}` for pluralization, `{name}`, etc. */
204
+ params?: Record<string, unknown>;
205
+ /** Host element tag. Defaults to `<span>`. */
206
+ tag?: string;
207
+ }
208
+ /**
209
+ * Vue wrapper around the vanilla `Phrase` rich-text handler.
210
+ *
211
+ * Use it to keep a markup-bearing run as ONE translatable phrase — e.g. so a
212
+ * count variable stays next to the noun it pluralizes:
213
+ *
214
+ * <Phrase category="ProductCard" :params="{ n: reviewCount }">
215
+ * Based on {n} <strong>reviews</strong>
216
+ * </Phrase>
217
+ *
218
+ * The inline markup never reaches the translator — it's replaced with neutral
219
+ * tokens and the real elements are reconstituted at render (see richtext.ts in
220
+ * the base SDK). The host carries `data-ls-phrase` so a wrapping `<Translate>`
221
+ * skips it and lets this handler own it.
222
+ *
223
+ * Keep children static (literal markup): the handler takes over the rendered
224
+ * subtree. For values Vue owns and re-renders, pass them through `params`.
225
+ */
226
+ declare const Phrase: vue.DefineComponent<vue.ExtractPropTypes<{
227
+ category: {
228
+ type: StringConstructor;
229
+ default: string;
230
+ };
231
+ params: {
232
+ type: PropType<Record<string, unknown>>;
233
+ default: () => {};
234
+ };
235
+ tag: {
236
+ type: StringConstructor;
237
+ default: string;
238
+ };
239
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
240
+ [key: string]: any;
241
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
242
+ category: {
243
+ type: StringConstructor;
244
+ default: string;
245
+ };
246
+ params: {
247
+ type: PropType<Record<string, unknown>>;
248
+ default: () => {};
249
+ };
250
+ tag: {
251
+ type: StringConstructor;
252
+ default: string;
253
+ };
254
+ }>> & Readonly<{}>, {
255
+ category: string;
256
+ tag: string;
257
+ params: Record<string, unknown>;
258
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
259
+
260
+ /**
261
+ * Props for the Vue `DontTranslate` component. Mirrors the React/Svelte
262
+ * components — `class` flows through native attribute fallthrough.
263
+ */
264
+ interface DontTranslateProps {
265
+ /** Host element tag. Defaults to `<span>`. */
266
+ tag?: string;
267
+ }
268
+ /**
269
+ * Marks a region as never-translated, preserved verbatim:
270
+ *
271
+ * Built with <DontTranslate>Kangen®</DontTranslate> on
272
+ * <DontTranslate>langsys.dev</DontTranslate>
273
+ *
274
+ * The host carries the standard `translate="no"` attribute, which both the
275
+ * tokenizer and the renderer in the base SDK already honor — so its content is
276
+ * never tokenized, registered, or replaced. Pure presentational glue; no
277
+ * vanilla handler needed.
278
+ */
279
+ declare const DontTranslate: vue.DefineComponent<vue.ExtractPropTypes<{
280
+ tag: {
281
+ type: StringConstructor;
282
+ default: string;
283
+ };
284
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
285
+ [key: string]: any;
286
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
287
+ tag: {
288
+ type: StringConstructor;
289
+ default: string;
290
+ };
291
+ }>> & Readonly<{}>, {
292
+ tag: string;
293
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
294
+
295
+ /**
296
+ * Vue-flavored init config. Identical to the base SDK's config except
297
+ * `UserLocaleStore` is typed as a `Signal<string>` — create one with
298
+ * `createLocaleStore()` (or get one from the `useLocaleStore` composable, or
299
+ * adapt an existing ref with `refToLocaleSource`). The base SDK only reads and
300
+ * subscribes to it.
301
+ */
302
+ interface iLangsysInitConfig extends Omit<iLangsysInitConfig$1, 'UserLocaleStore'> {
303
+ UserLocaleStore: Signal<string>;
304
+ }
305
+ /**
306
+ * Vue SDK entry point. Delegates everything to the underlying
307
+ * `langsys-js-typescript` singleton. Because the Vue locale store is already a
308
+ * `Signal` (unlike Svelte's `Writable`, which needs adapting), `init` is a
309
+ * straight passthrough — the Vue-native concerns live in the composables and
310
+ * the `<Translate>` component, not here.
311
+ */
312
+ declare class LangsysAppVue {
313
+ /** Initialize Langsys. Pass a `Signal<string>` (from `createLocaleStore`) as `UserLocaleStore`. */
314
+ init(config: iLangsysInitConfig): Promise<iLangsysResponse>;
315
+ get Translations(): langsys_js_typescript.Translations;
316
+ get translationsLoadingPromise(): Promise<unknown>;
317
+ /** Current translation function. Reads fresh state on every call (not reactive on its own — use `useT()` in components). */
318
+ get t(): TFunction;
319
+ get debug(): langsys_js_typescript.Logger;
320
+ refresh(): Promise<boolean>;
321
+ getCountries(inLocale?: string): Promise<iCountryList>;
322
+ getCountryName(forCountryCode: string, inLocale?: string): Promise<string>;
323
+ getCurrencies(inLocale?: string): Promise<iCurrencyList>;
324
+ getCurrencyName(forCurrencyCode: string, inLocale?: string): Promise<string>;
325
+ getDialCodes(inLocale?: string): Promise<iCountryDialCode[]>;
326
+ getLocales(inLocale?: string): Promise<iLocaleDefault>;
327
+ getLocalesFlat(inLocale?: string): Promise<iLocaleFlat[]>;
328
+ getLocalesData(inLocale?: string, forceRefresh?: boolean): Promise<iLocaleData[]>;
329
+ getLocalesFormat(format?: '' | 'flat' | 'data', inLocale?: string): Promise<iLocaleFlat[] | iLocaleDefault | iLocaleData[]>;
330
+ getLocaleName(forLocale: string, shortName?: boolean, inLocale?: string): string;
331
+ getLocaleNameWithLookup(forLocale: string, shortName?: boolean, inLocale?: string): Promise<string>;
332
+ /** @deprecated use `getLocaleNameWithLookup` or `getLocaleName` */
333
+ getLanguageName(forLocale: string, shortName?: boolean, inLocale?: string): Promise<string>;
334
+ detectPreferredLocale(acceptLanguageHeader?: string | null, supportedLocales?: string[]): string | false;
335
+ }
336
+ declare const LangsysApp: LangsysAppVue;
337
+
338
+ export { DontTranslate, type DontTranslateProps, LangsysApp, Phrase, type PhraseProps, Translate, type TranslateProps, createLocaleStore, type iLangsysInitConfig, refToLocaleSource, useCurrentLocale, useLocaleStore, useSignal, useT, useTranslations };
@@ -0,0 +1,338 @@
1
+ import * as langsys_js_typescript from 'langsys-js-typescript';
2
+ import { Signal, TFunction, iCategories, ParamPrimitive, iLangsysInitConfig as iLangsysInitConfig$1, iLangsysResponse, iCountryList, iCurrencyList, iCountryDialCode, iLocaleDefault, iLocaleFlat, iLocaleData } from 'langsys-js-typescript';
3
+ export { ExtractParamKeys, LangsysAppAPI, ParamPrimitive, ParamsFor, Signal, TArgs, TFunction, TranslationParams, canonicalizeLocale, createSignal, currentlyLoadedLocale, iCategories, iContentBlock, iCountry, iCountryDialCode, iCountryList, iCurrency, iCurrencyList, iLangsysResponse, iLanguageName, iLocaleData, iLocaleDefault, iLocaleFlat, iProject, iTranslations, sTranslations, tSignal as t } from 'langsys-js-typescript';
4
+ import * as vue from 'vue';
5
+ import { Ref, ShallowRef, PropType } from 'vue';
6
+
7
+ /**
8
+ * Subscribe the current effect scope to a base-SDK `Signal<T>` and return its
9
+ * value as a read-only shallow ref, updating whenever the signal changes.
10
+ *
11
+ * This is the Vue mirror of Svelte's `$store` auto-subscription and React's
12
+ * `useSignal` (`useSyncExternalStore`). The base SDK's `subscribe` fires
13
+ * synchronously with the current value and returns an unsubscribe function, so
14
+ * the ref is seeded immediately — server-side rendering sees the value the SDK
15
+ * seeded from `initialTranslations` with no flash of untranslated content.
16
+ *
17
+ * `shallowRef` is deliberate: signal payloads (`TFunction`, the catalog) must
18
+ * not be deeply proxied — the signal replaces the whole value on every change,
19
+ * which is exactly what a shallow ref tracks.
20
+ *
21
+ * When called inside a component `setup()` or an `effectScope`, the
22
+ * subscription is disposed with the scope. Outside any scope (module level),
23
+ * the subscription lives for the app's lifetime — fine for the SDK's global
24
+ * singletons, but prefer calling from `setup()`.
25
+ */
26
+ declare function useSignal<T>(signal: Signal<T>): Readonly<ShallowRef<T>>;
27
+ /**
28
+ * Create a reactive `Signal<string>` to hold the user's selected locale — the
29
+ * Vue analog of Svelte's `writable('en-US')`.
30
+ *
31
+ * Pass the result as `UserLocaleStore` to `LangsysApp.init`, read it reactively
32
+ * with `useSignal(store)` (or use the all-in-one `useLocaleStore` composable),
33
+ * and switch locale with `store.set('fr-FR')`. The base SDK only ever reads and
34
+ * subscribes to it — it never writes.
35
+ *
36
+ * Locale identifiers are canonicalized to BCP 47 by the base SDK (v0.3.0+), so
37
+ * `'en-us'` still works on input — but `currentlyLoadedLocale` always emits the
38
+ * canonical form (`'en-US'`), so prefer canonical casing to keep comparisons
39
+ * against it straightforward.
40
+ */
41
+ declare function createLocaleStore(initial?: string): Signal<string>;
42
+ /**
43
+ * Adapt an existing Vue `Ref<string>` into the SDK's `Signal<string>` contract
44
+ * — the Vue analog of the Svelte wrapper's `adaptStore(writable)`.
45
+ *
46
+ * Use this when your app already owns the locale in a ref (Pinia state, a
47
+ * composable, Nuxt's `useState`) and you want the SDK to react to it directly:
48
+ *
49
+ * const locale = ref('en-US');
50
+ * LangsysApp.init({ ..., UserLocaleStore: refToLocaleSource(locale) });
51
+ * locale.value = 'fr-FR'; // SDK loads French
52
+ *
53
+ * The watcher uses `flush: 'sync'` to preserve the Signal contract the SDK
54
+ * relies on (synchronous notification, immediate first fire). The returned
55
+ * unsubscriber stops the watcher.
56
+ */
57
+ declare function refToLocaleSource(localeRef: Ref<string>): Signal<string>;
58
+
59
+ /**
60
+ * The current translation function as a reactive ref, updating whenever
61
+ * translations or the loaded locale change. This is the Vue analog of Svelte's
62
+ * `$t` store read and React's `useT()`.
63
+ *
64
+ * const t = useT();
65
+ * // template: <h1>{{ t('Welcome to my app', 'UI') }}</h1> (auto-unwrapped)
66
+ * // script: t.value('Welcome to my app', 'UI')
67
+ *
68
+ * The phrase is both the lookup key and the base-language default. Signature:
69
+ * `t(phrase, category?, params?)`. Placeholder names in the phrase are
70
+ * type-checked against the params object at the call site.
71
+ */
72
+ declare function useT(): Readonly<ShallowRef<TFunction>>;
73
+ /**
74
+ * The locale whose translations are currently loaded. This lags the
75
+ * user-selected locale (`UserLocaleStore`) until the fetch for the new locale
76
+ * settles, which makes it the right value to gate "translations are ready" UI on.
77
+ */
78
+ declare function useCurrentLocale(): Readonly<ShallowRef<string>>;
79
+ /**
80
+ * The raw translation catalog. Rarely needed in app code — prefer `useT()`.
81
+ * Exposed for advanced cases (inspecting which categories/phrases are loaded).
82
+ */
83
+ declare function useTranslations(): Readonly<ShallowRef<iCategories>>;
84
+ /**
85
+ * All-in-one convenience for the user-locale store. Creates one
86
+ * `Signal<string>` (the Vue analog of Svelte's `writable`), subscribes the
87
+ * current scope to it, and returns `{ locale, setLocale, store }`.
88
+ *
89
+ * const { locale, setLocale, store } = useLocaleStore('en-US');
90
+ * onMounted(() => {
91
+ * LangsysApp.init({ projectid, key, UserLocaleStore: store });
92
+ * });
93
+ *
94
+ * // template: <select :value="locale" @change="setLocale($event.target.value)">…
95
+ *
96
+ * `setup()` runs once per component instance, so the store is stable for the
97
+ * component's lifetime and safe to hand to `LangsysApp.init`.
98
+ */
99
+ declare function useLocaleStore(initial?: string): {
100
+ locale: Readonly<ShallowRef<string>>;
101
+ setLocale: (locale: string) => void;
102
+ store: Signal<string>;
103
+ };
104
+
105
+ /**
106
+ * Props for the Vue `Translate` component. Mirrors the React/Svelte components
107
+ * 1:1 — Vue passes `class` through native attribute fallthrough, so no
108
+ * `class`/`className` prop is declared.
109
+ */
110
+ interface TranslateProps {
111
+ /** Optional category under which tokens are registered. Helps translators disambiguate. */
112
+ category?: string;
113
+ /** Optional stable id for the content block. If omitted, the SDK hashes category + tokens. */
114
+ custom_id?: string;
115
+ /** Optional human-readable label shown in the Translation Manager. */
116
+ label?: string;
117
+ /** Host element tag. Defaults to a `<translate>` custom element. */
118
+ tag?: string;
119
+ /**
120
+ * Interpolation params for `{name}`-style placeholders in the content —
121
+ * same single-brace syntax as `t()`. In markup, author the placeholders as
122
+ * `%name%` (the base SDK normalizes `%name%` → `{name}` at capture); a bare
123
+ * `{name}` also works in Vue templates but collides with `{{ }}` and other
124
+ * frameworks, so `%name%` is the portable form.
125
+ */
126
+ params?: Record<string, ParamPrimitive>;
127
+ }
128
+ /**
129
+ * Vue wrapper around the vanilla `Translate` DOM class from
130
+ * `langsys-js-typescript`. It renders a host element, then on mount lets the
131
+ * vanilla class walk and tokenize the rendered children (text nodes plus
132
+ * translatable attributes), register the content block, and re-translate on
133
+ * locale change. On unmount it tears the instance down.
134
+ *
135
+ * This is the Vue analog of the React/Svelte `<Translate>` components — pure
136
+ * mount/destroy glue. The DOM walking, content-block registration, attribute
137
+ * harvesting, `%name%`→`{name}` normalization, and re-translation lifecycle all
138
+ * live in the base SDK.
139
+ *
140
+ * The SDK mutates the rendered DOM in place, so keep the children static:
141
+ * prose, marketing copy, CMS-rendered HTML — the content-block use case. For
142
+ * dynamic per-string values that Vue owns and re-renders, use `useT()` instead.
143
+ */
144
+ declare const Translate: vue.DefineComponent<vue.ExtractPropTypes<{
145
+ category: {
146
+ type: StringConstructor;
147
+ default: string;
148
+ };
149
+ custom_id: {
150
+ type: StringConstructor;
151
+ default: string;
152
+ };
153
+ label: {
154
+ type: StringConstructor;
155
+ default: string;
156
+ };
157
+ tag: {
158
+ type: StringConstructor;
159
+ default: string;
160
+ };
161
+ params: {
162
+ type: PropType<Record<string, ParamPrimitive>>;
163
+ default: undefined;
164
+ };
165
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
166
+ [key: string]: any;
167
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
168
+ category: {
169
+ type: StringConstructor;
170
+ default: string;
171
+ };
172
+ custom_id: {
173
+ type: StringConstructor;
174
+ default: string;
175
+ };
176
+ label: {
177
+ type: StringConstructor;
178
+ default: string;
179
+ };
180
+ tag: {
181
+ type: StringConstructor;
182
+ default: string;
183
+ };
184
+ params: {
185
+ type: PropType<Record<string, ParamPrimitive>>;
186
+ default: undefined;
187
+ };
188
+ }>> & Readonly<{}>, {
189
+ category: string;
190
+ custom_id: string;
191
+ label: string;
192
+ tag: string;
193
+ params: Record<string, ParamPrimitive>;
194
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
195
+
196
+ /**
197
+ * Props for the Vue `Phrase` component. Mirrors the React/Svelte components —
198
+ * `class` flows through native attribute fallthrough.
199
+ */
200
+ interface PhraseProps {
201
+ /** Category the phrase registers under (disambiguation for translators). */
202
+ category?: string;
203
+ /** Interpolation params — `{n}` for pluralization, `{name}`, etc. */
204
+ params?: Record<string, unknown>;
205
+ /** Host element tag. Defaults to `<span>`. */
206
+ tag?: string;
207
+ }
208
+ /**
209
+ * Vue wrapper around the vanilla `Phrase` rich-text handler.
210
+ *
211
+ * Use it to keep a markup-bearing run as ONE translatable phrase — e.g. so a
212
+ * count variable stays next to the noun it pluralizes:
213
+ *
214
+ * <Phrase category="ProductCard" :params="{ n: reviewCount }">
215
+ * Based on {n} <strong>reviews</strong>
216
+ * </Phrase>
217
+ *
218
+ * The inline markup never reaches the translator — it's replaced with neutral
219
+ * tokens and the real elements are reconstituted at render (see richtext.ts in
220
+ * the base SDK). The host carries `data-ls-phrase` so a wrapping `<Translate>`
221
+ * skips it and lets this handler own it.
222
+ *
223
+ * Keep children static (literal markup): the handler takes over the rendered
224
+ * subtree. For values Vue owns and re-renders, pass them through `params`.
225
+ */
226
+ declare const Phrase: vue.DefineComponent<vue.ExtractPropTypes<{
227
+ category: {
228
+ type: StringConstructor;
229
+ default: string;
230
+ };
231
+ params: {
232
+ type: PropType<Record<string, unknown>>;
233
+ default: () => {};
234
+ };
235
+ tag: {
236
+ type: StringConstructor;
237
+ default: string;
238
+ };
239
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
240
+ [key: string]: any;
241
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
242
+ category: {
243
+ type: StringConstructor;
244
+ default: string;
245
+ };
246
+ params: {
247
+ type: PropType<Record<string, unknown>>;
248
+ default: () => {};
249
+ };
250
+ tag: {
251
+ type: StringConstructor;
252
+ default: string;
253
+ };
254
+ }>> & Readonly<{}>, {
255
+ category: string;
256
+ tag: string;
257
+ params: Record<string, unknown>;
258
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
259
+
260
+ /**
261
+ * Props for the Vue `DontTranslate` component. Mirrors the React/Svelte
262
+ * components — `class` flows through native attribute fallthrough.
263
+ */
264
+ interface DontTranslateProps {
265
+ /** Host element tag. Defaults to `<span>`. */
266
+ tag?: string;
267
+ }
268
+ /**
269
+ * Marks a region as never-translated, preserved verbatim:
270
+ *
271
+ * Built with <DontTranslate>Kangen®</DontTranslate> on
272
+ * <DontTranslate>langsys.dev</DontTranslate>
273
+ *
274
+ * The host carries the standard `translate="no"` attribute, which both the
275
+ * tokenizer and the renderer in the base SDK already honor — so its content is
276
+ * never tokenized, registered, or replaced. Pure presentational glue; no
277
+ * vanilla handler needed.
278
+ */
279
+ declare const DontTranslate: vue.DefineComponent<vue.ExtractPropTypes<{
280
+ tag: {
281
+ type: StringConstructor;
282
+ default: string;
283
+ };
284
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
285
+ [key: string]: any;
286
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
287
+ tag: {
288
+ type: StringConstructor;
289
+ default: string;
290
+ };
291
+ }>> & Readonly<{}>, {
292
+ tag: string;
293
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
294
+
295
+ /**
296
+ * Vue-flavored init config. Identical to the base SDK's config except
297
+ * `UserLocaleStore` is typed as a `Signal<string>` — create one with
298
+ * `createLocaleStore()` (or get one from the `useLocaleStore` composable, or
299
+ * adapt an existing ref with `refToLocaleSource`). The base SDK only reads and
300
+ * subscribes to it.
301
+ */
302
+ interface iLangsysInitConfig extends Omit<iLangsysInitConfig$1, 'UserLocaleStore'> {
303
+ UserLocaleStore: Signal<string>;
304
+ }
305
+ /**
306
+ * Vue SDK entry point. Delegates everything to the underlying
307
+ * `langsys-js-typescript` singleton. Because the Vue locale store is already a
308
+ * `Signal` (unlike Svelte's `Writable`, which needs adapting), `init` is a
309
+ * straight passthrough — the Vue-native concerns live in the composables and
310
+ * the `<Translate>` component, not here.
311
+ */
312
+ declare class LangsysAppVue {
313
+ /** Initialize Langsys. Pass a `Signal<string>` (from `createLocaleStore`) as `UserLocaleStore`. */
314
+ init(config: iLangsysInitConfig): Promise<iLangsysResponse>;
315
+ get Translations(): langsys_js_typescript.Translations;
316
+ get translationsLoadingPromise(): Promise<unknown>;
317
+ /** Current translation function. Reads fresh state on every call (not reactive on its own — use `useT()` in components). */
318
+ get t(): TFunction;
319
+ get debug(): langsys_js_typescript.Logger;
320
+ refresh(): Promise<boolean>;
321
+ getCountries(inLocale?: string): Promise<iCountryList>;
322
+ getCountryName(forCountryCode: string, inLocale?: string): Promise<string>;
323
+ getCurrencies(inLocale?: string): Promise<iCurrencyList>;
324
+ getCurrencyName(forCurrencyCode: string, inLocale?: string): Promise<string>;
325
+ getDialCodes(inLocale?: string): Promise<iCountryDialCode[]>;
326
+ getLocales(inLocale?: string): Promise<iLocaleDefault>;
327
+ getLocalesFlat(inLocale?: string): Promise<iLocaleFlat[]>;
328
+ getLocalesData(inLocale?: string, forceRefresh?: boolean): Promise<iLocaleData[]>;
329
+ getLocalesFormat(format?: '' | 'flat' | 'data', inLocale?: string): Promise<iLocaleFlat[] | iLocaleDefault | iLocaleData[]>;
330
+ getLocaleName(forLocale: string, shortName?: boolean, inLocale?: string): string;
331
+ getLocaleNameWithLookup(forLocale: string, shortName?: boolean, inLocale?: string): Promise<string>;
332
+ /** @deprecated use `getLocaleNameWithLookup` or `getLocaleName` */
333
+ getLanguageName(forLocale: string, shortName?: boolean, inLocale?: string): Promise<string>;
334
+ detectPreferredLocale(acceptLanguageHeader?: string | null, supportedLocales?: string[]): string | false;
335
+ }
336
+ declare const LangsysApp: LangsysAppVue;
337
+
338
+ export { DontTranslate, type DontTranslateProps, LangsysApp, Phrase, type PhraseProps, Translate, type TranslateProps, createLocaleStore, type iLangsysInitConfig, refToLocaleSource, useCurrentLocale, useLocaleStore, useSignal, useT, useTranslations };