@templatical/editor 0.54.0 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiAltTextPopover-NMJqQKvD.js → AiAltTextPopover-BBKVJ6HA.js} +1 -1
- package/dist/{AiAltTextReview-Ci4zHwRc.js → AiAltTextReview-BuVbeQh-.js} +1 -1
- package/dist/{AiRewriteMenu-CIHUnPud.js → AiRewriteMenu-ZpYJfm-O.js} +4 -4
- package/dist/{BlockPreviewCanvas-B70RSavL.js → BlockPreviewCanvas-DtOo5y3U.js} +6 -6
- package/dist/{CloudPanels-VpSQiLLL.js → CloudPanels-DQRWMc59.js} +1 -1
- package/dist/{CountdownToolbar-CM4XNEuO.js → CountdownToolbar-DTpMEDyh.js} +4 -4
- package/dist/{IssuesPanel-1wGV0wiy.js → IssuesPanel-BZn7-p9e.js} +1 -1
- package/dist/{LanguageMenu-d2GlX67r.js → LanguageMenu-OOmQWVzO.js} +5 -5
- package/dist/{LogicTagInsertButton-DgTJ6Lvx.js → LogicTagInsertButton-XESwnJia.js} +8 -8
- package/dist/{MergeTagInput-B_51YcQO.js → MergeTagInput-CAsBRoSm.js} +1 -1
- package/dist/{MergeTagModeToggle-D3Q2z317.js → MergeTagModeToggle-bOf27Hg1.js} +1 -1
- package/dist/{MergeTagTextarea-DZz1L9DE.js → MergeTagTextarea-DH_6JFui.js} +2 -2
- package/dist/{ParagraphEditor-CI68PYDL.js → ParagraphEditor-XGUkV5Uw.js} +12 -11
- package/dist/{RestoreVersionDialog-DcuhpOIz.js → RestoreVersionDialog-C72kWccI.js} +1 -1
- package/dist/{RichTextEditorContent-Dstovi0m.js → RichTextEditorContent-BZN8KRvR.js} +2 -2
- package/dist/{SaveBlockDialog-vuwvoi-d.js → SaveBlockDialog-CKOnTMTU.js} +4 -4
- package/dist/{SavedBlocksBrowserModal-DUJm0dOv.js → SavedBlocksBrowserModal-BrlNxqDH.js} +4 -4
- package/dist/{SavedBlocksPanels-BiMXQ5lY.js → SavedBlocksPanels--lPR6gdh.js} +1 -1
- package/dist/{SavedBlocksPickBar-CAstZfG7.js → SavedBlocksPickBar-4ON4_KKl.js} +1 -1
- package/dist/{TemplateSettings-Baar78_s.js → TemplateSettings-BE0jZmRJ.js} +4 -4
- package/dist/{TestEmailModal-Bl_GHdrN.js → TestEmailModal-BKmNGrZN.js} +5 -5
- package/dist/{TestEmailPanel-CpTBF7B5.js → TestEmailPanel-DT1wllX3.js} +1 -1
- package/dist/{TitleEditor-DkbEDAZB.js → TitleEditor-HjVZuUTB.js} +8 -7
- package/dist/{Toolbar-bOZ_eq7X.js → Toolbar-BppchV2k.js} +617 -617
- package/dist/{TplModal-wk2gLa7_.js → TplModal-BFWOoK8l.js} +1 -1
- package/dist/{VersionHistoryPanels-Cq2rFKIX.js → VersionHistoryPanels-D4yNVLvq.js} +1 -1
- package/dist/{WrapperBlock-cWT_nZgQ.js → WrapperBlock-BUzQTZuu.js} +3 -3
- package/dist/{blockTypeIcons-BUyPZ7Su.js → blockTypeIcons-D91v9k0x.js} +1 -1
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AiAltTextPopover-Cnc_kUmb.js → AiAltTextPopover-CAI18sdv.js} +2 -2
- package/dist/cdn/chunks/{AiAltTextPopover-Cnc_kUmb.js.map → AiAltTextPopover-CAI18sdv.js.map} +1 -1
- package/dist/cdn/chunks/{AiAltTextReview-DPeSY-7r.js → AiAltTextReview-CWEyMOF-.js} +2 -2
- package/dist/cdn/chunks/{AiAltTextReview-DPeSY-7r.js.map → AiAltTextReview-CWEyMOF-.js.map} +1 -1
- package/dist/cdn/chunks/{AiRewriteMenu-C4btyN4W.js → AiRewriteMenu-BEepu1vo.js} +5 -5
- package/dist/cdn/chunks/{AiRewriteMenu-C4btyN4W.js.map → AiRewriteMenu-BEepu1vo.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-CTKmBPsq.js → BlockPreviewCanvas-B6ndvof2.js} +5 -5
- package/dist/cdn/chunks/{BlockPreviewCanvas-CTKmBPsq.js.map → BlockPreviewCanvas-B6ndvof2.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-COU26R83.js → CloudPanels-BGwDb0jB.js} +2 -2
- package/dist/cdn/chunks/{CloudPanels-COU26R83.js.map → CloudPanels-BGwDb0jB.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-CNgsNL5-.js → CountdownToolbar-B-0FsTj-.js} +5 -5
- package/dist/cdn/chunks/{CountdownToolbar-CNgsNL5-.js.map → CountdownToolbar-B-0FsTj-.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-Duic0mIs.js → IssuesPanel-LyjMBDok.js} +3 -3
- package/dist/cdn/chunks/{IssuesPanel-Duic0mIs.js.map → IssuesPanel-LyjMBDok.js.map} +1 -1
- package/dist/cdn/chunks/{LanguageMenu-B1Aue_lf.js → LanguageMenu-CGwMCOQ5.js} +4 -4
- package/dist/cdn/chunks/{LanguageMenu-B1Aue_lf.js.map → LanguageMenu-CGwMCOQ5.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-Bhvi0nWz.js → LogicTagInsertButton-PDKuo2J3.js} +4 -4
- package/dist/cdn/chunks/{LogicTagInsertButton-Bhvi0nWz.js.map → LogicTagInsertButton-PDKuo2J3.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-CrhZm-AW.js → MergeTagInput-DoQHBJk2.js} +2 -2
- package/dist/cdn/chunks/{MergeTagInput-CrhZm-AW.js.map → MergeTagInput-DoQHBJk2.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-CWVtXLYa.js → MergeTagModeToggle-Ct5IG4VW.js} +2 -2
- package/dist/cdn/chunks/{MergeTagModeToggle-CWVtXLYa.js.map → MergeTagModeToggle-Ct5IG4VW.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagTextarea-hTIBwX0F.js → MergeTagTextarea-BMsnjphR.js} +3 -3
- package/dist/cdn/chunks/{MergeTagTextarea-hTIBwX0F.js.map → MergeTagTextarea-BMsnjphR.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-B2UU1Q5I.js → ParagraphEditor-CVW-kuHW.js} +114 -113
- package/dist/cdn/chunks/ParagraphEditor-CVW-kuHW.js.map +1 -0
- package/dist/cdn/chunks/{RestoreVersionDialog-C1Y5Ewo_.js → RestoreVersionDialog-7MFZz-Sb.js} +2 -2
- package/dist/cdn/chunks/{RestoreVersionDialog-C1Y5Ewo_.js.map → RestoreVersionDialog-7MFZz-Sb.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-up4AqL7D.js → RichTextEditorContent-CiL-SkZg.js} +3 -3
- package/dist/cdn/chunks/{RichTextEditorContent-up4AqL7D.js.map → RichTextEditorContent-CiL-SkZg.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-B9lwEP_T.js → SaveBlockDialog-CxdekCYy.js} +5 -5
- package/dist/cdn/chunks/{SaveBlockDialog-B9lwEP_T.js.map → SaveBlockDialog-CxdekCYy.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-fAeHUyxb.js → SavedBlocksBrowserModal-D9CAa2U3.js} +4 -4
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-fAeHUyxb.js.map → SavedBlocksBrowserModal-D9CAa2U3.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-DRDTLDyZ.js → SavedBlocksPanels-jfkYWtss.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-DRDTLDyZ.js.map → SavedBlocksPanels-jfkYWtss.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-B6b5z-o3.js → SavedBlocksPickBar-yaCumC4j.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPickBar-B6b5z-o3.js.map → SavedBlocksPickBar-yaCumC4j.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-CWUpUKJb.js → TemplateSettings-SaV2UVh_.js} +5 -5
- package/dist/cdn/chunks/{TemplateSettings-CWUpUKJb.js.map → TemplateSettings-SaV2UVh_.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-DQxnW5Q5.js → TestEmailModal-ByfhP_sm.js} +6 -6
- package/dist/cdn/chunks/{TestEmailModal-DQxnW5Q5.js.map → TestEmailModal-ByfhP_sm.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-BcO_-16H.js → TestEmailPanel-CfzpqpDs.js} +2 -2
- package/dist/cdn/chunks/{TestEmailPanel-BcO_-16H.js.map → TestEmailPanel-CfzpqpDs.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-pmycpmTd.js → TitleEditor-Ceb0YfWv.js} +8 -7
- package/dist/cdn/chunks/TitleEditor-Ceb0YfWv.js.map +1 -0
- package/dist/cdn/chunks/{Toolbar-BlWVQRcA.js → Toolbar-Cv6Rv1S-.js} +9 -9
- package/dist/cdn/chunks/{Toolbar-BlWVQRcA.js.map → Toolbar-Cv6Rv1S-.js.map} +1 -1
- package/dist/cdn/chunks/{TplModal-ClSSGX7a.js → TplModal-DGpGdwgf.js} +2 -2
- package/dist/cdn/chunks/{TplModal-ClSSGX7a.js.map → TplModal-DGpGdwgf.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-B8GPBKMq.js → VersionHistoryPanels-BJnHCMAH.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryPanels-B8GPBKMq.js.map → VersionHistoryPanels-BJnHCMAH.js.map} +1 -1
- package/dist/cdn/chunks/{WrapperBlock-BoUflYwY.js → WrapperBlock-C_uE5rPJ.js} +4 -4
- package/dist/cdn/chunks/{WrapperBlock-BoUflYwY.js.map → WrapperBlock-C_uE5rPJ.js.map} +1 -1
- package/dist/cdn/chunks/{composables-C1KU4ZHw.js → composables-BxikPuC1.js} +449 -443
- package/dist/cdn/chunks/composables-BxikPuC1.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-C2Zs5F1O.js → createCloudRuntime-D2DUaudp.js} +3 -3
- package/dist/cdn/chunks/{createCloudRuntime-C2Zs5F1O.js.map → createCloudRuntime-D2DUaudp.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-DcMKZpzh.js → extensions-DuDWpKo7.js} +4 -4
- package/dist/cdn/chunks/{extensions-DcMKZpzh.js.map → extensions-DuDWpKo7.js.map} +1 -1
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-cC32Ox6A.js → normalizeMergeTagMarkup-Bn_hl4jd.js} +2 -2
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-cC32Ox6A.js.map → normalizeMergeTagMarkup-Bn_hl4jd.js.map} +1 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-f7GEKdvw.js → preRenderCustomBlocks-C9oavydG.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-f7GEKdvw.js.map → preRenderCustomBlocks-C9oavydG.js.map} +1 -1
- package/dist/cdn/chunks/{sanitizeHtml-WTfz9lZd.js → sanitizeHtml-DfXoetOm.js} +2 -2
- package/dist/cdn/chunks/{sanitizeHtml-WTfz9lZd.js.map → sanitizeHtml-DfXoetOm.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-DeCYorUT.js → socialIcons-DPwkrn5v.js} +2 -2
- package/dist/cdn/chunks/{socialIcons-DeCYorUT.js.map → socialIcons-DPwkrn5v.js.map} +1 -1
- package/dist/cdn/chunks/{src-A_cKeTM_.js → src-712f3ofG.js} +2 -2
- package/dist/cdn/chunks/{src-A_cKeTM_.js.map → src-712f3ofG.js.map} +1 -1
- package/dist/cdn/chunks/{src-BWX_xVxO.js → src-B2tQbzf6.js} +152 -146
- package/dist/cdn/chunks/src-B2tQbzf6.js.map +1 -0
- package/dist/cdn/chunks/{src-BQUv2CYU.js → src-ZFw5fg_z.js} +40 -27
- package/dist/cdn/chunks/{src-BQUv2CYU.js.map → src-ZFw5fg_z.js.map} +1 -1
- package/dist/cdn/chunks/{useLocalizedDisplay-aGfnO90D.js → useLocalizedDisplay-DiNjT22M.js} +2 -2
- package/dist/cdn/chunks/{useLocalizedDisplay-aGfnO90D.js.map → useLocalizedDisplay-DiNjT22M.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-DtYe8HIq.js → useLogicTag-SvMW4g00.js} +2 -2
- package/dist/cdn/chunks/{useLogicTag-DtYe8HIq.js.map → useLogicTag-SvMW4g00.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-B8ULmsnp.js → useMergeTag-JLz3Pqcw.js} +2 -2
- package/dist/cdn/chunks/{useMergeTag-B8ULmsnp.js.map → useMergeTag-JLz3Pqcw.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-MK8ga9q9.js → withCurrentFont-BcoPpkDS.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-MK8ga9q9.js.map → withCurrentFont-BcoPpkDS.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +18 -18
- package/dist/{composables-CMIrGXJ1.js → composables-BbPFRlBf.js} +908 -902
- package/dist/{createCloudRuntime-DGV5a5Af.js → createCloudRuntime-Dlrg88gS.js} +2 -2
- package/dist/{dist-Cdkm20M6.js → dist-C34cYI5S.js} +126 -113
- package/dist/{extensions-BJ184osp.js → extensions-xCiyqSg7.js} +16 -16
- package/dist/{normalizeMergeTagMarkup-CUCo7B5X.js → normalizeMergeTagMarkup-C7FGNURu.js} +22 -22
- package/dist/{preRenderCustomBlocks-Bs3N9no-.js → preRenderCustomBlocks-DvbRa3L3.js} +3 -3
- package/dist/{sanitizeHtml-2rjV0r-6.js → sanitizeHtml-D_ab7dD6.js} +5 -5
- package/dist/{socialIcons-TFiOkpoU.js → socialIcons-DhAolBjt.js} +342 -342
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +190 -190
- package/dist/useLocalizedDisplay-C9MBFUr4.js +31 -0
- package/dist/{useLogicTag-BXXXQQmi.js → useLogicTag-BmuakZBd.js} +1 -1
- package/dist/{useMergeTag-C9Okr87y.js → useMergeTag-DC4a8b_v.js} +3 -3
- package/dist/{withCurrentFont-DJiQqZzL.js → withCurrentFont-BSxJai99.js} +1 -1
- package/package.json +7 -7
- package/dist/cdn/chunks/ParagraphEditor-B2UU1Q5I.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-pmycpmTd.js.map +0 -1
- package/dist/cdn/chunks/composables-C1KU4ZHw.js.map +0 -1
- package/dist/cdn/chunks/src-BWX_xVxO.js.map +0 -1
- package/dist/useLocalizedDisplay-DNNwDRxL.js +0 -31
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { C as e, F as t, G as n, K as r, Q as i, _ as a, c as o, ct as s, dt as c, g as l, h as u, j as d, l as f, m as p, mt as m, o as h, p as g, pt as _, tt as v } from "./draggable-DepKdldn.js";
|
|
2
|
-
import { a as y, i as b, n as x, u as S } from "./src-
|
|
2
|
+
import { a as y, i as b, n as x, u as S } from "./src-ZFw5fg_z.js";
|
|
3
3
|
import { t as C } from "./useI18n-BnJYydPv.js";
|
|
4
|
-
import { t as w } from "./useMergeTag-
|
|
4
|
+
import { t as w } from "./useMergeTag-JLz3Pqcw.js";
|
|
5
5
|
import { _ as T, g as E, h as D, n as O, r as k, t as A, v as j, y as M } from "./tiptap-Dipw_zOQ.js";
|
|
6
|
-
import { a as N, o as P, s as F } from "./LogicTagInsertButton-
|
|
6
|
+
import { a as N, o as P, s as F } from "./LogicTagInsertButton-PDKuo2J3.js";
|
|
7
7
|
// src/extensions/FontSize.ts
|
|
8
8
|
var I = D.create({
|
|
9
9
|
name: "fontSize",
|
|
@@ -514,4 +514,4 @@ var $ = D.create({
|
|
|
514
514
|
});
|
|
515
515
|
export { I as FontSize, L as LetterSpacing, R as LineBoundaryKeys, z as LineHeight, K as LogicMergeTagNode, Z as MergeTagNode, $ as MergeTagSuggestion, P as filterMergeTags, F as handleSuggestionKeyDown };
|
|
516
516
|
|
|
517
|
-
//# sourceMappingURL=extensions-
|
|
517
|
+
//# sourceMappingURL=extensions-DuDWpKo7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions-DcMKZpzh.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createBlock","_unref","_normalizeClass","_normalizeStyle","_withCtx","_withDirectives","_createElementBlock","_vModelText","_withModifiers","_withKeys","_toDisplayString","_createElementVNode","_createCommentVNode","_sfc_main","LogicMergeTagNodeView","_openBlock","_createBlock","_unref","_withCtx","_withDirectives","_createElementBlock","_normalizeClass","_vModelText","_withModifiers","_withKeys","_toDisplayString","_createElementVNode","_sfc_main","MergeTagNodeView","Suggestion","defineComponent","openBlock","withCtx","withDirectives","onScopeDispose","createElementBlock","withKeys","unref","normalizeClass","createCommentVNode","createBlock","nextTick","withModifiers","createBaseVNode","toDisplayString","vModelText","computed","normalizeStyle","ref","getMergeTagLabel","getLogicMergeTagKeyword","SYNTAX_PRESETS","isLogicMergeTagValue","useI18n","useMergeTag","Node","InputRule","Extension","NodeViewWrapper","VueNodeViewRenderer","src_default","PasteRule","mergeAttributes","createMergeTagPopup","filterMergeTags","handleSuggestionKeyDown","FontSize","element","attributes","chain","size","LetterSpacing","spacing","LineBoundaryKeys","moveToLineBoundary","view","editor","selection","direction","LineHeight","commands","type","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","LogicMergeTagNodeView_default","props","__props","isValid","syntax","displayKeyword","isEditing","editValue","inputRef","handled","startEditing","finishEditing","newValue","handleKeydown","event","_cache","$event","t","args","isNodeSelected","$from","$to","nodeTypeName","renderVueNodeView","component","LogicMergeTagNode","node","keyword","HTMLAttributes","inputRegex","fullValue","match","range","pasteRegex","_hoisted_1","_hoisted_2","_hoisted_3","MergeTagNodeView_default","displayLabel","getMergeTagDisplayLabel","canRepick","canRepickMergeTag","disposed","isEditValueValid","isMergeTagValue","repick","replacement","requestMergeTag","findMergeTag","activate","format","showRawValue","MergeTagNode","label","attrs","createMergeTagSuggestionRenderer","popup","emptyText","popoverRootRef","item","MergeTagSuggestion","getMergeTags","config","query"],"sources":["../../../src/extensions/FontSize.ts","../../../src/extensions/LetterSpacing.ts","../../../src/extensions/LineBoundaryKeys.ts","../../../src/extensions/LineHeight.ts","../../../src/extensions/LogicMergeTagNodeView.vue","../../../src/extensions/LogicMergeTagNodeView.vue","../../../src/extensions/isNodeSelected.ts","../../../src/extensions/renderVueNodeView.ts","../../../src/extensions/LogicMergeTagNode.ts","../../../src/extensions/MergeTagNodeView.vue","../../../src/extensions/MergeTagNodeView.vue","../../../src/extensions/MergeTagNode.ts","../../../src/extensions/MergeTagSuggestion.ts"],"sourcesContent":["import { Extension } from \"@tiptap/core\";\n\nexport interface FontSizeOptions {\n types: string[];\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n fontSize: {\n setFontSize: (size: string) => ReturnType;\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: \"fontSize\",\n\n addOptions() {\n return {\n types: [\"textStyle\"],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, \"\") || null,\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (size: string) =>\n ({ chain }) => {\n return chain().setMark(\"textStyle\", { fontSize: size }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark(\"textStyle\", { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\nexport interface LetterSpacingOptions {\n types: string[];\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n letterSpacing: {\n setLetterSpacing: (spacing: string) => ReturnType;\n unsetLetterSpacing: () => ReturnType;\n };\n }\n}\n\nexport const LetterSpacing = Extension.create<LetterSpacingOptions>({\n name: \"letterSpacing\",\n\n addOptions() {\n return {\n types: [\"textStyle\"],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n letterSpacing: {\n default: null,\n parseHTML: (element) =>\n element.style.letterSpacing?.replace(/['\"]+/g, \"\") || null,\n renderHTML: (attributes) => {\n if (!attributes.letterSpacing) {\n return {};\n }\n return {\n style: `letter-spacing: ${attributes.letterSpacing}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setLetterSpacing:\n (spacing: string) =>\n ({ chain }) => {\n return chain().setMark(\"textStyle\", { letterSpacing: spacing }).run();\n },\n unsetLetterSpacing:\n () =>\n ({ chain }) => {\n return chain()\n .setMark(\"textStyle\", { letterSpacing: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\n/**\n * Routes plain End/Home through `Selection.modify` instead of the browser's\n * native caret movement.\n *\n * Chromium (verified 140–151, including stable Chrome) has a bug where a\n * native End or Home pressed while a triple-click selection is active puts\n * Blink's selection state into a mode where the next typed character\n * natively smooth-scrolls the nearest scrollable ancestor (the editor's\n * canvas, `.tpl-body`) to its very bottom (End) or top (Home), dragging the\n * caret out of view. The state cannot be repaired after the fact — clearing\n * or re-setting the DOM selection, blur/refocus, and preventDefault on the\n * clicks all fail — but a programmatic caret move never arms it.\n *\n * `Selection.modify(\"move\", direction, \"lineboundary\")` is the exact\n * equivalent of the native key (visual line boundary, bidi-aware via the\n * logical forward/backward directions), so behavior is unchanged for users.\n * Shift+End / Shift+Home extend selections natively and do not trigger the\n * bug, so only the plain keys are bound — a keymap entry without modifiers\n * never matches the shifted keys.\n */\nexport const LineBoundaryKeys = Extension.create({\n name: \"lineBoundaryKeys\",\n\n addKeyboardShortcuts() {\n const moveToLineBoundary =\n (direction: \"forward\" | \"backward\") =>\n ({ editor }: { editor: { view: unknown } }): boolean => {\n const view = editor.view as {\n composing: boolean;\n root: DocumentOrShadowRoot & {\n getSelection?: () => Selection | null;\n };\n dom: HTMLElement;\n };\n // During IME composition End/Home commit the composition; leave\n // that to the browser.\n if (!view || view.composing) return false;\n // `view.root` is the editable's Document or ShadowRoot, so the\n // selection resolves correctly in both mount modes. ShadowRoot's\n // getSelection is Chromium-only; elsewhere fall back to the owner\n // document (Chromium is also the only engine with the bug).\n const selection =\n typeof view.root?.getSelection === \"function\"\n ? view.root.getSelection()\n : (view.dom?.ownerDocument?.getSelection?.() ?? null);\n // `modify` is non-standard; without it, or with a selection that\n // is not ours, native handling is the safer default.\n if (!selection || typeof selection.modify !== \"function\") return false;\n if (!selection.anchorNode || !view.dom.contains(selection.anchorNode)) {\n return false;\n }\n selection.modify(\"move\", direction, \"lineboundary\");\n return true;\n };\n\n return {\n End: moveToLineBoundary(\"forward\"),\n Home: moveToLineBoundary(\"backward\"),\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\nexport interface LineHeightOptions {\n types: string[];\n defaultLineHeight: string;\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n lineHeight: {\n setLineHeight: (lineHeight: string) => ReturnType;\n unsetLineHeight: () => ReturnType;\n };\n }\n}\n\nexport const LineHeight = Extension.create<LineHeightOptions>({\n name: \"lineHeight\",\n\n addOptions() {\n return {\n types: [\"paragraph\"],\n defaultLineHeight: \"1.5\",\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) => element.style.lineHeight || null,\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setLineHeight:\n (lineHeight: string) =>\n ({ commands }) => {\n return this.options.types.every((type) =>\n commands.updateAttributes(type, { lineHeight }),\n );\n },\n unsetLineHeight:\n () =>\n ({ commands }) => {\n return this.options.types.every((type) =>\n commands.resetAttributes(type, \"lineHeight\"),\n );\n },\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport {\n getLogicMergeTagKeyword,\n isLogicMergeTagValue,\n} from \"@templatical/types\";\nimport type { Editor } from \"@tiptap/core\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n value: string;\n keyword: string;\n };\n };\n editor: Editor;\n getPos: () => number;\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst { syntax } = useMergeTag();\nconst { t } = useI18n();\n\nconst isValid = computed(() =>\n isLogicMergeTagValue(props.node.attrs.value, syntax),\n);\nconst displayKeyword = computed(() =>\n getLogicMergeTagKeyword(props.node.attrs.value, syntax),\n);\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\nlet handled = false;\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n handled = false;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\nfunction finishEditing(): void {\n if (handled) {\n return;\n }\n handled = true;\n\n const newValue = editValue.value.trim();\n if (!newValue) {\n isEditing.value = false;\n return;\n }\n\n if (newValue !== props.node.attrs.value) {\n props.updateAttributes({\n value: newValue,\n keyword: isLogicMergeTagValue(newValue, syntax)\n ? getLogicMergeTagKeyword(newValue, syntax)\n : \"\",\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n :class=\"\n isValid\n ? 'tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none'\n : ''\n \"\n :style=\"\n isValid\n ? 'background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);'\n : ''\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n class=\"tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode: valid merge tag -->\n <span\n v-else-if=\"isValid\"\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n class=\"tpl-tooltip tpl:cursor-pointer\"\n :data-tooltip=\"node.attrs.value\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ displayKeyword }}\n </span>\n <!-- Display mode: invalid (plain text) -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ node.attrs.value }}\n </span>\n <button\n v-if=\"isValid\"\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport {\n getLogicMergeTagKeyword,\n isLogicMergeTagValue,\n} from \"@templatical/types\";\nimport type { Editor } from \"@tiptap/core\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n value: string;\n keyword: string;\n };\n };\n editor: Editor;\n getPos: () => number;\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst { syntax } = useMergeTag();\nconst { t } = useI18n();\n\nconst isValid = computed(() =>\n isLogicMergeTagValue(props.node.attrs.value, syntax),\n);\nconst displayKeyword = computed(() =>\n getLogicMergeTagKeyword(props.node.attrs.value, syntax),\n);\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\nlet handled = false;\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n handled = false;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\nfunction finishEditing(): void {\n if (handled) {\n return;\n }\n handled = true;\n\n const newValue = editValue.value.trim();\n if (!newValue) {\n isEditing.value = false;\n return;\n }\n\n if (newValue !== props.node.attrs.value) {\n props.updateAttributes({\n value: newValue,\n keyword: isLogicMergeTagValue(newValue, syntax)\n ? getLogicMergeTagKeyword(newValue, syntax)\n : \"\",\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n :class=\"\n isValid\n ? 'tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none'\n : ''\n \"\n :style=\"\n isValid\n ? 'background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);'\n : ''\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n class=\"tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode: valid merge tag -->\n <span\n v-else-if=\"isValid\"\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n class=\"tpl-tooltip tpl:cursor-pointer\"\n :data-tooltip=\"node.attrs.value\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ displayKeyword }}\n </span>\n <!-- Display mode: invalid (plain text) -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ node.attrs.value }}\n </span>\n <button\n v-if=\"isValid\"\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","import type { Editor } from \"@tiptap/core\";\n\n/**\n * Decides whether MergeTagNode / LogicMergeTagNode should swallow a\n * Backspace/Delete keystroke (returning `true` from a TipTap keymap\n * suppresses the default behavior).\n *\n * Only suppresses in the cursor-adjacent case so the \"first press\n * selects the atom, second press deletes it\" UX works. Range selections\n * (Cmd+A, drag-select, double-click-word) explicitly fall through —\n * default `replaceSelection` then deletes the entire range including\n * any merge-tag atoms inside it.\n *\n * Earlier revisions also returned `true` whenever `nodesBetween($from,\n * $to)` found a merge tag anywhere in the selection range — which\n * silently broke Cmd+A + Backspace for any paragraph containing a\n * merge tag (entire deletion was cancelled, nothing happened). The\n * cursor-adjacent protection is the only piece that should survive.\n */\nexport function isNodeSelected(editor: Editor, nodeTypeName: string): boolean {\n const { $from, $to } = editor.state.selection;\n\n // Range selection: let TipTap's default range-delete run. Even when\n // the range contains atom nodes, ProseMirror's replaceSelection\n // handles atomic deletion correctly.\n if ($from.pos !== $to.pos) return false;\n\n // Cursor-adjacent atom: protect from single-keystroke deletion.\n // (`$from.pos > 0` guards against reading `nodeBefore` at doc start\n // where ProseMirror's index would be undefined for nodeBefore.)\n if ($from.pos > 0 && $from.nodeBefore?.type.name === nodeTypeName) {\n return true;\n }\n if ($from.nodeAfter?.type.name === nodeTypeName) {\n return true;\n }\n\n return false;\n}\n","import type { Component } from \"vue\";\nimport { VueNodeViewRenderer } from \"@tiptap/vue-3\";\n\n/**\n * Typed wrapper for VueNodeViewRenderer that handles the known type mismatch\n * between Vue SFC default exports and TipTap's expected component type.\n */\nexport function renderVueNodeView(component: Component) {\n return VueNodeViewRenderer(\n component as Parameters<typeof VueNodeViewRenderer>[0],\n );\n}\n","import LogicMergeTagNodeView from \"./LogicMergeTagNodeView.vue\";\nimport type { SyntaxPreset } from \"@templatical/types\";\nimport {\n getLogicMergeTagKeyword,\n isLogicMergeTagValue,\n SYNTAX_PRESETS,\n} from \"@templatical/types\";\nimport { InputRule, mergeAttributes, Node, PasteRule } from \"@tiptap/core\";\nimport { isNodeSelected } from \"./isNodeSelected\";\nimport { renderVueNodeView } from \"./renderVueNodeView\";\n\nexport interface LogicMergeTagNodeOptions {\n syntax: SyntaxPreset;\n}\n\nexport const LogicMergeTagNode = Node.create<LogicMergeTagNodeOptions>({\n name: \"logicMergeTagNode\",\n\n group: \"inline\",\n\n inline: true,\n\n atom: true,\n\n addOptions() {\n return {\n syntax: SYNTAX_PRESETS.liquid,\n };\n },\n\n addAttributes() {\n return {\n // Both attributes are state, not markup, same as `MergeTagNode`:\n // `renderHTML()` emits the canonical `data-logic-merge-tag` /\n // `data-keyword` pair and `parseHTML` reads only those. `rendered: false`\n // keeps TipTap from also serializing each attribute under its own name,\n // which would put a write-only duplicate of the same data on every tag.\n value: {\n default: \"\",\n rendered: false,\n parseHTML: (element) =>\n element.getAttribute(\"data-logic-merge-tag\") || \"\",\n },\n keyword: {\n default: \"\",\n rendered: false,\n parseHTML: (element) =>\n element.getAttribute(\"data-keyword\") || element.textContent || \"\",\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span[data-logic-merge-tag]\",\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n if (!isLogicMergeTagValue(node.attrs.value, this.options.syntax)) {\n return [\"span\", {}, node.attrs.value];\n }\n\n const keyword = getLogicMergeTagKeyword(\n node.attrs.value,\n this.options.syntax,\n );\n\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-logic-merge-tag\": node.attrs.value,\n \"data-keyword\": keyword,\n }),\n keyword,\n ];\n },\n\n addNodeView() {\n return renderVueNodeView(LogicMergeTagNodeView);\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => isNodeSelected(this.editor, this.name),\n Delete: () => isNodeSelected(this.editor, this.name),\n };\n },\n\n addInputRules() {\n const inputRegex = new RegExp(this.options.syntax.logic.source + \"$\", \"\");\n\n return [\n new InputRule({\n find: inputRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n if (!isLogicMergeTagValue(fullValue, this.options.syntax)) {\n return;\n }\n\n const keyword = getLogicMergeTagKeyword(\n fullValue,\n this.options.syntax,\n );\n\n const node = this.type.create({\n value: fullValue,\n keyword,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n\n addPasteRules() {\n const pasteRegex = new RegExp(this.options.syntax.logic.source, \"g\");\n\n return [\n new PasteRule({\n find: pasteRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n if (!isLogicMergeTagValue(fullValue, this.options.syntax)) {\n return;\n }\n\n const keyword = getLogicMergeTagKeyword(\n fullValue,\n this.options.syntax,\n );\n\n const node = this.type.create({\n value: fullValue,\n keyword,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n});\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, onScopeDispose, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n label: string;\n value: string;\n };\n };\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst {\n getMergeTagLabel,\n getMergeTagDisplayLabel,\n findMergeTag,\n canRepickMergeTag,\n showRawValue,\n isMergeTagValue,\n requestMergeTag,\n} = useMergeTag();\nconst { t, format } = useI18n();\n\n// `node.attrs.label` is the label captured when the tag was inserted. It is\n// only ever a fallback — the configured tags win, which is what keeps a\n// relabelled tag from rendering its stale stored copy.\nconst displayLabel = computed(() =>\n getMergeTagDisplayLabel(props.node.attrs.value, props.node.attrs.label),\n);\nconst canRepick = computed(() => canRepickMergeTag(props.node.attrs.value));\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\n\n// The chooser mounts in the popover root, outside this node view, so the node\n// can be torn down while it is open — a collaborator edit, a block change, the\n// editor unmounting. Writing attributes onto a destroyed node view throws.\nlet disposed = false;\nonScopeDispose(() => {\n disposed = true;\n});\n\n/** Whether the text currently in the raw input is a usable merge tag. */\nconst isEditValueValid = computed(\n () =>\n editValue.value.trim() === \"\" || isMergeTagValue(editValue.value.trim()),\n);\n\n/**\n * Swap this tag for another one, chosen through the same chooser insertion\n * uses. `requestMergeTag` sets the editor-wide requesting flag for the whole\n * await, which is what stops `useRichTextEditor`'s click-outside handler\n * finishing the block when the user clicks a row in the chooser — that would\n * dispose this node view and silently drop the update.\n */\nasync function repick(): Promise<void> {\n const replacement = await requestMergeTag({\n reason: \"edit\",\n current: findMergeTag(props.node.attrs.value),\n });\n if (disposed || !replacement) return;\n props.updateAttributes({\n value: replacement.value,\n label: replacement.label,\n });\n}\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\n/**\n * Activating the chip opens the chooser when one can resolve this token, and\n * the raw input only when none can. Editing a token as free text is how a\n * chip ends up holding something that is not a merge tag at all, which the\n * renderer then emits verbatim into the sent email.\n */\nfunction activate(): void {\n if (canRepick.value) {\n void repick();\n return;\n }\n startEditing();\n}\n\nfunction finishEditing(): void {\n const newValue = editValue.value.trim();\n // Never commit something that isn't a merge tag: `renderHTML` writes the\n // value straight into `data-merge-tag`, and the renderer drops that into the\n // MJML unchanged, so a typo would ship as literal text in the email.\n if (\n newValue &&\n newValue !== props.node.attrs.value &&\n isMergeTagValue(newValue)\n ) {\n props.updateAttributes({\n // The honest resolution, not the display chain: this is written into the\n // document as `data-label`, so a placeholder would be persisted as if it\n // were the tag's name.\n value: newValue,\n label: getMergeTagLabel(newValue),\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n // Enter on an invalid value keeps the input open rather than discarding\n // what was typed — the border and `aria-invalid` already say why.\n if (!isEditValueValid.value) return;\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n class=\"tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]\"\n style=\"\n background-color: color-mix(in srgb, var(--tpl-primary) 20%, transparent);\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n :aria-invalid=\"isEditValueValid ? undefined : 'true'\"\n class=\"tpl:w-32 tpl:rounded tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n :class=\"\n isEditValueValid\n ? 'tpl:border-none'\n : 'tpl:border tpl:border-[var(--tpl-danger)]'\n \"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"\n canRepick\n ? format(t.mergeTag.changeTag, { label: displayLabel })\n : t.mergeTag.editValue\n \"\n class=\"tpl:cursor-pointer\"\n :class=\"showRawValue ? 'tpl-tooltip' : ''\"\n :data-tooltip=\"showRawValue ? node.attrs.value : undefined\"\n @click.stop=\"activate\"\n @keydown.enter.stop=\"activate\"\n @keydown.space.prevent.stop=\"activate\"\n >\n {{ displayLabel }}\n </span>\n <button\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, onScopeDispose, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n label: string;\n value: string;\n };\n };\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst {\n getMergeTagLabel,\n getMergeTagDisplayLabel,\n findMergeTag,\n canRepickMergeTag,\n showRawValue,\n isMergeTagValue,\n requestMergeTag,\n} = useMergeTag();\nconst { t, format } = useI18n();\n\n// `node.attrs.label` is the label captured when the tag was inserted. It is\n// only ever a fallback — the configured tags win, which is what keeps a\n// relabelled tag from rendering its stale stored copy.\nconst displayLabel = computed(() =>\n getMergeTagDisplayLabel(props.node.attrs.value, props.node.attrs.label),\n);\nconst canRepick = computed(() => canRepickMergeTag(props.node.attrs.value));\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\n\n// The chooser mounts in the popover root, outside this node view, so the node\n// can be torn down while it is open — a collaborator edit, a block change, the\n// editor unmounting. Writing attributes onto a destroyed node view throws.\nlet disposed = false;\nonScopeDispose(() => {\n disposed = true;\n});\n\n/** Whether the text currently in the raw input is a usable merge tag. */\nconst isEditValueValid = computed(\n () =>\n editValue.value.trim() === \"\" || isMergeTagValue(editValue.value.trim()),\n);\n\n/**\n * Swap this tag for another one, chosen through the same chooser insertion\n * uses. `requestMergeTag` sets the editor-wide requesting flag for the whole\n * await, which is what stops `useRichTextEditor`'s click-outside handler\n * finishing the block when the user clicks a row in the chooser — that would\n * dispose this node view and silently drop the update.\n */\nasync function repick(): Promise<void> {\n const replacement = await requestMergeTag({\n reason: \"edit\",\n current: findMergeTag(props.node.attrs.value),\n });\n if (disposed || !replacement) return;\n props.updateAttributes({\n value: replacement.value,\n label: replacement.label,\n });\n}\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\n/**\n * Activating the chip opens the chooser when one can resolve this token, and\n * the raw input only when none can. Editing a token as free text is how a\n * chip ends up holding something that is not a merge tag at all, which the\n * renderer then emits verbatim into the sent email.\n */\nfunction activate(): void {\n if (canRepick.value) {\n void repick();\n return;\n }\n startEditing();\n}\n\nfunction finishEditing(): void {\n const newValue = editValue.value.trim();\n // Never commit something that isn't a merge tag: `renderHTML` writes the\n // value straight into `data-merge-tag`, and the renderer drops that into the\n // MJML unchanged, so a typo would ship as literal text in the email.\n if (\n newValue &&\n newValue !== props.node.attrs.value &&\n isMergeTagValue(newValue)\n ) {\n props.updateAttributes({\n // The honest resolution, not the display chain: this is written into the\n // document as `data-label`, so a placeholder would be persisted as if it\n // were the tag's name.\n value: newValue,\n label: getMergeTagLabel(newValue),\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n // Enter on an invalid value keeps the input open rather than discarding\n // what was typed — the border and `aria-invalid` already say why.\n if (!isEditValueValid.value) return;\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n class=\"tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]\"\n style=\"\n background-color: color-mix(in srgb, var(--tpl-primary) 20%, transparent);\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n :aria-invalid=\"isEditValueValid ? undefined : 'true'\"\n class=\"tpl:w-32 tpl:rounded tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n :class=\"\n isEditValueValid\n ? 'tpl:border-none'\n : 'tpl:border tpl:border-[var(--tpl-danger)]'\n \"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"\n canRepick\n ? format(t.mergeTag.changeTag, { label: displayLabel })\n : t.mergeTag.editValue\n \"\n class=\"tpl:cursor-pointer\"\n :class=\"showRawValue ? 'tpl-tooltip' : ''\"\n :data-tooltip=\"showRawValue ? node.attrs.value : undefined\"\n @click.stop=\"activate\"\n @keydown.enter.stop=\"activate\"\n @keydown.space.prevent.stop=\"activate\"\n >\n {{ displayLabel }}\n </span>\n <button\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","import MergeTagNodeView from \"./MergeTagNodeView.vue\";\nimport type { MergeTag, SyntaxPreset } from \"@templatical/types\";\nimport { getMergeTagLabel, SYNTAX_PRESETS } from \"@templatical/types\";\nimport { InputRule, mergeAttributes, Node, PasteRule } from \"@tiptap/core\";\nimport { isNodeSelected } from \"./isNodeSelected\";\nimport { renderVueNodeView } from \"./renderVueNodeView\";\n\nexport interface MergeTagNodeOptions {\n /**\n * Read live, not captured. `renderHTML` and the input/paste rules resolve a\n * label every time they run, and `editor.setMergeTags` can replace the list\n * while a block is open for editing.\n */\n mergeTags: () => MergeTag[];\n syntax: SyntaxPreset;\n}\n\n/**\n * Inserted-node attrs are intentionally limited to `label` + `value`. The\n * `MergeTag` interface also carries optional `group` / `description` for\n * the built-in picker, but those are display-only and must NOT leak into\n * the document JSON — they would bloat templates and pollute serialized\n * state. `Pick<>` makes the constraint explicit at the type level.\n */\nexport type InsertMergeTagAttrs = Pick<MergeTag, \"label\" | \"value\">;\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n mergeTagNode: {\n insertMergeTag: (attrs: InsertMergeTagAttrs) => ReturnType;\n };\n }\n}\n\nexport const MergeTagNode = Node.create<MergeTagNodeOptions>({\n name: \"mergeTagNode\",\n\n group: \"inline\",\n\n inline: true,\n\n atom: true,\n\n addOptions() {\n return {\n mergeTags: () => [],\n syntax: SYNTAX_PRESETS.liquid,\n };\n },\n\n addAttributes() {\n return {\n // Both attributes are state, not markup: `renderHTML()` below emits the\n // canonical `data-merge-tag` / `data-label` pair and `parseHTML` reads\n // only those. `rendered: false` keeps TipTap from also serializing each\n // attribute under its own name, which would put a write-only duplicate\n // of the same data on every tag — invalid on a `<span>`, and paid again\n // through storage, autosave, snapshots and version history.\n label: {\n default: \"\",\n rendered: false,\n parseHTML: (element) =>\n element.getAttribute(\"data-label\") || element.textContent || \"\",\n },\n value: {\n default: \"\",\n rendered: false,\n parseHTML: (element) => element.getAttribute(\"data-merge-tag\") || \"\",\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span[data-merge-tag]\",\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const label = getMergeTagLabel(node.attrs.value, this.options.mergeTags());\n\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-merge-tag\": node.attrs.value,\n \"data-label\": label,\n }),\n label,\n ];\n },\n\n addNodeView() {\n return renderVueNodeView(MergeTagNodeView);\n },\n\n addCommands() {\n return {\n insertMergeTag:\n (attrs: InsertMergeTagAttrs) =>\n ({ commands }) => {\n // Whitelist explicitly — even if a caller smuggles extra keys via\n // a wider type assertion, only label/value reach the node attrs.\n return commands.insertContent({\n type: this.name,\n attrs: { label: attrs.label, value: attrs.value },\n });\n },\n };\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => isNodeSelected(this.editor, this.name),\n Delete: () => isNodeSelected(this.editor, this.name),\n };\n },\n\n addInputRules() {\n const inputRegex = new RegExp(this.options.syntax.value.source + \"$\", \"\");\n\n return [\n new InputRule({\n find: inputRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n const label = getMergeTagLabel(fullValue, this.options.mergeTags());\n\n const node = this.type.create({\n label,\n value: fullValue,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n\n addPasteRules() {\n const pasteRegex = new RegExp(this.options.syntax.value.source, \"g\");\n\n return [\n new PasteRule({\n find: pasteRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n const label = getMergeTagLabel(fullValue, this.options.mergeTags());\n\n const node = this.type.create({\n label,\n value: fullValue,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n});\n","import type { MergeTag } from \"@templatical/types\";\nimport { Extension } from \"@tiptap/core\";\nimport Suggestion, {\n type SuggestionOptions,\n type SuggestionProps,\n type SuggestionKeyDownProps,\n} from \"@tiptap/suggestion\";\nimport type { Ref } from \"vue\";\nimport { createMergeTagPopup, filterMergeTags } from \"../utils/mergeTagPopup\";\n\nexport interface MergeTagSuggestionOptions {\n /** Available merge tags */\n /**\n * Read live, not captured: the list can be replaced while a block is being\n * edited (`editor.setMergeTags`), and a snapshot taken when the extension\n * was configured would keep suggesting the old tags.\n */\n mergeTags: () => MergeTag[];\n /** Trigger string (e.g. \"{{\", \"*|\", \"%%=\") */\n char: string;\n /** Localized empty-state label */\n emptyText: string;\n /**\n * Mount target for the suggestion popup. When provided with a non-null\n * `.value`, the popup attaches into that element instead of\n * `document.body` — keeping it inside the editor's effective DOM root\n * (shadow-aware). Pass the ref returned by `usePopoverRoot()`.\n *\n * Falls back to `document.body` when omitted or when the ref's value is\n * null at popup-open time (e.g. headless/test editors without an editor\n * shell). Preserves pre-Phase-3 behavior for callers that don't migrate.\n */\n popoverRoot?: Ref<HTMLElement | null> | null;\n}\n\n/**\n * Builds the `@tiptap/suggestion` `render` factory for the merge-tag popup.\n * A thin adapter over {@link createMergeTagPopup}: it maps ProseMirror's\n * `SuggestionProps` (items, `clientRect`, `view.dom`, `command`) onto the\n * controller. Exported as a standalone function so that mapping can be\n * unit-tested with mocked `SuggestionProps` instead of a full editor.\n */\nexport function createMergeTagSuggestionRenderer(\n emptyText: string,\n popoverRootRef?: Ref<HTMLElement | null> | null,\n): NonNullable<SuggestionOptions<MergeTag>[\"render\"]> {\n return () => {\n const popup = createMergeTagPopup(emptyText, popoverRootRef);\n\n return {\n onStart: (props: SuggestionProps<MergeTag>) => {\n // Use view.dom (ProseMirror contenteditable, actually\n // attached to the DOM) rather than options.element, which may\n // be a detached div when no `element` is passed to the editor\n // constructor (as is the case with @tiptap/vue-3 EditorContent).\n const viewDom = props.editor.view?.dom as HTMLElement | undefined;\n popup.open({\n items: props.items,\n getRect: props.clientRect ?? null,\n anchorEl: viewDom ?? null,\n onCommand: (item) => props.command(item),\n });\n },\n onUpdate: (props: SuggestionProps<MergeTag>) => {\n popup.update({\n items: props.items,\n getRect: props.clientRect ?? null,\n onCommand: (item) => props.command(item),\n });\n },\n onKeyDown: (props: SuggestionKeyDownProps): boolean => {\n // Escape closes via TipTap's suggestion plugin (→ onExit); report it\n // handled without selecting.\n if (props.event.key === \"Escape\") {\n return true;\n }\n return popup.handleKeyDown(props.event);\n },\n onExit: () => popup.close(),\n };\n };\n}\n\nexport const MergeTagSuggestion = Extension.create<MergeTagSuggestionOptions>({\n name: \"mergeTagSuggestion\",\n\n addOptions() {\n return {\n mergeTags: () => [],\n char: \"{{\",\n emptyText: \"No matching merge tags\",\n popoverRoot: null,\n };\n },\n\n addProseMirrorPlugins() {\n const getMergeTags = this.options.mergeTags;\n const emptyText = this.options.emptyText;\n const popoverRootRef = this.options.popoverRoot;\n\n const config: Omit<SuggestionOptions<MergeTag>, \"editor\"> = {\n char: this.options.char,\n allowSpaces: false,\n startOfLine: false,\n // Default is [\" \"] which requires whitespace/line-start before the\n // trigger char — so `.{{` would not fire. Allow any preceding char.\n allowedPrefixes: null,\n items: ({ query }: { query: string }) =>\n filterMergeTags(getMergeTags(), query),\n command: ({\n editor,\n range,\n props,\n }: {\n editor: SuggestionProps<MergeTag>[\"editor\"];\n range: { from: number; to: number };\n props: MergeTag;\n }) => {\n if (!editor.isEditable) return;\n // Use insertContentAt for atomic replace (matches the canonical\n // @tiptap/suggestion + Mention pattern). Avoids edge cases where\n // chained deleteRange + insertMergeTag fails to insert when the\n // selection state shifts mid-chain.\n editor\n .chain()\n .focus()\n .insertContentAt(range, {\n type: \"mergeTagNode\",\n attrs: { label: props.label, value: props.value },\n })\n .run();\n },\n render: createMergeTagSuggestionRenderer(emptyText, popoverRootRef),\n };\n\n return [\n Suggestion({\n editor: this.editor,\n ...config,\n }),\n ];\n },\n});\n"],"mappings":";;;;;;;AAeA,IAAasE,IAAWT,EAAU,OAAwB;CACxD,MAAM;CAEN,aAAa;EACX,OAAO,EACL,OAAO,CAAC,WAAW,EACrB;CACF;CAEA,sBAAsB;EACpB,OAAO,CACL;GACE,OAAO,KAAK,QAAQ;GACpB,YAAY,EACV,UAAU;IACR,SAAS;IACT,YAAY,MACVU,EAAQ,MAAM,UAAU,QAAQ,UAAU,EAAE,KAAK;IACnD,aAAa,MACNC,EAAW,WAGT,EACL,OAAO,cAAcA,EAAW,WAClC,IAJS,CAAC;GAMd,EACF;EACF,CACF;CACF;CAEA,cAAc;EACZ,OAAO;GACL,cACG,OACA,EAAE,eACMC,EAAM,CAAC,CAAC,QAAQ,aAAa,EAAE,UAAUC,EAAK,CAAC,CAAC,CAAC,IAAI;GAEhE,sBAEG,EAAE,eACMD,EAAM,CAAC,CACX,QAAQ,aAAa,EAAE,UAAU,KAAK,CAAC,CAAC,CACxC,qBAAqB,CAAC,CACtB,IAAI;EAEb;CACF;AACF,CAAC,GCjDYE,IAAgBd,EAAU,OAA6B;CAClE,MAAM;CAEN,aAAa;EACX,OAAO,EACL,OAAO,CAAC,WAAW,EACrB;CACF;CAEA,sBAAsB;EACpB,OAAO,CACL;GACE,OAAO,KAAK,QAAQ;GACpB,YAAY,EACV,eAAe;IACb,SAAS;IACT,YAAY,MACVU,EAAQ,MAAM,eAAe,QAAQ,UAAU,EAAE,KAAK;IACxD,aAAa,MACNC,EAAW,gBAGT,EACL,OAAO,mBAAmBA,EAAW,gBACvC,IAJS,CAAC;GAMd,EACF;EACF,CACF;CACF;CAEA,cAAc;EACZ,OAAO;GACL,mBACG,OACA,EAAE,eACMC,EAAM,CAAC,CAAC,QAAQ,aAAa,EAAE,eAAeG,EAAQ,CAAC,CAAC,CAAC,IAAI;GAExE,2BAEG,EAAE,eACMH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M;KACb,SAASA,EAAM,cAAc;KAC7B,YAAY,MAASA,EAAM,QAAQ0D,CAAI;IACzC,CAAC;GACH;GACA,YAAY,MAGN1D,EAAM,MAAM,QAAQ,YAGjBuD,EAAM,cAAcvD,EAAM,KAAK;GAExC,cAAcuD,EAAM,MAAM;EAC5B;CACF;AACF;AAEA,IAAaI,IAAqBxF,EAAU,OAAkC;CAC5E,MAAM;CAEN,aAAa;EACX,OAAO;GACL,iBAAiB,CAAC;GAClB,MAAM;GACN,WAAW;GACX,aAAa;EACf;CACF;CAEA,wBAAwB;EACtB,IAAMyF,IAAe,KAAK,QAAQ,WAC5BJ,IAAY,KAAK,QAAQ,WACzBC,IAAiB,KAAK,QAAQ,aAE9BI,IAAsD;GAC1D,MAAM,KAAK,QAAQ;GACnB,aAAa;GACb,aAAa;GAGb,iBAAiB;GACjB,QAAQ,EAAE,eACRnF,EAAgBkF,EAAa,GAAGE,CAAK;GACvC,UAAU,EACR,WACA,UACA,eAKI;IACJ,AAAKxE,EAAO,cAKZA,EACG,MAAM,CAAC,CACP,MAAM,CAAC,CACP,gBAAgByC,GAAO;KACtB,MAAM;KACN,OAAO;MAAE,OAAO/B,EAAM;MAAO,OAAOA,EAAM;KAAM;IAClD,CAAC,CAAC,CACD,IAAI;GACT;GACA,QAAQsD,EAAiCE,GAAWC,CAAc;EACpE;EAEA,OAAO,CACLlH,EAAW;GACT,QAAQ,KAAK;GACb,GAAGsH;EACL,CAAC,CACH;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"extensions-DuDWpKo7.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createBlock","_unref","_normalizeClass","_normalizeStyle","_withCtx","_withDirectives","_createElementBlock","_vModelText","_withModifiers","_withKeys","_toDisplayString","_createElementVNode","_createCommentVNode","_sfc_main","LogicMergeTagNodeView","_openBlock","_createBlock","_unref","_withCtx","_withDirectives","_createElementBlock","_normalizeClass","_vModelText","_withModifiers","_withKeys","_toDisplayString","_createElementVNode","_sfc_main","MergeTagNodeView","Suggestion","defineComponent","openBlock","withCtx","withDirectives","onScopeDispose","createElementBlock","withKeys","unref","normalizeClass","createCommentVNode","createBlock","nextTick","withModifiers","createBaseVNode","toDisplayString","vModelText","computed","normalizeStyle","ref","getMergeTagLabel","getLogicMergeTagKeyword","SYNTAX_PRESETS","isLogicMergeTagValue","useI18n","useMergeTag","Node","InputRule","Extension","NodeViewWrapper","VueNodeViewRenderer","src_default","PasteRule","mergeAttributes","createMergeTagPopup","filterMergeTags","handleSuggestionKeyDown","FontSize","element","attributes","chain","size","LetterSpacing","spacing","LineBoundaryKeys","moveToLineBoundary","view","editor","selection","direction","LineHeight","commands","type","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","LogicMergeTagNodeView_default","props","__props","isValid","syntax","displayKeyword","isEditing","editValue","inputRef","handled","startEditing","finishEditing","newValue","handleKeydown","event","_cache","$event","t","args","isNodeSelected","$from","$to","nodeTypeName","renderVueNodeView","component","LogicMergeTagNode","node","keyword","HTMLAttributes","inputRegex","fullValue","match","range","pasteRegex","_hoisted_1","_hoisted_2","_hoisted_3","MergeTagNodeView_default","displayLabel","getMergeTagDisplayLabel","canRepick","canRepickMergeTag","disposed","isEditValueValid","isMergeTagValue","repick","replacement","requestMergeTag","findMergeTag","activate","format","showRawValue","MergeTagNode","label","attrs","createMergeTagSuggestionRenderer","popup","emptyText","popoverRootRef","item","MergeTagSuggestion","getMergeTags","config","query"],"sources":["../../../src/extensions/FontSize.ts","../../../src/extensions/LetterSpacing.ts","../../../src/extensions/LineBoundaryKeys.ts","../../../src/extensions/LineHeight.ts","../../../src/extensions/LogicMergeTagNodeView.vue","../../../src/extensions/LogicMergeTagNodeView.vue","../../../src/extensions/isNodeSelected.ts","../../../src/extensions/renderVueNodeView.ts","../../../src/extensions/LogicMergeTagNode.ts","../../../src/extensions/MergeTagNodeView.vue","../../../src/extensions/MergeTagNodeView.vue","../../../src/extensions/MergeTagNode.ts","../../../src/extensions/MergeTagSuggestion.ts"],"sourcesContent":["import { Extension } from \"@tiptap/core\";\n\nexport interface FontSizeOptions {\n types: string[];\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n fontSize: {\n setFontSize: (size: string) => ReturnType;\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: \"fontSize\",\n\n addOptions() {\n return {\n types: [\"textStyle\"],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, \"\") || null,\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (size: string) =>\n ({ chain }) => {\n return chain().setMark(\"textStyle\", { fontSize: size }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark(\"textStyle\", { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\nexport interface LetterSpacingOptions {\n types: string[];\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n letterSpacing: {\n setLetterSpacing: (spacing: string) => ReturnType;\n unsetLetterSpacing: () => ReturnType;\n };\n }\n}\n\nexport const LetterSpacing = Extension.create<LetterSpacingOptions>({\n name: \"letterSpacing\",\n\n addOptions() {\n return {\n types: [\"textStyle\"],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n letterSpacing: {\n default: null,\n parseHTML: (element) =>\n element.style.letterSpacing?.replace(/['\"]+/g, \"\") || null,\n renderHTML: (attributes) => {\n if (!attributes.letterSpacing) {\n return {};\n }\n return {\n style: `letter-spacing: ${attributes.letterSpacing}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setLetterSpacing:\n (spacing: string) =>\n ({ chain }) => {\n return chain().setMark(\"textStyle\", { letterSpacing: spacing }).run();\n },\n unsetLetterSpacing:\n () =>\n ({ chain }) => {\n return chain()\n .setMark(\"textStyle\", { letterSpacing: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\n/**\n * Routes plain End/Home through `Selection.modify` instead of the browser's\n * native caret movement.\n *\n * Chromium (verified 140–151, including stable Chrome) has a bug where a\n * native End or Home pressed while a triple-click selection is active puts\n * Blink's selection state into a mode where the next typed character\n * natively smooth-scrolls the nearest scrollable ancestor (the editor's\n * canvas, `.tpl-body`) to its very bottom (End) or top (Home), dragging the\n * caret out of view. The state cannot be repaired after the fact — clearing\n * or re-setting the DOM selection, blur/refocus, and preventDefault on the\n * clicks all fail — but a programmatic caret move never arms it.\n *\n * `Selection.modify(\"move\", direction, \"lineboundary\")` is the exact\n * equivalent of the native key (visual line boundary, bidi-aware via the\n * logical forward/backward directions), so behavior is unchanged for users.\n * Shift+End / Shift+Home extend selections natively and do not trigger the\n * bug, so only the plain keys are bound — a keymap entry without modifiers\n * never matches the shifted keys.\n */\nexport const LineBoundaryKeys = Extension.create({\n name: \"lineBoundaryKeys\",\n\n addKeyboardShortcuts() {\n const moveToLineBoundary =\n (direction: \"forward\" | \"backward\") =>\n ({ editor }: { editor: { view: unknown } }): boolean => {\n const view = editor.view as {\n composing: boolean;\n root: DocumentOrShadowRoot & {\n getSelection?: () => Selection | null;\n };\n dom: HTMLElement;\n };\n // During IME composition End/Home commit the composition; leave\n // that to the browser.\n if (!view || view.composing) return false;\n // `view.root` is the editable's Document or ShadowRoot, so the\n // selection resolves correctly in both mount modes. ShadowRoot's\n // getSelection is Chromium-only; elsewhere fall back to the owner\n // document (Chromium is also the only engine with the bug).\n const selection =\n typeof view.root?.getSelection === \"function\"\n ? view.root.getSelection()\n : (view.dom?.ownerDocument?.getSelection?.() ?? null);\n // `modify` is non-standard; without it, or with a selection that\n // is not ours, native handling is the safer default.\n if (!selection || typeof selection.modify !== \"function\") return false;\n if (!selection.anchorNode || !view.dom.contains(selection.anchorNode)) {\n return false;\n }\n selection.modify(\"move\", direction, \"lineboundary\");\n return true;\n };\n\n return {\n End: moveToLineBoundary(\"forward\"),\n Home: moveToLineBoundary(\"backward\"),\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\nexport interface LineHeightOptions {\n types: string[];\n defaultLineHeight: string;\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n lineHeight: {\n setLineHeight: (lineHeight: string) => ReturnType;\n unsetLineHeight: () => ReturnType;\n };\n }\n}\n\nexport const LineHeight = Extension.create<LineHeightOptions>({\n name: \"lineHeight\",\n\n addOptions() {\n return {\n types: [\"paragraph\"],\n defaultLineHeight: \"1.5\",\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) => element.style.lineHeight || null,\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setLineHeight:\n (lineHeight: string) =>\n ({ commands }) => {\n return this.options.types.every((type) =>\n commands.updateAttributes(type, { lineHeight }),\n );\n },\n unsetLineHeight:\n () =>\n ({ commands }) => {\n return this.options.types.every((type) =>\n commands.resetAttributes(type, \"lineHeight\"),\n );\n },\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport {\n getLogicMergeTagKeyword,\n isLogicMergeTagValue,\n} from \"@templatical/types\";\nimport type { Editor } from \"@tiptap/core\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n value: string;\n keyword: string;\n };\n };\n editor: Editor;\n getPos: () => number;\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst { syntax } = useMergeTag();\nconst { t } = useI18n();\n\nconst isValid = computed(() =>\n isLogicMergeTagValue(props.node.attrs.value, syntax),\n);\nconst displayKeyword = computed(() =>\n getLogicMergeTagKeyword(props.node.attrs.value, syntax),\n);\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\nlet handled = false;\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n handled = false;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\nfunction finishEditing(): void {\n if (handled) {\n return;\n }\n handled = true;\n\n const newValue = editValue.value.trim();\n if (!newValue) {\n isEditing.value = false;\n return;\n }\n\n if (newValue !== props.node.attrs.value) {\n props.updateAttributes({\n value: newValue,\n keyword: isLogicMergeTagValue(newValue, syntax)\n ? getLogicMergeTagKeyword(newValue, syntax)\n : \"\",\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n :class=\"\n isValid\n ? 'tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none'\n : ''\n \"\n :style=\"\n isValid\n ? 'background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);'\n : ''\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n class=\"tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode: valid merge tag -->\n <span\n v-else-if=\"isValid\"\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n class=\"tpl-tooltip tpl:cursor-pointer\"\n :data-tooltip=\"node.attrs.value\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ displayKeyword }}\n </span>\n <!-- Display mode: invalid (plain text) -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ node.attrs.value }}\n </span>\n <button\n v-if=\"isValid\"\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport {\n getLogicMergeTagKeyword,\n isLogicMergeTagValue,\n} from \"@templatical/types\";\nimport type { Editor } from \"@tiptap/core\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n value: string;\n keyword: string;\n };\n };\n editor: Editor;\n getPos: () => number;\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst { syntax } = useMergeTag();\nconst { t } = useI18n();\n\nconst isValid = computed(() =>\n isLogicMergeTagValue(props.node.attrs.value, syntax),\n);\nconst displayKeyword = computed(() =>\n getLogicMergeTagKeyword(props.node.attrs.value, syntax),\n);\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\nlet handled = false;\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n handled = false;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\nfunction finishEditing(): void {\n if (handled) {\n return;\n }\n handled = true;\n\n const newValue = editValue.value.trim();\n if (!newValue) {\n isEditing.value = false;\n return;\n }\n\n if (newValue !== props.node.attrs.value) {\n props.updateAttributes({\n value: newValue,\n keyword: isLogicMergeTagValue(newValue, syntax)\n ? getLogicMergeTagKeyword(newValue, syntax)\n : \"\",\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n :class=\"\n isValid\n ? 'tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none'\n : ''\n \"\n :style=\"\n isValid\n ? 'background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);'\n : ''\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n class=\"tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode: valid merge tag -->\n <span\n v-else-if=\"isValid\"\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n class=\"tpl-tooltip tpl:cursor-pointer\"\n :data-tooltip=\"node.attrs.value\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ displayKeyword }}\n </span>\n <!-- Display mode: invalid (plain text) -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"t.mergeTag.editValue\"\n @click.stop=\"startEditing\"\n @keydown.enter.stop=\"startEditing\"\n @keydown.space.prevent.stop=\"startEditing\"\n >\n {{ node.attrs.value }}\n </span>\n <button\n v-if=\"isValid\"\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","import type { Editor } from \"@tiptap/core\";\n\n/**\n * Decides whether MergeTagNode / LogicMergeTagNode should swallow a\n * Backspace/Delete keystroke (returning `true` from a TipTap keymap\n * suppresses the default behavior).\n *\n * Only suppresses in the cursor-adjacent case so the \"first press\n * selects the atom, second press deletes it\" UX works. Range selections\n * (Cmd+A, drag-select, double-click-word) explicitly fall through —\n * default `replaceSelection` then deletes the entire range including\n * any merge-tag atoms inside it.\n *\n * Earlier revisions also returned `true` whenever `nodesBetween($from,\n * $to)` found a merge tag anywhere in the selection range — which\n * silently broke Cmd+A + Backspace for any paragraph containing a\n * merge tag (entire deletion was cancelled, nothing happened). The\n * cursor-adjacent protection is the only piece that should survive.\n */\nexport function isNodeSelected(editor: Editor, nodeTypeName: string): boolean {\n const { $from, $to } = editor.state.selection;\n\n // Range selection: let TipTap's default range-delete run. Even when\n // the range contains atom nodes, ProseMirror's replaceSelection\n // handles atomic deletion correctly.\n if ($from.pos !== $to.pos) return false;\n\n // Cursor-adjacent atom: protect from single-keystroke deletion.\n // (`$from.pos > 0` guards against reading `nodeBefore` at doc start\n // where ProseMirror's index would be undefined for nodeBefore.)\n if ($from.pos > 0 && $from.nodeBefore?.type.name === nodeTypeName) {\n return true;\n }\n if ($from.nodeAfter?.type.name === nodeTypeName) {\n return true;\n }\n\n return false;\n}\n","import type { Component } from \"vue\";\nimport { VueNodeViewRenderer } from \"@tiptap/vue-3\";\n\n/**\n * Typed wrapper for VueNodeViewRenderer that handles the known type mismatch\n * between Vue SFC default exports and TipTap's expected component type.\n */\nexport function renderVueNodeView(component: Component) {\n return VueNodeViewRenderer(\n component as Parameters<typeof VueNodeViewRenderer>[0],\n );\n}\n","import LogicMergeTagNodeView from \"./LogicMergeTagNodeView.vue\";\nimport type { SyntaxPreset } from \"@templatical/types\";\nimport {\n getLogicMergeTagKeyword,\n isLogicMergeTagValue,\n SYNTAX_PRESETS,\n} from \"@templatical/types\";\nimport { InputRule, mergeAttributes, Node, PasteRule } from \"@tiptap/core\";\nimport { isNodeSelected } from \"./isNodeSelected\";\nimport { renderVueNodeView } from \"./renderVueNodeView\";\n\nexport interface LogicMergeTagNodeOptions {\n syntax: SyntaxPreset;\n}\n\nexport const LogicMergeTagNode = Node.create<LogicMergeTagNodeOptions>({\n name: \"logicMergeTagNode\",\n\n group: \"inline\",\n\n inline: true,\n\n atom: true,\n\n addOptions() {\n return {\n syntax: SYNTAX_PRESETS.liquid,\n };\n },\n\n addAttributes() {\n return {\n // Both attributes are state, not markup, same as `MergeTagNode`:\n // `renderHTML()` emits the canonical `data-logic-merge-tag` /\n // `data-keyword` pair and `parseHTML` reads only those. `rendered: false`\n // keeps TipTap from also serializing each attribute under its own name,\n // which would put a write-only duplicate of the same data on every tag.\n value: {\n default: \"\",\n rendered: false,\n parseHTML: (element) =>\n element.getAttribute(\"data-logic-merge-tag\") || \"\",\n },\n keyword: {\n default: \"\",\n rendered: false,\n parseHTML: (element) =>\n element.getAttribute(\"data-keyword\") || element.textContent || \"\",\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span[data-logic-merge-tag]\",\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n if (!isLogicMergeTagValue(node.attrs.value, this.options.syntax)) {\n return [\"span\", {}, node.attrs.value];\n }\n\n const keyword = getLogicMergeTagKeyword(\n node.attrs.value,\n this.options.syntax,\n );\n\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-logic-merge-tag\": node.attrs.value,\n \"data-keyword\": keyword,\n }),\n keyword,\n ];\n },\n\n addNodeView() {\n return renderVueNodeView(LogicMergeTagNodeView);\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => isNodeSelected(this.editor, this.name),\n Delete: () => isNodeSelected(this.editor, this.name),\n };\n },\n\n addInputRules() {\n const inputRegex = new RegExp(this.options.syntax.logic.source + \"$\", \"\");\n\n return [\n new InputRule({\n find: inputRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n if (!isLogicMergeTagValue(fullValue, this.options.syntax)) {\n return;\n }\n\n const keyword = getLogicMergeTagKeyword(\n fullValue,\n this.options.syntax,\n );\n\n const node = this.type.create({\n value: fullValue,\n keyword,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n\n addPasteRules() {\n const pasteRegex = new RegExp(this.options.syntax.logic.source, \"g\");\n\n return [\n new PasteRule({\n find: pasteRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n if (!isLogicMergeTagValue(fullValue, this.options.syntax)) {\n return;\n }\n\n const keyword = getLogicMergeTagKeyword(\n fullValue,\n this.options.syntax,\n );\n\n const node = this.type.create({\n value: fullValue,\n keyword,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n});\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, onScopeDispose, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n label: string;\n value: string;\n };\n };\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst {\n getMergeTagLabel,\n getMergeTagDisplayLabel,\n findMergeTag,\n canRepickMergeTag,\n showRawValue,\n isMergeTagValue,\n requestMergeTag,\n} = useMergeTag();\nconst { t, format } = useI18n();\n\n// `node.attrs.label` is the label captured when the tag was inserted. It is\n// only ever a fallback — the configured tags win, which is what keeps a\n// relabelled tag from rendering its stale stored copy.\nconst displayLabel = computed(() =>\n getMergeTagDisplayLabel(props.node.attrs.value, props.node.attrs.label),\n);\nconst canRepick = computed(() => canRepickMergeTag(props.node.attrs.value));\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\n\n// The chooser mounts in the popover root, outside this node view, so the node\n// can be torn down while it is open — a collaborator edit, a block change, the\n// editor unmounting. Writing attributes onto a destroyed node view throws.\nlet disposed = false;\nonScopeDispose(() => {\n disposed = true;\n});\n\n/** Whether the text currently in the raw input is a usable merge tag. */\nconst isEditValueValid = computed(\n () =>\n editValue.value.trim() === \"\" || isMergeTagValue(editValue.value.trim()),\n);\n\n/**\n * Swap this tag for another one, chosen through the same chooser insertion\n * uses. `requestMergeTag` sets the editor-wide requesting flag for the whole\n * await, which is what stops `useRichTextEditor`'s click-outside handler\n * finishing the block when the user clicks a row in the chooser — that would\n * dispose this node view and silently drop the update.\n */\nasync function repick(): Promise<void> {\n const replacement = await requestMergeTag({\n reason: \"edit\",\n current: findMergeTag(props.node.attrs.value),\n });\n if (disposed || !replacement) return;\n props.updateAttributes({\n value: replacement.value,\n label: replacement.label,\n });\n}\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\n/**\n * Activating the chip opens the chooser when one can resolve this token, and\n * the raw input only when none can. Editing a token as free text is how a\n * chip ends up holding something that is not a merge tag at all, which the\n * renderer then emits verbatim into the sent email.\n */\nfunction activate(): void {\n if (canRepick.value) {\n void repick();\n return;\n }\n startEditing();\n}\n\nfunction finishEditing(): void {\n const newValue = editValue.value.trim();\n // Never commit something that isn't a merge tag: `renderHTML` writes the\n // value straight into `data-merge-tag`, and the renderer drops that into the\n // MJML unchanged, so a typo would ship as literal text in the email.\n if (\n newValue &&\n newValue !== props.node.attrs.value &&\n isMergeTagValue(newValue)\n ) {\n props.updateAttributes({\n // The honest resolution, not the display chain: this is written into the\n // document as `data-label`, so a placeholder would be persisted as if it\n // were the tag's name.\n value: newValue,\n label: getMergeTagLabel(newValue),\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n // Enter on an invalid value keeps the input open rather than discarding\n // what was typed — the border and `aria-invalid` already say why.\n if (!isEditValueValid.value) return;\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n class=\"tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]\"\n style=\"\n background-color: color-mix(in srgb, var(--tpl-primary) 20%, transparent);\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n :aria-invalid=\"isEditValueValid ? undefined : 'true'\"\n class=\"tpl:w-32 tpl:rounded tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n :class=\"\n isEditValueValid\n ? 'tpl:border-none'\n : 'tpl:border tpl:border-[var(--tpl-danger)]'\n \"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"\n canRepick\n ? format(t.mergeTag.changeTag, { label: displayLabel })\n : t.mergeTag.editValue\n \"\n class=\"tpl:cursor-pointer\"\n :class=\"showRawValue ? 'tpl-tooltip' : ''\"\n :data-tooltip=\"showRawValue ? node.attrs.value : undefined\"\n @click.stop=\"activate\"\n @keydown.enter.stop=\"activate\"\n @keydown.space.prevent.stop=\"activate\"\n >\n {{ displayLabel }}\n </span>\n <button\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../composables/useI18n\";\nimport { useMergeTag } from \"../composables/useMergeTag\";\nimport { NodeViewWrapper } from \"@tiptap/vue-3\";\nimport { computed, nextTick, onScopeDispose, ref } from \"vue\";\n\nconst props = defineProps<{\n node: {\n attrs: {\n label: string;\n value: string;\n };\n };\n deleteNode: () => void;\n updateAttributes: (attrs: Record<string, unknown>) => void;\n}>();\n\nconst {\n getMergeTagLabel,\n getMergeTagDisplayLabel,\n findMergeTag,\n canRepickMergeTag,\n showRawValue,\n isMergeTagValue,\n requestMergeTag,\n} = useMergeTag();\nconst { t, format } = useI18n();\n\n// `node.attrs.label` is the label captured when the tag was inserted. It is\n// only ever a fallback — the configured tags win, which is what keeps a\n// relabelled tag from rendering its stale stored copy.\nconst displayLabel = computed(() =>\n getMergeTagDisplayLabel(props.node.attrs.value, props.node.attrs.label),\n);\nconst canRepick = computed(() => canRepickMergeTag(props.node.attrs.value));\n\nconst isEditing = ref(false);\nconst editValue = ref(\"\");\nconst inputRef = ref<HTMLInputElement | null>(null);\n\n// The chooser mounts in the popover root, outside this node view, so the node\n// can be torn down while it is open — a collaborator edit, a block change, the\n// editor unmounting. Writing attributes onto a destroyed node view throws.\nlet disposed = false;\nonScopeDispose(() => {\n disposed = true;\n});\n\n/** Whether the text currently in the raw input is a usable merge tag. */\nconst isEditValueValid = computed(\n () =>\n editValue.value.trim() === \"\" || isMergeTagValue(editValue.value.trim()),\n);\n\n/**\n * Swap this tag for another one, chosen through the same chooser insertion\n * uses. `requestMergeTag` sets the editor-wide requesting flag for the whole\n * await, which is what stops `useRichTextEditor`'s click-outside handler\n * finishing the block when the user clicks a row in the chooser — that would\n * dispose this node view and silently drop the update.\n */\nasync function repick(): Promise<void> {\n const replacement = await requestMergeTag({\n reason: \"edit\",\n current: findMergeTag(props.node.attrs.value),\n });\n if (disposed || !replacement) return;\n props.updateAttributes({\n value: replacement.value,\n label: replacement.label,\n });\n}\n\nfunction startEditing(): void {\n editValue.value = props.node.attrs.value;\n isEditing.value = true;\n nextTick(() => {\n inputRef.value?.focus();\n inputRef.value?.select();\n });\n}\n\n/**\n * Activating the chip opens the chooser when one can resolve this token, and\n * the raw input only when none can. Editing a token as free text is how a\n * chip ends up holding something that is not a merge tag at all, which the\n * renderer then emits verbatim into the sent email.\n */\nfunction activate(): void {\n if (canRepick.value) {\n void repick();\n return;\n }\n startEditing();\n}\n\nfunction finishEditing(): void {\n const newValue = editValue.value.trim();\n // Never commit something that isn't a merge tag: `renderHTML` writes the\n // value straight into `data-merge-tag`, and the renderer drops that into the\n // MJML unchanged, so a typo would ship as literal text in the email.\n if (\n newValue &&\n newValue !== props.node.attrs.value &&\n isMergeTagValue(newValue)\n ) {\n props.updateAttributes({\n // The honest resolution, not the display chain: this is written into the\n // document as `data-label`, so a placeholder would be persisted as if it\n // were the tag's name.\n value: newValue,\n label: getMergeTagLabel(newValue),\n });\n }\n isEditing.value = false;\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\") {\n event.preventDefault();\n // Enter on an invalid value keeps the input open rather than discarding\n // what was typed — the border and `aria-invalid` already say why.\n if (!isEditValueValid.value) return;\n finishEditing();\n } else if (event.key === \"Escape\") {\n isEditing.value = false;\n }\n}\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"span\"\n class=\"tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]\"\n style=\"\n background-color: color-mix(in srgb, var(--tpl-primary) 20%, transparent);\n \"\n contenteditable=\"false\"\n >\n <!-- Edit mode -->\n <input\n v-if=\"isEditing\"\n ref=\"inputRef\"\n v-model=\"editValue\"\n type=\"text\"\n :aria-invalid=\"isEditValueValid ? undefined : 'true'\"\n class=\"tpl:w-32 tpl:rounded tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]\"\n :class=\"\n isEditValueValid\n ? 'tpl:border-none'\n : 'tpl:border tpl:border-[var(--tpl-danger)]'\n \"\n @blur=\"finishEditing\"\n @keydown=\"handleKeydown\"\n />\n <!-- Display mode -->\n <span\n v-else\n role=\"button\"\n tabindex=\"0\"\n :aria-label=\"\n canRepick\n ? format(t.mergeTag.changeTag, { label: displayLabel })\n : t.mergeTag.editValue\n \"\n class=\"tpl:cursor-pointer\"\n :class=\"showRawValue ? 'tpl-tooltip' : ''\"\n :data-tooltip=\"showRawValue ? node.attrs.value : undefined\"\n @click.stop=\"activate\"\n @keydown.enter.stop=\"activate\"\n @keydown.space.prevent.stop=\"activate\"\n >\n {{ displayLabel }}\n </span>\n <button\n type=\"button\"\n :aria-label=\"t.mergeTag.deleteMergeTag\"\n class=\"tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all tpl:hover:opacity-100 tpl:text-[var(--tpl-primary)]\"\n contenteditable=\"false\"\n @click.stop.prevent=\"deleteNode\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </NodeViewWrapper>\n</template>\n","import MergeTagNodeView from \"./MergeTagNodeView.vue\";\nimport type { MergeTag, SyntaxPreset } from \"@templatical/types\";\nimport { getMergeTagLabel, SYNTAX_PRESETS } from \"@templatical/types\";\nimport { InputRule, mergeAttributes, Node, PasteRule } from \"@tiptap/core\";\nimport { isNodeSelected } from \"./isNodeSelected\";\nimport { renderVueNodeView } from \"./renderVueNodeView\";\n\nexport interface MergeTagNodeOptions {\n /**\n * Read live, not captured. `renderHTML` and the input/paste rules resolve a\n * label every time they run, and `editor.setMergeTags` can replace the list\n * while a block is open for editing.\n */\n mergeTags: () => MergeTag[];\n syntax: SyntaxPreset;\n}\n\n/**\n * Inserted-node attrs are intentionally limited to `label` + `value`. The\n * `MergeTag` interface also carries optional `group` / `description` for\n * the built-in picker, but those are display-only and must NOT leak into\n * the document JSON — they would bloat templates and pollute serialized\n * state. `Pick<>` makes the constraint explicit at the type level.\n */\nexport type InsertMergeTagAttrs = Pick<MergeTag, \"label\" | \"value\">;\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n mergeTagNode: {\n insertMergeTag: (attrs: InsertMergeTagAttrs) => ReturnType;\n };\n }\n}\n\nexport const MergeTagNode = Node.create<MergeTagNodeOptions>({\n name: \"mergeTagNode\",\n\n group: \"inline\",\n\n inline: true,\n\n atom: true,\n\n addOptions() {\n return {\n mergeTags: () => [],\n syntax: SYNTAX_PRESETS.liquid,\n };\n },\n\n addAttributes() {\n return {\n // Both attributes are state, not markup: `renderHTML()` below emits the\n // canonical `data-merge-tag` / `data-label` pair and `parseHTML` reads\n // only those. `rendered: false` keeps TipTap from also serializing each\n // attribute under its own name, which would put a write-only duplicate\n // of the same data on every tag — invalid on a `<span>`, and paid again\n // through storage, autosave, snapshots and version history.\n label: {\n default: \"\",\n rendered: false,\n parseHTML: (element) =>\n element.getAttribute(\"data-label\") || element.textContent || \"\",\n },\n value: {\n default: \"\",\n rendered: false,\n parseHTML: (element) => element.getAttribute(\"data-merge-tag\") || \"\",\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span[data-merge-tag]\",\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const label = getMergeTagLabel(node.attrs.value, this.options.mergeTags());\n\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-merge-tag\": node.attrs.value,\n \"data-label\": label,\n }),\n label,\n ];\n },\n\n addNodeView() {\n return renderVueNodeView(MergeTagNodeView);\n },\n\n addCommands() {\n return {\n insertMergeTag:\n (attrs: InsertMergeTagAttrs) =>\n ({ commands }) => {\n // Whitelist explicitly — even if a caller smuggles extra keys via\n // a wider type assertion, only label/value reach the node attrs.\n return commands.insertContent({\n type: this.name,\n attrs: { label: attrs.label, value: attrs.value },\n });\n },\n };\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => isNodeSelected(this.editor, this.name),\n Delete: () => isNodeSelected(this.editor, this.name),\n };\n },\n\n addInputRules() {\n const inputRegex = new RegExp(this.options.syntax.value.source + \"$\", \"\");\n\n return [\n new InputRule({\n find: inputRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n const label = getMergeTagLabel(fullValue, this.options.mergeTags());\n\n const node = this.type.create({\n label,\n value: fullValue,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n\n addPasteRules() {\n const pasteRegex = new RegExp(this.options.syntax.value.source, \"g\");\n\n return [\n new PasteRule({\n find: pasteRegex,\n handler: ({ state, range, match }) => {\n const fullValue = match[0];\n const label = getMergeTagLabel(fullValue, this.options.mergeTags());\n\n const node = this.type.create({\n label,\n value: fullValue,\n });\n\n state.tr.replaceWith(range.from, range.to, node);\n },\n }),\n ];\n },\n});\n","import type { MergeTag } from \"@templatical/types\";\nimport { Extension } from \"@tiptap/core\";\nimport Suggestion, {\n type SuggestionOptions,\n type SuggestionProps,\n type SuggestionKeyDownProps,\n} from \"@tiptap/suggestion\";\nimport type { Ref } from \"vue\";\nimport { createMergeTagPopup, filterMergeTags } from \"../utils/mergeTagPopup\";\n\nexport interface MergeTagSuggestionOptions {\n /** Available merge tags */\n /**\n * Read live, not captured: the list can be replaced while a block is being\n * edited (`editor.setMergeTags`), and a snapshot taken when the extension\n * was configured would keep suggesting the old tags.\n */\n mergeTags: () => MergeTag[];\n /** Trigger string (e.g. \"{{\", \"*|\", \"%%=\") */\n char: string;\n /** Localized empty-state label */\n emptyText: string;\n /**\n * Mount target for the suggestion popup. When provided with a non-null\n * `.value`, the popup attaches into that element instead of\n * `document.body` — keeping it inside the editor's effective DOM root\n * (shadow-aware). Pass the ref returned by `usePopoverRoot()`.\n *\n * Falls back to `document.body` when omitted or when the ref's value is\n * null at popup-open time (e.g. headless/test editors without an editor\n * shell). Preserves pre-Phase-3 behavior for callers that don't migrate.\n */\n popoverRoot?: Ref<HTMLElement | null> | null;\n}\n\n/**\n * Builds the `@tiptap/suggestion` `render` factory for the merge-tag popup.\n * A thin adapter over {@link createMergeTagPopup}: it maps ProseMirror's\n * `SuggestionProps` (items, `clientRect`, `view.dom`, `command`) onto the\n * controller. Exported as a standalone function so that mapping can be\n * unit-tested with mocked `SuggestionProps` instead of a full editor.\n */\nexport function createMergeTagSuggestionRenderer(\n emptyText: string,\n popoverRootRef?: Ref<HTMLElement | null> | null,\n): NonNullable<SuggestionOptions<MergeTag>[\"render\"]> {\n return () => {\n const popup = createMergeTagPopup(emptyText, popoverRootRef);\n\n return {\n onStart: (props: SuggestionProps<MergeTag>) => {\n // Use view.dom (ProseMirror contenteditable, actually\n // attached to the DOM) rather than options.element, which may\n // be a detached div when no `element` is passed to the editor\n // constructor (as is the case with @tiptap/vue-3 EditorContent).\n const viewDom = props.editor.view?.dom as HTMLElement | undefined;\n popup.open({\n items: props.items,\n getRect: props.clientRect ?? null,\n anchorEl: viewDom ?? null,\n onCommand: (item) => props.command(item),\n });\n },\n onUpdate: (props: SuggestionProps<MergeTag>) => {\n popup.update({\n items: props.items,\n getRect: props.clientRect ?? null,\n onCommand: (item) => props.command(item),\n });\n },\n onKeyDown: (props: SuggestionKeyDownProps): boolean => {\n // Escape closes via TipTap's suggestion plugin (→ onExit); report it\n // handled without selecting.\n if (props.event.key === \"Escape\") {\n return true;\n }\n return popup.handleKeyDown(props.event);\n },\n onExit: () => popup.close(),\n };\n };\n}\n\nexport const MergeTagSuggestion = Extension.create<MergeTagSuggestionOptions>({\n name: \"mergeTagSuggestion\",\n\n addOptions() {\n return {\n mergeTags: () => [],\n char: \"{{\",\n emptyText: \"No matching merge tags\",\n popoverRoot: null,\n };\n },\n\n addProseMirrorPlugins() {\n const getMergeTags = this.options.mergeTags;\n const emptyText = this.options.emptyText;\n const popoverRootRef = this.options.popoverRoot;\n\n const config: Omit<SuggestionOptions<MergeTag>, \"editor\"> = {\n char: this.options.char,\n allowSpaces: false,\n startOfLine: false,\n // Default is [\" \"] which requires whitespace/line-start before the\n // trigger char — so `.{{` would not fire. Allow any preceding char.\n allowedPrefixes: null,\n items: ({ query }: { query: string }) =>\n filterMergeTags(getMergeTags(), query),\n command: ({\n editor,\n range,\n props,\n }: {\n editor: SuggestionProps<MergeTag>[\"editor\"];\n range: { from: number; to: number };\n props: MergeTag;\n }) => {\n if (!editor.isEditable) return;\n // Use insertContentAt for atomic replace (matches the canonical\n // @tiptap/suggestion + Mention pattern). Avoids edge cases where\n // chained deleteRange + insertMergeTag fails to insert when the\n // selection state shifts mid-chain.\n editor\n .chain()\n .focus()\n .insertContentAt(range, {\n type: \"mergeTagNode\",\n attrs: { label: props.label, value: props.value },\n })\n .run();\n },\n render: createMergeTagSuggestionRenderer(emptyText, popoverRootRef),\n };\n\n return [\n Suggestion({\n editor: this.editor,\n ...config,\n }),\n ];\n },\n});\n"],"mappings":";;;;;;;AAeA,IAAasE,IAAWT,EAAU,OAAwB;CACxD,MAAM;CAEN,aAAa;EACX,OAAO,EACL,OAAO,CAAC,WAAW,EACrB;CACF;CAEA,sBAAsB;EACpB,OAAO,CACL;GACE,OAAO,KAAK,QAAQ;GACpB,YAAY,EACV,UAAU;IACR,SAAS;IACT,YAAY,MACVU,EAAQ,M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;CACF;CAEA,wBAAwB;EACtB,IAAMyF,IAAe,KAAK,QAAQ,WAC5BJ,IAAY,KAAK,QAAQ,WACzBC,IAAiB,KAAK,QAAQ,aAE9BI,IAAsD;GAC1D,MAAM,KAAK,QAAQ;GACnB,aAAa;GACb,aAAa;GAGb,iBAAiB;GACjB,QAAQ,EAAE,eACRnF,EAAgBkF,EAAa,GAAGE,CAAK;GACvC,UAAU,EACR,WACA,UACA,eAKI;IACJ,AAAKxE,EAAO,cAKZA,EACG,MAAM,CAAC,CACP,MAAM,CAAC,CACP,gBAAgByC,GAAO;KACtB,MAAM;KACN,OAAO;MAAE,OAAO/B,EAAM;MAAO,OAAOA,EAAM;KAAM;IAClD,CAAC,CAAC,CACD,IAAI;GACT;GACA,QAAQsD,EAAiCE,GAAWC,CAAc;EACpE;EAEA,OAAO,CACLlH,EAAW;GACT,QAAQ,KAAK;GACb,GAAGsH;EACL,CAAC,CACH;CACF;AACF,CAAC"}
|
package/dist/cdn/chunks/{normalizeMergeTagMarkup-cC32Ox6A.js → normalizeMergeTagMarkup-Bn_hl4jd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as e, Jt as t, Mt as n, Xt as r, a as i, en as a, i as o, jt as s, m as c, r as l } from "./src-
|
|
1
|
+
import { $t as e, Jt as t, Mt as n, Xt as r, a as i, en as a, i as o, jt as s, m as c, r as l } from "./src-ZFw5fg_z.js";
|
|
2
2
|
// src/utils/normalizeMergeTagMarkup.ts
|
|
3
3
|
function u(e) {
|
|
4
4
|
let t = e.flags.includes("g") ? e.flags : `${e.flags}g`;
|
|
@@ -287,4 +287,4 @@ function w(i, o, l) {
|
|
|
287
287
|
}
|
|
288
288
|
export { b as a, w as i, _ as n, x as o, p as r, v as t };
|
|
289
289
|
|
|
290
|
-
//# sourceMappingURL=normalizeMergeTagMarkup-
|
|
290
|
+
//# sourceMappingURL=normalizeMergeTagMarkup-Bn_hl4jd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeMergeTagMarkup-cC32Ox6A.js","names":["deepEqual","readPath","applyOperations","sourceHash","getMergeTagLabel","safeClone","getLogicMergeTagKeyword","OperationError","resolveSyntax","containsMergeTag","globalRegex","flags","pattern","collectHits","hits","scan","regex","match","text","start","end","hit","label","syntax","value","mergeTags","a","b","collectNormalizableTextNodes","walker","doc","node","el","nodes","current","normalizeMergeTagsInHtml","html","replacements","fragment","cursor","span","normalizeLocaleText","blockType","entry","normalizeBlock","l10n","block","changed","next","locale","layer","children","column","columnChanged","normalized","child","content","before","after","restamped","normalizeMergeTagMarkup","blocks","normalizeContentForConfig","copyIncomingContent","normalizeBlockForConfig","withNormalizedContentWrites","editor","markDirty","withNormalizedTemplateLoads","provider","template","id","blockTypeOf","found","collectBlockTypes","into","nested","normalizeRemoteOperations","tags","added","needsLocaleState","ops","op","original","normalizedState","advance","state","_expect","unguarded","error","index","blockIn","find","restamp","entries","result","path","oldEntry","newEntry","oldBase","newBase","hash","normalizeOne","type","expectText","expect","normalizeField","fields","set","nextOriginal","nextNormalized"],"sources":["../../../src/utils/normalizeMergeTagMarkup.ts"],"sourcesContent":["import type { Ref } from \"vue\";\nimport type {\n Block,\n MergeTag,\n LocalizedText,\n MergeTagsConfig,\n Operation,\n SectionBlock,\n SyntaxPreset,\n TemplateContent,\n TemplatesProvider,\n WrapperBlock,\n} from \"@templatical/types\";\nimport {\n sourceHash,\n readPath,\n deepEqual,\n applyOperations,\n containsMergeTag,\n getLogicMergeTagKeyword,\n getMergeTagLabel,\n OperationError,\n resolveSyntax,\n safeClone,\n} from \"@templatical/types\";\n\n/**\n * Convert bare merge-tag tokens in rich-text HTML into the `<span\n * data-merge-tag>` nodes the editor understands.\n *\n * A tag reaches stored content in one of two physical shapes. Anything a user\n * types or pastes is already a node, because `MergeTagNode`'s input and paste\n * rules convert it on the spot. What stays a bare token is content that never\n * passed through that pipeline — `init({ content })`, `setContent()`, a\n * template loaded from a store, or one produced by the `@templatical/import-*`\n * converters. A bare token renders as literal text: no label, no highlight, no\n * `sample` substitution, and it cannot be selected or deleted as a unit.\n *\n * Three properties of this implementation are load-bearing:\n *\n * 1. **It walks text nodes, never markup.** A token in attribute position —\n * `<a href=\"{{unsubscribe_url}}\">` is the common one — must be left exactly\n * as it is; wrapping it injects an element into an attribute value and\n * corrupts the document. A `TreeWalker` over text nodes cannot reach an\n * attribute at all, so this holds by construction rather than by guard.\n * A regex cannot do this job. Guarding with a `(?<!data-merge-tag=\")`\n * lookbehind protects the attribute of an already-converted span and\n * nothing else, so `<a href=\"{{unsubscribe_url}}\">` becomes an anchor whose\n * href contains a `<span>`. Telling text position from attribute position\n * needs parsing; no amount of lookbehind substitutes for it.\n *\n * 2. **It is idempotent structurally.** The walk rejects the whole subtree of\n * any element already carrying `data-merge-tag` / `data-logic-merge-tag`,\n * so an existing span's inner text is unreachable no matter what it says.\n * That covers the case where a tag's label *is* its value.\n *\n * 3. **It never builds markup by concatenation.** A consumer may configure a\n * syntax whose delimiters contain `<` / `>` — Smarty-style `<% $email %>` —\n * so a template string would emit an attribute no scanner could re-read.\n * Spans are created as elements and filled via `setAttribute` /\n * `textContent`, which leaves escaping to the serializer.\n *\n * Matching is driven by `syntax`, not by the declared tag list, so a template\n * migrated from another ESP has all of its tags made atomic rather than only\n * the handful the consumer has declared so far. An undeclared token falls back\n * to showing its raw value as the label, which `getMergeTagLabel` already does.\n * This mirrors typing: the input and paste rules are registered unconditionally\n * and match on syntax alone.\n */\n\ninterface TagHit {\n start: number;\n end: number;\n attr: string;\n value: string;\n label: string;\n}\n\nfunction globalRegex(pattern: RegExp): RegExp {\n const flags = pattern.flags.includes(\"g\")\n ? pattern.flags\n : `${pattern.flags}g`;\n return new RegExp(pattern.source, flags);\n}\n\nfunction collectHits(\n text: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TagHit[] {\n const hits: TagHit[] = [];\n\n const scan = (\n pattern: RegExp,\n attr: string,\n label: (match: string) => string,\n ): void => {\n const regex = globalRegex(pattern);\n let match = regex.exec(text);\n while (match !== null) {\n const start = match.index;\n const end = start + match[0].length;\n // A zero-length match would spin `exec` forever on the same index.\n if (match[0].length === 0) {\n regex.lastIndex++;\n } else if (!hits.some((hit) => start < hit.end && end > hit.start)) {\n hits.push({\n start,\n end,\n attr,\n value: match[0],\n label: label(match[0]),\n });\n }\n match = regex.exec(text);\n }\n };\n\n // Logic first, so it wins any overlap. Some syntaxes' value regex is liberal\n // enough to also match a logic tag — handlebars' `{{.+?}}` swallows\n // `{{#each items}}` — and `isMergeTagValue` resolves that same way.\n scan(syntax.logic, \"data-logic-merge-tag\", (value) =>\n getLogicMergeTagKeyword(value, syntax),\n );\n scan(syntax.value, \"data-merge-tag\", (value) =>\n getMergeTagLabel(value, mergeTags),\n );\n\n return hits.sort((a, b) => a.start - b.start);\n}\n\n/** Text nodes not already inside a merge-tag span, in document order. */\nfunction collectNormalizableTextNodes(doc: Document): Text[] {\n const walker = doc.createTreeWalker(\n doc.body,\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,\n {\n acceptNode(node: Node): number {\n if (node.nodeType !== 1) return NodeFilter.FILTER_ACCEPT;\n const el = node as Element;\n // REJECT (not SKIP) prunes the subtree, which is what makes a second\n // pass unable to see an existing span's inner text.\n return el.hasAttribute(\"data-merge-tag\") ||\n el.hasAttribute(\"data-logic-merge-tag\")\n ? NodeFilter.FILTER_REJECT\n : NodeFilter.FILTER_SKIP;\n },\n },\n );\n\n // Collected up front: replacing a node mid-walk invalidates the walker.\n const nodes: Text[] = [];\n let current = walker.nextNode();\n while (current !== null) {\n nodes.push(current as Text);\n current = walker.nextNode();\n }\n return nodes;\n}\n\nexport function normalizeMergeTagsInHtml(\n html: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): string {\n if (!html) return html;\n // Cheap reject before paying for a parse. A token that exists only in an\n // attribute still gets past this, and is then caught by the zero-replacement\n // short-circuit below.\n if (!containsMergeTag(html, syntax)) return html;\n if (typeof DOMParser === \"undefined\") return html;\n\n const doc = new DOMParser().parseFromString(\n `<!doctype html><body>${html}</body>`,\n \"text/html\",\n );\n\n let replacements = 0;\n for (const node of collectNormalizableTextNodes(doc)) {\n const text = node.data;\n const hits = collectHits(text, mergeTags, syntax);\n if (hits.length === 0) continue;\n\n const fragment = doc.createDocumentFragment();\n let cursor = 0;\n for (const hit of hits) {\n if (hit.start > cursor) {\n fragment.appendChild(\n doc.createTextNode(text.substring(cursor, hit.start)),\n );\n }\n const span = doc.createElement(\"span\");\n span.setAttribute(hit.attr, hit.value);\n span.textContent = hit.label;\n fragment.appendChild(span);\n cursor = hit.end;\n }\n if (cursor < text.length) {\n fragment.appendChild(doc.createTextNode(text.substring(cursor)));\n }\n\n node.parentNode?.replaceChild(fragment, node);\n replacements += hits.length;\n }\n\n // Nothing matched in text position, so return the input verbatim rather than\n // a re-serialization of it — otherwise content with no tags at all would be\n // rewritten (`<br/>` → `<br>`, attribute quoting, entity encoding) for no\n // reason. Where a replacement does happen some churn is unavoidable, and the\n // renderer accepts both shapes.\n if (replacements === 0) return html;\n\n return doc.body.innerHTML;\n}\n\n/** Normalize localized rich content without changing source hashes or caller-owned objects. */\nfunction normalizeLocaleText<T extends LocalizedText | null>(\n blockType: string | undefined,\n text: Record<string, T> | undefined,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): Record<string, T> | undefined {\n if (\n (blockType !== \"title\" &&\n blockType !== \"paragraph\" &&\n blockType !== \"html\") ||\n typeof text?.content?.value !== \"string\"\n )\n return text;\n const entry = text.content;\n const value = normalizeMergeTagsInHtml(entry.value, mergeTags, syntax);\n return value === entry.value\n ? text\n : { ...text, content: { ...entry, value } };\n}\n\n/**\n * Localized layers normalize only content on titles, paragraphs and HTML\n * blocks. Among base fields, only title and paragraph rich text is normalized. Every other merge-tag-bearing field —\n * `ButtonBlock.text`/`url`, `ImageBlock.alt`, `HtmlBlock.content`, custom-block\n * `fieldValues`, `settings.preheaderText` — is a plain string rendered as text,\n * so a span written into one would be displayed literally on the canvas and\n * emitted into a `url=` attribute by the renderer.\n *\n * `TableCellData.content` is span-bearing to the renderer but is deliberately\n * excluded: `TableBlock.vue` hydrates a cell with `textContent` and writes\n * `innerText` back on blur, so the first focus-and-leave on a normalized cell\n * would persist the literal markup into stored content as text. The\n * editor/renderer asymmetry there is a separate, pre-existing gap.\n */\nfunction normalizeBlock(\n block: Block,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): Block {\n const l10n = block.l10n;\n if (l10n) {\n let changed = false;\n const next = Object.fromEntries(\n Object.entries(l10n).map(([locale, layer]) => {\n const text = normalizeLocaleText(\n block.type,\n layer.text,\n mergeTags,\n syntax,\n );\n if (text === layer.text) return [locale, layer];\n changed = true;\n return [locale, { ...layer, text }];\n }),\n );\n if (changed) block = { ...block, l10n: next };\n }\n if (block.type === \"section\") {\n if (!Array.isArray(block.children)) return block;\n let changed = false;\n const children = block.children.map((column) => {\n if (!Array.isArray(column)) return column;\n let columnChanged = false;\n const next = column.map((child) => {\n const normalized = normalizeBlock(child, mergeTags, syntax);\n if (normalized !== child) columnChanged = true;\n return normalized;\n });\n if (!columnChanged) return column;\n changed = true;\n return next;\n });\n return changed ? ({ ...block, children } as SectionBlock) : block;\n }\n\n if (block.type === \"wrapper\") {\n if (!Array.isArray(block.children)) return block;\n let changed = false;\n const children = block.children.map((child) => {\n const normalized = normalizeBlock(child, mergeTags, syntax);\n if (normalized !== child) changed = true;\n return normalized;\n });\n return changed ? ({ ...block, children } as WrapperBlock) : block;\n }\n\n if (block.type !== \"title\" && block.type !== \"paragraph\") return block;\n if (typeof block.content !== \"string\") return block;\n\n const content = normalizeMergeTagsInHtml(block.content, mergeTags, syntax);\n if (content === block.content) return block;\n const before = sourceHash(block.content);\n const after = sourceHash(content);\n const restamped =\n block.l10n &&\n Object.fromEntries(\n Object.entries(block.l10n).map(([locale, layer]) => {\n const entry = layer.text?.content;\n return [\n locale,\n entry?.sourceHash === before\n ? {\n ...layer,\n text: {\n ...layer.text,\n content: { ...entry, sourceHash: after },\n },\n }\n : layer,\n ];\n }),\n );\n return { ...block, content, ...(restamped ? { l10n: restamped } : {}) };\n}\n\n/**\n * Normalize every rich-text field in a template. Returns the input reference\n * unchanged when nothing matched, so a template with no bare tokens costs no\n * allocation and keeps its object identity; otherwise returns a copy, leaving\n * the caller's content untouched.\n *\n * Shape is checked rather than trusted at every level. `TemplateContent` types\n * `blocks` as required and `SectionBlock.children` as a `Block[][]`, but this\n * runs at the SDK's entry points on an object the consumer hands us — a partial\n * or hand-rolled template must come back untouched, not turn a working `init()`\n * into a `TypeError`.\n */\nexport function normalizeMergeTagMarkup(\n content: TemplateContent,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TemplateContent {\n if (!content || !Array.isArray(content.blocks)) return content;\n\n let changed = false;\n const blocks = content.blocks.map((block) => {\n const normalized = normalizeBlock(block, mergeTags, syntax);\n if (normalized !== block) changed = true;\n return normalized;\n });\n\n return changed ? { ...content, blocks } : content;\n}\n\n/**\n * `normalizeMergeTagMarkup` bound to the editor's own config shape, so the hook\n * sites don't each resolve tags and syntax themselves.\n *\n * An absent `mergeTags` still normalizes, under the liquid default. That is not\n * an oversight: `MergeTagNode`'s input and paste rules are registered\n * unconditionally with the same default, so a consumer who configured nothing\n * already gets a node the instant a user types `{{x}}`. Loading the same text\n * and leaving it inert would be the inconsistency.\n *\n * It always returns a copy. Every content-in path runs through here, and the\n * editor edits the object it holds in place, so holding the caller's own one\n * leaks each edit into it, and one that another Vue made reactive or that a\n * store froze hides edits from the editor's bundled Vue or throws on the first.\n */\nexport function normalizeContentForConfig(\n content: TemplateContent,\n mergeTags: MergeTagsConfig | undefined,\n): TemplateContent {\n return normalizeMergeTagMarkup(\n copyIncomingContent(content),\n mergeTags?.tags ?? [],\n resolveSyntax(mergeTags?.syntax),\n );\n}\n\n/** {@link normalizeContentForConfig} for a single block. */\nexport function normalizeBlockForConfig(\n block: Block,\n mergeTags: MergeTagsConfig | undefined,\n): Block {\n return normalizeBlock(\n block,\n mergeTags?.tags ?? [],\n resolveSyntax(mergeTags?.syntax),\n );\n}\n\n/**\n * A non-object passes through: `normalizeMergeTagMarkup` already hands back\n * whatever is not shaped like content, and `safeClone(undefined)` would throw.\n */\nfunction copyIncomingContent(content: TemplateContent): TemplateContent {\n return typeof content === \"object\" && content !== null\n ? safeClone(content)\n : content;\n}\n\n/**\n * Wrap a `TemplatesProvider` so content arriving from the store is normalized\n * before the editor ever sees it.\n *\n * Only `load` is wrapped. `save` sends content *out*, and what it sends is\n * already-normalized editor state; rewriting it here would change what the\n * store keeps for no benefit. `create` likewise carries content outward, and\n * the template it returns supplies identity and timestamps rather than the\n * content the editor goes on to edit.\n *\n * Wrapping the provider — rather than normalizing after `load()` resolves —\n * is what keeps Q4 true: core assigns already-normalized content to its state\n * and observes no mutation, so there is no dirty flag to suppress and no\n * autosave tick to swallow.\n */\n/**\n * The slice of the editor a content-restoring feature consumes. Structural on\n * purpose: it matches `useVersionHistoryFeature`'s own `VersionHistoryEditor`\n * without importing it, so this util keeps no dependency on a composable.\n */\ninterface ContentWritingEditor {\n state: {\n readonly template?: { id: string } | null;\n readonly isDirty: boolean;\n };\n content: Ref<TemplateContent>;\n setContent: (content: TemplateContent, markDirty?: boolean) => void;\n}\n\n/**\n * Wrap an editor so content written through `setContent` is normalized first.\n *\n * This is how version history is covered. Its content reaches the canvas by\n * three routes — `version.content` off a hydrated list, a `fetched` cache, and\n * `provider.get()` — so wrapping the *provider*, the way the `templates` path\n * does, would miss two of them. `setContent` is the one chokepoint they share.\n *\n * A version is not guaranteed to hold normalized content just because a save\n * produced it: a store carries whatever was written to it, and a backend may\n * version a template it imported rather than one the editor round-tripped.\n * Previewing such a version without this would put bare tokens back on a canvas\n * where every other tag is a chip.\n *\n * `markDirty` is forwarded untouched: every version-history write passes\n * `false`, and swallowing that would turn opening a preview into an unsaved\n * change. `setContent` is resolved per call rather than captured, so a\n * wrapper installed on the editor later still sees every write.\n */\nexport function withNormalizedContentWrites<T extends ContentWritingEditor>(\n editor: T,\n mergeTags: MergeTagsConfig | undefined,\n): ContentWritingEditor {\n return {\n get state() {\n return editor.state;\n },\n get content() {\n return editor.content;\n },\n setContent: (content: TemplateContent, markDirty?: boolean) =>\n editor.setContent(\n normalizeContentForConfig(content, mergeTags),\n markDirty,\n ),\n };\n}\n\nexport function withNormalizedTemplateLoads(\n provider: TemplatesProvider,\n mergeTags: MergeTagsConfig | undefined,\n): TemplatesProvider {\n return {\n ...provider,\n async load(id: string) {\n const template = await provider.load(id);\n return {\n ...template,\n content: normalizeContentForConfig(template.content, mergeTags),\n };\n },\n };\n}\n\n/**\n * The type of the block `id` names — at the top level, in a section's columns\n * or inside a wrapper — or `undefined` when no block has that id.\n */\nfunction blockTypeOf(blocks: unknown, id: string): string | undefined {\n if (!Array.isArray(blocks)) return undefined;\n for (const block of blocks as Block[]) {\n if (!block || typeof block !== \"object\") continue;\n if (block.id === id) return block.type;\n const children = (block as { children?: unknown }).children;\n if (block.type === \"section\" && Array.isArray(children)) {\n for (const column of children) {\n const found = blockTypeOf(column, id);\n if (found) return found;\n }\n } else if (block.type === \"wrapper\") {\n const found = blockTypeOf(children, id);\n if (found) return found;\n }\n }\n return undefined;\n}\n\n/** Every block id in `block`, a section's or a wrapper's children included, with its type. */\nfunction collectBlockTypes(block: Block, into: Map<string, string>): void {\n if (typeof block.id === \"string\") into.set(block.id, block.type);\n const children = (block as { children?: unknown }).children;\n if (!Array.isArray(children)) return;\n const nested =\n block.type === \"section\" ? (children as unknown[]).flat() : children;\n for (const child of nested) {\n if (child && typeof child === \"object\") {\n collectBlockTypes(child as Block, into);\n }\n }\n}\n\n/**\n * Normalize the merge tags in a batch another session made, before the editor\n * applies it — the collaboration counterpart of {@link withNormalizedTemplateLoads}.\n * An agent writes `{{first_name}}` as text and a headless write stores it bare;\n * both arrive as operations, and normalizing them on arrival turns each token\n * into a tag at once. Nothing is sent back for it: the canvas and the\n * controller's copy of the backend's content change together.\n *\n * The rich-text fields only, as for loads: an `addBlock`'s block (a section's\n * children included), an `updateBlock`'s `set.content` when the block it names\n * is a title or a paragraph, its `expect.content`, and a deletion’s `expect.block` — found in `content`, or among the blocks the batch\n * itself added — and a `setContent`'s content. Returns `ops` itself when\n * nothing matched, and never changes it.\n */\nexport function normalizeRemoteOperations(\n ops: readonly Operation[],\n content: TemplateContent,\n mergeTags: MergeTagsConfig | undefined,\n): Operation[] {\n const tags = mergeTags?.tags ?? [];\n const syntax = resolveSyntax(mergeTags?.syntax);\n const added = new Map<string, string>();\n // Markup-only normalization also supports partial input and layout wrappers.\n // Locale hashes require engine-valid, evolving simulation states.\n const needsLocaleState = ops.some((op) => op.op === \"updateBlockLocale\");\n let original = safeClone(content);\n let normalizedState = safeClone(content);\n const advance = (\n state: TemplateContent,\n op: Operation,\n index: number,\n ): TemplateContent => {\n try {\n if (!(\"expect\" in op)) return applyOperations(state, [op]);\n // The backend already checked guards against its raw representation.\n const { expect: _expect, ...unguarded } = op;\n return applyOperations(state, [unguarded as Operation]);\n } catch (error) {\n if (!(error instanceof OperationError)) throw error;\n throw new OperationError(error.code, index, error.message, error.blockId);\n }\n };\n const blockIn = (state: TemplateContent, id: string): Block | undefined => {\n const find = (blocks: unknown): Block | undefined => {\n if (!Array.isArray(blocks)) return undefined;\n for (const block of blocks) {\n if (!block || typeof block !== \"object\") continue;\n if (block.id === id) return block;\n const children = block.children;\n const found = find(\n block.type === \"section\" && Array.isArray(children)\n ? children.flat()\n : children,\n );\n if (found) return found;\n }\n };\n return find(state?.blocks);\n };\n const restamp = <T extends LocalizedText | null>(\n entries: Record<string, T> | undefined,\n before: Block | undefined,\n after: Block | undefined,\n locale?: string,\n ): Record<string, T> | undefined => {\n if (!entries) return entries;\n let result = entries;\n for (const [path, entry] of Object.entries(entries)) {\n if (!entry) continue;\n const oldEntry = locale\n ? before?.l10n?.[locale]?.text?.[path]\n : undefined;\n const newEntry = locale ? after?.l10n?.[locale]?.text?.[path] : undefined;\n const oldBase = readPath(before, path);\n const newBase = readPath(after, path);\n const hash =\n oldEntry && newEntry && deepEqual(entry, oldEntry)\n ? newEntry.sourceHash\n : typeof oldBase === \"string\" &&\n typeof newBase === \"string\" &&\n entry.sourceHash === sourceHash(oldBase)\n ? sourceHash(newBase)\n : entry.sourceHash;\n if (hash !== entry.sourceHash)\n result = { ...result, [path]: { ...entry, sourceHash: hash } };\n }\n return result;\n };\n let changed = false;\n\n const normalizeOne = (op: Operation): Operation => {\n if (op.op === \"addBlock\") {\n if (!op.block || typeof op.block !== \"object\") return op;\n collectBlockTypes(op.block, added);\n const block = normalizeBlock(op.block, tags, syntax);\n if (block === op.block) return op;\n changed = true;\n return { ...op, block };\n }\n if (op.op === \"deleteBlock\" && op.expect?.block) {\n const block = normalizeBlock(op.expect.block, tags, syntax);\n if (block === op.expect.block) return op;\n changed = true;\n return { ...op, expect: { ...op.expect, block } };\n }\n if (op.op === \"updateBlockLocale\") {\n const type =\n added.get(op.blockId) ?? blockTypeOf(original?.blocks, op.blockId);\n const before = blockIn(original, op.blockId);\n const after = blockIn(normalizedState, op.blockId);\n const text = normalizeLocaleText(\n type,\n restamp(op.text, before, after),\n tags,\n syntax,\n );\n const expectText = normalizeLocaleText(\n type,\n restamp(op.expect?.text, before, after, op.locale),\n tags,\n syntax,\n );\n const expect =\n op.expect && expectText !== op.expect.text\n ? { ...op.expect, text: expectText }\n : op.expect;\n if (text === op.text && expect === op.expect) return op;\n changed = true;\n return {\n ...op,\n ...(text ? { text } : {}),\n ...(expect ? { expect } : {}),\n };\n }\n if (op.op === \"updateBlock\") {\n const type =\n added.get(op.blockId) ?? blockTypeOf(original?.blocks, op.blockId);\n if (type !== \"title\" && type !== \"paragraph\") return op;\n const normalizeField = (fields: Record<string, unknown> | undefined) => {\n if (typeof fields?.content !== \"string\") return fields;\n const normalized = normalizeMergeTagsInHtml(\n fields.content,\n tags,\n syntax,\n );\n return normalized === fields.content\n ? fields\n : { ...fields, content: normalized };\n };\n const set = normalizeField(op.set);\n const expect = normalizeField(op.expect);\n if (set === op.set && expect === op.expect) return op;\n changed = true;\n return { ...op, ...(set ? { set } : {}), ...(expect ? { expect } : {}) };\n }\n if (op.op === \"setContent\") {\n added.clear();\n const normalized = normalizeMergeTagMarkup(op.content, tags, syntax);\n if (normalized === op.content) return op;\n changed = true;\n return { ...op, content: normalized };\n }\n return op;\n };\n const next = ops.map((op, index) => {\n const normalized = normalizeOne(op);\n if (needsLocaleState) {\n // Fail before returning any batch if either state cannot advance. The\n // collaboration caller reports the error and applies its existing fallback.\n const nextOriginal = advance(original, op, index);\n const nextNormalized = advance(normalizedState, normalized, index);\n original = nextOriginal;\n normalizedState = nextNormalized;\n } else if (op.op === \"setContent\") {\n // Keep type lookup current without imposing engine validation on the\n // existing markup-only path. Added blocks are tracked in `added`.\n original = op.content;\n }\n return normalized;\n });\n\n return changed ? next : (ops as Operation[]);\n}\n"],"mappings":";;AA8EA,SAASU,EAAY,GAAyB;CAC5C,IAAMC,IAAQC,EAAQ,MAAM,SAAS,GAAG,IACpCA,EAAQ,QACR,GAAGA,EAAQ,MAAM;CACrB,OAAO,IAAI,OAAOA,EAAQ,QAAQD,CAAK;AACzC;AAEA,SAASE,EACP,GACA,GACA,GACU;CACV,IAAMC,IAAiB,CAAC,GAElBC,KACJ,GACA,GACA,MACS;EACT,IAAMC,IAAQN,EAAYE,CAAO,GAC7BK,IAAQD,EAAM,KAAKE,CAAI;EAC3B,OAAOD,MAAU,OAAM;GACrB,IAAME,IAAQF,EAAM,OACdG,IAAMD,IAAQF,EAAM,EAAE,CAAC;GAa7B,AAXIA,EAAM,EAAE,CAAC,WAAW,IACtB,EAAM,cACIH,EAAK,MAAM,MAAQK,IAAQE,EAAI,OAAOD,IAAMC,EAAI,KAAK,KAC/DP,EAAK,KAAK;IACR;IACA;IACA;IACA,OAAOG,EAAM;IACb,OAAOK,EAAML,EAAM,EAAE;GACvB,CAAC,GAEH,IAAQD,EAAM,KAAKE,CAAI;EACzB;CACF;CAYA,OAPAH,EA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"version":3,"file":"normalizeMergeTagMarkup-Bn_hl4jd.js","names":["deepEqual","readPath","applyOperations","sourceHash","getMergeTagLabel","safeClone","getLogicMergeTagKeyword","OperationError","resolveSyntax","containsMergeTag","globalRegex","flags","pattern","collectHits","hits","scan","regex","match","text","start","end","hit","label","syntax","value","mergeTags","a","b","collectNormalizableTextNodes","walker","doc","node","el","nodes","current","normalizeMergeTagsInHtml","html","replacements","fragment","cursor","span","normalizeLocaleText","blockType","entry","normalizeBlock","l10n","block","changed","next","locale","layer","children","column","columnChanged","normalized","child","content","before","after","restamped","normalizeMergeTagMarkup","blocks","normalizeContentForConfig","copyIncomingContent","normalizeBlockForConfig","withNormalizedContentWrites","editor","markDirty","withNormalizedTemplateLoads","provider","template","id","blockTypeOf","found","collectBlockTypes","into","nested","normalizeRemoteOperations","tags","added","needsLocaleState","ops","op","original","normalizedState","advance","state","_expect","unguarded","error","index","blockIn","find","restamp","entries","result","path","oldEntry","newEntry","oldBase","newBase","hash","normalizeOne","type","expectText","expect","normalizeField","fields","set","nextOriginal","nextNormalized"],"sources":["../../../src/utils/normalizeMergeTagMarkup.ts"],"sourcesContent":["import type { Ref } from \"vue\";\nimport type {\n Block,\n MergeTag,\n LocalizedText,\n MergeTagsConfig,\n Operation,\n SectionBlock,\n SyntaxPreset,\n TemplateContent,\n TemplatesProvider,\n WrapperBlock,\n} from \"@templatical/types\";\nimport {\n sourceHash,\n readPath,\n deepEqual,\n applyOperations,\n containsMergeTag,\n getLogicMergeTagKeyword,\n getMergeTagLabel,\n OperationError,\n resolveSyntax,\n safeClone,\n} from \"@templatical/types\";\n\n/**\n * Convert bare merge-tag tokens in rich-text HTML into the `<span\n * data-merge-tag>` nodes the editor understands.\n *\n * A tag reaches stored content in one of two physical shapes. Anything a user\n * types or pastes is already a node, because `MergeTagNode`'s input and paste\n * rules convert it on the spot. What stays a bare token is content that never\n * passed through that pipeline — `init({ content })`, `setContent()`, a\n * template loaded from a store, or one produced by the `@templatical/import-*`\n * converters. A bare token renders as literal text: no label, no highlight, no\n * `sample` substitution, and it cannot be selected or deleted as a unit.\n *\n * Three properties of this implementation are load-bearing:\n *\n * 1. **It walks text nodes, never markup.** A token in attribute position —\n * `<a href=\"{{unsubscribe_url}}\">` is the common one — must be left exactly\n * as it is; wrapping it injects an element into an attribute value and\n * corrupts the document. A `TreeWalker` over text nodes cannot reach an\n * attribute at all, so this holds by construction rather than by guard.\n * A regex cannot do this job. Guarding with a `(?<!data-merge-tag=\")`\n * lookbehind protects the attribute of an already-converted span and\n * nothing else, so `<a href=\"{{unsubscribe_url}}\">` becomes an anchor whose\n * href contains a `<span>`. Telling text position from attribute position\n * needs parsing; no amount of lookbehind substitutes for it.\n *\n * 2. **It is idempotent structurally.** The walk rejects the whole subtree of\n * any element already carrying `data-merge-tag` / `data-logic-merge-tag`,\n * so an existing span's inner text is unreachable no matter what it says.\n * That covers the case where a tag's label *is* its value.\n *\n * 3. **It never builds markup by concatenation.** A consumer may configure a\n * syntax whose delimiters contain `<` / `>` — Smarty-style `<% $email %>` —\n * so a template string would emit an attribute no scanner could re-read.\n * Spans are created as elements and filled via `setAttribute` /\n * `textContent`, which leaves escaping to the serializer.\n *\n * Matching is driven by `syntax`, not by the declared tag list, so a template\n * migrated from another ESP has all of its tags made atomic rather than only\n * the handful the consumer has declared so far. An undeclared token falls back\n * to showing its raw value as the label, which `getMergeTagLabel` already does.\n * This mirrors typing: the input and paste rules are registered unconditionally\n * and match on syntax alone.\n */\n\ninterface TagHit {\n start: number;\n end: number;\n attr: string;\n value: string;\n label: string;\n}\n\nfunction globalRegex(pattern: RegExp): RegExp {\n const flags = pattern.flags.includes(\"g\")\n ? pattern.flags\n : `${pattern.flags}g`;\n return new RegExp(pattern.source, flags);\n}\n\nfunction collectHits(\n text: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TagHit[] {\n const hits: TagHit[] = [];\n\n const scan = (\n pattern: RegExp,\n attr: string,\n label: (match: string) => string,\n ): void => {\n const regex = globalRegex(pattern);\n let match = regex.exec(text);\n while (match !== null) {\n const start = match.index;\n const end = start + match[0].length;\n // A zero-length match would spin `exec` forever on the same index.\n if (match[0].length === 0) {\n regex.lastIndex++;\n } else if (!hits.some((hit) => start < hit.end && end > hit.start)) {\n hits.push({\n start,\n end,\n attr,\n value: match[0],\n label: label(match[0]),\n });\n }\n match = regex.exec(text);\n }\n };\n\n // Logic first, so it wins any overlap. Some syntaxes' value regex is liberal\n // enough to also match a logic tag — handlebars' `{{.+?}}` swallows\n // `{{#each items}}` — and `isMergeTagValue` resolves that same way.\n scan(syntax.logic, \"data-logic-merge-tag\", (value) =>\n getLogicMergeTagKeyword(value, syntax),\n );\n scan(syntax.value, \"data-merge-tag\", (value) =>\n getMergeTagLabel(value, mergeTags),\n );\n\n return hits.sort((a, b) => a.start - b.start);\n}\n\n/** Text nodes not already inside a merge-tag span, in document order. */\nfunction collectNormalizableTextNodes(doc: Document): Text[] {\n const walker = doc.createTreeWalker(\n doc.body,\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,\n {\n acceptNode(node: Node): number {\n if (node.nodeType !== 1) return NodeFilter.FILTER_ACCEPT;\n const el = node as Element;\n // REJECT (not SKIP) prunes the subtree, which is what makes a second\n // pass unable to see an existing span's inner text.\n return el.hasAttribute(\"data-merge-tag\") ||\n el.hasAttribute(\"data-logic-merge-tag\")\n ? NodeFilter.FILTER_REJECT\n : NodeFilter.FILTER_SKIP;\n },\n },\n );\n\n // Collected up front: replacing a node mid-walk invalidates the walker.\n const nodes: Text[] = [];\n let current = walker.nextNode();\n while (current !== null) {\n nodes.push(current as Text);\n current = walker.nextNode();\n }\n return nodes;\n}\n\nexport function normalizeMergeTagsInHtml(\n html: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): string {\n if (!html) return html;\n // Cheap reject before paying for a parse. A token that exists only in an\n // attribute still gets past this, and is then caught by the zero-replacement\n // short-circuit below.\n if (!containsMergeTag(html, syntax)) return html;\n if (typeof DOMParser === \"undefined\") return html;\n\n const doc = new DOMParser().parseFromString(\n `<!doctype html><body>${html}</body>`,\n \"text/html\",\n );\n\n let replacements = 0;\n for (const node of collectNormalizableTextNodes(doc)) {\n const text = node.data;\n const hits = collectHits(text, mergeTags, syntax);\n if (hits.length === 0) continue;\n\n const fragment = doc.createDocumentFragment();\n let cursor = 0;\n for (const hit of hits) {\n if (hit.start > cursor) {\n fragment.appendChild(\n doc.createTextNode(text.substring(cursor, hit.start)),\n );\n }\n const span = doc.createElement(\"span\");\n span.setAttribute(hit.attr, hit.value);\n span.textContent = hit.label;\n fragment.appendChild(span);\n cursor = hit.end;\n }\n if (cursor < text.length) {\n fragment.appendChild(doc.createTextNode(text.substring(cursor)));\n }\n\n node.parentNode?.replaceChild(fragment, node);\n replacements += hits.length;\n }\n\n // Nothing matched in text position, so return the input verbatim rather than\n // a re-serialization of it — otherwise content with no tags at all would be\n // rewritten (`<br/>` → `<br>`, attribute quoting, entity encoding) for no\n // reason. Where a replacement does happen some churn is unavoidable, and the\n // renderer accepts both shapes.\n if (replacements === 0) return html;\n\n return doc.body.innerHTML;\n}\n\n/** Normalize localized rich content without changing source hashes or caller-owned objects. */\nfunction normalizeLocaleText<T extends LocalizedText | null>(\n blockType: string | undefined,\n text: Record<string, T> | undefined,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): Record<string, T> | undefined {\n if (\n (blockType !== \"title\" &&\n blockType !== \"paragraph\" &&\n blockType !== \"html\") ||\n typeof text?.content?.value !== \"string\"\n )\n return text;\n const entry = text.content;\n const value = normalizeMergeTagsInHtml(entry.value, mergeTags, syntax);\n return value === entry.value\n ? text\n : { ...text, content: { ...entry, value } };\n}\n\n/**\n * Localized layers normalize only content on titles, paragraphs and HTML\n * blocks. Among base fields, only title and paragraph rich text is normalized. Every other merge-tag-bearing field —\n * `ButtonBlock.text`/`url`, `ImageBlock.alt`, `HtmlBlock.content`, custom-block\n * `fieldValues`, `settings.preheaderText` — is a plain string rendered as text,\n * so a span written into one would be displayed literally on the canvas and\n * emitted into a `url=` attribute by the renderer.\n *\n * `TableCellData.content` is span-bearing to the renderer but is deliberately\n * excluded: `TableBlock.vue` hydrates a cell with `textContent` and writes\n * `innerText` back on blur, so the first focus-and-leave on a normalized cell\n * would persist the literal markup into stored content as text. The\n * editor/renderer asymmetry there is a separate, pre-existing gap.\n */\nfunction normalizeBlock(\n block: Block,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): Block {\n const l10n = block.l10n;\n if (l10n) {\n let changed = false;\n const next = Object.fromEntries(\n Object.entries(l10n).map(([locale, layer]) => {\n const text = normalizeLocaleText(\n block.type,\n layer.text,\n mergeTags,\n syntax,\n );\n if (text === layer.text) return [locale, layer];\n changed = true;\n return [locale, { ...layer, text }];\n }),\n );\n if (changed) block = { ...block, l10n: next };\n }\n if (block.type === \"section\") {\n if (!Array.isArray(block.children)) return block;\n let changed = false;\n const children = block.children.map((column) => {\n if (!Array.isArray(column)) return column;\n let columnChanged = false;\n const next = column.map((child) => {\n const normalized = normalizeBlock(child, mergeTags, syntax);\n if (normalized !== child) columnChanged = true;\n return normalized;\n });\n if (!columnChanged) return column;\n changed = true;\n return next;\n });\n return changed ? ({ ...block, children } as SectionBlock) : block;\n }\n\n if (block.type === \"wrapper\") {\n if (!Array.isArray(block.children)) return block;\n let changed = false;\n const children = block.children.map((child) => {\n const normalized = normalizeBlock(child, mergeTags, syntax);\n if (normalized !== child) changed = true;\n return normalized;\n });\n return changed ? ({ ...block, children } as WrapperBlock) : block;\n }\n\n if (block.type !== \"title\" && block.type !== \"paragraph\") return block;\n if (typeof block.content !== \"string\") return block;\n\n const content = normalizeMergeTagsInHtml(block.content, mergeTags, syntax);\n if (content === block.content) return block;\n const before = sourceHash(block.content);\n const after = sourceHash(content);\n const restamped =\n block.l10n &&\n Object.fromEntries(\n Object.entries(block.l10n).map(([locale, layer]) => {\n const entry = layer.text?.content;\n return [\n locale,\n entry?.sourceHash === before\n ? {\n ...layer,\n text: {\n ...layer.text,\n content: { ...entry, sourceHash: after },\n },\n }\n : layer,\n ];\n }),\n );\n return { ...block, content, ...(restamped ? { l10n: restamped } : {}) };\n}\n\n/**\n * Normalize every rich-text field in a template. Returns the input reference\n * unchanged when nothing matched, so a template with no bare tokens costs no\n * allocation and keeps its object identity; otherwise returns a copy, leaving\n * the caller's content untouched.\n *\n * Shape is checked rather than trusted at every level. `TemplateContent` types\n * `blocks` as required and `SectionBlock.children` as a `Block[][]`, but this\n * runs at the SDK's entry points on an object the consumer hands us — a partial\n * or hand-rolled template must come back untouched, not turn a working `init()`\n * into a `TypeError`.\n */\nexport function normalizeMergeTagMarkup(\n content: TemplateContent,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TemplateContent {\n if (!content || !Array.isArray(content.blocks)) return content;\n\n let changed = false;\n const blocks = content.blocks.map((block) => {\n const normalized = normalizeBlock(block, mergeTags, syntax);\n if (normalized !== block) changed = true;\n return normalized;\n });\n\n return changed ? { ...content, blocks } : content;\n}\n\n/**\n * `normalizeMergeTagMarkup` bound to the editor's own config shape, so the hook\n * sites don't each resolve tags and syntax themselves.\n *\n * An absent `mergeTags` still normalizes, under the liquid default. That is not\n * an oversight: `MergeTagNode`'s input and paste rules are registered\n * unconditionally with the same default, so a consumer who configured nothing\n * already gets a node the instant a user types `{{x}}`. Loading the same text\n * and leaving it inert would be the inconsistency.\n *\n * It always returns a copy. Every content-in path runs through here, and the\n * editor edits the object it holds in place, so holding the caller's own one\n * leaks each edit into it, and one that another Vue made reactive or that a\n * store froze hides edits from the editor's bundled Vue or throws on the first.\n */\nexport function normalizeContentForConfig(\n content: TemplateContent,\n mergeTags: MergeTagsConfig | undefined,\n): TemplateContent {\n return normalizeMergeTagMarkup(\n copyIncomingContent(content),\n mergeTags?.tags ?? [],\n resolveSyntax(mergeTags?.syntax),\n );\n}\n\n/** {@link normalizeContentForConfig} for a single block. */\nexport function normalizeBlockForConfig(\n block: Block,\n mergeTags: MergeTagsConfig | undefined,\n): Block {\n return normalizeBlock(\n block,\n mergeTags?.tags ?? [],\n resolveSyntax(mergeTags?.syntax),\n );\n}\n\n/**\n * A non-object passes through: `normalizeMergeTagMarkup` already hands back\n * whatever is not shaped like content, and `safeClone(undefined)` would throw.\n */\nfunction copyIncomingContent(content: TemplateContent): TemplateContent {\n return typeof content === \"object\" && content !== null\n ? safeClone(content)\n : content;\n}\n\n/**\n * Wrap a `TemplatesProvider` so content arriving from the store is normalized\n * before the editor ever sees it.\n *\n * Only `load` is wrapped. `save` sends content *out*, and what it sends is\n * already-normalized editor state; rewriting it here would change what the\n * store keeps for no benefit. `create` likewise carries content outward, and\n * the template it returns supplies identity and timestamps rather than the\n * content the editor goes on to edit.\n *\n * Wrapping the provider — rather than normalizing after `load()` resolves —\n * is what keeps Q4 true: core assigns already-normalized content to its state\n * and observes no mutation, so there is no dirty flag to suppress and no\n * autosave tick to swallow.\n */\n/**\n * The slice of the editor a content-restoring feature consumes. Structural on\n * purpose: it matches `useVersionHistoryFeature`'s own `VersionHistoryEditor`\n * without importing it, so this util keeps no dependency on a composable.\n */\ninterface ContentWritingEditor {\n state: {\n readonly template?: { id: string } | null;\n readonly isDirty: boolean;\n };\n content: Ref<TemplateContent>;\n setContent: (content: TemplateContent, markDirty?: boolean) => void;\n}\n\n/**\n * Wrap an editor so content written through `setContent` is normalized first.\n *\n * This is how version history is covered. Its content reaches the canvas by\n * three routes — `version.content` off a hydrated list, a `fetched` cache, and\n * `provider.get()` — so wrapping the *provider*, the way the `templates` path\n * does, would miss two of them. `setContent` is the one chokepoint they share.\n *\n * A version is not guaranteed to hold normalized content just because a save\n * produced it: a store carries whatever was written to it, and a backend may\n * version a template it imported rather than one the editor round-tripped.\n * Previewing such a version without this would put bare tokens back on a canvas\n * where every other tag is a chip.\n *\n * `markDirty` is forwarded untouched: every version-history write passes\n * `false`, and swallowing that would turn opening a preview into an unsaved\n * change. `setContent` is resolved per call rather than captured, so a\n * wrapper installed on the editor later still sees every write.\n */\nexport function withNormalizedContentWrites<T extends ContentWritingEditor>(\n editor: T,\n mergeTags: MergeTagsConfig | undefined,\n): ContentWritingEditor {\n return {\n get state() {\n return editor.state;\n },\n get content() {\n return editor.content;\n },\n setContent: (content: TemplateContent, markDirty?: boolean) =>\n editor.setContent(\n normalizeContentForConfig(content, mergeTags),\n markDirty,\n ),\n };\n}\n\nexport function withNormalizedTemplateLoads(\n provider: TemplatesProvider,\n mergeTags: MergeTagsConfig | undefined,\n): TemplatesProvider {\n return {\n ...provider,\n async load(id: string) {\n const template = await provider.load(id);\n return {\n ...template,\n content: normalizeContentForConfig(template.content, mergeTags),\n };\n },\n };\n}\n\n/**\n * The type of the block `id` names — at the top level, in a section's columns\n * or inside a wrapper — or `undefined` when no block has that id.\n */\nfunction blockTypeOf(blocks: unknown, id: string): string | undefined {\n if (!Array.isArray(blocks)) return undefined;\n for (const block of blocks as Block[]) {\n if (!block || typeof block !== \"object\") continue;\n if (block.id === id) return block.type;\n const children = (block as { children?: unknown }).children;\n if (block.type === \"section\" && Array.isArray(children)) {\n for (const column of children) {\n const found = blockTypeOf(column, id);\n if (found) return found;\n }\n } else if (block.type === \"wrapper\") {\n const found = blockTypeOf(children, id);\n if (found) return found;\n }\n }\n return undefined;\n}\n\n/** Every block id in `block`, a section's or a wrapper's children included, with its type. */\nfunction collectBlockTypes(block: Block, into: Map<string, string>): void {\n if (typeof block.id === \"string\") into.set(block.id, block.type);\n const children = (block as { children?: unknown }).children;\n if (!Array.isArray(children)) return;\n const nested =\n block.type === \"section\" ? (children as unknown[]).flat() : children;\n for (const child of nested) {\n if (child && typeof child === \"object\") {\n collectBlockTypes(child as Block, into);\n }\n }\n}\n\n/**\n * Normalize the merge tags in a batch another session made, before the editor\n * applies it — the collaboration counterpart of {@link withNormalizedTemplateLoads}.\n * An agent writes `{{first_name}}` as text and a headless write stores it bare;\n * both arrive as operations, and normalizing them on arrival turns each token\n * into a tag at once. Nothing is sent back for it: the canvas and the\n * controller's copy of the backend's content change together.\n *\n * The rich-text fields only, as for loads: an `addBlock`'s block (a section's\n * children included), an `updateBlock`'s `set.content` when the block it names\n * is a title or a paragraph, its `expect.content`, and a deletion’s `expect.block` — found in `content`, or among the blocks the batch\n * itself added — and a `setContent`'s content. Returns `ops` itself when\n * nothing matched, and never changes it.\n */\nexport function normalizeRemoteOperations(\n ops: readonly Operation[],\n content: TemplateContent,\n mergeTags: MergeTagsConfig | undefined,\n): Operation[] {\n const tags = mergeTags?.tags ?? [];\n const syntax = resolveSyntax(mergeTags?.syntax);\n const added = new Map<string, string>();\n // Markup-only normalization also supports partial input and layout wrappers.\n // Locale hashes require engine-valid, evolving simulation states.\n const needsLocaleState = ops.some((op) => op.op === \"updateBlockLocale\");\n let original = safeClone(content);\n let normalizedState = safeClone(content);\n const advance = (\n state: TemplateContent,\n op: Operation,\n index: number,\n ): TemplateContent => {\n try {\n if (!(\"expect\" in op)) return applyOperations(state, [op]);\n // The backend already checked guards against its raw representation.\n const { expect: _expect, ...unguarded } = op;\n return applyOperations(state, [unguarded as Operation]);\n } catch (error) {\n if (!(error instanceof OperationError)) throw error;\n throw new OperationError(error.code, index, error.message, error.blockId);\n }\n };\n const blockIn = (state: TemplateContent, id: string): Block | undefined => {\n const find = (blocks: unknown): Block | undefined => {\n if (!Array.isArray(blocks)) return undefined;\n for (const block of blocks) {\n if (!block || typeof block !== \"object\") continue;\n if (block.id === id) return block;\n const children = block.children;\n const found = find(\n block.type === \"section\" && Array.isArray(children)\n ? children.flat()\n : children,\n );\n if (found) return found;\n }\n };\n return find(state?.blocks);\n };\n const restamp = <T extends LocalizedText | null>(\n entries: Record<string, T> | undefined,\n before: Block | undefined,\n after: Block | undefined,\n locale?: string,\n ): Record<string, T> | undefined => {\n if (!entries) return entries;\n let result = entries;\n for (const [path, entry] of Object.entries(entries)) {\n if (!entry) continue;\n const oldEntry = locale\n ? before?.l10n?.[locale]?.text?.[path]\n : undefined;\n const newEntry = locale ? after?.l10n?.[locale]?.text?.[path] : undefined;\n const oldBase = readPath(before, path);\n const newBase = readPath(after, path);\n const hash =\n oldEntry && newEntry && deepEqual(entry, oldEntry)\n ? newEntry.sourceHash\n : typeof oldBase === \"string\" &&\n typeof newBase === \"string\" &&\n entry.sourceHash === sourceHash(oldBase)\n ? sourceHash(newBase)\n : entry.sourceHash;\n if (hash !== entry.sourceHash)\n result = { ...result, [path]: { ...entry, sourceHash: hash } };\n }\n return result;\n };\n let changed = false;\n\n const normalizeOne = (op: Operation): Operation => {\n if (op.op === \"addBlock\") {\n if (!op.block || typeof op.block !== \"object\") return op;\n collectBlockTypes(op.block, added);\n const block = normalizeBlock(op.block, tags, syntax);\n if (block === op.block) return op;\n changed = true;\n return { ...op, block };\n }\n if (op.op === \"deleteBlock\" && op.expect?.block) {\n const block = normalizeBlock(op.expect.block, tags, syntax);\n if (block === op.expect.block) return op;\n changed = true;\n return { ...op, expect: { ...op.expect, block } };\n }\n if (op.op === \"updateBlockLocale\") {\n const type =\n added.get(op.blockId) ?? blockTypeOf(original?.blocks, op.blockId);\n const before = blockIn(original, op.blockId);\n const after = blockIn(normalizedState, op.blockId);\n const text = normalizeLocaleText(\n type,\n restamp(op.text, before, after),\n tags,\n syntax,\n );\n const expectText = normalizeLocaleText(\n type,\n restamp(op.expect?.text, before, after, op.locale),\n tags,\n syntax,\n );\n const expect =\n op.expect && expectText !== op.expect.text\n ? { ...op.expect, text: expectText }\n : op.expect;\n if (text === op.text && expect === op.expect) return op;\n changed = true;\n return {\n ...op,\n ...(text ? { text } : {}),\n ...(expect ? { expect } : {}),\n };\n }\n if (op.op === \"updateBlock\") {\n const type =\n added.get(op.blockId) ?? blockTypeOf(original?.blocks, op.blockId);\n if (type !== \"title\" && type !== \"paragraph\") return op;\n const normalizeField = (fields: Record<string, unknown> | undefined) => {\n if (typeof fields?.content !== \"string\") return fields;\n const normalized = normalizeMergeTagsInHtml(\n fields.content,\n tags,\n syntax,\n );\n return normalized === fields.content\n ? fields\n : { ...fields, content: normalized };\n };\n const set = normalizeField(op.set);\n const expect = normalizeField(op.expect);\n if (set === op.set && expect === op.expect) return op;\n changed = true;\n return { ...op, ...(set ? { set } : {}), ...(expect ? { expect } : {}) };\n }\n if (op.op === \"setContent\") {\n added.clear();\n const normalized = normalizeMergeTagMarkup(op.content, tags, syntax);\n if (normalized === op.content) return op;\n changed = true;\n return { ...op, content: normalized };\n }\n return op;\n };\n const next = ops.map((op, index) => {\n const normalized = normalizeOne(op);\n if (needsLocaleState) {\n // Fail before returning any batch if either state cannot advance. The\n // collaboration caller reports the error and applies its existing fallback.\n const nextOriginal = advance(original, op, index);\n const nextNormalized = advance(normalizedState, normalized, index);\n original = nextOriginal;\n normalizedState = nextNormalized;\n } else if (op.op === \"setContent\") {\n // Keep type lookup current without imposing engine validation on the\n // existing markup-only path. Added blocks are tracked in `added`.\n original = op.content;\n }\n return normalized;\n });\n\n return changed ? next : (ops as Operation[]);\n}\n"],"mappings":";;AA8EA,SAASU,EAAY,GAAyB;CAC5C,IAAMC,IAAQC,EAAQ,MAAM,SAAS,GAAG,IACpCA,EAAQ,QACR,GAAGA,EAAQ,MAAM;CACrB,OAAO,IAAI,OAAOA,EAAQ,QAAQD,CAAK;AACzC;AAEA,SAASE,EACP,GACA,GACA,GACU;CACV,IAAMC,IAAiB,CAAC,GAElBC,KACJ,GACA,GACA,MACS;EACT,IAAMC,IAAQN,EAAYE,CAAO,GAC7BK,IAAQD,EAAM,KAAKE,CAAI;EAC3B,OAAOD,MAAU,OAAM;GACrB,IAAME,IAAQF,EAAM,OACdG,IAAMD,IAAQF,EAAM,EAAE,CAAC;GAa7B,AAXIA,EAAM,EAAE,CAAC,WAAW,IACtB,EAAM,cACIH,EAAK,MAAM,MAAQK,IAAQE,EAAI,OAAOD,IAAMC,EAAI,KAAK,KAC/DP,EAAK,KAAK;IACR;IACA;IACA;IACA,OAAOG,EAAM;IACb,OAAOK,EAAML,EAAM,EAAE;GACvB,CAAC,GAEH,IAAQD,EAAM,KAAKE,CAAI;EACzB;CACF;CAYA,OAPAH,EAAKQ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{preRenderCustomBlocks-f7GEKdvw.js → preRenderCustomBlocks-C9oavydG.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ot as e, ht as t, xt as n } from "./src-
|
|
1
|
+
import { Ot as e, ht as t, xt as n } from "./src-ZFw5fg_z.js";
|
|
2
2
|
// src/utils/preRenderCustomBlocks.ts
|
|
3
3
|
async function r(r, i) {
|
|
4
4
|
let a = async (r) => {
|
|
@@ -19,4 +19,4 @@ async function r(r, i) {
|
|
|
19
19
|
}
|
|
20
20
|
export { r as t };
|
|
21
21
|
|
|
22
|
-
//# sourceMappingURL=preRenderCustomBlocks-
|
|
22
|
+
//# sourceMappingURL=preRenderCustomBlocks-C9oavydG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preRenderCustomBlocks-
|
|
1
|
+
{"version":3,"file":"preRenderCustomBlocks-C9oavydG.js","names":["isWrapper","isCustomBlock","isSection","preRenderCustomBlocks","renderBlock","block","customBlock","registry","stylesheet","column","child","content"],"sources":["../../../src/utils/preRenderCustomBlocks.ts"],"sourcesContent":["import type { Block, CustomBlock, TemplateContent } from \"@templatical/types\";\nimport { isCustomBlock, isSection, isWrapper } from \"@templatical/types\";\n\n/**\n * The only things this needs from the block registry. Named as a slice rather\n * than taking `UseBlockRegistryReturn` so the render-payload builder can supply\n * the editor instance's own methods without reaching for the registry.\n */\nexport interface CustomBlockResolver {\n renderCustomBlock: (block: CustomBlock) => Promise<string>;\n getCustomBlockStylesheet: (customType: string) => string | undefined;\n}\n\n/**\n * Renders every custom block in the content tree to its HTML representation\n * and stores the result on `block.renderedHtml`, with the definition's\n * stylesheet on `block.renderedStylesheet`.\n *\n * **A contract obligation of every render, not a save-path detail.** A renderer\n * handed a custom block with neither a resolver nor `renderedHtml` omits it from\n * the output silently, and a backend has no way to resolve one: the HTML comes\n * from the consumer's liquid template plus the block's field values, and the\n * definition is registered in the browser. So this runs before a\n * `RenderProvider` sees the content, and before Cloud persists it.\n *\n * Failures per-block are swallowed (and replaced with a comment placeholder)\n * so one broken block doesn't block the save of the rest.\n */\nexport async function preRenderCustomBlocks(\n content: TemplateContent,\n registry: CustomBlockResolver,\n): Promise<void> {\n const renderBlock = async (block: Block): Promise<void> => {\n if (isCustomBlock(block)) {\n const customBlock = block as CustomBlock;\n try {\n customBlock.renderedHtml =\n await registry.renderCustomBlock(customBlock);\n } catch {\n customBlock.renderedHtml = `<!-- Custom block render error: ${customBlock.customType} -->`;\n }\n // Removed when the definition has none, so a copy written before its\n // stylesheet was deleted doesn't outlive it.\n const stylesheet = registry.getCustomBlockStylesheet(\n customBlock.customType,\n );\n if (stylesheet?.trim()) customBlock.renderedStylesheet = stylesheet;\n else delete customBlock.renderedStylesheet;\n }\n\n if (isSection(block)) {\n for (const column of block.children) {\n for (const child of column) {\n await renderBlock(child);\n }\n }\n } else if (isWrapper(block)) {\n for (const child of block.children) {\n await renderBlock(child);\n }\n }\n };\n\n for (const block of content.blocks) {\n await renderBlock(block);\n }\n}\n"],"mappings":";;AA4BA,eAAsBG,EACpB,GACA,GACe;CACf,IAAMC,IAAc,OAAO,MAAgC;EACzD,IAAIH,EAAcI,CAAK,GAAG;GACxB,IAAMC,IAAcD;GACpB,IAAI;IACF,EAAY,eACV,MAAME,EAAS,kBAAkBD,CAAW;GAChD,QAAQ;IACN,EAAY,eAAe,mCAAmCA,EAAY,WAAW;GACvF;GAGA,IAAME,IAAaD,EAAS,yBAC1BD,EAAY,UACd;GACA,AAAIE,GAAY,KAAK,IAAG,EAAY,qBAAqBA,IACpD,OAAOF,EAAY;EAC1B;EAEA,IAAIJ,EAAUG,CAAK,GACjB,KAAK,IAAMI,KAAUJ,EAAM,UACzB,KAAK,IAAMK,KAASD,GAClB,MAAML,EAAYM,CAAK;OAGtB,IAAIV,EAAUK,CAAK,GACxB,KAAK,IAAMK,KAASL,EAAM,UACxB,MAAMD,EAAYM,CAAK;CAG7B;CAEA,KAAK,IAAML,KAASM,EAAQ,QAC1B,MAAMP,EAAYC,CAAK;AAE3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, D as t, T as n, w as r } from "./src-
|
|
1
|
+
import { C as e, D as t, T as n, w as r } from "./src-ZFw5fg_z.js";
|
|
2
2
|
import { t as i } from "./dompurify-JVtr5-B1.js";
|
|
3
3
|
// src/utils/sanitizeHtml.ts
|
|
4
4
|
var a = new Set(r), o = [...e], s = RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))`, "i"), c = [
|
|
@@ -58,4 +58,4 @@ function p(e) {
|
|
|
58
58
|
}
|
|
59
59
|
export { p as n, f as t };
|
|
60
60
|
|
|
61
|
-
//# sourceMappingURL=sanitizeHtml-
|
|
61
|
+
//# sourceMappingURL=sanitizeHtml-DfXoetOm.js.map
|