@templatical/editor 0.0.6 → 0.1.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/LICENSE +56 -0
- package/README.md +69 -0
- package/dist/{AiChatSidebar-CNhSl_ty.js → AiChatSidebar-DgAjDWO1.js} +68 -68
- package/dist/{AiFeatureMenu-BFVsjUJY.js → AiFeatureMenu-j6oaiRVi.js} +25 -25
- package/dist/{CloudEditor-Bz5Xkxej.js → CloudEditor-yCOkIkZ-.js} +428 -437
- package/dist/{CollaboratorBar-D2Gu5Xj2.js → CollaboratorBar-CWVdp2Y6.js} +23 -23
- package/dist/CommentsSidebar-CSPHhbQH.js +439 -0
- package/dist/CountdownBlock-DK6P_RaQ.js +92 -0
- package/dist/CountdownToolbar-Dv-Sz4ui.js +210 -0
- package/dist/{DesignReferenceSidebar-u2tKSQK0.js → DesignReferenceSidebar-D7zfvux6.js} +58 -58
- package/dist/LoadingTrack-Cdz2SSq9.js +10 -0
- package/dist/ModuleBrowserModal-BLYuCZht.js +205 -0
- package/dist/ModulePreviewCanvas-CHYqP6K3.js +106 -0
- package/dist/NumberWithSuffix-D-5-AZc3.js +424 -0
- package/dist/{ParagraphEditor-CYrzYJO5.js → ParagraphEditor-DivLBNWv.js} +237 -236
- package/dist/{RichTextEditorContent-BeqlWlWB.js → RichTextEditorContent-G1lXgVJR.js} +42 -42
- package/dist/{SaveModuleDialog-Kde6X13X.js → SaveModuleDialog-DGVfiOmE.js} +29 -29
- package/dist/{SnapshotHistory-B3EfIcLW.js → SnapshotHistory-DM__MqSu.js} +38 -38
- package/dist/{TemplateScoringPanel-D2vCRGgx.js → TemplateScoringPanel-CW13Tlol.js} +80 -80
- package/dist/{TestEmailModal-Egk0DFDf.js → TestEmailModal-B8bYqWCY.js} +28 -28
- package/dist/TitleEditor-4Jrp3C4m.js +167 -0
- package/dist/{TplModal-BCruYWks.js → TplModal-BkoIz0oz.js} +14 -14
- package/dist/{_plugin-vue_export-helper-5TQrnOhO.js → _plugin-vue_export-helper-OO6pH1Dh.js} +11 -11
- package/dist/{blockTypeIcons-rW4BUUNC.js → blockTypeIcons-4AS3CvXn.js} +2 -2
- package/dist/cdn/chunks/{AiFeatureMenu-Dcbshcfu.js → AiFeatureMenu-BcHyzTQy.js} +4 -4
- package/dist/cdn/chunks/{AiFeatureMenu-Dcbshcfu.js.map → AiFeatureMenu-BcHyzTQy.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-Bca3RyBW.js → CloudEditor-TaEZq-YW.js} +179 -188
- package/dist/cdn/chunks/CloudEditor-TaEZq-YW.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-sToKJfHi.js → CollaboratorBar-DbC5-3If.js} +4 -4
- package/dist/cdn/chunks/{CollaboratorBar-sToKJfHi.js.map → CollaboratorBar-DbC5-3If.js.map} +1 -1
- package/dist/cdn/chunks/CountdownBlock-CfPmCQ7j.js +93 -0
- package/dist/cdn/chunks/CountdownBlock-CfPmCQ7j.js.map +1 -0
- package/dist/cdn/chunks/CountdownToolbar-CB0EVxwN.js +212 -0
- package/dist/cdn/chunks/CountdownToolbar-CB0EVxwN.js.map +1 -0
- package/dist/cdn/chunks/{ModuleBrowserModal-BNhwXbWw.js → ModuleBrowserModal-Df2fp9dj.js} +7 -7
- package/dist/cdn/chunks/{ModuleBrowserModal-BNhwXbWw.js.map → ModuleBrowserModal-Df2fp9dj.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-DylUylPU.js → ModulePreviewCanvas-Dw1OCpvV.js} +19 -19
- package/dist/cdn/chunks/{ModulePreviewCanvas-DylUylPU.js.map → ModulePreviewCanvas-Dw1OCpvV.js.map} +1 -1
- package/dist/cdn/chunks/NumberWithSuffix-BU6ycXyG.js +425 -0
- package/dist/cdn/chunks/NumberWithSuffix-BU6ycXyG.js.map +1 -0
- package/dist/cdn/chunks/{ParagraphEditor-BBw90y_p.js → ParagraphEditor-BMRNg_BX.js} +37 -37
- package/dist/cdn/chunks/{ParagraphEditor-BBw90y_p.js.map → ParagraphEditor-BMRNg_BX.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-DvyIO3nR.js → RichTextEditorContent-BKYY1YMZ.js} +5 -5
- package/dist/cdn/chunks/{RichTextEditorContent-DvyIO3nR.js.map → RichTextEditorContent-BKYY1YMZ.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-DvbSHvhF.js → SaveModuleDialog-D977Tg7t.js} +5 -5
- package/dist/cdn/chunks/{SaveModuleDialog-DvbSHvhF.js.map → SaveModuleDialog-D977Tg7t.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-tS3mgoVr.js → TitleEditor-q9IzNy38.js} +11 -11
- package/dist/cdn/chunks/{TitleEditor-tS3mgoVr.js.map → TitleEditor-q9IzNy38.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-DbnbyEQE.js → blockTypeIcons-L0fRc3qs.js} +3 -3
- package/dist/cdn/chunks/{blockTypeIcons-DbnbyEQE.js.map → blockTypeIcons-L0fRc3qs.js.map} +1 -1
- package/dist/cdn/chunks/{de-CgUR_S5I.js → de-3exf7MYE.js} +1 -1
- package/dist/cdn/chunks/{de-CgUR_S5I.js.map → de-3exf7MYE.js.map} +1 -1
- package/dist/cdn/chunks/{de-D8oDPhBD.js → de-C8LxVUsb.js} +1 -1
- package/dist/cdn/chunks/{de-D8oDPhBD.js.map → de-C8LxVUsb.js.map} +1 -1
- package/dist/cdn/chunks/{dist-BUmN5e4r.js → dist-D5g00M8N.js} +6 -2
- package/dist/cdn/chunks/dist-D5g00M8N.js.map +1 -0
- package/dist/cdn/chunks/{draggable-m78lz0gI.js → draggable-Bcb86AsV.js} +5 -5
- package/dist/cdn/chunks/draggable-Bcb86AsV.js.map +1 -0
- package/dist/cdn/chunks/{emojiData-CNNgvDqx.js → emojiData-DUHzsh4j.js} +1 -1
- package/dist/cdn/chunks/{emojiData-CNNgvDqx.js.map → emojiData-DUHzsh4j.js.map} +1 -1
- package/dist/cdn/chunks/{en-HseRPPeK.js → en-BoEycuqw.js} +1 -1
- package/dist/cdn/chunks/{en-HseRPPeK.js.map → en-BoEycuqw.js.map} +1 -1
- package/dist/cdn/chunks/{en-BBmfBDqY.js → en-KNPUKxYp.js} +1 -1
- package/dist/cdn/chunks/{en-BBmfBDqY.js.map → en-KNPUKxYp.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-ClpY3m0W.js → extensions-BZ1POyiv.js} +11 -11
- package/dist/cdn/chunks/{extensions-ClpY3m0W.js.map → extensions-BZ1POyiv.js.map} +1 -1
- package/dist/cdn/chunks/{features-B5dGxWLi.js → features-Ccqmm6-M.js} +549 -627
- package/dist/cdn/chunks/features-Ccqmm6-M.js.map +1 -0
- package/dist/cdn/chunks/{icons-hflTyPmb.js → icons-x53__2GC.js} +8 -8
- package/dist/cdn/chunks/icons-x53__2GC.js.map +1 -0
- package/dist/cdn/chunks/{liquid.browser-BxyRVCKv.js → liquid.browser-CEMn-ZqL.js} +2 -2
- package/dist/cdn/chunks/liquid.browser-CEMn-ZqL.js.map +1 -0
- package/dist/cdn/chunks/{media-library-Dgy-V-JA.js → media-library-DUoQk-w7.js} +97 -97
- package/dist/cdn/chunks/media-library-DUoQk-w7.js.map +1 -0
- package/dist/cdn/chunks/{pusher-D-m2WSdL.js → pusher-DwSQn6BA.js} +2 -2
- package/dist/cdn/chunks/pusher-DwSQn6BA.js.map +1 -0
- package/dist/cdn/chunks/{src-TDwMmqm0.js → src-DskCIAr8.js} +8 -8
- package/dist/cdn/chunks/{src-TDwMmqm0.js.map → src-DskCIAr8.js.map} +1 -1
- package/dist/cdn/chunks/{styleConstants-DFe3I4Op.js → styleConstants-DP1VOca8.js} +1 -1
- package/dist/cdn/chunks/{styleConstants-DFe3I4Op.js.map → styleConstants-DP1VOca8.js.map} +1 -1
- package/dist/cdn/chunks/{styles-hCOCOR6K.js → styles-BIlpNe52.js} +622 -1238
- package/dist/cdn/chunks/styles-BIlpNe52.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-C28NLMX8.js → tiptap-hPC_BgDO.js} +850 -826
- package/dist/cdn/chunks/tiptap-hPC_BgDO.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +92 -97
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-B5S-C0bz.js → check-Bff5NzCh.js} +1 -1
- package/dist/{chevron-down-CjsV1T0W.js → chevron-down-Bbv4SJwx.js} +1 -1
- package/dist/{circle-alert-CVTmJHKW.js → circle-alert-Dpr8MgkR.js} +1 -1
- package/dist/{clock-CAjdSHBy.js → clock-raVPKfl4.js} +1 -1
- package/dist/{dist-DJrDTuRr.js → dist-BHgEdO-M.js} +1001 -983
- package/dist/dist-BibwE8Y0.js +5 -0
- package/dist/{dist-DPM-DFvh.js → dist-BnlZ_HwX.js} +340 -340
- package/dist/{dist-BTtKPcd2.js → dist-C9yhcxsf.js} +2 -2
- package/dist/{dist-COguaIvm.js → dist-CGffNO8z.js} +2 -2
- package/dist/dist-CfGpCUSx.js +5 -0
- package/dist/{dist-COOFiBFV.js → dist-Chd-H2S3.js} +5 -5
- package/dist/{dist-DfqLGwSF.js → dist-Cq0OFLMj.js} +2 -2
- package/dist/{dist-B4LTlrAn.js → dist-D42og5Sc.js} +191 -185
- package/dist/{dist-CBr-qhie.js → dist-Owxo48fF.js} +2 -2
- package/dist/{dist-Crqkuf-w.js → dist-UZ8UzVZ-.js} +15 -15
- package/dist/dist-n0PkFNGl.js +314 -0
- package/dist/{dist-DHYuVJ_7.js → dist-skgH9dyo.js} +2 -2
- package/dist/{extensions-C6xp_B7K.js → extensions-DQKaICBH.js} +81 -81
- package/dist/{image-up-vZa1Txr-.js → image-up-B1AEiHCh.js} +1 -1
- package/dist/index.d.ts +17 -6
- package/dist/{keys-C0MQRs8d.js → keys-CIw9mUI2.js} +1 -1
- package/dist/{liquid.browser-C02owkex.js → liquid.browser-Bm53dnK1.js} +1 -1
- package/dist/{loader-circle-DilFjHSk.js → loader-circle-BYeKJ3to.js} +1 -1
- package/dist/{message-circle-Dpcnc2oa.js → message-circle-PhNlI7e7.js} +1 -1
- package/dist/{refresh-cw-4r7rkHHX.js → refresh-cw-DhDYRBDd.js} +1 -1
- package/dist/{rolldown-runtime-gEudmnaM.js → rolldown-runtime-BZGGJVDF.js} +2 -5
- package/dist/{scan-line-684IxPQ0.js → scan-line-Bw8bauvt.js} +1 -1
- package/dist/{send-ChDw64yL.js → send-CJPSzbLO.js} +1 -1
- package/dist/{shield-check-9dhLdyST.js → shield-check-DdEvVYMH.js} +1 -1
- package/dist/{sparkles-Co9fkDcv.js → sparkles-DT_27AYs.js} +1 -1
- package/dist/style.css +2 -0
- package/dist/{styleConstants-RV3eYwkD.js → styleConstants-Dqz9z3aa.js} +6 -45
- package/dist/styles-tcwlvlEB.js +2942 -0
- package/dist/templatical-editor.js +114 -119
- package/dist/text-align-start-4Hx15GUf.js +43 -0
- package/dist/{trash-2-CZkMtjeC.js → trash-2-BY-xp5hg.js} +1 -1
- package/dist/{triangle-alert-Dvt51agD.js → triangle-alert-DG72vdb2.js} +1 -1
- package/dist/useEditorCore-DMH2QpUL.js +8946 -0
- package/dist/{useI18n-D6m7ZUgY.js → useI18n-B8CN2iWs.js} +4 -4
- package/dist/{useMergeTag-CSXcnFBc.js → useMergeTag-Dz_Dx2Jz.js} +3 -3
- package/dist/vue.runtime.esm-bundler-DryoQb-v.js +5775 -0
- package/dist/{x-CU2XZOkQ.js → x-D-7GkO6Z.js} +1 -1
- package/package.json +31 -15
- package/dist/CommentsSidebar-CTeEAZTj.js +0 -439
- package/dist/LoadingTrack--aUassFH.js +0 -10
- package/dist/ModuleBrowserModal-DNxODPlX.js +0 -205
- package/dist/ModulePreviewCanvas-DnGe1Y-2.js +0 -106
- package/dist/TitleEditor-DwUpo4gF.js +0 -167
- package/dist/cdn/chunks/CloudEditor-Bca3RyBW.js.map +0 -1
- package/dist/cdn/chunks/dist-BUmN5e4r.js.map +0 -1
- package/dist/cdn/chunks/draggable-m78lz0gI.js.map +0 -1
- package/dist/cdn/chunks/features-B5dGxWLi.js.map +0 -1
- package/dist/cdn/chunks/icons-hflTyPmb.js.map +0 -1
- package/dist/cdn/chunks/liquid.browser-BxyRVCKv.js.map +0 -1
- package/dist/cdn/chunks/media-library-Dgy-V-JA.js.map +0 -1
- package/dist/cdn/chunks/pusher-D-m2WSdL.js.map +0 -1
- package/dist/cdn/chunks/styles-hCOCOR6K.js.map +0 -1
- package/dist/cdn/chunks/tiptap-C28NLMX8.js.map +0 -1
- package/dist/dist-Ac4o1O4a.js +0 -314
- package/dist/dist-DEJZ9iAU.js +0 -5
- package/dist/dist-DmVOCJjI.js +0 -5
- package/dist/styles-nvxFh6L6.js +0 -3557
- package/dist/templatical-editor.css +0 -2
- package/dist/templatical-editor.umd.cjs +0 -178
- package/dist/useEditorCore-ColJh1ST.js +0 -5695
- /package/dist/cdn/chunks/{_rolldown_dynamic_import_helper-DMEI4TQ3.js → _rolldown_dynamic_import_helper-BRcA6nWq.js} +0 -0
- /package/dist/{de-Dh8ON-dm.js → de-CN0xu_Tp.js} +0 -0
- /package/dist/{emojiData-Qc8mH_zW.js → emojiData-CwKEDxVf.js} +0 -0
- /package/dist/{en-C7IShRSD.js → en-DXvHkaUF.js} +0 -0
- /package/dist/{formatRelativeTime-D8f6NR7i.js → formatRelativeTime-BSpx5DHC.js} +0 -0
- /package/dist/{readableTextColor-B809bF5J.js → readableTextColor-CYCxm1jQ.js} +0 -0
- /package/dist/{timeouts-CmBrLeZA.js → timeouts-BSGxjuUF.js} +0 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { Ct as e, F as t, L as n, M as r, Ot as i, P as a, S as o, V as s, Y as c, _ as l, b as ee, d as u, g as d, h as f, l as p, m, p as h, t as te, tt as g, wt as _ } from "./vue.runtime.esm-bundler-DryoQb-v.js";
|
|
2
|
+
import { t as v } from "./dist-n0PkFNGl.js";
|
|
3
|
+
import { t as y } from "./useI18n-B8CN2iWs.js";
|
|
4
|
+
import { h as b, i as x, m as S, p as C, u as w } from "./styleConstants-Dqz9z3aa.js";
|
|
5
|
+
//#region ../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/math.js
|
|
6
|
+
var T = (e, t = 0, n = 1) => e > n ? n : e < t ? t : e, E = (e, t = 0, n = 10 ** t) => Math.round(n * e) / n;
|
|
7
|
+
360 / (Math.PI * 2);
|
|
8
|
+
var ne = (e) => j(D(e)), D = (e) => (e[0] === "#" && (e = e.substring(1)), e.length < 6 ? {
|
|
9
|
+
r: parseInt(e[0] + e[0], 16),
|
|
10
|
+
g: parseInt(e[1] + e[1], 16),
|
|
11
|
+
b: parseInt(e[2] + e[2], 16),
|
|
12
|
+
a: e.length === 4 ? E(parseInt(e[3] + e[3], 16) / 255, 2) : 1
|
|
13
|
+
} : {
|
|
14
|
+
r: parseInt(e.substring(0, 2), 16),
|
|
15
|
+
g: parseInt(e.substring(2, 4), 16),
|
|
16
|
+
b: parseInt(e.substring(4, 6), 16),
|
|
17
|
+
a: e.length === 8 ? E(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
|
|
18
|
+
}), re = (e) => A(ae(e)), ie = ({ h: e, s: t, v: n, a: r }) => {
|
|
19
|
+
let i = (200 - t) * n / 100;
|
|
20
|
+
return {
|
|
21
|
+
h: E(e),
|
|
22
|
+
s: E(i > 0 && i < 200 ? t * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
|
|
23
|
+
l: E(i / 2),
|
|
24
|
+
a: E(r, 2)
|
|
25
|
+
};
|
|
26
|
+
}, O = (e) => {
|
|
27
|
+
let { h: t, s: n, l: r } = ie(e);
|
|
28
|
+
return `hsl(${t}, ${n}%, ${r}%)`;
|
|
29
|
+
}, ae = ({ h: e, s: t, v: n, a: r }) => {
|
|
30
|
+
e = e / 360 * 6, t /= 100, n /= 100;
|
|
31
|
+
let i = Math.floor(e), a = n * (1 - t), o = n * (1 - (e - i) * t), s = n * (1 - (1 - e + i) * t), c = i % 6;
|
|
32
|
+
return {
|
|
33
|
+
r: E([
|
|
34
|
+
n,
|
|
35
|
+
o,
|
|
36
|
+
a,
|
|
37
|
+
a,
|
|
38
|
+
s,
|
|
39
|
+
n
|
|
40
|
+
][c] * 255),
|
|
41
|
+
g: E([
|
|
42
|
+
s,
|
|
43
|
+
n,
|
|
44
|
+
n,
|
|
45
|
+
o,
|
|
46
|
+
a,
|
|
47
|
+
a
|
|
48
|
+
][c] * 255),
|
|
49
|
+
b: E([
|
|
50
|
+
a,
|
|
51
|
+
a,
|
|
52
|
+
s,
|
|
53
|
+
n,
|
|
54
|
+
n,
|
|
55
|
+
o
|
|
56
|
+
][c] * 255),
|
|
57
|
+
a: E(r, 2)
|
|
58
|
+
};
|
|
59
|
+
}, k = (e) => {
|
|
60
|
+
let t = e.toString(16);
|
|
61
|
+
return t.length < 2 ? "0" + t : t;
|
|
62
|
+
}, A = ({ r: e, g: t, b: n, a: r }) => {
|
|
63
|
+
let i = r < 1 ? k(E(r * 255)) : "";
|
|
64
|
+
return "#" + k(e) + k(t) + k(n) + i;
|
|
65
|
+
}, j = ({ r: e, g: t, b: n, a: r }) => {
|
|
66
|
+
let i = Math.max(e, t, n), a = i - Math.min(e, t, n), o = a ? i === e ? (t - n) / a : i === t ? 2 + (n - e) / a : 4 + (e - t) / a : 0;
|
|
67
|
+
return {
|
|
68
|
+
h: E(60 * (o < 0 ? o + 6 : o)),
|
|
69
|
+
s: E(i ? a / i * 100 : 0),
|
|
70
|
+
v: E(i / 255 * 100),
|
|
71
|
+
a: r
|
|
72
|
+
};
|
|
73
|
+
}, M = (e, t) => {
|
|
74
|
+
if (e === t) return !0;
|
|
75
|
+
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
76
|
+
return !0;
|
|
77
|
+
}, oe = (e, t) => e.toLowerCase() === t.toLowerCase() ? !0 : M(D(e), D(t)), N = {}, P = (e) => {
|
|
78
|
+
let t = N[e];
|
|
79
|
+
return t || (t = document.createElement("template"), t.innerHTML = e, N[e] = t), t;
|
|
80
|
+
}, F = (e, t, n) => {
|
|
81
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
82
|
+
bubbles: !0,
|
|
83
|
+
detail: n
|
|
84
|
+
}));
|
|
85
|
+
}, I = !1, L = (e) => "touches" in e, R = (e) => I && !L(e) ? !1 : (I ||= L(e), !0), z = (e, t) => {
|
|
86
|
+
let n = L(t) ? t.touches[0] : t, r = e.el.getBoundingClientRect();
|
|
87
|
+
F(e.el, "move", e.getMove({
|
|
88
|
+
x: T((n.pageX - (r.left + window.pageXOffset)) / r.width),
|
|
89
|
+
y: T((n.pageY - (r.top + window.pageYOffset)) / r.height)
|
|
90
|
+
}));
|
|
91
|
+
}, B = (e, t) => {
|
|
92
|
+
let n = t.keyCode;
|
|
93
|
+
n > 40 || e.xy && n < 37 || n < 33 || (t.preventDefault(), F(e.el, "move", e.getMove({
|
|
94
|
+
x: n === 39 ? .01 : n === 37 ? -.01 : n === 34 ? .05 : n === 33 ? -.05 : n === 35 ? 1 : n === 36 ? -1 : 0,
|
|
95
|
+
y: n === 40 ? .01 : n === 38 ? -.01 : 0
|
|
96
|
+
}, !0)));
|
|
97
|
+
}, V = class {
|
|
98
|
+
constructor(e, t, n, r) {
|
|
99
|
+
let i = P(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);
|
|
100
|
+
e.appendChild(i.content.cloneNode(!0));
|
|
101
|
+
let a = e.querySelector(`[part=${t}]`);
|
|
102
|
+
a.addEventListener("mousedown", this), a.addEventListener("touchstart", this), a.addEventListener("keydown", this), this.el = a, this.xy = r, this.nodes = [a.firstChild, a];
|
|
103
|
+
}
|
|
104
|
+
set dragging(e) {
|
|
105
|
+
let t = e ? document.addEventListener : document.removeEventListener;
|
|
106
|
+
t(I ? "touchmove" : "mousemove", this), t(I ? "touchend" : "mouseup", this);
|
|
107
|
+
}
|
|
108
|
+
handleEvent(e) {
|
|
109
|
+
switch (e.type) {
|
|
110
|
+
case "mousedown":
|
|
111
|
+
case "touchstart":
|
|
112
|
+
if (e.preventDefault(), !R(e) || !I && e.button != 0) return;
|
|
113
|
+
this.el.focus(), z(this, e), this.dragging = !0;
|
|
114
|
+
break;
|
|
115
|
+
case "mousemove":
|
|
116
|
+
case "touchmove":
|
|
117
|
+
e.preventDefault(), z(this, e);
|
|
118
|
+
break;
|
|
119
|
+
case "mouseup":
|
|
120
|
+
case "touchend":
|
|
121
|
+
this.dragging = !1;
|
|
122
|
+
break;
|
|
123
|
+
case "keydown":
|
|
124
|
+
B(this, e);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
style(e) {
|
|
129
|
+
e.forEach((e, t) => {
|
|
130
|
+
for (let n in e) this.nodes[t].style.setProperty(n, e[n]);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}, H = class extends V {
|
|
134
|
+
constructor(e) {
|
|
135
|
+
super(e, "hue", "aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"", !1);
|
|
136
|
+
}
|
|
137
|
+
update({ h: e }) {
|
|
138
|
+
this.h = e, this.style([{
|
|
139
|
+
left: `${e / 360 * 100}%`,
|
|
140
|
+
color: O({
|
|
141
|
+
h: e,
|
|
142
|
+
s: 100,
|
|
143
|
+
v: 100,
|
|
144
|
+
a: 1
|
|
145
|
+
})
|
|
146
|
+
}]), this.el.setAttribute("aria-valuenow", `${E(e)}`);
|
|
147
|
+
}
|
|
148
|
+
getMove(e, t) {
|
|
149
|
+
return { h: t ? T(this.h + e.x * 360, 0, 360) : 360 * e.x };
|
|
150
|
+
}
|
|
151
|
+
}, U = class extends V {
|
|
152
|
+
constructor(e) {
|
|
153
|
+
super(e, "saturation", "aria-label=\"Color\"", !0);
|
|
154
|
+
}
|
|
155
|
+
update(e) {
|
|
156
|
+
this.hsva = e, this.style([{
|
|
157
|
+
top: `${100 - e.v}%`,
|
|
158
|
+
left: `${e.s}%`,
|
|
159
|
+
color: O(e)
|
|
160
|
+
}, { "background-color": O({
|
|
161
|
+
h: e.h,
|
|
162
|
+
s: 100,
|
|
163
|
+
v: 100,
|
|
164
|
+
a: 1
|
|
165
|
+
}) }]), this.el.setAttribute("aria-valuetext", `Saturation ${E(e.s)}%, Brightness ${E(e.v)}%`);
|
|
166
|
+
}
|
|
167
|
+
getMove(e, t) {
|
|
168
|
+
return {
|
|
169
|
+
s: t ? T(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
|
|
170
|
+
v: t ? T(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}, W = ":host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:\"\";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}", G = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", K = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", q = Symbol("same"), J = Symbol("color"), Y = Symbol("hsva"), X = Symbol("update"), Z = Symbol("parts"), Q = Symbol("css"), $ = Symbol("sliders"), se = class extends HTMLElement {
|
|
174
|
+
static get observedAttributes() {
|
|
175
|
+
return ["color"];
|
|
176
|
+
}
|
|
177
|
+
get [Q]() {
|
|
178
|
+
return [
|
|
179
|
+
W,
|
|
180
|
+
G,
|
|
181
|
+
K
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
get [$]() {
|
|
185
|
+
return [U, H];
|
|
186
|
+
}
|
|
187
|
+
get color() {
|
|
188
|
+
return this[J];
|
|
189
|
+
}
|
|
190
|
+
set color(e) {
|
|
191
|
+
if (!this[q](e)) {
|
|
192
|
+
let t = this.colorModel.toHsva(e);
|
|
193
|
+
this[X](t), this[J] = e;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
constructor() {
|
|
197
|
+
super();
|
|
198
|
+
let e = P(`<style>${this[Q].join("")}</style>`), t = this.attachShadow({ mode: "open" });
|
|
199
|
+
t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[Z] = this[$].map((e) => new e(t));
|
|
200
|
+
}
|
|
201
|
+
connectedCallback() {
|
|
202
|
+
if (this.hasOwnProperty("color")) {
|
|
203
|
+
let e = this.color;
|
|
204
|
+
delete this.color, this.color = e;
|
|
205
|
+
} else this.color ||= this.colorModel.defaultColor;
|
|
206
|
+
}
|
|
207
|
+
attributeChangedCallback(e, t, n) {
|
|
208
|
+
let r = this.colorModel.fromAttr(n);
|
|
209
|
+
this[q](r) || (this.color = r);
|
|
210
|
+
}
|
|
211
|
+
handleEvent(e) {
|
|
212
|
+
let t = this[Y], n = {
|
|
213
|
+
...t,
|
|
214
|
+
...e.detail
|
|
215
|
+
};
|
|
216
|
+
this[X](n);
|
|
217
|
+
let r;
|
|
218
|
+
!M(n, t) && !this[q](r = this.colorModel.fromHsva(n)) && (this[J] = r, F(this, "color-changed", { value: r }));
|
|
219
|
+
}
|
|
220
|
+
[q](e) {
|
|
221
|
+
return this.color && this.colorModel.equal(e, this.color);
|
|
222
|
+
}
|
|
223
|
+
[X](e) {
|
|
224
|
+
this[Y] = e, this[Z].forEach((t) => t.update(e));
|
|
225
|
+
}
|
|
226
|
+
}, ce = {
|
|
227
|
+
defaultColor: "#000",
|
|
228
|
+
toHsva: ne,
|
|
229
|
+
fromHsva: ({ h: e, s: t, v: n }) => re({
|
|
230
|
+
h: e,
|
|
231
|
+
s: t,
|
|
232
|
+
v: n,
|
|
233
|
+
a: 1
|
|
234
|
+
}),
|
|
235
|
+
equal: oe,
|
|
236
|
+
fromAttr: (e) => e
|
|
237
|
+
}, le = class extends se {
|
|
238
|
+
get colorModel() {
|
|
239
|
+
return ce;
|
|
240
|
+
}
|
|
241
|
+
}, ue = class extends le {};
|
|
242
|
+
customElements.define("hex-color-picker", ue);
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/components/ColorPicker.vue?vue&type=script&setup=true&lang.ts
|
|
245
|
+
var de = [
|
|
246
|
+
"disabled",
|
|
247
|
+
"aria-label",
|
|
248
|
+
"aria-expanded"
|
|
249
|
+
], fe = [
|
|
250
|
+
"value",
|
|
251
|
+
"placeholder",
|
|
252
|
+
"disabled",
|
|
253
|
+
"aria-label"
|
|
254
|
+
], pe = ["color", "aria-label"], me = /* @__PURE__ */ o({
|
|
255
|
+
__name: "ColorPicker",
|
|
256
|
+
props: {
|
|
257
|
+
modelValue: {},
|
|
258
|
+
placeholder: { default: x },
|
|
259
|
+
size: { default: "default" },
|
|
260
|
+
swatchOnly: {
|
|
261
|
+
type: Boolean,
|
|
262
|
+
default: !1
|
|
263
|
+
},
|
|
264
|
+
disabled: {
|
|
265
|
+
type: Boolean,
|
|
266
|
+
default: !1
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
emits: ["update:modelValue"],
|
|
270
|
+
setup(t, { emit: n }) {
|
|
271
|
+
let i = t, a = n, { t: o } = y(), u = c(!1), f = c(), b = c();
|
|
272
|
+
v(f, () => {
|
|
273
|
+
u.value = !1;
|
|
274
|
+
}, { ignore: [b] });
|
|
275
|
+
let x = h({
|
|
276
|
+
get: () => i.modelValue || "#000000",
|
|
277
|
+
set: (e) => a("update:modelValue", e)
|
|
278
|
+
});
|
|
279
|
+
function S(e) {
|
|
280
|
+
x.value = e.detail.value;
|
|
281
|
+
}
|
|
282
|
+
function C(e) {
|
|
283
|
+
x.value = e.target.value;
|
|
284
|
+
}
|
|
285
|
+
return (n, i) => (r(), l("div", { class: e(["tpl:flex tpl:gap-2 tpl:relative", t.disabled && "tpl:opacity-60 tpl:cursor-not-allowed"]) }, [
|
|
286
|
+
m("button", {
|
|
287
|
+
ref_key: "swatchRef",
|
|
288
|
+
ref: b,
|
|
289
|
+
type: "button",
|
|
290
|
+
disabled: t.disabled,
|
|
291
|
+
"aria-label": g(o).colorPicker.pickColor,
|
|
292
|
+
"aria-expanded": u.value,
|
|
293
|
+
class: e([
|
|
294
|
+
"tpl:shrink-0 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-0.5 tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
295
|
+
t.disabled ? "tpl:cursor-not-allowed" : "tpl:cursor-pointer",
|
|
296
|
+
u.value ? "tpl:border-[var(--tpl-primary)] tpl:shadow-[var(--tpl-ring)]" : !t.disabled && "hover:tpl:border-[var(--tpl-text-dim)]",
|
|
297
|
+
t.size === "large" ? "tpl:size-12" : "tpl:size-10"
|
|
298
|
+
]),
|
|
299
|
+
onClick: i[0] ||= (e) => !t.disabled && (u.value = !u.value)
|
|
300
|
+
}, [m("span", {
|
|
301
|
+
class: "tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]",
|
|
302
|
+
style: _({ backgroundColor: x.value })
|
|
303
|
+
}, null, 4)], 10, de),
|
|
304
|
+
t.swatchOnly ? d("", !0) : (r(), l("input", {
|
|
305
|
+
key: 0,
|
|
306
|
+
type: "text",
|
|
307
|
+
class: e(g(w)),
|
|
308
|
+
value: t.modelValue,
|
|
309
|
+
placeholder: t.placeholder,
|
|
310
|
+
disabled: t.disabled,
|
|
311
|
+
"aria-label": g(o).colorPicker.hexValue,
|
|
312
|
+
onInput: C
|
|
313
|
+
}, null, 42, fe)),
|
|
314
|
+
ee(te, {
|
|
315
|
+
"enter-active-class": "tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
316
|
+
"enter-from-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1",
|
|
317
|
+
"enter-to-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
|
|
318
|
+
"leave-active-class": "tpl:transition-all tpl:duration-[80ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
319
|
+
"leave-from-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
|
|
320
|
+
"leave-to-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1"
|
|
321
|
+
}, {
|
|
322
|
+
default: s(() => [u.value ? (r(), l("div", {
|
|
323
|
+
key: 0,
|
|
324
|
+
ref_key: "popoverRef",
|
|
325
|
+
ref: f,
|
|
326
|
+
class: "tpl:absolute tpl:left-0 tpl:top-full tpl:z-50 tpl:mt-2 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-3 tpl:shadow-lg"
|
|
327
|
+
}, [m("hex-color-picker", {
|
|
328
|
+
color: x.value,
|
|
329
|
+
"aria-label": g(o).colorPicker.pickColor,
|
|
330
|
+
onColorChanged: S,
|
|
331
|
+
onKeydown: i[1] ||= p((e) => u.value = !1, ["escape"])
|
|
332
|
+
}, null, 40, pe)], 512)) : d("", !0)]),
|
|
333
|
+
_: 1
|
|
334
|
+
})
|
|
335
|
+
], 2));
|
|
336
|
+
}
|
|
337
|
+
}), he = [
|
|
338
|
+
"aria-checked",
|
|
339
|
+
"aria-label",
|
|
340
|
+
"title",
|
|
341
|
+
"onClick"
|
|
342
|
+
], ge = { key: 1 }, _e = /* @__PURE__ */ o({
|
|
343
|
+
__name: "SlidingPillSelect",
|
|
344
|
+
props: {
|
|
345
|
+
options: {},
|
|
346
|
+
modelValue: {}
|
|
347
|
+
},
|
|
348
|
+
emits: ["update:modelValue"],
|
|
349
|
+
setup(e, { emit: t }) {
|
|
350
|
+
let o = e, s = t, c = h(() => {
|
|
351
|
+
let e = o.options.findIndex((e) => e.value === o.modelValue);
|
|
352
|
+
return `translateX(${Math.max(e, 0) * 100}%)`;
|
|
353
|
+
});
|
|
354
|
+
return (t, o) => (r(), l("div", {
|
|
355
|
+
role: "radiogroup",
|
|
356
|
+
class: "tpl:relative tpl:grid tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1",
|
|
357
|
+
style: _({
|
|
358
|
+
gridTemplateColumns: `repeat(${e.options.length}, 1fr)`,
|
|
359
|
+
backgroundColor: "var(--tpl-bg-hover)"
|
|
360
|
+
})
|
|
361
|
+
}, [m("div", {
|
|
362
|
+
class: "tpl:absolute tpl:inset-y-1 tpl:rounded-[var(--tpl-radius-sm)]",
|
|
363
|
+
style: _({
|
|
364
|
+
left: "4px",
|
|
365
|
+
width: `calc((100% - 8px) / ${e.options.length})`,
|
|
366
|
+
transform: c.value,
|
|
367
|
+
backgroundColor: "var(--tpl-bg)",
|
|
368
|
+
boxShadow: "var(--tpl-shadow)",
|
|
369
|
+
transition: "transform 120ms cubic-bezier(0.16, 1, 0.3, 1)"
|
|
370
|
+
})
|
|
371
|
+
}, null, 4), (r(!0), l(u, null, a(e.options, (t) => (r(), l("button", {
|
|
372
|
+
key: t.value,
|
|
373
|
+
role: "radio",
|
|
374
|
+
"aria-checked": e.modelValue === t.value,
|
|
375
|
+
"aria-label": t.label,
|
|
376
|
+
class: "tpl:relative tpl:z-10 tpl:flex tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:py-[5px] tpl:text-xs tpl:font-medium",
|
|
377
|
+
style: _({
|
|
378
|
+
color: e.modelValue === t.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
379
|
+
transition: "color 120ms cubic-bezier(0.16, 1, 0.3, 1)"
|
|
380
|
+
}),
|
|
381
|
+
title: t.label,
|
|
382
|
+
onClick: (e) => s("update:modelValue", t.value)
|
|
383
|
+
}, [t.icon ? (r(), f(n(t.icon), {
|
|
384
|
+
key: 0,
|
|
385
|
+
size: 14,
|
|
386
|
+
"stroke-width": 2
|
|
387
|
+
})) : (r(), l("span", ge, i(t.label), 1))], 12, he))), 128))], 4));
|
|
388
|
+
}
|
|
389
|
+
}), ve = { class: "tpl:mb-3.5" }, ye = /* @__PURE__ */ o({
|
|
390
|
+
__name: "FieldRow",
|
|
391
|
+
props: { label: {} },
|
|
392
|
+
setup(n) {
|
|
393
|
+
return (a, o) => (r(), l("div", ve, [n.label ? (r(), l("label", {
|
|
394
|
+
key: 0,
|
|
395
|
+
class: e(g(b))
|
|
396
|
+
}, i(n.label), 3)) : d("", !0), t(a.$slots, "default")]));
|
|
397
|
+
}
|
|
398
|
+
}), be = { class: "tpl:flex tpl:items-stretch" }, xe = [
|
|
399
|
+
"value",
|
|
400
|
+
"min",
|
|
401
|
+
"max"
|
|
402
|
+
], Se = /* @__PURE__ */ o({
|
|
403
|
+
__name: "NumberWithSuffix",
|
|
404
|
+
props: {
|
|
405
|
+
modelValue: {},
|
|
406
|
+
min: {},
|
|
407
|
+
max: {},
|
|
408
|
+
suffix: {}
|
|
409
|
+
},
|
|
410
|
+
emits: ["update:modelValue"],
|
|
411
|
+
setup(t, { emit: n }) {
|
|
412
|
+
let a = n;
|
|
413
|
+
return (n, o) => (r(), l("div", be, [m("input", {
|
|
414
|
+
type: "number",
|
|
415
|
+
class: e(g(C)),
|
|
416
|
+
value: t.modelValue,
|
|
417
|
+
min: t.min,
|
|
418
|
+
max: t.max,
|
|
419
|
+
onInput: o[0] ||= (e) => a("update:modelValue", Number(e.target.value))
|
|
420
|
+
}, null, 42, xe), m("span", { class: e(g(S)) }, i(t.suffix), 3)]));
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
//#endregion
|
|
424
|
+
export { me as i, ye as n, _e as r, Se as t };
|