@invana/canvas-core 0.0.15 → 0.0.17

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.d.ts CHANGED
@@ -771,6 +771,13 @@ interface CanvasGlobalEvents {
771
771
  preserveCamera?: boolean;
772
772
  fitCamera?: boolean;
773
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;
780
+ };
774
781
  'canvas:renderer:ready': {
775
782
  backend: string;
776
783
  capabilities?: Record<string, unknown>;
@@ -1040,6 +1047,11 @@ type ControlPanelPosition = ControlPanelAnchor | ControlPanelInsets;
1040
1047
  interface ControlItemBase {
1041
1048
  /** Stable key within the panel; defaults to the item's index. */
1042
1049
  key?: string;
1050
+ /**
1051
+ * The board modes the item shows in (the `board.mode` command's value). Default:
1052
+ * every mode. A board with no modes shows it.
1053
+ */
1054
+ modes?: string[];
1043
1055
  }
1044
1056
  /**
1045
1057
  * A button that runs a named command on click. Disabled while the command is
@@ -1088,6 +1100,11 @@ interface ControlToggleItemSpec extends ControlItemBase {
1088
1100
  label: string;
1089
1101
  /** Tooltip + label while active. Defaults to {@link label}. */
1090
1102
  activeLabel?: string;
1103
+ /**
1104
+ * A command whose `value` is drawn as a badge on the icon — a count, such as
1105
+ * the unsaved changes. Nothing is drawn while its value is `null` or `''`.
1106
+ */
1107
+ badge?: string;
1091
1108
  }
1092
1109
  /** One option of a {@link ControlChoiceItemSpec}. */
1093
1110
  interface ControlChoiceOption {
@@ -1193,10 +1210,51 @@ interface ControlPanelSpec {
1193
1210
  * Default `false`.
1194
1211
  */
1195
1212
  stretch?: boolean;
1196
- /** Draw the card surface (background, border, shadow). Default `true` over the canvas, `false` in a header / footer rail. */
1197
- surface?: boolean;
1213
+ /**
1214
+ * A fixed width in px, the items spread across it — a bar matched to what it
1215
+ * sits under (the minimap). Default: as wide as its items.
1216
+ */
1217
+ width?: number;
1218
+ /**
1219
+ * The panel's surface. `true` draws the card (background, border, shadow);
1220
+ * `'hairline'` a border hairline on a translucent background, no shadow — the
1221
+ * light toolbar row that lets the drawing show through; `false` nothing.
1222
+ * Default `true` over the canvas, `false` in a header / footer rail.
1223
+ */
1224
+ surface?: boolean | 'hairline';
1198
1225
  /** Show the panel. Default `true`. */
1199
1226
  visible?: boolean;
1227
+ /**
1228
+ * The board modes the panel shows in — the `board.mode` command's value, a
1229
+ * viewer's choice that is never saved with the board. Default: every mode. A
1230
+ * board with no modes shows it.
1231
+ */
1232
+ modes?: string[];
1233
+ /**
1234
+ * `'idle'` fades the panel while the pointer rests over the board and brings it
1235
+ * back on any movement — chrome that should not compete with the drawing
1236
+ * (Focus, Present). Default: always shown.
1237
+ */
1238
+ fade?: 'idle';
1239
+ /**
1240
+ * Let the panel fold down to a few of its items — the "tools off" row. A
1241
+ * trailing *Hide the tools* control folds it to the items whose `key` is in
1242
+ * `keep`, followed by *Show the tools*, which opens it again. Whether it is
1243
+ * folded is the viewer's, held by the drawing surface; {@link collapsed}
1244
+ * only says how it starts.
1245
+ */
1246
+ collapsible?: {
1247
+ /** Keys of the items that stay while folded, in their order in `items`. */
1248
+ keep: string[];
1249
+ /** Default `Show the tools`. */
1250
+ showLabel?: string;
1251
+ /** Default `Hide the tools`. */
1252
+ hideLabel?: string;
1253
+ /** Ids of other panels hidden while this one is folded — "nothing else floats". */
1254
+ hides?: string[];
1255
+ };
1256
+ /** With {@link collapsible}: start folded. Default `false`. */
1257
+ collapsed?: boolean;
1200
1258
  /** The panel's items, in order. */
1201
1259
  items: ControlItemSpec[];
1202
1260
  }
@@ -1655,6 +1713,12 @@ interface Playbook<S = Record<string, unknown>> {
1655
1713
  * this layer — the engine and the schema-driven editors give them concrete shape,
1656
1714
  * and the kernel stays domain-free (it treats element `style` as opaque).
1657
1715
  */
1716
+ /** A layout preset by id, and the options changed over its defaults. */
1717
+ interface CanvasLayoutPreset {
1718
+ id: string;
1719
+ /** Option key → chosen value, only where it differs from the preset's default. */
1720
+ overrides?: Record<string, string>;
1721
+ }
1658
1722
  interface CanvasView {
1659
1723
  /** "What the visualisation IS" — persisted, converged (a CRDT doc later). */
1660
1724
  definition: {
@@ -1668,6 +1732,13 @@ interface CanvasView {
1668
1732
  layouts: Record<string, Record<string, unknown>>;
1669
1733
  /** Id of the active layout among {@link layouts}, or `null`. */
1670
1734
  activeLayout: string | null;
1735
+ /**
1736
+ * The layout preset the layout, edge and layout-option slices were last set
1737
+ * from, and the options changed over it — `null` when none was applied. The
1738
+ * expanded slices are what take effect; this names them, for the picker,
1739
+ * *Reset to preset* and a replayed walkthrough step.
1740
+ */
1741
+ layoutPreset: CanvasLayoutPreset | null;
1671
1742
  /** Authored node/edge templates (designer output). */
1672
1743
  templates: unknown[];
1673
1744
  /** Theme **config** (registry + active family + mode + accent). The *resolved* theme is derived. */
@@ -3350,6 +3421,9 @@ interface BehaviourOptions {
3350
3421
  * suspended — its `onDisable` runs, `enabled` is unchanged — and resumes when
3351
3422
  * the mode comes back. E.g. `modes: ['connect']` on an edge-drawing behaviour
3352
3423
  * makes the modeller's Connect tool switch it on and off with no host wiring.
3424
+ * A `'!'` entry excludes a mode: `modes: ['!hand']` is live in every mode but
3425
+ * `'hand'`. Positive and `'!'` entries combine — listed modes, minus the
3426
+ * excluded ones.
3353
3427
  */
3354
3428
  modes?: readonly string[];
3355
3429
  }
@@ -3607,6 +3681,10 @@ interface CommandOption {
3607
3681
  label: string;
3608
3682
  /** Icon name, resolved by the UI kit's icon registry. */
3609
3683
  icon?: string;
3684
+ /** Offered but not pickable now. A control shows it dimmed, with {@link description} as the reason. */
3685
+ disabled?: boolean;
3686
+ /** One line under the label — for a disabled option, why it is off. */
3687
+ description?: string;
3610
3688
  }
3611
3689
  /**
3612
3690
  * The value kinds a {@link CommandArgSpec} can describe. The first five are
@@ -3900,6 +3978,18 @@ type LayoutEvents = {
3900
3978
  transition: {
3901
3979
  progress: number;
3902
3980
  };
3981
+ /**
3982
+ * An off-screen solve advanced: `done` of `total` iterations are finished.
3983
+ * Emitted by iterative layouts that settle before drawing (d3-force with
3984
+ * `animate: false`), so a UI can say why the canvas is still empty.
3985
+ *
3986
+ * Separate from `tick` on purpose: `tick` means "positions were written",
3987
+ * and the graph layer reveals nodes on it — progress writes nothing.
3988
+ */
3989
+ progress: {
3990
+ done: number;
3991
+ total: number;
3992
+ };
3903
3993
  end: {
3904
3994
  reason: LayoutEndReason;
3905
3995
  };
@@ -3938,13 +4028,34 @@ interface LayoutRunOptions {
3938
4028
  * the camera and stops the follow.
3939
4029
  *
3940
4030
  * `true` fits with the default padding (80 screen px); `{ padding }` sets
3941
- * it. Fitters that would otherwise frame on `end` (the `fitOnLoad`
4031
+ * it, and `{ maxZoom }` stops the fit zooming in past that scale (`1` keeps
4032
+ * a small graph at its drawn size). Fitters that would otherwise frame on `end` (the `fitOnLoad`
3942
4033
  * auto-fitter, the React layout wrappers' `fitPadding`) skip such a run —
3943
4034
  * it already owns the camera. Ignored when {@link preserveCamera} is set.
3944
4035
  */
3945
4036
  fitCamera?: boolean | {
3946
4037
  padding?: number;
4038
+ maxZoom?: number;
3947
4039
  };
4040
+ /**
4041
+ * Solve from scratch: ignore the nodes' stored positions as starting points
4042
+ * (pinned nodes still hold). For an iterative layout that settles from where
4043
+ * the nodes are, a settled graph otherwise falls straight back into the same
4044
+ * arrangement, and a graph laid out by another layout keeps that layout's
4045
+ * crossings. Honoured by `D3ForceLayout`; a one-shot layout computes from
4046
+ * scratch anyway.
4047
+ */
4048
+ reseed?: boolean;
4049
+ }
4050
+ /** How {@link Layout.setOptions} applies a patch. */
4051
+ interface LayoutSetOptions {
4052
+ /**
4053
+ * Re-run a layout that has already run, so the change shows. Default `true`.
4054
+ * `false` when the same write is about to run the layout anyway — a canvas
4055
+ * passes it for the layout an `activeLayout` write names — so a switch is one
4056
+ * run, carrying that run's options.
4057
+ */
4058
+ rerun?: boolean;
3948
4059
  }
3949
4060
  /**
3950
4061
  * How an **active** layout re-runs when its target layer's data changes
@@ -4012,10 +4123,10 @@ declare abstract class Layout<TLayer extends Layer<any, any, any, any> = Layer<a
4012
4123
  constructor(opts?: LayoutOptions);
4013
4124
  /**
4014
4125
  * Live-reconfigure. Called by `Canvas.update({ layouts: { id: patch } })`.
4015
- * Default no-op; iterative layouts (e.g. `D3ForceLayout`) override to merge
4016
- * the patch and re-heat a running simulation.
4126
+ * Default no-op; layouts override to merge the patch and, unless
4127
+ * `opts.rerun` is `false`, re-run so the change shows.
4017
4128
  */
4018
- setOptions(_patch: unknown): void;
4129
+ setOptions(_patch: unknown, _opts?: LayoutSetOptions): void;
4019
4130
  /**
4020
4131
  * Contribute this layout's serialisable config to a canvas-state snapshot (the
4021
4132
  * engine's `DefinitionSerializable` contract). The base captures the wiring
@@ -4946,6 +5057,46 @@ declare const bumpRadialPathStyle: IPathStyle;
4946
5057
  */
4947
5058
  declare const bumpHorizontalPathStyle: IPathStyle;
4948
5059
 
5060
+ /**
5061
+ * Single cubic Bézier from the first to the last polyline point, pulled
5062
+ * **vertically** — the curve of a top-to-bottom tree, d3-shape's
5063
+ * `linkVertical()`: `c1 = (sx, (sy + ty)/2)`, `c2 = (tx, (sy + ty)/2)`.
5064
+ *
5065
+ * Unlike `bump-horizontal` it ignores the anchors' tangents. On a circle with
5066
+ * the default `boundary` anchor the tangent points at the other node, so a
5067
+ * tangent-following curve flattens into a straight line; the midline keeps the
5068
+ * S-curve on every shape.
5069
+ *
5070
+ * Pair with `router: 'straight'`; intermediate waypoints are ignored.
5071
+ *
5072
+ * Edge cases: fewer than two points → `[]`; `sy === ty` → a straight line.
5073
+ */
5074
+ declare const bumpVerticalPathStyle: IPathStyle;
5075
+
5076
+ /**
5077
+ * A piecewise cubic Bézier read from its **control points** — the curve a
5078
+ * layout engine computed, drawn as it computed it.
5079
+ *
5080
+ * Pair with `router: 'straight'`, which yields
5081
+ * `[sourceAnchor, ...waypoints, targetAnchor]`. The waypoints are read as a
5082
+ * Bézier chain `P0, C1, C2, P1, C1, C2, P2, …, Pn` — `3k + 1` points, every
5083
+ * third one on the curve. That is how ELK's `SPLINES` edge routing reports a
5084
+ * section: start point, bend points (always `3k − 1` of them), end point. The
5085
+ * chain is drawn as is, so the curve keeps the clearance from nodes the engine
5086
+ * routed it for — unlike `smooth`, which interpolates *through* points and can
5087
+ * overshoot.
5088
+ *
5089
+ * The anchors join the chain with a straight leg when they don't sit on its
5090
+ * ends. With the default `boundary` anchor aiming at the first / last waypoint,
5091
+ * and ELK's section ends on the node border, the legs are zero-length and are
5092
+ * left out.
5093
+ *
5094
+ * Waypoints that don't form a chain (wrong count, or none) are drawn as a
5095
+ * polyline through them — the same as `normal` — so a misconfigured edge stays
5096
+ * visible and connected.
5097
+ */
5098
+ declare const splinePathStyle: IPathStyle;
5099
+
4949
5100
  /**
4950
5101
  * Catmull-Rom spline through every polyline point, emitted as cubic Béziers.
4951
5102
  * The curve passes through every input point exactly; intermediate router
@@ -5557,4 +5708,4 @@ interface Selected<U> {
5557
5708
  */
5558
5709
  declare function select<T, U>(store: ReactiveStore<T>, selector: (state: T) => U, isEqual?: (a: U, b: U) => boolean): Selected<U>;
5559
5710
 
5560
- export { type AnnotationRecord, BadgeOptions, BadgePlacement, BaseConnectorSpec, BaseShapeSpec, Behaviour, type BehaviourOptions, BehaviourRegistry, type BehaviourRegistryOptions, CANVAS_SOURCE, Camera, type CameraChangeKind, type CameraInputConfig, type CameraInputModifier, type CameraIntent, type CameraOptions, type CameraTransform, type CameraTransformValue, type CanvasActions, type CanvasCommand, type CanvasContext, type CanvasEvent, CanvasEventBus, type CanvasGlobalEvents, type CanvasSceneOptions, type CanvasStore, CanvasThemeState, type CanvasView, type ColumnArray, type ColumnSchema, ColumnStore, type ColumnStoreOptions, type ColumnType, type ColumnValue, type CommandArgKind, type CommandArgSpec, type CommandArgsOf, type CommandMap, type CommandName, type CommandOption, CommandRegistry, type CommandRegistryOptions, type ControlChoiceItemSpec, type ControlChoiceOption, type ControlCommandItemSpec, type ControlDividerItemSpec, type ControlItemSpec, type ControlPanelAnchor, type ControlPanelInsets, type ControlPanelPlacement, type ControlPanelPosition, type ControlPanelSpec, type ControlSlotItemSpec, type ControlTextItemSpec, type ControlToggleItemSpec, type ControlWidgetItemSpec, type CustomElementCtor, DEFAULT_ENDPOINT_BADGE_GAP_PX, DEFAULT_POSITION_TRANSITION_MS, type DataLogPart, type DataOpAdapter, type DataSource, DecorationSpec, type DeepPartial, DefaultGestureArbiter, type Delta, type DeltaOptions, type DeltaRecord, DirtyBatcher, type DirtySnapshot, EASING_NAMES, type Easing, type EasingName, type EdgeRecord, EffectSpec, ElementEventMap, EventEmitter, EventMap, type EventSource, type EventSourceKind, FlushMode, type FramePhase, type FramePhaseTimings, type FrameStats, type FrameTick, type GestureArbiter, type GestureClaimOptions, type GraphInput, type GroupRecord, HeadlessCameraBinding, HeadlessElementRenderer, HeadlessRenderer, HeadlessSurface, type HistoryView, HitResult, IAnchor, type IBehaviour, type ICameraBinding, type IElementRenderer, type ILayer, INHERIT, type IOverlayDevice, IPathStyle, type IRenderer, IRouter, type ISurface, type ISurfaceHost, type Inherit, type IntentLogEntry, type InteractionKind, type KindDelta, LOOP_CURVE_PRESETS, LabelContent, type LabelSizePolicy, type LabelSizeTarget, LabelWrap, Layer, LayerData, type LayerFlush, type LayerOptions, LayerRegistry, type LayerRegistryOptions, Layout, type LayoutDataRunOptions, type LayoutEndReason, type LayoutEvents, type LayoutOptions, LayoutRegistry, type LayoutRegistryOptions, type LayoutRunOptions, Listener, type LogEntry, type LogEntryFilter, type LogEntryStatus, type LogGroupMeta, type LogPart, type LogStepInfo, type LoopCurvePresetName, type MountedDecoration, NODE_FLAG, type NodeDelta, type NodeRecord, type OperationLog, type OverlayFill, type OverlayFillLike, type OverlaySpace, type OverlayStroke, type Patch, Path, type PinchInputOptions, type Playbook, type PlaybookSpec, Point, type PosSchema, type PositionTransition, type PositionTransitionOptions, type QueryStatus, type ReactiveStore, type Recipe, Rect, type RenderPreference, type RendererBackend, type RendererCapabilities, type RendererInitOptions, type RendererMountOptions, type ResolvedTheme, type RowOf, type Selected, type ShapeDisplayOverride, ShapeFill, ShapeStroke, SourceEmitter, SpecFlush, type SpecProjectionTarget, SpecProjector, type SpecProjectorOptions, SpecStore, type StateCell, type StepSpec, type StoreChange, type SurfaceBackdrop, type SurfaceOptions, type SurfaceSpace, type Tap, type TapOptions, type ThemeKind, type ThemeMode, type ThemeState, type Themed, Tween, type TweenOptions, type Update, Vec2, type ViewLogPart, type WheelInputOptions, animatePositions, attrs, bezierPathStyle, boundaryAnchor, bumpHorizontalPathStyle, bumpRadialPathStyle, bundlePathStyle, centerAnchor, connectorToSvg, createActions, defaultCanvasView, defaultEqual, distanceToPolylineSq, easeInOutCubic, easeInOutSine, easeOutCubic, easeOutQuad, edgePortAnchor, erRouter, esc, fillPaint, hexToCss, isInherit, linear, loopCurvePathStyle, loopPolylinePathStyle, manhattanRouter, metroRouter, normalPathStyle, oneSideRouter, originToBadgeLocal, orthRouter, pathBounds, pathToSvgD, perpendicularAnchor, pointsAttr, quadraticPathStyle, resolveBadgePosition, resolveConnectorBadgePosition, resolveEasing, resolveLabelScale, resolveThemed, roundedPathStyle, samplePath, samplePathAt, select, shallowEqual, shapeSpecToSvg, silhouettePortAnchor, smoothPathStyle, stepRadialPathStyle, straightRouter, strokePaint, n as svgNum, tangentAt, textContent, trimPathEnds };
5711
+ 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 CanvasLayoutPreset, 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, type LayoutSetOptions, 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, bumpVerticalPathStyle, 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, splinePathStyle, stepRadialPathStyle, straightRouter, strokePaint, n as svgNum, tangentAt, textContent, trimPathEnds };
package/dist/index.js CHANGED
@@ -446,7 +446,9 @@ var Behaviour = class {
446
446
  /** Is `mode` one this behaviour is live in? */
447
447
  matchesMode(mode) {
448
448
  const modes = this._options.modes;
449
- return modes === void 0 || modes.includes(mode);
449
+ if (modes === void 0) return true;
450
+ if (modes.includes(`!${mode}`)) return false;
451
+ return !modes.some((m) => !m.startsWith("!")) || modes.includes(mode);
450
452
  }
451
453
  /**
452
454
  * Follow `view.interaction.viewMode` while registered and `modes` is set;
@@ -668,10 +670,10 @@ var Layout = class {
668
670
  }
669
671
  /**
670
672
  * Live-reconfigure. Called by `Canvas.update({ layouts: { id: patch } })`.
671
- * Default no-op; iterative layouts (e.g. `D3ForceLayout`) override to merge
672
- * the patch and re-heat a running simulation.
673
+ * Default no-op; layouts override to merge the patch and, unless
674
+ * `opts.rerun` is `false`, re-run so the change shows.
673
675
  */
674
- setOptions(_patch) {
676
+ setOptions(_patch, _opts) {
675
677
  }
676
678
  /**
677
679
  * Contribute this layout's serialisable config to a canvas-state snapshot (the
@@ -3934,6 +3936,48 @@ var bumpHorizontalPathStyle = (polyline, _opts, endpoints) => {
3934
3936
  return out;
3935
3937
  };
3936
3938
 
3939
+ // src/lib/geometry/connectors/pathStyles/bumpVertical.ts
3940
+ var bumpVerticalPathStyle = (polyline) => {
3941
+ if (polyline.length < 2) return [];
3942
+ const s = polyline[0];
3943
+ const t = polyline[polyline.length - 1];
3944
+ const midY = (s.y + t.y) / 2;
3945
+ const out = [
3946
+ { kind: "M", x: s.x, y: s.y },
3947
+ { kind: "C", c1x: s.x, c1y: midY, c2x: t.x, c2y: midY, x: t.x, y: t.y }
3948
+ ];
3949
+ return out;
3950
+ };
3951
+
3952
+ // src/lib/geometry/connectors/pathStyles/spline.ts
3953
+ var COINCIDENT = 0.5;
3954
+ var splinePathStyle = (polyline) => {
3955
+ if (polyline.length < 2) return [];
3956
+ const source = polyline[0];
3957
+ const target = polyline[polyline.length - 1];
3958
+ const chain = polyline.slice(1, -1);
3959
+ if (chain.length < 4 || (chain.length - 1) % 3 !== 0) {
3960
+ return polyline.map(
3961
+ (p, i) => i === 0 ? { kind: "M", x: p.x, y: p.y } : { kind: "L", x: p.x, y: p.y }
3962
+ );
3963
+ }
3964
+ const first = chain[0];
3965
+ const last = chain[chain.length - 1];
3966
+ const out = [{ kind: "M", x: source.x, y: source.y }];
3967
+ if (!coincident(source, first)) out.push({ kind: "L", x: first.x, y: first.y });
3968
+ for (let i = 1; i + 2 < chain.length; i += 3) {
3969
+ const c1 = chain[i];
3970
+ const c2 = chain[i + 1];
3971
+ const p = chain[i + 2];
3972
+ out.push({ kind: "C", c1x: c1.x, c1y: c1.y, c2x: c2.x, c2y: c2.y, x: p.x, y: p.y });
3973
+ }
3974
+ if (!coincident(last, target)) out.push({ kind: "L", x: target.x, y: target.y });
3975
+ return out;
3976
+ };
3977
+ function coincident(a, b) {
3978
+ return Math.abs(a.x - b.x) < COINCIDENT && Math.abs(a.y - b.y) < COINCIDENT;
3979
+ }
3980
+
3937
3981
  // src/lib/geometry/connectors/pathStyles/smooth.ts
3938
3982
  var DEFAULT_TENSION2 = 1;
3939
3983
  var smoothPathStyle = (polyline, opts) => {
@@ -5282,6 +5326,7 @@ function defaultCanvasView() {
5282
5326
  behaviours: {},
5283
5327
  layouts: {},
5284
5328
  activeLayout: null,
5329
+ layoutPreset: null,
5285
5330
  templates: [],
5286
5331
  theme: {},
5287
5332
  controlPanels: {}
@@ -6225,6 +6270,6 @@ var LayerData = class {
6225
6270
  }
6226
6271
  };
6227
6272
 
6228
- export { Behaviour, BehaviourRegistry, CANVAS_SOURCE, Camera, CanvasEventBus, CanvasThemeState, ColumnStore, CommandRegistry, DEFAULT_ENDPOINT_BADGE_GAP_PX, DEFAULT_POSITION_TRANSITION_MS, DefaultGestureArbiter, DirtyBatcher, EASING_NAMES, EventEmitter, HeadlessCameraBinding, HeadlessElementRenderer, HeadlessRenderer, HeadlessSurface, INHERIT, LOOP_CURVE_PRESETS, Layer, LayerData, LayerRegistry, Layout, LayoutRegistry, NODE_FLAG, SourceEmitter, SpecProjector, SpecStore, Tween, animatePositions, attrs, bezierPathStyle, boundaryAnchor, boundsOfArc, boundsOfCircle, boundsOfComposite, boundsOfCompositeRoot, boundsOfEllipse, boundsOfPath, boundsOfPolygon, boundsOfRect, boundsOfRegularPolygon, boundsOfSpec, boundsOfStar, bumpHorizontalPathStyle, bumpRadialPathStyle, bundlePathStyle, centerAnchor, collapsedSpec, collapsedTabbedRect, compositeRootOffset, connectorGeometryKey, connectorToSvg, containsArc, containsCircle, containsComposite, containsEllipse, containsPath, containsPolygon, containsRect, containsRegularPolygon, containsSpec, containsStar, containsTabbedRect, createActions, defaultCanvasView, defaultEqual, distanceToOutlineSq, distanceToPolylineSq, distanceToSegmentSq, easeInOutCubic, easeInOutSine, easeOutCubic, easeOutQuad, edgePortAnchor, erRouter, esc, fillPaint, fitSpecToContent, fitTabbedRectToContent, hasSilhouetteFill, hexToCss, isInherit, linear, loopCurvePathStyle, loopPolylinePathStyle, manhattanRouter, metroRouter, normalPathStyle, offsetPolygon, oneSideRouter, originToBadgeLocal, orthRouter, pathBounds, pathToSvgD, perpendicularAnchor, pointInPolygon, pointsAttr, polygonBounds, polygonContainsInflated, quadraticPathStyle, rayPolygonIntersection, regularPolygonVertices, resolveBadgePosition, resolveCompositeRoot, resolveConnectorBadgePosition, resolveEasing, resolveLabelScale, resolveThemed, roundedPathStyle, roundedPolygonOutline, samplePath, samplePathAt, scaleArc, scaleCircle, scaleEllipse, scalePath, scalePolygon, scaleRect, scaleRegularPolygon, scaleSpec, scaleStar, scaleTabbedRect, scheduleFlush, select, shallowEqual, shapeSpecToSvg, silhouettePortAnchor, smoothPathStyle, starVertices, stepRadialPathStyle, straightRouter, strokeBandOf, strokePaint, n as svgNum, tabbedRectBounds, tabbedRectFoldLine, tabbedRectGeometry, tabbedRectOutline, tabbedRectTabBox, tabbedRectTabWidth, tangentAt, textContent, trimPathEnds, verticesOfRegularPolygon, verticesOfStar };
6273
+ export { Behaviour, BehaviourRegistry, CANVAS_SOURCE, Camera, CanvasEventBus, CanvasThemeState, ColumnStore, CommandRegistry, DEFAULT_ENDPOINT_BADGE_GAP_PX, DEFAULT_POSITION_TRANSITION_MS, DefaultGestureArbiter, DirtyBatcher, EASING_NAMES, EventEmitter, HeadlessCameraBinding, HeadlessElementRenderer, HeadlessRenderer, HeadlessSurface, INHERIT, LOOP_CURVE_PRESETS, Layer, LayerData, LayerRegistry, Layout, LayoutRegistry, NODE_FLAG, SourceEmitter, SpecProjector, SpecStore, Tween, animatePositions, attrs, bezierPathStyle, boundaryAnchor, boundsOfArc, boundsOfCircle, boundsOfComposite, boundsOfCompositeRoot, boundsOfEllipse, boundsOfPath, boundsOfPolygon, boundsOfRect, boundsOfRegularPolygon, boundsOfSpec, boundsOfStar, bumpHorizontalPathStyle, bumpRadialPathStyle, bumpVerticalPathStyle, bundlePathStyle, centerAnchor, collapsedSpec, collapsedTabbedRect, compositeRootOffset, connectorGeometryKey, connectorToSvg, containsArc, containsCircle, containsComposite, containsEllipse, containsPath, containsPolygon, containsRect, containsRegularPolygon, containsSpec, containsStar, containsTabbedRect, createActions, defaultCanvasView, defaultEqual, distanceToOutlineSq, distanceToPolylineSq, distanceToSegmentSq, easeInOutCubic, easeInOutSine, easeOutCubic, easeOutQuad, edgePortAnchor, erRouter, esc, fillPaint, fitSpecToContent, fitTabbedRectToContent, hasSilhouetteFill, hexToCss, isInherit, linear, loopCurvePathStyle, loopPolylinePathStyle, manhattanRouter, metroRouter, normalPathStyle, offsetPolygon, oneSideRouter, originToBadgeLocal, orthRouter, pathBounds, pathToSvgD, perpendicularAnchor, pointInPolygon, pointsAttr, polygonBounds, polygonContainsInflated, quadraticPathStyle, rayPolygonIntersection, regularPolygonVertices, resolveBadgePosition, resolveCompositeRoot, resolveConnectorBadgePosition, resolveEasing, resolveLabelScale, resolveThemed, roundedPathStyle, roundedPolygonOutline, samplePath, samplePathAt, scaleArc, scaleCircle, scaleEllipse, scalePath, scalePolygon, scaleRect, scaleRegularPolygon, scaleSpec, scaleStar, scaleTabbedRect, scheduleFlush, select, shallowEqual, shapeSpecToSvg, silhouettePortAnchor, smoothPathStyle, splinePathStyle, starVertices, stepRadialPathStyle, straightRouter, strokeBandOf, strokePaint, n as svgNum, tabbedRectBounds, tabbedRectFoldLine, tabbedRectGeometry, tabbedRectOutline, tabbedRectTabBox, tabbedRectTabWidth, tangentAt, textContent, trimPathEnds, verticesOfRegularPolygon, verticesOfStar };
6229
6274
  //# sourceMappingURL=index.js.map
6230
6275
  //# sourceMappingURL=index.js.map