@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
@@ -276,13 +276,42 @@ const INSET_BOTTOM = 56;
276
276
  * It is also why a legend never lists itself: nothing it draws carries a role.
277
277
  */
278
278
  export function rolesInBound(gfx, bound) {
279
+ return rolesOf(gfx.getElementsByBound(bound, { type: 'canvas' }));
280
+ }
281
+ /** {@link rolesInBound} over a perimeter already scanned. */
282
+ function rolesOf(elements) {
279
283
  const present = new Set();
280
- for (const el of gfx.getElementsByBound(bound, { type: 'canvas' })) {
284
+ for (const el of elements) {
281
285
  if (el.role !== undefined)
282
286
  present.add(el.role);
283
287
  }
284
288
  return present;
285
289
  }
290
+ /**
291
+ * The legends ALREADY drawn on this board — what turns the button's second
292
+ * press into "regenerate" rather than a second stacked box (issue #391).
293
+ *
294
+ * The scan already sees them: a generated legend's wrapper carries
295
+ * {@link LEGEND_ROLE}, so recognising one costs a filter over the elements the
296
+ * perimeter pass returned, and nothing in the document format changes.
297
+ *
298
+ * CONTAINMENT rather than intersection, which is what `getElementsByBound`
299
+ * answers with: two boards drawn edge to edge each overlap the other's corner,
300
+ * and the press on one would eat the other's box. A legend is inset well inside
301
+ * the board it documents, so asking for the whole box costs nothing here and
302
+ * keeps the neighbour's.
303
+ *
304
+ * Two boxes it deliberately does not find: one the author dragged off the board
305
+ * (it is no longer this board's legend, and a fresh one is drawn), and one
306
+ * generated before {@link LEGEND_ROLE} shipped in 0.42 — that box carries no
307
+ * role, so the old stacking survives on those documents. Nothing is backfilled,
308
+ * as ever (ADR 0026).
309
+ */
310
+ function legendsOn(elements, bound) {
311
+ return elements.filter(el => el.type === 'group' &&
312
+ el.role === LEGEND_ROLE &&
313
+ bound.contains(el.elementBound));
314
+ }
286
315
  /** Every registered vocabulary, merged — a role id is namespaced, so it is flat. */
287
316
  function vocabularyOf(std) {
288
317
  const merged = {};
@@ -410,15 +439,32 @@ function boardLegendBox(std, owner) {
410
439
  * Build the legend of what is drawn inside `board` and drop it bottom-left of
411
440
  * it, grouped and selected. THE gesture the shared toolbar button runs.
412
441
  *
442
+ * REPLACES the board's own legend if it already has one, rather than stacking a
443
+ * second box on the first (issue #391): the placement is derived from the board
444
+ * alone, so every press landed at the same pixel and the copies were invisible
445
+ * — one box to the eye, N groups and N × ~15 elements in the document. The
446
+ * second press is therefore a REFRESH, which is what a user who has just added
447
+ * three artefacts is asking for; the cost is that hand retouching of the box is
448
+ * lost, and one undo brings it back (see {@link legendsOn} and ADR 0026).
449
+ *
413
450
  * Returns the group id, or `undefined` when there is no surface to draw on.
414
451
  */
415
452
  export function createBoardLegend(std, board, owner) {
416
453
  const gfx = std.get(GfxControllerIdentifier);
417
454
  const surface = gfx.surface;
418
- if (!surface)
455
+ // The button already refuses on a readonly document; said again here because
456
+ // this gesture now DELETES before it draws, and a refused delete followed by
457
+ // a throwing draw is the one order that could lose a box.
458
+ if (!surface || std.store.readonly)
419
459
  return undefined;
420
460
  const bound = Bound.deserialize(board.xywh);
421
- const present = rolesInBound(gfx, bound);
461
+ const inside = gfx.getElementsByBound(bound, { type: 'canvas' });
462
+ const previous = legendsOn(inside, bound);
463
+ // The box about to be drawn describes the DRAWING, never the box it replaces:
464
+ // the outgoing wrapper is dropped from the scan so `core:legend` is not among
465
+ // the roles the rows are derived from. Its glyphs carry no role at all.
466
+ const outgoing = new Set(previous);
467
+ const present = rolesOf(inside.filter(el => !outgoing.has(el)));
422
468
  const sections = legendFromCommands(std, owner, present);
423
469
  const box = boardLegendBox(std, owner);
424
470
  const layout = {
@@ -432,7 +478,17 @@ export function createBoardLegend(std, board, owner) {
432
478
  const extras = box?.extras?.({ std, board, present }) ?? [];
433
479
  const title = translateKey(std, ...(box?.titleWording ?? BOARD_LEGEND_TITLE));
434
480
  const { height } = measureLegend(sections, layout, extras);
481
+ // ONE checkpoint, in front of BOTH halves of the replacement: a single
482
+ // Ctrl+Z after a regenerate puts the previous box back whole, rather than
483
+ // leaving the board with no legend at all.
435
484
  std.store.captureSync();
485
+ if (previous.length > 0) {
486
+ const crud = std.get(EdgelessCRUDIdentifier);
487
+ // Cascades into the group's children (`crud-extension.ts`), so one call
488
+ // per legend takes the whole box away.
489
+ for (const legend of previous)
490
+ crud.removeElement(legend.id);
491
+ }
436
492
  const id = addLegend(surface, std, bound.x + INSET_X, bound.y + bound.h - INSET_BOTTOM - height, { title, sections, extras, ...layout });
437
493
  gfx.selection.set({ elements: [id], editing: false });
438
494
  return id;
@@ -229,6 +229,10 @@ export function morphToolbarConfig(spec) {
229
229
  return renderPickerMenu({
230
230
  testId: 'element-morph',
231
231
  label: wording(ctx, spec.label),
232
+ // The shell's accessible name stays the stable ENGLISH
233
+ // identifier: composing it from the translated label produced
234
+ // half a sentence per language (#390).
235
+ menuAria: `${spec.label.fallback.toLowerCase()}-menu`,
232
236
  // The current kind's own icon on the closed button, exactly as the
233
237
  // shape picker shows the current shape: the dropdown reads as a
234
238
  // statement about the selection before it is opened.
@@ -130,13 +130,20 @@ export declare class ReadingProposalWidget extends EditorAnchoredPanel {
130
130
  */
131
131
  private _renderValueFlow;
132
132
  /**
133
- * Where the subject sits along the frame's phase axis.
133
+ * The zone of the frame the subject sits in — Wardley's evolution phase, a
134
+ * Core Domain Chart's quadrant, a BPMN lane — under the framework's own
135
+ * heading (`frame.label`), or the engine's default for a profile that names
136
+ * none (`readingFrameWording`).
134
137
  *
135
- * Absent ENTIRELY — not "no phase to read" — for a framework that declares no
136
- * frame. The empty state below is about a component that could have been on a
137
- * map and is not; telling the author of a BPMN task that it is "not on a
138
- * framework background" would be answering a question their notation never
139
- * asks.
138
+ * Absent ENTIRELY — not "no zone to read" — for a framework that declares no
139
+ * frame. The empty state below is about an artefact that could have been on
140
+ * a frame and is not, in the framework's own words (`frame.none`) or the
141
+ * default ones.
142
+ *
143
+ * The zone is named the way the board names it: the user's words when they
144
+ * wrote some (a renamed quadrant, a lane's name), the vocabulary otherwise,
145
+ * and "Unnamed" for a zone the board paints but never writes on — never the
146
+ * zone's id, which is not a word anyone drew.
140
147
  */
141
148
  private _renderPhase;
142
149
  private _renderNaming;
@@ -40,7 +40,7 @@ import { css, html, nothing } from 'lit';
40
40
  import { state } from 'lit/decorators.js';
41
41
  import { literal, unsafeStatic } from 'lit/static-html.js';
42
42
  import { EditorAnchoredPanel, editorAnchoredPanelStyles, } from './editor-anchored-panel.js';
43
- import { PivotRecordPickerProvider, ReadingManager, readingRelationDefs, readRecord, readValueFlows, } from './reading.js';
43
+ import { PivotRecordPickerProvider, ReadingManager, readingFrameWording, readingRelationDefs, readRecord, readValueFlows, } from './reading.js';
44
44
  export const READING_PROPOSAL_WIDGET = 'affine-reading-proposal-widget';
45
45
  /** The two commands the confirmations drive. Spelled once. */
46
46
  const TAG_SET_ID = 'tag.set';
@@ -514,21 +514,37 @@ let ReadingProposalWidget = (() => {
514
514
  </div>`)}`);
515
515
  }
516
516
  /**
517
- * Where the subject sits along the frame's phase axis.
517
+ * The zone of the frame the subject sits in — Wardley's evolution phase, a
518
+ * Core Domain Chart's quadrant, a BPMN lane — under the framework's own
519
+ * heading (`frame.label`), or the engine's default for a profile that names
520
+ * none (`readingFrameWording`).
518
521
  *
519
- * Absent ENTIRELY — not "no phase to read" — for a framework that declares no
520
- * frame. The empty state below is about a component that could have been on a
521
- * map and is not; telling the author of a BPMN task that it is "not on a
522
- * framework background" would be answering a question their notation never
523
- * asks.
522
+ * Absent ENTIRELY — not "no zone to read" — for a framework that declares no
523
+ * frame. The empty state below is about an artefact that could have been on
524
+ * a frame and is not, in the framework's own words (`frame.none`) or the
525
+ * default ones.
526
+ *
527
+ * The zone is named the way the board names it: the user's words when they
528
+ * wrote some (a renamed quadrant, a lane's name), the vocabulary otherwise,
529
+ * and "Unnamed" for a zone the board paints but never writes on — never the
530
+ * zone's id, which is not a word anyone drew.
524
531
  */
525
532
  _renderPhase(reading, profile) {
526
533
  if (!profile.frame)
527
534
  return nothing;
535
+ const { label, none } = readingFrameWording(profile.frame);
528
536
  const { phase } = reading;
529
- return this._field('reading-phase', translateKey(this.std, 'com.labre.reading.field.phase', 'Evolution phase'), phase
537
+ const words = !phase
538
+ ? ''
539
+ : phase.name !== undefined
540
+ ? phase.name.trim()
541
+ : phase.labelKey !== undefined
542
+ ? translateKey(this.std, phase.labelKey, phase.labelFallback ?? phase.labelKey)
543
+ : (phase.labelFallback ?? '');
544
+ return this._field('reading-phase', translateKey(this.std, label.labelKey, label.labelFallback), phase
530
545
  ? html `<div class="reading-value" data-zone-id=${phase.zoneId}>
531
- ${translateKey(this.std, phase.labelKey ?? phase.zoneId, phase.labelFallback ?? phase.zoneId)}
546
+ ${words ||
547
+ translateKey(this.std, 'com.labre.reading.zone.unnamed', 'Unnamed')}
532
548
  </div>
533
549
  ${phase.inTransitionBand
534
550
  ? html `<div class="reading-note" data-testid="reading-phase-band">
@@ -537,7 +553,7 @@ let ReadingProposalWidget = (() => {
537
553
  </div>`
538
554
  : nothing}`
539
555
  : html `<div class="reading-empty" data-testid="reading-phase-none">
540
- ${translateKey(this.std, 'com.labre.reading.phase.none', 'Not on a framework background — no phase to read.')}
556
+ ${translateKey(this.std, none.labelKey, none.labelFallback)}
541
557
  </div>`);
542
558
  }
543
559
  _renderNaming(reading) {
@@ -1,4 +1,4 @@
1
- import { type TagDef } from '../../affine-shared/services/index.js';
1
+ import { type ChromeWording, type TagDef } from '../../affine-shared/services/index.js';
2
2
  import { LifeCycleWatcher, type BlockStdScope, type FrameworkId } from '../../std/index.js';
3
3
  import type { RoleDefs, RoleId } from '../../std/gfx/index.js';
4
4
  import { GfxPrimitiveElementModel } from '../../std/gfx/index.js';
@@ -92,6 +92,14 @@ export interface ReadingRelationSideLabel {
92
92
  /** The framework's own English wording, for a host that ships no catalogue. */
93
93
  labelFallback: string;
94
94
  }
95
+ /**
96
+ * One wording a framework declares for the frame field of the panel: key plus
97
+ * its own English, so a host with no catalogue still reads a real phrase.
98
+ */
99
+ export interface ReadingFrameWording {
100
+ labelKey: string;
101
+ labelFallback: string;
102
+ }
95
103
  /**
96
104
  * The typed edge a reading walks, and the two words the framework reads it
97
105
  * with.
@@ -185,13 +193,41 @@ export interface ReadingProfile {
185
193
  * reads them in, so the first is the question the artefact answers first.
186
194
  */
187
195
  alsoRelations?: readonly ReadingRelationDef[];
188
- /** The frame the phase is read from. */
196
+ /**
197
+ * The frame the subject's ZONE is read from — Wardley's evolution phase, a
198
+ * Core Domain Chart's quadrant, a BPMN pool's lane.
199
+ */
189
200
  frame?: {
190
201
  backgroundRole: RoleId;
191
202
  /** The declaration itself, carried as data exactly like `roles` is. */
192
203
  background: FrameworkBackgroundDef;
193
- /** Which plot axis the zones are laid along. */
194
- axis: 'x' | 'y';
204
+ /**
205
+ * The plot axis the zones are laid ALONG, for a frame read in one
206
+ * dimension: Wardley's phases are columns of the evolution axis, so only
207
+ * the `x` position matters and a component in the top or bottom margin of
208
+ * the plot still has a phase.
209
+ *
210
+ * Absent, the frame is read in TWO dimensions: the subject is in the zone
211
+ * whose rectangle holds its centre — a quadrant, a lane — and nowhere when
212
+ * none does. A 2D frame has no transition band.
213
+ */
214
+ axis?: 'x' | 'y';
215
+ /**
216
+ * The panel's heading for the field — "Evolution phase", "Zone", "Lane".
217
+ * The framework's own word, like a relation's sides: the panel used to
218
+ * hard-code Wardley's, which a chart or a pool would have worn too.
219
+ *
220
+ * Optional because a 0.43 profile has no such field and a minor release
221
+ * never breaks a host: absent, the panel reads
222
+ * {@link READING_FRAME_DEFAULT_WORDING}, which is what 0.43 showed for
223
+ * every frame (`readingFrameWording`).
224
+ */
225
+ label?: ReadingFrameWording;
226
+ /**
227
+ * What the field says when the subject sits in no zone of any frame.
228
+ * Optional for the reason {@link label} is, with the same default.
229
+ */
230
+ none?: ReadingFrameWording;
195
231
  };
196
232
  /**
197
233
  * Which properties of the PIVOT RECORD the reading may compare itself
@@ -207,6 +243,21 @@ export interface ReadingProfile {
207
243
  phase?: string;
208
244
  };
209
245
  }
246
+ /** The default frame wording, as the rows the key manifest walks. */
247
+ export declare const READING_FRAME_WORDINGS: readonly ChromeWording[];
248
+ /** The default frame wording, as a profile's `frame.label` / `frame.none`. */
249
+ export declare const READING_FRAME_DEFAULT_WORDING: Readonly<{
250
+ label: ReadingFrameWording;
251
+ none: ReadingFrameWording;
252
+ }>;
253
+ /**
254
+ * The two wordings the panel reads a frame with: the framework's own where it
255
+ * declares them, {@link READING_FRAME_DEFAULT_WORDING} where it does not.
256
+ */
257
+ export declare function readingFrameWording(frame: NonNullable<ReadingProfile['frame']>): {
258
+ label: ReadingFrameWording;
259
+ none: ReadingFrameWording;
260
+ };
210
261
  /** Where the other end of a typed edge sits, relative to the subject. */
211
262
  export type ReadingRelationSide = 'consumer' | 'supplier';
212
263
  /**
@@ -271,12 +322,24 @@ export interface ReadingRelation {
271
322
  */
272
323
  contradictsGeometry: boolean;
273
324
  }
274
- /** Where the subject sits along the frame's phase axis. */
325
+ /**
326
+ * The zone of the frame the subject sits in: a phase along an axis, or a
327
+ * region of the plane (see `ReadingProfile.frame.axis`).
328
+ */
275
329
  export interface ReadingPhase {
276
- /** The declared zone id, e.g. `product`. */
330
+ /** The zone id, e.g. `product`, or `lane:<id>` for an instance zone. */
277
331
  zoneId: string;
332
+ /** The declared zone's vocabulary, absent on a zone the board never names. */
278
333
  labelKey?: string;
279
334
  labelFallback?: string;
335
+ /**
336
+ * The words the USER wrote for this zone, which is what the board paints in
337
+ * place of the vocabulary: a renamed zone label stored on the frame (the
338
+ * declaration's `label.prop`), or a lane's name. Wins over
339
+ * {@link labelKey} exactly as it does on the canvas (`backgroundLabelText`),
340
+ * so the panel and the board never name one zone two ways.
341
+ */
342
+ name?: string;
280
343
  /**
281
344
  * The subject sits in the band around a zone transition — Wardley's zone of
282
345
  * punctuated equilibrium, declared by the background as
@@ -331,6 +394,19 @@ export interface ElementReading {
331
394
  /** `undefined` with no nature, no convention for it, or no name to judge. */
332
395
  naming: ReadingNaming | undefined;
333
396
  }
397
+ /**
398
+ * The subject's NAME.
399
+ *
400
+ * Its own text first, then — because a framework artefact on this canvas is a
401
+ * composite — the text of the sibling carrying the profile's label role. That
402
+ * is the same fact `tags-toolbar.ts` works around from the other direction: one
403
+ * click selects the group, the role lives on the circle, and the name lives on
404
+ * a free text beside it.
405
+ *
406
+ * Exported for the selection pane, which names its rows the same way (ADR 0031
407
+ * §12): one rule for "what is this element called", not two.
408
+ */
409
+ export declare function readName(element: GfxPrimitiveElementModel, profile: Pick<ReadingProfile, 'labelRole' | 'roles'>): string;
334
410
  /** What the reading needs to know that is not in the document. */
335
411
  export interface ReadingOptions {
336
412
  /**
@@ -8,7 +8,49 @@ import { effect, signal } from '@preact/signals-core';
8
8
  // reading is a one-way read of pure declaration data that must never pull a
9
9
  // canvas in.
10
10
  import { backgroundPlot, } from '../framework-background/def.js';
11
- import { backgroundTransitionBands, containingFrame, } from '../framework-background/facts.js';
11
+ import { backgroundPlotRatios, backgroundTransitionBands, backgroundZoneAt, backgroundZones, containingFrame, } from '../framework-background/facts.js';
12
+ /**
13
+ * The frame wording of a profile that declares none — the heading and the
14
+ * empty state 0.43 showed for every frame, before a framework could name its
15
+ * own.
16
+ *
17
+ * Owned by the ENGINE rather than by Wardley, whose words they also are,
18
+ * because a host profile written against 0.43 reads with them too: declared in
19
+ * a framework bundle, they would vanish from a host that does not install it.
20
+ * Wardley's profile declares no wording and inherits these.
21
+ *
22
+ * Spelled as `[key, English]` rows, the form the key manifest walks and its
23
+ * drift check pairs with this declaration, then read as a profile's wording.
24
+ */
25
+ const READING_FRAME_DEFAULT_LABEL = [
26
+ 'com.labre.reading.field.phase',
27
+ 'Evolution phase',
28
+ ];
29
+ const READING_FRAME_DEFAULT_NONE = [
30
+ 'com.labre.reading.phase.none',
31
+ 'Not on a framework background — no phase to read.',
32
+ ];
33
+ /** The default frame wording, as the rows the key manifest walks. */
34
+ export const READING_FRAME_WORDINGS = [
35
+ READING_FRAME_DEFAULT_LABEL,
36
+ READING_FRAME_DEFAULT_NONE,
37
+ ];
38
+ const asFrameWording = ([labelKey, labelFallback,]) => ({ labelKey, labelFallback });
39
+ /** The default frame wording, as a profile's `frame.label` / `frame.none`. */
40
+ export const READING_FRAME_DEFAULT_WORDING = {
41
+ label: asFrameWording(READING_FRAME_DEFAULT_LABEL),
42
+ none: asFrameWording(READING_FRAME_DEFAULT_NONE),
43
+ };
44
+ /**
45
+ * The two wordings the panel reads a frame with: the framework's own where it
46
+ * declares them, {@link READING_FRAME_DEFAULT_WORDING} where it does not.
47
+ */
48
+ export function readingFrameWording(frame) {
49
+ return {
50
+ label: frame.label ?? READING_FRAME_DEFAULT_WORDING.label,
51
+ none: frame.none ?? READING_FRAME_DEFAULT_WORDING.none,
52
+ };
53
+ }
12
54
  /**
13
55
  * Every relation table a profile declares, in reading order.
14
56
  *
@@ -102,8 +144,11 @@ function groupMembers(element) {
102
144
  * is the same fact `tags-toolbar.ts` works around from the other direction: one
103
145
  * click selects the group, the role lives on the circle, and the name lives on
104
146
  * a free text beside it.
147
+ *
148
+ * Exported for the selection pane, which names its rows the same way (ADR 0031
149
+ * §12): one rule for "what is this element called", not two.
105
150
  */
106
- function readName(element, profile) {
151
+ export function readName(element, profile) {
107
152
  const own = ownText(element);
108
153
  if (own)
109
154
  return own;
@@ -168,13 +213,37 @@ function frameOf(element, elements, profile) {
168
213
  roleIsA(candidate.role, frame.backgroundRole, profile.roles)), candidate => candidate.elementBound);
169
214
  }
170
215
  /**
171
- * The phase, read from the position and the frame's DECLARED zones.
216
+ * How a zone is named, as the BOARD names it: the user's own words first — a
217
+ * renamed label stored on the frame, a lane's name — then the vocabulary.
172
218
  *
173
- * Two facts, both taken from the declaration and never from a number in this
174
- * file: which zone the subject's centre falls in, and whether it is inside the
175
- * band around a transition. The second is the "zone of punctuated equilibrium"
176
- * — the frontier is a region, not a coordinate — and a component sitting in one
177
- * is a different statement from a component sitting in a phase.
219
+ * The same precedence `backgroundLabelText` paints with, minus the translation:
220
+ * the reading carries the key and the panel resolves it, so the record and the
221
+ * drift comparison keep working on the vocabulary.
222
+ */
223
+ function zoneWording(zone, model) {
224
+ const label = zone.label;
225
+ const stored = label?.prop !== undefined ? model[label.prop] : undefined;
226
+ const name = stored !== undefined && stored !== null ? String(stored) : zone.name;
227
+ return {
228
+ ...(label?.labelKey !== undefined ? { labelKey: label.labelKey } : {}),
229
+ ...(label?.fallback !== undefined ? { labelFallback: label.fallback } : {}),
230
+ ...(name !== undefined ? { name } : {}),
231
+ };
232
+ }
233
+ /**
234
+ * The zone, read from the position and the zones the frame INSTANCE has
235
+ * ({@link backgroundZones}: the framework's in the instance's variant, then the
236
+ * instance's own).
237
+ *
238
+ * Along an axis (Wardley), two facts, both taken from the declaration and never
239
+ * from a number in this file: which zone the subject's centre falls in, and
240
+ * whether it is inside the band around a transition. The second is the "zone of
241
+ * punctuated equilibrium" — the frontier is a region, not a coordinate — and a
242
+ * component sitting in one is a different statement from a component sitting in
243
+ * a phase.
244
+ *
245
+ * In the plane (no `axis`: a Core Domain Chart, a BPMN pool), the zone whose
246
+ * rectangle holds the centre, through the helper the audit uses, and no band.
178
247
  */
179
248
  function readPhase(element, elements, profile) {
180
249
  const frame = profile.frame;
@@ -185,11 +254,25 @@ function readPhase(element, elements, profile) {
185
254
  return undefined;
186
255
  const def = frame.background;
187
256
  const bound = background.elementBound;
257
+ const model = background;
258
+ const zones = backgroundZones(def, model);
259
+ const axis = frame.axis;
260
+ if (axis === undefined) {
261
+ const at = backgroundPlotRatios(def, bound, element.elementBound);
262
+ const zone = at === null ? undefined : backgroundZoneAt(zones, at);
263
+ if (!zone)
264
+ return undefined;
265
+ return {
266
+ zoneId: zone.id,
267
+ ...zoneWording(zone, model),
268
+ inTransitionBand: false,
269
+ };
270
+ }
188
271
  const plot = backgroundPlot(def, bound.w, bound.h);
189
272
  const [cx, cy] = centreOf(element.elementBound);
190
- const along = frame.axis === 'x' ? cx : cy;
191
- const origin = frame.axis === 'x' ? bound.x + plot.x0 : bound.y + plot.y0;
192
- const span = frame.axis === 'x' ? plot.width : plot.height;
273
+ const along = axis === 'x' ? cx : cy;
274
+ const origin = axis === 'x' ? bound.x + plot.x0 : bound.y + plot.y0;
275
+ const span = axis === 'x' ? plot.width : plot.height;
193
276
  if (!(span > 0))
194
277
  return undefined;
195
278
  const ratio = (along - origin) / span;
@@ -198,25 +281,20 @@ function readPhase(element, elements, profile) {
198
281
  // phase it is visibly not in.
199
282
  if (ratio < 0 || ratio > 1)
200
283
  return undefined;
201
- const zone = (def.zones ?? []).find(({ rect }) => {
202
- const start = frame.axis === 'x' ? rect.x : rect.y;
203
- const size = frame.axis === 'x' ? rect.w : rect.h;
284
+ const zone = zones.find(({ rect }) => {
285
+ const start = axis === 'x' ? rect.x : rect.y;
286
+ const size = axis === 'x' ? rect.w : rect.h;
204
287
  // Half-open, so a component exactly on a divider reads as the phase it is
205
288
  // entering — the same side the band below reports as the frontier.
206
289
  return ratio >= start && (ratio < start + size || start + size >= 1);
207
290
  });
208
291
  if (!zone)
209
292
  return undefined;
210
- const bands = backgroundTransitionBands(def, bound)[frame.axis];
293
+ const bands = backgroundTransitionBands(def, bound)[axis];
211
294
  const band = bands.find(({ min, max }) => along >= min && along <= max);
212
295
  return {
213
296
  zoneId: zone.id,
214
- ...(zone.label?.labelKey !== undefined
215
- ? { labelKey: zone.label.labelKey }
216
- : {}),
217
- ...(zone.label?.fallback !== undefined
218
- ? { labelFallback: zone.label.fallback }
219
- : {}),
297
+ ...zoneWording(zone, model),
220
298
  inTransitionBand: band !== undefined,
221
299
  ...(band !== undefined ? { bandId: band.id } : {}),
222
300
  };
@@ -0,0 +1,80 @@
1
+ import type { BlockStdScope } from '../../../std/index.js';
2
+ import type { SelectionPaneNode } from './tree.js';
3
+ /**
4
+ * Move `id` so it sits directly ABOVE `above` in the stack — `null` puts it at
5
+ * the bottom of its stack. Answers whether anything was written.
6
+ *
7
+ * The drop target of a drag in a top-first list: dropping a row just over row
8
+ * X means "directly above X". The new `index` is a key between the two
9
+ * neighbours (the same `fractional-indexing` keys `LayerManager` generates), so
10
+ * one field of one model is written and nothing else moves.
11
+ *
12
+ * Refused, with nothing written: a read-only document; a mindmap node (it has
13
+ * no index of its own — the whole mindmap moves as one, as the toolbar's
14
+ * reorder already says); an `above` that is not stacked with `id`; and a
15
+ * target that is where the model already is.
16
+ */
17
+ export declare function reorderPaneElement(std: BlockStdScope, id: string, above: string | null): boolean;
18
+ /**
19
+ * Lock or unlock each model ON ITS OWN. Answers whether anything was written.
20
+ *
21
+ * Deliberately not the contextual toolbar's lock: that one, given several
22
+ * elements, wraps them into a new group and locks the group — a structural
23
+ * edit a row's padlock must never make. Here each row keeps its place in the
24
+ * tree; only `lockedBySelf` changes, and only where it differs.
25
+ */
26
+ export declare function setPaneElementsLocked(std: BlockStdScope, ids: readonly string[], locked: boolean): boolean;
27
+ /**
28
+ * Hide models for EVERYONE, or show them again (ADR 0031 §7). Answers how
29
+ * many models were written.
30
+ *
31
+ * Writes the stored `hiddenForEveryone` — never `hidden`, which mindmap
32
+ * collapse owns. Hiding writes `true`; showing REMOVES the key (`clearField`
33
+ * on an element, the props proxy's delete on a block), never stores `false`,
34
+ * so an unhidden document is byte-identical to one never hidden. Models
35
+ * already in the asked state are skipped, so a gesture that changes nothing
36
+ * writes nothing and pushes no undo step; the rest go in one transaction
37
+ * after one `captureSync()`.
38
+ */
39
+ export declare function setPaneElementsHiddenForEveryone(std: BlockStdScope, ids: readonly string[], hidden: boolean): number;
40
+ /**
41
+ * Rename a group through its existing stored `title`. Answers whether
42
+ * anything was written. An empty or unchanged title writes nothing.
43
+ */
44
+ export declare function renamePaneGroup(std: BlockStdScope, id: string, title: string): boolean;
45
+ /**
46
+ * Rename a frame through its existing stored `title`, edited in place — the
47
+ * `Text` the frame's own title editor binds to, never a replaced one, so an
48
+ * open title editor keeps its binding. Answers whether anything was written.
49
+ * An empty or unchanged title writes nothing.
50
+ */
51
+ export declare function renamePaneFrame(std: BlockStdScope, id: string, title: string): boolean;
52
+ /** Something the pane can be filtered by: a frame, and only a frame. */
53
+ export interface SelectionPaneFilterTarget {
54
+ id: string;
55
+ /**
56
+ * Always `'frame'`. A framework board was offered too until the product
57
+ * owner's review narrowed the filter to frames (ADR 0031, amendments); the
58
+ * field stays so a host reading it has nothing to change.
59
+ */
60
+ kind: 'frame';
61
+ }
62
+ /** The frames on the canvas, top first — what the pane's filter offers. */
63
+ export declare function selectionPaneFilterTargets(std: BlockStdScope): SelectionPaneFilterTarget[];
64
+ /**
65
+ * The ids a frame filter keeps: the frame itself — a row like any other, so
66
+ * the list keeps showing what it is filtered by (ADR 0031, amendments) — its
67
+ * `childElementIds` and their descendants. `null` for an id that is not a
68
+ * frame.
69
+ */
70
+ export declare function selectionPaneFilterMembers(std: BlockStdScope, targetId: string): Set<string> | null;
71
+ /**
72
+ * The tree narrowed to `members`: a row is kept when it is a member or holds
73
+ * one, so a group reaching into a frame stays as the path to its member.
74
+ *
75
+ * A LAYER row is always kept, its children narrowed (ADR 0031, amendments): a
76
+ * layer is where new elements land and where a drop goes, not something a
77
+ * frame holds, and a layer created under a filter that hid it read as a
78
+ * "New layer" button doing nothing.
79
+ */
80
+ export declare function filterSelectionPaneTree(nodes: readonly SelectionPaneNode[], members: ReadonlySet<string>): SelectionPaneNode[];