@formicoidea/labre-core 0.41.0 → 0.43.1

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 (343) hide show
  1. package/LICENSE +384 -0
  2. package/dist/_pkgs/affine-block-bookmark/bookmark-block.js +2 -2
  3. package/dist/_pkgs/affine-block-data-view/configs/tooltips.js +1 -1
  4. package/dist/_pkgs/affine-block-database/configs/tooltips.js +1 -1
  5. package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +4 -2
  6. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +7 -1
  7. package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.d.ts +39 -0
  8. package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.js +39 -0
  9. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +4 -1
  10. package/dist/_pkgs/affine-block-embed/embed-github-block/embed-github-block.js +2 -1
  11. package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts +14 -1
  12. package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js +21 -2
  13. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -0
  14. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +2 -1
  15. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +41 -11
  16. package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.d.ts +16 -0
  17. package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.js +17 -1
  18. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.d.ts +8 -0
  19. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.js +19 -0
  20. package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +4 -1
  21. package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +4 -1
  22. package/dist/_pkgs/affine-block-embed/index.d.ts +1 -0
  23. package/dist/_pkgs/affine-block-embed/index.js +1 -0
  24. package/dist/_pkgs/affine-block-embed/translations.d.ts +8 -0
  25. package/dist/_pkgs/affine-block-embed/translations.js +28 -0
  26. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -2
  27. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
  28. package/dist/_pkgs/affine-block-frame/frame-manager.js +6 -3
  29. package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
  30. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +6 -1
  31. package/dist/_pkgs/affine-block-list/list-keymap.js +7 -0
  32. package/dist/_pkgs/affine-block-list/utils/get-list-icon.js +3 -1
  33. package/dist/_pkgs/affine-block-note/configs/tooltips.js +1 -1
  34. package/dist/_pkgs/affine-block-note/note-keymap.js +7 -1
  35. package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
  36. package/dist/_pkgs/affine-block-root/adapters/html.js +2 -2
  37. package/dist/_pkgs/affine-block-root/commands/copy-link-commands.d.ts +2 -0
  38. package/dist/_pkgs/affine-block-root/commands/copy-link-commands.js +155 -0
  39. package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +1 -8
  40. package/dist/_pkgs/affine-block-root/commands/tag-commands.js +1 -8
  41. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.d.ts +9 -0
  42. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +51 -0
  43. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +22 -0
  44. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +46 -0
  45. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.d.ts +21 -0
  46. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.js +24 -0
  47. package/dist/_pkgs/affine-block-root/edgeless/utils/query.js +8 -0
  48. package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
  49. package/dist/_pkgs/affine-block-root/index.js +1 -0
  50. package/dist/_pkgs/affine-block-root/keyboard/keymap.js +1 -16
  51. package/dist/_pkgs/affine-block-root/view.js +2 -0
  52. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
  53. package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
  54. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +23 -0
  55. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +89 -0
  56. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +7 -0
  57. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +5 -0
  58. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +41 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +70 -0
  60. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +49 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +257 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.d.ts +16 -0
  63. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.js +24 -0
  64. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +24 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +66 -0
  66. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +66 -4
  69. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +253 -11
  70. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +18 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.d.ts +81 -0
  72. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.js +81 -0
  73. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +144 -0
  74. package/dist/_pkgs/affine-block-surface/extensions/legend.js +495 -0
  75. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -0
  76. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +17 -3
  77. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +35 -13
  78. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +61 -1
  79. package/dist/_pkgs/affine-block-surface/extensions/reading.js +85 -39
  80. package/dist/_pkgs/affine-block-surface/extensions/record-action.d.ts +66 -0
  81. package/dist/_pkgs/affine-block-surface/extensions/record-action.js +145 -0
  82. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +3 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +23 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +1 -1
  85. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +12 -4
  86. package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +253 -28
  87. package/dist/_pkgs/affine-block-surface/extensions/validation.js +489 -41
  88. package/dist/_pkgs/affine-block-surface/framework-background/background-view.d.ts +115 -0
  89. package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +185 -0
  90. package/dist/_pkgs/affine-block-surface/framework-background/fit.d.ts +36 -0
  91. package/dist/_pkgs/affine-block-surface/framework-background/fit.js +30 -0
  92. package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +2 -0
  93. package/dist/_pkgs/affine-block-surface/framework-background/index.js +2 -0
  94. package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +16 -1
  95. package/dist/_pkgs/affine-block-surface/framework-background/labels.js +31 -21
  96. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +29 -5
  97. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +6 -4
  98. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +56 -8
  99. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +12 -0
  100. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +15 -0
  101. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +2 -7
  102. package/dist/_pkgs/affine-block-surface/view.js +8 -1
  103. package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
  104. package/dist/_pkgs/affine-block-surface-ref/configs/tooltips.js +2 -2
  105. package/dist/_pkgs/affine-components/color-picker/button.d.ts +56 -1
  106. package/dist/_pkgs/affine-components/color-picker/button.js +168 -23
  107. package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +106 -0
  108. package/dist/_pkgs/affine-components/color-picker/framework-palette.js +177 -0
  109. package/dist/_pkgs/affine-components/color-picker/index.d.ts +2 -0
  110. package/dist/_pkgs/affine-components/color-picker/index.js +2 -0
  111. package/dist/_pkgs/affine-components/color-picker/palette-carousel.d.ts +85 -0
  112. package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +445 -0
  113. package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
  114. package/dist/_pkgs/affine-components/context-menu/button.js +3 -1
  115. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.d.ts +31 -1
  116. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +189 -63
  117. package/dist/_pkgs/affine-components/icons/ai.js +3 -3
  118. package/dist/_pkgs/affine-components/icons/list.js +7 -1
  119. package/dist/_pkgs/affine-components/resource/resource.js +29 -16
  120. package/dist/_pkgs/affine-components/size-dropdown-menu/dropdown-menu.js +6 -1
  121. package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -1
  122. package/dist/_pkgs/affine-components/toolbar/index.js +1 -1
  123. package/dist/_pkgs/affine-components/toolbar/menu-button.d.ts +7 -0
  124. package/dist/_pkgs/affine-components/toolbar/menu-button.js +30 -0
  125. package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +16 -1
  126. package/dist/_pkgs/affine-components/toolbar/picker-menu.js +2 -2
  127. package/dist/_pkgs/affine-components/toolbar/toolbar.d.ts +1 -0
  128. package/dist/_pkgs/affine-components/toolbar/toolbar.js +67 -0
  129. package/dist/_pkgs/affine-components/translations.d.ts +8 -0
  130. package/dist/_pkgs/affine-components/translations.js +17 -0
  131. package/dist/_pkgs/affine-foundation/view.js +2 -1
  132. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card-title-editor.js +1 -1
  133. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +1 -1
  134. package/dist/_pkgs/affine-gfx-brush/element-renderer.js +2 -2
  135. package/dist/_pkgs/affine-gfx-brush/toolbar/components/eraser/icons.js +1 -1
  136. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/brush.js +6 -1
  137. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/highlighter.js +6 -1
  138. package/dist/_pkgs/affine-gfx-connector/connector-manager.d.ts +9 -1
  139. package/dist/_pkgs/affine-gfx-connector/connector-manager.js +61 -0
  140. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +11 -2
  141. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +11 -2
  142. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.d.ts +7 -1
  143. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +87 -17
  144. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +78 -17
  145. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.d.ts +24 -2
  146. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +31 -8
  147. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.d.ts +124 -3
  148. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +219 -56
  149. package/dist/_pkgs/affine-gfx-connector/text/text.d.ts +13 -4
  150. package/dist/_pkgs/affine-gfx-connector/text/text.js +13 -44
  151. package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +56 -0
  152. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +94 -10
  153. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.d.ts +8 -0
  154. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.js +118 -0
  155. package/dist/_pkgs/affine-gfx-connector/translations.d.ts +3 -0
  156. package/dist/_pkgs/affine-gfx-connector/translations.js +23 -0
  157. package/dist/_pkgs/affine-gfx-connector/view/view.d.ts +37 -1
  158. package/dist/_pkgs/affine-gfx-connector/view/view.js +97 -8
  159. package/dist/_pkgs/affine-gfx-group/command/group-api.js +1 -1
  160. package/dist/_pkgs/affine-gfx-group/store.js +0 -2
  161. package/dist/_pkgs/affine-gfx-group/translations.d.ts +9 -10
  162. package/dist/_pkgs/affine-gfx-group/translations.js +9 -13
  163. package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
  164. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +1 -1
  165. package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
  166. package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
  167. package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
  168. package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +7 -1
  169. package/dist/_pkgs/affine-gfx-mindmap/translations.js +11 -1
  170. package/dist/_pkgs/affine-gfx-shape/element-renderer/highlighter.js +2 -2
  171. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.d.ts +6 -0
  172. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +30 -1
  173. package/dist/_pkgs/affine-gfx-shape/polygon-tool.d.ts +20 -1
  174. package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +9 -1
  175. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +10 -3
  176. package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
  177. package/dist/_pkgs/affine-gfx-shape/translations.d.ts +7 -0
  178. package/dist/_pkgs/affine-gfx-shape/translations.js +11 -0
  179. package/dist/_pkgs/affine-gfx-template/builtin/other.js +14 -8
  180. package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
  181. package/dist/_pkgs/affine-gfx-template/toolbar/template-loading.js +1 -1
  182. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
  183. package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
  184. package/dist/_pkgs/affine-gfx-template/translations.js +38 -0
  185. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.d.ts +13 -1
  186. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.js +19 -4
  187. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.d.ts +41 -0
  188. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +60 -4
  189. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
  190. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +14 -2
  191. package/dist/_pkgs/affine-gfx-text/translations.d.ts +9 -0
  192. package/dist/_pkgs/affine-gfx-text/translations.js +14 -1
  193. package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -1
  194. package/dist/_pkgs/affine-inline-preset/markdown.js +5 -1
  195. package/dist/_pkgs/affine-model/consts/connector.d.ts +28 -2
  196. package/dist/_pkgs/affine-model/consts/connector.js +26 -0
  197. package/dist/_pkgs/affine-model/consts/text.d.ts +15 -2
  198. package/dist/_pkgs/affine-model/consts/text.js +25 -1
  199. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -1
  200. package/dist/_pkgs/affine-model/elements/brush/brush.js +1 -1
  201. package/dist/_pkgs/affine-model/elements/c4/board.js +1 -1
  202. package/dist/_pkgs/affine-model/elements/c4/boundary.js +1 -1
  203. package/dist/_pkgs/affine-model/elements/connector/connector.d.ts +135 -0
  204. package/dist/_pkgs/affine-model/elements/connector/connector.js +246 -5
  205. package/dist/_pkgs/affine-model/elements/connector/end-label.d.ts +83 -0
  206. package/dist/_pkgs/affine-model/elements/connector/end-label.js +119 -0
  207. package/dist/_pkgs/affine-model/elements/connector/index.d.ts +1 -0
  208. package/dist/_pkgs/affine-model/elements/connector/index.js +1 -0
  209. package/dist/_pkgs/affine-model/elements/context-map/context-map.js +1 -1
  210. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +28 -0
  211. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +129 -2
  212. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +8 -0
  213. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +45 -2
  214. package/dist/_pkgs/affine-model/elements/edgy/board.js +1 -1
  215. package/dist/_pkgs/affine-model/elements/edgy/facets.js +1 -1
  216. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +6 -0
  217. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +36 -2
  218. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +18 -7
  219. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +23 -8
  220. package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +16 -0
  221. package/dist/_pkgs/affine-model/elements/framework-background/background.js +18 -0
  222. package/dist/_pkgs/affine-model/elements/highlighter/highlighter.js +1 -1
  223. package/dist/_pkgs/affine-model/elements/index.d.ts +8 -0
  224. package/dist/_pkgs/affine-model/elements/index.js +1 -0
  225. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -1
  226. package/dist/_pkgs/affine-model/elements/text/text.js +1 -1
  227. package/dist/_pkgs/affine-model/elements/uml/band.d.ts +39 -0
  228. package/dist/_pkgs/affine-model/elements/uml/band.js +31 -0
  229. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +158 -0
  230. package/dist/_pkgs/affine-model/elements/uml/diagram.js +229 -0
  231. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +161 -0
  232. package/dist/_pkgs/affine-model/elements/uml/fragment.js +205 -0
  233. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +8 -0
  234. package/dist/_pkgs/affine-model/elements/uml/index.js +8 -0
  235. package/dist/_pkgs/affine-model/elements/uml/lifeline.d.ts +77 -0
  236. package/dist/_pkgs/affine-model/elements/uml/lifeline.js +89 -0
  237. package/dist/_pkgs/affine-model/elements/uml/node.d.ts +142 -0
  238. package/dist/_pkgs/affine-model/elements/uml/node.js +190 -0
  239. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +106 -0
  240. package/dist/_pkgs/affine-model/elements/uml/partition.js +172 -0
  241. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +75 -0
  242. package/dist/_pkgs/affine-model/elements/uml/region.js +150 -0
  243. package/dist/_pkgs/affine-model/elements/uml/subject.d.ts +37 -0
  244. package/dist/_pkgs/affine-model/elements/uml/subject.js +108 -0
  245. package/dist/_pkgs/affine-model/elements/wardley/wardley.js +1 -1
  246. package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.d.ts +1 -0
  247. package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +18 -0
  248. package/dist/_pkgs/affine-shared/services/font-loader/config.js +82 -50
  249. package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +1 -9
  250. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.d.ts +53 -0
  251. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.js +95 -0
  252. package/dist/_pkgs/affine-shared/services/telemetry-service/index.d.ts +1 -0
  253. package/dist/_pkgs/affine-shared/services/telemetry-service/index.js +1 -0
  254. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +26 -1
  255. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  256. package/dist/_pkgs/affine-shared/services/theme-service.d.ts +19 -0
  257. package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
  258. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.d.ts +34 -0
  259. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.js +63 -0
  260. package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
  261. package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
  262. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +97 -7
  263. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +178 -7
  264. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  265. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  266. package/dist/_pkgs/affine-shared/styles/motion.d.ts +14 -0
  267. package/dist/_pkgs/affine-shared/styles/motion.js +38 -0
  268. package/dist/_pkgs/affine-shared/utils/event.d.ts +10 -0
  269. package/dist/_pkgs/affine-shared/utils/event.js +20 -0
  270. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +16 -0
  271. package/dist/_pkgs/affine-shared/utils/file/filesys.js +25 -0
  272. package/dist/_pkgs/affine-shared/utils/index.d.ts +1 -0
  273. package/dist/_pkgs/affine-shared/utils/index.js +1 -0
  274. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.d.ts +12 -0
  275. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.js +13 -0
  276. package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +2 -2
  277. package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +5 -1
  278. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +12 -4
  279. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +27 -4
  280. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/types.d.ts +15 -0
  281. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.d.ts +1 -1
  282. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.js +7 -2
  283. package/dist/_pkgs/affine-widget-edgeless-toolbar/create-popper.js +13 -0
  284. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +2 -0
  285. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +2 -0
  286. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +80 -0
  287. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +270 -81
  288. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.d.ts +15 -0
  289. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.js +15 -0
  290. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.d.ts +18 -0
  291. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.js +52 -6
  292. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-weight-and-style-panel.js +8 -1
  293. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.d.ts +42 -0
  294. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.js +100 -0
  295. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.d.ts +100 -0
  296. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.js +274 -0
  297. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.d.ts +3 -0
  298. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.js +3 -0
  299. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.d.ts +25 -0
  300. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.js +67 -0
  301. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +6 -0
  302. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +10 -0
  303. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +5 -0
  304. package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
  305. package/dist/_pkgs/affine-widget-slash-menu/translations.d.ts +16 -0
  306. package/dist/_pkgs/affine-widget-slash-menu/translations.js +23 -1
  307. package/dist/_pkgs/affine-widget-toolbar/utils.js +57 -14
  308. package/dist/_pkgs/data-view/core/detail/field.js +2 -1
  309. package/dist/_pkgs/data-view/core/filter/literal/define.js +3 -1
  310. package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +1 -1
  311. package/dist/_pkgs/data-view/property-presets/checkbox/cell-renderer.js +8 -2
  312. package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +1 -1
  313. package/dist/_pkgs/data-view/view-presets/kanban/pc/controller/drag.js +2 -1
  314. package/dist/_pkgs/data-view/view-presets/table/pc/controller/drag.js +2 -1
  315. package/dist/_pkgs/data-view/view-presets/table/pc/controller/selection.js +1 -1
  316. package/dist/_pkgs/data-view/view-presets/table/pc/header/vertical-indicator.js +2 -1
  317. package/dist/_pkgs/data-view/view-presets/table/pc/row/row-select-checkbox.js +3 -1
  318. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/drag.js +2 -1
  319. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/selection.js +1 -1
  320. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js +2 -1
  321. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/row-header.js +3 -1
  322. package/dist/_pkgs/global/gfx/xywh.js +7 -0
  323. package/dist/_pkgs/std/extension/command-registry.d.ts +158 -1
  324. package/dist/_pkgs/std/extension/command-registry.js +22 -0
  325. package/dist/_pkgs/std/gfx/index.d.ts +1 -1
  326. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.d.ts +12 -0
  327. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +20 -1
  328. package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +10 -0
  329. package/dist/_pkgs/std/gfx/interactivity/manager.js +12 -0
  330. package/dist/_pkgs/std/gfx/model/surface/element-model.js +12 -7
  331. package/dist/_pkgs/std/gfx/model/surface/role.d.ts +10 -5
  332. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +56 -0
  333. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +84 -3
  334. package/dist/_pkgs/std/gfx/view/view.d.ts +11 -2
  335. package/dist/_pkgs/std/gfx/view/view.js +16 -2
  336. package/dist/commands.d.ts +6 -0
  337. package/dist/commands.js +10 -2
  338. package/dist/frameworks.d.ts +9 -0
  339. package/dist/frameworks.js +19 -0
  340. package/dist/translations.js +21 -0
  341. package/package.json +13 -4
  342. package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
  343. package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
@@ -0,0 +1,25 @@
1
+ import type { GfxController } from '../../std/gfx/index.js';
2
+ /**
3
+ * Run `body` and report the ids of everything it put on the board — canvas
4
+ * elements and canvas blocks alike.
5
+ *
6
+ * Both subscriptions are synchronous: a Yjs observer fires when the transaction
7
+ * commits, inside the `addElement` / `addBlock` call, so an action that creates
8
+ * on the spot is fully accounted for by the time `body` returns. An action that
9
+ * creates from a promise is NOT, and its artefact is left where the command put
10
+ * it — which is today's behaviour for every command, so nothing regresses.
11
+ */
12
+ export declare function collectCreated(gfx: GfxController, body: () => void): string[];
13
+ /**
14
+ * Move a freshly created drawing by `(dx, dy)`, and report what is left to
15
+ * select.
16
+ *
17
+ * Only the TOP-LEVEL items move. An element the same run filed inside a group
18
+ * it also created is carried by that group, and moving it twice would tear the
19
+ * drawing apart. A group is moved through its children — `GfxGroupLikeElement`'s
20
+ * `xywh` setter is a deliberate no-op, its box being derived from what it holds
21
+ * — which is exactly what {@link updateXYWH} does, along with a connector's free
22
+ * endpoints (an anchored one simply follows what it is tied to) and a note's
23
+ * collapsed height. Hence no second opinion here.
24
+ */
25
+ export declare function translateCreated(gfx: GfxController, ids: string[], dx: number, dy: number): string[];
@@ -0,0 +1,67 @@
1
+ import { EdgelessCRUDIdentifier, updateXYWH, } from '../../affine-block-surface/index.js';
2
+ import { Bound } from '../../global/gfx/index.js';
3
+ /**
4
+ * Run `body` and report the ids of everything it put on the board — canvas
5
+ * elements and canvas blocks alike.
6
+ *
7
+ * Both subscriptions are synchronous: a Yjs observer fires when the transaction
8
+ * commits, inside the `addElement` / `addBlock` call, so an action that creates
9
+ * on the spot is fully accounted for by the time `body` returns. An action that
10
+ * creates from a promise is NOT, and its artefact is left where the command put
11
+ * it — which is today's behaviour for every command, so nothing regresses.
12
+ */
13
+ export function collectCreated(gfx, body) {
14
+ const ids = [];
15
+ const subscriptions = [
16
+ gfx.surface?.elementAdded.subscribe(({ id }) => {
17
+ ids.push(id);
18
+ }),
19
+ gfx.std.store.slots.blockUpdated.subscribe(payload => {
20
+ if (payload.type === 'add')
21
+ ids.push(payload.id);
22
+ }),
23
+ ];
24
+ try {
25
+ body();
26
+ }
27
+ finally {
28
+ subscriptions.forEach(subscription => subscription?.unsubscribe());
29
+ }
30
+ return ids;
31
+ }
32
+ /**
33
+ * Move a freshly created drawing by `(dx, dy)`, and report what is left to
34
+ * select.
35
+ *
36
+ * Only the TOP-LEVEL items move. An element the same run filed inside a group
37
+ * it also created is carried by that group, and moving it twice would tear the
38
+ * drawing apart. A group is moved through its children — `GfxGroupLikeElement`'s
39
+ * `xywh` setter is a deliberate no-op, its box being derived from what it holds
40
+ * — which is exactly what {@link updateXYWH} does, along with a connector's free
41
+ * endpoints (an anchored one simply follows what it is tied to) and a note's
42
+ * collapsed height. Hence no second opinion here.
43
+ */
44
+ export function translateCreated(gfx, ids, dx, dy) {
45
+ const created = new Set(ids);
46
+ const models = ids
47
+ .map(id => gfx.getElementById(id))
48
+ .filter((model) => !!model && 'xywh' in model);
49
+ const top = models.filter(model => !model.group || !created.has(model.group.id));
50
+ if (dx !== 0 || dy !== 0) {
51
+ const updateElement = gfx.std.get(EdgelessCRUDIdentifier).updateElement;
52
+ // Wrapped, not handed over: `Store.updateBlock` is a prototype method that
53
+ // reads `this.readonly` and `this._crud`. `updateXYWH` happens to re-bind it
54
+ // (`updateBlock.call(ele.store, …)`), so today nothing breaks — but an
55
+ // unbound method sitting in a variable is a landmine that reads correct, and
56
+ // the day that `.call` becomes a plain call the first canvas block placed
57
+ // would throw on `readonly` of undefined.
58
+ const updateBlock = (model, props) => gfx.std.store.updateBlock(model, props);
59
+ for (const model of top) {
60
+ const bound = Bound.deserialize(model.xywh);
61
+ bound.x += dx;
62
+ bound.y += dy;
63
+ updateXYWH(model, bound, updateElement, updateBlock);
64
+ }
65
+ }
66
+ return top.map(model => model.id);
67
+ }
@@ -11,5 +11,11 @@ import { type ChromeWording } from '../affine-shared/services/index.js';
11
11
  */
12
12
  export declare const EDGELESS_TOOLBAR_COMING_SOON: ChromeWording;
13
13
  export declare const EDGELESS_TOOLBAR_MORE_TOOLS: ChromeWording;
14
+ /**
15
+ * A family the element still carries but the host no longer configures
16
+ * (#396): the font picker keeps its name, greyed, with this mark. `{{name}}`
17
+ * is the family name, a proper name the host does not translate.
18
+ */
19
+ export declare const EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE: ChromeWording;
14
20
  /** Every wording this package declares, in the order it renders them. */
15
21
  export declare const EDGELESS_TOOLBAR_WORDINGS: readonly ChromeWording[];
@@ -14,7 +14,17 @@ export const EDGELESS_TOOLBAR_MORE_TOOLS = [
14
14
  'com.labre.edgeless-toolbar.more-tools',
15
15
  'More Tools',
16
16
  ];
17
+ /**
18
+ * A family the element still carries but the host no longer configures
19
+ * (#396): the font picker keeps its name, greyed, with this mark. `{{name}}`
20
+ * is the family name, a proper name the host does not translate.
21
+ */
22
+ export const EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE = [
23
+ 'com.labre.edgeless-toolbar.font-family-unavailable',
24
+ '{{name}} (unavailable)',
25
+ ];
17
26
  /** Every wording this package declares, in the order it renders them. */
18
27
  export const EDGELESS_TOOLBAR_WORDINGS = [
19
28
  EDGELESS_TOOLBAR_MORE_TOOLS,
29
+ EDGELESS_TOOLBAR_FONT_FAMILY_UNAVAILABLE,
20
30
  ];
@@ -3,6 +3,7 @@ import { artefactCatalogueDefaultExtension } from './catalogue/artefact-catalogu
3
3
  import { edgelessArtefactCatalogueWidget } from './catalogue/artefact-catalogue-widget.js';
4
4
  import { edgelessToolbarWidget } from './edgeless-toolbar.js';
5
5
  import { effects } from './effects.js';
6
+ import { ArtefactPlacementTool } from './placement/artefact-placement-tool.js';
6
7
  export class EdgelessToolbarViewExtension extends ViewExtensionProvider {
7
8
  constructor() {
8
9
  super(...arguments);
@@ -23,6 +24,10 @@ export class EdgelessToolbarViewExtension extends ViewExtensionProvider {
23
24
  // sidebar overrides the seam and the widget then never opens.
24
25
  context.register(edgelessArtefactCatalogueWidget);
25
26
  context.register(artefactCatalogueDefaultExtension);
27
+ // Unconditionally too, and for the same reason: the tool is generic
28
+ // chrome driven by whatever commands are registered, so a framework whose
29
+ // flag is off simply never arms it. See `docs/adr/0009`.
30
+ context.register(ArtefactPlacementTool);
26
31
  }
27
32
  }
28
33
  }
@@ -78,7 +78,8 @@ let EdgelessFrameTitleEditor = (() => {
78
78
  outline: none;
79
79
  z-index: 1;
80
80
  border: 1px solid var(--affine-primary-color);
81
- box-shadow: 0px 0px 0px 2px rgba(30, 150, 235, 0.3);
81
+ box-shadow: 0px 0px 0px 2px
82
+ color-mix(in srgb, var(--affine-primary-color) 30%, transparent);
82
83
  overflow: hidden;
83
84
  font-family: var(--affine-font-family);
84
85
  }
@@ -53,12 +53,19 @@ export declare const SLASH_MENU_DELETE_DESCRIPTION: ChromeWording;
53
53
  * '<n>_<Name>@<i>'`, the `<Name>` between `_` and `@`):
54
54
  *
55
55
  * - `Basic` — callout, latex, note (paragraph/heading/list/quote/divider).
56
+ * - `List`, `Style` — note again, but written as TEMPLATE literals
57
+ * (`` `1_List@${index++}` ``, `` `2_Style@${index++}` ``,
58
+ * `blocks/note/src/configs/slash-menu.ts`), which is why the first
59
+ * inventory — a grep for `group: '` — missed both (#390).
56
60
  * - `Content & Media` — attachment, bookmark, image, latex, the generic embed
57
61
  * (iframe) block, and (postponed, `blocks/table`) table.
58
62
  * - `Page` — the linked-doc embed block.
59
63
  * - `Edgeless Element` — surface-ref.
60
64
  * - `Date`, `Actions` — this package's own groups (`./config.ts`).
61
65
  *
66
+ * The inventory covers template literals too: the `<Name>` is read between the
67
+ * `_` and the `@`, whichever way the group string was built.
68
+ *
62
69
  * NOT included: `Database`, used only by the postponed `blocks/database` and
63
70
  * `blocks/data-view` — the PO's decision excludes those surfaces, and
64
71
  * `Database` has no other user today. A framework or a later lot that adds a
@@ -67,6 +74,15 @@ export declare const SLASH_MENU_DELETE_DESCRIPTION: ChromeWording;
67
74
  * of this existed.
68
75
  */
69
76
  export declare const SLASH_MENU_GROUP_BASIC: ChromeWording;
77
+ export declare const SLASH_MENU_GROUP_LIST: ChromeWording;
78
+ /**
79
+ * An ALIAS, not a new key: `STYLE_MENU_LABEL` already carries the word
80
+ * `Style` in the chrome table, and a second key with the same fallback would
81
+ * fail the "un mot chrome, une clé" test. Listed in the group table below,
82
+ * NOT in `SLASH_MENU_WORDINGS` — an alias is walked once, from
83
+ * `CHROME_WORDINGS`, exactly like `SLASH_MENU_COPY` / `_DUPLICATE`.
84
+ */
85
+ export declare const SLASH_MENU_GROUP_STYLE: ChromeWording;
70
86
  export declare const SLASH_MENU_GROUP_CONTENT_MEDIA: ChromeWording;
71
87
  export declare const SLASH_MENU_GROUP_PAGE: ChromeWording;
72
88
  export declare const SLASH_MENU_GROUP_EDGELESS_ELEMENT: ChromeWording;
@@ -1,4 +1,4 @@
1
- import { TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, TOOLBAR_MOVE_DOWN, TOOLBAR_MOVE_UP, } from '../affine-shared/services/index.js';
1
+ import { STYLE_MENU_LABEL, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, TOOLBAR_MOVE_DOWN, TOOLBAR_MOVE_UP, } from '../affine-shared/services/index.js';
2
2
  /**
3
3
  * The slash menu's own wordings — one `ChromeWording` per static config
4
4
  * literal (`name`, `description`, a tooltip's `caption`) that
@@ -91,12 +91,19 @@ export const SLASH_MENU_DELETE_DESCRIPTION = [
91
91
  * '<n>_<Name>@<i>'`, the `<Name>` between `_` and `@`):
92
92
  *
93
93
  * - `Basic` — callout, latex, note (paragraph/heading/list/quote/divider).
94
+ * - `List`, `Style` — note again, but written as TEMPLATE literals
95
+ * (`` `1_List@${index++}` ``, `` `2_Style@${index++}` ``,
96
+ * `blocks/note/src/configs/slash-menu.ts`), which is why the first
97
+ * inventory — a grep for `group: '` — missed both (#390).
94
98
  * - `Content & Media` — attachment, bookmark, image, latex, the generic embed
95
99
  * (iframe) block, and (postponed, `blocks/table`) table.
96
100
  * - `Page` — the linked-doc embed block.
97
101
  * - `Edgeless Element` — surface-ref.
98
102
  * - `Date`, `Actions` — this package's own groups (`./config.ts`).
99
103
  *
104
+ * The inventory covers template literals too: the `<Name>` is read between the
105
+ * `_` and the `@`, whichever way the group string was built.
106
+ *
100
107
  * NOT included: `Database`, used only by the postponed `blocks/database` and
101
108
  * `blocks/data-view` — the PO's decision excludes those surfaces, and
102
109
  * `Database` has no other user today. A framework or a later lot that adds a
@@ -108,6 +115,18 @@ export const SLASH_MENU_GROUP_BASIC = [
108
115
  'com.labre.slash-menu.group.basic',
109
116
  'Basic',
110
117
  ];
118
+ export const SLASH_MENU_GROUP_LIST = [
119
+ 'com.labre.slash-menu.group.list',
120
+ 'List',
121
+ ];
122
+ /**
123
+ * An ALIAS, not a new key: `STYLE_MENU_LABEL` already carries the word
124
+ * `Style` in the chrome table, and a second key with the same fallback would
125
+ * fail the "un mot chrome, une clé" test. Listed in the group table below,
126
+ * NOT in `SLASH_MENU_WORDINGS` — an alias is walked once, from
127
+ * `CHROME_WORDINGS`, exactly like `SLASH_MENU_COPY` / `_DUPLICATE`.
128
+ */
129
+ export const SLASH_MENU_GROUP_STYLE = STYLE_MENU_LABEL;
111
130
  export const SLASH_MENU_GROUP_CONTENT_MEDIA = [
112
131
  'com.labre.slash-menu.group.content-media',
113
132
  'Content & Media',
@@ -131,6 +150,8 @@ export const SLASH_MENU_GROUP_ACTIONS = [
131
150
  /** The group table, keyed by the raw group name `parseGroup` extracts. */
132
151
  const SLASH_MENU_GROUP_WORDINGS = {
133
152
  Basic: SLASH_MENU_GROUP_BASIC,
153
+ List: SLASH_MENU_GROUP_LIST,
154
+ Style: SLASH_MENU_GROUP_STYLE,
134
155
  'Content & Media': SLASH_MENU_GROUP_CONTENT_MEDIA,
135
156
  Page: SLASH_MENU_GROUP_PAGE,
136
157
  'Edgeless Element': SLASH_MENU_GROUP_EDGELESS_ELEMENT,
@@ -167,6 +188,7 @@ export const SLASH_MENU_WORDINGS = [
167
188
  SLASH_MENU_COPY_DUPLICATE_CAPTION,
168
189
  SLASH_MENU_DELETE_DESCRIPTION,
169
190
  SLASH_MENU_GROUP_BASIC,
191
+ SLASH_MENU_GROUP_LIST,
170
192
  SLASH_MENU_GROUP_CONTENT_MEDIA,
171
193
  SLASH_MENU_GROUP_PAGE,
172
194
  SLASH_MENU_GROUP_EDGELESS_ELEMENT,
@@ -23,6 +23,21 @@ export const sideMap = new Map([
23
23
  // has only one shape element
24
24
  ['affine:surface:shape', { top: 26, bottom: -26 }],
25
25
  ]);
26
+ /**
27
+ * The narrowest room the row is ever told it has.
28
+ *
29
+ * A cap is a `max-width`: below the width of what the row cannot give up, it
30
+ * stops being an instruction and becomes a guillotine — the entries past it are
31
+ * painted outside the row's own background, over the document. A floor keeps
32
+ * that from ever happening on a number nobody meant.
33
+ *
34
+ * 120px is a minimal row, drawn: three icon buttons — the "⋮" plus the two
35
+ * entries a menu is worth opening for — at {@link MENU_BUTTON_WIDTH} each, the
36
+ * two 8px gaps between them, one separator and its gap, and the row's own 6px
37
+ * of padding on either side. 109px, rounded up to leave the border its half
38
+ * pixel and the eye a little air.
39
+ */
40
+ const MIN_TOOLBAR_WIDTH = 120;
26
41
  export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, placement, sideOptions, options = { elementResize: false },
27
42
  /**
28
43
  * Called whenever the room the row has just changed. This is the only place
@@ -51,22 +66,32 @@ onAvailableWidth) {
51
66
  }
52
67
  : {
53
68
  placement,
69
+ // ORDER MATTERS, and `size` comes LAST of the four — after `inline`,
70
+ // after `shift`, after `flip` — which is the order floating-ui
71
+ // documents for it and the order this row needs.
72
+ //
73
+ // `size` asks the question "how much room is there", and it has two
74
+ // different answers depending on whether a `shift` has already run:
75
+ //
76
+ // - **after `shift`** (`middlewareData.shift.enabled.x`): the room is
77
+ // `maximumClippingWidth` — the clipping box, less the padding. Which
78
+ // is the truth: it is where the row may be drawn, and `shift` will
79
+ // slide the row to fit inside it.
80
+ // - **before `shift`**, on an UNALIGNED placement (`'top'`, which is
81
+ // what a text selection's row uses), floating-ui falls back to
82
+ // `width - 2 × overflow` — the row's own width, less twice what a
83
+ // row CENTRED on the selection would stick out by. That number is
84
+ // not room at all. It is fine while the centred row fits, and the
85
+ // moment it would stick out by one pixel it collapses below the
86
+ // row's width and the entries start leaving for the "⋮" — with 900px
87
+ // of empty editor next to them, because `shift` was about to slide
88
+ // the row back in anyway. Worse, it is computed from a width `size`
89
+ // itself has just capped, so each `reset` makes it smaller: the
90
+ // format bar measured 75px of "room" inside a 420px window.
91
+ //
92
+ // See the cap's only reader, `availableWidthOf`.
54
93
  middleware: [
55
94
  offset(10 + offsetY),
56
- size({
57
- padding: 10,
58
- apply: ({ elements, availableWidth }) => {
59
- elements.floating.style.width = 'fit-content';
60
- // The room the row has. The toolbar never wraps and never
61
- // scrolls: past this width its entries give way, in the order
62
- // they declared, into the "⋮" menu — see `ToolbarFitter`.
63
- const capped = `${availableWidth}px`;
64
- if (elements.floating.style.maxWidth !== capped) {
65
- elements.floating.style.maxWidth = capped;
66
- onAvailableWidth?.();
67
- }
68
- },
69
- }),
70
95
  isInline ? inline() : undefined,
71
96
  shift(state => ({
72
97
  padding: {
@@ -88,6 +113,20 @@ onAvailableWidth) {
88
113
  // 25/08/2026, third video: the map background's row). Horizontal
89
114
  // placement belongs to `shift`, which slides — it never teleports.
90
115
  flip({ padding: 10, crossAxis: false, flipAlignment: false }),
116
+ size({
117
+ padding: 10,
118
+ apply: ({ elements, availableWidth }) => {
119
+ elements.floating.style.width = 'fit-content';
120
+ // The room the row has. The toolbar never wraps and never
121
+ // scrolls: past this width its entries give way, in the order
122
+ // they declared, into the "⋮" menu — see `ToolbarFitter`.
123
+ const capped = `${Math.max(availableWidth, MIN_TOOLBAR_WIDTH)}px`;
124
+ if (elements.floating.style.maxWidth !== capped) {
125
+ elements.floating.style.maxWidth = capped;
126
+ onAvailableWidth?.();
127
+ }
128
+ },
129
+ }),
91
130
  hide(),
92
131
  ],
93
132
  };
@@ -599,6 +638,10 @@ const MAX_FIT_ROUNDS = 3;
599
638
  * keeps its natural width under it, while an `inner` toolbar is pinned to the
600
639
  * exact width of the block it sits on. Anything else — a row nothing has
601
640
  * positioned yet — has all the room in the world and collapses nothing.
641
+ *
642
+ * The cap is the clipping box less its padding, never the row's own width: see
643
+ * the middleware order in {@link autoUpdatePosition}. It is floored at
644
+ * {@link MIN_TOOLBAR_WIDTH}.
602
645
  */
603
646
  function availableWidthOf(toolbar) {
604
647
  const max = Number.parseFloat(toolbar.style.maxWidth);
@@ -129,7 +129,8 @@ let RecordField = (() => {
129
129
  }
130
130
 
131
131
  .field-content.is-editing {
132
- box-shadow: 0px 0px 0px 2px rgba(30, 150, 235, 0.3);
132
+ box-shadow: 0px 0px 0px 2px
133
+ color-mix(in srgb, var(--affine-primary-color) 30%, transparent);
133
134
  }
134
135
 
135
136
  .field-content.is-focus {
@@ -83,7 +83,9 @@ export const allLiteralConfig = [
83
83
  items: type.element.data?.map(tag => {
84
84
  const selected = set.has(tag.id);
85
85
  const prefix = selected
86
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
86
+ ? CheckBoxCheckSolidIcon({
87
+ style: `color:var(--affine-primary-color)`,
88
+ })
87
89
  : CheckBoxUnIcon();
88
90
  return menu.action({
89
91
  name: tag.value,
@@ -15,7 +15,7 @@ export class BooleanGroupView extends BaseGroup {
15
15
  render() {
16
16
  return html ` <div class="data-view-group-title-boolean-view">
17
17
  ${this.value
18
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
18
+ ? CheckBoxCheckSolidIcon({ style: `color:var(--affine-primary-color)` })
19
19
  : CheckBoxUnIcon()}
20
20
  </div>`;
21
21
  }
@@ -40,6 +40,12 @@ import { BaseCellRenderer } from '../../core/property/index.js';
40
40
  import { createFromBaseCellRenderer } from '../../core/property/renderer.js';
41
41
  import { createIcon } from '../../core/utils/uni-icon.js';
42
42
  import { checkboxPropertyModelConfig } from './define.js';
43
+ /**
44
+ * The chrome accent, reached through its token rather than written as a hex:
45
+ * the six-dot burst is chrome, so it has to follow the host's theme (DESIGN.md,
46
+ * The Borrowed Blue Rule).
47
+ */
48
+ const ACCENT = 'var(--affine-primary-color)';
43
49
  const playCheckAnimation = async (refElement, { left = 0, size = 20 } = {}) => {
44
50
  const sparkingEl = document.createElement('div');
45
51
  sparkingEl.classList.add('affine-check-animation');
@@ -56,7 +62,7 @@ const playCheckAnimation = async (refElement, { left = 0, size = 20 } = {}) => {
56
62
  refElement.append(sparkingEl);
57
63
  await sparkingEl.animate([
58
64
  {
59
- boxShadow: '0 -18px 0 -8px #1e96eb, 16px -8px 0 -8px #1e96eb, 16px 8px 0 -8px #1e96eb, 0 18px 0 -8px #1e96eb, -16px 8px 0 -8px #1e96eb, -16px -8px 0 -8px #1e96eb',
65
+ boxShadow: `0 -18px 0 -8px ${ACCENT}, 16px -8px 0 -8px ${ACCENT}, 16px 8px 0 -8px ${ACCENT}, 0 18px 0 -8px ${ACCENT}, -16px 8px 0 -8px ${ACCENT}, -16px -8px 0 -8px ${ACCENT}`,
60
66
  },
61
67
  ], { duration: 240, easing: 'ease', fill: 'forwards' }).finished;
62
68
  await sparkingEl.animate([
@@ -120,7 +126,7 @@ let CheckboxCell = (() => {
120
126
  render() {
121
127
  const checked = this.value ?? false;
122
128
  const icon = checked
123
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
129
+ ? CheckBoxCheckSolidIcon({ style: `color:var(--affine-primary-color)` })
124
130
  : CheckBoxUnIcon();
125
131
  return html ` <div class="affine-database-checkbox-container">
126
132
  <div
@@ -156,7 +156,7 @@ let KanbanCell = (() => {
156
156
  ? '1px solid var(--affine-primary-color)'
157
157
  : '';
158
158
  this.style.boxShadow = this.isEditing$.value
159
- ? '0px 0px 0px 2px rgba(30, 150, 235, 0.30)'
159
+ ? '0px 0px 0px 2px color-mix(in srgb, var(--affine-primary-color) 30%, transparent)'
160
160
  : '';
161
161
  return html ` ${this.renderIcon()}
162
162
  ${renderUniLit(view, props, {
@@ -172,7 +172,8 @@ const createDropPreview = () => {
172
172
  div.style.height = '2px';
173
173
  div.style.borderRadius = '1px';
174
174
  div.style.backgroundColor = 'var(--affine-primary-color)';
175
- div.style.boxShadow = '0px 0px 8px 0px rgba(30, 150, 235, 0.35)';
175
+ div.style.boxShadow =
176
+ '0px 0px 8px 0px color-mix(in srgb, var(--affine-primary-color) 35%, transparent)';
176
177
  return {
177
178
  display(group, self, card) {
178
179
  const target = card ?? group.querySelector('.add-card');
@@ -156,7 +156,8 @@ const createDropPreview = () => {
156
156
  div.style.height = '2px';
157
157
  div.style.borderRadius = '1px';
158
158
  div.style.backgroundColor = 'var(--affine-primary-color)';
159
- div.style.boxShadow = '0px 0px 8px 0px rgba(30, 150, 235, 0.35)';
159
+ div.style.boxShadow =
160
+ '0px 0px 8px 0px color-mix(in srgb, var(--affine-primary-color) 35%, transparent)';
160
161
  return {
161
162
  display(x, y, width) {
162
163
  document.body.append(div);
@@ -967,7 +967,7 @@ let SelectionElement = (() => {
967
967
  ? 'dashed'
968
968
  : 'solid';
969
969
  div.style.boxShadow = isEditing
970
- ? '0px 0px 0px 2px rgba(30, 150, 235, 0.30)'
970
+ ? '0px 0px 0px 2px color-mix(in srgb, var(--affine-primary-color) 30%, transparent)'
971
971
  : 'unset';
972
972
  div.style.display = 'block';
973
973
  dragToFill.style.left = `${x + w}px`;
@@ -101,7 +101,8 @@ let TableVerticalIndicator = (() => {
101
101
  }
102
102
 
103
103
  .with-shadow.vertical-indicator::after {
104
- box-shadow: 0px 0px 8px 0px rgba(30, 150, 235, 0.35);
104
+ box-shadow: 0px 0px 8px 0px
105
+ color-mix(in srgb, var(--affine-primary-color) 35%, transparent);
105
106
  }
106
107
  `; }
107
108
  render() {
@@ -122,7 +122,9 @@ let RowSelectCheckbox = (() => {
122
122
  return html `
123
123
  <div class="${classString}">
124
124
  ${this.isSelected$.value
125
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
125
+ ? CheckBoxCheckSolidIcon({
126
+ style: `color:var(--affine-primary-color)`,
127
+ })
126
128
  : CheckBoxUnIcon()}
127
129
  </div>
128
130
  `;
@@ -177,7 +177,8 @@ const createDropPreview = () => {
177
177
  div.style.height = '2px';
178
178
  div.style.borderRadius = '1px';
179
179
  div.style.backgroundColor = 'var(--affine-primary-color)';
180
- div.style.boxShadow = '0px 0px 8px 0px rgba(30, 150, 235, 0.35)';
180
+ div.style.boxShadow =
181
+ '0px 0px 8px 0px color-mix(in srgb, var(--affine-primary-color) 35%, transparent)';
181
182
  return {
182
183
  display(x, y, width) {
183
184
  document.body.append(div);
@@ -859,7 +859,7 @@ let SelectionElement = (() => {
859
859
  height: `${focus.height}px`,
860
860
  display: 'block',
861
861
  boxShadow: focus.editing
862
- ? '0px 0px 0px 2px rgba(30, 150, 235, 0.30)'
862
+ ? '0px 0px 0px 2px color-mix(in srgb, var(--affine-primary-color) 30%, transparent)'
863
863
  : 'unset',
864
864
  })
865
865
  : undefined;
@@ -101,7 +101,8 @@ let TableVerticalIndicator = (() => {
101
101
  }
102
102
 
103
103
  .with-shadow.vertical-indicator::after {
104
- box-shadow: 0px 0px 8px 0px rgba(30, 150, 235, 0.35);
104
+ box-shadow: 0px 0px 8px 0px
105
+ color-mix(in srgb, var(--affine-primary-color) 35%, transparent);
105
106
  }
106
107
  `; }
107
108
  render() {
@@ -138,7 +138,9 @@ let TableRowHeader = (() => {
138
138
  <div @click=${this.selectRow} class="${styles.checkboxWrapper}">
139
139
  <div class="${classString}">
140
140
  ${this.rowSelected$.value
141
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
141
+ ? CheckBoxCheckSolidIcon({
142
+ style: `color:var(--affine-primary-color)`,
143
+ })
142
144
  : CheckBoxUnIcon()}
143
145
  </div>
144
146
  </div>
@@ -2,6 +2,13 @@ export function serializeXYWH(x, y, w, h) {
2
2
  return `[${x},${y},${w},${h}]`;
3
3
  }
4
4
  export function deserializeXYWH(xywh) {
5
+ // An ABSENT value is not a parse failure: a document whose Yjs state has
6
+ // pending structs can hand us an element whose `xywh` key is simply missing.
7
+ // Say nothing here — this getter runs several times per frame per element,
8
+ // and the surface already reports the damaged element once, at mount.
9
+ if (xywh === null || xywh === undefined) {
10
+ return [0, 0, 0, 0];
11
+ }
5
12
  try {
6
13
  return JSON.parse(xywh);
7
14
  }