@templatical/editor 0.16.1 → 0.16.3

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 (79) hide show
  1. package/dist/{AiFeatureMenu-Rb8G3EBo.js → AiFeatureMenu-CcGRd1xE.js} +1 -1
  2. package/dist/{CloudEditor-D88gLBXp.js → CloudEditor-CUIWUMp5.js} +6 -6
  3. package/dist/{CollaboratorBar-dxCD8jSi.js → CollaboratorBar-DmxqeBYZ.js} +1 -1
  4. package/dist/ColorPicker-Gs4BMVog.js +474 -0
  5. package/dist/{CountdownToolbar-8XVTOuGX.js → CountdownToolbar-92w1YySJ.js} +2 -2
  6. package/dist/{ModuleBrowserModal-l4_RCC8m.js → ModuleBrowserModal-DsehjLvh.js} +4 -4
  7. package/dist/{ModulePreviewCanvas-BqYAr4fz.js → ModulePreviewCanvas-BBfuS8VW.js} +1 -1
  8. package/dist/{NumberWithSuffix-Di-cDy_m.js → NumberWithSuffix-BxSRfI8b.js} +1 -1
  9. package/dist/{ParagraphEditor-DIQ1jmSP.js → ParagraphEditor-vgvQxicC.js} +77 -87
  10. package/dist/{RichTextEditorContent-DkTJ6KK8.js → RichTextEditorContent-Dza2oPvh.js} +1 -1
  11. package/dist/{SaveModuleDialog-DPo3Raon.js → SaveModuleDialog-DNWGCHlS.js} +2 -2
  12. package/dist/{SnapshotHistory-m7brKV7C.js → SnapshotHistory-BLmnNLg1.js} +2 -2
  13. package/dist/{TestEmailModal-BE9sFEIl.js → TestEmailModal-D6v1hgY2.js} +2 -2
  14. package/dist/{TitleEditor-BATN-k-Q.js → TitleEditor-DPdzOQpq.js} +2 -2
  15. package/dist/{TplModal-DHBcZ1gq.js → TplModal-DObT0uxf.js} +1 -1
  16. package/dist/{blockTypeIcons-wRchKKx0.js → blockTypeIcons-B9f5fH_5.js} +1 -1
  17. package/dist/bundle-stats.json +6 -6
  18. package/dist/cdn/chunks/{AiFeatureMenu-W7VQFAwq.js → AiFeatureMenu-CyUCHd9I.js} +8 -8
  19. package/dist/cdn/chunks/{AiFeatureMenu-W7VQFAwq.js.map → AiFeatureMenu-CyUCHd9I.js.map} +1 -1
  20. package/dist/cdn/chunks/{BlockIssueBadge-ww2vNIfJ.js → BlockIssueBadge-BAa_dI-c.js} +5 -5
  21. package/dist/cdn/chunks/{BlockIssueBadge-ww2vNIfJ.js.map → BlockIssueBadge-BAa_dI-c.js.map} +1 -1
  22. package/dist/cdn/chunks/{CloudEditor-BVSJ1kvB.js → CloudEditor-ClfgLU48.js} +159 -159
  23. package/dist/cdn/chunks/{CloudEditor-BVSJ1kvB.js.map → CloudEditor-ClfgLU48.js.map} +1 -1
  24. package/dist/cdn/chunks/{CollaboratorBar-BFrAua9a.js → CollaboratorBar-DCc5SL0P.js} +3 -3
  25. package/dist/cdn/chunks/{CollaboratorBar-BFrAua9a.js.map → CollaboratorBar-DCc5SL0P.js.map} +1 -1
  26. package/dist/cdn/chunks/ColorPicker-Pi-1fR8c.js +471 -0
  27. package/dist/cdn/chunks/ColorPicker-Pi-1fR8c.js.map +1 -0
  28. package/dist/cdn/chunks/{CountdownBlock-MC-mhtQD.js → CountdownBlock-Bj7aoBUU.js} +4 -4
  29. package/dist/cdn/chunks/{CountdownBlock-MC-mhtQD.js.map → CountdownBlock-Bj7aoBUU.js.map} +1 -1
  30. package/dist/cdn/chunks/{CountdownToolbar-dXyr7tz-.js → CountdownToolbar-B1oniVq1.js} +4 -4
  31. package/dist/cdn/chunks/{CountdownToolbar-dXyr7tz-.js.map → CountdownToolbar-B1oniVq1.js.map} +1 -1
  32. package/dist/cdn/chunks/{IssuesPanel-CTxSgViL.js → IssuesPanel-BXLVRo-c.js} +7 -7
  33. package/dist/cdn/chunks/{IssuesPanel-CTxSgViL.js.map → IssuesPanel-BXLVRo-c.js.map} +1 -1
  34. package/dist/cdn/chunks/{ModuleBrowserModal-B5sCsrud.js → ModuleBrowserModal-C7BkJvzf.js} +6 -6
  35. package/dist/cdn/chunks/{ModuleBrowserModal-B5sCsrud.js.map → ModuleBrowserModal-C7BkJvzf.js.map} +1 -1
  36. package/dist/cdn/chunks/{ModulePreviewCanvas-DGTGo8kg.js → ModulePreviewCanvas-BJn-ZHlC.js} +10 -10
  37. package/dist/cdn/chunks/{ModulePreviewCanvas-DGTGo8kg.js.map → ModulePreviewCanvas-BJn-ZHlC.js.map} +1 -1
  38. package/dist/cdn/chunks/{NumberWithSuffix-tAHfui6k.js → NumberWithSuffix-CkOxH3F7.js} +2 -2
  39. package/dist/cdn/chunks/{NumberWithSuffix-tAHfui6k.js.map → NumberWithSuffix-CkOxH3F7.js.map} +1 -1
  40. package/dist/cdn/chunks/{ParagraphEditor-CB5FGRs3.js → ParagraphEditor-4cMKKC-V.js} +181 -190
  41. package/dist/cdn/chunks/ParagraphEditor-4cMKKC-V.js.map +1 -0
  42. package/dist/cdn/chunks/{RichTextEditorContent-CPelbtck.js → RichTextEditorContent-7RZe4tbj.js} +6 -6
  43. package/dist/cdn/chunks/{RichTextEditorContent-CPelbtck.js.map → RichTextEditorContent-7RZe4tbj.js.map} +1 -1
  44. package/dist/cdn/chunks/{SaveModuleDialog-7f9uUUEC.js → SaveModuleDialog-mr9A4j6G.js} +4 -4
  45. package/dist/cdn/chunks/{SaveModuleDialog-7f9uUUEC.js.map → SaveModuleDialog-mr9A4j6G.js.map} +1 -1
  46. package/dist/cdn/chunks/{TitleEditor-C0mYpgs4.js → TitleEditor-Cqw2jvuc.js} +8 -8
  47. package/dist/cdn/chunks/{TitleEditor-C0mYpgs4.js.map → TitleEditor-Cqw2jvuc.js.map} +1 -1
  48. package/dist/cdn/chunks/{blockTypeIcons-BtxaUtlx.js → blockTypeIcons-B_xRBxSU.js} +8 -8
  49. package/dist/cdn/chunks/{blockTypeIcons-BtxaUtlx.js.map → blockTypeIcons-B_xRBxSU.js.map} +1 -1
  50. package/dist/cdn/chunks/{extensions-BJ7vaBol.js → extensions-Btyx_IMf.js} +19 -19
  51. package/dist/cdn/chunks/{extensions-BJ7vaBol.js.map → extensions-Btyx_IMf.js.map} +1 -1
  52. package/dist/cdn/chunks/{features-CgbSSCgv.js → features-Dwb5aTLg.js} +18 -16
  53. package/dist/cdn/chunks/features-Dwb5aTLg.js.map +1 -0
  54. package/dist/cdn/chunks/{icons-Dlx5MT1V.js → icons-Dhqh5lYQ.js} +2 -2
  55. package/dist/cdn/chunks/{icons-Dlx5MT1V.js.map → icons-Dhqh5lYQ.js.map} +1 -1
  56. package/dist/cdn/chunks/{media-library-BMlykZGq.js → media-library-DRodsf2D.js} +101 -101
  57. package/dist/cdn/chunks/{media-library-BMlykZGq.js.map → media-library-DRodsf2D.js.map} +1 -1
  58. package/dist/cdn/chunks/{quality-DsVgXk_j.js → quality-A_V2Iqu_.js} +435 -435
  59. package/dist/cdn/chunks/{quality-DsVgXk_j.js.map → quality-A_V2Iqu_.js.map} +1 -1
  60. package/dist/cdn/chunks/{renderer-DPvEtVGO.js → renderer-BM_-zceB.js} +12 -12
  61. package/dist/cdn/chunks/renderer-BM_-zceB.js.map +1 -0
  62. package/dist/cdn/chunks/{src-CAdirukY.js → src-DSomxPI-.js} +4 -4
  63. package/dist/cdn/chunks/{src-CAdirukY.js.map → src-DSomxPI-.js.map} +1 -1
  64. package/dist/cdn/chunks/{styles-D7u4vCpH.js → styles--UXn88wH.js} +829 -829
  65. package/dist/cdn/chunks/{styles-D7u4vCpH.js.map → styles--UXn88wH.js.map} +1 -1
  66. package/dist/cdn/editor.css +1 -1
  67. package/dist/cdn/editor.js +30 -30
  68. package/dist/{dist-CFOQvhSC.js → color-DhoxCSMv.js} +9 -1
  69. package/dist/style.css +1 -1
  70. package/dist/{styles-B-yhoJnH.js → styles-CPt6RYEc.js} +6 -6
  71. package/dist/templatical-editor.js +4 -4
  72. package/dist/{useEditorCore-CV1ct_17.js → useEditorCore-CSfeEwCj.js} +196 -202
  73. package/package.json +8 -8
  74. package/dist/ColorPicker-CAgMCX3A.js +0 -442
  75. package/dist/cdn/chunks/ColorPicker-DmxMDn-t.js +0 -439
  76. package/dist/cdn/chunks/ColorPicker-DmxMDn-t.js.map +0 -1
  77. package/dist/cdn/chunks/ParagraphEditor-CB5FGRs3.js.map +0 -1
  78. package/dist/cdn/chunks/features-CgbSSCgv.js.map +0 -1
  79. package/dist/cdn/chunks/renderer-DPvEtVGO.js.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@templatical/editor",
3
3
  "description": "Vue 3 visual drag-and-drop email editor powered by Templatical",
4
- "version": "0.16.1",
4
+ "version": "0.16.3",
5
5
  "bugs": "https://github.com/templatical/sdk/issues",
6
6
  "devDependencies": {
7
7
  "@lucide/vue": "^1.24.0",
@@ -24,7 +24,7 @@
24
24
  "es-module-lexer": "^2.3.1",
25
25
  "happy-dom": "^20.10.6",
26
26
  "liquidjs": "^10.27.2",
27
- "tailwindcss": "^4.3.2",
27
+ "tailwindcss": "^4.3.3",
28
28
  "typescript": "^6.0.3",
29
29
  "vanilla-colorful": "^0.7.2",
30
30
  "vite": "^8.1.5",
@@ -32,9 +32,9 @@
32
32
  "vue": "^3.5.40",
33
33
  "vue-draggable-plus": "^0.6.1",
34
34
  "vue-tsc": "^3.3.7",
35
- "@templatical/core": "0.16.1",
36
- "@templatical/quality": "0.16.1",
37
- "@templatical/types": "0.16.1"
35
+ "@templatical/core": "0.16.3",
36
+ "@templatical/quality": "0.16.3",
37
+ "@templatical/types": "0.16.3"
38
38
  },
39
39
  "exports": {
40
40
  ".": {
@@ -62,9 +62,9 @@
62
62
  "license": "SEE LICENSE IN LICENSE",
63
63
  "module": "./dist/templatical-editor.js",
64
64
  "peerDependencies": {
65
- "@templatical/media-library": "0.16.1",
66
- "@templatical/quality": "0.16.1",
67
- "@templatical/renderer": "0.16.1"
65
+ "@templatical/media-library": "0.16.3",
66
+ "@templatical/quality": "0.16.3",
67
+ "@templatical/renderer": "0.16.3"
68
68
  },
69
69
  "peerDependenciesMeta": {
70
70
  "@templatical/renderer": {
@@ -1,442 +0,0 @@
1
- import { Dt as e, Et as t, O as n, R as r, Y as i, _ as a, c as o, d as s, h as c, i as l, l as ee, nt as u, s as d, u as f, x as p } from "./vue.runtime.esm-bundler-B0xoGkDv.js";
2
- import { s as te, t as ne } from "./runtime-dom.esm-bundler-GdMI8WqG.js";
3
- import { t as re } from "./dist-CFOQvhSC.js";
4
- import { I as ie, P as ae } from "./keys-BbDgCU6K.js";
5
- import { t as oe } from "./useI18n-eR1yVW0v.js";
6
- import { t as se } from "./x-CG_NV3nP.js";
7
- import { t as ce } from "./usePopoverRoot-C1j0D7cc.js";
8
- //#region src/constants/styleConstants.ts
9
- var m = "tpl:block tpl:mb-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]", h = "tpl:w-full tpl:h-10 tpl:px-3.5 tpl:py-1.5 tpl:text-sm tpl:border tpl:rounded-[var(--tpl-radius-sm)] tpl:shadow-xs tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)] tpl:border-[var(--tpl-border)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] tpl:outline-none focus:tpl:border-[var(--tpl-primary)] focus:tpl:shadow-[var(--tpl-ring)] placeholder:tpl:text-[var(--tpl-text-dim)]", g = "tpl:w-full tpl:h-10 tpl:px-3.5 tpl:py-1.5 tpl:text-sm tpl:border tpl:rounded-l-[var(--tpl-radius-sm)] tpl:rounded-r-none tpl:border-r-0 tpl:shadow-xs tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)] tpl:border-[var(--tpl-border)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] tpl:outline-none focus:tpl:border-[var(--tpl-primary)] focus:tpl:shadow-[var(--tpl-ring)] placeholder:tpl:text-[var(--tpl-text-dim)]", _ = "tpl:flex tpl:items-center tpl:px-2.5 tpl:text-xs tpl:border tpl:border-l-0 tpl:text-[var(--tpl-text-dim)] tpl:bg-[var(--tpl-bg-hover)] tpl:border-[var(--tpl-border)] tpl:rounded-r-[var(--tpl-radius-sm)]", le = "tpl:flex-1 tpl:h-10 tpl:px-3.5 tpl:py-1.5 tpl:text-xs tpl:font-mono tpl:border tpl:rounded-[var(--tpl-radius-sm)] tpl:shadow-xs tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)] tpl:border-[var(--tpl-border)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] tpl:outline-none focus:tpl:border-[var(--tpl-primary)] focus:tpl:shadow-[var(--tpl-ring)]", v = "tpl:rounded-[var(--tpl-radius)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-4 tpl:border tpl:border-[var(--tpl-border)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)]", y = "tpl:flex tpl:size-8 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text-muted)] tpl:transition-all tpl:duration-150 tpl:hover:border-[var(--tpl-danger)] tpl:hover:bg-[var(--tpl-danger-light)] tpl:hover:text-[var(--tpl-danger)]", b = "tpl:flex tpl:w-full tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-2 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text-muted)] tpl:transition-all tpl:duration-150 tpl:hover:border-[var(--tpl-primary)] tpl:hover:text-[var(--tpl-primary)]", x = "tpl:w-full tpl:resize-y tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-2.5 tpl:py-2 tpl:font-mono tpl:text-xs tpl:text-[var(--tpl-text)] tpl:outline-none tpl:transition-all tpl:duration-150 tpl:placeholder:text-[var(--tpl-text-dim)] tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[0_0_0_3px_var(--tpl-primary-light)]", S = "tpl-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3.5 tpl:py-2 tpl:text-sm tpl:font-medium tpl:whitespace-nowrap tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-primary)] hover:tpl:text-[var(--tpl-bg)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50", C = [
10
- "10px",
11
- "12px",
12
- "14px",
13
- "16px",
14
- "18px",
15
- "20px",
16
- "24px",
17
- "28px",
18
- "32px",
19
- "36px",
20
- "48px",
21
- "64px"
22
- ], w = [
23
- "1",
24
- "1.2",
25
- "1.4",
26
- "1.5",
27
- "1.6",
28
- "1.8",
29
- "2",
30
- "2.5"
31
- ], T = [
32
- {
33
- label: "Normal",
34
- value: "normal"
35
- },
36
- {
37
- label: "-0.5px",
38
- value: "-0.5px"
39
- },
40
- {
41
- label: "0.5px",
42
- value: "0.5px"
43
- },
44
- {
45
- label: "1px",
46
- value: "1px"
47
- },
48
- {
49
- label: "1.5px",
50
- value: "1.5px"
51
- },
52
- {
53
- label: "2px",
54
- value: "2px"
55
- },
56
- {
57
- label: "3px",
58
- value: "3px"
59
- }
60
- ], E = "#000000", D = "#ffffff", O = "#ffff00", k = "#f2f2f2", A = (e, t = 0, n = 1) => e > n ? n : e < t ? t : e, j = (e, t = 0, n = 10 ** t) => Math.round(n * e) / n;
61
- 360 / (Math.PI * 2);
62
- var M = (e) => fe(N(e)), N = (e) => (e[0] === "#" && (e = e.substring(1)), e.length < 6 ? {
63
- r: parseInt(e[0] + e[0], 16),
64
- g: parseInt(e[1] + e[1], 16),
65
- b: parseInt(e[2] + e[2], 16),
66
- a: e.length === 4 ? j(parseInt(e[3] + e[3], 16) / 255, 2) : 1
67
- } : {
68
- r: parseInt(e.substring(0, 2), 16),
69
- g: parseInt(e.substring(2, 4), 16),
70
- b: parseInt(e.substring(4, 6), 16),
71
- a: e.length === 8 ? j(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
72
- }), P = (e) => de(ue(e)), F = ({ h: e, s: t, v: n, a: r }) => {
73
- let i = (200 - t) * n / 100;
74
- return {
75
- h: j(e),
76
- s: j(i > 0 && i < 200 ? t * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
77
- l: j(i / 2),
78
- a: j(r, 2)
79
- };
80
- }, I = (e) => {
81
- let { h: t, s: n, l: r } = F(e);
82
- return `hsl(${t}, ${n}%, ${r}%)`;
83
- }, ue = ({ h: e, s: t, v: n, a: r }) => {
84
- e = e / 360 * 6, t /= 100, n /= 100;
85
- 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;
86
- return {
87
- r: j([
88
- n,
89
- o,
90
- a,
91
- a,
92
- s,
93
- n
94
- ][c] * 255),
95
- g: j([
96
- s,
97
- n,
98
- n,
99
- o,
100
- a,
101
- a
102
- ][c] * 255),
103
- b: j([
104
- a,
105
- a,
106
- s,
107
- n,
108
- n,
109
- o
110
- ][c] * 255),
111
- a: j(r, 2)
112
- };
113
- }, L = (e) => {
114
- let t = e.toString(16);
115
- return t.length < 2 ? "0" + t : t;
116
- }, de = ({ r: e, g: t, b: n, a: r }) => {
117
- let i = r < 1 ? L(j(r * 255)) : "";
118
- return "#" + L(e) + L(t) + L(n) + i;
119
- }, fe = ({ r: e, g: t, b: n, a: r }) => {
120
- 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;
121
- return {
122
- h: j(60 * (o < 0 ? o + 6 : o)),
123
- s: j(i ? a / i * 100 : 0),
124
- v: j(i / 255 * 100),
125
- a: r
126
- };
127
- }, R = (e, t) => {
128
- if (e === t) return !0;
129
- for (let n in e) if (e[n] !== t[n]) return !1;
130
- return !0;
131
- }, pe = (e, t) => e.toLowerCase() === t.toLowerCase() || R(N(e), N(t)), z = {}, B = (e) => {
132
- let t = z[e];
133
- return t || (t = document.createElement("template"), t.innerHTML = e, z[e] = t), t;
134
- }, V = (e, t, n) => {
135
- e.dispatchEvent(new CustomEvent(t, {
136
- bubbles: !0,
137
- detail: n
138
- }));
139
- }, H = !1, U = (e) => "touches" in e, W = (e) => H && !U(e) ? !1 : (H ||= U(e), !0), G = (e, t) => {
140
- let n = U(t) ? t.touches[0] : t, r = e.el.getBoundingClientRect();
141
- V(e.el, "move", e.getMove({
142
- x: A((n.pageX - (r.left + window.pageXOffset)) / r.width),
143
- y: A((n.pageY - (r.top + window.pageYOffset)) / r.height)
144
- }));
145
- }, me = (e, t) => {
146
- let n = t.keyCode;
147
- n > 40 || e.xy && n < 37 || n < 33 || (t.preventDefault(), V(e.el, "move", e.getMove({
148
- x: n === 39 ? .01 : n === 37 ? -.01 : n === 34 ? .05 : n === 33 ? -.05 : n === 35 ? 1 : n === 36 ? -1 : 0,
149
- y: n === 40 ? .01 : n === 38 ? -.01 : 0
150
- }, !0)));
151
- }, K = class {
152
- constructor(e, t, n, r) {
153
- let i = B(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);
154
- e.appendChild(i.content.cloneNode(!0));
155
- let a = e.querySelector(`[part=${t}]`);
156
- a.addEventListener("mousedown", this), a.addEventListener("touchstart", this), a.addEventListener("keydown", this), this.el = a, this.xy = r, this.nodes = [a.firstChild, a];
157
- }
158
- set dragging(e) {
159
- let t = e ? document.addEventListener : document.removeEventListener;
160
- t(H ? "touchmove" : "mousemove", this), t(H ? "touchend" : "mouseup", this);
161
- }
162
- handleEvent(e) {
163
- switch (e.type) {
164
- case "mousedown":
165
- case "touchstart":
166
- if (e.preventDefault(), !W(e) || !H && e.button != 0) return;
167
- this.el.focus(), G(this, e), this.dragging = !0;
168
- break;
169
- case "mousemove":
170
- case "touchmove":
171
- e.preventDefault(), G(this, e);
172
- break;
173
- case "mouseup":
174
- case "touchend":
175
- this.dragging = !1;
176
- break;
177
- case "keydown":
178
- me(this, e);
179
- break;
180
- }
181
- }
182
- style(e) {
183
- e.forEach((e, t) => {
184
- for (let n in e) this.nodes[t].style.setProperty(n, e[n]);
185
- });
186
- }
187
- }, he = class extends K {
188
- constructor(e) {
189
- super(e, "hue", "aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"", !1);
190
- }
191
- update({ h: e }) {
192
- this.h = e, this.style([{
193
- left: `${e / 360 * 100}%`,
194
- color: I({
195
- h: e,
196
- s: 100,
197
- v: 100,
198
- a: 1
199
- })
200
- }]), this.el.setAttribute("aria-valuenow", `${j(e)}`);
201
- }
202
- getMove(e, t) {
203
- return { h: t ? A(this.h + e.x * 360, 0, 360) : 360 * e.x };
204
- }
205
- }, ge = class extends K {
206
- constructor(e) {
207
- super(e, "saturation", "aria-label=\"Color\"", !0);
208
- }
209
- update(e) {
210
- this.hsva = e, this.style([{
211
- top: `${100 - e.v}%`,
212
- left: `${e.s}%`,
213
- color: I(e)
214
- }, { "background-color": I({
215
- h: e.h,
216
- s: 100,
217
- v: 100,
218
- a: 1
219
- }) }]), this.el.setAttribute("aria-valuetext", `Saturation ${j(e.s)}%, Brightness ${j(e.v)}%`);
220
- }
221
- getMove(e, t) {
222
- return {
223
- s: t ? A(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
224
- v: t ? A(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
225
- };
226
- }
227
- }, _e = ":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)}", ve = "[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}", ye = "[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"), be = class extends HTMLElement {
228
- static get observedAttributes() {
229
- return ["color"];
230
- }
231
- get [Q]() {
232
- return [
233
- _e,
234
- ve,
235
- ye
236
- ];
237
- }
238
- get [$]() {
239
- return [ge, he];
240
- }
241
- get color() {
242
- return this[J];
243
- }
244
- set color(e) {
245
- if (!this[q](e)) {
246
- let t = this.colorModel.toHsva(e);
247
- this[X](t), this[J] = e;
248
- }
249
- }
250
- constructor() {
251
- super();
252
- let e = B(`<style>${this[Q].join("")}</style>`), t = this.attachShadow({ mode: "open" });
253
- t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[Z] = this[$].map((e) => new e(t));
254
- }
255
- connectedCallback() {
256
- if (this.hasOwnProperty("color")) {
257
- let e = this.color;
258
- delete this.color, this.color = e;
259
- } else this.color ||= this.colorModel.defaultColor;
260
- }
261
- attributeChangedCallback(e, t, n) {
262
- let r = this.colorModel.fromAttr(n);
263
- this[q](r) || (this.color = r);
264
- }
265
- handleEvent(e) {
266
- let t = this[Y], n = {
267
- ...t,
268
- ...e.detail
269
- };
270
- this[X](n);
271
- let r;
272
- !R(n, t) && !this[q](r = this.colorModel.fromHsva(n)) && (this[J] = r, V(this, "color-changed", { value: r }));
273
- }
274
- [q](e) {
275
- return this.color && this.colorModel.equal(e, this.color);
276
- }
277
- [X](e) {
278
- this[Y] = e, this[Z].forEach((t) => t.update(e));
279
- }
280
- }, xe = {
281
- defaultColor: "#000",
282
- toHsva: M,
283
- fromHsva: ({ h: e, s: t, v: n }) => P({
284
- h: e,
285
- s: t,
286
- v: n,
287
- a: 1
288
- }),
289
- equal: pe,
290
- fromAttr: (e) => e
291
- }, Se = class extends be {
292
- get colorModel() {
293
- return xe;
294
- }
295
- }, Ce = class extends Se {};
296
- customElements.define("hex-color-picker", Ce);
297
- //#endregion
298
- //#region src/components/ColorPicker.vue?vue&type=script&setup=true&lang.ts
299
- var we = [
300
- "disabled",
301
- "aria-label",
302
- "aria-expanded"
303
- ], Te = {
304
- key: 0,
305
- class: "tpl:relative tpl:flex-1"
306
- }, Ee = [
307
- "value",
308
- "placeholder",
309
- "disabled",
310
- "aria-label"
311
- ], De = ["aria-label", "title"], Oe = ["data-tpl-theme"], ke = ["color", "aria-label"], Ae = /* @__PURE__ */ a({
312
- __name: "ColorPicker",
313
- props: {
314
- modelValue: {},
315
- placeholder: { default: "" },
316
- seedColor: { default: "#ffffff" },
317
- swatchOnly: {
318
- type: Boolean,
319
- default: !1
320
- },
321
- disabled: {
322
- type: Boolean,
323
- default: !1
324
- }
325
- },
326
- emits: ["update:modelValue"],
327
- setup(a, { emit: m }) {
328
- let h = a, g = m, { t: _ } = oe(), v = i(!1), y = i(), b = i(), x = i(!1);
329
- re(y, () => {
330
- v.value = !1;
331
- }, { ignore: [b] });
332
- let S = d(() => !h.modelValue), C = d(() => h.modelValue || h.seedColor), w = d(() => !h.swatchOnly && !h.disabled && !S.value);
333
- function T(e) {
334
- x.value = !0, g("update:modelValue", e.detail.value);
335
- }
336
- function E() {
337
- x.value = !1;
338
- }
339
- function D() {
340
- !x.value && S.value && g("update:modelValue", C.value);
341
- }
342
- function O(e) {
343
- g("update:modelValue", e.target.value);
344
- }
345
- function k() {
346
- g("update:modelValue", "");
347
- }
348
- let A = ce(), j = p(ae, null), M = p(ie, null), N = i({
349
- top: 0,
350
- left: 0
351
- });
352
- function P() {
353
- if (!h.disabled) {
354
- if (!v.value) {
355
- let e = b.value?.getBoundingClientRect();
356
- if (e) {
357
- let t = e.bottom + 8 + 240 <= window.innerHeight;
358
- N.value = {
359
- top: t ? e.bottom + 8 : Math.max(8, e.top - 240 - 8),
360
- left: e.left
361
- };
362
- }
363
- }
364
- v.value = !v.value;
365
- }
366
- }
367
- return (i, d) => (n(), s("div", { class: t(["tpl:flex tpl:items-center tpl:gap-2 tpl:relative", a.disabled && "tpl:opacity-60 tpl:cursor-not-allowed"]) }, [
368
- o("button", {
369
- ref_key: "swatchRef",
370
- ref: b,
371
- type: "button",
372
- disabled: a.disabled,
373
- "aria-label": u(_).colorPicker.pickColor,
374
- "aria-expanded": v.value,
375
- class: t([
376
- "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)]",
377
- a.disabled ? "tpl:cursor-not-allowed" : "tpl:cursor-pointer",
378
- v.value ? "tpl:border-[var(--tpl-primary)] tpl:shadow-[var(--tpl-ring)]" : !a.disabled && "hover:tpl:border-[var(--tpl-text-dim)]",
379
- "tpl:size-10"
380
- ]),
381
- onClick: P
382
- }, [o("span", {
383
- class: t(["tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]", { "tpl-color-swatch-empty": S.value }]),
384
- style: e(S.value ? void 0 : { backgroundColor: a.modelValue })
385
- }, null, 6)], 10, we),
386
- a.swatchOnly ? f("", !0) : (n(), s("div", Te, [o("input", {
387
- type: "text",
388
- class: t([u(le), "tpl:w-full"]),
389
- style: e(w.value ? { paddingRight: "2.25rem" } : void 0),
390
- value: a.modelValue,
391
- placeholder: a.placeholder || u(_).colorPicker.notSet,
392
- disabled: a.disabled,
393
- "aria-label": u(_).colorPicker.hexValue,
394
- onInput: O
395
- }, null, 46, Ee), w.value ? (n(), s("button", {
396
- key: 0,
397
- type: "button",
398
- "aria-label": u(_).colorPicker.clear,
399
- title: u(_).colorPicker.clear,
400
- class: "tpl:absolute tpl:right-2 tpl:top-1/2 tpl:flex tpl:size-6 tpl:-translate-y-1/2 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-text-dim)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)] hover:tpl:text-[var(--tpl-text)]",
401
- onClick: k
402
- }, [c(u(se), {
403
- size: 14,
404
- "stroke-width": 1.5
405
- })], 8, De)) : f("", !0)])),
406
- (n(), ee(l, {
407
- to: u(A),
408
- disabled: !u(A)
409
- }, [c(ne, {
410
- "enter-active-class": "tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
411
- "enter-from-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1",
412
- "enter-to-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
413
- "leave-active-class": "tpl:transition-all tpl:duration-[80ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
414
- "leave-from-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
415
- "leave-to-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1"
416
- }, {
417
- default: r(() => [v.value ? (n(), s("div", {
418
- key: 0,
419
- ref_key: "popoverRef",
420
- ref: y,
421
- "data-tpl-theme": u(M),
422
- class: "tpl-color-popover tpl:fixed tpl:z-modal tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-3 tpl:shadow-lg",
423
- style: e({
424
- top: `${N.value.top}px`,
425
- left: `${N.value.left}px`,
426
- ...u(j)
427
- })
428
- }, [o("hex-color-picker", {
429
- color: C.value,
430
- "aria-label": u(_).colorPicker.pickColor,
431
- onColorChanged: T,
432
- onPointerdown: E,
433
- onPointerup: D,
434
- onKeydown: d[0] ||= te((e) => v.value = !1, ["escape"])
435
- }, null, 40, ke)], 12, Oe)) : f("", !0)]),
436
- _: 1
437
- })], 8, ["to", "disabled"]))
438
- ], 2));
439
- }
440
- });
441
- //#endregion
442
- export { y as _, E as a, w as c, S as d, h as f, x as g, m as h, k as i, b as l, _ as m, D as n, C as o, g as p, O as r, T as s, Ae as t, v as u };