@m3ui-vue/m3ui-vue 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +3010 -376
- package/dist/MButton-Bl_BSUep.js +172 -0
- package/dist/MButton-Bl_BSUep.js.map +1 -0
- package/dist/MDialog-D_Yik8ou.js +173 -0
- package/dist/MDialog-D_Yik8ou.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-BxifHJdU.js +824 -0
- package/dist/MListItem-BxifHJdU.js.map +1 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js +115 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-BeN9QcB3.js +435 -0
- package/dist/MSeekBar-BeN9QcB3.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-BVSbJlGS.js +691 -0
- package/dist/MSlider-BVSbJlGS.js.map +1 -0
- package/dist/MSpinner-C2SUnWk4.js +65 -0
- package/dist/MSpinner-C2SUnWk4.js.map +1 -0
- package/dist/MTextField-CEkWSZ2v.js +296 -0
- package/dist/MTextField-CEkWSZ2v.js.map +1 -0
- package/dist/MTooltip-CodJGEO-.js +756 -0
- package/dist/MTooltip-CodJGEO-.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +150 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +248 -0
- package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
- package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
- package/dist/components/MFlow.vue.d.ts +318 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFloorPlan.d.ts +58 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +204 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1702 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3547 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/locales/index.js +1435 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +8248 -7637
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +113 -108
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-CaWwi-b6.js} +206 -2
- package/dist/useLocale-CaWwi-b6.js.map +1 -0
- package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +118 -0
- package/src/__tests__/MFloorPlan.test.ts +299 -0
- package/src/__tests__/MFlow.test.ts +590 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +819 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +1080 -0
- package/src/components/MFloorPlanInspector.vue +169 -0
- package/src/components/MFloorPlanToolbar.vue +128 -0
- package/src/components/MFlow.vue +2060 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1270 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +16 -0
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFloorPlan.ts +73 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +410 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +9 -0
- package/src/locales/de.ts +204 -0
- package/src/locales/es.ts +204 -0
- package/src/locales/fr.ts +204 -0
- package/src/locales/ja.ts +204 -0
- package/src/locales/ko.ts +204 -0
- package/src/locales/pt.ts +204 -0
- package/src/locales/zh.ts +204 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/dist/MMenuItem-D4Gx_l3F.js +0 -929
- package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
- package/dist/MSlider-Dx_S3vJ9.js +0 -1506
- package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
- package/dist/MTextField-Bz8JIsnl.js +0 -633
- package/dist/MTextField-Bz8JIsnl.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MTooltip-CodJGEO-.js","names":["$attrs","$slots"],"sources":["../src/composables/_tooltipTrigger.ts","../src/composables/_colorUtils.ts","../src/components/_MColorPanel.vue","../src/components/_MColorPanel.vue","../src/components/MColorPickerModal.vue","../src/components/MColorPickerModal.vue","../src/components/MTooltip.vue","../src/components/MTooltip.vue"],"sourcesContent":["/*\n * Internal (not exported from index.ts): what opens and closes a tooltip, shared by MTooltip and v-tooltip.\n *\n * Input as Compose's BasicTooltip: a mouse shows it on hover after `delay`; touch and pen on a long press, which\n * also swallows the click it would end in (a long-pressed button doesn't fire) and hides it TOUCH_DURATION after\n * the finger lifts (BasicTooltipDefaults.TooltipDuration); focus only from the keyboard. Escape hides it (and\n * stops there, so a dialog around it stays open), and so does any scroll. A rich tooltip closes a moment after\n * the pointer leaves (so it can move onto the tooltip), and after a long press stays until a touch outside it.\n */\n\nexport type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right'\n\nconst LONG_PRESS = 500\nconst TOUCH_DURATION = 1500\nconst RICH_HIDE_DELAY = 120\nconst GAP = 4\nconst MARGIN = 6\n\n/** Where `tip` goes next to `trigger`, kept 6px inside the window */\nexport function placeTooltip(trigger: HTMLElement, tip: HTMLElement, placement: TooltipPlacement) {\n const tr = trigger.getBoundingClientRect()\n const tt = tip.getBoundingClientRect()\n let top = 0\n let left = 0\n switch (placement) {\n case 'top': top = tr.top - tt.height - GAP; left = tr.left + (tr.width - tt.width) / 2; break\n case 'bottom': top = tr.bottom + GAP; left = tr.left + (tr.width - tt.width) / 2; break\n case 'left': top = tr.top + (tr.height - tt.height) / 2; left = tr.left - tt.width - GAP; break\n case 'right': top = tr.top + (tr.height - tt.height) / 2; left = tr.right + GAP; break\n }\n top = Math.max(MARGIN, Math.min(top, window.innerHeight - tt.height - MARGIN))\n left = Math.max(MARGIN, Math.min(left, window.innerWidth - tt.width - MARGIN))\n return { top, left }\n}\n\nexport interface TooltipTriggerOptions {\n delay: () => number\n rich?: () => boolean\n visible: () => boolean\n open: () => void\n close: () => void\n /** The tooltip's element while shown: a touch on it doesn't close a rich tooltip */\n tip: () => HTMLElement | null | undefined\n}\n\nexport function createTooltipTrigger(el: HTMLElement, o: TooltipTriggerOptions) {\n let showTimer: ReturnType<typeof setTimeout> | undefined\n let hideTimer: ReturnType<typeof setTimeout> | undefined\n let press: { id: number, x: number, y: number, timer: ReturnType<typeof setTimeout> } | null = null\n let longPressed = false\n const rich = () => o.rich?.() ?? false\n\n function cancel() {\n clearTimeout(showTimer)\n clearTimeout(hideTimer)\n }\n function show() {\n cancel()\n showTimer = setTimeout(o.open, o.delay())\n }\n function hide() {\n cancel()\n if (rich()) hideTimer = setTimeout(o.close, RICH_HIDE_DELAY)\n else o.close()\n }\n function closeNow() {\n cancel()\n o.close()\n }\n\n function onPointerEnter(e: PointerEvent) {\n if (e.pointerType === 'mouse') show()\n }\n function onPointerLeave(e: PointerEvent) {\n if (e.pointerType === 'mouse') hide()\n }\n\n function endPress() {\n if (press) clearTimeout(press.timer)\n press = null\n window.removeEventListener('pointermove', onPressMove)\n window.removeEventListener('pointerup', onPressUp)\n window.removeEventListener('pointercancel', onPressCancel)\n }\n function onPointerDown(e: PointerEvent) {\n if (e.pointerType === 'mouse') return\n endPress()\n longPressed = false\n press = {\n id: e.pointerId,\n x: e.clientX,\n y: e.clientY,\n timer: setTimeout(() => {\n longPressed = true\n cancel()\n o.open()\n }, LONG_PRESS),\n }\n window.addEventListener('pointermove', onPressMove)\n window.addEventListener('pointerup', onPressUp)\n window.addEventListener('pointercancel', onPressCancel)\n }\n function onPressMove(e: PointerEvent) {\n if (press && e.pointerId === press.id && Math.hypot(e.clientX - press.x, e.clientY - press.y) > 10) endPress()\n }\n function onPressUp(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n endPress()\n if (!longPressed) return\n cancel()\n // A rich tooltip may hold actions to tap: it stays until a touch outside it (Compose's persistent tooltips)\n if (rich()) document.addEventListener('pointerdown', onOutsideTouch, true)\n else hideTimer = setTimeout(o.close, TOUCH_DURATION)\n }\n function onOutsideTouch(e: PointerEvent) {\n const t = e.target as Node\n if (o.tip()?.contains(t) || el.contains(t)) return\n document.removeEventListener('pointerdown', onOutsideTouch, true)\n o.close()\n }\n // The browser took the touch (a scroll)\n function onPressCancel(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n endPress()\n if (longPressed) hide()\n }\n // The click a long press ends in, and the context menu it may open, belong to the tooltip\n function onClickCapture(e: MouseEvent) {\n if (!longPressed) return\n longPressed = false\n e.preventDefault()\n e.stopPropagation()\n }\n function onContextMenu(e: Event) {\n if (press || longPressed) e.preventDefault()\n }\n\n function onFocusIn(e: FocusEvent) {\n let keyboard = true\n try { keyboard = (e.target as Element).matches(':focus-visible') } catch { /* no :focus-visible: show */ }\n if (keyboard) show()\n }\n function onKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape' && o.visible()) {\n // Hiding the tooltip uses the key: a dialog around it stays open\n e.stopPropagation()\n closeNow()\n }\n }\n function onScroll() {\n if (o.visible()) closeNow()\n }\n\n el.addEventListener('pointerenter', onPointerEnter)\n el.addEventListener('pointerleave', onPointerLeave)\n el.addEventListener('pointerdown', onPointerDown)\n el.addEventListener('click', onClickCapture, true)\n el.addEventListener('contextmenu', onContextMenu)\n el.addEventListener('focusin', onFocusIn)\n el.addEventListener('focusout', hide)\n el.addEventListener('keydown', onKeyDown)\n window.addEventListener('scroll', onScroll, true)\n\n return {\n /** Keeps it open (the pointer moved onto a rich tooltip) */\n cancel,\n /** Closes it at once */\n closeNow,\n destroy() {\n cancel()\n endPress()\n document.removeEventListener('pointerdown', onOutsideTouch, true)\n el.removeEventListener('pointerenter', onPointerEnter)\n el.removeEventListener('pointerleave', onPointerLeave)\n el.removeEventListener('pointerdown', onPointerDown)\n el.removeEventListener('click', onClickCapture, true)\n el.removeEventListener('contextmenu', onContextMenu)\n el.removeEventListener('focusin', onFocusIn)\n el.removeEventListener('focusout', hide)\n el.removeEventListener('keydown', onKeyDown)\n window.removeEventListener('scroll', onScroll, true)\n },\n }\n}\n","// 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 * 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","<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","<script setup lang=\"ts\">\n/**\n * A hover/focus-triggered label — plain text, or a rich variant with a title, detailed content, and action\n * buttons.\n *\n * @slot default The trigger element the tooltip is anchored to\n * @slot content Rich-tooltip body content (only used when rich is true)\n * @slot actions Rich-tooltip action buttons row (only used when rich is true)\n */\nimport { nextTick, onMounted, onUnmounted, ref } from 'vue'\nimport { createTooltipTrigger, placeTooltip } from '../composables/_tooltipTrigger'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<{\n /** Tooltip text (plain variant), or the rich variant's title line */\n text?: string\n /** Tooltip position relative to the trigger */\n placement?: 'top' | 'bottom' | 'left' | 'right'\n /** Show delay in ms after hover/focus */\n delay?: number\n /**\n * Rich tooltip with a #content slot and optional #actions. Stays open when hovering the tooltip itself\n * instead of closing immediately.\n */\n rich?: boolean\n}>(), { placement: 'top', delay: 600, rich: false })\n\nconst visible = ref(false)\nconst tipEl = ref<HTMLElement>()\nconst triggerEl = ref<HTMLElement>()\nconst tipStyle = ref<Record<string, string>>({})\n\n// Hover, long press, keyboard focus, Escape and scroll: see _tooltipTrigger.ts (shared with v-tooltip)\nlet trigger: ReturnType<typeof createTooltipTrigger> | undefined\n\nasync function open() {\n visible.value = true\n await nextTick()\n reposition()\n}\n\nfunction onTipEnter() {\n if (props.rich) trigger?.cancel()\n}\n\nfunction onTipLeave() {\n if (props.rich) trigger?.closeNow()\n}\n\nfunction reposition() {\n if (!triggerEl.value || !tipEl.value) return\n const { top, left } = placeTooltip(triggerEl.value, tipEl.value, props.placement)\n tipStyle.value = { top: `${top}px`, left: `${left}px` }\n}\n\nonMounted(() => {\n trigger = createTooltipTrigger(triggerEl.value!, {\n delay: () => props.delay,\n rich: () => props.rich,\n visible: () => visible.value,\n open,\n close: () => { visible.value = false },\n tip: () => tipEl.value,\n })\n})\nonUnmounted(() => trigger?.destroy())\n</script>\n\n<template>\n <span\n ref=\"triggerEl\"\n v-bind=\"$attrs\"\n class=\"inline-flex\"\n >\n <slot />\n </span>\n\n <Teleport to=\"body\">\n <Transition\n enter-active-class=\"transition-opacity duration-150\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition-opacity duration-100\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\"\n >\n <!-- Plain tooltip -->\n <div\n v-if=\"visible && !rich && text\"\n ref=\"tipEl\"\n class=\"pointer-events-none fixed z-400 min-h-6 min-w-10 max-w-[200px] rounded bg-inverse-surface px-2 py-1 text-body-small text-inverse-on-surface\"\n :style=\"tipStyle\"\n role=\"tooltip\"\n >\n {{ text }}\n </div>\n\n <!-- Rich tooltip -->\n <div\n v-else-if=\"visible && rich\"\n ref=\"tipEl\"\n class=\"fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-2\"\n :style=\"tipStyle\"\n role=\"tooltip\"\n @mouseenter=\"onTipEnter\"\n @mouseleave=\"onTipLeave\"\n >\n <div v-if=\"text\" class=\"px-4 pt-3 pb-1 text-title-small font-medium text-on-surface-variant\">\n {{ text }}\n </div>\n <div class=\"px-4 py-2 text-body-medium text-on-surface-variant\">\n <slot name=\"content\" />\n </div>\n <div v-if=\"$slots.actions\" class=\"flex justify-end gap-2 px-4 pb-3\">\n <slot name=\"actions\" />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A hover/focus-triggered label — plain text, or a rich variant with a title, detailed content, and action\n * buttons.\n *\n * @slot default The trigger element the tooltip is anchored to\n * @slot content Rich-tooltip body content (only used when rich is true)\n * @slot actions Rich-tooltip action buttons row (only used when rich is true)\n */\nimport { nextTick, onMounted, onUnmounted, ref } from 'vue'\nimport { createTooltipTrigger, placeTooltip } from '../composables/_tooltipTrigger'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<{\n /** Tooltip text (plain variant), or the rich variant's title line */\n text?: string\n /** Tooltip position relative to the trigger */\n placement?: 'top' | 'bottom' | 'left' | 'right'\n /** Show delay in ms after hover/focus */\n delay?: number\n /**\n * Rich tooltip with a #content slot and optional #actions. Stays open when hovering the tooltip itself\n * instead of closing immediately.\n */\n rich?: boolean\n}>(), { placement: 'top', delay: 600, rich: false })\n\nconst visible = ref(false)\nconst tipEl = ref<HTMLElement>()\nconst triggerEl = ref<HTMLElement>()\nconst tipStyle = ref<Record<string, string>>({})\n\n// Hover, long press, keyboard focus, Escape and scroll: see _tooltipTrigger.ts (shared with v-tooltip)\nlet trigger: ReturnType<typeof createTooltipTrigger> | undefined\n\nasync function open() {\n visible.value = true\n await nextTick()\n reposition()\n}\n\nfunction onTipEnter() {\n if (props.rich) trigger?.cancel()\n}\n\nfunction onTipLeave() {\n if (props.rich) trigger?.closeNow()\n}\n\nfunction reposition() {\n if (!triggerEl.value || !tipEl.value) return\n const { top, left } = placeTooltip(triggerEl.value, tipEl.value, props.placement)\n tipStyle.value = { top: `${top}px`, left: `${left}px` }\n}\n\nonMounted(() => {\n trigger = createTooltipTrigger(triggerEl.value!, {\n delay: () => props.delay,\n rich: () => props.rich,\n visible: () => visible.value,\n open,\n close: () => { visible.value = false },\n tip: () => tipEl.value,\n })\n})\nonUnmounted(() => trigger?.destroy())\n</script>\n\n<template>\n <span\n ref=\"triggerEl\"\n v-bind=\"$attrs\"\n class=\"inline-flex\"\n >\n <slot />\n </span>\n\n <Teleport to=\"body\">\n <Transition\n enter-active-class=\"transition-opacity duration-150\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition-opacity duration-100\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\"\n >\n <!-- Plain tooltip -->\n <div\n v-if=\"visible && !rich && text\"\n ref=\"tipEl\"\n class=\"pointer-events-none fixed z-400 min-h-6 min-w-10 max-w-[200px] rounded bg-inverse-surface px-2 py-1 text-body-small text-inverse-on-surface\"\n :style=\"tipStyle\"\n role=\"tooltip\"\n >\n {{ text }}\n </div>\n\n <!-- Rich tooltip -->\n <div\n v-else-if=\"visible && rich\"\n ref=\"tipEl\"\n class=\"fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-2\"\n :style=\"tipStyle\"\n role=\"tooltip\"\n @mouseenter=\"onTipEnter\"\n @mouseleave=\"onTipLeave\"\n >\n <div v-if=\"text\" class=\"px-4 pt-3 pb-1 text-title-small font-medium text-on-surface-variant\">\n {{ text }}\n </div>\n <div class=\"px-4 py-2 text-body-medium text-on-surface-variant\">\n <slot name=\"content\" />\n </div>\n <div v-if=\"$slots.actions\" class=\"flex justify-end gap-2 px-4 pb-3\">\n <slot name=\"actions\" />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;AAYA,IAAM,IAAa,KACb,IAAiB,MACjB,IAAkB,KAClB,IAAM,GACN,IAAS;AAGf,SAAgB,EAAa,GAAsB,GAAkB,GAA6B;CAChG,IAAM,IAAK,EAAQ,sBAAsB,GACnC,IAAK,EAAI,sBAAsB,GACjC,IAAM,GACN,IAAO;CACX,QAAQ,GAAR;EACE,KAAK;GAAuC,AAAhC,IAAM,EAAG,MAAM,EAAG,SAAS,GAAK,IAAO,EAAG,QAAQ,EAAG,QAAQ,EAAG,SAAS;GAAG;EACxF,KAAK;GAAiC,AAAvB,IAAM,EAAG,SAAS,GAAK,IAAO,EAAG,QAAQ,EAAG,QAAQ,EAAG,SAAS;GAAG;EAClF,KAAK;GAAoD,AAA5C,IAAM,EAAG,OAAO,EAAG,SAAS,EAAG,UAAU,GAAG,IAAO,EAAG,OAAO,EAAG,QAAQ;GAAK;EAC1F,KAAK,SAAqD,AAA5C,IAAM,EAAG,OAAO,EAAG,SAAS,EAAG,UAAU,GAAG,IAAO,EAAG,QAAQ;CAC9E;CAGA,OAFA,IAAM,KAAK,IAAI,GAAQ,KAAK,IAAI,GAAK,OAAO,cAAc,EAAG,SAAS,CAAM,CAAC,GAC7E,IAAO,KAAK,IA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0,0 +1,18 @@
|
|
|
1
|
+
//#region src/composables/_storageKeys.ts
|
|
2
|
+
var e = "m3-theme", t = "m3-dynamic-palette", n = "m3-viewport", r = "", i = /* @__PURE__ */ new Set();
|
|
3
|
+
function a(e, t = r) {
|
|
4
|
+
return t ? `${t}-${e}` : e;
|
|
5
|
+
}
|
|
6
|
+
function o(e) {
|
|
7
|
+
if (e !== r) {
|
|
8
|
+
r = e;
|
|
9
|
+
for (let e of i) e();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function s(e) {
|
|
13
|
+
i.add(e);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { o as a, s as i, e as n, a as o, n as r, t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=_storageKeys-CYXsUBwK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_storageKeys-CYXsUBwK.js","names":[],"sources":["../src/composables/_storageKeys.ts"],"sourcesContent":["// Storage keys shared with modules that must not load useTheme (it applies the theme to <html> when it loads)\nexport const THEME_KEY = 'm3-theme'\n// The <style> useColorPalette writes a generated palette's CSS into\nexport const STYLE_ID = 'm3-dynamic-palette'\n// The window's size, a cookie only (createM3UI({ cookies: true })): `<width>x<height>`\nexport const VIEWPORT_KEY = 'm3-viewport'\n\n// ── Prefix ──────────────────────────────────────────────────────────────────────────────────────\n// `createM3UI({ storagePrefix: 'admin' })`: every key the library stores (localStorage and cookies) becomes\n// `admin-m3-…`, so apps on the same origin under different paths keep their own theme, palette and the rest\n// (localStorage is per origin and our cookies are on `Path=/`, so without it they share one).\n\nlet prefix = ''\nconst reloaders = new Set<() => void>()\n\n/** The name a key is stored under: the base key with the app's prefix, if any. */\nexport function storageKey(base: string, storagePrefix = prefix): string {\n return storagePrefix ? `${storagePrefix}-${base}` : base\n}\n\n/**\n * Sets the prefix and has every module that read its stored state on load (theme, palette, recent colors…) read\n * it again under the new keys. `createM3UI` calls it before applying anything else.\n */\nexport function setStoragePrefix(next: string) {\n if (next === prefix) return\n prefix = next\n for (const reload of reloaders) reload()\n}\n\n/** Registers what a module does to read its stored state again when the prefix changes. */\nexport function onStoragePrefix(reload: () => void) {\n reloaders.add(reload)\n}\n"],"mappings":";AACA,IAAa,IAAY,YAEZ,IAAW,sBAEX,IAAe,eAOxB,IAAS,IACP,oBAAY,IAAI,IAAgB;AAGtC,SAAgB,EAAW,GAAc,IAAgB,GAAgB;CACvE,OAAO,IAAgB,GAAG,EAAc,GAAG,MAAS;AACtD;AAMA,SAAgB,EAAiB,GAAc;CACzC,UAAS,GACb;MAAS;EACT,KAAK,IAAM,KAAU,GAAW,EAAO;CAD9B;AAEX;AAGA,SAAgB,EAAgB,GAAoB;CAClD,EAAU,IAAI,CAAM;AACtB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getCurrentInstance as e, onBeforeUnmount as t, watch as n } from "vue";
|
|
2
|
+
//#region src/composables/_useEscapeStack.ts
|
|
3
|
+
var r = [];
|
|
4
|
+
function i(e) {
|
|
5
|
+
e.key === "Escape" && r.length && (e.preventDefault(), r[r.length - 1]());
|
|
6
|
+
}
|
|
7
|
+
function a(a, o) {
|
|
8
|
+
let s = () => o();
|
|
9
|
+
function c(e) {
|
|
10
|
+
if (typeof document > "u") return;
|
|
11
|
+
let t = r.indexOf(s);
|
|
12
|
+
e && t < 0 ? (r.push(s), r.length === 1 && document.addEventListener("keydown", i)) : !e && t >= 0 && (r.splice(t, 1), r.length || document.removeEventListener("keydown", i));
|
|
13
|
+
}
|
|
14
|
+
n(a, (e) => c(!!e), { immediate: !0 }), e() && t(() => c(!1));
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { a as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=_useEscapeStack-CjndQhqg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_useEscapeStack-CjndQhqg.js","names":[],"sources":["../src/composables/_useEscapeStack.ts"],"sourcesContent":["import { getCurrentInstance, onBeforeUnmount, watch, type WatchSource } from 'vue'\n\n/*\n * Internal (not exported from index.ts): Escape for stacked modal surfaces. Each MDialog used to listen on document\n * itself, so with a dialog opened over another (a date picker over a form) one Escape closed them all. Open\n * surfaces go on a stack, and one listener hands Escape to the top one only. A persistent dialog on top takes it and\n * does nothing, so the one under it stays.\n */\n\nconst stack: (() => void)[] = []\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key !== 'Escape' || !stack.length) return\n // Handled: the browser then doesn't also run a close watcher with it (MContainerTransform's, under a dialog)\n e.preventDefault()\n stack[stack.length - 1]!()\n}\n\n/** Calls `onEscape` on Escape while `active`, unless something opened later is on top of it. */\nexport function useEscapeStack(active: WatchSource<boolean>, onEscape: () => void) {\n const entry = () => onEscape()\n function set(on: boolean) {\n if (typeof document === 'undefined') return\n const i = stack.indexOf(entry)\n if (on && i < 0) {\n stack.push(entry)\n if (stack.length === 1) document.addEventListener('keydown', onKeydown)\n } else if (!on && i >= 0) {\n stack.splice(i, 1)\n if (!stack.length) document.removeEventListener('keydown', onKeydown)\n }\n }\n watch(active, (on) => set(!!on), { immediate: true })\n if (getCurrentInstance()) onBeforeUnmount(() => set(false))\n}\n"],"mappings":";;AASA,IAAM,IAAwB,CAAC;AAE/B,SAAS,EAAU,GAAkB;CAC/B,EAAE,QAAQ,YAAa,EAAM,WAEjC,EAAE,eAAe,GACjB,EAAM,EAAM,SAAS,EAAE,CAAE;AAC3B;AAGA,SAAgB,EAAe,GAA8B,GAAsB;CACjF,IAAM,UAAc,EAAS;CAC7B,SAAS,EAAI,GAAa;EACxB,IAAI,OAAO,WAAa,KAAa;EACrC,IAAM,IAAI,EAAM,QAAQ,CAAK;EAC7B,AAAI,KAAM,IAAI,KACZ,EAAM,KAAK,CAAK,GACZ,EAAM,WAAW,KAAG,SAAS,iBAAiB,WAAW,CAAS,KAC7D,CAAC,KAAM,KAAK,MACrB,EAAM,OAAO,GAAG,CAAC,GACZ,EAAM,UAAQ,SAAS,oBAAoB,WAAW,CAAS;CAExE;CAEA,AADA,EAAM,IAAS,MAAO,EAAI,CAAC,CAAC,CAAE,GAAG,EAAE,WAAW,GAAK,CAAC,GAChD,EAAmB,KAAG,QAAsB,EAAI,EAAK,CAAC;AAC5D"}
|