@templatical/editor 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/{AiChatSidebar-BYMdVldY.js → AiChatSidebar-c-3yyjN1.js} +14 -14
  2. package/dist/{AiFeatureMenu-BhHhnu9G.js → AiFeatureMenu-B-COyG7k.js} +7 -7
  3. package/dist/{BlockIssueBadge-De36PJC4.js → BlockIssueBadge-Buk3_6QF.js} +5 -5
  4. package/dist/{BlockPreviewCanvas-BxSoA1QV.js → BlockPreviewCanvas-CJPHGI93.js} +3 -3
  5. package/dist/{CloudEditor-BXfuytQj.js → CloudEditor-BdSQ8hfv.js} +26 -26
  6. package/dist/{CollaboratorBar-D9AfWRTH.js → CollaboratorBar-mGoi6yye.js} +4 -4
  7. package/dist/{ColorPicker-VPq4ASC8.js → ColorPicker-ClETsjA3.js} +6 -6
  8. package/dist/{CommentsSidebar-C8BLy3Pr.js → CommentsSidebar-CdRCCSDD.js} +15 -15
  9. package/dist/{CountdownBlock-Bs2Q_bFX.js → CountdownBlock-DuyvGcr8.js} +3 -3
  10. package/dist/{CountdownToolbar-Cic6cdOw.js → CountdownToolbar-CBE9wRaV.js} +4 -4
  11. package/dist/{DesignReferenceSidebar-k-26nkJI.js → DesignReferenceSidebar-CgYkySre.js} +11 -11
  12. package/dist/{IssuesPanel-NPzwTPYW.js → IssuesPanel-Do7RLXsP.js} +8 -8
  13. package/dist/{LoadingTrack-DH3OEM3z.js → LoadingTrack-BexpNuTV.js} +1 -1
  14. package/dist/{MergeTagModeToggle-DEGyx8tw.js → MergeTagModeToggle-hAJgIKhw.js} +6 -6
  15. package/dist/{MergeTagSuggestion-DvisJ9im.js → MergeTagSuggestion-BJ43ihWR.js} +34 -32
  16. package/dist/{NumberWithSuffix-CuHCIwSn.js → NumberWithSuffix-D37ZWiZh.js} +2 -2
  17. package/dist/{ParagraphEditor-DK_IPi9H.js → ParagraphEditor-DBG63S70.js} +74 -80
  18. package/dist/{RichTextEditorContent-DznIQcdY.js → RichTextEditorContent-fbYJXAio.js} +8 -8
  19. package/dist/{SaveBlockDialog-R9PbMsy-.js → SaveBlockDialog-Dq9UVihi.js} +10 -10
  20. package/dist/{SavedBlocksBrowserModal-ttPAklPE.js → SavedBlocksBrowserModal-CtFG4zeV.js} +11 -11
  21. package/dist/{SavedBlocksPanels-BCwQgKLF.js → SavedBlocksPanels-DNVdso_W.js} +2 -2
  22. package/dist/{SavedBlocksPickBar-DD5Ddv9t.js → SavedBlocksPickBar-Cv4dIpP-.js} +4 -4
  23. package/dist/{SnapshotHistory-BXSTGgBh.js → SnapshotHistory-DsOtMHOV.js} +10 -10
  24. package/dist/{TemplateScoringPanel-Ue6Dfnjb.js → TemplateScoringPanel-BZUsb3FD.js} +15 -15
  25. package/dist/{TestEmailModal-KPFc5oSv.js → TestEmailModal-CIwqtGfr.js} +11 -11
  26. package/dist/{TestEmailPanel-b8GHTrnE.js → TestEmailPanel-l6LDmBGM.js} +2 -2
  27. package/dist/{TitleEditor-8ln7UBr_.js → TitleEditor-imoBUynh.js} +12 -12
  28. package/dist/{TplModal-D_FA3Wm3.js → TplModal-DDDHcoir.js} +5 -5
  29. package/dist/{blockTypeIcons-BoZeK6l7.js → blockTypeIcons-CfLN4A6t.js} +2 -2
  30. package/dist/bundle-stats.json +6 -6
  31. package/dist/cdn/chunks/{AiChatSidebar-D6jGwb4y.js → AiChatSidebar-BHqNxNcX.js} +35 -35
  32. package/dist/cdn/chunks/{AiChatSidebar-D6jGwb4y.js.map → AiChatSidebar-BHqNxNcX.js.map} +1 -1
  33. package/dist/cdn/chunks/{AiFeatureMenu-BtEcjxLL.js → AiFeatureMenu-D2AIDwEG.js} +13 -13
  34. package/dist/cdn/chunks/{AiFeatureMenu-BtEcjxLL.js.map → AiFeatureMenu-D2AIDwEG.js.map} +1 -1
  35. package/dist/cdn/chunks/{BlockIssueBadge-dnqZk6pl.js → BlockIssueBadge-BEEY9o2o.js} +5 -5
  36. package/dist/cdn/chunks/{BlockIssueBadge-dnqZk6pl.js.map → BlockIssueBadge-BEEY9o2o.js.map} +1 -1
  37. package/dist/cdn/chunks/{BlockPreviewCanvas-D8pfTFWi.js → BlockPreviewCanvas-DH5ULGkw.js} +22 -22
  38. package/dist/cdn/chunks/{BlockPreviewCanvas-D8pfTFWi.js.map → BlockPreviewCanvas-DH5ULGkw.js.map} +1 -1
  39. package/dist/cdn/chunks/{CloudEditor-BJ4-pPAl.js → CloudEditor-C0nB1JfD.js} +67 -67
  40. package/dist/cdn/chunks/{CloudEditor-BJ4-pPAl.js.map → CloudEditor-C0nB1JfD.js.map} +1 -1
  41. package/dist/cdn/chunks/{CollaboratorBar-SeUOuLeJ.js → CollaboratorBar-f6Ni7KNH.js} +12 -12
  42. package/dist/cdn/chunks/{CollaboratorBar-SeUOuLeJ.js.map → CollaboratorBar-f6Ni7KNH.js.map} +1 -1
  43. package/dist/cdn/chunks/{ColorPicker-yxvrro60.js → ColorPicker-W_UyiVGc.js} +131 -131
  44. package/dist/cdn/chunks/{ColorPicker-yxvrro60.js.map → ColorPicker-W_UyiVGc.js.map} +1 -1
  45. package/dist/cdn/chunks/{CommentsSidebar-FPbg-FuU.js → CommentsSidebar-BLRZRSSC.js} +112 -112
  46. package/dist/cdn/chunks/{CommentsSidebar-FPbg-FuU.js.map → CommentsSidebar-BLRZRSSC.js.map} +1 -1
  47. package/dist/cdn/chunks/{CountdownBlock-D2Oth7YY.js → CountdownBlock-vLTkTI9e.js} +11 -11
  48. package/dist/cdn/chunks/{CountdownBlock-D2Oth7YY.js.map → CountdownBlock-vLTkTI9e.js.map} +1 -1
  49. package/dist/cdn/chunks/{CountdownToolbar-BNgTBQGB.js → CountdownToolbar-DPjcgcVR.js} +41 -41
  50. package/dist/cdn/chunks/{CountdownToolbar-BNgTBQGB.js.map → CountdownToolbar-DPjcgcVR.js.map} +1 -1
  51. package/dist/cdn/chunks/{DesignReferenceSidebar-ChB_HBK1.js → DesignReferenceSidebar-DBoEBKxQ.js} +34 -34
  52. package/dist/cdn/chunks/{DesignReferenceSidebar-ChB_HBK1.js.map → DesignReferenceSidebar-DBoEBKxQ.js.map} +1 -1
  53. package/dist/cdn/chunks/{IssuesPanel-CjiZ8cLW.js → IssuesPanel-DKTS4QVb.js} +32 -32
  54. package/dist/cdn/chunks/{IssuesPanel-CjiZ8cLW.js.map → IssuesPanel-DKTS4QVb.js.map} +1 -1
  55. package/dist/cdn/chunks/{LoadingTrack-CiNg9s16.js → LoadingTrack-C52ZGL5q.js} +2 -2
  56. package/dist/cdn/chunks/{LoadingTrack-CiNg9s16.js.map → LoadingTrack-C52ZGL5q.js.map} +1 -1
  57. package/dist/cdn/chunks/{MergeTagModeToggle-CiYbOKzd.js → MergeTagModeToggle-D8iKvz7v.js} +28 -28
  58. package/dist/cdn/chunks/{MergeTagModeToggle-CiYbOKzd.js.map → MergeTagModeToggle-D8iKvz7v.js.map} +1 -1
  59. package/dist/cdn/chunks/{MergeTagSuggestion-CvZLI6Np.js → MergeTagSuggestion-Dn8dExNa.js} +18 -18
  60. package/dist/cdn/chunks/{MergeTagSuggestion-CvZLI6Np.js.map → MergeTagSuggestion-Dn8dExNa.js.map} +1 -1
  61. package/dist/cdn/chunks/{NumberWithSuffix-vVwCWrd_.js → NumberWithSuffix-BXrRdfq1.js} +22 -22
  62. package/dist/cdn/chunks/{NumberWithSuffix-vVwCWrd_.js.map → NumberWithSuffix-BXrRdfq1.js.map} +1 -1
  63. package/dist/cdn/chunks/{ParagraphEditor-o4hs9mgy.js → ParagraphEditor-Cuc83Blj.js} +58 -58
  64. package/dist/cdn/chunks/{ParagraphEditor-o4hs9mgy.js.map → ParagraphEditor-Cuc83Blj.js.map} +1 -1
  65. package/dist/cdn/chunks/{RichTextEditorContent-BAriGldd.js → RichTextEditorContent-DtL49Jpo.js} +20 -20
  66. package/dist/cdn/chunks/{RichTextEditorContent-BAriGldd.js.map → RichTextEditorContent-DtL49Jpo.js.map} +1 -1
  67. package/dist/cdn/chunks/{SaveBlockDialog-D3-oILb5.js → SaveBlockDialog-B8KHhVkI.js} +50 -50
  68. package/dist/cdn/chunks/{SaveBlockDialog-D3-oILb5.js.map → SaveBlockDialog-B8KHhVkI.js.map} +1 -1
  69. package/dist/cdn/chunks/{SavedBlocksBrowserModal-jMnNd4wn.js → SavedBlocksBrowserModal-B-sjsIJv.js} +62 -62
  70. package/dist/cdn/chunks/{SavedBlocksBrowserModal-jMnNd4wn.js.map → SavedBlocksBrowserModal-B-sjsIJv.js.map} +1 -1
  71. package/dist/cdn/chunks/{SavedBlocksPanels-BDd8FH6l.js → SavedBlocksPanels-Bb-eDMAh.js} +3 -3
  72. package/dist/cdn/chunks/{SavedBlocksPanels-BDd8FH6l.js.map → SavedBlocksPanels-Bb-eDMAh.js.map} +1 -1
  73. package/dist/cdn/chunks/{SavedBlocksPickBar-BNkLe8In.js → SavedBlocksPickBar-GudFfXa4.js} +12 -12
  74. package/dist/cdn/chunks/{SavedBlocksPickBar-BNkLe8In.js.map → SavedBlocksPickBar-GudFfXa4.js.map} +1 -1
  75. package/dist/cdn/chunks/{SnapshotHistory-CYVi7fvQ.js → SnapshotHistory-Srpzt2na.js} +26 -26
  76. package/dist/cdn/chunks/{SnapshotHistory-CYVi7fvQ.js.map → SnapshotHistory-Srpzt2na.js.map} +1 -1
  77. package/dist/cdn/chunks/{TemplateScoringPanel-D0KrxVnr.js → TemplateScoringPanel-NucRtAP0.js} +42 -42
  78. package/dist/cdn/chunks/{TemplateScoringPanel-D0KrxVnr.js.map → TemplateScoringPanel-NucRtAP0.js.map} +1 -1
  79. package/dist/cdn/chunks/{TestEmailModal-_RbTD787.js → TestEmailModal-DLeoJqaJ.js} +31 -31
  80. package/dist/cdn/chunks/{TestEmailModal-_RbTD787.js.map → TestEmailModal-DLeoJqaJ.js.map} +1 -1
  81. package/dist/cdn/chunks/{TestEmailPanel-BAnKtbSu.js → TestEmailPanel-Dr7Dkq2P.js} +3 -3
  82. package/dist/cdn/chunks/{TestEmailPanel-BAnKtbSu.js.map → TestEmailPanel-Dr7Dkq2P.js.map} +1 -1
  83. package/dist/cdn/chunks/{TitleEditor-LiUvXGPw.js → TitleEditor-DzYRr18C.js} +35 -35
  84. package/dist/cdn/chunks/{TitleEditor-LiUvXGPw.js.map → TitleEditor-DzYRr18C.js.map} +1 -1
  85. package/dist/cdn/chunks/{TplModal-C1iguuZz.js → TplModal-byw7-3wg.js} +17 -17
  86. package/dist/cdn/chunks/{TplModal-C1iguuZz.js.map → TplModal-byw7-3wg.js.map} +1 -1
  87. package/dist/cdn/chunks/blockTypeIcons-FXlMM3PL.js +21 -0
  88. package/dist/cdn/chunks/{blockTypeIcons-CrPzyP_k.js.map → blockTypeIcons-FXlMM3PL.js.map} +1 -1
  89. package/dist/cdn/chunks/{cloud-CxNsW3hp.js → cloud-CuItCnN_.js} +4 -4
  90. package/dist/cdn/chunks/{cloud-CxNsW3hp.js.map → cloud-CuItCnN_.js.map} +1 -1
  91. package/dist/cdn/chunks/{dist-BLF-S9_A.js → dist-B2HKGHnc.js} +9 -7
  92. package/dist/cdn/chunks/{dist-BLF-S9_A.js.map → dist-B2HKGHnc.js.map} +1 -1
  93. package/dist/cdn/chunks/{dist-Dp46rwVY.js → dist-C6z8AjBC.js} +2 -2
  94. package/dist/cdn/chunks/{dist-Dp46rwVY.js.map → dist-C6z8AjBC.js.map} +1 -1
  95. package/dist/cdn/chunks/{draggable-BRF_Q_jB.js → draggable-DCs9qL-b.js} +114 -92
  96. package/dist/cdn/chunks/{draggable-BRF_Q_jB.js.map → draggable-DCs9qL-b.js.map} +1 -1
  97. package/dist/cdn/chunks/{extensions-yNQlgLNE.js → extensions-B7laxHjs.js} +22 -22
  98. package/dist/cdn/chunks/{extensions-yNQlgLNE.js.map → extensions-B7laxHjs.js.map} +1 -1
  99. package/dist/cdn/chunks/{htmlparser-CPhs2cYE.js → htmlparser-DTML8Gvz.js} +8 -7
  100. package/dist/cdn/chunks/{htmlparser-CPhs2cYE.js.map → htmlparser-DTML8Gvz.js.map} +1 -1
  101. package/dist/cdn/chunks/{icons-DN008liP.js → icons-CvYN6zrM.js} +74 -80
  102. package/dist/cdn/chunks/icons-CvYN6zrM.js.map +1 -0
  103. package/dist/cdn/chunks/{keys-CZOBuCQd.js → keys-Cmc2Yl3D.js} +2 -2
  104. package/dist/cdn/chunks/{keys-CZOBuCQd.js.map → keys-Cmc2Yl3D.js.map} +1 -1
  105. package/dist/cdn/chunks/{liquid.browser-CZaQe87t.js → liquid.browser-UlAOKBjI.js} +120 -110
  106. package/dist/cdn/chunks/liquid.browser-UlAOKBjI.js.map +1 -0
  107. package/dist/cdn/chunks/{pusher-kUlkqMvR.js → pusher-BbIHJKf3.js} +29 -25
  108. package/dist/cdn/chunks/{pusher-kUlkqMvR.js.map → pusher-BbIHJKf3.js.map} +1 -1
  109. package/dist/cdn/chunks/{src-uc_Mb_yH.js → src-BYKYmEOD.js} +7 -6
  110. package/dist/cdn/chunks/src-BYKYmEOD.js.map +1 -0
  111. package/dist/cdn/chunks/{src-D_3bXt7-.js → src-Bi-Qhtfs.js} +3 -3
  112. package/dist/cdn/chunks/{src-D_3bXt7-.js.map → src-Bi-Qhtfs.js.map} +1 -1
  113. package/dist/cdn/chunks/{src-B2LpXMIw.js → src-C0N74uvF.js} +280 -277
  114. package/dist/cdn/chunks/{src-B2LpXMIw.js.map → src-C0N74uvF.js.map} +1 -1
  115. package/dist/cdn/chunks/{src-CZjSXPYq.js → src-EKTTBQ0y.js} +3 -2
  116. package/dist/cdn/chunks/src-EKTTBQ0y.js.map +1 -0
  117. package/dist/cdn/chunks/{styles-BzP13r-I.js → styles-C7s-VtJi.js} +1112 -1094
  118. package/dist/cdn/chunks/styles-C7s-VtJi.js.map +1 -0
  119. package/dist/cdn/chunks/{tiptap-CgwK_fKJ.js → tiptap-C44S1Cmh.js} +3681 -2965
  120. package/dist/cdn/chunks/tiptap-C44S1Cmh.js.map +1 -0
  121. package/dist/cdn/chunks/{useAliveFlag-Ctyt3GgH.js → useAliveFlag-Dxwgo6P4.js} +2 -2
  122. package/dist/cdn/chunks/{useAliveFlag-Ctyt3GgH.js.map → useAliveFlag-Dxwgo6P4.js.map} +1 -1
  123. package/dist/cdn/chunks/{useCloudI18n-CML0BxqX.js → useCloudI18n-8wkJtuJD.js} +3 -3
  124. package/dist/cdn/chunks/{useCloudI18n-CML0BxqX.js.map → useCloudI18n-8wkJtuJD.js.map} +1 -1
  125. package/dist/cdn/chunks/{useEditorCore-CTYH6u4r.js → useEditorCore-C_nUXiph.js} +275 -275
  126. package/dist/cdn/chunks/useEditorCore-C_nUXiph.js.map +1 -0
  127. package/dist/cdn/chunks/{useI18n-aRMtgYRj.js → useI18n-UMs0F71x.js} +3 -3
  128. package/dist/cdn/chunks/{useI18n-aRMtgYRj.js.map → useI18n-UMs0F71x.js.map} +1 -1
  129. package/dist/cdn/chunks/{useMergeTag-8a8BnIZp.js → useMergeTag-CPa_9VOq.js} +4 -4
  130. package/dist/cdn/chunks/{useMergeTag-8a8BnIZp.js.map → useMergeTag-CPa_9VOq.js.map} +1 -1
  131. package/dist/cdn/chunks/{usePopoverPosition-Dm1jv3y5.js → usePopoverPosition-cf8Y-ynK.js} +3 -3
  132. package/dist/cdn/chunks/{usePopoverPosition-Dm1jv3y5.js.map → usePopoverPosition-cf8Y-ynK.js.map} +1 -1
  133. package/dist/cdn/editor.js +47 -47
  134. package/dist/cdn/editor.js.map +1 -1
  135. package/dist/{check-Bqimqf7l.js → check-On4TSac-.js} +1 -1
  136. package/dist/{chevron-down-CYOoeGBd.js → chevron-down-69EiBGoB.js} +1 -1
  137. package/dist/{chevron-up-DYknsfm0.js → chevron-up-Dh3MG1Dw.js} +1 -1
  138. package/dist/{circle-alert-6q_jgtv_.js → circle-alert-cilwzafX.js} +1 -1
  139. package/dist/{clock-CnadSSTD.js → clock-Dt0APH92.js} +1 -1
  140. package/dist/{cloud-BJLg_SlM.js → cloud-C7-FhzMc.js} +2 -2
  141. package/dist/{createLucideIcon-D7GKhya2.js → createLucideIcon-C8WzBYCv.js} +3 -3
  142. package/dist/dist-6YJAWMuf.js +5 -0
  143. package/dist/dist-8vlm9kfO.js +5 -0
  144. package/dist/{dist-DSIgxp0v.js → dist-BImfm-46.js} +2 -2
  145. package/dist/{dist-DDfXShPv.js → dist-BpKxrUi2.js} +1 -1
  146. package/dist/{dist-B6Px6GPj.js → dist-C08jiemd.js} +7 -7
  147. package/dist/{dist-BxbTVeY0.js → dist-C27SeFL5.js} +15 -15
  148. package/dist/{dist-nR6mxyqI.js → dist-CYx-E82k.js} +2 -2
  149. package/dist/{dist-CcQFPJMF.js → dist-ChYLhoJ4.js} +2300 -1704
  150. package/dist/{dist-C31bMR4x.js → dist-Cl8J0IES.js} +270 -182
  151. package/dist/{dist-CQ0fVBQ3.js → dist-D5zCZFdU.js} +2 -1
  152. package/dist/{dist-Dx71pluS.js → dist-DMJRSouD.js} +470 -440
  153. package/dist/{dist-DyCHUyRR.js → dist-DfpeSdmE.js} +2 -2
  154. package/dist/{dist-DX4x6mQ1.js → dist-M7m1lYRe.js} +47 -47
  155. package/dist/{dist-CRH880TV.js → dist-g6cbzhZW.js} +2 -2
  156. package/dist/{extensions-CbiWtzS6.js → extensions-CxwhoG8v.js} +19 -19
  157. package/dist/{image-up-BfukboIn.js → image-up-Ceggh_R3.js} +1 -1
  158. package/dist/{info-DSYRzSZo.js → info-DO5odBcZ.js} +1 -1
  159. package/dist/{keys-BI6VSUh4.js → keys-fwF3qZax.js} +1 -1
  160. package/dist/{liquid.browser-BECWFL5Z.js → liquid.browser-B-rGrnrQ.js} +119 -109
  161. package/dist/{list-checks-URZOyLhr.js → list-checks-BSkPKbuI.js} +1 -1
  162. package/dist/{loader-circle-GADaYcyQ.js → loader-circle-bO7o7_HD.js} +1 -1
  163. package/dist/{message-circle-B62fdo0b.js → message-circle-BEkAk65X.js} +1 -1
  164. package/dist/{pencil-BGwkOpD_.js → pencil-t6m0EtKL.js} +1 -1
  165. package/dist/{refresh-cw-Z4wXfduO.js → refresh-cw-CkOYVzK5.js} +1 -1
  166. package/dist/{runtime-dom.esm-bundler-BkOsapVg.js → runtime-dom.esm-bundler-CepEmvwF.js} +13 -10
  167. package/dist/{scan-line-D8Oh5xos.js → scan-line-DwSVj25O.js} +1 -1
  168. package/dist/{send-BYp4k38T.js → send-CWsWN8PQ.js} +1 -1
  169. package/dist/{shield-check-Cm0RePnW.js → shield-check-qje8Kufw.js} +1 -1
  170. package/dist/{sparkles-BHEE-vRD.js → sparkles-DumaWRW-.js} +1 -1
  171. package/dist/{styles-B0MEBpOK.js → styles-C_slTGwp.js} +454 -436
  172. package/dist/templatical-editor.js +11 -11
  173. package/dist/{text-align-start-CHrg3vK8.js → text-align-start-Ir8Ah4mT.js} +1 -1
  174. package/dist/{trash-2-BoNT8wbq.js → trash-2-CklAFCmO.js} +1 -1
  175. package/dist/{triangle-alert-CiN0ssB3.js → triangle-alert-BBi4n93g.js} +1 -1
  176. package/dist/{upload-WvZGBySw.js → upload-sVqqppuv.js} +1 -1
  177. package/dist/{useAliveFlag-eT67QCMf.js → useAliveFlag-cvyBxHp7.js} +1 -1
  178. package/dist/{useCloudI18n-KgIWl-IE.js → useCloudI18n-DKVm6PCa.js} +2 -2
  179. package/dist/{useEditorCore-BMbxdUbY.js → useEditorCore-r4gWzCBA.js} +893 -893
  180. package/dist/{useI18n-BkHfCWC6.js → useI18n-DoVKdCTH.js} +2 -2
  181. package/dist/{useMergeTag-CZ4XYAxu.js → useMergeTag-C-_WxrgL.js} +3 -3
  182. package/dist/{usePopoverPosition-D93u-EZm.js → usePopoverPosition-C0dPEF4X.js} +3 -3
  183. package/dist/{vue.runtime.esm-bundler-0R1UhmZB.js → vue.runtime.esm-bundler-D1diBMsm.js} +119 -95
  184. package/dist/{x-B4WnJVRx.js → x-Mby7KlhS.js} +1 -1
  185. package/package.json +23 -23
  186. package/dist/cdn/chunks/blockTypeIcons-CrPzyP_k.js +0 -21
  187. package/dist/cdn/chunks/icons-DN008liP.js.map +0 -1
  188. package/dist/cdn/chunks/liquid.browser-CZaQe87t.js.map +0 -1
  189. package/dist/cdn/chunks/src-CZjSXPYq.js.map +0 -1
  190. package/dist/cdn/chunks/src-uc_Mb_yH.js.map +0 -1
  191. package/dist/cdn/chunks/styles-BzP13r-I.js.map +0 -1
  192. package/dist/cdn/chunks/tiptap-CgwK_fKJ.js.map +0 -1
  193. package/dist/cdn/chunks/useEditorCore-CTYH6u4r.js.map +0 -1
  194. package/dist/dist-CkPvZCld.js +0 -5
  195. package/dist/dist-iCEDH3cC.js +0 -5
@@ -1,11 +1,11 @@
1
- import { A as e, H as t, L as n, M as r, P as i, T as a, V as o, Z as s, c, ct as l, f as u, g as d, h as f, it as p, k as m, l as h, m as g, o as _, ot as v, p as y, st as b, t as x, u as S, v as C, x as w, y as T, z as E } from "./draggable-BRF_Q_jB.js";
2
- import { M as ee } from "./useEditorCore-CTYH6u4r.js";
3
- import { G as D, R as O, g as k, p as A } from "./keys-CZOBuCQd.js";
4
- import { t as te } from "./useI18n-aRMtgYRj.js";
5
- import { It as j, Nt as M, at as N, gt as P } from "./icons-DN008liP.js";
1
+ import { A as e, H as t, L as n, M as r, P as i, T as a, V as o, Z as s, c, ct as l, f as u, g as d, h as f, it as p, k as m, l as h, lt as g, m as _, o as v, p as y, st as b, t as x, u as S, v as C, x as w, y as T, z as E } from "./draggable-DCs9qL-b.js";
2
+ import { M as D } from "./useEditorCore-C_nUXiph.js";
3
+ import { G as O, R as k, g as A, p as ee } from "./keys-Cmc2Yl3D.js";
4
+ import { t as j } from "./useI18n-UMs0F71x.js";
5
+ import { It as M, Nt as te, ht as N, it as P } from "./icons-CvYN6zrM.js";
6
6
  import { n as F } from "./emailFrameWidth-BmFCN2dp.js";
7
- import { t as I } from "./TplModal-C1iguuZz.js";
8
- import { t as L } from "./BlockPreviewCanvas-D8pfTFWi.js";
7
+ import { t as I } from "./TplModal-byw7-3wg.js";
8
+ import { t as L } from "./BlockPreviewCanvas-DH5ULGkw.js";
9
9
  //#region src/components/SavedBlockPreviewRow.vue?vue&type=script&setup=true&lang.ts
10
10
  var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relative tpl:min-w-0 tpl:flex-1" }, V = {
11
11
  key: 0,
@@ -22,25 +22,25 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
22
22
  },
23
23
  emits: ["move"],
24
24
  setup(t, { emit: i }) {
25
- let o = t, _ = i, { t: v, format: x } = te(), S = a(A, []), w = a(k, null), E = u(() => F(w?.content.value.settings)), D = s(null), O = s(null), N = s(1), I = s(null), W = s(!1), G = null, K = u(() => I.value !== null && I.value > U), q = u(() => I.value === null ? null : W.value || !K.value ? I.value : U);
25
+ let o = t, v = i, { t: b, format: x } = j(), S = a(ee, []), w = a(A, null), E = u(() => F(w?.content.value.settings)), O = s(null), k = s(null), P = s(1), I = s(null), W = s(!1), G = null, K = u(() => I.value !== null && I.value > U), q = u(() => I.value === null ? null : W.value || !K.value ? I.value : U);
26
26
  function J() {
27
- let e = D.value, t = O.value;
27
+ let e = O.value, t = k.value;
28
28
  if (!e || !t) return;
29
29
  let n = e.clientWidth;
30
30
  if (n <= 0) return;
31
31
  let r = Math.min(1, n / E.value);
32
- N.value = r, I.value = t.offsetHeight * r;
32
+ P.value = r, I.value = t.offsetHeight * r;
33
33
  }
34
34
  e(() => {
35
- J(), !(typeof ResizeObserver > "u") && (G = new ResizeObserver(() => J()), D.value && G.observe(D.value), O.value && G.observe(O.value));
35
+ J(), !(typeof ResizeObserver > "u") && (G = new ResizeObserver(() => J()), O.value && G.observe(O.value), k.value && G.observe(k.value));
36
36
  }), m(() => {
37
37
  G?.disconnect(), G = null;
38
38
  });
39
- let Y = u(() => ee(o.block, v, S)), X = u(() => x(v.savedBlocks.reorderHandle, {
39
+ let Y = u(() => D(o.block, b, S)), X = u(() => x(b.savedBlocks.reorderHandle, {
40
40
  block: Y.value,
41
41
  position: o.position,
42
42
  total: o.total
43
- })), Z = u(() => x(W.value ? v.savedBlocks.collapsePreview : v.savedBlocks.expandPreview, { block: Y.value }));
43
+ })), Z = u(() => x(W.value ? b.savedBlocks.collapsePreview : b.savedBlocks.expandPreview, { block: Y.value }));
44
44
  return (e, i) => (r(), d("div", {
45
45
  "data-testid": "saved-blocks-reorder-row",
46
46
  "data-block-id": t.block.id,
@@ -51,23 +51,23 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
51
51
  "data-testid": "saved-blocks-reorder-handle",
52
52
  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)]",
53
53
  "aria-label": X.value,
54
- title: p(v).savedBlocks.reorderHint,
55
- onKeydown: [i[0] ||= c(h((e) => _("move", -1), ["prevent"]), ["up"]), i[1] ||= c(h((e) => _("move", 1), ["prevent"]), ["down"])]
56
- }, [T(p(P), {
54
+ title: p(b).savedBlocks.reorderHint,
55
+ onKeydown: [i[0] ||= c(h((e) => v("move", -1), ["prevent"]), ["up"]), i[1] ||= c(h((e) => v("move", 1), ["prevent"]), ["down"])]
56
+ }, [T(p(N), {
57
57
  size: 14,
58
58
  "stroke-width": 1.5
59
59
  })], 40, z), y("div", B, [
60
60
  y("div", {
61
61
  ref_key: "frameEl",
62
- ref: D,
62
+ ref: O,
63
63
  class: "tpl:overflow-hidden",
64
- style: b({ height: q.value === null ? void 0 : `${q.value}px` })
64
+ style: l({ height: q.value === null ? void 0 : `${q.value}px` })
65
65
  }, [y("div", {
66
66
  ref_key: "contentEl",
67
- ref: O,
68
- style: b({
67
+ ref: k,
68
+ style: l({
69
69
  width: `${E.value}px`,
70
- transform: `scale(${N.value})`,
70
+ transform: `scale(${P.value})`,
71
71
  transformOrigin: "top left"
72
72
  })
73
73
  }, [T(L, { blocks: [t.block] }, null, 8, ["blocks"])], 4)], 4),
@@ -80,10 +80,10 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
80
80
  "aria-label": Z.value,
81
81
  "aria-expanded": W.value,
82
82
  onClick: i[2] ||= (e) => W.value = !W.value
83
- }, [(r(), g(n(p(W.value ? M : j)), {
83
+ }, [(r(), _(n(p(W.value ? te : M)), {
84
84
  size: 11,
85
85
  "stroke-width": 2
86
- })), C(" " + l(W.value ? p(v).savedBlocks.collapse : p(v).savedBlocks.expand), 1)], 8, H)) : f("", !0)
86
+ })), C(" " + g(W.value ? p(b).savedBlocks.collapse : p(b).savedBlocks.expand), 1)], 8, H)) : f("", !0)
87
87
  ])], 8, R));
88
88
  }
89
89
  }), G = ["aria-busy"], K = {
@@ -118,7 +118,7 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
118
118
  },
119
119
  emits: ["close", "saved"],
120
120
  setup(e, { emit: n }) {
121
- let c = e, m = n, { t: h, format: b } = te(), w = D(k, "SaveBlockDialog"), j = D(O, "SaveBlockDialog"), M = a(A, []), P = s(""), F = s(""), L = s(!1), R = s(null), z = s(""), B = s([]), V = u(() => {
121
+ let c = e, l = n, { t: m, format: h } = j(), w = O(A, "SaveBlockDialog"), M = O(k, "SaveBlockDialog"), te = a(ee, []), N = s(""), F = s(""), L = s(!1), R = s(null), z = s(""), B = s([]), V = u(() => {
122
122
  let e = new Map(w.content.value.blocks.map((e) => [e.id, e]));
123
123
  return B.value.map((t) => e.get(t)).filter((e) => e !== void 0);
124
124
  }), H = u({
@@ -132,27 +132,27 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
132
132
  if (r === -1 || i < 0 || i >= n.length) return;
133
133
  [n[r], n[i]] = [n[i], n[r]], B.value = n;
134
134
  let a = V.value[i];
135
- z.value = a ? b(h.savedBlocks.reorderAnnouncement, {
135
+ z.value = a ? h(m.savedBlocks.reorderAnnouncement, {
136
136
  block: Q(a),
137
137
  position: i + 1,
138
138
  total: n.length
139
139
  }) : "";
140
140
  }
141
141
  function Q(e) {
142
- return ee(e, h, M);
142
+ return D(e, m, te);
143
143
  }
144
144
  let he = u(() => V.value.map(Q).join(", "));
145
145
  E(() => c.visible, (e) => {
146
- e && (P.value = "", F.value = "", R.value = null, z.value = "", B.value = [...c.pickedIds]);
146
+ e && (N.value = "", F.value = "", R.value = null, z.value = "", B.value = [...c.pickedIds]);
147
147
  }, { immediate: !0 });
148
- let ge = u(() => P.value.trim().length > 0 && V.value.length > 0 && !L.value);
148
+ let ge = u(() => N.value.trim().length > 0 && V.value.length > 0 && !L.value);
149
149
  async function _e() {
150
150
  if (!ge.value) return;
151
151
  let e = V.value;
152
152
  if (e.length !== 0) {
153
153
  L.value = !0, R.value = null;
154
154
  try {
155
- await j.create(P.value.trim(), e, F.value.trim() || void 0), m("saved"), m("close");
155
+ await M.create(N.value.trim(), e, F.value.trim() || void 0), l("saved"), l("close");
156
156
  } catch (e) {
157
157
  R.value = e.message;
158
158
  } finally {
@@ -161,12 +161,12 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
161
161
  }
162
162
  }
163
163
  function $() {
164
- L.value || m("close");
164
+ L.value || l("close");
165
165
  }
166
166
  function ve(e) {
167
167
  e.key === "Enter" && !e.shiftKey && (e.preventDefault(), _e()), e.key === "Escape" && $();
168
168
  }
169
- return (n, a) => (r(), g(I, {
169
+ return (n, a) => (r(), _(I, {
170
170
  visible: e.visible,
171
171
  onClose: $,
172
172
  onKeydown: ve
@@ -183,34 +183,34 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
183
183
  "max-height": "90vh"
184
184
  }
185
185
  }, [
186
- y("h3", K, l(p(h).savedBlocks.saveAsBlock), 1),
187
- y("div", q, [y("label", J, l(p(h).savedBlocks.name), 1), t(y("input", {
188
- "onUpdate:modelValue": a[0] ||= (e) => P.value = e,
186
+ y("h3", K, g(p(m).savedBlocks.saveAsBlock), 1),
187
+ y("div", q, [y("label", J, g(p(m).savedBlocks.name), 1), t(y("input", {
188
+ "onUpdate:modelValue": a[0] ||= (e) => N.value = e,
189
189
  type: "text",
190
190
  "data-testid": "saved-blocks-name-input",
191
- placeholder: p(h).savedBlocks.namePlaceholder,
191
+ placeholder: p(m).savedBlocks.namePlaceholder,
192
192
  class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
193
193
  disabled: L.value
194
- }, null, 8, Y), [[_, P.value]])]),
194
+ }, null, 8, Y), [[v, N.value]])]),
195
195
  y("div", X, [
196
- y("label", Z, l(p(h).savedBlocks.category), 1),
196
+ y("label", Z, g(p(m).savedBlocks.category), 1),
197
197
  t(y("input", {
198
198
  id: "tpl-save-block-category",
199
199
  "onUpdate:modelValue": a[1] ||= (e) => F.value = e,
200
200
  type: "text",
201
201
  "data-testid": "saved-blocks-category-input",
202
202
  list: "tpl-saved-block-categories",
203
- placeholder: p(h).savedBlocks.categoryPlaceholder,
203
+ placeholder: p(m).savedBlocks.categoryPlaceholder,
204
204
  class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
205
205
  disabled: L.value
206
- }, null, 8, ne), [[_, F.value]]),
207
- y("datalist", re, [(r(!0), d(S, null, i(p(j).categories.value, (e) => (r(), d("option", {
206
+ }, null, 8, ne), [[v, F.value]]),
207
+ y("datalist", re, [(r(!0), d(S, null, i(p(M).categories.value, (e) => (r(), d("option", {
208
208
  key: e,
209
209
  value: e
210
210
  }, null, 8, ie))), 128))])
211
211
  ]),
212
- y("p", ae, [C(l(p(b)(p(h).savedBlocks.savingCount, { count: V.value.length })) + " ", 1), y("span", oe, l(he.value), 1)]),
213
- V.value.length > 1 ? (r(), d("p", se, l(p(h).savedBlocks.reorderHint), 1)) : f("", !0),
212
+ y("p", ae, [C(g(p(h)(p(m).savedBlocks.savingCount, { count: V.value.length })) + " ", 1), y("span", oe, g(he.value), 1)]),
213
+ V.value.length > 1 ? (r(), d("p", se, g(p(m).savedBlocks.reorderHint), 1)) : f("", !0),
214
214
  T(p(x), {
215
215
  modelValue: H.value,
216
216
  "onUpdate:modelValue": a[2] ||= (e) => H.value = e,
@@ -222,7 +222,7 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
222
222
  "force-fallback": !0,
223
223
  class: "tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto"
224
224
  }, {
225
- default: o(() => [(r(!0), d(S, null, i(H.value, (e, t) => (r(), g(W, {
225
+ default: o(() => [(r(!0), d(S, null, i(H.value, (e, t) => (r(), _(W, {
226
226
  key: e.id,
227
227
  block: e,
228
228
  position: t + 1,
@@ -236,23 +236,23 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
236
236
  ]))), 128))]),
237
237
  _: 1
238
238
  }, 8, ["modelValue"]),
239
- y("div", ce, l(z.value), 1),
240
- R.value ? (r(), d("p", le, l(R.value), 1)) : f("", !0),
239
+ y("div", ce, g(z.value), 1),
240
+ R.value ? (r(), d("p", le, g(R.value), 1)) : f("", !0),
241
241
  y("div", ue, [y("button", {
242
242
  type: "button",
243
- class: v(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]", { "tpl:cursor-not-allowed tpl:opacity-50": L.value }]),
243
+ class: b(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]", { "tpl:cursor-not-allowed tpl:opacity-50": L.value }]),
244
244
  disabled: L.value,
245
245
  onClick: $
246
- }, l(p(h).savedBlocks.cancel), 11, de), y("button", {
246
+ }, g(p(m).savedBlocks.cancel), 11, de), y("button", {
247
247
  type: "button",
248
248
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
249
249
  disabled: !ge.value,
250
250
  onClick: _e
251
- }, [L.value ? (r(), d("span", pe, [T(p(N), {
251
+ }, [L.value ? (r(), d("span", pe, [T(p(P), {
252
252
  class: "tpl:animate-spin",
253
253
  size: 12,
254
254
  "stroke-width": 2
255
- }), C(" " + l(p(h).savedBlocks.saving), 1)])) : (r(), d("span", me, l(p(h).savedBlocks.save), 1))], 8, fe)])
255
+ }), C(" " + g(p(m).savedBlocks.saving), 1)])) : (r(), d("span", me, g(p(m).savedBlocks.save), 1))], 8, fe)])
256
256
  ], 8, G)]),
257
257
  _: 1
258
258
  }, 8, ["visible"]));
@@ -261,4 +261,4 @@ var R = ["data-block-id"], z = ["aria-label", "title"], B = { class: "tpl:relati
261
261
  //#endregion
262
262
  export { Q as default };
263
263
 
264
- //# sourceMappingURL=SaveBlockDialog-D3-oILb5.js.map
264
+ //# sourceMappingURL=SaveBlockDialog-B8KHhVkI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SaveBlockDialog-D3-oILb5.js","names":[],"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-md)] 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-md)] 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 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:mx-4 tpl:flex 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 max-height: 90vh;\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-xs tpl:outline-none 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-xs tpl:outline-none 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-[11px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's 90vh cap leaves\n after the fixed chrome, rather than a hand-tuned vh guess that a row\n expanding to full height would blow past. `min-h-0` is what lets a\n 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-xs tpl:transition-all tpl:duration-150 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=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\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 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:mx-4 tpl:flex 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 max-height: 90vh;\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-xs tpl:outline-none 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-xs tpl:outline-none 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-[11px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's 90vh cap leaves\n after the fixed chrome, rather than a hand-tuned vh guess that a row\n expanding to full height would blow past. `min-h-0` is what lets a\n 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-xs tpl:transition-all tpl:duration-150 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=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\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":";;;;;;;;;;;;;;;wCAgEM,IAAmB;;;;;;;;;EAlCzB,IAAM,IAAQ,GAOR,IAAO,GAIP,EAAE,MAAG,cAAW,GAAQ,GAExB,IAAyB,EAAO,GAA8B,CAAC,CAAC,GAEhE,IAAS,EAAO,GAAY,IAAI,GAUhC,IAAe,QACnB,EAAmB,GAAQ,QAAQ,MAAM,QAAQ,CACnD,GASM,IAAU,EAAwB,IAAI,GACtC,IAAY,EAAwB,IAAI,GACxC,IAAQ,EAAI,CAAC,GAEb,IAAa,EAAmB,IAAI,GACpC,IAAW,EAAI,EAAK,GAEtB,IAAkC,MAGhC,IAAY,QACV,EAAW,UAAU,QAAQ,EAAW,QAAQ,CACxD,GAEM,IAAc,QACd,EAAW,UAAU,OAAa,OAClC,EAAS,SAAS,CAAC,EAAU,QAAc,EAAW,QACnD,CACR;EAED,SAAS,IAAgB;GACvB,IAAM,IAAQ,EAAQ,OAChB,IAAU,EAAU;GAC1B,IAAI,CAAC,KAAS,CAAC,GAAS;GACxB,IAAM,IAAQ,EAAM;GACpB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AA;KACtB,eAAY;KACX,WAAW;KACZ,eAAY;KACZ,cAAW;KACX,QAAO;KACN,kBAAgB;KACjB,OAAM;;KAGJ,SAAA,QAAuC,EADzC,EAAA,EAAA,GAAA,EAOE,GAAA,MAAA,EANyB,EAAA,QAAjB,GAAO,OADjB,EAAA,GAAA,EAOE,GAAA;MALC,KAAK,EAAM;MACJ;MACP,UAAU,IAAK;MACf,OAAO,EAAA,MAAc;MACrB,SAAO,MAAU,EAAU,EAAM,IAAI,CAAK;;;;;;;;;IAK/C,EAOM,OAPN,IAOM,EADD,EAAA,KAAY,GAAA,CAAA;IAKT,EAAA,SADR,EAAA,GAAA,EAMI,KANJ,IAMI,EADC,EAAA,KAAK,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA;IAIV,EA8BM,OA9BN,IA8BM,CA7BJ,EAUS,UAAA;KATP,MAAK;KACL,OAAK,EAAA,CAAC,mOAAiO,EAExK,yCAAA,EAAA,MAAA,CAAA,CAAA;KAD9D,UAAU,EAAA;KAIV,SAAO;IAEL,GAAA,EAAA,EAAA,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,IAAA,EAAA,GAEzB,EAiBS,UAAA;KAhBP,MAAK;KACL,OAAM;KACL,UAAQ,CAAG,GAAA;KACX,SAAO;IAEI,GAAA,CAAA,EAAA,SAAZ,EAAA,GAAA,EAOO,QAPP,IAOO,CANL,EAIE,EAAA,CAAA,GAAA;KAHA,OAAM;KACL,MAAM;KACN,gBAAc;IACf,CAAA,GAAA,EAAA,MACF,EAAG,EAAA,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,CAAA,CAAA,CAAA,MAEzB,EAAA,GAAA,EAEO,QAAA,IAAA,EADF,EAAA,CAAA,CAAC,CAAC,YAAY,IAAI,GAAA,CAAA,EAAA,GAAA,GAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"SaveBlockDialog-B8KHhVkI.js","names":[],"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-md)] 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-md)] 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 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:mx-4 tpl:flex 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 max-height: 90vh;\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-xs tpl:outline-none 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-xs tpl:outline-none 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-[11px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's 90vh cap leaves\n after the fixed chrome, rather than a hand-tuned vh guess that a row\n expanding to full height would blow past. `min-h-0` is what lets a\n 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-xs tpl:transition-all tpl:duration-150 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=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\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 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:mx-4 tpl:flex 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 max-height: 90vh;\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-xs tpl:outline-none 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-xs tpl:outline-none 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-[11px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.reorderHint }}\n </p>\n <!-- The only growing region: takes whatever the dialog's 90vh cap leaves\n after the fixed chrome, rather than a hand-tuned vh guess that a row\n expanding to full height would blow past. `min-h-0` is what lets a\n 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-xs tpl:transition-all tpl:duration-150 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=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\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":";;;;;;;;;;;;;;;wCAgEM,IAAmB;;;;;;;;;EAlCzB,IAAM,IAAQ,GAOR,IAAO,GAIP,EAAE,MAAG,cAAW,EAAQ,GAExB,IAAyB,EAAO,IAA8B,CAAC,CAAC,GAEhE,IAAS,EAAO,GAAY,IAAI,GAUhC,IAAe,QACnB,EAAmB,GAAQ,QAAQ,MAAM,QAAQ,CACnD,GASM,IAAU,EAAwB,IAAI,GACtC,IAAY,EAAwB,IAAI,GACxC,IAAQ,EAAI,CAAC,GAEb,IAAa,EAAmB,IAAI,GACpC,IAAW,EAAI,EAAK,GAEtB,IAAkC,MAGhC,IAAY,QACV,EAAW,UAAU,QAAQ,EAAW,QAAQ,CACxD,GAEM,IAAc,QACd,EAAW,UAAU,OAAa,OAClC,EAAS,SAAS,CAAC,EAAU,QAAc,EAAW,QACnD,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