@templatical/editor 0.61.0 → 0.62.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/LICENSE +21 -109
- package/README.md +3 -3
- package/dist/{AiAltTextPopover-DSA1wiiW.js → AiAltTextPopover-C1Ike67q.js} +3 -4
- package/dist/{AiAltTextReview-B9-vfzCj.js → AiAltTextReview-BjT7_PoG.js} +2 -3
- package/dist/{AiChatPanel-DF5TvO9H.js → AiChatPanel-C82fJozf.js} +3 -4
- package/dist/{AiPanels-zRqC5DIP.js → AiPanels-sam_GMNs.js} +1 -1
- package/dist/{AiRewriteMenu-CmZKTO-O.js → AiRewriteMenu-BG3-appN.js} +3 -4
- package/dist/{BlockIssueBadge-Bug5iqcK.js → BlockIssueBadge-D3OmWkCh.js} +2 -3
- package/dist/{BlockPreviewCanvas-knSyWaCP.js → BlockPreviewCanvas-oxkPHm78.js} +6 -6
- package/dist/{CollaborationNotices-BM35YG72.js → CollaborationNotices-Cmc7Ziuf.js} +1 -1
- package/dist/{CollaboratorBar-DMsEOndt.js → CollaboratorBar-DVtWefk1.js} +1 -1
- package/dist/{CommentsPanel-BMYvXRKK.js → CommentsPanel-BSt22Zw9.js} +1 -1
- package/dist/{cdn/chunks/CommentsSidebar-BEiOQ_zT.js → CommentsSidebar-C8qbxjyN.js} +228 -205
- package/dist/{CountdownBlock-AYPypmcX.js → CountdownBlock-bFAELCB6.js} +3 -4
- package/dist/{CountdownToolbar-BprSuPJk.js → CountdownToolbar-CJbPEVV5.js} +4 -4
- package/dist/{IssuesPanel-CeCvUfa7.js → IssuesPanel-CKYf6K84.js} +4 -5
- package/dist/{LanguageMenu-CkGqLYjf.js → LanguageMenu-8yH1Ypum.js} +5 -6
- package/dist/{LocaleNotices-D0be8ovO.js → LocaleNotices-24UYFxo2.js} +7 -8
- package/dist/{LogicTagInsertButton-BzEZUTRZ.js → LogicTagInsertButton-DdaafrjI.js} +95 -96
- package/dist/{MergeTagInput-By2FSStk.js → MergeTagInput-BXM6-eF-.js} +1 -1
- package/dist/{MergeTagModeToggle-DtjOZhoD.js → MergeTagModeToggle-ooA_Ytfq.js} +2 -3
- package/dist/{MergeTagTextarea-BjHlamJv.js → MergeTagTextarea-B86MPY89.js} +3 -4
- package/dist/{ParagraphEditor-Ctu4fSsl.js → ParagraphEditor-B2BpfcoY.js} +78 -79
- package/dist/{RestoreVersionDialog-DvZoTJVa.js → RestoreVersionDialog-BF9Wyma8.js} +2 -2
- package/dist/{RichTextEditorContent-B1p7Ykq8.js → RichTextEditorContent-BNMBOkdy.js} +5 -6
- package/dist/{SaveBlockDialog-DHfT-Tpx.js → SaveBlockDialog-BZQkihki.js} +23 -24
- package/dist/{SavedBlocksBrowserModal-BjJuuXQv.js → SavedBlocksBrowserModal-CQNnmeGv.js} +8 -9
- package/dist/{SavedBlocksPanels-D6eiMQZ3.js → SavedBlocksPanels-n-IdFD6E.js} +1 -1
- package/dist/{SavedBlocksPickBar-BkgCDSXe.js → SavedBlocksPickBar-BtQgXlKF.js} +2 -2
- package/dist/{TemplateSettings-DQAbNsiS.js → TemplateSettings-Z-i-_xF5.js} +19 -20
- package/dist/{TestEmailModal-m_AEa36T.js → TestEmailModal-IeP1EsJ5.js} +17 -18
- package/dist/{TestEmailPanel-OApkuaVd.js → TestEmailPanel-DVxTZJ4H.js} +1 -1
- package/dist/{TitleEditor-Cwdtfk15.js → TitleEditor-D1UDQaHM.js} +8 -9
- package/dist/{Toolbar-D_T55elL.js → Toolbar-bwAdFK4A.js} +308 -310
- package/dist/{TplModal-2MKm5y6r.js → TplModal-BvUeHkqB.js} +4 -4
- package/dist/{VersionHistoryMenu-B3-xJ7GO.js → VersionHistoryMenu-qoOkZKal.js} +6 -7
- package/dist/{VersionHistoryPanels-CCM0IQBg.js → VersionHistoryPanels-rkOqdUem.js} +1 -1
- package/dist/{VersionPreviewBanner-DLAB4ZbS.js → VersionPreviewBanner-DEN9rl6y.js} +1 -1
- package/dist/{WrapperBlock-BZl10HLy.js → WrapperBlock-CvEmjNKs.js} +4 -4
- package/dist/{blockTypeIcons-C691ZY1l.js → blockTypeIcons-C1S2wVx8.js} +4 -4
- package/dist/bundle-stats.json +8 -8
- package/dist/{ca-C8N05sCU.js → ca-BIseSbs-.js} +1 -2
- package/dist/cdn/chunks/{AiAltTextPopover-BLNN_Pnd.js → AiAltTextPopover-mDx_knAl.js} +4 -5
- package/dist/cdn/chunks/{AiAltTextPopover-BLNN_Pnd.js.map → AiAltTextPopover-mDx_knAl.js.map} +1 -1
- package/dist/cdn/chunks/{AiAltTextReview-Db8vSNpe.js → AiAltTextReview-Dmg8iVWD.js} +3 -4
- package/dist/cdn/chunks/{AiAltTextReview-Db8vSNpe.js.map → AiAltTextReview-Dmg8iVWD.js.map} +1 -1
- package/dist/cdn/chunks/{AiChatPanel-BYAsgmoC.js → AiChatPanel-CEDr_x8G.js} +4 -5
- package/dist/cdn/chunks/{AiChatPanel-BYAsgmoC.js.map → AiChatPanel-CEDr_x8G.js.map} +1 -1
- package/dist/cdn/chunks/{AiPanels-MY_YPls8.js → AiPanels-qJgLTYPs.js} +2 -2
- package/dist/cdn/chunks/{AiPanels-MY_YPls8.js.map → AiPanels-qJgLTYPs.js.map} +1 -1
- package/dist/cdn/chunks/{AiRewriteMenu-BSePiXe_.js → AiRewriteMenu-DoZh5Q74.js} +4 -5
- package/dist/cdn/chunks/{AiRewriteMenu-BSePiXe_.js.map → AiRewriteMenu-DoZh5Q74.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-fYeNnepj.js → BlockIssueBadge-D87CYoPw.js} +3 -4
- package/dist/cdn/chunks/{BlockIssueBadge-fYeNnepj.js.map → BlockIssueBadge-D87CYoPw.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-B153A3hu.js → BlockPreviewCanvas-BrxWnLLK.js} +8 -8
- package/dist/cdn/chunks/{BlockPreviewCanvas-B153A3hu.js.map → BlockPreviewCanvas-BrxWnLLK.js.map} +1 -1
- package/dist/cdn/chunks/{CollaborationNotices-COkmBmps.js → CollaborationNotices-DyzhN_Ns.js} +2 -2
- package/dist/cdn/chunks/{CollaborationNotices-COkmBmps.js.map → CollaborationNotices-DyzhN_Ns.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-BSzI8YIU.js → CollaboratorBar-bNFuQxxP.js} +2 -2
- package/dist/cdn/chunks/{CollaboratorBar-BSzI8YIU.js.map → CollaboratorBar-bNFuQxxP.js.map} +1 -1
- package/dist/cdn/chunks/{CommentsPanel-R27fqh9O.js → CommentsPanel-D-D2qsS6.js} +2 -2
- package/dist/cdn/chunks/{CommentsPanel-R27fqh9O.js.map → CommentsPanel-D-D2qsS6.js.map} +1 -1
- package/dist/cdn/chunks/CommentsSidebar-CCVp8M2T.js +479 -0
- package/dist/cdn/chunks/CommentsSidebar-CCVp8M2T.js.map +1 -0
- package/dist/cdn/chunks/{CountdownBlock--hlKE2aj.js → CountdownBlock-5hUzymeP.js} +4 -5
- package/dist/cdn/chunks/{CountdownBlock--hlKE2aj.js.map → CountdownBlock-5hUzymeP.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-DOhXnbsq.js → CountdownToolbar-DaGxwKfG.js} +5 -5
- package/dist/cdn/chunks/{CountdownToolbar-DOhXnbsq.js.map → CountdownToolbar-DaGxwKfG.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-DgxiS3hF.js → IssuesPanel-DQQo1B1z.js} +10 -11
- package/dist/cdn/chunks/IssuesPanel-DQQo1B1z.js.map +1 -0
- package/dist/cdn/chunks/{LanguageMenu-B6kt8SgX.js → LanguageMenu-CyWfHmkP.js} +6 -7
- package/dist/cdn/chunks/{LanguageMenu-B6kt8SgX.js.map → LanguageMenu-CyWfHmkP.js.map} +1 -1
- package/dist/cdn/chunks/{LocaleNotices-Bleg4gTu.js → LocaleNotices-DSfOyyyf.js} +8 -9
- package/dist/cdn/chunks/{LocaleNotices-Bleg4gTu.js.map → LocaleNotices-DSfOyyyf.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-DGg1Wvhp.js → LogicTagInsertButton-CumMM1rP.js} +7 -8
- package/dist/cdn/chunks/{LogicTagInsertButton-DGg1Wvhp.js.map → LogicTagInsertButton-CumMM1rP.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-BVfTwujW.js → MergeTagInput-Dm_QiG96.js} +2 -2
- package/dist/cdn/chunks/{MergeTagInput-BVfTwujW.js.map → MergeTagInput-Dm_QiG96.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-BoI0C1Y6.js → MergeTagModeToggle-Bir7lkLe.js} +3 -4
- package/dist/cdn/chunks/{MergeTagModeToggle-BoI0C1Y6.js.map → MergeTagModeToggle-Bir7lkLe.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagTextarea-DGDv-pdn.js → MergeTagTextarea-B_IFeWfZ.js} +4 -5
- package/dist/cdn/chunks/{MergeTagTextarea-DGDv-pdn.js.map → MergeTagTextarea-B_IFeWfZ.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-D0q36Myd.js → ParagraphEditor-DUbU-eqS.js} +135 -136
- package/dist/cdn/chunks/{ParagraphEditor-D0q36Myd.js.map → ParagraphEditor-DUbU-eqS.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-CJggFdbi.js → RestoreVersionDialog-hDWvu1Fk.js} +3 -3
- package/dist/cdn/chunks/{RestoreVersionDialog-CJggFdbi.js.map → RestoreVersionDialog-hDWvu1Fk.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-D3ihUF8v.js → RichTextEditorContent-CuvFVxEq.js} +6 -7
- package/dist/cdn/chunks/{RichTextEditorContent-D3ihUF8v.js.map → RichTextEditorContent-CuvFVxEq.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-BzES5tqd.js → SaveBlockDialog-DVVG78vs.js} +25 -26
- package/dist/cdn/chunks/{SaveBlockDialog-BzES5tqd.js.map → SaveBlockDialog-DVVG78vs.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-CLNcZcLd.js → SavedBlocksBrowserModal-CJjVM9pN.js} +9 -10
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-CLNcZcLd.js.map → SavedBlocksBrowserModal-CJjVM9pN.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-R0W9LElD.js → SavedBlocksPanels-CUu9BLen.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-R0W9LElD.js.map → SavedBlocksPanels-CUu9BLen.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-JNi5Rx4V.js → SavedBlocksPickBar-ClGm41Wt.js} +3 -3
- package/dist/cdn/chunks/{SavedBlocksPickBar-JNi5Rx4V.js.map → SavedBlocksPickBar-ClGm41Wt.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-C5wsNcgX.js → TemplateSettings-B8Ch5ps8.js} +20 -21
- package/dist/cdn/chunks/{TemplateSettings-C5wsNcgX.js.map → TemplateSettings-B8Ch5ps8.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-BxIAwjww.js → TestEmailModal-BtrjByCC.js} +16 -17
- package/dist/cdn/chunks/{TestEmailModal-BxIAwjww.js.map → TestEmailModal-BtrjByCC.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-B8BsWXjE.js → TestEmailPanel-EjyQvj_M.js} +2 -2
- package/dist/cdn/chunks/{TestEmailPanel-B8BsWXjE.js.map → TestEmailPanel-EjyQvj_M.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-DhcI1aRS.js → TitleEditor-B0SHe63R.js} +17 -18
- package/dist/cdn/chunks/{TitleEditor-DhcI1aRS.js.map → TitleEditor-B0SHe63R.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-Ch3h2BUs.js → Toolbar-BnTSuZQb.js} +310 -312
- package/dist/cdn/chunks/Toolbar-BnTSuZQb.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-CPOqOxVf.js → TplModal-uqelrGih.js} +5 -5
- package/dist/cdn/chunks/{TplModal-CPOqOxVf.js.map → TplModal-uqelrGih.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-DTDO48HI.js → VersionHistoryMenu-DlPr3twf.js} +7 -8
- package/dist/cdn/chunks/{VersionHistoryMenu-DTDO48HI.js.map → VersionHistoryMenu-DlPr3twf.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-CVrXHYxT.js → VersionHistoryPanels-B1DN6c4B.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryPanels-CVrXHYxT.js.map → VersionHistoryPanels-B1DN6c4B.js.map} +1 -1
- package/dist/cdn/chunks/{VersionPreviewBanner-C1H_fYAr.js → VersionPreviewBanner-anJgZOcw.js} +2 -2
- package/dist/cdn/chunks/VersionPreviewBanner-anJgZOcw.js.map +1 -0
- package/dist/cdn/chunks/{WrapperBlock-B8SJ7Q4w.js → WrapperBlock-CUuF8Ese.js} +5 -5
- package/dist/cdn/chunks/{WrapperBlock-B8SJ7Q4w.js.map → WrapperBlock-CUuF8Ese.js.map} +1 -1
- package/dist/cdn/chunks/{ca-C8N05sCU.js → ca-BIseSbs-.js} +2 -3
- package/dist/cdn/chunks/{ca-C8N05sCU.js.map → ca-BIseSbs-.js.map} +1 -1
- package/dist/cdn/chunks/{composables-CKXPwWo9.js → composables-CuAVj7Ex.js} +444 -464
- package/dist/cdn/chunks/composables-CuAVj7Ex.js.map +1 -0
- package/dist/{da-Dno_4nGy.js → cdn/chunks/da-DN46iRXS.js} +3 -2
- package/dist/cdn/chunks/{da-Dno_4nGy.js.map → da-DN46iRXS.js.map} +1 -1
- package/dist/{de-DRR5JSkh.js → cdn/chunks/de-Dyk8PPCm.js} +3 -2
- package/dist/cdn/chunks/{de-DRR5JSkh.js.map → de-Dyk8PPCm.js.map} +1 -1
- package/dist/{en-DAcLbbpg.js → cdn/chunks/en-BzMbMmgz.js} +3 -2
- package/dist/cdn/chunks/{en-DAcLbbpg.js.map → en-BzMbMmgz.js.map} +1 -1
- package/dist/{es-BcEQLQxe.js → cdn/chunks/es-KSHEXYyf.js} +3 -2
- package/dist/cdn/chunks/{es-BcEQLQxe.js.map → es-KSHEXYyf.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-Bq9nXmBP.js → extensions-CqhrbdGN.js} +35 -18
- package/dist/cdn/chunks/extensions-CqhrbdGN.js.map +1 -0
- package/dist/{fr-CNQG7ESr.js → cdn/chunks/fr-DtKHfZyk.js} +3 -2
- package/dist/cdn/chunks/{fr-CNQG7ESr.js.map → fr-DtKHfZyk.js.map} +1 -1
- package/dist/{ja-CMxWxqSH.js → cdn/chunks/ja-DUSaDVPA.js} +3 -2
- package/dist/cdn/chunks/{ja-CMxWxqSH.js.map → ja-DUSaDVPA.js.map} +1 -1
- package/dist/{nl-BjyYZDkC.js → cdn/chunks/nl-DQbuxzD6.js} +3 -2
- package/dist/cdn/chunks/{nl-BjyYZDkC.js.map → nl-DQbuxzD6.js.map} +1 -1
- package/dist/{pt-BR-DC2A3C0v.js → cdn/chunks/pt-BR-CxpxBtvc.js} +3 -2
- package/dist/cdn/chunks/{pt-BR-DC2A3C0v.js.map → pt-BR-CxpxBtvc.js.map} +1 -1
- package/dist/cdn/chunks/rolldown-runtime-CGnMp29N.js +10 -0
- package/dist/cdn/chunks/{socialIcons-CSe4YJ52.js → socialIcons-CXQfKLUV.js} +156 -136
- package/dist/cdn/chunks/socialIcons-CXQfKLUV.js.map +1 -0
- package/dist/cdn/chunks/src-A0kzK-pR.js.map +1 -1
- package/dist/cdn/chunks/{src-edESkGqO.js → src-C9jjLNMg.js} +2 -2
- package/dist/cdn/chunks/{src-edESkGqO.js.map → src-C9jjLNMg.js.map} +1 -1
- package/dist/cdn/chunks/{src-Bk1LF1np.js → src-DxIDI6ZB.js} +4 -2
- package/dist/cdn/chunks/src-DxIDI6ZB.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-DDhueoan.js → tiptap-DLW5XdqI.js} +2 -2
- package/dist/cdn/chunks/{tiptap-DDhueoan.js.map → tiptap-DLW5XdqI.js.map} +1 -1
- package/dist/cdn/chunks/{useEditorRoot-D0Lp2x4_.js → useEditorRoot-BPVxLYFD.js} +2 -2
- package/dist/cdn/chunks/{useEditorRoot-D0Lp2x4_.js.map → useEditorRoot-BPVxLYFD.js.map} +1 -1
- package/dist/cdn/chunks/useI18n-DwP1ksBW.js +24 -0
- package/dist/cdn/chunks/{keys-ywH4jHJ2.js.map → useI18n-DwP1ksBW.js.map} +1 -1
- package/dist/cdn/chunks/{useLanguageName-DDhdVpqh.js → useLanguageName-CeuoO9WZ.js} +2 -2
- package/dist/cdn/chunks/{useLanguageName-DDhdVpqh.js.map → useLanguageName-CeuoO9WZ.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-CKtQlJDa.js → useLogicTag-gphGbQfy.js} +3 -3
- package/dist/cdn/chunks/{useLogicTag-CKtQlJDa.js.map → useLogicTag-gphGbQfy.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-Dwy3U0PI.js → useMergeTag-QM-tkBc6.js} +3 -3
- package/dist/cdn/chunks/{useMergeTag-Dwy3U0PI.js.map → useMergeTag-QM-tkBc6.js.map} +1 -1
- package/dist/cdn/chunks/{usePopoverPosition-CBp9uwjV.js → usePopoverPosition-Cg8LR0W4.js} +2 -2
- package/dist/cdn/chunks/{usePopoverPosition-CBp9uwjV.js.map → usePopoverPosition-Cg8LR0W4.js.map} +1 -1
- package/dist/cdn/chunks/{useScrollToBlock-32EnuMwu.js → useScrollToBlock-CS7zo4oQ.js} +2 -2
- package/dist/cdn/chunks/{useScrollToBlock-32EnuMwu.js.map → useScrollToBlock-CS7zo4oQ.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +877 -975
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{composables-26aR45W3.js → composables-DZWtVCMq.js} +817 -837
- package/dist/{cdn/chunks/da-Dno_4nGy.js → da-DN46iRXS.js} +1 -4
- package/dist/{cdn/chunks/de-DRR5JSkh.js → de-Dyk8PPCm.js} +1 -4
- package/dist/{cdn/chunks/en-DAcLbbpg.js → en-BzMbMmgz.js} +1 -4
- package/dist/{cdn/chunks/es-BcEQLQxe.js → es-KSHEXYyf.js} +1 -4
- package/dist/{extensions-zHf8YFRw.js → extensions-DfhOxy6Z.js} +341 -324
- package/dist/{cdn/chunks/fr-CNQG7ESr.js → fr-DtKHfZyk.js} +1 -4
- package/dist/index.d.ts +33 -405
- package/dist/{cdn/chunks/ja-CMxWxqSH.js → ja-DUSaDVPA.js} +1 -4
- package/dist/{cdn/chunks/nl-BjyYZDkC.js → nl-DQbuxzD6.js} +1 -4
- package/dist/{cdn/chunks/pt-BR-DC2A3C0v.js → pt-BR-CxpxBtvc.js} +1 -4
- package/dist/{socialIcons-mWE33bOn.js → socialIcons-K89pe-h2.js} +84 -64
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +1060 -1158
- package/dist/{useEditorRoot-DWfC2CVC.js → useEditorRoot-CQeutW_s.js} +1 -1
- package/dist/useI18n-B05qsAsl.js +22 -0
- package/dist/{useLanguageName-CEFzafHB.js → useLanguageName-CnpG7FD5.js} +1 -1
- package/dist/{useLogicTag-K5CPoMTk.js → useLogicTag-DSa1si4o.js} +2 -2
- package/dist/{useMergeTag-tsU_Sw2x.js → useMergeTag-DwxbvRZI.js} +2 -2
- package/dist/{usePopoverPosition-DF0ZYH7g.js → usePopoverPosition-B8CXTr8v.js} +1 -1
- package/dist/{useScrollToBlock-eZXiGa8o.js → useScrollToBlock-ZZBBGFan.js} +1 -1
- package/package.json +11 -13
- package/dist/CloudHeaderExtras-DC_oNrxz.js +0 -22
- package/dist/CloudPanels-BbHJHZri.js +0 -167
- package/dist/CommentsSidebar-_8at1Rug.js +0 -516
- package/dist/cdn/chunks/CloudHeaderExtras-Cd-ePldd.js +0 -24
- package/dist/cdn/chunks/CloudHeaderExtras-Cd-ePldd.js.map +0 -1
- package/dist/cdn/chunks/CloudPanels-Bv26_Sd8.js +0 -167
- package/dist/cdn/chunks/CloudPanels-Bv26_Sd8.js.map +0 -1
- package/dist/cdn/chunks/CommentsSidebar-BEiOQ_zT.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-DgxiS3hF.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-Ch3h2BUs.js.map +0 -1
- package/dist/cdn/chunks/VersionPreviewBanner-C1H_fYAr.js.map +0 -1
- package/dist/cdn/chunks/composables-CKXPwWo9.js.map +0 -1
- package/dist/cdn/chunks/createCloudRuntime-CUlw09ix.js +0 -1405
- package/dist/cdn/chunks/createCloudRuntime-CUlw09ix.js.map +0 -1
- package/dist/cdn/chunks/de-6M4JoHoD.js +0 -21
- package/dist/cdn/chunks/de-6M4JoHoD.js.map +0 -1
- package/dist/cdn/chunks/en-FzUuJ8HW.js +0 -21
- package/dist/cdn/chunks/en-FzUuJ8HW.js.map +0 -1
- package/dist/cdn/chunks/extensions-Bq9nXmBP.js.map +0 -1
- package/dist/cdn/chunks/keys-ywH4jHJ2.js +0 -11
- package/dist/cdn/chunks/logger-CqQTfJGx.js +0 -26
- package/dist/cdn/chunks/logger-CqQTfJGx.js.map +0 -1
- package/dist/cdn/chunks/preRenderCustomBlocks-BLVFtvl8.js +0 -22
- package/dist/cdn/chunks/preRenderCustomBlocks-BLVFtvl8.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-Bp92Fc6J.js +0 -21
- package/dist/cdn/chunks/pt-BR-Bp92Fc6J.js.map +0 -1
- package/dist/cdn/chunks/pusher-x9rNqzon.js +0 -2473
- package/dist/cdn/chunks/pusher-x9rNqzon.js.map +0 -1
- package/dist/cdn/chunks/rolldown-runtime-QGRDbDUS.js +0 -19
- package/dist/cdn/chunks/socialIcons-CSe4YJ52.js.map +0 -1
- package/dist/cdn/chunks/src-Bk1LF1np.js.map +0 -1
- package/dist/cdn/chunks/useCloudI18n-BTV9uu3c.js +0 -24
- package/dist/cdn/chunks/useCloudI18n-BTV9uu3c.js.map +0 -1
- package/dist/cdn/chunks/useI18n-DPg6rPbu.js +0 -18
- package/dist/cdn/chunks/useI18n-DPg6rPbu.js.map +0 -1
- package/dist/createCloudRuntime-CiEo0wkr.js +0 -1389
- package/dist/de-6M4JoHoD.js +0 -19
- package/dist/en-FzUuJ8HW.js +0 -19
- package/dist/keys-B4DimcgX.js +0 -9
- package/dist/logger-BOu7oEtk.js +0 -24
- package/dist/preRenderCustomBlocks-6CLw2rP6.js +0 -20
- package/dist/pt-BR-Bp92Fc6J.js +0 -19
- package/dist/useCloudI18n-BnuOL1YS.js +0 -22
- package/dist/useI18n-Cx9W7OWb.js +0 -16
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { O as e } from "./draggable-IRVFEZ-b.js";
|
|
2
|
-
import {
|
|
2
|
+
import { v as t } from "./useI18n-DwP1ksBW.js";
|
|
3
3
|
// src/composables/useEditorRoot.ts
|
|
4
4
|
function n() {
|
|
5
5
|
return e(t, document) ?? document;
|
|
6
6
|
}
|
|
7
7
|
export { n as t };
|
|
8
8
|
|
|
9
|
-
//# sourceMappingURL=useEditorRoot-
|
|
9
|
+
//# sourceMappingURL=useEditorRoot-BPVxLYFD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorRoot-
|
|
1
|
+
{"version":3,"file":"useEditorRoot-BPVxLYFD.js","names":["inject","EDITOR_ROOT_KEY","useEditorRoot"],"sources":["../../../src/composables/useEditorRoot.ts"],"sourcesContent":["import { inject } from \"vue\";\nimport { EDITOR_ROOT_KEY } from \"../keys\";\n\n/**\n * Returns the editor's effective DOM root — `Document` when mounted in light\n * DOM, `ShadowRoot` when mounted with `shadowDom: true`.\n *\n * Use this instead of reaching for `document` directly when the code is\n * shadow-DOM-aware (focus trap, selection, popover mount, etc.). Both\n * `Document` and `ShadowRoot` expose the same subset of APIs the editor\n * needs (`activeElement`, `getSelection?`, `querySelector`, `appendChild`),\n * so call sites usually don't need to branch.\n *\n * Falls back to `document` if no provider is in scope — keeps headless /\n * test-utility usage working without explicit wiring.\n *\n * Internal — not exported from the package entry.\n */\nexport function useEditorRoot(): Document | ShadowRoot {\n // When called outside a Vue setup() context (e.g. direct composable\n // invocation in unit tests), Vue's inject() warns and returns undefined\n // regardless of the default arg. Coalesce explicitly so callers always\n // get a usable root — keeps test ergonomics simple and matches the\n // \"headless fallback to document\" semantics this composable promises.\n const root = inject(EDITOR_ROOT_KEY, document);\n return root ?? document;\n}\n"],"mappings":";;;AAkBA,SAAgBE,IAAuC;CAOrD,OADaF,EAAOC,GAAiB,QAC9B,KAAQ;AACjB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { O as e, X as t, rt as n } from "./draggable-IRVFEZ-b.js";
|
|
2
|
+
// src/keys.ts
|
|
3
|
+
var r = Symbol("translations"), i = Symbol("localeChipOpeners"), a = Symbol("localization"), o = Symbol("ancestorHiddenLocales"), ee = Symbol("editor"), s = Symbol("aiFeature"), c = Symbol("translationFeature"), l = Symbol("activeLocaleCoverage"), u = Symbol("localizedContent"), d = Symbol("localeActions"), f = Symbol("history"), p = Symbol("blockActions"), m = Symbol("conditionPreview"), h = Symbol("appliesConditionFilter"), g = Symbol("fontsManager"), _ = Symbol("themeStyles"), v = Symbol("tplUiTheme"), y = Symbol("tplUiLocale"), b = Symbol("blockDefaults"), x = Symbol("blockRegistry"), S = Symbol("customBlockDefinitions"), C = Symbol("paletteBlocks"), w = Symbol("htmlBlockPreview"), T = Symbol("layout"), E = Symbol("sectionWrapper"), D = Symbol("colors"), O = Symbol("templateSettingsFields"), k = Symbol("customBlockStylesheets"), A = Symbol("mergeTags"), j = n([]), M = Symbol("mergeTagSyntax"), N = Symbol("onRequestMergeTag"), P = Symbol("mergeTagAutocomplete"), te = Symbol("mergeTagShowRawValue"), F = Symbol("mergeTagSampleMode"), I = Symbol("useMergeTagSamples"), L = Symbol("showsResolvedPreview"), R = Symbol("readOnlySurface"), z = Symbol("resolvePreview"), B = Symbol("registerDialogPreviewRefresh"), V = Symbol("previewResolution"), H = Symbol("mergeTagPicker"), U = Symbol("mergeTagRequesting"), W = Symbol("logicTagRequesting"), G = Symbol("logicTags"), K = Symbol("logicPairs"), q = Symbol("logicPicker"), J = Symbol("onRequestLogic"), Y = Symbol("onRequestMedia"), X = Symbol("canDropMedia"), Z = Symbol("imageUrlResolver"), Q = Symbol("displayConditions"), ne = Symbol("allowCustomConditions"), re = Symbol("onRequestDisplayCondition"), ie = Symbol("capabilities"), ae = Symbol("keyboardReorder"), oe = Symbol("templateLint"), $ = Symbol("sizeCheck"), se = Symbol("editorRoot"), ce = Symbol("popoverRoot"), le = Symbol("savedBlocks");
|
|
4
|
+
function ue(t, n) {
|
|
5
|
+
let r = e(t, null);
|
|
6
|
+
if (r == null) throw Error(`${n} requires a provider for ${t.description ?? "unknown key"}. Ensure it renders inside the editor, below Editor.vue.`);
|
|
7
|
+
return r;
|
|
8
|
+
}
|
|
9
|
+
// src/composables/useI18n.ts
|
|
10
|
+
function de(n) {
|
|
11
|
+
let i = n ?? e(r, null);
|
|
12
|
+
if (!i) throw Error("useI18n() requires a translations provider. Ensure the component renders inside the editor, below Editor.vue.");
|
|
13
|
+
let a = t(i) ? i.value : i;
|
|
14
|
+
function o(e, t) {
|
|
15
|
+
return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
t: a,
|
|
19
|
+
format: o
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export { L as $, G as A, j as B, ae as C, a as D, i as E, H as F, C as G, J as H, U as I, R as J, ce as K, F as L, W as M, A as N, u as O, P, E as Q, te as R, Z as S, d as T, Y as U, re as V, N as W, z as X, B as Y, le as Z, ee as _, o as a, c as at, f as b, b as c, I as ct, ie as d, $ as et, D as f, Q as g, k as h, ne as i, r as it, q as j, K as k, x as l, ue as lt, S as m, l as n, O as nt, h as o, y as ot, m as p, V as q, s as r, _ as rt, p as s, v as st, de as t, oe as tt, X as u, se as v, T as w, w as x, g as y, M as z };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=useI18n-DwP1ksBW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-ywH4jHJ2.js","names":["inject","shallowRef","TRANSLATIONS_KEY","LOCALE_CHIP_OPENERS_KEY","LOCALIZATION_KEY","ANCESTOR_HIDDEN_LOCALES_KEY","EDITOR_KEY","AI_FEATURE_KEY","TRANSLATION_FEATURE_KEY","ACTIVE_LOCALE_COVERAGE_KEY","LOCALIZED_CONTENT_KEY","LOCALE_ACTIONS_KEY","HISTORY_KEY","BLOCK_ACTIONS_KEY","CONDITION_PREVIEW_KEY","APPLIES_CONDITION_FILTER_KEY","FONTS_MANAGER_KEY","THEME_STYLES_KEY","UI_THEME_KEY","UI_LOCALE_KEY","BLOCK_DEFAULTS_KEY","BLOCK_REGISTRY_KEY","CUSTOM_BLOCK_DEFINITIONS_KEY","PALETTE_BLOCKS_KEY","HTML_BLOCK_PREVIEW_KEY","LAYOUT_KEY","SECTION_WRAPPER_KEY","COLORS_KEY","TEMPLATE_SETTINGS_FIELDS_KEY","CUSTOM_BLOCK_STYLESHEETS_KEY","MERGE_TAGS_KEY","NO_MERGE_TAGS","MERGE_TAG_SYNTAX_KEY","ON_REQUEST_MERGE_TAG_KEY","MERGE_TAG_AUTOCOMPLETE_KEY","MERGE_TAG_SHOW_RAW_VALUE_KEY","MERGE_TAG_SAMPLE_MODE_KEY","USE_MERGE_TAG_SAMPLES_KEY","SHOWS_RESOLVED_PREVIEW_KEY","READ_ONLY_SURFACE_KEY","RESOLVE_PREVIEW_KEY","REGISTER_DIALOG_PREVIEW_REFRESH_KEY","PREVIEW_RESOLUTION_KEY","MERGE_TAG_PICKER_KEY","MERGE_TAG_REQUESTING_KEY","LOGIC_TAG_REQUESTING_KEY","LOGIC_TAGS_KEY","LOGIC_PAIRS_KEY","LOGIC_TAG_PICKER_KEY","ON_REQUEST_LOGIC_TAG_KEY","ON_REQUEST_MEDIA_KEY","CAN_DROP_MEDIA_KEY","IMAGE_URL_RESOLVER_KEY","DISPLAY_CONDITIONS_KEY","ALLOW_CUSTOM_CONDITIONS_KEY","ON_REQUEST_DISPLAY_CONDITION_KEY","CAPABILITIES_KEY","KEYBOARD_REORDER_KEY","TEMPLATE_LINT_KEY","SIZE_CHECK_KEY","EDITOR_ROOT_KEY","POPOVER_ROOT_KEY","SAVED_BLOCKS_KEY","AUTH_MANAGER_KEY","CLOUD_TRANSLATIONS_KEY","requireInject","value","key","componentName"],"sources":["../../../src/keys.ts"],"sourcesContent":["import {\n inject,\n shallowRef,\n type InjectionKey,\n type ComputedRef,\n type Ref,\n type ShallowRef,\n} from \"vue\";\nimport type {\n UseHistoryReturn,\n UseBlockActionsReturn,\n UseConditionPreviewReturn,\n} from \"@templatical/core\";\nimport type {\n BlockDefaults,\n CustomBlockDefinition,\n DisplayCondition,\n DisplayConditionRequestContext,\n LocaleCoverage,\n LogicPair,\n LogicTag,\n MergeTag,\n MergeTagRequestContext,\n ResolvePreview,\n SyntaxPreset,\n TemplateContent,\n} from \"@templatical/types\";\nimport type { Translations, CloudTranslations } from \"./i18n\";\nimport type { AuthManager } from \"@templatical/core/cloud\";\nimport type { UseSavedBlocksReturn } from \"@templatical/core\";\nimport type { BaseEditorReturn } from \"./composables/useEditorCore\";\nimport type { ImageUrlResolver } from \"./composables/useImageUrlResolver\";\nimport type { UseFontsReturn } from \"./composables/useFonts\";\nimport type { UseAiFeatureReturn } from \"./composables/useAiFeature\";\nimport type { UseBlockRegistryReturn } from \"./composables/useBlockRegistry\";\nimport type { UseKeyboardReorderReturn } from \"./composables/useKeyboardReorder\";\nimport type { EditorCapabilities } from \"./types/editor-capabilities\";\nimport type { OnRequestMedia } from \"./index\";\n\n// ---------------------------------------------------------------------------\n// Shared keys (provided by useEditorCore, consumed by all components)\n// ---------------------------------------------------------------------------\n\nexport const TRANSLATIONS_KEY: InjectionKey<Translations> =\n Symbol(\"translations\");\n\n/** The states a block's status popover can explain for a localization finding. */\nexport type LocaleChipTarget = \"missing\" | \"stale\" | \"tags-differ\";\n\n/** Opens a block's status popover, on a finding's own state when given. */\nexport const LOCALE_CHIP_OPENERS_KEY: InjectionKey<\n Map<string, (target?: LocaleChipTarget) => void>\n> = Symbol(\"localeChipOpeners\");\n\nexport const LOCALIZATION_KEY: InjectionKey<\n | {\n locales: string[];\n doNotTranslate?: string[];\n languageNames?: Record<string, string>;\n }\n | undefined\n> = Symbol(\"localization\");\n\n/** Languages in which an ancestor section excludes its descendants. */\nexport const ANCESTOR_HIDDEN_LOCALES_KEY: InjectionKey<\n ComputedRef<ReadonlySet<string>>\n> = Symbol(\"ancestorHiddenLocales\");\n\nexport const EDITOR_KEY: InjectionKey<BaseEditorReturn> = Symbol(\"editor\");\n\n/**\n * The AI feature, for chrome deep in the tree (the paragraph toolbar's\n * rewrite menu). Provided by `Editor.vue` only while an `ai` provider is set.\n */\nexport const AI_FEATURE_KEY: InjectionKey<UseAiFeatureReturn> =\n Symbol(\"aiFeature\");\n\nexport const TRANSLATION_FEATURE_KEY: InjectionKey<\n import(\"./composables/useTranslationFeature\").UseTranslationFeatureReturn\n> = Symbol(\"translationFeature\");\n\n/**\n * The active language view's coverage, `null` in the default view. One pass\n * per change serves the header trigger, the language bar and its Translate\n * counts. Provided by `Editor.vue`.\n */\nexport const ACTIVE_LOCALE_COVERAGE_KEY: InjectionKey<\n ComputedRef<LocaleCoverage | null>\n> = Symbol(\"activeLocaleCoverage\");\n\n/**\n * The active language's projection of the whole template, one per change for\n * the few readers that need all of it (a \"match image\" hero's band width).\n * Provided by `Editor.vue`.\n */\nexport const LOCALIZED_CONTENT_KEY: InjectionKey<ComputedRef<TemplateContent>> =\n Symbol(\"localizedContent\");\n\nexport const LOCALE_ACTIONS_KEY: InjectionKey<\n import(\"./composables/useLocaleActions\").UseLocaleActionsReturn\n> = Symbol(\"localeActions\");\n\nexport const HISTORY_KEY: InjectionKey<UseHistoryReturn> = Symbol(\"history\");\n\nexport const BLOCK_ACTIONS_KEY: InjectionKey<UseBlockActionsReturn> =\n Symbol(\"blockActions\");\n\nexport const CONDITION_PREVIEW_KEY: InjectionKey<UseConditionPreviewReturn> =\n Symbol(\"conditionPreview\");\n\n/**\n * Whether the hand-toggled display-condition filter applies on this surface —\n * provided per-surface, exactly like `USE_MERGE_TAG_SAMPLES_KEY`, and for the\n * same reason: the rule folds in both `previewMode` and whether a resolver owns\n * the preview, so a component that re-derived it from `CONDITION_PREVIEW_KEY`\n * plus the editor's `previewMode` could get one half wrong on its own.\n *\n * Absent means \"applies\" — a surface with no provider filters as it always has.\n */\nexport const APPLIES_CONDITION_FILTER_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"appliesConditionFilter\");\n\nexport const FONTS_MANAGER_KEY: InjectionKey<UseFontsReturn> =\n Symbol(\"fontsManager\");\n\nexport const THEME_STYLES_KEY: InjectionKey<\n ComputedRef<Record<string, string>>\n> = Symbol(\"themeStyles\");\n\nexport const UI_THEME_KEY: InjectionKey<ComputedRef<string>> =\n Symbol(\"tplUiTheme\");\n\n/**\n * The editor's UI locale, exactly as the consumer passed it to\n * `init({ locale })` — unresolved, so it may be unsupported or malformed.\n *\n * For `Intl` formatting only. Translated *strings* come from\n * `TRANSLATIONS_KEY`, which is already resolved to a supported bundle; this is\n * for the labels `Intl` builds itself (dates), where the browser's own locale\n * would otherwise win and disagree with the surrounding chrome. Always format\n * through `formatAbsoluteDateTime`, which guards the malformed case.\n *\n * Not the template's `settings.locale` — that is the *email's* language and\n * belongs to content, not chrome.\n */\nexport const UI_LOCALE_KEY: InjectionKey<string | undefined> =\n Symbol(\"tplUiLocale\");\n\n// A ref, not a plain object: the recipient-facing half of these defaults\n// (video alt, countdown labels) tracks the template's own `settings.locale`,\n// which the author can change while the editor is open. Read it at insert\n// time — a value destructured at setup goes stale.\nexport const BLOCK_DEFAULTS_KEY: InjectionKey<ComputedRef<BlockDefaults>> =\n Symbol(\"blockDefaults\");\n\nexport const BLOCK_REGISTRY_KEY: InjectionKey<UseBlockRegistryReturn> =\n Symbol(\"blockRegistry\");\n\nexport const CUSTOM_BLOCK_DEFINITIONS_KEY: InjectionKey<\n CustomBlockDefinition[]\n> = Symbol(\"customBlockDefinitions\");\n\n/**\n * Consumer-supplied block-palette allowlist + order (`config.paletteBlocks`).\n * `undefined` means the default full palette. Consumed by `Sidebar.vue`.\n */\nexport const PALETTE_BLOCKS_KEY: InjectionKey<string[] | undefined> =\n Symbol(\"paletteBlocks\");\n\n/**\n * Whether HTML blocks render a live sandboxed-iframe preview in the canvas\n * (`config.htmlBlockPreview`), normalized to a boolean. `false` (the default)\n * keeps the static placeholder card. Consumed by `HtmlBlock.vue`.\n */\nexport const HTML_BLOCK_PREVIEW_KEY: InjectionKey<boolean> =\n Symbol(\"htmlBlockPreview\");\n\n/**\n * Embedder layout overlay (`config.layout`). Provided by `useEditorCore`.\n * `undefined` when the host configured none. Consumed by preview surfaces\n * and the section toolbar; never written into editor content.\n */\nexport const LAYOUT_KEY: InjectionKey<TemplateContent | undefined> =\n Symbol(\"layout\");\n\n/**\n * Whether the section toolbar offers Add wrapper (`config.sectionWrapper`).\n * Provided by `useEditorCore`. `undefined` when the host configured none,\n * which is on (`!== false`). Consumed by `SectionToolbar`. Own key — not\n * folded into `LAYOUT_KEY`.\n */\nexport const SECTION_WRAPPER_KEY: InjectionKey<boolean | undefined> =\n Symbol(\"sectionWrapper\");\n\n/**\n * Consumer-supplied color-picker palette (`config.colors`), normalized to\n * `{ presets, allowCustom, allowCustomIgnored }` by `resolveColorsConfig`.\n * Provided by `useEditorCore`, consumed by every `ColorPicker`. The inject\n * default (`DEFAULT_RESOLVED_COLORS` = `{ presets: [], allowCustom: true,\n * allowCustomIgnored: false }`) makes an unconfigured picker render exactly\n * as before.\n */\nexport const COLORS_KEY: InjectionKey<\n import(\"./utils/resolveColorsConfig\").ResolvedColors\n> = Symbol(\"colors\");\n\n/**\n * The template settings the panel may render (`config.templateSettings.fields`),\n * resolved to a set of `TemplateSettings` member names by\n * `resolveTemplateSettingsFields`. Provided by `useEditorCore`, consumed by\n * `TemplateSettings.vue` for its cards and by `RightSidebar.vue` for the\n * Settings tab.\n *\n * Consumers inject with `ALL_TEMPLATE_SETTINGS_FIELDS` as the default, never an\n * empty set: the key is absent for anyone who configured nothing, and this\n * config only ever narrows.\n */\nexport const TEMPLATE_SETTINGS_FIELDS_KEY: InjectionKey<\n ReadonlySet<import(\"./utils/templateSettingsFields\").TemplateSettingsField>\n> = Symbol(\"templateSettingsFields\");\n\nexport const CUSTOM_BLOCK_STYLESHEETS_KEY: InjectionKey<ComputedRef<string[]>> =\n Symbol(\"customBlockStylesheets\");\n\n/**\n * The configured merge tags, as a ref so `editor.setMergeTags()` repaints\n * everything that renders one. `useEditorCore` is the only writer.\n *\n * `shallowRef`, not `ref`: the list is replaced wholesale, and a deep proxy\n * would make an in-place `push` by a consumer holding the original array\n * behave differently from the same push today. Consumers must go through\n * `setMergeTags`.\n */\nexport const MERGE_TAGS_KEY: InjectionKey<ShallowRef<MergeTag[]>> =\n Symbol(\"mergeTags\");\n\n/**\n * Inject default for {@link MERGE_TAGS_KEY} — headless callers and tests mount\n * components with no editor above them. Shared rather than allocated per call,\n * and never written: an editor always provides its own ref.\n */\nexport const NO_MERGE_TAGS: ShallowRef<MergeTag[]> = shallowRef([]);\n\nexport const MERGE_TAG_SYNTAX_KEY: InjectionKey<SyntaxPreset> =\n Symbol(\"mergeTagSyntax\");\n\nexport const ON_REQUEST_MERGE_TAG_KEY: InjectionKey<\n ((context?: MergeTagRequestContext) => Promise<MergeTag | null>) | null\n> = Symbol(\"onRequestMergeTag\");\n\nexport const MERGE_TAG_AUTOCOMPLETE_KEY: InjectionKey<boolean> = Symbol(\n \"mergeTagAutocomplete\",\n);\n\n/**\n * Whether a merge tag's tooltip reveals the raw token behind its label.\n * Resolved once from `mergeTags.showRawValue` and read by every surface that\n * renders a tag, so a chip in a sidebar field and a chip on the canvas cannot\n * disagree about whether the token is visible.\n */\nexport const MERGE_TAG_SHOW_RAW_VALUE_KEY: InjectionKey<boolean> = Symbol(\n \"mergeTagShowRawValue\",\n);\n\n/**\n * The user's choice between the previews' two merge-tag views: `true` for\n * Sample (tags replaced by their `MergeTag.sample`, rendered as ordinary text)\n * and `false` for Label (tags shown as their label with the usual cue).\n *\n * Session state owned by `useEditorCore` and driven by a toggle that exists\n * only on preview surfaces. Defaults to Sample.\n */\nexport const MERGE_TAG_SAMPLE_MODE_KEY: InjectionKey<Ref<boolean>> =\n Symbol(\"mergeTagSampleMode\");\n\n/**\n * Whether **the current render surface** substitutes samples.\n *\n * Provided per surface rather than globally, and that is the whole point:\n * substitution must never happen while editing, so `Canvas.vue` folds in its\n * `previewMode` flag and provides `false` whenever the canvas is editable, no\n * matter what the mode ref says. Preview surfaces provide the mode directly.\n *\n * Block components inject **this** key. They must never read\n * `MERGE_TAG_SAMPLE_MODE_KEY`, which would bypass the editing guard.\n */\nexport const USE_MERGE_TAG_SAMPLES_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"useMergeTagSamples\");\n\n/**\n * Whether **the current render surface** is showing content a `resolvePreview`\n * hook returned, rather than the template itself.\n *\n * Provided per surface, like `USE_MERGE_TAG_SAMPLES_KEY`: `Canvas.vue` folds in\n * its `previewMode`, and `BlockPreviewCanvas` takes it as a prop because the\n * test-email dialog owns a separate resolution instance. Rich text reads it to\n * render the tags a host resolved in place as plain text\n * (`unwrapHtmlResolvedMergeTags`). Absent means `false`.\n */\nexport const SHOWS_RESOLVED_PREVIEW_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"showsResolvedPreview\");\n\n/** Whether this block-rendering surface permits edits to the live template. */\nexport const READ_ONLY_SURFACE_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"readOnlySurface\");\n\n/**\n * The `resolvePreview` seam — resolved content plus its loading and failure\n * state. Provided by `useEditorCore` so every preview surface shares one\n * lifecycle; `null` when the consumer configured no hook.\n *\n * Surfaces read `content` from here instead of `editor.content`, and gate the\n * Sample/Label toggle on `supersedesSamples`.\n */\n/**\n * The raw `config.resolvePreview` hook.\n *\n * Provided alongside PREVIEW_RESOLUTION_KEY because the test-email dialog needs\n * its **own** resolution instance — it resolves for the selected recipient,\n * which the editor's canvas has no notion of — and so cannot reuse the shared\n * one. `undefined` when the consumer configured no hook.\n */\nexport const RESOLVE_PREVIEW_KEY: InjectionKey<ResolvePreview | undefined> =\n Symbol(\"resolvePreview\");\n\n/** Registers the dialog's resolver as the topmost preview while it is open. */\nexport const REGISTER_DIALOG_PREVIEW_REFRESH_KEY: InjectionKey<\n (refresh: () => void) => () => void\n> = Symbol(\"registerDialogPreviewRefresh\");\n\nexport const PREVIEW_RESOLUTION_KEY: InjectionKey<\n import(\"./composables/usePreviewResolution\").UsePreviewResolutionReturn | null\n> = Symbol(\"previewResolution\");\n\n/**\n * Singleton state for the built-in merge tag picker modal. Provided by\n * `useEditorCore`, consumed by `useMergeTag.requestMergeTag()` (to open\n * the modal as a fall-through when only `mergeTags.tags` is configured)\n * and by `MergeTagPickerModal.vue` (to render and resolve).\n */\nexport const MERGE_TAG_PICKER_KEY: InjectionKey<\n import(\"./composables/useMergeTagPicker\").UseMergeTagPickerReturn\n> = Symbol(\"mergeTagPicker\");\n\n/**\n * One \"a merge tag request is in flight\" flag per editor, provided by\n * `useEditorCore` and injected by every `useMergeTag()` call.\n *\n * Shared, not per-call: `useRichTextEditor.handleClickOutside` suppresses\n * editor teardown while this is set, because the picker modal mounts in the\n * popover root — outside `.tpl-text-editor-wrapper`. A ref private to one\n * `useMergeTag()` instance leaves that guard blind to a picker opened from\n * any other host (the link dialog's URL field), so the click on a picker row\n * tears the block out of edit mode and the pending insert then no-ops on its\n * own disposal guard. Falls back to a private ref for headless callers.\n */\nexport const MERGE_TAG_REQUESTING_KEY: InjectionKey<Ref<boolean>> =\n Symbol(\"mergeTagRequesting\");\n\n/** Logic-tag counterpart of {@link MERGE_TAG_REQUESTING_KEY}. */\nexport const LOGIC_TAG_REQUESTING_KEY: InjectionKey<Ref<boolean>> =\n Symbol(\"logicTagRequesting\");\n\n// ---------------------------------------------------------------------------\n// Logic tags — a standalone feature, separate from merge tags. Native\n// highlighting (LogicMergeTagNode) is always on; these drive the dedicated\n// logic picker + insertion.\n// ---------------------------------------------------------------------------\n\nexport const LOGIC_TAGS_KEY: InjectionKey<LogicTag[]> = Symbol(\"logicTags\");\n\nexport const LOGIC_PAIRS_KEY: InjectionKey<LogicPair[]> = Symbol(\"logicPairs\");\n\n/**\n * Singleton state for the built-in logic picker modal. Provided by\n * `useEditorCore`, consumed by `useLogicTag.requestLogicTag()` (to open the modal)\n * and by `LogicTagPickerModal.vue` (to render and resolve).\n */\nexport const LOGIC_TAG_PICKER_KEY: InjectionKey<\n import(\"./composables/useLogicTagPicker\").UseLogicTagPickerReturn\n> = Symbol(\"logicPicker\");\n\nexport const ON_REQUEST_LOGIC_TAG_KEY: InjectionKey<\n (() => Promise<LogicTag | LogicPair | null>) | null\n> = Symbol(\"onRequestLogic\");\n\nexport const ON_REQUEST_MEDIA_KEY: InjectionKey<OnRequestMedia | null> =\n Symbol(\"onRequestMedia\");\n\n/**\n * Whether a dropped image file may be uploaded. Distinct from Browse: a\n * read-only provider (`create: false`) still opens the library, but the\n * drop zone must not highlight. True when a host `onRequestMedia` is set\n * (the callback receives `files`) or when `provider.create` is a function.\n *\n * `null` when neither a provider nor a callback is configured — image\n * fields stay URL-only and drop is off. Injected as a computed; consumed\n * by `useMediaDropField` with a `null` default.\n */\nexport const CAN_DROP_MEDIA_KEY: InjectionKey<ComputedRef<boolean> | null> =\n Symbol(\"canDropMedia\");\n\n/**\n * Per-editor display-only image URL resolver (`config.resolveImageUrl`),\n * wrapped with a per-src cache by `createImageUrlResolver`. `null` when the\n * host doesn't resolve — the canvas then displays canonical src values\n * verbatim. Consumed via `useResolvedImageSrc` in image-displaying blocks.\n */\nexport const IMAGE_URL_RESOLVER_KEY: InjectionKey<ImageUrlResolver | null> =\n Symbol(\"imageUrlResolver\");\n\nexport const DISPLAY_CONDITIONS_KEY: InjectionKey<DisplayCondition[]> =\n Symbol(\"displayConditions\");\n\nexport const ALLOW_CUSTOM_CONDITIONS_KEY: InjectionKey<boolean> = Symbol(\n \"allowCustomConditions\",\n);\n\nexport const ON_REQUEST_DISPLAY_CONDITION_KEY: InjectionKey<\n | ((\n context: DisplayConditionRequestContext,\n ) => Promise<DisplayCondition | null>)\n | null\n> = Symbol(\"onRequestDisplayCondition\");\n\nexport const CAPABILITIES_KEY: InjectionKey<EditorCapabilities> =\n Symbol(\"capabilities\");\n\nexport const KEYBOARD_REORDER_KEY: InjectionKey<UseKeyboardReorderReturn> =\n Symbol(\"keyboardReorder\");\n\nexport const TEMPLATE_LINT_KEY: InjectionKey<\n import(\"./composables/useTemplateLint\").UseTemplateLintReturn | null\n> = Symbol(\"templateLint\");\n\nexport interface SizeCheckContext {\n renderHtml: () => Promise<string>;\n canRenderHtml: () => boolean;\n cloud: boolean;\n options: import(\"@templatical/quality\").LintOptions;\n}\n\nexport const SIZE_CHECK_KEY: InjectionKey<SizeCheckContext> =\n Symbol(\"sizeCheck\");\n\n/**\n * The editor's effective DOM root — `Document` in light-DOM mode, `ShadowRoot`\n * when `shadowDom: true`. Composables that read `document.activeElement`,\n * popup mount targets, etc. should inject this and use the root-aware API\n * (both `Document` and `ShadowRoot` expose `activeElement` etc.).\n */\nexport const EDITOR_ROOT_KEY: InjectionKey<Document | ShadowRoot> =\n Symbol(\"editorRoot\");\n\n/**\n * Mount target for popovers, toolbars, and modal dialogs — never\n * `document.body`. Provided by `useEditorCore` as a ref bound\n * to a `<div class=\"tpl-popover-root\" />` rendered at the top level of the\n * editor template. Teleports use `:to=\"popoverRoot\"` so popups land inside\n * the editor's effective root — `document` in light-DOM mode, `ShadowRoot`\n * when `shadowDom: true` — instead of escaping the shadow boundary.\n *\n * Null until the editor's template mounts; consumers must guard with\n * `v-if=\"popoverRoot\"` before passing to `<Teleport>`.\n */\nexport const POPOVER_ROOT_KEY: InjectionKey<Ref<HTMLElement | null>> =\n Symbol(\"popoverRoot\");\n\n/**\n * Reactive saved-blocks state, provided by `useSavedBlocksFeature` when a\n * `SavedBlocksProvider` is configured. Shared by OSS and Cloud — the storage\n * transport lives behind the provider, so this key is not cloud-specific.\n */\nexport const SAVED_BLOCKS_KEY: InjectionKey<UseSavedBlocksReturn> =\n Symbol(\"savedBlocks\");\n\n// ---------------------------------------------------------------------------\n// Cloud-only keys (provided by createCloudRuntime, consumed by cloud components)\n// ---------------------------------------------------------------------------\n\nexport const AUTH_MANAGER_KEY: InjectionKey<AuthManager> =\n Symbol(\"authManager\");\n\n// Comments are deliberately not injected: the panel takes `useCommentsFeature`'s\n// return as a **prop** the way `TestEmailPanel` and `SavedBlocksPanels` do, and the\n// per-block indicators read the comments entry on `CAPABILITIES_KEY`. Nothing\n// injects the composable itself.\n\nexport const CLOUD_TRANSLATIONS_KEY: InjectionKey<CloudTranslations> =\n Symbol(\"cloudTranslations\");\n\n// ---------------------------------------------------------------------------\n// Helper for required injections with explicit null default + throw\n// ---------------------------------------------------------------------------\n\nexport function requireInject<T>(\n key: InjectionKey<T>,\n componentName: string,\n): T {\n const value = inject(key, null) as T | null;\n if (value === null || value === undefined) {\n throw new Error(\n `${componentName} requires a provider for ${key.description ?? \"unknown key\"}. Ensure it renders inside the editor, below Editor.vue.`,\n );\n }\n return value;\n}\n"],"mappings":";;AA2CA,IAAaE,IACX,OAAO,cAAc,GAMVC,IAET,OAAO,mBAAmB,GAEjBC,IAOT,OAAO,cAAc,GAGZC,IAET,OAAO,uBAAuB,GAErBC,IAA6C,OAAO,QAAQ,GAM5DC,IACX,OAAO,WAAW,GAEPC,IAET,OAAO,oBAAoB,GAOlBC,IAET,OAAO,sBAAsB,GAOpBC,IACX,OAAO,kBAAkB,GAEdC,IAET,OAAO,eAAe,GAEbC,IAA8C,OAAO,SAAS,GAE9DC,IACX,OAAO,cAAc,GAEVC,IACX,OAAO,kBAAkB,GAWdC,IACX,OAAO,wBAAwB,GAEpBC,IACX,OAAO,cAAc,GAEVC,IAET,OAAO,aAAa,GAEXC,IACX,OAAO,YAAY,GAeRC,IACX,OAAO,aAAa,GAMTC,IACX,OAAO,eAAe,GAEXC,IACX,OAAO,eAAe,GAEXC,IAET,OAAO,wBAAwB,GAMtBC,IACX,OAAO,eAAe,GAOXC,IACX,OAAO,kBAAkB,GAOdC,IACX,OAAO,QAAQ,GAQJC,IACX,OAAO,gBAAgB,GAUZC,IAET,OAAO,QAAQ,GAaNC,IAET,OAAO,wBAAwB,GAEtBC,IACX,OAAO,wBAAwB,GAWpBC,IACX,OAAO,WAAW,GAOPC,IAAwC9B,EAAW,CAAC,CAAC,GAErD+B,KACX,OAAO,gBAAgB,GAEZC,IAET,OAAO,mBAAmB,GAEjBC,IAAoD,OAC/D,sBACF,GAQaC,IAAsD,OACjE,sBACF,GAUaC,IACX,OAAO,oBAAoB,GAahBC,IACX,OAAO,oBAAoB,GAYhBC,IACX,OAAO,sBAAsB,GAGlBC,IACX,OAAO,iBAAiB,GAkBbC,IACX,OAAO,gBAAgB,GAGZC,IAET,OAAO,8BAA8B,GAE5BC,IAET,OAAO,mBAAmB,GAQjBC,IAET,OAAO,gBAAgB,GAcdC,IACX,OAAO,oBAAoB,GAGhBC,IACX,OAAO,oBAAoB,GAQhBC,IAA2C,OAAO,WAAW,GAE7DC,IAA6C,OAAO,YAAY,GAOhEC,IAET,OAAO,aAAa,GAEXC,IAET,OAAO,gBAAgB,GAEdC,IACX,OAAO,gBAAgB,GAYZC,IACX,OAAO,cAAc,GAQVC,IACX,OAAO,kBAAkB,GAEdC,IACX,OAAO,mBAAmB,GAEfC,IAAqD,OAChE,uBACF,GAEaC,KAKT,OAAO,2BAA2B,GAEzBC,KACX,OAAO,cAAc,GAEVC,KACX,OAAO,iBAAiB,GAEbC,KAET,OAAO,cAAc,GASZC,KACX,OAAO,WAAW,GAQPC,KACX,OAAO,YAAY,GAaRC,KACX,OAAO,aAAa,GAOTC,KACX,OAAO,aAAa,GAMTC,KACX,OAAO,aAAa,GAOTC,KACX,OAAO,mBAAmB;AAM5B,SAAgBC,GACd,GACA,GACG;CACH,IAAMC,IAAQlE,EAAOmE,GAAK,IAAI;CAC9B,IAAID,KAAU,MACZ,MAAU,MACR,GAAGE,EAAc,2BAA2BD,EAAI,eAAe,cAAc,yDAC/E;CAEF,OAAOD;AACT"}
|
|
1
|
+
{"version":3,"file":"useI18n-DwP1ksBW.js","names":["inject","isRef","shallowRef","TRANSLATIONS_KEY","LOCALE_CHIP_OPENERS_KEY","LOCALIZATION_KEY","ANCESTOR_HIDDEN_LOCALES_KEY","EDITOR_KEY","AI_FEATURE_KEY","TRANSLATION_FEATURE_KEY","ACTIVE_LOCALE_COVERAGE_KEY","LOCALIZED_CONTENT_KEY","LOCALE_ACTIONS_KEY","HISTORY_KEY","BLOCK_ACTIONS_KEY","CONDITION_PREVIEW_KEY","APPLIES_CONDITION_FILTER_KEY","FONTS_MANAGER_KEY","THEME_STYLES_KEY","UI_THEME_KEY","UI_LOCALE_KEY","BLOCK_DEFAULTS_KEY","BLOCK_REGISTRY_KEY","CUSTOM_BLOCK_DEFINITIONS_KEY","PALETTE_BLOCKS_KEY","HTML_BLOCK_PREVIEW_KEY","LAYOUT_KEY","SECTION_WRAPPER_KEY","COLORS_KEY","TEMPLATE_SETTINGS_FIELDS_KEY","CUSTOM_BLOCK_STYLESHEETS_KEY","MERGE_TAGS_KEY","NO_MERGE_TAGS","MERGE_TAG_SYNTAX_KEY","ON_REQUEST_MERGE_TAG_KEY","MERGE_TAG_AUTOCOMPLETE_KEY","MERGE_TAG_SHOW_RAW_VALUE_KEY","MERGE_TAG_SAMPLE_MODE_KEY","USE_MERGE_TAG_SAMPLES_KEY","SHOWS_RESOLVED_PREVIEW_KEY","READ_ONLY_SURFACE_KEY","RESOLVE_PREVIEW_KEY","REGISTER_DIALOG_PREVIEW_REFRESH_KEY","PREVIEW_RESOLUTION_KEY","MERGE_TAG_PICKER_KEY","MERGE_TAG_REQUESTING_KEY","LOGIC_TAG_REQUESTING_KEY","LOGIC_TAGS_KEY","LOGIC_PAIRS_KEY","LOGIC_TAG_PICKER_KEY","ON_REQUEST_LOGIC_TAG_KEY","ON_REQUEST_MEDIA_KEY","CAN_DROP_MEDIA_KEY","IMAGE_URL_RESOLVER_KEY","DISPLAY_CONDITIONS_KEY","ALLOW_CUSTOM_CONDITIONS_KEY","ON_REQUEST_DISPLAY_CONDITION_KEY","CAPABILITIES_KEY","KEYBOARD_REORDER_KEY","TEMPLATE_LINT_KEY","SIZE_CHECK_KEY","EDITOR_ROOT_KEY","POPOVER_ROOT_KEY","SAVED_BLOCKS_KEY","requireInject","value","key","componentName","useI18n","injected","translationsOverride","t","format","template","values"],"sources":["../../../src/keys.ts","../../../src/composables/useI18n.ts"],"sourcesContent":["import {\n inject,\n shallowRef,\n type InjectionKey,\n type ComputedRef,\n type Ref,\n type ShallowRef,\n} from \"vue\";\nimport type {\n UseHistoryReturn,\n UseBlockActionsReturn,\n UseConditionPreviewReturn,\n} from \"@templatical/core\";\nimport type {\n BlockDefaults,\n CustomBlockDefinition,\n DisplayCondition,\n DisplayConditionRequestContext,\n LocaleCoverage,\n LogicPair,\n LogicTag,\n MergeTag,\n MergeTagRequestContext,\n ResolvePreview,\n SyntaxPreset,\n TemplateContent,\n} from \"@templatical/types\";\nimport type { Translations } from \"./i18n\";\nimport type { UseSavedBlocksReturn } from \"@templatical/core\";\nimport type { BaseEditorReturn } from \"./composables/useEditorCore\";\nimport type { ImageUrlResolver } from \"./composables/useImageUrlResolver\";\nimport type { UseFontsReturn } from \"./composables/useFonts\";\nimport type { UseAiFeatureReturn } from \"./composables/useAiFeature\";\nimport type { UseBlockRegistryReturn } from \"./composables/useBlockRegistry\";\nimport type { UseKeyboardReorderReturn } from \"./composables/useKeyboardReorder\";\nimport type { EditorCapabilities } from \"./types/editor-capabilities\";\nimport type { OnRequestMedia } from \"./index\";\n\n// ---------------------------------------------------------------------------\n// Shared keys (provided by useEditorCore, consumed by all components)\n// ---------------------------------------------------------------------------\n\nexport const TRANSLATIONS_KEY: InjectionKey<Translations> =\n Symbol(\"translations\");\n\n/** The states a block's status popover can explain for a localization finding. */\nexport type LocaleChipTarget = \"missing\" | \"stale\" | \"tags-differ\";\n\n/** Opens a block's status popover, on a finding's own state when given. */\nexport const LOCALE_CHIP_OPENERS_KEY: InjectionKey<\n Map<string, (target?: LocaleChipTarget) => void>\n> = Symbol(\"localeChipOpeners\");\n\nexport const LOCALIZATION_KEY: InjectionKey<\n | {\n locales: string[];\n doNotTranslate?: string[];\n languageNames?: Record<string, string>;\n }\n | undefined\n> = Symbol(\"localization\");\n\n/** Languages in which an ancestor section excludes its descendants. */\nexport const ANCESTOR_HIDDEN_LOCALES_KEY: InjectionKey<\n ComputedRef<ReadonlySet<string>>\n> = Symbol(\"ancestorHiddenLocales\");\n\nexport const EDITOR_KEY: InjectionKey<BaseEditorReturn> = Symbol(\"editor\");\n\n/**\n * The AI feature, for chrome deep in the tree (the paragraph toolbar's\n * rewrite menu). Provided by `Editor.vue` only while an `ai` provider is set.\n */\nexport const AI_FEATURE_KEY: InjectionKey<UseAiFeatureReturn> =\n Symbol(\"aiFeature\");\n\nexport const TRANSLATION_FEATURE_KEY: InjectionKey<\n import(\"./composables/useTranslationFeature\").UseTranslationFeatureReturn\n> = Symbol(\"translationFeature\");\n\n/**\n * The active language view's coverage, `null` in the default view. One pass\n * per change serves the header trigger, the language bar and its Translate\n * counts. Provided by `Editor.vue`.\n */\nexport const ACTIVE_LOCALE_COVERAGE_KEY: InjectionKey<\n ComputedRef<LocaleCoverage | null>\n> = Symbol(\"activeLocaleCoverage\");\n\n/**\n * The active language's projection of the whole template, one per change for\n * the few readers that need all of it (a \"match image\" hero's band width).\n * Provided by `Editor.vue`.\n */\nexport const LOCALIZED_CONTENT_KEY: InjectionKey<ComputedRef<TemplateContent>> =\n Symbol(\"localizedContent\");\n\nexport const LOCALE_ACTIONS_KEY: InjectionKey<\n import(\"./composables/useLocaleActions\").UseLocaleActionsReturn\n> = Symbol(\"localeActions\");\n\nexport const HISTORY_KEY: InjectionKey<UseHistoryReturn> = Symbol(\"history\");\n\nexport const BLOCK_ACTIONS_KEY: InjectionKey<UseBlockActionsReturn> =\n Symbol(\"blockActions\");\n\nexport const CONDITION_PREVIEW_KEY: InjectionKey<UseConditionPreviewReturn> =\n Symbol(\"conditionPreview\");\n\n/**\n * Whether the hand-toggled display-condition filter applies on this surface —\n * provided per-surface, exactly like `USE_MERGE_TAG_SAMPLES_KEY`, and for the\n * same reason: the rule folds in both `previewMode` and whether a resolver owns\n * the preview, so a component that re-derived it from `CONDITION_PREVIEW_KEY`\n * plus the editor's `previewMode` could get one half wrong on its own.\n *\n * Absent means \"applies\" — a surface with no provider filters as it always has.\n */\nexport const APPLIES_CONDITION_FILTER_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"appliesConditionFilter\");\n\nexport const FONTS_MANAGER_KEY: InjectionKey<UseFontsReturn> =\n Symbol(\"fontsManager\");\n\nexport const THEME_STYLES_KEY: InjectionKey<\n ComputedRef<Record<string, string>>\n> = Symbol(\"themeStyles\");\n\nexport const UI_THEME_KEY: InjectionKey<ComputedRef<string>> =\n Symbol(\"tplUiTheme\");\n\n/**\n * The editor's UI locale, exactly as the consumer passed it to\n * `init({ locale })` — unresolved, so it may be unsupported or malformed.\n *\n * For `Intl` formatting only. Translated *strings* come from\n * `TRANSLATIONS_KEY`, which is already resolved to a supported bundle; this is\n * for the labels `Intl` builds itself (dates), where the browser's own locale\n * would otherwise win and disagree with the surrounding chrome. Always format\n * through `formatAbsoluteDateTime`, which guards the malformed case.\n *\n * Not the template's `settings.locale` — that is the *email's* language and\n * belongs to content, not chrome.\n */\nexport const UI_LOCALE_KEY: InjectionKey<string | undefined> =\n Symbol(\"tplUiLocale\");\n\n// A ref, not a plain object: the recipient-facing half of these defaults\n// (video alt, countdown labels) tracks the template's own `settings.locale`,\n// which the author can change while the editor is open. Read it at insert\n// time — a value destructured at setup goes stale.\nexport const BLOCK_DEFAULTS_KEY: InjectionKey<ComputedRef<BlockDefaults>> =\n Symbol(\"blockDefaults\");\n\nexport const BLOCK_REGISTRY_KEY: InjectionKey<UseBlockRegistryReturn> =\n Symbol(\"blockRegistry\");\n\nexport const CUSTOM_BLOCK_DEFINITIONS_KEY: InjectionKey<\n CustomBlockDefinition[]\n> = Symbol(\"customBlockDefinitions\");\n\n/**\n * Consumer-supplied block-palette allowlist + order (`config.paletteBlocks`).\n * `undefined` means the default full palette. Consumed by `Sidebar.vue`.\n */\nexport const PALETTE_BLOCKS_KEY: InjectionKey<string[] | undefined> =\n Symbol(\"paletteBlocks\");\n\n/**\n * Whether HTML blocks render a live sandboxed-iframe preview in the canvas\n * (`config.htmlBlockPreview`), normalized to a boolean. `false` (the default)\n * keeps the static placeholder card. Consumed by `HtmlBlock.vue`.\n */\nexport const HTML_BLOCK_PREVIEW_KEY: InjectionKey<boolean> =\n Symbol(\"htmlBlockPreview\");\n\n/**\n * Embedder layout overlay (`config.layout`). Provided by `useEditorCore`.\n * `undefined` when the host configured none. Consumed by preview surfaces\n * and the section toolbar; never written into editor content.\n */\nexport const LAYOUT_KEY: InjectionKey<TemplateContent | undefined> =\n Symbol(\"layout\");\n\n/**\n * Whether the section toolbar offers Add wrapper (`config.sectionWrapper`).\n * Provided by `useEditorCore`. `undefined` when the host configured none,\n * which is on (`!== false`). Consumed by `SectionToolbar`. Own key — not\n * folded into `LAYOUT_KEY`.\n */\nexport const SECTION_WRAPPER_KEY: InjectionKey<boolean | undefined> =\n Symbol(\"sectionWrapper\");\n\n/**\n * Consumer-supplied color-picker palette (`config.colors`), normalized to\n * `{ presets, allowCustom, allowCustomIgnored }` by `resolveColorsConfig`.\n * Provided by `useEditorCore`, consumed by every `ColorPicker`. The inject\n * default (`DEFAULT_RESOLVED_COLORS` = `{ presets: [], allowCustom: true,\n * allowCustomIgnored: false }`) makes an unconfigured picker render exactly\n * as before.\n */\nexport const COLORS_KEY: InjectionKey<\n import(\"./utils/resolveColorsConfig\").ResolvedColors\n> = Symbol(\"colors\");\n\n/**\n * The template settings the panel may render (`config.templateSettings.fields`),\n * resolved to a set of `TemplateSettings` member names by\n * `resolveTemplateSettingsFields`. Provided by `useEditorCore`, consumed by\n * `TemplateSettings.vue` for its cards and by `RightSidebar.vue` for the\n * Settings tab.\n *\n * Consumers inject with `ALL_TEMPLATE_SETTINGS_FIELDS` as the default, never an\n * empty set: the key is absent for anyone who configured nothing, and this\n * config only ever narrows.\n */\nexport const TEMPLATE_SETTINGS_FIELDS_KEY: InjectionKey<\n ReadonlySet<import(\"./utils/templateSettingsFields\").TemplateSettingsField>\n> = Symbol(\"templateSettingsFields\");\n\nexport const CUSTOM_BLOCK_STYLESHEETS_KEY: InjectionKey<ComputedRef<string[]>> =\n Symbol(\"customBlockStylesheets\");\n\n/**\n * The configured merge tags, as a ref so `editor.setMergeTags()` repaints\n * everything that renders one. `useEditorCore` is the only writer.\n *\n * `shallowRef`, not `ref`: the list is replaced wholesale, and a deep proxy\n * would make an in-place `push` by a consumer holding the original array\n * behave differently from the same push today. Consumers must go through\n * `setMergeTags`.\n */\nexport const MERGE_TAGS_KEY: InjectionKey<ShallowRef<MergeTag[]>> =\n Symbol(\"mergeTags\");\n\n/**\n * Inject default for {@link MERGE_TAGS_KEY} — headless callers and tests mount\n * components with no editor above them. Shared rather than allocated per call,\n * and never written: an editor always provides its own ref.\n */\nexport const NO_MERGE_TAGS: ShallowRef<MergeTag[]> = shallowRef([]);\n\nexport const MERGE_TAG_SYNTAX_KEY: InjectionKey<SyntaxPreset> =\n Symbol(\"mergeTagSyntax\");\n\nexport const ON_REQUEST_MERGE_TAG_KEY: InjectionKey<\n ((context?: MergeTagRequestContext) => Promise<MergeTag | null>) | null\n> = Symbol(\"onRequestMergeTag\");\n\nexport const MERGE_TAG_AUTOCOMPLETE_KEY: InjectionKey<boolean> = Symbol(\n \"mergeTagAutocomplete\",\n);\n\n/**\n * Whether a merge tag's tooltip reveals the raw token behind its label.\n * Resolved once from `mergeTags.showRawValue` and read by every surface that\n * renders a tag, so a chip in a sidebar field and a chip on the canvas cannot\n * disagree about whether the token is visible.\n */\nexport const MERGE_TAG_SHOW_RAW_VALUE_KEY: InjectionKey<boolean> = Symbol(\n \"mergeTagShowRawValue\",\n);\n\n/**\n * The user's choice between the previews' two merge-tag views: `true` for\n * Sample (tags replaced by their `MergeTag.sample`, rendered as ordinary text)\n * and `false` for Label (tags shown as their label with the usual cue).\n *\n * Session state owned by `useEditorCore` and driven by a toggle that exists\n * only on preview surfaces. Defaults to Sample.\n */\nexport const MERGE_TAG_SAMPLE_MODE_KEY: InjectionKey<Ref<boolean>> =\n Symbol(\"mergeTagSampleMode\");\n\n/**\n * Whether **the current render surface** substitutes samples.\n *\n * Provided per surface rather than globally, and that is the whole point:\n * substitution must never happen while editing, so `Canvas.vue` folds in its\n * `previewMode` flag and provides `false` whenever the canvas is editable, no\n * matter what the mode ref says. Preview surfaces provide the mode directly.\n *\n * Block components inject **this** key. They must never read\n * `MERGE_TAG_SAMPLE_MODE_KEY`, which would bypass the editing guard.\n */\nexport const USE_MERGE_TAG_SAMPLES_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"useMergeTagSamples\");\n\n/**\n * Whether **the current render surface** is showing content a `resolvePreview`\n * hook returned, rather than the template itself.\n *\n * Provided per surface, like `USE_MERGE_TAG_SAMPLES_KEY`: `Canvas.vue` folds in\n * its `previewMode`, and `BlockPreviewCanvas` takes it as a prop because the\n * test-email dialog owns a separate resolution instance. Rich text reads it to\n * render the tags a host resolved in place as plain text\n * (`unwrapHtmlResolvedMergeTags`). Absent means `false`.\n */\nexport const SHOWS_RESOLVED_PREVIEW_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"showsResolvedPreview\");\n\n/** Whether this block-rendering surface permits edits to the live template. */\nexport const READ_ONLY_SURFACE_KEY: InjectionKey<ComputedRef<boolean>> =\n Symbol(\"readOnlySurface\");\n\n/**\n * The `resolvePreview` seam — resolved content plus its loading and failure\n * state. Provided by `useEditorCore` so every preview surface shares one\n * lifecycle; `null` when the consumer configured no hook.\n *\n * Surfaces read `content` from here instead of `editor.content`, and gate the\n * Sample/Label toggle on `supersedesSamples`.\n */\n/**\n * The raw `config.resolvePreview` hook.\n *\n * Provided alongside PREVIEW_RESOLUTION_KEY because the test-email dialog needs\n * its **own** resolution instance — it resolves for the selected recipient,\n * which the editor's canvas has no notion of — and so cannot reuse the shared\n * one. `undefined` when the consumer configured no hook.\n */\nexport const RESOLVE_PREVIEW_KEY: InjectionKey<ResolvePreview | undefined> =\n Symbol(\"resolvePreview\");\n\n/** Registers the dialog's resolver as the topmost preview while it is open. */\nexport const REGISTER_DIALOG_PREVIEW_REFRESH_KEY: InjectionKey<\n (refresh: () => void) => () => void\n> = Symbol(\"registerDialogPreviewRefresh\");\n\nexport const PREVIEW_RESOLUTION_KEY: InjectionKey<\n import(\"./composables/usePreviewResolution\").UsePreviewResolutionReturn | null\n> = Symbol(\"previewResolution\");\n\n/**\n * Singleton state for the built-in merge tag picker modal. Provided by\n * `useEditorCore`, consumed by `useMergeTag.requestMergeTag()` (to open\n * the modal as a fall-through when only `mergeTags.tags` is configured)\n * and by `MergeTagPickerModal.vue` (to render and resolve).\n */\nexport const MERGE_TAG_PICKER_KEY: InjectionKey<\n import(\"./composables/useMergeTagPicker\").UseMergeTagPickerReturn\n> = Symbol(\"mergeTagPicker\");\n\n/**\n * One \"a merge tag request is in flight\" flag per editor, provided by\n * `useEditorCore` and injected by every `useMergeTag()` call.\n *\n * Shared, not per-call: `useRichTextEditor.handleClickOutside` suppresses\n * editor teardown while this is set, because the picker modal mounts in the\n * popover root — outside `.tpl-text-editor-wrapper`. A ref private to one\n * `useMergeTag()` instance leaves that guard blind to a picker opened from\n * any other host (the link dialog's URL field), so the click on a picker row\n * tears the block out of edit mode and the pending insert then no-ops on its\n * own disposal guard. Falls back to a private ref for headless callers.\n */\nexport const MERGE_TAG_REQUESTING_KEY: InjectionKey<Ref<boolean>> =\n Symbol(\"mergeTagRequesting\");\n\n/** Logic-tag counterpart of {@link MERGE_TAG_REQUESTING_KEY}. */\nexport const LOGIC_TAG_REQUESTING_KEY: InjectionKey<Ref<boolean>> =\n Symbol(\"logicTagRequesting\");\n\n// ---------------------------------------------------------------------------\n// Logic tags — a standalone feature, separate from merge tags. Native\n// highlighting (LogicMergeTagNode) is always on; these drive the dedicated\n// logic picker + insertion.\n// ---------------------------------------------------------------------------\n\nexport const LOGIC_TAGS_KEY: InjectionKey<LogicTag[]> = Symbol(\"logicTags\");\n\nexport const LOGIC_PAIRS_KEY: InjectionKey<LogicPair[]> = Symbol(\"logicPairs\");\n\n/**\n * Singleton state for the built-in logic picker modal. Provided by\n * `useEditorCore`, consumed by `useLogicTag.requestLogicTag()` (to open the modal)\n * and by `LogicTagPickerModal.vue` (to render and resolve).\n */\nexport const LOGIC_TAG_PICKER_KEY: InjectionKey<\n import(\"./composables/useLogicTagPicker\").UseLogicTagPickerReturn\n> = Symbol(\"logicPicker\");\n\nexport const ON_REQUEST_LOGIC_TAG_KEY: InjectionKey<\n (() => Promise<LogicTag | LogicPair | null>) | null\n> = Symbol(\"onRequestLogic\");\n\nexport const ON_REQUEST_MEDIA_KEY: InjectionKey<OnRequestMedia | null> =\n Symbol(\"onRequestMedia\");\n\n/**\n * Whether a dropped image file may be uploaded. Distinct from Browse: a\n * read-only provider (`create: false`) still opens the library, but the\n * drop zone must not highlight. True when a host `onRequestMedia` is set\n * (the callback receives `files`) or when `provider.create` is a function.\n *\n * `null` when neither a provider nor a callback is configured — image\n * fields stay URL-only and drop is off. Injected as a computed; consumed\n * by `useMediaDropField` with a `null` default.\n */\nexport const CAN_DROP_MEDIA_KEY: InjectionKey<ComputedRef<boolean> | null> =\n Symbol(\"canDropMedia\");\n\n/**\n * Per-editor display-only image URL resolver (`config.resolveImageUrl`),\n * wrapped with a per-src cache by `createImageUrlResolver`. `null` when the\n * host doesn't resolve — the canvas then displays canonical src values\n * verbatim. Consumed via `useResolvedImageSrc` in image-displaying blocks.\n */\nexport const IMAGE_URL_RESOLVER_KEY: InjectionKey<ImageUrlResolver | null> =\n Symbol(\"imageUrlResolver\");\n\nexport const DISPLAY_CONDITIONS_KEY: InjectionKey<DisplayCondition[]> =\n Symbol(\"displayConditions\");\n\nexport const ALLOW_CUSTOM_CONDITIONS_KEY: InjectionKey<boolean> = Symbol(\n \"allowCustomConditions\",\n);\n\nexport const ON_REQUEST_DISPLAY_CONDITION_KEY: InjectionKey<\n | ((\n context: DisplayConditionRequestContext,\n ) => Promise<DisplayCondition | null>)\n | null\n> = Symbol(\"onRequestDisplayCondition\");\n\nexport const CAPABILITIES_KEY: InjectionKey<EditorCapabilities> =\n Symbol(\"capabilities\");\n\nexport const KEYBOARD_REORDER_KEY: InjectionKey<UseKeyboardReorderReturn> =\n Symbol(\"keyboardReorder\");\n\nexport const TEMPLATE_LINT_KEY: InjectionKey<\n import(\"./composables/useTemplateLint\").UseTemplateLintReturn | null\n> = Symbol(\"templateLint\");\n\nexport interface SizeCheckContext {\n renderHtml: () => Promise<string>;\n canRenderHtml: () => boolean;\n options: import(\"@templatical/quality\").LintOptions;\n}\n\nexport const SIZE_CHECK_KEY: InjectionKey<SizeCheckContext> =\n Symbol(\"sizeCheck\");\n\n/**\n * The editor's effective DOM root — `Document` in light-DOM mode, `ShadowRoot`\n * when `shadowDom: true`. Composables that read `document.activeElement`,\n * popup mount targets, etc. should inject this and use the root-aware API\n * (both `Document` and `ShadowRoot` expose `activeElement` etc.).\n */\nexport const EDITOR_ROOT_KEY: InjectionKey<Document | ShadowRoot> =\n Symbol(\"editorRoot\");\n\n/**\n * Mount target for popovers, toolbars, and modal dialogs — never\n * `document.body`. Provided by `useEditorCore` as a ref bound\n * to a `<div class=\"tpl-popover-root\" />` rendered at the top level of the\n * editor template. Teleports use `:to=\"popoverRoot\"` so popups land inside\n * the editor's effective root — `document` in light-DOM mode, `ShadowRoot`\n * when `shadowDom: true` — instead of escaping the shadow boundary.\n *\n * Null until the editor's template mounts; consumers must guard with\n * `v-if=\"popoverRoot\"` before passing to `<Teleport>`.\n */\nexport const POPOVER_ROOT_KEY: InjectionKey<Ref<HTMLElement | null>> =\n Symbol(\"popoverRoot\");\n\n/**\n * Reactive saved-blocks state, provided by `useSavedBlocksFeature` when a\n * `SavedBlocksProvider` is configured. Storage lives behind the provider.\n */\nexport const SAVED_BLOCKS_KEY: InjectionKey<UseSavedBlocksReturn> =\n Symbol(\"savedBlocks\");\n\n// ---------------------------------------------------------------------------\n// Helper for required injections with explicit null default + throw\n// ---------------------------------------------------------------------------\n\nexport function requireInject<T>(\n key: InjectionKey<T>,\n componentName: string,\n): T {\n const value = inject(key, null) as T | null;\n if (value === null || value === undefined) {\n throw new Error(\n `${componentName} requires a provider for ${key.description ?? \"unknown key\"}. Ensure it renders inside the editor, below Editor.vue.`,\n );\n }\n return value;\n}\n","import type { Translations } from \"../i18n\";\nimport { type Ref, inject, isRef } from \"vue\";\nimport { TRANSLATIONS_KEY } from \"../keys\";\n\nexport interface UseI18nReturn {\n /** Current translations object */\n t: Translations;\n /** Format a string with placeholders */\n format: (template: string, values: Record<string, string | number>) => string;\n}\n\n/**\n * Composable for internationalization.\n * Provides access to the current locale's translations.\n *\n * @param translationsOverride - Optional translations to use instead of injected value\n */\nexport function useI18n(translationsOverride?: Translations): UseI18nReturn {\n const injected =\n translationsOverride ??\n (inject(TRANSLATIONS_KEY, null) as Translations | Ref<Translations> | null);\n\n if (!injected) {\n throw new Error(\n \"useI18n() requires a translations provider. Ensure the component renders inside the editor, below Editor.vue.\",\n );\n }\n\n const t: Translations = isRef(injected) ? injected.value : injected;\n\n /**\n * Format a string with placeholders.\n * e.g., format('{minutes}m ago', { minutes: 5 }) -> '5m ago'\n */\n function format(\n template: string,\n values: Record<string, string | number>,\n ): string {\n return template.replace(/\\{(\\w+)\\}/g, (_, key) => {\n return key in values ? String(values[key]) : `{${key}}`;\n });\n }\n\n return {\n t,\n format,\n };\n}\n"],"mappings":";;AA0CA,IAAaG,IACX,OAAO,cAAc,GAMVC,IAET,OAAO,mBAAmB,GAEjBC,IAOT,OAAO,cAAc,GAGZC,IAET,OAAO,uBAAuB,GAErBC,KAA6C,OAAO,QAAQ,GAM5DC,IACX,OAAO,WAAW,GAEPC,IAET,OAAO,oBAAoB,GAOlBC,IAET,OAAO,sBAAsB,GAOpBC,IACX,OAAO,kBAAkB,GAEdC,IAET,OAAO,eAAe,GAEbC,IAA8C,OAAO,SAAS,GAE9DC,IACX,OAAO,cAAc,GAEVC,IACX,OAAO,kBAAkB,GAWdC,IACX,OAAO,wBAAwB,GAEpBC,IACX,OAAO,cAAc,GAEVC,IAET,OAAO,aAAa,GAEXC,IACX,OAAO,YAAY,GAeRC,IACX,OAAO,aAAa,GAMTC,IACX,OAAO,eAAe,GAEXC,IACX,OAAO,eAAe,GAEXC,IAET,OAAO,wBAAwB,GAMtBC,IACX,OAAO,eAAe,GAOXC,IACX,OAAO,kBAAkB,GAOdC,IACX,OAAO,QAAQ,GAQJC,IACX,OAAO,gBAAgB,GAUZC,IAET,OAAO,QAAQ,GAaNC,IAET,OAAO,wBAAwB,GAEtBC,IACX,OAAO,wBAAwB,GAWpBC,IACX,OAAO,WAAW,GAOPC,IAAwC9B,EAAW,CAAC,CAAC,GAErD+B,IACX,OAAO,gBAAgB,GAEZC,IAET,OAAO,mBAAmB,GAEjBC,IAAoD,OAC/D,sBACF,GAQaC,KAAsD,OACjE,sBACF,GAUaC,IACX,OAAO,oBAAoB,GAahBC,IACX,OAAO,oBAAoB,GAYhBC,IACX,OAAO,sBAAsB,GAGlBC,IACX,OAAO,iBAAiB,GAkBbC,IACX,OAAO,gBAAgB,GAGZC,IAET,OAAO,8BAA8B,GAE5BC,IAET,OAAO,mBAAmB,GAQjBC,IAET,OAAO,gBAAgB,GAcdC,IACX,OAAO,oBAAoB,GAGhBC,IACX,OAAO,oBAAoB,GAQhBC,IAA2C,OAAO,WAAW,GAE7DC,IAA6C,OAAO,YAAY,GAOhEC,IAET,OAAO,aAAa,GAEXC,IAET,OAAO,gBAAgB,GAEdC,IACX,OAAO,gBAAgB,GAYZC,IACX,OAAO,cAAc,GAQVC,IACX,OAAO,kBAAkB,GAEdC,IACX,OAAO,mBAAmB,GAEfC,KAAqD,OAChE,uBACF,GAEaC,KAKT,OAAO,2BAA2B,GAEzBC,KACX,OAAO,cAAc,GAEVC,KACX,OAAO,iBAAiB,GAEbC,KAET,OAAO,cAAc,GAQZC,IACX,OAAO,WAAW,GAQPC,KACX,OAAO,YAAY,GAaRC,KACX,OAAO,aAAa,GAMTC,KACX,OAAO,aAAa;AAMtB,SAAgBC,GACd,GACA,GACG;CACH,IAAMC,IAAQjE,EAAOkE,GAAK,IAAI;CAC9B,IAAID,KAAU,MACZ,MAAU,MACR,GAAGE,EAAc,2BAA2BD,EAAI,eAAe,cAAc,yDAC/E;CAEF,OAAOD;AACT;;ACvdA,SAAgBG,GAAQ,GAAoD;CAC1E,IAAMC,IACJC,KACCtE,EAAOG,GAAkB,IAAI;CAEhC,IAAI,CAACkE,GACH,MAAU,MACR,+GACF;CAGF,IAAME,IAAkBtE,EAAMoE,CAAQ,IAAIA,EAAS,QAAQA;CAM3D,SAASG,EACP,GACA,GACQ;EACR,OAAOC,EAAS,QAAQ,eAAe,GAAG,MACjCP,KAAOQ,IAAS,OAAOA,EAAOR,EAAI,IAAI,IAAIA,EAAI,EACtD;CACH;CAEA,OAAO;EACL;EACA;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as e } from "./draggable-IRVFEZ-b.js";
|
|
2
|
-
import {
|
|
2
|
+
import { D as t, _ as n } from "./useI18n-DwP1ksBW.js";
|
|
3
3
|
// src/utils/languageName.ts
|
|
4
4
|
function r(e, t) {
|
|
5
5
|
let n = t?.labels;
|
|
@@ -38,4 +38,4 @@ function i(i) {
|
|
|
38
38
|
}
|
|
39
39
|
export { i as t };
|
|
40
40
|
|
|
41
|
-
//# sourceMappingURL=useLanguageName-
|
|
41
|
+
//# sourceMappingURL=useLanguageName-CeuoO9WZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLanguageName-
|
|
1
|
+
{"version":3,"file":"useLanguageName-CeuoO9WZ.js","names":["inject","LOCALIZATION_KEY","EDITOR_KEY","languageName","label","options","locale","value","tag","duplicate","other","sibling","name","useLanguageName","localization","activeEditor","editor","settings","siblings"],"sources":["../../../src/utils/languageName.ts","../../../src/composables/useLanguageName.ts"],"sourcesContent":["/**\n * A template language names itself, independently of the editor's UI locale.\n * It uses the language name alone unless another configured or template tag\n * shares that language, when it uses the full tag's name. A nonblank host\n * label takes precedence and is returned exactly as written.\n */\nexport function languageName(\n locale: string,\n options?: {\n siblings?: readonly string[];\n labels?: Readonly<Record<string, string>>;\n },\n): string {\n const label = options?.labels;\n if (label && Object.hasOwn(label, locale)) {\n const value = label[locale];\n if (typeof value === \"string\" && value.trim()) return value;\n }\n try {\n const tag = new Intl.Locale(locale);\n const duplicate = options?.siblings?.some((sibling) => {\n try {\n const other = new Intl.Locale(sibling);\n return (\n other.toString() !== tag.toString() && other.language === tag.language\n );\n } catch {\n return false;\n }\n });\n const name = new Intl.DisplayNames([locale], { type: \"language\" }).of(\n duplicate ? locale : tag.language,\n );\n if (name === undefined) return locale;\n return name.charAt(0).toLocaleUpperCase(locale) + name.slice(1);\n } catch {\n return locale;\n }\n}\n","import { inject, type Ref } from \"vue\";\nimport type { TemplateContent } from \"@templatical/types\";\nimport { EDITOR_KEY, LOCALIZATION_KEY } from \"../keys\";\nimport { languageName } from \"../utils/languageName\";\n\nexport function useLanguageName(\n editor?: { content: Ref<TemplateContent> } | null,\n): (locale: string) => string {\n const localization = inject(LOCALIZATION_KEY, undefined);\n const activeEditor = editor === undefined ? inject(EDITOR_KEY, null) : editor;\n return (locale) => {\n const settings = activeEditor?.content.value.settings;\n const siblings = [\n ...(localization?.locales ?? []),\n settings?.locale,\n ...(settings?.locales ?? []),\n ].filter((tag): tag is string => !!tag);\n return languageName(locale, {\n siblings: [...new Set(siblings)],\n labels: localization?.languageNames,\n });\n };\n}\n"],"mappings":";;;AAMA,SAAgBG,EACd,GACA,GAIQ;CACR,IAAMC,IAAQC,GAAS;CACvB,IAAID,KAAS,OAAO,OAAOA,GAAOE,CAAM,GAAG;EACzC,IAAMC,IAAQH,EAAME;EACpB,IAAI,OAAOC,KAAU,YAAYA,EAAM,KAAK,GAAG,OAAOA;CACxD;CACA,IAAI;EACF,IAAMC,IAAM,IAAI,KAAK,OAAOF,CAAM,GAC5BG,IAAYJ,GAAS,UAAU,MAAM,MAAY;GACrD,IAAI;IACF,IAAMK,IAAQ,IAAI,KAAK,OAAOC,CAAO;IACrC,OACED,EAAM,SAAS,MAAMF,EAAI,SAAS,KAAKE,EAAM,aAAaF,EAAI;GAElE,QAAQ;IACN,OAAO;GACT;EACF,CAAC,GACKI,IAAO,IAAI,KAAK,aAAa,CAACN,CAAM,GAAG,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,GACjEG,IAAYH,IAASE,EAAI,QAC3B;EAEA,OADII,MAAS,KAAA,IAAkBN,IACxBM,EAAK,OAAO,CAAC,CAAC,CAAC,kBAAkBN,CAAM,IAAIM,EAAK,MAAM,CAAC;CAChE,QAAQ;EACN,OAAON;CACT;AACF;;ACjCA,SAAgBO,EACd,GAC4B;CAC5B,IAAMC,IAAed,EAAOC,GAAkB,KAAA,CAAS,GACjDc,IAAeC,MAAW,KAAA,IAAYhB,EAAOE,GAAY,IAAI,IAAIc;CACvE,QAAQ,MAAW;EACjB,IAAMC,IAAWF,GAAc,QAAQ,MAAM,UACvCG,IAAW;GACf,GAAIJ,GAAc,WAAW,CAAC;GAC9BG,GAAU;GACV,GAAIA,GAAU,WAAW,CAAC;EAC5B,CAAC,CAAC,QAAQ,MAAuB,CAAC,CAACT,CAAG;EACtC,OAAOL,EAAaG,GAAQ;GAC1B,UAAU,CAAC,GAAG,IAAI,IAAIY,CAAQ,CAAC;GAC/B,QAAQJ,GAAc;EACxB,CAAC;CACH;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { H as e } from "./src-A0kzK-pR.js";
|
|
2
2
|
import { O as t, tt as n } from "./draggable-IRVFEZ-b.js";
|
|
3
|
-
import { A as r,
|
|
3
|
+
import { A as r, H as i, M as a, j as o, k as s, z as c } from "./useI18n-DwP1ksBW.js";
|
|
4
4
|
// src/composables/useLogicTag.ts
|
|
5
5
|
function l() {
|
|
6
|
-
let l = t(
|
|
6
|
+
let l = t(r, []), u = t(s, []), d = t(c, e.liquid), f = t(i, null), p = t(o, null), m = t(a, null) ?? n(!1), h = !!f || l.length > 0 || u.length > 0, g = l.length > 0 || u.length > 0;
|
|
7
7
|
async function _() {
|
|
8
8
|
if (f) {
|
|
9
9
|
m.value = !0;
|
|
@@ -34,4 +34,4 @@ function l() {
|
|
|
34
34
|
}
|
|
35
35
|
export { l as t };
|
|
36
36
|
|
|
37
|
-
//# sourceMappingURL=useLogicTag-
|
|
37
|
+
//# sourceMappingURL=useLogicTag-gphGbQfy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogicTag-
|
|
1
|
+
{"version":3,"file":"useLogicTag-gphGbQfy.js","names":["SYNTAX_PRESETS","inject","ref","LOGIC_TAGS_KEY","ON_REQUEST_LOGIC_TAG_KEY","LOGIC_TAG_REQUESTING_KEY","LOGIC_TAG_PICKER_KEY","LOGIC_PAIRS_KEY","MERGE_TAG_SYNTAX_KEY","useLogicTag","logicTags","logicPairs","syntax","onRequest","picker","isRequesting","canInsertLogicTag","hasStaticLogic","requestLogicTag"],"sources":["../../../src/composables/useLogicTag.ts"],"sourcesContent":["import type { LogicPair, LogicTag, SyntaxPreset } from \"@templatical/types\";\nimport { SYNTAX_PRESETS } from \"@templatical/types\";\nimport { inject, ref, type Ref } from \"vue\";\nimport {\n LOGIC_PAIRS_KEY,\n LOGIC_TAG_PICKER_KEY,\n LOGIC_TAG_REQUESTING_KEY,\n LOGIC_TAGS_KEY,\n MERGE_TAG_SYNTAX_KEY,\n ON_REQUEST_LOGIC_TAG_KEY,\n} from \"../keys\";\nimport type { LogicTagPickerResult } from \"./useLogicTagPicker\";\n\nexport interface UseLogicTagReturn {\n /** Configured standalone logic tags. */\n logicTags: LogicTag[];\n /** Configured open/close logic pairs. */\n logicPairs: LogicPair[];\n /** Resolved syntax preset — shared with merge tags; drives keyword badges. */\n syntax: SyntaxPreset;\n /**\n * Whether the \"Insert logic\" affordance should show. True when at least one\n * logic tag or pair is configured.\n */\n canInsertLogicTag: boolean;\n /** Whether a logic pick is in progress. */\n isRequesting: Ref<boolean>;\n /**\n * Open the built-in logic picker. Resolves with the chosen tag/pair, or null\n * when nothing is configured, the picker is unavailable (headless), or the\n * user cancels.\n */\n requestLogicTag: () => Promise<LogicTagPickerResult | null>;\n}\n\n/**\n * Composable for the standalone logic-tag feature — separate from merge tags.\n * Exposes configured logic tags/pairs and opens the built-in logic picker.\n */\nexport function useLogicTag(): UseLogicTagReturn {\n const logicTags = inject(LOGIC_TAGS_KEY, []);\n const logicPairs = inject(LOGIC_PAIRS_KEY, []);\n const syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\n const onRequest = inject(ON_REQUEST_LOGIC_TAG_KEY, null);\n // Picker may be null in headless contexts (tests, non-editor consumers).\n const picker = inject(LOGIC_TAG_PICKER_KEY, null);\n\n // Shared per editor — same reason as merge tags. See\n // LOGIC_TAG_REQUESTING_KEY.\n const isRequesting = inject(LOGIC_TAG_REQUESTING_KEY, null) ?? ref(false);\n\n // Show the affordance when a consumer callback is set OR static config\n // exists — mirrors useMergeTag's canRequestMergeTag.\n const canInsertLogicTag =\n !!onRequest || logicTags.length > 0 || logicPairs.length > 0;\n\n const hasStaticLogic = logicTags.length > 0 || logicPairs.length > 0;\n\n /**\n * Request a logic tag/pair from the user. Precedence:\n * 1. `logic.onRequest` callback (consumer-owned UX)\n * 2. Built-in picker over `logic.tags` / `logic.pairs`\n * 3. null (nothing configured / headless)\n */\n async function requestLogicTag(): Promise<LogicTagPickerResult | null> {\n if (onRequest) {\n isRequesting.value = true;\n try {\n return await onRequest();\n } finally {\n isRequesting.value = false;\n }\n }\n if (picker && hasStaticLogic) {\n isRequesting.value = true;\n try {\n return await picker.open(logicTags, logicPairs);\n } finally {\n isRequesting.value = false;\n }\n }\n return null;\n }\n\n return {\n logicTags,\n logicPairs,\n syntax,\n canInsertLogicTag,\n isRequesting,\n requestLogicTag,\n };\n}\n"],"mappings":";;;;AAuCA,SAAgBS,IAAiC;CAC/C,IAAMC,IAAYT,EAAOE,GAAgB,CAAC,CAAC,GACrCQ,IAAaV,EAAOM,GAAiB,CAAC,CAAC,GACvCK,IAASX,EAAOO,GAAsBR,EAAe,MAAM,GAC3Da,IAAYZ,EAAOG,GAA0B,IAAI,GAEjDU,IAASb,EAAOK,GAAsB,IAAI,GAI1CS,IAAed,EAAOI,GAA0B,IAAI,KAAKH,EAAI,EAAK,GAIlEc,IACJ,CAAC,CAACH,KAAaH,EAAU,SAAS,KAAKC,EAAW,SAAS,GAEvDM,IAAiBP,EAAU,SAAS,KAAKC,EAAW,SAAS;CAQnE,eAAeO,IAAwD;EACrE,IAAIL,GAAW;GACb,EAAa,QAAQ;GACrB,IAAI;IACF,OAAO,MAAMA,EAAU;GACzB,UAAU;IACR,EAAa,QAAQ;GACvB;EACF;EACA,IAAIC,KAAUG,GAAgB;GAC5B,EAAa,QAAQ;GACrB,IAAI;IACF,OAAO,MAAMH,EAAO,KAAKJ,GAAWC,CAAU;GAChD,UAAU;IACR,EAAa,QAAQ;GACvB;EACF;EACA,OAAO;CACT;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { H as e, K as t, Q as n } from "./src-A0kzK-pR.js";
|
|
2
2
|
import { O as r, p as i, tt as a } from "./draggable-IRVFEZ-b.js";
|
|
3
|
-
import { B as o, F as s,
|
|
3
|
+
import { B as o, F as s, I as c, N as l, P as u, R as d, W as f, it as p, z as m } from "./useI18n-DwP1ksBW.js";
|
|
4
4
|
// src/composables/useMergeTag.ts
|
|
5
5
|
function h() {
|
|
6
|
-
let h = r(
|
|
6
|
+
let h = r(l, o), g = r(m, e.liquid), _ = r(f, null), v = r(u, !0), y = r(s, null), b = r(d, !0), x = r(p, null)?.mergeTag.unknownLabel ?? "Merge tag", S = r(c, null) ?? a(!1);
|
|
7
7
|
function C(e) {
|
|
8
8
|
return n(e, g);
|
|
9
9
|
}
|
|
@@ -56,4 +56,4 @@ function h() {
|
|
|
56
56
|
}
|
|
57
57
|
export { h as t };
|
|
58
58
|
|
|
59
|
-
//# sourceMappingURL=useMergeTag-
|
|
59
|
+
//# sourceMappingURL=useMergeTag-QM-tkBc6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergeTag-Dwy3U0PI.js","names":["isMergeTagValue","checkIsMergeTagValue","getMergeTagLabel","resolveMergeTagLabel","SYNTAX_PRESETS","getMergeTagLabel","isMergeTagValue","inject","computed","ref","MERGE_TAG_SYNTAX_KEY","MERGE_TAG_AUTOCOMPLETE_KEY","ON_REQUEST_MERGE_TAG_KEY","MERGE_TAG_PICKER_KEY","MERGE_TAG_REQUESTING_KEY","MERGE_TAGS_KEY","NO_MERGE_TAGS","TRANSLATIONS_KEY","MERGE_TAG_SHOW_RAW_VALUE_KEY","useMergeTag","mergeTags","syntax","onRequestMergeTag","autocomplete","picker","showRawValue","unknownLabel","isRequesting","isMergeTagValue$1","value","getMergeTagLabel$1","findMergeTag","tag","canRepickMergeTag","getMergeTagDisplayLabel","declared","storedLabel","requestMergeTag","context"],"sources":["../../../src/composables/useMergeTag.ts"],"sourcesContent":["import type {\n MergeTag,\n MergeTagRequestContext,\n SyntaxPreset,\n} from \"@templatical/types\";\nimport {\n isMergeTagValue as checkIsMergeTagValue,\n getMergeTagLabel as resolveMergeTagLabel,\n SYNTAX_PRESETS,\n} from \"@templatical/types\";\nimport {\n computed,\n inject,\n ref,\n type ComputedRef,\n type Ref,\n type ShallowRef,\n} from \"vue\";\nimport {\n MERGE_TAGS_KEY,\n NO_MERGE_TAGS,\n MERGE_TAG_SYNTAX_KEY,\n MERGE_TAG_AUTOCOMPLETE_KEY,\n MERGE_TAG_PICKER_KEY,\n MERGE_TAG_SHOW_RAW_VALUE_KEY,\n MERGE_TAG_REQUESTING_KEY,\n ON_REQUEST_MERGE_TAG_KEY,\n TRANSLATIONS_KEY,\n} from \"../keys\";\n\nexport interface UseMergeTagReturn {\n /**\n * The configured merge tags. A ref, so `editor.setMergeTags()` reaches\n * everything reading it — never destructure the array out of it.\n */\n mergeTags: ShallowRef<MergeTag[]>;\n /** Whether a merge tag request is in progress */\n isRequesting: Ref<boolean>;\n /**\n * Whether the \"Insert merge tag\" button should be shown. True when\n * either `onRequestMergeTag` is provided or `mergeTags.tags` is\n * non-empty (the built-in picker then handles the click).\n */\n canRequestMergeTag: ComputedRef<boolean>;\n /** Whether typing-based autocomplete is enabled by configuration */\n autocomplete: boolean;\n /** The resolved syntax preset for merge tags */\n syntax: SyntaxPreset;\n /** Check if a value matches the configured merge tag syntax */\n isMergeTagValue: (value: string) => boolean;\n /** Get the human-readable label for a merge tag value */\n getMergeTagLabel: (value: string) => string;\n /**\n * The configured tag whose `value` is exactly `value`, or `undefined` when\n * the token matches nothing. Unlike `getMergeTagLabel`, absence is reported\n * rather than falling back to the raw token — callers deciding whether a\n * chip can be re-picked need to tell the two apart.\n */\n findMergeTag: (value: string) => MergeTag | undefined;\n /**\n * Whether activating a tag carrying `value` should open the chooser rather\n * than a raw text input.\n *\n * True when the consumer owns the chooser (`onRequest` decides for itself\n * what an unresolvable token means), or when the token resolves against\n * `tags` so the built-in picker has something to preselect. False otherwise,\n * which is the one case where editing the token as text is still the only\n * way to repair it.\n *\n * The single home for that rule: the canvas chip and a sidebar field chip\n * must not be able to answer it differently.\n */\n canRepickMergeTag: (value: string) => boolean;\n /**\n * What a tag renders as on screen.\n *\n * A declared tag shows its label. An undeclared token normally shows itself —\n * the editor makes a tag out of anything syntax-shaped, so the token is\n * usually the only thing identifying it. When the consumer hid raw tokens it\n * falls back to `storedLabel` (the label captured on the node when the tag\n * was inserted) and then to a neutral placeholder, so an opaque identifier\n * never reaches the screen.\n *\n * The single home for that chain: the canvas chip, its accessible name and a\n * sidebar field chip must all say the same thing.\n */\n getMergeTagDisplayLabel: (value: string, storedLabel?: string) => string;\n /**\n * Whether a tag's tooltip may reveal the raw token behind its label.\n * `false` when the consumer set `mergeTags.showRawValue: false`.\n */\n showRawValue: boolean;\n /**\n * Request a merge tag from the user. Precedence: when\n * `onRequestMergeTag` is set it owns the UX; otherwise the built-in\n * picker opens with the configured `mergeTags.tags`; otherwise null.\n *\n * `context` says whether this is an insertion or a replacement, and carries\n * the tag being replaced when one resolves.\n */\n requestMergeTag: (\n context?: MergeTagRequestContext,\n ) => Promise<MergeTag | null>;\n}\n\n/**\n * Composable for merge tag functionality.\n * Provides utilities for detecting, displaying, and requesting merge tags.\n */\nexport function useMergeTag(): UseMergeTagReturn {\n const mergeTags = inject(MERGE_TAGS_KEY, NO_MERGE_TAGS);\n const syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\n const onRequestMergeTag = inject(ON_REQUEST_MERGE_TAG_KEY, null);\n const autocomplete = inject(MERGE_TAG_AUTOCOMPLETE_KEY, true);\n // Picker may be null in headless contexts (tests, non-editor consumers).\n // requestMergeTag() returns null in that case rather than throwing.\n const picker = inject(MERGE_TAG_PICKER_KEY, null);\n const showRawValue = inject(MERGE_TAG_SHOW_RAW_VALUE_KEY, true);\n // Injected directly rather than through `useI18n()`, which throws without a\n // provider — this composable is used headlessly too. The binding name is one\n // `i18n-key-usage.test.ts` recognises as a translations holder; an unlisted\n // name makes every key read through it look dead to that guard.\n const injectedTranslations = inject(TRANSLATIONS_KEY, null);\n const unknownLabel =\n injectedTranslations?.mergeTag.unknownLabel ?? \"Merge tag\";\n\n // Shared per editor so every host that can open the picker is visible to\n // useRichTextEditor's click-outside guard. See MERGE_TAG_REQUESTING_KEY.\n const isRequesting = inject(MERGE_TAG_REQUESTING_KEY, null) ?? ref(false);\n\n function isMergeTagValue(value: string): boolean {\n return checkIsMergeTagValue(value, syntax);\n }\n\n function getMergeTagLabel(value: string): string {\n return resolveMergeTagLabel(value, mergeTags.value);\n }\n\n function findMergeTag(value: string): MergeTag | undefined {\n return mergeTags.value.find((tag) => tag.value === value);\n }\n\n function canRepickMergeTag(value: string): boolean {\n return !!onRequestMergeTag || findMergeTag(value) !== undefined;\n }\n\n function getMergeTagDisplayLabel(\n value: string,\n storedLabel?: string,\n ): string {\n const declared = findMergeTag(value);\n if (declared) return declared.label;\n // Before the token, not after it. A consumer whose picker mints a tag\n // returns one that is in no `tags` array, and its label is written onto\n // the node — reaching for the token first renders a raw identifier the\n // instant the author picks a field. This costs nothing for a tag the\n // editor made itself: the input rule, the paste rule, normalization and\n // `parseHTML` all derive an undeclared tag's stored label from\n // `getMergeTagLabel`, which returns the token, so the two agree already.\n if (storedLabel?.trim()) return storedLabel.trim();\n return showRawValue ? value : unknownLabel;\n }\n\n /**\n * Request a merge tag from the user. Precedence:\n * 1. `onRequestMergeTag` callback (consumer-owned UX)\n * 2. Built-in picker over `mergeTags.tags`\n * 3. null (nothing configured)\n */\n async function requestMergeTag(\n context?: MergeTagRequestContext,\n ): Promise<MergeTag | null> {\n if (onRequestMergeTag) {\n isRequesting.value = true;\n try {\n return await onRequestMergeTag(context);\n } finally {\n isRequesting.value = false;\n }\n }\n if (mergeTags.value.length > 0 && picker) {\n isRequesting.value = true;\n try {\n return await picker.open(mergeTags.value, {\n current: context?.current,\n });\n } finally {\n isRequesting.value = false;\n }\n }\n return null;\n }\n\n // Computed, not a snapshot: `setMergeTags` can take the list from empty to\n // populated, and a plain boolean captured here would leave the \"Insert merge\n // tag\" affordance hidden for the rest of the session.\n const canRequestMergeTag = computed(\n () => !!onRequestMergeTag || mergeTags.value.length > 0,\n );\n\n return {\n mergeTags,\n isRequesting,\n canRequestMergeTag,\n autocomplete,\n syntax,\n isMergeTagValue,\n getMergeTagLabel,\n findMergeTag,\n canRepickMergeTag,\n getMergeTagDisplayLabel,\n showRawValue,\n requestMergeTag,\n };\n}\n"],"mappings":";;;;AA6GA,SAAgBmB,IAAiC;CAC/C,IAAMC,IAAYb,EAAOQ,GAAgBC,CAAa,GAChDK,IAASd,EAAOG,GAAsBN,EAAe,MAAM,GAC3DkB,IAAoBf,EAAOK,GAA0B,IAAI,GACzDW,IAAehB,EAAOI,GAA4B,EAAI,GAGtDa,IAASjB,EAAOM,GAAsB,IAAI,GAC1CY,IAAelB,EAAOW,GAA8B,EAAI,GAMxDQ,IADuBnB,EAAOU,GAAkB,IAEpD,CAAA,EAAsB,SAAS,gBAAgB,aAI3CU,IAAepB,EAAOO,GAA0B,IAAI,KAAKL,EAAI,EAAK;CAExE,SAAST,EAAgB,GAAwB;EAC/C,OAAOC,EAAqB4B,GAAOR,CAAM;CAC3C;CAEA,SAASnB,EAAiB,GAAuB;EAC/C,OAAOC,EAAqB0B,GAAOT,EAAU,KAAK;CACpD;CAEA,SAASW,EAAa,GAAqC;EACzD,OAAOX,EAAU,MAAM,MAAM,MAAQY,EAAI,UAAUH,CAAK;CAC1D;CAEA,SAASI,EAAkB,GAAwB;EACjD,OAAO,CAAC,CAACX,KAAqBS,EAAaF,CAAK,MAAM,KAAA;CACxD;CAEA,SAASK,EACP,GACA,GACQ;EACR,IAAMC,IAAWJ,EAAaF,CAAK;EAUnC,OATIM,IAAiBA,EAAS,QAQ1BC,GAAa,KAAK,IAAUA,EAAY,KAAK,IAC1CX,IAAeI,IAAQH;CAChC;CAQA,eAAeW,EACb,GAC0B;EAC1B,IAAIf,GAAmB;GACrB,EAAa,QAAQ;GACrB,IAAI;IACF,OAAO,MAAMA,EAAkBgB,CAAO;GACxC,UAAU;IACR,EAAa,QAAQ;GACvB;EACF;EACA,IAAIlB,EAAU,MAAM,SAAS,KAAKI,GAAQ;GACxC,EAAa,QAAQ;GACrB,IAAI;IACF,OAAO,MAAMA,EAAO,KAAKJ,EAAU,OAAO,EACxC,SAASkB,GAAS,QACpB,CAAC;GACH,UAAU;IACR,EAAa,QAAQ;GACvB;EACF;EACA,OAAO;CACT;CASA,OAAO;EACL;EACA;EACA,oBAPyB9B,QACnB,CAAC,CAACc,KAAqBF,EAAU,MAAM,SAAS,CAMtD;EACA;EACA;EACA,iBAAAQ;EACA,kBAAAE;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useMergeTag-QM-tkBc6.js","names":["isMergeTagValue","checkIsMergeTagValue","getMergeTagLabel","resolveMergeTagLabel","SYNTAX_PRESETS","getMergeTagLabel","isMergeTagValue","inject","computed","ref","NO_MERGE_TAGS","MERGE_TAG_PICKER_KEY","MERGE_TAG_REQUESTING_KEY","MERGE_TAGS_KEY","MERGE_TAG_AUTOCOMPLETE_KEY","MERGE_TAG_SHOW_RAW_VALUE_KEY","ON_REQUEST_MERGE_TAG_KEY","TRANSLATIONS_KEY","MERGE_TAG_SYNTAX_KEY","useMergeTag","mergeTags","syntax","onRequestMergeTag","autocomplete","picker","showRawValue","unknownLabel","isRequesting","isMergeTagValue$1","value","getMergeTagLabel$1","findMergeTag","tag","canRepickMergeTag","getMergeTagDisplayLabel","declared","storedLabel","requestMergeTag","context"],"sources":["../../../src/composables/useMergeTag.ts"],"sourcesContent":["import type {\n MergeTag,\n MergeTagRequestContext,\n SyntaxPreset,\n} from \"@templatical/types\";\nimport {\n isMergeTagValue as checkIsMergeTagValue,\n getMergeTagLabel as resolveMergeTagLabel,\n SYNTAX_PRESETS,\n} from \"@templatical/types\";\nimport {\n computed,\n inject,\n ref,\n type ComputedRef,\n type Ref,\n type ShallowRef,\n} from \"vue\";\nimport {\n MERGE_TAGS_KEY,\n NO_MERGE_TAGS,\n MERGE_TAG_SYNTAX_KEY,\n MERGE_TAG_AUTOCOMPLETE_KEY,\n MERGE_TAG_PICKER_KEY,\n MERGE_TAG_SHOW_RAW_VALUE_KEY,\n MERGE_TAG_REQUESTING_KEY,\n ON_REQUEST_MERGE_TAG_KEY,\n TRANSLATIONS_KEY,\n} from \"../keys\";\n\nexport interface UseMergeTagReturn {\n /**\n * The configured merge tags. A ref, so `editor.setMergeTags()` reaches\n * everything reading it — never destructure the array out of it.\n */\n mergeTags: ShallowRef<MergeTag[]>;\n /** Whether a merge tag request is in progress */\n isRequesting: Ref<boolean>;\n /**\n * Whether the \"Insert merge tag\" button should be shown. True when\n * either `onRequestMergeTag` is provided or `mergeTags.tags` is\n * non-empty (the built-in picker then handles the click).\n */\n canRequestMergeTag: ComputedRef<boolean>;\n /** Whether typing-based autocomplete is enabled by configuration */\n autocomplete: boolean;\n /** The resolved syntax preset for merge tags */\n syntax: SyntaxPreset;\n /** Check if a value matches the configured merge tag syntax */\n isMergeTagValue: (value: string) => boolean;\n /** Get the human-readable label for a merge tag value */\n getMergeTagLabel: (value: string) => string;\n /**\n * The configured tag whose `value` is exactly `value`, or `undefined` when\n * the token matches nothing. Unlike `getMergeTagLabel`, absence is reported\n * rather than falling back to the raw token — callers deciding whether a\n * chip can be re-picked need to tell the two apart.\n */\n findMergeTag: (value: string) => MergeTag | undefined;\n /**\n * Whether activating a tag carrying `value` should open the chooser rather\n * than a raw text input.\n *\n * True when the consumer owns the chooser (`onRequest` decides for itself\n * what an unresolvable token means), or when the token resolves against\n * `tags` so the built-in picker has something to preselect. False otherwise,\n * which is the one case where editing the token as text is still the only\n * way to repair it.\n *\n * The single home for that rule: the canvas chip and a sidebar field chip\n * must not be able to answer it differently.\n */\n canRepickMergeTag: (value: string) => boolean;\n /**\n * What a tag renders as on screen.\n *\n * A declared tag shows its label. An undeclared token normally shows itself —\n * the editor makes a tag out of anything syntax-shaped, so the token is\n * usually the only thing identifying it. When the consumer hid raw tokens it\n * falls back to `storedLabel` (the label captured on the node when the tag\n * was inserted) and then to a neutral placeholder, so an opaque identifier\n * never reaches the screen.\n *\n * The single home for that chain: the canvas chip, its accessible name and a\n * sidebar field chip must all say the same thing.\n */\n getMergeTagDisplayLabel: (value: string, storedLabel?: string) => string;\n /**\n * Whether a tag's tooltip may reveal the raw token behind its label.\n * `false` when the consumer set `mergeTags.showRawValue: false`.\n */\n showRawValue: boolean;\n /**\n * Request a merge tag from the user. Precedence: when\n * `onRequestMergeTag` is set it owns the UX; otherwise the built-in\n * picker opens with the configured `mergeTags.tags`; otherwise null.\n *\n * `context` says whether this is an insertion or a replacement, and carries\n * the tag being replaced when one resolves.\n */\n requestMergeTag: (\n context?: MergeTagRequestContext,\n ) => Promise<MergeTag | null>;\n}\n\n/**\n * Composable for merge tag functionality.\n * Provides utilities for detecting, displaying, and requesting merge tags.\n */\nexport function useMergeTag(): UseMergeTagReturn {\n const mergeTags = inject(MERGE_TAGS_KEY, NO_MERGE_TAGS);\n const syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\n const onRequestMergeTag = inject(ON_REQUEST_MERGE_TAG_KEY, null);\n const autocomplete = inject(MERGE_TAG_AUTOCOMPLETE_KEY, true);\n // Picker may be null in headless contexts (tests, non-editor consumers).\n // requestMergeTag() returns null in that case rather than throwing.\n const picker = inject(MERGE_TAG_PICKER_KEY, null);\n const showRawValue = inject(MERGE_TAG_SHOW_RAW_VALUE_KEY, true);\n // Injected directly rather than through `useI18n()`, which throws without a\n // provider — this composable is used headlessly too. The binding name is one\n // `i18n-key-usage.test.ts` recognises as a translations holder; an unlisted\n // name makes every key read through it look dead to that guard.\n const injectedTranslations = inject(TRANSLATIONS_KEY, null);\n const unknownLabel =\n injectedTranslations?.mergeTag.unknownLabel ?? \"Merge tag\";\n\n // Shared per editor so every host that can open the picker is visible to\n // useRichTextEditor's click-outside guard. See MERGE_TAG_REQUESTING_KEY.\n const isRequesting = inject(MERGE_TAG_REQUESTING_KEY, null) ?? ref(false);\n\n function isMergeTagValue(value: string): boolean {\n return checkIsMergeTagValue(value, syntax);\n }\n\n function getMergeTagLabel(value: string): string {\n return resolveMergeTagLabel(value, mergeTags.value);\n }\n\n function findMergeTag(value: string): MergeTag | undefined {\n return mergeTags.value.find((tag) => tag.value === value);\n }\n\n function canRepickMergeTag(value: string): boolean {\n return !!onRequestMergeTag || findMergeTag(value) !== undefined;\n }\n\n function getMergeTagDisplayLabel(\n value: string,\n storedLabel?: string,\n ): string {\n const declared = findMergeTag(value);\n if (declared) return declared.label;\n // Before the token, not after it. A consumer whose picker mints a tag\n // returns one that is in no `tags` array, and its label is written onto\n // the node — reaching for the token first renders a raw identifier the\n // instant the author picks a field. This costs nothing for a tag the\n // editor made itself: the input rule, the paste rule, normalization and\n // `parseHTML` all derive an undeclared tag's stored label from\n // `getMergeTagLabel`, which returns the token, so the two agree already.\n if (storedLabel?.trim()) return storedLabel.trim();\n return showRawValue ? value : unknownLabel;\n }\n\n /**\n * Request a merge tag from the user. Precedence:\n * 1. `onRequestMergeTag` callback (consumer-owned UX)\n * 2. Built-in picker over `mergeTags.tags`\n * 3. null (nothing configured)\n */\n async function requestMergeTag(\n context?: MergeTagRequestContext,\n ): Promise<MergeTag | null> {\n if (onRequestMergeTag) {\n isRequesting.value = true;\n try {\n return await onRequestMergeTag(context);\n } finally {\n isRequesting.value = false;\n }\n }\n if (mergeTags.value.length > 0 && picker) {\n isRequesting.value = true;\n try {\n return await picker.open(mergeTags.value, {\n current: context?.current,\n });\n } finally {\n isRequesting.value = false;\n }\n }\n return null;\n }\n\n // Computed, not a snapshot: `setMergeTags` can take the list from empty to\n // populated, and a plain boolean captured here would leave the \"Insert merge\n // tag\" affordance hidden for the rest of the session.\n const canRequestMergeTag = computed(\n () => !!onRequestMergeTag || mergeTags.value.length > 0,\n );\n\n return {\n mergeTags,\n isRequesting,\n canRequestMergeTag,\n autocomplete,\n syntax,\n isMergeTagValue,\n getMergeTagLabel,\n findMergeTag,\n canRepickMergeTag,\n getMergeTagDisplayLabel,\n showRawValue,\n requestMergeTag,\n };\n}\n"],"mappings":";;;;AA6GA,SAAgBmB,IAAiC;CAC/C,IAAMC,IAAYb,EAAOM,GAAgBH,CAAa,GAChDW,IAASd,EAAOW,GAAsBd,EAAe,MAAM,GAC3DkB,IAAoBf,EAAOS,GAA0B,IAAI,GACzDO,IAAehB,EAAOO,GAA4B,EAAI,GAGtDU,IAASjB,EAAOI,GAAsB,IAAI,GAC1Cc,IAAelB,EAAOQ,GAA8B,EAAI,GAMxDW,IADuBnB,EAAOU,GAAkB,IAEpD,CAAA,EAAsB,SAAS,gBAAgB,aAI3CU,IAAepB,EAAOK,GAA0B,IAAI,KAAKH,EAAI,EAAK;CAExE,SAAST,EAAgB,GAAwB;EAC/C,OAAOC,EAAqB4B,GAAOR,CAAM;CAC3C;CAEA,SAASnB,EAAiB,GAAuB;EAC/C,OAAOC,EAAqB0B,GAAOT,EAAU,KAAK;CACpD;CAEA,SAASW,EAAa,GAAqC;EACzD,OAAOX,EAAU,MAAM,MAAM,MAAQY,EAAI,UAAUH,CAAK;CAC1D;CAEA,SAASI,EAAkB,GAAwB;EACjD,OAAO,CAAC,CAACX,KAAqBS,EAAaF,CAAK,MAAM,KAAA;CACxD;CAEA,SAASK,EACP,GACA,GACQ;EACR,IAAMC,IAAWJ,EAAaF,CAAK;EAUnC,OATIM,IAAiBA,EAAS,QAQ1BC,GAAa,KAAK,IAAUA,EAAY,KAAK,IAC1CX,IAAeI,IAAQH;CAChC;CAQA,eAAeW,EACb,GAC0B;EAC1B,IAAIf,GAAmB;GACrB,EAAa,QAAQ;GACrB,IAAI;IACF,OAAO,MAAMA,EAAkBgB,CAAO;GACxC,UAAU;IACR,EAAa,QAAQ;GACvB;EACF;EACA,IAAIlB,EAAU,MAAM,SAAS,KAAKI,GAAQ;GACxC,EAAa,QAAQ;GACrB,IAAI;IACF,OAAO,MAAMA,EAAO,KAAKJ,EAAU,OAAO,EACxC,SAASkB,GAAS,QACpB,CAAC;GACH,UAAU;IACR,EAAa,QAAQ;GACvB;EACF;EACA,OAAO;CACT;CASA,OAAO;EACL;EACA;EACA,oBAPyB9B,QACnB,CAAC,CAACc,KAAqBF,EAAU,MAAM,SAAS,CAMtD;EACA;EACA;EACA,iBAAAQ;EACA,kBAAAE;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as e, p as t, tt as n } from "./draggable-IRVFEZ-b.js";
|
|
2
|
-
import {
|
|
2
|
+
import { D as r, K as i, _ as a } from "./useI18n-DwP1ksBW.js";
|
|
3
3
|
// src/composables/useLocaleEditable.ts
|
|
4
4
|
function o() {
|
|
5
5
|
let n = e(a, null), i = e(r, void 0);
|
|
@@ -75,4 +75,4 @@ function g() {
|
|
|
75
75
|
}
|
|
76
76
|
export { d as a, o as c, m as i, h as n, l as o, f as r, u as s, g as t };
|
|
77
77
|
|
|
78
|
-
//# sourceMappingURL=usePopoverPosition-
|
|
78
|
+
//# sourceMappingURL=usePopoverPosition-Cg8LR0W4.js.map
|
package/dist/cdn/chunks/{usePopoverPosition-CBp9uwjV.js.map → usePopoverPosition-Cg8LR0W4.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopoverPosition-CBp9uwjV.js","names":["inject","computed","ref","LOCALIZATION_KEY","POPOVER_ROOT_KEY","EDITOR_KEY","useLocaleEditable","editor","localization","locale","RGB_CHANNELS","channelsToHex","toHex","n","r","g","b","normalizeColorToHex","m","value","opaqueHex","trimmed","short","canonicalizeHexColor","hex","DEFAULT_RESOLVED_COLORS","VALID_PRESET_HEX","resolveColorsConfig","presets","invalidPresets","colors","fallback","entry","requestedAllowCustom","allowCustomIgnored","usePopoverRoot","usePopoverPosition","popoverRoot","toLocal","rect","viewport"],"sources":["../../../src/composables/useLocaleEditable.ts","../../../src/utils/color.ts","../../../src/utils/resolveColorsConfig.ts","../../../src/composables/usePopoverRoot.ts","../../../src/composables/usePopoverPosition.ts"],"sourcesContent":["import { computed, inject } from \"vue\";\nimport { EDITOR_KEY, LOCALIZATION_KEY } from \"../keys\";\n\n/** Whether the active language is enabled for authoring. */\nexport function useLocaleEditable() {\n const editor = inject(EDITOR_KEY, null);\n const localization = inject(LOCALIZATION_KEY, undefined);\n return computed(() => {\n const locale = editor?.activeLocale?.value;\n return !locale || !localization || localization.locales.includes(locale);\n });\n}\n","const RGB_CHANNELS =\n /^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)(?:\\s*,\\s*(\\d*\\.?\\d+)\\s*)?\\)$/i;\n\nfunction channelsToHex(r: string, g: string, b: string): string {\n const toHex = (n: string) => Number(n).toString(16).padStart(2, \"0\");\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\n/**\n * Normalize an opaque `rgb()` / `rgba(..., 1)` to `#rrggbb`. The browser\n * serializes an inline `style=\"color:#hex\"` to `rgb(...)`, so reading a stored\n * color back via `element.style.color` (e.g. a TipTap textStyle/highlight mark,\n * or a saved link color) surfaces `rgb(...)` — mismatching the hex used\n * everywhere else, and unparseable by the hex-only picker (`vanilla-colorful`).\n *\n * An `rgba()` whose alpha is anything other than 1 is returned unchanged: that\n * alpha is the stored color, and folding it to hex would drop it on the next\n * edit. Keywords (`transparent`), hex, and empty are returned unchanged.\n */\nexport function normalizeColorToHex(value: string): string {\n const m = RGB_CHANNELS.exec(value.trim());\n if (!m) return value;\n if (m[4] !== undefined && Number(m[4]) !== 1) return value.trim();\n return channelsToHex(m[1], m[2], m[3]);\n}\n\n/**\n * The `#rrggbb` of a color's RGB channels, ignoring alpha. Used to position\n * the hex wheel on a stored `rgba()` without writing that hex back. Returns\n * null for keywords and empty.\n */\nexport function opaqueHex(value: string): string | null {\n const trimmed = value.trim();\n const short = /^#([0-9a-f]{3})$/i.exec(trimmed);\n if (short) {\n const [r, g, b] = short[1].split(\"\");\n return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();\n }\n if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed.toLowerCase();\n const m = RGB_CHANNELS.exec(trimmed);\n if (!m) return null;\n return channelsToHex(m[1], m[2], m[3]);\n}\n\n/**\n * Canonicalize a hex color to the lowercase 6-digit form used for preset\n * membership tests. Runs {@link normalizeColorToHex} first (so a\n * browser-serialized `rgb(...)` round-trip collapses to hex), then expands a\n * 3-digit shorthand (`#abc` → `#aabbcc`) and lowercases it. Non-hex input (a\n * keyword, or empty) is returned unchanged after that rgb normalization —\n * the caller decides whether that counts as a member.\n *\n * Kept separate from `normalizeColorToHex` (which is left untouched) because a\n * configured preset may be `#abc` while the browser round-trips the selected\n * value to `#aabbcc`, and a factory default may be `#FFFFFF` while the preset\n * is `#ffffff` — bare equality misses both. Preset-selection display\n * (`ColorPicker`) and the off-palette defaults audit (`collectOffPaletteDefaults`)\n * both compare through this one function so the two membership tests can't drift.\n */\nexport function canonicalizeHexColor(value: string): string {\n const hex = normalizeColorToHex(value);\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(hex);\n if (short) {\n return `#${short[1]}${short[1]}${short[2]}${short[2]}${short[3]}${short[3]}`.toLowerCase();\n }\n if (/^#[0-9a-f]{6}$/i.test(hex)) {\n return hex.toLowerCase();\n }\n return hex;\n}\n","import type { ColorsConfig } from \"@templatical/types\";\n\n/**\n * Normalized color-picker configuration handed to the provide/inject layer and\n * to `ColorPicker`. `presets` defaults to an empty array and `allowCustom` to\n * `true`, so consumers never branch on `undefined`.\n *\n * `allowCustomIgnored` is a validation signal, not a rendered value: it is\n * `true` when `allowCustom: false` was requested but forced back to `true`\n * because there were no presets to fall back on. This util stays pure — it\n * never logs; the consumer that owns the config surface emits the warning\n * (today that is `useEditorCore` for the editor-level config), the same split\n * `resolvePaletteBlocks` / `Sidebar.vue` use.\n */\nexport interface ResolvedColors {\n presets: string[];\n allowCustom: boolean;\n allowCustomIgnored: boolean;\n /**\n * Preset entries dropped because they are not a valid `#rgb` / `#rrggbb` hex\n * string (see the validity rule on {@link resolveColorsConfig}). Collected —\n * not logged — so the config-owning consumer can warn once listing them,\n * exactly as `allowCustomIgnored` is surfaced. Reflects THIS resolution's\n * `colors.presets` input only: when a `fallback`'s already-resolved (already\n * filtered) presets are inherited, its invalids are never re-reported here.\n */\n invalidPresets: string[];\n}\n\n/**\n * The unconfigured baseline: no presets, free-form entry allowed — i.e. the\n * picker behaves exactly as it did before the `colors` option existed. Used as\n * the inject default and as the fallback for the top-level resolution.\n */\nexport const DEFAULT_RESOLVED_COLORS: ResolvedColors = {\n presets: [],\n allowCustom: true,\n allowCustomIgnored: false,\n invalidPresets: [],\n};\n\n/**\n * A valid preset is a `#rgb` or `#rrggbb` hex string. 4-/8-digit alpha hex is\n * deliberately rejected: the wheel (vanilla-colorful) is RGB-only,\n * `normalizeColorToHex` drops alpha on the DOM round-trip so a selected alpha\n * preset would never read back as selected, and alpha degrades unpredictably\n * across email clients.\n */\nconst VALID_PRESET_HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/**\n * Resolve a `ColorsConfig` against an already-resolved `fallback`, applying\n * precedence per property (`input` → `fallback` → default) plus the shared\n * validation rule.\n *\n * The editor-level call passes no `fallback` (it defaults to\n * {@link DEFAULT_RESOLVED_COLORS}) and its result is provided via `COLORS_KEY`.\n * The `fallback` parameter is the nested-resolution seam: a narrower config can\n * be resolved against a broader already-resolved one, inheriting whichever\n * property it does not set.\n *\n * Validation: entries in `colors.presets` that aren't valid hex\n * ({@link VALID_PRESET_HEX}) are dropped from `presets` and collected into\n * `invalidPresets` for the caller to warn about. Separately, `allowCustom:\n * false` with no presets anywhere in the chain is ignored — forced back to\n * `true`, with `allowCustomIgnored` set so the caller can warn — because\n * hiding the wheel and hex input without a preset grid would leave the picker\n * unable to set a color. Filtering runs BEFORE that guard, so an all-invalid\n * list with `allowCustom: false` cascades into the forced-true path. This\n * mirrors how `paletteBlocks` is resolved: `resolvePaletteBlocks` collects the\n * offending entries and the consumer warns; this util stays pure the same way.\n */\nexport function resolveColorsConfig(\n colors: ColorsConfig | undefined,\n fallback: ResolvedColors = DEFAULT_RESOLVED_COLORS,\n): ResolvedColors {\n // Validate only presets this resolution actually supplies. When it inherits\n // `fallback.presets`, those were already resolved (already filtered), so\n // re-validating would double-report an upstream invalid entry.\n let presets: string[];\n let invalidPresets: string[];\n if (colors?.presets === undefined) {\n presets = fallback.presets;\n invalidPresets = [];\n } else {\n presets = [];\n invalidPresets = [];\n for (const entry of colors.presets) {\n if (VALID_PRESET_HEX.test(entry)) {\n presets.push(entry);\n } else {\n invalidPresets.push(entry);\n }\n }\n }\n\n const requestedAllowCustom = colors?.allowCustom ?? fallback.allowCustom;\n\n const allowCustomIgnored = !requestedAllowCustom && presets.length === 0;\n const allowCustom = allowCustomIgnored ? true : requestedAllowCustom;\n\n return { presets, allowCustom, allowCustomIgnored, invalidPresets };\n}\n","import { inject, ref, type Ref } from \"vue\";\nimport { POPOVER_ROOT_KEY } from \"../keys\";\n\n/**\n * Returns the editor's shared popover mount ref — the `<div\n * class=\"tpl-popover-root\" />` rendered at the top level of `Editor.vue`.\n * Every teleport target (RichTextLinkDialog, TitleEditor\n * toolbar, ParagraphToolbar, TplModal) injects this and teleports to\n * `popoverRoot.value` rather than `to=\"body\"`, so popups stay inside the\n * editor's effective DOM root (shadow-aware).\n *\n * Falls back to a never-resolving `ref(null)` when no provider is in scope.\n * Components must guard with `v-if=\"popoverRoot\"` before teleporting —\n * with the fallback, isolated component tests that don't mount the editor\n * shell simply render nothing rather than blow up.\n *\n * Internal — not exported from the package entry.\n */\nexport function usePopoverRoot(): Ref<HTMLElement | null> {\n return inject(POPOVER_ROOT_KEY, ref<HTMLElement | null>(null));\n}\n","import { usePopoverRoot } from \"./usePopoverRoot\";\n\n/**\n * Coordinate helper for popovers that teleport into the shared popover root\n * (`.tpl-popover-root`, `position: relative`) and position themselves with\n * `position: absolute`.\n *\n * Callers compute a target point in **viewport** space — from\n * `getBoundingClientRect()`, `useElementBounding`, or a TipTap caret rect —\n * and `toLocal` converts it to coordinates **local to the popover root** by\n * subtracting the root's own viewport rect.\n *\n * Why this exists: a `position: fixed` popover resolves its coordinates\n * against the nearest ancestor that establishes a containing block — and any\n * `transform` / `filter` / `will-change` on an ancestor of the editor (a\n * consumer's scroll-parallax wrapper, route-transition, reveal animation…)\n * does exactly that, even while its computed `transform` reads `none` (a\n * running/animated transform still promotes the element). The fixed popover\n * would then be offset by that ancestor's position. Anchoring `absolute`\n * inside the (positioned) popover root instead makes the placement immune:\n * both points are read in viewport space, so the subtraction cancels the\n * ancestor offset, and the popover tracks the editor if the ancestor moves.\n *\n * Read `toLocal` inside a `computed` for a reactive result (recomputes with\n * its viewport-coordinate dependencies), or call it once when a popover opens.\n * Falls back to the viewport coordinates unchanged when no popover root is in\n * scope (isolated component tests / headless callers).\n *\n * Internal — not exported from the package entry.\n */\nexport function usePopoverPosition(): {\n toLocal: (viewport: { top: number; left: number }) => {\n top: number;\n left: number;\n };\n} {\n const popoverRoot = usePopoverRoot();\n function toLocal(viewport: { top: number; left: number }): {\n top: number;\n left: number;\n } {\n const rect = popoverRoot.value?.getBoundingClientRect();\n if (!rect) return { top: viewport.top, left: viewport.left };\n return { top: viewport.top - rect.top, left: viewport.left - rect.left };\n }\n return { toLocal };\n}\n"],"mappings":";;;AAIA,SAAgBM,IAAoB;CAClC,IAAMC,IAASP,EAAOK,GAAY,IAAI,GAChCG,IAAeR,EAAOG,GAAkB,KAAA,CAAS;CACvD,OAAOF,QAAe;EACpB,IAAMQ,IAASF,GAAQ,cAAc;EACrC,OAAO,CAACE,KAAU,CAACD,KAAgBA,EAAa,QAAQ,SAASC,CAAM;CACzE,CAAC;AACH;;ACXA,IAAMC,IACJ;AAEF,SAASC,EAAc,GAAW,GAAW,GAAmB;CAC9D,IAAMC,KAAS,MAAc,OAAOC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;CACnE,OAAO,IAAID,EAAME,CAAC,IAAIF,EAAMG,CAAC,IAAIH,EAAMI,CAAC;AAC1C;AAaA,SAAgBC,EAAoB,GAAuB;CACzD,IAAMC,IAAIR,EAAa,KAAKS,EAAM,KAAK,CAAC;CAGxC,OAFKD,IACDA,EAAE,OAAO,KAAA,KAAa,OAAOA,EAAE,EAAE,MAAM,IAAUC,EAAM,KAAK,IACzDR,EAAcO,EAAE,IAAIA,EAAE,IAAIA,EAAE,EAAE,IAFtBC;AAGjB;AAOA,SAAgBC,EAAU,GAA8B;CACtD,IAAMC,IAAUF,EAAM,KAAK,GACrBG,IAAQ,oBAAoB,KAAKD,CAAO;CAC9C,IAAIC,GAAO;EACT,IAAM,CAACR,GAAGC,GAAGC,KAAKM,EAAM,EAAE,CAAC,MAAM,EAAE;EACnC,OAAO,IAAIR,IAAIA,IAAIC,IAAIA,IAAIC,IAAIA,IAAI,YAAY;CACjD;CACA,IAAI,kBAAkB,KAAKK,CAAO,GAAG,OAAOA,EAAQ,YAAY;CAChE,IAAMH,IAAIR,EAAa,KAAKW,CAAO;CAEnC,OADKH,IACEP,EAAcO,EAAE,IAAIA,EAAE,IAAIA,EAAE,EAAE,IADtB;AAEjB;AAiBA,SAAgBK,EAAqB,GAAuB;CAC1D,IAAMC,IAAMP,EAAoBE,CAAK,GAC/BG,IAAQ,qCAAqC,KAAKE,CAAG;CAO3D,OANIF,IACK,IAAIA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAK,YAAY,IAEvF,kBAAkB,KAAKE,CAAG,IACrBA,EAAI,YAAY,IAElBA;AACT;;ACnCA,IAAaC,IAA0C;CACrD,SAAS,CAAC;CACV,aAAa;CACb,oBAAoB;CACpB,gBAAgB,CAAC;AACnB,GASMC,IAAmB;AAwBzB,SAAgBC,EACd,GACA,IAA2BF,GACX;CAIhB,IAAIG,GACAC;CACJ,IAAIC,GAAQ,YAAY,KAAA,GAEtB,AADA,IAAUC,EAAS,SACnB,IAAiB,CAAC;MACb;EAEL,AADA,IAAU,CAAC,GACX,IAAiB,CAAC;EAClB,KAAK,IAAMC,KAASF,EAAO,SACzB,AAAIJ,EAAiB,KAAKM,CAAK,IAC7BJ,EAAQ,KAAKI,CAAK,IAElBH,EAAe,KAAKG,CAAK;CAG/B;CAEA,IAAMC,IAAuBH,GAAQ,eAAeC,EAAS,aAEvDG,IAAqB,CAACD,KAAwBL,EAAQ,WAAW;CAGvE,OAAO;EAAE;EAAS,aAFEM,IAAqB,KAAOD;EAEjB;EAAoB;CAAe;AACpE;;ACpFA,SAAgBE,IAA0C;CACxD,OAAOnC,EAAOI,GAAkBF,EAAwB,IAAI,CAAC;AAC/D;;ACUA,SAAgBkC,IAKd;CACA,IAAMC,IAAcF,EAAe;CACnC,SAASG,EAAQ,GAGf;EACA,IAAMC,IAAOF,EAAY,OAAO,sBAAsB;EAEtD,OADKE,IACE;GAAE,KAAKC,EAAS,MAAMD,EAAK;GAAK,MAAMC,EAAS,OAAOD,EAAK;EAAK,IADrD;GAAE,KAAKC,EAAS;GAAK,MAAMA,EAAS;EAAK;CAE7D;CACA,OAAO,EAAE,WAAQ;AACnB"}
|
|
1
|
+
{"version":3,"file":"usePopoverPosition-Cg8LR0W4.js","names":["inject","computed","ref","LOCALIZATION_KEY","POPOVER_ROOT_KEY","EDITOR_KEY","useLocaleEditable","editor","localization","locale","RGB_CHANNELS","channelsToHex","toHex","n","r","g","b","normalizeColorToHex","m","value","opaqueHex","trimmed","short","canonicalizeHexColor","hex","DEFAULT_RESOLVED_COLORS","VALID_PRESET_HEX","resolveColorsConfig","presets","invalidPresets","colors","fallback","entry","requestedAllowCustom","allowCustomIgnored","usePopoverRoot","usePopoverPosition","popoverRoot","toLocal","rect","viewport"],"sources":["../../../src/composables/useLocaleEditable.ts","../../../src/utils/color.ts","../../../src/utils/resolveColorsConfig.ts","../../../src/composables/usePopoverRoot.ts","../../../src/composables/usePopoverPosition.ts"],"sourcesContent":["import { computed, inject } from \"vue\";\nimport { EDITOR_KEY, LOCALIZATION_KEY } from \"../keys\";\n\n/** Whether the active language is enabled for authoring. */\nexport function useLocaleEditable() {\n const editor = inject(EDITOR_KEY, null);\n const localization = inject(LOCALIZATION_KEY, undefined);\n return computed(() => {\n const locale = editor?.activeLocale?.value;\n return !locale || !localization || localization.locales.includes(locale);\n });\n}\n","const RGB_CHANNELS =\n /^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)(?:\\s*,\\s*(\\d*\\.?\\d+)\\s*)?\\)$/i;\n\nfunction channelsToHex(r: string, g: string, b: string): string {\n const toHex = (n: string) => Number(n).toString(16).padStart(2, \"0\");\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\n/**\n * Normalize an opaque `rgb()` / `rgba(..., 1)` to `#rrggbb`. The browser\n * serializes an inline `style=\"color:#hex\"` to `rgb(...)`, so reading a stored\n * color back via `element.style.color` (e.g. a TipTap textStyle/highlight mark,\n * or a saved link color) surfaces `rgb(...)` — mismatching the hex used\n * everywhere else, and unparseable by the hex-only picker (`vanilla-colorful`).\n *\n * An `rgba()` whose alpha is anything other than 1 is returned unchanged: that\n * alpha is the stored color, and folding it to hex would drop it on the next\n * edit. Keywords (`transparent`), hex, and empty are returned unchanged.\n */\nexport function normalizeColorToHex(value: string): string {\n const m = RGB_CHANNELS.exec(value.trim());\n if (!m) return value;\n if (m[4] !== undefined && Number(m[4]) !== 1) return value.trim();\n return channelsToHex(m[1], m[2], m[3]);\n}\n\n/**\n * The `#rrggbb` of a color's RGB channels, ignoring alpha. Used to position\n * the hex wheel on a stored `rgba()` without writing that hex back. Returns\n * null for keywords and empty.\n */\nexport function opaqueHex(value: string): string | null {\n const trimmed = value.trim();\n const short = /^#([0-9a-f]{3})$/i.exec(trimmed);\n if (short) {\n const [r, g, b] = short[1].split(\"\");\n return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();\n }\n if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed.toLowerCase();\n const m = RGB_CHANNELS.exec(trimmed);\n if (!m) return null;\n return channelsToHex(m[1], m[2], m[3]);\n}\n\n/**\n * Canonicalize a hex color to the lowercase 6-digit form used for preset\n * membership tests. Runs {@link normalizeColorToHex} first (so a\n * browser-serialized `rgb(...)` round-trip collapses to hex), then expands a\n * 3-digit shorthand (`#abc` → `#aabbcc`) and lowercases it. Non-hex input (a\n * keyword, or empty) is returned unchanged after that rgb normalization —\n * the caller decides whether that counts as a member.\n *\n * Kept separate from `normalizeColorToHex` (which is left untouched) because a\n * configured preset may be `#abc` while the browser round-trips the selected\n * value to `#aabbcc`, and a factory default may be `#FFFFFF` while the preset\n * is `#ffffff` — bare equality misses both. Preset-selection display\n * (`ColorPicker`) and the off-palette defaults audit (`collectOffPaletteDefaults`)\n * both compare through this one function so the two membership tests can't drift.\n */\nexport function canonicalizeHexColor(value: string): string {\n const hex = normalizeColorToHex(value);\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(hex);\n if (short) {\n return `#${short[1]}${short[1]}${short[2]}${short[2]}${short[3]}${short[3]}`.toLowerCase();\n }\n if (/^#[0-9a-f]{6}$/i.test(hex)) {\n return hex.toLowerCase();\n }\n return hex;\n}\n","import type { ColorsConfig } from \"@templatical/types\";\n\n/**\n * Normalized color-picker configuration handed to the provide/inject layer and\n * to `ColorPicker`. `presets` defaults to an empty array and `allowCustom` to\n * `true`, so consumers never branch on `undefined`.\n *\n * `allowCustomIgnored` is a validation signal, not a rendered value: it is\n * `true` when `allowCustom: false` was requested but forced back to `true`\n * because there were no presets to fall back on. This util stays pure — it\n * never logs; the consumer that owns the config surface emits the warning\n * (today that is `useEditorCore` for the editor-level config), the same split\n * `resolvePaletteBlocks` / `Sidebar.vue` use.\n */\nexport interface ResolvedColors {\n presets: string[];\n allowCustom: boolean;\n allowCustomIgnored: boolean;\n /**\n * Preset entries dropped because they are not a valid `#rgb` / `#rrggbb` hex\n * string (see the validity rule on {@link resolveColorsConfig}). Collected —\n * not logged — so the config-owning consumer can warn once listing them,\n * exactly as `allowCustomIgnored` is surfaced. Reflects THIS resolution's\n * `colors.presets` input only: when a `fallback`'s already-resolved (already\n * filtered) presets are inherited, its invalids are never re-reported here.\n */\n invalidPresets: string[];\n}\n\n/**\n * The unconfigured baseline: no presets, free-form entry allowed — i.e. the\n * picker behaves exactly as it did before the `colors` option existed. Used as\n * the inject default and as the fallback for the top-level resolution.\n */\nexport const DEFAULT_RESOLVED_COLORS: ResolvedColors = {\n presets: [],\n allowCustom: true,\n allowCustomIgnored: false,\n invalidPresets: [],\n};\n\n/**\n * A valid preset is a `#rgb` or `#rrggbb` hex string. 4-/8-digit alpha hex is\n * deliberately rejected: the wheel (vanilla-colorful) is RGB-only,\n * `normalizeColorToHex` drops alpha on the DOM round-trip so a selected alpha\n * preset would never read back as selected, and alpha degrades unpredictably\n * across email clients.\n */\nconst VALID_PRESET_HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/**\n * Resolve a `ColorsConfig` against an already-resolved `fallback`, applying\n * precedence per property (`input` → `fallback` → default) plus the shared\n * validation rule.\n *\n * The editor-level call passes no `fallback` (it defaults to\n * {@link DEFAULT_RESOLVED_COLORS}) and its result is provided via `COLORS_KEY`.\n * The `fallback` parameter is the nested-resolution seam: a narrower config can\n * be resolved against a broader already-resolved one, inheriting whichever\n * property it does not set.\n *\n * Validation: entries in `colors.presets` that aren't valid hex\n * ({@link VALID_PRESET_HEX}) are dropped from `presets` and collected into\n * `invalidPresets` for the caller to warn about. Separately, `allowCustom:\n * false` with no presets anywhere in the chain is ignored — forced back to\n * `true`, with `allowCustomIgnored` set so the caller can warn — because\n * hiding the wheel and hex input without a preset grid would leave the picker\n * unable to set a color. Filtering runs BEFORE that guard, so an all-invalid\n * list with `allowCustom: false` cascades into the forced-true path. This\n * mirrors how `paletteBlocks` is resolved: `resolvePaletteBlocks` collects the\n * offending entries and the consumer warns; this util stays pure the same way.\n */\nexport function resolveColorsConfig(\n colors: ColorsConfig | undefined,\n fallback: ResolvedColors = DEFAULT_RESOLVED_COLORS,\n): ResolvedColors {\n // Validate only presets this resolution actually supplies. When it inherits\n // `fallback.presets`, those were already resolved (already filtered), so\n // re-validating would double-report an upstream invalid entry.\n let presets: string[];\n let invalidPresets: string[];\n if (colors?.presets === undefined) {\n presets = fallback.presets;\n invalidPresets = [];\n } else {\n presets = [];\n invalidPresets = [];\n for (const entry of colors.presets) {\n if (VALID_PRESET_HEX.test(entry)) {\n presets.push(entry);\n } else {\n invalidPresets.push(entry);\n }\n }\n }\n\n const requestedAllowCustom = colors?.allowCustom ?? fallback.allowCustom;\n\n const allowCustomIgnored = !requestedAllowCustom && presets.length === 0;\n const allowCustom = allowCustomIgnored ? true : requestedAllowCustom;\n\n return { presets, allowCustom, allowCustomIgnored, invalidPresets };\n}\n","import { inject, ref, type Ref } from \"vue\";\nimport { POPOVER_ROOT_KEY } from \"../keys\";\n\n/**\n * Returns the editor's shared popover mount ref — the `<div\n * class=\"tpl-popover-root\" />` rendered at the top level of `Editor.vue`.\n * Every teleport target (RichTextLinkDialog, TitleEditor\n * toolbar, ParagraphToolbar, TplModal) injects this and teleports to\n * `popoverRoot.value` rather than `to=\"body\"`, so popups stay inside the\n * editor's effective DOM root (shadow-aware).\n *\n * Falls back to a never-resolving `ref(null)` when no provider is in scope.\n * Components must guard with `v-if=\"popoverRoot\"` before teleporting —\n * with the fallback, isolated component tests that don't mount the editor\n * shell simply render nothing rather than blow up.\n *\n * Internal — not exported from the package entry.\n */\nexport function usePopoverRoot(): Ref<HTMLElement | null> {\n return inject(POPOVER_ROOT_KEY, ref<HTMLElement | null>(null));\n}\n","import { usePopoverRoot } from \"./usePopoverRoot\";\n\n/**\n * Coordinate helper for popovers that teleport into the shared popover root\n * (`.tpl-popover-root`, `position: relative`) and position themselves with\n * `position: absolute`.\n *\n * Callers compute a target point in **viewport** space — from\n * `getBoundingClientRect()`, `useElementBounding`, or a TipTap caret rect —\n * and `toLocal` converts it to coordinates **local to the popover root** by\n * subtracting the root's own viewport rect.\n *\n * Why this exists: a `position: fixed` popover resolves its coordinates\n * against the nearest ancestor that establishes a containing block — and any\n * `transform` / `filter` / `will-change` on an ancestor of the editor (a\n * consumer's scroll-parallax wrapper, route-transition, reveal animation…)\n * does exactly that, even while its computed `transform` reads `none` (a\n * running/animated transform still promotes the element). The fixed popover\n * would then be offset by that ancestor's position. Anchoring `absolute`\n * inside the (positioned) popover root instead makes the placement immune:\n * both points are read in viewport space, so the subtraction cancels the\n * ancestor offset, and the popover tracks the editor if the ancestor moves.\n *\n * Read `toLocal` inside a `computed` for a reactive result (recomputes with\n * its viewport-coordinate dependencies), or call it once when a popover opens.\n * Falls back to the viewport coordinates unchanged when no popover root is in\n * scope (isolated component tests / headless callers).\n *\n * Internal — not exported from the package entry.\n */\nexport function usePopoverPosition(): {\n toLocal: (viewport: { top: number; left: number }) => {\n top: number;\n left: number;\n };\n} {\n const popoverRoot = usePopoverRoot();\n function toLocal(viewport: { top: number; left: number }): {\n top: number;\n left: number;\n } {\n const rect = popoverRoot.value?.getBoundingClientRect();\n if (!rect) return { top: viewport.top, left: viewport.left };\n return { top: viewport.top - rect.top, left: viewport.left - rect.left };\n }\n return { toLocal };\n}\n"],"mappings":";;;AAIA,SAAgBM,IAAoB;CAClC,IAAMC,IAASP,EAAOK,GAAY,IAAI,GAChCG,IAAeR,EAAOG,GAAkB,KAAA,CAAS;CACvD,OAAOF,QAAe;EACpB,IAAMQ,IAASF,GAAQ,cAAc;EACrC,OAAO,CAACE,KAAU,CAACD,KAAgBA,EAAa,QAAQ,SAASC,CAAM;CACzE,CAAC;AACH;;ACXA,IAAMC,IACJ;AAEF,SAASC,EAAc,GAAW,GAAW,GAAmB;CAC9D,IAAMC,KAAS,MAAc,OAAOC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;CACnE,OAAO,IAAID,EAAME,CAAC,IAAIF,EAAMG,CAAC,IAAIH,EAAMI,CAAC;AAC1C;AAaA,SAAgBC,EAAoB,GAAuB;CACzD,IAAMC,IAAIR,EAAa,KAAKS,EAAM,KAAK,CAAC;CAGxC,OAFKD,IACDA,EAAE,OAAO,KAAA,KAAa,OAAOA,EAAE,EAAE,MAAM,IAAUC,EAAM,KAAK,IACzDR,EAAcO,EAAE,IAAIA,EAAE,IAAIA,EAAE,EAAE,IAFtBC;AAGjB;AAOA,SAAgBC,EAAU,GAA8B;CACtD,IAAMC,IAAUF,EAAM,KAAK,GACrBG,IAAQ,oBAAoB,KAAKD,CAAO;CAC9C,IAAIC,GAAO;EACT,IAAM,CAACR,GAAGC,GAAGC,KAAKM,EAAM,EAAE,CAAC,MAAM,EAAE;EACnC,OAAO,IAAIR,IAAIA,IAAIC,IAAIA,IAAIC,IAAIA,IAAI,YAAY;CACjD;CACA,IAAI,kBAAkB,KAAKK,CAAO,GAAG,OAAOA,EAAQ,YAAY;CAChE,IAAMH,IAAIR,EAAa,KAAKW,CAAO;CAEnC,OADKH,IACEP,EAAcO,EAAE,IAAIA,EAAE,IAAIA,EAAE,EAAE,IADtB;AAEjB;AAiBA,SAAgBK,EAAqB,GAAuB;CAC1D,IAAMC,IAAMP,EAAoBE,CAAK,GAC/BG,IAAQ,qCAAqC,KAAKE,CAAG;CAO3D,OANIF,IACK,IAAIA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAKA,EAAM,KAAK,YAAY,IAEvF,kBAAkB,KAAKE,CAAG,IACrBA,EAAI,YAAY,IAElBA;AACT;;ACnCA,IAAaC,IAA0C;CACrD,SAAS,CAAC;CACV,aAAa;CACb,oBAAoB;CACpB,gBAAgB,CAAC;AACnB,GASMC,IAAmB;AAwBzB,SAAgBC,EACd,GACA,IAA2BF,GACX;CAIhB,IAAIG,GACAC;CACJ,IAAIC,GAAQ,YAAY,KAAA,GAEtB,AADA,IAAUC,EAAS,SACnB,IAAiB,CAAC;MACb;EAEL,AADA,IAAU,CAAC,GACX,IAAiB,CAAC;EAClB,KAAK,IAAMC,KAASF,EAAO,SACzB,AAAIJ,EAAiB,KAAKM,CAAK,IAC7BJ,EAAQ,KAAKI,CAAK,IAElBH,EAAe,KAAKG,CAAK;CAG/B;CAEA,IAAMC,IAAuBH,GAAQ,eAAeC,EAAS,aAEvDG,IAAqB,CAACD,KAAwBL,EAAQ,WAAW;CAGvE,OAAO;EAAE;EAAS,aAFEM,IAAqB,KAAOD;EAEjB;EAAoB;CAAe;AACpE;;ACpFA,SAAgBE,IAA0C;CACxD,OAAOnC,EAAOI,GAAkBF,EAAwB,IAAI,CAAC;AAC/D;;ACUA,SAAgBkC,IAKd;CACA,IAAMC,IAAcF,EAAe;CACnC,SAASG,EAAQ,GAGf;EACA,IAAMC,IAAOF,EAAY,OAAO,sBAAsB;EAEtD,OADKE,IACE;GAAE,KAAKC,EAAS,MAAMD,EAAK;GAAK,MAAMC,EAAS,OAAOD,EAAK;EAAK,IADrD;GAAE,KAAKC,EAAS;GAAK,MAAMA,EAAS;EAAK;CAE7D;CACA,OAAO,EAAE,WAAQ;AACnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as e } from "./draggable-IRVFEZ-b.js";
|
|
2
|
-
import { t } from "./useEditorRoot-
|
|
2
|
+
import { t } from "./useEditorRoot-BPVxLYFD.js";
|
|
3
3
|
// src/utils/aiFixableRules.ts
|
|
4
4
|
var n = [
|
|
5
5
|
"a11y.link-vague-text",
|
|
@@ -46,4 +46,4 @@ function s() {
|
|
|
46
46
|
}
|
|
47
47
|
export { i as a, a as i, r as n, n as r, o as t };
|
|
48
48
|
|
|
49
|
-
//# sourceMappingURL=useScrollToBlock-
|
|
49
|
+
//# sourceMappingURL=useScrollToBlock-CS7zo4oQ.js.map
|
package/dist/cdn/chunks/{useScrollToBlock-32EnuMwu.js.map → useScrollToBlock-CS7zo4oQ.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollToBlock-
|
|
1
|
+
{"version":3,"file":"useScrollToBlock-CS7zo4oQ.js","names":["nextTick","AI_FIXABLE_RULES","AI_ALT_TEXT_RULES","toAiFixFinding","issue","effectiveAltMaxLength","accessibility","lint","value","useScrollToBlock","useEditorRoot","target","root","blockId","behavior","prefersReducedMotion"],"sources":["../../../src/utils/aiFixableRules.ts","../../../src/composables/useScrollToBlock.ts"],"sourcesContent":["import type { AiFixFinding } from \"@templatical/types\";\nimport type { LintOptions, LintIssue } from \"@templatical/quality\";\n\n/** Lint rules whose findings get \"Fix with AI\" (A1 amendment R3). */\nexport const AI_FIXABLE_RULES = [\n \"a11y.link-vague-text\",\n \"a11y.button-vague-label\",\n \"a11y.link-empty\",\n \"a11y.text-all-caps\",\n \"a11y.missing-preheader\",\n \"deliverability.link-text-domain-mismatch\",\n \"deliverability.low-text\",\n] as const;\n\n/** Lint rules whose findings get \"Write alt text\" (A1 amendment R4). */\nexport const AI_ALT_TEXT_RULES = [\n \"a11y.img-missing-alt\",\n \"a11y.img-alt-is-filename\",\n \"a11y.img-alt-too-long\",\n \"a11y.img-linked-no-context\",\n] as const;\n\n/** Copy only the serializable lint diagnostic that the AI contract accepts. */\nexport function toAiFixFinding(issue: LintIssue): AiFixFinding {\n return {\n ruleId: issue.ruleId,\n message: issue.message,\n suggestion: issue.suggestion,\n reference: issue.reference,\n blockId: issue.blockId,\n ...(issue.excerpt !== undefined ? { excerpt: issue.excerpt } : {}),\n };\n}\n\n/** Quality's default, pinned by aiFixableRules.test.ts without an eager runtime import. */\nexport const DEFAULT_ALT_MAX_LENGTH = 125;\n\nexport function effectiveAltMaxLength(lint: LintOptions | undefined): number {\n const accessibility = lint?.accessibility;\n const value =\n accessibility !== null && typeof accessibility === \"object\"\n ? accessibility.thresholds?.altMaxLength\n : undefined;\n return lint?.disabled !== true &&\n typeof value === \"number\" &&\n Number.isInteger(value) &&\n value >= 1 &&\n value <= 1000\n ? value\n : DEFAULT_ALT_MAX_LENGTH;\n}\n","import { nextTick } from \"vue\";\nimport { useEditorRoot } from \"./useEditorRoot\";\n\n/**\n * Returns a function that brings a block into view on the canvas.\n *\n * Selecting a block is not by itself visible: on a long template the selected\n * block can sit far below the fold while the canvas stays exactly where it was,\n * so an insert or a jump reads as \"nothing happened\". This is what makes the\n * outcome visible at the user's position.\n *\n * Queries through `useEditorRoot()` rather than `document` — in the default\n * shadow-DOM mount the blocks live in the shadow tree, where a document-level\n * query matches nothing.\n *\n * Scrolling is deferred one tick so a block inserted in the same call has\n * rendered by the time it is looked up. `block: \"nearest\"` leaves an\n * already-visible block alone instead of yanking it to the top.\n *\n * `Editor.vue` passes `root` itself: it is the component that provides\n * `EDITOR_ROOT_KEY`, and a component never sees its own provides.\n */\nexport function useScrollToBlock(\n root: Document | ShadowRoot = useEditorRoot(),\n): (blockId: string, behavior?: ScrollBehavior) => void {\n return (blockId: string, behavior?: ScrollBehavior) => {\n void nextTick(() => {\n const target = root.querySelector(`[data-block-id=\"${blockId}\"]`);\n if (!target) return;\n target.scrollIntoView({\n block: \"nearest\",\n behavior: behavior ?? (prefersReducedMotion() ? \"auto\" : \"smooth\"),\n });\n });\n };\n}\n\nfunction prefersReducedMotion(): boolean {\n // Absent in some embedding contexts; a throw here would break the insert\n // that asked for the scroll, so treat \"can't tell\" as motion allowed.\n if (typeof matchMedia !== \"function\") return false;\n return matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n}\n"],"mappings":";;;AAIA,IAAaC,IAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAGaC,IAAoB;CAC/B;CACA;CACA;CACA;AACF;AAGA,SAAgBC,EAAe,GAAgC;CAC7D,OAAO;EACL,QAAQC,EAAM;EACd,SAASA,EAAM;EACf,YAAYA,EAAM;EAClB,WAAWA,EAAM;EACjB,SAASA,EAAM;EACf,GAAIA,EAAM,YAAY,KAAA,IAAyC,CAAC,IAA9B,EAAE,SAASA,EAAM,QAAQ;CAC7D;AACF;AAKA,SAAgBC,EAAsB,GAAuC;CAC3E,IAAMC,IAAgBC,GAAM,eACtBC,IACsB,OAAOF,KAAkB,YAAnDA,IACIA,EAAc,YAAY,eAC1B,KAAA;CACN,OAAOC,GAAM,aAAa,MACxB,OAAOC,KAAU,YACjB,OAAO,UAAUA,CAAK,KACtBA,KAAS,KACTA,KAAS,MACPA,IAAA;AAEN;;AC5BA,SAAgBC,EACd,IAA8BC,EAAc,GACU;CACtD,QAAQ,GAAiB,MAA8B;EACrD,QAAoB;GAClB,IAAMC,IAASC,EAAK,cAAc,mBAAmBC,EAAQ,GAAG;GAChE,AAAKF,KACLA,EAAO,eAAe;IACpB,OAAO;IACP,UAAUG,MAAaC,EAAqB,IAAI,SAAS;GAC3D,CAAC;EACH,CAAC;CACH;AACF;AAEA,SAASA,IAAgC;CAIvC,OADI,OAAO,cAAe,cACnB,WAAW,kCAAkC,CAAC,CAAC;AACxD"}
|