@m3ui-vue/m3ui-vue 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +42 -15
- package/dist/{MTextField-TZ7lfr09.js → MTextField-BPbFeI9M.js} +76 -73
- package/dist/MTextField-BPbFeI9M.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +9 -6
- package/dist/components/MShader.vue.d.ts +9 -3
- package/dist/components/MTransition.vue.d.ts +0 -9
- package/dist/composables/_hydration.d.ts +4 -0
- package/dist/composables/_springAnimation.d.ts +17 -0
- package/dist/composables/themeInitScript.d.ts +21 -0
- package/dist/composables/useColorPalette.d.ts +4 -0
- package/dist/composables/useTheme.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +3017 -2782
- package/dist/m3ui.js.map +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/rich-text-editor.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/__tests__/MAppBarWithSearch.test.ts +12 -0
- package/src/__tests__/MBottomSheetScaffold.test.ts +21 -0
- package/src/__tests__/MNavigationDrawer.test.ts +185 -0
- package/src/__tests__/MNavigationRail.test.ts +17 -1
- package/src/__tests__/MPullToRefresh.test.ts +18 -1
- package/src/__tests__/MShader.test.ts +16 -0
- package/src/__tests__/MTransition.test.ts +12 -0
- package/src/__tests__/hydration.test.ts +86 -0
- package/src/__tests__/sheets.test.ts +19 -15
- package/src/__tests__/ssr.test.ts +109 -0
- package/src/__tests__/themeInitScript.test.ts +104 -0
- package/src/components/MBottomSheetScaffold.vue +23 -2
- package/src/components/MChart.vue +3 -2
- package/src/components/MContextMenu.vue +34 -33
- package/src/components/MLightbox.vue +6 -1
- package/src/components/MMenu.vue +34 -33
- package/src/components/MNavigationDrawer.vue +297 -37
- package/src/components/MNavigationRail.vue +69 -15
- package/src/components/MPullToRefresh.vue +18 -0
- package/src/components/MSearchBar.vue +8 -4
- package/src/components/MShader.vue +11 -3
- package/src/components/MTransition.vue +36 -41
- package/src/composables/_hydration.ts +10 -0
- package/src/composables/_springAnimation.ts +74 -0
- package/src/composables/_useSheetMotion.ts +101 -88
- package/src/composables/themeInitScript.ts +49 -0
- package/src/composables/useColorPalette.ts +10 -6
- package/src/composables/useTheme.ts +12 -6
- package/src/composables/useWindowSizeClass.ts +14 -4
- package/src/index.ts +2 -0
- package/src/plugin.ts +24 -11
- package/dist/MTextField-TZ7lfr09.js.map +0 -1
package/dist/API.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @m3ui-vue/m3ui-vue 1.0.
|
|
1
|
+
# @m3ui-vue/m3ui-vue 1.0.2 — API reference
|
|
2
2
|
|
|
3
3
|
Material Design 3 components for Vue 3 + Tailwind CSS v4. Generated from the source by
|
|
4
4
|
`scripts/generate-api.mjs`; full docs with live demos at https://m3ui.dev.
|
|
@@ -169,7 +169,7 @@ Props:
|
|
|
169
169
|
- `clearable?: boolean = false` — Show a clear button
|
|
170
170
|
- `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
|
|
171
171
|
- `noResultsText?: string` — Text when no options match
|
|
172
|
-
- `debounce?: number = 0` — Delay (ms) before filtering and firing
|
|
172
|
+
- `debounce?: number = 0` — Delay (ms) before filtering and firing @debounced. Selection is always instant
|
|
173
173
|
|
|
174
174
|
Events:
|
|
175
175
|
- `update:modelValue(unknown)` — Emitted on selection — powers v-model
|
|
@@ -1496,7 +1496,7 @@ Props:
|
|
|
1496
1496
|
- `value?: string | number` — Selection value — compared against the parent MList selected prop
|
|
1497
1497
|
- `active?: boolean = false` — Force the active/highlighted state regardless of parent list selection
|
|
1498
1498
|
- `disabled?: boolean = false` — Disabled state (38% opacity, blocks interaction)
|
|
1499
|
-
- `clickable?: boolean` — Force interactive styling/behavior (auto-true when href, to,
|
|
1499
|
+
- `clickable?: boolean` — Force interactive styling/behavior (auto-true when href, to, @click, selectable, or expandable apply)
|
|
1500
1500
|
- `href?: string` — Link URL — renders the item as an `<a>`
|
|
1501
1501
|
- `to?: string | object` — Vue Router destination — renders the item as a router-link
|
|
1502
1502
|
- `expandable?: boolean = false` — Show an expand/collapse chevron revealing the #children slot
|
|
@@ -1585,7 +1585,7 @@ Props:
|
|
|
1585
1585
|
- `leadingIcon?: string` — Material Symbol icon
|
|
1586
1586
|
- `clearable?: boolean = false` — Show clear button
|
|
1587
1587
|
- `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
|
|
1588
|
-
- `debounce?: number = 0` — Delay (ms) before firing the
|
|
1588
|
+
- `debounce?: number = 0` — Delay (ms) before firing the @debounced event
|
|
1589
1589
|
|
|
1590
1590
|
Events:
|
|
1591
1591
|
- `update:modelValue(string)` — Emitted on every keystroke — powers v-model
|
|
@@ -1678,7 +1678,7 @@ Props:
|
|
|
1678
1678
|
- `maxChips?: number = 3` — Max visible chips before "+N"
|
|
1679
1679
|
- `noResultsText?: string` — Text when no options match
|
|
1680
1680
|
- `hideSelected?: boolean = false` — Remove already-selected options from the dropdown
|
|
1681
|
-
- `debounce?: number = 0` — Delay (ms) before filtering and firing
|
|
1681
|
+
- `debounce?: number = 0` — Delay (ms) before filtering and firing @debounced. Selection is always instant
|
|
1682
1682
|
|
|
1683
1683
|
Events:
|
|
1684
1684
|
- `update:modelValue(unknown[])` — Emitted on selection change — powers v-model
|
|
@@ -1746,7 +1746,7 @@ export interface NavBarItem {
|
|
|
1746
1746
|
|
|
1747
1747
|
### MNavigationDrawer
|
|
1748
1748
|
|
|
1749
|
-
A slide-out or inline drawer of grouped, badge-able, optionally-nested navigation items — modal (Teleported, scrim-backed) or inline (participates in layout, supports a collapsed icon-only mode).
|
|
1749
|
+
A slide-out or inline drawer of grouped, badge-able, optionally-nested navigation items — modal (Teleported, scrim-backed, swiped closed toward its edge) or inline (participates in layout, supports a collapsed icon-only mode).
|
|
1750
1750
|
|
|
1751
1751
|
Props:
|
|
1752
1752
|
- `modelValue: boolean` (v-model) — Open/closed state (v-model)
|
|
@@ -1757,6 +1757,7 @@ Props:
|
|
|
1757
1757
|
- `collapsed?: boolean` — Compact mode (72px) showing only icons — inline variant only
|
|
1758
1758
|
- `width?: string` — Custom drawer width (e.g. "320px", "25rem"). Defaults to 22.5rem (360px)
|
|
1759
1759
|
- `side?: "top" | "right" | "bottom" | "left" = "left"` — Which side the drawer opens from. Top/bottom are only available for the modal variant — the inline variant always renders on left or right.
|
|
1760
|
+
- `swipeEnabled?: boolean = true` — Lets the modal drawer be swiped closed toward its edge; with false it only closes through v-model or the scrim
|
|
1760
1761
|
|
|
1761
1762
|
Events:
|
|
1762
1763
|
- `update:modelValue(boolean)` — Open/closed state for v-model
|
|
@@ -1880,7 +1881,7 @@ Props:
|
|
|
1880
1881
|
- `leadingIcon?: string` — Material Symbol icon
|
|
1881
1882
|
- `stepper?: boolean = true` — Show +/- buttons
|
|
1882
1883
|
- `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
|
|
1883
|
-
- `debounce?: number = 0` — Delay (ms) before firing the
|
|
1884
|
+
- `debounce?: number = 0` — Delay (ms) before firing the @debounced event
|
|
1884
1885
|
|
|
1885
1886
|
Events:
|
|
1886
1887
|
- `update:modelValue(number | null)` — Emitted on every change — typing, stepper clicks, or arrow keys — powers v-model
|
|
@@ -1975,7 +1976,7 @@ Props:
|
|
|
1975
1976
|
Wraps its own scrollable container and fires a refresh event when the user pulls past a threshold at the very top of the scroll.
|
|
1976
1977
|
|
|
1977
1978
|
Props:
|
|
1978
|
-
- `refreshing?: boolean = false` — Controlled loading state — set it to true in your
|
|
1979
|
+
- `refreshing?: boolean = false` — Controlled loading state — set it to true in your @refresh handler and back to false once the fetch resolves; the indicator settles and releases accordingly, same pattern as MInfiniteScroll's loading prop
|
|
1979
1980
|
- `disabled?: boolean = false` — Disables the pull gesture
|
|
1980
1981
|
- `threshold?: number = 64` — Pull distance in px required to trigger a refresh on release
|
|
1981
1982
|
- `size?: number = 36` — Indicator size in px
|
|
@@ -2232,7 +2233,7 @@ Slots:
|
|
|
2232
2233
|
|
|
2233
2234
|
### MSearchBar
|
|
2234
2235
|
|
|
2235
|
-
A collapsed search field that expands into a docked panel or a fullscreen overlay, with results shown below the input.
|
|
2236
|
+
A collapsed search field that expands into a docked panel or a fullscreen overlay, with results shown below the input. The expanded panel is teleported to `<body>`; `class`, `style` and other attributes you pass land on the collapsed bar. So with a fullscreen variant you can hide the bar (e.g. `class="hidden"` on phones) and open search from your own icon button through `v-model:expanded`. The docked panel is placed under the bar, so it needs the bar visible.
|
|
2236
2237
|
|
|
2237
2238
|
Props:
|
|
2238
2239
|
- `modelValue?: string = ""` (v-model) — Search query (v-model)
|
|
@@ -2333,12 +2334,12 @@ export interface SelectOption {
|
|
|
2333
2334
|
A canvas container for hand-written shaders. Give it a GLSL fragment shader (Shadertoy-style — it runs on WebGL2 and works everywhere) and, optionally, a WGSL fragment shader that runs on WebGPU when the browser supports it. `renderer="auto"` picks WebGPU whenever both a `wgsl` source and browser support are present, otherwise it falls back to WebGL2 — so the same component works as a drop-in on old and new browsers alike.
|
|
2334
2335
|
|
|
2335
2336
|
Props:
|
|
2336
|
-
- `code: string` — GLSL fragment shader body (Shadertoy-style): must define `mainImage(out vec4 fragColor, in vec2 fragCoord)`. Runs on WebGL2. Always required as the compatible baseline.
|
|
2337
|
-
- `wgsl?: string` — Optional WGSL fragment shader module, e.g. `@fragment fn fs_main(@builtin(position) pos: vec4f) ->
|
|
2337
|
+
- `code: string` — GLSL fragment shader body (Shadertoy-style): must define `mainImage(out vec4 fragColor, in vec2 fragCoord)`. Runs on WebGL2. Always required as the compatible baseline. Don't write the `#version`, the precision or any uniform: the component puts them in front of your code, with Shadertoy's `iTime` (seconds, stops while paused), `iResolution` (canvas size in device pixels), `iMouse` and `iFrame`, plus one per `uniforms` key.
|
|
2338
|
+
- `wgsl?: string` — Optional WGSL fragment shader module, e.g. `@fragment fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f`. Runs on WebGPU when available. Must declare its own bindings — see docs for the required uniform buffer layout.
|
|
2338
2339
|
- `renderer?: ShaderRenderer = "auto"` — Which backend to use. 'auto' picks WebGPU when `wgsl` is set and supported, else WebGL2.
|
|
2339
|
-
- `uniforms?: Record<string, number | number[]>` — Custom uniforms. Keys
|
|
2340
|
+
- `uniforms?: Record<string, number | number[]>` — Custom uniforms, read every frame. In GLSL each key is declared for you, as a `float` for a number or a `vec2`–`vec4` for an array; in WGSL they're binding 1, one `vec4f` per key in this order. Keys and shapes are fixed when the shader compiles (on mount, or when `code`/`wgsl`/`renderer` change); values can change freely, e.g. to drive the shader from your own clock instead of `iTime`.
|
|
2340
2341
|
- `paused?: boolean` — Freezes the render loop and the shader clock
|
|
2341
|
-
- `pixelRatio?: number` — Device pixel
|
|
2342
|
+
- `pixelRatio?: number` — Device pixels per CSS pixel to render at. Defaults to devicePixelRatio, capped at 2 for performance. Lower it to render fewer pixels (a "quality" setting); the canvas is resized when it changes.
|
|
2342
2343
|
|
|
2343
2344
|
Events:
|
|
2344
2345
|
- `error(message: string)` — Emitted on a shader compile/link error, or a WebGPU runtime error
|
|
@@ -2843,7 +2844,7 @@ Props:
|
|
|
2843
2844
|
- `maxTags?: number` — Max number of tags allowed
|
|
2844
2845
|
- `duplicates?: boolean = false` — Allow duplicate tags
|
|
2845
2846
|
- `clearable?: boolean = false` — Show a clear-all button
|
|
2846
|
-
- `debounce?: number = 0` — Delay (ms) before firing the
|
|
2847
|
+
- `debounce?: number = 0` — Delay (ms) before firing the @debounced event
|
|
2847
2848
|
|
|
2848
2849
|
Events:
|
|
2849
2850
|
- `update:modelValue(string[])` — Emitted whenever a tag is added or removed — powers v-model
|
|
@@ -2916,7 +2917,7 @@ Props:
|
|
|
2916
2917
|
- `leadingIcon?: string` — Material Symbol shown before the input
|
|
2917
2918
|
- `clearable?: boolean = false` — Show a clear button when the field has a value
|
|
2918
2919
|
- `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
|
|
2919
|
-
- `debounce?: number = 0` — Delay (ms) before firing the
|
|
2920
|
+
- `debounce?: number = 0` — Delay (ms) before firing the @debounced event. v-model always updates immediately
|
|
2920
2921
|
|
|
2921
2922
|
Events:
|
|
2922
2923
|
- `update:modelValue(string)` — Emitted on every keystroke — powers v-model
|
|
@@ -3349,6 +3350,14 @@ The palette id used while a seed color is active (`useColorPalette().setSeed()`)
|
|
|
3349
3350
|
SEED_PALETTE: "seed"
|
|
3350
3351
|
```
|
|
3351
3352
|
|
|
3353
|
+
### themeInitScript
|
|
3354
|
+
|
|
3355
|
+
A script to inline in `<head>` of a server-rendered page (Nuxt, Vite SSR), so dark mode, the palette and the contrast level are on `<html>` before the first paint instead of when the app's JS loads. It does what `useTheme` and `useColorPalette` do when they load in the browser (the stored choice, or the given `createM3UI` defaults), so pass it the same options as the plugin. A `seed` default can't be generated this early: its first visit still shows the baseline until the app loads (later visits use the cached CSS). ```ts useHead({ script: [{ innerHTML: themeInitScript({ palette: 'red' }) }] }) ```
|
|
3356
|
+
|
|
3357
|
+
```ts
|
|
3358
|
+
themeInitScript(options: ThemeInitOptions = {}): string
|
|
3359
|
+
```
|
|
3360
|
+
|
|
3352
3361
|
### generateScheme
|
|
3353
3362
|
|
|
3354
3363
|
Generates the light and dark schemes for a seed color (`#rrggbb`).
|
|
@@ -3615,6 +3624,13 @@ export interface M3UIOptions {
|
|
|
3615
3624
|
* mode (they keep their own dark bar); installed apps (PWA) still get it.
|
|
3616
3625
|
*/
|
|
3617
3626
|
themeColor?: 'surface' | 'surface-container' | 'primary' | (string & {})
|
|
3627
|
+
/**
|
|
3628
|
+
* Server-side rendering: tells the components whether the app is still hydrating the server's HTML (Nuxt's
|
|
3629
|
+
* `() => nuxtApp.isHydrating`, which `@m3ui-vue/nuxt` passes). The adaptive layouts (`MNavigationSuite`,
|
|
3630
|
+
* `MListDetail`, `MSupportingPane`) and `useWindowSizeClass()` then render their first frame at the server's size
|
|
3631
|
+
* (compact: it has no window) so it matches the HTML, and adapt once mounted.
|
|
3632
|
+
*/
|
|
3633
|
+
isHydrating?: () => boolean
|
|
3618
3634
|
}
|
|
3619
3635
|
```
|
|
3620
3636
|
|
|
@@ -3649,6 +3665,17 @@ export interface ActiveSeed extends SeedOptions {
|
|
|
3649
3665
|
export type ContrastLevel = 'standard' | 'medium' | 'high' | 'system'
|
|
3650
3666
|
```
|
|
3651
3667
|
|
|
3668
|
+
```ts
|
|
3669
|
+
export interface ThemeInitOptions {
|
|
3670
|
+
/** `createM3UI`'s `palette`: the first-visit default, or forced with `persistPalette: false`. */
|
|
3671
|
+
palette?: string
|
|
3672
|
+
/** `createM3UI`'s `contrast`, with the same rules as `palette`. */
|
|
3673
|
+
contrast?: ContrastLevel
|
|
3674
|
+
/** `createM3UI`'s `persistPalette`. */
|
|
3675
|
+
persistPalette?: boolean
|
|
3676
|
+
}
|
|
3677
|
+
```
|
|
3678
|
+
|
|
3652
3679
|
```ts
|
|
3653
3680
|
// Dynamic color: a full M3 color scheme (light and dark) generated from one seed color with Google's
|
|
3654
3681
|
// material-color-utilities (HCT, DynamicScheme). The package is loaded with a dynamic import, so apps that
|
|
@@ -32,14 +32,14 @@ var I = /* @__PURE__ */ new WeakMap(), L = {
|
|
|
32
32
|
let t = I.get(e);
|
|
33
33
|
t && e.removeEventListener("pointerdown", t.onPointerDown), I.delete(e);
|
|
34
34
|
}
|
|
35
|
-
}, R = ["aria-label"],
|
|
35
|
+
}, R = ["aria-label"], ne = {
|
|
36
36
|
key: 0,
|
|
37
37
|
class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
38
|
-
},
|
|
38
|
+
}, z = [
|
|
39
39
|
"width",
|
|
40
40
|
"height",
|
|
41
41
|
"viewBox"
|
|
42
|
-
],
|
|
42
|
+
], B = ["d", "stroke-dasharray"], V = 3, H = 9, U = /* @__PURE__ */ p({
|
|
43
43
|
__name: "MSpinner",
|
|
44
44
|
props: {
|
|
45
45
|
size: { default: 20 },
|
|
@@ -50,10 +50,10 @@ var I = /* @__PURE__ */ new WeakMap(), L = {
|
|
|
50
50
|
label: {}
|
|
51
51
|
},
|
|
52
52
|
setup(t) {
|
|
53
|
-
let n = t, r = e(), i = o(() => (n.size / 2 - 1 -
|
|
53
|
+
let n = t, r = e(), i = o(() => (n.size / 2 - 1 - V / 2) / 1.25), a = o(() => n.size / 2), s = o(() => {
|
|
54
54
|
let e = a.value, t = i.value, n = t * .08, r = [], o = 0, s = 0, c = 0;
|
|
55
55
|
for (let i = 0; i <= 216; i++) {
|
|
56
|
-
let a = 2 * Math.PI * i / 216 - Math.PI / 2, l = t + n * Math.sin(
|
|
56
|
+
let a = 2 * Math.PI * i / 216 - Math.PI / 2, l = t + n * Math.sin(H * a), u = e + l * Math.cos(a), d = e + l * Math.sin(a);
|
|
57
57
|
i > 0 && (o += Math.sqrt((u - s) ** 2 + (d - c) ** 2)), r.push(`${i === 0 ? "M" : "L"}${u.toFixed(2)},${d.toFixed(2)}`), s = u, c = d;
|
|
58
58
|
}
|
|
59
59
|
let l = o * .58, u = o - l, d = `${l.toFixed(1)} ${u.toFixed(1)}`;
|
|
@@ -82,14 +82,14 @@ var I = /* @__PURE__ */ new WeakMap(), L = {
|
|
|
82
82
|
}, [u("path", {
|
|
83
83
|
d: s.value.path,
|
|
84
84
|
stroke: "currentColor",
|
|
85
|
-
"stroke-width":
|
|
85
|
+
"stroke-width": V,
|
|
86
86
|
"stroke-linecap": "round",
|
|
87
87
|
"stroke-dasharray": s.value.dash,
|
|
88
88
|
class: "animate-[m3-wavy-travel_2s_linear_infinite]",
|
|
89
89
|
style: v({ "--m3-wave-len": s.value.len })
|
|
90
|
-
}, null, 12,
|
|
90
|
+
}, null, 12, B)], 12, z)) : (S(), l("span", ne))], 12, R));
|
|
91
91
|
}
|
|
92
|
-
}),
|
|
92
|
+
}), re = [
|
|
93
93
|
"bg-surface-container-highest",
|
|
94
94
|
"bg-surface-container-high",
|
|
95
95
|
"bg-surface-container-low",
|
|
@@ -116,8 +116,8 @@ var I = /* @__PURE__ */ new WeakMap(), L = {
|
|
|
116
116
|
"bg-tertiary",
|
|
117
117
|
"bg-error"
|
|
118
118
|
];
|
|
119
|
-
function
|
|
120
|
-
for (let t of
|
|
119
|
+
function W(e) {
|
|
120
|
+
for (let t of re) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
function G(e) {
|
|
@@ -137,7 +137,7 @@ function K(e, t) {
|
|
|
137
137
|
function i() {
|
|
138
138
|
let t = e.value?.parentElement ?? null;
|
|
139
139
|
for (; t;) {
|
|
140
|
-
let e =
|
|
140
|
+
let e = W(t);
|
|
141
141
|
if (e) {
|
|
142
142
|
r(e);
|
|
143
143
|
return;
|
|
@@ -630,7 +630,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
630
630
|
style: v(d.value)
|
|
631
631
|
}, {
|
|
632
632
|
default: M(() => [
|
|
633
|
-
e.iconPos === "leading" ? (S(), l(r, { key: 0 }, [e.loading ? (S(), s(
|
|
633
|
+
e.iconPos === "leading" ? (S(), l(r, { key: 0 }, [e.loading ? (S(), s(U, {
|
|
634
634
|
key: 0,
|
|
635
635
|
size: b.value
|
|
636
636
|
}, null, 8, ["size"])) : e.icon ? (S(), s(t, {
|
|
@@ -639,7 +639,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
639
639
|
size: y.value
|
|
640
640
|
}, null, 8, ["name", "size"])) : c("", !0)], 64)) : c("", !0),
|
|
641
641
|
E(n.$slots, "default"),
|
|
642
|
-
e.iconPos === "trailing" ? (S(), l(r, { key: 1 }, [e.loading ? (S(), s(
|
|
642
|
+
e.iconPos === "trailing" ? (S(), l(r, { key: 1 }, [e.loading ? (S(), s(U, {
|
|
643
643
|
key: 0,
|
|
644
644
|
size: b.value
|
|
645
645
|
}, null, 8, ["size"])) : e.icon ? (S(), s(t, {
|
|
@@ -856,39 +856,42 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
856
856
|
alpha: 1
|
|
857
857
|
}), L = e, e;
|
|
858
858
|
}
|
|
859
|
-
let
|
|
860
|
-
function
|
|
861
|
-
|
|
862
|
-
let r = e, i = R(), a = i.length - 1, o =
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
l = requestAnimationFrame(f);
|
|
859
|
+
let ne = 0, z = null, B = null;
|
|
860
|
+
function V(e, t, n) {
|
|
861
|
+
z?.();
|
|
862
|
+
let r = e, i = R(), a = i.length - 1, o = Math.round(Math.max(0, Math.min(a, ne))), s = n ? a : 0, c = n ? 1 : -1, l = [];
|
|
863
|
+
for (let e = o; n ? e <= s : e >= s; e += c) l.push(i[e]);
|
|
864
|
+
let u = (e) => ({
|
|
865
|
+
transform: `scale(${e.scale})`,
|
|
866
|
+
opacity: String(Math.min(1, Math.max(0, e.alpha)))
|
|
867
|
+
});
|
|
868
|
+
Object.assign(r.style, u(i[s]));
|
|
869
|
+
let d = !1;
|
|
870
|
+
function f() {
|
|
871
|
+
d || (d = !0, ne = s, z = null, B = null, t());
|
|
875
872
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
873
|
+
if (l.length < 2 || typeof r.animate != "function") return f();
|
|
874
|
+
let p = r.animate(l.map(u), {
|
|
875
|
+
duration: (l.length - 1) * $ * 1e3,
|
|
876
|
+
easing: "linear"
|
|
877
|
+
});
|
|
878
|
+
p.finished.catch(() => {}), p.onfinish = f, z = () => {
|
|
879
|
+
let e = Number(p.currentTime ?? 0) / ($ * 1e3);
|
|
880
|
+
ne = Math.max(0, Math.min(a, o + c * e)), d = !0, p.cancel();
|
|
881
|
+
}, B = n ? null : () => {
|
|
882
|
+
z?.(), z = null, B = null, t();
|
|
883
|
+
};
|
|
881
884
|
}
|
|
882
|
-
function
|
|
883
|
-
|
|
885
|
+
function H(e, t) {
|
|
886
|
+
V(e, t, !0);
|
|
884
887
|
}
|
|
885
|
-
function
|
|
886
|
-
|
|
888
|
+
function U(e, t) {
|
|
889
|
+
V(e, t, !1);
|
|
887
890
|
}
|
|
888
|
-
function
|
|
891
|
+
function re(e) {
|
|
889
892
|
F.value = "forward", N.value.push(e), g(() => oe());
|
|
890
893
|
}
|
|
891
|
-
function
|
|
894
|
+
function W() {
|
|
892
895
|
F.value = "backward", N.value.pop(), g(() => oe());
|
|
893
896
|
}
|
|
894
897
|
let G = w(!1), K = w(null), q = w(null), J = w({}), Y = m("m-menu-panel-registry", /* @__PURE__ */ new Set());
|
|
@@ -924,7 +927,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
924
927
|
}
|
|
925
928
|
C("m-menu-close", Z), C("m-menu-nav", {
|
|
926
929
|
mode: d.submenuMode,
|
|
927
|
-
push:
|
|
930
|
+
push: re
|
|
928
931
|
}), n({
|
|
929
932
|
close: Z,
|
|
930
933
|
open: G
|
|
@@ -944,7 +947,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
944
947
|
}
|
|
945
948
|
function ue(e) {
|
|
946
949
|
if (e.key === "Escape") {
|
|
947
|
-
N.value.length ?
|
|
950
|
+
N.value.length ? W() : Z();
|
|
948
951
|
return;
|
|
949
952
|
}
|
|
950
953
|
G.value && (e.key === "ArrowDown" ? (e.preventDefault(), se(1)) : e.key === "ArrowUp" && (e.preventDefault(), se(-1)));
|
|
@@ -952,7 +955,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
952
955
|
b(() => {
|
|
953
956
|
document.addEventListener("mousedown", Q), document.addEventListener("keydown", ue), window.addEventListener("scroll", le, !0);
|
|
954
957
|
}), x(() => {
|
|
955
|
-
document.removeEventListener("mousedown", Q), document.removeEventListener("keydown", ue), window.removeEventListener("scroll", le, !0),
|
|
958
|
+
document.removeEventListener("mousedown", Q), document.removeEventListener("keydown", ue), window.removeEventListener("scroll", le, !0), B ? B() : z?.();
|
|
956
959
|
});
|
|
957
960
|
let de = o(() => d.align === "right" ? "top right" : "top left");
|
|
958
961
|
return (n, o) => (S(), l(r, null, [u("div", h({
|
|
@@ -963,8 +966,8 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
963
966
|
onClick: ce
|
|
964
967
|
}), [E(n.$slots, "trigger", { open: G.value })], 16), (S(), s(i, { to: "body" }, [f(a, {
|
|
965
968
|
css: !1,
|
|
966
|
-
onEnter:
|
|
967
|
-
onLeave:
|
|
969
|
+
onEnter: H,
|
|
970
|
+
onLeave: U
|
|
968
971
|
}, {
|
|
969
972
|
default: M(() => [G.value ? (S(), l("div", {
|
|
970
973
|
key: 0,
|
|
@@ -986,7 +989,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
986
989
|
default: M(() => [P.value ? (S(), l("div", { key: N.value.length }, [u("button", {
|
|
987
990
|
type: "button",
|
|
988
991
|
class: "flex w-full items-center gap-3 border-b border-outline-variant px-4 py-2.5 text-left text-body-large text-on-surface outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary",
|
|
989
|
-
onClick:
|
|
992
|
+
onClick: W
|
|
990
993
|
}, [
|
|
991
994
|
f(t, {
|
|
992
995
|
name: "chevron_left",
|
|
@@ -1044,7 +1047,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1044
1047
|
setup(e, { emit: n }) {
|
|
1045
1048
|
let r = e, d = n, p = o(() => r.checked !== void 0), h = o(() => p.value || r.selected !== void 0), y = o(() => !!(r.checked ?? r.selected)), C = o(() => h.value && !r.icon), T = o(() => r.selectedIcon ?? (r.icon ? void 0 : "check")), A = w("single");
|
|
1046
1049
|
function N() {
|
|
1047
|
-
let e =
|
|
1050
|
+
let e = B.value;
|
|
1048
1051
|
if (!e || !h.value) return;
|
|
1049
1052
|
let t = (e) => !!e?.hasAttribute("data-m3-menu-choice"), n = t(e.previousElementSibling), r = t(e.nextElementSibling);
|
|
1050
1053
|
A.value = n && r ? "middle" : n ? "last" : r ? "first" : "single";
|
|
@@ -1065,23 +1068,23 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1065
1068
|
];
|
|
1066
1069
|
}
|
|
1067
1070
|
let { snap: F } = Q(() => h.value ? [...P(), C.value && y.value ? Le : 0] : [], ([e, t, n, r, i]) => {
|
|
1068
|
-
let a =
|
|
1069
|
-
a && r !== void 0 && (a.style.borderRadius = `${e}px ${t}px ${n}px ${r}px`),
|
|
1071
|
+
let a = V.value instanceof HTMLElement ? V.value : V.value?.$el;
|
|
1072
|
+
a && r !== void 0 && (a.style.borderRadius = `${e}px ${t}px ${n}px ${r}px`), H.value && i !== void 0 && (H.value.style.width = `${i}px`);
|
|
1070
1073
|
}, ae);
|
|
1071
1074
|
ee(A, () => F());
|
|
1072
1075
|
let te = null;
|
|
1073
1076
|
b(() => {
|
|
1074
1077
|
N();
|
|
1075
|
-
let e =
|
|
1078
|
+
let e = B.value?.parentElement;
|
|
1076
1079
|
e && (te = new MutationObserver(N), te.observe(e, { childList: !0 }));
|
|
1077
1080
|
}), x(() => te?.disconnect()), ee(h, () => g(N)), Q(() => C.value ? [+!!y.value] : [], ([e]) => {
|
|
1078
|
-
|
|
1081
|
+
H.value && e !== void 0 && (H.value.style.opacity = String(e));
|
|
1079
1082
|
}, oe);
|
|
1080
|
-
let I = j(), L = o(() => r.to ? "RouterLink" : "button"), R = o(() => !!I.children),
|
|
1081
|
-
function
|
|
1082
|
-
if (!
|
|
1083
|
-
let e =
|
|
1084
|
-
|
|
1083
|
+
let I = j(), L = o(() => r.to ? "RouterLink" : "button"), R = o(() => !!I.children), ne = m("m-menu-close", null), z = m("m-menu-nav", null), B = w(), V = w(), H = w(), U = w(!1), re = w({});
|
|
1084
|
+
function W() {
|
|
1085
|
+
if (!B.value) return;
|
|
1086
|
+
let e = B.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
|
|
1087
|
+
re.value = {
|
|
1085
1088
|
position: "fixed",
|
|
1086
1089
|
top: `${e.top}px`,
|
|
1087
1090
|
...t ? { right: `${window.innerWidth - e.left}px` } : { left: `${e.right}px` },
|
|
@@ -1089,45 +1092,45 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1089
1092
|
};
|
|
1090
1093
|
}
|
|
1091
1094
|
function G() {
|
|
1092
|
-
if (
|
|
1093
|
-
|
|
1095
|
+
if (U.value) {
|
|
1096
|
+
U.value = !1;
|
|
1094
1097
|
return;
|
|
1095
1098
|
}
|
|
1096
|
-
|
|
1099
|
+
W(), U.value = !0;
|
|
1097
1100
|
}
|
|
1098
1101
|
function K() {
|
|
1099
1102
|
if (!r.disabled) {
|
|
1100
1103
|
if (R.value) {
|
|
1101
|
-
|
|
1104
|
+
z?.mode === "push" ? z.push({
|
|
1102
1105
|
icon: r.icon,
|
|
1103
1106
|
header: I.default,
|
|
1104
1107
|
content: I.children
|
|
1105
1108
|
}) : G();
|
|
1106
1109
|
return;
|
|
1107
1110
|
}
|
|
1108
|
-
p.value && d("update:checked", !r.checked), d("click"), (r.keepOpen ?? p.value) ||
|
|
1111
|
+
p.value && d("update:checked", !r.checked), d("click"), (r.keepOpen ?? p.value) || ne?.();
|
|
1109
1112
|
}
|
|
1110
1113
|
}
|
|
1111
1114
|
function q(e) {
|
|
1112
|
-
e.pointerType === "mouse" && R.value && !r.disabled && (
|
|
1115
|
+
e.pointerType === "mouse" && R.value && !r.disabled && (W(), U.value = !0);
|
|
1113
1116
|
}
|
|
1114
1117
|
function J(e) {
|
|
1115
|
-
e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (
|
|
1118
|
+
e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (U.value = !1));
|
|
1116
1119
|
}
|
|
1117
1120
|
function Y(e) {
|
|
1118
1121
|
if (e.pointerType !== "mouse") return;
|
|
1119
1122
|
let t = e.relatedTarget;
|
|
1120
|
-
t?.closest(".m3-submenu") ||
|
|
1123
|
+
t?.closest(".m3-submenu") || B.value?.contains(t) || (U.value = !1);
|
|
1121
1124
|
}
|
|
1122
1125
|
return (n, r) => (S(), l("div", {
|
|
1123
1126
|
ref_key: "itemEl",
|
|
1124
|
-
ref:
|
|
1127
|
+
ref: B,
|
|
1125
1128
|
"data-m3-menu-choice": h.value || void 0,
|
|
1126
1129
|
onPointerenter: q,
|
|
1127
1130
|
onPointerleave: J
|
|
1128
1131
|
}, [(S(), s(D(L.value), {
|
|
1129
1132
|
ref_key: "controlEl",
|
|
1130
|
-
ref:
|
|
1133
|
+
ref: V,
|
|
1131
1134
|
to: e.to || void 0,
|
|
1132
1135
|
type: e.to ? void 0 : "button",
|
|
1133
1136
|
role: h.value ? p.value ? "menuitemcheckbox" : "menuitemradio" : void 0,
|
|
@@ -1144,14 +1147,14 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1144
1147
|
]]),
|
|
1145
1148
|
disabled: e.disabled || void 0,
|
|
1146
1149
|
"aria-haspopup": R.value ? "menu" : void 0,
|
|
1147
|
-
"aria-expanded": R.value ?
|
|
1150
|
+
"aria-expanded": R.value ? U.value : void 0,
|
|
1148
1151
|
onClick: K
|
|
1149
1152
|
}, {
|
|
1150
1153
|
default: M(() => [
|
|
1151
1154
|
C.value ? (S(), l("span", {
|
|
1152
1155
|
key: 0,
|
|
1153
1156
|
ref_key: "iconSlotEl",
|
|
1154
|
-
ref:
|
|
1157
|
+
ref: H,
|
|
1155
1158
|
class: "-mr-3 flex shrink-0 overflow-hidden",
|
|
1156
1159
|
style: {
|
|
1157
1160
|
width: "0",
|
|
@@ -1191,7 +1194,7 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1191
1194
|
"disabled",
|
|
1192
1195
|
"aria-haspopup",
|
|
1193
1196
|
"aria-expanded"
|
|
1194
|
-
])), R.value && k(
|
|
1197
|
+
])), R.value && k(z)?.mode !== "push" ? (S(), s(i, {
|
|
1195
1198
|
key: 0,
|
|
1196
1199
|
to: "body"
|
|
1197
1200
|
}, [f(a, {
|
|
@@ -1200,10 +1203,10 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1200
1203
|
"leave-active-class": "transition-opacity duration-75",
|
|
1201
1204
|
"leave-to-class": "opacity-0"
|
|
1202
1205
|
}, {
|
|
1203
|
-
default: M(() => [
|
|
1206
|
+
default: M(() => [U.value ? (S(), l("div", {
|
|
1204
1207
|
key: 0,
|
|
1205
1208
|
class: "m3-submenu min-w-44 rounded-xs shadow-elevation-2",
|
|
1206
|
-
style: v(
|
|
1209
|
+
style: v(re.value),
|
|
1207
1210
|
onPointerleave: Y
|
|
1208
1211
|
}, [u("div", Ie, [E(n.$slots, "children")])], 36)) : c("", !0)]),
|
|
1209
1212
|
_: 3
|
|
@@ -1360,6 +1363,6 @@ var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center just
|
|
|
1360
1363
|
}
|
|
1361
1364
|
});
|
|
1362
1365
|
//#endregion
|
|
1363
|
-
export { J as _, we as a,
|
|
1366
|
+
export { J as _, we as a, U as b, se as c, ae as d, le as f, Y as g, X as h, Ee as i, ce as l, ie as m, Re as n, pe as o, Q as p, Me as r, de as s, qe as t, oe as u, q as v, L as x, K as y };
|
|
1364
1367
|
|
|
1365
|
-
//# sourceMappingURL=MTextField-
|
|
1368
|
+
//# sourceMappingURL=MTextField-BPbFeI9M.js.map
|