@fluenti/solid 0.6.1 → 0.6.2
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/components-entry-Bdm3s2x9.cjs +1 -0
- package/dist/{components-entry-C-Df62O-.js → components-entry-Dfzg6Idb.js} +189 -111
- package/dist/components-entry.cjs +1 -1
- package/dist/components-entry.js +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -3
- package/dist/server.cjs +1 -2
- package/dist/server.js +0 -2
- package/dist/solid/src/compile-time-t.d.ts +0 -1
- package/dist/solid/src/compiled.d.ts +0 -1
- package/dist/solid/src/components/DateTime.d.ts +0 -1
- package/dist/solid/src/components/NumberFormat.d.ts +0 -1
- package/dist/solid/src/components-entry.d.ts +0 -1
- package/dist/solid/src/context.d.ts +7 -2
- package/dist/solid/src/hooks/__useI18n.d.ts +0 -1
- package/dist/solid/src/index.d.ts +0 -1
- package/dist/solid/src/msg.d.ts +0 -1
- package/dist/solid/src/plain-runtime.d.ts +0 -1
- package/dist/solid/src/plural.d.ts +0 -1
- package/dist/solid/src/provider.d.ts +0 -1
- package/dist/solid/src/rich-dom.d.ts +0 -1
- package/dist/solid/src/select.d.ts +0 -1
- package/dist/solid/src/server.d.ts +0 -1
- package/dist/solid/src/solid-runtime.d.ts +0 -1
- package/dist/solid/src/trans.d.ts +0 -1
- package/dist/solid/src/types.d.ts +0 -1
- package/dist/solid/src/use-i18n.d.ts +2 -2
- package/dist/solid/src/vite-plugin.d.ts +0 -1
- package/dist/vite-plugin.cjs +1 -2
- package/dist/vite-plugin.js +0 -2
- package/package.json +3 -3
- package/src/context.ts +158 -1
- package/src/use-i18n.ts +8 -1
- package/dist/components-entry-5CGlUlc5.cjs +0 -2
- package/dist/components-entry-5CGlUlc5.cjs.map +0 -1
- package/dist/components-entry-C-Df62O-.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/server.cjs.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/solid/src/compile-time-t.d.ts.map +0 -1
- package/dist/solid/src/compiled.d.ts.map +0 -1
- package/dist/solid/src/components/DateTime.d.ts.map +0 -1
- package/dist/solid/src/components/NumberFormat.d.ts.map +0 -1
- package/dist/solid/src/components-entry.d.ts.map +0 -1
- package/dist/solid/src/context.d.ts.map +0 -1
- package/dist/solid/src/hooks/__useI18n.d.ts.map +0 -1
- package/dist/solid/src/index.d.ts.map +0 -1
- package/dist/solid/src/msg.d.ts.map +0 -1
- package/dist/solid/src/plain-runtime.d.ts.map +0 -1
- package/dist/solid/src/plural.d.ts.map +0 -1
- package/dist/solid/src/provider.d.ts.map +0 -1
- package/dist/solid/src/rich-dom.d.ts.map +0 -1
- package/dist/solid/src/select.d.ts.map +0 -1
- package/dist/solid/src/server.d.ts.map +0 -1
- package/dist/solid/src/solid-runtime.d.ts.map +0 -1
- package/dist/solid/src/trans.d.ts.map +0 -1
- package/dist/solid/src/types.d.ts.map +0 -1
- package/dist/solid/src/use-i18n.d.ts.map +0 -1
- package/dist/solid/src/vite-plugin.d.ts.map +0 -1
- package/dist/vite-plugin.cjs.map +0 -1
- package/dist/vite-plugin.js.map +0 -1
|
@@ -3,15 +3,34 @@ import { createFluentiCore as a } from "@fluenti/core";
|
|
|
3
3
|
import { Dynamic as o, createComponent as s, memo as c } from "solid-js/web";
|
|
4
4
|
import { PLURAL_CATEGORIES as l, buildICUPluralMessage as u, buildICUSelectMessage as d, hashMessage as f, normalizeSelectForms as p, offsetIndices as m } from "@fluenti/core/runtime";
|
|
5
5
|
//#region src/context.ts
|
|
6
|
-
var h = Symbol.for("fluenti.runtime.solid.v1");
|
|
7
|
-
function
|
|
6
|
+
var h = Symbol.for("fluenti.runtime.solid.v1"), g = Symbol.for("fluenti.solid.context.v1"), _ = Symbol.for("fluenti.solid.fallback-context.v1");
|
|
7
|
+
function v() {
|
|
8
8
|
let e = globalThis[h];
|
|
9
9
|
return typeof e == "object" && e ? e : null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function y(e) {
|
|
12
12
|
return typeof e == "object" && e && "default" in e ? e.default : e;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
function b() {
|
|
15
|
+
try {
|
|
16
|
+
if (typeof process < "u" && process.env != null && process.env.NODE_ENV === "production") return !1;
|
|
17
|
+
} catch {}
|
|
18
|
+
try {
|
|
19
|
+
return !1;
|
|
20
|
+
} catch {}
|
|
21
|
+
try {
|
|
22
|
+
if (typeof process < "u" && process.env != null) return process.env.NODE_ENV !== "production";
|
|
23
|
+
} catch {}
|
|
24
|
+
return !1;
|
|
25
|
+
}
|
|
26
|
+
function x(e) {
|
|
27
|
+
let t = globalThis[e];
|
|
28
|
+
return t && typeof t == "object" ? t : void 0;
|
|
29
|
+
}
|
|
30
|
+
function S(e, t) {
|
|
31
|
+
return globalThis[e] = t, t;
|
|
32
|
+
}
|
|
33
|
+
var C = {
|
|
15
34
|
en: "USD",
|
|
16
35
|
"en-US": "USD",
|
|
17
36
|
"en-GB": "GBP",
|
|
@@ -40,7 +59,7 @@ var v = {
|
|
|
40
59
|
ru: "RUB",
|
|
41
60
|
ar: "SAR",
|
|
42
61
|
hi: "INR"
|
|
43
|
-
},
|
|
62
|
+
}, w = {
|
|
44
63
|
short: {
|
|
45
64
|
year: "numeric",
|
|
46
65
|
month: "numeric",
|
|
@@ -63,10 +82,10 @@ var v = {
|
|
|
63
82
|
hour: "numeric",
|
|
64
83
|
minute: "numeric"
|
|
65
84
|
}
|
|
66
|
-
},
|
|
85
|
+
}, T = {
|
|
67
86
|
currency: (e) => ({
|
|
68
87
|
style: "currency",
|
|
69
|
-
currency:
|
|
88
|
+
currency: C[e] ?? C[e.split("-")[0]] ?? "USD"
|
|
70
89
|
}),
|
|
71
90
|
percent: { style: "percent" },
|
|
72
91
|
decimal: {
|
|
@@ -74,16 +93,70 @@ var v = {
|
|
|
74
93
|
maximumFractionDigits: 2
|
|
75
94
|
}
|
|
76
95
|
};
|
|
77
|
-
function
|
|
96
|
+
function E() {
|
|
97
|
+
let e = "en", t = { en: {} }, n = a({
|
|
98
|
+
locale: e,
|
|
99
|
+
messages: t,
|
|
100
|
+
devWarnings: !1
|
|
101
|
+
}), r = () => e, i = () => !1, o = () => new Set(Object.keys(t));
|
|
102
|
+
function s() {
|
|
103
|
+
n.locale !== e && (n.locale = e);
|
|
104
|
+
}
|
|
105
|
+
function c(e, ...t) {
|
|
106
|
+
return s(), Array.isArray(e) && "raw" in e ? n.t(e, ...t) : n.t(e, t[0]);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
locale: r,
|
|
110
|
+
setLocale: async (r) => {
|
|
111
|
+
e = r, n.locale = r, t[r] ??= {};
|
|
112
|
+
},
|
|
113
|
+
t: c,
|
|
114
|
+
loadMessages: (e, r) => {
|
|
115
|
+
n.loadMessages(e, r), t[e] = {
|
|
116
|
+
...t[e],
|
|
117
|
+
...r
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
getLocales: () => Array.from(new Set([...n.getLocales(), ...Object.keys(t)])),
|
|
121
|
+
d: (e, t) => (s(), n.d(e, t)),
|
|
122
|
+
n: (e, t) => (s(), n.n(e, t)),
|
|
123
|
+
format: (e, t) => (s(), n.format(e, t)),
|
|
124
|
+
isLoading: i,
|
|
125
|
+
loadedLocales: o,
|
|
126
|
+
preloadLocale: (e) => {},
|
|
127
|
+
te: (n, r) => {
|
|
128
|
+
let i = t[r ?? e];
|
|
129
|
+
return i !== void 0 && n in i;
|
|
130
|
+
},
|
|
131
|
+
tm: (n, r) => {
|
|
132
|
+
let i = t[r ?? e];
|
|
133
|
+
return i ? i[n] : void 0;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function D() {
|
|
138
|
+
let e = x(g);
|
|
139
|
+
if (e) return {
|
|
140
|
+
context: e,
|
|
141
|
+
source: "singleton"
|
|
142
|
+
};
|
|
143
|
+
if (!b()) return;
|
|
144
|
+
let t = x(_);
|
|
145
|
+
return t ||= S(_, E()), {
|
|
146
|
+
context: t,
|
|
147
|
+
source: "development"
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function O(e) {
|
|
78
151
|
let [t, n] = r(e.locale), [i, o] = r(!1), s = new Set([e.locale]), [c, l] = r(new Set(s)), u = { ...e.messages }, d = e, f = d.lazyLocaleLoading ?? e.splitting ?? !1, p = {
|
|
79
152
|
locale: e.locale,
|
|
80
153
|
messages: e.messages ?? {},
|
|
81
154
|
dateFormats: {
|
|
82
|
-
...
|
|
155
|
+
...w,
|
|
83
156
|
...d.dateFormats
|
|
84
157
|
},
|
|
85
158
|
numberFormats: {
|
|
86
|
-
...
|
|
159
|
+
...T,
|
|
87
160
|
...d.numberFormats
|
|
88
161
|
}
|
|
89
162
|
};
|
|
@@ -93,17 +166,17 @@ function x(e) {
|
|
|
93
166
|
let r = t();
|
|
94
167
|
return m.locale !== r && (m.locale = r), Array.isArray(e) && "raw" in e ? m.t(e, ...n) : m.t(e, n[0]);
|
|
95
168
|
}
|
|
96
|
-
let
|
|
169
|
+
let g = (e, t) => {
|
|
97
170
|
m.loadMessages(e, t), u[e] = {
|
|
98
171
|
...u[e],
|
|
99
172
|
...t
|
|
100
173
|
}, s.add(e), l(new Set(s));
|
|
101
|
-
},
|
|
174
|
+
}, _ = 0, b = async (e) => {
|
|
102
175
|
if (!f || !d.chunkLoader) {
|
|
103
176
|
n(e);
|
|
104
177
|
return;
|
|
105
178
|
}
|
|
106
|
-
let t =
|
|
179
|
+
let t = v();
|
|
107
180
|
if (s.has(e)) {
|
|
108
181
|
try {
|
|
109
182
|
t?.__switchLocale && await t.__switchLocale(e);
|
|
@@ -113,30 +186,30 @@ function x(e) {
|
|
|
113
186
|
n(e);
|
|
114
187
|
return;
|
|
115
188
|
}
|
|
116
|
-
let r = ++
|
|
189
|
+
let r = ++_;
|
|
117
190
|
o(!0);
|
|
118
191
|
try {
|
|
119
|
-
let i =
|
|
192
|
+
let i = y(await d.chunkLoader(e));
|
|
120
193
|
if (m.loadMessages(e, i), u[e] = {
|
|
121
194
|
...u[e],
|
|
122
195
|
...i
|
|
123
|
-
}, s.add(e), l(new Set(s)), r !==
|
|
196
|
+
}, s.add(e), l(new Set(s)), r !== _) return;
|
|
124
197
|
try {
|
|
125
198
|
t?.__switchLocale && await t.__switchLocale(e);
|
|
126
199
|
} catch (t) {
|
|
127
200
|
console.warn(`[fluenti] split runtime switch failed for locale "${e}"`, t);
|
|
128
201
|
}
|
|
129
|
-
if (r !==
|
|
202
|
+
if (r !== _) return;
|
|
130
203
|
n(e);
|
|
131
204
|
} finally {
|
|
132
|
-
r ===
|
|
205
|
+
r === _ && o(!1);
|
|
133
206
|
}
|
|
134
|
-
},
|
|
207
|
+
}, x = /* @__PURE__ */ new Set();
|
|
135
208
|
return {
|
|
136
209
|
locale: t,
|
|
137
|
-
setLocale:
|
|
210
|
+
setLocale: b,
|
|
138
211
|
t: h,
|
|
139
|
-
loadMessages:
|
|
212
|
+
loadMessages: g,
|
|
140
213
|
getLocales: () => m.getLocales(),
|
|
141
214
|
d: (e, n) => {
|
|
142
215
|
let r = t();
|
|
@@ -153,11 +226,11 @@ function x(e) {
|
|
|
153
226
|
isLoading: i,
|
|
154
227
|
loadedLocales: c,
|
|
155
228
|
preloadLocale: (e) => {
|
|
156
|
-
if (!f || s.has(e) || !d.chunkLoader ||
|
|
157
|
-
|
|
158
|
-
let t =
|
|
229
|
+
if (!f || s.has(e) || !d.chunkLoader || x.has(e)) return;
|
|
230
|
+
x.add(e);
|
|
231
|
+
let t = v();
|
|
159
232
|
d.chunkLoader(e).then(async (n) => {
|
|
160
|
-
let r =
|
|
233
|
+
let r = y(n);
|
|
161
234
|
m.loadMessages(e, r), u[e] = {
|
|
162
235
|
...u[e],
|
|
163
236
|
...r
|
|
@@ -165,7 +238,7 @@ function x(e) {
|
|
|
165
238
|
}).catch((t) => {
|
|
166
239
|
console.warn("[fluenti] preload failed:", e, t);
|
|
167
240
|
}).finally(() => {
|
|
168
|
-
|
|
241
|
+
x.delete(e);
|
|
169
242
|
});
|
|
170
243
|
},
|
|
171
244
|
te: (e, n) => {
|
|
@@ -178,9 +251,14 @@ function x(e) {
|
|
|
178
251
|
}
|
|
179
252
|
};
|
|
180
253
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
254
|
+
function k(e) {
|
|
255
|
+
return S(g, O(e));
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/provider.tsx
|
|
259
|
+
var A = t(), j = (e) => {
|
|
260
|
+
let t = O(e);
|
|
261
|
+
return s(A.Provider, {
|
|
184
262
|
value: t,
|
|
185
263
|
get children() {
|
|
186
264
|
return e.children;
|
|
@@ -189,26 +267,28 @@ var S = x, C = t(), w = (e) => {
|
|
|
189
267
|
};
|
|
190
268
|
//#endregion
|
|
191
269
|
//#region src/use-i18n.ts
|
|
192
|
-
function
|
|
193
|
-
let e = i(
|
|
270
|
+
function M() {
|
|
271
|
+
let e = i(A);
|
|
194
272
|
if (e) return e;
|
|
273
|
+
let t = D();
|
|
274
|
+
if (t) return t.context;
|
|
195
275
|
throw Error("useI18n() must be used inside an <I18nProvider>.");
|
|
196
276
|
}
|
|
197
|
-
function
|
|
198
|
-
return
|
|
277
|
+
function N() {
|
|
278
|
+
return M().locale;
|
|
199
279
|
}
|
|
200
280
|
//#endregion
|
|
201
281
|
//#region src/rich-dom.tsx
|
|
202
|
-
function
|
|
282
|
+
function P(e) {
|
|
203
283
|
return typeof Node < "u" && e instanceof Node;
|
|
204
284
|
}
|
|
205
|
-
function
|
|
285
|
+
function F(e) {
|
|
206
286
|
return typeof e == "function" && !e.length ? e() : e;
|
|
207
287
|
}
|
|
208
|
-
function
|
|
288
|
+
function I(e) {
|
|
209
289
|
let t = [], n = "";
|
|
210
290
|
function r(e) {
|
|
211
|
-
let i =
|
|
291
|
+
let i = F(e);
|
|
212
292
|
if (i == null || typeof i == "boolean") return;
|
|
213
293
|
if (Array.isArray(i)) {
|
|
214
294
|
for (let e of i) r(e);
|
|
@@ -218,7 +298,7 @@ function k(e) {
|
|
|
218
298
|
n += String(i);
|
|
219
299
|
return;
|
|
220
300
|
}
|
|
221
|
-
if (!
|
|
301
|
+
if (!P(i)) return;
|
|
222
302
|
if (i.nodeType === Node.TEXT_NODE) {
|
|
223
303
|
n += i.textContent ?? "";
|
|
224
304
|
return;
|
|
@@ -227,7 +307,7 @@ function k(e) {
|
|
|
227
307
|
r(Array.from(i.childNodes));
|
|
228
308
|
return;
|
|
229
309
|
}
|
|
230
|
-
let a = t.length, o =
|
|
310
|
+
let a = t.length, o = I(Array.from(i.childNodes));
|
|
231
311
|
t.push(i.cloneNode(!1)), t.push(...o.components), o.message === "" && o.components.length === 0 ? n += `<${a}/>` : n += `<${a}>${m(o.message, a + 1)}</${a}>`;
|
|
232
312
|
}
|
|
233
313
|
return r(e), {
|
|
@@ -235,21 +315,21 @@ function k(e) {
|
|
|
235
315
|
components: t
|
|
236
316
|
};
|
|
237
317
|
}
|
|
238
|
-
function
|
|
239
|
-
let n =
|
|
318
|
+
function L(e, t) {
|
|
319
|
+
let n = F(t);
|
|
240
320
|
if (!(n == null || typeof n == "boolean")) {
|
|
241
321
|
if (Array.isArray(n)) {
|
|
242
|
-
for (let t of n)
|
|
322
|
+
for (let t of n) L(e, t);
|
|
243
323
|
return;
|
|
244
324
|
}
|
|
245
325
|
if (typeof n == "string" || typeof n == "number") {
|
|
246
326
|
e.appendChild(document.createTextNode(String(n)));
|
|
247
327
|
return;
|
|
248
328
|
}
|
|
249
|
-
|
|
329
|
+
P(n) && e.appendChild(n);
|
|
250
330
|
}
|
|
251
331
|
}
|
|
252
|
-
function
|
|
332
|
+
function R(e, t) {
|
|
253
333
|
let n = /<(\d+)(?:\/>|(>)([\s\S]*?)<\/\1>)/g, r = [], i = 0, a;
|
|
254
334
|
for (n.lastIndex = 0, a = n.exec(e); a !== null;) {
|
|
255
335
|
a.index > i && r.push(e.slice(i, a.index));
|
|
@@ -261,27 +341,27 @@ function j(e, t) {
|
|
|
261
341
|
let c = t[o];
|
|
262
342
|
if (s) c && r.push(c.cloneNode(!1));
|
|
263
343
|
else {
|
|
264
|
-
let e =
|
|
344
|
+
let e = R(a[2] === void 0 ? "" : a[3], t);
|
|
265
345
|
if (c) {
|
|
266
346
|
let t = c.cloneNode(!1);
|
|
267
|
-
|
|
347
|
+
L(t, e), r.push(t);
|
|
268
348
|
} else r.push(a[3] ?? "");
|
|
269
349
|
}
|
|
270
350
|
i = n.lastIndex, a = n.exec(e);
|
|
271
351
|
}
|
|
272
352
|
return i < e.length && r.push(e.slice(i)), r.length <= 1 ? r[0] ?? "" : r;
|
|
273
353
|
}
|
|
274
|
-
function
|
|
354
|
+
function z(e, t) {
|
|
275
355
|
let n = {}, r = [];
|
|
276
356
|
for (let i of e) {
|
|
277
357
|
let e = t[i];
|
|
278
358
|
if (e === void 0) continue;
|
|
279
|
-
let a =
|
|
359
|
+
let a = I(e);
|
|
280
360
|
n[i] = m(a.message, r.length), r.push(...a.components);
|
|
281
361
|
}
|
|
282
362
|
for (let [i, a] of Object.entries(t)) {
|
|
283
363
|
if (e.includes(i) || a === void 0) continue;
|
|
284
|
-
let t =
|
|
364
|
+
let t = I(a);
|
|
285
365
|
n[i] = m(t.message, r.length), r.push(...t.components);
|
|
286
366
|
}
|
|
287
367
|
return {
|
|
@@ -291,9 +371,9 @@ function M(e, t) {
|
|
|
291
371
|
}
|
|
292
372
|
//#endregion
|
|
293
373
|
//#region src/trans.tsx
|
|
294
|
-
var
|
|
295
|
-
function
|
|
296
|
-
if (t >
|
|
374
|
+
var B = 100;
|
|
375
|
+
function V(e, t = 0) {
|
|
376
|
+
if (t > B) return [{
|
|
297
377
|
type: "text",
|
|
298
378
|
value: e
|
|
299
379
|
}];
|
|
@@ -328,7 +408,7 @@ function P(e, t = 0) {
|
|
|
328
408
|
}), r = i + 1;
|
|
329
409
|
continue;
|
|
330
410
|
}
|
|
331
|
-
let s = o[1], c = i + o[0].length, l =
|
|
411
|
+
let s = o[1], c = i + o[0].length, l = H(e, s, c);
|
|
332
412
|
if (l === -1) {
|
|
333
413
|
n.push({
|
|
334
414
|
type: "text",
|
|
@@ -340,12 +420,12 @@ function P(e, t = 0) {
|
|
|
340
420
|
n.push({
|
|
341
421
|
type: "tag",
|
|
342
422
|
name: s,
|
|
343
|
-
children:
|
|
423
|
+
children: V(u, t + 1)
|
|
344
424
|
}), r = l + d.length;
|
|
345
425
|
}
|
|
346
426
|
return n;
|
|
347
427
|
}
|
|
348
|
-
function
|
|
428
|
+
function H(e, t, n) {
|
|
349
429
|
let r = `<${t}>`, i = `</${t}>`, a = 1, o = n;
|
|
350
430
|
for (; o < e.length && a > 0;) {
|
|
351
431
|
let t = e.indexOf(r, o), n = e.indexOf(i, o);
|
|
@@ -358,25 +438,25 @@ function F(e, t, n) {
|
|
|
358
438
|
}
|
|
359
439
|
return -1;
|
|
360
440
|
}
|
|
361
|
-
function
|
|
441
|
+
function U(e, t) {
|
|
362
442
|
let n = e.map((e) => {
|
|
363
443
|
if (e.type === "text") return e.value;
|
|
364
444
|
let n = t[e.name];
|
|
365
445
|
return n ? s(o, {
|
|
366
446
|
component: n,
|
|
367
|
-
children: e.children.length > 0 ?
|
|
368
|
-
}) :
|
|
447
|
+
children: e.children.length > 0 ? U(e.children, t) : void 0
|
|
448
|
+
}) : U(e.children, t);
|
|
369
449
|
});
|
|
370
450
|
return n.length === 1 ? n[0] : n;
|
|
371
451
|
}
|
|
372
|
-
var
|
|
373
|
-
let { t: r } =
|
|
452
|
+
var W = (t) => {
|
|
453
|
+
let { t: r } = M(), i = e(() => t.children), a = n(() => {
|
|
374
454
|
let e = t.__message ?? t.message;
|
|
375
455
|
return typeof e == "function" ? e() : e;
|
|
376
456
|
}), c = n(() => t.__components ?? t.components);
|
|
377
457
|
return (() => {
|
|
378
458
|
let e = a(), n = c();
|
|
379
|
-
if (e !== void 0 && n) return
|
|
459
|
+
if (e !== void 0 && n) return U(V(r({
|
|
380
460
|
...t.id === void 0 ? {} : { id: t.id },
|
|
381
461
|
message: e,
|
|
382
462
|
...t.context === void 0 ? {} : { context: t.context },
|
|
@@ -384,12 +464,12 @@ var L = (t) => {
|
|
|
384
464
|
})), n);
|
|
385
465
|
let l = i.toArray();
|
|
386
466
|
if (l.length === 0) return null;
|
|
387
|
-
let u =
|
|
467
|
+
let u = I(l), d = r({
|
|
388
468
|
...t.id === void 0 ? {} : { id: t.id },
|
|
389
469
|
message: u.message,
|
|
390
470
|
...t.context === void 0 ? {} : { context: t.context },
|
|
391
471
|
...t.comment === void 0 ? {} : { comment: t.comment }
|
|
392
|
-
}), f = u.components.length > 0 ?
|
|
472
|
+
}), f = u.components.length > 0 ? R(d, u.components) : d;
|
|
393
473
|
return Array.isArray(f) && f.length > 1 && t.tag ? s(o, {
|
|
394
474
|
get component() {
|
|
395
475
|
return t.tag;
|
|
@@ -400,32 +480,32 @@ var L = (t) => {
|
|
|
400
480
|
};
|
|
401
481
|
//#endregion
|
|
402
482
|
//#region src/plain-runtime.ts
|
|
403
|
-
function
|
|
483
|
+
function G(e) {
|
|
404
484
|
return typeof e == "function" && !e.length ? e() : e;
|
|
405
485
|
}
|
|
406
|
-
function
|
|
486
|
+
function K(e, t, n) {
|
|
407
487
|
return e ?? (n === void 0 ? t : f(t, n));
|
|
408
488
|
}
|
|
409
|
-
function
|
|
489
|
+
function q(e) {
|
|
410
490
|
return typeof e == "string" || typeof e == "number";
|
|
411
491
|
}
|
|
412
|
-
function
|
|
492
|
+
function J(e, t) {
|
|
413
493
|
let n = {};
|
|
414
494
|
for (let t of l) {
|
|
415
|
-
let r =
|
|
495
|
+
let r = G(e[t]);
|
|
416
496
|
if (r !== void 0) {
|
|
417
|
-
if (!
|
|
497
|
+
if (!q(r)) return;
|
|
418
498
|
n[t] = String(r);
|
|
419
499
|
}
|
|
420
500
|
}
|
|
421
501
|
if (n.other !== void 0) return u(n, t);
|
|
422
502
|
}
|
|
423
|
-
function
|
|
503
|
+
function Y(e) {
|
|
424
504
|
let t = {};
|
|
425
505
|
for (let [n, r] of Object.entries(e)) {
|
|
426
|
-
let e =
|
|
506
|
+
let e = G(r);
|
|
427
507
|
if (e !== void 0) {
|
|
428
|
-
if (!
|
|
508
|
+
if (!q(e)) return;
|
|
429
509
|
t[n] = String(e);
|
|
430
510
|
}
|
|
431
511
|
}
|
|
@@ -438,18 +518,18 @@ function H(e) {
|
|
|
438
518
|
}
|
|
439
519
|
//#endregion
|
|
440
520
|
//#region src/plural.tsx
|
|
441
|
-
var
|
|
442
|
-
let { t } =
|
|
521
|
+
var X = (e) => {
|
|
522
|
+
let { t } = M();
|
|
443
523
|
return (() => {
|
|
444
524
|
let n = {};
|
|
445
525
|
for (let t of l) {
|
|
446
|
-
let r =
|
|
526
|
+
let r = G(e[t]);
|
|
447
527
|
r !== void 0 && (n[t] = r);
|
|
448
528
|
}
|
|
449
|
-
let r =
|
|
529
|
+
let r = J(n, e.offset);
|
|
450
530
|
if (r !== void 0) {
|
|
451
531
|
let n = t({
|
|
452
|
-
id:
|
|
532
|
+
id: K(e.id, r, e.context),
|
|
453
533
|
message: r,
|
|
454
534
|
...e.context === void 0 ? {} : { context: e.context },
|
|
455
535
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
@@ -461,7 +541,7 @@ var U = (e) => {
|
|
|
461
541
|
children: n
|
|
462
542
|
}) : n;
|
|
463
543
|
}
|
|
464
|
-
let { messages: i, components: a } =
|
|
544
|
+
let { messages: i, components: a } = z(l, n), c = u({
|
|
465
545
|
...i.zero !== void 0 && { zero: i.zero },
|
|
466
546
|
...i.one !== void 0 && { one: i.one },
|
|
467
547
|
...i.two !== void 0 && { two: i.two },
|
|
@@ -469,11 +549,11 @@ var U = (e) => {
|
|
|
469
549
|
...i.many !== void 0 && { many: i.many },
|
|
470
550
|
other: i.other ?? ""
|
|
471
551
|
}, e.offset), d = t({
|
|
472
|
-
id:
|
|
552
|
+
id: K(e.id, c, e.context),
|
|
473
553
|
message: c,
|
|
474
554
|
...e.context === void 0 ? {} : { context: e.context },
|
|
475
555
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
476
|
-
}, { count: e.value }), f = a.length > 0 ?
|
|
556
|
+
}, { count: e.value }), f = a.length > 0 ? R(d, a) : d;
|
|
477
557
|
return e.tag ? s(o, {
|
|
478
558
|
get component() {
|
|
479
559
|
return e.tag;
|
|
@@ -481,8 +561,8 @@ var U = (e) => {
|
|
|
481
561
|
children: f
|
|
482
562
|
}) : f;
|
|
483
563
|
});
|
|
484
|
-
},
|
|
485
|
-
let { t } =
|
|
564
|
+
}, Z = (e) => {
|
|
565
|
+
let { t } = M(), n = () => {
|
|
486
566
|
let n = new Set([
|
|
487
567
|
"value",
|
|
488
568
|
"id",
|
|
@@ -507,20 +587,20 @@ var U = (e) => {
|
|
|
507
587
|
} : {
|
|
508
588
|
...e.options,
|
|
509
589
|
other: e.other
|
|
510
|
-
}, i =
|
|
590
|
+
}, i = Y(r);
|
|
511
591
|
if (i !== void 0) return t({
|
|
512
|
-
id:
|
|
592
|
+
id: K(e.id, i.message, e.context),
|
|
513
593
|
message: i.message,
|
|
514
594
|
...e.context === void 0 ? {} : { context: e.context },
|
|
515
595
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
516
596
|
}, { value: i.valueMap[e.value] ?? "other" });
|
|
517
|
-
let a = [...Object.keys(r).filter((e) => e !== "other"), "other"], { messages: o, components: s } =
|
|
518
|
-
id:
|
|
597
|
+
let a = [...Object.keys(r).filter((e) => e !== "other"), "other"], { messages: o, components: s } = z(a, r), c = p(Object.fromEntries([...a].map((e) => [e, o[e] ?? ""]))), l = t({
|
|
598
|
+
id: K(e.id, d(c.forms), e.context),
|
|
519
599
|
message: d(c.forms),
|
|
520
600
|
...e.context === void 0 ? {} : { context: e.context },
|
|
521
601
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
522
602
|
}, { value: c.valueMap[e.value] ?? "other" });
|
|
523
|
-
return s.length > 0 ?
|
|
603
|
+
return s.length > 0 ? R(l, s) : l;
|
|
524
604
|
};
|
|
525
605
|
return (() => e.tag ? s(o, {
|
|
526
606
|
get component() {
|
|
@@ -533,27 +613,27 @@ var U = (e) => {
|
|
|
533
613
|
};
|
|
534
614
|
//#endregion
|
|
535
615
|
//#region src/components/DateTime.tsx
|
|
536
|
-
function
|
|
537
|
-
let { d: t } =
|
|
616
|
+
function Q(e) {
|
|
617
|
+
let { d: t } = M();
|
|
538
618
|
return c(() => t(e.value, e.format));
|
|
539
619
|
}
|
|
540
620
|
//#endregion
|
|
541
621
|
//#region src/components/NumberFormat.tsx
|
|
542
|
-
function
|
|
543
|
-
let { n: t } =
|
|
622
|
+
function $(e) {
|
|
623
|
+
let { n: t } = M();
|
|
544
624
|
return c(() => t(e.value, e.format));
|
|
545
625
|
}
|
|
546
626
|
//#endregion
|
|
547
627
|
//#region src/compiled.tsx
|
|
548
|
-
var
|
|
549
|
-
let { t } =
|
|
628
|
+
var ee = (e) => {
|
|
629
|
+
let { t } = M();
|
|
550
630
|
return (() => {
|
|
551
631
|
let n = t({
|
|
552
632
|
id: e.id ?? f(e.message, e.context),
|
|
553
633
|
message: e.message,
|
|
554
634
|
...e.context === void 0 ? {} : { context: e.context },
|
|
555
635
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
556
|
-
}), r = e.components && e.components.length > 0 ?
|
|
636
|
+
}), r = e.components && e.components.length > 0 ? R(n, e.components) : n;
|
|
557
637
|
return e.tag ? s(o, {
|
|
558
638
|
get component() {
|
|
559
639
|
return e.tag;
|
|
@@ -561,11 +641,11 @@ var q = (e) => {
|
|
|
561
641
|
children: r
|
|
562
642
|
}) : r;
|
|
563
643
|
});
|
|
564
|
-
},
|
|
565
|
-
let { t } =
|
|
644
|
+
}, te = (e) => {
|
|
645
|
+
let { t } = M();
|
|
566
646
|
return (() => {
|
|
567
647
|
let n = t({
|
|
568
|
-
id:
|
|
648
|
+
id: K(e.id, e.message, e.context),
|
|
569
649
|
message: e.message,
|
|
570
650
|
...e.context === void 0 ? {} : { context: e.context },
|
|
571
651
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
@@ -577,11 +657,11 @@ var q = (e) => {
|
|
|
577
657
|
children: n
|
|
578
658
|
}) : n;
|
|
579
659
|
});
|
|
580
|
-
},
|
|
581
|
-
let { t } =
|
|
660
|
+
}, ne = (e) => {
|
|
661
|
+
let { t } = M();
|
|
582
662
|
return (() => {
|
|
583
663
|
let n = t({
|
|
584
|
-
id:
|
|
664
|
+
id: K(e.id, e.message, e.context),
|
|
585
665
|
message: e.message,
|
|
586
666
|
...e.context === void 0 ? {} : { context: e.context },
|
|
587
667
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
@@ -593,15 +673,15 @@ var q = (e) => {
|
|
|
593
673
|
children: n
|
|
594
674
|
}) : n;
|
|
595
675
|
});
|
|
596
|
-
},
|
|
597
|
-
let { t } =
|
|
676
|
+
}, re = (e) => {
|
|
677
|
+
let { t } = M();
|
|
598
678
|
return (() => {
|
|
599
679
|
let n = t({
|
|
600
|
-
id:
|
|
680
|
+
id: K(e.id, e.message, e.context),
|
|
601
681
|
message: e.message,
|
|
602
682
|
...e.context === void 0 ? {} : { context: e.context },
|
|
603
683
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
604
|
-
}, { count: e.value }), r = e.components.length > 0 ?
|
|
684
|
+
}, { count: e.value }), r = e.components.length > 0 ? R(n, e.components) : n;
|
|
605
685
|
return e.tag ? s(o, {
|
|
606
686
|
get component() {
|
|
607
687
|
return e.tag;
|
|
@@ -609,15 +689,15 @@ var q = (e) => {
|
|
|
609
689
|
children: r
|
|
610
690
|
}) : r;
|
|
611
691
|
});
|
|
612
|
-
},
|
|
613
|
-
let { t } =
|
|
692
|
+
}, ie = (e) => {
|
|
693
|
+
let { t } = M();
|
|
614
694
|
return (() => {
|
|
615
695
|
let n = t({
|
|
616
|
-
id:
|
|
696
|
+
id: K(e.id, e.message, e.context),
|
|
617
697
|
message: e.message,
|
|
618
698
|
...e.context === void 0 ? {} : { context: e.context },
|
|
619
699
|
...e.comment === void 0 ? {} : { comment: e.comment }
|
|
620
|
-
}, { value: e.valueMap?.[e.value] ?? "other" }), r = e.components.length > 0 ?
|
|
700
|
+
}, { value: e.valueMap?.[e.value] ?? "other" }), r = e.components.length > 0 ? R(n, e.components) : n;
|
|
621
701
|
return e.tag ? s(o, {
|
|
622
702
|
get component() {
|
|
623
703
|
return e.tag;
|
|
@@ -627,6 +707,4 @@ var q = (e) => {
|
|
|
627
707
|
});
|
|
628
708
|
};
|
|
629
709
|
//#endregion
|
|
630
|
-
export {
|
|
631
|
-
|
|
632
|
-
//# sourceMappingURL=components-entry-C-Df62O-.js.map
|
|
710
|
+
export { ee as a, Z as c, M as d, N as f, ne as i, X as l, k as m, re as n, $ as o, j as p, ie as r, Q as s, te as t, W as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./components-entry-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./components-entry-Bdm3s2x9.cjs`);exports.DateTime=e.s,exports.NumberFormat=e.o,exports.Plural=e.l,exports.Select=e.c,exports.Trans=e.u,exports.__FluentiCompiledPlural=e.t,exports.__FluentiCompiledRichPlural=e.n,exports.__FluentiCompiledRichSelect=e.r,exports.__FluentiCompiledSelect=e.i,exports.__FluentiCompiledTrans=e.a;
|
package/dist/components-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./components-entry-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./components-entry-Dfzg6Idb.js";
|
|
2
2
|
export { s as DateTime, a as NumberFormat, r as Plural, t as Select, l as Trans, c as __FluentiCompiledPlural, i as __FluentiCompiledRichPlural, o as __FluentiCompiledRichSelect, n as __FluentiCompiledSelect, e as __FluentiCompiledTrans };
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./components-entry-
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./components-entry-Bdm3s2x9.cjs`);let t=require(`@fluenti/core`);var n=((...e)=>{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(...).")});exports.DateTime=e.s,exports.I18nProvider=e.p,exports.NumberFormat=e.o,exports.Plural=e.l,exports.Select=e.c,exports.Trans=e.u,exports.createFluenti=e.m,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return t.msg}}),exports.t=n,exports.useI18n=e.d,exports.useLocale=e.f;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, d as t, f as n, l as r, m as i, o as a, p as o, s, u as c } from "./components-entry-
|
|
1
|
+
import { c as e, d as t, f as n, l as r, m as i, o as a, p as o, s, u as c } from "./components-entry-Dfzg6Idb.js";
|
|
2
2
|
import { msg as l } from "@fluenti/core";
|
|
3
3
|
//#region src/compile-time-t.ts
|
|
4
4
|
var u = ((...e) => {
|
|
@@ -6,5 +6,3 @@ var u = ((...e) => {
|
|
|
6
6
|
});
|
|
7
7
|
//#endregion
|
|
8
8
|
export { s as DateTime, o as I18nProvider, a as NumberFormat, r as Plural, e as Select, c as Trans, i as createFluenti, l as msg, u as t, t as useI18n, n as useLocale };
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=index.js.map
|