@m3ui-vue/m3ui-vue 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/API.md +940 -33
  2. package/dist/{MButton-CPghlKb0.js → MButton-OQ4wIERQ.js} +2 -2
  3. package/dist/{MButton-CPghlKb0.js.map → MButton-OQ4wIERQ.js.map} +1 -1
  4. package/dist/MColorPickerModal-NtkihoK6.js +577 -0
  5. package/dist/MColorPickerModal-NtkihoK6.js.map +1 -0
  6. package/dist/{MDialog-X50At1Gk.js → MDialog-DYMnaBlt.js} +3 -3
  7. package/dist/{MDialog-X50At1Gk.js.map → MDialog-DYMnaBlt.js.map} +1 -1
  8. package/dist/{MListItem-DVi1j1QI.js → MListItem-D2cNUyzP.js} +211 -168
  9. package/dist/MListItem-D2cNUyzP.js.map +1 -0
  10. package/dist/{MLoadingIndicator-vooA3110.js → MLoadingIndicator-DWUj0BAB.js} +2 -2
  11. package/dist/{MLoadingIndicator-vooA3110.js.map → MLoadingIndicator-DWUj0BAB.js.map} +1 -1
  12. package/dist/{MMenuItem-CRNZkVVr.js → MMenuItem-BuxYoASE.js} +133 -151
  13. package/dist/MMenuItem-BuxYoASE.js.map +1 -0
  14. package/dist/{MSeekBar-BL2W5_rD.js → MSeekBar-C4cn9RIF.js} +2 -2
  15. package/dist/{MSeekBar-BL2W5_rD.js.map → MSeekBar-C4cn9RIF.js.map} +1 -1
  16. package/dist/{MSlider-B9NcKTmZ.js → MSlider-BIkA6DiE.js} +2 -2
  17. package/dist/{MSlider-B9NcKTmZ.js.map → MSlider-BIkA6DiE.js.map} +1 -1
  18. package/dist/{MSpinner-_XpTRkAg.js → MSpinner-DZkXZJpc.js} +2 -2
  19. package/dist/{MSpinner-_XpTRkAg.js.map → MSpinner-DZkXZJpc.js.map} +1 -1
  20. package/dist/{MTextField-DpcPmR5B.js → MTextField-CNH-byir.js} +2 -2
  21. package/dist/{MTextField-DpcPmR5B.js.map → MTextField-CNH-byir.js.map} +1 -1
  22. package/dist/MTooltip-CK39Zon4.js +183 -0
  23. package/dist/MTooltip-CK39Zon4.js.map +1 -0
  24. package/dist/{_useEscapeStack-C5-BYr8y.js → _popupPosition-nL8SVKPK.js} +20 -2
  25. package/dist/_popupPosition-nL8SVKPK.js.map +1 -0
  26. package/dist/api.json +1 -1
  27. package/dist/code-editor.js +1 -1
  28. package/dist/components/MAddressField.vue.d.ts +54 -0
  29. package/dist/components/MAudioPlayer.vue.d.ts +1 -1
  30. package/dist/components/MAudioRecorder.vue.d.ts +51 -0
  31. package/dist/components/MAvailabilityCalendar.vue.d.ts +1 -1
  32. package/dist/components/MCameraCapture.vue.d.ts +51 -0
  33. package/dist/components/MCollapse.vue.d.ts +32 -0
  34. package/dist/components/MCountrySelect.vue.d.ts +41 -0
  35. package/dist/components/MCronField.vue.d.ts +26 -0
  36. package/dist/components/MDashboardGrid.vue.d.ts +65 -0
  37. package/dist/components/MDiffViewer.vue.d.ts +56 -0
  38. package/dist/components/MExpansionPanel.vue.d.ts +26 -3
  39. package/dist/components/MFilterBuilder.vue.d.ts +22 -0
  40. package/dist/components/MFlex.vue.d.ts +1 -1
  41. package/dist/components/MMapCluster.vue.d.ts +80 -0
  42. package/dist/components/MMapDraw.vue.d.ts +79 -0
  43. package/dist/components/MMentionField.vue.d.ts +102 -0
  44. package/dist/components/MNotificationCenter.vue.d.ts +57 -0
  45. package/dist/components/MQRScanner.vue.d.ts +52 -0
  46. package/dist/components/MQuiz.vue.d.ts +1 -1
  47. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  48. package/dist/components/MStack.vue.d.ts +1 -1
  49. package/dist/components/MTimezoneSelect.vue.d.ts +39 -0
  50. package/dist/components/MToolbar.vue.d.ts +1 -1
  51. package/dist/components/MVideoPlayer.vue.d.ts +1 -1
  52. package/dist/components/_MFilterGroup.vue.d.ts +17 -0
  53. package/dist/composables/_caretPosition.d.ts +6 -0
  54. package/dist/composables/_useCamera.d.ts +16 -0
  55. package/dist/composables/_useFollowAnchor.d.ts +15 -0
  56. package/dist/composables/cron.d.ts +29 -0
  57. package/dist/composables/dashboardLayout.d.ts +28 -0
  58. package/dist/composables/filterBuilder.d.ts +55 -0
  59. package/dist/composables/mapAdapters.d.ts +6 -1
  60. package/dist/composables/mapSearch.d.ts +1 -0
  61. package/dist/composables/textDiff.d.ts +24 -0
  62. package/dist/composables/useLocale.d.ts +108 -0
  63. package/dist/draw.js +28 -27
  64. package/dist/draw.js.map +1 -1
  65. package/dist/flow.js +1 -1
  66. package/dist/gantt.js +1 -1
  67. package/dist/index.d.ts +25 -0
  68. package/dist/locales/index.js +749 -0
  69. package/dist/locales/index.js.map +1 -1
  70. package/dist/m3ui-vue.css +1 -1
  71. package/dist/m3ui.js +10444 -7495
  72. package/dist/m3ui.js.map +1 -1
  73. package/dist/map.d.ts +5 -0
  74. package/dist/map.js +1509 -617
  75. package/dist/map.js.map +1 -1
  76. package/dist/media.js +5 -5
  77. package/dist/pdf.js +5 -5
  78. package/dist/rich-text-editor.js +5 -5
  79. package/dist/styles.css +1 -1
  80. package/dist/{useLocale-COav9m8C.js → useLocale-DaVSTdm0.js} +108 -1
  81. package/dist/useLocale-DaVSTdm0.js.map +1 -0
  82. package/package.json +1 -1
  83. package/src/__tests__/MAddressField.test.ts +149 -0
  84. package/src/__tests__/MAudioRecorder.test.ts +125 -0
  85. package/src/__tests__/MCameraCapture.test.ts +154 -0
  86. package/src/__tests__/MCountrySelect.test.ts +67 -0
  87. package/src/__tests__/MCronField.test.ts +100 -0
  88. package/src/__tests__/MDashboardGrid.test.ts +122 -0
  89. package/src/__tests__/MDiffViewer.test.ts +68 -0
  90. package/src/__tests__/MExpansionPanel.test.ts +107 -0
  91. package/src/__tests__/MFilterBuilder.test.ts +130 -0
  92. package/src/__tests__/MMapCluster.test.ts +127 -0
  93. package/src/__tests__/MMapDraw.test.ts +188 -0
  94. package/src/__tests__/MMapLayers.test.ts +56 -0
  95. package/src/__tests__/MMentionField.test.ts +163 -0
  96. package/src/__tests__/MNotificationCenter.test.ts +94 -0
  97. package/src/__tests__/_fakeMaplibre.ts +14 -3
  98. package/src/__tests__/attrsFallthrough.test.ts +4 -0
  99. package/src/__tests__/cron.test.ts +68 -0
  100. package/src/__tests__/dashboardLayout.test.ts +45 -0
  101. package/src/__tests__/filterBuilder.test.ts +91 -0
  102. package/src/__tests__/followAnchor.test.ts +162 -0
  103. package/src/__tests__/ssr.test.ts +3 -0
  104. package/src/__tests__/textDiff.test.ts +37 -0
  105. package/src/components/MAddressField.vue +301 -0
  106. package/src/components/MAudioRecorder.vue +334 -0
  107. package/src/components/MAutocomplete.vue +3 -7
  108. package/src/components/MCameraCapture.vue +156 -0
  109. package/src/components/MCollapse.vue +91 -0
  110. package/src/components/MColorPicker.vue +4 -8
  111. package/src/components/MCountrySelect.vue +89 -0
  112. package/src/components/MCronField.vue +251 -0
  113. package/src/components/MDashboardGrid.vue +382 -0
  114. package/src/components/MDatePicker.vue +10 -7
  115. package/src/components/MDateRangePicker.vue +10 -7
  116. package/src/components/MDiffViewer.vue +234 -0
  117. package/src/components/MExpansionPanel.vue +56 -48
  118. package/src/components/MFilterBuilder.vue +47 -0
  119. package/src/components/MMapBaseLayers.vue +29 -28
  120. package/src/components/MMapCluster.vue +295 -0
  121. package/src/components/MMapDraw.vue +601 -0
  122. package/src/components/MMapMeasure.vue +1 -1
  123. package/src/components/MMapSearch.vue +1 -9
  124. package/src/components/MMentionField.vue +373 -0
  125. package/src/components/MMultiAutocomplete.vue +3 -7
  126. package/src/components/MMultiSelect.vue +3 -7
  127. package/src/components/MNotificationCenter.vue +252 -0
  128. package/src/components/MPhoneInput.vue +3 -10
  129. package/src/components/MQRScanner.vue +177 -0
  130. package/src/components/MSelect.vue +3 -7
  131. package/src/components/MTimePicker.vue +10 -7
  132. package/src/components/MTimezoneSelect.vue +116 -0
  133. package/src/components/_MFilterGroup.vue +210 -0
  134. package/src/composables/_caretPosition.ts +44 -0
  135. package/src/composables/_useCamera.ts +66 -0
  136. package/src/composables/_useFollowAnchor.ts +109 -0
  137. package/src/composables/cron.ts +179 -0
  138. package/src/composables/dashboardLayout.ts +94 -0
  139. package/src/composables/filterBuilder.ts +195 -0
  140. package/src/composables/mapAdapters.ts +29 -15
  141. package/src/composables/mapSearch.ts +10 -0
  142. package/src/composables/textDiff.ts +106 -0
  143. package/src/composables/useLocale.ts +215 -0
  144. package/src/index.ts +25 -0
  145. package/src/locales/de.ts +107 -0
  146. package/src/locales/es.ts +107 -0
  147. package/src/locales/fr.ts +107 -0
  148. package/src/locales/ja.ts +107 -0
  149. package/src/locales/ko.ts +107 -0
  150. package/src/locales/pt.ts +107 -0
  151. package/src/locales/zh.ts +107 -0
  152. package/src/map.ts +5 -0
  153. package/dist/MListItem-DVi1j1QI.js.map +0 -1
  154. package/dist/MMenuItem-CRNZkVVr.js.map +0 -1
  155. package/dist/MTooltip-BL3jPYPT.js +0 -754
  156. package/dist/MTooltip-BL3jPYPT.js.map +0 -1
  157. package/dist/_useEscapeStack-C5-BYr8y.js.map +0 -1
  158. package/dist/useLocale-COav9m8C.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { t as e } from "./MSpinner-_XpTRkAg.js";
1
+ import { t as e } from "./MSpinner-DZkXZJpc.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-CPghlKb0.js.map
171
+ //# sourceMappingURL=MButton-OQ4wIERQ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MButton-CPghlKb0.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;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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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"./MIconButton-BBggVwBV.js";
5
+ import { i } from "./useLocale-DaVSTdm0.js";
6
+ import { i as a, o } from "./_storageKeys-C4W_4xK4.js";
7
+ import { t as s } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
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";
9
+ // src/composables/_colorUtils.ts
10
+ function E(e) {
11
+ let t = e.trim().replace(/^#/, "");
12
+ if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
13
+ t.length <= 4 && (t = [...t].map((e) => e + e).join(""));
14
+ let n = (e) => parseInt(t.substring(e, e + 2), 16);
15
+ return {
16
+ r: n(0),
17
+ g: n(2),
18
+ b: n(4),
19
+ a: t.length === 8 ? n(6) / 255 : 1
20
+ };
21
+ }
22
+ function D({ r: e, g: t, b: n, a: r }) {
23
+ let i = (e) => Math.round(Math.max(0, Math.min(255, e))).toString(16).padStart(2, "0");
24
+ return `#${i(e)}${i(t)}${i(n)}${r < 1 ? i(r * 255) : ""}`;
25
+ }
26
+ function O(e) {
27
+ let t = E(e);
28
+ return t ? D(t) : "";
29
+ }
30
+ function ne({ r: e, g: t, b: n }) {
31
+ e /= 255, t /= 255, n /= 255;
32
+ let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
33
+ return i !== 0 && (a = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a *= 60), {
34
+ h: a,
35
+ s: r === 0 ? 0 : i / r * 100,
36
+ v: r * 100
37
+ };
38
+ }
39
+ function k({ h: e, s: t, v: n }, r = 1) {
40
+ t /= 100, n /= 100;
41
+ let i = (r) => {
42
+ let i = (r + e / 60) % 6;
43
+ return (n - n * t * Math.max(0, Math.min(i, 4 - i, 1))) * 255;
44
+ };
45
+ return {
46
+ r: i(5),
47
+ g: i(3),
48
+ b: i(1),
49
+ a: r
50
+ };
51
+ }
52
+ function re({ h: e, s: t, v: n }) {
53
+ t /= 100, n /= 100;
54
+ let r = n * (1 - t / 2);
55
+ return {
56
+ h: e,
57
+ s: (r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r)) * 100,
58
+ l: r * 100
59
+ };
60
+ }
61
+ function ie({ h: e, s: t, l: n }) {
62
+ t /= 100, n /= 100;
63
+ let r = n + t * Math.min(n, 1 - n);
64
+ return {
65
+ h: e,
66
+ s: r === 0 ? 0 : 2 * (1 - n / r) * 100,
67
+ v: r * 100
68
+ };
69
+ }
70
+ function A(e) {
71
+ let t = E(e);
72
+ if (!t) return "#000000";
73
+ let n = (e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
74
+ return .2126 * n(t.r) + .7152 * n(t.g) + .0722 * n(t.b) > .179 ? "#000000" : "#ffffff";
75
+ }
76
+ var j = "m3-color-recent";
77
+ function M() {
78
+ try {
79
+ let e = JSON.parse(localStorage.getItem(o(j)) ?? "[]");
80
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!E(e)) : [];
81
+ } catch {
82
+ return [];
83
+ }
84
+ }
85
+ var N = b(M());
86
+ a(() => {
87
+ N.value = M();
88
+ });
89
+ function P(e, t) {
90
+ let n = O(e);
91
+ if (n) {
92
+ N.value = [n, ...N.value.filter((e) => e !== n)].slice(0, Math.max(t, 0));
93
+ try {
94
+ localStorage.setItem(o(j), JSON.stringify(N.value));
95
+ } catch {}
96
+ }
97
+ }
98
+ var F = [
99
+ "#f44336",
100
+ "#e91e63",
101
+ "#9c27b0",
102
+ "#673ab7",
103
+ "#3f51b5",
104
+ "#2196f3",
105
+ "#03a9f4",
106
+ "#00bcd4",
107
+ "#009688",
108
+ "#4caf50",
109
+ "#8bc34a",
110
+ "#cddc39",
111
+ "#ffeb3b",
112
+ "#ffc107",
113
+ "#ff9800",
114
+ "#ff5722",
115
+ "#795548",
116
+ "#607d8b",
117
+ "#9e9e9e",
118
+ "#000000",
119
+ "#ffffff"
120
+ ], ae = { class: "flex flex-col gap-4" }, oe = [
121
+ "aria-label",
122
+ "aria-valuenow",
123
+ "aria-valuetext"
124
+ ], se = { class: "flex flex-col gap-1" }, ce = ["aria-label", "aria-valuenow"], le = [
125
+ "aria-label",
126
+ "aria-valuenow",
127
+ "aria-valuetext"
128
+ ], ue = { class: "flex items-center gap-2" }, de = { class: "flex h-10 min-w-0 flex-1" }, fe = ["aria-label", "title"], pe = { class: "flex items-start gap-2" }, me = ["aria-label"], he = ["maxlength", "value"], ge = [
129
+ "aria-label",
130
+ "value",
131
+ "onInput",
132
+ "onKeydown"
133
+ ], _e = { class: "text-label-small text-on-surface-variant" }, ve = ["aria-label"], ye = {
134
+ key: 0,
135
+ class: "text-label-medium text-on-surface-variant"
136
+ }, be = { class: "grid grid-cols-7 gap-2" }, xe = [
137
+ "aria-label",
138
+ "aria-pressed",
139
+ "onClick"
140
+ ], I = 12, L = "repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px", R = /*#__PURE__*/ s(/* @__PURE__ */ g({
141
+ __name: "_MColorPanel",
142
+ props: {
143
+ modelValue: {},
144
+ presets: {},
145
+ alpha: { type: Boolean },
146
+ recent: { type: Boolean },
147
+ eyedropper: { type: Boolean },
148
+ original: {}
149
+ },
150
+ emits: ["update:modelValue"],
151
+ setup(e, { expose: t, emit: a }) {
152
+ let o = e, s = a, g = i(), T = b(0), j = b(100), M = b(100), P = b(1), F = l(() => D(k({
153
+ h: T.value,
154
+ s: j.value,
155
+ v: M.value
156
+ }, o.alpha ? P.value : 1))), R = l(() => D(k({
157
+ h: T.value,
158
+ s: j.value,
159
+ v: M.value
160
+ }))), Se = l(() => `hsl(${T.value}, 100%, 50%)`);
161
+ function z(e) {
162
+ let t = ne(e);
163
+ t.v > 0 && t.s > 0 && (T.value = t.h), t.v > 0 && (j.value = t.s), M.value = t.v, P.value = o.alpha ? e.a : 1;
164
+ }
165
+ let B = "";
166
+ function V() {
167
+ B = F.value, F.value !== O(o.modelValue) && s("update:modelValue", F.value);
168
+ }
169
+ w(() => o.modelValue, (e) => {
170
+ let t = O(e);
171
+ t && t !== B && (z(E(t)), B = t);
172
+ }, { immediate: !0 });
173
+ function Ce(e) {
174
+ let t = E(e);
175
+ t && (z(t), V());
176
+ }
177
+ let H = b(), we = b(), Te = b(), U = b(null), W = (e, t, n) => Math.min(n, Math.max(t, e));
178
+ function Ee(e, t) {
179
+ let n = e === "area" ? H.value : e === "hue" ? we.value : Te.value;
180
+ if (!n) return;
181
+ let r = n.getBoundingClientRect();
182
+ if (e === "area") j.value = W((t.clientX - r.left) / r.width * 100, 0, 100), M.value = W((1 - (t.clientY - r.top) / r.height) * 100, 0, 100);
183
+ else {
184
+ let n = W((t.clientX - r.left - I) / (r.width - 24), 0, 1);
185
+ e === "hue" ? T.value = n * 360 : P.value = Math.round(n * 100) / 100;
186
+ }
187
+ V();
188
+ }
189
+ function G(e, t) {
190
+ t.button === 0 && (t.preventDefault(), t.currentTarget.focus({ preventScroll: !0 }), t.currentTarget.setPointerCapture?.(t.pointerId), U.value = e, Ee(e, t));
191
+ }
192
+ function K(e, t) {
193
+ U.value === e && Ee(e, t);
194
+ }
195
+ function q() {
196
+ U.value = null;
197
+ }
198
+ function J(e, t) {
199
+ let n = t.shiftKey ? 10 : 1, r = t.key === "ArrowRight" ? n : t.key === "ArrowLeft" ? -n : 0, i = t.key === "ArrowUp" ? n : t.key === "ArrowDown" ? -n : 0;
200
+ if (e === "area") {
201
+ if (!r && !i) return;
202
+ j.value = W(j.value + r, 0, 100), M.value = W(M.value + i, 0, 100);
203
+ } else {
204
+ let n = e === "hue" ? 360 : 100, a = e === "hue" ? T.value : P.value * 100, o;
205
+ if (t.key === "Home") o = 0;
206
+ else if (t.key === "End") o = n;
207
+ else if (r || i) o = W(a + (r || i), 0, n);
208
+ else return;
209
+ e === "hue" ? T.value = o : P.value = Math.round(o) / 100;
210
+ }
211
+ t.preventDefault(), V();
212
+ }
213
+ let De = b(!1);
214
+ ee(() => {
215
+ De.value = "EyeDropper" in window;
216
+ });
217
+ async function Oe() {
218
+ try {
219
+ let e = window.EyeDropper, { sRGBHex: t } = await new e().open(), n = E(t);
220
+ n && (z({
221
+ ...n,
222
+ a: P.value
223
+ }), V());
224
+ } catch {}
225
+ }
226
+ let Y = [
227
+ {
228
+ id: "hex",
229
+ label: "HEX"
230
+ },
231
+ {
232
+ id: "rgb",
233
+ label: "RGB"
234
+ },
235
+ {
236
+ id: "hsl",
237
+ label: "HSL"
238
+ }
239
+ ], X = b("hex"), ke = l(() => Y.find((e) => e.id === X.value).label);
240
+ function Ae() {
241
+ X.value = Y[(Y.findIndex((e) => e.id === X.value) + 1) % Y.length].id, Z.value = null;
242
+ }
243
+ function je(e) {
244
+ T.value = e.h, j.value = e.s, M.value = e.v;
245
+ }
246
+ let Me = l(() => ({
247
+ key: "a",
248
+ label: "A",
249
+ display: String(Math.round(P.value * 100)),
250
+ max: 100,
251
+ apply: (e) => {
252
+ P.value = e / 100;
253
+ }
254
+ })), Ne = l(() => {
255
+ let e = [];
256
+ if (X.value === "rgb") {
257
+ let t = k({
258
+ h: T.value,
259
+ s: j.value,
260
+ v: M.value
261
+ }), n = {
262
+ r: Math.round(t.r),
263
+ g: Math.round(t.g),
264
+ b: Math.round(t.b),
265
+ a: P.value
266
+ };
267
+ for (let t of [
268
+ "r",
269
+ "g",
270
+ "b"
271
+ ]) e.push({
272
+ key: t,
273
+ label: t.toUpperCase(),
274
+ display: String(n[t]),
275
+ max: 255,
276
+ apply: (e) => z({
277
+ ...n,
278
+ [t]: e
279
+ })
280
+ });
281
+ } else if (X.value === "hsl") {
282
+ let t = re({
283
+ h: T.value,
284
+ s: j.value,
285
+ v: M.value
286
+ }), n = {
287
+ h: Math.round(t.h),
288
+ s: Math.round(t.s),
289
+ l: Math.round(t.l)
290
+ };
291
+ for (let t of [
292
+ "h",
293
+ "s",
294
+ "l"
295
+ ]) e.push({
296
+ key: t,
297
+ label: t.toUpperCase(),
298
+ display: String(n[t]),
299
+ max: t === "h" ? 360 : 100,
300
+ apply: (e) => je(ie({
301
+ ...n,
302
+ [t]: e
303
+ }))
304
+ });
305
+ }
306
+ return o.alpha && X.value !== "hex" && e.push(Me.value), e;
307
+ }), Z = b(null), Pe = (e, t) => Z.value?.key === e ? Z.value.text : t;
308
+ function Fe(e) {
309
+ let t = e.target.value;
310
+ Z.value = {
311
+ key: "hex",
312
+ text: t
313
+ };
314
+ let n = E(t);
315
+ n && (z(n), V());
316
+ }
317
+ function Ie(e, t) {
318
+ let n = t.target.value;
319
+ if (Z.value = {
320
+ key: e.key,
321
+ text: n
322
+ }, !/^\d+$/.test(n.trim())) return;
323
+ let r = Number(n);
324
+ r > e.max || (e.apply(r), V());
325
+ }
326
+ function Le(e, t) {
327
+ if (t.key === "Enter") {
328
+ Z.value = null;
329
+ return;
330
+ }
331
+ if (t.key !== "ArrowUp" && t.key !== "ArrowDown") return;
332
+ t.preventDefault();
333
+ let n = (t.shiftKey ? 10 : 1) * (t.key === "ArrowUp" ? 1 : -1);
334
+ e.apply(W(Number(e.display) + n, 0, e.max)), Z.value = null, V();
335
+ }
336
+ let Re = l(() => o.recent ? N.value : []), Q = (e) => O(e) === F.value, $ = (e) => `linear-gradient(${e}, ${e}), ${L}`, ze = l(() => P.value < .5 ? "#000000" : A(R.value)), Be = l(() => !!o.original && !!O(o.original) && O(o.original) !== F.value);
337
+ return t({ focus: () => H.value?.focus({ preventScroll: !0 }) }), (t, i) => (y(), f("div", ae, [
338
+ p("div", {
339
+ ref_key: "areaEl",
340
+ ref: H,
341
+ role: "slider",
342
+ tabindex: "0",
343
+ "aria-label": `${C(g).colorSaturation}, ${C(g).colorBrightness}`,
344
+ "aria-valuenow": Math.round(j.value),
345
+ "aria-valuemin": "0",
346
+ "aria-valuemax": "100",
347
+ "aria-valuetext": `${C(g).colorSaturation} ${Math.round(j.value)}%, ${C(g).colorBrightness} ${Math.round(M.value)}%`,
348
+ 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",
349
+ style: v({ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${Se.value})` }),
350
+ onPointerdown: i[0] ||= (e) => G("area", e),
351
+ onPointermove: i[1] ||= (e) => K("area", e),
352
+ onPointerup: q,
353
+ onPointercancel: q,
354
+ onKeydown: i[2] ||= (e) => J("area", e)
355
+ }, [p("span", {
356
+ 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", U.value === "area" ? "scale-125" : ""]),
357
+ style: v({
358
+ left: `${j.value}%`,
359
+ top: `${100 - M.value}%`,
360
+ backgroundColor: R.value
361
+ })
362
+ }, null, 6)], 44, oe),
363
+ p("div", se, [p("div", {
364
+ ref_key: "hueEl",
365
+ ref: we,
366
+ role: "slider",
367
+ tabindex: "0",
368
+ "aria-label": C(g).colorHue,
369
+ "aria-valuenow": Math.round(T.value),
370
+ "aria-valuemin": "0",
371
+ "aria-valuemax": "360",
372
+ class: "m3-cp-slider group",
373
+ onPointerdown: i[3] ||= (e) => G("hue", e),
374
+ onPointermove: i[4] ||= (e) => K("hue", e),
375
+ onPointerup: q,
376
+ onPointercancel: q,
377
+ onKeydown: i[5] ||= (e) => J("hue", e)
378
+ }, [i[13] ||= p("span", { class: "m3-cp-track m3-cp-hue" }, null, -1), p("span", {
379
+ class: _(["m3-cp-handle", { "m3-cp-handle-pressed": U.value === "hue" }]),
380
+ style: v({ left: `calc(${I}px + ${T.value / 360} * (100% - 24px))` })
381
+ }, null, 6)], 40, ce), e.alpha ? (y(), f("div", {
382
+ key: 0,
383
+ ref_key: "alphaEl",
384
+ ref: Te,
385
+ role: "slider",
386
+ tabindex: "0",
387
+ "aria-label": C(g).colorAlpha,
388
+ "aria-valuenow": Math.round(P.value * 100),
389
+ "aria-valuemin": "0",
390
+ "aria-valuemax": "100",
391
+ "aria-valuetext": `${Math.round(P.value * 100)}%`,
392
+ class: "m3-cp-slider group",
393
+ onPointerdown: i[6] ||= (e) => G("alpha", e),
394
+ onPointermove: i[7] ||= (e) => K("alpha", e),
395
+ onPointerup: q,
396
+ onPointercancel: q,
397
+ onKeydown: i[8] ||= (e) => J("alpha", e)
398
+ }, [p("span", {
399
+ class: "m3-cp-track",
400
+ style: v({ background: `linear-gradient(to right, transparent, ${R.value}), ${L}` })
401
+ }, null, 4), p("span", {
402
+ class: _(["m3-cp-handle", { "m3-cp-handle-pressed": U.value === "alpha" }]),
403
+ style: v({ left: `calc(${I}px + ${P.value} * (100% - 24px))` })
404
+ }, null, 6)], 40, le)) : d("", !0)]),
405
+ p("div", ue, [p("div", de, [Be.value ? (y(), f("button", {
406
+ key: 0,
407
+ type: "button",
408
+ 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",
409
+ style: v({ background: $(e.original) }),
410
+ "aria-label": C(g).colorOriginal,
411
+ title: C(g).colorOriginal,
412
+ onClick: i[9] ||= (t) => Ce(e.original)
413
+ }, [h(n, {
414
+ name: "undo",
415
+ size: 18,
416
+ style: v({ color: C(A)(e.original) })
417
+ }, null, 8, ["style"])], 12, fe)) : d("", !0), p("span", {
418
+ class: _(["m3-cp-swatch flex min-w-0 flex-1 items-center px-4 font-mono text-label-large transition-[border-radius] duration-200", Be.value ? "rounded-r-full" : "rounded-full"]),
419
+ style: v({
420
+ background: $(F.value),
421
+ color: ze.value
422
+ })
423
+ }, S(F.value), 7)]), e.eyedropper && De.value ? (y(), u(r, {
424
+ key: 0,
425
+ icon: "colorize",
426
+ variant: "tonal",
427
+ label: C(g).colorEyedropper,
428
+ onClick: Oe
429
+ }, null, 8, ["label"])) : d("", !0)]),
430
+ p("div", pe, [
431
+ p("button", {
432
+ type: "button",
433
+ 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",
434
+ "aria-label": `${C(g).colorFormat}: ${ke.value}`,
435
+ onClick: Ae
436
+ }, [m(S(ke.value) + " ", 1), h(n, {
437
+ name: "unfold_more",
438
+ size: 18
439
+ })], 8, me),
440
+ X.value === "hex" ? (y(), f("input", {
441
+ key: 0,
442
+ type: "text",
443
+ spellcheck: "false",
444
+ autocomplete: "off",
445
+ maxlength: e.alpha ? 9 : 7,
446
+ "aria-label": "HEX",
447
+ value: Pe("hex", F.value),
448
+ class: "m3-cp-field min-w-0 flex-1 font-mono text-body-medium",
449
+ onInput: Fe,
450
+ onBlur: i[10] ||= (e) => Z.value = null,
451
+ onKeydown: i[11] ||= te((e) => Z.value = null, ["enter"])
452
+ }, null, 40, he)) : d("", !0),
453
+ (y(!0), f(c, null, x(Ne.value, (e) => (y(), f("label", {
454
+ key: e.key,
455
+ class: "flex min-w-0 flex-1 flex-col items-center gap-1"
456
+ }, [p("input", {
457
+ type: "text",
458
+ inputmode: "numeric",
459
+ autocomplete: "off",
460
+ maxlength: 3,
461
+ "aria-label": e.label,
462
+ value: Pe(e.key, e.display),
463
+ class: "m3-cp-field w-full font-mono text-body-medium",
464
+ onInput: (t) => Ie(e, t),
465
+ onKeydown: (t) => Le(e, t),
466
+ onBlur: i[12] ||= (e) => Z.value = null
467
+ }, null, 40, ge), p("span", _e, S(e.label), 1)]))), 128))
468
+ ]),
469
+ (y(!0), f(c, null, x([{
470
+ id: "recent",
471
+ label: C(g).colorRecent,
472
+ colors: Re.value
473
+ }, {
474
+ id: "presets",
475
+ label: C(g).colorPresets,
476
+ colors: e.presets
477
+ }], (e) => (y(), f(c, { key: e.id }, [e.colors.length ? (y(), f("div", {
478
+ key: 0,
479
+ role: "group",
480
+ "aria-label": e.label,
481
+ class: "flex flex-col gap-2"
482
+ }, [Re.value.length ? (y(), f("span", ye, S(e.label), 1)) : d("", !0), p("div", be, [(y(!0), f(c, null, x(e.colors, (e) => (y(), f("button", {
483
+ key: e,
484
+ type: "button",
485
+ 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", { "m3-cp-morph-selected": Q(e) }]),
486
+ style: v({ background: $(e) }),
487
+ "aria-label": e,
488
+ "aria-pressed": Q(e),
489
+ onClick: (t) => Ce(e)
490
+ }, [Q(e) ? (y(), u(n, {
491
+ key: 0,
492
+ name: "check",
493
+ size: 18,
494
+ style: v({ color: C(A)(e) })
495
+ }, null, 8, ["style"])) : d("", !0)], 14, xe))), 128))])], 8, ve)) : d("", !0)], 64))), 128))
496
+ ]));
497
+ }
498
+ }), [["__scopeId", "data-v-87647feb"]]), Se = /* @__PURE__ */ g({
499
+ __name: "MColorPickerModal",
500
+ props: {
501
+ modelValue: {},
502
+ show: {
503
+ type: Boolean,
504
+ default: !1
505
+ },
506
+ presets: { default: () => F },
507
+ title: {},
508
+ alpha: {
509
+ type: Boolean,
510
+ default: !1
511
+ },
512
+ recent: {
513
+ type: Boolean,
514
+ default: !0
515
+ },
516
+ recentLimit: { default: 7 },
517
+ eyedropper: {
518
+ type: Boolean,
519
+ default: !0
520
+ }
521
+ },
522
+ emits: ["update:modelValue", "update:show"],
523
+ setup(n, { emit: r }) {
524
+ let a = n, o = i(), s = r, c = b(a.modelValue);
525
+ w(() => a.show, (e) => {
526
+ e && (c.value = a.modelValue);
527
+ }, { immediate: !0 });
528
+ function l() {
529
+ s("update:show", !1);
530
+ }
531
+ function d() {
532
+ let e = O(c.value) || c.value;
533
+ a.recent && P(e, a.recentLimit), s("update:modelValue", e), s("update:show", !1);
534
+ }
535
+ return (r, i) => (y(), u(t, {
536
+ "model-value": n.show,
537
+ title: n.title || C(o).selectColor,
538
+ "max-width": "328px",
539
+ closable: !1,
540
+ "onUpdate:modelValue": i[1] ||= (e) => !e && l()
541
+ }, {
542
+ actions: T(() => [h(e, {
543
+ variant: "text",
544
+ onClick: l
545
+ }, {
546
+ default: T(() => [m(S(C(o).cancel), 1)]),
547
+ _: 1
548
+ }), h(e, {
549
+ variant: "text",
550
+ onClick: d
551
+ }, {
552
+ default: T(() => [m(S(C(o).confirm), 1)]),
553
+ _: 1
554
+ })]),
555
+ default: T(() => [h(R, {
556
+ modelValue: c.value,
557
+ "onUpdate:modelValue": i[0] ||= (e) => c.value = e,
558
+ presets: n.presets,
559
+ alpha: n.alpha,
560
+ recent: n.recent,
561
+ eyedropper: n.eyedropper,
562
+ original: n.modelValue
563
+ }, null, 8, [
564
+ "modelValue",
565
+ "presets",
566
+ "alpha",
567
+ "recent",
568
+ "eyedropper",
569
+ "original"
570
+ ])]),
571
+ _: 1
572
+ }, 8, ["model-value", "title"]));
573
+ }
574
+ });
575
+ export { P as a, O as i, R as n, F as r, Se as t };
576
+
577
+ //# sourceMappingURL=MColorPickerModal-NtkihoK6.js.map