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