@m3ui-vue/m3ui-vue 1.10.2 → 1.11.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 (292) hide show
  1. package/README.md +19 -4
  2. package/dist/API.md +195 -56
  3. package/dist/MButton-gWoOzFWf.js +284 -0
  4. package/dist/MButton-gWoOzFWf.js.map +1 -0
  5. package/dist/MColorPickerModal-CJYMvlgK.js +466 -0
  6. package/dist/MColorPickerModal-CJYMvlgK.js.map +1 -0
  7. package/dist/MDialog-CU8EYgCC.js +226 -0
  8. package/dist/MDialog-CU8EYgCC.js.map +1 -0
  9. package/dist/{MIcon-BSsJZhK7.js → MIcon-CkUc9kuQ.js} +10 -4
  10. package/dist/MIcon-CkUc9kuQ.js.map +1 -0
  11. package/dist/MIconButton-DTFOfsTy.js +317 -0
  12. package/dist/MIconButton-DTFOfsTy.js.map +1 -0
  13. package/dist/MListItem-Cdw2FqCT.js +1306 -0
  14. package/dist/MListItem-Cdw2FqCT.js.map +1 -0
  15. package/dist/MLoadingIndicator-BxAy2x7P.js +115 -0
  16. package/dist/MLoadingIndicator-BxAy2x7P.js.map +1 -0
  17. package/dist/{MMenuItem-US0Zbglq.js → MMenuItem-CEIKYvaX.js} +216 -214
  18. package/dist/MMenuItem-CEIKYvaX.js.map +1 -0
  19. package/dist/{MPdfViewer-DL9mRsd2.js → MPdfViewer-CEfyXGq2.js} +674 -671
  20. package/dist/MPdfViewer-CEfyXGq2.js.map +1 -0
  21. package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
  22. package/dist/MSeekBar-B3_D-PwH.js +435 -0
  23. package/dist/MSeekBar-B3_D-PwH.js.map +1 -0
  24. package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-Dg07j-4r.js} +4 -4
  25. package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-Dg07j-4r.js.map} +1 -1
  26. package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-3nddtLKI.js} +2 -2
  27. package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-3nddtLKI.js.map} +1 -1
  28. package/dist/{MSlider-7TzhFHKS.js → MSlider-BrpLbqwt.js} +4 -4
  29. package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BrpLbqwt.js.map} +1 -1
  30. package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CLwzDH33.js} +2 -2
  31. package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CLwzDH33.js.map} +1 -1
  32. package/dist/{MTextField-B6_iOczK.js → MTextField-CZRizAwA.js} +136 -134
  33. package/dist/MTextField-CZRizAwA.js.map +1 -0
  34. package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-DVcqyy9g.js} +2 -2
  35. package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-DVcqyy9g.js.map} +1 -1
  36. package/dist/api.json +1 -1
  37. package/dist/chart.js +1 -1
  38. package/dist/code-editor.js +3 -3
  39. package/dist/code-editor.js.map +1 -1
  40. package/dist/components/MAlert.vue.d.ts +1 -1
  41. package/dist/components/MAudioPlayer.vue.d.ts +3 -3
  42. package/dist/components/MAvatar.vue.d.ts +19 -1
  43. package/dist/components/MButton.vue.d.ts +2 -1
  44. package/dist/components/MChatBubble.vue.d.ts +2 -0
  45. package/dist/components/MCheckbox.vue.d.ts +2 -0
  46. package/dist/components/MDataTable.vue.d.ts +31 -3
  47. package/dist/components/MFlow.vue.d.ts +1 -1
  48. package/dist/components/MHotkeys.vue.d.ts +1 -0
  49. package/dist/components/MIcon.vue.d.ts +6 -0
  50. package/dist/components/MIconButton.vue.d.ts +5 -0
  51. package/dist/components/MKanban.vue.d.ts +1 -1
  52. package/dist/components/MLink.vue.d.ts +59 -0
  53. package/dist/components/MListItem.vue.d.ts +3 -1
  54. package/dist/components/MMapControl.vue.d.ts +1 -1
  55. package/dist/components/MNotificationCenter.vue.d.ts +1 -1
  56. package/dist/components/MNumberField.vue.d.ts +1 -1
  57. package/dist/components/MPagination.vue.d.ts +14 -1
  58. package/dist/components/MPdfSigner.vue.d.ts +2 -2
  59. package/dist/components/MRadio.vue.d.ts +2 -0
  60. package/dist/components/MRadioGroup.vue.d.ts +2 -0
  61. package/dist/components/MStatCard.vue.d.ts +2 -2
  62. package/dist/components/MSwitch.vue.d.ts +2 -0
  63. package/dist/components/MText.vue.d.ts +4 -2
  64. package/dist/components/MTextField.vue.d.ts +2 -0
  65. package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
  66. package/dist/composables/_menuGroups.d.ts +10 -1
  67. package/dist/composables/_splitAttrs.d.ts +6 -0
  68. package/dist/composables/_springAnimation.d.ts +2 -2
  69. package/dist/composables/_useFocusTrap.d.ts +15 -0
  70. package/dist/composables/_usePaneResize.d.ts +1 -1
  71. package/dist/composables/_useSpring.d.ts +4 -4
  72. package/dist/composables/dynamicColor.d.ts +9 -1
  73. package/dist/composables/motion.d.ts +63 -0
  74. package/dist/composables/useConfirm.d.ts +28 -0
  75. package/dist/composables/useDevice.d.ts +8 -1
  76. package/dist/composables/useLocale.d.ts +14 -0
  77. package/dist/composables/useScrollReveal.d.ts +1 -1
  78. package/dist/composables/useTheme.d.ts +1 -0
  79. package/dist/composables/useToast.d.ts +7 -0
  80. package/dist/draw.js +556 -556
  81. package/dist/draw.js.map +1 -1
  82. package/dist/flow.js +854 -851
  83. package/dist/flow.js.map +1 -1
  84. package/dist/gantt.js +1118 -1096
  85. package/dist/gantt.js.map +1 -1
  86. package/dist/index.d.ts +8 -5
  87. package/dist/locales/index.d.ts +1 -0
  88. package/dist/locales/index.js +833 -1
  89. package/dist/locales/index.js.map +1 -1
  90. package/dist/locales/pl.d.ts +2 -0
  91. package/dist/m3ui-vue.css +1 -1
  92. package/dist/m3ui.js +10327 -9796
  93. package/dist/m3ui.js.map +1 -1
  94. package/dist/map.js +860 -860
  95. package/dist/map.js.map +1 -1
  96. package/dist/{material-color-utilities-CEFytLsr.js → material-color-utilities-BZsBNIhi.js} +276 -217
  97. package/dist/material-color-utilities-BZsBNIhi.js.map +1 -0
  98. package/dist/media.js +7 -7
  99. package/dist/{motion-BcejVTeX.js → motion-BqYcqcim.js} +15 -5
  100. package/dist/motion-BqYcqcim.js.map +1 -0
  101. package/dist/pdf-sign.js +140 -137
  102. package/dist/pdf-sign.js.map +1 -1
  103. package/dist/pdf.js +1 -1
  104. package/dist/plugin.d.ts +11 -0
  105. package/dist/rich-text-editor.js +7 -7
  106. package/dist/styles/theme.css +40 -0
  107. package/dist/styles.css +1 -1
  108. package/dist/terminal.js +1 -1
  109. package/dist/{useLocale-YRaOT12S.js → useLocale-BjcYauXr.js} +60 -4
  110. package/dist/useLocale-BjcYauXr.js.map +1 -0
  111. package/dist/{useThemeTokens-DyAdPQB0.js → useThemeTokens-D5nr5KHf.js} +28 -27
  112. package/dist/useThemeTokens-D5nr5KHf.js.map +1 -0
  113. package/package.json +17 -2
  114. package/src/__tests__/MAvatarImage.test.ts +37 -0
  115. package/src/__tests__/MDataTableControlled.test.ts +68 -0
  116. package/src/__tests__/MHotkeysSequence.test.ts +53 -0
  117. package/src/__tests__/MIconAxes.test.ts +16 -0
  118. package/src/__tests__/MIconButtonWidth.test.ts +22 -0
  119. package/src/__tests__/MLink.test.ts +46 -0
  120. package/src/__tests__/MPaginationPages.test.ts +43 -0
  121. package/src/__tests__/MTextEmphasized.test.ts +14 -0
  122. package/src/__tests__/controlDescription.test.ts +34 -0
  123. package/src/__tests__/customColor.test.ts +27 -0
  124. package/src/__tests__/dynamicColor.test.ts +3 -2
  125. package/src/__tests__/focusTrap.test.ts +124 -0
  126. package/src/__tests__/formatMessage.test.ts +20 -0
  127. package/src/__tests__/inputAttrs.test.ts +103 -0
  128. package/src/__tests__/localePresets.test.ts +2 -0
  129. package/src/__tests__/menuGroupsRemount.test.ts +40 -0
  130. package/src/__tests__/menuHydration.test.ts +41 -0
  131. package/src/__tests__/motionPrefs.test.ts +28 -0
  132. package/src/__tests__/ssr.test.ts +11 -0
  133. package/src/__tests__/ssrToast.test.ts +20 -0
  134. package/src/__tests__/toastDetails.test.ts +39 -0
  135. package/src/__tests__/useConfirm.test.ts +47 -0
  136. package/src/__tests__/useTheme.test.ts +14 -0
  137. package/src/__tests__/warningRole.test.ts +22 -0
  138. package/src/components/MAlert.vue +2 -2
  139. package/src/components/MAnimatedNumber.vue +9 -3
  140. package/src/components/MAutocomplete.vue +16 -4
  141. package/src/components/MAvailabilityCalendar.vue +3 -3
  142. package/src/components/MAvatar.vue +32 -5
  143. package/src/components/MAvatarGroup.vue +7 -2
  144. package/src/components/MBottomSheet.vue +18 -2
  145. package/src/components/MButton.vue +18 -5
  146. package/src/components/MCarousel.vue +3 -3
  147. package/src/components/MChatBubble.vue +14 -1
  148. package/src/components/MCheckbox.vue +21 -4
  149. package/src/components/MChip.vue +4 -2
  150. package/src/components/MCollapse.vue +7 -1
  151. package/src/components/MCommandPalette.vue +6 -2
  152. package/src/components/MContextMenu.vue +4 -4
  153. package/src/components/MCreditCardInput.vue +5 -0
  154. package/src/components/MDashboardGrid.vue +2 -1
  155. package/src/components/MDataTable.vue +63 -16
  156. package/src/components/MDialog.vue +21 -3
  157. package/src/components/MDiffViewer.vue +3 -3
  158. package/src/components/MDrawLayers.vue +3 -3
  159. package/src/components/MFabMenu.vue +7 -0
  160. package/src/components/MFloorPlan.vue +3 -3
  161. package/src/components/MFloorPlanInspector.vue +3 -3
  162. package/src/components/MFlow.vue +9 -5
  163. package/src/components/MFlowControls.vue +6 -0
  164. package/src/components/MFormBuilder.vue +1 -1
  165. package/src/components/MGantt.vue +10 -10
  166. package/src/components/MHotkeys.vue +61 -16
  167. package/src/components/MIcon.vue +17 -1
  168. package/src/components/MIconButton.vue +29 -6
  169. package/src/components/MImageCropper.vue +1 -1
  170. package/src/components/MKanban.vue +2 -1
  171. package/src/components/MLightbox.vue +5 -4
  172. package/src/components/MLink.vue +136 -0
  173. package/src/components/MListDetail.vue +7 -0
  174. package/src/components/MListItem.vue +7 -4
  175. package/src/components/MLoadingIndicator.vue +2 -1
  176. package/src/components/MMap.vue +3 -0
  177. package/src/components/MMapCluster.vue +2 -2
  178. package/src/components/MMapControl.vue +2 -2
  179. package/src/components/MMapMeasure.vue +1 -1
  180. package/src/components/MMaskField.vue +16 -3
  181. package/src/components/MMenu.vue +4 -4
  182. package/src/components/MMenuItem.vue +2 -2
  183. package/src/components/MMeterGroup.vue +3 -2
  184. package/src/components/MMortgageCalculator.vue +3 -3
  185. package/src/components/MMultiAutocomplete.vue +19 -7
  186. package/src/components/MMultiSelect.vue +19 -7
  187. package/src/components/MNavigationDrawer.vue +10 -3
  188. package/src/components/MNavigationRail.vue +5 -1
  189. package/src/components/MNotificationCenter.vue +2 -1
  190. package/src/components/MNotificationHost.vue +3 -3
  191. package/src/components/MNumberField.vue +23 -6
  192. package/src/components/MOdontogram.vue +4 -4
  193. package/src/components/MOrderBook.vue +4 -0
  194. package/src/components/MPagination.vue +91 -12
  195. package/src/components/MPdfSigner.vue +3 -3
  196. package/src/components/MPdfViewer.vue +7 -7
  197. package/src/components/MPhoneInput.vue +17 -4
  198. package/src/components/MProductConfigurator.vue +4 -4
  199. package/src/components/MProgressBar.vue +5 -0
  200. package/src/components/MQuiz.vue +8 -5
  201. package/src/components/MRadio.vue +24 -5
  202. package/src/components/MRadioGroup.vue +3 -0
  203. package/src/components/MReactions.vue +2 -2
  204. package/src/components/MResourceTimeline.vue +3 -3
  205. package/src/components/MResult.vue +1 -1
  206. package/src/components/MScrollField.vue +1 -1
  207. package/src/components/MSearchField.vue +6 -5
  208. package/src/components/MSeatMap.vue +5 -0
  209. package/src/components/MSeekBar.vue +3 -2
  210. package/src/components/MSelect.vue +16 -4
  211. package/src/components/MSideSheet.vue +25 -3
  212. package/src/components/MSimpleCarousel.vue +2 -2
  213. package/src/components/MSnackbar.vue +16 -13
  214. package/src/components/MSparkline.vue +2 -1
  215. package/src/components/MSpinner.vue +8 -0
  216. package/src/components/MSplitter.vue +1 -1
  217. package/src/components/MSpotlightSearch.vue +6 -2
  218. package/src/components/MSpreadsheet.vue +1 -1
  219. package/src/components/MStatCard.vue +2 -1
  220. package/src/components/MSwitch.vue +21 -4
  221. package/src/components/MTabs.vue +2 -1
  222. package/src/components/MTagInput.vue +19 -6
  223. package/src/components/MText.vue +23 -4
  224. package/src/components/MTextField.vue +25 -6
  225. package/src/components/MTimeline.vue +5 -5
  226. package/src/components/MToolbar.vue +2 -2
  227. package/src/components/MTour.vue +3 -0
  228. package/src/components/MTrackingTimeline.vue +6 -0
  229. package/src/components/MTypewriter.vue +7 -1
  230. package/src/components/MWindow.vue +10 -1
  231. package/src/components/_MColorPanel.vue +4 -4
  232. package/src/components/_MComment.vue +3 -2
  233. package/src/components/_MFlowNodeShell.vue +1 -1
  234. package/src/components/_MPdfPage.vue +1 -1
  235. package/src/components/_MTransferPane.vue +10 -0
  236. package/src/composables/_effectCanvas.ts +2 -1
  237. package/src/composables/_menuGroups.ts +10 -1
  238. package/src/composables/_splitAttrs.ts +29 -0
  239. package/src/composables/_springAnimation.ts +3 -3
  240. package/src/composables/_themeTransition.ts +3 -2
  241. package/src/composables/_useFocusTrap.ts +142 -0
  242. package/src/composables/_useMenuNav.ts +3 -3
  243. package/src/composables/_usePaneResize.ts +2 -1
  244. package/src/composables/_useSheetMotion.ts +3 -4
  245. package/src/composables/_useSpring.ts +16 -10
  246. package/src/composables/cron.ts +7 -6
  247. package/src/composables/dynamicColor.ts +21 -2
  248. package/src/composables/motion.ts +27 -0
  249. package/src/composables/useConfirm.ts +116 -0
  250. package/src/composables/useDevice.ts +23 -3
  251. package/src/composables/useFieldBg.ts +4 -0
  252. package/src/composables/useLocale.ts +74 -0
  253. package/src/composables/useNotification.ts +3 -0
  254. package/src/composables/useScrollReveal.ts +3 -3
  255. package/src/composables/useTheme.ts +8 -2
  256. package/src/composables/useToast.ts +27 -4
  257. package/src/directives/vSparkle.ts +2 -1
  258. package/src/index.ts +8 -5
  259. package/src/locales/ar.ts +7 -0
  260. package/src/locales/de.ts +7 -0
  261. package/src/locales/es.ts +7 -0
  262. package/src/locales/fr.ts +7 -0
  263. package/src/locales/index.ts +1 -0
  264. package/src/locales/ja.ts +7 -0
  265. package/src/locales/ko.ts +7 -0
  266. package/src/locales/pl.ts +807 -0
  267. package/src/locales/pt.ts +7 -0
  268. package/src/locales/zh.ts +7 -0
  269. package/src/plugin.ts +16 -0
  270. package/src/styles/theme.css +40 -0
  271. package/dist/MButton-B9RCM06i.js +0 -171
  272. package/dist/MButton-B9RCM06i.js.map +0 -1
  273. package/dist/MColorPickerModal-ChRtcZOo.js +0 -577
  274. package/dist/MColorPickerModal-ChRtcZOo.js.map +0 -1
  275. package/dist/MDialog-dk07tify.js +0 -167
  276. package/dist/MDialog-dk07tify.js.map +0 -1
  277. package/dist/MIcon-BSsJZhK7.js.map +0 -1
  278. package/dist/MIconButton-CrBPZidd.js +0 -288
  279. package/dist/MIconButton-CrBPZidd.js.map +0 -1
  280. package/dist/MListItem-h9H223vx.js +0 -1239
  281. package/dist/MListItem-h9H223vx.js.map +0 -1
  282. package/dist/MLoadingIndicator-YTV1Ov5w.js +0 -114
  283. package/dist/MLoadingIndicator-YTV1Ov5w.js.map +0 -1
  284. package/dist/MMenuItem-US0Zbglq.js.map +0 -1
  285. package/dist/MPdfViewer-DL9mRsd2.js.map +0 -1
  286. package/dist/MSeekBar-JFZcoJ8y.js +0 -434
  287. package/dist/MSeekBar-JFZcoJ8y.js.map +0 -1
  288. package/dist/MTextField-B6_iOczK.js.map +0 -1
  289. package/dist/material-color-utilities-CEFytLsr.js.map +0 -1
  290. package/dist/motion-BcejVTeX.js.map +0 -1
  291. package/dist/useLocale-YRaOT12S.js.map +0 -1
  292. package/dist/useThemeTokens-DyAdPQB0.js.map +0 -1
@@ -1,11 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  /**
3
3
  * Registers global keyboard shortcuts for as long as it's mounted, with an optional on-screen overlay listing
4
- * them grouped by category.
4
+ * them grouped by category. A binding is a combination (`mod+k`, `shift+/`) or a sequence of them separated by spaces
5
+ * (`g n`: g, then n within a second, as on GitHub or Gmail).
5
6
  */
6
7
  import { onMounted, onBeforeUnmount } from 'vue'
7
8
 
8
9
  export interface HotkeyBinding {
10
+ /** A combination (`mod+k`) or a sequence separated by spaces (`g n`, `mod+k mod+s`) */
9
11
  keys: string
10
12
  label: string
11
13
  handler: () => void
@@ -44,6 +46,15 @@ function formatKey(raw: string): string {
44
46
  .replace(/arrowright/gi, '→')
45
47
  }
46
48
 
49
+ // Steps of a sequence: spaces separate steps, `+` joins a combination (spaces around a `+` are allowed)
50
+ function parseSteps(keys: string): string[] {
51
+ return keys.trim().replace(/\s*\+\s*/g, '+').split(/\s+/)
52
+ }
53
+ const MODIFIERS = ['ctrl', 'alt', 'shift', 'meta', 'mod']
54
+ const MODIFIER_KEYS = ['Shift', 'Control', 'Alt', 'Meta', 'AltGraph', 'CapsLock']
55
+ // The next step of a sequence has to come within this long
56
+ const SEQUENCE_TIMEOUT = 1000
57
+
47
58
  function parseCombo(keys: string) {
48
59
  return keys.split('+').map(k => k.trim().toLowerCase())
49
60
  }
@@ -66,20 +77,52 @@ function matchesEvent(combo: string[], e: KeyboardEvent): boolean {
66
77
  && e.key.toLowerCase() === key
67
78
  }
68
79
 
80
+ // How many steps of each sequence binding have been typed, and when the last key came
81
+ let progress = new Map<HotkeyBinding, number>()
82
+ let lastKeyAt = 0
83
+
69
84
  function onKeydown(e: KeyboardEvent) {
85
+ // Pressing Shift on its way to `shift+/` isn't a step, nor does it break a sequence
86
+ if (MODIFIER_KEYS.includes(e.key)) return
70
87
  const tag = (e.target as HTMLElement).tagName
71
88
  const editable = tag === 'INPUT' || tag === 'TEXTAREA' || (e.target as HTMLElement).isContentEditable
89
+ const now = Date.now()
90
+ if (now - lastKeyAt > SEQUENCE_TIMEOUT) progress = new Map()
91
+ lastKeyAt = now
72
92
 
93
+ const next = new Map<HotkeyBinding, number>()
94
+ let completed: HotkeyBinding | null = null
95
+ let continued = false
96
+ const singles: HotkeyBinding[] = []
73
97
  for (const binding of props.bindings) {
74
98
  if (binding.disabled) continue
75
- const combo = parseCombo(binding.keys)
76
- const hasModifier = combo.some(k => ['ctrl', 'alt', 'shift', 'meta', 'mod'].includes(k))
77
- if (!hasModifier && editable) continue
78
- if (matchesEvent(combo, e)) {
79
- e.preventDefault()
80
- binding.handler()
81
- return
99
+ const steps = parseSteps(binding.keys).map(parseCombo)
100
+ // A key without a modifier is text in a field: the shortcut doesn't fire there
101
+ if (editable && steps.some(c => !c.some(k => MODIFIERS.includes(k)))) continue
102
+ if (steps.length === 1) {
103
+ if (matchesEvent(steps[0]!, e)) singles.push(binding)
104
+ continue
82
105
  }
106
+ const done = progress.get(binding) ?? 0
107
+ let reached = 0
108
+ if (done > 0 && matchesEvent(steps[done]!, e)) { reached = done + 1; continued = true }
109
+ else if (matchesEvent(steps[0]!, e)) reached = 1
110
+ if (reached === steps.length) completed ??= binding
111
+ else if (reached > 0) next.set(binding, reached)
112
+ }
113
+
114
+ if (completed) {
115
+ progress = new Map()
116
+ e.preventDefault()
117
+ completed.handler()
118
+ return
119
+ }
120
+ progress = next
121
+ // A key that carries a sequence on (the n of `g n`) belongs to it, not to a single-key binding
122
+ if (continued) { e.preventDefault(); return }
123
+ if (singles[0]) {
124
+ e.preventDefault()
125
+ singles[0].handler()
83
126
  }
84
127
  }
85
128
 
@@ -112,14 +155,16 @@ const grouped = () => {
112
155
  :class="b.disabled && 'opacity-38'"
113
156
  >
114
157
  <span class="text-body-medium text-on-surface">{{ b.label }}</span>
115
- <div class="flex items-center gap-0.5">
116
- <kbd
117
- v-for="(k, ki) in b.keys.split('+')"
118
- :key="ki"
119
- class="inline-flex min-w-[24px] items-center justify-center rounded bg-surface-container px-1.5 py-0.5 text-center text-label-small font-medium text-on-surface-variant"
120
- >
121
- {{ formatKey(k.trim()) }}
122
- </kbd>
158
+ <div class="flex items-center gap-2">
159
+ <span v-for="(step, si) in parseSteps(b.keys)" :key="si" class="flex items-center gap-0.5">
160
+ <kbd
161
+ v-for="(k, ki) in step.split('+')"
162
+ :key="ki"
163
+ class="inline-flex min-w-[24px] items-center justify-center rounded bg-surface-container px-1.5 py-0.5 text-center text-label-small font-medium text-on-surface-variant"
164
+ >
165
+ {{ formatKey(k.trim()) }}
166
+ </kbd>
167
+ </span>
123
168
  </div>
124
169
  </div>
125
170
  </div>
@@ -22,9 +22,25 @@ const props = withDefaults(defineProps<{
22
22
  label?: string
23
23
  /** Mirror the glyph in a right-to-left layout. By default, only the directional icons in `MIRRORED_ICONS` are */
24
24
  mirror?: boolean
25
+ /** Stroke weight, the font's `wght` axis: 100 (thin) to 700 (bold); 400 is the default */
26
+ weight?: number
27
+ /** Grade, the `GRAD` axis: -50 (lighter, for light icons on dark) to 200 (heavier, for emphasis); 0 is the default */
28
+ grade?: number
29
+ /** Optical size, the `opsz` axis (20–48): the stroke tuned for that size. Defaults to follow `size` */
30
+ opticalSize?: number
25
31
  }>(), { size: 24, filled: false, mirror: undefined })
26
32
 
27
33
  const mirrored = computed(() => props.mirror ?? MIRRORED_ICONS.has(props.name))
34
+
35
+ // Only the axes that were set: an axis left out keeps the font's own default (and opsz follows the font size)
36
+ const variation = computed(() => {
37
+ const axes: string[] = []
38
+ if (props.filled) axes.push(`'FILL' 1`)
39
+ if (props.weight != null) axes.push(`'wght' ${props.weight}`)
40
+ if (props.grade != null) axes.push(`'GRAD' ${props.grade}`)
41
+ if (props.opticalSize != null) axes.push(`'opsz' ${props.opticalSize}`)
42
+ return axes.length ? axes.join(', ') : undefined
43
+ })
28
44
  </script>
29
45
 
30
46
  <template>
@@ -34,6 +50,6 @@ const mirrored = computed(() => props.mirror ?? MIRRORED_ICONS.has(props.name))
34
50
  :role="label ? 'img' : undefined"
35
51
  :aria-label="label"
36
52
  :aria-hidden="label ? undefined : 'true'"
37
- :style="{ fontSize: `${size}px`, fontVariationSettings: filled ? `'FILL' 1` : undefined }"
53
+ :style="{ fontSize: `${size}px`, fontVariationSettings: variation }"
38
54
  >{{ name }}</span>
39
55
  </template>
@@ -37,6 +37,11 @@ const props = withDefaults(
37
37
  shape?: 'rounded' | 'squared'
38
38
  /** M3's 5-tier icon button sizing (xs:32, sm:40, md:56, lg:96, xl:136), or a custom pixel value */
39
39
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number
40
+ /**
41
+ * M3 Expressive width option (IconButtonDefaults' IconButtonWidthOption): `narrow` and `wide` keep the height and
42
+ * change only the width (sm: 32 / 40 / 52px). Ignored with a numeric size
43
+ */
44
+ width?: 'narrow' | 'default' | 'wide'
40
45
  /** Icon size in px. Default the size tier's (or 55% of a custom pixel `size`) */
41
46
  iconSize?: number
42
47
  /** Disables interaction */
@@ -96,15 +101,28 @@ function paintStyle() {
96
101
  }
97
102
  const tag = computed(() => props.to && !isToggle.value ? 'RouterLink' : 'button')
98
103
 
99
- // Container height/width (icon buttons are always square by default — real
100
- // `IconButtonDefaults.<tier>ContainerSize()` also has Narrow/Wide width options not
101
- // implemented here, matching the existing scope of MButton's size tiers) and icon size
104
+ // Container height/width (square by default; the `width` prop's narrow/wide options are
105
+ // `widthMap` above, from `IconButtonDefaults.<tier>ContainerSize(widthOption)`) and icon size
102
106
  // per M3's 5-tier `{XSmall,Small,Medium,Large,XLarge}IconButtonTokens.kt`. `squareRadius`
103
107
  // matches each tier's own `ContainerShapeSquare` (12px xs/sm, 16px md, 28px lg/xl) — same
104
108
  // pattern as MButton's size tiers.
105
109
  // Toggle radii (px) from the same token files: `square` is ContainerShapeSquare, `pressed`
106
110
  // PressedContainerShape, `checkedRound` SelectedContainerShapeRound (a round button squares off when
107
111
  // checked); SelectedContainerShapeSquare is CornerFull (a square one turns round), i.e. px / 2.
112
+ // Widths of the narrow and wide options: icon size + twice each tier's Narrow/WideLeadingSpace
113
+ // (IconButton{XSmall…XLarge}Tokens: xs 4/10dp, sm 4/14, md 12/24, lg 16/48, xl 32/72)
114
+ const widthMap = {
115
+ xs: { narrow: 28, wide: 40 },
116
+ sm: { narrow: 32, wide: 52 },
117
+ md: { narrow: 48, wide: 72 },
118
+ lg: { narrow: 64, wide: 128 },
119
+ xl: { narrow: 104, wide: 184 },
120
+ }
121
+ const containerWidth = computed(() => {
122
+ if (typeof props.size === 'number' || !props.width || props.width === 'default') return resolved.value.px
123
+ return (widthMap[props.size] ?? widthMap.sm)[props.width]
124
+ })
125
+
108
126
  const sizeMap = {
109
127
  xs: { px: 32, icon: 20, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },
110
128
  sm: { px: 40, icon: 24, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },
@@ -163,10 +181,15 @@ function onClick() {
163
181
  * per-variant Hovered/PressedColor tokens, which are all just the content color at a fixed
164
182
  * opacity (8% hover, 10% focus and press), the same universal state-layer pattern across every variant.
165
183
  */
184
+ // M3's minimum touch target (minimumInteractiveComponentSize, 48dp): on a touch screen (pointer: coarse) an invisible
185
+ // box centered on the button, so the 32px and 40px sizes still take a 48px tap. Not with a mouse: there it would only
186
+ // widen the hover and overlap neighbors in dense toolbars. Needs the button not to clip (no overflow-hidden): the state layer
187
+ // rounds itself instead, and the ripple clips in its own layer.
166
188
  const base =
167
- 'relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150 cursor-pointer ' +
189
+ 'relative inline-flex shrink-0 items-center justify-center transition-colors duration-150 cursor-pointer ' +
190
+ "pointer-coarse:after:content-[''] pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-12 pointer-coarse:after:min-w-12 " +
168
191
  'disabled:cursor-not-allowed disabled:text-on-surface/38 ' +
169
- "before:content-[''] before:pointer-events-none before:absolute before:inset-0 " +
192
+ "before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] " +
170
193
  'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +
171
194
  'enabled:hover:before:opacity-[0.08] enabled:focus-visible:before:opacity-[0.1] enabled:active:before:opacity-[0.1]'
172
195
 
@@ -234,7 +257,7 @@ const variantClasses = computed(() => {
234
257
  :aria-pressed="isToggle ? checked : undefined"
235
258
  :disabled="disabled"
236
259
  :class="[base, shapeClass, variantClasses, disabledContainerClasses]"
237
- :style="[{ width: `${resolved.px}px`, height: `${resolved.px}px` }, colorStyle]"
260
+ :style="[{ width: `${containerWidth}px`, height: `${resolved.px}px` }, colorStyle]"
238
261
  v-ripple="{ disabled, color: rippleColor }"
239
262
  @pointerdown="onPointerDown"
240
263
  @pointerup="onPointerUp"
@@ -458,7 +458,7 @@ defineExpose({ toCanvas, toBlob, rotate: turn, flip: flipX, reset, setAspect })
458
458
  tabindex="0"
459
459
  :aria-label="locale.cropArea"
460
460
  :aria-valuetext="`${Math.round(rect.width)} × ${Math.round(rect.height)}`"
461
- class="absolute cursor-move outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"
461
+ class="absolute cursor-move outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"
462
462
  :class="shape === 'circle' ? 'rounded-full' : ''"
463
463
  :style="{ left: `${frame.left}px`, top: `${frame.top}px`, width: `${frame.width}px`, height: `${frame.height}px`, boxShadow: '0 0 0 9999px rgb(0 0 0 / 0.55)' }"
464
464
  @pointerdown="onDown($event, 'move')"
@@ -29,7 +29,7 @@ export interface KanbanColumn {
29
29
  id: string | number
30
30
  title: string
31
31
  cards: KanbanCard[]
32
- color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
32
+ color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning'
33
33
  /** Optional WIP limit: the header shows count/limit and turns error-colored when exceeded. */
34
34
  limit?: number
35
35
  }
@@ -687,6 +687,7 @@ const dotColor: Record<string, string> = {
687
687
  tertiary: 'bg-tertiary',
688
688
  error: 'bg-error',
689
689
  success: 'bg-success',
690
+ warning: 'bg-warning',
690
691
  }
691
692
 
692
693
  const isLifted = (id: Id) => draggingId.value === id || settlingId.value === id || grabbedId.value === id
@@ -27,10 +27,11 @@
27
27
  * dampingRatio 0.9 / stiffness 700) stepped in one rAF loop that writes transforms directly.
28
28
  */
29
29
  import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
30
+ import { shouldReduceMotion } from '../composables/motion'
30
31
  import { isHydrating } from '../composables/_hydration'
31
32
  import MIconButton from './MIconButton.vue'
32
33
  import MSpinner from './MSpinner.vue'
33
- import { useLocale } from '../composables/useLocale'
34
+ import { useLocale, formatMessage } from '../composables/useLocale'
34
35
  import { useScrollLock } from '../composables/_useScrollLock'
35
36
  import { useEscapeStack } from '../composables/_useEscapeStack'
36
37
 
@@ -130,7 +131,7 @@ const slides = computed(() =>
130
131
  )
131
132
 
132
133
  const positionLabel = computed(() =>
133
- locale.carouselItem.replace('{index}', String(currentIndex.value + 1)).replace('{count}', String(count.value)),
134
+ formatMessage(locale.carouselItem, { index: String(currentIndex.value + 1), count: String(count.value) }, locale.lang),
134
135
  )
135
136
 
136
137
  // ── Springs ───────────────────────────────────────────────────────────────────────────────────
@@ -156,7 +157,7 @@ let onSettled: (() => void) | null = null
156
157
  /** The origin as a transform of the open image: offset, scale, and the crop that gives it the origin's shape. */
157
158
  interface Origin { dx: number; dy: number; s: number; insetX: number; insetY: number; radius: number }
158
159
  let introFrom: Origin | null = null
159
- const reducedMotion = () => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches
160
+ const reducedMotion = () => shouldReduceMotion()
160
161
 
161
162
  function setNow(s: Spring, v: number) {
162
163
  s.pos = v
@@ -905,7 +906,7 @@ defineExpose({ open, close, next, prev })
905
906
  data-lb-thumb
906
907
  class="h-14 w-14 shrink-0 cursor-pointer overflow-hidden rounded-md ring-2 transition-opacity"
907
908
  :class="i === currentIndex ? 'opacity-100 ring-white' : 'opacity-50 ring-transparent hover:opacity-80'"
908
- :aria-label="item.alt || locale.carouselItem.replace('{index}', String(i + 1)).replace('{count}', String(count))"
909
+ :aria-label="item.alt || formatMessage(locale.carouselItem, { index: String(i + 1), count: String(count) }, locale.lang)"
909
910
  :aria-current="i === currentIndex ? 'true' : undefined"
910
911
  @click="go(i)"
911
912
  >
@@ -0,0 +1,136 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * A text link. With `to` it's a vue-router `RouterLink` (or a plain `<a href>` in an app without vue-router); with
4
+ * `href`, always an `<a>`. Links to another site are detected: they get `rel="noopener noreferrer"`, open in a new
5
+ * tab (`newTab` decides), show the `open_in_new` icon and tell screen readers they open a new tab. `download`
6
+ * makes it a download link with its icon; `disabled` keeps the text but turns the link off.
7
+ *
8
+ * @slot default The link text
9
+ * @event click The native click (not emitted while disabled)
10
+ */
11
+ import { computed, getCurrentInstance } from 'vue'
12
+ import MIcon from './MIcon.vue'
13
+ import { useLocale } from '../composables/useLocale'
14
+ import type { ItemLink } from '../composables/_useItemLink'
15
+
16
+ const props = withDefaults(defineProps<{
17
+ /** A vue-router location: a RouterLink with vue-router, an `<a href>` (string only) without it */
18
+ to?: ItemLink
19
+ /** A plain URL, always rendered as `<a href>` */
20
+ href?: string
21
+ /**
22
+ * Whether it leads to another site. Detected from the URL (an absolute `http(s)` URL on another host); set it to
23
+ * override. External links get `rel="noopener noreferrer"` and, by default, a new tab and the `open_in_new` icon
24
+ */
25
+ external?: boolean
26
+ /** Open in a new tab (`target="_blank"`, with `noopener`). Defaults to `true` for external links */
27
+ newTab?: boolean
28
+ /** A file to download: `true`, or the file name to save it as. Shows the `download` icon */
29
+ download?: boolean | string
30
+ /** Leading Material Symbol */
31
+ icon?: string
32
+ /** Trailing Material Symbol; `false` hides the automatic `open_in_new` / `download` one */
33
+ trailingIcon?: string | false
34
+ /** Text color: a color role, or `inherit` to take the surrounding text's color */
35
+ color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'inherit'
36
+ /**
37
+ * `always` (default; links inside running text should be told apart by more than color), `hover`, or `none` for
38
+ * links that are already clearly links (a nav list, a footer)
39
+ */
40
+ underline?: 'always' | 'hover' | 'none'
41
+ /** Shows the text dimmed and turns the link off (no navigation, out of the tab order) */
42
+ disabled?: boolean
43
+ /** With `to` and vue-router: replace the current history entry instead of adding one */
44
+ replace?: boolean
45
+ }>(), {
46
+ external: undefined,
47
+ newTab: undefined,
48
+ download: false,
49
+ trailingIcon: undefined,
50
+ color: 'primary',
51
+ underline: 'always',
52
+ disabled: false,
53
+ replace: false,
54
+ })
55
+
56
+ const emit = defineEmits<{ click: [MouseEvent] }>()
57
+ const t = useLocale()
58
+ const hasRouter = !!getCurrentInstance()?.appContext.components.RouterLink
59
+
60
+ const url = computed(() => props.href ?? (typeof props.to === 'string' ? props.to : undefined))
61
+
62
+ const isExternal = computed(() => {
63
+ if (props.external !== undefined) return props.external
64
+ const u = url.value
65
+ if (!u || !/^(https?:)?\/\//i.test(u)) return false
66
+ if (typeof window === 'undefined') return true
67
+ try { return new URL(u, window.location.href).host !== window.location.host } catch { return false }
68
+ })
69
+ const opensNewTab = computed(() => !props.disabled && (props.newTab ?? isExternal.value))
70
+ const isDownload = computed(() => props.download !== false)
71
+
72
+ const tag = computed(() => {
73
+ if (props.disabled) return 'a'
74
+ if (props.to !== undefined && props.href === undefined && hasRouter && !isExternal.value) return 'RouterLink'
75
+ return 'a'
76
+ })
77
+
78
+ const linkAttrs = computed(() => {
79
+ if (props.disabled) return { role: 'link', 'aria-disabled': 'true', tabindex: -1 }
80
+ if (tag.value === 'RouterLink') {
81
+ return { to: props.to, replace: props.replace || undefined, target: opensNewTab.value ? '_blank' : undefined }
82
+ }
83
+ const rel = [isExternal.value && 'noopener noreferrer', !isExternal.value && opensNewTab.value && 'noopener']
84
+ .filter(Boolean).join(' ')
85
+ return {
86
+ href: url.value,
87
+ target: opensNewTab.value ? '_blank' : undefined,
88
+ rel: rel || undefined,
89
+ download: isDownload.value ? (typeof props.download === 'string' ? props.download : '') : undefined,
90
+ }
91
+ })
92
+
93
+ const trailing = computed(() => {
94
+ if (props.trailingIcon === false) return undefined
95
+ if (props.trailingIcon) return props.trailingIcon
96
+ if (isDownload.value) return 'download'
97
+ if (isExternal.value && opensNewTab.value) return 'open_in_new'
98
+ return undefined
99
+ })
100
+
101
+ const colorClass: Record<string, string> = {
102
+ primary: 'text-primary decoration-primary/60',
103
+ secondary: 'text-secondary decoration-secondary/60',
104
+ tertiary: 'text-tertiary decoration-tertiary/60',
105
+ error: 'text-error decoration-error/60',
106
+ inherit: 'text-inherit decoration-current/60',
107
+ }
108
+ const underlineClass: Record<string, string> = {
109
+ always: 'underline hover:decoration-current',
110
+ hover: 'no-underline hover:underline',
111
+ none: 'no-underline',
112
+ }
113
+
114
+ function onClick(e: MouseEvent) {
115
+ if (props.disabled) {
116
+ e.preventDefault()
117
+ return
118
+ }
119
+ emit('click', e)
120
+ }
121
+ </script>
122
+
123
+ <template>
124
+ <component
125
+ :is="tag"
126
+ v-bind="linkAttrs"
127
+ class="m3-link rounded-[2px] underline-offset-[0.2em] decoration-[0.08em] transition-colors duration-150 outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-secondary"
128
+ :class="disabled ? 'cursor-not-allowed text-on-surface/38 no-underline' : [colorClass[color], underlineClass[underline], 'cursor-pointer']"
129
+ @click="onClick"
130
+ >
131
+ <MIcon v-if="icon" :name="icon" aria-hidden="true" class="me-[0.2em] align-[-0.2em] !text-[1.15em]" />
132
+ <slot />
133
+ <MIcon v-if="trailing" :name="trailing" aria-hidden="true" class="ms-[0.15em] align-[-0.12em] !text-[1em]" />
134
+ <span v-if="opensNewTab" class="sr-only">({{ t.opensInNewTab }})</span>
135
+ </component>
136
+ </template>
@@ -191,4 +191,11 @@ const detailHidden = computed(() => (!twoPane.value && (!props.showDetail || ext
191
191
  transition: visibility 0s;
192
192
  }
193
193
  }
194
+ /* createM3UI({ reducedMotion: 'always' }) */
195
+ :root[data-m3-motion='reduce'] .m3-ld-pane,
196
+ :root[data-m3-motion='reduce'] .m3-ld-list-hidden,
197
+ :root[data-m3-motion='reduce'] .m3-ld-detail-hidden {
198
+ transition: visibility 0s;
199
+ }
200
+
194
201
  </style>
@@ -46,10 +46,12 @@ const props = withDefaults(
46
46
  leading?: ListItemLeading
47
47
  /** Name for the avatar (when leading='avatar') */
48
48
  avatarName?: string
49
+ /** Photo for the avatar (when leading='avatar'); the initials of `avatarName` show while it's missing or broken */
50
+ avatarSrc?: string
49
51
  /** Image URL (when leading='image') */
50
52
  image?: string
51
53
  /** Icon container background color (when leading='icon-container') */
52
- iconContainerColor?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
54
+ iconContainerColor?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning'
53
55
  /** Trailing icon name */
54
56
  trailingIcon?: string
55
57
  /** Trailing text label */
@@ -170,7 +172,7 @@ const isActive = computed(() => {
170
172
  const resolvedLeading = computed(() => {
171
173
  if (props.leading) return props.leading
172
174
  if (props.icon) return 'icon'
173
- if (props.avatarName) return 'avatar'
175
+ if (props.avatarName || props.avatarSrc) return 'avatar'
174
176
  if (props.image) return 'image'
175
177
  return null
176
178
  })
@@ -189,6 +191,7 @@ const iconContainerClasses: Record<string, string> = {
189
191
  tertiary: 'bg-tertiary-container text-on-tertiary-container',
190
192
  error: 'bg-error-container text-on-error-container',
191
193
  success: 'bg-success-container text-on-success-container',
194
+ warning: 'bg-warning-container text-on-warning-container',
192
195
  }
193
196
 
194
197
  const isDense = computed(() => list?.dense.value ?? false)
@@ -485,7 +488,7 @@ function handleTrailingToggle() {
485
488
  >
486
489
  <MIcon :name="icon!" :size="24" />
487
490
  </div>
488
- <MAvatar v-else-if="resolvedLeading === 'avatar'" :name="avatarName!" :size="40" class="shrink-0" />
491
+ <MAvatar v-else-if="resolvedLeading === 'avatar'" :name="avatarName" :src="avatarSrc" :size="40" class="shrink-0" />
489
492
  <img v-else-if="resolvedLeading === 'image'" :src="image" alt="" class="h-14 w-14 shrink-0 rounded-md object-cover">
490
493
  <MCheckbox v-else-if="resolvedLeading === 'checkbox'" :model-value="isChecked" class="shrink-0" data-mli-part />
491
494
  </slot>
@@ -503,7 +506,7 @@ function handleTrailingToggle() {
503
506
  </div>
504
507
  </template>
505
508
  <template v-else-if="resolvedLeading === 'avatar'">
506
- <MAvatar :name="avatarName!" :size="40" class="shrink-0" />
509
+ <MAvatar :name="avatarName" :src="avatarSrc" :size="40" class="shrink-0" />
507
510
  </template>
508
511
  <template v-else-if="resolvedLeading === 'image'">
509
512
  <img :src="image" alt="" class="h-14 w-14 shrink-0 rounded-md object-cover">
@@ -5,6 +5,7 @@
5
5
  * contained (circle-backed) variant.
6
6
  */
7
7
  import { computed, onMounted, onUnmounted, ref } from "vue";
8
+ import { shouldReduceMotion } from '../composables/motion';
8
9
  import { useLocale } from '../composables/useLocale';
9
10
 
10
11
  const props = withDefaults(
@@ -177,7 +178,7 @@ function tick(now: number) {
177
178
  }
178
179
 
179
180
  onMounted(() => {
180
- prefersReducedMotion.value = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
181
+ prefersReducedMotion.value = shouldReduceMotion();
181
182
  pathEl.value?.setAttribute("d", buildPath(shapes[0]!, shapes[0]!, 0));
182
183
  rafId = requestAnimationFrame(tick);
183
184
  });
@@ -449,6 +449,9 @@ defineExpose({
449
449
  @media (prefers-reduced-motion: reduce) {
450
450
  .m3-map .m3-map-control-panel-in { animation: none; }
451
451
  }
452
+ /* createM3UI({ reducedMotion: 'always' }) */
453
+ :root[data-m3-motion='reduce'] .m3-map .m3-map-control-panel-in { animation: none; }
454
+
452
455
  .m3-map .maplibregl-ctrl-group button {
453
456
  width: 40px;
454
457
  height: 40px;
@@ -13,7 +13,7 @@
13
13
  import { computed, onBeforeUnmount, shallowRef, useId, watch } from 'vue'
14
14
  import type * as Maplibre from 'maplibre-gl'
15
15
  import { useMap } from '../composables/useMap'
16
- import { useLocale } from '../composables/useLocale'
16
+ import { useLocale, formatMessage } from '../composables/useLocale'
17
17
  import { useThemeTokens } from '../composables/useThemeTokens'
18
18
  import type { MapGeoJsonLayer } from './MMapGeoJson.vue'
19
19
 
@@ -242,7 +242,7 @@ function onBubbleClick(b: Bubble) {
242
242
  if (props.zoomOnClick) void b.zoomIn()
243
243
  }
244
244
 
245
- const labelOf = (count: number) => locale.mapClusterZoom.replace('{count}', String(count))
245
+ const labelOf = (count: number) => formatMessage(locale.mapClusterZoom, { count: String(count) }, locale.lang)
246
246
 
247
247
  onBeforeUnmount(() => {
248
248
  if (frame) cancelAnimationFrame(frame)
@@ -14,7 +14,7 @@
14
14
  import { computed, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue'
15
15
  import type * as Maplibre from 'maplibre-gl'
16
16
  import { useMap } from '../composables/useMap'
17
- import { motionSprings } from '../composables/motion'
17
+ import { appSprings } from '../composables/motion'
18
18
  import { playSamples, prefersReducedMotion, sampleAt, sampleSpring } from '../composables/_springAnimation'
19
19
  import type { MapControlPosition } from './MMap.vue'
20
20
 
@@ -89,7 +89,7 @@ function onResize() {
89
89
  function grow(node: HTMLElement, a: { w: number; h: number }, b: { w: number; h: number }) {
90
90
  from = a
91
91
  to = b
92
- samples = sampleSpring(0, 1, 0, motionSprings.standard.defaultSpatial, 0.002)
92
+ samples = sampleSpring(0, 1, 0, appSprings().defaultSpatial, 0.002)
93
93
  node.style.overflow = 'hidden'
94
94
  const lerp = (p: number) => ({ width: `${a.w + (b.w - a.w) * p}px`, height: `${a.h + (b.h - a.h) * p}px` })
95
95
  anim = playSamples(node, samples, lerp)
@@ -441,7 +441,7 @@ defineExpose({ start, finish, clear, remove })
441
441
  <button
442
442
  v-if="label.m !== undefined"
443
443
  type="button"
444
- class="pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/12 focus-visible:outline-2 focus-visible:outline-on-primary"
444
+ class="pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/8 focus-visible:outline-2 focus-visible:outline-on-primary"
445
445
  :aria-label="t.mapDeleteMeasurement"
446
446
  v-tooltip="t.mapDeleteMeasurement"
447
447
  @click.stop="remove(label.m)"
@@ -2,6 +2,9 @@
2
2
  /**
3
3
  * A text field with a formatting mask — built-in presets or a custom pattern where `#` stands for a digit.
4
4
  *
5
+ * Your `class`, `style` and `data-*` go on the field's box; every other attribute (`id`, `inputmode`, `enterkeyhint`,
6
+ * `maxlength`, `readonly`, `aria-*`, native listeners like `@keydown`) goes on the `<input>`.
7
+ *
5
8
  * @event update:modelValue Emitted on every keystroke — powers v-model
6
9
  * @event debounced Emitted debounce ms after the user stops typing (only when debounce > 0)
7
10
  */
@@ -9,6 +12,7 @@ import { computed, ref, useId, watch } from 'vue'
9
12
  import { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'
10
13
  import type { ValidateOn, ValidationRule } from '../composables/validation'
11
14
  import MIcon from './MIcon.vue'
15
+ import { useSplitAttrs } from '../composables/_splitAttrs'
12
16
  import { useFieldBg } from '../composables/useFieldBg'
13
17
  import { useDebounce } from '../composables/useDebounce'
14
18
  import { useLocale } from '../composables/useLocale'
@@ -27,6 +31,8 @@ const PRESETS: Record<MaskPreset, string> = {
27
31
  zip: '#####-####',
28
32
  }
29
33
 
34
+ defineOptions({ inheritAttrs: false })
35
+
30
36
  const props = withDefaults(
31
37
  defineProps<{
32
38
  /** Masked value (v-model) */
@@ -101,7 +107,13 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
101
107
  emit('blur')
102
108
  })
103
109
 
104
- const id = useId()
110
+ const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
111
+ const autoId = useId()
112
+ const id = computed(() => attrId() ?? autoId)
113
+ // Ours (the message below the field) plus any the consumer passed
114
+ function describedBy() {
115
+ return [errorMessage.value || props.hint ? messageId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined
116
+ }
105
117
  const fieldBgEl = ref<HTMLElement | null>(null)
106
118
  const { resolvedFieldBg } = useFieldBg(fieldBgEl, () => props.fieldBg)
107
119
  const inputEl = ref<HTMLInputElement | null>(null)
@@ -228,7 +240,7 @@ defineExpose({
228
240
  </script>
229
241
 
230
242
  <template>
231
- <div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut">
243
+ <div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut" v-bind="rootAttrs()">
232
244
  <div
233
245
  ref="fieldBgEl"
234
246
  class="relative"
@@ -249,8 +261,9 @@ defineExpose({
249
261
  <input
250
262
  :id="id"
251
263
  ref="inputEl"
264
+ v-bind="inputAttrs()"
252
265
  :aria-invalid="hasError || undefined"
253
- :aria-describedby="errorMessage || hint ? messageId : undefined"
266
+ :aria-describedby="describedBy()"
254
267
  type="text"
255
268
  inputmode="numeric"
256
269
  :value="modelValue"