@cocoar/vue-localization 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { ref as y, computed as d, inject as p } from "vue";
2
- class L {
1
+ import { ref as g, computed as d, inject as v } from "vue";
2
+ class P {
3
3
  data = /* @__PURE__ */ new Map();
4
- _version = y(0);
4
+ _version = g(0);
5
5
  /** Reactive version counter — watch this to react to data changes */
6
6
  version = this._version;
7
7
  setLocaleData(t, n) {
@@ -20,37 +20,38 @@ class L {
20
20
  this.data.clear(), this._version.value++;
21
21
  }
22
22
  }
23
- class I {
23
+ class $ {
24
24
  async load(t) {
25
25
  return {
26
26
  code: t,
27
27
  date: _(t),
28
- number: P(t),
29
- currency: U(t),
30
- percent: b(t)
28
+ number: U(t),
29
+ currency: z(t),
30
+ percent: N(t)
31
31
  };
32
32
  }
33
33
  }
34
34
  function _(r) {
35
35
  const t = [], n = [], e = [], a = [], o = new Intl.DateTimeFormat(r, { month: "long" }), s = new Intl.DateTimeFormat(r, { month: "short" });
36
- for (let u = 0; u < 12; u++) {
37
- const f = new Date(2024, u, 1);
38
- t.push(o.format(f)), n.push(s.format(f));
36
+ for (let f = 0; f < 12; f++) {
37
+ const y = new Date(2024, f, 1);
38
+ t.push(o.format(y)), n.push(s.format(y));
39
39
  }
40
- const i = new Intl.DateTimeFormat(r, { weekday: "long" }), c = new Intl.DateTimeFormat(r, { weekday: "short" });
41
- for (let u = 0; u < 7; u++) {
42
- const f = new Date(2024, 0, 7 + u);
43
- e.push(i.format(f)), a.push(c.format(f));
40
+ const c = new Intl.DateTimeFormat(r, { weekday: "long" }), i = new Intl.DateTimeFormat(r, { weekday: "short" });
41
+ for (let f = 0; f < 7; f++) {
42
+ const y = new Date(2024, 0, 7 + f);
43
+ e.push(c.format(y)), a.push(i.format(y));
44
44
  }
45
- const l = R(r), m = $(r), h = F(r);
45
+ const { pattern: m, zeroPad: u } = R(r), h = b(r), l = F(r);
46
46
  return {
47
- pattern: l,
48
- firstDayOfWeek: m,
47
+ pattern: m,
48
+ firstDayOfWeek: h,
49
49
  monthNames: t,
50
50
  monthNamesShort: n,
51
51
  dayNames: e,
52
52
  dayNamesShort: a,
53
- amPm: h
53
+ amPm: l,
54
+ zeroPad: u
54
55
  };
55
56
  }
56
57
  function R(r) {
@@ -58,20 +59,27 @@ function R(r) {
58
59
  year: "numeric",
59
60
  month: "2-digit",
60
61
  day: "2-digit"
61
- }).formatToParts(new Date(2024, 11, 25)), e = n.filter((o) => o.type === "month" || o.type === "day" || o.type === "year").map((o) => o.type), a = n.find((o) => o.type === "literal")?.value ?? "/";
62
- return e[0] === "year" ? "yyyy-mm-dd" : e[0] === "month" ? "mm/dd/yyyy" : a === "." ? "dd.mm.yyyy" : "dd/mm/yyyy";
62
+ }).formatToParts(new Date(2024, 11, 25)), e = n.filter((u) => u.type === "month" || u.type === "day" || u.type === "year").map((u) => u.type), a = n.find((u) => u.type === "literal")?.value ?? "/";
63
+ let o;
64
+ e[0] === "year" ? o = a === "-" ? "yyyy-mm-dd" : "yyyy/mm/dd" : e[0] === "month" ? o = "mm/dd/yyyy" : a === "." ? o = "dd.mm.yyyy" : o = "dd/mm/yyyy";
65
+ const m = new Intl.DateTimeFormat(r, {
66
+ year: "numeric",
67
+ month: "numeric",
68
+ day: "numeric"
69
+ }).formatToParts(new Date(2024, 2, 5)).find((u) => u.type === "day")?.value === "05";
70
+ return { pattern: o, zeroPad: m };
63
71
  }
64
- function $(r) {
72
+ function b(r) {
65
73
  try {
66
74
  const e = new Intl.Locale(r), a = e.getWeekInfo?.() ?? e.weekInfo;
67
75
  if (a?.firstDay != null)
68
76
  return a.firstDay === 7 ? 0 : a.firstDay;
69
77
  } catch {
70
78
  }
71
- const t = w(r);
79
+ const t = L(r);
72
80
  return ["US", "CA", "JP", "KR", "TW", "PH", "IL"].includes(t) ? 0 : 1;
73
81
  }
74
- function w(r) {
82
+ function L(r) {
75
83
  const t = r.split("-");
76
84
  if (t.length > 1)
77
85
  return t[t.length - 1].toUpperCase();
@@ -89,21 +97,21 @@ function F(r) {
89
97
  return ["AM", "PM"];
90
98
  }
91
99
  }
92
- function P(r) {
100
+ function U(r) {
93
101
  const n = new Intl.NumberFormat(r, { useGrouping: !0 }).formatToParts(123456789e-2), e = n.find((o) => o.type === "decimal")?.value ?? ".", a = n.find((o) => o.type === "group")?.value ?? ",";
94
102
  return { decimal: e, group: a, grouping: [3] };
95
103
  }
96
- function U(r) {
97
- const t = w(r), n = z(t);
104
+ function z(r) {
105
+ const t = L(r), n = x(t);
98
106
  try {
99
107
  const a = new Intl.NumberFormat(r, {
100
108
  style: "currency",
101
109
  currency: n
102
- }).formatToParts(1234.56), s = a.find((u) => u.type === "currency")?.value ?? n, i = a.findIndex((u) => u.type === "currency"), c = a.findIndex((u) => u.type === "integer"), l = i < c ? "before" : "after", h = (l === "before" ? a.slice(i + 1, c) : a.slice(c, i)).some((u) => u.type === "literal" && /\s/.test(u.value));
110
+ }).formatToParts(1234.56), s = a.find((l) => l.type === "currency")?.value ?? n, c = a.findIndex((l) => l.type === "currency"), i = a.findIndex((l) => l.type === "integer"), m = c < i ? "before" : "after", h = (m === "before" ? a.slice(c + 1, i) : a.slice(i, c)).some((l) => l.type === "literal" && /\s/.test(l.value));
103
111
  return {
104
112
  default: n,
105
113
  symbols: { [n]: s },
106
- position: l,
114
+ position: m,
107
115
  spacing: h,
108
116
  decimals: 2
109
117
  };
@@ -117,15 +125,15 @@ function U(r) {
117
125
  };
118
126
  }
119
127
  }
120
- function b(r) {
128
+ function N(r) {
121
129
  try {
122
- const n = new Intl.NumberFormat(r, { style: "percent" }).formatToParts(0.25), e = n.find((c) => c.type === "percentSign")?.value ?? "%", a = n.findIndex((c) => c.type === "percentSign"), o = n.findIndex((c) => c.type === "integer"), i = (a > o ? n.slice(o + 1, a) : n.slice(a + 1, o)).some((c) => c.type === "literal" && /\s/.test(c.value));
123
- return { symbol: e, spacing: i, decimals: 0 };
130
+ const n = new Intl.NumberFormat(r, { style: "percent" }).formatToParts(0.25), e = n.find((i) => i.type === "percentSign")?.value ?? "%", a = n.findIndex((i) => i.type === "percentSign"), o = n.findIndex((i) => i.type === "integer"), c = (a > o ? n.slice(o + 1, a) : n.slice(a + 1, o)).some((i) => i.type === "literal" && /\s/.test(i.value));
131
+ return { symbol: e, spacing: c, decimals: 0 };
124
132
  } catch {
125
133
  return { symbol: "%", spacing: !1, decimals: 0 };
126
134
  }
127
135
  }
128
- function z(r) {
136
+ function x(r) {
129
137
  return {
130
138
  US: "USD",
131
139
  GB: "GBP",
@@ -177,7 +185,7 @@ function z(r) {
177
185
  SA: "SAR"
178
186
  }[r] ?? "USD";
179
187
  }
180
- function T(r, t) {
188
+ function I(r, t) {
181
189
  return {
182
190
  code: t.code ?? r.code,
183
191
  date: t.date ? { ...r.date, ...t.date } : r.date,
@@ -190,9 +198,9 @@ function T(r, t) {
190
198
  percent: t.percent ? { ...r.percent, ...t.percent } : r.percent
191
199
  };
192
200
  }
193
- class N {
201
+ class C {
194
202
  data = /* @__PURE__ */ new Map();
195
- _version = y(0);
203
+ _version = g(0);
196
204
  /** Reactive version counter — use in computed() to react to changes */
197
205
  version = this._version;
198
206
  /** Reactive set of loaded language codes */
@@ -203,14 +211,14 @@ class N {
203
211
  */
204
212
  setTranslations(t, n) {
205
213
  const e = /* @__PURE__ */ new Map();
206
- v(n, "", e), this.data.set(t, e), this._version.value++;
214
+ S(n, "", e), this.data.set(t, e), this._version.value++;
207
215
  }
208
216
  /**
209
217
  * Merge additional translations into existing ones for a language.
210
218
  */
211
219
  updateTranslations(t, n) {
212
220
  const e = this.data.get(t) ?? /* @__PURE__ */ new Map();
213
- v(n, "", e), this.data.set(t, e), this._version.value++;
221
+ S(n, "", e), this.data.set(t, e), this._version.value++;
214
222
  }
215
223
  /**
216
224
  * Get a single translation by key.
@@ -251,22 +259,22 @@ class N {
251
259
  this.data.clear(), this._version.value++;
252
260
  }
253
261
  }
254
- function v(r, t, n) {
262
+ function S(r, t, n) {
255
263
  for (const [e, a] of Object.entries(r)) {
256
264
  const o = t ? `${t}.${e}` : e;
257
- typeof a == "string" ? n.set(o, a) : v(a, o, n);
265
+ typeof a == "string" ? n.set(o, a) : S(a, o, n);
258
266
  }
259
267
  }
260
- function x(r, t) {
268
+ function E(r, t) {
261
269
  return t ? r.replace(/\{(\w+)\}/g, (n, e) => {
262
270
  const a = t[e];
263
271
  return a == null ? "" : String(a);
264
272
  }) : r;
265
273
  }
266
- function Z(r, t) {
274
+ function Y(r, t) {
267
275
  return t == null || t.trim() === "" ? !0 : r === t;
268
276
  }
269
- class C {
277
+ class M {
270
278
  async load(t) {
271
279
  const n = {};
272
280
  try {
@@ -293,7 +301,7 @@ class C {
293
301
  return n;
294
302
  }
295
303
  }
296
- class E {
304
+ class k {
297
305
  getTimezone() {
298
306
  try {
299
307
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -310,7 +318,7 @@ class A {
310
318
  return this._timezone;
311
319
  }
312
320
  constructor(t = []) {
313
- this.providers = [...t, new E()], this._timezone = y(this.resolve());
321
+ this.providers = [...t, new k()], this._timezone = g(this.resolve());
314
322
  }
315
323
  /** Re-resolve the timezone from providers and update the reactive value */
316
324
  refresh() {
@@ -324,7 +332,7 @@ class A {
324
332
  return "UTC";
325
333
  }
326
334
  }
327
- class M {
335
+ class B {
328
336
  defaultLanguage;
329
337
  _language;
330
338
  _loading;
@@ -344,11 +352,11 @@ class M {
344
352
  /** Computed current locale data — reactive, updates on language change */
345
353
  localeData;
346
354
  constructor(t = {}) {
347
- this.defaultLanguage = t.defaultLanguage ?? "en", this._language = y(this.defaultLanguage), this._loading = y(!1), this.l10nStore = new L(), this.i18nStore = new N(), this.timezoneService = new A(t.timezoneProviders);
348
- const n = new I();
355
+ this.defaultLanguage = t.defaultLanguage ?? "en", this._language = g(this.defaultLanguage), this._loading = g(!1), this.l10nStore = new P(), this.i18nStore = new C(), this.timezoneService = new A(t.timezoneProviders);
356
+ const n = new $();
349
357
  this.l10nSources = [n];
350
- const e = new C();
351
- this.i18nSources = [e], t.l10nUrl && this.l10nSources.push(new D(t.l10nUrl)), t.i18nUrl && this.i18nSources.push(new k(t.i18nUrl)), this.localeData = d(() => this.l10nStore.getLocaleData(this._language.value));
358
+ const e = new M();
359
+ this.i18nSources = [e], t.l10nUrl && this.l10nSources.push(new w(t.l10nUrl)), t.i18nUrl && this.i18nSources.push(new H(t.i18nUrl)), this.localeData = d(() => this.l10nStore.getLocaleData(this._language.value));
352
360
  }
353
361
  /** Get the configured default language */
354
362
  getDefaultLanguage() {
@@ -395,16 +403,16 @@ class M {
395
403
  const a = this._language.value;
396
404
  let o = this.i18nStore.getTranslation(a, t);
397
405
  if (o === void 0 && a.includes("-")) {
398
- const i = a.split("-")[0];
399
- o = this.i18nStore.getTranslation(i, t);
406
+ const c = a.split("-")[0];
407
+ o = this.i18nStore.getTranslation(c, t);
400
408
  }
401
- return x(o ?? e ?? t, n);
409
+ return E(o ?? e ?? t, n);
402
410
  }
403
411
  /**
404
412
  * Add a custom locale data source (loaded after Intl, before HTTP).
405
413
  */
406
414
  addLocaleDataSource(t) {
407
- const n = this.l10nSources.findIndex((e) => e instanceof D);
415
+ const n = this.l10nSources.findIndex((e) => e instanceof w);
408
416
  n >= 0 ? this.l10nSources.splice(n, 0, t) : this.l10nSources.push(t);
409
417
  }
410
418
  /**
@@ -422,7 +430,7 @@ class M {
422
430
  for (const e of this.l10nSources)
423
431
  try {
424
432
  const a = await e.load(t);
425
- a && (n ? n = T(n, a) : n = a);
433
+ a && (n ? n = I(n, a) : n = a);
426
434
  } catch {
427
435
  }
428
436
  n && this.l10nStore.setLocaleData(t, n);
@@ -437,7 +445,7 @@ class M {
437
445
  this.i18nStore.hasLanguage(t) || this.i18nStore.setTranslations(t, {});
438
446
  }
439
447
  }
440
- class D {
448
+ class w {
441
449
  constructor(t) {
442
450
  this.urlBuilder = t;
443
451
  }
@@ -454,14 +462,14 @@ class D {
454
462
  const a = await fetch(this.urlBuilder(t));
455
463
  if (a.ok) {
456
464
  const o = await a.json();
457
- e ? e = T(e, o) : e = o;
465
+ e ? e = I(e, o) : e = o;
458
466
  }
459
467
  } catch {
460
468
  }
461
469
  return e;
462
470
  }
463
471
  }
464
- class k {
472
+ class H {
465
473
  constructor(t) {
466
474
  this.urlBuilder = t;
467
475
  }
@@ -485,66 +493,81 @@ class k {
485
493
  return e;
486
494
  }
487
495
  }
488
- function S(r, t, n) {
496
+ function D(r, t, n) {
489
497
  const e = n ?? 2, a = Math.abs(r).toFixed(e), [o, s] = a.split(".");
490
- let i = "";
491
- const c = o, l = t.grouping[0] ?? 3;
492
- let m = c.length;
493
- for (; m > 0; ) {
494
- const u = Math.max(0, m - l);
495
- i = c.slice(u, m) + (i ? t.group + i : ""), m = u;
498
+ let c = "";
499
+ const i = o, m = t.grouping[0] ?? 3;
500
+ let u = i.length;
501
+ for (; u > 0; ) {
502
+ const l = Math.max(0, u - m);
503
+ c = i.slice(l, u) + (c ? t.group + c : ""), u = l;
496
504
  }
497
505
  const h = r < 0 ? "-" : "";
498
- return e > 0 && s ? `${h}${i}${t.decimal}${s}` : `${h}${i}`;
506
+ return e > 0 && s ? `${h}${c}${t.decimal}${s}` : `${h}${c}`;
499
507
  }
500
- function B(r, t, n) {
501
- const e = t.currency, a = n ?? e.default, o = e.symbols[a] ?? a, s = S(r, t.number, e.decimals), i = e.spacing ? " " : "";
502
- return e.position === "before" ? `${o}${i}${s}` : `${s}${i}${o}`;
508
+ function K(r, t, n) {
509
+ const e = t.currency, a = n ?? e.default, o = e.symbols[a] ?? O(t.code, a), s = D(r, t.number, e.decimals), c = e.spacing ? " " : "";
510
+ return e.position === "before" ? `${o}${c}${s}` : `${s}${c}${o}`;
503
511
  }
504
- function H(r, t, n) {
505
- const e = t.percent, a = n ?? e.decimals, o = S(r * 100, t.number, a), s = e.spacing ? " " : "";
512
+ const T = /* @__PURE__ */ new Map();
513
+ function O(r, t) {
514
+ const n = `${r}:${t}`;
515
+ let e = T.get(n);
516
+ if (e != null) return e;
517
+ try {
518
+ e = new Intl.NumberFormat(r, { style: "currency", currency: t }).formatToParts(0).find((o) => o.type === "currency")?.value ?? t;
519
+ } catch {
520
+ e = t;
521
+ }
522
+ return T.set(n, e), e;
523
+ }
524
+ function Z(r, t, n) {
525
+ const e = t.percent, a = n ?? e.decimals, o = D(r * 100, t.number, a), s = e.spacing ? " " : "";
506
526
  return `${o}${s}${e.symbol}`;
507
527
  }
508
- function K(r, t, n = !1) {
528
+ function G(r, t, n = !1) {
509
529
  const e = typeof r == "string" ? new Date(r) : r;
510
530
  if (isNaN(e.getTime())) return String(r);
511
- const a = String(e.getDate()).padStart(2, "0"), o = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getFullYear());
531
+ const a = t.zeroPad !== !1, o = a ? String(e.getDate()).padStart(2, "0") : String(e.getDate()), s = a ? String(e.getMonth() + 1).padStart(2, "0") : String(e.getMonth() + 1), c = String(e.getFullYear());
512
532
  let i;
513
533
  switch (t.pattern) {
514
534
  case "mm/dd/yyyy":
515
- i = `${o}/${a}/${s}`;
535
+ i = `${s}/${o}/${c}`;
516
536
  break;
517
537
  case "yyyy-mm-dd":
518
- i = `${s}-${o}-${a}`;
538
+ i = `${c}-${s}-${o}`;
539
+ break;
540
+ case "yyyy/mm/dd":
541
+ i = `${c}/${s}/${o}`;
519
542
  break;
520
543
  case "dd/mm/yyyy":
521
- i = `${a}/${o}/${s}`;
544
+ i = `${o}/${s}/${c}`;
522
545
  break;
523
546
  default:
524
- i = `${a}.${o}.${s}`;
547
+ i = `${o}.${s}.${c}`;
525
548
  break;
526
549
  }
527
550
  if (n) {
528
- const c = String(e.getHours()).padStart(2, "0"), l = String(e.getMinutes()).padStart(2, "0");
529
- i += ` ${c}:${l}`;
551
+ const m = String(e.getHours()).padStart(2, "0"), u = String(e.getMinutes()).padStart(2, "0");
552
+ i += ` ${m}:${u}`;
530
553
  }
531
554
  return i;
532
555
  }
533
- const g = /* @__PURE__ */ Symbol("coar-localization");
534
- function G(r = {}) {
535
- const t = new M(r);
556
+ const p = /* @__PURE__ */ Symbol("coar-localization");
557
+ function j(r = {}) {
558
+ const t = new B(r);
536
559
  return {
537
560
  service: t,
538
561
  install(e) {
539
- e.provide(g, t);
562
+ e.provide(p, t), t.setLanguage(t.getDefaultLanguage());
540
563
  }
541
564
  };
542
565
  }
543
- function W() {
544
- return p(g, null);
566
+ function J() {
567
+ return v(p, null);
545
568
  }
546
- function Y() {
547
- const r = p(g, null), t = r ? r.language : d(() => navigator.language || "en"), n = r ? r.localeData : d(() => {
569
+ function V() {
570
+ const r = v(p, null), t = r ? r.language : d(() => navigator.language || "en"), n = r ? r.localeData : d(() => {
548
571
  });
549
572
  return {
550
573
  /** Current language (reactive) */
@@ -554,27 +577,27 @@ function Y() {
554
577
  /** Format a number */
555
578
  fmtNumber: (e, a) => {
556
579
  const o = n.value;
557
- return o ? S(e, o.number, a) : e.toFixed(a ?? 2);
580
+ return o ? D(e, o.number, a) : e.toFixed(a ?? 2);
558
581
  },
559
582
  /** Format a currency value */
560
583
  fmtCurrency: (e, a) => {
561
584
  const o = n.value;
562
- return o ? B(e, o, a) : e.toFixed(2);
585
+ return o ? K(e, o, a) : e.toFixed(2);
563
586
  },
564
587
  /** Format a percentage (0.25 → "25%") */
565
588
  fmtPercent: (e, a) => {
566
589
  const o = n.value;
567
- return o ? H(e, o, a) : `${(e * 100).toFixed(a ?? 0)}%`;
590
+ return o ? Z(e, o, a) : `${(e * 100).toFixed(a ?? 0)}%`;
568
591
  },
569
592
  /** Format a date */
570
593
  fmtDate: (e, a = !1) => {
571
594
  const o = n.value;
572
- return o ? K(e, o.date, a) : String(e);
595
+ return o ? G(e, o.date, a) : String(e);
573
596
  }
574
597
  };
575
598
  }
576
- function j() {
577
- const r = p(g, null);
599
+ function X() {
600
+ const r = v(p, null);
578
601
  return {
579
602
  /** Current language (reactive) */
580
603
  language: r ? r.language : d(() => navigator.language || "en"),
@@ -589,8 +612,8 @@ function j() {
589
612
  tRef: (t, n, e) => r ? d(() => r.t(t, n, e)) : d(() => e ?? t)
590
613
  };
591
614
  }
592
- function J() {
593
- const r = p(g, null);
615
+ function q() {
616
+ const r = v(p, null);
594
617
  return {
595
618
  /** Current timezone (reactive IANA identifier) */
596
619
  timezone: r ? r.timezoneService.timezone : d(() => {
@@ -605,24 +628,24 @@ function J() {
605
628
  };
606
629
  }
607
630
  export {
608
- E as BrowserTimezoneProvider,
609
- g as COAR_LOCALIZATION_KEY,
610
- L as CoarLocalizationDataStore,
611
- M as CoarLocalizationService,
631
+ k as BrowserTimezoneProvider,
632
+ p as COAR_LOCALIZATION_KEY,
633
+ P as CoarLocalizationDataStore,
634
+ B as CoarLocalizationService,
612
635
  A as CoarTimezoneService,
613
- N as CoarTranslationStore,
614
- I as IntlLocaleDataSource,
615
- C as IntlTranslationSource,
616
- G as createCoarLocalization,
617
- B as formatCurrency,
618
- K as formatDate,
619
- S as formatNumber,
620
- H as formatPercent,
621
- x as interpolate,
622
- Z as isMissingTranslation,
623
- T as mergeLocalizationData,
624
- j as useI18n,
625
- Y as useL10n,
626
- W as useLocalization,
627
- J as useTimezone
636
+ C as CoarTranslationStore,
637
+ $ as IntlLocaleDataSource,
638
+ M as IntlTranslationSource,
639
+ j as createCoarLocalization,
640
+ K as formatCurrency,
641
+ G as formatDate,
642
+ D as formatNumber,
643
+ Z as formatPercent,
644
+ E as interpolate,
645
+ Y as isMissingTranslation,
646
+ I as mergeLocalizationData,
647
+ X as useI18n,
648
+ V as useL10n,
649
+ J as useLocalization,
650
+ q as useTimezone
628
651
  };
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/l10n/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAqBR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAWR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAMR;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,IAAI,EAAE,kBAAkB,EACxB,WAAW,UAAQ,GAClB,MAAM,CAgCR"}
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/l10n/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAqBR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAWR;AAkBD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAMR;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,IAAI,EAAE,kBAAkB,EACxB,WAAW,UAAQ,GAClB,MAAM,CAoCR"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,sBAA2B,GAAG,MAAM,GAAG;IACpF,OAAO,EAAE,uBAAuB,CAAC;CAClC,CAWA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,sBAA2B,GAAG,MAAM,GAAG;IACpF,OAAO,EAAE,uBAAuB,CAAC;CAClC,CAYA"}
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export interface CoarDateFormatData {
5
5
  /** Date pattern, e.g. 'dd.mm.yyyy', 'mm/dd/yyyy' */
6
- pattern: 'dd.mm.yyyy' | 'dd/mm/yyyy' | 'mm/dd/yyyy' | 'yyyy-mm-dd';
6
+ pattern: 'dd.mm.yyyy' | 'dd/mm/yyyy' | 'mm/dd/yyyy' | 'yyyy-mm-dd' | 'yyyy/mm/dd';
7
7
  /** First day of week: 0=Sunday, 1=Monday, ..., 6=Saturday */
8
8
  firstDayOfWeek: number;
9
9
  /** Full month names, e.g. ['January', 'February', ...] */
@@ -16,6 +16,8 @@ export interface CoarDateFormatData {
16
16
  dayNamesShort: string[];
17
17
  /** AM/PM labels */
18
18
  amPm: [string, string];
19
+ /** Whether day and month are zero-padded (e.g. '03' vs '3'). Default: true */
20
+ zeroPad?: boolean;
19
21
  }
20
22
  /**
21
23
  * Number format data for a locale.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,OAAO,EAAE,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;IACnE,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,wDAAwD;IACxD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,sDAAsD;IACtD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB;IACnB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,6CAA6C;IAC7C,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;IAC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EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,6BAA6B;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,8BAA8B;IAC9B,OAAO,EAAE,qBAAqB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,iDAAiD;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC3C,qFAAqF;IACrF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,WAAW,IAAI,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocoar/vue-localization",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Locale-aware formatting (l10n), translations (i18n), and timezone detection for Vue 3",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {