@formicoidea/labre-core 0.43.1 → 0.45.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 (263) hide show
  1. package/dist/_pkgs/affine-block-attachment/utils.js +4 -0
  2. package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +17 -4
  3. package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.d.ts +29 -0
  4. package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.js +81 -0
  5. package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +6 -4
  6. package/dist/_pkgs/affine-block-callout/configs/turn-into.d.ts +8 -0
  7. package/dist/_pkgs/affine-block-callout/configs/turn-into.js +19 -0
  8. package/dist/_pkgs/affine-block-callout/translations.d.ts +4 -2
  9. package/dist/_pkgs/affine-block-callout/translations.js +4 -2
  10. package/dist/_pkgs/affine-block-callout/view.js +3 -0
  11. package/dist/_pkgs/affine-block-code/code-block-service.d.ts +13 -0
  12. package/dist/_pkgs/affine-block-code/code-block-service.js +26 -0
  13. package/dist/_pkgs/affine-block-code/code-block.d.ts +6 -0
  14. package/dist/_pkgs/affine-block-code/code-block.js +11 -2
  15. package/dist/_pkgs/affine-block-code/code-toolbar/components/lang-button.js +31 -8
  16. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
  17. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
  18. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
  19. package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
  20. package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
  21. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
  22. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
  23. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
  24. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
  25. package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
  26. package/dist/_pkgs/affine-block-frame/frame-manager.js +48 -17
  27. package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
  28. package/dist/_pkgs/affine-block-image/utils.js +4 -1
  29. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
  30. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
  31. package/dist/_pkgs/affine-block-note/translations.d.ts +0 -1
  32. package/dist/_pkgs/affine-block-note/translations.js +0 -5
  33. package/dist/_pkgs/affine-block-root/configs/toolbar.js +17 -1
  34. package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
  35. package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
  36. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
  37. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
  38. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
  39. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
  40. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
  41. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
  42. package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
  43. package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
  44. package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
  45. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
  46. package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
  47. package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
  48. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
  49. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
  50. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
  51. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
  52. package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
  53. package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
  54. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
  55. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
  56. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
  57. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
  58. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
  59. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
  60. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
  63. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
  64. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
  66. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
  67. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
  68. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
  69. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
  70. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
  72. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
  73. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
  74. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
  75. package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
  76. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +80 -0
  77. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +248 -0
  78. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +82 -0
  79. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +342 -0
  80. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
  81. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
  82. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
  85. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +86 -15
  86. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
  87. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
  88. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
  89. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
  90. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
  91. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
  92. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
  93. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
  94. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
  96. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
  97. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
  98. package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
  99. package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
  100. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
  101. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
  102. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
  103. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
  104. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
  105. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
  106. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
  107. package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
  108. package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
  109. package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
  110. package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
  111. package/dist/_pkgs/affine-block-surface/view.js +23 -1
  112. package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
  113. package/dist/_pkgs/affine-components/context-menu/button.js +14 -0
  114. package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
  115. package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
  116. package/dist/_pkgs/affine-components/icons/index.js +0 -1
  117. package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
  118. package/dist/_pkgs/affine-components/icons/text.js +11 -0
  119. package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
  120. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +2 -2
  121. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
  122. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
  123. package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +1 -0
  124. package/dist/_pkgs/affine-fragment-frame-panel/index.js +1 -0
  125. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
  126. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
  127. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +3 -2
  128. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
  129. package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
  130. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
  131. package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
  132. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +1 -1
  133. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
  134. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
  135. package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
  136. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +2 -1
  137. package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
  138. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
  139. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
  140. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
  141. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +53 -2
  142. package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
  143. package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
  144. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
  145. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
  146. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
  147. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
  148. package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
  149. package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
  150. package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
  151. package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
  152. package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
  153. package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
  154. package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
  155. package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
  156. package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
  157. package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
  158. package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
  159. package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
  160. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
  161. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
  162. package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
  163. package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
  164. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  165. package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
  166. package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
  167. package/dist/_pkgs/affine-model/consts/text.d.ts +26 -0
  168. package/dist/_pkgs/affine-model/consts/text.js +25 -0
  169. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
  170. package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
  171. package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
  172. package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
  173. package/dist/_pkgs/affine-model/utils/helper.js +2 -0
  174. package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
  175. package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
  176. package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
  177. package/dist/_pkgs/affine-rich-text/index.js +1 -1
  178. package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
  179. package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
  180. package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
  181. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
  182. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
  183. package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +27 -0
  184. package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
  185. package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
  186. package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
  187. package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
  188. package/dist/_pkgs/affine-shared/services/index.d.ts +3 -0
  189. package/dist/_pkgs/affine-shared/services/index.js +3 -0
  190. package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
  191. package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
  192. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
  193. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  194. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +5 -0
  195. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +9 -0
  196. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  197. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  198. package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
  199. package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
  200. package/dist/_pkgs/affine-shared/styles/text.js +7 -7
  201. package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
  202. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
  203. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
  204. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
  205. package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
  206. package/dist/_pkgs/affine-shared/utils/index.d.ts +2 -0
  207. package/dist/_pkgs/affine-shared/utils/index.js +2 -0
  208. package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
  209. package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
  210. package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
  211. package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
  212. package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +10 -3
  213. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
  214. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
  215. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
  216. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
  217. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
  218. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +61 -0
  219. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +91 -0
  220. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
  221. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
  222. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
  223. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
  224. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
  225. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
  226. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +170 -0
  227. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1381 -0
  228. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +52 -0
  229. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +161 -1
  230. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
  231. package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
  232. package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
  233. package/dist/_pkgs/std/gfx/controller.js +22 -2
  234. package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
  235. package/dist/_pkgs/std/gfx/index.d.ts +3 -1
  236. package/dist/_pkgs/std/gfx/index.js +3 -1
  237. package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
  238. package/dist/_pkgs/std/gfx/layer.js +73 -5
  239. package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
  240. package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
  241. package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
  242. package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
  243. package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
  244. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
  245. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
  246. package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
  247. package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
  248. package/dist/_pkgs/std/utils/layer.d.ts +10 -0
  249. package/dist/_pkgs/std/utils/layer.js +64 -13
  250. package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
  251. package/dist/commands.js +4 -1
  252. package/dist/translations.js +10 -6
  253. package/package.json +9 -2
  254. package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
  255. package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
  256. package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
  257. package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
  258. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
  259. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
  260. package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
  261. package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
  262. package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
  263. package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
@@ -1,4 +1,4 @@
1
- import { EdgelessCRUDIdentifier, isNoteBlock, Overlay, } from '../affine-block-surface/index.js';
1
+ import { applyCreationLayer, EdgelessCRUDIdentifier, isNoteBlock, Overlay, sourceLayerOf, } from '../affine-block-surface/index.js';
2
2
  import { ShapeFactory } from '../affine-gfx-shape/index.js';
3
3
  import { getShapeRadius, getShapeType, GroupElementModel, ShapeElementModel, } from '../affine-model/index.js';
4
4
  import { getChromeAccentColor } from '../affine-shared/services/index.js';
@@ -230,6 +230,9 @@ export function createEdgelessElement(edgeless, current, bound) {
230
230
  ...current.serialize(),
231
231
  text: new Y.Text(),
232
232
  xywh: bound.serialize(),
233
+ // `serialize()` names no layer for a default-layer shape: ask for the
234
+ // source's explicitly, or the clone lands in the active layer.
235
+ layer: sourceLayerOf(current),
233
236
  });
234
237
  if (!id)
235
238
  return null;
@@ -237,12 +240,16 @@ export function createEdgelessElement(edgeless, current, bound) {
237
240
  }
238
241
  else if (isNoteBlock(current)) {
239
242
  const { store } = edgeless;
240
- id = store.addBlock('affine:note', {
243
+ const props = {
241
244
  background: current.props.background,
242
245
  displayMode: current.props.displayMode,
243
246
  edgeless: current.props.edgeless,
244
247
  xywh: bound.serialize(),
245
- }, edgeless.model.id);
248
+ // Beside its source, not in the viewer's active layer (ADR 0031 §6).
249
+ layer: sourceLayerOf(current),
250
+ };
251
+ applyCreationLayer(edgeless.std, props);
252
+ id = store.addBlock('affine:note', props, edgeless.model.id);
246
253
  const note = store.getBlock(id)?.model;
247
254
  if (!note) {
248
255
  throw new BlockSuiteError(ErrorCode.GfxBlockElementError, 'Note block is not found after creation');
@@ -35,9 +35,11 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { EDITOR_ANCHORED_PANEL_Z_INDEX } from '../../affine-block-surface/index.js';
36
36
  import { TOUCH_TARGET_MIN_PX } from '../../affine-shared/consts/index.js';
37
37
  import { CATALOGUE_OTHER, translateKey } from '../../affine-shared/services/index.js';
38
+ import { panelHeaderStyles } from '../../affine-shared/styles/index.js';
38
39
  import { IS_MAC } from '../../global/env/index.js';
39
40
  import { getCommandIcon, CommandUsageIdentifier, getCommandsForSurface, isCommandAvailable, normalizeLegacyCombo, rankCommandsByUsage, runCommand, ShortcutOverrideIdentifier, WidgetComponent, WidgetViewExtension, } from '../../std/index.js';
40
41
  import { GfxControllerIdentifier } from '../../std/gfx/index.js';
42
+ import { CloseIcon } from '@blocksuite/icons/lit';
41
43
  import { css, html, nothing, unsafeCSS } from 'lit';
42
44
  import { state } from 'lit/decorators.js';
43
45
  import { literal, unsafeStatic } from 'lit/static-html.js';
@@ -218,49 +220,13 @@ let EdgelessArtefactCatalogueWidget = (() => {
218
220
  outline-offset: -2px;
219
221
  }
220
222
 
221
- .artefact-catalogue-head {
222
- display: flex;
223
- align-items: center;
224
- justify-content: space-between;
225
- gap: 8px;
226
- padding: 8px 8px 8px 16px;
227
- border-bottom: 1px solid var(--affine-border-color);
228
- font-weight: 600;
229
- }
230
-
231
- .artefact-catalogue-title {
232
- overflow: hidden;
233
- text-overflow: ellipsis;
234
- white-space: nowrap;
235
- }
236
-
237
223
  /*
238
- A close button a finger can hit. Square at the touch minimum rather than
239
- the 6px-padded × the anchored panels use: this one is the only way out of
240
- a full-height surface on a tablet, where there is no Escape key.
224
+ The header row, its title and its close button are the frame panel's,
225
+ shared with the selection pane through panelHeaderStyles. The close is
226
+ the frame panel's 20px icon button, no longer the touch-sized ×: one
227
+ header design across the side panels was the product owner's call.
241
228
  */
242
- .artefact-catalogue-close {
243
- flex: none;
244
- display: flex;
245
- align-items: center;
246
- justify-content: center;
247
- width: ${unsafeCSS(TOUCH_TARGET_MIN_PX)}px;
248
- height: ${unsafeCSS(TOUCH_TARGET_MIN_PX)}px;
249
- border: none;
250
- border-radius: 8px;
251
- background: transparent;
252
- color: var(--affine-text-secondary-color);
253
- font-family: inherit;
254
- font-size: 20px;
255
- line-height: 1;
256
- cursor: pointer;
257
- }
258
-
259
- .artefact-catalogue-close:hover,
260
- .artefact-catalogue-close:focus-visible {
261
- background: var(--affine-hover-color);
262
- color: var(--affine-text-primary-color);
263
- }
229
+ ${panelHeaderStyles}
264
230
 
265
231
  .artefact-catalogue-body {
266
232
  flex: 1;
@@ -536,6 +502,7 @@ let EdgelessArtefactCatalogueWidget = (() => {
536
502
  // prose, and a host with a catalogue always wins.
537
503
  const frameworkLabel = translateKey(this.std, `com.labre.framework.${owner}`, humanizeCategory(owner));
538
504
  const catalogueTitle = translateKey(this.std, 'com.labre.catalogue.title', 'Artefacts');
505
+ const closeLabel = translateKey(this.std, 'com.labre.catalogue.close', 'Close');
539
506
  return html `<div
540
507
  class="artefact-catalogue-panel"
541
508
  role="dialog"
@@ -547,17 +514,26 @@ let EdgelessArtefactCatalogueWidget = (() => {
547
514
  @pointerup=${this._swallow}
548
515
  @click=${this._swallow}
549
516
  >
550
- <div class="artefact-catalogue-head">
551
- <span class="artefact-catalogue-title">${frameworkLabel}</span>
552
- <button
553
- class="artefact-catalogue-close"
554
- type="button"
517
+ <div
518
+ class="artefact-catalogue-head affine-panel-header"
519
+ data-testid="artefact-catalogue-header"
520
+ >
521
+ <span
522
+ class="artefact-catalogue-title affine-panel-header-title"
523
+ data-testid="artefact-catalogue-title"
524
+ >${frameworkLabel}</span
525
+ >
526
+ <edgeless-tool-icon-button
527
+ class="artefact-catalogue-close affine-panel-header-button"
555
528
  data-testid="artefact-catalogue-close"
556
- aria-label=${translateKey(this.std, 'com.labre.catalogue.close', 'Close')}
529
+ aria-label=${closeLabel}
530
+ .tooltip=${closeLabel}
531
+ .tipPosition=${'top'}
532
+ .activeMode=${'background'}
557
533
  @click=${this.closePanel}
558
534
  >
559
- ×
560
- </button>
535
+ ${CloseIcon({ width: '20px', height: '20px' })}
536
+ </edgeless-tool-icon-button>
561
537
  </div>
562
538
  <div
563
539
  class="artefact-catalogue-body"
@@ -6,6 +6,8 @@ import { EdgelessSlideMenu } from './menu/slide-menu.js';
6
6
  import { ToolbarArrowUpIcon } from './menu/toolbar-arrow-up-icon.js';
7
7
  import { EdgelessFontFamilyPanel } from './panel/font-family-panel.js';
8
8
  import { EdgelessFontWeightAndStylePanel } from './panel/font-weight-and-style-panel.js';
9
+ import { EdgelessSelectionPaneToolButton } from './selection-pane/selection-pane-tool.js';
10
+ import { EdgelessSelectionPaneWidget } from './selection-pane/selection-pane-widget.js';
9
11
  export declare function effects(): void;
10
12
  declare global {
11
13
  interface HTMLElementTagNameMap {
@@ -17,5 +19,7 @@ declare global {
17
19
  'edgeless-font-family-panel': EdgelessFontFamilyPanel;
18
20
  'edgeless-slide-menu': EdgelessSlideMenu;
19
21
  'toolbar-arrow-up-icon': ToolbarArrowUpIcon;
22
+ 'edgeless-selection-pane-widget': EdgelessSelectionPaneWidget;
23
+ 'edgeless-selection-pane-tool-button': EdgelessSelectionPaneToolButton;
20
24
  }
21
25
  }
@@ -6,6 +6,8 @@ import { EdgelessSlideMenu } from './menu/slide-menu.js';
6
6
  import { ToolbarArrowUpIcon } from './menu/toolbar-arrow-up-icon.js';
7
7
  import { EdgelessFontFamilyPanel } from './panel/font-family-panel.js';
8
8
  import { EdgelessFontWeightAndStylePanel } from './panel/font-weight-and-style-panel.js';
9
+ import { EdgelessSelectionPaneToolButton, SELECTION_PANE_TOOL_BUTTON, } from './selection-pane/selection-pane-tool.js';
10
+ import { EDGELESS_SELECTION_PANE_WIDGET, EdgelessSelectionPaneWidget, } from './selection-pane/selection-pane-widget.js';
9
11
  export function effects() {
10
12
  customElements.define(EDGELESS_TOOLBAR_WIDGET, EdgelessToolbarWidget);
11
13
  customElements.define(EDGELESS_ARTEFACT_CATALOGUE_WIDGET, EdgelessArtefactCatalogueWidget);
@@ -15,4 +17,6 @@ export function effects() {
15
17
  customElements.define('edgeless-font-family-panel', EdgelessFontFamilyPanel);
16
18
  customElements.define('edgeless-slide-menu', EdgelessSlideMenu);
17
19
  customElements.define('toolbar-arrow-up-icon', ToolbarArrowUpIcon);
20
+ customElements.define(EDGELESS_SELECTION_PANE_WIDGET, EdgelessSelectionPaneWidget);
21
+ customElements.define(SELECTION_PANE_TOOL_BUTTON, EdgelessSelectionPaneToolButton);
18
22
  }
@@ -12,3 +12,7 @@ export * from './menu/command-menu.js';
12
12
  export * from './menu/senior-menu-selection.js';
13
13
  export * from './mixins/index.js';
14
14
  export * from './placement/index.js';
15
+ export * from './selection-pane/labels.js';
16
+ export * from './selection-pane/selection-pane-default.js';
17
+ export * from './selection-pane/selection-pane-tool.js';
18
+ export * from './selection-pane/selection-pane-widget.js';
@@ -12,3 +12,7 @@ export * from './menu/command-menu.js';
12
12
  export * from './menu/senior-menu-selection.js';
13
13
  export * from './mixins/index.js';
14
14
  export * from './placement/index.js';
15
+ export * from './selection-pane/labels.js';
16
+ export * from './selection-pane/selection-pane-default.js';
17
+ export * from './selection-pane/selection-pane-tool.js';
18
+ export * from './selection-pane/selection-pane-widget.js';
@@ -0,0 +1,61 @@
1
+ import type { SelectionPaneNode } from '../../affine-block-surface/index.js';
2
+ /**
3
+ * Where a row dragged in the selection pane lands — the pure half of the
4
+ * pane's drag, kept apart from the DOM so the rule reads in one place.
5
+ *
6
+ * The pane shows a FLAT list of rows, and a gap between two of them can mean
7
+ * several places at once: the gap under a group's last member is also the gap
8
+ * after the group. A drag only ever moves a row inside its own sibling list
9
+ * (a layer row among the layers, an element among the rows of its group or
10
+ * layer — dropping INTO a layer is the layer header's business), so the gap is
11
+ * read as the one slot it offers in THAT list, or as none.
12
+ */
13
+ /** A visible row, as the drop rule reads it. */
14
+ export interface PaneDropRow {
15
+ node: SelectionPaneNode;
16
+ depth: number;
17
+ /** The row it is listed under, `''` at the top level. */
18
+ parent: string;
19
+ }
20
+ /** The sibling lists of the tree BEFORE any filter, keyed by parent id. */
21
+ export interface PaneLists {
22
+ readonly lists: ReadonlyMap<string, readonly SelectionPaneNode[]>;
23
+ readonly parentOf: ReadonlyMap<string, string>;
24
+ }
25
+ export declare function paneLists(full: readonly SelectionPaneNode[]): PaneLists;
26
+ /** A place in one sibling list. */
27
+ export interface PaneSlot {
28
+ /** The list's parent id, `''` at the top level. */
29
+ parent: string;
30
+ /** Position in the FULL list, 0 being the top. */
31
+ index: number;
32
+ /** How deep that list's rows sit, for the drop line's indent. */
33
+ depth: number;
34
+ }
35
+ /**
36
+ * The slot that the visible gap `gap` — between `rows[gap - 1]` and
37
+ * `rows[gap]` — offers in the list `parent`, or `null`.
38
+ *
39
+ * The gap is "before" the row under it when that row is in the list; else
40
+ * "after" the row above it, or after any ancestor of that row whose subtree
41
+ * ends at this gap (dropping under a group's last member, or a layer's, means
42
+ * after the group or the layer). Positions are read in the FULL list, so a
43
+ * filtered view never computes a neighbour it is not showing.
44
+ */
45
+ export declare function paneSlotAtGap(rows: readonly PaneDropRow[], gap: number, parent: string, { lists, parentOf }: PaneLists): PaneSlot | null;
46
+ /**
47
+ * What a drop at `index` of `list` writes for the dragged row `dragId`: the
48
+ * model it lands directly ABOVE (`null` = the bottom of its stack), or `null`
49
+ * when the slot is refused.
50
+ *
51
+ * `stackOf(id)` names the model that stands for a row in the dragged row's
52
+ * own stack — itself, or the frame it belongs to when the dragged row is a
53
+ * loose element and that row is a frame's member (a frame's members paint
54
+ * together, right above it) — or `undefined` for a row that is not in that
55
+ * stack at all. A slot is refused when neither neighbour is in the stack, or
56
+ * when both stand for the same model: the inside of a frame's block of rows,
57
+ * where a loose element cannot be put.
58
+ */
59
+ export declare function paneDropAbove(list: readonly SelectionPaneNode[], index: number, dragId: string, stackOf: (id: string) => string | undefined): {
60
+ above: string | null;
61
+ } | null;
@@ -0,0 +1,91 @@
1
+ export function paneLists(full) {
2
+ const lists = new Map();
3
+ const parentOf = new Map();
4
+ const walk = (list, parent) => {
5
+ lists.set(parent, list);
6
+ for (const node of list) {
7
+ parentOf.set(node.id, parent);
8
+ if (node.children)
9
+ walk(node.children, node.id);
10
+ }
11
+ };
12
+ walk(full, '');
13
+ return { lists, parentOf };
14
+ }
15
+ /**
16
+ * The slot that the visible gap `gap` — between `rows[gap - 1]` and
17
+ * `rows[gap]` — offers in the list `parent`, or `null`.
18
+ *
19
+ * The gap is "before" the row under it when that row is in the list; else
20
+ * "after" the row above it, or after any ancestor of that row whose subtree
21
+ * ends at this gap (dropping under a group's last member, or a layer's, means
22
+ * after the group or the layer). Positions are read in the FULL list, so a
23
+ * filtered view never computes a neighbour it is not showing.
24
+ */
25
+ export function paneSlotAtGap(rows, gap, parent, { lists, parentOf }) {
26
+ const list = lists.get(parent);
27
+ if (!list)
28
+ return null;
29
+ const above = rows[gap - 1];
30
+ const below = rows[gap];
31
+ const depthOf = (id) => rows.find(row => row.node.id === id)?.depth;
32
+ if (below && below.parent === parent) {
33
+ const index = list.findIndex(node => node.id === below.node.id);
34
+ if (index !== -1)
35
+ return { parent, index, depth: below.depth };
36
+ }
37
+ if (!above || below?.parent === above.node.id)
38
+ return null;
39
+ // The ancestors the row under the gap is still inside: the gap does not
40
+ // end their subtree.
41
+ const open = new Set();
42
+ for (let id = below?.parent ?? ''; id !== ''; id = parentOf.get(id) ?? '') {
43
+ open.add(id);
44
+ }
45
+ let id = above.node.id;
46
+ let listedIn = above.parent;
47
+ for (;;) {
48
+ if (listedIn === parent) {
49
+ const index = list.findIndex(node => node.id === id);
50
+ const depth = depthOf(id);
51
+ if (index === -1 || depth === undefined)
52
+ return null;
53
+ return { parent, index: index + 1, depth };
54
+ }
55
+ if (listedIn === '' || open.has(listedIn))
56
+ return null;
57
+ id = listedIn;
58
+ listedIn = parentOf.get(id) ?? '';
59
+ }
60
+ }
61
+ /**
62
+ * What a drop at `index` of `list` writes for the dragged row `dragId`: the
63
+ * model it lands directly ABOVE (`null` = the bottom of its stack), or `null`
64
+ * when the slot is refused.
65
+ *
66
+ * `stackOf(id)` names the model that stands for a row in the dragged row's
67
+ * own stack — itself, or the frame it belongs to when the dragged row is a
68
+ * loose element and that row is a frame's member (a frame's members paint
69
+ * together, right above it) — or `undefined` for a row that is not in that
70
+ * stack at all. A slot is refused when neither neighbour is in the stack, or
71
+ * when both stand for the same model: the inside of a frame's block of rows,
72
+ * where a loose element cannot be put.
73
+ */
74
+ export function paneDropAbove(list, index, dragId, stackOf) {
75
+ const before = list.slice(0, index).filter(node => node.id !== dragId);
76
+ const after = list.slice(index).filter(node => node.id !== dragId);
77
+ const upper = before.length
78
+ ? stackOf(before[before.length - 1].id)
79
+ : undefined;
80
+ const lower = after.length ? stackOf(after[0].id) : undefined;
81
+ if (upper === undefined && lower === undefined)
82
+ return null;
83
+ if (upper !== undefined && upper === lower)
84
+ return null;
85
+ for (const node of after) {
86
+ const model = stackOf(node.id);
87
+ if (model !== undefined)
88
+ return { above: model };
89
+ }
90
+ return { above: null };
91
+ }
@@ -0,0 +1,17 @@
1
+ import type { BlockStdScope } from '../../std/index.js';
2
+ import { type GfxModel } from '../../std/gfx/index.js';
3
+ import type { TemplateResult } from 'lit';
4
+ /** The type wording of a row: its kind, translated. */
5
+ export declare function selectionPaneTypeLabel(std: BlockStdScope, type: string): string;
6
+ /**
7
+ * The wording of a row, read off the model at render time (ADR 0031 §12: the
8
+ * headless tree carries ids only).
9
+ *
10
+ * In order: a group's or a frame's own stored title; then an element's own
11
+ * text, or its label sibling's — `readName`, the very rule the reversed
12
+ * reading names an artefact by, so a Wardley component reads as its label and
13
+ * not as "Shape"; then its role's wording; then its kind.
14
+ */
15
+ export declare function selectionPaneRowLabel(std: BlockStdScope, model: GfxModel): string;
16
+ /** The icon of a row, by element type or block flavour. */
17
+ export declare function selectionPaneRowIcon(type: string): TemplateResult;
@@ -0,0 +1,95 @@
1
+ import { ReadingManager, readingProfileFor, readName, } from '../../affine-block-surface/index.js';
2
+ import { FrameBlockModel, GroupElementModel } from '../../affine-model/index.js';
3
+ import { translateKey } from '../../affine-shared/services/index.js';
4
+ import { findRoleDef, GfxBlockElementModel, GfxPrimitiveElementModel, RoleVocabularyIdentifier, } from '../../std/gfx/index.js';
5
+ import { AttachmentIcon, BookmarkIcon, ConnectorCIcon, EmbedWebIcon, FrameIcon, GroupIcon, ImageIcon, MindmapIcon, PageIcon, PenIcon, ShapeIcon, TextIcon, } from '@blocksuite/icons/lit';
6
+ import { SELECTION_PANE_TYPE_ELEMENT, SELECTION_PANE_TYPE_EMBED, SELECTION_PANE_TYPE_WORDINGS, } from '../translations.js';
7
+ /** For an element no reading profile governs: its own text, no label sibling. */
8
+ const NO_PROFILE = { roles: {} };
9
+ /**
10
+ * Every key of the library starts with it. A host catalogue that echoes a key
11
+ * it does not hold (i18next's default) is not a wording either.
12
+ */
13
+ const KEY_PREFIX = 'com.labre.';
14
+ /** The type wording of a row: its kind, translated. */
15
+ export function selectionPaneTypeLabel(std, type) {
16
+ const wording = SELECTION_PANE_TYPE_WORDINGS[type] ??
17
+ (type.startsWith('affine:embed-')
18
+ ? SELECTION_PANE_TYPE_EMBED
19
+ : SELECTION_PANE_TYPE_ELEMENT);
20
+ return translateKey(std, ...wording);
21
+ }
22
+ /**
23
+ * The wording of a row, read off the model at render time (ADR 0031 §12: the
24
+ * headless tree carries ids only).
25
+ *
26
+ * In order: a group's or a frame's own stored title; then an element's own
27
+ * text, or its label sibling's — `readName`, the very rule the reversed
28
+ * reading names an artefact by, so a Wardley component reads as its label and
29
+ * not as "Shape"; then its role's wording; then its kind.
30
+ */
31
+ export function selectionPaneRowLabel(std, model) {
32
+ if (model instanceof GroupElementModel) {
33
+ const title = model.title.toString().trim();
34
+ if (title)
35
+ return title;
36
+ }
37
+ else if (model instanceof FrameBlockModel) {
38
+ const title = model.props.title.toString().trim();
39
+ if (title)
40
+ return title;
41
+ }
42
+ else if (model instanceof GfxPrimitiveElementModel) {
43
+ const profiles = std.getOptional(ReadingManager)?.profiles ?? [];
44
+ const profile = readingProfileFor(model, profiles) ?? NO_PROFILE;
45
+ const name = readName(model, profile);
46
+ if (name)
47
+ return name;
48
+ const vocabularies = [
49
+ ...std.provider.getAll(RoleVocabularyIdentifier).values(),
50
+ ];
51
+ const role = findRoleDef(vocabularies, model.role);
52
+ if (role?.labelKey) {
53
+ // `''`, not the key, when the role ships no wording: `translateKey`
54
+ // defaults its fallback to the key, and a row once printed
55
+ // `com.labre.wardley.role.…` that way. No wording reads as the kind.
56
+ const wording = translateKey(std, role.labelKey, role.labelFallback ?? '');
57
+ if (wording && !wording.startsWith(KEY_PREFIX))
58
+ return wording;
59
+ }
60
+ }
61
+ const type = model instanceof GfxBlockElementModel
62
+ ? model.flavour
63
+ : model.type;
64
+ return selectionPaneTypeLabel(std, type);
65
+ }
66
+ /** The icon of a row, by element type or block flavour. */
67
+ export function selectionPaneRowIcon(type) {
68
+ switch (type) {
69
+ case 'connector':
70
+ return ConnectorCIcon();
71
+ case 'text':
72
+ case 'affine:edgeless-text':
73
+ case 'affine:latex':
74
+ return TextIcon();
75
+ case 'group':
76
+ return GroupIcon();
77
+ case 'mindmap':
78
+ return MindmapIcon();
79
+ case 'brush':
80
+ case 'highlighter':
81
+ return PenIcon();
82
+ case 'affine:frame':
83
+ return FrameIcon();
84
+ case 'affine:note':
85
+ return PageIcon();
86
+ case 'affine:image':
87
+ return ImageIcon();
88
+ case 'affine:attachment':
89
+ return AttachmentIcon();
90
+ case 'affine:bookmark':
91
+ return BookmarkIcon();
92
+ default:
93
+ return type.startsWith('affine:embed-') ? EmbedWebIcon() : ShapeIcon();
94
+ }
95
+ }
@@ -0,0 +1,10 @@
1
+ import type { ExtensionType } from '../../store/index.js';
2
+ /**
3
+ * The DEFAULT `SelectionPaneProvider`: the library's own left panel.
4
+ *
5
+ * Mirrors `artefactCatalogueDefaultExtension` line for line: registered next
6
+ * to the widget, unconditionally (the pane is core chrome, and nothing it
7
+ * lists is a flag's business), with `di.addImpl` so a host's
8
+ * `SelectionPaneExtension(service | null)` — `di.override` — always wins.
9
+ */
10
+ export declare const selectionPaneDefaultExtension: ExtensionType;
@@ -0,0 +1,31 @@
1
+ import { SelectionPaneProvider, } from '../../affine-shared/services/index.js';
2
+ import { StdIdentifier } from '../../std/index.js';
3
+ import { EDGELESS_SELECTION_PANE_WIDGET, } from './selection-pane-widget.js';
4
+ /**
5
+ * The widget, found on the editor host — or `null` before it has mounted.
6
+ * A DOM lookup for the reason `artefact-catalogue-default.ts` gives: lit
7
+ * creates and destroys the widget as the root block renders.
8
+ */
9
+ function paneWidget(std) {
10
+ return (std.host.querySelector(EDGELESS_SELECTION_PANE_WIDGET) ?? null);
11
+ }
12
+ /**
13
+ * The DEFAULT `SelectionPaneProvider`: the library's own left panel.
14
+ *
15
+ * Mirrors `artefactCatalogueDefaultExtension` line for line: registered next
16
+ * to the widget, unconditionally (the pane is core chrome, and nothing it
17
+ * lists is a flag's business), with `di.addImpl` so a host's
18
+ * `SelectionPaneExtension(service | null)` — `di.override` — always wins.
19
+ */
20
+ export const selectionPaneDefaultExtension = {
21
+ setup: di => {
22
+ di.addImpl(SelectionPaneProvider, provider => {
23
+ const std = provider.get(StdIdentifier);
24
+ const service = {
25
+ open: () => paneWidget(std)?.openPanel(),
26
+ close: () => paneWidget(std)?.closePanel(),
27
+ };
28
+ return service;
29
+ });
30
+ },
31
+ };
@@ -0,0 +1,26 @@
1
+ import { LitElement } from 'lit';
2
+ export declare const SELECTION_PANE_TOOL_BUTTON = "edgeless-selection-pane-tool-button";
3
+ declare const EdgelessSelectionPaneToolButton_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../index.js").QuickToolMixinClass>;
4
+ /**
5
+ * The edgeless toolbar's entry to the selection pane: a quick tool, placed and
6
+ * styled like the undo and frame ones. An action, not a tool mode, so `type`
7
+ * is empty; it reads as active while the library's own pane is open.
8
+ */
9
+ export declare class EdgelessSelectionPaneToolButton extends EdgelessSelectionPaneToolButton_base {
10
+ static styles: import("lit").CSSResult;
11
+ type: never[];
12
+ private _onClick;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ }
15
+ /**
16
+ * Shown only while `SelectionPaneProvider` answers: `SelectionPaneExtension(null)`
17
+ * removes the button with the pane, because a control that opens nothing is a
18
+ * lie. Not hidden on a read-only document — the pane is how a reader finds
19
+ * what is on it.
20
+ *
21
+ * The `menu` entry is what the toolbar moves into its "more tools" menu when a
22
+ * narrow editor leaves no room for the button; a quick tool without one is
23
+ * dropped there, which is how the pane once went missing below ~800 px.
24
+ */
25
+ export declare const selectionPaneQuickTool: import("../../store/index.js").ExtensionType;
26
+ export {};
@@ -0,0 +1,82 @@
1
+ import { SelectionPaneModel, selectionPaneCommands, } from '../../affine-block-surface/index.js';
2
+ import { SelectionPaneProvider, translateKey, } from '../../affine-shared/services/index.js';
3
+ import { menu } from '../../affine-components/context-menu/index.js';
4
+ import { SignalWatcher } from '../../global/lit/index.js';
5
+ import { runCommand } from '../../std/index.js';
6
+ import { LayerIcon } from '@blocksuite/icons/lit';
7
+ import { css, html, LitElement } from 'lit';
8
+ import { QuickToolExtension } from '../extension/index.js';
9
+ import { QuickToolMixin } from '../mixins/index.js';
10
+ import { SELECTION_PANE_TITLE } from '../translations.js';
11
+ export const SELECTION_PANE_TOOL_BUTTON = 'edgeless-selection-pane-tool-button';
12
+ /**
13
+ * The button and its "more tools" entry both run `canvas.selectionPane.toggle`
14
+ * rather than calling the seam, so `SelectionPaneOpened` is emitted in ONE
15
+ * place whichever surface opened the pane.
16
+ */
17
+ function toggleSelectionPane(std) {
18
+ const toggle = selectionPaneCommands.find(command => command.id === 'canvas.selectionPane.toggle');
19
+ if (!toggle)
20
+ return;
21
+ runCommand(std, toggle, {
22
+ surface: 'contextual-toolbar',
23
+ source: 'toolbar:general',
24
+ });
25
+ }
26
+ /**
27
+ * The edgeless toolbar's entry to the selection pane: a quick tool, placed and
28
+ * styled like the undo and frame ones. An action, not a tool mode, so `type`
29
+ * is empty; it reads as active while the library's own pane is open.
30
+ */
31
+ export class EdgelessSelectionPaneToolButton extends QuickToolMixin(SignalWatcher(LitElement)) {
32
+ constructor() {
33
+ super(...arguments);
34
+ this.type = [];
35
+ }
36
+ static { this.styles = css `
37
+ .selection-pane-icon,
38
+ .selection-pane-icon > svg {
39
+ width: 24px;
40
+ height: 24px;
41
+ }
42
+ `; }
43
+ _onClick() {
44
+ toggleSelectionPane(this.edgeless.std);
45
+ }
46
+ render() {
47
+ const { std } = this.edgeless;
48
+ const open = std.getOptional(SelectionPaneModel)?.open$.value ?? false;
49
+ return html `<edgeless-tool-icon-button
50
+ .iconContainerPadding="${6}"
51
+ .tooltip="${translateKey(std, ...SELECTION_PANE_TITLE)}"
52
+ .tooltipOffset=${17}
53
+ .active=${open}
54
+ class="edgeless-selection-pane-tool-button"
55
+ data-testid="selection-pane-tool-button"
56
+ @click=${this._onClick}
57
+ >
58
+ <span class="selection-pane-icon">${LayerIcon()}</span>
59
+ </edgeless-tool-icon-button>`;
60
+ }
61
+ }
62
+ /**
63
+ * Shown only while `SelectionPaneProvider` answers: `SelectionPaneExtension(null)`
64
+ * removes the button with the pane, because a control that opens nothing is a
65
+ * lie. Not hidden on a read-only document — the pane is how a reader finds
66
+ * what is on it.
67
+ *
68
+ * The `menu` entry is what the toolbar moves into its "more tools" menu when a
69
+ * narrow editor leaves no room for the button; a quick tool without one is
70
+ * dropped there, which is how the pane once went missing below ~800 px.
71
+ */
72
+ export const selectionPaneQuickTool = QuickToolExtension('selection-pane', ({ block }) => ({
73
+ content: html `<edgeless-selection-pane-tool-button
74
+ .edgeless=${block}
75
+ ></edgeless-selection-pane-tool-button>`,
76
+ menu: menu.action({
77
+ name: translateKey(block.std, ...SELECTION_PANE_TITLE),
78
+ prefix: LayerIcon(),
79
+ select: () => toggleSelectionPane(block.std),
80
+ }),
81
+ enable: !!block.std.getOptional(SelectionPaneProvider),
82
+ }));