@templatical/editor 0.59.1 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiAltTextPopover-CwyKz_9U.js → AiAltTextPopover-DiIaqDtB.js} +3 -3
- package/dist/{AiAltTextReview-DNFnR1PN.js → AiAltTextReview-DIe0WBbj.js} +3 -3
- package/dist/{AiChatPanel-DWWVvJIP.js → AiChatPanel-aj2TPO9F.js} +10 -10
- package/dist/{AiPanels-CESbBB63.js → AiPanels-CRM3jf82.js} +1 -1
- package/dist/{AiRewriteMenu-DH6j1jOA.js → AiRewriteMenu-F3GyXBsk.js} +11 -11
- package/dist/{BlockIssueBadge-3k568_Od.js → BlockIssueBadge-DlhA_I6J.js} +4 -4
- package/dist/{BlockPreviewCanvas-BLJxLwTT.js → BlockPreviewCanvas-DYspUXMO.js} +29 -50
- package/dist/{CloudHeaderExtras-xrHubAHL.js → CloudHeaderExtras-DC_oNrxz.js} +1 -1
- package/dist/{CloudPanels-qW-MObRD.js → CloudPanels-CAMn545-.js} +4 -4
- package/dist/{CollaborationNotices-D9GQ477K.js → CollaborationNotices-CnfS8BQy.js} +2 -2
- package/dist/{CollaboratorBar-DsRjAaqd.js → CollaboratorBar-DufLdLQP.js} +2 -2
- package/dist/{CommentsPanel-lb-IFzjl.js → CommentsPanel-C2hFFs0o.js} +1 -1
- package/dist/{CommentsSidebar-CVVTCWBH.js → CommentsSidebar-CgEwxt2T.js} +12 -12
- package/dist/{CountdownBlock-CSEq79Nc.js → CountdownBlock-AYPypmcX.js} +2 -2
- package/dist/{CountdownToolbar-BV9yQi9k.js → CountdownToolbar-CNqYDevp.js} +5 -5
- package/dist/{IssuesPanel-pxcWAQJM.js → IssuesPanel-cPKhimE9.js} +12 -12
- package/dist/{LanguageMenu-D_xbvq3D.js → LanguageMenu-zxlpmw2x.js} +14 -14
- package/dist/{LocaleNotices-j4aMFfmc.js → LocaleNotices-PIfpvCCI.js} +4 -4
- package/dist/{LogicTagInsertButton-BDIsyl3C.js → LogicTagInsertButton-DqTkGJSR.js} +21 -21
- package/dist/{MediaEditModal-BWOqjEZN.js → MediaEditModal-C2Bn8WGb.js} +1 -1
- package/dist/{MediaPanels-C-XrldMu.js → MediaPanels-BAZByHRA.js} +1 -1
- package/dist/{MergeTagInput-De1yWoc2.js → MergeTagInput-Jly1Pw0v.js} +1 -1
- package/dist/{MergeTagModeToggle-CL96pI1E.js → MergeTagModeToggle-5kaFLRAm.js} +6 -6
- package/dist/{MergeTagTextarea-DDyV8U44.js → MergeTagTextarea-CCfirhcR.js} +7 -7
- package/dist/{ParagraphEditor-DpOsnnai.js → ParagraphEditor-DTdnxgDZ.js} +46 -46
- package/dist/{RestoreVersionDialog-JQEkVIh5.js → RestoreVersionDialog-cUYu3Xqs.js} +4 -4
- package/dist/{RichTextEditorContent-C2Yj1-ZA.js → RichTextEditorContent-Aub9tOHF.js} +8 -8
- package/dist/{SaveBlockDialog-BPf6tDhg.js → SaveBlockDialog-D_ie3uIF.js} +9 -9
- package/dist/{SavedBlocksBrowserModal-DnDCfwSv.js → SavedBlocksBrowserModal-fhSnYT1l.js} +11 -11
- package/dist/{SavedBlocksPanels-D5YaVCem.js → SavedBlocksPanels-Lklqy4XI.js} +1 -1
- package/dist/{SavedBlocksPickBar-OQ7ey3MD.js → SavedBlocksPickBar-CpWkCa8G.js} +3 -3
- package/dist/{TemplateSettings-CBCaybvd.js → TemplateSettings-BJ4a8RBr.js} +12 -12
- package/dist/{TestEmailModal-BDp85wIp.js → TestEmailModal-BEoapoDc.js} +14 -12
- package/dist/{TestEmailPanel-DkJx0Ptk.js → TestEmailPanel-DgyzokCf.js} +1 -1
- package/dist/{TitleEditor-wzknZqu_.js → TitleEditor-BQoSPgOi.js} +13 -13
- package/dist/{Toolbar-FIYSw3Us.js → Toolbar-KhPpWyX1.js} +857 -756
- package/dist/{TplModal-C57J-uF0.js → TplModal-F_kA7luG.js} +4 -4
- package/dist/{VersionHistoryMenu-6jMve6By.js → VersionHistoryMenu-Bz4G8cNm.js} +7 -7
- package/dist/{VersionHistoryPanels-BZ0GT52h.js → VersionHistoryPanels-DmVRyWv9.js} +1 -1
- package/dist/{VersionPreviewBanner-Bq8z1SUc.js → VersionPreviewBanner-BeppXZyn.js} +2 -2
- package/dist/{WrapperBlock-C4XrJkx5.js → WrapperBlock-Ds7yfbhg.js} +4 -4
- package/dist/{blockTypeIcons-VX_8UQ21.js → blockTypeIcons-Do1QqDjg.js} +3 -3
- package/dist/bundle-stats.json +6 -6
- package/dist/{ca-YfIxwO1G.js → ca-Ce3NmK9v.js} +6 -1
- package/dist/cdn/chunks/{AiAltTextPopover-Dj-VLU88.js → AiAltTextPopover-CUzIaLRK.js} +4 -4
- package/dist/cdn/chunks/AiAltTextPopover-CUzIaLRK.js.map +1 -0
- package/dist/cdn/chunks/{AiAltTextReview-tVkJPOk6.js → AiAltTextReview-BXBlE71X.js} +4 -4
- package/dist/cdn/chunks/AiAltTextReview-BXBlE71X.js.map +1 -0
- package/dist/cdn/chunks/{AiChatPanel-CYPvHQGQ.js → AiChatPanel-BKydciDQ.js} +4 -4
- package/dist/cdn/chunks/AiChatPanel-BKydciDQ.js.map +1 -0
- package/dist/cdn/chunks/{AiPanels-ChTLCmMS.js → AiPanels-De-cIZ4p.js} +2 -2
- package/dist/cdn/chunks/AiPanels-De-cIZ4p.js.map +1 -0
- package/dist/cdn/chunks/{AiRewriteMenu-B23ozFnP.js → AiRewriteMenu-C9vBUTIB.js} +9 -9
- package/dist/cdn/chunks/AiRewriteMenu-C9vBUTIB.js.map +1 -0
- package/dist/cdn/chunks/{BlockIssueBadge-BKO4Mr8f.js → BlockIssueBadge-B3CTTvgw.js} +4 -4
- package/dist/cdn/chunks/BlockIssueBadge-B3CTTvgw.js.map +1 -0
- package/dist/cdn/chunks/{BlockPreviewCanvas-CaRneMZ8.js → BlockPreviewCanvas-B4Bj--kc.js} +30 -51
- package/dist/cdn/chunks/BlockPreviewCanvas-B4Bj--kc.js.map +1 -0
- package/dist/cdn/chunks/{CloudHeaderExtras-O_K3jmgO.js → CloudHeaderExtras-Cd-ePldd.js} +2 -2
- package/dist/cdn/chunks/CloudHeaderExtras-Cd-ePldd.js.map +1 -0
- package/dist/cdn/chunks/{CloudPanels-xAEirqNC.js → CloudPanels-CQ75I3hQ.js} +4 -4
- package/dist/cdn/chunks/CloudPanels-CQ75I3hQ.js.map +1 -0
- package/dist/cdn/chunks/{CollaborationNotices-CwAoa-73.js → CollaborationNotices-CgLea-hu.js} +3 -3
- package/dist/cdn/chunks/CollaborationNotices-CgLea-hu.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-DdQQwtwd.js → CollaboratorBar-CjRcbebT.js} +3 -3
- package/dist/cdn/chunks/CollaboratorBar-CjRcbebT.js.map +1 -0
- package/dist/cdn/chunks/{CommentsPanel-C8AKtxiG.js → CommentsPanel-D_ud9GMN.js} +2 -2
- package/dist/cdn/chunks/CommentsPanel-D_ud9GMN.js.map +1 -0
- package/dist/cdn/chunks/{CommentsSidebar-FxY0RHSq.js → CommentsSidebar-CXn1EGAI.js} +4 -4
- package/dist/cdn/chunks/CommentsSidebar-CXn1EGAI.js.map +1 -0
- package/dist/cdn/chunks/{CountdownBlock-DGgnPUlu.js → CountdownBlock--hlKE2aj.js} +3 -3
- package/dist/cdn/chunks/CountdownBlock--hlKE2aj.js.map +1 -0
- package/dist/cdn/chunks/{CountdownToolbar-9PtYUgCW.js → CountdownToolbar-BOyk_4k7.js} +6 -6
- package/dist/cdn/chunks/CountdownToolbar-BOyk_4k7.js.map +1 -0
- package/dist/cdn/chunks/{IssuesPanel-Co-ffgWa.js → IssuesPanel-DOC94ZsH.js} +8 -8
- package/dist/cdn/chunks/IssuesPanel-DOC94ZsH.js.map +1 -0
- package/dist/cdn/chunks/{LanguageMenu-Cl0ajnXZ.js → LanguageMenu-DktneIpL.js} +100 -100
- package/dist/cdn/chunks/LanguageMenu-DktneIpL.js.map +1 -0
- package/dist/cdn/chunks/{LocaleNotices-BVDJ7kyj.js → LocaleNotices-B2NgnHoP.js} +4 -4
- package/dist/cdn/chunks/LocaleNotices-B2NgnHoP.js.map +1 -0
- package/dist/cdn/chunks/{LogicTagInsertButton-DPYA8LJW.js → LogicTagInsertButton-CQ8RiOou.js} +10 -10
- package/dist/cdn/chunks/LogicTagInsertButton-CQ8RiOou.js.map +1 -0
- package/dist/cdn/chunks/{MediaEditModal-CfgN7Jyi.js → MediaEditModal-Cs7_Om7e.js} +2 -2
- package/dist/cdn/chunks/MediaEditModal-Cs7_Om7e.js.map +1 -0
- package/dist/cdn/chunks/{MediaPanels-Cb5vsgb-.js → MediaPanels-BeekGmql.js} +2 -2
- package/dist/cdn/chunks/MediaPanels-BeekGmql.js.map +1 -0
- package/dist/cdn/chunks/{MergeTagInput-Cxfjq3tx.js → MergeTagInput-D7FZ0ca0.js} +2 -2
- package/dist/cdn/chunks/MergeTagInput-D7FZ0ca0.js.map +1 -0
- package/dist/cdn/chunks/{MergeTagModeToggle-BmNGV3yc.js → MergeTagModeToggle-CySCCEDs.js} +5 -5
- package/dist/cdn/chunks/MergeTagModeToggle-CySCCEDs.js.map +1 -0
- package/dist/cdn/chunks/{MergeTagTextarea-DmwrPAss.js → MergeTagTextarea-DJbWTYVH.js} +6 -6
- package/dist/cdn/chunks/MergeTagTextarea-DJbWTYVH.js.map +1 -0
- package/dist/cdn/chunks/{ParagraphEditor-BoGELRr-.js → ParagraphEditor-DAQUWqQJ.js} +26 -26
- package/dist/cdn/chunks/ParagraphEditor-DAQUWqQJ.js.map +1 -0
- package/dist/cdn/chunks/{RestoreVersionDialog-CaKiSq-9.js → RestoreVersionDialog-COTRe_rM.js} +4 -4
- package/dist/cdn/chunks/RestoreVersionDialog-COTRe_rM.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-Dq4TROOg.js → RichTextEditorContent-DeWPMd9V.js} +8 -8
- package/dist/cdn/chunks/RichTextEditorContent-DeWPMd9V.js.map +1 -0
- package/dist/cdn/chunks/{SaveBlockDialog-BAR0G4UO.js → SaveBlockDialog-adQMbKR1.js} +8 -8
- package/dist/cdn/chunks/SaveBlockDialog-adQMbKR1.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-C-KYaLkQ.js → SavedBlocksBrowserModal-CGIFCRAx.js} +8 -8
- package/dist/cdn/chunks/SavedBlocksBrowserModal-CGIFCRAx.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksPanels-C3OF0EeB.js → SavedBlocksPanels-Du0RYlEf.js} +2 -2
- package/dist/cdn/chunks/SavedBlocksPanels-Du0RYlEf.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksPickBar-BnyPXw5W.js → SavedBlocksPickBar-DmleyUrn.js} +4 -4
- package/dist/cdn/chunks/SavedBlocksPickBar-DmleyUrn.js.map +1 -0
- package/dist/cdn/chunks/{TemplateSettings-uoiUkd2l.js → TemplateSettings-Csjef99q.js} +10 -10
- package/dist/cdn/chunks/TemplateSettings-Csjef99q.js.map +1 -0
- package/dist/cdn/chunks/{TestEmailModal-B9d3ZsH7.js → TestEmailModal-ClkexOtF.js} +13 -11
- package/dist/cdn/chunks/TestEmailModal-ClkexOtF.js.map +1 -0
- package/dist/cdn/chunks/{TestEmailPanel--fPi6QjN.js → TestEmailPanel-DYEYzhU2.js} +2 -2
- package/dist/cdn/chunks/TestEmailPanel-DYEYzhU2.js.map +1 -0
- package/dist/cdn/chunks/{TitleEditor-Cn4fnSpa.js → TitleEditor-opvaIgVr.js} +12 -12
- package/dist/cdn/chunks/TitleEditor-opvaIgVr.js.map +1 -0
- package/dist/cdn/chunks/ToggleSwitch-C0w0srN_.js.map +1 -1
- package/dist/cdn/chunks/{Toolbar-BzAuH2G4.js → Toolbar-DbqkKRXy.js} +825 -724
- package/dist/cdn/chunks/Toolbar-DbqkKRXy.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-jMfK19PC.js → TplModal-DLV5OeMD.js} +5 -5
- package/dist/cdn/chunks/TplModal-DLV5OeMD.js.map +1 -0
- package/dist/cdn/chunks/{VersionHistoryMenu-DDqYMqC2.js → VersionHistoryMenu-DBd0zwjE.js} +4 -4
- package/dist/cdn/chunks/VersionHistoryMenu-DBd0zwjE.js.map +1 -0
- package/dist/cdn/chunks/{VersionHistoryPanels-DJpySkvq.js → VersionHistoryPanels-hy_Ybxie.js} +2 -2
- package/dist/cdn/chunks/VersionHistoryPanels-hy_Ybxie.js.map +1 -0
- package/dist/cdn/chunks/{VersionPreviewBanner-CYT5QUoc.js → VersionPreviewBanner-D-yHxWWY.js} +3 -3
- package/dist/cdn/chunks/VersionPreviewBanner-D-yHxWWY.js.map +1 -0
- package/dist/cdn/chunks/{WrapperBlock-Bi9XgDmX.js → WrapperBlock-Ce_k8m_x.js} +5 -5
- package/dist/cdn/chunks/WrapperBlock-Ce_k8m_x.js.map +1 -0
- package/dist/cdn/chunks/{blockTypeIcons-CGxNYHVA.js → blockTypeIcons-DBoP1HkR.js} +2 -2
- package/dist/cdn/chunks/{blockTypeIcons-CGxNYHVA.js.map → blockTypeIcons-DBoP1HkR.js.map} +1 -1
- package/dist/cdn/chunks/{ca-YfIxwO1G.js → ca-Ce3NmK9v.js} +7 -2
- package/dist/cdn/chunks/ca-Ce3NmK9v.js.map +1 -0
- package/dist/cdn/chunks/{composables-Cp6gZ7qV.js → composables-Brr4m0Sg.js} +526 -550
- package/dist/cdn/chunks/composables-Brr4m0Sg.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-D8zeR9D2.js → createCloudRuntime-QPeg45XL.js} +4 -4
- package/dist/cdn/chunks/{createCloudRuntime-D8zeR9D2.js.map → createCloudRuntime-QPeg45XL.js.map} +1 -1
- package/dist/cdn/chunks/{da-CM6DCvRG.js → da-4YwDAuEr.js} +7 -2
- package/dist/cdn/chunks/da-4YwDAuEr.js.map +1 -0
- package/dist/{de-Dugz1zXC.js → cdn/chunks/de-BlQ0vdZJ.js} +8 -1
- package/dist/cdn/chunks/de-BlQ0vdZJ.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-CXSSZplR.js → editor-modal-BCcbvIxc.js} +4 -4
- package/dist/cdn/chunks/editor-modal-BCcbvIxc.js.map +1 -0
- package/dist/cdn/chunks/en-DkulseE1.js +1 -0
- package/dist/{en-BykoFuFY.js → cdn/chunks/en-MlNeQVSG.js} +8 -1
- package/dist/cdn/chunks/en-MlNeQVSG.js.map +1 -0
- package/dist/{es-DaWsTkpj.js → cdn/chunks/es-2s8x4OM2.js} +8 -1
- package/dist/cdn/chunks/es-2s8x4OM2.js.map +1 -0
- package/dist/cdn/chunks/{extensions-BYJPv1sA.js → extensions-BpuyqKVY.js} +6 -6
- package/dist/cdn/chunks/extensions-BpuyqKVY.js.map +1 -0
- package/dist/cdn/chunks/{fr-DqwQHtJo.js → fr-D3MjrsgQ.js} +7 -2
- package/dist/cdn/chunks/fr-D3MjrsgQ.js.map +1 -0
- package/dist/cdn/chunks/{icons-C7vjUBLn.js → icons-BJ6AtVgu.js} +23 -23
- package/dist/cdn/chunks/{icons-C7vjUBLn.js.map → icons-BJ6AtVgu.js.map} +1 -1
- package/dist/{ja-BH4MS1Ye.js → cdn/chunks/ja-B4Kx7uBX.js} +8 -1
- package/dist/cdn/chunks/ja-B4Kx7uBX.js.map +1 -0
- package/dist/cdn/chunks/keys-ywH4jHJ2.js +11 -0
- package/dist/cdn/chunks/keys-ywH4jHJ2.js.map +1 -0
- package/dist/{nl-BQl1_UHv.js → cdn/chunks/nl-U65iX7wN.js} +8 -1
- package/dist/cdn/chunks/nl-U65iX7wN.js.map +1 -0
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-nDyYIXvL.js → normalizeMergeTagMarkup-B81BAWKT.js} +61 -61
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-nDyYIXvL.js.map → normalizeMergeTagMarkup-B81BAWKT.js.map} +1 -1
- package/dist/{preRenderCustomBlocks-CgPtlLGL.js → cdn/chunks/preRenderCustomBlocks-CQuaMxuv.js} +3 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-CxwYcAQe.js.map → preRenderCustomBlocks-CQuaMxuv.js.map} +1 -1
- package/dist/{pt-BR-eyzmU9Vs.js → cdn/chunks/pt-BR-_jsX1xLv.js} +8 -1
- package/dist/cdn/chunks/pt-BR-_jsX1xLv.js.map +1 -0
- package/dist/cdn/chunks/{sanitizeHtml-5T_KaDcp.js → sanitizeHtml-BdAjvU9I.js} +2 -2
- package/dist/cdn/chunks/{sanitizeHtml-5T_KaDcp.js.map → sanitizeHtml-BdAjvU9I.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-bvQ57o1m.js → socialIcons-Df9dNe7I.js} +463 -485
- package/dist/cdn/chunks/socialIcons-Df9dNe7I.js.map +1 -0
- package/dist/cdn/chunks/{src-BRyzUujm.js → src-B3v_3j9b.js} +586 -554
- package/dist/cdn/chunks/src-B3v_3j9b.js.map +1 -0
- package/dist/{dist-BTjObRcv.js → cdn/chunks/src-BHgVGOTi.js} +872 -700
- package/dist/cdn/chunks/src-BHgVGOTi.js.map +1 -0
- package/dist/cdn/chunks/src-C5V_yzAU.js +673 -0
- package/dist/cdn/chunks/src-C5V_yzAU.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-B7gxx0aJ.js → tiptap-D9amDW4u.js} +1030 -1027
- package/dist/cdn/chunks/tiptap-D9amDW4u.js.map +1 -0
- package/dist/cdn/chunks/{useCloudI18n-CWgySYuJ.js → useCloudI18n-BTV9uu3c.js} +2 -2
- package/dist/cdn/chunks/{useCloudI18n-CWgySYuJ.js.map → useCloudI18n-BTV9uu3c.js.map} +1 -1
- package/dist/cdn/chunks/{useEditorRoot-BA4vV7sK.js → useEditorRoot-D0Lp2x4_.js} +2 -2
- package/dist/cdn/chunks/{useEditorRoot-BA4vV7sK.js.map → useEditorRoot-D0Lp2x4_.js.map} +1 -1
- package/dist/cdn/chunks/{useI18n-JsIdvX-i.js → useI18n-DPg6rPbu.js} +2 -2
- package/dist/cdn/chunks/{useI18n-JsIdvX-i.js.map → useI18n-DPg6rPbu.js.map} +1 -1
- package/dist/cdn/chunks/useLocalizedDisplay-C3lIetmX.js +33 -0
- package/dist/cdn/chunks/{useLocalizedDisplay-7iwZ1UhB.js.map → useLocalizedDisplay-C3lIetmX.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-C10Wef7d.js → useLogicTag-DOIlsGk8.js} +3 -3
- package/dist/cdn/chunks/{useLogicTag-C10Wef7d.js.map → useLogicTag-DOIlsGk8.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-Dd26TcvH.js → useMergeTag-DUNl364g.js} +3 -3
- package/dist/cdn/chunks/{useMergeTag-Dd26TcvH.js.map → useMergeTag-DUNl364g.js.map} +1 -1
- package/dist/cdn/chunks/{usePopoverPosition-DWRQRT2P.js → usePopoverPosition-CBp9uwjV.js} +2 -2
- package/dist/cdn/chunks/{usePopoverPosition-DWRQRT2P.js.map → usePopoverPosition-CBp9uwjV.js.map} +1 -1
- package/dist/cdn/chunks/{useScrollToBlock-CArjwH-u.js → useScrollToBlock-32EnuMwu.js} +2 -2
- package/dist/cdn/chunks/{useScrollToBlock-CArjwH-u.js.map → useScrollToBlock-32EnuMwu.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-BaeBoPQZ.js → withCurrentFont-ufGLu2Vt.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-BaeBoPQZ.js.map → withCurrentFont-ufGLu2Vt.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +573 -573
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-ErKdPXG6.js → check-CWq6Nfjj.js} +1 -1
- package/dist/{chevron-down-C_vv5fZE.js → chevron-down-B9t0SK_-.js} +1 -1
- package/dist/{chevron-right-Cw4GpjFA.js → chevron-right-B_qslOCS.js} +1 -1
- package/dist/{chevron-up-uijYZoph.js → chevron-up-CxZ2teV2.js} +1 -1
- package/dist/{circle-exclamation-point-CIYHx5Tw.js → circle-exclamation-point-B1tbhkNb.js} +1 -1
- package/dist/{clock-tnC1IvZk.js → clock-Rw4btQn-.js} +1 -1
- package/dist/{composables-jTnTSqdm.js → composables-5KJV0O9T.js} +933 -957
- package/dist/{createCloudRuntime-DiUnYjKr.js → createCloudRuntime-BdoKeYJi.js} +3 -3
- package/dist/{createLucideIcon-CssArtUe.js → createLucideIcon-B6Zkn9r0.js} +5 -5
- package/dist/{da-CM6DCvRG.js → da-4YwDAuEr.js} +6 -1
- package/dist/{cdn/chunks/de-Dugz1zXC.js → de-BlQ0vdZJ.js} +6 -3
- package/dist/dist-AyAOL8Bj.js +4 -0
- package/dist/{dist-BTUMr4Pb.js → dist-BNrGwgev.js} +2 -2
- package/dist/{dist-CsplpC_6.js → dist-BPVNNdTv.js} +2 -2
- package/dist/{dist-bWIkrMkM.js → dist-C7YLw60i.js} +2 -2
- package/dist/{dist-Clfx1JeL.js → dist-CBnAqr27.js} +2 -2
- package/dist/{dist-CkHJRChP.js → dist-COvAA64n.js} +2 -2
- package/dist/{dist-C-NRkFsp.js → dist-CuRjmtWu.js} +5 -5
- package/dist/{dist-HKEDfp__.js → dist-DG_AWt8v.js} +2 -2
- package/dist/{dist-DY3WbyCO.js → dist-DYtuc3jc.js} +2 -2
- package/dist/dist-DkPTWQuO.js +4 -0
- package/dist/{dist-DwpKFWF4.js → dist-DoWk1r7z.js} +77 -74
- package/dist/{cdn/chunks/src-CVHGPKSW.js → dist-DsA7NeIy.js} +691 -649
- package/dist/{dist-BlrlMP8f.js → dist-fDsB6dCL.js} +2 -2
- package/dist/{editor-modal-BWvxfSj8.js → editor-modal-_ylhrf4g.js} +15 -15
- package/dist/en-DwxgN_-Y.js +1 -0
- package/dist/{cdn/chunks/en-BykoFuFY.js → en-MlNeQVSG.js} +6 -3
- package/dist/{cdn/chunks/es-DaWsTkpj.js → es-2s8x4OM2.js} +6 -3
- package/dist/{extensions-CAuXwpbI.js → extensions-DCJGAZ9z.js} +74 -74
- package/dist/{eye-DK4--qHk.js → eye-BE-DeEqG.js} +1 -1
- package/dist/{fr-DqwQHtJo.js → fr-D3MjrsgQ.js} +6 -1
- package/dist/{image-B5pJOw5Q.js → image-DfRxUmUh.js} +1 -1
- package/dist/index.d.ts +37 -7
- package/dist/{info-DKM0_thN.js → info-D1PS-81D.js} +1 -1
- package/dist/{cdn/chunks/ja-BH4MS1Ye.js → ja-B4Kx7uBX.js} +6 -3
- package/dist/keys-B4DimcgX.js +9 -0
- package/dist/{link-BNgTZ_Sw.js → link-DLaACaIz.js} +1 -1
- package/dist/{list-Bqynqm7o.js → list-CvtzVlvM.js} +1 -1
- package/dist/{loader-circle-BMc3fVpa.js → loader-circle-DCkSXApP.js} +1 -1
- package/dist/{message-circle-D_TpvAJh.js → message-circle-Bj4F9bBO.js} +1 -1
- package/dist/{cdn/chunks/nl-BQl1_UHv.js → nl-U65iX7wN.js} +6 -3
- package/dist/{normalizeMergeTagMarkup-fgoVMKAc.js → normalizeMergeTagMarkup-B7n_-4Dz.js} +45 -45
- package/dist/{package-D2fov5PU.js → package-By1au8Wi.js} +1 -1
- package/dist/{pencil-BNdkJyfY.js → pencil-T4qqyRLl.js} +1 -1
- package/dist/{plus-CWmBmMx-.js → plus-3Zry-1gs.js} +1 -1
- package/dist/{cdn/chunks/preRenderCustomBlocks-CxwYcAQe.js → preRenderCustomBlocks-D3GzENVB.js} +1 -3
- package/dist/{cdn/chunks/pt-BR-eyzmU9Vs.js → pt-BR-_jsX1xLv.js} +6 -3
- package/dist/{refresh-cw-Ryg1j66N.js → refresh-cw-BwaO0ioc.js} +1 -1
- package/dist/{rotate-ccw-D8j7gXXv.js → rotate-ccw-C3E0W5q-.js} +1 -1
- package/dist/{sanitizeHtml-D2wueiEe.js → sanitizeHtml-BcbjlypU.js} +6 -6
- package/dist/{search-CX2JkSHz.js → search-DfExisVv.js} +1 -1
- package/dist/{send-BLR1b-p5.js → send-FRC7Giap.js} +1 -1
- package/dist/{smartphone-Co8m0LLg.js → smartphone-BlYU_z_x.js} +1 -1
- package/dist/{socialIcons-RKdTgJip.js → socialIcons-By2LPWOQ.js} +563 -585
- package/dist/{sparkles-Dc3Undp5.js → sparkles-DSi61skE.js} +1 -1
- package/dist/{square-CPw_cyX8.js → square-DEE8tT2w.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +640 -640
- package/dist/{text-align-start-2VZGhCiK.js → text-align-start-DGdrmKcG.js} +1 -1
- package/dist/{trash-t6XXliVc.js → trash-YZPJMZc7.js} +1 -1
- package/dist/{triangle-exclamation-point-_YYWE2ZH.js → triangle-exclamation-point-BR-W6pQm.js} +1 -1
- package/dist/{upload-BWYXWYHb.js → upload-B_Eoqj-4.js} +1 -1
- package/dist/{useCloudI18n-nMZ9f_4b.js → useCloudI18n-BnuOL1YS.js} +1 -1
- package/dist/{useEditorRoot-DpssP9rX.js → useEditorRoot-DWfC2CVC.js} +1 -1
- package/dist/{useI18n-C2p-qHeb.js → useI18n-Cx9W7OWb.js} +1 -1
- package/dist/useLocalizedDisplay-_P6-hXaO.js +31 -0
- package/dist/{useLogicTag-59fmujI7.js → useLogicTag-f0SJ1Cd2.js} +2 -2
- package/dist/{useMergeTag-M1vauWet.js → useMergeTag-0-EudwkV.js} +4 -4
- package/dist/{usePopoverPosition-L9MOHBM-.js → usePopoverPosition-DF0ZYH7g.js} +1 -1
- package/dist/{useScrollToBlock-BMF0Dt5l.js → useScrollToBlock-CtM_ydOS.js} +2 -2
- package/dist/withCurrentFont-BOg3jmCT.js +18 -0
- package/dist/{x-CTKOxIyZ.js → x-C0X5MoK3.js} +1 -1
- package/package.json +22 -22
- package/dist/cdn/chunks/AiAltTextPopover-Dj-VLU88.js.map +0 -1
- package/dist/cdn/chunks/AiAltTextReview-tVkJPOk6.js.map +0 -1
- package/dist/cdn/chunks/AiChatPanel-CYPvHQGQ.js.map +0 -1
- package/dist/cdn/chunks/AiPanels-ChTLCmMS.js.map +0 -1
- package/dist/cdn/chunks/AiRewriteMenu-B23ozFnP.js.map +0 -1
- package/dist/cdn/chunks/BlockIssueBadge-BKO4Mr8f.js.map +0 -1
- package/dist/cdn/chunks/BlockPreviewCanvas-CaRneMZ8.js.map +0 -1
- package/dist/cdn/chunks/CloudHeaderExtras-O_K3jmgO.js.map +0 -1
- package/dist/cdn/chunks/CloudPanels-xAEirqNC.js.map +0 -1
- package/dist/cdn/chunks/CollaborationNotices-CwAoa-73.js.map +0 -1
- package/dist/cdn/chunks/CollaboratorBar-DdQQwtwd.js.map +0 -1
- package/dist/cdn/chunks/CommentsPanel-C8AKtxiG.js.map +0 -1
- package/dist/cdn/chunks/CommentsSidebar-FxY0RHSq.js.map +0 -1
- package/dist/cdn/chunks/CountdownBlock-DGgnPUlu.js.map +0 -1
- package/dist/cdn/chunks/CountdownToolbar-9PtYUgCW.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-Co-ffgWa.js.map +0 -1
- package/dist/cdn/chunks/LanguageMenu-Cl0ajnXZ.js.map +0 -1
- package/dist/cdn/chunks/LocaleNotices-BVDJ7kyj.js.map +0 -1
- package/dist/cdn/chunks/LogicTagInsertButton-DPYA8LJW.js.map +0 -1
- package/dist/cdn/chunks/MediaEditModal-CfgN7Jyi.js.map +0 -1
- package/dist/cdn/chunks/MediaPanels-Cb5vsgb-.js.map +0 -1
- package/dist/cdn/chunks/MergeTagInput-Cxfjq3tx.js.map +0 -1
- package/dist/cdn/chunks/MergeTagModeToggle-BmNGV3yc.js.map +0 -1
- package/dist/cdn/chunks/MergeTagTextarea-DmwrPAss.js.map +0 -1
- package/dist/cdn/chunks/ParagraphEditor-BoGELRr-.js.map +0 -1
- package/dist/cdn/chunks/RestoreVersionDialog-CaKiSq-9.js.map +0 -1
- package/dist/cdn/chunks/RichTextEditorContent-Dq4TROOg.js.map +0 -1
- package/dist/cdn/chunks/SaveBlockDialog-BAR0G4UO.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksBrowserModal-C-KYaLkQ.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksPanels-C3OF0EeB.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksPickBar-BnyPXw5W.js.map +0 -1
- package/dist/cdn/chunks/TemplateSettings-uoiUkd2l.js.map +0 -1
- package/dist/cdn/chunks/TestEmailModal-B9d3ZsH7.js.map +0 -1
- package/dist/cdn/chunks/TestEmailPanel--fPi6QjN.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-Cn4fnSpa.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-BzAuH2G4.js.map +0 -1
- package/dist/cdn/chunks/TplModal-jMfK19PC.js.map +0 -1
- package/dist/cdn/chunks/VersionHistoryMenu-DDqYMqC2.js.map +0 -1
- package/dist/cdn/chunks/VersionHistoryPanels-DJpySkvq.js.map +0 -1
- package/dist/cdn/chunks/VersionPreviewBanner-CYT5QUoc.js.map +0 -1
- package/dist/cdn/chunks/WrapperBlock-Bi9XgDmX.js.map +0 -1
- package/dist/cdn/chunks/ca-YfIxwO1G.js.map +0 -1
- package/dist/cdn/chunks/composables-Cp6gZ7qV.js.map +0 -1
- package/dist/cdn/chunks/da-CM6DCvRG.js.map +0 -1
- package/dist/cdn/chunks/de-Dugz1zXC.js.map +0 -1
- package/dist/cdn/chunks/editor-modal-CXSSZplR.js.map +0 -1
- package/dist/cdn/chunks/en-BykoFuFY.js.map +0 -1
- package/dist/cdn/chunks/en-DYMYt1TN.js +0 -1
- package/dist/cdn/chunks/es-DaWsTkpj.js.map +0 -1
- package/dist/cdn/chunks/extensions-BYJPv1sA.js.map +0 -1
- package/dist/cdn/chunks/fr-DqwQHtJo.js.map +0 -1
- package/dist/cdn/chunks/ja-BH4MS1Ye.js.map +0 -1
- package/dist/cdn/chunks/keys-DNv3xXxI.js +0 -11
- package/dist/cdn/chunks/keys-DNv3xXxI.js.map +0 -1
- package/dist/cdn/chunks/nl-BQl1_UHv.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-eyzmU9Vs.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-bvQ57o1m.js.map +0 -1
- package/dist/cdn/chunks/src-BRyzUujm.js.map +0 -1
- package/dist/cdn/chunks/src-CVHGPKSW.js.map +0 -1
- package/dist/cdn/chunks/src-aFRxbwqP.js +0 -707
- package/dist/cdn/chunks/src-aFRxbwqP.js.map +0 -1
- package/dist/cdn/chunks/tiptap-B7gxx0aJ.js.map +0 -1
- package/dist/cdn/chunks/useLocalizedDisplay-7iwZ1UhB.js +0 -33
- package/dist/dist-CkIeJEsa.js +0 -4
- package/dist/dist-eAgG-nCb.js +0 -4
- package/dist/en-DvCaYqiR.js +0 -1
- package/dist/keys-BeQy64On.js +0 -9
- package/dist/useLocalizedDisplay-9RqT2y_Y.js +0 -31
- package/dist/withCurrentFont-BXZ7g-K6.js +0 -18
package/dist/cdn/chunks/{normalizeMergeTagMarkup-nDyYIXvL.js → normalizeMergeTagMarkup-B81BAWKT.js}
RENAMED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as e, K as t, U as n, W as r, Xt as i, Zt as a, bn as o, gn as s, mn as c, rt as l, tt as u, yn as d } from "./src-BHgVGOTi.js";
|
|
2
2
|
// src/utils/normalizeMergeTagMarkup.ts
|
|
3
3
|
function f(e) {
|
|
4
4
|
let t = e.flags.includes("g") ? e.flags : `${e.flags}g`;
|
|
5
5
|
return new RegExp(e.source, t);
|
|
6
6
|
}
|
|
7
|
-
function p(
|
|
8
|
-
let o = [], s = a
|
|
9
|
-
|
|
10
|
-
let d = s ? null : f(
|
|
7
|
+
function p(r, i, a) {
|
|
8
|
+
let o = [], s = n(a) !== void 0, c = [], u = 0, d = (e, t, n, i) => {
|
|
9
|
+
t === "value" && (u = 0);
|
|
10
|
+
let d = s ? null : f(e), p = s ? l(r, a, t) : null, m = d?.exec(r) ?? null, h = 0;
|
|
11
11
|
for (; s ? h < p.length : m !== null;) {
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
12
|
+
let e = s ? p[h].index : m.index, a = s ? p[h].value : m[0], l = e + a.length;
|
|
13
|
+
if (a.length === 0) d.lastIndex++;
|
|
14
14
|
else {
|
|
15
|
-
if (
|
|
16
|
-
let
|
|
17
|
-
if (!
|
|
18
|
-
let
|
|
19
|
-
start:
|
|
20
|
-
end:
|
|
21
|
-
attr:
|
|
22
|
-
value:
|
|
23
|
-
label: a
|
|
15
|
+
if (t === "value") for (; c[u]?.end <= e;) u++;
|
|
16
|
+
let r = t === "value" ? c[u] : o[o.length - 1];
|
|
17
|
+
if (!r || e >= r.end || l <= r.start) {
|
|
18
|
+
let r = {
|
|
19
|
+
start: e,
|
|
20
|
+
end: l,
|
|
21
|
+
attr: n,
|
|
22
|
+
value: a,
|
|
23
|
+
label: i(a)
|
|
24
24
|
};
|
|
25
|
-
o.push(
|
|
25
|
+
o.push(r), t === "logic" && c.push(r);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
s ? h++ : m = d.exec(
|
|
28
|
+
s ? h++ : m = d.exec(r);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
return d(
|
|
31
|
+
return d(a.logic, "logic", "data-logic-merge-tag", (t) => e(t, a)), d(a.value, "value", "data-merge-tag", (e) => t(e, i)), o.sort((e, t) => e.start - t.start);
|
|
32
32
|
}
|
|
33
33
|
function m(e) {
|
|
34
34
|
let t = e.createTreeWalker(e.body, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, { acceptNode(e) {
|
|
@@ -40,20 +40,20 @@ function m(e) {
|
|
|
40
40
|
return n;
|
|
41
41
|
}
|
|
42
42
|
function h(e, t, n) {
|
|
43
|
-
if (!e || !
|
|
44
|
-
let
|
|
45
|
-
for (let e of m(
|
|
46
|
-
let
|
|
43
|
+
if (!e || !r(e, n) || typeof DOMParser > "u") return e;
|
|
44
|
+
let i = new DOMParser().parseFromString(`<!doctype html><body>${e}</body>`, "text/html"), a = 0;
|
|
45
|
+
for (let e of m(i)) {
|
|
46
|
+
let r = e.data, o = p(r, t, n);
|
|
47
47
|
if (o.length === 0) continue;
|
|
48
|
-
let s =
|
|
48
|
+
let s = i.createDocumentFragment(), c = 0;
|
|
49
49
|
for (let e of o) {
|
|
50
|
-
e.start > c && s.appendChild(
|
|
51
|
-
let t =
|
|
50
|
+
e.start > c && s.appendChild(i.createTextNode(r.substring(c, e.start)));
|
|
51
|
+
let t = i.createElement("span");
|
|
52
52
|
t.setAttribute(e.attr, e.value), t.textContent = e.label, s.appendChild(t), c = e.end;
|
|
53
53
|
}
|
|
54
|
-
c <
|
|
54
|
+
c < r.length && s.appendChild(i.createTextNode(r.substring(c))), e.parentNode?.replaceChild(s, e), a += o.length;
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return a === 0 ? e : i.body.innerHTML;
|
|
57
57
|
}
|
|
58
58
|
function g(e, t, n, r) {
|
|
59
59
|
if (e !== "title" && e !== "paragraph" && e !== "html" || typeof t?.content?.value != "string") return t;
|
|
@@ -141,13 +141,13 @@ function v(e, t, n) {
|
|
|
141
141
|
} : e;
|
|
142
142
|
}
|
|
143
143
|
function y(e, t) {
|
|
144
|
-
return v(x(e), t?.tags ?? [],
|
|
144
|
+
return v(x(e), t?.tags ?? [], u(t?.syntax));
|
|
145
145
|
}
|
|
146
146
|
function b(e, t) {
|
|
147
|
-
return _(e, t?.tags ?? [],
|
|
147
|
+
return _(e, t?.tags ?? [], u(t?.syntax));
|
|
148
148
|
}
|
|
149
149
|
function x(e) {
|
|
150
|
-
return typeof e == "object" && e ?
|
|
150
|
+
return typeof e == "object" && e ? o(e) : e;
|
|
151
151
|
}
|
|
152
152
|
function S(e, t) {
|
|
153
153
|
return {
|
|
@@ -194,14 +194,14 @@ function T(e, t) {
|
|
|
194
194
|
let r = e.type === "section" ? n.flat() : n;
|
|
195
195
|
for (let e of r) e && typeof e == "object" && T(e, t);
|
|
196
196
|
}
|
|
197
|
-
function E(t, n
|
|
198
|
-
let
|
|
197
|
+
function E(e, t, n) {
|
|
198
|
+
let r = n?.tags ?? [], l = u(n?.syntax), f = /* @__PURE__ */ new Map(), p = e.some((e) => e.op === "updateBlockLocale"), m = o(t), y = o(t), b = (e, t, n) => {
|
|
199
199
|
try {
|
|
200
|
-
if (!("expect" in
|
|
201
|
-
let { expect:
|
|
202
|
-
return e
|
|
200
|
+
if (!("expect" in t)) return a(e, [t]);
|
|
201
|
+
let { expect: n, ...r } = t;
|
|
202
|
+
return a(e, [r]);
|
|
203
203
|
} catch (e) {
|
|
204
|
-
throw e instanceof
|
|
204
|
+
throw e instanceof i ? new i(e.code, n, e.message, e.blockId) : e;
|
|
205
205
|
}
|
|
206
206
|
}, x = (e, t) => {
|
|
207
207
|
let n = (e) => {
|
|
@@ -215,31 +215,31 @@ function E(t, n, a) {
|
|
|
215
215
|
return n(e?.blocks);
|
|
216
216
|
}, S = (e, t, n, r) => {
|
|
217
217
|
if (!e) return e;
|
|
218
|
-
let
|
|
219
|
-
for (let [
|
|
220
|
-
if (!
|
|
221
|
-
let e = r ? t?.l10n?.[r]?.text?.[
|
|
222
|
-
p !==
|
|
223
|
-
...
|
|
224
|
-
[
|
|
225
|
-
...
|
|
218
|
+
let i = e;
|
|
219
|
+
for (let [a, o] of Object.entries(e)) {
|
|
220
|
+
if (!o) continue;
|
|
221
|
+
let e = r ? t?.l10n?.[r]?.text?.[a] : void 0, l = r ? n?.l10n?.[r]?.text?.[a] : void 0, u = c(t, a), f = c(n, a), p = e && l && d(o, e) ? l.sourceHash : typeof u == "string" && typeof f == "string" && o.sourceHash === s(u) ? s(f) : o.sourceHash;
|
|
222
|
+
p !== o.sourceHash && (i = {
|
|
223
|
+
...i,
|
|
224
|
+
[a]: {
|
|
225
|
+
...o,
|
|
226
226
|
sourceHash: p
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
return
|
|
230
|
+
return i;
|
|
231
231
|
}, C = !1, E = (e) => {
|
|
232
232
|
if (e.op === "addBlock") {
|
|
233
233
|
if (!e.block || typeof e.block != "object") return e;
|
|
234
234
|
T(e.block, f);
|
|
235
|
-
let t = _(e.block,
|
|
235
|
+
let t = _(e.block, r, l);
|
|
236
236
|
return t === e.block ? e : (C = !0, {
|
|
237
237
|
...e,
|
|
238
238
|
block: t
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
if (e.op === "deleteBlock" && e.expect?.block) {
|
|
242
|
-
let t = _(e.expect.block,
|
|
242
|
+
let t = _(e.expect.block, r, l);
|
|
243
243
|
return t === e.expect.block ? e : (C = !0, {
|
|
244
244
|
...e,
|
|
245
245
|
expect: {
|
|
@@ -249,13 +249,13 @@ function E(t, n, a) {
|
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
if (e.op === "updateBlockLocale") {
|
|
252
|
-
let t = f.get(e.blockId) ?? w(m?.blocks, e.blockId), n = x(m, e.blockId),
|
|
252
|
+
let t = f.get(e.blockId) ?? w(m?.blocks, e.blockId), n = x(m, e.blockId), i = x(y, e.blockId), a = g(t, S(e.text, n, i), r, l), o = g(t, S(e.expect?.text, n, i, e.locale), r, l), s = e.expect && o !== e.expect.text ? {
|
|
253
253
|
...e.expect,
|
|
254
|
-
text:
|
|
254
|
+
text: o
|
|
255
255
|
} : e.expect;
|
|
256
|
-
return
|
|
256
|
+
return a === e.text && s === e.expect ? e : (C = !0, {
|
|
257
257
|
...e,
|
|
258
|
-
...
|
|
258
|
+
...a ? { text: a } : {},
|
|
259
259
|
...s ? { expect: s } : {}
|
|
260
260
|
});
|
|
261
261
|
}
|
|
@@ -264,28 +264,28 @@ function E(t, n, a) {
|
|
|
264
264
|
if (t !== "title" && t !== "paragraph") return e;
|
|
265
265
|
let n = (e) => {
|
|
266
266
|
if (typeof e?.content != "string") return e;
|
|
267
|
-
let t = h(e.content,
|
|
267
|
+
let t = h(e.content, r, l);
|
|
268
268
|
return t === e.content ? e : {
|
|
269
269
|
...e,
|
|
270
270
|
content: t
|
|
271
271
|
};
|
|
272
|
-
},
|
|
273
|
-
return
|
|
272
|
+
}, i = n(e.set), a = n(e.expect);
|
|
273
|
+
return i === e.set && a === e.expect ? e : (C = !0, {
|
|
274
274
|
...e,
|
|
275
|
-
...
|
|
276
|
-
...
|
|
275
|
+
...i ? { set: i } : {},
|
|
276
|
+
...a ? { expect: a } : {}
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
if (e.op === "setContent") {
|
|
280
280
|
f.clear();
|
|
281
|
-
let t = v(e.content,
|
|
281
|
+
let t = v(e.content, r, l);
|
|
282
282
|
return t === e.content ? e : (C = !0, {
|
|
283
283
|
...e,
|
|
284
284
|
content: t
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
return e;
|
|
288
|
-
}, D =
|
|
288
|
+
}, D = e.map((e, t) => {
|
|
289
289
|
let n = E(e);
|
|
290
290
|
if (p) {
|
|
291
291
|
let r = b(m, e, t), i = b(y, n, t);
|
|
@@ -293,8 +293,8 @@ function E(t, n, a) {
|
|
|
293
293
|
} else e.op === "setContent" && (m = e.content);
|
|
294
294
|
return n;
|
|
295
295
|
});
|
|
296
|
-
return C ? D :
|
|
296
|
+
return C ? D : e;
|
|
297
297
|
}
|
|
298
298
|
export { S as a, E as i, y as n, C as o, h as r, b as t };
|
|
299
299
|
|
|
300
|
-
//# sourceMappingURL=normalizeMergeTagMarkup-
|
|
300
|
+
//# sourceMappingURL=normalizeMergeTagMarkup-B81BAWKT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeMergeTagMarkup-nDyYIXvL.js","names":["applyOperations","getLogicMergeTagKeyword","getMergeTagLabel","OperationError","readPath","builtInPresetOf","containsMergeTag","sourceHash","safeClone","deepEqual","scanSyntaxMatches","resolveSyntax","globalRegex","flags","pattern","collectHits","hits","builtin","syntax","logicHits","logicIndex","scan","kind","regex","matches","text","match","index","start","value","end","other","hit","label","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","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 builtInPresetOf,\n sourceHash,\n readPath,\n deepEqual,\n applyOperations,\n containsMergeTag,\n getLogicMergeTagKeyword,\n getMergeTagLabel,\n OperationError,\n resolveSyntax,\n safeClone,\n scanSyntaxMatches,\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\nexport function collectHits(\n text: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TagHit[] {\n const hits: TagHit[] = [];\n const builtin = builtInPresetOf(syntax) !== undefined;\n const logicHits: TagHit[] = [];\n let logicIndex = 0;\n\n const scan = (\n pattern: RegExp,\n kind: \"logic\" | \"value\",\n attr: string,\n label: (match: string) => string,\n ): void => {\n if (kind === \"value\") logicIndex = 0;\n const regex = builtin ? null : globalRegex(pattern);\n const matches = builtin ? scanSyntaxMatches(text, syntax, kind) : null;\n let match = regex?.exec(text) ?? null;\n let index = 0;\n while (builtin ? index < matches!.length : match !== null) {\n const start = builtin ? matches![index].index : match!.index;\n const value = builtin ? matches![index].value : match![0];\n const end = start + value.length;\n if (value.length === 0) {\n regex!.lastIndex++;\n } else {\n if (kind === \"value\") {\n while (logicHits[logicIndex]?.end <= start) logicIndex++;\n }\n const other =\n kind === \"value\" ? logicHits[logicIndex] : hits[hits.length - 1];\n if (!other || start >= other.end || end <= other.start) {\n const hit = {\n start,\n end,\n attr,\n value,\n label: label(value),\n };\n hits.push(hit);\n if (kind === \"logic\") logicHits.push(hit);\n }\n }\n if (builtin) index++;\n else 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, \"logic\", \"data-logic-merge-tag\", (value) =>\n getLogicMergeTagKeyword(value, syntax),\n );\n scan(syntax.value, \"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":";;AAgFA,SAASY,EAAY,GAAyB;CAC5C,IAAMC,IAAQC,EAAQ,MAAM,SAAS,GAAG,IACpCA,EAAQ,QACR,GAAGA,EAAQ,MAAM;CACrB,OAAO,IAAI,OAAOA,EAAQ,QAAQD,CAAK;AACzC;AAEA,SAAgBE,EACd,GACA,GACA,GACU;CACV,IAAMC,IAAiB,CAAC,GAClBC,IAAUZ,EAAgBa,CAAM,MAAM,KAAA,GACtCC,IAAsB,CAAC,GACzBC,IAAa,GAEXC,KACJ,GACA,GACA,GACA,MACS;EACT,AAAIC,MAAS,YAAS,IAAa;EACnC,IAAMC,IAAQN,IAAU,OAAOL,EAAYE,CAAO,GAC5CU,IAAUP,IAAUP,EAAkBe,GAAMP,GAAQI,CAAI,IAAI,MAC9DI,IAAQH,GAAO,KAAKE,CAAI,KAAK,MAC7BE,IAAQ;EACZ,OAAOV,IAAUU,IAAQH,EAAS,SAASE,MAAU,OAAM;GACzD,IAAME,IAAQX,IAAUO,EAASG,EAAM,CAAC,QAAQD,EA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,IAAItB,EAAG,OAAO,cAAc;GAC1B,EAAM,MAAM;GACZ,IAAM5B,IAAaM,EAAwBsB,EAAG,SAASJ,GAAMrE,CAAM;GAGnE,OAFI6C,MAAe4B,EAAG,UAAgBA,KACtC,IAAU,IACH;IAAE,GAAGA;IAAI,SAAS5B;GAAW;EACtC;EACA,OAAO4B;CACT,GACMlC,IAAOiC,EAAI,KAAK,GAAI,MAAU;EAClC,IAAM3B,IAAa+C,EAAanB,CAAE;EAClC,IAAIF,GAAkB;GAGpB,IAAM4B,IAAevB,EAAQF,GAAUD,GAAIhE,CAAK,GAC1C2F,IAAiBxB,EAAQD,GAAiB9B,GAAYpC,CAAK;GAEjE,AADA,IAAW0F,GACX,IAAkBC;EACpB,OAAO,AAAI3B,EAAG,OAAO,iBAGnB,IAAWA,EAAG;EAEhB,OAAO5B;CACT,CAAC;CAED,OAAOP,IAAUC,IAAQiC;AAC3B"}
|
|
1
|
+
{"version":3,"file":"normalizeMergeTagMarkup-B81BAWKT.js","names":["getLogicMergeTagKeyword","getMergeTagLabel","builtInPresetOf","containsMergeTag","OperationError","applyOperations","safeClone","sourceHash","readPath","scanSyntaxMatches","resolveSyntax","deepEqual","globalRegex","flags","pattern","collectHits","hits","builtin","syntax","logicHits","logicIndex","scan","kind","regex","matches","text","match","index","start","value","end","other","hit","label","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","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 builtInPresetOf,\n sourceHash,\n readPath,\n deepEqual,\n applyOperations,\n containsMergeTag,\n getLogicMergeTagKeyword,\n getMergeTagLabel,\n OperationError,\n resolveSyntax,\n safeClone,\n scanSyntaxMatches,\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\nexport function collectHits(\n text: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TagHit[] {\n const hits: TagHit[] = [];\n const builtin = builtInPresetOf(syntax) !== undefined;\n const logicHits: TagHit[] = [];\n let logicIndex = 0;\n\n const scan = (\n pattern: RegExp,\n kind: \"logic\" | \"value\",\n attr: string,\n label: (match: string) => string,\n ): void => {\n if (kind === \"value\") logicIndex = 0;\n const regex = builtin ? null : globalRegex(pattern);\n const matches = builtin ? scanSyntaxMatches(text, syntax, kind) : null;\n let match = regex?.exec(text) ?? null;\n let index = 0;\n while (builtin ? index < matches!.length : match !== null) {\n const start = builtin ? matches![index].index : match!.index;\n const value = builtin ? matches![index].value : match![0];\n const end = start + value.length;\n if (value.length === 0) {\n regex!.lastIndex++;\n } else {\n if (kind === \"value\") {\n while (logicHits[logicIndex]?.end <= start) logicIndex++;\n }\n const other =\n kind === \"value\" ? logicHits[logicIndex] : hits[hits.length - 1];\n if (!other || start >= other.end || end <= other.start) {\n const hit = {\n start,\n end,\n attr,\n value,\n label: label(value),\n };\n hits.push(hit);\n if (kind === \"logic\") logicHits.push(hit);\n }\n }\n if (builtin) index++;\n else 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, \"logic\", \"data-logic-merge-tag\", (value) =>\n getLogicMergeTagKeyword(value, syntax),\n );\n scan(syntax.value, \"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":";;AAgFA,SAASY,EAAY,GAAyB;CAC5C,IAAMC,IAAQC,EAAQ,MAAM,SAAS,GAAG,IACpCA,EAAQ,QACR,GAAGA,EAAQ,MAAM;CACrB,OAAO,IAAI,OAAOA,EAAQ,QAAQD,CAAK;AACzC;AAEA,SAAgBE,EACd,GACA,GACA,GACU;CACV,IAAMC,IAAiB,CAAC,GAClBC,IAAUf,EAAgBgB,CAAM,MAAM,KAAA,GACtCC,IAAsB,CAAC,GACzBC,IAAa,GAEXC,KACJ,GACA,GACA,GACA,MACS;EACT,AAAIC,MAAS,YAAS,IAAa;EACnC,IAAMC,IAAQN,IAAU,OAAOL,EAAYE,CAAO,GAC5CU,IAAUP,IAAUR,EAAkBgB,GAAMP,GAAQI,CAAI,IAAI,MAC9DI,IAAQH,GAAO,KAAKE,CAAI,KAAK,MAC7BE,IAAQ;EACZ,OAAOV,IAAUU,IAAQH,EAAS,SAASE,MAAU,OAAM;GACzD,IAAME,IAAQX,IAAUO,EAASG,EAAM,CAAC,QAAQD,EAAO,OACjDG,IAAQZ,IAAUO,EAASG,EAAM,CAAC,QAAQD,EAAO,IACjDI,IAAMF,IAAQC,EAAM;GAC1B,IAAIA,EAAM,WAAW,GACnB,EAAO;QACF;IACL,IAAIP,MAAS,SACX,OAAOH,EAAUC,EAAW,EAAE,OAAOQ,IAAO;IAE9C,IAAMG,IACJT,MAAS,UAAUH,EAAUC,KAAcJ,EAAKA,EAAK,SAAS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AClC,IAAM3B,IAAa+C,EAAanB,CAAE;EAClC,IAAIF,GAAkB;GAGpB,IAAM4B,IAAevB,EAAQF,GAAUD,GAAIhE,CAAK,GAC1C2F,IAAiBxB,EAAQD,GAAiB9B,GAAYpC,CAAK;GAEjE,AADA,IAAW0F,GACX,IAAkBC;EACpB,OAAO,AAAI3B,EAAG,OAAO,iBAGnB,IAAWA,EAAG;EAEhB,OAAO5B;CACT,CAAC;CAED,OAAOP,IAAUC,IAAQiC;AAC3B"}
|
package/dist/{preRenderCustomBlocks-CgPtlLGL.js → cdn/chunks/preRenderCustomBlocks-CQuaMxuv.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as e, Tt as t, yt as n } from "./src-BHgVGOTi.js";
|
|
2
2
|
// src/utils/preRenderCustomBlocks.ts
|
|
3
3
|
async function r(r, i) {
|
|
4
4
|
let a = async (r) => {
|
|
@@ -18,3 +18,5 @@ async function r(r, i) {
|
|
|
18
18
|
for (let e of r.blocks) await a(e);
|
|
19
19
|
}
|
|
20
20
|
export { r as t };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=preRenderCustomBlocks-CQuaMxuv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preRenderCustomBlocks-
|
|
1
|
+
{"version":3,"file":"preRenderCustomBlocks-CQuaMxuv.js","names":["isWrapper","isSection","isCustomBlock","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,IAAIF,EAAcG,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,IAAIL,EAAUI,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"}
|
|
@@ -245,6 +245,9 @@ var e = {
|
|
|
245
245
|
ratio13: "Proporção 1:3",
|
|
246
246
|
ratio31: "Proporção 3:1",
|
|
247
247
|
ratio121: "Proporção 1:2:1",
|
|
248
|
+
columnsCustom: "Personalizado",
|
|
249
|
+
columnWidths: "Larguras das colunas",
|
|
250
|
+
columnWidthAria: "Largura da coluna {index}",
|
|
248
251
|
borderRadius: "Arredondamento das Bordas",
|
|
249
252
|
wrapperEnable: "Adicionar wrapper",
|
|
250
253
|
wrapperLayoutConflict: "Este editor já emoldura o e-mail. Um quadro extra nesta seção não é suportado — a visualização e a exportação falharão.",
|
|
@@ -344,6 +347,7 @@ var e = {
|
|
|
344
347
|
textColor: "Cor do Texto",
|
|
345
348
|
borderRadius: "Arredondamento das Bordas",
|
|
346
349
|
fontSize: "Tamanho da Fonte",
|
|
350
|
+
lineHeight: "Altura da Linha",
|
|
347
351
|
fontWeight: "Peso",
|
|
348
352
|
fontWeightRegular: "Comum",
|
|
349
353
|
fontWeightMedium: "Médio",
|
|
@@ -351,7 +355,8 @@ var e = {
|
|
|
351
355
|
width: "Largura",
|
|
352
356
|
widthAuto: "Ajustar ao conteúdo",
|
|
353
357
|
fullWidth: "Largura Total",
|
|
354
|
-
widthCustom: "Personalizada"
|
|
358
|
+
widthCustom: "Personalizada",
|
|
359
|
+
widthUnit: "Unidade de largura"
|
|
355
360
|
},
|
|
356
361
|
divider: {
|
|
357
362
|
style: "Estilo",
|
|
@@ -947,3 +952,5 @@ var e = {
|
|
|
947
952
|
}
|
|
948
953
|
};
|
|
949
954
|
export { e as default };
|
|
955
|
+
|
|
956
|
+
//# sourceMappingURL=pt-BR-_jsX1xLv.js.map
|