@formicoidea/labre-core 0.42.0 → 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 (367) 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-data-view/configs/tooltips.js +1 -1
  17. package/dist/_pkgs/affine-block-database/configs/tooltips.js +1 -1
  18. package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +4 -2
  19. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
  20. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
  21. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
  22. package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
  23. package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.d.ts +39 -0
  24. package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.js +39 -0
  25. package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
  26. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -0
  27. package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts +14 -1
  28. package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js +21 -2
  29. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
  30. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +0 -2
  31. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -5
  32. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -1
  33. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +14 -6
  34. package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.d.ts +16 -0
  35. package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.js +17 -1
  36. package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +2 -0
  37. package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -0
  38. package/dist/_pkgs/affine-block-embed/index.d.ts +1 -0
  39. package/dist/_pkgs/affine-block-embed/index.js +1 -0
  40. package/dist/_pkgs/affine-block-embed/translations.d.ts +8 -0
  41. package/dist/_pkgs/affine-block-embed/translations.js +28 -0
  42. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
  43. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -2
  44. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
  45. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
  46. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
  47. package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
  48. package/dist/_pkgs/affine-block-frame/frame-manager.js +53 -19
  49. package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
  50. package/dist/_pkgs/affine-block-image/utils.js +4 -1
  51. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
  52. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
  53. package/dist/_pkgs/affine-block-list/utils/get-list-icon.js +3 -1
  54. package/dist/_pkgs/affine-block-note/configs/tooltips.js +1 -1
  55. package/dist/_pkgs/affine-block-note/translations.d.ts +0 -1
  56. package/dist/_pkgs/affine-block-note/translations.js +0 -5
  57. package/dist/_pkgs/affine-block-root/adapters/html.js +2 -2
  58. package/dist/_pkgs/affine-block-root/commands/copy-link-commands.d.ts +2 -0
  59. package/dist/_pkgs/affine-block-root/commands/copy-link-commands.js +155 -0
  60. package/dist/_pkgs/affine-block-root/configs/toolbar.js +17 -1
  61. package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
  62. package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
  63. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
  64. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
  65. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
  66. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
  67. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
  68. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
  69. package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
  70. package/dist/_pkgs/affine-block-root/index.js +1 -0
  71. package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
  72. package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
  73. package/dist/_pkgs/affine-block-root/view.js +2 -0
  74. package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
  75. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
  76. package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
  77. package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
  78. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
  79. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
  80. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
  81. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
  82. package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
  85. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
  86. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
  87. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
  88. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
  89. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
  90. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
  91. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
  92. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
  93. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
  94. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
  96. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
  97. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
  98. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
  99. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
  100. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
  101. package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
  102. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +13 -1
  103. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +8 -0
  104. package/dist/_pkgs/affine-block-surface/extensions/legend.js +59 -3
  105. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -0
  106. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
  107. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
  108. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
  109. package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
  110. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +80 -0
  111. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +248 -0
  112. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +82 -0
  113. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +342 -0
  114. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
  115. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
  116. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
  117. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
  118. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +3 -0
  119. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +23 -0
  120. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
  121. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +98 -19
  122. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
  123. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
  124. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
  125. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
  126. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
  127. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
  128. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
  129. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
  130. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
  131. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
  132. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
  133. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
  134. package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +1 -1
  135. package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
  136. package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
  137. package/dist/_pkgs/affine-block-surface/framework-background/fit.d.ts +36 -0
  138. package/dist/_pkgs/affine-block-surface/framework-background/fit.js +30 -0
  139. package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +1 -0
  140. package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
  141. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
  142. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
  143. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
  144. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
  145. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
  146. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +2 -7
  147. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
  148. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
  149. package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
  150. package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
  151. package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
  152. package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
  153. package/dist/_pkgs/affine-block-surface/view.js +23 -1
  154. package/dist/_pkgs/affine-block-surface-ref/configs/tooltips.js +2 -2
  155. package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
  156. package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +5 -0
  157. package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
  158. package/dist/_pkgs/affine-components/context-menu/button.js +17 -1
  159. package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
  160. package/dist/_pkgs/affine-components/icons/ai.js +3 -3
  161. package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
  162. package/dist/_pkgs/affine-components/icons/index.js +0 -1
  163. package/dist/_pkgs/affine-components/icons/list.js +7 -1
  164. package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
  165. package/dist/_pkgs/affine-components/icons/text.js +11 -0
  166. package/dist/_pkgs/affine-components/size-dropdown-menu/dropdown-menu.js +6 -1
  167. package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -1
  168. package/dist/_pkgs/affine-components/toolbar/index.js +1 -1
  169. package/dist/_pkgs/affine-components/toolbar/menu-button.d.ts +7 -0
  170. package/dist/_pkgs/affine-components/toolbar/menu-button.js +30 -0
  171. package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +16 -1
  172. package/dist/_pkgs/affine-components/toolbar/picker-menu.js +2 -2
  173. package/dist/_pkgs/affine-components/toolbar/toolbar.d.ts +1 -0
  174. package/dist/_pkgs/affine-components/toolbar/toolbar.js +67 -0
  175. package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
  176. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card-title-editor.js +1 -1
  177. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +3 -3
  178. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
  179. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
  180. package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +1 -0
  181. package/dist/_pkgs/affine-fragment-frame-panel/index.js +1 -0
  182. package/dist/_pkgs/affine-gfx-brush/toolbar/components/eraser/icons.js +1 -1
  183. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +11 -2
  184. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +11 -2
  185. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
  186. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
  187. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +6 -4
  188. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +24 -8
  189. package/dist/_pkgs/affine-gfx-connector/translations.d.ts +3 -0
  190. package/dist/_pkgs/affine-gfx-connector/translations.js +23 -0
  191. package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
  192. package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
  193. package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
  194. package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +6 -0
  195. package/dist/_pkgs/affine-gfx-mindmap/translations.js +10 -0
  196. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
  197. package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
  198. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +5 -3
  199. package/dist/_pkgs/affine-gfx-shape/translations.d.ts +7 -0
  200. package/dist/_pkgs/affine-gfx-shape/translations.js +11 -0
  201. package/dist/_pkgs/affine-gfx-template/builtin/other.js +13 -7
  202. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
  203. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
  204. package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
  205. package/dist/_pkgs/affine-gfx-template/toolbar/template-loading.js +1 -1
  206. package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
  207. package/dist/_pkgs/affine-gfx-template/translations.js +38 -0
  208. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +5 -3
  209. package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
  210. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
  211. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
  212. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
  213. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +56 -3
  214. package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
  215. package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
  216. package/dist/_pkgs/affine-gfx-text/translations.d.ts +8 -0
  217. package/dist/_pkgs/affine-gfx-text/translations.js +12 -0
  218. package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -1
  219. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
  220. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
  221. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
  222. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
  223. package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
  224. package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
  225. package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
  226. package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
  227. package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
  228. package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
  229. package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
  230. package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
  231. package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
  232. package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
  233. package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
  234. package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
  235. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
  236. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
  237. package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
  238. package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
  239. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  240. package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
  241. package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
  242. package/dist/_pkgs/affine-model/consts/text.d.ts +41 -2
  243. package/dist/_pkgs/affine-model/consts/text.js +50 -1
  244. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
  245. package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
  246. package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
  247. package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
  248. package/dist/_pkgs/affine-model/utils/helper.js +2 -0
  249. package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
  250. package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
  251. package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
  252. package/dist/_pkgs/affine-rich-text/index.js +1 -1
  253. package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
  254. package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
  255. package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
  256. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
  257. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
  258. package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +27 -0
  259. package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
  260. package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
  261. package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
  262. package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
  263. package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +13 -2
  264. package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -54
  265. package/dist/_pkgs/affine-shared/services/index.d.ts +3 -0
  266. package/dist/_pkgs/affine-shared/services/index.js +3 -0
  267. package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
  268. package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
  269. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
  270. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  271. package/dist/_pkgs/affine-shared/services/theme-service.d.ts +19 -0
  272. package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
  273. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +25 -0
  274. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +90 -0
  275. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  276. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  277. package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
  278. package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
  279. package/dist/_pkgs/affine-shared/styles/text.js +7 -7
  280. package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
  281. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
  282. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
  283. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
  284. package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
  285. package/dist/_pkgs/affine-shared/utils/index.d.ts +2 -0
  286. package/dist/_pkgs/affine-shared/utils/index.js +2 -0
  287. package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
  288. package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
  289. package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
  290. package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
  291. package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +2 -2
  292. package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +15 -4
  293. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
  294. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/types.d.ts +15 -0
  295. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.d.ts +1 -1
  296. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.js +7 -2
  297. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
  298. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
  299. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
  300. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
  301. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.d.ts +18 -0
  302. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.js +52 -6
  303. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +61 -0
  304. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +91 -0
  305. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
  306. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
  307. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
  308. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
  309. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
  310. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
  311. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +170 -0
  312. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1381 -0
  313. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +58 -0
  314. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +171 -1
  315. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
  316. package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
  317. package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
  318. package/dist/_pkgs/affine-widget-slash-menu/translations.d.ts +16 -0
  319. package/dist/_pkgs/affine-widget-slash-menu/translations.js +23 -1
  320. package/dist/_pkgs/affine-widget-toolbar/utils.js +57 -14
  321. package/dist/_pkgs/data-view/core/detail/field.js +2 -1
  322. package/dist/_pkgs/data-view/core/filter/literal/define.js +3 -1
  323. package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +1 -1
  324. package/dist/_pkgs/data-view/property-presets/checkbox/cell-renderer.js +8 -2
  325. package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +1 -1
  326. package/dist/_pkgs/data-view/view-presets/kanban/pc/controller/drag.js +2 -1
  327. package/dist/_pkgs/data-view/view-presets/table/pc/controller/drag.js +2 -1
  328. package/dist/_pkgs/data-view/view-presets/table/pc/controller/selection.js +1 -1
  329. package/dist/_pkgs/data-view/view-presets/table/pc/header/vertical-indicator.js +2 -1
  330. package/dist/_pkgs/data-view/view-presets/table/pc/row/row-select-checkbox.js +3 -1
  331. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/drag.js +2 -1
  332. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/selection.js +1 -1
  333. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js +2 -1
  334. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/row-header.js +3 -1
  335. package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
  336. package/dist/_pkgs/std/gfx/controller.js +22 -2
  337. package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
  338. package/dist/_pkgs/std/gfx/index.d.ts +3 -1
  339. package/dist/_pkgs/std/gfx/index.js +3 -1
  340. package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
  341. package/dist/_pkgs/std/gfx/layer.js +73 -5
  342. package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
  343. package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
  344. package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
  345. package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
  346. package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
  347. package/dist/_pkgs/std/gfx/model/surface/role.d.ts +10 -5
  348. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
  349. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
  350. package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
  351. package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
  352. package/dist/_pkgs/std/utils/layer.d.ts +10 -0
  353. package/dist/_pkgs/std/utils/layer.js +64 -13
  354. package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
  355. package/dist/commands.js +6 -2
  356. package/dist/translations.js +15 -6
  357. package/package.json +13 -2
  358. package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
  359. package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
  360. package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
  361. package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
  362. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
  363. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
  364. package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
  365. package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
  366. package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
  367. package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
@@ -25,6 +25,21 @@ export type Menu<T> = {
25
25
  tooltip?: string;
26
26
  /** {@link tooltip}, for the translation seam. */
27
27
  tooltipWording?: ChromeWording;
28
+ /**
29
+ * The accessible name of the MENU shell (`aria-label` on
30
+ * `editor-menu-button`) — its own key, never a composition (#390).
31
+ *
32
+ * Before this field the shell's name was sewn together as
33
+ * `` `${resolvedLabel.toLowerCase()}-menu` ``, which was a stable
34
+ * identifier while `label` was English and became half-translated
35
+ * ("changer le type de forme-menu") the day `label` joined the seam. The
36
+ * precedent is `ROOT_ALIGNMENT_MENU_ARIA` (`blocks/root`): a menu's aria is
37
+ * a wording of its own.
38
+ *
39
+ * Left out, the name is composed from the ENGLISH {@link label}, so a
40
+ * caller that declares nothing keeps exactly the identifier it had.
41
+ */
42
+ menuAriaWording?: ChromeWording;
28
43
  items: MenuItem<T>[];
29
44
  currentValue: T;
30
45
  onPick: (value: T) => void;
@@ -7,6 +7,6 @@ export declare function renderCurrentMenuItemWith<T, F extends keyof MenuItem<T>
7
7
  * resolved through `std` when the caller has one, else its `key` literal.
8
8
  */
9
9
  export declare function resolveMenuItemLabel<T>(items: MenuItem<T>[], currentValue: T, std?: BlockStdScope): string | undefined;
10
- export declare function renderMenu<T>({ label, labelWording, tooltip, tooltipWording, icon, items, currentValue, onPick, std, }: Menu<T>): import("lit-html").TemplateResult<1>;
10
+ export declare function renderMenu<T>({ label, labelWording, tooltip, tooltipWording, menuAriaWording, icon, items, currentValue, onPick, std, }: Menu<T>): import("lit-html").TemplateResult<1>;
11
11
  export declare function renderMenuItems<T>(items: MenuItem<T>[], currentValue: T, onPick: (value: T) => void, std?: BlockStdScope): unknown;
12
12
  export declare function getRootBlock(ctx: ToolbarContext): BlockComponent | null;
@@ -18,14 +18,19 @@ export function resolveMenuItemLabel(items, currentValue, std) {
18
18
  ? translateKey(std, ...item.keyWording)
19
19
  : item.key;
20
20
  }
21
- export function renderMenu({ label, labelWording, tooltip, tooltipWording, icon, items, currentValue, onPick, std, }) {
21
+ export function renderMenu({ label, labelWording, tooltip, tooltipWording, menuAriaWording, icon, items, currentValue, onPick, std, }) {
22
22
  const resolvedLabel = labelWording && std ? translateKey(std, ...labelWording) : label;
23
23
  const resolvedTooltip = tooltipWording && std
24
24
  ? translateKey(std, ...tooltipWording)
25
25
  : (tooltip ?? resolvedLabel);
26
+ // Composed from the ENGLISH `label`, never `resolvedLabel` (#390): sewing
27
+ // `-menu` onto a translated word produced "changer le type de forme-menu".
28
+ const menuAria = menuAriaWording && std
29
+ ? translateKey(std, ...menuAriaWording)
30
+ : `${label.toLowerCase()}-menu`;
26
31
  return html `
27
32
  <editor-menu-button
28
- aria-label="${`${resolvedLabel.toLowerCase()}-menu`}"
33
+ aria-label="${menuAria}"
29
34
  .button=${html `
30
35
  <editor-icon-button
31
36
  aria-label="${resolvedLabel}"
@@ -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';
@@ -1,9 +1,27 @@
1
1
  import { FontFamily } from '../../affine-model/index.js';
2
+ import type { BlockStdScope } from '../../std/index.js';
2
3
  import { LitElement } from 'lit';
3
4
  export declare class EdgelessFontFamilyPanel extends LitElement {
4
5
  static styles: import("lit").CSSResult;
6
+ /**
7
+ * The families the host configured: those with at least one face in its
8
+ * `FontConfig` (#396). Read from the config itself rather than from
9
+ * `document.fonts`, which the font loader fills a few seconds late for every
10
+ * non-critical family.
11
+ *
12
+ * `null` when no config is registered (the seam is absent, or empty, which
13
+ * the font loader also treats as absent): every family is offered, as before
14
+ * the seam narrowed the list. None of them has a file then, so each paints
15
+ * with the same fallback anyway.
16
+ */
17
+ private _configuredFamilies;
5
18
  private _onSelect;
19
+ private _unavailableLabel;
6
20
  render(): unknown;
7
21
  accessor onSelect: ((value: FontFamily) => void) | undefined;
22
+ /** Set by the caller that has one (`gfx/text`'s `createTextActions`): it
23
+ * carries the host's `FontConfig` and translations. Optional, so the panel
24
+ * still renders (every family, in English) when created with none. */
25
+ accessor std: BlockStdScope | undefined;
8
26
  accessor value: FontFamily;
9
27
  }
@@ -34,15 +34,20 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
34
34
  };
35
35
  import { TextUtils } from '../../affine-block-surface/index.js';
36
36
  import { FontFamily, FontFamilyList } from '../../affine-model/index.js';
37
+ import { fillPlaceholders, FontConfigIdentifier, translateKey, } from '../../affine-shared/services/index.js';
37
38
  import { DoneIcon } from '@blocksuite/icons/lit';
38
39
  import { css, html, LitElement, nothing } from 'lit';
39
40
  import { property } from 'lit/decorators.js';
40
41
  import { repeat } from 'lit/directives/repeat.js';
42
+ import { EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE } from '../translations.js';
41
43
  let EdgelessFontFamilyPanel = (() => {
42
44
  let _classSuper = LitElement;
43
45
  let _onSelect_decorators;
44
46
  let _onSelect_initializers = [];
45
47
  let _onSelect_extraInitializers = [];
48
+ let _std_decorators;
49
+ let _std_initializers = [];
50
+ let _std_extraInitializers = [];
46
51
  let _value_decorators;
47
52
  let _value_initializers = [];
48
53
  let _value_extraInitializers = [];
@@ -50,8 +55,10 @@ let EdgelessFontFamilyPanel = (() => {
50
55
  static {
51
56
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
57
  _onSelect_decorators = [property({ attribute: false })];
58
+ _std_decorators = [property({ attribute: false })];
53
59
  _value_decorators = [property({ attribute: false })];
54
60
  __esDecorate(this, null, _onSelect_decorators, { kind: "accessor", name: "onSelect", static: false, private: false, access: { has: obj => "onSelect" in obj, get: obj => obj.onSelect, set: (obj, value) => { obj.onSelect = value; } }, metadata: _metadata }, _onSelect_initializers, _onSelect_extraInitializers);
61
+ __esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
55
62
  __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
56
63
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
57
64
  }
@@ -67,26 +74,59 @@ let EdgelessFontFamilyPanel = (() => {
67
74
  width: 100%;
68
75
  }
69
76
  `; }
77
+ /**
78
+ * The families the host configured: those with at least one face in its
79
+ * `FontConfig` (#396). Read from the config itself rather than from
80
+ * `document.fonts`, which the font loader fills a few seconds late for every
81
+ * non-critical family.
82
+ *
83
+ * `null` when no config is registered (the seam is absent, or empty, which
84
+ * the font loader also treats as absent): every family is offered, as before
85
+ * the seam narrowed the list. None of them has a file then, so each paints
86
+ * with the same fallback anyway.
87
+ */
88
+ _configuredFamilies() {
89
+ const config = this.std?.getOptional(FontConfigIdentifier);
90
+ if (!config || config.length === 0)
91
+ return null;
92
+ return new Set(config.map(face => face.font));
93
+ }
70
94
  _onSelect(value) {
71
95
  this.value = value;
72
96
  if (this.onSelect) {
73
97
  this.onSelect(value);
74
98
  }
75
99
  }
100
+ _unavailableLabel(name) {
101
+ return this.std
102
+ ? translateKey(this.std, ...EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE, {
103
+ name,
104
+ })
105
+ : fillPlaceholders(EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE[1], { name });
106
+ }
76
107
  render() {
77
- return repeat(FontFamilyList, item => item[0], ([font, name]) => {
78
- const active = this.value === font;
108
+ const configured = this._configuredFamilies();
109
+ // The current family stays listed even when the host no longer ships it:
110
+ // the element keeps it (and paints the fallback), so the picker names it
111
+ // rather than pretend the text has none. Greyed and never picked from
112
+ // here, so nothing rewrites the stored value behind the user's back.
113
+ const families = FontFamilyList.filter(([font]) => !configured || configured.has(font) || font === this.value);
114
+ return repeat(families, item => item[0], ([font, name]) => {
115
+ const unavailable = !!configured && !configured.has(font);
116
+ const current = this.value === font;
79
117
  return html `
80
118
  <edgeless-tool-icon-button
81
119
  data-font="${name}"
82
120
  style="font-family: ${TextUtils.wrapFontFamily(font)}"
83
121
  .iconContainerPadding=${[4, 8]}
84
122
  .justify=${'space-between'}
85
- .active=${active}
123
+ .active=${current && !unavailable}
124
+ .disabled=${unavailable}
86
125
  .iconSize=${'20px'}
87
- @click=${() => this._onSelect(font)}
126
+ @click=${unavailable ? nothing : () => this._onSelect(font)}
88
127
  >
89
- ${name} ${active ? DoneIcon() : nothing}
128
+ ${unavailable ? this._unavailableLabel(name) : name}
129
+ ${current ? DoneIcon() : nothing}
90
130
  </edgeless-tool-icon-button>
91
131
  `;
92
132
  });
@@ -94,7 +134,13 @@ let EdgelessFontFamilyPanel = (() => {
94
134
  #onSelect_accessor_storage = __runInitializers(this, _onSelect_initializers, undefined);
95
135
  get onSelect() { return this.#onSelect_accessor_storage; }
96
136
  set onSelect(value) { this.#onSelect_accessor_storage = value; }
97
- #value_accessor_storage = (__runInitializers(this, _onSelect_extraInitializers), __runInitializers(this, _value_initializers, FontFamily.Inter));
137
+ #std_accessor_storage = (__runInitializers(this, _onSelect_extraInitializers), __runInitializers(this, _std_initializers, undefined));
138
+ /** Set by the caller that has one (`gfx/text`'s `createTextActions`): it
139
+ * carries the host's `FontConfig` and translations. Optional, so the panel
140
+ * still renders (every family, in English) when created with none. */
141
+ get std() { return this.#std_accessor_storage; }
142
+ set std(value) { this.#std_accessor_storage = value; }
143
+ #value_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _value_initializers, FontFamily.Inter));
98
144
  get value() { return this.#value_accessor_storage; }
99
145
  set value(value) { this.#value_accessor_storage = value; }
100
146
  constructor() {
@@ -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 {};