@m3ui-vue/m3ui-vue 1.11.0 → 1.11.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 +10 -4
- package/dist/{MButton-gWoOzFWf.js → MButton-BHKF1Tfd.js} +2 -2
- package/dist/{MButton-gWoOzFWf.js.map → MButton-BHKF1Tfd.js.map} +1 -1
- package/dist/{MColorPickerModal-CJYMvlgK.js → MColorPickerModal-CNesUJUq.js} +4 -4
- package/dist/{MColorPickerModal-CJYMvlgK.js.map → MColorPickerModal-CNesUJUq.js.map} +1 -1
- package/dist/{MDialog-CU8EYgCC.js → MDialog-jAYkZ4M8.js} +2 -2
- package/dist/{MDialog-CU8EYgCC.js.map → MDialog-jAYkZ4M8.js.map} +1 -1
- package/dist/{MListItem-Cdw2FqCT.js → MListItem-CgdM5sco.js} +4 -4
- package/dist/{MListItem-Cdw2FqCT.js.map → MListItem-CgdM5sco.js.map} +1 -1
- package/dist/{MLoadingIndicator-BxAy2x7P.js → MLoadingIndicator-00XbLQSf.js} +2 -2
- package/dist/{MLoadingIndicator-BxAy2x7P.js.map → MLoadingIndicator-00XbLQSf.js.map} +1 -1
- package/dist/{MPdfViewer-CEfyXGq2.js → MPdfViewer-KjUIJOIs.js} +5 -5
- package/dist/{MPdfViewer-CEfyXGq2.js.map → MPdfViewer-KjUIJOIs.js.map} +1 -1
- package/dist/{MSeekBar-B3_D-PwH.js → MSeekBar-B4EEWw3B.js} +2 -2
- package/dist/{MSeekBar-B3_D-PwH.js.map → MSeekBar-B4EEWw3B.js.map} +1 -1
- package/dist/{MSegmentedButton-Dg07j-4r.js → MSegmentedButton-UOAJAd2i.js} +2 -2
- package/dist/{MSegmentedButton-Dg07j-4r.js.map → MSegmentedButton-UOAJAd2i.js.map} +1 -1
- package/dist/{MSignaturePad-3nddtLKI.js → MSignaturePad-HZavgiGB.js} +2 -2
- package/dist/{MSignaturePad-3nddtLKI.js.map → MSignaturePad-HZavgiGB.js.map} +1 -1
- package/dist/{MSlider-BrpLbqwt.js → MSlider-BaQeaozI.js} +3 -3
- package/dist/{MSlider-BrpLbqwt.js.map → MSlider-BaQeaozI.js.map} +1 -1
- package/dist/{MSpinner-CLwzDH33.js → MSpinner-CbEMPY4X.js} +2 -2
- package/dist/{MSpinner-CLwzDH33.js.map → MSpinner-CbEMPY4X.js.map} +1 -1
- package/dist/{MTextField-CZRizAwA.js → MTextField-B9PwKHlP.js} +3 -3
- package/dist/{MTextField-CZRizAwA.js.map → MTextField-B9PwKHlP.js.map} +1 -1
- package/dist/{_useFieldValidation-DVcqyy9g.js → _useFieldValidation-B7AAfa69.js} +2 -2
- package/dist/{_useFieldValidation-DVcqyy9g.js.map → _useFieldValidation-B7AAfa69.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MJsonViewer.vue.d.ts +2 -0
- package/dist/components/MPdfSigner.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTicket.vue.d.ts +1 -1
- package/dist/composables/_countLabel.d.ts +6 -0
- package/dist/composables/useLocale.d.ts +4 -0
- package/dist/draw.js +2 -2
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/locales/index.js +36 -36
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2017 -2011
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +6 -6
- package/dist/media.js +4 -4
- package/dist/pdf-sign.js +7 -7
- package/dist/pdf.js +1 -1
- package/dist/rich-text-editor.js +5 -5
- package/dist/styles.css +1 -1
- package/dist/{useLocale-BjcYauXr.js → useLocale-BAPJ34Pq.js} +5 -5
- package/dist/useLocale-BAPJ34Pq.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/countLabels.test.ts +66 -0
- package/src/components/MDataTable.vue +5 -4
- package/src/components/MJsonViewer.vue +4 -1
- package/src/components/MTable.vue +3 -2
- package/src/composables/_countLabel.ts +10 -0
- package/src/composables/useLocale.ts +8 -4
- package/src/locales/ar.ts +4 -4
- package/src/locales/de.ts +4 -4
- package/src/locales/es.ts +4 -4
- package/src/locales/fr.ts +4 -4
- package/src/locales/ja.ts +4 -4
- package/src/locales/ko.ts +4 -4
- package/src/locales/pl.ts +4 -4
- package/src/locales/pt.ts +4 -4
- package/src/locales/zh.ts +4 -4
- package/dist/useLocale-BjcYauXr.js.map +0 -1
package/dist/API.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @m3ui-vue/m3ui-vue 1.11.
|
|
1
|
+
# @m3ui-vue/m3ui-vue 1.11.1 — 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.
|
|
@@ -1501,8 +1501,8 @@ Props:
|
|
|
1501
1501
|
- `total?: number = 0` — Total rows (for server-side pagination)
|
|
1502
1502
|
- `page?: number = 1` (v-model:page) — Current page (v-model via update:page)
|
|
1503
1503
|
- `searchPlaceholder?: string` — Placeholder for search input (defaults to the locale string)
|
|
1504
|
-
- `selectedText?: string` — Text for selected count badge (defaults to the locale string)
|
|
1505
|
-
- `recordsText?: string` — Text for total records count (defaults to the locale string)
|
|
1504
|
+
- `selectedText?: string` — Text for the selected count badge: a template with `{count}` (plural blocks allowed, see `formatMessage`), or a bare word shown after the number (defaults to the locale string)
|
|
1505
|
+
- `recordsText?: string` — Text for the total records count: a template with `{count}` (plural blocks allowed, see `formatMessage`), or a bare word shown after the number (defaults to the locale string)
|
|
1506
1506
|
- `expandLabel?: string` — Aria label for the expand button (defaults to the locale string)
|
|
1507
1507
|
- `columnsLabel?: string` — Label for the column-toggle button (defaults to the locale string)
|
|
1508
1508
|
- `exportLabel?: string` — Label for the export button (defaults to the locale string)
|
|
@@ -3027,7 +3027,9 @@ Props:
|
|
|
3027
3027
|
|
|
3028
3028
|
```ts
|
|
3029
3029
|
export interface JsonViewerLabels {
|
|
3030
|
+
/** An array's size: a template with `{count}` (plural blocks allowed, see `formatMessage`), or a bare word shown after the number */
|
|
3030
3031
|
elements?: string
|
|
3032
|
+
/** An object's size, same format as `elements` */
|
|
3031
3033
|
fields?: string
|
|
3032
3034
|
}
|
|
3033
3035
|
```
|
|
@@ -6207,7 +6209,7 @@ Props:
|
|
|
6207
6209
|
- `total?: number = 0` — Total rows (for server-side pagination)
|
|
6208
6210
|
- `page?: number = 1` (v-model:page) — Current page (v-model via update:page)
|
|
6209
6211
|
- `searchPlaceholder?: string` — Placeholder for search input (defaults to the locale string)
|
|
6210
|
-
- `selectedText?: string` — Text for selected count badge
|
|
6212
|
+
- `selectedText?: string` — Text for the selected count badge: a template with `{count}` (plural blocks allowed, see `formatMessage`), or a bare word shown after the number (defaults to the locale string)
|
|
6211
6213
|
|
|
6212
6214
|
Events:
|
|
6213
6215
|
- `update:modelValue(Record<string, any>[])` — Emitted when the selection changes — powers v-model
|
|
@@ -10485,7 +10487,9 @@ export interface M3Locale {
|
|
|
10485
10487
|
more: string
|
|
10486
10488
|
|
|
10487
10489
|
// Tables
|
|
10490
|
+
/** Selected rows with their count, `{count}` (plural block allowed): '{count} selected' */
|
|
10488
10491
|
selectedCount: string
|
|
10492
|
+
/** Total rows with their count, `{count}` (plural block allowed): '{count, plural, one {# record} other {# records}}' */
|
|
10489
10493
|
recordCount: string
|
|
10490
10494
|
expand: string
|
|
10491
10495
|
/** Collapses an expanded item (the opposite of `expand`) */
|
|
@@ -10637,7 +10641,9 @@ export interface M3Locale {
|
|
|
10637
10641
|
jsonMinify: string
|
|
10638
10642
|
|
|
10639
10643
|
// JSON viewer
|
|
10644
|
+
/** A collapsed JSON array's size, `{count}` (plural block allowed) */
|
|
10640
10645
|
jsonElements: string
|
|
10646
|
+
/** A collapsed JSON object's size, `{count}` (plural block allowed) */
|
|
10641
10647
|
jsonFields: string
|
|
10642
10648
|
|
|
10643
10649
|
// Result
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as e, o as t } from "./_storageKeys-C4W_4xK4.js";
|
|
2
|
-
import { t as n } from "./MSpinner-
|
|
2
|
+
import { t as n } from "./MSpinner-CbEMPY4X.js";
|
|
3
3
|
import { t as r } from "./MIcon-CkUc9kuQ.js";
|
|
4
4
|
import { p as i } from "./MIconButton-DTFOfsTy.js";
|
|
5
5
|
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, openBlock as p, ref as m, renderSlot as h, resolveDynamicComponent as g, unref as _, withCtx as v, withDirectives as y } from "vue";
|
|
@@ -281,4 +281,4 @@ var M = [
|
|
|
281
281
|
});
|
|
282
282
|
export { w as a, b as c, C as d, x as f, T as i, j as l, M as n, D as o, E as r, S as s, P as t, A as u };
|
|
283
283
|
|
|
284
|
-
//# sourceMappingURL=MButton-
|
|
284
|
+
//# sourceMappingURL=MButton-BHKF1Tfd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MButton-gWoOzFWf.js","names":["_withDirectives","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withCtx","_createElementBlock","_Fragment","MSpinner","MIcon","_renderSlot","_unref","onStoragePrefix","storageKey","MSpinner_default","MIcon_default","vRipple","parseHex","c","input","ch","i","toHex","h","n","r","g","b","a","normalizeHex","rgbToHsv","max","d","hsvToRgb","f","k","v","s","hsvToHsl","l","hslToHsv","inkFor","hex","lin","RECENT_KEY","readRecents","x","recentColors","ref","pushRecentColor","limit","defaultColorPresets","base","MButton_default","defineComponent","NAMED_COLORS","props","__props","tag","computed","isCustomColor","customStyle","isError","ROLE","style","disabledContainerClasses","sizeMap","sizeClasses","iconSize","spinnerSize","px","shapeClass","variantClasses","err","withDirectives","openBlock","createBlock","resolveDynamicComponent","normalizeClass","normalizeStyle","withCtx","createElementBlock","Fragment","createCommentVNode","renderSlot","_ctx","unref"],"sources":["../src/composables/_colorUtils.ts","../src/components/MButton.vue"],"sourcesContent":["// Internal color math shared by MColorPicker and MColorPickerModal (through _MColorPanel).\n// Not exported from index.ts.\nimport { ref } from 'vue'\nimport { onStoragePrefix, storageKey } from './_storageKeys'\n\nexport interface Rgba { r: number; g: number; b: number; a: number }\n/** h 0–360, s/v 0–100 */\nexport interface Hsv { h: number; s: number; v: number }\n/** h 0–360, s/l 0–100 */\nexport interface Hsl { h: number; s: number; l: number }\n\n/** Parses `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa` (the `#` is optional). r/g/b 0–255, a 0–1. */\nexport function parseHex(input: string): Rgba | null {\n let c = input.trim().replace(/^#/, '')\n if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(c)) return null\n if (c.length <= 4) c = [...c].map((ch) => ch + ch).join('')\n const n = (i: number) => parseInt(c.substring(i, i + 2), 16)\n return { r: n(0), g: n(2), b: n(4), a: c.length === 8 ? n(6) / 255 : 1 }\n}\n\n/** `#rrggbb`, or `#rrggbbaa` when a < 1. Lowercase. */\nexport function toHex({ r, g, b, a }: Rgba): string {\n const h = (n: number) => Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, '0')\n return `#${h(r)}${h(g)}${h(b)}${a < 1 ? h(a * 255) : ''}`\n}\n\n/** Lowercase canonical form of a hex string, or '' when it isn't one. */\nexport function normalizeHex(input: string): string {\n const c = parseHex(input)\n return c ? toHex(c) : ''\n}\n\nexport function rgbToHsv({ r, g, b }: Rgba): Hsv {\n r /= 255; g /= 255; b /= 255\n const max = Math.max(r, g, b), d = max - Math.min(r, g, b)\n let h = 0\n if (d !== 0) {\n if (max === r) h = ((g - b) / d + 6) % 6\n else if (max === g) h = (b - r) / d + 2\n else h = (r - g) / d + 4\n h *= 60\n }\n return { h, s: max === 0 ? 0 : (d / max) * 100, v: max * 100 }\n}\n\nexport function hsvToRgb({ h, s, v }: Hsv, a = 1): Rgba {\n s /= 100; v /= 100\n const f = (n: number) => {\n const k = (n + h / 60) % 6\n return (v - v * s * Math.max(0, Math.min(k, 4 - k, 1))) * 255\n }\n return { r: f(5), g: f(3), b: f(1), a }\n}\n\nexport function hsvToHsl({ h, s, v }: Hsv): Hsl {\n s /= 100; v /= 100\n const l = v * (1 - s / 2)\n const sl = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l)\n return { h, s: sl * 100, l: l * 100 }\n}\n\nexport function hslToHsv({ h, s, l }: Hsl): Hsv {\n s /= 100; l /= 100\n const v = l + s * Math.min(l, 1 - l)\n return { h, s: v === 0 ? 0 : 2 * (1 - l / v) * 100, v: v * 100 }\n}\n\n/** Black or white, whichever reads better on the color (WCAG relative luminance). */\nexport function inkFor(hex: string): '#000000' | '#ffffff' {\n const c = parseHex(hex)\n if (!c) return '#000000'\n const lin = (n: number) => {\n n /= 255\n return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4\n }\n const lum = 0.2126 * lin(c.r) + 0.7152 * lin(c.g) + 0.0722 * lin(c.b)\n // Contrast against black beats contrast against white above ~0.179\n return lum > 0.179 ? '#000000' : '#ffffff'\n}\n\n// ── Recent colors (per viewer, localStorage, shared by every picker on the page) ──────────────\n\nconst RECENT_KEY = 'm3-color-recent'\n\nfunction readRecents(): string[] {\n try {\n const v = JSON.parse(localStorage.getItem(storageKey(RECENT_KEY)) ?? '[]')\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string' && !!parseHex(x)) : []\n } catch {\n return []\n }\n}\n\nexport const recentColors = ref<string[]>(readRecents())\nonStoragePrefix(() => { recentColors.value = readRecents() })\n\nexport function pushRecentColor(hex: string, limit: number) {\n const c = normalizeHex(hex)\n if (!c) return\n recentColors.value = [c, ...recentColors.value.filter((x) => x !== c)].slice(0, Math.max(limit, 0))\n try { localStorage.setItem(storageKey(RECENT_KEY), JSON.stringify(recentColors.value)) } catch { /* storage blocked */ }\n}\n\n/** Default swatches for both pickers: the Material 2014 palette's 500 tones plus grey, black and white (3 rows of 7) */\nexport const defaultColorPresets = [\n '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4',\n '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107',\n '#ff9800', '#ff5722', '#795548', '#607d8b', '#9e9e9e', '#000000', '#ffffff',\n]\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { inkFor, parseHex } from '../composables/_colorUtils'\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button; its text is black or white by\n * contrast for a hex color, white for any other form (set `contentColor` to choose).\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n // Black or white by contrast when the color is a hex literal; white otherwise (set contentColor to override)\n '--color-on-primary': parseHex(props.color!) ? inkFor(props.color!) : '#ffffff',\n // color-mix, not a hex alpha suffix: works with any CSS color (rgb(), a name, var(--x)…)\n '--color-primary-container': `color-mix(in srgb, ${props.color} 20%, transparent)`,\n '--color-on-primary-container': props.color,\n // The tonal variant draws with the secondary container: point it at the same tint, or a custom color never\n // reached tonal buttons at all\n '--color-secondary-container': `color-mix(in srgb, ${props.color} 20%, transparent)`,\n '--color-on-secondary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\n// M3's minimum touch target (minimumInteractiveComponentSize, 48dp): on a touch screen (pointer: coarse) an invisible\n// box centered on the button, so the 32px and 40px sizes still take a 48px tap. Not with a mouse: there it would only\n// widen the hover and overlap neighbors in dense toolbars. Needs the button not to clip (no overflow-hidden): the state layer\n// rounds itself instead, and the ripple clips in its own layer.\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n \"pointer-coarse:after:content-[''] pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-12 pointer-coarse:after:min-w-12 \" +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:focus-visible:before:opacity-[0.1] enabled:active:before:opacity-[0.1]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":";;;;;;AAYA,SAAgBkB,EAAS,GAA4B;CACnD,IAAIC,IAAIC,EAAM,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE;CACrC,IAAI,CAAC,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AMW,EAAA;KAAW,QAAQX,EAAA;;;;;;IAEjE/C,EAAQ2E,EAAA,QAAA,SAAA;IACQ5B,EAAA,YAAO,cAAvBzD,EAAA,GAAAM,EAGWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAFOkD,EAAA,WAAhBzD,EAAA,GAAAC,EAA+CO,GAAA;;KAArB,MAAM6D,EAAA;I,yBACdZ,EAAA,QAAlBzD,EAAA,GAAAC,EAA6EQ,GAAA;;KAApD,MAAMgD,EAAA;KAAO,MAAMW,EAAA;KAAW,QAAQX,EAAA;;;;;;;;;;;;;;E,MAT3C,CAAA9C,EAAAK,CAAA,GAAA;GAAA,UAAAyC,EAAA,YAAYA,EAAA;GAAO,OAASA,EAAA;EAAW,CAAA,C"}
|
|
1
|
+
{"version":3,"file":"MButton-BHKF1Tfd.js","names":["_withDirectives","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withCtx","_createElementBlock","_Fragment","MSpinner","MIcon","_renderSlot","_unref","onStoragePrefix","storageKey","MSpinner_default","MIcon_default","vRipple","parseHex","c","input","ch","i","toHex","h","n","r","g","b","a","normalizeHex","rgbToHsv","max","d","hsvToRgb","f","k","v","s","hsvToHsl","l","hslToHsv","inkFor","hex","lin","RECENT_KEY","readRecents","x","recentColors","ref","pushRecentColor","limit","defaultColorPresets","base","MButton_default","defineComponent","NAMED_COLORS","props","__props","tag","computed","isCustomColor","customStyle","isError","ROLE","style","disabledContainerClasses","sizeMap","sizeClasses","iconSize","spinnerSize","px","shapeClass","variantClasses","err","withDirectives","openBlock","createBlock","resolveDynamicComponent","normalizeClass","normalizeStyle","withCtx","createElementBlock","Fragment","createCommentVNode","renderSlot","_ctx","unref"],"sources":["../src/composables/_colorUtils.ts","../src/components/MButton.vue"],"sourcesContent":["// Internal color math shared by MColorPicker and MColorPickerModal (through _MColorPanel).\n// Not exported from index.ts.\nimport { ref } from 'vue'\nimport { onStoragePrefix, storageKey } from './_storageKeys'\n\nexport interface Rgba { r: number; g: number; b: number; a: number }\n/** h 0–360, s/v 0–100 */\nexport interface Hsv { h: number; s: number; v: number }\n/** h 0–360, s/l 0–100 */\nexport interface Hsl { h: number; s: number; l: number }\n\n/** Parses `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa` (the `#` is optional). r/g/b 0–255, a 0–1. */\nexport function parseHex(input: string): Rgba | null {\n let c = input.trim().replace(/^#/, '')\n if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(c)) return null\n if (c.length <= 4) c = [...c].map((ch) => ch + ch).join('')\n const n = (i: number) => parseInt(c.substring(i, i + 2), 16)\n return { r: n(0), g: n(2), b: n(4), a: c.length === 8 ? n(6) / 255 : 1 }\n}\n\n/** `#rrggbb`, or `#rrggbbaa` when a < 1. Lowercase. */\nexport function toHex({ r, g, b, a }: Rgba): string {\n const h = (n: number) => Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, '0')\n return `#${h(r)}${h(g)}${h(b)}${a < 1 ? h(a * 255) : ''}`\n}\n\n/** Lowercase canonical form of a hex string, or '' when it isn't one. */\nexport function normalizeHex(input: string): string {\n const c = parseHex(input)\n return c ? toHex(c) : ''\n}\n\nexport function rgbToHsv({ r, g, b }: Rgba): Hsv {\n r /= 255; g /= 255; b /= 255\n const max = Math.max(r, g, b), d = max - Math.min(r, g, b)\n let h = 0\n if (d !== 0) {\n if (max === r) h = ((g - b) / d + 6) % 6\n else if (max === g) h = (b - r) / d + 2\n else h = (r - g) / d + 4\n h *= 60\n }\n return { h, s: max === 0 ? 0 : (d / max) * 100, v: max * 100 }\n}\n\nexport function hsvToRgb({ h, s, v }: Hsv, a = 1): Rgba {\n s /= 100; v /= 100\n const f = (n: number) => {\n const k = (n + h / 60) % 6\n return (v - v * s * Math.max(0, Math.min(k, 4 - k, 1))) * 255\n }\n return { r: f(5), g: f(3), b: f(1), a }\n}\n\nexport function hsvToHsl({ h, s, v }: Hsv): Hsl {\n s /= 100; v /= 100\n const l = v * (1 - s / 2)\n const sl = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l)\n return { h, s: sl * 100, l: l * 100 }\n}\n\nexport function hslToHsv({ h, s, l }: Hsl): Hsv {\n s /= 100; l /= 100\n const v = l + s * Math.min(l, 1 - l)\n return { h, s: v === 0 ? 0 : 2 * (1 - l / v) * 100, v: v * 100 }\n}\n\n/** Black or white, whichever reads better on the color (WCAG relative luminance). */\nexport function inkFor(hex: string): '#000000' | '#ffffff' {\n const c = parseHex(hex)\n if (!c) return '#000000'\n const lin = (n: number) => {\n n /= 255\n return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4\n }\n const lum = 0.2126 * lin(c.r) + 0.7152 * lin(c.g) + 0.0722 * lin(c.b)\n // Contrast against black beats contrast against white above ~0.179\n return lum > 0.179 ? '#000000' : '#ffffff'\n}\n\n// ── Recent colors (per viewer, localStorage, shared by every picker on the page) ──────────────\n\nconst RECENT_KEY = 'm3-color-recent'\n\nfunction readRecents(): string[] {\n try {\n const v = JSON.parse(localStorage.getItem(storageKey(RECENT_KEY)) ?? '[]')\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string' && !!parseHex(x)) : []\n } catch {\n return []\n }\n}\n\nexport const recentColors = ref<string[]>(readRecents())\nonStoragePrefix(() => { recentColors.value = readRecents() })\n\nexport function pushRecentColor(hex: string, limit: number) {\n const c = normalizeHex(hex)\n if (!c) return\n recentColors.value = [c, ...recentColors.value.filter((x) => x !== c)].slice(0, Math.max(limit, 0))\n try { localStorage.setItem(storageKey(RECENT_KEY), JSON.stringify(recentColors.value)) } catch { /* storage blocked */ }\n}\n\n/** Default swatches for both pickers: the Material 2014 palette's 500 tones plus grey, black and white (3 rows of 7) */\nexport const defaultColorPresets = [\n '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4',\n '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107',\n '#ff9800', '#ff5722', '#795548', '#607d8b', '#9e9e9e', '#000000', '#ffffff',\n]\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { inkFor, parseHex } from '../composables/_colorUtils'\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button; its text is black or white by\n * contrast for a hex color, white for any other form (set `contentColor` to choose).\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n // Black or white by contrast when the color is a hex literal; white otherwise (set contentColor to override)\n '--color-on-primary': parseHex(props.color!) ? inkFor(props.color!) : '#ffffff',\n // color-mix, not a hex alpha suffix: works with any CSS color (rgb(), a name, var(--x)…)\n '--color-primary-container': `color-mix(in srgb, ${props.color} 20%, transparent)`,\n '--color-on-primary-container': props.color,\n // The tonal variant draws with the secondary container: point it at the same tint, or a custom color never\n // reached tonal buttons at all\n '--color-secondary-container': `color-mix(in srgb, ${props.color} 20%, transparent)`,\n '--color-on-secondary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\n// M3's minimum touch target (minimumInteractiveComponentSize, 48dp): on a touch screen (pointer: coarse) an invisible\n// box centered on the button, so the 32px and 40px sizes still take a 48px tap. Not with a mouse: there it would only\n// widen the hover and overlap neighbors in dense toolbars. Needs the button not to clip (no overflow-hidden): the state layer\n// rounds itself instead, and the ripple clips in its own layer.\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n \"pointer-coarse:after:content-[''] pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-12 pointer-coarse:after:min-w-12 \" +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:focus-visible:before:opacity-[0.1] enabled:active:before:opacity-[0.1]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":";;;;;;AAYA,SAAgBkB,EAAS,GAA4B;CACnD,IAAIC,IAAIC,EAAM,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE;CACrC,IAAI,CAAC,6CAA6C,KAAKD,CAAC,GAAG,OAAO;CAClE,AAAIA,EAAE,UAAU,MAAG,IAAI,CAAC,GAAGA,CAAC,CAAC,CAAC,KAAK,MAAOE,IAAKA,CAAE,CAAC,CAAC,KAAK,EAAE;CAC1D,IAAM,KAAK,MAAc,SAASF,EAAE,UAAUG,GAAGA,IAAI,CAAC,GAAG,EAAE;CAC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ACdZ,EAAA,QAAlBzD,EAAA,GAAAC,EAA6EQ,GAAA;;KAApD,MAAMgD,EAAA;KAAO,MAAMW,EAAA;KAAW,QAAQX,EAAA;;;;;;;;;;;;;;E,MAT3C,CAAA9C,EAAAK,CAAA,GAAA;GAAA,UAAAyC,EAAA,YAAYA,EAAA;GAAO,OAASA,EAAA;EAAW,CAAA,C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as ee, s as c, t as l, u as te } from "./MButton-
|
|
2
|
-
import { t as u } from "./MDialog-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as ee, s as c, t as l, u as te } from "./MButton-BHKF1Tfd.js";
|
|
2
|
+
import { t as u } from "./MDialog-jAYkZ4M8.js";
|
|
3
3
|
import { t as d } from "./MIcon-CkUc9kuQ.js";
|
|
4
4
|
import { t as ne } from "./vTooltip-xESB2YOb.js";
|
|
5
5
|
import { t as re } from "./MIconButton-DTFOfsTy.js";
|
|
6
|
-
import { a as ie } from "./useLocale-
|
|
6
|
+
import { a as ie } from "./useLocale-BAPJ34Pq.js";
|
|
7
7
|
import { t as ae } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
8
8
|
import { Fragment as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createTextVNode as v, createVNode as y, defineComponent as b, normalizeClass as x, normalizeStyle as S, onMounted as oe, openBlock as C, ref as w, renderList as T, toDisplayString as E, unref as D, watch as O, withCtx as k, withDirectives as se, withKeys as ce } from "vue";
|
|
9
9
|
// src/components/_MColorPanel.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -463,4 +463,4 @@ var le = { class: "flex flex-col gap-4" }, ue = [
|
|
|
463
463
|
});
|
|
464
464
|
export { j as n, M as t };
|
|
465
465
|
|
|
466
|
-
//# sourceMappingURL=MColorPickerModal-
|
|
466
|
+
//# sourceMappingURL=MColorPickerModal-CNesUJUq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MColorPickerModal-CJYMvlgK.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_normalizeStyle","_normalizeClass","_withDirectives","_createVNode","MIcon","_toDisplayString","_createBlock","MIconButton","_createTextVNode","_withKeys","_Fragment","_renderList","_openBlock","_createBlock","MDialog","_unref","_withCtx","_createVNode","MButton","_createTextVNode","_toDisplayString","MColorPanel","hsvToRgb","parseHex","rgbToHsv","toHex","pushRecentColor","defaultColorPresets","inkFor","hslToHsv","normalizeHex","MButton_default","recentColors","MDialog_default","MIcon_default","vTooltip","MIconButton_default","useLocale","_plugin_vue_export_helper_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","THUMB_INSET","CHECKER","_MColorPanel_default","defineComponent","__expose","__emit","props","__props","emit","t","h","ref","s","v","a","hex","computed","opaqueHex","hueColor","setFromRgb","hsv","c","lastEmitted","commit","val","pick","color","areaEl","hueEl","alphaEl","dragging","clamp","max","min","n","update","el","target","e","p","onPointerDown","onPointerMove","onPointerUp","onKeydown","step","dx","dy","cur","next","canEyedrop","pickFromScreen","Ctor","sRGBHex","formats","format","formatLabel","f","cycleFormat","setHsv","alphaField","fields","list","rgb","round","ch","hsl","hsvToHsl","editing","shown","key","display","onHexInput","text","onFieldInput","onFieldKeydown","recents","isSelected","fill","previewInk","showOriginal","openBlock","createElementBlock","createElementVNode","unref","normalizeStyle","_cache","$event","normalizeClass","createCommentVNode","withDirectives","createVNode","toDisplayString","createBlock","createTextVNode","withKeys","Fragment","renderList","group","MColorPickerModal_default","draft","open","cancel","confirm","picked","withCtx"],"sources":["../src/components/_MColorPanel.vue","../src/components/MColorPickerModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Internal: the picking UI shared by MColorPicker (in its dropdown) and MColorPickerModal (in its dialog).\n * Saturation/brightness area, hue and opacity sliders, eyedropper, HEX/RGB/HSL fields, recent and preset\n * swatches. Emits on every change; the parent decides when that becomes the real value.\n */\nimport { computed, onMounted, ref, watch } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { vTooltip } from '../directives/vTooltip'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport {\n hslToHsv, hsvToHsl, hsvToRgb, inkFor, normalizeHex, parseHex, recentColors, rgbToHsv, toHex, type Rgba,\n} from '../composables/_colorUtils'\n\nconst props = defineProps<{\n modelValue: string\n presets: string[]\n alpha: boolean\n recent: boolean\n eyedropper: boolean\n /** Shown as the left half of the preview, click to restore */\n original?: string\n}>()\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\nconst t = useLocale()\n\n// ── State: HSV + alpha, kept here so hue survives grays and black ──────────────────────────\nconst h = ref(0)\nconst s = ref(100)\nconst v = ref(100)\nconst a = ref(1)\n\nconst hex = computed(() => toHex(hsvToRgb({ h: h.value, s: s.value, v: v.value }, props.alpha ? a.value : 1)))\nconst opaqueHex = computed(() => toHex(hsvToRgb({ h: h.value, s: s.value, v: v.value })))\nconst hueColor = computed(() => `hsl(${h.value}, 100%, 50%)`)\n\nfunction setFromRgb(c: Rgba) {\n const hsv = rgbToHsv(c)\n // A gray has no hue and black no saturation: keep the ones we had, so the thumbs don't jump\n if (hsv.v > 0 && hsv.s > 0) h.value = hsv.h\n if (hsv.v > 0) s.value = hsv.s\n v.value = hsv.v\n a.value = props.alpha ? c.a : 1\n}\n\nlet lastEmitted = ''\nfunction commit() {\n lastEmitted = hex.value\n if (hex.value !== normalizeHex(props.modelValue)) emit('update:modelValue', hex.value)\n}\n\nwatch(() => props.modelValue, (val) => {\n const n = normalizeHex(val)\n if (!n || n === lastEmitted) return\n setFromRgb(parseHex(n)!)\n lastEmitted = n\n}, { immediate: true })\n\nfunction pick(color: string) {\n const c = parseHex(color)\n if (!c) return\n setFromRgb(c)\n commit()\n}\n\n// ── Pointer: area and sliders ──────────────────────────────────────────────────────────────\ntype Target = 'area' | 'hue' | 'alpha'\nconst areaEl = ref<HTMLElement>()\nconst hueEl = ref<HTMLElement>()\nconst alphaEl = ref<HTMLElement>()\nconst dragging = ref<Target | null>(null)\n// The slider handles travel between the centers of the track's round ends (24px track)\nconst THUMB_INSET = 12\n\nconst clamp = (n: number, min: number, max: number) => Math.min(max, Math.max(min, n))\n\nfunction update(target: Target, e: PointerEvent) {\n const el = target === 'area' ? areaEl.value : target === 'hue' ? hueEl.value : alphaEl.value\n if (!el) return\n const r = el.getBoundingClientRect()\n if (target === 'area') {\n s.value = clamp(((e.clientX - r.left) / r.width) * 100, 0, 100)\n v.value = clamp((1 - (e.clientY - r.top) / r.height) * 100, 0, 100)\n } else {\n const p = clamp((e.clientX - r.left - THUMB_INSET) / (r.width - THUMB_INSET * 2), 0, 1)\n if (target === 'hue') h.value = p * 360\n else a.value = Math.round(p * 100) / 100\n }\n commit()\n}\n\nfunction onPointerDown(target: Target, e: PointerEvent) {\n if (e.button !== 0) return\n e.preventDefault()\n ;(e.currentTarget as HTMLElement).focus({ preventScroll: true })\n ;(e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId)\n dragging.value = target\n update(target, e)\n}\nfunction onPointerMove(target: Target, e: PointerEvent) {\n if (dragging.value === target) update(target, e)\n}\nfunction onPointerUp() {\n dragging.value = null\n}\n\n// ── Keyboard ───────────────────────────────────────────────────────────────────────────────\nfunction onKeydown(target: Target, e: KeyboardEvent) {\n const step = e.shiftKey ? 10 : 1\n const dx = e.key === 'ArrowRight' ? step : e.key === 'ArrowLeft' ? -step : 0\n const dy = e.key === 'ArrowUp' ? step : e.key === 'ArrowDown' ? -step : 0\n if (target === 'area') {\n if (!dx && !dy) return\n s.value = clamp(s.value + dx, 0, 100)\n v.value = clamp(v.value + dy, 0, 100)\n } else {\n const max = target === 'hue' ? 360 : 100\n const cur = target === 'hue' ? h.value : a.value * 100\n let next: number\n if (e.key === 'Home') next = 0\n else if (e.key === 'End') next = max\n else if (dx || dy) next = clamp(cur + (dx || dy), 0, max)\n else return\n if (target === 'hue') h.value = next\n else a.value = Math.round(next) / 100\n }\n e.preventDefault()\n commit()\n}\n\n// ── Eyedropper (Chromium only; the button isn't shown elsewhere) ─────────────────────────────\nconst canEyedrop = ref(false)\nonMounted(() => { canEyedrop.value = 'EyeDropper' in window })\n\nasync function pickFromScreen() {\n try {\n const Ctor = (window as unknown as { EyeDropper: new () => { open(): Promise<{ sRGBHex: string }> } }).EyeDropper\n const { sRGBHex } = await new Ctor().open()\n const c = parseHex(sRGBHex)\n if (c) { setFromRgb({ ...c, a: a.value }); commit() }\n } catch { /* cancelled */ }\n}\n\n// ── Text fields ─────────────────────────────────────────────────────────────────────────────\ntype Format = 'hex' | 'rgb' | 'hsl'\nconst formats: { id: Format; label: string }[] = [\n { id: 'hex', label: 'HEX' }, { id: 'rgb', label: 'RGB' }, { id: 'hsl', label: 'HSL' },\n]\nconst format = ref<Format>('hex')\nconst formatLabel = computed(() => formats.find((f) => f.id === format.value)!.label)\nfunction cycleFormat() {\n format.value = formats[(formats.findIndex((f) => f.id === format.value) + 1) % formats.length]!.id\n editing.value = null\n}\n\ninterface Field { key: string; label: string; display: string; max: number; apply: (n: number) => void }\n\nfunction setHsv(next: { h: number; s: number; v: number }) {\n h.value = next.h; s.value = next.s; v.value = next.v\n}\n\nconst alphaField = computed<Field>(() => ({\n key: 'a', label: 'A', display: String(Math.round(a.value * 100)), max: 100,\n apply: (n) => { a.value = n / 100 },\n}))\n\nconst fields = computed<Field[]>(() => {\n const list: Field[] = []\n if (format.value === 'rgb') {\n const rgb = hsvToRgb({ h: h.value, s: s.value, v: v.value })\n const round = { r: Math.round(rgb.r), g: Math.round(rgb.g), b: Math.round(rgb.b), a: a.value }\n for (const ch of ['r', 'g', 'b'] as const) {\n list.push({\n key: ch, label: ch.toUpperCase(), display: String(round[ch]), max: 255,\n apply: (n) => setFromRgb({ ...round, [ch]: n }),\n })\n }\n } else if (format.value === 'hsl') {\n const hsl = hsvToHsl({ h: h.value, s: s.value, v: v.value })\n const round = { h: Math.round(hsl.h), s: Math.round(hsl.s), l: Math.round(hsl.l) }\n for (const ch of ['h', 's', 'l'] as const) {\n list.push({\n key: ch, label: ch.toUpperCase(), display: String(round[ch]), max: ch === 'h' ? 360 : 100,\n // Straight from HSL to HSV, so a hue typed on a gray isn't lost\n apply: (n) => setHsv(hslToHsv({ ...round, [ch]: n })),\n })\n }\n }\n if (props.alpha && format.value !== 'hex') list.push(alphaField.value)\n return list\n})\n\n// While a field is focused it shows what the user typed, not the reformatted value\nconst editing = ref<{ key: string; text: string } | null>(null)\nconst shown = (key: string, display: string) => (editing.value?.key === key ? editing.value.text : display)\n\nfunction onHexInput(e: Event) {\n const text = (e.target as HTMLInputElement).value\n editing.value = { key: 'hex', text }\n const c = parseHex(text)\n if (c) { setFromRgb(c); commit() }\n}\n\nfunction onFieldInput(f: Field, e: Event) {\n const text = (e.target as HTMLInputElement).value\n editing.value = { key: f.key, text }\n if (!/^\\d+$/.test(text.trim())) return\n const n = Number(text)\n if (n > f.max) return\n f.apply(n)\n commit()\n}\n\nfunction onFieldKeydown(f: Field, e: KeyboardEvent) {\n if (e.key === 'Enter') { editing.value = null; return }\n if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return\n e.preventDefault()\n const step = (e.shiftKey ? 10 : 1) * (e.key === 'ArrowUp' ? 1 : -1)\n f.apply(clamp(Number(f.display) + step, 0, f.max))\n editing.value = null\n commit()\n}\n\n// ── Swatches ────────────────────────────────────────────────────────────────────────────────\nconst recents = computed(() => (props.recent ? recentColors.value : []))\nconst isSelected = (color: string) => normalizeHex(color) === hex.value\n// Swatches and preview segments paint the color over a checkerboard in one background, so a translucent color\n// shows it and the edge is a single antialiased shape (nested clipped layers looked jagged in Firefox)\nconst CHECKER = 'repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px'\nconst fill = (color: string) => `linear-gradient(${color}, ${color}), ${CHECKER}`\n// Over a mostly transparent color the checkerboard (light) is what's behind the text\nconst previewInk = computed(() => (a.value < 0.5 ? '#000000' : inkFor(opaqueHex.value)))\nconst showOriginal = computed(() => !!props.original && !!normalizeHex(props.original) && normalizeHex(props.original) !== hex.value)\n\ndefineExpose({ focus: () => areaEl.value?.focus({ preventScroll: true }) })\n</script>\n\n<template>\n <div class=\"flex flex-col gap-4\">\n <!-- Saturation (x) / brightness (y) -->\n <div\n ref=\"areaEl\"\n role=\"slider\"\n tabindex=\"0\"\n :aria-label=\"`${t.colorSaturation}, ${t.colorBrightness}`\"\n :aria-valuenow=\"Math.round(s)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuetext=\"`${t.colorSaturation} ${Math.round(s)}%, ${t.colorBrightness} ${Math.round(v)}%`\"\n class=\"relative h-40 w-full shrink-0 cursor-crosshair touch-none rounded-md outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :style=\"{ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${hueColor})` }\"\n @pointerdown=\"onPointerDown('area', $event)\"\n @pointermove=\"onPointerMove('area', $event)\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @keydown=\"onKeydown('area', $event)\"\n >\n <span\n class=\"m3-cp-area-thumb pointer-events-none absolute size-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white transition-[scale] duration-150\"\n :class=\"dragging === 'area' ? 'scale-125' : ''\"\n :style=\"{ left: `${s}%`, top: `${100 - v}%`, backgroundColor: opaqueHex }\"\n />\n </div>\n\n <!-- Hue / opacity: thick tracks with M3 Expressive's bar handle -->\n <div class=\"flex flex-col gap-1\">\n <div\n ref=\"hueEl\"\n role=\"slider\"\n tabindex=\"0\"\n :aria-label=\"t.colorHue\"\n :aria-valuenow=\"Math.round(h)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"360\"\n class=\"m3-cp-slider group\"\n @pointerdown=\"onPointerDown('hue', $event)\"\n @pointermove=\"onPointerMove('hue', $event)\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @keydown=\"onKeydown('hue', $event)\"\n >\n <span class=\"m3-cp-track m3-cp-hue\" />\n <span\n class=\"m3-cp-handle\"\n :class=\"{ 'm3-cp-handle-pressed': dragging === 'hue' }\"\n :style=\"{ left: `calc(${THUMB_INSET}px + ${h / 360} * (100% - ${THUMB_INSET * 2}px))` }\"\n />\n </div>\n <div\n v-if=\"alpha\"\n ref=\"alphaEl\"\n role=\"slider\"\n tabindex=\"0\"\n :aria-label=\"t.colorAlpha\"\n :aria-valuenow=\"Math.round(a * 100)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuetext=\"`${Math.round(a * 100)}%`\"\n class=\"m3-cp-slider group\"\n @pointerdown=\"onPointerDown('alpha', $event)\"\n @pointermove=\"onPointerMove('alpha', $event)\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @keydown=\"onKeydown('alpha', $event)\"\n >\n <span class=\"m3-cp-track\" :style=\"{ background: `linear-gradient(to right, transparent, ${opaqueHex}), ${CHECKER}` }\" />\n <span\n class=\"m3-cp-handle\"\n :class=\"{ 'm3-cp-handle-pressed': dragging === 'alpha' }\"\n :style=\"{ left: `calc(${THUMB_INSET}px + ${a} * (100% - ${THUMB_INSET * 2}px))` }\"\n />\n </div>\n </div>\n\n <!-- Preview (original | new) and eyedropper -->\n <div class=\"flex items-center gap-2\">\n <div class=\"flex h-10 min-w-0 flex-1\">\n <button\n v-if=\"showOriginal\"\n type=\"button\"\n class=\"m3-cp-swatch flex w-12 shrink-0 cursor-pointer items-center justify-center rounded-s-full outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :style=\"{ background: fill(original!) }\"\n :aria-label=\"t.colorOriginal\"\n v-tooltip=\"t.colorOriginal\"\n @click=\"pick(original!)\"\n >\n <MIcon name=\"undo\" :size=\"18\" :style=\"{ color: inkFor(original!) }\" />\n </button>\n <span\n class=\"m3-cp-swatch flex min-w-0 flex-1 items-center px-4 font-mono text-label-large transition-[border-radius] duration-200\"\n :class=\"showOriginal ? 'rounded-e-full' : 'rounded-full'\"\n :style=\"{ background: fill(hex), color: previewInk }\"\n >{{ hex }}</span>\n </div>\n <MIconButton v-if=\"eyedropper && canEyedrop\" icon=\"colorize\" variant=\"tonal\" :label=\"t.colorEyedropper\" @click=\"pickFromScreen\" />\n </div>\n\n <!-- Format + fields -->\n <div class=\"flex items-start gap-2\">\n <button\n type=\"button\"\n class=\"flex h-10 shrink-0 cursor-pointer items-center gap-0.5 rounded-full bg-secondary-container pe-2 ps-3 text-label-large text-on-secondary-container outline-none transition-[background-color] duration-150 hover:bg-[color-mix(in_srgb,var(--color-secondary-container),var(--color-on-secondary-container)_8%)] focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :aria-label=\"`${t.colorFormat}: ${formatLabel}`\"\n @click=\"cycleFormat\"\n >\n {{ formatLabel }}\n <MIcon name=\"unfold_more\" :size=\"18\" />\n </button>\n <input\n v-if=\"format === 'hex'\"\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n :maxlength=\"alpha ? 9 : 7\"\n aria-label=\"HEX\"\n :value=\"shown('hex', hex)\"\n class=\"m3-cp-field min-w-0 flex-1 font-mono text-body-medium\"\n @input=\"onHexInput\"\n @blur=\"editing = null\"\n @keydown.enter=\"editing = null\"\n />\n <label v-for=\"f in fields\" :key=\"f.key\" class=\"flex min-w-0 flex-1 flex-col items-center gap-1\">\n <input\n type=\"text\"\n inputmode=\"numeric\"\n autocomplete=\"off\"\n :maxlength=\"3\"\n :aria-label=\"f.label\"\n :value=\"shown(f.key, f.display)\"\n class=\"m3-cp-field w-full font-mono text-body-medium\"\n @input=\"onFieldInput(f, $event)\"\n @keydown=\"onFieldKeydown(f, $event)\"\n @blur=\"editing = null\"\n />\n <span class=\"text-label-small text-on-surface-variant\">{{ f.label }}</span>\n </label>\n </div>\n\n <!-- Swatches: rounded squares that morph into a circle when selected -->\n <template v-for=\"group in [{ id: 'recent', label: t.colorRecent, colors: recents }, { id: 'presets', label: t.colorPresets, colors: presets }]\" :key=\"group.id\">\n <div v-if=\"group.colors.length\" role=\"group\" :aria-label=\"group.label\" class=\"flex flex-col gap-2\">\n <span v-if=\"recents.length\" class=\"text-label-medium text-on-surface-variant\">{{ group.label }}</span>\n <div class=\"grid grid-cols-7 gap-2\">\n <button\n v-for=\"color in group.colors\"\n :key=\"color\"\n type=\"button\"\n class=\"m3-cp-swatch m3-cp-morph flex aspect-square cursor-pointer items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :class=\"{ 'm3-cp-morph-selected': isSelected(color) }\"\n :style=\"{ background: fill(color) }\"\n :aria-label=\"color\"\n :aria-pressed=\"isSelected(color)\"\n @click=\"pick(color)\"\n >\n <MIcon v-if=\"isSelected(color)\" name=\"check\" :size=\"18\" :style=\"{ color: inkFor(color) }\" />\n </button>\n </div>\n </div>\n </template>\n </div>\n</template>\n\n<style scoped>\n.m3-cp-hue {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n}\n/* Hairline so white swatches show on light surfaces and black ones on dark */\n.m3-cp-swatch {\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-on-surface) 12%, transparent);\n}\n.m3-cp-morph {\n border-radius: 30%;\n transition: border-radius 250ms cubic-bezier(0.2, 0, 0, 1);\n}\n.m3-cp-morph:hover {\n border-radius: 40%;\n}\n.m3-cp-morph-selected,\n.m3-cp-morph-selected:hover {\n border-radius: 50%;\n}\n.m3-cp-area-thumb {\n box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 1px 3px 1px rgb(0 0 0 / 0.25);\n}\n.m3-cp-slider {\n position: relative;\n height: 32px;\n cursor: pointer;\n touch-action: none;\n outline: none;\n}\n.m3-cp-track {\n position: absolute;\n inset: 4px 0;\n border-radius: 9999px;\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-on-surface) 12%, transparent);\n}\n/* After M3 Expressive's slider handle: a bar taller than the track that narrows while pressed */\n.m3-cp-handle {\n position: absolute;\n top: 0;\n width: 6px;\n height: 32px;\n translate: -50% 0;\n border-radius: 9999px;\n background: #fff;\n box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 1px 3px rgb(0 0 0 / 0.3);\n pointer-events: none;\n transition: width 150ms cubic-bezier(0.2, 0, 0, 1);\n}\n.m3-cp-handle-pressed {\n width: 4px;\n}\n.group:focus-visible .m3-cp-handle {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n.m3-cp-field {\n height: 40px;\n border-radius: var(--radius-sm);\n border: none;\n background: var(--color-surface-container-highest);\n padding: 0 8px;\n text-align: center;\n color: var(--color-on-surface);\n caret-color: var(--color-primary);\n outline: 2px solid transparent;\n outline-offset: -2px;\n transition: outline-color 150ms;\n}\n.m3-cp-field:hover {\n outline-color: color-mix(in srgb, var(--color-on-surface) 12%, transparent);\n}\n.m3-cp-field:focus {\n outline-color: var(--color-primary);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A color picker in a dialog: saturation/brightness area, hue (and optional opacity) slider, eyedropper,\n * HEX/RGB/HSL fields, recent colors and preset swatches. Built on MDialog; the color is only applied on confirm,\n * and the preview shows it next to the original.\n *\n * @event update:modelValue Emitted when a color is confirmed — powers v-model. Only fires on confirm, not while\n * dragging\n * @event update:show Emitted when the dialog opens or closes — powers v-model:show\n */\nimport { ref, watch } from 'vue'\nimport MButton from './MButton.vue'\nimport MDialog from './MDialog.vue'\nimport MColorPanel from './_MColorPanel.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { defaultColorPresets, normalizeHex, pushRecentColor } from '../composables/_colorUtils'\n\nconst props = withDefaults(defineProps<{\n /** Selected color in hex format (v-model). `#rrggbb`, or `#rrggbbaa` when `alpha` is on and the color isn't opaque. */\n modelValue: string\n /** Controls dialog visibility (v-model:show) */\n show?: boolean\n /** Preset color swatches shown in the dialog */\n presets?: string[]\n /** Dialog title; defaults to the locale's `selectColor` */\n title?: string\n /** Adds an opacity slider and an alpha channel to the value */\n alpha?: boolean\n /** Remember confirmed colors and show them above the presets (stored in localStorage, shared by every picker). */\n recent?: boolean\n /** How many recent colors to keep. */\n recentLimit?: number\n /** Show a button to pick a color from the screen, where the browser supports it (Chrome, Edge). */\n eyedropper?: boolean\n}>(), {\n show: false,\n presets: () => defaultColorPresets,\n alpha: false,\n recent: true,\n recentLimit: 7,\n eyedropper: true,\n})\n\nconst t = useLocale()\nconst emit = defineEmits<{\n 'update:modelValue': [string]\n 'update:show': [boolean]\n}>()\n\n// The color being picked; becomes the value only on confirm\nconst draft = ref(props.modelValue)\n\nwatch(() => props.show, (open) => {\n if (open) draft.value = props.modelValue\n}, { immediate: true })\n\nfunction cancel() { emit('update:show', false) }\n\nfunction confirm() {\n const picked = normalizeHex(draft.value) || draft.value\n if (props.recent) pushRecentColor(picked, props.recentLimit)\n emit('update:modelValue', picked)\n emit('update:show', false)\n}\n</script>\n\n<template>\n <MDialog\n :model-value=\"show\"\n :title=\"title || t.selectColor\"\n max-width=\"328px\"\n :closable=\"false\"\n @update:model-value=\"!$event && cancel()\"\n >\n <MColorPanel\n v-model=\"draft\"\n :presets=\"presets\"\n :alpha=\"alpha\"\n :recent=\"recent\"\n :eyedropper=\"eyedropper\"\n :original=\"modelValue\"\n />\n <template #actions>\n <MButton variant=\"text\" @click=\"cancel\">{{ t.cancel }}</MButton>\n <MButton variant=\"text\" @click=\"confirm\">{{ t.confirm }}</MButton>\n </template>\n </MDialog>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,GA0EM4D,IAAc,IA4JdC,KAAU,qE;;;;;;;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Block","_createElementVNode","_unref","_normalizeStyle","_normalizeClass","_withDirectives","_createVNode","MIcon","_toDisplayString","_createBlock","MIconButton","_createTextVNode","_withKeys","_Fragment","_renderList","_openBlock","_createBlock","MDialog","_unref","_withCtx","_createVNode","MButton","_createTextVNode","_toDisplayString","MColorPanel","hsvToRgb","parseHex","rgbToHsv","toHex","pushRecentColor","defaultColorPresets","inkFor","hslToHsv","normalizeHex","MButton_default","recentColors","MDialog_default","MIcon_default","vTooltip","MIconButton_default","useLocale","_plugin_vue_export_helper_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","THUMB_INSET","CHECKER","_MColorPanel_default","defineComponent","__expose","__emit","props","__props","emit","t","h","ref","s","v","a","hex","computed","opaqueHex","hueColor","setFromRgb","hsv","c","lastEmitted","commit","val","pick","color","areaEl","hueEl","alphaEl","dragging","clamp","max","min","n","update","el","target","e","p","onPointerDown","onPointerMove","onPointerUp","onKeydown","step","dx","dy","cur","next","canEyedrop","pickFromScreen","Ctor","sRGBHex","formats","format","formatLabel","f","cycleFormat","setHsv","alphaField","fields","list","rgb","round","ch","hsl","hsvToHsl","editing","shown","key","display","onHexInput","text","onFieldInput","onFieldKeydown","recents","isSelected","fill","previewInk","showOriginal","openBlock","createElementBlock","createElementVNode","unref","normalizeStyle","_cache","$event","normalizeClass","createCommentVNode","withDirectives","createVNode","toDisplayString","createBlock","createTextVNode","withKeys","Fragment","renderList","group","MColorPickerModal_default","draft","open","cancel","confirm","picked","withCtx"],"sources":["../src/components/_MColorPanel.vue","../src/components/MColorPickerModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Internal: the picking UI shared by MColorPicker (in its dropdown) and MColorPickerModal (in its dialog).\n * Saturation/brightness area, hue and opacity sliders, eyedropper, HEX/RGB/HSL fields, recent and preset\n * swatches. Emits on every change; the parent decides when that becomes the real value.\n */\nimport { computed, onMounted, ref, watch } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { vTooltip } from '../directives/vTooltip'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport {\n hslToHsv, hsvToHsl, hsvToRgb, inkFor, normalizeHex, parseHex, recentColors, rgbToHsv, toHex, type Rgba,\n} from '../composables/_colorUtils'\n\nconst props = defineProps<{\n modelValue: string\n presets: string[]\n alpha: boolean\n recent: boolean\n eyedropper: boolean\n /** Shown as the left half of the preview, click to restore */\n original?: string\n}>()\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\nconst t = useLocale()\n\n// ── State: HSV + alpha, kept here so hue survives grays and black ──────────────────────────\nconst h = ref(0)\nconst s = ref(100)\nconst v = ref(100)\nconst a = ref(1)\n\nconst hex = computed(() => toHex(hsvToRgb({ h: h.value, s: s.value, v: v.value }, props.alpha ? a.value : 1)))\nconst opaqueHex = computed(() => toHex(hsvToRgb({ h: h.value, s: s.value, v: v.value })))\nconst hueColor = computed(() => `hsl(${h.value}, 100%, 50%)`)\n\nfunction setFromRgb(c: Rgba) {\n const hsv = rgbToHsv(c)\n // A gray has no hue and black no saturation: keep the ones we had, so the thumbs don't jump\n if (hsv.v > 0 && hsv.s > 0) h.value = hsv.h\n if (hsv.v > 0) s.value = hsv.s\n v.value = hsv.v\n a.value = props.alpha ? c.a : 1\n}\n\nlet lastEmitted = ''\nfunction commit() {\n lastEmitted = hex.value\n if (hex.value !== normalizeHex(props.modelValue)) emit('update:modelValue', hex.value)\n}\n\nwatch(() => props.modelValue, (val) => {\n const n = normalizeHex(val)\n if (!n || n === lastEmitted) return\n setFromRgb(parseHex(n)!)\n lastEmitted = n\n}, { immediate: true })\n\nfunction pick(color: string) {\n const c = parseHex(color)\n if (!c) return\n setFromRgb(c)\n commit()\n}\n\n// ── Pointer: area and sliders ──────────────────────────────────────────────────────────────\ntype Target = 'area' | 'hue' | 'alpha'\nconst areaEl = ref<HTMLElement>()\nconst hueEl = ref<HTMLElement>()\nconst alphaEl = ref<HTMLElement>()\nconst dragging = ref<Target | null>(null)\n// The slider handles travel between the centers of the track's round ends (24px track)\nconst THUMB_INSET = 12\n\nconst clamp = (n: number, min: number, max: number) => Math.min(max, Math.max(min, n))\n\nfunction update(target: Target, e: PointerEvent) {\n const el = target === 'area' ? areaEl.value : target === 'hue' ? hueEl.value : alphaEl.value\n if (!el) return\n const r = el.getBoundingClientRect()\n if (target === 'area') {\n s.value = clamp(((e.clientX - r.left) / r.width) * 100, 0, 100)\n v.value = clamp((1 - (e.clientY - r.top) / r.height) * 100, 0, 100)\n } else {\n const p = clamp((e.clientX - r.left - THUMB_INSET) / (r.width - THUMB_INSET * 2), 0, 1)\n if (target === 'hue') h.value = p * 360\n else a.value = Math.round(p * 100) / 100\n }\n commit()\n}\n\nfunction onPointerDown(target: Target, e: PointerEvent) {\n if (e.button !== 0) return\n e.preventDefault()\n ;(e.currentTarget as HTMLElement).focus({ preventScroll: true })\n ;(e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId)\n dragging.value = target\n update(target, e)\n}\nfunction onPointerMove(target: Target, e: PointerEvent) {\n if (dragging.value === target) update(target, e)\n}\nfunction onPointerUp() {\n dragging.value = null\n}\n\n// ── Keyboard ───────────────────────────────────────────────────────────────────────────────\nfunction onKeydown(target: Target, e: KeyboardEvent) {\n const step = e.shiftKey ? 10 : 1\n const dx = e.key === 'ArrowRight' ? step : e.key === 'ArrowLeft' ? -step : 0\n const dy = e.key === 'ArrowUp' ? step : e.key === 'ArrowDown' ? -step : 0\n if (target === 'area') {\n if (!dx && !dy) return\n s.value = clamp(s.value + dx, 0, 100)\n v.value = clamp(v.value + dy, 0, 100)\n } else {\n const max = target === 'hue' ? 360 : 100\n const cur = target === 'hue' ? h.value : a.value * 100\n let next: number\n if (e.key === 'Home') next = 0\n else if (e.key === 'End') next = max\n else if (dx || dy) next = clamp(cur + (dx || dy), 0, max)\n else return\n if (target === 'hue') h.value = next\n else a.value = Math.round(next) / 100\n }\n e.preventDefault()\n commit()\n}\n\n// ── Eyedropper (Chromium only; the button isn't shown elsewhere) ─────────────────────────────\nconst canEyedrop = ref(false)\nonMounted(() => { canEyedrop.value = 'EyeDropper' in window })\n\nasync function pickFromScreen() {\n try {\n const Ctor = (window as unknown as { EyeDropper: new () => { open(): Promise<{ sRGBHex: string }> } }).EyeDropper\n const { sRGBHex } = await new Ctor().open()\n const c = parseHex(sRGBHex)\n if (c) { setFromRgb({ ...c, a: a.value }); commit() }\n } catch { /* cancelled */ }\n}\n\n// ── Text fields ─────────────────────────────────────────────────────────────────────────────\ntype Format = 'hex' | 'rgb' | 'hsl'\nconst formats: { id: Format; label: string }[] = [\n { id: 'hex', label: 'HEX' }, { id: 'rgb', label: 'RGB' }, { id: 'hsl', label: 'HSL' },\n]\nconst format = ref<Format>('hex')\nconst formatLabel = computed(() => formats.find((f) => f.id === format.value)!.label)\nfunction cycleFormat() {\n format.value = formats[(formats.findIndex((f) => f.id === format.value) + 1) % formats.length]!.id\n editing.value = null\n}\n\ninterface Field { key: string; label: string; display: string; max: number; apply: (n: number) => void }\n\nfunction setHsv(next: { h: number; s: number; v: number }) {\n h.value = next.h; s.value = next.s; v.value = next.v\n}\n\nconst alphaField = computed<Field>(() => ({\n key: 'a', label: 'A', display: String(Math.round(a.value * 100)), max: 100,\n apply: (n) => { a.value = n / 100 },\n}))\n\nconst fields = computed<Field[]>(() => {\n const list: Field[] = []\n if (format.value === 'rgb') {\n const rgb = hsvToRgb({ h: h.value, s: s.value, v: v.value })\n const round = { r: Math.round(rgb.r), g: Math.round(rgb.g), b: Math.round(rgb.b), a: a.value }\n for (const ch of ['r', 'g', 'b'] as const) {\n list.push({\n key: ch, label: ch.toUpperCase(), display: String(round[ch]), max: 255,\n apply: (n) => setFromRgb({ ...round, [ch]: n }),\n })\n }\n } else if (format.value === 'hsl') {\n const hsl = hsvToHsl({ h: h.value, s: s.value, v: v.value })\n const round = { h: Math.round(hsl.h), s: Math.round(hsl.s), l: Math.round(hsl.l) }\n for (const ch of ['h', 's', 'l'] as const) {\n list.push({\n key: ch, label: ch.toUpperCase(), display: String(round[ch]), max: ch === 'h' ? 360 : 100,\n // Straight from HSL to HSV, so a hue typed on a gray isn't lost\n apply: (n) => setHsv(hslToHsv({ ...round, [ch]: n })),\n })\n }\n }\n if (props.alpha && format.value !== 'hex') list.push(alphaField.value)\n return list\n})\n\n// While a field is focused it shows what the user typed, not the reformatted value\nconst editing = ref<{ key: string; text: string } | null>(null)\nconst shown = (key: string, display: string) => (editing.value?.key === key ? editing.value.text : display)\n\nfunction onHexInput(e: Event) {\n const text = (e.target as HTMLInputElement).value\n editing.value = { key: 'hex', text }\n const c = parseHex(text)\n if (c) { setFromRgb(c); commit() }\n}\n\nfunction onFieldInput(f: Field, e: Event) {\n const text = (e.target as HTMLInputElement).value\n editing.value = { key: f.key, text }\n if (!/^\\d+$/.test(text.trim())) return\n const n = Number(text)\n if (n > f.max) return\n f.apply(n)\n commit()\n}\n\nfunction onFieldKeydown(f: Field, e: KeyboardEvent) {\n if (e.key === 'Enter') { editing.value = null; return }\n if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return\n e.preventDefault()\n const step = (e.shiftKey ? 10 : 1) * (e.key === 'ArrowUp' ? 1 : -1)\n f.apply(clamp(Number(f.display) + step, 0, f.max))\n editing.value = null\n commit()\n}\n\n// ── Swatches ────────────────────────────────────────────────────────────────────────────────\nconst recents = computed(() => (props.recent ? recentColors.value : []))\nconst isSelected = (color: string) => normalizeHex(color) === hex.value\n// Swatches and preview segments paint the color over a checkerboard in one background, so a translucent color\n// shows it and the edge is a single antialiased shape (nested clipped layers looked jagged in Firefox)\nconst CHECKER = 'repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px'\nconst fill = (color: string) => `linear-gradient(${color}, ${color}), ${CHECKER}`\n// Over a mostly transparent color the checkerboard (light) is what's behind the text\nconst previewInk = computed(() => (a.value < 0.5 ? '#000000' : inkFor(opaqueHex.value)))\nconst showOriginal = computed(() => !!props.original && !!normalizeHex(props.original) && normalizeHex(props.original) !== hex.value)\n\ndefineExpose({ focus: () => areaEl.value?.focus({ preventScroll: true }) })\n</script>\n\n<template>\n <div class=\"flex flex-col gap-4\">\n <!-- Saturation (x) / brightness (y) -->\n <div\n ref=\"areaEl\"\n role=\"slider\"\n tabindex=\"0\"\n :aria-label=\"`${t.colorSaturation}, ${t.colorBrightness}`\"\n :aria-valuenow=\"Math.round(s)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuetext=\"`${t.colorSaturation} ${Math.round(s)}%, ${t.colorBrightness} ${Math.round(v)}%`\"\n class=\"relative h-40 w-full shrink-0 cursor-crosshair touch-none rounded-md outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :style=\"{ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${hueColor})` }\"\n @pointerdown=\"onPointerDown('area', $event)\"\n @pointermove=\"onPointerMove('area', $event)\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @keydown=\"onKeydown('area', $event)\"\n >\n <span\n class=\"m3-cp-area-thumb pointer-events-none absolute size-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white transition-[scale] duration-150\"\n :class=\"dragging === 'area' ? 'scale-125' : ''\"\n :style=\"{ left: `${s}%`, top: `${100 - v}%`, backgroundColor: opaqueHex }\"\n />\n </div>\n\n <!-- Hue / opacity: thick tracks with M3 Expressive's bar handle -->\n <div class=\"flex flex-col gap-1\">\n <div\n ref=\"hueEl\"\n role=\"slider\"\n tabindex=\"0\"\n :aria-label=\"t.colorHue\"\n :aria-valuenow=\"Math.round(h)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"360\"\n class=\"m3-cp-slider group\"\n @pointerdown=\"onPointerDown('hue', $event)\"\n @pointermove=\"onPointerMove('hue', $event)\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @keydown=\"onKeydown('hue', $event)\"\n >\n <span class=\"m3-cp-track m3-cp-hue\" />\n <span\n class=\"m3-cp-handle\"\n :class=\"{ 'm3-cp-handle-pressed': dragging === 'hue' }\"\n :style=\"{ left: `calc(${THUMB_INSET}px + ${h / 360} * (100% - ${THUMB_INSET * 2}px))` }\"\n />\n </div>\n <div\n v-if=\"alpha\"\n ref=\"alphaEl\"\n role=\"slider\"\n tabindex=\"0\"\n :aria-label=\"t.colorAlpha\"\n :aria-valuenow=\"Math.round(a * 100)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuetext=\"`${Math.round(a * 100)}%`\"\n class=\"m3-cp-slider group\"\n @pointerdown=\"onPointerDown('alpha', $event)\"\n @pointermove=\"onPointerMove('alpha', $event)\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @keydown=\"onKeydown('alpha', $event)\"\n >\n <span class=\"m3-cp-track\" :style=\"{ background: `linear-gradient(to right, transparent, ${opaqueHex}), ${CHECKER}` }\" />\n <span\n class=\"m3-cp-handle\"\n :class=\"{ 'm3-cp-handle-pressed': dragging === 'alpha' }\"\n :style=\"{ left: `calc(${THUMB_INSET}px + ${a} * (100% - ${THUMB_INSET * 2}px))` }\"\n />\n </div>\n </div>\n\n <!-- Preview (original | new) and eyedropper -->\n <div class=\"flex items-center gap-2\">\n <div class=\"flex h-10 min-w-0 flex-1\">\n <button\n v-if=\"showOriginal\"\n type=\"button\"\n class=\"m3-cp-swatch flex w-12 shrink-0 cursor-pointer items-center justify-center rounded-s-full outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :style=\"{ background: fill(original!) }\"\n :aria-label=\"t.colorOriginal\"\n v-tooltip=\"t.colorOriginal\"\n @click=\"pick(original!)\"\n >\n <MIcon name=\"undo\" :size=\"18\" :style=\"{ color: inkFor(original!) }\" />\n </button>\n <span\n class=\"m3-cp-swatch flex min-w-0 flex-1 items-center px-4 font-mono text-label-large transition-[border-radius] duration-200\"\n :class=\"showOriginal ? 'rounded-e-full' : 'rounded-full'\"\n :style=\"{ background: fill(hex), color: previewInk }\"\n >{{ hex }}</span>\n </div>\n <MIconButton v-if=\"eyedropper && canEyedrop\" icon=\"colorize\" variant=\"tonal\" :label=\"t.colorEyedropper\" @click=\"pickFromScreen\" />\n </div>\n\n <!-- Format + fields -->\n <div class=\"flex items-start gap-2\">\n <button\n type=\"button\"\n class=\"flex h-10 shrink-0 cursor-pointer items-center gap-0.5 rounded-full bg-secondary-container pe-2 ps-3 text-label-large text-on-secondary-container outline-none transition-[background-color] duration-150 hover:bg-[color-mix(in_srgb,var(--color-secondary-container),var(--color-on-secondary-container)_8%)] focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :aria-label=\"`${t.colorFormat}: ${formatLabel}`\"\n @click=\"cycleFormat\"\n >\n {{ formatLabel }}\n <MIcon name=\"unfold_more\" :size=\"18\" />\n </button>\n <input\n v-if=\"format === 'hex'\"\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n :maxlength=\"alpha ? 9 : 7\"\n aria-label=\"HEX\"\n :value=\"shown('hex', hex)\"\n class=\"m3-cp-field min-w-0 flex-1 font-mono text-body-medium\"\n @input=\"onHexInput\"\n @blur=\"editing = null\"\n @keydown.enter=\"editing = null\"\n />\n <label v-for=\"f in fields\" :key=\"f.key\" class=\"flex min-w-0 flex-1 flex-col items-center gap-1\">\n <input\n type=\"text\"\n inputmode=\"numeric\"\n autocomplete=\"off\"\n :maxlength=\"3\"\n :aria-label=\"f.label\"\n :value=\"shown(f.key, f.display)\"\n class=\"m3-cp-field w-full font-mono text-body-medium\"\n @input=\"onFieldInput(f, $event)\"\n @keydown=\"onFieldKeydown(f, $event)\"\n @blur=\"editing = null\"\n />\n <span class=\"text-label-small text-on-surface-variant\">{{ f.label }}</span>\n </label>\n </div>\n\n <!-- Swatches: rounded squares that morph into a circle when selected -->\n <template v-for=\"group in [{ id: 'recent', label: t.colorRecent, colors: recents }, { id: 'presets', label: t.colorPresets, colors: presets }]\" :key=\"group.id\">\n <div v-if=\"group.colors.length\" role=\"group\" :aria-label=\"group.label\" class=\"flex flex-col gap-2\">\n <span v-if=\"recents.length\" class=\"text-label-medium text-on-surface-variant\">{{ group.label }}</span>\n <div class=\"grid grid-cols-7 gap-2\">\n <button\n v-for=\"color in group.colors\"\n :key=\"color\"\n type=\"button\"\n class=\"m3-cp-swatch m3-cp-morph flex aspect-square cursor-pointer items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary\"\n :class=\"{ 'm3-cp-morph-selected': isSelected(color) }\"\n :style=\"{ background: fill(color) }\"\n :aria-label=\"color\"\n :aria-pressed=\"isSelected(color)\"\n @click=\"pick(color)\"\n >\n <MIcon v-if=\"isSelected(color)\" name=\"check\" :size=\"18\" :style=\"{ color: inkFor(color) }\" />\n </button>\n </div>\n </div>\n </template>\n </div>\n</template>\n\n<style scoped>\n.m3-cp-hue {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n}\n/* Hairline so white swatches show on light surfaces and black ones on dark */\n.m3-cp-swatch {\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-on-surface) 12%, transparent);\n}\n.m3-cp-morph {\n border-radius: 30%;\n transition: border-radius 250ms cubic-bezier(0.2, 0, 0, 1);\n}\n.m3-cp-morph:hover {\n border-radius: 40%;\n}\n.m3-cp-morph-selected,\n.m3-cp-morph-selected:hover {\n border-radius: 50%;\n}\n.m3-cp-area-thumb {\n box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 1px 3px 1px rgb(0 0 0 / 0.25);\n}\n.m3-cp-slider {\n position: relative;\n height: 32px;\n cursor: pointer;\n touch-action: none;\n outline: none;\n}\n.m3-cp-track {\n position: absolute;\n inset: 4px 0;\n border-radius: 9999px;\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-on-surface) 12%, transparent);\n}\n/* After M3 Expressive's slider handle: a bar taller than the track that narrows while pressed */\n.m3-cp-handle {\n position: absolute;\n top: 0;\n width: 6px;\n height: 32px;\n translate: -50% 0;\n border-radius: 9999px;\n background: #fff;\n box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 1px 3px rgb(0 0 0 / 0.3);\n pointer-events: none;\n transition: width 150ms cubic-bezier(0.2, 0, 0, 1);\n}\n.m3-cp-handle-pressed {\n width: 4px;\n}\n.group:focus-visible .m3-cp-handle {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n.m3-cp-field {\n height: 40px;\n border-radius: var(--radius-sm);\n border: none;\n background: var(--color-surface-container-highest);\n padding: 0 8px;\n text-align: center;\n color: var(--color-on-surface);\n caret-color: var(--color-primary);\n outline: 2px solid transparent;\n outline-offset: -2px;\n transition: outline-color 150ms;\n}\n.m3-cp-field:hover {\n outline-color: color-mix(in srgb, var(--color-on-surface) 12%, transparent);\n}\n.m3-cp-field:focus {\n outline-color: var(--color-primary);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A color picker in a dialog: saturation/brightness area, hue (and optional opacity) slider, eyedropper,\n * HEX/RGB/HSL fields, recent colors and preset swatches. Built on MDialog; the color is only applied on confirm,\n * and the preview shows it next to the original.\n *\n * @event update:modelValue Emitted when a color is confirmed — powers v-model. Only fires on confirm, not while\n * dragging\n * @event update:show Emitted when the dialog opens or closes — powers v-model:show\n */\nimport { ref, watch } from 'vue'\nimport MButton from './MButton.vue'\nimport MDialog from './MDialog.vue'\nimport MColorPanel from './_MColorPanel.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { defaultColorPresets, normalizeHex, pushRecentColor } from '../composables/_colorUtils'\n\nconst props = withDefaults(defineProps<{\n /** Selected color in hex format (v-model). `#rrggbb`, or `#rrggbbaa` when `alpha` is on and the color isn't opaque. */\n modelValue: string\n /** Controls dialog visibility (v-model:show) */\n show?: boolean\n /** Preset color swatches shown in the dialog */\n presets?: string[]\n /** Dialog title; defaults to the locale's `selectColor` */\n title?: string\n /** Adds an opacity slider and an alpha channel to the value */\n alpha?: boolean\n /** Remember confirmed colors and show them above the presets (stored in localStorage, shared by every picker). */\n recent?: boolean\n /** How many recent colors to keep. */\n recentLimit?: number\n /** Show a button to pick a color from the screen, where the browser supports it (Chrome, Edge). */\n eyedropper?: boolean\n}>(), {\n show: false,\n presets: () => defaultColorPresets,\n alpha: false,\n recent: true,\n recentLimit: 7,\n eyedropper: true,\n})\n\nconst t = useLocale()\nconst emit = defineEmits<{\n 'update:modelValue': [string]\n 'update:show': [boolean]\n}>()\n\n// The color being picked; becomes the value only on confirm\nconst draft = ref(props.modelValue)\n\nwatch(() => props.show, (open) => {\n if (open) draft.value = props.modelValue\n}, { immediate: true })\n\nfunction cancel() { emit('update:show', false) }\n\nfunction confirm() {\n const picked = normalizeHex(draft.value) || draft.value\n if (props.recent) pushRecentColor(picked, props.recentLimit)\n emit('update:modelValue', picked)\n emit('update:show', false)\n}\n</script>\n\n<template>\n <MDialog\n :model-value=\"show\"\n :title=\"title || t.selectColor\"\n max-width=\"328px\"\n :closable=\"false\"\n @update:model-value=\"!$event && cancel()\"\n >\n <MColorPanel\n v-model=\"draft\"\n :presets=\"presets\"\n :alpha=\"alpha\"\n :recent=\"recent\"\n :eyedropper=\"eyedropper\"\n :original=\"modelValue\"\n />\n <template #actions>\n <MButton variant=\"text\" @click=\"cancel\">{{ t.cancel }}</MButton>\n <MButton variant=\"text\" @click=\"confirm\">{{ t.confirm }}</MButton>\n </template>\n </MDialog>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,GA0EM4D,IAAc,IA4JdC,KAAU,qE;;;;;;;;;;;;EAvNhB,IAAMK,IAAQC,GAURC,KAAOH,GACPI,IAAI5B,GAAU,GAGd6B,IAAIC,EAAI,CAAC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
3
|
import { r as n } from "./_popupPosition-C_lxj9qU.js";
|
|
4
4
|
import { t as r } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
5
5
|
import { Fragment as i, Teleport as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, getCurrentInstance as h, mergeProps as g, nextTick as _, normalizeClass as v, onBeforeUnmount as y, onUnmounted as ee, openBlock as b, ref as x, renderSlot as S, toDisplayString as C, unref as w, useId as T, watch as E, withCtx as D, withModifiers as te } from "vue";
|
|
@@ -223,4 +223,4 @@ var B = ["aria-labelledby", "aria-label"], V = {
|
|
|
223
223
|
}), [["__scopeId", "data-v-7b886392"]]);
|
|
224
224
|
export { M as i, P as n, z as r, Z as t };
|
|
225
225
|
|
|
226
|
-
//# sourceMappingURL=MDialog-
|
|
226
|
+
//# sourceMappingURL=MDialog-jAYkZ4M8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDialog-CU8EYgCC.js","names":["$attrs","$slots","_openBlock","_createBlock","_Teleport","_Transition","_withCtx","_createElementBlock","_withModifiers","_createElementVNode","_mergeProps","_renderSlot","_Fragment","_createVNode","MIconButton","_unref","_normalizeClass","_createTextVNode","_toDisplayString","MIconButton_default","useLocale","useEscapeStack","_plugin_vue_export_helper_default","count","previous","lock","unlock","useScrollLock","held","set","on","active","watch","getCurrentInstance","onBeforeUnmount","FOCUSABLE","focusableIn","root","el","stack","listening","handlers","onKeydown","useFocusTrap","key","lastRoot","trapTab","container","items","current","e","first","last","focusInitial","target","options","start","nextTick","stop","i","back","now","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","MDialog_default","defineComponent","__emit","props","__props","locale","isCssValue","v","sizeClasses","computed","sizeStyle","emit","close","contentEl","ref","contentInnerEl","showDivider","resizeObserver","updateDividerVisibility","titleId","useId","surfaceEl","open","onUnmounted","openBlock","createBlock","Teleport","Transition","withCtx","createElementBlock","mergeProps","_ctx","renderSlot","createCommentVNode","unref","createElementVNode","createTextVNode","toDisplayString","withModifiers","Fragment","createVNode","normalizeClass"],"sources":["../src/composables/_useScrollLock.ts","../src/composables/_useFocusTrap.ts","../src/components/MDialog.vue"],"sourcesContent":["import { getCurrentInstance, onBeforeUnmount, watch, type WatchSource } from 'vue'\n\n/*\n * Internal (not exported from index.ts): locks the page's scroll (body overflow hidden) while a modal surface is\n * open, shared by every component that does it. Counted, so overlays stacked on each other (a select's modal or a\n * date picker inside an MDialog) release it only when the last one closes: each component used to write\n * `overflow = ''` on its own, so closing the inner one let the page under the outer one scroll again. Each\n * instance also releases what it holds when it unmounts (a dialog removed while open left the page locked for good)\n * and nothing when it holds nothing (a select unmounting inside an open dialog used to unlock it).\n */\n\nlet count = 0\nlet previous = ''\n\nfunction lock() {\n if (count++ === 0) {\n previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n }\n}\n\nfunction unlock() {\n if (count > 0 && --count === 0) document.body.style.overflow = previous\n}\n\n/**\n * Locks the page's scroll while `active` is true (from the start too: a dialog mounted open locks it), and releases\n * it when it turns false or the component unmounts. Without `active`, drive it with the returned `set`.\n */\nexport function useScrollLock(active?: WatchSource<boolean>) {\n let held = false\n function set(on: boolean) {\n if (typeof document === 'undefined' || on === held) return\n held = on\n if (on) lock()\n else unlock()\n }\n if (active) watch(active, (on) => set(!!on), { immediate: true })\n if (getCurrentInstance()) onBeforeUnmount(() => set(false))\n return { set }\n}\n","import { getCurrentInstance, nextTick, onBeforeUnmount, watch } from 'vue'\n\n/*\n * Internal (not exported from index.ts): keyboard focus for modal surfaces (dialogs, modal sheets and drawers), as\n * the ARIA dialog pattern asks:\n * - on open, focus moves inside: to an element marked `autofocus` / `data-autofocus`, else the first focusable\n * one, else the surface itself (made focusable with tabindex -1);\n * - while open, Tab and Shift+Tab cycle inside it (only the top-most surface traps, so a select's modal or a\n * confirm opened from a dialog takes over and hands back);\n * - on close, focus returns to what had it before (the button that opened it), unless the user already moved it\n * somewhere else.\n */\n\nconst FOCUSABLE = [\n 'a[href]', 'area[href]', 'button:not([disabled])', 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])', 'textarea:not([disabled])', 'iframe', 'audio[controls]', 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])', '[tabindex]:not([tabindex=\"-1\"])',\n].join(',')\n\n/** The elements Tab reaches inside `root`, in order (skipping inert, hidden and disabled ones) */\nexport function focusableIn(root: HTMLElement): HTMLElement[] {\n return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.tabIndex >= 0 && !el.closest('[inert], [hidden]') && getComputedStyle(el).visibility !== 'hidden',\n )\n}\n\nconst stack: symbol[] = []\nlet listening = false\nconst handlers = new Map<symbol, (e: KeyboardEvent) => void>()\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key !== 'Tab' || !stack.length) return\n handlers.get(stack[stack.length - 1]!)?.(e)\n}\n\nexport interface FocusTrapOptions {\n /** What gets focus on open, instead of the first autofocus / focusable element */\n initialFocus?: () => HTMLElement | null | undefined\n /** Return focus to the element that had it before opening (default true) */\n restoreFocus?: boolean\n}\n\n/**\n * Traps keyboard focus in `container()` while `active()` is true; see the file comment. `container` is read after\n * the DOM updates, so a surface rendered by the same `v-if` that `active` drives is already there.\n */\nexport function useFocusTrap(\n container: () => HTMLElement | null | undefined,\n active: () => boolean,\n options: FocusTrapOptions = {},\n) {\n const key = Symbol('focus-trap')\n let previous: HTMLElement | null = null\n let held = false\n // The surface as it was while open: on close its ref is already cleared while a leave animation still shows it\n let lastRoot: HTMLElement | null = null\n\n function trapTab(e: KeyboardEvent) {\n const root = container()\n if (root) lastRoot = root\n if (!root) return\n const items = focusableIn(root)\n const current = document.activeElement as HTMLElement | null\n if (!items.length) {\n e.preventDefault()\n root.focus()\n return\n }\n const first = items[0]!\n const last = items[items.length - 1]!\n if (!current || !root.contains(current)) {\n // Focus had escaped (a click on the scrim, a teleported popup that closed): bring it back\n e.preventDefault()\n ;(e.shiftKey ? last : first).focus()\n } else if (e.shiftKey && (current === first || current === root)) {\n e.preventDefault()\n last.focus()\n } else if (!e.shiftKey && current === last) {\n e.preventDefault()\n first.focus()\n }\n }\n\n function focusInitial() {\n const root = container()\n if (!root) return\n lastRoot = root\n // Something inside already took focus while mounting (an input focusing itself): leave it\n if (root.contains(document.activeElement)) return\n const target =\n options.initialFocus?.() ??\n root.querySelector<HTMLElement>('[autofocus], [data-autofocus]') ??\n focusableIn(root)[0]\n if (target) target.focus({ preventScroll: true })\n else {\n if (!root.hasAttribute('tabindex')) root.setAttribute('tabindex', '-1')\n root.focus({ preventScroll: true })\n }\n }\n\n function start() {\n if (held || typeof document === 'undefined') return\n held = true\n previous = document.activeElement as HTMLElement | null\n stack.push(key)\n handlers.set(key, trapTab)\n if (!listening) {\n document.addEventListener('keydown', onKeydown)\n listening = true\n }\n nextTick(focusInitial)\n }\n\n function stop() {\n if (!held) return\n held = false\n const i = stack.lastIndexOf(key)\n if (i >= 0) stack.splice(i, 1)\n handlers.delete(key)\n if (!stack.length && listening) {\n document.removeEventListener('keydown', onKeydown)\n listening = false\n }\n const back = previous\n previous = null\n if (options.restoreFocus === false || !back) return\n // Restore only when focus is still ours to give: inside the closing surface, or dropped on <body> because the\n // surface was removed. A click that closed it by landing on another control keeps that control focused.\n nextTick(() => {\n const now = document.activeElement\n const root = container() ?? lastRoot\n lastRoot = null\n const ours = !now || now === document.body || !now.isConnected || (root && root.contains(now))\n if (ours && back.isConnected) back.focus({ preventScroll: true })\n })\n }\n\n watch(() => !!active(), (on) => (on ? start() : stop()), { immediate: true, flush: 'post' })\n if (getCurrentInstance()) onBeforeUnmount(stop)\n\n return { focusFirst: focusInitial }\n}\n","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, focus and Teleport are handled internally. Supports a centered\n * card, a full-screen variant, and an optional icon that centers the title per spec.\n *\n * Focus follows the ARIA dialog pattern: on open it moves to an element with `autofocus` (or `data-autofocus`), else\n * the first control that isn't the close button; Tab and Shift+Tab stay inside; closing returns focus to the\n * element that opened it.\n *\n * @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the\n * title, per spec.\n * @slot title Overrides the title prop with custom markup\n * @slot default Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole\n * dialog: it fills the box (no title, padding, close button or actions row)\n * @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long\n * @event update:modelValue Emitted when the dialog should open/close — powers v-model\n */\nimport { computed, nextTick, onUnmounted, ref, useId, watch } from 'vue'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { useScrollLock } from '../composables/_useScrollLock'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\nimport { focusableIn, useFocusTrap } from '../composables/_useFocusTrap'\n\nconst props = withDefaults(\n defineProps<{\n /** Open/closed state (v-model) */\n modelValue: boolean\n /** Dialog title (overridable via the #title slot) */\n title?: string\n /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */\n maxWidth?: string\n /**\n * Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the\n * content is taller, the body scrolls and a divider appears above the actions.\n */\n // A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has\n // no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen\n // viewport-relative cap, not a spec value.\n maxHeight?: string\n /** Prevent closing by clicking the scrim, pressing Escape, or the X button */\n persistent?: boolean\n /** Full-screen variant — slides up from the bottom, covers the entire viewport */\n fullscreen?: boolean\n /** Aria label for the close (X) button — falls back to the locale string when omitted */\n closeLabel?: string\n /**\n * Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be\n * turned off\n */\n // Whether the header shows a close (\"X\") icon button. M3's `AlertDialog` spec has no such\n // button — it expects only a Cancel/Confirm text button in the actions row — so this is a\n // deliberate library extension on top of the spec, kept opt-out (default `true`, matching\n // this component's existing behavior) rather than added unconditionally.\n closable?: boolean\n /**\n * Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default\n * slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves\n * (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`\n * then only names it for assistive technology\n */\n bare?: boolean\n }>(),\n {\n // AlertDialogDefaults.DialogMaxWidth = 560dp\n maxWidth: 'max-w-[560px]',\n maxHeight: 'max-h-[90vh]',\n persistent: false,\n fullscreen: false,\n closable: true,\n bare: false,\n },\n)\n\n// The root is a Teleport, which can't take the consumer's class/style/attrs: they go on the dialog's surface\ndefineOptions({ inheritAttrs: false })\n\nconst locale = useLocale()\n\n// maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function\n// can't be a class, so those go to inline style instead.\nconst isCssValue = (v: string) => /^-?[\\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\\(/i.test(v.trim())\nconst sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))\nconst sizeStyle = computed(() => ({\n ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),\n ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [boolean] }>()\n\nfunction close() {\n if (props.persistent) return\n emit('update:modelValue', false)\n}\n\n\n// M3's dialog anatomy lists an optional divider between the (scrollable) content and the\n// actions row — Compose's own AlertDialog.kt has no built-in implementation of it at all, so\n// this shows it only when the content actually has more to scroll to, above the actions row.\nconst contentEl = ref<HTMLElement>()\nconst contentInnerEl = ref<HTMLElement>()\nconst showDivider = ref(false)\nlet resizeObserver: ResizeObserver | undefined\n\nfunction updateDividerVisibility() {\n const el = contentEl.value\n if (!el) { showDivider.value = false; return }\n showDivider.value = el.scrollHeight - el.scrollTop - el.clientHeight > 1\n}\n\nuseScrollLock(() => props.modelValue)\n// Escape closes the dialog on top only, when several are stacked\nuseEscapeStack(() => props.modelValue, close)\n\nconst titleId = `m3-dialog-${useId()}`\n\n// Focus moves into the dialog when it opens (an `autofocus` element, else the first control that isn't the close\n// button, else the close button, else the surface), Tab stays inside, and closing returns focus to the opener\nconst surfaceEl = ref<HTMLElement>()\nuseFocusTrap(() => surfaceEl.value, () => props.modelValue, {\n initialFocus: () => {\n const root = surfaceEl.value\n if (!root) return null\n return root.querySelector<HTMLElement>('[autofocus], [data-autofocus]') ?? focusableIn(root).find((el) => !el.closest('[data-dialog-close]'))\n },\n})\n\nwatch(\n () => props.modelValue,\n async (open) => {\n // Server rendering (a dialog open on load runs this immediately): nothing to measure or observe\n if (typeof window === 'undefined') return\n if (open) {\n await nextTick()\n updateDividerVisibility()\n // Observing contentEl alone only catches viewport-driven resizes (e.g. window resize\n // changing the maxHeight cap) — its own box stays put when the *slotted* content\n // changes height, since overflow doesn't affect the scroll container's own size. The\n // inner wrapper around the slot grows/shrinks with the actual content, so that's what\n // needs observing to catch dynamic content (reactive text, async-loaded content, etc).\n resizeObserver = new ResizeObserver(updateDividerVisibility)\n if (contentEl.value) resizeObserver.observe(contentEl.value)\n if (contentInnerEl.value) resizeObserver.observe(contentInnerEl.value)\n } else {\n resizeObserver?.disconnect()\n resizeObserver = undefined\n }\n },\n { immediate: true },\n)\n\nonUnmounted(() => {\n resizeObserver?.disconnect()\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <!-- Basic dialog -->\n <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->\n <Transition v-if=\"!fullscreen\" name=\"m3-dialog\" appear>\n <div\n v-if=\"modelValue\"\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4\"\n @click.self=\"close\"\n >\n <div\n ref=\"surfaceEl\"\n v-bind=\"$attrs\"\n class=\"dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col\"\n :class=\"sizeClasses\"\n :style=\"sizeStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole dialog (scrolling if taller than maxHeight), clipped to the box's\n corners (rounded-[inherit]) so content reaching its edges, like a full-bleed image, keeps them -->\n <div v-if=\"bare\" class=\"min-h-0 overflow-y-auto rounded-[inherit]\">\n <slot />\n </div>\n <template v-else>\n <!--\n AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content\n column, with per-element bottom paddings (IconPadding/TitlePadding/textPadding)\n providing the gaps BETWEEN elements — not a single wrapping padding, since this\n template uses separate divs per section instead of one padded Column. Each\n section's own top/bottom classes are chosen so the combined gaps still land on\n the right dp value: title-to-body is 16dp (8px here + 8px there), body-to-actions\n is 24dp (8px here + 16px there), and the outermost edges (top of title, bottom of\n whichever section is last) are the full 24dp on their own.\n -->\n <div class=\"relative px-6 pt-6 pb-2\">\n <!--\n Wrapped in a plain div rather than passing `absolute end-4 top-4` straight to\n MIconButton: its root already carries its own `relative` (for the ripple span),\n and Tailwind resolves conflicting position utilities by source order in the\n compiled CSS, not by order in the class attribute — so an external `absolute`\n can silently lose to that internal `relative` instead of overriding it.\n -->\n <div v-if=\"closable && !persistent\" class=\"absolute end-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.close\" data-dialog-close @click=\"close\" />\n </div>\n <!--\n Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,\n IconSize=24dp expected from the slot content, IconPadding bottom=16dp below it),\n which per spec also centers the title (\"Align the title to the center when an\n icon is present\") — reserving `pe-10` on the title only when the close button is\n also showing, so a centered title doesn't collide with it.\n -->\n <div v-if=\"$slots.icon\" class=\"mb-4 flex justify-center text-secondary\">\n <slot name=\"icon\" />\n </div>\n <h2\n :id=\"titleId\"\n class=\"text-headline-small text-on-surface\"\n :class=\"[\n $slots.icon ? 'text-center' : 'text-start',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pe-10') : '',\n ]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n </div>\n <div\n ref=\"contentEl\"\n class=\"overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant\"\n :class=\"$slots.actions ? 'pb-2' : 'pb-6'\"\n @scroll=\"updateDividerVisibility\"\n >\n <div ref=\"contentInnerEl\">\n <slot />\n </div>\n </div>\n <!-- Divider: M3 dialog anatomy's optional divider, shown only while the content has more to scroll to -->\n <div v-if=\"showDivider && $slots.actions\" class=\"shrink-0 border-t border-outline-variant\" />\n <!-- flex-wrap approximates AlertDialogFlowRow: buttons wrap to a new line instead of overflowing when labels are too long to fit on one -->\n <div v-if=\"$slots.actions\" class=\"flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6\">\n <slot name=\"actions\" />\n </div>\n </template>\n </div>\n </div>\n </Transition>\n\n <!-- Fullscreen dialog -->\n <Transition v-else name=\"m3-dialog-fs\" appear>\n <div\n v-if=\"modelValue\"\n ref=\"surfaceEl\"\n v-bind=\"$attrs\"\n class=\"dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole screen, top bar included, in whatever colors it draws -->\n <div v-if=\"bare\" class=\"min-h-0 flex-1 overflow-y-auto\">\n <slot />\n </div>\n <div v-else class=\"flex h-14 shrink-0 items-center gap-2 px-2\">\n <MIconButton v-if=\"!persistent\" icon=\"close\" :label=\"closeLabel ?? locale.close\" data-dialog-close @click=\"close\" />\n <h2 :id=\"titleId\" class=\"flex-1 text-title-large font-medium text-on-surface\">\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n <div v-if=\"$slots.actions\" class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n <div v-if=\"!bare\" class=\"flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant\">\n <slot />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.m3-dialog-enter-active,\n.m3-dialog-leave-active {\n transition: opacity 0.15s ease;\n}\n.m3-dialog-enter-from,\n.m3-dialog-leave-to {\n opacity: 0;\n}\n.m3-dialog-enter-active .dialog-box,\n.m3-dialog-leave-active .dialog-box {\n transition: transform 0.15s ease;\n}\n.m3-dialog-enter-from .dialog-box,\n.m3-dialog-leave-to .dialog-box {\n transform: scale(0.95);\n}\n\n.m3-dialog-fs-enter-active,\n.m3-dialog-fs-leave-active {\n transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;\n}\n.m3-dialog-fs-enter-from {\n transform: translateY(100%);\n opacity: 0;\n}\n.m3-dialog-fs-leave-to {\n transform: translateY(100%);\n opacity: 0;\n}\n</style>\n\n<style>\n/* The surfaces' look, in the base layer so the consumer's classes on MDialog win (see MShape) */\n@layer base {\n .m3-dialog-surface {\n background-color: var(--color-surface-container-high);\n border-radius: var(--radius-xl);\n box-shadow: var(--shadow-elevation-3);\n }\n .m3-dialog-fs-surface {\n background-color: var(--color-surface);\n }\n}\n</style>\n"],"mappings":";;;;;;AAWA,IAAIuB,IAAQ,GACRC,IAAW;AAEf,SAASC,IAAO;CACd,AAAI,QAAY,MACd,IAAW,SAAS,KAAK,MAAM,UAC/B,SAAS,KAAK,MAAM,WAAW;AAEnC;AAEA,SAASC,IAAS;CAChB,AAAIH,IAAQ,KAAK,EAAEA,MAAU,MAAG,SAAS,KAAK,MAAM,WAAWC;AACjE;AAMA,SAAgBG,EAAc,GAA+B;CAC3D,IAAIC,IAAO;CACX,SAASC,EAAI,GAAa;EACxB,AAAI,OAAO,WAAa,OAAeC,MAAOF,MAC9C,IAAOE,GACHA,IAAIL,EAAK,IACRC,EAAO;CACd;CAGA,OAFIK,KAAQC,EAAMD,IAAS,MAAOF,EAAI,CAAC,CAACC,CAA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AAmB,SAAOO;;KAS/ErF,EAAAA,OAAO,QAAlBC,EAAA,GAAAK,EAEM,OAFN2D,GAEM,CADJvD,EAAoB8F,EAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C;KAEtBhG,EASK,MAAA;MARF,IAAIoF;MACL,OAAK7E,EAAA,CAAC,uCAAqC,CACff,EAAAA,OAAO,OAAI,gBAAA,cAAmD6E,EAAA,YAAQ,CAAKA,EAAA,aAAc7E,EAAAA,OAAO,OAAI,UAAA,UAAA,E;K,IAKhIU,EAAqC8F,EAAA,QAAA,SAAA,CAAA,SAAA,CAAfxF,EAAAC,EAAA4D,EAAA,KAAK,GAAA,CAAA,C;;IAG/BrE,EASM,OAAA;KARA,SAAA;KAAJ,KAAI8E;KACJ,OAAKvE,EAAA,CAAC,sEACEf,EAAAA,OAAO,UAAO,SAAA,MAAA,CAAA;KACrB,UAAQ2F;I,IAETnF,EAEM,OAAA;KAFG,SAAA;KAAJ,KAAIgF;I,IACP9E,EAAQ8F,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C;IAIDf,EAAA,SAAezF,EAAAA,OAAO,WAAjCC,EAAA,GAAAK,EAA6F,OAA7F4D,CAA6F,K;IAElFlE,EAAAA,OAAO,WAAlBC,EAAA,GAAAK,EAEM,OAFN6D,GAEM,CADJzD,EAAuB8F,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C"}
|
|
1
|
+
{"version":3,"file":"MDialog-jAYkZ4M8.js","names":["$attrs","$slots","_openBlock","_createBlock","_Teleport","_Transition","_withCtx","_createElementBlock","_withModifiers","_createElementVNode","_mergeProps","_renderSlot","_Fragment","_createVNode","MIconButton","_unref","_normalizeClass","_createTextVNode","_toDisplayString","MIconButton_default","useLocale","useEscapeStack","_plugin_vue_export_helper_default","count","previous","lock","unlock","useScrollLock","held","set","on","active","watch","getCurrentInstance","onBeforeUnmount","FOCUSABLE","focusableIn","root","el","stack","listening","handlers","onKeydown","useFocusTrap","key","lastRoot","trapTab","container","items","current","e","first","last","focusInitial","target","options","start","nextTick","stop","i","back","now","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","MDialog_default","defineComponent","__emit","props","__props","locale","isCssValue","v","sizeClasses","computed","sizeStyle","emit","close","contentEl","ref","contentInnerEl","showDivider","resizeObserver","updateDividerVisibility","titleId","useId","surfaceEl","open","onUnmounted","openBlock","createBlock","Teleport","Transition","withCtx","createElementBlock","mergeProps","_ctx","renderSlot","createCommentVNode","unref","createElementVNode","createTextVNode","toDisplayString","withModifiers","Fragment","createVNode","normalizeClass"],"sources":["../src/composables/_useScrollLock.ts","../src/composables/_useFocusTrap.ts","../src/components/MDialog.vue"],"sourcesContent":["import { getCurrentInstance, onBeforeUnmount, watch, type WatchSource } from 'vue'\n\n/*\n * Internal (not exported from index.ts): locks the page's scroll (body overflow hidden) while a modal surface is\n * open, shared by every component that does it. Counted, so overlays stacked on each other (a select's modal or a\n * date picker inside an MDialog) release it only when the last one closes: each component used to write\n * `overflow = ''` on its own, so closing the inner one let the page under the outer one scroll again. Each\n * instance also releases what it holds when it unmounts (a dialog removed while open left the page locked for good)\n * and nothing when it holds nothing (a select unmounting inside an open dialog used to unlock it).\n */\n\nlet count = 0\nlet previous = ''\n\nfunction lock() {\n if (count++ === 0) {\n previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n }\n}\n\nfunction unlock() {\n if (count > 0 && --count === 0) document.body.style.overflow = previous\n}\n\n/**\n * Locks the page's scroll while `active` is true (from the start too: a dialog mounted open locks it), and releases\n * it when it turns false or the component unmounts. Without `active`, drive it with the returned `set`.\n */\nexport function useScrollLock(active?: WatchSource<boolean>) {\n let held = false\n function set(on: boolean) {\n if (typeof document === 'undefined' || on === held) return\n held = on\n if (on) lock()\n else unlock()\n }\n if (active) watch(active, (on) => set(!!on), { immediate: true })\n if (getCurrentInstance()) onBeforeUnmount(() => set(false))\n return { set }\n}\n","import { getCurrentInstance, nextTick, onBeforeUnmount, watch } from 'vue'\n\n/*\n * Internal (not exported from index.ts): keyboard focus for modal surfaces (dialogs, modal sheets and drawers), as\n * the ARIA dialog pattern asks:\n * - on open, focus moves inside: to an element marked `autofocus` / `data-autofocus`, else the first focusable\n * one, else the surface itself (made focusable with tabindex -1);\n * - while open, Tab and Shift+Tab cycle inside it (only the top-most surface traps, so a select's modal or a\n * confirm opened from a dialog takes over and hands back);\n * - on close, focus returns to what had it before (the button that opened it), unless the user already moved it\n * somewhere else.\n */\n\nconst FOCUSABLE = [\n 'a[href]', 'area[href]', 'button:not([disabled])', 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])', 'textarea:not([disabled])', 'iframe', 'audio[controls]', 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])', '[tabindex]:not([tabindex=\"-1\"])',\n].join(',')\n\n/** The elements Tab reaches inside `root`, in order (skipping inert, hidden and disabled ones) */\nexport function focusableIn(root: HTMLElement): HTMLElement[] {\n return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.tabIndex >= 0 && !el.closest('[inert], [hidden]') && getComputedStyle(el).visibility !== 'hidden',\n )\n}\n\nconst stack: symbol[] = []\nlet listening = false\nconst handlers = new Map<symbol, (e: KeyboardEvent) => void>()\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key !== 'Tab' || !stack.length) return\n handlers.get(stack[stack.length - 1]!)?.(e)\n}\n\nexport interface FocusTrapOptions {\n /** What gets focus on open, instead of the first autofocus / focusable element */\n initialFocus?: () => HTMLElement | null | undefined\n /** Return focus to the element that had it before opening (default true) */\n restoreFocus?: boolean\n}\n\n/**\n * Traps keyboard focus in `container()` while `active()` is true; see the file comment. `container` is read after\n * the DOM updates, so a surface rendered by the same `v-if` that `active` drives is already there.\n */\nexport function useFocusTrap(\n container: () => HTMLElement | null | undefined,\n active: () => boolean,\n options: FocusTrapOptions = {},\n) {\n const key = Symbol('focus-trap')\n let previous: HTMLElement | null = null\n let held = false\n // The surface as it was while open: on close its ref is already cleared while a leave animation still shows it\n let lastRoot: HTMLElement | null = null\n\n function trapTab(e: KeyboardEvent) {\n const root = container()\n if (root) lastRoot = root\n if (!root) return\n const items = focusableIn(root)\n const current = document.activeElement as HTMLElement | null\n if (!items.length) {\n e.preventDefault()\n root.focus()\n return\n }\n const first = items[0]!\n const last = items[items.length - 1]!\n if (!current || !root.contains(current)) {\n // Focus had escaped (a click on the scrim, a teleported popup that closed): bring it back\n e.preventDefault()\n ;(e.shiftKey ? last : first).focus()\n } else if (e.shiftKey && (current === first || current === root)) {\n e.preventDefault()\n last.focus()\n } else if (!e.shiftKey && current === last) {\n e.preventDefault()\n first.focus()\n }\n }\n\n function focusInitial() {\n const root = container()\n if (!root) return\n lastRoot = root\n // Something inside already took focus while mounting (an input focusing itself): leave it\n if (root.contains(document.activeElement)) return\n const target =\n options.initialFocus?.() ??\n root.querySelector<HTMLElement>('[autofocus], [data-autofocus]') ??\n focusableIn(root)[0]\n if (target) target.focus({ preventScroll: true })\n else {\n if (!root.hasAttribute('tabindex')) root.setAttribute('tabindex', '-1')\n root.focus({ preventScroll: true })\n }\n }\n\n function start() {\n if (held || typeof document === 'undefined') return\n held = true\n previous = document.activeElement as HTMLElement | null\n stack.push(key)\n handlers.set(key, trapTab)\n if (!listening) {\n document.addEventListener('keydown', onKeydown)\n listening = true\n }\n nextTick(focusInitial)\n }\n\n function stop() {\n if (!held) return\n held = false\n const i = stack.lastIndexOf(key)\n if (i >= 0) stack.splice(i, 1)\n handlers.delete(key)\n if (!stack.length && listening) {\n document.removeEventListener('keydown', onKeydown)\n listening = false\n }\n const back = previous\n previous = null\n if (options.restoreFocus === false || !back) return\n // Restore only when focus is still ours to give: inside the closing surface, or dropped on <body> because the\n // surface was removed. A click that closed it by landing on another control keeps that control focused.\n nextTick(() => {\n const now = document.activeElement\n const root = container() ?? lastRoot\n lastRoot = null\n const ours = !now || now === document.body || !now.isConnected || (root && root.contains(now))\n if (ours && back.isConnected) back.focus({ preventScroll: true })\n })\n }\n\n watch(() => !!active(), (on) => (on ? start() : stop()), { immediate: true, flush: 'post' })\n if (getCurrentInstance()) onBeforeUnmount(stop)\n\n return { focusFirst: focusInitial }\n}\n","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, focus and Teleport are handled internally. Supports a centered\n * card, a full-screen variant, and an optional icon that centers the title per spec.\n *\n * Focus follows the ARIA dialog pattern: on open it moves to an element with `autofocus` (or `data-autofocus`), else\n * the first control that isn't the close button; Tab and Shift+Tab stay inside; closing returns focus to the\n * element that opened it.\n *\n * @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the\n * title, per spec.\n * @slot title Overrides the title prop with custom markup\n * @slot default Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole\n * dialog: it fills the box (no title, padding, close button or actions row)\n * @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long\n * @event update:modelValue Emitted when the dialog should open/close — powers v-model\n */\nimport { computed, nextTick, onUnmounted, ref, useId, watch } from 'vue'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { useScrollLock } from '../composables/_useScrollLock'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\nimport { focusableIn, useFocusTrap } from '../composables/_useFocusTrap'\n\nconst props = withDefaults(\n defineProps<{\n /** Open/closed state (v-model) */\n modelValue: boolean\n /** Dialog title (overridable via the #title slot) */\n title?: string\n /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */\n maxWidth?: string\n /**\n * Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the\n * content is taller, the body scrolls and a divider appears above the actions.\n */\n // A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has\n // no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen\n // viewport-relative cap, not a spec value.\n maxHeight?: string\n /** Prevent closing by clicking the scrim, pressing Escape, or the X button */\n persistent?: boolean\n /** Full-screen variant — slides up from the bottom, covers the entire viewport */\n fullscreen?: boolean\n /** Aria label for the close (X) button — falls back to the locale string when omitted */\n closeLabel?: string\n /**\n * Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be\n * turned off\n */\n // Whether the header shows a close (\"X\") icon button. M3's `AlertDialog` spec has no such\n // button — it expects only a Cancel/Confirm text button in the actions row — so this is a\n // deliberate library extension on top of the spec, kept opt-out (default `true`, matching\n // this component's existing behavior) rather than added unconditionally.\n closable?: boolean\n /**\n * Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default\n * slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves\n * (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`\n * then only names it for assistive technology\n */\n bare?: boolean\n }>(),\n {\n // AlertDialogDefaults.DialogMaxWidth = 560dp\n maxWidth: 'max-w-[560px]',\n maxHeight: 'max-h-[90vh]',\n persistent: false,\n fullscreen: false,\n closable: true,\n bare: false,\n },\n)\n\n// The root is a Teleport, which can't take the consumer's class/style/attrs: they go on the dialog's surface\ndefineOptions({ inheritAttrs: false })\n\nconst locale = useLocale()\n\n// maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function\n// can't be a class, so those go to inline style instead.\nconst isCssValue = (v: string) => /^-?[\\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\\(/i.test(v.trim())\nconst sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))\nconst sizeStyle = computed(() => ({\n ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),\n ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [boolean] }>()\n\nfunction close() {\n if (props.persistent) return\n emit('update:modelValue', false)\n}\n\n\n// M3's dialog anatomy lists an optional divider between the (scrollable) content and the\n// actions row — Compose's own AlertDialog.kt has no built-in implementation of it at all, so\n// this shows it only when the content actually has more to scroll to, above the actions row.\nconst contentEl = ref<HTMLElement>()\nconst contentInnerEl = ref<HTMLElement>()\nconst showDivider = ref(false)\nlet resizeObserver: ResizeObserver | undefined\n\nfunction updateDividerVisibility() {\n const el = contentEl.value\n if (!el) { showDivider.value = false; return }\n showDivider.value = el.scrollHeight - el.scrollTop - el.clientHeight > 1\n}\n\nuseScrollLock(() => props.modelValue)\n// Escape closes the dialog on top only, when several are stacked\nuseEscapeStack(() => props.modelValue, close)\n\nconst titleId = `m3-dialog-${useId()}`\n\n// Focus moves into the dialog when it opens (an `autofocus` element, else the first control that isn't the close\n// button, else the close button, else the surface), Tab stays inside, and closing returns focus to the opener\nconst surfaceEl = ref<HTMLElement>()\nuseFocusTrap(() => surfaceEl.value, () => props.modelValue, {\n initialFocus: () => {\n const root = surfaceEl.value\n if (!root) return null\n return root.querySelector<HTMLElement>('[autofocus], [data-autofocus]') ?? focusableIn(root).find((el) => !el.closest('[data-dialog-close]'))\n },\n})\n\nwatch(\n () => props.modelValue,\n async (open) => {\n // Server rendering (a dialog open on load runs this immediately): nothing to measure or observe\n if (typeof window === 'undefined') return\n if (open) {\n await nextTick()\n updateDividerVisibility()\n // Observing contentEl alone only catches viewport-driven resizes (e.g. window resize\n // changing the maxHeight cap) — its own box stays put when the *slotted* content\n // changes height, since overflow doesn't affect the scroll container's own size. The\n // inner wrapper around the slot grows/shrinks with the actual content, so that's what\n // needs observing to catch dynamic content (reactive text, async-loaded content, etc).\n resizeObserver = new ResizeObserver(updateDividerVisibility)\n if (contentEl.value) resizeObserver.observe(contentEl.value)\n if (contentInnerEl.value) resizeObserver.observe(contentInnerEl.value)\n } else {\n resizeObserver?.disconnect()\n resizeObserver = undefined\n }\n },\n { immediate: true },\n)\n\nonUnmounted(() => {\n resizeObserver?.disconnect()\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <!-- Basic dialog -->\n <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->\n <Transition v-if=\"!fullscreen\" name=\"m3-dialog\" appear>\n <div\n v-if=\"modelValue\"\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4\"\n @click.self=\"close\"\n >\n <div\n ref=\"surfaceEl\"\n v-bind=\"$attrs\"\n class=\"dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col\"\n :class=\"sizeClasses\"\n :style=\"sizeStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole dialog (scrolling if taller than maxHeight), clipped to the box's\n corners (rounded-[inherit]) so content reaching its edges, like a full-bleed image, keeps them -->\n <div v-if=\"bare\" class=\"min-h-0 overflow-y-auto rounded-[inherit]\">\n <slot />\n </div>\n <template v-else>\n <!--\n AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content\n column, with per-element bottom paddings (IconPadding/TitlePadding/textPadding)\n providing the gaps BETWEEN elements — not a single wrapping padding, since this\n template uses separate divs per section instead of one padded Column. Each\n section's own top/bottom classes are chosen so the combined gaps still land on\n the right dp value: title-to-body is 16dp (8px here + 8px there), body-to-actions\n is 24dp (8px here + 16px there), and the outermost edges (top of title, bottom of\n whichever section is last) are the full 24dp on their own.\n -->\n <div class=\"relative px-6 pt-6 pb-2\">\n <!--\n Wrapped in a plain div rather than passing `absolute end-4 top-4` straight to\n MIconButton: its root already carries its own `relative` (for the ripple span),\n and Tailwind resolves conflicting position utilities by source order in the\n compiled CSS, not by order in the class attribute — so an external `absolute`\n can silently lose to that internal `relative` instead of overriding it.\n -->\n <div v-if=\"closable && !persistent\" class=\"absolute end-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.close\" data-dialog-close @click=\"close\" />\n </div>\n <!--\n Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,\n IconSize=24dp expected from the slot content, IconPadding bottom=16dp below it),\n which per spec also centers the title (\"Align the title to the center when an\n icon is present\") — reserving `pe-10` on the title only when the close button is\n also showing, so a centered title doesn't collide with it.\n -->\n <div v-if=\"$slots.icon\" class=\"mb-4 flex justify-center text-secondary\">\n <slot name=\"icon\" />\n </div>\n <h2\n :id=\"titleId\"\n class=\"text-headline-small text-on-surface\"\n :class=\"[\n $slots.icon ? 'text-center' : 'text-start',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pe-10') : '',\n ]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n </div>\n <div\n ref=\"contentEl\"\n class=\"overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant\"\n :class=\"$slots.actions ? 'pb-2' : 'pb-6'\"\n @scroll=\"updateDividerVisibility\"\n >\n <div ref=\"contentInnerEl\">\n <slot />\n </div>\n </div>\n <!-- Divider: M3 dialog anatomy's optional divider, shown only while the content has more to scroll to -->\n <div v-if=\"showDivider && $slots.actions\" class=\"shrink-0 border-t border-outline-variant\" />\n <!-- flex-wrap approximates AlertDialogFlowRow: buttons wrap to a new line instead of overflowing when labels are too long to fit on one -->\n <div v-if=\"$slots.actions\" class=\"flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6\">\n <slot name=\"actions\" />\n </div>\n </template>\n </div>\n </div>\n </Transition>\n\n <!-- Fullscreen dialog -->\n <Transition v-else name=\"m3-dialog-fs\" appear>\n <div\n v-if=\"modelValue\"\n ref=\"surfaceEl\"\n v-bind=\"$attrs\"\n class=\"dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole screen, top bar included, in whatever colors it draws -->\n <div v-if=\"bare\" class=\"min-h-0 flex-1 overflow-y-auto\">\n <slot />\n </div>\n <div v-else class=\"flex h-14 shrink-0 items-center gap-2 px-2\">\n <MIconButton v-if=\"!persistent\" icon=\"close\" :label=\"closeLabel ?? locale.close\" data-dialog-close @click=\"close\" />\n <h2 :id=\"titleId\" class=\"flex-1 text-title-large font-medium text-on-surface\">\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n <div v-if=\"$slots.actions\" class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n <div v-if=\"!bare\" class=\"flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant\">\n <slot />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.m3-dialog-enter-active,\n.m3-dialog-leave-active {\n transition: opacity 0.15s ease;\n}\n.m3-dialog-enter-from,\n.m3-dialog-leave-to {\n opacity: 0;\n}\n.m3-dialog-enter-active .dialog-box,\n.m3-dialog-leave-active .dialog-box {\n transition: transform 0.15s ease;\n}\n.m3-dialog-enter-from .dialog-box,\n.m3-dialog-leave-to .dialog-box {\n transform: scale(0.95);\n}\n\n.m3-dialog-fs-enter-active,\n.m3-dialog-fs-leave-active {\n transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;\n}\n.m3-dialog-fs-enter-from {\n transform: translateY(100%);\n opacity: 0;\n}\n.m3-dialog-fs-leave-to {\n transform: translateY(100%);\n opacity: 0;\n}\n</style>\n\n<style>\n/* The surfaces' look, in the base layer so the consumer's classes on MDialog win (see MShape) */\n@layer base {\n .m3-dialog-surface {\n background-color: var(--color-surface-container-high);\n border-radius: var(--radius-xl);\n box-shadow: var(--shadow-elevation-3);\n }\n .m3-dialog-fs-surface {\n background-color: var(--color-surface);\n }\n}\n</style>\n"],"mappings":";;;;;;AAWA,IAAIuB,IAAQ,GACRC,IAAW;AAEf,SAASC,IAAO;CACd,AAAI,QAAY,MACd,IAAW,SAAS,KAAK,MAAM,UAC/B,SAAS,KAAK,MAAM,WAAW;AAEnC;AAEA,SAASC,IAAS;CAChB,A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