@templatical/editor 0.54.2 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiAltTextPopover-BBKVJ6HA.js → AiAltTextPopover-DdsvhE78.js} +4 -4
- package/dist/{AiAltTextReview-BuVbeQh-.js → AiAltTextReview-P6to1_0t.js} +3 -3
- package/dist/{AiChatPanel-C8SeEJRP.js → AiChatPanel-BSlmzMRC.js} +10 -10
- package/dist/{AiPanels-CR6zphjP.js → AiPanels-DAsnX-a3.js} +1 -1
- package/dist/{AiRewriteMenu-ZpYJfm-O.js → AiRewriteMenu-DIISOR6U.js} +11 -11
- package/dist/{BlockIssueBadge-DaPTq1RE.js → BlockIssueBadge-Bmtc50BQ.js} +4 -4
- package/dist/BlockPreviewCanvas-BYIzNn-9.js +154 -0
- package/dist/{CloudHeaderExtras-XpjJjn3o.js → CloudHeaderExtras-Cqhw-jMz.js} +1 -1
- package/dist/{CloudPanels-DQRWMc59.js → CloudPanels-w34W8_BP.js} +4 -4
- package/dist/{CollaborationNotices-Cnx0XHzZ.js → CollaborationNotices-HTbCebjV.js} +2 -2
- package/dist/{CollaboratorBar-BaBoNhwB.js → CollaboratorBar-CLQjksX-.js} +2 -2
- package/dist/{CommentsPanel-Ck3QmqiC.js → CommentsPanel-C5qG17Ki.js} +1 -1
- package/dist/{CommentsSidebar-CHknhOar.js → CommentsSidebar-C7CWcUYZ.js} +12 -12
- package/dist/{CountdownBlock-BMezkFbJ.js → CountdownBlock-BTXcCvjZ.js} +2 -2
- package/dist/{CountdownToolbar-DTpMEDyh.js → CountdownToolbar-CP-pkntQ.js} +5 -5
- package/dist/{IssuesPanel-BZn7-p9e.js → IssuesPanel-CiiNBzH0.js} +12 -12
- package/dist/{LanguageMenu-OOmQWVzO.js → LanguageMenu-B981Av-6.js} +15 -15
- package/dist/{LocaleNotices-WzsYtBRs.js → LocaleNotices-CTCZ7BYv.js} +4 -4
- package/dist/{LogicTagInsertButton-XESwnJia.js → LogicTagInsertButton-DEOPc4RC.js} +284 -279
- package/dist/{MediaEditModal-C3U9Mi31.js → MediaEditModal-DJsPLTwP.js} +1 -1
- package/dist/{MediaPanels-CGmk9ufe.js → MediaPanels-D2WD2aE2.js} +1 -1
- package/dist/{MergeTagInput-CAsBRoSm.js → MergeTagInput-C9icdxw7.js} +1 -1
- package/dist/{MergeTagModeToggle-bOf27Hg1.js → MergeTagModeToggle-DXvb80OE.js} +6 -6
- package/dist/{MergeTagTextarea-DH_6JFui.js → MergeTagTextarea-CrAcmT3A.js} +5 -5
- package/dist/{ParagraphEditor-XGUkV5Uw.js → ParagraphEditor-BWBQ3jKz.js} +55 -55
- package/dist/{RestoreVersionDialog-C72kWccI.js → RestoreVersionDialog-CqAp16yQ.js} +4 -4
- package/dist/{RichTextEditorContent-BZN8KRvR.js → RichTextEditorContent-xbBjVPVQ.js} +8 -8
- package/dist/{SaveBlockDialog-CKOnTMTU.js → SaveBlockDialog-pebNJBTc.js} +9 -9
- package/dist/{SavedBlocksBrowserModal-BrlNxqDH.js → SavedBlocksBrowserModal-CvagMcv7.js} +11 -11
- package/dist/{SavedBlocksPanels--lPR6gdh.js → SavedBlocksPanels-B9AAVBDm.js} +1 -1
- package/dist/{SavedBlocksPickBar-4ON4_KKl.js → SavedBlocksPickBar-BIANWe3i.js} +3 -3
- package/dist/{TemplateSettings-BE0jZmRJ.js → TemplateSettings-ORq4PbCN.js} +12 -12
- package/dist/{TestEmailModal-BKmNGrZN.js → TestEmailModal-DRjCpcPl.js} +11 -11
- package/dist/{TestEmailPanel-DT1wllX3.js → TestEmailPanel-H0v8El__.js} +1 -1
- package/dist/{TitleEditor-HjVZuUTB.js → TitleEditor-CEGbJXeU.js} +11 -11
- package/dist/{Toolbar-BppchV2k.js → Toolbar-XT-uGA9J.js} +1134 -852
- package/dist/{TplModal-BFWOoK8l.js → TplModal-7NQq5-VW.js} +4 -4
- package/dist/{VersionHistoryMenu-BnP0EyLl.js → VersionHistoryMenu-C8BE3Pr-.js} +7 -7
- package/dist/{VersionHistoryPanels-D4yNVLvq.js → VersionHistoryPanels-CuKuOSJG.js} +1 -1
- package/dist/{VersionPreviewBanner-BPP939cD.js → VersionPreviewBanner-BVFBkveR.js} +2 -2
- package/dist/WrapperBlock-Bdw-072t.js +56 -0
- package/dist/{blockTypeIcons-D91v9k0x.js → blockTypeIcons-CGplGmmr.js} +3 -3
- package/dist/bundle-stats.json +6 -6
- package/dist/{ca-DOuIxWRv.js → ca-BJn8lcJx.js} +18 -1
- package/dist/cdn/chunks/{AiAltTextPopover-CAI18sdv.js → AiAltTextPopover-x999Gimz.js} +5 -5
- package/dist/cdn/chunks/{AiAltTextPopover-CAI18sdv.js.map → AiAltTextPopover-x999Gimz.js.map} +1 -1
- package/dist/cdn/chunks/{AiAltTextReview-CWEyMOF-.js → AiAltTextReview-DjnFz1wO.js} +4 -4
- package/dist/cdn/chunks/{AiAltTextReview-CWEyMOF-.js.map → AiAltTextReview-DjnFz1wO.js.map} +1 -1
- package/dist/cdn/chunks/{AiChatPanel-By8Uo1nH.js → AiChatPanel-DKDu9cs7.js} +4 -4
- package/dist/cdn/chunks/{AiChatPanel-By8Uo1nH.js.map → AiChatPanel-DKDu9cs7.js.map} +1 -1
- package/dist/cdn/chunks/{AiPanels-BblCSkQy.js → AiPanels-jMLVaiKx.js} +2 -2
- package/dist/cdn/chunks/{AiPanels-BblCSkQy.js.map → AiPanels-jMLVaiKx.js.map} +1 -1
- package/dist/cdn/chunks/{AiRewriteMenu-BEepu1vo.js → AiRewriteMenu-s79rmHFy.js} +10 -10
- package/dist/cdn/chunks/{AiRewriteMenu-BEepu1vo.js.map → AiRewriteMenu-s79rmHFy.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-D3Plo_wt.js → BlockIssueBadge-Bnmq_M4G.js} +4 -4
- package/dist/cdn/chunks/{BlockIssueBadge-D3Plo_wt.js.map → BlockIssueBadge-Bnmq_M4G.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-B6ndvof2.js → BlockPreviewCanvas-B3HkuENF.js} +46 -32
- package/dist/cdn/chunks/BlockPreviewCanvas-B3HkuENF.js.map +1 -0
- package/dist/cdn/chunks/{CloudHeaderExtras-BtqdN777.js → CloudHeaderExtras-uUJYJFJ6.js} +2 -2
- package/dist/cdn/chunks/{CloudHeaderExtras-BtqdN777.js.map → CloudHeaderExtras-uUJYJFJ6.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-BGwDb0jB.js → CloudPanels-DQnlH_YJ.js} +4 -4
- package/dist/cdn/chunks/{CloudPanels-BGwDb0jB.js.map → CloudPanels-DQnlH_YJ.js.map} +1 -1
- package/dist/cdn/chunks/{CollaborationNotices-DraFUhyo.js → CollaborationNotices-CHqUGhOZ.js} +3 -3
- package/dist/cdn/chunks/{CollaborationNotices-DraFUhyo.js.map → CollaborationNotices-CHqUGhOZ.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-0OEH3hrj.js → CollaboratorBar-C1ZI2xwa.js} +3 -3
- package/dist/cdn/chunks/{CollaboratorBar-0OEH3hrj.js.map → CollaboratorBar-C1ZI2xwa.js.map} +1 -1
- package/dist/cdn/chunks/{CommentsPanel-tZZswofV.js → CommentsPanel-EtdTzTmq.js} +2 -2
- package/dist/cdn/chunks/{CommentsPanel-tZZswofV.js.map → CommentsPanel-EtdTzTmq.js.map} +1 -1
- package/dist/cdn/chunks/{CommentsSidebar-7Hfl3Hdj.js → CommentsSidebar-Qmj049QX.js} +4 -4
- package/dist/cdn/chunks/{CommentsSidebar-7Hfl3Hdj.js.map → CommentsSidebar-Qmj049QX.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-CjMhMhnv.js → CountdownBlock-DyGsh92b.js} +3 -3
- package/dist/cdn/chunks/{CountdownBlock-CjMhMhnv.js.map → CountdownBlock-DyGsh92b.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-B-0FsTj-.js → CountdownToolbar-Ddj2erNm.js} +6 -6
- package/dist/cdn/chunks/{CountdownToolbar-B-0FsTj-.js.map → CountdownToolbar-Ddj2erNm.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-LyjMBDok.js → IssuesPanel-DnSnEh1X.js} +8 -8
- package/dist/cdn/chunks/{IssuesPanel-LyjMBDok.js.map → IssuesPanel-DnSnEh1X.js.map} +1 -1
- package/dist/cdn/chunks/{LanguageMenu-CGwMCOQ5.js → LanguageMenu-C2I_yTL5.js} +110 -110
- package/dist/cdn/chunks/{LanguageMenu-CGwMCOQ5.js.map → LanguageMenu-C2I_yTL5.js.map} +1 -1
- package/dist/cdn/chunks/{LocaleNotices-8J2DRWeg.js → LocaleNotices-Dr9LRCAg.js} +4 -4
- package/dist/cdn/chunks/{LocaleNotices-8J2DRWeg.js.map → LocaleNotices-Dr9LRCAg.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-PDKuo2J3.js → LogicTagInsertButton-BdzE9-l7.js} +260 -255
- package/dist/cdn/chunks/LogicTagInsertButton-BdzE9-l7.js.map +1 -0
- package/dist/cdn/chunks/{MediaEditModal-Dz972UFx.js → MediaEditModal-CMJFXu_o.js} +2 -2
- package/dist/cdn/chunks/{MediaEditModal-Dz972UFx.js.map → MediaEditModal-CMJFXu_o.js.map} +1 -1
- package/dist/cdn/chunks/{MediaPanels-C6Hqtp1H.js → MediaPanels-C790ZXuY.js} +2 -2
- package/dist/cdn/chunks/{MediaPanels-C6Hqtp1H.js.map → MediaPanels-C790ZXuY.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-DoQHBJk2.js → MergeTagInput-CmrX8Md6.js} +2 -2
- package/dist/cdn/chunks/{MergeTagInput-DoQHBJk2.js.map → MergeTagInput-CmrX8Md6.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-Ct5IG4VW.js → MergeTagModeToggle-D7maMGIM.js} +5 -5
- package/dist/cdn/chunks/{MergeTagModeToggle-Ct5IG4VW.js.map → MergeTagModeToggle-D7maMGIM.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagTextarea-BMsnjphR.js → MergeTagTextarea-KOnd2teB.js} +8 -8
- package/dist/cdn/chunks/{MergeTagTextarea-BMsnjphR.js.map → MergeTagTextarea-KOnd2teB.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-CVW-kuHW.js → ParagraphEditor-I9lbKaPk.js} +19 -19
- package/dist/cdn/chunks/{ParagraphEditor-CVW-kuHW.js.map → ParagraphEditor-I9lbKaPk.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-7MFZz-Sb.js → RestoreVersionDialog-DqbULAbc.js} +4 -4
- package/dist/cdn/chunks/{RestoreVersionDialog-7MFZz-Sb.js.map → RestoreVersionDialog-DqbULAbc.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-CiL-SkZg.js → RichTextEditorContent-_O22z0pn.js} +8 -8
- package/dist/cdn/chunks/{RichTextEditorContent-CiL-SkZg.js.map → RichTextEditorContent-_O22z0pn.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-CxdekCYy.js → SaveBlockDialog-CClRLXgF.js} +8 -8
- package/dist/cdn/chunks/{SaveBlockDialog-CxdekCYy.js.map → SaveBlockDialog-CClRLXgF.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-D9CAa2U3.js → SavedBlocksBrowserModal-BIaxaxw9.js} +8 -8
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-D9CAa2U3.js.map → SavedBlocksBrowserModal-BIaxaxw9.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-jfkYWtss.js → SavedBlocksPanels-Dfu9N6YW.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-jfkYWtss.js.map → SavedBlocksPanels-Dfu9N6YW.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-yaCumC4j.js → SavedBlocksPickBar-DiMW_dbJ.js} +4 -4
- package/dist/cdn/chunks/{SavedBlocksPickBar-yaCumC4j.js.map → SavedBlocksPickBar-DiMW_dbJ.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-SaV2UVh_.js → TemplateSettings-JMUo0LIV.js} +10 -10
- package/dist/cdn/chunks/{TemplateSettings-SaV2UVh_.js.map → TemplateSettings-JMUo0LIV.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-ByfhP_sm.js → TestEmailModal-D52VtwBZ.js} +12 -12
- package/dist/cdn/chunks/{TestEmailModal-ByfhP_sm.js.map → TestEmailModal-D52VtwBZ.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-CfzpqpDs.js → TestEmailPanel-D9ezVDHd.js} +2 -2
- package/dist/cdn/chunks/{TestEmailPanel-CfzpqpDs.js.map → TestEmailPanel-D9ezVDHd.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-Ceb0YfWv.js → TitleEditor-D04vvbUc.js} +9 -9
- package/dist/cdn/chunks/{TitleEditor-Ceb0YfWv.js.map → TitleEditor-D04vvbUc.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-Cv6Rv1S-.js → Toolbar-C_Hfsher.js} +1196 -914
- package/dist/cdn/chunks/Toolbar-C_Hfsher.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-DGpGdwgf.js → TplModal-d6fEZGJ5.js} +5 -5
- package/dist/cdn/chunks/{TplModal-DGpGdwgf.js.map → TplModal-d6fEZGJ5.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-CZury5gU.js → VersionHistoryMenu-C8ucm43v.js} +7 -7
- package/dist/cdn/chunks/{VersionHistoryMenu-CZury5gU.js.map → VersionHistoryMenu-C8ucm43v.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-BJnHCMAH.js → VersionHistoryPanels-BAdzmhvH.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryPanels-BJnHCMAH.js.map → VersionHistoryPanels-BAdzmhvH.js.map} +1 -1
- package/dist/cdn/chunks/{VersionPreviewBanner-C4Ji8nu4.js → VersionPreviewBanner-BWuovbFc.js} +3 -3
- package/dist/cdn/chunks/{VersionPreviewBanner-C4Ji8nu4.js.map → VersionPreviewBanner-BWuovbFc.js.map} +1 -1
- package/dist/cdn/chunks/WrapperBlock-TXDSDXUP.js +58 -0
- package/dist/cdn/chunks/WrapperBlock-TXDSDXUP.js.map +1 -0
- package/dist/cdn/chunks/{blockTypeIcons-Cc6RJ27V.js → blockTypeIcons-CzYA5DF9.js} +2 -2
- package/dist/cdn/chunks/{blockTypeIcons-Cc6RJ27V.js.map → blockTypeIcons-CzYA5DF9.js.map} +1 -1
- package/dist/cdn/chunks/{ca-DOuIxWRv.js → ca-BJn8lcJx.js} +19 -2
- package/dist/cdn/chunks/ca-BJn8lcJx.js.map +1 -0
- package/dist/cdn/chunks/{composables-BxikPuC1.js → composables-CsfQlmcf.js} +676 -620
- package/dist/cdn/chunks/composables-CsfQlmcf.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-D2DUaudp.js → createCloudRuntime-PpIFCDfj.js} +4 -4
- package/dist/cdn/chunks/{createCloudRuntime-D2DUaudp.js.map → createCloudRuntime-PpIFCDfj.js.map} +1 -1
- package/dist/{de-DaOUfYBX.js → cdn/chunks/de-BLFp3nWx.js} +20 -1
- package/dist/cdn/chunks/de-BLFp3nWx.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-erQEOHZN.js → editor-modal-B8UE9V8B.js} +90 -90
- package/dist/cdn/chunks/{editor-modal-erQEOHZN.js.map → editor-modal-B8UE9V8B.js.map} +1 -1
- package/dist/cdn/chunks/en-CVxNoHww.js +1 -0
- package/dist/cdn/chunks/{en-C0pHHMiR.js → en-DGGQJGbm.js} +19 -2
- package/dist/cdn/chunks/en-DGGQJGbm.js.map +1 -0
- package/dist/{es-CxyEKr6n.js → cdn/chunks/es-DTY9qgLv.js} +20 -1
- package/dist/cdn/chunks/es-DTY9qgLv.js.map +1 -0
- package/dist/cdn/chunks/{extensions-DuDWpKo7.js → extensions-BM6ZSnsQ.js} +82 -76
- package/dist/cdn/chunks/extensions-BM6ZSnsQ.js.map +1 -0
- package/dist/{fr-CYbamiI6.js → cdn/chunks/fr-L4FqO9Gp.js} +20 -1
- package/dist/cdn/chunks/fr-L4FqO9Gp.js.map +1 -0
- package/dist/cdn/chunks/{icons-Da9GKjPx.js → icons-DHExFLlT.js} +43 -43
- package/dist/cdn/chunks/{icons-Da9GKjPx.js.map → icons-DHExFLlT.js.map} +1 -1
- package/dist/cdn/chunks/{ja-DfaIAoGI.js → ja-6uOXkh4v.js} +19 -2
- package/dist/cdn/chunks/ja-6uOXkh4v.js.map +1 -0
- package/dist/cdn/chunks/{keys-CoQtCqNv.js → keys-BUmIvYy3.js} +4 -4
- package/dist/cdn/chunks/keys-BUmIvYy3.js.map +1 -0
- package/dist/cdn/chunks/{nl-DkrB-VKZ.js → nl-DCxuxwNq.js} +19 -2
- package/dist/cdn/chunks/nl-DCxuxwNq.js.map +1 -0
- package/dist/cdn/chunks/normalizeMergeTagMarkup-aWjkotui.js +300 -0
- package/dist/cdn/chunks/normalizeMergeTagMarkup-aWjkotui.js.map +1 -0
- package/dist/cdn/chunks/{preRenderCustomBlocks-C9oavydG.js → preRenderCustomBlocks-Dn6dFUwx.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-C9oavydG.js.map → preRenderCustomBlocks-Dn6dFUwx.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-CY5Ye7eP.js → pt-BR-CBkcrebr.js} +19 -2
- package/dist/cdn/chunks/pt-BR-CBkcrebr.js.map +1 -0
- package/dist/cdn/chunks/{sanitizeHtml-DfXoetOm.js → sanitizeHtml-DJI7vvET.js} +3 -3
- package/dist/cdn/chunks/{sanitizeHtml-DfXoetOm.js.map → sanitizeHtml-DJI7vvET.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-DPwkrn5v.js → socialIcons-Qw9rHc8C.js} +420 -406
- package/dist/cdn/chunks/{socialIcons-DPwkrn5v.js.map → socialIcons-Qw9rHc8C.js.map} +1 -1
- package/dist/cdn/chunks/src-Bfj1jHnn.js +710 -0
- package/dist/cdn/chunks/src-Bfj1jHnn.js.map +1 -0
- package/dist/cdn/chunks/{src-712f3ofG.js → src-C9JWWxAk.js} +683 -568
- package/dist/cdn/chunks/src-C9JWWxAk.js.map +1 -0
- package/dist/cdn/chunks/{src-ZFw5fg_z.js → src-mXG-Of9A.js} +892 -735
- package/dist/cdn/chunks/src-mXG-Of9A.js.map +1 -0
- package/dist/cdn/chunks/{useCloudI18n-Cc5NZqiI.js → useCloudI18n-Xsih9yRH.js} +2 -2
- package/dist/cdn/chunks/{useCloudI18n-Cc5NZqiI.js.map → useCloudI18n-Xsih9yRH.js.map} +1 -1
- package/dist/cdn/chunks/{useEditorRoot-D_LuZ_hE.js → useEditorRoot-Beau2Z_T.js} +2 -2
- package/dist/cdn/chunks/{useEditorRoot-D_LuZ_hE.js.map → useEditorRoot-Beau2Z_T.js.map} +1 -1
- package/dist/cdn/chunks/{useI18n-BnJYydPv.js → useI18n-D8s7HtTn.js} +2 -2
- package/dist/cdn/chunks/{useI18n-BnJYydPv.js.map → useI18n-D8s7HtTn.js.map} +1 -1
- package/dist/cdn/chunks/useLocalizedDisplay-Bgg4qpev.js +33 -0
- package/dist/cdn/chunks/{useLocalizedDisplay-DiNjT22M.js.map → useLocalizedDisplay-Bgg4qpev.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-SvMW4g00.js → useLogicTag-DLvWzWsp.js} +4 -4
- package/dist/cdn/chunks/{useLogicTag-SvMW4g00.js.map → useLogicTag-DLvWzWsp.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-JLz3Pqcw.js → useMergeTag-B4FHCGGm.js} +6 -6
- package/dist/cdn/chunks/{useMergeTag-JLz3Pqcw.js.map → useMergeTag-B4FHCGGm.js.map} +1 -1
- package/dist/cdn/chunks/{usePopoverPosition-BWAXWeBv.js → usePopoverPosition-esO6wjvU.js} +5 -5
- package/dist/cdn/chunks/{usePopoverPosition-BWAXWeBv.js.map → usePopoverPosition-esO6wjvU.js.map} +1 -1
- package/dist/cdn/chunks/{useScrollToBlock-Ct1AwLD-.js → useScrollToBlock-CJuUu7Xj.js} +2 -2
- package/dist/cdn/chunks/{useScrollToBlock-Ct1AwLD-.js.map → useScrollToBlock-CJuUu7Xj.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-BcoPpkDS.js → withCurrentFont-QqBilClC.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-BcoPpkDS.js.map → withCurrentFont-QqBilClC.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +761 -764
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-XMnOOIEC.js → check-CcuCoJDh.js} +1 -1
- package/dist/{chevron-down-DmamTEWQ.js → chevron-down-BfYIbFbC.js} +1 -1
- package/dist/{chevron-right-BEFXOH27.js → chevron-right-DyjFqY35.js} +1 -1
- package/dist/{chevron-up-Dw7woXj8.js → chevron-up-BHEIxuS-.js} +1 -1
- package/dist/{circle-alert-BTKC9vkq.js → circle-alert-Tq7kAh9S.js} +1 -1
- package/dist/{clock-BVT5u2uG.js → clock-Df0ZiXwQ.js} +1 -1
- package/dist/{composables-BbPFRlBf.js → composables-CRX6rncm.js} +1044 -988
- package/dist/{createCloudRuntime-Dlrg88gS.js → createCloudRuntime-DplyIlsy.js} +3 -3
- package/dist/{createLucideIcon-CgDE3xAR.js → createLucideIcon-CfBdtoUw.js} +5 -5
- package/dist/{cdn/chunks/de-DaOUfYBX.js → de-BLFp3nWx.js} +18 -3
- package/dist/{dist-C34cYI5S.js → dist-BMUUt3zJ.js} +964 -807
- package/dist/{editor-modal-BeX6otLk.js → editor-modal-D9HT9bD6.js} +15 -15
- package/dist/{en-C0pHHMiR.js → en-DGGQJGbm.js} +18 -1
- package/dist/en-De3uAutQ.js +1 -0
- package/dist/{cdn/chunks/es-CxyEKr6n.js → es-DTY9qgLv.js} +18 -3
- package/dist/{extensions-xCiyqSg7.js → extensions-Cm6K4SRX.js} +344 -338
- package/dist/{eye-ByMgHeA_.js → eye-B3psrAqd.js} +1 -1
- package/dist/{cdn/chunks/fr-CYbamiI6.js → fr-L4FqO9Gp.js} +18 -3
- package/dist/{image-Ch8tR35K.js → image-C3yuPDxx.js} +1 -1
- package/dist/index.d.ts +74 -13
- package/dist/{info-DzSD-Wpk.js → info-DKja7A68.js} +1 -1
- package/dist/{ja-DfaIAoGI.js → ja-6uOXkh4v.js} +18 -1
- package/dist/{keys-BCqskl51.js → keys-w_VRjoMu.js} +3 -3
- package/dist/{link-oDn9AR2w.js → link-DhzPI4Hn.js} +1 -1
- package/dist/{list-C5t07dp8.js → list-DVGn7Ik2.js} +1 -1
- package/dist/{loader-circle-k6xvKgUB.js → loader-circle-DqKWsMHO.js} +1 -1
- package/dist/{message-circle-C23R6OJR.js → message-circle-C4TonoBs.js} +1 -1
- package/dist/{nl-DkrB-VKZ.js → nl-DCxuxwNq.js} +18 -1
- package/dist/normalizeMergeTagMarkup-Da9JAgx7.js +298 -0
- package/dist/{package-C90eQ7NU.js → package-9OkiEO4S.js} +1 -1
- package/dist/{pencil-BK7GrQuA.js → pencil-M9vkOB7C.js} +1 -1
- package/dist/{plus-Cr0Mis63.js → plus-DxZiv9YC.js} +1 -1
- package/dist/{preRenderCustomBlocks-DvbRa3L3.js → preRenderCustomBlocks-CdqSp2P7.js} +4 -4
- package/dist/{pt-BR-CY5Ye7eP.js → pt-BR-CBkcrebr.js} +18 -1
- package/dist/{refresh-cw-_ZLOIEvA.js → refresh-cw-UY8_sdFG.js} +1 -1
- package/dist/{rotate-ccw-CB5wsHwv.js → rotate-ccw-BFTGCpHn.js} +1 -1
- package/dist/{sanitizeHtml-D_ab7dD6.js → sanitizeHtml-wBibnBF4.js} +6 -6
- package/dist/{search-BmrQNox8.js → search-RuGJnMEn.js} +1 -1
- package/dist/{send-blAsIBBg.js → send-DGB1ar02.js} +1 -1
- package/dist/{smartphone-BPpWYrwV.js → smartphone-CVA29CU_.js} +1 -1
- package/dist/{socialIcons-DhAolBjt.js → socialIcons-CJD6OsI7.js} +283 -269
- package/dist/{sparkles-OqIxrNp-.js → sparkles-IHfEwEcd.js} +1 -1
- package/dist/{square-BP-V7iT-.js → square-_Cl44UU6.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +851 -854
- package/dist/{text-align-start-4mwX2o-F.js → text-align-start-Dqk2Xt_Q.js} +13 -13
- package/dist/{trash-B99WixTA.js → trash-Cr7rD5Hh.js} +1 -1
- package/dist/{triangle-alert-CHMiDkHa.js → triangle-alert-CKcpwtUj.js} +1 -1
- package/dist/{upload-Cp8o-hrN.js → upload-DR9pqVON.js} +1 -1
- package/dist/{useCloudI18n-Dh2iydo1.js → useCloudI18n-BczJoFf4.js} +1 -1
- package/dist/{useEditorRoot-DY3mgcHm.js → useEditorRoot-BcXKhM_8.js} +1 -1
- package/dist/{useI18n-CgtvtF4C.js → useI18n-zeWYtWSv.js} +1 -1
- package/dist/useLocalizedDisplay-Cbhx208c.js +31 -0
- package/dist/{useLogicTag-BmuakZBd.js → useLogicTag-DLkYos2Q.js} +3 -3
- package/dist/{useMergeTag-DC4a8b_v.js → useMergeTag-IoWOO679.js} +5 -5
- package/dist/{usePopoverPosition-VDQjyX_A.js → usePopoverPosition-Br3zt_MQ.js} +4 -4
- package/dist/{useScrollToBlock-B35ObCGK.js → useScrollToBlock-BfOzc1Z6.js} +2 -2
- package/dist/{withCurrentFont-BSxJai99.js → withCurrentFont-m_PHcOD0.js} +1 -1
- package/dist/{x-BIBStNMS.js → x-DZSFHafL.js} +1 -1
- package/package.json +10 -10
- package/dist/BlockPreviewCanvas-DtOo5y3U.js +0 -140
- package/dist/WrapperBlock-BUzQTZuu.js +0 -44
- package/dist/cdn/chunks/BlockPreviewCanvas-B6ndvof2.js.map +0 -1
- package/dist/cdn/chunks/LogicTagInsertButton-PDKuo2J3.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-Cv6Rv1S-.js.map +0 -1
- package/dist/cdn/chunks/WrapperBlock-C_uE5rPJ.js +0 -46
- package/dist/cdn/chunks/WrapperBlock-C_uE5rPJ.js.map +0 -1
- package/dist/cdn/chunks/ca-DOuIxWRv.js.map +0 -1
- package/dist/cdn/chunks/composables-BxikPuC1.js.map +0 -1
- package/dist/cdn/chunks/de-DaOUfYBX.js.map +0 -1
- package/dist/cdn/chunks/en-B6tLGRHq.js +0 -1
- package/dist/cdn/chunks/en-C0pHHMiR.js.map +0 -1
- package/dist/cdn/chunks/es-CxyEKr6n.js.map +0 -1
- package/dist/cdn/chunks/extensions-DuDWpKo7.js.map +0 -1
- package/dist/cdn/chunks/fr-CYbamiI6.js.map +0 -1
- package/dist/cdn/chunks/ja-DfaIAoGI.js.map +0 -1
- package/dist/cdn/chunks/keys-CoQtCqNv.js.map +0 -1
- package/dist/cdn/chunks/nl-DkrB-VKZ.js.map +0 -1
- package/dist/cdn/chunks/normalizeMergeTagMarkup-Bn_hl4jd.js +0 -290
- package/dist/cdn/chunks/normalizeMergeTagMarkup-Bn_hl4jd.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-CY5Ye7eP.js.map +0 -1
- package/dist/cdn/chunks/src-712f3ofG.js.map +0 -1
- package/dist/cdn/chunks/src-B2tQbzf6.js +0 -677
- package/dist/cdn/chunks/src-B2tQbzf6.js.map +0 -1
- package/dist/cdn/chunks/src-ZFw5fg_z.js.map +0 -1
- package/dist/cdn/chunks/useLocalizedDisplay-DiNjT22M.js +0 -33
- package/dist/en-Do0SU6tR.js +0 -1
- package/dist/normalizeMergeTagMarkup-C7FGNURu.js +0 -288
- package/dist/useLocalizedDisplay-C9MBFUr4.js +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiRewriteMenu-BEepu1vo.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_createVNode","_createTextVNode","_toDisplayString","_Fragment","_normalizeClass","_renderList","ToolbarSelect","_withDirectives","_vModelText","_createCommentVNode","_sfc_main","defineComponent","openBlock","watch","withDirectives","renderList","onBeforeUnmount","inject","createElementBlock","createTextVNode","unref","normalizeClass","createCommentVNode","createBaseVNode","toDisplayString","vModelText","computed","ref","Fragment","createVNode","SdkError","SYNTAX_PRESETS","Sparkles","Square","WandSparkles","Languages","X","MERGE_TAG_SYNTAX_KEY","MERGE_TAGS_KEY","NO_MERGE_TAGS","AI_FEATURE_KEY","requireInject","UI_LOCALE_KEY","EDITOR_KEY","useI18n","secondaryBtnCompactClass","primaryBtnCompactClass","sanitizeHtml","normalizeMergeTagsInHtml","aiErrorMessage","rewriteLanguageOptions","htmlToPlainText","ToolbarSelect_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","AiRewriteMenu_default","props","__props","feature","mergeTags","syntax","uiLocale","templateEditor","PRESETS","languages","isOpen","language","instruction","isRewriting","streamed","raw","failure","controller","generation","result","streamingPreview","errorText","t","format","stop","activeController","reset","close","toggle","run","text","preset","html","requestController","token","answer","chunk","error","replace","_cache","$event"],"sources":["../../../src/components/ai/AiRewriteMenu.vue","../../../src/components/ai/AiRewriteMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from \"@tiptap/core\";\nimport {\n SdkError,\n SYNTAX_PRESETS,\n type AiRewritePreset,\n} from \"@templatical/types\";\nimport { Languages, Sparkles, Square, WandSparkles, X } from \"@lucide/vue\";\nimport { computed, inject, onBeforeUnmount, ref, watch } from \"vue\";\nimport ToolbarSelect from \"../toolbar/ToolbarSelect.vue\";\nimport { useI18n } from \"../../composables/useI18n\";\nimport {\n primaryBtnCompactClass,\n secondaryBtnCompactClass,\n} from \"../../constants/styleConstants\";\nimport {\n AI_FEATURE_KEY,\n EDITOR_KEY,\n MERGE_TAGS_KEY,\n MERGE_TAG_SYNTAX_KEY,\n NO_MERGE_TAGS,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../../keys\";\nimport { aiErrorMessage } from \"../../utils/aiErrors\";\nimport {\n htmlToPlainText,\n rewriteLanguageOptions,\n} from \"../../utils/aiRewritePreview\";\nimport { normalizeMergeTagsInHtml } from \"../../utils/normalizeMergeTagMarkup\";\nimport { sanitizeHtml } from \"../../utils/sanitizeHtml\";\n\n/**\n * Rewrite with AI, in the paragraph text toolbar: a preset or the user's own\n * instruction, streamed into a preview labelled as an AI suggestion. Replace\n * puts it into the paragraph through TipTap, so it is the user's own edit\n * (an ordinary change, on the normal undo stack, a normal batch with\n * collaboration). Rendered inside `.tpl-text-toolbar` and never teleported:\n * the paragraph leaves edit mode on a mousedown outside the toolbar.\n */\nconst props = defineProps<{ editor: Editor }>();\n\nconst { t, format } = useI18n();\nconst feature = requireInject(AI_FEATURE_KEY, \"AiRewriteMenu\");\nconst mergeTags = inject(MERGE_TAGS_KEY, NO_MERGE_TAGS);\nconst syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\nconst templateEditor = inject(EDITOR_KEY, null);\n\nconst PRESETS: Exclude<AiRewritePreset, \"translate\">[] = [\n \"shorten\",\n \"expand\",\n \"friendlier\",\n \"formal\",\n \"fixGrammar\",\n];\nconst languages = rewriteLanguageOptions(uiLocale);\n\nconst isOpen = ref(false);\nconst language = ref(languages[0].value);\nconst instruction = ref(\"\");\nconst isRewriting = ref(false);\nconst streamed = ref(\"\");\nconst raw = ref<string | null>(null);\nconst failure = ref<unknown>(null);\nlet controller: AbortController | null = null;\nlet generation = 0;\n\n/** The finished rewrite as the editor will hold it: tags, then sanitized (D22). */\nconst result = computed(() =>\n raw.value === null\n ? null\n : sanitizeHtml(\n normalizeMergeTagsInHtml(raw.value, mergeTags.value, syntax),\n ),\n);\nconst streamingPreview = computed(() => htmlToPlainText(streamed.value));\nconst errorText = computed(() =>\n failure.value\n ? aiErrorMessage(failure.value, t.ai.errors, format, uiLocale)\n : \"\",\n);\n\nfunction stop(): void {\n generation++;\n const activeController = controller;\n controller = null;\n isRewriting.value = false;\n activeController?.abort();\n}\n\nfunction reset(): void {\n stop();\n streamed.value = \"\";\n raw.value = null;\n failure.value = null;\n}\n\nfunction close(): void {\n reset();\n isOpen.value = false;\n}\n\nfunction toggle(): void {\n if (isOpen.value) close();\n else isOpen.value = true;\n}\n\nasync function run(preset: AiRewritePreset | null): Promise<void> {\n const text = instruction.value.trim();\n if (\n isRewriting.value ||\n (preset === null && text === \"\") ||\n (preset === \"translate\" && language.value === \"\")\n )\n return;\n reset();\n const html = props.editor.getHTML();\n if (Array.from(html).length > 20_000) {\n failure.value = new SdkError(t.ai.rewrite.tooLarge, 413);\n return;\n }\n const requestController = new AbortController();\n const token = ++generation;\n controller = requestController;\n isRewriting.value = true;\n try {\n const answer = await feature.rewrite(\n {\n html,\n preset,\n language: preset === \"translate\" ? language.value : null,\n instruction: text === \"\" ? null : text,\n },\n (chunk) => {\n if (token !== generation) return;\n streamed.value += chunk;\n },\n requestController.signal,\n );\n if (token !== generation) return;\n raw.value = answer.html;\n } catch (error) {\n if (\n token === generation &&\n !(error instanceof Error && error.name === \"AbortError\")\n )\n failure.value = error;\n } finally {\n if (token === generation) {\n isRewriting.value = false;\n controller = null;\n }\n }\n}\n\nfunction replace(): void {\n if (result.value === null) return;\n props.editor\n .chain()\n .focus()\n .setContent(result.value, { emitUpdate: true })\n .run();\n close();\n}\n\nif (templateEditor?.activeLocale)\n watch(templateEditor.activeLocale, close, { flush: \"sync\" });\nonBeforeUnmount(stop);\n</script>\n\n<template>\n <div class=\"tpl:relative tpl:flex tpl:items-center\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-trigger\"\n class=\"tpl:flex tpl:h-8 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)] tpl:transition-all tpl:hover:bg-[var(--tpl-bg-active)]\"\n :aria-label=\"t.ai.rewrite.title\"\n :title=\"t.ai.rewrite.title\"\n aria-haspopup=\"dialog\"\n :aria-expanded=\"isOpen\"\n @click=\"toggle\"\n >\n <Sparkles :size=\"16\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.menu.button }}\n </button>\n\n <div\n v-if=\"isOpen\"\n role=\"dialog\"\n :aria-label=\"t.ai.rewrite.title\"\n data-testid=\"ai-rewrite-panel\"\n class=\"tpl-ai-rewrite-panel tpl:absolute tpl:top-full tpl:right-0 tpl:z-50 tpl:mt-2 tpl:flex tpl:w-80 tpl:flex-col tpl:gap-3 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-3 tpl:shadow-[var(--tpl-shadow-lg)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:justify-between\">\n <span\n class=\"tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-primary)]\"\n >\n <WandSparkles :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.title }}\n </span>\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:p-0.5 tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"t.ai.rewrite.close\"\n :title=\"t.ai.rewrite.close\"\n @click=\"close\"\n >\n <X :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- The finished rewrite: normalized and sanitized, labelled (Art. 50). -->\n <template v-if=\"result !== null\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <div\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:max-h-48 tpl:overflow-y-auto tpl:text-sm tpl:text-[var(--tpl-text)]\"\n v-html=\"result\"\n />\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-discard\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"reset\"\n >\n {{ t.ai.rewrite.discard }}\n </button>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-replace\"\n :class=\"primaryBtnCompactClass\"\n @click=\"replace\"\n >\n {{ t.ai.rewrite.replaceAction }}\n </button>\n </div>\n </template>\n\n <!-- Streaming: plain text only. -->\n <template v-else-if=\"isRewriting\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <p\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:m-0 tpl:max-h-48 tpl:overflow-y-auto tpl:whitespace-pre-wrap tpl:text-sm tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ streamingPreview || t.ai.rewrite.rewriting }}\n </p>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-stop\"\n :class=\"[secondaryBtnCompactClass, 'tpl:self-end']\"\n @click=\"stop\"\n >\n <Square :size=\"12\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.stop }}\n </button>\n </template>\n\n <template v-else>\n <div class=\"tpl:flex tpl:flex-wrap tpl:gap-1.5\">\n <button\n v-for=\"preset in PRESETS\"\n :key=\"preset\"\n type=\"button\"\n :data-testid=\"`ai-rewrite-preset-${preset}`\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"run(preset)\"\n >\n {{ t.ai.rewrite.presets[preset] }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <Languages\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-muted)]\"\n aria-hidden=\"true\"\n />\n <ToolbarSelect\n v-model=\"language\"\n :options=\"languages\"\n :label=\"t.ai.rewrite.language\"\n width-class=\"tpl:flex-1\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-preset-translate\"\n :class=\"secondaryBtnCompactClass\"\n :disabled=\"language === ''\"\n @click=\"run('translate')\"\n >\n {{ t.ai.rewrite.presets.translate }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-end tpl:gap-2\">\n <textarea\n v-model=\"instruction\"\n data-testid=\"ai-rewrite-instruction\"\n maxlength=\"500\"\n rows=\"2\"\n class=\"tpl:flex-1 tpl:resize-none tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-2 tpl:py-1.5 tpl:font-sans tpl:text-sm tpl:text-[var(--tpl-text)]\"\n :aria-label=\"t.ai.rewrite.instructionLabel\"\n :placeholder=\"t.ai.rewrite.instructionPlaceholder\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-run\"\n :class=\"primaryBtnCompactClass\"\n :disabled=\"instruction.trim() === ''\"\n @click=\"run(null)\"\n >\n {{ t.ai.rewrite.run }}\n </button>\n </div>\n <p\n v-if=\"errorText\"\n role=\"alert\"\n data-testid=\"ai-rewrite-error\"\n class=\"tpl:m-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ errorText }}\n </p>\n <p class=\"tpl:m-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\">\n {{ t.ai.chat.disclaimer }}\n </p>\n </template>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Editor } from \"@tiptap/core\";\nimport {\n SdkError,\n SYNTAX_PRESETS,\n type AiRewritePreset,\n} from \"@templatical/types\";\nimport { Languages, Sparkles, Square, WandSparkles, X } from \"@lucide/vue\";\nimport { computed, inject, onBeforeUnmount, ref, watch } from \"vue\";\nimport ToolbarSelect from \"../toolbar/ToolbarSelect.vue\";\nimport { useI18n } from \"../../composables/useI18n\";\nimport {\n primaryBtnCompactClass,\n secondaryBtnCompactClass,\n} from \"../../constants/styleConstants\";\nimport {\n AI_FEATURE_KEY,\n EDITOR_KEY,\n MERGE_TAGS_KEY,\n MERGE_TAG_SYNTAX_KEY,\n NO_MERGE_TAGS,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../../keys\";\nimport { aiErrorMessage } from \"../../utils/aiErrors\";\nimport {\n htmlToPlainText,\n rewriteLanguageOptions,\n} from \"../../utils/aiRewritePreview\";\nimport { normalizeMergeTagsInHtml } from \"../../utils/normalizeMergeTagMarkup\";\nimport { sanitizeHtml } from \"../../utils/sanitizeHtml\";\n\n/**\n * Rewrite with AI, in the paragraph text toolbar: a preset or the user's own\n * instruction, streamed into a preview labelled as an AI suggestion. Replace\n * puts it into the paragraph through TipTap, so it is the user's own edit\n * (an ordinary change, on the normal undo stack, a normal batch with\n * collaboration). Rendered inside `.tpl-text-toolbar` and never teleported:\n * the paragraph leaves edit mode on a mousedown outside the toolbar.\n */\nconst props = defineProps<{ editor: Editor }>();\n\nconst { t, format } = useI18n();\nconst feature = requireInject(AI_FEATURE_KEY, \"AiRewriteMenu\");\nconst mergeTags = inject(MERGE_TAGS_KEY, NO_MERGE_TAGS);\nconst syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\nconst templateEditor = inject(EDITOR_KEY, null);\n\nconst PRESETS: Exclude<AiRewritePreset, \"translate\">[] = [\n \"shorten\",\n \"expand\",\n \"friendlier\",\n \"formal\",\n \"fixGrammar\",\n];\nconst languages = rewriteLanguageOptions(uiLocale);\n\nconst isOpen = ref(false);\nconst language = ref(languages[0].value);\nconst instruction = ref(\"\");\nconst isRewriting = ref(false);\nconst streamed = ref(\"\");\nconst raw = ref<string | null>(null);\nconst failure = ref<unknown>(null);\nlet controller: AbortController | null = null;\nlet generation = 0;\n\n/** The finished rewrite as the editor will hold it: tags, then sanitized (D22). */\nconst result = computed(() =>\n raw.value === null\n ? null\n : sanitizeHtml(\n normalizeMergeTagsInHtml(raw.value, mergeTags.value, syntax),\n ),\n);\nconst streamingPreview = computed(() => htmlToPlainText(streamed.value));\nconst errorText = computed(() =>\n failure.value\n ? aiErrorMessage(failure.value, t.ai.errors, format, uiLocale)\n : \"\",\n);\n\nfunction stop(): void {\n generation++;\n const activeController = controller;\n controller = null;\n isRewriting.value = false;\n activeController?.abort();\n}\n\nfunction reset(): void {\n stop();\n streamed.value = \"\";\n raw.value = null;\n failure.value = null;\n}\n\nfunction close(): void {\n reset();\n isOpen.value = false;\n}\n\nfunction toggle(): void {\n if (isOpen.value) close();\n else isOpen.value = true;\n}\n\nasync function run(preset: AiRewritePreset | null): Promise<void> {\n const text = instruction.value.trim();\n if (\n isRewriting.value ||\n (preset === null && text === \"\") ||\n (preset === \"translate\" && language.value === \"\")\n )\n return;\n reset();\n const html = props.editor.getHTML();\n if (Array.from(html).length > 20_000) {\n failure.value = new SdkError(t.ai.rewrite.tooLarge, 413);\n return;\n }\n const requestController = new AbortController();\n const token = ++generation;\n controller = requestController;\n isRewriting.value = true;\n try {\n const answer = await feature.rewrite(\n {\n html,\n preset,\n language: preset === \"translate\" ? language.value : null,\n instruction: text === \"\" ? null : text,\n },\n (chunk) => {\n if (token !== generation) return;\n streamed.value += chunk;\n },\n requestController.signal,\n );\n if (token !== generation) return;\n raw.value = answer.html;\n } catch (error) {\n if (\n token === generation &&\n !(error instanceof Error && error.name === \"AbortError\")\n )\n failure.value = error;\n } finally {\n if (token === generation) {\n isRewriting.value = false;\n controller = null;\n }\n }\n}\n\nfunction replace(): void {\n if (result.value === null) return;\n props.editor\n .chain()\n .focus()\n .setContent(result.value, { emitUpdate: true })\n .run();\n close();\n}\n\nif (templateEditor?.activeLocale)\n watch(templateEditor.activeLocale, close, { flush: \"sync\" });\nonBeforeUnmount(stop);\n</script>\n\n<template>\n <div class=\"tpl:relative tpl:flex tpl:items-center\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-trigger\"\n class=\"tpl:flex tpl:h-8 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)] tpl:transition-all tpl:hover:bg-[var(--tpl-bg-active)]\"\n :aria-label=\"t.ai.rewrite.title\"\n :title=\"t.ai.rewrite.title\"\n aria-haspopup=\"dialog\"\n :aria-expanded=\"isOpen\"\n @click=\"toggle\"\n >\n <Sparkles :size=\"16\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.menu.button }}\n </button>\n\n <div\n v-if=\"isOpen\"\n role=\"dialog\"\n :aria-label=\"t.ai.rewrite.title\"\n data-testid=\"ai-rewrite-panel\"\n class=\"tpl-ai-rewrite-panel tpl:absolute tpl:top-full tpl:right-0 tpl:z-50 tpl:mt-2 tpl:flex tpl:w-80 tpl:flex-col tpl:gap-3 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-3 tpl:shadow-[var(--tpl-shadow-lg)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:justify-between\">\n <span\n class=\"tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-primary)]\"\n >\n <WandSparkles :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.title }}\n </span>\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:p-0.5 tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"t.ai.rewrite.close\"\n :title=\"t.ai.rewrite.close\"\n @click=\"close\"\n >\n <X :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- The finished rewrite: normalized and sanitized, labelled (Art. 50). -->\n <template v-if=\"result !== null\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <div\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:max-h-48 tpl:overflow-y-auto tpl:text-sm tpl:text-[var(--tpl-text)]\"\n v-html=\"result\"\n />\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-discard\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"reset\"\n >\n {{ t.ai.rewrite.discard }}\n </button>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-replace\"\n :class=\"primaryBtnCompactClass\"\n @click=\"replace\"\n >\n {{ t.ai.rewrite.replaceAction }}\n </button>\n </div>\n </template>\n\n <!-- Streaming: plain text only. -->\n <template v-else-if=\"isRewriting\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <p\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:m-0 tpl:max-h-48 tpl:overflow-y-auto tpl:whitespace-pre-wrap tpl:text-sm tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ streamingPreview || t.ai.rewrite.rewriting }}\n </p>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-stop\"\n :class=\"[secondaryBtnCompactClass, 'tpl:self-end']\"\n @click=\"stop\"\n >\n <Square :size=\"12\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.stop }}\n </button>\n </template>\n\n <template v-else>\n <div class=\"tpl:flex tpl:flex-wrap tpl:gap-1.5\">\n <button\n v-for=\"preset in PRESETS\"\n :key=\"preset\"\n type=\"button\"\n :data-testid=\"`ai-rewrite-preset-${preset}`\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"run(preset)\"\n >\n {{ t.ai.rewrite.presets[preset] }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <Languages\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-muted)]\"\n aria-hidden=\"true\"\n />\n <ToolbarSelect\n v-model=\"language\"\n :options=\"languages\"\n :label=\"t.ai.rewrite.language\"\n width-class=\"tpl:flex-1\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-preset-translate\"\n :class=\"secondaryBtnCompactClass\"\n :disabled=\"language === ''\"\n @click=\"run('translate')\"\n >\n {{ t.ai.rewrite.presets.translate }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-end tpl:gap-2\">\n <textarea\n v-model=\"instruction\"\n data-testid=\"ai-rewrite-instruction\"\n maxlength=\"500\"\n rows=\"2\"\n class=\"tpl:flex-1 tpl:resize-none tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-2 tpl:py-1.5 tpl:font-sans tpl:text-sm tpl:text-[var(--tpl-text)]\"\n :aria-label=\"t.ai.rewrite.instructionLabel\"\n :placeholder=\"t.ai.rewrite.instructionPlaceholder\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-run\"\n :class=\"primaryBtnCompactClass\"\n :disabled=\"instruction.trim() === ''\"\n @click=\"run(null)\"\n >\n {{ t.ai.rewrite.run }}\n </button>\n </div>\n <p\n v-if=\"errorText\"\n role=\"alert\"\n data-testid=\"ai-rewrite-error\"\n class=\"tpl:m-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ errorText }}\n </p>\n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AAK;IACL,eAAY;IACX,OAAKM,EAAEL,EAAA8C,CAAA,CAAwB;IAC/B,SAAOsD;GAEL,GAAAjG,EAAAH,EAAAgG,CAAA,CAAC,CAAC,GAAG,QAAQ,OAAO,GAAA,CAAA,GAEzBjG,EAOS,UAAA;IANP,MAAK;IACL,eAAY;IACX,OAAKM,EAAEL,EAAA+C,CAAA,CAAsB;IAC7B,SAAOiE;GAEL,GAAA7G,EAAAH,EAAAgG,CAAA,CAAC,CAAC,GAAG,QAAQ,aAAa,GAAA,CAAA,C"}
|
|
1
|
+
{"version":3,"file":"AiRewriteMenu-s79rmHFy.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_createVNode","_createTextVNode","_toDisplayString","_Fragment","_normalizeClass","_renderList","ToolbarSelect","_withDirectives","_vModelText","_createCommentVNode","_sfc_main","defineComponent","openBlock","watch","withDirectives","renderList","onBeforeUnmount","inject","createElementBlock","createTextVNode","unref","normalizeClass","createCommentVNode","createBaseVNode","toDisplayString","vModelText","computed","ref","Fragment","createVNode","SYNTAX_PRESETS","SdkError","Sparkles","Square","WandSparkles","Languages","X","MERGE_TAG_SYNTAX_KEY","MERGE_TAGS_KEY","NO_MERGE_TAGS","UI_LOCALE_KEY","AI_FEATURE_KEY","requireInject","EDITOR_KEY","useI18n","secondaryBtnCompactClass","primaryBtnCompactClass","sanitizeHtml","normalizeMergeTagsInHtml","aiErrorMessage","rewriteLanguageOptions","htmlToPlainText","ToolbarSelect_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","AiRewriteMenu_default","props","__props","feature","mergeTags","syntax","uiLocale","templateEditor","PRESETS","languages","isOpen","language","instruction","isRewriting","streamed","raw","failure","controller","generation","result","streamingPreview","errorText","t","format","stop","activeController","reset","close","toggle","run","text","preset","html","requestController","token","answer","chunk","error","replace","_cache","$event"],"sources":["../../../src/components/ai/AiRewriteMenu.vue","../../../src/components/ai/AiRewriteMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from \"@tiptap/core\";\nimport {\n SdkError,\n SYNTAX_PRESETS,\n type AiRewritePreset,\n} from \"@templatical/types\";\nimport { Languages, Sparkles, Square, WandSparkles, X } from \"@lucide/vue\";\nimport { computed, inject, onBeforeUnmount, ref, watch } from \"vue\";\nimport ToolbarSelect from \"../toolbar/ToolbarSelect.vue\";\nimport { useI18n } from \"../../composables/useI18n\";\nimport {\n primaryBtnCompactClass,\n secondaryBtnCompactClass,\n} from \"../../constants/styleConstants\";\nimport {\n AI_FEATURE_KEY,\n EDITOR_KEY,\n MERGE_TAGS_KEY,\n MERGE_TAG_SYNTAX_KEY,\n NO_MERGE_TAGS,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../../keys\";\nimport { aiErrorMessage } from \"../../utils/aiErrors\";\nimport {\n htmlToPlainText,\n rewriteLanguageOptions,\n} from \"../../utils/aiRewritePreview\";\nimport { normalizeMergeTagsInHtml } from \"../../utils/normalizeMergeTagMarkup\";\nimport { sanitizeHtml } from \"../../utils/sanitizeHtml\";\n\n/**\n * Rewrite with AI, in the paragraph text toolbar: a preset or the user's own\n * instruction, streamed into a preview labelled as an AI suggestion. Replace\n * puts it into the paragraph through TipTap, so it is the user's own edit\n * (an ordinary change, on the normal undo stack, a normal batch with\n * collaboration). Rendered inside `.tpl-text-toolbar` and never teleported:\n * the paragraph leaves edit mode on a mousedown outside the toolbar.\n */\nconst props = defineProps<{ editor: Editor }>();\n\nconst { t, format } = useI18n();\nconst feature = requireInject(AI_FEATURE_KEY, \"AiRewriteMenu\");\nconst mergeTags = inject(MERGE_TAGS_KEY, NO_MERGE_TAGS);\nconst syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\nconst templateEditor = inject(EDITOR_KEY, null);\n\nconst PRESETS: Exclude<AiRewritePreset, \"translate\">[] = [\n \"shorten\",\n \"expand\",\n \"friendlier\",\n \"formal\",\n \"fixGrammar\",\n];\nconst languages = rewriteLanguageOptions(uiLocale);\n\nconst isOpen = ref(false);\nconst language = ref(languages[0].value);\nconst instruction = ref(\"\");\nconst isRewriting = ref(false);\nconst streamed = ref(\"\");\nconst raw = ref<string | null>(null);\nconst failure = ref<unknown>(null);\nlet controller: AbortController | null = null;\nlet generation = 0;\n\n/** The finished rewrite as the editor will hold it: tags, then sanitized (D22). */\nconst result = computed(() =>\n raw.value === null\n ? null\n : sanitizeHtml(\n normalizeMergeTagsInHtml(raw.value, mergeTags.value, syntax),\n ),\n);\nconst streamingPreview = computed(() => htmlToPlainText(streamed.value));\nconst errorText = computed(() =>\n failure.value\n ? aiErrorMessage(failure.value, t.ai.errors, format, uiLocale)\n : \"\",\n);\n\nfunction stop(): void {\n generation++;\n const activeController = controller;\n controller = null;\n isRewriting.value = false;\n activeController?.abort();\n}\n\nfunction reset(): void {\n stop();\n streamed.value = \"\";\n raw.value = null;\n failure.value = null;\n}\n\nfunction close(): void {\n reset();\n isOpen.value = false;\n}\n\nfunction toggle(): void {\n if (isOpen.value) close();\n else isOpen.value = true;\n}\n\nasync function run(preset: AiRewritePreset | null): Promise<void> {\n const text = instruction.value.trim();\n if (\n isRewriting.value ||\n (preset === null && text === \"\") ||\n (preset === \"translate\" && language.value === \"\")\n )\n return;\n reset();\n const html = props.editor.getHTML();\n if (Array.from(html).length > 20_000) {\n failure.value = new SdkError(t.ai.rewrite.tooLarge, 413);\n return;\n }\n const requestController = new AbortController();\n const token = ++generation;\n controller = requestController;\n isRewriting.value = true;\n try {\n const answer = await feature.rewrite(\n {\n html,\n preset,\n language: preset === \"translate\" ? language.value : null,\n instruction: text === \"\" ? null : text,\n },\n (chunk) => {\n if (token !== generation) return;\n streamed.value += chunk;\n },\n requestController.signal,\n );\n if (token !== generation) return;\n raw.value = answer.html;\n } catch (error) {\n if (\n token === generation &&\n !(error instanceof Error && error.name === \"AbortError\")\n )\n failure.value = error;\n } finally {\n if (token === generation) {\n isRewriting.value = false;\n controller = null;\n }\n }\n}\n\nfunction replace(): void {\n if (result.value === null) return;\n props.editor\n .chain()\n .focus()\n .setContent(result.value, { emitUpdate: true })\n .run();\n close();\n}\n\nif (templateEditor?.activeLocale)\n watch(templateEditor.activeLocale, close, { flush: \"sync\" });\nonBeforeUnmount(stop);\n</script>\n\n<template>\n <div class=\"tpl:relative tpl:flex tpl:items-center\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-trigger\"\n class=\"tpl:flex tpl:h-8 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)] tpl:transition-all tpl:hover:bg-[var(--tpl-bg-active)]\"\n :aria-label=\"t.ai.rewrite.title\"\n :title=\"t.ai.rewrite.title\"\n aria-haspopup=\"dialog\"\n :aria-expanded=\"isOpen\"\n @click=\"toggle\"\n >\n <Sparkles :size=\"16\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.menu.button }}\n </button>\n\n <div\n v-if=\"isOpen\"\n role=\"dialog\"\n :aria-label=\"t.ai.rewrite.title\"\n data-testid=\"ai-rewrite-panel\"\n class=\"tpl-ai-rewrite-panel tpl:absolute tpl:top-full tpl:right-0 tpl:z-50 tpl:mt-2 tpl:flex tpl:w-80 tpl:flex-col tpl:gap-3 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-3 tpl:shadow-[var(--tpl-shadow-lg)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:justify-between\">\n <span\n class=\"tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-primary)]\"\n >\n <WandSparkles :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.title }}\n </span>\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:p-0.5 tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"t.ai.rewrite.close\"\n :title=\"t.ai.rewrite.close\"\n @click=\"close\"\n >\n <X :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- The finished rewrite: normalized and sanitized, labelled (Art. 50). -->\n <template v-if=\"result !== null\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <div\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:max-h-48 tpl:overflow-y-auto tpl:text-sm tpl:text-[var(--tpl-text)]\"\n v-html=\"result\"\n />\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-discard\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"reset\"\n >\n {{ t.ai.rewrite.discard }}\n </button>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-replace\"\n :class=\"primaryBtnCompactClass\"\n @click=\"replace\"\n >\n {{ t.ai.rewrite.replaceAction }}\n </button>\n </div>\n </template>\n\n <!-- Streaming: plain text only. -->\n <template v-else-if=\"isRewriting\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <p\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:m-0 tpl:max-h-48 tpl:overflow-y-auto tpl:whitespace-pre-wrap tpl:text-sm tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ streamingPreview || t.ai.rewrite.rewriting }}\n </p>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-stop\"\n :class=\"[secondaryBtnCompactClass, 'tpl:self-end']\"\n @click=\"stop\"\n >\n <Square :size=\"12\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.stop }}\n </button>\n </template>\n\n <template v-else>\n <div class=\"tpl:flex tpl:flex-wrap tpl:gap-1.5\">\n <button\n v-for=\"preset in PRESETS\"\n :key=\"preset\"\n type=\"button\"\n :data-testid=\"`ai-rewrite-preset-${preset}`\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"run(preset)\"\n >\n {{ t.ai.rewrite.presets[preset] }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <Languages\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-muted)]\"\n aria-hidden=\"true\"\n />\n <ToolbarSelect\n v-model=\"language\"\n :options=\"languages\"\n :label=\"t.ai.rewrite.language\"\n width-class=\"tpl:flex-1\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-preset-translate\"\n :class=\"secondaryBtnCompactClass\"\n :disabled=\"language === ''\"\n @click=\"run('translate')\"\n >\n {{ t.ai.rewrite.presets.translate }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-end tpl:gap-2\">\n <textarea\n v-model=\"instruction\"\n data-testid=\"ai-rewrite-instruction\"\n maxlength=\"500\"\n rows=\"2\"\n class=\"tpl:flex-1 tpl:resize-none tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-2 tpl:py-1.5 tpl:font-sans tpl:text-sm tpl:text-[var(--tpl-text)]\"\n :aria-label=\"t.ai.rewrite.instructionLabel\"\n :placeholder=\"t.ai.rewrite.instructionPlaceholder\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-run\"\n :class=\"primaryBtnCompactClass\"\n :disabled=\"instruction.trim() === ''\"\n @click=\"run(null)\"\n >\n {{ t.ai.rewrite.run }}\n </button>\n </div>\n <p\n v-if=\"errorText\"\n role=\"alert\"\n data-testid=\"ai-rewrite-error\"\n class=\"tpl:m-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ errorText }}\n </p>\n <p class=\"tpl:m-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\">\n {{ t.ai.chat.disclaimer }}\n </p>\n </template>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Editor } from \"@tiptap/core\";\nimport {\n SdkError,\n SYNTAX_PRESETS,\n type AiRewritePreset,\n} from \"@templatical/types\";\nimport { Languages, Sparkles, Square, WandSparkles, X } from \"@lucide/vue\";\nimport { computed, inject, onBeforeUnmount, ref, watch } from \"vue\";\nimport ToolbarSelect from \"../toolbar/ToolbarSelect.vue\";\nimport { useI18n } from \"../../composables/useI18n\";\nimport {\n primaryBtnCompactClass,\n secondaryBtnCompactClass,\n} from \"../../constants/styleConstants\";\nimport {\n AI_FEATURE_KEY,\n EDITOR_KEY,\n MERGE_TAGS_KEY,\n MERGE_TAG_SYNTAX_KEY,\n NO_MERGE_TAGS,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../../keys\";\nimport { aiErrorMessage } from \"../../utils/aiErrors\";\nimport {\n htmlToPlainText,\n rewriteLanguageOptions,\n} from \"../../utils/aiRewritePreview\";\nimport { normalizeMergeTagsInHtml } from \"../../utils/normalizeMergeTagMarkup\";\nimport { sanitizeHtml } from \"../../utils/sanitizeHtml\";\n\n/**\n * Rewrite with AI, in the paragraph text toolbar: a preset or the user's own\n * instruction, streamed into a preview labelled as an AI suggestion. Replace\n * puts it into the paragraph through TipTap, so it is the user's own edit\n * (an ordinary change, on the normal undo stack, a normal batch with\n * collaboration). Rendered inside `.tpl-text-toolbar` and never teleported:\n * the paragraph leaves edit mode on a mousedown outside the toolbar.\n */\nconst props = defineProps<{ editor: Editor }>();\n\nconst { t, format } = useI18n();\nconst feature = requireInject(AI_FEATURE_KEY, \"AiRewriteMenu\");\nconst mergeTags = inject(MERGE_TAGS_KEY, NO_MERGE_TAGS);\nconst syntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\nconst templateEditor = inject(EDITOR_KEY, null);\n\nconst PRESETS: Exclude<AiRewritePreset, \"translate\">[] = [\n \"shorten\",\n \"expand\",\n \"friendlier\",\n \"formal\",\n \"fixGrammar\",\n];\nconst languages = rewriteLanguageOptions(uiLocale);\n\nconst isOpen = ref(false);\nconst language = ref(languages[0].value);\nconst instruction = ref(\"\");\nconst isRewriting = ref(false);\nconst streamed = ref(\"\");\nconst raw = ref<string | null>(null);\nconst failure = ref<unknown>(null);\nlet controller: AbortController | null = null;\nlet generation = 0;\n\n/** The finished rewrite as the editor will hold it: tags, then sanitized (D22). */\nconst result = computed(() =>\n raw.value === null\n ? null\n : sanitizeHtml(\n normalizeMergeTagsInHtml(raw.value, mergeTags.value, syntax),\n ),\n);\nconst streamingPreview = computed(() => htmlToPlainText(streamed.value));\nconst errorText = computed(() =>\n failure.value\n ? aiErrorMessage(failure.value, t.ai.errors, format, uiLocale)\n : \"\",\n);\n\nfunction stop(): void {\n generation++;\n const activeController = controller;\n controller = null;\n isRewriting.value = false;\n activeController?.abort();\n}\n\nfunction reset(): void {\n stop();\n streamed.value = \"\";\n raw.value = null;\n failure.value = null;\n}\n\nfunction close(): void {\n reset();\n isOpen.value = false;\n}\n\nfunction toggle(): void {\n if (isOpen.value) close();\n else isOpen.value = true;\n}\n\nasync function run(preset: AiRewritePreset | null): Promise<void> {\n const text = instruction.value.trim();\n if (\n isRewriting.value ||\n (preset === null && text === \"\") ||\n (preset === \"translate\" && language.value === \"\")\n )\n return;\n reset();\n const html = props.editor.getHTML();\n if (Array.from(html).length > 20_000) {\n failure.value = new SdkError(t.ai.rewrite.tooLarge, 413);\n return;\n }\n const requestController = new AbortController();\n const token = ++generation;\n controller = requestController;\n isRewriting.value = true;\n try {\n const answer = await feature.rewrite(\n {\n html,\n preset,\n language: preset === \"translate\" ? language.value : null,\n instruction: text === \"\" ? null : text,\n },\n (chunk) => {\n if (token !== generation) return;\n streamed.value += chunk;\n },\n requestController.signal,\n );\n if (token !== generation) return;\n raw.value = answer.html;\n } catch (error) {\n if (\n token === generation &&\n !(error instanceof Error && error.name === \"AbortError\")\n )\n failure.value = error;\n } finally {\n if (token === generation) {\n isRewriting.value = false;\n controller = null;\n }\n }\n}\n\nfunction replace(): void {\n if (result.value === null) return;\n props.editor\n .chain()\n .focus()\n .setContent(result.value, { emitUpdate: true })\n .run();\n close();\n}\n\nif (templateEditor?.activeLocale)\n watch(templateEditor.activeLocale, close, { flush: \"sync\" });\nonBeforeUnmount(stop);\n</script>\n\n<template>\n <div class=\"tpl:relative tpl:flex tpl:items-center\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-trigger\"\n class=\"tpl:flex tpl:h-8 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)] tpl:transition-all tpl:hover:bg-[var(--tpl-bg-active)]\"\n :aria-label=\"t.ai.rewrite.title\"\n :title=\"t.ai.rewrite.title\"\n aria-haspopup=\"dialog\"\n :aria-expanded=\"isOpen\"\n @click=\"toggle\"\n >\n <Sparkles :size=\"16\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.menu.button }}\n </button>\n\n <div\n v-if=\"isOpen\"\n role=\"dialog\"\n :aria-label=\"t.ai.rewrite.title\"\n data-testid=\"ai-rewrite-panel\"\n class=\"tpl-ai-rewrite-panel tpl:absolute tpl:top-full tpl:right-0 tpl:z-50 tpl:mt-2 tpl:flex tpl:w-80 tpl:flex-col tpl:gap-3 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-3 tpl:shadow-[var(--tpl-shadow-lg)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:justify-between\">\n <span\n class=\"tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-primary)]\"\n >\n <WandSparkles :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.title }}\n </span>\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:p-0.5 tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"t.ai.rewrite.close\"\n :title=\"t.ai.rewrite.close\"\n @click=\"close\"\n >\n <X :size=\"14\" :stroke-width=\"2\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- The finished rewrite: normalized and sanitized, labelled (Art. 50). -->\n <template v-if=\"result !== null\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <div\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:max-h-48 tpl:overflow-y-auto tpl:text-sm tpl:text-[var(--tpl-text)]\"\n v-html=\"result\"\n />\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-discard\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"reset\"\n >\n {{ t.ai.rewrite.discard }}\n </button>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-replace\"\n :class=\"primaryBtnCompactClass\"\n @click=\"replace\"\n >\n {{ t.ai.rewrite.replaceAction }}\n </button>\n </div>\n </template>\n\n <!-- Streaming: plain text only. -->\n <template v-else-if=\"isRewriting\">\n <span\n data-testid=\"ai-rewrite-label\"\n class=\"tpl:self-start tpl:rounded tpl:px-1.5 tpl:py-px tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-secondary-light)] tpl:text-[var(--tpl-text)]\"\n >\n {{ t.ai.rewrite.suggestionLabel }}\n </span>\n <p\n data-testid=\"ai-rewrite-preview\"\n class=\"tpl:m-0 tpl:max-h-48 tpl:overflow-y-auto tpl:whitespace-pre-wrap tpl:text-sm tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ streamingPreview || t.ai.rewrite.rewriting }}\n </p>\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-stop\"\n :class=\"[secondaryBtnCompactClass, 'tpl:self-end']\"\n @click=\"stop\"\n >\n <Square :size=\"12\" :stroke-width=\"2\" aria-hidden=\"true\" />\n {{ t.ai.rewrite.stop }}\n </button>\n </template>\n\n <template v-else>\n <div class=\"tpl:flex tpl:flex-wrap tpl:gap-1.5\">\n <button\n v-for=\"preset in PRESETS\"\n :key=\"preset\"\n type=\"button\"\n :data-testid=\"`ai-rewrite-preset-${preset}`\"\n :class=\"secondaryBtnCompactClass\"\n @click=\"run(preset)\"\n >\n {{ t.ai.rewrite.presets[preset] }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <Languages\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-muted)]\"\n aria-hidden=\"true\"\n />\n <ToolbarSelect\n v-model=\"language\"\n :options=\"languages\"\n :label=\"t.ai.rewrite.language\"\n width-class=\"tpl:flex-1\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-preset-translate\"\n :class=\"secondaryBtnCompactClass\"\n :disabled=\"language === ''\"\n @click=\"run('translate')\"\n >\n {{ t.ai.rewrite.presets.translate }}\n </button>\n </div>\n <div class=\"tpl:flex tpl:items-end tpl:gap-2\">\n <textarea\n v-model=\"instruction\"\n data-testid=\"ai-rewrite-instruction\"\n maxlength=\"500\"\n rows=\"2\"\n class=\"tpl:flex-1 tpl:resize-none tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-2 tpl:py-1.5 tpl:font-sans tpl:text-sm tpl:text-[var(--tpl-text)]\"\n :aria-label=\"t.ai.rewrite.instructionLabel\"\n :placeholder=\"t.ai.rewrite.instructionPlaceholder\"\n />\n <button\n type=\"button\"\n data-testid=\"ai-rewrite-run\"\n :class=\"primaryBtnCompactClass\"\n :disabled=\"instruction.trim() === ''\"\n @click=\"run(null)\"\n >\n {{ t.ai.rewrite.run }}\n </button>\n </div>\n <p\n v-if=\"errorText\"\n role=\"alert\"\n data-testid=\"ai-rewrite-error\"\n class=\"tpl:m-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ errorText }}\n </p>\n <p class=\"tpl:m-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\">\n {{ t.ai.chat.disclaimer }}\n </p>\n </template>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,IAAM8E,IAAQC,GAER,EAAE,MAAG,eAAW/B,GAAQ,GACxBgC,KAAUlC,GAAcD,IAAgB,eAAe,GACvDoC,KAAY5D,EAAOqB,IAAgBC,EAAa,GAChDuC,KAAS7D,EAAOoB,IAAsBP,GAAe,MAAM,GAC3DiD,IAAW9D,EAAOuB,IAAe,KAAA,CAAS,GAC1CwC,IAAiB/D,EAAO0B,IAAY,IAAI,GAExCsC,KAAmD;GACvD;GACA;GACA;GACA;GACA;EACF,GACMC,IAAYhC,GAAuB6B,CAAQ,GAE3CI,IAASxD,EAAI,EAAK,GAClByD,IAAWzD,EAAIuD,EAAU,EAAE,CAAC,KAAK,GACjCG,IAAc1D,EAAI,EAAE,GACpB2D,IAAc3D,EAAI,EAAK,GACvB4D,IAAW5D,EAAI,EAAE,GACjB6D,IAAM7D,EAAmB,IAAI,GAC7B8D,IAAU9D,EAAa,IAAI,GAC7B+D,IAAqC,MACrCC,IAAa,G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A,C;GAIfwB,EAAA,SADRlG,EAAA,GAAAC,EAOI,KAPJ0E,IAOIrE,EADC4F,EAAA,KAAS,GAAA,CAAA,K;GAEdhG,EAEI,KAFJ0E,IAEItE,EADCH,EAAAgG,CAAA,CAAC,CAAC,GAAG,KAAK,UAAU,GAAA,CAAA;E,WA1H3BnG,EAAA,GAAAC,EA8BWM,GAAA,EAAA,KAAA,EAAA,GAAA;GA7BTL,EAKO,QALP6D,GAKOzD,EADFH,EAAAgG,CAAA,CAAC,CAAC,GAAG,QAAQ,eAAe,GAAA,CAAA;GAEjCjG,EAIE,OAAA;IAHA,eAAY;IACZ,OAAM;IACN,WAAQ8F,EAAA;;GAEV9F,EAiBM,OAjBN+D,GAiBM,CAhBJ/D,EAOS,UAAA;IANP,MAAK;IACL,eAAY;IACX,OAAKM,EAAEL,EAAA8C,CAAA,CAAwB;IAC/B,SAAOsD;GAEL,GAAAjG,EAAAH,EAAAgG,CAAA,CAAC,CAAC,GAAG,QAAQ,OAAO,GAAA,CAAA,GAEzBjG,EAOS,UAAA;IANP,MAAK;IACL,eAAY;IACX,OAAKM,EAAEL,EAAA+C,CAAA,CAAsB;IAC7B,SAAOiE;GAEL,GAAA7G,EAAAH,EAAAgG,CAAA,CAAC,CAAC,GAAG,QAAQ,aAAa,GAAA,CAAA,C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as e, F as t, O as n, _ as r, ct as i, dt as a, g as o, h as s, p as c } from "./draggable-DepKdldn.js";
|
|
2
|
-
import { It as l, d as u } from "./icons-
|
|
3
|
-
import {
|
|
4
|
-
import { t as p } from "./useI18n-
|
|
2
|
+
import { It as l, d as u } from "./icons-DHExFLlT.js";
|
|
3
|
+
import { $ as d, v as f } from "./keys-BUmIvYy3.js";
|
|
4
|
+
import { t as p } from "./useI18n-D8s7HtTn.js";
|
|
5
5
|
// src/components/canvas/BlockIssueBadge.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var m = ["title", "aria-label"], h = /* @__PURE__ */ e({
|
|
7
7
|
__name: "BlockIssueBadge",
|
|
@@ -31,4 +31,4 @@ var m = ["title", "aria-label"], h = /* @__PURE__ */ e({
|
|
|
31
31
|
});
|
|
32
32
|
export { h as default };
|
|
33
33
|
|
|
34
|
-
//# sourceMappingURL=BlockIssueBadge-
|
|
34
|
+
//# sourceMappingURL=BlockIssueBadge-Bnmq_M4G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockIssueBadge-
|
|
1
|
+
{"version":3,"file":"BlockIssueBadge-Bnmq_M4G.js","names":["_openBlock","_createElementBlock","_normalizeClass","_createBlock","_unref","_createCommentVNode","_sfc_main","defineComponent","openBlock","inject","createElementBlock","unref","normalizeClass","createCommentVNode","createBlock","computed","CircleAlert","TriangleAlert","TEMPLATE_LINT_KEY","EDITOR_KEY","useI18n","_hoisted_1","BlockIssueBadge_default","props","__props","lint","editor","blockIssues","i","severity","tooltip","t"],"sources":["../../../src/components/canvas/BlockIssueBadge.vue","../../../src/components/canvas/BlockIssueBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, inject } from \"vue\";\nimport { CircleAlert, TriangleAlert } from \"@lucide/vue\";\nimport { useI18n } from \"../../composables/useI18n\";\nimport { EDITOR_KEY, TEMPLATE_LINT_KEY } from \"../../keys\";\n\nconst props = defineProps<{ blockId: string }>();\nconst { t } = useI18n();\nconst lint = inject(TEMPLATE_LINT_KEY, null);\nconst editor = inject(EDITOR_KEY, null);\n\nconst blockIssues = computed(() =>\n (lint?.issues.value ?? []).filter(\n (i) =>\n i.blockId === props.blockId &&\n !(editor?.activeLocale?.value && i.ruleId.startsWith(\"localization.\")),\n ),\n);\n\nconst severity = computed<\"error\" | \"warning\" | null>(() => {\n if (blockIssues.value.some((i) => i.severity === \"error\")) return \"error\";\n if (blockIssues.value.some((i) => i.severity === \"warning\")) return \"warning\";\n return null;\n});\n\nconst tooltip = computed(() =>\n severity.value === \"error\" ? t.issues.badgeError : t.issues.badgeWarning,\n);\n</script>\n\n<template>\n <span\n v-if=\"severity\"\n class=\"tpl-block-issue-badge tpl:flex tpl:size-5 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-bg)] tpl:ring-1 tpl:ring-[var(--tpl-border)] tpl:hover:shadow-[var(--tpl-shadow-sm)]\"\n :class=\"\n severity === 'error'\n ? 'tpl:text-[var(--tpl-danger)]'\n : 'tpl:text-[var(--tpl-warning)]'\n \"\n :title=\"tooltip\"\n :aria-label=\"tooltip\"\n role=\"img\"\n >\n <CircleAlert\n v-if=\"severity === 'error'\"\n :size=\"14\"\n :stroke-width=\"2.25\"\n fill=\"currentColor\"\n stroke=\"var(--tpl-bg)\"\n />\n <TriangleAlert\n v-else\n :size=\"14\"\n :stroke-width=\"2.25\"\n fill=\"currentColor\"\n stroke=\"var(--tpl-bg)\"\n />\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, inject } from \"vue\";\nimport { CircleAlert, TriangleAlert } from \"@lucide/vue\";\nimport { useI18n } from \"../../composables/useI18n\";\nimport { EDITOR_KEY, TEMPLATE_LINT_KEY } from \"../../keys\";\n\nconst props = defineProps<{ blockId: string }>();\nconst { t } = useI18n();\nconst lint = inject(TEMPLATE_LINT_KEY, null);\nconst editor = inject(EDITOR_KEY, null);\n\nconst blockIssues = computed(() =>\n (lint?.issues.value ?? []).filter(\n (i) =>\n i.blockId === props.blockId &&\n !(editor?.activeLocale?.value && i.ruleId.startsWith(\"localization.\")),\n ),\n);\n\nconst severity = computed<\"error\" | \"warning\" | null>(() => {\n if (blockIssues.value.some((i) => i.severity === \"error\")) return \"error\";\n if (blockIssues.value.some((i) => i.severity === \"warning\")) return \"warning\";\n return null;\n});\n\nconst tooltip = computed(() =>\n severity.value === \"error\" ? t.issues.badgeError : t.issues.badgeWarning,\n);\n</script>\n\n<template>\n <span\n v-if=\"severity\"\n class=\"tpl-block-issue-badge tpl:flex tpl:size-5 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-bg)] tpl:ring-1 tpl:ring-[var(--tpl-border)] tpl:hover:shadow-[var(--tpl-shadow-sm)]\"\n :class=\"\n severity === 'error'\n ? 'tpl:text-[var(--tpl-danger)]'\n : 'tpl:text-[var(--tpl-warning)]'\n \"\n :title=\"tooltip\"\n :aria-label=\"tooltip\"\n role=\"img\"\n >\n <CircleAlert\n v-if=\"severity === 'error'\"\n :size=\"14\"\n :stroke-width=\"2.25\"\n fill=\"currentColor\"\n stroke=\"var(--tpl-bg)\"\n />\n <TriangleAlert\n v-else\n :size=\"14\"\n :stroke-width=\"2.25\"\n fill=\"currentColor\"\n stroke=\"var(--tpl-bg)\"\n />\n </span>\n</template>\n"],"mappings":";;;;;;;;;EAMA,IAAMuB,IAAQC,GACR,EAAE,SAAMJ,EAAQ,GAChBK,IAAOhB,EAAOS,GAAmB,IAAI,GACrCQ,IAASjB,EAAOU,GAAY,IAAI,GAEhCQ,IAAcZ,SACjBU,GAAM,OAAO,SAAS,CAAC,EAAA,CAAG,QACxB,MACCG,EAAE,YAAYL,EAAM,WACpB,EAAEG,GAAQ,cAAc,SAASE,EAAE,OAAO,WAAW,eAAe,EACxE,CACF,GAEMC,IAAWd,QACXY,EAAY,MAAM,MAAM,MAAMC,EAAE,aAAa,OAAO,IAAU,UAC9DD,EAAY,MAAM,MAAM,MAAMC,EAAE,aAAa,SAAS,IAAU,YAC7D,IACR,GAEKE,IAAUf,QACdc,EAAS,UAAU,UAAUE,EAAE,OAAO,aAAaA,EAAE,OAAO,YAC9D;E,iBAKUF,EAAA,SADR7B,EAAA,GAAAC,EA0BO,QAAA;;GAxBL,OAAKC,EAAA,CAAC,sNACS2B,EAAA,UAAQ,U;GAKtB,OAAOC,EAAA;GACP,cAAYA,EAAA;GACb,MAAK;E,IAGGD,EAAA,UAAQ,WADhB7B,EAAA,GAAAG,EAMEC,EAAAY,CAAA,GAAA;;GAJC,MAAM;GACN,gBAAc;GACf,MAAK;GACL,QAAO;E,OAEThB,EAAA,GAAAG,EAMEC,EAAAa,CAAA,GAAA;;GAJC,MAAM;GACN,gBAAc;GACf,MAAK;GACL,QAAO"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-QGRDbDUS.js";
|
|
2
2
|
import { B as t, C as n, F as r, I as i, L as a, O as o, _ as s, ct as c, h as l, m as u, p as d, pt as f, u as p, z as m } from "./draggable-DepKdldn.js";
|
|
3
|
-
import {
|
|
4
|
-
import { c as _, l as v, o as y } from "./socialIcons-
|
|
5
|
-
import { B as b, C as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
3
|
+
import { H as h, dt as g } from "./src-mXG-Of9A.js";
|
|
4
|
+
import { c as _, l as v, o as y } from "./socialIcons-Qw9rHc8C.js";
|
|
5
|
+
import { B as b, C as ee, R as x, b as te, l as S, m as C, ot as w, st as T, v as E } from "./keys-BUmIvYy3.js";
|
|
6
|
+
import { E as D, O, T as k, _ as A, a as j, b as M, g as N, h as P, i as F, m as I, o as L, p as R, r as z, u as B, v as V, w as H, x as U } from "./composables-CsfQlmcf.js";
|
|
7
|
+
import { t as W } from "./WrapperBlock-TXDSDXUP.js";
|
|
8
8
|
// src/components/blocks/PreviewSectionBlock.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
9
|
+
var G = { class: "tpl:w-full" }, K = { class: "tpl:flex tpl:gap-0" }, q = /* @__PURE__ */ n({
|
|
10
10
|
name: "PreviewSectionBlock",
|
|
11
11
|
__name: "PreviewSectionBlock",
|
|
12
12
|
props: {
|
|
@@ -27,7 +27,7 @@ var W = { class: "tpl:w-full" }, G = { class: "tpl:flex tpl:gap-0" }, K = /* @__
|
|
|
27
27
|
spacer: j,
|
|
28
28
|
html: N,
|
|
29
29
|
custom: V
|
|
30
|
-
}, i = e, h = o(
|
|
30
|
+
}, i = e, h = o(S, null), g = d(() => {
|
|
31
31
|
switch (i.block.columns) {
|
|
32
32
|
case "2": return ["50%", "50%"];
|
|
33
33
|
case "3": return [
|
|
@@ -35,8 +35,21 @@ var W = { class: "tpl:w-full" }, G = { class: "tpl:flex tpl:gap-0" }, K = /* @__
|
|
|
35
35
|
"33.33%",
|
|
36
36
|
"33.33%"
|
|
37
37
|
];
|
|
38
|
+
case "4": return [
|
|
39
|
+
"25%",
|
|
40
|
+
"25%",
|
|
41
|
+
"25%",
|
|
42
|
+
"25%"
|
|
43
|
+
];
|
|
38
44
|
case "1-2": return ["33.33%", "66.67%"];
|
|
39
45
|
case "2-1": return ["66.67%", "33.33%"];
|
|
46
|
+
case "1-3": return ["25%", "75%"];
|
|
47
|
+
case "3-1": return ["75%", "25%"];
|
|
48
|
+
case "1-2-1": return [
|
|
49
|
+
"25%",
|
|
50
|
+
"50%",
|
|
51
|
+
"25%"
|
|
52
|
+
];
|
|
40
53
|
default: return ["100%"];
|
|
41
54
|
}
|
|
42
55
|
}), _ = d(() => {
|
|
@@ -52,12 +65,12 @@ var W = { class: "tpl:w-full" }, G = { class: "tpl:flex tpl:gap-0" }, K = /* @__
|
|
|
52
65
|
}
|
|
53
66
|
return (e, n) => {
|
|
54
67
|
let i = m("PreviewSectionBlock", !0);
|
|
55
|
-
return r(), s("div",
|
|
68
|
+
return r(), s("div", G, [u("div", K, [(r(!0), s(p, null, a(_.value, (e, n) => (r(), s("div", {
|
|
56
69
|
key: n,
|
|
57
70
|
style: f({ width: g.value[n] })
|
|
58
71
|
}, [(r(!0), s(p, null, a(v(n), (e) => (r(), s("div", {
|
|
59
72
|
key: e.id,
|
|
60
|
-
style: f(c(
|
|
73
|
+
style: f(c(H)(e))
|
|
61
74
|
}, [e.type === "section" ? (r(), l(i, {
|
|
62
75
|
key: 0,
|
|
63
76
|
block: e,
|
|
@@ -69,7 +82,7 @@ var W = { class: "tpl:w-full" }, G = { class: "tpl:flex tpl:gap-0" }, K = /* @__
|
|
|
69
82
|
}, null, 8, ["block"]))], 4))), 128))], 4))), 128))])]);
|
|
70
83
|
};
|
|
71
84
|
}
|
|
72
|
-
}),
|
|
85
|
+
}), J = ["lang", "dir"], Y = /*@__PURE__*/ n({
|
|
73
86
|
__name: "BlockPreviewCanvas",
|
|
74
87
|
props: {
|
|
75
88
|
blocks: {},
|
|
@@ -81,10 +94,10 @@ var W = { class: "tpl:w-full" }, G = { class: "tpl:flex tpl:gap-0" }, K = /* @__
|
|
|
81
94
|
settings: { default: void 0 }
|
|
82
95
|
},
|
|
83
96
|
setup(e) {
|
|
84
|
-
let n = e, m = o(
|
|
85
|
-
i(
|
|
86
|
-
let
|
|
87
|
-
section:
|
|
97
|
+
let n = e, m = o(S), H = o(E, null), G = o(C, null), K = T(te, "BlockPreviewCanvas"), Y = o(ee, null), X = o(b, h.liquid), Z = o(x, null);
|
|
98
|
+
i(w, d(() => Z?.value ?? !1));
|
|
99
|
+
let ne = d(() => n.applyConditionFilter ? n.blocks.filter((e) => !G?.isHidden(e.id)) : n.blocks), Q = d(() => n.settings ?? H?.content.value.settings), $ = d(() => v(Q.value, n.viewport)), re = d(() => Q.value ? D(Q.value, K.resolveFontFamily) : {}), ie = d(() => Q.value?.locale?.trim() || void 0), ae = d(() => g(Q.value ?? { locale: "en" })), oe = d(() => Q.value?.backgroundColor || "var(--tpl-canvas-bg)"), se = d(() => $.value + 192), ce = {
|
|
100
|
+
section: q,
|
|
88
101
|
title: B,
|
|
89
102
|
paragraph: R,
|
|
90
103
|
image: P,
|
|
@@ -97,46 +110,47 @@ var W = { class: "tpl:w-full" }, G = { class: "tpl:flex tpl:gap-0" }, K = /* @__
|
|
|
97
110
|
spacer: j,
|
|
98
111
|
html: N,
|
|
99
112
|
custom: V,
|
|
100
|
-
wrapper:
|
|
113
|
+
wrapper: W
|
|
101
114
|
};
|
|
102
|
-
function ce(e) {
|
|
103
|
-
return O(e, m, se);
|
|
104
|
-
}
|
|
105
115
|
function le(e) {
|
|
116
|
+
return O(e, m, ce);
|
|
117
|
+
}
|
|
118
|
+
function ue(e) {
|
|
106
119
|
let t = Q.value;
|
|
107
|
-
return
|
|
120
|
+
return k(e, Y, X, y(e, t ? {
|
|
108
121
|
blocks: n.blocks,
|
|
109
122
|
settings: t
|
|
110
123
|
} : void 0));
|
|
111
124
|
}
|
|
112
125
|
return (n, i) => (r(), s("div", {
|
|
113
126
|
"data-testid": "block-preview-stage",
|
|
114
|
-
class: "tpl:pointer-events-none tpl:mx-auto tpl:flex tpl:select-none tpl:justify-center tpl:rounded-lg",
|
|
127
|
+
class: "tpl-canvas-pane tpl:pointer-events-none tpl:mx-auto tpl:flex tpl:select-none tpl:justify-center tpl:rounded-lg",
|
|
115
128
|
style: f({
|
|
116
|
-
width: `${
|
|
129
|
+
width: `${se.value}px`,
|
|
117
130
|
minWidth: `${$.value}px`,
|
|
118
131
|
maxWidth: "100%",
|
|
119
|
-
backgroundColor:
|
|
132
|
+
backgroundColor: oe.value,
|
|
120
133
|
boxShadow: "var(--tpl-shadow-sm)"
|
|
121
134
|
})
|
|
122
135
|
}, [u("div", {
|
|
123
136
|
"data-testid": "block-preview-canvas",
|
|
124
|
-
lang:
|
|
125
|
-
dir:
|
|
137
|
+
lang: ie.value,
|
|
138
|
+
dir: ae.value,
|
|
126
139
|
style: f({
|
|
127
140
|
width: `${$.value}px`,
|
|
141
|
+
[c(U)]: `${$.value}px`,
|
|
128
142
|
transition: c(_),
|
|
129
|
-
...
|
|
143
|
+
...re.value
|
|
130
144
|
})
|
|
131
|
-
}, [(r(!0), s(p, null, a(
|
|
145
|
+
}, [(r(!0), s(p, null, a(ne.value, (n) => (r(), s("div", {
|
|
132
146
|
key: n.id,
|
|
133
|
-
style: f(
|
|
134
|
-
}, [(r(), l(t(
|
|
147
|
+
style: f(ue(n))
|
|
148
|
+
}, [(r(), l(t(le(n)), {
|
|
135
149
|
block: n,
|
|
136
150
|
viewport: e.viewport
|
|
137
|
-
}, null, 8, ["block", "viewport"]))], 4))), 128))], 12,
|
|
151
|
+
}, null, 8, ["block", "viewport"]))], 4))), 128))], 12, J)], 4));
|
|
138
152
|
}
|
|
139
|
-
}),
|
|
140
|
-
export {
|
|
153
|
+
}), X = /* @__PURE__ */ e({ default: () => Z }), Z = Y;
|
|
154
|
+
export { X as n, Z as t };
|
|
141
155
|
|
|
142
|
-
//# sourceMappingURL=BlockPreviewCanvas-
|
|
156
|
+
//# sourceMappingURL=BlockPreviewCanvas-B3HkuENF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockPreviewCanvas-B3HkuENF.js","names":["_hoisted_1","TitleBlock","ParagraphBlock","ImageBlock","VideoBlock","ButtonBlock","DividerBlock","SocialIconsBlock","MenuBlock","TableBlock","SpacerBlock","HtmlBlock","CustomBlock","_resolveComponent","_openBlock","_createElementBlock","_createElementVNode","_Fragment","_renderList","_normalizeStyle","_unref","_createBlock","_resolveDynamicComponent","_sfc_main","PreviewSectionBlock","TitleBlock","ParagraphBlock","ImageBlock","VideoBlock","ButtonBlock","DividerBlock","SocialIconsBlock","MenuBlock","TableBlock","SpacerBlock","HtmlBlock","CustomBlock","WrapperBlock","_openBlock","_createElementBlock","_normalizeStyle","_createElementVNode","_unref","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_sfc_main","__exportAll","resolveDynamicComponent","defineComponent","openBlock","provide","renderList","inject","createElementBlock","unref","createBlock","createBaseVNode","computed","normalizeStyle","Fragment","resolveComponent","SYNTAX_PRESETS","resolveContentDirection","EMAIL_FRAME_WIDTH_TRANSITION","getEmailFrameWidth","matchImageBoxWidth","MERGE_TAG_SYNTAX_KEY","IMAGE_URL_RESOLVER_KEY","MERGE_TAG_SAMPLE_MODE_KEY","FONTS_MANAGER_KEY","BLOCK_REGISTRY_KEY","CONDITION_PREVIEW_KEY","USE_MERGE_TAG_SAMPLES_KEY","requireInject","EDITOR_KEY","getDocumentStyle","getCachedBlockWrapperStyle","DividerBlock_default","SpacerBlock_default","ButtonBlock_default","HtmlBlock_default","ImageBlock_default","TableBlock_default","MenuBlock_default","SocialIconsBlock_default","ParagraphBlock_default","VideoBlock_default","TitleBlock_default","CustomBlock_default","getBlockWrapperStyle","EMAIL_FRAME_WIDTH_VAR","WrapperBlock_default","_hoisted_1$1","_hoisted_2","PreviewSectionBlock_default","previewBlockComponentMap","props","__props","blockRegistry","columnWidths","columns","count","children","getColumnBlocks","colIndex","getBlockComponent","resolveBlockComponent","block","_component_PreviewSectionBlock","childBlock","_hoisted_1","BlockPreviewCanvas_vue_vue_type_script_setup_true_lang_default","editor","conditionPreview","fontsManager","imageUrlResolver","mergeTagSyntax","mergeTagSampleMode","visibleBlocks","previewSettings","frameWidth","documentStyle","contentLang","contentDir","emailBackground","stageWidth","previewComponentMap","previewBlockStyle","settings","BlockPreviewCanvas_exports","BlockPreviewCanvas_default"],"sources":["../../../src/components/blocks/PreviewSectionBlock.vue","../../../src/components/blocks/PreviewSectionBlock.vue","../../../src/components/BlockPreviewCanvas.vue","../../../src/components/BlockPreviewCanvas.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport ButtonBlock from \"./ButtonBlock.vue\";\nimport CustomBlock from \"./CustomBlock.vue\";\nimport DividerBlock from \"./DividerBlock.vue\";\nimport HtmlBlock from \"./HtmlBlock.vue\";\nimport ImageBlock from \"./ImageBlock.vue\";\nimport MenuBlock from \"./MenuBlock.vue\";\nimport SocialIconsBlock from \"./SocialIconsBlock.vue\";\nimport SpacerBlock from \"./SpacerBlock.vue\";\nimport TableBlock from \"./TableBlock.vue\";\nimport TitleBlock from \"./TitleBlock.vue\";\nimport ParagraphBlock from \"./ParagraphBlock.vue\";\nimport VideoBlock from \"./VideoBlock.vue\";\nimport {\n resolveBlockComponent,\n getBlockWrapperStyle,\n} from \"../../utils/blockComponentResolver\";\nimport type {\n Block,\n SectionBlock as SectionBlockType,\n} from \"@templatical/types\";\nimport { computed, inject, type Component } from \"vue\";\nimport { BLOCK_REGISTRY_KEY } from \"../../keys\";\n\nconst previewBlockComponentMap: Record<string, Component> = {\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n custom: CustomBlock,\n};\n\nconst props = defineProps<{\n block: SectionBlockType;\n viewport: \"desktop\";\n}>();\n\ndefineOptions({ name: \"PreviewSectionBlock\" });\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY, null);\n\nconst columnWidths = computed(() => {\n switch (props.block.columns) {\n case \"2\":\n return [\"50%\", \"50%\"];\n case \"3\":\n return [\"33.33%\", \"33.33%\", \"33.33%\"];\n case \"4\":\n return [\"25%\", \"25%\", \"25%\", \"25%\"];\n case \"1-2\":\n return [\"33.33%\", \"66.67%\"];\n case \"2-1\":\n return [\"66.67%\", \"33.33%\"];\n case \"1-3\":\n return [\"25%\", \"75%\"];\n case \"3-1\":\n return [\"75%\", \"25%\"];\n case \"1-2-1\":\n return [\"25%\", \"50%\", \"25%\"];\n default:\n return [\"100%\"];\n }\n});\n\nconst columns = computed(() => {\n const count = columnWidths.value.length;\n const children = [...props.block.children];\n while (children.length < count) {\n children.push([]);\n }\n return children.slice(0, count);\n});\n\nfunction getColumnBlocks(colIndex: number): Block[] {\n return columns.value[colIndex] || [];\n}\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, previewBlockComponentMap);\n}\n</script>\n\n<template>\n <div class=\"tpl:w-full\">\n <div class=\"tpl:flex tpl:gap-0\">\n <div\n v-for=\"(_, colIndex) in columns\"\n :key=\"colIndex\"\n :style=\"{ width: columnWidths[colIndex] }\"\n >\n <div\n v-for=\"childBlock in getColumnBlocks(colIndex)\"\n :key=\"childBlock.id\"\n :style=\"getBlockWrapperStyle(childBlock)\"\n >\n <!-- Recursive self-reference for nested sections -->\n <PreviewSectionBlock\n v-if=\"childBlock.type === 'section'\"\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n <component\n :is=\"getBlockComponent(childBlock)\"\n v-else\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport ButtonBlock from \"./ButtonBlock.vue\";\nimport CustomBlock from \"./CustomBlock.vue\";\nimport DividerBlock from \"./DividerBlock.vue\";\nimport HtmlBlock from \"./HtmlBlock.vue\";\nimport ImageBlock from \"./ImageBlock.vue\";\nimport MenuBlock from \"./MenuBlock.vue\";\nimport SocialIconsBlock from \"./SocialIconsBlock.vue\";\nimport SpacerBlock from \"./SpacerBlock.vue\";\nimport TableBlock from \"./TableBlock.vue\";\nimport TitleBlock from \"./TitleBlock.vue\";\nimport ParagraphBlock from \"./ParagraphBlock.vue\";\nimport VideoBlock from \"./VideoBlock.vue\";\nimport {\n resolveBlockComponent,\n getBlockWrapperStyle,\n} from \"../../utils/blockComponentResolver\";\nimport type {\n Block,\n SectionBlock as SectionBlockType,\n} from \"@templatical/types\";\nimport { computed, inject, type Component } from \"vue\";\nimport { BLOCK_REGISTRY_KEY } from \"../../keys\";\n\nconst previewBlockComponentMap: Record<string, Component> = {\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n custom: CustomBlock,\n};\n\nconst props = defineProps<{\n block: SectionBlockType;\n viewport: \"desktop\";\n}>();\n\ndefineOptions({ name: \"PreviewSectionBlock\" });\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY, null);\n\nconst columnWidths = computed(() => {\n switch (props.block.columns) {\n case \"2\":\n return [\"50%\", \"50%\"];\n case \"3\":\n return [\"33.33%\", \"33.33%\", \"33.33%\"];\n case \"4\":\n return [\"25%\", \"25%\", \"25%\", \"25%\"];\n case \"1-2\":\n return [\"33.33%\", \"66.67%\"];\n case \"2-1\":\n return [\"66.67%\", \"33.33%\"];\n case \"1-3\":\n return [\"25%\", \"75%\"];\n case \"3-1\":\n return [\"75%\", \"25%\"];\n case \"1-2-1\":\n return [\"25%\", \"50%\", \"25%\"];\n default:\n return [\"100%\"];\n }\n});\n\nconst columns = computed(() => {\n const count = columnWidths.value.length;\n const children = [...props.block.children];\n while (children.length < count) {\n children.push([]);\n }\n return children.slice(0, count);\n});\n\nfunction getColumnBlocks(colIndex: number): Block[] {\n return columns.value[colIndex] || [];\n}\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, previewBlockComponentMap);\n}\n</script>\n\n<template>\n <div class=\"tpl:w-full\">\n <div class=\"tpl:flex tpl:gap-0\">\n <div\n v-for=\"(_, colIndex) in columns\"\n :key=\"colIndex\"\n :style=\"{ width: columnWidths[colIndex] }\"\n >\n <div\n v-for=\"childBlock in getColumnBlocks(colIndex)\"\n :key=\"childBlock.id\"\n :style=\"getBlockWrapperStyle(childBlock)\"\n >\n <!-- Recursive self-reference for nested sections -->\n <PreviewSectionBlock\n v-if=\"childBlock.type === 'section'\"\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n <component\n :is=\"getBlockComponent(childBlock)\"\n v-else\n :block=\"childBlock\"\n viewport=\"desktop\"\n />\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport ButtonBlock from \"./blocks/ButtonBlock.vue\";\nimport CustomBlock from \"./blocks/CustomBlock.vue\";\nimport DividerBlock from \"./blocks/DividerBlock.vue\";\nimport HtmlBlock from \"./blocks/HtmlBlock.vue\";\nimport ImageBlock from \"./blocks/ImageBlock.vue\";\nimport MenuBlock from \"./blocks/MenuBlock.vue\";\nimport PreviewSectionBlock from \"./blocks/PreviewSectionBlock.vue\";\nimport SocialIconsBlock from \"./blocks/SocialIconsBlock.vue\";\nimport SpacerBlock from \"./blocks/SpacerBlock.vue\";\nimport TableBlock from \"./blocks/TableBlock.vue\";\nimport TitleBlock from \"./blocks/TitleBlock.vue\";\nimport ParagraphBlock from \"./blocks/ParagraphBlock.vue\";\nimport VideoBlock from \"./blocks/VideoBlock.vue\";\nimport WrapperBlock from \"./blocks/WrapperBlock.vue\";\nimport {\n BLOCK_REGISTRY_KEY,\n CONDITION_PREVIEW_KEY,\n EDITOR_KEY,\n FONTS_MANAGER_KEY,\n IMAGE_URL_RESOLVER_KEY,\n MERGE_TAG_SAMPLE_MODE_KEY,\n MERGE_TAG_SYNTAX_KEY,\n USE_MERGE_TAG_SAMPLES_KEY,\n requireInject,\n} from \"../keys\";\nimport {\n EMAIL_FRAME_WIDTH_VAR,\n resolveBlockComponent,\n getCachedBlockWrapperStyle,\n getDocumentStyle,\n} from \"../utils/blockComponentResolver\";\nimport {\n EMAIL_FRAME_WIDTH_TRANSITION,\n EMAIL_GUTTER,\n getEmailFrameWidth,\n} from \"../utils/emailFrameWidth\";\nimport { matchImageBoxWidth } from \"../utils/imageRoom\";\nimport {\n SYNTAX_PRESETS,\n resolveContentDirection,\n type Block,\n type TemplateSettings,\n type ViewportSize,\n} from \"@templatical/types\";\nimport { computed, inject, provide, type Component } from \"vue\";\n\nconst props = withDefaults(\n defineProps<{\n blocks: Block[];\n /**\n * Which viewport to render. Defaults to `desktop`, so the saved-blocks\n * surfaces — which have no viewport control — behave exactly as before.\n * The test-email dialog passes the user's choice so responsive blocks show\n * the variant a recipient on that device would receive.\n */\n viewport?: ViewportSize;\n /**\n * Whether the hand-toggled display-condition filter still applies here.\n * `false` where a resolver owns the preview: it has already evaluated every\n * condition against real data, so layering a manual hide on top would veto\n * the answer that was asked for.\n *\n * A prop rather than an injected `PREVIEW_RESOLUTION_KEY` read, because the\n * test-email dialog builds its *own* resolution instance (keyed to the\n * selected recipient) — injecting would consult the shared canvas instance\n * and get the wrong answer.\n */\n applyConditionFilter?: boolean;\n /**\n * Document settings for this surface. Test-email passes the composed\n * document so the mat is layout `backgroundColor` (`mj-body`). Saved-block\n * previews omit it and read the live editor template.\n */\n settings?: TemplateSettings;\n }>(),\n { viewport: \"desktop\", applyConditionFilter: true, settings: undefined },\n);\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY);\nconst editor = inject(EDITOR_KEY, null);\nconst conditionPreview = inject(CONDITION_PREVIEW_KEY, null);\nconst fontsManager = requireInject(FONTS_MANAGER_KEY, \"BlockPreviewCanvas\");\nconst imageUrlResolver = inject(IMAGE_URL_RESOLVER_KEY, null);\nconst mergeTagSyntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\n\n/**\n * This canvas is only ever a preview — nothing here is editable — so it honours\n * the user's mode directly, with no `previewMode` gate of the kind `Canvas.vue`\n * needs. Re-provided rather than left to inherit, because a `BlockPreviewCanvas`\n * inside a dialog may sit under an editing `Canvas` that provides `false`.\n */\nconst mergeTagSampleMode = inject(MERGE_TAG_SAMPLE_MODE_KEY, null);\nprovide(\n USE_MERGE_TAG_SAMPLES_KEY,\n computed(() => mergeTagSampleMode?.value ?? false),\n);\n\n/**\n * Blocks a display condition currently excludes, so a preview never shows\n * content the recipient won't get. The canvas does the same via\n * `v-show=\"!conditionPreview?.isHidden(block.id)\"`.\n *\n * A no-op for the saved-blocks browser: entries there carry their *stored* ids,\n * which aren't in the current template, so nothing is tracked as hidden. It\n * bites where it should — the save dialog and the test-email preview, both of\n * which show blocks that are live on the canvas.\n *\n * Skipped entirely when `applyConditionFilter` is false — see the prop.\n */\nconst visibleBlocks = computed(() =>\n props.applyConditionFilter\n ? props.blocks.filter((block) => !conditionPreview?.isHidden(block.id))\n : props.blocks,\n);\n\nconst previewSettings = computed(\n () => props.settings ?? editor?.content.value.settings,\n);\n\n/**\n * Frame width, from the one helper the canvas and the scaled preview rows also\n * use — so all three agree by construction rather than by three constants that\n * happen to match. A template with a custom body width now previews at that\n * width instead of a flat 600.\n */\nconst frameWidth = computed(() =>\n getEmailFrameWidth(previewSettings.value, props.viewport),\n);\n\n/**\n * The same document-level style the canvas applies, so a previewed block\n * renders identically to the canvas one: without it the font falls back to the\n * editor UI's and the link rules hit their unset defaults, dropping the\n * underline and the link colour.\n *\n * Read from the *current* template even in the saved-blocks browser, where the\n * previewed content came from elsewhere — a saved block stores only `Block[]`,\n * and the current settings are what it will actually look like once inserted.\n */\nconst documentStyle = computed(() =>\n previewSettings.value\n ? getDocumentStyle(previewSettings.value, fontsManager.resolveFontFamily)\n : {},\n);\n\n/**\n * The email's own language, for the browser's spellchecker and hyphenation —\n * the same binding the editing canvas carries, so a preview is checked by the\n * same rules as the block it mirrors.\n *\n * From `settings.locale`, never `config.locale`: the chrome's language says\n * nothing about the content's. Read from the *current* template for the same\n * reason `documentStyle` is — a saved block stores only `Block[]`. Undefined\n * rather than `\"\"`, which would declare \"unknown language\" and suppress\n * spellcheck instead of falling back.\n */\nconst contentLang = computed(\n () => previewSettings.value?.locale?.trim() || undefined,\n);\nconst contentDir = computed(() =>\n resolveContentDirection(previewSettings.value ?? { locale: \"en\" }),\n);\n\n/**\n * The email's body background — `mj-body background-color` when sent, and the\n * `.tpl-canvas-bg` layer on the editing canvas.\n *\n * Deliberately NOT part of `getDocumentStyle`: the canvas applies that helper\n * to `.tpl-canvas`, which must stay transparent so the invertible background\n * layer beneath it shows through. A background there would double-paint and\n * defeat the dark-mode preview.\n *\n * Truthiness, not `??`: the colour pickers clear to an empty string to mean\n * \"unset\", which as an inline style renders the frame transparent rather than\n * falling back to the neutral preview surface.\n */\nconst emailBackground = computed(\n () => previewSettings.value?.backgroundColor || \"var(--tpl-canvas-bg)\",\n);\n\n/**\n * Width the stage asks for: the content column plus a full gutter on each side,\n * the same stage the canvas builds. It is an ask rather than a fixed size —\n * paired with `max-width: 100%` below, so a container with less room hands over\n * what it has and shows a narrower band instead of overflowing.\n *\n * It has to be a specified width, not `100%`: `TplModal`'s wrapper is\n * shrink-to-fit, so a percentage there resolves against a container whose size\n * the stage is itself supposed to influence, and the stage collapses to its\n * `min-width` — no gutters, on the one surface this exists for.\n */\nconst stageWidth = computed(() => frameWidth.value + EMAIL_GUTTER * 2);\n\nconst previewComponentMap: Record<string, Component> = {\n section: PreviewSectionBlock,\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n custom: CustomBlock,\n wrapper: WrapperBlock,\n};\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, previewComponentMap);\n}\n\n// This loop reads the resolver cache and never starts a lookup itself, so a\n// section's background image paints whatever the canvas has already resolved;\n// nested components (e.g. `ImageBlock`, a layout `WrapperBlock`) may resolve\n// their own images.\nfunction previewBlockStyle(block: Block): Record<string, string> {\n const settings = previewSettings.value;\n return getCachedBlockWrapperStyle(\n block,\n imageUrlResolver,\n mergeTagSyntax,\n matchImageBoxWidth(\n block,\n settings ? { blocks: props.blocks, settings } : undefined,\n ),\n );\n}\n</script>\n\n<template>\n <!-- STAGE — the email body, holding the background and a gutter of it on\n each side of the content column, the same shape `Canvas.vue` builds.\n `max-width: 100%` is what makes it fit anywhere: a roomy surface shows\n the full band, a dialog shows as much as it has, and a container sized to\n the content column shows none. `min-width` keeps it from squeezing the\n column, so a cramped surface clips exactly as it did when the frame\n carried the width itself. -->\n <div\n data-testid=\"block-preview-stage\"\n class=\"tpl-canvas-pane tpl:pointer-events-none tpl:mx-auto tpl:flex tpl:select-none tpl:justify-center tpl:rounded-lg\"\n :style=\"{\n width: `${stageWidth}px`,\n minWidth: `${frameWidth}px`,\n maxWidth: '100%',\n backgroundColor: emailBackground,\n boxShadow: 'var(--tpl-shadow-sm)',\n }\"\n >\n <!-- CONTENT COLUMN — the blocks at their true email width. Keeps the\n testid: this is the element whose width *is* the email width, which is\n what every viewport assertion measures. -->\n <div\n data-testid=\"block-preview-canvas\"\n :lang=\"contentLang\"\n :dir=\"contentDir\"\n :style=\"{\n width: `${frameWidth}px`,\n [EMAIL_FRAME_WIDTH_VAR]: `${frameWidth}px`,\n transition: EMAIL_FRAME_WIDTH_TRANSITION,\n ...documentStyle,\n }\"\n >\n <div\n v-for=\"block in visibleBlocks\"\n :key=\"block.id\"\n :style=\"previewBlockStyle(block)\"\n >\n <component\n :is=\"getBlockComponent(block)\"\n :block=\"block\"\n :viewport=\"viewport\"\n />\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport ButtonBlock from \"./blocks/ButtonBlock.vue\";\nimport CustomBlock from \"./blocks/CustomBlock.vue\";\nimport DividerBlock from \"./blocks/DividerBlock.vue\";\nimport HtmlBlock from \"./blocks/HtmlBlock.vue\";\nimport ImageBlock from \"./blocks/ImageBlock.vue\";\nimport MenuBlock from \"./blocks/MenuBlock.vue\";\nimport PreviewSectionBlock from \"./blocks/PreviewSectionBlock.vue\";\nimport SocialIconsBlock from \"./blocks/SocialIconsBlock.vue\";\nimport SpacerBlock from \"./blocks/SpacerBlock.vue\";\nimport TableBlock from \"./blocks/TableBlock.vue\";\nimport TitleBlock from \"./blocks/TitleBlock.vue\";\nimport ParagraphBlock from \"./blocks/ParagraphBlock.vue\";\nimport VideoBlock from \"./blocks/VideoBlock.vue\";\nimport WrapperBlock from \"./blocks/WrapperBlock.vue\";\nimport {\n BLOCK_REGISTRY_KEY,\n CONDITION_PREVIEW_KEY,\n EDITOR_KEY,\n FONTS_MANAGER_KEY,\n IMAGE_URL_RESOLVER_KEY,\n MERGE_TAG_SAMPLE_MODE_KEY,\n MERGE_TAG_SYNTAX_KEY,\n USE_MERGE_TAG_SAMPLES_KEY,\n requireInject,\n} from \"../keys\";\nimport {\n EMAIL_FRAME_WIDTH_VAR,\n resolveBlockComponent,\n getCachedBlockWrapperStyle,\n getDocumentStyle,\n} from \"../utils/blockComponentResolver\";\nimport {\n EMAIL_FRAME_WIDTH_TRANSITION,\n EMAIL_GUTTER,\n getEmailFrameWidth,\n} from \"../utils/emailFrameWidth\";\nimport { matchImageBoxWidth } from \"../utils/imageRoom\";\nimport {\n SYNTAX_PRESETS,\n resolveContentDirection,\n type Block,\n type TemplateSettings,\n type ViewportSize,\n} from \"@templatical/types\";\nimport { computed, inject, provide, type Component } from \"vue\";\n\nconst props = withDefaults(\n defineProps<{\n blocks: Block[];\n /**\n * Which viewport to render. Defaults to `desktop`, so the saved-blocks\n * surfaces — which have no viewport control — behave exactly as before.\n * The test-email dialog passes the user's choice so responsive blocks show\n * the variant a recipient on that device would receive.\n */\n viewport?: ViewportSize;\n /**\n * Whether the hand-toggled display-condition filter still applies here.\n * `false` where a resolver owns the preview: it has already evaluated every\n * condition against real data, so layering a manual hide on top would veto\n * the answer that was asked for.\n *\n * A prop rather than an injected `PREVIEW_RESOLUTION_KEY` read, because the\n * test-email dialog builds its *own* resolution instance (keyed to the\n * selected recipient) — injecting would consult the shared canvas instance\n * and get the wrong answer.\n */\n applyConditionFilter?: boolean;\n /**\n * Document settings for this surface. Test-email passes the composed\n * document so the mat is layout `backgroundColor` (`mj-body`). Saved-block\n * previews omit it and read the live editor template.\n */\n settings?: TemplateSettings;\n }>(),\n { viewport: \"desktop\", applyConditionFilter: true, settings: undefined },\n);\n\nconst blockRegistry = inject(BLOCK_REGISTRY_KEY);\nconst editor = inject(EDITOR_KEY, null);\nconst conditionPreview = inject(CONDITION_PREVIEW_KEY, null);\nconst fontsManager = requireInject(FONTS_MANAGER_KEY, \"BlockPreviewCanvas\");\nconst imageUrlResolver = inject(IMAGE_URL_RESOLVER_KEY, null);\nconst mergeTagSyntax = inject(MERGE_TAG_SYNTAX_KEY, SYNTAX_PRESETS.liquid);\n\n/**\n * This canvas is only ever a preview — nothing here is editable — so it honours\n * the user's mode directly, with no `previewMode` gate of the kind `Canvas.vue`\n * needs. Re-provided rather than left to inherit, because a `BlockPreviewCanvas`\n * inside a dialog may sit under an editing `Canvas` that provides `false`.\n */\nconst mergeTagSampleMode = inject(MERGE_TAG_SAMPLE_MODE_KEY, null);\nprovide(\n USE_MERGE_TAG_SAMPLES_KEY,\n computed(() => mergeTagSampleMode?.value ?? false),\n);\n\n/**\n * Blocks a display condition currently excludes, so a preview never shows\n * content the recipient won't get. The canvas does the same via\n * `v-show=\"!conditionPreview?.isHidden(block.id)\"`.\n *\n * A no-op for the saved-blocks browser: entries there carry their *stored* ids,\n * which aren't in the current template, so nothing is tracked as hidden. It\n * bites where it should — the save dialog and the test-email preview, both of\n * which show blocks that are live on the canvas.\n *\n * Skipped entirely when `applyConditionFilter` is false — see the prop.\n */\nconst visibleBlocks = computed(() =>\n props.applyConditionFilter\n ? props.blocks.filter((block) => !conditionPreview?.isHidden(block.id))\n : props.blocks,\n);\n\nconst previewSettings = computed(\n () => props.settings ?? editor?.content.value.settings,\n);\n\n/**\n * Frame width, from the one helper the canvas and the scaled preview rows also\n * use — so all three agree by construction rather than by three constants that\n * happen to match. A template with a custom body width now previews at that\n * width instead of a flat 600.\n */\nconst frameWidth = computed(() =>\n getEmailFrameWidth(previewSettings.value, props.viewport),\n);\n\n/**\n * The same document-level style the canvas applies, so a previewed block\n * renders identically to the canvas one: without it the font falls back to the\n * editor UI's and the link rules hit their unset defaults, dropping the\n * underline and the link colour.\n *\n * Read from the *current* template even in the saved-blocks browser, where the\n * previewed content came from elsewhere — a saved block stores only `Block[]`,\n * and the current settings are what it will actually look like once inserted.\n */\nconst documentStyle = computed(() =>\n previewSettings.value\n ? getDocumentStyle(previewSettings.value, fontsManager.resolveFontFamily)\n : {},\n);\n\n/**\n * The email's own language, for the browser's spellchecker and hyphenation —\n * the same binding the editing canvas carries, so a preview is checked by the\n * same rules as the block it mirrors.\n *\n * From `settings.locale`, never `config.locale`: the chrome's language says\n * nothing about the content's. Read from the *current* template for the same\n * reason `documentStyle` is — a saved block stores only `Block[]`. Undefined\n * rather than `\"\"`, which would declare \"unknown language\" and suppress\n * spellcheck instead of falling back.\n */\nconst contentLang = computed(\n () => previewSettings.value?.locale?.trim() || undefined,\n);\nconst contentDir = computed(() =>\n resolveContentDirection(previewSettings.value ?? { locale: \"en\" }),\n);\n\n/**\n * The email's body background — `mj-body background-color` when sent, and the\n * `.tpl-canvas-bg` layer on the editing canvas.\n *\n * Deliberately NOT part of `getDocumentStyle`: the canvas applies that helper\n * to `.tpl-canvas`, which must stay transparent so the invertible background\n * layer beneath it shows through. A background there would double-paint and\n * defeat the dark-mode preview.\n *\n * Truthiness, not `??`: the colour pickers clear to an empty string to mean\n * \"unset\", which as an inline style renders the frame transparent rather than\n * falling back to the neutral preview surface.\n */\nconst emailBackground = computed(\n () => previewSettings.value?.backgroundColor || \"var(--tpl-canvas-bg)\",\n);\n\n/**\n * Width the stage asks for: the content column plus a full gutter on each side,\n * the same stage the canvas builds. It is an ask rather than a fixed size —\n * paired with `max-width: 100%` below, so a container with less room hands over\n * what it has and shows a narrower band instead of overflowing.\n *\n * It has to be a specified width, not `100%`: `TplModal`'s wrapper is\n * shrink-to-fit, so a percentage there resolves against a container whose size\n * the stage is itself supposed to influence, and the stage collapses to its\n * `min-width` — no gutters, on the one surface this exists for.\n */\nconst stageWidth = computed(() => frameWidth.value + EMAIL_GUTTER * 2);\n\nconst previewComponentMap: Record<string, Component> = {\n section: PreviewSectionBlock,\n title: TitleBlock,\n paragraph: ParagraphBlock,\n image: ImageBlock,\n video: VideoBlock,\n button: ButtonBlock,\n divider: DividerBlock,\n social: SocialIconsBlock,\n menu: MenuBlock,\n table: TableBlock,\n spacer: SpacerBlock,\n html: HtmlBlock,\n custom: CustomBlock,\n wrapper: WrapperBlock,\n};\n\nfunction getBlockComponent(block: Block): Component | null {\n return resolveBlockComponent(block, blockRegistry, previewComponentMap);\n}\n\n// This loop reads the resolver cache and never starts a lookup itself, so a\n// section's background image paints whatever the canvas has already resolved;\n// nested components (e.g. `ImageBlock`, a layout `WrapperBlock`) may resolve\n// their own images.\nfunction previewBlockStyle(block: Block): Record<string, string> {\n const settings = previewSettings.value;\n return getCachedBlockWrapperStyle(\n block,\n imageUrlResolver,\n mergeTagSyntax,\n matchImageBoxWidth(\n block,\n settings ? { blocks: props.blocks, settings } : undefined,\n ),\n );\n}\n</script>\n\n<template>\n <!-- STAGE — the email body, holding the background and a gutter of it on\n each side of the content column, the same shape `Canvas.vue` builds.\n `max-width: 100%` is what makes it fit anywhere: a roomy surface shows\n the full band, a dialog shows as much as it has, and a container sized to\n the content column shows none. `min-width` keeps it from squeezing the\n column, so a cramped surface clips exactly as it did when the frame\n carried the width itself. -->\n <div\n data-testid=\"block-preview-stage\"\n class=\"tpl-canvas-pane tpl:pointer-events-none tpl:mx-auto tpl:flex tpl:select-none tpl:justify-center tpl:rounded-lg\"\n :style=\"{\n width: `${stageWidth}px`,\n minWidth: `${frameWidth}px`,\n maxWidth: '100%',\n backgroundColor: emailBackground,\n boxShadow: 'var(--tpl-shadow-sm)',\n }\"\n >\n <!-- CONTENT COLUMN — the blocks at their true email width. Keeps the\n testid: this is the element whose width *is* the email width, which is\n what every viewport assertion measures. -->\n <div\n data-testid=\"block-preview-canvas\"\n :lang=\"contentLang\"\n :dir=\"contentDir\"\n :style=\"{\n width: `${frameWidth}px`,\n [EMAIL_FRAME_WIDTH_VAR]: `${frameWidth}px`,\n transition: EMAIL_FRAME_WIDTH_TRANSITION,\n ...documentStyle,\n }\"\n >\n <div\n v-for=\"block in visibleBlocks\"\n :key=\"block.id\"\n :style=\"previewBlockStyle(block)\"\n >\n <component\n :is=\"getBlockComponent(block)\"\n :block=\"block\"\n :viewport=\"viewport\"\n />\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAwBA,IAAMiG,IAAsD;GAC1D,OAAOhG;GACP,WAAWC;GACX,OAAOC;GACP,OAAOC;GACP,QAAQC;GACR,SAASC;GACT,QAAQC;GACR,MAAMC;GACN,OAAOC;GACP,QAAQC;GACR,MAAMC;GACN,QAAQC;EACV,GAEMsF,IAAQC,GAORC,IAAgB9C,EAAOkB,GAAoB,IAAI,GAE/C6B,IAAe1C,QAAe;GAClC,QAAQuC,EAAM,MAAM,SAApB;IACE,KAAK,KACH,OAAO,CAAC,OAAO,KAAK;IACtB,KAAK,KACH,OAAO;KAAC;K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R,MAAMC;GACN,QAAQC;GACR,SAASC;EACX;EAEA,SAASsE,GAAkB,GAAgC;GACzD,OAAOC,EAAsBC,GAAOT,GAAe4B,EAAmB;EACxE;EAMA,SAASC,GAAkB,GAAsC;GAC/D,IAAMC,IAAWT,EAAgB;GACjC,OAAO3C,EACL+B,GACAQ,GACAC,GACAnD,EACE0C,GACAqB,IAAW;IAAE,QAAQhC,EAAM;IAAQ;GAAS,IAAI,KAAA,CAClD,CACF;EACF;E,kBAWE5D,EAAA,GAAAC,EAqCM,OAAA;GApCJ,eAAY;GACZ,OAAM;GACL,OAAKC,EAAA;IAAoB,OAAA,GAAAuF,GAAA,MAAU;IAAyB,UAAA,GAAAL,EAAA,MAAU;;IAAqD,iBAAAI,GAAA;;;E,IAW5HrF,EAsBM,OAAA;GArBJ,eAAY;GACX,MAAMmF,GAAA;GACN,KAAKC,GAAA;GACL,OAAKrF,EAAA;IAAsB,OAAA,GAAAkF,EAAA,MAAU;KAAehF,EAAAkD,CAAA,IAAqB,GAAM8B,EAAA,MAAU;IAA0B,YAAAhF,EAAAuB,CAAA;IAAyC,GAAA0D,GAAA;;E,KAO7JrF,EAAA,EAAA,GAAAC,EAUMI,GAAA,MAAAC,EATY4E,GAAA,QAAT,OADTlF,EAAA,GAAAC,EAUM,OAAA;GARH,KAAKsE,EAAM;GACX,OAAKrE,EAAEyF,GAAkBpB,CAAK,CAAA;E,KAE/BvE,EAAA,GAAAO,EAIEC,EAHK6D,GAAkBE,CAAK,CAAA,GAAA;GACpB;GACP,UAAUV,EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as e, F as t, _ as n, ct as r, g as i, mt as a, u as o } from "./draggable-DepKdldn.js";
|
|
2
|
-
import { t as s } from "./useCloudI18n-
|
|
2
|
+
import { t as s } from "./useCloudI18n-Xsih9yRH.js";
|
|
3
3
|
// src/cloud/components/CloudHeaderExtras.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var c = {
|
|
5
5
|
key: 0,
|
|
@@ -21,4 +21,4 @@ var c = {
|
|
|
21
21
|
});
|
|
22
22
|
export { l as default };
|
|
23
23
|
|
|
24
|
-
//# sourceMappingURL=CloudHeaderExtras-
|
|
24
|
+
//# sourceMappingURL=CloudHeaderExtras-uUJYJFJ6.js.map
|
package/dist/cdn/chunks/{CloudHeaderExtras-BtqdN777.js.map → CloudHeaderExtras-uUJYJFJ6.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudHeaderExtras-
|
|
1
|
+
{"version":3,"file":"CloudHeaderExtras-uUJYJFJ6.js","names":["_openBlock","_createElementBlock","_Fragment","_toDisplayString","_unref","_createCommentVNode","_sfc_main","defineComponent","openBlock","createElementBlock","unref","createCommentVNode","toDisplayString","Fragment","useCloudI18nStrict","_hoisted_1","CloudHeaderExtras_default","cloudT","cloudFormat","__props"],"sources":["../../../src/cloud/components/CloudHeaderExtras.vue","../../../src/cloud/components/CloudHeaderExtras.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\nimport type { CloudAttachment } from \"../runtime\";\n\n/**\n * The Cloud-only header control, filled into `EditorHeader`'s `left-extras`\n * slot. `Editor.vue` still mounts the `right` part, which renders nothing until\n * Cloud's next right-hand control (S7 and S8 on the `cloud` branch).\n *\n * This control lives in a lazy chunk, so a Cloud session pays one round-trip\n * for it and an OSS session pays none.\n *\n * There is no `center` part. The header's centre track must hold a constant\n * width, so only the anchored columns take conditional controls — see\n * `EditorHeader.vue`'s centre comment.\n *\n * The plan-usage readout lives here rather than in the shared header because\n * it renders a **cloud-chunk** string; OSS translators never see it. Comments\n * and the collaborator bar are deliberately not here: both are shared and\n * provider-backed, so their controls and strings belong to the shared header\n * and the OSS chunk.\n */\ndefineProps<{\n part: \"left\" | \"right\";\n cloud: CloudAttachment;\n}>();\n\nconst { t: cloudT, format: cloudFormat } = useCloudI18nStrict();\n</script>\n\n<template>\n <!-- Left: the plan's template usage. -->\n <template v-if=\"part === 'left'\">\n <!-- A plan *limit*, not a templates concern, which is why it sits here and\n its string stays in the cloud chunk. -->\n <span\n v-if=\"cloud.featureFlags.templateLimit.value !== null\"\n data-testid=\"cloud-template-usage\"\n class=\"tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n cloudFormat(cloudT.header.templatesUsed, {\n used: cloud.featureFlags.templateCount.value,\n max: cloud.featureFlags.templateLimit.value,\n })\n }}\n </span>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\nimport type { CloudAttachment } from \"../runtime\";\n\n/**\n * The Cloud-only header control, filled into `EditorHeader`'s `left-extras`\n * slot. `Editor.vue` still mounts the `right` part, which renders nothing until\n * Cloud's next right-hand control (S7 and S8 on the `cloud` branch).\n *\n * This control lives in a lazy chunk, so a Cloud session pays one round-trip\n * for it and an OSS session pays none.\n *\n * There is no `center` part. The header's centre track must hold a constant\n * width, so only the anchored columns take conditional controls — see\n * `EditorHeader.vue`'s centre comment.\n *\n * The plan-usage readout lives here rather than in the shared header because\n * it renders a **cloud-chunk** string; OSS translators never see it. Comments\n * and the collaborator bar are deliberately not here: both are shared and\n * provider-backed, so their controls and strings belong to the shared header\n * and the OSS chunk.\n */\ndefineProps<{\n part: \"left\" | \"right\";\n cloud: CloudAttachment;\n}>();\n\nconst { t: cloudT, format: cloudFormat } = useCloudI18nStrict();\n</script>\n\n<template>\n <!-- Left: the plan's template usage. -->\n <template v-if=\"part === 'left'\">\n <!-- A plan *limit*, not a templates concern, which is why it sits here and\n its string stays in the cloud chunk. -->\n <span\n v-if=\"cloud.featureFlags.templateLimit.value !== null\"\n data-testid=\"cloud-template-usage\"\n class=\"tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n cloudFormat(cloudT.header.templatesUsed, {\n used: cloud.featureFlags.templateCount.value,\n max: cloud.featureFlags.templateLimit.value,\n })\n }}\n </span>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EA2BA,IAAM,EAAE,GAAGiB,GAAQ,QAAQC,MAAgBJ,EAAmB;E,iBAK5CK,EAAA,SAAI,UAApBnB,EAAA,GAAAC,EAeWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAXDiB,EAAA,MAAM,aAAa,cAAc,UAAK,O,aAD9CnB,EAAA,GAAAC,EAWO,QAXPc,GAWOZ,EALHC,EAAAc,CAAA,CAAW,CAACd,EAAAa,CAAA,CAAM,CAAC,OAAO,eAAa;GAAoB,MAAAE,EAAA,MAAM,aAAa,cAAc;GAAsB,KAAAA,EAAA,MAAM,aAAa,cAAc"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { C as e, F as t, G as n, L as r, _ as i, ct as a, dt as o, g as s, h as c, m as l, mt as u, n as d, u as f, x as p, y as m } from "./draggable-DepKdldn.js";
|
|
2
|
-
import { It as h, d as g } from "./icons-
|
|
2
|
+
import { It as h, d as g } from "./icons-DHExFLlT.js";
|
|
3
3
|
import { C as _, b as v, f as y } from "./styleConstants-CgiNKdnc.js";
|
|
4
|
-
import { t as b } from "./useCloudI18n-
|
|
5
|
-
import { t as x } from "./TplModal-
|
|
4
|
+
import { t as b } from "./useCloudI18n-Xsih9yRH.js";
|
|
5
|
+
import { t as x } from "./TplModal-d6fEZGJ5.js";
|
|
6
6
|
// src/cloud/components/CloudErrorOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var S = {
|
|
8
8
|
key: 0,
|
|
@@ -164,4 +164,4 @@ var S = {
|
|
|
164
164
|
});
|
|
165
165
|
export { V as default };
|
|
166
166
|
|
|
167
|
-
//# sourceMappingURL=CloudPanels-
|
|
167
|
+
//# sourceMappingURL=CloudPanels-DQnlH_YJ.js.map
|