@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
@@ -1,5 +1,6 @@
1
1
  import { BulletedListIcon, CheckBoxIcon, CodeBlockIcon, DividerIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, NumberedListIcon, QuoteIcon, TextIcon, } from '../affine-components/icons/index.js';
2
2
  import { BLOCK_TYPE_BULLETED_LIST, BLOCK_TYPE_BULLETED_LIST_DESCRIPTION, BLOCK_TYPE_CODE_BLOCK, BLOCK_TYPE_CODE_BLOCK_DESCRIPTION, BLOCK_TYPE_DIVIDER, BLOCK_TYPE_DIVIDER_DESCRIPTION, BLOCK_TYPE_HEADING_1, BLOCK_TYPE_HEADING_1_DESCRIPTION, BLOCK_TYPE_HEADING_2, BLOCK_TYPE_HEADING_2_DESCRIPTION, BLOCK_TYPE_HEADING_3, BLOCK_TYPE_HEADING_3_DESCRIPTION, BLOCK_TYPE_HEADING_4, BLOCK_TYPE_HEADING_4_DESCRIPTION, BLOCK_TYPE_HEADING_5, BLOCK_TYPE_HEADING_5_DESCRIPTION, BLOCK_TYPE_HEADING_6, BLOCK_TYPE_HEADING_6_DESCRIPTION, BLOCK_TYPE_NUMBERED_LIST, BLOCK_TYPE_NUMBERED_LIST_DESCRIPTION, BLOCK_TYPE_QUOTE, BLOCK_TYPE_QUOTE_DESCRIPTION, BLOCK_TYPE_TEXT, BLOCK_TYPE_TEXT_DESCRIPTION, BLOCK_TYPE_TODO_LIST, BLOCK_TYPE_TODO_LIST_DESCRIPTION, } from '../affine-shared/services/index.js';
3
+ import { createIdentifier } from '../global/di/index.js';
3
4
  export const textConversionConfigs = [
4
5
  {
5
6
  flavour: 'affine:paragraph',
@@ -132,3 +133,11 @@ export const textConversionConfigs = [
132
133
  descriptionWording: BLOCK_TYPE_DIVIDER_DESCRIPTION,
133
134
  },
134
135
  ];
136
+ export const TextConversionEntryIdentifier = createIdentifier('AffineTextConversionEntry');
137
+ export function TextConversionEntryExtension(entry) {
138
+ return {
139
+ setup: di => {
140
+ di.addImpl(TextConversionEntryIdentifier(entry.flavour), entry);
141
+ },
142
+ };
143
+ }
@@ -1,4 +1,4 @@
1
- export { type TextConversionConfig, textConversionConfigs } from './conversion.js';
1
+ export { type TextConversionConfig, textConversionConfigs, type TextConversionEntry, TextConversionEntryExtension, TextConversionEntryIdentifier, } from './conversion.js';
2
2
  export { asyncGetRichText, asyncSetInlineRange, cleanSpecifiedTail, focusTextModel, getInlineEditorByModel, getRichTextByModel, getTextContentFromInlineRange, onModelTextUpdated, selectTextModel, } from './dom.js';
3
3
  export { RichText } from './rich-text.js';
4
4
  export * from './utils.js';
@@ -1,4 +1,4 @@
1
- export { textConversionConfigs } from './conversion.js';
1
+ export { textConversionConfigs, TextConversionEntryExtension, TextConversionEntryIdentifier, } from './conversion.js';
2
2
  export { asyncGetRichText, asyncSetInlineRange, cleanSpecifiedTail, focusTextModel, getInlineEditorByModel, getRichTextByModel, getTextContentFromInlineRange, onModelTextUpdated, selectTextModel, } from './dom.js';
3
3
  export { RichText } from './rich-text.js';
4
4
  export * from './utils.js';
@@ -1,5 +1,5 @@
1
- import type { BlockModel } from '../../../../store/index.js';
2
1
  import type { Command, TextSelection } from '../../../std/index.js';
2
+ import type { BlockModel } from '../../../store/index.js';
3
3
  /**
4
4
  * Replace the selected text with the given blocks
5
5
  *
@@ -0,0 +1,63 @@
1
+ import { LifeCycleWatcher } from '../../std/index.js';
2
+ import { type SurfaceBlockModel } from '../../std/gfx/index.js';
3
+ import { type ReadonlySignal } from '@preact/signals-core';
4
+ /** Who decided the grid this viewer sees (ADR 0031 §11). */
5
+ export type CanvasGridSource = 'local' | 'document' | 'host' | 'library';
6
+ /**
7
+ * The four levels of ADR 0031 §11, nearest decision first: the viewer's own
8
+ * override, the document's "saved for everyone" setting, the host's default
9
+ * (`edgelessShowGrid`), and the library default — on. `undefined` at a level
10
+ * means "nobody decided here".
11
+ */
12
+ export declare function resolveCanvasGrid(levels: {
13
+ local?: boolean;
14
+ document?: boolean;
15
+ host?: boolean;
16
+ }): {
17
+ visible: boolean;
18
+ source: CanvasGridSource;
19
+ };
20
+ /**
21
+ * What a surface stored for everyone, read reactively. Previews (the
22
+ * read-only edgeless preview, a surface-ref) follow THIS and the library
23
+ * default only: they are a picture of the document, not a viewer's session,
24
+ * so neither a viewer override nor a host default reaches them.
25
+ */
26
+ export declare function documentShowsGrid(surface: SurfaceBlockModel | null | undefined): boolean;
27
+ /**
28
+ * The canvas grid as THIS viewer sees it (ADR 0031 §11).
29
+ *
30
+ * - **The toggle is local**: it writes the viewer's override, an
31
+ * `EditPropsStore` `localStorage` prop keyed by document id like the
32
+ * viewport, so it survives a reload and produces no Yjs update — a reader
33
+ * may toggle it too.
34
+ * - **"Save for everyone"** writes the current state into the surface's
35
+ * `showGrid` and clears the saver's override, so they see what everyone
36
+ * sees. Refused on a read-only store; writes nothing when the document
37
+ * already says the same.
38
+ *
39
+ * Both containers that paint the grid (the edgeless root's background and
40
+ * the surface container) and the PNG export read `visible$`.
41
+ */
42
+ export declare class CanvasGrid extends LifeCycleWatcher {
43
+ static key: string;
44
+ private readonly _local$;
45
+ private readonly _resolved$;
46
+ /** Whether this viewer sees the grid. */
47
+ readonly visible$: ReadonlySignal<boolean>;
48
+ /** Which level decided `visible$`. */
49
+ readonly source$: ReadonlySignal<CanvasGridSource>;
50
+ private _surface;
51
+ /**
52
+ * Flip the grid for this viewer only. Answers the new visibility.
53
+ */
54
+ toggle(): boolean;
55
+ /**
56
+ * Store what this viewer sees as the document's setting, and drop their
57
+ * override. Answers the saved value, or `null` when nothing was written
58
+ * (read-only store, no surface, or the document already said so).
59
+ */
60
+ saveForEveryone(): boolean | null;
61
+ private _clearLocal;
62
+ mounted(): void;
63
+ }
@@ -0,0 +1,109 @@
1
+ import { LifeCycleWatcher } from '../../std/index.js';
2
+ import { GfxControllerIdentifier, } from '../../std/gfx/index.js';
3
+ import { computed, signal } from '@preact/signals-core';
4
+ import { EditPropsStore } from './edit-props-store.js';
5
+ import { EditorSettingProvider } from './editor-setting-service.js';
6
+ /**
7
+ * The four levels of ADR 0031 §11, nearest decision first: the viewer's own
8
+ * override, the document's "saved for everyone" setting, the host's default
9
+ * (`edgelessShowGrid`), and the library default — on. `undefined` at a level
10
+ * means "nobody decided here".
11
+ */
12
+ export function resolveCanvasGrid(levels) {
13
+ if (levels.local !== undefined) {
14
+ return { visible: levels.local, source: 'local' };
15
+ }
16
+ if (levels.document !== undefined) {
17
+ return { visible: levels.document, source: 'document' };
18
+ }
19
+ if (levels.host !== undefined) {
20
+ return { visible: levels.host, source: 'host' };
21
+ }
22
+ return { visible: true, source: 'library' };
23
+ }
24
+ /**
25
+ * What a surface stored for everyone, read reactively. Previews (the
26
+ * read-only edgeless preview, a surface-ref) follow THIS and the library
27
+ * default only: they are a picture of the document, not a viewer's session,
28
+ * so neither a viewer override nor a host default reaches them.
29
+ */
30
+ export function documentShowsGrid(surface) {
31
+ return surface?.props.showGrid$.value !== false;
32
+ }
33
+ /**
34
+ * The canvas grid as THIS viewer sees it (ADR 0031 §11).
35
+ *
36
+ * - **The toggle is local**: it writes the viewer's override, an
37
+ * `EditPropsStore` `localStorage` prop keyed by document id like the
38
+ * viewport, so it survives a reload and produces no Yjs update — a reader
39
+ * may toggle it too.
40
+ * - **"Save for everyone"** writes the current state into the surface's
41
+ * `showGrid` and clears the saver's override, so they see what everyone
42
+ * sees. Refused on a read-only store; writes nothing when the document
43
+ * already says the same.
44
+ *
45
+ * Both containers that paint the grid (the edgeless root's background and
46
+ * the surface container) and the PNG export read `visible$`.
47
+ */
48
+ export class CanvasGrid extends LifeCycleWatcher {
49
+ constructor() {
50
+ super(...arguments);
51
+ this._local$ = signal(undefined);
52
+ this._resolved$ = computed(() => resolveCanvasGrid({
53
+ local: this._local$.value,
54
+ document: this._surface()?.props.showGrid$.value,
55
+ host: this.std.getOptional(EditorSettingProvider)?.setting$.value
56
+ .edgelessShowGrid,
57
+ }));
58
+ /** Whether this viewer sees the grid. */
59
+ this.visible$ = computed(() => this._resolved$.value.visible);
60
+ /** Which level decided `visible$`. */
61
+ this.source$ = computed(() => this._resolved$.value.source);
62
+ }
63
+ static { this.key = 'canvas-grid'; }
64
+ _surface() {
65
+ return this.std.get(GfxControllerIdentifier).surface$.value;
66
+ }
67
+ /**
68
+ * Flip the grid for this viewer only. Answers the new visibility.
69
+ */
70
+ toggle() {
71
+ const visible = !this.visible$.peek();
72
+ this._local$.value = visible;
73
+ this.std.getOptional(EditPropsStore)?.setStorage('localShowGrid', visible);
74
+ return visible;
75
+ }
76
+ /**
77
+ * Store what this viewer sees as the document's setting, and drop their
78
+ * override. Answers the saved value, or `null` when nothing was written
79
+ * (read-only store, no surface, or the document already said so).
80
+ */
81
+ saveForEveryone() {
82
+ const surface = this._surface();
83
+ if (!surface || this.std.store.readonly)
84
+ return null;
85
+ const visible = this.visible$.peek();
86
+ this._clearLocal();
87
+ if (surface.props.showGrid === visible)
88
+ return null;
89
+ this.std.store.captureSync();
90
+ this.std.store.transact(() => {
91
+ surface.props.showGrid = visible;
92
+ });
93
+ this.std.store.captureSync();
94
+ return visible;
95
+ }
96
+ _clearLocal() {
97
+ if (this._local$.peek() === undefined)
98
+ return;
99
+ this._local$.value = undefined;
100
+ this.std.getOptional(EditPropsStore)?.removeStorage('localShowGrid');
101
+ }
102
+ mounted() {
103
+ super.mounted();
104
+ const stored = this.std
105
+ .getOptional(EditPropsStore)
106
+ ?.getStorage('localShowGrid');
107
+ this._local$.value = stored ?? undefined;
108
+ }
109
+ }
@@ -0,0 +1,64 @@
1
+ import { LifeCycleWatcher } from '../../std/index.js';
2
+ import { type ReadonlySignal } from '@preact/signals-core';
3
+ /**
4
+ * Hide is LOCAL by default (ADR 0031 §1, §8): what this viewer hid on this
5
+ * document's canvas, and nothing anybody else can see.
6
+ *
7
+ * - **Never written to the document.** The ids live in a signal and persist
8
+ * through `EditPropsStore`'s `localHiddenElements`, a `localStorage` prop
9
+ * keyed by document id exactly like the viewport — so a reload keeps them
10
+ * (open point 7, resolved at acceptance) and no Yjs update is ever produced.
11
+ * - **Pruned on load**: ids the document no longer has are dropped the first
12
+ * time the surface is there to ask, so the list does not grow forever.
13
+ * - **Not `display`**: the canvas text editor owns that flag and closing it on
14
+ * a locally hidden text would unhide it.
15
+ *
16
+ * The signal is registered into `gfx.localVisibility`, the per-editor hook the
17
+ * renderers, the DOM block views, pointer picking and the marquee read. It is
18
+ * never read by `grid.search`: rules, legends and semantic exports count a
19
+ * hidden element, because hiding is not deleting.
20
+ *
21
+ * Not gated by `store.readonly`: hiding is a way of LOOKING at a document, so
22
+ * a reader may do it — nothing they do here reaches the document.
23
+ *
24
+ * Whole user layers hide the same way (stage 7): a second set of ids, kept
25
+ * and persisted beside the first (`localHiddenLayers`), registered with
26
+ * `gfx.localVisibility.registerLayers` — every model whose effective layer
27
+ * is in it is hidden for this viewer.
28
+ */
29
+ export declare class CanvasLocalVisibility extends LifeCycleWatcher {
30
+ static key: string;
31
+ private readonly _hiddenIds$;
32
+ private readonly _hiddenLayerIds$;
33
+ private _disposers;
34
+ /** The ids this viewer hid. */
35
+ get hiddenIds$(): ReadonlySignal<ReadonlySet<string>>;
36
+ /** The user layers this viewer hid. */
37
+ get hiddenLayerIds$(): ReadonlySignal<ReadonlySet<string>>;
38
+ isHidden(id: string): boolean;
39
+ /** Hide whole user layers for this viewer. Answers how many changed. */
40
+ hideLayers(ids: Iterable<string>): number;
41
+ /** Show user layers again. Answers how many were hidden. */
42
+ showLayers(ids: Iterable<string>): number;
43
+ /** Hide `ids`. Answers how many were not hidden yet. */
44
+ hide(ids: Iterable<string>): number;
45
+ /** Show `ids` again. Answers how many were hidden. */
46
+ show(ids: Iterable<string>): number;
47
+ /**
48
+ * Show every element this viewer hid. Answers how many were hidden.
49
+ * Hidden layers are {@link showAllLayers}'s, so each count reports one
50
+ * target.
51
+ */
52
+ showAll(): number;
53
+ /** Show every layer this viewer hid. Answers how many were hidden. */
54
+ showAllLayers(): number;
55
+ private _commitLayers;
56
+ private _commit;
57
+ mounted(): void;
58
+ /**
59
+ * Restore the hidden layers, pruned of layers the surface no longer has —
60
+ * the first time the surface is there to ask.
61
+ */
62
+ private _restoreLayers;
63
+ unmounted(): void;
64
+ }
@@ -0,0 +1,192 @@
1
+ import { LifeCycleWatcher } from '../../std/index.js';
2
+ import { DEFAULT_LAYER_ID, GfxControllerIdentifier } from '../../std/gfx/index.js';
3
+ import { effect, signal } from '@preact/signals-core';
4
+ import { EditPropsStore } from './edit-props-store.js';
5
+ /**
6
+ * Hide is LOCAL by default (ADR 0031 §1, §8): what this viewer hid on this
7
+ * document's canvas, and nothing anybody else can see.
8
+ *
9
+ * - **Never written to the document.** The ids live in a signal and persist
10
+ * through `EditPropsStore`'s `localHiddenElements`, a `localStorage` prop
11
+ * keyed by document id exactly like the viewport — so a reload keeps them
12
+ * (open point 7, resolved at acceptance) and no Yjs update is ever produced.
13
+ * - **Pruned on load**: ids the document no longer has are dropped the first
14
+ * time the surface is there to ask, so the list does not grow forever.
15
+ * - **Not `display`**: the canvas text editor owns that flag and closing it on
16
+ * a locally hidden text would unhide it.
17
+ *
18
+ * The signal is registered into `gfx.localVisibility`, the per-editor hook the
19
+ * renderers, the DOM block views, pointer picking and the marquee read. It is
20
+ * never read by `grid.search`: rules, legends and semantic exports count a
21
+ * hidden element, because hiding is not deleting.
22
+ *
23
+ * Not gated by `store.readonly`: hiding is a way of LOOKING at a document, so
24
+ * a reader may do it — nothing they do here reaches the document.
25
+ *
26
+ * Whole user layers hide the same way (stage 7): a second set of ids, kept
27
+ * and persisted beside the first (`localHiddenLayers`), registered with
28
+ * `gfx.localVisibility.registerLayers` — every model whose effective layer
29
+ * is in it is hidden for this viewer.
30
+ */
31
+ export class CanvasLocalVisibility extends LifeCycleWatcher {
32
+ constructor() {
33
+ super(...arguments);
34
+ this._hiddenIds$ = signal(new Set());
35
+ this._hiddenLayerIds$ = signal(new Set());
36
+ this._disposers = [];
37
+ }
38
+ static { this.key = 'canvas-local-visibility'; }
39
+ /** The ids this viewer hid. */
40
+ get hiddenIds$() {
41
+ return this._hiddenIds$;
42
+ }
43
+ /** The user layers this viewer hid. */
44
+ get hiddenLayerIds$() {
45
+ return this._hiddenLayerIds$;
46
+ }
47
+ isHidden(id) {
48
+ return this._hiddenIds$.value.has(id);
49
+ }
50
+ /** Hide whole user layers for this viewer. Answers how many changed. */
51
+ hideLayers(ids) {
52
+ const next = new Set(this._hiddenLayerIds$.peek());
53
+ let changed = 0;
54
+ for (const id of ids) {
55
+ if (next.has(id))
56
+ continue;
57
+ next.add(id);
58
+ changed++;
59
+ }
60
+ if (changed)
61
+ this._commitLayers(next);
62
+ return changed;
63
+ }
64
+ /** Show user layers again. Answers how many were hidden. */
65
+ showLayers(ids) {
66
+ const next = new Set(this._hiddenLayerIds$.peek());
67
+ let changed = 0;
68
+ for (const id of ids) {
69
+ if (next.delete(id))
70
+ changed++;
71
+ }
72
+ if (changed)
73
+ this._commitLayers(next);
74
+ return changed;
75
+ }
76
+ /** Hide `ids`. Answers how many were not hidden yet. */
77
+ hide(ids) {
78
+ const next = new Set(this._hiddenIds$.peek());
79
+ let changed = 0;
80
+ for (const id of ids) {
81
+ if (next.has(id))
82
+ continue;
83
+ next.add(id);
84
+ changed++;
85
+ }
86
+ if (changed)
87
+ this._commit(next);
88
+ return changed;
89
+ }
90
+ /** Show `ids` again. Answers how many were hidden. */
91
+ show(ids) {
92
+ const next = new Set(this._hiddenIds$.peek());
93
+ let changed = 0;
94
+ for (const id of ids) {
95
+ if (next.delete(id))
96
+ changed++;
97
+ }
98
+ if (changed)
99
+ this._commit(next);
100
+ return changed;
101
+ }
102
+ /**
103
+ * Show every element this viewer hid. Answers how many were hidden.
104
+ * Hidden layers are {@link showAllLayers}'s, so each count reports one
105
+ * target.
106
+ */
107
+ showAll() {
108
+ const count = this._hiddenIds$.peek().size;
109
+ if (count)
110
+ this._commit(new Set());
111
+ return count;
112
+ }
113
+ /** Show every layer this viewer hid. Answers how many were hidden. */
114
+ showAllLayers() {
115
+ const count = this._hiddenLayerIds$.peek().size;
116
+ if (count)
117
+ this._commitLayers(new Set());
118
+ return count;
119
+ }
120
+ _commitLayers(next) {
121
+ this._hiddenLayerIds$.value = next;
122
+ this.std
123
+ .getOptional(EditPropsStore)
124
+ ?.setStorage('localHiddenLayers', [...next]);
125
+ }
126
+ _commit(next) {
127
+ this._hiddenIds$.value = next;
128
+ this.std
129
+ .getOptional(EditPropsStore)
130
+ ?.setStorage('localHiddenElements', [...next]);
131
+ }
132
+ mounted() {
133
+ super.mounted();
134
+ const gfx = this.std.get(GfxControllerIdentifier);
135
+ this._disposers.push(gfx.localVisibility.register(this._hiddenIds$));
136
+ this._disposers.push(gfx.localVisibility.registerLayers(this._hiddenLayerIds$));
137
+ this._restoreLayers();
138
+ const stored = this.std.getOptional(EditPropsStore)?.getStorage('localHiddenElements') ??
139
+ [];
140
+ if (!stored.length)
141
+ return;
142
+ // The surface may arrive after mount; prune the first time it is there.
143
+ let pruned = false;
144
+ const stop = effect(() => {
145
+ if (pruned || !gfx.surface$.value)
146
+ return;
147
+ pruned = true;
148
+ const kept = stored.filter(id => gfx.getElementById(id) !== null);
149
+ if (kept.length === stored.length) {
150
+ this._hiddenIds$.value = new Set(kept);
151
+ }
152
+ else {
153
+ this._commit(new Set(kept));
154
+ }
155
+ });
156
+ this._disposers.push(stop);
157
+ }
158
+ /**
159
+ * Restore the hidden layers, pruned of layers the surface no longer has —
160
+ * the first time the surface is there to ask.
161
+ */
162
+ _restoreLayers() {
163
+ const gfx = this.std.get(GfxControllerIdentifier);
164
+ const stored = this.std.getOptional(EditPropsStore)?.getStorage('localHiddenLayers') ??
165
+ [];
166
+ if (!stored.length)
167
+ return;
168
+ let pruned = false;
169
+ const stop = effect(() => {
170
+ const surface = gfx.surface$.value;
171
+ if (pruned || !surface)
172
+ return;
173
+ pruned = true;
174
+ const layers = surface.props.layers ?? {};
175
+ // The default layer exists with or without its record (ADR 0031
176
+ // amendments): a hide of it is never a layer the document lost.
177
+ const kept = stored.filter(id => id === DEFAULT_LAYER_ID || id in layers);
178
+ if (kept.length === stored.length) {
179
+ this._hiddenLayerIds$.value = new Set(kept);
180
+ }
181
+ else {
182
+ this._commitLayers(new Set(kept));
183
+ }
184
+ });
185
+ this._disposers.push(stop);
186
+ }
187
+ unmounted() {
188
+ this._disposers.forEach(dispose => dispose());
189
+ this._disposers = [];
190
+ super.unmounted();
191
+ }
192
+ }
@@ -47,6 +47,25 @@ declare const LocalPropsSchema: z.ZodObject<{
47
47
  presentNoFrameToastShown: z.ZodBoolean;
48
48
  autoHideEmbedHTMLFullScreenToolbar: z.ZodBoolean;
49
49
  connectorCenterAnchor: z.ZodDefault<z.ZodBoolean>;
50
+ /**
51
+ * The ids this viewer hid on this document's canvas (ADR 0031 §8). Per
52
+ * viewer and per document, like the viewport; never written to the
53
+ * document. Owned by `CanvasLocalVisibility`.
54
+ */
55
+ localHiddenElements: z.ZodArray<z.ZodString, "many">;
56
+ /**
57
+ * The user layers this viewer hid on this document's canvas (ADR 0031 §8,
58
+ * stage 7). Same owner, same key scheme, same lifetime as
59
+ * `localHiddenElements`; a separate key so the element list keeps the shape
60
+ * it already has in viewers' storage.
61
+ */
62
+ localHiddenLayers: z.ZodArray<z.ZodString, "many">;
63
+ /**
64
+ * This viewer's grid override on this document's canvas (ADR 0031 §11),
65
+ * keyed like the viewport. Absent = the document, the host or the library
66
+ * decides. Owned by `CanvasGrid`.
67
+ */
68
+ localShowGrid: z.ZodBoolean;
50
69
  }, "strip", z.ZodTypeAny, {
51
70
  viewport: {
52
71
  centerX: number;
@@ -62,6 +81,9 @@ declare const LocalPropsSchema: z.ZodObject<{
62
81
  presentNoFrameToastShown: boolean;
63
82
  autoHideEmbedHTMLFullScreenToolbar: boolean;
64
83
  connectorCenterAnchor: boolean;
84
+ localHiddenElements: string[];
85
+ localHiddenLayers: string[];
86
+ localShowGrid: boolean;
65
87
  }, {
66
88
  viewport: {
67
89
  centerX: number;
@@ -76,6 +98,9 @@ declare const LocalPropsSchema: z.ZodObject<{
76
98
  presentHideToolbar: boolean;
77
99
  presentNoFrameToastShown: boolean;
78
100
  autoHideEmbedHTMLFullScreenToolbar: boolean;
101
+ localHiddenElements: string[];
102
+ localHiddenLayers: string[];
103
+ localShowGrid: boolean;
79
104
  connectorCenterAnchor?: boolean | undefined;
80
105
  }>;
81
106
  type SessionProps = z.infer<typeof SessionPropsSchema>;
@@ -416,6 +441,8 @@ export declare class EditPropsStore extends LifeCycleWatcher {
416
441
  * session that turns read-only before unmounting stops writing too.
417
442
  */
418
443
  saveViewport(viewport: StorageProps['viewport']): void;
444
+ /** Forget a stored prop, so the next `getStorage` answers `null`. */
445
+ removeStorage(key: StoragePropsKey): void;
419
446
  setStorage<T extends StoragePropsKey>(key: T, value: StorageProps[T]): void;
420
447
  unmounted(): void;
421
448
  }
@@ -37,6 +37,25 @@ const LocalPropsSchema = z.object({
37
37
  presentNoFrameToastShown: z.boolean(),
38
38
  autoHideEmbedHTMLFullScreenToolbar: z.boolean(),
39
39
  connectorCenterAnchor: z.boolean().default(false),
40
+ /**
41
+ * The ids this viewer hid on this document's canvas (ADR 0031 §8). Per
42
+ * viewer and per document, like the viewport; never written to the
43
+ * document. Owned by `CanvasLocalVisibility`.
44
+ */
45
+ localHiddenElements: z.array(z.string()),
46
+ /**
47
+ * The user layers this viewer hid on this document's canvas (ADR 0031 §8,
48
+ * stage 7). Same owner, same key scheme, same lifetime as
49
+ * `localHiddenElements`; a separate key so the element list keeps the shape
50
+ * it already has in viewers' storage.
51
+ */
52
+ localHiddenLayers: z.array(z.string()),
53
+ /**
54
+ * This viewer's grid override on this document's canvas (ADR 0031 §11),
55
+ * keyed like the viewport. Absent = the document, the host or the library
56
+ * decides. Owned by `CanvasGrid`.
57
+ */
58
+ localShowGrid: z.boolean(),
40
59
  });
41
60
  function isLocalProp(key) {
42
61
  return key in LocalPropsSchema.shape;
@@ -45,6 +64,11 @@ function isSessionProp(key) {
45
64
  return key in SessionPropsSchema.shape;
46
65
  }
47
66
  function customizer(_target, source) {
67
+ // `mergeWith` assigns a primitive source as-is whatever the customizer says,
68
+ // so only an object can need one; skipping the schema parse for the rest is
69
+ // what keeps a paste of N elements from parsing every prop of every one.
70
+ if (source === null || typeof source !== 'object')
71
+ return;
48
72
  if (ColorSchema.safeParse(source).success ||
49
73
  source instanceof Y.Text ||
50
74
  source instanceof Y.Array ||
@@ -107,6 +131,12 @@ export class EditPropsStore extends LifeCycleWatcher {
107
131
  return 'blocksuite:embedHTML:autoHideFullScreenToolbar';
108
132
  case 'connectorCenterAnchor':
109
133
  return 'blocksuite:connector:centerAnchor';
134
+ case 'localHiddenElements':
135
+ return 'blocksuite:' + id + ':localHiddenElements';
136
+ case 'localHiddenLayers':
137
+ return 'blocksuite:' + id + ':localHiddenLayers';
138
+ case 'localShowGrid':
139
+ return 'blocksuite:' + id + ':localShowGrid';
110
140
  default:
111
141
  return key;
112
142
  }
@@ -171,6 +201,10 @@ export class EditPropsStore extends LifeCycleWatcher {
171
201
  return;
172
202
  this.setStorage('viewport', viewport);
173
203
  }
204
+ /** Forget a stored prop, so the next `getStorage` answers `null`. */
205
+ removeStorage(key) {
206
+ this._getStorage(key).removeItem(this._getStorageKey(key));
207
+ }
174
208
  setStorage(key, value) {
175
209
  const oldValue = this.getStorage(key);
176
210
  this._getStorage(key).setItem(this._getStorageKey(key), JSON.stringify(value));
@@ -5,6 +5,7 @@ import { z } from 'zod';
5
5
  export declare const GeneralSettingSchema: z.ZodObject<{
6
6
  edgelessScrollZoom: z.ZodDefault<z.ZodBoolean>;
7
7
  edgelessDisableScheduleUpdate: z.ZodDefault<z.ZodBoolean>;
8
+ edgelessShowGrid: z.ZodOptional<z.ZodBoolean>;
8
9
  docCanvasPreferView: z.ZodDefault<z.ZodEnum<["affine:embed-linked-doc", "affine:embed-synced-doc"]>>;
9
10
  } & {
10
11
  connector: z.ZodDefault<z.ZodObject<{
@@ -1479,6 +1480,7 @@ export declare const GeneralSettingSchema: z.ZodObject<{
1479
1480
  textHorizontalAlign?: import("../../affine-model/index.js").TextAlign | undefined;
1480
1481
  textVerticalAlign?: import("../../affine-model/index.js").TextVerticalAlign | undefined;
1481
1482
  };
1483
+ edgelessShowGrid?: boolean | undefined;
1482
1484
  }, {
1483
1485
  text?: {
1484
1486
  color: string | {
@@ -1512,6 +1514,7 @@ export declare const GeneralSettingSchema: z.ZodObject<{
1512
1514
  } | undefined;
1513
1515
  edgelessScrollZoom?: boolean | undefined;
1514
1516
  edgelessDisableScheduleUpdate?: boolean | undefined;
1517
+ edgelessShowGrid?: boolean | undefined;
1515
1518
  docCanvasPreferView?: "affine:embed-linked-doc" | "affine:embed-synced-doc" | undefined;
1516
1519
  connector?: {
1517
1520
  mode: import("../../affine-model/index.js").ConnectorMode;
@@ -5,6 +5,13 @@ export const GeneralSettingSchema = z
5
5
  .object({
6
6
  edgelessScrollZoom: z.boolean().default(false),
7
7
  edgelessDisableScheduleUpdate: z.boolean().default(false),
8
+ // The host's (or the user's) default for the canvas grid (ADR 0031 §11,
9
+ // level 3). No default on purpose: absent means the host did not decide,
10
+ // and the library default — on — applies. A viewer's own toggle and a
11
+ // document saved "for everyone" both win over it.
12
+ // A line comment, not JSDoc: see the guard in
13
+ // `affine/all/src/__tests__/zod-schema-jsdoc.unit.spec.ts`.
14
+ edgelessShowGrid: z.boolean().optional(),
8
15
  docCanvasPreferView: z
9
16
  .enum(['affine:embed-linked-doc', 'affine:embed-synced-doc'])
10
17
  .default('affine:embed-synced-doc'),
@@ -14,6 +14,10 @@ export interface BlockSuiteFlags {
14
14
  enable_mobile_keyboard_toolbar: boolean;
15
15
  enable_mobile_linked_doc_menu: boolean;
16
16
  enable_block_meta: boolean;
17
+ /**
18
+ * @deprecated No longer read: the Callout entries follow the `callout` key
19
+ * of `OPTIONAL_BLOCKS` alone, so `{ callout: false }` is the switch.
20
+ */
17
21
  enable_callout: boolean;
18
22
  enable_edgeless_scribbled_style: boolean;
19
23
  enable_table_virtual_scroll: boolean;
@@ -20,8 +20,19 @@ export type FontConfig = z.infer<typeof fontConfigSchema>;
20
20
  * The AFFiNE-hosted mirror. It carries strictly fewer files than the community
21
21
  * list: `cdn.affine.pro` answers 404 for every `Inter-Bold`, `Poppins-Bold`
22
22
  * and `BebasNeue-Bold` spelling, so those three families offer no 700 weight
23
- * here. The Kalam / Satoshi / Lora `SemiBold` entries below already point at
24
- * the 700 file — those families ship a single heavy face, not two.
23
+ * here. The Kalam / Lora `SemiBold` entries below already point at the 700
24
+ * file — those families ship a single heavy face, not two.
25
+ *
26
+ * Satoshi is in neither list since #396: its licence (ITF Free Font License
27
+ * 2.0, section 02) forbids offering it as a selectable font in a SaaS or design
28
+ * tool, whoever hosts the files. `FontFamily.Satoshi` stays a valid stored
29
+ * value; an element that carries it paints with the fallback, and the family
30
+ * picker names it as unavailable instead of offering it.
25
31
  */
26
32
  export declare const AffineCanvasTextFonts: FontConfig[];
33
+ /**
34
+ * The families on a public mirror, one `FontConfig` per face. A host that
35
+ * promises no third-party request passes the same list with its own `url`s;
36
+ * a host that drops a family drops it from the family picker too (#396).
37
+ */
27
38
  export declare const CommunityCanvasTextFonts: FontConfig[];