@templatical/editor 0.34.3 → 0.36.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 (290) hide show
  1. package/dist/{AiChatSidebar-CkHJ28sf.js → AiChatSidebar-tu4eLcf_.js} +78 -70
  2. package/dist/{AiFeatureMenu-DWdKguDN.js → AiFeatureMenu-BF0i0vA4.js} +17 -17
  3. package/dist/{BlockIssueBadge-DcyHTAqw.js → BlockIssueBadge-DT-FqKeC.js} +9 -9
  4. package/dist/BlockPreviewCanvas-DDCmMram.js +131 -0
  5. package/dist/CloudHeaderExtras-NPhudovT.js +59 -0
  6. package/dist/{CloudPanels-BGz9ygo6.js → CloudPanels-Iwnky0iA.js} +78 -108
  7. package/dist/CollaboratorBar-DAITu0hz.js +103 -0
  8. package/dist/{ColorPicker-C6EOwtHC.js → ColorPicker-BqlZ_TqG.js} +193 -193
  9. package/dist/{CommentsPanel-DmWh8f08.js → CommentsPanel-CDvgmWP1.js} +3 -3
  10. package/dist/{CommentsSidebar-CL_tffzT.js → CommentsSidebar-X_xqM3dR.js} +182 -173
  11. package/dist/{CountdownBlock-D1fsNsyS.js → CountdownBlock-ZFJIdbP6.js} +12 -12
  12. package/dist/{CountdownToolbar-B8J4i5Xp.js → CountdownToolbar-DBFoG3a6.js} +67 -67
  13. package/dist/{DesignReferenceSidebar-BDhEeaAh.js → DesignReferenceSidebar--QtXjLrw.js} +103 -95
  14. package/dist/{FieldRow-BWt7ECqo.js → FieldRow-C8nOknr_.js} +39 -39
  15. package/dist/IssuesPanel-BLbNFMSX.js +117 -0
  16. package/dist/{LoadingTrack-SQXoZVf2.js → LoadingTrack-BlTL4zFv.js} +2 -2
  17. package/dist/MediaPanels-CMTAhDXB.js +43 -0
  18. package/dist/{MergeTagInput-RytOlh1A.js → MergeTagInput-BEjzj4Iu.js} +153 -144
  19. package/dist/{MergeTagModeToggle-Bi-FydXj.js → MergeTagModeToggle-DKN6ihI5.js} +108 -96
  20. package/dist/{MergeTagSuggestion-CoCuzEmW.js → MergeTagSuggestion-DKoLEeoj.js} +21 -21
  21. package/dist/ParagraphEditor-1E9yzOfk.js +782 -0
  22. package/dist/{RestoreVersionDialog-Db5rZRMA.js → RestoreVersionDialog-BMGUkcd8.js} +28 -28
  23. package/dist/RichTextEditorContent-BnxbQUV9.js +154 -0
  24. package/dist/{SaveBlockDialog-CDCzx6Bo.js → SaveBlockDialog-WKASpCCT.js} +78 -78
  25. package/dist/SavedBlocksBrowserModal-AYEXTMtQ.js +323 -0
  26. package/dist/{SavedBlocksPanels-DFzV0CRD.js → SavedBlocksPanels-D_CpacTl.js} +6 -6
  27. package/dist/{SavedBlocksPickBar-XyXmnSnO.js → SavedBlocksPickBar-BHMwg-1G.js} +11 -11
  28. package/dist/TemplateScoringPanel-CSin43YM.js +267 -0
  29. package/dist/{TestEmailModal-DIfJy9eE.js → TestEmailModal-BxizsRCd.js} +59 -59
  30. package/dist/{TestEmailPanel-C8Wx5yPS.js → TestEmailPanel-vd2e5HzT.js} +3 -3
  31. package/dist/TitleEditor-CLJ68Ty4.js +199 -0
  32. package/dist/TplModal-Q9fDgS1M.js +51 -0
  33. package/dist/{VersionHistoryMenu-CV90OhXs.js → VersionHistoryMenu-eGYVhM4H.js} +48 -46
  34. package/dist/{VersionHistoryPanels-BE3pplJG.js → VersionHistoryPanels-C7Ntrrfq.js} +4 -4
  35. package/dist/{VersionPreviewBanner-BwUWBtlH.js → VersionPreviewBanner-BbQXnR0M.js} +9 -9
  36. package/dist/blockTypeIcons-5qD4bB76.js +163 -0
  37. package/dist/bundle-stats.json +8 -8
  38. package/dist/{ca-C0hfqt4U.js → ca-D9S-UCfZ.js} +2 -0
  39. package/dist/ca-Jx2CDwtn.js +83 -0
  40. package/dist/cdn/chunks/{AiChatSidebar-BEnIWn6s.js → AiChatSidebar-dyqqHAcI.js} +4 -4
  41. package/dist/cdn/chunks/{AiChatSidebar-BEnIWn6s.js.map → AiChatSidebar-dyqqHAcI.js.map} +1 -1
  42. package/dist/cdn/chunks/{AiFeatureMenu-DMl23akc.js → AiFeatureMenu-BjVMwhW8.js} +5 -5
  43. package/dist/cdn/chunks/{AiFeatureMenu-DMl23akc.js.map → AiFeatureMenu-BjVMwhW8.js.map} +1 -1
  44. package/dist/cdn/chunks/{BlockIssueBadge-CloK4k3M.js → BlockIssueBadge-BJ__oEtm.js} +4 -4
  45. package/dist/cdn/chunks/{BlockIssueBadge-CloK4k3M.js.map → BlockIssueBadge-BJ__oEtm.js.map} +1 -1
  46. package/dist/cdn/chunks/BlockPreviewCanvas-B5f26eLE.js +133 -0
  47. package/dist/cdn/chunks/BlockPreviewCanvas-B5f26eLE.js.map +1 -0
  48. package/dist/cdn/chunks/{CloudHeaderExtras-b4KpVeUN.js → CloudHeaderExtras-D5P5IEKA.js} +4 -4
  49. package/dist/cdn/chunks/{CloudHeaderExtras-b4KpVeUN.js.map → CloudHeaderExtras-D5P5IEKA.js.map} +1 -1
  50. package/dist/cdn/chunks/{CloudPanels-DzwOq9lp.js → CloudPanels-DkmR05nB.js} +15 -45
  51. package/dist/cdn/chunks/{CloudPanels-DzwOq9lp.js.map → CloudPanels-DkmR05nB.js.map} +1 -1
  52. package/dist/cdn/chunks/{CollaboratorBar-WXKvpoGK.js → CollaboratorBar-Yn7KSpt4.js} +4 -4
  53. package/dist/cdn/chunks/{CollaboratorBar-WXKvpoGK.js.map → CollaboratorBar-Yn7KSpt4.js.map} +1 -1
  54. package/dist/cdn/chunks/{ColorPicker-BubTDiS1.js → ColorPicker-LcrzgMoW.js} +7 -7
  55. package/dist/cdn/chunks/{ColorPicker-BubTDiS1.js.map → ColorPicker-LcrzgMoW.js.map} +1 -1
  56. package/dist/cdn/chunks/{CommentsPanel-DAA2VqX4.js → CommentsPanel-CntwwocI.js} +2 -2
  57. package/dist/cdn/chunks/{CommentsPanel-DAA2VqX4.js.map → CommentsPanel-CntwwocI.js.map} +1 -1
  58. package/dist/cdn/chunks/{CommentsSidebar-Ci0M2ePp.js → CommentsSidebar-BLDKnKy7.js} +4 -4
  59. package/dist/cdn/chunks/{CommentsSidebar-Ci0M2ePp.js.map → CommentsSidebar-BLDKnKy7.js.map} +1 -1
  60. package/dist/cdn/chunks/{CountdownBlock-rK055jpy.js → CountdownBlock-B4AfqJwb.js} +2 -2
  61. package/dist/cdn/chunks/{CountdownBlock-rK055jpy.js.map → CountdownBlock-B4AfqJwb.js.map} +1 -1
  62. package/dist/cdn/chunks/{CountdownToolbar-CzZq26Vp.js → CountdownToolbar-CA1dpuOI.js} +3 -3
  63. package/dist/cdn/chunks/{CountdownToolbar-CzZq26Vp.js.map → CountdownToolbar-CA1dpuOI.js.map} +1 -1
  64. package/dist/cdn/chunks/{DesignReferenceSidebar-C_ehdX5C.js → DesignReferenceSidebar-D1Y9Hswe.js} +5 -5
  65. package/dist/cdn/chunks/{DesignReferenceSidebar-C_ehdX5C.js.map → DesignReferenceSidebar-D1Y9Hswe.js.map} +1 -1
  66. package/dist/cdn/chunks/{IssuesPanel-BXAN2_al.js → IssuesPanel-Q62LTqvd.js} +5 -5
  67. package/dist/cdn/chunks/{IssuesPanel-BXAN2_al.js.map → IssuesPanel-Q62LTqvd.js.map} +1 -1
  68. package/dist/cdn/chunks/MediaPanels-D21M6shx.js +45 -0
  69. package/dist/cdn/chunks/MediaPanels-D21M6shx.js.map +1 -0
  70. package/dist/cdn/chunks/{MergeTagInput-1vcI9uQH.js → MergeTagInput-l7paaAml.js} +8 -8
  71. package/dist/cdn/chunks/{MergeTagInput-1vcI9uQH.js.map → MergeTagInput-l7paaAml.js.map} +1 -1
  72. package/dist/cdn/chunks/{MergeTagModeToggle-B_mUYJo4.js → MergeTagModeToggle-DYxkAGtA.js} +5 -5
  73. package/dist/cdn/chunks/{MergeTagModeToggle-B_mUYJo4.js.map → MergeTagModeToggle-DYxkAGtA.js.map} +1 -1
  74. package/dist/cdn/chunks/{ParagraphEditor-DCDHMcmx.js → ParagraphEditor-Bd-GQXee.js} +176 -172
  75. package/dist/cdn/chunks/{ParagraphEditor-DCDHMcmx.js.map → ParagraphEditor-Bd-GQXee.js.map} +1 -1
  76. package/dist/cdn/chunks/{RestoreVersionDialog-BkSSwf-Q.js → RestoreVersionDialog-2X9RpM9A.js} +4 -4
  77. package/dist/cdn/chunks/{RestoreVersionDialog-BkSSwf-Q.js.map → RestoreVersionDialog-2X9RpM9A.js.map} +1 -1
  78. package/dist/cdn/chunks/{RichTextEditorContent-S4KogjIj.js → RichTextEditorContent-D_rb0rmU.js} +8 -8
  79. package/dist/cdn/chunks/{RichTextEditorContent-S4KogjIj.js.map → RichTextEditorContent-D_rb0rmU.js.map} +1 -1
  80. package/dist/cdn/chunks/{SaveBlockDialog-BH774Nt0.js → SaveBlockDialog-CufdTomT.js} +15 -15
  81. package/dist/cdn/chunks/{SaveBlockDialog-BH774Nt0.js.map → SaveBlockDialog-CufdTomT.js.map} +1 -1
  82. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CSUqw_dD.js → SavedBlocksBrowserModal-CqpaNsk7.js} +8 -8
  83. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CSUqw_dD.js.map → SavedBlocksBrowserModal-CqpaNsk7.js.map} +1 -1
  84. package/dist/cdn/chunks/{SavedBlocksPanels-B6ApbCjG.js → SavedBlocksPanels-DpxYxddo.js} +2 -2
  85. package/dist/cdn/chunks/{SavedBlocksPanels-B6ApbCjG.js.map → SavedBlocksPanels-DpxYxddo.js.map} +1 -1
  86. package/dist/cdn/chunks/{SavedBlocksPickBar-C9MXSRcR.js → SavedBlocksPickBar-Drpoav1B.js} +4 -4
  87. package/dist/cdn/chunks/{SavedBlocksPickBar-C9MXSRcR.js.map → SavedBlocksPickBar-Drpoav1B.js.map} +1 -1
  88. package/dist/cdn/chunks/{TemplateScoringPanel-QVOxc9TZ.js → TemplateScoringPanel-DBjUNULq.js} +5 -5
  89. package/dist/cdn/chunks/{TemplateScoringPanel-QVOxc9TZ.js.map → TemplateScoringPanel-DBjUNULq.js.map} +1 -1
  90. package/dist/cdn/chunks/{TestEmailModal-_CZvaO58.js → TestEmailModal-BTNlSW6f.js} +11 -11
  91. package/dist/cdn/chunks/{TestEmailModal-_CZvaO58.js.map → TestEmailModal-BTNlSW6f.js.map} +1 -1
  92. package/dist/cdn/chunks/{TestEmailPanel-DXLxvyrD.js → TestEmailPanel-D0A9Zgxr.js} +2 -2
  93. package/dist/cdn/chunks/{TestEmailPanel-DXLxvyrD.js.map → TestEmailPanel-D0A9Zgxr.js.map} +1 -1
  94. package/dist/cdn/chunks/{TitleEditor-BuCOahW3.js → TitleEditor-CrnuIq62.js} +9 -9
  95. package/dist/cdn/chunks/{TitleEditor-BuCOahW3.js.map → TitleEditor-CrnuIq62.js.map} +1 -1
  96. package/dist/cdn/chunks/{TplModal-CqY8R3hn.js → TplModal-DYXrTz42.js} +5 -5
  97. package/dist/cdn/chunks/{TplModal-CqY8R3hn.js.map → TplModal-DYXrTz42.js.map} +1 -1
  98. package/dist/cdn/chunks/{VersionHistoryMenu-DDjIBvad.js → VersionHistoryMenu-bDGnE4hb.js} +6 -6
  99. package/dist/cdn/chunks/VersionHistoryMenu-bDGnE4hb.js.map +1 -0
  100. package/dist/cdn/chunks/{VersionHistoryPanels-BuTw04T5.js → VersionHistoryPanels-82P0Q0HM.js} +2 -2
  101. package/dist/cdn/chunks/{VersionHistoryPanels-BuTw04T5.js.map → VersionHistoryPanels-82P0Q0HM.js.map} +1 -1
  102. package/dist/cdn/chunks/{VersionPreviewBanner-fGAv20qI.js → VersionPreviewBanner-BJiwKkVC.js} +3 -3
  103. package/dist/cdn/chunks/{VersionPreviewBanner-fGAv20qI.js.map → VersionPreviewBanner-BJiwKkVC.js.map} +1 -1
  104. package/dist/cdn/chunks/{blockTypeIcons-ZEzEpCti.js → blockTypeIcons-CNjJSFun.js} +2 -2
  105. package/dist/cdn/chunks/{blockTypeIcons-ZEzEpCti.js.map → blockTypeIcons-CNjJSFun.js.map} +1 -1
  106. package/dist/cdn/chunks/{ca-C0hfqt4U.js → ca-D9S-UCfZ.js} +3 -1
  107. package/dist/cdn/chunks/{ca-C0hfqt4U.js.map → ca-D9S-UCfZ.js.map} +1 -1
  108. package/dist/cdn/chunks/{ca-CNRWAMHI.js → ca-Jx2CDwtn.js} +2 -6
  109. package/dist/cdn/chunks/ca-Jx2CDwtn.js.map +1 -0
  110. package/dist/cdn/chunks/{cloud-BP5-6__d.js → cloud-BLgCKP7Z.js} +453 -228
  111. package/dist/cdn/chunks/cloud-BLgCKP7Z.js.map +1 -0
  112. package/dist/cdn/chunks/createCloudRuntime-U-qCH-dq.js +385 -0
  113. package/dist/cdn/chunks/createCloudRuntime-U-qCH-dq.js.map +1 -0
  114. package/dist/{de-C6J2Iae8.js → cdn/chunks/de-BUPszLpi.js} +4 -0
  115. package/dist/cdn/chunks/{de-C6J2Iae8.js.map → de-BUPszLpi.js.map} +1 -1
  116. package/dist/cdn/chunks/{de-DFYCT4QU.js → de-Ck0pBGHu.js} +2 -6
  117. package/dist/cdn/chunks/de-Ck0pBGHu.js.map +1 -0
  118. package/dist/cdn/chunks/{src-Cxl-9O-L.js → editor-modal-MXgtarMl.js} +1473 -1934
  119. package/dist/cdn/chunks/editor-modal-MXgtarMl.js.map +1 -0
  120. package/dist/cdn/chunks/{en-BaUYOQi8.js → en-BbOC5x3w.js} +3 -1
  121. package/dist/cdn/chunks/en-BbOC5x3w.js.map +1 -0
  122. package/dist/cdn/chunks/en-C9U7N77n.js +2 -0
  123. package/dist/cdn/chunks/{es-CKDYfJYn.js → es-0bCDcT9p.js} +3 -1
  124. package/dist/cdn/chunks/{es-CKDYfJYn.js.map → es-0bCDcT9p.js.map} +1 -1
  125. package/dist/cdn/chunks/{es-OgkdMZGX.js → es-lagTvUfX.js} +2 -6
  126. package/dist/cdn/chunks/es-lagTvUfX.js.map +1 -0
  127. package/dist/cdn/chunks/{extensions-7z04EIGg.js → extensions-B8_jnIkD.js} +4 -4
  128. package/dist/cdn/chunks/{extensions-7z04EIGg.js.map → extensions-B8_jnIkD.js.map} +1 -1
  129. package/dist/{fr-L8DR73mK.js → cdn/chunks/fr-Brr8mJ9e.js} +4 -0
  130. package/dist/cdn/chunks/fr-Brr8mJ9e.js.map +1 -0
  131. package/dist/cdn/chunks/{fr-Dswns199.js → fr-C4hVl5Lk.js} +2 -6
  132. package/dist/cdn/chunks/fr-C4hVl5Lk.js.map +1 -0
  133. package/dist/cdn/chunks/icons-BUlqGSgd.js +1675 -0
  134. package/dist/cdn/chunks/icons-BUlqGSgd.js.map +1 -0
  135. package/dist/cdn/chunks/{keys-DQp8x7Nx.js → keys-DBFhDFng.js} +4 -4
  136. package/dist/cdn/chunks/{keys-DQp8x7Nx.js.map → keys-DBFhDFng.js.map} +1 -1
  137. package/dist/cdn/chunks/{nl-CbcPJlrL.js → nl-CReD7Apd.js} +2 -6
  138. package/dist/cdn/chunks/nl-CReD7Apd.js.map +1 -0
  139. package/dist/{nl-GDWeuX18.js → cdn/chunks/nl-Co3_RL0M.js} +4 -0
  140. package/dist/cdn/chunks/nl-Co3_RL0M.js.map +1 -0
  141. package/dist/cdn/chunks/{preRenderCustomBlocks-LFB-e-0m.js → preRenderCustomBlocks-Bdpiiw4A.js} +2 -2
  142. package/dist/cdn/chunks/{preRenderCustomBlocks-LFB-e-0m.js.map → preRenderCustomBlocks-Bdpiiw4A.js.map} +1 -1
  143. package/dist/cdn/chunks/{pt-BR-B1AVVhWj.js → pt-BR-BECez5b0.js} +3 -1
  144. package/dist/cdn/chunks/{pt-BR-B1AVVhWj.js.map → pt-BR-BECez5b0.js.map} +1 -1
  145. package/dist/cdn/chunks/{pt-BR-BibOQm-o.js → pt-BR-BRA0-vGP.js} +2 -6
  146. package/dist/cdn/chunks/pt-BR-BRA0-vGP.js.map +1 -0
  147. package/dist/cdn/chunks/{src-BM3f9I7t.js → src-CUvZWL6Y.js} +83 -83
  148. package/dist/cdn/chunks/src-CUvZWL6Y.js.map +1 -0
  149. package/dist/cdn/chunks/{src-BDvZrpFH.js → src-DZ0C9mH7.js} +161 -160
  150. package/dist/cdn/chunks/src-DZ0C9mH7.js.map +1 -0
  151. package/dist/cdn/chunks/{src-CLoCCDfs.js → src-Dwgq7hf4.js} +71 -48
  152. package/dist/cdn/chunks/src-Dwgq7hf4.js.map +1 -0
  153. package/dist/cdn/chunks/{useCloudI18n-MxgHWrV6.js → useCloudI18n-DSWSGj-A.js} +2 -2
  154. package/dist/cdn/chunks/{useCloudI18n-MxgHWrV6.js.map → useCloudI18n-DSWSGj-A.js.map} +1 -1
  155. package/dist/cdn/chunks/{useEditorCore-ehUSEsbw.js → useEditorCore-Cs7rYVBo.js} +614 -522
  156. package/dist/cdn/chunks/useEditorCore-Cs7rYVBo.js.map +1 -0
  157. package/dist/cdn/chunks/{useEditorRoot-CteADR3y.js → useEditorRoot-B0zW2nT4.js} +2 -2
  158. package/dist/cdn/chunks/{useEditorRoot-CteADR3y.js.map → useEditorRoot-B0zW2nT4.js.map} +1 -1
  159. package/dist/cdn/chunks/{useI18n-Ct1VIFcf.js → useI18n-Dlo7R9RA.js} +2 -2
  160. package/dist/cdn/chunks/{useI18n-Ct1VIFcf.js.map → useI18n-Dlo7R9RA.js.map} +1 -1
  161. package/dist/cdn/chunks/{useMergeTag-TLhF2fGK.js → useMergeTag-BYAifvh8.js} +4 -4
  162. package/dist/cdn/chunks/{useMergeTag-TLhF2fGK.js.map → useMergeTag-BYAifvh8.js.map} +1 -1
  163. package/dist/cdn/chunks/{usePopoverPosition-BxVWE5_0.js → usePopoverPosition-ElP3ABaV.js} +2 -2
  164. package/dist/cdn/chunks/{usePopoverPosition-BxVWE5_0.js.map → usePopoverPosition-ElP3ABaV.js.map} +1 -1
  165. package/dist/cdn/chunks/{useScrollToBlock-Cz3fpgTK.js → useScrollToBlock-nTbWkgaU.js} +2 -2
  166. package/dist/cdn/chunks/{useScrollToBlock-Cz3fpgTK.js.map → useScrollToBlock-nTbWkgaU.js.map} +1 -1
  167. package/dist/cdn/editor.css +1 -1
  168. package/dist/cdn/editor.js +1195 -1095
  169. package/dist/cdn/editor.js.map +1 -1
  170. package/dist/check-DWtkBzBU.js +11 -0
  171. package/dist/chevron-down-C-Fjxcqj.js +11 -0
  172. package/dist/chevron-right-SOkn2d4P.js +11 -0
  173. package/dist/chevron-up-lntU1ypp.js +11 -0
  174. package/dist/circle-alert-CjzUTwy3.js +30 -0
  175. package/dist/clock-pB2QKPsJ.js +16 -0
  176. package/dist/{cloud-BMzRKCbk.js → cloud-DdidMW6f.js} +446 -201
  177. package/dist/copy-CId1E038.js +19 -0
  178. package/dist/createCloudRuntime-x5WZm3p8.js +383 -0
  179. package/dist/createLucideIcon-Cwf_nTzE.js +96 -0
  180. package/dist/{cdn/chunks/de-C6J2Iae8.js → de-BUPszLpi.js} +2 -2
  181. package/dist/de-Ck0pBGHu.js +83 -0
  182. package/dist/{dist-BxFbxpgW.js → dist-BVqAYoRB.js} +125 -125
  183. package/dist/dist-D8i1ixHK.js +177 -0
  184. package/dist/dist-DBirAJIs.js +410 -0
  185. package/dist/{dist-PL6vP4SC.js → dist-tGkjkX-v.js} +143 -122
  186. package/dist/editor-modal-B_LaQf0s.js +5998 -0
  187. package/dist/{en-BaUYOQi8.js → en-BbOC5x3w.js} +2 -0
  188. package/dist/en-DcmpWV53.js +2 -0
  189. package/dist/{es-CKDYfJYn.js → es-0bCDcT9p.js} +2 -0
  190. package/dist/es-lagTvUfX.js +83 -0
  191. package/dist/{extensions-Mf8iHey9.js → extensions-CHOBZRab.js} +43 -43
  192. package/dist/eye-BuGtFUoJ.js +16 -0
  193. package/dist/{cdn/chunks/fr-L8DR73mK.js → fr-Brr8mJ9e.js} +2 -2
  194. package/dist/fr-C4hVl5Lk.js +83 -0
  195. package/dist/image-up-gH4JEpU5.js +27 -0
  196. package/dist/index.d.ts +77 -11
  197. package/dist/info-BQ60P82u.js +23 -0
  198. package/dist/{keys-C3P1yxnr.js → keys-DQA2i1k1.js} +4 -4
  199. package/dist/link-3R8it3J7.js +14 -0
  200. package/dist/list-Ccdgj46T.js +33 -0
  201. package/dist/loader-circle-B_tAD4k6.js +12 -0
  202. package/dist/message-circle-P-KSc6V0.js +11 -0
  203. package/dist/nl-CReD7Apd.js +83 -0
  204. package/dist/{cdn/chunks/nl-GDWeuX18.js → nl-Co3_RL0M.js} +2 -2
  205. package/dist/pencil-9ZiwqS4r.js +14 -0
  206. package/dist/plus-BwJEzCaO.js +14 -0
  207. package/dist/{preRenderCustomBlocks-CSIF-HyJ.js → preRenderCustomBlocks-DFXH54Zr.js} +1 -1
  208. package/dist/{pt-BR-B1AVVhWj.js → pt-BR-BECez5b0.js} +2 -0
  209. package/dist/pt-BR-BRA0-vGP.js +83 -0
  210. package/dist/refresh-cw-DEgfb2FK.js +25 -0
  211. package/dist/{runtime-dom.esm-bundler-BuG03jBM.js → runtime-dom.esm-bundler-PnoZU512.js} +106 -106
  212. package/dist/search-DqQ8Li5E.js +16 -0
  213. package/dist/send-CE6uvqop.js +14 -0
  214. package/dist/shield-check-DhD1Z3rd.js +14 -0
  215. package/dist/sparkles-R0ZQHa6F.js +28 -0
  216. package/dist/style.css +1 -1
  217. package/dist/templatical-editor.js +2742 -2590
  218. package/dist/text-align-start-DSux2UNn.js +58 -0
  219. package/dist/trash-Cf_SqsER.js +30 -0
  220. package/dist/triangle-alert-C6tGa6jw.js +22 -0
  221. package/dist/upload-DusKjpVr.js +21 -0
  222. package/dist/{useAliveFlag-PVmp95MT.js → useAliveFlag-oyByIcjy.js} +1 -1
  223. package/dist/{useCloudI18n-BKoiYsWZ.js → useCloudI18n-BLyh_e2T.js} +2 -2
  224. package/dist/{useEditorCore-DdkQuTHl.js → useEditorCore-DhlKOYwe.js} +1780 -1651
  225. package/dist/{useEditorRoot-DkRGTQRs.js → useEditorRoot-ds57-l6F.js} +2 -2
  226. package/dist/{useI18n-CL6RfPzK.js → useI18n-BbdxxpOE.js} +2 -2
  227. package/dist/{useMergeTag-gSuYus-M.js → useMergeTag-DlvOBW_B.js} +4 -4
  228. package/dist/{usePopoverPosition-CWxaIWd3.js → usePopoverPosition-CprM5p-c.js} +2 -2
  229. package/dist/useScrollToBlock-BTFw0b9O.js +48 -0
  230. package/dist/{vue.runtime.esm-bundler-D9JUcKrV.js → vue.runtime.esm-bundler-DShF3P6k.js} +1192 -1181
  231. package/dist/x-D_-42Ukq.js +14 -0
  232. package/package.json +9 -12
  233. package/dist/BlockPreviewCanvas-B621ANn9.js +0 -129
  234. package/dist/CloudHeaderExtras-BJ3Cebhv.js +0 -59
  235. package/dist/CollaboratorBar-KphmSQeZ.js +0 -95
  236. package/dist/IssuesPanel-CiOjeRFI.js +0 -109
  237. package/dist/ParagraphEditor-C87tkmtE.js +0 -767
  238. package/dist/RichTextEditorContent-BmTcV2-a.js +0 -152
  239. package/dist/SavedBlocksBrowserModal-DQR6kJB1.js +0 -322
  240. package/dist/TemplateScoringPanel-CpyEKMzC.js +0 -257
  241. package/dist/TitleEditor-iNFOisr4.js +0 -198
  242. package/dist/TplModal-CowM3o_F.js +0 -51
  243. package/dist/blockTypeIcons-DQsKtHik.js +0 -134
  244. package/dist/cdn/chunks/BlockPreviewCanvas-DSiJFJa0.js +0 -131
  245. package/dist/cdn/chunks/BlockPreviewCanvas-DSiJFJa0.js.map +0 -1
  246. package/dist/cdn/chunks/VersionHistoryMenu-DDjIBvad.js.map +0 -1
  247. package/dist/cdn/chunks/ca-CNRWAMHI.js.map +0 -1
  248. package/dist/cdn/chunks/cloud-BP5-6__d.js.map +0 -1
  249. package/dist/cdn/chunks/createCloudRuntime-JFE-sxbT.js +0 -443
  250. package/dist/cdn/chunks/createCloudRuntime-JFE-sxbT.js.map +0 -1
  251. package/dist/cdn/chunks/de-DFYCT4QU.js.map +0 -1
  252. package/dist/cdn/chunks/en-BaUYOQi8.js.map +0 -1
  253. package/dist/cdn/chunks/en-mEKGL1PX.js +0 -2
  254. package/dist/cdn/chunks/es-OgkdMZGX.js.map +0 -1
  255. package/dist/cdn/chunks/fr-Dswns199.js.map +0 -1
  256. package/dist/cdn/chunks/fr-L8DR73mK.js.map +0 -1
  257. package/dist/cdn/chunks/icons-SP5Itd-A.js +0 -1218
  258. package/dist/cdn/chunks/icons-SP5Itd-A.js.map +0 -1
  259. package/dist/cdn/chunks/nl-CbcPJlrL.js.map +0 -1
  260. package/dist/cdn/chunks/nl-GDWeuX18.js.map +0 -1
  261. package/dist/cdn/chunks/pt-BR-BibOQm-o.js.map +0 -1
  262. package/dist/cdn/chunks/src-BDvZrpFH.js.map +0 -1
  263. package/dist/cdn/chunks/src-BM3f9I7t.js.map +0 -1
  264. package/dist/cdn/chunks/src-CLoCCDfs.js.map +0 -1
  265. package/dist/cdn/chunks/src-Cxl-9O-L.js.map +0 -1
  266. package/dist/cdn/chunks/useEditorCore-ehUSEsbw.js.map +0 -1
  267. package/dist/check-JK8Uacq0.js +0 -7
  268. package/dist/chevron-down-a-fb_Ijn.js +0 -7
  269. package/dist/chevron-up-x4l0et_Y.js +0 -7
  270. package/dist/circle-alert-CJDW5LZo.js +0 -25
  271. package/dist/clock-BW6rXk2f.js +0 -12
  272. package/dist/createCloudRuntime-DbTFm1ES.js +0 -441
  273. package/dist/createLucideIcon-Bvw1Zx56.js +0 -43
  274. package/dist/dist-dNiknO7j.js +0 -251
  275. package/dist/dist-heatwAdo.js +0 -150
  276. package/dist/image-up-CuzFc1mu.js +0 -23
  277. package/dist/info-DybAwcA3.js +0 -19
  278. package/dist/loader-circle-t-SVgmJ3.js +0 -7
  279. package/dist/message-circle-DtwKrlhN.js +0 -7
  280. package/dist/pencil-2qhC-Y4q.js +0 -10
  281. package/dist/refresh-cw-C8SBuPdg.js +0 -29
  282. package/dist/send-BoqJliF6.js +0 -10
  283. package/dist/shield-check-D0dMaHtE.js +0 -10
  284. package/dist/sparkles-Dy2BJjiX.js +0 -23
  285. package/dist/text-align-start-DrxjxvIy.js +0 -43
  286. package/dist/trash-rYMzzHZd.js +0 -25
  287. package/dist/triangle-alert-DxnFj4-B.js +0 -17
  288. package/dist/upload-DZu1adQz.js +0 -17
  289. package/dist/useScrollToBlock-CdI8fGqt.js +0 -44
  290. package/dist/x-DJOd1hS4.js +0 -10
@@ -1,12 +1,12 @@
1
1
  import { A as e, B as t, E as n, F as r, H as i, N as a, Q as o, R as s, S as c, U as l, at as u, b as d, c as f, ct as p, f as m, g as h, h as g, j as _, l as v, lt as y, m as b, o as x, p as S, t as ee, u as C, ut as w, y as T } from "./draggable-kbOhCgnk.js";
2
- import { z as te } from "./useEditorCore-ehUSEsbw.js";
3
- import { J as E, f as D, h as O, z as k } from "./keys-DQp8x7Nx.js";
4
- import { t as A } from "./useI18n-Ct1VIFcf.js";
5
- import { It as j, Nt as M, ht as N, it as P } from "./icons-SP5Itd-A.js";
2
+ import { z as E } from "./useEditorCore-Cs7rYVBo.js";
3
+ import { B as D, Y as O, g as k, p as A } from "./keys-DBFhDFng.js";
4
+ import { t as te } from "./useI18n-Dlo7R9RA.js";
5
+ import { It as j, Nt as M, ht as N, it as P } from "./icons-BUlqGSgd.js";
6
6
  import { v as F } from "./styleConstants-C_YAPdQS.js";
7
7
  import { n as I } from "./emailFrameWidth-BmFCN2dp.js";
8
- import { t as L } from "./TplModal-CqY8R3hn.js";
9
- import { t as R } from "./BlockPreviewCanvas-DSiJFJa0.js";
8
+ import { t as L } from "./TplModal-DYXrTz42.js";
9
+ import { t as R } from "./BlockPreviewCanvas-B5f26eLE.js";
10
10
  //#region src/components/SavedBlockPreviewRow.vue?vue&type=script&setup=true&lang.ts
11
11
  var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relative tpl:min-w-0 tpl:flex-1" }, H = {
12
12
  key: 0,
@@ -23,9 +23,9 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
23
23
  },
24
24
  emits: ["move"],
25
25
  setup(t, { emit: r }) {
26
- let i = t, c = r, { t: l, format: p } = A(), x = n(D, []), ee = n(O, null), C = m(() => I(ee?.content.value.settings)), E = o(null), k = o(null), P = o(1), F = o(null), L = o(!1), G = null, K = m(() => F.value !== null && F.value > W), q = m(() => F.value === null ? null : L.value || !K.value ? F.value : W);
26
+ let i = t, c = r, { t: l, format: p } = te(), x = n(A, []), ee = n(k, null), C = m(() => I(ee?.content.value.settings)), D = o(null), O = o(null), P = o(1), F = o(null), L = o(!1), G = null, K = m(() => F.value !== null && F.value > W), q = m(() => F.value === null ? null : L.value || !K.value ? F.value : W);
27
27
  function J() {
28
- let e = E.value, t = k.value;
28
+ let e = D.value, t = O.value;
29
29
  if (!e || !t) return;
30
30
  let n = e.clientWidth;
31
31
  if (n <= 0) return;
@@ -33,11 +33,11 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
33
33
  P.value = r, F.value = t.offsetHeight * r;
34
34
  }
35
35
  _(() => {
36
- J(), !(typeof ResizeObserver > "u") && (G = new ResizeObserver(() => J()), E.value && G.observe(E.value), k.value && G.observe(k.value));
36
+ J(), !(typeof ResizeObserver > "u") && (G = new ResizeObserver(() => J()), D.value && G.observe(D.value), O.value && G.observe(O.value));
37
37
  }), e(() => {
38
38
  G?.disconnect(), G = null;
39
39
  });
40
- let Y = m(() => te(i.block, l, x)), X = m(() => p(l.savedBlocks.reorderHandle, {
40
+ let Y = m(() => E(i.block, l, x)), X = m(() => p(l.savedBlocks.reorderHandle, {
41
41
  block: Y.value,
42
42
  position: i.position,
43
43
  total: i.total
@@ -60,12 +60,12 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
60
60
  })], 40, B), S("div", V, [
61
61
  S("div", {
62
62
  ref_key: "frameEl",
63
- ref: E,
63
+ ref: D,
64
64
  class: "tpl:overflow-hidden",
65
65
  style: y({ height: q.value === null ? void 0 : `${q.value}px` })
66
66
  }, [S("div", {
67
67
  ref_key: "contentEl",
68
- ref: k,
68
+ ref: O,
69
69
  style: y({
70
70
  width: `${C.value}px`,
71
71
  transform: `scale(${P.value})`,
@@ -119,7 +119,7 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
119
119
  },
120
120
  emits: ["close", "saved"],
121
121
  setup(e, { emit: s }) {
122
- let c = e, f = s, { t: _, format: v } = A(), y = E(O, "SaveBlockDialog"), j = E(k, "SaveBlockDialog"), M = n(D, []), N = o(""), I = o(""), R = o(!1), z = o(null), B = o(""), V = o([]), H = m(() => {
122
+ let c = e, f = s, { t: _, format: v } = te(), y = O(k, "SaveBlockDialog"), j = O(D, "SaveBlockDialog"), M = n(A, []), N = o(""), I = o(""), R = o(!1), z = o(null), B = o(""), V = o([]), H = m(() => {
123
123
  let e = new Map(y.content.value.blocks.map((e) => [e.id, e]));
124
124
  return V.value.map((t) => e.get(t)).filter((e) => e !== void 0);
125
125
  }), U = m({
@@ -140,7 +140,7 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
140
140
  }) : "";
141
141
  }
142
142
  function Q(e) {
143
- return te(e, _, M);
143
+ return E(e, _, M);
144
144
  }
145
145
  let ge = m(() => H.value.map(Q).join(", "));
146
146
  t(() => c.visible, (e) => {
@@ -261,4 +261,4 @@ var z = ["data-block-id"], B = ["aria-label", "title"], V = { class: "tpl:relati
261
261
  //#endregion
262
262
  export { Q as default };
263
263
 
264
- //# sourceMappingURL=SaveBlockDialog-BH774Nt0.js.map
264
+ //# sourceMappingURL=SaveBlockDialog-CufdTomT.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SaveBlockDialog-BH774Nt0.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 { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl: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 backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl: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 backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;wCAgEM,IAAmB;;;;;;;;;EAlCzB,IAAM,IAAQ,GAOR,IAAO,GAIP,EAAE,MAAG,cAAW,EAAQ,GAExB,IAAyB,EAAO,GAA8B,CAAC,CAAC,GAEhE,KAAS,EAAO,GAAY,IAAI,GAUhC,IAAe,QACnB,EAAmB,IAAQ,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,IAAI,KAAS,GAAG;GAGhB,IAAM,IAAO,KAAK,IAAI,GAAG,IAAQ,EAAa,KAAK;GAEnD,AADA,EAAM,QAAQ,GACd,EAAW,QAAQ,EAAQ,eAAe;EAC5C;EAYA,AAVA,QAAgB;GACd,EAAQ,GAGJ,SAAO,iBAAmB,SAC9B,IAAW,IAAI,qBAAqB,EAAQ,CAAC,GACzC,EAAQ,SAAO,EAAS,QAAQ,EAAQ,KAAK,GAC7C,EAAU,SAAO,EAAS,QAAQ,EAAU,KAAK;EACvD,CAAC,GAED,QAAsB;GAEpB,AADA,GAAU,WAAW,GACrB,IAAW;EACb,CAAC;EAED,IAAM,IAAa,Q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,EAAA,KAAK,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA;IAIV,EA8BM,OA9BN,IA8BM,CA7BJ,EAUS,UAAA;KATP,MAAK;KACL,OAAK,EAAA,CAAC,sOAAoO,EAE3K,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;KACJ,OAAK,EAAE,EAAA,CAAA,CAAe;KACtB,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,IAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"SaveBlockDialog-CufdTomT.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 { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl: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 backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span v-else>\n {{ t.savedBlocks.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport SavedBlockPreviewRow from \"./SavedBlockPreviewRow.vue\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport {\n CUSTOM_BLOCK_DEFINITIONS_KEY,\n EDITOR_KEY,\n SAVED_BLOCKS_KEY,\n requireInject,\n} from \"../keys\";\nimport { getBlockLabel } from \"../utils/blockTypeLabels\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { VueDraggable } from \"vue-draggable-plus\";\nimport type { Block } from \"@templatical/types\";\nimport { computed, inject, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n /**\n * Blocks chosen during the canvas pick session, in the order they were\n * picked — `pickedIds` is built from a `Set`, which iterates in insertion\n * order. That order seeds the reorderable list below. Every id must be a\n * top-level block, which is what the session guarantees.\n */\n pickedIds: readonly string[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t, format } = useI18n();\nconst editor = requireInject(EDITOR_KEY, \"SaveBlockDialog\");\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SaveBlockDialog\");\n// Optional: a consumer with no custom blocks never provides definitions, and\n// the label helper degrades to the type slug rather than throwing.\nconst customBlockDefinitions = inject(CUSTOM_BLOCK_DEFINITIONS_KEY, []);\n\nconst name = ref(\"\");\nconst category = ref(\"\");\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\nconst announcement = ref(\"\");\n\n/**\n * The order the blocks will be saved in: seeded from the pick order, then owned\n * by this dialog once the user drags a row.\n *\n * Ids rather than blocks, deliberately. Resolving late means a block edited\n * while the dialog is open (a collaborator in Cloud) is persisted as it stands\n * at save time, not as it looked when the dialog opened, and an id that stops\n * resolving drops out on its own instead of leaving a stale snapshot behind.\n */\nconst orderedIds = ref<string[]>([]);\n\n/**\n * The picked blocks in the list's current order. Ids that no longer resolve (a\n * block deleted mid-session) simply drop out.\n */\nconst pickedBlocks = computed(() => {\n const byId = new Map(editor.content.value.blocks.map((b) => [b.id, b]));\n return orderedIds.value\n .map((id) => byId.get(id))\n .filter((b): b is Block => b !== undefined);\n});\n\n/**\n * Sortable's model. The setter reads ids straight back off the emitted entries\n * rather than storing them, so a Sortable `el` expando can never reach the\n * payload `create()` sends to the provider — and because the getter is already\n * filtered, writing through it prunes unresolvable ids too.\n */\nconst orderedBlocks = computed<Block[]>({\n get: () => pickedBlocks.value,\n set: (blocks) => {\n orderedIds.value = blocks.map((b) => b.id);\n },\n});\n\n/** Keyboard reorder from a focused grip: swap with the neighbouring row. */\nfunction moveBlock(blockId: string, delta: -1 | 1): void {\n const order = pickedBlocks.value.map((b) => b.id);\n const from = order.indexOf(blockId);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= order.length) return;\n [order[from], order[to]] = [order[to], order[from]];\n orderedIds.value = order;\n\n const moved = pickedBlocks.value[to];\n announcement.value = moved\n ? format(t.savedBlocks.reorderAnnouncement, {\n block: label(moved),\n position: to + 1,\n total: order.length,\n })\n : \"\";\n}\n\n/** Custom blocks read as the consumer's name for them, not the type `custom`. */\nfunction label(block: Block): string {\n return getBlockLabel(block, t, customBlockDefinitions);\n}\n\n/** e.g. \"Title, Paragraph, Button\" — what the user is about to save. */\nconst summary = computed(() => pickedBlocks.value.map(label).join(\", \"));\n\n// `immediate` matters: the dialog is mounted lazily behind a `v-if` on the\n// same state that drives `visible`, so it can mount with `visible` already\n// true and would otherwise never reset the name field or seed the order.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n name.value = \"\";\n category.value = \"\";\n error.value = null;\n announcement.value = \"\";\n orderedIds.value = [...props.pickedIds];\n }\n },\n { immediate: true },\n);\n\nconst canSave = computed(\n () =>\n name.value.trim().length > 0 &&\n pickedBlocks.value.length > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n const blocks = pickedBlocks.value;\n // Defence in depth: never persist an empty saved block (it would list as\n // \"0 block(s)\" and insert nothing). Guards a pick set whose ids no longer\n // resolve to anything on the canvas.\n if (blocks.length === 0) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n // Empty stays undefined rather than \"\": an entry is either categorised or\n // it isn't, and a blank string would show up as a nameless filter option.\n await savedBlocks.create(\n name.value.trim(),\n blocks,\n category.value.trim() || undefined,\n );\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-block-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-2xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-block-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.saveAsBlock }}\n </h3>\n\n <!-- Saved block name -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.name }}\n </label>\n <input\n v-model=\"name\"\n type=\"text\"\n data-testid=\"saved-blocks-name-input\"\n :placeholder=\"t.savedBlocks.namePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Category: free text, with the already-used categories offered as\n suggestions. A datalist rather than a <select> because the set is\n derived from existing entries — there is no registry to pick from,\n and the first entry in a category has to be able to name it. -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-save-block-category\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.savedBlocks.category }}\n </label>\n <input\n id=\"tpl-save-block-category\"\n v-model=\"category\"\n type=\"text\"\n data-testid=\"saved-blocks-category-input\"\n list=\"tpl-saved-block-categories\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl: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 backdrop cap\n leaves after the fixed chrome, rather than a hand-tuned vh guess that\n a row expanding to full height would blow past. `min-h-0` is what\n lets a flex child actually shrink below its content and scroll. -->\n <VueDraggable\n v-model=\"orderedBlocks\"\n data-testid=\"saved-blocks-reorder-list\"\n :animation=\"150\"\n ghost-class=\"tpl-ghost\"\n drag-class=\"tpl-dragging\"\n handle=\".tpl-saved-block-reorder-handle\"\n :force-fallback=\"true\"\n class=\"tpl:mb-4 tpl:flex tpl:min-h-0 tpl:flex-1 tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto\"\n >\n <SavedBlockPreviewRow\n v-for=\"(block, index) in orderedBlocks\"\n :key=\"block.id\"\n :block=\"block\"\n :position=\"index + 1\"\n :total=\"orderedBlocks.length\"\n @move=\"(delta) => moveBlock(block.id, delta)\"\n />\n </VueDraggable>\n\n <!-- Keyboard reorder announcement region (visually hidden, live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {{ announcement }}\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.savedBlocks.saving }}\n </span>\n <span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UAAA;KATP,MAAK;KACL,OAAK,EAAA,CAAC,sOAAoO,EAE3K,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;KACJ,OAAK,EAAE,EAAA,CAAA,CAAe;KACtB,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,IAAA,EAAA,CAAA,CAAA"}
@@ -1,13 +1,13 @@
1
1
  import { B as e, E as t, F as n, H as r, N as i, Q as a, R as ee, S as o, U as s, a as c, at as l, b as u, c as d, ct as f, f as p, g as m, h, k as te, l as g, lt as ne, m as _, o as v, p as y, u as b, ut as x, x as re } from "./draggable-kbOhCgnk.js";
2
- import "./useEditorCore-ehUSEsbw.js";
3
- import { G as ie, J as S, h as ae, z as oe } from "./keys-DQp8x7Nx.js";
4
- import { t as se } from "./useI18n-Ct1VIFcf.js";
5
- import { K as ce, N as le, Y as C, d as ue, n as de } from "./icons-SP5Itd-A.js";
2
+ import "./useEditorCore-Cs7rYVBo.js";
3
+ import { B as ie, K as ae, Y as S, g as oe } from "./keys-DBFhDFng.js";
4
+ import { t as se } from "./useI18n-Dlo7R9RA.js";
5
+ import { K as ce, N as le, Y as C, d as ue, n as de } from "./icons-BUlqGSgd.js";
6
6
  import { v as fe } from "./styleConstants-C_YAPdQS.js";
7
- import { t as w } from "./blockTypeIcons-ZEzEpCti.js";
7
+ import { t as w } from "./blockTypeIcons-CNjJSFun.js";
8
8
  import { t as pe } from "./formatAbsoluteDateTime-DMmop3C-.js";
9
9
  import { t as me } from "./formatRelativeTime-CtUU-QZ8.js";
10
- import { t as he } from "./TplModal-CqY8R3hn.js";
10
+ import { t as he } from "./TplModal-DYXrTz42.js";
11
11
  //#region src/components/SavedBlocksBrowserModal.vue?vue&type=script&setup=true&lang.ts
12
12
  var ge = {
13
13
  role: "dialog",
@@ -63,7 +63,7 @@ var ge = {
63
63
  props: { visible: { type: Boolean } },
64
64
  emits: ["close", "insert"],
65
65
  setup(o, { emit: A }) {
66
- let it = o, j = A, at = re(() => import("./BlockPreviewCanvas-DSiJFJa0.js").then((e) => e.n)), { t: M, format: N } = se(), P = S(oe, "SavedBlocksBrowserModal"), F = S(ae, "SavedBlocksBrowserModal"), ot = t(ie, void 0), I = a(""), L = a(""), R = a(null), z = a(null), B = a(null), V = a(""), H = a(""), U = a(null), W = a("end"), G = p(() => {
66
+ let it = o, j = A, at = re(() => import("./BlockPreviewCanvas-B5f26eLE.js").then((e) => e.n)), { t: M, format: N } = se(), P = S(ie, "SavedBlocksBrowserModal"), F = S(oe, "SavedBlocksBrowserModal"), ot = t(ae, void 0), I = a(""), L = a(""), R = a(null), z = a(null), B = a(null), V = a(""), H = a(""), U = a(null), W = a("end"), G = p(() => {
67
67
  let e = I.value.trim().toLowerCase(), t = L.value;
68
68
  return P.savedBlocks.value.filter((n) => !(e && !n.name.toLowerCase().includes(e) || t && n.category !== t));
69
69
  }), K = p(() => P.isLoading.value && P.savedBlocks.value.length === 0), st = p(() => I.value.trim().length > 0 || L.value !== ""), q = p(() => R.value ? P.savedBlocks.value.find((e) => e.id === R.value) ?? null : null), ct = p(() => {
@@ -318,4 +318,4 @@ var ge = {
318
318
  //#endregion
319
319
  export { A as default };
320
320
 
321
- //# sourceMappingURL=SavedBlocksBrowserModal-CSUqw_dD.js.map
321
+ //# sourceMappingURL=SavedBlocksBrowserModal-CqpaNsk7.js.map