@fluenti/vue 0.3.4 → 0.4.0-rc.1

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.
package/dist/index.d.ts CHANGED
@@ -2,15 +2,10 @@ export { createFluenti, FLUENTI_KEY } from './plugin';
2
2
  export type { FluentiConfig, FluentiPlugin, FluentiContext } from './plugin';
3
3
  export { useI18n } from './use-i18n';
4
4
  export { t } from './compile-time-t';
5
- export { Trans } from './components/Trans';
5
+ export { msg } from './msg';
6
6
  export type { FluentiTransProps } from './components/Trans';
7
- export { Plural } from './components/Plural';
8
7
  export type { FluentiPluralProps } from './components/Plural';
9
- export { Select } from './components/Select';
10
8
  export type { FluentiSelectProps } from './components/Select';
11
- export { DateTime } from './components/DateTime';
12
9
  export type { FluentiDateTimeProps } from './components/DateTime';
13
- export { NumberFormat } from './components/NumberFormat';
14
10
  export type { FluentiNumberFormatProps } from './components/NumberFormat';
15
- export { msg } from './msg';
16
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAI3B,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA"}
package/dist/index.js CHANGED
@@ -1,420 +1,194 @@
1
- import { Comment as e, Text as t, defineComponent as n, h as r, inject as i, isVNode as a, ref as o, shallowReactive as s } from "vue";
2
- import { createDiagnostics as c, formatDate as l, formatNumber as u, msg as d } from "@fluenti/core";
3
- import { PLURAL_CATEGORIES as f, buildICUMessage as p, buildICUPluralMessage as m, buildICUSelectMessage as h, hashMessage as g, interpolate as _, normalizeSelectForms as v, offsetIndices as y, resolveDescriptorId as b } from "@fluenti/core/internal";
4
- //#region src/use-i18n.ts
5
- function x() {
6
- let e = i(P);
7
- if (!e) throw Error("[fluenti] useI18n() requires createFluenti plugin");
8
- return e;
9
- }
10
- //#endregion
11
- //#region src/components/rich-text.ts
12
- function S(n) {
13
- let r = [], i = "";
14
- function o(n) {
15
- if (n == null || typeof n == "boolean") return;
16
- if (Array.isArray(n)) {
17
- for (let e of n) o(e);
18
- return;
19
- }
20
- if (typeof n == "string" || typeof n == "number") {
21
- i += String(n);
22
- return;
23
- }
24
- if (!a(n) || n.type === e) return;
25
- if (n.type === t) {
26
- i += typeof n.children == "string" ? n.children : "";
27
- return;
28
- }
29
- let s = r.length, c = S(n.children);
30
- r.push(n), r.push(...c.components), i += `<${s}>${y(c.message, s + 1)}</${s}>`;
31
- }
32
- return o(n), {
33
- message: i,
34
- components: r
35
- };
36
- }
37
- function C(e, t) {
38
- let n = /<(\d+)>([\s\S]*?)<\/\1>/g, i = [], a = 0, o;
39
- for (n.lastIndex = 0, o = n.exec(e); o !== null;) {
40
- o.index > a && i.push(e.slice(a, o.index));
41
- let s = t[Number(o[1])], c = C(o[2], t);
42
- s ? i.push(r(s.type, s.props ?? {}, Array.isArray(c) ? c : [c])) : i.push(o[2]), a = n.lastIndex, o = n.exec(e);
43
- }
44
- return a < e.length && i.push(e.slice(a)), i.length <= 1 ? i[0] ?? "" : i;
45
- }
46
- function w(e, t) {
47
- let n = {}, r = [];
48
- for (let i of e) {
49
- let e = t[i];
50
- if (e === void 0) continue;
51
- let a = S(e);
52
- n[i] = y(a.message, r.length), r.push(...a.components);
53
- }
54
- for (let [i, a] of Object.entries(t)) {
55
- if (e.includes(i) || a === void 0) continue;
56
- let t = S(a);
57
- n[i] = y(t.message, r.length), r.push(...t.components);
58
- }
59
- return {
60
- messages: n,
61
- components: r
62
- };
63
- }
64
- var T = n({
65
- name: "Trans",
66
- props: {
67
- id: String,
68
- context: String,
69
- comment: String,
70
- tag: {
71
- type: String,
72
- default: void 0
73
- }
74
- },
75
- setup(e, { slots: t }) {
76
- let { t: n } = x();
77
- return () => {
78
- let i = t.default?.();
79
- if (!i) return null;
80
- let { message: a, components: o } = S(i), s = n({
81
- ...e.id === void 0 ? {} : { id: e.id },
82
- message: a,
83
- ...e.context === void 0 ? {} : { context: e.context },
84
- ...e.comment === void 0 ? {} : { comment: e.comment }
85
- }), c = o.length > 0 ? C(s, o) : s;
86
- return Array.isArray(c) ? c.length === 1 ? c[0] : e.tag ? r(e.tag, null, c) : c : c;
87
- };
88
- }
89
- }), E = n({
90
- name: "Plural",
91
- props: {
92
- value: {
93
- type: Number,
94
- required: !0
95
- },
96
- id: String,
97
- context: String,
98
- comment: String,
99
- zero: String,
100
- one: String,
101
- two: String,
102
- few: String,
103
- many: String,
104
- other: {
105
- type: String,
106
- required: !0
107
- },
108
- offset: Number,
109
- tag: {
110
- type: String,
111
- default: void 0
112
- }
113
- },
114
- setup(e, { slots: t }) {
115
- let { t: n } = x();
116
- return () => {
117
- let i = {
118
- zero: e.zero,
119
- one: e.one,
120
- two: e.two,
121
- few: e.few,
122
- many: e.many,
123
- other: e.other
124
- };
125
- for (let e of f) {
126
- let n = t[e];
127
- n && (i[e] = n({ count: "#" }));
128
- }
129
- let { messages: a, components: o } = w(f, i), s = m({
130
- ...a.zero !== void 0 && { zero: a.zero },
131
- ...a.one !== void 0 && { one: a.one },
132
- ...a.two !== void 0 && { two: a.two },
133
- ...a.few !== void 0 && { few: a.few },
134
- ...a.many !== void 0 && { many: a.many },
135
- other: a.other ?? ""
136
- }, e.offset), c = n({
137
- id: e.id ?? (e.context === void 0 ? s : g(s, e.context)),
138
- message: s,
139
- ...e.context === void 0 ? {} : { context: e.context },
140
- ...e.comment === void 0 ? {} : { comment: e.comment }
141
- }, { count: e.value }), l = o.length > 0 ? C(c, o) : c;
142
- return e.tag ? r(e.tag, void 0, l ?? void 0) : l ?? null;
143
- };
144
- }
145
- }), D = n({
146
- name: "Select",
147
- inheritAttrs: !1,
148
- props: {
149
- value: {
150
- type: String,
151
- required: !0
152
- },
153
- id: String,
154
- context: String,
155
- comment: String,
156
- other: {
157
- type: String,
158
- required: !0
159
- },
160
- options: {
161
- type: Object,
162
- default: void 0
163
- },
164
- tag: {
165
- type: String,
166
- default: void 0
167
- }
168
- },
169
- setup(e, { attrs: t, slots: n }) {
170
- let { t: i } = x();
171
- return () => {
172
- let a = {};
173
- if (e.options !== void 0) {
174
- for (let [t, n] of Object.entries(e.options)) a[t] = n;
175
- a.other = e.other;
176
- } else {
177
- for (let [e, n] of Object.entries(t)) typeof n == "string" && (a[e] = n);
178
- a.other = e.other;
179
- }
180
- for (let [e, t] of Object.entries(n)) e === "default" || !t || (a[e] = t({ value: "{value}" }));
181
- let o = [...Object.keys(a).filter((e) => e !== "other"), "other"], { messages: s, components: c } = w(o, a), l = v(Object.fromEntries([...o].map((e) => [e, s[e] ?? ""]))), u = h(l.forms), d = i({
182
- id: e.id ?? (e.context === void 0 ? u : g(u, e.context)),
183
- message: u,
184
- ...e.context === void 0 ? {} : { context: e.context },
185
- ...e.comment === void 0 ? {} : { comment: e.comment }
186
- }, { value: l.valueMap[e.value] ?? "other" }), f = c.length > 0 ? C(d, c) : d;
187
- return e.tag ? r(e.tag, void 0, f ?? void 0) : f ?? null;
188
- };
189
- }
190
- }), O = n({
191
- name: "DateTime",
192
- props: {
193
- value: {
194
- type: [Date, Number],
195
- required: !0
196
- },
197
- format: {
198
- type: String,
199
- default: void 0
200
- },
201
- tag: {
202
- type: String,
203
- default: "span"
204
- }
205
- },
206
- setup(e) {
207
- let { d: t } = x();
208
- return () => r(e.tag, t(e.value, e.format));
209
- }
210
- }), k = n({
211
- name: "NumberFormat",
212
- props: {
213
- value: {
214
- type: Number,
215
- required: !0
216
- },
217
- format: {
218
- type: String,
219
- default: void 0
220
- },
221
- tag: {
222
- type: String,
223
- default: "span"
224
- }
225
- },
226
- setup(e) {
227
- let { n: t } = x();
228
- return () => r(e.tag, t(e.value, e.format));
229
- }
230
- });
231
- //#endregion
1
+ import { n as e, t } from "./use-i18n-DrhdlExQ.js";
2
+ import { ref as n, shallowReactive as r } from "vue";
3
+ import { createFluentiCore as i, msg as a } from "@fluenti/core";
232
4
  //#region src/plugin.ts
233
- function A(e) {
5
+ function o(e) {
234
6
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
235
7
  }
236
- var j = Symbol.for("fluenti.runtime.vue.v1");
237
- function M() {
238
- let e = globalThis[j];
8
+ var s = Symbol.for("fluenti.runtime.vue.v1");
9
+ function c() {
10
+ let e = globalThis[s];
239
11
  return typeof e == "object" && e ? e : null;
240
12
  }
241
- function N(e) {
13
+ function l(e) {
242
14
  return typeof e == "object" && e && "default" in e ? e.default : e;
243
15
  }
244
- var P = Symbol("fluenti");
245
- function F(e, t, n) {
246
- return typeof e == "function" ? e(t) : _(e, t, n);
247
- }
248
- function I(e) {
16
+ function u(e) {
249
17
  let t = Object.keys(e).filter((e) => e !== "plural");
250
18
  return t.length > 0 ? t[0] : void 0;
251
19
  }
252
- function L(e) {
253
- let t = e.lazyLocaleLoading ?? e.splitting ?? !1, n = e.diagnostics ? c(e.diagnostics) : void 0, r = o(e.locale), i = s({ ...e.messages }), a = o(!1), d = new Set([e.locale]), f = o(new Set(d));
254
- function m(e, t) {
255
- let n = i[e];
20
+ function d(t) {
21
+ let a = t.lazyLocaleLoading ?? t.splitting ?? !1, s = {
22
+ locale: t.locale,
23
+ messages: t.messages ?? {}
24
+ };
25
+ t.fallbackLocale !== void 0 && (s.fallbackLocale = t.fallbackLocale), t.fallbackChain !== void 0 && (s.fallbackChain = t.fallbackChain), t.dateFormats !== void 0 && (s.dateFormats = t.dateFormats), t.numberFormats !== void 0 && (s.numberFormats = t.numberFormats), t.missing !== void 0 && (s.missing = t.missing), t.diagnostics !== void 0 && (s.diagnostics = t.diagnostics), t.interpolate !== void 0 && (s.interpolate = t.interpolate);
26
+ let d = i(s), f = n(t.locale), p = r({ ...t.messages }), m = n(!1), h = new Set([t.locale]), g = n(new Set(h));
27
+ function _(e, t) {
28
+ let n = p[e];
256
29
  if (n) return n[t];
257
30
  }
258
- function h(t, ...i) {
259
- if (Array.isArray(t) && "raw" in t) return h(p(t, i), Object.fromEntries(i.map((e, t) => [`arg${t}`, e])));
260
- let a = t, o = i[0], s, c;
261
- typeof a == "object" && a ? (s = b(a) ?? "", c = a.message) : s = a;
262
- let l = r.value, u = [l];
263
- if (e.fallbackLocale && !u.includes(e.fallbackLocale) && u.push(e.fallbackLocale), e.fallbackChain?.[l]) for (let t of e.fallbackChain[l]) u.includes(t) || u.push(t);
264
- else if (e.fallbackChain?.["*"]) for (let t of e.fallbackChain["*"]) u.includes(t) || u.push(t);
265
- for (let e of u) {
266
- let t = m(e, s);
267
- if (t !== void 0) return e !== l && n?.fallbackUsed(l, e, s), F(t, o, e);
268
- }
269
- if (n?.missingKey(l, s), e.missing) try {
270
- let t = e.missing(l, s);
271
- if (t !== void 0) return t;
272
- } catch {}
273
- return c ? _(c, o, l) : s.includes("{") ? _(s, o, l) : s;
31
+ function v() {
32
+ d.locale !== f.value && (d.locale = f.value);
33
+ }
34
+ function y(e, ...t) {
35
+ return p[f.value], v(), Array.isArray(e) && "raw" in e ? d.t(e, ...t) : d.t(e, t[0]);
274
36
  }
275
- let g = 0;
276
- async function v(n) {
277
- if (!t || !e.chunkLoader) {
278
- r.value = n;
37
+ let b = 0;
38
+ async function x(e) {
39
+ if (!a || !t.chunkLoader) {
40
+ d.locale = e, f.value = e;
279
41
  return;
280
42
  }
281
- let o = M();
282
- if (d.has(n)) {
283
- o?.__switchLocale && await o.__switchLocale(n), r.value = n;
43
+ let n = c();
44
+ if (h.has(e)) {
45
+ try {
46
+ n?.__switchLocale && await n.__switchLocale(e);
47
+ } catch (t) {
48
+ console.warn(`[fluenti] split runtime switch failed for locale "${e}"`, t);
49
+ }
50
+ d.locale = e, f.value = e;
284
51
  return;
285
52
  }
286
- let s = ++g;
287
- a.value = !0;
53
+ let r = ++b;
54
+ m.value = !0;
288
55
  try {
289
- let t = N(await e.chunkLoader(n));
290
- if (s !== g || (i[n] = {
291
- ...i[n],
292
- ...t
293
- }, d.add(n), f.value = new Set(d), o?.__switchLocale && await o.__switchLocale(n), s !== g)) return;
294
- r.value = n;
56
+ let i = l(await t.chunkLoader(e));
57
+ if (r !== b) return;
58
+ p[e] = {
59
+ ...p[e],
60
+ ...i
61
+ }, d.loadMessages(e, i), h.add(e), g.value = new Set(h);
62
+ try {
63
+ n?.__switchLocale && await n.__switchLocale(e);
64
+ } catch (t) {
65
+ console.warn(`[fluenti] split runtime switch failed for locale "${e}"`, t);
66
+ }
67
+ if (r !== b) return;
68
+ d.locale = e, f.value = e;
295
69
  } finally {
296
- s === g && (a.value = !1);
70
+ r === b && (m.value = !1);
297
71
  }
298
72
  }
299
- function y(e, t) {
300
- i[e] = {
301
- ...i[e],
73
+ function S(e, t) {
74
+ p[e] = {
75
+ ...p[e],
302
76
  ...t
303
- }, d.add(e), f.value = new Set(d);
304
- }
305
- let x = /* @__PURE__ */ new Set();
306
- function S(n) {
307
- if (!t || d.has(n) || !e.chunkLoader || x.has(n)) return;
308
- x.add(n);
309
- let r = M();
310
- e.chunkLoader(n).then(async (e) => {
311
- let t = N(e);
312
- i[n] = {
313
- ...i[n],
314
- ...t
315
- }, d.add(n), f.value = new Set(d), r?.__preloadLocale && await r.__preloadLocale(n);
316
- }).catch((e) => {
317
- console.warn("[fluenti] preload failed:", n, e);
77
+ }, d.loadMessages(e, t), h.add(e), g.value = new Set(h);
78
+ }
79
+ let C = /* @__PURE__ */ new Set();
80
+ function w(e) {
81
+ if (!a || h.has(e) || !t.chunkLoader || C.has(e)) return;
82
+ C.add(e);
83
+ let n = c();
84
+ t.chunkLoader(e).then(async (t) => {
85
+ let r = l(t);
86
+ p[e] = {
87
+ ...p[e],
88
+ ...r
89
+ }, d.loadMessages(e, r), h.add(e), g.value = new Set(h), n?.__preloadLocale && await n.__preloadLocale(e);
90
+ }).catch((t) => {
91
+ console.warn("[fluenti] preload failed:", e, t);
318
92
  }).finally(() => {
319
- x.delete(n);
93
+ C.delete(e);
320
94
  });
321
95
  }
322
- function C() {
323
- return Object.keys(i);
96
+ function T() {
97
+ return v(), d.getLocales();
324
98
  }
325
- function w(t, n) {
326
- let i = r.value;
327
- return l(t, i, n, e.dateFormats);
99
+ function E(e, t) {
100
+ return f.value, v(), d.d(e, t);
328
101
  }
329
- function j(t, n) {
330
- let i = r.value;
331
- return u(t, i, n, e.numberFormats);
102
+ function D(e, t) {
103
+ return f.value, v(), d.n(e, t);
332
104
  }
333
- function L(e, t) {
334
- return F(e, t, r.value);
105
+ function O(e, t) {
106
+ return f.value, v(), d.format(e, t);
335
107
  }
336
- function R(e, t, n) {
337
- let r = A(n ? h(e, n) : h(e));
108
+ function k(e, t, n) {
109
+ let r = o(n ? y(e, n) : y(e));
338
110
  function i(e) {
339
111
  if (e.rawAttrs != null && e.rawAttrs !== "") {
340
112
  let t = [], n = /([\w:@.!-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g, r;
341
113
  for (; (r = n.exec(e.rawAttrs)) !== null;) {
342
- let e = A(r[1]), n = r[2] ?? r[3];
343
- t.push(n === void 0 ? e : `${e}="${A(n)}"`);
114
+ let e = o(r[1]), n = r[2] ?? r[3];
115
+ t.push(n === void 0 ? e : `${e}="${o(n)}"`);
344
116
  }
345
117
  return t.join(" ");
346
118
  }
347
- return e.attrs ? Object.entries(e.attrs).map(([e, t]) => t ? `${A(e)}="${A(t)}"` : A(e)).join(" ") : "";
119
+ return e.attrs ? Object.entries(e.attrs).map(([e, t]) => t ? `${o(e)}="${o(t)}"` : o(e)).join(" ") : "";
348
120
  }
349
121
  let a = r.replace(/&lt;(\d+)\/&gt;/g, (e, n) => {
350
122
  let r = t[Number(n)];
351
123
  if (!r) return "";
352
- let a = A(r.tag), o = i(r);
353
- return `<${a}${o ? " " + o : ""} />`;
124
+ let a = o(r.tag), s = i(r);
125
+ return `<${a}${s ? " " + s : ""} />`;
354
126
  });
355
127
  return a = a.replace(/&lt;(\d+)&gt;([\s\S]*?)&lt;\/\1&gt;/g, (e, n, r) => {
356
128
  let a = t[Number(n)];
357
129
  if (!a) return r;
358
- let o = A(a.tag), s = i(a);
359
- return `<${o}${s ? " " + s : ""}>${r}</${o}>`;
130
+ let s = o(a.tag), c = i(a);
131
+ return `<${s}${c ? " " + c : ""}>${r}</${s}>`;
360
132
  }), a;
361
133
  }
362
- function z(e, t) {
363
- return m(t ?? r.value, e) !== void 0;
364
- }
365
- function B(e, t) {
366
- return m(t ?? r.value, e);
367
- }
368
- let V = {
369
- t: h,
370
- locale: r,
371
- setLocale: v,
372
- loadMessages: y,
373
- getLocales: C,
374
- d: w,
375
- n: j,
376
- format: L,
377
- isLoading: a,
378
- loadedLocales: f,
379
- preloadLocale: S,
380
- te: z,
381
- tm: B
134
+ function A(e, t) {
135
+ return _(t ?? f.value, e) !== void 0;
136
+ }
137
+ function j(e, t) {
138
+ return _(t ?? f.value, e);
139
+ }
140
+ let M = {
141
+ t: y,
142
+ locale: f,
143
+ setLocale: x,
144
+ loadMessages: S,
145
+ getLocales: T,
146
+ d: E,
147
+ n: D,
148
+ format: O,
149
+ isLoading: m,
150
+ loadedLocales: g,
151
+ preloadLocale: w,
152
+ te: A,
153
+ tm: j
382
154
  };
383
155
  return {
384
- install(t) {
385
- t.provide(P, V);
386
- let n = e.componentPrefix ?? "";
387
- t.component(`${n}Trans`, T), t.component(`${n}Plural`, E), t.component(`${n}Select`, D), t.component(`${n}DateTime`, O), t.component(`${n}NumberFormat`, k), e.injectGlobalProperties !== !1 && (t.config.globalProperties.$t = h, t.config.globalProperties.$d = w, t.config.globalProperties.$n = j, t.config.globalProperties.$vtRich = R);
156
+ install(n) {
157
+ if (n.provide(e, M), t.components) {
158
+ let e = t.componentPrefix ?? "", r = t.components;
159
+ r.Trans && n.component(`${e}Trans`, r.Trans), r.Plural && n.component(`${e}Plural`, r.Plural), r.Select && n.component(`${e}Select`, r.Select), r.DateTime && n.component(`${e}DateTime`, r.DateTime), r.NumberFormat && n.component(`${e}NumberFormat`, r.NumberFormat);
160
+ }
161
+ t.injectGlobalProperties !== !1 && (n.config.globalProperties.$t = y, n.config.globalProperties.$d = E, n.config.globalProperties.$n = D, n.config.globalProperties.$vtRich = k);
388
162
  let r = /* @__PURE__ */ new WeakMap();
389
- t.directive("t", {
163
+ n.directive("t", {
390
164
  mounted(e, t) {
391
- let n = I(t.modifiers);
165
+ let n = u(t.modifiers);
392
166
  if (n) {
393
167
  let t = e.getAttribute(n) ?? "";
394
- r.set(e, t), e.setAttribute(n, h(t));
168
+ r.set(e, t), e.setAttribute(n, y(t));
395
169
  } else {
396
170
  let n = t.arg ?? e.textContent ?? "";
397
- r.set(e, n.trim()), e.textContent = h(n.trim(), t.value == null ? void 0 : { ...t.value });
171
+ r.set(e, n.trim()), e.textContent = y(n.trim(), t.value == null ? void 0 : { ...t.value });
398
172
  }
399
173
  },
400
174
  updated(e, t) {
401
- let n = I(t.modifiers);
175
+ let n = u(t.modifiers);
402
176
  if (n) {
403
177
  let t = r.get(e) ?? e.getAttribute(n) ?? "";
404
- e.setAttribute(n, h(t));
405
- } else e.textContent = h((t.arg ?? r.get(e) ?? "").trim(), t.value == null ? void 0 : { ...t.value });
178
+ e.setAttribute(n, y(t));
179
+ } else e.textContent = y((t.arg ?? r.get(e) ?? "").trim(), t.value == null ? void 0 : { ...t.value });
406
180
  }
407
181
  });
408
182
  },
409
- global: V
183
+ global: M
410
184
  };
411
185
  }
412
186
  //#endregion
413
187
  //#region src/compile-time-t.ts
414
- var R = ((...e) => {
188
+ var f = ((...e) => {
415
189
  throw Error("[fluenti] `t` imported from '@fluenti/vue' is a compile-time API. Use it only with the Fluenti build transform inside <script setup> or setup(). For runtime lookups, use useI18n().t(...).");
416
190
  });
417
191
  //#endregion
418
- export { O as DateTime, P as FLUENTI_KEY, k as NumberFormat, E as Plural, D as Select, T as Trans, L as createFluenti, d as msg, R as t, x as useI18n };
192
+ export { e as FLUENTI_KEY, d as createFluenti, a as msg, f as t, t as useI18n };
419
193
 
420
194
  //# sourceMappingURL=index.js.map