@templatical/editor 0.43.3 → 0.44.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/{AiChatSidebar-BAAypLEP.js → AiChatSidebar-BUR5Jshu.js} +8 -8
- package/dist/{AiFeatureMenu-CQcrDR-J.js → AiFeatureMenu-CgfLFHJw.js} +4 -4
- package/dist/{BlockIssueBadge-DYI7ic1j.js → BlockIssueBadge-CWZEwMXX.js} +2 -2
- package/dist/{BlockPreviewCanvas-x5W-Sdhg.js → BlockPreviewCanvas-2vVu55yN.js} +3 -3
- package/dist/{CloudHeaderExtras-DnLaX4ea.js → CloudHeaderExtras-BZ62q1aS.js} +2 -2
- package/dist/{CloudPanels-BHPG3d1o.js → CloudPanels-sv4aCKKE.js} +4 -4
- package/dist/{CollaboratorBar-DG6KroMt.js → CollaboratorBar-CSEFL7uC.js} +2 -2
- package/dist/{CommentsPanel-Bzk6VhJg.js → CommentsPanel-CYMHfFcn.js} +1 -1
- package/dist/{CommentsSidebar-CaRC3c1b.js → CommentsSidebar-uvQyCMUe.js} +10 -10
- package/dist/{CountdownToolbar-B-pAigUh.js → CountdownToolbar-C052mx2P.js} +3 -3
- package/dist/{DesignReferenceSidebar-DfuJyDBz.js → DesignReferenceSidebar-ZKJ7y7-G.js} +6 -6
- package/dist/{IssuesPanel-vWhcDIvb.js → IssuesPanel-DAlNiJX_.js} +5 -5
- package/dist/{LogicTagInsertButton-D2Fjo444.js → LogicTagInsertButton-DMUfVsPr.js} +6 -6
- package/dist/{MediaEditModal-BuP8SJrv.js → MediaEditModal-Cmd9tQXZ.js} +1 -1
- package/dist/{MediaPanels-BkcF0r_r.js → MediaPanels-DoBhG5gg.js} +1 -1
- package/dist/{MergeTagInput-fEOOY7OU.js → MergeTagInput-DoQWMSW4.js} +1 -1
- package/dist/{MergeTagModeToggle-BOeEL52u.js → MergeTagModeToggle-DOHixe4G.js} +4 -4
- package/dist/{ParagraphEditor-BlJGeBRY.js → ParagraphEditor-C_p6yKLK.js} +10 -10
- package/dist/{RestoreVersionDialog-DYaoFk5G.js → RestoreVersionDialog-CKHeCPG2.js} +3 -3
- package/dist/{RichTextEditorContent-GacK8qwu.js → RichTextEditorContent-BedBVHXS.js} +4 -4
- package/dist/{SaveBlockDialog-DR1UCtQY.js → SaveBlockDialog-q3_fjb9t.js} +8 -8
- package/dist/{SavedBlocksBrowserModal-q_-qYW9a.js → SavedBlocksBrowserModal-C4J-_cW8.js} +9 -9
- package/dist/{SavedBlocksPanels-nTH8NTAT.js → SavedBlocksPanels-DBoqC6df.js} +1 -1
- package/dist/{SavedBlocksPickBar-C7vHmc5c.js → SavedBlocksPickBar-Pq2bjpB_.js} +2 -2
- package/dist/{TemplateScoringPanel-D9jeQCYl.js → TemplateScoringPanel-DXsyp0_A.js} +11 -11
- package/dist/{TemplateSettings-ClfHwxUa.js → TemplateSettings-Bh10NFIN.js} +6 -6
- package/dist/{TestEmailModal-DEnvrv38.js → TestEmailModal-BYCKpH7g.js} +7 -7
- package/dist/{TestEmailPanel-Ca9t6KG7.js → TestEmailPanel-lUXAFsT5.js} +1 -1
- package/dist/{TitleEditor-D7mNs3s5.js → TitleEditor-CWPxXUp2.js} +6 -6
- package/dist/{ToggleSwitch-Z-rqEcig.js → ToggleSwitch-D7GLaT8s.js} +1 -1
- package/dist/{Toolbar-DUgyDBkz.js → Toolbar-CWxqqBHE.js} +21 -21
- package/dist/{TplModal-CYyFAScB.js → TplModal-D6lqrKls.js} +1 -1
- package/dist/{VersionHistoryMenu-D42tGKM6.js → VersionHistoryMenu-fLrx-Lvi.js} +5 -5
- package/dist/{VersionHistoryPanels-o0HGvQJX.js → VersionHistoryPanels-C3XhpQO_.js} +1 -1
- package/dist/{VersionPreviewBanner-D5RZtvUf.js → VersionPreviewBanner-CWuxq_bb.js} +1 -1
- package/dist/{WrapperBlock-B0_vSfSD.js → WrapperBlock-ox8TMS_p.js} +1 -1
- package/dist/{blockTypeIcons-CEk_GHmU.js → blockTypeIcons-DEvNVvBj.js} +2 -2
- package/dist/bundle-stats.json +5 -5
- package/dist/cdn/chunks/{AiChatSidebar-oFwacME4.js → AiChatSidebar-Cvp9beXR.js} +3 -3
- package/dist/cdn/chunks/{AiChatSidebar-oFwacME4.js.map → AiChatSidebar-Cvp9beXR.js.map} +1 -1
- package/dist/cdn/chunks/{AiFeatureMenu-BiHFJf9i.js → AiFeatureMenu-vOJtwdmT.js} +3 -3
- package/dist/cdn/chunks/{AiFeatureMenu-BiHFJf9i.js.map → AiFeatureMenu-vOJtwdmT.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-CWlcDBFm.js → BlockIssueBadge-CKIrYROg.js} +2 -2
- package/dist/cdn/chunks/{BlockIssueBadge-CWlcDBFm.js.map → BlockIssueBadge-CKIrYROg.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-CIwIA3zq.js → BlockPreviewCanvas-CB27Joyn.js} +4 -4
- package/dist/cdn/chunks/{BlockPreviewCanvas-CIwIA3zq.js.map → BlockPreviewCanvas-CB27Joyn.js.map} +1 -1
- package/dist/cdn/chunks/{CloudHeaderExtras-BgsjwWUQ.js → CloudHeaderExtras-9tKrhPm6.js} +3 -3
- package/dist/cdn/chunks/{CloudHeaderExtras-BgsjwWUQ.js.map → CloudHeaderExtras-9tKrhPm6.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-DFCwq8_J.js → CloudPanels-DTQ7zbEN.js} +4 -4
- package/dist/cdn/chunks/{CloudPanels-DFCwq8_J.js.map → CloudPanels-DTQ7zbEN.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-CiMZfMwN.js → CollaboratorBar-BKTkVMbz.js} +3 -3
- package/dist/cdn/chunks/{CollaboratorBar-CiMZfMwN.js.map → CollaboratorBar-BKTkVMbz.js.map} +1 -1
- package/dist/cdn/chunks/{CommentsPanel-CL4grbMp.js → CommentsPanel-BjHRj_Yw.js} +2 -2
- package/dist/cdn/chunks/{CommentsPanel-CL4grbMp.js.map → CommentsPanel-BjHRj_Yw.js.map} +1 -1
- package/dist/cdn/chunks/{CommentsSidebar-tWYYKv1s.js → CommentsSidebar-CpCfqSq4.js} +2 -2
- package/dist/cdn/chunks/{CommentsSidebar-tWYYKv1s.js.map → CommentsSidebar-CpCfqSq4.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-DfyqIppF.js → CountdownToolbar-C9QpHQcv.js} +4 -4
- package/dist/cdn/chunks/{CountdownToolbar-DfyqIppF.js.map → CountdownToolbar-C9QpHQcv.js.map} +1 -1
- package/dist/cdn/chunks/{DesignReferenceSidebar-C6O12hvt.js → DesignReferenceSidebar-BO0xz1wC.js} +3 -3
- package/dist/cdn/chunks/{DesignReferenceSidebar-C6O12hvt.js.map → DesignReferenceSidebar-BO0xz1wC.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-DYJXIwnw.js → IssuesPanel--62qud8w.js} +2 -2
- package/dist/cdn/chunks/{IssuesPanel-DYJXIwnw.js.map → IssuesPanel--62qud8w.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-FNMVxm_V.js → LogicTagInsertButton-gc8ICURV.js} +5 -5
- package/dist/cdn/chunks/{LogicTagInsertButton-FNMVxm_V.js.map → LogicTagInsertButton-gc8ICURV.js.map} +1 -1
- package/dist/cdn/chunks/{MediaEditModal-C9yZ0AJv.js → MediaEditModal-BuDXKwx4.js} +2 -2
- package/dist/cdn/chunks/{MediaEditModal-C9yZ0AJv.js.map → MediaEditModal-BuDXKwx4.js.map} +1 -1
- package/dist/cdn/chunks/{MediaPanels-DiKU1r9P.js → MediaPanels-xFpaxFRH.js} +2 -2
- package/dist/cdn/chunks/{MediaPanels-DiKU1r9P.js.map → MediaPanels-xFpaxFRH.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-CSC64xNL.js → MergeTagInput-DsPKWbWr.js} +2 -2
- package/dist/cdn/chunks/{MergeTagInput-CSC64xNL.js.map → MergeTagInput-DsPKWbWr.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-027RMXDP.js → MergeTagModeToggle-DU0WqgVH.js} +3 -3
- package/dist/cdn/chunks/{MergeTagModeToggle-027RMXDP.js.map → MergeTagModeToggle-DU0WqgVH.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-0Z26-N5u.js → ParagraphEditor-BSDGOsja.js} +10 -10
- package/dist/cdn/chunks/{ParagraphEditor-0Z26-N5u.js.map → ParagraphEditor-BSDGOsja.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-Dd1v1KLK.js → RestoreVersionDialog-DLe0Co57.js} +3 -3
- package/dist/cdn/chunks/{RestoreVersionDialog-Dd1v1KLK.js.map → RestoreVersionDialog-DLe0Co57.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-BOZ_5I76.js → RichTextEditorContent-Dkcts8Vh.js} +4 -4
- package/dist/cdn/chunks/{RichTextEditorContent-BOZ_5I76.js.map → RichTextEditorContent-Dkcts8Vh.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-B6WQwNJD.js → SaveBlockDialog-DQzaED8U.js} +7 -7
- package/dist/cdn/chunks/{SaveBlockDialog-B6WQwNJD.js.map → SaveBlockDialog-DQzaED8U.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-C015fVMV.js → SavedBlocksBrowserModal-D3JF-Gx-.js} +6 -6
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-C015fVMV.js.map → SavedBlocksBrowserModal-D3JF-Gx-.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-DZmfXW4x.js → SavedBlocksPanels-Cxbgby24.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-DZmfXW4x.js.map → SavedBlocksPanels-Cxbgby24.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-DtCQFCCW.js → SavedBlocksPickBar-DEL0r3Bv.js} +3 -3
- package/dist/cdn/chunks/{SavedBlocksPickBar-DtCQFCCW.js.map → SavedBlocksPickBar-DEL0r3Bv.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateScoringPanel-CeCVyNV1.js → TemplateScoringPanel-BBRHCNcR.js} +2 -2
- package/dist/cdn/chunks/{TemplateScoringPanel-CeCVyNV1.js.map → TemplateScoringPanel-BBRHCNcR.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-CuXwthI6.js → TemplateSettings-vsFOU0oA.js} +5 -5
- package/dist/cdn/chunks/{TemplateSettings-CuXwthI6.js.map → TemplateSettings-vsFOU0oA.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-DV1XKWRh.js → TestEmailModal-B7Dr2eFa.js} +7 -7
- package/dist/cdn/chunks/{TestEmailModal-DV1XKWRh.js.map → TestEmailModal-B7Dr2eFa.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-CnVW00RI.js → TestEmailPanel-C3PTYDbT.js} +2 -2
- package/dist/cdn/chunks/{TestEmailPanel-CnVW00RI.js.map → TestEmailPanel-C3PTYDbT.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-B9sKbRd4.js → TitleEditor-gHTla_4I.js} +5 -5
- package/dist/cdn/chunks/{TitleEditor-B9sKbRd4.js.map → TitleEditor-gHTla_4I.js.map} +1 -1
- package/dist/cdn/chunks/{ToggleSwitch-eHkFBx4o.js → ToggleSwitch-DoUNcLPP.js} +2 -2
- package/dist/cdn/chunks/{ToggleSwitch-eHkFBx4o.js.map → ToggleSwitch-DoUNcLPP.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-DeKbYejp.js → Toolbar-CnfNUkOY.js} +9 -9
- package/dist/cdn/chunks/{Toolbar-DeKbYejp.js.map → Toolbar-CnfNUkOY.js.map} +1 -1
- package/dist/cdn/chunks/{TplModal-Dqq-Ermd.js → TplModal-BVUBOEQL.js} +2 -2
- package/dist/cdn/chunks/{TplModal-Dqq-Ermd.js.map → TplModal-BVUBOEQL.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-Kf4QFm7m.js → VersionHistoryMenu-Cp3EHO_P.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryMenu-Kf4QFm7m.js.map → VersionHistoryMenu-Cp3EHO_P.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-Cz8rde-s.js → VersionHistoryPanels-Dcdy7ySA.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryPanels-Cz8rde-s.js.map → VersionHistoryPanels-Dcdy7ySA.js.map} +1 -1
- package/dist/cdn/chunks/{VersionPreviewBanner-DNYHqbj9.js → VersionPreviewBanner-BgkroXnG.js} +2 -2
- package/dist/cdn/chunks/{VersionPreviewBanner-DNYHqbj9.js.map → VersionPreviewBanner-BgkroXnG.js.map} +1 -1
- package/dist/cdn/chunks/{WrapperBlock-DIZHUwFn.js → WrapperBlock-23nAzweL.js} +2 -2
- package/dist/cdn/chunks/{WrapperBlock-DIZHUwFn.js.map → WrapperBlock-23nAzweL.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-hgzxMFWX.js → blockTypeIcons-BMZi7sdX.js} +2 -2
- package/dist/cdn/chunks/{blockTypeIcons-hgzxMFWX.js.map → blockTypeIcons-BMZi7sdX.js.map} +1 -1
- package/dist/cdn/chunks/{cloud-De-eh1u6.js → cloud-DLQU5l0Z.js} +2 -2
- package/dist/cdn/chunks/{cloud-De-eh1u6.js.map → cloud-DLQU5l0Z.js.map} +1 -1
- package/dist/cdn/chunks/{createCloudRuntime-DsaUaWvr.js → createCloudRuntime-Mnx8kV2W.js} +3 -3
- package/dist/cdn/chunks/{createCloudRuntime-DsaUaWvr.js.map → createCloudRuntime-Mnx8kV2W.js.map} +1 -1
- package/dist/cdn/chunks/{editor-modal-cKeJ4wC2.js → editor-modal-B7NNAFI5.js} +4 -4
- package/dist/cdn/chunks/{editor-modal-cKeJ4wC2.js.map → editor-modal-B7NNAFI5.js.map} +1 -1
- package/dist/cdn/chunks/en-C3n0qWte.js +2 -0
- package/dist/cdn/chunks/{extensions-rPP7qRRm.js → extensions-ClmkNA8R.js} +4 -4
- package/dist/cdn/chunks/{extensions-rPP7qRRm.js.map → extensions-ClmkNA8R.js.map} +1 -1
- package/dist/cdn/chunks/{icons-BF0mJX0V.js → icons-BjvraR-Y.js} +25 -25
- package/dist/cdn/chunks/{icons-BF0mJX0V.js.map → icons-BjvraR-Y.js.map} +1 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-h4ZFBKbD.js → preRenderCustomBlocks-Bg3rIgGJ.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-h4ZFBKbD.js.map → preRenderCustomBlocks-Bg3rIgGJ.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-ZOCwCCyn.js → socialIcons-CnUJBZTO.js} +2 -2
- package/dist/cdn/chunks/socialIcons-CnUJBZTO.js.map +1 -0
- package/dist/cdn/chunks/{src-fZSLjhjy.js → src-B5-VKcRQ.js} +2 -2
- package/dist/cdn/chunks/{src-fZSLjhjy.js.map → src-B5-VKcRQ.js.map} +1 -1
- package/dist/cdn/chunks/{src-V9_ODH_1.js → src-BmKDV_BK.js} +3 -3
- package/dist/cdn/chunks/{src-V9_ODH_1.js.map → src-BmKDV_BK.js.map} +1 -1
- package/dist/cdn/chunks/{src-BR3I3gOW.js → src-QIGNPFkl.js} +6 -8
- package/dist/cdn/chunks/src-QIGNPFkl.js.map +1 -0
- package/dist/cdn/chunks/{useEditorCore-DWvAia8X.js → useEditorCore-DjD7fJpq.js} +10 -10
- package/dist/cdn/chunks/{useEditorCore-DWvAia8X.js.map → useEditorCore-DjD7fJpq.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-J_i_hvZg.js → useLogicTag-D6lWY0bD.js} +2 -2
- package/dist/cdn/chunks/{useLogicTag-J_i_hvZg.js.map → useLogicTag-D6lWY0bD.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-C5MyHYxJ.js → useMergeTag-2iW-BKWW.js} +2 -2
- package/dist/cdn/chunks/{useMergeTag-C5MyHYxJ.js.map → useMergeTag-2iW-BKWW.js.map} +1 -1
- package/dist/cdn/editor.js +239 -234
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-DEjsanPt.js → check-DNyj-E0y.js} +1 -1
- package/dist/{chevron-down-Cv11TeKQ.js → chevron-down-BYnhkMsA.js} +1 -1
- package/dist/{chevron-right-R8dOpzBZ.js → chevron-right-D9HGBqJo.js} +1 -1
- package/dist/{chevron-up-DsDEytX1.js → chevron-up-BnIR1-ma.js} +1 -1
- package/dist/{circle-alert-B_NqWETg.js → circle-alert-B6xl1B_M.js} +1 -1
- package/dist/{clock-CDGKPx_X.js → clock-Cs5Wd3dW.js} +1 -1
- package/dist/{cloud-AO_X8T9g.js → cloud-BNEL7bxL.js} +1 -1
- package/dist/{copy-Dv2VltLv.js → copy-6uKc-WBk.js} +1 -1
- package/dist/{createCloudRuntime-D641nhri.js → createCloudRuntime-CaZapQZ6.js} +2 -2
- package/dist/{createLucideIcon-MrFrvtkF.js → createLucideIcon-BVcoovvP.js} +5 -5
- package/dist/{dist-iLUVPysa.js → dist-HjILVdTA.js} +5 -7
- package/dist/{editor-modal-DmgxKgII.js → editor-modal-Co-rZGaf.js} +16 -16
- package/dist/en-B-xoKkWi.js +2 -0
- package/dist/{extensions-CkwL1oWn.js → extensions-DXSI8Dyj.js} +3 -3
- package/dist/{eye-BVxcDaZZ.js → eye-Nbtw_q05.js} +1 -1
- package/dist/{image-up-CnC4n-8q.js → image-up-C1jC7NzQ.js} +1 -1
- package/dist/index.d.ts +2427 -373
- package/dist/{info-q7gVjMBC.js → info-ClH66pKN.js} +1 -1
- package/dist/{link-B1-UqOP6.js → link-y47GNW0o.js} +1 -1
- package/dist/{list-BvlNrd6M.js → list-DiLMlMaE.js} +1 -1
- package/dist/{loader-circle-CJ8klGfl.js → loader-circle-BRdCPW5h.js} +1 -1
- package/dist/{message-circle-Bgepipq_.js → message-circle-CNgIpVJv.js} +1 -1
- package/dist/{package-BYIdon2Q.js → package-B9OWk-Kp.js} +1 -1
- package/dist/{pencil-Bhs9MNTT.js → pencil-BDnjo24u.js} +1 -1
- package/dist/{plus-C0eGj8vT.js → plus-BMgjN7lI.js} +1 -1
- package/dist/{preRenderCustomBlocks-CTstI3Q-.js → preRenderCustomBlocks-C_PIxBp7.js} +1 -1
- package/dist/{refresh-cw-BQTOIZKD.js → refresh-cw-CR5lenxl.js} +1 -1
- package/dist/{search-CeT7yRBa.js → search-CxRUiOSF.js} +1 -1
- package/dist/{send-D7ck2xEq.js → send-Bu2RysGL.js} +1 -1
- package/dist/{shield-check-CF_VbIbH.js → shield-check-Cg8f4LB0.js} +1 -1
- package/dist/{smartphone-CkVOj7Qn.js → smartphone-CHf-8lHp.js} +1 -1
- package/dist/{socialIcons-QYtdurnO.js → socialIcons-D1gkHc_i.js} +2 -2
- package/dist/{sparkles-Cfb-Kkgv.js → sparkles-_DQGv4ub.js} +1 -1
- package/dist/templatical-editor.js +252 -247
- package/dist/{text-align-start-CkFs2Zig.js → text-align-start-PHo-Ep5i.js} +1 -1
- package/dist/{trash-C2LPw5pa.js → trash-BxIzHAri.js} +1 -1
- package/dist/{triangle-alert-gaUz4rum.js → triangle-alert-fcb2KoA-.js} +1 -1
- package/dist/{upload-C_DYZD_p.js → upload-BxBtMPMv.js} +1 -1
- package/dist/{useEditorCore-Cmv5ll-D.js → useEditorCore-iuKC8yr5.js} +14 -14
- package/dist/{useLogicTag-BaH8gey0.js → useLogicTag-wqfdwYYR.js} +1 -1
- package/dist/{useMergeTag-Cyad1yBE.js → useMergeTag-D3XDE_58.js} +1 -1
- package/dist/{useScrollToBlock-BsPYYJ8h.js → useScrollToBlock-DA_aIJXS.js} +1 -1
- package/dist/{x-JhKma5YO.js → x-DrZO5tt0.js} +1 -1
- package/package.json +13 -9
- package/dist/cdn/chunks/en-CoNe1psX.js +0 -2
- package/dist/cdn/chunks/socialIcons-ZOCwCCyn.js.map +0 -1
- package/dist/cdn/chunks/src-BR3I3gOW.js.map +0 -1
- package/dist/en-DXYNty6E.js +0 -2
package/dist/cdn/chunks/{preRenderCustomBlocks-h4ZFBKbD.js → preRenderCustomBlocks-Bg3rIgGJ.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as e, rt as t, ut as n } from "./src-
|
|
1
|
+
import { Z as e, rt as t, ut as n } from "./src-QIGNPFkl.js";
|
|
2
2
|
//#region src/utils/preRenderCustomBlocks.ts
|
|
3
3
|
async function r(r, i) {
|
|
4
4
|
let a = async (r) => {
|
|
@@ -18,4 +18,4 @@ async function r(r, i) {
|
|
|
18
18
|
//#endregion
|
|
19
19
|
export { r as t };
|
|
20
20
|
|
|
21
|
-
//# sourceMappingURL=preRenderCustomBlocks-
|
|
21
|
+
//# sourceMappingURL=preRenderCustomBlocks-Bg3rIgGJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preRenderCustomBlocks-
|
|
1
|
+
{"version":3,"file":"preRenderCustomBlocks-Bg3rIgGJ.js","names":["isCustomBlock","isSection","isWrapper","preRenderCustomBlocks","renderBlock","block","customBlock","registry","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 thing this needs from the block registry. Named as a slice rather than\n * taking `UseBlockRegistryReturn` so the render-payload builder can supply the\n * editor instance's own `renderCustomBlock` without reaching for the registry.\n */\nexport interface CustomBlockResolver {\n renderCustomBlock: (block: CustomBlock) => Promise<string>;\n}\n\n/**\n * Renders every custom block in the content tree to its HTML representation\n * and stores the result on `block.renderedHtml`.\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 }\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":";;AA0BA,eAAsBG,EACpB,GACA,GACe;CACf,IAAMC,IAAc,OAAO,MAAgC;EACzD,IAAIJ,EAAcK,CAAK,GAAG;GACxB,IAAMC,IAAcD;GACpB,IAAI;IACF,EAAY,eACV,MAAME,EAAS,kBAAkBD,CAAW;GAChD,QAAQ;IACN,EAAY,eAAe,mCAAmCA,EAAY,WAAW;GACvF;EACF;EAEA,IAAIL,EAAUI,CAAK,GACjB,KAAK,IAAMG,KAAUH,EAAM,UACzB,KAAK,IAAMI,KAASD,GAClB,MAAMJ,EAAYK,CAAK;OAGtB,IAAIP,EAAUG,CAAK,GACxB,KAAK,IAAMI,KAASJ,EAAM,UACxB,MAAMD,EAAYK,CAAK;CAG7B;CAEA,KAAK,IAAMJ,KAASK,EAAQ,QAC1B,MAAMN,EAAYC,CAAK;AAE3B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B as e, Q as t, W as n, X as r, Y as i, Z as a, f as o, ot as s, rt as c } from "./draggable-IB4x6w2O.js";
|
|
2
|
-
import { D as l, K as u, S as d, T as f, W as p, dt as m, t as h, x as g } from "./src-
|
|
2
|
+
import { D as l, K as u, S as d, T as f, W as p, dt as m, t as h, x as g } from "./src-QIGNPFkl.js";
|
|
3
3
|
import { r as _ } from "./dist-CXB2_kBa.js";
|
|
4
4
|
import { o as v, s as y } from "./usePopoverPosition-DGXjXKjM.js";
|
|
5
5
|
//#region ../core/src/error-reporting.ts
|
|
@@ -1057,4 +1057,4 @@ var Y = m, X = {
|
|
|
1057
1057
|
//#endregion
|
|
1058
1058
|
export { A as _, K as a, D as b, U as c, B as d, L as f, M as g, N as h, J as i, H as l, P as m, Y as n, G as o, F as p, Z as r, W as s, X as t, V as u, j as v, C as x, k as y };
|
|
1059
1059
|
|
|
1060
|
-
//# sourceMappingURL=socialIcons-
|
|
1060
|
+
//# sourceMappingURL=socialIcons-CnUJBZTO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socialIcons-CnUJBZTO.js","names":["computed","DEFAULT_KEY","computed","computed","computed","watch$1","ref","computed","reactive","onScopeDispose","readonly","computed$1","watch","toValue","createBlock","createDefaultTemplateContent","assertNoWrapperInContent","safeClone","generateId","SOCIAL_ICON_GLYPHS","SdkError","assertNoSlotInContent","useDropZone","DEFAULT_RESOLVED_COLORS","resolveColorsConfig","wrapReportedError","error","notifyHandler","getColumnCount","layout","useEditor","seedContent","options","state","revision","touch","content","value","selectedBlock","findBlockById","block","blocks","id","column","found","collectBlockIds","ids","child","findBlockParent","i","parent","colIdx","result","isBlockLocked","blockId","findBlockLocation","index","b","setContent","newContent","markDirty","selectBlock","setViewport","viewport","setDarkMode","darkMode","setUiTheme","theme","setPreviewMode","previewMode","updateBlock","updates","updateSettings","addBlock","candidate","targetSectionId","section","columnIndex","targetArray","removeBlock","removed","removedIds","moveBlock","oldIndex","newIndex","refuse","action","reason","notify","run","requireProvider","templates","setName","create","provider","providerCreate","created","input","revisionAtRequest","load","loaded","templateId","save","providerSave","current","patch","saved","localName","hasTemplate","MAX_STACK_SIZE","DEBOUNCE_MS","NAVIGATE_IDLE_MS","useHistory","undoStack","redoStack","isNavigating","navigatingTimeoutId","pendingDebounce","canUndo","canRedo","cloneContent","pushToUndoStack","snapshot","maxSize","flushPendingDebounce","record","isRemoteOperation","recordDebounced","setNavigating","undo","redo","clear","destroy","regenerateNestedIds","row","cell","icon","item","useBlockActions","createAndAddBlock","defaults","type","duplicateBlock","cloned","clonedChild","sourceLocation","deleteBlock","updateBlockProperty","key","DEFAULT_AUTO_SAVE_DEBOUNCE_MS","useAutoSave","timeoutId","paused","isEnabled","enabled","pause","cancel","resume","flush","isDirty","onChange","scheduleOnChange","debounce","stopWatch","useConditionPreview","hiddenBlockIds","hasHiddenBlocks","isHidden","toggleBlock","editor","reset","useDataSourceFetch","isFetching","fetchError","hasDataSource","needsFetch","fetch","def","merged","useHistoryInterceptor","originalAddBlock","originalRemoveBlock","originalMoveBlock","originalUpdateBlock","originalUpdateSettings","history","useSavedBlocks","savedBlocks","isLoading","categories","seen","category","a","canCreate","canUpdate","canDelete","canUpdateBlock","canDeleteBlock","params","update","providerUpdate","local","updated","remove","providerDelete","DEFAULT_KEY$1","createLocalStorageSavedBlocksProvider","storageKey","getStorage","readAll","raw","parsed","writeAll","all","search","now","next","DEFAULT_KEY","PAGE_SIZE","createLocalStorageMediaProvider","assets","readFileAsDataURL","reader","file","filtered","filename","asset","alt","offset","items","page","nextOffset","url","useVersionHistory","versions","nextCursor","isRestoring","fetched","canRestore","requireTemplateId","getTemplateId","peekContent","version","resolveContent","known","meta","restore","providerRestore","restored","versionId","useComments","comments","isSubmitting","canResolve","totalCount","sum","thread","unresolvedCount","commentCountByBlock","map","requireUser","user","getUser","find","commentId","reply","isOwn","comment","report","wrapped","replaceAt","list","sameComment","upsert","changed","replies","at","drop","existing","parentId","r","c","setResolved","providerSetResolved","resolved","applyRemoteCreate","applyRemoteUpdate","applyRemoteDelete","useCommentListener","subscribe","unsubscribe","stop","change","getBlockTypeLabel","translations","blockType","getBlockLabel","customBlockDefinitions","d","customType","resolveFieldColors","own","field","presetsInherited","editorResolved","IMAGE_MIME_PREFIX","useImageDrop","target","images","files","onFiles","isOverDropZone","socialIcons","socialIconSizeMap","socialPlatformOptions"],"sources":["../../../../core/src/error-reporting.ts","../../../../core/src/editor.ts","../../../../core/src/history.ts","../../../../core/src/block-actions.ts","../../../../core/src/auto-save.ts","../../../../core/src/condition-preview.ts","../../../../core/src/data-source-fetch.ts","../../../../core/src/history-interceptor.ts","../../../../core/src/saved-blocks.ts","../../../../core/src/saved-blocks-local.ts","../../../../core/src/media-local.ts","../../../../core/src/version-history.ts","../../../../core/src/comments.ts","../../../src/utils/blockTypeLabels.ts","../../../src/utils/resolveFieldColors.ts","../../../src/composables/useImageDrop.ts","../../../src/constants/socialIcons.ts"],"sourcesContent":["/**\n * Turn a thrown value into an `Error`.\n *\n * A `catch` clause's binding is `unknown` — a provider or a consumer's event\n * handler can throw a string, an object, or anything else. `onError` callbacks\n * across this package are typed to take an `Error`, so this is what makes that\n * contract honest at the one place values actually cross it.\n */\nexport function wrapReportedError(error: unknown): Error {\n return error instanceof Error\n ? error\n : new Error(String(error), { cause: error });\n}\n\n/**\n * Run a consumer's event handler without letting it fail the operation it\n * followed.\n *\n * A handler that throws must not turn a completed write into a rejected one —\n * the caller has already succeeded by the time this runs. `onError` is taken\n * as a parameter rather than read from a shared reporter, so every feature\n * module keeps its own `options.onError` wiring and this stays reusable by\n * any module with the same fire-and-forget event shape.\n */\nexport function notifyHandler(\n onError: ((error: Error) => void) | undefined,\n run: () => void,\n): void {\n try {\n run();\n } catch (error) {\n onError?.(wrapReportedError(error));\n }\n}\n","import type {\n Block,\n ColumnLayout,\n Template,\n TemplateContent,\n TemplateDefaults,\n TemplatePatch,\n TemplateSaveTrigger,\n TemplateSettings,\n TemplatesProvider,\n UiTheme,\n ViewportSize,\n} from \"@templatical/types\";\nimport {\n assertNoSlotInContent,\n assertNoWrapperInContent,\n createDefaultTemplateContent,\n SdkError,\n} from \"@templatical/types\";\nimport { notifyHandler } from \"./error-reporting\";\n\nfunction getColumnCount(layout: ColumnLayout): number {\n if (layout === \"1\") return 1;\n if (layout === \"3\") return 3;\n return 2;\n}\nimport {\n computed,\n reactive,\n readonly,\n type DeepReadonly,\n type Ref,\n} from \"@vue/reactivity\";\n\nexport interface EditorState {\n /**\n * The template currently being edited, as the store last returned it — `null`\n * until `create()` or `load()` resolves, and always `null` without a\n * {@link TemplatesProvider}.\n *\n * Carries identity and name only for practical purposes: its `content` is the\n * store's copy from the last round-trip, whereas `state.content` is what the\n * user is editing.\n */\n template: Template | null;\n content: TemplateContent;\n selectedBlockId: string | null;\n viewport: ViewportSize;\n darkMode: boolean;\n previewMode: boolean;\n isDirty: boolean;\n /** True for the duration of a `save()` call. */\n isSaving: boolean;\n /** True for the duration of a `create()` or `load()` call. */\n isLoading: boolean;\n uiTheme: UiTheme;\n}\n\nexport interface UseEditorOptions {\n content: TemplateContent;\n defaultFontFamily?: string;\n templateDefaults?: TemplateDefaults;\n lockedBlocks?: Ref<Map<string, unknown>>;\n /**\n * Storage backend for the template's save/load lifecycle. Omit it and\n * `create()` / `load()` / `save()` reject — the editor keeps working as a\n * purely local editing surface.\n */\n templates?: TemplatesProvider;\n /**\n * Called with any error a provider call rejects with, before the rejection is\n * re-thrown to the caller.\n */\n onError?: (error: Error) => void;\n}\n\nexport interface UseEditorReturn {\n state: DeepReadonly<EditorState>;\n content: Ref<TemplateContent>;\n selectedBlock: Ref<Block | null>;\n setContent: (content: TemplateContent, markDirty?: boolean) => void;\n selectBlock: (blockId: string | null) => void;\n setViewport: (viewport: ViewportSize) => void;\n setDarkMode: (darkMode: boolean) => void;\n setPreviewMode: (previewMode: boolean) => void;\n setUiTheme: (theme: UiTheme) => void;\n updateBlock: (blockId: string, updates: Partial<Block>) => void;\n updateSettings: (updates: Partial<TemplateSettings>) => void;\n addBlock: (\n block: Block,\n targetSectionId?: string,\n columnIndex?: number,\n index?: number,\n ) => void;\n removeBlock: (blockId: string) => void;\n moveBlock: (\n blockId: string,\n newIndex: number,\n targetSectionId?: string,\n columnIndex?: number,\n ) => void;\n isBlockLocked: (blockId: string) => boolean;\n markDirty: () => void;\n findBlockLocation: (blockId: string) => {\n targetSectionId?: string;\n columnIndex?: number;\n index: number;\n } | null;\n /**\n * Rename the loaded template locally and mark the editor dirty. The new name\n * reaches the store on the next `save()`, in the same patch as the content —\n * a rename is an ordinary unsaved change, not a side channel.\n *\n * This method only stages it. The editor's inline rename field commits by\n * calling `setName()` and then saving immediately, because a rename reads as a\n * discrete action rather than an edit to be batched — so in the editor the\n * \"next `save()`\" is usually the one it triggers itself. A headless caller\n * decides its own moment.\n *\n * No-op when no template is loaded: there is nothing to name.\n */\n setName: (name: string) => void;\n /**\n * Persist the current content as a new template. `input.content`, when given,\n * replaces the editor's content first — so `create({ content })` both loads\n * and stores in one step.\n */\n create: (input?: {\n name?: string;\n content?: TemplateContent;\n }) => Promise<Template>;\n /** Fetch a template and make it the editor's content. */\n load: (templateId: string) => Promise<Template>;\n /**\n * Persist the loaded template's name + content as a patch.\n *\n * `trigger` is passed through to `TemplatesOptions.onSaved`. It defaults to\n * `\"api\"`, which is the honest answer for a direct call — the editor package\n * passes the value matching whichever affordance fired.\n */\n save: (trigger?: TemplateSaveTrigger) => Promise<Template>;\n /** Whether a template has been created or loaded. */\n hasTemplate: () => boolean;\n}\n\nexport function useEditor(options: UseEditorOptions): UseEditorReturn {\n const seedContent =\n options.content ??\n createDefaultTemplateContent(\n options.defaultFontFamily,\n options.templateDefaults,\n );\n // Layout-only; authored content must not contain slot or wrapper.\n assertNoSlotInContent(seedContent);\n assertNoWrapperInContent(seedContent);\n\n const state = reactive<EditorState>({\n template: null,\n content: seedContent,\n selectedBlockId: null,\n viewport: \"desktop\",\n darkMode: false,\n previewMode: false,\n isDirty: false,\n isSaving: false,\n isLoading: false,\n uiTheme: \"auto\",\n });\n\n /**\n * Bumped by every content mutation. `save()` captures it before awaiting the\n * provider and only clears `isDirty` if it is unchanged afterwards, so an edit\n * made while a save is in flight is not reported as persisted — which would\n * also make autosave skip it, since that decides dirtiness at debounce time.\n */\n let revision = 0;\n\n function touch(): void {\n state.isDirty = true;\n revision++;\n }\n\n const content = computed({\n get: () => state.content,\n set: (value: TemplateContent) => {\n state.content = value;\n touch();\n },\n });\n\n const selectedBlock = computed(() => {\n if (!state.selectedBlockId) return null;\n return findBlockById(state.content.blocks, state.selectedBlockId);\n });\n\n function findBlockById(blocks: Block[], id: string): Block | null {\n for (const block of blocks) {\n if (block.id === id) return block;\n if (block.type === \"section\") {\n for (const column of block.children) {\n const found = findBlockById(column, id);\n if (found) return found;\n }\n }\n }\n return null;\n }\n\n function collectBlockIds(block: Block, ids: Set<string>): void {\n ids.add(block.id);\n if (block.type === \"section\") {\n for (const column of block.children) {\n for (const child of column) {\n collectBlockIds(child, ids);\n }\n }\n }\n }\n\n function findBlockParent(\n blocks: Block[],\n id: string,\n parent: {\n blocks: Block[];\n sectionId?: string;\n columnIndex?: number;\n } = { blocks },\n ): { blocks: Block[]; sectionId?: string; columnIndex?: number } | null {\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n if (block.id === id) return parent;\n if (block.type === \"section\") {\n for (let colIdx = 0; colIdx < block.children.length; colIdx++) {\n const result = findBlockParent(block.children[colIdx], id, {\n blocks: block.children[colIdx],\n sectionId: block.id,\n columnIndex: colIdx,\n });\n if (result) return result;\n }\n }\n }\n return null;\n }\n\n function isBlockLocked(blockId: string): boolean {\n return options.lockedBlocks?.value.has(blockId) ?? false;\n }\n\n function findBlockLocation(blockId: string): {\n targetSectionId?: string;\n columnIndex?: number;\n index: number;\n } | null {\n const parent = findBlockParent(state.content.blocks, blockId);\n if (!parent) return null;\n const index = parent.blocks.findIndex((b) => b.id === blockId);\n if (index === -1) return null;\n return {\n targetSectionId: parent.sectionId,\n columnIndex: parent.columnIndex,\n index,\n };\n }\n\n // TODO(collab): the lock checks in addBlock/moveBlock/removeBlock/updateBlock\n // are shallow — they only consider the directly-targeted block id. A section\n // can still be removed, moved, or have its `children` array rewritten while a\n // peer is editing one of its descendants, which silently disrupts that peer's\n // edit. Add a `hasLockedDescendant(blockId)` helper and gate section-level\n // operations on it (and on the parent of each affected child) so cascades\n // through the tree are also blocked.\n\n function setContent(newContent: TemplateContent, markDirty = true): void {\n assertNoSlotInContent(newContent);\n assertNoWrapperInContent(newContent);\n state.content = newContent;\n if (markDirty) {\n touch();\n }\n }\n\n function selectBlock(blockId: string | null): void {\n if (blockId && isBlockLocked(blockId)) {\n return;\n }\n state.selectedBlockId = blockId;\n }\n\n function setViewport(viewport: ViewportSize): void {\n state.viewport = viewport;\n }\n\n function setDarkMode(darkMode: boolean): void {\n state.darkMode = darkMode;\n }\n\n function setUiTheme(theme: UiTheme): void {\n state.uiTheme = theme;\n }\n\n function setPreviewMode(previewMode: boolean): void {\n state.previewMode = previewMode;\n if (previewMode) {\n state.selectedBlockId = null;\n }\n }\n\n function updateBlock(blockId: string, updates: Partial<Block>): void {\n if (isBlockLocked(blockId)) {\n return;\n }\n const block = findBlockById(state.content.blocks, blockId);\n if (block) {\n Object.assign(block, updates);\n touch();\n }\n }\n\n function updateSettings(updates: Partial<TemplateSettings>): void {\n state.content.settings = { ...state.content.settings, ...updates };\n touch();\n }\n\n function addBlock(\n block: Block,\n targetSectionId?: string,\n columnIndex = 0,\n index?: number,\n ): void {\n const candidate = {\n settings: state.content.settings,\n blocks: [block],\n };\n assertNoSlotInContent(candidate);\n assertNoWrapperInContent(candidate);\n // Sections cannot be nested inside a column — MJML forbids `mj-section`\n // inside `mj-column`, so the renderer drops them on export (issue #292).\n // Reject the nest up front rather than lose the content silently later.\n if (targetSectionId && block.type === \"section\") {\n return;\n }\n if (targetSectionId) {\n if (isBlockLocked(targetSectionId)) {\n return;\n }\n const section = findBlockById(state.content.blocks, targetSectionId);\n if (section && section.type === \"section\") {\n if (columnIndex < 0 || columnIndex >= getColumnCount(section.columns)) {\n return;\n }\n section.children[columnIndex] = section.children[columnIndex] || [];\n const targetArray = section.children[columnIndex];\n if (index !== undefined && index < targetArray.length) {\n targetArray.splice(index, 0, block);\n } else {\n targetArray.push(block);\n }\n }\n } else {\n if (index !== undefined && index < state.content.blocks.length) {\n state.content.blocks.splice(index, 0, block);\n } else {\n state.content.blocks.push(block);\n }\n }\n touch();\n }\n\n function removeBlock(blockId: string): void {\n if (isBlockLocked(blockId)) {\n return;\n }\n const parent = findBlockParent(state.content.blocks, blockId);\n if (parent) {\n const index = parent.blocks.findIndex((b) => b.id === blockId);\n if (index !== -1) {\n const [removed] = parent.blocks.splice(index, 1);\n if (state.selectedBlockId) {\n const removedIds = new Set<string>();\n collectBlockIds(removed, removedIds);\n if (removedIds.has(state.selectedBlockId)) {\n state.selectedBlockId = null;\n }\n }\n touch();\n }\n }\n }\n\n function moveBlock(\n blockId: string,\n newIndex: number,\n targetSectionId?: string,\n columnIndex = 0,\n ): void {\n if (isBlockLocked(blockId)) {\n return;\n }\n if (targetSectionId && isBlockLocked(targetSectionId)) {\n return;\n }\n\n const parent = findBlockParent(state.content.blocks, blockId);\n if (!parent) return;\n\n const oldIndex = parent.blocks.findIndex((b) => b.id === blockId);\n if (oldIndex === -1) return;\n\n // Sections cannot be nested inside a column (issue #292) — refuse to move\n // a section into a section column; MJML would drop it on export.\n if (targetSectionId && parent.blocks[oldIndex].type === \"section\") {\n return;\n }\n\n // Resolve target before mutating the source — otherwise an invalid\n // targetSectionId leaves the block spliced-out and unrecoverable.\n let targetArray: Block[];\n if (targetSectionId) {\n const section = findBlockById(state.content.blocks, targetSectionId);\n if (!section || section.type !== \"section\") return;\n if (columnIndex < 0 || columnIndex >= getColumnCount(section.columns)) {\n return;\n }\n section.children[columnIndex] = section.children[columnIndex] || [];\n targetArray = section.children[columnIndex];\n } else {\n targetArray = state.content.blocks;\n }\n\n const [block] = parent.blocks.splice(oldIndex, 1);\n targetArray.splice(newIndex, 0, block);\n\n touch();\n }\n\n function markDirty(): void {\n touch();\n }\n\n // -------------------------------------------------------------------------\n // Template lifecycle (over an optional TemplatesProvider)\n // -------------------------------------------------------------------------\n\n /**\n * A refused call throws rather than resolving, because a resolved promise\n * would read as \"saved\" to whoever awaited it.\n *\n * The message names the provider key the consumer set, not an internal\n * capability flag: neither `EditorCapabilities` nor its injection key is\n * exported, so neither a core nor an editor consumer can read one. Note the\n * editor hides its own save controls when `save` is withheld but has no\n * create affordance to hide at all, so `create()` is reachable by definition.\n */\n function refuse(action: string, reason: string): never {\n throw new SdkError(`[Templatical] Templates: ${action} ${reason}`);\n }\n\n /**\n * Run a consumer's event handler without letting it fail the operation.\n *\n * A handler that throws must not turn a completed write into a rejected one —\n * the UI would report a failure for something that landed.\n */\n function notify(run: () => void): void {\n notifyHandler(options.onError, run);\n }\n\n function requireProvider(action: string): TemplatesProvider {\n const { templates } = options;\n if (!templates) {\n refuse(\n action,\n \"needs a templates provider. Pass one as `init({ templates })` to enable saving and loading.\",\n );\n }\n return templates;\n }\n\n function setName(name: string): void {\n if (!state.template) return;\n state.template = { ...state.template, name };\n touch();\n }\n\n async function create(input?: {\n name?: string;\n content?: TemplateContent;\n }): Promise<Template> {\n const provider = requireProvider(\"create()\");\n const { create: providerCreate } = provider;\n if (typeof providerCreate !== \"function\") {\n refuse(\n \"create()\",\n \"is disabled by the provider — its `create` is `false`.\",\n );\n }\n\n let created: Template;\n state.isLoading = true;\n try {\n if (input?.content) {\n state.content = input.content;\n }\n // Omit `name` entirely when unset rather than sending `undefined` — a\n // provider serialising the input to JSON would otherwise receive a key it\n // never asked for.\n const revisionAtRequest = revision;\n created = await providerCreate(\n input?.name !== undefined\n ? { name: input.name, content: state.content }\n : { content: state.content },\n );\n state.template = created;\n if (revision === revisionAtRequest) {\n state.isDirty = false;\n }\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n } finally {\n state.isLoading = false;\n }\n // Below the `finally` on purpose: `isLoading` is cleared there, so a handler\n // must not observe the editor still loading. Unreachable on failure — the\n // catch rethrows.\n notify(() => provider.onCreated?.(created));\n return created;\n }\n\n async function load(templateId: string): Promise<Template> {\n const provider = requireProvider(\"load()\");\n\n let loaded: Template;\n state.isLoading = true;\n try {\n loaded = await provider.load(templateId);\n assertNoSlotInContent(loaded.content);\n assertNoWrapperInContent(loaded.content);\n state.template = loaded;\n state.content = loaded.content;\n state.isDirty = false;\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n } finally {\n state.isLoading = false;\n }\n // Below the `finally` on purpose: `isLoading` is cleared there, so a handler\n // must not observe the editor still loading. Unreachable on failure — the\n // catch rethrows.\n notify(() => provider.onLoaded?.(loaded));\n return loaded;\n }\n\n async function save(trigger: TemplateSaveTrigger = \"api\"): Promise<Template> {\n const provider = requireProvider(\"save()\");\n const { save: providerSave } = provider;\n if (typeof providerSave !== \"function\") {\n refuse(\"save()\", \"is disabled by the provider — its `save` is `false`.\");\n }\n const current = state.template;\n if (!current) {\n refuse(\n \"save()\",\n \"has no template loaded. Call create() or load() first.\",\n );\n }\n\n // The name rides the same patch as the content: a rename is an ordinary\n // unsaved change, so one round-trip persists both.\n const patch: TemplatePatch =\n current.name !== undefined\n ? { name: current.name, content: state.content }\n : { content: state.content };\n\n let saved: Template;\n state.isSaving = true;\n try {\n const revisionAtRequest = revision;\n saved = await providerSave(current.id, patch);\n // Adopt the response only while it still describes what is open. A\n // `load()` that landed mid-flight has already replaced the template, so\n // the response is stale.\n if (state.template?.id === current.id) {\n // The patch was built before the await, so a rename that landed during\n // it is absent from the response. Taking the response's name verbatim\n // reverts what the user typed — and because the next save reads the\n // name back off `state.template`, it would then persist the stale one,\n // losing the rename outright rather than merely on screen.\n const localName = state.template.name;\n state.template =\n localName !== current.name ? { ...saved, name: localName } : saved;\n }\n // Deliberately conditional. An edit landing while the request was in\n // flight is not persisted by it, and clearing the flag would both claim it\n // was and make autosave — which checks dirtiness at debounce time — skip\n // the follow-up save.\n if (revision === revisionAtRequest) {\n state.isDirty = false;\n }\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n } finally {\n state.isSaving = false;\n }\n // Below the `finally` on purpose: `isSaving` is cleared there, and a handler\n // that navigates must observe a settled editor or the consumer's own dirty\n // guard blocks their navigation. Unreachable on failure — the catch rethrows.\n notify(() => provider.onSaved?.(saved, { trigger }));\n return saved;\n }\n\n function hasTemplate(): boolean {\n return state.template?.id !== undefined;\n }\n\n return {\n state: readonly(state),\n content,\n selectedBlock,\n isBlockLocked,\n setContent,\n selectBlock,\n setViewport,\n setDarkMode,\n setUiTheme,\n setPreviewMode,\n updateBlock,\n updateSettings,\n addBlock,\n removeBlock,\n moveBlock,\n markDirty,\n findBlockLocation,\n setName,\n create,\n load,\n save,\n hasTemplate,\n };\n}\n","import { safeClone, type TemplateContent } from \"@templatical/types\";\nimport { computed, ref, type ComputedRef, type Ref } from \"@vue/reactivity\";\n\nexport interface UseHistoryOptions {\n content: Ref<TemplateContent>;\n setContent: (content: TemplateContent, markDirty?: boolean) => void;\n isRemoteOperation?: () => boolean;\n maxSize?: number;\n}\n\nexport interface UseHistoryReturn {\n canUndo: ComputedRef<boolean>;\n canRedo: ComputedRef<boolean>;\n isNavigating: Ref<boolean>;\n undo: () => void;\n redo: () => void;\n record: () => void;\n recordDebounced: (blockId: string) => void;\n clear: () => void;\n destroy: () => void;\n}\n\ninterface DebouncedSnapshot {\n blockId: string;\n timeoutId: ReturnType<typeof setTimeout>;\n}\n\nconst MAX_STACK_SIZE = 50;\nconst DEBOUNCE_MS = 300;\nconst NAVIGATE_IDLE_MS = 1500;\n\nexport function useHistory(options: UseHistoryOptions): UseHistoryReturn {\n const {\n content,\n setContent,\n isRemoteOperation,\n maxSize = MAX_STACK_SIZE,\n } = options;\n\n const undoStack = ref<TemplateContent[]>([]);\n const redoStack = ref<TemplateContent[]>([]);\n const isNavigating = ref(false);\n let navigatingTimeoutId: ReturnType<typeof setTimeout> | null = null;\n let pendingDebounce: DebouncedSnapshot | null = null;\n\n const canUndo = computed(() => undoStack.value.length > 0);\n const canRedo = computed(() => redoStack.value.length > 0);\n\n function cloneContent(): TemplateContent {\n // Cycle-safe deep clone (see `safeClone`). A naked JSON.stringify throws\n // `Converting circular structure to JSON` if a DOM element with a Sortable\n // expando back-ref ever sneaks into block data via a drag handler — which\n // would freeze the undo stack, since every subsequent mutation calls\n // `record()`. safeClone drops the back-ref instead of throwing.\n return safeClone(content.value);\n }\n\n function pushToUndoStack(snapshot: TemplateContent): void {\n undoStack.value.push(snapshot);\n if (undoStack.value.length > maxSize) {\n undoStack.value.splice(0, undoStack.value.length - maxSize);\n }\n }\n\n function flushPendingDebounce(): void {\n if (pendingDebounce) {\n clearTimeout(pendingDebounce.timeoutId);\n pendingDebounce = null;\n }\n }\n\n function record(): void {\n if (isRemoteOperation?.()) {\n return;\n }\n\n flushPendingDebounce();\n pushToUndoStack(cloneContent());\n redoStack.value = [];\n }\n\n function recordDebounced(blockId: string): void {\n if (isRemoteOperation?.()) {\n return;\n }\n\n if (pendingDebounce && pendingDebounce.blockId === blockId) {\n clearTimeout(pendingDebounce.timeoutId);\n pendingDebounce.timeoutId = setTimeout(() => {\n pendingDebounce = null;\n }, DEBOUNCE_MS);\n return;\n }\n\n flushPendingDebounce();\n\n pushToUndoStack(cloneContent());\n redoStack.value = [];\n\n pendingDebounce = {\n blockId,\n timeoutId: setTimeout(() => {\n pendingDebounce = null;\n }, DEBOUNCE_MS),\n };\n }\n\n function setNavigating(): void {\n isNavigating.value = true;\n if (navigatingTimeoutId) {\n clearTimeout(navigatingTimeoutId);\n }\n navigatingTimeoutId = setTimeout(() => {\n isNavigating.value = false;\n navigatingTimeoutId = null;\n }, NAVIGATE_IDLE_MS);\n }\n\n function undo(): void {\n if (undoStack.value.length === 0) {\n return;\n }\n\n flushPendingDebounce();\n\n const snapshot = undoStack.value.pop()!;\n redoStack.value.push(cloneContent());\n setContent(snapshot, true);\n setNavigating();\n }\n\n function redo(): void {\n if (redoStack.value.length === 0) {\n return;\n }\n\n flushPendingDebounce();\n\n const snapshot = redoStack.value.pop()!;\n undoStack.value.push(cloneContent());\n setContent(snapshot, true);\n setNavigating();\n }\n\n function clear(): void {\n undoStack.value = [];\n redoStack.value = [];\n flushPendingDebounce();\n }\n\n function destroy(): void {\n clear();\n if (navigatingTimeoutId) {\n clearTimeout(navigatingTimeoutId);\n navigatingTimeoutId = null;\n }\n }\n\n return {\n canUndo,\n canRedo,\n isNavigating,\n undo,\n redo,\n record,\n recordDebounced,\n clear,\n destroy,\n };\n}\n","import type { Block, BlockDefaults, BlockType } from \"@templatical/types\";\nimport { createBlock, generateId } from \"@templatical/types\";\n\nfunction regenerateNestedIds(block: Block): void {\n if (block.type === \"table\") {\n block.rows = block.rows.map((row) => ({\n ...row,\n id: generateId(),\n cells: row.cells.map((cell) => ({ ...cell, id: generateId() })),\n }));\n } else if (block.type === \"social\") {\n block.icons = block.icons.map((icon) => ({ ...icon, id: generateId() }));\n } else if (block.type === \"menu\") {\n block.items = block.items.map((item) => ({ ...item, id: generateId() }));\n }\n}\n\nexport interface UseBlockActionsOptions {\n addBlock: (\n block: Block,\n targetSectionId?: string,\n columnIndex?: number,\n index?: number,\n ) => void;\n removeBlock: (blockId: string) => void;\n updateBlock: (blockId: string, updates: Partial<Block>) => void;\n selectBlock: (blockId: string | null) => void;\n /** Locate a block in the tree — used by `duplicateBlock` to insert the\n * clone right after the source instead of appending to the end. */\n findBlockLocation?: (blockId: string) => {\n targetSectionId?: string;\n columnIndex?: number;\n index: number;\n } | null;\n /**\n * Defaults merged onto every block `createAndAddBlock` creates.\n *\n * A **getter** is re-read on each insert; a plain object is captured once.\n * The editor passes a getter because half of these defaults track the\n * template's own `settings.locale`, which the author can change mid-session\n * — a snapshot would pin every later insert to the value at mount.\n */\n blockDefaults?: BlockDefaults | (() => BlockDefaults);\n}\n\nexport interface UseBlockActionsReturn {\n createAndAddBlock: (\n type: BlockType,\n targetSectionId?: string,\n columnIndex?: number,\n ) => Block;\n duplicateBlock: (\n block: Block,\n targetSectionId?: string,\n columnIndex?: number,\n ) => Block;\n deleteBlock: (blockId: string) => void;\n updateBlockProperty: <K extends keyof Block>(\n blockId: string,\n key: K,\n value: Block[K],\n ) => void;\n}\n\nexport function useBlockActions(\n options: UseBlockActionsOptions,\n): UseBlockActionsReturn {\n const { addBlock, removeBlock, updateBlock, selectBlock, findBlockLocation } =\n options;\n\n function createAndAddBlock(\n type: BlockType,\n targetSectionId?: string,\n columnIndex?: number,\n ): Block {\n const defaults =\n typeof options.blockDefaults === \"function\"\n ? options.blockDefaults()\n : options.blockDefaults;\n const block = createBlock(type, defaults);\n addBlock(block, targetSectionId, columnIndex);\n selectBlock(block.id);\n return block;\n }\n\n function duplicateBlock(\n block: Block,\n targetSectionId?: string,\n columnIndex?: number,\n ): Block {\n const cloned = JSON.parse(JSON.stringify(block)) as Block;\n cloned.id = generateId();\n regenerateNestedIds(cloned);\n\n if (cloned.type === \"section\") {\n cloned.children = cloned.children.map((column) =>\n column.map((child) => {\n const clonedChild = JSON.parse(JSON.stringify(child)) as Block;\n clonedChild.id = generateId();\n regenerateNestedIds(clonedChild);\n return clonedChild;\n }),\n );\n }\n\n // Insert directly after the source block. Explicit target args win;\n // otherwise, resolve the source's location and bump index by 1. Falls\n // back to appending at the end if location is unknown.\n if (targetSectionId !== undefined || columnIndex !== undefined) {\n addBlock(cloned, targetSectionId, columnIndex);\n } else {\n const sourceLocation = findBlockLocation?.(block.id) ?? null;\n if (sourceLocation) {\n addBlock(\n cloned,\n sourceLocation.targetSectionId,\n sourceLocation.columnIndex,\n sourceLocation.index + 1,\n );\n } else {\n addBlock(cloned, targetSectionId, columnIndex);\n }\n }\n selectBlock(cloned.id);\n return cloned;\n }\n\n function deleteBlock(blockId: string): void {\n removeBlock(blockId);\n }\n\n function updateBlockProperty<K extends keyof Block>(\n blockId: string,\n key: K,\n value: Block[K],\n ): void {\n updateBlock(blockId, { [key]: value } as Partial<Block>);\n }\n\n return {\n createAndAddBlock,\n duplicateBlock,\n deleteBlock,\n updateBlockProperty,\n };\n}\n","import type { TemplateContent } from \"@templatical/types\";\nimport { watch, type Ref } from \"@vue/reactivity\";\n\nexport interface UseAutoSaveOptions {\n content: Ref<TemplateContent>;\n isDirty: () => boolean;\n onChange: (content: TemplateContent) => void;\n debounce?: number;\n enabled?: boolean | (() => boolean);\n}\n\nexport interface UseAutoSaveReturn {\n flush: () => void;\n cancel: () => void;\n pause: () => void;\n resume: () => void;\n destroy: () => void;\n}\n\n/**\n * Trailing debounce, in ms, measured from the *last* content mutation.\n *\n * Typing is not debounced upstream — TipTap's `onUpdate` calls `updateBlock` per\n * keystroke — so this is the only thing between a keypress and a whole-document\n * write. 1000 was too eager: ordinary prose pauses for a second constantly\n * (word choice, re-reading, reaching for the mouse), so a single paragraph could\n * produce dozens of full-content saves. 2000 roughly halves that while still\n * landing well before a user wonders whether their work was kept.\n *\n * **The single default for both entry points.** Cloud imports this constant\n * rather than declaring its own — a second copy for one setting drifts silently,\n * since nothing links the two.\n */\nexport const DEFAULT_AUTO_SAVE_DEBOUNCE_MS = 2000;\n\nexport function useAutoSave(options: UseAutoSaveOptions): UseAutoSaveReturn {\n const {\n content,\n isDirty,\n onChange,\n debounce = DEFAULT_AUTO_SAVE_DEBOUNCE_MS,\n enabled = true,\n } = options;\n\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n let paused = false;\n\n function isEnabled(): boolean {\n return typeof enabled === \"function\" ? enabled() : enabled;\n }\n\n function pause(): void {\n paused = true;\n cancel();\n }\n\n function resume(): void {\n paused = false;\n }\n\n function cancel(): void {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n }\n\n function flush(): void {\n cancel();\n if (isDirty()) {\n onChange(JSON.parse(JSON.stringify(content.value)));\n }\n }\n\n function scheduleOnChange(): void {\n if (!isEnabled() || paused) return;\n\n cancel();\n timeoutId = setTimeout(() => {\n timeoutId = null;\n if (isEnabled() && !paused && isDirty()) {\n onChange(JSON.parse(JSON.stringify(content.value)));\n }\n }, debounce);\n }\n\n // `watch` from `@vue/reactivity` has no scheduler, so this callback runs\n // *synchronously inside the mutation* — before the editor's trailing\n // `state.isDirty = true`, and `isDirty` sits outside the watched `content`\n // subtree so setting it never re-triggers. An `isDirty()` guard here would\n // therefore drop the first edit after every dirty-flag reset (issue #522).\n // Dirtiness is decided at debounce time instead, where the flag is settled;\n // `scheduleOnChange` still checks `enabled`/`paused` up front.\n const stopWatch = watch(\n content,\n () => {\n scheduleOnChange();\n },\n { deep: true },\n );\n\n function destroy(): void {\n stopWatch();\n cancel();\n }\n\n return {\n flush,\n cancel,\n pause,\n resume,\n destroy,\n };\n}\n","import { computed, reactive, type ComputedRef } from \"@vue/reactivity\";\n\nexport interface UseConditionPreviewReturn {\n isHidden: (blockId: string) => boolean;\n toggleBlock: (blockId: string) => void;\n reset: () => void;\n hasHiddenBlocks: ComputedRef<boolean>;\n}\n\n/**\n * The slice of an editor this needs — deliberately structural, so both the OSS\n * and the Cloud `useEditor` satisfy it without either having to grow toward the\n * other.\n */\nexport interface ConditionPreviewEditor {\n state: { readonly selectedBlockId: string | null };\n selectBlock: (blockId: string | null) => void;\n}\n\nexport function useConditionPreview(\n editor: ConditionPreviewEditor,\n): UseConditionPreviewReturn {\n const hiddenBlockIds = reactive(new Set<string>());\n\n const hasHiddenBlocks = computed(() => hiddenBlockIds.size > 0);\n\n function isHidden(blockId: string): boolean {\n return hiddenBlockIds.has(blockId);\n }\n\n function toggleBlock(blockId: string): void {\n if (hiddenBlockIds.has(blockId)) {\n hiddenBlockIds.delete(blockId);\n } else {\n hiddenBlockIds.add(blockId);\n\n if (editor.state.selectedBlockId === blockId) {\n editor.selectBlock(null);\n }\n }\n }\n\n function reset(): void {\n hiddenBlockIds.clear();\n }\n\n return {\n isHidden,\n toggleBlock,\n reset,\n hasHiddenBlocks,\n };\n}\n","import type { CustomBlock, CustomBlockDefinition } from \"@templatical/types\";\nimport type { ComputedRef, Ref } from \"@vue/reactivity\";\nimport { computed, ref } from \"@vue/reactivity\";\n\nexport function useDataSourceFetch(options: {\n definition: ComputedRef<CustomBlockDefinition | undefined>;\n block: ComputedRef<CustomBlock>;\n onUpdate: (fieldValues: Record<string, unknown>, fetched: boolean) => void;\n}): {\n isFetching: Ref<boolean>;\n fetchError: Ref<boolean>;\n fetch: () => Promise<void>;\n hasDataSource: ComputedRef<boolean>;\n needsFetch: ComputedRef<boolean>;\n} {\n const isFetching = ref(false);\n const fetchError = ref(false);\n\n const hasDataSource = computed(() => !!options.definition.value?.dataSource);\n\n const needsFetch = computed(\n () => hasDataSource.value && !options.block.value.dataSourceFetched,\n );\n\n async function fetch(): Promise<void> {\n const def = options.definition.value;\n if (!def?.dataSource) {\n return;\n }\n\n isFetching.value = true;\n fetchError.value = false;\n\n try {\n const result = await def.dataSource.onFetch({\n fieldValues: { ...options.block.value.fieldValues },\n blockId: options.block.value.id,\n });\n\n if (result == null) {\n return;\n }\n\n const merged = { ...options.block.value.fieldValues };\n for (const key of Object.keys(merged)) {\n if (key in result) {\n merged[key] = result[key];\n }\n }\n\n options.onUpdate(merged, true);\n } catch (error) {\n console.warn(\"[Templatical] Data source fetch error:\", error);\n fetchError.value = true;\n } finally {\n isFetching.value = false;\n }\n }\n\n return {\n isFetching,\n fetchError,\n fetch,\n hasDataSource,\n needsFetch,\n };\n}\n","import type { Block, TemplateSettings } from \"@templatical/types\";\nimport type { UseHistoryReturn } from \"./history\";\n\n/**\n * The mutable slice of an editor this wraps — structural, so the OSS and Cloud\n * `useEditor` returns both satisfy it without either having to grow toward the\n * other. Not `Readonly`: the whole point is to replace these members in place.\n */\nexport interface HistoryInterceptorEditor {\n addBlock: (\n block: Block,\n targetSectionId?: string,\n columnIndex?: number,\n index?: number,\n ) => void;\n removeBlock: (blockId: string) => void;\n moveBlock: (\n blockId: string,\n newIndex: number,\n targetSectionId?: string,\n columnIndex?: number,\n ) => void;\n updateBlock: (blockId: string, updates: Partial<Block>) => void;\n updateSettings: (updates: Partial<TemplateSettings>) => void;\n isBlockLocked: (blockId: string) => boolean;\n}\n\n/**\n * Wraps editor mutation methods to record history snapshots before each\n * operation. Mutates the editor object in place.\n *\n * Must be applied **after** any collaboration broadcast wrapping so the\n * call chain is: history.record() → broadcast → original mutation.\n */\nexport function useHistoryInterceptor(\n editor: HistoryInterceptorEditor,\n history: UseHistoryReturn,\n): void {\n const originalAddBlock = editor.addBlock;\n const originalRemoveBlock = editor.removeBlock;\n const originalMoveBlock = editor.moveBlock;\n const originalUpdateBlock = editor.updateBlock;\n const originalUpdateSettings = editor.updateSettings;\n\n // Skip recording when the underlying op is a no-op (e.g., a peer-locked\n // block or section), otherwise the undo stack fills with snapshots that\n // are identical to current state and undo silently does nothing.\n editor.addBlock = (block, targetSectionId?, columnIndex?, index?) => {\n if (targetSectionId && editor.isBlockLocked(targetSectionId)) {\n return;\n }\n history.record();\n originalAddBlock(block, targetSectionId, columnIndex, index);\n };\n\n editor.removeBlock = (blockId) => {\n if (editor.isBlockLocked(blockId)) {\n return;\n }\n history.record();\n originalRemoveBlock(blockId);\n };\n\n editor.moveBlock = (blockId, newIndex, targetSectionId?, columnIndex?) => {\n if (editor.isBlockLocked(blockId)) {\n return;\n }\n if (targetSectionId && editor.isBlockLocked(targetSectionId)) {\n return;\n }\n history.record();\n originalMoveBlock(blockId, newIndex, targetSectionId, columnIndex);\n };\n\n editor.updateBlock = (blockId, updates) => {\n if (editor.isBlockLocked(blockId)) {\n return;\n }\n history.recordDebounced(blockId);\n originalUpdateBlock(blockId, updates);\n };\n\n editor.updateSettings = (updates) => {\n history.record();\n originalUpdateSettings(updates);\n };\n}\n","import type {\n Block,\n SavedBlock,\n SavedBlockPatch,\n SavedBlocksListParams,\n SavedBlocksProvider,\n} from \"@templatical/types\";\nimport { SdkError } from \"@templatical/types\";\nimport { computed, ref, type ComputedRef, type Ref } from \"vue\";\nimport { notifyHandler } from \"./error-reporting\";\n\nexport interface UseSavedBlocksOptions {\n /**\n * Storage backend. Supplied by the consumer via `init({ savedBlocks })`, or\n * by Cloud's own adapter — this composable is transport-agnostic and never\n * talks to a network itself.\n */\n provider: SavedBlocksProvider;\n onError?: (error: Error) => void;\n}\n\nexport interface UseSavedBlocksReturn {\n /** In-memory mirror of the provider's list, kept in sync after each call. */\n savedBlocks: Ref<SavedBlock[]>;\n isLoading: Ref<boolean>;\n /**\n * Distinct categories across the loaded entries, alphabetically sorted.\n *\n * Derived rather than stored: a category exists exactly as long as an entry\n * carries it. Sorting here is not a violation of \"the editor never re-sorts\"\n * — that rule protects the provider's ordering of *entries*, whereas these\n * are strings with no given order.\n */\n categories: ComputedRef<string[]>;\n /**\n * Whether the provider supplied each mutation at all — `false` on the\n * provider means the capability does not exist for this user, and the UI\n * hides the corresponding affordance entirely.\n *\n * Constant for the provider's lifetime, but exposed as computed refs so\n * consumers can bind them the same way as everything else here.\n */\n canCreate: ComputedRef<boolean>;\n canUpdate: ComputedRef<boolean>;\n canDelete: ComputedRef<boolean>;\n /**\n * Whether a *particular* entry may be edited / deleted: the capability must\n * exist AND the entry must not opt out via `canUpdate` / `canDelete`.\n *\n * Use these rather than reading the flags directly, so every surface asks the\n * question the same way and the \"absent means allowed\" default lives in one\n * place.\n */\n canUpdateBlock: (block: SavedBlock) => boolean;\n canDeleteBlock: (block: SavedBlock) => boolean;\n /**\n * Re-read from the provider. The editor always calls this bare and filters\n * in memory; `params` exists for headless callers that want the provider to\n * filter instead (see {@link SavedBlocksListParams}).\n */\n load: (params?: SavedBlocksListParams) => Promise<void>;\n /** Rejects with an {@link SdkError} when the provider disabled `create`. */\n create: (\n name: string,\n content: Block[],\n category?: string,\n ) => Promise<SavedBlock>;\n /** Rejects when `update` is disabled or the entry opts out of editing. */\n update: (id: string, patch: SavedBlockPatch) => Promise<SavedBlock>;\n /** Rejects when `delete` is disabled or the entry opts out of deletion. */\n remove: (id: string) => Promise<void>;\n}\n\n/**\n * Reactive state over a {@link SavedBlocksProvider}.\n *\n * Owns the list, the loading flag, and the local mutations that keep the list\n * consistent after each successful call, so a provider only has to implement\n * four promise-returning methods. Errors are reported through `onError` and\n * re-thrown, leaving the local list untouched on failure.\n */\nexport function useSavedBlocks(\n options: UseSavedBlocksOptions,\n): UseSavedBlocksReturn {\n const { provider } = options;\n\n const savedBlocks = ref<SavedBlock[]>([]);\n const isLoading = ref(false);\n\n const categories = computed(() => {\n const seen = new Set<string>();\n for (const block of savedBlocks.value) {\n const category = block.category?.trim();\n if (category) seen.add(category);\n }\n return [...seen].sort((a, b) => a.localeCompare(b));\n });\n\n const canCreate = computed(() => typeof provider.create === \"function\");\n const canUpdate = computed(() => typeof provider.update === \"function\");\n const canDelete = computed(() => typeof provider.delete === \"function\");\n\n /** Absent flag means allowed — the flags exist only to forbid. */\n function canUpdateBlock(block: SavedBlock): boolean {\n return canUpdate.value && block.canUpdate !== false;\n }\n\n function canDeleteBlock(block: SavedBlock): boolean {\n return canDelete.value && block.canDelete !== false;\n }\n\n /**\n * The UI hides disabled actions, so reaching one of these means a programmatic\n * caller went around it. Fail loudly rather than silently no-op: a resolved\n * promise would read as \"saved\" to whoever awaited it.\n */\n function refuse(action: string, reason: string): never {\n throw new SdkError(\n `[Templatical] Saved blocks: ${action} is ${reason}. Check the capability before calling — the editor's own UI hides the action.`,\n );\n }\n\n /**\n * Run a consumer's event handler without letting it fail the operation.\n *\n * A handler that throws must not turn a completed write into a rejected one —\n * the UI would report a failure for a saved block that was created.\n */\n function notify(run: () => void): void {\n notifyHandler(options.onError, run);\n }\n\n async function load(params?: SavedBlocksListParams): Promise<void> {\n isLoading.value = true;\n try {\n savedBlocks.value = await provider.list(params);\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n } finally {\n isLoading.value = false;\n }\n }\n\n async function create(\n name: string,\n content: Block[],\n category?: string,\n ): Promise<SavedBlock> {\n const { create: providerCreate } = provider;\n if (typeof providerCreate !== \"function\") {\n refuse(\"create\", \"disabled by the provider\");\n }\n try {\n // Omit the key entirely when unset, rather than sending `undefined` —\n // a provider serialising the input to JSON would otherwise be handed an\n // explicit null-ish field it never asked for.\n const created = await providerCreate(\n category ? { name, content, category } : { name, content },\n );\n savedBlocks.value = [created, ...savedBlocks.value];\n notify(() => provider.onCreated?.(created));\n return created;\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n }\n }\n\n async function update(\n id: string,\n patch: SavedBlockPatch,\n ): Promise<SavedBlock> {\n const { update: providerUpdate } = provider;\n if (typeof providerUpdate !== \"function\") {\n refuse(\"update\", \"disabled by the provider\");\n }\n // An id absent from the local list isn't refused — a headless caller may\n // legitimately patch something it never loaded. Only a loaded entry that\n // explicitly opted out is blocked.\n const local = savedBlocks.value.find((b) => b.id === id);\n if (local && local.canUpdate === false) {\n refuse(\"update\", `not permitted for entry \"${id}\"`);\n }\n try {\n const updated = await providerUpdate(id, patch);\n savedBlocks.value = savedBlocks.value.map((b) =>\n b.id === id ? updated : b,\n );\n notify(() => provider.onUpdated?.(updated));\n return updated;\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n }\n }\n\n async function remove(id: string): Promise<void> {\n const { delete: providerDelete } = provider;\n if (typeof providerDelete !== \"function\") {\n refuse(\"delete\", \"disabled by the provider\");\n }\n // Captured before the delete resolves: `onDeleted` carries the removed\n // entry itself, and there is nothing left to read once the list is\n // filtered.\n const removed = savedBlocks.value.find((b) => b.id === id) ?? null;\n if (removed && removed.canDelete === false) {\n refuse(\"delete\", `not permitted for entry \"${id}\"`);\n }\n try {\n await providerDelete(id);\n savedBlocks.value = savedBlocks.value.filter((b) => b.id !== id);\n if (removed) {\n notify(() => provider.onDeleted?.(removed));\n }\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n }\n }\n\n return {\n savedBlocks,\n isLoading,\n categories,\n canCreate,\n canUpdate,\n canDelete,\n canUpdateBlock,\n canDeleteBlock,\n load,\n create,\n update,\n remove,\n };\n}\n","import type {\n SavedBlock,\n SavedBlockInput,\n SavedBlockPatch,\n SavedBlocksListParams,\n SavedBlocksProvider,\n} from \"@templatical/types\";\nimport { generateId } from \"@templatical/types\";\n\nexport interface LocalStorageSavedBlocksOptions {\n /**\n * `localStorage` key holding the serialized array.\n *\n * @default \"templatical:saved-blocks\"\n */\n key?: string;\n}\n\nconst DEFAULT_KEY = \"templatical:saved-blocks\";\n\n/**\n * Browser-local {@link SavedBlocksProvider} backed by `localStorage`.\n *\n * Opt-in: pass it explicitly as `init({ savedBlocks: createLocalStorageSavedBlocksProvider() })`.\n * The editor never falls back to it, so consumers without a provider keep the\n * feature — and its UI — entirely off.\n *\n * Intended for demos, prototypes, and single-device use. Entries live in one\n * browser profile only: they don't sync across devices or users, and clearing\n * site data removes them. Back saved blocks with your own API for anything\n * that needs to outlive a browser profile.\n */\nexport function createLocalStorageSavedBlocksProvider(\n options: LocalStorageSavedBlocksOptions = {},\n): SavedBlocksProvider {\n const storageKey = options.key ?? DEFAULT_KEY;\n\n function getStorage(): Storage {\n // Core targets a neutral platform, so `localStorage` isn't guaranteed —\n // fail with an actionable message rather than a bare ReferenceError.\n if (typeof localStorage === \"undefined\") {\n throw new Error(\n \"[Templatical] createLocalStorageSavedBlocksProvider requires a browser environment with localStorage. Supply your own SavedBlocksProvider for server-side or non-browser use.\",\n );\n }\n return localStorage;\n }\n\n function readAll(): SavedBlock[] {\n const raw = getStorage().getItem(storageKey);\n if (!raw) return [];\n try {\n const parsed: unknown = JSON.parse(raw);\n // Tolerate a corrupted or hand-edited value rather than breaking the\n // editor: treat anything that isn't an array as \"no saved blocks\".\n return Array.isArray(parsed) ? (parsed as SavedBlock[]) : [];\n } catch {\n return [];\n }\n }\n\n function writeAll(blocks: SavedBlock[]): void {\n getStorage().setItem(storageKey, JSON.stringify(blocks));\n }\n\n // Every method is `async` so a synchronous failure (a missing\n // `localStorage`, a quota error from `setItem`) surfaces as a rejected\n // promise rather than a sync throw — callers of a `Promise`-returning\n // contract must be able to rely on `.catch()`.\n return {\n // The editor calls this bare and filters in memory; the params are honored\n // for headless callers that would rather the provider did the work.\n async list(params?: SavedBlocksListParams): Promise<SavedBlock[]> {\n const all = readAll();\n const search = params?.search?.trim().toLowerCase();\n const category = params?.category?.trim();\n return all.filter((b) => {\n if (search && !b.name.toLowerCase().includes(search)) return false;\n if (category && b.category !== category) return false;\n return true;\n });\n },\n\n // All three mutations are enabled: a browser-local store has no notion of\n // permissions, so there is nothing to forbid.\n async create(input: SavedBlockInput): Promise<SavedBlock> {\n const now = new Date().toISOString();\n const created: SavedBlock = {\n id: generateId(),\n name: input.name,\n content: input.content,\n ...(input.category ? { category: input.category } : {}),\n createdAt: now,\n updatedAt: now,\n };\n // Newest-first, matching the order the composable applies locally after\n // a create — so a reload preserves what the user just saw.\n writeAll([created, ...readAll()]);\n return created;\n },\n\n async update(id: string, patch: SavedBlockPatch): Promise<SavedBlock> {\n const all = readAll();\n const index = all.findIndex((b) => b.id === id);\n // Mirrors a REST 404 so provider behavior is consistent across adapters.\n if (index === -1) {\n throw new Error(`[Templatical] Saved block not found: ${id}`);\n }\n const updated: SavedBlock = {\n ...all[index],\n ...patch,\n updatedAt: new Date().toISOString(),\n };\n const next = [...all];\n next[index] = updated;\n writeAll(next);\n return updated;\n },\n\n async delete(id: string): Promise<void> {\n const all = readAll();\n if (!all.some((b) => b.id === id)) {\n throw new Error(`[Templatical] Saved block not found: ${id}`);\n }\n writeAll(all.filter((b) => b.id !== id));\n },\n };\n}\n","import type {\n MediaAsset,\n MediaAssetPatch,\n MediaCreateInput,\n MediaListPage,\n MediaListParams,\n MediaProvider,\n} from \"@templatical/types\";\nimport { generateId } from \"@templatical/types\";\n\nexport interface LocalStorageMediaProviderOptions {\n /**\n * `localStorage` key holding the serialized array.\n *\n * @default \"templatical:media\"\n */\n key?: string;\n}\n\nconst DEFAULT_KEY = \"templatical:media\";\nconst PAGE_SIZE = 50;\n\n/**\n * Browser-local {@link MediaProvider} backed by `localStorage`.\n *\n * Opt-in: pass it explicitly as `init({ media: createLocalStorageMediaProvider() })`.\n * The editor never falls back to it, so consumers without a provider keep\n * image fields URL-only.\n *\n * `create` stores the file as a data URL. That is a demo-sized persistence\n * model — `localStorage` quotas are typically ~5 MB, and a few large\n * images will fill it. Back a real gallery with your own API.\n *\n * Folders, replace, import, usage, frequently-used and quota are `false`:\n * this adapter is a flat list of assets.\n */\nexport function createLocalStorageMediaProvider(\n options: LocalStorageMediaProviderOptions = {},\n): MediaProvider {\n const storageKey = options.key ?? DEFAULT_KEY;\n\n function getStorage(): Storage {\n // Core targets a neutral platform, so `localStorage` isn't guaranteed —\n // fail with an actionable message rather than a bare ReferenceError.\n if (typeof localStorage === \"undefined\") {\n throw new Error(\n \"[Templatical] createLocalStorageMediaProvider requires a browser environment with localStorage. Supply your own MediaProvider for server-side or non-browser use.\",\n );\n }\n return localStorage;\n }\n\n function readAll(): MediaAsset[] {\n const raw = getStorage().getItem(storageKey);\n if (!raw) return [];\n try {\n const parsed: unknown = JSON.parse(raw);\n // Tolerate a corrupted or hand-edited value rather than breaking the\n // editor: treat anything that isn't an array as \"no assets\".\n return Array.isArray(parsed) ? (parsed as MediaAsset[]) : [];\n } catch {\n return [];\n }\n }\n\n function writeAll(assets: MediaAsset[]): void {\n getStorage().setItem(storageKey, JSON.stringify(assets));\n }\n\n function readFileAsDataURL(file: File): Promise<string> {\n if (typeof FileReader === \"undefined\") {\n return Promise.reject(\n new Error(\n \"[Templatical] createLocalStorageMediaProvider requires a browser environment with FileReader.\",\n ),\n );\n }\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n if (typeof reader.result !== \"string\") {\n reject(new Error(\"[Templatical] Failed to read file as a data URL.\"));\n return;\n }\n resolve(reader.result);\n };\n reader.onerror = () => {\n reject(\n reader.error ??\n new Error(\"[Templatical] Failed to read file as a data URL.\"),\n );\n };\n reader.readAsDataURL(file);\n });\n }\n\n // Every method is `async` so a synchronous failure (a missing\n // `localStorage`, a quota error from `setItem`) surfaces as a rejected\n // promise rather than a sync throw — callers of a `Promise`-returning\n // contract must be able to rely on `.catch()`.\n return {\n async list(params?: MediaListParams): Promise<MediaListPage> {\n const all = readAll();\n const search = params?.search?.trim().toLowerCase();\n const filtered = search\n ? all.filter((asset) => {\n const filename = asset.filename?.toLowerCase() ?? \"\";\n const alt = asset.alt?.toLowerCase() ?? \"\";\n return filename.includes(search) || alt.includes(search);\n })\n : all;\n const parsed = params?.cursor ? Number.parseInt(params.cursor, 10) : 0;\n const offset = Number.isFinite(parsed) && parsed > 0 ? parsed : 0;\n const items = filtered.slice(offset, offset + PAGE_SIZE);\n const page: MediaListPage = { items };\n const nextOffset = offset + items.length;\n if (nextOffset < filtered.length) {\n page.nextCursor = String(nextOffset);\n }\n return page;\n },\n\n async create(input: MediaCreateInput): Promise<MediaAsset> {\n const url = await readFileAsDataURL(input.file);\n const now = new Date().toISOString();\n const created: MediaAsset = {\n id: generateId(),\n url,\n filename: input.filename || input.file.name,\n createdAt: now,\n updatedAt: now,\n size: input.file.size,\n };\n if (input.alt !== undefined) created.alt = input.alt;\n if (input.file.type) created.mimeType = input.file.type;\n if (input.folderId !== undefined) created.folderId = input.folderId;\n // Newest-first, matching the order the composable applies locally after\n // a create — so a reload preserves what the user just saw.\n writeAll([created, ...readAll()]);\n return created;\n },\n\n async update(id: string, patch: MediaAssetPatch): Promise<MediaAsset> {\n const all = readAll();\n const index = all.findIndex((asset) => asset.id === id);\n // Mirrors a REST 404 so provider behavior is consistent across adapters.\n if (index === -1) {\n throw new Error(`[Templatical] Media asset not found: ${id}`);\n }\n const current = all[index];\n const updated: MediaAsset = {\n ...current,\n ...patch,\n id: current.id,\n url: current.url,\n updatedAt: new Date().toISOString(),\n };\n const next = [...all];\n next[index] = updated;\n writeAll(next);\n return updated;\n },\n\n async delete(ids: string[]): Promise<void> {\n const all = readAll();\n for (const id of ids) {\n if (!all.some((asset) => asset.id === id)) {\n throw new Error(`[Templatical] Media asset not found: ${id}`);\n }\n }\n const remove = new Set(ids);\n writeAll(all.filter((asset) => !remove.has(asset.id)));\n },\n\n folders: false,\n replace: false,\n importFromUrl: false,\n checkUsage: false,\n frequentlyUsed: false,\n storage: false,\n };\n}\n","import type {\n Template,\n TemplateContent,\n TemplateVersion,\n VersionHistoryListParams,\n VersionHistoryProvider,\n} from \"@templatical/types\";\nimport { SdkError } from \"@templatical/types\";\nimport { computed, ref, type ComputedRef, type Ref } from \"vue\";\nimport { notifyHandler } from \"./error-reporting\";\n\nexport interface UseVersionHistoryOptions {\n /**\n * Storage backend. Supplied by the consumer via `init({ versionHistory })`,\n * or by Cloud's own adapter — this composable is transport-agnostic and never\n * talks to a network itself.\n */\n provider: VersionHistoryProvider;\n /**\n * Which template's history this is. A getter rather than a value because a\n * session can outlive the template: `initCloud()` constructs the feature at\n * setup and only learns the id once `create()` / `load()` resolves.\n */\n getTemplateId: () => string | null;\n onError?: (error: Error) => void;\n}\n\nexport interface UseVersionHistoryReturn {\n /** The provider's list, in the provider's order. Never re-sorted. */\n versions: Ref<TemplateVersion[]>;\n isLoading: Ref<boolean>;\n isRestoring: Ref<boolean>;\n /**\n * Cursor for the page after the one currently held, or `undefined` when the\n * provider signalled there is no more. The editor loads one page and ignores\n * this; it is here so a headless caller can page without reaching past the\n * composable.\n */\n nextCursor: Ref<string | undefined>;\n /** Whether the provider supplied each mutation at all. */\n canCreate: ComputedRef<boolean>;\n canRestore: ComputedRef<boolean>;\n /** Re-read the list. The editor calls this bare; `params` is for headless callers. */\n load: (params?: VersionHistoryListParams) => Promise<void>;\n /**\n * The version's content **if it is already in hand** — the provider's\n * `content` hint, or a previous `get` this composable cached. `null` means a\n * round-trip is required.\n *\n * Callers that must not block (scrubbing through history swaps the canvas in\n * the same tick) check this first and only await {@link resolveContent} when\n * it comes back null.\n */\n peekContent: (version: TemplateVersion) => TemplateContent | null;\n /**\n * `version.content ?? await provider.get(...)`, cached per version id, so a\n * lazily-loaded version costs one round-trip on its first visit and nothing\n * afterwards.\n */\n resolveContent: (version: TemplateVersion) => Promise<TemplateContent>;\n /** Rejects with an {@link SdkError} when the provider disabled `create`. */\n create: (\n content: TemplateContent,\n meta?: { label?: string },\n ) => Promise<TemplateVersion>;\n /** Rejects with an {@link SdkError} when the provider disabled `restore`. */\n restore: (versionId: string) => Promise<Template>;\n}\n\n/**\n * Reactive state over a {@link VersionHistoryProvider}.\n *\n * Owns the list, the loading flags and the per-version content cache that keeps\n * scrubbing synchronous. Errors are reported through `onError` and re-thrown,\n * leaving the list untouched on failure.\n *\n * It deliberately does **not** create versions of its own accord. The editor\n * never records a version on a save — whoever implements `TemplatesProvider.save`\n * decides that, because they are the side that pays for the storage.\n */\nexport function useVersionHistory(\n options: UseVersionHistoryOptions,\n): UseVersionHistoryReturn {\n const { provider, getTemplateId } = options;\n\n const versions = ref<TemplateVersion[]>([]);\n const isLoading = ref(false);\n const nextCursor = ref<string | undefined>(undefined);\n const isRestoring = ref(false);\n\n /**\n * Content fetched through `get`, keyed by version id. A version that carried\n * a `content` hint never lands here — the hint is read straight off the entry,\n * so a provider that eager-loads pays no second copy.\n */\n const fetched = new Map<string, TemplateContent>();\n\n const canCreate = computed(() => typeof provider.create === \"function\");\n const canRestore = computed(() => typeof provider.restore === \"function\");\n\n /**\n * The UI hides disabled actions and renders nothing before a template exists,\n * so reaching one of these means a programmatic caller went around it. Fail\n * loudly rather than silently no-op: a resolved promise reads as \"done\".\n */\n function requireTemplateId(action: string): string {\n const templateId = getTemplateId();\n if (!templateId) {\n throw new SdkError(\n `[Templatical] Version history: ${action} needs a template. Call create() or load() first.`,\n );\n }\n return templateId;\n }\n\n function refuse(action: string): never {\n throw new SdkError(\n `[Templatical] Version history: ${action} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`,\n );\n }\n\n /**\n * Run a consumer's event handler without letting it fail the operation.\n *\n * A handler that throws must not turn a completed write into a rejected one —\n * the UI would report a failure for a version that was recorded or restored.\n */\n function notify(run: () => void): void {\n notifyHandler(options.onError, run);\n }\n\n async function load(params?: VersionHistoryListParams): Promise<void> {\n const templateId = requireTemplateId(\"list\");\n isLoading.value = true;\n try {\n const page = await provider.list(templateId, params);\n versions.value = page.versions;\n nextCursor.value = page.nextCursor;\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n } finally {\n isLoading.value = false;\n }\n }\n\n function peekContent(version: TemplateVersion): TemplateContent | null {\n return version.content ?? fetched.get(version.id) ?? null;\n }\n\n async function resolveContent(\n version: TemplateVersion,\n ): Promise<TemplateContent> {\n const known = peekContent(version);\n if (known) return known;\n\n const templateId = requireTemplateId(\"get\");\n try {\n const content = await provider.get(templateId, version.id);\n fetched.set(version.id, content);\n return content;\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n }\n }\n\n async function create(\n content: TemplateContent,\n meta?: { label?: string },\n ): Promise<TemplateVersion> {\n const { create: providerCreate } = provider;\n if (typeof providerCreate !== \"function\") refuse(\"create\");\n const templateId = requireTemplateId(\"create\");\n try {\n const created = await providerCreate(templateId, content, meta);\n versions.value = [created, ...versions.value];\n notify(() => provider.onCreated?.(created));\n return created;\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n }\n }\n\n async function restore(versionId: string): Promise<Template> {\n const { restore: providerRestore } = provider;\n if (typeof providerRestore !== \"function\") refuse(\"restore\");\n const templateId = requireTemplateId(\"restore\");\n\n let restored: Template;\n isRestoring.value = true;\n try {\n restored = await providerRestore(templateId, versionId);\n } catch (error) {\n options.onError?.(error as Error);\n throw error;\n } finally {\n isRestoring.value = false;\n }\n // Below the `finally` on purpose: `isRestoring` is cleared there, so a\n // handler must not observe the composable still reporting itself\n // mid-restore. Unreachable on failure — the catch rethrows.\n notify(() => provider.onRestored?.(restored));\n return restored;\n }\n\n return {\n nextCursor,\n versions,\n isLoading,\n isRestoring,\n canCreate,\n canRestore,\n load,\n peekContent,\n resolveContent,\n create,\n restore,\n };\n}\n","import type {\n Comment,\n CommentAuthor,\n CommentChange,\n CommentInput,\n CommentPatch,\n CommentsListParams,\n CommentsProvider,\n} from \"@templatical/types\";\nimport { SdkError } from \"@templatical/types\";\nimport {\n computed,\n onScopeDispose,\n ref,\n watch,\n type ComputedRef,\n type Ref,\n} from \"vue\";\nimport { notifyHandler, wrapReportedError } from \"./error-reporting\";\n\nexport interface UseCommentsOptions {\n /**\n * Storage backend. Supplied by the consumer via `init({ comments })`, or by\n * Cloud's own adapter — this composable is transport-agnostic and never talks\n * to a network itself.\n */\n provider: CommentsProvider;\n /**\n * Which template's conversation this is. A getter rather than a value because a\n * session can outlive the template: `initCloud()` constructs the feature at\n * setup and only learns the id once `create()` / `load()` resolves.\n */\n getTemplateId: () => string | null;\n /**\n * Who is commenting, read at call time. `null` means the editor has no\n * identity, and every mutation refuses — an unattributable comment is worse\n * than no comment feature.\n */\n getUser: () => CommentAuthor | null;\n onError?: (error: Error) => void;\n}\n\nexport interface UseCommentsReturn {\n /** Thread roots in the provider's order. Never re-sorted. */\n comments: Ref<Comment[]>;\n isLoading: Ref<boolean>;\n isSubmitting: Ref<boolean>;\n /** Whether the provider supplied each mutation at all. */\n canCreate: ComputedRef<boolean>;\n canUpdate: ComputedRef<boolean>;\n canDelete: ComputedRef<boolean>;\n canResolve: ComputedRef<boolean>;\n /** Roots plus replies. */\n totalCount: ComputedRef<number>;\n /** Unresolved roots — the badge on the trigger. */\n unresolvedCount: ComputedRef<number>;\n /** Comments per anchored block id, roots plus their replies. */\n commentCountByBlock: ComputedRef<Map<string, number>>;\n /** Re-read the list. The editor calls this bare; `params` is for headless callers. */\n load: (params?: CommentsListParams) => Promise<void>;\n /** Rejects with an {@link SdkError} when `create` is disabled or there is no user. */\n create: (input: CommentInput) => Promise<Comment>;\n /** Rejects with an {@link SdkError} when `update` is disabled or there is no user. */\n update: (commentId: string, patch: CommentPatch) => Promise<Comment>;\n /** Rejects with an {@link SdkError} when `delete` is disabled or there is no user. */\n remove: (commentId: string) => Promise<void>;\n /** Rejects with an {@link SdkError} when `setResolved` is disabled or there is no user. */\n setResolved: (commentId: string, resolved: boolean) => Promise<Comment>;\n /** Look one up by id, root or reply. `null` when it isn't loaded. */\n find: (commentId: string) => Comment | null;\n /** Whether this comment was written by the current user. */\n isOwn: (comment: Comment) => boolean;\n /**\n * Apply a change that arrived from {@link CommentsProvider.subscribe}. Public\n * so a consumer driving this headlessly can push their own transport into it.\n */\n applyRemoteCreate: (comment: Comment) => void;\n applyRemoteUpdate: (comment: Comment) => void;\n applyRemoteDelete: (commentId: string, parentId?: string | null) => void;\n}\n\n/**\n * Reactive state over a {@link CommentsProvider}.\n *\n * Owns the thread list, the loading flags, the local mutations that keep the list\n * consistent, and the derived counts the chrome renders. Errors are reported\n * through `onError` and **re-thrown**, leaving the list untouched on failure —\n * the same discipline as `useSavedBlocks` and `useVersionHistory`.\n *\n * Mutations **reject** when the provider withheld them rather than resolving to\n * `null`: a resolved promise reads as \"saved\" to whoever awaited it. Ask through\n * `canCreate` / `canUpdate` / `canDelete` / `canResolve` first — which is what the\n * editor's own UI does, hiding each action rather than disabling it.\n */\nexport function useComments(options: UseCommentsOptions): UseCommentsReturn {\n const { provider, getTemplateId, getUser } = options;\n\n const comments = ref<Comment[]>([]);\n const isLoading = ref(false);\n const isSubmitting = ref(false);\n\n const canCreate = computed(() => typeof provider.create === \"function\");\n const canUpdate = computed(() => typeof provider.update === \"function\");\n const canDelete = computed(() => typeof provider.delete === \"function\");\n const canResolve = computed(() => typeof provider.setResolved === \"function\");\n\n const totalCount = computed(() =>\n comments.value.reduce(\n (sum, thread) => sum + 1 + (thread.replies?.length ?? 0),\n 0,\n ),\n );\n\n const unresolvedCount = computed(\n () => comments.value.filter((thread) => !thread.resolvedAt).length,\n );\n\n const commentCountByBlock = computed(() => {\n const map = new Map<string, number>();\n for (const thread of comments.value) {\n if (!thread.blockId) continue;\n map.set(\n thread.blockId,\n (map.get(thread.blockId) ?? 0) + 1 + (thread.replies?.length ?? 0),\n );\n }\n return map;\n });\n\n /**\n * The UI hides disabled actions and renders nothing before a template exists,\n * so reaching one of these means a programmatic caller went around it. Fail\n * loudly rather than silently no-op.\n */\n function requireTemplateId(action: string): string {\n const templateId = getTemplateId();\n if (!templateId) {\n throw new SdkError(\n `[Templatical] Comments: ${action} needs a template. Call create() or load() first.`,\n );\n }\n return templateId;\n }\n\n function requireUser(action: string): CommentAuthor {\n const user = getUser();\n if (!user) {\n throw new SdkError(\n `[Templatical] Comments: ${action} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`,\n );\n }\n return user;\n }\n\n function refuse(action: string): never {\n throw new SdkError(\n `[Templatical] Comments: ${action} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`,\n );\n }\n\n function find(commentId: string): Comment | null {\n for (const thread of comments.value) {\n if (thread.id === commentId) return thread;\n for (const reply of thread.replies ?? []) {\n if (reply.id === commentId) return reply;\n }\n }\n return null;\n }\n\n function isOwn(comment: Comment): boolean {\n const user = getUser();\n return user !== null && comment.author.id === user.id;\n }\n\n function report(error: unknown): never {\n const wrapped = wrapReportedError(error);\n options.onError?.(wrapped);\n throw wrapped;\n }\n\n /**\n * Run a consumer's event handler without letting it fail the operation.\n *\n * A handler that throws must not turn a completed write into a rejected one —\n * the UI would report a failure for a comment that was created.\n */\n function notify(run: () => void): void {\n notifyHandler(options.onError, run);\n }\n\n function replaceAt<T>(list: T[], index: number, next: T): T[] {\n return [...list.slice(0, index), next, ...list.slice(index + 1)];\n }\n\n /**\n * Key-order sensitive: identical fields serialized in a different order\n * compare unequal, so an echo whose transport frame orders keys\n * differently than the mutation response it echoes would not be\n * suppressed. Accepted rather than a defect — not worth a deep-equal\n * dependency for it.\n */\n function sameComment(a: Comment | undefined, b: Comment): boolean {\n return a !== undefined && JSON.stringify(a) === JSON.stringify(b);\n }\n\n /**\n * Insert a comment, replacing an entry with the same id rather than\n * duplicating it, and report whether the list actually changed.\n *\n * The **remote** apply paths (`applyRemoteCreate` / `applyRemoteUpdate`)\n * emit their event only when this returns `true`. A transport's own\n * broadcast can come back to the sender — `CommentsProvider.subscribe`'s\n * contract permits it — and emitting unconditionally fires the handler\n * twice for one comment. The comparison below runs against the **merged**\n * result, never the raw payload: the root branch keeps already-loaded\n * `replies` when an update payload carries none, so comparing the payload\n * directly would report a change for an echo that altered nothing.\n * Deleting the `sameComment` check as a redundant no-op reinstates the\n * double-fire.\n */\n function upsert(comment: Comment): boolean {\n if (comment.parentId) {\n let changed = false;\n const next = comments.value.map((thread) => {\n if (thread.id !== comment.parentId) return thread;\n const replies = thread.replies ?? [];\n const at = replies.findIndex((reply) => reply.id === comment.id);\n if (at !== -1 && sameComment(replies[at], comment)) return thread;\n changed = true;\n return {\n ...thread,\n replies:\n at === -1 ? [...replies, comment] : replaceAt(replies, at, comment),\n };\n });\n // Assigned only when something actually changed: `.map()` always returns\n // a new array, and reassigning `comments.value` for a no-op echo would\n // still invalidate every computed reading it (`commentCountByBlock`\n // returns a new `Map` on each recompute) for nothing.\n if (changed) comments.value = next;\n return changed;\n }\n\n const at = comments.value.findIndex((thread) => thread.id === comment.id);\n if (at === -1) {\n comments.value = [...comments.value, comment];\n return true;\n }\n // A root arriving again keeps the replies already loaded: the update payload\n // for a body edit carries none, and dropping them would empty the thread.\n const next: Comment = {\n ...comment,\n replies: comment.replies ?? comments.value[at].replies,\n };\n if (sameComment(comments.value[at], next)) return false;\n comments.value = replaceAt(comments.value, at, next);\n return true;\n }\n\n function drop(commentId: string, parentId?: string | null): Comment | null {\n const existing = find(commentId);\n // `parentId` from the caller wins so a delete can be applied without the\n // comment being loaded — the subscribe path, on a thread never opened.\n const parent = parentId ?? existing?.parentId ?? null;\n\n if (parent) {\n comments.value = comments.value.map((thread) =>\n thread.id === parent\n ? {\n ...thread,\n replies: (thread.replies ?? []).filter((r) => r.id !== commentId),\n }\n : thread,\n );\n } else {\n comments.value = comments.value.filter((c) => c.id !== commentId);\n }\n return existing;\n }\n\n async function load(params?: CommentsListParams): Promise<void> {\n const templateId = requireTemplateId(\"list\");\n isLoading.value = true;\n try {\n comments.value = await provider.list(templateId, params);\n } catch (error) {\n report(error);\n } finally {\n isLoading.value = false;\n }\n }\n\n async function create(input: CommentInput): Promise<Comment> {\n const { create: providerCreate } = provider;\n if (typeof providerCreate !== \"function\") refuse(\"create\");\n const templateId = requireTemplateId(\"create\");\n requireUser(\"create\");\n isSubmitting.value = true;\n try {\n const created = await providerCreate(templateId, input);\n upsert(created);\n notify(() => provider.onCreated?.(created, { origin: \"local\" }));\n return created;\n } catch (error) {\n report(error);\n } finally {\n isSubmitting.value = false;\n }\n }\n\n async function update(\n commentId: string,\n patch: CommentPatch,\n ): Promise<Comment> {\n const { update: providerUpdate } = provider;\n if (typeof providerUpdate !== \"function\") refuse(\"update\");\n const templateId = requireTemplateId(\"update\");\n requireUser(\"update\");\n isSubmitting.value = true;\n try {\n const updated = await providerUpdate(templateId, commentId, patch);\n upsert(updated);\n notify(() => provider.onUpdated?.(updated, { origin: \"local\" }));\n return updated;\n } catch (error) {\n report(error);\n } finally {\n isSubmitting.value = false;\n }\n }\n\n async function remove(commentId: string): Promise<void> {\n const { delete: providerDelete } = provider;\n if (typeof providerDelete !== \"function\") refuse(\"delete\");\n const templateId = requireTemplateId(\"delete\");\n requireUser(\"delete\");\n // Snapshotted before the request: the event carries what was deleted, and\n // there is nothing to read afterwards.\n const existing = find(commentId);\n isSubmitting.value = true;\n try {\n await providerDelete(templateId, commentId);\n drop(commentId);\n if (existing) {\n notify(() => provider.onDeleted?.(existing, { origin: \"local\" }));\n }\n } catch (error) {\n report(error);\n } finally {\n isSubmitting.value = false;\n }\n }\n\n async function setResolved(\n commentId: string,\n resolved: boolean,\n ): Promise<Comment> {\n const { setResolved: providerSetResolved } = provider;\n if (typeof providerSetResolved !== \"function\") refuse(\"setResolved\");\n const templateId = requireTemplateId(\"setResolved\");\n requireUser(\"setResolved\");\n isSubmitting.value = true;\n try {\n const updated = await providerSetResolved(\n templateId,\n commentId,\n resolved,\n );\n upsert(updated);\n // The stored result decides which event fires, not the requested state: a\n // store may refuse to reopen, and the consumer should hear what happened.\n notify(() =>\n (updated.resolvedAt ? provider.onResolved : provider.onUnresolved)?.(\n updated,\n { origin: \"local\" },\n ),\n );\n return updated;\n } catch (error) {\n report(error);\n } finally {\n isSubmitting.value = false;\n }\n }\n\n function applyRemoteCreate(comment: Comment): void {\n // A reply whose parent thread isn't loaded reports nothing: `upsert`\n // finds no matching thread to attach it to, so the list doesn't change.\n if (upsert(comment)) {\n notify(() => provider.onCreated?.(comment, { origin: \"remote\" }));\n }\n }\n\n function applyRemoteUpdate(comment: Comment): void {\n if (!upsert(comment)) return;\n notify(() =>\n (comment.resolvedAt\n ? provider.onResolved\n : // An unresolve and a body edit are both \"not resolved\"; only a payload\n // that used to be resolved is an unresolve, and the transport doesn't\n // say. `updated` is the honest answer for a plain change.\n provider.onUpdated)?.(comment, { origin: \"remote\" }),\n );\n }\n\n function applyRemoteDelete(\n commentId: string,\n parentId?: string | null,\n ): void {\n const existing = drop(commentId, parentId);\n if (existing) {\n notify(() => provider.onDeleted?.(existing, { origin: \"remote\" }));\n }\n }\n\n return {\n comments,\n isLoading,\n isSubmitting,\n canCreate,\n canUpdate,\n canDelete,\n canResolve,\n totalCount,\n unresolvedCount,\n commentCountByBlock,\n load,\n create,\n update,\n remove,\n setResolved,\n find,\n isOwn,\n applyRemoteCreate,\n applyRemoteUpdate,\n applyRemoteDelete,\n };\n}\n\nexport interface UseCommentListenerOptions {\n comments: UseCommentsReturn;\n provider: CommentsProvider;\n getTemplateId: () => string | null;\n}\n\n/**\n * Wire {@link CommentsProvider.subscribe} into the three `applyRemote*` paths.\n *\n * A no-op when the provider has no `subscribe` — realtime is optional, and\n * comments without it work exactly the same except that a colleague's comment\n * only appears on the next read. Nothing here knows about a transport: Cloud's\n * Pusher channel lives inside `createCloudCommentsProvider`, and an SSE or\n * long-poll implementation is the same three lines on the consumer's side.\n *\n * Re-subscribes when the template id changes, and unsubscribes on scope dispose —\n * so a session that loads a second template does not keep receiving the first\n * one's comments.\n */\nexport function useCommentListener(options: UseCommentListenerOptions): void {\n const { comments, provider, getTemplateId } = options;\n const { subscribe } = provider;\n if (typeof subscribe !== \"function\") return;\n\n let unsubscribe: (() => void) | null = null;\n\n function stop(): void {\n unsubscribe?.();\n unsubscribe = null;\n }\n\n watch(\n () => getTemplateId(),\n (templateId) => {\n stop();\n if (!templateId) return;\n unsubscribe = subscribe(templateId, (change: CommentChange) => {\n switch (change.type) {\n case \"created\":\n comments.applyRemoteCreate(change.comment);\n break;\n case \"updated\":\n comments.applyRemoteUpdate(change.comment);\n break;\n case \"deleted\":\n comments.applyRemoteDelete(change.commentId, change.parentId);\n break;\n }\n });\n },\n { immediate: true },\n );\n\n onScopeDispose(stop);\n}\n","import type { Translations } from \"../i18n\";\nimport type {\n Block,\n CustomBlock,\n CustomBlockDefinition,\n} from \"@templatical/types\";\n\n/**\n * Returns the i18n label for a built-in block type.\n * Falls back to the raw type string for unknown types.\n */\nexport function getBlockTypeLabel(\n blockType: string,\n translations: Translations,\n): string {\n const labels = translations.blocks as Record<string, string>;\n return labels[blockType] ?? blockType;\n}\n\n/**\n * Display label for a block *instance*, which is what user-facing copy wants:\n * built-ins resolve to their i18n label, custom blocks to the consumer's own\n * name for them (\"Featured Article\"), not the literal type `\"custom\"`.\n *\n * `blocks` carries no `custom` key on purpose — one generic \"Custom\" would make\n * two different custom blocks indistinguishable in a list. The name comes from\n * the definition instead; it is consumer-supplied and therefore NOT localized,\n * which is already how the toolbar and the sidebar palette present it.\n *\n * Falls back to `customType` (the slug) when no definition matches — an\n * instance whose definition was never registered — mirroring `Toolbar.vue`.\n * Pass the array injected under `CUSTOM_BLOCK_DEFINITIONS_KEY`; omitting it\n * degrades to that same slug fallback rather than throwing.\n */\nexport function getBlockLabel(\n block: Block,\n translations: Translations,\n customBlockDefinitions: readonly CustomBlockDefinition[] = [],\n): string {\n if (block.type !== \"custom\") {\n return getBlockTypeLabel(block.type, translations);\n }\n const { customType } = block as CustomBlock;\n const definition = customBlockDefinitions.find((d) => d.type === customType);\n return definition?.name ?? customType;\n}\n","import type { CustomBlockColorField } from \"@templatical/types\";\nimport {\n DEFAULT_RESOLVED_COLORS,\n resolveColorsConfig,\n type ResolvedColors,\n} from \"./resolveColorsConfig\";\n\n/**\n * The palette one custom-block color field renders, plus the audit signals a\n * consumer needs to warn about a field config that could not be honoured.\n *\n * Pure — this util never logs. The warnings live at the definition-registration\n * site (`useEditorCore`, via `collectColorFieldIssues`), the same resolver /\n * consumer split `resolveColorsConfig` and `resolvePaletteBlocks` use.\n */\nexport interface ResolvedFieldColors {\n /** The preset grid this field's picker renders. */\n presets: string[];\n /** Whether the wheel + hex input are offered alongside the grid. */\n allowCustom: boolean;\n /**\n * Entries of the FIELD's own `presets` dropped as invalid hex. Never includes\n * anything inherited from the editor palette — those were already validated\n * (and already warned about) at the editor level, so they are not re-reported.\n */\n invalidPresets: string[];\n /** The field declared `presets: []` — an empty list cannot narrow anything. */\n emptyPresets: boolean;\n /**\n * The field contributed no usable presets (unset, empty, or all-invalid), so\n * {@link ResolvedFieldColors.presets} is the editor's palette.\n */\n presetsInherited: boolean;\n /**\n * The field asked for `allowCustom: true` while the editor is locked. A field\n * may only narrow, so the request is dropped and the field stays locked.\n */\n allowCustomIgnored: boolean;\n}\n\n/**\n * Resolve a custom-block color field's own `presets` / `allowCustom` against\n * the already-resolved editor-wide palette. A field narrows the author's\n * freedom, not the palette: it can lock this field or give it its own presets,\n * but never unlock what the editor locked — and its `presets` *replace* the\n * editor grid rather than intersecting it (a locked field may list colors\n * outside it):\n *\n * - `allowCustom` — locked stays locked. `editorResolved.allowCustom === false`\n * wins outright, so an explicit field `allowCustom: true` under a locked\n * editor is ignored (flagged via `allowCustomIgnored`). Otherwise the field's\n * value applies, falling back to the editor's.\n * - `presets` — the field's entries are validated by {@link resolveColorsConfig}\n * (against the unconfigured baseline, so the hex rule lives in exactly one\n * place and inheritance is decided here rather than by that util's generic\n * per-property precedence). A non-empty valid list replaces the editor's;\n * unset, `[]`, or all-invalid all inherit the editor's palette. This is why\n * `[]` cannot mean \"no chips\" — an empty grid on a locked field would leave\n * the picker with nothing to pick.\n *\n * One residual case is left to `ColorPicker`'s own guard rather than forced\n * here: a field locking itself (`allowCustom: false`) when neither it nor the\n * editor has presets resolves to `{ presets: [], allowCustom: false }`, and the\n * picker's `showFreeform = allowCustom || !hasPresets` still renders the wheel,\n * so the field is never left unable to set a color.\n */\nexport function resolveFieldColors(\n field: Pick<CustomBlockColorField, \"presets\" | \"allowCustom\">,\n editorResolved: ResolvedColors,\n): ResolvedFieldColors {\n // Validate the field's own presets through the shared resolver, against the\n // unconfigured baseline — NOT against `editorResolved`, whose per-property\n // precedence would inherit before we can tell \"field said nothing\" apart\n // from \"field said something unusable\".\n const own = resolveColorsConfig(\n { presets: field.presets },\n DEFAULT_RESOLVED_COLORS,\n );\n\n const presetsInherited = own.presets.length === 0;\n\n const requestedAllowCustom = field.allowCustom ?? editorResolved.allowCustom;\n\n return {\n presets: presetsInherited ? editorResolved.presets : own.presets,\n allowCustom:\n editorResolved.allowCustom === false ? false : requestedAllowCustom,\n invalidPresets: own.invalidPresets,\n emptyPresets: field.presets !== undefined && field.presets.length === 0,\n presetsInherited,\n allowCustomIgnored:\n field.allowCustom === true && editorResolved.allowCustom === false,\n };\n}\n","import {\n computed,\n toValue,\n type ComputedRef,\n type MaybeRefOrGetter,\n} from \"vue\";\nimport { useDropZone } from \"@vueuse/core\";\n\nexport interface UseImageDropOptions {\n /** The drop target element (a template ref). */\n target: MaybeRefOrGetter<HTMLElement | null | undefined>;\n /**\n * Called with the dropped image file(s). The editor acts on a single file\n * per drop (`files[0]`), but the array shape is kept for forward-compat.\n */\n onFiles: (files: File[]) => void;\n /**\n * Gate the zone. While falsy the drop is inert: no highlight, dropped files\n * are ignored. Components pass `canDropMedia && !isUploading` so a\n * read-only library (`create: false`) renders no affordance, a missing\n * media handler does the same, and a second drop can't race an in-flight\n * upload.\n */\n enabled?: MaybeRefOrGetter<boolean>;\n}\n\nexport interface UseImageDropReturn {\n /** True while an image drag hovers the (enabled) target — drive the highlight. */\n isOver: ComputedRef<boolean>;\n}\n\nconst IMAGE_MIME_PREFIX = \"image/\";\n\n/**\n * Drag-and-drop image upload onto an image block/field (#229). Wraps\n * `useDropZone`; filters dropped files to image MIME types client-side (the\n * authoritative size/type check stays server/plan-config side) and forwards\n * the first image to `onFiles`. The caller hands the file to `onRequestMedia`,\n * which uploads it and returns a `MediaResult` — identical to the Browse Media\n * path, only the input differs.\n *\n * `preventDefaultForUnhandled` keeps the browser from navigating to the dropped\n * file even for a non-image drop on the zone; the editor-root guard covers\n * drops that land outside any zone.\n */\nexport function useImageDrop(options: UseImageDropOptions): UseImageDropReturn {\n const { target, onFiles, enabled } = options;\n\n const isEnabled = (): boolean =>\n enabled === undefined ? true : toValue(enabled);\n\n const { isOverDropZone } = useDropZone(target, {\n preventDefaultForUnhandled: true,\n onDrop: (files) => {\n if (!isEnabled()) return;\n const images = (files ?? []).filter((file) =>\n file.type.startsWith(IMAGE_MIME_PREFIX),\n );\n if (images.length > 0) onFiles([images[0]]);\n },\n });\n\n const isOver = computed(() => isEnabled() && isOverDropZone.value);\n\n return { isOver };\n}\n","import { SOCIAL_ICON_GLYPHS, type SocialPlatform } from \"@templatical/types\";\n\n/**\n * Icon glyph (SVG path + brand color) per platform. Re-exported from the\n * shared kernel in `@templatical/types` so the editor's inline SVG and the\n * renderer's PNG rasterizer never drift. Platform display labels are NOT here\n * — they come from i18n (`t.social.platforms[platform]`).\n */\nexport const socialIcons = SOCIAL_ICON_GLYPHS;\n\nexport const socialIconSizeMap: Record<\"small\" | \"medium\" | \"large\", number> = {\n small: 24,\n medium: 32,\n large: 48,\n};\n\nexport const socialPlatformOptions: SocialPlatform[] = [\n \"facebook\",\n \"twitter\",\n \"instagram\",\n \"linkedin\",\n \"youtube\",\n \"tiktok\",\n \"pinterest\",\n \"email\",\n \"website\",\n \"whatsapp\",\n \"telegram\",\n \"discord\",\n \"snapchat\",\n \"reddit\",\n \"github\",\n \"dribbble\",\n \"behance\",\n];\n"],"mappings":";;;;;AAQA,SAAgByB,EAAkB,GAAuB;CACvD,OAAOC,aAAiB,QACpBA,IACI,MAAM,OAAOA,CAAK,GAAG,EAAE,OAAOA,EAAM,CAAC;AAC/C;AAYA,SAAgBC,EACd,GACA,GACM;CACN,IAAI;EACF,EAAI;CACN,SAASD,GAAO;EACd,IAAUD,EAAkBC,CAAK,CAAC;CACpC;AACF;;;ACZA,SAASE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EAAO,SAAS,KAAGE,EAAQ,CAACF,EAAO,EAAE,CAAC;EAC5C;CACF,CAAC;CAID,OAAO,EAAE,QAFMhT,QAAeqJ,EAAU,KAAK8J,EAAe,KAEnD,EAAO;AAClB;;;ACzDA,IAAaC,IAAcrS,GAEdsS,IAAkE;CAC7E,OAAO;CACP,QAAQ;CACR,OAAO;AACT,GAEaC,IAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-B0aSnxlc.js";
|
|
2
|
-
import { $ as t, X as n, at as r, ct as i, et as a, lt as o, mt as s, nt as c, rt as l, st as ee, tt as u, ut as d } from "./src-
|
|
2
|
+
import { $ as t, X as n, at as r, ct as i, et as a, lt as o, mt as s, nt as c, rt as l, st as ee, tt as u, ut as d } from "./src-QIGNPFkl.js";
|
|
3
3
|
import { t as f } from "./htmlparser-ClUZ6waR.js";
|
|
4
4
|
//#region ../quality/src/types.ts
|
|
5
5
|
var te = {
|
|
@@ -1224,4 +1224,4 @@ function Jt(e, t = {}) {
|
|
|
1224
1224
|
//#endregion
|
|
1225
1225
|
export { Jt as lintTemplate };
|
|
1226
1226
|
|
|
1227
|
-
//# sourceMappingURL=src-
|
|
1227
|
+
//# sourceMappingURL=src-B5-VKcRQ.js.map
|