@invana/canvas-core 0.0.14 → 0.0.16
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 +1533 -162
- 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,33 @@ 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;
|
|
773
|
+
};
|
|
774
|
+
/** An off-screen solve advanced — `done` of `total` iterations. Nothing is drawn until `layout:run:tick` / `end`. */
|
|
775
|
+
'layout:run:progress': {
|
|
776
|
+
id: string;
|
|
777
|
+
layerId: string;
|
|
778
|
+
done: number;
|
|
779
|
+
total: number;
|
|
755
780
|
};
|
|
756
781
|
'canvas:renderer:ready': {
|
|
757
782
|
backend: string;
|
|
@@ -986,6 +1011,640 @@ declare const EASING_NAMES: EasingName[];
|
|
|
986
1011
|
*/
|
|
987
1012
|
declare function resolveEasing(name: EasingName | undefined, fallback?: Easing): Easing;
|
|
988
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Control panels — floating UI chrome inside the canvas, as **pure data**.
|
|
1016
|
+
*
|
|
1017
|
+
* A control panel is a small toolbar / widget cluster pinned over the canvas
|
|
1018
|
+
* (zoom buttons bottom-right, a brand + mode picker top-left, …). Its spec lives
|
|
1019
|
+
* in `CanvasView.definition.controlPanels`, so panels persist, export and
|
|
1020
|
+
* (later) sync like every other part of the definition. Edits are ordinary
|
|
1021
|
+
* `view` patches: a Studio edit (`canvas.update(…, 'edit:control-panels')`) is
|
|
1022
|
+
* recorded by `Canvas.history` and undone by the `history.undo` command, while a
|
|
1023
|
+
* programmatic write (a `<ControlPanel>` mount) is not.
|
|
1024
|
+
*
|
|
1025
|
+
* Specs hold **no closures and no components**: an item names what it does by
|
|
1026
|
+
* string — a `command` (resolved by the canvas's `CommandRegistry`), an `icon`
|
|
1027
|
+
* and a `widget` (resolved by the UI kit's registries), or a `slot` (non-persisted
|
|
1028
|
+
* React content registered by the declaring component). The kernel only stores
|
|
1029
|
+
* and validates the shape; drawing it is the UI kit's job.
|
|
1030
|
+
*/
|
|
1031
|
+
/** A preset anchor on the canvas's 9-point grid. */
|
|
1032
|
+
type ControlPanelAnchor = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
1033
|
+
/**
|
|
1034
|
+
* Exact insets from the canvas edges, in px or any CSS length. Set one of
|
|
1035
|
+
* `top`/`bottom` and one of `left`/`right` (setting both opposite sides
|
|
1036
|
+
* stretches the panel between them).
|
|
1037
|
+
*/
|
|
1038
|
+
interface ControlPanelInsets {
|
|
1039
|
+
top?: number | string;
|
|
1040
|
+
right?: number | string;
|
|
1041
|
+
bottom?: number | string;
|
|
1042
|
+
left?: number | string;
|
|
1043
|
+
}
|
|
1044
|
+
/** Where a panel sits: a preset {@link ControlPanelAnchor} or exact {@link ControlPanelInsets}. */
|
|
1045
|
+
type ControlPanelPosition = ControlPanelAnchor | ControlPanelInsets;
|
|
1046
|
+
/** Fields shared by every {@link ControlItemSpec}. */
|
|
1047
|
+
interface ControlItemBase {
|
|
1048
|
+
/** Stable key within the panel; defaults to the item's index. */
|
|
1049
|
+
key?: string;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* A button that runs a named command on click. Disabled while the command is
|
|
1053
|
+
* missing or reports `isEnabled() === false`.
|
|
1054
|
+
*
|
|
1055
|
+
* Unlike a {@link ControlToggleItemSpec} it never shows a pressed state, but it
|
|
1056
|
+
* may still **swap its face** while the command's `isActive(args)` is true — the
|
|
1057
|
+
* `active*` fields below. That's a Run button that turns into Stop while a
|
|
1058
|
+
* layout runs (`layout.toggle`), or an Erase button that reads "Selection"
|
|
1059
|
+
* while something is selected (`graph.erase`).
|
|
1060
|
+
*/
|
|
1061
|
+
interface ControlCommandItemSpec extends ControlItemBase {
|
|
1062
|
+
type: 'command';
|
|
1063
|
+
/** Command name in the canvas's `CommandRegistry`, e.g. `'camera.fit'`. */
|
|
1064
|
+
command: string;
|
|
1065
|
+
/** Arguments passed to the command's `run` / `isEnabled`. Must be JSON. */
|
|
1066
|
+
args?: unknown;
|
|
1067
|
+
/** Icon name, resolved by the UI kit's icon registry (e.g. `'maximize'`). */
|
|
1068
|
+
icon?: string;
|
|
1069
|
+
/** Tooltip + accessible label. */
|
|
1070
|
+
label: string;
|
|
1071
|
+
/** Optional visible text beside the icon. */
|
|
1072
|
+
text?: string;
|
|
1073
|
+
/** Icon name while the command is active. Defaults to {@link icon}. */
|
|
1074
|
+
activeIcon?: string;
|
|
1075
|
+
/** Tooltip + label while the command is active. Defaults to {@link label}. */
|
|
1076
|
+
activeLabel?: string;
|
|
1077
|
+
/** Visible text while the command is active. Defaults to {@link text}. */
|
|
1078
|
+
activeText?: string;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* A two-state toggle bound to a command: its active state is the command's
|
|
1082
|
+
* `isActive(args)`, and clicking runs the command (which flips it).
|
|
1083
|
+
*/
|
|
1084
|
+
interface ControlToggleItemSpec extends ControlItemBase {
|
|
1085
|
+
type: 'toggle';
|
|
1086
|
+
/** Command name in the canvas's `CommandRegistry`, e.g. `'view.lock'`. */
|
|
1087
|
+
command: string;
|
|
1088
|
+
/** Arguments passed to the command's `run` / `isActive` / `isEnabled`. Must be JSON. */
|
|
1089
|
+
args?: unknown;
|
|
1090
|
+
/** Icon name while inactive (and while active, unless {@link activeIcon} is set). */
|
|
1091
|
+
icon?: string;
|
|
1092
|
+
/** Icon name while active. */
|
|
1093
|
+
activeIcon?: string;
|
|
1094
|
+
/** Tooltip + label while inactive. */
|
|
1095
|
+
label: string;
|
|
1096
|
+
/** Tooltip + label while active. Defaults to {@link label}. */
|
|
1097
|
+
activeLabel?: string;
|
|
1098
|
+
}
|
|
1099
|
+
/** One option of a {@link ControlChoiceItemSpec}. */
|
|
1100
|
+
interface ControlChoiceOption {
|
|
1101
|
+
/** Passed to the command as `args.value` when picked. */
|
|
1102
|
+
value: string;
|
|
1103
|
+
/** Human label. */
|
|
1104
|
+
label: string;
|
|
1105
|
+
/** Icon name, resolved by the UI kit's icon registry. */
|
|
1106
|
+
icon?: string;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* A pick-one control (select mode, edge type, active layout) bound to a command
|
|
1110
|
+
* that reports a `value`. Picking an option runs the command with
|
|
1111
|
+
* `{ ...args, value }`.
|
|
1112
|
+
*/
|
|
1113
|
+
interface ControlChoiceItemSpec extends ControlItemBase {
|
|
1114
|
+
type: 'choice';
|
|
1115
|
+
/** Command name in the canvas's `CommandRegistry`, e.g. `'select.mode'`. */
|
|
1116
|
+
command: string;
|
|
1117
|
+
/** Arguments passed to the command (plus `value` when picking). Must be JSON. */
|
|
1118
|
+
args?: Record<string, unknown>;
|
|
1119
|
+
/** Trigger label + menu heading. */
|
|
1120
|
+
label: string;
|
|
1121
|
+
/** The options. Default: the command's own `options()`. */
|
|
1122
|
+
options?: ControlChoiceOption[];
|
|
1123
|
+
/** A collapsed dropdown (default) or every option inline as a segmented group. */
|
|
1124
|
+
display?: 'dropdown' | 'segmented';
|
|
1125
|
+
}
|
|
1126
|
+
/** A named widget from the UI kit's widget registry (e.g. `'zoom-readout'`). */
|
|
1127
|
+
interface ControlWidgetItemSpec extends ControlItemBase {
|
|
1128
|
+
type: 'widget';
|
|
1129
|
+
/** Widget name in the UI kit's widget registry. */
|
|
1130
|
+
widget: string;
|
|
1131
|
+
/** Widget options. Must be JSON. */
|
|
1132
|
+
options?: Record<string, unknown>;
|
|
1133
|
+
}
|
|
1134
|
+
/** A group separator. */
|
|
1135
|
+
interface ControlDividerItemSpec extends ControlItemBase {
|
|
1136
|
+
type: 'divider';
|
|
1137
|
+
}
|
|
1138
|
+
/** Static text (a brand, a caption). */
|
|
1139
|
+
interface ControlTextItemSpec extends ControlItemBase {
|
|
1140
|
+
type: 'text';
|
|
1141
|
+
text: string;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* A placeholder for **non-persisted** React content, registered at runtime under
|
|
1145
|
+
* {@link slot} (the declaring component's `children` use the panel id). Exported
|
|
1146
|
+
* state keeps the placeholder; a canvas that never registers the slot renders
|
|
1147
|
+
* nothing there.
|
|
1148
|
+
*/
|
|
1149
|
+
interface ControlSlotItemSpec extends ControlItemBase {
|
|
1150
|
+
type: 'slot';
|
|
1151
|
+
/** Slot name in the runtime slot registry. */
|
|
1152
|
+
slot: string;
|
|
1153
|
+
}
|
|
1154
|
+
/** One item in a {@link ControlPanelSpec} — pure JSON, resolved by name at render time. */
|
|
1155
|
+
type ControlItemSpec = ControlCommandItemSpec | ControlToggleItemSpec | ControlChoiceItemSpec | ControlWidgetItemSpec | ControlDividerItemSpec | ControlTextItemSpec | ControlSlotItemSpec;
|
|
1156
|
+
/**
|
|
1157
|
+
* Which surface draws a panel. `'canvas'` floats it over the canvas (the
|
|
1158
|
+
* `position` / `offset` / `stretch` fields place it there). The `header-*` and
|
|
1159
|
+
* `footer-*` placements put it in a region of the app shell's header or footer
|
|
1160
|
+
* rail instead — `GraphCanvasApp`'s left / centre / right — where it flows
|
|
1161
|
+
* inline after that region's own content: `position`, `offset` and `stretch`
|
|
1162
|
+
* are ignored, it is always a row, and `surface` defaults to `false`. A shell
|
|
1163
|
+
* that doesn't draw a rail ignores panels placed in it.
|
|
1164
|
+
*/
|
|
1165
|
+
type ControlPanelPlacement = 'canvas' | 'header-left' | 'header-center' | 'header-right' | 'footer-left' | 'footer-center' | 'footer-right';
|
|
1166
|
+
/**
|
|
1167
|
+
* A control panel — pure JSON, stored in `CanvasView.definition.controlPanels`
|
|
1168
|
+
* keyed by panel id. Floats over the canvas by default; {@link placement} can
|
|
1169
|
+
* put it in the app header or footer instead.
|
|
1170
|
+
*/
|
|
1171
|
+
interface ControlPanelSpec {
|
|
1172
|
+
/** Stable discriminator for tooling (the Studio's editor lookup). */
|
|
1173
|
+
kind: 'control-panel';
|
|
1174
|
+
/**
|
|
1175
|
+
* The surface that draws the panel. Default `'canvas'`. A header / footer
|
|
1176
|
+
* placement is drawn by a host that renders those rail regions
|
|
1177
|
+
* (`GraphCanvasApp`, or `<RegionControlPanels>` in a custom shell);
|
|
1178
|
+
* `<ControlPanels>` skips it.
|
|
1179
|
+
*/
|
|
1180
|
+
placement?: ControlPanelPlacement;
|
|
1181
|
+
/** Where the panel sits over the canvas. Default `'top-left'`. Ignored for a header / footer placement. */
|
|
1182
|
+
position?: ControlPanelPosition;
|
|
1183
|
+
/**
|
|
1184
|
+
* Distance from the anchored edges for a preset {@link position}, in px —
|
|
1185
|
+
* one number for both axes or `{ x, y }`. Ignored for insets and header / footer
|
|
1186
|
+
* placements. Default `8`.
|
|
1187
|
+
*/
|
|
1188
|
+
offset?: number | {
|
|
1189
|
+
x: number;
|
|
1190
|
+
y: number;
|
|
1191
|
+
};
|
|
1192
|
+
/**
|
|
1193
|
+
* Item flow. Default: `'vertical'` for the `left` / `right` anchors,
|
|
1194
|
+
* `'horizontal'` everywhere else.
|
|
1195
|
+
*/
|
|
1196
|
+
orientation?: 'horizontal' | 'vertical';
|
|
1197
|
+
/**
|
|
1198
|
+
* Stretch along the anchored edge — full height for `left` / `right`, full
|
|
1199
|
+
* width for `top` / `bottom`. Ignored for corners, `center` and insets.
|
|
1200
|
+
* Default `false`.
|
|
1201
|
+
*/
|
|
1202
|
+
stretch?: boolean;
|
|
1203
|
+
/** Draw the card surface (background, border, shadow). Default `true` over the canvas, `false` in a header / footer rail. */
|
|
1204
|
+
surface?: boolean;
|
|
1205
|
+
/** Show the panel. Default `true`. */
|
|
1206
|
+
visible?: boolean;
|
|
1207
|
+
/** The panel's items, in order. */
|
|
1208
|
+
items: ControlItemSpec[];
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* The operation-log vocabulary — what the canvas records (history) and what a
|
|
1213
|
+
* playbook replays (steps). Types only: the log itself (`createOperationLog`)
|
|
1214
|
+
* lives in `@invana/canvas-store`, the one data door (`GraphStore.applyDelta`)
|
|
1215
|
+
* in `@invana/graph`.
|
|
1216
|
+
*
|
|
1217
|
+
* Two directions, never mixed (RFC
|
|
1218
|
+
* `docs/rfcs/feat/2026-09-28-an-analysis-cannot-be-recorded-or-replayed.md`,
|
|
1219
|
+
* D-7):
|
|
1220
|
+
*
|
|
1221
|
+
* - **History = record.** {@link OperationLog} is written only by the canvas —
|
|
1222
|
+
* view patches from the reactive store and data ops from each registered
|
|
1223
|
+
* {@link DataOpAdapter} — and carries a free-text `actor` on every
|
|
1224
|
+
* {@link LogEntry}. {@link HistoryView} is its read + undo surface
|
|
1225
|
+
* (`canvas.history`).
|
|
1226
|
+
* - **Playbook = script.** A list of JSON {@link StepSpec}s; playing one calls
|
|
1227
|
+
* the ordinary canvas methods, and history records the result like any other
|
|
1228
|
+
* change.
|
|
1229
|
+
*/
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* A **view** share of a change: reactive-store patches plus their inverse.
|
|
1233
|
+
* `undoable: false` marks view intent that is recorded but skipped by plain
|
|
1234
|
+
* undo (selection, focus) — a step, or `revertTo`, still reverts it.
|
|
1235
|
+
*/
|
|
1236
|
+
interface ViewLogPart {
|
|
1237
|
+
kind: 'view';
|
|
1238
|
+
/** The action the store change carried (e.g. `'edit:control-panels'`). */
|
|
1239
|
+
action?: string;
|
|
1240
|
+
/** Forward patches (apply to the state before → the state after). */
|
|
1241
|
+
patches: Patch[];
|
|
1242
|
+
/** Inverse patches (apply to the state after → the state before). */
|
|
1243
|
+
inverse: Patch[];
|
|
1244
|
+
/** Whether plain undo / redo applies this part. */
|
|
1245
|
+
undoable: boolean;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* A **data** share of a change: ops against one registered data source, in
|
|
1249
|
+
* application order. The ops are opaque to the log — the source's
|
|
1250
|
+
* {@link DataOpAdapter} knows how to replay them (a graph source records its
|
|
1251
|
+
* `HistoryOp`s).
|
|
1252
|
+
*/
|
|
1253
|
+
interface DataLogPart {
|
|
1254
|
+
kind: 'data';
|
|
1255
|
+
/** Which {@link DataOpAdapter} replays these ops. */
|
|
1256
|
+
sourceId: string;
|
|
1257
|
+
/** Ops in application order. Undo replays their inverses in reverse. */
|
|
1258
|
+
ops: unknown[];
|
|
1259
|
+
}
|
|
1260
|
+
/** One source's share of a change. A single {@link LogEntry} can hold both kinds. */
|
|
1261
|
+
type LogPart = ViewLogPart | DataLogPart;
|
|
1262
|
+
/**
|
|
1263
|
+
* One history entry — one undo step. Kept for the life of the canvas (no
|
|
1264
|
+
* limit); `clear()` runs only when a new canvas state loads.
|
|
1265
|
+
*/
|
|
1266
|
+
interface LogEntry {
|
|
1267
|
+
/** Stable id, unique within the log. */
|
|
1268
|
+
id: string;
|
|
1269
|
+
/** When the entry was recorded (or last merged into), in `performance.now()` ms. */
|
|
1270
|
+
at: number;
|
|
1271
|
+
/**
|
|
1272
|
+
* Who made the change — free text (`'user'`, `'user:ravi'`, `'engine'`,
|
|
1273
|
+
* `'assistant'`, `'feed:twitter'`). Defaults to the canvas's session actor.
|
|
1274
|
+
*/
|
|
1275
|
+
actor: string;
|
|
1276
|
+
/** Human label: a playbook step's title, a graph transaction's label (`'paste'`). */
|
|
1277
|
+
title?: string;
|
|
1278
|
+
/** Set when a playbook step produced the entry (or adopted it — `Playbook.addStep` of a `sinceLastStep` result). */
|
|
1279
|
+
stepId?: string;
|
|
1280
|
+
/**
|
|
1281
|
+
* Set on a **streamed** entry — writes made with `applyDelta(delta, { coalesce: true })`,
|
|
1282
|
+
* merged into one open entry per actor (RFC G12). Plain undo steps over it;
|
|
1283
|
+
* a playbook's `revertTo` / `replayTo` still applies it.
|
|
1284
|
+
*/
|
|
1285
|
+
coalesced?: true;
|
|
1286
|
+
/** The parts, in the order they were recorded. */
|
|
1287
|
+
parts: LogPart[];
|
|
1288
|
+
}
|
|
1289
|
+
/** Filter for {@link OperationLog.entries}. Absent fields match everything. */
|
|
1290
|
+
interface LogEntryFilter {
|
|
1291
|
+
actor?: string;
|
|
1292
|
+
stepId?: string;
|
|
1293
|
+
}
|
|
1294
|
+
/** What {@link HistoryView.peekUndo} / {@link HistoryView.peekRedo} report about an entry. */
|
|
1295
|
+
interface LogStepInfo {
|
|
1296
|
+
/** The action of the entry's first view part, when it has one. */
|
|
1297
|
+
action?: string;
|
|
1298
|
+
/** The entry's title, when it has one. */
|
|
1299
|
+
title?: string;
|
|
1300
|
+
/** The entry's actor. */
|
|
1301
|
+
actor: string;
|
|
1302
|
+
/** When the entry was recorded. */
|
|
1303
|
+
at: number;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* The one shape data changes take — `GraphStore.applyDelta`'s argument, and a
|
|
1307
|
+
* playbook step's `data`. Applied in this order: `removed` (edges, then nodes,
|
|
1308
|
+
* cascading), `added` (nodes, then edges; an existing id merges), `updated`
|
|
1309
|
+
* (nodes, then edges), then `hidden`, `shown` and `pinned`. Unknown ids are
|
|
1310
|
+
* skipped.
|
|
1311
|
+
*
|
|
1312
|
+
* Generic over the record types so the vocabulary stays domain-free; a graph
|
|
1313
|
+
* source instantiates it with its node / edge records.
|
|
1314
|
+
*/
|
|
1315
|
+
interface Delta<N extends {
|
|
1316
|
+
id: string;
|
|
1317
|
+
} = {
|
|
1318
|
+
id: string;
|
|
1319
|
+
}, E extends {
|
|
1320
|
+
id: string;
|
|
1321
|
+
} = {
|
|
1322
|
+
id: string;
|
|
1323
|
+
}> {
|
|
1324
|
+
added?: {
|
|
1325
|
+
nodes?: readonly N[];
|
|
1326
|
+
edges?: readonly E[];
|
|
1327
|
+
};
|
|
1328
|
+
updated?: {
|
|
1329
|
+
nodes?: ReadonlyArray<{
|
|
1330
|
+
id: string;
|
|
1331
|
+
patch: Partial<N>;
|
|
1332
|
+
}>;
|
|
1333
|
+
edges?: ReadonlyArray<{
|
|
1334
|
+
id: string;
|
|
1335
|
+
patch: Partial<E>;
|
|
1336
|
+
}>;
|
|
1337
|
+
};
|
|
1338
|
+
removed?: {
|
|
1339
|
+
nodeIds?: readonly string[];
|
|
1340
|
+
edgeIds?: readonly string[];
|
|
1341
|
+
};
|
|
1342
|
+
/** Set the explicit hidden flag on these ids. */
|
|
1343
|
+
hidden?: {
|
|
1344
|
+
nodeIds?: readonly string[];
|
|
1345
|
+
edgeIds?: readonly string[];
|
|
1346
|
+
};
|
|
1347
|
+
/** Clear the explicit hidden flag on these ids. */
|
|
1348
|
+
shown?: {
|
|
1349
|
+
nodeIds?: readonly string[];
|
|
1350
|
+
edgeIds?: readonly string[];
|
|
1351
|
+
};
|
|
1352
|
+
/**
|
|
1353
|
+
* Pin (default) or unpin nodes. `x` / `y`, when both are given, also move the
|
|
1354
|
+
* node there — a drag's final position.
|
|
1355
|
+
*/
|
|
1356
|
+
pinned?: ReadonlyArray<{
|
|
1357
|
+
id: string;
|
|
1358
|
+
pinned?: boolean;
|
|
1359
|
+
x?: number;
|
|
1360
|
+
y?: number;
|
|
1361
|
+
}>;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* A record in a playbook step's {@link Delta}: an id plus whatever fields the
|
|
1365
|
+
* source's records carry (`type`, `data`, `source` / `target` …). Open, because
|
|
1366
|
+
* the vocabulary is domain-free; the source checks the shape when it applies.
|
|
1367
|
+
*/
|
|
1368
|
+
type DeltaRecord = {
|
|
1369
|
+
id: string;
|
|
1370
|
+
} & Record<string, unknown>;
|
|
1371
|
+
/** Options for a recorded data write (`applyDelta(delta, opts)`). */
|
|
1372
|
+
interface DeltaOptions {
|
|
1373
|
+
/** Who the history entry is attributed to. Default: the canvas's session actor. */
|
|
1374
|
+
actor?: string;
|
|
1375
|
+
/** The history entry's label (`'paste'`, `'delete selection'`), shown by undo menus and `peekUndo`. */
|
|
1376
|
+
title?: string;
|
|
1377
|
+
/**
|
|
1378
|
+
* Streamed write (a live feed): merge into the actor's **open** streamed
|
|
1379
|
+
* entry instead of making a new one. Within it, an add and a later remove
|
|
1380
|
+
* of the same id cancel. Plain undo steps over streamed entries; any other
|
|
1381
|
+
* entry, a playbook step, an undo / redo or a clear seals the open one, so
|
|
1382
|
+
* the next streamed write starts a new entry (RFC D-14, G12).
|
|
1383
|
+
*
|
|
1384
|
+
* Hosts should hold feed ticks while `!history.atLatest()` — a streamed
|
|
1385
|
+
* entry recorded while undone entries wait to be redone sits before them.
|
|
1386
|
+
*/
|
|
1387
|
+
coalesce?: boolean;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* A data source the log can replay: it applies its own recorded ops forward or
|
|
1391
|
+
* backward. Registered with {@link OperationLog.registerSource}; replay runs
|
|
1392
|
+
* with recording suspended, so the source's writes during it are not recorded
|
|
1393
|
+
* again.
|
|
1394
|
+
*/
|
|
1395
|
+
interface DataOpAdapter {
|
|
1396
|
+
/** Matches {@link DataLogPart.sourceId}. */
|
|
1397
|
+
readonly sourceId: string;
|
|
1398
|
+
/** Re-apply `ops` in order (`'forward'`) or their inverses in reverse (`'back'`). */
|
|
1399
|
+
applyOps(ops: readonly unknown[], direction: 'forward' | 'back'): void;
|
|
1400
|
+
/**
|
|
1401
|
+
* The source's one recorded data door (a graph store's `applyDelta`). A
|
|
1402
|
+
* playbook step's `data` goes through it. Absent ⇒ the source takes no
|
|
1403
|
+
* steps.
|
|
1404
|
+
*/
|
|
1405
|
+
applyDelta?(delta: Delta, opts?: DeltaOptions): void;
|
|
1406
|
+
/** Whether the source holds an element with this id — a step's view ids are checked against it. */
|
|
1407
|
+
hasElement?(id: string): boolean;
|
|
1408
|
+
/**
|
|
1409
|
+
* The **net** change `ops` make, as a {@link Delta}: an add and a later
|
|
1410
|
+
* remove of the same id cancel, updates fold into one patch per id, the last
|
|
1411
|
+
* hide / show wins. `HistoryView.sinceLastStep` builds a step's `data` with
|
|
1412
|
+
* it. Absent ⇒ the source's entries contribute no `data`.
|
|
1413
|
+
*/
|
|
1414
|
+
toDelta?(ops: readonly unknown[]): Delta<DeltaRecord, DeltaRecord>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Compact an op list that will be replayed as one unit — used when streamed
|
|
1417
|
+
* writes merge ({@link DeltaOptions.coalesce}): an element added and removed
|
|
1418
|
+
* within `ops` drops out, with every op on it in between. Must replay
|
|
1419
|
+
* (forward and back) to the same states as `ops`. Absent ⇒ ops are kept
|
|
1420
|
+
* as recorded.
|
|
1421
|
+
*/
|
|
1422
|
+
compact?(ops: readonly unknown[]): unknown[];
|
|
1423
|
+
}
|
|
1424
|
+
/** Where an entry id stands in the log: applied, waiting to be redone, or not (or no longer) in it. */
|
|
1425
|
+
type LogEntryStatus = 'applied' | 'pending' | 'unknown';
|
|
1426
|
+
/** Metadata for {@link OperationLog.group}. */
|
|
1427
|
+
interface LogGroupMeta {
|
|
1428
|
+
title?: string;
|
|
1429
|
+
actor?: string;
|
|
1430
|
+
stepId?: string;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* The one operation log behind `canvas.history`. **Written only by the canvas**
|
|
1434
|
+
* — the view store's change stream and each data source's recorded writes; a
|
|
1435
|
+
* consumer reads it through {@link HistoryView}.
|
|
1436
|
+
*
|
|
1437
|
+
* Undo is linear across actors (D-10): it takes back the newest undoable entry,
|
|
1438
|
+
* whoever made it. Entries with no undoable part (a selection change) are kept
|
|
1439
|
+
* in the record but stepped over. A change after an undo keeps the undone
|
|
1440
|
+
* entries as a side branch rather than discarding them.
|
|
1441
|
+
*/
|
|
1442
|
+
interface OperationLog {
|
|
1443
|
+
/** Register a data source for replay. Returns the unregister. */
|
|
1444
|
+
registerSource(adapter: DataOpAdapter): () => void;
|
|
1445
|
+
/** The registered source with this id, or `undefined`. */
|
|
1446
|
+
source(sourceId: string): DataOpAdapter | undefined;
|
|
1447
|
+
/**
|
|
1448
|
+
* Where `entryId` stands: `'applied'`, `'pending'` (undone, waiting to be
|
|
1449
|
+
* redone) or `'unknown'` (never recorded, or moved to a side branch by a
|
|
1450
|
+
* change after an undo). A playbook asks before replaying a step's entries.
|
|
1451
|
+
*/
|
|
1452
|
+
status(entryId: string): LogEntryStatus;
|
|
1453
|
+
/**
|
|
1454
|
+
* Record already-applied data ops as one part. Outside a {@link group} it is
|
|
1455
|
+
* its own entry; inside, it joins the open one. Dropped while the log is
|
|
1456
|
+
* replaying. With `opts.coalesce` (outside a group) the ops merge into the
|
|
1457
|
+
* actor's open streamed entry — see {@link DeltaOptions.coalesce}.
|
|
1458
|
+
*/
|
|
1459
|
+
recordData(sourceId: string, ops: readonly unknown[], actor?: string, opts?: {
|
|
1460
|
+
coalesce?: boolean;
|
|
1461
|
+
}): void;
|
|
1462
|
+
/**
|
|
1463
|
+
* Mark applied entries as belonging to a playbook step — how
|
|
1464
|
+
* `Playbook.addStep` adopts a `sinceLastStep` result: its entries become the
|
|
1465
|
+
* step's, without being re-run. Ids not in the applied record are ignored.
|
|
1466
|
+
*/
|
|
1467
|
+
tagStep(entryIds: readonly string[], meta: {
|
|
1468
|
+
stepId: string;
|
|
1469
|
+
title?: string;
|
|
1470
|
+
}): void;
|
|
1471
|
+
/**
|
|
1472
|
+
* Run `fn`; everything recorded meanwhile becomes one entry. Nested groups
|
|
1473
|
+
* merge. **All or nothing:** if `fn` throws, what it recorded is reverted,
|
|
1474
|
+
* no entry is kept, and the error is rethrown.
|
|
1475
|
+
*/
|
|
1476
|
+
group<T>(meta: LogGroupMeta, fn: () => T): T;
|
|
1477
|
+
/** Whether the log is applying entries (undo / redo / revertTo / replayTo) right now. */
|
|
1478
|
+
readonly replaying: boolean;
|
|
1479
|
+
undo(): void;
|
|
1480
|
+
redo(): void;
|
|
1481
|
+
canUndo(): boolean;
|
|
1482
|
+
canRedo(): boolean;
|
|
1483
|
+
peekUndo(): LogStepInfo | undefined;
|
|
1484
|
+
peekRedo(): LogStepInfo | undefined;
|
|
1485
|
+
/** Revert every applied entry after `entryId` (`null` = back to the start), every part included. */
|
|
1486
|
+
revertTo(entryId: string | null): void;
|
|
1487
|
+
/** Re-apply recorded entries up to and including `entryId`, every part included. */
|
|
1488
|
+
replayTo(entryId: string): void;
|
|
1489
|
+
/** True when no recorded entry is waiting to be redone. */
|
|
1490
|
+
atLatest(): boolean;
|
|
1491
|
+
/** The applied entries, oldest first, optionally filtered. */
|
|
1492
|
+
entries(filter?: LogEntryFilter): readonly LogEntry[];
|
|
1493
|
+
/** Hear every new entry. Returns the unsubscribe. */
|
|
1494
|
+
onEntry(listener: (entry: LogEntry) => void): () => void;
|
|
1495
|
+
/** Hear every change to the log (record / merge / undo / redo / clear). Returns the unsubscribe. */
|
|
1496
|
+
subscribe(listener: () => void): () => void;
|
|
1497
|
+
/** Drop every entry and branch. Runs when a new canvas state loads. */
|
|
1498
|
+
clear(): void;
|
|
1499
|
+
/** Stop recording and release subscriptions. */
|
|
1500
|
+
dispose(): void;
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* `canvas.history` — the record. Undo / redo as before, plus who-did-what reads.
|
|
1504
|
+
* Nobody writes to it: entries come from the canvas's own writes.
|
|
1505
|
+
*/
|
|
1506
|
+
interface HistoryView {
|
|
1507
|
+
undo(): void;
|
|
1508
|
+
redo(): void;
|
|
1509
|
+
canUndo(): boolean;
|
|
1510
|
+
canRedo(): boolean;
|
|
1511
|
+
/** The entry {@link undo} would revert, or `undefined`. */
|
|
1512
|
+
peekUndo(): LogStepInfo | undefined;
|
|
1513
|
+
/** The entry {@link redo} would re-apply, or `undefined`. */
|
|
1514
|
+
peekRedo(): LogStepInfo | undefined;
|
|
1515
|
+
/** The applied entries, oldest first, optionally filtered by actor / step. */
|
|
1516
|
+
entries(filter?: LogEntryFilter): readonly LogEntry[];
|
|
1517
|
+
/** Hear every new entry (e.g. to send a user's changes back to the engine). */
|
|
1518
|
+
onEntry(listener: (entry: LogEntry) => void): () => void;
|
|
1519
|
+
/** True when no recorded entry is waiting to be redone. */
|
|
1520
|
+
atLatest(): boolean;
|
|
1521
|
+
/**
|
|
1522
|
+
* The work done since the last playbook step, **as a step** (RFC F14, D-13):
|
|
1523
|
+
* every applied entry after the newest one carrying a `stepId` (or from the
|
|
1524
|
+
* start), summarised —
|
|
1525
|
+
*
|
|
1526
|
+
* - `data`: the net delta per source (an add then a remove cancels);
|
|
1527
|
+
* - `settings`: the definition values those entries changed, as a
|
|
1528
|
+
* `canvas.update` patch holding their current values;
|
|
1529
|
+
* - `view`: the current selection / focus / inspect / camera intent, for
|
|
1530
|
+
* the slices those entries changed.
|
|
1531
|
+
*
|
|
1532
|
+
* Pass the returned object to `playbook.addStep` to make the work a step:
|
|
1533
|
+
* it **adopts** the recorded entries rather than playing them again (only
|
|
1534
|
+
* while they are still the newest; otherwise, or for a copy of the object,
|
|
1535
|
+
* it is added as an ordinary step). Returns a step with no fields besides
|
|
1536
|
+
* `id` / `title` when nothing was done. Reading it changes nothing.
|
|
1537
|
+
*
|
|
1538
|
+
* @typeParam S The settings patch shape — `CanvasConfig` on a `Canvas`.
|
|
1539
|
+
*/
|
|
1540
|
+
sinceLastStep<S = Record<string, unknown>>(title: string): StepSpec<S>;
|
|
1541
|
+
/**
|
|
1542
|
+
* What one entry did to the data, **per source**: each data part's ops as
|
|
1543
|
+
* that source's net {@link Delta} (its {@link DataOpAdapter.toDelta}). A
|
|
1544
|
+
* source without `toDelta`, or whose ops net to nothing, is left out; an
|
|
1545
|
+
* entry holding only view parts returns `[]`. For display (a history
|
|
1546
|
+
* panel's "+3 nodes · −1 edge"); reading it changes nothing.
|
|
1547
|
+
*/
|
|
1548
|
+
entryData(entry: LogEntry): ReadonlyArray<{
|
|
1549
|
+
sourceId: string;
|
|
1550
|
+
delta: Delta<DeltaRecord, DeltaRecord>;
|
|
1551
|
+
}>;
|
|
1552
|
+
/** Hear every change (record / undo / redo / clear). Returns the unsubscribe. */
|
|
1553
|
+
subscribe(listener: () => void): () => void;
|
|
1554
|
+
/** Drop every entry. */
|
|
1555
|
+
clear(): void;
|
|
1556
|
+
/** Stop recording and release subscriptions. */
|
|
1557
|
+
dispose(): void;
|
|
1558
|
+
}
|
|
1559
|
+
/** Where a step points the camera: its focus, every visible node, or everything. */
|
|
1560
|
+
type CameraIntent = 'focus' | 'visible' | 'all';
|
|
1561
|
+
/**
|
|
1562
|
+
* One playbook step — what should happen, as plain JSON. Ids and values only;
|
|
1563
|
+
* no functions, no rules. The Invana engine answers prompts in this format.
|
|
1564
|
+
*
|
|
1565
|
+
* @typeParam S The settings patch shape — `CanvasConfig` in `@invana/canvas`.
|
|
1566
|
+
*/
|
|
1567
|
+
interface StepSpec<S = Record<string, unknown>> {
|
|
1568
|
+
id: string;
|
|
1569
|
+
title: string;
|
|
1570
|
+
/** Who the resulting history entry is attributed to. */
|
|
1571
|
+
actor?: string;
|
|
1572
|
+
/** Presenter text. */
|
|
1573
|
+
narration?: string;
|
|
1574
|
+
/** The engine's own data; never read by the canvas. */
|
|
1575
|
+
meta?: unknown;
|
|
1576
|
+
/** Data source id; defaults to the playbook's. */
|
|
1577
|
+
source?: string;
|
|
1578
|
+
/** Exactly `applyDelta`'s argument, with the source's records as plain JSON. */
|
|
1579
|
+
data?: Delta<DeltaRecord, DeltaRecord>;
|
|
1580
|
+
/** Exactly `canvas.update`'s argument. */
|
|
1581
|
+
settings?: S;
|
|
1582
|
+
view?: {
|
|
1583
|
+
/** Selected ids; `[]` clears. */
|
|
1584
|
+
select?: string[];
|
|
1585
|
+
/** Highlighted ids, the rest optionally dimmed; `null` clears. */
|
|
1586
|
+
focus?: {
|
|
1587
|
+
ids: string[];
|
|
1588
|
+
dim?: boolean;
|
|
1589
|
+
} | null;
|
|
1590
|
+
/** The node whose properties are open; `null` closes. */
|
|
1591
|
+
inspect?: string | null;
|
|
1592
|
+
camera?: CameraIntent;
|
|
1593
|
+
};
|
|
1594
|
+
/** Rare verbs that leave no state (export, redraw), run after the rest. */
|
|
1595
|
+
do?: Array<{
|
|
1596
|
+
command: string;
|
|
1597
|
+
args?: Record<string, unknown>;
|
|
1598
|
+
}>;
|
|
1599
|
+
}
|
|
1600
|
+
/** A saved playbook: the script, nothing more. */
|
|
1601
|
+
interface PlaybookSpec<S = Record<string, unknown>> {
|
|
1602
|
+
version: 1;
|
|
1603
|
+
title: string;
|
|
1604
|
+
/** Default data source id for its steps. */
|
|
1605
|
+
source?: string;
|
|
1606
|
+
steps: StepSpec<S>[];
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* `canvas.playbook` — a list of {@link StepSpec}s and a position. `addStep` only
|
|
1610
|
+
* appends; moving to a step plays it (or replays / reverts its recorded entries).
|
|
1611
|
+
*/
|
|
1612
|
+
interface Playbook<S = Record<string, unknown>> {
|
|
1613
|
+
/** The script's title (from {@link load}, else `'Playbook'`). */
|
|
1614
|
+
readonly title: string;
|
|
1615
|
+
readonly steps: readonly StepSpec<S>[];
|
|
1616
|
+
/** The step the canvas is at, or `undefined` before the first. */
|
|
1617
|
+
readonly current: StepSpec<S> | undefined;
|
|
1618
|
+
/** Index of {@link current} in {@link steps}; `-1` before the first. */
|
|
1619
|
+
readonly index: number;
|
|
1620
|
+
/**
|
|
1621
|
+
* Append to the list; the canvas does not change. Returns the step id.
|
|
1622
|
+
* Throws on a duplicate id.
|
|
1623
|
+
*
|
|
1624
|
+
* A step returned by `history.sinceLastStep` is **adopted** instead when its
|
|
1625
|
+
* entries are still the newest and the playbook is at its last step: the
|
|
1626
|
+
* work is already on the canvas, so its entries are tagged with the step's
|
|
1627
|
+
* id, the step counts as played, and the position moves to it — `previous`
|
|
1628
|
+
* reverts that work like any played step.
|
|
1629
|
+
*/
|
|
1630
|
+
addStep(spec: StepSpec<S>): string;
|
|
1631
|
+
/**
|
|
1632
|
+
* Play the next step — or replay it, when it was played and then stepped
|
|
1633
|
+
* back over. Rejects (writing nothing) when the step fails validation.
|
|
1634
|
+
* Resolves once its `do` verbs finished and the canvas settled.
|
|
1635
|
+
*/
|
|
1636
|
+
next(): Promise<void>;
|
|
1637
|
+
/** Revert the current step's recorded entries and move back one. */
|
|
1638
|
+
previous(): Promise<void>;
|
|
1639
|
+
/** Move to `stepId`, playing / reverting every step in between. */
|
|
1640
|
+
goTo(stepId: string): Promise<void>;
|
|
1641
|
+
toJSON(): PlaybookSpec<S>;
|
|
1642
|
+
/** Replace the list; the canvas does not change. */
|
|
1643
|
+
load(doc: PlaybookSpec<S>): Promise<void>;
|
|
1644
|
+
/** Hear every change to the list or the position. Returns the unsubscribe. */
|
|
1645
|
+
subscribe(listener: () => void): () => void;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
989
1648
|
/**
|
|
990
1649
|
* `CanvasView` — the reactive, observable, syncable half of `CanvasStore`: how a
|
|
991
1650
|
* visualisation is **defined**, **viewed**, and its small transient **runtime**
|
|
@@ -1020,6 +1679,11 @@ interface CanvasView {
|
|
|
1020
1679
|
templates: unknown[];
|
|
1021
1680
|
/** Theme **config** (registry + active family + mode + accent). The *resolved* theme is derived. */
|
|
1022
1681
|
theme: Record<string, unknown>;
|
|
1682
|
+
/**
|
|
1683
|
+
* Floating control panels over the canvas, keyed by panel id. Pure JSON —
|
|
1684
|
+
* items name commands / icons / widgets by string (see {@link ControlPanelSpec}).
|
|
1685
|
+
*/
|
|
1686
|
+
controlPanels: Record<string, ControlPanelSpec>;
|
|
1023
1687
|
};
|
|
1024
1688
|
/** "The live view onto it" — mostly ephemeral / per-user (Awareness later). */
|
|
1025
1689
|
interaction: {
|
|
@@ -1058,14 +1722,48 @@ interface CanvasView {
|
|
|
1058
1722
|
ids: ReadonlySet<string>;
|
|
1059
1723
|
dim: boolean;
|
|
1060
1724
|
} | null;
|
|
1725
|
+
/**
|
|
1726
|
+
* The element whose properties are open (a node or edge id), or `null`.
|
|
1727
|
+
* Written by a playbook step, the assistant or a panel; a property-view
|
|
1728
|
+
* behaviour (`ClickViewBehaviour`) follows it and writes it back when the
|
|
1729
|
+
* user opens or closes one. Recorded as view intent — plain undo steps
|
|
1730
|
+
* over it.
|
|
1731
|
+
*/
|
|
1732
|
+
inspect: string | null;
|
|
1733
|
+
/**
|
|
1734
|
+
* The latest request to frame the camera — `'focus'` (the focus set),
|
|
1735
|
+
* `'visible'` (every visible element) or `'all'` (all content, hidden
|
|
1736
|
+
* included) — or `null` before any. An **intent, not pixels** (RFC D-4):
|
|
1737
|
+
* whoever owns that framing performs it once the canvas settles (the
|
|
1738
|
+
* engine frames `'visible'` / `'all'`, `FocusBehaviour` frames `'focus'`).
|
|
1739
|
+
* `seq` increases on every request, so asking for the same intent twice
|
|
1740
|
+
* frames twice. Recorded as view intent — plain undo steps over it.
|
|
1741
|
+
*/
|
|
1742
|
+
cameraIntent: {
|
|
1743
|
+
intent: CameraIntent;
|
|
1744
|
+
seq: number;
|
|
1745
|
+
} | null;
|
|
1061
1746
|
/**
|
|
1062
1747
|
* Nodes transiently locked during a drag/resize gesture — held against the
|
|
1063
1748
|
* layout for the gesture's duration. **Distinct from data `pinned`** (the
|
|
1064
1749
|
* permanent, synced user flag); these are ephemeral and never synced.
|
|
1065
1750
|
*/
|
|
1066
1751
|
transientPins: ReadonlySet<string>;
|
|
1067
|
-
/**
|
|
1752
|
+
/**
|
|
1753
|
+
* Active interaction mode — the modeller "tool" (`'select'`, `'add'`,
|
|
1754
|
+
* `'connect'`, `'delete'`, or any string a host defines). Per-user and
|
|
1755
|
+
* ephemeral like the rest of `interaction`. Behaviours opt into following it
|
|
1756
|
+
* through `BehaviourOptions.modes`; commands switch it (`tool.active`).
|
|
1757
|
+
* Seeded from `definition.canvas.defaultViewMode` when a canvas starts.
|
|
1758
|
+
*/
|
|
1068
1759
|
viewMode: string;
|
|
1760
|
+
/**
|
|
1761
|
+
* Parameters of the active mode, as plain strings keyed by name — e.g.
|
|
1762
|
+
* `{ nodeKind: 'circle' }` for an "add node" tool. A bag rather than typed
|
|
1763
|
+
* fields so the kernel stays domain-free: what a key means is the
|
|
1764
|
+
* business of whoever reads it (the graph's `tool.nodeKind` command).
|
|
1765
|
+
*/
|
|
1766
|
+
viewModeArgs: Readonly<Record<string, string>>;
|
|
1069
1767
|
};
|
|
1070
1768
|
/** Small observable transient status — reactive (UIs react) but **never synced**. */
|
|
1071
1769
|
runtime: {
|
|
@@ -1149,8 +1847,8 @@ type CameraInput = Partial<{
|
|
|
1149
1847
|
* target {@link LayerData}.
|
|
1150
1848
|
*
|
|
1151
1849
|
* Group by concern: `node / edge / group / annotation / positions` (data) and
|
|
1152
|
-
* `layers / behaviours / layouts / camera / selection / hover / templates /
|
|
1153
|
-
* (view).
|
|
1850
|
+
* `layers / behaviours / layouts / camera / selection / hover / viewMode / templates /
|
|
1851
|
+
* theme / controlPanels` (view).
|
|
1154
1852
|
*
|
|
1155
1853
|
* ⚠ **Data actions target the default {@link LayerData} store only.** The
|
|
1156
1854
|
* injected `layer(id)` accessor (see `createCanvasStore`) **throws** for any id
|
|
@@ -1238,11 +1936,30 @@ declare function createActions(view: ReactiveStore<CanvasView>, layer: (id: stri
|
|
|
1238
1936
|
set: (source: string, ids: Iterable<string>) => void;
|
|
1239
1937
|
clear: (source: string) => void;
|
|
1240
1938
|
};
|
|
1939
|
+
viewMode: {
|
|
1940
|
+
/**
|
|
1941
|
+
* Switch the active mode. `args`, when given, **replaces** the mode's
|
|
1942
|
+
* parameters; omit it to keep the current ones (a tool's node kind
|
|
1943
|
+
* survives a trip through Select).
|
|
1944
|
+
*/
|
|
1945
|
+
set: (mode: string, args?: Readonly<Record<string, string>>) => void;
|
|
1946
|
+
/** Shallow-merge `patch` into the mode parameters. */
|
|
1947
|
+
setArgs: (patch: Readonly<Record<string, string>>) => void;
|
|
1948
|
+
};
|
|
1241
1949
|
templates: {
|
|
1242
1950
|
create: (template: unknown) => void;
|
|
1243
1951
|
update: (id: string, patch: Bag) => void;
|
|
1244
1952
|
remove: (id: string) => void;
|
|
1245
1953
|
};
|
|
1954
|
+
controlPanels: {
|
|
1955
|
+
/** Add (or replace) the panel `id`. */
|
|
1956
|
+
add: (id: string, spec: ControlPanelSpec) => void;
|
|
1957
|
+
/** Shallow-merge `patch` into panel `id` (`items` replaces). No-op when absent. */
|
|
1958
|
+
update: (id: string, patch: Partial<ControlPanelSpec>) => void;
|
|
1959
|
+
show: (id: string) => void;
|
|
1960
|
+
hide: (id: string) => void;
|
|
1961
|
+
remove: (id: string) => void;
|
|
1962
|
+
};
|
|
1246
1963
|
theme: {
|
|
1247
1964
|
set: (patch: Bag) => void;
|
|
1248
1965
|
};
|
|
@@ -1264,6 +1981,14 @@ declare function createActions(view: ReactiveStore<CanvasView>, layer: (id: stri
|
|
|
1264
1981
|
set: (ids: Iterable<string>, dim?: boolean) => void;
|
|
1265
1982
|
clear: () => void;
|
|
1266
1983
|
};
|
|
1984
|
+
inspect: {
|
|
1985
|
+
set: (id: string) => void;
|
|
1986
|
+
clear: () => void;
|
|
1987
|
+
};
|
|
1988
|
+
cameraIntent: {
|
|
1989
|
+
/** Ask for a framing; the owner performs it once the canvas settles. */
|
|
1990
|
+
request: (intent: CameraIntent) => void;
|
|
1991
|
+
};
|
|
1267
1992
|
transientPins: {
|
|
1268
1993
|
add: (ids: Iterable<string>) => void;
|
|
1269
1994
|
remove: (ids: Iterable<string>) => void;
|
|
@@ -1619,8 +2344,21 @@ declare class Camera {
|
|
|
1619
2344
|
* maps to the screen centre, keeping the current zoom. The pan-only
|
|
1620
2345
|
* counterpart to {@link fitContent}: use it for "focus" / "go to" actions
|
|
1621
2346
|
* that should locate a target without rescaling the view.
|
|
2347
|
+
*
|
|
2348
|
+
* By default the pan is applied at once. Pass a positive `durationMs` to
|
|
2349
|
+
* glide there instead — the move then runs through {@link animateTo}, so it
|
|
2350
|
+
* follows the same rules: eased, and cancelled by any other camera write.
|
|
2351
|
+
*
|
|
2352
|
+
* @param durationMs Length of the glide. Absent or `<= 0` pans immediately.
|
|
2353
|
+
* @param easing Named curve for the glide; defaults to `'easeOutCubic'`.
|
|
2354
|
+
* @param onDone Called once the camera is on target (immediately when
|
|
2355
|
+
* not gliding; never when a glide is cancelled).
|
|
1622
2356
|
*/
|
|
1623
|
-
centerOn(worldX: number, worldY: number
|
|
2357
|
+
centerOn(worldX: number, worldY: number, { durationMs, easing, onDone }?: {
|
|
2358
|
+
durationMs?: number;
|
|
2359
|
+
easing?: EasingName;
|
|
2360
|
+
onDone?: () => void;
|
|
2361
|
+
}): void;
|
|
1624
2362
|
/** Update on viewport resize. Forwarded so the binding's own math stays correct. */
|
|
1625
2363
|
resize(screenWidth: number, screenHeight: number): void;
|
|
1626
2364
|
/** Screen → world. */
|
|
@@ -1862,8 +2600,9 @@ declare class SpecProjector<TSpec extends BaseShapeSpec | BaseConnectorSpec> {
|
|
|
1862
2600
|
*
|
|
1863
2601
|
* **This is not the end state.** The classification table in
|
|
1864
2602
|
* `docs/renderer-split-design.md` (P4.5) records where each of these is headed:
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
2603
|
+
* decorations and badges become spec state, while the LOD setters stay
|
|
2604
|
+
* per-element commands (G5 was revised: a single global level cannot express
|
|
2605
|
+
* per-element exemptions). Until then the interface describes
|
|
1867
2606
|
* what is really called, rather than what we wish were called — a smaller
|
|
1868
2607
|
* interface that lied would not let the package split at all.
|
|
1869
2608
|
*/
|
|
@@ -1892,6 +2631,73 @@ interface MountedDecoration<TStyle = unknown> {
|
|
|
1892
2631
|
* the thing that can give it meaning.
|
|
1893
2632
|
*/
|
|
1894
2633
|
type CustomElementCtor = abstract new (...args: never[]) => object;
|
|
2634
|
+
/**
|
|
2635
|
+
* A **display-only** adjustment to one shape, layered on top of everything
|
|
2636
|
+
* else that positions or scales it — the logical position (`spec.x/y`, kept
|
|
2637
|
+
* current by `moveShape` / `updateShape`), the LOD/hover visual scale
|
|
2638
|
+
* (`scaleShape`) and any text-LOD visibility. None of those writes clobbers an
|
|
2639
|
+
* override, and the override never reaches the spec, the store or history.
|
|
2640
|
+
*
|
|
2641
|
+
* Built for focus+context distortion (a fisheye lens): nodes inside the lens
|
|
2642
|
+
* are drawn displaced and enlarged while their layout positions stay put.
|
|
2643
|
+
* Connectors, anchors and picking follow the **drawn** shape, so edges stay
|
|
2644
|
+
* glued to it and a click lands on what the user sees.
|
|
2645
|
+
*/
|
|
2646
|
+
interface ShapeDisplayOverride {
|
|
2647
|
+
/** World-space offset added to the drawn origin. Default `0`. */
|
|
2648
|
+
readonly dx?: number;
|
|
2649
|
+
/** World-space offset added to the drawn origin. Default `0`. */
|
|
2650
|
+
readonly dy?: number;
|
|
2651
|
+
/**
|
|
2652
|
+
* Multiplier on the shape's current visual scale, applied about the shape's
|
|
2653
|
+
* visual centre (so top-left-anchored rects and cards grow in place).
|
|
2654
|
+
* Default `1`.
|
|
2655
|
+
*/
|
|
2656
|
+
readonly scale?: number;
|
|
2657
|
+
/**
|
|
2658
|
+
* `true` forces the shape's text (its `'label'` decoration and any internal
|
|
2659
|
+
* text) visible while the override is set, regardless of text-LOD or
|
|
2660
|
+
* label-collision hiding. Clearing the override restores whatever those last
|
|
2661
|
+
* asked for. Omitted / `false` leaves text visibility to them.
|
|
2662
|
+
*/
|
|
2663
|
+
readonly showText?: boolean;
|
|
2664
|
+
}
|
|
2665
|
+
/**
|
|
2666
|
+
* Which labels a {@link LabelSizePolicy} governs: `'shape'` = the `'label'`
|
|
2667
|
+
* decoration of every shape (graph nodes), `'connector'` = the `'label'`
|
|
2668
|
+
* decoration of every connector (graph edges). Badge plates and the text
|
|
2669
|
+
* *inside* a shape (composite `label` parts) are never governed.
|
|
2670
|
+
*/
|
|
2671
|
+
type LabelSizeTarget = 'shape' | 'connector';
|
|
2672
|
+
/**
|
|
2673
|
+
* How big a label is drawn **on screen** as the camera zooms — the input to
|
|
2674
|
+
* {@link IElementRenderer.setLabelSizePolicy}. Sizes are CSS pixels; a label's
|
|
2675
|
+
* authored `fontSize` is its size at camera zoom `1`.
|
|
2676
|
+
*
|
|
2677
|
+
* Every field is optional and an empty policy changes nothing: without
|
|
2678
|
+
* `zoomGrowth` a label keeps whatever size its host gives it today (it grows
|
|
2679
|
+
* with the world, or stays pixel-constant under a node-size LOD); the clamps
|
|
2680
|
+
* then bound that.
|
|
2681
|
+
*
|
|
2682
|
+
* @example
|
|
2683
|
+
* ```ts
|
|
2684
|
+
* // Grow with √zoom, never above 24px on screen.
|
|
2685
|
+
* renderer.setLabelSizePolicy('shape', { zoomGrowth: 0.5, maxFontPx: 24 });
|
|
2686
|
+
* ```
|
|
2687
|
+
*/
|
|
2688
|
+
interface LabelSizePolicy {
|
|
2689
|
+
/**
|
|
2690
|
+
* How on-screen size follows camera zoom: `fontSize × zoom ^ zoomGrowth`.
|
|
2691
|
+
* `1` grows with the world, `0.5` with its square root, `0` keeps each
|
|
2692
|
+
* label's own `fontSize` on screen. Clamped to `[0, 1]`. Omit to keep the
|
|
2693
|
+
* size the host gives the label (see the interface doc).
|
|
2694
|
+
*/
|
|
2695
|
+
readonly zoomGrowth?: number;
|
|
2696
|
+
/** Smallest on-screen font size in CSS px. Omit for no floor. */
|
|
2697
|
+
readonly minFontPx?: number;
|
|
2698
|
+
/** Largest on-screen font size in CSS px. Omit for no cap. */
|
|
2699
|
+
readonly maxFontPx?: number;
|
|
2700
|
+
}
|
|
1895
2701
|
interface IElementRenderer extends SpecProjectionTarget {
|
|
1896
2702
|
/**
|
|
1897
2703
|
* Teach this backend a new element kind. The spec vocabulary stays open —
|
|
@@ -1904,16 +2710,68 @@ interface IElementRenderer extends SpecProjectionTarget {
|
|
|
1904
2710
|
hasConnector(id: string): boolean;
|
|
1905
2711
|
moveShape(id: string, x: number, y: number): void;
|
|
1906
2712
|
scaleShape(id: string, scale: number): void;
|
|
2713
|
+
/**
|
|
2714
|
+
* Set (or, with `null`, clear) a shape's {@link ShapeDisplayOverride}. The
|
|
2715
|
+
* drawn shape, its connectors' anchors and its hit area follow the override;
|
|
2716
|
+
* {@link getShapePosition} keeps answering the **logical** position, because
|
|
2717
|
+
* its callers (drag, resize, collapse) write that position back. Connectors
|
|
2718
|
+
* are **not** re-routed here — the caller re-routes the ones it cares about
|
|
2719
|
+
* with `updateConnector(id, {})`, once per batch. No-op for unknown ids.
|
|
2720
|
+
*/
|
|
2721
|
+
setShapeDisplayOverride(id: string, override: ShapeDisplayOverride | null): void;
|
|
2722
|
+
/**
|
|
2723
|
+
* Clear every display override this renderer holds. Same re-routing caveat
|
|
2724
|
+
* as {@link setShapeDisplayOverride}.
|
|
2725
|
+
*/
|
|
2726
|
+
clearShapeDisplayOverrides(): void;
|
|
1907
2727
|
setConnectorStroke(id: string, stroke: {
|
|
1908
2728
|
color: number;
|
|
1909
2729
|
width: number;
|
|
1910
2730
|
}): void;
|
|
1911
2731
|
scaleConnectorStroke(id: string, scale: number): void;
|
|
1912
2732
|
setRaised(ids: Iterable<string>): void;
|
|
2733
|
+
/**
|
|
2734
|
+
* Text-LOD visibility of a shape's text: its `'label'` decoration **and** any
|
|
2735
|
+
* text the shape draws inside itself (composite `label` parts). This is the
|
|
2736
|
+
* LOD channel only — label collision writes its own channel through
|
|
2737
|
+
* `setDecorationVisible(id, 'label', …)`, and a label is drawn only when both
|
|
2738
|
+
* allow it (a display override's `showText` forces it on).
|
|
2739
|
+
*/
|
|
1913
2740
|
setShapeTextVisible(id: string, visible: boolean): void;
|
|
2741
|
+
/**
|
|
2742
|
+
* Text-LOD visibility of a connector's `'label'` decoration. Same two-channel
|
|
2743
|
+
* rule as {@link setShapeTextVisible}: collision's
|
|
2744
|
+
* `setDecorationVisible(id, 'label', …)` is a separate channel, and the label
|
|
2745
|
+
* is drawn only when both allow it. No-op for unknown ids.
|
|
2746
|
+
*/
|
|
2747
|
+
setConnectorTextVisible(id: string, visible: boolean): void;
|
|
2748
|
+
/**
|
|
2749
|
+
* What the text-LOD channel last asked for this shape or connector (`true`
|
|
2750
|
+
* when a display override's `showText` forces it on); `false` for an unknown
|
|
2751
|
+
* id. Lets label collision ignore labels LOD has hidden, so an invisible
|
|
2752
|
+
* label never blocks a visible one.
|
|
2753
|
+
*/
|
|
2754
|
+
isTextVisible(id: string): boolean;
|
|
1914
2755
|
setShapeIconVisible(id: string, visible: boolean): void;
|
|
1915
2756
|
setShapeImageVisible(id: string, visible: boolean): void;
|
|
1916
2757
|
setLabelsResolution(resolution: number): void;
|
|
2758
|
+
/**
|
|
2759
|
+
* Set (or, with `null`, clear) how this renderer sizes the `'label'`
|
|
2760
|
+
* decorations of every shape or every connector across camera zoom — see
|
|
2761
|
+
* {@link LabelSizePolicy}. The backend re-applies it whenever the camera
|
|
2762
|
+
* scale, a host's visual scale or a label changes; a caller pushes it once
|
|
2763
|
+
* per configuration change, never per frame. Clearing restores each label's
|
|
2764
|
+
* natural size.
|
|
2765
|
+
*
|
|
2766
|
+
* **Cost.** The pixi backend sizes only labels that are drawn (not hidden by a
|
|
2767
|
+
* label LOD) and on screen on a zoom frame, catching off-screen ones up while
|
|
2768
|
+
* the zoom holds still — so a zoomed-in view or a visibility band keeps it
|
|
2769
|
+
* under ~1 ms a frame at 10 000 labels. The known limit is every label on
|
|
2770
|
+
* screen at once with no band (a zoomed-out hairball): each still costs one
|
|
2771
|
+
* transform write per zoom frame, ~3–4 ms at 10 000. Pair a size policy with
|
|
2772
|
+
* a band (`NodeLabelLODBehaviour.minZoom`) on large graphs.
|
|
2773
|
+
*/
|
|
2774
|
+
setLabelSizePolicy(target: LabelSizeTarget, policy: LabelSizePolicy | null): void;
|
|
1917
2775
|
setVisibleSet(ids: ReadonlySet<string> | null): void;
|
|
1918
2776
|
cull(visibleBounds: Rect, padWorld?: number): void;
|
|
1919
2777
|
uncull(): void;
|
|
@@ -2441,6 +3299,14 @@ declare class LayerRegistry {
|
|
|
2441
3299
|
* conflict warnings when two enabled behaviours claim the same gesture
|
|
2442
3300
|
* (e.g. lasso vs. pan both wanting `'shift+drag'`). The framework warns;
|
|
2443
3301
|
* it does not enforce — that's the developer's job.
|
|
3302
|
+
*
|
|
3303
|
+
* **`modes`** ties a behaviour to the canvas's interaction mode
|
|
3304
|
+
* (`view.interaction.viewMode` — the modeller "tool"). An enabled behaviour with
|
|
3305
|
+
* `modes: ['add']` is only *live* while the mode is `'add'`: outside it the base
|
|
3306
|
+
* runs {@link Behaviour.onDisable} (cancelling any gesture) and back inside it
|
|
3307
|
+
* runs {@link Behaviour.onEnable}. `enabled` stays the developer's flag — a mode
|
|
3308
|
+
* switch never changes it, never fires `scene:behaviour:enable`, and never shows
|
|
3309
|
+
* up in {@link Behaviour.getOptions}.
|
|
2444
3310
|
*/
|
|
2445
3311
|
|
|
2446
3312
|
/** What `BehaviourRegistry` sees. */
|
|
@@ -2462,6 +3328,13 @@ interface IBehaviour {
|
|
|
2462
3328
|
* `canvas.update({ behaviours })` path can retune any behaviour uniformly.
|
|
2463
3329
|
*/
|
|
2464
3330
|
setOptions(changes: Record<string, unknown>): void;
|
|
3331
|
+
/**
|
|
3332
|
+
* Replace the interaction modes this behaviour is live in (`undefined` = all).
|
|
3333
|
+
* The engine calls it directly for a `modes` patch, like it routes `enabled`
|
|
3334
|
+
* through the registry, because some behaviours override `setOptions`
|
|
3335
|
+
* without calling `super`.
|
|
3336
|
+
*/
|
|
3337
|
+
setModes?(modes: readonly string[] | undefined): void;
|
|
2465
3338
|
}
|
|
2466
3339
|
interface BehaviourOptions {
|
|
2467
3340
|
id: string;
|
|
@@ -2478,6 +3351,14 @@ interface BehaviourOptions {
|
|
|
2478
3351
|
* `'wheel+ctrl'`, `'rclick'`); registries match strings as-is.
|
|
2479
3352
|
*/
|
|
2480
3353
|
shortcuts?: readonly string[];
|
|
3354
|
+
/**
|
|
3355
|
+
* Interaction modes (`view.interaction.viewMode` values) this behaviour is live
|
|
3356
|
+
* in. Omitted = every mode. An enabled behaviour outside its modes is
|
|
3357
|
+
* suspended — its `onDisable` runs, `enabled` is unchanged — and resumes when
|
|
3358
|
+
* the mode comes back. E.g. `modes: ['connect']` on an edge-drawing behaviour
|
|
3359
|
+
* makes the modeller's Connect tool switch it on and off with no host wiring.
|
|
3360
|
+
*/
|
|
3361
|
+
modes?: readonly string[];
|
|
2481
3362
|
}
|
|
2482
3363
|
declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOptions> implements IBehaviour {
|
|
2483
3364
|
readonly id: string;
|
|
@@ -2498,8 +3379,20 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2498
3379
|
* from the constructor — subclasses don't need to re-declare.
|
|
2499
3380
|
*/
|
|
2500
3381
|
readonly scope: 'layer' | 'canvas';
|
|
3382
|
+
/**
|
|
3383
|
+
* Whether the behaviour is **live**: the developer's flag ({@link enabled})
|
|
3384
|
+
* *and* the current interaction mode being one of {@link BehaviourOptions.modes}.
|
|
3385
|
+
* Subclasses gate their handlers on this (or {@link isEnabled}); only the base
|
|
3386
|
+
* writes it.
|
|
3387
|
+
*/
|
|
2501
3388
|
protected _enabled: boolean;
|
|
2502
3389
|
protected ctx?: CanvasContext;
|
|
3390
|
+
/** The developer's enable flag — what {@link enabled} reports and snapshots capture. */
|
|
3391
|
+
private _wanted;
|
|
3392
|
+
/** `false` while the canvas's mode is outside {@link BehaviourOptions.modes}. */
|
|
3393
|
+
private _inMode;
|
|
3394
|
+
/** Releases the `viewMode` subscription, or `null` when not watching. */
|
|
3395
|
+
private _modeUnsub;
|
|
2503
3396
|
/**
|
|
2504
3397
|
* The construction options, merged in-place by {@link setOptions}. Named
|
|
2505
3398
|
* `_options` (not `options`) so subclasses that expose a bespoke
|
|
@@ -2515,6 +3408,7 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2515
3408
|
*/
|
|
2516
3409
|
private _gestureRelease;
|
|
2517
3410
|
constructor(opts: TOptions);
|
|
3411
|
+
/** The developer's enable flag. A behaviour suspended by its `modes` still reports `true`. */
|
|
2518
3412
|
get enabled(): boolean;
|
|
2519
3413
|
get isRegistered(): boolean;
|
|
2520
3414
|
/** Called by `BehaviourRegistry.register(behaviour)`. Subscribes to inputs. */
|
|
@@ -2523,6 +3417,20 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2523
3417
|
destroy(): void;
|
|
2524
3418
|
enable(): void;
|
|
2525
3419
|
disable(): void;
|
|
3420
|
+
/**
|
|
3421
|
+
* Bring {@link _enabled} in line with `_wanted && _inMode`, running the
|
|
3422
|
+
* matching hook on a change. The single place a behaviour goes live or idle.
|
|
3423
|
+
*/
|
|
3424
|
+
private syncLive;
|
|
3425
|
+
/** Is `mode` one this behaviour is live in? */
|
|
3426
|
+
private matchesMode;
|
|
3427
|
+
/**
|
|
3428
|
+
* Follow `view.interaction.viewMode` while registered and `modes` is set;
|
|
3429
|
+
* otherwise stop following and count as in-mode. Idempotent — `setOptions`
|
|
3430
|
+
* calls it again when `modes` changes.
|
|
3431
|
+
*/
|
|
3432
|
+
private watchMode;
|
|
3433
|
+
private unwatchMode;
|
|
2526
3434
|
/**
|
|
2527
3435
|
* Merge a serialisable options patch and apply it live. Reflects an `enabled`
|
|
2528
3436
|
* change by enabling/disabling, then calls {@link onOptionsChanged} so the
|
|
@@ -2536,6 +3444,32 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2536
3444
|
* to keep `_options` — and thus {@link getOptions} — coherent.
|
|
2537
3445
|
*/
|
|
2538
3446
|
setOptions(changes: Partial<TOptions>): void;
|
|
3447
|
+
/**
|
|
3448
|
+
* Apply an `enabled` option. While this instance is the one mounted under its
|
|
3449
|
+
* id, the toggle goes through the registry so `scene:behaviour:enable` /
|
|
3450
|
+
* `disable` and the gesture-conflict warning fire — calling {@link enable}
|
|
3451
|
+
* directly would leave the registry's own `setEnabled` (the engine's
|
|
3452
|
+
* `canvas.update` path) a silent no-op. Unmounted, or superseded by a newer
|
|
3453
|
+
* instance under the same id, it toggles itself directly.
|
|
3454
|
+
*/
|
|
3455
|
+
private applyEnabled;
|
|
3456
|
+
/**
|
|
3457
|
+
* Replace {@link BehaviourOptions.modes} and re-evaluate liveness against the
|
|
3458
|
+
* current interaction mode. `undefined` = live in every mode.
|
|
3459
|
+
*/
|
|
3460
|
+
setModes(modes: readonly string[] | undefined): void;
|
|
3461
|
+
/**
|
|
3462
|
+
* Merge `changes` into the options {@link getOptions} returns — and nothing
|
|
3463
|
+
* else: no enable / disable, no mode re-wiring, no {@link onOptionsChanged}.
|
|
3464
|
+
*
|
|
3465
|
+
* For subclasses that override {@link setOptions} with their own apply logic
|
|
3466
|
+
* and don't call `super`: call this first so `getOptions()` (a settings
|
|
3467
|
+
* editor's seed, the engine's undo baseline) stays current. Prefer it to
|
|
3468
|
+
* `super.setOptions` there: the engine routes `enabled` / `modes` through
|
|
3469
|
+
* the registry itself, and the base's direct `enable()` would pre-empt the
|
|
3470
|
+
* registry's `scene:behaviour:enable` event.
|
|
3471
|
+
*/
|
|
3472
|
+
protected recordOptions(changes: Partial<TOptions>): void;
|
|
2539
3473
|
/** Snapshot of the current (merged) options — seeds a settings editor. */
|
|
2540
3474
|
getOptions(): Readonly<TOptions>;
|
|
2541
3475
|
/**
|
|
@@ -2564,7 +3498,7 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2564
3498
|
protected onOptionsChanged(_changes: Partial<TOptions>): void;
|
|
2565
3499
|
/**
|
|
2566
3500
|
* Convenience `if (!enabled) return;` for use inside event handlers
|
|
2567
|
-
* (without rebinding `this` cost).
|
|
3501
|
+
* (without rebinding `this` cost). `false` while suspended by `modes`.
|
|
2568
3502
|
*/
|
|
2569
3503
|
protected get isEnabled(): boolean;
|
|
2570
3504
|
/**
|
|
@@ -2609,7 +3543,8 @@ declare abstract class Behaviour<TOptions extends BehaviourOptions = BehaviourOp
|
|
|
2609
3543
|
* Architecture: see `architecture-proposal.md` §2.2.
|
|
2610
3544
|
*
|
|
2611
3545
|
* **Responsibilities**
|
|
2612
|
-
* - `register` / `unregister` (with register / destroy lifecycle
|
|
3546
|
+
* - `register` / `unregister` (with register / destroy lifecycle; fires
|
|
3547
|
+
* `'scene:behaviour:register'` / `'scene:behaviour:unregister'`).
|
|
2613
3548
|
* - `setEnabled(id, enabled)` — toggles + fires `'scene:behaviour:enable'` /
|
|
2614
3549
|
* `'scene:behaviour:disable'`.
|
|
2615
3550
|
* - Typed `get<T>(id)`.
|
|
@@ -2632,13 +3567,22 @@ declare class BehaviourRegistry {
|
|
|
2632
3567
|
* Register a Behaviour. Wires it (`behaviour.register(ctx)` + events) now if
|
|
2633
3568
|
* the Canvas is initialised; otherwise it's stored and wired later by
|
|
2634
3569
|
* `registerAll()` (called by `Canvas.init`). Throws on duplicate id.
|
|
3570
|
+
*
|
|
3571
|
+
* When wiring throws (the behaviour rejects its context — a missing target
|
|
3572
|
+
* layer, a second instance of a one-per-layer kind), the entry is removed
|
|
3573
|
+
* before the error propagates, so a rejected behaviour never shows up in
|
|
3574
|
+
* {@link list} and its id stays free.
|
|
2635
3575
|
*/
|
|
2636
3576
|
register(behaviour: IBehaviour): void;
|
|
2637
3577
|
/** Wire every not-yet-registered behaviour. Called by `Canvas.init` (after layers mount). */
|
|
2638
3578
|
registerAll(): void;
|
|
2639
3579
|
/** `behaviour.register(ctx)` + the registered/enabled events. */
|
|
2640
3580
|
private wire;
|
|
2641
|
-
/**
|
|
3581
|
+
/**
|
|
3582
|
+
* Remove a behaviour. Calls `destroy()`, then fires
|
|
3583
|
+
* `'scene:behaviour:unregister'` (after `'scene:behaviour:disable'` when it
|
|
3584
|
+
* was enabled). No-op if not registered.
|
|
3585
|
+
*/
|
|
2642
3586
|
unregister(id: string): void;
|
|
2643
3587
|
/** Enable / disable a behaviour. Fires the corresponding bus event. */
|
|
2644
3588
|
setEnabled(id: string, enabled: boolean): void;
|
|
@@ -2651,33 +3595,495 @@ declare class BehaviourRegistry {
|
|
|
2651
3595
|
}
|
|
2652
3596
|
|
|
2653
3597
|
/**
|
|
2654
|
-
* `
|
|
2655
|
-
* Layout receives at mount/register time.
|
|
3598
|
+
* `CommandRegistry` — named, serialisable-by-reference actions.
|
|
2656
3599
|
*
|
|
2657
|
-
*
|
|
3600
|
+
* Serialisable UI (control panels today; shortcuts and menus later) can't hold
|
|
3601
|
+
* closures, so it names what it does — `'camera.fit'`, `'view.lock'` — and this
|
|
3602
|
+
* registry resolves the name to behaviour at run time. Names are
|
|
3603
|
+
* `namespace.verb`; the engine registers its built-ins, a domain package or an
|
|
3604
|
+
* app adds its own.
|
|
2658
3605
|
*
|
|
2659
|
-
*
|
|
2660
|
-
* `
|
|
2661
|
-
|
|
2662
|
-
|
|
3606
|
+
* Generic over the context `C` a command runs against (the engine binds it to
|
|
3607
|
+
* its `Canvas`), so the kernel stays free of any engine type.
|
|
3608
|
+
*/
|
|
3609
|
+
/** One option of a pick-one command (see {@link CanvasCommand.options}). */
|
|
3610
|
+
interface CommandOption {
|
|
3611
|
+
/** The value passed back to `run` as `args.value` when picked. */
|
|
3612
|
+
value: string;
|
|
3613
|
+
/** Human label. */
|
|
3614
|
+
label: string;
|
|
3615
|
+
/** Icon name, resolved by the UI kit's icon registry. */
|
|
3616
|
+
icon?: string;
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* The value kinds a {@link CommandArgSpec} can describe. The first five are
|
|
3620
|
+
* plain JSON values; `layer` / `behaviour` / `layout` are the **id** of a
|
|
3621
|
+
* registered instance (an editor offers the live registry as choices); `json`
|
|
3622
|
+
* is any JSON value the editor can only take as text (maps, number lists).
|
|
3623
|
+
*/
|
|
3624
|
+
type CommandArgKind = 'string' | 'number' | 'boolean' | 'enum' | 'strings' | 'layer' | 'behaviour' | 'layout' | 'json';
|
|
3625
|
+
/**
|
|
3626
|
+
* Describes one key of a command's `args` bag — plain data, so the kernel stays
|
|
3627
|
+
* UI-free; the UI kit maps it to a form field. Optional on every command: an
|
|
3628
|
+
* undescribed command (or key) is still editable as raw JSON.
|
|
3629
|
+
*/
|
|
3630
|
+
interface CommandArgSpec {
|
|
3631
|
+
/** The value's kind. */
|
|
3632
|
+
kind: CommandArgKind;
|
|
3633
|
+
/** Field label. Default: the key. */
|
|
3634
|
+
label?: string;
|
|
3635
|
+
/** One-line help shown under the field. */
|
|
3636
|
+
description?: string;
|
|
3637
|
+
/** The value the command uses when the key is absent — shown as a hint, never written. */
|
|
3638
|
+
default?: unknown;
|
|
3639
|
+
/** The allowed values, for `kind: 'enum'`. */
|
|
3640
|
+
options?: readonly CommandOption[];
|
|
3641
|
+
/**
|
|
3642
|
+
* The key a **pick-one** control supplies itself (`value` — see
|
|
3643
|
+
* {@link CanvasCommand.value}). An editor hides it on a `choice` item, where
|
|
3644
|
+
* picking sets it, and shows it on a button / toggle, where it's fixed.
|
|
3645
|
+
*/
|
|
3646
|
+
pick?: boolean;
|
|
3647
|
+
/**
|
|
3648
|
+
* The command can't run without this key (`behaviour.toggle`'s `id`). A
|
|
3649
|
+
* surface that runs commands bare — the palette — leaves such commands out.
|
|
3650
|
+
* Default `false`: an absent key falls back to {@link default} or the
|
|
3651
|
+
* command's own behaviour.
|
|
3652
|
+
*/
|
|
3653
|
+
required?: boolean;
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* A **command map**: command name → the type of its `args` bag. A package
|
|
3657
|
+
* exports its commands' map as a type (`EngineCommandMap` in `@invana/canvas`,
|
|
3658
|
+
* `GraphCommandMap` in `@invana/graph`) and a registry typed with it
|
|
3659
|
+
* (`CommandRegistry<C, M>`) checks the args of those names at compile time —
|
|
3660
|
+
* types only, nothing at runtime. Any other name still takes `unknown` args, so
|
|
3661
|
+
* app-registered commands keep working. Merge maps with `&`.
|
|
3662
|
+
*/
|
|
3663
|
+
type CommandMap = object;
|
|
3664
|
+
/** A command name: one of `M`'s (offered for completion), or any other string. */
|
|
3665
|
+
type CommandName<M extends CommandMap> = (keyof M & string) | (string & {});
|
|
3666
|
+
/**
|
|
3667
|
+
* The `args` type of command `K` in map `M` — `unknown` for a name `M` doesn't
|
|
3668
|
+
* list. An indexed access, not a conditional type, so a registry stays
|
|
3669
|
+
* covariant in its map: a `CommandRegistry<C, Wider>` is a
|
|
3670
|
+
* `CommandRegistry<C, Narrower>` (a subclass can widen `commands`' map).
|
|
3671
|
+
*/
|
|
3672
|
+
type CommandArgsOf<M extends CommandMap, K extends string> = (M & Record<string, unknown>)[K];
|
|
3673
|
+
/**
|
|
3674
|
+
* A named command, run against a context `C`. `args` is whatever the caller's
|
|
3675
|
+
* spec carried (JSON); `A` narrows it for a command whose map entry is known.
|
|
2663
3676
|
*
|
|
2664
|
-
*
|
|
2665
|
-
*
|
|
3677
|
+
* Its `isEnabled` / `isActive` / `value` / `options` may read anything; a bound
|
|
3678
|
+
* control re-reads them on view-store writes and on the registry's
|
|
3679
|
+
* {@link CommandRegistry.subscribe} signal. State outside the store needs an
|
|
3680
|
+
* owner-side {@link CommandRegistry.invalidate} bridge — see there.
|
|
2666
3681
|
*/
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
3682
|
+
interface CanvasCommand<C, A = unknown> {
|
|
3683
|
+
/** Human label — a default tooltip when a spec doesn't give one. */
|
|
3684
|
+
label?: string;
|
|
3685
|
+
/**
|
|
3686
|
+
* Group a command palette / menu lists it under (`'Camera'`, `'Edit'`,
|
|
3687
|
+
* `'Layout'`, …). Data only — the kernel never reads it.
|
|
3688
|
+
*/
|
|
3689
|
+
category?: string;
|
|
3690
|
+
/** Extra search terms a command palette matches besides the label and name. Data only. */
|
|
3691
|
+
keywords?: readonly string[];
|
|
3692
|
+
/**
|
|
3693
|
+
* The keys `args` may carry, described for editors (the Studio's control-panel
|
|
3694
|
+
* editor draws a field per key). In dev builds {@link CommandRegistry.run}
|
|
3695
|
+
* checks a described key's value against its `kind` and warns (never throws)
|
|
3696
|
+
* on a mismatch — see {@link CommandRegistryOptions.validateArgs}. Keys it
|
|
3697
|
+
* doesn't name still pass through unchecked.
|
|
3698
|
+
*/
|
|
3699
|
+
args?: Readonly<Record<string, CommandArgSpec>>;
|
|
3700
|
+
/**
|
|
3701
|
+
* Perform the command. A command whose work finishes later (a layout run)
|
|
3702
|
+
* returns its promise, so {@link CommandRegistry.runAsync} can wait for it;
|
|
3703
|
+
* {@link CommandRegistry.run} ignores it.
|
|
3704
|
+
*/
|
|
3705
|
+
run(ctx: C, args?: A): void | Promise<void>;
|
|
3706
|
+
/** Toggle state for toggle-style controls. Absent ⇒ never active. */
|
|
3707
|
+
isActive?(ctx: C, args?: A): boolean;
|
|
3708
|
+
/** Whether the command can run now. Absent ⇒ always enabled. */
|
|
3709
|
+
isEnabled?(ctx: C, args?: A): boolean;
|
|
3710
|
+
/**
|
|
3711
|
+
* Current value, for a **pick-one** command (select mode, edge type, active
|
|
3712
|
+
* layout). Picking an option runs the command with `{ ...args, value }`.
|
|
3713
|
+
* `null` when nothing is picked.
|
|
3714
|
+
*/
|
|
3715
|
+
value?(ctx: C, args?: A): string | null;
|
|
3716
|
+
/** The options a pick-one command offers. A spec's own `options` take precedence. */
|
|
3717
|
+
options?(ctx: C, args?: A): CommandOption[];
|
|
3718
|
+
}
|
|
3719
|
+
/** Options for {@link CommandRegistry}. */
|
|
3720
|
+
interface CommandRegistryOptions<C> {
|
|
3721
|
+
/** The context every command runs against (resolved lazily, per call). */
|
|
3722
|
+
getContext: () => C;
|
|
2671
3723
|
/**
|
|
2672
|
-
*
|
|
2673
|
-
*
|
|
2674
|
-
*
|
|
3724
|
+
* Check `args` against each command's {@link CanvasCommand.args} descriptors
|
|
3725
|
+
* in {@link CommandRegistry.run}, warning once per (command, key, problem) on
|
|
3726
|
+
* a mismatch. Never throws, never blocks the run. Default: on in dev builds
|
|
3727
|
+
* (`process.env.NODE_ENV !== 'production'`), off in production bundles.
|
|
2675
3728
|
*/
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
3729
|
+
validateArgs?: boolean;
|
|
3730
|
+
}
|
|
3731
|
+
/**
|
|
3732
|
+
* Holds {@link CanvasCommand}s by name and runs them against a bound context.
|
|
3733
|
+
*
|
|
3734
|
+
* `M` ({@link CommandMap}) types the args of the names it lists — `register`
|
|
3735
|
+
* (the handler's `args`), `run`, `isEnabled`, `isActive`, `value`, `options` —
|
|
3736
|
+
* while every other name takes `unknown` args. Unset, nothing is typed, and a
|
|
3737
|
+
* typed registry still passes where a `CommandRegistry<C>` is expected. Types
|
|
3738
|
+
* only: the registry behaves the same for any `M`.
|
|
3739
|
+
*
|
|
3740
|
+
* Registrations **stack** per name: registering a name that already exists
|
|
3741
|
+
* overrides it (a provider upgrading `graph.clear` to its undoable form, an app
|
|
3742
|
+
* replacing a built-in), and disposing an override restores whatever is
|
|
3743
|
+
* underneath — in any disposal order. {@link subscribe} listeners hear every
|
|
3744
|
+
* register / unregister and every {@link invalidate}, so a UI can re-read
|
|
3745
|
+
* command state.
|
|
3746
|
+
*/
|
|
3747
|
+
declare class CommandRegistry<C, M extends CommandMap = Record<never, never>> {
|
|
3748
|
+
/** Per name, the registrations oldest → newest; the last one is live. */
|
|
3749
|
+
private readonly stacks;
|
|
3750
|
+
private readonly listeners;
|
|
3751
|
+
/** Bumped on every {@link subscribe} signal — see {@link version}. */
|
|
3752
|
+
private _version;
|
|
3753
|
+
private readonly getContext;
|
|
3754
|
+
private readonly validateArgs;
|
|
3755
|
+
/** `command|key|problem` already warned about, so a bound button doesn't flood the console. */
|
|
3756
|
+
private readonly warned;
|
|
3757
|
+
constructor(opts: CommandRegistryOptions<C>);
|
|
3758
|
+
/**
|
|
3759
|
+
* Register `name`, overriding any existing registration. Returns a disposer
|
|
3760
|
+
* that removes **this** registration only: if it is live, the one underneath
|
|
3761
|
+
* becomes live again; if it was already overridden, the override stays.
|
|
3762
|
+
*/
|
|
3763
|
+
register<K extends CommandName<M>>(name: K, command: CanvasCommand<C, CommandArgsOf<M, K>>): () => void;
|
|
3764
|
+
/** Remove every registration of `name`. No-op when absent. */
|
|
3765
|
+
unregister(name: string): void;
|
|
3766
|
+
has(name: string): boolean;
|
|
3767
|
+
/** The live (most recent) registration of `name`. */
|
|
3768
|
+
get(name: string): CanvasCommand<C> | undefined;
|
|
3769
|
+
/** Registered command names, in first-registration order. */
|
|
3770
|
+
list(): string[];
|
|
3771
|
+
/**
|
|
3772
|
+
* Run `name` with `args`. Returns `false` (and does nothing) when the command
|
|
3773
|
+
* is missing or disabled. With `validateArgs` on, first warns about any
|
|
3774
|
+
* described key whose value doesn't fit its descriptor — the run proceeds
|
|
3775
|
+
* regardless.
|
|
3776
|
+
*/
|
|
3777
|
+
run<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): boolean;
|
|
3778
|
+
/**
|
|
3779
|
+
* {@link run}, awaiting the command's work: resolves once the promise a
|
|
3780
|
+
* command's `run` returned settles (`layout.run` resolves when the layout
|
|
3781
|
+
* run ends). Resolves `false` — without running anything — when the command
|
|
3782
|
+
* is missing or disabled; a synchronous command resolves `true` at once. A
|
|
3783
|
+
* playbook step's `do` verbs go through here, so each finishes before the
|
|
3784
|
+
* next starts.
|
|
3785
|
+
*/
|
|
3786
|
+
runAsync<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): Promise<boolean>;
|
|
3787
|
+
/** `isActive` of `name`; `false` when missing or not a toggle. */
|
|
3788
|
+
isActive<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): boolean;
|
|
3789
|
+
/** `isEnabled` of `name`; `false` when missing, `true` when it declares no check. */
|
|
3790
|
+
isEnabled<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): boolean;
|
|
3791
|
+
/** `value` of a pick-one command; `null` when missing or not a picker. */
|
|
3792
|
+
value<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): string | null;
|
|
3793
|
+
/** `options` of a pick-one command; `[]` when missing or it declares none. */
|
|
3794
|
+
options<K extends CommandName<M>>(name: K, args?: CommandArgsOf<M, K>): CommandOption[];
|
|
3795
|
+
/**
|
|
3796
|
+
* Tell subscribers that command state changed **outside** the view store (a
|
|
3797
|
+
* history stack, a clipboard buffer, a layer's edge defaults, a registry), so
|
|
3798
|
+
* a bound control re-reads `isEnabled` / `isActive` / `value` / `options`.
|
|
3799
|
+
*
|
|
3800
|
+
* Call it from the state's **owner** — a bridge from the owner's own change
|
|
3801
|
+
* signal, set up once (the engine bridges the registries, layer visibility and
|
|
3802
|
+
* `canvas.history`; `GraphCanvas` its layers' edge templates; a provider its
|
|
3803
|
+
* own history / clipboard) — never from the write sites, where another
|
|
3804
|
+
* writer would forget it. A command whose state lives in the view store
|
|
3805
|
+
* needs none.
|
|
3806
|
+
*/
|
|
3807
|
+
invalidate(): void;
|
|
2679
3808
|
/**
|
|
2680
|
-
*
|
|
3809
|
+
* A counter bumped on every {@link subscribe} signal (register, unregister,
|
|
3810
|
+
* dispose, {@link invalidate}, {@link clear}) — and only then. Use it as a
|
|
3811
|
+
* `useSyncExternalStore` snapshot when a UI must re-read *everything* on a
|
|
3812
|
+
* signal: a snapshot derived from `list()` stays equal when only a command's
|
|
3813
|
+
* `options` / state changed, and React would skip the re-render.
|
|
3814
|
+
*/
|
|
3815
|
+
get version(): number;
|
|
3816
|
+
/** Hear every register / unregister / {@link invalidate}. Returns an unsubscribe. */
|
|
3817
|
+
subscribe(listener: () => void): () => void;
|
|
3818
|
+
/** Drop every command and listener. */
|
|
3819
|
+
clear(): void;
|
|
3820
|
+
/** Warn (once each) about `args` values that don't fit `specs`. */
|
|
3821
|
+
private checkArgs;
|
|
3822
|
+
private warn;
|
|
3823
|
+
private notify;
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* `Layout` — function from data to positions.
|
|
3828
|
+
*
|
|
3829
|
+
* Architecture: see `architecture-proposal.md` §2.3.
|
|
3830
|
+
*
|
|
3831
|
+
* Per the proposal:
|
|
3832
|
+
* - A Layout does NOT register with the canvas.
|
|
3833
|
+
* - It does NOT render.
|
|
3834
|
+
* - It does NOT subscribe to input.
|
|
3835
|
+
* - You instantiate it and call it against a layer.
|
|
3836
|
+
*
|
|
3837
|
+
* const layout = new D3ForceLayout({ charge: -300 });
|
|
3838
|
+
* layout.events.on('end', () => canvas.camera.fitContent(...));
|
|
3839
|
+
* await layout.apply(graphLayer);
|
|
3840
|
+
*
|
|
3841
|
+
* Continuous-running cases (e.g. always-relax force simulation) are handled
|
|
3842
|
+
* by a thin wrapper Behaviour that calls `apply()` on a tick — keeps the
|
|
3843
|
+
* Layout API clean while supporting the rare continuous case.
|
|
3844
|
+
*
|
|
3845
|
+
* Whether two layouts conflict is a domain concern (don't apply two layouts
|
|
3846
|
+
* to the same data) — not enforced here.
|
|
3847
|
+
*
|
|
3848
|
+
* ## Lifecycle events
|
|
3849
|
+
*
|
|
3850
|
+
* Every layout owns a typed `events` emitter and fires three lifecycle
|
|
3851
|
+
* events around `apply()`:
|
|
3852
|
+
*
|
|
3853
|
+
* - `start` — emitted once, synchronously, after the layout has set up
|
|
3854
|
+
* its internal state and just before it begins producing positions.
|
|
3855
|
+
* - `tick` — emitted whenever the layout writes a fresh batch of positions.
|
|
3856
|
+
* One-shot layouts (e.g. ELK) fire it once. Iterative layouts (force
|
|
3857
|
+
* sims) fire it on every iteration. High-frequency; subscribe sparingly.
|
|
3858
|
+
* - `end` — emitted once when the run terminates. `reason` distinguishes
|
|
3859
|
+
* a natural settle from an external `stop()` call.
|
|
3860
|
+
*
|
|
3861
|
+
* Subscribe to these events to drive camera fits, progress UI, etc. —
|
|
3862
|
+
* instead of listening to per-tick `data:changed` on the layer, which
|
|
3863
|
+
* conflates "structure changed" with "positions updated".
|
|
3864
|
+
*/
|
|
3865
|
+
|
|
3866
|
+
/**
|
|
3867
|
+
* Why the run ended.
|
|
3868
|
+
*
|
|
3869
|
+
* - `completed` — the layout settled / finished on its own.
|
|
3870
|
+
* - `stopped` — `stop()` (or a second `apply()`) cancelled it.
|
|
3871
|
+
*/
|
|
3872
|
+
type LayoutEndReason = 'completed' | 'stopped';
|
|
3873
|
+
/**
|
|
3874
|
+
* Lifecycle events fired by every `Layout`.
|
|
3875
|
+
*
|
|
3876
|
+
* Subclass-specific telemetry (e.g. d3-force's `alpha`) belongs on a
|
|
3877
|
+
* subclass-specific event map, not here.
|
|
3878
|
+
*/
|
|
3879
|
+
type LayoutEvents = {
|
|
3880
|
+
/**
|
|
3881
|
+
* Run is about to produce positions. Optional run-size / animation metadata
|
|
3882
|
+
* lets a `Canvas.runLayout` bridge forward it onto the canvas bus as
|
|
3883
|
+
* `layout:run:start` without reaching into layer internals. Every field is
|
|
3884
|
+
* optional — a layout that doesn't know (or care) emits `{}`, and the bridge
|
|
3885
|
+
* substitutes `0` / `false`.
|
|
3886
|
+
*
|
|
3887
|
+
* - `nodeCount` / `edgeCount` — size of the run, for progress UIs / telemetry.
|
|
3888
|
+
* - `animate` — whether the run animates its settle (iterative force sims)
|
|
3889
|
+
* vs. jumps straight to final positions; render policies branch on it.
|
|
3890
|
+
*/
|
|
3891
|
+
start: {
|
|
3892
|
+
nodeCount?: number;
|
|
3893
|
+
edgeCount?: number;
|
|
3894
|
+
animate?: boolean;
|
|
3895
|
+
};
|
|
3896
|
+
tick: Record<string, never>;
|
|
3897
|
+
/**
|
|
3898
|
+
* A position **transition** advanced one frame — a one-shot layout gliding
|
|
3899
|
+
* nodes from where they were to where the run put them. `progress` is the
|
|
3900
|
+
* **eased** fraction of the glide, `0..1`, and reaches exactly `1` on the
|
|
3901
|
+
* last frame (before `end`). A run that snaps emits none.
|
|
3902
|
+
*
|
|
3903
|
+
* Separate from `tick` on purpose: `tick` means "the layout placed nodes",
|
|
3904
|
+
* and fitters react to it as such; this is per-frame motion, which a
|
|
3905
|
+
* {@link LayoutRunOptions.fitCamera} run follows with the camera.
|
|
3906
|
+
*/
|
|
3907
|
+
transition: {
|
|
3908
|
+
progress: number;
|
|
3909
|
+
};
|
|
3910
|
+
/**
|
|
3911
|
+
* An off-screen solve advanced: `done` of `total` iterations are finished.
|
|
3912
|
+
* Emitted by iterative layouts that settle before drawing (d3-force with
|
|
3913
|
+
* `animate: false`), so a UI can say why the canvas is still empty.
|
|
3914
|
+
*
|
|
3915
|
+
* Separate from `tick` on purpose: `tick` means "positions were written",
|
|
3916
|
+
* and the graph layer reveals nodes on it — progress writes nothing.
|
|
3917
|
+
*/
|
|
3918
|
+
progress: {
|
|
3919
|
+
done: number;
|
|
3920
|
+
total: number;
|
|
3921
|
+
};
|
|
3922
|
+
end: {
|
|
3923
|
+
reason: LayoutEndReason;
|
|
3924
|
+
};
|
|
3925
|
+
};
|
|
3926
|
+
/**
|
|
3927
|
+
* How one layout run should behave — passed per call to {@link Layout.apply}
|
|
3928
|
+
* (and `Canvas.runLayout`), as opposed to {@link LayoutOptions}, which are the
|
|
3929
|
+
* layout's standing configuration.
|
|
3930
|
+
*
|
|
3931
|
+
* Both fields describe a **re-flow** the user did not ask for directly — e.g.
|
|
3932
|
+
* `CollapseExpandBehaviour` re-running the active layout after a group frame
|
|
3933
|
+
* opens or closes — where the point is to keep the picture steady.
|
|
3934
|
+
*/
|
|
3935
|
+
interface LayoutRunOptions {
|
|
3936
|
+
/**
|
|
3937
|
+
* Keep this node where it is on screen. The run computes positions as usual,
|
|
3938
|
+
* then shifts the whole result so this node's box centre stays where it was;
|
|
3939
|
+
* everything else re-flows around it. Honoured by layouts that support it
|
|
3940
|
+
* (the one-shot layouts and `D3ForceLayout`); ignored by the rest.
|
|
3941
|
+
*/
|
|
3942
|
+
anchorNodeId?: string;
|
|
3943
|
+
/**
|
|
3944
|
+
* Leave the camera alone for this run. Fitters that normally re-frame the
|
|
3945
|
+
* view when a layout ends (the `fitOnLoad` auto-fitter, the React layout
|
|
3946
|
+
* wrappers' `fitPadding`) skip a run carrying this flag.
|
|
3947
|
+
*/
|
|
3948
|
+
preserveCamera?: boolean;
|
|
3949
|
+
/**
|
|
3950
|
+
* Frame the result, moving the camera **together with** the nodes. While
|
|
3951
|
+
* the run's position transition plays, `Canvas.runLayout` blends the camera
|
|
3952
|
+
* from where it started toward a fit of the content as it is on that frame
|
|
3953
|
+
* (by the transition's eased progress), so the picture stays framed the
|
|
3954
|
+
* whole way and ends exactly fitted — no glide under a stale camera
|
|
3955
|
+
* followed by a snap. A run that snaps (or a layout that reports no
|
|
3956
|
+
* `transition`) gets one fit when it ends. A user pan / zoom mid-run takes
|
|
3957
|
+
* the camera and stops the follow.
|
|
3958
|
+
*
|
|
3959
|
+
* `true` fits with the default padding (80 screen px); `{ padding }` sets
|
|
3960
|
+
* it. Fitters that would otherwise frame on `end` (the `fitOnLoad`
|
|
3961
|
+
* auto-fitter, the React layout wrappers' `fitPadding`) skip such a run —
|
|
3962
|
+
* it already owns the camera. Ignored when {@link preserveCamera} is set.
|
|
3963
|
+
*/
|
|
3964
|
+
fitCamera?: boolean | {
|
|
3965
|
+
padding?: number;
|
|
3966
|
+
};
|
|
3967
|
+
}
|
|
3968
|
+
/**
|
|
3969
|
+
* How an **active** layout re-runs when its target layer's data changes
|
|
3970
|
+
* (nodes added / removed / hidden / shown). Read by the facade that wires the
|
|
3971
|
+
* active layout (`GraphCanvas`) each time it re-runs, so assigning
|
|
3972
|
+
* {@link Layout.onData} takes effect on the next change.
|
|
3973
|
+
*/
|
|
3974
|
+
interface LayoutDataRunOptions {
|
|
3975
|
+
/**
|
|
3976
|
+
* At most one data-triggered run per this many ms: the first change runs at
|
|
3977
|
+
* once, later ones inside the window collapse into one run at its end — so
|
|
3978
|
+
* a feed writing every tick doesn't restart the layout every tick. Default
|
|
3979
|
+
* `0` (every change runs).
|
|
3980
|
+
*/
|
|
3981
|
+
throttleMs?: number;
|
|
3982
|
+
/**
|
|
3983
|
+
* Leave the camera alone on data-triggered runs
|
|
3984
|
+
* ({@link LayoutRunOptions.preserveCamera}) — the view doesn't re-frame each
|
|
3985
|
+
* time the data changes. Default `false`.
|
|
3986
|
+
*/
|
|
3987
|
+
preserveCamera?: boolean;
|
|
3988
|
+
}
|
|
3989
|
+
/** Construction options every layout shares (for the `LayoutRegistry`). */
|
|
3990
|
+
interface LayoutOptions {
|
|
3991
|
+
/** Stable id, used to address the layout in a `LayoutRegistry` / config. Default `'layout'`. */
|
|
3992
|
+
id?: string;
|
|
3993
|
+
/** The layer this layout is meant to run against. Informational — `apply(layer)` still takes one explicitly. */
|
|
3994
|
+
targetLayerId?: string;
|
|
3995
|
+
/** How data-triggered re-runs behave while this layout is active. See {@link LayoutDataRunOptions}. */
|
|
3996
|
+
onData?: LayoutDataRunOptions;
|
|
3997
|
+
}
|
|
3998
|
+
declare abstract class Layout<TLayer extends Layer<any, any, any, any> = Layer<any, any, any, any>> {
|
|
3999
|
+
/** Stable id (registry / config key). */
|
|
4000
|
+
readonly id: string;
|
|
4001
|
+
/** The layer this layout targets, if declared at construction. */
|
|
4002
|
+
readonly targetLayerId?: string;
|
|
4003
|
+
/**
|
|
4004
|
+
* Stable **class kind** — a minification-safe discriminator matching the
|
|
4005
|
+
* `@invana/canvas-ui` settings-editor registry key (e.g. `'d3-force-layout'`,
|
|
4006
|
+
* `'elk-layout'`). Distinct from {@link id} (the per-instance key): all
|
|
4007
|
+
* `D3ForceLayout` instances share `kind: 'd3-force-layout'`. Concrete layouts
|
|
4008
|
+
* set it as a class field; left `undefined` on any that haven't, so consumers
|
|
4009
|
+
* fall back (e.g. to the class name). Lets domain-free tooling resolve an
|
|
4010
|
+
* instance's editor without an `instanceof` ladder.
|
|
4011
|
+
*/
|
|
4012
|
+
readonly kind?: string;
|
|
4013
|
+
/**
|
|
4014
|
+
* Lifecycle event bus. See class docs for the event vocabulary.
|
|
4015
|
+
* Subclasses with richer telemetry can declare their own typed
|
|
4016
|
+
* emitter on top (`override readonly events = new EventEmitter<MyEvents>()`).
|
|
4017
|
+
*/
|
|
4018
|
+
readonly events: EventEmitter<LayoutEvents>;
|
|
4019
|
+
/**
|
|
4020
|
+
* Options of the run in flight, or of the last one once it has ended.
|
|
4021
|
+
* Implementations record them at the top of {@link apply}, so an `end`
|
|
4022
|
+
* listener can tell what kind of run just finished — e.g. a fitter skipping
|
|
4023
|
+
* a {@link LayoutRunOptions.preserveCamera} run.
|
|
4024
|
+
*/
|
|
4025
|
+
runOptions: Readonly<LayoutRunOptions>;
|
|
4026
|
+
/**
|
|
4027
|
+
* How data-triggered re-runs behave while this layout is active (throttle,
|
|
4028
|
+
* keep the camera). Mutable: the wiring reads it on every data change.
|
|
4029
|
+
*/
|
|
4030
|
+
onData: LayoutDataRunOptions;
|
|
4031
|
+
constructor(opts?: LayoutOptions);
|
|
4032
|
+
/**
|
|
4033
|
+
* Live-reconfigure. Called by `Canvas.update({ layouts: { id: patch } })`.
|
|
4034
|
+
* Default no-op; iterative layouts (e.g. `D3ForceLayout`) override to merge
|
|
4035
|
+
* the patch and re-heat a running simulation.
|
|
4036
|
+
*/
|
|
4037
|
+
setOptions(_patch: unknown): void;
|
|
4038
|
+
/**
|
|
4039
|
+
* Contribute this layout's serialisable config to a canvas-state snapshot (the
|
|
4040
|
+
* engine's `DefinitionSerializable` contract). The base captures the wiring
|
|
4041
|
+
* `targetLayerId`; iterative layouts holding tunable params (e.g. force
|
|
4042
|
+
* strengths) should override and spread `super.serializeDefinition()` with a
|
|
4043
|
+
* JSON-safe copy of those params.
|
|
4044
|
+
*/
|
|
4045
|
+
serializeDefinition(): Record<string, unknown> | undefined;
|
|
4046
|
+
/**
|
|
4047
|
+
* Run the layout against `layer`. Resolves when the run terminates
|
|
4048
|
+
* (either a natural settle or an external `stop()`).
|
|
4049
|
+
*
|
|
4050
|
+
* Calling `apply()` again on the same instance must cancel any in-flight
|
|
4051
|
+
* run first, and must record `run` on {@link runOptions} before emitting
|
|
4052
|
+
* `start`.
|
|
4053
|
+
*
|
|
4054
|
+
* @param run How this particular run should behave; see {@link LayoutRunOptions}.
|
|
4055
|
+
*/
|
|
4056
|
+
abstract apply(layer: TLayer, run?: LayoutRunOptions): Promise<void>;
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
/**
|
|
4060
|
+
* `CanvasContext` — the shared service surface every Layer / Behaviour /
|
|
4061
|
+
* Layout receives at mount/register time.
|
|
4062
|
+
*
|
|
4063
|
+
* Architecture: see `architecture-proposal.md` §2.4.
|
|
4064
|
+
*
|
|
4065
|
+
* **One context, three audiences.** Per the proposal, there is no separate
|
|
4066
|
+
* `LayerContext` / `BehaviourContext` / `LayoutContext` — the same shape is
|
|
4067
|
+
* handed to every participant so cross-cutting access (read peer layers,
|
|
4068
|
+
* fire camera moves, tap telemetry) doesn't need three parallel context types.
|
|
4069
|
+
*
|
|
4070
|
+
* The `Canvas` builds a concrete object that satisfies this interface and
|
|
4071
|
+
* passes it down. Tests can construct a stub by satisfying these fields.
|
|
4072
|
+
*/
|
|
4073
|
+
|
|
4074
|
+
interface CanvasContext {
|
|
4075
|
+
/** Layer registry — `add / remove / get<T>(id) / list / byZOrder`. */
|
|
4076
|
+
readonly layers: LayerRegistry;
|
|
4077
|
+
/**
|
|
4078
|
+
* Behaviour registry — `register / setEnabled / get<T>(id) / list`.
|
|
4079
|
+
* Behaviours never auto-enable; the developer registers + enables explicitly
|
|
4080
|
+
* (`architecture-proposal.md` §2.2).
|
|
4081
|
+
*/
|
|
4082
|
+
readonly behaviours: BehaviourRegistry;
|
|
4083
|
+
/** Camera — pan/zoom/projection. Wraps a `pixi-viewport` `Viewport`. */
|
|
4084
|
+
readonly camera: Camera;
|
|
4085
|
+
/**
|
|
4086
|
+
* Pointer-gesture arbitration — at most one owner at a time. A behaviour that
|
|
2681
4087
|
* needs the pointer to itself (drag, lasso, brush, resize, edge draw) claims
|
|
2682
4088
|
* it here rather than suspending the camera's pan plugin behind its back;
|
|
2683
4089
|
* `DragPanBehaviour` yields whenever `gestures.owner` names somebody else.
|
|
@@ -2713,6 +4119,19 @@ interface CanvasContext {
|
|
|
2713
4119
|
* read this to find a parent element and to attach native DOM listeners.
|
|
2714
4120
|
*/
|
|
2715
4121
|
readonly canvasElement?: HTMLCanvasElement;
|
|
4122
|
+
/**
|
|
4123
|
+
* The canvas's named commands (`canvas.commands`) — for an extension that
|
|
4124
|
+
* dispatches by name, such as a keyboard-shortcut behaviour. Optional so a
|
|
4125
|
+
* hand-built context (a test double) needn't supply one.
|
|
4126
|
+
*/
|
|
4127
|
+
readonly commands?: CommandRegistry<unknown>;
|
|
4128
|
+
/**
|
|
4129
|
+
* The canvas's operation log — the record behind `canvas.history`. A data
|
|
4130
|
+
* layer attaches its store here on mount (`GraphStore.attachLog`) so the
|
|
4131
|
+
* store's recorded writes and the view's edits land in one undo order.
|
|
4132
|
+
* Optional so a hand-built context (a test double) needn't supply one.
|
|
4133
|
+
*/
|
|
4134
|
+
readonly log?: OperationLog;
|
|
2716
4135
|
/**
|
|
2717
4136
|
* Build a patch-emitting {@link ReactiveStore} — the factory behind
|
|
2718
4137
|
* `Layer.state`. Injected by the engine (which implements it with the
|
|
@@ -2746,6 +4165,31 @@ interface CanvasContext {
|
|
|
2746
4165
|
showMessage(text: string, timeout?: number): void;
|
|
2747
4166
|
/** Clear the current canvas message. */
|
|
2748
4167
|
clearMessage(): void;
|
|
4168
|
+
/**
|
|
4169
|
+
* Re-run the canvas's **active** layout (`definition.activeLayout`) — the
|
|
4170
|
+
* same call as `Canvas.runLayout(activeLayout, run)`. Lets a behaviour ask
|
|
4171
|
+
* for a re-flow without knowing which layout is showing (e.g.
|
|
4172
|
+
* `CollapseExpandBehaviour` after a group frame opens or closes). Resolves
|
|
4173
|
+
* once the run settles; resolves immediately when no layout is active.
|
|
4174
|
+
*
|
|
4175
|
+
* Optional so hand-built contexts (tests, the headless double) need not
|
|
4176
|
+
* provide it — callers use `ctx.runActiveLayout?.(…)`.
|
|
4177
|
+
*/
|
|
4178
|
+
runActiveLayout?(run?: LayoutRunOptions): Promise<void>;
|
|
4179
|
+
/**
|
|
4180
|
+
* Resolve on the first frame on which the canvas is **settled**: no layout
|
|
4181
|
+
* run in flight (its position transition included) and no camera glide.
|
|
4182
|
+
* Waits at least one frame, so writes made just before the call have
|
|
4183
|
+
* flushed. Resolves anyway after `timeoutMs` (default 15 000) so a
|
|
4184
|
+
* never-ending simulation can't hold a caller forever.
|
|
4185
|
+
*
|
|
4186
|
+
* What a playbook step and `FocusBehaviour`'s framing wait on. Not on the
|
|
4187
|
+
* public `Canvas` surface. Optional so hand-built contexts need not provide
|
|
4188
|
+
* it — callers use `ctx.whenSettled?.()`.
|
|
4189
|
+
*/
|
|
4190
|
+
whenSettled?(opts?: {
|
|
4191
|
+
timeoutMs?: number;
|
|
4192
|
+
}): Promise<void>;
|
|
2749
4193
|
}
|
|
2750
4194
|
|
|
2751
4195
|
/**
|
|
@@ -2976,134 +4420,6 @@ declare abstract class Layer<TOptions = unknown, TState extends object = object,
|
|
|
2976
4420
|
protected onVisibleChange(_value: boolean): void;
|
|
2977
4421
|
}
|
|
2978
4422
|
|
|
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
4423
|
/**
|
|
3108
4424
|
* `LayoutRegistry` — stores the Layouts registered on a Canvas, addressed by id.
|
|
3109
4425
|
*
|
|
@@ -3230,11 +4546,29 @@ declare class HeadlessElementRenderer implements IElementRenderer {
|
|
|
3230
4546
|
x: number;
|
|
3231
4547
|
y: number;
|
|
3232
4548
|
} | null;
|
|
4549
|
+
/**
|
|
4550
|
+
* Display overrides by shape id — recorded so a test can assert what a
|
|
4551
|
+
* behaviour asked to draw. Nothing is drawn, and positions stay logical.
|
|
4552
|
+
*/
|
|
4553
|
+
readonly displayOverrides: Map<string, ShapeDisplayOverride>;
|
|
4554
|
+
setShapeDisplayOverride(id: string, override: ShapeDisplayOverride | null): void;
|
|
4555
|
+
clearShapeDisplayOverrides(): void;
|
|
4556
|
+
/**
|
|
4557
|
+
* Ids whose text the LOD channel has hidden (`setShapeTextVisible` /
|
|
4558
|
+
* `setConnectorTextVisible` with `false`) — recorded so a behaviour test can
|
|
4559
|
+
* assert what a text LOD asked for.
|
|
4560
|
+
*/
|
|
4561
|
+
readonly textHidden: Set<string>;
|
|
4562
|
+
setShapeTextVisible(id: string, visible: boolean): void;
|
|
4563
|
+
setConnectorTextVisible(id: string, visible: boolean): void;
|
|
4564
|
+
isTextVisible(id: string): boolean;
|
|
4565
|
+
/** The label-size policy last pushed per target — recorded for assertions. */
|
|
4566
|
+
readonly labelSizePolicies: Record<LabelSizeTarget, LabelSizePolicy | null>;
|
|
4567
|
+
setLabelSizePolicy(target: LabelSizeTarget, policy: LabelSizePolicy | null): void;
|
|
3233
4568
|
scaleShape(): void;
|
|
3234
4569
|
setConnectorStroke(): void;
|
|
3235
4570
|
scaleConnectorStroke(): void;
|
|
3236
4571
|
setRaised(): void;
|
|
3237
|
-
setShapeTextVisible(): void;
|
|
3238
4572
|
setShapeIconVisible(): void;
|
|
3239
4573
|
setShapeImageVisible(): void;
|
|
3240
4574
|
setLabelsResolution(): void;
|
|
@@ -3983,6 +5317,39 @@ declare function resolveConnectorBadgePosition(path: Path, badgeLocalBounds: Rec
|
|
|
3983
5317
|
rotation: number;
|
|
3984
5318
|
};
|
|
3985
5319
|
|
|
5320
|
+
/**
|
|
5321
|
+
* The scale to draw a label at so its on-screen font size follows `policy`.
|
|
5322
|
+
*
|
|
5323
|
+
* Positional arguments, not an options object: the renderer calls this once per
|
|
5324
|
+
* label per zoom-changed frame, so it must not allocate.
|
|
5325
|
+
*
|
|
5326
|
+
* @param fontSize The label's authored font size — its on-screen size at zoom `1`.
|
|
5327
|
+
* @param zoom Current camera zoom (`camera.scale`).
|
|
5328
|
+
* @param hostScale Visual scale the label inherits from its host before any label
|
|
5329
|
+
* scaling — e.g. a node-size LOD drawing the node at `1 / zoom`; `1` for
|
|
5330
|
+
* connectors. Excludes display-only magnification (a fisheye lens), which
|
|
5331
|
+
* should still enlarge the label.
|
|
5332
|
+
* @param policy The policy in force, or `null` for none.
|
|
5333
|
+
* @param contained `true` when the label must stay inside its host (an `inside-*`
|
|
5334
|
+
* placement): the result never exceeds `1`, so the host's fit-to-box budget holds.
|
|
5335
|
+
*
|
|
5336
|
+
* - `natural = fontSize × zoom × hostScale` — what the label measures on
|
|
5337
|
+
* screen with no policy.
|
|
5338
|
+
* - `target = zoomGrowth === undefined ? natural : fontSize × zoom ^ zoomGrowth`,
|
|
5339
|
+
* then clamped to `[minFontPx, maxFontPx]`.
|
|
5340
|
+
* - Result: `target / natural`, capped at `1` for a contained label.
|
|
5341
|
+
*
|
|
5342
|
+
* Returns `1` for a `null` policy and for degenerate input (non-positive font
|
|
5343
|
+
* size, zoom or host scale), so a caller can apply the result unconditionally.
|
|
5344
|
+
*
|
|
5345
|
+
* @example
|
|
5346
|
+
* ```ts
|
|
5347
|
+
* resolveLabelScale(12, 4, 1, { maxFontPx: 20 });
|
|
5348
|
+
* // → 20 / 48 ≈ 0.417 — the label reads 20px on screen instead of 48px
|
|
5349
|
+
* ```
|
|
5350
|
+
*/
|
|
5351
|
+
declare function resolveLabelScale(fontSize: number, zoom: number, hostScale: number, policy: LabelSizePolicy | null, contained?: boolean): number;
|
|
5352
|
+
|
|
3986
5353
|
/**
|
|
3987
5354
|
* Options for constructing a `Tween`. `from` / `to` / `duration` are required;
|
|
3988
5355
|
* everything else is optional and falls back to a sensible default.
|
|
@@ -4058,8 +5425,12 @@ interface PositionTransitionOptions {
|
|
|
4058
5425
|
* Called once per frame with the interpolated buffer — write it straight to
|
|
4059
5426
|
* the store (e.g. `store.setPositionsBulk(ids, xy)`). The SAME buffer is
|
|
4060
5427
|
* reused every frame; copy it if you need to retain it.
|
|
5428
|
+
*
|
|
5429
|
+
* `progress` is the **eased** fraction of the transition, `0..1` — the same
|
|
5430
|
+
* factor the buffer was interpolated with — and is exactly `1` on the final
|
|
5431
|
+
* frame. Lets a caller move something else in lock-step (e.g. the camera).
|
|
4061
5432
|
*/
|
|
4062
|
-
onFrame: (xy: Float32Array) => void;
|
|
5433
|
+
onFrame: (xy: Float32Array, progress: number) => void;
|
|
4063
5434
|
/** Fires once when the transition finishes naturally. NOT called on `cancel()`. */
|
|
4064
5435
|
onComplete?: () => void;
|
|
4065
5436
|
}
|
|
@@ -4205,4 +5576,4 @@ interface Selected<U> {
|
|
|
4205
5576
|
*/
|
|
4206
5577
|
declare function select<T, U>(store: ReactiveStore<T>, selector: (state: T) => U, isEqual?: (a: U, b: U) => boolean): Selected<U>;
|
|
4207
5578
|
|
|
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 };
|
|
5579
|
+
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 };
|