@formicoidea/labre-core 0.43.1 → 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 (263) 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-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
  17. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
  18. package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
  19. package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
  20. package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
  21. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
  22. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
  23. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
  24. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
  25. package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
  26. package/dist/_pkgs/affine-block-frame/frame-manager.js +48 -17
  27. package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
  28. package/dist/_pkgs/affine-block-image/utils.js +4 -1
  29. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
  30. package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
  31. package/dist/_pkgs/affine-block-note/translations.d.ts +0 -1
  32. package/dist/_pkgs/affine-block-note/translations.js +0 -5
  33. package/dist/_pkgs/affine-block-root/configs/toolbar.js +17 -1
  34. package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
  35. package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
  36. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
  37. package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
  38. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
  39. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
  40. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
  41. package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
  42. package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
  43. package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
  44. package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
  45. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
  46. package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
  47. package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
  48. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
  49. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
  50. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
  51. package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
  52. package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
  53. package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
  54. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
  55. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
  56. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
  57. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
  58. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
  59. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
  60. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
  63. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
  64. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
  66. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
  67. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
  68. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
  69. package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
  70. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
  72. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
  73. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
  74. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
  75. package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
  76. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +80 -0
  77. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +248 -0
  78. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +82 -0
  79. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +342 -0
  80. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
  81. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
  82. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
  85. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +86 -15
  86. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
  87. package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
  88. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
  89. package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
  90. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
  91. package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
  92. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
  93. package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
  94. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
  96. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
  97. package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
  98. package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
  99. package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
  100. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
  101. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
  102. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
  103. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
  104. package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
  105. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
  106. package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
  107. package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
  108. package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
  109. package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
  110. package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
  111. package/dist/_pkgs/affine-block-surface/view.js +23 -1
  112. package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
  113. package/dist/_pkgs/affine-components/context-menu/button.js +14 -0
  114. package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
  115. package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
  116. package/dist/_pkgs/affine-components/icons/index.js +0 -1
  117. package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
  118. package/dist/_pkgs/affine-components/icons/text.js +11 -0
  119. package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
  120. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +2 -2
  121. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
  122. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
  123. package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +1 -0
  124. package/dist/_pkgs/affine-fragment-frame-panel/index.js +1 -0
  125. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
  126. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
  127. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +3 -2
  128. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
  129. package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
  130. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
  131. package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
  132. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +1 -1
  133. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
  134. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
  135. package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
  136. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +2 -1
  137. package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
  138. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
  139. package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
  140. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
  141. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +53 -2
  142. package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
  143. package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
  144. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
  145. package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
  146. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
  147. package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
  148. package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
  149. package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
  150. package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
  151. package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
  152. package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
  153. package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
  154. package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
  155. package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
  156. package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
  157. package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
  158. package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
  159. package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
  160. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
  161. package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
  162. package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
  163. package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
  164. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  165. package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
  166. package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
  167. package/dist/_pkgs/affine-model/consts/text.d.ts +26 -0
  168. package/dist/_pkgs/affine-model/consts/text.js +25 -0
  169. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
  170. package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
  171. package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
  172. package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
  173. package/dist/_pkgs/affine-model/utils/helper.js +2 -0
  174. package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
  175. package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
  176. package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
  177. package/dist/_pkgs/affine-rich-text/index.js +1 -1
  178. package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
  179. package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
  180. package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
  181. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
  182. package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
  183. package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +27 -0
  184. package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
  185. package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
  186. package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
  187. package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
  188. package/dist/_pkgs/affine-shared/services/index.d.ts +3 -0
  189. package/dist/_pkgs/affine-shared/services/index.js +3 -0
  190. package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
  191. package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
  192. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
  193. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  194. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +5 -0
  195. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +9 -0
  196. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  197. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  198. package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
  199. package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
  200. package/dist/_pkgs/affine-shared/styles/text.js +7 -7
  201. package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
  202. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
  203. package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
  204. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
  205. package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
  206. package/dist/_pkgs/affine-shared/utils/index.d.ts +2 -0
  207. package/dist/_pkgs/affine-shared/utils/index.js +2 -0
  208. package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
  209. package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
  210. package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
  211. package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
  212. package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +10 -3
  213. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
  214. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
  215. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
  216. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
  217. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
  218. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +61 -0
  219. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +91 -0
  220. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
  221. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
  222. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
  223. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
  224. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
  225. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
  226. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +170 -0
  227. package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1381 -0
  228. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +52 -0
  229. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +161 -1
  230. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
  231. package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
  232. package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
  233. package/dist/_pkgs/std/gfx/controller.js +22 -2
  234. package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
  235. package/dist/_pkgs/std/gfx/index.d.ts +3 -1
  236. package/dist/_pkgs/std/gfx/index.js +3 -1
  237. package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
  238. package/dist/_pkgs/std/gfx/layer.js +73 -5
  239. package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
  240. package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
  241. package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
  242. package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
  243. package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
  244. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
  245. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
  246. package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
  247. package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
  248. package/dist/_pkgs/std/utils/layer.d.ts +10 -0
  249. package/dist/_pkgs/std/utils/layer.js +64 -13
  250. package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
  251. package/dist/commands.js +4 -1
  252. package/dist/translations.js +10 -6
  253. package/package.json +9 -2
  254. package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
  255. package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
  256. package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
  257. package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
  258. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
  259. package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
  260. package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
  261. package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
  262. package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
  263. package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
@@ -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`));
@@ -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({
@@ -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();
@@ -126,19 +126,25 @@ let FilterableListComponent = (() => {
126
126
  });
127
127
  }
128
128
  _filterItems() {
129
- const searchFilter = !this._filterText
130
- ? this.options.items
131
- : this.options.items.filter(item => item.name.startsWith(this._filterText.toLowerCase()) ||
132
- item.aliases?.some(alias => alias.startsWith(this._filterText.toLowerCase())));
133
- return searchFilter.sort((a, b) => {
134
- const isActiveA = this.options.active?.(a);
135
- const isActiveB = this.options.active?.(b);
129
+ const query = this._filterText.toLowerCase();
130
+ // A copy: the caller's array is its own state (the language button keeps
131
+ // its most-recently-used order in it), so sorting must not reorder it.
132
+ const ranked = this.options.items
133
+ .map(item => ({ item, rank: matchRank(item, query) }))
134
+ .filter(entry => entry.rank !== -1);
135
+ return ranked
136
+ .sort((a, b) => {
137
+ const isActiveA = this.options.active?.(a.item);
138
+ const isActiveB = this.options.active?.(b.item);
136
139
  if (isActiveA && !isActiveB)
137
140
  return -1;
138
141
  if (!isActiveA && isActiveB)
139
142
  return 1;
140
- return this.listFilter?.(a, b) ?? 0;
141
- });
143
+ if (a.rank !== b.rank)
144
+ return a.rank - b.rank;
145
+ return this.listFilter?.(a.item, b.item) ?? 0;
146
+ })
147
+ .map(entry => entry.item);
142
148
  }
143
149
  _scrollFocusedItemIntoView() {
144
150
  this.updateComplete
@@ -256,6 +262,21 @@ let FilterableListComponent = (() => {
256
262
  };
257
263
  })();
258
264
  export { FilterableListComponent };
265
+ /**
266
+ * Prefix match on both sides lowercased: 0 for a name or alias hit, 1 for a
267
+ * hit on the display label only (it sorts after an id hit), -1 for no match.
268
+ * An empty query matches everything at rank 0.
269
+ */
270
+ function matchRank(item, query) {
271
+ if (!query)
272
+ return 0;
273
+ const hits = (value) => !!value && value.toLowerCase().startsWith(query);
274
+ if (hits(item.name) || item.aliases?.some(hits))
275
+ return 0;
276
+ if (hits(item.label))
277
+ return 1;
278
+ return -1;
279
+ }
259
280
  export function showPopFilterableList({ options, filter, abortController = new AbortController(), referenceElement, container, maxHeight = 440, portalStyles, }) {
260
281
  const portalPadding = {
261
282
  top: PAGE_HEADER_HEIGHT + 12,
@@ -1,6 +1,5 @@
1
1
  export * from './ai.js';
2
2
  export * from './file-icons.js';
3
- export * from './file-icons-rc.js';
4
3
  export * from './import-export.js';
5
4
  export * from './list.js';
6
5
  export * from './loading.js';
@@ -1,6 +1,5 @@
1
1
  export * from './ai.js';
2
2
  export * from './file-icons.js';
3
- export * from './file-icons-rc.js';
4
3
  export * from './import-export.js';
5
4
  export * from './list.js';
6
5
  export * from './loading.js';
@@ -29,6 +29,7 @@ export declare const DividerIcon: import("lit-html").TemplateResult<1>;
29
29
  export declare const BoldIcon: import("lit-html").TemplateResult<1>;
30
30
  export declare const ItalicIcon: import("lit-html").TemplateResult<1>;
31
31
  export declare const UnderlineIcon: import("lit-html").TemplateResult<1>;
32
+ export declare const OverlineIcon: import("lit-html").TemplateResult<1>;
32
33
  export declare const StrikethroughIcon: import("lit-html").TemplateResult<1>;
33
34
  export declare const CodeIcon: import("lit-html").TemplateResult<1>;
34
35
  export declare const LinkIcon: import("lit-html").TemplateResult<1>;
@@ -97,6 +97,17 @@ export const UnderlineIcon = icons.UnderLineIcon({
97
97
  width: '20',
98
98
  height: '20',
99
99
  });
100
+ /**
101
+ * The icon set ships no overline, so it is drawn here: the underline icon's
102
+ * own letter and rule, the rule moved above the letter (ADR 0030).
103
+ */
104
+ const OverlineSVG = svg `<path
105
+ fill="currentColor"
106
+ fill-rule="evenodd"
107
+ clip-rule="evenodd"
108
+ d="M4.458 3.064a.808.808 0 0 0 0 1.616h15.084a.808.808 0 1 0 0-1.616zM7.744 7.968a.808.808 0 1 0-1.616 0v7.003a5.656 5.656 0 1 0 11.313 0V7.968a.808.808 0 1 0-1.616 0v7.003a4.04 4.04 0 1 1-8.08 0z"
109
+ />`;
110
+ export const OverlineIcon = icon(OverlineSVG, 20);
100
111
  export const StrikethroughIcon = icons.StrikeThroughIcon({
101
112
  width: '20',
102
113
  height: '20',
@@ -1,5 +1,5 @@
1
- import type { BlockStdScope } from '../../std/index.js';
2
- import type { Store, TransformerMiddleware } from '../../store/index.js';
1
+ import type { BlockStdScope } from '../std/index.js';
2
+ import type { Store, TransformerMiddleware } from '../store/index.js';
3
3
  import { LitElement, type PropertyValues } from 'lit';
4
4
  export declare const AFFINE_ADAPTER_PANEL = "affine-adapter-panel";
5
5
  declare const AdapterPanel_base: typeof LitElement & import("../global/utils/types.js").Constructor<import("../global/lit/with-disposable.js").DisposableClass>;
@@ -32,6 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
32
32
  }
33
33
  return useValue ? value : void 0;
34
34
  };
35
+ import { panelDragStarted } from '../../affine-shared/styles/index.js';
35
36
  import { on, once } from '../../affine-shared/utils/index.js';
36
37
  import { WithDisposable } from '../../global/lit/index.js';
37
38
  import { ShadowlessElement } from '../../std/index.js';
@@ -174,8 +175,7 @@ let FrameCard = (() => {
174
175
  return;
175
176
  const { clientX: startX, clientY: startY } = e;
176
177
  const disposeDragStart = on(this.ownerDocument, 'mousemove', e => {
177
- if (Math.abs(startX - e.clientX) < 5 &&
178
- Math.abs(startY - e.clientY) < 5) {
178
+ if (!panelDragStarted({ x: startX, y: startY }, { x: e.clientX, y: e.clientY })) {
179
179
  return;
180
180
  }
181
181
  if (this.status !== 'selected') {
@@ -3,7 +3,7 @@ import { LitElement, type PropertyValues } from 'lit';
3
3
  export declare const AFFINE_FRAME_PANEL_HEADER = "affine-frame-panel-header";
4
4
  declare const FramePanelHeader_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
5
5
  export declare class FramePanelHeader extends FramePanelHeader_base {
6
- static styles: import("lit").CSSResult;
6
+ static styles: import("lit").CSSResult[];
7
7
  private readonly _clearEdgelessDisposables;
8
8
  private _edgelessDisposables;
9
9
  private get _gfx();
@@ -35,6 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { PresentTool } from '../../affine-block-frame/index.js';
36
36
  import { EdgelessLegacySlotIdentifier } from '../../affine-block-surface/index.js';
37
37
  import { DocModeProvider, EditPropsStore, translateKey, } from '../../affine-shared/services/index.js';
38
+ import { panelHeaderStyles } from '../../affine-shared/styles/index.js';
38
39
  import { createButtonPopper } from '../../affine-shared/utils/index.js';
39
40
  import { DisposableGroup } from '../../global/disposable/index.js';
40
41
  import { WithDisposable } from '../../global/lit/index.js';
@@ -50,16 +51,6 @@ const styles = css `
50
51
  justify-content: start;
51
52
  }
52
53
 
53
- .frame-panel-header {
54
- display: flex;
55
- width: 100%;
56
- height: 36px;
57
- align-items: center;
58
- justify-content: space-between;
59
- box-sizing: border-box;
60
- padding: 0 8px;
61
- }
62
-
63
54
  .all-frames-setting {
64
55
  display: flex;
65
56
  align-items: center;
@@ -69,22 +60,9 @@ const styles = css `
69
60
  margin: 8px 4px;
70
61
  }
71
62
 
72
- .all-frames-setting-button svg {
73
- color: var(--affine-icon-secondary);
74
- }
75
-
76
- .all-frames-setting-button:hover svg,
77
- .all-frames-setting-button.active svg {
78
- color: var(--affine-icon-color);
79
- }
80
-
81
63
  .all-frames-setting-label {
82
64
  width: 68px;
83
65
  height: 22px;
84
- font-size: var(--affine-font-sm);
85
- font-weight: 500;
86
- line-height: 22px;
87
- color: var(--light-text-color-text-secondary-color, #8e8d91);
88
66
  }
89
67
 
90
68
  .frames-setting-container {
@@ -158,7 +136,9 @@ let FramePanelHeader = (() => {
158
136
  __esDecorate(this, null, _editorHost_decorators, { kind: "accessor", name: "editorHost", static: false, private: false, access: { has: obj => "editorHost" in obj, get: obj => obj.editorHost, set: (obj, value) => { obj.editorHost = value; } }, metadata: _metadata }, _editorHost_initializers, _editorHost_extraInitializers);
159
137
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
160
138
  }
161
- static { this.styles = styles; }
139
+ // The header row, title and icon button are every side panel's: they live in
140
+ // panelHeaderStyles so the selection pane and the catalogue draw the same.
141
+ static { this.styles = [panelHeaderStyles, styles]; }
162
142
  get _gfx() {
163
143
  return this.editorHost.std.get(GfxControllerIdentifier);
164
144
  }
@@ -194,13 +174,14 @@ let FramePanelHeader = (() => {
194
174
  }
195
175
  render() {
196
176
  const { std } = this.editorHost;
197
- return html `<div class="frame-panel-header">
177
+ return html `<div class="frame-panel-header affine-panel-header">
198
178
  <div class="all-frames-setting">
199
- <span class="all-frames-setting-label"
179
+ <span class="all-frames-setting-label affine-panel-header-title"
200
180
  >${translateKey(std, ...FRAME_PANEL_ALL_FRAMES_LABEL)}</span
201
181
  >
202
182
  <edgeless-tool-icon-button
203
- class="all-frames-setting-button ${this._settingPopperShow
183
+ class="all-frames-setting-button affine-panel-header-button ${this
184
+ ._settingPopperShow
204
185
  ? 'active'
205
186
  : ''}"
206
187
  .tooltip=${this._settingPopperShow
@@ -1 +1,2 @@
1
1
  export * from './frame-panel.js';
2
+ export * from './header/frame-panel-header.js';
@@ -1 +1,2 @@
1
1
  export * from './frame-panel.js';
2
+ export * from './header/frame-panel-header.js';
@@ -1,3 +1,4 @@
1
+ import { textDecorationLine } from '../../../affine-gfx-text/index.js';
1
2
  import { ConnectorMode, DefaultTheme, } from '../../../affine-model/index.js';
2
3
  import { PointLocation, SVGPathBuilder } from '../../../global/gfx/index.js';
3
4
  import { isConnectorWithLabel } from '../../connector-manager.js';
@@ -207,7 +208,7 @@ function renderConnectorLabel(model, retained, renderer, zoom, slot) {
207
208
  return;
208
209
  }
209
210
  const [lx, ly, lw, lh] = content.xywh;
210
- const { labelStyle: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, }, } = model;
211
+ const { labelStyle: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, textDecoration, }, } = model;
211
212
  const labelElement = getOrCreateLabelElement(retained, slot);
212
213
  labelElement.style.position = 'absolute';
213
214
  labelElement.style.left = `${lx * zoom}px`;
@@ -231,6 +232,7 @@ function renderConnectorLabel(model, retained, renderer, zoom, slot) {
231
232
  labelElement.style.fontStyle = fontStyle;
232
233
  labelElement.style.fontFamily = fontFamily;
233
234
  labelElement.style.textAlign = textAlign;
235
+ labelElement.style.textDecorationLine = textDecorationLine(textDecoration);
234
236
  labelElement.style.lineHeight = '1.2';
235
237
  labelElement.style.whiteSpace = 'pre-wrap';
236
238
  labelElement.style.wordWrap = 'break-word';
@@ -1,5 +1,5 @@
1
1
  import { ElementRendererExtension, } from '../../affine-block-surface/index.js';
2
- import { getFontString, getLineHeight, getTextWidth, isRTL, wrapTextDeltas, } from '../../affine-gfx-text/index.js';
2
+ import { alphabeticBaselineOffset, getFontString, getLineHeight, getTextWidth, isRTL, paintTextDecoration, wrapTextDeltas, } from '../../affine-gfx-text/index.js';
3
3
  import { ConnectorMode, DefaultTheme, } from '../../affine-model/index.js';
4
4
  import { getBezierParameters, } from '../../global/gfx/index.js';
5
5
  import { deltaInsertsToChunks } from '../../std/inline/index.js';
@@ -170,7 +170,7 @@ function renderEndpoint(model, location, ctx, rc, end, style, stroke) {
170
170
  * which pair of fields the function reached into.
171
171
  */
172
172
  function renderLabel(label, ctx, matrix, renderer) {
173
- const { text, xywh, style: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign }, constraints: { hasMaxWidth, maxWidth }, } = label;
173
+ const { text, xywh, style: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, textDecoration, }, constraints: { hasMaxWidth, maxWidth }, } = label;
174
174
  const font = getFontString({
175
175
  fontStyle,
176
176
  fontWeight,
@@ -193,7 +193,8 @@ function renderLabel(label, ctx, matrix, renderer) {
193
193
  ctx.font = font;
194
194
  ctx.textAlign = textAlign;
195
195
  ctx.textBaseline = 'middle';
196
- ctx.fillStyle = renderer.getColorValue(color, DefaultTheme.black, true);
196
+ const fill = renderer.getColorValue(color, DefaultTheme.black, true);
197
+ ctx.fillStyle = fill;
197
198
  let textMaxWidth = textAlign === 'center' ? 0 : getMaxTextWidth(lines, font);
198
199
  if (hasMaxWidth && maxWidth > 0) {
199
200
  textMaxWidth = Math.min(textMaxWidth, textMaxWidth);
@@ -219,7 +220,23 @@ function renderLabel(label, ctx, matrix, renderer) {
219
220
  : rtl
220
221
  ? 0.5
221
222
  : -0.5);
222
- ctx.fillText(str, x + cx, index * lineHeight - textHeight + cy);
223
+ const lineY = index * lineHeight - textHeight + cy;
224
+ ctx.fillText(str, x + cx, lineY);
225
+ if (textDecoration) {
226
+ // Painted on the `middle` baseline; the line hangs off the alphabetic
227
+ // one, measured below it.
228
+ paintTextDecoration(ctx, {
229
+ decoration: textDecoration,
230
+ lineText: str,
231
+ font,
232
+ x: x + cx,
233
+ baselineY: lineY + alphabeticBaselineOffset(font, 'middle'),
234
+ fontFamily,
235
+ fontSize,
236
+ fontWeight,
237
+ color: fill,
238
+ });
239
+ }
223
240
  if (shouldTemporarilyAttach) {
224
241
  ctx.canvas.remove();
225
242
  }
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
33
  return useValue ? value : void 0;
34
34
  };
35
35
  import { DefaultTool, EdgelessCRUDIdentifier, } from '../../affine-block-surface/index.js';
36
- import { getLineHeight } from '../../affine-gfx-text/index.js';
36
+ import { getLineHeight, textDecorationLine } from '../../affine-gfx-text/index.js';
37
37
  import { connectorEndLabelBox, } from '../../affine-model/index.js';
38
38
  import { ThemeProvider, translateKey } from '../../affine-shared/services/index.js';
39
39
  import { almostEqual } from '../../affine-shared/utils/index.js';
@@ -423,7 +423,7 @@ let EdgelessConnectorLabelEditor = (() => {
423
423
  }
424
424
  render() {
425
425
  const { connector } = this;
426
- const { labelStyle: { fontFamily, fontSize, fontStyle, fontWeight, textAlign, color: labelColor, }, labelConstraints: { hasMaxWidth, maxWidth }, } = connector;
426
+ const { labelStyle: { fontFamily, fontSize, fontStyle, fontWeight, textAlign, textDecoration, color: labelColor, }, labelConstraints: { hasMaxWidth, maxWidth }, } = connector;
427
427
  const lineHeight = getLineHeight(fontFamily, fontSize, fontWeight);
428
428
  const { translateX, translateY, zoom } = this.gfx.viewport;
429
429
  const [x, y] = Vec.mul(this._labelCenter, zoom);
@@ -447,6 +447,7 @@ let EdgelessConnectorLabelEditor = (() => {
447
447
  fontStyle,
448
448
  fontWeight,
449
449
  textAlign,
450
+ textDecorationLine: textDecorationLine(textDecoration),
450
451
  lineHeight: `${lineHeight}px`,
451
452
  maxWidth: hasMaxWidth
452
453
  ? `${maxWidth + BORDER_WIDTH * 2 + HORIZONTAL_PADDING * 2}px`
@@ -450,7 +450,7 @@ export const connectorToolbarConfig = {
450
450
  return;
451
451
  const labelStyle = { ...model.labelStyle, ...props };
452
452
  // No need to adjust element bounds
453
- if (props['textAlign']) {
453
+ if (props['textAlign'] || props['textDecoration']) {
454
454
  ctx.std
455
455
  .get(EdgelessCRUDIdentifier)
456
456
  .updateElement(model.id, { labelStyle });
@@ -1,7 +1,7 @@
1
1
  import { EdgelessCRUDIdentifier } from '../../affine-block-surface/index.js';
2
2
  import { MindmapElementModel, } from '../../affine-model/index.js';
3
3
  import { translateKey } from '../../affine-shared/services/index.js';
4
- import { batchAddChildren, batchRemoveChildren, generateKeyBetween, generateNKeysBetween, GfxControllerIdentifier, measureOperation, } from '../../std/gfx/index.js';
4
+ import { batchAddChildren, batchRemoveChildren, generateKeyBetween, generateNKeysBetween, GfxControllerIdentifier, GfxPrimitiveElementModel, measureOperation, } from '../../std/gfx/index.js';
5
5
  import { GROUP_SEED_NAME } from '../translations.js';
6
6
  /**
7
7
  * Every element that sits at the root of the board, in painting order.
@@ -65,12 +65,60 @@ const buildUngroupIndexes = (orderedElements, afterIndex, beforeIndex, fallbackA
65
65
  tryGenerateOneByOne(null, null) ??
66
66
  []);
67
67
  };
68
+ /**
69
+ * The layer a new group is stored in (ADR 0031 §5): the effective layer of
70
+ * its HIGHEST member, so grouping never sinks what was on top. `'@default'`
71
+ * is passed explicitly — the creation middleware then writes no key, rather
72
+ * than reading "absent" as "the viewer's active layer". Nothing at all while
73
+ * the surface has no user layer.
74
+ */
75
+ function groupLayerProps(gfx, elements) {
76
+ const userLayers = gfx.surface?.userLayers;
77
+ if (!userLayers?.ranks)
78
+ return {};
79
+ const models = elements
80
+ .map(el => (typeof el === 'string' ? gfx.getElementById(el) : el))
81
+ .filter((model) => !!model && 'index' in model)
82
+ .sort((a, b) => gfx.layer.compare(a, b));
83
+ const highest = models.at(-1);
84
+ return highest ? { layer: userLayers.effectiveLayerOf(highest) } : {};
85
+ }
86
+ /**
87
+ * Ungrouping a top-level group hands its layer to each released child, in
88
+ * the ungroup's own transaction (ADR 0031 §5): a member's own `layer` was
89
+ * ignored while it was inside, and may be stale.
90
+ */
91
+ function releaseChildrenToGroupLayer(gfx, group, children) {
92
+ const userLayers = gfx.surface?.userLayers;
93
+ if (!userLayers?.ranks)
94
+ return;
95
+ const layer = group.layer;
96
+ for (const child of children) {
97
+ const own = child instanceof GfxPrimitiveElementModel
98
+ ? child.layer
99
+ : child.props.layer;
100
+ if (own === layer)
101
+ continue;
102
+ if (layer === undefined) {
103
+ if (child instanceof GfxPrimitiveElementModel) {
104
+ child.clearField('layer');
105
+ }
106
+ else {
107
+ delete child.props.layer;
108
+ }
109
+ }
110
+ else {
111
+ gfx.updateElement(child, { layer });
112
+ }
113
+ }
114
+ }
68
115
  export const createGroupCommand = (ctx, next) => {
69
116
  const { std, elements } = ctx;
70
117
  const gfx = std.get(GfxControllerIdentifier);
71
118
  const crud = std.get(EdgelessCRUDIdentifier);
72
119
  const groups = gfx.layer.canvasElements.filter(el => el.type === 'group');
73
120
  const groupId = crud.addElement('group', {
121
+ ...groupLayerProps(gfx, elements),
74
122
  children: elements.reduce((pre, el) => {
75
123
  const id = typeof el === 'string' ? el : el.id;
76
124
  pre[id] = true;
@@ -175,6 +223,9 @@ export const ungroupCommand = (ctx, next) => {
175
223
  if (parent !== null) {
176
224
  batchAddChildren(parent, orderedElements);
177
225
  }
226
+ else {
227
+ releaseChildrenToGroupLayer(gfx, group, orderedElements);
228
+ }
178
229
  });
179
230
  selection.set({
180
231
  editing: false,