@m3ui-vue/m3ui-vue 1.8.0 → 1.9.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 (297) hide show
  1. package/dist/API.md +34 -19
  2. package/dist/MButton-LiZRRP4h.js +171 -0
  3. package/dist/MButton-LiZRRP4h.js.map +1 -0
  4. package/dist/{MColorPickerModal-H8nuX0Wu.js → MColorPickerModal-IjciC8zh.js} +185 -184
  5. package/dist/MColorPickerModal-IjciC8zh.js.map +1 -0
  6. package/dist/MDialog-BLpfgIA3.js +167 -0
  7. package/dist/MDialog-BLpfgIA3.js.map +1 -0
  8. package/dist/MIcon-BSsJZhK7.js +116 -0
  9. package/dist/MIcon-BSsJZhK7.js.map +1 -0
  10. package/dist/{MIconButton-BBggVwBV.js → MIconButton-CNjN0xwW.js} +18 -18
  11. package/dist/{MIconButton-BBggVwBV.js.map → MIconButton-CNjN0xwW.js.map} +1 -1
  12. package/dist/{MListItem-DiOAxaN7.js → MListItem-BBQ-6i3v.js} +139 -139
  13. package/dist/MListItem-BBQ-6i3v.js.map +1 -0
  14. package/dist/{MLoadingIndicator-CuTZYFFj.js → MLoadingIndicator-dejdXpu8.js} +2 -2
  15. package/dist/{MLoadingIndicator-CuTZYFFj.js.map → MLoadingIndicator-dejdXpu8.js.map} +1 -1
  16. package/dist/MMenuItem-E31tMzOt.js +577 -0
  17. package/dist/MMenuItem-E31tMzOt.js.map +1 -0
  18. package/dist/MPdfViewer-B5Q9Xs9d.js +1866 -0
  19. package/dist/MPdfViewer-B5Q9Xs9d.js.map +1 -0
  20. package/dist/MProgressBar-CPrZhQbA.js +179 -0
  21. package/dist/MProgressBar-CPrZhQbA.js.map +1 -0
  22. package/dist/{MSeekBar-BCDQTx2t.js → MSeekBar-NwkuAzx-.js} +2 -2
  23. package/dist/{MSeekBar-BCDQTx2t.js.map → MSeekBar-NwkuAzx-.js.map} +1 -1
  24. package/dist/{MSegmentedButton-BXzRsg1S.js → MSegmentedButton-DZuZLBML.js} +4 -4
  25. package/dist/{MSegmentedButton-BXzRsg1S.js.map → MSegmentedButton-DZuZLBML.js.map} +1 -1
  26. package/dist/MSignaturePad-Bqr-1R9f.js +140 -0
  27. package/dist/MSignaturePad-Bqr-1R9f.js.map +1 -0
  28. package/dist/MSlider-B7dIcHVn.js +745 -0
  29. package/dist/MSlider-B7dIcHVn.js.map +1 -0
  30. package/dist/{MSpinner-UCdtSOHP.js → MSpinner-CXLY7lWw.js} +2 -2
  31. package/dist/{MSpinner-UCdtSOHP.js.map → MSpinner-CXLY7lWw.js.map} +1 -1
  32. package/dist/{MTextField-CYk9yFvi.js → MTextField-CryHMs8-.js} +18 -18
  33. package/dist/MTextField-CryHMs8-.js.map +1 -0
  34. package/dist/MTooltip-Cn_DYm9M.js +90 -0
  35. package/dist/MTooltip-Cn_DYm9M.js.map +1 -0
  36. package/dist/{_popupPosition-nL8SVKPK.js → _popupPosition-C_lxj9qU.js} +7 -7
  37. package/dist/_popupPosition-C_lxj9qU.js.map +1 -0
  38. package/dist/{_useFieldValidation-B0B44M_t.js → _useFieldValidation-CvZnZfl-.js} +2 -2
  39. package/dist/{_useFieldValidation-B0B44M_t.js.map → _useFieldValidation-CvZnZfl-.js.map} +1 -1
  40. package/dist/api.json +1 -1
  41. package/dist/code-editor.js +129 -128
  42. package/dist/code-editor.js.map +1 -1
  43. package/dist/components/MAddressField.vue.d.ts +1 -1
  44. package/dist/components/MAudioPlayer.vue.d.ts +1 -1
  45. package/dist/components/MAutocomplete.vue.d.ts +1 -1
  46. package/dist/components/MAvailabilityCalendar.vue.d.ts +3 -3
  47. package/dist/components/MBadge.vue.d.ts +2 -2
  48. package/dist/components/MBar.vue.d.ts +1 -1
  49. package/dist/components/MBeforeAfter.vue.d.ts +3 -3
  50. package/dist/components/MButton.vue.d.ts +1 -1
  51. package/dist/components/MCalendarHeatmap.vue.d.ts +1 -1
  52. package/dist/components/MChatBubble.vue.d.ts +1 -1
  53. package/dist/components/MCodeEditor.vue.d.ts +1 -1
  54. package/dist/components/MContainerTransform.vue.d.ts +1 -1
  55. package/dist/components/MCopyButton.vue.d.ts +2 -2
  56. package/dist/components/MCountrySelect.vue.d.ts +1 -1
  57. package/dist/components/MCreditCardInput.vue.d.ts +2 -2
  58. package/dist/components/MDiffViewer.vue.d.ts +1 -1
  59. package/dist/components/MDrawCanvas.vue.d.ts +2 -2
  60. package/dist/components/MExpansionPanel.vue.d.ts +1 -1
  61. package/dist/components/MExportButton.vue.d.ts +1 -1
  62. package/dist/components/MFab.vue.d.ts +1 -1
  63. package/dist/components/MFilterBuilder.vue.d.ts +1 -1
  64. package/dist/components/MFlex.vue.d.ts +2 -2
  65. package/dist/components/MFloorPlan.vue.d.ts +2 -2
  66. package/dist/components/MFlow.vue.d.ts +2 -2
  67. package/dist/components/MFormRenderer.vue.d.ts +2 -2
  68. package/dist/components/MGantt.vue.d.ts +2 -2
  69. package/dist/components/MGanttControls.vue.d.ts +1 -1
  70. package/dist/components/MGrid.vue.d.ts +1 -1
  71. package/dist/components/MIcon.vue.d.ts +3 -5
  72. package/dist/components/MIconButton.vue.d.ts +1 -1
  73. package/dist/components/MLightbox.vue.d.ts +2 -2
  74. package/dist/components/MMapMeasure.vue.d.ts +2 -2
  75. package/dist/components/MMenu.vue.d.ts +6 -3
  76. package/dist/components/MMortgageCalculator.vue.d.ts +2 -2
  77. package/dist/components/MMultiAutocomplete.vue.d.ts +1 -1
  78. package/dist/components/MMultiSelect.vue.d.ts +1 -1
  79. package/dist/components/MNavigationDrawer.vue.d.ts +5 -4
  80. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  81. package/dist/components/MNumberField.vue.d.ts +1 -1
  82. package/dist/components/MOdontogram.vue.d.ts +2 -2
  83. package/dist/components/MPdfSigner.vue.d.ts +1 -1
  84. package/dist/components/MPhoneInput.vue.d.ts +2 -2
  85. package/dist/components/MPinInput.vue.d.ts +3 -3
  86. package/dist/components/MPosKeypad.vue.d.ts +1 -1
  87. package/dist/components/MProductConfigurator.vue.d.ts +1 -1
  88. package/dist/components/MResourceTimeline.vue.d.ts +2 -2
  89. package/dist/components/MRichTextEditor.vue.d.ts +1 -1
  90. package/dist/components/MScheme.vue.d.ts +1 -1
  91. package/dist/components/MSearchBar.vue.d.ts +2 -2
  92. package/dist/components/MSearchField.vue.d.ts +1 -1
  93. package/dist/components/MSeatMap.vue.d.ts +1 -1
  94. package/dist/components/MSeekBar.vue.d.ts +2 -2
  95. package/dist/components/MSelect.vue.d.ts +1 -1
  96. package/dist/components/MShortNavigationBar.vue.d.ts +1 -1
  97. package/dist/components/MSkeleton.vue.d.ts +1 -1
  98. package/dist/components/MSpreadsheet.vue.d.ts +2 -2
  99. package/dist/components/MStack.vue.d.ts +2 -2
  100. package/dist/components/MSubtitle.vue.d.ts +1 -1
  101. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  102. package/dist/components/MSwitch.vue.d.ts +1 -1
  103. package/dist/components/MTagInput.vue.d.ts +1 -1
  104. package/dist/components/MText.vue.d.ts +1 -1
  105. package/dist/components/MTextField.vue.d.ts +3 -3
  106. package/dist/components/MTimeScroll.vue.d.ts +1 -1
  107. package/dist/components/MTimezoneSelect.vue.d.ts +1 -1
  108. package/dist/components/MTitle.vue.d.ts +1 -1
  109. package/dist/components/MToolbar.vue.d.ts +1 -1
  110. package/dist/components/MTooltip.vue.d.ts +1 -1
  111. package/dist/components/MTopAppBar.vue.d.ts +2 -2
  112. package/dist/components/MVitalsChart.vue.d.ts +1 -1
  113. package/dist/components/MWindow.vue.d.ts +3 -3
  114. package/dist/components/_MDrawerItemList.vue.d.ts +8 -1
  115. package/dist/composables/_fieldLayout.d.ts +8 -8
  116. package/dist/composables/_popupPosition.d.ts +3 -2
  117. package/dist/composables/_rtl.d.ts +26 -0
  118. package/dist/composables/useColorPalette.d.ts +1 -1
  119. package/dist/composables/useLocale.d.ts +4 -0
  120. package/dist/draw.js +5 -5
  121. package/dist/flow.js +2 -2
  122. package/dist/gantt.js +3 -3
  123. package/dist/locales/ar.d.ts +6 -0
  124. package/dist/locales/index.d.ts +1 -0
  125. package/dist/locales/index.js +768 -1
  126. package/dist/locales/index.js.map +1 -1
  127. package/dist/m3ui-vue.css +1 -1
  128. package/dist/m3ui.js +11962 -12039
  129. package/dist/m3ui.js.map +1 -1
  130. package/dist/map.js +1127 -1149
  131. package/dist/map.js.map +1 -1
  132. package/dist/markdown.js +1 -1
  133. package/dist/markdown.js.map +1 -1
  134. package/dist/media.js +7 -7
  135. package/dist/pdf-sign.d.ts +3 -0
  136. package/dist/pdf-sign.js +548 -0
  137. package/dist/pdf-sign.js.map +1 -0
  138. package/dist/pdf.d.ts +0 -3
  139. package/dist/pdf.js +1 -2400
  140. package/dist/plugin.d.ts +8 -0
  141. package/dist/rich-text-editor.js +79 -77
  142. package/dist/rich-text-editor.js.map +1 -1
  143. package/dist/styles/theme.css +13 -0
  144. package/dist/styles.css +1 -1
  145. package/dist/terminal.js +5 -2
  146. package/dist/terminal.js.map +1 -1
  147. package/dist/{useLocale-DL96OFgr.js → useLocale-ybIju59R.js} +3 -1
  148. package/dist/useLocale-ybIju59R.js.map +1 -0
  149. package/dist/vTooltip-xESB2YOb.js +154 -0
  150. package/dist/vTooltip-xESB2YOb.js.map +1 -0
  151. package/package.json +5 -1
  152. package/src/__tests__/MAddressField.test.ts +1 -1
  153. package/src/__tests__/MChip.test.ts +3 -3
  154. package/src/__tests__/MFab.test.ts +6 -6
  155. package/src/__tests__/MListItemNestedControl.test.ts +2 -2
  156. package/src/__tests__/MScheduler.test.ts +1 -1
  157. package/src/__tests__/MTrackingTimeline.test.ts +1 -1
  158. package/src/__tests__/MWindow.test.ts +16 -0
  159. package/src/__tests__/fieldOverflow.test.ts +9 -9
  160. package/src/__tests__/hydration.test.ts +39 -0
  161. package/src/__tests__/localePresets.test.ts +2 -0
  162. package/src/__tests__/rtl.test.ts +167 -0
  163. package/src/__tests__/ssr.test.ts +6 -0
  164. package/src/components/MAlert.vue +1 -1
  165. package/src/components/MAutocomplete.vue +7 -7
  166. package/src/components/MAvailabilityCalendar.vue +5 -3
  167. package/src/components/MBadge.vue +12 -3
  168. package/src/components/MBar.vue +1 -1
  169. package/src/components/MBottomAppBar.vue +1 -1
  170. package/src/components/MCalendar.vue +3 -3
  171. package/src/components/MCalendarHeatmap.vue +3 -3
  172. package/src/components/MChatBubble.vue +3 -3
  173. package/src/components/MChip.vue +6 -6
  174. package/src/components/MCodeEditor.vue +7 -3
  175. package/src/components/MColorPicker.vue +1 -1
  176. package/src/components/MCommandPalette.vue +1 -1
  177. package/src/components/MContainerTransform.vue +1 -1
  178. package/src/components/MContextMenu.vue +1 -1
  179. package/src/components/MDataTable.vue +5 -5
  180. package/src/components/MDatePicker.vue +3 -2
  181. package/src/components/MDateRangePicker.vue +3 -2
  182. package/src/components/MDialog.vue +5 -5
  183. package/src/components/MDiffViewer.vue +1 -1
  184. package/src/components/MDivider.vue +1 -1
  185. package/src/components/MDragDropList.vue +1 -1
  186. package/src/components/MEmojiSelector.vue +11 -7
  187. package/src/components/MExpansionPanel.vue +1 -1
  188. package/src/components/MFab.vue +5 -5
  189. package/src/components/MFormBuilder.vue +3 -3
  190. package/src/components/MIcon.vue +14 -2
  191. package/src/components/MJsonEditor.vue +1 -3
  192. package/src/components/MJsonViewer.vue +1 -1
  193. package/src/components/MKanban.vue +2 -1
  194. package/src/components/MListDetail.vue +2 -2
  195. package/src/components/MListGroup.vue +1 -1
  196. package/src/components/MListItem.vue +5 -5
  197. package/src/components/MListSubheader.vue +1 -1
  198. package/src/components/MMapDraw.vue +3 -2
  199. package/src/components/MMapHover.vue +2 -1
  200. package/src/components/MMapMeasure.vue +2 -1
  201. package/src/components/MMapRoute.vue +2 -1
  202. package/src/components/MMarkdown.vue +9 -6
  203. package/src/components/MMaskField.vue +6 -6
  204. package/src/components/MMenu.vue +13 -6
  205. package/src/components/MMenuItem.vue +8 -6
  206. package/src/components/MMultiAutocomplete.vue +9 -8
  207. package/src/components/MMultiSelect.vue +9 -8
  208. package/src/components/MNavigationDrawer.vue +39 -27
  209. package/src/components/MNavigationRail.vue +28 -19
  210. package/src/components/MNavigationSuite.vue +1 -1
  211. package/src/components/MNotificationCenter.vue +1 -1
  212. package/src/components/MNotificationHost.vue +1 -1
  213. package/src/components/MNumberField.vue +6 -6
  214. package/src/components/MOrderTicket.vue +1 -1
  215. package/src/components/MPageProgress.vue +1 -1
  216. package/src/components/MPdfSigner.vue +1 -1
  217. package/src/components/MPhoneInput.vue +5 -4
  218. package/src/components/MPinInput.vue +3 -2
  219. package/src/components/MPosKeypad.vue +2 -1
  220. package/src/components/MProductConfigurator.vue +2 -1
  221. package/src/components/MProgressBar.vue +2 -2
  222. package/src/components/MRichTextEditor.vue +8 -4
  223. package/src/components/MScheduler.vue +14 -14
  224. package/src/components/MSearchField.vue +1 -1
  225. package/src/components/MSeatMap.vue +2 -1
  226. package/src/components/MSegmentedButton.vue +1 -1
  227. package/src/components/MSelect.vue +7 -7
  228. package/src/components/MSideSheet.vue +3 -2
  229. package/src/components/MSimpleCarousel.vue +20 -11
  230. package/src/components/MSlider.vue +15 -5
  231. package/src/components/MSnackbar.vue +2 -2
  232. package/src/components/MSplitButton.vue +3 -2
  233. package/src/components/MSplitter.vue +6 -3
  234. package/src/components/MSpotlightSearch.vue +1 -1
  235. package/src/components/MSwitch.vue +5 -5
  236. package/src/components/MTable.vue +3 -3
  237. package/src/components/MTabs.vue +4 -1
  238. package/src/components/MTagInput.vue +6 -6
  239. package/src/components/MTerminal.vue +1 -1
  240. package/src/components/MText.vue +1 -1
  241. package/src/components/MTextField.vue +7 -7
  242. package/src/components/MTimePicker.vue +3 -2
  243. package/src/components/MTimePickerModal.vue +2 -2
  244. package/src/components/MTimeScroll.vue +1 -1
  245. package/src/components/MTimeline.vue +12 -12
  246. package/src/components/MToolbar.vue +3 -3
  247. package/src/components/MTrackingTimeline.vue +3 -2
  248. package/src/components/MTransition.vue +8 -3
  249. package/src/components/MTreeTable.vue +1 -1
  250. package/src/components/MTypewriter.vue +1 -1
  251. package/src/components/MVirtualTable.vue +2 -2
  252. package/src/components/MWindow.vue +4 -3
  253. package/src/components/_MColorPanel.vue +5 -4
  254. package/src/components/_MDrawerItemList.vue +9 -5
  255. package/src/components/_MMapAttribution.vue +2 -1
  256. package/src/components/_MMonthYearButton.vue +1 -1
  257. package/src/components/_MTransferPane.vue +8 -1
  258. package/src/components/_MTreeNode.vue +3 -3
  259. package/src/components/_MYearGrid.vue +4 -2
  260. package/src/composables/_fieldLayout.ts +19 -19
  261. package/src/composables/_popupPosition.ts +5 -3
  262. package/src/composables/_rtl.ts +76 -0
  263. package/src/composables/_useMenuNav.ts +24 -17
  264. package/src/composables/_useSheetMotion.ts +10 -3
  265. package/src/composables/pdfSign.ts +2 -2
  266. package/src/composables/useLocale.ts +6 -0
  267. package/src/locales/ar.ts +798 -0
  268. package/src/locales/de.ts +2 -0
  269. package/src/locales/es.ts +2 -0
  270. package/src/locales/fr.ts +2 -0
  271. package/src/locales/index.ts +1 -0
  272. package/src/locales/ja.ts +2 -0
  273. package/src/locales/ko.ts +2 -0
  274. package/src/locales/pt.ts +2 -0
  275. package/src/locales/zh.ts +2 -0
  276. package/src/pdf-sign.ts +5 -0
  277. package/src/pdf.ts +0 -3
  278. package/src/plugin.ts +10 -0
  279. package/src/styles/theme.css +13 -0
  280. package/dist/MColorPickerModal-H8nuX0Wu.js.map +0 -1
  281. package/dist/MDialog-B42Mhn8W.js +0 -331
  282. package/dist/MDialog-B42Mhn8W.js.map +0 -1
  283. package/dist/MIcon-DpajuUTJ.js +0 -33
  284. package/dist/MIcon-DpajuUTJ.js.map +0 -1
  285. package/dist/MListItem-DiOAxaN7.js.map +0 -1
  286. package/dist/MMenuItem-BuxYoASE.js +0 -574
  287. package/dist/MMenuItem-BuxYoASE.js.map +0 -1
  288. package/dist/MSignaturePad-BTqGaPXA.js +0 -313
  289. package/dist/MSignaturePad-BTqGaPXA.js.map +0 -1
  290. package/dist/MSlider-D_O8J9YH.js +0 -739
  291. package/dist/MSlider-D_O8J9YH.js.map +0 -1
  292. package/dist/MTextField-CYk9yFvi.js.map +0 -1
  293. package/dist/MTooltip-CK39Zon4.js +0 -183
  294. package/dist/MTooltip-CK39Zon4.js.map +0 -1
  295. package/dist/_popupPosition-nL8SVKPK.js.map +0 -1
  296. package/dist/pdf.js.map +0 -1
  297. package/dist/useLocale-DL96OFgr.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MProgressBar-CPrZhQbA.js","names":["_openBlock","_createElementBlock","_normalizeStyle","_toDisplayString","_normalizeClass","_Fragment","_createElementVNode","_unref","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","PERIOD","AMP","STEP","MARGIN_PX","WAVE_START","VALUE_TAU","MProgressBar_default","defineComponent","props","__props","isIndeterminate","computed","clampedValue","ROLES","roleOr","c","colorVars","effectiveThickness","waveMid","waveViewH","waveWidth","staticWavePath","d","x","y","displayedValue","appearanceF","animPhase","appearAnim","easeInOut","t","startAnim","from","to","now","tickAnim","a","v","waveClipEl","ref","trackEl","wavePath","lastTime","rafId","PHASE_PER_MS","buildWavePath","mid","pts","factor","ph","tick","dt","k","margin","dv","prev","initAndStart","stopRaf","onMounted","onUnmounted","watch","nextTick","openBlock","createElementBlock","normalizeStyle","toDisplayString","createCommentVNode","normalizeClass","Fragment","createElementVNode","unref","\"top\"","\"transform\""],"sources":["../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 m3-rtl:-scale-x-100\"\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 m3-rtl:-scale-x-100\"\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":";;;;;;;;;;;A,0DA2CMiB,IAAa,IACbC,IAAa,KAEbC,IAAa,GACbC,IAAa,GACbC,IAAa,IA2DbC,IAAe,K;;;;;;;;;;;;EArGrB,IAAMG,IAAQC,GAoBRC,IAAkBC,QAAeH,EAAM,iBAAiBA,EAAM,UAAU,KAAA,CAAS,GACjFI,IAAkBD,QAAe,KAAK,IAAI,KAAK,KAAK,IAAI,GAAGH,EAAM,SAAS,CAAC,CAAC,CAAC,GAE7EK,IAAQ;GAAC;GAAW;GAAa;GAAY;EAAO,GACpDC,KAAU,MAAeD,EAAM,SAASE,CAAC,KAAKA,EAAE,SAAS,YAAY,IAAI,eAAeA,EAAE,KAAKA,GAE/FC,KAAYL,SAOT;GAAE,qBANGG,EAAON,EAAM,KAMK;GAAK,uBALrBA,EAAM,aAChBM,EAAON,EAAM,UAAU,IACvBK,EAAM,SAASL,EAAM,KAAK,IACxB,eAAeA,EAAM,MAAM,eAC3B,sBAAsBA,EAAM,MAAM;EACwB,EACjE,GAWKS,IAAqBN,QAAeH,EAAM,aAAa,CAAC,GACxDU,IAAWP,QAAeV,IAAMgB,EAAmB,QAAQ,CAAC,GAC5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GACL,QAAO;GACN,gBAAcJ,EAAA;GACf,kBAAe;E,oCA7DvBlC,EAAA,GAAAC,EAyCWI,GAAA,EAAA,KAAA,EAAA,GAAA;GAvCTC,EAmBM,OAAA;IAlBA,SAAA;IAAJ,KAAIiD;IACJ,OAAM;IACN,OAAA,EAAA,aAAA,oBAAA;G,KAEAvD,EAAA,GAAAC,EAaM,OAAA;IAZJ,OAAM;IACL,OAAOoC;IACP,QAAQD,EAAA;IACR,SAAO,OAASC,EAAS,GAAID,EAAA;G,IAE9B9B,EAME,QAAA;IALC,GAAGoD,EAAA;IACJ,MAAK;IACL,QAAO;IACN,gBAAcxB,EAAA;IACf,kBAAe;;GAMrB5B,EAIE,OAAA;IAHI,SAAA;IAAJ,KAAImD;IACJ,OAAM;IACN,OAAA;KAAA,iBAAA;KAAA+B,KAAA;KAAAC,WAAA;IAAA;;GAIFnF,EASE,OAAA;IARA,OAAM;IACL,OAAKJ,EAAA;;;;KAAqH,OAAA,GAAAgC,EAAA,MAAkB;KAA6B,QAAA,GAAAA,EAAA,MAAkB"}
@@ -1,4 +1,4 @@
1
- import { i as e } from "./useLocale-DL96OFgr.js";
1
+ import { i as e } from "./useLocale-ybIju59R.js";
2
2
  import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, onBeforeUnmount as l, onMounted as ee, openBlock as u, ref as d, renderList as te, renderSlot as ne, toDisplayString as f, unref as p, watch as m } from "vue";
3
3
  // src/components/MSeekBar.vue?vue&type=script&setup=true&lang.ts
4
4
  var re = [
@@ -431,4 +431,4 @@ var re = [
431
431
  });
432
432
  export { de as t };
433
433
 
434
- //# sourceMappingURL=MSeekBar-BCDQTx2t.js.map
434
+ //# sourceMappingURL=MSeekBar-NwkuAzx-.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MSeekBar-BCDQTx2t.js","names":["_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_toDisplayString","_createElementVNode","_unref","_Fragment","_renderList","_renderSlot","useLocale","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","MSeekBar_default","defineComponent","__emit","props","__props","emit","locale","SIZES","s","computed","dur","inactive","ROLES","colors","active","pad","n","fmt","t","sec","h","m","scrubTime","ref","pos","current","showRemaining","v","toggleRemaining","timeStyle","startText","endText","valueText","chapterAt","found","c","trackEl","width","toPx","thumbX","x","inset","bufferedRanges","b","pieces","W","track","trackH","chapterGap","cuts","cx","gap","p","q","spans","at","c0","c1","full","small","playedTo","a","fills","t0","t1","l","r","stopDot","pressed","focused","hovered","thumbStyle","base","d","scale","dotIdle","narrow","hoverTime","previewTime","previewChapter","bubbleEl","bubbleW","bubbleObserver","el","previewX","half","press","timeAt","clientX","scrubTo","begin","commit","now","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","dx","dy","end","onHover","onLeave","onKeyDown","steps","baseAt","raf","last","amp","phase","wavePathEl","svgH","reducedMotion","ampTarget","advancing","syncPos","drawWave","path","wave","mid","k","length","px","frame","dt","kick","watch","resizeObserver","onMounted","onBeforeUnmount","openBlock","createElementBlock","normalizeClass","normalizeStyle","toDisplayString","createCommentVNode","createElementVNode","unref","_cache","Fragment","renderList","i","j","f","renderSlot","_ctx"],"sources":["../src/components/MSeekBar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface SeekBarChapter {\n /** Where the chapter starts, in seconds */\n start: number\n /** Shown in the preview while the pointer is over it */\n title?: string\n}\n</script>\n\n<script setup lang=\"ts\">\n/**\n * A media seek bar (not an M3 spec component; Media3's ProgressSlider is a plain M3 Slider, which this follows in\n * its default look): the playback position on a track with the buffered part, optional chapters, elapsed and\n * total (or remaining) time, and a preview of the time under the pointer. Dragging scrubs locally and seeks once\n * on release (or live, with `live`); a tap or click seeks to that point. While `playing`, it advances on its own\n * between `modelValue` updates, so a 4Hz `timeupdate` still moves it smoothly.\n *\n * @slot preview Replaces the bubble shown above the pointer while hovering or dragging (a frame preview, say).\n * Props: `{ time, formatted, chapter }`\n * @event update:modelValue Emitted on a seek (and continuously while dragging with `live`) — powers v-model\n * @event seek Emitted once per seek with its time: on release of a drag, a tap or click, or a key press\n * @event scrub-start Emitted when a drag starts, with its time\n * @event scrub Emitted while dragging, with the time under the pointer\n * @event update:remaining Emitted when the end label is clicked to switch between total and remaining time\n */\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useLocale } from '../composables/useLocale'\n\nconst props = withDefaults(defineProps<{\n /** Playback position in seconds (v-model) */\n modelValue: number\n /** Media length in seconds; 0, NaN or Infinity (not loaded yet, a live stream) disables seeking */\n duration: number\n /** How much is loaded: up to a time, or time ranges (`[[start, end], …]`, like a media element's `buffered`) */\n buffered?: number | [number, number][]\n /** Chapter starts, drawn as gaps in the track; their titles show in the preview */\n chapters?: SeekBarChapter[]\n /** The media is playing: the bar moves on its own between updates, and the wavy line waves */\n playing?: boolean\n /** Playback speed, for that motion between updates */\n playbackRate?: number\n /** Updates the v-model continuously while dragging (the media follows the thumb), not only on release */\n live?: boolean\n /** `slider`: the M3 slider (bar thumb with a gap around it). `line`: a plain line with a round thumb. `wavy`: the played part waves while playing */\n variant?: 'slider' | 'line' | 'wavy'\n /** Track thickness: `md` (16px, the smallest M3 slider), `sm` (8px) or `xs` (4px, over a video) */\n size?: 'xs' | 'sm' | 'md'\n /** Where the elapsed and total time go */\n time?: 'below' | 'sides' | 'none'\n /** The end label shows the remaining time (`-1:23`) instead of the total; clicking it switches (v-model:remaining) */\n remaining?: boolean\n /** Formats a time in seconds. Default `m:ss`, or `h:mm:ss` for media an hour or longer */\n format?: (seconds: number) => string\n /** Seconds the arrow keys move; Page Up/Down move 10% */\n keyStep?: number\n /** Shows the time (and chapter) above the pointer while hovering or dragging */\n preview?: boolean\n /** Played part and thumb: an M3 role (`primary`, `secondary`, `tertiary`, `error`) or any CSS color */\n color?: string\n /** Unplayed track: an M3 role or any CSS color. Default secondary-container */\n trackColor?: string\n /** The time labels' color, as a CSS color (white over a video, say). Default on-surface-variant */\n timeColor?: string\n /** Disables seeking */\n disabled?: boolean\n /** Accessible name. Default the locale's `seekBar` */\n label?: string\n}>(), {\n playing: false,\n playbackRate: 1,\n live: false,\n variant: 'slider',\n size: 'md',\n time: 'below',\n remaining: false,\n keyStep: 5,\n preview: true,\n color: 'primary',\n disabled: false,\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [number]\n seek: [number]\n 'scrub-start': [number]\n scrub: [number]\n 'update:remaining': [boolean]\n}>()\n\nconst locale = useLocale()\n\n// track: thickness; thumbH: the bar thumb's height (md = MSlider xs, SliderTokens.HandleHeight); dot: the line\n// variant's round thumb under the pointer, dotIdle at rest (the thinner the line, the more it grows, as a\n// video player's does); gap: around the bar thumb; hit: the pointer target's height; wave/amp/length: the wavy line\nconst SIZES = {\n xs: { track: 4, thumbH: 16, dot: 21, dotIdle: 10, gap: 4, hit: 32, wave: 4, amp: 2.5, length: 18 },\n sm: { track: 8, thumbH: 28, dot: 20, dotIdle: 14, gap: 5, hit: 40, wave: 6, amp: 3, length: 22 },\n md: { track: 16, thumbH: 44, dot: 28, dotIdle: 21, gap: 6, hit: 46, wave: 8, amp: 4, length: 26 },\n}\nconst s = computed(() => SIZES[props.size] ?? SIZES.md)\n\nconst dur = computed(() => (Number.isFinite(props.duration) && props.duration > 0 ? props.duration : 0))\nconst inactive = computed(() => props.disabled || !dur.value)\n\n// ── Colors (as in MSlider: a role name or any CSS color; disabled per SliderTokens) ─────────────────────\nconst ROLES: Record<string, string> = {\n primary: 'var(--color-primary)',\n secondary: 'var(--color-secondary)',\n tertiary: 'var(--color-tertiary)',\n error: 'var(--color-error)',\n 'secondary-container': 'var(--color-secondary-container)',\n}\nconst colors = computed(() => {\n if (props.disabled) {\n return {\n active: 'color-mix(in srgb, var(--color-on-surface) 38%, transparent)',\n inactive: 'color-mix(in srgb, var(--color-on-surface) 12%, transparent)',\n buffered: 'color-mix(in srgb, var(--color-on-surface) 20%, transparent)',\n }\n }\n const active = ROLES[props.color] ?? props.color\n const inactive = props.trackColor ? ROLES[props.trackColor] ?? props.trackColor : 'var(--color-secondary-container)'\n return { active, inactive, buffered: `color-mix(in srgb, ${active} 35%, ${inactive})` }\n})\n\n// ── Time ────────────────────────────────────────────────────────────────────────────────────────────────\nconst pad = (n: number) => String(n).padStart(2, '0')\nfunction fmt(t: number) {\n if (props.format) return props.format(t)\n const sec = Math.max(0, Math.floor(t))\n const h = Math.floor(sec / 3600)\n const m = Math.floor((sec % 3600) / 60)\n return (dur.value >= 3600 ? `${h}:${pad(m)}` : String(h * 60 + m)) + ':' + pad(sec % 60)\n}\n\n// The shown position: the drag's while scrubbing, else `pos`, which follows modelValue and, while playing,\n// advances on its own (only written when it moves half a pixel or crosses a second, so it re-renders rarely)\nconst scrubTime = ref<number | null>(null)\nconst pos = ref(props.modelValue)\nconst current = computed(() => Math.min(dur.value || Infinity, Math.max(0, scrubTime.value ?? pos.value)))\n\nconst showRemaining = ref(props.remaining)\nwatch(() => props.remaining, (v) => { showRemaining.value = v })\nfunction toggleRemaining() {\n showRemaining.value = !showRemaining.value\n emit('update:remaining', showRemaining.value)\n}\nconst timeStyle = computed(() => (props.timeColor ? { color: props.timeColor } : undefined))\nconst startText = computed(() => fmt(current.value))\nconst endText = computed(() => {\n if (!dur.value) return '--:--'\n return showRemaining.value ? `-${fmt(dur.value - current.value)}` : fmt(dur.value)\n})\nconst valueText = computed(() =>\n locale.seekBarValue.replace('{position}', fmt(current.value)).replace('{duration}', dur.value ? fmt(dur.value) : '--:--'),\n)\n\nconst chapterAt = (t: number) => {\n let found: SeekBarChapter | null = null\n for (const c of props.chapters ?? []) if (c.start <= t && (!found || c.start >= found.start)) found = c\n return found\n}\n\n// ── Geometry (px, from the measured track width) ────────────────────────────────────────────────────────\nconst trackEl = ref<HTMLElement>()\nconst width = ref(0)\nconst toPx = (t: number) => (dur.value ? (width.value * Math.min(1, Math.max(0, t / dur.value))) : 0)\n\n// The bar thumb keeps clear of the track's ends, as MSlider's thumbInset; the round one may overhang them\nconst thumbX = computed(() => {\n const x = toPx(current.value)\n if (props.variant === 'line') return x\n const inset = Math.max(2, s.value.track * 0.3)\n return Math.min(width.value - inset, Math.max(inset, x))\n})\n\nconst bufferedRanges = computed<[number, number][]>(() => {\n const b = props.buffered\n if (b === undefined) return []\n return typeof b === 'number' ? [[0, b]] : b\n})\n\ninterface Piece { a: number; b: number; rl: number; rr: number; fills: { left: number; width: number; color: string }[] }\n\n// The track is drawn as pieces between cuts: chapter boundaries, the gap around the bar thumb and, for the wavy\n// line, everything before the thumb (drawn by the SVG). Outer ends get a full radius, cut ends a small one, as\n// the M3 slider's segments.\nconst pieces = computed<Piece[]>(() => {\n const W = width.value\n if (!W) return []\n const { gap } = s.value\n const track = trackH.value\n const x = thumbX.value\n const chapterGap = props.size === 'md' ? 4 : 2\n const cuts: [number, number][] = []\n for (const c of props.chapters ?? []) {\n if (c.start <= 0 || c.start >= dur.value) continue\n const cx = toPx(c.start)\n cuts.push([cx - chapterGap / 2, cx + chapterGap / 2])\n }\n if (props.variant === 'slider') cuts.push([x - gap, x + gap])\n if (props.variant === 'wavy') cuts.push([-Infinity, x + gap])\n cuts.sort((p, q) => p[0] - q[0])\n const spans: [number, number][] = []\n let at = 0\n for (const [c0, c1] of cuts) {\n if (c0 > at) spans.push([at, Math.min(c0, W)])\n at = Math.max(at, c1)\n }\n if (at < W) spans.push([at, W])\n\n const full = track / 2\n const small = Math.min(full, Math.max(1, track / 8))\n const playedTo = props.variant === 'line' ? toPx(current.value) : x\n return spans.filter(([a, b]) => b - a >= 0.5).map(([a, b]) => {\n const fills: Piece['fills'] = []\n for (const [t0, t1] of bufferedRanges.value) {\n const l = Math.max(a, toPx(t0))\n const r = Math.min(b, toPx(t1))\n if (r > l) fills.push({ left: l - a, width: r - l, color: colors.value.buffered })\n }\n if (playedTo > a) fills.push({ left: 0, width: Math.min(b, playedTo) - a, color: colors.value.active })\n return { a, b, rl: a <= 0.01 ? full : small, rr: b >= W - 0.01 ? full : small, fills }\n })\n})\n\n// M3's stop indicator at the far end of a (md) slider track, while the thumb hasn't reached it\nconst stopDot = computed(() => props.variant === 'slider' && props.size === 'md' && thumbX.value < width.value - 12 - s.value.gap)\n\n// ── Thumb ───────────────────────────────────────────────────────────────────────────────────────────────\nconst pressed = ref(false)\nconst focused = ref(false)\nconst hovered = ref(false)\n\n// The line thickens under the pointer, as a video player's does; the wavy line's unplayed part is as thick as the\n// wave's stroke (WavyProgressIndicatorDefaults: the same stroke for indicator and track)\nconst trackH = computed(() => {\n if (props.variant === 'wavy') return s.value.wave\n const t = s.value.track\n return props.variant === 'line' && !inactive.value && (hovered.value || pressed.value) ? t + Math.max(2, t / 4) : t\n})\nconst thumbStyle = computed(() => {\n const base = { left: `${thumbX.value}px`, backgroundColor: colors.value.active }\n if (props.variant === 'line') {\n const { dot: d, dotIdle } = s.value\n const scale = pressed.value || hovered.value || focused.value ? 1 : dotIdle / d\n return { ...base, width: `${d}px`, height: `${d}px`, borderRadius: '50%', transform: `translate(-50%, -50%) scale(${scale})` }\n }\n // Pinches to half its width while pressed or focused, as MSlider (SliderTokens.PressedHandleWidth)\n const narrow = pressed.value || focused.value ? 0.5 : 1\n return { ...base, width: '4px', height: `${s.value.thumbH}px`, borderRadius: '2px', transform: `translate(-50%, -50%) scaleX(${narrow})` }\n})\n\n// ── Preview bubble ──────────────────────────────────────────────────────────────────────────────────────\nconst hoverTime = ref<number | null>(null)\nconst previewTime = computed(() => (props.preview && !inactive.value ? scrubTime.value ?? hoverTime.value : null))\nconst previewChapter = computed(() => (previewTime.value === null ? null : chapterAt(previewTime.value)))\nconst bubbleEl = ref<HTMLElement>()\nconst bubbleW = ref(0)\nlet bubbleObserver: ResizeObserver | null = null\nwatch(bubbleEl, (el) => {\n bubbleObserver?.disconnect()\n if (!el || typeof ResizeObserver === 'undefined') return\n bubbleW.value = el.offsetWidth\n bubbleObserver = new ResizeObserver(() => { bubbleW.value = el.offsetWidth })\n bubbleObserver.observe(el)\n})\n// Centered over the time, but kept within the track\nconst previewX = computed(() => {\n const x = previewTime.value === null ? 0 : toPx(previewTime.value)\n const half = bubbleW.value / 2\n return half * 2 >= width.value ? width.value / 2 : Math.min(width.value - half, Math.max(half, x))\n})\n\n// ── Pointer: mouse/pen scrub from the press; a touch waits to see a horizontal move (touch-action pan-y leaves a\n// vertical one to the page), and a touch that doesn't move is a tap that seeks there ────────────────────────\nlet press: { id: number; x: number; y: number; touch: boolean; started: boolean } | null = null\n\nfunction timeAt(clientX: number) {\n const el = trackEl.value\n if (!el || !dur.value) return 0\n const r = el.getBoundingClientRect()\n return (Math.min(1, Math.max(0, (clientX - r.left) / (r.width || 1)))) * dur.value\n}\n\nfunction scrubTo(t: number) {\n scrubTime.value = t\n emit('scrub', t)\n if (props.live) emit('update:modelValue', t)\n}\n\nfunction begin(e: PointerEvent) {\n if (!press) return\n press.started = true\n pressed.value = true\n const t = timeAt(e.clientX)\n emit('scrub-start', t)\n scrubTo(t)\n}\n\nfunction commit(t: number) {\n emit('update:modelValue', t)\n emit('seek', t)\n // Show it at once; a later modelValue resyncs\n pos.value = t\n base = t\n baseAt = now()\n}\n\nfunction onPointerDown(e: PointerEvent) {\n if (inactive.value || e.button !== 0) return\n press = { id: e.pointerId, x: e.clientX, y: e.clientY, touch: e.pointerType === 'touch', started: false }\n window.addEventListener('pointermove', onPointerMove)\n window.addEventListener('pointerup', onPointerUp)\n window.addEventListener('pointercancel', onPointerCancel)\n if (!press.touch) {\n e.preventDefault()\n trackEl.value?.focus({ preventScroll: true })\n begin(e)\n }\n}\n\nfunction onPointerMove(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n if (!press.started) {\n const dx = Math.abs(e.clientX - press.x)\n const dy = Math.abs(e.clientY - press.y)\n if (dy > 8 && dy > dx) return end()\n if (dx < 4) return\n begin(e)\n }\n scrubTo(timeAt(e.clientX))\n}\n\nfunction onPointerUp(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n const t = press.started ? scrubTime.value ?? timeAt(e.clientX) : timeAt(e.clientX)\n end()\n commit(t)\n}\n\n// The browser took the touch (a scroll): a drag in progress still lands where it was\nfunction onPointerCancel(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n const t = press.started ? scrubTime.value : null\n end()\n if (t !== null) commit(t)\n}\n\nfunction end() {\n press = null\n pressed.value = false\n scrubTime.value = null\n window.removeEventListener('pointermove', onPointerMove)\n window.removeEventListener('pointerup', onPointerUp)\n window.removeEventListener('pointercancel', onPointerCancel)\n}\n\nfunction onHover(e: PointerEvent) {\n if (e.pointerType === 'touch') return\n hovered.value = true\n hoverTime.value = timeAt(e.clientX)\n}\nfunction onLeave() {\n hovered.value = false\n hoverTime.value = null\n}\n\nfunction onKeyDown(e: KeyboardEvent) {\n if (inactive.value) return\n const d = dur.value\n const steps: Record<string, number> = {\n ArrowRight: props.keyStep, ArrowUp: props.keyStep, ArrowLeft: -props.keyStep, ArrowDown: -props.keyStep,\n PageUp: d / 10, PageDown: -d / 10,\n }\n let t: number | null = null\n if (e.key in steps) t = current.value + steps[e.key]!\n else if (e.key === 'Home') t = 0\n else if (e.key === 'End') t = d\n if (t === null) return\n e.preventDefault()\n commit(Math.min(d, Math.max(0, t)))\n}\n\n// ── Motion between updates, and the wave (a rAF loop, only while either needs frames) ───────────────────\nconst now = () => (typeof performance !== 'undefined' ? performance.now() : 0)\nlet base = props.modelValue\nlet baseAt = now()\nlet raf = 0\nlet last = 0\nlet amp = 0\nlet phase = 0\nconst wavePathEl = ref<SVGPathElement>()\nconst svgH = computed(() => s.value.wave + 2 * s.value.amp + 2)\nconst reducedMotion = typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches\n\nconst ampTarget = () => (props.variant === 'wavy' && props.playing && scrubTime.value === null ? s.value.amp : 0)\namp = ampTarget()\n\nfunction advancing() {\n return props.playing && scrubTime.value === null && !!dur.value\n}\n\nfunction syncPos(t: number) {\n const W = width.value\n const d = dur.value\n if (Math.floor(t) !== Math.floor(pos.value) || (d && (Math.abs(t - pos.value) * W) / d >= 0.5)) pos.value = t\n}\n\nfunction drawWave() {\n const path = wavePathEl.value\n if (!path) return\n const { wave, length, gap } = s.value\n const half = wave / 2\n const end = thumbX.value - gap - half\n if (end <= half) return path.setAttribute('d', '')\n const mid = svgH.value / 2\n const k = (2 * Math.PI) / length\n let d = ''\n for (let x = half; ; x += 2) {\n const px = Math.min(x, end)\n d += `${d ? 'L' : 'M'}${px.toFixed(1)},${(mid + amp * Math.sin(k * px + phase)).toFixed(2)}`\n if (px >= end) break\n }\n path.setAttribute('d', d)\n}\n\nfunction frame(t: number) {\n const dt = last ? Math.min(0.1, (t - last) / 1000) : 0\n last = t\n if (advancing()) syncPos(Math.min(dur.value, base + ((t - baseAt) / 1000) * props.playbackRate))\n if (props.variant === 'wavy') {\n amp += (ampTarget() - amp) * (1 - Math.exp(-dt / 0.12))\n if (Math.abs(ampTarget() - amp) < 0.01) amp = ampTarget()\n // The wave travels with the playback, one length every 1.25s\n if (props.playing && !reducedMotion) phase -= (dt * 2 * Math.PI) / 1.25\n drawWave()\n }\n if (advancing() || (props.variant === 'wavy' && (amp !== ampTarget() || (props.playing && !reducedMotion)))) {\n raf = requestAnimationFrame(frame)\n } else {\n raf = 0\n last = 0\n }\n}\n\nfunction kick() {\n if (raf || typeof requestAnimationFrame === 'undefined') return\n raf = requestAnimationFrame(frame)\n}\n\nwatch(() => props.modelValue, (v) => {\n base = v\n baseAt = now()\n pos.value = v\n kick()\n})\nwatch(() => props.playing, () => {\n base = pos.value\n baseAt = now()\n kick()\n})\nwatch(scrubTime, (v) => {\n if (v === null) {\n base = pos.value\n baseAt = now()\n }\n kick()\n})\n// Paused, the (flat) wave still follows the thumb\nwatch([thumbX, () => props.variant, () => props.size], () => {\n if (props.variant === 'wavy') drawWave()\n}, { flush: 'post' })\n\nlet resizeObserver: ResizeObserver | null = null\nonMounted(() => {\n const el = trackEl.value!\n width.value = el.clientWidth\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => { width.value = el.clientWidth })\n resizeObserver.observe(el)\n }\n drawWave()\n kick()\n})\nonBeforeUnmount(() => {\n cancelAnimationFrame(raf)\n resizeObserver?.disconnect()\n bubbleObserver?.disconnect()\n end()\n})\n</script>\n\n<template>\n <div class=\"flex min-w-0 select-none\" :class=\"time === 'sides' ? 'items-center gap-3' : 'flex-col'\">\n <span v-if=\"time === 'sides'\" class=\"min-w-[4ch] shrink-0 text-right text-label-medium tabular-nums\" :class=\"!timeColor && 'text-on-surface-variant'\" :style=\"timeStyle\">{{ startText }}</span>\n\n <div\n ref=\"trackEl\"\n role=\"slider\"\n :tabindex=\"inactive ? -1 : 0\"\n :aria-label=\"label ?? locale.seekBar\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"Math.round(dur)\"\n :aria-valuenow=\"Math.round(current)\"\n :aria-valuetext=\"valueText\"\n :aria-disabled=\"inactive || undefined\"\n class=\"group relative min-w-0 shrink-0 touch-pan-y outline-none\"\n :class=\"[inactive ? 'cursor-default' : 'cursor-pointer', time === 'sides' && 'flex-1']\"\n :style=\"{ height: `${s.hit}px` }\"\n @pointerdown=\"onPointerDown\"\n @pointermove=\"onHover\"\n @pointerleave=\"onLeave\"\n @keydown=\"onKeyDown\"\n @focus=\"focused = true\"\n @blur=\"focused = false\"\n >\n <!-- A grace zone past the hit area (mostly above, where the preview opens), so the pointer doesn't have to\n land exactly on a thin line: its events reach the track like the track's own -->\n <div v-if=\"!inactive\" class=\"absolute inset-x-0 -top-3 -bottom-1\" />\n <div\n v-for=\"(p, i) in pieces\"\n :key=\"i\"\n class=\"absolute top-1/2 -translate-y-1/2 overflow-hidden transition-[height] duration-100\"\n :style=\"{\n left: `${p.a}px`, width: `${p.b - p.a}px`, height: `${trackH}px`,\n borderRadius: `${p.rl}px ${p.rr}px ${p.rr}px ${p.rl}px`, backgroundColor: colors.inactive,\n }\"\n >\n <div\n v-for=\"(f, j) in p.fills\"\n :key=\"j\"\n class=\"absolute inset-y-0\"\n :style=\"{ left: `${f.left}px`, width: `${f.width}px`, backgroundColor: f.color }\"\n />\n </div>\n\n <svg\n v-if=\"variant === 'wavy'\"\n class=\"pointer-events-none absolute top-1/2 left-0 -translate-y-1/2 overflow-visible\"\n :width=\"width\"\n :height=\"svgH\"\n aria-hidden=\"true\"\n >\n <path ref=\"wavePathEl\" fill=\"none\" :stroke=\"colors.active\" :stroke-width=\"s.wave\" stroke-linecap=\"round\" />\n </svg>\n\n <div\n v-if=\"stopDot\"\n class=\"pointer-events-none absolute top-1/2 right-3 size-1 -translate-y-1/2 rounded-full\"\n :style=\"{ backgroundColor: colors.active }\"\n />\n\n <div\n class=\"pointer-events-none absolute top-1/2 transition-transform duration-75 group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface\"\n :style=\"thumbStyle\"\n />\n\n <div\n v-if=\"previewTime !== null\"\n ref=\"bubbleEl\"\n class=\"pointer-events-none absolute bottom-full z-10 mb-1 -translate-x-1/2\"\n :style=\"{ left: `${previewX}px` }\"\n >\n <slot name=\"preview\" :time=\"previewTime\" :formatted=\"fmt(previewTime)\" :chapter=\"previewChapter\">\n <div class=\"flex h-7 max-w-60 items-center gap-1 rounded-full bg-inverse-surface px-2.5 text-label-medium whitespace-nowrap text-inverse-on-surface tabular-nums\">\n <span v-if=\"previewChapter?.title\" class=\"truncate\">{{ previewChapter.title }} ·</span>\n <span>{{ fmt(previewTime) }}</span>\n </div>\n </slot>\n </div>\n </div>\n\n <div v-if=\"time === 'below'\" class=\"flex items-center justify-between text-label-medium tabular-nums\" :class=\"!timeColor && 'text-on-surface-variant'\" :style=\"timeStyle\">\n <span>{{ startText }}</span>\n <button\n type=\"button\"\n class=\"cursor-pointer rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-secondary\"\n :aria-label=\"showRemaining ? locale.seekBarShowDuration : locale.seekBarShowRemaining\"\n @click=\"toggleRemaining\"\n >{{ endText }}</button>\n </div>\n <button\n v-else-if=\"time === 'sides'\"\n type=\"button\"\n class=\"min-w-[4ch] shrink-0 cursor-pointer rounded-sm text-left text-label-medium tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-secondary\"\n :class=\"!timeColor && 'text-on-surface-variant'\"\n :style=\"timeStyle\"\n :aria-label=\"showRemaining ? locale.seekBarShowDuration : locale.seekBarShowRemaining\"\n @click=\"toggleRemaining\"\n >{{ endText }}</button>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BA,IAAMsB,IAAQC,GAqDRC,IAAOH,IAQPI,IAASf,EAAU,GAKnBgB,KAAQ;GACZ,IAAI;IAAE,OAAO;IAAG,QAAQ;IAAI,KAAK;IAAI,SAAS;IAAI,KAAK;IAAG,KAAK;IAAI,MAAM;IAAG,KAAK;IAAK,QAAQ;GAAG;GACjG,IAAI;IAAE,OAAO;IAAG,QAAQ;IAAI,KAAK;IAAI,SAAS;IAAI,KAAK;IAAG,KAAK;IAAI,MAAM;IAAG,KAAK;IAAG,QAAQ;GAAG;GAC/F,IAAI;IAAE,OAAO;IAAI,QAAQ;IAAI,KAAK;IAAI,SAAS;IAAI,KAAK;IAAG,KAAK;IAAI,MAAM;IAAG,KAAK;IAAG,QAAQ;GAAG;EAClG,GACMC,IAAIC,QAAeF,GAAMJ,EAAM,SAASI,GAAM,EAAE,GAEhDG,IAAMD,QAAgB,OAAO,SAASN,EAAM,QAAQ,KAAKA,EAAM,WAAW,IAAIA,EAAM,WAAW,CAAE,GACjGQ,IAAWF,QAAeN,EAAM,YAAY,CAACO,EAAI,KAAK,GAGtDE,KAAgC;GACpC,SAAS;GACT,WAAW;GACX,UAAU;GACV,OAAO;GACP,uBAAuB;EACzB,GACMC,IAASJ,QAAe;GAC5B,IAAIN,EAAM,UACR,OAAO;IACL,QAAQ;IACR,UAAU;IACV,UAAU;GACZ;GAEF,IAA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,EAAA8C,GAAA,KAAO,GAAA,IAAAhC,EAAA,K"}
1
+ {"version":3,"file":"MSeekBar-NwkuAzx-.js","names":["_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_toDisplayString","_createElementVNode","_unref","_Fragment","_renderList","_renderSlot","useLocale","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","MSeekBar_default","defineComponent","__emit","props","__props","emit","locale","SIZES","s","computed","dur","inactive","ROLES","colors","active","pad","n","fmt","t","sec","h","m","scrubTime","ref","pos","current","showRemaining","v","toggleRemaining","timeStyle","startText","endText","valueText","chapterAt","found","c","trackEl","width","toPx","thumbX","x","inset","bufferedRanges","b","pieces","W","track","trackH","chapterGap","cuts","cx","gap","p","q","spans","at","c0","c1","full","small","playedTo","a","fills","t0","t1","l","r","stopDot","pressed","focused","hovered","thumbStyle","base","d","scale","dotIdle","narrow","hoverTime","previewTime","previewChapter","bubbleEl","bubbleW","bubbleObserver","el","previewX","half","press","timeAt","clientX","scrubTo","begin","commit","now","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","dx","dy","end","onHover","onLeave","onKeyDown","steps","baseAt","raf","last","amp","phase","wavePathEl","svgH","reducedMotion","ampTarget","advancing","syncPos","drawWave","path","wave","mid","k","length","px","frame","dt","kick","watch","resizeObserver","onMounted","onBeforeUnmount","openBlock","createElementBlock","normalizeClass","normalizeStyle","toDisplayString","createCommentVNode","createElementVNode","unref","_cache","Fragment","renderList","i","j","f","renderSlot","_ctx"],"sources":["../src/components/MSeekBar.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface SeekBarChapter {\n /** Where the chapter starts, in seconds */\n start: number\n /** Shown in the preview while the pointer is over it */\n title?: string\n}\n</script>\n\n<script setup lang=\"ts\">\n/**\n * A media seek bar (not an M3 spec component; Media3's ProgressSlider is a plain M3 Slider, which this follows in\n * its default look): the playback position on a track with the buffered part, optional chapters, elapsed and\n * total (or remaining) time, and a preview of the time under the pointer. Dragging scrubs locally and seeks once\n * on release (or live, with `live`); a tap or click seeks to that point. While `playing`, it advances on its own\n * between `modelValue` updates, so a 4Hz `timeupdate` still moves it smoothly.\n *\n * @slot preview Replaces the bubble shown above the pointer while hovering or dragging (a frame preview, say).\n * Props: `{ time, formatted, chapter }`\n * @event update:modelValue Emitted on a seek (and continuously while dragging with `live`) — powers v-model\n * @event seek Emitted once per seek with its time: on release of a drag, a tap or click, or a key press\n * @event scrub-start Emitted when a drag starts, with its time\n * @event scrub Emitted while dragging, with the time under the pointer\n * @event update:remaining Emitted when the end label is clicked to switch between total and remaining time\n */\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useLocale } from '../composables/useLocale'\n\nconst props = withDefaults(defineProps<{\n /** Playback position in seconds (v-model) */\n modelValue: number\n /** Media length in seconds; 0, NaN or Infinity (not loaded yet, a live stream) disables seeking */\n duration: number\n /** How much is loaded: up to a time, or time ranges (`[[start, end], …]`, like a media element's `buffered`) */\n buffered?: number | [number, number][]\n /** Chapter starts, drawn as gaps in the track; their titles show in the preview */\n chapters?: SeekBarChapter[]\n /** The media is playing: the bar moves on its own between updates, and the wavy line waves */\n playing?: boolean\n /** Playback speed, for that motion between updates */\n playbackRate?: number\n /** Updates the v-model continuously while dragging (the media follows the thumb), not only on release */\n live?: boolean\n /** `slider`: the M3 slider (bar thumb with a gap around it). `line`: a plain line with a round thumb. `wavy`: the played part waves while playing */\n variant?: 'slider' | 'line' | 'wavy'\n /** Track thickness: `md` (16px, the smallest M3 slider), `sm` (8px) or `xs` (4px, over a video) */\n size?: 'xs' | 'sm' | 'md'\n /** Where the elapsed and total time go */\n time?: 'below' | 'sides' | 'none'\n /** The end label shows the remaining time (`-1:23`) instead of the total; clicking it switches (v-model:remaining) */\n remaining?: boolean\n /** Formats a time in seconds. Default `m:ss`, or `h:mm:ss` for media an hour or longer */\n format?: (seconds: number) => string\n /** Seconds the arrow keys move; Page Up/Down move 10% */\n keyStep?: number\n /** Shows the time (and chapter) above the pointer while hovering or dragging */\n preview?: boolean\n /** Played part and thumb: an M3 role (`primary`, `secondary`, `tertiary`, `error`) or any CSS color */\n color?: string\n /** Unplayed track: an M3 role or any CSS color. Default secondary-container */\n trackColor?: string\n /** The time labels' color, as a CSS color (white over a video, say). Default on-surface-variant */\n timeColor?: string\n /** Disables seeking */\n disabled?: boolean\n /** Accessible name. Default the locale's `seekBar` */\n label?: string\n}>(), {\n playing: false,\n playbackRate: 1,\n live: false,\n variant: 'slider',\n size: 'md',\n time: 'below',\n remaining: false,\n keyStep: 5,\n preview: true,\n color: 'primary',\n disabled: false,\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [number]\n seek: [number]\n 'scrub-start': [number]\n scrub: [number]\n 'update:remaining': [boolean]\n}>()\n\nconst locale = useLocale()\n\n// track: thickness; thumbH: the bar thumb's height (md = MSlider xs, SliderTokens.HandleHeight); dot: the line\n// variant's round thumb under the pointer, dotIdle at rest (the thinner the line, the more it grows, as a\n// video player's does); gap: around the bar thumb; hit: the pointer target's height; wave/amp/length: the wavy line\nconst SIZES = {\n xs: { track: 4, thumbH: 16, dot: 21, dotIdle: 10, gap: 4, hit: 32, wave: 4, amp: 2.5, length: 18 },\n sm: { track: 8, thumbH: 28, dot: 20, dotIdle: 14, gap: 5, hit: 40, wave: 6, amp: 3, length: 22 },\n md: { track: 16, thumbH: 44, dot: 28, dotIdle: 21, gap: 6, hit: 46, wave: 8, amp: 4, length: 26 },\n}\nconst s = computed(() => SIZES[props.size] ?? SIZES.md)\n\nconst dur = computed(() => (Number.isFinite(props.duration) && props.duration > 0 ? props.duration : 0))\nconst inactive = computed(() => props.disabled || !dur.value)\n\n// ── Colors (as in MSlider: a role name or any CSS color; disabled per SliderTokens) ─────────────────────\nconst ROLES: Record<string, string> = {\n primary: 'var(--color-primary)',\n secondary: 'var(--color-secondary)',\n tertiary: 'var(--color-tertiary)',\n error: 'var(--color-error)',\n 'secondary-container': 'var(--color-secondary-container)',\n}\nconst colors = computed(() => {\n if (props.disabled) {\n return {\n active: 'color-mix(in srgb, var(--color-on-surface) 38%, transparent)',\n inactive: 'color-mix(in srgb, var(--color-on-surface) 12%, transparent)',\n buffered: 'color-mix(in srgb, var(--color-on-surface) 20%, transparent)',\n }\n }\n const active = ROLES[props.color] ?? props.color\n const inactive = props.trackColor ? ROLES[props.trackColor] ?? props.trackColor : 'var(--color-secondary-container)'\n return { active, inactive, buffered: `color-mix(in srgb, ${active} 35%, ${inactive})` }\n})\n\n// ── Time ────────────────────────────────────────────────────────────────────────────────────────────────\nconst pad = (n: number) => String(n).padStart(2, '0')\nfunction fmt(t: number) {\n if (props.format) return props.format(t)\n const sec = Math.max(0, Math.floor(t))\n const h = Math.floor(sec / 3600)\n const m = Math.floor((sec % 3600) / 60)\n return (dur.value >= 3600 ? `${h}:${pad(m)}` : String(h * 60 + m)) + ':' + pad(sec % 60)\n}\n\n// The shown position: the drag's while scrubbing, else `pos`, which follows modelValue and, while playing,\n// advances on its own (only written when it moves half a pixel or crosses a second, so it re-renders rarely)\nconst scrubTime = ref<number | null>(null)\nconst pos = ref(props.modelValue)\nconst current = computed(() => Math.min(dur.value || Infinity, Math.max(0, scrubTime.value ?? pos.value)))\n\nconst showRemaining = ref(props.remaining)\nwatch(() => props.remaining, (v) => { showRemaining.value = v })\nfunction toggleRemaining() {\n showRemaining.value = !showRemaining.value\n emit('update:remaining', showRemaining.value)\n}\nconst timeStyle = computed(() => (props.timeColor ? { color: props.timeColor } : undefined))\nconst startText = computed(() => fmt(current.value))\nconst endText = computed(() => {\n if (!dur.value) return '--:--'\n return showRemaining.value ? `-${fmt(dur.value - current.value)}` : fmt(dur.value)\n})\nconst valueText = computed(() =>\n locale.seekBarValue.replace('{position}', fmt(current.value)).replace('{duration}', dur.value ? fmt(dur.value) : '--:--'),\n)\n\nconst chapterAt = (t: number) => {\n let found: SeekBarChapter | null = null\n for (const c of props.chapters ?? []) if (c.start <= t && (!found || c.start >= found.start)) found = c\n return found\n}\n\n// ── Geometry (px, from the measured track width) ────────────────────────────────────────────────────────\nconst trackEl = ref<HTMLElement>()\nconst width = ref(0)\nconst toPx = (t: number) => (dur.value ? (width.value * Math.min(1, Math.max(0, t / dur.value))) : 0)\n\n// The bar thumb keeps clear of the track's ends, as MSlider's thumbInset; the round one may overhang them\nconst thumbX = computed(() => {\n const x = toPx(current.value)\n if (props.variant === 'line') return x\n const inset = Math.max(2, s.value.track * 0.3)\n return Math.min(width.value - inset, Math.max(inset, x))\n})\n\nconst bufferedRanges = computed<[number, number][]>(() => {\n const b = props.buffered\n if (b === undefined) return []\n return typeof b === 'number' ? [[0, b]] : b\n})\n\ninterface Piece { a: number; b: number; rl: number; rr: number; fills: { left: number; width: number; color: string }[] }\n\n// The track is drawn as pieces between cuts: chapter boundaries, the gap around the bar thumb and, for the wavy\n// line, everything before the thumb (drawn by the SVG). Outer ends get a full radius, cut ends a small one, as\n// the M3 slider's segments.\nconst pieces = computed<Piece[]>(() => {\n const W = width.value\n if (!W) return []\n const { gap } = s.value\n const track = trackH.value\n const x = thumbX.value\n const chapterGap = props.size === 'md' ? 4 : 2\n const cuts: [number, number][] = []\n for (const c of props.chapters ?? []) {\n if (c.start <= 0 || c.start >= dur.value) continue\n const cx = toPx(c.start)\n cuts.push([cx - chapterGap / 2, cx + chapterGap / 2])\n }\n if (props.variant === 'slider') cuts.push([x - gap, x + gap])\n if (props.variant === 'wavy') cuts.push([-Infinity, x + gap])\n cuts.sort((p, q) => p[0] - q[0])\n const spans: [number, number][] = []\n let at = 0\n for (const [c0, c1] of cuts) {\n if (c0 > at) spans.push([at, Math.min(c0, W)])\n at = Math.max(at, c1)\n }\n if (at < W) spans.push([at, W])\n\n const full = track / 2\n const small = Math.min(full, Math.max(1, track / 8))\n const playedTo = props.variant === 'line' ? toPx(current.value) : x\n return spans.filter(([a, b]) => b - a >= 0.5).map(([a, b]) => {\n const fills: Piece['fills'] = []\n for (const [t0, t1] of bufferedRanges.value) {\n const l = Math.max(a, toPx(t0))\n const r = Math.min(b, toPx(t1))\n if (r > l) fills.push({ left: l - a, width: r - l, color: colors.value.buffered })\n }\n if (playedTo > a) fills.push({ left: 0, width: Math.min(b, playedTo) - a, color: colors.value.active })\n return { a, b, rl: a <= 0.01 ? full : small, rr: b >= W - 0.01 ? full : small, fills }\n })\n})\n\n// M3's stop indicator at the far end of a (md) slider track, while the thumb hasn't reached it\nconst stopDot = computed(() => props.variant === 'slider' && props.size === 'md' && thumbX.value < width.value - 12 - s.value.gap)\n\n// ── Thumb ───────────────────────────────────────────────────────────────────────────────────────────────\nconst pressed = ref(false)\nconst focused = ref(false)\nconst hovered = ref(false)\n\n// The line thickens under the pointer, as a video player's does; the wavy line's unplayed part is as thick as the\n// wave's stroke (WavyProgressIndicatorDefaults: the same stroke for indicator and track)\nconst trackH = computed(() => {\n if (props.variant === 'wavy') return s.value.wave\n const t = s.value.track\n return props.variant === 'line' && !inactive.value && (hovered.value || pressed.value) ? t + Math.max(2, t / 4) : t\n})\nconst thumbStyle = computed(() => {\n const base = { left: `${thumbX.value}px`, backgroundColor: colors.value.active }\n if (props.variant === 'line') {\n const { dot: d, dotIdle } = s.value\n const scale = pressed.value || hovered.value || focused.value ? 1 : dotIdle / d\n return { ...base, width: `${d}px`, height: `${d}px`, borderRadius: '50%', transform: `translate(-50%, -50%) scale(${scale})` }\n }\n // Pinches to half its width while pressed or focused, as MSlider (SliderTokens.PressedHandleWidth)\n const narrow = pressed.value || focused.value ? 0.5 : 1\n return { ...base, width: '4px', height: `${s.value.thumbH}px`, borderRadius: '2px', transform: `translate(-50%, -50%) scaleX(${narrow})` }\n})\n\n// ── Preview bubble ──────────────────────────────────────────────────────────────────────────────────────\nconst hoverTime = ref<number | null>(null)\nconst previewTime = computed(() => (props.preview && !inactive.value ? scrubTime.value ?? hoverTime.value : null))\nconst previewChapter = computed(() => (previewTime.value === null ? null : chapterAt(previewTime.value)))\nconst bubbleEl = ref<HTMLElement>()\nconst bubbleW = ref(0)\nlet bubbleObserver: ResizeObserver | null = null\nwatch(bubbleEl, (el) => {\n bubbleObserver?.disconnect()\n if (!el || typeof ResizeObserver === 'undefined') return\n bubbleW.value = el.offsetWidth\n bubbleObserver = new ResizeObserver(() => { bubbleW.value = el.offsetWidth })\n bubbleObserver.observe(el)\n})\n// Centered over the time, but kept within the track\nconst previewX = computed(() => {\n const x = previewTime.value === null ? 0 : toPx(previewTime.value)\n const half = bubbleW.value / 2\n return half * 2 >= width.value ? width.value / 2 : Math.min(width.value - half, Math.max(half, x))\n})\n\n// ── Pointer: mouse/pen scrub from the press; a touch waits to see a horizontal move (touch-action pan-y leaves a\n// vertical one to the page), and a touch that doesn't move is a tap that seeks there ────────────────────────\nlet press: { id: number; x: number; y: number; touch: boolean; started: boolean } | null = null\n\nfunction timeAt(clientX: number) {\n const el = trackEl.value\n if (!el || !dur.value) return 0\n const r = el.getBoundingClientRect()\n return (Math.min(1, Math.max(0, (clientX - r.left) / (r.width || 1)))) * dur.value\n}\n\nfunction scrubTo(t: number) {\n scrubTime.value = t\n emit('scrub', t)\n if (props.live) emit('update:modelValue', t)\n}\n\nfunction begin(e: PointerEvent) {\n if (!press) return\n press.started = true\n pressed.value = true\n const t = timeAt(e.clientX)\n emit('scrub-start', t)\n scrubTo(t)\n}\n\nfunction commit(t: number) {\n emit('update:modelValue', t)\n emit('seek', t)\n // Show it at once; a later modelValue resyncs\n pos.value = t\n base = t\n baseAt = now()\n}\n\nfunction onPointerDown(e: PointerEvent) {\n if (inactive.value || e.button !== 0) return\n press = { id: e.pointerId, x: e.clientX, y: e.clientY, touch: e.pointerType === 'touch', started: false }\n window.addEventListener('pointermove', onPointerMove)\n window.addEventListener('pointerup', onPointerUp)\n window.addEventListener('pointercancel', onPointerCancel)\n if (!press.touch) {\n e.preventDefault()\n trackEl.value?.focus({ preventScroll: true })\n begin(e)\n }\n}\n\nfunction onPointerMove(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n if (!press.started) {\n const dx = Math.abs(e.clientX - press.x)\n const dy = Math.abs(e.clientY - press.y)\n if (dy > 8 && dy > dx) return end()\n if (dx < 4) return\n begin(e)\n }\n scrubTo(timeAt(e.clientX))\n}\n\nfunction onPointerUp(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n const t = press.started ? scrubTime.value ?? timeAt(e.clientX) : timeAt(e.clientX)\n end()\n commit(t)\n}\n\n// The browser took the touch (a scroll): a drag in progress still lands where it was\nfunction onPointerCancel(e: PointerEvent) {\n if (!press || e.pointerId !== press.id) return\n const t = press.started ? scrubTime.value : null\n end()\n if (t !== null) commit(t)\n}\n\nfunction end() {\n press = null\n pressed.value = false\n scrubTime.value = null\n window.removeEventListener('pointermove', onPointerMove)\n window.removeEventListener('pointerup', onPointerUp)\n window.removeEventListener('pointercancel', onPointerCancel)\n}\n\nfunction onHover(e: PointerEvent) {\n if (e.pointerType === 'touch') return\n hovered.value = true\n hoverTime.value = timeAt(e.clientX)\n}\nfunction onLeave() {\n hovered.value = false\n hoverTime.value = null\n}\n\nfunction onKeyDown(e: KeyboardEvent) {\n if (inactive.value) return\n const d = dur.value\n const steps: Record<string, number> = {\n ArrowRight: props.keyStep, ArrowUp: props.keyStep, ArrowLeft: -props.keyStep, ArrowDown: -props.keyStep,\n PageUp: d / 10, PageDown: -d / 10,\n }\n let t: number | null = null\n if (e.key in steps) t = current.value + steps[e.key]!\n else if (e.key === 'Home') t = 0\n else if (e.key === 'End') t = d\n if (t === null) return\n e.preventDefault()\n commit(Math.min(d, Math.max(0, t)))\n}\n\n// ── Motion between updates, and the wave (a rAF loop, only while either needs frames) ───────────────────\nconst now = () => (typeof performance !== 'undefined' ? performance.now() : 0)\nlet base = props.modelValue\nlet baseAt = now()\nlet raf = 0\nlet last = 0\nlet amp = 0\nlet phase = 0\nconst wavePathEl = ref<SVGPathElement>()\nconst svgH = computed(() => s.value.wave + 2 * s.value.amp + 2)\nconst reducedMotion = typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches\n\nconst ampTarget = () => (props.variant === 'wavy' && props.playing && scrubTime.value === null ? s.value.amp : 0)\namp = ampTarget()\n\nfunction advancing() {\n return props.playing && scrubTime.value === null && !!dur.value\n}\n\nfunction syncPos(t: number) {\n const W = width.value\n const d = dur.value\n if (Math.floor(t) !== Math.floor(pos.value) || (d && (Math.abs(t - pos.value) * W) / d >= 0.5)) pos.value = t\n}\n\nfunction drawWave() {\n const path = wavePathEl.value\n if (!path) return\n const { wave, length, gap } = s.value\n const half = wave / 2\n const end = thumbX.value - gap - half\n if (end <= half) return path.setAttribute('d', '')\n const mid = svgH.value / 2\n const k = (2 * Math.PI) / length\n let d = ''\n for (let x = half; ; x += 2) {\n const px = Math.min(x, end)\n d += `${d ? 'L' : 'M'}${px.toFixed(1)},${(mid + amp * Math.sin(k * px + phase)).toFixed(2)}`\n if (px >= end) break\n }\n path.setAttribute('d', d)\n}\n\nfunction frame(t: number) {\n const dt = last ? Math.min(0.1, (t - last) / 1000) : 0\n last = t\n if (advancing()) syncPos(Math.min(dur.value, base + ((t - baseAt) / 1000) * props.playbackRate))\n if (props.variant === 'wavy') {\n amp += (ampTarget() - amp) * (1 - Math.exp(-dt / 0.12))\n if (Math.abs(ampTarget() - amp) < 0.01) amp = ampTarget()\n // The wave travels with the playback, one length every 1.25s\n if (props.playing && !reducedMotion) phase -= (dt * 2 * Math.PI) / 1.25\n drawWave()\n }\n if (advancing() || (props.variant === 'wavy' && (amp !== ampTarget() || (props.playing && !reducedMotion)))) {\n raf = requestAnimationFrame(frame)\n } else {\n raf = 0\n last = 0\n }\n}\n\nfunction kick() {\n if (raf || typeof requestAnimationFrame === 'undefined') return\n raf = requestAnimationFrame(frame)\n}\n\nwatch(() => props.modelValue, (v) => {\n base = v\n baseAt = now()\n pos.value = v\n kick()\n})\nwatch(() => props.playing, () => {\n base = pos.value\n baseAt = now()\n kick()\n})\nwatch(scrubTime, (v) => {\n if (v === null) {\n base = pos.value\n baseAt = now()\n }\n kick()\n})\n// Paused, the (flat) wave still follows the thumb\nwatch([thumbX, () => props.variant, () => props.size], () => {\n if (props.variant === 'wavy') drawWave()\n}, { flush: 'post' })\n\nlet resizeObserver: ResizeObserver | null = null\nonMounted(() => {\n const el = trackEl.value!\n width.value = el.clientWidth\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => { width.value = el.clientWidth })\n resizeObserver.observe(el)\n }\n drawWave()\n kick()\n})\nonBeforeUnmount(() => {\n cancelAnimationFrame(raf)\n resizeObserver?.disconnect()\n bubbleObserver?.disconnect()\n end()\n})\n</script>\n\n<template>\n <div class=\"flex min-w-0 select-none\" :class=\"time === 'sides' ? 'items-center gap-3' : 'flex-col'\">\n <span v-if=\"time === 'sides'\" class=\"min-w-[4ch] shrink-0 text-right text-label-medium tabular-nums\" :class=\"!timeColor && 'text-on-surface-variant'\" :style=\"timeStyle\">{{ startText }}</span>\n\n <div\n ref=\"trackEl\"\n role=\"slider\"\n :tabindex=\"inactive ? -1 : 0\"\n :aria-label=\"label ?? locale.seekBar\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"Math.round(dur)\"\n :aria-valuenow=\"Math.round(current)\"\n :aria-valuetext=\"valueText\"\n :aria-disabled=\"inactive || undefined\"\n class=\"group relative min-w-0 shrink-0 touch-pan-y outline-none\"\n :class=\"[inactive ? 'cursor-default' : 'cursor-pointer', time === 'sides' && 'flex-1']\"\n :style=\"{ height: `${s.hit}px` }\"\n @pointerdown=\"onPointerDown\"\n @pointermove=\"onHover\"\n @pointerleave=\"onLeave\"\n @keydown=\"onKeyDown\"\n @focus=\"focused = true\"\n @blur=\"focused = false\"\n >\n <!-- A grace zone past the hit area (mostly above, where the preview opens), so the pointer doesn't have to\n land exactly on a thin line: its events reach the track like the track's own -->\n <div v-if=\"!inactive\" class=\"absolute inset-x-0 -top-3 -bottom-1\" />\n <div\n v-for=\"(p, i) in pieces\"\n :key=\"i\"\n class=\"absolute top-1/2 -translate-y-1/2 overflow-hidden transition-[height] duration-100\"\n :style=\"{\n left: `${p.a}px`, width: `${p.b - p.a}px`, height: `${trackH}px`,\n borderRadius: `${p.rl}px ${p.rr}px ${p.rr}px ${p.rl}px`, backgroundColor: colors.inactive,\n }\"\n >\n <div\n v-for=\"(f, j) in p.fills\"\n :key=\"j\"\n class=\"absolute inset-y-0\"\n :style=\"{ left: `${f.left}px`, width: `${f.width}px`, backgroundColor: f.color }\"\n />\n </div>\n\n <svg\n v-if=\"variant === 'wavy'\"\n class=\"pointer-events-none absolute top-1/2 left-0 -translate-y-1/2 overflow-visible\"\n :width=\"width\"\n :height=\"svgH\"\n aria-hidden=\"true\"\n >\n <path ref=\"wavePathEl\" fill=\"none\" :stroke=\"colors.active\" :stroke-width=\"s.wave\" stroke-linecap=\"round\" />\n </svg>\n\n <div\n v-if=\"stopDot\"\n class=\"pointer-events-none absolute top-1/2 right-3 size-1 -translate-y-1/2 rounded-full\"\n :style=\"{ backgroundColor: colors.active }\"\n />\n\n <div\n class=\"pointer-events-none absolute top-1/2 transition-transform duration-75 group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface\"\n :style=\"thumbStyle\"\n />\n\n <div\n v-if=\"previewTime !== null\"\n ref=\"bubbleEl\"\n class=\"pointer-events-none absolute bottom-full z-10 mb-1 -translate-x-1/2\"\n :style=\"{ left: `${previewX}px` }\"\n >\n <slot name=\"preview\" :time=\"previewTime\" :formatted=\"fmt(previewTime)\" :chapter=\"previewChapter\">\n <div class=\"flex h-7 max-w-60 items-center gap-1 rounded-full bg-inverse-surface px-2.5 text-label-medium whitespace-nowrap text-inverse-on-surface tabular-nums\">\n <span v-if=\"previewChapter?.title\" class=\"truncate\">{{ previewChapter.title }} ·</span>\n <span>{{ fmt(previewTime) }}</span>\n </div>\n </slot>\n </div>\n </div>\n\n <div v-if=\"time === 'below'\" class=\"flex items-center justify-between text-label-medium tabular-nums\" :class=\"!timeColor && 'text-on-surface-variant'\" :style=\"timeStyle\">\n <span>{{ startText }}</span>\n <button\n type=\"button\"\n class=\"cursor-pointer rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-secondary\"\n :aria-label=\"showRemaining ? locale.seekBarShowDuration : locale.seekBarShowRemaining\"\n @click=\"toggleRemaining\"\n >{{ endText }}</button>\n </div>\n <button\n v-else-if=\"time === 'sides'\"\n type=\"button\"\n class=\"min-w-[4ch] shrink-0 cursor-pointer rounded-sm text-left text-label-medium tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-secondary\"\n :class=\"!timeColor && 'text-on-surface-variant'\"\n :style=\"timeStyle\"\n :aria-label=\"showRemaining ? locale.seekBarShowDuration : locale.seekBarShowRemaining\"\n @click=\"toggleRemaining\"\n >{{ endText }}</button>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BA,IAAMsB,IAAQC,GAqDRC,IAAOH,IAQPI,IAASf,EAAU,GAKnBgB,KAAQ;GACZ,IAAI;IAAE,OAAO;IAAG,QAAQ;IAAI,KAAK;IAAI,SAAS;IAAI,KAAK;IAAG,KAAK;IAAI,MAAM;IAAG,KAAK;IAAK,QAAQ;GAAG;GACjG,IAAI;IAAE,OAAO;IAAG,QAAQ;IAAI,KAAK;IAAI,SAAS;IAAI,KAAK;IAAG,KAAK;IAAI,MAAM;IAAG,KAAK;IAAG,QAAQ;GAAG;GAC/F,IAAI;IAAE,OAAO;IAAI,QAAQ;IAAI,KAAK;IAAI,SAAS;IAAI,KAAK;IAAG,KAAK;IAAI,MAAM;IAAG,KAAK;IAAG,QAAQ;GAAG;EAClG,GACMC,IAAIC,QAAeF,GAAMJ,EAAM,SAASI,GAAM,EAAE,GAEhDG,IAAMD,QAAgB,OAAO,SAASN,EAAM,QAAQ,KAAKA,EAAM,WAAW,IAAIA,EAAM,WAAW,CAAE,GACjGQ,IAAWF,QAAeN,EAAM,YAAY,CAACO,EAAI,KAAK,GAGtDE,KAAgC;GACpC,SAAS;GACT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OAAKpB,EAAE6C,EAAA,KAAS;IAChB,cAAYH,EAAA,QAAgBvC,EAAAmB,CAAA,CAAM,CAAC,sBAAsBnB,EAAAmB,CAAA,CAAM,CAAC;IAChE,SAAOsB;GACN,GAAA3C,EAAA8C,GAAA,KAAO,GAAA,IAAAhC,EAAA,K"}
@@ -1,5 +1,5 @@
1
- import { t as e } from "./MIcon-DpajuUTJ.js";
2
- import { n as t, r as n } from "./_useFieldValidation-B0B44M_t.js";
1
+ import { t as e } from "./MIcon-BSsJZhK7.js";
2
+ import { n as t, r as n } from "./_useFieldValidation-CvZnZfl-.js";
3
3
  import { Fragment as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, mergeProps as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, toDisplayString as m, unref as h } from "vue";
4
4
  // src/components/MSegmentedButton.vue?vue&type=script&setup=true&lang.ts
5
5
  var g = ["aria-invalid", "aria-describedby"], _ = [
@@ -75,7 +75,7 @@ var g = ["aria-invalid", "aria-describedby"], _ = [
75
75
  type: "button",
76
76
  class: u(["relative inline-flex grow items-center justify-center gap-2 text-label-large font-medium transition-[background-color,color] duration-150 outline-none before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", [
77
77
  c.density === "compact" ? "h-8 px-3" : c.density === "comfortable" ? "h-10 px-4" : "h-10 px-6",
78
- n > 0 ? t.disabled ? "border-l border-outline/12" : "border-l border-outline" : "",
78
+ n > 0 ? t.disabled ? "border-s border-outline/12" : "border-s border-outline" : "",
79
79
  t.disabled ? "cursor-not-allowed" : "cursor-pointer",
80
80
  k(t.value, c.modelValue) && (c.color === "secondary" ? "bg-secondary-container" : c.color === "tertiary" ? "bg-tertiary-container" : "bg-primary-container"),
81
81
  t.disabled ? "text-on-surface/38" : k(t.value, c.modelValue) ? c.color === "secondary" ? "text-on-secondary-container" : c.color === "tertiary" ? "text-on-tertiary-container" : "text-on-primary-container" : "text-on-surface"
@@ -102,4 +102,4 @@ var g = ["aria-invalid", "aria-describedby"], _ = [
102
102
  });
103
103
  export { y as t };
104
104
 
105
- //# sourceMappingURL=MSegmentedButton-BXzRsg1S.js.map
105
+ //# sourceMappingURL=MSegmentedButton-DZuZLBML.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MSegmentedButton-BXzRsg1S.js","names":["$attrs","_openBlock","_createElementBlock","_Fragment","_createElementVNode","_mergeProps","_unref","_renderList","_normalizeClass","_createBlock","MIcon","_toDisplayString","MIcon_default","useFieldValidation","useFocusLeave","_hoisted_1","_hoisted_2","_hoisted_3","MSegmentedButton_default","defineComponent","__expose","__emit","props","__props","emit","rootEl","ref","validation","v","errorMessage","onFocusOut","isSelected","modelValue","value","toggle","multi","arr","idx","opt","openBlock","createElementBlock","Fragment","createElementVNode","mergeProps","_ctx","unref","hasError","messageId","_cache","args","renderList","normalizeClass","i","createBlock","createCommentVNode","toDisplayString"],"sources":["../src/components/MSegmentedButton.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface SegmentedOption<V extends string | number = string | number> {\n value: V\n label: string\n icon?: string\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"V extends string | number, M extends V | V[] = V\">\n/**\n * A row of joined segments for choosing between a small set of related options — single or multi select.\n *\n * @event update:modelValue Emitted on selection change — powers v-model\n * @event blur Emitted when focus leaves the segments\n */\nimport { ref } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'\nimport type { ValidateOn, ValidationRule } from '../composables/validation'\n\nconst props = withDefaults(defineProps<{\n /** Selected value, or values with `multiSelect` (v-model); typed after the options' values */\n modelValue: M\n /** The options to choose from; see `SegmentedOption`. */\n options: SegmentedOption<V>[]\n /** Allow multiple selections */\n multiSelect?: boolean\n /** Button density */\n density?: 'default' | 'comfortable' | 'compact'\n /** Selected segment color */\n color?: 'primary' | 'secondary' | 'tertiary'\n /** Error state. A string is also the message */\n error?: boolean | string\n /** Error message shown when `error` is true */\n errorLabel?: string\n /** Inside an `MForm` or with `rules`, a segment must be selected */\n required?: boolean\n /** Validation rules (functions or a Standard Schema); see `MForm` */\n rules?: ValidationRule | ValidationRule[]\n /** When the rules are checked and shown: on leaving it (default), on change, or only on submit */\n validateOn?: ValidateOn\n /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */\n validateDebounce?: number\n /** The key of this field in its `MForm` */\n name?: string\n}>(), { multiSelect: false, density: 'default', color: 'primary' })\n\n// Segments + their message: attributes go on the segments\ndefineOptions({ inheritAttrs: false })\n\nconst emit = defineEmits<{ 'update:modelValue': [M]; blur: [] }>()\n\nconst rootEl = ref<HTMLElement | null>(null)\n\nconst validation = useFieldValidation({\n value: () => props.modelValue,\n rules: () => props.rules,\n required: () => props.required,\n error: () => props.error,\n errorLabel: () => props.errorLabel,\n name: () => props.name,\n validateOn: () => props.validateOn,\n validateDebounce: () => props.validateDebounce,\n disabled: () => false,\n focus: () => { rootEl.value?.querySelector<HTMLButtonElement>('button:not(:disabled)')?.focus() },\n el: () => rootEl.value,\n setValue: (v) => emit('update:modelValue', v as M),\n})\nconst { hasError, message: errorMessage, messageId } = validation\nconst onFocusOut = useFocusLeave(() => rootEl.value, () => {\n validation.onBlur()\n emit('blur')\n})\n\ndefineExpose({\n /** Checks its rules and shows the result; resolves to whether they pass */\n validate: validation.validate,\n /** Hides its validation error (until the next check) */\n resetValidation: validation.resetValidation,\n})\n\nfunction isSelected(value: V, modelValue: M) {\n return Array.isArray(modelValue) ? modelValue.includes(value) : modelValue === value\n}\n\nfunction toggle(opt: SegmentedOption<V>, modelValue: M, multi: boolean) {\n if (opt.disabled) return\n if (multi) {\n const arr: V[] = Array.isArray(modelValue) ? [...modelValue] : [modelValue as V]\n const idx = arr.indexOf(opt.value)\n if (idx >= 0) arr.splice(idx, 1)\n else arr.push(opt.value)\n emit('update:modelValue', arr as M)\n } else {\n emit('update:modelValue', opt.value as M)\n }\n}\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n v-bind=\"$attrs\"\n class=\"inline-flex overflow-hidden rounded-full border border-outline\"\n role=\"group\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"errorMessage ? messageId : undefined\"\n @focusout=\"onFocusOut\"\n >\n <button\n v-for=\"(opt, i) in options\"\n :key=\"opt.value\"\n type=\"button\"\n class=\"relative inline-flex grow items-center justify-center gap-2 text-label-large font-medium transition-[background-color,color] duration-150 outline-none before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]\"\n :class=\"[\n density === 'compact' ? 'h-8 px-3' : density === 'comfortable' ? 'h-10 px-4' : 'h-10 px-6',\n i > 0 ? (opt.disabled ? 'border-l border-outline/12' : 'border-l border-outline') : '',\n opt.disabled ? 'cursor-not-allowed' : 'cursor-pointer',\n isSelected(opt.value, modelValue) && (\n color === 'secondary' ? 'bg-secondary-container'\n : color === 'tertiary' ? 'bg-tertiary-container'\n : 'bg-primary-container'\n ),\n opt.disabled\n ? 'text-on-surface/38'\n : isSelected(opt.value, modelValue)\n ? color === 'secondary' ? 'text-on-secondary-container'\n : color === 'tertiary' ? 'text-on-tertiary-container'\n : 'text-on-primary-container'\n : 'text-on-surface',\n ]\"\n :disabled=\"opt.disabled\"\n :aria-pressed=\"isSelected(opt.value, modelValue)\"\n @click=\"toggle(opt, modelValue, multiSelect)\"\n >\n <MIcon\n v-if=\"isSelected(opt.value, modelValue)\"\n name=\"check\"\n :size=\"18\"\n class=\"transition-transform duration-150\"\n />\n <MIcon v-else-if=\"opt.icon\" :name=\"opt.icon\" :size=\"18\" />\n <span>{{ opt.label }}</span>\n </button>\n </div>\n <!-- M3's segmented button has no error state: the message says so -->\n <p v-if=\"errorMessage\" :id=\"messageId\" role=\"alert\" class=\"mt-1 text-body-small text-error\">{{ errorMessage }}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AII,EAAAyC,CAAA;GAAW,MAAK;GAAQ,OAAM;EAAqC,GAAApC,EAAAL,EAAAuB,CAAA,CAAY,GAAA,GAAAZ,CAAA,K"}
1
+ {"version":3,"file":"MSegmentedButton-DZuZLBML.js","names":["$attrs","_openBlock","_createElementBlock","_Fragment","_createElementVNode","_mergeProps","_unref","_renderList","_normalizeClass","_createBlock","MIcon","_toDisplayString","MIcon_default","useFieldValidation","useFocusLeave","_hoisted_1","_hoisted_2","_hoisted_3","MSegmentedButton_default","defineComponent","__expose","__emit","props","__props","emit","rootEl","ref","validation","v","errorMessage","onFocusOut","isSelected","modelValue","value","toggle","multi","arr","idx","opt","openBlock","createElementBlock","Fragment","createElementVNode","mergeProps","_ctx","unref","hasError","messageId","_cache","args","renderList","normalizeClass","i","createBlock","createCommentVNode","toDisplayString"],"sources":["../src/components/MSegmentedButton.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface SegmentedOption<V extends string | number = string | number> {\n value: V\n label: string\n icon?: string\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"V extends string | number, M extends V | V[] = V\">\n/**\n * A row of joined segments for choosing between a small set of related options — single or multi select.\n *\n * @event update:modelValue Emitted on selection change — powers v-model\n * @event blur Emitted when focus leaves the segments\n */\nimport { ref } from 'vue'\nimport MIcon from './MIcon.vue'\nimport { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'\nimport type { ValidateOn, ValidationRule } from '../composables/validation'\n\nconst props = withDefaults(defineProps<{\n /** Selected value, or values with `multiSelect` (v-model); typed after the options' values */\n modelValue: M\n /** The options to choose from; see `SegmentedOption`. */\n options: SegmentedOption<V>[]\n /** Allow multiple selections */\n multiSelect?: boolean\n /** Button density */\n density?: 'default' | 'comfortable' | 'compact'\n /** Selected segment color */\n color?: 'primary' | 'secondary' | 'tertiary'\n /** Error state. A string is also the message */\n error?: boolean | string\n /** Error message shown when `error` is true */\n errorLabel?: string\n /** Inside an `MForm` or with `rules`, a segment must be selected */\n required?: boolean\n /** Validation rules (functions or a Standard Schema); see `MForm` */\n rules?: ValidationRule | ValidationRule[]\n /** When the rules are checked and shown: on leaving it (default), on change, or only on submit */\n validateOn?: ValidateOn\n /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */\n validateDebounce?: number\n /** The key of this field in its `MForm` */\n name?: string\n}>(), { multiSelect: false, density: 'default', color: 'primary' })\n\n// Segments + their message: attributes go on the segments\ndefineOptions({ inheritAttrs: false })\n\nconst emit = defineEmits<{ 'update:modelValue': [M]; blur: [] }>()\n\nconst rootEl = ref<HTMLElement | null>(null)\n\nconst validation = useFieldValidation({\n value: () => props.modelValue,\n rules: () => props.rules,\n required: () => props.required,\n error: () => props.error,\n errorLabel: () => props.errorLabel,\n name: () => props.name,\n validateOn: () => props.validateOn,\n validateDebounce: () => props.validateDebounce,\n disabled: () => false,\n focus: () => { rootEl.value?.querySelector<HTMLButtonElement>('button:not(:disabled)')?.focus() },\n el: () => rootEl.value,\n setValue: (v) => emit('update:modelValue', v as M),\n})\nconst { hasError, message: errorMessage, messageId } = validation\nconst onFocusOut = useFocusLeave(() => rootEl.value, () => {\n validation.onBlur()\n emit('blur')\n})\n\ndefineExpose({\n /** Checks its rules and shows the result; resolves to whether they pass */\n validate: validation.validate,\n /** Hides its validation error (until the next check) */\n resetValidation: validation.resetValidation,\n})\n\nfunction isSelected(value: V, modelValue: M) {\n return Array.isArray(modelValue) ? modelValue.includes(value) : modelValue === value\n}\n\nfunction toggle(opt: SegmentedOption<V>, modelValue: M, multi: boolean) {\n if (opt.disabled) return\n if (multi) {\n const arr: V[] = Array.isArray(modelValue) ? [...modelValue] : [modelValue as V]\n const idx = arr.indexOf(opt.value)\n if (idx >= 0) arr.splice(idx, 1)\n else arr.push(opt.value)\n emit('update:modelValue', arr as M)\n } else {\n emit('update:modelValue', opt.value as M)\n }\n}\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n v-bind=\"$attrs\"\n class=\"inline-flex overflow-hidden rounded-full border border-outline\"\n role=\"group\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"errorMessage ? messageId : undefined\"\n @focusout=\"onFocusOut\"\n >\n <button\n v-for=\"(opt, i) in options\"\n :key=\"opt.value\"\n type=\"button\"\n class=\"relative inline-flex grow items-center justify-center gap-2 text-label-large font-medium transition-[background-color,color] duration-150 outline-none before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]\"\n :class=\"[\n density === 'compact' ? 'h-8 px-3' : density === 'comfortable' ? 'h-10 px-4' : 'h-10 px-6',\n i > 0 ? (opt.disabled ? 'border-s border-outline/12' : 'border-s border-outline') : '',\n opt.disabled ? 'cursor-not-allowed' : 'cursor-pointer',\n isSelected(opt.value, modelValue) && (\n color === 'secondary' ? 'bg-secondary-container'\n : color === 'tertiary' ? 'bg-tertiary-container'\n : 'bg-primary-container'\n ),\n opt.disabled\n ? 'text-on-surface/38'\n : isSelected(opt.value, modelValue)\n ? color === 'secondary' ? 'text-on-secondary-container'\n : color === 'tertiary' ? 'text-on-tertiary-container'\n : 'text-on-primary-container'\n : 'text-on-surface',\n ]\"\n :disabled=\"opt.disabled\"\n :aria-pressed=\"isSelected(opt.value, modelValue)\"\n @click=\"toggle(opt, modelValue, multiSelect)\"\n >\n <MIcon\n v-if=\"isSelected(opt.value, modelValue)\"\n name=\"check\"\n :size=\"18\"\n class=\"transition-transform duration-150\"\n />\n <MIcon v-else-if=\"opt.icon\" :name=\"opt.icon\" :size=\"18\" />\n <span>{{ opt.label }}</span>\n </button>\n </div>\n <!-- M3's segmented button has no error state: the message says so -->\n <p v-if=\"errorMessage\" :id=\"messageId\" role=\"alert\" class=\"mt-1 text-body-small text-error\">{{ errorMessage }}</p>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBA,IAAMsB,IAAQC,GA8BRC,IAAOH,GAEPI,IAAS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K"}
@@ -0,0 +1,140 @@
1
+ import { n as e } from "./_useFieldValidation-CvZnZfl-.js";
2
+ import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeProps as s, onMounted as c, openBlock as l, ref as u, toDisplayString as d, unref as f, watch as p } from "vue";
3
+ // src/components/MSignaturePad.vue?vue&type=script&setup=true&lang.ts
4
+ var m = [
5
+ "width",
6
+ "height",
7
+ "aria-invalid",
8
+ "aria-describedby"
9
+ ], h = ["id"], g = /* @__PURE__ */ o({
10
+ inheritAttrs: !1,
11
+ __name: "MSignaturePad",
12
+ props: {
13
+ width: { default: 400 },
14
+ height: { default: 200 },
15
+ lineWidth: { default: 2.5 },
16
+ color: { default: "#000000" },
17
+ background: { default: "#ffffff" },
18
+ variant: { default: "outlined" },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: !1
22
+ },
23
+ error: { type: [Boolean, String] },
24
+ errorLabel: {},
25
+ required: { type: Boolean },
26
+ rules: {},
27
+ validateOn: {},
28
+ validateDebounce: {},
29
+ name: {}
30
+ },
31
+ emits: [
32
+ "begin",
33
+ "end",
34
+ "change"
35
+ ],
36
+ setup(o, { expose: g, emit: _ }) {
37
+ let v = o, y = _, b = u(null), x = u(null), S = e({
38
+ value: () => b.value,
39
+ rules: () => v.rules,
40
+ required: () => v.required,
41
+ error: () => v.error,
42
+ errorLabel: () => v.errorLabel,
43
+ name: () => v.name,
44
+ validateOn: () => v.validateOn,
45
+ validateDebounce: () => v.validateDebounce,
46
+ disabled: () => v.disabled,
47
+ focus: () => x.value?.scrollIntoView({
48
+ block: "center",
49
+ behavior: "smooth"
50
+ }),
51
+ el: () => x.value,
52
+ setValue: () => L()
53
+ }), C = S.disabled, { hasError: w, message: T, messageId: E } = S, D = u(null), O = u([]), k = u(!1), A = n(() => O.value.length === 0);
54
+ function j() {
55
+ return D.value?.getContext("2d") ?? null;
56
+ }
57
+ function M() {
58
+ let e = j(), t = D.value;
59
+ if (e && t) {
60
+ e.clearRect(0, 0, t.width, t.height), e.fillStyle = v.background, e.fillRect(0, 0, t.width, t.height), e.strokeStyle = v.color, e.lineWidth = v.lineWidth, e.lineCap = "round", e.lineJoin = "round";
61
+ for (let t of O.value) if (!(t.length < 2)) {
62
+ e.beginPath(), e.moveTo(t[0].x, t[0].y);
63
+ for (let n of t.slice(1)) e.lineTo(n.x, n.y);
64
+ e.stroke();
65
+ }
66
+ }
67
+ }
68
+ function N(e) {
69
+ let t = D.value.getBoundingClientRect();
70
+ return {
71
+ x: e.clientX - t.left,
72
+ y: e.clientY - t.top
73
+ };
74
+ }
75
+ function P(e) {
76
+ C.value || (k.value = !0, O.value.push([N(e)]), y("begin"), D.value?.setPointerCapture(e.pointerId));
77
+ }
78
+ function F(e) {
79
+ k.value && (O.value[O.value.length - 1].push(N(e)), M());
80
+ }
81
+ function I() {
82
+ if (!k.value) return;
83
+ k.value = !1;
84
+ let e = B();
85
+ b.value = e, y("end", e), y("change", e), S.onBlur();
86
+ }
87
+ function L() {
88
+ O.value = [], b.value = null, M();
89
+ }
90
+ function R() {
91
+ O.value = O.value.slice(0, -1), M();
92
+ let e = B();
93
+ b.value = A.value ? null : e, y("change", e);
94
+ }
95
+ function z() {
96
+ return A.value;
97
+ }
98
+ function B(e, t) {
99
+ return D.value?.toDataURL(e, t) ?? "";
100
+ }
101
+ p([
102
+ () => v.color,
103
+ () => v.background,
104
+ () => v.lineWidth
105
+ ], M), c(M), g({
106
+ clear: L,
107
+ undo: R,
108
+ isEmpty: z,
109
+ toDataURL: B,
110
+ validate: S.validate,
111
+ resetValidation: S.resetValidation
112
+ });
113
+ let V = n(() => v.variant === "outlined" ? ["rounded-sm border", w.value ? "border-error" : "border-outline"] : ["rounded-t-sm bg-surface-container-highest border-b", w.value ? "border-error" : "border-on-surface-variant"]);
114
+ return (e, n) => (l(), i(t, null, [a("div", s({
115
+ ref_key: "rootEl",
116
+ ref: x
117
+ }, e.$attrs, { class: ["inline-block touch-none", [V.value, f(C) ? "cursor-not-allowed opacity-[0.38]" : "cursor-crosshair"]] }), [a("canvas", {
118
+ ref_key: "canvasEl",
119
+ ref: D,
120
+ width: o.width,
121
+ height: o.height,
122
+ role: "img",
123
+ "aria-label": "Signature pad",
124
+ "aria-invalid": f(w) || void 0,
125
+ "aria-describedby": f(T) ? f(E) : void 0,
126
+ onPointerdown: P,
127
+ onPointermove: F,
128
+ onPointerup: I,
129
+ onPointerleave: I
130
+ }, null, 40, m)], 16), f(T) ? (l(), i("p", {
131
+ key: 0,
132
+ id: f(E),
133
+ role: "alert",
134
+ class: "mt-1 text-body-small text-error"
135
+ }, d(f(T)), 9, h)) : r("", !0)], 64));
136
+ }
137
+ });
138
+ export { g as t };
139
+
140
+ //# sourceMappingURL=MSignaturePad-Bqr-1R9f.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MSignaturePad-Bqr-1R9f.js","names":["$attrs","_openBlock","_createElementBlock","_createElementVNode","_mergeProps","_unref","_toDisplayString","useFieldValidation","_hoisted_1","_hoisted_2","MSignaturePad_default","defineComponent","__expose","__emit","props","__props","emit","signature","ref","rootEl","validation","clear","isDisabled","errorMessage","canvasEl","strokes","drawing","empty","computed","getContext","redraw","ctx","canvas","stroke","point","pointFromEvent","rect","onPointerDown","onPointerMove","onPointerUp","dataUrl","toDataURL","undo","isEmpty","type","quality","watch","onMounted","containerClasses","hasError","openBlock","createElementBlock","Fragment","createElementVNode","mergeProps","_ctx","unref","messageId","toDisplayString","createCommentVNode"],"sources":["../src/components/MSignaturePad.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A bordered canvas that captures pointer strokes for signature capture. There's no v-model, since a signature\n * isn't a simple value — read it out via events or the exposed methods.\n *\n * @event end Fires after a stroke ends, with a PNG data: URL of the canvas\n * @event change Fires alongside end, and also after undo() — same data: URL payload\n * @event begin Fires on the first pointerdown of a new stroke\n *\n * In an `MForm` it validates as a field whose value is the PNG data: URL (null while empty): `required` asks for a\n * signature, and the form's values carry it under `name`.\n */\nimport { computed, onMounted, ref, watch } from 'vue'\nimport { useFieldValidation } from '../composables/_useFieldValidation'\nimport type { ValidateOn, ValidationRule } from '../composables/validation'\n\nconst props = withDefaults(\n defineProps<{\n /** Canvas width in px */\n width?: number\n /** Canvas height in px */\n height?: number\n /** Stroke width */\n lineWidth?: number\n /** Stroke color */\n color?: string\n /** Canvas background color */\n background?: string\n /** Container border style */\n variant?: 'filled' | 'outlined'\n /** Disables drawing */\n disabled?: boolean\n /** Error state. A string is also the message */\n error?: boolean | string\n /** Error message shown when `error` is true */\n errorLabel?: string\n /** Inside an `MForm` or with `rules`, a signature must be drawn */\n required?: boolean\n /** Validation rules (functions or a Standard Schema); see `MForm` */\n rules?: ValidationRule | ValidationRule[]\n /** When the rules are checked and shown: after each stroke (default), or only on submit */\n validateOn?: ValidateOn\n /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */\n validateDebounce?: number\n /** The key of this field in its `MForm` */\n name?: string\n }>(),\n {\n width: 400,\n height: 200,\n lineWidth: 2.5,\n color: '#000000',\n background: '#ffffff',\n variant: 'outlined',\n disabled: false,\n },\n)\n\n// Pad + its message: attributes go on the pad\ndefineOptions({ inheritAttrs: false })\n\nconst emit = defineEmits<{ begin: []; end: [string]; change: [string] }>()\n\n/** The signature as a data: URL, null while empty: what validation checks and an MForm submits */\nconst signature = ref<string | null>(null)\nconst rootEl = ref<HTMLElement | null>(null)\nconst validation = useFieldValidation({\n value: () => signature.value,\n rules: () => props.rules,\n required: () => props.required,\n error: () => props.error,\n errorLabel: () => props.errorLabel,\n name: () => props.name,\n validateOn: () => props.validateOn,\n validateDebounce: () => props.validateDebounce,\n disabled: () => props.disabled,\n // A canvas takes no focus: bring it into view instead\n focus: () => rootEl.value?.scrollIntoView({ block: 'center', behavior: 'smooth' }),\n el: () => rootEl.value,\n // MForm's reset(): back to empty\n setValue: () => clear(),\n})\n/** Its own `disabled` or its MForm's */\nconst isDisabled = validation.disabled\nconst { hasError, message: errorMessage, messageId } = validation\n\ntype Point = { x: number; y: number }\n\nconst canvasEl = ref<HTMLCanvasElement | null>(null)\nconst strokes = ref<Point[][]>([])\nconst drawing = ref(false)\nconst empty = computed(() => strokes.value.length === 0)\n\nfunction getContext() {\n return canvasEl.value?.getContext('2d') ?? null\n}\n\nfunction redraw() {\n const ctx = getContext()\n const canvas = canvasEl.value\n if (!ctx || !canvas) return\n\n ctx.clearRect(0, 0, canvas.width, canvas.height)\n ctx.fillStyle = props.background\n ctx.fillRect(0, 0, canvas.width, canvas.height)\n\n ctx.strokeStyle = props.color\n ctx.lineWidth = props.lineWidth\n ctx.lineCap = 'round'\n ctx.lineJoin = 'round'\n\n for (const stroke of strokes.value) {\n if (stroke.length < 2) continue\n ctx.beginPath()\n ctx.moveTo(stroke[0]!.x, stroke[0]!.y)\n for (const point of stroke.slice(1)) ctx.lineTo(point.x, point.y)\n ctx.stroke()\n }\n}\n\nfunction pointFromEvent(e: PointerEvent): Point {\n const rect = canvasEl.value!.getBoundingClientRect()\n return { x: e.clientX - rect.left, y: e.clientY - rect.top }\n}\n\nfunction onPointerDown(e: PointerEvent) {\n if (isDisabled.value) return\n drawing.value = true\n strokes.value.push([pointFromEvent(e)])\n emit('begin')\n canvasEl.value?.setPointerCapture(e.pointerId)\n}\n\nfunction onPointerMove(e: PointerEvent) {\n if (!drawing.value) return\n strokes.value[strokes.value.length - 1]!.push(pointFromEvent(e))\n redraw()\n}\n\nfunction onPointerUp() {\n if (!drawing.value) return\n drawing.value = false\n const dataUrl = toDataURL()\n signature.value = dataUrl\n emit('end', dataUrl)\n emit('change', dataUrl)\n // A finished stroke counts as having used the field\n validation.onBlur()\n}\n\nfunction clear() {\n strokes.value = []\n signature.value = null\n redraw()\n}\n\nfunction undo() {\n strokes.value = strokes.value.slice(0, -1)\n redraw()\n const dataUrl = toDataURL()\n signature.value = empty.value ? null : dataUrl\n emit('change', dataUrl)\n}\n\nfunction isEmpty(): boolean {\n return empty.value\n}\n\nfunction toDataURL(type?: string, quality?: number): string {\n return canvasEl.value?.toDataURL(type, quality) ?? ''\n}\n\nwatch([() => props.color, () => props.background, () => props.lineWidth], redraw)\n\nonMounted(redraw)\n\ndefineExpose({\n clear,\n undo,\n isEmpty,\n toDataURL,\n /** Checks its rules and shows the result; resolves to whether they pass */\n validate: validation.validate,\n /** Hides its validation error (until the next check) */\n resetValidation: validation.resetValidation,\n})\n\nconst containerClasses = computed(() => {\n if (props.variant === 'outlined') {\n return ['rounded-sm border', hasError.value ? 'border-error' : 'border-outline']\n }\n return ['rounded-t-sm bg-surface-container-highest border-b', hasError.value ? 'border-error' : 'border-on-surface-variant']\n})\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n v-bind=\"$attrs\"\n class=\"inline-block touch-none\"\n :class=\"[containerClasses, isDisabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-crosshair']\"\n >\n <canvas\n ref=\"canvasEl\"\n :width=\"width\"\n :height=\"height\"\n role=\"img\"\n aria-label=\"Signature pad\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"errorMessage ? messageId : undefined\"\n @pointerdown=\"onPointerDown\"\n @pointermove=\"onPointerMove\"\n @pointerup=\"onPointerUp\"\n @pointerleave=\"onPointerUp\"\n />\n </div>\n <p v-if=\"errorMessage\" :id=\"messageId\" role=\"alert\" class=\"mt-1 text-body-small text-error\">{{ errorMessage }}</p>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,IAAMc,IAAQC,GA6CRC,IAAOH,GAGPI,IAAYC,EAAmB,IAAI,GACnCC,IAASD,EAAwB,IAAI,GACrCE,IAAab,EAAmB;GACpC,aAAaU,EAAU;GACvB,aAAaH,EAAM;GACnB,gBAAgBA,EAAM;GACtB,aAAaA,EAAM;GACnB,kBAAkBA,EAAM;GACxB,YAAYA,EAAM;GAClB,kBAAkBA,EAAM;GACxB,wBAAwBA,EAAM;GAC9B,gBAAgBA,EAAM;GAEtB,aAAaK,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