@formicoidea/labre-core 0.32.0 → 0.34.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 (308) hide show
  1. package/dist/_pkgs/affine-block-attachment/attachment-block.js +3 -3
  2. package/dist/_pkgs/affine-block-attachment/configs/toolbar.d.ts +2 -2
  3. package/dist/_pkgs/affine-block-attachment/configs/toolbar.js +9 -7
  4. package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +12 -12
  5. package/dist/_pkgs/affine-block-callout/callout-block.js +1 -1
  6. package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
  7. package/dist/_pkgs/affine-block-code/code-block.js +2 -2
  8. package/dist/_pkgs/affine-block-code/code-toolbar/config.js +9 -1
  9. package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
  10. package/dist/_pkgs/affine-block-database/data-source.js +1 -2
  11. package/dist/_pkgs/affine-block-database/database-block.js +2 -2
  12. package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
  13. package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +1 -1
  14. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +1 -1
  15. package/dist/_pkgs/affine-block-embed/common/render-linked-doc.js +3 -3
  16. package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -11
  17. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
  18. package/dist/_pkgs/affine-block-embed/embed-html-block/configs/toolbar.js +5 -5
  19. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.d.ts +7 -7
  20. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +14 -14
  21. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +2 -2
  22. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +10 -10
  23. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -4
  24. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/utils.js +1 -1
  25. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/components/embed-synced-doc-card.js +5 -4
  26. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +10 -10
  27. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +1 -1
  28. package/dist/_pkgs/affine-block-frame/frame-manager.js +3 -1
  29. package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
  30. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +2 -2
  31. package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
  32. package/dist/_pkgs/affine-block-image/configs/toolbar.js +4 -4
  33. package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -1
  34. package/dist/_pkgs/affine-block-list/utils/forward-delete.js +1 -1
  35. package/dist/_pkgs/affine-block-note/commands/select-block.js +1 -1
  36. package/dist/_pkgs/affine-block-note/commands/select-blocks-between.js +1 -1
  37. package/dist/_pkgs/affine-block-note/configs/toolbar.js +2 -2
  38. package/dist/_pkgs/affine-block-note/move-block.js +1 -1
  39. package/dist/_pkgs/affine-block-paragraph/utils/forward-delete.js +2 -2
  40. package/dist/_pkgs/affine-block-paragraph/utils/merge-with-prev.js +1 -1
  41. package/dist/_pkgs/affine-block-root/configs/toolbar.d.ts +6 -4
  42. package/dist/_pkgs/affine-block-root/configs/toolbar.js +6 -6
  43. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.d.ts +10 -10
  44. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.js +4 -4
  45. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.d.ts +7 -7
  46. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +9 -9
  47. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +1 -1
  48. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +3 -1
  49. package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
  50. package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.js +1 -1
  51. package/dist/_pkgs/affine-block-surface/adapters/plain-text/element-adapter/type.js +1 -1
  52. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +18 -3
  53. package/dist/_pkgs/affine-block-surface/element-model/index.js +12 -2
  54. package/dist/_pkgs/affine-block-surface/extensions/audit.js +23 -6
  55. package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +10 -5
  56. package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +2 -1
  57. package/dist/_pkgs/affine-block-surface/extensions/element-renderer.js +1 -1
  58. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +1 -1
  59. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
  60. package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +172 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +404 -0
  63. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +323 -0
  64. package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +61 -61
  66. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.d.ts +248 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +248 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +78 -80
  69. package/dist/_pkgs/affine-block-surface/extensions/reading.js +2 -2
  70. package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +21 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +17 -3
  72. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +107 -0
  73. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +958 -0
  74. package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +809 -20
  75. package/dist/_pkgs/affine-block-surface/extensions/validation.js +1661 -50
  76. package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +50 -6
  77. package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +129 -32
  78. package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +289 -0
  79. package/dist/_pkgs/affine-block-surface/framework-background/def.js +126 -1
  80. package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +42 -2
  81. package/dist/_pkgs/affine-block-surface/framework-background/labels.js +80 -4
  82. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +172 -11
  83. package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
  84. package/dist/_pkgs/affine-block-surface/index.js +1 -0
  85. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.d.ts +17 -0
  86. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +66 -0
  87. package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
  88. package/dist/_pkgs/affine-block-surface/view.js +5 -0
  89. package/dist/_pkgs/affine-block-surface-ref/configs/toolbar.js +4 -4
  90. package/dist/_pkgs/affine-block-surface-ref/portal/note.js +2 -2
  91. package/dist/_pkgs/affine-block-table/commands.js +1 -1
  92. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +1 -1
  93. package/dist/_pkgs/affine-components/embed-card-modal/embed-card-edit-modal.js +1 -1
  94. package/dist/_pkgs/affine-components/filterable-list/styles.js +1 -1
  95. package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
  96. package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
  97. package/dist/_pkgs/affine-components/icons/text.js +426 -426
  98. package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +2 -0
  99. package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
  100. package/dist/_pkgs/affine-components/resource/resource.js +2 -0
  101. package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -0
  102. package/dist/_pkgs/affine-components/toolbar/index.js +1 -0
  103. package/dist/_pkgs/affine-components/toolbar/menu-button.js +1 -1
  104. package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +55 -0
  105. package/dist/_pkgs/affine-components/toolbar/picker-menu.js +47 -0
  106. package/dist/_pkgs/affine-components/view-dropdown-menu/dropdown-menu.js +27 -14
  107. package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +2 -2
  108. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +2 -2
  109. package/dist/_pkgs/affine-fragment-frame-panel/header/frames-setting-menu.js +1 -1
  110. package/dist/_pkgs/affine-fragment-outline/mobile-outline-panel.js +1 -1
  111. package/dist/_pkgs/affine-gfx-brush/toolbar/components/pen/pen-tool-button.js +1 -1
  112. package/dist/_pkgs/affine-gfx-connector/connector-manager.js +7 -10
  113. package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +19 -1
  114. package/dist/_pkgs/affine-gfx-connector/connector-tool.js +10 -2
  115. package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
  116. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +2 -1
  117. package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +1 -3
  118. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +1 -1
  119. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +1 -1
  120. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
  121. package/dist/_pkgs/affine-gfx-mindmap/adapter/markdown/index.js +1 -1
  122. package/dist/_pkgs/affine-gfx-mindmap/adapter/utils.js +1 -1
  123. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +583 -4
  124. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +23 -23
  125. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +5 -1
  126. package/dist/_pkgs/affine-gfx-mindmap/view/utils.js +1 -1
  127. package/dist/_pkgs/affine-gfx-note/overlay/overlay.js +1 -1
  128. package/dist/_pkgs/affine-gfx-note/toolbar/note-senior-button.js +1 -1
  129. package/dist/_pkgs/affine-gfx-shape/consts.js +1 -1
  130. package/dist/_pkgs/affine-gfx-shape/draggable/shape-draggable.js +1 -1
  131. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/polygon.js +17 -9
  132. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/utils.js +8 -3
  133. package/dist/_pkgs/affine-gfx-shape/element-view.js +19 -12
  134. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +1 -1
  135. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-vertex-editing-overlay.js +12 -7
  136. package/dist/_pkgs/affine-gfx-shape/overlay/shape-overlay.js +1 -1
  137. package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +4 -2
  138. package/dist/_pkgs/affine-gfx-shape/shape-tool.js +1 -1
  139. package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +1 -3
  140. package/dist/_pkgs/affine-gfx-template/builtin/other.js +66 -17
  141. package/dist/_pkgs/affine-gfx-template/toolbar/overlay-scrollbar.js +1 -1
  142. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +1 -1
  143. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +1 -1
  144. package/dist/_pkgs/affine-inline-link/command.js +1 -1
  145. package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.d.ts +4 -4
  146. package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.js +6 -6
  147. package/dist/_pkgs/affine-inline-preset/command/format-block.js +1 -1
  148. package/dist/_pkgs/affine-inline-preset/command/format-native.js +2 -2
  149. package/dist/_pkgs/affine-inline-preset/command/format-text.js +1 -1
  150. package/dist/_pkgs/affine-inline-preset/inline-spec.js +1 -1
  151. package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.d.ts +4 -4
  152. package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.js +6 -6
  153. package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
  154. package/dist/_pkgs/affine-model/elements/bpmn/node.d.ts +40 -7
  155. package/dist/_pkgs/affine-model/elements/bpmn/node.js +4 -2
  156. package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +135 -17
  157. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +148 -26
  158. package/dist/_pkgs/affine-model/elements/c4/board.d.ts +88 -0
  159. package/dist/_pkgs/affine-model/elements/c4/board.js +128 -0
  160. package/dist/_pkgs/affine-model/elements/c4/boundary.d.ts +63 -0
  161. package/dist/_pkgs/affine-model/elements/c4/boundary.js +134 -0
  162. package/dist/_pkgs/affine-model/elements/c4/index.d.ts +3 -0
  163. package/dist/_pkgs/affine-model/elements/c4/index.js +3 -0
  164. package/dist/_pkgs/affine-model/elements/c4/node.d.ts +97 -0
  165. package/dist/_pkgs/affine-model/elements/c4/node.js +130 -0
  166. package/dist/_pkgs/affine-model/elements/connector/connector.js +1 -1
  167. package/dist/_pkgs/affine-model/elements/context-map/context-map.d.ts +27 -0
  168. package/dist/_pkgs/affine-model/elements/context-map/context-map.js +94 -0
  169. package/dist/_pkgs/affine-model/elements/context-map/index.d.ts +1 -0
  170. package/dist/_pkgs/affine-model/elements/context-map/index.js +1 -0
  171. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +34 -17
  172. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +28 -26
  173. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +7 -2
  174. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +9 -4
  175. package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +7 -2
  176. package/dist/_pkgs/affine-model/elements/edgy/board.js +9 -4
  177. package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +20 -3
  178. package/dist/_pkgs/affine-model/elements/edgy/facets.js +13 -4
  179. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +7 -2
  180. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +9 -4
  181. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +36 -0
  182. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +103 -0
  183. package/dist/_pkgs/affine-model/elements/event-storming/index.d.ts +1 -0
  184. package/dist/_pkgs/affine-model/elements/event-storming/index.js +1 -0
  185. package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +7 -2
  186. package/dist/_pkgs/affine-model/elements/framework-background/background.js +9 -4
  187. package/dist/_pkgs/affine-model/elements/framework-background/hit-test.d.ts +48 -0
  188. package/dist/_pkgs/affine-model/elements/framework-background/hit-test.js +55 -0
  189. package/dist/_pkgs/affine-model/elements/framework-background/index.d.ts +1 -0
  190. package/dist/_pkgs/affine-model/elements/framework-background/index.js +1 -0
  191. package/dist/_pkgs/affine-model/elements/index.d.ts +11 -0
  192. package/dist/_pkgs/affine-model/elements/index.js +3 -0
  193. package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
  194. package/dist/_pkgs/affine-shared/adapters/html/block-adapter.js +1 -1
  195. package/dist/_pkgs/affine-shared/adapters/markdown/block-adapter.js +1 -1
  196. package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.js +1 -1
  197. package/dist/_pkgs/affine-shared/adapters/notion-html/block-adapter.js +1 -1
  198. package/dist/_pkgs/affine-shared/adapters/notion-html/delta-converter.js +1 -1
  199. package/dist/_pkgs/affine-shared/adapters/plain-text/block-adapter.js +1 -1
  200. package/dist/_pkgs/affine-shared/adapters/plain-text/delta-converter.js +1 -1
  201. package/dist/_pkgs/affine-shared/adapters/utils/color.js +5 -2
  202. package/dist/_pkgs/affine-shared/commands/model-crud/draft-selected-models.js +1 -1
  203. package/dist/_pkgs/affine-shared/commands/selection/focus-block-end.js +1 -1
  204. package/dist/_pkgs/affine-shared/commands/selection/focus-block-start.js +1 -1
  205. package/dist/_pkgs/affine-shared/consts/index.d.ts +10 -0
  206. package/dist/_pkgs/affine-shared/consts/index.js +10 -0
  207. package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.d.ts +55 -0
  208. package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.js +35 -0
  209. package/dist/_pkgs/affine-shared/services/audit-service.d.ts +11 -0
  210. package/dist/_pkgs/affine-shared/services/command-usage-service.d.ts +31 -0
  211. package/dist/_pkgs/affine-shared/services/command-usage-service.js +109 -0
  212. package/dist/_pkgs/affine-shared/services/comment-service/block-comment-manager.js +1 -1
  213. package/dist/_pkgs/affine-shared/services/doc-display-meta-service.js +1 -1
  214. package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +11 -0
  215. package/dist/_pkgs/affine-shared/services/edit-props-store.js +15 -0
  216. package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
  217. package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
  218. package/dist/_pkgs/affine-shared/services/index.js +2 -0
  219. package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +2 -1
  220. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +73 -1
  221. package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +32 -0
  222. package/dist/_pkgs/affine-shared/services/toolbar-service/action.js +16 -0
  223. package/dist/_pkgs/affine-shared/services/toolbar-service/flags.d.ts +10 -0
  224. package/dist/_pkgs/affine-shared/services/toolbar-service/flags.js +32 -1
  225. package/dist/_pkgs/affine-shared/services/toolbar-service/registry.d.ts +44 -0
  226. package/dist/_pkgs/affine-shared/services/toolbar-service/registry.js +161 -3
  227. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +106 -0
  228. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +201 -0
  229. package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +1 -0
  230. package/dist/_pkgs/affine-shared/services/translation-service/index.js +1 -0
  231. package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +5 -3
  232. package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
  233. package/dist/_pkgs/affine-shared/utils/edgeless.js +1 -1
  234. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +34 -0
  235. package/dist/_pkgs/affine-shared/utils/file/filesys.js +48 -7
  236. package/dist/_pkgs/affine-shared/utils/zod-schema.js +1 -3
  237. package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
  238. package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +1 -1
  239. package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +1 -1
  240. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.d.ts +14 -0
  241. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.js +40 -0
  242. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +158 -0
  243. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +572 -0
  244. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +41 -0
  245. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +49 -0
  246. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.d.ts +13 -0
  247. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.js +50 -0
  248. package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.d.ts +6 -0
  249. package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +15 -5
  250. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +2 -0
  251. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +2 -0
  252. package/dist/_pkgs/affine-widget-edgeless-toolbar/extension/index.d.ts +7 -0
  253. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
  254. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
  255. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +19 -0
  256. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +51 -10
  257. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
  258. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +2 -1
  259. package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
  260. package/dist/_pkgs/affine-widget-keyboard-toolbar/keyboard-tool-panel.js +1 -1
  261. package/dist/_pkgs/affine-widget-linked-doc/import-doc/import-doc.js +1 -1
  262. package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +1 -1
  263. package/dist/_pkgs/affine-widget-page-dragging-area/index.js +1 -1
  264. package/dist/_pkgs/affine-widget-remote-selection/doc/doc-remote-selection.js +1 -1
  265. package/dist/_pkgs/affine-widget-slash-menu/config.js +2 -1
  266. package/dist/_pkgs/affine-widget-toolbar/toolbar.js +11 -2
  267. package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +19 -2
  268. package/dist/_pkgs/affine-widget-toolbar/utils.js +28 -9
  269. package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
  270. package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
  271. package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +8 -12
  272. package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +52 -40
  273. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +3 -1
  274. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +3 -1
  275. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
  276. package/dist/_pkgs/std/clipboard/utils.js +4 -1
  277. package/dist/_pkgs/std/extension/command-registry.d.ts +195 -5
  278. package/dist/_pkgs/std/extension/command-registry.js +218 -4
  279. package/dist/_pkgs/std/extension/shortcut.js +2 -1
  280. package/dist/_pkgs/std/extension/translation-manifest.d.ts +46 -1
  281. package/dist/_pkgs/std/extension/translation-manifest.js +58 -0
  282. package/dist/_pkgs/std/gfx/grid.js +1 -1
  283. package/dist/_pkgs/std/gfx/highlight.d.ts +84 -0
  284. package/dist/_pkgs/std/gfx/highlight.js +112 -0
  285. package/dist/_pkgs/std/gfx/index.d.ts +2 -1
  286. package/dist/_pkgs/std/gfx/index.js +1 -0
  287. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +17 -3
  288. package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +160 -0
  289. package/dist/_pkgs/std/gfx/model/surface/element-model.js +75 -1
  290. package/dist/_pkgs/std/gfx/model/surface/role.js +5 -3
  291. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +2 -1
  292. package/dist/_pkgs/std/gfx/selection.js +1 -1
  293. package/dist/_pkgs/std/gfx/viewport.js +1 -1
  294. package/dist/_pkgs/std/inline/extensions/inline-manager.js +1 -1
  295. package/dist/_pkgs/std/inline/extensions/markdown-matcher.js +1 -1
  296. package/dist/_pkgs/std/scope/std-scope.d.ts +2 -1
  297. package/dist/_pkgs/std/scope/std-scope.js +2 -0
  298. package/dist/_pkgs/std/utils/gfx.js +2 -0
  299. package/dist/_pkgs/store/model/store/crud.js +4 -1
  300. package/dist/commands.js +1 -1
  301. package/dist/extensions/command-usage.d.ts +23 -0
  302. package/dist/extensions/command-usage.js +37 -0
  303. package/dist/extensions/view.js +12 -0
  304. package/dist/frameworks.js +32 -0
  305. package/dist/shortcuts.d.ts +20 -6
  306. package/dist/shortcuts.js +7 -9
  307. package/dist/translations.js +98 -3
  308. package/package.json +13 -1
@@ -0,0 +1,84 @@
1
+ import { Signal } from '@preact/signals-core';
2
+ import type { GfxController } from './controller.js';
3
+ import { GfxExtension } from './extension.js';
4
+ import type { GfxModel } from './model/model.js';
5
+ /**
6
+ * How long a highlight stays visible when no `duration` is given.
7
+ */
8
+ export declare const DEFAULT_HIGHLIGHT_DURATION = 2000;
9
+ /**
10
+ * Viewport padding used when `reframe` is requested without an explicit one.
11
+ * Expressed in percentage of the viewport (see `Viewport.setViewportByBound`).
12
+ */
13
+ export declare const DEFAULT_HIGHLIGHT_PADDING: [number, number, number, number];
14
+ export interface HighlightElementsOptions {
15
+ /**
16
+ * Reframe the viewport on the union of the target bounds before emphasizing
17
+ * them. Defaults to `false`, the highlight is then purely visual.
18
+ */
19
+ reframe?: boolean;
20
+ /**
21
+ * How long the emphasis stays visible, in milliseconds.
22
+ * Defaults to {@link DEFAULT_HIGHLIGHT_DURATION}.
23
+ * Pass `0` to keep it until the next `highlightElements` or `clear` call.
24
+ */
25
+ duration?: number;
26
+ /**
27
+ * Padding applied by the reframe, only used when `reframe` is `true`.
28
+ * Defaults to {@link DEFAULT_HIGHLIGHT_PADDING}.
29
+ */
30
+ padding?: [number, number, number, number];
31
+ /**
32
+ * Animate the reframe, only used when `reframe` is `true`. Defaults to `true`.
33
+ */
34
+ smooth?: boolean;
35
+ }
36
+ /**
37
+ * Transient, read-only emphasis on a set of graphic elements.
38
+ *
39
+ * The manager owns the state only: it never writes to the store and never
40
+ * touches the selection model, so it is safe on a read-only or non-interactive
41
+ * editor (an embedded preview window, for instance). The actual ring is drawn
42
+ * by a renderer subscribing to {@link ElementHighlightManager.highlighted$},
43
+ * which keeps this extension free of any rendering concern.
44
+ */
45
+ export declare class ElementHighlightManager extends GfxExtension {
46
+ static key: string;
47
+ private _timer;
48
+ /**
49
+ * Ids of the elements currently emphasized. Empty when nothing is
50
+ * highlighted. Only ids that resolved to an actual graphic element at call
51
+ * time are kept.
52
+ */
53
+ readonly highlighted$: Signal<readonly string[]>;
54
+ /**
55
+ * The models behind {@link highlighted$}, resolved on read so that elements
56
+ * deleted meanwhile simply drop out of the highlight.
57
+ */
58
+ get highlightedElements(): GfxModel[];
59
+ static extendGfx(gfx: GfxController): void;
60
+ private _clearTimer;
61
+ /**
62
+ * Drop the current emphasis immediately.
63
+ */
64
+ clear(): void;
65
+ /**
66
+ * Emphasize the given elements for a while.
67
+ *
68
+ * Unknown ids and non-graphic blocks are ignored; if none of the ids
69
+ * resolves, any running highlight is cleared and nothing else happens.
70
+ * Calling it again replaces the previous highlight and restarts the timer.
71
+ */
72
+ highlightElements(ids: string[], opts?: HighlightElementsOptions): void;
73
+ unmounted(): void;
74
+ }
75
+ declare module './controller.js' {
76
+ interface GfxController {
77
+ readonly highlight: ElementHighlightManager;
78
+ /**
79
+ * Transiently emphasize a set of elements without mutating the document
80
+ * nor the selection. Shorthand for `gfx.highlight.highlightElements`.
81
+ */
82
+ highlightElements(ids: string[], opts?: HighlightElementsOptions): void;
83
+ }
84
+ }
@@ -0,0 +1,112 @@
1
+ import { getCommonBoundWithRotation } from '../../global/gfx/index.js';
2
+ import { Signal } from '@preact/signals-core';
3
+ import { GfxExtension, GfxExtensionIdentifier } from './extension.js';
4
+ import { GfxBlockElementModel } from './model/gfx-block-model.js';
5
+ import { GfxPrimitiveElementModel } from './model/surface/element-model.js';
6
+ /**
7
+ * How long a highlight stays visible when no `duration` is given.
8
+ */
9
+ export const DEFAULT_HIGHLIGHT_DURATION = 2000;
10
+ /**
11
+ * Viewport padding used when `reframe` is requested without an explicit one.
12
+ * Expressed in percentage of the viewport (see `Viewport.setViewportByBound`).
13
+ */
14
+ export const DEFAULT_HIGHLIGHT_PADDING = [
15
+ 0.15, 0.15, 0.15, 0.15,
16
+ ];
17
+ /**
18
+ * Only models that live on the canvas can carry an emphasis ring.
19
+ * Anything else queried by id (plain blocks, unknown ids) is ignored.
20
+ */
21
+ function isRenderableGfxModel(model) {
22
+ return (model instanceof GfxPrimitiveElementModel ||
23
+ model instanceof GfxBlockElementModel);
24
+ }
25
+ /**
26
+ * Transient, read-only emphasis on a set of graphic elements.
27
+ *
28
+ * The manager owns the state only: it never writes to the store and never
29
+ * touches the selection model, so it is safe on a read-only or non-interactive
30
+ * editor (an embedded preview window, for instance). The actual ring is drawn
31
+ * by a renderer subscribing to {@link ElementHighlightManager.highlighted$},
32
+ * which keeps this extension free of any rendering concern.
33
+ */
34
+ export class ElementHighlightManager extends GfxExtension {
35
+ constructor() {
36
+ super(...arguments);
37
+ this._timer = null;
38
+ /**
39
+ * Ids of the elements currently emphasized. Empty when nothing is
40
+ * highlighted. Only ids that resolved to an actual graphic element at call
41
+ * time are kept.
42
+ */
43
+ this.highlighted$ = new Signal([]);
44
+ }
45
+ static { this.key = 'elementHighlight'; }
46
+ /**
47
+ * The models behind {@link highlighted$}, resolved on read so that elements
48
+ * deleted meanwhile simply drop out of the highlight.
49
+ */
50
+ get highlightedElements() {
51
+ return this.highlighted$.value
52
+ .map(id => this.gfx.getElementById(id))
53
+ .filter(isRenderableGfxModel);
54
+ }
55
+ static extendGfx(gfx) {
56
+ Object.defineProperty(gfx, 'highlight', {
57
+ get() {
58
+ return this.std.get(GfxExtensionIdentifier('elementHighlight'));
59
+ },
60
+ });
61
+ Object.defineProperty(gfx, 'highlightElements', {
62
+ value: (ids, opts) => gfx.highlight.highlightElements(ids, opts),
63
+ });
64
+ }
65
+ _clearTimer() {
66
+ if (this._timer !== null) {
67
+ clearTimeout(this._timer);
68
+ this._timer = null;
69
+ }
70
+ }
71
+ /**
72
+ * Drop the current emphasis immediately.
73
+ */
74
+ clear() {
75
+ this._clearTimer();
76
+ if (this.highlighted$.peek().length === 0)
77
+ return;
78
+ this.highlighted$.value = [];
79
+ }
80
+ /**
81
+ * Emphasize the given elements for a while.
82
+ *
83
+ * Unknown ids and non-graphic blocks are ignored; if none of the ids
84
+ * resolves, any running highlight is cleared and nothing else happens.
85
+ * Calling it again replaces the previous highlight and restarts the timer.
86
+ */
87
+ highlightElements(ids, opts = {}) {
88
+ this._clearTimer();
89
+ const elements = ids
90
+ .map(id => this.gfx.getElementById(id))
91
+ .filter(isRenderableGfxModel);
92
+ if (elements.length === 0) {
93
+ this.highlighted$.value = [];
94
+ return;
95
+ }
96
+ if (opts.reframe) {
97
+ this.gfx.viewport.setViewportByBound(getCommonBoundWithRotation(elements), opts.padding ?? DEFAULT_HIGHLIGHT_PADDING, opts.smooth ?? true);
98
+ }
99
+ this.highlighted$.value = elements.map(element => element.id);
100
+ const duration = opts.duration ?? DEFAULT_HIGHLIGHT_DURATION;
101
+ if (duration > 0) {
102
+ this._timer = setTimeout(() => {
103
+ this._timer = null;
104
+ this.clear();
105
+ }, duration);
106
+ }
107
+ }
108
+ unmounted() {
109
+ this._clearTimer();
110
+ this.highlighted$.value = [];
111
+ }
112
+ }
@@ -5,6 +5,7 @@ export { GfxController } from './controller.js';
5
5
  export type { CursorType, StandardCursor } from './cursor.js';
6
6
  export { GfxExtension, GfxExtensionIdentifier } from './extension.js';
7
7
  export { GridManager } from './grid.js';
8
+ export { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_HIGHLIGHT_PADDING, ElementHighlightManager, type HighlightElementsOptions, } from './highlight.js';
8
9
  export { GfxControllerIdentifier } from './identifiers.js';
9
10
  export type { BoxSelectionContext, DragEndContext, DragExtensionInitializeContext, DragInitializationOption, DragMoveContext, DragStartContext, ExtensionDragEndContext, ExtensionDragMoveContext, ExtensionDragStartContext, GfxInteractivityContext, GfxViewInteractionConfig, ResizeConstraint, ResizeEndContext, ResizeHandle, ResizeMoveContext, ResizeStartContext, RotateConstraint, RotateEndContext, RotateMoveContext, RotateStartContext, SelectContext, } from './interactivity/index.js';
10
11
  export { GfxViewEventManager, GfxViewInteractionExtension, InteractivityExtension, InteractivityIdentifier, InteractivityManager, } from './interactivity/index.js';
@@ -14,7 +15,7 @@ export { gfxGroupCompatibleSymbol, isGfxGroupCompatibleModel, } from './model/ba
14
15
  export { GfxBlockElementModel, type GfxCommonBlockProps, GfxCompatibleBlockModel as GfxCompatible, type GfxCompatibleProps, } from './model/gfx-block-model.js';
15
16
  export { type GfxModel, isPrimitiveModel } from './model/model.js';
16
17
  export { convert, convertProps, derive, field, getDerivedProps, getFieldPropsSet, getLocalPropsSet, initializeObservers, initializeWatchers, local, observe, updateDerivedProps, watch, } from './model/surface/decorators/index.js';
17
- export { type BaseElementProps, GfxGroupLikeElementModel, GfxPrimitiveElementModel, type SerializedElement, type ValidationException, } from './model/surface/element-model.js';
18
+ export { type BaseElementProps, type ForeignInterchange, type InterchangeScope, GfxGroupLikeElementModel, GfxPrimitiveElementModel, type SerializedElement, type ValidationException, } from './model/surface/element-model.js';
18
19
  export { GfxLocalElementModel, prop, } from './model/surface/local-element-model.js';
19
20
  export { collectPivotOccurrences, isPivotBound, type PivotBoundElement, type PivotOccurrence, } from './model/surface/pivot.js';
20
21
  export { type EdgeDirectionDef, findRoleDef, isTypedEdgeRole, type RoleDef, type RoleDefs, type RoleId, roleIsA, type RoleKind, RoleVocabularyExtension, RoleVocabularyIdentifier, } from './model/surface/role.js';
@@ -4,6 +4,7 @@ export { batchAddChildren, batchRemoveChildren, canSafeAddToContainer, descendan
4
4
  export { GfxController } from './controller.js';
5
5
  export { GfxExtension, GfxExtensionIdentifier } from './extension.js';
6
6
  export { GridManager } from './grid.js';
7
+ export { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_HIGHLIGHT_PADDING, ElementHighlightManager, } from './highlight.js';
7
8
  export { GfxControllerIdentifier } from './identifiers.js';
8
9
  export { GfxViewEventManager, GfxViewInteractionExtension, InteractivityExtension, InteractivityIdentifier, InteractivityManager, } from './interactivity/index.js';
9
10
  export { LayerManager } from './layer.js';
@@ -51,15 +51,29 @@ export class GfxViewEventManager {
51
51
  filter: ['canvas', 'local'],
52
52
  })
53
53
  .reduce((pre, model) => {
54
- if (model.includesPoint(x, y, {
54
+ const view = this.gfx.view.get(model);
55
+ if (!view)
56
+ return pre;
57
+ // The VIEW's hit test, not the model's.
58
+ //
59
+ // `GfxElementModelView.includesPoint` delegates to the model by
60
+ // default, so for every view that does not override it this is the
61
+ // same answer as before. It is the seam a framework needs when the
62
+ // area that SELECTS an element and the area that its own gestures
63
+ // answer on are not the same rectangle: a framework background is
64
+ // picked by its border alone (issue #194), yet its editable labels
65
+ // must keep receiving the double-click that renames them, and a BPMN
66
+ // pool's lane separators must keep receiving the drag that moves them.
67
+ // Those zones are drawn by the framework's view, so that is where they
68
+ // are declared — the model layer stays free of geometry it cannot see.
69
+ if (view.includesPoint(x, y, {
55
70
  hitThreshold: 10,
56
71
  responsePadding: [5, 5],
57
72
  }, this.gfx.std.host) ||
58
73
  ('externalBound' in model
59
74
  ? model.externalBound?.isPointInBound([x, y])
60
75
  : false)) {
61
- const view = this.gfx.view.get(model);
62
- view && pre.push(view);
76
+ pre.push(view);
63
77
  }
64
78
  return pre;
65
79
  }, [])
@@ -34,6 +34,100 @@ export type ValidationException = {
34
34
  /** Epoch ms, taken at the moment of the gesture. */
35
35
  at: number;
36
36
  };
37
+ /**
38
+ * A SCOPE: which part of the source document a carried fragment came off.
39
+ *
40
+ * One Labre element routinely stands for several source elements — a BPMN pool
41
+ * is a `participant` AND its `process`, plus a `laneSet`, every `lane`, the
42
+ * `BPMNShape` that draws it, and (for the first pool of a document) the
43
+ * `collaboration` and `definitions` themselves. Everything they carry lands in
44
+ * ONE payload, so an unscoped `Record<name, value>` has two defects, and the
45
+ * first one destroys data: two lanes carrying the same foreign attribute
46
+ * overwrite each other silently, and nothing records which element an attribute
47
+ * belonged to, so no exporter can ever put it back where it came from.
48
+ *
49
+ * A scope is therefore either of exactly two things, and they cannot collide:
50
+ *
51
+ * - **the source element's id, verbatim** — the normal case, and the one that
52
+ * lets an exporter put a fragment back on the element that had it;
53
+ * - **an `@`-prefixed ROLE key** for a source element with no id of its own, or
54
+ * one whose identity is its relation to this element rather than a name:
55
+ * `@self` (the element this payload is on), `@shape` (the diagram element
56
+ * that draws it), and whatever else the format needs. **`@` is not an XML
57
+ * NameStartChar**, so a role key can never be mistaken for an id, whatever a
58
+ * file calls its elements.
59
+ *
60
+ * The role vocabulary past `@self` and `@shape` belongs to each format's
61
+ * importer, which is the only thing that knows what parts a document has;
62
+ * `.bpmn`'s is documented in `gfx/bpmn/src/import.ts`. The base model stores
63
+ * strings and never learns what any of them mean.
64
+ */
65
+ export type InterchangeScope = string;
66
+ /**
67
+ * Verbatim foreign matter one interchange import kept on one element, for one
68
+ * format (ADR 0012 § D2).
69
+ *
70
+ * Document DATA in the same sense {@link ValidationException} is: it records
71
+ * what a file actually said, so it outlives the tab, the framework flag and the
72
+ * client version that imported it. Deliberately format-agnostic — the base
73
+ * model stores fragments and attributes, and never learns what they mean.
74
+ *
75
+ * Every member is optional and absent rather than empty: an importer writes the
76
+ * ones it has, and a reader that finds none of them has an element that met an
77
+ * import and carried nothing.
78
+ *
79
+ * The three carrying members are keyed by {@link InterchangeScope}, so that
80
+ * what came off two different source elements stays apart. That shape is what
81
+ * makes the payload sufficient for re-emission, and it is the one thing here
82
+ * that could not be changed later: this value is persisted, so a document
83
+ * written under a shape that loses data cannot be repaired without the original
84
+ * file. One `Y.Map` entry all the same — the whole record is written once, as a
85
+ * blob, and never mutated.
86
+ */
87
+ export type ForeignInterchange = {
88
+ /**
89
+ * The element's id in the SOURCE file, verbatim. The surface element keeps
90
+ * its own nanoid — surface identity is Labre's and never the file's — and an
91
+ * export prefers this id back when it is still usable, which is what makes
92
+ * the id map a fixed point after one cycle (ADR 0012 § D3).
93
+ */
94
+ id?: string;
95
+ /**
96
+ * The source element's name, when the element itself was CARRIED rather than
97
+ * mapped, e.g. `bpmn:boundaryEvent`.
98
+ */
99
+ element?: string;
100
+ /**
101
+ * Attributes the importer does not model — foreign-namespaced and standard
102
+ * alike — by {@link InterchangeScope}, then by attribute name.
103
+ *
104
+ * `{ 'Lane_1': { 'camunda:owner': 'alice' }, 'Lane_2': { 'camunda:owner':
105
+ * 'bob' } }`: two lanes of one pool, two owners, and both still here.
106
+ */
107
+ attrs?: Record<InterchangeScope, Record<string, string>>;
108
+ /**
109
+ * Child fragments, serialized — extension subtrees, unmodelled children, and
110
+ * whole carried elements — by the {@link InterchangeScope} of the element
111
+ * they were children OF. The scope is where an exporter has to put them back.
112
+ */
113
+ children?: Record<InterchangeScope, string[]>;
114
+ /**
115
+ * Diagram-interchange fragments, by the {@link InterchangeScope} of what they
116
+ * draw: `@shape` for the parts of this element's own diagram element that the
117
+ * importer did not model, a source id for the diagram of something carried.
118
+ */
119
+ di?: Record<InterchangeScope, string[]>;
120
+ /**
121
+ * Fragments kept but deliberately NOT re-emitted, each with the reason
122
+ * (ADR 0012 § D5). Preserved so a reader can see what was dropped and why;
123
+ * never a place the exporter reads for output — which is why this one is a
124
+ * flat list and needs no scope: nothing has to know where to put it back.
125
+ */
126
+ quarantined?: {
127
+ fragment: string;
128
+ reason: string;
129
+ }[];
130
+ };
37
131
  export type SerializedElement = Record<string, unknown> & {
38
132
  type: string;
39
133
  xywh: SerializedXYWH;
@@ -351,6 +445,72 @@ export declare abstract class GfxPrimitiveElementModel<Props extends BaseElement
351
445
  * not pruned: the tooling comes and goes with a flag, the decision does not.
352
446
  */
353
447
  accessor qualityChecklist: string[] | undefined;
448
+ /**
449
+ * Verbatim foreign matter from an interchange import, keyed by FORMAT id
450
+ * (`bpmn`, `owm`, …) — never by framework, because a `.bpmn` and an OWM file
451
+ * make different promises about the same element (ADR 0012 § D2).
452
+ *
453
+ * This field is dumb storage, and that is the whole design. ADR 0012 sorts
454
+ * every node of an imported file into three states — **mapped** (there is a
455
+ * Labre artefact, re-emitted from the drawing), **carried** (no artefact,
456
+ * kept verbatim here, re-emitted in place) and **quarantined** (kept, but
457
+ * re-emitting it would contradict the document, so it is not). That contract
458
+ * lives entirely in the importers and exporters; the base model neither
459
+ * classifies, validates, dereferences nor re-emits anything, and knows no
460
+ * format. No renderer, hit-test, layout or `@derive` / `@convert` chain reads
461
+ * it, so nothing here can move, resize or restyle an element.
462
+ *
463
+ * Declared on the BASE class for the same reason as {@link role} and
464
+ * {@link validationExceptions}, and for one more: a BPMN `sequenceFlow`
465
+ * carrying a `conditionExpression` is a plain **connector**, and
466
+ * `ConnectorElementModel` is shared plumbing that will never be a BPMN class.
467
+ * An element re-created from props (paste, duplicate, alt-drag clone,
468
+ * template insertion) only reaches the Y.Map through keys that have a
469
+ * declared accessor, so a payload declared per subclass would be silently
470
+ * dropped on copy — the exact loss `docs/spikes/us-1-8-unknown-props-preservation.md`
471
+ * exists to prevent. Declaring it, rather than leaning on that spike's
472
+ * verbatim fallback for undeclared keys, is what makes it a contract: a field
473
+ * nothing declares is a field nothing can test, strip or find.
474
+ *
475
+ * `undefined` = this element never met an import, and no key is written for
476
+ * it, so it stays byte-identical to one created before the field existed:
477
+ * optional field, no schema version bump, no migration. An import writes no
478
+ * key for a visual-tier capability, and none for an element that carried
479
+ * nothing. Clearing goes through {@link clearField}, which removes the key
480
+ * rather than leaving a tombstone.
481
+ *
482
+ * Flat JSON on purpose — a value a Yjs update can encode is the contract
483
+ * enforced by `_assignElementProp`, and the whole payload is ONE Y.Map entry,
484
+ * written once at import and never mutated afterwards. Two peers writing it
485
+ * concurrently therefore resolve last-write-wins on the whole blob, which is
486
+ * `lanes`' trade (ADR 0007): nobody edits this value, so the window is the
487
+ * import itself.
488
+ *
489
+ * ## Writing it, for the importer
490
+ *
491
+ * - **Write the whole blob in one assignment**, the way an import already
492
+ * produces it. Never read-modify-write it key by key: the Y.Map entry is the
493
+ * entire `Record`, so a partial update is still a last-write-wins overwrite
494
+ * of everything, and two of them racing lose a whole format's payload rather
495
+ * than merging.
496
+ * - **Key what you carry by its {@link InterchangeScope}.** One Labre element
497
+ * stands for several source elements, and an unscoped map lets what came off
498
+ * one overwrite what came off another — a silent loss, into a persisted
499
+ * value, of exactly the data this field exists to keep. The scope is also
500
+ * the only record of where a fragment has to be put back.
501
+ * - **Write no key at all** when there is nothing to carry — an element the
502
+ * import mapped cleanly, or any visual-tier capability, which by contract
503
+ * writes none (ADR 0012 P2). Absent and empty are NOT equivalent here:
504
+ * `{}` costs every element a Y.Map entry and makes P2's "writes no
505
+ * `interchange` key" untestable.
506
+ * - **Removing it is {@link clearField}**, never an assignment to `undefined`
507
+ * — the former deletes the key, the latter can leave a tombstone.
508
+ * - **Nothing caps the size of this value** (ADR 0012, open question 3). A
509
+ * pathological file would produce a document that is mostly foreign matter;
510
+ * a cap that dropped data would contradict D2, so the only honest cap is a
511
+ * refusal at import time. That is the importer's call, not the model's.
512
+ */
513
+ accessor interchange: Record<string, ForeignInterchange> | undefined;
354
514
  accessor lockedBySelf: boolean | undefined;
355
515
  accessor opacity: number;
356
516
  accessor responseExtension: [number, number];
@@ -127,6 +127,9 @@ let GfxPrimitiveElementModel = (() => {
127
127
  let _qualityChecklist_decorators;
128
128
  let _qualityChecklist_initializers = [];
129
129
  let _qualityChecklist_extraInitializers = [];
130
+ let _interchange_decorators;
131
+ let _interchange_initializers = [];
132
+ let _interchange_extraInitializers = [];
130
133
  let _lockedBySelf_decorators;
131
134
  let _lockedBySelf_initializers = [];
132
135
  let _lockedBySelf_extraInitializers = [];
@@ -156,6 +159,7 @@ let GfxPrimitiveElementModel = (() => {
156
159
  _validationExceptions_decorators = [field()];
157
160
  _validationProfile_decorators = [field()];
158
161
  _qualityChecklist_decorators = [field()];
162
+ _interchange_decorators = [field()];
159
163
  _lockedBySelf_decorators = [field()];
160
164
  _opacity_decorators = [local()];
161
165
  _responseExtension_decorators = [local()];
@@ -172,6 +176,7 @@ let GfxPrimitiveElementModel = (() => {
172
176
  __esDecorate(this, null, _validationExceptions_decorators, { kind: "accessor", name: "validationExceptions", static: false, private: false, access: { has: obj => "validationExceptions" in obj, get: obj => obj.validationExceptions, set: (obj, value) => { obj.validationExceptions = value; } }, metadata: _metadata }, _validationExceptions_initializers, _validationExceptions_extraInitializers);
173
177
  __esDecorate(this, null, _validationProfile_decorators, { kind: "accessor", name: "validationProfile", static: false, private: false, access: { has: obj => "validationProfile" in obj, get: obj => obj.validationProfile, set: (obj, value) => { obj.validationProfile = value; } }, metadata: _metadata }, _validationProfile_initializers, _validationProfile_extraInitializers);
174
178
  __esDecorate(this, null, _qualityChecklist_decorators, { kind: "accessor", name: "qualityChecklist", static: false, private: false, access: { has: obj => "qualityChecklist" in obj, get: obj => obj.qualityChecklist, set: (obj, value) => { obj.qualityChecklist = value; } }, metadata: _metadata }, _qualityChecklist_initializers, _qualityChecklist_extraInitializers);
179
+ __esDecorate(this, null, _interchange_decorators, { kind: "accessor", name: "interchange", static: false, private: false, access: { has: obj => "interchange" in obj, get: obj => obj.interchange, set: (obj, value) => { obj.interchange = value; } }, metadata: _metadata }, _interchange_initializers, _interchange_extraInitializers);
175
180
  __esDecorate(this, null, _lockedBySelf_decorators, { kind: "accessor", name: "lockedBySelf", static: false, private: false, access: { has: obj => "lockedBySelf" in obj, get: obj => obj.lockedBySelf, set: (obj, value) => { obj.lockedBySelf = value; } }, metadata: _metadata }, _lockedBySelf_initializers, _lockedBySelf_extraInitializers);
176
181
  __esDecorate(this, null, _opacity_decorators, { kind: "accessor", name: "opacity", static: false, private: false, access: { has: obj => "opacity" in obj, get: obj => obj.opacity, set: (obj, value) => { obj.opacity = value; } }, metadata: _metadata }, _opacity_initializers, _opacity_extraInitializers);
177
182
  __esDecorate(this, null, _responseExtension_decorators, { kind: "accessor", name: "responseExtension", static: false, private: false, access: { has: obj => "responseExtension" in obj, get: obj => obj.responseExtension, set: (obj, value) => { obj.responseExtension = value; } }, metadata: _metadata }, _responseExtension_initializers, _responseExtension_extraInitializers);
@@ -260,7 +265,8 @@ let GfxPrimitiveElementModel = (() => {
260
265
  this.#validationExceptions_accessor_storage = (__runInitializers(this, _tags_extraInitializers), __runInitializers(this, _validationExceptions_initializers, undefined));
261
266
  this.#validationProfile_accessor_storage = (__runInitializers(this, _validationExceptions_extraInitializers), __runInitializers(this, _validationProfile_initializers, undefined));
262
267
  this.#qualityChecklist_accessor_storage = (__runInitializers(this, _validationProfile_extraInitializers), __runInitializers(this, _qualityChecklist_initializers, undefined));
263
- this.#lockedBySelf_accessor_storage = (__runInitializers(this, _qualityChecklist_extraInitializers), __runInitializers(this, _lockedBySelf_initializers, false));
268
+ this.#interchange_accessor_storage = (__runInitializers(this, _qualityChecklist_extraInitializers), __runInitializers(this, _interchange_initializers, undefined));
269
+ this.#lockedBySelf_accessor_storage = (__runInitializers(this, _interchange_extraInitializers), __runInitializers(this, _lockedBySelf_initializers, false));
264
270
  this.#opacity_accessor_storage = (__runInitializers(this, _lockedBySelf_extraInitializers), __runInitializers(this, _opacity_initializers, 1));
265
271
  this.#responseExtension_accessor_storage = (__runInitializers(this, _opacity_extraInitializers), __runInitializers(this, _responseExtension_initializers, [0, 0]));
266
272
  this.#seed_accessor_storage = (__runInitializers(this, _responseExtension_extraInitializers), __runInitializers(this, _seed_initializers, void 0));
@@ -663,6 +669,74 @@ let GfxPrimitiveElementModel = (() => {
663
669
  */
664
670
  get qualityChecklist() { return this.#qualityChecklist_accessor_storage; }
665
671
  set qualityChecklist(value) { this.#qualityChecklist_accessor_storage = value; }
672
+ #interchange_accessor_storage;
673
+ /**
674
+ * Verbatim foreign matter from an interchange import, keyed by FORMAT id
675
+ * (`bpmn`, `owm`, …) — never by framework, because a `.bpmn` and an OWM file
676
+ * make different promises about the same element (ADR 0012 § D2).
677
+ *
678
+ * This field is dumb storage, and that is the whole design. ADR 0012 sorts
679
+ * every node of an imported file into three states — **mapped** (there is a
680
+ * Labre artefact, re-emitted from the drawing), **carried** (no artefact,
681
+ * kept verbatim here, re-emitted in place) and **quarantined** (kept, but
682
+ * re-emitting it would contradict the document, so it is not). That contract
683
+ * lives entirely in the importers and exporters; the base model neither
684
+ * classifies, validates, dereferences nor re-emits anything, and knows no
685
+ * format. No renderer, hit-test, layout or `@derive` / `@convert` chain reads
686
+ * it, so nothing here can move, resize or restyle an element.
687
+ *
688
+ * Declared on the BASE class for the same reason as {@link role} and
689
+ * {@link validationExceptions}, and for one more: a BPMN `sequenceFlow`
690
+ * carrying a `conditionExpression` is a plain **connector**, and
691
+ * `ConnectorElementModel` is shared plumbing that will never be a BPMN class.
692
+ * An element re-created from props (paste, duplicate, alt-drag clone,
693
+ * template insertion) only reaches the Y.Map through keys that have a
694
+ * declared accessor, so a payload declared per subclass would be silently
695
+ * dropped on copy — the exact loss `docs/spikes/us-1-8-unknown-props-preservation.md`
696
+ * exists to prevent. Declaring it, rather than leaning on that spike's
697
+ * verbatim fallback for undeclared keys, is what makes it a contract: a field
698
+ * nothing declares is a field nothing can test, strip or find.
699
+ *
700
+ * `undefined` = this element never met an import, and no key is written for
701
+ * it, so it stays byte-identical to one created before the field existed:
702
+ * optional field, no schema version bump, no migration. An import writes no
703
+ * key for a visual-tier capability, and none for an element that carried
704
+ * nothing. Clearing goes through {@link clearField}, which removes the key
705
+ * rather than leaving a tombstone.
706
+ *
707
+ * Flat JSON on purpose — a value a Yjs update can encode is the contract
708
+ * enforced by `_assignElementProp`, and the whole payload is ONE Y.Map entry,
709
+ * written once at import and never mutated afterwards. Two peers writing it
710
+ * concurrently therefore resolve last-write-wins on the whole blob, which is
711
+ * `lanes`' trade (ADR 0007): nobody edits this value, so the window is the
712
+ * import itself.
713
+ *
714
+ * ## Writing it, for the importer
715
+ *
716
+ * - **Write the whole blob in one assignment**, the way an import already
717
+ * produces it. Never read-modify-write it key by key: the Y.Map entry is the
718
+ * entire `Record`, so a partial update is still a last-write-wins overwrite
719
+ * of everything, and two of them racing lose a whole format's payload rather
720
+ * than merging.
721
+ * - **Key what you carry by its {@link InterchangeScope}.** One Labre element
722
+ * stands for several source elements, and an unscoped map lets what came off
723
+ * one overwrite what came off another — a silent loss, into a persisted
724
+ * value, of exactly the data this field exists to keep. The scope is also
725
+ * the only record of where a fragment has to be put back.
726
+ * - **Write no key at all** when there is nothing to carry — an element the
727
+ * import mapped cleanly, or any visual-tier capability, which by contract
728
+ * writes none (ADR 0012 P2). Absent and empty are NOT equivalent here:
729
+ * `{}` costs every element a Y.Map entry and makes P2's "writes no
730
+ * `interchange` key" untestable.
731
+ * - **Removing it is {@link clearField}**, never an assignment to `undefined`
732
+ * — the former deletes the key, the latter can leave a tombstone.
733
+ * - **Nothing caps the size of this value** (ADR 0012, open question 3). A
734
+ * pathological file would produce a document that is mostly foreign matter;
735
+ * a cap that dropped data would contradict D2, so the only honest cap is a
736
+ * refusal at import time. That is the importer's call, not the model's.
737
+ */
738
+ get interchange() { return this.#interchange_accessor_storage; }
739
+ set interchange(value) { this.#interchange_accessor_storage = value; }
666
740
  #lockedBySelf_accessor_storage;
667
741
  get lockedBySelf() { return this.#lockedBySelf_accessor_storage; }
668
742
  set lockedBySelf(value) { this.#lockedBySelf_accessor_storage = value; }
@@ -20,9 +20,11 @@
20
20
  */
21
21
  import { createIdentifier } from '../../../../global/di/index.js';
22
22
  /**
23
- * Deepest specialisation chain {@link roleIsA} walks. Real vocabularies are
24
- * one or two levels deep; the bound exists so a malformed `parent` cycle
25
- * cannot hang the caller. Chains longer than this are NOT supported.
23
+ * Deepest specialisation chain {@link roleIsA} walks. Real vocabularies run two
24
+ * or three levels deep — BPMN's descriptive profile is three on two branches
25
+ * (`bpmn:message-start-event` → `bpmn:start-event` → `bpmn:event`) — and the
26
+ * bound is far above them, so that a malformed `parent` cycle cannot hang the
27
+ * caller. Chains longer than this are NOT supported.
26
28
  */
27
29
  const MAX_ROLE_DEPTH = 32;
28
30
  /**
@@ -67,7 +67,8 @@ const UNSAFE_ELEMENT_PROP_KEYS = new Set([
67
67
  * (data descriptor, no setter) and a getter-only accessor both answer `false`.
68
68
  */
69
69
  function isDeclaredElementProp(element, key) {
70
- if (getFieldPropsSet(element).has(key) || getLocalPropsSet(element).has(key)) {
70
+ if (getFieldPropsSet(element).has(key) ||
71
+ getLocalPropsSet(element).has(key)) {
71
72
  return true;
72
73
  }
73
74
  for (let proto = Object.getPrototypeOf(element); proto !== null; proto = Object.getPrototypeOf(proto)) {
@@ -1,5 +1,5 @@
1
1
  import { DisposableGroup } from '../../global/disposable/index.js';
2
- import { getCommonBoundWithRotation, } from '../../global/gfx/index.js';
2
+ import { getCommonBoundWithRotation } from '../../global/gfx/index.js';
3
3
  import { assertType } from '../../global/utils/index.js';
4
4
  import groupBy from 'lodash-es/groupBy.js';
5
5
  import { Subject } from 'rxjs';
@@ -1,4 +1,4 @@
1
- import { Bound, clamp, Vec, } from '../../global/gfx/index.js';
1
+ import { Bound, clamp, Vec } from '../../global/gfx/index.js';
2
2
  import debounce from 'lodash-es/debounce.js';
3
3
  import { BehaviorSubject, debounceTime, Subject } from 'rxjs';
4
4
  function cutoff(value, ref, sign) {
@@ -1,4 +1,4 @@
1
- import { createIdentifier, } from '../../../global/di/index.js';
1
+ import { createIdentifier } from '../../../global/di/index.js';
2
2
  import { baseTextAttributes, } from '../../../store/index.js';
3
3
  import { z } from 'zod';
4
4
  import { StdIdentifier } from '../../identifier.js';
@@ -1,4 +1,4 @@
1
- import { createIdentifier, } from '../../../global/di/index.js';
1
+ import { createIdentifier } from '../../../global/di/index.js';
2
2
  export const MarkdownMatcherIdentifier = createIdentifier('AffineMarkdownMatcher');
3
3
  export function InlineMarkdownExtension(matcher) {
4
4
  const identifier = MarkdownMatcherIdentifier(matcher.name);
@@ -5,6 +5,7 @@ import { CommandManager } from '../command/index.js';
5
5
  import { UIEventDispatcher } from '../event/index.js';
6
6
  import { DndController } from '../extension/dnd/index.js';
7
7
  import { ServiceManager } from '../extension/service-manager.js';
8
+ import { ElementHighlightManager } from '../gfx/highlight.js';
8
9
  import { GridManager, LayerManager } from '../gfx/index.js';
9
10
  import { GfxSelectionManager } from '../gfx/selection.js';
10
11
  import { SurfaceMiddlewareExtension } from '../gfx/surface-middleware.js';
@@ -17,7 +18,7 @@ export interface BlockStdOptions {
17
18
  extensions: ExtensionType[];
18
19
  }
19
20
  export declare class BlockStdScope {
20
- static internalExtensions: (typeof ViewStore | typeof UIEventDispatcher | typeof RangeManager | typeof CommandManager | typeof GridManager | typeof LayerManager | typeof ServiceManager | typeof GfxSelectionManager | typeof SurfaceMiddlewareExtension | typeof ViewManager)[];
21
+ static internalExtensions: (typeof ViewStore | typeof UIEventDispatcher | typeof RangeManager | typeof CommandManager | typeof GridManager | typeof LayerManager | typeof ServiceManager | typeof ElementHighlightManager | typeof GfxSelectionManager | typeof SurfaceMiddlewareExtension | typeof ViewManager)[];
21
22
  readonly container: Container;
22
23
  readonly store: Store;
23
24
  readonly provider: ServiceProvider;
@@ -8,6 +8,7 @@ import { DndController } from '../extension/dnd/index.js';
8
8
  import { EditorLifeCycleExtension } from '../extension/editor-life-cycle.js';
9
9
  import { ServiceManager } from '../extension/service-manager.js';
10
10
  import { GfxController } from '../gfx/controller.js';
11
+ import { ElementHighlightManager } from '../gfx/highlight.js';
11
12
  import { GridManager, LayerManager } from '../gfx/index.js';
12
13
  import { GfxSelectionManager } from '../gfx/selection.js';
13
14
  import { SurfaceMiddlewareExtension } from '../gfx/surface-middleware.js';
@@ -25,6 +26,7 @@ const internalExtensions = [
25
26
  Clipboard,
26
27
  GfxController,
27
28
  GfxSelectionManager,
29
+ ElementHighlightManager,
28
30
  GridManager,
29
31
  LayerManager,
30
32
  SurfaceMiddlewareExtension,
@@ -1,5 +1,7 @@
1
1
  import { effect } from '@preact/signals-core';
2
2
  import { SurfaceBlockModel } from '../gfx/model/surface/surface-model.js';
3
+ // The explicit return type keeps declaration emit off signals-core's
4
+ // `DisposeFn`, whose `[Symbol.dispose]` member tsc cannot serialize.
3
5
  export function onSurfaceAdded(doc, callback) {
4
6
  let found = false;
5
7
  let foundId = '';