@prefabs.tech/vue3-i18n 0.13.0 → 0.14.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.
@@ -1,145 +1,144 @@
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";
1
+ import { useI18n as G, createI18n as z } from "vue-i18n";
2
+ import { useI18n as Pe } from "vue-i18n";
3
+ import { watch as D, getCurrentScope as R, onScopeDispose as U, computed as I, toValue as v, unref as N, defineComponent as A, createElementBlock as L, openBlock as _, createTextVNode as V, createCommentVNode as j, toDisplayString as E, createBlock as H, ref as P, normalizeClass as T, createElementVNode as w, renderSlot as J, Fragment as K, renderList as Q, createVNode as X } from "vue";
4
+ import { useConfig as Y } from "@prefabs.tech/vue3-config";
6
5
  function Z(e) {
7
- return z() ? (U(e), !0) : !1;
6
+ return R() ? (U(e), !0) : !1;
8
7
  }
9
- const N = typeof window < "u" && typeof document < "u";
8
+ const W = typeof window < "u" && typeof document < "u";
10
9
  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() {
10
+ const ee = Object.prototype.toString, te = (e) => ee.call(e) === "[object Object]", y = () => {
11
+ }, ne = /* @__PURE__ */ oe();
12
+ function oe() {
14
13
  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));
14
+ return W && ((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
15
  }
17
- function $(e) {
16
+ function B(e) {
18
17
  return Array.isArray(e) ? e : [e];
19
18
  }
20
- function le(e, t, o) {
19
+ function le(e, t, n) {
21
20
  return D(
22
21
  e,
23
22
  t,
24
23
  {
25
- ...o,
24
+ ...n,
26
25
  immediate: !0
27
26
  }
28
27
  );
29
28
  }
30
- const W = N ? window : void 0;
29
+ const q = W ? window : void 0;
31
30
  function b(e) {
32
31
  var t;
33
- const o = h(e);
34
- return (t = o?.$el) != null ? t : o;
32
+ const n = v(e);
33
+ return (t = n?.$el) != null ? t : n;
35
34
  }
36
- function L(...e) {
37
- const t = [], o = () => {
35
+ function S(...e) {
36
+ const t = [], n = () => {
38
37
  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);
38
+ }, o = (a, r, u, p) => (a.addEventListener(r, u, p), () => a.removeEventListener(r, u, p)), l = I(() => {
39
+ const a = B(v(e[0])).filter((r) => r != null);
41
40
  return a.every((r) => typeof r != "string") ? a : void 0;
42
- }), s = le(
41
+ }), c = le(
43
42
  () => {
44
43
  var a, r;
45
44
  return [
46
- (r = (a = l.value) == null ? void 0 : a.map((u) => b(u))) != null ? r : [W].filter((u) => u != null),
47
- $(h(l.value ? e[1] : e[0])),
48
- $(M(l.value ? e[2] : e[1])),
45
+ (r = (a = l.value) == null ? void 0 : a.map((u) => b(u))) != null ? r : [q].filter((u) => u != null),
46
+ B(v(l.value ? e[1] : e[0])),
47
+ B(N(l.value ? e[2] : e[1])),
49
48
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
50
- h(l.value ? e[3] : e[2])
49
+ v(l.value ? e[3] : e[2])
51
50
  ];
52
51
  },
53
- ([a, r, u, f]) => {
54
- if (o(), !a?.length || !r?.length || !u?.length)
52
+ ([a, r, u, p]) => {
53
+ if (n(), !a?.length || !r?.length || !u?.length)
55
54
  return;
56
- const m = te(f) ? { ...f } : f;
55
+ const g = te(p) ? { ...p } : p;
57
56
  t.push(
58
57
  ...a.flatMap(
59
- (v) => r.flatMap(
60
- (g) => u.map((k) => n(v, g, k, m))
58
+ (h) => r.flatMap(
59
+ (m) => u.map((k) => o(h, m, k, g))
61
60
  )
62
61
  )
63
62
  );
64
63
  },
65
64
  { flush: "post" }
66
- ), p = () => {
67
- s(), o();
65
+ ), f = () => {
66
+ c(), n();
68
67
  };
69
- return Z(o), p;
68
+ return Z(n), f;
70
69
  }
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);
70
+ let M = !1;
71
+ function se(e, t, n = {}) {
72
+ const { window: o = q, ignore: l = [], capture: c = !0, detectIframe: f = !1, controls: a = !1 } = n;
73
+ if (!o)
74
+ return a ? { stop: y, cancel: y, trigger: y } : y;
75
+ if (ne && !M) {
76
+ M = !0;
77
+ const s = { passive: !0 };
78
+ Array.from(o.document.body.children).forEach((i) => S(i, "click", y, s)), S(o.document.documentElement, "click", y, s);
80
79
  }
81
80
  let r = !0;
82
- const u = (c) => h(l).some((i) => {
81
+ const u = (s) => v(l).some((i) => {
83
82
  if (typeof i == "string")
84
- return Array.from(n.document.querySelectorAll(i)).some((d) => d === c.target || c.composedPath().includes(d));
83
+ return Array.from(o.document.querySelectorAll(i)).some((d) => d === s.target || s.composedPath().includes(d));
85
84
  {
86
85
  const d = b(i);
87
- return d && (c.target === d || c.composedPath().includes(d));
86
+ return d && (s.target === d || s.composedPath().includes(d));
88
87
  }
89
88
  });
90
- function f(c) {
91
- const i = h(c);
89
+ function p(s) {
90
+ const i = v(s);
92
91
  return i && i.$.subTree.shapeFlag === 16;
93
92
  }
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));
93
+ function g(s, i) {
94
+ const d = v(s), $ = d.$.subTree && d.$.subTree.children;
95
+ return $ == null || !Array.isArray($) ? !1 : $.some((x) => x.el === i.target || i.composedPath().includes(x.el));
97
96
  }
98
- const v = (c) => {
97
+ const h = (s) => {
99
98
  const i = b(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) {
99
+ if (s.target != null && !(!(i instanceof Element) && p(e) && g(e, s)) && !(!i || i === s.target || s.composedPath().includes(i))) {
100
+ if ("detail" in s && s.detail === 0 && (r = !u(s)), !r) {
102
101
  r = !0;
103
102
  return;
104
103
  }
105
- t(c);
104
+ t(s);
106
105
  }
107
106
  };
108
- let g = !1;
107
+ let m = !1;
109
108
  const k = [
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) => {
109
+ S(o, "click", (s) => {
110
+ m || (m = !0, setTimeout(() => {
111
+ m = !1;
112
+ }, 0), h(s));
113
+ }, { passive: !0, capture: c }),
114
+ S(o, "pointerdown", (s) => {
116
115
  const i = b(e);
117
- r = !u(c) && !!(i && !c.composedPath().includes(i));
116
+ r = !u(s) && !!(i && !s.composedPath().includes(i));
118
117
  }, { passive: !0 }),
119
- p && L(n, "blur", (c) => {
118
+ f && S(o, "blur", (s) => {
120
119
  setTimeout(() => {
121
120
  var i;
122
121
  const d = b(e);
123
- ((i = n.document.activeElement) == null ? void 0 : i.tagName) === "IFRAME" && !d?.contains(n.document.activeElement) && t(c);
122
+ ((i = o.document.activeElement) == null ? void 0 : i.tagName) === "IFRAME" && !d?.contains(o.document.activeElement) && t(s);
124
123
  }, 0);
125
124
  }, { passive: !0 })
126
- ].filter(Boolean), A = () => k.forEach((c) => c());
125
+ ].filter(Boolean), O = () => k.forEach((s) => s());
127
126
  return a ? {
128
- stop: A,
127
+ stop: O,
129
128
  cancel: () => {
130
129
  r = !1;
131
130
  },
132
- trigger: (c) => {
133
- r = !0, v(c), r = !1;
131
+ trigger: (s) => {
132
+ r = !0, h(s), r = !1;
134
133
  }
135
- } : A;
134
+ } : O;
136
135
  }
137
- const se = { class: "badge" }, re = {
136
+ const ce = { class: "badge" }, re = {
138
137
  key: 0,
139
138
  class: "country"
140
139
  }, ae = {
141
140
  name: "LocaleBadge"
142
- }, ie = /* @__PURE__ */ C({
141
+ }, ie = /* @__PURE__ */ A({
143
142
  ...ae,
144
143
  props: {
145
144
  locale: {
@@ -148,25 +147,25 @@ const se = { class: "badge" }, re = {
148
147
  }
149
148
  },
150
149
  setup(e) {
151
- const t = e, o = I(() => t.locale.substring(0, 2)), n = I(() => {
150
+ const t = e, n = I(() => t.locale.substring(0, 2)), o = I(() => {
152
151
  const l = t.locale.split("-");
153
152
  if (l.length > 1)
154
153
  return l[1];
155
154
  });
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)
155
+ return (l, c) => (_(), L("span", ce, [
156
+ V(E(n.value) + " ", 1),
157
+ o.value ? (_(), L("span", re, E(o.value), 1)) : j("", !0)
159
158
  ]));
160
159
  }
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 = {
160
+ }), C = (e, t) => {
161
+ const n = e.__vccOpts || e;
162
+ for (const [o, l] of t)
163
+ n[o] = l;
164
+ return n;
165
+ }, ue = /* @__PURE__ */ C(ie, [["__scopeId", "data-v-c1291edf"]]), de = { class: "locale" }, fe = {
167
166
  name: "LocaleOption"
168
- }, fe = /* @__PURE__ */ C({
169
- ...pe,
167
+ }, pe = /* @__PURE__ */ A({
168
+ ...fe,
170
169
  props: {
171
170
  locale: {
172
171
  required: !0,
@@ -175,15 +174,22 @@ const se = { class: "badge" }, re = {
175
174
  name: {
176
175
  required: !0,
177
176
  type: String
177
+ },
178
+ showBadges: {
179
+ default: !0,
180
+ type: Boolean
178
181
  }
179
182
  },
180
183
  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
+ return (t, n) => (_(), L("div", de, [
185
+ e.showBadges ? (_(), H(ue, {
186
+ key: 0,
187
+ locale: e.locale
188
+ }, null, 8, ["locale"])) : j("", !0),
189
+ V(" " + E(e.name), 1)
184
190
  ]));
185
191
  }
186
- }), me = /* @__PURE__ */ O(fe, [["__scopeId", "data-v-5ee88038"]]), F = (e) => {
192
+ }), ge = /* @__PURE__ */ C(pe, [["__scopeId", "data-v-3d8a4124"]]), F = (e) => {
187
193
  const t = `${e}.locale`;
188
194
  return { getLocale: () => {
189
195
  const l = localStorage.getItem(t);
@@ -191,131 +197,145 @@ const se = { class: "badge" }, re = {
191
197
  }, setLocale: (l) => {
192
198
  l ? localStorage.setItem(t, l) : localStorage.removeItem(t);
193
199
  } };
194
- }, ge = { class: "locale truncated" }, ve = { class: "truncated" }, he = { class: "dropdown" }, _e = ["onClick"], we = {
200
+ }, me = { class: "locale truncated" }, he = { class: "truncated" }, ve = { class: "dropdown" }, _e = ["onClick"], we = {
195
201
  name: "LocaleSwitcher"
196
- }, ye = /* @__PURE__ */ C({
202
+ }, ye = /* @__PURE__ */ A({
197
203
  ...we,
204
+ props: {
205
+ showBadges: {
206
+ default: !0,
207
+ type: Boolean
208
+ }
209
+ },
198
210
  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);
211
+ const { availableLocales: t, locale: n, t: o } = G(), l = Y(), c = P(!1), f = (g) => {
212
+ n.value = g, c.value = !1;
213
+ const { setLocale: h } = F(l.slug);
214
+ h(g);
203
215
  }, a = I(() => ({
204
- locale: o.value,
205
- name: u(o.value)
216
+ locale: n.value,
217
+ name: u(n.value)
206
218
  })), 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", {
219
+ c.value = !c.value;
220
+ }, u = (g) => o(`locales.${g}`), p = P(null);
221
+ return se(p, (g) => {
222
+ c.value = !1;
223
+ }), (g, h) => (_(), L("nav", {
212
224
  ref_key: "dzangolabVueI18nLocaleSwitcher",
213
- ref: f,
214
- class: V(["locale-switcher", { expanded: s.value }])
225
+ ref: p,
226
+ class: T(["locale-switcher", { expanded: c.value }])
215
227
  }, [
216
- S("div", {
228
+ w("div", {
217
229
  class: "locale-trigger",
218
230
  onClick: r
219
231
  }, [
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))
232
+ w("div", me, E(a.value.name), 1),
233
+ w("span", he, [
234
+ J(g.$slots, "icon", {}, () => [
235
+ h[0] || (h[0] = w("svg", {
236
+ height: "24",
237
+ viewBox: "0 0 24 24",
238
+ width: "24",
239
+ xmlns: "http://www.w3.org/2000/svg"
240
+ }, [
241
+ w("path", {
242
+ d: "M12 15.25a.74.74 0 0 1-.53-.22l-5-5A.75.75 0 0 1 7.53 9L12 13.44L16.47 9a.75.75 0 0 1 1.06 1l-5 5a.74.74 0 0 1-.53.25",
243
+ fill: "currentColor"
244
+ })
245
+ ], -1))
227
246
  ], !0)
228
247
  ])
229
248
  ]),
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: (k) => p(g)
249
+ w("ul", ve, [
250
+ (_(!0), L(K, null, Q(N(t), (m) => (_(), L("li", {
251
+ key: m,
252
+ class: T([{ current: m === a.value.locale }, "truncated"]),
253
+ onClick: (k) => f(m)
235
254
  }, [
236
- G(me, {
237
- locale: g,
238
- name: u(g)
239
- }, null, 8, ["locale", "name"])
255
+ X(ge, {
256
+ locale: m,
257
+ name: u(m),
258
+ "show-badges": e.showBadges
259
+ }, null, 8, ["locale", "name", "show-badges"])
240
260
  ], 10, _e))), 128))
241
261
  ])
242
262
  ], 2));
243
263
  }
244
- }), Ce = /* @__PURE__ */ O(ye, [["__scopeId", "data-v-0bb7ed2b"]]), Se = {
264
+ }), Ae = /* @__PURE__ */ C(ye, [["__scopeId", "data-v-368e3886"]]), Le = {
245
265
  en: "English",
246
266
  "en-GB": "English (GB)",
247
267
  "en-US": "English (US)",
248
268
  fr: "Français",
249
269
  th: "ไทย"
250
- }, Le = (e) => {
270
+ }, Se = (e) => {
251
271
  const t = {};
252
- for (const o of e)
253
- t[o] = {
254
- locales: Se
272
+ for (const n of e)
273
+ t[n] = {
274
+ locales: Le
255
275
  };
256
276
  return t;
257
277
  }, be = (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;
278
+ let n;
279
+ return e.some((o) => {
280
+ const l = o.split("-");
281
+ let c = [];
282
+ for (let f = 1; f <= l.length; f++)
283
+ if (c = (c.length === 0 ? t : c).filter((a) => a.startsWith(l.slice(0, f).join("-"))), c.length === 1)
284
+ return n = c[0], !0;
285
+ }), n;
266
286
  }, ke = (e, t) => {
267
287
  if (!t)
268
288
  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,
289
+ const n = {};
290
+ for (const o in t) {
291
+ const l = t[o], c = e[o];
292
+ n[o] = c ? {
293
+ ...c,
274
294
  ...l
275
295
  } : l;
276
296
  }
277
- for (const n in e) {
278
- if (o[n])
297
+ for (const o in e) {
298
+ if (n[o])
279
299
  continue;
280
- const l = t[n], s = e[n];
281
- o[n] = l ? {
282
- ...s,
300
+ const l = t[o], c = e[o];
301
+ n[o] = l ? {
302
+ ...c,
283
303
  ...l
284
- } : s;
304
+ } : c;
285
305
  }
286
- return o;
306
+ return n;
287
307
  }, Ie = (e) => {
288
- const t = e.config.i18n, o = e.config.slug, { getLocale: n, setLocale: l } = F(o), s = n();
289
- if (!s) {
308
+ const t = e.config.i18n, n = e.config.slug, { getLocale: o, setLocale: l } = F(n), c = o();
309
+ if (!c) {
290
310
  const r = be(
291
311
  navigator.languages,
292
312
  t.supportedLocales
293
313
  );
294
314
  l(r);
295
315
  }
296
- const p = ke(
297
- Le(t.supportedLocales),
316
+ const f = ke(
317
+ Se(t.supportedLocales),
298
318
  t?.messages
299
319
  );
300
- return q({
320
+ return z({
301
321
  ...t,
302
322
  globalInjection: !0,
303
323
  legacy: !1,
304
- locale: s,
305
- messages: p
324
+ locale: c,
325
+ messages: f
306
326
  });
307
- }, Oe = {
327
+ }, Ce = {
308
328
  install: (e, t) => {
309
- const o = Ie(t);
310
- e.use(o);
329
+ const n = Ie(t);
330
+ e.use(n);
311
331
  }
312
332
  };
313
333
  export {
314
- Ce as LocaleSwitcher,
334
+ Ae as LocaleSwitcher,
315
335
  Ie as createI18n,
316
- Oe as default,
336
+ Ce as default,
317
337
  be as getPreferredLocale,
318
338
  ke as prependMessages,
319
- Te as useI18n,
339
+ Pe as useI18n,
320
340
  F as useLocaleStore
321
341
  };
@@ -1 +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 b(e){var n;const o=t.toValue(e);return(n=o?.$el)!=null?n:o}function w(...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=>b(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=>w(u,"click",S,r)),w(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=b(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=b(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=[w(c,"click",r=>{_||(_=!0,setTimeout(()=>{_=!1},0),y(r))},{passive:!0,capture:s}),w(c,"pointerdown",r=>{const u=b(e);a=!d(r)&&!!(u&&!r.composedPath().includes(u))},{passive:!0}),m&&w(c,"blur",r=>{setTimeout(()=>{var u;const p=b(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-0bb7ed2b"]]),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"}})});
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,e,j){"use strict";function v(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}const C=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const q=Object.prototype.toString,x=t=>q.call(t)==="[object Object]",w=()=>{},D=W();function W(){var t,n;return C&&((t=window?.navigator)==null?void 0:t.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(t){return Array.isArray(t)?t:[t]}function z(t,n,o){return e.watch(t,n,{...o,immediate:!0})}const P=C?window:void 0;function S(t){var n;const o=e.toValue(t);return(n=o?.$el)!=null?n:o}function b(...t){const n=[],o=()=>{n.forEach(i=>i()),n.length=0},l=(i,a,d,g)=>(i.addEventListener(a,d,g),()=>i.removeEventListener(a,d,g)),c=e.computed(()=>{const i=E(e.toValue(t[0])).filter(a=>a!=null);return i.every(a=>typeof a!="string")?i:void 0}),s=z(()=>{var i,a;return[(a=(i=c.value)==null?void 0:i.map(d=>S(d)))!=null?a:[P].filter(d=>d!=null),E(e.toValue(c.value?t[1]:t[0])),E(e.unref(c.value?t[2]:t[1])),e.toValue(c.value?t[3]:t[2])]},([i,a,d,g])=>{if(o(),!i?.length||!a?.length||!d?.length)return;const h=x(g)?{...g}:g;n.push(...i.flatMap(y=>a.flatMap(_=>d.map(L=>l(y,_,L,h)))))},{flush:"post"}),m=()=>{s(),o()};return v(o),m}let O=!1;function F(t,n,o={}){const{window:l=P,ignore:c=[],capture:s=!0,detectIframe:m=!1,controls:i=!1}=o;if(!l)return i?{stop:w,cancel:w,trigger:w}:w;if(D&&!O){O=!0;const r={passive:!0};Array.from(l.document.body.children).forEach(u=>b(u,"click",w,r)),b(l.document.documentElement,"click",w,r)}let a=!0;const d=r=>e.toValue(c).some(u=>{if(typeof u=="string")return Array.from(l.document.querySelectorAll(u)).some(p=>p===r.target||r.composedPath().includes(p));{const p=S(u);return p&&(r.target===p||r.composedPath().includes(p))}});function g(r){const u=e.toValue(r);return u&&u.$.subTree.shapeFlag===16}function h(r,u){const p=e.toValue(r),I=p.$.subTree&&p.$.subTree.children;return I==null||!Array.isArray(I)?!1:I.some(M=>M.el===u.target||u.composedPath().includes(M.el))}const y=r=>{const u=S(t);if(r.target!=null&&!(!(u instanceof Element)&&g(t)&&h(t,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(l,"click",r=>{_||(_=!0,setTimeout(()=>{_=!1},0),y(r))},{passive:!0,capture:s}),b(l,"pointerdown",r=>{const u=S(t);a=!d(r)&&!!(u&&!r.composedPath().includes(u))},{passive:!0}),m&&b(l,"blur",r=>{setTimeout(()=>{var u;const p=S(t);((u=l.document.activeElement)==null?void 0:u.tagName)==="IFRAME"&&!p?.contains(l.document.activeElement)&&n(r)},0)},{passive:!0})].filter(Boolean),A=()=>L.forEach(r=>r());return i?{stop:A,cancel:()=>{a=!1},trigger:r=>{a=!0,y(r),a=!1}}:A}const G={class:"badge"},R={key:0,class:"country"},U={name:"LocaleBadge"},H=e.defineComponent({...U,props:{locale:{required:!0,type:String}},setup(t){const n=t,o=e.computed(()=>n.locale.substring(0,2)),l=e.computed(()=>{const c=n.locale.split("-");if(c.length>1)return c[1]});return(c,s)=>(e.openBlock(),e.createElementBlock("span",G,[e.createTextVNode(e.toDisplayString(o.value)+" ",1),l.value?(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]))}}),B=(t,n)=>{const o=t.__vccOpts||t;for(const[l,c]of n)o[l]=c;return o},J=B(H,[["__scopeId","data-v-c1291edf"]]),K={class:"locale"},Q={name:"LocaleOption"},X=e.defineComponent({...Q,props:{locale:{required:!0,type:String},name:{required:!0,type:String},showBadges:{default:!0,type:Boolean}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",K,[t.showBadges?(e.openBlock(),e.createBlock(J,{key:0,locale:t.locale},null,8,["locale"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.name),1)]))}}),Y=B(X,[["__scopeId","data-v-3d8a4124"]]),V=t=>{const n=`${t}.locale`;return{getLocale:()=>{const c=localStorage.getItem(n);return c||void 0},setLocale:c=>{c?localStorage.setItem(n,c):localStorage.removeItem(n)}}},Z={class:"locale truncated"},ee={class:"truncated"},te={class:"dropdown"},ne=["onClick"],oe={name:"LocaleSwitcher"},le=e.defineComponent({...oe,props:{showBadges:{default:!0,type:Boolean}},setup(t){const{availableLocales:n,locale:o,t:l}=k.useI18n(),c=j.useConfig(),s=e.ref(!1),m=h=>{o.value=h,s.value=!1;const{setLocale:y}=V(c.slug);y(h)},i=e.computed(()=>({locale:o.value,name:d(o.value)})),a=()=>{s.value=!s.value},d=h=>l(`locales.${h}`),g=e.ref(null);return F(g,h=>{s.value=!1}),(h,y)=>(e.openBlock(),e.createElementBlock("nav",{ref_key:"dzangolabVueI18nLocaleSwitcher",ref:g,class:e.normalizeClass(["locale-switcher",{expanded:s.value}])},[e.createElementVNode("div",{class:"locale-trigger",onClick:a},[e.createElementVNode("div",Z,e.toDisplayString(i.value.name),1),e.createElementVNode("span",ee,[e.renderSlot(h.$slots,"icon",{},()=>[y[0]||(y[0]=e.createElementVNode("svg",{height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M12 15.25a.74.74 0 0 1-.53-.22l-5-5A.75.75 0 0 1 7.53 9L12 13.44L16.47 9a.75.75 0 0 1 1.06 1l-5 5a.74.74 0 0 1-.53.25",fill:"currentColor"})],-1))],!0)])]),e.createElementVNode("ul",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),_=>(e.openBlock(),e.createElementBlock("li",{key:_,class:e.normalizeClass([{current:_===i.value.locale},"truncated"]),onClick:L=>m(_)},[e.createVNode(Y,{locale:_,name:d(_),"show-badges":t.showBadges},null,8,["locale","name","show-badges"])],10,ne))),128))])],2))}}),ce=B(le,[["__scopeId","data-v-368e3886"]]),re={en:"English","en-GB":"English (GB)","en-US":"English (US)",fr:"Français",th:"ไทย"},se=t=>{const n={};for(const o of t)n[o]={locales:re};return n},T=(t,n)=>{let o;return t.some(l=>{const c=l.split("-");let s=[];for(let m=1;m<=c.length;m++)if(s=(s.length===0?n:s).filter(i=>i.startsWith(c.slice(0,m).join("-"))),s.length===1)return o=s[0],!0}),o},$=(t,n)=>{if(!n)return t;const o={};for(const l in n){const c=n[l],s=t[l];o[l]=s?{...s,...c}:c}for(const l in t){if(o[l])continue;const c=n[l],s=t[l];o[l]=c?{...s,...c}:s}return o},N=t=>{const n=t.config.i18n,o=t.config.slug,{getLocale:l,setLocale:c}=V(o),s=l();if(!s){const a=T(navigator.languages,n.supportedLocales);c(a)}const m=$(se(n.supportedLocales),n?.messages);return k.createI18n({...n,globalInjection:!0,legacy:!1,locale:s,messages:m})},ae={install:(t,n)=>{const o=N(n);t.use(o)}};Object.defineProperty(f,"useI18n",{enumerable:!0,get:()=>k.useI18n}),f.LocaleSwitcher=ce,f.createI18n=N,f.default=ae,f.getPreferredLocale=T,f.prependMessages=$,f.useLocaleStore=V,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,4 +1,16 @@
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>, {
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ showBadges: {
3
+ default: boolean;
4
+ type: BooleanConstructor;
5
+ };
6
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
7
+ showBadges: {
8
+ default: boolean;
9
+ type: BooleanConstructor;
10
+ };
11
+ }>> & Readonly<{}>, {
12
+ showBadges: boolean;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
2
14
  icon: (_: {}) => any;
3
15
  }>;
4
16
  export default _default;
@@ -1 +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"}
1
+ {"version":3,"file":"Index.vue.d.ts","sourceRoot":"","sources":["../../../src/locale-switcher/Index.vue.ts"],"names":[],"mappings":";;;;;;;;;;;;;UA8KM,CAAC,CAAC,IAAgB,KAAK,GAAG;;AAjKhC,wBAsLc;AACd,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAAE,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC"}
@@ -8,6 +8,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
8
8
  required: true;
9
9
  type: PropType<string>;
10
10
  };
11
+ showBadges: {
12
+ default: boolean;
13
+ type: BooleanConstructor;
14
+ };
11
15
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
16
  locale: {
13
17
  required: true;
@@ -17,6 +21,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
17
21
  required: true;
18
22
  type: PropType<string>;
19
23
  };
20
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
24
+ showBadges: {
25
+ default: boolean;
26
+ type: BooleanConstructor;
27
+ };
28
+ }>> & Readonly<{}>, {
29
+ showBadges: boolean;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
21
31
  export default _default;
22
32
  //# sourceMappingURL=LocaleOption.vue.d.ts.map
@@ -1 +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"}
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;;;;cAuBhB,QAAQ,CAAC,MAAM,CAAC;;;;cAIhB,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;cAJhB,QAAQ,CAAC,MAAM,CAAC;;;;cAIhB,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;AAxBpC,wBAiGc"}
@@ -1 +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-0bb7ed2b]{--_hover-bg: var(--nav-item-hover-bg, #f0f2f7ad);--_hover-color: var(--nav-item-hover-color, #2c2c2c);border-radius:.325rem;cursor:pointer;padding:0;position:relative;width:var(--locale-switcher-width, 9rem)}nav.locale-switcher.expanded[data-v-0bb7ed2b],nav.locale-switcher[data-v-0bb7ed2b]:hover{background:var(--_hover-bg);color:var(--_hover-color)}nav.locale-switcher>.locale-trigger[data-v-0bb7ed2b]{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-0bb7ed2b]{flex:1}nav>.locale-trigger>span[data-v-0bb7ed2b]{align-self:start;font-size:1.5rem;line-height:1.25rem;text-align:center;width:1.25rem}nav>ul.dropdown[data-v-0bb7ed2b]{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-0bb7ed2b]{display:block}nav>.dropdown>li[data-v-0bb7ed2b]{--_hover-bg: var(--nav-item-hover-bg, #f0f2f7ad);--_hover-color: var(--nav-item-hover-color, #2c2c2c);cursor:pointer;list-style:none;padding:.7rem 1.25rem}nav li.current[data-v-0bb7ed2b]{display:none}nav.expanded li[data-v-0bb7ed2b]:hover{background:var(--_hover-bg);color:var(--_hover-color)}.truncated[data-v-0bb7ed2b]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}nav .truncated>img[data-v-0bb7ed2b]{transition:transform .3s ease}nav.expanded .truncated>img[data-v-0bb7ed2b]{transform:rotate(180deg)}
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-3d8a4124]{align-items:center;display:flex;gap:.5rem;justify-content:flex-start}nav.locale-switcher[data-v-368e3886]{--_hover-bg: var(--nav-item-hover-bg, #f0f2f7ad);--_hover-color: var(--nav-item-hover-color, #2c2c2c);--_width: var(--locale-switcher-width, 10rem);border-radius:.325rem;cursor:pointer;padding:0;position:relative;width:var(--_width)}nav.locale-switcher.expanded[data-v-368e3886],nav.locale-switcher[data-v-368e3886]:hover{background:var(--_hover-bg);color:var(--_hover-color)}nav.locale-switcher>.locale-trigger[data-v-368e3886]{--_padding-h: var(--locale-switcher-padding-h, 1rem);--_padding-v: var(--locale-switcher-padding-v, .625rem);align-items:center;display:flex;gap:0;justify-content:space-between;padding:var(--_padding-v) var(--_padding-h)}.locale[data-v-368e3886]{flex:1}nav.locale-switcher>.locale-trigger>span[data-v-368e3886]{align-self:start;font-size:1.5rem;line-height:1.25rem;text-align:center;width:1.5rem}nav.locale-switcher>ul.dropdown[data-v-368e3886]{--_bg-color: var(--locale-switcher-bg-color, #fff);--_border: var(--locale-switcher-border, 1px solid #e5e5e5);--_min-width: var(--locale-switcher-width, 10rem);background-color:var(--_bg-color);border:var(--_border);border-radius:.325rem;box-shadow:0 2px 5px #0000001a;display:none;list-style:none;min-width:var(--_min-width);padding-inline-start:0;padding:.15rem 0;position:absolute;right:0;top:120%;z-index:1000}nav.locale-switcher.expanded ul[data-v-368e3886]{display:block}nav.locale-switcher>.dropdown>li[data-v-368e3886]{--_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;list-style:none;padding:.7rem 1.25rem}nav.locale-switcher.expanded li[data-v-368e3886]:hover{background:var(--_hover-bg);color:var(--_hover-color)}nav.locale-switcher>.dropdown>li.current[data-v-368e3886]{background-color:var(--_active-bg);color:var(--_active-color)}.locale-switcher .truncated[data-v-368e3886]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.locale-switcher .truncated>svg[data-v-368e3886]{transition:transform .3s ease}nav.locale-switcher.expanded .truncated>svg[data-v-368e3886]{transform:rotate(180deg)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prefabs.tech/vue3-i18n",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Vue3 I18n Plugin",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "devDependencies": {
23
23
  "@prefabs.tech/eslint-config": "0.2.0",
24
24
  "@prefabs.tech/tsconfig": "0.2.0",
25
- "@prefabs.tech/vue3-config": "0.13.0",
25
+ "@prefabs.tech/vue3-config": "0.14.0",
26
26
  "@types/node": "22.13.5",
27
27
  "@typescript-eslint/eslint-plugin": "8.24.1",
28
28
  "@typescript-eslint/parser": "8.24.1",
@@ -49,7 +49,7 @@
49
49
  "vue-tsc": "1.2.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@prefabs.tech/vue3-config": "0.13.0",
52
+ "@prefabs.tech/vue3-config": "0.14.0",
53
53
  "@vueuse/core": ">=9.4.0",
54
54
  "pinia": ">=2.0",
55
55
  "vue": ">=3.2"
@@ -62,6 +62,7 @@
62
62
  "build": "vite build && vue-tsc --emitDeclarationOnly",
63
63
  "lint": "eslint . --ext .vue",
64
64
  "lint:fix": "eslint . --ext .vue --fix",
65
+ "snapshot:update": "vitest --environment jsdom run --update",
65
66
  "sort-package": "npx sort-package-json",
66
67
  "test": "vitest --environment jsdom run --coverage",
67
68
  "test:component": "vitest --environment jsdom run component/",