@m3ui-vue/m3ui-vue 1.1.2 → 1.1.3

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.
Files changed (88) hide show
  1. package/dist/API.md +135 -5
  2. package/dist/{MIcon-DLOkQduI.js → MIcon-Bxh9j135.js} +15 -8
  3. package/dist/MIcon-Bxh9j135.js.map +1 -0
  4. package/dist/{MMenuItem-DVxKEv1W.js → MMenuItem-BckcR0nW.js} +4 -4
  5. package/dist/{MMenuItem-DVxKEv1W.js.map → MMenuItem-BckcR0nW.js.map} +1 -1
  6. package/dist/{MSlider-BXsBv0ox.js → MSlider-LyH_gy8D.js} +56 -47
  7. package/dist/MSlider-LyH_gy8D.js.map +1 -0
  8. package/dist/{MTextField-rML9jnXs.js → MTextField-FCPOTB0o.js} +65 -64
  9. package/dist/{MTextField-rML9jnXs.js.map → MTextField-FCPOTB0o.js.map} +1 -1
  10. package/dist/api.json +1 -1
  11. package/dist/code-editor.js +2 -2
  12. package/dist/components/MAnimatedNumber.vue.d.ts +27 -0
  13. package/dist/components/MIcon.vue.d.ts +2 -0
  14. package/dist/components/MListGroup.vue.d.ts +23 -0
  15. package/dist/components/MScheduler.vue.d.ts +2 -2
  16. package/dist/components/MScheme.vue.d.ts +60 -0
  17. package/dist/components/MSparkline.vue.d.ts +41 -0
  18. package/dist/components/MWindow.vue.d.ts +2 -2
  19. package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
  20. package/dist/composables/_useSegmentRuns.d.ts +8 -0
  21. package/dist/composables/dynamicColor.d.ts +11 -0
  22. package/dist/composables/useColorPalette.d.ts +3 -1
  23. package/dist/composables/useConfetti.d.ts +32 -0
  24. package/dist/composables/useLocale.d.ts +6 -0
  25. package/dist/index.d.ts +7 -1
  26. package/dist/locales/index.js +21 -0
  27. package/dist/locales/index.js.map +1 -1
  28. package/dist/m3ui-vue.css +1 -1
  29. package/dist/m3ui.js +16187 -15377
  30. package/dist/m3ui.js.map +1 -1
  31. package/dist/map.js +45 -45
  32. package/dist/{material-color-utilities-Cktu8DBU.js → material-color-utilities-C_iikgRm.js} +928 -603
  33. package/dist/material-color-utilities-C_iikgRm.js.map +1 -0
  34. package/dist/rich-text-editor.js +4 -4
  35. package/dist/styles.css +1 -1
  36. package/dist/terminal.js +1 -1
  37. package/dist/{useLocale-CqQrhWFl.js → useLocale-SfQHnJfp.js} +4 -1
  38. package/dist/useLocale-SfQHnJfp.js.map +1 -0
  39. package/package.json +1 -1
  40. package/src/__tests__/MAnimatedNumber.test.ts +106 -0
  41. package/src/__tests__/MIcon.test.ts +19 -0
  42. package/src/__tests__/MListItemShape.test.ts +34 -0
  43. package/src/__tests__/MScheme.test.ts +107 -0
  44. package/src/__tests__/MSparkline.test.ts +96 -0
  45. package/src/__tests__/iconButtonNames.test.ts +124 -0
  46. package/src/__tests__/ssr.test.ts +1 -0
  47. package/src/__tests__/useConfetti.test.ts +81 -0
  48. package/src/components/MAnimatedNumber.vue +301 -0
  49. package/src/components/MAutocomplete.vue +34 -4
  50. package/src/components/MBottomSheet.vue +1 -0
  51. package/src/components/MDataTable.vue +1 -1
  52. package/src/components/MIcon.vue +11 -4
  53. package/src/components/MList.vue +8 -30
  54. package/src/components/MListGroup.vue +66 -0
  55. package/src/components/MMaskField.vue +3 -0
  56. package/src/components/MMultiAutocomplete.vue +5 -1
  57. package/src/components/MMultiSelect.vue +19 -9
  58. package/src/components/MScheme.vue +162 -0
  59. package/src/components/MSearchBar.vue +2 -0
  60. package/src/components/MSelect.vue +44 -10
  61. package/src/components/MSideSheet.vue +3 -0
  62. package/src/components/MSimpleCarousel.vue +6 -0
  63. package/src/components/MSparkline.vue +250 -0
  64. package/src/components/MSplitButton.vue +3 -0
  65. package/src/components/MSpotlightSearch.vue +1 -0
  66. package/src/components/MTable.vue +1 -0
  67. package/src/components/MTagInput.vue +4 -0
  68. package/src/components/MTextField.vue +3 -0
  69. package/src/components/MTour.vue +1 -0
  70. package/src/components/MTreeTable.vue +1 -0
  71. package/src/components/_MTreeNode.vue +3 -0
  72. package/src/composables/_useSegmentRuns.ts +39 -0
  73. package/src/composables/dynamicColor.ts +66 -0
  74. package/src/composables/useColorPalette.ts +2 -2
  75. package/src/composables/useConfetti.ts +204 -0
  76. package/src/composables/useLocale.ts +9 -0
  77. package/src/index.ts +7 -1
  78. package/src/locales/de.ts +3 -0
  79. package/src/locales/es.ts +3 -0
  80. package/src/locales/fr.ts +3 -0
  81. package/src/locales/ja.ts +3 -0
  82. package/src/locales/ko.ts +3 -0
  83. package/src/locales/pt.ts +3 -0
  84. package/src/locales/zh.ts +3 -0
  85. package/dist/MIcon-DLOkQduI.js.map +0 -1
  86. package/dist/MSlider-BXsBv0ox.js.map +0 -1
  87. package/dist/material-color-utilities-Cktu8DBU.js.map +0 -1
  88. package/dist/useLocale-CqQrhWFl.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { i as e } from "./useLocale-CqQrhWFl.js";
2
- import { a as t, c as n, o as r } from "./MTextField-rML9jnXs.js";
3
- import { t as i } from "./MIcon-DLOkQduI.js";
1
+ import { i as e } from "./useLocale-SfQHnJfp.js";
2
+ import { a as t, c as n, o as r } from "./MTextField-FCPOTB0o.js";
3
+ import { t as i } from "./MIcon-Bxh9j135.js";
4
4
  import { Fragment as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, inject as h, mergeProps as g, normalizeClass as _, normalizeStyle as v, onBeforeUnmount as y, onMounted as b, onUnmounted as x, openBlock as S, provide as C, ref as w, renderList as T, renderSlot as E, resolveDynamicComponent as D, shallowRef as O, toDisplayString as k, unref as ee, useAttrs as te, useSlots as A, watch as j, withCtx as ne, withModifiers as M } from "vue";
5
5
  //#region src/composables/_storageKeys.ts
6
6
  var N = "m3-theme", P = "m3-dynamic-palette", F = "m3-viewport", I = /* @__PURE__ */ m({
@@ -377,7 +377,26 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
377
377
  "style"
378
378
  ]));
379
379
  }
380
- }), Q = /* @__PURE__ */ m({
380
+ });
381
+ //#endregion
382
+ //#region src/composables/_useSegmentRuns.ts
383
+ function Q(e) {
384
+ let t = O(/* @__PURE__ */ new Map());
385
+ function n() {
386
+ let n = /* @__PURE__ */ new Map(), r = [], i = () => {
387
+ r.forEach((e, t) => n.set(e, r.length === 1 ? "single" : t === 0 ? "first" : t === r.length - 1 ? "last" : "middle")), r = [];
388
+ };
389
+ for (let t of e.value?.children ?? []) t.getAttribute("role") === "listitem" ? r.push(t) : i();
390
+ i(), t.value = n;
391
+ }
392
+ let r;
393
+ return b(() => {
394
+ n(), e.value && (r = new MutationObserver(n), r.observe(e.value, { childList: !0 }));
395
+ }), x(() => r?.disconnect()), (e) => e ? t.value.get(e) : void 0;
396
+ }
397
+ //#endregion
398
+ //#region src/components/MList.vue
399
+ var $ = /* @__PURE__ */ m({
381
400
  __name: "MList",
382
401
  props: {
383
402
  dense: {
@@ -405,19 +424,9 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
405
424
  },
406
425
  emits: ["update:selected"],
407
426
  setup(e, { emit: t }) {
408
- let n = e, r = t, i = w(), a = O(/* @__PURE__ */ new Map());
409
- function o() {
410
- let e = /* @__PURE__ */ new Map(), t = [], n = () => {
411
- t.forEach((n, r) => e.set(n, t.length === 1 ? "single" : r === 0 ? "first" : r === t.length - 1 ? "last" : "middle")), t = [];
412
- };
413
- for (let e of i.value?.children ?? []) e.getAttribute("role") === "listitem" ? t.push(e) : n();
414
- n(), a.value = e;
415
- }
416
- let c;
417
- b(() => {
418
- o(), i.value && (c = new MutationObserver(o), c.observe(i.value, { childList: !0 }));
419
- }), x(() => c?.disconnect()), C("m-list", {
420
- segmentPosition: (e) => e ? a.value.get(e) : void 0,
427
+ let n = e, r = t, i = w(), a = Q(i);
428
+ C("m-list", {
429
+ segmentPosition: a,
421
430
  dense: s(() => n.dense),
422
431
  nav: s(() => n.nav),
423
432
  segmented: s(() => n.segmented),
@@ -427,7 +436,7 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
427
436
  lines: s(() => n.lines),
428
437
  select: (e) => r("update:selected", e)
429
438
  });
430
- let l = s(() => [
439
+ let o = s(() => [
431
440
  "flex flex-col",
432
441
  n.segmented ? "gap-0.5 p-2" : "py-2",
433
442
  n.nav && !n.segmented && "gap-0.5 px-3"
@@ -436,13 +445,13 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
436
445
  ref_key: "listEl",
437
446
  ref: i,
438
447
  role: "list",
439
- class: _(l.value)
448
+ class: _(o.value)
440
449
  }, [E(e.$slots, "default")], 2));
441
450
  }
442
- }), $ = { class: "relative -my-2 inline-flex h-12 shrink-0 items-center" }, me = ["checked", "disabled"], he = {
451
+ }), me = { class: "relative -my-2 inline-flex h-12 shrink-0 items-center" }, he = ["checked", "disabled"], ge = {
443
452
  key: 0,
444
453
  class: "text-body-large text-on-surface"
445
- }, ge = "bg-outline group-hover:bg-on-surface-variant group-active:bg-on-surface-variant peer-focus-visible:bg-on-surface-variant", _e = /* @__PURE__ */ m({
454
+ }, _e = "bg-outline group-hover:bg-on-surface-variant group-active:bg-on-surface-variant peer-focus-visible:bg-on-surface-variant", ve = /* @__PURE__ */ m({
446
455
  __name: "MSwitch",
447
456
  props: {
448
457
  modelValue: { type: Boolean },
@@ -499,14 +508,14 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
499
508
  onPointerup: b,
500
509
  onPointerleave: b,
501
510
  onPointercancel: b
502
- }, [d("span", $, [d("span", { class: _(["relative inline-flex h-8 w-[52px] items-center rounded-full border-2 transition-colors duration-200", e.modelValue ? a[e.color] : "border-outline bg-surface-container-highest"]) }, [
511
+ }, [d("span", me, [d("span", { class: _(["relative inline-flex h-8 w-[52px] items-center rounded-full border-2 transition-colors duration-200", e.modelValue ? a[e.color] : "border-outline bg-surface-container-highest"]) }, [
503
512
  d("input", {
504
513
  type: "checkbox",
505
514
  class: "peer sr-only",
506
515
  checked: e.modelValue,
507
516
  disabled: e.disabled,
508
517
  onChange: n[0] ||= (t) => r("update:modelValue", !e.modelValue)
509
- }, null, 40, me),
518
+ }, null, 40, he),
510
519
  e.disabled ? l("", !0) : (S(), u("span", {
511
520
  key: 0,
512
521
  class: _(["pointer-events-none absolute top-1/2 -left-1 h-10 w-10 -translate-y-1/2 rounded-full opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08] group-active:opacity-[0.12] peer-focus-visible:opacity-[0.08]", e.modelValue ? h[e.color] : "bg-on-surface-variant"]),
@@ -518,7 +527,7 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
518
527
  style: v(T.value)
519
528
  }, null, 4)),
520
529
  d("span", {
521
- class: _(["absolute left-1 top-1/2 flex h-6 w-6 items-center justify-center rounded-full will-change-transform", e.modelValue ? [f[e.color], "shadow-sm"] : ge]),
530
+ class: _(["absolute left-1 top-1/2 flex h-6 w-6 items-center justify-center rounded-full will-change-transform", e.modelValue ? [f[e.color], "shadow-sm"] : _e]),
522
531
  style: v(C.value)
523
532
  }, [p(o, {
524
533
  "enter-active-class": "transition-opacity duration-150 delay-[120ms]",
@@ -536,12 +545,12 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
536
545
  }, null, 8, ["class"])) : l("", !0)]),
537
546
  _: 1
538
547
  })], 6)
539
- ], 2)]), e.label ? (S(), u("span", he, k(e.label), 1)) : l("", !0)], 34));
548
+ ], 2)]), e.label ? (S(), u("span", ge, k(e.label), 1)) : l("", !0)], 34));
540
549
  }
541
- }), ve = { class: "min-w-0 flex-1" }, ye = {
550
+ }), ye = { class: "min-w-0 flex-1" }, be = {
542
551
  key: 0,
543
552
  class: "mli-expand-grid"
544
- }, be = { class: "mli-expand-body" }, xe = ["src"], Se = { class: "min-w-0 flex-1" }, Ce = 4, we = 8, Te = 16, Ee = /* @__PURE__ */ m({
553
+ }, xe = { class: "mli-expand-body" }, Se = ["src"], Ce = { class: "min-w-0 flex-1" }, we = 4, Te = 8, Ee = 16, De = /* @__PURE__ */ m({
545
554
  __name: "MListItem",
546
555
  props: {
547
556
  title: {},
@@ -602,14 +611,14 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
602
611
  r.disabled && "opacity-[0.38] pointer-events-none"
603
612
  ]), B = w(null), re = w(null), V = (e) => e && "$el" in e ? e.$el : e, H = w(!1), U = w(!1), W = w(!1), G = s(() => N.value ? y?.segmentPosition(V(B.value)) : void 0), ie = s(() => {
604
613
  if (M.value) return [];
605
- let e = x.value && !r.disabled, t = e && U.value || C.value || e && W.value ? Te : e && H.value ? we : null;
614
+ let e = x.value && !r.disabled, t = e && U.value || C.value || e && W.value ? Ee : e && H.value ? Te : null;
606
615
  if (t !== null) return [
607
616
  t,
608
617
  t,
609
618
  t,
610
619
  t
611
620
  ];
612
- let n = G.value, i = n === "first" || n === "single" ? Te : Ce, a = n === "last" || n === "single" ? Te : Ce;
621
+ let n = G.value, i = n === "first" || n === "single" ? Ee : we, a = n === "last" || n === "single" ? Ee : we;
613
622
  return [
614
623
  i,
615
624
  i,
@@ -677,7 +686,7 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
677
686
  size: 24,
678
687
  class: _(["shrink-0", L.value])
679
688
  }, null, 8, ["name", "class"])) : l("", !0)]),
680
- d("div", ve, [E(t.$slots, "overline", {}, () => [e.overline ? (S(), u("p", {
689
+ d("div", ye, [E(t.$slots, "overline", {}, () => [e.overline ? (S(), u("p", {
681
690
  key: 0,
682
691
  class: _(["truncate text-label-small", L.value])
683
692
  }, k(e.overline), 3)) : l("", !0)]), E(t.$slots, "default", {}, () => [d("p", { class: _(["truncate text-body-large", F.value]) }, k(e.title), 3), e.subtitle && b.value >= 2 ? (S(), u("p", {
@@ -690,7 +699,7 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
690
699
  class: _(["shrink-0", L.value])
691
700
  }, null, 8, ["name", "class"])
692
701
  ], 34), p(o, { name: "mli-expand" }, {
693
- default: ne(() => [v.value ? (S(), u("div", ye, [d("div", be, [E(t.$slots, "children")])])) : l("", !0)]),
702
+ default: ne(() => [v.value ? (S(), u("div", be, [d("div", xe, [E(t.$slots, "children")])])) : l("", !0)]),
694
703
  _: 3
695
704
  })], 512)) : (S(), c(D(ue.value), g({
696
705
  key: 1,
@@ -734,12 +743,12 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
734
743
  src: e.image,
735
744
  alt: "",
736
745
  class: "h-14 w-14 shrink-0 rounded-md object-cover"
737
- }, null, 8, xe)) : T.value === "checkbox" ? (S(), c(de, {
746
+ }, null, 8, Se)) : T.value === "checkbox" ? (S(), c(de, {
738
747
  key: 4,
739
748
  "model-value": C.value,
740
749
  class: "shrink-0"
741
750
  }, null, 8, ["model-value"])) : l("", !0)]),
742
- d("div", Se, [E(t.$slots, "overline", {}, () => [e.overline ? (S(), u("p", {
751
+ d("div", Ce, [E(t.$slots, "overline", {}, () => [e.overline ? (S(), u("p", {
743
752
  key: 0,
744
753
  class: _(["truncate text-label-small", L.value])
745
754
  }, k(e.overline), 3)) : l("", !0)]), E(t.$slots, "default", {}, () => [
@@ -761,7 +770,7 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
761
770
  }, null, 8, ["name", "class"])) : O.value === "text" ? (S(), u("span", {
762
771
  key: 1,
763
772
  class: _(["shrink-0 text-label-small", L.value])
764
- }, k(e.trailingText), 3)) : O.value === "switch" ? (S(), c(_e, {
773
+ }, k(e.trailingText), 3)) : O.value === "switch" ? (S(), c(ve, {
765
774
  key: 2,
766
775
  "model-value": !!e.trailingValue,
767
776
  "onUpdate:modelValue": X
@@ -774,22 +783,22 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
774
783
  _: 3
775
784
  }, 16, ["class"]));
776
785
  }
777
- }), De = {
786
+ }), Oe = {
778
787
  key: 0,
779
788
  class: "flex items-center justify-between"
780
- }, Oe = {
789
+ }, ke = {
781
790
  key: 0,
782
791
  class: "text-label-large text-on-surface"
783
- }, ke = {
792
+ }, Ae = {
784
793
  key: 1,
785
794
  class: "tabular-nums text-label-large text-on-surface-variant"
786
- }, Ae = [
795
+ }, je = [
787
796
  "aria-valuenow",
788
797
  "aria-valuemin",
789
798
  "aria-valuemax",
790
799
  "aria-disabled",
791
800
  "aria-orientation"
792
- ], je = "color-mix(in srgb, var(--color-on-surface) 38%, transparent)", Me = "color-mix(in srgb, var(--color-on-surface) 12%, transparent)", Ne = /* @__PURE__ */ m({
801
+ ], Me = "color-mix(in srgb, var(--color-on-surface) 38%, transparent)", Ne = "color-mix(in srgb, var(--color-on-surface) 12%, transparent)", Pe = /* @__PURE__ */ m({
793
802
  __name: "MSlider",
794
803
  props: {
795
804
  modelValue: {},
@@ -920,14 +929,14 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
920
929
  return P[n] ?? n;
921
930
  }
922
931
  let I = s(() => n.disabled ? {
923
- active: je,
924
- inactive: Me
932
+ active: Me,
933
+ inactive: Ne
925
934
  } : {
926
935
  active: F(n.fillColor, n.color),
927
936
  inactive: "var(--color-secondary-container)"
928
937
  }), L = s(() => n.disabled ? {
929
- active: je,
930
- inactive: Me
938
+ active: Me,
939
+ inactive: Ne
931
940
  } : {
932
941
  active: F(n.thumbColor, n.color),
933
942
  inactive: "var(--color-secondary-container)"
@@ -1076,7 +1085,7 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
1076
1085
  };
1077
1086
  }
1078
1087
  let _e = s(() => b.value ? `${x.value.lo} – ${x.value.hi}` : String(n.modelValue)), ve = s(() => b.value && typeof m.value == "number" ? n.modelValue[m.value] : n.modelValue), ye = s(() => b.value && typeof m.value == "number" ? C(n.modelValue[m.value]) : E.value);
1079
- return (t, n) => (S(), u("div", { class: _(["flex select-none", g.value ? "h-full flex-col items-center" : "flex-col gap-1"]) }, [e.label || e.showValue ? (S(), u("div", De, [e.label ? (S(), u("span", Oe, k(e.label), 1)) : l("", !0), e.showValue ? (S(), u("span", ke, k(_e.value), 1)) : l("", !0)])) : l("", !0), d("div", { class: _(["flex items-center", g.value ? "flex-1 flex-col" : ""]) }, [d("div", {
1088
+ return (t, n) => (S(), u("div", { class: _(["flex select-none", g.value ? "h-full flex-col items-center" : "flex-col gap-1"]) }, [e.label || e.showValue ? (S(), u("div", Oe, [e.label ? (S(), u("span", ke, k(e.label), 1)) : l("", !0), e.showValue ? (S(), u("span", Ae, k(_e.value), 1)) : l("", !0)])) : l("", !0), d("div", { class: _(["flex items-center", g.value ? "flex-1 flex-col" : ""]) }, [d("div", {
1080
1089
  ref_key: "trackEl",
1081
1090
  ref: f,
1082
1091
  role: "slider",
@@ -1393,10 +1402,10 @@ var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-mot
1393
1402
  }, k(ve.value), 5)) : l("", !0)]),
1394
1403
  _: 1
1395
1404
  })
1396
- ], 46, Ae)], 2)], 2));
1405
+ ], 46, je)], 2)], 2));
1397
1406
  }
1398
1407
  });
1399
1408
  //#endregion
1400
- export { Z as a, V as c, z as d, I as f, F as h, Q as i, H as l, N as m, Ee as n, de as o, P as p, _e as r, q as s, Ne as t, B as u };
1409
+ export { Q as a, q as c, B as d, z as f, F as g, N as h, $ as i, V as l, P as m, De as n, Z as o, I as p, ve as r, de as s, Pe as t, H as u };
1401
1410
 
1402
- //# sourceMappingURL=MSlider-BXsBv0ox.js.map
1411
+ //# sourceMappingURL=MSlider-LyH_gy8D.js.map