@formicoidea/labre-core 0.49.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/_pkgs/affine-block-attachment/asset-picker.d.ts +24 -0
  2. package/dist/_pkgs/affine-block-attachment/asset-picker.js +87 -0
  3. package/dist/_pkgs/affine-block-attachment/configs/slash-menu.js +3 -20
  4. package/dist/_pkgs/affine-block-attachment/index.d.ts +1 -0
  5. package/dist/_pkgs/affine-block-attachment/index.js +1 -0
  6. package/dist/_pkgs/affine-block-attachment/utils.d.ts +9 -1
  7. package/dist/_pkgs/affine-block-attachment/utils.js +9 -0
  8. package/dist/_pkgs/affine-block-bookmark/adapters/markdown/markdown.js +14 -1
  9. package/dist/_pkgs/affine-block-bookmark/adapters/notion-html.js +5 -1
  10. package/dist/_pkgs/affine-block-database/adapters/markdown.js +5 -3
  11. package/dist/_pkgs/affine-block-embed/common/adapters/html.js +5 -3
  12. package/dist/_pkgs/affine-block-embed/common/adapters/markdown.js +11 -0
  13. package/dist/_pkgs/affine-block-frame/frame-template.d.ts +58 -0
  14. package/dist/_pkgs/affine-block-frame/frame-template.js +207 -0
  15. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +19 -3
  16. package/dist/_pkgs/affine-block-frame/index.d.ts +1 -0
  17. package/dist/_pkgs/affine-block-frame/index.js +1 -0
  18. package/dist/_pkgs/affine-block-frame/translations.d.ts +7 -0
  19. package/dist/_pkgs/affine-block-frame/translations.js +16 -1
  20. package/dist/_pkgs/affine-block-frame/view.js +6 -0
  21. package/dist/_pkgs/affine-block-image/asset-picker.d.ts +63 -0
  22. package/dist/_pkgs/affine-block-image/asset-picker.js +183 -0
  23. package/dist/_pkgs/affine-block-image/commands/insert-images.d.ts +5 -0
  24. package/dist/_pkgs/affine-block-image/commands/insert-images.js +8 -8
  25. package/dist/_pkgs/affine-block-image/components/page-image-block.d.ts +11 -0
  26. package/dist/_pkgs/affine-block-image/components/page-image-block.js +81 -12
  27. package/dist/_pkgs/affine-block-image/configs/replace-action.d.ts +9 -0
  28. package/dist/_pkgs/affine-block-image/configs/replace-action.js +27 -0
  29. package/dist/_pkgs/affine-block-image/configs/toolbar.js +6 -0
  30. package/dist/_pkgs/affine-block-image/crop/crop-controller.d.ts +46 -0
  31. package/dist/_pkgs/affine-block-image/crop/crop-controller.js +104 -0
  32. package/dist/_pkgs/affine-block-image/crop/crop-math.d.ts +70 -0
  33. package/dist/_pkgs/affine-block-image/crop/crop-math.js +141 -0
  34. package/dist/_pkgs/affine-block-image/crop/crop-overlay.d.ts +57 -0
  35. package/dist/_pkgs/affine-block-image/crop/crop-overlay.js +343 -0
  36. package/dist/_pkgs/affine-block-image/crop/crop-toolbar.d.ts +12 -0
  37. package/dist/_pkgs/affine-block-image/crop/crop-toolbar.js +78 -0
  38. package/dist/_pkgs/affine-block-image/crop/write-crop.d.ts +16 -0
  39. package/dist/_pkgs/affine-block-image/crop/write-crop.js +57 -0
  40. package/dist/_pkgs/affine-block-image/edgeless-clipboard-config.js +4 -1
  41. package/dist/_pkgs/affine-block-image/effects.js +2 -0
  42. package/dist/_pkgs/affine-block-image/image-block.d.ts +2 -0
  43. package/dist/_pkgs/affine-block-image/image-block.js +2 -0
  44. package/dist/_pkgs/affine-block-image/image-edgeless-block.d.ts +2 -0
  45. package/dist/_pkgs/affine-block-image/image-edgeless-block.js +36 -8
  46. package/dist/_pkgs/affine-block-image/image-resize-manager.js +15 -0
  47. package/dist/_pkgs/affine-block-image/index.d.ts +1 -0
  48. package/dist/_pkgs/affine-block-image/index.js +1 -0
  49. package/dist/_pkgs/affine-block-image/translations.d.ts +15 -0
  50. package/dist/_pkgs/affine-block-image/translations.js +43 -0
  51. package/dist/_pkgs/affine-block-image/utils.d.ts +13 -0
  52. package/dist/_pkgs/affine-block-image/utils.js +10 -1
  53. package/dist/_pkgs/affine-block-root/clipboard/page-clipboard.js +5 -0
  54. package/dist/_pkgs/affine-block-root/commands/page-export-commands.d.ts +2 -0
  55. package/dist/_pkgs/affine-block-root/commands/page-export-commands.js +71 -0
  56. package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
  57. package/dist/_pkgs/affine-block-root/index.js +1 -0
  58. package/dist/_pkgs/affine-block-root/view.js +8 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.d.ts +30 -0
  60. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.js +44 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.d.ts +26 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.js +82 -0
  63. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.d.ts +18 -0
  64. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.js +91 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.d.ts +3 -0
  66. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.js +3 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.d.ts +50 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.js +732 -0
  69. package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.d.ts +12 -0
  70. package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.js +15 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +7 -1
  72. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +7 -1
  73. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +60 -1
  74. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +2 -2
  75. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +2 -2
  76. package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.d.ts +6 -0
  77. package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.js +8 -0
  78. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +28 -1
  79. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +66 -6
  80. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +2 -7
  81. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +2 -6
  82. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +2 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/index.js +2 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/interchange-export.d.ts +84 -0
  85. package/dist/_pkgs/affine-block-surface/extensions/interchange-export.js +150 -0
  86. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +24 -2
  87. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +23 -2
  88. package/dist/_pkgs/affine-block-surface/extensions/interchange.js +4 -1
  89. package/dist/_pkgs/affine-block-surface/extensions/legend-role.d.ts +18 -0
  90. package/dist/_pkgs/affine-block-surface/extensions/legend-role.js +20 -0
  91. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +2 -19
  92. package/dist/_pkgs/affine-block-surface/extensions/legend.js +2 -18
  93. package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.d.ts +67 -0
  94. package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.js +235 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +1 -0
  96. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +9 -0
  97. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +17 -13
  98. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +52 -80
  99. package/dist/_pkgs/affine-block-surface/extensions/xml-element.d.ts +98 -0
  100. package/dist/_pkgs/affine-block-surface/extensions/xml-element.js +261 -0
  101. package/dist/_pkgs/affine-block-surface/extensions/xml-reader.d.ts +238 -0
  102. package/dist/_pkgs/affine-block-surface/extensions/xml-reader.js +570 -0
  103. package/dist/_pkgs/affine-block-surface/framework-background/def.js +1 -1
  104. package/dist/_pkgs/affine-block-surface/interchange-headless.d.ts +29 -0
  105. package/dist/_pkgs/affine-block-surface/interchange-headless.js +32 -0
  106. package/dist/_pkgs/affine-block-surface/view.js +22 -2
  107. package/dist/_pkgs/affine-block-table/adapters/utils.js +24 -1
  108. package/dist/_pkgs/affine-components/color-picker/color-panel.d.ts +11 -0
  109. package/dist/_pkgs/affine-components/color-picker/color-panel.js +87 -12
  110. package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +8 -0
  111. package/dist/_pkgs/affine-components/color-picker/framework-palette.js +11 -3
  112. package/dist/_pkgs/affine-components/color-picker/icons.d.ts +9 -0
  113. package/dist/_pkgs/affine-components/color-picker/icons.js +12 -0
  114. package/dist/_pkgs/affine-gfx-note/toolbar/note-menu.js +5 -8
  115. package/dist/_pkgs/affine-gfx-template/contribute.d.ts +14 -4
  116. package/dist/_pkgs/affine-gfx-template/contribute.js +47 -6
  117. package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.d.ts +7 -2
  118. package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.js +14 -40
  119. package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.d.ts +1 -1
  120. package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.js +1 -1
  121. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.d.ts +4 -4
  122. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +9 -9
  123. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +2 -4
  124. package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
  125. package/dist/_pkgs/affine-gfx-template/translations.js +9 -0
  126. package/dist/_pkgs/affine-inline-footnote/adapters/markdown/inline-delta.js +6 -0
  127. package/dist/_pkgs/affine-inline-footnote/adapters/markdown/markdown-inline.js +7 -0
  128. package/dist/_pkgs/affine-inline-link/adapters/html/html-inline.js +4 -1
  129. package/dist/_pkgs/affine-inline-link/adapters/html/inline-delta.js +3 -1
  130. package/dist/_pkgs/affine-inline-link/adapters/markdown/inline-delta.js +4 -1
  131. package/dist/_pkgs/affine-inline-link/adapters/notion-html/html-inline.js +2 -1
  132. package/dist/_pkgs/affine-inline-link/link-node/affine-link.d.ts +7 -0
  133. package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +37 -0
  134. package/dist/_pkgs/affine-inline-link/link-node/index.d.ts +1 -0
  135. package/dist/_pkgs/affine-inline-link/link-node/index.js +1 -0
  136. package/dist/_pkgs/affine-inline-link/link-node/propose-views.d.ts +22 -0
  137. package/dist/_pkgs/affine-inline-link/link-node/propose-views.js +59 -0
  138. package/dist/_pkgs/affine-model/blocks/database/types.d.ts +28 -0
  139. package/dist/_pkgs/affine-model/blocks/image/image-crop.d.ts +48 -0
  140. package/dist/_pkgs/affine-model/blocks/image/image-crop.js +78 -0
  141. package/dist/_pkgs/affine-model/blocks/image/image-model.d.ts +6 -0
  142. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  143. package/dist/_pkgs/affine-model/blocks/image/index.d.ts +1 -0
  144. package/dist/_pkgs/affine-model/blocks/image/index.js +1 -0
  145. package/dist/_pkgs/affine-model/consts/shape.d.ts +2 -0
  146. package/dist/_pkgs/affine-model/consts/shape.js +5 -0
  147. package/dist/_pkgs/affine-model/elements/bpmn/consts.d.ts +31 -0
  148. package/dist/_pkgs/affine-model/elements/bpmn/consts.js +31 -0
  149. package/dist/_pkgs/affine-model/elements/bpmn/index.d.ts +1 -0
  150. package/dist/_pkgs/affine-model/elements/bpmn/index.js +1 -0
  151. package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +0 -25
  152. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -25
  153. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +0 -2
  154. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -2
  155. package/dist/_pkgs/affine-model/elements/uml/consts.d.ts +133 -0
  156. package/dist/_pkgs/affine-model/elements/uml/consts.js +107 -0
  157. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +1 -79
  158. package/dist/_pkgs/affine-model/elements/uml/diagram.js +1 -53
  159. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +0 -15
  160. package/dist/_pkgs/affine-model/elements/uml/fragment.js +1 -15
  161. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +1 -0
  162. package/dist/_pkgs/affine-model/elements/uml/index.js +1 -0
  163. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +0 -20
  164. package/dist/_pkgs/affine-model/elements/uml/partition.js +1 -20
  165. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +0 -11
  166. package/dist/_pkgs/affine-model/elements/uml/region.js +1 -11
  167. package/dist/_pkgs/affine-model/headless.d.ts +19 -0
  168. package/dist/_pkgs/affine-model/headless.js +19 -0
  169. package/dist/_pkgs/affine-shared/headless.d.ts +10 -0
  170. package/dist/_pkgs/affine-shared/headless.js +10 -0
  171. package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +63 -0
  172. package/dist/_pkgs/affine-shared/services/asset-picker-service.js +20 -0
  173. package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +6 -3
  174. package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +83 -0
  175. package/dist/_pkgs/affine-shared/services/frame-template-service.js +17 -0
  176. package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
  177. package/dist/_pkgs/affine-shared/services/index.js +2 -0
  178. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +6 -0
  179. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +10 -0
  180. package/dist/_pkgs/affine-widget-drag-handle/watchers/drag-event-watcher.js +8 -3
  181. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +4 -16
  182. package/dist/_pkgs/affine-widget-linked-doc/transformers/html.d.ts +7 -0
  183. package/dist/_pkgs/affine-widget-linked-doc/transformers/html.js +25 -24
  184. package/dist/_pkgs/affine-widget-linked-doc/transformers/index.d.ts +1 -1
  185. package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +7 -0
  186. package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +26 -25
  187. package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +23 -0
  188. package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +14 -0
  189. package/dist/_pkgs/data-view/core/common/properties.d.ts +29 -0
  190. package/dist/_pkgs/data-view/core/common/properties.js +110 -8
  191. package/dist/_pkgs/data-view/core/common/property-menu.d.ts +44 -1
  192. package/dist/_pkgs/data-view/core/common/property-menu.js +100 -3
  193. package/dist/_pkgs/data-view/core/component/tags/color-carousel.d.ts +41 -0
  194. package/dist/_pkgs/data-view/core/component/tags/color-carousel.js +199 -0
  195. package/dist/_pkgs/data-view/core/component/tags/color-menu.d.ts +49 -0
  196. package/dist/_pkgs/data-view/core/component/tags/color-menu.js +123 -0
  197. package/dist/_pkgs/data-view/core/component/tags/index.d.ts +3 -0
  198. package/dist/_pkgs/data-view/core/component/tags/index.js +3 -0
  199. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +8 -1
  200. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +21 -20
  201. package/dist/_pkgs/data-view/core/component/tags/softened-colors.d.ts +42 -0
  202. package/dist/_pkgs/data-view/core/component/tags/softened-colors.js +79 -0
  203. package/dist/_pkgs/data-view/core/data-view.d.ts +8 -1
  204. package/dist/_pkgs/data-view/core/data-view.js +18 -2
  205. package/dist/_pkgs/data-view/core/effect.js +2 -1
  206. package/dist/_pkgs/data-view/core/filter/eval.d.ts +6 -1
  207. package/dist/_pkgs/data-view/core/filter/eval.js +7 -2
  208. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +3 -0
  209. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +119 -71
  210. package/dist/_pkgs/data-view/core/view/color-rules.d.ts +85 -0
  211. package/dist/_pkgs/data-view/core/view/color-rules.js +165 -0
  212. package/dist/_pkgs/data-view/core/view/index.d.ts +1 -0
  213. package/dist/_pkgs/data-view/core/view/index.js +1 -0
  214. package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +1 -0
  215. package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +1 -0
  216. package/dist/_pkgs/data-view/translations.d.ts +34 -0
  217. package/dist/_pkgs/data-view/translations.js +80 -0
  218. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +7 -1
  219. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +6 -1
  220. package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +6 -1
  221. package/dist/_pkgs/data-view/view-presets/list/list-view.js +4 -0
  222. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +3 -0
  223. package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.d.ts +3 -1
  224. package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.js +149 -175
  225. package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +6 -0
  226. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.d.ts +12 -0
  227. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.js +206 -0
  228. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +16 -2
  229. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +4 -2
  230. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +11 -2
  231. package/dist/commands.js +5 -2
  232. package/dist/host-panels.d.ts +21 -1
  233. package/dist/host-panels.js +50 -10
  234. package/dist/interchange.d.ts +1 -0
  235. package/dist/interchange.js +1 -0
  236. package/dist/model/headless.d.ts +1 -0
  237. package/dist/model/headless.js +1 -0
  238. package/dist/shared/headless.d.ts +1 -0
  239. package/dist/shared/headless.js +1 -0
  240. package/dist/translations.js +8 -1
  241. package/package.json +13 -1
@@ -1,10 +1,10 @@
1
- import { ExportToPdfIcon, ExportToPngIcon, GridIcon, } from '@blocksuite/icons/lit';
1
+ import { ExportIcon, ExportToPdfIcon, ExportToPngIcon, ExportToSvgIcon, GridIcon, } from '@blocksuite/icons/lit';
2
2
  import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
3
3
  import { CanvasGrid, CanvasLocalVisibility, } from '../affine-shared/services/index.js';
4
4
  import { BlockViewExtension, CommandExtension, FlavourExtension, } from '../std/index.js';
5
5
  import { literal } from 'lit/static-html.js';
6
6
  import { effects } from './effects.js';
7
- import { auditCommands, CanvasActiveLayer, canvasExportCommands, canvasGridCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, exportSvgCommands, exportSvgToolbarExtension, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, selectionPaneCommands, SelectionPaneModel, SpotlightManager, UserLayerMiddlewareBuilder, userLayerCommands, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
7
+ import { auditCommands, CanvasActiveLayer, canvasDrawioExportCommands, canvasExportCommands, CANVAS_INTERCHANGE, canvasGridCommands, canvasSvgExportCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, exportSvgCommands, INTERCHANGE_EXPORT_ICON_KEY, InterchangeExtension, exportSvgToolbarExtension, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, selectionPaneCommands, SelectionPaneModel, SpotlightManager, UserLayerMiddlewareBuilder, userLayerCommands, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
8
8
  import { ExportManagerExtension } from './extensions/export-manager/export-manager.js';
9
9
  import { BackgroundStackingExtension } from './framework-background/stacking.js';
10
10
  import { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
@@ -97,6 +97,26 @@ export class SurfaceViewExtension extends ViewExtensionProvider {
97
97
  'canvas.export.png': ExportToPngIcon(),
98
98
  'canvas.export.pdf': ExportToPdfIcon(),
99
99
  }));
100
+ // The canvas as a draw.io drawing (ADR 0019, amendment of 2026-10-14):
101
+ // the third "This view" export, and the registry's one capability no
102
+ // framework owns. Never gated, for the PNG's reason — it writes what the
103
+ // canvas paints, whatever drew it — so with every framework off the
104
+ // registry still answers `canvas:drawio:export`.
105
+ context.register(InterchangeExtension(CANVAS_INTERCHANGE));
106
+ context.register(CommandExtension(canvasDrawioExportCommands, {
107
+ 'canvas.export.drawio': ExportIcon(),
108
+ // The icon of the view actions derived from the frameworks'
109
+ // `*:export` capabilities (`interchange-export.ts`): they are
110
+ // listed by the host façade, never registered as commands, so their
111
+ // one icon rides on this table.
112
+ [INTERCHANGE_EXPORT_ICON_KEY]: ExportIcon(),
113
+ }));
114
+ // The whole canvas as SVG (ADR 0034, amendment of 2026-10-14): the
115
+ // renderer replay of `export.svg`, over everything this viewer sees.
116
+ // Never gated, for the PNG's reason.
117
+ context.register(CommandExtension(canvasSvgExportCommands, {
118
+ 'canvas.export.svg': ExportToSvgIcon(),
119
+ }));
100
120
  // User layers (ADR 0031 §2-§6): the viewer's active layer (session
101
121
  // only), the `beforeAdd` middleware that stamps it on what is created,
102
122
  // and the commands the pane's layer rows run. Content, never gated.
@@ -130,12 +130,35 @@ export const parseTableFromHtml = (element, astToDelta) => {
130
130
  });
131
131
  return createTableProps(rowTextLists);
132
132
  };
133
+ /**
134
+ * A cell holds rich text, and no inline matcher turns an `image` into a delta:
135
+ * `![alt](url)` in a pasted Markdown table used to vanish from its cell. It is
136
+ * kept as a link named by its alt text (its URL when it has none), so nothing
137
+ * of the source is lost; the link matcher still refuses an unsafe scheme and
138
+ * keeps the words (labre REQ-IM-2, "no data loss").
139
+ */
140
+ function imagesAsLinks(node) {
141
+ if (node.type === 'image') {
142
+ return {
143
+ type: 'link',
144
+ url: node.url,
145
+ title: node.title,
146
+ children: [{ type: 'text', value: node.alt || node.url }],
147
+ };
148
+ }
149
+ if (!('children' in node))
150
+ return node;
151
+ return {
152
+ ...node,
153
+ children: node.children.map(child => imagesAsLinks(child)),
154
+ };
155
+ }
133
156
  export const parseTableFromMarkdown = (node, astToDelta) => {
134
157
  const rowTextLists = [];
135
158
  node.children.forEach(row => {
136
159
  const rowText = [];
137
160
  row.children.forEach(cell => {
138
- rowText.push(astToDelta(cell));
161
+ rowText.push(astToDelta(imagesAsLinks(cell)));
139
162
  });
140
163
  rowTextLists.push(rowText);
141
164
  });
@@ -16,6 +16,17 @@ export declare class EdgelessColorPanel extends LitElement {
16
16
  select(palette: Palette): void;
17
17
  get resolvedValue(): string | null;
18
18
  willUpdate(changedProperties: PropertyValues<this>): void;
19
+ connectedCallback(): void;
20
+ /**
21
+ * The keyboard path of the grid (a roving tab stop, ADR 0036 amendment of
22
+ * 2026-10-14): Tab reaches one swatch, the current colour or the first;
23
+ * the arrows move between swatches (up and down by `columns` when the grid
24
+ * declares them, else by one); Enter or Space picks, through the same
25
+ * click a pointer sends. A handled key goes no further, so the canvas does
26
+ * not also read it as a nudge or a pan.
27
+ */
28
+ private readonly _onKeydown;
29
+ private _focusIndex;
19
30
  render(): import("lit-html").TemplateResult<1>;
20
31
  accessor hasTransparent: boolean;
21
32
  accessor hollowCircle: boolean;
@@ -142,6 +142,12 @@ let EdgelessColorButton = (() => {
142
142
  :host([active])::after {
143
143
  border: 1.5px solid var(--affine-primary-color);
144
144
  }
145
+
146
+ :host(:focus-visible) {
147
+ outline: 2px solid ${unsafeCSSVarV2('layer/insideBorder/primaryBorder')};
148
+ outline-offset: 2px;
149
+ border-radius: 50%;
150
+ }
145
151
  `; }
146
152
  get preprocessColor() {
147
153
  const value = resolveColor(this.color, this.theme);
@@ -150,7 +156,11 @@ let EdgelessColorButton = (() => {
150
156
  render() {
151
157
  const { label, preprocessColor, hollowCircle } = this;
152
158
  const additionIcon = AdditionIcon(preprocessColor, !!hollowCircle);
153
- return html `<div class="color-unit" aria-label=${ifDefined(label)}>
159
+ return html `<div
160
+ class="color-unit"
161
+ aria-label=${ifDefined(label)}
162
+ title=${ifDefined(label)}
163
+ >
154
164
  ${additionIcon}
155
165
  </div>`;
156
166
  }
@@ -268,38 +278,56 @@ let EdgelessColorPanel = (() => {
268
278
  }
269
279
  }
270
280
  }
281
+ connectedCallback() {
282
+ super.connectedCallback();
283
+ if (!this.hasAttribute('role'))
284
+ this.setAttribute('role', 'radiogroup');
285
+ }
271
286
  render() {
287
+ const resolvedValue = this.resolvedValue;
288
+ const resolved = this.palettes.map(palette => resolveColor(palette.value, this.theme));
289
+ const activeIndex = resolved.findIndex(color => isEqual(color, resolvedValue));
290
+ const focusIndex = this._focusIndex !== undefined && this._focusIndex < resolved.length
291
+ ? this._focusIndex
292
+ : Math.max(activeIndex, 0);
272
293
  return html `
273
- ${repeat(this.palettes, palette => palette.key, palette => {
274
- const resolvedColor = resolveColor(palette.value, this.theme);
275
- const activated = isEqual(resolvedColor, this.resolvedValue);
294
+ ${repeat(this.palettes, palette => palette.key, (palette, index) => {
295
+ const resolvedColor = resolved[index] ?? '';
296
+ const activated = isEqual(resolvedColor, resolvedValue);
297
+ const label = resolvePaletteLabel(this.std, palette);
276
298
  return html `<edgeless-color-button
277
299
  class=${classMap({ large: true })}
278
- .label=${resolvePaletteLabel(this.std, palette)}
300
+ role="radio"
301
+ aria-checked=${activated ? 'true' : 'false'}
302
+ aria-label=${label}
303
+ tabindex=${index === focusIndex ? '0' : '-1'}
304
+ .label=${label}
279
305
  .color=${palette.value}
280
306
  .theme=${this.theme}
281
307
  .hollowCircle=${this.hollowCircle}
282
308
  ?active=${activated}
283
309
  @click=${() => {
310
+ this._focusIndex = index;
284
311
  this.select(palette);
285
312
  this.value = resolvedColor;
286
313
  }}
314
+ @keydown=${(event) => this._onKeydown(event, index)}
287
315
  >
288
316
  </edgeless-color-button>`;
289
317
  })}
290
318
  <slot name="custom"></slot>
291
319
  `;
292
320
  }
293
- #hasTransparent_accessor_storage = __runInitializers(this, _hasTransparent_initializers, true);
321
+ #hasTransparent_accessor_storage;
294
322
  get hasTransparent() { return this.#hasTransparent_accessor_storage; }
295
323
  set hasTransparent(value) { this.#hasTransparent_accessor_storage = value; }
296
- #hollowCircle_accessor_storage = (__runInitializers(this, _hasTransparent_extraInitializers), __runInitializers(this, _hollowCircle_initializers, false));
324
+ #hollowCircle_accessor_storage;
297
325
  get hollowCircle() { return this.#hollowCircle_accessor_storage; }
298
326
  set hollowCircle(value) { this.#hollowCircle_accessor_storage = value; }
299
- #palettes_accessor_storage = (__runInitializers(this, _hollowCircle_extraInitializers), __runInitializers(this, _palettes_initializers, DefaultTheme.Palettes));
327
+ #palettes_accessor_storage;
300
328
  get palettes() { return this.#palettes_accessor_storage; }
301
329
  set palettes(value) { this.#palettes_accessor_storage = value; }
302
- #std_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _std_initializers, undefined));
330
+ #std_accessor_storage;
303
331
  /**
304
332
  * Optional: with none, every swatch's label resolves to its English
305
333
  * fallback (or, for a swatch neither {@link resolvePaletteLabel} tier
@@ -308,17 +336,64 @@ let EdgelessColorPanel = (() => {
308
336
  */
309
337
  get std() { return this.#std_accessor_storage; }
310
338
  set std(value) { this.#std_accessor_storage = value; }
311
- #theme_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _theme_initializers, void 0));
339
+ #theme_accessor_storage;
312
340
  get theme() { return this.#theme_accessor_storage; }
313
341
  set theme(value) { this.#theme_accessor_storage = value; }
314
- #value_accessor_storage = (__runInitializers(this, _theme_extraInitializers), __runInitializers(this, _value_initializers, null));
342
+ #value_accessor_storage;
315
343
  get value() { return this.#value_accessor_storage; }
316
344
  set value(value) { this.#value_accessor_storage = value; }
317
- #columns_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _columns_initializers, undefined));
345
+ #columns_accessor_storage;
318
346
  get columns() { return this.#columns_accessor_storage; }
319
347
  set columns(value) { this.#columns_accessor_storage = value; }
320
348
  constructor() {
321
349
  super(...arguments);
350
+ /**
351
+ * The keyboard path of the grid (a roving tab stop, ADR 0036 amendment of
352
+ * 2026-10-14): Tab reaches one swatch, the current colour or the first;
353
+ * the arrows move between swatches (up and down by `columns` when the grid
354
+ * declares them, else by one); Enter or Space picks, through the same
355
+ * click a pointer sends. A handled key goes no further, so the canvas does
356
+ * not also read it as a nudge or a pan.
357
+ */
358
+ this._onKeydown = (event, index) => {
359
+ if (event.isComposing)
360
+ return;
361
+ if (event.key === 'Enter' || event.key === ' ') {
362
+ event.preventDefault();
363
+ event.stopPropagation();
364
+ event.currentTarget.click();
365
+ return;
366
+ }
367
+ const perRow = this.columns ?? 1;
368
+ const step = event.key === 'ArrowLeft'
369
+ ? -1
370
+ : event.key === 'ArrowRight'
371
+ ? 1
372
+ : event.key === 'ArrowUp'
373
+ ? -perRow
374
+ : event.key === 'ArrowDown'
375
+ ? perRow
376
+ : 0;
377
+ if (step === 0)
378
+ return;
379
+ event.preventDefault();
380
+ event.stopPropagation();
381
+ const swatches = [
382
+ ...this.renderRoot.querySelectorAll('edgeless-color-button'),
383
+ ];
384
+ const next = Math.min(Math.max(index + step, 0), swatches.length - 1);
385
+ this._focusIndex = next;
386
+ this.requestUpdate();
387
+ swatches[next]?.focus();
388
+ };
389
+ this._focusIndex = undefined;
390
+ this.#hasTransparent_accessor_storage = __runInitializers(this, _hasTransparent_initializers, true);
391
+ this.#hollowCircle_accessor_storage = (__runInitializers(this, _hasTransparent_extraInitializers), __runInitializers(this, _hollowCircle_initializers, false));
392
+ this.#palettes_accessor_storage = (__runInitializers(this, _hollowCircle_extraInitializers), __runInitializers(this, _palettes_initializers, DefaultTheme.Palettes));
393
+ this.#std_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _std_initializers, undefined));
394
+ this.#theme_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _theme_initializers, void 0));
395
+ this.#value_accessor_storage = (__runInitializers(this, _theme_extraInitializers), __runInitializers(this, _value_initializers, null));
396
+ this.#columns_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _columns_initializers, undefined));
322
397
  __runInitializers(this, _columns_extraInitializers);
323
398
  }
324
399
  };
@@ -94,6 +94,14 @@ export declare function frameworkOfElement(gfx: GfxController, model: GfxModel):
94
94
  * palette, which is true of every element in it.
95
95
  */
96
96
  export declare function frameworkOfSelection(gfx: GfxController, models: readonly GfxModel[]): FrameworkId | undefined;
97
+ /**
98
+ * The palettes the frameworks whose tooling is on registered with this
99
+ * editor, in {@link FRAMEWORK_IDS} order so the pages read the same way in
100
+ * every picker: the canvas carousel below and the database colour grid
101
+ * (`@labre/data-view`, ADR 0036 amendment of 2026-10-14) both page through
102
+ * this list.
103
+ */
104
+ export declare function contributedFrameworkPalettes(std: BlockStdScope): FrameworkPalette[];
97
105
  /**
98
106
  * The carousel a contextual toolbar hands its colour picker.
99
107
  *
@@ -144,6 +144,16 @@ export function frameworkOfSelection(gfx, models) {
144
144
  return undefined;
145
145
  return unanimous(models.map(model => frameworkOfElement(gfx, model)));
146
146
  }
147
+ /**
148
+ * The palettes the frameworks whose tooling is on registered with this
149
+ * editor, in {@link FRAMEWORK_IDS} order so the pages read the same way in
150
+ * every picker: the canvas carousel below and the database colour grid
151
+ * (`@labre/data-view`, ADR 0036 amendment of 2026-10-14) both page through
152
+ * this list.
153
+ */
154
+ export function contributedFrameworkPalettes(std) {
155
+ return [...std.provider.getAll(FrameworkPaletteIdentifier).values()].sort((a, b) => FRAMEWORK_IDS.indexOf(a.framework) - FRAMEWORK_IDS.indexOf(b.framework));
156
+ }
147
157
  /**
148
158
  * The carousel a contextual toolbar hands its colour picker.
149
159
  *
@@ -154,9 +164,7 @@ export function frameworkOfSelection(gfx, models) {
154
164
  * carousel, else the base palette.
155
165
  */
156
166
  export function frameworkPaletteGroups(std, models, basePalettes) {
157
- const contributed = [
158
- ...std.provider.getAll(FrameworkPaletteIdentifier).values(),
159
- ].sort((a, b) => FRAMEWORK_IDS.indexOf(a.framework) - FRAMEWORK_IDS.indexOf(b.framework));
167
+ const contributed = contributedFrameworkPalettes(std);
160
168
  const groups = [
161
169
  {
162
170
  key: BASE_PALETTE_KEY,
@@ -1,5 +1,14 @@
1
1
  import { type TemplateResult } from 'lit';
2
2
  export declare function TransparentIcon(hollowCircle?: boolean): TemplateResult<1>;
3
+ /**
4
+ * A swatch paints through `style` as well as the `fill` attribute: its colour
5
+ * may be a CSS variable string (the database options' chip colours, ADR 0036
6
+ * amendment of 2026-10-14), and `var(...)` in an SVG presentation attribute
7
+ * is an engine's courtesy (Chromium resolves it) where a `fill` declaration
8
+ * is the CSS rule. The inline style wins and paints a plain colour exactly
9
+ * as the attribute did.
10
+ */
3
11
  export declare function CircleIcon(color: string): TemplateResult<1>;
12
+ /** Painted through `style` too, for the reason {@link CircleIcon} gives. */
4
13
  export declare function HollowCircleIcon(color: string): TemplateResult<1>;
5
14
  export declare function AdditionIcon(color: string, hollowCircle: boolean): TemplateResult<1>;
@@ -1,6 +1,7 @@
1
1
  import { isTransparent } from '../../affine-model/index.js';
2
2
  import { cssVarV2 } from '../../affine-shared/theme/index.js';
3
3
  import { html, svg } from 'lit';
4
+ import { styleMap } from 'lit/directives/style-map.js';
4
5
  export function TransparentIcon(hollowCircle = false) {
5
6
  const CircleIcon = hollowCircle
6
7
  ? svg `<circle cx="10" cy="10" r="8" fill="white" />`
@@ -23,6 +24,14 @@ export function TransparentIcon(hollowCircle = false) {
23
24
  </svg>
24
25
  `;
25
26
  }
27
+ /**
28
+ * A swatch paints through `style` as well as the `fill` attribute: its colour
29
+ * may be a CSS variable string (the database options' chip colours, ADR 0036
30
+ * amendment of 2026-10-14), and `var(...)` in an SVG presentation attribute
31
+ * is an engine's courtesy (Chromium resolves it) where a `fill` declaration
32
+ * is the CSS rule. The inline style wins and paints a plain colour exactly
33
+ * as the attribute did.
34
+ */
26
35
  export function CircleIcon(color) {
27
36
  return html `
28
37
  <svg
@@ -31,11 +40,13 @@ export function CircleIcon(color) {
31
40
  height="20"
32
41
  viewBox="0 0 20 20"
33
42
  fill="${color}"
43
+ style=${styleMap({ fill: color })}
34
44
  >
35
45
  <circle cx="10" cy="10" r="10" />
36
46
  </svg>
37
47
  `;
38
48
  }
49
+ /** Painted through `style` too, for the reason {@link CircleIcon} gives. */
39
50
  export function HollowCircleIcon(color) {
40
51
  return html `
41
52
  <svg
@@ -44,6 +55,7 @@ export function HollowCircleIcon(color) {
44
55
  height="20"
45
56
  viewBox="0 0 20 20"
46
57
  fill="${color}"
58
+ style=${styleMap({ fill: color })}
47
59
  >
48
60
  <path
49
61
  fill-rule="evenodd"
@@ -32,13 +32,12 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
32
32
  }
33
33
  return useValue ? value : void 0;
34
34
  };
35
- import { addAttachments } from '../../affine-block-attachment/index.js';
35
+ import { pickAndAddAttachments } from '../../affine-block-attachment/index.js';
36
36
  import { insertLinkByQuickSearchCommand } from '../../affine-block-bookmark/index.js';
37
- import { addImages } from '../../affine-block-image/index.js';
37
+ import { pickAndAddImages } from '../../affine-block-image/index.js';
38
38
  import { DefaultTool } from '../../affine-block-surface/index.js';
39
39
  import { MAX_IMAGE_WIDTH } from '../../affine-model/index.js';
40
40
  import { TelemetryProvider, translateKey } from '../../affine-shared/services/index.js';
41
- import { getImageFilesFromLocal, openSingleFileWith, } from '../../affine-shared/utils/index.js';
42
41
  import { EdgelessToolbarToolMixin } from '../../affine-widget-edgeless-toolbar/index.js';
43
42
  import { AttachmentIcon, ImageIcon, LinkIcon } from '@blocksuite/icons/lit';
44
43
  import { effect } from '@preact/signals-core';
@@ -112,8 +111,7 @@ let EdgelessNoteMenu = (() => {
112
111
  `; }
113
112
  async _addImages() {
114
113
  this._imageLoading = true;
115
- const imageFiles = await getImageFilesFromLocal();
116
- const ids = await addImages(this.edgeless.std, imageFiles, {
114
+ const ids = await pickAndAddImages(this.edgeless.std, {
117
115
  maxWidth: MAX_IMAGE_WIDTH,
118
116
  });
119
117
  this._imageLoading = false;
@@ -185,10 +183,9 @@ let EdgelessNoteMenu = (() => {
185
183
  .activeMode=${'background'}
186
184
  .tooltip=${translateKey(this.edgeless.std, ...GFX_NOTE_MENU_FILE)}
187
185
  @click=${async () => {
188
- const file = await openSingleFileWith();
189
- if (!file)
186
+ const ids = await pickAndAddAttachments(this.edgeless.std);
187
+ if (!ids.length)
190
188
  return;
191
- await addAttachments(this.edgeless.std, [file]);
192
189
  this.gfx.tool.setTool(DefaultTool);
193
190
  this.edgeless.std
194
191
  .getOptional(TelemetryProvider)
@@ -26,9 +26,19 @@ export declare const TemplateCategoryIdentifier: import("../global/di/types.js")
26
26
  */
27
27
  export declare function TemplateCategoryExtension(...categories: TemplateCategory[]): ExtensionType;
28
28
  /**
29
- * The catalogue ONE editor sees: the built-in categories (`Other`, plus
30
- * whatever a host appended through `EdgelessTemplatePanel.templates.extend`)
31
- * followed by the categories the view extensions mounted on this `std`
32
- * registered — i.e. exactly the frameworks whose tooling is on.
29
+ * The identity of the host's category of saved frames (the
30
+ * `FrameTemplateProvider` seam): the stable name the panel remembers and
31
+ * lists by. Its tab reads {@link TEMPLATE_PANEL_CATEGORY_SAVED_FRAMES}.
32
+ */
33
+ export declare const SAVED_FRAMES_CATEGORY = "Saved frames";
34
+ /**
35
+ * The catalogue ONE editor sees: the built-in `Other`, then the categories
36
+ * the view extensions mounted on this `std` registered — i.e. exactly the
37
+ * frameworks whose tooling is on — then the host's saved frames, when a
38
+ * host keeps them (`FrameTemplateProvider`).
39
+ *
40
+ * Per editor, from its DI container: the module-level `extend(...)` of
41
+ * 0.49 and earlier, which appended for every editor and was never emptied,
42
+ * is gone (a host category is a `TemplateCategoryExtension`).
33
43
  */
34
44
  export declare function templateManagerFor(std: BlockStdScope): TemplateManager;
@@ -1,6 +1,8 @@
1
+ import { FrameTemplateProvider, } from '../affine-shared/services/index.js';
1
2
  import { createIdentifier } from '../global/di/index.js';
2
3
  import { builtInTemplates } from './toolbar/builtin-templates.js';
3
4
  import { resolveTemplateName } from './toolbar/resolve-name.js';
5
+ import { TEMPLATE_PANEL_CATEGORY_SAVED_FRAMES } from './translations.js';
4
6
  /**
5
7
  * A framework registers its Templates-panel categories here; the panel reads
6
8
  * them back from the std of the edgeless it opens on. One identifier per
@@ -33,20 +35,61 @@ export function TemplateCategoryExtension(...categories) {
33
35
  },
34
36
  };
35
37
  }
38
+ /**
39
+ * The identity of the host's category of saved frames (the
40
+ * `FrameTemplateProvider` seam): the stable name the panel remembers and
41
+ * lists by. Its tab reads {@link TEMPLATE_PANEL_CATEGORY_SAVED_FRAMES}.
42
+ */
43
+ export const SAVED_FRAMES_CATEGORY = 'Saved frames';
44
+ function savedFrameTemplate(service, saved) {
45
+ return {
46
+ name: saved.title,
47
+ type: 'template',
48
+ content: saved.snapshot,
49
+ preview: saved.preview,
50
+ // The panel runs `afterInsert` only once the template job has resolved.
51
+ afterInsert: service.frameInserted
52
+ ? std => service.frameInserted?.({
53
+ docId: std.store.id,
54
+ templateId: saved.id,
55
+ })
56
+ : undefined,
57
+ };
58
+ }
59
+ /**
60
+ * The host's saved frames as a category, or none without a host. Lazy: the
61
+ * host is asked only when the panel shows the tab or searches across tabs.
62
+ */
63
+ function savedFramesCategory(std) {
64
+ const service = std.provider.getOptional(FrameTemplateProvider);
65
+ if (!service)
66
+ return null;
67
+ return {
68
+ name: SAVED_FRAMES_CATEGORY,
69
+ nameKey: TEMPLATE_PANEL_CATEGORY_SAVED_FRAMES[0],
70
+ templates: async () => (await service.list()).map(saved => savedFrameTemplate(service, saved)),
71
+ };
72
+ }
36
73
  function loadCategory(category) {
37
74
  return Array.isArray(category.templates)
38
75
  ? Promise.resolve(category.templates)
39
76
  : category.templates();
40
77
  }
41
78
  /**
42
- * The catalogue ONE editor sees: the built-in categories (`Other`, plus
43
- * whatever a host appended through `EdgelessTemplatePanel.templates.extend`)
44
- * followed by the categories the view extensions mounted on this `std`
45
- * registered — i.e. exactly the frameworks whose tooling is on.
79
+ * The catalogue ONE editor sees: the built-in `Other`, then the categories
80
+ * the view extensions mounted on this `std` registered — i.e. exactly the
81
+ * frameworks whose tooling is on — then the host's saved frames, when a
82
+ * host keeps them (`FrameTemplateProvider`).
83
+ *
84
+ * Per editor, from its DI container: the module-level `extend(...)` of
85
+ * 0.49 and earlier, which appended for every editor and was never emptied,
86
+ * is gone (a host category is a `TemplateCategoryExtension`).
46
87
  */
47
88
  export function templateManagerFor(std) {
89
+ const saved = savedFramesCategory(std);
48
90
  const contributed = [
49
91
  ...std.provider.getAll(TemplateCategoryIdentifier).values(),
92
+ ...(saved ? [saved] : []),
50
93
  ];
51
94
  const byName = (name) => contributed.find(c => c.name === name);
52
95
  return {
@@ -57,8 +100,6 @@ export function templateManagerFor(std) {
57
100
  ]),
58
101
  ],
59
102
  categoryLabel: name => byName(name)?.nameKey ?? builtInTemplates.categoryLabel(name),
60
- // Both halves, so a host's `extend(...)` can still append to a framework's
61
- // own category (the global half answers `[]` for a name it does not know).
62
103
  list: async (name) => {
63
104
  const category = byName(name);
64
105
  return [
@@ -1,9 +1,14 @@
1
- import type { Template, TemplateCategory, TemplateManager } from './template-type.js';
1
+ import type { Template, TemplateCategory } from './template-type.js';
2
2
  export declare const templates: TemplateCategory[];
3
+ /**
4
+ * The catalogue every editor has, whatever is mounted: `Other`. A host or a
5
+ * framework adds a category per editor with `TemplateCategoryExtension`; the
6
+ * module-level `extend(...)` this object carried until 0.49 appended for every
7
+ * editor of the page and was never emptied.
8
+ */
3
9
  export declare const builtInTemplates: {
4
10
  list: (category: string) => Promise<Template[]>;
5
11
  categories: () => Promise<string[]>;
6
12
  categoryLabel: (name: string) => string | undefined;
7
13
  search: (keyword: string, cateName?: string) => Promise<Template[]>;
8
- extend(manager: TemplateManager): void;
9
14
  };
@@ -16,48 +16,27 @@ function lcs(text1, text2) {
16
16
  }
17
17
  return dp[text1.length][text2.length];
18
18
  }
19
- const extendTemplate = [];
20
- const flat = (arr) => arr.reduce((pre, current) => {
21
- if (current) {
22
- return pre.concat(current);
23
- }
24
- return pre;
25
- }, []);
19
+ /**
20
+ * The catalogue every editor has, whatever is mounted: `Other`. A host or a
21
+ * framework adds a category per editor with `TemplateCategoryExtension`; the
22
+ * module-level `extend(...)` this object carried until 0.49 appended for every
23
+ * editor of the page and was never emptied.
24
+ */
26
25
  export const builtInTemplates = {
27
26
  list: async (category) => {
28
- const extendTemplates = flat(await Promise.all(extendTemplate.map(manager => manager.list(category))));
29
- // eslint-disable-next-line sonarjs/no-empty-collection
30
27
  const cate = templates.find(cate => cate.name === category);
31
28
  if (!cate)
32
- return extendTemplates;
33
- const result = cate.templates instanceof Function
34
- ? await cate.templates()
35
- : await Promise.all(Object.values(cate.templates));
36
- return result.concat(extendTemplates);
37
- },
38
- categories: async () => {
39
- const extendCates = flat(await Promise.all(extendTemplate.map(manager => manager.categories())));
40
- // eslint-disable-next-line sonarjs/no-empty-collection
41
- return templates.map(cate => cate.name).concat(extendCates);
42
- },
43
- categoryLabel: (name) => {
44
- // eslint-disable-next-line sonarjs/no-empty-collection
45
- const own = templates.find(cate => cate.name === name)?.nameKey;
46
- if (own)
47
- return own;
48
- for (const manager of extendTemplate) {
49
- const key = manager.categoryLabel?.(name);
50
- if (key)
51
- return key;
52
- }
53
- return undefined;
29
+ return [];
30
+ return cate.templates instanceof Function
31
+ ? cate.templates()
32
+ : cate.templates;
54
33
  },
34
+ categories: async () => templates.map(cate => cate.name),
35
+ categoryLabel: (name) => templates.find(cate => cate.name === name)?.nameKey,
55
36
  search: async (keyword, cateName) => {
56
- const candidates = flat(await Promise.all(extendTemplate.map(manager => manager.search(keyword, cateName))));
37
+ const candidates = [];
57
38
  keyword = keyword.trim().toLocaleLowerCase();
58
- await Promise.all(
59
- // eslint-disable-next-line sonarjs/no-empty-collection
60
- templates.map(async (categroy) => {
39
+ await Promise.all(templates.map(async (categroy) => {
61
40
  if (cateName && cateName !== categroy.name) {
62
41
  return;
63
42
  }
@@ -73,9 +52,4 @@ export const builtInTemplates = {
73
52
  }));
74
53
  return candidates;
75
54
  },
76
- extend(manager) {
77
- if (extendTemplate.includes(manager))
78
- return;
79
- extendTemplate.push(manager);
80
- },
81
55
  };
@@ -10,7 +10,7 @@ import type { Template } from './template-type.js';
10
10
  * through this generic seam.
11
11
  *
12
12
  * `Template.name` itself stays the STABLE identity `templateFromCommand`
13
- * bakes in (the drag payload, the `repeat` key, the `templateCache` storage
13
+ * bakes in (the drag payload, the search, the `templateCache` storage
14
14
  * key) — and it is ALSO what gets passed as `translateKey`'s fallback, never
15
15
  * `command.labelFallback`: most derived templates leave `name` at its default
16
16
  * (the command's own fallback, so the two agree anyway), but a few tiles
@@ -10,7 +10,7 @@ import { getRegisteredCommands } from '../../std/index.js';
10
10
  * through this generic seam.
11
11
  *
12
12
  * `Template.name` itself stays the STABLE identity `templateFromCommand`
13
- * bakes in (the drag payload, the `repeat` key, the `templateCache` storage
13
+ * bakes in (the drag payload, the search, the `templateCache` storage
14
14
  * key) — and it is ALSO what gets passed as `translateKey`'s fallback, never
15
15
  * `command.labelFallback`: most derived templates leave `name` at its default
16
16
  * (the command's own fallback, so the two agree anyway), but a few tiles
@@ -6,16 +6,16 @@ declare const EdgelessTemplatePanel_base: typeof LitElement & import("../../glob
6
6
  export declare class EdgelessTemplatePanel extends EdgelessTemplatePanel_base {
7
7
  static styles: import("lit").CSSResult;
8
8
  /**
9
- * The GLOBAL half of the catalogue — `Other` and a host's `extend(...)`.
10
- * Framework categories are not here: they live in the editor's DI container
11
- * (`TemplateCategoryExtension`) and are read through {@link catalogue}.
9
+ * The GLOBAL half of the catalogue — `Other`. Framework and host
10
+ * categories are not here: they live in the editor's DI container
11
+ * (`TemplateCategoryExtension`, `FrameTemplateProvider`) and are read
12
+ * through {@link catalogue}.
12
13
  */
13
14
  static templates: {
14
15
  list: (category: string) => Promise<Template[]>;
15
16
  categories: () => Promise<string[]>;
16
17
  categoryLabel: (name: string) => string | undefined;
17
18
  search: (keyword: string, cateName?: string) => Promise<Template[]>;
18
- extend(manager: import("./template-type.js").TemplateManager): void;
19
19
  };
20
20
  /** What THIS edgeless offers: the global half plus its std's categories. */
21
21
  get catalogue(): import("./template-type.js").TemplateManager;