@weasel-js/diagram 1.11.0 → 1.11.1
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/README.md +696 -4
- package/dist/chunk-43LDZ6L4.js +2053 -0
- package/dist/chunk-43LDZ6L4.js.map +1 -0
- package/dist/chunk-CI3I3I6T.js +3600 -0
- package/dist/chunk-CI3I3I6T.js.map +1 -0
- package/dist/{chunk-NUMMW5BI.js → chunk-IM6DHWZO.js} +388 -33
- package/dist/chunk-IM6DHWZO.js.map +1 -0
- package/dist/chunk-QKSWZEJH.js +312 -0
- package/dist/chunk-QKSWZEJH.js.map +1 -0
- package/dist/chunk-T6DQT553.js +1431 -0
- package/dist/chunk-T6DQT553.js.map +1 -0
- package/dist/chunk-WDIE35AK.js +3 -0
- package/dist/chunk-WDIE35AK.js.map +1 -0
- package/dist/{fromData-GKqRgPFs.d.ts → dataTypes-B-iEwKZp.d.ts} +229 -55
- package/dist/effect-audio.d.ts +138 -0
- package/dist/effect-audio.js +527 -0
- package/dist/effect-audio.js.map +1 -0
- package/dist/effect.d.ts +486 -121
- package/dist/effect.js +1599 -340
- package/dist/effect.js.map +1 -1
- package/dist/icons.table.d.ts +6 -0
- package/dist/icons.table.js +32 -0
- package/dist/icons.table.js.map +1 -0
- package/dist/icons.table.json +24 -0
- package/dist/index.d.ts +2149 -88
- package/dist/index.js +1056 -2
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +3 -3
- package/dist/{layout.entry-BoWFcR4G.d.ts → layout.entry-CH9gc0CY.d.ts} +230 -3
- package/dist/layout.js +3 -1
- package/dist/stageTypes-DvnR8cKQ.d.ts +189 -0
- package/dist/{body-2lC7IiIA.d.ts → types-BbHunLXm.d.ts} +147 -7
- package/package.json +28 -7
- package/dist/chunk-C4NAI6NV.js +0 -2041
- package/dist/chunk-C4NAI6NV.js.map +0 -1
- package/dist/chunk-NUMMW5BI.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Page } from '@weasel-js/core';
|
|
2
|
+
import { Vec2 } from '@weasel-js/core/math';
|
|
3
|
+
|
|
4
|
+
/** An effects pipeline as plain data. It says what is wired to what and
|
|
5
|
+
* nothing about how any of it is drawn. */
|
|
6
|
+
interface EffectPipeline {
|
|
7
|
+
stages: readonly EffectStage[];
|
|
8
|
+
wires: readonly EffectWire[];
|
|
9
|
+
groups?: readonly EffectGroup[];
|
|
10
|
+
/** What the value types mean. A type no entry names is plain data. */
|
|
11
|
+
types?: Readonly<Record<string, EffectType>>;
|
|
12
|
+
}
|
|
13
|
+
/** One step of a pipeline: what it reads and writes, and what its box shows. */
|
|
14
|
+
interface EffectStage {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
/** What sort of stage this is, for a look to read. The shipped looks know
|
|
18
|
+
* 'stage' (default), 'decision', 'source' and 'sink', and draw any other
|
|
19
|
+
* value as 'stage'. */
|
|
20
|
+
kind?: string;
|
|
21
|
+
/** Which palette entry or template made this stage. A tag for an editor to
|
|
22
|
+
* read: no shipped look draws differently for it. */
|
|
23
|
+
type?: string;
|
|
24
|
+
inputs?: readonly EffectPort[];
|
|
25
|
+
outputs?: readonly EffectPort[];
|
|
26
|
+
/** Settings worth showing, in order. */
|
|
27
|
+
params?: readonly EffectParam[];
|
|
28
|
+
/** For a decision that splits on a number: the input it compares, and the
|
|
29
|
+
* cut points in ascending order. N cuts need N + 1 outputs, the lowest
|
|
30
|
+
* band first. */
|
|
31
|
+
split?: {
|
|
32
|
+
input: string;
|
|
33
|
+
at: readonly number[];
|
|
34
|
+
};
|
|
35
|
+
/** The stage is in the pipeline and switched off. */
|
|
36
|
+
bypassed?: boolean;
|
|
37
|
+
/** Anything else a look wants. No shipped look reads it. */
|
|
38
|
+
data?: Readonly<Record<string, unknown>>;
|
|
39
|
+
}
|
|
40
|
+
/** One input or output of a stage, carrying a value of one type. */
|
|
41
|
+
interface EffectPort {
|
|
42
|
+
/** Unique among the stage's inputs and outputs together. */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Default the id. */
|
|
45
|
+
label?: string;
|
|
46
|
+
type: string;
|
|
47
|
+
}
|
|
48
|
+
/** A connection from one stage's output to another stage's input. */
|
|
49
|
+
interface EffectWire {
|
|
50
|
+
/** Carried to the drawn edge's `DataEdge.id`, so the wire can be found again. */
|
|
51
|
+
id?: string;
|
|
52
|
+
from: {
|
|
53
|
+
stage: string;
|
|
54
|
+
port: string;
|
|
55
|
+
};
|
|
56
|
+
to: {
|
|
57
|
+
stage: string;
|
|
58
|
+
port: string;
|
|
59
|
+
};
|
|
60
|
+
/** Drawn on the wire. */
|
|
61
|
+
label?: string;
|
|
62
|
+
}
|
|
63
|
+
/** A box drawn around some stages, and around other groups. */
|
|
64
|
+
interface EffectGroup {
|
|
65
|
+
id: string;
|
|
66
|
+
label?: string;
|
|
67
|
+
/** Stage ids and group ids. */
|
|
68
|
+
members: readonly string[];
|
|
69
|
+
}
|
|
70
|
+
/** One run of a pipeline: what happened, beside the pipeline rather than in
|
|
71
|
+
* it, so it can change every frame while the pipeline and its layout stay
|
|
72
|
+
* put. A stage the run has no entry for is one it never reached. */
|
|
73
|
+
interface EffectRun {
|
|
74
|
+
stages: Readonly<Record<string, EffectStageRun>>;
|
|
75
|
+
/** The stage a run taken a step at a time is on, drawn outlined. */
|
|
76
|
+
at?: string;
|
|
77
|
+
}
|
|
78
|
+
/** What one stage did in a run. */
|
|
79
|
+
interface EffectStageRun {
|
|
80
|
+
/** How long it took, in milliseconds. */
|
|
81
|
+
cost?: number;
|
|
82
|
+
/** For a decision: the output it chose. */
|
|
83
|
+
taken?: string;
|
|
84
|
+
/** What each output carried, by port id, as text to show; for a stage with
|
|
85
|
+
* no outputs, what reached each input. */
|
|
86
|
+
values?: Readonly<Record<string, string>>;
|
|
87
|
+
/** What each port `values` covers carried, by port id, as a picture, drawn in the slot a
|
|
88
|
+
* look keeps for it (`showPreviews`). A bitmap rather than a canvas
|
|
89
|
+
* because its pixels cannot change: hand back the same one and nothing is
|
|
90
|
+
* uploaded again; draw new pixels into a new one. */
|
|
91
|
+
previews?: Readonly<Record<string, ImageBitmap>>;
|
|
92
|
+
/** Why the stage failed, written where its cost goes. What it feeds is
|
|
93
|
+
* left unreached. */
|
|
94
|
+
error?: string;
|
|
95
|
+
}
|
|
96
|
+
/** What a value type means, as `EffectPipeline.types` records it. */
|
|
97
|
+
interface EffectType {
|
|
98
|
+
/** A control value: a condition, a gate, a modulation source. Looks draw
|
|
99
|
+
* its wires apart from data wires. */
|
|
100
|
+
control?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** How a param is edited, and the value it holds. */
|
|
103
|
+
type EffectParamControl = {
|
|
104
|
+
kind: 'number';
|
|
105
|
+
value: number;
|
|
106
|
+
min?: number;
|
|
107
|
+
max?: number;
|
|
108
|
+
step?: number;
|
|
109
|
+
unit?: string;
|
|
110
|
+
} | {
|
|
111
|
+
kind: 'enum';
|
|
112
|
+
value: string;
|
|
113
|
+
options: readonly {
|
|
114
|
+
value: string;
|
|
115
|
+
label?: string;
|
|
116
|
+
}[];
|
|
117
|
+
} | {
|
|
118
|
+
kind: 'boolean';
|
|
119
|
+
value: boolean;
|
|
120
|
+
} | {
|
|
121
|
+
kind: 'string';
|
|
122
|
+
value: string;
|
|
123
|
+
};
|
|
124
|
+
/** One setting a stage shows. `value` is the display string; `control`, when
|
|
125
|
+
* present, is what an editor changes and `value` is its formatted form. */
|
|
126
|
+
interface EffectParam {
|
|
127
|
+
/** Addresses the param when labels repeat; the label stands in when absent. */
|
|
128
|
+
id?: string;
|
|
129
|
+
label: string;
|
|
130
|
+
value: string;
|
|
131
|
+
control?: EffectParamControl;
|
|
132
|
+
}
|
|
133
|
+
/** Where each stage sits, by stage id, beside the pipeline rather than in it. */
|
|
134
|
+
type EffectPlaces = Readonly<Record<string, Vec2>>;
|
|
135
|
+
/** A pipeline and where its stages sit: what an editor holds and changes. */
|
|
136
|
+
interface EffectDoc {
|
|
137
|
+
pipeline: EffectPipeline;
|
|
138
|
+
places: EffectPlaces;
|
|
139
|
+
/** The pages the stages are drawn across under `nodeGraph`, beside the
|
|
140
|
+
* pipeline as `places` is. A wire between stages on different pages is
|
|
141
|
+
* drawn as two stubs with off-page tags. The other looks ignore them. */
|
|
142
|
+
pages?: readonly Page[];
|
|
143
|
+
/** The value types whose lanes the `lanes` look draws first, top down. */
|
|
144
|
+
laneOrder?: readonly string[];
|
|
145
|
+
/** The waypoints a person routed each wire through under `nodeGraph`, by
|
|
146
|
+
* wire id, beside the pipeline as `places` is. */
|
|
147
|
+
routes?: Readonly<Record<string, readonly Vec2[]>>;
|
|
148
|
+
/** The routes a person drew under `rack` and `lanes`, by look, then by wire id. */
|
|
149
|
+
lookRoutes?: LookRoutes;
|
|
150
|
+
/** Each group's box under `nodeGraph`, by group id, beside the pipeline as
|
|
151
|
+
* `places` is. A group with none fits its members. */
|
|
152
|
+
groupBoxes?: Readonly<Record<string, EffectBox>>;
|
|
153
|
+
}
|
|
154
|
+
/** A box on the page, in world units. */
|
|
155
|
+
interface EffectBox {
|
|
156
|
+
x: number;
|
|
157
|
+
y: number;
|
|
158
|
+
width: number;
|
|
159
|
+
height: number;
|
|
160
|
+
}
|
|
161
|
+
/** A wire's route under a look that places its stages itself. */
|
|
162
|
+
interface LookRoute {
|
|
163
|
+
waypoints: readonly Vec2[];
|
|
164
|
+
/** Where the wire's from and to ports were when it was routed. The route
|
|
165
|
+
* is drawn only while they are still there: a reorder or an added stage
|
|
166
|
+
* moves stages, and a route drawn for one arrangement means nothing in another. */
|
|
167
|
+
ends: readonly [Vec2, Vec2];
|
|
168
|
+
}
|
|
169
|
+
/** `EffectDoc.lookRoutes`. */
|
|
170
|
+
interface LookRoutes {
|
|
171
|
+
rack?: Readonly<Record<string, LookRoute>>;
|
|
172
|
+
lanes?: Readonly<Record<string, LookRoute>>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** A palette entry: a stage's ports and params, ready to be copied into a pipeline. */
|
|
176
|
+
interface EffectStageType {
|
|
177
|
+
type: string;
|
|
178
|
+
title: string;
|
|
179
|
+
kind?: string;
|
|
180
|
+
inputs?: readonly EffectPort[];
|
|
181
|
+
outputs?: readonly EffectPort[];
|
|
182
|
+
params?: readonly EffectParam[];
|
|
183
|
+
}
|
|
184
|
+
/** A stage of type `t` with its own copy of the ports and params; no link back. */
|
|
185
|
+
declare function stageFromType(t: EffectStageType, id: string): EffectStage;
|
|
186
|
+
/** The display string for a control's value, to as many places as its `step` has (one without a step). */
|
|
187
|
+
declare function formatParam(control: EffectParamControl): string;
|
|
188
|
+
|
|
189
|
+
export { type EffectPipeline as E, type LookRoutes as L, type EffectRun as a, type EffectStageType as b, type EffectDoc as c, type EffectWire as d, type EffectStage as e, type EffectPort as f, type EffectGroup as g, type EffectParamControl as h, type EffectBox as i, type EffectParam as j, type EffectPlaces as k, type EffectStageRun as l, type EffectType as m, type LookRoute as n, formatParam as o, stageFromType as s };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as _weasel_js_geom from '@weasel-js/geom';
|
|
2
1
|
import { Path, Vec2, PoseDescriptor } from '@weasel-js/core/math';
|
|
2
|
+
import * as _weasel_js_geom from '@weasel-js/geom';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The shapes a built body can wear, as paths in the node's bounds.
|
|
6
6
|
*
|
|
7
7
|
* These are the flowchart vocabulary — a decision is a diamond, an I/O step a
|
|
8
|
-
* parallelogram, a terminator a stadium, a demultiplexer a trapezoid, a preparation step a hexagon
|
|
9
|
-
* plus `'rect'` for everything else and
|
|
8
|
+
* parallelogram, a terminator a stadium, a demultiplexer a trapezoid, a preparation step a hexagon,
|
|
9
|
+
* a connector an ellipse — plus `'rect'` for everything else and
|
|
10
10
|
* a `Path` escape hatch for a shape the vocabulary does not have. The path is
|
|
11
11
|
* built in world coordinates from the bounds it is given, the same way the
|
|
12
12
|
* kit's own `clipFromPose` factories are; a custom `Path` is drawn in a unit
|
|
@@ -26,7 +26,7 @@ interface Bounds {
|
|
|
26
26
|
/** A named flowchart shape, or a path a consumer built themselves in a unit
|
|
27
27
|
* square — `(0, 0)` the box's top-left, `(1, 1)` its bottom-right — so it
|
|
28
28
|
* follows its node wherever layout or a drag puts it. */
|
|
29
|
-
type Outline = 'rect' | 'diamond' | 'stadium' | 'parallelogram' | 'trapezoid' | 'hexagon' | Path;
|
|
29
|
+
type Outline = 'rect' | 'diamond' | 'stadium' | 'ellipse' | 'parallelogram' | 'trapezoid' | 'hexagon' | Path;
|
|
30
30
|
/** The path `outline` describes inside `bounds`. A zero-area box gives a
|
|
31
31
|
* zero-area rect rather than a degenerate polygon. */
|
|
32
32
|
declare function outlinePath(outline: Outline, bounds: Bounds): Path;
|
|
@@ -57,6 +57,97 @@ declare function boxForContent(outline: Outline, content: {
|
|
|
57
57
|
height: number;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The label trait: where along its edge a label sits. Data only — placing the
|
|
62
|
+
* label on the route is `label`'s job, so layout can read one without
|
|
63
|
+
* reaching the scene.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/** Where along an edge a label sits. */
|
|
67
|
+
interface DiagramLabel {
|
|
68
|
+
/** `'start'`, `'mid'` and `'end'` are 0, 0.5 and 1; a number is that
|
|
69
|
+
* fraction of the route's length. `{ near }` is the point on the route
|
|
70
|
+
* nearest `near`, in world coordinates — where `layered` leaves a label
|
|
71
|
+
* room — so a bend added or removed elsewhere leaves the label on the
|
|
72
|
+
* stretch it was on. */
|
|
73
|
+
at: 'start' | 'mid' | 'end' | number | {
|
|
74
|
+
near: Vec2;
|
|
75
|
+
};
|
|
76
|
+
/** World units between the route and the label's near side, to the **left
|
|
77
|
+
* of the direction of travel** — above a left-to-right edge. Default 0,
|
|
78
|
+
* which centers the label on the line. */
|
|
79
|
+
offset?: number;
|
|
80
|
+
/** Where label placement moved it, off a station something covered:
|
|
81
|
+
* `at` a fraction of the route's length, `offset` as above. Read in place
|
|
82
|
+
* of `at` and `offset`, which stay the author's preference. Written only
|
|
83
|
+
* by placement (`installLabelPlacement`). */
|
|
84
|
+
placed?: LabelSpot;
|
|
85
|
+
/** `false` keeps placement from ever moving this label. */
|
|
86
|
+
dodge?: false;
|
|
87
|
+
}
|
|
88
|
+
/** A station placement chose: a fraction of the route's length, and the
|
|
89
|
+
* offset from the line. */
|
|
90
|
+
interface LabelSpot {
|
|
91
|
+
at: number;
|
|
92
|
+
offset: number;
|
|
93
|
+
}
|
|
94
|
+
/** Where an edge label sits when neither the edge nor the scene says. */
|
|
95
|
+
declare const LABEL_PLACEMENT: DiagramLabel;
|
|
96
|
+
/** The label trait on a node's data, or `null`. */
|
|
97
|
+
declare function diagramLabelOf(node: {
|
|
98
|
+
data: unknown;
|
|
99
|
+
}): DiagramLabel | null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The container trait: what makes a core `ContainerNode` a diagram container,
|
|
103
|
+
* a pool, or one of a pool's lanes, and where its header is.
|
|
104
|
+
*
|
|
105
|
+
* A container's title is a text child in its header, named
|
|
106
|
+
* `<container id>/title`. The layouts find it by that name, because a layout
|
|
107
|
+
* strategy sees only ids and poses.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/** Which kind of region a container is. */
|
|
111
|
+
type ContainerRole = 'container' | 'pool' | 'lane';
|
|
112
|
+
/** The strip a container's title sits in, along one side. */
|
|
113
|
+
interface ContainerHeader {
|
|
114
|
+
side: 'top' | 'left';
|
|
115
|
+
/** Its depth into the container, in world units. */
|
|
116
|
+
size: number;
|
|
117
|
+
}
|
|
118
|
+
/** The container half of a diagram node's trait, under `data.diagram.container`. */
|
|
119
|
+
interface DiagramContainer {
|
|
120
|
+
role: ContainerRole;
|
|
121
|
+
header?: ContainerHeader;
|
|
122
|
+
/** Its box is fitted to its members each time the diagram is built from data
|
|
123
|
+
* (`DataContainer` with no `box`), so a move that carries it along is no edit of its own. */
|
|
124
|
+
fitted?: true;
|
|
125
|
+
}
|
|
126
|
+
type Box = {
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
width: number;
|
|
130
|
+
height: number;
|
|
131
|
+
};
|
|
132
|
+
/** The container trait on a node's data, or `null`. */
|
|
133
|
+
declare function diagramContainerOf(node: {
|
|
134
|
+
data: unknown;
|
|
135
|
+
}): DiagramContainer | null;
|
|
136
|
+
/** The id of a container's title node. */
|
|
137
|
+
declare const titleIdOf: (containerId: string) => string;
|
|
138
|
+
/** The header strip of a container at `bounds`; null with no header. */
|
|
139
|
+
declare function headerBox(bounds: Box, header: ContainerHeader | undefined): Box | null;
|
|
140
|
+
/** What a container at `bounds` holds members in: everything past its header. */
|
|
141
|
+
declare function bodyBox(bounds: Box, header: ContainerHeader | undefined): Box;
|
|
142
|
+
|
|
143
|
+
/** A color on a shape or connector that the author can set by hand, and a theme then leaves alone.
|
|
144
|
+
* On a connector, `text` is its label's color. */
|
|
145
|
+
type StyleField = 'fill' | 'stroke' | 'text';
|
|
146
|
+
/** A part of a shape's or connector's text face the author can set by hand, which a theme then
|
|
147
|
+
* leaves alone. Kept apart from {@link StyleField}, so choosing a role, which hands back the
|
|
148
|
+
* colors, keeps it. */
|
|
149
|
+
type FontField = 'size';
|
|
150
|
+
|
|
60
151
|
/**
|
|
61
152
|
* Where a port sits on its node, in **normalized bounds coordinates**:
|
|
62
153
|
* `(0, 0)` is the top-left corner of the node's AABB and `(1, 1)` the
|
|
@@ -119,9 +210,28 @@ interface DiagramNode {
|
|
|
119
210
|
* itself is never laid out — it derives its pose from its members — but an
|
|
120
211
|
* edge can attach to it like any participant. */
|
|
121
212
|
group?: DiagramGroup;
|
|
213
|
+
/** Present on a container, a pool, or a lane: a `ContainerNode` holding
|
|
214
|
+
* members (`containers/trait.ts`). */
|
|
215
|
+
container?: DiagramContainer;
|
|
122
216
|
/** How far past its bounds something drawn with it reaches, on each side —
|
|
123
217
|
* a built body's port labels. Layout keeps neighbors that far off too. */
|
|
124
218
|
margin?: GroupInset;
|
|
219
|
+
/** The theme role it is drawn in. Unset, the theme's default role. */
|
|
220
|
+
style?: string;
|
|
221
|
+
/** The colors the author set by hand, which a theme leaves as they are. */
|
|
222
|
+
ownStyle?: readonly StyleField[];
|
|
223
|
+
/** The parts of its text face the author set by hand, which a theme leaves as they are. */
|
|
224
|
+
ownFont?: readonly FontField[];
|
|
225
|
+
/** On a built body whose rows are all text: how it stacks them, so it can be laid out again when
|
|
226
|
+
* their text changes size. Each row's text node carries its place as `bodyRow`. */
|
|
227
|
+
body?: BodyLayout;
|
|
228
|
+
}
|
|
229
|
+
/** How a built body stacks its text rows: the `BodySpec` fields its layout reads, and how many rows. */
|
|
230
|
+
interface BodyLayout {
|
|
231
|
+
padding: number;
|
|
232
|
+
gap: number;
|
|
233
|
+
verticalAlign: 'top' | 'center' | 'bottom';
|
|
234
|
+
rows: number;
|
|
125
235
|
}
|
|
126
236
|
/** The group half of a {@link DiagramNode}. */
|
|
127
237
|
interface DiagramGroup {
|
|
@@ -131,6 +241,8 @@ interface DiagramGroup {
|
|
|
131
241
|
/** The narrowest the box may be, in world units, as room for its label.
|
|
132
242
|
* A box its members leave narrower grows evenly on both sides. */
|
|
133
243
|
minWidth?: number;
|
|
244
|
+
/** The axis its members can be dragged along to change their order. */
|
|
245
|
+
reorder?: 'x' | 'y';
|
|
134
246
|
}
|
|
135
247
|
/** A port resolved against a node's current pose: where it is in world
|
|
136
248
|
* coordinates, and which way an edge leaves it. */
|
|
@@ -190,7 +302,7 @@ interface DiagramNodeEntry {
|
|
|
190
302
|
* the two apart. Without that test an edge reads as a participant declaring
|
|
191
303
|
* no ports, and collects the four defaults on the degenerate pose an edge
|
|
192
304
|
* carries. An edge label's `label` trait and an anchored node's `anchor` are
|
|
193
|
-
* excluded the same way. */
|
|
305
|
+
* excluded the same way, and so is a pool's lane, which takes no connectors. */
|
|
194
306
|
declare const dataKeyReader: DiagramNodeReader;
|
|
195
307
|
/**
|
|
196
308
|
* A reader over declared kinds. A trait on the node's own data still wins, so
|
|
@@ -257,6 +369,9 @@ interface GraphGroup {
|
|
|
257
369
|
minWidth?: number;
|
|
258
370
|
/** The group this one is directly inside. */
|
|
259
371
|
parent?: string;
|
|
372
|
+
/** Its direct members, nodes and groups, in the order a layered layout
|
|
373
|
+
* keeps them across every rank: set for a group that reorders. */
|
|
374
|
+
ordered?: readonly string[];
|
|
260
375
|
}
|
|
261
376
|
/** One connection. `id` is the edge node's own id, so a caller can go back to
|
|
262
377
|
* the scene for its trait. */
|
|
@@ -520,7 +635,7 @@ declare const DEFAULT_GROUP_INSET = 12;
|
|
|
520
635
|
* across it. A group's inset there includes that of any group nested in it
|
|
521
636
|
* that ends, or starts, at the same rank. `rows` is the nodes of each rank.
|
|
522
637
|
*/
|
|
523
|
-
declare function rankGaps(graph: Graph, rows: readonly (readonly GraphNode[])[], axes: LayoutAxes, rankGap: number): number[];
|
|
638
|
+
declare function rankGaps(graph: Pick<Graph, 'groups'>, rows: readonly (readonly Pick<GraphNode, 'id'>[])[], axes: LayoutAxes, rankGap: number): number[];
|
|
524
639
|
/**
|
|
525
640
|
* Cross positions for every node, with each group's members kept in a column
|
|
526
641
|
* of their own, and a nested group in a column inside its parent's.
|
|
@@ -783,4 +898,29 @@ declare function buildBody<TData, TLayer extends string, TPose extends Bounds>(s
|
|
|
783
898
|
specs: BodyNodeSpec<TData, TLayer, TPose>[];
|
|
784
899
|
};
|
|
785
900
|
|
|
786
|
-
|
|
901
|
+
/**
|
|
902
|
+
* Line jumps as data: the document value that turns them on, and the hops a
|
|
903
|
+
* connector carries. Plain data, so layout and any reader can use it.
|
|
904
|
+
*/
|
|
905
|
+
|
|
906
|
+
/** The document value (`scene.doc`) holding the line-jump setting: present
|
|
907
|
+
* while hops are on, absent while off. */
|
|
908
|
+
declare const HOPS_DOC_KEY = "diagram:hops";
|
|
909
|
+
/** The line-jump setting while it is on. */
|
|
910
|
+
interface HopsDocValue {
|
|
911
|
+
/** A hop's radius, in world units. */
|
|
912
|
+
size: number;
|
|
913
|
+
}
|
|
914
|
+
/** The radius a hop takes when nothing sets one. */
|
|
915
|
+
declare const DEFAULT_HOP_SIZE = 5;
|
|
916
|
+
/** Where a connector bows over others: a half circle of radius `r` centered
|
|
917
|
+
* on `at`, which lies on the connector's route. `over` names the connectors
|
|
918
|
+
* it passes over; hops closer than `2r` merge into one, which passes over all
|
|
919
|
+
* of theirs. */
|
|
920
|
+
interface EdgeHop {
|
|
921
|
+
at: Vec2;
|
|
922
|
+
over: readonly string[];
|
|
923
|
+
r: number;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
export { type PortSite as $, DEFAULT_RANK_GAP as A, type BodySpec as B, type ContainerRole as C, type DiagramGroup as D, type EdgeHop as E, type FontField as F, type Graph as G, DIAGRAM_TRAIT_KEY as H, type DiagramNodeEntry as I, type EdgeLabelRoom as J, type GraphEdge as K, type LayoutPorts as L, type MeasureRowText as M, type GraphGroup as N, type Outline as O, type PortAnchor as P, type GraphNode as Q, type RowTextStyle as R, type StyleField as S, type GroupInset as T, HOPS_DOC_KEY as U, type HopsDocValue as V, LABEL_PLACEMENT as W, type LayoutAxes as X, PORT_LABEL_GAP as Y, type PerimeterPortLabelBox as Z, type PortLabelPlacement as _, type Row as a, type RowBox as a0, type RowNodeData as a1, type RowPort as a2, type RowPortBox as a3, type Slot as a4, anchorOffset as a5, axesFor as a6, bodyBox as a7, bodyOutline as a8, bodyTrait as a9, portLabelsOf as aA, rankGaps as aB, seededOrder as aC, settle as aD, sizeToBody as aE, titleIdOf as aF, translated as aG, untilSettled as aH, extent as aI, boxForContent as aa, buildBody as ab, buildGraph as ac, canvasMeasure as ad, contentBox as ae, createDiagramNodes as af, dataKeyReader as ag, diagramContainerOf as ah, diagramLabelOf as ai, diagramNodeOf as aj, expandGroupEdges as ak, graphOrder as al, headerBox as am, insetOf as an, isPinned as ao, layoutBody as ap, layoutRowPorts as aq, marginOf as ar, measureBody as as, outlinePath as at, packAcross as au, packClusters as av, pinnedSet as aw, planOf as ax, plannerPlan as ay, portLabelBox as az, type PortSpec as b, type DiagramLabel as c, type LayoutFn as d, type LayoutOptions as e, type DiagramNode as f, type Port as g, type DiagramNodeLike as h, type DiagramNodeReader as i, type DiagramContainer as j, type ContainerHeader as k, type LabelSpot as l, type Bounds as m, type LayoutResult as n, type GraphSource as o, type LayoutPlanner as p, type LayoutDirection as q, type LayoutPlan as r, type GraphNodeLike as s, type BodyFloor as t, type BodyNodeSpec as u, type BuildBodyOptions as v, type BuildGraphOptions as w, DEFAULT_GROUP_INSET as x, DEFAULT_HOP_SIZE as y, DEFAULT_NODE_GAP as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/diagram",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Node-link diagramming for weasel: any scene node becomes a diagram participant, with ports on its perimeter and an optional body builder for flowchart-shaped boxes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,15 +21,36 @@
|
|
|
21
21
|
"import": "./dist/effect.js",
|
|
22
22
|
"types": "./dist/effect.d.ts"
|
|
23
23
|
},
|
|
24
|
+
"./effect-audio": {
|
|
25
|
+
"import": "./dist/effect-audio.js",
|
|
26
|
+
"types": "./dist/effect-audio.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./icons": {
|
|
29
|
+
"import": "./dist/icons.table.js",
|
|
30
|
+
"types": "./dist/icons.table.d.ts"
|
|
31
|
+
},
|
|
24
32
|
"./package.json": "./package.json"
|
|
25
33
|
},
|
|
26
34
|
"peerDependencies": {
|
|
27
35
|
"react": ">=18",
|
|
28
|
-
"@weasel-js/animator": "1.11.
|
|
29
|
-
"@weasel-js/
|
|
30
|
-
"@weasel-js/
|
|
31
|
-
"@weasel-js/
|
|
32
|
-
"@weasel-js/
|
|
36
|
+
"@weasel-js/animator": "1.11.1",
|
|
37
|
+
"@weasel-js/audio": "1.11.1",
|
|
38
|
+
"@weasel-js/core": "1.11.1",
|
|
39
|
+
"@weasel-js/font": "1.11.1",
|
|
40
|
+
"@weasel-js/geom": "1.11.1",
|
|
41
|
+
"@weasel-js/react": "1.11.1",
|
|
42
|
+
"@weasel-js/simulation": "1.11.1"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"@weasel-js/audio": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"weaselIcons": {
|
|
50
|
+
"table": "./dist/icons.table.json"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@weasel-js/icons": "1.11.1"
|
|
33
54
|
},
|
|
34
55
|
"author": "orochi235",
|
|
35
56
|
"homepage": "https://orochi235.github.io/weasel/",
|
|
@@ -50,7 +71,7 @@
|
|
|
50
71
|
"LICENSE"
|
|
51
72
|
],
|
|
52
73
|
"scripts": {
|
|
53
|
-
"build": "tsup"
|
|
74
|
+
"build": "tsup && cp src/icons.table.json dist/"
|
|
54
75
|
},
|
|
55
76
|
"publishConfig": {
|
|
56
77
|
"access": "public",
|