@m3ui-vue/m3ui-vue 1.2.2 → 1.3.1
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 +3010 -376
- package/dist/MButton-Bl_BSUep.js +172 -0
- package/dist/MButton-Bl_BSUep.js.map +1 -0
- package/dist/MDialog-D_Yik8ou.js +173 -0
- package/dist/MDialog-D_Yik8ou.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-BxifHJdU.js +824 -0
- package/dist/MListItem-BxifHJdU.js.map +1 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js +115 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-BeN9QcB3.js +435 -0
- package/dist/MSeekBar-BeN9QcB3.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-BVSbJlGS.js +691 -0
- package/dist/MSlider-BVSbJlGS.js.map +1 -0
- package/dist/MSpinner-C2SUnWk4.js +65 -0
- package/dist/MSpinner-C2SUnWk4.js.map +1 -0
- package/dist/MTextField-CEkWSZ2v.js +296 -0
- package/dist/MTextField-CEkWSZ2v.js.map +1 -0
- package/dist/MTooltip-CodJGEO-.js +756 -0
- package/dist/MTooltip-CodJGEO-.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +150 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +248 -0
- package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
- package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
- package/dist/components/MFlow.vue.d.ts +318 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFloorPlan.d.ts +58 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +204 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1702 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3547 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/locales/index.js +1435 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +8248 -7637
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +113 -108
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-CaWwi-b6.js} +206 -2
- package/dist/useLocale-CaWwi-b6.js.map +1 -0
- package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +118 -0
- package/src/__tests__/MFloorPlan.test.ts +299 -0
- package/src/__tests__/MFlow.test.ts +590 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +819 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +1080 -0
- package/src/components/MFloorPlanInspector.vue +169 -0
- package/src/components/MFloorPlanToolbar.vue +128 -0
- package/src/components/MFlow.vue +2060 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1270 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +16 -0
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFloorPlan.ts +73 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +410 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +9 -0
- package/src/locales/de.ts +204 -0
- package/src/locales/es.ts +204 -0
- package/src/locales/fr.ts +204 -0
- package/src/locales/ja.ts +204 -0
- package/src/locales/ko.ts +204 -0
- package/src/locales/pt.ts +204 -0
- package/src/locales/zh.ts +204 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/dist/MMenuItem-D4Gx_l3F.js +0 -929
- package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
- package/dist/MSlider-Dx_S3vJ9.js +0 -1506
- package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
- package/dist/MTextField-Bz8JIsnl.js +0 -633
- package/dist/MTextField-Bz8JIsnl.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
import { i as e, o as t } from "./_storageKeys-CYXsUBwK.js";
|
|
2
|
+
import { i as n } from "./useLocale-CaWwi-b6.js";
|
|
3
|
+
import { t as r } from "./MIconButton-DoNotQ9v.js";
|
|
4
|
+
import { t as i } from "./MIcon-Bxh9j135.js";
|
|
5
|
+
import { t as a } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
6
|
+
import { t as o } from "./MDialog-D_Yik8ou.js";
|
|
7
|
+
import { t as s } from "./MButton-Bl_BSUep.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
|
+
//#region 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
|
+
//#endregion
|
|
104
|
+
//#region src/composables/_colorUtils.ts
|
|
105
|
+
function R(e) {
|
|
106
|
+
let t = e.trim().replace(/^#/, "");
|
|
107
|
+
if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
|
|
108
|
+
t.length <= 4 && (t = [...t].map((e) => e + e).join(""));
|
|
109
|
+
let n = (e) => parseInt(t.substring(e, e + 2), 16);
|
|
110
|
+
return {
|
|
111
|
+
r: n(0),
|
|
112
|
+
g: n(2),
|
|
113
|
+
b: n(4),
|
|
114
|
+
a: t.length === 8 ? n(6) / 255 : 1
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function re({ r: e, g: t, b: n, a: r }) {
|
|
118
|
+
let i = (e) => Math.round(Math.max(0, Math.min(255, e))).toString(16).padStart(2, "0");
|
|
119
|
+
return `#${i(e)}${i(t)}${i(n)}${r < 1 ? i(r * 255) : ""}`;
|
|
120
|
+
}
|
|
121
|
+
function z(e) {
|
|
122
|
+
let t = R(e);
|
|
123
|
+
return t ? re(t) : "";
|
|
124
|
+
}
|
|
125
|
+
function ie({ r: e, g: t, b: n }) {
|
|
126
|
+
e /= 255, t /= 255, n /= 255;
|
|
127
|
+
let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
|
|
128
|
+
return i !== 0 && (a = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a *= 60), {
|
|
129
|
+
h: a,
|
|
130
|
+
s: r === 0 ? 0 : i / r * 100,
|
|
131
|
+
v: r * 100
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function B({ h: e, s: t, v: n }, r = 1) {
|
|
135
|
+
t /= 100, n /= 100;
|
|
136
|
+
let i = (r) => {
|
|
137
|
+
let i = (r + e / 60) % 6;
|
|
138
|
+
return (n - n * t * Math.max(0, Math.min(i, 4 - i, 1))) * 255;
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
r: i(5),
|
|
142
|
+
g: i(3),
|
|
143
|
+
b: i(1),
|
|
144
|
+
a: r
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function ae({ h: e, s: t, v: n }) {
|
|
148
|
+
t /= 100, n /= 100;
|
|
149
|
+
let r = n * (1 - t / 2);
|
|
150
|
+
return {
|
|
151
|
+
h: e,
|
|
152
|
+
s: (r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r)) * 100,
|
|
153
|
+
l: r * 100
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function oe({ h: e, s: t, l: n }) {
|
|
157
|
+
t /= 100, n /= 100;
|
|
158
|
+
let r = n + t * Math.min(n, 1 - n);
|
|
159
|
+
return {
|
|
160
|
+
h: e,
|
|
161
|
+
s: r === 0 ? 0 : 2 * (1 - n / r) * 100,
|
|
162
|
+
v: r * 100
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function V(e) {
|
|
166
|
+
let t = R(e);
|
|
167
|
+
if (!t) return "#000000";
|
|
168
|
+
let n = (e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
169
|
+
return .2126 * n(t.r) + .7152 * n(t.g) + .0722 * n(t.b) > .179 ? "#000000" : "#ffffff";
|
|
170
|
+
}
|
|
171
|
+
var H = "m3-color-recent";
|
|
172
|
+
function U() {
|
|
173
|
+
try {
|
|
174
|
+
let e = JSON.parse(localStorage.getItem(t(H)) ?? "[]");
|
|
175
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!R(e)) : [];
|
|
176
|
+
} catch {
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var W = E(U());
|
|
181
|
+
e(() => {
|
|
182
|
+
W.value = U();
|
|
183
|
+
});
|
|
184
|
+
function G(e, n) {
|
|
185
|
+
let r = z(e);
|
|
186
|
+
if (r) {
|
|
187
|
+
W.value = [r, ...W.value.filter((e) => e !== r)].slice(0, Math.max(n, 0));
|
|
188
|
+
try {
|
|
189
|
+
localStorage.setItem(t(H), JSON.stringify(W.value));
|
|
190
|
+
} catch {}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
var K = [
|
|
194
|
+
"#f44336",
|
|
195
|
+
"#e91e63",
|
|
196
|
+
"#9c27b0",
|
|
197
|
+
"#673ab7",
|
|
198
|
+
"#3f51b5",
|
|
199
|
+
"#2196f3",
|
|
200
|
+
"#03a9f4",
|
|
201
|
+
"#00bcd4",
|
|
202
|
+
"#009688",
|
|
203
|
+
"#4caf50",
|
|
204
|
+
"#8bc34a",
|
|
205
|
+
"#cddc39",
|
|
206
|
+
"#ffeb3b",
|
|
207
|
+
"#ffc107",
|
|
208
|
+
"#ff9800",
|
|
209
|
+
"#ff5722",
|
|
210
|
+
"#795548",
|
|
211
|
+
"#607d8b",
|
|
212
|
+
"#9e9e9e",
|
|
213
|
+
"#000000",
|
|
214
|
+
"#ffffff"
|
|
215
|
+
], se = { class: "flex flex-col gap-4" }, ce = [
|
|
216
|
+
"aria-label",
|
|
217
|
+
"aria-valuenow",
|
|
218
|
+
"aria-valuetext"
|
|
219
|
+
], le = { class: "flex flex-col gap-1" }, ue = ["aria-label", "aria-valuenow"], de = [
|
|
220
|
+
"aria-label",
|
|
221
|
+
"aria-valuenow",
|
|
222
|
+
"aria-valuetext"
|
|
223
|
+
], 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 = [
|
|
224
|
+
"aria-label",
|
|
225
|
+
"value",
|
|
226
|
+
"onInput",
|
|
227
|
+
"onKeydown"
|
|
228
|
+
], ye = { class: "text-label-small text-on-surface-variant" }, be = ["aria-label"], xe = {
|
|
229
|
+
key: 0,
|
|
230
|
+
class: "text-label-medium text-on-surface-variant"
|
|
231
|
+
}, Se = { class: "grid grid-cols-7 gap-2" }, Ce = [
|
|
232
|
+
"aria-label",
|
|
233
|
+
"aria-pressed",
|
|
234
|
+
"onClick"
|
|
235
|
+
], q = 12, we = "repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px", J = /*#__PURE__*/ a(/* @__PURE__ */ v({
|
|
236
|
+
__name: "_MColorPanel",
|
|
237
|
+
props: {
|
|
238
|
+
modelValue: {},
|
|
239
|
+
presets: {},
|
|
240
|
+
alpha: { type: Boolean },
|
|
241
|
+
recent: { type: Boolean },
|
|
242
|
+
eyedropper: { type: Boolean },
|
|
243
|
+
original: {}
|
|
244
|
+
},
|
|
245
|
+
emits: ["update:modelValue"],
|
|
246
|
+
setup(e, { expose: t, emit: a }) {
|
|
247
|
+
let o = e, s = a, l = n(), u = E(0), v = E(100), y = E(100), b = E(1), w = d(() => re(B({
|
|
248
|
+
h: u.value,
|
|
249
|
+
s: v.value,
|
|
250
|
+
v: y.value
|
|
251
|
+
}, o.alpha ? b.value : 1))), D = d(() => re(B({
|
|
252
|
+
h: u.value,
|
|
253
|
+
s: v.value,
|
|
254
|
+
v: y.value
|
|
255
|
+
}))), A = d(() => `hsl(${u.value}, 100%, 50%)`);
|
|
256
|
+
function j(e) {
|
|
257
|
+
let t = ie(e);
|
|
258
|
+
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;
|
|
259
|
+
}
|
|
260
|
+
let M = "";
|
|
261
|
+
function N() {
|
|
262
|
+
M = w.value, w.value !== z(o.modelValue) && s("update:modelValue", w.value);
|
|
263
|
+
}
|
|
264
|
+
te(() => o.modelValue, (e) => {
|
|
265
|
+
let t = z(e);
|
|
266
|
+
t && t !== M && (j(R(t)), M = t);
|
|
267
|
+
}, { immediate: !0 });
|
|
268
|
+
function P(e) {
|
|
269
|
+
let t = R(e);
|
|
270
|
+
t && (j(t), N());
|
|
271
|
+
}
|
|
272
|
+
let F = E(), I = E(), L = E(), H = E(null), U = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
273
|
+
function G(e, t) {
|
|
274
|
+
let n = e === "area" ? F.value : e === "hue" ? I.value : L.value;
|
|
275
|
+
if (!n) return;
|
|
276
|
+
let r = n.getBoundingClientRect();
|
|
277
|
+
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);
|
|
278
|
+
else {
|
|
279
|
+
let n = U((t.clientX - r.left - q) / (r.width - 24), 0, 1);
|
|
280
|
+
e === "hue" ? u.value = n * 360 : b.value = Math.round(n * 100) / 100;
|
|
281
|
+
}
|
|
282
|
+
N();
|
|
283
|
+
}
|
|
284
|
+
function K(e, t) {
|
|
285
|
+
t.button === 0 && (t.preventDefault(), t.currentTarget.focus({ preventScroll: !0 }), t.currentTarget.setPointerCapture?.(t.pointerId), H.value = e, G(e, t));
|
|
286
|
+
}
|
|
287
|
+
function J(e, t) {
|
|
288
|
+
H.value === e && G(e, t);
|
|
289
|
+
}
|
|
290
|
+
function Y() {
|
|
291
|
+
H.value = null;
|
|
292
|
+
}
|
|
293
|
+
function X(e, t) {
|
|
294
|
+
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;
|
|
295
|
+
if (e === "area") {
|
|
296
|
+
if (!r && !i) return;
|
|
297
|
+
v.value = U(v.value + r, 0, 100), y.value = U(y.value + i, 0, 100);
|
|
298
|
+
} else {
|
|
299
|
+
let n = e === "hue" ? 360 : 100, a = e === "hue" ? u.value : b.value * 100, o;
|
|
300
|
+
if (t.key === "Home") o = 0;
|
|
301
|
+
else if (t.key === "End") o = n;
|
|
302
|
+
else if (r || i) o = U(a + (r || i), 0, n);
|
|
303
|
+
else return;
|
|
304
|
+
e === "hue" ? u.value = o : b.value = Math.round(o) / 100;
|
|
305
|
+
}
|
|
306
|
+
t.preventDefault(), N();
|
|
307
|
+
}
|
|
308
|
+
let Te = E(!1);
|
|
309
|
+
C(() => {
|
|
310
|
+
Te.value = "EyeDropper" in window;
|
|
311
|
+
});
|
|
312
|
+
async function Ee() {
|
|
313
|
+
try {
|
|
314
|
+
let e = window.EyeDropper, { sRGBHex: t } = await new e().open(), n = R(t);
|
|
315
|
+
n && (j({
|
|
316
|
+
...n,
|
|
317
|
+
a: b.value
|
|
318
|
+
}), N());
|
|
319
|
+
} catch {}
|
|
320
|
+
}
|
|
321
|
+
let Z = [
|
|
322
|
+
{
|
|
323
|
+
id: "hex",
|
|
324
|
+
label: "HEX"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: "rgb",
|
|
328
|
+
label: "RGB"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "hsl",
|
|
332
|
+
label: "HSL"
|
|
333
|
+
}
|
|
334
|
+
], Q = E("hex"), De = d(() => Z.find((e) => e.id === Q.value).label);
|
|
335
|
+
function Oe() {
|
|
336
|
+
Q.value = Z[(Z.findIndex((e) => e.id === Q.value) + 1) % Z.length].id, $.value = null;
|
|
337
|
+
}
|
|
338
|
+
function ke(e) {
|
|
339
|
+
u.value = e.h, v.value = e.s, y.value = e.v;
|
|
340
|
+
}
|
|
341
|
+
let Ae = d(() => ({
|
|
342
|
+
key: "a",
|
|
343
|
+
label: "A",
|
|
344
|
+
display: String(Math.round(b.value * 100)),
|
|
345
|
+
max: 100,
|
|
346
|
+
apply: (e) => {
|
|
347
|
+
b.value = e / 100;
|
|
348
|
+
}
|
|
349
|
+
})), je = d(() => {
|
|
350
|
+
let e = [];
|
|
351
|
+
if (Q.value === "rgb") {
|
|
352
|
+
let t = B({
|
|
353
|
+
h: u.value,
|
|
354
|
+
s: v.value,
|
|
355
|
+
v: y.value
|
|
356
|
+
}), n = {
|
|
357
|
+
r: Math.round(t.r),
|
|
358
|
+
g: Math.round(t.g),
|
|
359
|
+
b: Math.round(t.b),
|
|
360
|
+
a: b.value
|
|
361
|
+
};
|
|
362
|
+
for (let t of [
|
|
363
|
+
"r",
|
|
364
|
+
"g",
|
|
365
|
+
"b"
|
|
366
|
+
]) e.push({
|
|
367
|
+
key: t,
|
|
368
|
+
label: t.toUpperCase(),
|
|
369
|
+
display: String(n[t]),
|
|
370
|
+
max: 255,
|
|
371
|
+
apply: (e) => j({
|
|
372
|
+
...n,
|
|
373
|
+
[t]: e
|
|
374
|
+
})
|
|
375
|
+
});
|
|
376
|
+
} else if (Q.value === "hsl") {
|
|
377
|
+
let t = ae({
|
|
378
|
+
h: u.value,
|
|
379
|
+
s: v.value,
|
|
380
|
+
v: y.value
|
|
381
|
+
}), n = {
|
|
382
|
+
h: Math.round(t.h),
|
|
383
|
+
s: Math.round(t.s),
|
|
384
|
+
l: Math.round(t.l)
|
|
385
|
+
};
|
|
386
|
+
for (let t of [
|
|
387
|
+
"h",
|
|
388
|
+
"s",
|
|
389
|
+
"l"
|
|
390
|
+
]) e.push({
|
|
391
|
+
key: t,
|
|
392
|
+
label: t.toUpperCase(),
|
|
393
|
+
display: String(n[t]),
|
|
394
|
+
max: t === "h" ? 360 : 100,
|
|
395
|
+
apply: (e) => ke(oe({
|
|
396
|
+
...n,
|
|
397
|
+
[t]: e
|
|
398
|
+
}))
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return o.alpha && Q.value !== "hex" && e.push(Ae.value), e;
|
|
402
|
+
}), $ = E(null), Me = (e, t) => $.value?.key === e ? $.value.text : t;
|
|
403
|
+
function Ne(e) {
|
|
404
|
+
let t = e.target.value;
|
|
405
|
+
$.value = {
|
|
406
|
+
key: "hex",
|
|
407
|
+
text: t
|
|
408
|
+
};
|
|
409
|
+
let n = R(t);
|
|
410
|
+
n && (j(n), N());
|
|
411
|
+
}
|
|
412
|
+
function Pe(e, t) {
|
|
413
|
+
let n = t.target.value;
|
|
414
|
+
if ($.value = {
|
|
415
|
+
key: e.key,
|
|
416
|
+
text: n
|
|
417
|
+
}, !/^\d+$/.test(n.trim())) return;
|
|
418
|
+
let r = Number(n);
|
|
419
|
+
r > e.max || (e.apply(r), N());
|
|
420
|
+
}
|
|
421
|
+
function Fe(e, t) {
|
|
422
|
+
if (t.key === "Enter") {
|
|
423
|
+
$.value = null;
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (t.key !== "ArrowUp" && t.key !== "ArrowDown") return;
|
|
427
|
+
t.preventDefault();
|
|
428
|
+
let n = (t.shiftKey ? 10 : 1) * (t.key === "ArrowUp" ? 1 : -1);
|
|
429
|
+
e.apply(U(Number(e.display) + n, 0, e.max)), $.value = null, N();
|
|
430
|
+
}
|
|
431
|
+
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);
|
|
432
|
+
return t({ focus: () => F.value?.focus({ preventScroll: !0 }) }), (t, n) => (T(), m("div", se, [
|
|
433
|
+
h("div", {
|
|
434
|
+
ref_key: "areaEl",
|
|
435
|
+
ref: F,
|
|
436
|
+
role: "slider",
|
|
437
|
+
tabindex: "0",
|
|
438
|
+
"aria-label": `${k(l).colorSaturation}, ${k(l).colorBrightness}`,
|
|
439
|
+
"aria-valuenow": Math.round(v.value),
|
|
440
|
+
"aria-valuemin": "0",
|
|
441
|
+
"aria-valuemax": "100",
|
|
442
|
+
"aria-valuetext": `${k(l).colorSaturation} ${Math.round(v.value)}%, ${k(l).colorBrightness} ${Math.round(y.value)}%`,
|
|
443
|
+
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",
|
|
444
|
+
style: S({ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${A.value})` }),
|
|
445
|
+
onPointerdown: n[0] ||= (e) => K("area", e),
|
|
446
|
+
onPointermove: n[1] ||= (e) => J("area", e),
|
|
447
|
+
onPointerup: Y,
|
|
448
|
+
onPointercancel: Y,
|
|
449
|
+
onKeydown: n[2] ||= (e) => X("area", e)
|
|
450
|
+
}, [h("span", {
|
|
451
|
+
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" : ""]),
|
|
452
|
+
style: S({
|
|
453
|
+
left: `${v.value}%`,
|
|
454
|
+
top: `${100 - y.value}%`,
|
|
455
|
+
backgroundColor: D.value
|
|
456
|
+
})
|
|
457
|
+
}, null, 6)], 44, ce),
|
|
458
|
+
h("div", le, [h("div", {
|
|
459
|
+
ref_key: "hueEl",
|
|
460
|
+
ref: I,
|
|
461
|
+
role: "slider",
|
|
462
|
+
tabindex: "0",
|
|
463
|
+
"aria-label": k(l).colorHue,
|
|
464
|
+
"aria-valuenow": Math.round(u.value),
|
|
465
|
+
"aria-valuemin": "0",
|
|
466
|
+
"aria-valuemax": "360",
|
|
467
|
+
class: "m3-cp-slider group",
|
|
468
|
+
onPointerdown: n[3] ||= (e) => K("hue", e),
|
|
469
|
+
onPointermove: n[4] ||= (e) => J("hue", e),
|
|
470
|
+
onPointerup: Y,
|
|
471
|
+
onPointercancel: Y,
|
|
472
|
+
onKeydown: n[5] ||= (e) => X("hue", e)
|
|
473
|
+
}, [n[13] ||= h("span", { class: "m3-cp-track m3-cp-hue" }, null, -1), h("span", {
|
|
474
|
+
class: x(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "hue" }]),
|
|
475
|
+
style: S({ left: `calc(${q}px + ${u.value / 360} * (100% - 24px))` })
|
|
476
|
+
}, null, 6)], 40, ue), e.alpha ? (T(), m("div", {
|
|
477
|
+
key: 0,
|
|
478
|
+
ref_key: "alphaEl",
|
|
479
|
+
ref: L,
|
|
480
|
+
role: "slider",
|
|
481
|
+
tabindex: "0",
|
|
482
|
+
"aria-label": k(l).colorAlpha,
|
|
483
|
+
"aria-valuenow": Math.round(b.value * 100),
|
|
484
|
+
"aria-valuemin": "0",
|
|
485
|
+
"aria-valuemax": "100",
|
|
486
|
+
"aria-valuetext": `${Math.round(b.value * 100)}%`,
|
|
487
|
+
class: "m3-cp-slider group",
|
|
488
|
+
onPointerdown: n[6] ||= (e) => K("alpha", e),
|
|
489
|
+
onPointermove: n[7] ||= (e) => J("alpha", e),
|
|
490
|
+
onPointerup: Y,
|
|
491
|
+
onPointercancel: Y,
|
|
492
|
+
onKeydown: n[8] ||= (e) => X("alpha", e)
|
|
493
|
+
}, [h("span", {
|
|
494
|
+
class: "m3-cp-track",
|
|
495
|
+
style: S({ background: `linear-gradient(to right, transparent, ${D.value}), ${we}` })
|
|
496
|
+
}, null, 4), h("span", {
|
|
497
|
+
class: x(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "alpha" }]),
|
|
498
|
+
style: S({ left: `calc(${q}px + ${b.value} * (100% - 24px))` })
|
|
499
|
+
}, null, 6)], 40, de)) : p("", !0)]),
|
|
500
|
+
h("div", fe, [h("div", pe, [Be.value ? (T(), m("button", {
|
|
501
|
+
key: 0,
|
|
502
|
+
type: "button",
|
|
503
|
+
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",
|
|
504
|
+
style: S({ background: Re(e.original) }),
|
|
505
|
+
"aria-label": k(l).colorOriginal,
|
|
506
|
+
title: k(l).colorOriginal,
|
|
507
|
+
onClick: n[9] ||= (t) => P(e.original)
|
|
508
|
+
}, [_(i, {
|
|
509
|
+
name: "undo",
|
|
510
|
+
size: 18,
|
|
511
|
+
style: S({ color: k(V)(e.original) })
|
|
512
|
+
}, null, 8, ["style"])], 12, me)) : p("", !0), h("span", {
|
|
513
|
+
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"]),
|
|
514
|
+
style: S({
|
|
515
|
+
background: Re(w.value),
|
|
516
|
+
color: ze.value
|
|
517
|
+
})
|
|
518
|
+
}, O(w.value), 7)]), e.eyedropper && Te.value ? (T(), f(r, {
|
|
519
|
+
key: 0,
|
|
520
|
+
icon: "colorize",
|
|
521
|
+
variant: "tonal",
|
|
522
|
+
label: k(l).colorEyedropper,
|
|
523
|
+
onClick: Ee
|
|
524
|
+
}, null, 8, ["label"])) : p("", !0)]),
|
|
525
|
+
h("div", he, [
|
|
526
|
+
h("button", {
|
|
527
|
+
type: "button",
|
|
528
|
+
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",
|
|
529
|
+
"aria-label": `${k(l).colorFormat}: ${De.value}`,
|
|
530
|
+
onClick: Oe
|
|
531
|
+
}, [g(O(De.value) + " ", 1), _(i, {
|
|
532
|
+
name: "unfold_more",
|
|
533
|
+
size: 18
|
|
534
|
+
})], 8, ge),
|
|
535
|
+
Q.value === "hex" ? (T(), m("input", {
|
|
536
|
+
key: 0,
|
|
537
|
+
type: "text",
|
|
538
|
+
spellcheck: "false",
|
|
539
|
+
autocomplete: "off",
|
|
540
|
+
maxlength: e.alpha ? 9 : 7,
|
|
541
|
+
"aria-label": "HEX",
|
|
542
|
+
value: Me("hex", w.value),
|
|
543
|
+
class: "m3-cp-field min-w-0 flex-1 font-mono text-body-medium",
|
|
544
|
+
onInput: Ne,
|
|
545
|
+
onBlur: n[10] ||= (e) => $.value = null,
|
|
546
|
+
onKeydown: n[11] ||= ne((e) => $.value = null, ["enter"])
|
|
547
|
+
}, null, 40, _e)) : p("", !0),
|
|
548
|
+
(T(!0), m(c, null, ee(je.value, (e) => (T(), m("label", {
|
|
549
|
+
key: e.key,
|
|
550
|
+
class: "flex min-w-0 flex-1 flex-col items-center gap-1"
|
|
551
|
+
}, [h("input", {
|
|
552
|
+
type: "text",
|
|
553
|
+
inputmode: "numeric",
|
|
554
|
+
autocomplete: "off",
|
|
555
|
+
maxlength: 3,
|
|
556
|
+
"aria-label": e.label,
|
|
557
|
+
value: Me(e.key, e.display),
|
|
558
|
+
class: "m3-cp-field w-full font-mono text-body-medium",
|
|
559
|
+
onInput: (t) => Pe(e, t),
|
|
560
|
+
onKeydown: (t) => Fe(e, t),
|
|
561
|
+
onBlur: n[12] ||= (e) => $.value = null
|
|
562
|
+
}, null, 40, ve), h("span", ye, O(e.label), 1)]))), 128))
|
|
563
|
+
]),
|
|
564
|
+
(T(!0), m(c, null, ee([{
|
|
565
|
+
id: "recent",
|
|
566
|
+
label: k(l).colorRecent,
|
|
567
|
+
colors: Ie.value
|
|
568
|
+
}, {
|
|
569
|
+
id: "presets",
|
|
570
|
+
label: k(l).colorPresets,
|
|
571
|
+
colors: e.presets
|
|
572
|
+
}], (e) => (T(), m(c, { key: e.id }, [e.colors.length ? (T(), m("div", {
|
|
573
|
+
key: 0,
|
|
574
|
+
role: "group",
|
|
575
|
+
"aria-label": e.label,
|
|
576
|
+
class: "flex flex-col gap-2"
|
|
577
|
+
}, [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", {
|
|
578
|
+
key: e,
|
|
579
|
+
type: "button",
|
|
580
|
+
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) }]),
|
|
581
|
+
style: S({ background: Re(e) }),
|
|
582
|
+
"aria-label": e,
|
|
583
|
+
"aria-pressed": Le(e),
|
|
584
|
+
onClick: (t) => P(e)
|
|
585
|
+
}, [Le(e) ? (T(), f(i, {
|
|
586
|
+
key: 0,
|
|
587
|
+
name: "check",
|
|
588
|
+
size: 18,
|
|
589
|
+
style: S({ color: k(V)(e) })
|
|
590
|
+
}, null, 8, ["style"])) : p("", !0)], 14, Ce))), 128))])], 8, be)) : p("", !0)], 64))), 128))
|
|
591
|
+
]));
|
|
592
|
+
}
|
|
593
|
+
}), [["__scopeId", "data-v-87647feb"]]), Y = /* @__PURE__ */ v({
|
|
594
|
+
__name: "MColorPickerModal",
|
|
595
|
+
props: {
|
|
596
|
+
modelValue: {},
|
|
597
|
+
show: {
|
|
598
|
+
type: Boolean,
|
|
599
|
+
default: !1
|
|
600
|
+
},
|
|
601
|
+
presets: { default: () => K },
|
|
602
|
+
title: {},
|
|
603
|
+
alpha: {
|
|
604
|
+
type: Boolean,
|
|
605
|
+
default: !1
|
|
606
|
+
},
|
|
607
|
+
recent: {
|
|
608
|
+
type: Boolean,
|
|
609
|
+
default: !0
|
|
610
|
+
},
|
|
611
|
+
recentLimit: { default: 7 },
|
|
612
|
+
eyedropper: {
|
|
613
|
+
type: Boolean,
|
|
614
|
+
default: !0
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
emits: ["update:modelValue", "update:show"],
|
|
618
|
+
setup(e, { emit: t }) {
|
|
619
|
+
let r = e, i = n(), a = t, c = E(r.modelValue);
|
|
620
|
+
te(() => r.show, (e) => {
|
|
621
|
+
e && (c.value = r.modelValue);
|
|
622
|
+
}, { immediate: !0 });
|
|
623
|
+
function l() {
|
|
624
|
+
a("update:show", !1);
|
|
625
|
+
}
|
|
626
|
+
function u() {
|
|
627
|
+
let e = z(c.value) || c.value;
|
|
628
|
+
r.recent && G(e, r.recentLimit), a("update:modelValue", e), a("update:show", !1);
|
|
629
|
+
}
|
|
630
|
+
return (t, n) => (T(), f(o, {
|
|
631
|
+
"model-value": e.show,
|
|
632
|
+
title: e.title || k(i).selectColor,
|
|
633
|
+
"max-width": "328px",
|
|
634
|
+
closable: !1,
|
|
635
|
+
"onUpdate:modelValue": n[1] ||= (e) => !e && l()
|
|
636
|
+
}, {
|
|
637
|
+
actions: A(() => [_(s, {
|
|
638
|
+
variant: "text",
|
|
639
|
+
onClick: l
|
|
640
|
+
}, {
|
|
641
|
+
default: A(() => [g(O(k(i).cancel), 1)]),
|
|
642
|
+
_: 1
|
|
643
|
+
}), _(s, {
|
|
644
|
+
variant: "text",
|
|
645
|
+
onClick: u
|
|
646
|
+
}, {
|
|
647
|
+
default: A(() => [g(O(k(i).confirm), 1)]),
|
|
648
|
+
_: 1
|
|
649
|
+
})]),
|
|
650
|
+
default: A(() => [_(J, {
|
|
651
|
+
modelValue: c.value,
|
|
652
|
+
"onUpdate:modelValue": n[0] ||= (e) => c.value = e,
|
|
653
|
+
presets: e.presets,
|
|
654
|
+
alpha: e.alpha,
|
|
655
|
+
recent: e.recent,
|
|
656
|
+
eyedropper: e.eyedropper,
|
|
657
|
+
original: e.modelValue
|
|
658
|
+
}, null, 8, [
|
|
659
|
+
"modelValue",
|
|
660
|
+
"presets",
|
|
661
|
+
"alpha",
|
|
662
|
+
"recent",
|
|
663
|
+
"eyedropper",
|
|
664
|
+
"original"
|
|
665
|
+
])]),
|
|
666
|
+
_: 1
|
|
667
|
+
}, 8, ["model-value", "title"]));
|
|
668
|
+
}
|
|
669
|
+
}), X = {
|
|
670
|
+
key: 0,
|
|
671
|
+
class: "px-4 pt-3 pb-1 text-title-small font-medium text-on-surface-variant"
|
|
672
|
+
}, Te = { class: "px-4 py-2 text-body-medium text-on-surface-variant" }, Ee = {
|
|
673
|
+
key: 1,
|
|
674
|
+
class: "flex justify-end gap-2 px-4 pb-3"
|
|
675
|
+
}, Z = /* @__PURE__ */ v({
|
|
676
|
+
inheritAttrs: !1,
|
|
677
|
+
__name: "MTooltip",
|
|
678
|
+
props: {
|
|
679
|
+
text: {},
|
|
680
|
+
placement: { default: "top" },
|
|
681
|
+
delay: { default: 600 },
|
|
682
|
+
rich: {
|
|
683
|
+
type: Boolean,
|
|
684
|
+
default: !1
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
setup(e) {
|
|
688
|
+
let t = e, n = E(!1), r = E(), i = E(), a = E({}), o;
|
|
689
|
+
async function s() {
|
|
690
|
+
n.value = !0, await b(), v();
|
|
691
|
+
}
|
|
692
|
+
function d() {
|
|
693
|
+
t.rich && o?.cancel();
|
|
694
|
+
}
|
|
695
|
+
function g() {
|
|
696
|
+
t.rich && o?.closeNow();
|
|
697
|
+
}
|
|
698
|
+
function v() {
|
|
699
|
+
if (!i.value || !r.value) return;
|
|
700
|
+
let { top: e, left: n } = I(i.value, r.value, t.placement);
|
|
701
|
+
a.value = {
|
|
702
|
+
top: `${e}px`,
|
|
703
|
+
left: `${n}px`
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
return C(() => {
|
|
707
|
+
o = L(i.value, {
|
|
708
|
+
delay: () => t.delay,
|
|
709
|
+
rich: () => t.rich,
|
|
710
|
+
visible: () => n.value,
|
|
711
|
+
open: s,
|
|
712
|
+
close: () => {
|
|
713
|
+
n.value = !1;
|
|
714
|
+
},
|
|
715
|
+
tip: () => r.value
|
|
716
|
+
});
|
|
717
|
+
}), w(() => o?.destroy()), (t, o) => (T(), m(c, null, [h("span", y({
|
|
718
|
+
ref_key: "triggerEl",
|
|
719
|
+
ref: i
|
|
720
|
+
}, t.$attrs, { class: "inline-flex" }), [D(t.$slots, "default")], 16), (T(), f(l, { to: "body" }, [_(u, {
|
|
721
|
+
"enter-active-class": "transition-opacity duration-150",
|
|
722
|
+
"enter-from-class": "opacity-0",
|
|
723
|
+
"enter-to-class": "opacity-100",
|
|
724
|
+
"leave-active-class": "transition-opacity duration-100",
|
|
725
|
+
"leave-from-class": "opacity-100",
|
|
726
|
+
"leave-to-class": "opacity-0"
|
|
727
|
+
}, {
|
|
728
|
+
default: A(() => [n.value && !e.rich && e.text ? (T(), m("div", {
|
|
729
|
+
key: 0,
|
|
730
|
+
ref_key: "tipEl",
|
|
731
|
+
ref: r,
|
|
732
|
+
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",
|
|
733
|
+
style: S(a.value),
|
|
734
|
+
role: "tooltip"
|
|
735
|
+
}, O(e.text), 5)) : n.value && e.rich ? (T(), m("div", {
|
|
736
|
+
key: 1,
|
|
737
|
+
ref_key: "tipEl",
|
|
738
|
+
ref: r,
|
|
739
|
+
class: "fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-2",
|
|
740
|
+
style: S(a.value),
|
|
741
|
+
role: "tooltip",
|
|
742
|
+
onMouseenter: d,
|
|
743
|
+
onMouseleave: g
|
|
744
|
+
}, [
|
|
745
|
+
e.text ? (T(), m("div", X, O(e.text), 1)) : p("", !0),
|
|
746
|
+
h("div", Te, [D(t.$slots, "content")]),
|
|
747
|
+
t.$slots.actions ? (T(), m("div", Ee, [D(t.$slots, "actions")])) : p("", !0)
|
|
748
|
+
], 36)) : p("", !0)]),
|
|
749
|
+
_: 3
|
|
750
|
+
})]))], 64));
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
//#endregion
|
|
754
|
+
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 };
|
|
755
|
+
|
|
756
|
+
//# sourceMappingURL=MTooltip-CodJGEO-.js.map
|