@templatical/editor 0.21.2 → 0.23.0
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/README.md +1 -1
- package/dist/{AiChatSidebar-K_AehWc-.js → AiChatSidebar-Bru6-ziQ.js} +1 -1
- package/dist/{AiFeatureMenu-CcqQDHzJ.js → AiFeatureMenu-CcqjRMFW.js} +1 -1
- package/dist/{SavedBlockPreviewCanvas-2-mzAnZE.js → BlockPreviewCanvas-MD9BGuXV.js} +36 -30
- package/dist/{CloudEditor-DOjGJwPe.js → CloudEditor-iK4vkpNm.js} +275 -279
- package/dist/{CollaboratorBar-Bj4NZiie.js → CollaboratorBar-C_1SF7Xf.js} +1 -1
- package/dist/{DesignReferenceSidebar-DNmK3dxp.js → DesignReferenceSidebar-BxPo0zyx.js} +1 -1
- package/dist/{MergeTagSuggestion-DMe4rqn0.js → MergeTagSuggestion-D9eCryMC.js} +2 -2
- package/dist/{ParagraphEditor--_zWfxps.js → ParagraphEditor-MKJYyWN9.js} +13 -13
- package/dist/{SaveBlockDialog-CYIEHABH.js → SaveBlockDialog-CFAJHP3v.js} +99 -98
- package/dist/{SavedBlocksBrowserModal-D5V5yF_3.js → SavedBlocksBrowserModal-C_-Xcm0Q.js} +4 -4
- package/dist/{SavedBlocksPanels-Dff38YXu.js → SavedBlocksPanels-CRf7zzFn.js} +1 -1
- package/dist/{SavedBlocksPickBar-rB6iyji6.js → SavedBlocksPickBar-C1FTJP-I.js} +1 -1
- package/dist/{SnapshotHistory-FtzDq8f0.js → SnapshotHistory-DWlQ3Eh0.js} +1 -1
- package/dist/TestEmailModal-D90-3Yex.js +162 -0
- package/dist/TestEmailPanel-B0u_Yd3X.js +33 -0
- package/dist/{TitleEditor-CPda5lh-.js → TitleEditor-DzsPxKv4.js} +5 -5
- package/dist/{TplModal-C7Koj5gM.js → TplModal-CykwWFhF.js} +1 -1
- package/dist/ViewportToggle-BjmbNoao.js +97 -0
- package/dist/{blockTypeIcons-CgwECCut.js → blockTypeIcons-CpKkI47V.js} +1 -1
- package/dist/bundle-stats.json +8 -8
- package/dist/{ca-BBgad6y5.js → ca-D47BxSGu.js} +14 -0
- package/dist/cdn/chunks/{AiChatSidebar-A1CuWGY0.js → AiChatSidebar-BMnsF8G6.js} +2 -2
- package/dist/cdn/chunks/{AiChatSidebar-A1CuWGY0.js.map → AiChatSidebar-BMnsF8G6.js.map} +1 -1
- package/dist/cdn/chunks/{AiFeatureMenu-Duwg413F.js → AiFeatureMenu-hWgWQg11.js} +2 -2
- package/dist/cdn/chunks/{AiFeatureMenu-Duwg413F.js.map → AiFeatureMenu-hWgWQg11.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlockPreviewCanvas-DZOMgNsz.js → BlockPreviewCanvas-eASrdFSN.js} +37 -31
- package/dist/cdn/chunks/BlockPreviewCanvas-eASrdFSN.js.map +1 -0
- package/dist/cdn/chunks/{CloudEditor-C0Y4RD4c.js → CloudEditor-S8zLHtKb.js} +253 -257
- package/dist/cdn/chunks/CloudEditor-S8zLHtKb.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-BS3rJy6-.js → CollaboratorBar-mkJVAkSh.js} +2 -2
- package/dist/cdn/chunks/{CollaboratorBar-BS3rJy6-.js.map → CollaboratorBar-mkJVAkSh.js.map} +1 -1
- package/dist/cdn/chunks/{DesignReferenceSidebar-Dre99DTH.js → DesignReferenceSidebar-CM-k15pd.js} +2 -2
- package/dist/cdn/chunks/{DesignReferenceSidebar-Dre99DTH.js.map → DesignReferenceSidebar-CM-k15pd.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagSuggestion-D7TsECll.js → MergeTagSuggestion-BM349_QH.js} +2 -2
- package/dist/cdn/chunks/{MergeTagSuggestion-D7TsECll.js.map → MergeTagSuggestion-BM349_QH.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-CtaRa1vr.js → ParagraphEditor-J-1RLyi7.js} +14 -14
- package/dist/cdn/chunks/{ParagraphEditor-CtaRa1vr.js.map → ParagraphEditor-J-1RLyi7.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-Bb3fdUEZ.js → SaveBlockDialog-Bi_Z3kuA.js} +100 -99
- package/dist/cdn/chunks/SaveBlockDialog-Bi_Z3kuA.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-CeUWcPv0.js → SavedBlocksBrowserModal-CesYxFsH.js} +4 -4
- package/dist/cdn/chunks/SavedBlocksBrowserModal-CesYxFsH.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksPanels-D-pA_wfk.js → SavedBlocksPanels-BsSpJwrW.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-D-pA_wfk.js.map → SavedBlocksPanels-BsSpJwrW.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-1rf1KpqS.js → SavedBlocksPickBar-CduR1Cpb.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPickBar-1rf1KpqS.js.map → SavedBlocksPickBar-CduR1Cpb.js.map} +1 -1
- package/dist/cdn/chunks/{SnapshotHistory-Bf1uovti.js → SnapshotHistory-DO-gzr3i.js} +2 -2
- package/dist/cdn/chunks/{SnapshotHistory-Bf1uovti.js.map → SnapshotHistory-DO-gzr3i.js.map} +1 -1
- package/dist/cdn/chunks/TestEmailModal-CCWEVrE2.js +162 -0
- package/dist/cdn/chunks/TestEmailModal-CCWEVrE2.js.map +1 -0
- package/dist/cdn/chunks/TestEmailPanel-048m0kxX.js +35 -0
- package/dist/cdn/chunks/TestEmailPanel-048m0kxX.js.map +1 -0
- package/dist/cdn/chunks/{TitleEditor-BJ7LFykI.js → TitleEditor-J1vgU_J6.js} +6 -6
- package/dist/cdn/chunks/{TitleEditor-BJ7LFykI.js.map → TitleEditor-J1vgU_J6.js.map} +1 -1
- package/dist/cdn/chunks/{TplModal-CH9RzKF7.js → TplModal-BN53d9Se.js} +2 -2
- package/dist/cdn/chunks/{TplModal-CH9RzKF7.js.map → TplModal-BN53d9Se.js.map} +1 -1
- package/dist/cdn/chunks/ViewportToggle-CFmF-N4i.js +66 -0
- package/dist/cdn/chunks/ViewportToggle-CFmF-N4i.js.map +1 -0
- package/dist/cdn/chunks/{ca-BBgad6y5.js → ca-D47BxSGu.js} +15 -1
- package/dist/cdn/chunks/{ca-BBgad6y5.js.map → ca-D47BxSGu.js.map} +1 -1
- package/dist/cdn/chunks/{cloud-BJlbXGTJ.js → cloud-F-aVi9hj.js} +45 -41
- package/dist/cdn/chunks/cloud-F-aVi9hj.js.map +1 -0
- package/dist/{de-D7WbpFBR.js → cdn/chunks/de-CnnxBwh7.js} +16 -0
- package/dist/cdn/chunks/{de-D7WbpFBR.js.map → de-CnnxBwh7.js.map} +1 -1
- package/dist/{de-Bw6fB5JU.js → cdn/chunks/de-uVoSP1xF.js} +2 -9
- package/dist/cdn/chunks/de-uVoSP1xF.js.map +1 -0
- package/dist/cdn/chunks/emailFrameWidth-BmFCN2dp.js +8 -0
- package/dist/cdn/chunks/emailFrameWidth-BmFCN2dp.js.map +1 -0
- package/dist/{en-BrZ0uGK2.js → cdn/chunks/en-5gW-bYy2.js} +16 -0
- package/dist/cdn/chunks/{en-BrZ0uGK2.js.map → en-5gW-bYy2.js.map} +1 -1
- package/dist/{en-DAdHJz7h.js → cdn/chunks/en-CjhsJxb-.js} +2 -9
- package/dist/cdn/chunks/en-CjhsJxb-.js.map +1 -0
- package/dist/{es-tLSLysPs.js → cdn/chunks/es-sQ9SdI0l.js} +16 -0
- package/dist/cdn/chunks/{es-tLSLysPs.js.map → es-sQ9SdI0l.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-ZX2oarW6.js → extensions-C49c51P1.js} +3 -3
- package/dist/cdn/chunks/{extensions-ZX2oarW6.js.map → extensions-C49c51P1.js.map} +1 -1
- package/dist/cdn/chunks/fr-DBZ5w21C.js +624 -0
- package/dist/cdn/chunks/fr-DBZ5w21C.js.map +1 -0
- package/dist/cdn/chunks/fr-Dswns199.js +89 -0
- package/dist/cdn/chunks/fr-Dswns199.js.map +1 -0
- package/dist/cdn/chunks/nl-CbcPJlrL.js +89 -0
- package/dist/cdn/chunks/nl-CbcPJlrL.js.map +1 -0
- package/dist/cdn/chunks/nl-DOL7Fnfo.js +624 -0
- package/dist/cdn/chunks/nl-DOL7Fnfo.js.map +1 -0
- package/dist/{pt-BR-w2sGzHNX.js → cdn/chunks/pt-BR-CTzHTqJD.js} +2 -9
- package/dist/cdn/chunks/pt-BR-CTzHTqJD.js.map +1 -0
- package/dist/cdn/chunks/{pt-BR-BWFokdTU.js → pt-BR-DRCdHX1d.js} +15 -1
- package/dist/cdn/chunks/{pt-BR-BWFokdTU.js.map → pt-BR-DRCdHX1d.js.map} +1 -1
- package/dist/cdn/chunks/{src-D6F_3XkE.js → src-CzoMNRq4.js} +19 -17
- package/dist/cdn/chunks/{src-D6F_3XkE.js.map → src-CzoMNRq4.js.map} +1 -1
- package/dist/cdn/chunks/{src-BuC_IHzN.js → src-SluTVSz_.js} +2 -2
- package/dist/cdn/chunks/{src-BuC_IHzN.js.map → src-SluTVSz_.js.map} +1 -1
- package/dist/cdn/chunks/{styles-DMOEiSX9.js → styles-BbfU2w9R.js} +617 -585
- package/dist/cdn/chunks/styles-BbfU2w9R.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-BMZ-OENR.js → tiptap-DUTbZTeR.js} +5 -5
- package/dist/cdn/chunks/{tiptap-BMZ-OENR.js.map → tiptap-DUTbZTeR.js.map} +1 -1
- package/dist/cdn/chunks/{useEditorCore-BA6mspzD.js → useEditorCore-CzMhD6Gd.js} +3 -3
- package/dist/cdn/chunks/{useEditorCore-BA6mspzD.js.map → useEditorCore-CzMhD6Gd.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +164 -145
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{cloud-Du7mnkz2.js → cloud-CeZPgo1V.js} +41 -39
- package/dist/{cdn/chunks/de-D7WbpFBR.js → de-CnnxBwh7.js} +14 -2
- package/dist/{cdn/chunks/de-Bw6fB5JU.js → de-uVoSP1xF.js} +0 -11
- package/dist/{dist-CDO52Rxy.js → dist-3DHaYEiT.js} +2 -2
- package/dist/{dist-BEpCh2mG.js → dist-3HenmYIg.js} +1 -1
- package/dist/{dist-CrjzhIxB.js → dist-BCnJcAQc.js} +2 -2
- package/dist/{dist-BgPYC_8-.js → dist-B_etKYyh.js} +5 -5
- package/dist/{dist-CBzCU-a-.js → dist-CL_CfQ3Q.js} +2 -2
- package/dist/dist-CcQLJeWV.js +5 -0
- package/dist/{dist-CuXha2_7.js → dist-CclnU_v0.js} +2 -2
- package/dist/{dist-BkM8A17N.js → dist-DKWoZJAV.js} +2 -2
- package/dist/{dist-DYClLqy8.js → dist-DOtLGnLr.js} +2 -2
- package/dist/dist-DerdmERj.js +5 -0
- package/dist/{dist-BuNDAAVp.js → dist-Ih7ejWzn.js} +2 -2
- package/dist/{dist-CtcgoC_R.js → dist-bivrM-nS.js} +2 -2
- package/dist/emailFrameWidth-BmFCN2dp.js +6 -0
- package/dist/{cdn/chunks/en-BrZ0uGK2.js → en-5gW-bYy2.js} +14 -2
- package/dist/{cdn/chunks/en-DAdHJz7h.js → en-CjhsJxb-.js} +0 -11
- package/dist/{cdn/chunks/es-tLSLysPs.js → es-sQ9SdI0l.js} +14 -2
- package/dist/{extensions-ClY5Sh7S.js → extensions-3870a_3R.js} +3 -3
- package/dist/fr-DBZ5w21C.js +622 -0
- package/dist/index.d.ts +74 -0
- package/dist/nl-DOL7Fnfo.js +622 -0
- package/dist/{cdn/chunks/pt-BR-w2sGzHNX.js → pt-BR-CTzHTqJD.js} +0 -11
- package/dist/{pt-BR-BWFokdTU.js → pt-BR-DRCdHX1d.js} +14 -0
- package/dist/style.css +1 -1
- package/dist/{styles-PcOPXvLO.js → styles-BWTIgN5L.js} +672 -673
- package/dist/templatical-editor.js +128 -108
- package/dist/{useEditorCore-CT1slufs.js → useEditorCore-CuMMIfiS.js} +2 -2
- package/package.json +20 -20
- package/dist/TestEmailModal-DL2O1H8M.js +0 -95
- package/dist/cdn/chunks/CloudEditor-C0Y4RD4c.js.map +0 -1
- package/dist/cdn/chunks/SaveBlockDialog-Bb3fdUEZ.js.map +0 -1
- package/dist/cdn/chunks/SavedBlockPreviewCanvas-DZOMgNsz.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksBrowserModal-CeUWcPv0.js.map +0 -1
- package/dist/cdn/chunks/TestEmailModal-BJTDxFHh.js +0 -96
- package/dist/cdn/chunks/TestEmailModal-BJTDxFHh.js.map +0 -1
- package/dist/cdn/chunks/cloud-BJlbXGTJ.js.map +0 -1
- package/dist/cdn/chunks/de-Bw6fB5JU.js.map +0 -1
- package/dist/cdn/chunks/en-DAdHJz7h.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-w2sGzHNX.js.map +0 -1
- package/dist/cdn/chunks/styles-DMOEiSX9.js.map +0 -1
- package/dist/dist-CweLDZrs.js +0 -5
- package/dist/dist-DOsdqAEZ.js +0 -5
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { A as e, H as t, L as n, M as r, P as i, T as a, V as o, Z as s, c, ct as l, f as u, g as d, h as f, it as p, k as m, l as h, m as g, o as _, ot as v, p as y, st as b, t as x, u as S, v as C, x as w, y as T, z as E } from "./draggable-D840DIZB.js";
|
|
2
|
-
import { M as
|
|
3
|
-
import { B as
|
|
4
|
-
import { t as
|
|
5
|
-
import { Pt as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
2
|
+
import { M as ee } from "./useEditorCore-CzMhD6Gd.js";
|
|
3
|
+
import { B as D, P as O, f as k, h as A } from "./keys-D7kUmfpE.js";
|
|
4
|
+
import { t as te } from "./useI18n-8Wd7G-cq.js";
|
|
5
|
+
import { Pt as j, jt as M, mt as N, rt as P } from "./icons-CYWw8Xfp.js";
|
|
6
|
+
import { n as F } from "./emailFrameWidth-BmFCN2dp.js";
|
|
7
|
+
import { t as I } from "./TplModal-BN53d9Se.js";
|
|
8
|
+
import { t as L } from "./BlockPreviewCanvas-eASrdFSN.js";
|
|
8
9
|
//#region src/components/SavedBlockPreviewRow.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
10
|
+
var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relative tpl:min-w-0 tpl:flex-1" }, V = {
|
|
10
11
|
key: 0,
|
|
11
12
|
"data-testid": "saved-blocks-preview-fade",
|
|
12
13
|
"aria-hidden": "true",
|
|
13
14
|
class: "tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10",
|
|
14
15
|
style: { background: "linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n )" }
|
|
15
|
-
},
|
|
16
|
+
}, H = ["aria-label", "aria-expanded"], U = 240, W = /* @__PURE__ */ w({
|
|
16
17
|
__name: "SavedBlockPreviewRow",
|
|
17
18
|
props: {
|
|
18
19
|
block: {},
|
|
@@ -21,25 +22,25 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
21
22
|
},
|
|
22
23
|
emits: ["move"],
|
|
23
24
|
setup(t, { emit: i }) {
|
|
24
|
-
let o = t, _ = i, { t: v, format: x } =
|
|
25
|
-
function
|
|
26
|
-
let e =
|
|
25
|
+
let o = t, _ = i, { t: v, format: x } = te(), S = a(k, []), w = a(A, null), E = u(() => F(w?.content.value.settings)), D = s(null), O = s(null), P = s(1), I = s(null), W = s(!1), G = null, K = u(() => I.value !== null && I.value > U), q = u(() => I.value === null ? null : W.value || !K.value ? I.value : U);
|
|
26
|
+
function J() {
|
|
27
|
+
let e = D.value, t = O.value;
|
|
27
28
|
if (!e || !t) return;
|
|
28
29
|
let n = e.clientWidth;
|
|
29
30
|
if (n <= 0) return;
|
|
30
|
-
let r = Math.min(1, n /
|
|
31
|
-
|
|
31
|
+
let r = Math.min(1, n / E.value);
|
|
32
|
+
P.value = r, I.value = t.offsetHeight * r;
|
|
32
33
|
}
|
|
33
34
|
e(() => {
|
|
34
|
-
|
|
35
|
+
J(), !(typeof ResizeObserver > "u") && (G = new ResizeObserver(() => J()), D.value && G.observe(D.value), O.value && G.observe(O.value));
|
|
35
36
|
}), m(() => {
|
|
36
|
-
|
|
37
|
+
G?.disconnect(), G = null;
|
|
37
38
|
});
|
|
38
|
-
let
|
|
39
|
-
block:
|
|
39
|
+
let Y = u(() => ee(o.block, v, S)), X = u(() => x(v.savedBlocks.reorderHandle, {
|
|
40
|
+
block: Y.value,
|
|
40
41
|
position: o.position,
|
|
41
42
|
total: o.total
|
|
42
|
-
})),
|
|
43
|
+
})), Z = u(() => x(W.value ? v.savedBlocks.collapsePreview : v.savedBlocks.expandPreview, { block: Y.value }));
|
|
43
44
|
return (e, i) => (r(), d("div", {
|
|
44
45
|
"data-testid": "saved-blocks-reorder-row",
|
|
45
46
|
"data-block-id": t.block.id,
|
|
@@ -49,67 +50,67 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
49
50
|
type: "button",
|
|
50
51
|
"data-testid": "saved-blocks-reorder-handle",
|
|
51
52
|
class: "tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]",
|
|
52
|
-
"aria-label":
|
|
53
|
+
"aria-label": X.value,
|
|
53
54
|
title: p(v).savedBlocks.reorderHint,
|
|
54
55
|
onKeydown: [i[0] ||= c(h((e) => _("move", -1), ["prevent"]), ["up"]), i[1] ||= c(h((e) => _("move", 1), ["prevent"]), ["down"])]
|
|
55
|
-
}, [T(p(
|
|
56
|
+
}, [T(p(N), {
|
|
56
57
|
size: 14,
|
|
57
58
|
"stroke-width": 1.5
|
|
58
|
-
})], 40,
|
|
59
|
+
})], 40, z), y("div", B, [
|
|
59
60
|
y("div", {
|
|
60
61
|
ref_key: "frameEl",
|
|
61
|
-
ref:
|
|
62
|
+
ref: D,
|
|
62
63
|
class: "tpl:overflow-hidden",
|
|
63
|
-
style: b({ height:
|
|
64
|
+
style: b({ height: q.value === null ? void 0 : `${q.value}px` })
|
|
64
65
|
}, [y("div", {
|
|
65
66
|
ref_key: "contentEl",
|
|
66
|
-
ref:
|
|
67
|
+
ref: O,
|
|
67
68
|
style: b({
|
|
68
|
-
width: `${
|
|
69
|
-
transform: `scale(${
|
|
69
|
+
width: `${E.value}px`,
|
|
70
|
+
transform: `scale(${P.value})`,
|
|
70
71
|
transformOrigin: "top left"
|
|
71
72
|
})
|
|
72
|
-
}, [T(
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
}, [T(L, { blocks: [t.block] }, null, 8, ["blocks"])], 4)], 4),
|
|
74
|
+
K.value && !W.value ? (r(), d("div", V)) : f("", !0),
|
|
75
|
+
K.value ? (r(), d("button", {
|
|
75
76
|
key: 1,
|
|
76
77
|
type: "button",
|
|
77
78
|
"data-testid": "saved-blocks-preview-toggle",
|
|
78
79
|
class: "tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]",
|
|
79
|
-
"aria-label":
|
|
80
|
-
"aria-expanded":
|
|
81
|
-
onClick: i[2] ||= (e) =>
|
|
82
|
-
}, [(r(), g(n(p(
|
|
80
|
+
"aria-label": Z.value,
|
|
81
|
+
"aria-expanded": W.value,
|
|
82
|
+
onClick: i[2] ||= (e) => W.value = !W.value
|
|
83
|
+
}, [(r(), g(n(p(W.value ? M : j)), {
|
|
83
84
|
size: 11,
|
|
84
85
|
"stroke-width": 2
|
|
85
|
-
})), C(" " + l(
|
|
86
|
-
])], 8,
|
|
86
|
+
})), C(" " + l(W.value ? p(v).savedBlocks.collapse : p(v).savedBlocks.expand), 1)], 8, H)) : f("", !0)
|
|
87
|
+
])], 8, R));
|
|
87
88
|
}
|
|
88
|
-
}),
|
|
89
|
+
}), G = ["aria-busy"], K = {
|
|
89
90
|
id: "tpl-save-block-title",
|
|
90
91
|
class: "tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
|
|
91
|
-
},
|
|
92
|
+
}, q = { class: "tpl:mb-3 tpl:shrink-0" }, J = { class: "tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]" }, Y = ["placeholder", "disabled"], X = { class: "tpl:mb-3 tpl:shrink-0" }, Z = {
|
|
92
93
|
for: "tpl-save-block-category",
|
|
93
94
|
class: "tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]"
|
|
94
|
-
},
|
|
95
|
+
}, ne = ["placeholder", "disabled"], re = { id: "tpl-saved-block-categories" }, ie = ["value"], ae = {
|
|
95
96
|
"data-testid": "saved-blocks-save-summary",
|
|
96
97
|
class: "tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]"
|
|
97
|
-
},
|
|
98
|
+
}, oe = { class: "tpl:text-[var(--tpl-text-dim)]" }, se = {
|
|
98
99
|
key: 0,
|
|
99
100
|
class: "tpl:mb-1.5 tpl:shrink-0 tpl:text-[11px] tpl:text-[var(--tpl-text-dim)]"
|
|
100
|
-
},
|
|
101
|
+
}, ce = {
|
|
101
102
|
class: "tpl-sr-only",
|
|
102
103
|
role: "status",
|
|
103
104
|
"aria-live": "polite",
|
|
104
105
|
"aria-atomic": "true"
|
|
105
|
-
},
|
|
106
|
+
}, le = {
|
|
106
107
|
key: 1,
|
|
107
108
|
role: "alert",
|
|
108
109
|
class: "tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]"
|
|
109
|
-
},
|
|
110
|
+
}, ue = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2" }, de = ["disabled"], fe = ["disabled"], pe = {
|
|
110
111
|
key: 0,
|
|
111
112
|
class: "tpl:flex tpl:items-center tpl:gap-1.5"
|
|
112
|
-
},
|
|
113
|
+
}, me = { key: 1 }, Q = /* @__PURE__ */ w({
|
|
113
114
|
__name: "SaveBlockDialog",
|
|
114
115
|
props: {
|
|
115
116
|
visible: { type: Boolean },
|
|
@@ -117,55 +118,55 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
117
118
|
},
|
|
118
119
|
emits: ["close", "saved"],
|
|
119
120
|
setup(e, { emit: n }) {
|
|
120
|
-
let c = e, m = n, { t: h, format: b } =
|
|
121
|
+
let c = e, m = n, { t: h, format: b } = te(), w = D(A, "SaveBlockDialog"), j = D(O, "SaveBlockDialog"), M = a(k, []), N = s(""), F = s(""), L = s(!1), R = s(null), z = s(""), B = s([]), V = u(() => {
|
|
121
122
|
let e = new Map(w.content.value.blocks.map((e) => [e.id, e]));
|
|
122
|
-
return
|
|
123
|
-
}),
|
|
124
|
-
get: () =>
|
|
123
|
+
return B.value.map((t) => e.get(t)).filter((e) => e !== void 0);
|
|
124
|
+
}), H = u({
|
|
125
|
+
get: () => V.value,
|
|
125
126
|
set: (e) => {
|
|
126
|
-
|
|
127
|
+
B.value = e.map((e) => e.id);
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
|
-
function
|
|
130
|
-
let n =
|
|
130
|
+
function U(e, t) {
|
|
131
|
+
let n = V.value.map((e) => e.id), r = n.indexOf(e), i = r + t;
|
|
131
132
|
if (r === -1 || i < 0 || i >= n.length) return;
|
|
132
|
-
[n[r], n[i]] = [n[i], n[r]],
|
|
133
|
-
let a =
|
|
134
|
-
|
|
135
|
-
block:
|
|
133
|
+
[n[r], n[i]] = [n[i], n[r]], B.value = n;
|
|
134
|
+
let a = V.value[i];
|
|
135
|
+
z.value = a ? b(h.savedBlocks.reorderAnnouncement, {
|
|
136
|
+
block: Q(a),
|
|
136
137
|
position: i + 1,
|
|
137
138
|
total: n.length
|
|
138
139
|
}) : "";
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
141
|
+
function Q(e) {
|
|
142
|
+
return ee(e, h, M);
|
|
142
143
|
}
|
|
143
|
-
let
|
|
144
|
+
let he = u(() => V.value.map(Q).join(", "));
|
|
144
145
|
E(() => c.visible, (e) => {
|
|
145
|
-
e && (
|
|
146
|
+
e && (N.value = "", F.value = "", R.value = null, z.value = "", B.value = [...c.pickedIds]);
|
|
146
147
|
}, { immediate: !0 });
|
|
147
|
-
let
|
|
148
|
+
let ge = u(() => N.value.trim().length > 0 && V.value.length > 0 && !L.value);
|
|
148
149
|
async function _e() {
|
|
149
|
-
if (!
|
|
150
|
-
let e =
|
|
150
|
+
if (!ge.value) return;
|
|
151
|
+
let e = V.value;
|
|
151
152
|
if (e.length !== 0) {
|
|
152
|
-
|
|
153
|
+
L.value = !0, R.value = null;
|
|
153
154
|
try {
|
|
154
|
-
await
|
|
155
|
+
await j.create(N.value.trim(), e, F.value.trim() || void 0), m("saved"), m("close");
|
|
155
156
|
} catch (e) {
|
|
156
|
-
|
|
157
|
+
R.value = e.message;
|
|
157
158
|
} finally {
|
|
158
|
-
|
|
159
|
+
L.value = !1;
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
function $() {
|
|
163
|
-
|
|
164
|
+
L.value || m("close");
|
|
164
165
|
}
|
|
165
166
|
function ve(e) {
|
|
166
167
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), _e()), e.key === "Escape" && $();
|
|
167
168
|
}
|
|
168
|
-
return (n, a) => (r(), g(
|
|
169
|
+
return (n, a) => (r(), g(I, {
|
|
169
170
|
visible: e.visible,
|
|
170
171
|
onClose: $,
|
|
171
172
|
onKeydown: ve
|
|
@@ -173,7 +174,7 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
173
174
|
default: o(() => [y("div", {
|
|
174
175
|
role: "dialog",
|
|
175
176
|
"aria-modal": "true",
|
|
176
|
-
"aria-busy":
|
|
177
|
+
"aria-busy": L.value,
|
|
177
178
|
"aria-labelledby": "tpl-save-block-title",
|
|
178
179
|
class: "tpl-scale-in tpl:mx-4 tpl:flex tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
|
|
179
180
|
style: {
|
|
@@ -182,37 +183,37 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
182
183
|
"max-height": "90vh"
|
|
183
184
|
}
|
|
184
185
|
}, [
|
|
185
|
-
y("h3",
|
|
186
|
-
y("div",
|
|
187
|
-
"onUpdate:modelValue": a[0] ||= (e) =>
|
|
186
|
+
y("h3", K, l(p(h).savedBlocks.saveAsBlock), 1),
|
|
187
|
+
y("div", q, [y("label", J, l(p(h).savedBlocks.name), 1), t(y("input", {
|
|
188
|
+
"onUpdate:modelValue": a[0] ||= (e) => N.value = e,
|
|
188
189
|
type: "text",
|
|
189
190
|
"data-testid": "saved-blocks-name-input",
|
|
190
191
|
placeholder: p(h).savedBlocks.namePlaceholder,
|
|
191
192
|
class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
|
|
192
|
-
disabled:
|
|
193
|
-
}, null, 8,
|
|
194
|
-
y("div",
|
|
195
|
-
y("label",
|
|
193
|
+
disabled: L.value
|
|
194
|
+
}, null, 8, Y), [[_, N.value]])]),
|
|
195
|
+
y("div", X, [
|
|
196
|
+
y("label", Z, l(p(h).savedBlocks.category), 1),
|
|
196
197
|
t(y("input", {
|
|
197
198
|
id: "tpl-save-block-category",
|
|
198
|
-
"onUpdate:modelValue": a[1] ||= (e) =>
|
|
199
|
+
"onUpdate:modelValue": a[1] ||= (e) => F.value = e,
|
|
199
200
|
type: "text",
|
|
200
201
|
"data-testid": "saved-blocks-category-input",
|
|
201
202
|
list: "tpl-saved-block-categories",
|
|
202
203
|
placeholder: p(h).savedBlocks.categoryPlaceholder,
|
|
203
204
|
class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
|
|
204
|
-
disabled:
|
|
205
|
-
}, null, 8,
|
|
206
|
-
y("datalist",
|
|
205
|
+
disabled: L.value
|
|
206
|
+
}, null, 8, ne), [[_, F.value]]),
|
|
207
|
+
y("datalist", re, [(r(!0), d(S, null, i(p(j).categories.value, (e) => (r(), d("option", {
|
|
207
208
|
key: e,
|
|
208
209
|
value: e
|
|
209
|
-
}, null, 8,
|
|
210
|
+
}, null, 8, ie))), 128))])
|
|
210
211
|
]),
|
|
211
|
-
y("p",
|
|
212
|
-
|
|
212
|
+
y("p", ae, [C(l(p(b)(p(h).savedBlocks.savingCount, { count: V.value.length })) + " ", 1), y("span", oe, l(he.value), 1)]),
|
|
213
|
+
V.value.length > 1 ? (r(), d("p", se, l(p(h).savedBlocks.reorderHint), 1)) : f("", !0),
|
|
213
214
|
T(p(x), {
|
|
214
|
-
modelValue:
|
|
215
|
-
"onUpdate:modelValue": a[2] ||= (e) =>
|
|
215
|
+
modelValue: H.value,
|
|
216
|
+
"onUpdate:modelValue": a[2] ||= (e) => H.value = e,
|
|
216
217
|
"data-testid": "saved-blocks-reorder-list",
|
|
217
218
|
animation: 150,
|
|
218
219
|
"ghost-class": "tpl-ghost",
|
|
@@ -221,12 +222,12 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
221
222
|
"force-fallback": !0,
|
|
222
223
|
class: "tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto"
|
|
223
224
|
}, {
|
|
224
|
-
default: o(() => [(r(!0), d(S, null, i(
|
|
225
|
+
default: o(() => [(r(!0), d(S, null, i(H.value, (e, t) => (r(), g(W, {
|
|
225
226
|
key: e.id,
|
|
226
227
|
block: e,
|
|
227
228
|
position: t + 1,
|
|
228
|
-
total:
|
|
229
|
-
onMove: (t) =>
|
|
229
|
+
total: H.value.length,
|
|
230
|
+
onMove: (t) => U(e.id, t)
|
|
230
231
|
}, null, 8, [
|
|
231
232
|
"block",
|
|
232
233
|
"position",
|
|
@@ -235,29 +236,29 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
|
|
|
235
236
|
]))), 128))]),
|
|
236
237
|
_: 1
|
|
237
238
|
}, 8, ["modelValue"]),
|
|
238
|
-
y("div",
|
|
239
|
-
|
|
240
|
-
y("div",
|
|
239
|
+
y("div", ce, l(z.value), 1),
|
|
240
|
+
R.value ? (r(), d("p", le, l(R.value), 1)) : f("", !0),
|
|
241
|
+
y("div", ue, [y("button", {
|
|
241
242
|
type: "button",
|
|
242
|
-
class: v(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]", { "tpl:cursor-not-allowed tpl:opacity-50":
|
|
243
|
-
disabled:
|
|
243
|
+
class: v(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]", { "tpl:cursor-not-allowed tpl:opacity-50": L.value }]),
|
|
244
|
+
disabled: L.value,
|
|
244
245
|
onClick: $
|
|
245
|
-
}, l(p(h).savedBlocks.cancel), 11,
|
|
246
|
+
}, l(p(h).savedBlocks.cancel), 11, de), y("button", {
|
|
246
247
|
type: "button",
|
|
247
248
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
|
|
248
|
-
disabled: !
|
|
249
|
+
disabled: !ge.value,
|
|
249
250
|
onClick: _e
|
|
250
|
-
}, [
|
|
251
|
+
}, [L.value ? (r(), d("span", pe, [T(p(P), {
|
|
251
252
|
class: "tpl:animate-spin",
|
|
252
253
|
size: 12,
|
|
253
254
|
"stroke-width": 2
|
|
254
|
-
}), C(" " + l(p(h).savedBlocks.saving), 1)])) : (r(), d("span",
|
|
255
|
-
], 8,
|
|
255
|
+
}), C(" " + l(p(h).savedBlocks.saving), 1)])) : (r(), d("span", me, l(p(h).savedBlocks.save), 1))], 8, fe)])
|
|
256
|
+
], 8, G)]),
|
|
256
257
|
_: 1
|
|
257
258
|
}, 8, ["visible"]));
|
|
258
259
|
}
|
|
259
260
|
});
|
|
260
261
|
//#endregion
|
|
261
|
-
export {
|
|
262
|
+
export { Q as default };
|
|
262
263
|
|
|
263
|
-
//# sourceMappingURL=SaveBlockDialog-
|
|
264
|
+
//# sourceMappingURL=SaveBlockDialog-Bi_Z3kuA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveBlockDialog-Bi_Z3kuA.js","names":[],"sources":["../../../src/components/SavedBlockPreviewRow.vue","../../../src/components/SavedBlockPreviewRow.vue","../../../src/components/SaveBlockDialog.vue","../../../src/components/SaveBlockDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * One reorderable row in the save dialog's preview list: a grip handle beside a\n * scaled-down render of the real block.\n *\n * The preview is the same `BlockPreviewCanvas` the browser modal uses, so\n * a row shows what the block actually looks like rather than a description of\n * it. That canvas is fixed at the 600px email width every block component\n * renders against, so the row shrinks it with `transform: scale()` instead of\n * re-flowing it at dialog width — a re-flow would show a layout the recipient\n * will never see.\n *\n * `transform` doesn't participate in layout, so the frame would keep reserving\n * the full unscaled height; a `ResizeObserver` mirrors the scaled height back\n * onto it. The handle is a sibling of the scaled subtree, so it stays full size\n * and keeps its real hit area.\n *\n * Row chrome uses the raw theme tokens, not the `--tpl-chrome-*` aliases: the\n * chrome is an ancestor and a sibling of the rendered email content, never a\n * descendant, so the `.tpl-block-content` token override can't reach it.\n */\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\nimport { useI18n } from \"../composables\";\nimport { CUSTOM_BLOCK_DEFINITIONS_KEY, EDITOR_KEY } from \"../keys\";\nimport { getEmailFrameWidth } from \"../utils/emailFrameWidth\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { ChevronDown, ChevronUp, GripVertical } from \"@lucide/vue\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nconst props = defineProps<{\n block: Block;\n /** 1-based position in the list — spoken by the handle's label. */\n position: number;\n total: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"move\", delta: -1 | 1): void;\n}>();\n\nconst { t, format } = useI18n();\n// Optional: absent when the consumer registers no custom blocks.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst editor = inject(EDITOR_KEY, null);\n\n/**\n * The width the nested `BlockPreviewCanvas` actually renders at.\n *\n * MUST come from the same helper the canvas uses, because the scale factor below\n * divides by it: a mismatch scales every row by the wrong amount, so a template\n * with a custom body width would overflow its frame or under-fill it. Rows are\n * always the desktop width — the save dialog has no viewport control.\n */\nconst previewWidth = computed(() =>\n getEmailFrameWidth(editor?.content.value.settings),\n);\n/**\n * Collapsed height for a tall block. A hero card or a multi-row section would\n * otherwise be taller than the whole list, leaving one row on screen — and\n * seeing the rows together is what makes them orderable. Anything taller\n * collapses to this, fades out at the cut, and can be expanded in place.\n */\nconst COLLAPSED_HEIGHT = 240;\n\nconst frameEl = ref<HTMLElement | null>(null);\nconst contentEl = ref<HTMLElement | null>(null);\nconst scale = ref(1);\n/** Scaled height of the whole block; `null` until first measured. */\nconst fullHeight = ref<number | null>(null);\nconst expanded = ref(false);\n\nlet observer: ResizeObserver | null = null;\n\n/** Only a block taller than the collapsed cap needs fading or expanding. */\nconst isClipped = computed(\n () => fullHeight.value !== null && fullHeight.value > COLLAPSED_HEIGHT,\n);\n\nconst frameHeight = computed(() => {\n if (fullHeight.value === null) return null;\n if (expanded.value || !isClipped.value) return fullHeight.value;\n return COLLAPSED_HEIGHT;\n});\n\nfunction measure(): void {\n const frame = frameEl.value;\n const content = contentEl.value;\n if (!frame || !content) return;\n const width = frame.clientWidth;\n if (width <= 0) return;\n // Never scale up: a dialog wider than the email would blow the preview past\n // its real proportions.\n const next = Math.min(1, width / previewWidth.value);\n scale.value = next;\n fullHeight.value = content.offsetHeight * next;\n}\n\nonMounted(() => {\n measure();\n // Absent in non-DOM test environments. Without it the frame simply falls back\n // to the untransformed height and clips — degraded, never broken.\n if (typeof ResizeObserver === \"undefined\") return;\n observer = new ResizeObserver(() => measure());\n if (frameEl.value) observer.observe(frameEl.value);\n if (contentEl.value) observer.observe(contentEl.value);\n});\n\nonBeforeUnmount(() => {\n observer?.disconnect();\n observer = null;\n});\n\nconst blockLabel = computed(() =>\n getBlockLabel(props.block, t, customBlockDefinitions),\n);\n\nconst handleLabel = computed(() =>\n format(t.savedBlocks.reorderHandle, {\n block: blockLabel.value,\n position: props.position,\n total: props.total,\n }),\n);\n\nconst toggleLabel = computed(() =>\n format(\n expanded.value\n ? t.savedBlocks.collapsePreview\n : t.savedBlocks.expandPreview,\n { block: blockLabel.value },\n ),\n);\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-reorder-row\"\n :data-block-id=\"block.id\"\n class=\"tpl:flex tpl:items-start tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-md)] tpl:border tpl:p-1.5 tpl:border-[var(--tpl-border)]\"\n style=\"background-color: var(--tpl-bg)\"\n >\n <!-- Sortable's `handle` selector points here, so a pointer-drag can only\n start from the grip — never from the preview itself. -->\n <button\n type=\"button\"\n data-testid=\"saved-blocks-reorder-handle\"\n class=\"tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"handleLabel\"\n :title=\"t.savedBlocks.reorderHint\"\n @keydown.up.prevent=\"emit('move', -1)\"\n @keydown.down.prevent=\"emit('move', 1)\"\n >\n <GripVertical :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n\n <div class=\"tpl:relative tpl:min-w-0 tpl:flex-1\">\n <div\n ref=\"frameEl\"\n class=\"tpl:overflow-hidden\"\n :style=\"{\n height: frameHeight !== null ? `${frameHeight}px` : undefined,\n }\"\n >\n <div\n ref=\"contentEl\"\n :style=\"{\n width: `${previewWidth}px`,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }\"\n >\n <BlockPreviewCanvas :blocks=\"[block]\" />\n </div>\n </div>\n\n <!-- Fade over the cut, so a clipped block reads as truncated rather than\n as a block that simply ends there. Pointer-transparent: it sits over\n the preview, and swallowing clicks would break the row. -->\n <div\n v-if=\"isClipped && !expanded\"\n data-testid=\"saved-blocks-preview-fade\"\n aria-hidden=\"true\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10\"\n style=\"\n background: linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n );\n \"\n />\n\n <button\n v-if=\"isClipped\"\n type=\"button\"\n data-testid=\"saved-blocks-preview-toggle\"\n class=\"tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"toggleLabel\"\n :aria-expanded=\"expanded\"\n @click=\"expanded = !expanded\"\n >\n <component\n :is=\"expanded ? ChevronUp : ChevronDown\"\n :size=\"11\"\n :stroke-width=\"2\"\n />\n {{ expanded ? t.savedBlocks.collapse : t.savedBlocks.expand }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * One reorderable row in the save dialog's preview list: a grip handle beside a\n * scaled-down render of the real block.\n *\n * The preview is the same `BlockPreviewCanvas` the browser modal uses, so\n * a row shows what the block actually looks like rather than a description of\n * it. That canvas is fixed at the 600px email width every block component\n * renders against, so the row shrinks it with `transform: scale()` instead of\n * re-flowing it at dialog width — a re-flow would show a layout the recipient\n * will never see.\n *\n * `transform` doesn't participate in layout, so the frame would keep reserving\n * the full unscaled height; a `ResizeObserver` mirrors the scaled height back\n * onto it. The handle is a sibling of the scaled subtree, so it stays full size\n * and keeps its real hit area.\n *\n * Row chrome uses the raw theme tokens, not the `--tpl-chrome-*` aliases: the\n * chrome is an ancestor and a sibling of the rendered email content, never a\n * descendant, so the `.tpl-block-content` token override can't reach it.\n */\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\nimport { useI18n } from \"../composables\";\nimport { CUSTOM_BLOCK_DEFINITIONS_KEY, EDITOR_KEY } from \"../keys\";\nimport { getEmailFrameWidth } from \"../utils/emailFrameWidth\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { ChevronDown, ChevronUp, GripVertical } from \"@lucide/vue\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nconst props = defineProps<{\n block: Block;\n /** 1-based position in the list — spoken by the handle's label. */\n position: number;\n total: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"move\", delta: -1 | 1): void;\n}>();\n\nconst { t, format } = useI18n();\n// Optional: absent when the consumer registers no custom blocks.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst editor = inject(EDITOR_KEY, null);\n\n/**\n * The width the nested `BlockPreviewCanvas` actually renders at.\n *\n * MUST come from the same helper the canvas uses, because the scale factor below\n * divides by it: a mismatch scales every row by the wrong amount, so a template\n * with a custom body width would overflow its frame or under-fill it. Rows are\n * always the desktop width — the save dialog has no viewport control.\n */\nconst previewWidth = computed(() =>\n getEmailFrameWidth(editor?.content.value.settings),\n);\n/**\n * Collapsed height for a tall block. A hero card or a multi-row section would\n * otherwise be taller than the whole list, leaving one row on screen — and\n * seeing the rows together is what makes them orderable. Anything taller\n * collapses to this, fades out at the cut, and can be expanded in place.\n */\nconst COLLAPSED_HEIGHT = 240;\n\nconst frameEl = ref<HTMLElement | null>(null);\nconst contentEl = ref<HTMLElement | null>(null);\nconst scale = ref(1);\n/** Scaled height of the whole block; `null` until first measured. */\nconst fullHeight = ref<number | null>(null);\nconst expanded = ref(false);\n\nlet observer: ResizeObserver | null = null;\n\n/** Only a block taller than the collapsed cap needs fading or expanding. */\nconst isClipped = computed(\n () => fullHeight.value !== null && fullHeight.value > COLLAPSED_HEIGHT,\n);\n\nconst frameHeight = computed(() => {\n if (fullHeight.value === null) return null;\n if (expanded.value || !isClipped.value) return fullHeight.value;\n return COLLAPSED_HEIGHT;\n});\n\nfunction measure(): void {\n const frame = frameEl.value;\n const content = contentEl.value;\n if (!frame || !content) return;\n const width = frame.clientWidth;\n if (width <= 0) return;\n // Never scale up: a dialog wider than the email would blow the preview past\n // its real proportions.\n const next = Math.min(1, width / previewWidth.value);\n scale.value = next;\n fullHeight.value = content.offsetHeight * next;\n}\n\nonMounted(() => {\n measure();\n // Absent in non-DOM test environments. Without it the frame simply falls back\n // to the untransformed height and clips — degraded, never broken.\n if (typeof ResizeObserver === \"undefined\") return;\n observer = new ResizeObserver(() => measure());\n if (frameEl.value) observer.observe(frameEl.value);\n if (contentEl.value) observer.observe(contentEl.value);\n});\n\nonBeforeUnmount(() => {\n observer?.disconnect();\n observer = null;\n});\n\nconst blockLabel = computed(() =>\n getBlockLabel(props.block, t, customBlockDefinitions),\n);\n\nconst handleLabel = computed(() =>\n format(t.savedBlocks.reorderHandle, {\n block: blockLabel.value,\n position: props.position,\n total: props.total,\n }),\n);\n\nconst toggleLabel = computed(() =>\n format(\n expanded.value\n ? t.savedBlocks.collapsePreview\n : t.savedBlocks.expandPreview,\n { block: blockLabel.value },\n ),\n);\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-reorder-row\"\n :data-block-id=\"block.id\"\n class=\"tpl:flex tpl:items-start tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-md)] tpl:border tpl:p-1.5 tpl:border-[var(--tpl-border)]\"\n style=\"background-color: var(--tpl-bg)\"\n >\n <!-- Sortable's `handle` selector points here, so a pointer-drag can only\n start from the grip — never from the preview itself. -->\n <button\n type=\"button\"\n data-testid=\"saved-blocks-reorder-handle\"\n class=\"tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"handleLabel\"\n :title=\"t.savedBlocks.reorderHint\"\n @keydown.up.prevent=\"emit('move', -1)\"\n @keydown.down.prevent=\"emit('move', 1)\"\n >\n <GripVertical :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n\n <div class=\"tpl:relative tpl:min-w-0 tpl:flex-1\">\n <div\n ref=\"frameEl\"\n class=\"tpl:overflow-hidden\"\n :style=\"{\n height: frameHeight !== null ? `${frameHeight}px` : undefined,\n }\"\n >\n <div\n ref=\"contentEl\"\n :style=\"{\n width: `${previewWidth}px`,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }\"\n >\n <BlockPreviewCanvas :blocks=\"[block]\" />\n </div>\n </div>\n\n <!-- Fade over the cut, so a clipped block reads as truncated rather than\n as a block that simply ends there. Pointer-transparent: it sits over\n the preview, and swallowing clicks would break the row. -->\n <div\n v-if=\"isClipped && !expanded\"\n data-testid=\"saved-blocks-preview-fade\"\n aria-hidden=\"true\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10\"\n style=\"\n background: linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n );\n \"\n />\n\n <button\n v-if=\"isClipped\"\n type=\"button\"\n data-testid=\"saved-blocks-preview-toggle\"\n class=\"tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"toggleLabel\"\n :aria-expanded=\"expanded\"\n @click=\"expanded = !expanded\"\n >\n <component\n :is=\"expanded ? ChevronUp : ChevronDown\"\n :size=\"11\"\n :stroke-width=\"2\"\n />\n {{ expanded ? t.savedBlocks.collapse : t.savedBlocks.expand }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:mx-4 tpl:flex tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n max-height: 90vh;\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n <datalist id=\"tpl-saved-block-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n </div>\n\n <!-- Summary of what the pick session chose. Which blocks were picked is\n settled on the canvas — the dialog re-presents them only so the user\n can see and order what they're about to save. -->\n <p\n data-testid=\"saved-blocks-save-summary\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ format(t.savedBlocks.savingCount, { count: pickedBlocks.length }) }}\n <span class=\"tpl:text-[var(--tpl-text-dim)]\">{{ summary }}</span>\n </p>\n\n <!-- Reorderable preview. Seeded in pick order and saved in whatever order\n the list ends up in. Its own Sortable instance with no `group`, so it\n can never exchange items with the canvas or a section column. -->\n <p\n v-if=\"pickedBlocks.length > 1\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-[11px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's 90vh cap leaves\n after the fixed chrome, rather than a hand-tuned vh guess that a row\n expanding to full height would blow past. `min-h-0` is what lets a\n flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:mx-4 tpl:flex tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n max-height: 90vh;\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n <datalist id=\"tpl-saved-block-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n </div>\n\n <!-- Summary of what the pick session chose. Which blocks were picked is\n settled on the canvas — the dialog re-presents them only so the user\n can see and order what they're about to save. -->\n <p\n data-testid=\"saved-blocks-save-summary\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ format(t.savedBlocks.savingCount, { count: pickedBlocks.length }) }}\n <span class=\"tpl:text-[var(--tpl-text-dim)]\">{{ summary }}</span>\n </p>\n\n <!-- Reorderable preview. Seeded in pick order and saved in whatever order\n the list ends up in. Its own Sortable instance with no `group`, so it\n can never exchange items with the canvas or a section column. -->\n <p\n v-if=\"pickedBlocks.length > 1\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-[11px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's 90vh cap leaves\n after the fixed chrome, rather than a hand-tuned vh guess that a row\n expanding to full height would blow past. `min-h-0` is what lets a\n flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;wCAgEM,IAAmB;;;;;;;;;EAlCzB,IAAM,IAAQ,GAOR,IAAO,GAIP,EAAE,MAAG,cAAW,GAAQ,GAExB,IAAyB,EAAO,GAA8B,CAAC,CAAC,GAEhE,IAAS,EAAO,GAAY,IAAI,GAUhC,IAAe,QACnB,EAAmB,GAAQ,QAAQ,MAAM,QAAQ,CACnD,GASM,IAAU,EAAwB,IAAI,GACtC,IAAY,EAAwB,IAAI,GACxC,IAAQ,EAAI,CAAC,GAEb,IAAa,EAAmB,IAAI,GACpC,IAAW,EAAI,EAAK,GAEtB,IAAkC,MAGhC,IAAY,QACV,EAAW,UAAU,QAAQ,EAAW,QAAQ,CACxD,GAEM,IAAc,QACd,EAAW,UAAU,OAAa,OAClC,EAAS,SAAS,CAAC,EAAU,QAAc,EAAW,QACnD,CACR;EAED,SAAS,IAAgB;GACvB,IAAM,IAAQ,EAAQ,OAChB,IAAU,EAAU;GAC1B,IAAI,CAAC,KAAS,CAAC,GAAS;GACxB,IAAM,IAAQ,EAAM;GACpB,IAAI,KAAS,GAAG;GAGhB,IAAM,IAAO,KAAK,IAAI,GAAG,IAAQ,EAAa,KAAK;GAEnD,AADA,EAAM,QAAQ,GACd,EAAW,QAAQ,EAAQ,eAAe;EAC5C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AAA,CAAA,CAAA;KAD9D,UAAU,EAAA;KAIV,SAAO;SAEL,EAAA,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,IAAA,EAAA,GAEzB,EAiBS,UAAA;KAhBP,MAAK;KACL,OAAM;KACL,UAAQ,CAAG,GAAA;KACX,SAAO;QAEI,EAAA,SAAA,EAAA,GAAZ,EAOO,QAPP,IAOO,CANL,EAIE,EAAA,CAAA,GAAA;KAHA,OAAM;KACL,MAAM;KACN,gBAAc;UACf,MACF,EAAG,EAAA,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,CAAA,CAAA,CAAA,MAAA,EAAA,GAEzB,EAEO,QAAA,IAAA,EADF,EAAA,CAAA,CAAC,CAAC,YAAY,IAAI,GAAA,CAAA,EAAA,GAAA,GAAA,EAAA,CAAA,CAAA"}
|
package/dist/cdn/chunks/{SavedBlocksBrowserModal-CeUWcPv0.js → SavedBlocksBrowserModal-CesYxFsH.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { H as e, L as t, M as n, O as r, P as i, V as ee, Z as a, a as o, b as te, c as s, ct as c, f as l, g as u, h as d, it as f, l as p, m, o as h, ot as ne, p as g, st as re, u as _, x as v, y, z as ie } from "./draggable-D840DIZB.js";
|
|
2
|
-
import "./useEditorCore-
|
|
2
|
+
import "./useEditorCore-CzMhD6Gd.js";
|
|
3
3
|
import { B as b, P as ae, h as oe } from "./keys-D7kUmfpE.js";
|
|
4
4
|
import { t as se } from "./useI18n-8Wd7G-cq.js";
|
|
5
5
|
import { G as ce, J as x, M as le, d as ue, n as de } from "./icons-CYWw8Xfp.js";
|
|
6
6
|
import { t as S } from "./blockTypeIcons-etMMQoVv.js";
|
|
7
|
-
import { t as fe } from "./TplModal-
|
|
7
|
+
import { t as fe } from "./TplModal-BN53d9Se.js";
|
|
8
8
|
import { t as pe } from "./formatRelativeTime-CtUU-QZ8.js";
|
|
9
9
|
//#region src/components/SavedBlocksBrowserModal.vue?vue&type=script&setup=true&lang.ts
|
|
10
10
|
var me = {
|
|
@@ -62,7 +62,7 @@ var me = {
|
|
|
62
62
|
props: { visible: { type: Boolean } },
|
|
63
63
|
emits: ["close", "insert"],
|
|
64
64
|
setup(v, { emit: A }) {
|
|
65
|
-
let et = v, j = A, tt = te(() => import("./
|
|
65
|
+
let et = v, j = A, tt = te(() => import("./BlockPreviewCanvas-eASrdFSN.js").then((e) => e.n)), { t: M, format: N } = se(), P = b(ae, "SavedBlocksBrowserModal"), F = b(oe, "SavedBlocksBrowserModal"), I = a(""), L = a(""), R = a(null), z = a(null), B = a(null), V = a(""), H = a(""), U = a(null), W = a("end"), G = l(() => {
|
|
66
66
|
let e = I.value.trim().toLowerCase(), t = L.value;
|
|
67
67
|
return P.savedBlocks.value.filter((n) => !(e && !n.name.toLowerCase().includes(e) || t && n.category !== t));
|
|
68
68
|
}), K = l(() => P.isLoading.value && P.savedBlocks.value.length === 0), nt = l(() => I.value.trim().length > 0 || L.value !== ""), q = l(() => R.value ? P.savedBlocks.value.find((e) => e.id === R.value) ?? null : null), rt = l(() => {
|
|
@@ -319,4 +319,4 @@ var me = {
|
|
|
319
319
|
//#endregion
|
|
320
320
|
export { A as default };
|
|
321
321
|
|
|
322
|
-
//# sourceMappingURL=SavedBlocksBrowserModal-
|
|
322
|
+
//# sourceMappingURL=SavedBlocksBrowserModal-CesYxFsH.js.map
|