@templatical/editor 0.54.1 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiAltTextPopover-NMJqQKvD.js → AiAltTextPopover-BBKVJ6HA.js} +1 -1
- package/dist/{AiAltTextReview-Ci4zHwRc.js → AiAltTextReview-BuVbeQh-.js} +1 -1
- package/dist/{AiRewriteMenu-arKoTjsQ.js → AiRewriteMenu-ZpYJfm-O.js} +4 -4
- package/dist/{BlockPreviewCanvas-BTieuBmH.js → BlockPreviewCanvas-DtOo5y3U.js} +6 -6
- package/dist/{CloudPanels-Hxdp0doU.js → CloudPanels-DQRWMc59.js} +1 -1
- package/dist/{CountdownToolbar-CM4XNEuO.js → CountdownToolbar-DTpMEDyh.js} +4 -4
- package/dist/{IssuesPanel-1wGV0wiy.js → IssuesPanel-BZn7-p9e.js} +1 -1
- package/dist/{LanguageMenu-BpxbIJEx.js → LanguageMenu-OOmQWVzO.js} +5 -5
- package/dist/{LogicTagInsertButton-DgTJ6Lvx.js → LogicTagInsertButton-XESwnJia.js} +8 -8
- package/dist/{MergeTagInput-B_51YcQO.js → MergeTagInput-CAsBRoSm.js} +1 -1
- package/dist/{MergeTagModeToggle-D3Q2z317.js → MergeTagModeToggle-bOf27Hg1.js} +1 -1
- package/dist/{MergeTagTextarea-DZz1L9DE.js → MergeTagTextarea-DH_6JFui.js} +2 -2
- package/dist/{ParagraphEditor-B38t4E2p.js → ParagraphEditor-XGUkV5Uw.js} +8 -8
- package/dist/{RestoreVersionDialog-n7FSmWXB.js → RestoreVersionDialog-C72kWccI.js} +1 -1
- package/dist/{RichTextEditorContent-Dstovi0m.js → RichTextEditorContent-BZN8KRvR.js} +2 -2
- package/dist/{SaveBlockDialog-B94NpmDV.js → SaveBlockDialog-CKOnTMTU.js} +4 -4
- package/dist/{SavedBlocksBrowserModal-C1vSc8iM.js → SavedBlocksBrowserModal-BrlNxqDH.js} +4 -4
- package/dist/{SavedBlocksPanels-DLDmIYeL.js → SavedBlocksPanels--lPR6gdh.js} +1 -1
- package/dist/{SavedBlocksPickBar-ngf2sFEs.js → SavedBlocksPickBar-4ON4_KKl.js} +1 -1
- package/dist/{TemplateSettings-Baar78_s.js → TemplateSettings-BE0jZmRJ.js} +4 -4
- package/dist/{TestEmailModal-CB_9I1bl.js → TestEmailModal-BKmNGrZN.js} +5 -5
- package/dist/{TestEmailPanel-BUq-dbXQ.js → TestEmailPanel-DT1wllX3.js} +1 -1
- package/dist/{TitleEditor-BLP41rwy.js → TitleEditor-HjVZuUTB.js} +4 -4
- package/dist/{Toolbar-bOZ_eq7X.js → Toolbar-BppchV2k.js} +617 -617
- package/dist/{TplModal-DFKqmJQz.js → TplModal-BFWOoK8l.js} +1 -1
- package/dist/{VersionHistoryPanels-DPxj3mec.js → VersionHistoryPanels-D4yNVLvq.js} +1 -1
- package/dist/{WrapperBlock-BdVIuGMR.js → WrapperBlock-BUzQTZuu.js} +3 -3
- package/dist/{blockTypeIcons-BUyPZ7Su.js → blockTypeIcons-D91v9k0x.js} +1 -1
- package/dist/bundle-stats.json +5 -5
- package/dist/cdn/chunks/{AiAltTextPopover-Cnc_kUmb.js → AiAltTextPopover-CAI18sdv.js} +2 -2
- package/dist/cdn/chunks/{AiAltTextPopover-Cnc_kUmb.js.map → AiAltTextPopover-CAI18sdv.js.map} +1 -1
- package/dist/cdn/chunks/{AiAltTextReview-DPeSY-7r.js → AiAltTextReview-CWEyMOF-.js} +2 -2
- package/dist/cdn/chunks/{AiAltTextReview-DPeSY-7r.js.map → AiAltTextReview-CWEyMOF-.js.map} +1 -1
- package/dist/cdn/chunks/{AiRewriteMenu-YcVFv6RS.js → AiRewriteMenu-BEepu1vo.js} +5 -5
- package/dist/cdn/chunks/{AiRewriteMenu-YcVFv6RS.js.map → AiRewriteMenu-BEepu1vo.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-6ck15xz9.js → BlockPreviewCanvas-B6ndvof2.js} +5 -5
- package/dist/cdn/chunks/{BlockPreviewCanvas-6ck15xz9.js.map → BlockPreviewCanvas-B6ndvof2.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-BHHpNckC.js → CloudPanels-BGwDb0jB.js} +2 -2
- package/dist/cdn/chunks/{CloudPanels-BHHpNckC.js.map → CloudPanels-BGwDb0jB.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-CNgsNL5-.js → CountdownToolbar-B-0FsTj-.js} +5 -5
- package/dist/cdn/chunks/{CountdownToolbar-CNgsNL5-.js.map → CountdownToolbar-B-0FsTj-.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-Duic0mIs.js → IssuesPanel-LyjMBDok.js} +3 -3
- package/dist/cdn/chunks/{IssuesPanel-Duic0mIs.js.map → IssuesPanel-LyjMBDok.js.map} +1 -1
- package/dist/cdn/chunks/{LanguageMenu-C6utRx_4.js → LanguageMenu-CGwMCOQ5.js} +4 -4
- package/dist/cdn/chunks/{LanguageMenu-C6utRx_4.js.map → LanguageMenu-CGwMCOQ5.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-Bhvi0nWz.js → LogicTagInsertButton-PDKuo2J3.js} +4 -4
- package/dist/cdn/chunks/{LogicTagInsertButton-Bhvi0nWz.js.map → LogicTagInsertButton-PDKuo2J3.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-CrhZm-AW.js → MergeTagInput-DoQHBJk2.js} +2 -2
- package/dist/cdn/chunks/{MergeTagInput-CrhZm-AW.js.map → MergeTagInput-DoQHBJk2.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-CWVtXLYa.js → MergeTagModeToggle-Ct5IG4VW.js} +2 -2
- package/dist/cdn/chunks/{MergeTagModeToggle-CWVtXLYa.js.map → MergeTagModeToggle-Ct5IG4VW.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagTextarea-hTIBwX0F.js → MergeTagTextarea-BMsnjphR.js} +3 -3
- package/dist/cdn/chunks/{MergeTagTextarea-hTIBwX0F.js.map → MergeTagTextarea-BMsnjphR.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-B3EQ0Ai6.js → ParagraphEditor-CVW-kuHW.js} +9 -9
- package/dist/cdn/chunks/{ParagraphEditor-B3EQ0Ai6.js.map → ParagraphEditor-CVW-kuHW.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-DfNrVi0R.js → RestoreVersionDialog-7MFZz-Sb.js} +2 -2
- package/dist/cdn/chunks/{RestoreVersionDialog-DfNrVi0R.js.map → RestoreVersionDialog-7MFZz-Sb.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-up4AqL7D.js → RichTextEditorContent-CiL-SkZg.js} +3 -3
- package/dist/cdn/chunks/{RichTextEditorContent-up4AqL7D.js.map → RichTextEditorContent-CiL-SkZg.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-BqglcKcN.js → SaveBlockDialog-CxdekCYy.js} +5 -5
- package/dist/cdn/chunks/{SaveBlockDialog-BqglcKcN.js.map → SaveBlockDialog-CxdekCYy.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BewXGlrK.js → SavedBlocksBrowserModal-D9CAa2U3.js} +4 -4
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BewXGlrK.js.map → SavedBlocksBrowserModal-D9CAa2U3.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-0ZpX-jXI.js → SavedBlocksPanels-jfkYWtss.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-0ZpX-jXI.js.map → SavedBlocksPanels-jfkYWtss.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-DHah-Uf7.js → SavedBlocksPickBar-yaCumC4j.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPickBar-DHah-Uf7.js.map → SavedBlocksPickBar-yaCumC4j.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-CWUpUKJb.js → TemplateSettings-SaV2UVh_.js} +5 -5
- package/dist/cdn/chunks/{TemplateSettings-CWUpUKJb.js.map → TemplateSettings-SaV2UVh_.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-7pUDYLrk.js → TestEmailModal-ByfhP_sm.js} +6 -6
- package/dist/cdn/chunks/{TestEmailModal-7pUDYLrk.js.map → TestEmailModal-ByfhP_sm.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-DBWwMsH1.js → TestEmailPanel-CfzpqpDs.js} +2 -2
- package/dist/cdn/chunks/{TestEmailPanel-DBWwMsH1.js.map → TestEmailPanel-CfzpqpDs.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-VAanUjPQ.js → TitleEditor-Ceb0YfWv.js} +4 -4
- package/dist/cdn/chunks/{TitleEditor-VAanUjPQ.js.map → TitleEditor-Ceb0YfWv.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-BlWVQRcA.js → Toolbar-Cv6Rv1S-.js} +9 -9
- package/dist/cdn/chunks/{Toolbar-BlWVQRcA.js.map → Toolbar-Cv6Rv1S-.js.map} +1 -1
- package/dist/cdn/chunks/{TplModal-DDlR7mk3.js → TplModal-DGpGdwgf.js} +2 -2
- package/dist/cdn/chunks/{TplModal-DDlR7mk3.js.map → TplModal-DGpGdwgf.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-DJDeaf1B.js → VersionHistoryPanels-BJnHCMAH.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryPanels-DJDeaf1B.js.map → VersionHistoryPanels-BJnHCMAH.js.map} +1 -1
- package/dist/cdn/chunks/{WrapperBlock-DRJnrgy-.js → WrapperBlock-C_uE5rPJ.js} +4 -4
- package/dist/cdn/chunks/{WrapperBlock-DRJnrgy-.js.map → WrapperBlock-C_uE5rPJ.js.map} +1 -1
- package/dist/cdn/chunks/{composables-Jc3uZuLs.js → composables-BxikPuC1.js} +449 -443
- package/dist/cdn/chunks/composables-BxikPuC1.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-C2Zs5F1O.js → createCloudRuntime-D2DUaudp.js} +3 -3
- package/dist/cdn/chunks/{createCloudRuntime-C2Zs5F1O.js.map → createCloudRuntime-D2DUaudp.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-DcMKZpzh.js → extensions-DuDWpKo7.js} +4 -4
- package/dist/cdn/chunks/{extensions-DcMKZpzh.js.map → extensions-DuDWpKo7.js.map} +1 -1
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-cC32Ox6A.js → normalizeMergeTagMarkup-Bn_hl4jd.js} +2 -2
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-cC32Ox6A.js.map → normalizeMergeTagMarkup-Bn_hl4jd.js.map} +1 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-f7GEKdvw.js → preRenderCustomBlocks-C9oavydG.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-f7GEKdvw.js.map → preRenderCustomBlocks-C9oavydG.js.map} +1 -1
- package/dist/cdn/chunks/{sanitizeHtml-WTfz9lZd.js → sanitizeHtml-DfXoetOm.js} +2 -2
- package/dist/cdn/chunks/{sanitizeHtml-WTfz9lZd.js.map → sanitizeHtml-DfXoetOm.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-DeCYorUT.js → socialIcons-DPwkrn5v.js} +2 -2
- package/dist/cdn/chunks/{socialIcons-DeCYorUT.js.map → socialIcons-DPwkrn5v.js.map} +1 -1
- package/dist/cdn/chunks/{src-A_cKeTM_.js → src-712f3ofG.js} +2 -2
- package/dist/cdn/chunks/{src-A_cKeTM_.js.map → src-712f3ofG.js.map} +1 -1
- package/dist/cdn/chunks/{src-8bYYJPCt.js → src-B2tQbzf6.js} +152 -146
- package/dist/cdn/chunks/src-B2tQbzf6.js.map +1 -0
- package/dist/cdn/chunks/{src-BQUv2CYU.js → src-ZFw5fg_z.js} +40 -27
- package/dist/cdn/chunks/{src-BQUv2CYU.js.map → src-ZFw5fg_z.js.map} +1 -1
- package/dist/cdn/chunks/{useLocalizedDisplay-aGfnO90D.js → useLocalizedDisplay-DiNjT22M.js} +2 -2
- package/dist/cdn/chunks/{useLocalizedDisplay-aGfnO90D.js.map → useLocalizedDisplay-DiNjT22M.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-DtYe8HIq.js → useLogicTag-SvMW4g00.js} +2 -2
- package/dist/cdn/chunks/{useLogicTag-DtYe8HIq.js.map → useLogicTag-SvMW4g00.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-B8ULmsnp.js → useMergeTag-JLz3Pqcw.js} +2 -2
- package/dist/cdn/chunks/{useMergeTag-B8ULmsnp.js.map → useMergeTag-JLz3Pqcw.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-MK8ga9q9.js → withCurrentFont-BcoPpkDS.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-MK8ga9q9.js.map → withCurrentFont-BcoPpkDS.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +18 -18
- package/dist/{composables-XjYKaKhY.js → composables-BbPFRlBf.js} +908 -902
- package/dist/{createCloudRuntime-DGV5a5Af.js → createCloudRuntime-Dlrg88gS.js} +2 -2
- package/dist/{dist-Cdkm20M6.js → dist-C34cYI5S.js} +126 -113
- package/dist/{extensions-BJ184osp.js → extensions-xCiyqSg7.js} +16 -16
- package/dist/{normalizeMergeTagMarkup-CUCo7B5X.js → normalizeMergeTagMarkup-C7FGNURu.js} +22 -22
- package/dist/{preRenderCustomBlocks-Bs3N9no-.js → preRenderCustomBlocks-DvbRa3L3.js} +3 -3
- package/dist/{sanitizeHtml-2rjV0r-6.js → sanitizeHtml-D_ab7dD6.js} +5 -5
- package/dist/{socialIcons-TFiOkpoU.js → socialIcons-DhAolBjt.js} +342 -342
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +190 -190
- package/dist/useLocalizedDisplay-C9MBFUr4.js +31 -0
- package/dist/{useLogicTag-BXXXQQmi.js → useLogicTag-BmuakZBd.js} +1 -1
- package/dist/{useMergeTag-C9Okr87y.js → useMergeTag-DC4a8b_v.js} +3 -3
- package/dist/{withCurrentFont-DJiQqZzL.js → withCurrentFont-BSxJai99.js} +1 -1
- package/package.json +7 -7
- package/dist/cdn/chunks/composables-Jc3uZuLs.js.map +0 -1
- package/dist/cdn/chunks/src-8bYYJPCt.js.map +0 -1
- package/dist/useLocalizedDisplay-DNNwDRxL.js +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavedBlocksBrowserModal-BewXGlrK.js","names":["_openBlock","_createBlock","TplModal","_withCtx","_createElementVNode","_toDisplayString","_unref","_createVNode","_withDirectives","_vModelText","_createElementBlock","_Fragment","_renderList","_vModelSelect","_createCommentVNode","_withKeys","_withModifiers","_normalizeStyle","_resolveDynamicComponent","_normalizeClass","Trash2","_sfc_main","resolveDynamicComponent","defineComponent","openBlock","withCtx","watch","withDirectives","renderList","inject","defineAsyncComponent","createElementBlock","vModelSelect","withKeys","unref","normalizeClass","createCommentVNode","createBlock","nextTick","withModifiers","createBaseVNode","toDisplayString","vModelText","computed","normalizeStyle","ref","Fragment","createVNode","Pencil","Search","Package","Trash","X","SAVED_BLOCKS_KEY","requireInject","UI_LOCALE_KEY","EDITOR_KEY","useI18n","primaryBtnClass","TplModal_default","formatAbsoluteDateTime","blockTypeIcons","formatRelativeTime","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","_hoisted_36","_hoisted_37","_hoisted_38","_hoisted_39","_hoisted_40","_hoisted_41","_hoisted_42","_hoisted_43","_hoisted_44","_hoisted_45","_hoisted_46","_hoisted_47","_hoisted_48","SELECT_CONTROL","RENAME_CONTROL","DELETE_CONTROL","SavedBlocksBrowserModal_default","__emit","props","__props","emit","BlockPreviewCanvas","n","savedBlocks","editor","uiLocale","searchQuery","categoryFilter","selectedId","confirmDeleteId","renamingId","renameDraft","renameCategoryDraft","renameInput","searchInput","confirmButton","insertPosition","cardEls","setCardEl","el","id","focusCardControl","selector","filtered","query","category","b","isInitialLoad","isFiltering","selected","positionOptions","options","t","blocks","i","block","format","resolvedInsertIndex","idx","visible","selectedBlockId","getBlockTypeIcons","icons","seen","saved","getRemainingTypeCount","types","relativeLabel","raw","absoluteLabel","armDelete","disarmDelete","handleDelete","index","error","list","next","startRename","cancelRename","commitRename","nextName","nextCategory","current","patch","commitRenameByKey","cancelRenameByKey","onEditFocusOut","row","event","handleInsert","handleClose","handleKeydown","_cache","$event","option","item","icon","opt"],"sources":["../../../src/components/SavedBlocksBrowserModal.vue","../../../src/components/SavedBlocksBrowserModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport { blockTypeIcons } from \"../utils/blockTypeIcons\";\nimport { formatAbsoluteDateTime } from \"../utils/formatAbsoluteDateTime\";\nimport { formatRelativeTime } from \"../utils/formatRelativeTime\";\nimport {\n SAVED_BLOCKS_KEY,\n EDITOR_KEY,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../keys\";\nimport type { SavedBlock } from \"@templatical/types\";\nimport { Package, Pencil, Search, Trash2, X } from \"@lucide/vue\";\nimport {\n computed,\n defineAsyncComponent,\n inject,\n nextTick,\n ref,\n watch,\n} from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"insert\", saved: SavedBlock, insertIndex: number | undefined): void;\n}>();\n\nconst BlockPreviewCanvas = defineAsyncComponent(\n () => import(\"./BlockPreviewCanvas.vue\"),\n);\n\nconst { t, format } = useI18n();\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SavedBlocksBrowserModal\");\nconst editor = requireInject(EDITOR_KEY, \"SavedBlocksBrowserModal\");\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\n\nconst searchQuery = ref(\"\");\n/** `\"\"` = no category filter. Matched exactly against `SavedBlock.category`. */\nconst categoryFilter = ref(\"\");\nconst selectedId = ref<string | null>(null);\nconst confirmDeleteId = ref<string | null>(null);\nconst renamingId = ref<string | null>(null);\nconst renameDraft = ref(\"\");\nconst renameCategoryDraft = ref(\"\");\nconst renameInput = ref<HTMLInputElement | null>(null);\nconst searchInput = ref<HTMLInputElement | null>(null);\nconst confirmButton = ref<HTMLButtonElement | null>(null);\n// 'end' = append, 'beginning' = index 0, or block id = after that block\nconst insertPosition = ref<string>(\"end\");\n\n// Arming a delete, deleting and closing a rename each unmount the element that\n// holds focus, which would drop it to the page and send a keyboard user back\n// to the top. So focus is handed to a control in an entry's card, found by\n// these class hooks (each also carries its control's styles).\nconst SELECT_CONTROL = \".tpl-saved-block-select\";\nconst RENAME_CONTROL = \".tpl-saved-block-rename-btn\";\nconst DELETE_CONTROL = \".tpl-saved-block-delete-btn\";\n\nconst cardEls = new Map<string, HTMLElement>();\n\nfunction setCardEl(id: string, el: HTMLElement | null): void {\n if (el) cardEls.set(id, el);\n else cardEls.delete(id);\n}\n\n/** Focuses a control in an entry's card, once the card has re-rendered. */\nasync function focusCardControl(id: string, selector: string): Promise<void> {\n await nextTick();\n cardEls.get(id)?.querySelector<HTMLElement>(selector)?.focus();\n}\n\n// Order is the provider's to decide — the editor never re-sorts. Whatever\n// `list()` returns is what the user sees (the bundled localStorage adapter, for\n// instance, returns newest-first). Filters only narrow; they never reorder.\n//\n// Both filters run in memory over the loaded entries rather than round-tripping\n// to the provider: that keeps a BYO provider at four dumb methods, and it is\n// what lets the category options below be derived at all — a provider-filtered\n// response could not tell us which other categories exist.\nconst filtered = computed(() => {\n const query = searchQuery.value.trim().toLowerCase();\n const category = categoryFilter.value;\n return savedBlocks.savedBlocks.value.filter((b) => {\n if (query && !b.name.toLowerCase().includes(query)) return false;\n if (category && b.category !== category) return false;\n return true;\n });\n});\n\n/**\n * The list is fetched when this modal opens, not at editor mount, so a first\n * open can arrive before the provider answers. Show the skeleton only while\n * there is *nothing* to display: on a reopen the previous entries render\n * immediately and the refetch lands underneath them.\n *\n * Without this the empty state would claim \"No saved blocks yet\" for the whole\n * duration of the request — false, not merely unhelpful.\n */\nconst isInitialLoad = computed(\n () =>\n savedBlocks.isLoading.value && savedBlocks.savedBlocks.value.length === 0,\n);\n\n/** Whether any filter is narrowing the list — drives the empty-state copy. */\nconst isFiltering = computed(\n () => searchQuery.value.trim().length > 0 || categoryFilter.value !== \"\",\n);\n\nconst selected = computed(() => {\n if (!selectedId.value) return null;\n return (\n savedBlocks.savedBlocks.value.find((b) => b.id === selectedId.value) ?? null\n );\n});\n\ninterface PositionOption {\n value: string;\n label: string;\n}\n\nconst positionOptions = computed<PositionOption[]>(() => {\n const options: PositionOption[] = [\n { value: \"beginning\", label: t.savedBlocks.insertAtBeginning },\n ];\n const blocks = editor.content.value.blocks;\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n options.push({\n value: block.id,\n label: format(t.savedBlocks.insertAfterBlock, {\n block: `${label} ${i + 1}`,\n }),\n });\n }\n options.push({ value: \"end\", label: t.savedBlocks.insertAtEnd });\n return options;\n});\n\nconst resolvedInsertIndex = computed<number | undefined>(() => {\n if (insertPosition.value === \"end\") return undefined;\n if (insertPosition.value === \"beginning\") return 0;\n const blocks = editor.content.value.blocks;\n const idx = blocks.findIndex((b) => b.id === insertPosition.value);\n if (idx !== -1) return idx + 1;\n return undefined;\n});\n\n// `immediate` matters: the modal is mounted lazily behind a `v-if` on the same\n// state that drives `visible`, so it can mount with `visible` already true and\n// would otherwise never resolve the default insert position.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n searchQuery.value = \"\";\n categoryFilter.value = \"\";\n selectedId.value = null;\n confirmDeleteId.value = null;\n renamingId.value = null;\n // Default to after selected block, or end\n const selectedBlockId = editor.state.selectedBlockId;\n if (selectedBlockId) {\n const idx = editor.content.value.blocks.findIndex(\n (b) => b.id === selectedBlockId,\n );\n insertPosition.value = idx !== -1 ? selectedBlockId : \"end\";\n } else {\n insertPosition.value = \"end\";\n }\n }\n },\n { immediate: true },\n);\n\nfunction getBlockTypeIcons(\n saved: SavedBlock,\n): { type: string; icon: unknown }[] {\n const icons: { type: string; icon: unknown }[] = [];\n const seen = new Set<string>();\n for (const block of saved.content) {\n if (!seen.has(block.type) && blockTypeIcons[block.type]) {\n seen.add(block.type);\n icons.push({ type: block.type, icon: blockTypeIcons[block.type] });\n }\n if (icons.length >= 5) break;\n }\n return icons;\n}\n\nfunction getRemainingTypeCount(saved: SavedBlock): number {\n const types = new Set(saved.content.map((b) => b.type));\n return Math.max(0, types.size - 5);\n}\n\n/** Compact \"5m ago\" label, or \"\" when the provider supplies no usable timestamp. */\nfunction relativeLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatRelativeTime(raw, t.time, format) ?? \"\";\n}\n\n/**\n * Absolute timestamp for the row's tooltip. Built by `Intl`, so it needs no\n * i18n keys — but it does need the editor's locale, or it formats in the\n * browser's and disagrees with the translated row beside it.\n */\nfunction absoluteLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatAbsoluteDateTime(raw, uiLocale);\n}\n\n/** The confirm replaces the trash it came from, so it takes the focus too. */\nasync function armDelete(id: string): Promise<void> {\n confirmDeleteId.value = id;\n await nextTick();\n confirmButton.value?.focus();\n}\n\n/** Escape at the confirm backs out to the trash and leaves the browser open. */\nfunction disarmDelete(id: string): Promise<void> {\n confirmDeleteId.value = null;\n return focusCardControl(id, DELETE_CONTROL);\n}\n\nasync function handleDelete(id: string): Promise<void> {\n const index = filtered.value.findIndex((b) => b.id === id);\n try {\n await savedBlocks.remove(id);\n } catch (error) {\n // The entry is still listed, so focus goes back to its own trash.\n await disarmDelete(id);\n throw error;\n }\n confirmDeleteId.value = null;\n if (selectedId.value === id) {\n selectedId.value = null;\n }\n // The entry that moved into the deleted one's place takes focus, else the\n // one before it, else the search box once nothing is left to list.\n const list = filtered.value;\n const next = list[Math.min(index, list.length - 1)];\n if (next) {\n await focusCardControl(next.id, SELECT_CONTROL);\n } else {\n await nextTick();\n searchInput.value?.focus();\n }\n}\n\nasync function startRename(saved: SavedBlock): Promise<void> {\n // The pencil is already hidden when editing isn't permitted; this stops a\n // programmatic call opening an editor whose commit could only fail.\n if (!savedBlocks.canUpdateBlock(saved)) return;\n renamingId.value = saved.id;\n renameDraft.value = saved.name;\n renameCategoryDraft.value = saved.category ?? \"\";\n confirmDeleteId.value = null;\n await nextTick();\n renameInput.value?.focus();\n renameInput.value?.select();\n}\n\nfunction cancelRename(): void {\n renamingId.value = null;\n renameDraft.value = \"\";\n renameCategoryDraft.value = \"\";\n}\n\nasync function commitRename(id: string): Promise<void> {\n // Guards two races: Escape sets `renamingId` to null and the unmounting\n // input can still emit `blur`, and Enter commits then blurs. Either would\n // otherwise fire a second, unwanted update.\n if (renamingId.value !== id) return;\n const nextName = renameDraft.value.trim();\n const nextCategory = renameCategoryDraft.value.trim();\n const current = savedBlocks.savedBlocks.value.find((b) => b.id === id);\n\n // An empty name is not a rename — fall back to what's stored, so clearing\n // the field and blurring can't wipe the entry's name.\n const patch: Partial<{ name: string; category: string }> = {};\n if (nextName && nextName !== current?.name) patch.name = nextName;\n // \"\" is meaningful here: it clears the category. Only skip when unchanged.\n if (nextCategory !== (current?.category ?? \"\")) patch.category = nextCategory;\n\n // Skip the round-trip when nothing actually changed.\n if (Object.keys(patch).length === 0) {\n cancelRename();\n return;\n }\n try {\n await savedBlocks.update(id, patch);\n } finally {\n cancelRename();\n }\n}\n\n// Enter and Escape close the edit row from inside it, so focus goes back to the\n// Rename that opened it. A commit because focus left the row keeps focus\n// wherever it went.\nasync function commitRenameByKey(id: string): Promise<void> {\n try {\n await commitRename(id);\n } finally {\n await focusCardControl(id, RENAME_CONTROL);\n }\n}\n\nfunction cancelRenameByKey(id: string): Promise<void> {\n cancelRename();\n return focusCardControl(id, RENAME_CONTROL);\n}\n\n/**\n * Commit when focus leaves the edit row entirely — not when it moves between\n * the name and category inputs. A plain `@blur` on each input would commit\n * (and unmount the row) the moment the user tabbed from one to the other.\n */\nfunction onEditFocusOut(event: FocusEvent, id: string): void {\n const row = event.currentTarget as HTMLElement;\n const next = event.relatedTarget as Node | null;\n if (next && row.contains(next)) return;\n void commitRename(id);\n}\n\nfunction handleInsert(): void {\n if (selected.value) {\n emit(\"insert\", selected.value, resolvedInsertIndex.value);\n }\n}\n\nfunction handleClose(): void {\n emit(\"close\");\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n // While renaming, Enter/Escape belong to the inline input, not the dialog.\n if (renamingId.value) return;\n if (event.key === \"Escape\") {\n handleClose();\n }\n if (event.key === \"Enter\" && selected.value) {\n event.preventDefault();\n handleInsert();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <!-- Explicit width, not `w-full`: the modal's parent is shrink-to-fit, so\n `width: 100%` resolved against its own contents and the 600px preview\n canvas drove the dialog's size — it measured 523px with nothing selected\n and 965px with a block selected, nearly doubling on click. A pinned\n width makes every state identical and stops any future right-pane\n content from moving it. `max-w-full` keeps it inside the backdrop on\n narrow hosts — a percentage, so it neither reintroduces the `rem`\n sensitivity of issue #209 nor the viewport mismatch of issue #575; the\n preview scrolls within. -->\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"saved-blocks-browser\"\n aria-labelledby=\"tpl-saved-blocks-browser-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-[1000px] tpl:max-w-full tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)]\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <!-- Header -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-4 tpl:border-[var(--tpl-border)]\"\n >\n <h3\n id=\"tpl-saved-blocks-browser-title\"\n class=\"tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.browse }}\n </h3>\n <button\n :aria-label=\"t.savedBlocks.close\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-1 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n @click=\"handleClose\"\n >\n <X :size=\"16\" :stroke-width=\"2\" />\n </button>\n </div>\n\n <!-- Body -->\n <div class=\"tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden\">\n <!-- Left panel: saved block list -->\n <div\n class=\"tpl:flex tpl:w-[300px] tpl:shrink-0 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Search + category filter -->\n <div\n class=\"tpl:flex tpl:flex-col tpl:gap-2 tpl:px-4 tpl:pt-4 tpl:pb-3\"\n >\n <div class=\"tpl:relative\">\n <Search\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:left-3 tpl:top-1/2 tpl:-translate-y-1/2 tpl:text-[var(--tpl-text-dim)]\"\n />\n <input\n ref=\"searchInput\"\n v-model=\"searchQuery\"\n type=\"text\"\n :placeholder=\"t.savedBlocks.search\"\n :disabled=\"isInitialLoad\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:pl-9 tpl:pr-3 tpl:text-sm tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:opacity-50 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n </div>\n <!-- Only worth showing once something is actually categorised. -->\n <select\n v-if=\"savedBlocks.categories.value.length > 0\"\n v-model=\"categoryFilter\"\n data-testid=\"saved-blocks-category-filter\"\n :aria-label=\"t.savedBlocks.filterByCategory\"\n class=\"tpl:h-8 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option value=\"\">{{ t.savedBlocks.allCategories }}</option>\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n </div>\n\n <!-- Suggestions for the inline category editor, shared by every row -->\n <datalist id=\"tpl-saved-block-browser-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n\n <!-- List -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:px-4 tpl:pb-4\">\n <!-- Skeleton rows: same height and gap as a real card, so the pane\n doesn't resize when the entries land. `aria-busy` on the region\n is what a screen reader announces; the bars are decorative. -->\n <div\n v-if=\"isInitialLoad\"\n data-testid=\"saved-blocks-loading\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n role=\"status\"\n aria-busy=\"true\"\n :aria-label=\"t.savedBlocks.loading\"\n >\n <div\n v-for=\"n in 3\"\n :key=\"n\"\n aria-hidden=\"true\"\n class=\"tpl-saved-block-skeleton tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl:h-3 tpl:w-1/2 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n <div\n class=\"tpl:mt-2 tpl:h-2.5 tpl:w-1/4 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n </div>\n </div>\n\n <div\n v-else-if=\"filtered.length > 0\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n >\n <template v-for=\"item in filtered\" :key=\"item.id\">\n <!-- Inline rename swaps the whole card for an edit row holding\n the name and category inputs. -->\n <div\n v-if=\"renamingId === item.id\"\n class=\"tpl:flex tpl:w-full tpl:flex-col tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-primary)]\"\n style=\"background-color: var(--tpl-primary-light)\"\n @focusout=\"onEditFocusOut($event, item.id)\"\n >\n <input\n :ref=\"(el) => (renameInput = el as HTMLInputElement | null)\"\n v-model=\"renameDraft\"\n type=\"text\"\n :aria-label=\"t.savedBlocks.rename\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n <input\n v-model=\"renameCategoryDraft\"\n type=\"text\"\n data-testid=\"saved-blocks-edit-category\"\n :aria-label=\"t.savedBlocks.category\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n list=\"tpl-saved-block-browser-categories\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n </div>\n\n <!-- A wrapper, never a button: the card holds Rename, Delete\n and the inline confirm, and a button may not contain\n controls — it announces as a control inside a control, and\n its accessible name absorbs theirs (#738 fixed the same\n defect for merge-tag fields). The select button is the\n real, keyboard-reachable control; the wrapper's click is a\n redundant mouse convenience that keeps the whole card a\n click target. -->\n <div\n v-else\n data-testid=\"saved-block-card\"\n class=\"tpl:group/card tpl:relative tpl:w-full tpl:cursor-pointer tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:bg-transparent tpl:px-3 tpl:py-2 tpl:text-left tpl:transition-all tpl:duration-[120ms]\"\n :style=\"{\n borderColor:\n selectedId === item.id\n ? 'var(--tpl-primary)'\n : 'var(--tpl-border)',\n backgroundColor:\n selectedId === item.id\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n @click=\"selectedId = item.id\"\n :ref=\"(el) => setCardEl(item.id, el as HTMLElement | null)\"\n >\n <!-- Its text is its accessible name, so it holds the entry\n — name, count, category — and nothing else. Spans, not\n divs: a button takes phrasing content only. -->\n <button\n type=\"button\"\n :aria-pressed=\"selectedId === item.id\"\n class=\"tpl-saved-block-select tpl:block tpl:w-full tpl:text-left\"\n >\n <span class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <span\n data-testid=\"saved-block-name\"\n class=\"tpl:flex-1 tpl:truncate tpl:text-xs tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ item.name }}\n </span>\n <span\n class=\"tpl:shrink-0 tpl:rounded-full tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n format(t.savedBlocks.blockCount, {\n count: item.content.length,\n })\n }}\n </span>\n </span>\n <span\n v-if=\"item.category\"\n class=\"tpl:mt-1 tpl:flex tpl:items-center\"\n >\n <span\n data-testid=\"saved-block-category\"\n class=\"tpl:max-w-full tpl:truncate tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]\"\n >\n {{ item.category }}\n </span>\n </span>\n </button>\n <!-- When the row is crowded, only the timestamp gives way:\n the icons, the count and the confirm keep their size. -->\n <div class=\"tpl:mt-1 tpl:flex tpl:items-center tpl:gap-1\">\n <component\n :is=\"icon.icon\"\n v-for=\"icon in getBlockTypeIcons(item)\"\n :key=\"icon.type\"\n :size=\"14\"\n :stroke-width=\"1.5\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-dim)]\"\n />\n <span\n v-if=\"getRemainingTypeCount(item) > 0\"\n class=\"tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n +{{ getRemainingTypeCount(item) }}\n </span>\n <span\n v-if=\"relativeLabel(item)\"\n data-testid=\"saved-block-updated\"\n class=\"tpl:ml-1 tpl:truncate tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n :title=\"absoluteLabel(item)\"\n >\n {{ relativeLabel(item) }}\n </span>\n <!-- The full question doesn't fit beside five icons, so\n the button shows a short label and the question is its\n accessible name, which contains the label. -->\n <button\n v-if=\"confirmDeleteId === item.id\"\n :ref=\"\n (el) => (confirmButton = el as HTMLButtonElement | null)\n \"\n :aria-label=\"t.savedBlocks.deleteConfirm\"\n class=\"tpl:ml-auto tpl:shrink-0 tpl:cursor-pointer tpl:whitespace-nowrap tpl:rounded-md tpl:border tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:transition-colors tpl:border-[var(--tpl-danger)] tpl:text-[var(--tpl-danger)]\"\n style=\"background-color: transparent\"\n @click.stop=\"handleDelete(item.id)\"\n @keydown.esc.prevent.stop=\"disarmDelete(item.id)\"\n >\n {{ t.savedBlocks.deleteConfirmShort }}\n </button>\n <!-- Hidden, not disabled: an action the user can't perform\n is better absent than greyed out. `ml-auto` moves to\n whichever button survives so the row stays aligned. -->\n <template v-else>\n <button\n v-if=\"savedBlocks.canUpdateBlock(item)\"\n class=\"tpl-saved-block-rename-btn tpl:ml-auto tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"t.savedBlocks.rename\"\n :title=\"t.savedBlocks.rename\"\n @click.stop=\"startRename(item)\"\n >\n <Pencil :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n <button\n v-if=\"savedBlocks.canDeleteBlock(item)\"\n class=\"tpl-saved-block-delete-btn tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :class=\"{\n 'tpl:ml-auto': !savedBlocks.canUpdateBlock(item),\n }\"\n :aria-label=\"t.savedBlocks.delete\"\n :title=\"t.savedBlocks.delete\"\n @click.stop=\"armDelete(item.id)\"\n >\n <Trash2 :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n </template>\n </div>\n </div>\n </template>\n </div>\n\n <!-- Empty state — only once we actually know the library is empty -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-12\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n v-if=\"isFiltering\"\n class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.noResults }}\n </p>\n <template v-else>\n <p class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\">\n {{ t.savedBlocks.empty }}\n </p>\n <p\n class=\"tpl:mt-1 tpl:max-w-[220px] tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.emptyHint }}\n </p>\n </template>\n </div>\n </div>\n </div>\n\n <!-- Right panel: preview -->\n <div\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden tpl:border-l tpl:border-[var(--tpl-border)]\"\n >\n <div\n v-if=\"selected\"\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Visual preview -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:p-4\">\n <BlockPreviewCanvas :blocks=\"selected.content\" />\n </div>\n </div>\n\n <!-- Empty preview state -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:items-center tpl:justify-center tpl:px-4\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n class=\"tpl:mt-2 tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.selectToPreview }}\n </p>\n </div>\n </div>\n </div>\n\n <!-- Footer -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3 tpl:border-[var(--tpl-border)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <label\n class=\"tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.insertPosition }}\n </label>\n <select\n v-model=\"insertPosition\"\n class=\"tpl:h-7 tpl:max-w-[220px] tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option\n v-for=\"opt in positionOptions\"\n :key=\"opt.value\"\n :value=\"opt.value\"\n >\n {{ opt.label }}\n </option>\n </select>\n </div>\n <div class=\"tpl:flex tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"saved-blocks-browser-close\"\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 @click=\"handleClose\"\n >\n {{ t.savedBlocks.close }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!selected\"\n @click=\"handleInsert\"\n >\n {{ t.savedBlocks.insert }}\n </button>\n </div>\n </div>\n </div>\n </TplModal>\n</template>\n\n<style>\n/* Subtle breathing so the placeholders read as \"loading\" rather than as empty\n rows. `prefers-reduced-motion` holds them still at full opacity — the bars\n still communicate shape without animating. */\n.tpl-saved-block-skeleton {\n animation: tpl-saved-block-pulse 1.4s ease-in-out infinite;\n}\n\n@keyframes tpl-saved-block-pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.55;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tpl-saved-block-skeleton {\n animation: none;\n }\n}\n\n/* The select button covers only the card's name rows, but keyboard focus rings\n the whole entry. So the button paints the ring on an overlay spanning the\n card instead of on itself: the card is `relative`, and `inset: -1px` reaches\n out over its 1px border. `pointer-events: none` keeps the overlay from taking\n clicks meant for the actions under it. Its radius is the card's\n `--tpl-radius-sm`, so the ring follows the card's corners. */\n.tpl-saved-block-select:focus-visible {\n box-shadow: none;\n}\n\n.tpl-saved-block-select:focus-visible::after {\n content: \"\";\n position: absolute;\n inset: -1px;\n border-radius: var(--tpl-radius-sm);\n box-shadow: var(--tpl-ring);\n pointer-events: none;\n}\n\n.tpl-saved-block-delete-btn:hover {\n color: var(--tpl-danger) !important;\n}\n\n.tpl-saved-block-rename-btn:hover {\n color: var(--tpl-primary) !important;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport { blockTypeIcons } from \"../utils/blockTypeIcons\";\nimport { formatAbsoluteDateTime } from \"../utils/formatAbsoluteDateTime\";\nimport { formatRelativeTime } from \"../utils/formatRelativeTime\";\nimport {\n SAVED_BLOCKS_KEY,\n EDITOR_KEY,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../keys\";\nimport type { SavedBlock } from \"@templatical/types\";\nimport { Package, Pencil, Search, Trash2, X } from \"@lucide/vue\";\nimport {\n computed,\n defineAsyncComponent,\n inject,\n nextTick,\n ref,\n watch,\n} from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"insert\", saved: SavedBlock, insertIndex: number | undefined): void;\n}>();\n\nconst BlockPreviewCanvas = defineAsyncComponent(\n () => import(\"./BlockPreviewCanvas.vue\"),\n);\n\nconst { t, format } = useI18n();\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SavedBlocksBrowserModal\");\nconst editor = requireInject(EDITOR_KEY, \"SavedBlocksBrowserModal\");\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\n\nconst searchQuery = ref(\"\");\n/** `\"\"` = no category filter. Matched exactly against `SavedBlock.category`. */\nconst categoryFilter = ref(\"\");\nconst selectedId = ref<string | null>(null);\nconst confirmDeleteId = ref<string | null>(null);\nconst renamingId = ref<string | null>(null);\nconst renameDraft = ref(\"\");\nconst renameCategoryDraft = ref(\"\");\nconst renameInput = ref<HTMLInputElement | null>(null);\nconst searchInput = ref<HTMLInputElement | null>(null);\nconst confirmButton = ref<HTMLButtonElement | null>(null);\n// 'end' = append, 'beginning' = index 0, or block id = after that block\nconst insertPosition = ref<string>(\"end\");\n\n// Arming a delete, deleting and closing a rename each unmount the element that\n// holds focus, which would drop it to the page and send a keyboard user back\n// to the top. So focus is handed to a control in an entry's card, found by\n// these class hooks (each also carries its control's styles).\nconst SELECT_CONTROL = \".tpl-saved-block-select\";\nconst RENAME_CONTROL = \".tpl-saved-block-rename-btn\";\nconst DELETE_CONTROL = \".tpl-saved-block-delete-btn\";\n\nconst cardEls = new Map<string, HTMLElement>();\n\nfunction setCardEl(id: string, el: HTMLElement | null): void {\n if (el) cardEls.set(id, el);\n else cardEls.delete(id);\n}\n\n/** Focuses a control in an entry's card, once the card has re-rendered. */\nasync function focusCardControl(id: string, selector: string): Promise<void> {\n await nextTick();\n cardEls.get(id)?.querySelector<HTMLElement>(selector)?.focus();\n}\n\n// Order is the provider's to decide — the editor never re-sorts. Whatever\n// `list()` returns is what the user sees (the bundled localStorage adapter, for\n// instance, returns newest-first). Filters only narrow; they never reorder.\n//\n// Both filters run in memory over the loaded entries rather than round-tripping\n// to the provider: that keeps a BYO provider at four dumb methods, and it is\n// what lets the category options below be derived at all — a provider-filtered\n// response could not tell us which other categories exist.\nconst filtered = computed(() => {\n const query = searchQuery.value.trim().toLowerCase();\n const category = categoryFilter.value;\n return savedBlocks.savedBlocks.value.filter((b) => {\n if (query && !b.name.toLowerCase().includes(query)) return false;\n if (category && b.category !== category) return false;\n return true;\n });\n});\n\n/**\n * The list is fetched when this modal opens, not at editor mount, so a first\n * open can arrive before the provider answers. Show the skeleton only while\n * there is *nothing* to display: on a reopen the previous entries render\n * immediately and the refetch lands underneath them.\n *\n * Without this the empty state would claim \"No saved blocks yet\" for the whole\n * duration of the request — false, not merely unhelpful.\n */\nconst isInitialLoad = computed(\n () =>\n savedBlocks.isLoading.value && savedBlocks.savedBlocks.value.length === 0,\n);\n\n/** Whether any filter is narrowing the list — drives the empty-state copy. */\nconst isFiltering = computed(\n () => searchQuery.value.trim().length > 0 || categoryFilter.value !== \"\",\n);\n\nconst selected = computed(() => {\n if (!selectedId.value) return null;\n return (\n savedBlocks.savedBlocks.value.find((b) => b.id === selectedId.value) ?? null\n );\n});\n\ninterface PositionOption {\n value: string;\n label: string;\n}\n\nconst positionOptions = computed<PositionOption[]>(() => {\n const options: PositionOption[] = [\n { value: \"beginning\", label: t.savedBlocks.insertAtBeginning },\n ];\n const blocks = editor.content.value.blocks;\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n options.push({\n value: block.id,\n label: format(t.savedBlocks.insertAfterBlock, {\n block: `${label} ${i + 1}`,\n }),\n });\n }\n options.push({ value: \"end\", label: t.savedBlocks.insertAtEnd });\n return options;\n});\n\nconst resolvedInsertIndex = computed<number | undefined>(() => {\n if (insertPosition.value === \"end\") return undefined;\n if (insertPosition.value === \"beginning\") return 0;\n const blocks = editor.content.value.blocks;\n const idx = blocks.findIndex((b) => b.id === insertPosition.value);\n if (idx !== -1) return idx + 1;\n return undefined;\n});\n\n// `immediate` matters: the modal is mounted lazily behind a `v-if` on the same\n// state that drives `visible`, so it can mount with `visible` already true and\n// would otherwise never resolve the default insert position.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n searchQuery.value = \"\";\n categoryFilter.value = \"\";\n selectedId.value = null;\n confirmDeleteId.value = null;\n renamingId.value = null;\n // Default to after selected block, or end\n const selectedBlockId = editor.state.selectedBlockId;\n if (selectedBlockId) {\n const idx = editor.content.value.blocks.findIndex(\n (b) => b.id === selectedBlockId,\n );\n insertPosition.value = idx !== -1 ? selectedBlockId : \"end\";\n } else {\n insertPosition.value = \"end\";\n }\n }\n },\n { immediate: true },\n);\n\nfunction getBlockTypeIcons(\n saved: SavedBlock,\n): { type: string; icon: unknown }[] {\n const icons: { type: string; icon: unknown }[] = [];\n const seen = new Set<string>();\n for (const block of saved.content) {\n if (!seen.has(block.type) && blockTypeIcons[block.type]) {\n seen.add(block.type);\n icons.push({ type: block.type, icon: blockTypeIcons[block.type] });\n }\n if (icons.length >= 5) break;\n }\n return icons;\n}\n\nfunction getRemainingTypeCount(saved: SavedBlock): number {\n const types = new Set(saved.content.map((b) => b.type));\n return Math.max(0, types.size - 5);\n}\n\n/** Compact \"5m ago\" label, or \"\" when the provider supplies no usable timestamp. */\nfunction relativeLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatRelativeTime(raw, t.time, format) ?? \"\";\n}\n\n/**\n * Absolute timestamp for the row's tooltip. Built by `Intl`, so it needs no\n * i18n keys — but it does need the editor's locale, or it formats in the\n * browser's and disagrees with the translated row beside it.\n */\nfunction absoluteLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatAbsoluteDateTime(raw, uiLocale);\n}\n\n/** The confirm replaces the trash it came from, so it takes the focus too. */\nasync function armDelete(id: string): Promise<void> {\n confirmDeleteId.value = id;\n await nextTick();\n confirmButton.value?.focus();\n}\n\n/** Escape at the confirm backs out to the trash and leaves the browser open. */\nfunction disarmDelete(id: string): Promise<void> {\n confirmDeleteId.value = null;\n return focusCardControl(id, DELETE_CONTROL);\n}\n\nasync function handleDelete(id: string): Promise<void> {\n const index = filtered.value.findIndex((b) => b.id === id);\n try {\n await savedBlocks.remove(id);\n } catch (error) {\n // The entry is still listed, so focus goes back to its own trash.\n await disarmDelete(id);\n throw error;\n }\n confirmDeleteId.value = null;\n if (selectedId.value === id) {\n selectedId.value = null;\n }\n // The entry that moved into the deleted one's place takes focus, else the\n // one before it, else the search box once nothing is left to list.\n const list = filtered.value;\n const next = list[Math.min(index, list.length - 1)];\n if (next) {\n await focusCardControl(next.id, SELECT_CONTROL);\n } else {\n await nextTick();\n searchInput.value?.focus();\n }\n}\n\nasync function startRename(saved: SavedBlock): Promise<void> {\n // The pencil is already hidden when editing isn't permitted; this stops a\n // programmatic call opening an editor whose commit could only fail.\n if (!savedBlocks.canUpdateBlock(saved)) return;\n renamingId.value = saved.id;\n renameDraft.value = saved.name;\n renameCategoryDraft.value = saved.category ?? \"\";\n confirmDeleteId.value = null;\n await nextTick();\n renameInput.value?.focus();\n renameInput.value?.select();\n}\n\nfunction cancelRename(): void {\n renamingId.value = null;\n renameDraft.value = \"\";\n renameCategoryDraft.value = \"\";\n}\n\nasync function commitRename(id: string): Promise<void> {\n // Guards two races: Escape sets `renamingId` to null and the unmounting\n // input can still emit `blur`, and Enter commits then blurs. Either would\n // otherwise fire a second, unwanted update.\n if (renamingId.value !== id) return;\n const nextName = renameDraft.value.trim();\n const nextCategory = renameCategoryDraft.value.trim();\n const current = savedBlocks.savedBlocks.value.find((b) => b.id === id);\n\n // An empty name is not a rename — fall back to what's stored, so clearing\n // the field and blurring can't wipe the entry's name.\n const patch: Partial<{ name: string; category: string }> = {};\n if (nextName && nextName !== current?.name) patch.name = nextName;\n // \"\" is meaningful here: it clears the category. Only skip when unchanged.\n if (nextCategory !== (current?.category ?? \"\")) patch.category = nextCategory;\n\n // Skip the round-trip when nothing actually changed.\n if (Object.keys(patch).length === 0) {\n cancelRename();\n return;\n }\n try {\n await savedBlocks.update(id, patch);\n } finally {\n cancelRename();\n }\n}\n\n// Enter and Escape close the edit row from inside it, so focus goes back to the\n// Rename that opened it. A commit because focus left the row keeps focus\n// wherever it went.\nasync function commitRenameByKey(id: string): Promise<void> {\n try {\n await commitRename(id);\n } finally {\n await focusCardControl(id, RENAME_CONTROL);\n }\n}\n\nfunction cancelRenameByKey(id: string): Promise<void> {\n cancelRename();\n return focusCardControl(id, RENAME_CONTROL);\n}\n\n/**\n * Commit when focus leaves the edit row entirely — not when it moves between\n * the name and category inputs. A plain `@blur` on each input would commit\n * (and unmount the row) the moment the user tabbed from one to the other.\n */\nfunction onEditFocusOut(event: FocusEvent, id: string): void {\n const row = event.currentTarget as HTMLElement;\n const next = event.relatedTarget as Node | null;\n if (next && row.contains(next)) return;\n void commitRename(id);\n}\n\nfunction handleInsert(): void {\n if (selected.value) {\n emit(\"insert\", selected.value, resolvedInsertIndex.value);\n }\n}\n\nfunction handleClose(): void {\n emit(\"close\");\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n // While renaming, Enter/Escape belong to the inline input, not the dialog.\n if (renamingId.value) return;\n if (event.key === \"Escape\") {\n handleClose();\n }\n if (event.key === \"Enter\" && selected.value) {\n event.preventDefault();\n handleInsert();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <!-- Explicit width, not `w-full`: the modal's parent is shrink-to-fit, so\n `width: 100%` resolved against its own contents and the 600px preview\n canvas drove the dialog's size — it measured 523px with nothing selected\n and 965px with a block selected, nearly doubling on click. A pinned\n width makes every state identical and stops any future right-pane\n content from moving it. `max-w-full` keeps it inside the backdrop on\n narrow hosts — a percentage, so it neither reintroduces the `rem`\n sensitivity of issue #209 nor the viewport mismatch of issue #575; the\n preview scrolls within. -->\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"saved-blocks-browser\"\n aria-labelledby=\"tpl-saved-blocks-browser-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-[1000px] tpl:max-w-full tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)]\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <!-- Header -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-4 tpl:border-[var(--tpl-border)]\"\n >\n <h3\n id=\"tpl-saved-blocks-browser-title\"\n class=\"tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.browse }}\n </h3>\n <button\n :aria-label=\"t.savedBlocks.close\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-1 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n @click=\"handleClose\"\n >\n <X :size=\"16\" :stroke-width=\"2\" />\n </button>\n </div>\n\n <!-- Body -->\n <div class=\"tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden\">\n <!-- Left panel: saved block list -->\n <div\n class=\"tpl:flex tpl:w-[300px] tpl:shrink-0 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Search + category filter -->\n <div\n class=\"tpl:flex tpl:flex-col tpl:gap-2 tpl:px-4 tpl:pt-4 tpl:pb-3\"\n >\n <div class=\"tpl:relative\">\n <Search\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:left-3 tpl:top-1/2 tpl:-translate-y-1/2 tpl:text-[var(--tpl-text-dim)]\"\n />\n <input\n ref=\"searchInput\"\n v-model=\"searchQuery\"\n type=\"text\"\n :placeholder=\"t.savedBlocks.search\"\n :disabled=\"isInitialLoad\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:pl-9 tpl:pr-3 tpl:text-sm tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:opacity-50 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n </div>\n <!-- Only worth showing once something is actually categorised. -->\n <select\n v-if=\"savedBlocks.categories.value.length > 0\"\n v-model=\"categoryFilter\"\n data-testid=\"saved-blocks-category-filter\"\n :aria-label=\"t.savedBlocks.filterByCategory\"\n class=\"tpl:h-8 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option value=\"\">{{ t.savedBlocks.allCategories }}</option>\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n </div>\n\n <!-- Suggestions for the inline category editor, shared by every row -->\n <datalist id=\"tpl-saved-block-browser-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n\n <!-- List -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:px-4 tpl:pb-4\">\n <!-- Skeleton rows: same height and gap as a real card, so the pane\n doesn't resize when the entries land. `aria-busy` on the region\n is what a screen reader announces; the bars are decorative. -->\n <div\n v-if=\"isInitialLoad\"\n data-testid=\"saved-blocks-loading\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n role=\"status\"\n aria-busy=\"true\"\n :aria-label=\"t.savedBlocks.loading\"\n >\n <div\n v-for=\"n in 3\"\n :key=\"n\"\n aria-hidden=\"true\"\n class=\"tpl-saved-block-skeleton tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl:h-3 tpl:w-1/2 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n <div\n class=\"tpl:mt-2 tpl:h-2.5 tpl:w-1/4 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n </div>\n </div>\n\n <div\n v-else-if=\"filtered.length > 0\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n >\n <template v-for=\"item in filtered\" :key=\"item.id\">\n <!-- Inline rename swaps the whole card for an edit row holding\n the name and category inputs. -->\n <div\n v-if=\"renamingId === item.id\"\n class=\"tpl:flex tpl:w-full tpl:flex-col tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-primary)]\"\n style=\"background-color: var(--tpl-primary-light)\"\n @focusout=\"onEditFocusOut($event, item.id)\"\n >\n <input\n :ref=\"(el) => (renameInput = el as HTMLInputElement | null)\"\n v-model=\"renameDraft\"\n type=\"text\"\n :aria-label=\"t.savedBlocks.rename\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n <input\n v-model=\"renameCategoryDraft\"\n type=\"text\"\n data-testid=\"saved-blocks-edit-category\"\n :aria-label=\"t.savedBlocks.category\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n list=\"tpl-saved-block-browser-categories\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n </div>\n\n <!-- A wrapper, never a button: the card holds Rename, Delete\n and the inline confirm, and a button may not contain\n controls — it announces as a control inside a control, and\n its accessible name absorbs theirs (#738 fixed the same\n defect for merge-tag fields). The select button is the\n real, keyboard-reachable control; the wrapper's click is a\n redundant mouse convenience that keeps the whole card a\n click target. -->\n <div\n v-else\n data-testid=\"saved-block-card\"\n class=\"tpl:group/card tpl:relative tpl:w-full tpl:cursor-pointer tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:bg-transparent tpl:px-3 tpl:py-2 tpl:text-left tpl:transition-all tpl:duration-[120ms]\"\n :style=\"{\n borderColor:\n selectedId === item.id\n ? 'var(--tpl-primary)'\n : 'var(--tpl-border)',\n backgroundColor:\n selectedId === item.id\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n @click=\"selectedId = item.id\"\n :ref=\"(el) => setCardEl(item.id, el as HTMLElement | null)\"\n >\n <!-- Its text is its accessible name, so it holds the entry\n — name, count, category — and nothing else. Spans, not\n divs: a button takes phrasing content only. -->\n <button\n type=\"button\"\n :aria-pressed=\"selectedId === item.id\"\n class=\"tpl-saved-block-select tpl:block tpl:w-full tpl:text-left\"\n >\n <span class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <span\n data-testid=\"saved-block-name\"\n class=\"tpl:flex-1 tpl:truncate tpl:text-xs tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ item.name }}\n </span>\n <span\n class=\"tpl:shrink-0 tpl:rounded-full tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n format(t.savedBlocks.blockCount, {\n count: item.content.length,\n })\n }}\n </span>\n </span>\n <span\n v-if=\"item.category\"\n class=\"tpl:mt-1 tpl:flex tpl:items-center\"\n >\n <span\n data-testid=\"saved-block-category\"\n class=\"tpl:max-w-full tpl:truncate tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]\"\n >\n {{ item.category }}\n </span>\n </span>\n </button>\n <!-- When the row is crowded, only the timestamp gives way:\n the icons, the count and the confirm keep their size. -->\n <div class=\"tpl:mt-1 tpl:flex tpl:items-center tpl:gap-1\">\n <component\n :is=\"icon.icon\"\n v-for=\"icon in getBlockTypeIcons(item)\"\n :key=\"icon.type\"\n :size=\"14\"\n :stroke-width=\"1.5\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-dim)]\"\n />\n <span\n v-if=\"getRemainingTypeCount(item) > 0\"\n class=\"tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n +{{ getRemainingTypeCount(item) }}\n </span>\n <span\n v-if=\"relativeLabel(item)\"\n data-testid=\"saved-block-updated\"\n class=\"tpl:ml-1 tpl:truncate tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n :title=\"absoluteLabel(item)\"\n >\n {{ relativeLabel(item) }}\n </span>\n <!-- The full question doesn't fit beside five icons, so\n the button shows a short label and the question is its\n accessible name, which contains the label. -->\n <button\n v-if=\"confirmDeleteId === item.id\"\n :ref=\"\n (el) => (confirmButton = el as HTMLButtonElement | null)\n \"\n :aria-label=\"t.savedBlocks.deleteConfirm\"\n class=\"tpl:ml-auto tpl:shrink-0 tpl:cursor-pointer tpl:whitespace-nowrap tpl:rounded-md tpl:border tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:transition-colors tpl:border-[var(--tpl-danger)] tpl:text-[var(--tpl-danger)]\"\n style=\"background-color: transparent\"\n @click.stop=\"handleDelete(item.id)\"\n @keydown.esc.prevent.stop=\"disarmDelete(item.id)\"\n >\n {{ t.savedBlocks.deleteConfirmShort }}\n </button>\n <!-- Hidden, not disabled: an action the user can't perform\n is better absent than greyed out. `ml-auto` moves to\n whichever button survives so the row stays aligned. -->\n <template v-else>\n <button\n v-if=\"savedBlocks.canUpdateBlock(item)\"\n class=\"tpl-saved-block-rename-btn tpl:ml-auto tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"t.savedBlocks.rename\"\n :title=\"t.savedBlocks.rename\"\n @click.stop=\"startRename(item)\"\n >\n <Pencil :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n <button\n v-if=\"savedBlocks.canDeleteBlock(item)\"\n class=\"tpl-saved-block-delete-btn tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :class=\"{\n 'tpl:ml-auto': !savedBlocks.canUpdateBlock(item),\n }\"\n :aria-label=\"t.savedBlocks.delete\"\n :title=\"t.savedBlocks.delete\"\n @click.stop=\"armDelete(item.id)\"\n >\n <Trash2 :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n </template>\n </div>\n </div>\n </template>\n </div>\n\n <!-- Empty state — only once we actually know the library is empty -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-12\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n v-if=\"isFiltering\"\n class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.noResults }}\n </p>\n <template v-else>\n <p class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\">\n {{ t.savedBlocks.empty }}\n </p>\n <p\n class=\"tpl:mt-1 tpl:max-w-[220px] tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.emptyHint }}\n </p>\n </template>\n </div>\n </div>\n </div>\n\n <!-- Right panel: preview -->\n <div\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden tpl:border-l tpl:border-[var(--tpl-border)]\"\n >\n <div\n v-if=\"selected\"\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Visual preview -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:p-4\">\n <BlockPreviewCanvas :blocks=\"selected.content\" />\n </div>\n </div>\n\n <!-- Empty preview state -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:items-center tpl:justify-center tpl:px-4\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n class=\"tpl:mt-2 tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.selectToPreview }}\n </p>\n </div>\n </div>\n </div>\n\n <!-- Footer -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3 tpl:border-[var(--tpl-border)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <label\n class=\"tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.insertPosition }}\n </label>\n <select\n v-model=\"insertPosition\"\n class=\"tpl:h-7 tpl:max-w-[220px] tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option\n v-for=\"opt in positionOptions\"\n :key=\"opt.value\"\n :value=\"opt.value\"\n >\n {{ opt.label }}\n </option>\n </select>\n </div>\n <div class=\"tpl:flex tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"saved-blocks-browser-close\"\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 @click=\"handleClose\"\n >\n {{ t.savedBlocks.close }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!selected\"\n @click=\"handleInsert\"\n >\n {{ t.savedBlocks.insert }}\n </button>\n </div>\n </div>\n </div>\n </TplModal>\n</template>\n\n<style>\n/* Subtle breathing so the placeholders read as \"loading\" rather than as empty\n rows. `prefers-reduced-motion` holds them still at full opacity — the bars\n still communicate shape without animating. */\n.tpl-saved-block-skeleton {\n animation: tpl-saved-block-pulse 1.4s ease-in-out infinite;\n}\n\n@keyframes tpl-saved-block-pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.55;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tpl-saved-block-skeleton {\n animation: none;\n }\n}\n\n/* The select button covers only the card's name rows, but keyboard focus rings\n the whole entry. So the button paints the ring on an overlay spanning the\n card instead of on itself: the card is `relative`, and `inset: -1px` reaches\n out over its 1px border. `pointer-events: none` keeps the overlay from taking\n clicks meant for the actions under it. Its radius is the card's\n `--tpl-radius-sm`, so the ring follows the card's corners. */\n.tpl-saved-block-select:focus-visible {\n box-shadow: none;\n}\n\n.tpl-saved-block-select:focus-visible::after {\n content: \"\";\n position: absolute;\n inset: -1px;\n border-radius: var(--tpl-radius-sm);\n box-shadow: var(--tpl-ring);\n pointer-events: none;\n}\n\n.tpl-saved-block-delete-btn:hover {\n color: var(--tpl-danger) !important;\n}\n\n.tpl-saved-block-rename-btn:hover {\n color: var(--tpl-primary) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,oaA4DM+G,KAAiB,2BACjBC,IAAiB,+BACjBC,KAAiB,+B;;;;;EAtCvB,IAAMG,KAAQC,GAIRC,IAAOH,GAKPI,KAAqBzF,SACnB,OAAO,mCACf,CAAA,MAAA,MAAA0F,EAAA,CAAA,CAAA,GAEM,EAAE,MAAG,cAAW/D,GAAQ,GACxBgE,IAAcnE,EAAcD,IAAkB,yBAAyB,GACvEqE,IAASpE,EAAcE,IAAY,yBAAyB,GAC5DmE,KAAW9F,EAAO0B,IAAe,KAAA,CAAS,GAE1CqE,IAAc/E,EAAI,EAAE,GAEpBgF,IAAiBhF,EAAI,EAAE,GACvBiF,IAAajF,EAAmB,IAAI,GACpCkF,IAAkBlF,EAAmB,IAAI,GACzCmF,IAAanF,EAAmB,IAAI,GACpCoF,IAAcpF,EAAI,EAAE,GACpBqF,IAAsBrF,EAAI,EAAE,GAC5BsF,IAActF,EAA6B,IAAI,GAC/CuF,IAAcvF,EAA6B,IAAI,GAC/CwF,IAAgBxF,EAA8B,IAAI,GAElDyF,IAAiBzF,EAAY,KAAK,GAUlC0F,oBAAU,IAAI,IAAyB;EAE7C,SAASC,GAAU,GAAY,GAA8B;GAC3D,AAAIC,IAAIF,EAAQ,IAAIG,GAAID,CAAE,IACrBF,EAAQ,OAAOG,CAAE;EACxB;EAGA,eAAeC,EAAiB,GAAY,GAAiC;GAE3E,AADA,MAAMrG,EAAS,GACfiG,EAAQ,IAAIG,CAAE,CAAC,EAAE,cAA2BE,CAAQ,CAAC,EAAE,MAAM;EAC/D;EAUA,IAAMC,IAAWlG,QAAe;GAC9B,IAAMmG,IAAQlB,EAAY,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M;KACN,gBAAc;KACf,OAAM;I,IAER9C,EAII,KAJJoG,IAIInG,EADCC,EAAAgJ,CAAA,CAAC,CAAC,YAAY,eAAe,GAAA,CAAA,C;IAOxClJ,EAwCM,OAxCNqG,IAwCM,CArCJrG,EAkBM,OAlBNsG,IAkBM,CAjBJtG,EAIQ,SAJRuG,IAIQtG,EADHC,EAAAgJ,CAAA,CAAC,CAAC,YAAY,cAAc,GAAA,CAAA,GAEjC9I,EAAAJ,EAWS,UAAA;KAVE,uBAAA,AAAA0L,EAAA,QAAA,MAAA,EAAc,QAAAC;KACvB,OAAM;I,KAEN/L,EAAA,EAAA,GAAAU,EAMSC,GAAA,MAAAC,EALOwI,GAAA,QAAP,OADTpJ,EAAA,GAAAU,EAMS,UAAA;KAJN,KAAKyL,EAAI;KACT,OAAOA,EAAI;IAET,GAAA9L,EAAA8L,EAAI,KAAK,GAAA,GAAAvF,EAAA,E,kBARL,CAAA/F,GAAAyH,EAAA,KAAc,C,MAY3BlI,EAiBM,OAjBNyG,IAiBM,CAhBJzG,EAOS,UAAA;KANP,MAAK;KACL,eAAY;KACZ,OAAM;KACL,SAAOwL;IAEL,GAAAvL,EAAAC,EAAAgJ,CAAA,CAAC,CAAC,YAAY,KAAK,GAAA,CAAA,GAExBlJ,EAOS,UAAA;KANP,MAAK;KACJ,OAAKe,EAAEb,EAAAoD,EAAA,CAAe;KACtB,UAAQ,CAAGyF,EAAA;KACX,SAAOwC;IAEL,GAAAtL,EAAAC,EAAAgJ,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,IAAAxC,EAAA,C"}
|
|
1
|
+
{"version":3,"file":"SavedBlocksBrowserModal-D9CAa2U3.js","names":["_openBlock","_createBlock","TplModal","_withCtx","_createElementVNode","_toDisplayString","_unref","_createVNode","_withDirectives","_vModelText","_createElementBlock","_Fragment","_renderList","_vModelSelect","_createCommentVNode","_withKeys","_withModifiers","_normalizeStyle","_resolveDynamicComponent","_normalizeClass","Trash2","_sfc_main","resolveDynamicComponent","defineComponent","openBlock","withCtx","watch","withDirectives","renderList","inject","defineAsyncComponent","createElementBlock","vModelSelect","withKeys","unref","normalizeClass","createCommentVNode","createBlock","nextTick","withModifiers","createBaseVNode","toDisplayString","vModelText","computed","normalizeStyle","ref","Fragment","createVNode","Pencil","Search","Package","Trash","X","SAVED_BLOCKS_KEY","requireInject","UI_LOCALE_KEY","EDITOR_KEY","useI18n","primaryBtnClass","TplModal_default","formatAbsoluteDateTime","blockTypeIcons","formatRelativeTime","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","_hoisted_36","_hoisted_37","_hoisted_38","_hoisted_39","_hoisted_40","_hoisted_41","_hoisted_42","_hoisted_43","_hoisted_44","_hoisted_45","_hoisted_46","_hoisted_47","_hoisted_48","SELECT_CONTROL","RENAME_CONTROL","DELETE_CONTROL","SavedBlocksBrowserModal_default","__emit","props","__props","emit","BlockPreviewCanvas","n","savedBlocks","editor","uiLocale","searchQuery","categoryFilter","selectedId","confirmDeleteId","renamingId","renameDraft","renameCategoryDraft","renameInput","searchInput","confirmButton","insertPosition","cardEls","setCardEl","el","id","focusCardControl","selector","filtered","query","category","b","isInitialLoad","isFiltering","selected","positionOptions","options","t","blocks","i","block","format","resolvedInsertIndex","idx","visible","selectedBlockId","getBlockTypeIcons","icons","seen","saved","getRemainingTypeCount","types","relativeLabel","raw","absoluteLabel","armDelete","disarmDelete","handleDelete","index","error","list","next","startRename","cancelRename","commitRename","nextName","nextCategory","current","patch","commitRenameByKey","cancelRenameByKey","onEditFocusOut","row","event","handleInsert","handleClose","handleKeydown","_cache","$event","option","item","icon","opt"],"sources":["../../../src/components/SavedBlocksBrowserModal.vue","../../../src/components/SavedBlocksBrowserModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport { blockTypeIcons } from \"../utils/blockTypeIcons\";\nimport { formatAbsoluteDateTime } from \"../utils/formatAbsoluteDateTime\";\nimport { formatRelativeTime } from \"../utils/formatRelativeTime\";\nimport {\n SAVED_BLOCKS_KEY,\n EDITOR_KEY,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../keys\";\nimport type { SavedBlock } from \"@templatical/types\";\nimport { Package, Pencil, Search, Trash2, X } from \"@lucide/vue\";\nimport {\n computed,\n defineAsyncComponent,\n inject,\n nextTick,\n ref,\n watch,\n} from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"insert\", saved: SavedBlock, insertIndex: number | undefined): void;\n}>();\n\nconst BlockPreviewCanvas = defineAsyncComponent(\n () => import(\"./BlockPreviewCanvas.vue\"),\n);\n\nconst { t, format } = useI18n();\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SavedBlocksBrowserModal\");\nconst editor = requireInject(EDITOR_KEY, \"SavedBlocksBrowserModal\");\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\n\nconst searchQuery = ref(\"\");\n/** `\"\"` = no category filter. Matched exactly against `SavedBlock.category`. */\nconst categoryFilter = ref(\"\");\nconst selectedId = ref<string | null>(null);\nconst confirmDeleteId = ref<string | null>(null);\nconst renamingId = ref<string | null>(null);\nconst renameDraft = ref(\"\");\nconst renameCategoryDraft = ref(\"\");\nconst renameInput = ref<HTMLInputElement | null>(null);\nconst searchInput = ref<HTMLInputElement | null>(null);\nconst confirmButton = ref<HTMLButtonElement | null>(null);\n// 'end' = append, 'beginning' = index 0, or block id = after that block\nconst insertPosition = ref<string>(\"end\");\n\n// Arming a delete, deleting and closing a rename each unmount the element that\n// holds focus, which would drop it to the page and send a keyboard user back\n// to the top. So focus is handed to a control in an entry's card, found by\n// these class hooks (each also carries its control's styles).\nconst SELECT_CONTROL = \".tpl-saved-block-select\";\nconst RENAME_CONTROL = \".tpl-saved-block-rename-btn\";\nconst DELETE_CONTROL = \".tpl-saved-block-delete-btn\";\n\nconst cardEls = new Map<string, HTMLElement>();\n\nfunction setCardEl(id: string, el: HTMLElement | null): void {\n if (el) cardEls.set(id, el);\n else cardEls.delete(id);\n}\n\n/** Focuses a control in an entry's card, once the card has re-rendered. */\nasync function focusCardControl(id: string, selector: string): Promise<void> {\n await nextTick();\n cardEls.get(id)?.querySelector<HTMLElement>(selector)?.focus();\n}\n\n// Order is the provider's to decide — the editor never re-sorts. Whatever\n// `list()` returns is what the user sees (the bundled localStorage adapter, for\n// instance, returns newest-first). Filters only narrow; they never reorder.\n//\n// Both filters run in memory over the loaded entries rather than round-tripping\n// to the provider: that keeps a BYO provider at four dumb methods, and it is\n// what lets the category options below be derived at all — a provider-filtered\n// response could not tell us which other categories exist.\nconst filtered = computed(() => {\n const query = searchQuery.value.trim().toLowerCase();\n const category = categoryFilter.value;\n return savedBlocks.savedBlocks.value.filter((b) => {\n if (query && !b.name.toLowerCase().includes(query)) return false;\n if (category && b.category !== category) return false;\n return true;\n });\n});\n\n/**\n * The list is fetched when this modal opens, not at editor mount, so a first\n * open can arrive before the provider answers. Show the skeleton only while\n * there is *nothing* to display: on a reopen the previous entries render\n * immediately and the refetch lands underneath them.\n *\n * Without this the empty state would claim \"No saved blocks yet\" for the whole\n * duration of the request — false, not merely unhelpful.\n */\nconst isInitialLoad = computed(\n () =>\n savedBlocks.isLoading.value && savedBlocks.savedBlocks.value.length === 0,\n);\n\n/** Whether any filter is narrowing the list — drives the empty-state copy. */\nconst isFiltering = computed(\n () => searchQuery.value.trim().length > 0 || categoryFilter.value !== \"\",\n);\n\nconst selected = computed(() => {\n if (!selectedId.value) return null;\n return (\n savedBlocks.savedBlocks.value.find((b) => b.id === selectedId.value) ?? null\n );\n});\n\ninterface PositionOption {\n value: string;\n label: string;\n}\n\nconst positionOptions = computed<PositionOption[]>(() => {\n const options: PositionOption[] = [\n { value: \"beginning\", label: t.savedBlocks.insertAtBeginning },\n ];\n const blocks = editor.content.value.blocks;\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n options.push({\n value: block.id,\n label: format(t.savedBlocks.insertAfterBlock, {\n block: `${label} ${i + 1}`,\n }),\n });\n }\n options.push({ value: \"end\", label: t.savedBlocks.insertAtEnd });\n return options;\n});\n\nconst resolvedInsertIndex = computed<number | undefined>(() => {\n if (insertPosition.value === \"end\") return undefined;\n if (insertPosition.value === \"beginning\") return 0;\n const blocks = editor.content.value.blocks;\n const idx = blocks.findIndex((b) => b.id === insertPosition.value);\n if (idx !== -1) return idx + 1;\n return undefined;\n});\n\n// `immediate` matters: the modal is mounted lazily behind a `v-if` on the same\n// state that drives `visible`, so it can mount with `visible` already true and\n// would otherwise never resolve the default insert position.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n searchQuery.value = \"\";\n categoryFilter.value = \"\";\n selectedId.value = null;\n confirmDeleteId.value = null;\n renamingId.value = null;\n // Default to after selected block, or end\n const selectedBlockId = editor.state.selectedBlockId;\n if (selectedBlockId) {\n const idx = editor.content.value.blocks.findIndex(\n (b) => b.id === selectedBlockId,\n );\n insertPosition.value = idx !== -1 ? selectedBlockId : \"end\";\n } else {\n insertPosition.value = \"end\";\n }\n }\n },\n { immediate: true },\n);\n\nfunction getBlockTypeIcons(\n saved: SavedBlock,\n): { type: string; icon: unknown }[] {\n const icons: { type: string; icon: unknown }[] = [];\n const seen = new Set<string>();\n for (const block of saved.content) {\n if (!seen.has(block.type) && blockTypeIcons[block.type]) {\n seen.add(block.type);\n icons.push({ type: block.type, icon: blockTypeIcons[block.type] });\n }\n if (icons.length >= 5) break;\n }\n return icons;\n}\n\nfunction getRemainingTypeCount(saved: SavedBlock): number {\n const types = new Set(saved.content.map((b) => b.type));\n return Math.max(0, types.size - 5);\n}\n\n/** Compact \"5m ago\" label, or \"\" when the provider supplies no usable timestamp. */\nfunction relativeLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatRelativeTime(raw, t.time, format) ?? \"\";\n}\n\n/**\n * Absolute timestamp for the row's tooltip. Built by `Intl`, so it needs no\n * i18n keys — but it does need the editor's locale, or it formats in the\n * browser's and disagrees with the translated row beside it.\n */\nfunction absoluteLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatAbsoluteDateTime(raw, uiLocale);\n}\n\n/** The confirm replaces the trash it came from, so it takes the focus too. */\nasync function armDelete(id: string): Promise<void> {\n confirmDeleteId.value = id;\n await nextTick();\n confirmButton.value?.focus();\n}\n\n/** Escape at the confirm backs out to the trash and leaves the browser open. */\nfunction disarmDelete(id: string): Promise<void> {\n confirmDeleteId.value = null;\n return focusCardControl(id, DELETE_CONTROL);\n}\n\nasync function handleDelete(id: string): Promise<void> {\n const index = filtered.value.findIndex((b) => b.id === id);\n try {\n await savedBlocks.remove(id);\n } catch (error) {\n // The entry is still listed, so focus goes back to its own trash.\n await disarmDelete(id);\n throw error;\n }\n confirmDeleteId.value = null;\n if (selectedId.value === id) {\n selectedId.value = null;\n }\n // The entry that moved into the deleted one's place takes focus, else the\n // one before it, else the search box once nothing is left to list.\n const list = filtered.value;\n const next = list[Math.min(index, list.length - 1)];\n if (next) {\n await focusCardControl(next.id, SELECT_CONTROL);\n } else {\n await nextTick();\n searchInput.value?.focus();\n }\n}\n\nasync function startRename(saved: SavedBlock): Promise<void> {\n // The pencil is already hidden when editing isn't permitted; this stops a\n // programmatic call opening an editor whose commit could only fail.\n if (!savedBlocks.canUpdateBlock(saved)) return;\n renamingId.value = saved.id;\n renameDraft.value = saved.name;\n renameCategoryDraft.value = saved.category ?? \"\";\n confirmDeleteId.value = null;\n await nextTick();\n renameInput.value?.focus();\n renameInput.value?.select();\n}\n\nfunction cancelRename(): void {\n renamingId.value = null;\n renameDraft.value = \"\";\n renameCategoryDraft.value = \"\";\n}\n\nasync function commitRename(id: string): Promise<void> {\n // Guards two races: Escape sets `renamingId` to null and the unmounting\n // input can still emit `blur`, and Enter commits then blurs. Either would\n // otherwise fire a second, unwanted update.\n if (renamingId.value !== id) return;\n const nextName = renameDraft.value.trim();\n const nextCategory = renameCategoryDraft.value.trim();\n const current = savedBlocks.savedBlocks.value.find((b) => b.id === id);\n\n // An empty name is not a rename — fall back to what's stored, so clearing\n // the field and blurring can't wipe the entry's name.\n const patch: Partial<{ name: string; category: string }> = {};\n if (nextName && nextName !== current?.name) patch.name = nextName;\n // \"\" is meaningful here: it clears the category. Only skip when unchanged.\n if (nextCategory !== (current?.category ?? \"\")) patch.category = nextCategory;\n\n // Skip the round-trip when nothing actually changed.\n if (Object.keys(patch).length === 0) {\n cancelRename();\n return;\n }\n try {\n await savedBlocks.update(id, patch);\n } finally {\n cancelRename();\n }\n}\n\n// Enter and Escape close the edit row from inside it, so focus goes back to the\n// Rename that opened it. A commit because focus left the row keeps focus\n// wherever it went.\nasync function commitRenameByKey(id: string): Promise<void> {\n try {\n await commitRename(id);\n } finally {\n await focusCardControl(id, RENAME_CONTROL);\n }\n}\n\nfunction cancelRenameByKey(id: string): Promise<void> {\n cancelRename();\n return focusCardControl(id, RENAME_CONTROL);\n}\n\n/**\n * Commit when focus leaves the edit row entirely — not when it moves between\n * the name and category inputs. A plain `@blur` on each input would commit\n * (and unmount the row) the moment the user tabbed from one to the other.\n */\nfunction onEditFocusOut(event: FocusEvent, id: string): void {\n const row = event.currentTarget as HTMLElement;\n const next = event.relatedTarget as Node | null;\n if (next && row.contains(next)) return;\n void commitRename(id);\n}\n\nfunction handleInsert(): void {\n if (selected.value) {\n emit(\"insert\", selected.value, resolvedInsertIndex.value);\n }\n}\n\nfunction handleClose(): void {\n emit(\"close\");\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n // While renaming, Enter/Escape belong to the inline input, not the dialog.\n if (renamingId.value) return;\n if (event.key === \"Escape\") {\n handleClose();\n }\n if (event.key === \"Enter\" && selected.value) {\n event.preventDefault();\n handleInsert();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <!-- Explicit width, not `w-full`: the modal's parent is shrink-to-fit, so\n `width: 100%` resolved against its own contents and the 600px preview\n canvas drove the dialog's size — it measured 523px with nothing selected\n and 965px with a block selected, nearly doubling on click. A pinned\n width makes every state identical and stops any future right-pane\n content from moving it. `max-w-full` keeps it inside the backdrop on\n narrow hosts — a percentage, so it neither reintroduces the `rem`\n sensitivity of issue #209 nor the viewport mismatch of issue #575; the\n preview scrolls within. -->\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"saved-blocks-browser\"\n aria-labelledby=\"tpl-saved-blocks-browser-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-[1000px] tpl:max-w-full tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)]\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <!-- Header -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-4 tpl:border-[var(--tpl-border)]\"\n >\n <h3\n id=\"tpl-saved-blocks-browser-title\"\n class=\"tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.browse }}\n </h3>\n <button\n :aria-label=\"t.savedBlocks.close\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-1 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n @click=\"handleClose\"\n >\n <X :size=\"16\" :stroke-width=\"2\" />\n </button>\n </div>\n\n <!-- Body -->\n <div class=\"tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden\">\n <!-- Left panel: saved block list -->\n <div\n class=\"tpl:flex tpl:w-[300px] tpl:shrink-0 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Search + category filter -->\n <div\n class=\"tpl:flex tpl:flex-col tpl:gap-2 tpl:px-4 tpl:pt-4 tpl:pb-3\"\n >\n <div class=\"tpl:relative\">\n <Search\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:left-3 tpl:top-1/2 tpl:-translate-y-1/2 tpl:text-[var(--tpl-text-dim)]\"\n />\n <input\n ref=\"searchInput\"\n v-model=\"searchQuery\"\n type=\"text\"\n :placeholder=\"t.savedBlocks.search\"\n :disabled=\"isInitialLoad\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:pl-9 tpl:pr-3 tpl:text-sm tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:opacity-50 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n </div>\n <!-- Only worth showing once something is actually categorised. -->\n <select\n v-if=\"savedBlocks.categories.value.length > 0\"\n v-model=\"categoryFilter\"\n data-testid=\"saved-blocks-category-filter\"\n :aria-label=\"t.savedBlocks.filterByCategory\"\n class=\"tpl:h-8 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option value=\"\">{{ t.savedBlocks.allCategories }}</option>\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n </div>\n\n <!-- Suggestions for the inline category editor, shared by every row -->\n <datalist id=\"tpl-saved-block-browser-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n\n <!-- List -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:px-4 tpl:pb-4\">\n <!-- Skeleton rows: same height and gap as a real card, so the pane\n doesn't resize when the entries land. `aria-busy` on the region\n is what a screen reader announces; the bars are decorative. -->\n <div\n v-if=\"isInitialLoad\"\n data-testid=\"saved-blocks-loading\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n role=\"status\"\n aria-busy=\"true\"\n :aria-label=\"t.savedBlocks.loading\"\n >\n <div\n v-for=\"n in 3\"\n :key=\"n\"\n aria-hidden=\"true\"\n class=\"tpl-saved-block-skeleton tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl:h-3 tpl:w-1/2 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n <div\n class=\"tpl:mt-2 tpl:h-2.5 tpl:w-1/4 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n </div>\n </div>\n\n <div\n v-else-if=\"filtered.length > 0\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n >\n <template v-for=\"item in filtered\" :key=\"item.id\">\n <!-- Inline rename swaps the whole card for an edit row holding\n the name and category inputs. -->\n <div\n v-if=\"renamingId === item.id\"\n class=\"tpl:flex tpl:w-full tpl:flex-col tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-primary)]\"\n style=\"background-color: var(--tpl-primary-light)\"\n @focusout=\"onEditFocusOut($event, item.id)\"\n >\n <input\n :ref=\"(el) => (renameInput = el as HTMLInputElement | null)\"\n v-model=\"renameDraft\"\n type=\"text\"\n :aria-label=\"t.savedBlocks.rename\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n <input\n v-model=\"renameCategoryDraft\"\n type=\"text\"\n data-testid=\"saved-blocks-edit-category\"\n :aria-label=\"t.savedBlocks.category\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n list=\"tpl-saved-block-browser-categories\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n </div>\n\n <!-- A wrapper, never a button: the card holds Rename, Delete\n and the inline confirm, and a button may not contain\n controls — it announces as a control inside a control, and\n its accessible name absorbs theirs (#738 fixed the same\n defect for merge-tag fields). The select button is the\n real, keyboard-reachable control; the wrapper's click is a\n redundant mouse convenience that keeps the whole card a\n click target. -->\n <div\n v-else\n data-testid=\"saved-block-card\"\n class=\"tpl:group/card tpl:relative tpl:w-full tpl:cursor-pointer tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:bg-transparent tpl:px-3 tpl:py-2 tpl:text-left tpl:transition-all tpl:duration-[120ms]\"\n :style=\"{\n borderColor:\n selectedId === item.id\n ? 'var(--tpl-primary)'\n : 'var(--tpl-border)',\n backgroundColor:\n selectedId === item.id\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n @click=\"selectedId = item.id\"\n :ref=\"(el) => setCardEl(item.id, el as HTMLElement | null)\"\n >\n <!-- Its text is its accessible name, so it holds the entry\n — name, count, category — and nothing else. Spans, not\n divs: a button takes phrasing content only. -->\n <button\n type=\"button\"\n :aria-pressed=\"selectedId === item.id\"\n class=\"tpl-saved-block-select tpl:block tpl:w-full tpl:text-left\"\n >\n <span class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <span\n data-testid=\"saved-block-name\"\n class=\"tpl:flex-1 tpl:truncate tpl:text-xs tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ item.name }}\n </span>\n <span\n class=\"tpl:shrink-0 tpl:rounded-full tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n format(t.savedBlocks.blockCount, {\n count: item.content.length,\n })\n }}\n </span>\n </span>\n <span\n v-if=\"item.category\"\n class=\"tpl:mt-1 tpl:flex tpl:items-center\"\n >\n <span\n data-testid=\"saved-block-category\"\n class=\"tpl:max-w-full tpl:truncate tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]\"\n >\n {{ item.category }}\n </span>\n </span>\n </button>\n <!-- When the row is crowded, only the timestamp gives way:\n the icons, the count and the confirm keep their size. -->\n <div class=\"tpl:mt-1 tpl:flex tpl:items-center tpl:gap-1\">\n <component\n :is=\"icon.icon\"\n v-for=\"icon in getBlockTypeIcons(item)\"\n :key=\"icon.type\"\n :size=\"14\"\n :stroke-width=\"1.5\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-dim)]\"\n />\n <span\n v-if=\"getRemainingTypeCount(item) > 0\"\n class=\"tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n +{{ getRemainingTypeCount(item) }}\n </span>\n <span\n v-if=\"relativeLabel(item)\"\n data-testid=\"saved-block-updated\"\n class=\"tpl:ml-1 tpl:truncate tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n :title=\"absoluteLabel(item)\"\n >\n {{ relativeLabel(item) }}\n </span>\n <!-- The full question doesn't fit beside five icons, so\n the button shows a short label and the question is its\n accessible name, which contains the label. -->\n <button\n v-if=\"confirmDeleteId === item.id\"\n :ref=\"\n (el) => (confirmButton = el as HTMLButtonElement | null)\n \"\n :aria-label=\"t.savedBlocks.deleteConfirm\"\n class=\"tpl:ml-auto tpl:shrink-0 tpl:cursor-pointer tpl:whitespace-nowrap tpl:rounded-md tpl:border tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:transition-colors tpl:border-[var(--tpl-danger)] tpl:text-[var(--tpl-danger)]\"\n style=\"background-color: transparent\"\n @click.stop=\"handleDelete(item.id)\"\n @keydown.esc.prevent.stop=\"disarmDelete(item.id)\"\n >\n {{ t.savedBlocks.deleteConfirmShort }}\n </button>\n <!-- Hidden, not disabled: an action the user can't perform\n is better absent than greyed out. `ml-auto` moves to\n whichever button survives so the row stays aligned. -->\n <template v-else>\n <button\n v-if=\"savedBlocks.canUpdateBlock(item)\"\n class=\"tpl-saved-block-rename-btn tpl:ml-auto tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"t.savedBlocks.rename\"\n :title=\"t.savedBlocks.rename\"\n @click.stop=\"startRename(item)\"\n >\n <Pencil :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n <button\n v-if=\"savedBlocks.canDeleteBlock(item)\"\n class=\"tpl-saved-block-delete-btn tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :class=\"{\n 'tpl:ml-auto': !savedBlocks.canUpdateBlock(item),\n }\"\n :aria-label=\"t.savedBlocks.delete\"\n :title=\"t.savedBlocks.delete\"\n @click.stop=\"armDelete(item.id)\"\n >\n <Trash2 :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n </template>\n </div>\n </div>\n </template>\n </div>\n\n <!-- Empty state — only once we actually know the library is empty -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-12\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n v-if=\"isFiltering\"\n class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.noResults }}\n </p>\n <template v-else>\n <p class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\">\n {{ t.savedBlocks.empty }}\n </p>\n <p\n class=\"tpl:mt-1 tpl:max-w-[220px] tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.emptyHint }}\n </p>\n </template>\n </div>\n </div>\n </div>\n\n <!-- Right panel: preview -->\n <div\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden tpl:border-l tpl:border-[var(--tpl-border)]\"\n >\n <div\n v-if=\"selected\"\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Visual preview -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:p-4\">\n <BlockPreviewCanvas :blocks=\"selected.content\" />\n </div>\n </div>\n\n <!-- Empty preview state -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:items-center tpl:justify-center tpl:px-4\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n class=\"tpl:mt-2 tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.selectToPreview }}\n </p>\n </div>\n </div>\n </div>\n\n <!-- Footer -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3 tpl:border-[var(--tpl-border)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <label\n class=\"tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.insertPosition }}\n </label>\n <select\n v-model=\"insertPosition\"\n class=\"tpl:h-7 tpl:max-w-[220px] tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option\n v-for=\"opt in positionOptions\"\n :key=\"opt.value\"\n :value=\"opt.value\"\n >\n {{ opt.label }}\n </option>\n </select>\n </div>\n <div class=\"tpl:flex tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"saved-blocks-browser-close\"\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 @click=\"handleClose\"\n >\n {{ t.savedBlocks.close }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!selected\"\n @click=\"handleInsert\"\n >\n {{ t.savedBlocks.insert }}\n </button>\n </div>\n </div>\n </div>\n </TplModal>\n</template>\n\n<style>\n/* Subtle breathing so the placeholders read as \"loading\" rather than as empty\n rows. `prefers-reduced-motion` holds them still at full opacity — the bars\n still communicate shape without animating. */\n.tpl-saved-block-skeleton {\n animation: tpl-saved-block-pulse 1.4s ease-in-out infinite;\n}\n\n@keyframes tpl-saved-block-pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.55;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tpl-saved-block-skeleton {\n animation: none;\n }\n}\n\n/* The select button covers only the card's name rows, but keyboard focus rings\n the whole entry. So the button paints the ring on an overlay spanning the\n card instead of on itself: the card is `relative`, and `inset: -1px` reaches\n out over its 1px border. `pointer-events: none` keeps the overlay from taking\n clicks meant for the actions under it. Its radius is the card's\n `--tpl-radius-sm`, so the ring follows the card's corners. */\n.tpl-saved-block-select:focus-visible {\n box-shadow: none;\n}\n\n.tpl-saved-block-select:focus-visible::after {\n content: \"\";\n position: absolute;\n inset: -1px;\n border-radius: var(--tpl-radius-sm);\n box-shadow: var(--tpl-ring);\n pointer-events: none;\n}\n\n.tpl-saved-block-delete-btn:hover {\n color: var(--tpl-danger) !important;\n}\n\n.tpl-saved-block-rename-btn:hover {\n color: var(--tpl-primary) !important;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { primaryBtnClass } from \"../constants/styleConstants\";\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../composables\";\nimport { blockTypeIcons } from \"../utils/blockTypeIcons\";\nimport { formatAbsoluteDateTime } from \"../utils/formatAbsoluteDateTime\";\nimport { formatRelativeTime } from \"../utils/formatRelativeTime\";\nimport {\n SAVED_BLOCKS_KEY,\n EDITOR_KEY,\n UI_LOCALE_KEY,\n requireInject,\n} from \"../keys\";\nimport type { SavedBlock } from \"@templatical/types\";\nimport { Package, Pencil, Search, Trash2, X } from \"@lucide/vue\";\nimport {\n computed,\n defineAsyncComponent,\n inject,\n nextTick,\n ref,\n watch,\n} from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"insert\", saved: SavedBlock, insertIndex: number | undefined): void;\n}>();\n\nconst BlockPreviewCanvas = defineAsyncComponent(\n () => import(\"./BlockPreviewCanvas.vue\"),\n);\n\nconst { t, format } = useI18n();\nconst savedBlocks = requireInject(SAVED_BLOCKS_KEY, \"SavedBlocksBrowserModal\");\nconst editor = requireInject(EDITOR_KEY, \"SavedBlocksBrowserModal\");\nconst uiLocale = inject(UI_LOCALE_KEY, undefined);\n\nconst searchQuery = ref(\"\");\n/** `\"\"` = no category filter. Matched exactly against `SavedBlock.category`. */\nconst categoryFilter = ref(\"\");\nconst selectedId = ref<string | null>(null);\nconst confirmDeleteId = ref<string | null>(null);\nconst renamingId = ref<string | null>(null);\nconst renameDraft = ref(\"\");\nconst renameCategoryDraft = ref(\"\");\nconst renameInput = ref<HTMLInputElement | null>(null);\nconst searchInput = ref<HTMLInputElement | null>(null);\nconst confirmButton = ref<HTMLButtonElement | null>(null);\n// 'end' = append, 'beginning' = index 0, or block id = after that block\nconst insertPosition = ref<string>(\"end\");\n\n// Arming a delete, deleting and closing a rename each unmount the element that\n// holds focus, which would drop it to the page and send a keyboard user back\n// to the top. So focus is handed to a control in an entry's card, found by\n// these class hooks (each also carries its control's styles).\nconst SELECT_CONTROL = \".tpl-saved-block-select\";\nconst RENAME_CONTROL = \".tpl-saved-block-rename-btn\";\nconst DELETE_CONTROL = \".tpl-saved-block-delete-btn\";\n\nconst cardEls = new Map<string, HTMLElement>();\n\nfunction setCardEl(id: string, el: HTMLElement | null): void {\n if (el) cardEls.set(id, el);\n else cardEls.delete(id);\n}\n\n/** Focuses a control in an entry's card, once the card has re-rendered. */\nasync function focusCardControl(id: string, selector: string): Promise<void> {\n await nextTick();\n cardEls.get(id)?.querySelector<HTMLElement>(selector)?.focus();\n}\n\n// Order is the provider's to decide — the editor never re-sorts. Whatever\n// `list()` returns is what the user sees (the bundled localStorage adapter, for\n// instance, returns newest-first). Filters only narrow; they never reorder.\n//\n// Both filters run in memory over the loaded entries rather than round-tripping\n// to the provider: that keeps a BYO provider at four dumb methods, and it is\n// what lets the category options below be derived at all — a provider-filtered\n// response could not tell us which other categories exist.\nconst filtered = computed(() => {\n const query = searchQuery.value.trim().toLowerCase();\n const category = categoryFilter.value;\n return savedBlocks.savedBlocks.value.filter((b) => {\n if (query && !b.name.toLowerCase().includes(query)) return false;\n if (category && b.category !== category) return false;\n return true;\n });\n});\n\n/**\n * The list is fetched when this modal opens, not at editor mount, so a first\n * open can arrive before the provider answers. Show the skeleton only while\n * there is *nothing* to display: on a reopen the previous entries render\n * immediately and the refetch lands underneath them.\n *\n * Without this the empty state would claim \"No saved blocks yet\" for the whole\n * duration of the request — false, not merely unhelpful.\n */\nconst isInitialLoad = computed(\n () =>\n savedBlocks.isLoading.value && savedBlocks.savedBlocks.value.length === 0,\n);\n\n/** Whether any filter is narrowing the list — drives the empty-state copy. */\nconst isFiltering = computed(\n () => searchQuery.value.trim().length > 0 || categoryFilter.value !== \"\",\n);\n\nconst selected = computed(() => {\n if (!selectedId.value) return null;\n return (\n savedBlocks.savedBlocks.value.find((b) => b.id === selectedId.value) ?? null\n );\n});\n\ninterface PositionOption {\n value: string;\n label: string;\n}\n\nconst positionOptions = computed<PositionOption[]>(() => {\n const options: PositionOption[] = [\n { value: \"beginning\", label: t.savedBlocks.insertAtBeginning },\n ];\n const blocks = editor.content.value.blocks;\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n options.push({\n value: block.id,\n label: format(t.savedBlocks.insertAfterBlock, {\n block: `${label} ${i + 1}`,\n }),\n });\n }\n options.push({ value: \"end\", label: t.savedBlocks.insertAtEnd });\n return options;\n});\n\nconst resolvedInsertIndex = computed<number | undefined>(() => {\n if (insertPosition.value === \"end\") return undefined;\n if (insertPosition.value === \"beginning\") return 0;\n const blocks = editor.content.value.blocks;\n const idx = blocks.findIndex((b) => b.id === insertPosition.value);\n if (idx !== -1) return idx + 1;\n return undefined;\n});\n\n// `immediate` matters: the modal is mounted lazily behind a `v-if` on the same\n// state that drives `visible`, so it can mount with `visible` already true and\n// would otherwise never resolve the default insert position.\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n searchQuery.value = \"\";\n categoryFilter.value = \"\";\n selectedId.value = null;\n confirmDeleteId.value = null;\n renamingId.value = null;\n // Default to after selected block, or end\n const selectedBlockId = editor.state.selectedBlockId;\n if (selectedBlockId) {\n const idx = editor.content.value.blocks.findIndex(\n (b) => b.id === selectedBlockId,\n );\n insertPosition.value = idx !== -1 ? selectedBlockId : \"end\";\n } else {\n insertPosition.value = \"end\";\n }\n }\n },\n { immediate: true },\n);\n\nfunction getBlockTypeIcons(\n saved: SavedBlock,\n): { type: string; icon: unknown }[] {\n const icons: { type: string; icon: unknown }[] = [];\n const seen = new Set<string>();\n for (const block of saved.content) {\n if (!seen.has(block.type) && blockTypeIcons[block.type]) {\n seen.add(block.type);\n icons.push({ type: block.type, icon: blockTypeIcons[block.type] });\n }\n if (icons.length >= 5) break;\n }\n return icons;\n}\n\nfunction getRemainingTypeCount(saved: SavedBlock): number {\n const types = new Set(saved.content.map((b) => b.type));\n return Math.max(0, types.size - 5);\n}\n\n/** Compact \"5m ago\" label, or \"\" when the provider supplies no usable timestamp. */\nfunction relativeLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatRelativeTime(raw, t.time, format) ?? \"\";\n}\n\n/**\n * Absolute timestamp for the row's tooltip. Built by `Intl`, so it needs no\n * i18n keys — but it does need the editor's locale, or it formats in the\n * browser's and disagrees with the translated row beside it.\n */\nfunction absoluteLabel(saved: SavedBlock): string {\n const raw = saved.updatedAt ?? saved.createdAt;\n if (!raw) return \"\";\n return formatAbsoluteDateTime(raw, uiLocale);\n}\n\n/** The confirm replaces the trash it came from, so it takes the focus too. */\nasync function armDelete(id: string): Promise<void> {\n confirmDeleteId.value = id;\n await nextTick();\n confirmButton.value?.focus();\n}\n\n/** Escape at the confirm backs out to the trash and leaves the browser open. */\nfunction disarmDelete(id: string): Promise<void> {\n confirmDeleteId.value = null;\n return focusCardControl(id, DELETE_CONTROL);\n}\n\nasync function handleDelete(id: string): Promise<void> {\n const index = filtered.value.findIndex((b) => b.id === id);\n try {\n await savedBlocks.remove(id);\n } catch (error) {\n // The entry is still listed, so focus goes back to its own trash.\n await disarmDelete(id);\n throw error;\n }\n confirmDeleteId.value = null;\n if (selectedId.value === id) {\n selectedId.value = null;\n }\n // The entry that moved into the deleted one's place takes focus, else the\n // one before it, else the search box once nothing is left to list.\n const list = filtered.value;\n const next = list[Math.min(index, list.length - 1)];\n if (next) {\n await focusCardControl(next.id, SELECT_CONTROL);\n } else {\n await nextTick();\n searchInput.value?.focus();\n }\n}\n\nasync function startRename(saved: SavedBlock): Promise<void> {\n // The pencil is already hidden when editing isn't permitted; this stops a\n // programmatic call opening an editor whose commit could only fail.\n if (!savedBlocks.canUpdateBlock(saved)) return;\n renamingId.value = saved.id;\n renameDraft.value = saved.name;\n renameCategoryDraft.value = saved.category ?? \"\";\n confirmDeleteId.value = null;\n await nextTick();\n renameInput.value?.focus();\n renameInput.value?.select();\n}\n\nfunction cancelRename(): void {\n renamingId.value = null;\n renameDraft.value = \"\";\n renameCategoryDraft.value = \"\";\n}\n\nasync function commitRename(id: string): Promise<void> {\n // Guards two races: Escape sets `renamingId` to null and the unmounting\n // input can still emit `blur`, and Enter commits then blurs. Either would\n // otherwise fire a second, unwanted update.\n if (renamingId.value !== id) return;\n const nextName = renameDraft.value.trim();\n const nextCategory = renameCategoryDraft.value.trim();\n const current = savedBlocks.savedBlocks.value.find((b) => b.id === id);\n\n // An empty name is not a rename — fall back to what's stored, so clearing\n // the field and blurring can't wipe the entry's name.\n const patch: Partial<{ name: string; category: string }> = {};\n if (nextName && nextName !== current?.name) patch.name = nextName;\n // \"\" is meaningful here: it clears the category. Only skip when unchanged.\n if (nextCategory !== (current?.category ?? \"\")) patch.category = nextCategory;\n\n // Skip the round-trip when nothing actually changed.\n if (Object.keys(patch).length === 0) {\n cancelRename();\n return;\n }\n try {\n await savedBlocks.update(id, patch);\n } finally {\n cancelRename();\n }\n}\n\n// Enter and Escape close the edit row from inside it, so focus goes back to the\n// Rename that opened it. A commit because focus left the row keeps focus\n// wherever it went.\nasync function commitRenameByKey(id: string): Promise<void> {\n try {\n await commitRename(id);\n } finally {\n await focusCardControl(id, RENAME_CONTROL);\n }\n}\n\nfunction cancelRenameByKey(id: string): Promise<void> {\n cancelRename();\n return focusCardControl(id, RENAME_CONTROL);\n}\n\n/**\n * Commit when focus leaves the edit row entirely — not when it moves between\n * the name and category inputs. A plain `@blur` on each input would commit\n * (and unmount the row) the moment the user tabbed from one to the other.\n */\nfunction onEditFocusOut(event: FocusEvent, id: string): void {\n const row = event.currentTarget as HTMLElement;\n const next = event.relatedTarget as Node | null;\n if (next && row.contains(next)) return;\n void commitRename(id);\n}\n\nfunction handleInsert(): void {\n if (selected.value) {\n emit(\"insert\", selected.value, resolvedInsertIndex.value);\n }\n}\n\nfunction handleClose(): void {\n emit(\"close\");\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n // While renaming, Enter/Escape belong to the inline input, not the dialog.\n if (renamingId.value) return;\n if (event.key === \"Escape\") {\n handleClose();\n }\n if (event.key === \"Enter\" && selected.value) {\n event.preventDefault();\n handleInsert();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <!-- Explicit width, not `w-full`: the modal's parent is shrink-to-fit, so\n `width: 100%` resolved against its own contents and the 600px preview\n canvas drove the dialog's size — it measured 523px with nothing selected\n and 965px with a block selected, nearly doubling on click. A pinned\n width makes every state identical and stops any future right-pane\n content from moving it. `max-w-full` keeps it inside the backdrop on\n narrow hosts — a percentage, so it neither reintroduces the `rem`\n sensitivity of issue #209 nor the viewport mismatch of issue #575; the\n preview scrolls within. -->\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"saved-blocks-browser\"\n aria-labelledby=\"tpl-saved-blocks-browser-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-[1000px] tpl:max-w-full tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)]\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <!-- Header -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-4 tpl:border-[var(--tpl-border)]\"\n >\n <h3\n id=\"tpl-saved-blocks-browser-title\"\n class=\"tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.savedBlocks.browse }}\n </h3>\n <button\n :aria-label=\"t.savedBlocks.close\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-1 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n @click=\"handleClose\"\n >\n <X :size=\"16\" :stroke-width=\"2\" />\n </button>\n </div>\n\n <!-- Body -->\n <div class=\"tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden\">\n <!-- Left panel: saved block list -->\n <div\n class=\"tpl:flex tpl:w-[300px] tpl:shrink-0 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Search + category filter -->\n <div\n class=\"tpl:flex tpl:flex-col tpl:gap-2 tpl:px-4 tpl:pt-4 tpl:pb-3\"\n >\n <div class=\"tpl:relative\">\n <Search\n :size=\"14\"\n :stroke-width=\"2\"\n class=\"tpl:pointer-events-none tpl:absolute tpl:left-3 tpl:top-1/2 tpl:-translate-y-1/2 tpl:text-[var(--tpl-text-dim)]\"\n />\n <input\n ref=\"searchInput\"\n v-model=\"searchQuery\"\n type=\"text\"\n :placeholder=\"t.savedBlocks.search\"\n :disabled=\"isInitialLoad\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:pl-9 tpl:pr-3 tpl:text-sm tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:opacity-50 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n </div>\n <!-- Only worth showing once something is actually categorised. -->\n <select\n v-if=\"savedBlocks.categories.value.length > 0\"\n v-model=\"categoryFilter\"\n data-testid=\"saved-blocks-category-filter\"\n :aria-label=\"t.savedBlocks.filterByCategory\"\n class=\"tpl:h-8 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option value=\"\">{{ t.savedBlocks.allCategories }}</option>\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n </div>\n\n <!-- Suggestions for the inline category editor, shared by every row -->\n <datalist id=\"tpl-saved-block-browser-categories\">\n <option\n v-for=\"option in savedBlocks.categories.value\"\n :key=\"option\"\n :value=\"option\"\n />\n </datalist>\n\n <!-- List -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:px-4 tpl:pb-4\">\n <!-- Skeleton rows: same height and gap as a real card, so the pane\n doesn't resize when the entries land. `aria-busy` on the region\n is what a screen reader announces; the bars are decorative. -->\n <div\n v-if=\"isInitialLoad\"\n data-testid=\"saved-blocks-loading\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n role=\"status\"\n aria-busy=\"true\"\n :aria-label=\"t.savedBlocks.loading\"\n >\n <div\n v-for=\"n in 3\"\n :key=\"n\"\n aria-hidden=\"true\"\n class=\"tpl-saved-block-skeleton tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl:h-3 tpl:w-1/2 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n <div\n class=\"tpl:mt-2 tpl:h-2.5 tpl:w-1/4 tpl:rounded tpl:bg-[var(--tpl-bg-hover)]\"\n />\n </div>\n </div>\n\n <div\n v-else-if=\"filtered.length > 0\"\n class=\"tpl:flex tpl:flex-col tpl:gap-1\"\n >\n <template v-for=\"item in filtered\" :key=\"item.id\">\n <!-- Inline rename swaps the whole card for an edit row holding\n the name and category inputs. -->\n <div\n v-if=\"renamingId === item.id\"\n class=\"tpl:flex tpl:w-full tpl:flex-col tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-primary)]\"\n style=\"background-color: var(--tpl-primary-light)\"\n @focusout=\"onEditFocusOut($event, item.id)\"\n >\n <input\n :ref=\"(el) => (renameInput = el as HTMLInputElement | null)\"\n v-model=\"renameDraft\"\n type=\"text\"\n :aria-label=\"t.savedBlocks.rename\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n <input\n v-model=\"renameCategoryDraft\"\n type=\"text\"\n data-testid=\"saved-blocks-edit-category\"\n :aria-label=\"t.savedBlocks.category\"\n :placeholder=\"t.savedBlocks.categoryPlaceholder\"\n list=\"tpl-saved-block-browser-categories\"\n class=\"tpl:h-7 tpl:w-full tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n @keydown.enter.prevent.stop=\"commitRenameByKey(item.id)\"\n @keydown.esc.prevent.stop=\"cancelRenameByKey(item.id)\"\n />\n </div>\n\n <!-- A wrapper, never a button: the card holds Rename, Delete\n and the inline confirm, and a button may not contain\n controls — it announces as a control inside a control, and\n its accessible name absorbs theirs (#738 fixed the same\n defect for merge-tag fields). The select button is the\n real, keyboard-reachable control; the wrapper's click is a\n redundant mouse convenience that keeps the whole card a\n click target. -->\n <div\n v-else\n data-testid=\"saved-block-card\"\n class=\"tpl:group/card tpl:relative tpl:w-full tpl:cursor-pointer tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:bg-transparent tpl:px-3 tpl:py-2 tpl:text-left tpl:transition-all tpl:duration-[120ms]\"\n :style=\"{\n borderColor:\n selectedId === item.id\n ? 'var(--tpl-primary)'\n : 'var(--tpl-border)',\n backgroundColor:\n selectedId === item.id\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n @click=\"selectedId = item.id\"\n :ref=\"(el) => setCardEl(item.id, el as HTMLElement | null)\"\n >\n <!-- Its text is its accessible name, so it holds the entry\n — name, count, category — and nothing else. Spans, not\n divs: a button takes phrasing content only. -->\n <button\n type=\"button\"\n :aria-pressed=\"selectedId === item.id\"\n class=\"tpl-saved-block-select tpl:block tpl:w-full tpl:text-left\"\n >\n <span class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <span\n data-testid=\"saved-block-name\"\n class=\"tpl:flex-1 tpl:truncate tpl:text-xs tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ item.name }}\n </span>\n <span\n class=\"tpl:shrink-0 tpl:rounded-full tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n format(t.savedBlocks.blockCount, {\n count: item.content.length,\n })\n }}\n </span>\n </span>\n <span\n v-if=\"item.category\"\n class=\"tpl:mt-1 tpl:flex tpl:items-center\"\n >\n <span\n data-testid=\"saved-block-category\"\n class=\"tpl:max-w-full tpl:truncate tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]\"\n >\n {{ item.category }}\n </span>\n </span>\n </button>\n <!-- When the row is crowded, only the timestamp gives way:\n the icons, the count and the confirm keep their size. -->\n <div class=\"tpl:mt-1 tpl:flex tpl:items-center tpl:gap-1\">\n <component\n :is=\"icon.icon\"\n v-for=\"icon in getBlockTypeIcons(item)\"\n :key=\"icon.type\"\n :size=\"14\"\n :stroke-width=\"1.5\"\n class=\"tpl:shrink-0 tpl:text-[var(--tpl-text-dim)]\"\n />\n <span\n v-if=\"getRemainingTypeCount(item) > 0\"\n class=\"tpl:shrink-0 tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n +{{ getRemainingTypeCount(item) }}\n </span>\n <span\n v-if=\"relativeLabel(item)\"\n data-testid=\"saved-block-updated\"\n class=\"tpl:ml-1 tpl:truncate tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n :title=\"absoluteLabel(item)\"\n >\n {{ relativeLabel(item) }}\n </span>\n <!-- The full question doesn't fit beside five icons, so\n the button shows a short label and the question is its\n accessible name, which contains the label. -->\n <button\n v-if=\"confirmDeleteId === item.id\"\n :ref=\"\n (el) => (confirmButton = el as HTMLButtonElement | null)\n \"\n :aria-label=\"t.savedBlocks.deleteConfirm\"\n class=\"tpl:ml-auto tpl:shrink-0 tpl:cursor-pointer tpl:whitespace-nowrap tpl:rounded-md tpl:border tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:transition-colors tpl:border-[var(--tpl-danger)] tpl:text-[var(--tpl-danger)]\"\n style=\"background-color: transparent\"\n @click.stop=\"handleDelete(item.id)\"\n @keydown.esc.prevent.stop=\"disarmDelete(item.id)\"\n >\n {{ t.savedBlocks.deleteConfirmShort }}\n </button>\n <!-- Hidden, not disabled: an action the user can't perform\n is better absent than greyed out. `ml-auto` moves to\n whichever button survives so the row stays aligned. -->\n <template v-else>\n <button\n v-if=\"savedBlocks.canUpdateBlock(item)\"\n class=\"tpl-saved-block-rename-btn tpl:ml-auto tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :aria-label=\"t.savedBlocks.rename\"\n :title=\"t.savedBlocks.rename\"\n @click.stop=\"startRename(item)\"\n >\n <Pencil :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n <button\n v-if=\"savedBlocks.canDeleteBlock(item)\"\n class=\"tpl-saved-block-delete-btn tpl:cursor-pointer tpl:rounded-md tpl:border-none tpl:bg-transparent tpl:p-0.5 tpl:transition-colors tpl:text-[var(--tpl-text-dim)]\"\n :class=\"{\n 'tpl:ml-auto': !savedBlocks.canUpdateBlock(item),\n }\"\n :aria-label=\"t.savedBlocks.delete\"\n :title=\"t.savedBlocks.delete\"\n @click.stop=\"armDelete(item.id)\"\n >\n <Trash2 :size=\"12\" :stroke-width=\"1.5\" />\n </button>\n </template>\n </div>\n </div>\n </template>\n </div>\n\n <!-- Empty state — only once we actually know the library is empty -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-12\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n v-if=\"isFiltering\"\n class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.noResults }}\n </p>\n <template v-else>\n <p class=\"tpl:mt-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\">\n {{ t.savedBlocks.empty }}\n </p>\n <p\n class=\"tpl:mt-1 tpl:max-w-[220px] tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.emptyHint }}\n </p>\n </template>\n </div>\n </div>\n </div>\n\n <!-- Right panel: preview -->\n <div\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden tpl:border-l tpl:border-[var(--tpl-border)]\"\n >\n <div\n v-if=\"selected\"\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:overflow-hidden\"\n >\n <!-- Visual preview -->\n <div class=\"tpl:flex-1 tpl:overflow-y-auto tpl:p-4\">\n <BlockPreviewCanvas :blocks=\"selected.content\" />\n </div>\n </div>\n\n <!-- Empty preview state -->\n <div\n v-else\n class=\"tpl:flex tpl:flex-1 tpl:flex-col tpl:items-center tpl:justify-center tpl:px-4\"\n >\n <Package\n :size=\"32\"\n :stroke-width=\"1\"\n class=\"tpl:text-[var(--tpl-text-dim)]\"\n />\n <p\n class=\"tpl:mt-2 tpl:text-center tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.selectToPreview }}\n </p>\n </div>\n </div>\n </div>\n\n <!-- Footer -->\n <div\n class=\"tpl:flex tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3 tpl:border-[var(--tpl-border)]\"\n >\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <label\n class=\"tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.savedBlocks.insertPosition }}\n </label>\n <select\n v-model=\"insertPosition\"\n class=\"tpl:h-7 tpl:max-w-[220px] tpl:rounded-md tpl:border tpl:px-2 tpl:text-xs tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option\n v-for=\"opt in positionOptions\"\n :key=\"opt.value\"\n :value=\"opt.value\"\n >\n {{ opt.label }}\n </option>\n </select>\n </div>\n <div class=\"tpl:flex tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"saved-blocks-browser-close\"\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 @click=\"handleClose\"\n >\n {{ t.savedBlocks.close }}\n </button>\n <button\n type=\"button\"\n :class=\"primaryBtnClass\"\n :disabled=\"!selected\"\n @click=\"handleInsert\"\n >\n {{ t.savedBlocks.insert }}\n </button>\n </div>\n </div>\n </div>\n </TplModal>\n</template>\n\n<style>\n/* Subtle breathing so the placeholders read as \"loading\" rather than as empty\n rows. `prefers-reduced-motion` holds them still at full opacity — the bars\n still communicate shape without animating. */\n.tpl-saved-block-skeleton {\n animation: tpl-saved-block-pulse 1.4s ease-in-out infinite;\n}\n\n@keyframes tpl-saved-block-pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.55;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tpl-saved-block-skeleton {\n animation: none;\n }\n}\n\n/* The select button covers only the card's name rows, but keyboard focus rings\n the whole entry. So the button paints the ring on an overlay spanning the\n card instead of on itself: the card is `relative`, and `inset: -1px` reaches\n out over its 1px border. `pointer-events: none` keeps the overlay from taking\n clicks meant for the actions under it. Its radius is the card's\n `--tpl-radius-sm`, so the ring follows the card's corners. */\n.tpl-saved-block-select:focus-visible {\n box-shadow: none;\n}\n\n.tpl-saved-block-select:focus-visible::after {\n content: \"\";\n position: absolute;\n inset: -1px;\n border-radius: var(--tpl-radius-sm);\n box-shadow: var(--tpl-ring);\n pointer-events: none;\n}\n\n.tpl-saved-block-delete-btn:hover {\n color: var(--tpl-danger) !important;\n}\n\n.tpl-saved-block-rename-btn:hover {\n color: var(--tpl-primary) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,oaA4DM+G,KAAiB,2BACjBC,IAAiB,+BACjBC,KAAiB,+B;;;;;EAtCvB,IAAMG,KAAQC,GAIRC,IAAOH,GAKPI,KAAqBzF,SACnB,OAAO,mCACf,CAAA,MAAA,MAAA0F,EAAA,CAAA,CAAA,GAEM,EAAE,MAAG,cAAW/D,GAAQ,GACxBgE,IAAcnE,EAAcD,IAAkB,yBAAyB,GACvEqE,IAASpE,EAAcE,IAAY,yBAAyB,GAC5DmE,KAAW9F,EAAO0B,I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AK,GAAA,GAAAvF,EAAA,E,kBARL,CAAA/F,GAAAyH,EAAA,KAAc,C,MAY3BlI,EAiBM,OAjBNyG,IAiBM,CAhBJzG,EAOS,UAAA;KANP,MAAK;KACL,eAAY;KACZ,OAAM;KACL,SAAOwL;IAEL,GAAAvL,EAAAC,EAAAgJ,CAAA,CAAC,CAAC,YAAY,KAAK,GAAA,CAAA,GAExBlJ,EAOS,UAAA;KANP,MAAK;KACJ,OAAKe,EAAEb,EAAAoD,EAAA,CAAe;KACtB,UAAQ,CAAGyF,EAAA;KACX,SAAOwC;IAEL,GAAAtL,EAAAC,EAAAgJ,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,IAAAxC,EAAA,C"}
|
|
@@ -4,7 +4,7 @@ var c = /* @__PURE__ */ e({
|
|
|
4
4
|
__name: "SavedBlocksPanels",
|
|
5
5
|
props: { feature: {} },
|
|
6
6
|
setup(e) {
|
|
7
|
-
let c = e, l = n(() => import("./SavedBlocksPickBar-
|
|
7
|
+
let c = e, l = n(() => import("./SavedBlocksPickBar-yaCumC4j.js")), u = n(() => import("./SaveBlockDialog-CxdekCYy.js")), d = n(() => import("./SavedBlocksBrowserModal-D9CAa2U3.js"));
|
|
8
8
|
function f(e, t) {
|
|
9
9
|
c.feature.insert(e, t);
|
|
10
10
|
}
|
|
@@ -33,4 +33,4 @@ var c = /* @__PURE__ */ e({
|
|
|
33
33
|
});
|
|
34
34
|
export { c as default };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=SavedBlocksPanels-
|
|
36
|
+
//# sourceMappingURL=SavedBlocksPanels-jfkYWtss.js.map
|
package/dist/cdn/chunks/{SavedBlocksPanels-0ZpX-jXI.js.map → SavedBlocksPanels-jfkYWtss.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavedBlocksPanels-
|
|
1
|
+
{"version":3,"file":"SavedBlocksPanels-jfkYWtss.js","names":["_openBlock","_createElementBlock","_Fragment","_createBlock","_unref","_createCommentVNode","_sfc_main","defineComponent","openBlock","defineAsyncComponent","createElementBlock","unref","createCommentVNode","createBlock","Fragment","SavedBlocksPanels_default","props","__props","SavedBlocksPickBar","SaveBlockDialog","SavedBlocksBrowserModal","handleInsert","saved","insertIndex","_cache"],"sources":["../../../src/components/SavedBlocksPanels.vue","../../../src/components/SavedBlocksPanels.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Mount point for the saved-blocks UI, shared by the OSS and Cloud editors.\n *\n * Everything here is `defineAsyncComponent` rendered behind `v-if` on its own\n * state, so each chunk is fetched only when actually needed —\n * `defineAsyncComponent` triggers its `import()` on first render, not at\n * definition time. `Editor.vue` in turn lazy-loads *this* wrapper and renders\n * it only when a `SavedBlocksProvider` is configured, so a consumer without one\n * downloads none of it.\n *\n * The pick bar lives here rather than in `Editor.vue` so the editor shell needs\n * no knowledge of saved blocks, and the lazy-load guarantee covers the bar too.\n */\nimport { defineAsyncComponent } from \"vue\";\nimport type { SavedBlock } from \"@templatical/types\";\nimport type { UseSavedBlocksFeatureReturn } from \"../composables/useSavedBlocksFeature\";\n\nconst props = defineProps<{\n feature: UseSavedBlocksFeatureReturn;\n}>();\n\nconst SavedBlocksPickBar = defineAsyncComponent(\n () => import(\"./SavedBlocksPickBar.vue\"),\n);\nconst SaveBlockDialog = defineAsyncComponent(\n () => import(\"./SaveBlockDialog.vue\"),\n);\nconst SavedBlocksBrowserModal = defineAsyncComponent(\n () => import(\"./SavedBlocksBrowserModal.vue\"),\n);\n\nfunction handleInsert(\n saved: SavedBlock,\n insertIndex: number | undefined,\n): void {\n props.feature.insert(saved, insertIndex);\n}\n</script>\n\n<template>\n <SavedBlocksPickBar\n v-if=\"feature.isPicking.value\"\n :count=\"feature.pickedCount.value\"\n @confirm=\"feature.confirmPicking()\"\n @cancel=\"feature.cancelPicking()\"\n />\n\n <SaveBlockDialog\n v-if=\"feature.isSaveDialogOpen.value\"\n :visible=\"feature.isSaveDialogOpen.value\"\n :picked-ids=\"[...feature.pickedIds.value]\"\n @close=\"feature.closeSaveDialog()\"\n @saved=\"feature.refresh()\"\n />\n\n <SavedBlocksBrowserModal\n v-if=\"feature.isBrowserOpen.value\"\n :visible=\"feature.isBrowserOpen.value\"\n @close=\"feature.closeBrowser()\"\n @insert=\"handleInsert\"\n />\n</template>\n","<script setup lang=\"ts\">\n/**\n * Mount point for the saved-blocks UI, shared by the OSS and Cloud editors.\n *\n * Everything here is `defineAsyncComponent` rendered behind `v-if` on its own\n * state, so each chunk is fetched only when actually needed —\n * `defineAsyncComponent` triggers its `import()` on first render, not at\n * definition time. `Editor.vue` in turn lazy-loads *this* wrapper and renders\n * it only when a `SavedBlocksProvider` is configured, so a consumer without one\n * downloads none of it.\n *\n * The pick bar lives here rather than in `Editor.vue` so the editor shell needs\n * no knowledge of saved blocks, and the lazy-load guarantee covers the bar too.\n */\nimport { defineAsyncComponent } from \"vue\";\nimport type { SavedBlock } from \"@templatical/types\";\nimport type { UseSavedBlocksFeatureReturn } from \"../composables/useSavedBlocksFeature\";\n\nconst props = defineProps<{\n feature: UseSavedBlocksFeatureReturn;\n}>();\n\nconst SavedBlocksPickBar = defineAsyncComponent(\n () => import(\"./SavedBlocksPickBar.vue\"),\n);\nconst SaveBlockDialog = defineAsyncComponent(\n () => import(\"./SaveBlockDialog.vue\"),\n);\nconst SavedBlocksBrowserModal = defineAsyncComponent(\n () => import(\"./SavedBlocksBrowserModal.vue\"),\n);\n\nfunction handleInsert(\n saved: SavedBlock,\n insertIndex: number | undefined,\n): void {\n props.feature.insert(saved, insertIndex);\n}\n</script>\n\n<template>\n <SavedBlocksPickBar\n v-if=\"feature.isPicking.value\"\n :count=\"feature.pickedCount.value\"\n @confirm=\"feature.confirmPicking()\"\n @cancel=\"feature.cancelPicking()\"\n />\n\n <SaveBlockDialog\n v-if=\"feature.isSaveDialogOpen.value\"\n :visible=\"feature.isSaveDialogOpen.value\"\n :picked-ids=\"[...feature.pickedIds.value]\"\n @close=\"feature.closeSaveDialog()\"\n @saved=\"feature.refresh()\"\n />\n\n <SavedBlocksBrowserModal\n v-if=\"feature.isBrowserOpen.value\"\n :visible=\"feature.isBrowserOpen.value\"\n @close=\"feature.closeBrowser()\"\n @insert=\"handleInsert\"\n />\n</template>\n"],"mappings":";;;;;;EAkBA,IAAMgB,IAAQC,GAIRC,IAAqBT,QACnB,OAAO,mCACf,GACMU,IAAkBV,QAChB,OAAO,gCACf,GACMW,IAA0BX,QACxB,OAAO,wCACf;EAEA,SAASY,EACP,GACA,GACM;GACN,EAAM,QAAQ,OAAOC,GAAOC,CAAW;EACzC;;GAKUN,EAAA,QAAQ,UAAU,SAD1BjB,EAAA,GAAAG,EAKEC,EAAAc,CAAA,GAAA;;IAHC,OAAOD,EAAA,QAAQ,YAAY;IAC3B,WAAO,AAAAO,EAAA,QAAA,MAAEP,EAAA,QAAQ,eAAc;IAC/B,UAAM,AAAAO,EAAA,QAAA,MAAEP,EAAA,QAAQ,cAAa;;GAIxBA,EAAA,QAAQ,iBAAiB,SADjCjB,EAAA,GAAAG,EAMEC,EAAAe,CAAA,GAAA;;IAJC,SAASF,EAAA,QAAQ,iBAAiB;IAClC,cAAU,CAAA,GAAMA,EAAA,QAAQ,UAAU,KAAK;IACvC,SAAK,AAAAO,EAAA,QAAA,MAAEP,EAAA,QAAQ,gBAAe;IAC9B,SAAK,AAAAO,EAAA,QAAA,MAAEP,EAAA,QAAQ,QAAO;;GAIjBA,EAAA,QAAQ,cAAc,SAD9BjB,EAAA,GAAAG,EAKEC,EAAAgB,CAAA,GAAA;;IAHC,SAASH,EAAA,QAAQ,cAAc;IAC/B,SAAK,AAAAO,EAAA,QAAA,MAAEP,EAAA,QAAQ,aAAY;IAC3B,UAAQI"}
|
|
@@ -2,7 +2,7 @@ import { C as e, F as t, _ as n, b as r, ct as i, dt as a, m as o, mt as s, x as
|
|
|
2
2
|
import { Wt as l, t as u } from "./icons-Da9GKjPx.js";
|
|
3
3
|
import { t as d } from "./useI18n-BnJYydPv.js";
|
|
4
4
|
import { C as f, b as p } from "./styleConstants-CgiNKdnc.js";
|
|
5
|
-
import "./composables-
|
|
5
|
+
import "./composables-BxikPuC1.js";
|
|
6
6
|
// src/components/SavedBlocksPickBar.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var m = {
|
|
8
8
|
"data-testid": "saved-blocks-pick-bar",
|
|
@@ -51,4 +51,4 @@ var m = {
|
|
|
51
51
|
});
|
|
52
52
|
export { x as default };
|
|
53
53
|
|
|
54
|
-
//# sourceMappingURL=SavedBlocksPickBar-
|
|
54
|
+
//# sourceMappingURL=SavedBlocksPickBar-yaCumC4j.js.map
|
package/dist/cdn/chunks/{SavedBlocksPickBar-DHah-Uf7.js.map → SavedBlocksPickBar-yaCumC4j.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavedBlocksPickBar-
|
|
1
|
+
{"version":3,"file":"SavedBlocksPickBar-yaCumC4j.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_toDisplayString","_normalizeClass","_createVNode","_createTextVNode","_sfc_main","defineComponent","openBlock","createElementBlock","createTextVNode","unref","normalizeClass","createBaseVNode","toDisplayString","createVNode","Bookmark","X","useI18n","secondaryBtnClass","primaryBtnClass","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","SavedBlocksPickBar_default","__emit","props","__props","emit","handleConfirm","t","format","_cache"],"sources":["../../../src/components/SavedBlocksPickBar.vue","../../../src/components/SavedBlocksPickBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Floating bar for an active pick session: how many blocks are picked, plus\n * Save and Cancel.\n *\n * Positioned like `EditorFooter` — absolute inside `.tpl`, NOT inside the\n * canvas body, whose `overflow: auto` would clip it. The rail offsets are the\n * non-preview ones because a session can't be active in preview mode\n * (`useSavedBlocksFeature` cancels it if preview turns on).\n */\nimport { useI18n } from \"../composables\";\nimport {\n primaryBtnClass,\n secondaryBtnClass,\n} from \"../constants/styleConstants\";\nimport { Bookmark, X } from \"@lucide/vue\";\n\nconst props = defineProps<{\n count: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"confirm\"): void;\n (e: \"cancel\"): void;\n}>();\n\nconst { t, format } = useI18n();\n\nfunction handleConfirm(): void {\n if (props.count > 0) emit(\"confirm\");\n}\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-pick-bar\"\n class=\"tpl:absolute tpl:bottom-10 tpl:left-12 tpl:right-[320px] tpl:z-50 tpl:flex tpl:justify-center tpl:px-4\"\n style=\"pointer-events: none\"\n >\n <div\n role=\"toolbar\"\n :aria-label=\"t.savedBlocks.pickToolbar\"\n class=\"tpl-scale-in tpl:flex tpl:items-center tpl:gap-3 tpl:rounded-[var(--tpl-radius-lg)] tpl:border tpl:py-2 tpl:pl-4 tpl:pr-2 tpl:border-[var(--tpl-border)]\"\n style=\"\n pointer-events: auto;\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <div class=\"tpl:flex tpl:flex-col\">\n <span\n data-testid=\"saved-blocks-pick-count\"\n class=\"tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text)]\"\n >\n {{ format(t.savedBlocks.pickCount, { count }) }}\n </span>\n <span class=\"tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\">\n {{ t.savedBlocks.pickHint }}\n </span>\n </div>\n\n <div class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <button\n type=\"button\"\n data-testid=\"saved-blocks-pick-cancel\"\n :class=\"secondaryBtnClass\"\n @click=\"emit('cancel')\"\n >\n <X :size=\"13\" :stroke-width=\"2\" />\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n data-testid=\"saved-blocks-pick-confirm\"\n :class=\"primaryBtnClass\"\n :disabled=\"count === 0\"\n @click=\"handleConfirm\"\n >\n <Bookmark :size=\"13\" :stroke-width=\"2\" />\n {{ t.savedBlocks.save }}\n </button>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * Floating bar for an active pick session: how many blocks are picked, plus\n * Save and Cancel.\n *\n * Positioned like `EditorFooter` — absolute inside `.tpl`, NOT inside the\n * canvas body, whose `overflow: auto` would clip it. The rail offsets are the\n * non-preview ones because a session can't be active in preview mode\n * (`useSavedBlocksFeature` cancels it if preview turns on).\n */\nimport { useI18n } from \"../composables\";\nimport {\n primaryBtnClass,\n secondaryBtnClass,\n} from \"../constants/styleConstants\";\nimport { Bookmark, X } from \"@lucide/vue\";\n\nconst props = defineProps<{\n count: number;\n}>();\n\nconst emit = defineEmits<{\n (e: \"confirm\"): void;\n (e: \"cancel\"): void;\n}>();\n\nconst { t, format } = useI18n();\n\nfunction handleConfirm(): void {\n if (props.count > 0) emit(\"confirm\");\n}\n</script>\n\n<template>\n <div\n data-testid=\"saved-blocks-pick-bar\"\n class=\"tpl:absolute tpl:bottom-10 tpl:left-12 tpl:right-[320px] tpl:z-50 tpl:flex tpl:justify-center tpl:px-4\"\n style=\"pointer-events: none\"\n >\n <div\n role=\"toolbar\"\n :aria-label=\"t.savedBlocks.pickToolbar\"\n class=\"tpl-scale-in tpl:flex tpl:items-center tpl:gap-3 tpl:rounded-[var(--tpl-radius-lg)] tpl:border tpl:py-2 tpl:pl-4 tpl:pr-2 tpl:border-[var(--tpl-border)]\"\n style=\"\n pointer-events: auto;\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <div class=\"tpl:flex tpl:flex-col\">\n <span\n data-testid=\"saved-blocks-pick-count\"\n class=\"tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text)]\"\n >\n {{ format(t.savedBlocks.pickCount, { count }) }}\n </span>\n <span class=\"tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\">\n {{ t.savedBlocks.pickHint }}\n </span>\n </div>\n\n <div class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <button\n type=\"button\"\n data-testid=\"saved-blocks-pick-cancel\"\n :class=\"secondaryBtnClass\"\n @click=\"emit('cancel')\"\n >\n <X :size=\"13\" :stroke-width=\"2\" />\n {{ t.savedBlocks.cancel }}\n </button>\n <button\n type=\"button\"\n data-testid=\"saved-blocks-pick-confirm\"\n :class=\"primaryBtnClass\"\n :disabled=\"count === 0\"\n @click=\"handleConfirm\"\n >\n <Bookmark :size=\"13\" :stroke-width=\"2\" />\n {{ t.savedBlocks.save }}\n </button>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAiBA,IAAMgC,IAAQC,GAIRC,IAAOH,GAKP,EAAE,MAAG,cAAWX,EAAQ;EAE9B,SAASe,IAAsB;GAC7B,AAAIH,EAAM,QAAQ,KAAGE,EAAK,SAAS;EACrC;E,kBAIElC,EAAA,GAAAC,EAiDM,OAjDNsB,GAiDM,CA5CJrB,EA2CM,OAAA;GA1CJ,MAAK;GACJ,cAAYC,EAAAiC,CAAA,CAAC,CAAC,YAAY;GAC3B,OAAM;GACN,OAAA;IAAA,kBAAA;IAAA,oBAAA;IAAA,cAAA;GAAA;E,IAMAlC,EAUM,OAVNuB,GAUM,CATJvB,EAKO,QALPwB,GAKOtB,EADFD,EAAAkC,CAAA,CAAM,CAAClC,EAAAiC,CAAA,CAAC,CAAC,YAAY,WAAS,EAAA,OAAIH,EAAA,MAAK,CAAA,CAAA,GAAA,CAAA,GAE5C/B,EAEO,QAFPyB,GAEOvB,EADFD,EAAAiC,CAAA,CAAC,CAAC,YAAY,QAAQ,GAAA,CAAA,C,IAI7BlC,EAoBM,OApBN0B,GAoBM,CAnBJ1B,EAQS,UAAA;GAPP,MAAK;GACL,eAAY;GACX,OAAKG,EAAEF,EAAAkB,CAAA,CAAiB;GACxB,SAAK,AAAAiB,EAAA,QAAA,MAAEJ,EAAI,QAAA;E,IAEZ5B,EAAkCH,EAAAgB,CAAA,GAAA;GAA9B,MAAM;GAAK,gBAAc;E,IAAKZ,EAAA,MAClCH,EAAGD,EAAAiC,CAAA,CAAC,CAAC,YAAY,MAAM,GAAA,CAAA,C,OAEzBlC,EASS,UAAA;GARP,MAAK;GACL,eAAY;GACX,OAAKG,EAAEF,EAAAmB,CAAA,CAAe;GACtB,UAAUW,EAAA,UAAK;GACf,SAAOE;E,IAER7B,EAAyCH,EAAAe,CAAA,GAAA;GAA9B,MAAM;GAAK,gBAAc;E,IAAKX,EAAA,MACzCH,EAAGD,EAAAiC,CAAA,CAAC,CAAC,YAAY,IAAI,GAAA,CAAA,C"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { C as e, F as t, G as n, L as r, O as i, _ as a, ct as o, dt as s, g as c, m as l, mt as u, p as d, pt as ee, u as f, x as p } from "./draggable-DepKdldn.js";
|
|
2
|
-
import { ct as te } from "./src-
|
|
2
|
+
import { ct as te } from "./src-ZFw5fg_z.js";
|
|
3
3
|
import { Dt as ne, Pt as re, T as m, gt as h, xt as g } from "./icons-Da9GKjPx.js";
|
|
4
4
|
import { $ as ie, b as ae, ot as oe } from "./keys-CoQtCqNv.js";
|
|
5
5
|
import { t as se } from "./useI18n-BnJYydPv.js";
|
|
6
6
|
import { _ as ce, g as le, h as _, l as ue, t as de, v } from "./styleConstants-CgiNKdnc.js";
|
|
7
7
|
import { n as y, t as b } from "./templateSettingsFields-cjlP-jdw.js";
|
|
8
|
-
import { n as x, t as S } from "./MergeTagTextarea-
|
|
9
|
-
import { c as C } from "./LogicTagInsertButton-
|
|
8
|
+
import { n as x, t as S } from "./MergeTagTextarea-BMsnjphR.js";
|
|
9
|
+
import { c as C } from "./LogicTagInsertButton-PDKuo2J3.js";
|
|
10
10
|
import { t as w } from "./ToggleSwitch-BSkySwA1.js";
|
|
11
|
-
import { n as T, t as E } from "./withCurrentFont-
|
|
11
|
+
import { n as T, t as E } from "./withCurrentFont-BcoPpkDS.js";
|
|
12
12
|
// src/components/TemplateSettings.vue?vue&type=script&setup=true&lang.ts
|
|
13
13
|
var D = {
|
|
14
14
|
"data-testid": "template-settings",
|
|
@@ -263,4 +263,4 @@ var D = {
|
|
|
263
263
|
});
|
|
264
264
|
export { W as default };
|
|
265
265
|
|
|
266
|
-
//# sourceMappingURL=TemplateSettings-
|
|
266
|
+
//# sourceMappingURL=TemplateSettings-SaV2UVh_.js.map
|