@invana/canvas-core 0.0.16 → 0.0.18
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 +139 -7
- package/dist/index.js +50 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1047,6 +1047,11 @@ type ControlPanelPosition = ControlPanelAnchor | ControlPanelInsets;
|
|
|
1047
1047
|
interface ControlItemBase {
|
|
1048
1048
|
/** Stable key within the panel; defaults to the item's index. */
|
|
1049
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[];
|
|
1050
1055
|
}
|
|
1051
1056
|
/**
|
|
1052
1057
|
* A button that runs a named command on click. Disabled while the command is
|
|
@@ -1095,6 +1100,11 @@ interface ControlToggleItemSpec extends ControlItemBase {
|
|
|
1095
1100
|
label: string;
|
|
1096
1101
|
/** Tooltip + label while active. Defaults to {@link label}. */
|
|
1097
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;
|
|
1098
1108
|
}
|
|
1099
1109
|
/** One option of a {@link ControlChoiceItemSpec}. */
|
|
1100
1110
|
interface ControlChoiceOption {
|
|
@@ -1200,10 +1210,51 @@ interface ControlPanelSpec {
|
|
|
1200
1210
|
* Default `false`.
|
|
1201
1211
|
*/
|
|
1202
1212
|
stretch?: boolean;
|
|
1203
|
-
/**
|
|
1204
|
-
|
|
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';
|
|
1205
1225
|
/** Show the panel. Default `true`. */
|
|
1206
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;
|
|
1207
1258
|
/** The panel's items, in order. */
|
|
1208
1259
|
items: ControlItemSpec[];
|
|
1209
1260
|
}
|
|
@@ -1662,6 +1713,12 @@ interface Playbook<S = Record<string, unknown>> {
|
|
|
1662
1713
|
* this layer — the engine and the schema-driven editors give them concrete shape,
|
|
1663
1714
|
* and the kernel stays domain-free (it treats element `style` as opaque).
|
|
1664
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
|
+
}
|
|
1665
1722
|
interface CanvasView {
|
|
1666
1723
|
/** "What the visualisation IS" — persisted, converged (a CRDT doc later). */
|
|
1667
1724
|
definition: {
|
|
@@ -1675,6 +1732,13 @@ interface CanvasView {
|
|
|
1675
1732
|
layouts: Record<string, Record<string, unknown>>;
|
|
1676
1733
|
/** Id of the active layout among {@link layouts}, or `null`. */
|
|
1677
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;
|
|
1678
1742
|
/** Authored node/edge templates (designer output). */
|
|
1679
1743
|
templates: unknown[];
|
|
1680
1744
|
/** Theme **config** (registry + active family + mode + accent). The *resolved* theme is derived. */
|
|
@@ -3357,6 +3421,9 @@ interface BehaviourOptions {
|
|
|
3357
3421
|
* suspended — its `onDisable` runs, `enabled` is unchanged — and resumes when
|
|
3358
3422
|
* the mode comes back. E.g. `modes: ['connect']` on an edge-drawing behaviour
|
|
3359
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.
|
|
3360
3427
|
*/
|
|
3361
3428
|
modes?: readonly string[];
|
|
3362
3429
|
}
|
|
@@ -3614,6 +3681,10 @@ interface CommandOption {
|
|
|
3614
3681
|
label: string;
|
|
3615
3682
|
/** Icon name, resolved by the UI kit's icon registry. */
|
|
3616
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;
|
|
3617
3688
|
}
|
|
3618
3689
|
/**
|
|
3619
3690
|
* The value kinds a {@link CommandArgSpec} can describe. The first five are
|
|
@@ -3957,13 +4028,34 @@ interface LayoutRunOptions {
|
|
|
3957
4028
|
* the camera and stops the follow.
|
|
3958
4029
|
*
|
|
3959
4030
|
* `true` fits with the default padding (80 screen px); `{ padding }` sets
|
|
3960
|
-
* it
|
|
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`
|
|
3961
4033
|
* auto-fitter, the React layout wrappers' `fitPadding`) skip such a run —
|
|
3962
4034
|
* it already owns the camera. Ignored when {@link preserveCamera} is set.
|
|
3963
4035
|
*/
|
|
3964
4036
|
fitCamera?: boolean | {
|
|
3965
4037
|
padding?: number;
|
|
4038
|
+
maxZoom?: number;
|
|
3966
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;
|
|
3967
4059
|
}
|
|
3968
4060
|
/**
|
|
3969
4061
|
* How an **active** layout re-runs when its target layer's data changes
|
|
@@ -4031,10 +4123,10 @@ declare abstract class Layout<TLayer extends Layer<any, any, any, any> = Layer<a
|
|
|
4031
4123
|
constructor(opts?: LayoutOptions);
|
|
4032
4124
|
/**
|
|
4033
4125
|
* Live-reconfigure. Called by `Canvas.update({ layouts: { id: patch } })`.
|
|
4034
|
-
* Default no-op;
|
|
4035
|
-
*
|
|
4126
|
+
* Default no-op; layouts override to merge the patch and, unless
|
|
4127
|
+
* `opts.rerun` is `false`, re-run so the change shows.
|
|
4036
4128
|
*/
|
|
4037
|
-
setOptions(_patch: unknown): void;
|
|
4129
|
+
setOptions(_patch: unknown, _opts?: LayoutSetOptions): void;
|
|
4038
4130
|
/**
|
|
4039
4131
|
* Contribute this layout's serialisable config to a canvas-state snapshot (the
|
|
4040
4132
|
* engine's `DefinitionSerializable` contract). The base captures the wiring
|
|
@@ -4965,6 +5057,46 @@ declare const bumpRadialPathStyle: IPathStyle;
|
|
|
4965
5057
|
*/
|
|
4966
5058
|
declare const bumpHorizontalPathStyle: IPathStyle;
|
|
4967
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
|
+
|
|
4968
5100
|
/**
|
|
4969
5101
|
* Catmull-Rom spline through every polyline point, emitted as cubic Béziers.
|
|
4970
5102
|
* The curve passes through every input point exactly; intermediate router
|
|
@@ -5576,4 +5708,4 @@ interface Selected<U> {
|
|
|
5576
5708
|
*/
|
|
5577
5709
|
declare function select<T, U>(store: ReactiveStore<T>, selector: (state: T) => U, isEqual?: (a: U, b: U) => boolean): Selected<U>;
|
|
5578
5710
|
|
|
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 };
|
|
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
|
-
|
|
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;
|
|
672
|
-
*
|
|
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
|