@m3ui-vue/m3ui-vue 1.2.1 → 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.
Files changed (269) hide show
  1. package/dist/API.md +2914 -348
  2. package/dist/MButton-CuNzpoxm.js +172 -0
  3. package/dist/MButton-CuNzpoxm.js.map +1 -0
  4. package/dist/MDialog-HxEL-m58.js +173 -0
  5. package/dist/MDialog-HxEL-m58.js.map +1 -0
  6. package/dist/MIconButton-DoNotQ9v.js +282 -0
  7. package/dist/MIconButton-DoNotQ9v.js.map +1 -0
  8. package/dist/MListItem-DnPtv-hY.js +824 -0
  9. package/dist/MListItem-DnPtv-hY.js.map +1 -0
  10. package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
  11. package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
  12. package/dist/MMenuItem-Bih0h4-n.js +604 -0
  13. package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
  14. package/dist/MProgressBar-BCoruxA-.js +184 -0
  15. package/dist/MProgressBar-BCoruxA-.js.map +1 -0
  16. package/dist/MSeekBar-LURE1Ah7.js +435 -0
  17. package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
  18. package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
  19. package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
  20. package/dist/MSlider-_J4IS2_z.js +691 -0
  21. package/dist/MSlider-_J4IS2_z.js.map +1 -0
  22. package/dist/MSpinner-BhkMYKOM.js +65 -0
  23. package/dist/MSpinner-BhkMYKOM.js.map +1 -0
  24. package/dist/MTextField-CkzwNBWS.js +296 -0
  25. package/dist/MTextField-CkzwNBWS.js.map +1 -0
  26. package/dist/MTooltip-B67ZDSGp.js +756 -0
  27. package/dist/MTooltip-B67ZDSGp.js.map +1 -0
  28. package/dist/_storageKeys-CYXsUBwK.js +18 -0
  29. package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
  30. package/dist/_useEscapeStack-CjndQhqg.js +19 -0
  31. package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
  32. package/dist/api.json +1 -1
  33. package/dist/chart.js +1 -1
  34. package/dist/code-editor.js +1 -1
  35. package/dist/components/MAudioPlayer.vue.d.ts +115 -0
  36. package/dist/components/MBadge.vue.d.ts +1 -1
  37. package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
  38. package/dist/components/MBox.vue.d.ts +1 -1
  39. package/dist/components/MButton.vue.d.ts +1 -1
  40. package/dist/components/MConfirmDialog.vue.d.ts +1 -1
  41. package/dist/components/MCopyButton.vue.d.ts +2 -2
  42. package/dist/components/MDataTable.vue.d.ts +2 -2
  43. package/dist/components/MDialog.vue.d.ts +2 -2
  44. package/dist/components/MDivider.vue.d.ts +1 -1
  45. package/dist/components/MDragHandle.vue.d.ts +1 -1
  46. package/dist/components/MDrawCanvas.vue.d.ts +148 -0
  47. package/dist/components/MDrawLayers.vue.d.ts +3 -0
  48. package/dist/components/MDrawToolbar.vue.d.ts +34 -0
  49. package/dist/components/MExportButton.vue.d.ts +1 -1
  50. package/dist/components/MFab.vue.d.ts +2 -2
  51. package/dist/components/MFabMenu.vue.d.ts +2 -2
  52. package/dist/components/MFixed.vue.d.ts +1 -1
  53. package/dist/components/MFlex.vue.d.ts +2 -2
  54. package/dist/components/MFloorPlan.vue.d.ts +160 -0
  55. package/dist/components/MFlow.vue.d.ts +305 -0
  56. package/dist/components/MFlowControls.vue.d.ts +33 -0
  57. package/dist/components/MFlowHandle.vue.d.ts +16 -0
  58. package/dist/components/MFlowMinimap.vue.d.ts +22 -0
  59. package/dist/components/MFlowNode.vue.d.ts +35 -0
  60. package/dist/components/MGantt.vue.d.ts +141 -0
  61. package/dist/components/MGanttControls.vue.d.ts +32 -0
  62. package/dist/components/MIconButton.vue.d.ts +3 -1
  63. package/dist/components/MImageCropper.vue.d.ts +110 -0
  64. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  65. package/dist/components/MLightbox.vue.d.ts +2 -2
  66. package/dist/components/MList.vue.d.ts +1 -1
  67. package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
  68. package/dist/components/MMap.vue.d.ts +1 -1
  69. package/dist/components/MMapControl.vue.d.ts +1 -1
  70. package/dist/components/MMapSearch.vue.d.ts +1 -1
  71. package/dist/components/MMaskField.vue.d.ts +12 -1
  72. package/dist/components/MMenu.vue.d.ts +1 -1
  73. package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
  74. package/dist/components/MNumberField.vue.d.ts +11 -2
  75. package/dist/components/MPdfViewer.vue.d.ts +174 -0
  76. package/dist/components/MPullToRefresh.vue.d.ts +1 -1
  77. package/dist/components/MResourceTimeline.vue.d.ts +149 -0
  78. package/dist/components/MScheduler.vue.d.ts +3 -3
  79. package/dist/components/MScheme.vue.d.ts +1 -1
  80. package/dist/components/MSearchField.vue.d.ts +1 -1
  81. package/dist/components/MSeekBar.vue.d.ts +1 -1
  82. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  83. package/dist/components/MSkeleton.vue.d.ts +1 -1
  84. package/dist/components/MSlider.vue.d.ts +4 -4
  85. package/dist/components/MSparkline.vue.d.ts +1 -1
  86. package/dist/components/MSplitter.vue.d.ts +1 -1
  87. package/dist/components/MStack.vue.d.ts +2 -2
  88. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  89. package/dist/components/MSwitch.vue.d.ts +1 -1
  90. package/dist/components/MTable.vue.d.ts +1 -1
  91. package/dist/components/MTagInput.vue.d.ts +12 -1
  92. package/dist/components/MTextField.vue.d.ts +13 -2
  93. package/dist/components/MToolbar.vue.d.ts +1 -1
  94. package/dist/components/MTree.vue.d.ts +2 -2
  95. package/dist/components/MVideoPlayer.vue.d.ts +253 -0
  96. package/dist/components/MVirtualTable.vue.d.ts +1 -1
  97. package/dist/components/MWindow.vue.d.ts +3 -3
  98. package/dist/components/_MFlowEdge.vue.d.ts +9 -0
  99. package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
  100. package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
  101. package/dist/components/_MPdfPage.vue.d.ts +76 -0
  102. package/dist/components/_MTimeBackground.vue.d.ts +14 -0
  103. package/dist/components/_MTimeHeader.vue.d.ts +20 -0
  104. package/dist/composables/_effectCanvas.d.ts +23 -0
  105. package/dist/composables/_flowPanel.d.ts +2 -0
  106. package/dist/composables/_flowSlot.d.ts +5 -0
  107. package/dist/composables/_ganttTime.d.ts +41 -0
  108. package/dist/composables/_storageKeys.d.ts +9 -0
  109. package/dist/composables/_useTimeAxis.d.ts +90 -0
  110. package/dist/composables/drawGeometry.d.ts +119 -0
  111. package/dist/composables/flowFormats.d.ts +79 -0
  112. package/dist/composables/flowLayout.d.ts +45 -0
  113. package/dist/composables/flowPaths.d.ts +53 -0
  114. package/dist/composables/ganttFormats.d.ts +52 -0
  115. package/dist/composables/ganttSchedule.d.ts +99 -0
  116. package/dist/composables/themeInitScript.d.ts +2 -0
  117. package/dist/composables/useConfetti.d.ts +19 -8
  118. package/dist/composables/useDrawing.d.ts +44 -0
  119. package/dist/composables/useFireworks.d.ts +37 -0
  120. package/dist/composables/useFlow.d.ts +266 -0
  121. package/dist/composables/useGantt.d.ts +87 -0
  122. package/dist/composables/useLocale.d.ts +163 -0
  123. package/dist/composables/useMediaPlayer.d.ts +101 -0
  124. package/dist/composables/usePdf.d.ts +119 -0
  125. package/dist/composables/useReactions.d.ts +32 -0
  126. package/dist/composables/useResourceTimeline.d.ts +70 -0
  127. package/dist/composables/viewportHints.d.ts +2 -0
  128. package/dist/directives/vSparkle.d.ts +27 -0
  129. package/dist/draw.d.ts +7 -0
  130. package/dist/draw.js +1700 -0
  131. package/dist/draw.js.map +1 -0
  132. package/dist/flow.d.ts +14 -0
  133. package/dist/flow.js +3542 -0
  134. package/dist/flow.js.map +1 -0
  135. package/dist/flowPaths-CUc6X373.js +161 -0
  136. package/dist/flowPaths-CUc6X373.js.map +1 -0
  137. package/dist/gantt.d.ts +12 -0
  138. package/dist/gantt.js +3575 -0
  139. package/dist/gantt.js.map +1 -0
  140. package/dist/index.d.ts +11 -1
  141. package/dist/locales/index.js +1148 -7
  142. package/dist/locales/index.js.map +1 -1
  143. package/dist/m3ui-vue.css +1 -1
  144. package/dist/m3ui.js +7822 -7809
  145. package/dist/m3ui.js.map +1 -1
  146. package/dist/map.js +593 -588
  147. package/dist/map.js.map +1 -1
  148. package/dist/media.d.ts +5 -0
  149. package/dist/media.js +1311 -0
  150. package/dist/media.js.map +1 -0
  151. package/dist/pdf.d.ts +4 -0
  152. package/dist/pdf.js +1871 -0
  153. package/dist/pdf.js.map +1 -0
  154. package/dist/plugin.d.ts +10 -0
  155. package/dist/rich-text-editor.js +28 -26
  156. package/dist/rich-text-editor.js.map +1 -1
  157. package/dist/styles.css +1 -1
  158. package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
  159. package/dist/useLocale-BpGxplLV.js.map +1 -0
  160. package/dist/{useThemeTokens-Bv-Uv8eX.js → useThemeTokens-DQQcaWbE.js} +41 -40
  161. package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
  162. package/package.json +29 -5
  163. package/src/__tests__/MAudioPlayer.test.ts +75 -0
  164. package/src/__tests__/MDrawCanvas.test.ts +110 -0
  165. package/src/__tests__/MFloorPlan.test.ts +97 -0
  166. package/src/__tests__/MFlow.test.ts +575 -0
  167. package/src/__tests__/MGantt.test.ts +130 -0
  168. package/src/__tests__/MImageCropper.test.ts +89 -0
  169. package/src/__tests__/MPdfViewer.test.ts +235 -0
  170. package/src/__tests__/MResourceTimeline.test.ts +102 -0
  171. package/src/__tests__/MSlider.test.ts +36 -0
  172. package/src/__tests__/MVideoPlayer.test.ts +201 -0
  173. package/src/__tests__/drawGeometry.test.ts +58 -0
  174. package/src/__tests__/fieldExpose.test.ts +30 -0
  175. package/src/__tests__/flowFormats.test.ts +185 -0
  176. package/src/__tests__/flowLayout.test.ts +113 -0
  177. package/src/__tests__/ganttFormats.test.ts +76 -0
  178. package/src/__tests__/ganttSchedule.test.ts +136 -0
  179. package/src/__tests__/pdfMock.ts +83 -0
  180. package/src/__tests__/plugin.test.ts +56 -1
  181. package/src/__tests__/ssr.test.ts +1 -1
  182. package/src/__tests__/themeInitScript.test.ts +10 -0
  183. package/src/__tests__/useConfetti.test.ts +33 -2
  184. package/src/__tests__/useFireworks.test.ts +104 -0
  185. package/src/__tests__/useMediaPlayer.test.ts +182 -0
  186. package/src/__tests__/usePdf.test.ts +102 -0
  187. package/src/__tests__/useReactions.test.ts +51 -0
  188. package/src/__tests__/vSparkle.test.ts +83 -0
  189. package/src/components/MAudioPlayer.vue +319 -0
  190. package/src/components/MDrawCanvas.vue +813 -0
  191. package/src/components/MDrawLayers.vue +114 -0
  192. package/src/components/MDrawToolbar.vue +171 -0
  193. package/src/components/MEmojiSelector.vue +3 -2
  194. package/src/components/MFloorPlan.vue +581 -0
  195. package/src/components/MFlow.vue +2049 -0
  196. package/src/components/MFlowControls.vue +110 -0
  197. package/src/components/MFlowHandle.vue +60 -0
  198. package/src/components/MFlowMinimap.vue +134 -0
  199. package/src/components/MFlowNode.vue +98 -0
  200. package/src/components/MGantt.vue +1609 -0
  201. package/src/components/MGanttControls.vue +77 -0
  202. package/src/components/MIconButton.vue +3 -1
  203. package/src/components/MImageCropper.vue +507 -0
  204. package/src/components/MMap.vue +3 -2
  205. package/src/components/MMaskField.vue +13 -0
  206. package/src/components/MNumberField.vue +13 -0
  207. package/src/components/MPdfViewer.vue +1269 -0
  208. package/src/components/MResourceTimeline.vue +1020 -0
  209. package/src/components/MSlider.vue +22 -4
  210. package/src/components/MTagInput.vue +13 -0
  211. package/src/components/MTextField.vue +24 -4
  212. package/src/components/MVideoPlayer.vue +839 -0
  213. package/src/components/_MFlowEdge.vue +100 -0
  214. package/src/components/_MFlowEdgeLabel.vue +56 -0
  215. package/src/components/_MFlowNodeShell.vue +111 -0
  216. package/src/components/_MPdfPage.vue +456 -0
  217. package/src/components/_MTimeBackground.vue +16 -0
  218. package/src/components/_MTimeHeader.vue +31 -0
  219. package/src/composables/_colorUtils.ts +4 -2
  220. package/src/composables/_effectCanvas.ts +109 -0
  221. package/src/composables/_flowPanel.ts +13 -0
  222. package/src/composables/_flowSlot.ts +6 -0
  223. package/src/composables/_ganttTime.ts +200 -0
  224. package/src/composables/_ssrState.ts +2 -2
  225. package/src/composables/_storageKeys.ts +28 -0
  226. package/src/composables/_useTimeAxis.ts +224 -0
  227. package/src/composables/drawGeometry.ts +405 -0
  228. package/src/composables/flowFormats.ts +916 -0
  229. package/src/composables/flowLayout.ts +297 -0
  230. package/src/composables/flowPaths.ts +239 -0
  231. package/src/composables/ganttFormats.ts +366 -0
  232. package/src/composables/ganttSchedule.ts +403 -0
  233. package/src/composables/themeInitScript.ts +5 -2
  234. package/src/composables/useColorPalette.ts +36 -8
  235. package/src/composables/useConfetti.ts +84 -107
  236. package/src/composables/useDrawing.ts +53 -0
  237. package/src/composables/useFireworks.ts +360 -0
  238. package/src/composables/useFlow.ts +250 -0
  239. package/src/composables/useGantt.ts +92 -0
  240. package/src/composables/useLocale.ts +328 -0
  241. package/src/composables/useMediaPlayer.ts +406 -0
  242. package/src/composables/usePdf.ts +456 -0
  243. package/src/composables/useReactions.ts +131 -0
  244. package/src/composables/useResourceTimeline.ts +76 -0
  245. package/src/composables/useTheme.ts +21 -4
  246. package/src/composables/viewportHints.ts +6 -5
  247. package/src/directives/vSparkle.ts +180 -0
  248. package/src/draw.ts +25 -0
  249. package/src/flow.ts +26 -0
  250. package/src/gantt.ts +12 -0
  251. package/src/index.ts +11 -1
  252. package/src/locales/de.ts +163 -0
  253. package/src/locales/es.ts +163 -0
  254. package/src/locales/fr.ts +163 -0
  255. package/src/locales/ja.ts +163 -0
  256. package/src/locales/ko.ts +163 -0
  257. package/src/locales/pt.ts +163 -0
  258. package/src/locales/zh.ts +163 -0
  259. package/src/media.ts +5 -0
  260. package/src/pdf.ts +15 -0
  261. package/src/plugin.ts +21 -5
  262. package/dist/MMenuItem-DI351kIf.js +0 -929
  263. package/dist/MMenuItem-DI351kIf.js.map +0 -1
  264. package/dist/MSlider-BnEy5ieZ.js +0 -1500
  265. package/dist/MSlider-BnEy5ieZ.js.map +0 -1
  266. package/dist/MTextField-BBmkaIbO.js +0 -633
  267. package/dist/MTextField-BBmkaIbO.js.map +0 -1
  268. package/dist/useLocale-JYxDDeXC.js.map +0 -1
  269. package/dist/useThemeTokens-Bv-Uv8eX.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MMenuItem-Bih0h4-n.js","names":["$attrs","$slots"],"sources":["../src/components/MMenuDivider.vue","../src/components/MMenuDivider.vue","../src/composables/_useMenuNav.ts","../src/composables/_popupPosition.ts","../src/components/MMenu.vue","../src/components/MMenu.vue","../src/components/MMenuItem.vue","../src/components/MMenuItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A line between groups of items in an MMenu or MContextMenu; with `gap` in an expressive menu it splits the\n * menu into separate rounded groups.\n */\nwithDefaults(\n defineProps<{\n /**\n * Marks this as a group boundary for `MMenu`/`MContextMenu`'s\n * `variant=\"expressive\"` — instead of rendering this divider in place,\n * the parent menu splits its panel into two independently-rounded group\n * boxes with a small gap between them. Has no effect outside an\n * `expressive` menu, where it renders as a normal divider line.\n */\n gap?: boolean\n }>(),\n { gap: false },\n)\n</script>\n\n<template>\n <hr class=\"my-1 border-outline-variant\" />\n</template>\n","<script setup lang=\"ts\">\n/**\n * A line between groups of items in an MMenu or MContextMenu; with `gap` in an expressive menu it splits the\n * menu into separate rounded groups.\n */\nwithDefaults(\n defineProps<{\n /**\n * Marks this as a group boundary for `MMenu`/`MContextMenu`'s\n * `variant=\"expressive\"` — instead of rendering this divider in place,\n * the parent menu splits its panel into two independently-rounded group\n * boxes with a small gap between them. Has no effect outside an\n * `expressive` menu, where it renders as a normal divider line.\n */\n gap?: boolean\n }>(),\n { gap: false },\n)\n</script>\n\n<template>\n <hr class=\"my-1 border-outline-variant\" />\n</template>\n","import { computed, nextTick, onUnmounted, ref } from 'vue'\nimport { motionSprings } from './motion'\nimport { playSamples, prefersReducedMotion, sampleSpring } from './_springAnimation'\n\n/*\n * Internal (not exported from index.ts): the `submenuMode=\"push\"` navigation shared by MMenu and MContextMenu.\n * A stack of levels (one per opened MMenuItem with #children) shown one at a time in the panel's scroll\n * wrapper (`navBox`), with:\n * - M3's shared axis X between levels: a 30dp slide with a crossfade, the old level fading out quickly and the\n * new one fading in after it. Driven by the Web Animations API through a `:css=\"false\"` Transition: with\n * direction-dependent classes on a mode-less Transition, Vue's class swap unreliably never completed.\n * - the panel's height following the new level on a spring (Standard DefaultSpatial), measured before and\n * after the swap, with no scrollbar while the levels cross.\n * - swipe right to go back on touch: the level follows the finger and, released past a third of the panel\n * (or flung), leaves from where it is; otherwise it springs back.\n */\n\nexport type MenuNavEntry = { icon?: string, header?: () => any, content?: () => any }\n\nconst SHARED_AXIS_OFFSET = 30\n// Back to scrolling once the slide (60ms delay + 300ms) has settled\nconst SLIDE_SETTLE_MS = 380\n// A touch decides between a vertical scroll and a swipe once it has moved this far\nconst SWIPE_SLOP = 8\nconst SWIPE_DISTANCE = 1 / 3\nconst SWIPE_VELOCITY = 0.5 // px/ms\n\nexport function useMenuNav(focusFirst: () => void) {\n const navStack = ref<MenuNavEntry[]>([])\n const currentNav = computed(() => navStack.value[navStack.value.length - 1])\n const navDirection = ref<'forward' | 'backward'>('forward')\n const navBox = ref<HTMLElement>()\n\n // Where a swiped level was released, so its leave starts there instead of jumping back to 0\n let leaveFromX = 0\n let leaveFromOpacity = 1\n\n function navSlideEnter(el: Element, done: () => void) {\n const dir = navDirection.value === 'forward' ? 1 : -1\n const anim = (el as HTMLElement).animate(\n [\n { transform: `translateX(${dir * SHARED_AXIS_OFFSET}px)`, opacity: 0 },\n { transform: 'translateX(0)', opacity: 1 },\n ],\n { duration: 300, delay: 60, easing: 'cubic-bezier(0.05,0.7,0.1,1)', fill: 'backwards' },\n )\n anim.onfinish = done\n }\n\n function navSlideLeave(el: Element, done: () => void) {\n const dir = navDirection.value === 'forward' ? -1 : 1\n const htmlEl = el as HTMLElement\n htmlEl.style.position = 'absolute'\n htmlEl.style.insetInline = '0'\n htmlEl.style.top = '0'\n const from = leaveFromX\n const opacity = leaveFromOpacity\n leaveFromX = 0\n leaveFromOpacity = 1\n const anim = htmlEl.animate(\n [\n { transform: `translateX(${from}px)`, opacity },\n { transform: `translateX(${from + dir * SHARED_AXIS_OFFSET}px)`, opacity: 0 },\n ],\n { duration: 90, easing: 'cubic-bezier(0.3,0,0.8,0.15)', fill: 'forwards' },\n )\n anim.onfinish = done\n }\n\n function resizeAround(change: () => void) {\n const el = navBox.value\n const from = el?.offsetHeight ?? 0\n // Both levels overflow for a moment: no scrollbar until they settle, then the wrapper's own inline value\n const prevOverflow = el?.style.overflowY ?? ''\n if (el) el.style.overflowY = 'hidden'\n const restore = () => { if (el) el.style.overflowY = prevOverflow }\n change()\n if (!el || prefersReducedMotion()) return restore()\n nextTick(() => {\n const to = el.offsetHeight\n const anim = Math.abs(to - from) < 1 ? null\n : playSamples(el, sampleSpring(from, to, 0, motionSprings.standard.defaultSpatial, 0.5), (h) => ({ height: `${h}px` }))\n const slide = new Promise((r) => setTimeout(r, SLIDE_SETTLE_MS))\n Promise.all([slide, anim?.finished.catch(() => {})]).then(restore)\n })\n }\n\n function pushNav(entry: MenuNavEntry) {\n navDirection.value = 'forward'\n resizeAround(() => navStack.value.push(entry))\n nextTick(focusFirst)\n }\n\n function popNav() {\n navDirection.value = 'backward'\n resizeAround(() => navStack.value.pop())\n nextTick(focusFirst)\n }\n\n function resetNav() {\n navStack.value = []\n }\n\n // Swipe back. The wrapper has `touch-action: pan-y` while a level is pushed, so a sideways drag reaches us\n // as pointer events while vertical ones still scroll the list\n let swipe: { id: number, x: number, y: number, level: HTMLElement, width: number, active: boolean, lastX: number, lastT: number, vel: number } | null = null\n\n function levelEl() {\n // The level on screen (a level still leaving has another depth)\n return navBox.value?.querySelector<HTMLElement>(`:scope > [data-menu-level=\"${navStack.value.length}\"]`) ?? null\n }\n\n function onNavPointerDown(e: PointerEvent) {\n if (e.pointerType !== 'touch' || !navStack.value.length || swipe) return\n const level = levelEl()\n if (!level) return\n swipe = { id: e.pointerId, x: e.clientX, y: e.clientY, level, width: navBox.value!.clientWidth, active: false, lastX: e.clientX, lastT: e.timeStamp, vel: 0 }\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onCancel)\n }\n\n function writeDrag(dx: number) {\n if (!swipe) return\n swipe.level.style.transform = `translateX(${dx}px)`\n swipe.level.style.opacity = String(1 - 0.5 * Math.min(1, dx / swipe.width))\n }\n\n function onMove(e: PointerEvent) {\n if (!swipe || e.pointerId !== swipe.id) return\n const dx = e.clientX - swipe.x\n const dy = e.clientY - swipe.y\n if (!swipe.active) {\n if (Math.hypot(dx, dy) < SWIPE_SLOP) return\n // Vertical (a scroll) or leftwards: not ours\n if (Math.abs(dy) > Math.abs(dx) || dx < 0) return stopListening()\n swipe.active = true\n swipe.x = e.clientX\n swipe.level.getAnimations().forEach((a) => a.finish())\n }\n const dt = e.timeStamp - swipe.lastT\n if (dt > 0) swipe.vel = 0.8 * ((e.clientX - swipe.lastX) / dt) + 0.2 * swipe.vel\n swipe.lastX = e.clientX\n swipe.lastT = e.timeStamp\n writeDrag(Math.max(0, e.clientX - swipe.x))\n }\n\n function onUp(e: PointerEvent) {\n if (!swipe || e.pointerId !== swipe.id) return\n const s = swipe\n stopListening()\n if (!s.active) return\n // The finger lifted on an item: that's not a tap on it. The click comes in a later task, so the guard\n // waits for it a little while\n window.addEventListener('click', swallowClick, { capture: true, once: true })\n clearTimeout(swallowTimer)\n swallowTimer = setTimeout(stopSwallowing, 400)\n const dx = Math.max(0, e.clientX - s.x)\n if (dx > s.width * SWIPE_DISTANCE || s.vel > SWIPE_VELOCITY) {\n leaveFromX = dx\n leaveFromOpacity = Number(s.level.style.opacity || 1)\n popNav()\n }\n else settleBack(s.level, dx)\n }\n\n function onCancel(e: PointerEvent) {\n if (!swipe || e.pointerId !== swipe.id) return\n const s = swipe\n stopListening()\n if (s.active) settleBack(s.level, Math.max(0, s.lastX - s.x))\n }\n\n function settleBack(level: HTMLElement, dx: number) {\n level.style.transform = ''\n level.style.opacity = ''\n if (prefersReducedMotion() || dx < 1) return\n const width = navBox.value?.clientWidth || 1\n playSamples(level, sampleSpring(dx, 0, 0, motionSprings.standard.defaultSpatial, 0.5), (x) => ({\n transform: `translateX(${x}px)`,\n opacity: String(1 - 0.5 * Math.min(1, x / width)),\n }))\n }\n\n let swallowTimer: ReturnType<typeof setTimeout> | undefined\n function stopSwallowing() {\n clearTimeout(swallowTimer)\n window.removeEventListener('click', swallowClick, { capture: true })\n }\n\n function swallowClick(e: Event) {\n e.stopPropagation()\n e.preventDefault()\n }\n\n function stopListening() {\n swipe = null\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onCancel)\n }\n\n onUnmounted(() => {\n stopListening()\n stopSwallowing()\n })\n\n return { navStack, currentNav, navBox, navSlideEnter, navSlideLeave, pushNav, popNav, resetNav, onNavPointerDown }\n}\n","/*\n * Internal (not exported from index.ts): keeps a popup on screen along one axis, after Compose's\n * DropdownMenuPositionProvider (material3/internal/MenuPosition.kt). The candidates are tried in order and the\n * first that fits inside the window, MARGIN in from its edges (MenuHorizontalMargin), wins; when none does, a\n * popup wider than the window minus the margins is centered, anything else is clamped inside them.\n *\n * Measure the popup with nothing constraining its width (no `right`, no narrow `left`) before calling this:\n * a fixed element anchored on its right shrinks to the space on its left, which is the very overflow to avoid.\n */\n\n/** Compose's MenuHorizontalMargin (8dp). */\nexport const POPUP_MARGIN = 8\n\n/** The first candidate start position that keeps `size` inside `viewport`, else centered or clamped. */\nexport function fitPopup(candidates: number[], size: number, viewport: number, margin = POPUP_MARGIN): number {\n for (const x of candidates) {\n if (x >= margin && x + size <= viewport - margin) return x\n }\n if (size >= viewport - 2 * margin) return (viewport - size) / 2\n const last = candidates[candidates.length - 1] ?? margin\n return Math.min(viewport - margin - size, Math.max(margin, last))\n}\n\n/**\n * A dropdown's left edge: aligned with the anchor's start or end edge (`align` picks which is tried first), else\n * against the window edge on the anchor's side (MenuAnchorPosition.Below's xCandidates).\n */\nexport function dropdownX(\n anchor: { left: number; right: number },\n width: number,\n viewport: number,\n align: 'start' | 'end',\n margin = POPUP_MARGIN,\n): number {\n const start = anchor.left\n const end = anchor.right - width\n const windowSide = (anchor.left + anchor.right) / 2 < viewport / 2 ? margin : viewport - margin - width\n return fitPopup(align === 'start' ? [start, end, windowSide] : [end, start, windowSide], width, viewport, margin)\n}\n","<script setup lang=\"ts\">\n/**\n * A trigger-based dropdown menu, composed with `MMenuItem` and `MMenuDivider`. Items support unlimited-depth\n * nested submenus via the `#children` slot.\n *\n * @slot trigger The element that opens the menu when clicked; `open` tells whether it's open.\n * @slot default The menu's items (MMenuItem, MMenuDivider or your own markup); `close()` closes the menu.\n */\nimport { computed, Fragment, inject, nextTick, onMounted, onUnmounted, provide, ref, useSlots, watch, type VNode } from 'vue'\nimport MIcon from './MIcon.vue'\nimport MMenuDivider from './MMenuDivider.vue'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\nimport { useMenuNav } from '../composables/_useMenuNav'\nimport { POPUP_MARGIN, dropdownX } from '../composables/_popupPosition'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(\n defineProps<{\n /** Which edge of the trigger the dropdown aligns to. */\n align?: 'left' | 'right'\n /**\n * How items with a `#children` slot behave.\n * `'flyout'` opens a hover-positioned side panel (desktop).\n * `'push'` replaces the panel's own content with the submenu and a\n * back header — no positioning math, works with touch. Useful for mobile.\n */\n submenuMode?: 'flyout' | 'push'\n /**\n * 'standard' is M3's baseline menu (4dp corners). 'expressive' is M3's rounder 'vertical menu' styling\n * (16dp corners) — combine with `<MMenuDivider gap />` to split the panel into independently-rounded groups\n * with a visible gap, instead of a plain divider line.\n */\n // `'standard'` is M3's baseline menu — square-ish 4dp corners\n // (`MenuTokens.ContainerShape`/`CornerExtraSmall`).\n // `'expressive'` is M3's rounder \"vertical menu\" styling — 16dp corners\n // (`SegmentedMenuTokens.ContainerShape`/`CornerLarge`). Combine with\n // `<MMenuDivider gap />` to split the panel into independently-rounded\n // groups with a visible gap between them, instead of a plain line.\n variant?: 'standard' | 'expressive'\n }>(),\n { align: 'right', submenuMode: 'flyout', variant: 'standard' },\n)\n\nconst slots = useSlots()\n\nfunction flattenVNodes(vnodes: VNode[]): VNode[] {\n const out: VNode[] = []\n for (const vnode of vnodes) {\n if (vnode.type === Fragment && Array.isArray(vnode.children)) {\n out.push(...flattenVNodes(vnode.children as VNode[]))\n } else {\n out.push(vnode)\n }\n }\n return out\n}\n\nfunction isGapDivider(vnode: VNode): boolean {\n if (vnode.type !== MMenuDivider) return false\n const gap = (vnode.props as { gap?: unknown } | null)?.gap\n return gap === '' || gap === true || gap === 'true'\n}\n\n// Splits the default slot's content into groups at each `<MMenuDivider gap />`\n// — only used by the 'expressive' variant to render independently-rounded\n// group boxes. A plain `<MMenuDivider />` (no `gap`) stays a normal in-line\n// divider inside a single group, same as 'standard'.\nconst groups = computed(() => {\n if (props.variant !== 'expressive') return null\n const raw = flattenVNodes((slots.default?.({ close }) ?? []) as VNode[])\n const result: VNode[][] = [[]]\n for (const vnode of raw) {\n if (isGapDivider(vnode)) result.push([])\n else result[result.length - 1]!.push(vnode)\n }\n return result.filter(g => g.length > 0)\n})\nconst isGrouped = computed(() => !!groups.value && groups.value.length > 1)\n\nconst { navStack, currentNav, navBox, navSlideEnter, navSlideLeave, pushNav, popNav, onNavPointerDown } = useMenuNav(() => focusFirstItem())\n\n// The real DropdownMenuContent in Menu.kt animates scale (0.8 -> 1) and alpha\n// (0 -> 1) with actual springs (MotionSchemeKeyTokens.FastSpatial/FastEffects\n// on the Standard scheme, StandardMotionTokens: scale dampingRatio 0.9/\n// stiffness 1400, alpha dampingRatio 1.0/stiffness 3800) — not a duration+\n// easing tween, which is why a cubic-bezier stand-in read as an abrupt cut on\n// close (a bezier can't carry a spring's momentum). But running the *close*\n// as its own independent spring toward the opposite target isn't right\n// either: alpha (stiffness 3800) settles much faster than scale (stiffness\n// 1400), so on close the panel fades to invisible well before it finishes\n// shrinking — you never actually see the shrink. On open this isn't a\n// problem (it becomes visible early, *then* you watch it keep growing), but\n// close needs to be the literal time-reverse of open, not a forward\n// simulation toward reversed targets, so the shrink stays visible the whole\n// time and only the fade races ahead right at the very end (mirroring how\n// the fade led at the very start of open). Simulated once (open direction\n// only) and played back forwards for enter, backwards for leave.\n//\n// A damped spring approaches its target exponentially, so it keeps \"settling\"\n// long after the motion is visually done — with a tight (0.001) tolerance on\n// both position *and* velocity, roughly the last third of the recorded\n// trajectory is values within a fraction of a percent of the target, visually\n// indistinguishable from it. Reversed for close, that flat tail lands at the\n// *start* instead, so nothing visibly happens for the first ~80ms before the\n// close animation actually appears to begin. Trimmed on position alone with a\n// much looser tolerance instead, since that's what's actually visible.\nlet cachedTrajectory: { scale: number, alpha: number }[] | null = null\nconst trajectoryStep = 1 / 240\nfunction openTrajectory() {\n if (cachedTrajectory) return cachedTrajectory\n const samples: { scale: number, alpha: number }[] = []\n let scale = 0.8\n let scaleVel = 0\n let alpha = 0\n let alphaVel = 0\n const scaleDamping = 0.9\n const scaleStiffness = 1400\n const alphaDamping = 1.0\n const alphaStiffness = 3800\n for (let t = 0; t < 1; t += trajectoryStep) {\n samples.push({ scale, alpha })\n scaleVel += (-scaleStiffness * (scale - 1) - 2 * scaleDamping * Math.sqrt(scaleStiffness) * scaleVel) * trajectoryStep\n scale += scaleVel * trajectoryStep\n alphaVel += (-alphaStiffness * (alpha - 1) - 2 * alphaDamping * Math.sqrt(alphaStiffness) * alphaVel) * trajectoryStep\n alpha += alphaVel * trajectoryStep\n const visuallySettled = Math.abs(scale - 1) < 0.003 && Math.abs(alpha - 1) < 0.003\n if (visuallySettled) break\n }\n samples.push({ scale: 1, alpha: 1 })\n cachedTrajectory = samples\n return samples\n}\n\n// Vue interrupts and reverses this mid-flight when the menu is toggled\n// quickly (close while still opening, or vice versa) — it calls the other\n// hook on the same still-mounted element without waiting for `done()`. Both\n// `currentIdx` (how far along the trajectory we are, so a reversal continues\n// smoothly from wherever it currently is instead of snapping back to a fixed\n// start) and `cancelActive` (so the previous animation actually stops instead\n// of running alongside the new one, fighting over the same style) have to live outside this function to survive that interruption.\nlet currentIdx = 0\nlet cancelActive: (() => void) | null = null\n// Set only while a close is playing: stops the animation *and* calls its `done()`.\n// Used on unmount — a menu item that navigates away (e.g. \"Log out\" ->\n// router.push) unmounts this component mid-close, and Vue only removes the\n// Teleported panel from <body> inside the leave's `done()`, so merely\n// cancelling the animation there left the half-closed panel stranded on screen.\nlet finishLeave: (() => void) | null = null\n\nfunction playTrajectory(el: Element, done: () => void, opening: boolean) {\n cancelActive?.()\n const htmlEl = el as HTMLElement\n const samples = openTrajectory()\n const last = samples.length - 1\n const from = Math.round(Math.max(0, Math.min(last, currentIdx)))\n const to = opening ? last : 0\n const step = opening ? 1 : -1\n const frames: { scale: number, alpha: number }[] = []\n for (let i = from; opening ? i <= to : i >= to; i += step) frames.push(samples[i]!)\n const style = (s: { scale: number, alpha: number }) => ({\n transform: `scale(${s.scale})`,\n opacity: String(Math.min(1, Math.max(0, s.alpha))),\n })\n // Played as a Web Animation (see _springAnimation.ts), which the compositor runs, so the open isn't janked by\n // the panel's content mounting at the same moment. The end state goes inline underneath it.\n Object.assign(htmlEl.style, style(samples[to]!))\n let ended = false\n function complete() {\n if (ended) return\n ended = true\n currentIdx = to\n cancelActive = null\n finishLeave = null\n done()\n }\n if (frames.length < 2 || typeof htmlEl.animate !== 'function') return complete()\n const anim = htmlEl.animate(frames.map(style), { duration: (frames.length - 1) * trajectoryStep * 1000, easing: 'linear' })\n anim.finished.catch(() => {})\n anim.onfinish = complete\n cancelActive = () => {\n // Remember where it got to, so the reversal continues from there\n const t = Number(anim.currentTime ?? 0) / (trajectoryStep * 1000)\n currentIdx = Math.max(0, Math.min(last, from + step * t))\n ended = true\n anim.cancel()\n }\n finishLeave = opening ? null : () => { cancelActive?.(); cancelActive = null; finishLeave = null; done() }\n}\nfunction panelEnter(el: Element, done: () => void) {\n placeX(el as HTMLElement)\n playTrajectory(el, done, true)\n}\nfunction panelLeave(el: Element, done: () => void) {\n playTrajectory(el, done, false)\n}\n\nconst open = ref(false)\nconst triggerEl = ref<HTMLElement | null>(null)\nconst dropdownEl = ref<HTMLElement | null>(null)\nconst dropStyle = ref<Record<string, string>>({})\n\n// A menu can be nested inside another MMenu/MContextMenu's slot (e.g. a\n// \"Language\" picker menu inside a \"More options\" overflow menu) — since both\n// Teleport straight to <body>, the outer one's panel DOM never contains the\n// inner one's, so the outer's outside-click check would otherwise see a click\n// inside the nested menu as \"outside\" and close (unmount) itself on\n// mousedown, before the inner button's own click can fire. Sharing one\n// registry of open panel elements across the whole logical (not DOM) menu\n// tree via provide/inject fixes that for arbitrary nesting depth.\nconst panelRegistry = inject<Set<HTMLElement>>('m-menu-panel-registry', new Set())\nprovide('m-menu-panel-registry', panelRegistry)\n\nwatch(dropdownEl, (el, oldEl) => {\n if (oldEl) panelRegistry.delete(oldEl)\n if (el) panelRegistry.add(el)\n})\n\nonUnmounted(() => {\n if (dropdownEl.value) panelRegistry.delete(dropdownEl.value)\n})\n\n// Separate from panelRegistry above: that one is shared all the way down the\n// nesting chain so a click inside a descendant menu never closes an ancestor.\n// This one is scoped to just this menu's *direct* children (e.g. \"Language\"\n// and \"Color palette\", both nested inside the same \"More options\" menu) —\n// without it, opening one no longer closes the other (since panelRegistry now\n// treats a click on either as \"inside\" the shared ancestor), so two sibling\n// pickers could stay open at once. Only one child of the same parent open at\n// a time, like an accordion; doesn't affect unrelated top-level menus.\nconst siblingGroup = inject<{ current: (() => void) | null } | null>('m-menu-sibling-group', null)\nprovide('m-menu-sibling-group', { current: null })\n\n// The vertical side and height from the trigger alone; the horizontal position needs the panel's width, so\n// placeX() sets it once the panel is in the DOM (in its enter hook, before it paints). Until then it sits at the\n// window's left edge, where nothing narrows it while it's measured.\nlet anchorRect: DOMRect | null = null\nconst openAbove = ref(false)\nfunction computePos() {\n if (!triggerEl.value) return\n const rect = triggerEl.value.getBoundingClientRect()\n anchorRect = rect\n const spaceBelow = window.innerHeight - rect.bottom - 8\n openAbove.value = spaceBelow < 200 && rect.top > spaceBelow\n\n const style: Record<string, string> = {\n maxHeight: `${Math.min(openAbove.value ? rect.top - 12 : spaceBelow, 400)}px`,\n maxWidth: `${window.innerWidth - 2 * POPUP_MARGIN}px`,\n left: '0px',\n }\n\n if (openAbove.value) {\n style.bottom = `${window.innerHeight - rect.top + 4}px`\n } else {\n style.top = `${rect.bottom + 4}px`\n }\n\n dropStyle.value = style\n}\n\n// Keeps the panel on screen (Compose's DropdownMenuPositionProvider, see _popupPosition.ts): aligned with the\n// trigger's `align` edge if it fits there, else its other edge, else against the window edge on its side. The\n// animation grows from the trigger, wherever the panel ended up.\nconst originX = ref(props.align === 'right' ? 'right' : 'left')\nfunction placeX(el: HTMLElement) {\n if (!anchorRect) return\n const width = el.offsetWidth\n const x = dropdownX(anchorRect, width, window.innerWidth, props.align === 'right' ? 'end' : 'start')\n const pivot = Math.min(width, Math.max(0, (anchorRect.left + anchorRect.right) / 2 - x))\n const fromEdge = Math.abs(x - anchorRect.left) < 1 ? 'left' : Math.abs(x + width - anchorRect.right) < 1 ? 'right' : `${pivot}px`\n originX.value = fromEdge\n dropStyle.value = { ...dropStyle.value, left: `${x}px` }\n // Now, not on the next render: the enter animation starts this frame\n el.style.left = `${x}px`\n el.style.transformOrigin = `${fromEdge} ${openAbove.value ? 'bottom' : 'top'}`\n}\n\nfunction focusableItems() {\n if (!dropdownEl.value) return []\n return Array.from(\n dropdownEl.value.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]'),\n )\n}\n\nfunction focusFirstItem() {\n nextTick(() => focusableItems()[0]?.focus())\n}\n\nfunction moveFocus(dir: 1 | -1) {\n const items = focusableItems()\n if (!items.length) return\n const idx = items.indexOf(document.activeElement as HTMLElement)\n const next = idx === -1\n ? (dir === 1 ? items[0] : items[items.length - 1])\n : items[(idx + dir + items.length) % items.length]\n next?.focus()\n}\n\nfunction toggle() {\n if (!open.value) {\n if (siblingGroup && siblingGroup.current && siblingGroup.current !== close) {\n siblingGroup.current()\n }\n if (siblingGroup) siblingGroup.current = close\n computePos()\n navStack.value = []\n } else if (siblingGroup?.current === close) {\n siblingGroup.current = null\n }\n open.value = !open.value\n if (open.value) focusFirstItem()\n}\n\nfunction close() {\n if (siblingGroup?.current === close) siblingGroup.current = null\n open.value = false\n}\n\nprovide('m-menu-close', close)\nprovide('m-menu-nav', { mode: props.submenuMode, push: pushNav })\ndefineExpose({ close, open })\n\nfunction onOutsideClick(e: MouseEvent) {\n const t = e.target as Node\n if (triggerEl.value?.contains(t)) return\n for (const panel of panelRegistry) {\n if (panel.contains(t)) return\n }\n if ((t as Element).closest?.('.m3-submenu')) return\n close()\n}\n\n// Scrolling inside any panel of this menu tree (own, or a nested menu's\n// Teleported panel) isn't an \"outside\" scroll — same registry as onOutsideClick\nfunction onScroll(e: Event) {\n if (!open.value) return\n const t = e.target as Node\n for (const panel of panelRegistry) {\n if (panel.contains(t)) return\n }\n if ((t as Element).closest?.('.m3-submenu')) return\n close()\n}\n\n// Escape goes through the library's stack, so a menu open in a dialog or an overlay closes alone (a pushed\n// submenu steps back first)\nuseEscapeStack(() => open.value, () => (navStack.value.length ? popNav() : close()))\n\nfunction onKeydown(e: KeyboardEvent) {\n if (!open.value) return\n if (e.key === 'ArrowDown') { e.preventDefault(); moveFocus(1) }\n else if (e.key === 'ArrowUp') { e.preventDefault(); moveFocus(-1) }\n}\n\nonMounted(() => {\n document.addEventListener('mousedown', onOutsideClick)\n document.addEventListener('keydown', onKeydown)\n window.addEventListener('scroll', onScroll, true)\n})\n\nonUnmounted(() => {\n document.removeEventListener('mousedown', onOutsideClick)\n document.removeEventListener('keydown', onKeydown)\n window.removeEventListener('scroll', onScroll, true)\n if (finishLeave) finishLeave()\n else cancelActive?.()\n})\n\nconst origin = computed(() => `${originX.value} ${openAbove.value ? 'bottom' : 'top'}`)\n</script>\n\n<template>\n <div ref=\"triggerEl\" v-bind=\"$attrs\" class=\"inline-block\" @click=\"toggle\">\n <slot name=\"trigger\" :open=\"open\" />\n </div>\n\n <Teleport to=\"body\">\n <Transition :css=\"false\" @enter=\"panelEnter\" @leave=\"panelLeave\">\n <div\n v-if=\"open\"\n ref=\"dropdownEl\"\n class=\"fixed z-500 min-w-48\"\n :class=\"[\n variant === 'expressive' ? 'rounded-lg' : 'rounded-xs',\n isGrouped ? '' : 'shadow-elevation-2',\n ]\"\n :style=\"{ ...dropStyle, transformOrigin: origin }\"\n >\n <!-- overflow-hidden (for the rounded-corner clip and to clip the push\n submenu's slide) lives on this inner wrapper, never together with\n shadow-elevation-2 on the same box — overflow-hidden clips an\n element's own box-shadow too, so the two have to be on separate\n elements or the shadow gets cut off -->\n <div\n class=\"overflow-hidden\"\n :class=\"[\n variant === 'expressive' ? 'rounded-lg' : 'rounded-xs',\n isGrouped ? '' : 'bg-surface-container',\n ]\"\n >\n <div\n ref=\"navBox\"\n class=\"relative overflow-x-hidden overflow-y-auto overscroll-contain py-1\"\n :style=\"{ maxHeight: dropStyle.maxHeight, touchAction: currentNav ? 'pan-y' : undefined }\"\n @pointerdown=\"onNavPointerDown\"\n >\n <Transition :css=\"false\" @enter=\"navSlideEnter\" @leave=\"navSlideLeave\">\n <div v-if=\"currentNav\" :key=\"navStack.length\" :data-menu-level=\"navStack.length\">\n <!-- Back: a header row in the menu's own item metrics, labelled like an M3 menu group, then a divider -->\n <button\n type=\"button\"\n class=\"flex w-full items-center gap-3 px-4 py-2.5 text-left text-label-large text-on-surface-variant outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary\"\n @click=\"popNav\"\n >\n <MIcon name=\"arrow_back\" :size=\"20\" class=\"shrink-0\" />\n <span class=\"flex-1 truncate\"><component :is=\"() => currentNav?.header?.()\" /></span>\n </button>\n <hr class=\"my-1 border-outline-variant\" />\n <component :is=\"() => currentNav?.content?.()\" />\n </div>\n <div v-else key=\"root\">\n <div v-if=\"isGrouped\" class=\"flex flex-col gap-1 px-1.5\">\n <div v-for=\"(group, i) in groups\" :key=\"i\" class=\"rounded-lg shadow-elevation-2\">\n <div class=\"overflow-hidden rounded-lg bg-surface-container\">\n <component :is=\"() => group\" />\n </div>\n </div>\n </div>\n <slot v-else :close=\"close\" />\n </div>\n </Transition>\n </div>\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A trigger-based dropdown menu, composed with `MMenuItem` and `MMenuDivider`. Items support unlimited-depth\n * nested submenus via the `#children` slot.\n *\n * @slot trigger The element that opens the menu when clicked; `open` tells whether it's open.\n * @slot default The menu's items (MMenuItem, MMenuDivider or your own markup); `close()` closes the menu.\n */\nimport { computed, Fragment, inject, nextTick, onMounted, onUnmounted, provide, ref, useSlots, watch, type VNode } from 'vue'\nimport MIcon from './MIcon.vue'\nimport MMenuDivider from './MMenuDivider.vue'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\nimport { useMenuNav } from '../composables/_useMenuNav'\nimport { POPUP_MARGIN, dropdownX } from '../composables/_popupPosition'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(\n defineProps<{\n /** Which edge of the trigger the dropdown aligns to. */\n align?: 'left' | 'right'\n /**\n * How items with a `#children` slot behave.\n * `'flyout'` opens a hover-positioned side panel (desktop).\n * `'push'` replaces the panel's own content with the submenu and a\n * back header — no positioning math, works with touch. Useful for mobile.\n */\n submenuMode?: 'flyout' | 'push'\n /**\n * 'standard' is M3's baseline menu (4dp corners). 'expressive' is M3's rounder 'vertical menu' styling\n * (16dp corners) — combine with `<MMenuDivider gap />` to split the panel into independently-rounded groups\n * with a visible gap, instead of a plain divider line.\n */\n // `'standard'` is M3's baseline menu — square-ish 4dp corners\n // (`MenuTokens.ContainerShape`/`CornerExtraSmall`).\n // `'expressive'` is M3's rounder \"vertical menu\" styling — 16dp corners\n // (`SegmentedMenuTokens.ContainerShape`/`CornerLarge`). Combine with\n // `<MMenuDivider gap />` to split the panel into independently-rounded\n // groups with a visible gap between them, instead of a plain line.\n variant?: 'standard' | 'expressive'\n }>(),\n { align: 'right', submenuMode: 'flyout', variant: 'standard' },\n)\n\nconst slots = useSlots()\n\nfunction flattenVNodes(vnodes: VNode[]): VNode[] {\n const out: VNode[] = []\n for (const vnode of vnodes) {\n if (vnode.type === Fragment && Array.isArray(vnode.children)) {\n out.push(...flattenVNodes(vnode.children as VNode[]))\n } else {\n out.push(vnode)\n }\n }\n return out\n}\n\nfunction isGapDivider(vnode: VNode): boolean {\n if (vnode.type !== MMenuDivider) return false\n const gap = (vnode.props as { gap?: unknown } | null)?.gap\n return gap === '' || gap === true || gap === 'true'\n}\n\n// Splits the default slot's content into groups at each `<MMenuDivider gap />`\n// — only used by the 'expressive' variant to render independently-rounded\n// group boxes. A plain `<MMenuDivider />` (no `gap`) stays a normal in-line\n// divider inside a single group, same as 'standard'.\nconst groups = computed(() => {\n if (props.variant !== 'expressive') return null\n const raw = flattenVNodes((slots.default?.({ close }) ?? []) as VNode[])\n const result: VNode[][] = [[]]\n for (const vnode of raw) {\n if (isGapDivider(vnode)) result.push([])\n else result[result.length - 1]!.push(vnode)\n }\n return result.filter(g => g.length > 0)\n})\nconst isGrouped = computed(() => !!groups.value && groups.value.length > 1)\n\nconst { navStack, currentNav, navBox, navSlideEnter, navSlideLeave, pushNav, popNav, onNavPointerDown } = useMenuNav(() => focusFirstItem())\n\n// The real DropdownMenuContent in Menu.kt animates scale (0.8 -> 1) and alpha\n// (0 -> 1) with actual springs (MotionSchemeKeyTokens.FastSpatial/FastEffects\n// on the Standard scheme, StandardMotionTokens: scale dampingRatio 0.9/\n// stiffness 1400, alpha dampingRatio 1.0/stiffness 3800) — not a duration+\n// easing tween, which is why a cubic-bezier stand-in read as an abrupt cut on\n// close (a bezier can't carry a spring's momentum). But running the *close*\n// as its own independent spring toward the opposite target isn't right\n// either: alpha (stiffness 3800) settles much faster than scale (stiffness\n// 1400), so on close the panel fades to invisible well before it finishes\n// shrinking — you never actually see the shrink. On open this isn't a\n// problem (it becomes visible early, *then* you watch it keep growing), but\n// close needs to be the literal time-reverse of open, not a forward\n// simulation toward reversed targets, so the shrink stays visible the whole\n// time and only the fade races ahead right at the very end (mirroring how\n// the fade led at the very start of open). Simulated once (open direction\n// only) and played back forwards for enter, backwards for leave.\n//\n// A damped spring approaches its target exponentially, so it keeps \"settling\"\n// long after the motion is visually done — with a tight (0.001) tolerance on\n// both position *and* velocity, roughly the last third of the recorded\n// trajectory is values within a fraction of a percent of the target, visually\n// indistinguishable from it. Reversed for close, that flat tail lands at the\n// *start* instead, so nothing visibly happens for the first ~80ms before the\n// close animation actually appears to begin. Trimmed on position alone with a\n// much looser tolerance instead, since that's what's actually visible.\nlet cachedTrajectory: { scale: number, alpha: number }[] | null = null\nconst trajectoryStep = 1 / 240\nfunction openTrajectory() {\n if (cachedTrajectory) return cachedTrajectory\n const samples: { scale: number, alpha: number }[] = []\n let scale = 0.8\n let scaleVel = 0\n let alpha = 0\n let alphaVel = 0\n const scaleDamping = 0.9\n const scaleStiffness = 1400\n const alphaDamping = 1.0\n const alphaStiffness = 3800\n for (let t = 0; t < 1; t += trajectoryStep) {\n samples.push({ scale, alpha })\n scaleVel += (-scaleStiffness * (scale - 1) - 2 * scaleDamping * Math.sqrt(scaleStiffness) * scaleVel) * trajectoryStep\n scale += scaleVel * trajectoryStep\n alphaVel += (-alphaStiffness * (alpha - 1) - 2 * alphaDamping * Math.sqrt(alphaStiffness) * alphaVel) * trajectoryStep\n alpha += alphaVel * trajectoryStep\n const visuallySettled = Math.abs(scale - 1) < 0.003 && Math.abs(alpha - 1) < 0.003\n if (visuallySettled) break\n }\n samples.push({ scale: 1, alpha: 1 })\n cachedTrajectory = samples\n return samples\n}\n\n// Vue interrupts and reverses this mid-flight when the menu is toggled\n// quickly (close while still opening, or vice versa) — it calls the other\n// hook on the same still-mounted element without waiting for `done()`. Both\n// `currentIdx` (how far along the trajectory we are, so a reversal continues\n// smoothly from wherever it currently is instead of snapping back to a fixed\n// start) and `cancelActive` (so the previous animation actually stops instead\n// of running alongside the new one, fighting over the same style) have to live outside this function to survive that interruption.\nlet currentIdx = 0\nlet cancelActive: (() => void) | null = null\n// Set only while a close is playing: stops the animation *and* calls its `done()`.\n// Used on unmount — a menu item that navigates away (e.g. \"Log out\" ->\n// router.push) unmounts this component mid-close, and Vue only removes the\n// Teleported panel from <body> inside the leave's `done()`, so merely\n// cancelling the animation there left the half-closed panel stranded on screen.\nlet finishLeave: (() => void) | null = null\n\nfunction playTrajectory(el: Element, done: () => void, opening: boolean) {\n cancelActive?.()\n const htmlEl = el as HTMLElement\n const samples = openTrajectory()\n const last = samples.length - 1\n const from = Math.round(Math.max(0, Math.min(last, currentIdx)))\n const to = opening ? last : 0\n const step = opening ? 1 : -1\n const frames: { scale: number, alpha: number }[] = []\n for (let i = from; opening ? i <= to : i >= to; i += step) frames.push(samples[i]!)\n const style = (s: { scale: number, alpha: number }) => ({\n transform: `scale(${s.scale})`,\n opacity: String(Math.min(1, Math.max(0, s.alpha))),\n })\n // Played as a Web Animation (see _springAnimation.ts), which the compositor runs, so the open isn't janked by\n // the panel's content mounting at the same moment. The end state goes inline underneath it.\n Object.assign(htmlEl.style, style(samples[to]!))\n let ended = false\n function complete() {\n if (ended) return\n ended = true\n currentIdx = to\n cancelActive = null\n finishLeave = null\n done()\n }\n if (frames.length < 2 || typeof htmlEl.animate !== 'function') return complete()\n const anim = htmlEl.animate(frames.map(style), { duration: (frames.length - 1) * trajectoryStep * 1000, easing: 'linear' })\n anim.finished.catch(() => {})\n anim.onfinish = complete\n cancelActive = () => {\n // Remember where it got to, so the reversal continues from there\n const t = Number(anim.currentTime ?? 0) / (trajectoryStep * 1000)\n currentIdx = Math.max(0, Math.min(last, from + step * t))\n ended = true\n anim.cancel()\n }\n finishLeave = opening ? null : () => { cancelActive?.(); cancelActive = null; finishLeave = null; done() }\n}\nfunction panelEnter(el: Element, done: () => void) {\n placeX(el as HTMLElement)\n playTrajectory(el, done, true)\n}\nfunction panelLeave(el: Element, done: () => void) {\n playTrajectory(el, done, false)\n}\n\nconst open = ref(false)\nconst triggerEl = ref<HTMLElement | null>(null)\nconst dropdownEl = ref<HTMLElement | null>(null)\nconst dropStyle = ref<Record<string, string>>({})\n\n// A menu can be nested inside another MMenu/MContextMenu's slot (e.g. a\n// \"Language\" picker menu inside a \"More options\" overflow menu) — since both\n// Teleport straight to <body>, the outer one's panel DOM never contains the\n// inner one's, so the outer's outside-click check would otherwise see a click\n// inside the nested menu as \"outside\" and close (unmount) itself on\n// mousedown, before the inner button's own click can fire. Sharing one\n// registry of open panel elements across the whole logical (not DOM) menu\n// tree via provide/inject fixes that for arbitrary nesting depth.\nconst panelRegistry = inject<Set<HTMLElement>>('m-menu-panel-registry', new Set())\nprovide('m-menu-panel-registry', panelRegistry)\n\nwatch(dropdownEl, (el, oldEl) => {\n if (oldEl) panelRegistry.delete(oldEl)\n if (el) panelRegistry.add(el)\n})\n\nonUnmounted(() => {\n if (dropdownEl.value) panelRegistry.delete(dropdownEl.value)\n})\n\n// Separate from panelRegistry above: that one is shared all the way down the\n// nesting chain so a click inside a descendant menu never closes an ancestor.\n// This one is scoped to just this menu's *direct* children (e.g. \"Language\"\n// and \"Color palette\", both nested inside the same \"More options\" menu) —\n// without it, opening one no longer closes the other (since panelRegistry now\n// treats a click on either as \"inside\" the shared ancestor), so two sibling\n// pickers could stay open at once. Only one child of the same parent open at\n// a time, like an accordion; doesn't affect unrelated top-level menus.\nconst siblingGroup = inject<{ current: (() => void) | null } | null>('m-menu-sibling-group', null)\nprovide('m-menu-sibling-group', { current: null })\n\n// The vertical side and height from the trigger alone; the horizontal position needs the panel's width, so\n// placeX() sets it once the panel is in the DOM (in its enter hook, before it paints). Until then it sits at the\n// window's left edge, where nothing narrows it while it's measured.\nlet anchorRect: DOMRect | null = null\nconst openAbove = ref(false)\nfunction computePos() {\n if (!triggerEl.value) return\n const rect = triggerEl.value.getBoundingClientRect()\n anchorRect = rect\n const spaceBelow = window.innerHeight - rect.bottom - 8\n openAbove.value = spaceBelow < 200 && rect.top > spaceBelow\n\n const style: Record<string, string> = {\n maxHeight: `${Math.min(openAbove.value ? rect.top - 12 : spaceBelow, 400)}px`,\n maxWidth: `${window.innerWidth - 2 * POPUP_MARGIN}px`,\n left: '0px',\n }\n\n if (openAbove.value) {\n style.bottom = `${window.innerHeight - rect.top + 4}px`\n } else {\n style.top = `${rect.bottom + 4}px`\n }\n\n dropStyle.value = style\n}\n\n// Keeps the panel on screen (Compose's DropdownMenuPositionProvider, see _popupPosition.ts): aligned with the\n// trigger's `align` edge if it fits there, else its other edge, else against the window edge on its side. The\n// animation grows from the trigger, wherever the panel ended up.\nconst originX = ref(props.align === 'right' ? 'right' : 'left')\nfunction placeX(el: HTMLElement) {\n if (!anchorRect) return\n const width = el.offsetWidth\n const x = dropdownX(anchorRect, width, window.innerWidth, props.align === 'right' ? 'end' : 'start')\n const pivot = Math.min(width, Math.max(0, (anchorRect.left + anchorRect.right) / 2 - x))\n const fromEdge = Math.abs(x - anchorRect.left) < 1 ? 'left' : Math.abs(x + width - anchorRect.right) < 1 ? 'right' : `${pivot}px`\n originX.value = fromEdge\n dropStyle.value = { ...dropStyle.value, left: `${x}px` }\n // Now, not on the next render: the enter animation starts this frame\n el.style.left = `${x}px`\n el.style.transformOrigin = `${fromEdge} ${openAbove.value ? 'bottom' : 'top'}`\n}\n\nfunction focusableItems() {\n if (!dropdownEl.value) return []\n return Array.from(\n dropdownEl.value.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]'),\n )\n}\n\nfunction focusFirstItem() {\n nextTick(() => focusableItems()[0]?.focus())\n}\n\nfunction moveFocus(dir: 1 | -1) {\n const items = focusableItems()\n if (!items.length) return\n const idx = items.indexOf(document.activeElement as HTMLElement)\n const next = idx === -1\n ? (dir === 1 ? items[0] : items[items.length - 1])\n : items[(idx + dir + items.length) % items.length]\n next?.focus()\n}\n\nfunction toggle() {\n if (!open.value) {\n if (siblingGroup && siblingGroup.current && siblingGroup.current !== close) {\n siblingGroup.current()\n }\n if (siblingGroup) siblingGroup.current = close\n computePos()\n navStack.value = []\n } else if (siblingGroup?.current === close) {\n siblingGroup.current = null\n }\n open.value = !open.value\n if (open.value) focusFirstItem()\n}\n\nfunction close() {\n if (siblingGroup?.current === close) siblingGroup.current = null\n open.value = false\n}\n\nprovide('m-menu-close', close)\nprovide('m-menu-nav', { mode: props.submenuMode, push: pushNav })\ndefineExpose({ close, open })\n\nfunction onOutsideClick(e: MouseEvent) {\n const t = e.target as Node\n if (triggerEl.value?.contains(t)) return\n for (const panel of panelRegistry) {\n if (panel.contains(t)) return\n }\n if ((t as Element).closest?.('.m3-submenu')) return\n close()\n}\n\n// Scrolling inside any panel of this menu tree (own, or a nested menu's\n// Teleported panel) isn't an \"outside\" scroll — same registry as onOutsideClick\nfunction onScroll(e: Event) {\n if (!open.value) return\n const t = e.target as Node\n for (const panel of panelRegistry) {\n if (panel.contains(t)) return\n }\n if ((t as Element).closest?.('.m3-submenu')) return\n close()\n}\n\n// Escape goes through the library's stack, so a menu open in a dialog or an overlay closes alone (a pushed\n// submenu steps back first)\nuseEscapeStack(() => open.value, () => (navStack.value.length ? popNav() : close()))\n\nfunction onKeydown(e: KeyboardEvent) {\n if (!open.value) return\n if (e.key === 'ArrowDown') { e.preventDefault(); moveFocus(1) }\n else if (e.key === 'ArrowUp') { e.preventDefault(); moveFocus(-1) }\n}\n\nonMounted(() => {\n document.addEventListener('mousedown', onOutsideClick)\n document.addEventListener('keydown', onKeydown)\n window.addEventListener('scroll', onScroll, true)\n})\n\nonUnmounted(() => {\n document.removeEventListener('mousedown', onOutsideClick)\n document.removeEventListener('keydown', onKeydown)\n window.removeEventListener('scroll', onScroll, true)\n if (finishLeave) finishLeave()\n else cancelActive?.()\n})\n\nconst origin = computed(() => `${originX.value} ${openAbove.value ? 'bottom' : 'top'}`)\n</script>\n\n<template>\n <div ref=\"triggerEl\" v-bind=\"$attrs\" class=\"inline-block\" @click=\"toggle\">\n <slot name=\"trigger\" :open=\"open\" />\n </div>\n\n <Teleport to=\"body\">\n <Transition :css=\"false\" @enter=\"panelEnter\" @leave=\"panelLeave\">\n <div\n v-if=\"open\"\n ref=\"dropdownEl\"\n class=\"fixed z-500 min-w-48\"\n :class=\"[\n variant === 'expressive' ? 'rounded-lg' : 'rounded-xs',\n isGrouped ? '' : 'shadow-elevation-2',\n ]\"\n :style=\"{ ...dropStyle, transformOrigin: origin }\"\n >\n <!-- overflow-hidden (for the rounded-corner clip and to clip the push\n submenu's slide) lives on this inner wrapper, never together with\n shadow-elevation-2 on the same box — overflow-hidden clips an\n element's own box-shadow too, so the two have to be on separate\n elements or the shadow gets cut off -->\n <div\n class=\"overflow-hidden\"\n :class=\"[\n variant === 'expressive' ? 'rounded-lg' : 'rounded-xs',\n isGrouped ? '' : 'bg-surface-container',\n ]\"\n >\n <div\n ref=\"navBox\"\n class=\"relative overflow-x-hidden overflow-y-auto overscroll-contain py-1\"\n :style=\"{ maxHeight: dropStyle.maxHeight, touchAction: currentNav ? 'pan-y' : undefined }\"\n @pointerdown=\"onNavPointerDown\"\n >\n <Transition :css=\"false\" @enter=\"navSlideEnter\" @leave=\"navSlideLeave\">\n <div v-if=\"currentNav\" :key=\"navStack.length\" :data-menu-level=\"navStack.length\">\n <!-- Back: a header row in the menu's own item metrics, labelled like an M3 menu group, then a divider -->\n <button\n type=\"button\"\n class=\"flex w-full items-center gap-3 px-4 py-2.5 text-left text-label-large text-on-surface-variant outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary\"\n @click=\"popNav\"\n >\n <MIcon name=\"arrow_back\" :size=\"20\" class=\"shrink-0\" />\n <span class=\"flex-1 truncate\"><component :is=\"() => currentNav?.header?.()\" /></span>\n </button>\n <hr class=\"my-1 border-outline-variant\" />\n <component :is=\"() => currentNav?.content?.()\" />\n </div>\n <div v-else key=\"root\">\n <div v-if=\"isGrouped\" class=\"flex flex-col gap-1 px-1.5\">\n <div v-for=\"(group, i) in groups\" :key=\"i\" class=\"rounded-lg shadow-elevation-2\">\n <div class=\"overflow-hidden rounded-lg bg-surface-container\">\n <component :is=\"() => group\" />\n </div>\n </div>\n </div>\n <slot v-else :close=\"close\" />\n </div>\n </Transition>\n </div>\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\n/**\n * An item of an MMenu or MContextMenu: icon, label and a shortcut hint. Put more items in its `#children` slot\n * to make it open a submenu. With `selected` it's one choice of several (Compose's SelectableDropdownMenuItem),\n * with `checked` an on/off setting (CheckableDropdownMenuItem): tertiary-container and rounder while on, with a\n * check that slides in.\n *\n * @slot default Item label text.\n * @slot icon Replaces the leading icon (an `MIcon` with a class, an image, an avatar…), `{ on }` while selected or\n * checked. It gets the icon's 20px box and color\n * @slot children Nested submenu items. In the parent MMenu's default 'flyout' mode, clicking or hovering (mouse\n * only) the item opens a side panel — supports unlimited nesting depth. In 'push' mode, clicking the item\n * instead swaps the whole menu panel to the submenu with a back header; hover does nothing.\n * @event click Emitted when a leaf item (no #children) is clicked. Not emitted for disabled items or for items\n * with #children, since clicking those just opens/toggles the submenu instead.\n * @event update:checked Emitted on click when `checked` is set, with the new value — powers v-model:checked\n */\nimport { computed, inject, nextTick, onMounted, onUnmounted, ref, useSlots, watch } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { FAST_EFFECTS, FAST_SPATIAL, useSpring } from '../composables/_useSpring'\nimport { POPUP_MARGIN, fitPopup } from '../composables/_popupPosition'\n\nconst props = withDefaults(defineProps<{\n /** Material Symbol icon name */\n icon?: string\n /** Keyboard shortcut hint displayed on the right (e.g. \"Ctrl+C\") — hidden when the item has #children */\n shortcut?: string\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Disables the item */\n disabled?: boolean\n /** Danger/destructive styling (error color) */\n danger?: boolean\n /** Keep the menu open after this item is clicked. Defaults to true for `checked` items, false otherwise */\n keepOpen?: boolean\n /** Makes it one choice of several (radio-like): selected look while true. Leave unset for a plain item */\n selected?: boolean\n /** Makes it an on/off setting (v-model:checked, checkbox-like): checked look while true. Leave unset for a plain item */\n checked?: boolean\n /**\n * Icon shown while selected or checked. Defaults to a check that slides in when the item has no `icon`;\n * with an `icon`, that icon stays and turns filled\n */\n selectedIcon?: string\n}>(), {\n disabled: false,\n danger: false,\n keepOpen: undefined,\n selected: undefined,\n checked: undefined,\n})\n\nconst emit = defineEmits<{ click: [], 'update:checked': [boolean] }>()\n\nconst slots = useSlots()\nconst checkable = computed(() => props.checked !== undefined)\nconst selectable = computed(() => checkable.value || props.selected !== undefined)\nconst on = computed(() => !!(props.checked ?? props.selected))\n// Without an `icon`, the selected icon (a check by default) only shows while on and slides the label aside\nconst slidingIcon = computed(() => selectable.value && !props.icon && !slots.icon)\nconst onIcon = computed(() => props.selectedIcon ?? (props.icon ? undefined : 'check'))\n\n// Where this item sits in a run of consecutive selectable/checkable siblings, MenuDefaults.itemShape(index,\n// count): the first rounds its top corners, the last its bottom ones, a lone one stays square-ish\nconst position = ref<'single' | 'first' | 'middle' | 'last'>('single')\nfunction measurePosition() {\n const el = itemEl.value\n if (!el || !selectable.value) return\n const choice = (n: Element | null) => !!n?.hasAttribute('data-m3-menu-choice')\n const prev = choice(el.previousElementSibling)\n const next = choice(el.nextElementSibling)\n position.value = prev && next ? 'middle' : prev ? 'last' : next ? 'first' : 'single'\n}\n\n// Item shapes (SegmentedMenuTokens, MenuDefaults' leading/middle/trailing/standalone item shapes): ItemShape\n// 4dp, CornerMedium 12dp on the group's outer corners, ItemSelectedShape 12dp all round; corners morph on\n// FastSpatial. The sliding icon expands on FastSpatial and fades on FastEffects (AnimatedVisibility's\n// expandHorizontally + fadeIn).\nconst ICON_SPACE = 32 // 20dp icon + 12dp to the label\nfunction radii(): number[] {\n if (on.value) return [12, 12, 12, 12]\n const top = position.value === 'first' ? 12 : 4\n const bottom = position.value === 'last' ? 12 : 4\n return [top, top, bottom, bottom]\n}\nconst { snap } = useSpring(\n () => (selectable.value ? [...radii(), slidingIcon.value && on.value ? ICON_SPACE : 0] : []),\n ([tl, tr, br, bl, width]) => {\n const el = controlEl.value instanceof HTMLElement ? controlEl.value : controlEl.value?.$el\n if (el && bl !== undefined) el.style.borderRadius = `${tl}px ${tr}px ${br}px ${bl}px`\n if (iconSlotEl.value && width !== undefined) iconSlotEl.value.style.width = `${width}px`\n },\n FAST_SPATIAL,\n)\n// A position change comes from the layout (items added, removed, the menu opening): jump, don't morph\nwatch(position, () => snap())\n\nlet siblingsObserver: MutationObserver | null = null\nonMounted(() => {\n measurePosition()\n const parent = itemEl.value?.parentElement\n if (!parent) return\n siblingsObserver = new MutationObserver(measurePosition)\n siblingsObserver.observe(parent, { childList: true })\n})\nonUnmounted(() => siblingsObserver?.disconnect())\nwatch(selectable, () => nextTick(measurePosition))\nuseSpring(\n () => (slidingIcon.value ? [on.value ? 1 : 0] : []),\n ([opacity]) => { if (iconSlotEl.value && opacity !== undefined) iconSlotEl.value.style.opacity = String(opacity) },\n FAST_EFFECTS,\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\nconst hasChildren = computed(() => !!slots.children)\nconst menuClose = inject<(() => void) | null>('m-menu-close', null)\nconst nav = inject<{\n mode: 'flyout' | 'push'\n push: (entry: { icon?: string, header?: () => any, content?: () => any }) => void\n} | null>('m-menu-nav', null)\n\nconst itemEl = ref<HTMLElement>()\n// The button, or a RouterLink instance when `to` is set\nconst controlEl = ref<HTMLElement | { $el: HTMLElement }>()\nconst iconSlotEl = ref<HTMLElement>()\nconst showSub = ref(false)\nconst subStyle = ref<Record<string, string>>({})\n\n// To the item's right, else its left, else clamped on screen (see _popupPosition.ts); placeSub() settles it once\n// the submenu is in the DOM and its size is known, before it paints\nfunction positionSub() {\n if (!itemEl.value) return\n const rect = itemEl.value.getBoundingClientRect()\n subStyle.value = {\n position: 'fixed',\n top: `${rect.top}px`,\n left: `${rect.right}px`,\n maxWidth: `${window.innerWidth - 2 * POPUP_MARGIN}px`,\n zIndex: '501',\n }\n}\n\nfunction placeSub(el: Element) {\n if (!itemEl.value) return\n const sub = el as HTMLElement\n const rect = itemEl.value.getBoundingClientRect()\n // Measured at the window's left edge, where nothing narrows it\n sub.style.left = '0px'\n const w = sub.offsetWidth\n const h = sub.offsetHeight\n const left = fitPopup([rect.right, rect.left - w], w, window.innerWidth)\n const top = fitPopup([rect.top, rect.bottom - h], h, window.innerHeight)\n subStyle.value = { ...subStyle.value, left: `${left}px`, top: `${top}px` }\n sub.style.left = `${left}px`\n sub.style.top = `${top}px`\n}\n\nfunction toggleSub() {\n if (showSub.value) {\n showSub.value = false\n return\n }\n positionSub()\n showSub.value = true\n}\n\nfunction handleClick() {\n if (props.disabled) return\n\n if (hasChildren.value) {\n if (nav?.mode === 'push') {\n nav.push({ icon: props.icon, header: slots.default, content: slots.children })\n } else {\n toggleSub()\n }\n return\n }\n\n if (checkable.value) emit('update:checked', !props.checked)\n emit('click')\n if (!(props.keepOpen ?? checkable.value)) menuClose?.()\n}\n\n// Desktop hover convenience for the flyout variant — ignored on touch/pen so a\n// tap doesn't fire a spurious pointerleave (relatedTarget is null on touch)\n// and close the submenu before its click event can land.\nfunction onPointerEnter(e: PointerEvent) {\n if (e.pointerType !== 'mouse' || !hasChildren.value || props.disabled) return\n positionSub()\n showSub.value = true\n}\n\nfunction onPointerLeave(e: PointerEvent) {\n if (e.pointerType !== 'mouse') return\n const related = e.relatedTarget as Element | null\n if (related?.closest('.m3-submenu')) return\n showSub.value = false\n}\n\nfunction onSubPointerLeave(e: PointerEvent) {\n if (e.pointerType !== 'mouse') return\n const related = e.relatedTarget as Element | null\n if (related?.closest('.m3-submenu') || itemEl.value?.contains(related as Node)) return\n showSub.value = false\n}\n</script>\n\n<template>\n <div\n ref=\"itemEl\"\n :data-m3-menu-choice=\"selectable || undefined\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"onPointerLeave\"\n >\n <!-- Selectable/checkable items sit 4dp in from the edges (DropdownMenuSelectableItemPadding) with 12dp\n inside, so their label lines up with plain items; the state layer is a pseudo-element so it can\n tint the selected container too -->\n <component\n :is=\"tag\"\n ref=\"controlEl\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : 'button'\"\n :role=\"selectable ? (checkable ? 'menuitemcheckbox' : 'menuitemradio') : undefined\"\n :aria-checked=\"selectable ? on : undefined\"\n class=\"flex items-center gap-3 py-2.5 text-left text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary\"\n :class=\"selectable\n ? [\n 'relative mx-1 w-[calc(100%-0.5rem)] px-3 duration-150 before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity',\n on ? 'bg-tertiary-container text-on-tertiary-container' : 'text-on-surface',\n disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]',\n ]\n : [\n 'w-full px-4',\n disabled ? 'cursor-not-allowed opacity-[0.38] text-on-surface' : 'cursor-pointer',\n !disabled && danger ? 'text-error hover:bg-error/8' : '',\n !disabled && !danger ? 'text-on-surface hover:bg-on-surface/8' : '',\n ]\"\n :disabled=\"disabled || undefined\"\n :aria-haspopup=\"hasChildren ? 'menu' : undefined\"\n :aria-expanded=\"hasChildren ? showSub : undefined\"\n @click=\"handleClick\"\n >\n <!-- -mr-3 cancels the flex gap, so the label sits flush while the slot is closed -->\n <span v-if=\"slidingIcon\" ref=\"iconSlotEl\" class=\"-mr-3 flex shrink-0 overflow-hidden\" style=\"width: 0; opacity: 0\">\n <MIcon :name=\"onIcon!\" :size=\"20\" class=\"shrink-0\" />\n </span>\n <span\n v-else-if=\"$slots.icon\"\n class=\"flex size-5 shrink-0 items-center justify-center\"\n :class=\"selectable ? (on ? '' : 'text-on-surface-variant') : danger ? 'text-error' : 'text-on-surface-variant'\"\n >\n <slot name=\"icon\" :on=\"on\" />\n </span>\n <MIcon\n v-else-if=\"icon\"\n :name=\"on && onIcon ? onIcon : icon\"\n :filled=\"on && !onIcon\"\n :size=\"20\"\n class=\"shrink-0\"\n :class=\"selectable ? (on ? '' : 'text-on-surface-variant') : danger ? 'text-error' : 'text-on-surface-variant'\"\n />\n <span class=\"flex-1\"><slot /></span>\n <span v-if=\"shortcut && !hasChildren\" class=\"ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60\">{{ shortcut }}</span>\n <MIcon v-if=\"hasChildren\" name=\"chevron_right\" :size=\"18\" class=\"shrink-0 text-on-surface-variant\" />\n </component>\n\n <!-- Submenu (flyout variant only — \"push\" mode is rendered by the root MMenu/MContextMenu panel) -->\n <Teleport v-if=\"hasChildren && nav?.mode !== 'push'\" to=\"body\">\n <Transition\n enter-active-class=\"transition-opacity duration-100\"\n enter-from-class=\"opacity-0\"\n leave-active-class=\"transition-opacity duration-75\"\n leave-to-class=\"opacity-0\"\n @enter=\"placeSub\"\n >\n <div\n v-if=\"showSub\"\n class=\"m3-submenu min-w-44 rounded-xs shadow-elevation-2\"\n :style=\"subStyle\"\n @pointerleave=\"onSubPointerLeave\"\n >\n <!-- overflow-hidden lives here, separate from shadow-elevation-2 above —\n overflow-hidden clips an element's own box-shadow too -->\n <div class=\"overflow-hidden rounded-xs bg-surface-container py-1\">\n <slot name=\"children\" />\n </div>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * An item of an MMenu or MContextMenu: icon, label and a shortcut hint. Put more items in its `#children` slot\n * to make it open a submenu. With `selected` it's one choice of several (Compose's SelectableDropdownMenuItem),\n * with `checked` an on/off setting (CheckableDropdownMenuItem): tertiary-container and rounder while on, with a\n * check that slides in.\n *\n * @slot default Item label text.\n * @slot icon Replaces the leading icon (an `MIcon` with a class, an image, an avatar…), `{ on }` while selected or\n * checked. It gets the icon's 20px box and color\n * @slot children Nested submenu items. In the parent MMenu's default 'flyout' mode, clicking or hovering (mouse\n * only) the item opens a side panel — supports unlimited nesting depth. In 'push' mode, clicking the item\n * instead swaps the whole menu panel to the submenu with a back header; hover does nothing.\n * @event click Emitted when a leaf item (no #children) is clicked. Not emitted for disabled items or for items\n * with #children, since clicking those just opens/toggles the submenu instead.\n * @event update:checked Emitted on click when `checked` is set, with the new value — powers v-model:checked\n */\nimport { computed, inject, nextTick, onMounted, onUnmounted, ref, useSlots, watch } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { FAST_EFFECTS, FAST_SPATIAL, useSpring } from '../composables/_useSpring'\nimport { POPUP_MARGIN, fitPopup } from '../composables/_popupPosition'\n\nconst props = withDefaults(defineProps<{\n /** Material Symbol icon name */\n icon?: string\n /** Keyboard shortcut hint displayed on the right (e.g. \"Ctrl+C\") — hidden when the item has #children */\n shortcut?: string\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Disables the item */\n disabled?: boolean\n /** Danger/destructive styling (error color) */\n danger?: boolean\n /** Keep the menu open after this item is clicked. Defaults to true for `checked` items, false otherwise */\n keepOpen?: boolean\n /** Makes it one choice of several (radio-like): selected look while true. Leave unset for a plain item */\n selected?: boolean\n /** Makes it an on/off setting (v-model:checked, checkbox-like): checked look while true. Leave unset for a plain item */\n checked?: boolean\n /**\n * Icon shown while selected or checked. Defaults to a check that slides in when the item has no `icon`;\n * with an `icon`, that icon stays and turns filled\n */\n selectedIcon?: string\n}>(), {\n disabled: false,\n danger: false,\n keepOpen: undefined,\n selected: undefined,\n checked: undefined,\n})\n\nconst emit = defineEmits<{ click: [], 'update:checked': [boolean] }>()\n\nconst slots = useSlots()\nconst checkable = computed(() => props.checked !== undefined)\nconst selectable = computed(() => checkable.value || props.selected !== undefined)\nconst on = computed(() => !!(props.checked ?? props.selected))\n// Without an `icon`, the selected icon (a check by default) only shows while on and slides the label aside\nconst slidingIcon = computed(() => selectable.value && !props.icon && !slots.icon)\nconst onIcon = computed(() => props.selectedIcon ?? (props.icon ? undefined : 'check'))\n\n// Where this item sits in a run of consecutive selectable/checkable siblings, MenuDefaults.itemShape(index,\n// count): the first rounds its top corners, the last its bottom ones, a lone one stays square-ish\nconst position = ref<'single' | 'first' | 'middle' | 'last'>('single')\nfunction measurePosition() {\n const el = itemEl.value\n if (!el || !selectable.value) return\n const choice = (n: Element | null) => !!n?.hasAttribute('data-m3-menu-choice')\n const prev = choice(el.previousElementSibling)\n const next = choice(el.nextElementSibling)\n position.value = prev && next ? 'middle' : prev ? 'last' : next ? 'first' : 'single'\n}\n\n// Item shapes (SegmentedMenuTokens, MenuDefaults' leading/middle/trailing/standalone item shapes): ItemShape\n// 4dp, CornerMedium 12dp on the group's outer corners, ItemSelectedShape 12dp all round; corners morph on\n// FastSpatial. The sliding icon expands on FastSpatial and fades on FastEffects (AnimatedVisibility's\n// expandHorizontally + fadeIn).\nconst ICON_SPACE = 32 // 20dp icon + 12dp to the label\nfunction radii(): number[] {\n if (on.value) return [12, 12, 12, 12]\n const top = position.value === 'first' ? 12 : 4\n const bottom = position.value === 'last' ? 12 : 4\n return [top, top, bottom, bottom]\n}\nconst { snap } = useSpring(\n () => (selectable.value ? [...radii(), slidingIcon.value && on.value ? ICON_SPACE : 0] : []),\n ([tl, tr, br, bl, width]) => {\n const el = controlEl.value instanceof HTMLElement ? controlEl.value : controlEl.value?.$el\n if (el && bl !== undefined) el.style.borderRadius = `${tl}px ${tr}px ${br}px ${bl}px`\n if (iconSlotEl.value && width !== undefined) iconSlotEl.value.style.width = `${width}px`\n },\n FAST_SPATIAL,\n)\n// A position change comes from the layout (items added, removed, the menu opening): jump, don't morph\nwatch(position, () => snap())\n\nlet siblingsObserver: MutationObserver | null = null\nonMounted(() => {\n measurePosition()\n const parent = itemEl.value?.parentElement\n if (!parent) return\n siblingsObserver = new MutationObserver(measurePosition)\n siblingsObserver.observe(parent, { childList: true })\n})\nonUnmounted(() => siblingsObserver?.disconnect())\nwatch(selectable, () => nextTick(measurePosition))\nuseSpring(\n () => (slidingIcon.value ? [on.value ? 1 : 0] : []),\n ([opacity]) => { if (iconSlotEl.value && opacity !== undefined) iconSlotEl.value.style.opacity = String(opacity) },\n FAST_EFFECTS,\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\nconst hasChildren = computed(() => !!slots.children)\nconst menuClose = inject<(() => void) | null>('m-menu-close', null)\nconst nav = inject<{\n mode: 'flyout' | 'push'\n push: (entry: { icon?: string, header?: () => any, content?: () => any }) => void\n} | null>('m-menu-nav', null)\n\nconst itemEl = ref<HTMLElement>()\n// The button, or a RouterLink instance when `to` is set\nconst controlEl = ref<HTMLElement | { $el: HTMLElement }>()\nconst iconSlotEl = ref<HTMLElement>()\nconst showSub = ref(false)\nconst subStyle = ref<Record<string, string>>({})\n\n// To the item's right, else its left, else clamped on screen (see _popupPosition.ts); placeSub() settles it once\n// the submenu is in the DOM and its size is known, before it paints\nfunction positionSub() {\n if (!itemEl.value) return\n const rect = itemEl.value.getBoundingClientRect()\n subStyle.value = {\n position: 'fixed',\n top: `${rect.top}px`,\n left: `${rect.right}px`,\n maxWidth: `${window.innerWidth - 2 * POPUP_MARGIN}px`,\n zIndex: '501',\n }\n}\n\nfunction placeSub(el: Element) {\n if (!itemEl.value) return\n const sub = el as HTMLElement\n const rect = itemEl.value.getBoundingClientRect()\n // Measured at the window's left edge, where nothing narrows it\n sub.style.left = '0px'\n const w = sub.offsetWidth\n const h = sub.offsetHeight\n const left = fitPopup([rect.right, rect.left - w], w, window.innerWidth)\n const top = fitPopup([rect.top, rect.bottom - h], h, window.innerHeight)\n subStyle.value = { ...subStyle.value, left: `${left}px`, top: `${top}px` }\n sub.style.left = `${left}px`\n sub.style.top = `${top}px`\n}\n\nfunction toggleSub() {\n if (showSub.value) {\n showSub.value = false\n return\n }\n positionSub()\n showSub.value = true\n}\n\nfunction handleClick() {\n if (props.disabled) return\n\n if (hasChildren.value) {\n if (nav?.mode === 'push') {\n nav.push({ icon: props.icon, header: slots.default, content: slots.children })\n } else {\n toggleSub()\n }\n return\n }\n\n if (checkable.value) emit('update:checked', !props.checked)\n emit('click')\n if (!(props.keepOpen ?? checkable.value)) menuClose?.()\n}\n\n// Desktop hover convenience for the flyout variant — ignored on touch/pen so a\n// tap doesn't fire a spurious pointerleave (relatedTarget is null on touch)\n// and close the submenu before its click event can land.\nfunction onPointerEnter(e: PointerEvent) {\n if (e.pointerType !== 'mouse' || !hasChildren.value || props.disabled) return\n positionSub()\n showSub.value = true\n}\n\nfunction onPointerLeave(e: PointerEvent) {\n if (e.pointerType !== 'mouse') return\n const related = e.relatedTarget as Element | null\n if (related?.closest('.m3-submenu')) return\n showSub.value = false\n}\n\nfunction onSubPointerLeave(e: PointerEvent) {\n if (e.pointerType !== 'mouse') return\n const related = e.relatedTarget as Element | null\n if (related?.closest('.m3-submenu') || itemEl.value?.contains(related as Node)) return\n showSub.value = false\n}\n</script>\n\n<template>\n <div\n ref=\"itemEl\"\n :data-m3-menu-choice=\"selectable || undefined\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"onPointerLeave\"\n >\n <!-- Selectable/checkable items sit 4dp in from the edges (DropdownMenuSelectableItemPadding) with 12dp\n inside, so their label lines up with plain items; the state layer is a pseudo-element so it can\n tint the selected container too -->\n <component\n :is=\"tag\"\n ref=\"controlEl\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : 'button'\"\n :role=\"selectable ? (checkable ? 'menuitemcheckbox' : 'menuitemradio') : undefined\"\n :aria-checked=\"selectable ? on : undefined\"\n class=\"flex items-center gap-3 py-2.5 text-left text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary\"\n :class=\"selectable\n ? [\n 'relative mx-1 w-[calc(100%-0.5rem)] px-3 duration-150 before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity',\n on ? 'bg-tertiary-container text-on-tertiary-container' : 'text-on-surface',\n disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]',\n ]\n : [\n 'w-full px-4',\n disabled ? 'cursor-not-allowed opacity-[0.38] text-on-surface' : 'cursor-pointer',\n !disabled && danger ? 'text-error hover:bg-error/8' : '',\n !disabled && !danger ? 'text-on-surface hover:bg-on-surface/8' : '',\n ]\"\n :disabled=\"disabled || undefined\"\n :aria-haspopup=\"hasChildren ? 'menu' : undefined\"\n :aria-expanded=\"hasChildren ? showSub : undefined\"\n @click=\"handleClick\"\n >\n <!-- -mr-3 cancels the flex gap, so the label sits flush while the slot is closed -->\n <span v-if=\"slidingIcon\" ref=\"iconSlotEl\" class=\"-mr-3 flex shrink-0 overflow-hidden\" style=\"width: 0; opacity: 0\">\n <MIcon :name=\"onIcon!\" :size=\"20\" class=\"shrink-0\" />\n </span>\n <span\n v-else-if=\"$slots.icon\"\n class=\"flex size-5 shrink-0 items-center justify-center\"\n :class=\"selectable ? (on ? '' : 'text-on-surface-variant') : danger ? 'text-error' : 'text-on-surface-variant'\"\n >\n <slot name=\"icon\" :on=\"on\" />\n </span>\n <MIcon\n v-else-if=\"icon\"\n :name=\"on && onIcon ? onIcon : icon\"\n :filled=\"on && !onIcon\"\n :size=\"20\"\n class=\"shrink-0\"\n :class=\"selectable ? (on ? '' : 'text-on-surface-variant') : danger ? 'text-error' : 'text-on-surface-variant'\"\n />\n <span class=\"flex-1\"><slot /></span>\n <span v-if=\"shortcut && !hasChildren\" class=\"ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60\">{{ shortcut }}</span>\n <MIcon v-if=\"hasChildren\" name=\"chevron_right\" :size=\"18\" class=\"shrink-0 text-on-surface-variant\" />\n </component>\n\n <!-- Submenu (flyout variant only — \"push\" mode is rendered by the root MMenu/MContextMenu panel) -->\n <Teleport v-if=\"hasChildren && nav?.mode !== 'push'\" to=\"body\">\n <Transition\n enter-active-class=\"transition-opacity duration-100\"\n enter-from-class=\"opacity-0\"\n leave-active-class=\"transition-opacity duration-75\"\n leave-to-class=\"opacity-0\"\n @enter=\"placeSub\"\n >\n <div\n v-if=\"showSub\"\n class=\"m3-submenu min-w-44 rounded-xs shadow-elevation-2\"\n :style=\"subStyle\"\n @pointerleave=\"onSubPointerLeave\"\n >\n <!-- overflow-hidden lives here, separate from shadow-elevation-2 above —\n overflow-hidden clips an element's own box-shadow too -->\n <div class=\"overflow-hidden rounded-xs bg-surface-container py-1\">\n <slot name=\"children\" />\n </div>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;oBAqBE,EAAA,GAAA,EAA0C,MAA1C,CAA0C;;IEFtC,KAAqB,IAErB,KAAkB,KAElB,IAAa,GACb,KAAiB,IAAI,GACrB,IAAiB;AAEvB,SAAgB,GAAW,GAAwB;CACjD,IAAM,IAAW,EAAoB,CAAC,CAAC,GACjC,IAAa,QAAe,EAAS,MAAM,EAAS,MAAM,SAAS,EAAE,GACrE,IAAe,EAA4B,SAAS,GACpD,IAAS,EAAiB,GAG5B,IAAa,GACb,IAAmB;CAEvB,SAAS,EAAc,GAAa,GAAkB;EACpD,IAAM,IAAM,EAAa,UAAU,YAAY,IAAI,IAC7C,IAAQ,EAAmB,QAC/B,CACE;GAAE,WAAW,cAAc,IAAM,GAAmB;GAAM,SAAS;EAAE,GACrE;GAAE,WAAW;GAAiB,SAAS;EAAE,CAC3C,GACA;GAAE,UAAU;GAAK,OAAO;GAAI,QAAQ;GAAgC,MAAM;EAAY,CACxF;EACA,EAAK,WAAW;CAClB;CAEA,SAAS,EAAc,GAAa,GAAkB;EACpD,IAAM,IAAM,EAAa,UAAU,YAAY,KAAK,GAC9C,IAAS;EAGf,AAFA,EAAO,MAAM,WAAW,YACxB,EAAO,MAAM,cAAc,KAC3B,EAAO,MAAM,MAAM;EACnB,IAAM,IAAO,GACP,IAAU;EAEhB,AADA,IAAa,GACb,IAAmB;EACnB,IAAM,IAAO,EAAO,QAClB,CACE;GAAE,WAAW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IAAA,EAAA;IAC9G,EAAA,SAAb,EAAA,GAAA,EAAqG,GAAA;;KAA3E,MAAK;KAAiB,MAAM;KAAI,OAAM;;;;;;;;;;;;;EAIlD,CAAA,IAAA,EAAA,SAAe,EAAA,CAAA,CAAG,EAAE,SAAI,UAAxC,EAAA,GAAA,EAqBW,GAAA;;GArB0C,IAAG;EACtD,GAAA,CAAA,EAmBa,GAAA;GAlBX,sBAAmB;GACnB,oBAAiB;GACjB,sBAAmB;GACnB,kBAAe;GACd,SAAO;;GAER,SAAA,SAWM,CAVE,EAAA,SADR,EAAA,GAAA,EAWM,OAAA;;IATJ,OAAM;IACL,OAAK,EAAE,EAAA,KAAQ;IACf,gBAAc;GAIf,GAAA,CAAA,EAEM,OAFN,GAEM,CADJ,EAAwB,EAAA,QAAA,UAAA,CAAA,CAAA,CAAA,GAAA,EAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
@@ -0,0 +1,184 @@
1
+ import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, nextTick as o, normalizeClass as s, normalizeStyle as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, toDisplayString as p, unref as m, watch as h } from "vue";
2
+ //#region src/components/MProgressBar.vue?vue&type=script&setup=true&lang.ts
3
+ var g = {
4
+ key: 0,
5
+ class: "text-label-small text-on-surface-variant"
6
+ }, _ = ["aria-valuenow"], ee = {
7
+ key: 1,
8
+ class: "absolute inset-y-0 w-2/5 rounded-full animate-[m3-progress-indeterminate_1.6s_ease-in-out_infinite] bg-(--m3-progress-bar)"
9
+ }, v = ["aria-valuenow"], y = ["height", "viewBox"], b = ["d", "stroke-width"], te = {
10
+ key: 1,
11
+ class: "absolute inset-0 overflow-hidden rounded-full"
12
+ }, ne = ["height", "viewBox"], x = ["d", "stroke-width"], S = 20, C = 2.5, w = 2, T = 4, E = 10, D = 130, O = /* @__PURE__ */ a({
13
+ __name: "MProgressBar",
14
+ props: {
15
+ value: {},
16
+ indeterminate: { type: Boolean },
17
+ color: { default: "primary" },
18
+ trackColor: {},
19
+ variant: { default: "linear" },
20
+ label: {},
21
+ thickness: {}
22
+ },
23
+ setup(a) {
24
+ let O = a, k = t(() => O.indeterminate || O.value === void 0), A = t(() => Math.min(100, Math.max(0, O.value ?? 0))), j = [
25
+ "primary",
26
+ "secondary",
27
+ "tertiary",
28
+ "error"
29
+ ], M = (e) => j.includes(e) || e.endsWith("-container") ? `var(--color-${e})` : e, re = t(() => ({
30
+ "--m3-progress-bar": M(O.color),
31
+ "--m3-progress-track": O.trackColor ? M(O.trackColor) : j.includes(O.color) ? `var(--color-${O.color}-container)` : `color-mix(in srgb, ${O.color} 24%, transparent)`
32
+ })), N = t(() => O.thickness ?? 4), P = t(() => C + N.value / 2), F = t(() => 2 * C + N.value), I = 1600, L = (() => {
33
+ let e = "";
34
+ for (let t = 0; t <= I; t += w) {
35
+ let n = 4 - C * Math.sin(t / S * Math.PI * 2);
36
+ e += `${t === 0 ? "M" : "L"}${t},${n.toFixed(2)} `;
37
+ }
38
+ return e.trim();
39
+ })(), R = 0, z = 0, B = 0, V = {
40
+ from: 0,
41
+ to: 0,
42
+ t0: -1,
43
+ dur: 500
44
+ };
45
+ function H(e) {
46
+ return e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2;
47
+ }
48
+ function U(e, t, n, r) {
49
+ if (Math.abs(t - n) < .001) {
50
+ e.t0 = -1, e.to = n;
51
+ return;
52
+ }
53
+ e.from = t, e.to = n, e.t0 = r;
54
+ }
55
+ function W(e, t) {
56
+ if (e.t0 < 0) return e.to;
57
+ let n = Math.min(1, (t - e.t0) / e.dur), r = e.from + (e.to - e.from) * H(n);
58
+ return n >= 1 && (e.t0 = -1), r;
59
+ }
60
+ let G = f(null), K = f(null), q = f(""), J = null, Y = 0, ie = 2 * Math.PI / 800;
61
+ function X(e, t) {
62
+ let n = P.value, r = [];
63
+ for (let i = 0; i <= I; i += w) {
64
+ let a = n - C * e * Math.sin(i / S * Math.PI * 2 + t);
65
+ r.push(`${i === 0 ? "M" : "L"}${i},${a.toFixed(2)}`);
66
+ }
67
+ return r.join(" ");
68
+ }
69
+ function Z(e) {
70
+ let t = J === null ? 0 : e - J;
71
+ if (J = e, B -= t * ie, t > 0) {
72
+ let e = 1 - Math.exp(-t / D);
73
+ R += (A.value - R) * e;
74
+ }
75
+ z = W(V, e);
76
+ let n = T * z, r = R;
77
+ G.value && (G.value.style.clipPath = `inset(0 ${(100 - r).toFixed(3)}% 0 0)`), K.value && (K.value.style.left = `calc(${r.toFixed(3)}% + ${n.toFixed(2)}px)`, K.value.style.height = `${N.value}px`), q.value = X(z, B), Y = requestAnimationFrame(Z);
78
+ }
79
+ h(A, (e, t) => {
80
+ if (O.variant !== "wavy" || k.value) return;
81
+ let n = performance.now();
82
+ t <= E && e > E && e < 100 ? U(V, z, 1, n) : t > E && e <= E || e === 100 ? U(V, z, 0, n) : t === 100 && e > E && U(V, z, 1, n);
83
+ });
84
+ function Q() {
85
+ R = A.value;
86
+ let e = A.value;
87
+ z = +(e > E && e < 100), V.to = z, V.t0 = -1;
88
+ let t = T * z;
89
+ G.value && (G.value.style.clipPath = `inset(0 ${(100 - e).toFixed(3)}% 0 0)`), K.value && (K.value.style.left = `calc(${e.toFixed(3)}% + ${t.toFixed(2)}px)`, K.value.style.height = `${N.value}px`), q.value = X(z, B), Y ||= requestAnimationFrame(Z);
90
+ }
91
+ function $() {
92
+ cancelAnimationFrame(Y), Y = 0, J = null, V.t0 = -1;
93
+ }
94
+ return l(() => {
95
+ O.variant === "wavy" && !k.value && Q();
96
+ }), u($), h(() => O.variant, async (e) => {
97
+ e === "wavy" && !k.value ? (await o(), Q()) : $();
98
+ }), h(k, async (e) => {
99
+ !e && O.variant === "wavy" ? (await o(), Q()) : $();
100
+ }), (t, o) => (d(), r("div", {
101
+ class: "flex flex-col gap-1",
102
+ style: c(re.value)
103
+ }, [a.label ? (d(), r("span", g, p(a.label), 1)) : n("", !0), a.variant === "linear" ? (d(), r("div", {
104
+ key: 1,
105
+ class: s(["relative w-full overflow-hidden rounded-full", k.value ? "bg-(--m3-progress-track)" : ""]),
106
+ style: c({ height: `${N.value}px` }),
107
+ role: "progressbar",
108
+ "aria-valuenow": k.value ? void 0 : A.value,
109
+ "aria-valuemin": "0",
110
+ "aria-valuemax": "100"
111
+ }, [k.value ? (d(), r("div", ee)) : (d(), r(e, { key: 0 }, [i("div", {
112
+ class: "absolute inset-y-0 left-0 rounded-full transition-[width] duration-300 ease-in-out bg-(--m3-progress-bar)",
113
+ style: c({ width: `${A.value}%` })
114
+ }, null, 4), i("div", {
115
+ class: "absolute inset-y-0 right-0 rounded-full transition-[left] duration-300 ease-in-out bg-(--m3-progress-track)",
116
+ style: c({ left: `calc(${A.value}% + 4px)` })
117
+ }, null, 4)], 64))], 14, _)) : (d(), r("div", {
118
+ key: 2,
119
+ class: "relative w-full overflow-visible",
120
+ style: c({ height: `${F.value}px` }),
121
+ role: "progressbar",
122
+ "aria-valuenow": k.value ? void 0 : A.value,
123
+ "aria-valuemin": "0",
124
+ "aria-valuemax": "100"
125
+ }, [k.value ? (d(), r("div", te, [i("div", {
126
+ class: "absolute top-0 left-0 h-full animate-[m3-wave-flow_0.9s_linear_infinite] text-(--m3-progress-bar)",
127
+ style: c({ width: `${I}px` })
128
+ }, [(d(), r("svg", {
129
+ width: I,
130
+ height: F.value,
131
+ viewBox: `0 0 ${I} ${F.value}`,
132
+ class: "h-full",
133
+ xmlns: "http://www.w3.org/2000/svg"
134
+ }, [i("path", {
135
+ d: m(L),
136
+ fill: "none",
137
+ stroke: "currentColor",
138
+ "stroke-width": N.value,
139
+ "stroke-linecap": "round"
140
+ }, null, 8, x)], 8, ne))], 4)])) : (d(), r(e, { key: 0 }, [
141
+ i("div", {
142
+ ref_key: "waveClipEl",
143
+ ref: G,
144
+ class: "absolute inset-0 overflow-hidden",
145
+ style: { "clip-path": "inset(0 100% 0 0)" }
146
+ }, [(d(), r("svg", {
147
+ class: "absolute top-0 left-0 h-full text-(--m3-progress-bar)",
148
+ width: I,
149
+ height: F.value,
150
+ viewBox: `0 0 ${I} ${F.value}`
151
+ }, [i("path", {
152
+ d: q.value,
153
+ fill: "none",
154
+ stroke: "currentColor",
155
+ "stroke-width": N.value,
156
+ "stroke-linecap": "round"
157
+ }, null, 8, b)], 8, y))], 512),
158
+ i("div", {
159
+ ref_key: "trackEl",
160
+ ref: K,
161
+ class: "absolute right-0 bg-(--m3-progress-track)",
162
+ style: {
163
+ "border-radius": "9999px",
164
+ top: "50%",
165
+ transform: "translateY(-50%)"
166
+ }
167
+ }, null, 512),
168
+ i("div", {
169
+ class: "absolute rounded-full bg-(--m3-progress-bar)",
170
+ style: c({
171
+ right: "0",
172
+ top: "50%",
173
+ transform: "translateY(-50%)",
174
+ width: `${N.value}px`,
175
+ height: `${N.value}px`
176
+ })
177
+ }, null, 4)
178
+ ], 64))], 12, v))], 4));
179
+ }
180
+ });
181
+ //#endregion
182
+ export { O as t };
183
+
184
+ //# sourceMappingURL=MProgressBar-BCoruxA-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MProgressBar-BCoruxA-.js","names":[],"sources":["../src/components/MProgressBar.vue","../src/components/MProgressBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A linear progress indicator — determinate, indeterminate, or the M3 Expressive wavy variant.\n */\nimport { computed, ref, watch, onMounted, onUnmounted, nextTick } from \"vue\";\n\nconst props = withDefaults(\n defineProps<{\n /** Progress 0–100 (omit for indeterminate) */\n value?: number;\n /** Indeterminate animation — also implied by omitting value */\n indeterminate?: boolean;\n /** Bar color: an M3 role or any CSS color (`#fff` over a photo, say) */\n color?: \"primary\" | \"secondary\" | \"tertiary\" | \"error\" | (string & {});\n /** Track color: an M3 role or any CSS color. Default the role's container, or the bar color at 24% for a CSS color */\n trackColor?: string;\n /** Bar style */\n variant?: \"linear\" | \"wavy\";\n /** Label text above the bar */\n label?: string;\n /** Stroke width in px. Defaults to 4dp, matching the real M3 token for both variants. */\n thickness?: number;\n }>(),\n { color: \"primary\", variant: \"linear\" },\n);\n\nconst isIndeterminate = computed(() => props.indeterminate || props.value === undefined);\nconst clampedValue = computed(() => Math.min(100, Math.max(0, props.value ?? 0)));\n\nconst ROLES = [\"primary\", \"secondary\", \"tertiary\", \"error\"];\nconst roleOr = (c: string) => (ROLES.includes(c) || c.endsWith(\"-container\") ? `var(--color-${c})` : c);\n// Both colors go through custom properties on the root, read by the bar/track/wave below.\nconst colorVars = computed(() => {\n const bar = roleOr(props.color);\n const track = props.trackColor\n ? roleOr(props.trackColor)\n : ROLES.includes(props.color)\n ? `var(--color-${props.color}-container)`\n : `color-mix(in srgb, ${props.color} 24%, transparent)`;\n return { \"--m3-progress-bar\": bar, \"--m3-progress-track\": track };\n});\n\n// ── Wave geometry ─────────────────────────────────────────────────────────\nconst PERIOD = 20;\nconst AMP = 2.5;\nconst PERIODS = 80;\nconst STEP = 2;\nconst MARGIN_PX = 4; // gap between wave right-end and track start\nconst WAVE_START = 10; // threshold % below which wave collapses to line\n\n// thickness-derived (computed so they react to prop changes)\nconst effectiveThickness = computed(() => props.thickness ?? 4);\nconst waveMid = computed(() => AMP + effectiveThickness.value / 2);\nconst waveViewH = computed(() => 2 * AMP + effectiveThickness.value);\n\nconst waveWidth = PERIOD * PERIODS; // 1600px — covers any container width\n\n// Static path for indeterminate — built once with the wavy default (thickness=3)\nconst STATIC_MID = AMP + 3 / 2; // = 4\nconst staticWavePath = (() => {\n let d = \"\";\n for (let x = 0; x <= waveWidth; x += STEP) {\n const y = STATIC_MID - AMP * Math.sin((x / PERIOD) * Math.PI * 2);\n d += `${x === 0 ? \"M\" : \"L\"}${x},${y.toFixed(2)} `;\n }\n return d.trim();\n})();\n\n// ── rAF state (plain JS — no Vue refs to avoid 60fps reactive overhead) ───\n//\n// Architecture mirrors MCircleProgressBar:\n// • displayedValue follows clampedValue with exponential smoothing (~300ms)\n// • appearanceF animates 0↔1 at the WAVE_START threshold and at 100%\n// • animPhase advances every frame to scroll the wave leftward\n// clip-path and track.left are written via direct DOM setAttribute/style\n// to avoid the CSS-transition vs rAF conflict.\nlet displayedValue = 0;\nlet appearanceF = 0;\nlet animPhase = 0;\n\ntype Anim = { from: number; to: number; t0: number; dur: number };\nconst appearAnim: Anim = { from: 0, to: 0, t0: -1, dur: 500 };\n\nfunction easeInOut(t: number) {\n return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;\n}\nfunction startAnim(a: Anim, from: number, to: number, now: number) {\n if (Math.abs(from - to) < 0.001) { a.t0 = -1; a.to = to; return; }\n a.from = from; a.to = to; a.t0 = now;\n}\nfunction tickAnim(a: Anim, now: number): number {\n if (a.t0 < 0) return a.to;\n const t = Math.min(1, (now - a.t0) / a.dur);\n const v = a.from + (a.to - a.from) * easeInOut(t);\n if (t >= 1) a.t0 = -1;\n return v;\n}\n\n// ── Template refs for direct DOM updates ─────────────────────────────────\nconst waveClipEl = ref<HTMLDivElement | null>(null);\nconst trackEl = ref<HTMLDivElement | null>(null);\nconst wavePath = ref(\"\"); // updated in tick → drives path's :d binding\n\n// ── rAF tick ─────────────────────────────────────────────────────────────\nlet lastTime: number | null = null;\nlet rafId = 0;\nconst PHASE_PER_MS = (2 * Math.PI) / 800; // one full PERIOD scroll per 800ms\nconst VALUE_TAU = 130; // exponential τ → ~300ms 90%-settle\n\nfunction buildWavePath(factor: number, ph: number): string {\n const mid = waveMid.value;\n const pts: string[] = [];\n for (let x = 0; x <= waveWidth; x += STEP) {\n const y = mid - AMP * factor * Math.sin((x / PERIOD) * Math.PI * 2 + ph);\n pts.push(`${x === 0 ? \"M\" : \"L\"}${x},${y.toFixed(2)}`);\n }\n return pts.join(\" \");\n}\n\nfunction tick(now: number) {\n const dt = lastTime !== null ? now - lastTime : 0;\n lastTime = now;\n\n // 1. Wave phase scrolls leftward\n animPhase -= dt * PHASE_PER_MS;\n\n // 2. Smooth displayed value (exponential interpolation)\n if (dt > 0) {\n const k = 1 - Math.exp(-dt / VALUE_TAU);\n displayedValue += (clampedValue.value - displayedValue) * k;\n }\n\n // 3. Advance appearance animation\n appearanceF = tickAnim(appearAnim, now);\n\n // 4. Update DOM directly\n const margin = MARGIN_PX * appearanceF;\n const dv = displayedValue;\n\n if (waveClipEl.value)\n waveClipEl.value.style.clipPath = `inset(0 ${(100 - dv).toFixed(3)}% 0 0)`;\n\n if (trackEl.value) {\n trackEl.value.style.left = `calc(${dv.toFixed(3)}% + ${margin.toFixed(2)}px)`;\n trackEl.value.style.height = `${effectiveThickness.value}px`;\n }\n\n // 5. Rebuild wave path (drives :d via Vue ref)\n wavePath.value = buildWavePath(appearanceF, animPhase);\n\n rafId = requestAnimationFrame(tick);\n}\n\n// ── Watchers ─────────────────────────────────────────────────────────────\nwatch(clampedValue, (v, prev) => {\n if (props.variant !== \"wavy\" || isIndeterminate.value) return;\n const now = performance.now();\n\n if (prev <= WAVE_START && v > WAVE_START && v < 100) startAnim(appearAnim, appearanceF, 1, now);\n else if (prev > WAVE_START && v <= WAVE_START) startAnim(appearAnim, appearanceF, 0, now);\n else if (v === 100) startAnim(appearAnim, appearanceF, 0, now);\n else if (prev === 100 && v > WAVE_START) startAnim(appearAnim, appearanceF, 1, now);\n});\n\nfunction initAndStart() {\n displayedValue = clampedValue.value;\n const v = clampedValue.value;\n appearanceF = (v > WAVE_START && v < 100) ? 1 : 0;\n appearAnim.to = appearanceF;\n appearAnim.t0 = -1;\n\n // Set initial DOM values immediately to avoid a one-frame flash\n const margin = MARGIN_PX * appearanceF;\n if (waveClipEl.value)\n waveClipEl.value.style.clipPath = `inset(0 ${(100 - v).toFixed(3)}% 0 0)`;\n if (trackEl.value) {\n trackEl.value.style.left = `calc(${v.toFixed(3)}% + ${margin.toFixed(2)}px)`;\n trackEl.value.style.height = `${effectiveThickness.value}px`;\n }\n wavePath.value = buildWavePath(appearanceF, animPhase);\n\n if (!rafId) rafId = requestAnimationFrame(tick);\n}\n\nfunction stopRaf() {\n cancelAnimationFrame(rafId);\n rafId = 0; lastTime = null;\n appearAnim.t0 = -1;\n}\n\nonMounted(() => {\n if (props.variant === \"wavy\" && !isIndeterminate.value) initAndStart();\n});\nonUnmounted(stopRaf);\n\nwatch(() => props.variant, async (v) => {\n if (v === \"wavy\" && !isIndeterminate.value) { await nextTick(); initAndStart(); }\n else stopRaf();\n});\nwatch(isIndeterminate, async (v) => {\n if (!v && props.variant === \"wavy\") { await nextTick(); initAndStart(); }\n else stopRaf();\n});\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1\" :style=\"colorVars\">\n <span v-if=\"label\" class=\"text-label-small text-on-surface-variant\">{{ label }}</span>\n\n <!-- ── Linear variant ────────────────────────────────────────────────── -->\n <div\n v-if=\"variant === 'linear'\"\n class=\"relative w-full overflow-hidden rounded-full\"\n :class=\"isIndeterminate ? 'bg-(--m3-progress-track)' : ''\"\n :style=\"{ height: `${effectiveThickness}px` }\"\n role=\"progressbar\"\n :aria-valuenow=\"isIndeterminate ? undefined : clampedValue\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n >\n <!-- LinearProgressIndicatorTokens.TrackActiveSpace=4dp: the track starts\n a fixed gap after the active bar, not flush against it. -->\n <template v-if=\"!isIndeterminate\">\n <div\n class=\"absolute inset-y-0 left-0 rounded-full transition-[width] duration-300 ease-in-out bg-(--m3-progress-bar)\"\n :style=\"{ width: `${clampedValue}%` }\"\n />\n <div\n class=\"absolute inset-y-0 right-0 rounded-full transition-[left] duration-300 ease-in-out bg-(--m3-progress-track)\"\n :style=\"{ left: `calc(${clampedValue}% + 4px)` }\"\n />\n </template>\n <div\n v-else\n class=\"absolute inset-y-0 w-2/5 rounded-full animate-[m3-progress-indeterminate_1.6s_ease-in-out_infinite] bg-(--m3-progress-bar)\"\n />\n </div>\n\n <!-- ── Wavy variant ───────────────────────────────────────────────────── -->\n <div\n v-else\n class=\"relative w-full overflow-visible\"\n :style=\"{ height: `${waveViewH}px` }\"\n role=\"progressbar\"\n :aria-valuenow=\"isIndeterminate ? undefined : clampedValue\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n >\n <!-- DETERMINATE — rAF drives clip-path, track.left, and wave path -->\n <template v-if=\"!isIndeterminate\">\n <!-- Active wave, clipped to displayedValue% -->\n <div\n ref=\"waveClipEl\"\n class=\"absolute inset-0 overflow-hidden\"\n style=\"clip-path: inset(0 100% 0 0)\"\n >\n <svg\n class=\"absolute top-0 left-0 h-full text-(--m3-progress-bar)\"\n :width=\"waveWidth\"\n :height=\"waveViewH\"\n :viewBox=\"`0 0 ${waveWidth} ${waveViewH}`\"\n >\n <path\n :d=\"wavePath\"\n fill=\"none\"\n stroke=\"currentColor\"\n :stroke-width=\"effectiveThickness\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>\n\n <!-- Inactive track — rAF owns left and height; no Vue-managed left -->\n <div\n ref=\"trackEl\"\n class=\"absolute right-0 bg-(--m3-progress-track)\"\n style=\"border-radius: 9999px; top: 50%; transform: translateY(-50%);\"\n />\n\n <!-- Stop dot at far right -->\n <div\n class=\"absolute rounded-full bg-(--m3-progress-bar)\"\n :style=\"{\n right: '0',\n top: '50%',\n transform: 'translateY(-50%)',\n width: `${effectiveThickness}px`,\n height: `${effectiveThickness}px`,\n }\"\n />\n </template>\n\n <!-- INDETERMINATE — keeps original CSS-animated wide strip -->\n <div v-else class=\"absolute inset-0 overflow-hidden rounded-full\">\n <div\n class=\"absolute top-0 left-0 h-full animate-[m3-wave-flow_0.9s_linear_infinite] text-(--m3-progress-bar)\"\n :style=\"{ width: `${waveWidth}px` }\"\n >\n <svg\n :width=\"waveWidth\"\n :height=\"waveViewH\"\n :viewBox=\"`0 0 ${waveWidth} ${waveViewH}`\"\n class=\"h-full\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n :d=\"staticWavePath\"\n fill=\"none\"\n stroke=\"currentColor\"\n :stroke-width=\"effectiveThickness\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<style>\n@keyframes m3-wave-flow {\n from { transform: translateX(0); }\n to { transform: translateX(-20px); }\n}\n\n@keyframes m3-progress-indeterminate {\n 0% { left: -40%; }\n 100% { left: 100%; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .animate-\\[m3-wave-flow_1\\.2s_linear_infinite\\],\n .animate-\\[m3-wave-flow_0\\.9s_linear_infinite\\],\n .animate-\\[m3-progress-indeterminate_1\\.6s_ease-in-out_infinite\\] {\n animation: none !important;\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A linear progress indicator — determinate, indeterminate, or the M3 Expressive wavy variant.\n */\nimport { computed, ref, watch, onMounted, onUnmounted, nextTick } from \"vue\";\n\nconst props = withDefaults(\n defineProps<{\n /** Progress 0–100 (omit for indeterminate) */\n value?: number;\n /** Indeterminate animation — also implied by omitting value */\n indeterminate?: boolean;\n /** Bar color: an M3 role or any CSS color (`#fff` over a photo, say) */\n color?: \"primary\" | \"secondary\" | \"tertiary\" | \"error\" | (string & {});\n /** Track color: an M3 role or any CSS color. Default the role's container, or the bar color at 24% for a CSS color */\n trackColor?: string;\n /** Bar style */\n variant?: \"linear\" | \"wavy\";\n /** Label text above the bar */\n label?: string;\n /** Stroke width in px. Defaults to 4dp, matching the real M3 token for both variants. */\n thickness?: number;\n }>(),\n { color: \"primary\", variant: \"linear\" },\n);\n\nconst isIndeterminate = computed(() => props.indeterminate || props.value === undefined);\nconst clampedValue = computed(() => Math.min(100, Math.max(0, props.value ?? 0)));\n\nconst ROLES = [\"primary\", \"secondary\", \"tertiary\", \"error\"];\nconst roleOr = (c: string) => (ROLES.includes(c) || c.endsWith(\"-container\") ? `var(--color-${c})` : c);\n// Both colors go through custom properties on the root, read by the bar/track/wave below.\nconst colorVars = computed(() => {\n const bar = roleOr(props.color);\n const track = props.trackColor\n ? roleOr(props.trackColor)\n : ROLES.includes(props.color)\n ? `var(--color-${props.color}-container)`\n : `color-mix(in srgb, ${props.color} 24%, transparent)`;\n return { \"--m3-progress-bar\": bar, \"--m3-progress-track\": track };\n});\n\n// ── Wave geometry ─────────────────────────────────────────────────────────\nconst PERIOD = 20;\nconst AMP = 2.5;\nconst PERIODS = 80;\nconst STEP = 2;\nconst MARGIN_PX = 4; // gap between wave right-end and track start\nconst WAVE_START = 10; // threshold % below which wave collapses to line\n\n// thickness-derived (computed so they react to prop changes)\nconst effectiveThickness = computed(() => props.thickness ?? 4);\nconst waveMid = computed(() => AMP + effectiveThickness.value / 2);\nconst waveViewH = computed(() => 2 * AMP + effectiveThickness.value);\n\nconst waveWidth = PERIOD * PERIODS; // 1600px — covers any container width\n\n// Static path for indeterminate — built once with the wavy default (thickness=3)\nconst STATIC_MID = AMP + 3 / 2; // = 4\nconst staticWavePath = (() => {\n let d = \"\";\n for (let x = 0; x <= waveWidth; x += STEP) {\n const y = STATIC_MID - AMP * Math.sin((x / PERIOD) * Math.PI * 2);\n d += `${x === 0 ? \"M\" : \"L\"}${x},${y.toFixed(2)} `;\n }\n return d.trim();\n})();\n\n// ── rAF state (plain JS — no Vue refs to avoid 60fps reactive overhead) ───\n//\n// Architecture mirrors MCircleProgressBar:\n// • displayedValue follows clampedValue with exponential smoothing (~300ms)\n// • appearanceF animates 0↔1 at the WAVE_START threshold and at 100%\n// • animPhase advances every frame to scroll the wave leftward\n// clip-path and track.left are written via direct DOM setAttribute/style\n// to avoid the CSS-transition vs rAF conflict.\nlet displayedValue = 0;\nlet appearanceF = 0;\nlet animPhase = 0;\n\ntype Anim = { from: number; to: number; t0: number; dur: number };\nconst appearAnim: Anim = { from: 0, to: 0, t0: -1, dur: 500 };\n\nfunction easeInOut(t: number) {\n return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;\n}\nfunction startAnim(a: Anim, from: number, to: number, now: number) {\n if (Math.abs(from - to) < 0.001) { a.t0 = -1; a.to = to; return; }\n a.from = from; a.to = to; a.t0 = now;\n}\nfunction tickAnim(a: Anim, now: number): number {\n if (a.t0 < 0) return a.to;\n const t = Math.min(1, (now - a.t0) / a.dur);\n const v = a.from + (a.to - a.from) * easeInOut(t);\n if (t >= 1) a.t0 = -1;\n return v;\n}\n\n// ── Template refs for direct DOM updates ─────────────────────────────────\nconst waveClipEl = ref<HTMLDivElement | null>(null);\nconst trackEl = ref<HTMLDivElement | null>(null);\nconst wavePath = ref(\"\"); // updated in tick → drives path's :d binding\n\n// ── rAF tick ─────────────────────────────────────────────────────────────\nlet lastTime: number | null = null;\nlet rafId = 0;\nconst PHASE_PER_MS = (2 * Math.PI) / 800; // one full PERIOD scroll per 800ms\nconst VALUE_TAU = 130; // exponential τ → ~300ms 90%-settle\n\nfunction buildWavePath(factor: number, ph: number): string {\n const mid = waveMid.value;\n const pts: string[] = [];\n for (let x = 0; x <= waveWidth; x += STEP) {\n const y = mid - AMP * factor * Math.sin((x / PERIOD) * Math.PI * 2 + ph);\n pts.push(`${x === 0 ? \"M\" : \"L\"}${x},${y.toFixed(2)}`);\n }\n return pts.join(\" \");\n}\n\nfunction tick(now: number) {\n const dt = lastTime !== null ? now - lastTime : 0;\n lastTime = now;\n\n // 1. Wave phase scrolls leftward\n animPhase -= dt * PHASE_PER_MS;\n\n // 2. Smooth displayed value (exponential interpolation)\n if (dt > 0) {\n const k = 1 - Math.exp(-dt / VALUE_TAU);\n displayedValue += (clampedValue.value - displayedValue) * k;\n }\n\n // 3. Advance appearance animation\n appearanceF = tickAnim(appearAnim, now);\n\n // 4. Update DOM directly\n const margin = MARGIN_PX * appearanceF;\n const dv = displayedValue;\n\n if (waveClipEl.value)\n waveClipEl.value.style.clipPath = `inset(0 ${(100 - dv).toFixed(3)}% 0 0)`;\n\n if (trackEl.value) {\n trackEl.value.style.left = `calc(${dv.toFixed(3)}% + ${margin.toFixed(2)}px)`;\n trackEl.value.style.height = `${effectiveThickness.value}px`;\n }\n\n // 5. Rebuild wave path (drives :d via Vue ref)\n wavePath.value = buildWavePath(appearanceF, animPhase);\n\n rafId = requestAnimationFrame(tick);\n}\n\n// ── Watchers ─────────────────────────────────────────────────────────────\nwatch(clampedValue, (v, prev) => {\n if (props.variant !== \"wavy\" || isIndeterminate.value) return;\n const now = performance.now();\n\n if (prev <= WAVE_START && v > WAVE_START && v < 100) startAnim(appearAnim, appearanceF, 1, now);\n else if (prev > WAVE_START && v <= WAVE_START) startAnim(appearAnim, appearanceF, 0, now);\n else if (v === 100) startAnim(appearAnim, appearanceF, 0, now);\n else if (prev === 100 && v > WAVE_START) startAnim(appearAnim, appearanceF, 1, now);\n});\n\nfunction initAndStart() {\n displayedValue = clampedValue.value;\n const v = clampedValue.value;\n appearanceF = (v > WAVE_START && v < 100) ? 1 : 0;\n appearAnim.to = appearanceF;\n appearAnim.t0 = -1;\n\n // Set initial DOM values immediately to avoid a one-frame flash\n const margin = MARGIN_PX * appearanceF;\n if (waveClipEl.value)\n waveClipEl.value.style.clipPath = `inset(0 ${(100 - v).toFixed(3)}% 0 0)`;\n if (trackEl.value) {\n trackEl.value.style.left = `calc(${v.toFixed(3)}% + ${margin.toFixed(2)}px)`;\n trackEl.value.style.height = `${effectiveThickness.value}px`;\n }\n wavePath.value = buildWavePath(appearanceF, animPhase);\n\n if (!rafId) rafId = requestAnimationFrame(tick);\n}\n\nfunction stopRaf() {\n cancelAnimationFrame(rafId);\n rafId = 0; lastTime = null;\n appearAnim.t0 = -1;\n}\n\nonMounted(() => {\n if (props.variant === \"wavy\" && !isIndeterminate.value) initAndStart();\n});\nonUnmounted(stopRaf);\n\nwatch(() => props.variant, async (v) => {\n if (v === \"wavy\" && !isIndeterminate.value) { await nextTick(); initAndStart(); }\n else stopRaf();\n});\nwatch(isIndeterminate, async (v) => {\n if (!v && props.variant === \"wavy\") { await nextTick(); initAndStart(); }\n else stopRaf();\n});\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1\" :style=\"colorVars\">\n <span v-if=\"label\" class=\"text-label-small text-on-surface-variant\">{{ label }}</span>\n\n <!-- ── Linear variant ────────────────────────────────────────────────── -->\n <div\n v-if=\"variant === 'linear'\"\n class=\"relative w-full overflow-hidden rounded-full\"\n :class=\"isIndeterminate ? 'bg-(--m3-progress-track)' : ''\"\n :style=\"{ height: `${effectiveThickness}px` }\"\n role=\"progressbar\"\n :aria-valuenow=\"isIndeterminate ? undefined : clampedValue\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n >\n <!-- LinearProgressIndicatorTokens.TrackActiveSpace=4dp: the track starts\n a fixed gap after the active bar, not flush against it. -->\n <template v-if=\"!isIndeterminate\">\n <div\n class=\"absolute inset-y-0 left-0 rounded-full transition-[width] duration-300 ease-in-out bg-(--m3-progress-bar)\"\n :style=\"{ width: `${clampedValue}%` }\"\n />\n <div\n class=\"absolute inset-y-0 right-0 rounded-full transition-[left] duration-300 ease-in-out bg-(--m3-progress-track)\"\n :style=\"{ left: `calc(${clampedValue}% + 4px)` }\"\n />\n </template>\n <div\n v-else\n class=\"absolute inset-y-0 w-2/5 rounded-full animate-[m3-progress-indeterminate_1.6s_ease-in-out_infinite] bg-(--m3-progress-bar)\"\n />\n </div>\n\n <!-- ── Wavy variant ───────────────────────────────────────────────────── -->\n <div\n v-else\n class=\"relative w-full overflow-visible\"\n :style=\"{ height: `${waveViewH}px` }\"\n role=\"progressbar\"\n :aria-valuenow=\"isIndeterminate ? undefined : clampedValue\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n >\n <!-- DETERMINATE — rAF drives clip-path, track.left, and wave path -->\n <template v-if=\"!isIndeterminate\">\n <!-- Active wave, clipped to displayedValue% -->\n <div\n ref=\"waveClipEl\"\n class=\"absolute inset-0 overflow-hidden\"\n style=\"clip-path: inset(0 100% 0 0)\"\n >\n <svg\n class=\"absolute top-0 left-0 h-full text-(--m3-progress-bar)\"\n :width=\"waveWidth\"\n :height=\"waveViewH\"\n :viewBox=\"`0 0 ${waveWidth} ${waveViewH}`\"\n >\n <path\n :d=\"wavePath\"\n fill=\"none\"\n stroke=\"currentColor\"\n :stroke-width=\"effectiveThickness\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>\n\n <!-- Inactive track — rAF owns left and height; no Vue-managed left -->\n <div\n ref=\"trackEl\"\n class=\"absolute right-0 bg-(--m3-progress-track)\"\n style=\"border-radius: 9999px; top: 50%; transform: translateY(-50%);\"\n />\n\n <!-- Stop dot at far right -->\n <div\n class=\"absolute rounded-full bg-(--m3-progress-bar)\"\n :style=\"{\n right: '0',\n top: '50%',\n transform: 'translateY(-50%)',\n width: `${effectiveThickness}px`,\n height: `${effectiveThickness}px`,\n }\"\n />\n </template>\n\n <!-- INDETERMINATE — keeps original CSS-animated wide strip -->\n <div v-else class=\"absolute inset-0 overflow-hidden rounded-full\">\n <div\n class=\"absolute top-0 left-0 h-full animate-[m3-wave-flow_0.9s_linear_infinite] text-(--m3-progress-bar)\"\n :style=\"{ width: `${waveWidth}px` }\"\n >\n <svg\n :width=\"waveWidth\"\n :height=\"waveViewH\"\n :viewBox=\"`0 0 ${waveWidth} ${waveViewH}`\"\n class=\"h-full\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n :d=\"staticWavePath\"\n fill=\"none\"\n stroke=\"currentColor\"\n :stroke-width=\"effectiveThickness\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<style>\n@keyframes m3-wave-flow {\n from { transform: translateX(0); }\n to { transform: translateX(-20px); }\n}\n\n@keyframes m3-progress-indeterminate {\n 0% { left: -40%; }\n 100% { left: 100%; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .animate-\\[m3-wave-flow_1\\.2s_linear_infinite\\],\n .animate-\\[m3-wave-flow_0\\.9s_linear_infinite\\],\n .animate-\\[m3-progress-indeterminate_1\\.6s_ease-in-out_infinite\\] {\n animation: none !important;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;0DA2CM,IAAa,IACb,IAAa,KAEb,IAAa,GACb,IAAa,GACb,IAAa,IA2Db,IAAe;;;;;;;;;;;;EArGrB,IAAM,IAAQ,GAoBR,IAAkB,QAAe,EAAM,iBAAiB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