@m3ui-vue/m3ui-vue 1.1.4 → 1.2.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.
- package/dist/API.md +511 -34
- package/dist/MMenuItem-DI351kIf.js +929 -0
- package/dist/MMenuItem-DI351kIf.js.map +1 -0
- package/dist/{MSlider-JflHJ70q.js → MSlider-BnEy5ieZ.js} +295 -320
- package/dist/MSlider-BnEy5ieZ.js.map +1 -0
- package/dist/MTextField-BBmkaIbO.js +633 -0
- package/dist/MTextField-BBmkaIbO.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +83 -49
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MButton.vue.d.ts +7 -1
- package/dist/components/MButtonGroup.vue.d.ts +40 -31
- package/dist/components/MCarousel.vue.d.ts +2 -0
- package/dist/components/MChart.vue.d.ts +6 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +5 -3
- package/dist/components/MContextMenu.vue.d.ts +2 -2
- package/dist/components/MCopyButton.vue.d.ts +1 -1
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +1 -1
- package/dist/components/MIconButton.vue.d.ts +13 -1
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MMap.vue.d.ts +20 -2
- package/dist/components/MMapBaseLayers.vue.d.ts +3 -0
- package/dist/components/MMapFilter.vue.d.ts +3 -0
- package/dist/components/MMapLayers.vue.d.ts +3 -0
- package/dist/components/MMenu.vue.d.ts +2 -2
- package/dist/components/MMenuItem.vue.d.ts +7 -3
- package/dist/components/MNavigationDrawer.vue.d.ts +13 -2
- package/dist/components/MOverlay.vue.d.ts +12 -1
- package/dist/components/MProgressBar.vue.d.ts +5 -3
- package/dist/components/MPullToRefresh.vue.d.ts +7 -2
- package/dist/components/MRichTextEditor.vue.d.ts +7 -1
- package/dist/components/MSearchField.vue.d.ts +58 -0
- package/dist/components/MSegmentedButton.vue.d.ts +31 -23
- package/dist/components/MSimpleCarousel.vue.d.ts +2 -0
- package/dist/components/MSkeleton.vue.d.ts +6 -3
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +5 -1
- package/dist/components/MTimeline.vue.d.ts +85 -22
- package/dist/components/MTooltip.vue.d.ts +1 -1
- package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
- package/dist/composables/_mapStyle.d.ts +13 -0
- package/dist/composables/_themeTransition.d.ts +2 -0
- package/dist/composables/_tooltipTrigger.d.ts +22 -0
- package/dist/composables/_useMenuNav.d.ts +28 -0
- package/dist/composables/useAutoGrow.d.ts +21 -0
- package/dist/composables/useColorPalette.d.ts +1 -1
- package/dist/composables/useLocale.d.ts +3 -0
- package/dist/composables/useMap.d.ts +19 -3
- package/dist/composables/useMapFilter.d.ts +4 -1
- package/dist/composables/useMapLayers.d.ts +5 -2
- package/dist/composables/useScrollReveal.d.ts +44 -0
- package/dist/composables/useThemeTokens.d.ts +21 -0
- package/dist/composables/viewportHints.d.ts +27 -0
- package/dist/directives/vClickOutside.d.ts +25 -0
- package/dist/directives/vFocusRing.d.ts +22 -0
- package/dist/directives/vLongPress.d.ts +27 -0
- package/dist/directives/vReveal.d.ts +10 -0
- package/dist/directives/vScrollElevation.d.ts +31 -0
- package/dist/directives/vSkeleton.d.ts +19 -0
- package/dist/directives/vStateLayer.d.ts +20 -0
- package/dist/directives/vSwipe.d.ts +45 -0
- package/dist/directives/vTooltip.d.ts +23 -0
- package/dist/index.d.ts +28 -1
- package/dist/locales/index.js +21 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7132 -6217
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js +821 -791
- package/dist/map.js.map +1 -1
- package/dist/motion-DZiXG09o.js +150 -0
- package/dist/motion-DZiXG09o.js.map +1 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/rich-text-editor.js +13 -9
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles/theme.css +63 -0
- package/dist/styles.css +1 -1
- package/dist/{useLocale-CXibICQA.js → useLocale-JYxDDeXC.js} +4 -2
- package/dist/useLocale-JYxDDeXC.js.map +1 -0
- package/dist/useThemeTokens-Bv-Uv8eX.js +135 -0
- package/dist/useThemeTokens-Bv-Uv8eX.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MButton.test.ts +22 -0
- package/src/__tests__/MCarousel.test.ts +9 -0
- package/src/__tests__/MChart.test.ts +77 -5
- package/src/__tests__/MIconButton.test.ts +33 -0
- package/src/__tests__/MMap.test.ts +53 -1
- package/src/__tests__/MMapLayers.test.ts +46 -2
- package/src/__tests__/MMenu.test.ts +104 -1
- package/src/__tests__/MMenuItem.test.ts +18 -0
- package/src/__tests__/MNavigationDrawer.test.ts +80 -0
- package/src/__tests__/MOverlay.test.ts +49 -0
- package/src/__tests__/MProgressBar.test.ts +41 -0
- package/src/__tests__/MPullToRefresh.test.ts +33 -0
- package/src/__tests__/MRichTextEditor.test.ts +22 -0
- package/src/__tests__/MSearchField.test.ts +71 -0
- package/src/__tests__/MSegmentedButton.test.ts +10 -0
- package/src/__tests__/MSkeleton.test.ts +38 -0
- package/src/__tests__/MTimeline.test.ts +238 -0
- package/src/__tests__/_fakeMaplibre.ts +3 -1
- package/src/__tests__/attrsFallthrough.test.ts +3 -0
- package/src/__tests__/escapeStack.test.ts +93 -0
- package/src/__tests__/ssr.test.ts +21 -2
- package/src/__tests__/useAutoGrow.test.ts +103 -0
- package/src/__tests__/useScrollReveal.test.ts +102 -0
- package/src/__tests__/useThemeTokens.test.ts +114 -0
- package/src/__tests__/vClickOutside.test.ts +82 -0
- package/src/__tests__/vFocusRing.test.ts +36 -0
- package/src/__tests__/vLongPress.test.ts +81 -0
- package/src/__tests__/vScrollElevation.test.ts +89 -0
- package/src/__tests__/vSkeleton.test.ts +48 -0
- package/src/__tests__/vStateLayer.test.ts +53 -0
- package/src/__tests__/vSwipe.test.ts +93 -0
- package/src/__tests__/vTooltip.test.ts +95 -0
- package/src/__tests__/viewportHints.test.ts +41 -0
- package/src/components/MAutocomplete.vue +5 -0
- package/src/components/MBottomSheet.vue +4 -1
- package/src/components/MButton.vue +15 -1
- package/src/components/MButtonGroup.vue +22 -17
- package/src/components/MCarousel.vue +7 -1
- package/src/components/MChart.vue +74 -34
- package/src/components/MCircleProgressBar.vue +14 -9
- package/src/components/MCommandPalette.vue +3 -2
- package/src/components/MContextMenu.vue +19 -60
- package/src/components/MDragDropList.vue +2 -0
- package/src/components/MIconButton.vue +40 -1
- package/src/components/MKanban.vue +2 -0
- package/src/components/MLightbox.vue +7 -2
- package/src/components/MMap.vue +38 -5
- package/src/components/MMapBaseLayers.vue +7 -3
- package/src/components/MMapFilter.vue +7 -4
- package/src/components/MMapGeoJson.vue +1 -1
- package/src/components/MMapLayers.vue +6 -2
- package/src/components/MMapMeasure.vue +5 -2
- package/src/components/MMenu.vue +18 -59
- package/src/components/MMenuItem.vue +11 -2
- package/src/components/MMultiAutocomplete.vue +5 -0
- package/src/components/MNavigationDrawer.vue +96 -11
- package/src/components/MNavigationRail.vue +4 -15
- package/src/components/MOverlay.vue +32 -13
- package/src/components/MProgressBar.vue +25 -27
- package/src/components/MPullToRefresh.vue +20 -1
- package/src/components/MRichTextEditor.vue +19 -5
- package/src/components/MSearchBar.vue +5 -0
- package/src/components/MSearchField.vue +142 -0
- package/src/components/MSegmentedButton.vue +20 -18
- package/src/components/MSelect.vue +10 -1
- package/src/components/MSideSheet.vue +5 -2
- package/src/components/MSimpleCarousel.vue +10 -1
- package/src/components/MSkeleton.vue +30 -8
- package/src/components/MSpotlightSearch.vue +3 -2
- package/src/components/MTextField.vue +15 -2
- package/src/components/MTimeline.vue +370 -81
- package/src/components/MTooltip.vue +20 -152
- package/src/components/_MDrawerItemList.vue +25 -6
- package/src/composables/_mapStyle.ts +45 -0
- package/src/composables/_themeTransition.ts +2 -0
- package/src/composables/_tooltipTrigger.ts +184 -0
- package/src/composables/_useMenuNav.ts +209 -0
- package/src/composables/useAutoGrow.ts +78 -0
- package/src/composables/useLocale.ts +5 -0
- package/src/composables/useMap.ts +43 -5
- package/src/composables/useMapFilter.ts +6 -5
- package/src/composables/useMapLayers.ts +7 -6
- package/src/composables/useScrollReveal.ts +151 -0
- package/src/composables/useThemeTokens.ts +116 -0
- package/src/composables/viewportHints.ts +80 -0
- package/src/directives/vClickOutside.ts +90 -0
- package/src/directives/vFocusRing.ts +60 -0
- package/src/directives/vLongPress.ts +134 -0
- package/src/directives/vReveal.ts +57 -0
- package/src/directives/vScrollElevation.ts +116 -0
- package/src/directives/vSkeleton.ts +87 -0
- package/src/directives/vStateLayer.ts +83 -0
- package/src/directives/vSwipe.ts +197 -0
- package/src/directives/vTooltip.ts +128 -0
- package/src/index.ts +28 -1
- package/src/locales/de.ts +2 -0
- package/src/locales/es.ts +2 -0
- package/src/locales/fr.ts +2 -0
- package/src/locales/ja.ts +2 -0
- package/src/locales/ko.ts +2 -0
- package/src/locales/pt.ts +2 -0
- package/src/locales/zh.ts +2 -0
- package/src/map.ts +1 -1
- package/src/plugin.ts +34 -0
- package/src/styles/theme.css +63 -0
- package/dist/MMenuItem-BfjqwcYP.js +0 -830
- package/dist/MMenuItem-BfjqwcYP.js.map +0 -1
- package/dist/MSlider-JflHJ70q.js.map +0 -1
- package/dist/MTextField-NaIB6RbM.js +0 -673
- package/dist/MTextField-NaIB6RbM.js.map +0 -1
- package/dist/composables/_useThemeTokens.d.ts +0 -7
- package/dist/useLocale-CXibICQA.js.map +0 -1
- package/src/composables/_useThemeTokens.ts +0 -42
|
@@ -0,0 +1,929 @@
|
|
|
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-BBmkaIbO.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-DI351kIf.js.map
|