@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,577 +0,0 @@
1
- import { t as e } from "./MButton-B9RCM06i.js";
2
- import { t } from "./MDialog-dk07tify.js";
3
- import { t as n } from "./MIcon-BSsJZhK7.js";
4
- import { t as r } from "./vTooltip-xESB2YOb.js";
5
- import { t as i } from "./MIconButton-CrBPZidd.js";
6
- import { i as a } from "./useLocale-YRaOT12S.js";
7
- import { i as o, o as s } from "./_storageKeys-C4W_4xK4.js";
8
- import { t as c } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
9
- import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, normalizeClass as v, normalizeStyle as y, onMounted as ee, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, watch as te, withCtx as T, withDirectives as ne, withKeys as re } from "vue";
10
- // src/composables/_colorUtils.ts
11
- function E(e) {
12
- let t = e.trim().replace(/^#/, "");
13
- if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
14
- t.length <= 4 && (t = [...t].map((e) => e + e).join(""));
15
- let n = (e) => parseInt(t.substring(e, e + 2), 16);
16
- return {
17
- r: n(0),
18
- g: n(2),
19
- b: n(4),
20
- a: t.length === 8 ? n(6) / 255 : 1
21
- };
22
- }
23
- function D({ r: e, g: t, b: n, a: r }) {
24
- let i = (e) => Math.round(Math.max(0, Math.min(255, e))).toString(16).padStart(2, "0");
25
- return `#${i(e)}${i(t)}${i(n)}${r < 1 ? i(r * 255) : ""}`;
26
- }
27
- function O(e) {
28
- let t = E(e);
29
- return t ? D(t) : "";
30
- }
31
- function ie({ r: e, g: t, b: n }) {
32
- e /= 255, t /= 255, n /= 255;
33
- let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
34
- return i !== 0 && (a = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a *= 60), {
35
- h: a,
36
- s: r === 0 ? 0 : i / r * 100,
37
- v: r * 100
38
- };
39
- }
40
- function k({ h: e, s: t, v: n }, r = 1) {
41
- t /= 100, n /= 100;
42
- let i = (r) => {
43
- let i = (r + e / 60) % 6;
44
- return (n - n * t * Math.max(0, Math.min(i, 4 - i, 1))) * 255;
45
- };
46
- return {
47
- r: i(5),
48
- g: i(3),
49
- b: i(1),
50
- a: r
51
- };
52
- }
53
- function ae({ h: e, s: t, v: n }) {
54
- t /= 100, n /= 100;
55
- let r = n * (1 - t / 2);
56
- return {
57
- h: e,
58
- s: (r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r)) * 100,
59
- l: r * 100
60
- };
61
- }
62
- function oe({ h: e, s: t, l: n }) {
63
- t /= 100, n /= 100;
64
- let r = n + t * Math.min(n, 1 - n);
65
- return {
66
- h: e,
67
- s: r === 0 ? 0 : 2 * (1 - n / r) * 100,
68
- v: r * 100
69
- };
70
- }
71
- function A(e) {
72
- let t = E(e);
73
- if (!t) return "#000000";
74
- let n = (e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
75
- return .2126 * n(t.r) + .7152 * n(t.g) + .0722 * n(t.b) > .179 ? "#000000" : "#ffffff";
76
- }
77
- var j = "m3-color-recent";
78
- function M() {
79
- try {
80
- let e = JSON.parse(localStorage.getItem(s(j)) ?? "[]");
81
- return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!E(e)) : [];
82
- } catch {
83
- return [];
84
- }
85
- }
86
- var N = x(M());
87
- o(() => {
88
- N.value = M();
89
- });
90
- function P(e, t) {
91
- let n = O(e);
92
- if (n) {
93
- N.value = [n, ...N.value.filter((e) => e !== n)].slice(0, Math.max(t, 0));
94
- try {
95
- localStorage.setItem(s(j), JSON.stringify(N.value));
96
- } catch {}
97
- }
98
- }
99
- var F = [
100
- "#f44336",
101
- "#e91e63",
102
- "#9c27b0",
103
- "#673ab7",
104
- "#3f51b5",
105
- "#2196f3",
106
- "#03a9f4",
107
- "#00bcd4",
108
- "#009688",
109
- "#4caf50",
110
- "#8bc34a",
111
- "#cddc39",
112
- "#ffeb3b",
113
- "#ffc107",
114
- "#ff9800",
115
- "#ff5722",
116
- "#795548",
117
- "#607d8b",
118
- "#9e9e9e",
119
- "#000000",
120
- "#ffffff"
121
- ], se = { class: "flex flex-col gap-4" }, ce = [
122
- "aria-label",
123
- "aria-valuenow",
124
- "aria-valuetext"
125
- ], le = { class: "flex flex-col gap-1" }, ue = ["aria-label", "aria-valuenow"], de = [
126
- "aria-label",
127
- "aria-valuenow",
128
- "aria-valuetext"
129
- ], fe = { class: "flex items-center gap-2" }, pe = { class: "flex h-10 min-w-0 flex-1" }, me = ["aria-label"], he = { class: "flex items-start gap-2" }, ge = ["aria-label"], _e = ["maxlength", "value"], ve = [
130
- "aria-label",
131
- "value",
132
- "onInput",
133
- "onKeydown"
134
- ], ye = { class: "text-label-small text-on-surface-variant" }, be = ["aria-label"], xe = {
135
- key: 0,
136
- class: "text-label-medium text-on-surface-variant"
137
- }, Se = { class: "grid grid-cols-7 gap-2" }, Ce = [
138
- "aria-label",
139
- "aria-pressed",
140
- "onClick"
141
- ], I = 12, we = "repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px", L = /*#__PURE__*/ c(/* @__PURE__ */ _({
142
- __name: "_MColorPanel",
143
- props: {
144
- modelValue: {},
145
- presets: {},
146
- alpha: { type: Boolean },
147
- recent: { type: Boolean },
148
- eyedropper: { type: Boolean },
149
- original: {}
150
- },
151
- emits: ["update:modelValue"],
152
- setup(e, { expose: t, emit: o }) {
153
- let s = e, c = o, _ = a(), T = x(0), j = x(100), M = x(100), P = x(1), F = u(() => D(k({
154
- h: T.value,
155
- s: j.value,
156
- v: M.value
157
- }, s.alpha ? P.value : 1))), L = u(() => D(k({
158
- h: T.value,
159
- s: j.value,
160
- v: M.value
161
- }))), Te = u(() => `hsl(${T.value}, 100%, 50%)`);
162
- function R(e) {
163
- let t = ie(e);
164
- t.v > 0 && t.s > 0 && (T.value = t.h), t.v > 0 && (j.value = t.s), M.value = t.v, P.value = s.alpha ? e.a : 1;
165
- }
166
- let z = "";
167
- function B() {
168
- z = F.value, F.value !== O(s.modelValue) && c("update:modelValue", F.value);
169
- }
170
- te(() => s.modelValue, (e) => {
171
- let t = O(e);
172
- t && t !== z && (R(E(t)), z = t);
173
- }, { immediate: !0 });
174
- function Ee(e) {
175
- let t = E(e);
176
- t && (R(t), B());
177
- }
178
- let V = x(), De = x(), Oe = x(), H = x(null), U = (e, t, n) => Math.min(n, Math.max(t, e));
179
- function ke(e, t) {
180
- let n = e === "area" ? V.value : e === "hue" ? De.value : Oe.value;
181
- if (!n) return;
182
- let r = n.getBoundingClientRect();
183
- if (e === "area") j.value = U((t.clientX - r.left) / r.width * 100, 0, 100), M.value = U((1 - (t.clientY - r.top) / r.height) * 100, 0, 100);
184
- else {
185
- let n = U((t.clientX - r.left - I) / (r.width - 24), 0, 1);
186
- e === "hue" ? T.value = n * 360 : P.value = Math.round(n * 100) / 100;
187
- }
188
- B();
189
- }
190
- function W(e, t) {
191
- t.button === 0 && (t.preventDefault(), t.currentTarget.focus({ preventScroll: !0 }), t.currentTarget.setPointerCapture?.(t.pointerId), H.value = e, ke(e, t));
192
- }
193
- function G(e, t) {
194
- H.value === e && ke(e, t);
195
- }
196
- function K() {
197
- H.value = null;
198
- }
199
- function q(e, t) {
200
- let n = t.shiftKey ? 10 : 1, r = t.key === "ArrowRight" ? n : t.key === "ArrowLeft" ? -n : 0, i = t.key === "ArrowUp" ? n : t.key === "ArrowDown" ? -n : 0;
201
- if (e === "area") {
202
- if (!r && !i) return;
203
- j.value = U(j.value + r, 0, 100), M.value = U(M.value + i, 0, 100);
204
- } else {
205
- let n = e === "hue" ? 360 : 100, a = e === "hue" ? T.value : P.value * 100, o;
206
- if (t.key === "Home") o = 0;
207
- else if (t.key === "End") o = n;
208
- else if (r || i) o = U(a + (r || i), 0, n);
209
- else return;
210
- e === "hue" ? T.value = o : P.value = Math.round(o) / 100;
211
- }
212
- t.preventDefault(), B();
213
- }
214
- let Ae = x(!1);
215
- ee(() => {
216
- Ae.value = "EyeDropper" in window;
217
- });
218
- async function je() {
219
- try {
220
- let e = window.EyeDropper, { sRGBHex: t } = await new e().open(), n = E(t);
221
- n && (R({
222
- ...n,
223
- a: P.value
224
- }), B());
225
- } catch {}
226
- }
227
- let J = [
228
- {
229
- id: "hex",
230
- label: "HEX"
231
- },
232
- {
233
- id: "rgb",
234
- label: "RGB"
235
- },
236
- {
237
- id: "hsl",
238
- label: "HSL"
239
- }
240
- ], Y = x("hex"), Me = u(() => J.find((e) => e.id === Y.value).label);
241
- function Ne() {
242
- Y.value = J[(J.findIndex((e) => e.id === Y.value) + 1) % J.length].id, X.value = null;
243
- }
244
- function Pe(e) {
245
- T.value = e.h, j.value = e.s, M.value = e.v;
246
- }
247
- let Fe = u(() => ({
248
- key: "a",
249
- label: "A",
250
- display: String(Math.round(P.value * 100)),
251
- max: 100,
252
- apply: (e) => {
253
- P.value = e / 100;
254
- }
255
- })), Ie = u(() => {
256
- let e = [];
257
- if (Y.value === "rgb") {
258
- let t = k({
259
- h: T.value,
260
- s: j.value,
261
- v: M.value
262
- }), n = {
263
- r: Math.round(t.r),
264
- g: Math.round(t.g),
265
- b: Math.round(t.b),
266
- a: P.value
267
- };
268
- for (let t of [
269
- "r",
270
- "g",
271
- "b"
272
- ]) e.push({
273
- key: t,
274
- label: t.toUpperCase(),
275
- display: String(n[t]),
276
- max: 255,
277
- apply: (e) => R({
278
- ...n,
279
- [t]: e
280
- })
281
- });
282
- } else if (Y.value === "hsl") {
283
- let t = ae({
284
- h: T.value,
285
- s: j.value,
286
- v: M.value
287
- }), n = {
288
- h: Math.round(t.h),
289
- s: Math.round(t.s),
290
- l: Math.round(t.l)
291
- };
292
- for (let t of [
293
- "h",
294
- "s",
295
- "l"
296
- ]) e.push({
297
- key: t,
298
- label: t.toUpperCase(),
299
- display: String(n[t]),
300
- max: t === "h" ? 360 : 100,
301
- apply: (e) => Pe(oe({
302
- ...n,
303
- [t]: e
304
- }))
305
- });
306
- }
307
- return s.alpha && Y.value !== "hex" && e.push(Fe.value), e;
308
- }), X = x(null), Z = (e, t) => X.value?.key === e ? X.value.text : t;
309
- function Le(e) {
310
- let t = e.target.value;
311
- X.value = {
312
- key: "hex",
313
- text: t
314
- };
315
- let n = E(t);
316
- n && (R(n), B());
317
- }
318
- function Re(e, t) {
319
- let n = t.target.value;
320
- if (X.value = {
321
- key: e.key,
322
- text: n
323
- }, !/^\d+$/.test(n.trim())) return;
324
- let r = Number(n);
325
- r > e.max || (e.apply(r), B());
326
- }
327
- function ze(e, t) {
328
- if (t.key === "Enter") {
329
- X.value = null;
330
- return;
331
- }
332
- if (t.key !== "ArrowUp" && t.key !== "ArrowDown") return;
333
- t.preventDefault();
334
- let n = (t.shiftKey ? 10 : 1) * (t.key === "ArrowUp" ? 1 : -1);
335
- e.apply(U(Number(e.display) + n, 0, e.max)), X.value = null, B();
336
- }
337
- let Be = u(() => s.recent ? N.value : []), Q = (e) => O(e) === F.value, $ = (e) => `linear-gradient(${e}, ${e}), ${we}`, Ve = u(() => P.value < .5 ? "#000000" : A(L.value)), He = u(() => !!s.original && !!O(s.original) && O(s.original) !== F.value);
338
- return t({ focus: () => V.value?.focus({ preventScroll: !0 }) }), (t, a) => (b(), p("div", se, [
339
- m("div", {
340
- ref_key: "areaEl",
341
- ref: V,
342
- role: "slider",
343
- tabindex: "0",
344
- "aria-label": `${w(_).colorSaturation}, ${w(_).colorBrightness}`,
345
- "aria-valuenow": Math.round(j.value),
346
- "aria-valuemin": "0",
347
- "aria-valuemax": "100",
348
- "aria-valuetext": `${w(_).colorSaturation} ${Math.round(j.value)}%, ${w(_).colorBrightness} ${Math.round(M.value)}%`,
349
- class: "relative h-40 w-full shrink-0 cursor-crosshair touch-none rounded-md outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
350
- style: y({ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${Te.value})` }),
351
- onPointerdown: a[0] ||= (e) => W("area", e),
352
- onPointermove: a[1] ||= (e) => G("area", e),
353
- onPointerup: K,
354
- onPointercancel: K,
355
- onKeydown: a[2] ||= (e) => q("area", e)
356
- }, [m("span", {
357
- class: v(["m3-cp-area-thumb pointer-events-none absolute size-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white transition-[scale] duration-150", H.value === "area" ? "scale-125" : ""]),
358
- style: y({
359
- left: `${j.value}%`,
360
- top: `${100 - M.value}%`,
361
- backgroundColor: L.value
362
- })
363
- }, null, 6)], 44, ce),
364
- m("div", le, [m("div", {
365
- ref_key: "hueEl",
366
- ref: De,
367
- role: "slider",
368
- tabindex: "0",
369
- "aria-label": w(_).colorHue,
370
- "aria-valuenow": Math.round(T.value),
371
- "aria-valuemin": "0",
372
- "aria-valuemax": "360",
373
- class: "m3-cp-slider group",
374
- onPointerdown: a[3] ||= (e) => W("hue", e),
375
- onPointermove: a[4] ||= (e) => G("hue", e),
376
- onPointerup: K,
377
- onPointercancel: K,
378
- onKeydown: a[5] ||= (e) => q("hue", e)
379
- }, [a[13] ||= m("span", { class: "m3-cp-track m3-cp-hue" }, null, -1), m("span", {
380
- class: v(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "hue" }]),
381
- style: y({ left: `calc(${I}px + ${T.value / 360} * (100% - 24px))` })
382
- }, null, 6)], 40, ue), e.alpha ? (b(), p("div", {
383
- key: 0,
384
- ref_key: "alphaEl",
385
- ref: Oe,
386
- role: "slider",
387
- tabindex: "0",
388
- "aria-label": w(_).colorAlpha,
389
- "aria-valuenow": Math.round(P.value * 100),
390
- "aria-valuemin": "0",
391
- "aria-valuemax": "100",
392
- "aria-valuetext": `${Math.round(P.value * 100)}%`,
393
- class: "m3-cp-slider group",
394
- onPointerdown: a[6] ||= (e) => W("alpha", e),
395
- onPointermove: a[7] ||= (e) => G("alpha", e),
396
- onPointerup: K,
397
- onPointercancel: K,
398
- onKeydown: a[8] ||= (e) => q("alpha", e)
399
- }, [m("span", {
400
- class: "m3-cp-track",
401
- style: y({ background: `linear-gradient(to right, transparent, ${L.value}), ${we}` })
402
- }, null, 4), m("span", {
403
- class: v(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "alpha" }]),
404
- style: y({ left: `calc(${I}px + ${P.value} * (100% - 24px))` })
405
- }, null, 6)], 40, de)) : f("", !0)]),
406
- m("div", fe, [m("div", pe, [He.value ? ne((b(), p("button", {
407
- key: 0,
408
- type: "button",
409
- class: "m3-cp-swatch flex w-12 shrink-0 cursor-pointer items-center justify-center rounded-s-full outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
410
- style: y({ background: $(e.original) }),
411
- "aria-label": w(_).colorOriginal,
412
- onClick: a[9] ||= (t) => Ee(e.original)
413
- }, [g(n, {
414
- name: "undo",
415
- size: 18,
416
- style: y({ color: w(A)(e.original) })
417
- }, null, 8, ["style"])], 12, me)), [[w(r), w(_).colorOriginal]]) : f("", !0), m("span", {
418
- class: v(["m3-cp-swatch flex min-w-0 flex-1 items-center px-4 font-mono text-label-large transition-[border-radius] duration-200", He.value ? "rounded-e-full" : "rounded-full"]),
419
- style: y({
420
- background: $(F.value),
421
- color: Ve.value
422
- })
423
- }, C(F.value), 7)]), e.eyedropper && Ae.value ? (b(), d(i, {
424
- key: 0,
425
- icon: "colorize",
426
- variant: "tonal",
427
- label: w(_).colorEyedropper,
428
- onClick: je
429
- }, null, 8, ["label"])) : f("", !0)]),
430
- m("div", he, [
431
- m("button", {
432
- type: "button",
433
- class: "flex h-10 shrink-0 cursor-pointer items-center gap-0.5 rounded-full bg-secondary-container pe-2 ps-3 text-label-large text-on-secondary-container outline-none transition-[background-color] duration-150 hover:bg-[color-mix(in_srgb,var(--color-secondary-container),var(--color-on-secondary-container)_8%)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
434
- "aria-label": `${w(_).colorFormat}: ${Me.value}`,
435
- onClick: Ne
436
- }, [h(C(Me.value) + " ", 1), g(n, {
437
- name: "unfold_more",
438
- size: 18
439
- })], 8, ge),
440
- Y.value === "hex" ? (b(), p("input", {
441
- key: 0,
442
- type: "text",
443
- spellcheck: "false",
444
- autocomplete: "off",
445
- maxlength: e.alpha ? 9 : 7,
446
- "aria-label": "HEX",
447
- value: Z("hex", F.value),
448
- class: "m3-cp-field min-w-0 flex-1 font-mono text-body-medium",
449
- onInput: Le,
450
- onBlur: a[10] ||= (e) => X.value = null,
451
- onKeydown: a[11] ||= re((e) => X.value = null, ["enter"])
452
- }, null, 40, _e)) : f("", !0),
453
- (b(!0), p(l, null, S(Ie.value, (e) => (b(), p("label", {
454
- key: e.key,
455
- class: "flex min-w-0 flex-1 flex-col items-center gap-1"
456
- }, [m("input", {
457
- type: "text",
458
- inputmode: "numeric",
459
- autocomplete: "off",
460
- maxlength: 3,
461
- "aria-label": e.label,
462
- value: Z(e.key, e.display),
463
- class: "m3-cp-field w-full font-mono text-body-medium",
464
- onInput: (t) => Re(e, t),
465
- onKeydown: (t) => ze(e, t),
466
- onBlur: a[12] ||= (e) => X.value = null
467
- }, null, 40, ve), m("span", ye, C(e.label), 1)]))), 128))
468
- ]),
469
- (b(!0), p(l, null, S([{
470
- id: "recent",
471
- label: w(_).colorRecent,
472
- colors: Be.value
473
- }, {
474
- id: "presets",
475
- label: w(_).colorPresets,
476
- colors: e.presets
477
- }], (e) => (b(), p(l, { key: e.id }, [e.colors.length ? (b(), p("div", {
478
- key: 0,
479
- role: "group",
480
- "aria-label": e.label,
481
- class: "flex flex-col gap-2"
482
- }, [Be.value.length ? (b(), p("span", xe, C(e.label), 1)) : f("", !0), m("div", Se, [(b(!0), p(l, null, S(e.colors, (e) => (b(), p("button", {
483
- key: e,
484
- type: "button",
485
- class: v(["m3-cp-swatch m3-cp-morph flex aspect-square cursor-pointer items-center justify-center outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", { "m3-cp-morph-selected": Q(e) }]),
486
- style: y({ background: $(e) }),
487
- "aria-label": e,
488
- "aria-pressed": Q(e),
489
- onClick: (t) => Ee(e)
490
- }, [Q(e) ? (b(), d(n, {
491
- key: 0,
492
- name: "check",
493
- size: 18,
494
- style: y({ color: w(A)(e) })
495
- }, null, 8, ["style"])) : f("", !0)], 14, Ce))), 128))])], 8, be)) : f("", !0)], 64))), 128))
496
- ]));
497
- }
498
- }), [["__scopeId", "data-v-59fe716a"]]), Te = /* @__PURE__ */ _({
499
- __name: "MColorPickerModal",
500
- props: {
501
- modelValue: {},
502
- show: {
503
- type: Boolean,
504
- default: !1
505
- },
506
- presets: { default: () => F },
507
- title: {},
508
- alpha: {
509
- type: Boolean,
510
- default: !1
511
- },
512
- recent: {
513
- type: Boolean,
514
- default: !0
515
- },
516
- recentLimit: { default: 7 },
517
- eyedropper: {
518
- type: Boolean,
519
- default: !0
520
- }
521
- },
522
- emits: ["update:modelValue", "update:show"],
523
- setup(n, { emit: r }) {
524
- let i = n, o = a(), s = r, c = x(i.modelValue);
525
- te(() => i.show, (e) => {
526
- e && (c.value = i.modelValue);
527
- }, { immediate: !0 });
528
- function l() {
529
- s("update:show", !1);
530
- }
531
- function u() {
532
- let e = O(c.value) || c.value;
533
- i.recent && P(e, i.recentLimit), s("update:modelValue", e), s("update:show", !1);
534
- }
535
- return (r, i) => (b(), d(t, {
536
- "model-value": n.show,
537
- title: n.title || w(o).selectColor,
538
- "max-width": "328px",
539
- closable: !1,
540
- "onUpdate:modelValue": i[1] ||= (e) => !e && l()
541
- }, {
542
- actions: T(() => [g(e, {
543
- variant: "text",
544
- onClick: l
545
- }, {
546
- default: T(() => [h(C(w(o).cancel), 1)]),
547
- _: 1
548
- }), g(e, {
549
- variant: "text",
550
- onClick: u
551
- }, {
552
- default: T(() => [h(C(w(o).confirm), 1)]),
553
- _: 1
554
- })]),
555
- default: T(() => [g(L, {
556
- modelValue: c.value,
557
- "onUpdate:modelValue": i[0] ||= (e) => c.value = e,
558
- presets: n.presets,
559
- alpha: n.alpha,
560
- recent: n.recent,
561
- eyedropper: n.eyedropper,
562
- original: n.modelValue
563
- }, null, 8, [
564
- "modelValue",
565
- "presets",
566
- "alpha",
567
- "recent",
568
- "eyedropper",
569
- "original"
570
- ])]),
571
- _: 1
572
- }, 8, ["model-value", "title"]));
573
- }
574
- });
575
- export { P as a, O as i, L as n, F as r, Te as t };
576
-
577
- //# sourceMappingURL=MColorPickerModal-ChRtcZOo.js.map