@m3ui-vue/m3ui-vue 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +2776 -351
- package/dist/MButton-CuNzpoxm.js +172 -0
- package/dist/MButton-CuNzpoxm.js.map +1 -0
- package/dist/MDialog-HxEL-m58.js +173 -0
- package/dist/MDialog-HxEL-m58.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-DnPtv-hY.js +824 -0
- package/dist/MListItem-DnPtv-hY.js.map +1 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.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-LURE1Ah7.js +435 -0
- package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-_J4IS2_z.js +691 -0
- package/dist/MSlider-_J4IS2_z.js.map +1 -0
- package/dist/MSpinner-BhkMYKOM.js +65 -0
- package/dist/MSpinner-BhkMYKOM.js.map +1 -0
- package/dist/MTextField-CkzwNBWS.js +296 -0
- package/dist/MTextField-CkzwNBWS.js.map +1 -0
- package/dist/MTooltip-B67ZDSGp.js +756 -0
- package/dist/MTooltip-B67ZDSGp.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 +148 -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 +160 -0
- package/dist/components/MFlow.vue.d.ts +305 -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/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +163 -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 +1700 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3542 -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 +4 -0
- package/dist/locales/index.js +1148 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7286 -7654
- 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-BpGxplLV.js} +165 -2
- package/dist/useLocale-BpGxplLV.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 +110 -0
- package/src/__tests__/MFloorPlan.test.ts +97 -0
- package/src/__tests__/MFlow.test.ts +575 -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 +813 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +581 -0
- package/src/components/MFlow.vue +2049 -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 +1269 -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/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +328 -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 +4 -0
- package/src/locales/de.ts +163 -0
- package/src/locales/es.ts +163 -0
- package/src/locales/fr.ts +163 -0
- package/src/locales/ja.ts +163 -0
- package/src/locales/ko.ts +163 -0
- package/src/locales/pt.ts +163 -0
- package/src/locales/zh.ts +163 -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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MTextField-Bz8JIsnl.js","names":["$slots"],"sources":["../src/directives/vRipple.ts","../src/composables/_springAnimation.ts","../src/components/MSpinner.vue","../src/components/MSpinner.vue","../src/composables/useFieldBg.ts","../src/composables/useAutoGrow.ts","../src/composables/useDebounce.ts","../src/composables/_useSpring.ts","../src/components/MIconButton.vue","../src/components/MIconButton.vue","../src/composables/_useEscapeStack.ts","../src/components/MTextField.vue","../src/components/MTextField.vue"],"sourcesContent":["import type { Directive } from 'vue'\n\n/** Options for `v-ripple`. */\nexport interface RippleOptions {\n /** No ripple while true (e.g. bound to the element's disabled state). */\n disabled?: boolean\n /** Any CSS color for the ripple; defaults to the element's text color (`currentColor`). */\n color?: string\n}\n\n/** `v-ripple` value: nothing or `true` (on), `false` (off), a CSS color, or an options object. */\nexport type RippleValue = boolean | string | RippleOptions | null | undefined\n\nfunction normalize(value: RippleValue): RippleOptions {\n if (value === false) return { disabled: true }\n if (typeof value === 'string') return { color: value }\n if (value === true || value == null) return {}\n return value\n}\n\n// The ripple sits in its own clipping layer (`border-radius: inherit`), so the host only needs to be\n// positioned, not `overflow: hidden`.\nfunction spawnRipple(host: HTMLElement, event: { clientX: number; clientY: number }, color?: string) {\n const rect = host.getBoundingClientRect()\n const d = Math.max(rect.width, rect.height) * 2\n const layer = document.createElement('span')\n layer.className = 'm3-ripple-layer'\n const el = document.createElement('span')\n el.className = 'm3-ripple'\n el.style.cssText = `width:${d}px;height:${d}px;top:${event.clientY - rect.top - d / 2}px;left:${event.clientX - rect.left - d / 2}px`\n if (color) el.style.background = color\n layer.appendChild(el)\n host.appendChild(layer)\n el.addEventListener('animationend', () => layer.remove(), { once: true })\n}\n\ninterface RippleState {\n options: RippleOptions\n onPointerDown: (e: PointerEvent) => void\n}\n\nconst states = new WeakMap<HTMLElement, RippleState>()\n\n/**\n * The M3 press ripple for any element: `<div v-ripple>`, `v-ripple=\"false\"`, `v-ripple=\"'#e91e63'\"`\n * or `v-ripple=\"{ disabled, color }\"`. A statically positioned element is made `position: relative`.\n * Registered globally as `v-ripple` by `createM3UI()`; import `vRipple` to use it without the plugin.\n */\nexport const vRipple: Directive<HTMLElement, RippleValue> = {\n mounted(el, binding) {\n const state: RippleState = {\n options: normalize(binding.value),\n onPointerDown(e) {\n if (state.options.disabled || e.button !== 0) return\n // Checked on press, not on mount: the element may not be in the document yet when mounted.\n const { position } = getComputedStyle(el)\n if (!position || position === 'static') el.style.position = 'relative'\n spawnRipple(el, e, state.options.color)\n },\n }\n states.set(el, state)\n el.addEventListener('pointerdown', state.onPointerDown)\n },\n updated(el, binding) {\n const state = states.get(el)\n if (state) state.options = normalize(binding.value)\n },\n beforeUnmount(el) {\n const state = states.get(el)\n if (state) el.removeEventListener('pointerdown', state.onPointerDown)\n states.delete(el)\n },\n}\n","import type { SpringSpec } from './motion'\n\n/*\n * Internal (not exported from index.ts): springs played as Web Animations.\n *\n * The library's springs normally step in a rAF loop (see CLAUDE.md). That loop runs on the main thread, and an\n * enter/exit animation starts exactly when the main thread is busiest: mounting the panel's content, re-laying\n * out the page for a scroll lock. On phones that janked visibly (MNavigationDrawer's open, where the old CSS\n * transition hadn't, since the compositor runs those). So enter/exit/settle springs are simulated up front, one\n * sample per 60Hz frame, and played as a linear Web Animation of transform/opacity, which the compositor runs\n * too. Same curve, bounce and release velocity as the loop; only a finger-driven drag writes styles directly.\n *\n * Pattern: write the end state inline, then play the samples over it (an animation beats inline styles), so\n * nothing jumps when it ends; to interrupt, read `sampleAt(samples, anim.currentTime)`, write that inline and\n * cancel.\n */\n\nexport const SAMPLE_MS = 1000 / 60\n// Stiff springs (FastEffects, 3800) diverge at a 16ms Euler step: integrate in 4ms substeps\nconst SUBSTEP = 0.004\n\n/**\n * The spring from `from` to `to`, starting at `velocity` (units/s), one sample per 60Hz frame until it's within\n * `epsilon` of `to` (and slower than `epsilon * 10` per second). The last sample is exactly `to`.\n */\nexport function sampleSpring(from: number, to: number, velocity: number, spring: SpringSpec, epsilon: number): number[] {\n const out = [from]\n let pos = from\n let vel = velocity\n const damping = 2 * spring.dampingRatio * Math.sqrt(spring.stiffness)\n for (let i = 0; i < 600; i++) {\n for (let left = SAMPLE_MS / 1000; left > 1e-9; left -= SUBSTEP) {\n const h = Math.min(SUBSTEP, left)\n vel += (-spring.stiffness * (pos - to) - damping * vel) * h\n pos += vel * h\n }\n out.push(pos)\n if (Math.abs(pos - to) < epsilon && Math.abs(vel) < epsilon * 10) break\n }\n out[out.length - 1] = to\n return out\n}\n\n/** The value `samples` has `time` ms into playback (an Animation's currentTime), linear between frames */\nexport function sampleAt(samples: number[], time: CSSNumberish | null | undefined): number {\n const t = Number(time ?? 0) / SAMPLE_MS\n const i = Math.floor(t)\n if (i >= samples.length - 1) return samples[samples.length - 1]!\n if (i < 0) return samples[0]!\n return samples[i]! + (samples[i + 1]! - samples[i]!) * (t - i)\n}\n\n/** How long `samples` play, in ms */\nexport const samplesDuration = (samples: number[]) => (samples.length - 1) * SAMPLE_MS\n\n/**\n * Plays `samples` on `el` as a linear Web Animation, each mapped to a keyframe. Null when there's nothing to\n * play or no Web Animations API (the inline end state then simply stands).\n */\nexport function playSamples(\n el: Element | null | undefined,\n samples: number[],\n keyframe: (value: number) => Keyframe,\n delay = 0,\n): Animation | null {\n if (!el || typeof (el as HTMLElement).animate !== 'function' || samples.length < 2) return null\n const anim = (el as HTMLElement).animate(samples.map(keyframe), { duration: samplesDuration(samples), delay, easing: 'linear' })\n // cancel() rejects `finished`; nothing has to wait on it\n anim.finished.catch(() => {})\n return anim\n}\n\nexport const prefersReducedMotion = () =>\n typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches\n","<script setup lang=\"ts\">\n/**\n * A small circular loading spinner — a standard ring, or the M3 Expressive wavy variant. For a larger,\n * shape-morphing loading affordance, see MLoadingIndicator.\n */\nimport { computed } from \"vue\";\nimport { useLocale } from '../composables/useLocale';\n\nconst props = withDefaults(\n defineProps<{\n /** Size in px */\n size?: number;\n /**\n * M3 Expressive wavy animation style — the ring rotates while a wave travels along its stroke, instead of a\n * plain spin\n */\n wavy?: boolean;\n /** Aria label for the spinner's status role — falls back to the locale string ('Loading') when omitted */\n label?: string;\n }>(),\n { size: 20, wavy: false },\n);\n\nconst locale = useLocale();\n\nconst STROKE = 3;\nconst BUMPS = 9;\n\n// amp fraction of r = 0.25 → max radius = r * 1.25\n// Constrain so that max_r + STROKE/2 ≤ size/2 - 1 (1px margin from edge)\nconst r = computed(() => (props.size / 2 - 1 - STROKE / 2) / 1.25);\nconst cx = computed(() => props.size / 2);\n\n// Build the full bumpy-circle path and its total length.\nconst wavyData = computed(() => {\n const CX = cx.value;\n const R = r.value;\n const amp = R * 0.08;\n const segs = BUMPS * 24; // smooth curve\n\n const pts: string[] = [];\n let len = 0;\n let px = 0,\n py = 0;\n\n for (let i = 0; i <= segs; i++) {\n const theta = (2 * Math.PI * i) / segs - Math.PI / 2;\n const rr = R + amp * Math.sin(BUMPS * theta);\n const x = CX + rr * Math.cos(theta);\n const y = CX + rr * Math.sin(theta);\n if (i > 0) len += Math.sqrt((x - px) ** 2 + (y - py) ** 2);\n pts.push(`${i === 0 ? \"M\" : \"L\"}${x.toFixed(2)},${y.toFixed(2)}`);\n px = x;\n py = y;\n }\n\n // Visible arc ~58% of the circumference, gap fills the rest.\n const visible = len * 0.58;\n const gap = len - visible;\n const dash = `${visible.toFixed(1)} ${gap.toFixed(1)}`;\n\n // The wave \"travels\" by shifting dashoffset over exactly one full length,\n // so the crests slide around the path independently of the rotation.\n return { path: pts.join(\"\") + \"Z\", dash, len: len.toFixed(1) };\n});\n</script>\n\n<template>\n <span\n class=\"inline-flex shrink-0 items-center justify-center\"\n :style=\"{ width: `${size}px`, height: `${size}px` }\"\n role=\"status\"\n :aria-label=\"label ?? locale.loading\"\n >\n <!-- Standard circular spinner -->\n <span\n v-if=\"!wavy\"\n class=\"block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n\n <!-- Wavy spinner (M3 Expressive): the whole shape rotates AND the wave\n travels along the stroke via dashoffset, giving the snake-like flow. -->\n <svg\n v-else\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"`0 0 ${size} ${size}`\"\n fill=\"none\"\n class=\"animate-[m3-wavy-spin_2.8s_linear_infinite]\"\n :style=\"`transform-origin: ${cx}px ${cx}px`\"\n >\n <path\n :d=\"wavyData.path\"\n stroke=\"currentColor\"\n :stroke-width=\"STROKE\"\n stroke-linecap=\"round\"\n :stroke-dasharray=\"wavyData.dash\"\n class=\"animate-[m3-wavy-travel_2s_linear_infinite]\"\n :style=\"{ '--m3-wave-len': wavyData.len }\"\n />\n </svg>\n </span>\n</template>\n\n<style>\n/* The SVG element rotates the whole bumpy circle. */\n@keyframes m3-wavy-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n/* The stroke's dashoffset slides by one full path length, so the crests\n appear to crawl along the circle — the \"snake\" motion of M3 Expressive.\n Negative direction makes the wave travel forward relative to the spin. */\n@keyframes m3-wavy-travel {\n from {\n stroke-dashoffset: 0;\n }\n to {\n stroke-dashoffset: calc(var(--m3-wave-len) * -1px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .animate-\\[m3-wavy-spin_2\\.8s_linear_infinite\\] {\n animation: m3-wavy-spin 2.8s linear infinite;\n }\n .animate-\\[m3-wavy-travel_2s_linear_infinite\\] {\n animation: none !important;\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A small circular loading spinner — a standard ring, or the M3 Expressive wavy variant. For a larger,\n * shape-morphing loading affordance, see MLoadingIndicator.\n */\nimport { computed } from \"vue\";\nimport { useLocale } from '../composables/useLocale';\n\nconst props = withDefaults(\n defineProps<{\n /** Size in px */\n size?: number;\n /**\n * M3 Expressive wavy animation style — the ring rotates while a wave travels along its stroke, instead of a\n * plain spin\n */\n wavy?: boolean;\n /** Aria label for the spinner's status role — falls back to the locale string ('Loading') when omitted */\n label?: string;\n }>(),\n { size: 20, wavy: false },\n);\n\nconst locale = useLocale();\n\nconst STROKE = 3;\nconst BUMPS = 9;\n\n// amp fraction of r = 0.25 → max radius = r * 1.25\n// Constrain so that max_r + STROKE/2 ≤ size/2 - 1 (1px margin from edge)\nconst r = computed(() => (props.size / 2 - 1 - STROKE / 2) / 1.25);\nconst cx = computed(() => props.size / 2);\n\n// Build the full bumpy-circle path and its total length.\nconst wavyData = computed(() => {\n const CX = cx.value;\n const R = r.value;\n const amp = R * 0.08;\n const segs = BUMPS * 24; // smooth curve\n\n const pts: string[] = [];\n let len = 0;\n let px = 0,\n py = 0;\n\n for (let i = 0; i <= segs; i++) {\n const theta = (2 * Math.PI * i) / segs - Math.PI / 2;\n const rr = R + amp * Math.sin(BUMPS * theta);\n const x = CX + rr * Math.cos(theta);\n const y = CX + rr * Math.sin(theta);\n if (i > 0) len += Math.sqrt((x - px) ** 2 + (y - py) ** 2);\n pts.push(`${i === 0 ? \"M\" : \"L\"}${x.toFixed(2)},${y.toFixed(2)}`);\n px = x;\n py = y;\n }\n\n // Visible arc ~58% of the circumference, gap fills the rest.\n const visible = len * 0.58;\n const gap = len - visible;\n const dash = `${visible.toFixed(1)} ${gap.toFixed(1)}`;\n\n // The wave \"travels\" by shifting dashoffset over exactly one full length,\n // so the crests slide around the path independently of the rotation.\n return { path: pts.join(\"\") + \"Z\", dash, len: len.toFixed(1) };\n});\n</script>\n\n<template>\n <span\n class=\"inline-flex shrink-0 items-center justify-center\"\n :style=\"{ width: `${size}px`, height: `${size}px` }\"\n role=\"status\"\n :aria-label=\"label ?? locale.loading\"\n >\n <!-- Standard circular spinner -->\n <span\n v-if=\"!wavy\"\n class=\"block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n\n <!-- Wavy spinner (M3 Expressive): the whole shape rotates AND the wave\n travels along the stroke via dashoffset, giving the snake-like flow. -->\n <svg\n v-else\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"`0 0 ${size} ${size}`\"\n fill=\"none\"\n class=\"animate-[m3-wavy-spin_2.8s_linear_infinite]\"\n :style=\"`transform-origin: ${cx}px ${cx}px`\"\n >\n <path\n :d=\"wavyData.path\"\n stroke=\"currentColor\"\n :stroke-width=\"STROKE\"\n stroke-linecap=\"round\"\n :stroke-dasharray=\"wavyData.dash\"\n class=\"animate-[m3-wavy-travel_2s_linear_infinite]\"\n :style=\"{ '--m3-wave-len': wavyData.len }\"\n />\n </svg>\n </span>\n</template>\n\n<style>\n/* The SVG element rotates the whole bumpy circle. */\n@keyframes m3-wavy-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n/* The stroke's dashoffset slides by one full path length, so the crests\n appear to crawl along the circle — the \"snake\" motion of M3 Expressive.\n Negative direction makes the wave travel forward relative to the spin. */\n@keyframes m3-wavy-travel {\n from {\n stroke-dashoffset: 0;\n }\n to {\n stroke-dashoffset: calc(var(--m3-wave-len) * -1px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .animate-\\[m3-wavy-spin_2\\.8s_linear_infinite\\] {\n animation: m3-wavy-spin 2.8s linear infinite;\n }\n .animate-\\[m3-wavy-travel_2s_linear_infinite\\] {\n animation: none !important;\n }\n}\n</style>\n","import { ref, computed, onMounted, onBeforeUnmount, type Ref } from 'vue'\n\nconst M3_BG_CLASSES = [\n 'bg-surface-container-highest',\n 'bg-surface-container-high',\n 'bg-surface-container-low',\n 'bg-surface-container-lowest',\n 'bg-surface-container',\n 'bg-surface-variant',\n 'bg-surface-bright',\n 'bg-surface-dim',\n 'bg-surface',\n 'bg-background',\n 'bg-inverse-surface',\n 'bg-primary-container',\n 'bg-secondary-container',\n 'bg-tertiary-container',\n 'bg-error-container',\n 'bg-primary-fixed',\n 'bg-primary-fixed-dim',\n 'bg-secondary-fixed',\n 'bg-secondary-fixed-dim',\n 'bg-tertiary-fixed',\n 'bg-tertiary-fixed-dim',\n 'bg-primary',\n 'bg-secondary',\n 'bg-tertiary',\n 'bg-error',\n] as const\n\nfunction findM3BgVar(el: HTMLElement): string | null {\n for (const cls of M3_BG_CLASSES) {\n if (el.classList.contains(cls)) return `var(--color-${cls.slice(3)})`\n }\n return null\n}\n\nfunction isTransparent(color: string): boolean {\n if (!color || color === 'transparent') return true\n const m = color.match(/^rgba?\\(([^)]+)\\)$/)\n if (m) {\n const parts = m[1]!.split(',').map((s) => s.trim())\n if (parts.length === 4 && parseFloat(parts[3]!) === 0) return true\n }\n return false\n}\n\n/**\n * Auto-detects the background behind `containerEl` and exposes it as `--field-bg`.\n * Prefers a CSS variable reference (e.g. var(--color-surface-container-low)) over a\n * raw computed color so the outlined label cutout transitions in sync with the rest\n * of the theme switch instead of lagging behind.\n *\n * @param containerEl The element that receives `--field-bg` as an inline style.\n * @param fieldBgProp Getter for the explicit `fieldBg` prop (overrides auto-detect).\n */\nexport function useFieldBg(\n containerEl: Ref<HTMLElement | null>,\n fieldBgProp: () => string | undefined,\n) {\n const detectedBg = ref<string>('var(--color-surface)')\n\n function applyFieldBg(value: string) {\n detectedBg.value = value\n containerEl.value?.style.setProperty('--field-bg', fieldBgProp() ?? value)\n }\n\n function resolveBg() {\n let el: HTMLElement | null = containerEl.value?.parentElement ?? null\n while (el) {\n const cssVar = findM3BgVar(el)\n if (cssVar) { applyFieldBg(cssVar); return }\n if (el === document.body) { applyFieldBg('var(--color-surface)'); return }\n const bg = getComputedStyle(el).backgroundColor\n if (!isTransparent(bg)) { applyFieldBg(bg); return }\n el = el.parentElement\n }\n applyFieldBg('var(--color-surface)')\n }\n\n let observer: MutationObserver | null = null\n\n onMounted(() => {\n resolveBg()\n observer = new MutationObserver(() => resolveBg())\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'style', 'data-theme'],\n })\n })\n\n onBeforeUnmount(() => observer?.disconnect())\n\n const resolvedFieldBg = computed(() => fieldBgProp() ?? detectedBg.value)\n\n return { resolvedFieldBg }\n}\n","import { getCurrentInstance, onBeforeUnmount, toValue, watch, type MaybeRefOrGetter, type WatchSource } from 'vue'\n\nexport interface AutoGrowOptions {\n /** Fewest rows it shrinks to (default 1) */\n minRows?: MaybeRefOrGetter<number | undefined>\n /** Most rows it grows to; past them it scrolls. Unset grows without limit */\n maxRows?: MaybeRefOrGetter<number | undefined>\n /**\n * The text, when it can change without typing (cleared after sending, an emoji inserted…): a ref or getter, so the\n * height follows. Typing is followed on its own\n */\n value?: WatchSource<unknown>\n}\n\n/**\n * Makes a `<textarea>` grow with its text, between `minRows` and `maxRows` rows, scrolling past the last one: a chat\n * composer, a comment box. Works on any textarea, styled however you like (rows are measured from its computed line\n * height, padding and border). It also follows width changes, which rewrap the text. Returns `resize()` for anything\n * else that changes the text.\n */\nexport function useAutoGrow(target: MaybeRefOrGetter<HTMLTextAreaElement | null | undefined>, options: AutoGrowOptions = {}) {\n let el: HTMLTextAreaElement | null = null\n let observer: ResizeObserver | null = null\n let lastWidth = 0\n\n function resize() {\n if (!el) return\n const cs = getComputedStyle(el)\n const px = (v: string) => parseFloat(v) || 0\n // `normal` line height has no number: about 1.5× the font size\n const lineHeight = px(cs.lineHeight) || px(cs.fontSize) * 1.5 || 24\n const padding = px(cs.paddingTop) + px(cs.paddingBottom)\n const border = cs.boxSizing === 'border-box' ? px(cs.borderTopWidth) + px(cs.borderBottomWidth) : 0\n const extra = (cs.boxSizing === 'border-box' ? padding : 0) + border\n const min = (toValue(options.minRows) ?? 1) * lineHeight + extra\n const maxRows = toValue(options.maxRows)\n const max = maxRows ? maxRows * lineHeight + extra : Infinity\n\n // Collapse first so scrollHeight measures the text, not the current height\n el.style.height = 'auto'\n const content = el.scrollHeight + border + (cs.boxSizing === 'border-box' ? 0 : -padding)\n const height = Math.min(max, Math.max(min, content))\n el.style.height = `${height}px`\n el.style.overflowY = content > max ? 'auto' : 'hidden'\n }\n\n function attach(next: HTMLTextAreaElement | null | undefined) {\n if (el) {\n el.removeEventListener('input', resize)\n observer?.disconnect()\n // Released (autoGrow turned off, another element): back to its own height\n el.style.height = ''\n el.style.overflowY = ''\n }\n el = next ?? null\n if (!el) return\n el.addEventListener('input', resize)\n if (typeof ResizeObserver !== 'undefined') {\n // Only width changes rewrap the text; our own height writes would otherwise loop\n observer ??= new ResizeObserver(([entry]) => {\n const w = entry!.contentRect.width\n if (w !== lastWidth) {\n lastWidth = w\n resize()\n }\n })\n observer.observe(el)\n }\n resize()\n }\n\n watch(() => toValue(target), attach, { immediate: true, flush: 'post' })\n watch([() => toValue(options.minRows), () => toValue(options.maxRows)], () => resize(), { flush: 'post' })\n if (options.value) watch(options.value, () => resize(), { flush: 'post' })\n if (getCurrentInstance()) onBeforeUnmount(() => attach(null))\n\n return { resize }\n}\n","import { onBeforeUnmount } from 'vue'\n\nexport function useDebounce(fn: (...args: any[]) => void, ms: number) {\n let timer: ReturnType<typeof setTimeout> | null = null\n\n function debounced(...args: any[]) {\n if (timer) clearTimeout(timer)\n timer = setTimeout(() => {\n timer = null\n fn(...args)\n }, ms)\n }\n\n function cancel() {\n if (timer) {\n clearTimeout(timer)\n timer = null\n }\n }\n\n onBeforeUnmount(cancel)\n\n return { debounced, cancel }\n}\n","// A set of numbers (corner radii, sizes...) that springs toward a target, written to the DOM once per\n// frame through `apply`. Same integration as the rest of the library (semi-implicit Euler), in fixed 4ms\n// substeps so a stiff spring stays stable on a dropped frame. `useSpring` is public (index.ts, with the\n// motion tokens); the constants below are the library's internal shorthands for the Standard scheme.\nimport { onMounted, onUnmounted, watch } from 'vue'\nimport { cubicBezier, motionSprings, type SpringSpec } from './motion'\n\nexport type { SpringSpec }\n\n/** MotionSchemeKeyTokens.FastSpatial in the Standard scheme (StandardMotionTokens.SpringFastSpatial*) */\nexport const FAST_SPATIAL: SpringSpec = motionSprings.standard.fastSpatial\n/** MotionSchemeKeyTokens.FastEffects in the Standard scheme */\nexport const FAST_EFFECTS: SpringSpec = motionSprings.standard.fastEffects\n/** MotionSchemeKeyTokens.DefaultEffects in the Standard scheme */\nexport const DEFAULT_EFFECTS: SpringSpec = motionSprings.standard.defaultEffects\n/** MotionSchemeKeyTokens.DefaultSpatial in the Standard scheme */\nexport const DEFAULT_SPATIAL: SpringSpec = motionSprings.standard.defaultSpatial\n\nconst SUBSTEP = 0.004\n\nexport function useSpring(\n target: () => number[],\n apply: (values: readonly number[]) => void,\n spec: SpringSpec = FAST_SPATIAL,\n) {\n let current = [...target()]\n let velocity = current.map(() => 0)\n let raf = 0\n let last = 0\n\n function frame(now: number) {\n let dt = Math.min((now - last) / 1000, 1 / 30)\n last = now\n const t = target()\n if (t.length !== current.length) {\n current = [...t]\n velocity = t.map(() => 0)\n }\n const k = spec.stiffness\n const c = 2 * spec.dampingRatio * Math.sqrt(k)\n while (dt > 0) {\n const h = Math.min(dt, SUBSTEP)\n dt -= h\n for (let i = 0; i < t.length; i++) {\n velocity[i]! += (-k * (current[i]! - t[i]!) - c * velocity[i]!) * h\n current[i]! += velocity[i]! * h\n }\n }\n const settled = t.every((v, i) => Math.abs(v - current[i]!) < 0.05 && Math.abs(velocity[i]!) < 0.05)\n if (settled) {\n current = [...t]\n velocity = t.map(() => 0)\n }\n apply(current)\n raf = settled ? 0 : requestAnimationFrame(frame)\n }\n\n function start() {\n if (raf) return\n last = performance.now()\n raf = requestAnimationFrame(frame)\n }\n\n /** Jumps to the target without animating (e.g. when the layout context changes). */\n function snap() {\n cancelAnimationFrame(raf)\n raf = 0\n current = [...target()]\n velocity = current.map(() => 0)\n apply(current)\n }\n\n watch(() => target().join(','), start)\n onMounted(() => apply(current))\n onUnmounted(() => cancelAnimationFrame(raf))\n\n return { snap }\n}\n\n/** Compose's FastOutSlowInEasing, cubic-bezier(0.4, 0, 0.2, 1) — the easing of a default tween() */\nexport const fastOutSlowIn = cubicBezier(0.4, 0, 0.2, 1)\n","<script setup lang=\"ts\">\n/**\n * A button that shows only an icon — four visual styles, the same 5-tier expressive sizing as MButton. Give it\n * `checked` (v-model:checked) and it becomes M3's icon toggle button.\n *\n * @event update:checked Emitted on click when `checked` is set — powers v-model:checked\n */\nimport { computed, ref } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\nimport { DEFAULT_EFFECTS, useSpring } from '../composables/_useSpring'\n\nconst props = withDefaults(\n defineProps<{\n /** Material Symbol icon name */\n icon: string\n /** Accessible label (its aria-label; no visible tooltip: wrap it in MTooltip for one) */\n label?: string\n /** Visual style */\n variant?: 'standard' | 'filled' | 'tonal' | 'outlined'\n /**\n * An M3 role or any CSS color (`#fff` over a photo, `rgb(0 0 0 / 0.3)` for a scrim-like filled button,\n * `currentColor` to follow the surrounding text). Standard and outlined use it for the icon; filled for the\n * container with white (or the role's on-color) on it; tonal for a 20% container with the color on it.\n * Disabled buttons and toggles keep their own colors\n */\n color?: 'primary' | 'secondary' | 'tertiary' | 'error' | (string & {})\n /**\n * Icon color over what the variant and `color` give: an M3 role (`on-surface`…) or any CSS color (`#000` on a\n * white filled button). Disabled buttons and toggles keep their own\n */\n contentColor?: string\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 /** M3's 5-tier icon button sizing (xs:32, sm:40, md:56, lg:96, xl:136), or a custom pixel value */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number\n /** Disables interaction */\n disabled?: boolean\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 * Makes it a toggle button (v-model:checked): selected colors, a filled icon, and a shape that morphs when\n * pressed and when checked. Leave it unset for a plain icon button\n */\n checked?: boolean\n /** Icon shown while checked, when it differs from `icon` (e.g. 'pause' for 'play_arrow') */\n checkedIcon?: string\n /** Draw the icon filled (Material Symbols' FILL axis) without making it a toggle, e.g. media controls */\n iconFilled?: boolean\n }>(),\n {\n variant: 'standard',\n shape: 'rounded',\n size: 'sm',\n disabled: false,\n checked: undefined,\n },\n)\n\nconst emit = defineEmits<{ 'update:checked': [boolean] }>()\n\nconst isToggle = computed(() => props.checked !== undefined)\n\nconst ROLES = ['primary', 'secondary', 'tertiary', 'error']\n// Color-role names (`on-surface`…) 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 colorStyle = computed(() => {\n const base = paintStyle()\n const cc = props.contentColor\n if (!cc || props.disabled || isToggle.value) return base\n return { ...base, color: ROLE.test(cc) ? `var(--color-${cc})` : cc }\n})\n// `color` as inline styles over the variant's classes, so the default look stays class-only\nfunction paintStyle() {\n const c = props.color\n if (!c || props.disabled || isToggle.value) return undefined\n const role = ROLES.includes(c)\n const main = role ? `var(--color-${c})` : c\n switch (props.variant) {\n case 'filled':\n return { backgroundColor: main, color: role ? `var(--color-on-${c})` : '#fff' }\n case 'tonal':\n return role\n ? { backgroundColor: `var(--color-${c}-container)`, color: `var(--color-on-${c}-container)` }\n : { backgroundColor: `color-mix(in srgb, ${c} 20%, transparent)`, color: c }\n default:\n return { color: main }\n }\n}\nconst tag = computed(() => props.to && !isToggle.value ? 'RouterLink' : 'button')\n\n// Container height/width (icon buttons are always square by default — real\n// `IconButtonDefaults.<tier>ContainerSize()` also has Narrow/Wide width options not\n// implemented here, matching the existing scope of MButton's size tiers) and icon size\n// per M3's 5-tier `{XSmall,Small,Medium,Large,XLarge}IconButtonTokens.kt`. `squareRadius`\n// matches each tier's own `ContainerShapeSquare` (12px xs/sm, 16px md, 28px lg/xl) — same\n// pattern as MButton's size tiers.\n// Toggle radii (px) from the same token files: `square` is ContainerShapeSquare, `pressed`\n// PressedContainerShape, `checkedRound` SelectedContainerShapeRound (a round button squares off when\n// checked); SelectedContainerShapeSquare is CornerFull (a square one turns round), i.e. px / 2.\nconst sizeMap = {\n xs: { px: 32, icon: 20, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },\n sm: { px: 40, icon: 24, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },\n md: { px: 56, icon: 24, squareRadius: 'rounded-lg', square: 16, pressed: 12, checkedRound: 16 },\n lg: { px: 96, icon: 32, squareRadius: 'rounded-xl', square: 28, pressed: 16, checkedRound: 28 },\n xl: { px: 136, icon: 40, squareRadius: 'rounded-xl', square: 28, pressed: 16, checkedRound: 28 },\n}\n\nconst resolved = computed(() => {\n if (typeof props.size === 'number') {\n return { px: props.size, icon: Math.round(props.size * 0.55), squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 }\n }\n return sizeMap[props.size] ?? sizeMap.sm\n})\n\n// Icon toggle shape morph (IconButton.kt's shapeByInteraction: pressed, else checked, else the resting\n// shape), on the DefaultEffects spring the source picks so it doesn't bounce. Plain icon buttons keep\n// a static shape, like Compose's non-`shapes` overloads.\nconst rootEl = ref<unknown>(null)\nconst pressed = ref(false)\n\nfunction targetRadius() {\n const r = resolved.value\n const full = r.px / 2\n if (pressed.value) return r.pressed\n if (props.checked) return props.shape === 'squared' ? full : r.checkedRound\n return props.shape === 'squared' ? r.square : full\n}\n\nuseSpring(\n () => (isToggle.value ? [targetRadius()] : []),\n (v) => {\n // A RouterLink root (plain button with `to`) is a component instance, not an element\n if (rootEl.value instanceof HTMLElement) rootEl.value.style.borderRadius = v.length ? `${v[0]}px` : ''\n },\n DEFAULT_EFFECTS,\n)\n\nfunction onPointerDown() {\n if (isToggle.value && !props.disabled) pressed.value = true\n}\nfunction onPointerUp() {\n pressed.value = false\n}\n\nfunction onClick() {\n if (isToggle.value && !props.disabled) emit('update:checked', !props.checked)\n}\n\n/*\n * State layer via a `before:` overlay (same technique MButton uses) rather than a direct\n * `hover:bg-*`/`active:bg-*` utility: a solid `bg-primary`/`bg-secondary-container`\n * container can't also swap to a translucent hover background without just replacing the\n * color outright, so hover/press need a separate semi-transparent layer painted on top,\n * tinted with the button's own content color (`before:bg-current`) — matches real M3's\n * per-variant Hovered/PressedColor tokens, which are all just the content color at a fixed\n * opacity (8%/12%), the same universal state-layer pattern across every variant.\n */\nconst base =\n 'relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150 cursor-pointer ' +\n 'disabled:cursor-not-allowed 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 container opacity is 10% on-surface (DisabledContainerOpacity, Filled/Tonal\n// only — Outlined has no container). Outlined's border needs no separate disabled class:\n// it's `border-current` (see `variantClasses`), so it dims automatically along with the\n// `disabled:text-on-surface/38` in `base` above, exactly like the real `outlinedIconButtonBorder`\n// (which literally reuses `LocalContentColor` at the same disabled opacity as the icon).\nconst disabledContainerClasses = computed(() => {\n if (props.variant === 'outlined' && props.checked) return 'disabled:bg-on-surface/10'\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n return 'disabled:bg-on-surface/10'\n default:\n return ''\n }\n})\n\nconst shapeClass = computed(() => props.shape === 'squared' ? resolved.value.squareRadius : 'rounded-full')\n\n\n// Toggle colors: the Selected*/Unselected* tokens of each variant's *IconButtonTokens. Unchecked\n// filled/tonal differ from the plain button's colors, so the checked state stands out.\nconst toggleClasses = computed(() => {\n const on = props.checked\n switch (props.variant) {\n case 'filled':\n return on ? 'bg-primary text-on-primary' : 'bg-surface-container text-on-surface-variant'\n case 'tonal':\n return on ? 'bg-secondary text-on-secondary' : 'bg-secondary-container text-on-secondary-container'\n case 'outlined':\n // outlinedIconToggleButtonBorder: no border once checked\n return on ? 'bg-inverse-surface text-inverse-on-surface' : 'border border-current text-on-surface-variant'\n default:\n return on ? 'text-primary' : 'text-on-surface-variant'\n }\n})\n\nconst variantClasses = computed(() => {\n if (isToggle.value) return toggleClasses.value\n switch (props.variant) {\n case 'filled':\n // Real IconButton.kt has no elevation tokens at all for any variant — flat, unlike Button\n return 'bg-primary text-on-primary'\n case 'tonal':\n return 'bg-secondary-container text-on-secondary-container'\n case 'outlined':\n // OutlinedIconButtonTokens' default (non-\"vibrant\") border tracks LocalContentColor,\n // i.e. the same on-surface-variant used for the icon itself — not a fixed outline token\n return 'border border-current text-on-surface-variant'\n default:\n return 'text-on-surface-variant'\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n ref=\"rootEl\"\n :to=\"tag === 'RouterLink' ? to : undefined\"\n :type=\"tag === 'RouterLink' ? undefined : 'button'\"\n :aria-label=\"label || undefined\"\n :aria-pressed=\"isToggle ? checked : undefined\"\n :disabled=\"disabled\"\n :class=\"[base, shapeClass, variantClasses, disabledContainerClasses]\"\n :style=\"[{ width: `${resolved.px}px`, height: `${resolved.px}px` }, colorStyle]\"\n v-ripple=\"{ disabled, color: rippleColor }\"\n @pointerdown=\"onPointerDown\"\n @pointerup=\"onPointerUp\"\n @pointerleave=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @click=\"onClick\"\n >\n <MIcon :name=\"checked && checkedIcon ? checkedIcon : icon\" :size=\"resolved.icon\" :filled=\"!!checked || iconFilled\" />\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A button that shows only an icon — four visual styles, the same 5-tier expressive sizing as MButton. Give it\n * `checked` (v-model:checked) and it becomes M3's icon toggle button.\n *\n * @event update:checked Emitted on click when `checked` is set — powers v-model:checked\n */\nimport { computed, ref } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\nimport { DEFAULT_EFFECTS, useSpring } from '../composables/_useSpring'\n\nconst props = withDefaults(\n defineProps<{\n /** Material Symbol icon name */\n icon: string\n /** Accessible label (its aria-label; no visible tooltip: wrap it in MTooltip for one) */\n label?: string\n /** Visual style */\n variant?: 'standard' | 'filled' | 'tonal' | 'outlined'\n /**\n * An M3 role or any CSS color (`#fff` over a photo, `rgb(0 0 0 / 0.3)` for a scrim-like filled button,\n * `currentColor` to follow the surrounding text). Standard and outlined use it for the icon; filled for the\n * container with white (or the role's on-color) on it; tonal for a 20% container with the color on it.\n * Disabled buttons and toggles keep their own colors\n */\n color?: 'primary' | 'secondary' | 'tertiary' | 'error' | (string & {})\n /**\n * Icon color over what the variant and `color` give: an M3 role (`on-surface`…) or any CSS color (`#000` on a\n * white filled button). Disabled buttons and toggles keep their own\n */\n contentColor?: string\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 /** M3's 5-tier icon button sizing (xs:32, sm:40, md:56, lg:96, xl:136), or a custom pixel value */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number\n /** Disables interaction */\n disabled?: boolean\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 * Makes it a toggle button (v-model:checked): selected colors, a filled icon, and a shape that morphs when\n * pressed and when checked. Leave it unset for a plain icon button\n */\n checked?: boolean\n /** Icon shown while checked, when it differs from `icon` (e.g. 'pause' for 'play_arrow') */\n checkedIcon?: string\n /** Draw the icon filled (Material Symbols' FILL axis) without making it a toggle, e.g. media controls */\n iconFilled?: boolean\n }>(),\n {\n variant: 'standard',\n shape: 'rounded',\n size: 'sm',\n disabled: false,\n checked: undefined,\n },\n)\n\nconst emit = defineEmits<{ 'update:checked': [boolean] }>()\n\nconst isToggle = computed(() => props.checked !== undefined)\n\nconst ROLES = ['primary', 'secondary', 'tertiary', 'error']\n// Color-role names (`on-surface`…) 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 colorStyle = computed(() => {\n const base = paintStyle()\n const cc = props.contentColor\n if (!cc || props.disabled || isToggle.value) return base\n return { ...base, color: ROLE.test(cc) ? `var(--color-${cc})` : cc }\n})\n// `color` as inline styles over the variant's classes, so the default look stays class-only\nfunction paintStyle() {\n const c = props.color\n if (!c || props.disabled || isToggle.value) return undefined\n const role = ROLES.includes(c)\n const main = role ? `var(--color-${c})` : c\n switch (props.variant) {\n case 'filled':\n return { backgroundColor: main, color: role ? `var(--color-on-${c})` : '#fff' }\n case 'tonal':\n return role\n ? { backgroundColor: `var(--color-${c}-container)`, color: `var(--color-on-${c}-container)` }\n : { backgroundColor: `color-mix(in srgb, ${c} 20%, transparent)`, color: c }\n default:\n return { color: main }\n }\n}\nconst tag = computed(() => props.to && !isToggle.value ? 'RouterLink' : 'button')\n\n// Container height/width (icon buttons are always square by default — real\n// `IconButtonDefaults.<tier>ContainerSize()` also has Narrow/Wide width options not\n// implemented here, matching the existing scope of MButton's size tiers) and icon size\n// per M3's 5-tier `{XSmall,Small,Medium,Large,XLarge}IconButtonTokens.kt`. `squareRadius`\n// matches each tier's own `ContainerShapeSquare` (12px xs/sm, 16px md, 28px lg/xl) — same\n// pattern as MButton's size tiers.\n// Toggle radii (px) from the same token files: `square` is ContainerShapeSquare, `pressed`\n// PressedContainerShape, `checkedRound` SelectedContainerShapeRound (a round button squares off when\n// checked); SelectedContainerShapeSquare is CornerFull (a square one turns round), i.e. px / 2.\nconst sizeMap = {\n xs: { px: 32, icon: 20, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },\n sm: { px: 40, icon: 24, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },\n md: { px: 56, icon: 24, squareRadius: 'rounded-lg', square: 16, pressed: 12, checkedRound: 16 },\n lg: { px: 96, icon: 32, squareRadius: 'rounded-xl', square: 28, pressed: 16, checkedRound: 28 },\n xl: { px: 136, icon: 40, squareRadius: 'rounded-xl', square: 28, pressed: 16, checkedRound: 28 },\n}\n\nconst resolved = computed(() => {\n if (typeof props.size === 'number') {\n return { px: props.size, icon: Math.round(props.size * 0.55), squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 }\n }\n return sizeMap[props.size] ?? sizeMap.sm\n})\n\n// Icon toggle shape morph (IconButton.kt's shapeByInteraction: pressed, else checked, else the resting\n// shape), on the DefaultEffects spring the source picks so it doesn't bounce. Plain icon buttons keep\n// a static shape, like Compose's non-`shapes` overloads.\nconst rootEl = ref<unknown>(null)\nconst pressed = ref(false)\n\nfunction targetRadius() {\n const r = resolved.value\n const full = r.px / 2\n if (pressed.value) return r.pressed\n if (props.checked) return props.shape === 'squared' ? full : r.checkedRound\n return props.shape === 'squared' ? r.square : full\n}\n\nuseSpring(\n () => (isToggle.value ? [targetRadius()] : []),\n (v) => {\n // A RouterLink root (plain button with `to`) is a component instance, not an element\n if (rootEl.value instanceof HTMLElement) rootEl.value.style.borderRadius = v.length ? `${v[0]}px` : ''\n },\n DEFAULT_EFFECTS,\n)\n\nfunction onPointerDown() {\n if (isToggle.value && !props.disabled) pressed.value = true\n}\nfunction onPointerUp() {\n pressed.value = false\n}\n\nfunction onClick() {\n if (isToggle.value && !props.disabled) emit('update:checked', !props.checked)\n}\n\n/*\n * State layer via a `before:` overlay (same technique MButton uses) rather than a direct\n * `hover:bg-*`/`active:bg-*` utility: a solid `bg-primary`/`bg-secondary-container`\n * container can't also swap to a translucent hover background without just replacing the\n * color outright, so hover/press need a separate semi-transparent layer painted on top,\n * tinted with the button's own content color (`before:bg-current`) — matches real M3's\n * per-variant Hovered/PressedColor tokens, which are all just the content color at a fixed\n * opacity (8%/12%), the same universal state-layer pattern across every variant.\n */\nconst base =\n 'relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150 cursor-pointer ' +\n 'disabled:cursor-not-allowed 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 container opacity is 10% on-surface (DisabledContainerOpacity, Filled/Tonal\n// only — Outlined has no container). Outlined's border needs no separate disabled class:\n// it's `border-current` (see `variantClasses`), so it dims automatically along with the\n// `disabled:text-on-surface/38` in `base` above, exactly like the real `outlinedIconButtonBorder`\n// (which literally reuses `LocalContentColor` at the same disabled opacity as the icon).\nconst disabledContainerClasses = computed(() => {\n if (props.variant === 'outlined' && props.checked) return 'disabled:bg-on-surface/10'\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n return 'disabled:bg-on-surface/10'\n default:\n return ''\n }\n})\n\nconst shapeClass = computed(() => props.shape === 'squared' ? resolved.value.squareRadius : 'rounded-full')\n\n\n// Toggle colors: the Selected*/Unselected* tokens of each variant's *IconButtonTokens. Unchecked\n// filled/tonal differ from the plain button's colors, so the checked state stands out.\nconst toggleClasses = computed(() => {\n const on = props.checked\n switch (props.variant) {\n case 'filled':\n return on ? 'bg-primary text-on-primary' : 'bg-surface-container text-on-surface-variant'\n case 'tonal':\n return on ? 'bg-secondary text-on-secondary' : 'bg-secondary-container text-on-secondary-container'\n case 'outlined':\n // outlinedIconToggleButtonBorder: no border once checked\n return on ? 'bg-inverse-surface text-inverse-on-surface' : 'border border-current text-on-surface-variant'\n default:\n return on ? 'text-primary' : 'text-on-surface-variant'\n }\n})\n\nconst variantClasses = computed(() => {\n if (isToggle.value) return toggleClasses.value\n switch (props.variant) {\n case 'filled':\n // Real IconButton.kt has no elevation tokens at all for any variant — flat, unlike Button\n return 'bg-primary text-on-primary'\n case 'tonal':\n return 'bg-secondary-container text-on-secondary-container'\n case 'outlined':\n // OutlinedIconButtonTokens' default (non-\"vibrant\") border tracks LocalContentColor,\n // i.e. the same on-surface-variant used for the icon itself — not a fixed outline token\n return 'border border-current text-on-surface-variant'\n default:\n return 'text-on-surface-variant'\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n ref=\"rootEl\"\n :to=\"tag === 'RouterLink' ? to : undefined\"\n :type=\"tag === 'RouterLink' ? undefined : 'button'\"\n :aria-label=\"label || undefined\"\n :aria-pressed=\"isToggle ? checked : undefined\"\n :disabled=\"disabled\"\n :class=\"[base, shapeClass, variantClasses, disabledContainerClasses]\"\n :style=\"[{ width: `${resolved.px}px`, height: `${resolved.px}px` }, colorStyle]\"\n v-ripple=\"{ disabled, color: rippleColor }\"\n @pointerdown=\"onPointerDown\"\n @pointerup=\"onPointerUp\"\n @pointerleave=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n @click=\"onClick\"\n >\n <MIcon :name=\"checked && checkedIcon ? checkedIcon : icon\" :size=\"resolved.icon\" :filled=\"!!checked || iconFilled\" />\n </component>\n</template>\n","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","<script setup lang=\"ts\">\n/**\n * The standard single- or multi-line text input, filled or outlined, with floating label.\n *\n * @slot trailing Custom trailing content (e.g. an icon button) — replaces the built-in clear button when\n * present\n * @event update:modelValue Emitted on every keystroke — powers v-model\n * @event debounced Emitted debounce ms after the user stops typing (only when debounce > 0)\n */\nimport { computed, ref, useId, useSlots } from \"vue\";\nimport MIcon from \"./MIcon.vue\";\nimport { useAutoGrow } from \"../composables/useAutoGrow\";\nimport { useFieldBg } from \"../composables/useFieldBg\";\nimport { useDebounce } from \"../composables/useDebounce\";\nimport { useLocale } from '../composables/useLocale'\n\nconst locale = useLocale()\nconst props = withDefaults(\n defineProps<{\n /** Bound value (v-model) */\n modelValue: string | number;\n /** Field label */\n label: string;\n /** HTML input type */\n type?: string;\n /** Visual style */\n variant?: \"filled\" | \"outlined\";\n /** Puts the field in error state (red border and label) */\n error?: boolean;\n /** Error message shown below the field (only visible when error is true) */\n errorLabel?: string;\n /** Hint text shown below the field */\n hint?: string;\n /** Disables the field */\n disabled?: boolean;\n /** Marks as required — adds a red asterisk after the label */\n required?: boolean;\n /** Renders a textarea instead of an input */\n multiline?: boolean;\n /** Textarea rows (when multiline); with autoGrow, the fewest it shrinks to */\n rows?: number;\n /** Multiline only: grows with the text from `rows` up to `maxRows`, instead of a fixed height with a drag handle */\n autoGrow?: boolean;\n /** With autoGrow, the most rows it grows to before scrolling. Unset grows without limit */\n maxRows?: number;\n /** Passed through to the native autocomplete attribute */\n autocomplete?: string;\n /** Material Symbol shown before the input */\n leadingIcon?: string;\n /** Show a clear button when the field has a value */\n clearable?: boolean;\n /**\n * Overrides the auto-detected background color used to cut the floating label out of the outlined border\n */\n fieldBg?: string;\n /** Delay (ms) before firing the @debounced event. v-model always updates immediately */\n debounce?: number;\n }>(),\n {\n type: \"text\",\n variant: \"filled\",\n rows: 3,\n clearable: false,\n debounce: 0,\n },\n);\n\nconst emit = defineEmits<{ \"update:modelValue\": [string]; debounced: [string] }>();\n\nconst id = useId();\nconst slots = useSlots();\n\nconst fieldBgEl = ref<HTMLElement | null>(null);\nconst { resolvedFieldBg } = useFieldBg(fieldBgEl, () => props.fieldBg);\n\nconst { debounced: emitDebounced, cancel: cancelDebounce } = useDebounce((v: string) => emit(\"debounced\", v), props.debounce)\n\nconst textareaEl = ref<HTMLTextAreaElement | null>(null);\nuseAutoGrow(() => (props.multiline && props.autoGrow ? textareaEl.value : null), {\n minRows: () => props.rows,\n maxRows: () => props.maxRows,\n value: () => props.modelValue,\n});\n\nconst showClear = computed(() => props.clearable && String(props.modelValue).length > 0 && !props.disabled)\n\nconst inputClasses = computed(() => {\n const hasTrailing = !!slots.trailing || props.clearable;\n const pl = props.leadingIcon ? \"pl-12\" : \"pl-4\";\n const pr = hasTrailing ? \"pr-12\" : \"pr-4\";\n const size = props.multiline ? (props.autoGrow ? \"resize-none min-h-[56px]\" : \"resize-y min-h-[56px]\") : \"h-14\";\n const base = [\n \"peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent\",\n \"transition-[border-color,border-width] duration-150\",\n \"disabled:cursor-not-allowed disabled:text-on-surface/38\",\n props.error ? \"caret-error\" : \"caret-primary\",\n size,\n pl,\n pr,\n ];\n\n if (props.variant === \"outlined\") {\n return [\n ...base,\n \"rounded-xs border bg-transparent py-4\",\n props.error\n ? \"border-error focus:border-2 focus:border-error\"\n : \"border-outline hover:border-on-surface focus:border-2 focus:border-primary\",\n \"disabled:border-on-surface/12\",\n ].join(\" \");\n }\n\n return [\n ...base,\n // Multiline: the label's 24px band is a transparent top border rather than padding, so text scrolled up is\n // clipped below the label (at the padding box) instead of running behind it; the background still fills it\n props.multiline\n ? \"rounded-t-xs bg-surface-container-highest border-b border-t-24 border-t-transparent pb-2\"\n : \"rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2\",\n props.error\n ? \"border-b-error focus:border-b-2 focus:border-b-error\"\n : \"border-b-on-surface-variant hover:border-b-on-surface focus:border-b-2 focus:border-b-primary\",\n \"disabled:border-b-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]\",\n ].join(\" \");\n});\n\nconst labelClasses = computed(() => {\n const left = props.leadingIcon\n ? props.variant === \"outlined\"\n ? \"left-11\"\n : \"left-12\"\n : props.variant === \"outlined\"\n ? \"left-3\"\n : \"left-4\";\n\n const unfloatedTop = props.variant === 'filled' ? 'top-[53%]' : 'top-1/2'\n const base = [\n \"pointer-events-none absolute truncate transition-all duration-200\",\n left,\n \"right-4\",\n `${unfloatedTop} -translate-y-1/2 text-body-large`,\n ];\n\n if (props.variant === \"outlined\") {\n // When floated: drop right-4 (right-auto) and cap max-width so the label\n // shrinks to its own text width. The bg then only covers the glyphs + px-1,\n // cutting the border just where the text sits instead of a long strip.\n return [\n ...base,\n \"peer-focus:-top-2.5 peer-focus:translate-y-0 peer-focus:text-label-small peer-focus:right-auto peer-focus:max-w-[calc(100%-1.5rem)] peer-focus:bg-[var(--field-bg)] peer-focus:px-1\",\n \"peer-[&:not(:placeholder-shown)]:-top-2.5 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:right-auto peer-[&:not(:placeholder-shown)]:max-w-[calc(100%-1.5rem)]\",\n \"peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1\",\n props.error\n ? \"text-error peer-focus:text-error\"\n : \"text-on-surface-variant peer-focus:text-primary\",\n \"peer-disabled:text-on-surface/38\",\n ].join(\" \");\n }\n\n // Filled: label floats to top-2 (slightly higher than before)\n return [\n ...base,\n \"peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small\",\n \"peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small\",\n props.error\n ? \"text-error peer-focus:text-error\"\n : \"text-on-surface-variant peer-focus:text-primary\",\n \"peer-disabled:text-on-surface/38\",\n ].join(\" \");\n});\n\nfunction onInput(event: Event) {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n emit(\"update:modelValue\", target.value);\n if (props.debounce > 0) emitDebounced(target.value)\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1\">\n <!--\n --field-bg: background behind the floating label in outlined mode, so it\n \"cuts through\" the border. Auto-detected from the nearest opaque ancestor\n (see resolveBg); overridable via the fieldBg prop; falls back to surface.\n -->\n <div\n ref=\"fieldBgEl\"\n class=\"relative\"\n :class=\"variant === 'outlined' ? 'mt-2' : ''\"\n :style=\"variant === 'outlined' ? { '--field-bg': resolvedFieldBg } : undefined\"\n >\n <div\n v-if=\"leadingIcon\"\n class=\"pointer-events-none absolute left-3.5\"\n :class=\"[\n multiline ? 'top-[55%] -translate-y-1/2' : variant === 'filled' ? 'top-4.5' : 'top-4',\n disabled ? 'text-on-surface/38' : 'text-on-surface-variant',\n ]\"\n >\n <MIcon :name=\"leadingIcon\" :size=\"24\" />\n </div>\n\n <textarea\n v-if=\"multiline\"\n ref=\"textareaEl\"\n :id=\"id\"\n :value=\"String(modelValue)\"\n :rows=\"rows\"\n :disabled=\"disabled\"\n :required=\"required\"\n placeholder=\" \"\n :class=\"inputClasses\"\n @input=\"onInput\"\n />\n <input\n v-else\n :id=\"id\"\n :type=\"type\"\n :value=\"modelValue\"\n :disabled=\"disabled\"\n :required=\"required\"\n :autocomplete=\"autocomplete\"\n placeholder=\" \"\n :class=\"inputClasses\"\n @input=\"onInput\"\n />\n\n <label :for=\"id\" :class=\"labelClasses\">\n {{ label }}<span v-if=\"required\" class=\"text-error\"> *</span>\n </label>\n\n <div v-if=\"$slots.trailing\" class=\"absolute right-2 top-1/2 -translate-y-1/2\">\n <slot name=\"trailing\" />\n </div>\n <button\n :aria-label=\"locale.clear\"\n v-else-if=\"showClear\"\n type=\"button\"\n class=\"absolute right-3 top-1/2 -translate-y-1/2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-on-surface-variant transition-colors hover:bg-on-surface/8 hover:text-on-surface\"\n @click=\"cancelDebounce(); emit('update:modelValue', '')\"\n >\n <MIcon name=\"close\" :size=\"18\" />\n </button>\n </div>\n\n <p v-if=\"error && errorLabel\" class=\"px-4 text-body-small text-error\">{{ errorLabel }}</p>\n <p v-else-if=\"hint\" class=\"px-4 text-body-small text-on-surface-variant\">{{ hint }}</p>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The standard single- or multi-line text input, filled or outlined, with floating label.\n *\n * @slot trailing Custom trailing content (e.g. an icon button) — replaces the built-in clear button when\n * present\n * @event update:modelValue Emitted on every keystroke — powers v-model\n * @event debounced Emitted debounce ms after the user stops typing (only when debounce > 0)\n */\nimport { computed, ref, useId, useSlots } from \"vue\";\nimport MIcon from \"./MIcon.vue\";\nimport { useAutoGrow } from \"../composables/useAutoGrow\";\nimport { useFieldBg } from \"../composables/useFieldBg\";\nimport { useDebounce } from \"../composables/useDebounce\";\nimport { useLocale } from '../composables/useLocale'\n\nconst locale = useLocale()\nconst props = withDefaults(\n defineProps<{\n /** Bound value (v-model) */\n modelValue: string | number;\n /** Field label */\n label: string;\n /** HTML input type */\n type?: string;\n /** Visual style */\n variant?: \"filled\" | \"outlined\";\n /** Puts the field in error state (red border and label) */\n error?: boolean;\n /** Error message shown below the field (only visible when error is true) */\n errorLabel?: string;\n /** Hint text shown below the field */\n hint?: string;\n /** Disables the field */\n disabled?: boolean;\n /** Marks as required — adds a red asterisk after the label */\n required?: boolean;\n /** Renders a textarea instead of an input */\n multiline?: boolean;\n /** Textarea rows (when multiline); with autoGrow, the fewest it shrinks to */\n rows?: number;\n /** Multiline only: grows with the text from `rows` up to `maxRows`, instead of a fixed height with a drag handle */\n autoGrow?: boolean;\n /** With autoGrow, the most rows it grows to before scrolling. Unset grows without limit */\n maxRows?: number;\n /** Passed through to the native autocomplete attribute */\n autocomplete?: string;\n /** Material Symbol shown before the input */\n leadingIcon?: string;\n /** Show a clear button when the field has a value */\n clearable?: boolean;\n /**\n * Overrides the auto-detected background color used to cut the floating label out of the outlined border\n */\n fieldBg?: string;\n /** Delay (ms) before firing the @debounced event. v-model always updates immediately */\n debounce?: number;\n }>(),\n {\n type: \"text\",\n variant: \"filled\",\n rows: 3,\n clearable: false,\n debounce: 0,\n },\n);\n\nconst emit = defineEmits<{ \"update:modelValue\": [string]; debounced: [string] }>();\n\nconst id = useId();\nconst slots = useSlots();\n\nconst fieldBgEl = ref<HTMLElement | null>(null);\nconst { resolvedFieldBg } = useFieldBg(fieldBgEl, () => props.fieldBg);\n\nconst { debounced: emitDebounced, cancel: cancelDebounce } = useDebounce((v: string) => emit(\"debounced\", v), props.debounce)\n\nconst textareaEl = ref<HTMLTextAreaElement | null>(null);\nuseAutoGrow(() => (props.multiline && props.autoGrow ? textareaEl.value : null), {\n minRows: () => props.rows,\n maxRows: () => props.maxRows,\n value: () => props.modelValue,\n});\n\nconst showClear = computed(() => props.clearable && String(props.modelValue).length > 0 && !props.disabled)\n\nconst inputClasses = computed(() => {\n const hasTrailing = !!slots.trailing || props.clearable;\n const pl = props.leadingIcon ? \"pl-12\" : \"pl-4\";\n const pr = hasTrailing ? \"pr-12\" : \"pr-4\";\n const size = props.multiline ? (props.autoGrow ? \"resize-none min-h-[56px]\" : \"resize-y min-h-[56px]\") : \"h-14\";\n const base = [\n \"peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent\",\n \"transition-[border-color,border-width] duration-150\",\n \"disabled:cursor-not-allowed disabled:text-on-surface/38\",\n props.error ? \"caret-error\" : \"caret-primary\",\n size,\n pl,\n pr,\n ];\n\n if (props.variant === \"outlined\") {\n return [\n ...base,\n \"rounded-xs border bg-transparent py-4\",\n props.error\n ? \"border-error focus:border-2 focus:border-error\"\n : \"border-outline hover:border-on-surface focus:border-2 focus:border-primary\",\n \"disabled:border-on-surface/12\",\n ].join(\" \");\n }\n\n return [\n ...base,\n // Multiline: the label's 24px band is a transparent top border rather than padding, so text scrolled up is\n // clipped below the label (at the padding box) instead of running behind it; the background still fills it\n props.multiline\n ? \"rounded-t-xs bg-surface-container-highest border-b border-t-24 border-t-transparent pb-2\"\n : \"rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2\",\n props.error\n ? \"border-b-error focus:border-b-2 focus:border-b-error\"\n : \"border-b-on-surface-variant hover:border-b-on-surface focus:border-b-2 focus:border-b-primary\",\n \"disabled:border-b-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]\",\n ].join(\" \");\n});\n\nconst labelClasses = computed(() => {\n const left = props.leadingIcon\n ? props.variant === \"outlined\"\n ? \"left-11\"\n : \"left-12\"\n : props.variant === \"outlined\"\n ? \"left-3\"\n : \"left-4\";\n\n const unfloatedTop = props.variant === 'filled' ? 'top-[53%]' : 'top-1/2'\n const base = [\n \"pointer-events-none absolute truncate transition-all duration-200\",\n left,\n \"right-4\",\n `${unfloatedTop} -translate-y-1/2 text-body-large`,\n ];\n\n if (props.variant === \"outlined\") {\n // When floated: drop right-4 (right-auto) and cap max-width so the label\n // shrinks to its own text width. The bg then only covers the glyphs + px-1,\n // cutting the border just where the text sits instead of a long strip.\n return [\n ...base,\n \"peer-focus:-top-2.5 peer-focus:translate-y-0 peer-focus:text-label-small peer-focus:right-auto peer-focus:max-w-[calc(100%-1.5rem)] peer-focus:bg-[var(--field-bg)] peer-focus:px-1\",\n \"peer-[&:not(:placeholder-shown)]:-top-2.5 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:right-auto peer-[&:not(:placeholder-shown)]:max-w-[calc(100%-1.5rem)]\",\n \"peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1\",\n props.error\n ? \"text-error peer-focus:text-error\"\n : \"text-on-surface-variant peer-focus:text-primary\",\n \"peer-disabled:text-on-surface/38\",\n ].join(\" \");\n }\n\n // Filled: label floats to top-2 (slightly higher than before)\n return [\n ...base,\n \"peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small\",\n \"peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small\",\n props.error\n ? \"text-error peer-focus:text-error\"\n : \"text-on-surface-variant peer-focus:text-primary\",\n \"peer-disabled:text-on-surface/38\",\n ].join(\" \");\n});\n\nfunction onInput(event: Event) {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n emit(\"update:modelValue\", target.value);\n if (props.debounce > 0) emitDebounced(target.value)\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1\">\n <!--\n --field-bg: background behind the floating label in outlined mode, so it\n \"cuts through\" the border. Auto-detected from the nearest opaque ancestor\n (see resolveBg); overridable via the fieldBg prop; falls back to surface.\n -->\n <div\n ref=\"fieldBgEl\"\n class=\"relative\"\n :class=\"variant === 'outlined' ? 'mt-2' : ''\"\n :style=\"variant === 'outlined' ? { '--field-bg': resolvedFieldBg } : undefined\"\n >\n <div\n v-if=\"leadingIcon\"\n class=\"pointer-events-none absolute left-3.5\"\n :class=\"[\n multiline ? 'top-[55%] -translate-y-1/2' : variant === 'filled' ? 'top-4.5' : 'top-4',\n disabled ? 'text-on-surface/38' : 'text-on-surface-variant',\n ]\"\n >\n <MIcon :name=\"leadingIcon\" :size=\"24\" />\n </div>\n\n <textarea\n v-if=\"multiline\"\n ref=\"textareaEl\"\n :id=\"id\"\n :value=\"String(modelValue)\"\n :rows=\"rows\"\n :disabled=\"disabled\"\n :required=\"required\"\n placeholder=\" \"\n :class=\"inputClasses\"\n @input=\"onInput\"\n />\n <input\n v-else\n :id=\"id\"\n :type=\"type\"\n :value=\"modelValue\"\n :disabled=\"disabled\"\n :required=\"required\"\n :autocomplete=\"autocomplete\"\n placeholder=\" \"\n :class=\"inputClasses\"\n @input=\"onInput\"\n />\n\n <label :for=\"id\" :class=\"labelClasses\">\n {{ label }}<span v-if=\"required\" class=\"text-error\"> *</span>\n </label>\n\n <div v-if=\"$slots.trailing\" class=\"absolute right-2 top-1/2 -translate-y-1/2\">\n <slot name=\"trailing\" />\n </div>\n <button\n :aria-label=\"locale.clear\"\n v-else-if=\"showClear\"\n type=\"button\"\n class=\"absolute right-3 top-1/2 -translate-y-1/2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-on-surface-variant transition-colors hover:bg-on-surface/8 hover:text-on-surface\"\n @click=\"cancelDebounce(); emit('update:modelValue', '')\"\n >\n <MIcon name=\"close\" :size=\"18\" />\n </button>\n </div>\n\n <p v-if=\"error && errorLabel\" class=\"px-4 text-body-small text-error\">{{ errorLabel }}</p>\n <p v-else-if=\"hint\" class=\"px-4 text-body-small text-on-surface-variant\">{{ hint }}</p>\n </div>\n</template>\n"],"mappings":";;;;;AAaA,SAAS,EAAU,GAAmC;CAIpD,OAHI,MAAU,KAAc,EAAE,UAAU,GAAK,IACzC,OAAO,KAAU,WAAiB,EAAE,OAAO,EAAM,IACjD,MAAU,MAAQ,KAAS,OAAa,CAAC,IACtC;AACT;AAIA,SAAS,EAAY,GAAmB,GAA6C,GAAgB;CACnG,IAAM,IAAO,EAAK,sBAAsB,GAClC,IAAI,KAAK,IAAI,EAAK,OAAO,EAAK,MAAM,IAAI,GACxC,IAAQ,SAAS,cAAc,MAAM;CAC3C,EAAM,YAAY;CAClB,IAAM,IAAK,SAAS,cAAc,MAAM;CAMxC,AALA,EAAG,YAAY,aACf,EAAG,MAAM,UAAU,SAAS,EAAE,YAAY,EAAE,SAAS,EAAM,UAAU,EAAK,MAAM,IAAI,EAAE,UAAU,EAAM,UAAU,EAAK,OAAO,IAAI,EAAE,KAC9H,MAAO,EAAG,MAAM,aAAa,IACjC,EAAM,YAAY,CAAE,GACpB,EAAK,YAAY,CAAK,GACtB,EAAG,iBAAiB,sBAAsB,EAAM,OAAO,GAAG,EAAE,MAAM,GAAK,CAAC;AAC1E;AAOA,IAAM,oBAAS,IAAI,QAAkC,GAOxC,IAA+C;CAC1D,QAAQ,GAAI,GAAS;EACnB,IAAM,IAAqB;GACzB,SAAS,EAAU,EAAQ,KAAK;GAChC,cAAc,GAAG;IACf,IAAI,EAAM,QAAQ,YAAY,EAAE,WAAW,GAAG;IAE9C,IAAM,EAAE,gBAAa,iBAAiB,CAAE;IAExC,CADI,CAAC,KAAY,MAAa,cAAU,EAAG,MAAM,WAAW,aAC5D,EAAY,GAAI,GAAG,EAAM,QAAQ,KAAK;GACxC;EACF;EAEA,AADA,EAAO,IAAI,GAAI,CAAK,GACpB,EAAG,iBAAiB,eAAe,EAAM,aAAa;CACxD;CACA,QAAQ,G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AZ,EAAA,GAAA,EAAuD,QAAvD,GAAyC,OAAO,KAAA,EAAA,IAAA,EAAA,CAAA,GAAA,IAAA,EAAA;GAGlDA,EAAAA,OAAO,YAAlB,EAAA,GAAA,EAEM,OAFN,IAEM,CADJ,EAAwB,EAAA,QAAA,UAAA,CAAA,CAAA,KAIb,EAAA,SAFb,EAAA,GAAA,EAQS,UAAA;;IAPN,cAAY,EAAA,CAAA,CAAM,CAAC;IAEpB,MAAK;IACL,OAAM;IACL,SAAK,AAAA,EAAA,QAAA,MAAA;KAAoB,AAAlB,EAAA,CAAA,CAAc,CAAA,GAAI,EAAI,qBAAA,EAAA;IAAA;GAE9B,GAAA,CAAA,EAAiC,GAAA;IAA1B,MAAK;IAAS,MAAM;;EAItB,GAAA,CAAA,GAAA,EAAA,SAAS,EAAA,cAAlB,EAAA,GAAA,EAA0F,KAA1F,IAA0F,EAAjB,EAAA,UAAU,GAAA,CAAA,KACrE,EAAA,QAAd,EAAA,GAAA,EAAuF,KAAvF,IAAuF,EAAX,EAAA,IAAI,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale-JYxDDeXC.js","names":[],"sources":["../src/composables/useLocale.ts"],"sourcesContent":["import { inject, reactive, shallowRef, watchEffect, toValue, type InjectionKey, type MaybeRef } from 'vue'\n\nexport interface M3Locale {\n /** BCP-47 language tag (e.g. 'en', 'es', 'pt') — read by locale-aware components (MRelativeTime) that use Intl formatting. */\n lang: string\n\n // Common\n search: string\n noResults: string\n close: string\n cancel: string\n confirm: string\n loading: string\n menu: string\n\n // Navigation\n previous: string\n next: string\n today: string\n more: string\n\n // Tables\n selectedCount: string\n recordCount: string\n expand: string\n /** Collapses an expanded item (the opposite of `expand`) */\n collapse: string\n /** Clears a field's value (the × at its end) */\n clear: string\n columns: string\n exportCsv: string\n noGroup: string\n\n // Tour\n finish: string\n\n // File upload\n dropText: string\n selectText: string\n maxSizePrefix: string\n remove: string\n\n // Pickers\n selectDate: string\n ok: string\n dateToggleInput: string\n dateToggleCalendar: string\n dateInputLabel: string\n selectTime: string\n timeHourSelection: string\n timeMinuteSelection: string\n timePeriodToggle: string\n timeToggleKeyboard: string\n timeToggleDial: string\n timeToggleScroll: string\n sheetExpand: string\n sheetCollapse: string\n sheetDismiss: string\n seekBar: string\n seekBarValue: string\n seekBarShowRemaining: string\n seekBarShowDuration: string\n selectRange: string\n pickStart: string\n pickEnd: string\n previousMonth: string\n nextMonth: string\n\n // Color picker\n selectColor: string\n colorHue: string\n colorSaturation: string\n colorBrightness: string\n colorAlpha: string\n colorEyedropper: string\n colorOriginal: string\n colorFormat: string\n colorRecent: string\n colorPresets: string\n\n // Scheduler\n dayView: string\n weekView: string\n allDay: string\n emojiSearch: string\n emojiNoResults: string\n emojiRecent: string\n emojiSkinTone: string\n emojiSkinTones: string\n emojiCategorySmileys: string\n emojiCategoryGestures: string\n emojiCategoryPeople: string\n emojiCategoryAnimals: string\n emojiCategoryNature: string\n emojiCategoryFood: string\n emojiCategoryActivities: string\n emojiCategoryTravel: string\n emojiCategoryObjects: string\n emojiCategorySymbols: string\n emojiCategoryFlags: string\n\n // Transfer list\n available: string\n selected: string\n noItems: string\n moveAllRight: string\n moveRight: string\n moveLeft: string\n moveAllLeft: string\n\n // Command palette / Spotlight\n searchCommand: string\n navigateHint: string\n selectHint: string\n openHint: string\n closeHint: string\n\n // Infinite scroll\n loadingMore: string\n noMoreItems: string\n\n // Rich text editor\n bold: string\n italic: string\n underline: string\n strikethrough: string\n highlight: string\n bulletList: string\n orderedList: string\n blockquote: string\n code: string\n alignLeft: string\n alignCenter: string\n alignRight: string\n undo: string\n redo: string\n link: string\n image: string\n paragraph: string\n heading1: string\n heading2: string\n heading3: string\n insertLink: string\n insertImage: string\n imageUrlLabel: string\n insert: string\n\n // JSON editor\n jsonValid: string\n jsonInvalid: string\n jsonFormat: string\n jsonMinify: string\n\n // JSON viewer\n jsonElements: string\n jsonFields: string\n\n // Result\n resultSuccessTitle: string\n resultSuccessDesc: string\n resultErrorTitle: string\n resultErrorDesc: string\n resultWarningTitle: string\n resultWarningDesc: string\n resultInfoTitle: string\n resultInfoDesc: string\n result404Title: string\n result404Desc: string\n result403Title: string\n result403Desc: string\n result500Title: string\n result500Desc: string\n\n // Chat bubble\n chatTyping: string\n chatRecordingAudio: string\n\n // Drag & drop list ({pos}/{total} are replaced at runtime)\n reorderHandle: string\n reorderGrabbed: string\n reorderMoved: string\n reorderDropped: string\n reorderCancelled: string\n\n // Transfer list (panes)\n selectAll: string\n clearSearch: string\n\n // Kanban ({column}/{pos}/{total} are replaced at runtime)\n kanbanMoved: string\n // MWindow title bar buttons\n windowMinimize: string\n windowMaximize: string\n windowRestore: string\n // MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)\n paginationRange: string\n paginationPage: string\n previousPage: string\n nextPage: string\n carousel: string\n carouselItem: string\n /** MSparkline's summary for screen readers: {first}, {last}, {min}, {max} */\n sparklineSummary: string\n /** MSlider range: its two thumbs */\n sliderRangeStart: string\n sliderRangeEnd: string\n // MMap (maplibre controls)\n mapTitle: string\n mapMarker: string\n mapZoomIn: string\n mapZoomOut: string\n mapResetBearing: string\n mapFindMyLocation: string\n mapLocationNotAvailable: string\n mapEnterFullscreen: string\n mapExitFullscreen: string\n mapToggleAttribution: string\n mapFeedback: string\n mapCtrlScroll: string\n mapCmdScroll: string\n mapTwoFingers: string\n mapLayers: string\n mapSearchLayers: string\n mapNoLayers: string\n mapShowLayer: string\n mapHideLayer: string\n mapOpacity: string\n mapDownload: string\n mapNoBaseLayer: string\n mapHoverInfo: string\n mapNoValue: string\n mapMeasureDistance: string\n mapMeasureArea: string\n mapClearMeasurements: string\n mapDeleteMeasurement: string\n mapTotal: string\n mapSearchPlaces: string\n /** MTimeline's button past `limit`; `{count}` is how many entries are hidden */\n timelineShowMore: string\n timelineShowLess: string\n}\n\nexport const defaultLocale: M3Locale = {\n lang: 'en',\n\n search: 'Search...',\n noResults: 'No results',\n close: 'Close',\n menu: 'Menu',\n cancel: 'Cancel',\n confirm: 'Confirm',\n loading: 'Loading',\n\n previous: 'Previous',\n next: 'Next',\n today: 'Today',\n more: 'more',\n\n selectedCount: 'selected',\n recordCount: 'record',\n expand: 'Expand',\n collapse: 'Collapse',\n clear: 'Clear',\n columns: 'Columns',\n exportCsv: 'Export CSV',\n noGroup: 'No group',\n\n finish: 'Finish',\n\n dropText: 'Drop files here or',\n selectText: 'browse',\n maxSizePrefix: 'Max.',\n remove: 'Remove',\n\n selectDate: 'Select date',\n ok: 'OK',\n dateToggleInput: 'Switch to text input',\n dateToggleCalendar: 'Switch to calendar',\n dateInputLabel: 'Date',\n selectTime: 'Select time',\n timeHourSelection: 'Select hour',\n timeMinuteSelection: 'Select minutes',\n timePeriodToggle: 'Select AM or PM',\n timeToggleKeyboard: 'Switch to text input mode',\n timeToggleDial: 'Switch to clock mode',\n timeToggleScroll: 'Switch to scroll mode',\n sheetExpand: 'Expand bottom sheet',\n sheetCollapse: 'Collapse bottom sheet',\n sheetDismiss: 'Dismiss bottom sheet',\n seekBar: 'Seek',\n seekBarValue: '{position} of {duration}',\n seekBarShowRemaining: 'Show remaining time',\n seekBarShowDuration: 'Show total time',\n selectRange: 'Select range',\n pickStart: 'Select start',\n pickEnd: 'Select end',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n selectColor: 'Select color',\n colorHue: 'Hue',\n colorSaturation: 'Saturation',\n colorBrightness: 'Brightness',\n colorAlpha: 'Opacity',\n colorEyedropper: 'Pick a color from the screen',\n colorOriginal: 'Original color',\n colorFormat: 'Color format',\n colorRecent: 'Recent',\n colorPresets: 'Presets',\n\n dayView: 'Day',\n weekView: 'Week',\n allDay: 'All day',\n emojiSearch: 'Search emoji',\n emojiNoResults: 'No emoji found',\n emojiRecent: 'Recently used',\n emojiSkinTone: 'Skin tone',\n emojiSkinTones: 'No skin tone|Light|Medium-light|Medium|Medium-dark|Dark',\n emojiCategorySmileys: 'Smileys',\n emojiCategoryGestures: 'Gestures',\n emojiCategoryPeople: 'People',\n emojiCategoryAnimals: 'Animals',\n emojiCategoryNature: 'Nature',\n emojiCategoryFood: 'Food & drink',\n emojiCategoryActivities: 'Activities',\n emojiCategoryTravel: 'Travel & places',\n emojiCategoryObjects: 'Objects',\n emojiCategorySymbols: 'Symbols',\n emojiCategoryFlags: 'Flags',\n\n available: 'Available',\n selected: 'Selected',\n noItems: 'No items',\n moveAllRight: 'Move all right',\n moveRight: 'Move selected right',\n moveLeft: 'Move selected left',\n moveAllLeft: 'Move all left',\n\n searchCommand: 'Search command...',\n navigateHint: 'navigate',\n selectHint: 'select',\n openHint: 'open',\n closeHint: 'close',\n\n loadingMore: 'Loading...',\n noMoreItems: 'No more items',\n\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strikethrough: 'Strikethrough',\n highlight: 'Highlight',\n bulletList: 'Bullet list',\n orderedList: 'Ordered list',\n blockquote: 'Blockquote',\n code: 'Code',\n alignLeft: 'Align left',\n alignCenter: 'Align center',\n alignRight: 'Align right',\n undo: 'Undo',\n redo: 'Redo',\n link: 'Link',\n image: 'Image',\n paragraph: 'Paragraph',\n heading1: 'Heading 1',\n heading2: 'Heading 2',\n heading3: 'Heading 3',\n insertLink: 'Insert link',\n insertImage: 'Insert image',\n imageUrlLabel: 'Image URL',\n insert: 'Insert',\n\n jsonValid: 'Valid',\n jsonInvalid: 'Invalid',\n jsonFormat: 'Format',\n jsonMinify: 'Minify',\n\n jsonElements: 'elements',\n jsonFields: 'fields',\n\n // Result\n resultSuccessTitle: 'Success',\n resultSuccessDesc: 'The action was completed successfully.',\n resultErrorTitle: 'Something went wrong',\n resultErrorDesc: 'An unexpected error occurred. Please try again.',\n resultWarningTitle: 'Warning',\n resultWarningDesc: 'Something needs your attention.',\n resultInfoTitle: 'Information',\n resultInfoDesc: 'Here is something you should know.',\n result404Title: 'Page not found',\n result404Desc: 'The page you are looking for does not exist or has been moved.',\n result403Title: 'Access denied',\n result403Desc: 'You don\\'t have permission to view this resource.',\n result500Title: 'Server error',\n result500Desc: 'The server could not process the request.',\n\n // Chat bubble\n chatTyping: 'Typing…',\n chatRecordingAudio: 'Recording audio…',\n\n // Drag & drop list ({pos}/{total} are replaced at runtime)\n reorderHandle: 'Reorder',\n reorderGrabbed: 'Item grabbed, position {pos} of {total}. Use the arrow keys to move it, Space to drop it, Escape to cancel.',\n reorderMoved: 'Moved to position {pos} of {total}.',\n reorderDropped: 'Item dropped at position {pos} of {total}.',\n reorderCancelled: 'Reorder cancelled.',\n\n // Transfer list (panes)\n selectAll: 'Select all',\n clearSearch: 'Clear search',\n\n // Kanban ({column}/{pos}/{total} are replaced at runtime)\n kanbanMoved: 'Moved to {column}, position {pos} of {total}.',\n windowMinimize: 'Minimize',\n windowMaximize: 'Maximize',\n windowRestore: 'Restore',\n // MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)\n paginationRange: '{from}–{to} of {total}',\n paginationPage: 'Page {page} of {pages}',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n carousel: 'Carousel',\n carouselItem: '{index} of {count}',\n sparklineSummary: 'From {first} to {last}, low {min}, high {max}',\n sliderRangeStart: 'Range start',\n sliderRangeEnd: 'Range end',\n // MMap (maplibre controls)\n mapTitle: 'Map',\n mapMarker: 'Map marker',\n mapZoomIn: 'Zoom in',\n mapZoomOut: 'Zoom out',\n mapResetBearing: 'Reset bearing to north',\n mapFindMyLocation: 'Find my location',\n mapLocationNotAvailable: 'Location not available',\n mapEnterFullscreen: 'Enter fullscreen',\n mapExitFullscreen: 'Exit fullscreen',\n mapToggleAttribution: 'Toggle attribution',\n mapFeedback: 'Map feedback',\n mapCtrlScroll: 'Use Ctrl + scroll to zoom the map',\n mapCmdScroll: 'Use ⌘ + scroll to zoom the map',\n mapTwoFingers: 'Use two fingers to move the map',\n mapLayers: 'Layers',\n mapSearchLayers: 'Search layers',\n mapNoLayers: 'No layers',\n mapShowLayer: 'Show layer',\n mapHideLayer: 'Hide layer',\n mapOpacity: 'Opacity',\n mapDownload: 'Download',\n mapNoBaseLayer: 'No base layer',\n mapHoverInfo: 'Info on hover',\n mapNoValue: 'Not available',\n mapMeasureDistance: 'Measure distance',\n mapMeasureArea: 'Measure area',\n mapClearMeasurements: 'Clear measurements',\n mapDeleteMeasurement: 'Delete measurement',\n mapTotal: 'Total',\n mapSearchPlaces: 'Search places',\n timelineShowMore: 'Show {count} more',\n timelineShowLess: 'Show less',\n}\n\nexport const M3_LOCALE_KEY: InjectionKey<MaybeRef<Partial<M3Locale>>> = Symbol('m3-locale')\n\n/**\n * The locale given to `createM3UI()`, for components rendered outside the app that installed it:\n * `useToast()` and `useNotification()` mount their hosts with an app of their own, where the\n * plugin's `provide` doesn't reach. Inside the user's app the provided locale still wins.\n */\n// Wrapped in an object: a shallowRef holding a ref directly gets that ref unwrapped in its type.\nconst appLocale = shallowRef<{ locale: MaybeRef<Partial<M3Locale>> } | null>(null)\n\n/** @internal Called by `createM3UI()`; not exported from the package. */\nexport function __setAppLocale(locale: MaybeRef<Partial<M3Locale>> | null) {\n appLocale.value = locale ? { locale } : null\n}\n\nexport function useLocale(): M3Locale {\n const provided = inject(M3_LOCALE_KEY, null)\n const locale = reactive({ ...defaultLocale }) as M3Locale\n\n watchEffect(() => {\n Object.assign(locale, defaultLocale, toValue(provided ?? appLocale.value?.locale ?? {}))\n })\n\n return locale\n}\n"],"mappings":";;AAkPA,IAAa,IAA0B;CACrC,MAAM;CAEN,QAAQ;CACR,WAAW;CACX,OAAO;CACP,MAAM;CACN,QAAQ;CACR,SAAS;CACT,SAAS;CAET,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CAEN,eAAe;CACf,aAAa;CACb,QAAQ;CACR,UAAU;CACV,OAAO;CACP,SAAS;CACT,WAAW;CACX,SAAS;CAET,QAAQ;CAER,UAAU;CACV,YAAY;CACZ,eAAe;CACf,QAAQ;CAER,YAAY;CACZ,IAAI;CACJ,iBAAiB;CACjB,o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jB,gBAAgB;CAChB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,eAAe;CAGf,YAAY;CACZ,oBAAoB;CAGpB,eAAe;CACf,gBAAgB;CAChB,cAAc;CACd,gBAAgB;CAChB,kBAAkB;CAGlB,WAAW;CACX,aAAa;CAGb,aAAa;CACb,gBAAgB;CAChB,gBAAgB;CAChB,eAAe;CAEf,iBAAiB;CACjB,gBAAgB;CAChB,cAAc;CACd,UAAU;CACV,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,gBAAgB;CAEhB,UAAU;CACV,WAAW;CACX,WAAW;CACX,YAAY;CACZ,iBAAiB;CACjB,mBAAmB;CACnB,yBAAyB;CACzB,oBAAoB;CACpB,mBAAmB;CACnB,sBAAsB;CACtB,aAAa;CACb,eAAe;CACf,cAAc;CACd,eAAe;CACf,WAAW;CACX,iBAAiB;CACjB,aAAa;CACb,cAAc;CACd,cAAc;CACd,YAAY;CACZ,aAAa;CACb,gBAAgB;CAChB,cAAc;CACd,YAAY;CACZ,oBAAoB;CACpB,gBAAgB;CAChB,sBAAsB;CACtB,sBAAsB;CACtB,UAAU;CACV,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;AACpB,GAEa,IAA2D,OAAO,WAAW,GAQpF,IAAY,EAA2D,IAAI;AAGjF,SAAgB,EAAe,GAA4C;CACzE,EAAU,QAAQ,IAAS,EAAE,UAAO,IAAI;AAC1C;AAEA,SAAgB,IAAsB;CACpC,IAAM,IAAW,EAAO,GAAe,IAAI,GACrC,IAAS,EAAS,EAAE,GAAG,EAAc,CAAC;CAM5C,OAJA,QAAkB;EAChB,OAAO,OAAO,GAAQ,GAAe,EAAQ,KAAY,EAAU,OAAO,UAAU,CAAC,CAAC,CAAC;CACzF,CAAC,GAEM;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeTokens-y0HZpyhL.js","names":[],"sources":["../src/composables/_themeTransition.ts","../src/composables/_storageKeys.ts","../src/composables/useThemeTokens.ts"],"sourcesContent":["// Internal: animates a theme change (dark mode, palette, contrast).\n//\n// Firefox (and any browser without @property) transitions six color properties on every element\n// (`.theme-transitioning` in theme.css): smooth there, but in Chromium it recalculates every element's transitions\n// each frame and stutters. Chromium and WebKit instead transition the color tokens themselves, once, on <html>:\n// registered as <color> with @property they interpolate, and every element follows them through var(). Components'\n// own color transitions (transition-colors) are turned off meanwhile, or they would restart on every frame of the\n// token's change and trail behind the rest (the navbar and buttons did). A view transition was tried first: it\n// cross-fades two snapshots, which looks washed out midway compared to the colors moving.\n\n// The tokens of theme.css, palettes.css and generated palettes\nconst COLOR_TOKENS = [\n 'background', 'on-background', 'surface', 'surface-dim', 'surface-bright', 'surface-variant', 'on-surface',\n 'on-surface-variant', 'surface-container-lowest', 'surface-container-low', 'surface-container',\n 'surface-container-high', 'surface-container-highest', 'inverse-surface', 'inverse-on-surface', 'inverse-primary',\n 'outline', 'outline-variant', 'shadow', 'scrim',\n ...['primary', 'secondary', 'tertiary', 'error', 'success'].flatMap((c) => [c, `on-${c}`, `${c}-container`, `on-${c}-container`]),\n ...['primary', 'secondary', 'tertiary'].flatMap((c) => [`${c}-fixed`, `${c}-fixed-dim`, `on-${c}-fixed`, `on-${c}-fixed-variant`]),\n].map((t) => `--color-${t}`)\n\nconst DURATION = 250\n/** How long a theme switch's color transition takes, in ms (both paths) */\nexport const THEME_TRANSITION_MS = DURATION\nconst STYLE_ID = 'm3-theme-transition'\n\n// Injected only while switching: a registered <color> computes to rgb(), and code reading a token with\n// getPropertyValue() expects it as written\nconst css = COLOR_TOKENS.map((t) => `@property ${t} { syntax: '<color>'; inherits: true; initial-value: transparent; }`).join('\\n')\n + `\\nhtml.theme-switching { transition: ${COLOR_TOKENS.map((t) => `${t} ${DURATION}ms ease`).join(', ')}; }`\n + '\\nhtml.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }'\n\n// Gecko: a CSS feature only it has, or its user agent (\"Gecko/<version>\" or \"Firefox/\"; Chromium and WebKit only\n// say \"like Gecko\", and Firefox on iOS is WebKit and says \"FxiOS\")\nconst isGecko = () =>\n (typeof CSS !== 'undefined' && !!CSS.supports?.('-moz-appearance', 'none'))\n || (typeof navigator !== 'undefined' && /\\bGecko\\/\\d|\\bFirefox\\//.test(navigator.userAgent))\nconst hasProperty = () => typeof CSS !== 'undefined' && typeof CSS.registerProperty === 'function'\n\nlet timer: ReturnType<typeof setTimeout> | undefined\n\n/** Runs `apply` (the DOM writes of a theme change) with the theme transition. */\nexport function themeTransition(apply: () => void) {\n if (typeof document === 'undefined') return apply()\n const reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches\n if (reduced) return apply()\n const root = document.documentElement\n\n if (!isGecko() && hasProperty()) {\n if (!document.getElementById(STYLE_ID)) {\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = css\n document.head.appendChild(style)\n }\n root.classList.add('theme-switching')\n // Style flush: the tokens' current values are computed as registered colors and the transition is in place\n // before they change\n void root.offsetHeight\n apply()\n clearTimeout(timer)\n timer = setTimeout(() => {\n root.classList.remove('theme-switching')\n document.getElementById(STYLE_ID)?.remove()\n }, DURATION + 50)\n return\n }\n\n root.classList.add('theme-transitioning')\n // Force a style flush so the transition is in place before the colors change\n void root.offsetHeight\n apply()\n setTimeout(() => root.classList.remove('theme-transitioning'), 300)\n}\n","// 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","import { onBeforeUnmount, onMounted, ref, type Ref } from 'vue'\nimport { STYLE_ID } from './_storageKeys'\nimport { THEME_TRANSITION_MS } from './_themeTransition'\nimport { cubicBezier } from './motion'\n\nexport interface ThemeTokensOptions {\n /**\n * Updates every animation frame while the theme switch's colors fade, so a canvas redrawn on change fades with\n * the page instead of jumping to the new colors. Off by default: what animates color changes itself (Chart.js,\n * MChart, maps) only needs the final values, and would otherwise redraw ~15 times per switch.\n */\n live?: boolean\n}\n\n// The CSS `ease` the switch uses (_themeTransition.ts, and `.theme-transitioning` in theme.css)\nconst ease = cubicBezier(0.25, 0.1, 0.25, 1)\n\ntype Rgba = [number, number, number, number]\n\n// Hex (#rgb, #rgba, #rrggbb, #rrggbbaa) or rgb()/rgba(), the forms tokens are written in or computed to; null for\n// anything else (that token then switches at once)\nfunction parseColor(value: string): Rgba | null {\n const v = value.trim()\n const hex = /^#([0-9a-f]{3,8})$/i.exec(v)?.[1]\n if (hex && hex.length !== 5 && hex.length !== 7) {\n const full = hex.length <= 4 ? [...hex].map((c) => c + c).join('') : hex\n const n = (i: number) => parseInt(full.slice(i, i + 2), 16)\n return [n(0), n(2), n(4), full.length === 8 ? n(6) / 255 : 1]\n }\n const fn = /^rgba?\\(([^)]+)\\)$/i.exec(v)?.[1]\n if (!fn) return null\n const parts = fn.split(/[\\s,/]+/).filter(Boolean)\n if (parts.length < 3) return null\n const channel = (p: string) => (p.endsWith('%') ? parseFloat(p) * 2.55 : parseFloat(p))\n const alpha = parts[3] == null ? 1 : parts[3].endsWith('%') ? parseFloat(parts[3]) / 100 : parseFloat(parts[3])\n const rgba = [channel(parts[0]!), channel(parts[1]!), channel(parts[2]!), alpha] as Rgba\n return rgba.every(Number.isFinite) ? rgba : null\n}\n\nfunction mix(from: string, to: string, t: number): string {\n const a = parseColor(from)\n const b = parseColor(to)\n if (!a || !b) return t < 1 ? from : to\n const [r, g, bl, al] = a.map((x, i) => x + (b[i]! - x) * t)\n return `rgba(${Math.round(r!)}, ${Math.round(g!)}, ${Math.round(bl!)}, ${+al!.toFixed(3)})`\n}\n\n/**\n * The current values of some color tokens (`['primary', 'surface']` → `--color-primary`…), kept up to date across\n * light/dark, palette, contrast and generated (seed) palette changes: for what can't use CSS variables, like a\n * Chart.js dataset, a canvas or a MapLibre layer's paint. Values settle after the theme switch's color transition;\n * with `{ live: true }` they also follow it frame by frame (as `rgba()` midway). Empty strings on the server.\n *\n * ```ts\n * const colors = useThemeTokens(['primary', 'tertiary', 'outline-variant'] as const)\n * const data = computed(() => ({ datasets: [{ data: sales, borderColor: colors.value.primary }] }))\n * ```\n */\nexport function useThemeTokens<T extends string>(names: readonly T[], options: ThemeTokensOptions = {}): Ref<Record<T, string>> {\n const read = () => {\n const style = getComputedStyle(document.documentElement)\n return Object.fromEntries(names.map((n) => [n, style.getPropertyValue(`--color-${n}`).trim()])) as Record<T, string>\n }\n const tokens = ref(typeof document === 'undefined' ? Object.fromEntries(names.map((n) => [n, ''])) as Record<T, string> : read()) as Ref<Record<T, string>>\n let observer: MutationObserver | undefined\n let settle: ReturnType<typeof setTimeout> | undefined\n let frame = 0\n\n const set = (next: Record<T, string>) => {\n if (names.some((n) => next[n] !== tokens.value[n])) tokens.value = next\n }\n const update = () => set(read())\n\n // Follows a switch already under way. Chromium/WebKit animate the tokens themselves (`theme-switching`), so\n // reading them each frame gives the page's own colors; Firefox fades each element's colors instead\n // (`theme-transitioning`) while the tokens jump, so the same `ease` is replayed here from the old values\n function follow(root: HTMLElement) {\n cancelAnimationFrame(frame)\n const native = root.classList.contains('theme-switching')\n const from = { ...tokens.value }\n const to = native ? null : read()\n const start = performance.now()\n const step = (now: number) => {\n const t = Math.min(1, (now - start) / THEME_TRANSITION_MS)\n // The last frame lands on the values as written, not their rgba() form\n if (to) set(t < 1 ? Object.fromEntries(names.map((n) => [n, mix(from[n], to[n], ease(t))])) as Record<T, string> : to)\n else update()\n if (t < 1) frame = requestAnimationFrame(step)\n }\n frame = requestAnimationFrame(step)\n }\n\n onMounted(() => {\n const root = document.documentElement\n // Dark mode (class), a palette or contrast (attributes), or a generated palette rewriting its <style> in <head>\n const isPaletteStyle = (node: Node | null) => (node instanceof Element ? node : node?.parentElement)?.id === STYLE_ID\n observer = new MutationObserver((records) => {\n if (!records.some((r) => r.target === root || isPaletteStyle(r.target)\n || Array.from(r.addedNodes).some(isPaletteStyle))) return\n if (options.live && (root.classList.contains('theme-switching') || root.classList.contains('theme-transitioning'))) follow(root)\n else update()\n // Chromium animates the tokens on a theme switch (_themeTransition, 250ms): read the settled values too\n clearTimeout(settle)\n settle = setTimeout(update, THEME_TRANSITION_MS + 50)\n })\n observer.observe(root, { attributes: true, attributeFilter: ['class', 'style', 'data-palette', 'data-contrast'] })\n observer.observe(document.head, { childList: true, characterData: true, subtree: true })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n clearTimeout(settle)\n cancelAnimationFrame(frame)\n })\n\n return tokens\n}\n"],"mappings":";;;AAWA,IAAM,IAAe;CACnB;CAAc;CAAiB;CAAW;CAAe;CAAkB;CAAmB;CAC9F;CAAsB;CAA4B;CAAyB;CAC3E;CAA0B;CAA6B;CAAmB;CAAsB;CAChG;CAAW;CAAmB;CAAU;CACxC,GAAG;EAAC;EAAW;EAAa;EAAY;EAAS;CAAS,CAAC,CAAC,SAAS,MAAM;EAAC;EAAG,MAAM;EAAK,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