@formicoidea/labre-core 0.43.1 → 0.46.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 (300) 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-callout-into.d.ts +43 -0
  4. package/dist/_pkgs/affine-block-callout/commands/turn-callout-into.js +109 -0
  5. package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.d.ts +29 -0
  6. package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.js +81 -0
  7. package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +6 -4
  8. package/dist/_pkgs/affine-block-callout/configs/toolbar.d.ts +65 -0
  9. package/dist/_pkgs/affine-block-callout/configs/toolbar.js +178 -0
  10. package/dist/_pkgs/affine-block-callout/configs/turn-into.d.ts +8 -0
  11. package/dist/_pkgs/affine-block-callout/configs/turn-into.js +19 -0
  12. package/dist/_pkgs/affine-block-callout/translations.d.ts +4 -2
  13. package/dist/_pkgs/affine-block-callout/translations.js +4 -2
  14. package/dist/_pkgs/affine-block-callout/view.js +10 -1
  15. package/dist/_pkgs/affine-block-code/code-block-service.d.ts +13 -0
  16. package/dist/_pkgs/affine-block-code/code-block-service.js +26 -0
  17. package/dist/_pkgs/affine-block-code/code-block.d.ts +6 -0
  18. package/dist/_pkgs/affine-block-code/code-block.js +11 -2
  19. package/dist/_pkgs/affine-block-code/code-toolbar/components/lang-button.js +31 -8
  20. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
  21. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
  22. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
  23. package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
  24. package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
  25. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
  26. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
  27. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
  28. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
  29. package/dist/_pkgs/affine-block-frame/commands.d.ts +27 -0
  30. package/dist/_pkgs/affine-block-frame/commands.js +49 -0
  31. package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +16 -6
  32. package/dist/_pkgs/affine-block-frame/frame-manager.js +58 -22
  33. package/dist/_pkgs/affine-block-frame/frame-order.d.ts +43 -0
  34. package/dist/_pkgs/affine-block-frame/frame-order.js +93 -0
  35. package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
  36. package/dist/_pkgs/affine-block-frame/index.d.ts +2 -0
  37. package/dist/_pkgs/affine-block-frame/index.js +2 -0
  38. package/dist/_pkgs/affine-block-frame/present/frame-order-menu.d.ts +10 -2
  39. package/dist/_pkgs/affine-block-frame/present/frame-order-menu.js +32 -18
  40. package/dist/_pkgs/affine-block-frame/view.js +6 -0
  41. package/dist/_pkgs/affine-block-image/utils.js +4 -1
  42. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
  43. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
  44. package/dist/_pkgs/affine-block-note/configs/toolbar.d.ts +19 -0
  45. package/dist/_pkgs/affine-block-note/configs/toolbar.js +38 -23
  46. package/dist/_pkgs/affine-block-note/translations.d.ts +2 -1
  47. package/dist/_pkgs/affine-block-note/translations.js +14 -6
  48. package/dist/_pkgs/affine-block-root/configs/toolbar.js +48 -3
  49. package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
  50. package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
  51. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
  52. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
  53. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
  54. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
  55. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
  56. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
  57. package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
  58. package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
  59. package/dist/_pkgs/affine-block-root/translations.d.ts +7 -2
  60. package/dist/_pkgs/affine-block-root/translations.js +10 -13
  61. package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
  62. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
  63. package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
  64. package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
  65. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
  66. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
  69. package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
  70. package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
  72. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
  73. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
  74. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
  75. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
  76. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
  77. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
  78. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
  79. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
  80. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
  81. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
  82. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
  83. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
  84. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
  85. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
  86. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
  87. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
  88. package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
  89. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
  90. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
  91. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
  92. package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
  93. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +91 -0
  94. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +285 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +80 -0
  96. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +355 -0
  97. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
  98. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
  99. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
  100. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
  101. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
  102. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +86 -15
  103. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
  104. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
  105. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
  106. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
  107. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
  108. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
  109. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
  110. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
  111. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
  112. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
  113. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
  114. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
  115. package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
  116. package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
  117. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
  118. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
  119. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
  120. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
  121. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
  122. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
  123. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
  124. package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
  125. package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
  126. package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
  127. package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
  128. package/dist/_pkgs/affine-block-surface/view.js +23 -1
  129. package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
  130. package/dist/_pkgs/affine-components/context-menu/button.js +14 -0
  131. package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
  132. package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
  133. package/dist/_pkgs/affine-components/icons/index.js +0 -1
  134. package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
  135. package/dist/_pkgs/affine-components/icons/text.js +11 -0
  136. package/dist/_pkgs/affine-components/portal/portal.d.ts +1 -1
  137. package/dist/_pkgs/affine-foundation/view.d.ts +8 -8
  138. package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
  139. package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.d.ts +34 -2
  140. package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +194 -81
  141. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.d.ts +7 -4
  142. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +9 -24
  143. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
  144. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
  145. package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +2 -0
  146. package/dist/_pkgs/affine-fragment-frame-panel/index.js +2 -0
  147. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
  148. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
  149. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +3 -2
  150. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
  151. package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
  152. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
  153. package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
  154. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +1 -1
  155. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
  156. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
  157. package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
  158. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +2 -1
  159. package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
  160. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
  161. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
  162. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
  163. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +53 -2
  164. package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
  165. package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
  166. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
  167. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
  168. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
  169. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
  170. package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
  171. package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
  172. package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
  173. package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
  174. package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
  175. package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
  176. package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
  177. package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
  178. package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
  179. package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
  180. package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
  181. package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
  182. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
  183. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
  184. package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
  185. package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
  186. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  187. package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
  188. package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
  189. package/dist/_pkgs/affine-model/consts/text.d.ts +26 -0
  190. package/dist/_pkgs/affine-model/consts/text.js +25 -0
  191. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
  192. package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
  193. package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
  194. package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
  195. package/dist/_pkgs/affine-model/utils/helper.js +2 -0
  196. package/dist/_pkgs/affine-model/utils/types.d.ts +2 -2
  197. package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
  198. package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
  199. package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
  200. package/dist/_pkgs/affine-rich-text/index.js +1 -1
  201. package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
  202. package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
  203. package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
  204. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
  205. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
  206. package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +31 -4
  207. package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
  208. package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
  209. package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
  210. package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
  211. package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +2 -2
  212. package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.d.ts +3 -3
  213. package/dist/_pkgs/affine-shared/services/index.d.ts +4 -1
  214. package/dist/_pkgs/affine-shared/services/index.js +4 -1
  215. package/dist/_pkgs/affine-shared/services/link-preview-service/link-preview-storage.d.ts +4 -4
  216. package/dist/_pkgs/affine-shared/services/outline-panel-service.d.ts +31 -0
  217. package/dist/_pkgs/affine-shared/services/outline-panel-service.js +17 -0
  218. package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
  219. package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
  220. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
  221. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  222. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +16 -0
  223. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +28 -0
  224. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  225. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  226. package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
  227. package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
  228. package/dist/_pkgs/affine-shared/styles/text.js +7 -7
  229. package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
  230. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
  231. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
  232. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
  233. package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
  234. package/dist/_pkgs/affine-shared/utils/index.d.ts +3 -0
  235. package/dist/_pkgs/affine-shared/utils/index.js +3 -0
  236. package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
  237. package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
  238. package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
  239. package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
  240. package/dist/_pkgs/affine-shared/utils/panel-reorder-drag.d.ts +85 -0
  241. package/dist/_pkgs/affine-shared/utils/panel-reorder-drag.js +162 -0
  242. package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +10 -3
  243. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
  244. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
  245. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
  246. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
  247. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
  248. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +62 -0
  249. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +94 -0
  250. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
  251. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
  252. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
  253. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
  254. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
  255. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
  256. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +186 -0
  257. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1417 -0
  258. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +52 -0
  259. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +161 -1
  260. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
  261. package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
  262. package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
  263. package/dist/_pkgs/std/gfx/controller.js +22 -2
  264. package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
  265. package/dist/_pkgs/std/gfx/index.d.ts +3 -1
  266. package/dist/_pkgs/std/gfx/index.js +3 -1
  267. package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
  268. package/dist/_pkgs/std/gfx/layer.js +73 -5
  269. package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
  270. package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
  271. package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
  272. package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
  273. package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
  274. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
  275. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
  276. package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
  277. package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
  278. package/dist/_pkgs/std/scope/std-scope.d.ts +1 -1
  279. package/dist/_pkgs/std/utils/layer.d.ts +10 -0
  280. package/dist/_pkgs/std/utils/layer.js +64 -13
  281. package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
  282. package/dist/commands.js +6 -1
  283. package/dist/host-panels.d.ts +90 -0
  284. package/dist/host-panels.js +111 -0
  285. package/dist/translations.js +10 -6
  286. package/package.json +13 -2
  287. package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
  288. package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
  289. package/dist/_pkgs/affine-fragment-frame-panel/utils/drag.d.ts +0 -27
  290. package/dist/_pkgs/affine-fragment-frame-panel/utils/drag.js +0 -96
  291. package/dist/_pkgs/affine-shared/services/sidebar-service.d.ts +0 -8
  292. package/dist/_pkgs/affine-shared/services/sidebar-service.js +0 -7
  293. package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
  294. package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
  295. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
  296. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
  297. package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
  298. package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
  299. package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
  300. package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
@@ -17,5 +17,57 @@ export declare const EDGELESS_TOOLBAR_MORE_TOOLS: ChromeWording;
17
17
  * is the family name, a proper name the host does not translate.
18
18
  */
19
19
  export declare const EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE: ChromeWording;
20
+ /** The pane's title, and the toolbar button's tooltip. */
21
+ export declare const SELECTION_PANE_TITLE: ChromeWording;
22
+ /**
23
+ * The catalogue's own "Close": the same word on the same kind of side panel,
24
+ * so one key (L7 dedupe: one chrome word, one key). The manifest already
25
+ * declares it for the catalogue, so it is not listed again below.
26
+ */
27
+ export declare const SELECTION_PANE_CLOSE: ChromeWording;
28
+ /** What the pane says on a canvas with nothing on it, or nothing filtered. */
29
+ export declare const SELECTION_PANE_EMPTY: ChromeWording;
30
+ export declare const SELECTION_PANE_FILTER: ChromeWording;
31
+ /** The filter entry that shows every element again. */
32
+ export declare const SELECTION_PANE_FILTER_ALL: ChromeWording;
33
+ /** A frame offered by the filter; `{{name}}` is the frame's own title. */
34
+ export declare const SELECTION_PANE_FILTER_FRAME: ChromeWording;
35
+ /**
36
+ * Under a layer whose members the frame filter all leaves out: how many rows
37
+ * it holds. `{{count}}` is the number; the host pluralises.
38
+ */
39
+ export declare const SELECTION_PANE_LAYER_FILTERED: ChromeWording;
40
+ /** The eye of a visible row: hide it for this viewer only (ADR 0031 §8). */
41
+ export declare const SELECTION_PANE_HIDE: ChromeWording;
42
+ /** The eye of a row this viewer hid: show it again. */
43
+ export declare const SELECTION_PANE_SHOW: ChromeWording;
44
+ /**
45
+ * A row's menu entry that hides it for EVERYONE (ADR 0031 §7): written to
46
+ * the document, painted with the theme's warning tokens.
47
+ */
48
+ export declare const SELECTION_PANE_HIDE_FOR_EVERYONE: ChromeWording;
49
+ /** The same entry on a row hidden for everyone: show it to everyone again. */
50
+ export declare const SELECTION_PANE_SHOW_FOR_EVERYONE: ChromeWording;
51
+ /** The pane's head button that adds a user layer (ADR 0031 §2). */
52
+ export declare const SELECTION_PANE_NEW_LAYER: ChromeWording;
53
+ /** The hint on the active layer's row: where new elements land. */
54
+ export declare const SELECTION_PANE_ACTIVE_LAYER: ChromeWording;
55
+ /**
56
+ * A layer row's menu entry that deletes the layer WITH its members, in one
57
+ * undo step (ADR 0031 §10). Absent on the default layer.
58
+ */
59
+ export declare const SELECTION_PANE_DELETE_LAYER: ChromeWording;
60
+ /** The menu of a row, opened by a right click or its "more" button. */
61
+ export declare const SELECTION_PANE_ROW_MENU: ChromeWording;
62
+ /** The padlock of a locked row; the unlocked one reads `TOOLBAR_LOCK`. */
63
+ export declare const SELECTION_PANE_UNLOCK: ChromeWording;
64
+ export declare const SELECTION_PANE_EXPAND: ChromeWording;
65
+ export declare const SELECTION_PANE_COLLAPSE: ChromeWording;
66
+ /** One wording per element type and gfx block flavour the library ships. */
67
+ export declare const SELECTION_PANE_TYPE_WORDINGS: Readonly<Record<string, ChromeWording>>;
68
+ /** Every `affine:embed-*` flavour: the iframe embed's own word. */
69
+ export declare const SELECTION_PANE_TYPE_EMBED: ChromeWording;
70
+ /** A kind the library does not ship: a framework's own element type. */
71
+ export declare const SELECTION_PANE_TYPE_ELEMENT: ChromeWording;
20
72
  /** Every wording this package declares, in the order it renders them. */
21
73
  export declare const EDGELESS_TOOLBAR_WORDINGS: readonly ChromeWording[];
@@ -1,4 +1,4 @@
1
- import { ICON_BUTTON_COMING_SOON, } from '../affine-shared/services/index.js';
1
+ import { ATTACHMENT_LABEL, ICON_BUTTON_COMING_SOON, IMAGE_LABEL, TOOL_NAME_FRAME, TOOL_NAME_NOTE, } from '../affine-shared/services/index.js';
2
2
  /**
3
3
  * The generic edgeless toolbar's own wordings — not a specific tool's, the
4
4
  * toolbar chrome itself. `STYLE_GENERAL`/`STYLE_SCRIBBLED` (`config/consts.ts`'s
@@ -23,8 +23,168 @@ export const EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE = [
23
23
  'com.labre.edgeless-toolbar.font-family-unavailable',
24
24
  '{{name}} (unavailable)',
25
25
  ];
26
+ /* ── Selection pane (ADR 0031) ────────────────────────────────────────── */
27
+ /** The pane's title, and the toolbar button's tooltip. */
28
+ export const SELECTION_PANE_TITLE = [
29
+ 'com.labre.selection-pane.title',
30
+ 'Selection pane',
31
+ ];
32
+ /**
33
+ * The catalogue's own "Close": the same word on the same kind of side panel,
34
+ * so one key (L7 dedupe: one chrome word, one key). The manifest already
35
+ * declares it for the catalogue, so it is not listed again below.
36
+ */
37
+ export const SELECTION_PANE_CLOSE = [
38
+ 'com.labre.catalogue.close',
39
+ 'Close',
40
+ ];
41
+ /** What the pane says on a canvas with nothing on it, or nothing filtered. */
42
+ export const SELECTION_PANE_EMPTY = [
43
+ 'com.labre.selection-pane.empty',
44
+ 'Nothing on the canvas',
45
+ ];
46
+ export const SELECTION_PANE_FILTER = [
47
+ 'com.labre.selection-pane.filter',
48
+ 'Filter',
49
+ ];
50
+ /** The filter entry that shows every element again. */
51
+ export const SELECTION_PANE_FILTER_ALL = [
52
+ 'com.labre.selection-pane.filter.all',
53
+ 'All elements',
54
+ ];
55
+ /** A frame offered by the filter; `{{name}}` is the frame's own title. */
56
+ export const SELECTION_PANE_FILTER_FRAME = [
57
+ 'com.labre.selection-pane.filter.frame',
58
+ 'Frame: {{name}}',
59
+ ];
60
+ /**
61
+ * Under a layer whose members the frame filter all leaves out: how many rows
62
+ * it holds. `{{count}}` is the number; the host pluralises.
63
+ */
64
+ export const SELECTION_PANE_LAYER_FILTERED = [
65
+ 'com.labre.selection-pane.layer.filtered',
66
+ '{{count}} hidden by the filter',
67
+ ];
68
+ /** The eye of a visible row: hide it for this viewer only (ADR 0031 §8). */
69
+ export const SELECTION_PANE_HIDE = [
70
+ 'com.labre.selection-pane.hide',
71
+ 'Hide for me',
72
+ ];
73
+ /** The eye of a row this viewer hid: show it again. */
74
+ export const SELECTION_PANE_SHOW = [
75
+ 'com.labre.selection-pane.show',
76
+ 'Show',
77
+ ];
78
+ /**
79
+ * A row's menu entry that hides it for EVERYONE (ADR 0031 §7): written to
80
+ * the document, painted with the theme's warning tokens.
81
+ */
82
+ export const SELECTION_PANE_HIDE_FOR_EVERYONE = [
83
+ 'com.labre.selection-pane.hide-for-everyone',
84
+ 'Hide for everyone',
85
+ ];
86
+ /** The same entry on a row hidden for everyone: show it to everyone again. */
87
+ export const SELECTION_PANE_SHOW_FOR_EVERYONE = [
88
+ 'com.labre.selection-pane.show-for-everyone',
89
+ 'Show for everyone',
90
+ ];
91
+ /** The pane's head button that adds a user layer (ADR 0031 §2). */
92
+ export const SELECTION_PANE_NEW_LAYER = [
93
+ 'com.labre.selection-pane.new-layer',
94
+ 'New layer',
95
+ ];
96
+ /** The hint on the active layer's row: where new elements land. */
97
+ export const SELECTION_PANE_ACTIVE_LAYER = [
98
+ 'com.labre.selection-pane.active-layer',
99
+ 'New elements go into this layer',
100
+ ];
101
+ /**
102
+ * A layer row's menu entry that deletes the layer WITH its members, in one
103
+ * undo step (ADR 0031 §10). Absent on the default layer.
104
+ */
105
+ export const SELECTION_PANE_DELETE_LAYER = [
106
+ 'com.labre.selection-pane.delete-layer',
107
+ 'Delete layer',
108
+ ];
109
+ /** The menu of a row, opened by a right click or its "more" button. */
110
+ export const SELECTION_PANE_ROW_MENU = [
111
+ 'com.labre.selection-pane.row-menu',
112
+ 'More actions',
113
+ ];
114
+ /** The padlock of a locked row; the unlocked one reads `TOOLBAR_LOCK`. */
115
+ export const SELECTION_PANE_UNLOCK = [
116
+ 'com.labre.selection-pane.unlock',
117
+ 'Unlock',
118
+ ];
119
+ export const SELECTION_PANE_EXPAND = [
120
+ 'com.labre.selection-pane.expand',
121
+ 'Expand',
122
+ ];
123
+ export const SELECTION_PANE_COLLAPSE = [
124
+ 'com.labre.selection-pane.collapse',
125
+ 'Collapse',
126
+ ];
127
+ /**
128
+ * The wording of a row whose element carries no text and no role: its KIND.
129
+ *
130
+ * The kinds the pane is the first to name get their own keys below; the
131
+ * others reuse the word their tool, slash entry or label already declares (L7
132
+ * dedupe: one chrome word, one key), restated here with the owner's exact
133
+ * fallback because this package cannot import every owner's table.
134
+ */
135
+ const SELECTION_PANE_OWN_TYPE_WORDINGS = {
136
+ shape: ['com.labre.selection-pane.type.shape', 'Shape'],
137
+ text: ['com.labre.selection-pane.type.text', 'Text'],
138
+ group: ['com.labre.selection-pane.type.group', 'Group'],
139
+ brush: ['com.labre.selection-pane.type.brush', 'Drawing'],
140
+ 'affine:bookmark': ['com.labre.selection-pane.type.bookmark', 'Link'],
141
+ 'affine:latex': ['com.labre.selection-pane.type.latex', 'Equation'],
142
+ };
143
+ /** One wording per element type and gfx block flavour the library ships. */
144
+ export const SELECTION_PANE_TYPE_WORDINGS = {
145
+ ...SELECTION_PANE_OWN_TYPE_WORDINGS,
146
+ 'affine:edgeless-text': SELECTION_PANE_OWN_TYPE_WORDINGS.text,
147
+ connector: ['com.labre.connector.toolbar.connector', 'Connector'],
148
+ mindmap: ['com.labre.surface-ref.type.mindmap', 'Mind map'],
149
+ highlighter: ['com.labre.highlight.label', 'Highlight'],
150
+ 'affine:frame': TOOL_NAME_FRAME,
151
+ 'affine:note': TOOL_NAME_NOTE,
152
+ 'affine:image': IMAGE_LABEL,
153
+ 'affine:attachment': ATTACHMENT_LABEL,
154
+ };
155
+ /** Every `affine:embed-*` flavour: the iframe embed's own word. */
156
+ export const SELECTION_PANE_TYPE_EMBED = [
157
+ 'com.labre.embed.iframe.slash.name',
158
+ 'Embed',
159
+ ];
160
+ /** A kind the library does not ship: a framework's own element type. */
161
+ export const SELECTION_PANE_TYPE_ELEMENT = [
162
+ 'com.labre.selection-pane.type.element',
163
+ 'Element',
164
+ ];
26
165
  /** Every wording this package declares, in the order it renders them. */
27
166
  export const EDGELESS_TOOLBAR_WORDINGS = [
28
167
  EDGELESS_TOOLBAR_MORE_TOOLS,
29
168
  EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE,
169
+ SELECTION_PANE_TITLE,
170
+ SELECTION_PANE_EMPTY,
171
+ SELECTION_PANE_FILTER,
172
+ SELECTION_PANE_FILTER_ALL,
173
+ SELECTION_PANE_FILTER_FRAME,
174
+ SELECTION_PANE_LAYER_FILTERED,
175
+ SELECTION_PANE_HIDE,
176
+ SELECTION_PANE_SHOW,
177
+ SELECTION_PANE_HIDE_FOR_EVERYONE,
178
+ SELECTION_PANE_SHOW_FOR_EVERYONE,
179
+ SELECTION_PANE_ROW_MENU,
180
+ SELECTION_PANE_NEW_LAYER,
181
+ SELECTION_PANE_ACTIVE_LAYER,
182
+ SELECTION_PANE_DELETE_LAYER,
183
+ SELECTION_PANE_UNLOCK,
184
+ SELECTION_PANE_EXPAND,
185
+ SELECTION_PANE_COLLAPSE,
186
+ // Only the kinds this pane names first; the reused words are declared by
187
+ // their owners.
188
+ ...Object.values(SELECTION_PANE_OWN_TYPE_WORDINGS),
189
+ SELECTION_PANE_TYPE_ELEMENT,
30
190
  ];
@@ -4,6 +4,9 @@ import { edgelessArtefactCatalogueWidget } from './catalogue/artefact-catalogue-
4
4
  import { edgelessToolbarWidget } from './edgeless-toolbar.js';
5
5
  import { effects } from './effects.js';
6
6
  import { ArtefactPlacementTool } from './placement/artefact-placement-tool.js';
7
+ import { selectionPaneDefaultExtension } from './selection-pane/selection-pane-default.js';
8
+ import { selectionPaneQuickTool } from './selection-pane/selection-pane-tool.js';
9
+ import { edgelessSelectionPaneWidget } from './selection-pane/selection-pane-widget.js';
7
10
  export class EdgelessToolbarViewExtension extends ViewExtensionProvider {
8
11
  constructor() {
9
12
  super(...arguments);
@@ -28,6 +31,13 @@ export class EdgelessToolbarViewExtension extends ViewExtensionProvider {
28
31
  // chrome driven by whatever commands are registered, so a framework whose
29
32
  // flag is off simply never arms it. See `docs/adr/0009`.
30
33
  context.register(ArtefactPlacementTool);
34
+ // The selection pane (ADR 0031), on the catalogue's terms: its panel,
35
+ // the default implementation of its seam, and its toolbar entry, all
36
+ // unconditional. A host replaces or switches it off through
37
+ // `SelectionPaneExtension`; nothing it lists is a flag's business.
38
+ context.register(edgelessSelectionPaneWidget);
39
+ context.register(selectionPaneDefaultExtension);
40
+ context.register(selectionPaneQuickTool);
31
41
  }
32
42
  }
33
43
  }
@@ -32,7 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
32
32
  }
33
33
  return useValue ? value : void 0;
34
34
  };
35
- import { EdgelessLegacySlotIdentifier, getSurfaceComponent, isNoteBlock, } from '../affine-block-surface/index.js';
35
+ import { applyCreationLayer, EdgelessLegacySlotIdentifier, getSurfaceComponent, isNoteBlock, sourceLayerOf, } from '../affine-block-surface/index.js';
36
36
  import { DEFAULT_NOTE_HEIGHT, } from '../affine-model/index.js';
37
37
  import { EDGELESS_BLOCK_CHILD_PADDING } from '../affine-shared/consts/index.js';
38
38
  import { TelemetryProvider } from '../affine-shared/services/index.js';
@@ -192,13 +192,17 @@ let NoteSlicer = (() => {
192
192
  const [x, , width] = deserializeXYWH(xywh);
193
193
  const sliceVerticalPos = this._divingLinePositions[this._activeSlicerIndex].y;
194
194
  const newY = this.gfx.viewport.toModelCoord(x, sliceVerticalPos)[1];
195
- const newNoteId = this.store.addBlock('affine:note', {
195
+ const props = {
196
196
  background,
197
197
  displayMode,
198
198
  xywh: serializeXYWH(x, newY + NEW_NOTE_GAP, width, DEFAULT_NOTE_HEIGHT),
199
199
  index: originalIndex + 1,
200
200
  edgeless: restOfEdgeless,
201
- }, doc.root?.id, originalNoteIndex ? originalNoteIndex + 1 : undefined);
201
+ // The split-off half stays in its note's layer (ADR 0031 §6).
202
+ layer: sourceLayerOf(this._anchorNote),
203
+ };
204
+ applyCreationLayer(this.std, props);
205
+ const newNoteId = this.store.addBlock('affine:note', props, doc.root?.id, originalNoteIndex ? originalNoteIndex + 1 : undefined);
202
206
  doc.moveBlocks(resetBlocks, doc.getModelById(newNoteId));
203
207
  this._activeSlicerIndex = 0;
204
208
  this._selection.set({
@@ -8,6 +8,7 @@ import type { CursorType } from './cursor.js';
8
8
  import { GridManager } from './grid.js';
9
9
  import { KeyboardController } from './keyboard.js';
10
10
  import { LayerManager } from './layer.js';
11
+ import { GfxHiddenForEveryone, GfxLocalVisibility } from './local-visibility.js';
11
12
  import type { PointTestOptions } from './model/base.js';
12
13
  import { GfxBlockElementModel } from './model/gfx-block-model.js';
13
14
  import type { GfxModel } from './model/model.js';
@@ -20,6 +21,18 @@ export declare class GfxController extends LifeCycleWatcher {
20
21
  private readonly _surface$;
21
22
  readonly cursor$: Signal<CursorType>;
22
23
  readonly keyboard: KeyboardController;
24
+ /**
25
+ * What this viewer has hidden on the canvas (ADR 0031 §8). Read by the
26
+ * renderers, the DOM block views, pointer picking and the marquee — never by
27
+ * `grid.search`, whose answer rules and legends share.
28
+ */
29
+ readonly localVisibility: GfxLocalVisibility;
30
+ /**
31
+ * The ids hidden for everyone (ADR 0031 §7), followed on the surface and
32
+ * the store and registered into {@link localVisibility}: what nobody sees
33
+ * is, a fortiori, not seen by this viewer.
34
+ */
35
+ readonly hiddenForEveryone: GfxHiddenForEveryone;
23
36
  readonly viewport: Viewport;
24
37
  get grid(): GridManager;
25
38
  get layer(): LayerManager;
@@ -10,6 +10,7 @@ import { GridManager } from './grid.js';
10
10
  import { gfxControllerKey } from './identifiers.js';
11
11
  import { KeyboardController } from './keyboard.js';
12
12
  import { LayerManager } from './layer.js';
13
+ import { GfxHiddenForEveryone, GfxLocalVisibility, } from './local-visibility.js';
13
14
  import { GfxBlockElementModel } from './model/gfx-block-model.js';
14
15
  import { GfxPrimitiveElementModel } from './model/surface/element-model.js';
15
16
  import { FIT_TO_SCREEN_PADDING, Viewport, ZOOM_INITIAL } from './viewport.js';
@@ -46,11 +47,27 @@ export class GfxController extends LifeCycleWatcher {
46
47
  this._disposables = new DisposableGroup();
47
48
  this._surface$ = new Signal(null);
48
49
  this.cursor$ = new Signal();
50
+ /**
51
+ * What this viewer has hidden on the canvas (ADR 0031 §8). Read by the
52
+ * renderers, the DOM block views, pointer picking and the marquee — never by
53
+ * `grid.search`, whose answer rules and legends share.
54
+ */
55
+ this.localVisibility = new GfxLocalVisibility();
56
+ /**
57
+ * The ids hidden for everyone (ADR 0031 §7), followed on the surface and
58
+ * the store and registered into {@link localVisibility}: what nobody sees
59
+ * is, a fortiori, not seen by this viewer.
60
+ */
61
+ this.hiddenForEveryone = new GfxHiddenForEveryone();
49
62
  this.viewport = new Viewport();
50
63
  this.keyboard = new KeyboardController(std);
51
64
  this._disposables.add(onSurfaceAdded(this.doc, surface => {
52
65
  this._surface$.value = surface;
66
+ this.hiddenForEveryone.watch(this.doc, surface);
53
67
  }));
68
+ this._disposables.add(this.localVisibility.register(this.hiddenForEveryone.ids$));
69
+ this._disposables.add(this.localVisibility.registerLayers(this.hiddenForEveryone.layerIds$));
70
+ this._disposables.add(() => this.hiddenForEveryone.dispose());
54
71
  this._disposables.add(this.viewport);
55
72
  this._disposables.add(this.keyboard);
56
73
  this.std.provider.getAll(GfxClassExtenderIdentifier).forEach(ext => {
@@ -94,8 +111,11 @@ export class GfxController extends LifeCycleWatcher {
94
111
  h: responsePadding[1] * 2,
95
112
  };
96
113
  const candidates = this.grid.search(hitTestBound);
97
- const picked = candidates.filter(elm => elm.includesPoint(x, y, options, this.std.host) ||
98
- elm.externalBound?.isPointInBound([x, y]));
114
+ // A model this viewer hid is not under the pointer: it is not painted,
115
+ // so it cannot be what the user aims at (ADR 0031 §8).
116
+ const picked = candidates.filter(elm => !this.localVisibility.isHidden(elm) &&
117
+ (elm.includesPoint(x, y, options, this.std.host) ||
118
+ elm.externalBound?.isPointInBound([x, y])));
99
119
  picked.sort(this.layer.compare);
100
120
  if (all) {
101
121
  return picked;
@@ -45,8 +45,37 @@ export declare class GridManager extends GfxExtension {
45
45
  remove(element: GfxModel | GfxLocalElementModel): void;
46
46
  /**
47
47
  * Search for elements in a bound.
48
- * @param bound
49
- * @param options
48
+ *
49
+ * Skips the stored `hidden` (mindmap collapse) and NOTHING ELSE, on purpose:
50
+ * this answer is shared by painting, picking AND logic — rules, legends,
51
+ * semantic exports — and a viewer's local hide must never change what
52
+ * another viewer's rules or legend say about the same document (ADR 0031
53
+ * §8). A new visibility is applied by the consumer, never added here.
54
+ *
55
+ * Caller audit (ADR 0031 §9; the row of its table each caller belongs to):
56
+ *
57
+ * - paint — the canvas renderer's bound pass (`_renderByBound`, which also
58
+ * paints the SVG export and the PNG export's canvas layer) and the DOM
59
+ * renderer's two passes: filter through the shared paint predicate
60
+ * (`isPainted`, `affine-block-surface/renderer/paint-predicate.ts`).
61
+ * - paint, blocks — `gfx-viewport`'s `getModelsInViewport` in the edgeless
62
+ * root and its preview: which DOM blocks to mount; a block's own
63
+ * visibility is its view's business.
64
+ * - picking — `GfxController.getElementByPoint` and every caller of it
65
+ * (selection, hover highlights, frame highlight, peek, connector reveal,
66
+ * mindmap drag, pan, text tools, element link, spotlight).
67
+ * - marquee — `GfxController.getElementsByBound` from
68
+ * `InteractivityManager.handleBoxSelection`.
69
+ * - export — `getElementsByBound` from the PNG export (`ExportManager`),
70
+ * the SVG board export (`renderBoardSvg`) and copy-as-PNG
71
+ * (`EdgelessClipboardController`'s canvas path).
72
+ * - logic, keeps every visibility — `getElementsByBound` from the legend
73
+ * (`rolesInBound`, the legend redraw), and the surface-ref slash menu's
74
+ * free-space search (a hidden element still takes its room).
75
+ * - pointer-adjacent, no row in the table yet, keeps every visibility today
76
+ * — the connector tool's connectable targets in view and the snap
77
+ * overlay's alignment candidates: a connector may still attach to, and a
78
+ * drag still snap to, an element the viewer hid.
50
79
  */
51
80
  search<T extends BuiltInFilterType = 'canvas' | 'block'>(bound: IBound, options?: {
52
81
  /**
@@ -10,12 +10,14 @@ export { GfxControllerIdentifier } from './identifiers.js';
10
10
  export type { BoxSelectionContext, DragEndContext, DragExtensionInitializeContext, DragInitializationOption, DragMoveContext, DragStartContext, ExtensionDragEndContext, ExtensionDragMoveContext, ExtensionDragStartContext, GfxInteractivityContext, GfxViewInteractionConfig, ResizeConstraint, ResizeEndContext, ResizeHandle, ResizeMoveContext, ResizeStartContext, RotateConstraint, RotateEndContext, RotateMoveContext, RotateStartContext, SelectContext, } from './interactivity/index.js';
11
11
  export { GfxViewEventManager, GfxViewInteractionExtension, InteractivityExtension, InteractivityIdentifier, InteractivityManager, } from './interactivity/index.js';
12
12
  export { LayerManager, type ReorderingDirection } from './layer.js';
13
+ export { GfxHiddenForEveryone, GfxLocalVisibility, } from './local-visibility.js';
13
14
  export type { GfxCompatibleInterface, GfxElementGeometry, GfxGroupCompatibleInterface, PointTestOptions, } from './model/base.js';
14
15
  export { gfxGroupCompatibleSymbol, isGfxGroupCompatibleModel, } from './model/base.js';
15
16
  export { GfxBlockElementModel, type GfxCommonBlockProps, GfxCompatibleBlockModel as GfxCompatible, type GfxCompatibleProps, } from './model/gfx-block-model.js';
16
17
  export { type GfxModel, isPrimitiveModel } from './model/model.js';
17
18
  export { convert, convertProps, derive, field, getDerivedProps, getFieldPropsSet, getLocalPropsSet, initializeObservers, initializeWatchers, local, observe, updateDerivedProps, watch, } from './model/surface/decorators/index.js';
18
- export { type BaseElementProps, type ForeignInterchange, type InterchangeScope, GfxGroupLikeElementModel, GfxPrimitiveElementModel, type SerializedElement, type ValidationException, } from './model/surface/element-model.js';
19
+ export { type BaseElementProps, type ForeignInterchange, type InterchangeScope, GfxGroupLikeElementModel, GfxPrimitiveElementModel, isStoredHiddenForEveryone, type SerializedElement, type ValidationException, } from './model/surface/element-model.js';
20
+ export { DEFAULT_LAYER_ID, layerCarrierOf, ownLayerOf, type SurfaceLayerRecord, SurfaceUserLayers, } from './model/surface/user-layers.js';
19
21
  export { GfxLocalElementModel, prop, } from './model/surface/local-element-model.js';
20
22
  export { collectPivotOccurrences, isPivotBound, type PivotBoundElement, type PivotOccurrence, resolvePivotBinding, } from './model/surface/pivot.js';
21
23
  export { type EdgeDirectionDef, findRoleDef, isTypedEdgeRole, type RoleDef, type RoleDefs, type RoleId, roleIsA, type RoleKind, RoleVocabularyExtension, RoleVocabularyIdentifier, } from './model/surface/role.js';
@@ -8,11 +8,13 @@ export { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_HIGHLIGHT_PADDING, ElementHighlight
8
8
  export { GfxControllerIdentifier } from './identifiers.js';
9
9
  export { GfxViewEventManager, GfxViewInteractionExtension, InteractivityExtension, InteractivityIdentifier, InteractivityManager, } from './interactivity/index.js';
10
10
  export { LayerManager } from './layer.js';
11
+ export { GfxHiddenForEveryone, GfxLocalVisibility, } from './local-visibility.js';
11
12
  export { gfxGroupCompatibleSymbol, isGfxGroupCompatibleModel, } from './model/base.js';
12
13
  export { GfxBlockElementModel, GfxCompatibleBlockModel as GfxCompatible, } from './model/gfx-block-model.js';
13
14
  export { isPrimitiveModel } from './model/model.js';
14
15
  export { convert, convertProps, derive, field, getDerivedProps, getFieldPropsSet, getLocalPropsSet, initializeObservers, initializeWatchers, local, observe, updateDerivedProps, watch, } from './model/surface/decorators/index.js';
15
- export { GfxGroupLikeElementModel, GfxPrimitiveElementModel, } from './model/surface/element-model.js';
16
+ export { GfxGroupLikeElementModel, GfxPrimitiveElementModel, isStoredHiddenForEveryone, } from './model/surface/element-model.js';
17
+ export { DEFAULT_LAYER_ID, layerCarrierOf, ownLayerOf, SurfaceUserLayers, } from './model/surface/user-layers.js';
16
18
  export { GfxLocalElementModel, prop, } from './model/surface/local-element-model.js';
17
19
  export { collectPivotOccurrences, isPivotBound, resolvePivotBinding, } from './model/surface/pivot.js';
18
20
  export { findRoleDef, isTypedEdgeRole, roleIsA, RoleVocabularyExtension, RoleVocabularyIdentifier, } from './model/surface/role.js';
@@ -225,6 +225,10 @@ export class InteractivityManager extends GfxExtension {
225
225
  }
226
226
  handleBoxSelection(context) {
227
227
  const elements = this.gfx.getElementsByBound(context.box).filter(model => {
228
+ // The marquee takes what the viewer sees: a locally hidden model is
229
+ // left out (ADR 0031 §8). The selection pane still selects it.
230
+ if (this.gfx.localVisibility.isHidden(model))
231
+ return false;
228
232
  const view = this.gfx.view.get(model);
229
233
  if (!view ||
230
234
  view.onBoxSelected({
@@ -283,6 +287,9 @@ export class InteractivityManager extends GfxExtension {
283
287
  onDragMove(lastEvent);
284
288
  });
285
289
  const onDragMove = (event) => {
290
+ // The viewport watcher replays the latest pointer position; without
291
+ // this it replayed the drag start and snapped the elements back.
292
+ lastEvent = event;
286
293
  dragLastPos = Point.from(this.gfx.viewport.toModelCoordFromClientCoord([event.x, event.y]));
287
294
  const moveContext = {
288
295
  ...internal,
@@ -220,11 +220,22 @@ export class LayerManager extends GfxExtension {
220
220
  layerElements[0],
221
221
  last(layerElements),
222
222
  ], target)) {
223
- const insertIdx = layerElements.findIndex((_, idx) => {
224
- const pre = layerElements[idx - 1];
225
- return (compare(target, layerElements[idx]) < 0 &&
226
- (!pre || compare(target, pre) >= 0));
227
- });
223
+ // The first element `target` sorts before. The layer is sorted and
224
+ // `target` is in its range, so that position is found by bisection
225
+ // rather than by comparing `target` with every element: a frame
226
+ // adopting N children re-inserted each of them, N² comparisons.
227
+ let low = 0;
228
+ let high = layerElements.length;
229
+ while (low < high) {
230
+ const mid = (low + high) >>> 1;
231
+ if (compare(target, layerElements[mid]) < 0) {
232
+ high = mid;
233
+ }
234
+ else {
235
+ low = mid + 1;
236
+ }
237
+ }
238
+ const insertIdx = low;
228
239
  if (layer.type === type) {
229
240
  addToLayer(layer, target, insertIdx);
230
241
  updateLayersZIndex(layers, cur);
@@ -468,6 +479,31 @@ export class LayerManager extends GfxExtension {
468
479
  * @returns
469
480
  */
470
481
  generateIndex(reverse = false) {
482
+ // With user layers the paint order is layer rank first (ADR 0031 §4), so
483
+ // the first and last runs no longer hold the lowest and highest `index`.
484
+ // "Above everything" must still mean above every key, which, rank first,
485
+ // is the top of whichever layer the new element lands in.
486
+ // Every model is scanned, not the runs' edges: a run can span two user
487
+ // layers, and the lower layer's highest key then sits mid-run.
488
+ if (this._surface?.userLayers.ranks) {
489
+ let lowest = null;
490
+ let highest = null;
491
+ for (const model of [...this.canvasElements, ...this.blocks]) {
492
+ const index = model.index;
493
+ if (typeof index !== 'string')
494
+ continue;
495
+ if (lowest === null || index < lowest)
496
+ lowest = index;
497
+ if (highest === null || index > highest)
498
+ highest = index;
499
+ }
500
+ if (lowest === null || highest === null) {
501
+ return LayerManager.INITIAL_INDEX;
502
+ }
503
+ return reverse
504
+ ? generateKeyBetween(null, lowest)
505
+ : generateKeyBetween(highest, null);
506
+ }
471
507
  if (reverse) {
472
508
  const firstIndex = this.layers[0]?.indexes[0];
473
509
  return firstIndex
@@ -493,6 +529,13 @@ export class LayerManager extends GfxExtension {
493
529
  }
494
530
  else {
495
531
  elements = this.layers.reduce((pre, current) => pre.concat(current.elements.filter(element => element.group == null)), []);
532
+ // Forward / backward / front / back move an element WITHIN its user
533
+ // layer (ADR 0031 §4): its neighbours are that layer's members only.
534
+ const userLayers = this._surface?.userLayers;
535
+ if (userLayers?.ranks) {
536
+ const own = userLayers.effectiveLayerOf(element);
537
+ elements = elements.filter(other => userLayers.effectiveLayerOf(other) === own);
538
+ }
496
539
  }
497
540
  const currentIdx = elements.indexOf(element);
498
541
  switch (direction) {
@@ -553,6 +596,13 @@ export class LayerManager extends GfxExtension {
553
596
  }
554
597
  if (payload.type === 'update') {
555
598
  const block = store.getModelById(payload.id);
599
+ // A block moved to another user layer (ADR 0031 §3) stacks
600
+ // elsewhere: re-sort it as if its `index` changed.
601
+ if (payload.props.key === 'layer' &&
602
+ block instanceof GfxBlockElementModel &&
603
+ this.blocks.includes(block)) {
604
+ this.update(block);
605
+ }
556
606
  if ((payload.props.key === 'index' ||
557
607
  payload.props.key === 'childElementIds') &&
558
608
  block instanceof GfxBlockElementModel &&
@@ -599,6 +649,24 @@ export class LayerManager extends GfxExtension {
599
649
  if (payload.props['index'] || payload.props['childIds']) {
600
650
  this.update(surface.getElementById(payload.id), payload.props);
601
651
  }
652
+ else if ('layer' in payload.props || 'layer' in payload.oldValues) {
653
+ // Moved to another user layer (ADR 0031 §3), set or cleared:
654
+ // re-sort as an `index` change would (a group re-sorts whole).
655
+ const element = surface.getElementById(payload.id);
656
+ if (element)
657
+ this.update(element);
658
+ }
659
+ }));
660
+ // The layer list changed — created, reordered, removed (ADR 0031 §2):
661
+ // every rank may have moved, so the whole order is rebuilt.
662
+ this._disposable.add(surface.propsUpdated.subscribe(({ key }) => {
663
+ if (key !== 'layers')
664
+ return;
665
+ this._reset();
666
+ this.slots.layerUpdated.next({
667
+ type: 'update',
668
+ initiatingElement: surface,
669
+ });
602
670
  }));
603
671
  this._disposable.add(surface.elementRemoved.subscribe(payload => this.delete(payload.model)));
604
672
  this._disposable.add(surface.localElementAdded.subscribe(elm => {