@m3ui-vue/m3ui-vue 1.2.2 → 1.3.1

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 (241) hide show
  1. package/dist/API.md +3010 -376
  2. package/dist/MButton-Bl_BSUep.js +172 -0
  3. package/dist/MButton-Bl_BSUep.js.map +1 -0
  4. package/dist/MDialog-D_Yik8ou.js +173 -0
  5. package/dist/MDialog-D_Yik8ou.js.map +1 -0
  6. package/dist/MIconButton-DoNotQ9v.js +282 -0
  7. package/dist/MIconButton-DoNotQ9v.js.map +1 -0
  8. package/dist/MListItem-BxifHJdU.js +824 -0
  9. package/dist/MListItem-BxifHJdU.js.map +1 -0
  10. package/dist/MLoadingIndicator-BxbFhSX6.js +115 -0
  11. package/dist/MLoadingIndicator-BxbFhSX6.js.map +1 -0
  12. package/dist/MMenuItem-Bih0h4-n.js +604 -0
  13. package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
  14. package/dist/MProgressBar-BCoruxA-.js +184 -0
  15. package/dist/MProgressBar-BCoruxA-.js.map +1 -0
  16. package/dist/MSeekBar-BeN9QcB3.js +435 -0
  17. package/dist/MSeekBar-BeN9QcB3.js.map +1 -0
  18. package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
  19. package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
  20. package/dist/MSlider-BVSbJlGS.js +691 -0
  21. package/dist/MSlider-BVSbJlGS.js.map +1 -0
  22. package/dist/MSpinner-C2SUnWk4.js +65 -0
  23. package/dist/MSpinner-C2SUnWk4.js.map +1 -0
  24. package/dist/MTextField-CEkWSZ2v.js +296 -0
  25. package/dist/MTextField-CEkWSZ2v.js.map +1 -0
  26. package/dist/MTooltip-CodJGEO-.js +756 -0
  27. package/dist/MTooltip-CodJGEO-.js.map +1 -0
  28. package/dist/_storageKeys-CYXsUBwK.js +18 -0
  29. package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
  30. package/dist/_useEscapeStack-CjndQhqg.js +19 -0
  31. package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
  32. package/dist/api.json +1 -1
  33. package/dist/chart.js +1 -1
  34. package/dist/code-editor.js +1 -1
  35. package/dist/components/MAudioPlayer.vue.d.ts +115 -0
  36. package/dist/components/MBadge.vue.d.ts +1 -1
  37. package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
  38. package/dist/components/MBox.vue.d.ts +1 -1
  39. package/dist/components/MButton.vue.d.ts +1 -1
  40. package/dist/components/MConfirmDialog.vue.d.ts +1 -1
  41. package/dist/components/MCopyButton.vue.d.ts +2 -2
  42. package/dist/components/MDataTable.vue.d.ts +2 -2
  43. package/dist/components/MDialog.vue.d.ts +2 -2
  44. package/dist/components/MDivider.vue.d.ts +1 -1
  45. package/dist/components/MDragHandle.vue.d.ts +1 -1
  46. package/dist/components/MDrawCanvas.vue.d.ts +150 -0
  47. package/dist/components/MDrawLayers.vue.d.ts +3 -0
  48. package/dist/components/MDrawToolbar.vue.d.ts +34 -0
  49. package/dist/components/MExportButton.vue.d.ts +1 -1
  50. package/dist/components/MFab.vue.d.ts +2 -2
  51. package/dist/components/MFabMenu.vue.d.ts +2 -2
  52. package/dist/components/MFixed.vue.d.ts +1 -1
  53. package/dist/components/MFlex.vue.d.ts +2 -2
  54. package/dist/components/MFloorPlan.vue.d.ts +248 -0
  55. package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
  56. package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
  57. package/dist/components/MFlow.vue.d.ts +318 -0
  58. package/dist/components/MFlowControls.vue.d.ts +33 -0
  59. package/dist/components/MFlowHandle.vue.d.ts +16 -0
  60. package/dist/components/MFlowMinimap.vue.d.ts +22 -0
  61. package/dist/components/MFlowNode.vue.d.ts +35 -0
  62. package/dist/components/MGantt.vue.d.ts +141 -0
  63. package/dist/components/MGanttControls.vue.d.ts +32 -0
  64. package/dist/components/MIconButton.vue.d.ts +3 -1
  65. package/dist/components/MImageCropper.vue.d.ts +110 -0
  66. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  67. package/dist/components/MLightbox.vue.d.ts +2 -2
  68. package/dist/components/MList.vue.d.ts +1 -1
  69. package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
  70. package/dist/components/MMapControl.vue.d.ts +1 -1
  71. package/dist/components/MMapSearch.vue.d.ts +1 -1
  72. package/dist/components/MMaskField.vue.d.ts +12 -1
  73. package/dist/components/MMenu.vue.d.ts +1 -1
  74. package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
  75. package/dist/components/MNumberField.vue.d.ts +11 -2
  76. package/dist/components/MPdfViewer.vue.d.ts +174 -0
  77. package/dist/components/MPullToRefresh.vue.d.ts +1 -1
  78. package/dist/components/MResourceTimeline.vue.d.ts +149 -0
  79. package/dist/components/MScheduler.vue.d.ts +3 -3
  80. package/dist/components/MScheme.vue.d.ts +1 -1
  81. package/dist/components/MSearchField.vue.d.ts +1 -1
  82. package/dist/components/MSeekBar.vue.d.ts +1 -1
  83. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  84. package/dist/components/MSkeleton.vue.d.ts +1 -1
  85. package/dist/components/MSlider.vue.d.ts +2 -2
  86. package/dist/components/MSparkline.vue.d.ts +1 -1
  87. package/dist/components/MSplitter.vue.d.ts +1 -1
  88. package/dist/components/MStack.vue.d.ts +2 -2
  89. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  90. package/dist/components/MSwitch.vue.d.ts +1 -1
  91. package/dist/components/MTable.vue.d.ts +1 -1
  92. package/dist/components/MTagInput.vue.d.ts +12 -1
  93. package/dist/components/MTextField.vue.d.ts +13 -2
  94. package/dist/components/MToolbar.vue.d.ts +1 -1
  95. package/dist/components/MTree.vue.d.ts +2 -2
  96. package/dist/components/MVideoPlayer.vue.d.ts +253 -0
  97. package/dist/components/MVirtualTable.vue.d.ts +1 -1
  98. package/dist/components/MWindow.vue.d.ts +3 -3
  99. package/dist/components/_MFlowEdge.vue.d.ts +9 -0
  100. package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
  101. package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
  102. package/dist/components/_MPdfPage.vue.d.ts +76 -0
  103. package/dist/components/_MTimeBackground.vue.d.ts +14 -0
  104. package/dist/components/_MTimeHeader.vue.d.ts +20 -0
  105. package/dist/composables/_flowPanel.d.ts +2 -0
  106. package/dist/composables/_flowSlot.d.ts +5 -0
  107. package/dist/composables/_ganttTime.d.ts +41 -0
  108. package/dist/composables/_useTimeAxis.d.ts +90 -0
  109. package/dist/composables/drawGeometry.d.ts +119 -0
  110. package/dist/composables/flowFormats.d.ts +79 -0
  111. package/dist/composables/flowLayout.d.ts +45 -0
  112. package/dist/composables/flowPaths.d.ts +53 -0
  113. package/dist/composables/ganttFormats.d.ts +52 -0
  114. package/dist/composables/ganttSchedule.d.ts +99 -0
  115. package/dist/composables/useDrawing.d.ts +44 -0
  116. package/dist/composables/useFloorPlan.d.ts +58 -0
  117. package/dist/composables/useFlow.d.ts +266 -0
  118. package/dist/composables/useGantt.d.ts +87 -0
  119. package/dist/composables/useLocale.d.ts +204 -0
  120. package/dist/composables/useMediaPlayer.d.ts +101 -0
  121. package/dist/composables/usePdf.d.ts +119 -0
  122. package/dist/composables/useResourceTimeline.d.ts +70 -0
  123. package/dist/draw.d.ts +7 -0
  124. package/dist/draw.js +1702 -0
  125. package/dist/draw.js.map +1 -0
  126. package/dist/flow.d.ts +14 -0
  127. package/dist/flow.js +3547 -0
  128. package/dist/flow.js.map +1 -0
  129. package/dist/flowPaths-CUc6X373.js +161 -0
  130. package/dist/flowPaths-CUc6X373.js.map +1 -0
  131. package/dist/gantt.d.ts +12 -0
  132. package/dist/gantt.js +3575 -0
  133. package/dist/gantt.js.map +1 -0
  134. package/dist/index.d.ts +9 -0
  135. package/dist/locales/index.js +1435 -7
  136. package/dist/locales/index.js.map +1 -1
  137. package/dist/m3ui-vue.css +1 -1
  138. package/dist/m3ui.js +8248 -7637
  139. package/dist/m3ui.js.map +1 -1
  140. package/dist/map.js +113 -108
  141. package/dist/map.js.map +1 -1
  142. package/dist/media.d.ts +5 -0
  143. package/dist/media.js +1311 -0
  144. package/dist/media.js.map +1 -0
  145. package/dist/pdf.d.ts +4 -0
  146. package/dist/pdf.js +1871 -0
  147. package/dist/pdf.js.map +1 -0
  148. package/dist/rich-text-editor.js +28 -26
  149. package/dist/rich-text-editor.js.map +1 -1
  150. package/dist/styles.css +1 -1
  151. package/dist/{useLocale-JYxDDeXC.js → useLocale-CaWwi-b6.js} +206 -2
  152. package/dist/useLocale-CaWwi-b6.js.map +1 -0
  153. package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
  154. package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
  155. package/package.json +29 -5
  156. package/src/__tests__/MAudioPlayer.test.ts +75 -0
  157. package/src/__tests__/MDrawCanvas.test.ts +118 -0
  158. package/src/__tests__/MFloorPlan.test.ts +299 -0
  159. package/src/__tests__/MFlow.test.ts +590 -0
  160. package/src/__tests__/MGantt.test.ts +130 -0
  161. package/src/__tests__/MImageCropper.test.ts +89 -0
  162. package/src/__tests__/MPdfViewer.test.ts +235 -0
  163. package/src/__tests__/MResourceTimeline.test.ts +102 -0
  164. package/src/__tests__/MVideoPlayer.test.ts +201 -0
  165. package/src/__tests__/drawGeometry.test.ts +58 -0
  166. package/src/__tests__/fieldExpose.test.ts +30 -0
  167. package/src/__tests__/flowFormats.test.ts +185 -0
  168. package/src/__tests__/flowLayout.test.ts +113 -0
  169. package/src/__tests__/ganttFormats.test.ts +76 -0
  170. package/src/__tests__/ganttSchedule.test.ts +136 -0
  171. package/src/__tests__/pdfMock.ts +83 -0
  172. package/src/__tests__/useMediaPlayer.test.ts +182 -0
  173. package/src/__tests__/usePdf.test.ts +102 -0
  174. package/src/components/MAudioPlayer.vue +319 -0
  175. package/src/components/MDrawCanvas.vue +819 -0
  176. package/src/components/MDrawLayers.vue +114 -0
  177. package/src/components/MDrawToolbar.vue +171 -0
  178. package/src/components/MFloorPlan.vue +1080 -0
  179. package/src/components/MFloorPlanInspector.vue +169 -0
  180. package/src/components/MFloorPlanToolbar.vue +128 -0
  181. package/src/components/MFlow.vue +2060 -0
  182. package/src/components/MFlowControls.vue +110 -0
  183. package/src/components/MFlowHandle.vue +60 -0
  184. package/src/components/MFlowMinimap.vue +134 -0
  185. package/src/components/MFlowNode.vue +98 -0
  186. package/src/components/MGantt.vue +1609 -0
  187. package/src/components/MGanttControls.vue +77 -0
  188. package/src/components/MIconButton.vue +3 -1
  189. package/src/components/MImageCropper.vue +507 -0
  190. package/src/components/MMaskField.vue +13 -0
  191. package/src/components/MNumberField.vue +13 -0
  192. package/src/components/MPdfViewer.vue +1270 -0
  193. package/src/components/MResourceTimeline.vue +1020 -0
  194. package/src/components/MTagInput.vue +13 -0
  195. package/src/components/MTextField.vue +16 -0
  196. package/src/components/MVideoPlayer.vue +839 -0
  197. package/src/components/_MFlowEdge.vue +100 -0
  198. package/src/components/_MFlowEdgeLabel.vue +56 -0
  199. package/src/components/_MFlowNodeShell.vue +111 -0
  200. package/src/components/_MPdfPage.vue +456 -0
  201. package/src/components/_MTimeBackground.vue +16 -0
  202. package/src/components/_MTimeHeader.vue +31 -0
  203. package/src/composables/_flowPanel.ts +13 -0
  204. package/src/composables/_flowSlot.ts +6 -0
  205. package/src/composables/_ganttTime.ts +200 -0
  206. package/src/composables/_useTimeAxis.ts +224 -0
  207. package/src/composables/drawGeometry.ts +405 -0
  208. package/src/composables/flowFormats.ts +916 -0
  209. package/src/composables/flowLayout.ts +297 -0
  210. package/src/composables/flowPaths.ts +239 -0
  211. package/src/composables/ganttFormats.ts +366 -0
  212. package/src/composables/ganttSchedule.ts +403 -0
  213. package/src/composables/useDrawing.ts +53 -0
  214. package/src/composables/useFloorPlan.ts +73 -0
  215. package/src/composables/useFlow.ts +250 -0
  216. package/src/composables/useGantt.ts +92 -0
  217. package/src/composables/useLocale.ts +410 -0
  218. package/src/composables/useMediaPlayer.ts +406 -0
  219. package/src/composables/usePdf.ts +456 -0
  220. package/src/composables/useResourceTimeline.ts +76 -0
  221. package/src/draw.ts +25 -0
  222. package/src/flow.ts +26 -0
  223. package/src/gantt.ts +12 -0
  224. package/src/index.ts +9 -0
  225. package/src/locales/de.ts +204 -0
  226. package/src/locales/es.ts +204 -0
  227. package/src/locales/fr.ts +204 -0
  228. package/src/locales/ja.ts +204 -0
  229. package/src/locales/ko.ts +204 -0
  230. package/src/locales/pt.ts +204 -0
  231. package/src/locales/zh.ts +204 -0
  232. package/src/media.ts +5 -0
  233. package/src/pdf.ts +15 -0
  234. package/dist/MMenuItem-D4Gx_l3F.js +0 -929
  235. package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
  236. package/dist/MSlider-Dx_S3vJ9.js +0 -1506
  237. package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
  238. package/dist/MTextField-Bz8JIsnl.js +0 -633
  239. package/dist/MTextField-Bz8JIsnl.js.map +0 -1
  240. package/dist/useLocale-JYxDDeXC.js.map +0 -1
  241. package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
@@ -0,0 +1,604 @@
1
+ import { a as e, f as t, i as n, l as r, s as i, u as a } from "./MIconButton-DoNotQ9v.js";
2
+ import { i as o } from "./motion-DZiXG09o.js";
3
+ import { t as s } from "./MIcon-Bxh9j135.js";
4
+ import { t as c } from "./_useEscapeStack-CjndQhqg.js";
5
+ import { Fragment as l, Teleport as u, Transition as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, inject as ee, mergeProps as y, nextTick as b, normalizeClass as x, normalizeStyle as S, onMounted as te, onUnmounted as ne, openBlock as C, provide as w, ref as T, renderList as E, renderSlot as D, resolveDynamicComponent as O, toDisplayString as k, unref as A, useSlots as re, watch as ie, withCtx as ae } from "vue";
6
+ //#region src/components/MMenuDivider.vue?vue&type=script&setup=true&lang.ts
7
+ var j = { class: "my-1 border-outline-variant" }, M = /* @__PURE__ */ v({
8
+ __name: "MMenuDivider",
9
+ props: { gap: {
10
+ type: Boolean,
11
+ default: !1
12
+ } },
13
+ setup(e) {
14
+ return (e, t) => (C(), h("hr", j));
15
+ }
16
+ }), oe = 30, se = 380, N = 8, ce = 1 / 3, P = .5;
17
+ function le(e) {
18
+ let n = T([]), i = f(() => n.value[n.value.length - 1]), s = T("forward"), c = T(), l = 0, u = 1;
19
+ function d(e, t) {
20
+ let n = s.value === "forward" ? 1 : -1, r = e.animate([{
21
+ transform: `translateX(${n * oe}px)`,
22
+ opacity: 0
23
+ }, {
24
+ transform: "translateX(0)",
25
+ opacity: 1
26
+ }], {
27
+ duration: 300,
28
+ delay: 60,
29
+ easing: "cubic-bezier(0.05,0.7,0.1,1)",
30
+ fill: "backwards"
31
+ });
32
+ r.onfinish = t;
33
+ }
34
+ function p(e, t) {
35
+ let n = s.value === "forward" ? -1 : 1, r = e;
36
+ r.style.position = "absolute", r.style.insetInline = "0", r.style.top = "0";
37
+ let i = l, a = u;
38
+ l = 0, u = 1;
39
+ let o = r.animate([{
40
+ transform: `translateX(${i}px)`,
41
+ opacity: a
42
+ }, {
43
+ transform: `translateX(${i + n * oe}px)`,
44
+ opacity: 0
45
+ }], {
46
+ duration: 90,
47
+ easing: "cubic-bezier(0.3,0,0.8,0.15)",
48
+ fill: "forwards"
49
+ });
50
+ o.onfinish = t;
51
+ }
52
+ function m(e) {
53
+ let n = c.value, i = n?.offsetHeight ?? 0, s = n?.style.overflowY ?? "";
54
+ n && (n.style.overflowY = "hidden");
55
+ let l = () => {
56
+ n && (n.style.overflowY = s);
57
+ };
58
+ if (e(), !n || a()) return l();
59
+ b(() => {
60
+ let e = n.offsetHeight, a = Math.abs(e - i) < 1 ? null : r(n, t(i, e, 0, o.standard.defaultSpatial, .5), (e) => ({ height: `${e}px` })), s = new Promise((e) => setTimeout(e, se));
61
+ Promise.all([s, a?.finished.catch(() => {})]).then(l);
62
+ });
63
+ }
64
+ function h(t) {
65
+ s.value = "forward", m(() => n.value.push(t)), b(e);
66
+ }
67
+ function g() {
68
+ s.value = "backward", m(() => n.value.pop()), b(e);
69
+ }
70
+ function _() {
71
+ n.value = [];
72
+ }
73
+ let v = null;
74
+ function ee() {
75
+ return c.value?.querySelector(`:scope > [data-menu-level="${n.value.length}"]`) ?? null;
76
+ }
77
+ function y(e) {
78
+ if (e.pointerType !== "touch" || !n.value.length || v) return;
79
+ let t = ee();
80
+ t && (v = {
81
+ id: e.pointerId,
82
+ x: e.clientX,
83
+ y: e.clientY,
84
+ level: t,
85
+ width: c.value.clientWidth,
86
+ active: !1,
87
+ lastX: e.clientX,
88
+ lastT: e.timeStamp,
89
+ vel: 0
90
+ }, window.addEventListener("pointermove", S), window.addEventListener("pointerup", te), window.addEventListener("pointercancel", C));
91
+ }
92
+ function x(e) {
93
+ v && (v.level.style.transform = `translateX(${e}px)`, v.level.style.opacity = String(1 - .5 * Math.min(1, e / v.width)));
94
+ }
95
+ function S(e) {
96
+ if (!v || e.pointerId !== v.id) return;
97
+ let t = e.clientX - v.x, n = e.clientY - v.y;
98
+ if (!v.active) {
99
+ if (Math.hypot(t, n) < N) return;
100
+ if (Math.abs(n) > Math.abs(t) || t < 0) return k();
101
+ v.active = !0, v.x = e.clientX, v.level.getAnimations().forEach((e) => e.finish());
102
+ }
103
+ let r = e.timeStamp - v.lastT;
104
+ r > 0 && (v.vel = .8 * ((e.clientX - v.lastX) / r) + .2 * v.vel), v.lastX = e.clientX, v.lastT = e.timeStamp, x(Math.max(0, e.clientX - v.x));
105
+ }
106
+ function te(e) {
107
+ if (!v || e.pointerId !== v.id) return;
108
+ let t = v;
109
+ if (k(), !t.active) return;
110
+ window.addEventListener("click", O, {
111
+ capture: !0,
112
+ once: !0
113
+ }), clearTimeout(E), E = setTimeout(D, 400);
114
+ let n = Math.max(0, e.clientX - t.x);
115
+ n > t.width * ce || t.vel > P ? (l = n, u = Number(t.level.style.opacity || 1), g()) : w(t.level, n);
116
+ }
117
+ function C(e) {
118
+ if (!v || e.pointerId !== v.id) return;
119
+ let t = v;
120
+ k(), t.active && w(t.level, Math.max(0, t.lastX - t.x));
121
+ }
122
+ function w(e, n) {
123
+ if (e.style.transform = "", e.style.opacity = "", a() || n < 1) return;
124
+ let i = c.value?.clientWidth || 1;
125
+ r(e, t(n, 0, 0, o.standard.defaultSpatial, .5), (e) => ({
126
+ transform: `translateX(${e}px)`,
127
+ opacity: String(1 - .5 * Math.min(1, e / i))
128
+ }));
129
+ }
130
+ let E;
131
+ function D() {
132
+ clearTimeout(E), window.removeEventListener("click", O, { capture: !0 });
133
+ }
134
+ function O(e) {
135
+ e.stopPropagation(), e.preventDefault();
136
+ }
137
+ function k() {
138
+ v = null, window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", te), window.removeEventListener("pointercancel", C);
139
+ }
140
+ return ne(() => {
141
+ k(), D();
142
+ }), {
143
+ navStack: n,
144
+ currentNav: i,
145
+ navBox: c,
146
+ navSlideEnter: d,
147
+ navSlideLeave: p,
148
+ pushNav: h,
149
+ popNav: g,
150
+ resetNav: _,
151
+ onNavPointerDown: y
152
+ };
153
+ }
154
+ function F(e, t, n, r = 8) {
155
+ for (let i of e) if (i >= r && i + t <= n - r) return i;
156
+ if (t >= n - 2 * r) return (n - t) / 2;
157
+ let i = e[e.length - 1] ?? r;
158
+ return Math.min(n - r - t, Math.max(r, i));
159
+ }
160
+ function I(e, t, n, r, i = 8) {
161
+ let a = e.left, o = e.right - t, s = (e.left + e.right) / 2 < n / 2 ? i : n - i - t;
162
+ return F(r === "start" ? [
163
+ a,
164
+ o,
165
+ s
166
+ ] : [
167
+ o,
168
+ a,
169
+ s
170
+ ], t, n, i);
171
+ }
172
+ //#endregion
173
+ //#region src/components/MMenu.vue?vue&type=script&setup=true&lang.ts
174
+ var L = ["data-menu-level"], R = { class: "flex-1 truncate" }, z = { key: "root" }, B = {
175
+ key: 0,
176
+ class: "flex flex-col gap-1 px-1.5"
177
+ }, V = { class: "overflow-hidden rounded-lg bg-surface-container" }, H = 1 / 240, U = /* @__PURE__ */ v({
178
+ inheritAttrs: !1,
179
+ __name: "MMenu",
180
+ props: {
181
+ align: { default: "right" },
182
+ submenuMode: { default: "flyout" },
183
+ variant: { default: "standard" }
184
+ },
185
+ setup(e, { expose: t }) {
186
+ let n = e, r = re();
187
+ function i(e) {
188
+ let t = [];
189
+ for (let n of e) n.type === l && Array.isArray(n.children) ? t.push(...i(n.children)) : t.push(n);
190
+ return t;
191
+ }
192
+ function a(e) {
193
+ if (e.type !== M) return !1;
194
+ let t = e.props?.gap;
195
+ return t === "" || t === !0 || t === "true";
196
+ }
197
+ let o = f(() => {
198
+ if (n.variant !== "expressive") return null;
199
+ let e = i(r.default?.({ close: $ }) ?? []), t = [[]];
200
+ for (let n of e) a(n) ? t.push([]) : t[t.length - 1].push(n);
201
+ return t.filter((e) => e.length > 0);
202
+ }), v = f(() => !!o.value && o.value.length > 1), { navStack: k, currentNav: j, navBox: oe, navSlideEnter: se, navSlideLeave: N, pushNav: ce, popNav: P, onNavPointerDown: F } = le(() => be()), U = null;
203
+ function ue() {
204
+ if (U) return U;
205
+ let e = [], t = .8, n = 0, r = 0, i = 0;
206
+ for (let a = 0; a < 1 && (e.push({
207
+ scale: t,
208
+ alpha: r
209
+ }), n += (-1400 * (t - 1) - 1.8 * Math.sqrt(1400) * n) * H, t += n * H, i += (-3800 * (r - 1) - 2 * Math.sqrt(3800) * i) * H, r += i * H, !(Math.abs(t - 1) < .003 && Math.abs(r - 1) < .003)); a += H);
210
+ return e.push({
211
+ scale: 1,
212
+ alpha: 1
213
+ }), U = e, e;
214
+ }
215
+ let de = 0, W = null, G = null;
216
+ function fe(e, t, n) {
217
+ W?.();
218
+ let r = e, i = ue(), a = i.length - 1, o = Math.round(Math.max(0, Math.min(a, de))), s = n ? a : 0, c = n ? 1 : -1, l = [];
219
+ for (let e = o; n ? e <= s : e >= s; e += c) l.push(i[e]);
220
+ let u = (e) => ({
221
+ transform: `scale(${e.scale})`,
222
+ opacity: String(Math.min(1, Math.max(0, e.alpha)))
223
+ });
224
+ Object.assign(r.style, u(i[s]));
225
+ let d = !1;
226
+ function f() {
227
+ d || (d = !0, de = s, W = null, G = null, t());
228
+ }
229
+ if (l.length < 2 || typeof r.animate != "function") return f();
230
+ let p = r.animate(l.map(u), {
231
+ duration: (l.length - 1) * H * 1e3,
232
+ easing: "linear"
233
+ });
234
+ p.finished.catch(() => {}), p.onfinish = f, W = () => {
235
+ let e = Number(p.currentTime ?? 0) / (H * 1e3);
236
+ de = Math.max(0, Math.min(a, o + c * e)), d = !0, p.cancel();
237
+ }, G = n ? null : () => {
238
+ W?.(), W = null, G = null, t();
239
+ };
240
+ }
241
+ function pe(e, t) {
242
+ ve(e), fe(e, t, !0);
243
+ }
244
+ function me(e, t) {
245
+ fe(e, t, !1);
246
+ }
247
+ let K = T(!1), q = T(null), J = T(null), Y = T({}), X = ee("m-menu-panel-registry", /* @__PURE__ */ new Set());
248
+ w("m-menu-panel-registry", X), ie(J, (e, t) => {
249
+ t && X.delete(t), e && X.add(e);
250
+ }), ne(() => {
251
+ J.value && X.delete(J.value);
252
+ });
253
+ let Z = ee("m-menu-sibling-group", null);
254
+ w("m-menu-sibling-group", { current: null });
255
+ let Q = null, he = T(!1);
256
+ function ge() {
257
+ if (!q.value) return;
258
+ let e = q.value.getBoundingClientRect();
259
+ Q = e;
260
+ let t = window.innerHeight - e.bottom - 8;
261
+ he.value = t < 200 && e.top > t;
262
+ let n = {
263
+ maxHeight: `${Math.min(he.value ? e.top - 12 : t, 400)}px`,
264
+ maxWidth: `${window.innerWidth - 16}px`,
265
+ left: "0px"
266
+ };
267
+ he.value ? n.bottom = `${window.innerHeight - e.top + 4}px` : n.top = `${e.bottom + 4}px`, Y.value = n;
268
+ }
269
+ let _e = T(n.align === "right" ? "right" : "left");
270
+ function ve(e) {
271
+ if (!Q) return;
272
+ let t = e.offsetWidth, r = I(Q, t, window.innerWidth, n.align === "right" ? "end" : "start"), i = Math.min(t, Math.max(0, (Q.left + Q.right) / 2 - r)), a = Math.abs(r - Q.left) < 1 ? "left" : Math.abs(r + t - Q.right) < 1 ? "right" : `${i}px`;
273
+ _e.value = a, Y.value = {
274
+ ...Y.value,
275
+ left: `${r}px`
276
+ }, e.style.left = `${r}px`, e.style.transformOrigin = `${a} ${he.value ? "bottom" : "top"}`;
277
+ }
278
+ function ye() {
279
+ return J.value ? Array.from(J.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
280
+ }
281
+ function be() {
282
+ b(() => ye()[0]?.focus());
283
+ }
284
+ function xe(e) {
285
+ let t = ye();
286
+ if (!t.length) return;
287
+ let n = t.indexOf(document.activeElement);
288
+ (n === -1 ? e === 1 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length])?.focus();
289
+ }
290
+ function Se() {
291
+ K.value ? Z?.current === $ && (Z.current = null) : (Z && Z.current && Z.current !== $ && Z.current(), Z && (Z.current = $), ge(), k.value = []), K.value = !K.value, K.value && be();
292
+ }
293
+ function $() {
294
+ Z?.current === $ && (Z.current = null), K.value = !1;
295
+ }
296
+ w("m-menu-close", $), w("m-menu-nav", {
297
+ mode: n.submenuMode,
298
+ push: ce
299
+ }), t({
300
+ close: $,
301
+ open: K
302
+ });
303
+ function Ce(e) {
304
+ let t = e.target;
305
+ if (!q.value?.contains(t)) {
306
+ for (let e of X) if (e.contains(t)) return;
307
+ t.closest?.(".m3-submenu") || $();
308
+ }
309
+ }
310
+ function we(e) {
311
+ if (!K.value) return;
312
+ let t = e.target;
313
+ for (let e of X) if (e.contains(t)) return;
314
+ t.closest?.(".m3-submenu") || $();
315
+ }
316
+ c(() => K.value, () => k.value.length ? P() : $());
317
+ function Te(e) {
318
+ K.value && (e.key === "ArrowDown" ? (e.preventDefault(), xe(1)) : e.key === "ArrowUp" && (e.preventDefault(), xe(-1)));
319
+ }
320
+ te(() => {
321
+ document.addEventListener("mousedown", Ce), document.addEventListener("keydown", Te), window.addEventListener("scroll", we, !0);
322
+ }), ne(() => {
323
+ document.removeEventListener("mousedown", Ce), document.removeEventListener("keydown", Te), window.removeEventListener("scroll", we, !0), G ? G() : W?.();
324
+ });
325
+ let Ee = f(() => `${_e.value} ${he.value ? "bottom" : "top"}`);
326
+ return (t, n) => (C(), h(l, null, [g("div", y({
327
+ ref_key: "triggerEl",
328
+ ref: q
329
+ }, t.$attrs, {
330
+ class: "inline-block",
331
+ onClick: Se
332
+ }), [D(t.$slots, "trigger", { open: K.value })], 16), (C(), p(u, { to: "body" }, [_(d, {
333
+ css: !1,
334
+ onEnter: pe,
335
+ onLeave: me
336
+ }, {
337
+ default: ae(() => [K.value ? (C(), h("div", {
338
+ key: 0,
339
+ ref_key: "dropdownEl",
340
+ ref: J,
341
+ class: x(["fixed z-500 min-w-48", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", v.value ? "" : "shadow-elevation-2"]]),
342
+ style: S({
343
+ ...Y.value,
344
+ transformOrigin: Ee.value
345
+ })
346
+ }, [g("div", { class: x(["overflow-hidden", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", v.value ? "" : "bg-surface-container"]]) }, [g("div", {
347
+ ref_key: "navBox",
348
+ ref: oe,
349
+ class: "relative overflow-x-hidden overflow-y-auto overscroll-contain py-1",
350
+ style: S({
351
+ maxHeight: Y.value.maxHeight,
352
+ touchAction: A(j) ? "pan-y" : void 0
353
+ }),
354
+ onPointerdown: n[1] ||= (...e) => A(F) && A(F)(...e)
355
+ }, [_(d, {
356
+ css: !1,
357
+ onEnter: A(se),
358
+ onLeave: A(N)
359
+ }, {
360
+ default: ae(() => [A(j) ? (C(), h("div", {
361
+ key: A(k).length,
362
+ "data-menu-level": A(k).length
363
+ }, [
364
+ g("button", {
365
+ type: "button",
366
+ class: "flex w-full items-center gap-3 px-4 py-2.5 text-left text-label-large text-on-surface-variant outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary",
367
+ onClick: n[0] ||= (...e) => A(P) && A(P)(...e)
368
+ }, [_(s, {
369
+ name: "arrow_back",
370
+ size: 20,
371
+ class: "shrink-0"
372
+ }), g("span", R, [(C(), p(O(() => A(j)?.header?.())))])]),
373
+ n[2] ||= g("hr", { class: "my-1 border-outline-variant" }, null, -1),
374
+ (C(), p(O(() => A(j)?.content?.())))
375
+ ], 8, L)) : (C(), h("div", z, [v.value ? (C(), h("div", B, [(C(!0), h(l, null, E(o.value, (e, t) => (C(), h("div", {
376
+ key: t,
377
+ class: "rounded-lg shadow-elevation-2"
378
+ }, [g("div", V, [(C(), p(O(() => e)))])]))), 128))])) : D(t.$slots, "default", { close: $ }, void 0, void 0, 1)]))]),
379
+ _: 3
380
+ }, 8, ["onEnter", "onLeave"])], 36)], 2)], 6)) : m("", !0)]),
381
+ _: 3
382
+ })]))], 64));
383
+ }
384
+ }), ue = ["data-m3-menu-choice"], de = { class: "flex-1" }, W = {
385
+ key: 3,
386
+ class: "ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60"
387
+ }, G = { class: "overflow-hidden rounded-xs bg-surface-container py-1" }, fe = 32, pe = /* @__PURE__ */ v({
388
+ __name: "MMenuItem",
389
+ props: {
390
+ icon: {},
391
+ shortcut: {},
392
+ to: {},
393
+ disabled: {
394
+ type: Boolean,
395
+ default: !1
396
+ },
397
+ danger: {
398
+ type: Boolean,
399
+ default: !1
400
+ },
401
+ keepOpen: {
402
+ type: Boolean,
403
+ default: void 0
404
+ },
405
+ selected: {
406
+ type: Boolean,
407
+ default: void 0
408
+ },
409
+ checked: {
410
+ type: Boolean,
411
+ default: void 0
412
+ },
413
+ selectedIcon: {}
414
+ },
415
+ emits: ["click", "update:checked"],
416
+ setup(t, { emit: r }) {
417
+ let a = t, o = r, c = re(), l = f(() => a.checked !== void 0), v = f(() => l.value || a.selected !== void 0), y = f(() => !!(a.checked ?? a.selected)), w = f(() => v.value && !a.icon && !c.icon), E = f(() => a.selectedIcon ?? (a.icon ? void 0 : "check")), j = T("single");
418
+ function M() {
419
+ let e = L.value;
420
+ if (!e || !v.value) return;
421
+ let t = (e) => !!e?.hasAttribute("data-m3-menu-choice"), n = t(e.previousElementSibling), r = t(e.nextElementSibling);
422
+ j.value = n && r ? "middle" : n ? "last" : r ? "first" : "single";
423
+ }
424
+ function oe() {
425
+ if (y.value) return [
426
+ 12,
427
+ 12,
428
+ 12,
429
+ 12
430
+ ];
431
+ let e = j.value === "first" ? 12 : 4, t = j.value === "last" ? 12 : 4;
432
+ return [
433
+ e,
434
+ e,
435
+ t,
436
+ t
437
+ ];
438
+ }
439
+ let { snap: se } = i(() => v.value ? [...oe(), w.value && y.value ? fe : 0] : [], ([e, t, n, r, i]) => {
440
+ let a = R.value instanceof HTMLElement ? R.value : R.value?.$el;
441
+ a && r !== void 0 && (a.style.borderRadius = `${e}px ${t}px ${n}px ${r}px`), z.value && i !== void 0 && (z.value.style.width = `${i}px`);
442
+ }, e);
443
+ ie(j, () => se());
444
+ let N = null;
445
+ te(() => {
446
+ M();
447
+ let e = L.value?.parentElement;
448
+ e && (N = new MutationObserver(M), N.observe(e, { childList: !0 }));
449
+ }), ne(() => N?.disconnect()), ie(v, () => b(M)), i(() => w.value ? [+!!y.value] : [], ([e]) => {
450
+ z.value && e !== void 0 && (z.value.style.opacity = String(e));
451
+ }, n);
452
+ let ce = f(() => a.to ? "RouterLink" : "button"), P = f(() => !!c.children), le = ee("m-menu-close", null), I = ee("m-menu-nav", null), L = T(), R = T(), z = T(), B = T(!1), V = T({});
453
+ function H() {
454
+ if (!L.value) return;
455
+ let e = L.value.getBoundingClientRect();
456
+ V.value = {
457
+ position: "fixed",
458
+ top: `${e.top}px`,
459
+ left: `${e.right}px`,
460
+ maxWidth: `${window.innerWidth - 16}px`,
461
+ zIndex: "501"
462
+ };
463
+ }
464
+ function U(e) {
465
+ if (!L.value) return;
466
+ let t = e, n = L.value.getBoundingClientRect();
467
+ t.style.left = "0px";
468
+ let r = t.offsetWidth, i = t.offsetHeight, a = F([n.right, n.left - r], r, window.innerWidth), o = F([n.top, n.bottom - i], i, window.innerHeight);
469
+ V.value = {
470
+ ...V.value,
471
+ left: `${a}px`,
472
+ top: `${o}px`
473
+ }, t.style.left = `${a}px`, t.style.top = `${o}px`;
474
+ }
475
+ function pe() {
476
+ if (B.value) {
477
+ B.value = !1;
478
+ return;
479
+ }
480
+ H(), B.value = !0;
481
+ }
482
+ function me() {
483
+ if (!a.disabled) {
484
+ if (P.value) {
485
+ I?.mode === "push" ? I.push({
486
+ icon: a.icon,
487
+ header: c.default,
488
+ content: c.children
489
+ }) : pe();
490
+ return;
491
+ }
492
+ l.value && o("update:checked", !a.checked), o("click"), (a.keepOpen ?? l.value) || le?.();
493
+ }
494
+ }
495
+ function K(e) {
496
+ e.pointerType === "mouse" && P.value && !a.disabled && (H(), B.value = !0);
497
+ }
498
+ function q(e) {
499
+ e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (B.value = !1));
500
+ }
501
+ function J(e) {
502
+ if (e.pointerType !== "mouse") return;
503
+ let t = e.relatedTarget;
504
+ t?.closest(".m3-submenu") || L.value?.contains(t) || (B.value = !1);
505
+ }
506
+ return (e, n) => (C(), h("div", {
507
+ ref_key: "itemEl",
508
+ ref: L,
509
+ "data-m3-menu-choice": v.value || void 0,
510
+ onPointerenter: K,
511
+ onPointerleave: q
512
+ }, [(C(), p(O(ce.value), {
513
+ ref_key: "controlEl",
514
+ ref: R,
515
+ to: t.to || void 0,
516
+ type: t.to ? void 0 : "button",
517
+ role: v.value ? l.value ? "menuitemcheckbox" : "menuitemradio" : void 0,
518
+ "aria-checked": v.value ? y.value : void 0,
519
+ class: x(["flex items-center gap-3 py-2.5 text-left text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", v.value ? [
520
+ "relative mx-1 w-[calc(100%-0.5rem)] px-3 duration-150 before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity",
521
+ y.value ? "bg-tertiary-container text-on-tertiary-container" : "text-on-surface",
522
+ t.disabled ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]"
523
+ ] : [
524
+ "w-full px-4",
525
+ t.disabled ? "cursor-not-allowed opacity-[0.38] text-on-surface" : "cursor-pointer",
526
+ !t.disabled && t.danger ? "text-error hover:bg-error/8" : "",
527
+ !t.disabled && !t.danger ? "text-on-surface hover:bg-on-surface/8" : ""
528
+ ]]),
529
+ disabled: t.disabled || void 0,
530
+ "aria-haspopup": P.value ? "menu" : void 0,
531
+ "aria-expanded": P.value ? B.value : void 0,
532
+ onClick: me
533
+ }, {
534
+ default: ae(() => [
535
+ w.value ? (C(), h("span", {
536
+ key: 0,
537
+ ref_key: "iconSlotEl",
538
+ ref: z,
539
+ class: "-mr-3 flex shrink-0 overflow-hidden",
540
+ style: {
541
+ width: "0",
542
+ opacity: "0"
543
+ }
544
+ }, [_(s, {
545
+ name: E.value,
546
+ size: 20,
547
+ class: "shrink-0"
548
+ }, null, 8, ["name"])], 512)) : e.$slots.icon ? (C(), h("span", {
549
+ key: 1,
550
+ class: x(["flex size-5 shrink-0 items-center justify-center", v.value ? y.value ? "" : "text-on-surface-variant" : t.danger ? "text-error" : "text-on-surface-variant"])
551
+ }, [D(e.$slots, "icon", { on: y.value })], 2)) : t.icon ? (C(), p(s, {
552
+ key: 2,
553
+ name: y.value && E.value ? E.value : t.icon,
554
+ filled: y.value && !E.value,
555
+ size: 20,
556
+ class: x(["shrink-0", v.value ? y.value ? "" : "text-on-surface-variant" : t.danger ? "text-error" : "text-on-surface-variant"])
557
+ }, null, 8, [
558
+ "name",
559
+ "filled",
560
+ "class"
561
+ ])) : m("", !0),
562
+ g("span", de, [D(e.$slots, "default")]),
563
+ t.shortcut && !P.value ? (C(), h("span", W, k(t.shortcut), 1)) : m("", !0),
564
+ P.value ? (C(), p(s, {
565
+ key: 4,
566
+ name: "chevron_right",
567
+ size: 18,
568
+ class: "shrink-0 text-on-surface-variant"
569
+ })) : m("", !0)
570
+ ]),
571
+ _: 3
572
+ }, 8, [
573
+ "to",
574
+ "type",
575
+ "role",
576
+ "aria-checked",
577
+ "class",
578
+ "disabled",
579
+ "aria-haspopup",
580
+ "aria-expanded"
581
+ ])), P.value && A(I)?.mode !== "push" ? (C(), p(u, {
582
+ key: 0,
583
+ to: "body"
584
+ }, [_(d, {
585
+ "enter-active-class": "transition-opacity duration-100",
586
+ "enter-from-class": "opacity-0",
587
+ "leave-active-class": "transition-opacity duration-75",
588
+ "leave-to-class": "opacity-0",
589
+ onEnter: U
590
+ }, {
591
+ default: ae(() => [B.value ? (C(), h("div", {
592
+ key: 0,
593
+ class: "m3-submenu min-w-44 rounded-xs shadow-elevation-2",
594
+ style: S(V.value),
595
+ onPointerleave: J
596
+ }, [g("div", G, [D(e.$slots, "children")])], 36)) : m("", !0)]),
597
+ _: 3
598
+ })])) : m("", !0)], 40, ue));
599
+ }
600
+ });
601
+ //#endregion
602
+ export { le as a, F as i, U as n, M as o, I as r, pe as t };
603
+
604
+ //# sourceMappingURL=MMenuItem-Bih0h4-n.js.map