@fluenti/solid 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/context.d.ts +15 -24
- package/dist/context.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 +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +129 -167
- package/dist/index.js.map +1 -1
- package/dist/plural.d.ts +3 -3
- package/dist/plural.d.ts.map +1 -1
- package/dist/provider.d.ts +3 -3
- package/dist/provider.d.ts.map +1 -1
- package/dist/rich-dom.d.ts +0 -6
- package/dist/rich-dom.d.ts.map +1 -1
- package/dist/select.d.ts +3 -3
- package/dist/select.d.ts.map +1 -1
- package/dist/server.cjs +2 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.ts +33 -17
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +54 -0
- package/dist/server.js.map +1 -0
- package/dist/solid-runtime.d.ts.map +1 -1
- package/dist/trans.d.ts +3 -3
- package/dist/trans.d.ts.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/use-i18n.d.ts +4 -8
- package/dist/use-i18n.d.ts.map +1 -1
- package/dist/vite-plugin.cjs +2 -113
- package/dist/vite-plugin.cjs.map +1 -1
- package/dist/vite-plugin.js +14 -123
- package/dist/vite-plugin.js.map +1 -1
- package/llms-full.txt +186 -0
- package/llms-migration.txt +176 -0
- package/llms.txt +64 -0
- package/package.json +17 -5
- package/src/context.ts +56 -77
- package/src/hooks/__useI18n.ts +2 -2
- package/src/index.ts +6 -6
- package/src/plural.tsx +9 -38
- package/src/provider.tsx +5 -5
- package/src/rich-dom.tsx +25 -47
- package/src/select.tsx +11 -8
- package/src/server.ts +94 -49
- package/src/solid-runtime.ts +15 -134
- package/src/trans.tsx +7 -4
- package/src/types.ts +9 -8
- package/src/use-i18n.ts +5 -16
- package/src/vite-plugin.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { children as e, createContext as t, createMemo as n,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { children as e, createContext as t, createMemo as n, createSignal as r, useContext as i } from "solid-js";
|
|
2
|
+
import { createDiagnostics as a, formatDate as o, formatNumber as s, msg as c } from "@fluenti/core";
|
|
3
|
+
import { PLURAL_CATEGORIES as l, buildICUMessage as u, buildICUPluralMessage as d, buildICUSelectMessage as f, hashMessage as p, interpolate as m, normalizeSelectForms as h, offsetIndices as g, resolveDescriptorId as _ } from "@fluenti/core/internal";
|
|
4
|
+
import { Dynamic as v, createComponent as y, memo as b } from "solid-js/web";
|
|
4
5
|
//#region src/context.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let e = globalThis[
|
|
6
|
+
var x = Symbol.for("fluenti.runtime.solid.v1");
|
|
7
|
+
function S() {
|
|
8
|
+
let e = globalThis[x];
|
|
8
9
|
return typeof e == "object" && e ? e : null;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function C(e) {
|
|
11
12
|
return typeof e == "object" && e && "default" in e ? e.default : e;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
let [t, n] =
|
|
14
|
+
function w(e) {
|
|
15
|
+
let [t, n] = r(e.locale), [i, c] = r(!1), l = new Set([e.locale]), [d, f] = r(new Set(l)), p = { ...e.messages }, h = e, g = h.diagnostics ? a(h.diagnostics) : void 0, v = h.lazyLocaleLoading ?? e.splitting ?? !1;
|
|
15
16
|
function y(e, t, n) {
|
|
16
|
-
let r =
|
|
17
|
+
let r = p[t];
|
|
17
18
|
if (!r) return;
|
|
18
19
|
let i = r[e];
|
|
19
|
-
if (i !== void 0) return typeof i == "function" ? i(n) : typeof i == "string" && n ?
|
|
20
|
+
if (i !== void 0) return typeof i == "function" ? i(n) : typeof i == "string" && n ? m(i, n, t) : String(i);
|
|
20
21
|
}
|
|
21
22
|
function b(t, n, r) {
|
|
22
23
|
let i = [n], a = new Set(i);
|
|
@@ -24,8 +25,8 @@ function y(e) {
|
|
|
24
25
|
let o = h.fallbackChain?.[n] ?? h.fallbackChain?.["*"];
|
|
25
26
|
if (o) for (let e of o) a.has(e) || (i.push(e), a.add(e));
|
|
26
27
|
for (let e of i) {
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
28
|
+
let i = y(t, e, r);
|
|
29
|
+
if (i !== void 0) return e !== n && g?.fallbackUsed(n, e, t), i;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function x(t, n) {
|
|
@@ -33,91 +34,92 @@ function y(e) {
|
|
|
33
34
|
let r = e.missing(n, t);
|
|
34
35
|
if (r !== void 0) return r;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function w(e, t, n) {
|
|
37
38
|
let r = b(e, t, n);
|
|
38
39
|
if (r !== void 0) return r;
|
|
40
|
+
g?.missingKey(t, e);
|
|
39
41
|
let i = x(e, t);
|
|
40
|
-
return i === void 0 ? e.includes("{") ?
|
|
42
|
+
return i === void 0 ? e.includes("{") ? m(e, n, t) : e : i;
|
|
41
43
|
}
|
|
42
|
-
function
|
|
43
|
-
if (Array.isArray(e) && "raw" in e) return
|
|
44
|
+
function T(e, ...n) {
|
|
45
|
+
if (Array.isArray(e) && "raw" in e) return T(u(e, n), Object.fromEntries(n.map((e, t) => [String(t), e])));
|
|
44
46
|
let r = e, i = n[0], a = t();
|
|
45
47
|
if (typeof r == "object" && r) {
|
|
46
|
-
let e =
|
|
48
|
+
let e = _(r);
|
|
47
49
|
if (e) {
|
|
48
50
|
let t = b(e, a, i);
|
|
49
51
|
if (t !== void 0) return t;
|
|
50
52
|
let n = x(e, a);
|
|
51
53
|
if (n !== void 0) return n;
|
|
52
54
|
}
|
|
53
|
-
return r.message === void 0 ? e ?? "" :
|
|
55
|
+
return r.message === void 0 ? e ?? "" : m(r.message, i, a);
|
|
54
56
|
}
|
|
55
|
-
return
|
|
57
|
+
return w(r, a, i);
|
|
56
58
|
}
|
|
57
59
|
return {
|
|
58
60
|
locale: t,
|
|
59
61
|
setLocale: async (e) => {
|
|
60
|
-
if (!
|
|
62
|
+
if (!v || !h.chunkLoader) {
|
|
61
63
|
n(e);
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
64
|
-
let t =
|
|
66
|
+
let t = S();
|
|
65
67
|
if (l.has(e)) {
|
|
66
68
|
t?.__switchLocale && await t.__switchLocale(e), n(e);
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
|
-
|
|
71
|
+
c(!0);
|
|
70
72
|
try {
|
|
71
|
-
let r =
|
|
72
|
-
|
|
73
|
-
...
|
|
73
|
+
let r = C(await h.chunkLoader(e));
|
|
74
|
+
p[e] = {
|
|
75
|
+
...p[e],
|
|
74
76
|
...r
|
|
75
|
-
}, l.add(e),
|
|
77
|
+
}, l.add(e), f(new Set(l)), t?.__switchLocale && await t.__switchLocale(e), n(e);
|
|
76
78
|
} finally {
|
|
77
|
-
|
|
79
|
+
c(!1);
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
|
-
t:
|
|
82
|
+
t: T,
|
|
81
83
|
loadMessages: (e, t) => {
|
|
82
|
-
|
|
83
|
-
...
|
|
84
|
+
p[e] = {
|
|
85
|
+
...p[e],
|
|
84
86
|
...t
|
|
85
|
-
}, l.add(e),
|
|
87
|
+
}, l.add(e), f(new Set(l));
|
|
86
88
|
},
|
|
87
|
-
getLocales: () => Object.keys(
|
|
88
|
-
d: (e, n) =>
|
|
89
|
-
n: (e, n) =>
|
|
90
|
-
format: (e, n) =>
|
|
91
|
-
isLoading:
|
|
89
|
+
getLocales: () => Object.keys(p),
|
|
90
|
+
d: (e, n) => o(e, t(), n, h.dateFormats),
|
|
91
|
+
n: (e, n) => s(e, t(), n, h.numberFormats),
|
|
92
|
+
format: (e, n) => m(e, n, t()),
|
|
93
|
+
isLoading: i,
|
|
92
94
|
loadedLocales: d,
|
|
93
95
|
preloadLocale: (e) => {
|
|
94
|
-
if (!
|
|
95
|
-
let t =
|
|
96
|
+
if (!v || l.has(e) || !h.chunkLoader) return;
|
|
97
|
+
let t = S();
|
|
96
98
|
h.chunkLoader(e).then(async (n) => {
|
|
97
|
-
let r =
|
|
98
|
-
|
|
99
|
-
...
|
|
99
|
+
let r = C(n);
|
|
100
|
+
p[e] = {
|
|
101
|
+
...p[e],
|
|
100
102
|
...r
|
|
101
|
-
}, l.add(e),
|
|
103
|
+
}, l.add(e), f(new Set(l)), t?.__preloadLocale && await t.__preloadLocale(e);
|
|
102
104
|
}).catch((t) => {
|
|
103
105
|
console.warn("[fluenti] preload failed:", e, t);
|
|
104
106
|
});
|
|
107
|
+
},
|
|
108
|
+
te: (e, n) => {
|
|
109
|
+
let r = p[n ?? t()];
|
|
110
|
+
return r !== void 0 && e in r;
|
|
111
|
+
},
|
|
112
|
+
tm: (e, n) => {
|
|
113
|
+
let r = p[n ?? t()];
|
|
114
|
+
return r ? r[e] : void 0;
|
|
105
115
|
}
|
|
106
116
|
};
|
|
107
117
|
}
|
|
108
|
-
var b;
|
|
109
|
-
function x(e) {
|
|
110
|
-
let t = r(() => y(e));
|
|
111
|
-
return typeof window < "u" ? b = t : console.warn("[fluenti] createI18n() detected SSR environment. Use <I18nProvider> for per-request isolation in SSR."), t;
|
|
112
|
-
}
|
|
113
|
-
function S() {
|
|
114
|
-
return b;
|
|
115
|
-
}
|
|
116
118
|
//#endregion
|
|
117
119
|
//#region src/provider.tsx
|
|
118
|
-
var
|
|
119
|
-
let t =
|
|
120
|
-
return
|
|
120
|
+
var T = t(), E = (e) => {
|
|
121
|
+
let t = w(e);
|
|
122
|
+
return y(T.Provider, {
|
|
121
123
|
value: t,
|
|
122
124
|
get children() {
|
|
123
125
|
return e.children;
|
|
@@ -126,33 +128,28 @@ var C = t(), w = (e) => {
|
|
|
126
128
|
};
|
|
127
129
|
//#endregion
|
|
128
130
|
//#region src/use-i18n.ts
|
|
129
|
-
function
|
|
130
|
-
let e =
|
|
131
|
+
function D() {
|
|
132
|
+
let e = i(T);
|
|
131
133
|
if (e) return e;
|
|
132
|
-
|
|
133
|
-
if (t) return t;
|
|
134
|
-
throw Error("useI18n requires either createI18n() to be called at startup, or the component to be inside an <I18nProvider>.");
|
|
134
|
+
throw Error("useI18n() must be used inside an <I18nProvider>.");
|
|
135
135
|
}
|
|
136
136
|
//#endregion
|
|
137
137
|
//#region src/compile-time-t.ts
|
|
138
|
-
var
|
|
138
|
+
var O = ((...e) => {
|
|
139
139
|
throw Error("[fluenti] `t` imported from '@fluenti/solid' is a compile-time API. Use it only with the Fluenti build transform inside a component or custom hook. For runtime lookups, use useI18n().t(...).");
|
|
140
140
|
});
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/rich-dom.tsx
|
|
143
|
-
function
|
|
143
|
+
function k(e) {
|
|
144
144
|
return typeof Node < "u" && e instanceof Node;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function A(e) {
|
|
147
147
|
return typeof e == "function" && !e.length ? e() : e;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return t === 0 ? e : e.replace(/<(\d+)(\/?>)/g, (e, n, r) => `<${Number(n) + t}${r}`).replace(/<\/(\d+)>/g, (e, n) => `</${Number(n) + t}>`);
|
|
151
|
-
}
|
|
152
|
-
function A(e) {
|
|
149
|
+
function j(e) {
|
|
153
150
|
let t = [], n = "";
|
|
154
151
|
function r(e) {
|
|
155
|
-
let i =
|
|
152
|
+
let i = A(e);
|
|
156
153
|
if (i == null || typeof i == "boolean") return;
|
|
157
154
|
if (Array.isArray(i)) {
|
|
158
155
|
for (let e of i) r(e);
|
|
@@ -162,7 +159,7 @@ function A(e) {
|
|
|
162
159
|
n += String(i);
|
|
163
160
|
return;
|
|
164
161
|
}
|
|
165
|
-
if (!
|
|
162
|
+
if (!k(i)) return;
|
|
166
163
|
if (i.nodeType === Node.TEXT_NODE) {
|
|
167
164
|
n += i.textContent ?? "";
|
|
168
165
|
return;
|
|
@@ -171,80 +168,66 @@ function A(e) {
|
|
|
171
168
|
r(Array.from(i.childNodes));
|
|
172
169
|
return;
|
|
173
170
|
}
|
|
174
|
-
let a = t.length, o =
|
|
175
|
-
t.push(i.cloneNode(!1)), t.push(...o.components), n += `<${a}>${
|
|
171
|
+
let a = t.length, o = j(Array.from(i.childNodes));
|
|
172
|
+
t.push(i.cloneNode(!1)), t.push(...o.components), o.message === "" && o.components.length === 0 ? n += `<${a}/>` : n += `<${a}>${g(o.message, a + 1)}</${a}>`;
|
|
176
173
|
}
|
|
177
174
|
return r(e), {
|
|
178
175
|
message: n,
|
|
179
176
|
components: t
|
|
180
177
|
};
|
|
181
178
|
}
|
|
182
|
-
function
|
|
183
|
-
let n =
|
|
179
|
+
function M(e, t) {
|
|
180
|
+
let n = A(t);
|
|
184
181
|
if (!(n == null || typeof n == "boolean")) {
|
|
185
182
|
if (Array.isArray(n)) {
|
|
186
|
-
for (let t of n)
|
|
183
|
+
for (let t of n) M(e, t);
|
|
187
184
|
return;
|
|
188
185
|
}
|
|
189
186
|
if (typeof n == "string" || typeof n == "number") {
|
|
190
187
|
e.appendChild(document.createTextNode(String(n)));
|
|
191
188
|
return;
|
|
192
189
|
}
|
|
193
|
-
|
|
190
|
+
k(n) && e.appendChild(n);
|
|
194
191
|
}
|
|
195
192
|
}
|
|
196
|
-
function
|
|
197
|
-
let n = /<(\d+)>([\s\S]*?)<\/\1
|
|
193
|
+
function N(e, t) {
|
|
194
|
+
let n = /<(\d+)(?:\/>|(>)([\s\S]*?)<\/\1>)/g, r = [], i = 0, a;
|
|
198
195
|
for (n.lastIndex = 0, a = n.exec(e); a !== null;) {
|
|
199
196
|
a.index > i && r.push(e.slice(i, a.index));
|
|
200
|
-
let o =
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
let o = Number(a[1]), s = a[2] === void 0, c = t[o];
|
|
198
|
+
if (s) c && r.push(c.cloneNode(!1));
|
|
199
|
+
else {
|
|
200
|
+
let e = N(a[2] === void 0 ? "" : a[3], t);
|
|
201
|
+
if (c) {
|
|
202
|
+
let t = c.cloneNode(!1);
|
|
203
|
+
M(t, e), r.push(t);
|
|
204
|
+
} else r.push(a[3] ?? "");
|
|
205
|
+
}
|
|
205
206
|
i = n.lastIndex, a = n.exec(e);
|
|
206
207
|
}
|
|
207
208
|
return i < e.length && r.push(e.slice(i)), r.length <= 1 ? r[0] ?? "" : r;
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
+
function P(e, t) {
|
|
210
211
|
let n = {}, r = [];
|
|
211
212
|
for (let i of e) {
|
|
212
213
|
let e = t[i];
|
|
213
214
|
if (e === void 0) continue;
|
|
214
|
-
let a =
|
|
215
|
-
n[i] =
|
|
215
|
+
let a = j(e);
|
|
216
|
+
n[i] = g(a.message, r.length), r.push(...a.components);
|
|
216
217
|
}
|
|
217
218
|
for (let [i, a] of Object.entries(t)) {
|
|
218
219
|
if (e.includes(i) || a === void 0) continue;
|
|
219
|
-
let t =
|
|
220
|
-
n[i] =
|
|
220
|
+
let t = j(a);
|
|
221
|
+
n[i] = g(t.message, r.length), r.push(...t.components);
|
|
221
222
|
}
|
|
222
223
|
return {
|
|
223
224
|
messages: n,
|
|
224
225
|
components: r
|
|
225
226
|
};
|
|
226
227
|
}
|
|
227
|
-
function P(e) {
|
|
228
|
-
return `{value, select, ${Object.entries(e).map(([e, t]) => `${e} {${t}}`).join(" ")}}`;
|
|
229
|
-
}
|
|
230
|
-
function F(e) {
|
|
231
|
-
let t = {}, n = {}, r = 0;
|
|
232
|
-
for (let [i, a] of Object.entries(e)) {
|
|
233
|
-
if (i === "other") {
|
|
234
|
-
t.other = a;
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
let e = /^[A-Za-z0-9_]+$/.test(i) ? i : `case_${r++}`;
|
|
238
|
-
t[e] = a, n[i] = e;
|
|
239
|
-
}
|
|
240
|
-
return t.other === void 0 && (t.other = ""), {
|
|
241
|
-
forms: t,
|
|
242
|
-
valueMap: n
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
228
|
//#endregion
|
|
246
229
|
//#region src/trans.tsx
|
|
247
|
-
function
|
|
230
|
+
function F(e) {
|
|
248
231
|
let t = [], n = 0;
|
|
249
232
|
for (; n < e.length;) {
|
|
250
233
|
let r = e.indexOf("<", n);
|
|
@@ -276,7 +259,7 @@ function I(e) {
|
|
|
276
259
|
}), n = r + 1;
|
|
277
260
|
continue;
|
|
278
261
|
}
|
|
279
|
-
let o = a[1], s = r + a[0].length, c =
|
|
262
|
+
let o = a[1], s = r + a[0].length, c = I(e, o, s);
|
|
280
263
|
if (c === -1) {
|
|
281
264
|
t.push({
|
|
282
265
|
type: "text",
|
|
@@ -288,12 +271,12 @@ function I(e) {
|
|
|
288
271
|
t.push({
|
|
289
272
|
type: "tag",
|
|
290
273
|
name: o,
|
|
291
|
-
children:
|
|
274
|
+
children: F(l)
|
|
292
275
|
}), n = c + u.length;
|
|
293
276
|
}
|
|
294
277
|
return t;
|
|
295
278
|
}
|
|
296
|
-
function
|
|
279
|
+
function I(e, t, n) {
|
|
297
280
|
let r = `<${t}>`, i = `</${t}>`, a = 1, o = n;
|
|
298
281
|
for (; o < e.length && a > 0;) {
|
|
299
282
|
let t = e.indexOf(r, o), n = e.indexOf(i, o);
|
|
@@ -306,25 +289,25 @@ function L(e, t, n) {
|
|
|
306
289
|
}
|
|
307
290
|
return -1;
|
|
308
291
|
}
|
|
309
|
-
function
|
|
292
|
+
function L(e, t) {
|
|
310
293
|
let n = e.map((e) => {
|
|
311
294
|
if (e.type === "text") return e.value;
|
|
312
295
|
let n = t[e.name];
|
|
313
|
-
return n ?
|
|
296
|
+
return n ? y(v, {
|
|
314
297
|
component: n,
|
|
315
|
-
children: e.children.length > 0 ?
|
|
316
|
-
}) :
|
|
298
|
+
children: e.children.length > 0 ? L(e.children, t) : void 0
|
|
299
|
+
}) : L(e.children, t);
|
|
317
300
|
});
|
|
318
301
|
return n.length === 1 ? n[0] : n;
|
|
319
302
|
}
|
|
320
|
-
var
|
|
321
|
-
let { t: r } =
|
|
303
|
+
var R = (t) => {
|
|
304
|
+
let { t: r } = D(), i = e(() => t.children), a = n(() => {
|
|
322
305
|
let e = t.__message ?? t.message;
|
|
323
306
|
return typeof e == "function" ? e() : e;
|
|
324
307
|
}), o = n(() => t.__components ?? t.components);
|
|
325
308
|
return (() => {
|
|
326
309
|
let e = a(), n = o();
|
|
327
|
-
if (e !== void 0 && n) return
|
|
310
|
+
if (e !== void 0 && n) return L(F(r({
|
|
328
311
|
...t.id === void 0 ? {} : { id: t.id },
|
|
329
312
|
message: e,
|
|
330
313
|
...t.context === void 0 ? {} : { context: t.context },
|
|
@@ -332,50 +315,31 @@ var z = (t) => {
|
|
|
332
315
|
})), n);
|
|
333
316
|
let s = i.toArray();
|
|
334
317
|
if (s.length === 0) return null;
|
|
335
|
-
let c =
|
|
318
|
+
let c = j(s), l = r({
|
|
336
319
|
...t.id === void 0 ? {} : { id: t.id },
|
|
337
320
|
message: c.message,
|
|
338
321
|
...t.context === void 0 ? {} : { context: t.context },
|
|
339
322
|
...t.comment === void 0 ? {} : { comment: t.comment }
|
|
340
|
-
}), u = c.components.length > 0 ?
|
|
341
|
-
return Array.isArray(u) && u.length > 1 ?
|
|
323
|
+
}), u = c.components.length > 0 ? N(l, c.components) : l;
|
|
324
|
+
return Array.isArray(u) && u.length > 1 && t.tag ? y(v, {
|
|
342
325
|
get component() {
|
|
343
|
-
return t.tag
|
|
326
|
+
return t.tag;
|
|
344
327
|
},
|
|
345
328
|
children: u
|
|
346
329
|
}) : u;
|
|
347
330
|
});
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
"one",
|
|
351
|
-
"two",
|
|
352
|
-
"few",
|
|
353
|
-
"many",
|
|
354
|
-
"other"
|
|
355
|
-
];
|
|
356
|
-
function V(e, t) {
|
|
357
|
-
let n = [];
|
|
358
|
-
for (let t of B) {
|
|
359
|
-
let r = e[t];
|
|
360
|
-
if (r !== void 0) {
|
|
361
|
-
let e = t === "zero" ? "=0" : t;
|
|
362
|
-
n.push(`${e} {${r}}`);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return `{count, plural, ${t ? `offset:${t} ` : ""}${n.join(" ")}}`;
|
|
366
|
-
}
|
|
367
|
-
var H = (e) => {
|
|
368
|
-
let { t } = T();
|
|
331
|
+
}, z = (e) => {
|
|
332
|
+
let { t } = D();
|
|
369
333
|
function n(e) {
|
|
370
334
|
return typeof e == "function" ? e() : e;
|
|
371
335
|
}
|
|
372
336
|
return (() => {
|
|
373
337
|
let r = {};
|
|
374
|
-
for (let t of
|
|
338
|
+
for (let t of l) {
|
|
375
339
|
let i = n(e[t]);
|
|
376
340
|
i !== void 0 && (r[t] = i);
|
|
377
341
|
}
|
|
378
|
-
let { messages: i, components: a } =
|
|
342
|
+
let { messages: i, components: a } = P(l, r), o = d({
|
|
379
343
|
...i.zero !== void 0 && { zero: i.zero },
|
|
380
344
|
...i.one !== void 0 && { one: i.one },
|
|
381
345
|
...i.two !== void 0 && { two: i.two },
|
|
@@ -383,22 +347,20 @@ var H = (e) => {
|
|
|
383
347
|
...i.many !== void 0 && { many: i.many },
|
|
384
348
|
other: i.other ?? ""
|
|
385
349
|
}, e.offset), s = t({
|
|
386
|
-
id: e.id ?? (e.context === void 0 ? o :
|
|
350
|
+
id: e.id ?? (e.context === void 0 ? o : p(o, e.context)),
|
|
387
351
|
message: o,
|
|
388
352
|
...e.context === void 0 ? {} : { context: e.context },
|
|
389
353
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
390
|
-
}, { count: e.value });
|
|
391
|
-
return
|
|
354
|
+
}, { count: e.value }), c = a.length > 0 ? N(s, a) : s;
|
|
355
|
+
return e.tag ? y(v, {
|
|
392
356
|
get component() {
|
|
393
|
-
return e.tag
|
|
357
|
+
return e.tag;
|
|
394
358
|
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
});
|
|
359
|
+
children: c
|
|
360
|
+
}) : c;
|
|
399
361
|
});
|
|
400
|
-
},
|
|
401
|
-
let { t } =
|
|
362
|
+
}, B = (e) => {
|
|
363
|
+
let { t } = D(), n = () => {
|
|
402
364
|
let n = e.options === void 0 ? {
|
|
403
365
|
...Object.fromEntries(Object.entries(e).filter(([e]) => ![
|
|
404
366
|
"value",
|
|
@@ -413,36 +375,36 @@ var H = (e) => {
|
|
|
413
375
|
} : {
|
|
414
376
|
...e.options,
|
|
415
377
|
other: e.other
|
|
416
|
-
}, r = [...Object.keys(n).filter((e) => e !== "other"), "other"], { messages: i, components: a } =
|
|
417
|
-
id: e.id ?? (e.context === void 0 ?
|
|
418
|
-
message:
|
|
378
|
+
}, r = [...Object.keys(n).filter((e) => e !== "other"), "other"], { messages: i, components: a } = P(r, n), o = h(Object.fromEntries([...r].map((e) => [e, i[e] ?? ""]))), s = t({
|
|
379
|
+
id: e.id ?? (e.context === void 0 ? f(o.forms) : p(f(o.forms), e.context)),
|
|
380
|
+
message: f(o.forms),
|
|
419
381
|
...e.context === void 0 ? {} : { context: e.context },
|
|
420
382
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
421
383
|
}, { value: o.valueMap[e.value] ?? "other" });
|
|
422
|
-
return a.length > 0 ?
|
|
384
|
+
return a.length > 0 ? N(s, a) : s;
|
|
423
385
|
};
|
|
424
|
-
return
|
|
386
|
+
return (() => e.tag ? y(v, {
|
|
425
387
|
get component() {
|
|
426
|
-
return
|
|
388
|
+
return e.tag;
|
|
427
389
|
},
|
|
428
390
|
get children() {
|
|
429
|
-
return
|
|
391
|
+
return n();
|
|
430
392
|
}
|
|
431
|
-
});
|
|
393
|
+
}) : b(n));
|
|
432
394
|
};
|
|
433
395
|
//#endregion
|
|
434
396
|
//#region src/components/DateTime.tsx
|
|
435
|
-
function
|
|
436
|
-
let { d: t } =
|
|
437
|
-
return
|
|
397
|
+
function V(e) {
|
|
398
|
+
let { d: t } = D();
|
|
399
|
+
return b(() => t(e.value, e.style));
|
|
438
400
|
}
|
|
439
401
|
//#endregion
|
|
440
402
|
//#region src/components/NumberFormat.tsx
|
|
441
|
-
function
|
|
442
|
-
let { n: t } =
|
|
443
|
-
return
|
|
403
|
+
function H(e) {
|
|
404
|
+
let { n: t } = D();
|
|
405
|
+
return b(() => t(e.value, e.style));
|
|
444
406
|
}
|
|
445
407
|
//#endregion
|
|
446
|
-
export {
|
|
408
|
+
export { V as DateTime, E as I18nProvider, H as NumberFormat, z as Plural, B as Select, R as Trans, w as createFluentiContext, c as msg, O as t, D as useI18n };
|
|
447
409
|
|
|
448
410
|
//# sourceMappingURL=index.js.map
|