@m3ui-vue/m3ui-vue 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +649 -28
- package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
- package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
- package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-BKM1CHxr.js} +4 -4
- package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-BKM1CHxr.js.map} +1 -1
- package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
- package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
- package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
- package/dist/MListItem-BU5KDRCB.js.map +1 -0
- package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
- package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
- package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
- package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
- package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
- package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
- package/dist/MSlider-BCeVIxcq.js +739 -0
- package/dist/MSlider-BCeVIxcq.js.map +1 -0
- package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
- package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
- package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
- package/dist/MTextField-NaFbMkjv.js.map +1 -0
- package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
- package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +184 -103
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +18 -3
- package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAutocomplete.vue.d.ts +22 -3
- package/dist/components/MCheckbox.vue.d.ts +23 -1
- package/dist/components/MCodeEditor.vue.d.ts +23 -1
- package/dist/components/MColorPicker.vue.d.ts +24 -3
- package/dist/components/MConfirmDialog.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +13 -2
- package/dist/components/MCreditCardInput.vue.d.ts +33 -0
- package/dist/components/MCronField.vue.d.ts +23 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDatePicker.vue.d.ts +24 -3
- package/dist/components/MDateRangePicker.vue.d.ts +24 -3
- package/dist/components/MFileUpload.vue.d.ts +23 -2
- package/dist/components/MForm.vue.d.ts +61 -0
- package/dist/components/MJsonEditor.vue.d.ts +23 -1
- package/dist/components/MMapRoute.vue.d.ts +168 -0
- package/dist/components/MMaskField.vue.d.ts +20 -2
- package/dist/components/MMentionField.vue.d.ts +13 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
- package/dist/components/MMultiSelect.vue.d.ts +22 -3
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +2 -2
- package/dist/components/MNumberField.vue.d.ts +20 -2
- package/dist/components/MPhoneInput.vue.d.ts +19 -4
- package/dist/components/MPinInput.vue.d.ts +24 -3
- package/dist/components/MPosKeypad.vue.d.ts +2 -2
- package/dist/components/MRadioGroup.vue.d.ts +23 -1
- package/dist/components/MRating.vue.d.ts +23 -1
- package/dist/components/MRichTextEditor.vue.d.ts +23 -1
- package/dist/components/MSearchBar.vue.d.ts +1 -1
- package/dist/components/MSegmentedButton.vue.d.ts +23 -2
- package/dist/components/MSelect.vue.d.ts +22 -3
- package/dist/components/MSignaturePad.vue.d.ts +19 -0
- package/dist/components/MSlider.vue.d.ts +23 -1
- package/dist/components/MSwitch.vue.d.ts +23 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +20 -2
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +26 -3
- package/dist/components/MTimePicker.vue.d.ts +24 -3
- package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
- package/dist/components/MTour.vue.d.ts +2 -2
- package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
- package/dist/components/MWindow.vue.d.ts +2 -2
- package/dist/composables/_routeGeometry.d.ts +26 -0
- package/dist/composables/_useFieldValidation.d.ts +91 -0
- package/dist/composables/mapRouting.d.ts +35 -0
- package/dist/composables/useLocale.d.ts +23 -0
- package/dist/composables/validation.d.ts +82 -0
- package/dist/draw.js +2 -2
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/locales/index.js +154 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6768 -5602
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.js +1230 -784
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +189 -146
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MForm.test.ts +325 -0
- package/src/__tests__/MMapRoute.test.ts +384 -0
- package/src/__tests__/MPhoneInput.test.ts +5 -2
- package/src/__tests__/MRichTextEditor.test.ts +2 -1
- package/src/__tests__/MTrackingTimeline.test.ts +66 -0
- package/src/__tests__/_fakeMaplibre.ts +4 -1
- package/src/__tests__/_osrmRoutes.ts +10 -0
- package/src/__tests__/attrsFallthrough.test.ts +11 -0
- package/src/__tests__/fieldsValidation.test.ts +229 -0
- package/src/__tests__/ssr.test.ts +1 -0
- package/src/__tests__/validation.test.ts +77 -0
- package/src/components/MAddressField.vue +45 -8
- package/src/components/MAutocomplete.vue +69 -23
- package/src/components/MCheckbox.vue +80 -17
- package/src/components/MCodeEditor.vue +59 -2
- package/src/components/MColorPicker.vue +65 -16
- package/src/components/MCountrySelect.vue +17 -3
- package/src/components/MCreditCardInput.vue +76 -7
- package/src/components/MCronField.vue +60 -10
- package/src/components/MDatePicker.vue +65 -16
- package/src/components/MDateRangePicker.vue +66 -16
- package/src/components/MFileUpload.vue +71 -8
- package/src/components/MForm.vue +208 -0
- package/src/components/MJsonEditor.vue +57 -3
- package/src/components/MMapRoute.vue +470 -0
- package/src/components/MMaskField.vue +55 -13
- package/src/components/MMentionField.vue +17 -2
- package/src/components/MMultiAutocomplete.vue +70 -23
- package/src/components/MMultiSelect.vue +70 -23
- package/src/components/MNumberField.vue +58 -16
- package/src/components/MPhoneInput.vue +60 -18
- package/src/components/MPinInput.vue +58 -10
- package/src/components/MRadioGroup.vue +65 -4
- package/src/components/MRating.vue +62 -6
- package/src/components/MRichTextEditor.vue +64 -4
- package/src/components/MSegmentedButton.vue +59 -2
- package/src/components/MSelect.vue +72 -26
- package/src/components/MSignaturePad.vue +71 -6
- package/src/components/MSlider.vue +61 -10
- package/src/components/MSwitch.vue +63 -8
- package/src/components/MTagInput.vue +67 -25
- package/src/components/MTextField.vue +68 -14
- package/src/components/MTimePicker.vue +65 -16
- package/src/components/MTimezoneSelect.vue +17 -3
- package/src/components/MTrackingTimeline.vue +257 -0
- package/src/composables/_routeGeometry.ts +140 -0
- package/src/composables/_useFieldValidation.ts +287 -0
- package/src/composables/mapRouting.ts +55 -0
- package/src/composables/useLocale.ts +46 -0
- package/src/composables/validation.ts +178 -0
- package/src/index.ts +5 -0
- package/src/locales/de.ts +21 -0
- package/src/locales/es.ts +28 -7
- package/src/locales/fr.ts +21 -0
- package/src/locales/ja.ts +21 -0
- package/src/locales/ko.ts +21 -0
- package/src/locales/pt.ts +21 -0
- package/src/locales/zh.ts +21 -0
- package/src/map.ts +4 -0
- package/dist/MListItem-D2cNUyzP.js.map +0 -1
- package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
- package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
- package/dist/MSlider-BIkA6DiE.js +0 -690
- package/dist/MSlider-BIkA6DiE.js.map +0 -1
- package/dist/MTextField-CNH-byir.js.map +0 -1
- package/dist/useLocale-DaVSTdm0.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./MSpinner-
|
|
1
|
+
import { t as e } from "./MSpinner-Cs03qoqE.js";
|
|
2
2
|
import { t } from "./MIcon-DpajuUTJ.js";
|
|
3
3
|
import { p as n } from "./MIconButton-BBggVwBV.js";
|
|
4
4
|
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, renderSlot as f, resolveDynamicComponent as p, unref as m, withCtx as h, withDirectives as g } from "vue";
|
|
@@ -168,4 +168,4 @@ var _ = "relative inline-flex items-center justify-center font-medium whitespace
|
|
|
168
168
|
});
|
|
169
169
|
export { v as t };
|
|
170
170
|
|
|
171
|
-
//# sourceMappingURL=MButton-
|
|
171
|
+
//# sourceMappingURL=MButton-CN3wYwIG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MButton-OQ4wIERQ.js","names":["_withDirectives","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withCtx","_createElementBlock","_Fragment","MSpinner","MIcon","_renderSlot","_unref","MSpinner_default","vRipple","base","MButton_default","defineComponent","NAMED_COLORS","props","__props","tag","computed","isCustomColor","customStyle","isError","ROLE","style","c","disabledContainerClasses","sizeMap","s","sizeClasses","iconSize","spinnerSize","px","shapeClass","variantClasses","err","withDirectives","openBlock","createBlock","resolveDynamicComponent","normalizeClass","normalizeStyle","withCtx","createElementBlock","Fragment","MIcon_default","createCommentVNode","renderSlot","_ctx","unref"],"sources":["../src/components/MButton.vue"],"sourcesContent":["<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 { 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.\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 '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-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\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\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 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\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":";;;;;AAkGA,IAAMe,IACJ,8e;;;;;;;;;;;;;;;;;;;;;;;;EAxFF,IAAMG,IAAe,CAAC,WAAW,OAAO,GAGlCC,IAAQC,GA0DRC,IAAMC,QAAeH,EAAM,KAAK,eAAe,QAAQ,GAEvDI,IAAgBD,QACd,CAAC,CAACH,EAAM,SAAS,CAAED,EAAmC,SAASC,EAAM,KAAK,CAClF,GAEMK,IAAcF,QAAe;GACjC,IAAKC,EAAc,OACnB,OAAO;IACL,mBAAmBJ,EAAM;IACzB,sBAAsB;IACtB,6BAA6BA,EAAM,QAAQ;IAC3C,gCAAgCA,EAAM;GACxC;EACF,CAAC,GAEKM,IAAUH,QAAeH,EAAM,UAAU,OAAO,GAGhDO,IAAO,4HACPC,IAAQL,QAAe;GAC3B,IAAMM,IAAIT,EAAM;GAEhB,OADI,CAACS,KAAKT,EAAM,YAAYA,EAAM,UAAgBK,EAAY,QACvD;IAAE,GAAGA,EAAY;IAAO,OAAOE,EAAK,KAAKE,CAAC,IAAI,eAAeA,EAAE,KAAKA;GAAE;EAC/E,CAAC,GAgBKC,IAA2BP,QAAe;GAC9C,QAAQH,EAAM,SAAd;IACE,KAAK;IACL,KAAK;IACL,KAAK,YACH,OAAO;IACT,KAAK,YACH,OAAOM,EAAQ,QAAQ,6BAA6B;IACtD,SACE,OAAO;GACX;EACF,CAAC,GAcKK,IAAU;GACd,IAAI;IAAE,GAAG;IAAO,MAAM;IAAoB,MAAM;IAAI,SAAS;IAAI,KAAK;IAAS,IAAI;IAAQ,QAAQ;IAAQ,cAAc;GAAa;GACtI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ACV,MAAMA,EAAA,KAAK,KAAA,IAAYA,EAAA;GACvB,UAAUA,EAAA,YAAYA,EAAA;GACtB,OAAKhB,EAAA;IAAGW;IAAMqB,EAAA;IAAYJ,EAAA;IAAaG,EAAA;IAAIE,EAAA;IAAgBR,EAAA;GAAwB,CAAA;GACnF,OAAKxB,EAAEsB,EAAA,KAAK;;GAGb,SAAArB,QAGW;IAHKc,EAAA,YAAO,aAAvBnB,EAAA,GAAAM,EAGWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAFOY,EAAA,WAAhBnB,EAAA,GAAAC,EAA+CO,GAAA;;KAArB,MAAMyB,EAAA;I,yBACdd,EAAA,QAAlBnB,EAAA,GAAAC,EAA6EQ,GAAA;;KAApD,MAAMU,EAAA;KAAO,MAAMa,EAAA;KAAW,QAAQb,EAAA;;;;;;IAEjET,EAAQwC,EAAA,QAAA,SAAA;IACQ/B,EAAA,YAAO,cAAvBnB,EAAA,GAAAM,EAGWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAFOY,EAAA,WAAhBnB,EAAA,GAAAC,EAA+CO,GAAA;;KAArB,MAAMyB,EAAA;I,yBACdd,EAAA,QAAlBnB,EAAA,GAAAC,EAA6EQ,GAAA;;KAApD,MAAMU,EAAA;KAAO,MAAMa,EAAA;KAAW,QAAQb,EAAA;;;;;;;;;;;;;;E,MAT3C,CAAAR,EAAAE,CAAA,GAAA;GAAA,UAAAM,EAAA,YAAYA,EAAA;GAAO,OAASA,EAAA;EAAW,CAAA,C"}
|
|
1
|
+
{"version":3,"file":"MButton-CN3wYwIG.js","names":["_withDirectives","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withCtx","_createElementBlock","_Fragment","MSpinner","MIcon","_renderSlot","_unref","MSpinner_default","vRipple","base","MButton_default","defineComponent","NAMED_COLORS","props","__props","tag","computed","isCustomColor","customStyle","isError","ROLE","style","c","disabledContainerClasses","sizeMap","s","sizeClasses","iconSize","spinnerSize","px","shapeClass","variantClasses","err","withDirectives","openBlock","createBlock","resolveDynamicComponent","normalizeClass","normalizeStyle","withCtx","createElementBlock","Fragment","MIcon_default","createCommentVNode","renderSlot","_ctx","unref"],"sources":["../src/components/MButton.vue"],"sourcesContent":["<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 { 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.\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 '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-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\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\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 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\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":";;;;;AAkGA,IAAMe,IACJ,8e;;;;;;;;;;;;;;;;;;;;;;;;EAxFF,IAAMG,IAAe,CAAC,WAAW,OAAO,GAGlCC,IAAQC,GA0DRC,IAAMC,QAAeH,EAAM,KAAK,eAAe,QAAQ,GAEvDI,IAAgBD,QACd,CAAC,CAACH,EAAM,SAAS,CAAED,EAAmC,SAASC,EAAM,KAAK,CAClF,GAEMK,IAAcF,QAAe;GACjC,IAAKC,EAAc,OACnB,OAAO;IACL,mBAAmBJ,EAAM;IACzB,sBAAsB;IACtB,6BAA6BA,EAAM,QAAQ;IAC3C,gCAAgCA,EAAM;GACxC;EACF,CAAC,GAEKM,IAAUH,QAAeH,EAAM,UAAU,OAAO,GAGhDO,IAAO,4HACPC,IAAQL,QAAe;GAC3B,IAAMM,IAAIT,EAAM;GAEhB,OADI,CAACS,KAAKT,EAAM,YAAYA,EAAM,UAAgBK,EAAY,QACvD;IAAE,GAAGA,EAAY;IAAO,OAAOE,EAAK,KAAKE,CAAC,IAAI,eAAeA,EAAE,KAAKA;GAAE;EAC/E,CAAC,GAgBKC,IAA2BP,QAAe;GAC9C,QAAQH,EAAM,SAAd;IACE,KAAK;IACL,KAAK;IACL,KAAK,YACH,OAAO;IACT,KAAK,YACH,OAAOM,EAAQ,QAAQ,6BAA6B;IACtD,SACE,OAAO;GACX;EACF,CAAC,GAcKK,IAAU;GACd,IAAI;IAAE,GAAG;IAAO,MAAM;IAAoB,MAAM;IAAI,SAAS;IAAI,KAAK;IAAS,IAAI;IAAQ,QAAQ;IAAQ,cAAc;GAAa;GACtI,IAAI;IAAE,GAAG;IAAQ,MAAM;IAAoB,MAAM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vB,UAAUA,EAAA,YAAYA,EAAA;GACtB,OAAKhB,EAAA;IAAGW;IAAMqB,EAAA;IAAYJ,EAAA;IAAaG,EAAA;IAAIE,EAAA;IAAgBR,EAAA;GAAwB,CAAA;GACnF,OAAKxB,EAAEsB,EAAA,KAAK;;GAGb,SAAArB,QAGW;IAHKc,EAAA,YAAO,aAAvBnB,EAAA,GAAAM,EAGWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAFOY,EAAA,WAAhBnB,EAAA,GAAAC,EAA+CO,GAAA;;KAArB,MAAMyB,EAAA;I,yBACdd,EAAA,QAAlBnB,EAAA,GAAAC,EAA6EQ,GAAA;;KAApD,MAAMU,EAAA;KAAO,MAAMa,EAAA;KAAW,QAAQb,EAAA;;;;;;IAEjET,EAAQwC,EAAA,QAAA,SAAA;IACQ/B,EAAA,YAAO,cAAvBnB,EAAA,GAAAM,EAGWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAFOY,EAAA,WAAhBnB,EAAA,GAAAC,EAA+CO,GAAA;;KAArB,MAAMyB,EAAA;I,yBACdd,EAAA,QAAlBnB,EAAA,GAAAC,EAA6EQ,GAAA;;KAApD,MAAMU,EAAA;KAAO,MAAMa,EAAA;KAAW,QAAQb,EAAA;;;;;;;;;;;;;;E,MAT3C,CAAAR,EAAAE,CAAA,GAAA;GAAA,UAAAM,EAAA,YAAYA,EAAA;GAAO,OAASA,EAAA;EAAW,CAAA,C"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./MButton-
|
|
2
|
-
import { t } from "./MDialog-
|
|
1
|
+
import { t as e } from "./MButton-CN3wYwIG.js";
|
|
2
|
+
import { t } from "./MDialog-1LAk9WAO.js";
|
|
3
3
|
import { t as n } from "./MIcon-DpajuUTJ.js";
|
|
4
4
|
import { t as r } from "./MIconButton-BBggVwBV.js";
|
|
5
|
-
import { i } from "./useLocale-
|
|
5
|
+
import { i } from "./useLocale-Dh1xZZ8i.js";
|
|
6
6
|
import { i as a, o } from "./_storageKeys-C4W_4xK4.js";
|
|
7
7
|
import { t as s } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
8
8
|
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, normalizeClass as _, normalizeStyle as v, onMounted as ee, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, watch as w, withCtx as T, withKeys as te } from "vue";
|
|
@@ -574,4 +574,4 @@ var F = [
|
|
|
574
574
|
});
|
|
575
575
|
export { P as a, O as i, R as n, F as r, Se as t };
|
|
576
576
|
|
|
577
|
-
//# sourceMappingURL=MColorPickerModal-
|
|
577
|
+
//# sourceMappingURL=MColorPickerModal-BKM1CHxr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MColorPickerModal-NtkihoK6.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_normalizeStyle","_normalizeClass","_createVNode","MIcon","_toDisplayString","_createBlock","MIconButton","_createTextVNode","_withKeys","_Fragment","_renderList","_openBlock","_createBlock","MDialog","_unref","_withCtx","_createVNode","MButton","_createTextVNode","_toDisplayString","MColorPanel","MButton_default","MIcon_default","MIconButton_default","onStoragePrefix","_plugin_vue_export_helper_default","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","storageKey","x","recentColors","ref","pushRecentColor","limit","defaultColorPresets","_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","useLocale","computed","opaqueHex","hueColor","setFromRgb","hsv","lastEmitted","commit","val","pick","color","areaEl","hueEl","alphaEl","dragging","clamp","min","update","el","target","e","p","onPointerDown","onPointerMove","onPointerUp","onKeydown","step","dx","dy","cur","next","canEyedrop","pickFromScreen","Ctor","sRGBHex","formats","format","formatLabel","cycleFormat","setHsv","alphaField","fields","list","rgb","round","hsl","editing","shown","key","display","onHexInput","text","onFieldInput","onFieldKeydown","recents","isSelected","fill","previewInk","showOriginal","openBlock","createElementBlock","createElementVNode","unref","normalizeStyle","_cache","$event","normalizeClass","createCommentVNode","createVNode","toDisplayString","createBlock","createTextVNode","withKeys","Fragment","renderList","group","MColorPickerModal_default","draft","open","cancel","confirm","picked","MDialog_default","withCtx"],"sources":["../src/composables/_colorUtils.ts","../src/components/_MColorPanel.vue","../src/components/MColorPickerModal.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 * 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 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-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\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-l-full outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\n :style=\"{ background: fill(original!) }\"\n :aria-label=\"t.colorOriginal\"\n :title=\"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-r-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 pr-2 pl-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-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\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-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\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":";;;;;;;;;AAYA,SAAgB8B,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;CAC3D,OAAO;EAAE,GAAG,EAAE,CAAC;EAAG,GAAG,EAAE,CAAC;EAAG,GAAG,EAAE,CAAC;EAAG,GAAGH,EAAE,WAAW,IAAI,EAAE,CAAC,IAAI,MAAM;CAAE;AACzE;AAGA,SAAgBI,EAAM,EAAE,MAAG,MAAG,MAAG,QAAmB;CAClD,IAAMC,KAAK,MAAc,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,KAAKC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAA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DxE,EAAkEC,GAAA;IAAzD,SAAQ;IAAQ,SAAOwJ;;IAAS,SAAA1J,QAAe,CAAZG,EAAAC,EAAAL,EAAA0E,CAAA,CAAC,CAAC,OAAO,GAAA,CAAA,C;;;GAVvD,SAAAzE,QAOE,CAPFC,EAOEI,GAAA;IANS,YAAAkJ,EAAA;IAAA,uBAAA,AAAAb,EAAA,QAAA,MAAA,EAAK,QAAAC;IACb,SAASpE,EAAA;IACT,OAAOA,EAAA;IACP,QAAQA,EAAA;IACR,YAAYA,EAAA;IACZ,UAAUA,EAAA"}
|
|
1
|
+
{"version":3,"file":"MColorPickerModal-BKM1CHxr.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_normalizeStyle","_normalizeClass","_createVNode","MIcon","_toDisplayString","_createBlock","MIconButton","_createTextVNode","_withKeys","_Fragment","_renderList","_openBlock","_createBlock","MDialog","_unref","_withCtx","_createVNode","MButton","_createTextVNode","_toDisplayString","MColorPanel","MButton_default","MIcon_default","MIconButton_default","onStoragePrefix","_plugin_vue_export_helper_default","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","storageKey","x","recentColors","ref","pushRecentColor","limit","defaultColorPresets","_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","useLocale","computed","opaqueHex","hueColor","setFromRgb","hsv","lastEmitted","commit","val","pick","color","areaEl","hueEl","alphaEl","dragging","clamp","min","update","el","target","e","p","onPointerDown","onPointerMove","onPointerUp","onKeydown","step","dx","dy","cur","next","canEyedrop","pickFromScreen","Ctor","sRGBHex","formats","format","formatLabel","cycleFormat","setHsv","alphaField","fields","list","rgb","round","hsl","editing","shown","key","display","onHexInput","text","onFieldInput","onFieldKeydown","recents","isSelected","fill","previewInk","showOriginal","openBlock","createElementBlock","createElementVNode","unref","normalizeStyle","_cache","$event","normalizeClass","createCommentVNode","createVNode","toDisplayString","createBlock","createTextVNode","withKeys","Fragment","renderList","group","MColorPickerModal_default","draft","open","cancel","confirm","picked","MDialog_default","withCtx"],"sources":["../src/composables/_colorUtils.ts","../src/components/_MColorPanel.vue","../src/components/MColorPickerModal.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 * 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 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-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\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-l-full outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\n :style=\"{ background: fill(original!) }\"\n :aria-label=\"t.colorOriginal\"\n :title=\"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-r-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 pr-2 pl-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-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\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-2 focus-visible:outline-offset-2 focus-visible:outline-primary\"\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":";;;;;;;;;AAYA,SAAgB8B,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;CAC3D,OAAO;EAAE,GAAG,EAAE,CAAC;EAAG,GAAG,EAAE,CAAC;EAAG,GAAG,EAAE,CAAC;EAAG,GAAGH,EAAE,WAAW,IAAI,EAAE,CAAC,IAAI,MAAM;CAAE;AACzE;AAGA,SAAgBI,EAAM,EAAE,MAAG,MAAG,MAAG,QAAmB;CAClD,IAAMC,KAAK,MAAc,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,KAAKC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;CAC/F,OAAO,IAAID,EAAEE,CAAC,IAAIF,EAAEG,CAAC,IAAIH,EAAEI,CAAC,IAAIC,IAAI,IAAIL,EAAEK,IAAI,GAAG,IAAI;AACvD;AAGA,SAAg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C;;;GAVvD,SAAAzE,QAOE,CAPFC,EAOEI,GAAA;IANS,YAAAkJ,EAAA;IAAA,uBAAA,AAAAb,EAAA,QAAA,MAAA,EAAK,QAAAC;IACb,SAASpE,EAAA;IACT,OAAOA,EAAA;IACP,QAAQA,EAAA;IACR,YAAYA,EAAA;IACZ,UAAUA,EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./MIconButton-BBggVwBV.js";
|
|
2
|
-
import { i as t } from "./useLocale-
|
|
2
|
+
import { i as t } from "./useLocale-Dh1xZZ8i.js";
|
|
3
3
|
import { r as n } from "./_popupPosition-nL8SVKPK.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 b, openBlock as x, ref as S, renderSlot as C, toDisplayString as w, unref as T, useId as E, watch as D, withCtx as O, withModifiers as k } from "vue";
|
|
@@ -164,4 +164,4 @@ var F = ["aria-labelledby", "aria-label"], I = {
|
|
|
164
164
|
}), [["__scopeId", "data-v-8f788bae"]]);
|
|
165
165
|
export { P as n, q as t };
|
|
166
166
|
|
|
167
|
-
//# sourceMappingURL=MDialog-
|
|
167
|
+
//# sourceMappingURL=MDialog-1LAk9WAO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDialog-DYMnaBlt.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","_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","el","titleId","useId","open","nextTick","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/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","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, 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 * @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'\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\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 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 right-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 right-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.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 `pr-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-left',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pr-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 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\" @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,CAAE,GAAG,EAAE,WAAW,GAAK,CAAC,GAC5DG,EAAmB,KAAGC,QAAsBL,EAAI,EAAK,CAAC,GACnD,EAAE,OAAI;AACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECrBA,IAAMqB,IAAQC,GAqDRC,IAAShC,EAAU,GAInBiC,KAAc,MAAc,iDAAiD,KAAKC,EAAE,KAAK,CAAC,GAC1FC,IAAcC,QAAe,CAACN,EAAM,UAAUA,EAAM,SAAS,CAAC,CAAC,QAAQ,MAAM,CAACG,EAAWC,CAAC,CAAC,CAAC,GAC5FG,IAAYD,SAAgB;GAChC,GAAIH,EAAWH,EAAM,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,EAEM,OAFNkC,GAEM,CADJ9B,EAAuBoE,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C"}
|
|
1
|
+
{"version":3,"file":"MDialog-1LAk9WAO.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","_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","el","titleId","useId","open","nextTick","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/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","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, 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 * @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'\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\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 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 right-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 right-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.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 `pr-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-left',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pr-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 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\" @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,CAAE,GAAG,EAAE,WAAW,GAAK,CAAC,GAC5DG,EAAmB,KAAGC,QAAs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