@templatical/editor 0.56.1 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{AiAltTextPopover-CpZ7UeAZ.js → AiAltTextPopover-BiZHthAB.js} +5 -5
- package/dist/{AiAltTextReview-LYxvn7Qe.js → AiAltTextReview-BwhROHiF.js} +6 -6
- package/dist/{AiChatPanel-Cy05P-iO.js → AiChatPanel-Cros4ZCM.js} +22 -25
- package/dist/AiPanels-D_CdHqFZ.js +26 -0
- package/dist/{AiRewriteMenu-DgqJHnza.js → AiRewriteMenu-6b8GNj64.js} +53 -53
- package/dist/{BlockIssueBadge-CxHJmuOh.js → BlockIssueBadge-i2cZy5PB.js} +5 -5
- package/dist/{BlockPreviewCanvas-DEmNZkEG.js → BlockPreviewCanvas-BAYIy-QJ.js} +27 -27
- package/dist/{CloudHeaderExtras-Cqhw-jMz.js → CloudHeaderExtras-CJsXi4Ku.js} +2 -2
- package/dist/{CloudPanels-Bmlf05Il.js → CloudPanels-Cb54vtYC.js} +6 -6
- package/dist/{CollaborationNotices-C27GCMvK.js → CollaborationNotices-DkYX-ose.js} +3 -3
- package/dist/{CollaboratorBar-CLQjksX-.js → CollaboratorBar-xDweDvB6.js} +3 -3
- package/dist/CommentsPanel-t3w16YUl.js +23 -0
- package/dist/CommentsSidebar-B3M90RY_.js +516 -0
- package/dist/{CountdownBlock-D8dqjm3F.js → CountdownBlock-BrR2uqM3.js} +4 -4
- package/dist/{CountdownToolbar-IjpCOjCd.js → CountdownToolbar-CTbJPh8B.js} +7 -7
- package/dist/{IssuesPanel-uwuzeMSW.js → IssuesPanel-BUKc8lld.js} +13 -13
- package/dist/{LanguageMenu-C-eQ0lFy.js → LanguageMenu-DruJAMET.js} +16 -16
- package/dist/{LoadingTrack-BG8cg9xi.js → LoadingTrack-c4SeD16s.js} +1 -1
- package/dist/{LocaleNotices-CDK_9D7P.js → LocaleNotices-D6zk-QCL.js} +5 -5
- package/dist/{LogicTagInsertButton-BSolF7Fd.js → LogicTagInsertButton-Ci7V0Exe.js} +65 -65
- package/dist/{MediaEditModal-C8yc9dxt.js → MediaEditModal-BxbwZxnf.js} +4 -4
- package/dist/{MediaPanels-FI4I8asn.js → MediaPanels-BiUxsTMM.js} +2 -2
- package/dist/{MergeTagInput-B1nl2ZMT.js → MergeTagInput-BA89v7KJ.js} +2 -2
- package/dist/{MergeTagModeToggle-DXvb80OE.js → MergeTagModeToggle-De_FNmcG.js} +7 -7
- package/dist/{MergeTagTextarea-DJlf3VbS.js → MergeTagTextarea-BRMB24Dg.js} +9 -9
- package/dist/{ParagraphEditor-Dqco128s.js → ParagraphEditor-DYqh0kEa.js} +51 -51
- package/dist/{RestoreVersionDialog-hqLCuGV5.js → RestoreVersionDialog-CRkyFafq.js} +5 -5
- package/dist/{RichTextEditorContent-xIEF0Y3Z.js → RichTextEditorContent-WeCqqCy3.js} +10 -10
- package/dist/{SaveBlockDialog-CQlCP_XC.js → SaveBlockDialog-D992yyO4.js} +15 -15
- package/dist/{SavedBlocksBrowserModal-BXA32Fx6.js → SavedBlocksBrowserModal-tH74h2Tz.js} +13 -13
- package/dist/{SavedBlocksPanels-BKUzbamj.js → SavedBlocksPanels-BuzEwYfp.js} +2 -2
- package/dist/{SavedBlocksPickBar-BlvF-4UF.js → SavedBlocksPickBar-DbULBPsI.js} +4 -4
- package/dist/{TemplateSettings-CYFtR8zv.js → TemplateSettings-eMBAy_wd.js} +14 -14
- package/dist/{TestEmailModal-BbaL17HO.js → TestEmailModal-hb9iopaZ.js} +13 -13
- package/dist/{TestEmailPanel-DhB1CSpg.js → TestEmailPanel-DbeZjj0u.js} +2 -2
- package/dist/{TitleEditor-3BRl8u5l.js → TitleEditor-CisDioGi.js} +14 -14
- package/dist/{ToggleSwitch-R3wCCYE6.js → ToggleSwitch-BIPdFWUr.js} +1 -1
- package/dist/{Toolbar-pzNIakGM.js → Toolbar-BUVRjylH.js} +218 -218
- package/dist/{TplModal-WNuWhHZm.js → TplModal-BPPP-uM6.js} +6 -6
- package/dist/{VersionHistoryMenu--T-Qp_mH.js → VersionHistoryMenu-Cd2IaHgT.js} +10 -10
- package/dist/{VersionHistoryPanels-BPubvYIE.js → VersionHistoryPanels-BNONrE-8.js} +2 -2
- package/dist/{VersionPreviewBanner-ClL3Wkln.js → VersionPreviewBanner-lkAf7tc8.js} +3 -3
- package/dist/{WrapperBlock-CjfCPceb.js → WrapperBlock-B3UAv5kv.js} +5 -5
- package/dist/{blockTypeIcons-12OMwVyN.js → blockTypeIcons-BPPpqFc2.js} +3 -3
- package/dist/bundle-stats.json +7 -7
- package/dist/cdn/chunks/{AiAltTextPopover-PFjTrl0y.js → AiAltTextPopover-CafZSF50.js} +5 -5
- package/dist/cdn/chunks/{AiAltTextPopover-PFjTrl0y.js.map → AiAltTextPopover-CafZSF50.js.map} +1 -1
- package/dist/cdn/chunks/{AiAltTextReview-BMjzvApH.js → AiAltTextReview-BJcaqyp5.js} +6 -6
- package/dist/cdn/chunks/{AiAltTextReview-BMjzvApH.js.map → AiAltTextReview-BJcaqyp5.js.map} +1 -1
- package/dist/cdn/chunks/{AiChatPanel-C2gpq4kP.js → AiChatPanel-DNCUpV8n.js} +15 -18
- package/dist/cdn/chunks/AiChatPanel-DNCUpV8n.js.map +1 -0
- package/dist/cdn/chunks/AiPanels-IV0VEkBL.js +27 -0
- package/dist/cdn/chunks/AiPanels-IV0VEkBL.js.map +1 -0
- package/dist/cdn/chunks/{AiRewriteMenu-CnkyjPEu.js → AiRewriteMenu-DFUZWA7e.js} +58 -58
- package/dist/cdn/chunks/AiRewriteMenu-DFUZWA7e.js.map +1 -0
- package/dist/cdn/chunks/{BlockIssueBadge-DncZ-HDf.js → BlockIssueBadge-DIlFDDwh.js} +5 -5
- package/dist/cdn/chunks/BlockIssueBadge-DIlFDDwh.js.map +1 -0
- package/dist/cdn/chunks/{BlockPreviewCanvas-CCSEzL46.js → BlockPreviewCanvas-D0VhkzY8.js} +28 -28
- package/dist/cdn/chunks/BlockPreviewCanvas-D0VhkzY8.js.map +1 -0
- package/dist/cdn/chunks/{CloudHeaderExtras-uUJYJFJ6.js → CloudHeaderExtras-CazfMn6A.js} +3 -3
- package/dist/cdn/chunks/{CloudHeaderExtras-uUJYJFJ6.js.map → CloudHeaderExtras-CazfMn6A.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-CRztnw4M.js → CloudPanels-BiU1MD-4.js} +5 -5
- package/dist/cdn/chunks/CloudPanels-BiU1MD-4.js.map +1 -0
- package/dist/cdn/chunks/{CollaborationNotices-IuLYT2x7.js → CollaborationNotices-DGA8XRZJ.js} +4 -4
- package/dist/cdn/chunks/{CollaborationNotices-IuLYT2x7.js.map → CollaborationNotices-DGA8XRZJ.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-C1ZI2xwa.js → CollaboratorBar-BWL1Shc1.js} +4 -4
- package/dist/cdn/chunks/{CollaboratorBar-C1ZI2xwa.js.map → CollaboratorBar-BWL1Shc1.js.map} +1 -1
- package/dist/cdn/chunks/CommentsPanel-4mrl4zMK.js +24 -0
- package/dist/cdn/chunks/CommentsPanel-4mrl4zMK.js.map +1 -0
- package/dist/cdn/chunks/CommentsSidebar-BJ87vc7i.js +486 -0
- package/dist/cdn/chunks/CommentsSidebar-BJ87vc7i.js.map +1 -0
- package/dist/cdn/chunks/{CountdownBlock-8aPSExrv.js → CountdownBlock-Do6oItNW.js} +5 -5
- package/dist/cdn/chunks/{CountdownBlock-8aPSExrv.js.map → CountdownBlock-Do6oItNW.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-CnWQEW5g.js → CountdownToolbar-CH8UK01N.js} +8 -8
- package/dist/cdn/chunks/{CountdownToolbar-CnWQEW5g.js.map → CountdownToolbar-CH8UK01N.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-CrplCzo8.js → IssuesPanel-3NPqHXJx.js} +9 -9
- package/dist/cdn/chunks/IssuesPanel-3NPqHXJx.js.map +1 -0
- package/dist/cdn/chunks/{LanguageMenu-B6MNInCL.js → LanguageMenu-75uu4P2d.js} +105 -105
- package/dist/cdn/chunks/LanguageMenu-75uu4P2d.js.map +1 -0
- package/dist/cdn/chunks/{LoadingTrack-DUYcDHOV.js → LoadingTrack-o-89hApJ.js} +2 -2
- package/dist/cdn/chunks/{LoadingTrack-DUYcDHOV.js.map → LoadingTrack-o-89hApJ.js.map} +1 -1
- package/dist/cdn/chunks/{LocaleNotices-TxeAl8Iq.js → LocaleNotices-CUN5K5QJ.js} +5 -5
- package/dist/cdn/chunks/{LocaleNotices-TxeAl8Iq.js.map → LocaleNotices-CUN5K5QJ.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-DvSVx2DB.js → LogicTagInsertButton-C5L73hYh.js} +12 -12
- package/dist/cdn/chunks/{LogicTagInsertButton-DvSVx2DB.js.map → LogicTagInsertButton-C5L73hYh.js.map} +1 -1
- package/dist/cdn/chunks/{MediaEditModal-tGK6htBl.js → MediaEditModal-BHTMNHx0.js} +4 -4
- package/dist/cdn/chunks/{MediaEditModal-tGK6htBl.js.map → MediaEditModal-BHTMNHx0.js.map} +1 -1
- package/dist/cdn/chunks/{MediaPanels-BVrQYz2C.js → MediaPanels-BlianNRh.js} +3 -3
- package/dist/cdn/chunks/{MediaPanels-BVrQYz2C.js.map → MediaPanels-BlianNRh.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-DeuNH3re.js → MergeTagInput-D8cbnnZu.js} +3 -3
- package/dist/cdn/chunks/{MergeTagInput-DeuNH3re.js.map → MergeTagInput-D8cbnnZu.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-D7maMGIM.js → MergeTagModeToggle-D-RhwBsO.js} +6 -6
- package/dist/cdn/chunks/{MergeTagModeToggle-D7maMGIM.js.map → MergeTagModeToggle-D-RhwBsO.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagTextarea-B2xxIU3e.js → MergeTagTextarea-CAJIi2FE.js} +7 -7
- package/dist/cdn/chunks/{MergeTagTextarea-B2xxIU3e.js.map → MergeTagTextarea-CAJIi2FE.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-Bx_Hlw8d.js → ParagraphEditor-sRPXZDzp.js} +30 -30
- package/dist/cdn/chunks/{ParagraphEditor-Bx_Hlw8d.js.map → ParagraphEditor-sRPXZDzp.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-CPrrWTsT.js → RestoreVersionDialog-CJK-14PX.js} +5 -5
- package/dist/cdn/chunks/RestoreVersionDialog-CJK-14PX.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-Dze4C9VI.js → RichTextEditorContent-DU0wtA_j.js} +9 -9
- package/dist/cdn/chunks/{RichTextEditorContent-Dze4C9VI.js.map → RichTextEditorContent-DU0wtA_j.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-CXVwnfsy.js → SaveBlockDialog-C8hY9xA-.js} +13 -13
- package/dist/cdn/chunks/{SaveBlockDialog-CXVwnfsy.js.map → SaveBlockDialog-C8hY9xA-.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BDTmenOE.js → SavedBlocksBrowserModal-B3nFAgAa.js} +9 -9
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BDTmenOE.js.map → SavedBlocksBrowserModal-B3nFAgAa.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-B41Rk_v1.js → SavedBlocksPanels-CQenugHO.js} +3 -3
- package/dist/cdn/chunks/{SavedBlocksPanels-B41Rk_v1.js.map → SavedBlocksPanels-CQenugHO.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-B97z_rFH.js → SavedBlocksPickBar-DzUP4IYv.js} +5 -5
- package/dist/cdn/chunks/{SavedBlocksPickBar-B97z_rFH.js.map → SavedBlocksPickBar-DzUP4IYv.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-YwwRbxPc.js → TemplateSettings-DnOwyN_1.js} +12 -12
- package/dist/cdn/chunks/{TemplateSettings-YwwRbxPc.js.map → TemplateSettings-DnOwyN_1.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-BiFP2Cbx.js → TestEmailModal-BFqmfOZ1.js} +10 -10
- package/dist/cdn/chunks/{TestEmailModal-BiFP2Cbx.js.map → TestEmailModal-BFqmfOZ1.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-BrivPMk2.js → TestEmailPanel-DFOhhaa9.js} +3 -3
- package/dist/cdn/chunks/{TestEmailPanel-BrivPMk2.js.map → TestEmailPanel-DFOhhaa9.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-CzPkkL2s.js → TitleEditor-ChPXTB9T.js} +13 -13
- package/dist/cdn/chunks/{TitleEditor-CzPkkL2s.js.map → TitleEditor-ChPXTB9T.js.map} +1 -1
- package/dist/cdn/chunks/{ToggleSwitch-BSkySwA1.js → ToggleSwitch-C0w0srN_.js} +2 -2
- package/dist/cdn/chunks/{ToggleSwitch-BSkySwA1.js.map → ToggleSwitch-C0w0srN_.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-VH07SzX7.js → Toolbar-bbO5WoKo.js} +302 -302
- package/dist/cdn/chunks/Toolbar-bbO5WoKo.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-DMe6J811.js → TplModal-Bg97XHIJ.js} +6 -6
- package/dist/cdn/chunks/{TplModal-DMe6J811.js.map → TplModal-Bg97XHIJ.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-DkwbKhBl.js → VersionHistoryMenu-BNPxnWiO.js} +9 -9
- package/dist/cdn/chunks/{VersionHistoryMenu-DkwbKhBl.js.map → VersionHistoryMenu-BNPxnWiO.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-CgxhMRAl.js → VersionHistoryPanels-CyyRXWPU.js} +3 -3
- package/dist/cdn/chunks/{VersionHistoryPanels-CgxhMRAl.js.map → VersionHistoryPanels-CyyRXWPU.js.map} +1 -1
- package/dist/cdn/chunks/{VersionPreviewBanner-WVBDBrwQ.js → VersionPreviewBanner-BldFvgxJ.js} +4 -4
- package/dist/cdn/chunks/{VersionPreviewBanner-WVBDBrwQ.js.map → VersionPreviewBanner-BldFvgxJ.js.map} +1 -1
- package/dist/cdn/chunks/{WrapperBlock-CCCIcqe2.js → WrapperBlock-ZBCf7Y8u.js} +6 -6
- package/dist/cdn/chunks/{WrapperBlock-CCCIcqe2.js.map → WrapperBlock-ZBCf7Y8u.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-CzYA5DF9.js → blockTypeIcons-19xd5ZPi.js} +6 -6
- package/dist/cdn/chunks/{blockTypeIcons-CzYA5DF9.js.map → blockTypeIcons-19xd5ZPi.js.map} +1 -1
- package/dist/cdn/chunks/{composables-D3lsO7Io.js → composables-CMBZad02.js} +750 -730
- package/dist/cdn/chunks/composables-CMBZad02.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-CE79GB1H.js → createCloudRuntime-BHGFjpek.js} +157 -143
- package/dist/cdn/chunks/createCloudRuntime-BHGFjpek.js.map +1 -0
- package/dist/cdn/chunks/da-CYWJkrTg.js +97 -0
- package/dist/cdn/chunks/da-CYWJkrTg.js.map +1 -0
- package/dist/cdn/chunks/da-qQzj0QGy.js +950 -0
- package/dist/cdn/chunks/da-qQzj0QGy.js.map +1 -0
- package/dist/cdn/chunks/{dist-BzXULHvI.js → dist-BtWMy7UQ.js} +3 -3
- package/dist/cdn/chunks/{dist-BzXULHvI.js.map → dist-BtWMy7UQ.js.map} +1 -1
- package/dist/cdn/chunks/{dist-Cf1pSluo.js → dist-zu1jwYIS.js} +4 -4
- package/dist/cdn/chunks/{dist-Cf1pSluo.js.map → dist-zu1jwYIS.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-DepKdldn.js → draggable-IRVFEZ-b.js} +1535 -1500
- package/dist/cdn/chunks/draggable-IRVFEZ-b.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-CN69NlOK.js → editor-modal-CarOiAYJ.js} +77 -76
- package/dist/cdn/chunks/{editor-modal-CN69NlOK.js.map → editor-modal-CarOiAYJ.js.map} +1 -1
- package/dist/cdn/chunks/en-B4s_0ryk.js +1 -0
- package/dist/cdn/chunks/{extensions-8dlM-fU4.js → extensions-Beg0g2wm.js} +7 -7
- package/dist/cdn/chunks/{extensions-8dlM-fU4.js.map → extensions-Beg0g2wm.js.map} +1 -1
- package/dist/cdn/chunks/{icons-DHExFLlT.js → icons-Cl4oR2mf.js} +73 -73
- package/dist/cdn/chunks/icons-Cl4oR2mf.js.map +1 -0
- package/dist/cdn/chunks/keys-BQqbBUag.js +11 -0
- package/dist/cdn/chunks/keys-BQqbBUag.js.map +1 -0
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-aWjkotui.js → normalizeMergeTagMarkup-B8yU4usU.js} +55 -55
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-aWjkotui.js.map → normalizeMergeTagMarkup-B8yU4usU.js.map} +1 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-Dn6dFUwx.js → preRenderCustomBlocks-CPHm2GOQ.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-Dn6dFUwx.js.map → preRenderCustomBlocks-CPHm2GOQ.js.map} +1 -1
- package/dist/cdn/chunks/{sanitizeHtml-B3njfkSy.js → sanitizeHtml-B7LC0gKK.js} +22 -11
- package/dist/cdn/chunks/sanitizeHtml-B7LC0gKK.js.map +1 -0
- package/dist/cdn/chunks/{socialIcons-BFgc3qqJ.js → socialIcons-D9D02_y5.js} +575 -524
- package/dist/cdn/chunks/socialIcons-D9D02_y5.js.map +1 -0
- package/dist/cdn/chunks/{src-C9JWWxAk.js → src-BCrSqaj8.js} +108 -95
- package/dist/cdn/chunks/src-BCrSqaj8.js.map +1 -0
- package/dist/cdn/chunks/{src-GgKlXNxy.js → src-BO4aXl_Y.js} +232 -228
- package/dist/cdn/chunks/src-BO4aXl_Y.js.map +1 -0
- package/dist/cdn/chunks/{src-mXG-Of9A.js → src-DeywvttP.js} +812 -780
- package/dist/cdn/chunks/src-DeywvttP.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-C940SvId.js → tiptap-BPiZqxCt.js} +40 -31
- package/dist/cdn/chunks/tiptap-BPiZqxCt.js.map +1 -0
- package/dist/cdn/chunks/{useCloudI18n-Xsih9yRH.js → useCloudI18n-Dr4S2TRW.js} +3 -3
- package/dist/cdn/chunks/{useCloudI18n-Xsih9yRH.js.map → useCloudI18n-Dr4S2TRW.js.map} +1 -1
- package/dist/cdn/chunks/useEditorRoot-B_kf_k-g.js +9 -0
- package/dist/cdn/chunks/{useEditorRoot-Beau2Z_T.js.map → useEditorRoot-B_kf_k-g.js.map} +1 -1
- package/dist/cdn/chunks/{useI18n-D8s7HtTn.js → useI18n-CSf-ZpcM.js} +3 -3
- package/dist/cdn/chunks/{useI18n-D8s7HtTn.js.map → useI18n-CSf-ZpcM.js.map} +1 -1
- package/dist/cdn/chunks/useLocalizedDisplay-oykFcYrW.js +33 -0
- package/dist/cdn/chunks/{useLocalizedDisplay-Bgg4qpev.js.map → useLocalizedDisplay-oykFcYrW.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-B0PDeDxl.js → useLogicTag-D_qg9qqO.js} +4 -4
- package/dist/cdn/chunks/{useLogicTag-B0PDeDxl.js.map → useLogicTag-D_qg9qqO.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-BSU75bKk.js → useMergeTag-VLnVHtxV.js} +4 -4
- package/dist/cdn/chunks/{useMergeTag-BSU75bKk.js.map → useMergeTag-VLnVHtxV.js.map} +1 -1
- package/dist/cdn/chunks/{usePopoverPosition-esO6wjvU.js → usePopoverPosition-BJFFi8x6.js} +3 -3
- package/dist/cdn/chunks/{usePopoverPosition-esO6wjvU.js.map → usePopoverPosition-BJFFi8x6.js.map} +1 -1
- package/dist/cdn/chunks/{useScrollToBlock-CJuUu7Xj.js → useScrollToBlock-MI4PP5lk.js} +3 -3
- package/dist/cdn/chunks/{useScrollToBlock-CJuUu7Xj.js.map → useScrollToBlock-MI4PP5lk.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-QqBilClC.js → withCurrentFont-m6TtR0dC.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-QqBilClC.js.map → withCurrentFont-m6TtR0dC.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +685 -663
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-CcuCoJDh.js → check-C7ua4TAK.js} +1 -1
- package/dist/{chevron-down-BfYIbFbC.js → chevron-down-DftQrAkI.js} +1 -1
- package/dist/{chevron-right-DyjFqY35.js → chevron-right-B-DULGbg.js} +1 -1
- package/dist/{chevron-up-BHEIxuS-.js → chevron-up-CeYsyD8c.js} +1 -1
- package/dist/{circle-alert-Tq7kAh9S.js → circle-exclamation-point-DHjORV_I.js} +3 -3
- package/dist/{clock-Df0ZiXwQ.js → clock-CajOtLEZ.js} +1 -1
- package/dist/{composables-DreAt_0A.js → composables-Cq7rsxRc.js} +1123 -1103
- package/dist/{createCloudRuntime-CL4tUlDC.js → createCloudRuntime-CHsFF8DI.js} +42 -28
- package/dist/{createLucideIcon-CfBdtoUw.js → createLucideIcon-D-mELTSY.js} +6 -6
- package/dist/da-CYWJkrTg.js +95 -0
- package/dist/da-qQzj0QGy.js +948 -0
- package/dist/{dist-CX7skkvG.js → dist-A328tG0Z.js} +2 -2
- package/dist/{dist-BjzK1g4Z.js → dist-B15BvV94.js} +2 -2
- package/dist/{dist-DDytHU_6.js → dist-B3G4Yvpd.js} +3 -3
- package/dist/{dist-CiYotUR8.js → dist-B6ptxfPo.js} +3 -3
- package/dist/{dist-0GWMyHtM.js → dist-BmV-2uBJ.js} +2 -2
- package/dist/{dist-CCLRTtJP.js → dist-BxKFi2h_.js} +5 -5
- package/dist/{dist-BMUUt3zJ.js → dist-C0hVefGI.js} +791 -759
- package/dist/{dist-CsknfjrZ.js → dist-CMBOqk9I.js} +7 -7
- package/dist/{dist-ZrT0vAB6.js → dist-CXTsTO5h.js} +2 -2
- package/dist/{dist-Dq9VnANT.js → dist-D5BUcCjv.js} +2 -2
- package/dist/dist-D9cbSSSx.js +4 -0
- package/dist/{dist-BsumKKh9.js → dist-DAdrn64r.js} +2 -2
- package/dist/{dist-C3avsUq9.js → dist-DENg3ORe.js} +31 -22
- package/dist/{dist-Cr1CLCmx.js → dist-DI_8rB1X.js} +2 -2
- package/dist/dist-ELLEk-lS.js +4 -0
- package/dist/{editor-modal-BD32TXws.js → editor-modal-CgsaLpwB.js} +20 -19
- package/dist/en-DBLcB-CW.js +1 -0
- package/dist/{extensions-DKxHlSd7.js → extensions-BSXjPQEc.js} +21 -21
- package/dist/{eye-B3psrAqd.js → eye-fe5sKF_K.js} +1 -1
- package/dist/{image-C3yuPDxx.js → image-CUC7SZiW.js} +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/{info-DKja7A68.js → info-DDbLU4pT.js} +1 -1
- package/dist/keys-D9oKZN1h.js +9 -0
- package/dist/{link-DhzPI4Hn.js → link-C2icj0iH.js} +1 -1
- package/dist/{list-DVGn7Ik2.js → list-KYC_Jb5A.js} +1 -1
- package/dist/{loader-circle-DqKWsMHO.js → loader-circle-DmyagWpc.js} +1 -1
- package/dist/{message-circle-C4TonoBs.js → message-circle-ijyWn6UJ.js} +1 -1
- package/dist/{normalizeMergeTagMarkup-Da9JAgx7.js → normalizeMergeTagMarkup-CBLCQe02.js} +82 -82
- package/dist/{package-9OkiEO4S.js → package-CKYm_jQY.js} +1 -1
- package/dist/{pencil-M9vkOB7C.js → pencil-C2TRSR-Y.js} +1 -1
- package/dist/{plus-DxZiv9YC.js → plus-CotJVDxb.js} +1 -1
- package/dist/{preRenderCustomBlocks-CdqSp2P7.js → preRenderCustomBlocks-e2OlY4aU.js} +3 -3
- package/dist/{refresh-cw-UY8_sdFG.js → refresh-cw-CuCRV6D5.js} +1 -1
- package/dist/{rotate-ccw-BFTGCpHn.js → rotate-ccw-BlnQ3y6R.js} +1 -1
- package/dist/{runtime-dom.esm-bundler-DlHp8xgy.js → runtime-dom.esm-bundler-nN-jsqr1.js} +20 -20
- package/dist/{sanitizeHtml-wBibnBF4.js → sanitizeHtml-Dfn-fH17.js} +25 -14
- package/dist/{search-RuGJnMEn.js → search-Dxw6oFrZ.js} +1 -1
- package/dist/{send-DGB1ar02.js → send-C-blQBZ9.js} +1 -1
- package/dist/{smartphone-CVA29CU_.js → smartphone-rLz4X-Dd.js} +1 -1
- package/dist/{socialIcons-oo4uL16Y.js → socialIcons-BZRLo0eT.js} +600 -549
- package/dist/{sparkles-IHfEwEcd.js → sparkles-JWQlUiSn.js} +1 -1
- package/dist/{square-_Cl44UU6.js → square-DshDy1Il.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +748 -726
- package/dist/{text-align-start-Dqk2Xt_Q.js → text-align-start-CyasaQtr.js} +13 -13
- package/dist/{trash-Cr7rD5Hh.js → trash-B1lZp2Tv.js} +1 -1
- package/dist/{triangle-alert-CKcpwtUj.js → triangle-exclamation-point-BhJvBEoT.js} +3 -3
- package/dist/{upload-DR9pqVON.js → upload-CNK8JX38.js} +1 -1
- package/dist/{useCloudI18n-BczJoFf4.js → useCloudI18n-HhCZYRV6.js} +2 -2
- package/dist/useEditorRoot-B0Njczhx.js +7 -0
- package/dist/{useI18n-zeWYtWSv.js → useI18n-CM9vKbYc.js} +2 -2
- package/dist/{cdn/chunks/useLocalizedDisplay-Bgg4qpev.js → useLocalizedDisplay-B7tlQF4g.js} +2 -4
- package/dist/{useLogicTag-B4Zpk3eo.js → useLogicTag-k_y-4o4W.js} +3 -3
- package/dist/{useMergeTag-B5qlq8px.js → useMergeTag-BiZ6XOdL.js} +3 -3
- package/dist/{usePopoverPosition-Br3zt_MQ.js → usePopoverPosition-CVRzzLkC.js} +2 -2
- package/dist/{useScrollToBlock-BfOzc1Z6.js → useScrollToBlock-vf_KD0FM.js} +3 -3
- package/dist/{vue.runtime.esm-bundler-BJXc_Mri.js → vue.runtime.esm-bundler-BE5V8ADU.js} +414 -362
- package/dist/{withCurrentFont-m_PHcOD0.js → withCurrentFont-CPhRujet.js} +1 -1
- package/dist/{x-DZSFHafL.js → x-DbLX5Qdm.js} +1 -1
- package/package.json +23 -23
- package/dist/AiPanels-CwKmXzyr.js +0 -31
- package/dist/CommentsPanel-B5NqPMmY.js +0 -16
- package/dist/CommentsSidebar-BDrcrDxS.js +0 -526
- package/dist/cdn/chunks/AiChatPanel-C2gpq4kP.js.map +0 -1
- package/dist/cdn/chunks/AiPanels-Cx3PE2mE.js +0 -32
- package/dist/cdn/chunks/AiPanels-Cx3PE2mE.js.map +0 -1
- package/dist/cdn/chunks/AiRewriteMenu-CnkyjPEu.js.map +0 -1
- package/dist/cdn/chunks/BlockIssueBadge-DncZ-HDf.js.map +0 -1
- package/dist/cdn/chunks/BlockPreviewCanvas-CCSEzL46.js.map +0 -1
- package/dist/cdn/chunks/CloudPanels-CRztnw4M.js.map +0 -1
- package/dist/cdn/chunks/CommentsPanel-lgjJNrrY.js +0 -18
- package/dist/cdn/chunks/CommentsPanel-lgjJNrrY.js.map +0 -1
- package/dist/cdn/chunks/CommentsSidebar-DTold7iy.js +0 -496
- package/dist/cdn/chunks/CommentsSidebar-DTold7iy.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-CrplCzo8.js.map +0 -1
- package/dist/cdn/chunks/LanguageMenu-B6MNInCL.js.map +0 -1
- package/dist/cdn/chunks/RestoreVersionDialog-CPrrWTsT.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-VH07SzX7.js.map +0 -1
- package/dist/cdn/chunks/composables-D3lsO7Io.js.map +0 -1
- package/dist/cdn/chunks/createCloudRuntime-CE79GB1H.js.map +0 -1
- package/dist/cdn/chunks/draggable-DepKdldn.js.map +0 -1
- package/dist/cdn/chunks/en-Bcz4gS9U.js +0 -1
- package/dist/cdn/chunks/icons-DHExFLlT.js.map +0 -1
- package/dist/cdn/chunks/keys-BUmIvYy3.js +0 -11
- package/dist/cdn/chunks/keys-BUmIvYy3.js.map +0 -1
- package/dist/cdn/chunks/sanitizeHtml-B3njfkSy.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-BFgc3qqJ.js.map +0 -1
- package/dist/cdn/chunks/src-C9JWWxAk.js.map +0 -1
- package/dist/cdn/chunks/src-GgKlXNxy.js.map +0 -1
- package/dist/cdn/chunks/src-mXG-Of9A.js.map +0 -1
- package/dist/cdn/chunks/tiptap-C940SvId.js.map +0 -1
- package/dist/cdn/chunks/useEditorRoot-Beau2Z_T.js +0 -9
- package/dist/dist-B_0FPmoy.js +0 -4
- package/dist/dist-DKV9m4Uu.js +0 -4
- package/dist/en-Dgs_-NBw.js +0 -1
- package/dist/keys-w_VRjoMu.js +0 -9
- package/dist/useEditorRoot-BcXKhM_8.js +0 -7
- package/dist/useLocalizedDisplay-Cbhx208c.js +0 -31
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as e, C as t, F as n, H as r, M as i, O as a, Q as o, X as s, Y as c, _ as l, at as u, b as d, ct as f, dt as p, et as m, lt as h, mt as g, ot as _, p as v, pt as y, q as b, rt as x, tt as S, u as C, x as w } from "./draggable-
|
|
2
|
-
import { $t as T,
|
|
3
|
-
import { at as
|
|
4
|
-
import { B as
|
|
5
|
-
import { t as
|
|
6
|
-
import { r as
|
|
7
|
-
import { i as
|
|
1
|
+
import { $ as e, C as t, F as n, H as r, M as i, O as a, Q as o, X as s, Y as c, _ as l, at as u, b as d, ct as f, dt as p, et as m, lt as h, mt as g, ot as _, p as v, pt as y, q as b, rt as x, tt as S, u as C, x as w } from "./draggable-IRVFEZ-b.js";
|
|
2
|
+
import { $t as T, Bt as E, Cn as D, Ft as O, Gt as k, H as ee, Ht as A, I as j, It as te, Kt as M, Lt as N, Nt as ne, Pt as P, Qt as F, Rt as re, Ut as I, W as L, Wt as ie, Xt as R, Yt as ae, Zt as oe, an as se, dn as z, en as B, ft as V, h as ce, in as H, jt as le, m as U, nn as W, p as ue, rn as G, tn as de, v as fe, wt as pe, y as me, zt as he } from "./src-DeywvttP.js";
|
|
3
|
+
import { at as K, s as ge } from "./icons-Cl4oR2mf.js";
|
|
4
|
+
import { B as _e, C as ve, W as ye, u as be } from "./keys-BQqbBUag.js";
|
|
5
|
+
import { t as xe } from "./useI18n-CSf-ZpcM.js";
|
|
6
|
+
import { r as Se } from "./dist-zu1jwYIS.js";
|
|
7
|
+
import { i as q, r as Ce } from "./usePopoverPosition-BJFFi8x6.js";
|
|
8
8
|
// ../core/src/localized-edit.ts
|
|
9
|
-
var J = (e) => typeof e == "object" && !!e && !Array.isArray(e),
|
|
9
|
+
var J = (e) => typeof e == "object" && !!e && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => J(e) && typeof e.id == "string"), we = /* @__PURE__ */ new Set([
|
|
10
10
|
"id",
|
|
11
11
|
"type",
|
|
12
12
|
"children",
|
|
@@ -18,37 +18,37 @@ function Te(e, t, n) {
|
|
|
18
18
|
let r = /* @__PURE__ */ new Set();
|
|
19
19
|
for (let i of n) {
|
|
20
20
|
if (!ie(i)) continue;
|
|
21
|
-
let n = i.split("."), a = n.pop(), o = n.join("."), s =
|
|
21
|
+
let n = i.split("."), a = n.pop(), o = n.join("."), s = F(e, i), c = t;
|
|
22
22
|
for (let [t, i] of n.entries()) {
|
|
23
23
|
let a = n.slice(0, t + 1).join(".");
|
|
24
|
-
s !== void 0 && J(c) &&
|
|
24
|
+
s !== void 0 && J(c) && F(c, i) === void 0 && J(F(e, a)) && (c[i] = {}, r.add(a)), c = F(c, i);
|
|
25
25
|
}
|
|
26
26
|
if (Array.isArray(c)) {
|
|
27
27
|
let e = c.findIndex((e) => J(e) && e.id === a);
|
|
28
28
|
if (e < 0) continue;
|
|
29
|
-
s === void 0 ? c.splice(e, 1) : c[e] =
|
|
30
|
-
} else J(c) && (s === void 0 ? delete c[a] : c[a] =
|
|
29
|
+
s === void 0 ? c.splice(e, 1) : c[e] = H(s);
|
|
30
|
+
} else J(c) && (s === void 0 ? delete c[a] : c[a] = H(s), o && Object.keys(c).length === 0 && F(e, o) === void 0 && Te(e, t, [o]));
|
|
31
31
|
}
|
|
32
32
|
return r;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (J(e) && J(t) && !a.has(n)) for (let o of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])) (n || !we.has(o)) &&
|
|
36
|
-
else if (i &&
|
|
34
|
+
function X(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
|
|
35
|
+
if (J(e) && J(t) && !a.has(n)) for (let o of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])) (n || !we.has(o)) && X(e[o], t[o], n ? `${n}.${o}` : o, r, i, a);
|
|
36
|
+
else if (i && Y(e) && Y(t)) for (let o of t) {
|
|
37
37
|
if (o.id.includes(".")) continue;
|
|
38
38
|
let t = e.find((e) => e.id === o.id);
|
|
39
|
-
t &&
|
|
39
|
+
t && X(t, o, `${n}.${o.id}`, r, i, a);
|
|
40
40
|
}
|
|
41
|
-
else
|
|
41
|
+
else G(e, t) || r.set(n, t);
|
|
42
42
|
}
|
|
43
43
|
function Ee(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
|
|
44
44
|
let a = /* @__PURE__ */ new Map();
|
|
45
|
-
|
|
46
|
-
let o = new Set(e.type === "custom" ?
|
|
47
|
-
for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) :
|
|
45
|
+
X(e, t, "", a, e.type !== "custom", i);
|
|
46
|
+
let o = new Set(e.type === "custom" ? de(e, r) : []), s = {}, c = {};
|
|
47
|
+
for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : M(e.type, t)) && typeof r == "string" && F(e, t) !== void 0) {
|
|
48
48
|
let i = n?.text?.[t];
|
|
49
49
|
s[t] = i && i.value === r ? i : {
|
|
50
50
|
value: r,
|
|
51
|
-
sourceHash:
|
|
51
|
+
sourceHash: B(String(F(e, t) ?? ""))
|
|
52
52
|
};
|
|
53
53
|
} else c[t] = r === void 0 ? null : r;
|
|
54
54
|
let l = {};
|
|
@@ -58,7 +58,7 @@ function De(e, t, n) {
|
|
|
58
58
|
let r = !1;
|
|
59
59
|
function i(e, t, n, a) {
|
|
60
60
|
let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) => J(e) && typeof e.id == "string");
|
|
61
|
-
if (c(o) && c(s) && (JSON.stringify(o.map((e) => e.id)) !== JSON.stringify(s.map((e) => e.id)) && (r = !0, e[n] = s.map((e) =>
|
|
61
|
+
if (c(o) && c(s) && (JSON.stringify(o.map((e) => e.id)) !== JSON.stringify(s.map((e) => e.id)) && (r = !0, e[n] = s.map((e) => H(o.find((t) => t.id === e.id) ?? e))), a)) for (let t of s) {
|
|
62
62
|
let r = e[n].find((e) => e.id === t.id);
|
|
63
63
|
r && i(r, t, a);
|
|
64
64
|
}
|
|
@@ -66,7 +66,7 @@ function De(e, t, n) {
|
|
|
66
66
|
let a = e, o = t;
|
|
67
67
|
if (e.type === "menu" && i(a, o, "items"), e.type === "table" && i(a, o, "rows", "cells"), e.type === "social" && i(a, o, "icons"), e.type === "section" && t.type === "section") {
|
|
68
68
|
let i = (e) => e.map((e) => e.map((e) => e.id));
|
|
69
|
-
(e.columns !== t.columns || JSON.stringify(i(e.children)) !== JSON.stringify(i(t.children))) && (r = !0, e.columns = t.columns, e.children = t.children.map((e) => e.map((e) =>
|
|
69
|
+
(e.columns !== t.columns || JSON.stringify(i(e.children)) !== JSON.stringify(i(t.children))) && (r = !0, e.columns = t.columns, e.children = t.children.map((e) => e.map((e) => H(n(e.id) ?? e))));
|
|
70
70
|
}
|
|
71
71
|
return r;
|
|
72
72
|
}
|
|
@@ -75,39 +75,39 @@ function Oe(e, t, n) {
|
|
|
75
75
|
let { locale: t, locales: n, l10n: r, ...i } = e;
|
|
76
76
|
return i;
|
|
77
77
|
}, i = /* @__PURE__ */ new Map();
|
|
78
|
-
|
|
78
|
+
X(r(e), r(t), "", i);
|
|
79
79
|
let a = {};
|
|
80
|
-
for (let [t, r] of i) if (
|
|
80
|
+
for (let [t, r] of i) if (E.includes(t) && typeof r == "string" && F(e, t) !== void 0) {
|
|
81
81
|
let i = n?.text?.[t];
|
|
82
82
|
(a.text ??= {})[t] = i?.value === r ? i : {
|
|
83
83
|
value: r,
|
|
84
|
-
sourceHash:
|
|
84
|
+
sourceHash: B(String(F(e, t) ?? ""))
|
|
85
85
|
};
|
|
86
86
|
} else (a.set ??= {})[t] = r === void 0 ? null : r;
|
|
87
87
|
return a;
|
|
88
88
|
}
|
|
89
89
|
function ke(e, t, n, r, i, a = []) {
|
|
90
|
-
let o =
|
|
90
|
+
let o = H(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
|
|
91
91
|
...Object.keys(t.text ?? {}),
|
|
92
92
|
...Object.keys(t.set ?? {}),
|
|
93
93
|
...Object.keys(n.text ?? {}),
|
|
94
94
|
...Object.keys(n.set ?? {})
|
|
95
|
-
])].filter((e) => !
|
|
95
|
+
])].filter((e) => !G(t.text?.[e], n.text?.[e]) || !G(t.set?.[e], n.set?.[e]))])], c = Object.keys(e?.set ?? {}).filter((e) => s.some((t) => t.startsWith(`${e}.`)));
|
|
96
96
|
for (let e of c) {
|
|
97
|
-
let t =
|
|
98
|
-
if (
|
|
99
|
-
else if (n.length && J(
|
|
97
|
+
let t = F(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && G(F(r, t), F(i, t)));
|
|
98
|
+
if (G(t, F(r, e))) delete o.set[e];
|
|
99
|
+
else if (n.length && J(F(r, e)) && J(t)) {
|
|
100
100
|
delete o.set[e];
|
|
101
101
|
let i = (e, t, a) => {
|
|
102
102
|
if (!n.some((t) => e === t || e.startsWith(`${t}.`))) {
|
|
103
103
|
if (J(t) && J(a)) for (let n of /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(a)])) i(`${e}.${n}`, t[n], a[n]);
|
|
104
|
-
else if (J(r) && r.type !== "custom" &&
|
|
105
|
-
else J(r) && typeof r.type == "string" &&
|
|
104
|
+
else if (J(r) && r.type !== "custom" && Y(t) && Y(a)) for (let n of a) i(`${e}.${n.id}`, t.find((e) => e.id === n.id), n);
|
|
105
|
+
else J(r) && typeof r.type == "string" && k(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : H(a));
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
i(e,
|
|
109
|
-
} else o.set[e] = t === void 0 ? null :
|
|
110
|
-
for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) n.startsWith(`${e}.`) && (
|
|
108
|
+
i(e, F(r, e), t);
|
|
109
|
+
} else o.set[e] = t === void 0 ? null : H(t);
|
|
110
|
+
for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) n.startsWith(`${e}.`) && (G(t === "text" ? o.text[n].value : o.set[n] ?? void 0, F(i, n)) || delete o[t][n]);
|
|
111
111
|
}
|
|
112
112
|
for (let e of s) if (!c.includes(e)) {
|
|
113
113
|
for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) (n === e || n.startsWith(`${e}.`)) && delete o[t][n];
|
|
@@ -129,13 +129,13 @@ function je(e, t, n) {
|
|
|
129
129
|
let r = t === "addBlock", i = t === "duplicateBlock", a = typeof n[0] == "string" ? n[0] : n[0].id, o = r ? n[0] : e.findBlock?.(a);
|
|
130
130
|
if (!r && e.findBlock && !o) return !1;
|
|
131
131
|
let s = r ? null : e.findBlockLocation?.(a);
|
|
132
|
-
if (!r && e.findBlockLocation && !s || !r && e.isBlockLocked(a, !0) || s?.targetSectionId && e.isBlockLocked(s.targetSectionId, !0)) return !1;
|
|
132
|
+
if (!r && e.findBlockLocation && !s || !r && e.isBlockLocked(a, !0) || !r && o && N(o).some((t) => t !== a && e.isBlockLocked(t, !0)) || s?.targetSectionId && e.isBlockLocked(s.targetSectionId, !0)) return !1;
|
|
133
133
|
if (r && e.content) {
|
|
134
134
|
let t = {
|
|
135
135
|
...e.content(),
|
|
136
136
|
blocks: [o]
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
U(t), ce(t);
|
|
139
139
|
}
|
|
140
140
|
if (t === "removeBlock") return !0;
|
|
141
141
|
let c = i && n[1] === void 0 && n[2] === void 0, l = c ? s?.targetSectionId : n[t === "moveBlock" ? 2 : 1], u = (c ? s?.columnIndex : n[t === "moveBlock" ? 3 : 2]) ?? 0;
|
|
@@ -143,22 +143,22 @@ function je(e, t, n) {
|
|
|
143
143
|
if (e.isBlockLocked(l, !0) || o?.type === "section") return !1;
|
|
144
144
|
if (e.findBlock) {
|
|
145
145
|
let t = e.findBlock(l);
|
|
146
|
-
if (t?.type !== "section" || u < 0 || u >=
|
|
146
|
+
if (t?.type !== "section" || u < 0 || u >= he(t.columns)) return !1;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
return t !== "moveBlock" || s?.targetSectionId !== l || (s?.columnIndex ?? 0) !== u || s?.index !== n[1];
|
|
150
150
|
}
|
|
151
|
-
var
|
|
152
|
-
function Me(e, t) {
|
|
153
|
-
X.set(e, t);
|
|
154
|
-
for (let n of Object.values(e)) typeof n == "function" && X.set(n, t);
|
|
155
|
-
}
|
|
151
|
+
var Me = /* @__PURE__ */ new WeakMap();
|
|
156
152
|
function Ne(e, t) {
|
|
157
|
-
|
|
158
|
-
n &&
|
|
153
|
+
Me.set(e, t);
|
|
154
|
+
for (let n of Object.values(e)) typeof n == "function" && Me.set(n, t);
|
|
155
|
+
}
|
|
156
|
+
function Z(e, t) {
|
|
157
|
+
let n = Me.get(e);
|
|
158
|
+
n && Me.set(t, n);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
let r = Reflect.get(e, t), i =
|
|
160
|
+
function Q(e, t, n) {
|
|
161
|
+
let r = Reflect.get(e, t), i = Me.get(e) ?? (typeof r == "function" ? Me.get(r) : void 0);
|
|
162
162
|
if (i) return i(t, n);
|
|
163
163
|
if (!Ae(t)) return !0;
|
|
164
164
|
let a = Reflect.get(e, "isBlockLocked");
|
|
@@ -179,7 +179,7 @@ function Z(e, t, n) {
|
|
|
179
179
|
function Pe(e) {
|
|
180
180
|
return e instanceof Error ? e : Error(String(e), { cause: e });
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Fe(e, t) {
|
|
183
183
|
try {
|
|
184
184
|
t();
|
|
185
185
|
} catch (t) {
|
|
@@ -187,9 +187,9 @@ function Q(e, t) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
// ../core/src/editor.ts
|
|
190
|
-
function
|
|
191
|
-
let n = t.content ??
|
|
192
|
-
|
|
190
|
+
function Ie(t) {
|
|
191
|
+
let n = t.content ?? V(t.defaultFontFamily, t.templateDefaults);
|
|
192
|
+
U(n), ce(n);
|
|
193
193
|
let r = e({
|
|
194
194
|
template: null,
|
|
195
195
|
content: n,
|
|
@@ -204,11 +204,11 @@ function Fe(t) {
|
|
|
204
204
|
uiTheme: "auto"
|
|
205
205
|
}), i = u(r, "activeLocale"), a = [];
|
|
206
206
|
function o(e) {
|
|
207
|
-
let t =
|
|
207
|
+
let t = A(r.content);
|
|
208
208
|
if (e === t && (e = null), e !== null && !r.content.settings.locales?.includes(e)) throw new W(`This template has no "${e}" version.`, void 0, "unknown_locale");
|
|
209
209
|
i.value = e;
|
|
210
210
|
}
|
|
211
|
-
h(() => i.value ??
|
|
211
|
+
h(() => i.value ?? A(r.content), (e) => Fe(t.onError, () => t.onLocaleChange?.(e))), h(() => r.content.settings.locales?.includes(i.value ?? ""), () => {
|
|
212
212
|
i.value && !r.content.settings.locales?.includes(i.value) && o(null);
|
|
213
213
|
});
|
|
214
214
|
function s() {
|
|
@@ -218,16 +218,16 @@ function Fe(t) {
|
|
|
218
218
|
a = e;
|
|
219
219
|
}
|
|
220
220
|
function l(e) {
|
|
221
|
-
return
|
|
221
|
+
return re(r.content, e, a);
|
|
222
222
|
}
|
|
223
223
|
function d(e, n) {
|
|
224
224
|
if (!s()) return null;
|
|
225
|
-
if (e === "addLocale" && (!
|
|
226
|
-
let i =
|
|
225
|
+
if (e === "addLocale" && (!I(n) || t.localization && !t.localization.locales.includes(n))) throw new W(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
|
|
226
|
+
let i = H(r.content);
|
|
227
227
|
return te(i, [{
|
|
228
228
|
op: e,
|
|
229
229
|
locale: n
|
|
230
|
-
}]),
|
|
230
|
+
}]), G(i, r.content) ? null : i;
|
|
231
231
|
}
|
|
232
232
|
function f(e, t) {
|
|
233
233
|
let n = d(e, t);
|
|
@@ -248,17 +248,17 @@ function Fe(t) {
|
|
|
248
248
|
}
|
|
249
249
|
function v(e, t) {
|
|
250
250
|
let [n, o] = t;
|
|
251
|
-
if (!i.value || !s() ||
|
|
252
|
-
let c =
|
|
251
|
+
if (!i.value || !s() || P(n)) return null;
|
|
252
|
+
let c = M(r.content.blocks, n);
|
|
253
253
|
if (!c) return null;
|
|
254
|
-
let l = c.l10n?.[i.value], u =
|
|
254
|
+
let l = c.l10n?.[i.value], u = ae(c, i.value, A(r.content)), d = Ee(c, u, l, a), f = e === "resetLocaleFields" && Array.isArray(o) ? Te(c, u, o) : void 0, p = e === "resetLocaleFields" ? ke(l, d, Ee(c, u, l, a, f), c, u, Array.isArray(o) ? o : []) : H(l ?? {});
|
|
255
255
|
if (e === "setBlockHidden") o ? p.hidden = !0 : delete p.hidden;
|
|
256
256
|
else if (e === "resetLocaleFields") o || (delete p.text, delete p.set, delete p.hidden);
|
|
257
257
|
else for (let e of o) {
|
|
258
258
|
let t = p.text?.[e];
|
|
259
|
-
t && (t.sourceHash =
|
|
259
|
+
t && (t.sourceHash = B(String(F(c, e) ?? "")));
|
|
260
260
|
}
|
|
261
|
-
return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set,
|
|
261
|
+
return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set, G(l ?? {}, p) ? null : {
|
|
262
262
|
block: c,
|
|
263
263
|
layer: p
|
|
264
264
|
};
|
|
@@ -280,31 +280,28 @@ function Fe(t) {
|
|
|
280
280
|
function k() {
|
|
281
281
|
r.isDirty = !0, O++;
|
|
282
282
|
}
|
|
283
|
-
let
|
|
283
|
+
let ee = b({
|
|
284
284
|
get: () => r.content,
|
|
285
285
|
set: (e) => {
|
|
286
286
|
r.content = e, k();
|
|
287
287
|
}
|
|
288
|
-
}),
|
|
289
|
-
function
|
|
288
|
+
}), j = b(() => r.selectedBlockId ? M(r.content.blocks, r.selectedBlockId) : null);
|
|
289
|
+
function M(e, t) {
|
|
290
290
|
for (let n of e) {
|
|
291
291
|
if (n.id === t) return n;
|
|
292
292
|
if (n.type === "section") for (let e of n.children) {
|
|
293
|
-
let n =
|
|
293
|
+
let n = M(e, t);
|
|
294
294
|
if (n) return n;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
return null;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) ie(e, t);
|
|
301
|
-
}
|
|
302
|
-
function F(e, t, n = { blocks: e }) {
|
|
299
|
+
function ne(e, t, n = { blocks: e }) {
|
|
303
300
|
for (let r = 0; r < e.length; r++) {
|
|
304
301
|
let i = e[r];
|
|
305
302
|
if (i.id === t) return n;
|
|
306
303
|
if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
|
|
307
|
-
let n =
|
|
304
|
+
let n = ne(i.children[e], t, {
|
|
308
305
|
blocks: i.children[e],
|
|
309
306
|
sectionId: i.id,
|
|
310
307
|
columnIndex: e
|
|
@@ -314,7 +311,7 @@ function Fe(t) {
|
|
|
314
311
|
}
|
|
315
312
|
return null;
|
|
316
313
|
}
|
|
317
|
-
function
|
|
314
|
+
function P(e, n = !1) {
|
|
318
315
|
let r = i.value ?? t.lockLocale?.value ?? null;
|
|
319
316
|
for (let [i, a] of t.lockedBlocks?.value ?? []) {
|
|
320
317
|
let o = a;
|
|
@@ -324,8 +321,8 @@ function Fe(t) {
|
|
|
324
321
|
}
|
|
325
322
|
return !1;
|
|
326
323
|
}
|
|
327
|
-
function
|
|
328
|
-
let t =
|
|
324
|
+
function L(e) {
|
|
325
|
+
let t = ne(r.content.blocks, e);
|
|
329
326
|
if (!t) return null;
|
|
330
327
|
let n = t.blocks.findIndex((t) => t.id === e);
|
|
331
328
|
return n === -1 ? null : {
|
|
@@ -334,52 +331,63 @@ function Fe(t) {
|
|
|
334
331
|
index: n
|
|
335
332
|
};
|
|
336
333
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
334
|
+
function ie(e, t = !0) {
|
|
335
|
+
U(e), ce(e), r.content = e, t && k();
|
|
339
336
|
}
|
|
340
|
-
function
|
|
341
|
-
e &&
|
|
337
|
+
function se(e) {
|
|
338
|
+
e && P(e) || (r.selectedBlockId = e);
|
|
342
339
|
}
|
|
343
|
-
function
|
|
340
|
+
function z(e) {
|
|
344
341
|
r.viewport = e;
|
|
345
342
|
}
|
|
346
|
-
function
|
|
343
|
+
function le(e) {
|
|
347
344
|
r.darkMode = e;
|
|
348
345
|
}
|
|
349
|
-
function
|
|
346
|
+
function ue(e) {
|
|
350
347
|
r.uiTheme = e;
|
|
351
348
|
}
|
|
352
|
-
function
|
|
349
|
+
function de(e) {
|
|
353
350
|
r.previewMode = e, e && (r.selectedBlockId = null);
|
|
354
351
|
}
|
|
355
352
|
function fe(e, t) {
|
|
356
353
|
if (!s()) return !1;
|
|
357
|
-
let n =
|
|
354
|
+
let n = M(r.content.blocks, e);
|
|
358
355
|
if (!n) return !1;
|
|
359
356
|
if ("l10n" in t) throw new W("l10n is immutable in updateBlock.", void 0, "invalid_operation");
|
|
360
|
-
let
|
|
357
|
+
let a = {
|
|
361
358
|
...n,
|
|
362
359
|
...t
|
|
363
|
-
};
|
|
364
|
-
|
|
360
|
+
}, o = H(n), c = De(o, a, (e) => M(r.content.blocks, e)), l = "children" in t, u = c || l || a.type !== n.type;
|
|
361
|
+
if (l && a.type === "section" && Array.isArray(a.children)) {
|
|
362
|
+
let e = new Set(N(n).slice(1)), t = /* @__PURE__ */ new Set();
|
|
363
|
+
for (let n of a.children) for (let i of n) for (let n of N(i)) {
|
|
364
|
+
if (t.has(n) || P(n, !0) || M(r.content.blocks, n) !== null && !e.has(n)) return !1;
|
|
365
|
+
t.add(n);
|
|
366
|
+
}
|
|
367
|
+
if (i.value) {
|
|
368
|
+
let e = N(o);
|
|
369
|
+
if (new Set(e).size !== e.length) return !1;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return !P(e, u || "columns" in t) && (!u || !N(n).some((t) => t !== e && P(t, !0)));
|
|
365
373
|
}
|
|
366
374
|
function pe(e, n) {
|
|
367
375
|
if (!fe(e, n)) return;
|
|
368
|
-
let o =
|
|
376
|
+
let o = M(r.content.blocks, e);
|
|
369
377
|
if (!o) return;
|
|
370
378
|
let s = i.value;
|
|
371
379
|
if (s) {
|
|
372
|
-
let i =
|
|
380
|
+
let i = ae(o, s, A(r.content)), c = {
|
|
373
381
|
...i,
|
|
374
382
|
...n
|
|
375
|
-
}, l =
|
|
376
|
-
if (
|
|
383
|
+
}, l = H(o), u = De(l, c, (e) => M(r.content.blocks, e));
|
|
384
|
+
if (P(e, u)) return;
|
|
377
385
|
u && t.onStructureChange?.();
|
|
378
|
-
let d =
|
|
386
|
+
let d = R(l);
|
|
379
387
|
delete o.l10n, Object.assign(o, d), _(o, ke(o.l10n?.[s], Ee(o, i, o.l10n?.[s], a), Ee(o, c, o.l10n?.[s], a), o, c));
|
|
380
388
|
} else {
|
|
381
|
-
if (
|
|
382
|
-
let t =
|
|
389
|
+
if (P(e, "children" in n || "columns" in n)) return;
|
|
390
|
+
let t = R({
|
|
383
391
|
...o,
|
|
384
392
|
...n
|
|
385
393
|
});
|
|
@@ -389,18 +397,18 @@ function Fe(t) {
|
|
|
389
397
|
}
|
|
390
398
|
function me(e) {
|
|
391
399
|
if ("locales" in e || "l10n" in e) throw new W("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
|
|
392
|
-
if ("locale" in e && e.locale !==
|
|
400
|
+
if ("locale" in e && e.locale !== A(r.content) && r.content.settings.locales?.length) throw new W("The default locale can't change while language versions exist.", void 0, "invalid_operation");
|
|
393
401
|
}
|
|
394
402
|
function he(e) {
|
|
395
403
|
if (!s()) return;
|
|
396
404
|
me(e);
|
|
397
405
|
let t = i.value;
|
|
398
|
-
if (!t) r.content.settings =
|
|
406
|
+
if (!t) r.content.settings = oe({
|
|
399
407
|
...r.content.settings,
|
|
400
408
|
...e
|
|
401
409
|
});
|
|
402
410
|
else {
|
|
403
|
-
let n = r.content.settings, i =
|
|
411
|
+
let n = r.content.settings, i = T(r.content, t).settings, a = {
|
|
404
412
|
...i,
|
|
405
413
|
locale: n.locale,
|
|
406
414
|
...e
|
|
@@ -415,9 +423,9 @@ function Fe(t) {
|
|
|
415
423
|
let K = {
|
|
416
424
|
canEdit: s,
|
|
417
425
|
content: () => r.content,
|
|
418
|
-
findBlock: (e) =>
|
|
419
|
-
findBlockLocation:
|
|
420
|
-
isBlockLocked:
|
|
426
|
+
findBlock: (e) => M(r.content.blocks, e),
|
|
427
|
+
findBlockLocation: L,
|
|
428
|
+
isBlockLocked: P
|
|
421
429
|
};
|
|
422
430
|
function ge(e, n, a = 0, o) {
|
|
423
431
|
if (je(K, "addBlock", [
|
|
@@ -427,7 +435,7 @@ function Fe(t) {
|
|
|
427
435
|
o
|
|
428
436
|
])) {
|
|
429
437
|
if (n) {
|
|
430
|
-
let t =
|
|
438
|
+
let t = M(r.content.blocks, n);
|
|
431
439
|
if (t && t.type === "section") {
|
|
432
440
|
t.children[a] = t.children[a] || [];
|
|
433
441
|
let n = t.children[a];
|
|
@@ -439,16 +447,12 @@ function Fe(t) {
|
|
|
439
447
|
}
|
|
440
448
|
function _e(e) {
|
|
441
449
|
if (!je(K, "removeBlock", [e])) return;
|
|
442
|
-
let n =
|
|
450
|
+
let n = ne(r.content.blocks, e);
|
|
443
451
|
if (n) {
|
|
444
452
|
let a = n.blocks.findIndex((t) => t.id === e);
|
|
445
453
|
if (a !== -1) {
|
|
446
454
|
let [e] = n.blocks.splice(a, 1);
|
|
447
|
-
|
|
448
|
-
let t = /* @__PURE__ */ new Set();
|
|
449
|
-
ie(e, t), t.has(r.selectedBlockId) && (r.selectedBlockId = null);
|
|
450
|
-
}
|
|
451
|
-
i.value && t.onStructureChange?.(), k();
|
|
455
|
+
r.selectedBlockId && new Set(N(e)).has(r.selectedBlockId) && (r.selectedBlockId = null), i.value && t.onStructureChange?.(), k();
|
|
452
456
|
}
|
|
453
457
|
}
|
|
454
458
|
}
|
|
@@ -459,9 +463,9 @@ function Fe(t) {
|
|
|
459
463
|
a,
|
|
460
464
|
o
|
|
461
465
|
])) return;
|
|
462
|
-
let s =
|
|
466
|
+
let s = ne(r.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
|
|
463
467
|
if (a) {
|
|
464
|
-
let e =
|
|
468
|
+
let e = M(r.content.blocks, a);
|
|
465
469
|
e.children[o] = e.children[o] || [], l = e.children[o];
|
|
466
470
|
} else l = r.content.blocks;
|
|
467
471
|
let [u] = s.blocks.splice(c, 1);
|
|
@@ -474,7 +478,7 @@ function Fe(t) {
|
|
|
474
478
|
throw new W(`[Templatical] Templates: ${e} ${t}`);
|
|
475
479
|
}
|
|
476
480
|
function xe(e) {
|
|
477
|
-
|
|
481
|
+
Fe(t.onError, e);
|
|
478
482
|
}
|
|
479
483
|
function Se(e) {
|
|
480
484
|
let { templates: n } = t;
|
|
@@ -486,7 +490,7 @@ function Fe(t) {
|
|
|
486
490
|
name: e
|
|
487
491
|
}, k());
|
|
488
492
|
}
|
|
489
|
-
async function
|
|
493
|
+
async function Ce(e) {
|
|
490
494
|
let n = Se("create()"), { create: i } = n;
|
|
491
495
|
typeof i != "function" && be("create()", "is disabled by the provider — its `create` is `false`.");
|
|
492
496
|
let a, o = ++D;
|
|
@@ -505,11 +509,11 @@ function Fe(t) {
|
|
|
505
509
|
}
|
|
506
510
|
return xe(() => n.onCreated?.(a)), a;
|
|
507
511
|
}
|
|
508
|
-
async function
|
|
512
|
+
async function J(e, n) {
|
|
509
513
|
let i = Se("load()"), a, o = ++D;
|
|
510
514
|
r.isLoading = !0;
|
|
511
515
|
try {
|
|
512
|
-
if (a = await i.load(e),
|
|
516
|
+
if (a = await i.load(e), U(a.content), ce(a.content), n && !n()) return a;
|
|
513
517
|
r.template = a, r.content = a.content, r.isDirty = !1, E.value++;
|
|
514
518
|
} catch (e) {
|
|
515
519
|
throw t.onError?.(e), e;
|
|
@@ -518,7 +522,7 @@ function Fe(t) {
|
|
|
518
522
|
}
|
|
519
523
|
return xe(() => i.onLoaded?.(a)), a;
|
|
520
524
|
}
|
|
521
|
-
async function
|
|
525
|
+
async function Y(e = "api") {
|
|
522
526
|
let n = Se("save()"), { save: i } = n;
|
|
523
527
|
typeof i != "function" && be("save()", "is disabled by the provider — its `save` is `false`.");
|
|
524
528
|
let a = r.template;
|
|
@@ -545,14 +549,14 @@ function Fe(t) {
|
|
|
545
549
|
}
|
|
546
550
|
return xe(() => n.onSaved?.(s, { trigger: e })), s;
|
|
547
551
|
}
|
|
548
|
-
function
|
|
552
|
+
function we() {
|
|
549
553
|
return r.template?.id !== void 0;
|
|
550
554
|
}
|
|
551
555
|
let X = {
|
|
552
556
|
state: m(r),
|
|
553
557
|
loadVersion: m(E),
|
|
554
|
-
content:
|
|
555
|
-
selectedBlock:
|
|
558
|
+
content: ee,
|
|
559
|
+
selectedBlock: j,
|
|
556
560
|
activeLocale: i,
|
|
557
561
|
setActiveLocale: o,
|
|
558
562
|
addLocale: p,
|
|
@@ -562,34 +566,34 @@ function Fe(t) {
|
|
|
562
566
|
keepTranslations: w,
|
|
563
567
|
setCustomBlockDefinitions: c,
|
|
564
568
|
createSetDefaultLocaleOperation: l,
|
|
565
|
-
isBlockLocked:
|
|
566
|
-
setContent:
|
|
567
|
-
selectBlock:
|
|
568
|
-
setViewport:
|
|
569
|
-
setDarkMode:
|
|
570
|
-
setUiTheme:
|
|
571
|
-
setPreviewMode:
|
|
569
|
+
isBlockLocked: P,
|
|
570
|
+
setContent: ie,
|
|
571
|
+
selectBlock: se,
|
|
572
|
+
setViewport: z,
|
|
573
|
+
setDarkMode: le,
|
|
574
|
+
setUiTheme: ue,
|
|
575
|
+
setPreviewMode: de,
|
|
572
576
|
updateBlock: pe,
|
|
573
577
|
updateSettings: he,
|
|
574
578
|
addBlock: ge,
|
|
575
579
|
removeBlock: _e,
|
|
576
580
|
moveBlock: ve,
|
|
577
581
|
markDirty: ye,
|
|
578
|
-
findBlockLocation:
|
|
582
|
+
findBlockLocation: L,
|
|
579
583
|
setName: q,
|
|
580
|
-
create:
|
|
581
|
-
load:
|
|
582
|
-
save:
|
|
583
|
-
hasTemplate:
|
|
584
|
+
create: Ce,
|
|
585
|
+
load: J,
|
|
586
|
+
save: Y,
|
|
587
|
+
hasTemplate: we
|
|
584
588
|
};
|
|
585
|
-
return
|
|
589
|
+
return Ne(X, (e, t) => Ae(e) ? je(K, e, t) : s() ? e === "updateBlock" ? fe(t[0], t[1]) : (e === "updateSettings" && me(t[0]), e === "addLocale" || e === "removeLocale" ? d(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? v(e, t) !== null : !0) : !1), X;
|
|
586
590
|
}
|
|
587
591
|
// ../core/src/history.ts
|
|
588
|
-
var
|
|
589
|
-
function
|
|
590
|
-
let { content: t, setContent: n, maxSize: r =
|
|
592
|
+
var Le = 50, Re = 300, ze = 1500;
|
|
593
|
+
function Be(e) {
|
|
594
|
+
let { content: t, setContent: n, maxSize: r = Le } = e, i = S([]), a = S([]), o = S(!1), s = null, c = null, l = b(() => i.value.length > 0), u = b(() => a.value.length > 0);
|
|
591
595
|
function d() {
|
|
592
|
-
return
|
|
596
|
+
return H(t.value);
|
|
593
597
|
}
|
|
594
598
|
function f(e) {
|
|
595
599
|
i.value.push(e), i.value.length > r && i.value.splice(0, i.value.length - r);
|
|
@@ -603,17 +607,17 @@ function ze(e) {
|
|
|
603
607
|
function h(e) {
|
|
604
608
|
c && c.blockId === e ? (clearTimeout(c.timeoutId), c.timeoutId = setTimeout(() => {
|
|
605
609
|
c = null;
|
|
606
|
-
},
|
|
610
|
+
}, Re)) : (p(), f(d()), a.value = [], c = {
|
|
607
611
|
blockId: e,
|
|
608
612
|
timeoutId: setTimeout(() => {
|
|
609
613
|
c = null;
|
|
610
|
-
},
|
|
614
|
+
}, Re)
|
|
611
615
|
});
|
|
612
616
|
}
|
|
613
617
|
function g() {
|
|
614
618
|
o.value = !0, s && clearTimeout(s), s = setTimeout(() => {
|
|
615
619
|
o.value = !1, s = null;
|
|
616
|
-
},
|
|
620
|
+
}, ze);
|
|
617
621
|
}
|
|
618
622
|
function _() {
|
|
619
623
|
if (i.value.length === 0) return;
|
|
@@ -647,15 +651,15 @@ function ze(e) {
|
|
|
647
651
|
};
|
|
648
652
|
}
|
|
649
653
|
// ../core/src/block-actions.ts
|
|
650
|
-
function
|
|
654
|
+
function Ve(e) {
|
|
651
655
|
let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
|
|
652
656
|
function o(n, r, a) {
|
|
653
|
-
let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s =
|
|
657
|
+
let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = me(n, o);
|
|
654
658
|
return t(s, r, a), i(s.id), s;
|
|
655
659
|
}
|
|
656
660
|
function s(e, n, r) {
|
|
657
|
-
let o =
|
|
658
|
-
if (!
|
|
661
|
+
let o = fe(e);
|
|
662
|
+
if (!Q(t, "duplicateBlock", [
|
|
659
663
|
e,
|
|
660
664
|
n,
|
|
661
665
|
r
|
|
@@ -681,9 +685,9 @@ function Be(e) {
|
|
|
681
685
|
};
|
|
682
686
|
}
|
|
683
687
|
// ../core/src/auto-save.ts
|
|
684
|
-
var
|
|
685
|
-
function
|
|
686
|
-
let { content: t, isDirty: n, onChange: r, debounce: i =
|
|
688
|
+
var He = 2e3;
|
|
689
|
+
function Ue(e) {
|
|
690
|
+
let { content: t, isDirty: n, onChange: r, debounce: i = He, enabled: a = !0 } = e, o = null, s = !1;
|
|
687
691
|
function c() {
|
|
688
692
|
return typeof a == "function" ? a() : a;
|
|
689
693
|
}
|
|
@@ -719,7 +723,7 @@ function He(e) {
|
|
|
719
723
|
};
|
|
720
724
|
}
|
|
721
725
|
// ../core/src/condition-preview.ts
|
|
722
|
-
function
|
|
726
|
+
function We(t) {
|
|
723
727
|
let n = e(/* @__PURE__ */ new Set()), r = b(() => n.size > 0);
|
|
724
728
|
function i(e) {
|
|
725
729
|
return n.has(e);
|
|
@@ -738,7 +742,7 @@ function Ue(t) {
|
|
|
738
742
|
};
|
|
739
743
|
}
|
|
740
744
|
// ../core/src/data-source-fetch.ts
|
|
741
|
-
function
|
|
745
|
+
function Ge(e) {
|
|
742
746
|
let t = S(!1), n = S(!1), r = b(() => !!e.definition.value?.dataSource), i = b(() => r.value && !e.block.value.dataSourceFetched);
|
|
743
747
|
async function a() {
|
|
744
748
|
let r = e.definition.value;
|
|
@@ -769,7 +773,7 @@ function We(e) {
|
|
|
769
773
|
};
|
|
770
774
|
}
|
|
771
775
|
// ../core/src/history-interceptor.ts
|
|
772
|
-
function
|
|
776
|
+
function Ke(e, t) {
|
|
773
777
|
e.activeLocale && h(e.activeLocale, () => t.flushDebounce?.());
|
|
774
778
|
for (let n of [
|
|
775
779
|
"addLocale",
|
|
@@ -780,70 +784,75 @@ function Ge(e, t) {
|
|
|
780
784
|
]) {
|
|
781
785
|
let r = e[n];
|
|
782
786
|
r && (Object.assign(e, { [n]: (...i) => {
|
|
783
|
-
|
|
784
|
-
} }),
|
|
787
|
+
Q(e, n, i) && (["addLocale", "removeLocale"].includes(n) || !e.isBlockLocked(i[0])) && (t.record(), r(...i));
|
|
788
|
+
} }), Z(r, e[n]));
|
|
785
789
|
}
|
|
786
790
|
let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
|
|
787
791
|
e.addBlock = (r, i, a, o) => {
|
|
788
|
-
|
|
792
|
+
Q(e, "addBlock", [
|
|
789
793
|
r,
|
|
790
794
|
i,
|
|
791
795
|
a,
|
|
792
796
|
o
|
|
793
797
|
]) && (t.record(), n(r, i, a, o));
|
|
794
798
|
}, e.removeBlock = (n) => {
|
|
795
|
-
|
|
799
|
+
Q(e, "removeBlock", [n]) && (t.record(), r(n));
|
|
796
800
|
}, e.moveBlock = (n, r, a, o) => {
|
|
797
|
-
|
|
801
|
+
Q(e, "moveBlock", [
|
|
798
802
|
n,
|
|
799
803
|
r,
|
|
800
804
|
a,
|
|
801
805
|
o
|
|
802
806
|
]) && (t.record(), i(n, r, a, o));
|
|
803
|
-
},
|
|
804
|
-
|
|
807
|
+
}, Z(n, e.addBlock), Z(r, e.removeBlock), Z(i, e.moveBlock), e.updateBlock = (n, r) => {
|
|
808
|
+
Q(e, "updateBlock", [n, r]) && (e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r)));
|
|
805
809
|
}, e.updateSettings = (n) => {
|
|
806
|
-
|
|
807
|
-
},
|
|
810
|
+
Q(e, "updateSettings", [n]) && (t.record(), o(n));
|
|
811
|
+
}, Z(a, e.updateBlock), Z(o, e.updateSettings);
|
|
808
812
|
}
|
|
809
813
|
// ../core/src/diff-content.ts
|
|
810
|
-
var
|
|
814
|
+
var qe = "root", Je = /* @__PURE__ */ new Set([
|
|
811
815
|
"id",
|
|
812
816
|
"type",
|
|
813
817
|
"children",
|
|
814
818
|
"l10n"
|
|
815
|
-
]),
|
|
819
|
+
]), Ye = /* @__PURE__ */ new Set([
|
|
816
820
|
"id",
|
|
817
821
|
"type",
|
|
818
822
|
"children",
|
|
819
823
|
"columns",
|
|
820
824
|
"l10n"
|
|
821
|
-
]),
|
|
822
|
-
function Ze(e) {
|
|
823
|
-
return e === null ? Ke : JSON.stringify([e.sectionId, e.column]);
|
|
824
|
-
}
|
|
825
|
+
]), Xe = /* @__PURE__ */ new Set(), Ze = /* @__PURE__ */ new Set(["locales", "l10n"]);
|
|
825
826
|
function Qe(e) {
|
|
827
|
+
return e === null ? qe : "wrapperId" in e ? JSON.stringify(["wrapper", e.wrapperId]) : JSON.stringify([
|
|
828
|
+
"section",
|
|
829
|
+
e.sectionId,
|
|
830
|
+
e.column
|
|
831
|
+
]);
|
|
832
|
+
}
|
|
833
|
+
function $e(e) {
|
|
826
834
|
let t = e.children;
|
|
827
835
|
return e.type === "section" && Array.isArray(t) ? t : [];
|
|
828
836
|
}
|
|
829
|
-
function
|
|
837
|
+
function et(e) {
|
|
830
838
|
let t = /* @__PURE__ */ new Map(), n = (e, r) => {
|
|
831
839
|
e.forEach((e, i) => {
|
|
832
840
|
t.has(e.id) || t.set(e.id, {
|
|
833
841
|
block: e,
|
|
834
|
-
|
|
842
|
+
parent: r,
|
|
843
|
+
key: Qe(r),
|
|
835
844
|
index: i
|
|
836
|
-
}),
|
|
845
|
+
}), $e(e).forEach((t, r) => {
|
|
837
846
|
Array.isArray(t) && n(t, {
|
|
838
847
|
sectionId: e.id,
|
|
839
848
|
column: r
|
|
840
849
|
});
|
|
841
|
-
});
|
|
850
|
+
}), e.type === "wrapper" && Array.isArray(e.children) && n(e.children, { wrapperId: e.id });
|
|
842
851
|
});
|
|
843
852
|
};
|
|
844
853
|
return n(e, null), t;
|
|
845
854
|
}
|
|
846
|
-
function
|
|
855
|
+
function tt(e) {
|
|
847
856
|
let t = [], n = Array(e.length).fill(-1);
|
|
848
857
|
e.forEach((r, i) => {
|
|
849
858
|
let a = 0, o = t.length;
|
|
@@ -857,17 +866,17 @@ function et(e) {
|
|
|
857
866
|
for (; i !== -1;) r.add(i), i = n[i];
|
|
858
867
|
return r;
|
|
859
868
|
}
|
|
860
|
-
function
|
|
869
|
+
function nt(e, t, n) {
|
|
861
870
|
let r = {}, i = [];
|
|
862
|
-
for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 ||
|
|
871
|
+
for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || G(e[i], t[i]) || (r[i] = H(t[i]));
|
|
863
872
|
for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
|
|
864
873
|
return {
|
|
865
874
|
set: r,
|
|
866
875
|
unset: i
|
|
867
876
|
};
|
|
868
877
|
}
|
|
869
|
-
function
|
|
870
|
-
let n =
|
|
878
|
+
function rt(e = {}, t = {}) {
|
|
879
|
+
let n = nt(e.text ?? {}, t.text ?? {}, Xe), r = nt(e.set ?? {}, t.set ?? {}, Xe), i = [.../* @__PURE__ */ new Set([...n.unset, ...r.unset])];
|
|
871
880
|
return {
|
|
872
881
|
...Object.keys(n.set).length > 0 ? { text: n.set } : {},
|
|
873
882
|
...Object.keys(r.set).length > 0 ? { set: r.set } : {},
|
|
@@ -875,107 +884,142 @@ function nt(e = {}, t = {}) {
|
|
|
875
884
|
...e.hidden === t.hidden ? {} : { hidden: t.hidden === !0 }
|
|
876
885
|
};
|
|
877
886
|
}
|
|
878
|
-
function
|
|
887
|
+
function it(e, t) {
|
|
879
888
|
if (e.settings.locale !== t.settings.locale && (e.settings.locales?.length || t.settings.locales?.length)) return [{
|
|
880
889
|
op: "setContent",
|
|
881
|
-
content:
|
|
890
|
+
content: H(t)
|
|
882
891
|
}];
|
|
883
|
-
let n =
|
|
892
|
+
let n = et(e.blocks), r = et(t.blocks), i = [], a = new Set(t.settings.locales ?? []), o = new Set(e.settings.locales ?? []), s = (e) => {
|
|
884
893
|
let t = r.get(e), i = n.get(e);
|
|
885
894
|
return t !== void 0 && i !== void 0 && t.block.type !== i.block.type;
|
|
886
|
-
},
|
|
895
|
+
}, c = (e) => r.has(e.id) && !s(e.id), l = (e) => e.type === "wrapper" && Array.isArray(e.children) ? [e.children] : $e(e), u = (e) => l(e).some((e) => e.some((e) => c(e) || !s(e.id) && u(e))), d = /* @__PURE__ */ new Set(), f = [], p = (e, t) => {
|
|
887
896
|
let n = "kept";
|
|
888
|
-
t === "dropped" ? (
|
|
897
|
+
t === "dropped" ? (d.add(e.id), n = "dropped") : s(e.id) ? (i.push({
|
|
889
898
|
op: "deleteBlock",
|
|
890
899
|
blockId: e.id
|
|
891
|
-
}),
|
|
900
|
+
}), d.add(e.id), n = "dropped") : r.has(e.id) || (t === "deferred" ? n = "deferred" : u(e) ? (f.push(e.id), n = "deferred") : (i.push({
|
|
892
901
|
op: "deleteBlock",
|
|
893
902
|
blockId: e.id
|
|
894
|
-
}),
|
|
895
|
-
for (let t of
|
|
903
|
+
}), d.add(e.id), n = "dropped"));
|
|
904
|
+
for (let t of l(e)) if (Array.isArray(t)) for (let e of t) p(e, n);
|
|
896
905
|
};
|
|
897
|
-
for (let t of e.blocks)
|
|
898
|
-
let
|
|
899
|
-
let t =
|
|
900
|
-
return t.type === "section"
|
|
901
|
-
},
|
|
902
|
-
let a =
|
|
906
|
+
for (let t of e.blocks) p(t, "kept");
|
|
907
|
+
let m = (e) => n.has(e) && !d.has(e), h = (e) => {
|
|
908
|
+
let t = H(e);
|
|
909
|
+
return t.type === "section" ? t.children = $e(e).map((e) => Array.isArray(e) ? e.filter((e) => !m(e.id)).map(h) : e) : t.type === "wrapper" && e.type === "wrapper" && (t.children = e.children.filter((e) => !m(e.id)).map(h)), t;
|
|
910
|
+
}, g = (e, t, r) => {
|
|
911
|
+
let a = Qe(e), o = [], s = [];
|
|
903
912
|
t.forEach((e, t) => {
|
|
904
913
|
let r = n.get(e.id);
|
|
905
|
-
|
|
914
|
+
m(e.id) && r !== void 0 && r.key === a && (o.push(r.index), s.push(t));
|
|
906
915
|
});
|
|
907
|
-
let c = new Set([...
|
|
916
|
+
let c = new Set([...tt(o)].map((e) => s[e]));
|
|
908
917
|
t.forEach((n, a) => {
|
|
909
918
|
if (c.has(a) || r(n)) return;
|
|
910
919
|
let o = a > 0 ? t[a - 1].id : null;
|
|
911
|
-
i.push(
|
|
920
|
+
i.push(m(n.id) ? {
|
|
912
921
|
op: "moveBlock",
|
|
913
922
|
blockId: n.id,
|
|
914
923
|
parent: e,
|
|
915
924
|
after: o
|
|
916
925
|
} : {
|
|
917
926
|
op: "addBlock",
|
|
918
|
-
block:
|
|
927
|
+
block: h(n),
|
|
919
928
|
parent: e,
|
|
920
929
|
after: o
|
|
921
930
|
});
|
|
922
931
|
});
|
|
923
932
|
};
|
|
924
|
-
|
|
925
|
-
let
|
|
926
|
-
for (let t of
|
|
927
|
-
if (!
|
|
928
|
-
let r =
|
|
933
|
+
g(null, t.blocks, () => !1);
|
|
934
|
+
let _ = [...r.values()].map(({ block: e }) => e).filter((e) => e.type === "section"), v = /* @__PURE__ */ new Set(), y = (e) => {
|
|
935
|
+
for (let t of _) {
|
|
936
|
+
if (!m(t.id)) continue;
|
|
937
|
+
let r = $e(n.get(t.id).block).length, a = $e(t).length;
|
|
929
938
|
(e ? a > r : a < r) && (i.push({
|
|
930
939
|
op: "updateBlock",
|
|
931
940
|
blockId: t.id,
|
|
932
941
|
set: { columns: t.columns }
|
|
933
|
-
}),
|
|
942
|
+
}), v.add(t.id));
|
|
934
943
|
}
|
|
935
944
|
};
|
|
936
|
-
|
|
937
|
-
for (let e of
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
945
|
+
y(!0);
|
|
946
|
+
for (let { block: e } of r.values()) {
|
|
947
|
+
if (e.type !== "wrapper") continue;
|
|
948
|
+
let t = !m(e.id);
|
|
949
|
+
g({ wrapperId: e.id }, e.children, (e) => t && !m(e.id));
|
|
950
|
+
}
|
|
951
|
+
for (let e of _) {
|
|
952
|
+
let t = !m(e.id);
|
|
953
|
+
$e(e).forEach((n, r) => {
|
|
954
|
+
Array.isArray(n) && g({
|
|
941
955
|
sectionId: e.id,
|
|
942
956
|
column: r
|
|
943
|
-
}, n, (e) => t && !
|
|
957
|
+
}, n, (e) => t && !m(e.id));
|
|
944
958
|
});
|
|
945
959
|
}
|
|
946
|
-
|
|
947
|
-
for (let e of
|
|
960
|
+
y(!1);
|
|
961
|
+
for (let e of f) i.push({
|
|
948
962
|
op: "deleteBlock",
|
|
949
963
|
blockId: e
|
|
950
964
|
});
|
|
965
|
+
let b = (e) => e.type === "slot" || l(e).some((e) => e.some(b)), x = (e) => {
|
|
966
|
+
let t = [], n = e;
|
|
967
|
+
for (; n !== null;) {
|
|
968
|
+
let e = "wrapperId" in n ? n.wrapperId : n.sectionId;
|
|
969
|
+
"wrapperId" in n && t.push(e), n = r.get(e)?.parent ?? null;
|
|
970
|
+
}
|
|
971
|
+
return t;
|
|
972
|
+
}, S = new Set(i.flatMap((e) => {
|
|
973
|
+
if (e.op !== "addBlock" && e.op !== "moveBlock" || e.parent === null) return [];
|
|
974
|
+
let t = e.op === "addBlock" ? e.block : n.get(e.blockId)?.block;
|
|
975
|
+
return t && b(t) ? x(e.parent) : [];
|
|
976
|
+
})), C = /* @__PURE__ */ new Set(), w = [];
|
|
977
|
+
for (let [e, t] of n) {
|
|
978
|
+
let n = r.get(e);
|
|
979
|
+
if (S.has(e) && n && c(t.block)) for (let [r, i] of Object.entries(t.block.l10n ?? {})) i.hidden === !0 && n.block.l10n?.[r]?.hidden !== !0 && o.has(r) && (w.push({
|
|
980
|
+
op: "updateBlockLocale",
|
|
981
|
+
blockId: e,
|
|
982
|
+
locale: r,
|
|
983
|
+
hidden: !1
|
|
984
|
+
}), C.add(JSON.stringify([e, r])));
|
|
985
|
+
}
|
|
986
|
+
let T = /* @__PURE__ */ new Set(), E = [];
|
|
987
|
+
for (let [e, t] of n) {
|
|
988
|
+
let n = r.get(e);
|
|
989
|
+
n && c(t.block) && t.block.type === "section" && t.block.wrapper !== void 0 && n.block.wrapper === void 0 && n.parent !== null && "wrapperId" in n.parent && (T.add(e), E.push({
|
|
990
|
+
op: "updateBlock",
|
|
991
|
+
blockId: e,
|
|
992
|
+
unset: ["wrapper"]
|
|
993
|
+
}));
|
|
994
|
+
}
|
|
995
|
+
i.unshift(...w, ...E);
|
|
951
996
|
for (let [e, t] of r) {
|
|
952
|
-
if (!
|
|
953
|
-
let
|
|
954
|
-
(Object.keys(
|
|
997
|
+
if (!m(e)) continue;
|
|
998
|
+
let r = nt(n.get(e).block, t.block, v.has(e) ? Ye : Je), { set: a } = r, o = T.has(e) ? r.unset.filter((e) => e !== "wrapper") : r.unset;
|
|
999
|
+
(Object.keys(a).length !== 0 || o.length !== 0) && i.push({
|
|
955
1000
|
op: "updateBlock",
|
|
956
1001
|
blockId: e,
|
|
957
|
-
...Object.keys(
|
|
958
|
-
...
|
|
1002
|
+
...Object.keys(a).length > 0 ? { set: a } : {},
|
|
1003
|
+
...o.length > 0 ? { unset: o } : {}
|
|
959
1004
|
});
|
|
960
1005
|
}
|
|
961
|
-
let
|
|
962
|
-
(Object.keys(
|
|
1006
|
+
let D = nt(e.settings, t.settings, Ze);
|
|
1007
|
+
(Object.keys(D.set).length > 0 || D.unset.length > 0) && i.push({
|
|
963
1008
|
op: "updateSettings",
|
|
964
|
-
...Object.keys(
|
|
965
|
-
...
|
|
1009
|
+
...Object.keys(D.set).length > 0 ? { set: D.set } : {},
|
|
1010
|
+
...D.unset.length > 0 ? { unset: D.unset } : {}
|
|
966
1011
|
});
|
|
967
|
-
let
|
|
968
|
-
for (let e of y) v.has(e) || i.push({
|
|
1012
|
+
for (let e of a) o.has(e) || i.push({
|
|
969
1013
|
op: "addLocale",
|
|
970
1014
|
locale: e
|
|
971
1015
|
});
|
|
972
1016
|
for (let [e, t] of r) {
|
|
973
|
-
if (!
|
|
974
|
-
let r = n.get(e).block.l10n ?? {},
|
|
975
|
-
for (let t of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(
|
|
976
|
-
if (!
|
|
977
|
-
let n =
|
|
978
|
-
Object.keys(n).length > 0 && i.push({
|
|
1017
|
+
if (!m(e)) continue;
|
|
1018
|
+
let r = n.get(e).block.l10n ?? {}, o = t.block.l10n ?? {};
|
|
1019
|
+
for (let t of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(o)])) {
|
|
1020
|
+
if (!a.has(t)) continue;
|
|
1021
|
+
let n = rt(r[t], o[t]);
|
|
1022
|
+
C.has(JSON.stringify([e, t])) && delete n.hidden, Object.keys(n).length > 0 && i.push({
|
|
979
1023
|
op: "updateBlockLocale",
|
|
980
1024
|
blockId: e,
|
|
981
1025
|
locale: t,
|
|
@@ -983,17 +1027,17 @@ function rt(e, t) {
|
|
|
983
1027
|
});
|
|
984
1028
|
}
|
|
985
1029
|
}
|
|
986
|
-
let
|
|
987
|
-
for (let e of /* @__PURE__ */ new Set([...Object.keys(
|
|
988
|
-
if (!
|
|
989
|
-
let t =
|
|
1030
|
+
let O = e.settings.l10n ?? {}, k = t.settings.l10n ?? {};
|
|
1031
|
+
for (let e of /* @__PURE__ */ new Set([...Object.keys(O), ...Object.keys(k)])) {
|
|
1032
|
+
if (!a.has(e)) continue;
|
|
1033
|
+
let t = rt(O[e], k[e]);
|
|
990
1034
|
Object.keys(t).length > 0 && i.push({
|
|
991
1035
|
op: "updateSettingsLocale",
|
|
992
1036
|
locale: e,
|
|
993
1037
|
...t
|
|
994
1038
|
});
|
|
995
1039
|
}
|
|
996
|
-
for (let e of
|
|
1040
|
+
for (let e of o) a.has(e) || i.push({
|
|
997
1041
|
op: "removeLocale",
|
|
998
1042
|
locale: e
|
|
999
1043
|
});
|
|
@@ -1002,23 +1046,30 @@ function rt(e, t) {
|
|
|
1002
1046
|
// ../core/src/localized-operations.ts
|
|
1003
1047
|
function $(e) {
|
|
1004
1048
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1005
|
-
t.set(e.id, e), e.type === "section"
|
|
1049
|
+
t.set(e.id, e), e.type === "section" ? e.children.flat().forEach(n) : e.type === "wrapper" && e.children.forEach(n);
|
|
1006
1050
|
};
|
|
1007
1051
|
return e.forEach(n), t;
|
|
1008
1052
|
}
|
|
1009
|
-
function
|
|
1053
|
+
function at(e, t) {
|
|
1010
1054
|
if (t === null) return e.blocks;
|
|
1011
|
-
|
|
1012
|
-
|
|
1055
|
+
if ("sectionId" in t) {
|
|
1056
|
+
let n = $(e.blocks).get(t.sectionId);
|
|
1057
|
+
return n?.type === "section" ? n.children[t.column] : [];
|
|
1058
|
+
}
|
|
1059
|
+
let n = $(e.blocks).get(t.wrapperId);
|
|
1060
|
+
return n?.type === "wrapper" ? n.children : [];
|
|
1013
1061
|
}
|
|
1014
|
-
function
|
|
1062
|
+
function ot(e, t) {
|
|
1015
1063
|
let n = (e, r) => {
|
|
1016
1064
|
let i = e.findIndex((e) => e.id === t);
|
|
1017
1065
|
if (i >= 0) return {
|
|
1018
1066
|
parent: r,
|
|
1019
1067
|
after: e[i - 1]?.id ?? null
|
|
1020
1068
|
};
|
|
1021
|
-
for (let t of e) if (t.type === "
|
|
1069
|
+
for (let t of e) if (t.type === "wrapper") {
|
|
1070
|
+
let e = n(t.children, { wrapperId: t.id });
|
|
1071
|
+
if (e) return e;
|
|
1072
|
+
} else if (t.type === "section") for (let [e, r] of t.children.entries()) {
|
|
1022
1073
|
let i = n(r, {
|
|
1023
1074
|
sectionId: t.id,
|
|
1024
1075
|
column: e
|
|
@@ -1028,52 +1079,52 @@ function at(e, t) {
|
|
|
1028
1079
|
};
|
|
1029
1080
|
return n(e.blocks, null);
|
|
1030
1081
|
}
|
|
1031
|
-
function
|
|
1082
|
+
function st(e, t, n, r, i) {
|
|
1032
1083
|
if (r !== null) return r;
|
|
1033
|
-
let a =
|
|
1084
|
+
let a = at(t, n).find((e) => e.id !== i), o = at(e, n).filter((e) => e.id !== i);
|
|
1034
1085
|
return o[(a ? o.findIndex((e) => e.id === a.id) : o.length) - 1]?.id ?? null;
|
|
1035
1086
|
}
|
|
1036
|
-
function
|
|
1087
|
+
function ct(e, t, n) {
|
|
1037
1088
|
Object.keys(n).length ? (e.l10n ??= {})[t] = n : e.l10n && (delete e.l10n[t], Object.keys(e.l10n).length || delete e.l10n);
|
|
1038
1089
|
}
|
|
1039
|
-
function
|
|
1040
|
-
let t =
|
|
1041
|
-
return delete t.l10n, t.type === "section"
|
|
1090
|
+
function lt(e) {
|
|
1091
|
+
let t = H(e);
|
|
1092
|
+
return delete t.l10n, t.type === "section" ? t.children = t.children.map((e) => e.map(lt)) : t.type === "wrapper" && (t.children = t.children.map(lt)), t;
|
|
1042
1093
|
}
|
|
1043
|
-
function
|
|
1044
|
-
let i =
|
|
1094
|
+
function ut(e, t, n, r) {
|
|
1095
|
+
let i = T(e, t), a = H(e), o = H(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
|
|
1045
1096
|
for (let [i, a] of $(n)) c.set(i, {
|
|
1046
|
-
initial:
|
|
1097
|
+
initial: ae(a, t, A(e)),
|
|
1047
1098
|
added: r,
|
|
1048
1099
|
changed: !1
|
|
1049
1100
|
});
|
|
1050
1101
|
};
|
|
1051
1102
|
l(i.blocks, !1);
|
|
1052
1103
|
let u = [], d = (e, t, n) => {
|
|
1053
|
-
if (t.some((e) => e?.op === "setDefaultLocale")) throw new
|
|
1054
|
-
if (t.some((e) => e?.op === "setContent")) throw new
|
|
1104
|
+
if (t.some((e) => e?.op === "setDefaultLocale")) throw new P("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
|
|
1105
|
+
if (t.some((e) => e?.op === "setContent")) throw new P("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
|
|
1055
1106
|
try {
|
|
1056
|
-
return
|
|
1107
|
+
return O(e, t);
|
|
1057
1108
|
} catch (e) {
|
|
1058
|
-
throw e instanceof
|
|
1109
|
+
throw e instanceof P ? new P(e.code, n, e.message, e.blockId) : e;
|
|
1059
1110
|
}
|
|
1060
1111
|
}, f = (e, t) => {
|
|
1061
1112
|
a = d(a, e, t), u.push(...e);
|
|
1062
1113
|
}, p = (e, n) => {
|
|
1063
1114
|
let o = c.get(e);
|
|
1064
1115
|
if (!o?.changed) return;
|
|
1065
|
-
let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u =
|
|
1066
|
-
if (o.added) p =
|
|
1116
|
+
let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = H(a), d = at(u, ot(u, e).parent), p = H(s);
|
|
1117
|
+
if (o.added) p = lt(l), p.type === "section" && s.type === "section" ? (p.children = s.children, p.columns = s.columns) : p.type === "wrapper" && s.type === "wrapper" && (p.children = s.children);
|
|
1067
1118
|
else {
|
|
1068
1119
|
De(p, p.type === "section" ? {
|
|
1069
1120
|
...l,
|
|
1070
1121
|
children: p.children,
|
|
1071
1122
|
columns: p.columns
|
|
1072
|
-
} : l, (e) => $(a.blocks).get(e) ?? null), p =
|
|
1123
|
+
} : l, (e) => $(a.blocks).get(e) ?? null), p = R(p);
|
|
1073
1124
|
let e = p.l10n?.[t];
|
|
1074
|
-
|
|
1125
|
+
ct(p, t, ke(e, Ee(p, o.initial, e, r), Ee(p, l, e, r), p, l));
|
|
1075
1126
|
}
|
|
1076
|
-
d[d.findIndex((t) => t.id === e)] = p, f(
|
|
1127
|
+
d[d.findIndex((t) => t.id === e)] = p, f(it(a, u), n), o.changed = !1;
|
|
1077
1128
|
}, m = (e, t, n) => {
|
|
1078
1129
|
let r = $(a.blocks).get(e.blockId), i = $(t.blocks).get(e.blockId);
|
|
1079
1130
|
if (r.type !== "section" || i.type !== "section" || r.columns === i.columns) return;
|
|
@@ -1092,7 +1143,7 @@ function lt(e, t, n, r) {
|
|
|
1092
1143
|
op: "updateBlock",
|
|
1093
1144
|
blockId: e.blockId,
|
|
1094
1145
|
set: { columns: i.columns },
|
|
1095
|
-
...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e,
|
|
1146
|
+
...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, F(u, e) ?? null])) } : {}
|
|
1096
1147
|
}], n);
|
|
1097
1148
|
};
|
|
1098
1149
|
n.forEach((e, t) => {
|
|
@@ -1100,19 +1151,19 @@ function lt(e, t, n, r) {
|
|
|
1100
1151
|
let n = d(i, [e], t);
|
|
1101
1152
|
switch (e.op) {
|
|
1102
1153
|
case "addBlock": {
|
|
1103
|
-
let n =
|
|
1154
|
+
let n = lt(e.block);
|
|
1104
1155
|
f([{
|
|
1105
1156
|
...e,
|
|
1106
1157
|
block: n,
|
|
1107
|
-
after:
|
|
1158
|
+
after: st(a, i, e.parent, e.after)
|
|
1108
1159
|
}], t), l([n], !0);
|
|
1109
1160
|
break;
|
|
1110
1161
|
}
|
|
1111
1162
|
case "moveBlock":
|
|
1112
1163
|
f([{
|
|
1113
1164
|
...e,
|
|
1114
|
-
after:
|
|
1115
|
-
...e.expect ? { expect:
|
|
1165
|
+
after: st(a, i, e.parent, e.after, e.blockId),
|
|
1166
|
+
...e.expect ? { expect: ot(a, e.blockId) } : {}
|
|
1116
1167
|
}], t);
|
|
1117
1168
|
break;
|
|
1118
1169
|
case "deleteBlock": {
|
|
@@ -1137,18 +1188,18 @@ function lt(e, t, n, r) {
|
|
|
1137
1188
|
});
|
|
1138
1189
|
for (let e of c.keys()) p(e, n.length - 1);
|
|
1139
1190
|
if (s) {
|
|
1140
|
-
let e =
|
|
1141
|
-
|
|
1191
|
+
let e = H(a), r = e.settings.l10n?.[t];
|
|
1192
|
+
ct(e.settings, t, ke(r, Oe(e.settings, o, r), Oe(e.settings, i.settings, r), e.settings, i.settings)), f(it(a, e), n.length - 1);
|
|
1142
1193
|
}
|
|
1143
1194
|
return u;
|
|
1144
1195
|
}
|
|
1145
|
-
var
|
|
1196
|
+
var dt = 1e3, ft = 1e4, pt = [
|
|
1146
1197
|
1e3,
|
|
1147
1198
|
2e3,
|
|
1148
1199
|
5e3,
|
|
1149
1200
|
1e4,
|
|
1150
1201
|
3e4
|
|
1151
|
-
],
|
|
1202
|
+
], mt = 50, ht = 100, gt = /* @__PURE__ */ new Set([
|
|
1152
1203
|
"block_exists",
|
|
1153
1204
|
"block_missing",
|
|
1154
1205
|
"anchor_missing",
|
|
@@ -1159,49 +1210,49 @@ var ut = 1e3, dt = 1e4, ft = [
|
|
|
1159
1210
|
"lock_lost",
|
|
1160
1211
|
"content_too_large"
|
|
1161
1212
|
]);
|
|
1162
|
-
function
|
|
1213
|
+
function _t(e, t) {
|
|
1163
1214
|
return e.ops.some((e) => e.op === "setContent") ? e.view = t : delete e.view, e;
|
|
1164
1215
|
}
|
|
1165
|
-
function
|
|
1216
|
+
function vt(e) {
|
|
1166
1217
|
let t = e?.code;
|
|
1167
|
-
return typeof t == "string" &&
|
|
1218
|
+
return typeof t == "string" && gt.has(t) ? t : null;
|
|
1168
1219
|
}
|
|
1169
|
-
function
|
|
1220
|
+
function yt(e) {
|
|
1170
1221
|
let t = e?.holder;
|
|
1171
1222
|
return typeof t == "object" && t && typeof t.sessionId == "string" ? t : void 0;
|
|
1172
1223
|
}
|
|
1173
|
-
function
|
|
1224
|
+
function bt(e) {
|
|
1174
1225
|
let t = e?.statusCode;
|
|
1175
1226
|
return typeof t != "number" || t >= 500 || t === 408 || t === 429;
|
|
1176
1227
|
}
|
|
1177
|
-
function
|
|
1228
|
+
function xt(e, t) {
|
|
1178
1229
|
return e.some((e) => {
|
|
1179
1230
|
if (e.id === t) return !0;
|
|
1180
1231
|
let n = e.children;
|
|
1181
|
-
return e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) &&
|
|
1232
|
+
return e.type === "wrapper" && Array.isArray(n) && xt(n, t) || e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) && xt(e, t));
|
|
1182
1233
|
});
|
|
1183
1234
|
}
|
|
1184
|
-
function
|
|
1235
|
+
function St(e) {
|
|
1185
1236
|
if (e.length === 1 && e[0].op === "updateSettings") return !0;
|
|
1186
1237
|
let t = e[0];
|
|
1187
1238
|
return t.op === "updateBlock" && e.every((e) => e.op === "updateBlock" && e.blockId === t.blockId) || t.op === "updateBlockLocale" && e.every((e) => e.op === "updateBlockLocale" && e.blockId === t.blockId && e.locale === t.locale);
|
|
1188
1239
|
}
|
|
1189
|
-
function
|
|
1240
|
+
function Ct(e) {
|
|
1190
1241
|
return e.map((e) => {
|
|
1191
1242
|
if (!("expect" in e)) return e;
|
|
1192
1243
|
let { expect: t, ...n } = e;
|
|
1193
1244
|
return n;
|
|
1194
1245
|
});
|
|
1195
1246
|
}
|
|
1196
|
-
function
|
|
1197
|
-
let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), r = e.maxUndo ??
|
|
1198
|
-
function
|
|
1247
|
+
function wt(e) {
|
|
1248
|
+
let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), r = e.maxUndo ?? mt, i = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", a = x([]), s = x(/* @__PURE__ */ new Map()), l = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new WeakMap(), d = 0, f = S(null), p = S(null), m = S(0), g = S(0), _ = null, v = null, y = !1, C = !1, w = !1, T = !1, E = null, D = 0, k = !1, ee = [], A = null, j = null, M = Promise.resolve(), N = null, F = b(() => (v?.undo.length ?? 0) > 0), re = b(() => (v?.redo.length ?? 0) > 0);
|
|
1249
|
+
function I(t) {
|
|
1199
1250
|
e.onError?.(t instanceof Error ? t : Error(String(t)));
|
|
1200
1251
|
}
|
|
1201
|
-
function
|
|
1202
|
-
n !== v ||
|
|
1252
|
+
function L(t, n = v) {
|
|
1253
|
+
n !== v || k || e.onNotice?.(t);
|
|
1203
1254
|
}
|
|
1204
|
-
function
|
|
1255
|
+
function ie() {
|
|
1205
1256
|
return {
|
|
1206
1257
|
locks: [...s.value.values()].map((e) => ({
|
|
1207
1258
|
blockId: e.blockId,
|
|
@@ -1211,102 +1262,102 @@ function Ct(e) {
|
|
|
1211
1262
|
session: n
|
|
1212
1263
|
};
|
|
1213
1264
|
}
|
|
1214
|
-
function
|
|
1265
|
+
function R() {
|
|
1215
1266
|
g.value++;
|
|
1216
1267
|
}
|
|
1217
|
-
function
|
|
1268
|
+
function ae(e, t) {
|
|
1218
1269
|
e.push(t), e.length > r && e.splice(0, e.length - r);
|
|
1219
1270
|
}
|
|
1220
|
-
function
|
|
1271
|
+
function oe(e) {
|
|
1221
1272
|
if (!_ || y) return;
|
|
1222
1273
|
C = !0;
|
|
1223
1274
|
try {
|
|
1224
|
-
let t = _.content.value, n =
|
|
1275
|
+
let t = _.content.value, n = it(t, e);
|
|
1225
1276
|
if (n.length > 0) try {
|
|
1226
1277
|
te(t, n);
|
|
1227
1278
|
} catch {
|
|
1228
|
-
_.setContent(
|
|
1279
|
+
_.setContent(H(e), !1);
|
|
1229
1280
|
}
|
|
1230
|
-
|
|
1281
|
+
G(_.content.value, e) || _.setContent(H(e), !1);
|
|
1231
1282
|
} finally {
|
|
1232
1283
|
C = !1;
|
|
1233
1284
|
}
|
|
1234
1285
|
let t = _.state.selectedBlockId;
|
|
1235
|
-
t && !
|
|
1286
|
+
t && !xt(e.blocks, t) && _.selectBlock(null);
|
|
1236
1287
|
}
|
|
1237
|
-
function
|
|
1288
|
+
function se() {
|
|
1238
1289
|
C || T || (T = !0, queueMicrotask(() => {
|
|
1239
|
-
T = !1,
|
|
1290
|
+
T = !1, B(!1);
|
|
1240
1291
|
}));
|
|
1241
1292
|
}
|
|
1242
|
-
function
|
|
1243
|
-
|
|
1293
|
+
function z() {
|
|
1294
|
+
E &&= (clearTimeout(E), null);
|
|
1244
1295
|
}
|
|
1245
|
-
function
|
|
1296
|
+
function B(e, t = !1) {
|
|
1246
1297
|
let n = v;
|
|
1247
1298
|
if (!_ || !n || y || C || _.state.isLoading && !t || _.state.template?.id !== n.templateId) return;
|
|
1248
|
-
let r =
|
|
1249
|
-
if (r.length === 0)
|
|
1299
|
+
let r = it(n.view, _.content.value);
|
|
1300
|
+
if (r.length === 0) z();
|
|
1250
1301
|
else {
|
|
1251
|
-
if (!e &&
|
|
1302
|
+
if (!e && St(r)) {
|
|
1252
1303
|
let e = Date.now();
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1255
|
-
|
|
1304
|
+
if (E === null && (D = e), e - D < 1e3) {
|
|
1305
|
+
E && clearTimeout(E), E = setTimeout(() => {
|
|
1306
|
+
E = null, B(!0);
|
|
1256
1307
|
}, 300);
|
|
1257
1308
|
return;
|
|
1258
1309
|
}
|
|
1259
1310
|
}
|
|
1260
|
-
|
|
1311
|
+
z(), ce(n, r);
|
|
1261
1312
|
}
|
|
1262
1313
|
}
|
|
1263
1314
|
function V() {
|
|
1264
|
-
|
|
1315
|
+
B(!0);
|
|
1265
1316
|
}
|
|
1266
1317
|
function ce(e, t) {
|
|
1267
1318
|
let n = t, r;
|
|
1268
1319
|
try {
|
|
1269
|
-
r =
|
|
1320
|
+
r = O(e.view, n, ie());
|
|
1270
1321
|
} catch (n) {
|
|
1271
|
-
if (!(n instanceof
|
|
1272
|
-
|
|
1273
|
-
let r = n.blockId === void 0 ? void 0 :
|
|
1322
|
+
if (!(n instanceof P)) throw n;
|
|
1323
|
+
oe(e.view);
|
|
1324
|
+
let r = n.blockId === void 0 ? void 0 : ke(n.blockId).find((e) => {
|
|
1274
1325
|
let r = t[n.opIndex];
|
|
1275
1326
|
return r.op !== "updateBlockLocale" || e.locale == null || e.locale === r.locale;
|
|
1276
1327
|
})?.holder;
|
|
1277
|
-
|
|
1328
|
+
L({
|
|
1278
1329
|
type: "editRefused",
|
|
1279
1330
|
code: n.code,
|
|
1280
1331
|
...r ? { holder: r } : {}
|
|
1281
|
-
}), n.code === "invalid_operation" &&
|
|
1332
|
+
}), n.code === "invalid_operation" && I(n);
|
|
1282
1333
|
return;
|
|
1283
1334
|
}
|
|
1284
1335
|
let i = _.content.value;
|
|
1285
|
-
if (!
|
|
1286
|
-
|
|
1336
|
+
if (!G(r, i)) {
|
|
1337
|
+
I(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
|
|
1287
1338
|
op: "setContent",
|
|
1288
|
-
content:
|
|
1339
|
+
content: H(i)
|
|
1289
1340
|
}];
|
|
1290
1341
|
try {
|
|
1291
|
-
r =
|
|
1342
|
+
r = O(e.view, n, ie());
|
|
1292
1343
|
} catch (t) {
|
|
1293
|
-
if (!(t instanceof
|
|
1294
|
-
|
|
1344
|
+
if (!(t instanceof P)) throw t;
|
|
1345
|
+
oe(e.view), L({
|
|
1295
1346
|
type: "editRefused",
|
|
1296
1347
|
code: t.code
|
|
1297
1348
|
});
|
|
1298
1349
|
return;
|
|
1299
1350
|
}
|
|
1300
1351
|
}
|
|
1301
|
-
let a =
|
|
1302
|
-
|
|
1352
|
+
let a = _t({ ops: ne(e.view, n) }, r);
|
|
1353
|
+
ae(e.undo, a), e.redo = [], R();
|
|
1303
1354
|
let o = e.view;
|
|
1304
1355
|
e.view = r, le(e, n, "edit", a, o);
|
|
1305
1356
|
}
|
|
1306
1357
|
function le(e, t, n, r, i) {
|
|
1307
1358
|
let a = { dropped: !1 }, o = 0, s = i;
|
|
1308
1359
|
do {
|
|
1309
|
-
let i = t.slice(o, o +
|
|
1360
|
+
let i = t.slice(o, o + ht);
|
|
1310
1361
|
if (e.pending.push({
|
|
1311
1362
|
batchId: crypto.randomUUID(),
|
|
1312
1363
|
ops: i,
|
|
@@ -1316,42 +1367,42 @@ function Ct(e) {
|
|
|
1316
1367
|
sent: !1,
|
|
1317
1368
|
revision: null,
|
|
1318
1369
|
...s && i.some((e) => e.op === "setContent") ? { base: s } : {}
|
|
1319
|
-
}), o +=
|
|
1320
|
-
s =
|
|
1370
|
+
}), o += ht, s && t.slice(o).some((e) => e.op === "setContent")) try {
|
|
1371
|
+
s = O(s, i);
|
|
1321
1372
|
} catch {
|
|
1322
1373
|
s = null;
|
|
1323
1374
|
}
|
|
1324
1375
|
} while (o < t.length);
|
|
1325
|
-
|
|
1376
|
+
U(e);
|
|
1326
1377
|
}
|
|
1327
|
-
function
|
|
1378
|
+
function U(e) {
|
|
1328
1379
|
if (e.inFlight || w) return;
|
|
1329
1380
|
let t = e.pending.find((e) => !e.sent);
|
|
1330
|
-
t ? (t.sent = !0, e.inFlight = t,
|
|
1381
|
+
t ? (t.sent = !0, e.inFlight = t, W(e, t, 0)) : he(e);
|
|
1331
1382
|
}
|
|
1332
|
-
function
|
|
1383
|
+
function W(e, n, r) {
|
|
1333
1384
|
t.submit(e.templateId, {
|
|
1334
1385
|
batchId: n.batchId,
|
|
1335
1386
|
baseRevision: n.baseRevision ??= e.revision,
|
|
1336
1387
|
ops: n.ops,
|
|
1337
1388
|
...n.origin === "ai" ? { origin: "ai" } : {}
|
|
1338
1389
|
}).then(({ revision: t }) => {
|
|
1339
|
-
e.inFlight = null,
|
|
1390
|
+
e.inFlight = null, ue(e, n, t), U(e);
|
|
1340
1391
|
}, (t) => {
|
|
1341
|
-
if (
|
|
1342
|
-
else if (
|
|
1392
|
+
if (vt(t) !== null) e.inFlight = null, me(e, n, t), U(e);
|
|
1393
|
+
else if (bt(t)) {
|
|
1343
1394
|
K(e, t);
|
|
1344
|
-
let i =
|
|
1395
|
+
let i = pt[Math.min(r, pt.length - 1)];
|
|
1345
1396
|
setTimeout(() => {
|
|
1346
|
-
|
|
1397
|
+
k || W(e, n, r + 1);
|
|
1347
1398
|
}, i);
|
|
1348
|
-
} else e.inFlight = null,
|
|
1399
|
+
} else e.inFlight = null, I(t), me(e, n, t), U(e);
|
|
1349
1400
|
});
|
|
1350
1401
|
}
|
|
1351
|
-
function
|
|
1352
|
-
t.revision === null && (t.revision = n, n <= e.revision ? (
|
|
1402
|
+
function ue(e, t, n) {
|
|
1403
|
+
t.revision === null && (t.revision = n, n <= e.revision ? (de(e, t), ye(e)) : (e.own.set(n, t), ve(e)));
|
|
1353
1404
|
}
|
|
1354
|
-
function
|
|
1405
|
+
function de(e, t) {
|
|
1355
1406
|
e.pending = e.pending.filter((e) => e !== t), he(e);
|
|
1356
1407
|
}
|
|
1357
1408
|
function fe(e, t) {
|
|
@@ -1360,7 +1411,7 @@ function Ct(e) {
|
|
|
1360
1411
|
let e = n.indexOf(t.entry);
|
|
1361
1412
|
e !== -1 && n.splice(e, 1);
|
|
1362
1413
|
}
|
|
1363
|
-
|
|
1414
|
+
R();
|
|
1364
1415
|
}
|
|
1365
1416
|
}
|
|
1366
1417
|
function pe(e, t) {
|
|
@@ -1368,16 +1419,16 @@ function Ct(e) {
|
|
|
1368
1419
|
return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && fe(e, t), he(e), n;
|
|
1369
1420
|
}
|
|
1370
1421
|
function me(e, t, n) {
|
|
1371
|
-
if (
|
|
1372
|
-
let r =
|
|
1422
|
+
if (de(e, t), pe(e, t)) {
|
|
1423
|
+
let r = vt(n) ?? "invalid_operation";
|
|
1373
1424
|
if (t.origin === "edit" || t.origin === "ai") {
|
|
1374
|
-
let t =
|
|
1375
|
-
|
|
1425
|
+
let t = yt(n);
|
|
1426
|
+
L({
|
|
1376
1427
|
type: "editRefused",
|
|
1377
1428
|
code: r,
|
|
1378
1429
|
...t ? { holder: t } : {}
|
|
1379
1430
|
}, e);
|
|
1380
|
-
} else
|
|
1431
|
+
} else L({
|
|
1381
1432
|
type: "undoSkipped",
|
|
1382
1433
|
code: r
|
|
1383
1434
|
}, e);
|
|
@@ -1394,16 +1445,16 @@ function Ct(e) {
|
|
|
1394
1445
|
function ge(e, t) {
|
|
1395
1446
|
if (t.revision <= e.revision) return;
|
|
1396
1447
|
let n = e.pending.find((e) => e.batchId === t.batchId);
|
|
1397
|
-
n ?
|
|
1448
|
+
n ? ue(e, n, t.revision) : (e.remote.set(t.revision, t), ve(e));
|
|
1398
1449
|
}
|
|
1399
1450
|
function _e(t, n) {
|
|
1400
1451
|
let r = n.ops;
|
|
1401
1452
|
if (e.normalizeRemoteOperations) try {
|
|
1402
1453
|
r = e.normalizeRemoteOperations(n.ops, t.confirmed);
|
|
1403
1454
|
} catch (e) {
|
|
1404
|
-
|
|
1455
|
+
I(e);
|
|
1405
1456
|
}
|
|
1406
|
-
return
|
|
1457
|
+
return Ct(r);
|
|
1407
1458
|
}
|
|
1408
1459
|
function ve(t) {
|
|
1409
1460
|
let n = [], r = !1;
|
|
@@ -1411,16 +1462,16 @@ function Ct(e) {
|
|
|
1411
1462
|
let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
|
|
1412
1463
|
if (!i && !a) break;
|
|
1413
1464
|
try {
|
|
1414
|
-
t.confirmed =
|
|
1465
|
+
t.confirmed = O(t.confirmed, i ? _e(t, i) : a.ops);
|
|
1415
1466
|
} catch {
|
|
1416
1467
|
if (t.recovering) {
|
|
1417
|
-
t.remote.clear(), t.own.clear(),
|
|
1468
|
+
t.remote.clear(), t.own.clear(), I(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
|
|
1418
1469
|
return;
|
|
1419
1470
|
}
|
|
1420
|
-
|
|
1471
|
+
Ce(t);
|
|
1421
1472
|
return;
|
|
1422
1473
|
}
|
|
1423
|
-
t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0),
|
|
1474
|
+
t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), de(t, a));
|
|
1424
1475
|
}
|
|
1425
1476
|
if (t === v && (m.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? xe(t) : Se(t), (n.length !== 0 || r) && (ye(t), t === v)) for (let t of n) try {
|
|
1426
1477
|
e.onRemoteChange?.({
|
|
@@ -1429,7 +1480,7 @@ function Ct(e) {
|
|
|
1429
1480
|
locale: t.ops.find((e) => e.op !== "setDefaultLocale" && "locale" in e)?.locale ?? null
|
|
1430
1481
|
});
|
|
1431
1482
|
} catch (e) {
|
|
1432
|
-
|
|
1483
|
+
I(e);
|
|
1433
1484
|
}
|
|
1434
1485
|
}
|
|
1435
1486
|
function ye(e) {
|
|
@@ -1440,21 +1491,21 @@ function Ct(e) {
|
|
|
1440
1491
|
} finally {
|
|
1441
1492
|
t && (w = !1);
|
|
1442
1493
|
}
|
|
1443
|
-
t &&
|
|
1494
|
+
t && U(e);
|
|
1444
1495
|
}
|
|
1445
1496
|
function be(e) {
|
|
1446
1497
|
e === v && V();
|
|
1447
1498
|
let t = e.confirmed;
|
|
1448
1499
|
for (let n = 0; n < e.pending.length; n++) {
|
|
1449
1500
|
let r = e.pending[n], i;
|
|
1450
|
-
if (r.base && !
|
|
1501
|
+
if (r.base && !G(r.base, t)) i = "precondition_failed";
|
|
1451
1502
|
else try {
|
|
1452
|
-
t =
|
|
1503
|
+
t = O(t, r.ops);
|
|
1453
1504
|
continue;
|
|
1454
1505
|
} catch (e) {
|
|
1455
|
-
i = e instanceof
|
|
1506
|
+
i = e instanceof P ? e.code : "invalid_operation";
|
|
1456
1507
|
}
|
|
1457
|
-
r.sent || (pe(e, r) &&
|
|
1508
|
+
r.sent || (pe(e, r) && L(r.origin === "edit" || r.origin === "ai" ? {
|
|
1458
1509
|
type: "editRefused",
|
|
1459
1510
|
code: i
|
|
1460
1511
|
} : {
|
|
@@ -1462,12 +1513,12 @@ function Ct(e) {
|
|
|
1462
1513
|
code: i
|
|
1463
1514
|
}, e), t = e.confirmed, n = -1);
|
|
1464
1515
|
}
|
|
1465
|
-
e.view = t, he(e), e === v &&
|
|
1516
|
+
e.view = t, he(e), e === v && oe(t);
|
|
1466
1517
|
}
|
|
1467
1518
|
function xe(e) {
|
|
1468
1519
|
e.gapTimer ||= setTimeout(() => {
|
|
1469
1520
|
e.gapTimer = null, e === v && q();
|
|
1470
|
-
},
|
|
1521
|
+
}, dt);
|
|
1471
1522
|
}
|
|
1472
1523
|
function Se(e) {
|
|
1473
1524
|
e.gapTimer &&= (clearTimeout(e.gapTimer), null);
|
|
@@ -1479,33 +1530,33 @@ function Ct(e) {
|
|
|
1479
1530
|
let n = await t.operationsAfter(e.templateId, e.revision);
|
|
1480
1531
|
if (e.retired) return;
|
|
1481
1532
|
if ("resync" in n) {
|
|
1482
|
-
await
|
|
1533
|
+
await Ce(e);
|
|
1483
1534
|
return;
|
|
1484
1535
|
}
|
|
1485
1536
|
for (let t of n.batches) ge(e, t);
|
|
1486
1537
|
} catch (e) {
|
|
1487
|
-
|
|
1538
|
+
I(e);
|
|
1488
1539
|
} finally {
|
|
1489
1540
|
e.catchingUp = null;
|
|
1490
1541
|
}
|
|
1491
1542
|
})(), e.catchingUp) : Promise.resolve();
|
|
1492
1543
|
}
|
|
1493
|
-
async function
|
|
1544
|
+
async function Ce(t) {
|
|
1494
1545
|
t.recovering = !0;
|
|
1495
1546
|
try {
|
|
1496
1547
|
let n = await e.loadTemplate(t.templateId);
|
|
1497
1548
|
if (t.retired) return;
|
|
1498
1549
|
let r = n.revision ?? t.revision;
|
|
1499
|
-
t.confirmed =
|
|
1500
|
-
for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e),
|
|
1550
|
+
t.confirmed = H(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
|
|
1551
|
+
for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), de(t, n));
|
|
1501
1552
|
t === v && (m.value = r), ye(t), ve(t);
|
|
1502
1553
|
} catch (e) {
|
|
1503
|
-
|
|
1554
|
+
I(e);
|
|
1504
1555
|
} finally {
|
|
1505
1556
|
t.recovering = !1;
|
|
1506
1557
|
}
|
|
1507
1558
|
}
|
|
1508
|
-
function
|
|
1559
|
+
function J(t) {
|
|
1509
1560
|
let n = () => t === v && !t.retired;
|
|
1510
1561
|
return {
|
|
1511
1562
|
onBatch: (e) => {
|
|
@@ -1519,13 +1570,13 @@ function Ct(e) {
|
|
|
1519
1570
|
actor: i
|
|
1520
1571
|
});
|
|
1521
1572
|
} catch (e) {
|
|
1522
|
-
|
|
1573
|
+
I(e);
|
|
1523
1574
|
}
|
|
1524
1575
|
q();
|
|
1525
1576
|
}
|
|
1526
1577
|
},
|
|
1527
1578
|
onLock: (e) => {
|
|
1528
|
-
n() &&
|
|
1579
|
+
n() && je(e);
|
|
1529
1580
|
},
|
|
1530
1581
|
onUnlock: (e, t, r) => {
|
|
1531
1582
|
n() && Me(e, t, r);
|
|
@@ -1534,23 +1585,23 @@ function Ct(e) {
|
|
|
1534
1585
|
n() && Z(e);
|
|
1535
1586
|
},
|
|
1536
1587
|
onConnectionChange: (e) => {
|
|
1537
|
-
n() &&
|
|
1588
|
+
n() && X(t, e);
|
|
1538
1589
|
}
|
|
1539
1590
|
};
|
|
1540
1591
|
}
|
|
1541
|
-
function
|
|
1592
|
+
function Y(e, r) {
|
|
1542
1593
|
let i = d;
|
|
1543
|
-
t.join(e.templateId, { sessionId: n },
|
|
1544
|
-
e.retired || e !== v ? r || t.leave() : (e.leave = t.leave, Ne(t.locks, !r, i), Z(t.members), t.members.length > 0 && (p.value = "connected"), t.revision > e.revision && q(), r &&
|
|
1545
|
-
}, (e) =>
|
|
1594
|
+
t.join(e.templateId, { sessionId: n }, J(e)).then((t) => {
|
|
1595
|
+
e.retired || e !== v ? r || t.leave() : (e.leave = t.leave, Ne(t.locks, !r, i), Z(t.members), t.members.length > 0 && (p.value = "connected"), t.revision > e.revision && q(), r && Pe());
|
|
1596
|
+
}, (e) => I(e));
|
|
1546
1597
|
}
|
|
1547
|
-
function
|
|
1548
|
-
let t =
|
|
1598
|
+
function we(e) {
|
|
1599
|
+
let t = H(e.content), n = {
|
|
1549
1600
|
templateId: e.id,
|
|
1550
1601
|
confirmed: t,
|
|
1551
1602
|
revision: e.revision ?? 0,
|
|
1552
1603
|
pending: [],
|
|
1553
|
-
view:
|
|
1604
|
+
view: H(t),
|
|
1554
1605
|
remote: /* @__PURE__ */ new Map(),
|
|
1555
1606
|
own: /* @__PURE__ */ new Map(),
|
|
1556
1607
|
inFlight: null,
|
|
@@ -1563,49 +1614,49 @@ function Ct(e) {
|
|
|
1563
1614
|
redo: [],
|
|
1564
1615
|
waiters: []
|
|
1565
1616
|
};
|
|
1566
|
-
v = n, m.value = n.revision,
|
|
1617
|
+
v = n, m.value = n.revision, R(), Y(n, !1), _?.state.selectedBlockId && ze(_.state.selectedBlockId), se();
|
|
1567
1618
|
}
|
|
1568
|
-
function
|
|
1619
|
+
function Te(e) {
|
|
1569
1620
|
e.retired = !0, Se(e), e.leave?.(), e.leave = null, K(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
|
|
1570
1621
|
}
|
|
1571
|
-
function
|
|
1622
|
+
function X(e, t) {
|
|
1572
1623
|
let n = p.value;
|
|
1573
|
-
p.value = t, t === "connected" && n !== null && n !== "connected" &&
|
|
1624
|
+
p.value = t, t === "connected" && n !== null && n !== "connected" && Y(e, !0);
|
|
1574
1625
|
}
|
|
1575
|
-
function
|
|
1576
|
-
v && v.templateId === e?.id || (v &&= (
|
|
1626
|
+
function Ee(e) {
|
|
1627
|
+
v && v.templateId === e?.id || (v &&= (z(), Te(v), null), a.value = [], s.value = /* @__PURE__ */ new Map(), p.value = null, A = null, Pe(), R(), e && we(e));
|
|
1577
1628
|
}
|
|
1578
|
-
function
|
|
1629
|
+
function De(e, t) {
|
|
1579
1630
|
return `${e}\u0000${t ?? ""}`;
|
|
1580
1631
|
}
|
|
1581
|
-
function
|
|
1632
|
+
function Oe(e, t, n) {
|
|
1582
1633
|
return e.blockId === t && (n == null || e.locale == null || e.locale === n);
|
|
1583
1634
|
}
|
|
1584
|
-
function
|
|
1635
|
+
function ke(e) {
|
|
1585
1636
|
return [...s.value.values()].filter((t) => t.blockId === e);
|
|
1586
1637
|
}
|
|
1587
|
-
function
|
|
1638
|
+
function Ae(e) {
|
|
1588
1639
|
e !== f.value && (V(), f.value = e, ze(_?.state.selectedBlockId ?? null));
|
|
1589
1640
|
}
|
|
1590
|
-
function
|
|
1641
|
+
function je(e, t = !1) {
|
|
1591
1642
|
if (e.holder.sessionId === n) return;
|
|
1592
1643
|
t ? l.add(e) : u.set(e, ++d);
|
|
1593
1644
|
let r = new Map([...s.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
|
|
1594
|
-
r.set(
|
|
1645
|
+
r.set(De(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), L({
|
|
1595
1646
|
type: "selectionRefused",
|
|
1596
1647
|
blockId: e.blockId,
|
|
1597
1648
|
holder: e.holder
|
|
1598
1649
|
}));
|
|
1599
1650
|
}
|
|
1600
1651
|
function Me(e, t, n) {
|
|
1601
|
-
let r =
|
|
1652
|
+
let r = De(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && l.has(i))));
|
|
1602
1653
|
i.size !== s.value.size && (s.value = i);
|
|
1603
1654
|
}
|
|
1604
1655
|
function Ne(e, t, r) {
|
|
1605
1656
|
let i = new Map([...s.value].filter(([, e]) => !l.has(e) && (t || (u.get(e) ?? 0) > r))), a = [...i.values()];
|
|
1606
|
-
for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId ||
|
|
1657
|
+
for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || Oe(e, t.blockId, t.locale))) {
|
|
1607
1658
|
for (let [e, n] of i) n.holder.sessionId === t.holder.sessionId && i.delete(e);
|
|
1608
|
-
i.set(
|
|
1659
|
+
i.set(De(t.blockId, t.locale), t);
|
|
1609
1660
|
}
|
|
1610
1661
|
s.value = i;
|
|
1611
1662
|
}
|
|
@@ -1615,11 +1666,11 @@ function Ct(e) {
|
|
|
1615
1666
|
let r = new Map([...s.value].filter(([, e]) => !n.has(e.holder.sessionId)));
|
|
1616
1667
|
r.size !== s.value.size && (s.value = r);
|
|
1617
1668
|
}
|
|
1618
|
-
function
|
|
1619
|
-
|
|
1669
|
+
function Q(e) {
|
|
1670
|
+
M = M.then(e).catch(I);
|
|
1620
1671
|
}
|
|
1621
|
-
function
|
|
1622
|
-
i &&
|
|
1672
|
+
function Pe() {
|
|
1673
|
+
i && Q(async () => {
|
|
1623
1674
|
if (j && (A === null || j.templateId !== A.templateId || j.locale !== A.locale)) {
|
|
1624
1675
|
let e = j;
|
|
1625
1676
|
j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale);
|
|
@@ -1639,38 +1690,38 @@ function Ct(e) {
|
|
|
1639
1690
|
});
|
|
1640
1691
|
}
|
|
1641
1692
|
function Fe(e, t) {
|
|
1642
|
-
let n = new Map([...s.value].filter(([, n]) => !
|
|
1693
|
+
let n = new Map([...s.value].filter(([, n]) => !Oe(n, e, t)));
|
|
1643
1694
|
n.size !== s.value.size && (s.value = n);
|
|
1644
1695
|
}
|
|
1645
1696
|
function Ie(e, t) {
|
|
1646
|
-
let n =
|
|
1697
|
+
let n = vt(t);
|
|
1647
1698
|
if (n === "lock_held" || n === "block_missing") {
|
|
1648
1699
|
A = null;
|
|
1649
|
-
let n =
|
|
1650
|
-
n ?
|
|
1700
|
+
let n = yt(t);
|
|
1701
|
+
n ? je({
|
|
1651
1702
|
blockId: e,
|
|
1652
1703
|
holder: n,
|
|
1653
1704
|
expiresAt: ""
|
|
1654
1705
|
}, !0) : _?.state.selectedBlockId === e && _.selectBlock(null);
|
|
1655
|
-
} else
|
|
1656
|
-
A?.blockId === e &&
|
|
1657
|
-
},
|
|
1706
|
+
} else I(t), setTimeout(() => {
|
|
1707
|
+
A?.blockId === e && Pe();
|
|
1708
|
+
}, pt[0]);
|
|
1658
1709
|
}
|
|
1659
1710
|
function Le() {
|
|
1660
1711
|
N ||= setInterval(() => {
|
|
1661
|
-
|
|
1712
|
+
Q(async () => {
|
|
1662
1713
|
let e = j;
|
|
1663
1714
|
if (e) try {
|
|
1664
1715
|
await t.renewLock(e.templateId, e.blockId, e.locale);
|
|
1665
1716
|
} catch (e) {
|
|
1666
|
-
if (
|
|
1667
|
-
j = null, Re(),
|
|
1717
|
+
if (vt(e) === "lock_lost") {
|
|
1718
|
+
j = null, Re(), Pe();
|
|
1668
1719
|
return;
|
|
1669
1720
|
}
|
|
1670
|
-
|
|
1721
|
+
I(e);
|
|
1671
1722
|
}
|
|
1672
1723
|
});
|
|
1673
|
-
},
|
|
1724
|
+
}, ft);
|
|
1674
1725
|
}
|
|
1675
1726
|
function Re() {
|
|
1676
1727
|
N &&= (clearInterval(N), null);
|
|
@@ -1680,7 +1731,7 @@ function Ct(e) {
|
|
|
1680
1731
|
templateId: v.templateId,
|
|
1681
1732
|
blockId: e,
|
|
1682
1733
|
locale: f.value
|
|
1683
|
-
} : null,
|
|
1734
|
+
} : null, Pe());
|
|
1684
1735
|
}
|
|
1685
1736
|
function Be() {
|
|
1686
1737
|
V(), j && i && (t.releaseLock(j.templateId, j.blockId, j.locale).catch(() => {}), j = null, Re()), v?.leave?.(), v && (v.leave = null);
|
|
@@ -1691,8 +1742,8 @@ function Ct(e) {
|
|
|
1691
1742
|
V();
|
|
1692
1743
|
let n = (e === "undo" ? t.undo : t.redo).pop();
|
|
1693
1744
|
if (!n) return;
|
|
1694
|
-
if (
|
|
1695
|
-
|
|
1745
|
+
if (R(), n.view && !G(n.view, t.view)) {
|
|
1746
|
+
L({
|
|
1696
1747
|
type: "undoSkipped",
|
|
1697
1748
|
code: "precondition_failed"
|
|
1698
1749
|
});
|
|
@@ -1700,30 +1751,30 @@ function Ct(e) {
|
|
|
1700
1751
|
}
|
|
1701
1752
|
let r;
|
|
1702
1753
|
try {
|
|
1703
|
-
r =
|
|
1754
|
+
r = O(t.view, n.ops, ie());
|
|
1704
1755
|
} catch (e) {
|
|
1705
|
-
if (!(e instanceof
|
|
1706
|
-
|
|
1756
|
+
if (!(e instanceof P)) throw e;
|
|
1757
|
+
L({
|
|
1707
1758
|
type: "undoSkipped",
|
|
1708
1759
|
code: e.code
|
|
1709
1760
|
});
|
|
1710
1761
|
return;
|
|
1711
1762
|
}
|
|
1712
|
-
let i =
|
|
1713
|
-
|
|
1763
|
+
let i = _t({ ops: ne(t.view, n.ops) }, r);
|
|
1764
|
+
ae(e === "undo" ? t.redo : t.undo, i);
|
|
1714
1765
|
let a = t.view;
|
|
1715
|
-
t.view = r,
|
|
1766
|
+
t.view = r, oe(r), _?.markDirty(), le(t, n.ops, e, i, a);
|
|
1716
1767
|
}
|
|
1717
1768
|
function He(e, t) {
|
|
1718
1769
|
let n = v;
|
|
1719
1770
|
if (!_ || !n || y) return {
|
|
1720
1771
|
applied: !1,
|
|
1721
|
-
error: new
|
|
1772
|
+
error: new P("invalid_operation", 0, "No template is open for editing.")
|
|
1722
1773
|
};
|
|
1723
1774
|
if (t.origin === void 0) try {
|
|
1724
|
-
|
|
1775
|
+
O(_.content.value, e, ie());
|
|
1725
1776
|
} catch (e) {
|
|
1726
|
-
if (e instanceof
|
|
1777
|
+
if (e instanceof P) return {
|
|
1727
1778
|
applied: !1,
|
|
1728
1779
|
error: e
|
|
1729
1780
|
};
|
|
@@ -1732,9 +1783,9 @@ function Ct(e) {
|
|
|
1732
1783
|
V();
|
|
1733
1784
|
let r, i;
|
|
1734
1785
|
try {
|
|
1735
|
-
r =
|
|
1786
|
+
r = O(n.view, e, ie()), i = ne(n.view, e);
|
|
1736
1787
|
} catch (e) {
|
|
1737
|
-
if (e instanceof
|
|
1788
|
+
if (e instanceof P) return {
|
|
1738
1789
|
applied: !1,
|
|
1739
1790
|
error: e
|
|
1740
1791
|
};
|
|
@@ -1742,15 +1793,15 @@ function Ct(e) {
|
|
|
1742
1793
|
}
|
|
1743
1794
|
let a = n.undo.at(-1), o;
|
|
1744
1795
|
if (t.origin === "ai" && t.turn !== void 0 && a && a.turn === t.turn) {
|
|
1745
|
-
let e = a.view !== void 0 && !
|
|
1746
|
-
a.ops = [...i, ...a.ops], o = e ? a :
|
|
1747
|
-
} else o =
|
|
1796
|
+
let e = a.view !== void 0 && !G(a.view, n.view);
|
|
1797
|
+
a.ops = [...i, ...a.ops], o = e ? a : _t(a, r);
|
|
1798
|
+
} else o = _t({
|
|
1748
1799
|
ops: i,
|
|
1749
1800
|
...t.origin === "ai" && t.turn !== void 0 ? { turn: t.turn } : {}
|
|
1750
|
-
}, r),
|
|
1751
|
-
n.redo = [],
|
|
1801
|
+
}, r), ae(n.undo, o);
|
|
1802
|
+
n.redo = [], R();
|
|
1752
1803
|
let s = n.view;
|
|
1753
|
-
return n.view = r,
|
|
1804
|
+
return n.view = r, oe(r), _.markDirty(), le(n, e, t.origin ?? "edit", o, s), {
|
|
1754
1805
|
applied: !0,
|
|
1755
1806
|
inverse: i
|
|
1756
1807
|
};
|
|
@@ -1761,7 +1812,7 @@ function Ct(e) {
|
|
|
1761
1812
|
if (t.moveBlock && t.findBlockLocation) {
|
|
1762
1813
|
let n = t.moveBlock, r = (...r) => {
|
|
1763
1814
|
let i = v, a = i && !y && !C && !e.state.isLoading && e.state.template?.id === i.templateId;
|
|
1764
|
-
if (a &&
|
|
1815
|
+
if (a && B(!0), n(...r), !a || G(i.view, e.content.value)) return;
|
|
1765
1816
|
let o = t.findBlockLocation(r[0]);
|
|
1766
1817
|
if (!o) return;
|
|
1767
1818
|
let s = o.targetSectionId ? {
|
|
@@ -1775,11 +1826,11 @@ function Ct(e) {
|
|
|
1775
1826
|
after: (s && c?.type === "section" ? c.children[s.column] : e.content.value.blocks)[o.index - 1]?.id ?? null
|
|
1776
1827
|
}]);
|
|
1777
1828
|
};
|
|
1778
|
-
t.moveBlock = r,
|
|
1829
|
+
t.moveBlock = r, ee.push(() => {
|
|
1779
1830
|
t.moveBlock === r && (t.moveBlock = n);
|
|
1780
1831
|
});
|
|
1781
1832
|
}
|
|
1782
|
-
|
|
1833
|
+
ee.push(h(() => e.state.template, (e) => Ee(e), { immediate: !0 }), h(() => e.content.value, se, { deep: !0 }), h(() => e.state.selectedBlockId, ze), h(() => e.state.isLoading, (e) => e ? B(!0, !0) : se())), typeof window < "u" && (window.addEventListener("pagehide", Be), window.addEventListener("blur", V)), c() && o(qe);
|
|
1783
1834
|
}
|
|
1784
1835
|
function We() {
|
|
1785
1836
|
V();
|
|
@@ -1793,44 +1844,44 @@ function Ct(e) {
|
|
|
1793
1844
|
V(), y = !0;
|
|
1794
1845
|
}
|
|
1795
1846
|
function Ke() {
|
|
1796
|
-
y = !1, v &&
|
|
1847
|
+
y = !1, v && oe(v.view);
|
|
1797
1848
|
}
|
|
1798
1849
|
function qe() {
|
|
1799
|
-
if (!
|
|
1850
|
+
if (!k) {
|
|
1800
1851
|
V();
|
|
1801
|
-
for (let e of
|
|
1802
|
-
|
|
1852
|
+
for (let e of ee.splice(0)) e();
|
|
1853
|
+
z(), Be(), k = !0, v && Te(v), v = null, Re(), typeof window < "u" && (window.removeEventListener("pagehide", Be), window.removeEventListener("blur", V));
|
|
1803
1854
|
}
|
|
1804
1855
|
}
|
|
1805
1856
|
return {
|
|
1806
1857
|
sessionId: n,
|
|
1807
1858
|
members: a,
|
|
1808
1859
|
locks: s,
|
|
1809
|
-
locksOf:
|
|
1860
|
+
locksOf: ke,
|
|
1810
1861
|
lockLocale: f,
|
|
1811
|
-
setLockLocale:
|
|
1862
|
+
setLockLocale: Ae,
|
|
1812
1863
|
connection: p,
|
|
1813
1864
|
revision: m,
|
|
1814
|
-
canUndo:
|
|
1815
|
-
canRedo:
|
|
1865
|
+
canUndo: F,
|
|
1866
|
+
canRedo: re,
|
|
1816
1867
|
attach: Ue,
|
|
1817
1868
|
undo: () => Ve("undo"),
|
|
1818
1869
|
redo: () => Ve("redo"),
|
|
1819
1870
|
clearHistory: () => {
|
|
1820
|
-
v && (v.undo = [], v.redo = [],
|
|
1871
|
+
v && (v.undo = [], v.redo = [], R());
|
|
1821
1872
|
},
|
|
1822
1873
|
flush: V,
|
|
1823
1874
|
settle: We,
|
|
1824
1875
|
suspend: Ge,
|
|
1825
1876
|
resume: Ke,
|
|
1826
1877
|
catchUp: q,
|
|
1827
|
-
hasConfirmedBlock: (e) => v ?
|
|
1878
|
+
hasConfirmedBlock: (e) => v ? xt(v.confirmed.blocks, e) : !1,
|
|
1828
1879
|
applyOperations: He,
|
|
1829
1880
|
destroy: qe
|
|
1830
1881
|
};
|
|
1831
1882
|
}
|
|
1832
1883
|
// ../core/src/saved-blocks.ts
|
|
1833
|
-
function
|
|
1884
|
+
function Tt(e) {
|
|
1834
1885
|
let { provider: t } = e, n = S([]), r = S(!1), i = v(() => {
|
|
1835
1886
|
let e = /* @__PURE__ */ new Set();
|
|
1836
1887
|
for (let t of n.value) {
|
|
@@ -1849,7 +1900,7 @@ function wt(e) {
|
|
|
1849
1900
|
throw new W(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
|
|
1850
1901
|
}
|
|
1851
1902
|
function d(t) {
|
|
1852
|
-
|
|
1903
|
+
Fe(e.onError, t);
|
|
1853
1904
|
}
|
|
1854
1905
|
async function f(i) {
|
|
1855
1906
|
r.value = !0;
|
|
@@ -1917,9 +1968,9 @@ function wt(e) {
|
|
|
1917
1968
|
};
|
|
1918
1969
|
}
|
|
1919
1970
|
// ../core/src/saved-blocks-local.ts
|
|
1920
|
-
var
|
|
1921
|
-
function
|
|
1922
|
-
let t = e.key ??
|
|
1971
|
+
var Et = "templatical:saved-blocks";
|
|
1972
|
+
function Dt(e = {}) {
|
|
1973
|
+
let t = e.key ?? Et;
|
|
1923
1974
|
function n() {
|
|
1924
1975
|
if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageSavedBlocksProvider requires a browser environment with localStorage. Supply your own SavedBlocksProvider for server-side or non-browser use.");
|
|
1925
1976
|
return localStorage;
|
|
@@ -1944,7 +1995,7 @@ function Et(e = {}) {
|
|
|
1944
1995
|
},
|
|
1945
1996
|
async create(e) {
|
|
1946
1997
|
let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
|
|
1947
|
-
id:
|
|
1998
|
+
id: j(),
|
|
1948
1999
|
name: e.name,
|
|
1949
2000
|
content: e.content,
|
|
1950
2001
|
...e.category ? { category: e.category } : {},
|
|
@@ -1971,9 +2022,9 @@ function Et(e = {}) {
|
|
|
1971
2022
|
};
|
|
1972
2023
|
}
|
|
1973
2024
|
// ../core/src/media-local.ts
|
|
1974
|
-
var
|
|
1975
|
-
function
|
|
1976
|
-
let t = e.key ??
|
|
2025
|
+
var Ot = "templatical:media", kt = 50;
|
|
2026
|
+
function At(e = {}) {
|
|
2027
|
+
let t = e.key ?? Ot;
|
|
1977
2028
|
function n() {
|
|
1978
2029
|
if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with localStorage. Supply your own MediaProvider for server-side or non-browser use.");
|
|
1979
2030
|
return localStorage;
|
|
@@ -2006,12 +2057,12 @@ function kt(e = {}) {
|
|
|
2006
2057
|
let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
|
|
2007
2058
|
let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
|
|
2008
2059
|
return t.includes(n) || r.includes(n);
|
|
2009
|
-
}) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o +
|
|
2060
|
+
}) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + kt), c = { items: s }, l = o + s.length;
|
|
2010
2061
|
return l < i.length && (c.nextCursor = String(l)), c;
|
|
2011
2062
|
},
|
|
2012
2063
|
async create(e) {
|
|
2013
2064
|
let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
2014
|
-
id:
|
|
2065
|
+
id: j(),
|
|
2015
2066
|
url: t,
|
|
2016
2067
|
filename: e.filename || e.file.name,
|
|
2017
2068
|
createdAt: n,
|
|
@@ -2047,7 +2098,7 @@ function kt(e = {}) {
|
|
|
2047
2098
|
};
|
|
2048
2099
|
}
|
|
2049
2100
|
// ../core/src/version-history.ts
|
|
2050
|
-
function
|
|
2101
|
+
function jt(e) {
|
|
2051
2102
|
let { provider: t, getTemplateId: n } = e, r = S([]), i = S(!1), a = S(void 0), o = S(!1), s = /* @__PURE__ */ new Map(), c = v(() => typeof t.create == "function"), l = v(() => typeof t.restore == "function");
|
|
2052
2103
|
function u(e) {
|
|
2053
2104
|
let t = n();
|
|
@@ -2058,7 +2109,7 @@ function At(e) {
|
|
|
2058
2109
|
throw new W(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
|
|
2059
2110
|
}
|
|
2060
2111
|
function f(t) {
|
|
2061
|
-
|
|
2112
|
+
Fe(e.onError, t);
|
|
2062
2113
|
}
|
|
2063
2114
|
async function p(n) {
|
|
2064
2115
|
let o = u("list");
|
|
@@ -2126,7 +2177,7 @@ function At(e) {
|
|
|
2126
2177
|
};
|
|
2127
2178
|
}
|
|
2128
2179
|
// ../core/src/comments.ts
|
|
2129
|
-
function
|
|
2180
|
+
function Mt(e) {
|
|
2130
2181
|
let { provider: t, getTemplateId: n, getUser: r } = e, i = S([]), a = S(!1), o = S(!1), s = v(() => typeof t.create == "function"), c = v(() => typeof t.update == "function"), l = v(() => typeof t.delete == "function"), u = v(() => typeof t.setResolved == "function"), d = v(() => i.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), f = v(() => i.value.filter((e) => !e.resolvedAt).length), p = v(() => {
|
|
2131
2182
|
let e = /* @__PURE__ */ new Map();
|
|
2132
2183
|
for (let t of i.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
|
|
@@ -2161,7 +2212,7 @@ function jt(e) {
|
|
|
2161
2212
|
throw e.onError?.(n), n;
|
|
2162
2213
|
}
|
|
2163
2214
|
function x(t) {
|
|
2164
|
-
|
|
2215
|
+
Fe(e.onError, t);
|
|
2165
2216
|
}
|
|
2166
2217
|
function C(e, t, n) {
|
|
2167
2218
|
return [
|
|
@@ -2225,7 +2276,7 @@ function jt(e) {
|
|
|
2225
2276
|
o.value = !1;
|
|
2226
2277
|
}
|
|
2227
2278
|
}
|
|
2228
|
-
async function
|
|
2279
|
+
async function k(e, n) {
|
|
2229
2280
|
let { update: r } = t;
|
|
2230
2281
|
typeof r != "function" && g("update");
|
|
2231
2282
|
let i = m("update");
|
|
@@ -2239,7 +2290,7 @@ function jt(e) {
|
|
|
2239
2290
|
o.value = !1;
|
|
2240
2291
|
}
|
|
2241
2292
|
}
|
|
2242
|
-
async function
|
|
2293
|
+
async function ee(e) {
|
|
2243
2294
|
let { delete: n } = t;
|
|
2244
2295
|
typeof n != "function" && g("delete");
|
|
2245
2296
|
let r = m("delete");
|
|
@@ -2254,7 +2305,7 @@ function jt(e) {
|
|
|
2254
2305
|
o.value = !1;
|
|
2255
2306
|
}
|
|
2256
2307
|
}
|
|
2257
|
-
async function
|
|
2308
|
+
async function A(e, n) {
|
|
2258
2309
|
let { setResolved: r } = t;
|
|
2259
2310
|
typeof r != "function" && g("setResolved");
|
|
2260
2311
|
let i = m("setResolved");
|
|
@@ -2268,13 +2319,13 @@ function jt(e) {
|
|
|
2268
2319
|
o.value = !1;
|
|
2269
2320
|
}
|
|
2270
2321
|
}
|
|
2271
|
-
function
|
|
2322
|
+
function j(e) {
|
|
2272
2323
|
T(e) && x(() => t.onCreated?.(e, { origin: "remote" }));
|
|
2273
2324
|
}
|
|
2274
|
-
function
|
|
2325
|
+
function te(e) {
|
|
2275
2326
|
T(e) && x(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
|
|
2276
2327
|
}
|
|
2277
|
-
function
|
|
2328
|
+
function M(e, n) {
|
|
2278
2329
|
let r = E(e, n);
|
|
2279
2330
|
r && x(() => t.onDeleted?.(r, { origin: "remote" }));
|
|
2280
2331
|
}
|
|
@@ -2291,17 +2342,17 @@ function jt(e) {
|
|
|
2291
2342
|
commentCountByBlock: p,
|
|
2292
2343
|
load: D,
|
|
2293
2344
|
create: O,
|
|
2294
|
-
update:
|
|
2295
|
-
remove:
|
|
2296
|
-
setResolved:
|
|
2345
|
+
update: k,
|
|
2346
|
+
remove: ee,
|
|
2347
|
+
setResolved: A,
|
|
2297
2348
|
find: _,
|
|
2298
2349
|
isOwn: y,
|
|
2299
|
-
applyRemoteCreate:
|
|
2300
|
-
applyRemoteUpdate:
|
|
2301
|
-
applyRemoteDelete:
|
|
2350
|
+
applyRemoteCreate: j,
|
|
2351
|
+
applyRemoteUpdate: te,
|
|
2352
|
+
applyRemoteDelete: M
|
|
2302
2353
|
};
|
|
2303
2354
|
}
|
|
2304
|
-
function
|
|
2355
|
+
function Nt(e) {
|
|
2305
2356
|
let { comments: t, provider: n, getTemplateId: i } = e, { subscribe: a } = n;
|
|
2306
2357
|
if (typeof a != "function") return;
|
|
2307
2358
|
let s = null;
|
|
@@ -2323,9 +2374,9 @@ function Mt(e) {
|
|
|
2323
2374
|
}, { immediate: !0 }), o(c);
|
|
2324
2375
|
}
|
|
2325
2376
|
// src/constants/timeouts.ts
|
|
2326
|
-
var
|
|
2377
|
+
var Pt = 1e4;
|
|
2327
2378
|
// src/composables/useImageUrlResolver.ts
|
|
2328
|
-
function
|
|
2379
|
+
function Ft(t) {
|
|
2329
2380
|
let n = e(/* @__PURE__ */ new Map()), r = /* @__PURE__ */ new Set();
|
|
2330
2381
|
function i(e) {
|
|
2331
2382
|
return n.get(e);
|
|
@@ -2354,8 +2405,8 @@ function Pt(t) {
|
|
|
2354
2405
|
lookup: o
|
|
2355
2406
|
};
|
|
2356
2407
|
}
|
|
2357
|
-
function
|
|
2358
|
-
let t = a(
|
|
2408
|
+
function It(e) {
|
|
2409
|
+
let t = a(ve, null), n = v(e);
|
|
2359
2410
|
if (!t) return n;
|
|
2360
2411
|
let i;
|
|
2361
2412
|
function s() {
|
|
@@ -2376,37 +2427,37 @@ function Ft(e) {
|
|
|
2376
2427
|
return typeof r == "string" && r.length > 0 ? r : e;
|
|
2377
2428
|
});
|
|
2378
2429
|
}
|
|
2379
|
-
function
|
|
2430
|
+
function Lt(e, t) {
|
|
2380
2431
|
if (!e || !t) return t;
|
|
2381
2432
|
let n = e.get(t);
|
|
2382
2433
|
return typeof n == "string" && n.length > 0 ? n : t;
|
|
2383
2434
|
}
|
|
2384
|
-
function Lt(e, t) {
|
|
2385
|
-
return typeof e?.url == "string" && F(e.url, t);
|
|
2386
|
-
}
|
|
2387
2435
|
function Rt(e, t) {
|
|
2436
|
+
return typeof e?.url == "string" && L(e.url, t);
|
|
2437
|
+
}
|
|
2438
|
+
function zt(e, t) {
|
|
2388
2439
|
let n = e?.url;
|
|
2389
|
-
if (typeof n == "string" && n.trim() !== "") return
|
|
2440
|
+
if (typeof n == "string" && n.trim() !== "") return L(n, t) ? void 0 : n;
|
|
2390
2441
|
}
|
|
2391
|
-
function
|
|
2392
|
-
let t = a(
|
|
2393
|
-
return v(() =>
|
|
2442
|
+
function Bt(e) {
|
|
2443
|
+
let t = a(_e, ee.liquid), n = It(() => zt(e(), t));
|
|
2444
|
+
return v(() => Rt(e(), t) ? null : n.value);
|
|
2394
2445
|
}
|
|
2395
|
-
function
|
|
2396
|
-
return
|
|
2446
|
+
function Vt(e, t, n) {
|
|
2447
|
+
return Rt(t, n) ? null : Lt(e, zt(t, n));
|
|
2397
2448
|
}
|
|
2398
2449
|
// src/utils/blockTypeLabels.ts
|
|
2399
|
-
function
|
|
2450
|
+
function Ht(e, t) {
|
|
2400
2451
|
return t.blocks[e] ?? e;
|
|
2401
2452
|
}
|
|
2402
|
-
function
|
|
2403
|
-
if (e.type !== "custom") return
|
|
2453
|
+
function Ut(e, t, n = []) {
|
|
2454
|
+
if (e.type !== "custom") return Ht(e.type, t);
|
|
2404
2455
|
let { customType: r } = e;
|
|
2405
2456
|
return n.find((e) => e.type === r)?.name ?? r;
|
|
2406
2457
|
}
|
|
2407
2458
|
// src/utils/resolveFieldColors.ts
|
|
2408
|
-
function
|
|
2409
|
-
let n =
|
|
2459
|
+
function Wt(e, t) {
|
|
2460
|
+
let n = q({ presets: e.presets }, Ce), r = n.presets.length === 0;
|
|
2410
2461
|
return {
|
|
2411
2462
|
presets: r ? t.presets : n.presets,
|
|
2412
2463
|
allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
|
|
@@ -2417,19 +2468,19 @@ function Ut(e, t) {
|
|
|
2417
2468
|
};
|
|
2418
2469
|
}
|
|
2419
2470
|
// src/utils/imageNaturalSize.ts
|
|
2420
|
-
function
|
|
2471
|
+
function Gt(e) {
|
|
2421
2472
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
2422
2473
|
}
|
|
2423
|
-
function
|
|
2424
|
-
return
|
|
2474
|
+
function Kt(e, t) {
|
|
2475
|
+
return Gt(e) && Gt(t) ? {
|
|
2425
2476
|
width: e,
|
|
2426
2477
|
height: t
|
|
2427
2478
|
} : null;
|
|
2428
2479
|
}
|
|
2429
|
-
function Kt(e) {
|
|
2430
|
-
return Gt(e.naturalWidth, e.naturalHeight);
|
|
2431
|
-
}
|
|
2432
2480
|
function qt(e) {
|
|
2481
|
+
return Kt(e.naturalWidth, e.naturalHeight);
|
|
2482
|
+
}
|
|
2483
|
+
function Jt(e) {
|
|
2433
2484
|
return e ? {
|
|
2434
2485
|
naturalWidth: e.width,
|
|
2435
2486
|
naturalHeight: e.height
|
|
@@ -2438,35 +2489,35 @@ function qt(e) {
|
|
|
2438
2489
|
naturalHeight: void 0
|
|
2439
2490
|
};
|
|
2440
2491
|
}
|
|
2441
|
-
function
|
|
2492
|
+
function Yt(e, t) {
|
|
2442
2493
|
if (typeof Image > "u") return t(null), () => {};
|
|
2443
2494
|
let n = new Image(), r = () => {
|
|
2444
2495
|
n.onload = null, n.onerror = null;
|
|
2445
2496
|
};
|
|
2446
2497
|
return n.onload = () => {
|
|
2447
|
-
r(), t(
|
|
2498
|
+
r(), t(Kt(n.naturalWidth, n.naturalHeight));
|
|
2448
2499
|
}, n.onerror = () => {
|
|
2449
2500
|
r(), t(null);
|
|
2450
2501
|
}, n.src = e, r;
|
|
2451
2502
|
}
|
|
2452
|
-
function
|
|
2503
|
+
function Xt(e) {
|
|
2453
2504
|
return new Promise((t) => {
|
|
2454
2505
|
let n = setTimeout(() => {
|
|
2455
2506
|
r(), t(null);
|
|
2456
|
-
},
|
|
2507
|
+
}, Pt), r = Yt(e, (e) => {
|
|
2457
2508
|
clearTimeout(n), t(e);
|
|
2458
2509
|
});
|
|
2459
2510
|
});
|
|
2460
2511
|
}
|
|
2461
2512
|
// src/components/MediaDropOverlay.vue
|
|
2462
|
-
var
|
|
2513
|
+
var Zt = /* @__PURE__ */ t({
|
|
2463
2514
|
__name: "MediaDropOverlay",
|
|
2464
2515
|
props: {
|
|
2465
2516
|
uploading: { type: Boolean },
|
|
2466
2517
|
size: { default: "field" }
|
|
2467
2518
|
},
|
|
2468
2519
|
setup(e) {
|
|
2469
|
-
let t = e, { t: r } =
|
|
2520
|
+
let t = e, { t: r } = xe(), i = {
|
|
2470
2521
|
field: {
|
|
2471
2522
|
gap: "tpl:gap-1.5",
|
|
2472
2523
|
icon: 18,
|
|
@@ -2481,39 +2532,39 @@ var Xt = /* @__PURE__ */ t({
|
|
|
2481
2532
|
return (t, i) => (n(), l("div", {
|
|
2482
2533
|
class: p(["tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]", a.value.gap]),
|
|
2483
2534
|
style: y({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${a.value.veil}, transparent)` })
|
|
2484
|
-
}, [e.uploading ? (n(), l(C, { key: 0 }, [w(f(
|
|
2535
|
+
}, [e.uploading ? (n(), l(C, { key: 0 }, [w(f(K), {
|
|
2485
2536
|
class: "tpl-spinner",
|
|
2486
2537
|
size: a.value.icon,
|
|
2487
2538
|
"stroke-width": 2
|
|
2488
|
-
}, null, 8, ["size"]), d(" " + g(f(r).image.uploading), 1)], 64)) : (n(), l(C, { key: 1 }, [w(f(
|
|
2539
|
+
}, null, 8, ["size"]), d(" " + g(f(r).image.uploading), 1)], 64)) : (n(), l(C, { key: 1 }, [w(f(ge), {
|
|
2489
2540
|
size: a.value.icon,
|
|
2490
2541
|
"stroke-width": 1.5
|
|
2491
2542
|
}, null, 8, ["size"]), d(" " + g(f(r).image.dropToUpload), 1)], 64))], 6));
|
|
2492
2543
|
}
|
|
2493
2544
|
});
|
|
2494
2545
|
// src/composables/useAliveFlag.ts
|
|
2495
|
-
function
|
|
2546
|
+
function Qt() {
|
|
2496
2547
|
let e = { alive: !0 };
|
|
2497
2548
|
return i(() => {
|
|
2498
2549
|
e.alive = !1;
|
|
2499
2550
|
}), e;
|
|
2500
2551
|
}
|
|
2501
2552
|
// src/composables/useImageDrop.ts
|
|
2502
|
-
var
|
|
2503
|
-
function
|
|
2504
|
-
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || _(r), { isOverDropZone: a } =
|
|
2553
|
+
var $t = "image/";
|
|
2554
|
+
function en(e) {
|
|
2555
|
+
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || _(r), { isOverDropZone: a } = Se(t, {
|
|
2505
2556
|
preventDefaultForUnhandled: !0,
|
|
2506
2557
|
onDrop: (e) => {
|
|
2507
2558
|
if (!i()) return;
|
|
2508
|
-
let t = (e ?? []).filter((e) => e.type.startsWith(
|
|
2559
|
+
let t = (e ?? []).filter((e) => e.type.startsWith($t));
|
|
2509
2560
|
t.length > 0 && n([t[0]]);
|
|
2510
2561
|
}
|
|
2511
2562
|
});
|
|
2512
2563
|
return { isOver: v(() => i() && a.value) };
|
|
2513
2564
|
}
|
|
2514
2565
|
// src/composables/useMediaDropField.ts
|
|
2515
|
-
function
|
|
2516
|
-
let { target: t, blocked: n, apply: r } = e, i = a(
|
|
2566
|
+
function tn(e) {
|
|
2567
|
+
let { target: t, blocked: n, apply: r } = e, i = a(ye, null), o = a(be, null), s = Qt();
|
|
2517
2568
|
async function c() {
|
|
2518
2569
|
let e = await i?.({ accept: ["images"] });
|
|
2519
2570
|
s.alive && e && r(e);
|
|
@@ -2534,7 +2585,7 @@ function en(e) {
|
|
|
2534
2585
|
}
|
|
2535
2586
|
}
|
|
2536
2587
|
}
|
|
2537
|
-
let { isOver: f } =
|
|
2588
|
+
let { isOver: f } = en({
|
|
2538
2589
|
target: t,
|
|
2539
2590
|
enabled: u,
|
|
2540
2591
|
onFiles: d
|
|
@@ -2547,10 +2598,10 @@ function en(e) {
|
|
|
2547
2598
|
openMediaBrowser: c
|
|
2548
2599
|
};
|
|
2549
2600
|
}
|
|
2550
|
-
function
|
|
2601
|
+
function nn(e, t = "desktop") {
|
|
2551
2602
|
return t === "mobile" ? 375 : e?.width ?? 600;
|
|
2552
2603
|
}
|
|
2553
|
-
var
|
|
2604
|
+
var rn = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", an = {
|
|
2554
2605
|
1: [100],
|
|
2555
2606
|
2: [50, 50],
|
|
2556
2607
|
3: [
|
|
@@ -2574,60 +2625,60 @@ var nn = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", rn = {
|
|
|
2574
2625
|
25
|
|
2575
2626
|
]
|
|
2576
2627
|
};
|
|
2577
|
-
function an(e, t) {
|
|
2578
|
-
let n = (e) => Math.trunc(e ?? 0), r = (e) => fe(e) === null ? 0 : Math.trunc(e.width);
|
|
2579
|
-
return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
|
|
2580
|
-
}
|
|
2581
2628
|
function on(e, t) {
|
|
2582
|
-
|
|
2629
|
+
let n = (e) => Math.trunc(e ?? 0), r = (e) => D(e) === null ? 0 : Math.trunc(e.width);
|
|
2630
|
+
return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
|
|
2583
2631
|
}
|
|
2584
2632
|
function sn(e, t) {
|
|
2633
|
+
return Math.floor(e) - on(t);
|
|
2634
|
+
}
|
|
2635
|
+
function cn(e, t) {
|
|
2585
2636
|
let n = "border" in e ? e.border : void 0;
|
|
2586
|
-
return Math.floor(t) -
|
|
2637
|
+
return Math.floor(t) - on(e.styles.padding, n);
|
|
2587
2638
|
}
|
|
2588
|
-
function*
|
|
2589
|
-
for (let n of e)
|
|
2639
|
+
function* ln(e, t) {
|
|
2640
|
+
for (let n of e) le(n) ? yield* ln(n.children, sn(t, n.styles.padding)) : yield {
|
|
2590
2641
|
block: n,
|
|
2591
|
-
bandWidth:
|
|
2642
|
+
bandWidth: pe(n) && n.wrapper ? sn(t, n.wrapper.padding) : t
|
|
2592
2643
|
};
|
|
2593
2644
|
}
|
|
2594
|
-
function
|
|
2645
|
+
function un(e, t, n = A(e)) {
|
|
2595
2646
|
if (!t) return e;
|
|
2596
2647
|
try {
|
|
2597
|
-
return
|
|
2648
|
+
return ue(T(t, n, { missing: "default" }), e);
|
|
2598
2649
|
} catch {
|
|
2599
2650
|
return e;
|
|
2600
2651
|
}
|
|
2601
2652
|
}
|
|
2602
|
-
function
|
|
2603
|
-
let i =
|
|
2604
|
-
for (let { block: e, bandWidth: n } of
|
|
2605
|
-
let r =
|
|
2653
|
+
function dn(e, t, n, r) {
|
|
2654
|
+
let i = un(e, n, r);
|
|
2655
|
+
for (let { block: e, bandWidth: n } of ln(i.blocks, i.settings.width)) if (pe(e)) {
|
|
2656
|
+
let r = z(e)?.applied ? void 0 : e.border, i = Math.floor(n) - on(e.styles.padding, r), a = an[e.columns] ?? [100];
|
|
2606
2657
|
for (let n = 0; n < e.children.length; n++) {
|
|
2607
2658
|
let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
|
|
2608
|
-
if (o) return
|
|
2659
|
+
if (o) return cn(o, r);
|
|
2609
2660
|
}
|
|
2610
|
-
} else if (e.id === t) return
|
|
2661
|
+
} else if (e.id === t) return cn(e, n);
|
|
2611
2662
|
return null;
|
|
2612
2663
|
}
|
|
2613
|
-
function
|
|
2614
|
-
let i =
|
|
2615
|
-
for (let { block: e, bandWidth: n } of
|
|
2664
|
+
function fn(e, t, n, r) {
|
|
2665
|
+
let i = un(e, n, r);
|
|
2666
|
+
for (let { block: e, bandWidth: n } of ln(i.blocks, i.settings.width)) if (e.id === t) return Math.floor(n);
|
|
2616
2667
|
return null;
|
|
2617
2668
|
}
|
|
2618
|
-
function
|
|
2619
|
-
let t =
|
|
2669
|
+
function pn(e) {
|
|
2670
|
+
let t = pe(e) ? z(e) : null;
|
|
2620
2671
|
return !!t?.applied && t.height === "image";
|
|
2621
2672
|
}
|
|
2622
|
-
function
|
|
2623
|
-
if (
|
|
2673
|
+
function mn(e, t, n, r) {
|
|
2674
|
+
if (pn(e)) return (t ? fn(t, e.id, n, r) : null) ?? nn(t?.settings);
|
|
2624
2675
|
}
|
|
2625
2676
|
// src/constants/socialIcons.ts
|
|
2626
|
-
var
|
|
2677
|
+
var hn = se, gn = {
|
|
2627
2678
|
small: 24,
|
|
2628
2679
|
medium: 32,
|
|
2629
2680
|
large: 48
|
|
2630
|
-
},
|
|
2681
|
+
}, _n = [
|
|
2631
2682
|
"facebook",
|
|
2632
2683
|
"twitter",
|
|
2633
2684
|
"instagram",
|
|
@@ -2647,6 +2698,6 @@ var mn = se, hn = {
|
|
|
2647
2698
|
"dribbble",
|
|
2648
2699
|
"behance"
|
|
2649
2700
|
];
|
|
2650
|
-
export {
|
|
2701
|
+
export { Dt as A, Be as B, Vt as C, Mt as D, Nt as E, Ge as F, We as I, He as L, wt as M, ut as N, jt as O, Ke as P, Ue as R, zt as S, It as T, Ie as V, Kt as _, pn as a, Ht as b, rn as c, Qt as d, Zt as f, qt as g, Jt as h, dn as i, Tt as j, At as k, nn as l, Xt as m, hn as n, mn as o, Yt as p, _n as r, fn as s, gn as t, tn as u, Wt as v, Bt as w, Ft as x, Ut as y, Ve as z };
|
|
2651
2702
|
|
|
2652
|
-
//# sourceMappingURL=socialIcons-
|
|
2703
|
+
//# sourceMappingURL=socialIcons-D9D02_y5.js.map
|