@aswin.dev/editor 0.7.1 → 0.7.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.
- package/LICENSE +56 -0
- package/dist/{AiChatSidebar-DWGPVtvC.js → AiChatSidebar-Dt5pvG5t.js} +37 -51
- package/dist/{AiFeatureMenu-duUFSfDf.js → AiFeatureMenu-BipxcGap.js} +1 -1
- package/dist/{CloudEditor-CFldoCOb.js → CloudEditor-CnUX0IOW.js} +283 -239
- package/dist/{CollaboratorBar-Bw-lbt61.js → CollaboratorBar-NaaZTjbs.js} +2 -2
- package/dist/{CommentsSidebar-BaD5F53-.js → CommentsSidebar-DE6ZsM4D.js} +9 -10
- package/dist/CountdownBlock-Ba3T-i2X.js +1536 -0
- package/dist/{CountdownToolbar-Dg4F8MTk.js → CountdownToolbar-CbhSp_uq.js} +1 -1
- package/dist/{DesignReferenceSidebar-BSH7uNP_.js → DesignReferenceSidebar-CZg97bbj.js} +1 -1
- package/dist/{ModuleBrowserModal-6phxZSKI.js → ModuleBrowserModal-D2EVdexc.js} +4 -4
- package/dist/{ModulePreviewCanvas-BW8L3eQX.js → ModulePreviewCanvas-P3N-nxkU.js} +52 -47
- package/dist/{NumberWithSuffix-BpUzQOJt.js → NumberWithSuffix-CihczoAd.js} +1 -1
- package/dist/{ParagraphEditor-DNSzAB-I.js → ParagraphEditor-BbRuKhWv.js} +7 -7
- package/dist/{SaveModuleDialog-zMQTpez7.js → SaveModuleDialog-DLZa3m3O.js} +2 -2
- package/dist/{SnapshotHistory-Do-A5rYU.js → SnapshotHistory-Csg1_jXi.js} +3 -3
- package/dist/{TestEmailModal-DGj_9V1u.js → TestEmailModal-m3okLbJz.js} +2 -2
- package/dist/{TitleEditor-C7IDnAoS.js → TitleEditor-CtJIS5ER.js} +2 -2
- package/dist/{TplModal-BAsVzcTb.js → TplModal-CQCrKeKP.js} +1 -1
- package/dist/{blockTypeIcons-C6LDKvmd.js → blockTypeIcons-Dah0pgt-.js} +50 -19
- package/dist/bundle-stats.json +8 -8
- package/dist/cdn/chunks/AccessibilityPanel-Bt_fD7QT.js +97 -0
- package/dist/cdn/chunks/AccessibilityPanel-Bt_fD7QT.js.map +1 -0
- package/dist/cdn/chunks/AiFeatureMenu-Bn-0rgfr.js +59 -0
- package/dist/cdn/chunks/AiFeatureMenu-Bn-0rgfr.js.map +1 -0
- package/dist/cdn/chunks/BlockA11yBadge-Cj18Iw0p.js +33 -0
- package/dist/cdn/chunks/BlockA11yBadge-Cj18Iw0p.js.map +1 -0
- package/dist/cdn/chunks/CloudEditor-56lVcdot.js +1220 -0
- package/dist/cdn/chunks/CloudEditor-56lVcdot.js.map +1 -0
- package/dist/cdn/chunks/CollaboratorBar-B7DCV3xp.js +51 -0
- package/dist/cdn/chunks/CollaboratorBar-B7DCV3xp.js.map +1 -0
- package/dist/cdn/chunks/CountdownToolbar-BtaD3d3-.js +212 -0
- package/dist/cdn/chunks/CountdownToolbar-BtaD3d3-.js.map +1 -0
- package/dist/cdn/chunks/ModuleBrowserModal-CiIY7ZGv.js +195 -0
- package/dist/cdn/chunks/ModuleBrowserModal-CiIY7ZGv.js.map +1 -0
- package/dist/cdn/chunks/ModulePreviewCanvas-M7_OGV2m.js +113 -0
- package/dist/cdn/chunks/ModulePreviewCanvas-M7_OGV2m.js.map +1 -0
- package/dist/cdn/chunks/NumberWithSuffix-DfVBnsgc.js +423 -0
- package/dist/cdn/chunks/NumberWithSuffix-DfVBnsgc.js.map +1 -0
- package/dist/cdn/chunks/ParagraphEditor-1XJOpiLX.js +544 -0
- package/dist/cdn/chunks/ParagraphEditor-1XJOpiLX.js.map +1 -0
- package/dist/cdn/chunks/RichTextEditorContent-C2q8sbp2.js +106 -0
- package/dist/cdn/chunks/RichTextEditorContent-C2q8sbp2.js.map +1 -0
- package/dist/cdn/chunks/SaveModuleDialog-BNxh1jPT.js +119 -0
- package/dist/cdn/chunks/SaveModuleDialog-BNxh1jPT.js.map +1 -0
- package/dist/cdn/chunks/TitleEditor-IF7VzLTk.js +171 -0
- package/dist/cdn/chunks/TitleEditor-IF7VzLTk.js.map +1 -0
- package/dist/cdn/chunks/blockTypeIcons-tPBKQ8WC.js +24 -0
- package/dist/cdn/chunks/blockTypeIcons-tPBKQ8WC.js.map +1 -0
- package/dist/cdn/chunks/de-B05yW8Gi.js +840 -0
- package/dist/cdn/chunks/de-B05yW8Gi.js.map +1 -0
- package/dist/cdn/chunks/de-BPHtelu7.js +209 -0
- package/dist/cdn/chunks/de-BPHtelu7.js.map +1 -0
- package/dist/cdn/chunks/de-BRDqJwJe.js +89 -0
- package/dist/cdn/chunks/de-BRDqJwJe.js.map +1 -0
- package/dist/cdn/chunks/draggable-C-1_gch3.js +11572 -0
- package/dist/cdn/chunks/draggable-C-1_gch3.js.map +1 -0
- package/dist/cdn/chunks/emojiData-DUHzsh4j.js +19 -0
- package/dist/cdn/chunks/emojiData-DUHzsh4j.js.map +1 -0
- package/dist/cdn/chunks/en-BII7695P.js +840 -0
- package/dist/cdn/chunks/en-BII7695P.js.map +1 -0
- package/dist/cdn/chunks/en-Cdj_Ikl1.js +89 -0
- package/dist/cdn/chunks/en-Cdj_Ikl1.js.map +1 -0
- package/dist/cdn/chunks/en-DejwuJhw.js +209 -0
- package/dist/cdn/chunks/en-DejwuJhw.js.map +1 -0
- package/dist/cdn/chunks/extensions-B0eT-yjf.js +598 -0
- package/dist/cdn/chunks/extensions-B0eT-yjf.js.map +1 -0
- package/dist/cdn/chunks/features-BrvE2Fzv.js +9677 -0
- package/dist/cdn/chunks/features-BrvE2Fzv.js.map +1 -0
- package/dist/cdn/chunks/icons-C7wtAD8p.js +1043 -0
- package/dist/cdn/chunks/icons-C7wtAD8p.js.map +1 -0
- package/dist/cdn/chunks/liquid.browser-CllF-us3.js +3279 -0
- package/dist/cdn/chunks/liquid.browser-CllF-us3.js.map +1 -0
- package/dist/cdn/chunks/media-library-Cl5XuaKy.js +6030 -0
- package/dist/cdn/chunks/media-library-Cl5XuaKy.js.map +1 -0
- package/dist/cdn/chunks/pusher-i7-OBujc.js +2508 -0
- package/dist/cdn/chunks/pusher-i7-OBujc.js.map +1 -0
- package/dist/cdn/chunks/quality-Va91a3N8.js +1456 -0
- package/dist/cdn/chunks/quality-Va91a3N8.js.map +1 -0
- package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js +32 -0
- package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js.map +1 -0
- package/dist/cdn/chunks/renderer-si0Zgxeb.js +642 -0
- package/dist/cdn/chunks/renderer-si0Zgxeb.js.map +1 -0
- package/dist/cdn/chunks/rolldown-runtime-BNuo_Jkg.js +20 -0
- package/dist/cdn/chunks/src-BLyYIbdZ.js +497 -0
- package/dist/cdn/chunks/src-BLyYIbdZ.js.map +1 -0
- package/dist/cdn/chunks/styleConstants-DfcU8u_r.js +57 -0
- package/dist/cdn/chunks/styleConstants-DfcU8u_r.js.map +1 -0
- package/dist/cdn/chunks/styles-C6BQLT9F.js +5807 -0
- package/dist/cdn/chunks/styles-C6BQLT9F.js.map +1 -0
- package/dist/cdn/chunks/tiptap-D8whBv5F.js +14654 -0
- package/dist/cdn/chunks/tiptap-D8whBv5F.js.map +1 -0
- package/dist/cdn/editor.css +2 -0
- package/dist/cdn/editor.js +367 -0
- package/dist/cdn/editor.js.map +1 -0
- package/dist/{cloud-6ZmAvF0j.js → cloud-BoS0J0vs.js} +1 -1
- package/dist/{de-DWcgp-7T.js → de-C74F9xK3.js} +112 -3
- package/dist/dist-C2grMquk.js +1261 -0
- package/dist/{dist-CivF9P8b.js → dist-Djgi0A6k.js} +92 -77
- package/dist/{en-Cxd4fhNm.js → en-B24jVTeO.js} +112 -3
- package/dist/{extensions-D__hOlV1.js → extensions-DsmjHqBF.js} +14 -14
- package/dist/index.d.ts +21 -10
- package/dist/{pencil-BZJPNYWR.js → pencil-Bpimrzzw.js} +5 -2
- package/dist/style.css +1 -1
- package/dist/styles-BMFMtR9R.js +6341 -0
- package/dist/templatical-editor.js +197 -139
- package/dist/undo-2-m1EUDbUg.js +16 -0
- package/dist/{useEditorCore-wslttMH-.js → useEditorCore-CtNAo0uy.js} +2154 -2025
- package/dist/useMergeTag-2vTcVpNo.js +34 -0
- package/package.json +12 -12
- package/dist/CountdownBlock-DaYGxKqo.js +0 -92
- package/dist/check-DJrpDKO_.js +0 -7
- package/dist/dist-C04s_fLA.js +0 -563
- package/dist/styles-B4tjX5SP.js +0 -5224
- package/dist/useMergeTag-DX0XG5V9.js +0 -34
- /package/dist/{clock-ik2pRJKG.js → clock-Ba4p3rJM.js} +0 -0
- /package/dist/{readableTextColor-DVuzNX1y.js → readableTextColor-C_9OpzBw.js} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { C as e, D as t, I as n, P as r, R as i, ct as a, dt as o, f as s, g as c, h as l, m as u, v as d, z as f } from "./draggable-C-1_gch3.js";
|
|
2
|
+
import { F as p, G as m, H as h, J as g, K as _, Kt as v, Lt as y, M as b, N as x, P as S, R as C, U as w, W as T, X as E, Y as D, j as O, q as k, z as A } from "./features-BrvE2Fzv.js";
|
|
3
|
+
//#region src/components/blocks/PreviewSectionBlock.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var j = { class: "tpl:w-full" }, M = { class: "tpl:flex tpl:gap-0" }, N = /* @__PURE__ */ e({
|
|
5
|
+
name: "PreviewSectionBlock",
|
|
6
|
+
__name: "PreviewSectionBlock",
|
|
7
|
+
props: {
|
|
8
|
+
block: {},
|
|
9
|
+
viewport: {}
|
|
10
|
+
},
|
|
11
|
+
setup(e) {
|
|
12
|
+
let N = {
|
|
13
|
+
title: b,
|
|
14
|
+
paragraph: T,
|
|
15
|
+
image: k,
|
|
16
|
+
video: O,
|
|
17
|
+
button: y,
|
|
18
|
+
input: _,
|
|
19
|
+
divider: D,
|
|
20
|
+
social: p,
|
|
21
|
+
menu: m,
|
|
22
|
+
table: x,
|
|
23
|
+
spacer: S,
|
|
24
|
+
html: g,
|
|
25
|
+
countdown: A,
|
|
26
|
+
form: C,
|
|
27
|
+
custom: E
|
|
28
|
+
}, P = e, F = t(v, null), I = u(() => {
|
|
29
|
+
switch (P.block.columns) {
|
|
30
|
+
case "2": return ["50%", "50%"];
|
|
31
|
+
case "3": return [
|
|
32
|
+
"33.33%",
|
|
33
|
+
"33.33%",
|
|
34
|
+
"33.33%"
|
|
35
|
+
];
|
|
36
|
+
case "1-2": return ["33.33%", "66.67%"];
|
|
37
|
+
case "2-1": return ["66.67%", "33.33%"];
|
|
38
|
+
default: return ["100%"];
|
|
39
|
+
}
|
|
40
|
+
}), L = u(() => {
|
|
41
|
+
let e = I.value.length, t = [...P.block.children];
|
|
42
|
+
for (; t.length < e;) t.push([]);
|
|
43
|
+
return t.slice(0, e);
|
|
44
|
+
});
|
|
45
|
+
function R(e) {
|
|
46
|
+
return L.value[e] || [];
|
|
47
|
+
}
|
|
48
|
+
function z(e) {
|
|
49
|
+
return w(e, F, N);
|
|
50
|
+
}
|
|
51
|
+
return (e, t) => {
|
|
52
|
+
let u = i("PreviewSectionBlock", !0);
|
|
53
|
+
return r(), d("div", j, [l("div", M, [(r(!0), d(s, null, n(L.value, (e, t) => (r(), d("div", {
|
|
54
|
+
key: t,
|
|
55
|
+
style: o({ width: I.value[t] })
|
|
56
|
+
}, [(r(!0), d(s, null, n(R(t), (e) => (r(), d("div", {
|
|
57
|
+
key: e.id,
|
|
58
|
+
style: o(a(h)(e))
|
|
59
|
+
}, [e.type === "section" ? (r(), c(u, {
|
|
60
|
+
key: 0,
|
|
61
|
+
block: e,
|
|
62
|
+
viewport: "desktop"
|
|
63
|
+
}, null, 8, ["block"])) : (r(), c(f(z(e)), {
|
|
64
|
+
key: 1,
|
|
65
|
+
block: e,
|
|
66
|
+
viewport: "desktop"
|
|
67
|
+
}, null, 8, ["block"]))], 4))), 128))], 4))), 128))])]);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}), P = {
|
|
71
|
+
class: "tpl:pointer-events-none tpl:mx-auto tpl:w-[600px] tpl:select-none tpl:rounded-lg",
|
|
72
|
+
style: {
|
|
73
|
+
"background-color": "var(--tpl-canvas-bg)",
|
|
74
|
+
"box-shadow": "var(--tpl-shadow-sm)"
|
|
75
|
+
}
|
|
76
|
+
}, F = /* @__PURE__ */ e({
|
|
77
|
+
__name: "ModulePreviewCanvas",
|
|
78
|
+
props: { blocks: {} },
|
|
79
|
+
setup(e) {
|
|
80
|
+
let i = t(v), l = {
|
|
81
|
+
section: N,
|
|
82
|
+
title: b,
|
|
83
|
+
paragraph: T,
|
|
84
|
+
image: k,
|
|
85
|
+
video: O,
|
|
86
|
+
button: y,
|
|
87
|
+
input: _,
|
|
88
|
+
divider: D,
|
|
89
|
+
social: p,
|
|
90
|
+
menu: m,
|
|
91
|
+
table: x,
|
|
92
|
+
spacer: S,
|
|
93
|
+
html: g,
|
|
94
|
+
countdown: A,
|
|
95
|
+
form: C,
|
|
96
|
+
custom: E
|
|
97
|
+
};
|
|
98
|
+
function u(e) {
|
|
99
|
+
return w(e, i, l);
|
|
100
|
+
}
|
|
101
|
+
return (t, i) => (r(), d("div", P, [(r(!0), d(s, null, n(e.blocks, (e) => (r(), d("div", {
|
|
102
|
+
key: e.id,
|
|
103
|
+
style: o(a(h)(e))
|
|
104
|
+
}, [(r(), c(f(u(e)), {
|
|
105
|
+
block: e,
|
|
106
|
+
viewport: "desktop"
|
|
107
|
+
}, null, 8, ["block"]))], 4))), 128))]));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
//#endregion
|
|
111
|
+
export { F as default };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=ModulePreviewCanvas-M7_OGV2m.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModulePreviewCanvas-M7_OGV2m.js","names":[],"sources":["../../../src/components/blocks/PreviewSectionBlock.vue","../../../src/components/blocks/PreviewSectionBlock.vue","../../../src/cloud/components/ModulePreviewCanvas.vue","../../../src/cloud/components/ModulePreviewCanvas.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport ButtonBlock from \"./ButtonBlock.vue\";\nimport CountdownBlockComponent from \"./CountdownBlock.vue\";\nimport CustomBlock from \"./CustomBlock.vue\";\nimport DividerBlock from \"./DividerBlock.vue\";\nimport FormBlockComponent from \"./FormBlock.vue\";\nimport HtmlBlock from \"./HtmlBlock.vue\";\nimport ImageBlock from \"./ImageBlock.vue\";\nimport InputBlock from \"./InputBlock.vue\";\nimport MenuBlock from \"./MenuBlock.vue\";\nimport SocialIconsBlock from \"./SocialIconsBlock.vue\";\nimport SpacerBlock from \"./SpacerBlock.vue\";\nimport TableBlock from \"./TableBlock.vue\";\nimport TitleBlock from \"./TitleBlock.vue\";\nimport ParagraphBlock from \"./ParagraphBlock.vue\";\nimport VideoBlock from \"./VideoBlock.vue\";\nimport {\n resolveBlockComponent,\n getBlockWrapperStyle,\n} from \"../../utils/blockComponentResolver\";\nimport type { Block, SectionBlock as SectionBlockType } from \"@aswin.dev/types\";\nimport { computed, inject, type Component } from \"vue\";\nimport { BLOCK_REGISTRY_KEY } from \"../../keys\";\n\nconst previewBlockComponentMap: Record<string, Component> = {\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n input: InputBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n countdown: CountdownBlockComponent,\n form: FormBlockComponent,\n custom: CustomBlock,\n};\n\nconst props = defineProps<{\n block: SectionBlockType;\n viewport: \"desktop\";\n}>();\n\ndefineOptions({ name: \"PreviewSectionBlock\" });\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY, null);\n\nconst columnWidths = computed(() => {\n switch (props.block.columns) {\n case \"2\":\n return [\"50%\", \"50%\"];\n case \"3\":\n return [\"33.33%\", \"33.33%\", \"33.33%\"];\n case \"1-2\":\n return [\"33.33%\", \"66.67%\"];\n case \"2-1\":\n return [\"66.67%\", \"33.33%\"];\n default:\n return [\"100%\"];\n }\n});\n\nconst columns = computed(() => {\n const count = columnWidths.value.length;\n const children = [...props.block.children];\n while (children.length < count) {\n children.push([]);\n }\n return children.slice(0, count);\n});\n\nfunction getColumnBlocks(colIndex: number): Block[] {\n return columns.value[colIndex] || [];\n}\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, previewBlockComponentMap);\n}\n</script>\n\n<template>\n <div class=\"tpl:w-full\">\n <div class=\"tpl:flex tpl:gap-0\">\n <div\n v-for=\"(_, colIndex) in columns\"\n :key=\"colIndex\"\n :style=\"{ width: columnWidths[colIndex] }\"\n >\n <div\n v-for=\"childBlock in getColumnBlocks(colIndex)\"\n :key=\"childBlock.id\"\n :style=\"getBlockWrapperStyle(childBlock)\"\n >\n <!-- Recursive self-reference for nested sections -->\n <PreviewSectionBlock\n v-if=\"childBlock.type === 'section'\"\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n <component\n :is=\"getBlockComponent(childBlock)\"\n v-else\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport ButtonBlock from \"./ButtonBlock.vue\";\nimport CountdownBlockComponent from \"./CountdownBlock.vue\";\nimport CustomBlock from \"./CustomBlock.vue\";\nimport DividerBlock from \"./DividerBlock.vue\";\nimport FormBlockComponent from \"./FormBlock.vue\";\nimport HtmlBlock from \"./HtmlBlock.vue\";\nimport ImageBlock from \"./ImageBlock.vue\";\nimport InputBlock from \"./InputBlock.vue\";\nimport MenuBlock from \"./MenuBlock.vue\";\nimport SocialIconsBlock from \"./SocialIconsBlock.vue\";\nimport SpacerBlock from \"./SpacerBlock.vue\";\nimport TableBlock from \"./TableBlock.vue\";\nimport TitleBlock from \"./TitleBlock.vue\";\nimport ParagraphBlock from \"./ParagraphBlock.vue\";\nimport VideoBlock from \"./VideoBlock.vue\";\nimport {\n resolveBlockComponent,\n getBlockWrapperStyle,\n} from \"../../utils/blockComponentResolver\";\nimport type { Block, SectionBlock as SectionBlockType } from \"@aswin.dev/types\";\nimport { computed, inject, type Component } from \"vue\";\nimport { BLOCK_REGISTRY_KEY } from \"../../keys\";\n\nconst previewBlockComponentMap: Record<string, Component> = {\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n input: InputBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n countdown: CountdownBlockComponent,\n form: FormBlockComponent,\n custom: CustomBlock,\n};\n\nconst props = defineProps<{\n block: SectionBlockType;\n viewport: \"desktop\";\n}>();\n\ndefineOptions({ name: \"PreviewSectionBlock\" });\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY, null);\n\nconst columnWidths = computed(() => {\n switch (props.block.columns) {\n case \"2\":\n return [\"50%\", \"50%\"];\n case \"3\":\n return [\"33.33%\", \"33.33%\", \"33.33%\"];\n case \"1-2\":\n return [\"33.33%\", \"66.67%\"];\n case \"2-1\":\n return [\"66.67%\", \"33.33%\"];\n default:\n return [\"100%\"];\n }\n});\n\nconst columns = computed(() => {\n const count = columnWidths.value.length;\n const children = [...props.block.children];\n while (children.length < count) {\n children.push([]);\n }\n return children.slice(0, count);\n});\n\nfunction getColumnBlocks(colIndex: number): Block[] {\n return columns.value[colIndex] || [];\n}\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, previewBlockComponentMap);\n}\n</script>\n\n<template>\n <div class=\"tpl:w-full\">\n <div class=\"tpl:flex tpl:gap-0\">\n <div\n v-for=\"(_, colIndex) in columns\"\n :key=\"colIndex\"\n :style=\"{ width: columnWidths[colIndex] }\"\n >\n <div\n v-for=\"childBlock in getColumnBlocks(colIndex)\"\n :key=\"childBlock.id\"\n :style=\"getBlockWrapperStyle(childBlock)\"\n >\n <!-- Recursive self-reference for nested sections -->\n <PreviewSectionBlock\n v-if=\"childBlock.type === 'section'\"\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n <component\n :is=\"getBlockComponent(childBlock)\"\n v-else\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport ButtonBlock from \"../../components/blocks/ButtonBlock.vue\";\nimport CountdownBlockComponent from \"../../components/blocks/CountdownBlock.vue\";\nimport CustomBlock from \"../../components/blocks/CustomBlock.vue\";\nimport DividerBlock from \"../../components/blocks/DividerBlock.vue\";\nimport FormBlockComponent from \"../../components/blocks/FormBlock.vue\";\nimport HtmlBlock from \"../../components/blocks/HtmlBlock.vue\";\nimport ImageBlock from \"../../components/blocks/ImageBlock.vue\";\nimport InputBlock from \"../../components/blocks/InputBlock.vue\";\nimport MenuBlock from \"../../components/blocks/MenuBlock.vue\";\nimport PreviewSectionBlock from \"../../components/blocks/PreviewSectionBlock.vue\";\nimport SocialIconsBlock from \"../../components/blocks/SocialIconsBlock.vue\";\nimport SpacerBlock from \"../../components/blocks/SpacerBlock.vue\";\nimport TableBlock from \"../../components/blocks/TableBlock.vue\";\nimport TitleBlock from \"../../components/blocks/TitleBlock.vue\";\nimport ParagraphBlock from \"../../components/blocks/ParagraphBlock.vue\";\nimport VideoBlock from \"../../components/blocks/VideoBlock.vue\";\nimport { BLOCK_REGISTRY_KEY } from \"../../keys\";\nimport {\n resolveBlockComponent,\n getBlockWrapperStyle,\n} from \"../../utils/blockComponentResolver\";\nimport type { Block } from \"@aswin.dev/types\";\nimport { inject, type Component } from \"vue\";\n\ndefineProps<{\n blocks: Block[];\n}>();\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY);\n\nconst modulePreviewComponentMap: Record<string, Component> = {\n section: PreviewSectionBlock,\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n input: InputBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n countdown: CountdownBlockComponent,\n form: FormBlockComponent,\n custom: CustomBlock,\n};\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, modulePreviewComponentMap);\n}\n</script>\n\n<template>\n <div\n class=\"tpl:pointer-events-none tpl:mx-auto tpl:w-[600px] tpl:select-none tpl:rounded-lg\"\n style=\"\n background-color: var(--tpl-canvas-bg);\n box-shadow: var(--tpl-shadow-sm);\n \"\n >\n <div\n v-for=\"block in blocks\"\n :key=\"block.id\"\n :style=\"getBlockWrapperStyle(block)\"\n >\n <component\n :is=\"getBlockComponent(block)\"\n :block=\"block\"\n viewport=\"desktop\"\n />\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport ButtonBlock from \"../../components/blocks/ButtonBlock.vue\";\nimport CountdownBlockComponent from \"../../components/blocks/CountdownBlock.vue\";\nimport CustomBlock from \"../../components/blocks/CustomBlock.vue\";\nimport DividerBlock from \"../../components/blocks/DividerBlock.vue\";\nimport FormBlockComponent from \"../../components/blocks/FormBlock.vue\";\nimport HtmlBlock from \"../../components/blocks/HtmlBlock.vue\";\nimport ImageBlock from \"../../components/blocks/ImageBlock.vue\";\nimport InputBlock from \"../../components/blocks/InputBlock.vue\";\nimport MenuBlock from \"../../components/blocks/MenuBlock.vue\";\nimport PreviewSectionBlock from \"../../components/blocks/PreviewSectionBlock.vue\";\nimport SocialIconsBlock from \"../../components/blocks/SocialIconsBlock.vue\";\nimport SpacerBlock from \"../../components/blocks/SpacerBlock.vue\";\nimport TableBlock from \"../../components/blocks/TableBlock.vue\";\nimport TitleBlock from \"../../components/blocks/TitleBlock.vue\";\nimport ParagraphBlock from \"../../components/blocks/ParagraphBlock.vue\";\nimport VideoBlock from \"../../components/blocks/VideoBlock.vue\";\nimport { BLOCK_REGISTRY_KEY } from \"../../keys\";\nimport {\n resolveBlockComponent,\n getBlockWrapperStyle,\n} from \"../../utils/blockComponentResolver\";\nimport type { Block } from \"@aswin.dev/types\";\nimport { inject, type Component } from \"vue\";\n\ndefineProps<{\n blocks: Block[];\n}>();\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY);\n\nconst modulePreviewComponentMap: Record<string, Component> = {\n section: PreviewSectionBlock,\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n input: InputBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n countdown: CountdownBlockComponent,\n form: FormBlockComponent,\n custom: CustomBlock,\n};\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, modulePreviewComponentMap);\n}\n</script>\n\n<template>\n <div\n class=\"tpl:pointer-events-none tpl:mx-auto tpl:w-[600px] tpl:select-none tpl:rounded-lg\"\n style=\"\n background-color: var(--tpl-canvas-bg);\n box-shadow: var(--tpl-shadow-sm);\n \"\n >\n <div\n v-for=\"block in blocks\"\n :key=\"block.id\"\n :style=\"getBlockWrapperStyle(block)\"\n >\n <component\n :is=\"getBlockComponent(block)\"\n :block=\"block\"\n viewport=\"desktop\"\n />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;EAwBA,IAAM,IAAsD;GAC1D,OAAO;GACP,WAAW;GACX,OAAO;GACP,OAAO;GACP,QAAQ;GACR,OAAO;GACP,SAAS;GACT,QAAQ;GACR,MAAM;GACN,OAAO;GACP,QAAQ;GACR,MAAM;GACN,WAAW;GACX,MAAM;GACN,QAAQ;GACT,EAEK,IAAQ,GAOR,IAAgB,EAAO,GAAoB,KAAK,EAEhD,IAAe,QAAe;AAClC,WAAQ,EAAM,MAAM,SAApB;IACE,KAAK,IACH,QAAO,CAAC,OAAO,MAAM;IACvB,KAAK,IACH,QAAO;KAAC;KAAU;KAAU;KAAS;IACvC,KAAK,MACH,QAAO,CAAC,UAAU,SAAS;IAC7B,KAAK,MACH,QAAO,CAAC,UAAU,SAAS;IAC7B,QACE,QAAO,CAAC,OAAO;;IAEnB,EAEI,IAAU,QAAe;GAC7B,IAAM,IAAQ,EAAa,MAAM,QAC3B,IAAW,CAAC,GAAG,EAAM,MAAM,SAAS;AAC1C,UAAO,EAAS,SAAS,GACvB,GAAS,KAAK,EAAE,CAAC;AAEnB,UAAO,EAAS,MAAM,GAAG,EAAM;IAC/B;EAEF,SAAS,EAAgB,GAA2B;AAClD,UAAO,EAAQ,MAAM,MAAa,EAAE;;EAGtC,SAAS,EAAkB,GAAgC;AACzD,UAAO,EAAsB,GAAO,GAAe,EAAyB;;;;eAK5E,EA2BM,OA3BN,GA2BM,CA1BJ,EAyBM,OAzBN,GAyBM,EAAA,EAAA,GAAA,EAxBJ,EAuBM,GAAA,MAAA,EAtBoB,EAAA,QAAhB,GAAG,YADb,EAuBM,OAAA;IArBH,KAAK;IACL,OAAK,EAAA,EAAA,OAAW,EAAA,MAAa,IAAQ,CAAA;eAEtC,EAiBM,GAAA,MAAA,EAhBiB,EAAgB,EAAQ,GAAtC,YADT,EAiBM,OAAA;IAfH,KAAK,EAAW;IAChB,OAAK,EAAE,EAAA,EAAoB,CAAC,EAAU,CAAA;OAI/B,EAAW,SAAI,aAAA,GAAA,EADvB,EAIE,GAAA;;IAFC,OAAO;IACR,UAAS;mCAEX,EAKE,EAJK,EAAkB,EAAU,CAAA,EAAA;;IAEhC,OAAO;IACR,UAAS;;;;;;;;;;;;;;EE9ErB,IAAM,IAAgB,EAAO,EAAmB,EAE1C,IAAuD;GAC3D,SAAS;GACT,OAAO;GACP,WAAW;GACX,OAAO;GACP,OAAO;GACP,QAAQ;GACR,OAAO;GACP,SAAS;GACT,QAAQ;GACR,MAAM;GACN,OAAO;GACP,QAAQ;GACR,MAAM;GACN,WAAW;GACX,MAAM;GACN,QAAQ;GACT;EAED,SAAS,EAAkB,GAAgC;AACzD,UAAO,EAAsB,GAAO,GAAe,EAA0B;;yBAK7E,EAkBM,OAlBN,GAkBM,EAAA,EAAA,GAAA,EAXJ,EAUM,GAAA,MAAA,EATY,EAAA,SAAT,YADT,EAUM,OAAA;GARH,KAAK,EAAM;GACX,OAAK,EAAE,EAAA,EAAoB,CAAC,EAAK,CAAA;YAElC,EAIE,EAHK,EAAkB,EAAK,CAAA,EAAA;GACpB;GACR,UAAS"}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { C as e, I as t, L as n, P as r, W as i, _ as a, ct as o, dt as s, f as c, ft as l, g as u, h as d, m as f, n as p, tt as m, u as h, ut as g, v as _, x as ee, z as v } from "./draggable-C-1_gch3.js";
|
|
2
|
+
import { Bt as y, fn as te } from "./features-BrvE2Fzv.js";
|
|
3
|
+
import { h as b, i as x, m as S, p as C, u as ne } from "./styleConstants-DfcU8u_r.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/math.js
|
|
5
|
+
var w = (e, t = 0, n = 1) => e > n ? n : e < t ? t : e, T = (e, t = 0, n = 10 ** t) => Math.round(n * e) / n;
|
|
6
|
+
360 / (Math.PI * 2);
|
|
7
|
+
var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.length < 6 ? {
|
|
8
|
+
r: parseInt(e[0] + e[0], 16),
|
|
9
|
+
g: parseInt(e[1] + e[1], 16),
|
|
10
|
+
b: parseInt(e[2] + e[2], 16),
|
|
11
|
+
a: e.length === 4 ? T(parseInt(e[3] + e[3], 16) / 255, 2) : 1
|
|
12
|
+
} : {
|
|
13
|
+
r: parseInt(e.substring(0, 2), 16),
|
|
14
|
+
g: parseInt(e.substring(2, 4), 16),
|
|
15
|
+
b: parseInt(e.substring(4, 6), 16),
|
|
16
|
+
a: e.length === 8 ? T(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
|
|
17
|
+
}), D = (e) => oe(ae(e)), ie = ({ h: e, s: t, v: n, a: r }) => {
|
|
18
|
+
let i = (200 - t) * n / 100;
|
|
19
|
+
return {
|
|
20
|
+
h: T(e),
|
|
21
|
+
s: T(i > 0 && i < 200 ? t * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
|
|
22
|
+
l: T(i / 2),
|
|
23
|
+
a: T(r, 2)
|
|
24
|
+
};
|
|
25
|
+
}, O = (e) => {
|
|
26
|
+
let { h: t, s: n, l: r } = ie(e);
|
|
27
|
+
return `hsl(${t}, ${n}%, ${r}%)`;
|
|
28
|
+
}, ae = ({ h: e, s: t, v: n, a: r }) => {
|
|
29
|
+
e = e / 360 * 6, t /= 100, n /= 100;
|
|
30
|
+
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;
|
|
31
|
+
return {
|
|
32
|
+
r: T([
|
|
33
|
+
n,
|
|
34
|
+
o,
|
|
35
|
+
a,
|
|
36
|
+
a,
|
|
37
|
+
s,
|
|
38
|
+
n
|
|
39
|
+
][c] * 255),
|
|
40
|
+
g: T([
|
|
41
|
+
s,
|
|
42
|
+
n,
|
|
43
|
+
n,
|
|
44
|
+
o,
|
|
45
|
+
a,
|
|
46
|
+
a
|
|
47
|
+
][c] * 255),
|
|
48
|
+
b: T([
|
|
49
|
+
a,
|
|
50
|
+
a,
|
|
51
|
+
s,
|
|
52
|
+
n,
|
|
53
|
+
n,
|
|
54
|
+
o
|
|
55
|
+
][c] * 255),
|
|
56
|
+
a: T(r, 2)
|
|
57
|
+
};
|
|
58
|
+
}, k = (e) => {
|
|
59
|
+
let t = e.toString(16);
|
|
60
|
+
return t.length < 2 ? "0" + t : t;
|
|
61
|
+
}, oe = ({ r: e, g: t, b: n, a: r }) => {
|
|
62
|
+
let i = r < 1 ? k(T(r * 255)) : "";
|
|
63
|
+
return "#" + k(e) + k(t) + k(n) + i;
|
|
64
|
+
}, A = ({ r: e, g: t, b: n, a: r }) => {
|
|
65
|
+
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;
|
|
66
|
+
return {
|
|
67
|
+
h: T(60 * (o < 0 ? o + 6 : o)),
|
|
68
|
+
s: T(i ? a / i * 100 : 0),
|
|
69
|
+
v: T(i / 255 * 100),
|
|
70
|
+
a: r
|
|
71
|
+
};
|
|
72
|
+
}, j = (e, t) => {
|
|
73
|
+
if (e === t) return !0;
|
|
74
|
+
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
75
|
+
return !0;
|
|
76
|
+
}, M = (e, t) => e.toLowerCase() === t.toLowerCase() ? !0 : j(E(e), E(t)), N = {}, P = (e) => {
|
|
77
|
+
let t = N[e];
|
|
78
|
+
return t || (t = document.createElement("template"), t.innerHTML = e, N[e] = t), t;
|
|
79
|
+
}, F = (e, t, n) => {
|
|
80
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
81
|
+
bubbles: !0,
|
|
82
|
+
detail: n
|
|
83
|
+
}));
|
|
84
|
+
}, I = !1, L = (e) => "touches" in e, R = (e) => I && !L(e) ? !1 : (I ||= L(e), !0), z = (e, t) => {
|
|
85
|
+
let n = L(t) ? t.touches[0] : t, r = e.el.getBoundingClientRect();
|
|
86
|
+
F(e.el, "move", e.getMove({
|
|
87
|
+
x: w((n.pageX - (r.left + window.pageXOffset)) / r.width),
|
|
88
|
+
y: w((n.pageY - (r.top + window.pageYOffset)) / r.height)
|
|
89
|
+
}));
|
|
90
|
+
}, B = (e, t) => {
|
|
91
|
+
let n = t.keyCode;
|
|
92
|
+
n > 40 || e.xy && n < 37 || n < 33 || (t.preventDefault(), F(e.el, "move", e.getMove({
|
|
93
|
+
x: n === 39 ? .01 : n === 37 ? -.01 : n === 34 ? .05 : n === 33 ? -.05 : n === 35 ? 1 : n === 36 ? -1 : 0,
|
|
94
|
+
y: n === 40 ? .01 : n === 38 ? -.01 : 0
|
|
95
|
+
}, !0)));
|
|
96
|
+
}, V = class {
|
|
97
|
+
constructor(e, t, n, r) {
|
|
98
|
+
let i = P(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);
|
|
99
|
+
e.appendChild(i.content.cloneNode(!0));
|
|
100
|
+
let a = e.querySelector(`[part=${t}]`);
|
|
101
|
+
a.addEventListener("mousedown", this), a.addEventListener("touchstart", this), a.addEventListener("keydown", this), this.el = a, this.xy = r, this.nodes = [a.firstChild, a];
|
|
102
|
+
}
|
|
103
|
+
set dragging(e) {
|
|
104
|
+
let t = e ? document.addEventListener : document.removeEventListener;
|
|
105
|
+
t(I ? "touchmove" : "mousemove", this), t(I ? "touchend" : "mouseup", this);
|
|
106
|
+
}
|
|
107
|
+
handleEvent(e) {
|
|
108
|
+
switch (e.type) {
|
|
109
|
+
case "mousedown":
|
|
110
|
+
case "touchstart":
|
|
111
|
+
if (e.preventDefault(), !R(e) || !I && e.button != 0) return;
|
|
112
|
+
this.el.focus(), z(this, e), this.dragging = !0;
|
|
113
|
+
break;
|
|
114
|
+
case "mousemove":
|
|
115
|
+
case "touchmove":
|
|
116
|
+
e.preventDefault(), z(this, e);
|
|
117
|
+
break;
|
|
118
|
+
case "mouseup":
|
|
119
|
+
case "touchend":
|
|
120
|
+
this.dragging = !1;
|
|
121
|
+
break;
|
|
122
|
+
case "keydown":
|
|
123
|
+
B(this, e);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
style(e) {
|
|
128
|
+
e.forEach((e, t) => {
|
|
129
|
+
for (let n in e) this.nodes[t].style.setProperty(n, e[n]);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}, H = class extends V {
|
|
133
|
+
constructor(e) {
|
|
134
|
+
super(e, "hue", "aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"", !1);
|
|
135
|
+
}
|
|
136
|
+
update({ h: e }) {
|
|
137
|
+
this.h = e, this.style([{
|
|
138
|
+
left: `${e / 360 * 100}%`,
|
|
139
|
+
color: O({
|
|
140
|
+
h: e,
|
|
141
|
+
s: 100,
|
|
142
|
+
v: 100,
|
|
143
|
+
a: 1
|
|
144
|
+
})
|
|
145
|
+
}]), this.el.setAttribute("aria-valuenow", `${T(e)}`);
|
|
146
|
+
}
|
|
147
|
+
getMove(e, t) {
|
|
148
|
+
return { h: t ? w(this.h + e.x * 360, 0, 360) : 360 * e.x };
|
|
149
|
+
}
|
|
150
|
+
}, U = class extends V {
|
|
151
|
+
constructor(e) {
|
|
152
|
+
super(e, "saturation", "aria-label=\"Color\"", !0);
|
|
153
|
+
}
|
|
154
|
+
update(e) {
|
|
155
|
+
this.hsva = e, this.style([{
|
|
156
|
+
top: `${100 - e.v}%`,
|
|
157
|
+
left: `${e.s}%`,
|
|
158
|
+
color: O(e)
|
|
159
|
+
}, { "background-color": O({
|
|
160
|
+
h: e.h,
|
|
161
|
+
s: 100,
|
|
162
|
+
v: 100,
|
|
163
|
+
a: 1
|
|
164
|
+
}) }]), this.el.setAttribute("aria-valuetext", `Saturation ${T(e.s)}%, Brightness ${T(e.v)}%`);
|
|
165
|
+
}
|
|
166
|
+
getMove(e, t) {
|
|
167
|
+
return {
|
|
168
|
+
s: t ? w(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
|
|
169
|
+
v: t ? w(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}, 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 {
|
|
173
|
+
static get observedAttributes() {
|
|
174
|
+
return ["color"];
|
|
175
|
+
}
|
|
176
|
+
get [Q]() {
|
|
177
|
+
return [
|
|
178
|
+
W,
|
|
179
|
+
G,
|
|
180
|
+
K
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
get [$]() {
|
|
184
|
+
return [U, H];
|
|
185
|
+
}
|
|
186
|
+
get color() {
|
|
187
|
+
return this[J];
|
|
188
|
+
}
|
|
189
|
+
set color(e) {
|
|
190
|
+
if (!this[q](e)) {
|
|
191
|
+
let t = this.colorModel.toHsva(e);
|
|
192
|
+
this[X](t), this[J] = e;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
constructor() {
|
|
196
|
+
super();
|
|
197
|
+
let e = P(`<style>${this[Q].join("")}</style>`), t = this.attachShadow({ mode: "open" });
|
|
198
|
+
t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[Z] = this[$].map((e) => new e(t));
|
|
199
|
+
}
|
|
200
|
+
connectedCallback() {
|
|
201
|
+
if (this.hasOwnProperty("color")) {
|
|
202
|
+
let e = this.color;
|
|
203
|
+
delete this.color, this.color = e;
|
|
204
|
+
} else this.color ||= this.colorModel.defaultColor;
|
|
205
|
+
}
|
|
206
|
+
attributeChangedCallback(e, t, n) {
|
|
207
|
+
let r = this.colorModel.fromAttr(n);
|
|
208
|
+
this[q](r) || (this.color = r);
|
|
209
|
+
}
|
|
210
|
+
handleEvent(e) {
|
|
211
|
+
let t = this[Y], n = {
|
|
212
|
+
...t,
|
|
213
|
+
...e.detail
|
|
214
|
+
};
|
|
215
|
+
this[X](n);
|
|
216
|
+
let r;
|
|
217
|
+
!j(n, t) && !this[q](r = this.colorModel.fromHsva(n)) && (this[J] = r, F(this, "color-changed", { value: r }));
|
|
218
|
+
}
|
|
219
|
+
[q](e) {
|
|
220
|
+
return this.color && this.colorModel.equal(e, this.color);
|
|
221
|
+
}
|
|
222
|
+
[X](e) {
|
|
223
|
+
this[Y] = e, this[Z].forEach((t) => t.update(e));
|
|
224
|
+
}
|
|
225
|
+
}, ce = {
|
|
226
|
+
defaultColor: "#000",
|
|
227
|
+
toHsva: re,
|
|
228
|
+
fromHsva: ({ h: e, s: t, v: n }) => D({
|
|
229
|
+
h: e,
|
|
230
|
+
s: t,
|
|
231
|
+
v: n,
|
|
232
|
+
a: 1
|
|
233
|
+
}),
|
|
234
|
+
equal: M,
|
|
235
|
+
fromAttr: (e) => e
|
|
236
|
+
}, le = class extends se {
|
|
237
|
+
get colorModel() {
|
|
238
|
+
return ce;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
customElements.define("hex-color-picker", class extends le {});
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/components/ColorPicker.vue?vue&type=script&setup=true&lang.ts
|
|
244
|
+
var ue = [
|
|
245
|
+
"disabled",
|
|
246
|
+
"aria-label",
|
|
247
|
+
"aria-expanded"
|
|
248
|
+
], de = [
|
|
249
|
+
"value",
|
|
250
|
+
"placeholder",
|
|
251
|
+
"disabled",
|
|
252
|
+
"aria-label"
|
|
253
|
+
], fe = ["color", "aria-label"], pe = /* @__PURE__ */ e({
|
|
254
|
+
__name: "ColorPicker",
|
|
255
|
+
props: {
|
|
256
|
+
modelValue: {},
|
|
257
|
+
placeholder: { default: x },
|
|
258
|
+
size: { default: "default" },
|
|
259
|
+
swatchOnly: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
default: !1
|
|
262
|
+
},
|
|
263
|
+
disabled: {
|
|
264
|
+
type: Boolean,
|
|
265
|
+
default: !1
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
emits: ["update:modelValue"],
|
|
269
|
+
setup(e, { emit: t }) {
|
|
270
|
+
let n = e, c = t, { t: l } = y(), u = m(!1), v = m(), b = m();
|
|
271
|
+
te(v, () => {
|
|
272
|
+
u.value = !1;
|
|
273
|
+
}, { ignore: [b] });
|
|
274
|
+
let x = f({
|
|
275
|
+
get: () => n.modelValue || "#000000",
|
|
276
|
+
set: (e) => c("update:modelValue", e)
|
|
277
|
+
});
|
|
278
|
+
function S(e) {
|
|
279
|
+
x.value = e.detail.value;
|
|
280
|
+
}
|
|
281
|
+
function C(e) {
|
|
282
|
+
x.value = e.target.value;
|
|
283
|
+
}
|
|
284
|
+
return (t, n) => (r(), _("div", { class: g(["tpl:flex tpl:gap-2 tpl:relative tpl:w-full tpl:min-w-0", e.disabled && "tpl:opacity-60 tpl:cursor-not-allowed"]) }, [
|
|
285
|
+
d("button", {
|
|
286
|
+
ref_key: "swatchRef",
|
|
287
|
+
ref: b,
|
|
288
|
+
type: "button",
|
|
289
|
+
disabled: e.disabled,
|
|
290
|
+
"aria-label": o(l).colorPicker.pickColor,
|
|
291
|
+
"aria-expanded": u.value,
|
|
292
|
+
class: g([
|
|
293
|
+
"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)]",
|
|
294
|
+
e.disabled ? "tpl:cursor-not-allowed" : "tpl:cursor-pointer",
|
|
295
|
+
u.value ? "tpl:border-[var(--tpl-primary)] tpl:shadow-[var(--tpl-ring)]" : !e.disabled && "hover:tpl:border-[var(--tpl-text-dim)]",
|
|
296
|
+
e.size === "large" ? "tpl:size-12" : "tpl:size-10"
|
|
297
|
+
]),
|
|
298
|
+
onClick: n[0] ||= (t) => !e.disabled && (u.value = !u.value)
|
|
299
|
+
}, [d("span", {
|
|
300
|
+
class: "tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]",
|
|
301
|
+
style: s({ backgroundColor: x.value })
|
|
302
|
+
}, null, 4)], 10, ue),
|
|
303
|
+
e.swatchOnly ? a("", !0) : (r(), _("input", {
|
|
304
|
+
key: 0,
|
|
305
|
+
type: "text",
|
|
306
|
+
class: g(o(ne)),
|
|
307
|
+
value: e.modelValue,
|
|
308
|
+
placeholder: e.placeholder,
|
|
309
|
+
disabled: e.disabled,
|
|
310
|
+
"aria-label": o(l).colorPicker.hexValue,
|
|
311
|
+
onInput: C
|
|
312
|
+
}, null, 42, de)),
|
|
313
|
+
ee(p, {
|
|
314
|
+
"enter-active-class": "tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
315
|
+
"enter-from-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1",
|
|
316
|
+
"enter-to-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
|
|
317
|
+
"leave-active-class": "tpl:transition-all tpl:duration-[80ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
318
|
+
"leave-from-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
|
|
319
|
+
"leave-to-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1"
|
|
320
|
+
}, {
|
|
321
|
+
default: i(() => [u.value ? (r(), _("div", {
|
|
322
|
+
key: 0,
|
|
323
|
+
ref_key: "popoverRef",
|
|
324
|
+
ref: v,
|
|
325
|
+
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"
|
|
326
|
+
}, [d("hex-color-picker", {
|
|
327
|
+
color: x.value,
|
|
328
|
+
"aria-label": o(l).colorPicker.pickColor,
|
|
329
|
+
onColorChanged: S,
|
|
330
|
+
onKeydown: n[1] ||= h((e) => u.value = !1, ["escape"])
|
|
331
|
+
}, null, 40, fe)], 512)) : a("", !0)]),
|
|
332
|
+
_: 1
|
|
333
|
+
})
|
|
334
|
+
], 2));
|
|
335
|
+
}
|
|
336
|
+
}), me = [
|
|
337
|
+
"aria-checked",
|
|
338
|
+
"aria-label",
|
|
339
|
+
"title",
|
|
340
|
+
"onClick"
|
|
341
|
+
], he = { key: 1 }, ge = /* @__PURE__ */ e({
|
|
342
|
+
__name: "SlidingPillSelect",
|
|
343
|
+
props: {
|
|
344
|
+
options: {},
|
|
345
|
+
modelValue: {}
|
|
346
|
+
},
|
|
347
|
+
emits: ["update:modelValue"],
|
|
348
|
+
setup(e, { emit: n }) {
|
|
349
|
+
let i = e, o = n, d = f(() => i.options.findIndex((e) => e.value === i.modelValue)), p = f(() => `translateX(${Math.max(d.value, 0) * 100}%)`);
|
|
350
|
+
return (n, i) => (r(), _("div", {
|
|
351
|
+
role: "radiogroup",
|
|
352
|
+
class: "tpl:relative tpl:grid tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1",
|
|
353
|
+
style: s({
|
|
354
|
+
gridTemplateColumns: `repeat(${e.options.length}, 1fr)`,
|
|
355
|
+
backgroundColor: "var(--tpl-bg-hover)"
|
|
356
|
+
})
|
|
357
|
+
}, [d.value >= 0 ? (r(), _("div", {
|
|
358
|
+
key: 0,
|
|
359
|
+
class: "tpl:absolute tpl:inset-y-1 tpl:rounded-[var(--tpl-radius-sm)]",
|
|
360
|
+
style: s({
|
|
361
|
+
left: "4px",
|
|
362
|
+
width: `calc((100% - 8px) / ${e.options.length})`,
|
|
363
|
+
transform: p.value,
|
|
364
|
+
backgroundColor: "var(--tpl-bg)",
|
|
365
|
+
boxShadow: "var(--tpl-shadow)",
|
|
366
|
+
transition: "transform 120ms cubic-bezier(0.16, 1, 0.3, 1)"
|
|
367
|
+
})
|
|
368
|
+
}, null, 4)) : a("", !0), (r(!0), _(c, null, t(e.options, (t) => (r(), _("button", {
|
|
369
|
+
key: t.value,
|
|
370
|
+
role: "radio",
|
|
371
|
+
"aria-checked": e.modelValue === t.value,
|
|
372
|
+
"aria-label": t.label,
|
|
373
|
+
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",
|
|
374
|
+
style: s({
|
|
375
|
+
color: e.modelValue === t.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
376
|
+
transition: "color 120ms cubic-bezier(0.16, 1, 0.3, 1)"
|
|
377
|
+
}),
|
|
378
|
+
title: t.label,
|
|
379
|
+
onClick: (e) => o("update:modelValue", t.value)
|
|
380
|
+
}, [t.icon ? (r(), u(v(t.icon), {
|
|
381
|
+
key: 0,
|
|
382
|
+
size: 14,
|
|
383
|
+
"stroke-width": 2
|
|
384
|
+
})) : (r(), _("span", he, l(t.label), 1))], 12, me))), 128))], 4));
|
|
385
|
+
}
|
|
386
|
+
}), _e = { class: "tpl:mb-3.5" }, ve = /* @__PURE__ */ e({
|
|
387
|
+
__name: "FieldRow",
|
|
388
|
+
props: { label: {} },
|
|
389
|
+
setup(e) {
|
|
390
|
+
return (t, i) => (r(), _("div", _e, [e.label ? (r(), _("label", {
|
|
391
|
+
key: 0,
|
|
392
|
+
class: g(o(b))
|
|
393
|
+
}, l(e.label), 3)) : a("", !0), n(t.$slots, "default")]));
|
|
394
|
+
}
|
|
395
|
+
}), ye = { class: "tpl:flex tpl:items-stretch" }, be = [
|
|
396
|
+
"value",
|
|
397
|
+
"min",
|
|
398
|
+
"max"
|
|
399
|
+
], xe = /* @__PURE__ */ e({
|
|
400
|
+
__name: "NumberWithSuffix",
|
|
401
|
+
props: {
|
|
402
|
+
modelValue: {},
|
|
403
|
+
min: {},
|
|
404
|
+
max: {},
|
|
405
|
+
suffix: {}
|
|
406
|
+
},
|
|
407
|
+
emits: ["update:modelValue"],
|
|
408
|
+
setup(e, { emit: t }) {
|
|
409
|
+
let n = t;
|
|
410
|
+
return (t, i) => (r(), _("div", ye, [d("input", {
|
|
411
|
+
type: "number",
|
|
412
|
+
class: g(o(C)),
|
|
413
|
+
value: e.modelValue,
|
|
414
|
+
min: e.min,
|
|
415
|
+
max: e.max,
|
|
416
|
+
onInput: i[0] ||= (e) => n("update:modelValue", Number(e.target.value))
|
|
417
|
+
}, null, 42, be), d("span", { class: g(o(S)) }, l(e.suffix), 3)]));
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
//#endregion
|
|
421
|
+
export { pe as i, ve as n, ge as r, xe as t };
|
|
422
|
+
|
|
423
|
+
//# sourceMappingURL=NumberWithSuffix-DfVBnsgc.js.map
|