@invana/canvas-core 0.0.14 → 0.0.15
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/{index-C-drjwfS.d.ts → index-CZuSgBOJ.d.ts} +15 -0
- package/dist/index.d.ts +1519 -167
- package/dist/index.js +495 -29
- package/dist/index.js.map +1 -1
- package/dist/specs/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FlushMode, S as SpecFlush, L as Listener, C as CameraTransform$1, R as Rect, a as SpecStore, P as Point, B as BaseShapeSpec, b as BaseConnectorSpec, D as DecorationSpec, c as BadgeOptions, E as EffectSpec, d as LabelContent, e as LabelWrap, H as HitResult, f as EventEmitter, g as ElementEventMap, h as EventMap, I as IAnchor, i as IRouter, j as IPathStyle, k as Path, V as Vec2, l as BadgePlacement, m as ShapeFill, n as ShapeStroke } from './index-
|
|
2
|
-
export { A as AnchorCtx, o as AnchorShapeRef, p as AnchorSpec, q as ArcSpec, r as BadgeShapeSpec, s as CircleSpec, t as CompositePart, u as CompositePartFill, v as CompositePartStroke, w as CompositeRootSpec, x as CompositeSpec, y as ConnectorBadgePlacement, z as ConnectorEndpointSpec, G as ConnectorLabelPlacement, J as ConnectorLabelStyle, K as ConnectorPaintStyle, M as DecorationTarget, N as EffectTarget, O as EffectTargetKind, Q as EllipseSpec, T as Endpoint, U as FlowParticlesConnectorDecorationStyle, W as FlyMarkerConnectorDecorationStyle, X as GlowConnectorDecorationStyle, Y as GlowDecorationStyle, Z as HtmlTagStyle, _ as InsetAnchor, $ as InsetFillLayer, a0 as LabelBackground, a1 as LabelStyleCommon, a2 as LabelVisibility, a3 as LiquidFillDecorationStyle, a4 as LocalSpec, a5 as MarchingAntsConnectorDecorationStyle, a6 as MarchingAntsDecorationStyle, a7 as MarkerShapeSpec, a8 as NamedBadgePlacement, a9 as Obstacle, aa as PathCommand, ab as PathSpec, ac as PathStyleEndpoints, ad as PlaneName, ae as PolygonSpec, af as Polyline, ag as PulseRingDecorationStyle, ah as RectSpec, ai as RegisterDecorationOptions, aj as RegisterEffectOptions, ak as RegularPolygonSpec, al as RenderStats, am as ResizeHandleDecorationStyle, an as ResizeHandlePlacement, ao as RevealConnectorDecorationStyle, ap as RevealDirection, aq as RevealEasingName, ar as RevealHostStroke, as as RevealRepeat, at as RingConnectorDecorationStyle, au as RingDecorationStyle, av as RippleConnectorDecorationStyle, aw as RoundedCorner, ax as RouterCtx, ay as SelectionFrameBorderStyle, az as SelectionFrameDecorationStyle, aA as SelectionFrameHandleHit, aB as SelectionFrameHandleShape, aC as SelectionFramePlacement, aD as ShapeFillLayer, aE as ShapeLabelPlacement, aF as ShapeLabelStyle, aG as ShapePaintStyle, aH as ShapeSpec, aI as Size, aJ as StarSpec, aK as StyleOverride, aL as TabAlign, aM as TabbedRectGeometry, aN as TabbedRectGeometrySpec, aO as TabbedRectSpec, aP as ToggleDecorationStyle, aQ as ToggleHitGeometry, aR as TogglePlacement, aS as TransformDelta, aT as boundsOfArc, aU as boundsOfCircle, aV as boundsOfComposite, aW as boundsOfCompositeRoot, aX as boundsOfEllipse, aY as boundsOfPath, aZ as boundsOfPolygon, a_ as boundsOfRect, a$ as boundsOfRegularPolygon, b0 as boundsOfSpec, b1 as boundsOfStar, b2 as collapsedSpec, b3 as collapsedTabbedRect, b4 as compositeRootOffset, b5 as connectorGeometryKey, b6 as containsArc, b7 as containsCircle, b8 as containsComposite, b9 as containsEllipse, ba as containsPath, bb as containsPolygon, bc as containsRect, bd as containsRegularPolygon, be as containsSpec, bf as containsStar, bg as containsTabbedRect, bh as distanceToOutlineSq, bi as distanceToSegmentSq, bj as fitSpecToContent, bk as fitTabbedRectToContent, bl as hasSilhouetteFill, bm as offsetPolygon, bn as pointInPolygon, bo as polygonBounds, bp as polygonContainsInflated, bq as rayPolygonIntersection, br as regularPolygonVertices, bs as resolveCompositeRoot, bt as roundedPolygonOutline, bu as scaleArc, bv as scaleCircle, bw as scaleEllipse, bx as scalePath, by as scalePolygon, bz as scaleRect, bA as scaleRegularPolygon, bB as scaleSpec, bC as scaleStar, bD as scaleTabbedRect, bE as scheduleFlush, bF as starVertices, bG as strokeBandOf, bH as tabbedRectBounds, bI as tabbedRectFoldLine, bJ as tabbedRectGeometry, bK as tabbedRectOutline, bL as tabbedRectTabBox, bM as tabbedRectTabWidth, bN as verticesOfRegularPolygon, bO as verticesOfStar } from './index-
|
|
1
|
+
import { F as FlushMode, S as SpecFlush, L as Listener, C as CameraTransform$1, R as Rect, a as SpecStore, P as Point, B as BaseShapeSpec, b as BaseConnectorSpec, D as DecorationSpec, c as BadgeOptions, E as EffectSpec, d as LabelContent, e as LabelWrap, H as HitResult, f as EventEmitter, g as ElementEventMap, h as EventMap, I as IAnchor, i as IRouter, j as IPathStyle, k as Path, V as Vec2, l as BadgePlacement, m as ShapeFill, n as ShapeStroke } from './index-CZuSgBOJ.js';
|
|
2
|
+
export { A as AnchorCtx, o as AnchorShapeRef, p as AnchorSpec, q as ArcSpec, r as BadgeShapeSpec, s as CircleSpec, t as CompositePart, u as CompositePartFill, v as CompositePartStroke, w as CompositeRootSpec, x as CompositeSpec, y as ConnectorBadgePlacement, z as ConnectorEndpointSpec, G as ConnectorLabelPlacement, J as ConnectorLabelStyle, K as ConnectorPaintStyle, M as DecorationTarget, N as EffectTarget, O as EffectTargetKind, Q as EllipseSpec, T as Endpoint, U as FlowParticlesConnectorDecorationStyle, W as FlyMarkerConnectorDecorationStyle, X as GlowConnectorDecorationStyle, Y as GlowDecorationStyle, Z as HtmlTagStyle, _ as InsetAnchor, $ as InsetFillLayer, a0 as LabelBackground, a1 as LabelStyleCommon, a2 as LabelVisibility, a3 as LiquidFillDecorationStyle, a4 as LocalSpec, a5 as MarchingAntsConnectorDecorationStyle, a6 as MarchingAntsDecorationStyle, a7 as MarkerShapeSpec, a8 as NamedBadgePlacement, a9 as Obstacle, aa as PathCommand, ab as PathSpec, ac as PathStyleEndpoints, ad as PlaneName, ae as PolygonSpec, af as Polyline, ag as PulseRingDecorationStyle, ah as RectSpec, ai as RegisterDecorationOptions, aj as RegisterEffectOptions, ak as RegularPolygonSpec, al as RenderStats, am as ResizeHandleDecorationStyle, an as ResizeHandlePlacement, ao as RevealConnectorDecorationStyle, ap as RevealDirection, aq as RevealEasingName, ar as RevealHostStroke, as as RevealRepeat, at as RingConnectorDecorationStyle, au as RingDecorationStyle, av as RippleConnectorDecorationStyle, aw as RoundedCorner, ax as RouterCtx, ay as SelectionFrameBorderStyle, az as SelectionFrameDecorationStyle, aA as SelectionFrameHandleHit, aB as SelectionFrameHandleShape, aC as SelectionFramePlacement, aD as ShapeFillLayer, aE as ShapeLabelPlacement, aF as ShapeLabelStyle, aG as ShapePaintStyle, aH as ShapeSpec, aI as Size, aJ as StarSpec, aK as StyleOverride, aL as TabAlign, aM as TabbedRectGeometry, aN as TabbedRectGeometrySpec, aO as TabbedRectSpec, aP as ToggleDecorationStyle, aQ as ToggleHitGeometry, aR as TogglePlacement, aS as TransformDelta, aT as boundsOfArc, aU as boundsOfCircle, aV as boundsOfComposite, aW as boundsOfCompositeRoot, aX as boundsOfEllipse, aY as boundsOfPath, aZ as boundsOfPolygon, a_ as boundsOfRect, a$ as boundsOfRegularPolygon, b0 as boundsOfSpec, b1 as boundsOfStar, b2 as collapsedSpec, b3 as collapsedTabbedRect, b4 as compositeRootOffset, b5 as connectorGeometryKey, b6 as containsArc, b7 as containsCircle, b8 as containsComposite, b9 as containsEllipse, ba as containsPath, bb as containsPolygon, bc as containsRect, bd as containsRegularPolygon, be as containsSpec, bf as containsStar, bg as containsTabbedRect, bh as distanceToOutlineSq, bi as distanceToSegmentSq, bj as fitSpecToContent, bk as fitTabbedRectToContent, bl as hasSilhouetteFill, bm as offsetPolygon, bn as pointInPolygon, bo as polygonBounds, bp as polygonContainsInflated, bq as rayPolygonIntersection, br as regularPolygonVertices, bs as resolveCompositeRoot, bt as roundedPolygonOutline, bu as scaleArc, bv as scaleCircle, bw as scaleEllipse, bx as scalePath, by as scalePolygon, bz as scaleRect, bA as scaleRegularPolygon, bB as scaleSpec, bC as scaleStar, bD as scaleTabbedRect, bE as scheduleFlush, bF as starVertices, bG as strokeBandOf, bH as tabbedRectBounds, bI as tabbedRectFoldLine, bJ as tabbedRectGeometry, bK as tabbedRectOutline, bL as tabbedRectTabBox, bM as tabbedRectTabWidth, bN as verticesOfRegularPolygon, bO as verticesOfStar } from './index-CZuSgBOJ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The **device-shaped** half of the renderer seam — the part the kernel can
|
|
@@ -682,6 +682,14 @@ interface CanvasGlobalEvents {
|
|
|
682
682
|
'scene:behaviour:register': {
|
|
683
683
|
id: string;
|
|
684
684
|
};
|
|
685
|
+
/**
|
|
686
|
+
* A behaviour was removed via `BehaviourRegistry.unregister` (or `clear`).
|
|
687
|
+
* Fires after `scene:behaviour:disable` (when it was enabled) and after the
|
|
688
|
+
* behaviour is destroyed — the counterpart of `scene:layer:remove`.
|
|
689
|
+
*/
|
|
690
|
+
'scene:behaviour:unregister': {
|
|
691
|
+
id: string;
|
|
692
|
+
};
|
|
685
693
|
'scene:behaviour:enable': {
|
|
686
694
|
id: string;
|
|
687
695
|
};
|
|
@@ -742,16 +750,26 @@ interface CanvasGlobalEvents {
|
|
|
742
750
|
nodeCount?: number;
|
|
743
751
|
edgeCount?: number;
|
|
744
752
|
animate?: boolean;
|
|
753
|
+
/** The run was asked to leave the camera alone (`LayoutRunOptions.preserveCamera`). */
|
|
754
|
+
preserveCamera?: boolean;
|
|
755
|
+
/** The run frames itself (`LayoutRunOptions.fitCamera`) — other fitters stand down. */
|
|
756
|
+
fitCamera?: boolean;
|
|
745
757
|
};
|
|
746
758
|
/** A layout run ended. `reason` distinguishes a natural settle from an external stop / abort. */
|
|
747
759
|
'layout:run:end': {
|
|
748
760
|
id: string;
|
|
749
761
|
layerId: string;
|
|
750
762
|
reason?: 'settled' | 'stopped' | 'cancelled';
|
|
763
|
+
/** The run was asked to leave the camera alone (`LayoutRunOptions.preserveCamera`). */
|
|
764
|
+
preserveCamera?: boolean;
|
|
765
|
+
/** The run frames itself (`LayoutRunOptions.fitCamera`) — other fitters stand down. */
|
|
766
|
+
fitCamera?: boolean;
|
|
751
767
|
};
|
|
752
768
|
'layout:run:tick': {
|
|
753
769
|
id: string;
|
|
754
770
|
progress?: number;
|
|
771
|
+
preserveCamera?: boolean;
|
|
772
|
+
fitCamera?: boolean;
|
|
755
773
|
};
|
|
756
774
|
'canvas:renderer:ready': {
|
|
757
775
|
backend: string;
|
|
@@ -986,6 +1004,640 @@ declare const EASING_NAMES: EasingName[];
|
|
|
986
1004
|
*/
|
|
987
1005
|
declare function resolveEasing(name: EasingName | undefined, fallback?: Easing): Easing;
|
|
988
1006
|
|
|
1007
|
+
/**
|
|
1008
|
+
* Control panels — floating UI chrome inside the canvas, as **pure data**.
|
|
1009
|
+
*
|
|
1010
|
+
* A control panel is a small toolbar / widget cluster pinned over the canvas
|
|
1011
|
+
* (zoom buttons bottom-right, a brand + mode picker top-left, …). Its spec lives
|
|
1012
|
+
* in `CanvasView.definition.controlPanels`, so panels persist, export and
|
|
1013
|
+
* (later) sync like every other part of the definition. Edits are ordinary
|
|
1014
|
+
* `view` patches: a Studio edit (`canvas.update(…, 'edit:control-panels')`) is
|
|
1015
|
+
* recorded by `Canvas.history` and undone by the `history.undo` command, while a
|
|
1016
|
+
* programmatic write (a `<ControlPanel>` mount) is not.
|
|
1017
|
+
*
|
|
1018
|
+
* Specs hold **no closures and no components**: an item names what it does by
|
|
1019
|
+
* string — a `command` (resolved by the canvas's `CommandRegistry`), an `icon`
|
|
1020
|
+
* and a `widget` (resolved by the UI kit's registries), or a `slot` (non-persisted
|
|
1021
|
+
* React content registered by the declaring component). The kernel only stores
|
|
1022
|
+
* and validates the shape; drawing it is the UI kit's job.
|
|
1023
|
+
*/
|
|
1024
|
+
/** A preset anchor on the canvas's 9-point grid. */
|
|
1025
|
+
type ControlPanelAnchor = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
1026
|
+
/**
|
|
1027
|
+
* Exact insets from the canvas edges, in px or any CSS length. Set one of
|
|
1028
|
+
* `top`/`bottom` and one of `left`/`right` (setting both opposite sides
|
|
1029
|
+
* stretches the panel between them).
|
|
1030
|
+
*/
|
|
1031
|
+
interface ControlPanelInsets {
|
|
1032
|
+
top?: number | string;
|
|
1033
|
+
right?: number | string;
|
|
1034
|
+
bottom?: number | string;
|
|
1035
|
+
left?: number | string;
|
|
1036
|
+
}
|
|
1037
|
+
/** Where a panel sits: a preset {@link ControlPanelAnchor} or exact {@link ControlPanelInsets}. */
|
|
1038
|
+
type ControlPanelPosition = ControlPanelAnchor | ControlPanelInsets;
|
|
1039
|
+
/** Fields shared by every {@link ControlItemSpec}. */
|
|
1040
|
+
interface ControlItemBase {
|
|
1041
|
+
/** Stable key within the panel; defaults to the item's index. */
|
|
1042
|
+
key?: string;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* A button that runs a named command on click. Disabled while the command is
|
|
1046
|
+
* missing or reports `isEnabled() === false`.
|
|
1047
|
+
*
|
|
1048
|
+
* Unlike a {@link ControlToggleItemSpec} it never shows a pressed state, but it
|
|
1049
|
+
* may still **swap its face** while the command's `isActive(args)` is true — the
|
|
1050
|
+
* `active*` fields below. That's a Run button that turns into Stop while a
|
|
1051
|
+
* layout runs (`layout.toggle`), or an Erase button that reads "Selection"
|
|
1052
|
+
* while something is selected (`graph.erase`).
|
|
1053
|
+
*/
|
|
1054
|
+
interface ControlCommandItemSpec extends ControlItemBase {
|
|
1055
|
+
type: 'command';
|
|
1056
|
+
/** Command name in the canvas's `CommandRegistry`, e.g. `'camera.fit'`. */
|
|
1057
|
+
command: string;
|
|
1058
|
+
/** Arguments passed to the command's `run` / `isEnabled`. Must be JSON. */
|
|
1059
|
+
args?: unknown;
|
|
1060
|
+
/** Icon name, resolved by the UI kit's icon registry (e.g. `'maximize'`). */
|
|
1061
|
+
icon?: string;
|
|
1062
|
+
/** Tooltip + accessible label. */
|
|
1063
|
+
label: string;
|
|
1064
|
+
/** Optional visible text beside the icon. */
|
|
1065
|
+
text?: string;
|
|
1066
|
+
/** Icon name while the command is active. Defaults to {@link icon}. */
|
|
1067
|
+
activeIcon?: string;
|
|
1068
|
+
/** Tooltip + label while the command is active. Defaults to {@link label}. */
|
|
1069
|
+
activeLabel?: string;
|
|
1070
|
+
/** Visible text while the command is active. Defaults to {@link text}. */
|
|
1071
|
+
activeText?: string;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* A two-state toggle bound to a command: its active state is the command's
|
|
1075
|
+
* `isActive(args)`, and clicking runs the command (which flips it).
|
|
1076
|
+
*/
|
|
1077
|
+
interface ControlToggleItemSpec extends ControlItemBase {
|
|
1078
|
+
type: 'toggle';
|
|
1079
|
+
/** Command name in the canvas's `CommandRegistry`, e.g. `'view.lock'`. */
|
|
1080
|
+
command: string;
|
|
1081
|
+
/** Arguments passed to the command's `run` / `isActive` / `isEnabled`. Must be JSON. */
|
|
1082
|
+
args?: unknown;
|
|
1083
|
+
/** Icon name while inactive (and while active, unless {@link activeIcon} is set). */
|
|
1084
|
+
icon?: string;
|
|
1085
|
+
/** Icon name while active. */
|
|
1086
|
+
activeIcon?: string;
|
|
1087
|
+
/** Tooltip + label while inactive. */
|
|
1088
|
+
label: string;
|
|
1089
|
+
/** Tooltip + label while active. Defaults to {@link label}. */
|
|
1090
|
+
activeLabel?: string;
|
|
1091
|
+
}
|
|
1092
|
+
/** One option of a {@link ControlChoiceItemSpec}. */
|
|
1093
|
+
interface ControlChoiceOption {
|
|
1094
|
+
/** Passed to the command as `args.value` when picked. */
|
|
1095
|
+
value: string;
|
|
1096
|
+
/** Human label. */
|
|
1097
|
+
label: string;
|
|
1098
|
+
/** Icon name, resolved by the UI kit's icon registry. */
|
|
1099
|
+
icon?: string;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* A pick-one control (select mode, edge type, active layout) bound to a command
|
|
1103
|
+
* that reports a `value`. Picking an option runs the command with
|
|
1104
|
+
* `{ ...args, value }`.
|
|
1105
|
+
*/
|
|
1106
|
+
interface ControlChoiceItemSpec extends ControlItemBase {
|
|
1107
|
+
type: 'choice';
|
|
1108
|
+
/** Command name in the canvas's `CommandRegistry`, e.g. `'select.mode'`. */
|
|
1109
|
+
command: string;
|
|
1110
|
+
/** Arguments passed to the command (plus `value` when picking). Must be JSON. */
|
|
1111
|
+
args?: Record<string, unknown>;
|
|
1112
|
+
/** Trigger label + menu heading. */
|
|
1113
|
+
label: string;
|
|
1114
|
+
/** The options. Default: the command's own `options()`. */
|
|
1115
|
+
options?: ControlChoiceOption[];
|
|
1116
|
+
/** A collapsed dropdown (default) or every option inline as a segmented group. */
|
|
1117
|
+
display?: 'dropdown' | 'segmented';
|
|
1118
|
+
}
|
|
1119
|
+
/** A named widget from the UI kit's widget registry (e.g. `'zoom-readout'`). */
|
|
1120
|
+
interface ControlWidgetItemSpec extends ControlItemBase {
|
|
1121
|
+
type: 'widget';
|
|
1122
|
+
/** Widget name in the UI kit's widget registry. */
|
|
1123
|
+
widget: string;
|
|
1124
|
+
/** Widget options. Must be JSON. */
|
|
1125
|
+
options?: Record<string, unknown>;
|
|
1126
|
+
}
|
|
1127
|
+
/** A group separator. */
|
|
1128
|
+
interface ControlDividerItemSpec extends ControlItemBase {
|
|
1129
|
+
type: 'divider';
|
|
1130
|
+
}
|
|
1131
|
+
/** Static text (a brand, a caption). */
|
|
1132
|
+
interface ControlTextItemSpec extends ControlItemBase {
|
|
1133
|
+
type: 'text';
|
|
1134
|
+
text: string;
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* A placeholder for **non-persisted** React content, registered at runtime under
|
|
1138
|
+
* {@link slot} (the declaring component's `children` use the panel id). Exported
|
|
1139
|
+
* state keeps the placeholder; a canvas that never registers the slot renders
|
|
1140
|
+
* nothing there.
|
|
1141
|
+
*/
|
|
1142
|
+
interface ControlSlotItemSpec extends ControlItemBase {
|
|
1143
|
+
type: 'slot';
|
|
1144
|
+
/** Slot name in the runtime slot registry. */
|
|
1145
|
+
slot: string;
|
|
1146
|
+
}
|
|
1147
|
+
/** One item in a {@link ControlPanelSpec} — pure JSON, resolved by name at render time. */
|
|
1148
|
+
type ControlItemSpec = ControlCommandItemSpec | ControlToggleItemSpec | ControlChoiceItemSpec | ControlWidgetItemSpec | ControlDividerItemSpec | ControlTextItemSpec | ControlSlotItemSpec;
|
|
1149
|
+
/**
|
|
1150
|
+
* Which surface draws a panel. `'canvas'` floats it over the canvas (the
|
|
1151
|
+
* `position` / `offset` / `stretch` fields place it there). The `header-*` and
|
|
1152
|
+
* `footer-*` placements put it in a region of the app shell's header or footer
|
|
1153
|
+
* rail instead — `GraphCanvasApp`'s left / centre / right — where it flows
|
|
1154
|
+
* inline after that region's own content: `position`, `offset` and `stretch`
|
|
1155
|
+
* are ignored, it is always a row, and `surface` defaults to `false`. A shell
|
|
1156
|
+
* that doesn't draw a rail ignores panels placed in it.
|
|
1157
|
+
*/
|
|
1158
|
+
type ControlPanelPlacement = 'canvas' | 'header-left' | 'header-center' | 'header-right' | 'footer-left' | 'footer-center' | 'footer-right';
|
|
1159
|
+
/**
|
|
1160
|
+
* A control panel — pure JSON, stored in `CanvasView.definition.controlPanels`
|
|
1161
|
+
* keyed by panel id. Floats over the canvas by default; {@link placement} can
|
|
1162
|
+
* put it in the app header or footer instead.
|
|
1163
|
+
*/
|
|
1164
|
+
interface ControlPanelSpec {
|
|
1165
|
+
/** Stable discriminator for tooling (the Studio's editor lookup). */
|
|
1166
|
+
kind: 'control-panel';
|
|
1167
|
+
/**
|
|
1168
|
+
* The surface that draws the panel. Default `'canvas'`. A header / footer
|
|
1169
|
+
* placement is drawn by a host that renders those rail regions
|
|
1170
|
+
* (`GraphCanvasApp`, or `<RegionControlPanels>` in a custom shell);
|
|
1171
|
+
* `<ControlPanels>` skips it.
|
|
1172
|
+
*/
|
|
1173
|
+
placement?: ControlPanelPlacement;
|
|
1174
|
+
/** Where the panel sits over the canvas. Default `'top-left'`. Ignored for a header / footer placement. */
|
|
1175
|
+
position?: ControlPanelPosition;
|
|
1176
|
+
/**
|
|
1177
|
+
* Distance from the anchored edges for a preset {@link position}, in px —
|
|
1178
|
+
* one number for both axes or `{ x, y }`. Ignored for insets and header / footer
|
|
1179
|
+
* placements. Default `8`.
|
|
1180
|
+
*/
|
|
1181
|
+
offset?: number | {
|
|
1182
|
+
x: number;
|
|
1183
|
+
y: number;
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* Item flow. Default: `'vertical'` for the `left` / `right` anchors,
|
|
1187
|
+
* `'horizontal'` everywhere else.
|
|
1188
|
+
*/
|
|
1189
|
+
orientation?: 'horizontal' | 'vertical';
|
|
1190
|
+
/**
|
|
1191
|
+
* Stretch along the anchored edge — full height for `left` / `right`, full
|
|
1192
|
+
* width for `top` / `bottom`. Ignored for corners, `center` and insets.
|
|
1193
|
+
* Default `false`.
|
|
1194
|
+
*/
|
|
1195
|
+
stretch?: boolean;
|
|
1196
|
+
/** Draw the card surface (background, border, shadow). Default `true` over the canvas, `false` in a header / footer rail. */
|
|
1197
|
+
surface?: boolean;
|
|
1198
|
+
/** Show the panel. Default `true`. */
|
|
1199
|
+
visible?: boolean;
|
|
1200
|
+
/** The panel's items, in order. */
|
|
1201
|
+
items: ControlItemSpec[];
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* The operation-log vocabulary — what the canvas records (history) and what a
|
|
1206
|
+
* playbook replays (steps). Types only: the log itself (`createOperationLog`)
|
|
1207
|
+
* lives in `@invana/canvas-store`, the one data door (`GraphStore.applyDelta`)
|
|
1208
|
+
* in `@invana/graph`.
|
|
1209
|
+
*
|
|
1210
|
+
* Two directions, never mixed (RFC
|
|
1211
|
+
* `docs/rfcs/feat/2026-09-28-an-analysis-cannot-be-recorded-or-replayed.md`,
|
|
1212
|
+
* D-7):
|
|
1213
|
+
*
|
|
1214
|
+
* - **History = record.** {@link OperationLog} is written only by the canvas —
|
|
1215
|
+
* view patches from the reactive store and data ops from each registered
|
|
1216
|
+
* {@link DataOpAdapter} — and carries a free-text `actor` on every
|
|
1217
|
+
* {@link LogEntry}. {@link HistoryView} is its read + undo surface
|
|
1218
|
+
* (`canvas.history`).
|
|
1219
|
+
* - **Playbook = script.** A list of JSON {@link StepSpec}s; playing one calls
|
|
1220
|
+
* the ordinary canvas methods, and history records the result like any other
|
|
1221
|
+
* change.
|
|
1222
|
+
*/
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* A **view** share of a change: reactive-store patches plus their inverse.
|
|
1226
|
+
* `undoable: false` marks view intent that is recorded but skipped by plain
|
|
1227
|
+
* undo (selection, focus) — a step, or `revertTo`, still reverts it.
|
|
1228
|
+
*/
|
|
1229
|
+
interface ViewLogPart {
|
|
1230
|
+
kind: 'view';
|
|
1231
|
+
/** The action the store change carried (e.g. `'edit:control-panels'`). */
|
|
1232
|
+
action?: string;
|
|
1233
|
+
/** Forward patches (apply to the state before → the state after). */
|
|
1234
|
+
patches: Patch[];
|
|
1235
|
+
/** Inverse patches (apply to the state after → the state before). */
|
|
1236
|
+
inverse: Patch[];
|
|
1237
|
+
/** Whether plain undo / redo applies this part. */
|
|
1238
|
+
undoable: boolean;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* A **data** share of a change: ops against one registered data source, in
|
|
1242
|
+
* application order. The ops are opaque to the log — the source's
|
|
1243
|
+
* {@link DataOpAdapter} knows how to replay them (a graph source records its
|
|
1244
|
+
* `HistoryOp`s).
|
|
1245
|
+
*/
|
|
1246
|
+
interface DataLogPart {
|
|
1247
|
+
kind: 'data';
|
|
1248
|
+
/** Which {@link DataOpAdapter} replays these ops. */
|
|
1249
|
+
sourceId: string;
|
|
1250
|
+
/** Ops in application order. Undo replays their inverses in reverse. */
|
|
1251
|
+
ops: unknown[];
|
|
1252
|
+
}
|
|
1253
|
+
/** One source's share of a change. A single {@link LogEntry} can hold both kinds. */
|
|
1254
|
+
type LogPart = ViewLogPart | DataLogPart;
|
|
1255
|
+
/**
|
|
1256
|
+
* One history entry — one undo step. Kept for the life of the canvas (no
|
|
1257
|
+
* limit); `clear()` runs only when a new canvas state loads.
|
|
1258
|
+
*/
|
|
1259
|
+
interface LogEntry {
|
|
1260
|
+
/** Stable id, unique within the log. */
|
|
1261
|
+
id: string;
|
|
1262
|
+
/** When the entry was recorded (or last merged into), in `performance.now()` ms. */
|
|
1263
|
+
at: number;
|
|
1264
|
+
/**
|
|
1265
|
+
* Who made the change — free text (`'user'`, `'user:ravi'`, `'engine'`,
|
|
1266
|
+
* `'assistant'`, `'feed:twitter'`). Defaults to the canvas's session actor.
|
|
1267
|
+
*/
|
|
1268
|
+
actor: string;
|
|
1269
|
+
/** Human label: a playbook step's title, a graph transaction's label (`'paste'`). */
|
|
1270
|
+
title?: string;
|
|
1271
|
+
/** Set when a playbook step produced the entry (or adopted it — `Playbook.addStep` of a `sinceLastStep` result). */
|
|
1272
|
+
stepId?: string;
|
|
1273
|
+
/**
|
|
1274
|
+
* Set on a **streamed** entry — writes made with `applyDelta(delta, { coalesce: true })`,
|
|
1275
|
+
* merged into one open entry per actor (RFC G12). Plain undo steps over it;
|
|
1276
|
+
* a playbook's `revertTo` / `replayTo` still applies it.
|
|
1277
|
+
*/
|
|
1278
|
+
coalesced?: true;
|
|
1279
|
+
/** The parts, in the order they were recorded. */
|
|
1280
|
+
parts: LogPart[];
|
|
1281
|
+
}
|
|
1282
|
+
/** Filter for {@link OperationLog.entries}. Absent fields match everything. */
|
|
1283
|
+
interface LogEntryFilter {
|
|
1284
|
+
actor?: string;
|
|
1285
|
+
stepId?: string;
|
|
1286
|
+
}
|
|
1287
|
+
/** What {@link HistoryView.peekUndo} / {@link HistoryView.peekRedo} report about an entry. */
|
|
1288
|
+
interface LogStepInfo {
|
|
1289
|
+
/** The action of the entry's first view part, when it has one. */
|
|
1290
|
+
action?: string;
|
|
1291
|
+
/** The entry's title, when it has one. */
|
|
1292
|
+
title?: string;
|
|
1293
|
+
/** The entry's actor. */
|
|
1294
|
+
actor: string;
|
|
1295
|
+
/** When the entry was recorded. */
|
|
1296
|
+
at: number;
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* The one shape data changes take — `GraphStore.applyDelta`'s argument, and a
|
|
1300
|
+
* playbook step's `data`. Applied in this order: `removed` (edges, then nodes,
|
|
1301
|
+
* cascading), `added` (nodes, then edges; an existing id merges), `updated`
|
|
1302
|
+
* (nodes, then edges), then `hidden`, `shown` and `pinned`. Unknown ids are
|
|
1303
|
+
* skipped.
|
|
1304
|
+
*
|
|
1305
|
+
* Generic over the record types so the vocabulary stays domain-free; a graph
|
|
1306
|
+
* source instantiates it with its node / edge records.
|
|
1307
|
+
*/
|
|
1308
|
+
interface Delta<N extends {
|
|
1309
|
+
id: string;
|
|
1310
|
+
} = {
|
|
1311
|
+
id: string;
|
|
1312
|
+
}, E extends {
|
|
1313
|
+
id: string;
|
|
1314
|
+
} = {
|
|
1315
|
+
id: string;
|
|
1316
|
+
}> {
|
|
1317
|
+
added?: {
|
|
1318
|
+
nodes?: readonly N[];
|
|
1319
|
+
edges?: readonly E[];
|
|
1320
|
+
};
|
|
1321
|
+
updated?: {
|
|
1322
|
+
nodes?: ReadonlyArray<{
|
|
1323
|
+
id: string;
|
|
1324
|
+
patch: Partial<N>;
|
|
1325
|
+
}>;
|
|
1326
|
+
edges?: ReadonlyArray<{
|
|
1327
|
+
id: string;
|
|
1328
|
+
patch: Partial<E>;
|
|
1329
|
+
}>;
|
|
1330
|
+
};
|
|
1331
|
+
removed?: {
|
|
1332
|
+
nodeIds?: readonly string[];
|
|
1333
|
+
edgeIds?: readonly string[];
|
|
1334
|
+
};
|
|
1335
|
+
/** Set the explicit hidden flag on these ids. */
|
|
1336
|
+
hidden?: {
|
|
1337
|
+
nodeIds?: readonly string[];
|
|
1338
|
+
edgeIds?: readonly string[];
|
|
1339
|
+
};
|
|
1340
|
+
/** Clear the explicit hidden flag on these ids. */
|
|
1341
|
+
shown?: {
|
|
1342
|
+
nodeIds?: readonly string[];
|
|
1343
|
+
edgeIds?: readonly string[];
|
|
1344
|
+
};
|
|
1345
|
+
/**
|
|
1346
|
+
* Pin (default) or unpin nodes. `x` / `y`, when both are given, also move the
|
|
1347
|
+
* node there — a drag's final position.
|
|
1348
|
+
*/
|
|
1349
|
+
pinned?: ReadonlyArray<{
|
|
1350
|
+
id: string;
|
|
1351
|
+
pinned?: boolean;
|
|
1352
|
+
x?: number;
|
|
1353
|
+
y?: number;
|
|
1354
|
+
}>;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* A record in a playbook step's {@link Delta}: an id plus whatever fields the
|
|
1358
|
+
* source's records carry (`type`, `data`, `source` / `target` …). Open, because
|
|
1359
|
+
* the vocabulary is domain-free; the source checks the shape when it applies.
|
|
1360
|
+
*/
|
|
1361
|
+
type DeltaRecord = {
|
|
1362
|
+
id: string;
|
|
1363
|
+
} & Record<string, unknown>;
|
|
1364
|
+
/** Options for a recorded data write (`applyDelta(delta, opts)`). */
|
|
1365
|
+
interface DeltaOptions {
|
|
1366
|
+
/** Who the history entry is attributed to. Default: the canvas's session actor. */
|
|
1367
|
+
actor?: string;
|
|
1368
|
+
/** The history entry's label (`'paste'`, `'delete selection'`), shown by undo menus and `peekUndo`. */
|
|
1369
|
+
title?: string;
|
|
1370
|
+
/**
|
|
1371
|
+
* Streamed write (a live feed): merge into the actor's **open** streamed
|
|
1372
|
+
* entry instead of making a new one. Within it, an add and a later remove
|
|
1373
|
+
* of the same id cancel. Plain undo steps over streamed entries; any other
|
|
1374
|
+
* entry, a playbook step, an undo / redo or a clear seals the open one, so
|
|
1375
|
+
* the next streamed write starts a new entry (RFC D-14, G12).
|
|
1376
|
+
*
|
|
1377
|
+
* Hosts should hold feed ticks while `!history.atLatest()` — a streamed
|
|
1378
|
+
* entry recorded while undone entries wait to be redone sits before them.
|
|
1379
|
+
*/
|
|
1380
|
+
coalesce?: boolean;
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* A data source the log can replay: it applies its own recorded ops forward or
|
|
1384
|
+
* backward. Registered with {@link OperationLog.registerSource}; replay runs
|
|
1385
|
+
* with recording suspended, so the source's writes during it are not recorded
|
|
1386
|
+
* again.
|
|
1387
|
+
*/
|
|
1388
|
+
interface DataOpAdapter {
|
|
1389
|
+
/** Matches {@link DataLogPart.sourceId}. */
|
|
1390
|
+
readonly sourceId: string;
|
|
1391
|
+
/** Re-apply `ops` in order (`'forward'`) or their inverses in reverse (`'back'`). */
|
|
1392
|
+
applyOps(ops: readonly unknown[], direction: 'forward' | 'back'): void;
|
|
1393
|
+
/**
|
|
1394
|
+
* The source's one recorded data door (a graph store's `applyDelta`). A
|
|
1395
|
+
* playbook step's `data` goes through it. Absent ⇒ the source takes no
|
|
1396
|
+
* steps.
|
|
1397
|
+
*/
|
|
1398
|
+
applyDelta?(delta: Delta, opts?: DeltaOptions): void;
|
|
1399
|
+
/** Whether the source holds an element with this id — a step's view ids are checked against it. */
|
|
1400
|
+
hasElement?(id: string): boolean;
|
|
1401
|
+
/**
|
|
1402
|
+
* The **net** change `ops` make, as a {@link Delta}: an add and a later
|
|
1403
|
+
* remove of the same id cancel, updates fold into one patch per id, the last
|
|
1404
|
+
* hide / show wins. `HistoryView.sinceLastStep` builds a step's `data` with
|
|
1405
|
+
* it. Absent ⇒ the source's entries contribute no `data`.
|
|
1406
|
+
*/
|
|
1407
|
+
toDelta?(ops: readonly unknown[]): Delta<DeltaRecord, DeltaRecord>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Compact an op list that will be replayed as one unit — used when streamed
|
|
1410
|
+
* writes merge ({@link DeltaOptions.coalesce}): an element added and removed
|
|
1411
|
+
* within `ops` drops out, with every op on it in between. Must replay
|
|
1412
|
+
* (forward and back) to the same states as `ops`. Absent ⇒ ops are kept
|
|
1413
|
+
* as recorded.
|
|
1414
|
+
*/
|
|
1415
|
+
compact?(ops: readonly unknown[]): unknown[];
|
|
1416
|
+
}
|
|
1417
|
+
/** Where an entry id stands in the log: applied, waiting to be redone, or not (or no longer) in it. */
|
|
1418
|
+
type LogEntryStatus = 'applied' | 'pending' | 'unknown';
|
|
1419
|
+
/** Metadata for {@link OperationLog.group}. */
|
|
1420
|
+
interface LogGroupMeta {
|
|
1421
|
+
title?: string;
|
|
1422
|
+
actor?: string;
|
|
1423
|
+
stepId?: string;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* The one operation log behind `canvas.history`. **Written only by the canvas**
|
|
1427
|
+
* — the view store's change stream and each data source's recorded writes; a
|
|
1428
|
+
* consumer reads it through {@link HistoryView}.
|
|
1429
|
+
*
|
|
1430
|
+
* Undo is linear across actors (D-10): it takes back the newest undoable entry,
|
|
1431
|
+
* whoever made it. Entries with no undoable part (a selection change) are kept
|
|
1432
|
+
* in the record but stepped over. A change after an undo keeps the undone
|
|
1433
|
+
* entries as a side branch rather than discarding them.
|
|
1434
|
+
*/
|
|
1435
|
+
interface OperationLog {
|
|
1436
|
+
/** Register a data source for replay. Returns the unregister. */
|
|
1437
|
+
registerSource(adapter: DataOpAdapter): () => void;
|
|
1438
|
+
/** The registered source with this id, or `undefined`. */
|
|
1439
|
+
source(sourceId: string): DataOpAdapter | undefined;
|
|
1440
|
+
/**
|
|
1441
|
+
* Where `entryId` stands: `'applied'`, `'pending'` (undone, waiting to be
|
|
1442
|
+
* redone) or `'unknown'` (never recorded, or moved to a side branch by a
|
|
1443
|
+
* change after an undo). A playbook asks before replaying a step's entries.
|
|
1444
|
+
*/
|
|
1445
|
+
status(entryId: string): LogEntryStatus;
|
|
1446
|
+
/**
|
|
1447
|
+
* Record already-applied data ops as one part. Outside a {@link group} it is
|
|
1448
|
+
* its own entry; inside, it joins the open one. Dropped while the log is
|
|
1449
|
+
* replaying. With `opts.coalesce` (outside a group) the ops merge into the
|
|
1450
|
+
* actor's open streamed entry — see {@link DeltaOptions.coalesce}.
|
|
1451
|
+
*/
|
|
1452
|
+
recordData(sourceId: string, ops: readonly unknown[], actor?: string, opts?: {
|
|
1453
|
+
coalesce?: boolean;
|
|
1454
|
+
}): void;
|
|
1455
|
+
/**
|
|
1456
|
+
* Mark applied entries as belonging to a playbook step — how
|
|
1457
|
+
* `Playbook.addStep` adopts a `sinceLastStep` result: its entries become the
|
|
1458
|
+
* step's, without being re-run. Ids not in the applied record are ignored.
|
|
1459
|
+
*/
|
|
1460
|
+
tagStep(entryIds: readonly string[], meta: {
|
|
1461
|
+
stepId: string;
|
|
1462
|
+
title?: string;
|
|
1463
|
+
}): void;
|
|
1464
|
+
/**
|
|
1465
|
+
* Run `fn`; everything recorded meanwhile becomes one entry. Nested groups
|
|
1466
|
+
* merge. **All or nothing:** if `fn` throws, what it recorded is reverted,
|
|
1467
|
+
* no entry is kept, and the error is rethrown.
|
|
1468
|
+
*/
|
|
1469
|
+
group<T>(meta: LogGroupMeta, fn: () => T): T;
|
|
1470
|
+
/** Whether the log is applying entries (undo / redo / revertTo / replayTo) right now. */
|
|
1471
|
+
readonly replaying: boolean;
|
|
1472
|
+
undo(): void;
|
|
1473
|
+
redo(): void;
|
|
1474
|
+
canUndo(): boolean;
|
|
1475
|
+
canRedo(): boolean;
|
|
1476
|
+
peekUndo(): LogStepInfo | undefined;
|
|
1477
|
+
peekRedo(): LogStepInfo | undefined;
|
|
1478
|
+
/** Revert every applied entry after `entryId` (`null` = back to the start), every part included. */
|
|
1479
|
+
revertTo(entryId: string | null): void;
|
|
1480
|
+
/** Re-apply recorded entries up to and including `entryId`, every part included. */
|
|
1481
|
+
replayTo(entryId: string): void;
|
|
1482
|
+
/** True when no recorded entry is waiting to be redone. */
|
|
1483
|
+
atLatest(): boolean;
|
|
1484
|
+
/** The applied entries, oldest first, optionally filtered. */
|
|
1485
|
+
entries(filter?: LogEntryFilter): readonly LogEntry[];
|
|
1486
|
+
/** Hear every new entry. Returns the unsubscribe. */
|
|
1487
|
+
onEntry(listener: (entry: LogEntry) => void): () => void;
|
|
1488
|
+
/** Hear every change to the log (record / merge / undo / redo / clear). Returns the unsubscribe. */
|
|
1489
|
+
subscribe(listener: () => void): () => void;
|
|
1490
|
+
/** Drop every entry and branch. Runs when a new canvas state loads. */
|
|
1491
|
+
clear(): void;
|
|
1492
|
+
/** Stop recording and release subscriptions. */
|
|
1493
|
+
dispose(): void;
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* `canvas.history` — the record. Undo / redo as before, plus who-did-what reads.
|
|
1497
|
+
* Nobody writes to it: entries come from the canvas's own writes.
|
|
1498
|
+
*/
|
|
1499
|
+
interface HistoryView {
|
|
1500
|
+
undo(): void;
|
|
1501
|
+
redo(): void;
|
|
1502
|
+
canUndo(): boolean;
|
|
1503
|
+
canRedo(): boolean;
|
|
1504
|
+
/** The entry {@link undo} would revert, or `undefined`. */
|
|
1505
|
+
peekUndo(): LogStepInfo | undefined;
|
|
1506
|
+
/** The entry {@link redo} would re-apply, or `undefined`. */
|
|
1507
|
+
peekRedo(): LogStepInfo | undefined;
|
|
1508
|
+
/** The applied entries, oldest first, optionally filtered by actor / step. */
|
|
1509
|
+
entries(filter?: LogEntryFilter): readonly LogEntry[];
|
|
1510
|
+
/** Hear every new entry (e.g. to send a user's changes back to the engine). */
|
|
1511
|
+
onEntry(listener: (entry: LogEntry) => void): () => void;
|
|
1512
|
+
/** True when no recorded entry is waiting to be redone. */
|
|
1513
|
+
atLatest(): boolean;
|
|
1514
|
+
/**
|
|
1515
|
+
* The work done since the last playbook step, **as a step** (RFC F14, D-13):
|
|
1516
|
+
* every applied entry after the newest one carrying a `stepId` (or from the
|
|
1517
|
+
* start), summarised —
|
|
1518
|
+
*
|
|
1519
|
+
* - `data`: the net delta per source (an add then a remove cancels);
|
|
1520
|
+
* - `settings`: the definition values those entries changed, as a
|
|
1521
|
+
* `canvas.update` patch holding their current values;
|
|
1522
|
+
* - `view`: the current selection / focus / inspect / camera intent, for
|
|
1523
|
+
* the slices those entries changed.
|
|
1524
|
+
*
|
|
1525
|
+
* Pass the returned object to `playbook.addStep` to make the work a step:
|
|
1526
|
+
* it **adopts** the recorded entries rather than playing them again (only
|
|
1527
|
+
* while they are still the newest; otherwise, or for a copy of the object,
|
|
1528
|
+
* it is added as an ordinary step). Returns a step with no fields besides
|
|
1529
|
+
* `id` / `title` when nothing was done. Reading it changes nothing.
|
|
1530
|
+
*
|
|
1531
|
+
* @typeParam S The settings patch shape — `CanvasConfig` on a `Canvas`.
|
|
1532
|
+
*/
|
|
1533
|
+
sinceLastStep<S = Record<string, unknown>>(title: string): StepSpec<S>;
|
|
1534
|
+
/**
|
|
1535
|
+
* What one entry did to the data, **per source**: each data part's ops as
|
|
1536
|
+
* that source's net {@link Delta} (its {@link DataOpAdapter.toDelta}). A
|
|
1537
|
+
* source without `toDelta`, or whose ops net to nothing, is left out; an
|
|
1538
|
+
* entry holding only view parts returns `[]`. For display (a history
|
|
1539
|
+
* panel's "+3 nodes · −1 edge"); reading it changes nothing.
|
|
1540
|
+
*/
|
|
1541
|
+
entryData(entry: LogEntry): ReadonlyArray<{
|
|
1542
|
+
sourceId: string;
|
|
1543
|
+
delta: Delta<DeltaRecord, DeltaRecord>;
|
|
1544
|
+
}>;
|
|
1545
|
+
/** Hear every change (record / undo / redo / clear). Returns the unsubscribe. */
|
|
1546
|
+
subscribe(listener: () => void): () => void;
|
|
1547
|
+
/** Drop every entry. */
|
|
1548
|
+
clear(): void;
|
|
1549
|
+
/** Stop recording and release subscriptions. */
|
|
1550
|
+
dispose(): void;
|
|
1551
|
+
}
|
|
1552
|
+
/** Where a step points the camera: its focus, every visible node, or everything. */
|
|
1553
|
+
type CameraIntent = 'focus' | 'visible' | 'all';
|
|
1554
|
+
/**
|
|
1555
|
+
* One playbook step — what should happen, as plain JSON. Ids and values only;
|
|
1556
|
+
* no functions, no rules. The Invana engine answers prompts in this format.
|
|
1557
|
+
*
|
|
1558
|
+
* @typeParam S The settings patch shape — `CanvasConfig` in `@invana/canvas`.
|
|
1559
|
+
*/
|
|
1560
|
+
interface StepSpec<S = Record<string, unknown>> {
|
|
1561
|
+
id: string;
|
|
1562
|
+
title: string;
|
|
1563
|
+
/** Who the resulting history entry is attributed to. */
|
|
1564
|
+
actor?: string;
|
|
1565
|
+
/** Presenter text. */
|
|
1566
|
+
narration?: string;
|
|
1567
|
+
/** The engine's own data; never read by the canvas. */
|
|
1568
|
+
meta?: unknown;
|
|
1569
|
+
/** Data source id; defaults to the playbook's. */
|
|
1570
|
+
source?: string;
|
|
1571
|
+
/** Exactly `applyDelta`'s argument, with the source's records as plain JSON. */
|
|
1572
|
+
data?: Delta<DeltaRecord, DeltaRecord>;
|
|
1573
|
+
/** Exactly `canvas.update`'s argument. */
|
|
1574
|
+
settings?: S;
|
|
1575
|
+
view?: {
|
|
1576
|
+
/** Selected ids; `[]` clears. */
|
|
1577
|
+
select?: string[];
|
|
1578
|
+
/** Highlighted ids, the rest optionally dimmed; `null` clears. */
|
|
1579
|
+
focus?: {
|
|
1580
|
+
ids: string[];
|
|
1581
|
+
dim?: boolean;
|
|
1582
|
+
} | null;
|
|
1583
|
+
/** The node whose properties are open; `null` closes. */
|
|
1584
|
+
inspect?: string | null;
|
|
1585
|
+
camera?: CameraIntent;
|
|
1586
|
+
};
|
|
1587
|
+
/** Rare verbs that leave no state (export, redraw), run after the rest. */
|
|
1588
|
+
do?: Array<{
|
|
1589
|
+
command: string;
|
|
1590
|
+
args?: Record<string, unknown>;
|
|
1591
|
+
}>;
|
|
1592
|
+
}
|
|
1593
|
+
/** A saved playbook: the script, nothing more. */
|
|
1594
|
+
interface PlaybookSpec<S = Record<string, unknown>> {
|
|
1595
|
+
version: 1;
|
|
1596
|
+
title: string;
|
|
1597
|
+
/** Default data source id for its steps. */
|
|
1598
|
+
source?: string;
|
|
1599
|
+
steps: StepSpec<S>[];
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* `canvas.playbook` — a list of {@link StepSpec}s and a position. `addStep` only
|
|
1603
|
+
* appends; moving to a step plays it (or replays / reverts its recorded entries).
|
|
1604
|
+
*/
|
|
1605
|
+
interface Playbook<S = Record<string, unknown>> {
|
|
1606
|
+
/** The script's title (from {@link load}, else `'Playbook'`). */
|
|
1607
|
+
readonly title: string;
|
|
1608
|
+
readonly steps: readonly StepSpec<S>[];
|
|
1609
|
+
/** The step the canvas is at, or `undefined` before the first. */
|
|
1610
|
+
readonly current: StepSpec<S> | undefined;
|
|
1611
|
+
/** Index of {@link current} in {@link steps}; `-1` before the first. */
|
|
1612
|
+
readonly index: number;
|
|
1613
|
+
/**
|
|
1614
|
+
* Append to the list; the canvas does not change. Returns the step id.
|
|
1615
|
+
* Throws on a duplicate id.
|
|
1616
|
+
*
|
|
1617
|
+
* A step returned by `history.sinceLastStep` is **adopted** instead when its
|
|
1618
|
+
* entries are still the newest and the playbook is at its last step: the
|
|
1619
|
+
* work is already on the canvas, so its entries are tagged with the step's
|
|
1620
|
+
* id, the step counts as played, and the position moves to it — `previous`
|
|
1621
|
+
* reverts that work like any played step.
|
|
1622
|
+
*/
|
|
1623
|
+
addStep(spec: StepSpec<S>): string;
|
|
1624
|
+
/**
|
|
1625
|
+
* Play the next step — or replay it, when it was played and then stepped
|
|
1626
|
+
* back over. Rejects (writing nothing) when the step fails validation.
|
|
1627
|
+
* Resolves once its `do` verbs finished and the canvas settled.
|
|
1628
|
+
*/
|
|
1629
|
+
next(): Promise<void>;
|
|
1630
|
+
/** Revert the current step's recorded entries and move back one. */
|
|
1631
|
+
previous(): Promise<void>;
|
|
1632
|
+
/** Move to `stepId`, playing / reverting every step in between. */
|
|
1633
|
+
goTo(stepId: string): Promise<void>;
|
|
1634
|
+
toJSON(): PlaybookSpec<S>;
|
|
1635
|
+
/** Replace the list; the canvas does not change. */
|
|
1636
|
+
load(doc: PlaybookSpec<S>): Promise<void>;
|
|
1637
|
+
/** Hear every change to the list or the position. Returns the unsubscribe. */
|
|
1638
|
+
subscribe(listener: () => void): () => void;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
989
1641
|
/**
|
|
990
1642
|
* `CanvasView` — the reactive, observable, syncable half of `CanvasStore`: how a
|
|
991
1643
|
* visualisation is **defined**, **viewed**, and its small transient **runtime**
|
|
@@ -1020,6 +1672,11 @@ interface CanvasView {
|
|
|
1020
1672
|
templates: unknown[];
|
|
1021
1673
|
/** Theme **config** (registry + active family + mode + accent). The *resolved* theme is derived. */
|
|
1022
1674
|
theme: Record<string, unknown>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Floating control panels over the canvas, keyed by panel id. Pure JSON —
|
|
1677
|
+
* items name commands / icons / widgets by string (see {@link ControlPanelSpec}).
|
|
1678
|
+
*/
|
|
1679
|
+
controlPanels: Record<string, ControlPanelSpec>;
|
|
1023
1680
|
};
|
|
1024
1681
|
/** "The live view onto it" — mostly ephemeral / per-user (Awareness later). */
|
|
1025
1682
|
interaction: {
|
|
@@ -1058,14 +1715,48 @@ interface CanvasView {
|
|
|
1058
1715
|
ids: ReadonlySet<string>;
|
|
1059
1716
|
dim: boolean;
|
|
1060
1717
|
} | null;
|
|
1718
|
+
/**
|
|
1719
|
+
* The element whose properties are open (a node or edge id), or `null`.
|
|
1720
|
+
* Written by a playbook step, the assistant or a panel; a property-view
|
|
1721
|
+
* behaviour (`ClickViewBehaviour`) follows it and writes it back when the
|
|
1722
|
+
* user opens or closes one. Recorded as view intent — plain undo steps
|
|
1723
|
+
* over it.
|
|
1724
|
+
*/
|
|
1725
|
+
inspect: string | null;
|
|
1726
|
+
/**
|
|
1727
|
+
* The latest request to frame the camera — `'focus'` (the focus set),
|
|
1728
|
+
* `'visible'` (every visible element) or `'all'` (all content, hidden
|
|
1729
|
+
* included) — or `null` before any. An **intent, not pixels** (RFC D-4):
|
|
1730
|
+
* whoever owns that framing performs it once the canvas settles (the
|
|
1731
|
+
* engine frames `'visible'` / `'all'`, `FocusBehaviour` frames `'focus'`).
|
|
1732
|
+
* `seq` increases on every request, so asking for the same intent twice
|
|
1733
|
+
* frames twice. Recorded as view intent — plain undo steps over it.
|
|
1734
|
+
*/
|
|
1735
|
+
cameraIntent: {
|
|
1736
|
+
intent: CameraIntent;
|
|
1737
|
+
seq: number;
|
|
1738
|
+
} | null;
|
|
1061
1739
|
/**
|
|
1062
1740
|
* Nodes transiently locked during a drag/resize gesture — held against the
|
|
1063
1741
|
* layout for the gesture's duration. **Distinct from data `pinned`** (the
|
|
1064
1742
|
* permanent, synced user flag); these are ephemeral and never synced.
|
|
1065
1743
|
*/
|
|
1066
1744
|
transientPins: ReadonlySet<string>;
|
|
1067
|
-
/**
|
|
1745
|
+
/**
|
|
1746
|
+
* Active interaction mode — the modeller "tool" (`'select'`, `'add'`,
|
|
1747
|
+
* `'connect'`, `'delete'`, or any string a host defines). Per-user and
|
|
1748
|
+
* ephemeral like the rest of `interaction`. Behaviours opt into following it
|
|
1749
|
+
* through `BehaviourOptions.modes`; commands switch it (`tool.active`).
|
|
1750
|
+
* Seeded from `definition.canvas.defaultViewMode` when a canvas starts.
|
|
1751
|
+
*/
|
|
1068
1752
|
viewMode: string;
|
|
1753
|
+
/**
|
|
1754
|
+
* Parameters of the active mode, as plain strings keyed by name — e.g.
|
|
1755
|
+
* `{ nodeKind: 'circle' }` for an "add node" tool. A bag rather than typed
|
|
1756
|
+
* fields so the kernel stays domain-free: what a key means is the
|
|
1757
|
+
* business of whoever reads it (the graph's `tool.nodeKind` command).
|
|
1758
|
+
*/
|
|
1759
|
+
viewModeArgs: Readonly<Record<string, string>>;
|
|
1069
1760
|
};
|
|
1070
1761
|
/** Small observable transient status — reactive (UIs react) but **never synced**. */
|
|
1071
1762
|
runtime: {
|
|
@@ -1149,8 +1840,8 @@ type CameraInput = Partial<{
|
|
|
1149
1840
|
* target {@link LayerData}.
|
|
1150
1841
|
*
|
|
1151
1842
|
* Group by concern: `node / edge / group / annotation / positions` (data) and
|
|
1152
|
-
* `layers / behaviours / layouts / camera / selection / hover / templates /
|
|
1153
|
-
* (view).
|
|
1843
|
+
* `layers / behaviours / layouts / camera / selection / hover / viewMode / templates /
|
|
1844
|
+
* theme / controlPanels` (view).
|
|
1154
1845
|
*
|
|
1155
1846
|
* ⚠ **Data actions target the default {@link LayerData} store only.** The
|
|
1156
1847
|
* injected `layer(id)` accessor (see `createCanvasStore`) **throws** for any id
|
|
@@ -1238,11 +1929,30 @@ declare function createActions(view: ReactiveStore<CanvasView>, layer: (id: stri
|
|
|
1238
1929
|
set: (source: string, ids: Iterable<string>) => void;
|
|
1239
1930
|
clear: (source: string) => void;
|
|
1240
1931
|
};
|
|
1932
|
+
viewMode: {
|
|
1933
|
+
/**
|
|
1934
|
+
* Switch the active mode. `args`, when given, **replaces** the mode's
|
|
1935
|
+
* parameters; omit it to keep the current ones (a tool's node kind
|
|
1936
|
+
* survives a trip through Select).
|
|
1937
|
+
*/
|
|
1938
|
+
set: (mode: string, args?: Readonly<Record<string, string>>) => void;
|
|
1939
|
+
/** Shallow-merge `patch` into the mode parameters. */
|
|
1940
|
+
setArgs: (patch: Readonly<Record<string, string>>) => void;
|
|
1941
|
+
};
|
|
1241
1942
|
templates: {
|
|
1242
1943
|
create: (template: unknown) => void;
|
|
1243
1944
|
update: (id: string, patch: Bag) => void;
|
|
1244
1945
|
remove: (id: string) => void;
|
|
1245
1946
|
};
|
|
1947
|
+
controlPanels: {
|
|
1948
|
+
/** Add (or replace) the panel `id`. */
|
|
1949
|
+
add: (id: string, spec: ControlPanelSpec) => void;
|
|
1950
|
+
/** Shallow-merge `patch` into panel `id` (`items` replaces). No-op when absent. */
|
|
1951
|
+
update: (id: string, patch: Partial<ControlPanelSpec>) => void;
|
|
1952
|
+
show: (id: string) => void;
|
|
1953
|
+
hide: (id: string) => void;
|
|
1954
|
+
remove: (id: string) => void;
|
|
1955
|
+
};
|
|
1246
1956
|
theme: {
|
|
1247
1957
|
set: (patch: Bag) => void;
|
|
1248
1958
|
};
|
|
@@ -1264,6 +1974,14 @@ declare function createActions(view: ReactiveStore<CanvasView>, layer: (id: stri
|
|
|
1264
1974
|
set: (ids: Iterable<string>, dim?: boolean) => void;
|
|
1265
1975
|
clear: () => void;
|
|
1266
1976
|
};
|
|
1977
|
+
inspect: {
|
|
1978
|
+
set: (id: string) => void;
|
|
1979
|
+
clear: () => void;
|
|
1980
|
+
};
|
|
1981
|
+
cameraIntent: {
|
|
1982
|
+
/** Ask for a framing; the owner performs it once the canvas settles. */
|
|
1983
|
+
request: (intent: CameraIntent) => void;
|
|
1984
|
+
};
|
|
1267
1985
|
transientPins: {
|
|
1268
1986
|
add: (ids: Iterable<string>) => void;
|
|
1269
1987
|
remove: (ids: Iterable<string>) => void;
|
|
@@ -1619,8 +2337,21 @@ declare class Camera {
|
|
|
1619
2337
|
* maps to the screen centre, keeping the current zoom. The pan-only
|
|
1620
2338
|
* counterpart to {@link fitContent}: use it for "focus" / "go to" actions
|
|
1621
2339
|
* that should locate a target without rescaling the view.
|
|
2340
|
+
*
|
|
2341
|
+
* By default the pan is applied at once. Pass a positive `durationMs` to
|
|
2342
|
+
* glide there instead — the move then runs through {@link animateTo}, so it
|
|
2343
|
+
* follows the same rules: eased, and cancelled by any other camera write.
|
|
2344
|
+
*
|
|
2345
|
+
* @param durationMs Length of the glide. Absent or `<= 0` pans immediately.
|
|
2346
|
+
* @param easing Named curve for the glide; defaults to `'easeOutCubic'`.
|
|
2347
|
+
* @param onDone Called once the camera is on target (immediately when
|
|
2348
|
+
* not gliding; never when a glide is cancelled).
|
|
1622
2349
|
*/
|
|
1623
|
-
centerOn(worldX: number, worldY: number
|
|
2350
|
+
centerOn(worldX: number, worldY: number, { durationMs, easing, onDone }?: {
|
|
2351
|
+
durationMs?: number;
|
|
2352
|
+
easing?: EasingName;
|
|
2353
|
+
onDone?: () => void;
|
|
2354
|
+
}): void;
|
|
1624
2355
|
/** Update on viewport resize. Forwarded so the binding's own math stays correct. */
|
|
1625
2356
|
resize(screenWidth: number, screenHeight: number): void;
|
|
1626
2357
|
/** Screen → world. */
|
|
@@ -1862,8 +2593,9 @@ declare class SpecProjector<TSpec extends BaseShapeSpec | BaseConnectorSpec> {
|
|
|
1862
2593
|
*
|
|
1863
2594
|
* **This is not the end state.** The classification table in
|
|
1864
2595
|
* `docs/renderer-split-design.md` (P4.5) records where each of these is headed:
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
2596
|
+
* decorations and badges become spec state, while the LOD setters stay
|
|
2597
|
+
* per-element commands (G5 was revised: a single global level cannot express
|
|
2598
|
+
* per-element exemptions). Until then the interface describes
|
|
1867
2599
|
* what is really called, rather than what we wish were called — a smaller
|
|
1868
2600
|
* interface that lied would not let the package split at all.
|
|
1869
2601
|
*/
|
|
@@ -1892,6 +2624,73 @@ interface MountedDecoration<TStyle = unknown> {
|
|
|
1892
2624
|
* the thing that can give it meaning.
|
|
1893
2625
|
*/
|
|
1894
2626
|
type CustomElementCtor = abstract new (...args: never[]) => object;
|
|
2627
|
+
/**
|
|
2628
|
+
* A **display-only** adjustment to one shape, layered on top of everything
|
|
2629
|
+
* else that positions or scales it — the logical position (`spec.x/y`, kept
|
|
2630
|
+
* current by `moveShape` / `updateShape`), the LOD/hover visual scale
|
|
2631
|
+
* (`scaleShape`) and any text-LOD visibility. None of those writes clobbers an
|
|
2632
|
+
* override, and the override never reaches the spec, the store or history.
|
|
2633
|
+
*
|
|
2634
|
+
* Built for focus+context distortion (a fisheye lens): nodes inside the lens
|
|
2635
|
+
* are drawn displaced and enlarged while their layout positions stay put.
|
|
2636
|
+
* Connectors, anchors and picking follow the **drawn** shape, so edges stay
|
|
2637
|
+
* glued to it and a click lands on what the user sees.
|
|
2638
|
+
*/
|
|
2639
|
+
interface ShapeDisplayOverride {
|
|
2640
|
+
/** World-space offset added to the drawn origin. Default `0`. */
|
|
2641
|
+
readonly dx?: number;
|
|
2642
|
+
/** World-space offset added to the drawn origin. Default `0`. */
|
|
2643
|
+
readonly dy?: number;
|
|
2644
|
+
/**
|
|
2645
|
+
* Multiplier on the shape's current visual scale, applied about the shape's
|
|
2646
|
+
* visual centre (so top-left-anchored rects and cards grow in place).
|
|
2647
|
+
* Default `1`.
|
|
2648
|
+
*/
|
|
2649
|
+
readonly scale?: number;
|
|
2650
|
+
/**
|
|
2651
|
+
* `true` forces the shape's text (its `'label'` decoration and any internal
|
|
2652
|
+
* text) visible while the override is set, regardless of text-LOD or
|
|
2653
|
+
* label-collision hiding. Clearing the override restores whatever those last
|
|
2654
|
+
* asked for. Omitted / `false` leaves text visibility to them.
|
|
2655
|
+
*/
|
|
2656
|
+
readonly showText?: boolean;
|
|
2657
|
+
}
|
|
2658
|
+
/**
|
|
2659
|
+
* Which labels a {@link LabelSizePolicy} governs: `'shape'` = the `'label'`
|
|
2660
|
+
* decoration of every shape (graph nodes), `'connector'` = the `'label'`
|
|
2661
|
+
* decoration of every connector (graph edges). Badge plates and the text
|
|
2662
|
+
* *inside* a shape (composite `label` parts) are never governed.
|
|
2663
|
+
*/
|
|
2664
|
+
type LabelSizeTarget = 'shape' | 'connector';
|
|
2665
|
+
/**
|
|
2666
|
+
* How big a label is drawn **on screen** as the camera zooms — the input to
|
|
2667
|
+
* {@link IElementRenderer.setLabelSizePolicy}. Sizes are CSS pixels; a label's
|
|
2668
|
+
* authored `fontSize` is its size at camera zoom `1`.
|
|
2669
|
+
*
|
|
2670
|
+
* Every field is optional and an empty policy changes nothing: without
|
|
2671
|
+
* `zoomGrowth` a label keeps whatever size its host gives it today (it grows
|
|
2672
|
+
* with the world, or stays pixel-constant under a node-size LOD); the clamps
|
|
2673
|
+
* then bound that.
|
|
2674
|
+
*
|
|
2675
|
+
* @example
|
|
2676
|
+
* ```ts
|
|
2677
|
+
* // Grow with √zoom, never above 24px on screen.
|
|
2678
|
+
* renderer.setLabelSizePolicy('shape', { zoomGrowth: 0.5, maxFontPx: 24 });
|
|
2679
|
+
* ```
|
|
2680
|
+
*/
|
|
2681
|
+
interface LabelSizePolicy {
|
|
2682
|
+
/**
|
|
2683
|
+
* How on-screen size follows camera zoom: `fontSize × zoom ^ zoomGrowth`.
|
|
2684
|
+
* `1` grows with the world, `0.5` with its square root, `0` keeps each
|
|
2685
|
+
* label's own `fontSize` on screen. Clamped to `[0, 1]`. Omit to keep the
|
|
2686
|
+
* size the host gives the label (see the interface doc).
|
|
2687
|
+
*/
|
|
2688
|
+
readonly zoomGrowth?: number;
|
|
2689
|
+
/** Smallest on-screen font size in CSS px. Omit for no floor. */
|
|
2690
|
+
readonly minFontPx?: number;
|
|
2691
|
+
/** Largest on-screen font size in CSS px. Omit for no cap. */
|
|
2692
|
+
readonly maxFontPx?: number;
|
|
2693
|
+
}
|
|
1895
2694
|
interface IElementRenderer extends SpecProjectionTarget {
|
|
1896
2695
|
/**
|
|
1897
2696
|
* Teach this backend a new element kind. The spec vocabulary stays open —
|
|
@@ -1904,16 +2703,68 @@ interface IElementRenderer extends SpecProjectionTarget {
|
|
|
1904
2703
|
hasConnector(id: string): boolean;
|
|
1905
2704
|
moveShape(id: string, x: number, y: number): void;
|
|
1906
2705
|
scaleShape(id: string, scale: number): void;
|
|
2706
|
+
/**
|
|
2707
|
+
* Set (or, with `null`, clear) a shape's {@link ShapeDisplayOverride}. The
|
|
2708
|
+
* drawn shape, its connectors' anchors and its hit area follow the override;
|
|
2709
|
+
* {@link getShapePosition} keeps answering the **logical** position, because
|
|
2710
|
+
* its callers (drag, resize, collapse) write that position back. Connectors
|
|
2711
|
+
* are **not** re-routed here — the caller re-routes the ones it cares about
|
|
2712
|
+
* with `updateConnector(id, {})`, once per batch. No-op for unknown ids.
|
|
2713
|
+
*/
|
|
2714
|
+
setShapeDisplayOverride(id: string, override: ShapeDisplayOverride | null): void;
|
|
2715
|
+
/**
|
|
2716
|
+
* Clear every display override this renderer holds. Same re-routing caveat
|
|
2717
|
+
* as {@link setShapeDisplayOverride}.
|
|
2718
|
+
*/
|
|
2719
|
+
clearShapeDisplayOverrides(): void;
|
|
1907
2720
|
setConnectorStroke(id: string, stroke: {
|
|
1908
2721
|
color: number;
|
|
1909
2722
|
width: number;
|
|
1910
2723
|
}): void;
|
|
1911
2724
|
scaleConnectorStroke(id: string, scale: number): void;
|
|
1912
2725
|
setRaised(ids: Iterable<string>): void;
|
|
2726
|
+
/**
|
|
2727
|
+
* Text-LOD visibility of a shape's text: its `'label'` decoration **and** any
|
|
2728
|
+
* text the shape draws inside itself (composite `label` parts). This is the
|
|
2729
|
+
* LOD channel only — label collision writes its own channel through
|
|
2730
|
+
* `setDecorationVisible(id, 'label', …)`, and a label is drawn only when both
|
|
2731
|
+
* allow it (a display override's `showText` forces it on).
|
|
2732
|
+
*/
|
|
1913
2733
|
setShapeTextVisible(id: string, visible: boolean): void;
|
|
2734
|
+
/**
|
|
2735
|
+
* Text-LOD visibility of a connector's `'label'` decoration. Same two-channel
|
|
2736
|
+
* rule as {@link setShapeTextVisible}: collision's
|
|
2737
|
+
* `setDecorationVisible(id, 'label', …)` is a separate channel, and the label
|
|
2738
|
+
* is drawn only when both allow it. No-op for unknown ids.
|
|
2739
|
+
*/
|
|
2740
|
+
setConnectorTextVisible(id: string, visible: boolean): void;
|
|
2741
|
+
/**
|
|
2742
|
+
* What the text-LOD channel last asked for this shape or connector (`true`
|
|
2743
|
+
* when a display override's `showText` forces it on); `false` for an unknown
|
|
2744
|
+
* id. Lets label collision ignore labels LOD has hidden, so an invisible
|
|
2745
|
+
* label never blocks a visible one.
|
|
2746
|
+
*/
|
|
2747
|
+
isTextVisible(id: string): boolean;
|
|
1914
2748
|
setShapeIconVisible(id: string, visible: boolean): void;
|
|
1915
2749
|
setShapeImageVisible(id: string, visible: boolean): void;
|
|
1916
2750
|
setLabelsResolution(resolution: number): void;
|
|
2751
|
+
/**
|
|
2752
|
+
* Set (or, with `null`, clear) how this renderer sizes the `'label'`
|
|
2753
|
+
* decorations of every shape or every connector across camera zoom — see
|
|
2754
|
+
* {@link LabelSizePolicy}. The backend re-applies it whenever the camera
|
|
2755
|
+
* scale, a host's visual scale or a label changes; a caller pushes it once
|
|
2756
|
+
* per configuration change, never per frame. Clearing restores each label's
|
|
2757
|
+
* natural size.
|
|
2758
|
+
*
|
|
2759
|
+
* **Cost.** The pixi backend sizes only labels that are drawn (not hidden by a
|
|
2760
|
+
* label LOD) and on screen on a zoom frame, catching off-screen ones up while
|
|
2761
|
+
* the zoom holds still — so a zoomed-in view or a visibility band keeps it
|
|
2762
|
+
* under ~1 ms a frame at 10 000 labels. The known limit is every label on
|
|
2763
|
+
* screen at once with no band (a zoomed-out hairball): each still costs one
|
|
2764
|
+
* transform write per zoom frame, ~3–4 ms at 10 000. Pair a size policy with
|
|
2765
|
+
* a band (`NodeLabelLODBehaviour.minZoom`) on large graphs.
|
|
2766
|
+
*/
|
|
2767
|
+
setLabelSizePolicy(target: LabelSizeTarget, policy: LabelSizePolicy | null): void;
|
|
1917
2768
|
setVisibleSet(ids: ReadonlySet<string> | null): void;
|
|
1918
2769
|
cull(visibleBounds: Rect, padWorld?: number): void;
|
|
1919
2770
|
uncull(): void;
|
|
@@ -2441,6 +3292,14 @@ declare class LayerRegistry {
|
|
|
2441
3292
|
* conflict warnings when two enabled behaviours claim the same gesture
|
|
2442
3293
|
* (e.g. lasso vs. pan both wanting `'shift+drag'`). The framework warns;
|
|
2443
3294
|
* it does not enforce — that's the developer's job.
|
|
3295
|
+
*
|
|
3296
|
+
* **`modes`** ties a behaviour to the canvas's interaction mode
|
|
3297
|
+
* (`view.interaction.viewMode` — the modeller "tool"). An enabled behaviour with
|
|
3298
|
+
* `modes: ['add']` is only *live* while the mode is `'add'`: outside it the base
|
|
3299
|
+
* runs {@link Behaviour.onDisable} (cancelling any gesture) and back inside it
|
|
3300
|
+
* runs {@link Behaviour.onEnable}. `enabled` stays the developer's flag — a mode
|
|
3301
|
+
* switch never changes it, never fires `scene:behaviour:enable`, and never shows
|
|
3302
|
+
* up in {@link Behaviour.getOptions}.
|
|
2444
3303
|
*/
|
|
2445
3304
|
|
|
2446
3305
|
/** What `BehaviourRegistry` sees. */
|
|
@@ -2462,6 +3321,13 @@ interface IBehaviour {
|
|
|
2462
3321
|
* `canvas.update({ behaviours })` path can retune any behaviour uniformly.
|
|
2463
3322
|
*/
|
|
2464
3323
|
setOptions(changes: Record<string, unknown>): void;
|
|
3324
|
+
/**
|
|
3325
|
+
* Replace the interaction modes this behaviour is live in (`undefined` = all).
|
|
3326
|
+
* The engine calls it directly for a `modes` patch, like it routes `enabled`
|
|
3327
|
+
* through the registry, because some behaviours override `setOptions`
|
|
3328
|
+
* without calling `super`.
|
|
3329
|
+
*/
|
|
3330
|
+
setModes?(modes: readonly string[] | undefined): void;
|
|
2465
3331
|
}
|
|
2466
3332
|
interface BehaviourOptions {
|
|
2467
3333
|
id: string;
|
|
@@ -2478,6 +3344,14 @@ interface BehaviourOptions {
|
|
|
2478
3344
|
* `'wheel+ctrl'`, `'rclick'`); registries match strings as-is.
|
|
2479
3345
|
*/
|
|
2480
3346
|
shortcuts?: readonly string[];
|
|
3347
|
+
/**
|
|
3348
|
+
* Interaction modes (`view.interaction.viewMode` values) this behaviour is live
|
|
3349
|
+
* in. Omitted = every mode. An enabled behaviour outside its modes is
|
|
3350
|
+
* suspended — its `onDisable` runs, `enabled` is unchanged — and resumes when
|
|
3351
|
+
* the mode comes back. E.g. `modes: ['connect']` on an edge-drawing behaviour
|
|
3352
|
+
* makes the modeller's Connect tool switch it on and off with no host wiring.
|
|
3353
|
+
*/
|
|
3354
|
+
modes?: readonly string[];
|
|
2481
3355
|
}
|
|
2482
3356
|
declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOptions> implements IBehaviour {
|
|
2483
3357
|
readonly id: string;
|
|
@@ -2498,8 +3372,20 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2498
3372
|
* from the constructor — subclasses don't need to re-declare.
|
|
2499
3373
|
*/
|
|
2500
3374
|
readonly scope: 'layer' | 'canvas';
|
|
3375
|
+
/**
|
|
3376
|
+
* Whether the behaviour is **live**: the developer's flag ({@link enabled})
|
|
3377
|
+
* *and* the current interaction mode being one of {@link BehaviourOptions.modes}.
|
|
3378
|
+
* Subclasses gate their handlers on this (or {@link isEnabled}); only the base
|
|
3379
|
+
* writes it.
|
|
3380
|
+
*/
|
|
2501
3381
|
protected _enabled: boolean;
|
|
2502
3382
|
protected ctx?: CanvasContext;
|
|
3383
|
+
/** The developer's enable flag — what {@link enabled} reports and snapshots capture. */
|
|
3384
|
+
private _wanted;
|
|
3385
|
+
/** `false` while the canvas's mode is outside {@link BehaviourOptions.modes}. */
|
|
3386
|
+
private _inMode;
|
|
3387
|
+
/** Releases the `viewMode` subscription, or `null` when not watching. */
|
|
3388
|
+
private _modeUnsub;
|
|
2503
3389
|
/**
|
|
2504
3390
|
* The construction options, merged in-place by {@link setOptions}. Named
|
|
2505
3391
|
* `_options` (not `options`) so subclasses that expose a bespoke
|
|
@@ -2515,6 +3401,7 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2515
3401
|
*/
|
|
2516
3402
|
private _gestureRelease;
|
|
2517
3403
|
constructor(opts: TOptions);
|
|
3404
|
+
/** The developer's enable flag. A behaviour suspended by its `modes` still reports `true`. */
|
|
2518
3405
|
get enabled(): boolean;
|
|
2519
3406
|
get isRegistered(): boolean;
|
|
2520
3407
|
/** Called by `BehaviourRegistry.register(behaviour)`. Subscribes to inputs. */
|
|
@@ -2523,6 +3410,20 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2523
3410
|
destroy(): void;
|
|
2524
3411
|
enable(): void;
|
|
2525
3412
|
disable(): void;
|
|
3413
|
+
/**
|
|
3414
|
+
* Bring {@link _enabled} in line with `_wanted && _inMode`, running the
|
|
3415
|
+
* matching hook on a change. The single place a behaviour goes live or idle.
|
|
3416
|
+
*/
|
|
3417
|
+
private syncLive;
|
|
3418
|
+
/** Is `mode` one this behaviour is live in? */
|
|
3419
|
+
private matchesMode;
|
|
3420
|
+
/**
|
|
3421
|
+
* Follow `view.interaction.viewMode` while registered and `modes` is set;
|
|
3422
|
+
* otherwise stop following and count as in-mode. Idempotent — `setOptions`
|
|
3423
|
+
* calls it again when `modes` changes.
|
|
3424
|
+
*/
|
|
3425
|
+
private watchMode;
|
|
3426
|
+
private unwatchMode;
|
|
2526
3427
|
/**
|
|
2527
3428
|
* Merge a serialisable options patch and apply it live. Reflects an `enabled`
|
|
2528
3429
|
* change by enabling/disabling, then calls {@link onOptionsChanged} so the
|
|
@@ -2536,6 +3437,32 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2536
3437
|
* to keep `_options` — and thus {@link getOptions} — coherent.
|
|
2537
3438
|
*/
|
|
2538
3439
|
setOptions(changes: Partial<TOptions>): void;
|
|
3440
|
+
/**
|
|
3441
|
+
* Apply an `enabled` option. While this instance is the one mounted under its
|
|
3442
|
+
* id, the toggle goes through the registry so `scene:behaviour:enable` /
|
|
3443
|
+
* `disable` and the gesture-conflict warning fire — calling {@link enable}
|
|
3444
|
+
* directly would leave the registry's own `setEnabled` (the engine's
|
|
3445
|
+
* `canvas.update` path) a silent no-op. Unmounted, or superseded by a newer
|
|
3446
|
+
* instance under the same id, it toggles itself directly.
|
|
3447
|
+
*/
|
|
3448
|
+
private applyEnabled;
|
|
3449
|
+
/**
|
|
3450
|
+
* Replace {@link BehaviourOptions.modes} and re-evaluate liveness against the
|
|
3451
|
+
* current interaction mode. `undefined` = live in every mode.
|
|
3452
|
+
*/
|
|
3453
|
+
setModes(modes: readonly string[] | undefined): void;
|
|
3454
|
+
/**
|
|
3455
|
+
* Merge `changes` into the options {@link getOptions} returns — and nothing
|
|
3456
|
+
* else: no enable / disable, no mode re-wiring, no {@link onOptionsChanged}.
|
|
3457
|
+
*
|
|
3458
|
+
* For subclasses that override {@link setOptions} with their own apply logic
|
|
3459
|
+
* and don't call `super`: call this first so `getOptions()` (a settings
|
|
3460
|
+
* editor's seed, the engine's undo baseline) stays current. Prefer it to
|
|
3461
|
+
* `super.setOptions` there: the engine routes `enabled` / `modes` through
|
|
3462
|
+
* the registry itself, and the base's direct `enable()` would pre-empt the
|
|
3463
|
+
* registry's `scene:behaviour:enable` event.
|
|
3464
|
+
*/
|
|
3465
|
+
protected recordOptions(changes: Partial<TOptions>): void;
|
|
2539
3466
|
/** Snapshot of the current (merged) options — seeds a settings editor. */
|
|
2540
3467
|
getOptions(): Readonly<TOptions>;
|
|
2541
3468
|
/**
|
|
@@ -2564,7 +3491,7 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2564
3491
|
protected onOptionsChanged(_changes: Partial<TOptions>): void;
|
|
2565
3492
|
/**
|
|
2566
3493
|
* Convenience `if (!enabled) return;` for use inside event handlers
|
|
2567
|
-
* (without rebinding `this` cost).
|
|
3494
|
+
* (without rebinding `this` cost). `false` while suspended by `modes`.
|
|
2568
3495
|
*/
|
|
2569
3496
|
protected get isEnabled(): boolean;
|
|
2570
3497
|
/**
|
|
@@ -2609,7 +3536,8 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2609
3536
|
* Architecture: see `architecture-proposal.md` §2.2.
|
|
2610
3537
|
*
|
|
2611
3538
|
* **Responsibilities**
|
|
2612
|
-
* - `register` / `unregister` (with register / destroy lifecycle
|
|
3539
|
+
* - `register` / `unregister` (with register / destroy lifecycle; fires
|
|
3540
|
+
* `'scene:behaviour:register'` / `'scene:behaviour:unregister'`).
|
|
2613
3541
|
* - `setEnabled(id, enabled)` — toggles + fires `'scene:behaviour:enable'` /
|
|
2614
3542
|
* `'scene:behaviour:disable'`.
|
|
2615
3543
|
* - Typed `get<T>(id)`.
|
|
@@ -2632,13 +3560,22 @@ declare class BehaviourRegistry {
|
|
|
2632
3560
|
* Register a Behaviour. Wires it (`behaviour.register(ctx)` + events) now if
|
|
2633
3561
|
* the Canvas is initialised; otherwise it's stored and wired later by
|
|
2634
3562
|
* `registerAll()` (called by `Canvas.init`). Throws on duplicate id.
|
|
3563
|
+
*
|
|
3564
|
+
* When wiring throws (the behaviour rejects its context — a missing target
|
|
3565
|
+
* layer, a second instance of a one-per-layer kind), the entry is removed
|
|
3566
|
+
* before the error propagates, so a rejected behaviour never shows up in
|
|
3567
|
+
* {@link list} and its id stays free.
|
|
2635
3568
|
*/
|
|
2636
3569
|
register(behaviour: IBehaviour): void;
|
|
2637
3570
|
/** Wire every not-yet-registered behaviour. Called by `Canvas.init` (after layers mount). */
|
|
2638
3571
|
registerAll(): void;
|
|
2639
3572
|
/** `behaviour.register(ctx)` + the registered/enabled events. */
|
|
2640
3573
|
private wire;
|
|
2641
|
-
/**
|
|
3574
|
+
/**
|
|
3575
|
+
* Remove a behaviour. Calls `destroy()`, then fires
|
|
3576
|
+
* `'scene:behaviour:unregister'` (after `'scene:behaviour:disable'` when it
|
|
3577
|
+
* was enabled). No-op if not registered.
|
|
3578
|
+
*/
|
|
2642
3579
|
unregister(id: string): void;
|
|
2643
3580
|
/** Enable / disable a behaviour. Fires the corresponding bus event. */
|
|
2644
3581
|
setEnabled(id: string, enabled: boolean): void;
|
|
@@ -2651,38 +3588,488 @@ declare class BehaviourRegistry {
|
|
|
2651
3588
|
}
|
|
2652
3589
|
|
|
2653
3590
|
/**
|
|
2654
|
-
* `
|
|
2655
|
-
* Layout receives at mount/register time.
|
|
3591
|
+
* `CommandRegistry` — named, serialisable-by-reference actions.
|
|
2656
3592
|
*
|
|
2657
|
-
*
|
|
3593
|
+
* Serialisable UI (control panels today; shortcuts and menus later) can't hold
|
|
3594
|
+
* closures, so it names what it does — `'camera.fit'`, `'view.lock'` — and this
|
|
3595
|
+
* registry resolves the name to behaviour at run time. Names are
|
|
3596
|
+
* `namespace.verb`; the engine registers its built-ins, a domain package or an
|
|
3597
|
+
* app adds its own.
|
|
2658
3598
|
*
|
|
2659
|
-
*
|
|
2660
|
-
* `
|
|
2661
|
-
|
|
2662
|
-
|
|
3599
|
+
* Generic over the context `C` a command runs against (the engine binds it to
|
|
3600
|
+
* its `Canvas`), so the kernel stays free of any engine type.
|
|
3601
|
+
*/
|
|
3602
|
+
/** One option of a pick-one command (see {@link CanvasCommand.options}). */
|
|
3603
|
+
interface CommandOption {
|
|
3604
|
+
/** The value passed back to `run` as `args.value` when picked. */
|
|
3605
|
+
value: string;
|
|
3606
|
+
/** Human label. */
|
|
3607
|
+
label: string;
|
|
3608
|
+
/** Icon name, resolved by the UI kit's icon registry. */
|
|
3609
|
+
icon?: string;
|
|
3610
|
+
}
|
|
3611
|
+
/**
|
|
3612
|
+
* The value kinds a {@link CommandArgSpec} can describe. The first five are
|
|
3613
|
+
* plain JSON values; `layer` / `behaviour` / `layout` are the **id** of a
|
|
3614
|
+
* registered instance (an editor offers the live registry as choices); `json`
|
|
3615
|
+
* is any JSON value the editor can only take as text (maps, number lists).
|
|
3616
|
+
*/
|
|
3617
|
+
type CommandArgKind = 'string' | 'number' | 'boolean' | 'enum' | 'strings' | 'layer' | 'behaviour' | 'layout' | 'json';
|
|
3618
|
+
/**
|
|
3619
|
+
* Describes one key of a command's `args` bag — plain data, so the kernel stays
|
|
3620
|
+
* UI-free; the UI kit maps it to a form field. Optional on every command: an
|
|
3621
|
+
* undescribed command (or key) is still editable as raw JSON.
|
|
3622
|
+
*/
|
|
3623
|
+
interface CommandArgSpec {
|
|
3624
|
+
/** The value's kind. */
|
|
3625
|
+
kind: CommandArgKind;
|
|
3626
|
+
/** Field label. Default: the key. */
|
|
3627
|
+
label?: string;
|
|
3628
|
+
/** One-line help shown under the field. */
|
|
3629
|
+
description?: string;
|
|
3630
|
+
/** The value the command uses when the key is absent — shown as a hint, never written. */
|
|
3631
|
+
default?: unknown;
|
|
3632
|
+
/** The allowed values, for `kind: 'enum'`. */
|
|
3633
|
+
options?: readonly CommandOption[];
|
|
3634
|
+
/**
|
|
3635
|
+
* The key a **pick-one** control supplies itself (`value` — see
|
|
3636
|
+
* {@link CanvasCommand.value}). An editor hides it on a `choice` item, where
|
|
3637
|
+
* picking sets it, and shows it on a button / toggle, where it's fixed.
|
|
3638
|
+
*/
|
|
3639
|
+
pick?: boolean;
|
|
3640
|
+
/**
|
|
3641
|
+
* The command can't run without this key (`behaviour.toggle`'s `id`). A
|
|
3642
|
+
* surface that runs commands bare — the palette — leaves such commands out.
|
|
3643
|
+
* Default `false`: an absent key falls back to {@link default} or the
|
|
3644
|
+
* command's own behaviour.
|
|
3645
|
+
*/
|
|
3646
|
+
required?: boolean;
|
|
3647
|
+
}
|
|
3648
|
+
/**
|
|
3649
|
+
* A **command map**: command name → the type of its `args` bag. A package
|
|
3650
|
+
* exports its commands' map as a type (`EngineCommandMap` in `@invana/canvas`,
|
|
3651
|
+
* `GraphCommandMap` in `@invana/graph`) and a registry typed with it
|
|
3652
|
+
* (`CommandRegistry<C, M>`) checks the args of those names at compile time —
|
|
3653
|
+
* types only, nothing at runtime. Any other name still takes `unknown` args, so
|
|
3654
|
+
* app-registered commands keep working. Merge maps with `&`.
|
|
3655
|
+
*/
|
|
3656
|
+
type CommandMap = object;
|
|
3657
|
+
/** A command name: one of `M`'s (offered for completion), or any other string. */
|
|
3658
|
+
type CommandName<M extends CommandMap> = (keyof M & string) | (string & {});
|
|
3659
|
+
/**
|
|
3660
|
+
* The `args` type of command `K` in map `M` — `unknown` for a name `M` doesn't
|
|
3661
|
+
* list. An indexed access, not a conditional type, so a registry stays
|
|
3662
|
+
* covariant in its map: a `CommandRegistry<C, Wider>` is a
|
|
3663
|
+
* `CommandRegistry<C, Narrower>` (a subclass can widen `commands`' map).
|
|
3664
|
+
*/
|
|
3665
|
+
type CommandArgsOf<M extends CommandMap, K extends string> = (M & Record<string, unknown>)[K];
|
|
3666
|
+
/**
|
|
3667
|
+
* A named command, run against a context `C`. `args` is whatever the caller's
|
|
3668
|
+
* spec carried (JSON); `A` narrows it for a command whose map entry is known.
|
|
2663
3669
|
*
|
|
2664
|
-
*
|
|
2665
|
-
*
|
|
3670
|
+
* Its `isEnabled` / `isActive` / `value` / `options` may read anything; a bound
|
|
3671
|
+
* control re-reads them on view-store writes and on the registry's
|
|
3672
|
+
* {@link CommandRegistry.subscribe} signal. State outside the store needs an
|
|
3673
|
+
* owner-side {@link CommandRegistry.invalidate} bridge — see there.
|
|
2666
3674
|
*/
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
3675
|
+
interface CanvasCommand<C, A = unknown> {
|
|
3676
|
+
/** Human label — a default tooltip when a spec doesn't give one. */
|
|
3677
|
+
label?: string;
|
|
3678
|
+
/**
|
|
3679
|
+
* Group a command palette / menu lists it under (`'Camera'`, `'Edit'`,
|
|
3680
|
+
* `'Layout'`, …). Data only — the kernel never reads it.
|
|
3681
|
+
*/
|
|
3682
|
+
category?: string;
|
|
3683
|
+
/** Extra search terms a command palette matches besides the label and name. Data only. */
|
|
3684
|
+
keywords?: readonly string[];
|
|
3685
|
+
/**
|
|
3686
|
+
* The keys `args` may carry, described for editors (the Studio's control-panel
|
|
3687
|
+
* editor draws a field per key). In dev builds {@link CommandRegistry.run}
|
|
3688
|
+
* checks a described key's value against its `kind` and warns (never throws)
|
|
3689
|
+
* on a mismatch — see {@link CommandRegistryOptions.validateArgs}. Keys it
|
|
3690
|
+
* doesn't name still pass through unchecked.
|
|
3691
|
+
*/
|
|
3692
|
+
args?: Readonly<Record<string, CommandArgSpec>>;
|
|
3693
|
+
/**
|
|
3694
|
+
* Perform the command. A command whose work finishes later (a layout run)
|
|
3695
|
+
* returns its promise, so {@link CommandRegistry.runAsync} can wait for it;
|
|
3696
|
+
* {@link CommandRegistry.run} ignores it.
|
|
3697
|
+
*/
|
|
3698
|
+
run(ctx: C, args?: A): void | Promise<void>;
|
|
3699
|
+
/** Toggle state for toggle-style controls. Absent ⇒ never active. */
|
|
3700
|
+
isActive?(ctx: C, args?: A): boolean;
|
|
3701
|
+
/** Whether the command can run now. Absent ⇒ always enabled. */
|
|
3702
|
+
isEnabled?(ctx: C, args?: A): boolean;
|
|
3703
|
+
/**
|
|
3704
|
+
* Current value, for a **pick-one** command (select mode, edge type, active
|
|
3705
|
+
* layout). Picking an option runs the command with `{ ...args, value }`.
|
|
3706
|
+
* `null` when nothing is picked.
|
|
3707
|
+
*/
|
|
3708
|
+
value?(ctx: C, args?: A): string | null;
|
|
3709
|
+
/** The options a pick-one command offers. A spec's own `options` take precedence. */
|
|
3710
|
+
options?(ctx: C, args?: A): CommandOption[];
|
|
3711
|
+
}
|
|
3712
|
+
/** Options for {@link CommandRegistry}. */
|
|
3713
|
+
interface CommandRegistryOptions<C> {
|
|
3714
|
+
/** The context every command runs against (resolved lazily, per call). */
|
|
3715
|
+
getContext: () => C;
|
|
2671
3716
|
/**
|
|
2672
|
-
*
|
|
2673
|
-
*
|
|
2674
|
-
*
|
|
3717
|
+
* Check `args` against each command's {@link CanvasCommand.args} descriptors
|
|
3718
|
+
* in {@link CommandRegistry.run}, warning once per (command, key, problem) on
|
|
3719
|
+
* a mismatch. Never throws, never blocks the run. Default: on in dev builds
|
|
3720
|
+
* (`process.env.NODE_ENV !== 'production'`), off in production bundles.
|
|
2675
3721
|
*/
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
3722
|
+
validateArgs?: boolean;
|
|
3723
|
+
}
|
|
3724
|
+
/**
|
|
3725
|
+
* Holds {@link CanvasCommand}s by name and runs them against a bound context.
|
|
3726
|
+
*
|
|
3727
|
+
* `M` ({@link CommandMap}) types the args of the names it lists — `register`
|
|
3728
|
+
* (the handler's `args`), `run`, `isEnabled`, `isActive`, `value`, `options` —
|
|
3729
|
+
* while every other name takes `unknown` args. Unset, nothing is typed, and a
|
|
3730
|
+
* typed registry still passes where a `CommandRegistry<C>` is expected. Types
|
|
3731
|
+
* only: the registry behaves the same for any `M`.
|
|
3732
|
+
*
|
|
3733
|
+
* Registrations **stack** per name: registering a name that already exists
|
|
3734
|
+
* overrides it (a provider upgrading `graph.clear` to its undoable form, an app
|
|
3735
|
+
* replacing a built-in), and disposing an override restores whatever is
|
|
3736
|
+
* underneath — in any disposal order. {@link subscribe} listeners hear every
|
|
3737
|
+
* register / unregister and every {@link invalidate}, so a UI can re-read
|
|
3738
|
+
* command state.
|
|
3739
|
+
*/
|
|
3740
|
+
declare class CommandRegistry<C, M extends CommandMap = Record<never, never>> {
|
|
3741
|
+
/** Per name, the registrations oldest → newest; the last one is live. */
|
|
3742
|
+
private readonly stacks;
|
|
3743
|
+
private readonly listeners;
|
|
3744
|
+
/** Bumped on every {@link subscribe} signal — see {@link version}. */
|
|
3745
|
+
private _version;
|
|
3746
|
+
private readonly getContext;
|
|
3747
|
+
private readonly validateArgs;
|
|
3748
|
+
/** `command|key|problem` already warned about, so a bound button doesn't flood the console. */
|
|
3749
|
+
private readonly warned;
|
|
3750
|
+
constructor(opts: CommandRegistryOptions<C>);
|
|
3751
|
+
/**
|
|
3752
|
+
* Register `name`, overriding any existing registration. Returns a disposer
|
|
3753
|
+
* that removes **this** registration only: if it is live, the one underneath
|
|
3754
|
+
* becomes live again; if it was already overridden, the override stays.
|
|
3755
|
+
*/
|
|
3756
|
+
register<K extends CommandName<M>>(name: K, command: CanvasCommand<C, CommandArgsOf<M, K>>): () => void;
|
|
3757
|
+
/** Remove every registration of `name`. No-op when absent. */
|
|
3758
|
+
unregister(name: string): void;
|
|
3759
|
+
has(name: string): boolean;
|
|
3760
|
+
/** The live (most recent) registration of `name`. */
|
|
3761
|
+
get(name: string): CanvasCommand<C> | undefined;
|
|
3762
|
+
/** Registered command names, in first-registration order. */
|
|
3763
|
+
list(): string[];
|
|
3764
|
+
/**
|
|
3765
|
+
* Run `name` with `args`. Returns `false` (and does nothing) when the command
|
|
3766
|
+
* is missing or disabled. With `validateArgs` on, first warns about any
|
|
3767
|
+
* described key whose value doesn't fit its descriptor — the run proceeds
|
|
3768
|
+
* regardless.
|
|
3769
|
+
*/
|
|
3770
|
+
run<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): boolean;
|
|
3771
|
+
/**
|
|
3772
|
+
* {@link run}, awaiting the command's work: resolves once the promise a
|
|
3773
|
+
* command's `run` returned settles (`layout.run` resolves when the layout
|
|
3774
|
+
* run ends). Resolves `false` — without running anything — when the command
|
|
3775
|
+
* is missing or disabled; a synchronous command resolves `true` at once. A
|
|
3776
|
+
* playbook step's `do` verbs go through here, so each finishes before the
|
|
3777
|
+
* next starts.
|
|
3778
|
+
*/
|
|
3779
|
+
runAsync<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): Promise<boolean>;
|
|
3780
|
+
/** `isActive` of `name`; `false` when missing or not a toggle. */
|
|
3781
|
+
isActive<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): boolean;
|
|
3782
|
+
/** `isEnabled` of `name`; `false` when missing, `true` when it declares no check. */
|
|
3783
|
+
isEnabled<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): boolean;
|
|
3784
|
+
/** `value` of a pick-one command; `null` when missing or not a picker. */
|
|
3785
|
+
value<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): string | null;
|
|
3786
|
+
/** `options` of a pick-one command; `[]` when missing or it declares none. */
|
|
3787
|
+
options<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): CommandOption[];
|
|
3788
|
+
/**
|
|
3789
|
+
* Tell subscribers that command state changed **outside** the view store (a
|
|
3790
|
+
* history stack, a clipboard buffer, a layer's edge defaults, a registry), so
|
|
3791
|
+
* a bound control re-reads `isEnabled` / `isActive` / `value` / `options`.
|
|
2684
3792
|
*
|
|
2685
|
-
*
|
|
3793
|
+
* Call it from the state's **owner** — a bridge from the owner's own change
|
|
3794
|
+
* signal, set up once (the engine bridges the registries, layer visibility and
|
|
3795
|
+
* `canvas.history`; `GraphCanvas` its layers' edge templates; a provider its
|
|
3796
|
+
* own history / clipboard) — never from the write sites, where another
|
|
3797
|
+
* writer would forget it. A command whose state lives in the view store
|
|
3798
|
+
* needs none.
|
|
3799
|
+
*/
|
|
3800
|
+
invalidate(): void;
|
|
3801
|
+
/**
|
|
3802
|
+
* A counter bumped on every {@link subscribe} signal (register, unregister,
|
|
3803
|
+
* dispose, {@link invalidate}, {@link clear}) — and only then. Use it as a
|
|
3804
|
+
* `useSyncExternalStore` snapshot when a UI must re-read *everything* on a
|
|
3805
|
+
* signal: a snapshot derived from `list()` stays equal when only a command's
|
|
3806
|
+
* `options` / state changed, and React would skip the re-render.
|
|
3807
|
+
*/
|
|
3808
|
+
get version(): number;
|
|
3809
|
+
/** Hear every register / unregister / {@link invalidate}. Returns an unsubscribe. */
|
|
3810
|
+
subscribe(listener: () => void): () => void;
|
|
3811
|
+
/** Drop every command and listener. */
|
|
3812
|
+
clear(): void;
|
|
3813
|
+
/** Warn (once each) about `args` values that don't fit `specs`. */
|
|
3814
|
+
private checkArgs;
|
|
3815
|
+
private warn;
|
|
3816
|
+
private notify;
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3819
|
+
/**
|
|
3820
|
+
* `Layout` — function from data to positions.
|
|
3821
|
+
*
|
|
3822
|
+
* Architecture: see `architecture-proposal.md` §2.3.
|
|
3823
|
+
*
|
|
3824
|
+
* Per the proposal:
|
|
3825
|
+
* - A Layout does NOT register with the canvas.
|
|
3826
|
+
* - It does NOT render.
|
|
3827
|
+
* - It does NOT subscribe to input.
|
|
3828
|
+
* - You instantiate it and call it against a layer.
|
|
3829
|
+
*
|
|
3830
|
+
* const layout = new D3ForceLayout({ charge: -300 });
|
|
3831
|
+
* layout.events.on('end', () => canvas.camera.fitContent(...));
|
|
3832
|
+
* await layout.apply(graphLayer);
|
|
3833
|
+
*
|
|
3834
|
+
* Continuous-running cases (e.g. always-relax force simulation) are handled
|
|
3835
|
+
* by a thin wrapper Behaviour that calls `apply()` on a tick — keeps the
|
|
3836
|
+
* Layout API clean while supporting the rare continuous case.
|
|
3837
|
+
*
|
|
3838
|
+
* Whether two layouts conflict is a domain concern (don't apply two layouts
|
|
3839
|
+
* to the same data) — not enforced here.
|
|
3840
|
+
*
|
|
3841
|
+
* ## Lifecycle events
|
|
3842
|
+
*
|
|
3843
|
+
* Every layout owns a typed `events` emitter and fires three lifecycle
|
|
3844
|
+
* events around `apply()`:
|
|
3845
|
+
*
|
|
3846
|
+
* - `start` — emitted once, synchronously, after the layout has set up
|
|
3847
|
+
* its internal state and just before it begins producing positions.
|
|
3848
|
+
* - `tick` — emitted whenever the layout writes a fresh batch of positions.
|
|
3849
|
+
* One-shot layouts (e.g. ELK) fire it once. Iterative layouts (force
|
|
3850
|
+
* sims) fire it on every iteration. High-frequency; subscribe sparingly.
|
|
3851
|
+
* - `end` — emitted once when the run terminates. `reason` distinguishes
|
|
3852
|
+
* a natural settle from an external `stop()` call.
|
|
3853
|
+
*
|
|
3854
|
+
* Subscribe to these events to drive camera fits, progress UI, etc. —
|
|
3855
|
+
* instead of listening to per-tick `data:changed` on the layer, which
|
|
3856
|
+
* conflates "structure changed" with "positions updated".
|
|
3857
|
+
*/
|
|
3858
|
+
|
|
3859
|
+
/**
|
|
3860
|
+
* Why the run ended.
|
|
3861
|
+
*
|
|
3862
|
+
* - `completed` — the layout settled / finished on its own.
|
|
3863
|
+
* - `stopped` — `stop()` (or a second `apply()`) cancelled it.
|
|
3864
|
+
*/
|
|
3865
|
+
type LayoutEndReason = 'completed' | 'stopped';
|
|
3866
|
+
/**
|
|
3867
|
+
* Lifecycle events fired by every `Layout`.
|
|
3868
|
+
*
|
|
3869
|
+
* Subclass-specific telemetry (e.g. d3-force's `alpha`) belongs on a
|
|
3870
|
+
* subclass-specific event map, not here.
|
|
3871
|
+
*/
|
|
3872
|
+
type LayoutEvents = {
|
|
3873
|
+
/**
|
|
3874
|
+
* Run is about to produce positions. Optional run-size / animation metadata
|
|
3875
|
+
* lets a `Canvas.runLayout` bridge forward it onto the canvas bus as
|
|
3876
|
+
* `layout:run:start` without reaching into layer internals. Every field is
|
|
3877
|
+
* optional — a layout that doesn't know (or care) emits `{}`, and the bridge
|
|
3878
|
+
* substitutes `0` / `false`.
|
|
3879
|
+
*
|
|
3880
|
+
* - `nodeCount` / `edgeCount` — size of the run, for progress UIs / telemetry.
|
|
3881
|
+
* - `animate` — whether the run animates its settle (iterative force sims)
|
|
3882
|
+
* vs. jumps straight to final positions; render policies branch on it.
|
|
3883
|
+
*/
|
|
3884
|
+
start: {
|
|
3885
|
+
nodeCount?: number;
|
|
3886
|
+
edgeCount?: number;
|
|
3887
|
+
animate?: boolean;
|
|
3888
|
+
};
|
|
3889
|
+
tick: Record<string, never>;
|
|
3890
|
+
/**
|
|
3891
|
+
* A position **transition** advanced one frame — a one-shot layout gliding
|
|
3892
|
+
* nodes from where they were to where the run put them. `progress` is the
|
|
3893
|
+
* **eased** fraction of the glide, `0..1`, and reaches exactly `1` on the
|
|
3894
|
+
* last frame (before `end`). A run that snaps emits none.
|
|
3895
|
+
*
|
|
3896
|
+
* Separate from `tick` on purpose: `tick` means "the layout placed nodes",
|
|
3897
|
+
* and fitters react to it as such; this is per-frame motion, which a
|
|
3898
|
+
* {@link LayoutRunOptions.fitCamera} run follows with the camera.
|
|
3899
|
+
*/
|
|
3900
|
+
transition: {
|
|
3901
|
+
progress: number;
|
|
3902
|
+
};
|
|
3903
|
+
end: {
|
|
3904
|
+
reason: LayoutEndReason;
|
|
3905
|
+
};
|
|
3906
|
+
};
|
|
3907
|
+
/**
|
|
3908
|
+
* How one layout run should behave — passed per call to {@link Layout.apply}
|
|
3909
|
+
* (and `Canvas.runLayout`), as opposed to {@link LayoutOptions}, which are the
|
|
3910
|
+
* layout's standing configuration.
|
|
3911
|
+
*
|
|
3912
|
+
* Both fields describe a **re-flow** the user did not ask for directly — e.g.
|
|
3913
|
+
* `CollapseExpandBehaviour` re-running the active layout after a group frame
|
|
3914
|
+
* opens or closes — where the point is to keep the picture steady.
|
|
3915
|
+
*/
|
|
3916
|
+
interface LayoutRunOptions {
|
|
3917
|
+
/**
|
|
3918
|
+
* Keep this node where it is on screen. The run computes positions as usual,
|
|
3919
|
+
* then shifts the whole result so this node's box centre stays where it was;
|
|
3920
|
+
* everything else re-flows around it. Honoured by layouts that support it
|
|
3921
|
+
* (the one-shot layouts and `D3ForceLayout`); ignored by the rest.
|
|
3922
|
+
*/
|
|
3923
|
+
anchorNodeId?: string;
|
|
3924
|
+
/**
|
|
3925
|
+
* Leave the camera alone for this run. Fitters that normally re-frame the
|
|
3926
|
+
* view when a layout ends (the `fitOnLoad` auto-fitter, the React layout
|
|
3927
|
+
* wrappers' `fitPadding`) skip a run carrying this flag.
|
|
3928
|
+
*/
|
|
3929
|
+
preserveCamera?: boolean;
|
|
3930
|
+
/**
|
|
3931
|
+
* Frame the result, moving the camera **together with** the nodes. While
|
|
3932
|
+
* the run's position transition plays, `Canvas.runLayout` blends the camera
|
|
3933
|
+
* from where it started toward a fit of the content as it is on that frame
|
|
3934
|
+
* (by the transition's eased progress), so the picture stays framed the
|
|
3935
|
+
* whole way and ends exactly fitted — no glide under a stale camera
|
|
3936
|
+
* followed by a snap. A run that snaps (or a layout that reports no
|
|
3937
|
+
* `transition`) gets one fit when it ends. A user pan / zoom mid-run takes
|
|
3938
|
+
* the camera and stops the follow.
|
|
3939
|
+
*
|
|
3940
|
+
* `true` fits with the default padding (80 screen px); `{ padding }` sets
|
|
3941
|
+
* it. Fitters that would otherwise frame on `end` (the `fitOnLoad`
|
|
3942
|
+
* auto-fitter, the React layout wrappers' `fitPadding`) skip such a run —
|
|
3943
|
+
* it already owns the camera. Ignored when {@link preserveCamera} is set.
|
|
3944
|
+
*/
|
|
3945
|
+
fitCamera?: boolean | {
|
|
3946
|
+
padding?: number;
|
|
3947
|
+
};
|
|
3948
|
+
}
|
|
3949
|
+
/**
|
|
3950
|
+
* How an **active** layout re-runs when its target layer's data changes
|
|
3951
|
+
* (nodes added / removed / hidden / shown). Read by the facade that wires the
|
|
3952
|
+
* active layout (`GraphCanvas`) each time it re-runs, so assigning
|
|
3953
|
+
* {@link Layout.onData} takes effect on the next change.
|
|
3954
|
+
*/
|
|
3955
|
+
interface LayoutDataRunOptions {
|
|
3956
|
+
/**
|
|
3957
|
+
* At most one data-triggered run per this many ms: the first change runs at
|
|
3958
|
+
* once, later ones inside the window collapse into one run at its end — so
|
|
3959
|
+
* a feed writing every tick doesn't restart the layout every tick. Default
|
|
3960
|
+
* `0` (every change runs).
|
|
3961
|
+
*/
|
|
3962
|
+
throttleMs?: number;
|
|
3963
|
+
/**
|
|
3964
|
+
* Leave the camera alone on data-triggered runs
|
|
3965
|
+
* ({@link LayoutRunOptions.preserveCamera}) — the view doesn't re-frame each
|
|
3966
|
+
* time the data changes. Default `false`.
|
|
3967
|
+
*/
|
|
3968
|
+
preserveCamera?: boolean;
|
|
3969
|
+
}
|
|
3970
|
+
/** Construction options every layout shares (for the `LayoutRegistry`). */
|
|
3971
|
+
interface LayoutOptions {
|
|
3972
|
+
/** Stable id, used to address the layout in a `LayoutRegistry` / config. Default `'layout'`. */
|
|
3973
|
+
id?: string;
|
|
3974
|
+
/** The layer this layout is meant to run against. Informational — `apply(layer)` still takes one explicitly. */
|
|
3975
|
+
targetLayerId?: string;
|
|
3976
|
+
/** How data-triggered re-runs behave while this layout is active. See {@link LayoutDataRunOptions}. */
|
|
3977
|
+
onData?: LayoutDataRunOptions;
|
|
3978
|
+
}
|
|
3979
|
+
declare abstract class Layout<TLayer extends Layer<any, any, any, any> = Layer<any, any, any, any>> {
|
|
3980
|
+
/** Stable id (registry / config key). */
|
|
3981
|
+
readonly id: string;
|
|
3982
|
+
/** The layer this layout targets, if declared at construction. */
|
|
3983
|
+
readonly targetLayerId?: string;
|
|
3984
|
+
/**
|
|
3985
|
+
* Stable **class kind** — a minification-safe discriminator matching the
|
|
3986
|
+
* `@invana/canvas-ui` settings-editor registry key (e.g. `'d3-force-layout'`,
|
|
3987
|
+
* `'elk-layout'`). Distinct from {@link id} (the per-instance key): all
|
|
3988
|
+
* `D3ForceLayout` instances share `kind: 'd3-force-layout'`. Concrete layouts
|
|
3989
|
+
* set it as a class field; left `undefined` on any that haven't, so consumers
|
|
3990
|
+
* fall back (e.g. to the class name). Lets domain-free tooling resolve an
|
|
3991
|
+
* instance's editor without an `instanceof` ladder.
|
|
3992
|
+
*/
|
|
3993
|
+
readonly kind?: string;
|
|
3994
|
+
/**
|
|
3995
|
+
* Lifecycle event bus. See class docs for the event vocabulary.
|
|
3996
|
+
* Subclasses with richer telemetry can declare their own typed
|
|
3997
|
+
* emitter on top (`override readonly events = new EventEmitter<MyEvents>()`).
|
|
3998
|
+
*/
|
|
3999
|
+
readonly events: EventEmitter<LayoutEvents>;
|
|
4000
|
+
/**
|
|
4001
|
+
* Options of the run in flight, or of the last one once it has ended.
|
|
4002
|
+
* Implementations record them at the top of {@link apply}, so an `end`
|
|
4003
|
+
* listener can tell what kind of run just finished — e.g. a fitter skipping
|
|
4004
|
+
* a {@link LayoutRunOptions.preserveCamera} run.
|
|
4005
|
+
*/
|
|
4006
|
+
runOptions: Readonly<LayoutRunOptions>;
|
|
4007
|
+
/**
|
|
4008
|
+
* How data-triggered re-runs behave while this layout is active (throttle,
|
|
4009
|
+
* keep the camera). Mutable: the wiring reads it on every data change.
|
|
4010
|
+
*/
|
|
4011
|
+
onData: LayoutDataRunOptions;
|
|
4012
|
+
constructor(opts?: LayoutOptions);
|
|
4013
|
+
/**
|
|
4014
|
+
* Live-reconfigure. Called by `Canvas.update({ layouts: { id: patch } })`.
|
|
4015
|
+
* Default no-op; iterative layouts (e.g. `D3ForceLayout`) override to merge
|
|
4016
|
+
* the patch and re-heat a running simulation.
|
|
4017
|
+
*/
|
|
4018
|
+
setOptions(_patch: unknown): void;
|
|
4019
|
+
/**
|
|
4020
|
+
* Contribute this layout's serialisable config to a canvas-state snapshot (the
|
|
4021
|
+
* engine's `DefinitionSerializable` contract). The base captures the wiring
|
|
4022
|
+
* `targetLayerId`; iterative layouts holding tunable params (e.g. force
|
|
4023
|
+
* strengths) should override and spread `super.serializeDefinition()` with a
|
|
4024
|
+
* JSON-safe copy of those params.
|
|
4025
|
+
*/
|
|
4026
|
+
serializeDefinition(): Record<string, unknown> | undefined;
|
|
4027
|
+
/**
|
|
4028
|
+
* Run the layout against `layer`. Resolves when the run terminates
|
|
4029
|
+
* (either a natural settle or an external `stop()`).
|
|
4030
|
+
*
|
|
4031
|
+
* Calling `apply()` again on the same instance must cancel any in-flight
|
|
4032
|
+
* run first, and must record `run` on {@link runOptions} before emitting
|
|
4033
|
+
* `start`.
|
|
4034
|
+
*
|
|
4035
|
+
* @param run How this particular run should behave; see {@link LayoutRunOptions}.
|
|
4036
|
+
*/
|
|
4037
|
+
abstract apply(layer: TLayer, run?: LayoutRunOptions): Promise<void>;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
/**
|
|
4041
|
+
* `CanvasContext` — the shared service surface every Layer / Behaviour /
|
|
4042
|
+
* Layout receives at mount/register time.
|
|
4043
|
+
*
|
|
4044
|
+
* Architecture: see `architecture-proposal.md` §2.4.
|
|
4045
|
+
*
|
|
4046
|
+
* **One context, three audiences.** Per the proposal, there is no separate
|
|
4047
|
+
* `LayerContext` / `BehaviourContext` / `LayoutContext` — the same shape is
|
|
4048
|
+
* handed to every participant so cross-cutting access (read peer layers,
|
|
4049
|
+
* fire camera moves, tap telemetry) doesn't need three parallel context types.
|
|
4050
|
+
*
|
|
4051
|
+
* The `Canvas` builds a concrete object that satisfies this interface and
|
|
4052
|
+
* passes it down. Tests can construct a stub by satisfying these fields.
|
|
4053
|
+
*/
|
|
4054
|
+
|
|
4055
|
+
interface CanvasContext {
|
|
4056
|
+
/** Layer registry — `add / remove / get<T>(id) / list / byZOrder`. */
|
|
4057
|
+
readonly layers: LayerRegistry;
|
|
4058
|
+
/**
|
|
4059
|
+
* Behaviour registry — `register / setEnabled / get<T>(id) / list`.
|
|
4060
|
+
* Behaviours never auto-enable; the developer registers + enables explicitly
|
|
4061
|
+
* (`architecture-proposal.md` §2.2).
|
|
4062
|
+
*/
|
|
4063
|
+
readonly behaviours: BehaviourRegistry;
|
|
4064
|
+
/** Camera — pan/zoom/projection. Wraps a `pixi-viewport` `Viewport`. */
|
|
4065
|
+
readonly camera: Camera;
|
|
4066
|
+
/**
|
|
4067
|
+
* Pointer-gesture arbitration — at most one owner at a time. A behaviour that
|
|
4068
|
+
* needs the pointer to itself (drag, lasso, brush, resize, edge draw) claims
|
|
4069
|
+
* it here rather than suspending the camera's pan plugin behind its back;
|
|
4070
|
+
* `DragPanBehaviour` yields whenever `gestures.owner` names somebody else.
|
|
4071
|
+
*
|
|
4072
|
+
* Behaviours should reach for `Behaviour.claimGesture` /
|
|
2686
4073
|
* `Behaviour.releaseGesture` instead of calling this directly — the base class
|
|
2687
4074
|
* releases on `disable()` / `destroy()`, and a stranded claim would freeze
|
|
2688
4075
|
* both the camera and every other gesture.
|
|
@@ -2713,6 +4100,19 @@ interface CanvasContext {
|
|
|
2713
4100
|
* read this to find a parent element and to attach native DOM listeners.
|
|
2714
4101
|
*/
|
|
2715
4102
|
readonly canvasElement?: HTMLCanvasElement;
|
|
4103
|
+
/**
|
|
4104
|
+
* The canvas's named commands (`canvas.commands`) — for an extension that
|
|
4105
|
+
* dispatches by name, such as a keyboard-shortcut behaviour. Optional so a
|
|
4106
|
+
* hand-built context (a test double) needn't supply one.
|
|
4107
|
+
*/
|
|
4108
|
+
readonly commands?: CommandRegistry<unknown>;
|
|
4109
|
+
/**
|
|
4110
|
+
* The canvas's operation log — the record behind `canvas.history`. A data
|
|
4111
|
+
* layer attaches its store here on mount (`GraphStore.attachLog`) so the
|
|
4112
|
+
* store's recorded writes and the view's edits land in one undo order.
|
|
4113
|
+
* Optional so a hand-built context (a test double) needn't supply one.
|
|
4114
|
+
*/
|
|
4115
|
+
readonly log?: OperationLog;
|
|
2716
4116
|
/**
|
|
2717
4117
|
* Build a patch-emitting {@link ReactiveStore} — the factory behind
|
|
2718
4118
|
* `Layer.state`. Injected by the engine (which implements it with the
|
|
@@ -2746,6 +4146,31 @@ interface CanvasContext {
|
|
|
2746
4146
|
showMessage(text: string, timeout?: number): void;
|
|
2747
4147
|
/** Clear the current canvas message. */
|
|
2748
4148
|
clearMessage(): void;
|
|
4149
|
+
/**
|
|
4150
|
+
* Re-run the canvas's **active** layout (`definition.activeLayout`) — the
|
|
4151
|
+
* same call as `Canvas.runLayout(activeLayout, run)`. Lets a behaviour ask
|
|
4152
|
+
* for a re-flow without knowing which layout is showing (e.g.
|
|
4153
|
+
* `CollapseExpandBehaviour` after a group frame opens or closes). Resolves
|
|
4154
|
+
* once the run settles; resolves immediately when no layout is active.
|
|
4155
|
+
*
|
|
4156
|
+
* Optional so hand-built contexts (tests, the headless double) need not
|
|
4157
|
+
* provide it — callers use `ctx.runActiveLayout?.(…)`.
|
|
4158
|
+
*/
|
|
4159
|
+
runActiveLayout?(run?: LayoutRunOptions): Promise<void>;
|
|
4160
|
+
/**
|
|
4161
|
+
* Resolve on the first frame on which the canvas is **settled**: no layout
|
|
4162
|
+
* run in flight (its position transition included) and no camera glide.
|
|
4163
|
+
* Waits at least one frame, so writes made just before the call have
|
|
4164
|
+
* flushed. Resolves anyway after `timeoutMs` (default 15 000) so a
|
|
4165
|
+
* never-ending simulation can't hold a caller forever.
|
|
4166
|
+
*
|
|
4167
|
+
* What a playbook step and `FocusBehaviour`'s framing wait on. Not on the
|
|
4168
|
+
* public `Canvas` surface. Optional so hand-built contexts need not provide
|
|
4169
|
+
* it — callers use `ctx.whenSettled?.()`.
|
|
4170
|
+
*/
|
|
4171
|
+
whenSettled?(opts?: {
|
|
4172
|
+
timeoutMs?: number;
|
|
4173
|
+
}): Promise<void>;
|
|
2749
4174
|
}
|
|
2750
4175
|
|
|
2751
4176
|
/**
|
|
@@ -2976,134 +4401,6 @@ declare abstract class Layer<TOptions = unknown, TState extends object = object,
|
|
|
2976
4401
|
protected onVisibleChange(_value: boolean): void;
|
|
2977
4402
|
}
|
|
2978
4403
|
|
|
2979
|
-
/**
|
|
2980
|
-
* `Layout` — function from data to positions.
|
|
2981
|
-
*
|
|
2982
|
-
* Architecture: see `architecture-proposal.md` §2.3.
|
|
2983
|
-
*
|
|
2984
|
-
* Per the proposal:
|
|
2985
|
-
* - A Layout does NOT register with the canvas.
|
|
2986
|
-
* - It does NOT render.
|
|
2987
|
-
* - It does NOT subscribe to input.
|
|
2988
|
-
* - You instantiate it and call it against a layer.
|
|
2989
|
-
*
|
|
2990
|
-
* const layout = new D3ForceLayout({ charge: -300 });
|
|
2991
|
-
* layout.events.on('end', () => canvas.camera.fitContent(...));
|
|
2992
|
-
* await layout.apply(graphLayer);
|
|
2993
|
-
*
|
|
2994
|
-
* Continuous-running cases (e.g. always-relax force simulation) are handled
|
|
2995
|
-
* by a thin wrapper Behaviour that calls `apply()` on a tick — keeps the
|
|
2996
|
-
* Layout API clean while supporting the rare continuous case.
|
|
2997
|
-
*
|
|
2998
|
-
* Whether two layouts conflict is a domain concern (don't apply two layouts
|
|
2999
|
-
* to the same data) — not enforced here.
|
|
3000
|
-
*
|
|
3001
|
-
* ## Lifecycle events
|
|
3002
|
-
*
|
|
3003
|
-
* Every layout owns a typed `events` emitter and fires three lifecycle
|
|
3004
|
-
* events around `apply()`:
|
|
3005
|
-
*
|
|
3006
|
-
* - `start` — emitted once, synchronously, after the layout has set up
|
|
3007
|
-
* its internal state and just before it begins producing positions.
|
|
3008
|
-
* - `tick` — emitted whenever the layout writes a fresh batch of positions.
|
|
3009
|
-
* One-shot layouts (e.g. ELK) fire it once. Iterative layouts (force
|
|
3010
|
-
* sims) fire it on every iteration. High-frequency; subscribe sparingly.
|
|
3011
|
-
* - `end` — emitted once when the run terminates. `reason` distinguishes
|
|
3012
|
-
* a natural settle from an external `stop()` call.
|
|
3013
|
-
*
|
|
3014
|
-
* Subscribe to these events to drive camera fits, progress UI, etc. —
|
|
3015
|
-
* instead of listening to per-tick `data:changed` on the layer, which
|
|
3016
|
-
* conflates "structure changed" with "positions updated".
|
|
3017
|
-
*/
|
|
3018
|
-
|
|
3019
|
-
/**
|
|
3020
|
-
* Why the run ended.
|
|
3021
|
-
*
|
|
3022
|
-
* - `completed` — the layout settled / finished on its own.
|
|
3023
|
-
* - `stopped` — `stop()` (or a second `apply()`) cancelled it.
|
|
3024
|
-
*/
|
|
3025
|
-
type LayoutEndReason = 'completed' | 'stopped';
|
|
3026
|
-
/**
|
|
3027
|
-
* Lifecycle events fired by every `Layout`.
|
|
3028
|
-
*
|
|
3029
|
-
* Subclass-specific telemetry (e.g. d3-force's `alpha`) belongs on a
|
|
3030
|
-
* subclass-specific event map, not here.
|
|
3031
|
-
*/
|
|
3032
|
-
type LayoutEvents = {
|
|
3033
|
-
/**
|
|
3034
|
-
* Run is about to produce positions. Optional run-size / animation metadata
|
|
3035
|
-
* lets a `Canvas.runLayout` bridge forward it onto the canvas bus as
|
|
3036
|
-
* `layout:run:start` without reaching into layer internals. Every field is
|
|
3037
|
-
* optional — a layout that doesn't know (or care) emits `{}`, and the bridge
|
|
3038
|
-
* substitutes `0` / `false`.
|
|
3039
|
-
*
|
|
3040
|
-
* - `nodeCount` / `edgeCount` — size of the run, for progress UIs / telemetry.
|
|
3041
|
-
* - `animate` — whether the run animates its settle (iterative force sims)
|
|
3042
|
-
* vs. jumps straight to final positions; render policies branch on it.
|
|
3043
|
-
*/
|
|
3044
|
-
start: {
|
|
3045
|
-
nodeCount?: number;
|
|
3046
|
-
edgeCount?: number;
|
|
3047
|
-
animate?: boolean;
|
|
3048
|
-
};
|
|
3049
|
-
tick: Record<string, never>;
|
|
3050
|
-
end: {
|
|
3051
|
-
reason: LayoutEndReason;
|
|
3052
|
-
};
|
|
3053
|
-
};
|
|
3054
|
-
/** Construction options every layout shares (for the `LayoutRegistry`). */
|
|
3055
|
-
interface LayoutOptions {
|
|
3056
|
-
/** Stable id, used to address the layout in a `LayoutRegistry` / config. Default `'layout'`. */
|
|
3057
|
-
id?: string;
|
|
3058
|
-
/** The layer this layout is meant to run against. Informational — `apply(layer)` still takes one explicitly. */
|
|
3059
|
-
targetLayerId?: string;
|
|
3060
|
-
}
|
|
3061
|
-
declare abstract class Layout<TLayer extends Layer<any, any, any, any> = Layer<any, any, any, any>> {
|
|
3062
|
-
/** Stable id (registry / config key). */
|
|
3063
|
-
readonly id: string;
|
|
3064
|
-
/** The layer this layout targets, if declared at construction. */
|
|
3065
|
-
readonly targetLayerId?: string;
|
|
3066
|
-
/**
|
|
3067
|
-
* Stable **class kind** — a minification-safe discriminator matching the
|
|
3068
|
-
* `@invana/canvas-ui` settings-editor registry key (e.g. `'d3-force-layout'`,
|
|
3069
|
-
* `'elk-layout'`). Distinct from {@link id} (the per-instance key): all
|
|
3070
|
-
* `D3ForceLayout` instances share `kind: 'd3-force-layout'`. Concrete layouts
|
|
3071
|
-
* set it as a class field; left `undefined` on any that haven't, so consumers
|
|
3072
|
-
* fall back (e.g. to the class name). Lets domain-free tooling resolve an
|
|
3073
|
-
* instance's editor without an `instanceof` ladder.
|
|
3074
|
-
*/
|
|
3075
|
-
readonly kind?: string;
|
|
3076
|
-
/**
|
|
3077
|
-
* Lifecycle event bus. See class docs for the event vocabulary.
|
|
3078
|
-
* Subclasses with richer telemetry can declare their own typed
|
|
3079
|
-
* emitter on top (`override readonly events = new EventEmitter<MyEvents>()`).
|
|
3080
|
-
*/
|
|
3081
|
-
readonly events: EventEmitter<LayoutEvents>;
|
|
3082
|
-
constructor(opts?: LayoutOptions);
|
|
3083
|
-
/**
|
|
3084
|
-
* Live-reconfigure. Called by `Canvas.update({ layouts: { id: patch } })`.
|
|
3085
|
-
* Default no-op; iterative layouts (e.g. `D3ForceLayout`) override to merge
|
|
3086
|
-
* the patch and re-heat a running simulation.
|
|
3087
|
-
*/
|
|
3088
|
-
setOptions(_patch: unknown): void;
|
|
3089
|
-
/**
|
|
3090
|
-
* Contribute this layout's serialisable config to a canvas-state snapshot (the
|
|
3091
|
-
* engine's `DefinitionSerializable` contract). The base captures the wiring
|
|
3092
|
-
* `targetLayerId`; iterative layouts holding tunable params (e.g. force
|
|
3093
|
-
* strengths) should override and spread `super.serializeDefinition()` with a
|
|
3094
|
-
* JSON-safe copy of those params.
|
|
3095
|
-
*/
|
|
3096
|
-
serializeDefinition(): Record<string, unknown> | undefined;
|
|
3097
|
-
/**
|
|
3098
|
-
* Run the layout against `layer`. Resolves when the run terminates
|
|
3099
|
-
* (either a natural settle or an external `stop()`).
|
|
3100
|
-
*
|
|
3101
|
-
* Calling `apply()` again on the same instance must cancel any in-flight
|
|
3102
|
-
* run first.
|
|
3103
|
-
*/
|
|
3104
|
-
abstract apply(layer: TLayer): Promise<void>;
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
4404
|
/**
|
|
3108
4405
|
* `LayoutRegistry` — stores the Layouts registered on a Canvas, addressed by id.
|
|
3109
4406
|
*
|
|
@@ -3230,11 +4527,29 @@ declare class HeadlessElementRenderer implements IElementRenderer {
|
|
|
3230
4527
|
x: number;
|
|
3231
4528
|
y: number;
|
|
3232
4529
|
} | null;
|
|
4530
|
+
/**
|
|
4531
|
+
* Display overrides by shape id — recorded so a test can assert what a
|
|
4532
|
+
* behaviour asked to draw. Nothing is drawn, and positions stay logical.
|
|
4533
|
+
*/
|
|
4534
|
+
readonly displayOverrides: Map<string, ShapeDisplayOverride>;
|
|
4535
|
+
setShapeDisplayOverride(id: string, override: ShapeDisplayOverride | null): void;
|
|
4536
|
+
clearShapeDisplayOverrides(): void;
|
|
4537
|
+
/**
|
|
4538
|
+
* Ids whose text the LOD channel has hidden (`setShapeTextVisible` /
|
|
4539
|
+
* `setConnectorTextVisible` with `false`) — recorded so a behaviour test can
|
|
4540
|
+
* assert what a text LOD asked for.
|
|
4541
|
+
*/
|
|
4542
|
+
readonly textHidden: Set<string>;
|
|
4543
|
+
setShapeTextVisible(id: string, visible: boolean): void;
|
|
4544
|
+
setConnectorTextVisible(id: string, visible: boolean): void;
|
|
4545
|
+
isTextVisible(id: string): boolean;
|
|
4546
|
+
/** The label-size policy last pushed per target — recorded for assertions. */
|
|
4547
|
+
readonly labelSizePolicies: Record<LabelSizeTarget, LabelSizePolicy | null>;
|
|
4548
|
+
setLabelSizePolicy(target: LabelSizeTarget, policy: LabelSizePolicy | null): void;
|
|
3233
4549
|
scaleShape(): void;
|
|
3234
4550
|
setConnectorStroke(): void;
|
|
3235
4551
|
scaleConnectorStroke(): void;
|
|
3236
4552
|
setRaised(): void;
|
|
3237
|
-
setShapeTextVisible(): void;
|
|
3238
4553
|
setShapeIconVisible(): void;
|
|
3239
4554
|
setShapeImageVisible(): void;
|
|
3240
4555
|
setLabelsResolution(): void;
|
|
@@ -3983,6 +5298,39 @@ declare function resolveConnectorBadgePosition(path: Path, badgeLocalBounds: Rec
|
|
|
3983
5298
|
rotation: number;
|
|
3984
5299
|
};
|
|
3985
5300
|
|
|
5301
|
+
/**
|
|
5302
|
+
* The scale to draw a label at so its on-screen font size follows `policy`.
|
|
5303
|
+
*
|
|
5304
|
+
* Positional arguments, not an options object: the renderer calls this once per
|
|
5305
|
+
* label per zoom-changed frame, so it must not allocate.
|
|
5306
|
+
*
|
|
5307
|
+
* @param fontSize The label's authored font size — its on-screen size at zoom `1`.
|
|
5308
|
+
* @param zoom Current camera zoom (`camera.scale`).
|
|
5309
|
+
* @param hostScale Visual scale the label inherits from its host before any label
|
|
5310
|
+
* scaling — e.g. a node-size LOD drawing the node at `1 / zoom`; `1` for
|
|
5311
|
+
* connectors. Excludes display-only magnification (a fisheye lens), which
|
|
5312
|
+
* should still enlarge the label.
|
|
5313
|
+
* @param policy The policy in force, or `null` for none.
|
|
5314
|
+
* @param contained `true` when the label must stay inside its host (an `inside-*`
|
|
5315
|
+
* placement): the result never exceeds `1`, so the host's fit-to-box budget holds.
|
|
5316
|
+
*
|
|
5317
|
+
* - `natural = fontSize × zoom × hostScale` — what the label measures on
|
|
5318
|
+
* screen with no policy.
|
|
5319
|
+
* - `target = zoomGrowth === undefined ? natural : fontSize × zoom ^ zoomGrowth`,
|
|
5320
|
+
* then clamped to `[minFontPx, maxFontPx]`.
|
|
5321
|
+
* - Result: `target / natural`, capped at `1` for a contained label.
|
|
5322
|
+
*
|
|
5323
|
+
* Returns `1` for a `null` policy and for degenerate input (non-positive font
|
|
5324
|
+
* size, zoom or host scale), so a caller can apply the result unconditionally.
|
|
5325
|
+
*
|
|
5326
|
+
* @example
|
|
5327
|
+
* ```ts
|
|
5328
|
+
* resolveLabelScale(12, 4, 1, { maxFontPx: 20 });
|
|
5329
|
+
* // → 20 / 48 ≈ 0.417 — the label reads 20px on screen instead of 48px
|
|
5330
|
+
* ```
|
|
5331
|
+
*/
|
|
5332
|
+
declare function resolveLabelScale(fontSize: number, zoom: number, hostScale: number, policy: LabelSizePolicy | null, contained?: boolean): number;
|
|
5333
|
+
|
|
3986
5334
|
/**
|
|
3987
5335
|
* Options for constructing a `Tween`. `from` / `to` / `duration` are required;
|
|
3988
5336
|
* everything else is optional and falls back to a sensible default.
|
|
@@ -4058,8 +5406,12 @@ interface PositionTransitionOptions {
|
|
|
4058
5406
|
* Called once per frame with the interpolated buffer — write it straight to
|
|
4059
5407
|
* the store (e.g. `store.setPositionsBulk(ids, xy)`). The SAME buffer is
|
|
4060
5408
|
* reused every frame; copy it if you need to retain it.
|
|
5409
|
+
*
|
|
5410
|
+
* `progress` is the **eased** fraction of the transition, `0..1` — the same
|
|
5411
|
+
* factor the buffer was interpolated with — and is exactly `1` on the final
|
|
5412
|
+
* frame. Lets a caller move something else in lock-step (e.g. the camera).
|
|
4061
5413
|
*/
|
|
4062
|
-
onFrame: (xy: Float32Array) => void;
|
|
5414
|
+
onFrame: (xy: Float32Array, progress: number) => void;
|
|
4063
5415
|
/** Fires once when the transition finishes naturally. NOT called on `cancel()`. */
|
|
4064
5416
|
onComplete?: () => void;
|
|
4065
5417
|
}
|
|
@@ -4205,4 +5557,4 @@ interface Selected<U> {
|
|
|
4205
5557
|
*/
|
|
4206
5558
|
declare function select<T, U>(store: ReactiveStore<T>, selector: (state: T) => U, isEqual?: (a: U, b: U) => boolean): Selected<U>;
|
|
4207
5559
|
|
|
4208
|
-
export { type AnnotationRecord, BadgeOptions, BadgePlacement, BaseConnectorSpec, BaseShapeSpec, Behaviour, type BehaviourOptions, BehaviourRegistry, type BehaviourRegistryOptions, CANVAS_SOURCE, Camera, type CameraChangeKind, type CameraInputConfig, type CameraInputModifier, type CameraOptions, type CameraTransform, type CameraTransformValue, type CanvasActions, type CanvasContext, type CanvasEvent, CanvasEventBus, type CanvasGlobalEvents, type CanvasSceneOptions, type CanvasStore, CanvasThemeState, type CanvasView, type ColumnArray, type ColumnSchema, ColumnStore, type ColumnStoreOptions, type ColumnType, type ColumnValue, type CustomElementCtor, DEFAULT_ENDPOINT_BADGE_GAP_PX, DEFAULT_POSITION_TRANSITION_MS, type DataSource, DecorationSpec, type DeepPartial, DefaultGestureArbiter, DirtyBatcher, type DirtySnapshot, EASING_NAMES, type Easing, type EasingName, type EdgeRecord, EffectSpec, ElementEventMap, EventEmitter, EventMap, type EventSource, type EventSourceKind, FlushMode, type FramePhase, type FramePhaseTimings, type FrameStats, type FrameTick, type GestureArbiter, type GestureClaimOptions, type GraphInput, type GroupRecord, HeadlessCameraBinding, HeadlessElementRenderer, HeadlessRenderer, HeadlessSurface, HitResult, IAnchor, type IBehaviour, type ICameraBinding, type IElementRenderer, type ILayer, INHERIT, type IOverlayDevice, IPathStyle, type IRenderer, IRouter, type ISurface, type ISurfaceHost, type Inherit, type IntentLogEntry, type InteractionKind, type KindDelta, LOOP_CURVE_PRESETS, LabelContent, LabelWrap, Layer, LayerData, type LayerFlush, type LayerOptions, LayerRegistry, type LayerRegistryOptions, Layout, type LayoutEndReason, type LayoutEvents, type LayoutOptions, LayoutRegistry, type LayoutRegistryOptions, Listener, type LoopCurvePresetName, type MountedDecoration, NODE_FLAG, type NodeDelta, type NodeRecord, type OverlayFill, type OverlayFillLike, type OverlaySpace, type OverlayStroke, type Patch, Path, type PinchInputOptions, Point, type PosSchema, type PositionTransition, type PositionTransitionOptions, type QueryStatus, type ReactiveStore, type Recipe, Rect, type RenderPreference, type RendererBackend, type RendererCapabilities, type RendererInitOptions, type RendererMountOptions, type ResolvedTheme, type RowOf, type Selected, ShapeFill, ShapeStroke, SourceEmitter, SpecFlush, type SpecProjectionTarget, SpecProjector, type SpecProjectorOptions, SpecStore, type StateCell, type StoreChange, type SurfaceBackdrop, type SurfaceOptions, type SurfaceSpace, type Tap, type TapOptions, type ThemeKind, type ThemeMode, type ThemeState, type Themed, Tween, type TweenOptions, type Update, Vec2, type WheelInputOptions, animatePositions, attrs, bezierPathStyle, boundaryAnchor, bumpHorizontalPathStyle, bumpRadialPathStyle, bundlePathStyle, centerAnchor, connectorToSvg, createActions, defaultCanvasView, defaultEqual, distanceToPolylineSq, easeInOutCubic, easeInOutSine, easeOutCubic, easeOutQuad, edgePortAnchor, erRouter, esc, fillPaint, hexToCss, isInherit, linear, loopCurvePathStyle, loopPolylinePathStyle, manhattanRouter, metroRouter, normalPathStyle, oneSideRouter, originToBadgeLocal, orthRouter, pathBounds, pathToSvgD, perpendicularAnchor, pointsAttr, quadraticPathStyle, resolveBadgePosition, resolveConnectorBadgePosition, resolveEasing, resolveThemed, roundedPathStyle, samplePath, samplePathAt, select, shallowEqual, shapeSpecToSvg, silhouettePortAnchor, smoothPathStyle, stepRadialPathStyle, straightRouter, strokePaint, n as svgNum, tangentAt, textContent, trimPathEnds };
|
|
5560
|
+
export { type AnnotationRecord, BadgeOptions, BadgePlacement, BaseConnectorSpec, BaseShapeSpec, Behaviour, type BehaviourOptions, BehaviourRegistry, type BehaviourRegistryOptions, CANVAS_SOURCE, Camera, type CameraChangeKind, type CameraInputConfig, type CameraInputModifier, type CameraIntent, type CameraOptions, type CameraTransform, type CameraTransformValue, type CanvasActions, type CanvasCommand, type CanvasContext, type CanvasEvent, CanvasEventBus, type CanvasGlobalEvents, type CanvasSceneOptions, type CanvasStore, CanvasThemeState, type CanvasView, type ColumnArray, type ColumnSchema, ColumnStore, type ColumnStoreOptions, type ColumnType, type ColumnValue, type CommandArgKind, type CommandArgSpec, type CommandArgsOf, type CommandMap, type CommandName, type CommandOption, CommandRegistry, type CommandRegistryOptions, type ControlChoiceItemSpec, type ControlChoiceOption, type ControlCommandItemSpec, type ControlDividerItemSpec, type ControlItemSpec, type ControlPanelAnchor, type ControlPanelInsets, type ControlPanelPlacement, type ControlPanelPosition, type ControlPanelSpec, type ControlSlotItemSpec, type ControlTextItemSpec, type ControlToggleItemSpec, type ControlWidgetItemSpec, type CustomElementCtor, DEFAULT_ENDPOINT_BADGE_GAP_PX, DEFAULT_POSITION_TRANSITION_MS, type DataLogPart, type DataOpAdapter, type DataSource, DecorationSpec, type DeepPartial, DefaultGestureArbiter, type Delta, type DeltaOptions, type DeltaRecord, DirtyBatcher, type DirtySnapshot, EASING_NAMES, type Easing, type EasingName, type EdgeRecord, EffectSpec, ElementEventMap, EventEmitter, EventMap, type EventSource, type EventSourceKind, FlushMode, type FramePhase, type FramePhaseTimings, type FrameStats, type FrameTick, type GestureArbiter, type GestureClaimOptions, type GraphInput, type GroupRecord, HeadlessCameraBinding, HeadlessElementRenderer, HeadlessRenderer, HeadlessSurface, type HistoryView, HitResult, IAnchor, type IBehaviour, type ICameraBinding, type IElementRenderer, type ILayer, INHERIT, type IOverlayDevice, IPathStyle, type IRenderer, IRouter, type ISurface, type ISurfaceHost, type Inherit, type IntentLogEntry, type InteractionKind, type KindDelta, LOOP_CURVE_PRESETS, LabelContent, type LabelSizePolicy, type LabelSizeTarget, LabelWrap, Layer, LayerData, type LayerFlush, type LayerOptions, LayerRegistry, type LayerRegistryOptions, Layout, type LayoutDataRunOptions, type LayoutEndReason, type LayoutEvents, type LayoutOptions, LayoutRegistry, type LayoutRegistryOptions, type LayoutRunOptions, Listener, type LogEntry, type LogEntryFilter, type LogEntryStatus, type LogGroupMeta, type LogPart, type LogStepInfo, type LoopCurvePresetName, type MountedDecoration, NODE_FLAG, type NodeDelta, type NodeRecord, type OperationLog, type OverlayFill, type OverlayFillLike, type OverlaySpace, type OverlayStroke, type Patch, Path, type PinchInputOptions, type Playbook, type PlaybookSpec, Point, type PosSchema, type PositionTransition, type PositionTransitionOptions, type QueryStatus, type ReactiveStore, type Recipe, Rect, type RenderPreference, type RendererBackend, type RendererCapabilities, type RendererInitOptions, type RendererMountOptions, type ResolvedTheme, type RowOf, type Selected, type ShapeDisplayOverride, ShapeFill, ShapeStroke, SourceEmitter, SpecFlush, type SpecProjectionTarget, SpecProjector, type SpecProjectorOptions, SpecStore, type StateCell, type StepSpec, type StoreChange, type SurfaceBackdrop, type SurfaceOptions, type SurfaceSpace, type Tap, type TapOptions, type ThemeKind, type ThemeMode, type ThemeState, type Themed, Tween, type TweenOptions, type Update, Vec2, type ViewLogPart, type WheelInputOptions, animatePositions, attrs, bezierPathStyle, boundaryAnchor, bumpHorizontalPathStyle, bumpRadialPathStyle, bundlePathStyle, centerAnchor, connectorToSvg, createActions, defaultCanvasView, defaultEqual, distanceToPolylineSq, easeInOutCubic, easeInOutSine, easeOutCubic, easeOutQuad, edgePortAnchor, erRouter, esc, fillPaint, hexToCss, isInherit, linear, loopCurvePathStyle, loopPolylinePathStyle, manhattanRouter, metroRouter, normalPathStyle, oneSideRouter, originToBadgeLocal, orthRouter, pathBounds, pathToSvgD, perpendicularAnchor, pointsAttr, quadraticPathStyle, resolveBadgePosition, resolveConnectorBadgePosition, resolveEasing, resolveLabelScale, resolveThemed, roundedPathStyle, samplePath, samplePathAt, select, shallowEqual, shapeSpecToSvg, silhouettePortAnchor, smoothPathStyle, stepRadialPathStyle, straightRouter, strokePaint, n as svgNum, tangentAt, textContent, trimPathEnds };
|