@m3ui-vue/m3ui-vue 1.2.2 → 1.3.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.
Files changed (235) hide show
  1. package/dist/API.md +2776 -351
  2. package/dist/MButton-CuNzpoxm.js +172 -0
  3. package/dist/MButton-CuNzpoxm.js.map +1 -0
  4. package/dist/MDialog-HxEL-m58.js +173 -0
  5. package/dist/MDialog-HxEL-m58.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-DnPtv-hY.js +824 -0
  9. package/dist/MListItem-DnPtv-hY.js.map +1 -0
  10. package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
  11. package/dist/MLoadingIndicator-BQMNX6Dx.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-LURE1Ah7.js +435 -0
  17. package/dist/MSeekBar-LURE1Ah7.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-_J4IS2_z.js +691 -0
  21. package/dist/MSlider-_J4IS2_z.js.map +1 -0
  22. package/dist/MSpinner-BhkMYKOM.js +65 -0
  23. package/dist/MSpinner-BhkMYKOM.js.map +1 -0
  24. package/dist/MTextField-CkzwNBWS.js +296 -0
  25. package/dist/MTextField-CkzwNBWS.js.map +1 -0
  26. package/dist/MTooltip-B67ZDSGp.js +756 -0
  27. package/dist/MTooltip-B67ZDSGp.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 +148 -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 +160 -0
  55. package/dist/components/MFlow.vue.d.ts +305 -0
  56. package/dist/components/MFlowControls.vue.d.ts +33 -0
  57. package/dist/components/MFlowHandle.vue.d.ts +16 -0
  58. package/dist/components/MFlowMinimap.vue.d.ts +22 -0
  59. package/dist/components/MFlowNode.vue.d.ts +35 -0
  60. package/dist/components/MGantt.vue.d.ts +141 -0
  61. package/dist/components/MGanttControls.vue.d.ts +32 -0
  62. package/dist/components/MIconButton.vue.d.ts +3 -1
  63. package/dist/components/MImageCropper.vue.d.ts +110 -0
  64. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  65. package/dist/components/MLightbox.vue.d.ts +2 -2
  66. package/dist/components/MList.vue.d.ts +1 -1
  67. package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
  68. package/dist/components/MMapControl.vue.d.ts +1 -1
  69. package/dist/components/MMapSearch.vue.d.ts +1 -1
  70. package/dist/components/MMaskField.vue.d.ts +12 -1
  71. package/dist/components/MMenu.vue.d.ts +1 -1
  72. package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
  73. package/dist/components/MNumberField.vue.d.ts +11 -2
  74. package/dist/components/MPdfViewer.vue.d.ts +174 -0
  75. package/dist/components/MPullToRefresh.vue.d.ts +1 -1
  76. package/dist/components/MResourceTimeline.vue.d.ts +149 -0
  77. package/dist/components/MScheduler.vue.d.ts +3 -3
  78. package/dist/components/MScheme.vue.d.ts +1 -1
  79. package/dist/components/MSearchField.vue.d.ts +1 -1
  80. package/dist/components/MSeekBar.vue.d.ts +1 -1
  81. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  82. package/dist/components/MSkeleton.vue.d.ts +1 -1
  83. package/dist/components/MSlider.vue.d.ts +2 -2
  84. package/dist/components/MSparkline.vue.d.ts +1 -1
  85. package/dist/components/MSplitter.vue.d.ts +1 -1
  86. package/dist/components/MStack.vue.d.ts +2 -2
  87. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  88. package/dist/components/MSwitch.vue.d.ts +1 -1
  89. package/dist/components/MTable.vue.d.ts +1 -1
  90. package/dist/components/MTagInput.vue.d.ts +12 -1
  91. package/dist/components/MTextField.vue.d.ts +13 -2
  92. package/dist/components/MToolbar.vue.d.ts +1 -1
  93. package/dist/components/MTree.vue.d.ts +2 -2
  94. package/dist/components/MVideoPlayer.vue.d.ts +253 -0
  95. package/dist/components/MVirtualTable.vue.d.ts +1 -1
  96. package/dist/components/MWindow.vue.d.ts +3 -3
  97. package/dist/components/_MFlowEdge.vue.d.ts +9 -0
  98. package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
  99. package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
  100. package/dist/components/_MPdfPage.vue.d.ts +76 -0
  101. package/dist/components/_MTimeBackground.vue.d.ts +14 -0
  102. package/dist/components/_MTimeHeader.vue.d.ts +20 -0
  103. package/dist/composables/_flowPanel.d.ts +2 -0
  104. package/dist/composables/_flowSlot.d.ts +5 -0
  105. package/dist/composables/_ganttTime.d.ts +41 -0
  106. package/dist/composables/_useTimeAxis.d.ts +90 -0
  107. package/dist/composables/drawGeometry.d.ts +119 -0
  108. package/dist/composables/flowFormats.d.ts +79 -0
  109. package/dist/composables/flowLayout.d.ts +45 -0
  110. package/dist/composables/flowPaths.d.ts +53 -0
  111. package/dist/composables/ganttFormats.d.ts +52 -0
  112. package/dist/composables/ganttSchedule.d.ts +99 -0
  113. package/dist/composables/useDrawing.d.ts +44 -0
  114. package/dist/composables/useFlow.d.ts +266 -0
  115. package/dist/composables/useGantt.d.ts +87 -0
  116. package/dist/composables/useLocale.d.ts +163 -0
  117. package/dist/composables/useMediaPlayer.d.ts +101 -0
  118. package/dist/composables/usePdf.d.ts +119 -0
  119. package/dist/composables/useResourceTimeline.d.ts +70 -0
  120. package/dist/draw.d.ts +7 -0
  121. package/dist/draw.js +1700 -0
  122. package/dist/draw.js.map +1 -0
  123. package/dist/flow.d.ts +14 -0
  124. package/dist/flow.js +3542 -0
  125. package/dist/flow.js.map +1 -0
  126. package/dist/flowPaths-CUc6X373.js +161 -0
  127. package/dist/flowPaths-CUc6X373.js.map +1 -0
  128. package/dist/gantt.d.ts +12 -0
  129. package/dist/gantt.js +3575 -0
  130. package/dist/gantt.js.map +1 -0
  131. package/dist/index.d.ts +4 -0
  132. package/dist/locales/index.js +1148 -7
  133. package/dist/locales/index.js.map +1 -1
  134. package/dist/m3ui-vue.css +1 -1
  135. package/dist/m3ui.js +7286 -7654
  136. package/dist/m3ui.js.map +1 -1
  137. package/dist/map.js +113 -108
  138. package/dist/map.js.map +1 -1
  139. package/dist/media.d.ts +5 -0
  140. package/dist/media.js +1311 -0
  141. package/dist/media.js.map +1 -0
  142. package/dist/pdf.d.ts +4 -0
  143. package/dist/pdf.js +1871 -0
  144. package/dist/pdf.js.map +1 -0
  145. package/dist/rich-text-editor.js +28 -26
  146. package/dist/rich-text-editor.js.map +1 -1
  147. package/dist/styles.css +1 -1
  148. package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
  149. package/dist/useLocale-BpGxplLV.js.map +1 -0
  150. package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
  151. package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
  152. package/package.json +29 -5
  153. package/src/__tests__/MAudioPlayer.test.ts +75 -0
  154. package/src/__tests__/MDrawCanvas.test.ts +110 -0
  155. package/src/__tests__/MFloorPlan.test.ts +97 -0
  156. package/src/__tests__/MFlow.test.ts +575 -0
  157. package/src/__tests__/MGantt.test.ts +130 -0
  158. package/src/__tests__/MImageCropper.test.ts +89 -0
  159. package/src/__tests__/MPdfViewer.test.ts +235 -0
  160. package/src/__tests__/MResourceTimeline.test.ts +102 -0
  161. package/src/__tests__/MVideoPlayer.test.ts +201 -0
  162. package/src/__tests__/drawGeometry.test.ts +58 -0
  163. package/src/__tests__/fieldExpose.test.ts +30 -0
  164. package/src/__tests__/flowFormats.test.ts +185 -0
  165. package/src/__tests__/flowLayout.test.ts +113 -0
  166. package/src/__tests__/ganttFormats.test.ts +76 -0
  167. package/src/__tests__/ganttSchedule.test.ts +136 -0
  168. package/src/__tests__/pdfMock.ts +83 -0
  169. package/src/__tests__/useMediaPlayer.test.ts +182 -0
  170. package/src/__tests__/usePdf.test.ts +102 -0
  171. package/src/components/MAudioPlayer.vue +319 -0
  172. package/src/components/MDrawCanvas.vue +813 -0
  173. package/src/components/MDrawLayers.vue +114 -0
  174. package/src/components/MDrawToolbar.vue +171 -0
  175. package/src/components/MFloorPlan.vue +581 -0
  176. package/src/components/MFlow.vue +2049 -0
  177. package/src/components/MFlowControls.vue +110 -0
  178. package/src/components/MFlowHandle.vue +60 -0
  179. package/src/components/MFlowMinimap.vue +134 -0
  180. package/src/components/MFlowNode.vue +98 -0
  181. package/src/components/MGantt.vue +1609 -0
  182. package/src/components/MGanttControls.vue +77 -0
  183. package/src/components/MIconButton.vue +3 -1
  184. package/src/components/MImageCropper.vue +507 -0
  185. package/src/components/MMaskField.vue +13 -0
  186. package/src/components/MNumberField.vue +13 -0
  187. package/src/components/MPdfViewer.vue +1269 -0
  188. package/src/components/MResourceTimeline.vue +1020 -0
  189. package/src/components/MTagInput.vue +13 -0
  190. package/src/components/MTextField.vue +16 -0
  191. package/src/components/MVideoPlayer.vue +839 -0
  192. package/src/components/_MFlowEdge.vue +100 -0
  193. package/src/components/_MFlowEdgeLabel.vue +56 -0
  194. package/src/components/_MFlowNodeShell.vue +111 -0
  195. package/src/components/_MPdfPage.vue +456 -0
  196. package/src/components/_MTimeBackground.vue +16 -0
  197. package/src/components/_MTimeHeader.vue +31 -0
  198. package/src/composables/_flowPanel.ts +13 -0
  199. package/src/composables/_flowSlot.ts +6 -0
  200. package/src/composables/_ganttTime.ts +200 -0
  201. package/src/composables/_useTimeAxis.ts +224 -0
  202. package/src/composables/drawGeometry.ts +405 -0
  203. package/src/composables/flowFormats.ts +916 -0
  204. package/src/composables/flowLayout.ts +297 -0
  205. package/src/composables/flowPaths.ts +239 -0
  206. package/src/composables/ganttFormats.ts +366 -0
  207. package/src/composables/ganttSchedule.ts +403 -0
  208. package/src/composables/useDrawing.ts +53 -0
  209. package/src/composables/useFlow.ts +250 -0
  210. package/src/composables/useGantt.ts +92 -0
  211. package/src/composables/useLocale.ts +328 -0
  212. package/src/composables/useMediaPlayer.ts +406 -0
  213. package/src/composables/usePdf.ts +456 -0
  214. package/src/composables/useResourceTimeline.ts +76 -0
  215. package/src/draw.ts +25 -0
  216. package/src/flow.ts +26 -0
  217. package/src/gantt.ts +12 -0
  218. package/src/index.ts +4 -0
  219. package/src/locales/de.ts +163 -0
  220. package/src/locales/es.ts +163 -0
  221. package/src/locales/fr.ts +163 -0
  222. package/src/locales/ja.ts +163 -0
  223. package/src/locales/ko.ts +163 -0
  224. package/src/locales/pt.ts +163 -0
  225. package/src/locales/zh.ts +163 -0
  226. package/src/media.ts +5 -0
  227. package/src/pdf.ts +15 -0
  228. package/dist/MMenuItem-D4Gx_l3F.js +0 -929
  229. package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
  230. package/dist/MSlider-Dx_S3vJ9.js +0 -1506
  231. package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
  232. package/dist/MTextField-Bz8JIsnl.js +0 -633
  233. package/dist/MTextField-Bz8JIsnl.js.map +0 -1
  234. package/dist/useLocale-JYxDDeXC.js.map +0 -1
  235. package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
@@ -1,929 +0,0 @@
1
- import { i as e } from "./useLocale-JYxDDeXC.js";
2
- import { g as t, h as n, l as r, n as i, o as a, p as o, r as s, s as c, v as l, y as u } from "./MTextField-Bz8JIsnl.js";
3
- import { i as d } from "./motion-DZiXG09o.js";
4
- import { t as f } from "./MIcon-Bxh9j135.js";
5
- import { t as p } from "./_plugin-vue_export-helper-B3ysoDQm.js";
6
- import { Fragment as m, Teleport as h, Transition as g, computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createTextVNode as S, createVNode as C, defineComponent as w, getCurrentInstance as T, inject as E, mergeProps as D, nextTick as O, normalizeClass as k, normalizeStyle as A, onBeforeUnmount as ee, onMounted as te, onUnmounted as ne, openBlock as j, provide as M, ref as N, renderList as re, renderSlot as P, resolveDynamicComponent as ie, toDisplayString as F, unref as I, useId as ae, useSlots as oe, watch as L, withCtx as R, withDirectives as z, withModifiers as B } from "vue";
7
- //#region src/composables/_useScrollLock.ts
8
- var V = 0, H = "";
9
- function U() {
10
- V++ === 0 && (H = document.body.style.overflow, document.body.style.overflow = "hidden");
11
- }
12
- function se() {
13
- V > 0 && --V === 0 && (document.body.style.overflow = H);
14
- }
15
- function W(e) {
16
- let t = !1;
17
- function n(e) {
18
- typeof document > "u" || e === t || (t = e, e ? U() : se());
19
- }
20
- return e && L(e, (e) => n(!!e), { immediate: !0 }), T() && ee(() => n(!1)), { set: n };
21
- }
22
- //#endregion
23
- //#region src/components/MButton.vue?vue&type=script&setup=true&lang.ts
24
- var G = "relative inline-flex items-center justify-center font-medium whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", K = /* @__PURE__ */ w({
25
- __name: "MButton",
26
- props: {
27
- variant: { default: "filled" },
28
- color: { default: "primary" },
29
- type: { default: "button" },
30
- disabled: {
31
- type: Boolean,
32
- default: !1
33
- },
34
- loading: {
35
- type: Boolean,
36
- default: !1
37
- },
38
- icon: {},
39
- iconFilled: { type: Boolean },
40
- iconPos: { default: "leading" },
41
- size: { default: "sm" },
42
- shape: { default: "rounded" },
43
- to: {},
44
- rippleColor: {},
45
- contentColor: {}
46
- },
47
- setup(e) {
48
- let t = ["primary", "error"], n = e, r = _(() => n.to ? "RouterLink" : "button"), i = _(() => !!n.color && !t.includes(n.color)), a = _(() => {
49
- if (i.value) return {
50
- "--color-primary": n.color,
51
- "--color-on-primary": "#ffffff",
52
- "--color-primary-container": n.color + "33",
53
- "--color-on-primary-container": n.color
54
- };
55
- }), s = _(() => n.color === "error"), c = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/, l = _(() => {
56
- let e = n.contentColor;
57
- return !e || n.disabled || n.loading ? a.value : {
58
- ...a.value,
59
- color: c.test(e) ? `var(--color-${e})` : e
60
- };
61
- }), d = _(() => {
62
- switch (n.variant) {
63
- case "filled":
64
- case "tonal":
65
- case "elevated": return "disabled:bg-on-surface/10";
66
- case "outlined": return s.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
67
- default: return "";
68
- }
69
- }), p = {
70
- xs: {
71
- h: "h-8",
72
- text: "text-label-large",
73
- icon: 20,
74
- spinner: 16,
75
- gap: "gap-1",
76
- px: "px-3",
77
- pxText: "px-2",
78
- squareRadius: "rounded-md"
79
- },
80
- sm: {
81
- h: "h-10",
82
- text: "text-label-large",
83
- icon: 20,
84
- spinner: 16,
85
- gap: "gap-2",
86
- px: "px-4",
87
- pxText: "px-3",
88
- squareRadius: "rounded-md"
89
- },
90
- md: {
91
- h: "h-14",
92
- text: "text-title-medium",
93
- icon: 24,
94
- spinner: 18,
95
- gap: "gap-2",
96
- px: "px-6",
97
- pxText: "px-3",
98
- squareRadius: "rounded-lg"
99
- },
100
- lg: {
101
- h: "h-24",
102
- text: "text-headline-small",
103
- icon: 32,
104
- spinner: 26,
105
- gap: "gap-3",
106
- px: "px-12",
107
- pxText: "px-4",
108
- squareRadius: "rounded-xl"
109
- },
110
- xl: {
111
- h: "h-[136px]",
112
- text: "text-headline-large",
113
- icon: 40,
114
- spinner: 34,
115
- gap: "gap-4",
116
- px: "px-16",
117
- pxText: "px-4",
118
- squareRadius: "rounded-xl"
119
- }
120
- }, h = _(() => p[n.size] ?? p.sm), g = _(() => `${h.value.h} ${h.value.text} ${h.value.gap}`), x = _(() => h.value.icon), S = _(() => h.value.spinner), C = _(() => n.variant === "text" ? h.value.pxText : h.value.px), w = _(() => n.shape === "squared" ? h.value.squareRadius : "rounded-full"), T = _(() => {
121
- let e = s.value;
122
- switch (n.variant) {
123
- case "filled": return e ? "bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
124
- case "tonal": return e ? "bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
125
- case "elevated": return e ? "bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2" : "bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2";
126
- case "outlined": return e ? "border border-error text-error" : "border border-outline-variant text-primary";
127
- case "text": return e ? "text-error" : "text-primary";
128
- default: return "";
129
- }
130
- });
131
- return (t, n) => z((j(), v(ie(r.value), {
132
- to: e.to || void 0,
133
- type: e.to ? void 0 : e.type,
134
- disabled: e.disabled || e.loading,
135
- class: k([
136
- G,
137
- w.value,
138
- g.value,
139
- C.value,
140
- T.value,
141
- d.value
142
- ]),
143
- style: A(l.value)
144
- }, {
145
- default: R(() => [
146
- e.iconPos === "leading" ? (j(), b(m, { key: 0 }, [e.loading ? (j(), v(o, {
147
- key: 0,
148
- size: S.value
149
- }, null, 8, ["size"])) : e.icon ? (j(), v(f, {
150
- key: 1,
151
- name: e.icon,
152
- size: x.value,
153
- filled: e.iconFilled
154
- }, null, 8, [
155
- "name",
156
- "size",
157
- "filled"
158
- ])) : y("", !0)], 64)) : y("", !0),
159
- P(t.$slots, "default"),
160
- e.iconPos === "trailing" ? (j(), b(m, { key: 1 }, [e.loading ? (j(), v(o, {
161
- key: 0,
162
- size: S.value
163
- }, null, 8, ["size"])) : e.icon ? (j(), v(f, {
164
- key: 1,
165
- name: e.icon,
166
- size: x.value,
167
- filled: e.iconFilled
168
- }, null, 8, [
169
- "name",
170
- "size",
171
- "filled"
172
- ])) : y("", !0)], 64)) : y("", !0)
173
- ]),
174
- _: 3
175
- }, 8, [
176
- "to",
177
- "type",
178
- "disabled",
179
- "class",
180
- "style"
181
- ])), [[I(u), {
182
- disabled: e.disabled || e.loading,
183
- color: e.rippleColor
184
- }]]);
185
- }
186
- }), q = ["aria-labelledby", "aria-label"], J = {
187
- key: 0,
188
- class: "min-h-0 overflow-y-auto rounded-[inherit]"
189
- }, Y = { class: "relative px-6 pt-6 pb-2" }, X = {
190
- key: 0,
191
- class: "absolute right-4 top-4"
192
- }, Z = {
193
- key: 1,
194
- class: "mb-4 flex justify-center text-secondary"
195
- }, ce = {
196
- key: 0,
197
- class: "shrink-0 border-t border-outline-variant"
198
- }, le = {
199
- key: 1,
200
- class: "flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6"
201
- }, ue = ["aria-labelledby", "aria-label"], de = {
202
- key: 0,
203
- class: "min-h-0 flex-1 overflow-y-auto"
204
- }, fe = {
205
- key: 1,
206
- class: "flex h-14 shrink-0 items-center gap-2 px-2"
207
- }, pe = {
208
- key: 1,
209
- class: "flex items-center gap-2"
210
- }, me = {
211
- key: 2,
212
- class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant"
213
- }, Q = /*#__PURE__*/ p(/* @__PURE__ */ w({
214
- inheritAttrs: !1,
215
- __name: "MDialog",
216
- props: {
217
- modelValue: { type: Boolean },
218
- title: {},
219
- maxWidth: { default: "max-w-[560px]" },
220
- maxHeight: { default: "max-h-[90vh]" },
221
- persistent: {
222
- type: Boolean,
223
- default: !1
224
- },
225
- fullscreen: {
226
- type: Boolean,
227
- default: !1
228
- },
229
- closeLabel: {},
230
- closable: {
231
- type: Boolean,
232
- default: !0
233
- },
234
- bare: {
235
- type: Boolean,
236
- default: !1
237
- }
238
- },
239
- emits: ["update:modelValue"],
240
- setup(t, { emit: n }) {
241
- let r = t, a = e(), o = (e) => /^-?[\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\(/i.test(e.trim()), c = _(() => [r.maxWidth, r.maxHeight].filter((e) => !o(e))), l = _(() => ({
242
- ...o(r.maxWidth) ? { maxWidth: r.maxWidth } : {},
243
- ...o(r.maxHeight) ? { maxHeight: r.maxHeight } : {}
244
- })), u = n;
245
- function d() {
246
- r.persistent || u("update:modelValue", !1);
247
- }
248
- let f = N(), p = N(), w = N(!1), T;
249
- function E() {
250
- let e = f.value;
251
- if (!e) {
252
- w.value = !1;
253
- return;
254
- }
255
- w.value = e.scrollHeight - e.scrollTop - e.clientHeight > 1;
256
- }
257
- W(() => r.modelValue), i(() => r.modelValue, d);
258
- let A = `m3-dialog-${ae()}`;
259
- return L(() => r.modelValue, async (e) => {
260
- typeof window > "u" || (e ? (await O(), E(), T = new ResizeObserver(E), f.value && T.observe(f.value), p.value && T.observe(p.value)) : (T?.disconnect(), T = void 0));
261
- }, { immediate: !0 }), ne(() => {
262
- T?.disconnect();
263
- }), (e, n) => (j(), v(h, { to: "body" }, [t.fullscreen ? (j(), v(g, {
264
- key: 1,
265
- name: "m3-dialog-fs",
266
- appear: ""
267
- }, {
268
- default: R(() => [t.modelValue ? (j(), b("div", D({ key: 0 }, e.$attrs, {
269
- class: "dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col",
270
- role: "dialog",
271
- "aria-modal": "true",
272
- "aria-labelledby": !t.bare && (e.$slots.title || t.title) ? A : void 0,
273
- "aria-label": t.bare ? t.title : void 0
274
- }), [t.bare ? (j(), b("div", de, [P(e.$slots, "default", {}, void 0, !0)])) : (j(), b("div", fe, [
275
- t.persistent ? y("", !0) : (j(), v(s, {
276
- key: 0,
277
- icon: "close",
278
- label: t.closeLabel ?? I(a).close,
279
- onClick: d
280
- }, null, 8, ["label"])),
281
- x("h2", {
282
- id: A,
283
- class: "flex-1 text-title-large font-medium text-on-surface"
284
- }, [P(e.$slots, "title", {}, () => [S(F(t.title), 1)], !0)]),
285
- e.$slots.actions ? (j(), b("div", pe, [P(e.$slots, "actions", {}, void 0, !0)])) : y("", !0)
286
- ])), t.bare ? y("", !0) : (j(), b("div", me, [P(e.$slots, "default", {}, void 0, !0)]))], 16, ue)) : y("", !0)]),
287
- _: 3
288
- })) : (j(), v(g, {
289
- key: 0,
290
- name: "m3-dialog",
291
- appear: ""
292
- }, {
293
- default: R(() => [t.modelValue ? (j(), b("div", {
294
- key: 0,
295
- class: "fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4",
296
- onClick: B(d, ["self"])
297
- }, [x("div", D(e.$attrs, {
298
- class: ["dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col", c.value],
299
- style: l.value,
300
- role: "dialog",
301
- "aria-modal": "true",
302
- "aria-labelledby": !t.bare && (e.$slots.title || t.title) ? A : void 0,
303
- "aria-label": t.bare ? t.title : void 0
304
- }), [t.bare ? (j(), b("div", J, [P(e.$slots, "default", {}, void 0, !0)])) : (j(), b(m, { key: 1 }, [
305
- x("div", Y, [
306
- t.closable && !t.persistent ? (j(), b("div", X, [C(s, {
307
- icon: "close",
308
- label: t.closeLabel ?? I(a).close,
309
- onClick: d
310
- }, null, 8, ["label"])])) : y("", !0),
311
- e.$slots.icon ? (j(), b("div", Z, [P(e.$slots, "icon", {}, void 0, !0)])) : y("", !0),
312
- x("h2", {
313
- id: A,
314
- class: k(["text-headline-small text-on-surface", [e.$slots.icon ? "text-center" : "text-left", t.closable && !t.persistent ? e.$slots.icon ? "px-10" : "pr-10" : ""]])
315
- }, [P(e.$slots, "title", {}, () => [S(F(t.title), 1)], !0)], 2)
316
- ]),
317
- x("div", {
318
- ref_key: "contentEl",
319
- ref: f,
320
- class: k(["overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant", e.$slots.actions ? "pb-2" : "pb-6"]),
321
- onScroll: E
322
- }, [x("div", {
323
- ref_key: "contentInnerEl",
324
- ref: p
325
- }, [P(e.$slots, "default", {}, void 0, !0)], 512)], 34),
326
- w.value && e.$slots.actions ? (j(), b("div", ce)) : y("", !0),
327
- e.$slots.actions ? (j(), b("div", le, [P(e.$slots, "actions", {}, void 0, !0)])) : y("", !0)
328
- ], 64))], 16, q)])) : y("", !0)]),
329
- _: 3
330
- }))]));
331
- }
332
- }), [["__scopeId", "data-v-8f788bae"]]), he = { class: "my-1 border-outline-variant" }, ge = /* @__PURE__ */ w({
333
- __name: "MMenuDivider",
334
- props: { gap: {
335
- type: Boolean,
336
- default: !1
337
- } },
338
- setup(e) {
339
- return (e, t) => (j(), b("hr", he));
340
- }
341
- }), _e = 30, ve = 380, ye = 8, be = 1 / 3, xe = .5;
342
- function Se(e) {
343
- let r = N([]), i = _(() => r.value[r.value.length - 1]), a = N("forward"), o = N(), s = 0, c = 1;
344
- function u(e, t) {
345
- let n = a.value === "forward" ? 1 : -1, r = e.animate([{
346
- transform: `translateX(${n * _e}px)`,
347
- opacity: 0
348
- }, {
349
- transform: "translateX(0)",
350
- opacity: 1
351
- }], {
352
- duration: 300,
353
- delay: 60,
354
- easing: "cubic-bezier(0.05,0.7,0.1,1)",
355
- fill: "backwards"
356
- });
357
- r.onfinish = t;
358
- }
359
- function f(e, t) {
360
- let n = a.value === "forward" ? -1 : 1, r = e;
361
- r.style.position = "absolute", r.style.insetInline = "0", r.style.top = "0";
362
- let i = s, o = c;
363
- s = 0, c = 1;
364
- let l = r.animate([{
365
- transform: `translateX(${i}px)`,
366
- opacity: o
367
- }, {
368
- transform: `translateX(${i + n * _e}px)`,
369
- opacity: 0
370
- }], {
371
- duration: 90,
372
- easing: "cubic-bezier(0.3,0,0.8,0.15)",
373
- fill: "forwards"
374
- });
375
- l.onfinish = t;
376
- }
377
- function p(e) {
378
- let r = o.value, i = r?.offsetHeight ?? 0, a = r?.style.overflowY ?? "";
379
- r && (r.style.overflowY = "hidden");
380
- let s = () => {
381
- r && (r.style.overflowY = a);
382
- };
383
- if (e(), !r || t()) return s();
384
- O(() => {
385
- let e = r.offsetHeight, t = Math.abs(e - i) < 1 ? null : n(r, l(i, e, 0, d.standard.defaultSpatial, .5), (e) => ({ height: `${e}px` })), a = new Promise((e) => setTimeout(e, ve));
386
- Promise.all([a, t?.finished.catch(() => {})]).then(s);
387
- });
388
- }
389
- function m(t) {
390
- a.value = "forward", p(() => r.value.push(t)), O(e);
391
- }
392
- function h() {
393
- a.value = "backward", p(() => r.value.pop()), O(e);
394
- }
395
- function g() {
396
- r.value = [];
397
- }
398
- let v = null;
399
- function y() {
400
- return o.value?.querySelector(`:scope > [data-menu-level="${r.value.length}"]`) ?? null;
401
- }
402
- function b(e) {
403
- if (e.pointerType !== "touch" || !r.value.length || v) return;
404
- let t = y();
405
- t && (v = {
406
- id: e.pointerId,
407
- x: e.clientX,
408
- y: e.clientY,
409
- level: t,
410
- width: o.value.clientWidth,
411
- active: !1,
412
- lastX: e.clientX,
413
- lastT: e.timeStamp,
414
- vel: 0
415
- }, window.addEventListener("pointermove", S), window.addEventListener("pointerup", C), window.addEventListener("pointercancel", w));
416
- }
417
- function x(e) {
418
- v && (v.level.style.transform = `translateX(${e}px)`, v.level.style.opacity = String(1 - .5 * Math.min(1, e / v.width)));
419
- }
420
- function S(e) {
421
- if (!v || e.pointerId !== v.id) return;
422
- let t = e.clientX - v.x, n = e.clientY - v.y;
423
- if (!v.active) {
424
- if (Math.hypot(t, n) < ye) return;
425
- if (Math.abs(n) > Math.abs(t) || t < 0) return A();
426
- v.active = !0, v.x = e.clientX, v.level.getAnimations().forEach((e) => e.finish());
427
- }
428
- let r = e.timeStamp - v.lastT;
429
- 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));
430
- }
431
- function C(e) {
432
- if (!v || e.pointerId !== v.id) return;
433
- let t = v;
434
- if (A(), !t.active) return;
435
- window.addEventListener("click", k, {
436
- capture: !0,
437
- once: !0
438
- }), clearTimeout(E), E = setTimeout(D, 400);
439
- let n = Math.max(0, e.clientX - t.x);
440
- n > t.width * be || t.vel > xe ? (s = n, c = Number(t.level.style.opacity || 1), h()) : T(t.level, n);
441
- }
442
- function w(e) {
443
- if (!v || e.pointerId !== v.id) return;
444
- let t = v;
445
- A(), t.active && T(t.level, Math.max(0, t.lastX - t.x));
446
- }
447
- function T(e, r) {
448
- if (e.style.transform = "", e.style.opacity = "", t() || r < 1) return;
449
- let i = o.value?.clientWidth || 1;
450
- n(e, l(r, 0, 0, d.standard.defaultSpatial, .5), (e) => ({
451
- transform: `translateX(${e}px)`,
452
- opacity: String(1 - .5 * Math.min(1, e / i))
453
- }));
454
- }
455
- let E;
456
- function D() {
457
- clearTimeout(E), window.removeEventListener("click", k, { capture: !0 });
458
- }
459
- function k(e) {
460
- e.stopPropagation(), e.preventDefault();
461
- }
462
- function A() {
463
- v = null, window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", C), window.removeEventListener("pointercancel", w);
464
- }
465
- return ne(() => {
466
- A(), D();
467
- }), {
468
- navStack: r,
469
- currentNav: i,
470
- navBox: o,
471
- navSlideEnter: u,
472
- navSlideLeave: f,
473
- pushNav: m,
474
- popNav: h,
475
- resetNav: g,
476
- onNavPointerDown: b
477
- };
478
- }
479
- function Ce(e, t, n, r = 8) {
480
- for (let i of e) if (i >= r && i + t <= n - r) return i;
481
- if (t >= n - 2 * r) return (n - t) / 2;
482
- let i = e[e.length - 1] ?? r;
483
- return Math.min(n - r - t, Math.max(r, i));
484
- }
485
- function we(e, t, n, r, i = 8) {
486
- let a = e.left, o = e.right - t, s = (e.left + e.right) / 2 < n / 2 ? i : n - i - t;
487
- return Ce(r === "start" ? [
488
- a,
489
- o,
490
- s
491
- ] : [
492
- o,
493
- a,
494
- s
495
- ], t, n, i);
496
- }
497
- //#endregion
498
- //#region src/components/MMenu.vue?vue&type=script&setup=true&lang.ts
499
- var Te = ["data-menu-level"], Ee = { class: "flex-1 truncate" }, De = { key: "root" }, Oe = {
500
- key: 0,
501
- class: "flex flex-col gap-1 px-1.5"
502
- }, ke = { class: "overflow-hidden rounded-lg bg-surface-container" }, $ = 1 / 240, Ae = /* @__PURE__ */ w({
503
- inheritAttrs: !1,
504
- __name: "MMenu",
505
- props: {
506
- align: { default: "right" },
507
- submenuMode: { default: "flyout" },
508
- variant: { default: "standard" }
509
- },
510
- setup(e, { expose: t }) {
511
- let n = e, r = oe();
512
- function a(e) {
513
- let t = [];
514
- for (let n of e) n.type === m && Array.isArray(n.children) ? t.push(...a(n.children)) : t.push(n);
515
- return t;
516
- }
517
- function o(e) {
518
- if (e.type !== ge) return !1;
519
- let t = e.props?.gap;
520
- return t === "" || t === !0 || t === "true";
521
- }
522
- let s = _(() => {
523
- if (n.variant !== "expressive") return null;
524
- let e = a(r.default?.({ close: Q }) ?? []), t = [[]];
525
- for (let n of e) o(n) ? t.push([]) : t[t.length - 1].push(n);
526
- return t.filter((e) => e.length > 0);
527
- }), c = _(() => !!s.value && s.value.length > 1), { navStack: l, currentNav: u, navBox: d, navSlideEnter: p, navSlideLeave: S, pushNav: w, popNav: T, onNavPointerDown: ee } = Se(() => fe()), F = null;
528
- function ae() {
529
- if (F) return F;
530
- let e = [], t = .8, n = 0, r = 0, i = 0;
531
- for (let a = 0; a < 1 && (e.push({
532
- scale: t,
533
- alpha: r
534
- }), n += (-1400 * (t - 1) - 1.8 * Math.sqrt(1400) * n) * $, t += n * $, i += (-3800 * (r - 1) - 2 * Math.sqrt(3800) * i) * $, r += i * $, !(Math.abs(t - 1) < .003 && Math.abs(r - 1) < .003)); a += $);
535
- return e.push({
536
- scale: 1,
537
- alpha: 1
538
- }), F = e, e;
539
- }
540
- let z = 0, B = null, V = null;
541
- function H(e, t, n) {
542
- B?.();
543
- let r = e, i = ae(), a = i.length - 1, o = Math.round(Math.max(0, Math.min(a, z))), s = n ? a : 0, c = n ? 1 : -1, l = [];
544
- for (let e = o; n ? e <= s : e >= s; e += c) l.push(i[e]);
545
- let u = (e) => ({
546
- transform: `scale(${e.scale})`,
547
- opacity: String(Math.min(1, Math.max(0, e.alpha)))
548
- });
549
- Object.assign(r.style, u(i[s]));
550
- let d = !1;
551
- function f() {
552
- d || (d = !0, z = s, B = null, V = null, t());
553
- }
554
- if (l.length < 2 || typeof r.animate != "function") return f();
555
- let p = r.animate(l.map(u), {
556
- duration: (l.length - 1) * $ * 1e3,
557
- easing: "linear"
558
- });
559
- p.finished.catch(() => {}), p.onfinish = f, B = () => {
560
- let e = Number(p.currentTime ?? 0) / ($ * 1e3);
561
- z = Math.max(0, Math.min(a, o + c * e)), d = !0, p.cancel();
562
- }, V = n ? null : () => {
563
- B?.(), B = null, V = null, t();
564
- };
565
- }
566
- function U(e, t) {
567
- ue(e), H(e, t, !0);
568
- }
569
- function se(e, t) {
570
- H(e, t, !1);
571
- }
572
- let W = N(!1), G = N(null), K = N(null), q = N({}), J = E("m-menu-panel-registry", /* @__PURE__ */ new Set());
573
- M("m-menu-panel-registry", J), L(K, (e, t) => {
574
- t && J.delete(t), e && J.add(e);
575
- }), ne(() => {
576
- K.value && J.delete(K.value);
577
- });
578
- let Y = E("m-menu-sibling-group", null);
579
- M("m-menu-sibling-group", { current: null });
580
- let X = null, Z = N(!1);
581
- function ce() {
582
- if (!G.value) return;
583
- let e = G.value.getBoundingClientRect();
584
- X = e;
585
- let t = window.innerHeight - e.bottom - 8;
586
- Z.value = t < 200 && e.top > t;
587
- let n = {
588
- maxHeight: `${Math.min(Z.value ? e.top - 12 : t, 400)}px`,
589
- maxWidth: `${window.innerWidth - 16}px`,
590
- left: "0px"
591
- };
592
- Z.value ? n.bottom = `${window.innerHeight - e.top + 4}px` : n.top = `${e.bottom + 4}px`, q.value = n;
593
- }
594
- let le = N(n.align === "right" ? "right" : "left");
595
- function ue(e) {
596
- if (!X) return;
597
- let t = e.offsetWidth, r = we(X, t, window.innerWidth, n.align === "right" ? "end" : "start"), i = Math.min(t, Math.max(0, (X.left + X.right) / 2 - r)), a = Math.abs(r - X.left) < 1 ? "left" : Math.abs(r + t - X.right) < 1 ? "right" : `${i}px`;
598
- le.value = a, q.value = {
599
- ...q.value,
600
- left: `${r}px`
601
- }, e.style.left = `${r}px`, e.style.transformOrigin = `${a} ${Z.value ? "bottom" : "top"}`;
602
- }
603
- function de() {
604
- return K.value ? Array.from(K.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
605
- }
606
- function fe() {
607
- O(() => de()[0]?.focus());
608
- }
609
- function pe(e) {
610
- let t = de();
611
- if (!t.length) return;
612
- let n = t.indexOf(document.activeElement);
613
- (n === -1 ? e === 1 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length])?.focus();
614
- }
615
- function me() {
616
- W.value ? Y?.current === Q && (Y.current = null) : (Y && Y.current && Y.current !== Q && Y.current(), Y && (Y.current = Q), ce(), l.value = []), W.value = !W.value, W.value && fe();
617
- }
618
- function Q() {
619
- Y?.current === Q && (Y.current = null), W.value = !1;
620
- }
621
- M("m-menu-close", Q), M("m-menu-nav", {
622
- mode: n.submenuMode,
623
- push: w
624
- }), t({
625
- close: Q,
626
- open: W
627
- });
628
- function he(e) {
629
- let t = e.target;
630
- if (!G.value?.contains(t)) {
631
- for (let e of J) if (e.contains(t)) return;
632
- t.closest?.(".m3-submenu") || Q();
633
- }
634
- }
635
- function _e(e) {
636
- if (!W.value) return;
637
- let t = e.target;
638
- for (let e of J) if (e.contains(t)) return;
639
- t.closest?.(".m3-submenu") || Q();
640
- }
641
- i(() => W.value, () => l.value.length ? T() : Q());
642
- function ve(e) {
643
- W.value && (e.key === "ArrowDown" ? (e.preventDefault(), pe(1)) : e.key === "ArrowUp" && (e.preventDefault(), pe(-1)));
644
- }
645
- te(() => {
646
- document.addEventListener("mousedown", he), document.addEventListener("keydown", ve), window.addEventListener("scroll", _e, !0);
647
- }), ne(() => {
648
- document.removeEventListener("mousedown", he), document.removeEventListener("keydown", ve), window.removeEventListener("scroll", _e, !0), V ? V() : B?.();
649
- });
650
- let ye = _(() => `${le.value} ${Z.value ? "bottom" : "top"}`);
651
- return (t, n) => (j(), b(m, null, [x("div", D({
652
- ref_key: "triggerEl",
653
- ref: G
654
- }, t.$attrs, {
655
- class: "inline-block",
656
- onClick: me
657
- }), [P(t.$slots, "trigger", { open: W.value })], 16), (j(), v(h, { to: "body" }, [C(g, {
658
- css: !1,
659
- onEnter: U,
660
- onLeave: se
661
- }, {
662
- default: R(() => [W.value ? (j(), b("div", {
663
- key: 0,
664
- ref_key: "dropdownEl",
665
- ref: K,
666
- class: k(["fixed z-500 min-w-48", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", c.value ? "" : "shadow-elevation-2"]]),
667
- style: A({
668
- ...q.value,
669
- transformOrigin: ye.value
670
- })
671
- }, [x("div", { class: k(["overflow-hidden", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", c.value ? "" : "bg-surface-container"]]) }, [x("div", {
672
- ref_key: "navBox",
673
- ref: d,
674
- class: "relative overflow-x-hidden overflow-y-auto overscroll-contain py-1",
675
- style: A({
676
- maxHeight: q.value.maxHeight,
677
- touchAction: I(u) ? "pan-y" : void 0
678
- }),
679
- onPointerdown: n[1] ||= (...e) => I(ee) && I(ee)(...e)
680
- }, [C(g, {
681
- css: !1,
682
- onEnter: I(p),
683
- onLeave: I(S)
684
- }, {
685
- default: R(() => [I(u) ? (j(), b("div", {
686
- key: I(l).length,
687
- "data-menu-level": I(l).length
688
- }, [
689
- x("button", {
690
- type: "button",
691
- 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",
692
- onClick: n[0] ||= (...e) => I(T) && I(T)(...e)
693
- }, [C(f, {
694
- name: "arrow_back",
695
- size: 20,
696
- class: "shrink-0"
697
- }), x("span", Ee, [(j(), v(ie(() => I(u)?.header?.())))])]),
698
- n[2] ||= x("hr", { class: "my-1 border-outline-variant" }, null, -1),
699
- (j(), v(ie(() => I(u)?.content?.())))
700
- ], 8, Te)) : (j(), b("div", De, [c.value ? (j(), b("div", Oe, [(j(!0), b(m, null, re(s.value, (e, t) => (j(), b("div", {
701
- key: t,
702
- class: "rounded-lg shadow-elevation-2"
703
- }, [x("div", ke, [(j(), v(ie(() => e)))])]))), 128))])) : P(t.$slots, "default", { close: Q }, void 0, void 0, 1)]))]),
704
- _: 3
705
- }, 8, ["onEnter", "onLeave"])], 36)], 2)], 6)) : y("", !0)]),
706
- _: 3
707
- })]))], 64));
708
- }
709
- }), je = ["data-m3-menu-choice"], Me = { class: "flex-1" }, Ne = {
710
- key: 3,
711
- class: "ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60"
712
- }, Pe = { class: "overflow-hidden rounded-xs bg-surface-container py-1" }, Fe = 32, Ie = /* @__PURE__ */ w({
713
- __name: "MMenuItem",
714
- props: {
715
- icon: {},
716
- shortcut: {},
717
- to: {},
718
- disabled: {
719
- type: Boolean,
720
- default: !1
721
- },
722
- danger: {
723
- type: Boolean,
724
- default: !1
725
- },
726
- keepOpen: {
727
- type: Boolean,
728
- default: void 0
729
- },
730
- selected: {
731
- type: Boolean,
732
- default: void 0
733
- },
734
- checked: {
735
- type: Boolean,
736
- default: void 0
737
- },
738
- selectedIcon: {}
739
- },
740
- emits: ["click", "update:checked"],
741
- setup(e, { emit: t }) {
742
- let n = e, i = t, o = oe(), s = _(() => n.checked !== void 0), l = _(() => s.value || n.selected !== void 0), u = _(() => !!(n.checked ?? n.selected)), d = _(() => l.value && !n.icon && !o.icon), p = _(() => n.selectedIcon ?? (n.icon ? void 0 : "check")), m = N("single");
743
- function S() {
744
- let e = z.value;
745
- if (!e || !l.value) return;
746
- let t = (e) => !!e?.hasAttribute("data-m3-menu-choice"), n = t(e.previousElementSibling), r = t(e.nextElementSibling);
747
- m.value = n && r ? "middle" : n ? "last" : r ? "first" : "single";
748
- }
749
- function w() {
750
- if (u.value) return [
751
- 12,
752
- 12,
753
- 12,
754
- 12
755
- ];
756
- let e = m.value === "first" ? 12 : 4, t = m.value === "last" ? 12 : 4;
757
- return [
758
- e,
759
- e,
760
- t,
761
- t
762
- ];
763
- }
764
- let { snap: T } = r(() => l.value ? [...w(), d.value && u.value ? Fe : 0] : [], ([e, t, n, r, i]) => {
765
- let a = B.value instanceof HTMLElement ? B.value : B.value?.$el;
766
- a && r !== void 0 && (a.style.borderRadius = `${e}px ${t}px ${n}px ${r}px`), V.value && i !== void 0 && (V.value.style.width = `${i}px`);
767
- }, c);
768
- L(m, () => T());
769
- let D = null;
770
- te(() => {
771
- S();
772
- let e = z.value?.parentElement;
773
- e && (D = new MutationObserver(S), D.observe(e, { childList: !0 }));
774
- }), ne(() => D?.disconnect()), L(l, () => O(S)), r(() => d.value ? [+!!u.value] : [], ([e]) => {
775
- V.value && e !== void 0 && (V.value.style.opacity = String(e));
776
- }, a);
777
- let ee = _(() => n.to ? "RouterLink" : "button"), M = _(() => !!o.children), re = E("m-menu-close", null), ae = E("m-menu-nav", null), z = N(), B = N(), V = N(), H = N(!1), U = N({});
778
- function se() {
779
- if (!z.value) return;
780
- let e = z.value.getBoundingClientRect();
781
- U.value = {
782
- position: "fixed",
783
- top: `${e.top}px`,
784
- left: `${e.right}px`,
785
- maxWidth: `${window.innerWidth - 16}px`,
786
- zIndex: "501"
787
- };
788
- }
789
- function W(e) {
790
- if (!z.value) return;
791
- let t = e, n = z.value.getBoundingClientRect();
792
- t.style.left = "0px";
793
- let r = t.offsetWidth, i = t.offsetHeight, a = Ce([n.right, n.left - r], r, window.innerWidth), o = Ce([n.top, n.bottom - i], i, window.innerHeight);
794
- U.value = {
795
- ...U.value,
796
- left: `${a}px`,
797
- top: `${o}px`
798
- }, t.style.left = `${a}px`, t.style.top = `${o}px`;
799
- }
800
- function G() {
801
- if (H.value) {
802
- H.value = !1;
803
- return;
804
- }
805
- se(), H.value = !0;
806
- }
807
- function K() {
808
- if (!n.disabled) {
809
- if (M.value) {
810
- ae?.mode === "push" ? ae.push({
811
- icon: n.icon,
812
- header: o.default,
813
- content: o.children
814
- }) : G();
815
- return;
816
- }
817
- s.value && i("update:checked", !n.checked), i("click"), (n.keepOpen ?? s.value) || re?.();
818
- }
819
- }
820
- function q(e) {
821
- e.pointerType === "mouse" && M.value && !n.disabled && (se(), H.value = !0);
822
- }
823
- function J(e) {
824
- e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (H.value = !1));
825
- }
826
- function Y(e) {
827
- if (e.pointerType !== "mouse") return;
828
- let t = e.relatedTarget;
829
- t?.closest(".m3-submenu") || z.value?.contains(t) || (H.value = !1);
830
- }
831
- return (t, n) => (j(), b("div", {
832
- ref_key: "itemEl",
833
- ref: z,
834
- "data-m3-menu-choice": l.value || void 0,
835
- onPointerenter: q,
836
- onPointerleave: J
837
- }, [(j(), v(ie(ee.value), {
838
- ref_key: "controlEl",
839
- ref: B,
840
- to: e.to || void 0,
841
- type: e.to ? void 0 : "button",
842
- role: l.value ? s.value ? "menuitemcheckbox" : "menuitemradio" : void 0,
843
- "aria-checked": l.value ? u.value : void 0,
844
- class: k(["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", l.value ? [
845
- "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",
846
- u.value ? "bg-tertiary-container text-on-tertiary-container" : "text-on-surface",
847
- e.disabled ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]"
848
- ] : [
849
- "w-full px-4",
850
- e.disabled ? "cursor-not-allowed opacity-[0.38] text-on-surface" : "cursor-pointer",
851
- !e.disabled && e.danger ? "text-error hover:bg-error/8" : "",
852
- !e.disabled && !e.danger ? "text-on-surface hover:bg-on-surface/8" : ""
853
- ]]),
854
- disabled: e.disabled || void 0,
855
- "aria-haspopup": M.value ? "menu" : void 0,
856
- "aria-expanded": M.value ? H.value : void 0,
857
- onClick: K
858
- }, {
859
- default: R(() => [
860
- d.value ? (j(), b("span", {
861
- key: 0,
862
- ref_key: "iconSlotEl",
863
- ref: V,
864
- class: "-mr-3 flex shrink-0 overflow-hidden",
865
- style: {
866
- width: "0",
867
- opacity: "0"
868
- }
869
- }, [C(f, {
870
- name: p.value,
871
- size: 20,
872
- class: "shrink-0"
873
- }, null, 8, ["name"])], 512)) : t.$slots.icon ? (j(), b("span", {
874
- key: 1,
875
- class: k(["flex size-5 shrink-0 items-center justify-center", l.value ? u.value ? "" : "text-on-surface-variant" : e.danger ? "text-error" : "text-on-surface-variant"])
876
- }, [P(t.$slots, "icon", { on: u.value })], 2)) : e.icon ? (j(), v(f, {
877
- key: 2,
878
- name: u.value && p.value ? p.value : e.icon,
879
- filled: u.value && !p.value,
880
- size: 20,
881
- class: k(["shrink-0", l.value ? u.value ? "" : "text-on-surface-variant" : e.danger ? "text-error" : "text-on-surface-variant"])
882
- }, null, 8, [
883
- "name",
884
- "filled",
885
- "class"
886
- ])) : y("", !0),
887
- x("span", Me, [P(t.$slots, "default")]),
888
- e.shortcut && !M.value ? (j(), b("span", Ne, F(e.shortcut), 1)) : y("", !0),
889
- M.value ? (j(), v(f, {
890
- key: 4,
891
- name: "chevron_right",
892
- size: 18,
893
- class: "shrink-0 text-on-surface-variant"
894
- })) : y("", !0)
895
- ]),
896
- _: 3
897
- }, 8, [
898
- "to",
899
- "type",
900
- "role",
901
- "aria-checked",
902
- "class",
903
- "disabled",
904
- "aria-haspopup",
905
- "aria-expanded"
906
- ])), M.value && I(ae)?.mode !== "push" ? (j(), v(h, {
907
- key: 0,
908
- to: "body"
909
- }, [C(g, {
910
- "enter-active-class": "transition-opacity duration-100",
911
- "enter-from-class": "opacity-0",
912
- "leave-active-class": "transition-opacity duration-75",
913
- "leave-to-class": "opacity-0",
914
- onEnter: W
915
- }, {
916
- default: R(() => [H.value ? (j(), b("div", {
917
- key: 0,
918
- class: "m3-submenu min-w-44 rounded-xs shadow-elevation-2",
919
- style: A(U.value),
920
- onPointerleave: Y
921
- }, [x("div", Pe, [P(t.$slots, "children")])], 36)) : y("", !0)]),
922
- _: 3
923
- })])) : y("", !0)], 40, je));
924
- }
925
- });
926
- //#endregion
927
- export { Se as a, K as c, Ce as i, W as l, Ae as n, ge as o, we as r, Q as s, Ie as t };
928
-
929
- //# sourceMappingURL=MMenuItem-D4Gx_l3F.js.map