@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.
- package/dist/_pkgs/affine-block-attachment/attachment-block.js +1 -1
- package/dist/_pkgs/affine-block-callout/callout-block.js +1 -1
- package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +3 -1
- package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
- package/dist/_pkgs/affine-block-database/data-source.js +1 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/utils.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-manager.js +3 -1
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -1
- package/dist/_pkgs/affine-block-list/utils/forward-delete.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-block.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-blocks-between.js +1 -1
- package/dist/_pkgs/affine-block-note/move-block.js +1 -1
- package/dist/_pkgs/affine-block-paragraph/utils/forward-delete.js +2 -2
- package/dist/_pkgs/affine-block-paragraph/utils/merge-with-prev.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/adapters/plain-text/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +18 -3
- package/dist/_pkgs/affine-block-surface/element-model/index.js +12 -2
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +23 -6
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +10 -5
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +2 -1
- package/dist/_pkgs/affine-block-surface/extensions/element-renderer.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +393 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +306 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +61 -61
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.d.ts +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +78 -80
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +107 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +958 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +809 -20
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +1661 -50
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +50 -6
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +129 -32
- package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +289 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +126 -1
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +42 -2
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +80 -4
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +172 -11
- package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
- package/dist/_pkgs/affine-block-surface-ref/portal/note.js +2 -2
- package/dist/_pkgs/affine-block-table/commands.js +1 -1
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +1 -1
- package/dist/_pkgs/affine-components/embed-card-modal/embed-card-edit-modal.js +1 -1
- package/dist/_pkgs/affine-components/filterable-list/styles.js +1 -1
- package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +55 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +47 -0
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frames-setting-menu.js +1 -1
- package/dist/_pkgs/affine-fragment-outline/mobile-outline-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/pen/pen-tool-button.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +7 -10
- package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +19 -1
- package/dist/_pkgs/affine-gfx-connector/connector-tool.js +10 -2
- package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +2 -1
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +1 -3
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/markdown/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +583 -4
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +23 -23
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +5 -1
- package/dist/_pkgs/affine-gfx-mindmap/view/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-note/overlay/overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-note/toolbar/note-senior-button.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/consts.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/draggable/shape-draggable.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/polygon.js +17 -9
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/utils.js +8 -3
- package/dist/_pkgs/affine-gfx-shape/element-view.js +19 -12
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-vertex-editing-overlay.js +12 -7
- package/dist/_pkgs/affine-gfx-shape/overlay/shape-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +4 -2
- package/dist/_pkgs/affine-gfx-shape/shape-tool.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +1 -3
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +66 -17
- package/dist/_pkgs/affine-gfx-template/toolbar/overlay-scrollbar.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +1 -1
- package/dist/_pkgs/affine-inline-link/command.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/format-block.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/format-native.js +2 -2
- package/dist/_pkgs/affine-inline-preset/command/format-text.js +1 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +1 -1
- package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
- package/dist/_pkgs/affine-model/elements/bpmn/node.d.ts +40 -7
- package/dist/_pkgs/affine-model/elements/bpmn/node.js +4 -2
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +74 -17
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +55 -26
- package/dist/_pkgs/affine-model/elements/c4/board.d.ts +88 -0
- package/dist/_pkgs/affine-model/elements/c4/board.js +128 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.d.ts +63 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.js +134 -0
- package/dist/_pkgs/affine-model/elements/c4/index.d.ts +3 -0
- package/dist/_pkgs/affine-model/elements/c4/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/c4/node.d.ts +97 -0
- package/dist/_pkgs/affine-model/elements/c4/node.js +130 -0
- package/dist/_pkgs/affine-model/elements/connector/connector.js +1 -1
- package/dist/_pkgs/affine-model/elements/context-map/context-map.d.ts +27 -0
- package/dist/_pkgs/affine-model/elements/context-map/context-map.js +94 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +34 -17
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +28 -26
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +36 -0
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +103 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/index.d.ts +11 -0
- package/dist/_pkgs/affine-model/elements/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
- package/dist/_pkgs/affine-shared/adapters/html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/utils/color.js +5 -2
- package/dist/_pkgs/affine-shared/commands/model-crud/draft-selected-models.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-end.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-start.js +1 -1
- package/dist/_pkgs/affine-shared/consts/index.d.ts +10 -0
- package/dist/_pkgs/affine-shared/consts/index.js +10 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.d.ts +55 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.js +35 -0
- package/dist/_pkgs/affine-shared/services/audit-service.d.ts +11 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.d.ts +31 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.js +109 -0
- package/dist/_pkgs/affine-shared/services/comment-service/block-comment-manager.js +1 -1
- package/dist/_pkgs/affine-shared/services/doc-display-meta-service.js +1 -1
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
- package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
- package/dist/_pkgs/affine-shared/services/index.js +2 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +2 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +73 -1
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.js +161 -3
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +5 -3
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
- package/dist/_pkgs/affine-shared/utils/edgeless.js +1 -1
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +34 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +48 -7
- package/dist/_pkgs/affine-shared/utils/zod-schema.js +1 -3
- package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.d.ts +14 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.js +40 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +158 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +572 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +46 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +66 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.d.ts +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.js +50 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.d.ts +6 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +15 -5
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/extension/index.d.ts +7 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +19 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +51 -10
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
- package/dist/_pkgs/affine-widget-keyboard-toolbar/keyboard-tool-panel.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/import-doc/import-doc.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +1 -1
- package/dist/_pkgs/affine-widget-page-dragging-area/index.js +1 -1
- package/dist/_pkgs/affine-widget-remote-selection/doc/doc-remote-selection.js +1 -1
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +6 -2
- package/dist/_pkgs/affine-widget-toolbar/utils.js +6 -2
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +8 -12
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +52 -40
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +3 -1
- package/dist/_pkgs/std/clipboard/utils.js +4 -1
- package/dist/_pkgs/std/extension/command-registry.d.ts +159 -5
- package/dist/_pkgs/std/extension/command-registry.js +202 -4
- package/dist/_pkgs/std/extension/shortcut.js +2 -1
- package/dist/_pkgs/std/gfx/grid.js +1 -1
- package/dist/_pkgs/std/gfx/index.d.ts +1 -1
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +160 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +75 -1
- package/dist/_pkgs/std/gfx/model/surface/role.js +5 -3
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +2 -1
- package/dist/_pkgs/std/gfx/selection.js +1 -1
- package/dist/_pkgs/std/gfx/viewport.js +1 -1
- package/dist/_pkgs/std/inline/extensions/inline-manager.js +1 -1
- package/dist/_pkgs/std/inline/extensions/markdown-matcher.js +1 -1
- package/dist/_pkgs/store/model/store/crud.js +4 -1
- package/dist/commands.js +1 -1
- package/dist/extensions/command-usage.d.ts +23 -0
- package/dist/extensions/command-usage.js +37 -0
- package/dist/extensions/view.js +12 -0
- package/dist/frameworks.js +32 -0
- package/dist/translations.js +90 -2
- package/package.json +1 -1
|
@@ -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.#
|
|
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
|
|
24
|
-
*
|
|
25
|
-
*
|
|
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) ||
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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);
|
|
@@ -195,7 +195,10 @@ export class DocCRUD {
|
|
|
195
195
|
// be answered before indexing.
|
|
196
196
|
if (index === 0)
|
|
197
197
|
return null;
|
|
198
|
-
return parent
|
|
198
|
+
return (parent
|
|
199
|
+
.get('sys:children')
|
|
200
|
+
.toArray()
|
|
201
|
+
.at(index - 1) ?? null);
|
|
199
202
|
});
|
|
200
203
|
}
|
|
201
204
|
moveBlocks(blocksToMove, newParent, targetSibling = null, shouldInsertBeforeSibling = true) {
|
package/dist/commands.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { coreCommands, pivotCommands, readingCommands, tagCommands, } from './_pkgs/affine-block-root/index.js';
|
|
2
|
-
import { auditCommands, mapQualityCommands
|
|
2
|
+
import { auditCommands, mapQualityCommands } from './_pkgs/affine-block-surface/index.js';
|
|
3
3
|
import { edgeDirectionCommands } from './_pkgs/affine-gfx-connector/index.js';
|
|
4
4
|
import { shapeCommands } from './_pkgs/affine-gfx-shape/index.js';
|
|
5
5
|
import { toCommandManifestEntry, } from './_pkgs/std/index.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ViewExtensionContext, ViewExtensionProvider } from '../_pkgs/affine-ext-loader/index.js';
|
|
2
|
+
import type { ExtensionType } from '../_pkgs/store/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The DEFAULT command usage measure: `localStorage`, this browser only.
|
|
5
|
+
*
|
|
6
|
+
* `runCommand` records every invocation into whatever answers
|
|
7
|
+
* `CommandUsageIdentifier`; without a default nothing would be measured at all
|
|
8
|
+
* until a host wired a store, and PF6's "seven most-recent + six most-used"
|
|
9
|
+
* sub-menu would have nothing to rank in a standalone editor. A host that owns
|
|
10
|
+
* a per-user database replaces this with `CommandUsageExtension(store)`, whose
|
|
11
|
+
* `di.override` beats the `addImpl` below.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CommandUsageDefaultExtension: ExtensionType;
|
|
14
|
+
/**
|
|
15
|
+
* Registered unconditionally by `getInternalViewExtensions`, next to
|
|
16
|
+
* `CommandTelemetryViewExtension` and for the same reason: measuring which
|
|
17
|
+
* commands a user reaches for is not a framework's business, and a framework
|
|
18
|
+
* toggled off simply never invokes a command.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CommandUsageViewExtension extends ViewExtensionProvider {
|
|
21
|
+
name: string;
|
|
22
|
+
setup(context: ViewExtensionContext): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ViewExtensionProvider, } from '../_pkgs/affine-ext-loader/index.js';
|
|
2
|
+
import { createLocalCommandUsageStore } from '../_pkgs/affine-shared/services/index.js';
|
|
3
|
+
import { CommandUsageIdentifier } from '../_pkgs/std/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* The DEFAULT command usage measure: `localStorage`, this browser only.
|
|
6
|
+
*
|
|
7
|
+
* `runCommand` records every invocation into whatever answers
|
|
8
|
+
* `CommandUsageIdentifier`; without a default nothing would be measured at all
|
|
9
|
+
* until a host wired a store, and PF6's "seven most-recent + six most-used"
|
|
10
|
+
* sub-menu would have nothing to rank in a standalone editor. A host that owns
|
|
11
|
+
* a per-user database replaces this with `CommandUsageExtension(store)`, whose
|
|
12
|
+
* `di.override` beats the `addImpl` below.
|
|
13
|
+
*/
|
|
14
|
+
export const CommandUsageDefaultExtension = {
|
|
15
|
+
// Factory form, not value form — as for the telemetry reporter: the container
|
|
16
|
+
// calls a function argument as a factory, so the store is built here and the
|
|
17
|
+
// service provider is never passed to it.
|
|
18
|
+
setup: di => {
|
|
19
|
+
di.addImpl(CommandUsageIdentifier, () => createLocalCommandUsageStore());
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Registered unconditionally by `getInternalViewExtensions`, next to
|
|
24
|
+
* `CommandTelemetryViewExtension` and for the same reason: measuring which
|
|
25
|
+
* commands a user reaches for is not a framework's business, and a framework
|
|
26
|
+
* toggled off simply never invokes a command.
|
|
27
|
+
*/
|
|
28
|
+
export class CommandUsageViewExtension extends ViewExtensionProvider {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.name = 'affine-command-usage';
|
|
32
|
+
}
|
|
33
|
+
setup(context) {
|
|
34
|
+
super.setup(context);
|
|
35
|
+
context.register(CommandUsageDefaultExtension);
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/extensions/view.js
CHANGED
|
@@ -58,6 +58,7 @@ import { ToolbarViewExtension } from '../_pkgs/affine-widget-toolbar/view.js';
|
|
|
58
58
|
import { ViewportOverlayViewExtension } from '../_pkgs/affine-widget-viewport-overlay/view.js';
|
|
59
59
|
import { isBlockEnabled, isCapabilityEnabled, } from '../flags.js';
|
|
60
60
|
import { CommandTelemetryViewExtension } from './command-telemetry.js';
|
|
61
|
+
import { CommandUsageViewExtension } from './command-usage.js';
|
|
61
62
|
/**
|
|
62
63
|
* View extensions.
|
|
63
64
|
*
|
|
@@ -74,9 +75,20 @@ export function getInternalViewExtensions(flags) {
|
|
|
74
75
|
// The single command-telemetry emitter. Unconditional: a disabled
|
|
75
76
|
// framework simply never invokes a command (docs/adr/0008).
|
|
76
77
|
CommandTelemetryViewExtension,
|
|
78
|
+
// The default (browser-local) recency/frequency measure. Unconditional for
|
|
79
|
+
// the same reason, and independent of telemetry: it feeds an in-editor
|
|
80
|
+
// ranking, not a dashboard (docs/adr/0008).
|
|
81
|
+
CommandUsageViewExtension,
|
|
77
82
|
// Gfx — each framework contributes an always-on `…Render…` extension
|
|
78
83
|
// (element view + renderer + interaction + contextual toolbar) and a
|
|
79
84
|
// flag-gated tooling extension (senior button + creation shortcuts).
|
|
85
|
+
//
|
|
86
|
+
// The eight business frameworks are registered as PAIRS, in the order their
|
|
87
|
+
// senior buttons must read left to right: no framework declares a
|
|
88
|
+
// `SeniorTool.order`, so they all share the default group and the row is
|
|
89
|
+
// sorted stably — i.e. left in registration order. The single source of that
|
|
90
|
+
// order is `FRAMEWORK_DESCRIPTORS`, and `senior-row-order.unit.spec.ts` pins
|
|
91
|
+
// the two lists together.
|
|
80
92
|
PointerViewExtension,
|
|
81
93
|
GfxNoteViewExtension,
|
|
82
94
|
BrushRenderViewExtension,
|
package/dist/frameworks.js
CHANGED
|
@@ -2,6 +2,7 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
2
2
|
{
|
|
3
3
|
id: 'wardley',
|
|
4
4
|
labelKey: 'com.labre.framework.wardley',
|
|
5
|
+
labelFallback: 'Wardley map',
|
|
5
6
|
iconKey: 'wardley.toolbar',
|
|
6
7
|
// The only allocated chord prefix: `w` was free against
|
|
7
8
|
// RESERVED_EDGELESS_KEYS. The other six frameworks ship no chord, so they
|
|
@@ -26,6 +27,7 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
26
27
|
{
|
|
27
28
|
id: 'edgy',
|
|
28
29
|
labelKey: 'com.labre.framework.edgy',
|
|
30
|
+
labelFallback: 'EDGY',
|
|
29
31
|
iconKey: 'edgy.toolbar',
|
|
30
32
|
telemetryKey: 'edgy',
|
|
31
33
|
telemetrySegment: 'edgy toolbox',
|
|
@@ -43,6 +45,7 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
43
45
|
{
|
|
44
46
|
id: 'cynefin-estuarine',
|
|
45
47
|
labelKey: 'com.labre.framework.cynefin-estuarine',
|
|
48
|
+
labelFallback: 'Cynefin / Estuarine',
|
|
46
49
|
iconKey: 'cynefin.toolbar',
|
|
47
50
|
// Historical PostHog value; the flag and the owner say
|
|
48
51
|
// `cynefin-estuarine`, the wire says `cynefin`.
|
|
@@ -66,6 +69,7 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
66
69
|
{
|
|
67
70
|
id: 'bpmn',
|
|
68
71
|
labelKey: 'com.labre.framework.bpmn',
|
|
72
|
+
labelFallback: 'BPMN',
|
|
69
73
|
iconKey: 'bpmn.toolbar',
|
|
70
74
|
telemetryKey: 'bpmn',
|
|
71
75
|
telemetrySegment: 'bpmn toolbox',
|
|
@@ -83,6 +87,7 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
83
87
|
{
|
|
84
88
|
id: 'ddd-event-storming',
|
|
85
89
|
labelKey: 'com.labre.framework.ddd-event-storming',
|
|
90
|
+
labelFallback: 'Event Storming',
|
|
86
91
|
iconKey: 'ddd-event-storming.toolbar',
|
|
87
92
|
telemetryKey: 'event-storming',
|
|
88
93
|
telemetrySegment: 'ddd toolbox',
|
|
@@ -91,6 +96,9 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
91
96
|
pkg: '@labre/affine-gfx-ddd-event-storming',
|
|
92
97
|
dir: 'affine/gfx/ddd-event-storming',
|
|
93
98
|
extensions: [
|
|
99
|
+
// always-on: placed Event Storming boards must paint even with the button
|
|
100
|
+
// off, and their role vocabulary must stay readable
|
|
101
|
+
{ viewExtension: 'DddEventStormingRenderViewExtension' },
|
|
94
102
|
{
|
|
95
103
|
flag: 'ddd-event-storming',
|
|
96
104
|
viewExtension: 'DddEventStormingViewExtension',
|
|
@@ -98,9 +106,29 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
98
106
|
],
|
|
99
107
|
shortcuts: true,
|
|
100
108
|
},
|
|
109
|
+
{
|
|
110
|
+
id: 'c4',
|
|
111
|
+
labelKey: 'com.labre.framework.c4',
|
|
112
|
+
labelFallback: 'C4 model',
|
|
113
|
+
iconKey: 'c4.toolbar',
|
|
114
|
+
telemetryKey: 'c4',
|
|
115
|
+
telemetrySegment: 'c4 toolbox',
|
|
116
|
+
bundle: 'framework-c4',
|
|
117
|
+
info: 'c4Framework',
|
|
118
|
+
pkg: '@labre/affine-gfx-c4',
|
|
119
|
+
dir: 'affine/gfx/c4',
|
|
120
|
+
extensions: [
|
|
121
|
+
// always-on: placed C4 boards, boundaries and elements must paint even
|
|
122
|
+
// with the button off
|
|
123
|
+
{ viewExtension: 'C4RenderViewExtension' },
|
|
124
|
+
{ flag: 'c4', viewExtension: 'C4ViewExtension' },
|
|
125
|
+
],
|
|
126
|
+
shortcuts: true,
|
|
127
|
+
},
|
|
101
128
|
{
|
|
102
129
|
id: 'ddd-core-domain',
|
|
103
130
|
labelKey: 'com.labre.framework.ddd-core-domain',
|
|
131
|
+
labelFallback: 'Core Domain Chart',
|
|
104
132
|
iconKey: 'ddd-core-domain.toolbar',
|
|
105
133
|
telemetryKey: 'core-domain',
|
|
106
134
|
telemetrySegment: 'ddd toolbox',
|
|
@@ -118,6 +146,7 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
118
146
|
{
|
|
119
147
|
id: 'ddd-context-map',
|
|
120
148
|
labelKey: 'com.labre.framework.ddd-context-map',
|
|
149
|
+
labelFallback: 'Context Map',
|
|
121
150
|
iconKey: 'ddd-context-map.toolbar',
|
|
122
151
|
telemetryKey: 'context-map',
|
|
123
152
|
telemetrySegment: 'ddd toolbox',
|
|
@@ -126,6 +155,9 @@ export const FRAMEWORK_DESCRIPTORS = [
|
|
|
126
155
|
pkg: '@labre/affine-gfx-ddd-context-map',
|
|
127
156
|
dir: 'affine/gfx/ddd-context-map',
|
|
128
157
|
extensions: [
|
|
158
|
+
// always-on: placed Context Map boards must paint even with the button
|
|
159
|
+
// off, and their role vocabulary must stay readable
|
|
160
|
+
{ viewExtension: 'DddContextMapRenderViewExtension' },
|
|
129
161
|
{ flag: 'ddd-context-map', viewExtension: 'DddContextMapViewExtension' },
|
|
130
162
|
],
|
|
131
163
|
shortcuts: true,
|