@formicoidea/labre-core 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/_pkgs/affine-block-attachment/attachment-block.js +1 -1
  2. package/dist/_pkgs/affine-block-callout/callout-block.js +1 -1
  3. package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
  4. package/dist/_pkgs/affine-block-code/code-toolbar/config.js +3 -1
  5. package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
  6. package/dist/_pkgs/affine-block-database/data-source.js +1 -2
  7. package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
  8. package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +1 -1
  9. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +1 -1
  10. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
  11. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +2 -2
  12. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +1 -1
  13. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/utils.js +1 -1
  14. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +1 -1
  15. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +1 -1
  16. package/dist/_pkgs/affine-block-frame/frame-manager.js +3 -1
  17. package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
  18. package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
  19. package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -1
  20. package/dist/_pkgs/affine-block-list/utils/forward-delete.js +1 -1
  21. package/dist/_pkgs/affine-block-note/commands/select-block.js +1 -1
  22. package/dist/_pkgs/affine-block-note/commands/select-blocks-between.js +1 -1
  23. package/dist/_pkgs/affine-block-note/move-block.js +1 -1
  24. package/dist/_pkgs/affine-block-paragraph/utils/forward-delete.js +2 -2
  25. package/dist/_pkgs/affine-block-paragraph/utils/merge-with-prev.js +1 -1
  26. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +1 -1
  27. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +1 -1
  28. package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
  29. package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.js +1 -1
  30. package/dist/_pkgs/affine-block-surface/adapters/plain-text/element-adapter/type.js +1 -1
  31. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +18 -3
  32. package/dist/_pkgs/affine-block-surface/element-model/index.js +12 -2
  33. package/dist/_pkgs/affine-block-surface/extensions/audit.js +23 -6
  34. package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +10 -5
  35. package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +2 -1
  36. package/dist/_pkgs/affine-block-surface/extensions/element-renderer.js +1 -1
  37. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +1 -1
  38. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
  39. package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
  40. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +172 -0
  41. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +393 -0
  42. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +306 -0
  43. package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
  44. package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +61 -61
  45. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.d.ts +248 -0
  46. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +248 -0
  47. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +78 -80
  48. package/dist/_pkgs/affine-block-surface/extensions/reading.js +2 -2
  49. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +107 -0
  50. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +958 -0
  51. package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +809 -20
  52. package/dist/_pkgs/affine-block-surface/extensions/validation.js +1661 -50
  53. package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +50 -6
  54. package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +129 -32
  55. package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +289 -0
  56. package/dist/_pkgs/affine-block-surface/framework-background/def.js +126 -1
  57. package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +42 -2
  58. package/dist/_pkgs/affine-block-surface/framework-background/labels.js +80 -4
  59. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +172 -11
  60. package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
  61. package/dist/_pkgs/affine-block-surface-ref/portal/note.js +2 -2
  62. package/dist/_pkgs/affine-block-table/commands.js +1 -1
  63. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +1 -1
  64. package/dist/_pkgs/affine-components/embed-card-modal/embed-card-edit-modal.js +1 -1
  65. package/dist/_pkgs/affine-components/filterable-list/styles.js +1 -1
  66. package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
  67. package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -0
  68. package/dist/_pkgs/affine-components/toolbar/index.js +1 -0
  69. package/dist/_pkgs/affine-components/toolbar/menu-button.js +1 -1
  70. package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +55 -0
  71. package/dist/_pkgs/affine-components/toolbar/picker-menu.js +47 -0
  72. package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +2 -2
  73. package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +2 -2
  74. package/dist/_pkgs/affine-fragment-frame-panel/header/frames-setting-menu.js +1 -1
  75. package/dist/_pkgs/affine-fragment-outline/mobile-outline-panel.js +1 -1
  76. package/dist/_pkgs/affine-gfx-brush/toolbar/components/pen/pen-tool-button.js +1 -1
  77. package/dist/_pkgs/affine-gfx-connector/connector-manager.js +7 -10
  78. package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +19 -1
  79. package/dist/_pkgs/affine-gfx-connector/connector-tool.js +10 -2
  80. package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
  81. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +2 -1
  82. package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +1 -3
  83. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +1 -1
  84. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +1 -1
  85. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
  86. package/dist/_pkgs/affine-gfx-mindmap/adapter/markdown/index.js +1 -1
  87. package/dist/_pkgs/affine-gfx-mindmap/adapter/utils.js +1 -1
  88. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +583 -4
  89. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +23 -23
  90. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +5 -1
  91. package/dist/_pkgs/affine-gfx-mindmap/view/utils.js +1 -1
  92. package/dist/_pkgs/affine-gfx-note/overlay/overlay.js +1 -1
  93. package/dist/_pkgs/affine-gfx-note/toolbar/note-senior-button.js +1 -1
  94. package/dist/_pkgs/affine-gfx-shape/consts.js +1 -1
  95. package/dist/_pkgs/affine-gfx-shape/draggable/shape-draggable.js +1 -1
  96. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/polygon.js +17 -9
  97. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/utils.js +8 -3
  98. package/dist/_pkgs/affine-gfx-shape/element-view.js +19 -12
  99. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +1 -1
  100. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-vertex-editing-overlay.js +12 -7
  101. package/dist/_pkgs/affine-gfx-shape/overlay/shape-overlay.js +1 -1
  102. package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +4 -2
  103. package/dist/_pkgs/affine-gfx-shape/shape-tool.js +1 -1
  104. package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +1 -3
  105. package/dist/_pkgs/affine-gfx-template/builtin/other.js +66 -17
  106. package/dist/_pkgs/affine-gfx-template/toolbar/overlay-scrollbar.js +1 -1
  107. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +1 -1
  108. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +1 -1
  109. package/dist/_pkgs/affine-inline-link/command.js +1 -1
  110. package/dist/_pkgs/affine-inline-preset/command/format-block.js +1 -1
  111. package/dist/_pkgs/affine-inline-preset/command/format-native.js +2 -2
  112. package/dist/_pkgs/affine-inline-preset/command/format-text.js +1 -1
  113. package/dist/_pkgs/affine-inline-preset/inline-spec.js +1 -1
  114. package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
  115. package/dist/_pkgs/affine-model/elements/bpmn/node.d.ts +40 -7
  116. package/dist/_pkgs/affine-model/elements/bpmn/node.js +4 -2
  117. package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +74 -17
  118. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +55 -26
  119. package/dist/_pkgs/affine-model/elements/c4/board.d.ts +88 -0
  120. package/dist/_pkgs/affine-model/elements/c4/board.js +128 -0
  121. package/dist/_pkgs/affine-model/elements/c4/boundary.d.ts +63 -0
  122. package/dist/_pkgs/affine-model/elements/c4/boundary.js +134 -0
  123. package/dist/_pkgs/affine-model/elements/c4/index.d.ts +3 -0
  124. package/dist/_pkgs/affine-model/elements/c4/index.js +3 -0
  125. package/dist/_pkgs/affine-model/elements/c4/node.d.ts +97 -0
  126. package/dist/_pkgs/affine-model/elements/c4/node.js +130 -0
  127. package/dist/_pkgs/affine-model/elements/connector/connector.js +1 -1
  128. package/dist/_pkgs/affine-model/elements/context-map/context-map.d.ts +27 -0
  129. package/dist/_pkgs/affine-model/elements/context-map/context-map.js +94 -0
  130. package/dist/_pkgs/affine-model/elements/context-map/index.d.ts +1 -0
  131. package/dist/_pkgs/affine-model/elements/context-map/index.js +1 -0
  132. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +34 -17
  133. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +28 -26
  134. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +36 -0
  135. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +103 -0
  136. package/dist/_pkgs/affine-model/elements/event-storming/index.d.ts +1 -0
  137. package/dist/_pkgs/affine-model/elements/event-storming/index.js +1 -0
  138. package/dist/_pkgs/affine-model/elements/index.d.ts +11 -0
  139. package/dist/_pkgs/affine-model/elements/index.js +3 -0
  140. package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
  141. package/dist/_pkgs/affine-shared/adapters/html/block-adapter.js +1 -1
  142. package/dist/_pkgs/affine-shared/adapters/markdown/block-adapter.js +1 -1
  143. package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.js +1 -1
  144. package/dist/_pkgs/affine-shared/adapters/notion-html/block-adapter.js +1 -1
  145. package/dist/_pkgs/affine-shared/adapters/notion-html/delta-converter.js +1 -1
  146. package/dist/_pkgs/affine-shared/adapters/plain-text/block-adapter.js +1 -1
  147. package/dist/_pkgs/affine-shared/adapters/plain-text/delta-converter.js +1 -1
  148. package/dist/_pkgs/affine-shared/adapters/utils/color.js +5 -2
  149. package/dist/_pkgs/affine-shared/commands/model-crud/draft-selected-models.js +1 -1
  150. package/dist/_pkgs/affine-shared/commands/selection/focus-block-end.js +1 -1
  151. package/dist/_pkgs/affine-shared/commands/selection/focus-block-start.js +1 -1
  152. package/dist/_pkgs/affine-shared/consts/index.d.ts +10 -0
  153. package/dist/_pkgs/affine-shared/consts/index.js +10 -0
  154. package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.d.ts +55 -0
  155. package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.js +35 -0
  156. package/dist/_pkgs/affine-shared/services/audit-service.d.ts +11 -0
  157. package/dist/_pkgs/affine-shared/services/command-usage-service.d.ts +31 -0
  158. package/dist/_pkgs/affine-shared/services/command-usage-service.js +109 -0
  159. package/dist/_pkgs/affine-shared/services/comment-service/block-comment-manager.js +1 -1
  160. package/dist/_pkgs/affine-shared/services/doc-display-meta-service.js +1 -1
  161. package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
  162. package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
  163. package/dist/_pkgs/affine-shared/services/index.js +2 -0
  164. package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +2 -1
  165. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +73 -1
  166. package/dist/_pkgs/affine-shared/services/toolbar-service/registry.d.ts +44 -0
  167. package/dist/_pkgs/affine-shared/services/toolbar-service/registry.js +161 -3
  168. package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +5 -3
  169. package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
  170. package/dist/_pkgs/affine-shared/utils/edgeless.js +1 -1
  171. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +34 -0
  172. package/dist/_pkgs/affine-shared/utils/file/filesys.js +48 -7
  173. package/dist/_pkgs/affine-shared/utils/zod-schema.js +1 -3
  174. package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
  175. package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +1 -1
  176. package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +1 -1
  177. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.d.ts +14 -0
  178. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.js +40 -0
  179. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +158 -0
  180. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +572 -0
  181. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +46 -0
  182. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +66 -0
  183. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.d.ts +13 -0
  184. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.js +50 -0
  185. package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.d.ts +6 -0
  186. package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +15 -5
  187. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +2 -0
  188. package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +2 -0
  189. package/dist/_pkgs/affine-widget-edgeless-toolbar/extension/index.d.ts +7 -0
  190. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
  191. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
  192. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +19 -0
  193. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +51 -10
  194. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
  195. package/dist/_pkgs/affine-widget-keyboard-toolbar/keyboard-tool-panel.js +1 -1
  196. package/dist/_pkgs/affine-widget-linked-doc/import-doc/import-doc.js +1 -1
  197. package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +1 -1
  198. package/dist/_pkgs/affine-widget-page-dragging-area/index.js +1 -1
  199. package/dist/_pkgs/affine-widget-remote-selection/doc/doc-remote-selection.js +1 -1
  200. package/dist/_pkgs/affine-widget-toolbar/toolbar.js +6 -2
  201. package/dist/_pkgs/affine-widget-toolbar/utils.js +6 -2
  202. package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +8 -12
  203. package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +52 -40
  204. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +3 -1
  205. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +3 -1
  206. package/dist/_pkgs/std/clipboard/utils.js +4 -1
  207. package/dist/_pkgs/std/extension/command-registry.d.ts +159 -5
  208. package/dist/_pkgs/std/extension/command-registry.js +202 -4
  209. package/dist/_pkgs/std/extension/shortcut.js +2 -1
  210. package/dist/_pkgs/std/gfx/grid.js +1 -1
  211. package/dist/_pkgs/std/gfx/index.d.ts +1 -1
  212. package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +160 -0
  213. package/dist/_pkgs/std/gfx/model/surface/element-model.js +75 -1
  214. package/dist/_pkgs/std/gfx/model/surface/role.js +5 -3
  215. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +2 -1
  216. package/dist/_pkgs/std/gfx/selection.js +1 -1
  217. package/dist/_pkgs/std/gfx/viewport.js +1 -1
  218. package/dist/_pkgs/std/inline/extensions/inline-manager.js +1 -1
  219. package/dist/_pkgs/std/inline/extensions/markdown-matcher.js +1 -1
  220. package/dist/_pkgs/store/model/store/crud.js +4 -1
  221. package/dist/commands.js +1 -1
  222. package/dist/extensions/command-usage.d.ts +23 -0
  223. package/dist/extensions/command-usage.js +37 -0
  224. package/dist/extensions/view.js +12 -0
  225. package/dist/frameworks.js +32 -0
  226. package/dist/translations.js +90 -2
  227. package/package.json +1 -1
@@ -3,6 +3,7 @@ export { ToolbarMoreMenuConfigExtension } from './config.js';
3
3
  export { EditorIconButton } from './icon-button.js';
4
4
  export { EditorMenuAction, EditorMenuButton, EditorMenuContent, } from './menu-button.js';
5
5
  export { MenuContext } from './menu-context.js';
6
+ export { type PickerMenu, type PickerMenuItem, renderCurrentPickerItemWith, renderPickerMenu, renderPickerMenuItems, } from './picker-menu.js';
6
7
  export { EditorToolbarSeparator } from './separator.js';
7
8
  export { darkToolbarStyles, lightToolbarStyles } from './styles.js';
8
9
  export { EditorToolbar } from './toolbar.js';
@@ -8,6 +8,7 @@ export { ToolbarMoreMenuConfigExtension } from './config.js';
8
8
  export { EditorIconButton } from './icon-button.js';
9
9
  export { EditorMenuAction, EditorMenuButton, EditorMenuContent, } from './menu-button.js';
10
10
  export { MenuContext } from './menu-context.js';
11
+ export { renderCurrentPickerItemWith, renderPickerMenu, renderPickerMenuItems, } from './picker-menu.js';
11
12
  export { EditorToolbarSeparator } from './separator.js';
12
13
  export { darkToolbarStyles, lightToolbarStyles } from './styles.js';
13
14
  export { EditorToolbar } from './toolbar.js';
@@ -32,7 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
32
32
  }
33
33
  return useValue ? value : void 0;
34
34
  };
35
- import { panelBaseStyle, scrollbarStyle, } from '../../affine-shared/styles/index.js';
35
+ import { panelBaseStyle, scrollbarStyle } from '../../affine-shared/styles/index.js';
36
36
  import { createButtonPopper, } from '../../affine-shared/utils/index.js';
37
37
  import { WithDisposable } from '../../global/lit/index.js';
38
38
  import { css, html, LitElement, } from 'lit';
@@ -0,0 +1,55 @@
1
+ import { type TemplateResult } from 'lit';
2
+ /**
3
+ * The **one-of-many picker** every toolbar in this editor uses: a chevron
4
+ * button that opens a row of icons, one of which is lit because it is what the
5
+ * selection currently is.
6
+ *
7
+ * "Switch shape type" is the one everybody knows; the framework morph dropdown
8
+ * is the same object. It lives HERE, in the shared component package, and not
9
+ * where it was first written (`@labre/affine-widget-edgeless-toolbar`) for a
10
+ * dependency reason that is not going away: that widget package depends on
11
+ * `@labre/affine-block-surface`, so nothing in the surface package — which is
12
+ * where the generic, framework-parameterized toolbar modules live — can import
13
+ * from it without closing a cycle. This package is below both, which is why the
14
+ * toolbar's buttons, its menu shells and its chevron already live here.
15
+ *
16
+ * The edgeless-toolbar copy is deliberately untouched by the change that added
17
+ * this file: it is what the shape toolbar and its neighbours already call, and
18
+ * collapsing the two is a follow-up whose blast radius is every shape entry in
19
+ * the editor rather than one new dropdown. Until then the two are the same
20
+ * markup twice — knowingly, and named here so the follow-up is findable.
21
+ *
22
+ * ## Names
23
+ *
24
+ * `PickerMenu` / `PickerMenuItem` rather than `Menu` / `MenuItem`: this package
25
+ * already exports a `MenuItem`, and it is a different thing entirely (a line in
26
+ * the "⋮" overflow menu, with a label and an action). Two types called
27
+ * `MenuItem` in one entry point is a trap, not a convenience.
28
+ */
29
+ /** One option: what it is worth, what it looks like, what it is called. */
30
+ export type PickerMenuItem<T> = {
31
+ /** Tooltip and accessible name. */
32
+ key?: string;
33
+ value: T;
34
+ icon?: TemplateResult;
35
+ disabled?: boolean;
36
+ };
37
+ export type PickerMenu<T> = {
38
+ label: string;
39
+ icon?: TemplateResult;
40
+ tooltip?: string;
41
+ items: PickerMenuItem<T>[];
42
+ currentValue: T;
43
+ onPick: (value: T) => void;
44
+ /**
45
+ * `data-testid` for the host element and, suffixed with `-option`, for each
46
+ * line. Optional: the shape toolbar's picker has never needed one, and a
47
+ * framework module that wants to be reachable from an integration spec says
48
+ * so rather than making every caller carry an attribute it does not use.
49
+ */
50
+ testId?: string;
51
+ };
52
+ /** The field of the item that currently matches — its icon, usually. */
53
+ export declare function renderCurrentPickerItemWith<T, F extends keyof PickerMenuItem<T>>(items: PickerMenuItem<T>[], currentValue: T, field: F): PickerMenuItem<T>[F] | undefined;
54
+ export declare function renderPickerMenu<T>({ label, tooltip, icon, items, currentValue, onPick, testId, }: PickerMenu<T>): TemplateResult<1>;
55
+ export declare function renderPickerMenuItems<T>(items: PickerMenuItem<T>[], currentValue: T, onPick: (value: T) => void, testId?: string): unknown;
@@ -0,0 +1,47 @@
1
+ import { html } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { repeat } from 'lit/directives/repeat.js';
4
+ import { EditorChevronDown } from './chevron-down.js';
5
+ /** The field of the item that currently matches — its icon, usually. */
6
+ export function renderCurrentPickerItemWith(items, currentValue, field) {
7
+ return items.find(({ value }) => value === currentValue)?.[field];
8
+ }
9
+ export function renderPickerMenu({ label, tooltip, icon, items, currentValue, onPick, testId, }) {
10
+ return html `
11
+ <editor-menu-button
12
+ data-testid=${ifDefined(testId)}
13
+ aria-label="${`${label.toLowerCase()}-menu`}"
14
+ .button=${html `
15
+ <editor-icon-button
16
+ data-testid=${ifDefined(testId ? `${testId}-button` : undefined)}
17
+ aria-label="${label}"
18
+ .tooltip="${tooltip ?? label}"
19
+ >
20
+ ${icon ?? renderCurrentPickerItemWith(items, currentValue, 'icon')}
21
+ ${EditorChevronDown}
22
+ </editor-icon-button>
23
+ `}
24
+ >
25
+ ${renderPickerMenuItems(items, currentValue, onPick, testId)}
26
+ </editor-menu-button>
27
+ `;
28
+ }
29
+ export function renderPickerMenuItems(items, currentValue, onPick, testId) {
30
+ // Keyed by `value`: the option list is rebuilt on every selection change, and
31
+ // an unkeyed repeat would recycle one kind's button into another's rather
32
+ // than moving it — which is what makes an icon and its tooltip disagree.
33
+ return repeat(items, item => item.value, ({ key, value, icon, disabled }) => html `
34
+ <editor-icon-button
35
+ data-testid=${ifDefined(testId ? `${testId}-option` : undefined)}
36
+ data-value=${ifDefined(typeof value === 'string' ? value : undefined)}
37
+ aria-label="${ifDefined(key)}"
38
+ .disabled=${ifDefined(disabled)}
39
+ .tooltip="${ifDefined(key)}"
40
+ .active="${currentValue === value}"
41
+ .activeMode="${'background'}"
42
+ @click=${() => onPick(value)}
43
+ >
44
+ ${icon}
45
+ </editor-icon-button>
46
+ `);
47
+ }
@@ -33,12 +33,12 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
33
  return useValue ? value : void 0;
34
34
  };
35
35
  import { EdgelessFrameManager } from '../../affine-block-frame/index.js';
36
- import { DocModeProvider, EditPropsStore, } from '../../affine-shared/services/index.js';
36
+ import { DocModeProvider, EditPropsStore } from '../../affine-shared/services/index.js';
37
37
  import { DisposableGroup } from '../../global/disposable/index.js';
38
38
  import { Bound } from '../../global/gfx/index.js';
39
39
  import { SignalWatcher, WithDisposable } from '../../global/lit/index.js';
40
40
  import { ShadowlessElement } from '../../std/index.js';
41
- import { generateKeyBetweenV2, GfxControllerIdentifier, } from '../../std/gfx/index.js';
41
+ import { generateKeyBetweenV2, GfxControllerIdentifier } from '../../std/gfx/index.js';
42
42
  import { css, html, nothing } from 'lit';
43
43
  import { property, query, state } from 'lit/decorators.js';
44
44
  import { keyed } from 'lit/directives/keyed.js';
@@ -32,9 +32,9 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
32
32
  }
33
33
  return useValue ? value : void 0;
34
34
  };
35
- import { PresentTool, } from '../../affine-block-frame/index.js';
35
+ import { PresentTool } from '../../affine-block-frame/index.js';
36
36
  import { EdgelessLegacySlotIdentifier } from '../../affine-block-surface/index.js';
37
- import { DocModeProvider, EditPropsStore, } from '../../affine-shared/services/index.js';
37
+ import { DocModeProvider, EditPropsStore } from '../../affine-shared/services/index.js';
38
38
  import { createButtonPopper } from '../../affine-shared/utils/index.js';
39
39
  import { DisposableGroup } from '../../global/disposable/index.js';
40
40
  import { WithDisposable } from '../../global/lit/index.js';
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
33
  return useValue ? value : void 0;
34
34
  };
35
35
  import { EdgelessLegacySlotIdentifier } from '../../affine-block-surface/index.js';
36
- import { DocModeProvider, EditPropsStore, } from '../../affine-shared/services/index.js';
36
+ import { DocModeProvider, EditPropsStore } from '../../affine-shared/services/index.js';
37
37
  import { WithDisposable } from '../../global/lit/index.js';
38
38
  import { css, html, LitElement } from 'lit';
39
39
  import { property, state } from 'lit/decorators.js';
@@ -37,7 +37,7 @@ import { DocModeProvider } from '../affine-shared/services/index.js';
37
37
  import { unsafeCSSVarV2 } from '../affine-shared/theme/index.js';
38
38
  import { matchModels } from '../affine-shared/utils/index.js';
39
39
  import { SignalWatcher, WithDisposable } from '../global/lit/index.js';
40
- import { PropTypes, requiredProperties, } from '../std/index.js';
40
+ import { PropTypes, requiredProperties } from '../std/index.js';
41
41
  import { signal } from '@preact/signals-core';
42
42
  import { css, html, LitElement, nothing } from 'lit';
43
43
  import { property } from 'lit/decorators.js';
@@ -1,5 +1,5 @@
1
1
  import { keepColor } from '../../../../affine-components/color-picker/index.js';
2
- import { EditPropsStore, ThemeProvider, } from '../../../../affine-shared/services/index.js';
2
+ import { EditPropsStore, ThemeProvider } from '../../../../affine-shared/services/index.js';
3
3
  import { EdgelessToolbarToolMixin } from '../../../../affine-widget-edgeless-toolbar/index.js';
4
4
  import { SignalWatcher } from '../../../../global/lit/index.js';
5
5
  import { computed, signal } from '@preact/signals-core';
@@ -1,6 +1,6 @@
1
1
  import { AStarRunner, Overlay } from '../affine-block-surface/index.js';
2
2
  import { ConnectorElementModel, ConnectorMode, DEFAULT_POLYGON_VERTICES, GroupElementModel, ShapeElementModel, ShapeType, } from '../affine-model/index.js';
3
- import { EditPropsStore, ThemeProvider, } from '../affine-shared/services/index.js';
3
+ import { EditPropsStore, ThemeProvider } from '../affine-shared/services/index.js';
4
4
  import { BlockSuiteError } from '../global/exceptions/index.js';
5
5
  import { almostEqual, Bound, getBezierCurveBoundingBox, getBezierParameters, getBoundFromPoints, getBoundWithRotation, getPointFromBoundsWithRotation, isOverlap, isVecZero, lineIntersects, PI2, PointLocation, polygonCentroid, sign, toRadian, Vec, } from '../global/gfx/index.js';
6
6
  import { assertType } from '../global/utils/index.js';
@@ -212,11 +212,12 @@ export function getAnchors(ele, includeCenterAnchor = true) {
212
212
  // getLineIntersections.
213
213
  if (ele.centerAnchorOnly) {
214
214
  const centerPoint = getPointFromBoundsWithRotation({ ...bound, rotate }, bound.center);
215
- return [{ point: new PointLocation(centerPoint), coord: [0.5, 0.5] }];
215
+ return [
216
+ { point: new PointLocation(centerPoint), coord: [0.5, 0.5] },
217
+ ];
216
218
  }
217
219
  // For polygon shapes, generate anchors at each vertex and edge midpoint
218
- if (ele instanceof ShapeElementModel &&
219
- ele.shapeType === ShapeType.Polygon) {
220
+ if (ele instanceof ShapeElementModel && ele.shapeType === ShapeType.Polygon) {
220
221
  const verts = ele.vertices ?? DEFAULT_POLYGON_VERTICES;
221
222
  for (let i = 0; i < verts.length; i++) {
222
223
  const curr = verts[i];
@@ -240,10 +241,7 @@ export function getAnchors(ele, includeCenterAnchor = true) {
240
241
  coord: vertCoord,
241
242
  });
242
243
  // --- Edge midpoint anchor ---
243
- const midCoord = [
244
- (curr[0] + next[0]) / 2,
245
- (curr[1] + next[1]) / 2,
246
- ];
244
+ const midCoord = [(curr[0] + next[0]) / 2, (curr[1] + next[1]) / 2];
247
245
  const midAbs = [
248
246
  bound.x + midCoord[0] * bound.w,
249
247
  bound.y + midCoord[1] * bound.h,
@@ -1241,8 +1239,7 @@ export class ConnectorPathGenerator extends PathGenerator {
1241
1239
  _isPointAtShapeCenter(connectable, point) {
1242
1240
  const bound = Bound.deserialize(connectable.xywh);
1243
1241
  const center = getPointFromBoundsWithRotation({ ...bound, rotate: connectable.rotate }, bound.center);
1244
- return (almostEqual(point[0], center[0], 1) &&
1245
- almostEqual(point[1], center[1], 1));
1242
+ return (almostEqual(point[0], center[0], 1) && almostEqual(point[1], center[1], 1));
1246
1243
  }
1247
1244
  _getConnectionPoint(connector, type) {
1248
1245
  const connection = connector[type];
@@ -1,4 +1,4 @@
1
- import { ConnectorMode } from '../affine-model/index.js';
1
+ import { type ConnectorElementProps, ConnectorMode } from '../affine-model/index.js';
2
2
  import type { IVec } from '../global/gfx/index.js';
3
3
  import type { PointerEventState } from '../std/index.js';
4
4
  import { BaseTool, type GfxModel } from '../std/gfx/index.js';
@@ -11,6 +11,24 @@ export type ConnectorToolOptions = {
11
11
  * the edge then stays neutral and no `role` key is written.
12
12
  */
13
13
  role?: string;
14
+ /**
15
+ * The FIVE stroke-and-marker props a framework toolbox arms its flow with
16
+ * (e.g. solid + filled triangle for a BPMN sequence flow) — the ones the
17
+ * stencils actually distinguish each other by. Applied at creation only,
18
+ * where explicit props win over the user's last plain-connector props, and
19
+ * NEVER recorded into `EditPropsStore`: arming a typed flow must not restyle
20
+ * the plain connector tool (BPMN 2.0 p.40 — other connectors must not adopt
21
+ * a flow's line style). Left out for the plain tool, which keeps drawing
22
+ * with the user's own last props.
23
+ *
24
+ * Deliberately NOT the whole look: a connector's other styled props —
25
+ * `rough`, `labelStyle` and the rest — are outside this bag and still come
26
+ * from the user's last plain-connector props, exactly as they did before
27
+ * this option existed. No framework declares them today, so nothing is lost;
28
+ * a framework that needs one must widen this `Pick` rather than reach for
29
+ * the store.
30
+ */
31
+ style?: Partial<Pick<ConnectorElementProps, 'stroke' | 'strokeStyle' | 'strokeWidth' | 'frontEndpointStyle' | 'rearEndpointStyle'>>;
14
32
  };
15
33
  export declare class ConnectorTool extends BaseTool<ConnectorToolOptions> {
16
34
  static toolName: string;
@@ -36,6 +36,10 @@ export class ConnectorTool extends BaseTool {
36
36
  this.doc.captureSync();
37
37
  const id = this.gfx.surface.addElement({
38
38
  type: CanvasElementType.CONNECTOR,
39
+ // The activation's own style, if any: explicit props win over the
40
+ // user's last plain-connector props in the edit-props middleware, so a
41
+ // framework look never passes through the shared store.
42
+ ...this.activatedOption.style,
39
43
  mode: this.activatedOption.mode,
40
44
  // `undefined` writes nothing: a neutral edge keeps no `role` key.
41
45
  role: this.activatedOption.role,
@@ -160,7 +164,9 @@ export class ConnectorTool extends BaseTool {
160
164
  }
161
165
  // Geometric centroid as a center anchor (gated on the global toggle),
162
166
  // mirroring the center anchor offered for other shape types.
163
- const centerAnchorEnabled = this.std.getOptional(EditPropsStore)?.getStorage('connectorCenterAnchor') ?? true;
167
+ const centerAnchorEnabled = this.std
168
+ .getOptional(EditPropsStore)
169
+ ?.getStorage('connectorCenterAnchor') ?? true;
164
170
  if (centerAnchorEnabled) {
165
171
  locations.push(polygonCentroid(verts));
166
172
  }
@@ -171,7 +177,9 @@ export class ConnectorTool extends BaseTool {
171
177
  this._sourceLocations = [[0.5, 0.5]];
172
178
  }
173
179
  else {
174
- const centerAnchorEnabled = this.std.getOptional(EditPropsStore)?.getStorage('connectorCenterAnchor') ?? true;
180
+ const centerAnchorEnabled = this.std
181
+ .getOptional(EditPropsStore)
182
+ ?.getStorage('connectorCenterAnchor') ?? true;
175
183
  this._sourceLocations =
176
184
  element instanceof ShapeElementModel &&
177
185
  element.shapeType === ShapeType.Triangle
@@ -39,10 +39,7 @@ function reanchorConnectorsForPolygon(surface, polygonId, elementGetter) {
39
39
  continue;
40
40
  // Convert the stored normalized [0-1] position to absolute model coords.
41
41
  const [nx, ny] = connection.position;
42
- const absPos = [
43
- bound.x + nx * bound.w,
44
- bound.y + ny * bound.h,
45
- ];
42
+ const absPos = [bound.x + nx * bound.w, bound.y + ny * bound.h];
46
43
  // Find the nearest anchor on the updated polygon boundary.
47
44
  let nearestCoord = connection.position;
48
45
  let minDist = Infinity;
@@ -273,7 +273,8 @@ export class EdgeDirectionManager extends InteractivityExtension {
273
273
  }
274
274
  }
275
275
  const current = this.revealed$.peek();
276
- if (ids.length === current.length && ids.every((id, i) => id === current[i])) {
276
+ if (ids.length === current.length &&
277
+ ids.every((id, i) => id === current[i])) {
277
278
  return;
278
279
  }
279
280
  this.revealed$.value = ids;
@@ -168,9 +168,7 @@ const invertEdgeDirection = {
168
168
  std.getOptional(TelemetryProvider)?.track('EdgeDirectionInverted', {
169
169
  page: 'whiteboard editor',
170
170
  ...(role !== undefined ? { role } : {}),
171
- ...(role !== undefined
172
- ? { framework: role.split(':')[0] }
173
- : {}),
171
+ ...(role !== undefined ? { framework: role.split(':')[0] } : {}),
174
172
  elementCount: edges.length,
175
173
  control: invocation.source,
176
174
  module: invocation.surface,
@@ -1,7 +1,7 @@
1
1
  import { ElementRendererExtension, } from '../../affine-block-surface/index.js';
2
2
  import { getFontString, getLineHeight, getTextWidth, isRTL, wrapTextDeltas, } from '../../affine-gfx-text/index.js';
3
3
  import { ConnectorMode, DefaultTheme, } from '../../affine-model/index.js';
4
- import { getBezierParameters, } from '../../global/gfx/index.js';
4
+ import { getBezierParameters } from '../../global/gfx/index.js';
5
5
  import { deltaInsertsToChunks } from '../../std/inline/index.js';
6
6
  import { isConnectorWithLabel } from '../connector-manager.js';
7
7
  import { DEFAULT_ARROW_SIZE, getArrowOptions, renderArrow, renderCircle, renderDiamond, renderTriangle, } from './utils.js';
@@ -1,5 +1,5 @@
1
1
  import { ConnectorMode, } from '../../affine-model/index.js';
2
- import { getBezierParameters, getBezierTangent, Vec, } from '../../global/gfx/index.js';
2
+ import { getBezierParameters, getBezierTangent, Vec } from '../../global/gfx/index.js';
3
3
  export const DEFAULT_ARROW_SIZE = 15;
4
4
  export function getArrowPoints(points, size = 10, mode, bezierParameters, endPoint = 'Rear', radians = Math.PI / 4) {
5
5
  const anchorPoint = getPointWithTangent(points, mode, endPoint, bezierParameters);
@@ -1,6 +1,6 @@
1
1
  import { EdgelessCRUDIdentifier } from '../../affine-block-surface/index.js';
2
2
  import { packColor, } from '../../affine-components/color-picker/index.js';
3
- import { createTextActions, normalizeTextBound, } from '../../affine-gfx-text/index.js';
3
+ import { createTextActions, normalizeTextBound } from '../../affine-gfx-text/index.js';
4
4
  import { ConnectorElementModel, ConnectorMode, DEFAULT_FRONT_ENDPOINT_STYLE, DEFAULT_REAR_ENDPOINT_STYLE, DefaultTheme, LineWidth, PointStyle, resolveColor, StrokeStyle, } from '../../affine-model/index.js';
5
5
  import { ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
6
6
  import { getMostCommonResolvedValue, getMostCommonValue, } from '../../affine-shared/utils/index.js';
@@ -1,6 +1,6 @@
1
1
  import { ElementToMarkdownAdapterExtension } from '../../../affine-block-surface/index.js';
2
2
  import { getShapeText } from '../../../affine-gfx-shape/index.js';
3
- import { buildMindMapTree, } from '../../../affine-model/index.js';
3
+ import { buildMindMapTree } from '../../../affine-model/index.js';
4
4
  export const mindmapToMarkdownAdapterMatcher = ElementToMarkdownAdapterExtension({
5
5
  name: 'mindmap',
6
6
  match: elementModel => elementModel.type === 'mindmap',
@@ -1,5 +1,5 @@
1
1
  import { getShapeText } from '../../affine-gfx-shape/index.js';
2
- import { buildMindMapTree, } from '../../affine-model/index.js';
2
+ import { buildMindMapTree } from '../../affine-model/index.js';
3
3
  /**
4
4
  * traverse the mindMapTree and construct the content string
5
5
  * like: