@templatical/editor 0.56.0 → 0.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/dist/{AiAltTextPopover-DdsvhE78.js → AiAltTextPopover-CpZ7UeAZ.js} +3 -3
  2. package/dist/{AiAltTextReview-P6to1_0t.js → AiAltTextReview-LYxvn7Qe.js} +4 -4
  3. package/dist/{AiChatPanel-BSlmzMRC.js → AiChatPanel-Cy05P-iO.js} +53 -53
  4. package/dist/{AiPanels-DAsnX-a3.js → AiPanels-CwKmXzyr.js} +1 -1
  5. package/dist/{AiRewriteMenu-DIISOR6U.js → AiRewriteMenu-DgqJHnza.js} +8 -8
  6. package/dist/{BlockIssueBadge-Bmtc50BQ.js → BlockIssueBadge-CxHJmuOh.js} +3 -3
  7. package/dist/{BlockPreviewCanvas-BYIzNn-9.js → BlockPreviewCanvas-DEmNZkEG.js} +44 -44
  8. package/dist/{CloudPanels-w34W8_BP.js → CloudPanels-Bmlf05Il.js} +11 -11
  9. package/dist/{CollaborationNotices-HTbCebjV.js → CollaborationNotices-C27GCMvK.js} +7 -7
  10. package/dist/{CommentsPanel-C5qG17Ki.js → CommentsPanel-B5NqPMmY.js} +1 -1
  11. package/dist/{CommentsSidebar-C7CWcUYZ.js → CommentsSidebar-BDrcrDxS.js} +42 -42
  12. package/dist/{CountdownBlock-BTXcCvjZ.js → CountdownBlock-D8dqjm3F.js} +6 -6
  13. package/dist/{CountdownToolbar-CP-pkntQ.js → CountdownToolbar-IjpCOjCd.js} +30 -30
  14. package/dist/{IssuesPanel-CiiNBzH0.js → IssuesPanel-uwuzeMSW.js} +87 -87
  15. package/dist/LanguageMenu-C-eQ0lFy.js +403 -0
  16. package/dist/{LocaleNotices-CTCZ7BYv.js → LocaleNotices-CDK_9D7P.js} +8 -8
  17. package/dist/{LogicTagInsertButton-DEOPc4RC.js → LogicTagInsertButton-BSolF7Fd.js} +3 -3
  18. package/dist/{MediaEditModal-DJsPLTwP.js → MediaEditModal-C8yc9dxt.js} +7 -7
  19. package/dist/{MediaPanels-D2WD2aE2.js → MediaPanels-FI4I8asn.js} +1 -1
  20. package/dist/{MergeTagInput-C9icdxw7.js → MergeTagInput-B1nl2ZMT.js} +12 -12
  21. package/dist/{MergeTagTextarea-CrAcmT3A.js → MergeTagTextarea-DJlf3VbS.js} +1 -1
  22. package/dist/{ParagraphEditor-BWBQ3jKz.js → ParagraphEditor-Dqco128s.js} +156 -156
  23. package/dist/{RestoreVersionDialog-CqAp16yQ.js → RestoreVersionDialog-hqLCuGV5.js} +12 -12
  24. package/dist/{RichTextEditorContent-xbBjVPVQ.js → RichTextEditorContent-xIEF0Y3Z.js} +2 -2
  25. package/dist/{SaveBlockDialog-pebNJBTc.js → SaveBlockDialog-CQlCP_XC.js} +46 -46
  26. package/dist/{SavedBlocksBrowserModal-CvagMcv7.js → SavedBlocksBrowserModal-BXA32Fx6.js} +23 -23
  27. package/dist/{SavedBlocksPanels-B9AAVBDm.js → SavedBlocksPanels-BKUzbamj.js} +1 -1
  28. package/dist/{SavedBlocksPickBar-BIANWe3i.js → SavedBlocksPickBar-BlvF-4UF.js} +9 -9
  29. package/dist/{TemplateSettings-ORq4PbCN.js → TemplateSettings-CYFtR8zv.js} +41 -41
  30. package/dist/{TestEmailModal-DRjCpcPl.js → TestEmailModal-BbaL17HO.js} +20 -20
  31. package/dist/{TestEmailPanel-H0v8El__.js → TestEmailPanel-DhB1CSpg.js} +1 -1
  32. package/dist/{TitleEditor-CEGbJXeU.js → TitleEditor-3BRl8u5l.js} +21 -21
  33. package/dist/{Toolbar-XT-uGA9J.js → Toolbar-pzNIakGM.js} +656 -656
  34. package/dist/{TplModal-7NQq5-VW.js → TplModal-WNuWhHZm.js} +4 -4
  35. package/dist/{VersionHistoryMenu-C8BE3Pr-.js → VersionHistoryMenu--T-Qp_mH.js} +15 -15
  36. package/dist/{VersionHistoryPanels-CuKuOSJG.js → VersionHistoryPanels-BPubvYIE.js} +1 -1
  37. package/dist/{VersionPreviewBanner-BVFBkveR.js → VersionPreviewBanner-ClL3Wkln.js} +7 -7
  38. package/dist/{WrapperBlock-Bdw-072t.js → WrapperBlock-CjfCPceb.js} +11 -11
  39. package/dist/{blockTypeIcons-CGplGmmr.js → blockTypeIcons-12OMwVyN.js} +1 -1
  40. package/dist/bundle-stats.json +6 -6
  41. package/dist/cdn/chunks/{AiAltTextPopover-x999Gimz.js → AiAltTextPopover-PFjTrl0y.js} +4 -4
  42. package/dist/cdn/chunks/{AiAltTextPopover-x999Gimz.js.map → AiAltTextPopover-PFjTrl0y.js.map} +1 -1
  43. package/dist/cdn/chunks/{AiAltTextReview-DjnFz1wO.js → AiAltTextReview-BMjzvApH.js} +5 -5
  44. package/dist/cdn/chunks/{AiAltTextReview-DjnFz1wO.js.map → AiAltTextReview-BMjzvApH.js.map} +1 -1
  45. package/dist/cdn/chunks/{AiChatPanel-DKDu9cs7.js → AiChatPanel-C2gpq4kP.js} +107 -107
  46. package/dist/cdn/chunks/{AiChatPanel-DKDu9cs7.js.map → AiChatPanel-C2gpq4kP.js.map} +1 -1
  47. package/dist/cdn/chunks/{AiPanels-jMLVaiKx.js → AiPanels-Cx3PE2mE.js} +2 -2
  48. package/dist/cdn/chunks/{AiPanels-jMLVaiKx.js.map → AiPanels-Cx3PE2mE.js.map} +1 -1
  49. package/dist/cdn/chunks/{AiRewriteMenu-s79rmHFy.js → AiRewriteMenu-CnkyjPEu.js} +11 -11
  50. package/dist/cdn/chunks/{AiRewriteMenu-s79rmHFy.js.map → AiRewriteMenu-CnkyjPEu.js.map} +1 -1
  51. package/dist/cdn/chunks/{BlockIssueBadge-Bnmq_M4G.js → BlockIssueBadge-DncZ-HDf.js} +4 -4
  52. package/dist/cdn/chunks/{BlockIssueBadge-Bnmq_M4G.js.map → BlockIssueBadge-DncZ-HDf.js.map} +1 -1
  53. package/dist/cdn/chunks/BlockPreviewCanvas-CCSEzL46.js +156 -0
  54. package/dist/cdn/chunks/{BlockPreviewCanvas-B3HkuENF.js.map → BlockPreviewCanvas-CCSEzL46.js.map} +1 -1
  55. package/dist/cdn/chunks/{CloudPanels-DQnlH_YJ.js → CloudPanels-CRztnw4M.js} +2 -2
  56. package/dist/cdn/chunks/{CloudPanels-DQnlH_YJ.js.map → CloudPanels-CRztnw4M.js.map} +1 -1
  57. package/dist/cdn/chunks/{CollaborationNotices-CHqUGhOZ.js → CollaborationNotices-IuLYT2x7.js} +8 -8
  58. package/dist/cdn/chunks/{CollaborationNotices-CHqUGhOZ.js.map → CollaborationNotices-IuLYT2x7.js.map} +1 -1
  59. package/dist/cdn/chunks/{CommentsPanel-EtdTzTmq.js → CommentsPanel-lgjJNrrY.js} +2 -2
  60. package/dist/cdn/chunks/{CommentsPanel-EtdTzTmq.js.map → CommentsPanel-lgjJNrrY.js.map} +1 -1
  61. package/dist/cdn/chunks/{CommentsSidebar-Qmj049QX.js → CommentsSidebar-DTold7iy.js} +214 -214
  62. package/dist/cdn/chunks/{CommentsSidebar-Qmj049QX.js.map → CommentsSidebar-DTold7iy.js.map} +1 -1
  63. package/dist/cdn/chunks/{CountdownBlock-DyGsh92b.js → CountdownBlock-8aPSExrv.js} +7 -7
  64. package/dist/cdn/chunks/{CountdownBlock-DyGsh92b.js.map → CountdownBlock-8aPSExrv.js.map} +1 -1
  65. package/dist/cdn/chunks/{CountdownToolbar-Ddj2erNm.js → CountdownToolbar-CnWQEW5g.js} +50 -50
  66. package/dist/cdn/chunks/{CountdownToolbar-Ddj2erNm.js.map → CountdownToolbar-CnWQEW5g.js.map} +1 -1
  67. package/dist/cdn/chunks/{IssuesPanel-DnSnEh1X.js → IssuesPanel-CrplCzo8.js} +11 -11
  68. package/dist/cdn/chunks/{IssuesPanel-DnSnEh1X.js.map → IssuesPanel-CrplCzo8.js.map} +1 -1
  69. package/dist/cdn/chunks/{LanguageMenu-C2I_yTL5.js → LanguageMenu-B6MNInCL.js} +110 -110
  70. package/dist/cdn/chunks/{LanguageMenu-C2I_yTL5.js.map → LanguageMenu-B6MNInCL.js.map} +1 -1
  71. package/dist/cdn/chunks/{LocaleNotices-Dr9LRCAg.js → LocaleNotices-TxeAl8Iq.js} +9 -9
  72. package/dist/cdn/chunks/{LocaleNotices-Dr9LRCAg.js.map → LocaleNotices-TxeAl8Iq.js.map} +1 -1
  73. package/dist/cdn/chunks/{LogicTagInsertButton-BdzE9-l7.js → LogicTagInsertButton-DvSVx2DB.js} +4 -4
  74. package/dist/cdn/chunks/{LogicTagInsertButton-BdzE9-l7.js.map → LogicTagInsertButton-DvSVx2DB.js.map} +1 -1
  75. package/dist/cdn/chunks/{MediaEditModal-CMJFXu_o.js → MediaEditModal-tGK6htBl.js} +8 -8
  76. package/dist/cdn/chunks/{MediaEditModal-CMJFXu_o.js.map → MediaEditModal-tGK6htBl.js.map} +1 -1
  77. package/dist/cdn/chunks/{MediaPanels-C790ZXuY.js → MediaPanels-BVrQYz2C.js} +2 -2
  78. package/dist/cdn/chunks/{MediaPanels-C790ZXuY.js.map → MediaPanels-BVrQYz2C.js.map} +1 -1
  79. package/dist/cdn/chunks/{MergeTagInput-CmrX8Md6.js → MergeTagInput-DeuNH3re.js} +13 -13
  80. package/dist/cdn/chunks/{MergeTagInput-CmrX8Md6.js.map → MergeTagInput-DeuNH3re.js.map} +1 -1
  81. package/dist/cdn/chunks/{MergeTagTextarea-KOnd2teB.js → MergeTagTextarea-B2xxIU3e.js} +2 -2
  82. package/dist/cdn/chunks/{MergeTagTextarea-KOnd2teB.js.map → MergeTagTextarea-B2xxIU3e.js.map} +1 -1
  83. package/dist/cdn/chunks/{ParagraphEditor-I9lbKaPk.js → ParagraphEditor-Bx_Hlw8d.js} +106 -106
  84. package/dist/cdn/chunks/{ParagraphEditor-I9lbKaPk.js.map → ParagraphEditor-Bx_Hlw8d.js.map} +1 -1
  85. package/dist/cdn/chunks/{RestoreVersionDialog-DqbULAbc.js → RestoreVersionDialog-CPrrWTsT.js} +12 -12
  86. package/dist/cdn/chunks/{RestoreVersionDialog-DqbULAbc.js.map → RestoreVersionDialog-CPrrWTsT.js.map} +1 -1
  87. package/dist/cdn/chunks/{RichTextEditorContent-_O22z0pn.js → RichTextEditorContent-Dze4C9VI.js} +3 -3
  88. package/dist/cdn/chunks/{RichTextEditorContent-_O22z0pn.js.map → RichTextEditorContent-Dze4C9VI.js.map} +1 -1
  89. package/dist/cdn/chunks/{SaveBlockDialog-CClRLXgF.js → SaveBlockDialog-CXVwnfsy.js} +51 -51
  90. package/dist/cdn/chunks/{SaveBlockDialog-CClRLXgF.js.map → SaveBlockDialog-CXVwnfsy.js.map} +1 -1
  91. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BIaxaxw9.js → SavedBlocksBrowserModal-BDTmenOE.js} +23 -23
  92. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BIaxaxw9.js.map → SavedBlocksBrowserModal-BDTmenOE.js.map} +1 -1
  93. package/dist/cdn/chunks/{SavedBlocksPanels-Dfu9N6YW.js → SavedBlocksPanels-B41Rk_v1.js} +2 -2
  94. package/dist/cdn/chunks/{SavedBlocksPanels-Dfu9N6YW.js.map → SavedBlocksPanels-B41Rk_v1.js.map} +1 -1
  95. package/dist/cdn/chunks/{SavedBlocksPickBar-DiMW_dbJ.js → SavedBlocksPickBar-B97z_rFH.js} +11 -11
  96. package/dist/cdn/chunks/{SavedBlocksPickBar-DiMW_dbJ.js.map → SavedBlocksPickBar-B97z_rFH.js.map} +1 -1
  97. package/dist/cdn/chunks/{TemplateSettings-JMUo0LIV.js → TemplateSettings-YwwRbxPc.js} +102 -102
  98. package/dist/cdn/chunks/{TemplateSettings-JMUo0LIV.js.map → TemplateSettings-YwwRbxPc.js.map} +1 -1
  99. package/dist/cdn/chunks/{TestEmailModal-D52VtwBZ.js → TestEmailModal-BiFP2Cbx.js} +20 -20
  100. package/dist/cdn/chunks/{TestEmailModal-D52VtwBZ.js.map → TestEmailModal-BiFP2Cbx.js.map} +1 -1
  101. package/dist/cdn/chunks/{TestEmailPanel-D9ezVDHd.js → TestEmailPanel-BrivPMk2.js} +2 -2
  102. package/dist/cdn/chunks/{TestEmailPanel-D9ezVDHd.js.map → TestEmailPanel-BrivPMk2.js.map} +1 -1
  103. package/dist/cdn/chunks/{TitleEditor-D04vvbUc.js → TitleEditor-CzPkkL2s.js} +19 -19
  104. package/dist/cdn/chunks/{TitleEditor-D04vvbUc.js.map → TitleEditor-CzPkkL2s.js.map} +1 -1
  105. package/dist/cdn/chunks/{Toolbar-C_Hfsher.js → Toolbar-VH07SzX7.js} +550 -550
  106. package/dist/cdn/chunks/{Toolbar-C_Hfsher.js.map → Toolbar-VH07SzX7.js.map} +1 -1
  107. package/dist/cdn/chunks/{TplModal-d6fEZGJ5.js → TplModal-DMe6J811.js} +6 -6
  108. package/dist/cdn/chunks/{TplModal-d6fEZGJ5.js.map → TplModal-DMe6J811.js.map} +1 -1
  109. package/dist/cdn/chunks/{VersionHistoryMenu-C8ucm43v.js → VersionHistoryMenu-DkwbKhBl.js} +15 -15
  110. package/dist/cdn/chunks/{VersionHistoryMenu-C8ucm43v.js.map → VersionHistoryMenu-DkwbKhBl.js.map} +1 -1
  111. package/dist/cdn/chunks/{VersionHistoryPanels-BAdzmhvH.js → VersionHistoryPanels-CgxhMRAl.js} +2 -2
  112. package/dist/cdn/chunks/{VersionHistoryPanels-BAdzmhvH.js.map → VersionHistoryPanels-CgxhMRAl.js.map} +1 -1
  113. package/dist/cdn/chunks/{VersionPreviewBanner-BWuovbFc.js → VersionPreviewBanner-WVBDBrwQ.js} +8 -8
  114. package/dist/cdn/chunks/{VersionPreviewBanner-BWuovbFc.js.map → VersionPreviewBanner-WVBDBrwQ.js.map} +1 -1
  115. package/dist/cdn/chunks/{WrapperBlock-TXDSDXUP.js → WrapperBlock-CCCIcqe2.js} +12 -12
  116. package/dist/cdn/chunks/{WrapperBlock-TXDSDXUP.js.map → WrapperBlock-CCCIcqe2.js.map} +1 -1
  117. package/dist/cdn/chunks/{composables-CsfQlmcf.js → composables-D3lsO7Io.js} +925 -925
  118. package/dist/cdn/chunks/composables-D3lsO7Io.js.map +1 -0
  119. package/dist/cdn/chunks/{createCloudRuntime-PpIFCDfj.js → createCloudRuntime-CE79GB1H.js} +15 -15
  120. package/dist/cdn/chunks/{createCloudRuntime-PpIFCDfj.js.map → createCloudRuntime-CE79GB1H.js.map} +1 -1
  121. package/dist/cdn/chunks/dist-Cf1pSluo.js +405 -0
  122. package/dist/cdn/chunks/{dist-DqGgijFI.js.map → dist-Cf1pSluo.js.map} +1 -1
  123. package/dist/cdn/chunks/{editor-modal-B8UE9V8B.js → editor-modal-CN69NlOK.js} +170 -170
  124. package/dist/cdn/chunks/{editor-modal-B8UE9V8B.js.map → editor-modal-CN69NlOK.js.map} +1 -1
  125. package/dist/cdn/chunks/en-Bcz4gS9U.js +1 -0
  126. package/dist/cdn/chunks/{extensions-BM6ZSnsQ.js → extensions-8dlM-fU4.js} +96 -96
  127. package/dist/cdn/chunks/{extensions-BM6ZSnsQ.js.map → extensions-8dlM-fU4.js.map} +1 -1
  128. package/dist/cdn/chunks/{sanitizeHtml-DJI7vvET.js → sanitizeHtml-B3njfkSy.js} +11 -11
  129. package/dist/cdn/chunks/{sanitizeHtml-DJI7vvET.js.map → sanitizeHtml-B3njfkSy.js.map} +1 -1
  130. package/dist/cdn/chunks/{socialIcons-Qw9rHc8C.js → socialIcons-BFgc3qqJ.js} +2 -2
  131. package/dist/cdn/chunks/{socialIcons-Qw9rHc8C.js.map → socialIcons-BFgc3qqJ.js.map} +1 -1
  132. package/dist/cdn/chunks/{src-Bfj1jHnn.js → src-GgKlXNxy.js} +2 -2
  133. package/dist/cdn/chunks/{src-Bfj1jHnn.js.map → src-GgKlXNxy.js.map} +1 -1
  134. package/dist/cdn/chunks/{tiptap-Dipw_zOQ.js → tiptap-C940SvId.js} +3 -3
  135. package/dist/cdn/chunks/{tiptap-Dipw_zOQ.js.map → tiptap-C940SvId.js.map} +1 -1
  136. package/dist/cdn/chunks/{useLogicTag-DLvWzWsp.js → useLogicTag-B0PDeDxl.js} +4 -4
  137. package/dist/cdn/chunks/{useLogicTag-DLvWzWsp.js.map → useLogicTag-B0PDeDxl.js.map} +1 -1
  138. package/dist/cdn/chunks/{useMergeTag-B4FHCGGm.js → useMergeTag-BSU75bKk.js} +7 -7
  139. package/dist/cdn/chunks/{useMergeTag-B4FHCGGm.js.map → useMergeTag-BSU75bKk.js.map} +1 -1
  140. package/dist/cdn/editor.js +325 -325
  141. package/dist/cdn/editor.js.map +1 -1
  142. package/dist/{composables-CRX6rncm.js → composables-DreAt_0A.js} +1031 -1031
  143. package/dist/{createCloudRuntime-DplyIlsy.js → createCloudRuntime-CL4tUlDC.js} +14 -14
  144. package/dist/{dist-ChOb5XHW.js → dist-0GWMyHtM.js} +1 -1
  145. package/dist/{dist-6DU0me3E.js → dist-B_0FPmoy.js} +1 -1
  146. package/dist/{dist-B8dY8drK.js → dist-BjzK1g4Z.js} +1 -1
  147. package/dist/{dist-54VCNoC0.js → dist-BsumKKh9.js} +1 -1
  148. package/dist/{dist-BWflWcpW.js → dist-C3avsUq9.js} +2 -2
  149. package/dist/{dist-fqSers8_.js → dist-CCLRTtJP.js} +197 -197
  150. package/dist/dist-CiYotUR8.js +406 -0
  151. package/dist/{dist-C3hu_C3w.js → dist-Cr1CLCmx.js} +1 -1
  152. package/dist/{dist-D_XrUEET.js → dist-CsknfjrZ.js} +3 -3
  153. package/dist/{dist-TAv500j6.js → dist-DDytHU_6.js} +1 -1
  154. package/dist/{dist-CcOn7WCo.js → dist-DKV9m4Uu.js} +1 -1
  155. package/dist/{dist-B9a7iVye.js → dist-Dq9VnANT.js} +1 -1
  156. package/dist/{dist-DZ3X-uB8.js → dist-ZrT0vAB6.js} +1 -1
  157. package/dist/{editor-modal-D9HT9bD6.js → editor-modal-BD32TXws.js} +106 -106
  158. package/dist/en-Dgs_-NBw.js +1 -0
  159. package/dist/{extensions-Cm6K4SRX.js → extensions-DKxHlSd7.js} +179 -179
  160. package/dist/{socialIcons-CJD6OsI7.js → socialIcons-oo4uL16Y.js} +1 -1
  161. package/dist/templatical-editor.js +526 -526
  162. package/dist/{useLogicTag-DLkYos2Q.js → useLogicTag-B4Zpk3eo.js} +3 -3
  163. package/dist/{useMergeTag-IoWOO679.js → useMergeTag-B5qlq8px.js} +7 -7
  164. package/package.json +7 -7
  165. package/dist/LanguageMenu-B981Av-6.js +0 -403
  166. package/dist/cdn/chunks/BlockPreviewCanvas-B3HkuENF.js +0 -156
  167. package/dist/cdn/chunks/composables-CsfQlmcf.js.map +0 -1
  168. package/dist/cdn/chunks/dist-DqGgijFI.js +0 -405
  169. package/dist/cdn/chunks/en-CVxNoHww.js +0 -1
  170. package/dist/dist-0alKVRc_.js +0 -406
  171. package/dist/en-De3uAutQ.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SaveBlockDialog-CClRLXgF.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_openBlock","_createElementBlock","_createElementVNode","_unref","_withKeys","_withModifiers","_createVNode","_normalizeStyle","BlockPreviewCanvas","_createCommentVNode","_createBlock","_resolveDynamicComponent","_createTextVNode","_toDisplayString","_sfc_main","_openBlock","_createBlock","TplModal","_withCtx","_createElementVNode","_toDisplayString","_unref","_withDirectives","_vModelText","_createElementBlock","_Fragment","_renderList","_createTextVNode","_createCommentVNode","_createVNode","VueDraggable","SavedBlockPreviewRow","_normalizeClass","_sfc_main","resolveDynamicComponent","defineComponent","openBlock","withCtx","watch","withDirectives","renderList","onBeforeUnmount","onMounted","inject","createElementBlock","createTextVNode","withKeys","unref","normalizeClass","createCommentVNode","createBlock","withModifiers","createBaseVNode","toDisplayString","vModelText","computed","normalizeStyle","lo","ref","Fragment","createVNode","getEmailFrameWidth","getBlockLabel","ChevronDown","ChevronUp","LoaderCircle","GripVertical","SAVED_BLOCKS_KEY","CUSTOM_BLOCK_DEFINITIONS_KEY","requireInject","EDITOR_KEY","useI18n","primaryBtnClass","TplModal_default","BlockPreviewCanvas_default","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","\"background\"","_hoisted_5$1","COLLAPSED_HEIGHT","SavedBlockPreviewRow_default","__emit","props","__props","emit","customBlockDefinitions","editor","previewWidth","frameEl","contentEl","scale","fullHeight","expanded","observer","isClipped","frameHeight","measure","frame","content","width","next","blockLabel","t","handleLabel","format","toggleLabel","_cache","_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","SaveBlockDialog_default","savedBlocks","name","category","isSaving","error","announcement","orderedIds","pickedBlocks","byId","b","id","orderedBlocks","blocks","moveBlock","order","from","blockId","to","delta","moved","label","block","summary","visible","canSave","handleSave","err","handleClose","handleKeydown","event","$event","option","index"],"sources":["../../../src/components/SavedBlockPreviewRow.vue","../../../src/components/SavedBlockPreviewRow.vue","../../../src/components/SaveBlockDialog.vue","../../../src/components/SaveBlockDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * One reorderable row in the save dialog's preview list: a grip handle beside a\n * scaled-down render of the real block.\n *\n * The preview is the same `BlockPreviewCanvas` the browser modal uses, so\n * a row shows what the block actually looks like rather than a description of\n * it. That canvas is fixed at the 600px email width every block component\n * renders against, so the row shrinks it with `transform: scale()` instead of\n * re-flowing it at dialog width — a re-flow would show a layout the recipient\n * will never see.\n *\n * `transform` doesn't participate in layout, so the frame would keep reserving\n * the full unscaled height; a `ResizeObserver` mirrors the scaled height back\n * onto it. The handle is a sibling of the scaled subtree, so it stays full size\n * and keeps its real hit area.\n *\n * Row chrome uses the raw theme tokens, not the `--tpl-chrome-*` aliases: the\n * chrome is an ancestor and a sibling of the rendered email content, never a\n * descendant, so the `.tpl-block-content` token override can't reach it.\n */\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\nimport { useI18n } from \"../composables\";\nimport { CUSTOM_BLOCK_DEFINITIONS_KEY, EDITOR_KEY } from \"../keys\";\nimport { getEmailFrameWidth } from \"../utils/emailFrameWidth\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { ChevronDown, ChevronUp, GripVertical } from \"@lucide/vue\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nconst props = defineProps<{\n block: Block;\n /** 1-based position in the list — spoken by the handle's label. */\n position: number;\n total: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"move\", delta: -1 | 1): void;\n}>();\n\nconst { t, format } = useI18n();\n// Optional: absent when the consumer registers no custom blocks.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst editor = inject(EDITOR_KEY, null);\n\n/**\n * The width the nested `BlockPreviewCanvas` actually renders at.\n *\n * MUST come from the same helper the canvas uses, because the scale factor below\n * divides by it: a mismatch scales every row by the wrong amount, so a template\n * with a custom body width would overflow its frame or under-fill it. Rows are\n * always the desktop width — the save dialog has no viewport control.\n */\nconst previewWidth = computed(() =>\n getEmailFrameWidth(editor?.content.value.settings),\n);\n/**\n * Collapsed height for a tall block. A hero card or a multi-row section would\n * otherwise be taller than the whole list, leaving one row on screen — and\n * seeing the rows together is what makes them orderable. Anything taller\n * collapses to this, fades out at the cut, and can be expanded in place.\n */\nconst COLLAPSED_HEIGHT = 240;\n\nconst frameEl = ref<HTMLElement | null>(null);\nconst contentEl = ref<HTMLElement | null>(null);\nconst scale = ref(1);\n/** Scaled height of the whole block; `null` until first measured. */\nconst fullHeight = ref<number | null>(null);\nconst expanded = ref(false);\n\nlet observer: ResizeObserver | null = null;\n\n/** Only a block taller than the collapsed cap needs fading or expanding. */\nconst isClipped = computed(\n () => fullHeight.value !== null && fullHeight.value > COLLAPSED_HEIGHT,\n);\n\nconst frameHeight = computed(() => {\n if (fullHeight.value === null) return null;\n if (expanded.value || !isClipped.value) return fullHeight.value;\n return COLLAPSED_HEIGHT;\n});\n\nfunction measure(): void {\n const frame = frameEl.value;\n const content = contentEl.value;\n if (!frame || !content) return;\n const width = frame.clientWidth;\n if (width <= 0) return;\n // Never scale up: a dialog wider than the email would blow the preview past\n // its real proportions.\n const next = Math.min(1, width / previewWidth.value);\n scale.value = next;\n fullHeight.value = content.offsetHeight * next;\n}\n\nonMounted(() => {\n measure();\n // Absent in non-DOM test environments. Without it the frame simply falls back\n // to the untransformed height and clips — degraded, never broken.\n if (typeof ResizeObserver === \"undefined\") return;\n observer = new ResizeObserver(() => measure());\n if (frameEl.value) observer.observe(frameEl.value);\n if (contentEl.value) observer.observe(contentEl.value);\n});\n\nonBeforeUnmount(() => {\n observer?.disconnect();\n observer = null;\n});\n\nconst blockLabel = computed(() =>\n getBlockLabel(props.block, t, customBlockDefinitions),\n);\n\nconst handleLabel = computed(() =>\n format(t.savedBlocks.reorderHandle, {\n block: blockLabel.value,\n position: props.position,\n total: props.total,\n }),\n);\n\nconst toggleLabel = computed(() =>\n format(\n expanded.value\n ? t.savedBlocks.collapsePreview\n : t.savedBlocks.expandPreview,\n { block: blockLabel.value },\n ),\n);\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-reorder-row\"\n :data-block-id=\"block.id\"\n class=\"tpl:flex tpl:items-start tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:p-1.5 tpl:border-[var(--tpl-border)]\"\n style=\"background-color: var(--tpl-bg)\"\n >\n <!-- Sortable's `handle` selector points here, so a pointer-drag can only\n start from the grip — never from the preview itself. -->\n <button\n type=\"button\"\n data-testid=\"saved-blocks-reorder-handle\"\n class=\"tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"handleLabel\"\n :title=\"t.savedBlocks.reorderHint\"\n @keydown.up.prevent=\"emit('move', -1)\"\n @keydown.down.prevent=\"emit('move', 1)\"\n >\n <GripVertical :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n\n <div class=\"tpl:relative tpl:min-w-0 tpl:flex-1\">\n <div\n ref=\"frameEl\"\n class=\"tpl:overflow-hidden\"\n :style=\"{\n height: frameHeight !== null ? `${frameHeight}px` : undefined,\n }\"\n >\n <div\n ref=\"contentEl\"\n :style=\"{\n width: `${previewWidth}px`,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }\"\n >\n <BlockPreviewCanvas :blocks=\"[block]\" />\n </div>\n </div>\n\n <!-- Fade over the cut, so a clipped block reads as truncated rather than\n as a block that simply ends there. Pointer-transparent: it sits over\n the preview, and swallowing clicks would break the row. -->\n <div\n v-if=\"isClipped && !expanded\"\n data-testid=\"saved-blocks-preview-fade\"\n aria-hidden=\"true\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10\"\n style=\"\n background: linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n );\n \"\n />\n\n <button\n v-if=\"isClipped\"\n type=\"button\"\n data-testid=\"saved-blocks-preview-toggle\"\n class=\"tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"toggleLabel\"\n :aria-expanded=\"expanded\"\n @click=\"expanded = !expanded\"\n >\n <component\n :is=\"expanded ? ChevronUp : ChevronDown\"\n :size=\"11\"\n :stroke-width=\"2\"\n />\n {{ expanded ? t.savedBlocks.collapse : t.savedBlocks.expand }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * One reorderable row in the save dialog's preview list: a grip handle beside a\n * scaled-down render of the real block.\n *\n * The preview is the same `BlockPreviewCanvas` the browser modal uses, so\n * a row shows what the block actually looks like rather than a description of\n * it. That canvas is fixed at the 600px email width every block component\n * renders against, so the row shrinks it with `transform: scale()` instead of\n * re-flowing it at dialog width — a re-flow would show a layout the recipient\n * will never see.\n *\n * `transform` doesn't participate in layout, so the frame would keep reserving\n * the full unscaled height; a `ResizeObserver` mirrors the scaled height back\n * onto it. The handle is a sibling of the scaled subtree, so it stays full size\n * and keeps its real hit area.\n *\n * Row chrome uses the raw theme tokens, not the `--tpl-chrome-*` aliases: the\n * chrome is an ancestor and a sibling of the rendered email content, never a\n * descendant, so the `.tpl-block-content` token override can't reach it.\n */\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\nimport { useI18n } from \"../composables\";\nimport { CUSTOM_BLOCK_DEFINITIONS_KEY, EDITOR_KEY } from \"../keys\";\nimport { getEmailFrameWidth } from \"../utils/emailFrameWidth\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { ChevronDown, ChevronUp, GripVertical } from \"@lucide/vue\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nconst props = defineProps<{\n block: Block;\n /** 1-based position in the list — spoken by the handle's label. */\n position: number;\n total: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"move\", delta: -1 | 1): void;\n}>();\n\nconst { t, format } = useI18n();\n// Optional: absent when the consumer registers no custom blocks.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst editor = inject(EDITOR_KEY, null);\n\n/**\n * The width the nested `BlockPreviewCanvas` actually renders at.\n *\n * MUST come from the same helper the canvas uses, because the scale factor below\n * divides by it: a mismatch scales every row by the wrong amount, so a template\n * with a custom body width would overflow its frame or under-fill it. Rows are\n * always the desktop width — the save dialog has no viewport control.\n */\nconst previewWidth = computed(() =>\n getEmailFrameWidth(editor?.content.value.settings),\n);\n/**\n * Collapsed height for a tall block. A hero card or a multi-row section would\n * otherwise be taller than the whole list, leaving one row on screen — and\n * seeing the rows together is what makes them orderable. Anything taller\n * collapses to this, fades out at the cut, and can be expanded in place.\n */\nconst COLLAPSED_HEIGHT = 240;\n\nconst frameEl = ref<HTMLElement | null>(null);\nconst contentEl = ref<HTMLElement | null>(null);\nconst scale = ref(1);\n/** Scaled height of the whole block; `null` until first measured. */\nconst fullHeight = ref<number | null>(null);\nconst expanded = ref(false);\n\nlet observer: ResizeObserver | null = null;\n\n/** Only a block taller than the collapsed cap needs fading or expanding. */\nconst isClipped = computed(\n () => fullHeight.value !== null && fullHeight.value > COLLAPSED_HEIGHT,\n);\n\nconst frameHeight = computed(() => {\n if (fullHeight.value === null) return null;\n if (expanded.value || !isClipped.value) return fullHeight.value;\n return COLLAPSED_HEIGHT;\n});\n\nfunction measure(): void {\n const frame = frameEl.value;\n const content = contentEl.value;\n if (!frame || !content) return;\n const width = frame.clientWidth;\n if (width <= 0) return;\n // Never scale up: a dialog wider than the email would blow the preview past\n // its real proportions.\n const next = Math.min(1, width / previewWidth.value);\n scale.value = next;\n fullHeight.value = content.offsetHeight * next;\n}\n\nonMounted(() => {\n measure();\n // Absent in non-DOM test environments. Without it the frame simply falls back\n // to the untransformed height and clips — degraded, never broken.\n if (typeof ResizeObserver === \"undefined\") return;\n observer = new ResizeObserver(() => measure());\n if (frameEl.value) observer.observe(frameEl.value);\n if (contentEl.value) observer.observe(contentEl.value);\n});\n\nonBeforeUnmount(() => {\n observer?.disconnect();\n observer = null;\n});\n\nconst blockLabel = computed(() =>\n getBlockLabel(props.block, t, customBlockDefinitions),\n);\n\nconst handleLabel = computed(() =>\n format(t.savedBlocks.reorderHandle, {\n block: blockLabel.value,\n position: props.position,\n total: props.total,\n }),\n);\n\nconst toggleLabel = computed(() =>\n format(\n expanded.value\n ? t.savedBlocks.collapsePreview\n : t.savedBlocks.expandPreview,\n { block: blockLabel.value },\n ),\n);\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-reorder-row\"\n :data-block-id=\"block.id\"\n class=\"tpl:flex tpl:items-start tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:p-1.5 tpl:border-[var(--tpl-border)]\"\n style=\"background-color: var(--tpl-bg)\"\n >\n <!-- Sortable's `handle` selector points here, so a pointer-drag can only\n start from the grip — never from the preview itself. -->\n <button\n type=\"button\"\n data-testid=\"saved-blocks-reorder-handle\"\n class=\"tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"handleLabel\"\n :title=\"t.savedBlocks.reorderHint\"\n @keydown.up.prevent=\"emit('move', -1)\"\n @keydown.down.prevent=\"emit('move', 1)\"\n >\n <GripVertical :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n\n <div class=\"tpl:relative tpl:min-w-0 tpl:flex-1\">\n <div\n ref=\"frameEl\"\n class=\"tpl:overflow-hidden\"\n :style=\"{\n height: frameHeight !== null ? `${frameHeight}px` : undefined,\n }\"\n >\n <div\n ref=\"contentEl\"\n :style=\"{\n width: `${previewWidth}px`,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }\"\n >\n <BlockPreviewCanvas :blocks=\"[block]\" />\n </div>\n </div>\n\n <!-- Fade over the cut, so a clipped block reads as truncated rather than\n as a block that simply ends there. Pointer-transparent: it sits over\n the preview, and swallowing clicks would break the row. -->\n <div\n v-if=\"isClipped && !expanded\"\n data-testid=\"saved-blocks-preview-fade\"\n aria-hidden=\"true\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10\"\n style=\"\n background: linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n );\n \"\n />\n\n <button\n v-if=\"isClipped\"\n type=\"button\"\n data-testid=\"saved-blocks-preview-toggle\"\n class=\"tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"toggleLabel\"\n :aria-expanded=\"expanded\"\n @click=\"expanded = !expanded\"\n >\n <component\n :is=\"expanded ? ChevronUp : ChevronDown\"\n :size=\"11\"\n :stroke-width=\"2\"\n />\n {{ expanded ? t.savedBlocks.collapse : t.savedBlocks.expand }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n <datalist id=\"tpl-saved-block-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n </div>\n\n <!-- Summary of what the pick session chose. Which blocks were picked is\n settled on the canvas — the dialog re-presents them only so the user\n can see and order what they're about to save. -->\n <p\n data-testid=\"saved-blocks-save-summary\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ format(t.savedBlocks.savingCount, { count: pickedBlocks.length }) }}\n <span class=\"tpl:text-[var(--tpl-text-dim)]\">{{ summary }}</span>\n </p>\n\n <!-- Reorderable preview. Seeded in pick order and saved in whatever order\n the list ends up in. Its own Sortable instance with no `group`, so it\n can never exchange items with the canvas or a section column. -->\n <p\n v-if=\"pickedBlocks.length > 1\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n <datalist id=\"tpl-saved-block-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n </div>\n\n <!-- Summary of what the pick session chose. Which blocks were picked is\n settled on the canvas — the dialog re-presents them only so the user\n can see and order what they're about to save. -->\n <p\n data-testid=\"saved-blocks-save-summary\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ format(t.savedBlocks.savingCount, { count: pickedBlocks.length }) }}\n <span class=\"tpl:text-[var(--tpl-text-dim)]\">{{ summary }}</span>\n </p>\n\n <!-- Reorderable preview. Seeded in pick order and saved in whatever order\n the list ends up in. Its own Sortable instance with no `group`, so it\n can never exchange items with the canvas or a section column. -->\n <p\n v-if=\"pickedBlocks.length > 1\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedB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W,IAAK;MACf,OAAOrB,EAAA,MAAc;MACrB,SAAO,MAAUE,EAAUQ,EAAM,IAAIH,CAAK;;;;;;;;;IAK/CjI,EAOM,OAPNuG,IAOMtG,EADDmH,EAAA,KAAY,GAAA,CAAA;IAKTD,EAAA,SADRvH,EAAA,GAAAS,EAMI,KANJmG,IAMIvG,EADCkH,EAAA,KAAK,GAAA,CAAA,K;IAIVnH,EA8BM,OA9BNyG,IA8BM,CA7BJzG,EAUS,UAAA;KATP,MAAK;KACL,OAAKa,EAAA,CAAC,sOAAoO,EAE3K,yCAAAqG,EAAA,M;KAD9D,UAAUA,EAAA;KAIV,SAAOwB;IAEL,GAAAzI,EAAAC,EAAAmF,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,IAAAqB,EAAA,GAEzB1G,EAiBS,UAAA;KAhBP,MAAK;KACJ,OAAKa,EAAEX,EAAAmD,CAAA,CAAe;KACtB,UAAQ,CAAGkF,GAAA;KACX,SAAOC;I,IAEItB,EAAA,SAAZtH,EAAA,GAAAS,EAOO,QAPPuG,IAOO,CANLlG,EAIER,EAAA4C,CAAA,GAAA;KAHA,OAAM;KACL,MAAM;KACN,gBAAc;I,IACftC,EAAA,MACFP,EAAGC,EAAAmF,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,CAAA,C,OAEzBzF,EAAA,GAAAS,EAEO,QAAAwG,IAAA5G,EADFC,EAAAmF,CAAA,CAAC,CAAC,YAAY,IAAI,GAAA,CAAA,E"}
1
+ {"version":3,"file":"SaveBlockDialog-CXVwnfsy.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_openBlock","_createElementBlock","_createElementVNode","_unref","_withKeys","_withModifiers","_createVNode","_normalizeStyle","BlockPreviewCanvas","_createCommentVNode","_createBlock","_resolveDynamicComponent","_createTextVNode","_toDisplayString","_sfc_main","_openBlock","_createBlock","TplModal","_withCtx","_createElementVNode","_toDisplayString","_unref","_withDirectives","_vModelText","_createElementBlock","_Fragment","_renderList","_createTextVNode","_createCommentVNode","_createVNode","VueDraggable","SavedBlockPreviewRow","_normalizeClass","_sfc_main","resolveDynamicComponent","defineComponent","openBlock","withCtx","watch","withDirectives","renderList","onBeforeUnmount","onMounted","inject","createElementBlock","createTextVNode","withKeys","unref","normalizeClass","createCommentVNode","createBlock","withModifiers","createBaseVNode","toDisplayString","vModelText","computed","normalizeStyle","lo","ref","Fragment","createVNode","primaryBtnClass","BlockPreviewCanvas_default","useI18n","SAVED_BLOCKS_KEY","CUSTOM_BLOCK_DEFINITIONS_KEY","requireInject","EDITOR_KEY","getEmailFrameWidth","getBlockLabel","ChevronDown","ChevronUp","LoaderCircle","GripVertical","TplModal_default","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","\"background\"","_hoisted_5$1","COLLAPSED_HEIGHT","SavedBlockPreviewRow_default","__emit","props","__props","emit","customBlockDefinitions","editor","previewWidth","frameEl","contentEl","scale","fullHeight","expanded","observer","isClipped","frameHeight","measure","frame","content","width","next","blockLabel","t","handleLabel","format","toggleLabel","_cache","_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","SaveBlockDialog_default","savedBlocks","name","category","isSaving","error","announcement","orderedIds","pickedBlocks","byId","b","id","orderedBlocks","blocks","moveBlock","order","from","blockId","to","delta","moved","label","block","summary","visible","canSave","handleSave","err","handleClose","handleKeydown","event","$event","option","index"],"sources":["../../../src/components/SavedBlockPreviewRow.vue","../../../src/components/SavedBlockPreviewRow.vue","../../../src/components/SaveBlockDialog.vue","../../../src/components/SaveBlockDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * One reorderable row in the save dialog's preview list: a grip handle beside a\n * scaled-down render of the real block.\n *\n * The preview is the same `BlockPreviewCanvas` the browser modal uses, so\n * a row shows what the block actually looks like rather than a description of\n * it. That canvas is fixed at the 600px email width every block component\n * renders against, so the row shrinks it with `transform: scale()` instead of\n * re-flowing it at dialog width — a re-flow would show a layout the recipient\n * will never see.\n *\n * `transform` doesn't participate in layout, so the frame would keep reserving\n * the full unscaled height; a `ResizeObserver` mirrors the scaled height back\n * onto it. The handle is a sibling of the scaled subtree, so it stays full size\n * and keeps its real hit area.\n *\n * Row chrome uses the raw theme tokens, not the `--tpl-chrome-*` aliases: the\n * chrome is an ancestor and a sibling of the rendered email content, never a\n * descendant, so the `.tpl-block-content` token override can't reach it.\n */\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\nimport { useI18n } from \"../composables\";\nimport { CUSTOM_BLOCK_DEFINITIONS_KEY, EDITOR_KEY } from \"../keys\";\nimport { getEmailFrameWidth } from \"../utils/emailFrameWidth\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { ChevronDown, ChevronUp, GripVertical } from \"@lucide/vue\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nconst props = defineProps<{\n block: Block;\n /** 1-based position in the list — spoken by the handle's label. */\n position: number;\n total: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"move\", delta: -1 | 1): void;\n}>();\n\nconst { t, format } = useI18n();\n// Optional: absent when the consumer registers no custom blocks.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst editor = inject(EDITOR_KEY, null);\n\n/**\n * The width the nested `BlockPreviewCanvas` actually renders at.\n *\n * MUST come from the same helper the canvas uses, because the scale factor below\n * divides by it: a mismatch scales every row by the wrong amount, so a template\n * with a custom body width would overflow its frame or under-fill it. Rows are\n * always the desktop width — the save dialog has no viewport control.\n */\nconst previewWidth = computed(() =>\n getEmailFrameWidth(editor?.content.value.settings),\n);\n/**\n * Collapsed height for a tall block. A hero card or a multi-row section would\n * otherwise be taller than the whole list, leaving one row on screen — and\n * seeing the rows together is what makes them orderable. Anything taller\n * collapses to this, fades out at the cut, and can be expanded in place.\n */\nconst COLLAPSED_HEIGHT = 240;\n\nconst frameEl = ref<HTMLElement | null>(null);\nconst contentEl = ref<HTMLElement | null>(null);\nconst scale = ref(1);\n/** Scaled height of the whole block; `null` until first measured. */\nconst fullHeight = ref<number | null>(null);\nconst expanded = ref(false);\n\nlet observer: ResizeObserver | null = null;\n\n/** Only a block taller than the collapsed cap needs fading or expanding. */\nconst isClipped = computed(\n () => fullHeight.value !== null && fullHeight.value > COLLAPSED_HEIGHT,\n);\n\nconst frameHeight = computed(() => {\n if (fullHeight.value === null) return null;\n if (expanded.value || !isClipped.value) return fullHeight.value;\n return COLLAPSED_HEIGHT;\n});\n\nfunction measure(): void {\n const frame = frameEl.value;\n const content = contentEl.value;\n if (!frame || !content) return;\n const width = frame.clientWidth;\n if (width <= 0) return;\n // Never scale up: a dialog wider than the email would blow the preview past\n // its real proportions.\n const next = Math.min(1, width / previewWidth.value);\n scale.value = next;\n fullHeight.value = content.offsetHeight * next;\n}\n\nonMounted(() => {\n measure();\n // Absent in non-DOM test environments. Without it the frame simply falls back\n // to the untransformed height and clips — degraded, never broken.\n if (typeof ResizeObserver === \"undefined\") return;\n observer = new ResizeObserver(() => measure());\n if (frameEl.value) observer.observe(frameEl.value);\n if (contentEl.value) observer.observe(contentEl.value);\n});\n\nonBeforeUnmount(() => {\n observer?.disconnect();\n observer = null;\n});\n\nconst blockLabel = computed(() =>\n getBlockLabel(props.block, t, customBlockDefinitions),\n);\n\nconst handleLabel = computed(() =>\n format(t.savedBlocks.reorderHandle, {\n block: blockLabel.value,\n position: props.position,\n total: props.total,\n }),\n);\n\nconst toggleLabel = computed(() =>\n format(\n expanded.value\n ? t.savedBlocks.collapsePreview\n : t.savedBlocks.expandPreview,\n { block: blockLabel.value },\n ),\n);\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-reorder-row\"\n :data-block-id=\"block.id\"\n class=\"tpl:flex tpl:items-start tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:p-1.5 tpl:border-[var(--tpl-border)]\"\n style=\"background-color: var(--tpl-bg)\"\n >\n <!-- Sortable's `handle` selector points here, so a pointer-drag can only\n start from the grip — never from the preview itself. -->\n <button\n type=\"button\"\n data-testid=\"saved-blocks-reorder-handle\"\n class=\"tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"handleLabel\"\n :title=\"t.savedBlocks.reorderHint\"\n @keydown.up.prevent=\"emit('move', -1)\"\n @keydown.down.prevent=\"emit('move', 1)\"\n >\n <GripVertical :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n\n <div class=\"tpl:relative tpl:min-w-0 tpl:flex-1\">\n <div\n ref=\"frameEl\"\n class=\"tpl:overflow-hidden\"\n :style=\"{\n height: frameHeight !== null ? `${frameHeight}px` : undefined,\n }\"\n >\n <div\n ref=\"contentEl\"\n :style=\"{\n width: `${previewWidth}px`,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }\"\n >\n <BlockPreviewCanvas :blocks=\"[block]\" />\n </div>\n </div>\n\n <!-- Fade over the cut, so a clipped block reads as truncated rather than\n as a block that simply ends there. Pointer-transparent: it sits over\n the preview, and swallowing clicks would break the row. -->\n <div\n v-if=\"isClipped && !expanded\"\n data-testid=\"saved-blocks-preview-fade\"\n aria-hidden=\"true\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10\"\n style=\"\n background: linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n );\n \"\n />\n\n <button\n v-if=\"isClipped\"\n type=\"button\"\n data-testid=\"saved-blocks-preview-toggle\"\n class=\"tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"toggleLabel\"\n :aria-expanded=\"expanded\"\n @click=\"expanded = !expanded\"\n >\n <component\n :is=\"expanded ? ChevronUp : ChevronDown\"\n :size=\"11\"\n :stroke-width=\"2\"\n />\n {{ expanded ? t.savedBlocks.collapse : t.savedBlocks.expand }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * One reorderable row in the save dialog's preview list: a grip handle beside a\n * scaled-down render of the real block.\n *\n * The preview is the same `BlockPreviewCanvas` the browser modal uses, so\n * a row shows what the block actually looks like rather than a description of\n * it. That canvas is fixed at the 600px email width every block component\n * renders against, so the row shrinks it with `transform: scale()` instead of\n * re-flowing it at dialog width — a re-flow would show a layout the recipient\n * will never see.\n *\n * `transform` doesn't participate in layout, so the frame would keep reserving\n * the full unscaled height; a `ResizeObserver` mirrors the scaled height back\n * onto it. The handle is a sibling of the scaled subtree, so it stays full size\n * and keeps its real hit area.\n *\n * Row chrome uses the raw theme tokens, not the `--tpl-chrome-*` aliases: the\n * chrome is an ancestor and a sibling of the rendered email content, never a\n * descendant, so the `.tpl-block-content` token override can't reach it.\n */\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\nimport { useI18n } from \"../composables\";\nimport { CUSTOM_BLOCK_DEFINITIONS_KEY, EDITOR_KEY } from \"../keys\";\nimport { getEmailFrameWidth } from \"../utils/emailFrameWidth\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { ChevronDown, ChevronUp, GripVertical } from \"@lucide/vue\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, onBeforeUnmount, onMounted, ref } from \"vue\";\n\nconst props = defineProps<{\n block: Block;\n /** 1-based position in the list — spoken by the handle's label. */\n position: number;\n total: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"move\", delta: -1 | 1): void;\n}>();\n\nconst { t, format } = useI18n();\n// Optional: absent when the consumer registers no custom blocks.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst editor = inject(EDITOR_KEY, null);\n\n/**\n * The width the nested `BlockPreviewCanvas` actually renders at.\n *\n * MUST come from the same helper the canvas uses, because the scale factor below\n * divides by it: a mismatch scales every row by the wrong amount, so a template\n * with a custom body width would overflow its frame or under-fill it. Rows are\n * always the desktop width — the save dialog has no viewport control.\n */\nconst previewWidth = computed(() =>\n getEmailFrameWidth(editor?.content.value.settings),\n);\n/**\n * Collapsed height for a tall block. A hero card or a multi-row section would\n * otherwise be taller than the whole list, leaving one row on screen — and\n * seeing the rows together is what makes them orderable. Anything taller\n * collapses to this, fades out at the cut, and can be expanded in place.\n */\nconst COLLAPSED_HEIGHT = 240;\n\nconst frameEl = ref<HTMLElement | null>(null);\nconst contentEl = ref<HTMLElement | null>(null);\nconst scale = ref(1);\n/** Scaled height of the whole block; `null` until first measured. */\nconst fullHeight = ref<number | null>(null);\nconst expanded = ref(false);\n\nlet observer: ResizeObserver | null = null;\n\n/** Only a block taller than the collapsed cap needs fading or expanding. */\nconst isClipped = computed(\n () => fullHeight.value !== null && fullHeight.value > COLLAPSED_HEIGHT,\n);\n\nconst frameHeight = computed(() => {\n if (fullHeight.value === null) return null;\n if (expanded.value || !isClipped.value) return fullHeight.value;\n return COLLAPSED_HEIGHT;\n});\n\nfunction measure(): void {\n const frame = frameEl.value;\n const content = contentEl.value;\n if (!frame || !content) return;\n const width = frame.clientWidth;\n if (width <= 0) return;\n // Never scale up: a dialog wider than the email would blow the preview past\n // its real proportions.\n const next = Math.min(1, width / previewWidth.value);\n scale.value = next;\n fullHeight.value = content.offsetHeight * next;\n}\n\nonMounted(() => {\n measure();\n // Absent in non-DOM test environments. Without it the frame simply falls back\n // to the untransformed height and clips — degraded, never broken.\n if (typeof ResizeObserver === \"undefined\") return;\n observer = new ResizeObserver(() => measure());\n if (frameEl.value) observer.observe(frameEl.value);\n if (contentEl.value) observer.observe(contentEl.value);\n});\n\nonBeforeUnmount(() => {\n observer?.disconnect();\n observer = null;\n});\n\nconst blockLabel = computed(() =>\n getBlockLabel(props.block, t, customBlockDefinitions),\n);\n\nconst handleLabel = computed(() =>\n format(t.savedBlocks.reorderHandle, {\n block: blockLabel.value,\n position: props.position,\n total: props.total,\n }),\n);\n\nconst toggleLabel = computed(() =>\n format(\n expanded.value\n ? t.savedBlocks.collapsePreview\n : t.savedBlocks.expandPreview,\n { block: blockLabel.value },\n ),\n);\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-reorder-row\"\n :data-block-id=\"block.id\"\n class=\"tpl:flex tpl:items-start tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:p-1.5 tpl:border-[var(--tpl-border)]\"\n style=\"background-color: var(--tpl-bg)\"\n >\n <!-- Sortable's `handle` selector points here, so a pointer-drag can only\n start from the grip — never from the preview itself. -->\n <button\n type=\"button\"\n data-testid=\"saved-blocks-reorder-handle\"\n class=\"tpl-saved-block-reorder-handle tpl:mt-0.5 tpl:shrink-0 tpl:cursor-grab tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"handleLabel\"\n :title=\"t.savedBlocks.reorderHint\"\n @keydown.up.prevent=\"emit('move', -1)\"\n @keydown.down.prevent=\"emit('move', 1)\"\n >\n <GripVertical :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n\n <div class=\"tpl:relative tpl:min-w-0 tpl:flex-1\">\n <div\n ref=\"frameEl\"\n class=\"tpl:overflow-hidden\"\n :style=\"{\n height: frameHeight !== null ? `${frameHeight}px` : undefined,\n }\"\n >\n <div\n ref=\"contentEl\"\n :style=\"{\n width: `${previewWidth}px`,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }\"\n >\n <BlockPreviewCanvas :blocks=\"[block]\" />\n </div>\n </div>\n\n <!-- Fade over the cut, so a clipped block reads as truncated rather than\n as a block that simply ends there. Pointer-transparent: it sits over\n the preview, and swallowing clicks would break the row. -->\n <div\n v-if=\"isClipped && !expanded\"\n data-testid=\"saved-blocks-preview-fade\"\n aria-hidden=\"true\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:inset-x-0 tpl:bottom-0 tpl:h-10\"\n style=\"\n background: linear-gradient(\n to bottom,\n transparent,\n var(--tpl-bg) 90%\n );\n \"\n />\n\n <button\n v-if=\"isClipped\"\n type=\"button\"\n data-testid=\"saved-blocks-preview-toggle\"\n class=\"tpl:absolute tpl:bottom-1 tpl:right-1 tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-0.5 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:text-[var(--tpl-text-muted)]\"\n :aria-label=\"toggleLabel\"\n :aria-expanded=\"expanded\"\n @click=\"expanded = !expanded\"\n >\n <component\n :is=\"expanded ? ChevronUp : ChevronDown\"\n :size=\"11\"\n :stroke-width=\"2\"\n />\n {{ expanded ? t.savedBlocks.collapse : t.savedBlocks.expand }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n <datalist id=\"tpl-saved-block-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n </div>\n\n <!-- Summary of what the pick session chose. Which blocks were picked is\n settled on the canvas — the dialog re-presents them only so the user\n can see and order what they're about to save. -->\n <p\n data-testid=\"saved-blocks-save-summary\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ format(t.savedBlocks.savingCount, { count: pickedBlocks.length }) }}\n <span class=\"tpl:text-[var(--tpl-text-dim)]\">{{ summary }}</span>\n </p>\n\n <!-- Reorderable preview. Seeded in pick order and saved in whatever order\n the list ends up in. Its own Sortable instance with no `group`, so it\n can never exchange items with the canvas or a section column. -->\n <p\n v-if=\"pickedBlocks.length > 1\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n <datalist id=\"tpl-saved-block-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n </div>\n\n <!-- Summary of what the pick session chose. Which blocks were picked is\n settled on the canvas — the dialog re-presents them only so the user\n can see and order what they're about to save. -->\n <p\n data-testid=\"saved-blocks-save-summary\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ format(t.savedBlocks.savingCount, { count: pickedBlocks.length }) }}\n <span class=\"tpl:text-[var(--tpl-text-dim)]\">{{ summary }}</span>\n </p>\n\n <!-- Reorderable preview. Seeded in pick order and saved in whatever order\n the list ends up in. Its own Sortable instance with no `group`, so it\n can never exchange items with the canvas or a section column. -->\n <p\n v-if=\"pickedBlocks.length > 1\"\n class=\"tpl:mb-1.5 tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;A,wCAgEMsF,IAAmB,K;;;;;;;;;EAlCzB,IAAMG,IAAQC,GAORC,IAAOH,GAIP,EAAE,MAAG,cAAWpB,EAAQ,GAExBwB,IAAyB5C,EAAOsB,GAA8B,CAAC,CAAC,GAEhEuB,KAAS7C,EAAOwB,IAAY,IAAI,GAUhCsB,IAAelC,QACnBa,EAAmBoB,IAAQ,QAAQ,MAAM,QAAQ,CACnD,GASME,IAAUhC,EAAwB,IAAI,GACtCiC,IAAYjC,EAAwB,IAAI,GACxCkC,IAAQlC,EAAI,CAAC,GAEbmC,IAAanC,EAAmB,IAAI,GACpCoC,IAAWpC,EAAI,EAAK,GAEtBqC,IAAkC,MAGhCC,IAAYzC,QACVsC,EAAW,UAAU,QAAQA,EAAW,QAAQZ,CACxD,GAEMgB,IAAc1C,QACdsC,EAAW,UAAU,OAAa,OAClCC,EAAS,SAAS,CAACE,EAAU,QAAcH,EAAW,QACnDZ,CACR;EAED,SAASiB,IAAgB;GACvB,IAAMC,IAAQT,EAAQ,OAChBU,IAAUT,EAAU;GAC1B,IAAI,CAACQ,KAAS,CAACC,GAAS;GACxB,IAAM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EAAA,GAAAS,EAEO,QAAAwG,IAAA5G,EADFC,EAAAmF,CAAA,CAAC,CAAC,YAAY,IAAI,GAAA,CAAA,E"}
@@ -1,13 +1,13 @@
1
1
  import { B as e, C as t, F as n, G as r, H as i, K as a, L as o, O as s, S as ee, _ as c, a as l, c as u, ct as d, dt as f, g as p, h as te, j as m, l as h, m as g, mt as _, o as v, p as y, pt as ne, tt as b, u as x, x as S } from "./draggable-DepKdldn.js";
2
- import { G as re, M as ie, Y as C, f as ae, t as oe } from "./icons-DHExFLlT.js";
3
- import { X as se, it as ce, st as w, v as le } from "./keys-BUmIvYy3.js";
4
- import { t as ue } from "./useI18n-D8s7HtTn.js";
5
- import { b as de } from "./styleConstants-CgiNKdnc.js";
6
- import "./composables-CsfQlmcf.js";
7
- import { t as fe } from "./TplModal-d6fEZGJ5.js";
8
- import { t as pe } from "./formatAbsoluteDateTime-Ck2_zXra.js";
9
- import { t as T } from "./blockTypeIcons-CzYA5DF9.js";
10
- import { t as me } from "./formatRelativeTime-BTD8Ktt-.js";
2
+ import { b as re } from "./styleConstants-CgiNKdnc.js";
3
+ import { t as ie } from "./TplModal-DMe6J811.js";
4
+ import { t as ae } from "./useI18n-D8s7HtTn.js";
5
+ import "./composables-D3lsO7Io.js";
6
+ import { t as C } from "./blockTypeIcons-CzYA5DF9.js";
7
+ import { t as oe } from "./formatAbsoluteDateTime-Ck2_zXra.js";
8
+ import { t as se } from "./formatRelativeTime-BTD8Ktt-.js";
9
+ import { X as ce, it as le, st as w, v as ue } from "./keys-BUmIvYy3.js";
10
+ import { G as de, M as fe, Y as T, f as pe, t as me } from "./icons-DHExFLlT.js";
11
11
  // src/components/SavedBlocksBrowserModal.vue?vue&type=script&setup=true&lang.ts
12
12
  var he = {
13
13
  role: "dialog",
@@ -70,7 +70,7 @@ var he = {
70
70
  props: { visible: { type: Boolean } },
71
71
  emits: ["close", "insert"],
72
72
  setup(t, { emit: D }) {
73
- let dt = t, O = D, ft = ee(() => import("./BlockPreviewCanvas-B3HkuENF.js").then((e) => e.n)), { t: k, format: A } = ue(), j = w(se, "SavedBlocksBrowserModal"), M = w(le, "SavedBlocksBrowserModal"), pt = s(ce, void 0), N = b(""), P = b(""), F = b(null), I = b(null), L = b(null), R = b(""), z = b(""), B = b(null), V = b(null), H = b(null), U = b("end"), W = /* @__PURE__ */ new Map();
73
+ let dt = t, O = D, ft = ee(() => import("./BlockPreviewCanvas-CCSEzL46.js").then((e) => e.n)), { t: k, format: A } = ae(), j = w(ce, "SavedBlocksBrowserModal"), M = w(ue, "SavedBlocksBrowserModal"), pt = s(le, void 0), N = b(""), P = b(""), F = b(null), I = b(null), L = b(null), R = b(""), z = b(""), B = b(null), V = b(null), H = b(null), U = b("end"), W = /* @__PURE__ */ new Map();
74
74
  function mt(e, t) {
75
75
  t ? W.set(e, t) : W.delete(e);
76
76
  }
@@ -114,9 +114,9 @@ var he = {
114
114
  }, { immediate: !0 });
115
115
  function vt(e) {
116
116
  let t = [], n = /* @__PURE__ */ new Set();
117
- for (let r of e.content) if (!n.has(r.type) && T[r.type] && (n.add(r.type), t.push({
117
+ for (let r of e.content) if (!n.has(r.type) && C[r.type] && (n.add(r.type), t.push({
118
118
  type: r.type,
119
- icon: T[r.type]
119
+ icon: C[r.type]
120
120
  })), t.length >= 5) break;
121
121
  return t;
122
122
  }
@@ -126,11 +126,11 @@ var he = {
126
126
  }
127
127
  function X(e) {
128
128
  let t = e.updatedAt ?? e.createdAt;
129
- return t ? me(t, k.time, A) ?? "" : "";
129
+ return t ? se(t, k.time, A) ?? "" : "";
130
130
  }
131
131
  function yt(e) {
132
132
  let t = e.updatedAt ?? e.createdAt;
133
- return t ? pe(t, pt) : "";
133
+ return t ? oe(t, pt) : "";
134
134
  }
135
135
  async function bt(e) {
136
136
  I.value = e, await m(), H.value?.focus();
@@ -188,7 +188,7 @@ var he = {
188
188
  function Ot(e) {
189
189
  L.value || (e.key === "Escape" && $(), e.key === "Enter" && J.value && (e.preventDefault(), Dt()));
190
190
  }
191
- return (i, s) => (n(), te(fe, {
191
+ return (i, s) => (n(), te(ie, {
192
192
  visible: t.visible,
193
193
  onClose: $,
194
194
  onKeydown: Ot
@@ -198,12 +198,12 @@ var he = {
198
198
  "aria-label": d(k).savedBlocks.close,
199
199
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-1 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]",
200
200
  onClick: $
201
- }, [S(d(oe), {
201
+ }, [S(d(me), {
202
202
  size: 16,
203
203
  "stroke-width": 2
204
204
  })], 8, ve)]),
205
205
  g("div", ye, [g("div", be, [
206
- g("div", xe, [g("div", Se, [S(d(ie), {
206
+ g("div", xe, [g("div", Se, [S(d(fe), {
207
207
  size: 14,
208
208
  "stroke-width": 2,
209
209
  class: "tpl:pointer-events-none tpl:absolute tpl:left-3 tpl:top-1/2 tpl:-translate-y-1/2 tpl:text-[var(--tpl-text-dim)]"
@@ -306,7 +306,7 @@ var he = {
306
306
  "aria-label": d(k).savedBlocks.rename,
307
307
  title: d(k).savedBlocks.rename,
308
308
  onClick: h((e) => St(t), ["stop"])
309
- }, [S(d(re), {
309
+ }, [S(d(de), {
310
310
  size: 12,
311
311
  "stroke-width": 1.5
312
312
  })], 8, Ke)) : p("", !0), d(j).canDeleteBlock(t) ? (n(), c("button", {
@@ -315,16 +315,16 @@ var he = {
315
315
  "aria-label": d(k).savedBlocks.delete,
316
316
  title: d(k).savedBlocks.delete,
317
317
  onClick: h((e) => bt(t.id), ["stop"])
318
- }, [S(d(ae), {
318
+ }, [S(d(pe), {
319
319
  size: 12,
320
320
  "stroke-width": 1.5
321
321
  })], 10, qe)) : p("", !0)], 64))
322
- ])], 12, Fe))], 64))), 128))])) : (n(), c("div", Je, [S(d(C), {
322
+ ])], 12, Fe))], 64))), 128))])) : (n(), c("div", Je, [S(d(T), {
323
323
  size: 32,
324
324
  "stroke-width": 1,
325
325
  class: "tpl:text-[var(--tpl-text-dim)]"
326
326
  }), ht.value ? (n(), c("p", Ye, _(d(k).savedBlocks.noResults), 1)) : (n(), c(x, { key: 1 }, [g("p", Xe, _(d(k).savedBlocks.empty), 1), g("p", Ze, _(d(k).savedBlocks.emptyHint), 1)], 64))]))])
327
- ]), g("div", Qe, [J.value ? (n(), c("div", $e, [g("div", et, [S(d(ft), { blocks: J.value.content }, null, 8, ["blocks"])])])) : (n(), c("div", tt, [S(d(C), {
327
+ ]), g("div", Qe, [J.value ? (n(), c("div", $e, [g("div", et, [S(d(ft), { blocks: J.value.content }, null, 8, ["blocks"])])])) : (n(), c("div", tt, [S(d(T), {
328
328
  size: 32,
329
329
  "stroke-width": 1,
330
330
  class: "tpl:text-[var(--tpl-text-dim)]"
@@ -342,7 +342,7 @@ var he = {
342
342
  onClick: $
343
343
  }, _(d(k).savedBlocks.close), 1), g("button", {
344
344
  type: "button",
345
- class: f(d(de)),
345
+ class: f(d(re)),
346
346
  disabled: !J.value,
347
347
  onClick: Dt
348
348
  }, _(d(k).savedBlocks.insert), 11, ct)])])
@@ -353,4 +353,4 @@ var he = {
353
353
  });
354
354
  export { D as default };
355
355
 
356
- //# sourceMappingURL=SavedBlocksBrowserModal-BIaxaxw9.js.map
356
+ //# sourceMappingURL=SavedBlocksBrowserModal-BDTmenOE.js.map