@prefabs.tech/vue3-i18n 0.12.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/LICENSE +21 -0
- package/dist/PrefabsTechVue3I18n.es.js +321 -0
- package/dist/PrefabsTechVue3I18n.umd.js +1 -0
- package/dist/src/__test__/unit/LocaleNames.test.d.ts +2 -0
- package/dist/src/__test__/unit/LocaleNames.test.d.ts.map +1 -0
- package/dist/src/__test__/unit/PreferredLocale.spec.d.ts +2 -0
- package/dist/src/__test__/unit/PreferredLocale.spec.d.ts.map +1 -0
- package/dist/src/__test__/unit/PrependMessages.spec.d.ts +2 -0
- package/dist/src/__test__/unit/PrependMessages.spec.d.ts.map +1 -0
- package/dist/src/index.d.ts +28 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/locale-switcher/Badge.vue.d.ts +14 -0
- package/dist/src/locale-switcher/Badge.vue.d.ts.map +1 -0
- package/dist/src/locale-switcher/Index.vue.d.ts +10 -0
- package/dist/src/locale-switcher/Index.vue.d.ts.map +1 -0
- package/dist/src/locale-switcher/LocaleOption.vue.d.ts +22 -0
- package/dist/src/locale-switcher/LocaleOption.vue.d.ts.map +1 -0
- package/dist/src/locales/native-locale-names.d.ts +9 -0
- package/dist/src/locales/native-locale-names.d.ts.map +1 -0
- package/dist/src/store.d.ts +6 -0
- package/dist/src/store.d.ts.map +1 -0
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/vue3-i18n.css +1 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Olivier Pichon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { useI18n as R, createI18n as q } from "vue-i18n";
|
|
2
|
+
import { useI18n as Te } from "vue-i18n";
|
|
3
|
+
import { watch as D, getCurrentScope as z, onScopeDispose as U, computed as I, toValue as h, unref as M, defineComponent as C, createElementBlock as w, openBlock as y, createTextVNode as j, createCommentVNode as H, toDisplayString as x, createVNode as G, ref as T, normalizeClass as V, createElementVNode as S, renderSlot as J, Fragment as K, renderList as Q } from "vue";
|
|
4
|
+
import { useConfig as X } from "@prefabs.tech/vue3-config";
|
|
5
|
+
const Y = "data:image/svg+xml,%3c?xml%20version='1.0'%20?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle/%3e%3cg%20id='Complete'%3e%3cg%20id='F-Chevron'%3e%3cpolyline%20fill='none'%20id='Down'%20points='5%208.5%2012%2015.5%2019%208.5'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
|
|
6
|
+
function Z(e) {
|
|
7
|
+
return z() ? (U(e), !0) : !1;
|
|
8
|
+
}
|
|
9
|
+
const N = typeof window < "u" && typeof document < "u";
|
|
10
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
11
|
+
const ee = Object.prototype.toString, te = (e) => ee.call(e) === "[object Object]", _ = () => {
|
|
12
|
+
}, oe = /* @__PURE__ */ ne();
|
|
13
|
+
function ne() {
|
|
14
|
+
var e, t;
|
|
15
|
+
return N && ((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));
|
|
16
|
+
}
|
|
17
|
+
function $(e) {
|
|
18
|
+
return Array.isArray(e) ? e : [e];
|
|
19
|
+
}
|
|
20
|
+
function le(e, t, o) {
|
|
21
|
+
return D(
|
|
22
|
+
e,
|
|
23
|
+
t,
|
|
24
|
+
{
|
|
25
|
+
...o,
|
|
26
|
+
immediate: !0
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const W = N ? window : void 0;
|
|
31
|
+
function k(e) {
|
|
32
|
+
var t;
|
|
33
|
+
const o = h(e);
|
|
34
|
+
return (t = o?.$el) != null ? t : o;
|
|
35
|
+
}
|
|
36
|
+
function L(...e) {
|
|
37
|
+
const t = [], o = () => {
|
|
38
|
+
t.forEach((a) => a()), t.length = 0;
|
|
39
|
+
}, n = (a, r, u, f) => (a.addEventListener(r, u, f), () => a.removeEventListener(r, u, f)), l = I(() => {
|
|
40
|
+
const a = $(h(e[0])).filter((r) => r != null);
|
|
41
|
+
return a.every((r) => typeof r != "string") ? a : void 0;
|
|
42
|
+
}), s = le(
|
|
43
|
+
() => {
|
|
44
|
+
var a, r;
|
|
45
|
+
return [
|
|
46
|
+
(r = (a = l.value) == null ? void 0 : a.map((u) => k(u))) != null ? r : [W].filter((u) => u != null),
|
|
47
|
+
$(h(l.value ? e[1] : e[0])),
|
|
48
|
+
$(M(l.value ? e[2] : e[1])),
|
|
49
|
+
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
50
|
+
h(l.value ? e[3] : e[2])
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
([a, r, u, f]) => {
|
|
54
|
+
if (o(), !a?.length || !r?.length || !u?.length)
|
|
55
|
+
return;
|
|
56
|
+
const m = te(f) ? { ...f } : f;
|
|
57
|
+
t.push(
|
|
58
|
+
...a.flatMap(
|
|
59
|
+
(v) => r.flatMap(
|
|
60
|
+
(g) => u.map((b) => n(v, g, b, m))
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
{ flush: "post" }
|
|
66
|
+
), p = () => {
|
|
67
|
+
s(), o();
|
|
68
|
+
};
|
|
69
|
+
return Z(o), p;
|
|
70
|
+
}
|
|
71
|
+
let B = !1;
|
|
72
|
+
function ce(e, t, o = {}) {
|
|
73
|
+
const { window: n = W, ignore: l = [], capture: s = !0, detectIframe: p = !1, controls: a = !1 } = o;
|
|
74
|
+
if (!n)
|
|
75
|
+
return a ? { stop: _, cancel: _, trigger: _ } : _;
|
|
76
|
+
if (oe && !B) {
|
|
77
|
+
B = !0;
|
|
78
|
+
const c = { passive: !0 };
|
|
79
|
+
Array.from(n.document.body.children).forEach((i) => L(i, "click", _, c)), L(n.document.documentElement, "click", _, c);
|
|
80
|
+
}
|
|
81
|
+
let r = !0;
|
|
82
|
+
const u = (c) => h(l).some((i) => {
|
|
83
|
+
if (typeof i == "string")
|
|
84
|
+
return Array.from(n.document.querySelectorAll(i)).some((d) => d === c.target || c.composedPath().includes(d));
|
|
85
|
+
{
|
|
86
|
+
const d = k(i);
|
|
87
|
+
return d && (c.target === d || c.composedPath().includes(d));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
function f(c) {
|
|
91
|
+
const i = h(c);
|
|
92
|
+
return i && i.$.subTree.shapeFlag === 16;
|
|
93
|
+
}
|
|
94
|
+
function m(c, i) {
|
|
95
|
+
const d = h(c), E = d.$.subTree && d.$.subTree.children;
|
|
96
|
+
return E == null || !Array.isArray(E) ? !1 : E.some((P) => P.el === i.target || i.composedPath().includes(P.el));
|
|
97
|
+
}
|
|
98
|
+
const v = (c) => {
|
|
99
|
+
const i = k(e);
|
|
100
|
+
if (c.target != null && !(!(i instanceof Element) && f(e) && m(e, c)) && !(!i || i === c.target || c.composedPath().includes(i))) {
|
|
101
|
+
if ("detail" in c && c.detail === 0 && (r = !u(c)), !r) {
|
|
102
|
+
r = !0;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
t(c);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
let g = !1;
|
|
109
|
+
const b = [
|
|
110
|
+
L(n, "click", (c) => {
|
|
111
|
+
g || (g = !0, setTimeout(() => {
|
|
112
|
+
g = !1;
|
|
113
|
+
}, 0), v(c));
|
|
114
|
+
}, { passive: !0, capture: s }),
|
|
115
|
+
L(n, "pointerdown", (c) => {
|
|
116
|
+
const i = k(e);
|
|
117
|
+
r = !u(c) && !!(i && !c.composedPath().includes(i));
|
|
118
|
+
}, { passive: !0 }),
|
|
119
|
+
p && L(n, "blur", (c) => {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
var i;
|
|
122
|
+
const d = k(e);
|
|
123
|
+
((i = n.document.activeElement) == null ? void 0 : i.tagName) === "IFRAME" && !d?.contains(n.document.activeElement) && t(c);
|
|
124
|
+
}, 0);
|
|
125
|
+
}, { passive: !0 })
|
|
126
|
+
].filter(Boolean), A = () => b.forEach((c) => c());
|
|
127
|
+
return a ? {
|
|
128
|
+
stop: A,
|
|
129
|
+
cancel: () => {
|
|
130
|
+
r = !1;
|
|
131
|
+
},
|
|
132
|
+
trigger: (c) => {
|
|
133
|
+
r = !0, v(c), r = !1;
|
|
134
|
+
}
|
|
135
|
+
} : A;
|
|
136
|
+
}
|
|
137
|
+
const se = { class: "badge" }, re = {
|
|
138
|
+
key: 0,
|
|
139
|
+
class: "country"
|
|
140
|
+
}, ae = {
|
|
141
|
+
name: "LocaleBadge"
|
|
142
|
+
}, ie = /* @__PURE__ */ C({
|
|
143
|
+
...ae,
|
|
144
|
+
props: {
|
|
145
|
+
locale: {
|
|
146
|
+
required: !0,
|
|
147
|
+
type: String
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
setup(e) {
|
|
151
|
+
const t = e, o = I(() => t.locale.substring(0, 2)), n = I(() => {
|
|
152
|
+
const l = t.locale.split("-");
|
|
153
|
+
if (l.length > 1)
|
|
154
|
+
return l[1];
|
|
155
|
+
});
|
|
156
|
+
return (l, s) => (y(), w("span", se, [
|
|
157
|
+
j(x(o.value) + " ", 1),
|
|
158
|
+
n.value ? (y(), w("span", re, x(n.value), 1)) : H("", !0)
|
|
159
|
+
]));
|
|
160
|
+
}
|
|
161
|
+
}), O = (e, t) => {
|
|
162
|
+
const o = e.__vccOpts || e;
|
|
163
|
+
for (const [n, l] of t)
|
|
164
|
+
o[n] = l;
|
|
165
|
+
return o;
|
|
166
|
+
}, ue = /* @__PURE__ */ O(ie, [["__scopeId", "data-v-c1291edf"]]), de = { class: "locale" }, pe = {
|
|
167
|
+
name: "LocaleOption"
|
|
168
|
+
}, fe = /* @__PURE__ */ C({
|
|
169
|
+
...pe,
|
|
170
|
+
props: {
|
|
171
|
+
locale: {
|
|
172
|
+
required: !0,
|
|
173
|
+
type: String
|
|
174
|
+
},
|
|
175
|
+
name: {
|
|
176
|
+
required: !0,
|
|
177
|
+
type: String
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
setup(e) {
|
|
181
|
+
return (t, o) => (y(), w("div", de, [
|
|
182
|
+
G(ue, { locale: e.locale }, null, 8, ["locale"]),
|
|
183
|
+
j(" " + x(e.name), 1)
|
|
184
|
+
]));
|
|
185
|
+
}
|
|
186
|
+
}), me = /* @__PURE__ */ O(fe, [["__scopeId", "data-v-5ee88038"]]), F = (e) => {
|
|
187
|
+
const t = `${e}.locale`;
|
|
188
|
+
return { getLocale: () => {
|
|
189
|
+
const l = localStorage.getItem(t);
|
|
190
|
+
return l || void 0;
|
|
191
|
+
}, setLocale: (l) => {
|
|
192
|
+
l ? localStorage.setItem(t, l) : localStorage.removeItem(t);
|
|
193
|
+
} };
|
|
194
|
+
}, ge = { class: "locale truncated" }, ve = { class: "truncated" }, he = { class: "dropdown" }, _e = ["onClick"], we = {
|
|
195
|
+
name: "LocaleSwitcher"
|
|
196
|
+
}, ye = /* @__PURE__ */ C({
|
|
197
|
+
...we,
|
|
198
|
+
setup(e) {
|
|
199
|
+
const { availableLocales: t, locale: o, t: n } = R(), l = X(), s = T(!1), p = (m) => {
|
|
200
|
+
o.value = m, s.value = !1;
|
|
201
|
+
const { setLocale: v } = F(l.slug);
|
|
202
|
+
v(m);
|
|
203
|
+
}, a = I(() => ({
|
|
204
|
+
locale: o.value,
|
|
205
|
+
name: u(o.value)
|
|
206
|
+
})), r = () => {
|
|
207
|
+
s.value = !s.value;
|
|
208
|
+
}, u = (m) => n(`locales.${m}`), f = T(null);
|
|
209
|
+
return ce(f, (m) => {
|
|
210
|
+
s.value = !1;
|
|
211
|
+
}), (m, v) => (y(), w("nav", {
|
|
212
|
+
ref_key: "dzangolabVueI18nLocaleSwitcher",
|
|
213
|
+
ref: f,
|
|
214
|
+
class: V(["locale-switcher", { expanded: s.value }])
|
|
215
|
+
}, [
|
|
216
|
+
S("div", {
|
|
217
|
+
class: "locale-trigger",
|
|
218
|
+
onClick: r
|
|
219
|
+
}, [
|
|
220
|
+
S("div", ge, x(a.value.name), 1),
|
|
221
|
+
S("span", ve, [
|
|
222
|
+
J(m.$slots, "icon", {}, () => [
|
|
223
|
+
v[0] || (v[0] = S("img", {
|
|
224
|
+
src: Y,
|
|
225
|
+
alt: "locale"
|
|
226
|
+
}, null, -1))
|
|
227
|
+
], !0)
|
|
228
|
+
])
|
|
229
|
+
]),
|
|
230
|
+
S("ul", he, [
|
|
231
|
+
(y(!0), w(K, null, Q(M(t), (g) => (y(), w("li", {
|
|
232
|
+
key: g,
|
|
233
|
+
class: V([{ current: g === a.value.locale }, "truncated"]),
|
|
234
|
+
onClick: (b) => p(g)
|
|
235
|
+
}, [
|
|
236
|
+
G(me, {
|
|
237
|
+
locale: g,
|
|
238
|
+
name: u(g)
|
|
239
|
+
}, null, 8, ["locale", "name"])
|
|
240
|
+
], 10, _e))), 128))
|
|
241
|
+
])
|
|
242
|
+
], 2));
|
|
243
|
+
}
|
|
244
|
+
}), Ce = /* @__PURE__ */ O(ye, [["__scopeId", "data-v-2184c436"]]), Se = {
|
|
245
|
+
en: "English",
|
|
246
|
+
"en-GB": "English (GB)",
|
|
247
|
+
"en-US": "English (US)",
|
|
248
|
+
fr: "Français",
|
|
249
|
+
th: "ไทย"
|
|
250
|
+
}, Le = (e) => {
|
|
251
|
+
const t = {};
|
|
252
|
+
for (const o of e)
|
|
253
|
+
t[o] = {
|
|
254
|
+
locales: Se
|
|
255
|
+
};
|
|
256
|
+
return t;
|
|
257
|
+
}, ke = (e, t) => {
|
|
258
|
+
let o;
|
|
259
|
+
return e.some((n) => {
|
|
260
|
+
const l = n.split("-");
|
|
261
|
+
let s = [];
|
|
262
|
+
for (let p = 1; p <= l.length; p++)
|
|
263
|
+
if (s = (s.length === 0 ? t : s).filter((a) => a.startsWith(l.slice(0, p).join("-"))), s.length === 1)
|
|
264
|
+
return o = s[0], !0;
|
|
265
|
+
}), o;
|
|
266
|
+
}, be = (e, t) => {
|
|
267
|
+
if (!t)
|
|
268
|
+
return e;
|
|
269
|
+
const o = {};
|
|
270
|
+
for (const n in t) {
|
|
271
|
+
const l = t[n], s = e[n];
|
|
272
|
+
o[n] = s ? {
|
|
273
|
+
...s,
|
|
274
|
+
...l
|
|
275
|
+
} : l;
|
|
276
|
+
}
|
|
277
|
+
for (const n in e) {
|
|
278
|
+
if (o[n])
|
|
279
|
+
continue;
|
|
280
|
+
const l = t[n], s = e[n];
|
|
281
|
+
o[n] = l ? {
|
|
282
|
+
...s,
|
|
283
|
+
...l
|
|
284
|
+
} : s;
|
|
285
|
+
}
|
|
286
|
+
return o;
|
|
287
|
+
}, Ie = (e) => {
|
|
288
|
+
const t = e.config.i18n, o = e.config.slug, { getLocale: n, setLocale: l } = F(o), s = n();
|
|
289
|
+
if (!s) {
|
|
290
|
+
const r = ke(
|
|
291
|
+
navigator.languages,
|
|
292
|
+
t.supportedLocales
|
|
293
|
+
);
|
|
294
|
+
l(r);
|
|
295
|
+
}
|
|
296
|
+
const p = be(
|
|
297
|
+
Le(t.supportedLocales),
|
|
298
|
+
t?.messages
|
|
299
|
+
);
|
|
300
|
+
return q({
|
|
301
|
+
...t,
|
|
302
|
+
globalInjection: !0,
|
|
303
|
+
legacy: !1,
|
|
304
|
+
locale: s,
|
|
305
|
+
messages: p
|
|
306
|
+
});
|
|
307
|
+
}, Oe = {
|
|
308
|
+
install: (e, t) => {
|
|
309
|
+
const o = Ie(t);
|
|
310
|
+
e.use(o);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
export {
|
|
314
|
+
Ce as LocaleSwitcher,
|
|
315
|
+
Ie as createI18n,
|
|
316
|
+
Oe as default,
|
|
317
|
+
ke as getPreferredLocale,
|
|
318
|
+
be as prependMessages,
|
|
319
|
+
Te as useI18n,
|
|
320
|
+
F as useLocaleStore
|
|
321
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(f,k){typeof exports=="object"&&typeof module<"u"?k(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"],k):(f=typeof globalThis<"u"?globalThis:f||self,k(f.PrefabsTechVue3I18n={},f.VueI18n,f.Vue,f.PrefabsTechVue3Config))})(this,function(f,k,t,A){"use strict";const M="data:image/svg+xml,%3c?xml%20version='1.0'%20?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle/%3e%3cg%20id='Complete'%3e%3cg%20id='F-Chevron'%3e%3cpolyline%20fill='none'%20id='Down'%20points='5%208.5%2012%2015.5%2019%208.5'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function j(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const C=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const q=Object.prototype.toString,D=e=>q.call(e)==="[object Object]",S=()=>{},G=W();function W(){var e,n;return C&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function E(e){return Array.isArray(e)?e:[e]}function F(e,n,o){return t.watch(e,n,{...o,immediate:!0})}const v=C?window:void 0;function w(e){var n;const o=t.toValue(e);return(n=o?.$el)!=null?n:o}function b(...e){const n=[],o=()=>{n.forEach(i=>i()),n.length=0},c=(i,a,d,g)=>(i.addEventListener(a,d,g),()=>i.removeEventListener(a,d,g)),l=t.computed(()=>{const i=E(t.toValue(e[0])).filter(a=>a!=null);return i.every(a=>typeof a!="string")?i:void 0}),s=F(()=>{var i,a;return[(a=(i=l.value)==null?void 0:i.map(d=>w(d)))!=null?a:[v].filter(d=>d!=null),E(t.toValue(l.value?e[1]:e[0])),E(t.unref(l.value?e[2]:e[1])),t.toValue(l.value?e[3]:e[2])]},([i,a,d,g])=>{if(o(),!i?.length||!a?.length||!d?.length)return;const h=D(g)?{...g}:g;n.push(...i.flatMap(y=>a.flatMap(_=>d.map(L=>c(y,_,L,h)))))},{flush:"post"}),m=()=>{s(),o()};return j(o),m}let P=!1;function R(e,n,o={}){const{window:c=v,ignore:l=[],capture:s=!0,detectIframe:m=!1,controls:i=!1}=o;if(!c)return i?{stop:S,cancel:S,trigger:S}:S;if(G&&!P){P=!0;const r={passive:!0};Array.from(c.document.body.children).forEach(u=>b(u,"click",S,r)),b(c.document.documentElement,"click",S,r)}let a=!0;const d=r=>t.toValue(l).some(u=>{if(typeof u=="string")return Array.from(c.document.querySelectorAll(u)).some(p=>p===r.target||r.composedPath().includes(p));{const p=w(u);return p&&(r.target===p||r.composedPath().includes(p))}});function g(r){const u=t.toValue(r);return u&&u.$.subTree.shapeFlag===16}function h(r,u){const p=t.toValue(r),B=p.$.subTree&&p.$.subTree.children;return B==null||!Array.isArray(B)?!1:B.some(x=>x.el===u.target||u.composedPath().includes(x.el))}const y=r=>{const u=w(e);if(r.target!=null&&!(!(u instanceof Element)&&g(e)&&h(e,r))&&!(!u||u===r.target||r.composedPath().includes(u))){if("detail"in r&&r.detail===0&&(a=!d(r)),!a){a=!0;return}n(r)}};let _=!1;const L=[b(c,"click",r=>{_||(_=!0,setTimeout(()=>{_=!1},0),y(r))},{passive:!0,capture:s}),b(c,"pointerdown",r=>{const u=w(e);a=!d(r)&&!!(u&&!r.composedPath().includes(u))},{passive:!0}),m&&b(c,"blur",r=>{setTimeout(()=>{var u;const p=w(e);((u=c.document.activeElement)==null?void 0:u.tagName)==="IFRAME"&&!p?.contains(c.document.activeElement)&&n(r)},0)},{passive:!0})].filter(Boolean),N=()=>L.forEach(r=>r());return i?{stop:N,cancel:()=>{a=!1},trigger:r=>{a=!0,y(r),a=!1}}:N}const z={class:"badge"},U={key:0,class:"country"},H={name:"LocaleBadge"},J=t.defineComponent({...H,props:{locale:{required:!0,type:String}},setup(e){const n=e,o=t.computed(()=>n.locale.substring(0,2)),c=t.computed(()=>{const l=n.locale.split("-");if(l.length>1)return l[1]});return(l,s)=>(t.openBlock(),t.createElementBlock("span",z,[t.createTextVNode(t.toDisplayString(o.value)+" ",1),c.value?(t.openBlock(),t.createElementBlock("span",U,t.toDisplayString(c.value),1)):t.createCommentVNode("",!0)]))}}),V=(e,n)=>{const o=e.__vccOpts||e;for(const[c,l]of n)o[c]=l;return o},K=V(J,[["__scopeId","data-v-c1291edf"]]),Q={class:"locale"},X={name:"LocaleOption"},Y=t.defineComponent({...X,props:{locale:{required:!0,type:String},name:{required:!0,type:String}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",Q,[t.createVNode(K,{locale:e.locale},null,8,["locale"]),t.createTextVNode(" "+t.toDisplayString(e.name),1)]))}}),Z=V(Y,[["__scopeId","data-v-5ee88038"]]),I=e=>{const n=`${e}.locale`;return{getLocale:()=>{const l=localStorage.getItem(n);return l||void 0},setLocale:l=>{l?localStorage.setItem(n,l):localStorage.removeItem(n)}}},ee={class:"locale truncated"},te={class:"truncated"},ne={class:"dropdown"},oe=["onClick"],ce={name:"LocaleSwitcher"},le=t.defineComponent({...ce,setup(e){const{availableLocales:n,locale:o,t:c}=k.useI18n(),l=A.useConfig(),s=t.ref(!1),m=h=>{o.value=h,s.value=!1;const{setLocale:y}=I(l.slug);y(h)},i=t.computed(()=>({locale:o.value,name:d(o.value)})),a=()=>{s.value=!s.value},d=h=>c(`locales.${h}`),g=t.ref(null);return R(g,h=>{s.value=!1}),(h,y)=>(t.openBlock(),t.createElementBlock("nav",{ref_key:"dzangolabVueI18nLocaleSwitcher",ref:g,class:t.normalizeClass(["locale-switcher",{expanded:s.value}])},[t.createElementVNode("div",{class:"locale-trigger",onClick:a},[t.createElementVNode("div",ee,t.toDisplayString(i.value.name),1),t.createElementVNode("span",te,[t.renderSlot(h.$slots,"icon",{},()=>[y[0]||(y[0]=t.createElementVNode("img",{src:M,alt:"locale"},null,-1))],!0)])]),t.createElementVNode("ul",ne,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(n),_=>(t.openBlock(),t.createElementBlock("li",{key:_,class:t.normalizeClass([{current:_===i.value.locale},"truncated"]),onClick:L=>m(_)},[t.createVNode(Z,{locale:_,name:d(_)},null,8,["locale","name"])],10,oe))),128))])],2))}}),re=V(le,[["__scopeId","data-v-2184c436"]]),se={en:"English","en-GB":"English (GB)","en-US":"English (US)",fr:"Français",th:"ไทย"},ae=e=>{const n={};for(const o of e)n[o]={locales:se};return n},T=(e,n)=>{let o;return e.some(c=>{const l=c.split("-");let s=[];for(let m=1;m<=l.length;m++)if(s=(s.length===0?n:s).filter(i=>i.startsWith(l.slice(0,m).join("-"))),s.length===1)return o=s[0],!0}),o},O=(e,n)=>{if(!n)return e;const o={};for(const c in n){const l=n[c],s=e[c];o[c]=s?{...s,...l}:l}for(const c in e){if(o[c])continue;const l=n[c],s=e[c];o[c]=l?{...s,...l}:s}return o},$=e=>{const n=e.config.i18n,o=e.config.slug,{getLocale:c,setLocale:l}=I(o),s=c();if(!s){const a=T(navigator.languages,n.supportedLocales);l(a)}const m=O(ae(n.supportedLocales),n?.messages);return k.createI18n({...n,globalInjection:!0,legacy:!1,locale:s,messages:m})},ie={install:(e,n)=>{const o=$(n);e.use(o)}};Object.defineProperty(f,"useI18n",{enumerable:!0,get:()=>k.useI18n}),f.LocaleSwitcher=re,f.createI18n=$,f.default=ie,f.getPreferredLocale=T,f.prependMessages=O,f.useLocaleStore=I,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleNames.test.d.ts","sourceRoot":"","sources":["../../../../src/__test__/unit/LocaleNames.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreferredLocale.spec.d.ts","sourceRoot":"","sources":["../../../../src/__test__/unit/PreferredLocale.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrependMessages.spec.d.ts","sourceRoot":"","sources":["../../../../src/__test__/unit/PrependMessages.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useI18n } from "vue-i18n";
|
|
2
|
+
import LocaleSwitcher from "./locale-switcher/Index.vue";
|
|
3
|
+
import useLocaleStore from "./store";
|
|
4
|
+
import { getPreferredLocale, prependMessages } from "./utils";
|
|
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
|
+
declare const createI18n: (options: DzangolabVueI18nPluginOptions) => Plugin;
|
|
9
|
+
declare const plugin: {
|
|
10
|
+
install: (app: App, options: {
|
|
11
|
+
config: AppConfig;
|
|
12
|
+
}) => void;
|
|
13
|
+
};
|
|
14
|
+
type DzangolabI18nOptions = I18nOptions & {
|
|
15
|
+
supportedLocales: string[];
|
|
16
|
+
};
|
|
17
|
+
interface DzangolabVueI18nPluginOptions {
|
|
18
|
+
config: AppConfig;
|
|
19
|
+
}
|
|
20
|
+
declare module "@prefabs.tech/vue3-config" {
|
|
21
|
+
interface AppConfig {
|
|
22
|
+
i18n: DzangolabI18nOptions;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export default plugin;
|
|
26
|
+
export { createI18n, getPreferredLocale, LocaleSwitcher, prependMessages, useI18n, useLocaleStore, };
|
|
27
|
+
export type { DzangolabI18nOptions, DzangolabVueI18nPluginOptions, LocaleMessages, VueMessageType, };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,OAAO,EAAE,MAAM,UAAU,CAAC;AAEjE,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,cAAc,MAAM,SAAS,CAAC;AACrC,OAAO,EAAkB,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9E,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,QAAA,MAAM,UAAU,YAAa,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PropType } from "vue";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
locale: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: PropType<string>;
|
|
6
|
+
};
|
|
7
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
+
locale: {
|
|
9
|
+
required: true;
|
|
10
|
+
type: PropType<string>;
|
|
11
|
+
};
|
|
12
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=Badge.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Badge.vue.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;;;;cA6BhB,QAAQ,CAAC,MAAM,CAAC;;;;;cAAhB,QAAQ,CAAC,MAAM,CAAC;;;AA1BpC,wBAiGc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
2
|
+
icon: (_: {}) => any;
|
|
3
|
+
}>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
+
new (): {
|
|
7
|
+
$slots: S;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=Index.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Index.vue.ts"],"names":[],"mappings":";UAqLM,CAAC,CAAC,IAAgB,KAAK,GAAG;;AAxKhC,wBA6Lc;AACd,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAAE,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PropType } from "vue";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
locale: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: PropType<string>;
|
|
6
|
+
};
|
|
7
|
+
name: {
|
|
8
|
+
required: true;
|
|
9
|
+
type: PropType<string>;
|
|
10
|
+
};
|
|
11
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
locale: {
|
|
13
|
+
required: true;
|
|
14
|
+
type: PropType<string>;
|
|
15
|
+
};
|
|
16
|
+
name: {
|
|
17
|
+
required: true;
|
|
18
|
+
type: PropType<string>;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=LocaleOption.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleOption.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/LocaleOption.vue.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;;;;cAmBhB,QAAQ,CAAC,MAAM,CAAC;;;;cAIhB,QAAQ,CAAC,MAAM,CAAC;;;;;cAJhB,QAAQ,CAAC,MAAM,CAAC;;;;cAIhB,QAAQ,CAAC,MAAM,CAAC;;;AApBpC,wBAqFc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-locale-names.d.ts","sourceRoot":"","sources":["../../../src/locales/native-locale-names.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB;;;;;;CAMtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc,SAAU,MAAM;qBAGZ,MAAM,GAAG,SAAS;wBAMb,MAAM,GAAG,SAAS,KAAG,IAAI;CASrD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LocaleMessages, VueMessageType } from "vue-i18n";
|
|
2
|
+
declare const getLocaleNames: (supportedLocales: string[]) => LocaleMessages<VueMessageType>;
|
|
3
|
+
declare const getPreferredLocale: (languages: readonly string[], locales: string[]) => string | undefined;
|
|
4
|
+
declare const prependMessages: (messages: LocaleMessages<VueMessageType>, defaults: LocaleMessages<VueMessageType> | undefined) => LocaleMessages<VueMessageType>;
|
|
5
|
+
export { getLocaleNames, getPreferredLocale, prependMessages };
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/D,QAAA,MAAM,cAAc,qBAAsB,MAAM,EAAE,mCAUjD,CAAC;AAEF,QAAA,MAAM,kBAAkB,cACX,SAAS,MAAM,EAAE,WACnB,MAAM,EAAE,KAChB,MAAM,GAAG,SAsBX,CAAC;AAEF,QAAA,MAAM,eAAe,aACT,cAAc,CAAC,cAAc,CAAC,YAC9B,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,KACnD,cAAc,CAAC,cAAc,CAoC/B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.country[data-v-c1291edf]{bottom:-.35rem;background:var(--locale-switcher-badge-country-bf-color, #007aff);color:var(--locale-switcher-badge-country-color, #fff);font-size:.5rem;font-weight:700;line-height:1.25;padding:1px 2px;position:absolute;right:-.25rem}.badge[data-v-c1291edf]{align-items:center;background-color:var(--locale-switcher-badge-bg-color, #007aff);border-radius:50%;display:flex;font-size:.9rem;height:2em;justify-content:center;position:relative;text-align:center;width:2em}.locale[data-v-5ee88038]{align-items:center;display:flex;gap:.5rem;justify-content:flex-start}nav.locale-switcher[data-v-2184c436]{cursor:pointer;padding:0;position:relative;width:var(--locale-switcher-width, 9rem)}nav.locale-switcher.expanded[data-v-2184c436],nav.locale-switcher[data-v-2184c436]:hover{background-color:var(--locale-switcher-hover-color, #e5e5e5);border-radius:5px}nav.locale-switcher>.locale-trigger[data-v-2184c436]{align-items:center;display:flex;gap:0;justify-content:space-between;padding:var(--locale-switcher-padding-v, .625rem) var(--locale-switcher-padding-h, 1rem)}.locale[data-v-2184c436]{flex:1}nav>.locale-trigger>span[data-v-2184c436]{align-self:start;font-size:1.5rem;line-height:1.25rem;text-align:center;width:1.25rem}nav>ul.dropdown[data-v-2184c436]{background-color:var(--locale-switcher-bg-color, #fff);border:var(--locale-switcher-border, 1px solid #e5e5e5);border-radius:var(--locale-switcher-border-radius, 5px);box-shadow:0 2px 5px #0000001a;display:none;list-style:none;min-width:var(--locale-switcher-min-width, 160px);padding-inline-start:0;padding:.15rem 0;position:absolute;right:0;top:120%;z-index:var(--locale-switcher-z-index, 9999)}nav.expanded ul[data-v-2184c436]{display:block}nav>.dropdown>li[data-v-2184c436]{cursor:pointer;list-style:none;padding:.7rem 1.25rem}nav li.current[data-v-2184c436]{display:none}nav.expanded li[data-v-2184c436]:hover{background-color:var(--locale-switcher-hover-color, #e5e5e5)}.truncated[data-v-2184c436]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}nav .truncated>img[data-v-2184c436]{transition:transform .3s ease}nav.expanded .truncated>img[data-v-2184c436]{transform:rotate(180deg)}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prefabs.tech/vue3-i18n",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "Vue3 I18n Plugin",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/PrefabsTechVue3I18n.es.js",
|
|
9
|
+
"require": "./dist/PrefabsTechVue3I18n.umd.js"
|
|
10
|
+
},
|
|
11
|
+
"./dist/PrefabsTechVue3I18n.css": "./dist/vue3-i18n.css"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/PrefabsTechVue3I18n.umd.js",
|
|
14
|
+
"module": "./dist/PrefabsTechVue3I18n.es.js",
|
|
15
|
+
"types": "./dist/src/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"vue-i18n": "9.1.10"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@prefabs.tech/eslint-config": "0.2.0",
|
|
24
|
+
"@prefabs.tech/tsconfig": "0.2.0",
|
|
25
|
+
"@prefabs.tech/vue3-config": "0.12.0",
|
|
26
|
+
"@types/node": "22.13.5",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "8.24.1",
|
|
28
|
+
"@typescript-eslint/parser": "8.24.1",
|
|
29
|
+
"@vitejs/plugin-vue": "5.2.1",
|
|
30
|
+
"@vitejs/plugin-vue-jsx": "4.1.1",
|
|
31
|
+
"@vitest/coverage-istanbul": "3.0.6",
|
|
32
|
+
"@vueuse/core": "12.7.0",
|
|
33
|
+
"eslint": "8.57.1",
|
|
34
|
+
"eslint-config-prettier": "9.1.0",
|
|
35
|
+
"eslint-import-resolver-alias": "1.1.2",
|
|
36
|
+
"eslint-import-resolver-typescript": "3.8.3",
|
|
37
|
+
"eslint-plugin-import": "2.31.0",
|
|
38
|
+
"eslint-plugin-prettier": "5.2.3",
|
|
39
|
+
"eslint-plugin-unicorn": "56.0.1",
|
|
40
|
+
"eslint-plugin-vue": "9.32.0",
|
|
41
|
+
"jsdom": "26.0.0",
|
|
42
|
+
"pinia": "3.0.1",
|
|
43
|
+
"prettier": "3.5.2",
|
|
44
|
+
"typescript": "5.5.4",
|
|
45
|
+
"vite": "6.1.1",
|
|
46
|
+
"vitest": "3.0.6",
|
|
47
|
+
"vue": "3.5.13",
|
|
48
|
+
"vue-eslint-parser": "9.4.3",
|
|
49
|
+
"vue-tsc": "1.2.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@prefabs.tech/vue3-config": "0.12.0",
|
|
53
|
+
"@vueuse/core": ">=9.4.0",
|
|
54
|
+
"pinia": ">=2.0",
|
|
55
|
+
"vue": ">=3.2"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18",
|
|
59
|
+
"pnpm": ">=9"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "vite build && vue-tsc --emitDeclarationOnly",
|
|
63
|
+
"lint": "eslint . --ext .vue",
|
|
64
|
+
"lint:fix": "eslint . --ext .vue --fix",
|
|
65
|
+
"sort-package": "npx sort-package-json",
|
|
66
|
+
"test": "vitest --environment jsdom run --coverage",
|
|
67
|
+
"test:component": "vitest --environment jsdom run component/",
|
|
68
|
+
"test:snapshot": "vitest --environment jsdom run snapshot/",
|
|
69
|
+
"test:unit": "vitest --environment jsdom run unit/",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.json --composite false"
|
|
72
|
+
}
|
|
73
|
+
}
|