@prefabs.tech/vue3-i18n 0.32.0 → 0.33.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/dist/PrefabsTechVue3I18n.es.js +261 -331
- package/dist/PrefabsTechVue3I18n.umd.js +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/locale-switcher/Badge.vue.d.ts +3 -2
- package/dist/src/locale-switcher/Badge.vue.d.ts.map +1 -1
- package/dist/src/locale-switcher/Index.vue.d.ts +5 -4
- package/dist/src/locale-switcher/Index.vue.d.ts.map +1 -1
- package/dist/src/locale-switcher/LocaleOption.vue.d.ts +3 -2
- package/dist/src/locale-switcher/LocaleOption.vue.d.ts.map +1 -1
- package/dist/src/store.d.ts.map +1 -1
- package/dist/src/utilities.d.ts.map +1 -1
- package/dist/vue3-i18n.css +2 -1
- package/package.json +30 -23
- package/dist/src/__test__/unit/LocaleNames.test.d.ts +0 -2
- package/dist/src/__test__/unit/LocaleNames.test.d.ts.map +0 -1
- package/dist/src/__test__/unit/PreferredLocale.spec.d.ts +0 -2
- package/dist/src/__test__/unit/PreferredLocale.spec.d.ts.map +0 -1
- package/dist/src/__test__/unit/PrependMessages.spec.d.ts +0 -2
- package/dist/src/__test__/unit/PrependMessages.spec.d.ts.map +0 -1
|
@@ -1,338 +1,268 @@
|
|
|
1
|
-
import { useI18n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return D() ? (R(e), !0) : !1;
|
|
7
|
-
}
|
|
8
|
-
const j = typeof window < "u" && typeof document < "u";
|
|
1
|
+
import { createI18n as e, useI18n as t, useI18n as n } from "vue-i18n";
|
|
2
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, toValue as v, unref as y, watch as b } from "vue";
|
|
3
|
+
import { useConfig as x } from "@prefabs.tech/vue3-config";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@vueuse+shared@14.3.0_vue@3.5.40_typescript@6.0.3_/node_modules/@vueuse/shared/dist/index.js
|
|
5
|
+
var S = typeof window < "u" && typeof document < "u";
|
|
9
6
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return j && ((e = window?.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window?.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
|
|
7
|
+
var C = Object.prototype.toString, w = (e) => C.call(e) === "[object Object]", T = () => {}, E = /* @__PURE__ */ D();
|
|
8
|
+
function D() {
|
|
9
|
+
var e, t;
|
|
10
|
+
return S && !!(!((e = window) == null || (e = e.navigator) == null) && e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window) == null || (t = t.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
|
|
15
11
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
12
|
+
function O(e) {
|
|
13
|
+
return Array.isArray(e) ? e : [e];
|
|
18
14
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...n,
|
|
25
|
-
immediate: !0
|
|
26
|
-
}
|
|
27
|
-
);
|
|
15
|
+
function k(e, t, n) {
|
|
16
|
+
return b(e, t, {
|
|
17
|
+
...n,
|
|
18
|
+
immediate: !0
|
|
19
|
+
});
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../node_modules/.pnpm/@vueuse+core@14.3.0_vue@3.5.40_typescript@6.0.3_/node_modules/@vueuse/core/dist/index.js
|
|
23
|
+
var A = S ? window : void 0;
|
|
24
|
+
S && window.document, S && window.navigator, S && window.location;
|
|
25
|
+
function j(e) {
|
|
26
|
+
let t = v(e);
|
|
27
|
+
return t?.$el ?? t;
|
|
34
28
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
([r, a, u, p]) => {
|
|
53
|
-
if (n(), !r?.length || !a?.length || !u?.length)
|
|
54
|
-
return;
|
|
55
|
-
const g = ee(p) ? { ...p } : p;
|
|
56
|
-
t.push(
|
|
57
|
-
...r.flatMap(
|
|
58
|
-
(h) => a.flatMap(
|
|
59
|
-
(m) => u.map((k) => o(h, m, k, g))
|
|
60
|
-
)
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
},
|
|
64
|
-
{ flush: "post" }
|
|
65
|
-
), f = () => {
|
|
66
|
-
c(), n();
|
|
67
|
-
};
|
|
68
|
-
return X(n), f;
|
|
29
|
+
function M(...e) {
|
|
30
|
+
let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = i(() => {
|
|
31
|
+
let t = O(v(e[0])).filter((e) => e != null);
|
|
32
|
+
return t.every((e) => typeof e != "string") ? t : void 0;
|
|
33
|
+
});
|
|
34
|
+
return k(() => [
|
|
35
|
+
n.value?.map((e) => j(e)) ?? [A].filter((e) => e != null),
|
|
36
|
+
O(v(n.value ? e[1] : e[0])),
|
|
37
|
+
O(y(n.value ? e[2] : e[1])),
|
|
38
|
+
v(n.value ? e[3] : e[2])
|
|
39
|
+
], ([e, n, r, i], a, o) => {
|
|
40
|
+
if (!e?.length || !n?.length || !r?.length) return;
|
|
41
|
+
let s = w(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
|
|
42
|
+
o(() => {
|
|
43
|
+
c.forEach((e) => e());
|
|
44
|
+
});
|
|
45
|
+
}, { flush: "post" });
|
|
69
46
|
}
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
47
|
+
var N = !1;
|
|
48
|
+
function P(e, t, n = {}) {
|
|
49
|
+
let { window: r = A, ignore: i = [], capture: a = !0, detectIframe: o = !1, controls: s = !1 } = n;
|
|
50
|
+
if (!r) return s ? {
|
|
51
|
+
stop: T,
|
|
52
|
+
cancel: T,
|
|
53
|
+
trigger: T
|
|
54
|
+
} : T;
|
|
55
|
+
if (E && !N) {
|
|
56
|
+
N = !0;
|
|
57
|
+
let e = { passive: !0 };
|
|
58
|
+
Array.from(r.document.body.children).forEach((t) => t.addEventListener("click", T, e)), r.document.documentElement.addEventListener("click", T, e);
|
|
59
|
+
}
|
|
60
|
+
let c = !0, l = (e) => v(i).some((t) => {
|
|
61
|
+
if (typeof t == "string") return Array.from(r.document.querySelectorAll(t)).some((t) => t === e.target || e.composedPath().includes(t));
|
|
62
|
+
{
|
|
63
|
+
let n = j(t);
|
|
64
|
+
return n && (e.target === n || e.composedPath().includes(n));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function u(e) {
|
|
68
|
+
let t = v(e);
|
|
69
|
+
return t && t.$.subTree.shapeFlag === 16;
|
|
70
|
+
}
|
|
71
|
+
function d(e, t) {
|
|
72
|
+
let n = v(e), r = n.$.subTree && n.$.subTree.children;
|
|
73
|
+
return r == null || !Array.isArray(r) ? !1 : r.some((e) => e.el === t.target || t.composedPath().includes(e.el));
|
|
74
|
+
}
|
|
75
|
+
let f = (n) => {
|
|
76
|
+
let r = j(e);
|
|
77
|
+
if (n.target != null && !(!(r instanceof Element) && u(e) && d(e, n)) && !(!r || r === n.target || n.composedPath().includes(r))) {
|
|
78
|
+
if ("detail" in n && n.detail === 0 && (c = !l(n)), !c) {
|
|
79
|
+
c = !0;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
t(n);
|
|
83
|
+
}
|
|
84
|
+
}, p = !1, m = [
|
|
85
|
+
M(r, "click", (e) => {
|
|
86
|
+
p || (p = !0, setTimeout(() => {
|
|
87
|
+
p = !1;
|
|
88
|
+
}, 0), f(e));
|
|
89
|
+
}, {
|
|
90
|
+
passive: !0,
|
|
91
|
+
capture: a
|
|
92
|
+
}),
|
|
93
|
+
M(r, "pointerdown", (t) => {
|
|
94
|
+
let n = j(e);
|
|
95
|
+
c = !l(t) && !!(n && !t.composedPath().includes(n));
|
|
96
|
+
}, { passive: !0 }),
|
|
97
|
+
o && M(r, "blur", (n) => {
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
let i = j(e), a = r.document.activeElement;
|
|
100
|
+
for (; a?.shadowRoot;) a = a.shadowRoot.activeElement;
|
|
101
|
+
a?.tagName === "IFRAME" && !i?.contains(r.document.activeElement) && t(n);
|
|
102
|
+
}, 0);
|
|
103
|
+
}, { passive: !0 })
|
|
104
|
+
].filter(Boolean), h = () => m.forEach((e) => e());
|
|
105
|
+
return s ? {
|
|
106
|
+
stop: h,
|
|
107
|
+
cancel: () => {
|
|
108
|
+
c = !1;
|
|
109
|
+
},
|
|
110
|
+
trigger: (e) => {
|
|
111
|
+
c = !0, f(e), c = !1;
|
|
112
|
+
}
|
|
113
|
+
} : h;
|
|
135
114
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const s = t[o], c = e[o];
|
|
291
|
-
n[o] = c ? {
|
|
292
|
-
...c,
|
|
293
|
-
...s
|
|
294
|
-
} : s;
|
|
295
|
-
}
|
|
296
|
-
for (const o in e) {
|
|
297
|
-
if (n[o])
|
|
298
|
-
continue;
|
|
299
|
-
const s = t[o], c = e[o];
|
|
300
|
-
n[o] = s ? {
|
|
301
|
-
...c,
|
|
302
|
-
...s
|
|
303
|
-
} : c;
|
|
304
|
-
}
|
|
305
|
-
return n;
|
|
306
|
-
}, Se = (e) => {
|
|
307
|
-
const t = e.config.i18n, n = e.config.slug, { getLocale: o, setLocale: s } = q(n);
|
|
308
|
-
let c = o();
|
|
309
|
-
c || (c = Le(
|
|
310
|
-
navigator.languages,
|
|
311
|
-
t.supportedLocales
|
|
312
|
-
), s(c));
|
|
313
|
-
const f = be(
|
|
314
|
-
ye(t.supportedLocales),
|
|
315
|
-
t?.messages
|
|
316
|
-
);
|
|
317
|
-
return G({
|
|
318
|
-
...t,
|
|
319
|
-
globalInjection: !0,
|
|
320
|
-
legacy: !1,
|
|
321
|
-
locale: c,
|
|
322
|
-
messages: f
|
|
323
|
-
});
|
|
324
|
-
}, $e = {
|
|
325
|
-
install: (e, t) => {
|
|
326
|
-
const n = Se(t);
|
|
327
|
-
e.use(n);
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
export {
|
|
331
|
-
Ee as LocaleSwitcher,
|
|
332
|
-
Se as createI18n,
|
|
333
|
-
$e as default,
|
|
334
|
-
Le as getPreferredLocale,
|
|
335
|
-
be as prependMessages,
|
|
336
|
-
Oe as useI18n,
|
|
337
|
-
q as useLocaleStore
|
|
338
|
-
};
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/store.ts
|
|
117
|
+
var F = (e) => {
|
|
118
|
+
let t = `${e}.locale`;
|
|
119
|
+
return {
|
|
120
|
+
getLocale: () => localStorage.getItem(t) || void 0,
|
|
121
|
+
setLocale: (e) => {
|
|
122
|
+
e ? localStorage.setItem(t, e) : localStorage.removeItem(t);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, I = { class: "badge" }, L = {
|
|
126
|
+
key: 0,
|
|
127
|
+
class: "country"
|
|
128
|
+
}, R = /*#__PURE__*/ ((e, t) => {
|
|
129
|
+
let n = e.__vccOpts || e;
|
|
130
|
+
for (let [e, r] of t) n[e] = r;
|
|
131
|
+
return n;
|
|
132
|
+
})(/* @__PURE__ */ d({
|
|
133
|
+
name: "LocaleBadge",
|
|
134
|
+
props: { locale: {
|
|
135
|
+
required: !0,
|
|
136
|
+
type: String
|
|
137
|
+
} },
|
|
138
|
+
setup(e) {
|
|
139
|
+
let t = e, n = i(() => t.locale.slice(0, 2)), r = i(() => {
|
|
140
|
+
let e = t.locale.split("-");
|
|
141
|
+
if (e.length > 1) return e[1];
|
|
142
|
+
});
|
|
143
|
+
return (e, t) => (p(), s("span", I, [l(_(n.value) + " ", 1), r.value ? (p(), s("span", L, _(r.value), 1)) : o("", !0)]));
|
|
144
|
+
}
|
|
145
|
+
}), [["__scopeId", "data-v-83bea1dd"]]), z = { class: "locale" }, B = /* @__PURE__ */ d({
|
|
146
|
+
name: "LocaleOption",
|
|
147
|
+
props: {
|
|
148
|
+
locale: {
|
|
149
|
+
required: !0,
|
|
150
|
+
type: String
|
|
151
|
+
},
|
|
152
|
+
name: {
|
|
153
|
+
required: !0,
|
|
154
|
+
type: String
|
|
155
|
+
},
|
|
156
|
+
showBadges: {
|
|
157
|
+
default: !0,
|
|
158
|
+
type: Boolean
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
setup(e) {
|
|
162
|
+
return (t, n) => (p(), s("div", z, [e.showBadges ? (p(), a(R, {
|
|
163
|
+
key: 0,
|
|
164
|
+
locale: e.locale
|
|
165
|
+
}, null, 8, ["locale"])) : o("", !0), l(" " + _(e.name), 1)]));
|
|
166
|
+
}
|
|
167
|
+
}), V = { class: "locale truncated" }, H = { class: "truncated" }, U = { class: "dropdown" }, W = ["onClick"], G = /* @__PURE__ */ d({
|
|
168
|
+
name: "LocaleSwitcher",
|
|
169
|
+
props: { showBadges: {
|
|
170
|
+
default: !0,
|
|
171
|
+
type: Boolean
|
|
172
|
+
} },
|
|
173
|
+
setup(e) {
|
|
174
|
+
let { availableLocales: t, locale: a, t: o } = n(), l = x(), d = m(!1), v = (e) => {
|
|
175
|
+
a.value = e, d.value = !1;
|
|
176
|
+
let { setLocale: t } = F(l.slug);
|
|
177
|
+
t(e);
|
|
178
|
+
}, b = i(() => ({
|
|
179
|
+
locale: a.value,
|
|
180
|
+
name: C(a.value)
|
|
181
|
+
})), S = () => {
|
|
182
|
+
d.value = !d.value;
|
|
183
|
+
}, C = (e) => o(`locales.${e}`), w = m(null);
|
|
184
|
+
return P(w, (e) => {
|
|
185
|
+
d.value = !1;
|
|
186
|
+
}), (n, i) => (p(), s("nav", {
|
|
187
|
+
ref_key: "dzangolabVueI18nLocaleSwitcher",
|
|
188
|
+
ref: w,
|
|
189
|
+
class: f(["locale-switcher", { expanded: d.value }])
|
|
190
|
+
}, [c("div", {
|
|
191
|
+
class: "locale-trigger",
|
|
192
|
+
onClick: S
|
|
193
|
+
}, [c("div", V, _(b.value.name), 1), c("span", H, [g(n.$slots, "icon", {}, () => [i[0] ||= c("svg", {
|
|
194
|
+
"aria-label": "open user menu",
|
|
195
|
+
fill: "none",
|
|
196
|
+
viewBox: "0 0 24 24",
|
|
197
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
198
|
+
}, [c("path", {
|
|
199
|
+
"clip-rule": "evenodd",
|
|
200
|
+
"fill-rule": "evenodd",
|
|
201
|
+
d: "M12 7C12.2652 7 12.5196 7.10536 12.7071 7.29289L19.7071 14.2929C20.0976 14.6834 20.0976 15.3166 19.7071 15.7071C19.3166 16.0976 18.6834 16.0976 18.2929 15.7071L12 9.41421L5.70711 15.7071C5.31658 16.0976 4.68342 16.0976 4.29289 15.7071C3.90237 15.3166 3.90237 14.6834 4.29289 14.2929L11.2929 7.29289C11.4804 7.10536 11.7348 7 12 7Z",
|
|
202
|
+
fill: "currentColor"
|
|
203
|
+
})], -1)])])]), c("ul", U, [(p(!0), s(r, null, h(y(t), (t) => (p(), s("li", {
|
|
204
|
+
key: t,
|
|
205
|
+
class: f([{ current: t === b.value.locale }, "truncated"]),
|
|
206
|
+
onClick: (e) => v(t)
|
|
207
|
+
}, [u(B, {
|
|
208
|
+
locale: t,
|
|
209
|
+
name: C(t),
|
|
210
|
+
"show-badges": e.showBadges
|
|
211
|
+
}, null, 8, [
|
|
212
|
+
"locale",
|
|
213
|
+
"name",
|
|
214
|
+
"show-badges"
|
|
215
|
+
])], 10, W))), 128))])], 2));
|
|
216
|
+
}
|
|
217
|
+
}), K = {
|
|
218
|
+
en: "English",
|
|
219
|
+
"en-GB": "English (GB)",
|
|
220
|
+
"en-US": "English (US)",
|
|
221
|
+
fr: "Français",
|
|
222
|
+
th: "ไทย"
|
|
223
|
+
}, q = (e) => {
|
|
224
|
+
let t = {};
|
|
225
|
+
for (let n of e) t[n] = { locales: K };
|
|
226
|
+
return t;
|
|
227
|
+
}, J = (e, t) => {
|
|
228
|
+
let n;
|
|
229
|
+
return e.some((e) => {
|
|
230
|
+
let r = e.split("-"), i = [];
|
|
231
|
+
for (let e = 1; e <= r.length; e++) if (i = (i.length === 0 ? t : i).filter((t) => t.startsWith(r.slice(0, e).join("-"))), i.length === 1) return n = i[0], !0;
|
|
232
|
+
}), n;
|
|
233
|
+
}, Y = (e, t) => {
|
|
234
|
+
if (!t) return e;
|
|
235
|
+
let n = {};
|
|
236
|
+
for (let r in t) {
|
|
237
|
+
let i = t[r], a = e[r];
|
|
238
|
+
n[r] = a ? {
|
|
239
|
+
...a,
|
|
240
|
+
...i
|
|
241
|
+
} : i;
|
|
242
|
+
}
|
|
243
|
+
for (let r in e) {
|
|
244
|
+
if (n[r]) continue;
|
|
245
|
+
let i = t[r], a = e[r];
|
|
246
|
+
n[r] = i ? {
|
|
247
|
+
...a,
|
|
248
|
+
...i
|
|
249
|
+
} : a;
|
|
250
|
+
}
|
|
251
|
+
return n;
|
|
252
|
+
}, X = (t) => {
|
|
253
|
+
let n = t.config.i18n, r = t.config.slug, { getLocale: i, setLocale: a } = F(r), o = i();
|
|
254
|
+
o || (o = J(navigator.languages, n.supportedLocales), a(o));
|
|
255
|
+
let s = Y(q(n.supportedLocales), n?.messages);
|
|
256
|
+
return e({
|
|
257
|
+
...n,
|
|
258
|
+
globalInjection: !0,
|
|
259
|
+
legacy: !1,
|
|
260
|
+
locale: o,
|
|
261
|
+
messages: s
|
|
262
|
+
});
|
|
263
|
+
}, Z = { install: (e, t) => {
|
|
264
|
+
let n = X(t);
|
|
265
|
+
e.use(n);
|
|
266
|
+
} };
|
|
267
|
+
//#endregion
|
|
268
|
+
export { G as LocaleSwitcher, X as createI18n, Z as default, J as getPreferredLocale, Y as prependMessages, t as useI18n, F as useLocaleStore };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue-i18n"),require("vue"),require("@prefabs.tech/vue3-config")):typeof define==`function`&&define.amd?define([`exports`,`vue-i18n`,`vue`,`@prefabs.tech/vue3-config`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.PrefabsTechVue3I18n={},e.VueI18n,e.Vue,e.PrefabsTechVue3Config))})(this,function(e,t,n,r){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var i=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var a=Object.prototype.toString,o=e=>a.call(e)===`[object Object]`,s=()=>{},c=l();function l(){var e,t;return i&&!!(!((e=window)==null||(e=e.navigator)==null)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function u(e){return Array.isArray(e)?e:[e]}function d(e,t,r){return(0,n.watch)(e,t,{...r,immediate:!0})}var f=i?window:void 0;i&&window.document,i&&window.navigator,i&&window.location;function p(e){let t=(0,n.toValue)(e);return t?.$el??t}function m(...e){let t=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=(0,n.computed)(()=>{let t=u((0,n.toValue)(e[0])).filter(e=>e!=null);return t.every(e=>typeof e!=`string`)?t:void 0});return d(()=>[r.value?.map(e=>p(e))??[f].filter(e=>e!=null),u((0,n.toValue)(r.value?e[1]:e[0])),u((0,n.unref)(r.value?e[2]:e[1])),(0,n.toValue)(r.value?e[3]:e[2])],([e,n,r,i],a,s)=>{if(!e?.length||!n?.length||!r?.length)return;let c=o(i)?{...i}:i,l=e.flatMap(e=>n.flatMap(n=>r.map(r=>t(e,n,r,c))));s(()=>{l.forEach(e=>e())})},{flush:`post`})}var h=!1;function g(e,t,r={}){let{window:i=f,ignore:a=[],capture:o=!0,detectIframe:l=!1,controls:u=!1}=r;if(!i)return u?{stop:s,cancel:s,trigger:s}:s;if(c&&!h){h=!0;let e={passive:!0};Array.from(i.document.body.children).forEach(t=>t.addEventListener(`click`,s,e)),i.document.documentElement.addEventListener(`click`,s,e)}let d=!0,g=e=>(0,n.toValue)(a).some(t=>{if(typeof t==`string`)return Array.from(i.document.querySelectorAll(t)).some(t=>t===e.target||e.composedPath().includes(t));{let n=p(t);return n&&(e.target===n||e.composedPath().includes(n))}});function _(e){let t=(0,n.toValue)(e);return t&&t.$.subTree.shapeFlag===16}function v(e,t){let r=(0,n.toValue)(e),i=r.$.subTree&&r.$.subTree.children;return i==null||!Array.isArray(i)?!1:i.some(e=>e.el===t.target||t.composedPath().includes(e.el))}let y=n=>{let r=p(e);if(n.target!=null&&!(!(r instanceof Element)&&_(e)&&v(e,n))&&!(!r||r===n.target||n.composedPath().includes(r))){if(`detail`in n&&n.detail===0&&(d=!g(n)),!d){d=!0;return}t(n)}},b=!1,x=[m(i,`click`,e=>{b||(b=!0,setTimeout(()=>{b=!1},0),y(e))},{passive:!0,capture:o}),m(i,`pointerdown`,t=>{let n=p(e);d=!g(t)&&!!(n&&!t.composedPath().includes(n))},{passive:!0}),l&&m(i,`blur`,n=>{setTimeout(()=>{let r=p(e),a=i.document.activeElement;for(;a?.shadowRoot;)a=a.shadowRoot.activeElement;a?.tagName===`IFRAME`&&!r?.contains(i.document.activeElement)&&t(n)},0)},{passive:!0})].filter(Boolean),S=()=>x.forEach(e=>e());return u?{stop:S,cancel:()=>{d=!1},trigger:e=>{d=!0,y(e),d=!1}}:S}var _=e=>{let t=`${e}.locale`;return{getLocale:()=>localStorage.getItem(t)||void 0,setLocale:e=>{e?localStorage.setItem(t,e):localStorage.removeItem(t)}}},v={class:`badge`},y={key:0,class:`country`},b=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,n.defineComponent)({name:`LocaleBadge`,props:{locale:{required:!0,type:String}},setup(e){let t=e,r=(0,n.computed)(()=>t.locale.slice(0,2)),i=(0,n.computed)(()=>{let e=t.locale.split(`-`);if(e.length>1)return e[1]});return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`span`,v,[(0,n.createTextVNode)((0,n.toDisplayString)(r.value)+` `,1),i.value?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,y,(0,n.toDisplayString)(i.value),1)):(0,n.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-83bea1dd`]]),x={class:`locale`},S=(0,n.defineComponent)({name:`LocaleOption`,props:{locale:{required:!0,type:String},name:{required:!0,type:String},showBadges:{default:!0,type:Boolean}},setup(e){return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,x,[e.showBadges?((0,n.openBlock)(),(0,n.createBlock)(b,{key:0,locale:e.locale},null,8,[`locale`])):(0,n.createCommentVNode)(``,!0),(0,n.createTextVNode)(` `+(0,n.toDisplayString)(e.name),1)]))}}),C={class:`locale truncated`},w={class:`truncated`},T={class:`dropdown`},E=[`onClick`],D=(0,n.defineComponent)({name:`LocaleSwitcher`,props:{showBadges:{default:!0,type:Boolean}},setup(e){let{availableLocales:i,locale:a,t:o}=(0,t.useI18n)(),s=(0,r.useConfig)(),c=(0,n.ref)(!1),l=e=>{a.value=e,c.value=!1;let{setLocale:t}=_(s.slug);t(e)},u=(0,n.computed)(()=>({locale:a.value,name:f(a.value)})),d=()=>{c.value=!c.value},f=e=>o(`locales.${e}`),p=(0,n.ref)(null);return g(p,e=>{c.value=!1}),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`nav`,{ref_key:`dzangolabVueI18nLocaleSwitcher`,ref:p,class:(0,n.normalizeClass)([`locale-switcher`,{expanded:c.value}])},[(0,n.createElementVNode)(`div`,{class:`locale-trigger`,onClick:d},[(0,n.createElementVNode)(`div`,C,(0,n.toDisplayString)(u.value.name),1),(0,n.createElementVNode)(`span`,w,[(0,n.renderSlot)(t.$slots,`icon`,{},()=>[r[0]||=(0,n.createElementVNode)(`svg`,{"aria-label":`open user menu`,fill:`none`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`},[(0,n.createElementVNode)(`path`,{"clip-rule":`evenodd`,"fill-rule":`evenodd`,d:`M12 7C12.2652 7 12.5196 7.10536 12.7071 7.29289L19.7071 14.2929C20.0976 14.6834 20.0976 15.3166 19.7071 15.7071C19.3166 16.0976 18.6834 16.0976 18.2929 15.7071L12 9.41421L5.70711 15.7071C5.31658 16.0976 4.68342 16.0976 4.29289 15.7071C3.90237 15.3166 3.90237 14.6834 4.29289 14.2929L11.2929 7.29289C11.4804 7.10536 11.7348 7 12 7Z`,fill:`currentColor`})],-1)])])]),(0,n.createElementVNode)(`ul`,T,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(i),t=>((0,n.openBlock)(),(0,n.createElementBlock)(`li`,{key:t,class:(0,n.normalizeClass)([{current:t===u.value.locale},`truncated`]),onClick:e=>l(t)},[(0,n.createVNode)(S,{locale:t,name:f(t),"show-badges":e.showBadges},null,8,[`locale`,`name`,`show-badges`])],10,E))),128))])],2))}}),O={en:`English`,"en-GB":`English (GB)`,"en-US":`English (US)`,fr:`Français`,th:`ไทย`},k=e=>{let t={};for(let n of e)t[n]={locales:O};return t},A=(e,t)=>{let n;return e.some(e=>{let r=e.split(`-`),i=[];for(let e=1;e<=r.length;e++)if(i=(i.length===0?t:i).filter(t=>t.startsWith(r.slice(0,e).join(`-`))),i.length===1)return n=i[0],!0}),n},j=(e,t)=>{if(!t)return e;let n={};for(let r in t){let i=t[r],a=e[r];n[r]=a?{...a,...i}:i}for(let r in e){if(n[r])continue;let i=t[r],a=e[r];n[r]=i?{...a,...i}:a}return n},M=e=>{let n=e.config.i18n,r=e.config.slug,{getLocale:i,setLocale:a}=_(r),o=i();o||(o=A(navigator.languages,n.supportedLocales),a(o));let s=j(k(n.supportedLocales),n?.messages);return(0,t.createI18n)({...n,globalInjection:!0,legacy:!1,locale:o,messages:s})};e.LocaleSwitcher=D,e.createI18n=M,e.default={install:(e,t)=>{let n=M(t);e.use(n)}},e.getPreferredLocale=A,e.prependMessages=j,e.useI18n=t.useI18n,e.useLocaleStore=_});
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { AppConfig } from "@prefabs.tech/vue3-config";
|
|
2
|
+
import type { App, Plugin } from "vue";
|
|
3
|
+
import type { I18nOptions, LocaleMessages, VueMessageType } from "vue-i18n";
|
|
1
4
|
import { useI18n } from "vue-i18n";
|
|
2
5
|
import LocaleSwitcher from "./locale-switcher/Index.vue";
|
|
3
6
|
import useLocaleStore from "./store";
|
|
4
7
|
import { getPreferredLocale, prependMessages } from "./utilities";
|
|
5
|
-
import type { AppConfig } from "@prefabs.tech/vue3-config";
|
|
6
|
-
import type { App, Plugin } from "vue";
|
|
7
|
-
import type { I18nOptions, LocaleMessages, VueMessageType } from "vue-i18n";
|
|
8
8
|
declare const createI18n: (options: DzangolabVueI18nPluginOptions) => Plugin;
|
|
9
9
|
declare const plugin: {
|
|
10
10
|
install: (app: App, options: {
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAgC,OAAO,EAAE,MAAM,UAAU,CAAC;AAEjE,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,cAAc,MAAM,SAAS,CAAC;AACrC,OAAO,EAEL,kBAAkB,EAClB,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,QAAA,MAAM,UAAU,GAAI,SAAS,6BAA6B,KAAG,MA+B5D,CAAC;AAEF,QAAA,MAAM,MAAM;mBACK,GAAG,WAAW;QAAE,MAAM,EAAE,SAAS,CAAA;KAAE,KAAG,IAAI;CAK1D,CAAC;AAEF,KAAK,oBAAoB,GAAG,WAAW,GAAG;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,UAAU,6BAA6B;IACrC,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,OAAO,QAAQ,2BAA2B,CAAC;IACzC,UAAiB,SAAS;QACxB,IAAI,EAAE,oBAAoB,CAAC;KAC5B;CACF;AAED,eAAe,MAAM,CAAC;AAEtB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,OAAO,EACP,cAAc,GACf,CAAC;AAEF,YAAY,EACV,oBAAoB,EACpB,6BAA6B,EAC7B,cAAc,EACd,cAAc,GACf,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PropType } from "vue";
|
|
2
|
-
declare const _default:
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
5
|
locale: {
|
|
4
6
|
required: true;
|
|
5
7
|
type: PropType<string>;
|
|
@@ -10,5 +12,4 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
10
12
|
type: PropType<string>;
|
|
11
13
|
};
|
|
12
14
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
-
export default _default;
|
|
14
15
|
//# sourceMappingURL=Badge.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Badge.vue
|
|
1
|
+
{"version":3,"file":"Badge.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Badge.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;wBAKf,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY;;;cA8DE,QAAQ,CAAC,MAAM,CAAC;;;;;cAAhB,QAAQ,CAAC,MAAM,CAAC;;iGAIhC,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
4
|
showBadges: {
|
|
3
5
|
default: boolean;
|
|
4
6
|
type: BooleanConstructor;
|
|
@@ -11,10 +13,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
11
13
|
}>> & Readonly<{}>, {
|
|
12
14
|
showBadges: boolean;
|
|
13
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
14
|
-
icon
|
|
16
|
+
icon?: (props: {}) => any;
|
|
15
17
|
}>;
|
|
16
|
-
|
|
17
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
19
|
new (): {
|
|
19
20
|
$slots: S;
|
|
20
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Index.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Index.vue
|
|
1
|
+
{"version":3,"file":"Index.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Index.vue"],"names":[],"mappings":"wBA8HqB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY;;;;;;;;;;;;;WAwIP,CAAC,KAAK,IAAgB,KAAK,GAAG;EAgBrC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PropType } from "vue";
|
|
2
|
-
declare const _default:
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
5
|
locale: {
|
|
4
6
|
required: true;
|
|
5
7
|
type: PropType<string>;
|
|
@@ -28,5 +30,4 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
28
30
|
}>> & Readonly<{}>, {
|
|
29
31
|
showBadges: boolean;
|
|
30
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
-
export default _default;
|
|
32
33
|
//# sourceMappingURL=LocaleOption.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleOption.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/LocaleOption.vue
|
|
1
|
+
{"version":3,"file":"LocaleOption.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/LocaleOption.vue"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;wBAKf,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY;;;cAmDE,QAAQ,CAAC,MAAM,CAAC;;;;cAIhB,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;cAJhB,QAAQ,CAAC,MAAM,CAAC;;;;cAIhB,QAAQ,CAAC,MAAM,CAAC;;;;;;;;4EAQhC,CAAC"}
|
package/dist/src/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc,GAAI,MAAM,MAAM;qBAGZ,MAAM,GAAG,SAAS;wBAMb,MAAM,GAAG,SAAS,KAAG,IAAI;CASrD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../src/utilities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../src/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/D,QAAA,MAAM,cAAc,GAAI,kBAAkB,MAAM,EAAE,mCAUjD,CAAC;AAEF,QAAA,MAAM,kBAAkB,GACtB,WAAW,SAAS,MAAM,EAAE,EAC5B,SAAS,MAAM,EAAE,KAChB,MAAM,GAAG,SAsBX,CAAC;AAEF,QAAA,MAAM,eAAe,GACnB,UAAU,cAAc,CAAC,cAAc,CAAC,EACxC,UAAU,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,KACnD,cAAc,CAAC,cAAc,CAoC/B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/vue3-i18n.css
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
.country[data-v-
|
|
1
|
+
.country[data-v-83bea1dd]{background:var(--locale-switcher-badge-country-bf-color,#007aff);color:var(--locale-switcher-badge-country-color,#fff);padding:1px 2px;font-size:.5rem;font-weight:700;line-height:1.25;position:absolute;bottom:-.35rem;right:-.25rem}.badge[data-v-83bea1dd]{background-color:var(--locale-switcher-badge-bg-color,#007aff);text-align:center;border-radius:50%;justify-content:center;align-items:center;width:2em;height:2em;font-size:.9rem;display:flex;position:relative}ul.dropdown .locale{justify-content:flex-start;align-items:center;gap:.5rem;display:flex}nav.locale-switcher{--_hover-bg:var(--nav-item-hover-bg,#f0f2f7ad);--_hover-color:var(--nav-item-hover-color,#2c2c2c);--_width:var(--locale-switcher-width,10rem);cursor:pointer;width:var(--_width);border-radius:.325rem;padding:0;position:relative}nav.locale-switcher.expanded>.locale-trigger,nav.locale-switcher>.locale-trigger:hover{background:var(--_hover-bg);color:var(--_hover-color)}nav.locale-switcher>.locale-trigger{--_padding-h:var(--locale-switcher-padding-h,1rem);--_padding-v:var(--locale-switcher-padding-v,.625rem);padding:var(--_padding-v) var(--_padding-h);justify-content:space-between;align-items:center;gap:0;display:flex}.locale{flex:1}nav.locale-switcher>.locale-trigger>span{text-align:center;width:1rem;font-size:1.5rem;line-height:1.25rem}nav.locale-switcher>ul.dropdown{--_bg-color:var(--locale-switcher-bg-color,#fff);--_min-width:var(--locale-switcher-width,10rem);background-color:var(--_bg-color);border:var(--_border);max-height:0;min-width:var(--_min-width);z-index:1000;border-radius:.325rem;padding-inline-start:0;list-style:none;transition:max-height .3s ease-out;position:absolute;inset:0 0 auto auto;overflow-y:hidden;transform:translateY(56px)}nav.locale-switcher.expanded ul{--_border:var(--locale-switcher-border,1px solid #e5e5e5);height:auto;max-height:30rem;padding-block:.15rem;box-shadow:1px 1px 5px 1px #e5e5e5}nav.locale-switcher>.dropdown>li{--_active-bg:var(--nav-item-active-bg,#eff6ff);--_active-color:var(--nav-item-active-color,#2c2c2c);--_hover-bg:var(--nav-item-hover-bg,#f0f2f7ad);--_hover-color:var(--nav-item-hover-color,#2c2c2c);cursor:pointer;padding:.7rem 1.25rem;list-style:none}nav.locale-switcher.expanded li:hover{background:var(--_hover-bg);color:var(--_hover-color)}nav.locale-switcher>.dropdown>li.current{background-color:var(--_active-bg);color:var(--_active-color)}.locale-switcher .truncated{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.locale-switcher .truncated>svg{transition:transform .3s}nav.locale-switcher.expanded .truncated>svg{transform:rotate(-180deg)}
|
|
2
|
+
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prefabs.tech/vue3-i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Vue3 I18n Plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,29 +21,34 @@
|
|
|
21
21
|
"vue-i18n": "9.1.10"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@prefabs.tech/eslint-config": "0.
|
|
25
|
-
"@prefabs.tech/
|
|
26
|
-
"@prefabs.tech/
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@vitejs/plugin-vue
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"vue": "
|
|
40
|
-
"
|
|
24
|
+
"@prefabs.tech/eslint-config": "0.8.7",
|
|
25
|
+
"@prefabs.tech/stylelint-config": "0.8.7",
|
|
26
|
+
"@prefabs.tech/tsconfig": "0.8.7",
|
|
27
|
+
"@prefabs.tech/vue3-config": "0.33.0",
|
|
28
|
+
"@types/node": "26.1.1",
|
|
29
|
+
"@vitejs/plugin-vue": "6.0.8",
|
|
30
|
+
"@vitejs/plugin-vue-jsx": "5.1.6",
|
|
31
|
+
"@vitest/coverage-istanbul": "4.1.10",
|
|
32
|
+
"@vue/test-utils": "2.4.11",
|
|
33
|
+
"@vueuse/core": "14.3.0",
|
|
34
|
+
"eslint": "10.7.0",
|
|
35
|
+
"prettier": "3.9.5",
|
|
36
|
+
"jsdom": "29.1.1",
|
|
37
|
+
"pinia": "4.0.2",
|
|
38
|
+
"stylelint": "17.14.1",
|
|
39
|
+
"stylelint-config-recommended-vue": "1.6.1",
|
|
40
|
+
"stylelint-order": "8.1.1",
|
|
41
|
+
"typescript": "6.0.3",
|
|
42
|
+
"vite": "8.1.5",
|
|
43
|
+
"vitest": "4.1.10",
|
|
44
|
+
"vue": "3.5.40",
|
|
45
|
+
"vue-tsc": "3.3.7"
|
|
41
46
|
},
|
|
42
47
|
"peerDependencies": {
|
|
43
|
-
"@prefabs.tech/vue3-config": "0.
|
|
44
|
-
"@vueuse/core": ">=
|
|
45
|
-
"pinia": ">=
|
|
46
|
-
"vue": ">=3.
|
|
48
|
+
"@prefabs.tech/vue3-config": "0.33.0",
|
|
49
|
+
"@vueuse/core": ">=14.3.0",
|
|
50
|
+
"pinia": ">=4.0",
|
|
51
|
+
"vue": ">=3.5"
|
|
47
52
|
},
|
|
48
53
|
"engines": {
|
|
49
54
|
"node": ">=18",
|
|
@@ -55,11 +60,13 @@
|
|
|
55
60
|
"lint:fix": "eslint . --fix",
|
|
56
61
|
"snapshot:update": "vitest --environment jsdom run --update",
|
|
57
62
|
"sort-package": "npx sort-package-json",
|
|
63
|
+
"stylelint": "stylelint \"src/**/*.{css,vue}\" --allow-empty-input",
|
|
64
|
+
"stylelint:fix": "stylelint \"src/**/*.{css,vue}\" --fix --allow-empty-input",
|
|
58
65
|
"test": "vitest --environment jsdom run --coverage --passWithNoTests",
|
|
59
66
|
"test:component": "vitest --environment jsdom run component/ --passWithNoTests",
|
|
60
67
|
"test:snapshot": "vitest --environment jsdom run snapshot/ --passWithNoTests",
|
|
61
68
|
"test:unit": "vitest --environment jsdom run unit/ --passWithNoTests",
|
|
62
69
|
"test:watch": "vitest",
|
|
63
|
-
"typecheck": "vue-tsc --noEmit -p tsconfig.json --composite false"
|
|
70
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false"
|
|
64
71
|
}
|
|
65
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleNames.test.d.ts","sourceRoot":"","sources":["../../../../src/__test__/unit/LocaleNames.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PreferredLocale.spec.d.ts","sourceRoot":"","sources":["../../../../src/__test__/unit/PreferredLocale.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrependMessages.spec.d.ts","sourceRoot":"","sources":["../../../../src/__test__/unit/PrependMessages.spec.ts"],"names":[],"mappings":""}
|