@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
@@ -64,10 +64,16 @@ export declare function indexOverBackgrounds(siblings: readonly StackedElement[]
64
64
  * it, the same raise applies — superposed boards stack in the order they
65
65
  * were placed, each still under its own artefacts — unless it ENCLOSES that
66
66
  * background, in which case it is the sheet the other is drawn on and stays
67
- * under it ({@link encloses}). Otherwise, if it covers an artefact it
68
- * overlaps, it is acting as a lid: lower it to just above the floor it lies
69
- * on, or to the back of the surface when it lies on bare canvas. Otherwise
70
- * nothing.
67
+ * under it ({@link encloses}). Otherwise, if it was just PLACED and covers
68
+ * an artefact it overlaps, it is acting as a lid: lower it to just above
69
+ * the floor it lies on, or to the back of the surface when it lies on bare
70
+ * canvas. Otherwise nothing.
71
+ *
72
+ * `gesture` says which: `'placed'` (created, pasted, duplicated, inserted from
73
+ * a template or an import) or `'moved'`. A move never lowers a board (ADR
74
+ * 0033): the user may have put it above an artefact on purpose, from the
75
+ * selection pane or with "bring forward", and their own drag of that board
76
+ * must not undo it. Moved over free elements, a board now covers them.
71
77
  *
72
78
  * `siblings` are the OTHER top-level elements of the surface — canvas elements
73
79
  * and blocks alike, since the surface paints both by index — with `element`
@@ -89,7 +95,7 @@ export declare function indexOverBackgrounds(siblings: readonly StackedElement[]
89
95
  * state writes nothing — no corrupted depth, and no extra entry pushed onto
90
96
  * the history stack.
91
97
  */
92
- export declare function stackingIndexFor(element: StackedElement, siblings: readonly StackedElement[]): string | null;
98
+ export declare function stackingIndexFor(element: StackedElement, siblings: readonly StackedElement[], gesture?: 'placed' | 'moved'): string | null;
93
99
  /**
94
100
  * The top-level elements of a surface as {@link StackedElement}s — blocks as
95
101
  * well as canvas elements, since the surface paints both by index — minus the
@@ -111,9 +117,11 @@ export declare function stackedElementsOf(gfx: GfxController, exclude?: GfxModel
111
117
  *
112
118
  * Two gestures produce a wrong depth, and they are the two this listens for:
113
119
  * an element CREATED (every creation site mints the top of the stack, so a
114
- * board drawn last covers what it was drawn around) and an element MOVED (onto
115
- * a board that is above it, or over free elements it then hides). Anything
116
- * else — a resize, a colour, a rename — cannot change who covers whom.
120
+ * board drawn last covers what it was drawn around) and an element MOVED onto
121
+ * a board that is above it. A board moved over free elements it then hides is
122
+ * deliberately NOT one of them (ADR 0033): a board's depth after it is placed
123
+ * is the user's. Anything else — a resize, a colour, a rename — cannot change
124
+ * who covers whom.
117
125
  *
118
126
  * Frames are BLOCKS: their own two gestures are already handled, at creation
119
127
  * by `frameIndexAt` and on a move by `_watchFrameMoved` (#223), so this never
@@ -63,10 +63,16 @@ export function indexOverBackgrounds(siblings, box) {
63
63
  * it, the same raise applies — superposed boards stack in the order they
64
64
  * were placed, each still under its own artefacts — unless it ENCLOSES that
65
65
  * background, in which case it is the sheet the other is drawn on and stays
66
- * under it ({@link encloses}). Otherwise, if it covers an artefact it
67
- * overlaps, it is acting as a lid: lower it to just above the floor it lies
68
- * on, or to the back of the surface when it lies on bare canvas. Otherwise
69
- * nothing.
66
+ * under it ({@link encloses}). Otherwise, if it was just PLACED and covers
67
+ * an artefact it overlaps, it is acting as a lid: lower it to just above
68
+ * the floor it lies on, or to the back of the surface when it lies on bare
69
+ * canvas. Otherwise nothing.
70
+ *
71
+ * `gesture` says which: `'placed'` (created, pasted, duplicated, inserted from
72
+ * a template or an import) or `'moved'`. A move never lowers a board (ADR
73
+ * 0033): the user may have put it above an artefact on purpose, from the
74
+ * selection pane or with "bring forward", and their own drag of that board
75
+ * must not undo it. Moved over free elements, a board now covers them.
70
76
  *
71
77
  * `siblings` are the OTHER top-level elements of the surface — canvas elements
72
78
  * and blocks alike, since the surface paints both by index — with `element`
@@ -88,7 +94,7 @@ export function indexOverBackgrounds(siblings, box) {
88
94
  * state writes nothing — no corrupted depth, and no extra entry pushed onto
89
95
  * the history stack.
90
96
  */
91
- export function stackingIndexFor(element, siblings) {
97
+ export function stackingIndexFor(element, siblings, gesture = 'placed') {
92
98
  const box = Bound.deserialize(element.xywh);
93
99
  const overlapping = siblings.filter(sibling => Bound.deserialize(sibling.xywh).isOverlapWithBound(box));
94
100
  // The stack {@link indexOverBackgrounds} is allowed to land ON, which is the
@@ -109,7 +115,10 @@ export function stackingIndexFor(element, siblings) {
109
115
  const buried = overlapping.some(sibling => sibling.isBackground &&
110
116
  sibling.index > element.index &&
111
117
  !encloses(element, box, sibling));
112
- const lidding = element.isBackground &&
118
+ // Only where it is PLACED (ADR 0033): a board lowered by its own move would
119
+ // undo the depth a user gave it by hand, so a move never lowers one.
120
+ const lidding = gesture === 'placed' &&
121
+ element.isBackground &&
113
122
  overlapping.some(sibling => !sibling.isBackground && sibling.index < element.index);
114
123
  const next = buried
115
124
  ? indexOverBackgrounds(floors, box)
@@ -183,9 +192,11 @@ export function stackedElementsOf(gfx, exclude) {
183
192
  *
184
193
  * Two gestures produce a wrong depth, and they are the two this listens for:
185
194
  * an element CREATED (every creation site mints the top of the stack, so a
186
- * board drawn last covers what it was drawn around) and an element MOVED (onto
187
- * a board that is above it, or over free elements it then hides). Anything
188
- * else — a resize, a colour, a rename — cannot change who covers whom.
195
+ * board drawn last covers what it was drawn around) and an element MOVED onto
196
+ * a board that is above it. A board moved over free elements it then hides is
197
+ * deliberately NOT one of them (ADR 0033): a board's depth after it is placed
198
+ * is the user's. Anything else — a resize, a colour, a rename — cannot change
199
+ * who covers whom.
189
200
  *
190
201
  * Frames are BLOCKS: their own two gestures are already handled, at creation
191
202
  * by `frameIndexAt` and on a move by `_watchFrameMoved` (#223), so this never
@@ -206,14 +217,15 @@ export class BackgroundStackingExtension extends GfxExtension {
206
217
  return;
207
218
  this._disposable.add(surface.elementAdded.subscribe(({ id, local }) => {
208
219
  if (local)
209
- this._restack(surface.getElementById(id));
220
+ this._restack(surface.getElementById(id), 'placed');
210
221
  }));
211
222
  this._disposable.add(surface.elementUpdated.subscribe(({ id, props, local }) => {
212
- if (local && props['xywh'])
213
- this._restack(surface.getElementById(id));
223
+ if (local && props['xywh']) {
224
+ this._restack(surface.getElementById(id), 'moved');
225
+ }
214
226
  }));
215
227
  }
216
- _restack(model) {
228
+ _restack(model, gesture) {
217
229
  // A nested element is ordered by its ancestor's index — `compare` reads
218
230
  // that and ignores the child's own, so restacking it would change nothing.
219
231
  if (!model || model.group !== null)
@@ -222,7 +234,7 @@ export class BackgroundStackingExtension extends GfxExtension {
222
234
  index: model.index,
223
235
  xywh: model.xywh,
224
236
  isBackground: model instanceof FrameworkBackgroundElementModel,
225
- }, stackedElementsOf(this.gfx, model));
237
+ }, stackedElementsOf(this.gfx, model), gesture);
226
238
  if (index !== null)
227
239
  this.gfx.updateElement(model, { index });
228
240
  }
@@ -4,11 +4,12 @@ import { requestConnectedFrame } from '../../affine-shared/utils/index.js';
4
4
  import { DisposableGroup } from '../../global/disposable/index.js';
5
5
  import { Bound, getBoundWithRotation, intersects, } from '../../global/gfx/index.js';
6
6
  import { GfxControllerIdentifier } from '../../std/gfx/index.js';
7
- import { effect } from '@preact/signals-core';
7
+ import { effect, untracked } from '@preact/signals-core';
8
8
  import last from 'lodash-es/last.js';
9
9
  import { Subject } from 'rxjs';
10
10
  import { ElementRendererIdentifier } from '../extensions/element-renderer.js';
11
11
  import { RoughCanvas } from '../utils/rough/canvas.js';
12
+ import { isPainted } from './paint-predicate.js';
12
13
  const STACKING_CANVAS_PADDING = 32;
13
14
  export class CanvasRenderer {
14
15
  get stackingCanvas() {
@@ -188,7 +189,7 @@ export class CanvasRenderer {
188
189
  _getLayerRenderBound(elements, viewportBounds) {
189
190
  let layerBound = null;
190
191
  for (const element of elements) {
191
- const display = (element.display ?? true) && !element.hidden;
192
+ const display = isPainted(element, this._gfx.localVisibility);
192
193
  if (!display) {
193
194
  continue;
194
195
  }
@@ -310,6 +311,19 @@ export class CanvasRenderer {
310
311
  this.refresh({ type: 'all' });
311
312
  }
312
313
  }));
314
+ // A local hide or show changes what is painted without touching any
315
+ // element: repaint everything once (ADR 0031 §8). The first run only
316
+ // subscribes.
317
+ let visibilityRead = false;
318
+ this._disposables.add(effect(() => {
319
+ this._gfx.localVisibility.hiddenIds$.value;
320
+ this._gfx.localVisibility.hiddenLayerIds$.value;
321
+ if (!visibilityRead) {
322
+ visibilityRead = true;
323
+ return;
324
+ }
325
+ untracked(() => this.refresh({ type: 'all' }));
326
+ }));
313
327
  let wasDragging = false;
314
328
  this._disposables.add(effect(() => {
315
329
  const isDragging = this._gfx.tool.dragging$.value;
@@ -427,7 +441,7 @@ export class CanvasRenderer {
427
441
  filter: ['canvas', 'local'],
428
442
  });
429
443
  for (const element of elements) {
430
- const display = (element.display ?? true) && !element.hidden;
444
+ const display = isPainted(element, this._gfx.localVisibility);
431
445
  if (display && intersects(getBoundWithRotation(element), bound)) {
432
446
  renderStats && (renderStats.visibleElementCount += 1);
433
447
  if (this.usePlaceholder &&
@@ -1,6 +1,6 @@
1
1
  import { type Color, ColorScheme } from '../../affine-model/index.js';
2
2
  import type { BlockStdScope } from '../../std/index.js';
3
- import type { GridManager, LayerManager, SurfaceBlockModel, Viewport } from '../../std/gfx/index.js';
3
+ import { type GridManager, type LayerManager, type SurfaceBlockModel, type Viewport } from '../../std/gfx/index.js';
4
4
  import { Subject } from 'rxjs';
5
5
  import type { Overlay } from './overlay.js';
6
6
  type EnvProvider = {
@@ -99,6 +99,8 @@ export declare class DomRenderer {
99
99
  removed: HTMLElement[];
100
100
  }>;
101
101
  constructor(options: RendererOptions);
102
+ /** The viewer's local hide (ADR 0031 §8), read by the paint predicate. */
103
+ private readonly _localVisibility;
102
104
  private _initViewport;
103
105
  private _resetSize;
104
106
  private _renderElement;
@@ -3,8 +3,11 @@ import { FeatureFlagService } from '../../affine-shared/services/index.js';
3
3
  import { requestConnectedFrame } from '../../affine-shared/utils/index.js';
4
4
  import { DisposableGroup } from '../../global/disposable/index.js';
5
5
  import { getBoundWithRotation, intersects, } from '../../global/gfx/index.js';
6
+ import { GfxControllerIdentifier, } from '../../std/gfx/index.js';
7
+ import { effect, untracked } from '@preact/signals-core';
6
8
  import { Subject } from 'rxjs';
7
9
  import { DomElementRendererIdentifier } from './dom-elements/index.js';
10
+ import { isPainted } from './paint-predicate.js';
8
11
  const UpdateType = {
9
12
  ELEMENT_ADDED: 'element-added',
10
13
  ELEMENT_REMOVED: 'element-removed',
@@ -185,10 +188,27 @@ export class DomRenderer {
185
188
  const featureFlagService = options.std.get(FeatureFlagService);
186
189
  return featureFlagService.getFlag('enable_turbo_renderer');
187
190
  };
191
+ this._localVisibility = this.std.get(GfxControllerIdentifier).localVisibility;
188
192
  this._initViewport();
189
193
  this._watchSurface(options.surfaceModel);
190
194
  }
191
195
  _initViewport() {
196
+ // A local hide or show changes what is painted without touching any
197
+ // element: the whole viewport is dirty once. The first run only
198
+ // subscribes.
199
+ let visibilityRead = false;
200
+ this._disposables.add(effect(() => {
201
+ this._localVisibility.hiddenIds$.value;
202
+ this._localVisibility.hiddenLayerIds$.value;
203
+ if (!visibilityRead) {
204
+ visibilityRead = true;
205
+ return;
206
+ }
207
+ untracked(() => {
208
+ this._markViewportDirty();
209
+ this.refresh();
210
+ });
211
+ }));
192
212
  this._disposables.add(this.viewport.viewportUpdated.subscribe(() => {
193
213
  this._markViewportDirty();
194
214
  this.refresh();
@@ -386,7 +406,7 @@ export class DomRenderer {
386
406
  const visibleElementIds = new Set();
387
407
  // 1. Update dirty elements
388
408
  for (const elementModel of elementsFromGrid) {
389
- const display = (elementModel.display ?? true) && !elementModel.hidden;
409
+ const display = isPainted(elementModel, this._localVisibility);
390
410
  if (display &&
391
411
  intersects(getBoundWithRotation(elementModel), viewportBounds)) {
392
412
  visibleElementIds.add(elementModel.id);
@@ -449,7 +469,7 @@ export class DomRenderer {
449
469
  });
450
470
  const visibleElementIds = new Set();
451
471
  for (const elementModel of elementsFromGrid) {
452
- const display = (elementModel.display ?? true) && !elementModel.hidden;
472
+ const display = isPainted(elementModel, this._localVisibility);
453
473
  if (display &&
454
474
  intersects(getBoundWithRotation(elementModel), viewportBounds)) {
455
475
  visibleElementIds.add(elementModel.id);
@@ -1,4 +1,4 @@
1
- import { ThemeProvider } from '../../affine-shared/services/index.js';
1
+ import { getChromeAccentColor } from '../../affine-shared/services/index.js';
2
2
  import { DisposableGroup } from '../../global/disposable/index.js';
3
3
  import { effect } from '@preact/signals-core';
4
4
  import { Overlay } from './overlay.js';
@@ -8,8 +8,6 @@ const HIGHLIGHT_STROKE_WIDTH = 2;
8
8
  const HIGHLIGHT_GAP = 4;
9
9
  /** Ring corner radius, in screen pixels. */
10
10
  const HIGHLIGHT_RADIUS = 4;
11
- /** Used when no theme is provided, matches the legacy frame highlight. */
12
- const FALLBACK_HIGHLIGHT_COLOR = '#1E96EB';
13
11
  /**
14
12
  * Draws the transient emphasis ring around the elements held by
15
13
  * `gfx.highlight` (`ElementHighlightManager`).
@@ -20,10 +18,7 @@ const FALLBACK_HIGHLIGHT_COLOR = '#1E96EB';
20
18
  export class ElementHighlightOverlay extends Overlay {
21
19
  static { this.overlayName = 'element-highlight'; }
22
20
  get _strokeColor() {
23
- return (this.gfx.std
24
- .getOptional(ThemeProvider)
25
- ?.getCssVariableColor('--affine-primary-color') ??
26
- FALLBACK_HIGHLIGHT_COLOR);
21
+ return getChromeAccentColor(this.gfx.std);
27
22
  }
28
23
  constructor(gfx) {
29
24
  super(gfx);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The one question every renderer site asks before it paints an element:
3
+ * "is this painted?".
4
+ *
5
+ * Four sites asked it inline, with the same expression copied four times — the
6
+ * canvas renderer's layer bound and its bound pass, the DOM renderer's full
7
+ * and incremental passes. ADR 0031 adds two more visibilities beside the two
8
+ * this reads (a viewer's local hide, a stored "hide for everyone"), and a
9
+ * fifth copy of a three-term conjunction is how one site ends up painting
10
+ * what the others skip. So the expression lives here, once.
11
+ *
12
+ * - `display` is the text editor's session flag (`edgeless-text-editor.ts`
13
+ * sets it to `false` while it edits); `undefined` means painted.
14
+ * - `hidden` is stored, and owned by mindmap collapse alone (ADR 0031 §1).
15
+ * - `visibility` is what this viewer does not see (`gfx.localVisibility`, ADR
16
+ * 0031 §8): their own local hide, and the stored "hide for everyone" that
17
+ * `GfxController` registers into the same hook (§7). The exports paint
18
+ * through the same renderer, so both are left out of an SVG or PNG too:
19
+ * what you see is what you export.
20
+ *
21
+ * Painting only. Picking does not read this: the stored `hidden` is already
22
+ * skipped by `grid.search`, the local hide by `getElementByPoint`, and
23
+ * `display` is deliberately still clickable.
24
+ */
25
+ export declare function isPainted<T extends {
26
+ display?: boolean;
27
+ hidden?: boolean;
28
+ }>(element: T, visibility?: {
29
+ isHidden(element: NoInfer<T>): boolean;
30
+ }): boolean;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The one question every renderer site asks before it paints an element:
3
+ * "is this painted?".
4
+ *
5
+ * Four sites asked it inline, with the same expression copied four times — the
6
+ * canvas renderer's layer bound and its bound pass, the DOM renderer's full
7
+ * and incremental passes. ADR 0031 adds two more visibilities beside the two
8
+ * this reads (a viewer's local hide, a stored "hide for everyone"), and a
9
+ * fifth copy of a three-term conjunction is how one site ends up painting
10
+ * what the others skip. So the expression lives here, once.
11
+ *
12
+ * - `display` is the text editor's session flag (`edgeless-text-editor.ts`
13
+ * sets it to `false` while it edits); `undefined` means painted.
14
+ * - `hidden` is stored, and owned by mindmap collapse alone (ADR 0031 §1).
15
+ * - `visibility` is what this viewer does not see (`gfx.localVisibility`, ADR
16
+ * 0031 §8): their own local hide, and the stored "hide for everyone" that
17
+ * `GfxController` registers into the same hook (§7). The exports paint
18
+ * through the same renderer, so both are left out of an SVG or PNG too:
19
+ * what you see is what you export.
20
+ *
21
+ * Painting only. Picking does not read this: the stored `hidden` is already
22
+ * skipped by `grid.search`, the local hide by `getElementByPoint`, and
23
+ * `display` is deliberately still clickable.
24
+ */
25
+ export function isPainted(element, visibility) {
26
+ return ((element.display ?? true) &&
27
+ !element.hidden &&
28
+ !(visibility?.isHidden(element) ?? false));
29
+ }
@@ -108,6 +108,12 @@ let SurfaceBlockComponent = (() => {
108
108
  z-index: 0;
109
109
  }
110
110
 
111
+ /* ADR 0031 §11: off removes the grid here too (CanvasGrid.visible$). */
112
+ affine-edgeless-root[data-grid-hidden]
113
+ .affine-block-children-container.edgeless {
114
+ background-image: none;
115
+ }
116
+
111
117
  .affine-edgeless-block-child {
112
118
  position: absolute;
113
119
  transform-origin: center;
@@ -9,6 +9,11 @@ export const SurfaceBlockSchema = defineBlockSchema({
9
9
  flavour: 'affine:surface',
10
10
  props: (internalPrimitives) => ({
11
11
  elements: internalPrimitives.Boxed(new Y.Map()),
12
+ // ADR 0031 §2: optional, `undefined` default, so the load pass writes
13
+ // nothing and the schema version stays 5.
14
+ showGrid: undefined,
15
+ // ADR 0031 §2: user layers, absent until the first one is created.
16
+ layers: undefined,
12
17
  }),
13
18
  metadata: {
14
19
  version: 5,
@@ -58,7 +58,11 @@ export class SurfaceBlockTransformer extends BaseBlockTransformer {
58
58
  yMap.set(key, element);
59
59
  });
60
60
  const elements = this._internal.Boxed(yMap);
61
+ // Every other surface prop (ADR 0031: `layers`, `showGrid`, and any key
62
+ // a newer client wrote) crosses the snapshot unchanged; only `elements`
63
+ // needs rebuilding into a Y.Map.
61
64
  snapshotRet.props = {
65
+ ...snapshotRet.props,
62
66
  elements,
63
67
  };
64
68
  return snapshotRet;
@@ -79,6 +83,7 @@ export class SurfaceBlockTransformer extends BaseBlockTransformer {
79
83
  });
80
84
  }
81
85
  snapshot.props = {
86
+ ...snapshot.props,
82
87
  elements: value,
83
88
  };
84
89
  return snapshot;
@@ -78,6 +78,9 @@ export class DefaultTool extends BaseTool {
78
78
  static { this.toolName = 'default'; }
79
79
  _scrollViewport(delta) {
80
80
  this.gfx.viewport.applyDeltaCenter(delta[0], delta[1]);
81
+ // `viewportMoved` is what an element move listens to in order to keep the
82
+ // dragged elements under a pointer that stays still while the board pans.
83
+ this.gfx.viewport.viewportMoved.next(delta);
81
84
  }
82
85
  /**
83
86
  * Get the end position of the dragging area in the model coordinate
@@ -144,7 +147,7 @@ export class DefaultTool extends BaseTool {
144
147
  }
145
148
  }
146
149
  }
147
- initializeDragState(dragType, event) {
150
+ initializeDragState(dragType, event, cloned = false) {
148
151
  this.dragType = dragType;
149
152
  this._clearDisposable();
150
153
  this._disposables = new DisposableGroup();
@@ -161,11 +164,16 @@ export class DefaultTool extends BaseTool {
161
164
  }
162
165
  if (this.dragType === DefaultModeDragType.ContentMoving) {
163
166
  if (this.interactivity) {
164
- this.doc.captureSync();
167
+ // An alt+drag captured BEFORE its clone: a capture here would close
168
+ // the step between the copy and its move, and the first undo would
169
+ // only put the copy back on its source (`alt-drag-clone.spec.ts`).
170
+ if (!cloned)
171
+ this.doc.captureSync();
165
172
  this.interactivity.handleElementMove({
166
173
  movingElements: this._toBeMoved,
167
174
  event: event.raw,
168
175
  onDragEnd: () => {
176
+ this._stopEdgeScrolling();
169
177
  this.doc.captureSync();
170
178
  },
171
179
  });
@@ -230,6 +238,17 @@ export class DefaultTool extends BaseTool {
230
238
  break;
231
239
  }
232
240
  case DefaultModeDragType.ContentMoving: {
241
+ // Only an accepted move pans: `handleElementMove` refuses a readonly
242
+ // store and an extension may cancel it, and neither leaves an active
243
+ // interaction behind.
244
+ const moving = this.interactivity?.activeInteraction$.peek()?.type === 'move';
245
+ const moveDelta = moving ? calPanDelta(viewport, e) : null;
246
+ if (moveDelta) {
247
+ this._enableEdgeScrolling(moveDelta);
248
+ }
249
+ else {
250
+ this._stopEdgeScrolling();
251
+ }
233
252
  break;
234
253
  }
235
254
  case DefaultModeDragType.NativeEditing: {
@@ -266,12 +285,16 @@ export class DefaultTool extends BaseTool {
266
285
  }
267
286
  });
268
287
  this._toBeMoved = Array.from(toBeMoved);
269
- // If alt key is pressed and content is moving, clone the content
270
- if (dragType === DefaultModeDragType.ContentMoving && e.keys.alt) {
288
+ // If alt key is pressed and content is moving, clone the content. One
289
+ // gesture, one undo step: close what came before, then nothing closes the
290
+ // step between the clone's writes and the move's end.
291
+ const cloning = dragType === DefaultModeDragType.ContentMoving && e.keys.alt;
292
+ if (cloning) {
293
+ this.doc.captureSync();
271
294
  await this._cloneContent();
272
295
  }
273
296
  // Set up drag state
274
- this.initializeDragState(dragType, e);
297
+ this.initializeDragState(dragType, e, cloning);
275
298
  }
276
299
  mounted() {
277
300
  this.disposable.add(effect(() => {
@@ -1,8 +1,9 @@
1
1
  import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
2
+ import { CanvasGrid, CanvasLocalVisibility, } from '../affine-shared/services/index.js';
2
3
  import { BlockViewExtension, CommandExtension, FlavourExtension, } from '../std/index.js';
3
4
  import { literal } from 'lit/static-html.js';
4
5
  import { effects } from './effects.js';
5
- import { auditCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, exportSvgCommands, exportSvgToolbarExtension, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, SpotlightManager, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
6
+ import { auditCommands, CanvasActiveLayer, canvasGridCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, exportSvgCommands, exportSvgToolbarExtension, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, selectionPaneCommands, SelectionPaneModel, SpotlightManager, UserLayerMiddlewareBuilder, userLayerCommands, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
6
7
  import { ExportManagerExtension } from './extensions/export-manager/export-manager.js';
7
8
  import { BackgroundStackingExtension } from './framework-background/stacking.js';
8
9
  import { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
@@ -72,6 +73,27 @@ export class SurfaceViewExtension extends ViewExtensionProvider {
72
73
  // (`docs/adr/0025`). Nothing is offered until a board is selected.
73
74
  context.register(CommandExtension(exportSvgCommands));
74
75
  context.register(exportSvgToolbarExtension);
76
+ // The selection pane's headless half (ADR 0031): the live tree a pane
77
+ // renders from, and the commands its rows run. Core chrome, never a
78
+ // framework's, and nothing it lists is gated — a flag gates tooling,
79
+ // the rows are content. The panel itself is the edgeless toolbar's.
80
+ context.register(SelectionPaneModel);
81
+ // This viewer's local hide (ADR 0031 §8): registers into
82
+ // `gfx.localVisibility` and persists per document, never in it.
83
+ context.register(CanvasLocalVisibility);
84
+ context.register(CommandExtension(selectionPaneCommands));
85
+ // The grid as a setting (ADR 0031 §11): this viewer's override, the
86
+ // document's `showGrid`, the host default, the library default. Read by
87
+ // the edgeless root's background, the surface container and the PNG
88
+ // export; previews follow the document setting alone.
89
+ context.register(CanvasGrid);
90
+ context.register(CommandExtension(canvasGridCommands));
91
+ // User layers (ADR 0031 §2-§6): the viewer's active layer (session
92
+ // only), the `beforeAdd` middleware that stamps it on what is created,
93
+ // and the commands the pane's layer rows run. Content, never gated.
94
+ context.register(CanvasActiveLayer);
95
+ context.register(UserLayerMiddlewareBuilder);
96
+ context.register(CommandExtension(userLayerCommands));
75
97
  }
76
98
  else {
77
99
  context.register(BlockViewExtension('affine:surface', literal `affine-surface-void`));
@@ -6,8 +6,8 @@ export const EdgelessTooltip = html `<svg width="170" height="106" viewBox="0 0
6
6
  <rect width="170" height="106" rx="2" fill="white"/>
7
7
  </mask>
8
8
  <g mask="url(#mask0_16460_1252)">
9
- <rect x="100.5" y="42.6565" width="141" height="51" stroke="#1E96EB" stroke-width="3" stroke-dasharray="5 5"/>
10
- <circle cx="101.5" cy="43.5" r="6" fill="white" stroke="#1E96EB" stroke-width="3"/>
9
+ <rect x="100.5" y="42.6565" width="141" height="51" stroke="var(--affine-primary-color)" stroke-width="3" stroke-dasharray="5 5"/>
10
+ <circle cx="101.5" cy="43.5" r="6" fill="white" stroke="var(--affine-primary-color)" stroke-width="3"/>
11
11
  <rect x="105" y="8" width="59" height="26" rx="10" fill="black" fill-opacity="0.1"/>
12
12
  <text fill="#121212" xml:space="preserve" style="white-space: pre" font-family="Inter" font-size="12" letter-spacing="0em"><tspan x="117" y="25.3636">Group</tspan></text>
13
13
  <mask id="mask1_16460_1252" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="98" height="106">
@@ -39,7 +39,7 @@ import { Peekable } from '../affine-components/peek/index.js';
39
39
  import { ViewExtensionManagerIdentifier } from '../affine-ext-loader/index.js';
40
40
  import { RefNodeSlotsProvider } from '../affine-inline-reference/index.js';
41
41
  import { FrameBlockModel, } from '../affine-model/index.js';
42
- import { BlockCommentManager, DocModeProvider, EditPropsStore, ThemeProvider, ToolbarRegistryIdentifier, ViewportElementExtension, } from '../affine-shared/services/index.js';
42
+ import { BlockCommentManager, DocModeProvider, documentShowsGrid, EditPropsStore, ThemeProvider, ToolbarRegistryIdentifier, ViewportElementExtension, } from '../affine-shared/services/index.js';
43
43
  import { unsafeCSSVarV2 } from '../affine-shared/theme/index.js';
44
44
  import { requestConnectedFrame } from '../affine-shared/utils/index.js';
45
45
  import { DisposableGroup } from '../global/disposable/index.js';
@@ -128,6 +128,11 @@ let SurfaceRefBlockComponent = (() => {
128
128
  );
129
129
  }
130
130
 
131
+ /* ADR 0031 §11: a reference follows the document's showGrid alone. */
132
+ .ref-content.grid-hidden {
133
+ background: var(--affine-background-primary-color);
134
+ }
135
+
131
136
  .ref-viewport {
132
137
  max-width: 100%;
133
138
  margin: 0 auto;
@@ -351,7 +356,12 @@ let SurfaceRefBlockComponent = (() => {
351
356
  const aspectRatio = h !== 0 ? w / h : 1;
352
357
  const _previewSpec = this._previewSpec.concat(this._runtimePreviewExt);
353
358
  const edgelessTheme = this.std.get(ThemeProvider).edgeless$.value;
354
- return html `<div class="ref-content">
359
+ // A reference is a picture of the referenced document: its saved grid,
360
+ // never this viewer's override.
361
+ const showGrid = documentShowsGrid(this._previewDoc ? getSurfaceBlock(this._previewDoc) : null);
362
+ return html `<div
363
+ class=${classMap({ 'ref-content': true, 'grid-hidden': !showGrid })}
364
+ >
355
365
  <div
356
366
  class="ref-viewport"
357
367
  style=${styleMap({
@@ -125,6 +125,11 @@ export const paletteCarouselStyles = css `
125
125
  /* Nine pages fit without scrolling; the cap is a seatbelt for a tenth. */
126
126
  max-height: 280px;
127
127
  overflow-y: auto;
128
+ /* Same trap as the popup box that holds this list (issue #392, see
129
+ * toolbar/menu-button.ts): an overflow-y of its own makes the other axis
130
+ * scrollable too, and this list is one long page name — a translation, or
131
+ * a tenth page — away from overflowing it. */
132
+ overflow-x: hidden;
128
133
  overscroll-behavior: contain;
129
134
  animation: palette-carousel-settle ${springDuration} ${springEasing};
130
135
  }
@@ -109,7 +109,7 @@ export const COLOR_PICKER_STYLE = css `
109
109
  }
110
110
  .modes .mode button[active] {
111
111
  pointer-events: none;
112
- outline: 2px solid var(--affine-brand-color, #1e96eb);
112
+ outline: 2px solid var(--affine-brand-color);
113
113
  }
114
114
 
115
115
  .content {
@@ -90,6 +90,20 @@ let MenuButton = (() => {
90
90
  .affine-menu-button.delete-item:hover .affine-menu-action-text {
91
91
  color: var(--affine-error-color);
92
92
  }
93
+
94
+ /*
95
+ An entry whose effect reaches every viewer of the document ("Hide for
96
+ everyone", ADR 0031): the theme's warning tokens, always on, so it reads
97
+ differently from its local twin before it is hovered.
98
+ */
99
+ .affine-menu-button.warning-item,
100
+ .affine-menu-button.warning-item .affine-menu-action-text {
101
+ color: var(--affine-warning-color);
102
+ }
103
+
104
+ .affine-menu-button.warning-item:hover {
105
+ background-color: var(--affine-background-warning-color);
106
+ }
93
107
  `; }
94
108
  connectedCallback() {
95
109
  super.connectedCallback();
@@ -264,7 +278,9 @@ export const menuButtonItems = {
264
278
  const data = {
265
279
  content: () => html `
266
280
  ${config.checked.value
267
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
281
+ ? CheckBoxCheckSolidIcon({
282
+ style: `color:var(--affine-primary-color)`,
283
+ })
268
284
  : CheckBoxUnIcon()}
269
285
  <div class="affine-menu-action-text">
270
286
  ${config.label?.() ?? config.name}