@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
|
@@ -1,17 +1,50 @@
|
|
|
1
1
|
import { ShapeElementModel } from '../shape/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* The BPMN
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* The BPMN artefacts the pack draws — the **descriptive conformance subclass**
|
|
4
|
+
* of BPMN 2.0. Each maps onto a native shape, decorated by a glyph where the
|
|
5
|
+
* notation asks for one:
|
|
6
|
+
*
|
|
7
|
+
* - events (ellipse) — `startEvent` / `endEvent` plain, plus the message and
|
|
8
|
+
* timer starts and the message and terminate ends;
|
|
9
|
+
* - activities (rect) — `task` plain, plus the user and service tasks, the
|
|
10
|
+
* collapsed sub-process and the call activity;
|
|
11
|
+
* - gateways (diamond) — `gatewayExclusive` (X) and `gatewayParallel` (+);
|
|
12
|
+
* - data & artifacts — `dataObject`, `dataStore` and `textAnnotation`, whose
|
|
13
|
+
* silhouettes (folded page, cylinder, open bracket) are drawn by the glyph
|
|
14
|
+
* over a native rect with its own stroke and fill turned off;
|
|
15
|
+
* - `group` — a dashed rounded rectangle drawn AROUND things.
|
|
16
|
+
*
|
|
17
|
+
* `group` is the odd one and deliberately so. Every other kind is a node the
|
|
18
|
+
* process is made of; a group is a lasso somebody drew round part of it. The
|
|
19
|
+
* spec (BPMN 2.0.2 §10.4) exempts it from every connection and containment
|
|
20
|
+
* constraint there is — it cannot be attached to a sequence or message flow, it
|
|
21
|
+
* is not bounded by the pool or lane it overlaps, and it may straddle several
|
|
22
|
+
* pools at once. Nothing here has to enforce that, because a group is unfilled:
|
|
23
|
+
* it is hit near its border and on its label, so it never steals a click from
|
|
24
|
+
* what it encloses, and what it encloses never becomes its content.
|
|
25
|
+
*
|
|
26
|
+
* ## Compatibility
|
|
27
|
+
*
|
|
28
|
+
* This union is only ever WIDENED, and it is widened with new VALUES of the
|
|
29
|
+
* existing `kind` string field — no new field, no schema change, no migration
|
|
30
|
+
* and no backfill. The precedent is `wardley`'s (`gfx/wardley/src/roles.ts`):
|
|
31
|
+
* a process drawn before today carries one of the four original values, loads
|
|
32
|
+
* unchanged and paints exactly as it always did.
|
|
33
|
+
*
|
|
34
|
+
* The expanded (drilled-in) sub-process is deliberately NOT here: `subProcess`
|
|
35
|
+
* is the COLLAPSED representation only — a task-sized rectangle with the `+`
|
|
36
|
+
* marker. An expanded sub-process is a container with its own flow inside it,
|
|
37
|
+
* which is a containment model this pack does not have yet.
|
|
7
38
|
*/
|
|
8
|
-
export type BpmnNodeKind = 'startEvent' | 'endEvent' | 'task' | 'gatewayExclusive';
|
|
39
|
+
export type BpmnNodeKind = 'startEvent' | 'startEventMessage' | 'startEventTimer' | 'endEvent' | 'endEventMessage' | 'endEventTerminate' | 'task' | 'taskUser' | 'taskService' | 'subProcess' | 'callActivity' | 'gatewayExclusive' | 'gatewayParallel' | 'dataObject' | 'dataStore' | 'textAnnotation' | 'group';
|
|
9
40
|
/**
|
|
10
41
|
* A BPMN flow-object node. Extends {@link ShapeElementModel} (a native shape)
|
|
11
42
|
* so it inherits ALL shape behaviour — editable stroke width / colors, inner
|
|
12
43
|
* text, native resize, the shape context toolbar — for free. `kind`
|
|
13
|
-
* discriminates the
|
|
14
|
-
*
|
|
44
|
+
* discriminates the artefacts and drives the RENDERING alone; what a node
|
|
45
|
+
* MEANS is the `role` stamped on it at creation (`gfx/bpmn/src/roles.ts`).
|
|
46
|
+
* The plain start event, end event and task are undecorated native shapes;
|
|
47
|
+
* every other kind is decorated with a glyph by the renderer.
|
|
15
48
|
*
|
|
16
49
|
* Mirrors {@link EdgyNodeElementModel}.
|
|
17
50
|
*/
|
|
@@ -38,8 +38,10 @@ import { ShapeElementModel } from '../shape/index.js';
|
|
|
38
38
|
* A BPMN flow-object node. Extends {@link ShapeElementModel} (a native shape)
|
|
39
39
|
* so it inherits ALL shape behaviour — editable stroke width / colors, inner
|
|
40
40
|
* text, native resize, the shape context toolbar — for free. `kind`
|
|
41
|
-
* discriminates the
|
|
42
|
-
*
|
|
41
|
+
* discriminates the artefacts and drives the RENDERING alone; what a node
|
|
42
|
+
* MEANS is the `role` stamped on it at creation (`gfx/bpmn/src/roles.ts`).
|
|
43
|
+
* The plain start event, end event and task are undecorated native shapes;
|
|
44
|
+
* every other kind is decorated with a glyph by the renderer.
|
|
43
45
|
*
|
|
44
46
|
* Mirrors {@link EdgyNodeElementModel}.
|
|
45
47
|
*/
|
|
@@ -1,30 +1,87 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { SerializedXYWH } from '../../../global/gfx/index.js';
|
|
2
|
+
import type { FrameworkBackgroundProps } from '../framework-background/index.js';
|
|
3
|
+
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* One LANE (couloir) of a pool: a horizontal band the participant's own work is
|
|
6
|
+
* divided into — "Sales", "Back office", "Automated".
|
|
7
|
+
*
|
|
8
|
+
* The shape of a {@link BackgroundInstanceZoneItem} in
|
|
9
|
+
* `@labre/affine-block-surface`, and deliberately the same three fields: the
|
|
10
|
+
* primitive paints an instance partition from that structure, the audit reports
|
|
11
|
+
* it from that structure, and a lane that had a shape of its own would be a
|
|
12
|
+
* fourth place the two have to agree.
|
|
13
|
+
*
|
|
14
|
+
* `size` is a relative WEIGHT, not a height in model units: lanes share the
|
|
15
|
+
* plot in proportion to their sizes, so a pool dragged taller redistributes the
|
|
16
|
+
* extra space instead of leaving a gap under the last band. `2` reads as "twice
|
|
17
|
+
* the other one", which is the only thing a lane's height ever means.
|
|
18
|
+
*/
|
|
19
|
+
export interface BpmnLane {
|
|
20
|
+
/** Stable id, generated at creation. Never the name: a lane can be renamed. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** The lane name, written horizontally in its top-left corner. */
|
|
23
|
+
name?: string;
|
|
24
|
+
/** Relative weight — see above. Must be a finite number greater than zero. */
|
|
25
|
+
size: number;
|
|
26
|
+
}
|
|
27
|
+
export type BpmnPoolProps = FrameworkBackgroundProps & {
|
|
6
28
|
/** The participant name shown in the left band — edited inline on dblclick. */
|
|
7
29
|
name?: string;
|
|
8
|
-
/**
|
|
9
|
-
|
|
30
|
+
/** The pool's own partition into lanes. Absent until the first one is added. */
|
|
31
|
+
lanes?: BpmnLane[];
|
|
10
32
|
};
|
|
11
33
|
/**
|
|
12
34
|
* A BPMN "pool": a participant container drawn as a rounded-rect frame with a
|
|
13
|
-
* vertical name band on the left. It is a background
|
|
14
|
-
*
|
|
15
|
-
*
|
|
35
|
+
* vertical name band on the left. It is a framework background like every other
|
|
36
|
+
* one in the library — the user drops flow-object nodes on top of it, and a
|
|
37
|
+
* connector never snaps to it.
|
|
38
|
+
*
|
|
39
|
+
* The geometry of a passive canvas comes from
|
|
40
|
+
* {@link FrameworkBackgroundElementModel}: this class used to restate all five
|
|
41
|
+
* of those overrides verbatim, which is exactly the kind of copy that drifts.
|
|
42
|
+
* The persisted type is still `bpmnPool`, and the first four fields below are
|
|
43
|
+
* the four it has always written, in the same order, with the same defaults.
|
|
16
44
|
*
|
|
17
|
-
*
|
|
45
|
+
* What it LOOKS like is declared, not coded: see `BPMN_POOL_BACKGROUND` in
|
|
46
|
+
* `@labre/affine-gfx-bpmn`.
|
|
18
47
|
*/
|
|
19
|
-
export declare class BpmnPoolElementModel extends
|
|
48
|
+
export declare class BpmnPoolElementModel extends FrameworkBackgroundElementModel<BpmnPoolProps> {
|
|
20
49
|
get type(): string;
|
|
21
|
-
get connectable(): boolean;
|
|
22
|
-
containsBound(bounds: Bound): boolean;
|
|
23
|
-
getLineIntersections(start: IVec, end: IVec): import("../../../global/gfx/index.js").PointLocation[] | null;
|
|
24
|
-
getNearestPoint(point: IVec): IVec;
|
|
25
|
-
includesPoint(x: number, y: number): boolean;
|
|
26
50
|
accessor name: string;
|
|
27
51
|
accessor resizeEnabled: boolean;
|
|
28
52
|
accessor rotate: number;
|
|
29
53
|
accessor xywh: SerializedXYWH;
|
|
54
|
+
/**
|
|
55
|
+
* The pool's own partition into lanes, in top-to-bottom order.
|
|
56
|
+
*
|
|
57
|
+
* The FIFTH field, and the only one that is optional. It mirrors
|
|
58
|
+
* `validationExceptions` on the base element model exactly, for the same three
|
|
59
|
+
* reasons:
|
|
60
|
+
*
|
|
61
|
+
* - **`undefined`, not `[]`.** `@field()`'s `init` writes nothing for an
|
|
62
|
+
* `undefined` default, so a pool that has no lane stays byte-identical to
|
|
63
|
+
* one created before this field existed: optional field, no schema version
|
|
64
|
+
* bump, no migration, and every document already on disk opens and paints
|
|
65
|
+
* exactly as it did (pinned by `pool-background.unit.spec.ts`, whose
|
|
66
|
+
* fixture carries no `lanes` key). Removing the last lane goes back through
|
|
67
|
+
* `clearField`, which deletes the KEY rather than leaving a phantom one.
|
|
68
|
+
* - **Flat JSON on purpose.** Element serialization is one level deep, and a
|
|
69
|
+
* value a Yjs update can encode is the contract `_assignElementProp`
|
|
70
|
+
* enforces. A nested `Y.Map` is what `tags` needs and this does not (see
|
|
71
|
+
* `docs/adr/0007`): a lane list is one atomic choice about how a single
|
|
72
|
+
* participant's own band is cut, authored by whoever is drawing the
|
|
73
|
+
* process — not an accumulating multi-key set different people qualify
|
|
74
|
+
* concurrently. The trade is stated so it is reviewed, not discovered:
|
|
75
|
+
* two peers reordering the lanes at the same moment resolve
|
|
76
|
+
* last-write-wins, one whole list winning over the other.
|
|
77
|
+
* - **Declared HERE and not on the base class.** A lane is a subdivision of a
|
|
78
|
+
* pool and of nothing else, and the accessor is what carries the value
|
|
79
|
+
* through a copy, a paste or a template insertion, so a duplicated pool
|
|
80
|
+
* arrives with its lanes.
|
|
81
|
+
*
|
|
82
|
+
* What it MEANS is declared, not coded: `BPMN_POOL_BACKGROUND.instanceZones`
|
|
83
|
+
* in `@labre/affine-gfx-bpmn` names this prop, and the framework-background
|
|
84
|
+
* primitive paints the dividers and the names from it.
|
|
85
|
+
*/
|
|
86
|
+
accessor lanes: BpmnLane[] | undefined;
|
|
30
87
|
}
|
|
@@ -32,18 +32,25 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
35
|
+
import { field } from '../../../std/gfx/index.js';
|
|
36
|
+
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
37
37
|
/**
|
|
38
38
|
* A BPMN "pool": a participant container drawn as a rounded-rect frame with a
|
|
39
|
-
* vertical name band on the left. It is a background
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* vertical name band on the left. It is a framework background like every other
|
|
40
|
+
* one in the library — the user drops flow-object nodes on top of it, and a
|
|
41
|
+
* connector never snaps to it.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
43
|
+
* The geometry of a passive canvas comes from
|
|
44
|
+
* {@link FrameworkBackgroundElementModel}: this class used to restate all five
|
|
45
|
+
* of those overrides verbatim, which is exactly the kind of copy that drifts.
|
|
46
|
+
* The persisted type is still `bpmnPool`, and the first four fields below are
|
|
47
|
+
* the four it has always written, in the same order, with the same defaults.
|
|
48
|
+
*
|
|
49
|
+
* What it LOOKS like is declared, not coded: see `BPMN_POOL_BACKGROUND` in
|
|
50
|
+
* `@labre/affine-gfx-bpmn`.
|
|
44
51
|
*/
|
|
45
52
|
let BpmnPoolElementModel = (() => {
|
|
46
|
-
let _classSuper =
|
|
53
|
+
let _classSuper = FrameworkBackgroundElementModel;
|
|
47
54
|
let _name_decorators;
|
|
48
55
|
let _name_initializers = [];
|
|
49
56
|
let _name_extraInitializers = [];
|
|
@@ -56,6 +63,9 @@ let BpmnPoolElementModel = (() => {
|
|
|
56
63
|
let _xywh_decorators;
|
|
57
64
|
let _xywh_initializers = [];
|
|
58
65
|
let _xywh_extraInitializers = [];
|
|
66
|
+
let _lanes_decorators;
|
|
67
|
+
let _lanes_initializers = [];
|
|
68
|
+
let _lanes_extraInitializers = [];
|
|
59
69
|
return class BpmnPoolElementModel extends _classSuper {
|
|
60
70
|
static {
|
|
61
71
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -63,33 +73,17 @@ let BpmnPoolElementModel = (() => {
|
|
|
63
73
|
_resizeEnabled_decorators = [field(true)];
|
|
64
74
|
_rotate_decorators = [field(0)];
|
|
65
75
|
_xywh_decorators = [field()];
|
|
76
|
+
_lanes_decorators = [field()];
|
|
66
77
|
__esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
67
78
|
__esDecorate(this, null, _resizeEnabled_decorators, { kind: "accessor", name: "resizeEnabled", static: false, private: false, access: { has: obj => "resizeEnabled" in obj, get: obj => obj.resizeEnabled, set: (obj, value) => { obj.resizeEnabled = value; } }, metadata: _metadata }, _resizeEnabled_initializers, _resizeEnabled_extraInitializers);
|
|
68
79
|
__esDecorate(this, null, _rotate_decorators, { kind: "accessor", name: "rotate", static: false, private: false, access: { has: obj => "rotate" in obj, get: obj => obj.rotate, set: (obj, value) => { obj.rotate = value; } }, metadata: _metadata }, _rotate_initializers, _rotate_extraInitializers);
|
|
69
80
|
__esDecorate(this, null, _xywh_decorators, { kind: "accessor", name: "xywh", static: false, private: false, access: { has: obj => "xywh" in obj, get: obj => obj.xywh, set: (obj, value) => { obj.xywh = value; } }, metadata: _metadata }, _xywh_initializers, _xywh_extraInitializers);
|
|
81
|
+
__esDecorate(this, null, _lanes_decorators, { kind: "accessor", name: "lanes", static: false, private: false, access: { has: obj => "lanes" in obj, get: obj => obj.lanes, set: (obj, value) => { obj.lanes = value; } }, metadata: _metadata }, _lanes_initializers, _lanes_extraInitializers);
|
|
70
82
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
71
83
|
}
|
|
72
84
|
get type() {
|
|
73
85
|
return 'bpmnPool';
|
|
74
86
|
}
|
|
75
|
-
get connectable() {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
containsBound(bounds) {
|
|
79
|
-
const points = getPointsFromBoundWithRotation(this);
|
|
80
|
-
return points.some(point => bounds.containsPoint(point));
|
|
81
|
-
}
|
|
82
|
-
getLineIntersections(start, end) {
|
|
83
|
-
const points = getPointsFromBoundWithRotation(this);
|
|
84
|
-
return linePolygonIntersects(start, end, points);
|
|
85
|
-
}
|
|
86
|
-
getNearestPoint(point) {
|
|
87
|
-
return polygonNearestPoint(Bound.deserialize(this.xywh).points, point);
|
|
88
|
-
}
|
|
89
|
-
includesPoint(x, y) {
|
|
90
|
-
const points = getPointsFromBoundWithRotation(this);
|
|
91
|
-
return pointInPolygon([x, y], points);
|
|
92
|
-
}
|
|
93
87
|
#name_accessor_storage = __runInitializers(this, _name_initializers, 'Pool');
|
|
94
88
|
get name() { return this.#name_accessor_storage; }
|
|
95
89
|
set name(value) { this.#name_accessor_storage = value; }
|
|
@@ -102,9 +96,44 @@ let BpmnPoolElementModel = (() => {
|
|
|
102
96
|
#xywh_accessor_storage = (__runInitializers(this, _rotate_extraInitializers), __runInitializers(this, _xywh_initializers, '[0,0,560,200]'));
|
|
103
97
|
get xywh() { return this.#xywh_accessor_storage; }
|
|
104
98
|
set xywh(value) { this.#xywh_accessor_storage = value; }
|
|
99
|
+
#lanes_accessor_storage = (__runInitializers(this, _xywh_extraInitializers), __runInitializers(this, _lanes_initializers, undefined));
|
|
100
|
+
/**
|
|
101
|
+
* The pool's own partition into lanes, in top-to-bottom order.
|
|
102
|
+
*
|
|
103
|
+
* The FIFTH field, and the only one that is optional. It mirrors
|
|
104
|
+
* `validationExceptions` on the base element model exactly, for the same three
|
|
105
|
+
* reasons:
|
|
106
|
+
*
|
|
107
|
+
* - **`undefined`, not `[]`.** `@field()`'s `init` writes nothing for an
|
|
108
|
+
* `undefined` default, so a pool that has no lane stays byte-identical to
|
|
109
|
+
* one created before this field existed: optional field, no schema version
|
|
110
|
+
* bump, no migration, and every document already on disk opens and paints
|
|
111
|
+
* exactly as it did (pinned by `pool-background.unit.spec.ts`, whose
|
|
112
|
+
* fixture carries no `lanes` key). Removing the last lane goes back through
|
|
113
|
+
* `clearField`, which deletes the KEY rather than leaving a phantom one.
|
|
114
|
+
* - **Flat JSON on purpose.** Element serialization is one level deep, and a
|
|
115
|
+
* value a Yjs update can encode is the contract `_assignElementProp`
|
|
116
|
+
* enforces. A nested `Y.Map` is what `tags` needs and this does not (see
|
|
117
|
+
* `docs/adr/0007`): a lane list is one atomic choice about how a single
|
|
118
|
+
* participant's own band is cut, authored by whoever is drawing the
|
|
119
|
+
* process — not an accumulating multi-key set different people qualify
|
|
120
|
+
* concurrently. The trade is stated so it is reviewed, not discovered:
|
|
121
|
+
* two peers reordering the lanes at the same moment resolve
|
|
122
|
+
* last-write-wins, one whole list winning over the other.
|
|
123
|
+
* - **Declared HERE and not on the base class.** A lane is a subdivision of a
|
|
124
|
+
* pool and of nothing else, and the accessor is what carries the value
|
|
125
|
+
* through a copy, a paste or a template insertion, so a duplicated pool
|
|
126
|
+
* arrives with its lanes.
|
|
127
|
+
*
|
|
128
|
+
* What it MEANS is declared, not coded: `BPMN_POOL_BACKGROUND.instanceZones`
|
|
129
|
+
* in `@labre/affine-gfx-bpmn` names this prop, and the framework-background
|
|
130
|
+
* primitive paints the dividers and the names from it.
|
|
131
|
+
*/
|
|
132
|
+
get lanes() { return this.#lanes_accessor_storage; }
|
|
133
|
+
set lanes(value) { this.#lanes_accessor_storage = value; }
|
|
105
134
|
constructor() {
|
|
106
135
|
super(...arguments);
|
|
107
|
-
__runInitializers(this,
|
|
136
|
+
__runInitializers(this, _lanes_extraInitializers);
|
|
108
137
|
}
|
|
109
138
|
};
|
|
110
139
|
})();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { SerializedXYWH } from '../../../global/gfx/index.js';
|
|
2
|
+
import type { FrameworkBackgroundProps } from '../framework-background/index.js';
|
|
3
|
+
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Which of C4's levels this board draws — the DECLARED fact, as opposed to the
|
|
6
|
+
* title, which is free text and says whatever its author wants it to.
|
|
7
|
+
*
|
|
8
|
+
* **Four values, for the four C's the notation is named after**: Context,
|
|
9
|
+
* Containers, Components, Code. The vocabulary is the model's, so it says all
|
|
10
|
+
* of it.
|
|
11
|
+
*
|
|
12
|
+
* ## Why `code` is here although nothing draws it
|
|
13
|
+
*
|
|
14
|
+
* Because the two questions are not the same one. What the EDITOR can draw is a
|
|
15
|
+
* fact about this tooling — there are no code-level artefacts in the pack today,
|
|
16
|
+
* and C4 itself says to skip that diagram unless it is generated from the source
|
|
17
|
+
* — while what a SHEET may declare is a fact about the author's intent. A board
|
|
18
|
+
* an architect keeps for the class diagram they paste in from elsewhere is a
|
|
19
|
+
* code-level board, and a vocabulary that refused to let them say so would be
|
|
20
|
+
* this editor's limitation dressed up as the notation's.
|
|
21
|
+
*
|
|
22
|
+
* So the declaration is the author's to make, and no rule judges it: nothing in
|
|
23
|
+
* the pack knows what a code diagram admits, and a rule with nothing to forbid
|
|
24
|
+
* is data that can never fire (`rules.ts` says this at length, about `component`
|
|
25
|
+
* and `code` together). The level is recorded, exported and readable; it is
|
|
26
|
+
* simply not yet checked.
|
|
27
|
+
*
|
|
28
|
+
* ## Widening this union is additive
|
|
29
|
+
*
|
|
30
|
+
* A value added here is a value older clients have never seen, and they read it
|
|
31
|
+
* back as the string it is — the same promise `C4NodeKind` and
|
|
32
|
+
* `C4BoundaryVariant` make. No document is rewritten, no migration is owed, and
|
|
33
|
+
* a rule that does not name a level evaluates nothing on a board carrying it.
|
|
34
|
+
*
|
|
35
|
+
* A board that states a level is a board a rule can judge — "a container has no
|
|
36
|
+
* place on a context diagram" — where a board that states nothing is a free
|
|
37
|
+
* sketch, which is what every C4 diagram ever drawn in this editor is.
|
|
38
|
+
*/
|
|
39
|
+
export type C4BoardLevel = 'context' | 'container' | 'component' | 'code';
|
|
40
|
+
export type C4BoardProps = FrameworkBackgroundProps & {
|
|
41
|
+
/** The diagram title, written top-left — edited inline on dblclick. */
|
|
42
|
+
name?: string;
|
|
43
|
+
/** Which C4 level this sheet draws. Absent means a free sketch. */
|
|
44
|
+
level?: C4BoardLevel;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The C4 board: the sheet one diagram of the model is drawn on — a context
|
|
48
|
+
* diagram, a container diagram, a component diagram. A framework background like
|
|
49
|
+
* every other one in the library: the user drops nodes on top of it, and a
|
|
50
|
+
* connector never snaps to it.
|
|
51
|
+
*
|
|
52
|
+
* It carries a NAME, and optionally the LEVEL it draws. A C4 diagram has no
|
|
53
|
+
* frame of reference — a system drawn top left says nothing more than one drawn
|
|
54
|
+
* bottom right — so there are no axes, no zones and no partition to declare.
|
|
55
|
+
*
|
|
56
|
+
* What it LOOKS like is declared, not coded: see `C4_BOARD_BACKGROUND` in
|
|
57
|
+
* `@labre/affine-gfx-c4`.
|
|
58
|
+
*/
|
|
59
|
+
export declare class C4BoardElementModel extends FrameworkBackgroundElementModel<C4BoardProps> {
|
|
60
|
+
get type(): string;
|
|
61
|
+
accessor name: string;
|
|
62
|
+
accessor resizeEnabled: boolean;
|
|
63
|
+
accessor rotate: number;
|
|
64
|
+
accessor xywh: SerializedXYWH;
|
|
65
|
+
/**
|
|
66
|
+
* Which C4 level this sheet draws — the only OPTIONAL field of this element,
|
|
67
|
+
* and optional on purpose.
|
|
68
|
+
*
|
|
69
|
+
* `@field()`'s `init` writes nothing for an `undefined` default, so a board
|
|
70
|
+
* that never states its level stays byte-identical to one created before this
|
|
71
|
+
* value existed: no schema version bump, no migration, and every document
|
|
72
|
+
* already on disk opens and paints exactly as it did. The same call
|
|
73
|
+
* `C4BoundaryElementModel.variant` makes, for the same reason.
|
|
74
|
+
*
|
|
75
|
+
* ## Why there is no default to read, unlike the boundary's `variant`
|
|
76
|
+
*
|
|
77
|
+
* A boundary that says nothing still IS one of the two levels, and reading it
|
|
78
|
+
* as `'system'` is the only answer a reader could give. A board that says
|
|
79
|
+
* nothing is a different thing altogether: a free sketch, whose author has not
|
|
80
|
+
* told the tool which of the three sheets they are drawing. Guessing would
|
|
81
|
+
* hand every diagram already in existence a level nobody chose, and a rule
|
|
82
|
+
* reading it would start indicting drawings on the strength of that guess.
|
|
83
|
+
*
|
|
84
|
+
* So absent stays absent, and the rules that read it evaluate nothing at all
|
|
85
|
+
* on a board that declares none — no fact, no rule (PRD principle 8).
|
|
86
|
+
*/
|
|
87
|
+
accessor level: C4BoardLevel | undefined;
|
|
88
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { field } from '../../../std/gfx/index.js';
|
|
36
|
+
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
37
|
+
/**
|
|
38
|
+
* The C4 board: the sheet one diagram of the model is drawn on — a context
|
|
39
|
+
* diagram, a container diagram, a component diagram. A framework background like
|
|
40
|
+
* every other one in the library: the user drops nodes on top of it, and a
|
|
41
|
+
* connector never snaps to it.
|
|
42
|
+
*
|
|
43
|
+
* It carries a NAME, and optionally the LEVEL it draws. A C4 diagram has no
|
|
44
|
+
* frame of reference — a system drawn top left says nothing more than one drawn
|
|
45
|
+
* bottom right — so there are no axes, no zones and no partition to declare.
|
|
46
|
+
*
|
|
47
|
+
* What it LOOKS like is declared, not coded: see `C4_BOARD_BACKGROUND` in
|
|
48
|
+
* `@labre/affine-gfx-c4`.
|
|
49
|
+
*/
|
|
50
|
+
let C4BoardElementModel = (() => {
|
|
51
|
+
let _classSuper = FrameworkBackgroundElementModel;
|
|
52
|
+
let _name_decorators;
|
|
53
|
+
let _name_initializers = [];
|
|
54
|
+
let _name_extraInitializers = [];
|
|
55
|
+
let _resizeEnabled_decorators;
|
|
56
|
+
let _resizeEnabled_initializers = [];
|
|
57
|
+
let _resizeEnabled_extraInitializers = [];
|
|
58
|
+
let _rotate_decorators;
|
|
59
|
+
let _rotate_initializers = [];
|
|
60
|
+
let _rotate_extraInitializers = [];
|
|
61
|
+
let _xywh_decorators;
|
|
62
|
+
let _xywh_initializers = [];
|
|
63
|
+
let _xywh_extraInitializers = [];
|
|
64
|
+
let _level_decorators;
|
|
65
|
+
let _level_initializers = [];
|
|
66
|
+
let _level_extraInitializers = [];
|
|
67
|
+
return class C4BoardElementModel extends _classSuper {
|
|
68
|
+
static {
|
|
69
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
70
|
+
_name_decorators = [field('C4 diagram')];
|
|
71
|
+
_resizeEnabled_decorators = [field(true)];
|
|
72
|
+
_rotate_decorators = [field(0)];
|
|
73
|
+
_xywh_decorators = [field()];
|
|
74
|
+
_level_decorators = [field()];
|
|
75
|
+
__esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
76
|
+
__esDecorate(this, null, _resizeEnabled_decorators, { kind: "accessor", name: "resizeEnabled", static: false, private: false, access: { has: obj => "resizeEnabled" in obj, get: obj => obj.resizeEnabled, set: (obj, value) => { obj.resizeEnabled = value; } }, metadata: _metadata }, _resizeEnabled_initializers, _resizeEnabled_extraInitializers);
|
|
77
|
+
__esDecorate(this, null, _rotate_decorators, { kind: "accessor", name: "rotate", static: false, private: false, access: { has: obj => "rotate" in obj, get: obj => obj.rotate, set: (obj, value) => { obj.rotate = value; } }, metadata: _metadata }, _rotate_initializers, _rotate_extraInitializers);
|
|
78
|
+
__esDecorate(this, null, _xywh_decorators, { kind: "accessor", name: "xywh", static: false, private: false, access: { has: obj => "xywh" in obj, get: obj => obj.xywh, set: (obj, value) => { obj.xywh = value; } }, metadata: _metadata }, _xywh_initializers, _xywh_extraInitializers);
|
|
79
|
+
__esDecorate(this, null, _level_decorators, { kind: "accessor", name: "level", static: false, private: false, access: { has: obj => "level" in obj, get: obj => obj.level, set: (obj, value) => { obj.level = value; } }, metadata: _metadata }, _level_initializers, _level_extraInitializers);
|
|
80
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
81
|
+
}
|
|
82
|
+
get type() {
|
|
83
|
+
return 'c4Board';
|
|
84
|
+
}
|
|
85
|
+
#name_accessor_storage = __runInitializers(this, _name_initializers, 'C4 diagram');
|
|
86
|
+
get name() { return this.#name_accessor_storage; }
|
|
87
|
+
set name(value) { this.#name_accessor_storage = value; }
|
|
88
|
+
#resizeEnabled_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _resizeEnabled_initializers, true));
|
|
89
|
+
get resizeEnabled() { return this.#resizeEnabled_accessor_storage; }
|
|
90
|
+
set resizeEnabled(value) { this.#resizeEnabled_accessor_storage = value; }
|
|
91
|
+
#rotate_accessor_storage = (__runInitializers(this, _resizeEnabled_extraInitializers), __runInitializers(this, _rotate_initializers, 0));
|
|
92
|
+
get rotate() { return this.#rotate_accessor_storage; }
|
|
93
|
+
set rotate(value) { this.#rotate_accessor_storage = value; }
|
|
94
|
+
#xywh_accessor_storage = (__runInitializers(this, _rotate_extraInitializers), __runInitializers(this, _xywh_initializers, '[0,0,1400,900]'));
|
|
95
|
+
get xywh() { return this.#xywh_accessor_storage; }
|
|
96
|
+
set xywh(value) { this.#xywh_accessor_storage = value; }
|
|
97
|
+
#level_accessor_storage = (__runInitializers(this, _xywh_extraInitializers), __runInitializers(this, _level_initializers, undefined));
|
|
98
|
+
/**
|
|
99
|
+
* Which C4 level this sheet draws — the only OPTIONAL field of this element,
|
|
100
|
+
* and optional on purpose.
|
|
101
|
+
*
|
|
102
|
+
* `@field()`'s `init` writes nothing for an `undefined` default, so a board
|
|
103
|
+
* that never states its level stays byte-identical to one created before this
|
|
104
|
+
* value existed: no schema version bump, no migration, and every document
|
|
105
|
+
* already on disk opens and paints exactly as it did. The same call
|
|
106
|
+
* `C4BoundaryElementModel.variant` makes, for the same reason.
|
|
107
|
+
*
|
|
108
|
+
* ## Why there is no default to read, unlike the boundary's `variant`
|
|
109
|
+
*
|
|
110
|
+
* A boundary that says nothing still IS one of the two levels, and reading it
|
|
111
|
+
* as `'system'` is the only answer a reader could give. A board that says
|
|
112
|
+
* nothing is a different thing altogether: a free sketch, whose author has not
|
|
113
|
+
* told the tool which of the three sheets they are drawing. Guessing would
|
|
114
|
+
* hand every diagram already in existence a level nobody chose, and a rule
|
|
115
|
+
* reading it would start indicting drawings on the strength of that guess.
|
|
116
|
+
*
|
|
117
|
+
* So absent stays absent, and the rules that read it evaluate nothing at all
|
|
118
|
+
* on a board that declares none — no fact, no rule (PRD principle 8).
|
|
119
|
+
*/
|
|
120
|
+
get level() { return this.#level_accessor_storage; }
|
|
121
|
+
set level(value) { this.#level_accessor_storage = value; }
|
|
122
|
+
constructor() {
|
|
123
|
+
super(...arguments);
|
|
124
|
+
__runInitializers(this, _level_extraInitializers);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
})();
|
|
128
|
+
export { C4BoardElementModel };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { SerializedXYWH } from '../../../global/gfx/index.js';
|
|
2
|
+
import type { FrameworkBackgroundProps } from '../framework-background/index.js';
|
|
3
|
+
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Which level a boundary encloses. C4 draws the two identically — a dashed
|
|
6
|
+
* rectangle round a group of elements — and the difference is entirely in what
|
|
7
|
+
* the label says, which is why this is one element type with a variant rather
|
|
8
|
+
* than two.
|
|
9
|
+
*/
|
|
10
|
+
export type C4BoundaryVariant = 'system' | 'container';
|
|
11
|
+
export type C4BoundaryProps = FrameworkBackgroundProps & {
|
|
12
|
+
/** The boundary name, written bottom-left — edited inline on dblclick. */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** Which level this boundary encloses. Absent behaves as `'system'`. */
|
|
15
|
+
variant?: C4BoundaryVariant;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A C4 boundary: the dashed rectangle drawn AROUND a group of elements to say
|
|
19
|
+
* "all of this is one system" (or one container). A framework background, so
|
|
20
|
+
* nodes are dropped on it and connectors never snap to it — but a transparent
|
|
21
|
+
* one, unlike every other background in the library: a boundary is drawn over
|
|
22
|
+
* the board it sits on, and an opaque card would hide the diagram it encloses.
|
|
23
|
+
*
|
|
24
|
+
* What it LOOKS like is declared, not coded: see `C4_BOUNDARY_BACKGROUND` in
|
|
25
|
+
* `@labre/affine-gfx-c4`.
|
|
26
|
+
*/
|
|
27
|
+
export declare class C4BoundaryElementModel extends FrameworkBackgroundElementModel<C4BoundaryProps> {
|
|
28
|
+
get type(): string;
|
|
29
|
+
accessor name: string;
|
|
30
|
+
accessor resizeEnabled: boolean;
|
|
31
|
+
accessor rotate: number;
|
|
32
|
+
accessor xywh: SerializedXYWH;
|
|
33
|
+
/**
|
|
34
|
+
* The level enclosed — the only OPTIONAL field of this element, and optional
|
|
35
|
+
* on purpose.
|
|
36
|
+
*
|
|
37
|
+
* `@field()`'s `init` writes nothing for an `undefined` default, so a boundary
|
|
38
|
+
* that never states its level stays byte-identical to one created before this
|
|
39
|
+
* value existed: no schema version bump, no migration, and every document
|
|
40
|
+
* already on disk opens and paints exactly as it did. The same call
|
|
41
|
+
* `BpmnPoolElementModel.lanes` makes, for the same reason.
|
|
42
|
+
*
|
|
43
|
+
* Absent reads as `'system'` everywhere — the outermost boundary, which is the
|
|
44
|
+
* one a reader draws first and the one the default wording names.
|
|
45
|
+
*/
|
|
46
|
+
accessor variant: C4BoundaryVariant | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The variant every reader of this element should use — `variant` with its
|
|
49
|
+
* documented default already applied.
|
|
50
|
+
*
|
|
51
|
+
* Derived, not stored: nothing here reaches the document, and an element that
|
|
52
|
+
* never stated a level is untouched by the existence of this getter.
|
|
53
|
+
*
|
|
54
|
+
* It is what lets the declaration gate a piece of itself on the level
|
|
55
|
+
* (`variantProp`), which a raw optional field cannot do: an unstated `variant`
|
|
56
|
+
* stringifies to `"undefined"`, matches no declared variant, and would paint
|
|
57
|
+
* NOTHING — the trap the boundary declaration used to avoid by declaring no
|
|
58
|
+
* `variantProp` at all. Reading the default here removes the trap instead of
|
|
59
|
+
* routing round it, so the frame can finally write the bracket line the
|
|
60
|
+
* stencil puts under a boundary's name.
|
|
61
|
+
*/
|
|
62
|
+
get variantOrDefault(): C4BoundaryVariant;
|
|
63
|
+
}
|