@fluenti/vue 0.2.1 → 0.3.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.
- package/README.md +5 -5
- package/dist/components/DateTime.d.ts +1 -1
- package/dist/components/DateTime.d.ts.map +1 -1
- package/dist/components/NumberFormat.d.ts +1 -1
- package/dist/components/NumberFormat.d.ts.map +1 -1
- package/dist/components/Plural.d.ts +12 -13
- package/dist/components/Plural.d.ts.map +1 -1
- package/dist/components/Select.d.ts +12 -13
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/Trans.d.ts +7 -7
- package/dist/components/Trans.d.ts.map +1 -1
- package/dist/components/rich-text.d.ts +0 -6
- package/dist/components/rich-text.d.ts.map +1 -1
- package/dist/hooks/__useI18n.d.ts +2 -2
- package/dist/hooks/__useI18n.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -169
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +25 -14
- package/dist/plugin.d.ts.map +1 -1
- package/dist/server.cjs +2 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.ts +33 -13
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +54 -0
- package/dist/server.js.map +1 -0
- package/dist/use-i18n.d.ts +3 -3
- package/dist/use-i18n.d.ts.map +1 -1
- package/dist/vite-plugin.cjs +1 -111
- package/dist/vite-plugin.cjs.map +1 -1
- package/dist/vite-plugin.js +18 -126
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vue-runtime.d.ts.map +1 -1
- package/llms-full.txt +220 -0
- package/llms-migration.txt +199 -0
- package/llms.txt +82 -0
- package/package.json +17 -5
package/dist/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
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 {
|
|
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";
|
|
3
4
|
//#region src/use-i18n.ts
|
|
4
|
-
function
|
|
5
|
-
let e = i(
|
|
6
|
-
if (!e) throw Error("[fluenti] useI18n() requires
|
|
5
|
+
function x() {
|
|
6
|
+
let e = i(P);
|
|
7
|
+
if (!e) throw Error("[fluenti] useI18n() requires createFluenti plugin");
|
|
7
8
|
return e;
|
|
8
9
|
}
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region src/components/rich-text.ts
|
|
11
|
-
function
|
|
12
|
-
return t === 0 ? e : e.replace(/<(\d+)(\/?>)/g, (e, n, r) => `<${Number(n) + t}${r}`).replace(/<\/(\d+)>/g, (e, n) => `</${Number(n) + t}>`);
|
|
13
|
-
}
|
|
14
|
-
function _(n) {
|
|
12
|
+
function S(n) {
|
|
15
13
|
let r = [], i = "";
|
|
16
14
|
function o(n) {
|
|
17
15
|
if (n == null || typeof n == "boolean") return;
|
|
@@ -28,60 +26,42 @@ function _(n) {
|
|
|
28
26
|
i += typeof n.children == "string" ? n.children : "";
|
|
29
27
|
return;
|
|
30
28
|
}
|
|
31
|
-
let s = r.length, c =
|
|
32
|
-
r.push(n), r.push(...c.components), i += `<${s}>${
|
|
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}>`;
|
|
33
31
|
}
|
|
34
32
|
return o(n), {
|
|
35
33
|
message: i,
|
|
36
34
|
components: r
|
|
37
35
|
};
|
|
38
36
|
}
|
|
39
|
-
function
|
|
37
|
+
function C(e, t) {
|
|
40
38
|
let n = /<(\d+)>([\s\S]*?)<\/\1>/g, i = [], a = 0, o;
|
|
41
39
|
for (n.lastIndex = 0, o = n.exec(e); o !== null;) {
|
|
42
40
|
o.index > a && i.push(e.slice(a, o.index));
|
|
43
|
-
let s = t[Number(o[1])], c =
|
|
41
|
+
let s = t[Number(o[1])], c = C(o[2], t);
|
|
44
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);
|
|
45
43
|
}
|
|
46
44
|
return a < e.length && i.push(e.slice(a)), i.length <= 1 ? i[0] ?? "" : i;
|
|
47
45
|
}
|
|
48
|
-
function
|
|
46
|
+
function w(e, t) {
|
|
49
47
|
let n = {}, r = [];
|
|
50
48
|
for (let i of e) {
|
|
51
49
|
let e = t[i];
|
|
52
50
|
if (e === void 0) continue;
|
|
53
|
-
let a =
|
|
54
|
-
n[i] =
|
|
51
|
+
let a = S(e);
|
|
52
|
+
n[i] = y(a.message, r.length), r.push(...a.components);
|
|
55
53
|
}
|
|
56
54
|
for (let [i, a] of Object.entries(t)) {
|
|
57
55
|
if (e.includes(i) || a === void 0) continue;
|
|
58
|
-
let t =
|
|
59
|
-
n[i] =
|
|
56
|
+
let t = S(a);
|
|
57
|
+
n[i] = y(t.message, r.length), r.push(...t.components);
|
|
60
58
|
}
|
|
61
59
|
return {
|
|
62
60
|
messages: n,
|
|
63
61
|
components: r
|
|
64
62
|
};
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
return `{value, select, ${Object.entries(e).map(([e, t]) => `${e} {${t}}`).join(" ")}}`;
|
|
68
|
-
}
|
|
69
|
-
function x(e) {
|
|
70
|
-
let t = {}, n = {}, r = 0;
|
|
71
|
-
for (let [i, a] of Object.entries(e)) {
|
|
72
|
-
if (i === "other") {
|
|
73
|
-
t.other = a;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
let e = /^[A-Za-z0-9_]+$/.test(i) ? i : `case_${r++}`;
|
|
77
|
-
t[e] = a, n[i] = e;
|
|
78
|
-
}
|
|
79
|
-
return t.other === void 0 && (t.other = ""), {
|
|
80
|
-
forms: t,
|
|
81
|
-
valueMap: n
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
var S = n({
|
|
64
|
+
var T = n({
|
|
85
65
|
name: "Trans",
|
|
86
66
|
props: {
|
|
87
67
|
id: String,
|
|
@@ -89,43 +69,24 @@ var S = n({
|
|
|
89
69
|
comment: String,
|
|
90
70
|
tag: {
|
|
91
71
|
type: String,
|
|
92
|
-
default:
|
|
72
|
+
default: void 0
|
|
93
73
|
}
|
|
94
74
|
},
|
|
95
75
|
setup(e, { slots: t }) {
|
|
96
|
-
let { t: n } =
|
|
76
|
+
let { t: n } = x();
|
|
97
77
|
return () => {
|
|
98
78
|
let i = t.default?.();
|
|
99
79
|
if (!i) return null;
|
|
100
|
-
let { message: a, components: o } =
|
|
80
|
+
let { message: a, components: o } = S(i), s = n({
|
|
101
81
|
...e.id === void 0 ? {} : { id: e.id },
|
|
102
82
|
message: a,
|
|
103
83
|
...e.context === void 0 ? {} : { context: e.context },
|
|
104
84
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
105
|
-
}), c = o.length > 0 ?
|
|
106
|
-
return Array.isArray(c) ? c.length === 1 ? c[0] : r(e.tag, null, c) : c;
|
|
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;
|
|
107
87
|
};
|
|
108
88
|
}
|
|
109
|
-
}),
|
|
110
|
-
"zero",
|
|
111
|
-
"one",
|
|
112
|
-
"two",
|
|
113
|
-
"few",
|
|
114
|
-
"many",
|
|
115
|
-
"other"
|
|
116
|
-
];
|
|
117
|
-
function w(e, t) {
|
|
118
|
-
let n = [];
|
|
119
|
-
for (let t of C) {
|
|
120
|
-
let r = e[t];
|
|
121
|
-
if (r !== void 0) {
|
|
122
|
-
let e = t === "zero" ? "=0" : t;
|
|
123
|
-
n.push(`${e} {${r}}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return `{count, plural, ${t ? `offset:${t} ` : ""}${n.join(" ")}}`;
|
|
127
|
-
}
|
|
128
|
-
var T = n({
|
|
89
|
+
}), E = n({
|
|
129
90
|
name: "Plural",
|
|
130
91
|
props: {
|
|
131
92
|
value: {
|
|
@@ -142,16 +103,16 @@ var T = n({
|
|
|
142
103
|
many: String,
|
|
143
104
|
other: {
|
|
144
105
|
type: String,
|
|
145
|
-
|
|
106
|
+
required: !0
|
|
146
107
|
},
|
|
147
108
|
offset: Number,
|
|
148
109
|
tag: {
|
|
149
110
|
type: String,
|
|
150
|
-
default:
|
|
111
|
+
default: void 0
|
|
151
112
|
}
|
|
152
113
|
},
|
|
153
114
|
setup(e, { slots: t }) {
|
|
154
|
-
let { t: n } =
|
|
115
|
+
let { t: n } = x();
|
|
155
116
|
return () => {
|
|
156
117
|
let i = {
|
|
157
118
|
zero: e.zero,
|
|
@@ -159,13 +120,13 @@ var T = n({
|
|
|
159
120
|
two: e.two,
|
|
160
121
|
few: e.few,
|
|
161
122
|
many: e.many,
|
|
162
|
-
other: e.other
|
|
123
|
+
other: e.other
|
|
163
124
|
};
|
|
164
|
-
for (let e of
|
|
125
|
+
for (let e of f) {
|
|
165
126
|
let n = t[e];
|
|
166
127
|
n && (i[e] = n({ count: "#" }));
|
|
167
128
|
}
|
|
168
|
-
let { messages: a, components: o } =
|
|
129
|
+
let { messages: a, components: o } = w(f, i), s = m({
|
|
169
130
|
...a.zero !== void 0 && { zero: a.zero },
|
|
170
131
|
...a.one !== void 0 && { one: a.one },
|
|
171
132
|
...a.two !== void 0 && { two: a.two },
|
|
@@ -173,15 +134,15 @@ var T = n({
|
|
|
173
134
|
...a.many !== void 0 && { many: a.many },
|
|
174
135
|
other: a.other ?? ""
|
|
175
136
|
}, e.offset), c = n({
|
|
176
|
-
id: e.id ?? (e.context === void 0 ? s :
|
|
137
|
+
id: e.id ?? (e.context === void 0 ? s : g(s, e.context)),
|
|
177
138
|
message: s,
|
|
178
139
|
...e.context === void 0 ? {} : { context: e.context },
|
|
179
140
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
180
|
-
}, { count: e.value }), l = o.length > 0 ?
|
|
181
|
-
return r(e.tag, void 0, l ?? void 0);
|
|
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;
|
|
182
143
|
};
|
|
183
144
|
}
|
|
184
|
-
}),
|
|
145
|
+
}), D = n({
|
|
185
146
|
name: "Select",
|
|
186
147
|
inheritAttrs: !1,
|
|
187
148
|
props: {
|
|
@@ -194,7 +155,7 @@ var T = n({
|
|
|
194
155
|
comment: String,
|
|
195
156
|
other: {
|
|
196
157
|
type: String,
|
|
197
|
-
|
|
158
|
+
required: !0
|
|
198
159
|
},
|
|
199
160
|
options: {
|
|
200
161
|
type: Object,
|
|
@@ -202,31 +163,31 @@ var T = n({
|
|
|
202
163
|
},
|
|
203
164
|
tag: {
|
|
204
165
|
type: String,
|
|
205
|
-
default:
|
|
166
|
+
default: void 0
|
|
206
167
|
}
|
|
207
168
|
},
|
|
208
169
|
setup(e, { attrs: t, slots: n }) {
|
|
209
|
-
let { t: i } =
|
|
170
|
+
let { t: i } = x();
|
|
210
171
|
return () => {
|
|
211
172
|
let a = {};
|
|
212
173
|
if (e.options !== void 0) {
|
|
213
174
|
for (let [t, n] of Object.entries(e.options)) a[t] = n;
|
|
214
|
-
a.other = e.other
|
|
175
|
+
a.other = e.other;
|
|
215
176
|
} else {
|
|
216
177
|
for (let [e, n] of Object.entries(t)) typeof n == "string" && (a[e] = n);
|
|
217
|
-
a.other = e.other
|
|
178
|
+
a.other = e.other;
|
|
218
179
|
}
|
|
219
180
|
for (let [e, t] of Object.entries(n)) e === "default" || !t || (a[e] = t({ value: "{value}" }));
|
|
220
|
-
let o = [...Object.keys(a).filter((e) => e !== "other"), "other"], { messages: s, components: c } =
|
|
221
|
-
id: e.id ?? (e.context === void 0 ? u :
|
|
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)),
|
|
222
183
|
message: u,
|
|
223
184
|
...e.context === void 0 ? {} : { context: e.context },
|
|
224
185
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
225
|
-
}, { value: l.valueMap[e.value] ?? "other" }),
|
|
226
|
-
return r(e.tag, void 0,
|
|
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;
|
|
227
188
|
};
|
|
228
189
|
}
|
|
229
|
-
}),
|
|
190
|
+
}), O = n({
|
|
230
191
|
name: "DateTime",
|
|
231
192
|
props: {
|
|
232
193
|
value: {
|
|
@@ -243,10 +204,10 @@ var T = n({
|
|
|
243
204
|
}
|
|
244
205
|
},
|
|
245
206
|
setup(e) {
|
|
246
|
-
let { d: t } =
|
|
207
|
+
let { d: t } = x();
|
|
247
208
|
return () => r(e.tag, t(e.value, e.style));
|
|
248
209
|
}
|
|
249
|
-
}),
|
|
210
|
+
}), k = n({
|
|
250
211
|
name: "NumberFormat",
|
|
251
212
|
props: {
|
|
252
213
|
value: {
|
|
@@ -263,146 +224,171 @@ var T = n({
|
|
|
263
224
|
}
|
|
264
225
|
},
|
|
265
226
|
setup(e) {
|
|
266
|
-
let { n: t } =
|
|
227
|
+
let { n: t } = x();
|
|
267
228
|
return () => r(e.tag, t(e.value, e.style));
|
|
268
229
|
}
|
|
269
230
|
});
|
|
270
231
|
//#endregion
|
|
271
232
|
//#region src/plugin.ts
|
|
272
|
-
function
|
|
233
|
+
function A(e) {
|
|
273
234
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
274
235
|
}
|
|
275
|
-
var
|
|
276
|
-
function
|
|
277
|
-
let e = globalThis[
|
|
236
|
+
var j = Symbol.for("fluenti.runtime.vue.v1");
|
|
237
|
+
function M() {
|
|
238
|
+
let e = globalThis[j];
|
|
278
239
|
return typeof e == "object" && e ? e : null;
|
|
279
240
|
}
|
|
280
|
-
function
|
|
241
|
+
function N(e) {
|
|
281
242
|
return typeof e == "object" && e && "default" in e ? e.default : e;
|
|
282
243
|
}
|
|
283
|
-
var
|
|
284
|
-
function
|
|
285
|
-
return typeof e == "function" ? e(t) :
|
|
244
|
+
var P = Symbol("fluenti");
|
|
245
|
+
function F(e, t, n) {
|
|
246
|
+
return typeof e == "function" ? e(t) : _(e, t, n);
|
|
286
247
|
}
|
|
287
|
-
function
|
|
248
|
+
function I(e) {
|
|
288
249
|
let t = Object.keys(e).filter((e) => e !== "plural");
|
|
289
250
|
return t.length > 0 ? t[0] : void 0;
|
|
290
251
|
}
|
|
291
|
-
function
|
|
292
|
-
let t = e.lazyLocaleLoading ?? e.splitting ?? !1, n = o(e.locale),
|
|
293
|
-
function
|
|
294
|
-
let n =
|
|
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];
|
|
295
256
|
if (n) return n[t];
|
|
296
257
|
}
|
|
297
|
-
function h(t, ...
|
|
298
|
-
if (Array.isArray(t) && "raw" in t) return h(
|
|
299
|
-
let
|
|
300
|
-
typeof
|
|
301
|
-
let l =
|
|
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];
|
|
302
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);
|
|
303
264
|
else if (e.fallbackChain?.["*"]) for (let t of e.fallbackChain["*"]) u.includes(t) || u.push(t);
|
|
304
265
|
for (let e of u) {
|
|
305
|
-
let t =
|
|
306
|
-
if (t !== void 0) return
|
|
266
|
+
let t = m(e, s);
|
|
267
|
+
if (t !== void 0) return e !== l && n?.fallbackUsed(l, e, s), F(t, o, e);
|
|
307
268
|
}
|
|
308
|
-
if (e.missing) {
|
|
309
|
-
let t = e.missing(l,
|
|
269
|
+
if (n?.missingKey(l, s), e.missing) {
|
|
270
|
+
let t = e.missing(l, s);
|
|
310
271
|
if (t !== void 0) return t;
|
|
311
272
|
}
|
|
312
|
-
return
|
|
273
|
+
return c ? _(c, o, l) : s.includes("{") ? _(s, o, l) : s;
|
|
313
274
|
}
|
|
314
|
-
|
|
275
|
+
let g = 0;
|
|
276
|
+
async function v(n) {
|
|
315
277
|
if (!t || !e.chunkLoader) {
|
|
316
|
-
|
|
278
|
+
r.value = n;
|
|
317
279
|
return;
|
|
318
280
|
}
|
|
319
|
-
let
|
|
320
|
-
if (
|
|
321
|
-
|
|
281
|
+
let o = M();
|
|
282
|
+
if (d.has(n)) {
|
|
283
|
+
o?.__switchLocale && await o.__switchLocale(n), r.value = n;
|
|
322
284
|
return;
|
|
323
285
|
}
|
|
324
|
-
|
|
286
|
+
let s = ++g;
|
|
287
|
+
a.value = !0;
|
|
325
288
|
try {
|
|
326
|
-
let t =
|
|
327
|
-
|
|
328
|
-
|
|
289
|
+
let t = N(await e.chunkLoader(n));
|
|
290
|
+
if (s !== g) return;
|
|
291
|
+
i[n] = {
|
|
292
|
+
...i[n],
|
|
329
293
|
...t
|
|
330
|
-
},
|
|
294
|
+
}, d.add(n), f.value = new Set(d), o?.__switchLocale && await o.__switchLocale(n), r.value = n;
|
|
331
295
|
} finally {
|
|
332
|
-
|
|
296
|
+
s === g && (a.value = !1);
|
|
333
297
|
}
|
|
334
298
|
}
|
|
335
|
-
function
|
|
336
|
-
|
|
337
|
-
...
|
|
299
|
+
function y(e, t) {
|
|
300
|
+
i[e] = {
|
|
301
|
+
...i[e],
|
|
338
302
|
...t
|
|
339
|
-
},
|
|
303
|
+
}, d.add(e), f.value = new Set(d);
|
|
340
304
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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();
|
|
344
310
|
e.chunkLoader(n).then(async (e) => {
|
|
345
|
-
let t =
|
|
346
|
-
|
|
347
|
-
...
|
|
311
|
+
let t = N(e);
|
|
312
|
+
i[n] = {
|
|
313
|
+
...i[n],
|
|
348
314
|
...t
|
|
349
|
-
},
|
|
315
|
+
}, d.add(n), f.value = new Set(d), r?.__preloadLocale && await r.__preloadLocale(n);
|
|
350
316
|
}).catch((e) => {
|
|
351
317
|
console.warn("[fluenti] preload failed:", n, e);
|
|
318
|
+
}).finally(() => {
|
|
319
|
+
x.delete(n);
|
|
352
320
|
});
|
|
353
321
|
}
|
|
354
|
-
function
|
|
355
|
-
return Object.keys(
|
|
322
|
+
function C() {
|
|
323
|
+
return Object.keys(i);
|
|
356
324
|
}
|
|
357
|
-
function
|
|
358
|
-
let i =
|
|
359
|
-
return l(t, i,
|
|
325
|
+
function w(t, n) {
|
|
326
|
+
let i = r.value;
|
|
327
|
+
return l(t, i, n, e.dateFormats);
|
|
360
328
|
}
|
|
361
|
-
function
|
|
362
|
-
let i =
|
|
363
|
-
return u(t, i,
|
|
329
|
+
function j(t, n) {
|
|
330
|
+
let i = r.value;
|
|
331
|
+
return u(t, i, n, e.numberFormats);
|
|
364
332
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
333
|
+
function L(e, t) {
|
|
334
|
+
return F(e, t, r.value);
|
|
367
335
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
if (
|
|
372
|
-
|
|
373
|
-
|
|
336
|
+
function R(e, t, n) {
|
|
337
|
+
let r = A(n ? h(e, n) : h(e));
|
|
338
|
+
function i(e) {
|
|
339
|
+
if (e.rawAttrs != null && e.rawAttrs !== "") {
|
|
340
|
+
let t = [], n = /([\w:@.!-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g, r;
|
|
341
|
+
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)}"`);
|
|
344
|
+
}
|
|
345
|
+
return t.join(" ");
|
|
346
|
+
}
|
|
347
|
+
return e.attrs ? Object.entries(e.attrs).map(([e, t]) => t ? `${A(e)}="${A(t)}"` : A(e)).join(" ") : "";
|
|
348
|
+
}
|
|
349
|
+
let a = r.replace(/<(\d+)\/>/g, (e, n) => {
|
|
350
|
+
let r = t[Number(n)];
|
|
351
|
+
if (!r) return "";
|
|
352
|
+
let a = A(r.tag), o = i(r);
|
|
353
|
+
return `<${a}${o ? " " + o : ""} />`;
|
|
374
354
|
});
|
|
355
|
+
return a = a.replace(/<(\d+)>([\s\S]*?)<\/\1>/g, (e, n, r) => {
|
|
356
|
+
let a = t[Number(n)];
|
|
357
|
+
if (!a) return r;
|
|
358
|
+
let o = A(a.tag), s = i(a);
|
|
359
|
+
return `<${o}${s ? " " + s : ""}>${r}</${o}>`;
|
|
360
|
+
}), a;
|
|
375
361
|
}
|
|
376
|
-
function
|
|
377
|
-
return
|
|
362
|
+
function z(e, t) {
|
|
363
|
+
return m(t ?? r.value, e) !== void 0;
|
|
378
364
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
365
|
+
function B(e, t) {
|
|
366
|
+
return m(t ?? r.value, e);
|
|
381
367
|
}
|
|
382
|
-
let
|
|
368
|
+
let V = {
|
|
383
369
|
t: h,
|
|
384
|
-
locale:
|
|
385
|
-
setLocale:
|
|
386
|
-
loadMessages:
|
|
387
|
-
getLocales:
|
|
388
|
-
d:
|
|
389
|
-
n:
|
|
390
|
-
format:
|
|
391
|
-
isLoading:
|
|
392
|
-
loadedLocales:
|
|
393
|
-
preloadLocale:
|
|
394
|
-
te:
|
|
395
|
-
tm:
|
|
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
|
|
396
382
|
};
|
|
397
383
|
return {
|
|
398
384
|
install(t) {
|
|
399
|
-
t.provide(
|
|
385
|
+
t.provide(P, V);
|
|
400
386
|
let n = e.componentPrefix ?? "";
|
|
401
|
-
t.component(`${n}Trans`,
|
|
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);
|
|
402
388
|
let r = /* @__PURE__ */ new WeakMap();
|
|
403
389
|
t.directive("t", {
|
|
404
390
|
mounted(e, t) {
|
|
405
|
-
let n =
|
|
391
|
+
let n = I(t.modifiers);
|
|
406
392
|
if (n) {
|
|
407
393
|
let t = e.getAttribute(n) ?? "";
|
|
408
394
|
r.set(e, t), e.setAttribute(n, h(t));
|
|
@@ -412,7 +398,7 @@ function I(e) {
|
|
|
412
398
|
}
|
|
413
399
|
},
|
|
414
400
|
updated(e, t) {
|
|
415
|
-
let n =
|
|
401
|
+
let n = I(t.modifiers);
|
|
416
402
|
if (n) {
|
|
417
403
|
let t = r.get(e) ?? e.getAttribute(n) ?? "";
|
|
418
404
|
e.setAttribute(n, h(t));
|
|
@@ -420,15 +406,15 @@ function I(e) {
|
|
|
420
406
|
}
|
|
421
407
|
});
|
|
422
408
|
},
|
|
423
|
-
global:
|
|
409
|
+
global: V
|
|
424
410
|
};
|
|
425
411
|
}
|
|
426
412
|
//#endregion
|
|
427
413
|
//#region src/compile-time-t.ts
|
|
428
|
-
var
|
|
414
|
+
var R = ((...e) => {
|
|
429
415
|
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(...).");
|
|
430
416
|
});
|
|
431
417
|
//#endregion
|
|
432
|
-
export {
|
|
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 };
|
|
433
419
|
|
|
434
420
|
//# sourceMappingURL=index.js.map
|