@m3ui-vue/m3ui-vue 1.6.0 → 1.6.2

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 (158) hide show
  1. package/dist/API.md +940 -33
  2. package/dist/{MButton-CPghlKb0.js → MButton-OQ4wIERQ.js} +2 -2
  3. package/dist/{MButton-CPghlKb0.js.map → MButton-OQ4wIERQ.js.map} +1 -1
  4. package/dist/MColorPickerModal-NtkihoK6.js +577 -0
  5. package/dist/MColorPickerModal-NtkihoK6.js.map +1 -0
  6. package/dist/{MDialog-X50At1Gk.js → MDialog-DYMnaBlt.js} +3 -3
  7. package/dist/{MDialog-X50At1Gk.js.map → MDialog-DYMnaBlt.js.map} +1 -1
  8. package/dist/{MListItem-DVi1j1QI.js → MListItem-D2cNUyzP.js} +211 -168
  9. package/dist/MListItem-D2cNUyzP.js.map +1 -0
  10. package/dist/{MLoadingIndicator-vooA3110.js → MLoadingIndicator-DWUj0BAB.js} +2 -2
  11. package/dist/{MLoadingIndicator-vooA3110.js.map → MLoadingIndicator-DWUj0BAB.js.map} +1 -1
  12. package/dist/{MMenuItem-CRNZkVVr.js → MMenuItem-BuxYoASE.js} +133 -151
  13. package/dist/MMenuItem-BuxYoASE.js.map +1 -0
  14. package/dist/{MSeekBar-BL2W5_rD.js → MSeekBar-C4cn9RIF.js} +2 -2
  15. package/dist/{MSeekBar-BL2W5_rD.js.map → MSeekBar-C4cn9RIF.js.map} +1 -1
  16. package/dist/{MSlider-B9NcKTmZ.js → MSlider-BIkA6DiE.js} +2 -2
  17. package/dist/{MSlider-B9NcKTmZ.js.map → MSlider-BIkA6DiE.js.map} +1 -1
  18. package/dist/{MSpinner-_XpTRkAg.js → MSpinner-DZkXZJpc.js} +2 -2
  19. package/dist/{MSpinner-_XpTRkAg.js.map → MSpinner-DZkXZJpc.js.map} +1 -1
  20. package/dist/{MTextField-DpcPmR5B.js → MTextField-CNH-byir.js} +2 -2
  21. package/dist/{MTextField-DpcPmR5B.js.map → MTextField-CNH-byir.js.map} +1 -1
  22. package/dist/MTooltip-CK39Zon4.js +183 -0
  23. package/dist/MTooltip-CK39Zon4.js.map +1 -0
  24. package/dist/{_useEscapeStack-C5-BYr8y.js → _popupPosition-nL8SVKPK.js} +20 -2
  25. package/dist/_popupPosition-nL8SVKPK.js.map +1 -0
  26. package/dist/api.json +1 -1
  27. package/dist/code-editor.js +1 -1
  28. package/dist/components/MAddressField.vue.d.ts +54 -0
  29. package/dist/components/MAudioPlayer.vue.d.ts +1 -1
  30. package/dist/components/MAudioRecorder.vue.d.ts +51 -0
  31. package/dist/components/MAvailabilityCalendar.vue.d.ts +1 -1
  32. package/dist/components/MCameraCapture.vue.d.ts +51 -0
  33. package/dist/components/MCollapse.vue.d.ts +32 -0
  34. package/dist/components/MCountrySelect.vue.d.ts +41 -0
  35. package/dist/components/MCronField.vue.d.ts +26 -0
  36. package/dist/components/MDashboardGrid.vue.d.ts +65 -0
  37. package/dist/components/MDiffViewer.vue.d.ts +56 -0
  38. package/dist/components/MExpansionPanel.vue.d.ts +26 -3
  39. package/dist/components/MFilterBuilder.vue.d.ts +22 -0
  40. package/dist/components/MFlex.vue.d.ts +1 -1
  41. package/dist/components/MMapCluster.vue.d.ts +80 -0
  42. package/dist/components/MMapDraw.vue.d.ts +79 -0
  43. package/dist/components/MMentionField.vue.d.ts +102 -0
  44. package/dist/components/MNotificationCenter.vue.d.ts +57 -0
  45. package/dist/components/MQRScanner.vue.d.ts +52 -0
  46. package/dist/components/MQuiz.vue.d.ts +1 -1
  47. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  48. package/dist/components/MStack.vue.d.ts +1 -1
  49. package/dist/components/MTimezoneSelect.vue.d.ts +39 -0
  50. package/dist/components/MToolbar.vue.d.ts +1 -1
  51. package/dist/components/MVideoPlayer.vue.d.ts +1 -1
  52. package/dist/components/_MFilterGroup.vue.d.ts +17 -0
  53. package/dist/composables/_caretPosition.d.ts +6 -0
  54. package/dist/composables/_useCamera.d.ts +16 -0
  55. package/dist/composables/_useFollowAnchor.d.ts +15 -0
  56. package/dist/composables/cron.d.ts +29 -0
  57. package/dist/composables/dashboardLayout.d.ts +28 -0
  58. package/dist/composables/filterBuilder.d.ts +55 -0
  59. package/dist/composables/mapAdapters.d.ts +6 -1
  60. package/dist/composables/mapSearch.d.ts +1 -0
  61. package/dist/composables/textDiff.d.ts +24 -0
  62. package/dist/composables/useLocale.d.ts +108 -0
  63. package/dist/draw.js +28 -27
  64. package/dist/draw.js.map +1 -1
  65. package/dist/flow.js +1 -1
  66. package/dist/gantt.js +1 -1
  67. package/dist/index.d.ts +25 -0
  68. package/dist/locales/index.js +749 -0
  69. package/dist/locales/index.js.map +1 -1
  70. package/dist/m3ui-vue.css +1 -1
  71. package/dist/m3ui.js +10444 -7495
  72. package/dist/m3ui.js.map +1 -1
  73. package/dist/map.d.ts +5 -0
  74. package/dist/map.js +1509 -617
  75. package/dist/map.js.map +1 -1
  76. package/dist/media.js +5 -5
  77. package/dist/pdf.js +5 -5
  78. package/dist/rich-text-editor.js +5 -5
  79. package/dist/styles.css +1 -1
  80. package/dist/{useLocale-COav9m8C.js → useLocale-DaVSTdm0.js} +108 -1
  81. package/dist/useLocale-DaVSTdm0.js.map +1 -0
  82. package/package.json +1 -1
  83. package/src/__tests__/MAddressField.test.ts +149 -0
  84. package/src/__tests__/MAudioRecorder.test.ts +125 -0
  85. package/src/__tests__/MCameraCapture.test.ts +154 -0
  86. package/src/__tests__/MCountrySelect.test.ts +67 -0
  87. package/src/__tests__/MCronField.test.ts +100 -0
  88. package/src/__tests__/MDashboardGrid.test.ts +122 -0
  89. package/src/__tests__/MDiffViewer.test.ts +68 -0
  90. package/src/__tests__/MExpansionPanel.test.ts +107 -0
  91. package/src/__tests__/MFilterBuilder.test.ts +130 -0
  92. package/src/__tests__/MMapCluster.test.ts +127 -0
  93. package/src/__tests__/MMapDraw.test.ts +188 -0
  94. package/src/__tests__/MMapLayers.test.ts +56 -0
  95. package/src/__tests__/MMentionField.test.ts +163 -0
  96. package/src/__tests__/MNotificationCenter.test.ts +94 -0
  97. package/src/__tests__/_fakeMaplibre.ts +14 -3
  98. package/src/__tests__/attrsFallthrough.test.ts +4 -0
  99. package/src/__tests__/cron.test.ts +68 -0
  100. package/src/__tests__/dashboardLayout.test.ts +45 -0
  101. package/src/__tests__/filterBuilder.test.ts +91 -0
  102. package/src/__tests__/followAnchor.test.ts +162 -0
  103. package/src/__tests__/ssr.test.ts +3 -0
  104. package/src/__tests__/textDiff.test.ts +37 -0
  105. package/src/components/MAddressField.vue +301 -0
  106. package/src/components/MAudioRecorder.vue +334 -0
  107. package/src/components/MAutocomplete.vue +3 -7
  108. package/src/components/MCameraCapture.vue +156 -0
  109. package/src/components/MCollapse.vue +91 -0
  110. package/src/components/MColorPicker.vue +4 -8
  111. package/src/components/MCountrySelect.vue +89 -0
  112. package/src/components/MCronField.vue +251 -0
  113. package/src/components/MDashboardGrid.vue +382 -0
  114. package/src/components/MDatePicker.vue +10 -7
  115. package/src/components/MDateRangePicker.vue +10 -7
  116. package/src/components/MDiffViewer.vue +234 -0
  117. package/src/components/MExpansionPanel.vue +56 -48
  118. package/src/components/MFilterBuilder.vue +47 -0
  119. package/src/components/MMapBaseLayers.vue +29 -28
  120. package/src/components/MMapCluster.vue +295 -0
  121. package/src/components/MMapDraw.vue +601 -0
  122. package/src/components/MMapMeasure.vue +1 -1
  123. package/src/components/MMapSearch.vue +1 -9
  124. package/src/components/MMentionField.vue +373 -0
  125. package/src/components/MMultiAutocomplete.vue +3 -7
  126. package/src/components/MMultiSelect.vue +3 -7
  127. package/src/components/MNotificationCenter.vue +252 -0
  128. package/src/components/MPhoneInput.vue +3 -10
  129. package/src/components/MQRScanner.vue +177 -0
  130. package/src/components/MSelect.vue +3 -7
  131. package/src/components/MTimePicker.vue +10 -7
  132. package/src/components/MTimezoneSelect.vue +116 -0
  133. package/src/components/_MFilterGroup.vue +210 -0
  134. package/src/composables/_caretPosition.ts +44 -0
  135. package/src/composables/_useCamera.ts +66 -0
  136. package/src/composables/_useFollowAnchor.ts +109 -0
  137. package/src/composables/cron.ts +179 -0
  138. package/src/composables/dashboardLayout.ts +94 -0
  139. package/src/composables/filterBuilder.ts +195 -0
  140. package/src/composables/mapAdapters.ts +29 -15
  141. package/src/composables/mapSearch.ts +10 -0
  142. package/src/composables/textDiff.ts +106 -0
  143. package/src/composables/useLocale.ts +215 -0
  144. package/src/index.ts +25 -0
  145. package/src/locales/de.ts +107 -0
  146. package/src/locales/es.ts +107 -0
  147. package/src/locales/fr.ts +107 -0
  148. package/src/locales/ja.ts +107 -0
  149. package/src/locales/ko.ts +107 -0
  150. package/src/locales/pt.ts +107 -0
  151. package/src/locales/zh.ts +107 -0
  152. package/src/map.ts +5 -0
  153. package/dist/MListItem-DVi1j1QI.js.map +0 -1
  154. package/dist/MMenuItem-CRNZkVVr.js.map +0 -1
  155. package/dist/MTooltip-BL3jPYPT.js +0 -754
  156. package/dist/MTooltip-BL3jPYPT.js.map +0 -1
  157. package/dist/_useEscapeStack-C5-BYr8y.js.map +0 -1
  158. package/dist/useLocale-COav9m8C.js.map +0 -1
@@ -1,754 +0,0 @@
1
- import { i as e, o as t } from "./_storageKeys-C4W_4xK4.js";
2
- import { i as n } from "./useLocale-COav9m8C.js";
3
- import { t as r } from "./MIconButton-BBggVwBV.js";
4
- import { t as i } from "./MIcon-DpajuUTJ.js";
5
- import { t as a } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
6
- import { t as o } from "./MDialog-X50At1Gk.js";
7
- import { t as s } from "./MButton-CPghlKb0.js";
8
- import { Fragment as c, Teleport as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, mergeProps as y, nextTick as b, normalizeClass as x, normalizeStyle as S, onMounted as C, onUnmounted as w, openBlock as T, ref as E, renderList as ee, renderSlot as D, toDisplayString as O, unref as k, watch as te, withCtx as A, withKeys as ne } from "vue";
9
- // src/composables/_tooltipTrigger.ts
10
- var j = 500, M = 1500, N = 120, P = 4, F = 6;
11
- function I(e, t, n) {
12
- let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = 0, o = 0;
13
- switch (n) {
14
- case "top":
15
- a = r.top - i.height - P, o = r.left + (r.width - i.width) / 2;
16
- break;
17
- case "bottom":
18
- a = r.bottom + P, o = r.left + (r.width - i.width) / 2;
19
- break;
20
- case "left":
21
- a = r.top + (r.height - i.height) / 2, o = r.left - i.width - P;
22
- break;
23
- case "right": a = r.top + (r.height - i.height) / 2, o = r.right + P;
24
- }
25
- return a = Math.max(F, Math.min(a, window.innerHeight - i.height - F)), o = Math.max(F, Math.min(o, window.innerWidth - i.width - F)), {
26
- top: a,
27
- left: o
28
- };
29
- }
30
- function L(e, t) {
31
- let n, r, i = null, a = !1, o = () => t.rich?.() ?? !1;
32
- function s() {
33
- clearTimeout(n), clearTimeout(r);
34
- }
35
- function c() {
36
- s(), n = setTimeout(t.open, t.delay());
37
- }
38
- function l() {
39
- s(), o() ? r = setTimeout(t.close, N) : t.close();
40
- }
41
- function u() {
42
- s(), t.close();
43
- }
44
- function d(e) {
45
- e.pointerType === "mouse" && c();
46
- }
47
- function f(e) {
48
- e.pointerType === "mouse" && l();
49
- }
50
- function p() {
51
- i && clearTimeout(i.timer), i = null, window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", g), window.removeEventListener("pointercancel", v);
52
- }
53
- function m(e) {
54
- e.pointerType !== "mouse" && (p(), a = !1, i = {
55
- id: e.pointerId,
56
- x: e.clientX,
57
- y: e.clientY,
58
- timer: setTimeout(() => {
59
- a = !0, s(), t.open();
60
- }, j)
61
- }, window.addEventListener("pointermove", h), window.addEventListener("pointerup", g), window.addEventListener("pointercancel", v));
62
- }
63
- function h(e) {
64
- i && e.pointerId === i.id && Math.hypot(e.clientX - i.x, e.clientY - i.y) > 10 && p();
65
- }
66
- function g(e) {
67
- i && e.pointerId === i.id && (p(), a && (s(), o() ? document.addEventListener("pointerdown", _, !0) : r = setTimeout(t.close, M)));
68
- }
69
- function _(n) {
70
- let r = n.target;
71
- t.tip()?.contains(r) || e.contains(r) || (document.removeEventListener("pointerdown", _, !0), t.close());
72
- }
73
- function v(e) {
74
- i && e.pointerId === i.id && (p(), a && l());
75
- }
76
- function y(e) {
77
- a && (a = !1, e.preventDefault(), e.stopPropagation());
78
- }
79
- function b(e) {
80
- (i || a) && e.preventDefault();
81
- }
82
- function x(e) {
83
- let t = !0;
84
- try {
85
- t = e.target.matches(":focus-visible");
86
- } catch {}
87
- t && c();
88
- }
89
- function S(e) {
90
- e.key === "Escape" && t.visible() && (e.stopPropagation(), u());
91
- }
92
- function C() {
93
- t.visible() && u();
94
- }
95
- return e.addEventListener("pointerenter", d), e.addEventListener("pointerleave", f), e.addEventListener("pointerdown", m), e.addEventListener("click", y, !0), e.addEventListener("contextmenu", b), e.addEventListener("focusin", x), e.addEventListener("focusout", l), e.addEventListener("keydown", S), window.addEventListener("scroll", C, !0), {
96
- cancel: s,
97
- closeNow: u,
98
- destroy() {
99
- s(), p(), document.removeEventListener("pointerdown", _, !0), e.removeEventListener("pointerenter", d), e.removeEventListener("pointerleave", f), e.removeEventListener("pointerdown", m), e.removeEventListener("click", y, !0), e.removeEventListener("contextmenu", b), e.removeEventListener("focusin", x), e.removeEventListener("focusout", l), e.removeEventListener("keydown", S), window.removeEventListener("scroll", C, !0);
100
- }
101
- };
102
- }
103
- // src/composables/_colorUtils.ts
104
- function R(e) {
105
- let t = e.trim().replace(/^#/, "");
106
- if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
107
- t.length <= 4 && (t = [...t].map((e) => e + e).join(""));
108
- let n = (e) => parseInt(t.substring(e, e + 2), 16);
109
- return {
110
- r: n(0),
111
- g: n(2),
112
- b: n(4),
113
- a: t.length === 8 ? n(6) / 255 : 1
114
- };
115
- }
116
- function re({ r: e, g: t, b: n, a: r }) {
117
- let i = (e) => Math.round(Math.max(0, Math.min(255, e))).toString(16).padStart(2, "0");
118
- return `#${i(e)}${i(t)}${i(n)}${r < 1 ? i(r * 255) : ""}`;
119
- }
120
- function z(e) {
121
- let t = R(e);
122
- return t ? re(t) : "";
123
- }
124
- function ie({ r: e, g: t, b: n }) {
125
- e /= 255, t /= 255, n /= 255;
126
- let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
127
- return i !== 0 && (a = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a *= 60), {
128
- h: a,
129
- s: r === 0 ? 0 : i / r * 100,
130
- v: r * 100
131
- };
132
- }
133
- function B({ h: e, s: t, v: n }, r = 1) {
134
- t /= 100, n /= 100;
135
- let i = (r) => {
136
- let i = (r + e / 60) % 6;
137
- return (n - n * t * Math.max(0, Math.min(i, 4 - i, 1))) * 255;
138
- };
139
- return {
140
- r: i(5),
141
- g: i(3),
142
- b: i(1),
143
- a: r
144
- };
145
- }
146
- function ae({ h: e, s: t, v: n }) {
147
- t /= 100, n /= 100;
148
- let r = n * (1 - t / 2);
149
- return {
150
- h: e,
151
- s: (r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r)) * 100,
152
- l: r * 100
153
- };
154
- }
155
- function oe({ h: e, s: t, l: n }) {
156
- t /= 100, n /= 100;
157
- let r = n + t * Math.min(n, 1 - n);
158
- return {
159
- h: e,
160
- s: r === 0 ? 0 : 2 * (1 - n / r) * 100,
161
- v: r * 100
162
- };
163
- }
164
- function V(e) {
165
- let t = R(e);
166
- if (!t) return "#000000";
167
- let n = (e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
168
- return .2126 * n(t.r) + .7152 * n(t.g) + .0722 * n(t.b) > .179 ? "#000000" : "#ffffff";
169
- }
170
- var H = "m3-color-recent";
171
- function U() {
172
- try {
173
- let e = JSON.parse(localStorage.getItem(t(H)) ?? "[]");
174
- return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!R(e)) : [];
175
- } catch {
176
- return [];
177
- }
178
- }
179
- var W = E(U());
180
- e(() => {
181
- W.value = U();
182
- });
183
- function G(e, n) {
184
- let r = z(e);
185
- if (r) {
186
- W.value = [r, ...W.value.filter((e) => e !== r)].slice(0, Math.max(n, 0));
187
- try {
188
- localStorage.setItem(t(H), JSON.stringify(W.value));
189
- } catch {}
190
- }
191
- }
192
- var K = [
193
- "#f44336",
194
- "#e91e63",
195
- "#9c27b0",
196
- "#673ab7",
197
- "#3f51b5",
198
- "#2196f3",
199
- "#03a9f4",
200
- "#00bcd4",
201
- "#009688",
202
- "#4caf50",
203
- "#8bc34a",
204
- "#cddc39",
205
- "#ffeb3b",
206
- "#ffc107",
207
- "#ff9800",
208
- "#ff5722",
209
- "#795548",
210
- "#607d8b",
211
- "#9e9e9e",
212
- "#000000",
213
- "#ffffff"
214
- ], se = { class: "flex flex-col gap-4" }, ce = [
215
- "aria-label",
216
- "aria-valuenow",
217
- "aria-valuetext"
218
- ], le = { class: "flex flex-col gap-1" }, ue = ["aria-label", "aria-valuenow"], de = [
219
- "aria-label",
220
- "aria-valuenow",
221
- "aria-valuetext"
222
- ], fe = { class: "flex items-center gap-2" }, pe = { class: "flex h-10 min-w-0 flex-1" }, me = ["aria-label", "title"], he = { class: "flex items-start gap-2" }, ge = ["aria-label"], _e = ["maxlength", "value"], ve = [
223
- "aria-label",
224
- "value",
225
- "onInput",
226
- "onKeydown"
227
- ], ye = { class: "text-label-small text-on-surface-variant" }, be = ["aria-label"], xe = {
228
- key: 0,
229
- class: "text-label-medium text-on-surface-variant"
230
- }, Se = { class: "grid grid-cols-7 gap-2" }, Ce = [
231
- "aria-label",
232
- "aria-pressed",
233
- "onClick"
234
- ], q = 12, we = "repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px", J = /*#__PURE__*/ a(/* @__PURE__ */ v({
235
- __name: "_MColorPanel",
236
- props: {
237
- modelValue: {},
238
- presets: {},
239
- alpha: { type: Boolean },
240
- recent: { type: Boolean },
241
- eyedropper: { type: Boolean },
242
- original: {}
243
- },
244
- emits: ["update:modelValue"],
245
- setup(e, { expose: t, emit: a }) {
246
- let o = e, s = a, l = n(), u = E(0), v = E(100), y = E(100), b = E(1), w = d(() => re(B({
247
- h: u.value,
248
- s: v.value,
249
- v: y.value
250
- }, o.alpha ? b.value : 1))), D = d(() => re(B({
251
- h: u.value,
252
- s: v.value,
253
- v: y.value
254
- }))), A = d(() => `hsl(${u.value}, 100%, 50%)`);
255
- function j(e) {
256
- let t = ie(e);
257
- t.v > 0 && t.s > 0 && (u.value = t.h), t.v > 0 && (v.value = t.s), y.value = t.v, b.value = o.alpha ? e.a : 1;
258
- }
259
- let M = "";
260
- function N() {
261
- M = w.value, w.value !== z(o.modelValue) && s("update:modelValue", w.value);
262
- }
263
- te(() => o.modelValue, (e) => {
264
- let t = z(e);
265
- t && t !== M && (j(R(t)), M = t);
266
- }, { immediate: !0 });
267
- function P(e) {
268
- let t = R(e);
269
- t && (j(t), N());
270
- }
271
- let F = E(), I = E(), L = E(), H = E(null), U = (e, t, n) => Math.min(n, Math.max(t, e));
272
- function G(e, t) {
273
- let n = e === "area" ? F.value : e === "hue" ? I.value : L.value;
274
- if (!n) return;
275
- let r = n.getBoundingClientRect();
276
- if (e === "area") v.value = U((t.clientX - r.left) / r.width * 100, 0, 100), y.value = U((1 - (t.clientY - r.top) / r.height) * 100, 0, 100);
277
- else {
278
- let n = U((t.clientX - r.left - q) / (r.width - 24), 0, 1);
279
- e === "hue" ? u.value = n * 360 : b.value = Math.round(n * 100) / 100;
280
- }
281
- N();
282
- }
283
- function K(e, t) {
284
- t.button === 0 && (t.preventDefault(), t.currentTarget.focus({ preventScroll: !0 }), t.currentTarget.setPointerCapture?.(t.pointerId), H.value = e, G(e, t));
285
- }
286
- function J(e, t) {
287
- H.value === e && G(e, t);
288
- }
289
- function Y() {
290
- H.value = null;
291
- }
292
- function X(e, t) {
293
- 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;
294
- if (e === "area") {
295
- if (!r && !i) return;
296
- v.value = U(v.value + r, 0, 100), y.value = U(y.value + i, 0, 100);
297
- } else {
298
- let n = e === "hue" ? 360 : 100, a = e === "hue" ? u.value : b.value * 100, o;
299
- if (t.key === "Home") o = 0;
300
- else if (t.key === "End") o = n;
301
- else if (r || i) o = U(a + (r || i), 0, n);
302
- else return;
303
- e === "hue" ? u.value = o : b.value = Math.round(o) / 100;
304
- }
305
- t.preventDefault(), N();
306
- }
307
- let Te = E(!1);
308
- C(() => {
309
- Te.value = "EyeDropper" in window;
310
- });
311
- async function Ee() {
312
- try {
313
- let e = window.EyeDropper, { sRGBHex: t } = await new e().open(), n = R(t);
314
- n && (j({
315
- ...n,
316
- a: b.value
317
- }), N());
318
- } catch {}
319
- }
320
- let Z = [
321
- {
322
- id: "hex",
323
- label: "HEX"
324
- },
325
- {
326
- id: "rgb",
327
- label: "RGB"
328
- },
329
- {
330
- id: "hsl",
331
- label: "HSL"
332
- }
333
- ], Q = E("hex"), De = d(() => Z.find((e) => e.id === Q.value).label);
334
- function Oe() {
335
- Q.value = Z[(Z.findIndex((e) => e.id === Q.value) + 1) % Z.length].id, $.value = null;
336
- }
337
- function ke(e) {
338
- u.value = e.h, v.value = e.s, y.value = e.v;
339
- }
340
- let Ae = d(() => ({
341
- key: "a",
342
- label: "A",
343
- display: String(Math.round(b.value * 100)),
344
- max: 100,
345
- apply: (e) => {
346
- b.value = e / 100;
347
- }
348
- })), je = d(() => {
349
- let e = [];
350
- if (Q.value === "rgb") {
351
- let t = B({
352
- h: u.value,
353
- s: v.value,
354
- v: y.value
355
- }), n = {
356
- r: Math.round(t.r),
357
- g: Math.round(t.g),
358
- b: Math.round(t.b),
359
- a: b.value
360
- };
361
- for (let t of [
362
- "r",
363
- "g",
364
- "b"
365
- ]) e.push({
366
- key: t,
367
- label: t.toUpperCase(),
368
- display: String(n[t]),
369
- max: 255,
370
- apply: (e) => j({
371
- ...n,
372
- [t]: e
373
- })
374
- });
375
- } else if (Q.value === "hsl") {
376
- let t = ae({
377
- h: u.value,
378
- s: v.value,
379
- v: y.value
380
- }), n = {
381
- h: Math.round(t.h),
382
- s: Math.round(t.s),
383
- l: Math.round(t.l)
384
- };
385
- for (let t of [
386
- "h",
387
- "s",
388
- "l"
389
- ]) e.push({
390
- key: t,
391
- label: t.toUpperCase(),
392
- display: String(n[t]),
393
- max: t === "h" ? 360 : 100,
394
- apply: (e) => ke(oe({
395
- ...n,
396
- [t]: e
397
- }))
398
- });
399
- }
400
- return o.alpha && Q.value !== "hex" && e.push(Ae.value), e;
401
- }), $ = E(null), Me = (e, t) => $.value?.key === e ? $.value.text : t;
402
- function Ne(e) {
403
- let t = e.target.value;
404
- $.value = {
405
- key: "hex",
406
- text: t
407
- };
408
- let n = R(t);
409
- n && (j(n), N());
410
- }
411
- function Pe(e, t) {
412
- let n = t.target.value;
413
- if ($.value = {
414
- key: e.key,
415
- text: n
416
- }, !/^\d+$/.test(n.trim())) return;
417
- let r = Number(n);
418
- r > e.max || (e.apply(r), N());
419
- }
420
- function Fe(e, t) {
421
- if (t.key === "Enter") {
422
- $.value = null;
423
- return;
424
- }
425
- if (t.key !== "ArrowUp" && t.key !== "ArrowDown") return;
426
- t.preventDefault();
427
- let n = (t.shiftKey ? 10 : 1) * (t.key === "ArrowUp" ? 1 : -1);
428
- e.apply(U(Number(e.display) + n, 0, e.max)), $.value = null, N();
429
- }
430
- let Ie = d(() => o.recent ? W.value : []), Le = (e) => z(e) === w.value, Re = (e) => `linear-gradient(${e}, ${e}), ${we}`, ze = d(() => b.value < .5 ? "#000000" : V(D.value)), Be = d(() => !!o.original && !!z(o.original) && z(o.original) !== w.value);
431
- return t({ focus: () => F.value?.focus({ preventScroll: !0 }) }), (t, n) => (T(), m("div", se, [
432
- h("div", {
433
- ref_key: "areaEl",
434
- ref: F,
435
- role: "slider",
436
- tabindex: "0",
437
- "aria-label": `${k(l).colorSaturation}, ${k(l).colorBrightness}`,
438
- "aria-valuenow": Math.round(v.value),
439
- "aria-valuemin": "0",
440
- "aria-valuemax": "100",
441
- "aria-valuetext": `${k(l).colorSaturation} ${Math.round(v.value)}%, ${k(l).colorBrightness} ${Math.round(y.value)}%`,
442
- 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",
443
- style: S({ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${A.value})` }),
444
- onPointerdown: n[0] ||= (e) => K("area", e),
445
- onPointermove: n[1] ||= (e) => J("area", e),
446
- onPointerup: Y,
447
- onPointercancel: Y,
448
- onKeydown: n[2] ||= (e) => X("area", e)
449
- }, [h("span", {
450
- class: x(["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" : ""]),
451
- style: S({
452
- left: `${v.value}%`,
453
- top: `${100 - y.value}%`,
454
- backgroundColor: D.value
455
- })
456
- }, null, 6)], 44, ce),
457
- h("div", le, [h("div", {
458
- ref_key: "hueEl",
459
- ref: I,
460
- role: "slider",
461
- tabindex: "0",
462
- "aria-label": k(l).colorHue,
463
- "aria-valuenow": Math.round(u.value),
464
- "aria-valuemin": "0",
465
- "aria-valuemax": "360",
466
- class: "m3-cp-slider group",
467
- onPointerdown: n[3] ||= (e) => K("hue", e),
468
- onPointermove: n[4] ||= (e) => J("hue", e),
469
- onPointerup: Y,
470
- onPointercancel: Y,
471
- onKeydown: n[5] ||= (e) => X("hue", e)
472
- }, [n[13] ||= h("span", { class: "m3-cp-track m3-cp-hue" }, null, -1), h("span", {
473
- class: x(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "hue" }]),
474
- style: S({ left: `calc(${q}px + ${u.value / 360} * (100% - 24px))` })
475
- }, null, 6)], 40, ue), e.alpha ? (T(), m("div", {
476
- key: 0,
477
- ref_key: "alphaEl",
478
- ref: L,
479
- role: "slider",
480
- tabindex: "0",
481
- "aria-label": k(l).colorAlpha,
482
- "aria-valuenow": Math.round(b.value * 100),
483
- "aria-valuemin": "0",
484
- "aria-valuemax": "100",
485
- "aria-valuetext": `${Math.round(b.value * 100)}%`,
486
- class: "m3-cp-slider group",
487
- onPointerdown: n[6] ||= (e) => K("alpha", e),
488
- onPointermove: n[7] ||= (e) => J("alpha", e),
489
- onPointerup: Y,
490
- onPointercancel: Y,
491
- onKeydown: n[8] ||= (e) => X("alpha", e)
492
- }, [h("span", {
493
- class: "m3-cp-track",
494
- style: S({ background: `linear-gradient(to right, transparent, ${D.value}), ${we}` })
495
- }, null, 4), h("span", {
496
- class: x(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "alpha" }]),
497
- style: S({ left: `calc(${q}px + ${b.value} * (100% - 24px))` })
498
- }, null, 6)], 40, de)) : p("", !0)]),
499
- h("div", fe, [h("div", pe, [Be.value ? (T(), m("button", {
500
- key: 0,
501
- type: "button",
502
- class: "m3-cp-swatch flex w-12 shrink-0 cursor-pointer items-center justify-center rounded-l-full outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
503
- style: S({ background: Re(e.original) }),
504
- "aria-label": k(l).colorOriginal,
505
- title: k(l).colorOriginal,
506
- onClick: n[9] ||= (t) => P(e.original)
507
- }, [_(i, {
508
- name: "undo",
509
- size: 18,
510
- style: S({ color: k(V)(e.original) })
511
- }, null, 8, ["style"])], 12, me)) : p("", !0), h("span", {
512
- class: x(["m3-cp-swatch flex min-w-0 flex-1 items-center px-4 font-mono text-label-large transition-[border-radius] duration-200", Be.value ? "rounded-r-full" : "rounded-full"]),
513
- style: S({
514
- background: Re(w.value),
515
- color: ze.value
516
- })
517
- }, O(w.value), 7)]), e.eyedropper && Te.value ? (T(), f(r, {
518
- key: 0,
519
- icon: "colorize",
520
- variant: "tonal",
521
- label: k(l).colorEyedropper,
522
- onClick: Ee
523
- }, null, 8, ["label"])) : p("", !0)]),
524
- h("div", he, [
525
- h("button", {
526
- type: "button",
527
- class: "flex h-10 shrink-0 cursor-pointer items-center gap-0.5 rounded-full bg-secondary-container pr-2 pl-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",
528
- "aria-label": `${k(l).colorFormat}: ${De.value}`,
529
- onClick: Oe
530
- }, [g(O(De.value) + " ", 1), _(i, {
531
- name: "unfold_more",
532
- size: 18
533
- })], 8, ge),
534
- Q.value === "hex" ? (T(), m("input", {
535
- key: 0,
536
- type: "text",
537
- spellcheck: "false",
538
- autocomplete: "off",
539
- maxlength: e.alpha ? 9 : 7,
540
- "aria-label": "HEX",
541
- value: Me("hex", w.value),
542
- class: "m3-cp-field min-w-0 flex-1 font-mono text-body-medium",
543
- onInput: Ne,
544
- onBlur: n[10] ||= (e) => $.value = null,
545
- onKeydown: n[11] ||= ne((e) => $.value = null, ["enter"])
546
- }, null, 40, _e)) : p("", !0),
547
- (T(!0), m(c, null, ee(je.value, (e) => (T(), m("label", {
548
- key: e.key,
549
- class: "flex min-w-0 flex-1 flex-col items-center gap-1"
550
- }, [h("input", {
551
- type: "text",
552
- inputmode: "numeric",
553
- autocomplete: "off",
554
- maxlength: 3,
555
- "aria-label": e.label,
556
- value: Me(e.key, e.display),
557
- class: "m3-cp-field w-full font-mono text-body-medium",
558
- onInput: (t) => Pe(e, t),
559
- onKeydown: (t) => Fe(e, t),
560
- onBlur: n[12] ||= (e) => $.value = null
561
- }, null, 40, ve), h("span", ye, O(e.label), 1)]))), 128))
562
- ]),
563
- (T(!0), m(c, null, ee([{
564
- id: "recent",
565
- label: k(l).colorRecent,
566
- colors: Ie.value
567
- }, {
568
- id: "presets",
569
- label: k(l).colorPresets,
570
- colors: e.presets
571
- }], (e) => (T(), m(c, { key: e.id }, [e.colors.length ? (T(), m("div", {
572
- key: 0,
573
- role: "group",
574
- "aria-label": e.label,
575
- class: "flex flex-col gap-2"
576
- }, [Ie.value.length ? (T(), m("span", xe, O(e.label), 1)) : p("", !0), h("div", Se, [(T(!0), m(c, null, ee(e.colors, (e) => (T(), m("button", {
577
- key: e,
578
- type: "button",
579
- class: x(["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": Le(e) }]),
580
- style: S({ background: Re(e) }),
581
- "aria-label": e,
582
- "aria-pressed": Le(e),
583
- onClick: (t) => P(e)
584
- }, [Le(e) ? (T(), f(i, {
585
- key: 0,
586
- name: "check",
587
- size: 18,
588
- style: S({ color: k(V)(e) })
589
- }, null, 8, ["style"])) : p("", !0)], 14, Ce))), 128))])], 8, be)) : p("", !0)], 64))), 128))
590
- ]));
591
- }
592
- }), [["__scopeId", "data-v-87647feb"]]), Y = /* @__PURE__ */ v({
593
- __name: "MColorPickerModal",
594
- props: {
595
- modelValue: {},
596
- show: {
597
- type: Boolean,
598
- default: !1
599
- },
600
- presets: { default: () => K },
601
- title: {},
602
- alpha: {
603
- type: Boolean,
604
- default: !1
605
- },
606
- recent: {
607
- type: Boolean,
608
- default: !0
609
- },
610
- recentLimit: { default: 7 },
611
- eyedropper: {
612
- type: Boolean,
613
- default: !0
614
- }
615
- },
616
- emits: ["update:modelValue", "update:show"],
617
- setup(e, { emit: t }) {
618
- let r = e, i = n(), a = t, c = E(r.modelValue);
619
- te(() => r.show, (e) => {
620
- e && (c.value = r.modelValue);
621
- }, { immediate: !0 });
622
- function l() {
623
- a("update:show", !1);
624
- }
625
- function u() {
626
- let e = z(c.value) || c.value;
627
- r.recent && G(e, r.recentLimit), a("update:modelValue", e), a("update:show", !1);
628
- }
629
- return (t, n) => (T(), f(o, {
630
- "model-value": e.show,
631
- title: e.title || k(i).selectColor,
632
- "max-width": "328px",
633
- closable: !1,
634
- "onUpdate:modelValue": n[1] ||= (e) => !e && l()
635
- }, {
636
- actions: A(() => [_(s, {
637
- variant: "text",
638
- onClick: l
639
- }, {
640
- default: A(() => [g(O(k(i).cancel), 1)]),
641
- _: 1
642
- }), _(s, {
643
- variant: "text",
644
- onClick: u
645
- }, {
646
- default: A(() => [g(O(k(i).confirm), 1)]),
647
- _: 1
648
- })]),
649
- default: A(() => [_(J, {
650
- modelValue: c.value,
651
- "onUpdate:modelValue": n[0] ||= (e) => c.value = e,
652
- presets: e.presets,
653
- alpha: e.alpha,
654
- recent: e.recent,
655
- eyedropper: e.eyedropper,
656
- original: e.modelValue
657
- }, null, 8, [
658
- "modelValue",
659
- "presets",
660
- "alpha",
661
- "recent",
662
- "eyedropper",
663
- "original"
664
- ])]),
665
- _: 1
666
- }, 8, ["model-value", "title"]));
667
- }
668
- }), X = {
669
- key: 0,
670
- class: "px-4 pt-3 pb-1 text-title-small font-medium text-on-surface-variant"
671
- }, Te = { class: "px-4 py-2 text-body-medium text-on-surface-variant" }, Ee = {
672
- key: 1,
673
- class: "flex justify-end gap-2 px-4 pb-3"
674
- }, Z = /* @__PURE__ */ v({
675
- inheritAttrs: !1,
676
- __name: "MTooltip",
677
- props: {
678
- text: {},
679
- placement: { default: "top" },
680
- delay: { default: 600 },
681
- rich: {
682
- type: Boolean,
683
- default: !1
684
- }
685
- },
686
- setup(e) {
687
- let t = e, n = E(!1), r = E(), i = E(), a = E({}), o;
688
- async function s() {
689
- n.value = !0, await b(), v();
690
- }
691
- function d() {
692
- t.rich && o?.cancel();
693
- }
694
- function g() {
695
- t.rich && o?.closeNow();
696
- }
697
- function v() {
698
- if (!i.value || !r.value) return;
699
- let { top: e, left: n } = I(i.value, r.value, t.placement);
700
- a.value = {
701
- top: `${e}px`,
702
- left: `${n}px`
703
- };
704
- }
705
- return C(() => {
706
- o = L(i.value, {
707
- delay: () => t.delay,
708
- rich: () => t.rich,
709
- visible: () => n.value,
710
- open: s,
711
- close: () => {
712
- n.value = !1;
713
- },
714
- tip: () => r.value
715
- });
716
- }), w(() => o?.destroy()), (t, o) => (T(), m(c, null, [h("span", y({
717
- ref_key: "triggerEl",
718
- ref: i
719
- }, t.$attrs, { class: "inline-flex" }), [D(t.$slots, "default")], 16), (T(), f(l, { to: "body" }, [_(u, {
720
- "enter-active-class": "transition-opacity duration-150",
721
- "enter-from-class": "opacity-0",
722
- "enter-to-class": "opacity-100",
723
- "leave-active-class": "transition-opacity duration-100",
724
- "leave-from-class": "opacity-100",
725
- "leave-to-class": "opacity-0"
726
- }, {
727
- default: A(() => [n.value && !e.rich && e.text ? (T(), m("div", {
728
- key: 0,
729
- ref_key: "tipEl",
730
- ref: r,
731
- class: "pointer-events-none fixed z-400 min-h-6 min-w-10 max-w-[200px] rounded bg-inverse-surface px-2 py-1 text-body-small text-inverse-on-surface",
732
- style: S(a.value),
733
- role: "tooltip"
734
- }, O(e.text), 5)) : n.value && e.rich ? (T(), m("div", {
735
- key: 1,
736
- ref_key: "tipEl",
737
- ref: r,
738
- class: "fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-2",
739
- style: S(a.value),
740
- role: "tooltip",
741
- onMouseenter: d,
742
- onMouseleave: g
743
- }, [
744
- e.text ? (T(), m("div", X, O(e.text), 1)) : p("", !0),
745
- h("div", Te, [D(t.$slots, "content")]),
746
- t.$slots.actions ? (T(), m("div", Ee, [D(t.$slots, "actions")])) : p("", !0)
747
- ], 36)) : p("", !0)]),
748
- _: 3
749
- })]))], 64));
750
- }
751
- });
752
- export { z as a, I as c, K as i, Y as n, G as o, J as r, L as s, Z as t };
753
-
754
- //# sourceMappingURL=MTooltip-BL3jPYPT.js.map