@weasel-js/diagram 1.15.2 → 1.16.0

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.
@@ -1,6 +1,6 @@
1
- import { DerivedDep, PoseDescriptor, NodeShapeEntry, MarkerRef, Page, PageLayoutOptions, PoseComposition, RectPose, AddNodeSpec, Stroke } from '@weasel-js/core';
1
+ import { DerivedDep, PoseDescriptor, NodeShapeEntry, MarkerRef, StrokeTrim, Page, PageLayoutOptions, PoseComposition, RectPose, AddNodeSpec, Stroke } from '@weasel-js/core';
2
2
  import { Vec2 } from '@weasel-js/core/math';
3
- import { E as EdgeHop, S as StyleField, P as PortAnchor, D as DiagramGroup, R as RowTextStyle, a as Row, O as Outline, b as PortSpec, B as BodySpec, L as LayoutPorts, c as LayoutFn, d as LayoutOptions, M as MeasureRowText, e as DiagramNode } from './types-D5ybp8Xh.js';
3
+ import { E as EdgeHop, S as StyleField, P as PortAnchor, D as DiagramGroup, R as Row, a as RowTextStyle, O as Outline, b as PortSpec, B as BodySpec, L as LayoutPorts, c as LayoutFn, d as LayoutOptions, M as MeasureRowText, e as DiagramNode } from './types-DtWfIUIv.js';
4
4
  import { D as DiagramLabel } from './labelTrait-moIciyXr.js';
5
5
 
6
6
  /**
@@ -158,6 +158,21 @@ declare const GROUP_DERIVE_POSE: DiagramDerivePose<unknown>;
158
158
  /** The default anchor derivation, a stable reference for the same reason. */
159
159
  declare const ANCHOR_DERIVE_POSE: DiagramDerivePose<unknown>;
160
160
 
161
+ /** The face a diagram node's text is set in. */
162
+ type DiagramTextStyle = {
163
+ fontFamily: string;
164
+ fontSize: number;
165
+ fontWeight?: number;
166
+ fontStyle?: 'italic';
167
+ align?: 'center';
168
+ };
169
+ type Font = {
170
+ fontFamily: string;
171
+ fontSize: number;
172
+ };
173
+ /** The face a body row's text is set in. A label row's is centered in the row. */
174
+ declare function rowTextStyle(row: Row | undefined, font: Font): DiagramTextStyle;
175
+
161
176
  /**
162
177
  * Marks: what a data node draws besides its rows. A drawn mark is SVG path
163
178
  * data in a unit square, stretched over the node's box, so it follows the node
@@ -198,21 +213,6 @@ declare function registerMarkShape<TPose>(opts?: {
198
213
  geometry?: PoseDescriptor<TPose>;
199
214
  }): () => void;
200
215
 
201
- /** The face a diagram node's text is set in. */
202
- type DiagramTextStyle = {
203
- fontFamily: string;
204
- fontSize: number;
205
- fontWeight?: number;
206
- fontStyle?: 'italic';
207
- align?: 'center';
208
- };
209
- type Font = {
210
- fontFamily: string;
211
- fontSize: number;
212
- };
213
- /** The face a body row's text is set in. A label row's is centered in the row. */
214
- declare function rowTextStyle(row: Row | undefined, font: Font): DiagramTextStyle;
215
-
216
216
  /** The roles every shipped theme styles, with the name a picker shows. */
217
217
  declare const DIAGRAM_ROLES: readonly [{
218
218
  readonly id: "default";
@@ -355,8 +355,9 @@ interface DataEdge {
355
355
  routedPorts?: LayoutPorts;
356
356
  /** The theme role it is drawn in, under `DiagramSceneOptions.theme`: that role's stroke. Kept on its trait. */
357
357
  style?: string;
358
- /** Its stroke, markers, and label color of its own, over the theme's. `stroke` and `label` are
359
- * listed in the trait's `ownStyle` (as `stroke` and `text`), so a theme change leaves them. */
358
+ /** Its own {@link EdgeStyle} fields over the theme's: stroke color and width, dash, trim, markers
359
+ * and label color. `stroke` and `label` are listed in the trait's `ownStyle` (as `stroke` and
360
+ * `text`), so a theme change leaves them; a theme change writes none of the rest. */
360
361
  colors?: Partial<EdgeStyle>;
361
362
  }
362
363
  /** A box drawn around some nodes, which layout keeps together. */
@@ -472,7 +473,7 @@ declare const NODE_STROKE_WIDTH = 2;
472
473
  declare const LANE_STROKE_WIDTH = 1;
473
474
  /** An edge's stroke width when its style gives none. */
474
475
  declare const EDGE_STROKE_WIDTH = 1.5;
475
- /** The stroke, markers, and label color an edge is drawn with. */
476
+ /** How an edge is drawn: its stroke's color, width, dash and trim, its markers, and its label color. */
476
477
  interface EdgeStyle {
477
478
  stroke: string;
478
479
  width?: number;
@@ -483,6 +484,9 @@ interface EdgeStyle {
483
484
  markerEnd?: MarkerRef | null;
484
485
  /** Default `stroke`. */
485
486
  label?: string;
487
+ /** The stretch of the route drawn, in pen order from the `from` end; the heads ride its ends.
488
+ * Default the whole route. */
489
+ trim?: StrokeTrim;
486
490
  }
487
491
  /** How an edge is drawn between its ends. */
488
492
  type DiagramRouter = 'straight' | 'bezier' | 'orthogonal' | 'avoid';
@@ -1,6 +1,6 @@
1
- import { formatParam, uniqueStages, runOrder, paramValues, PREVIEW_DENSITY, closeBitmaps, previewsOf, PREVIEW_SIZE } from './chunk-LPTNAYER.js';
2
- import './chunk-QGL6QJE4.js';
3
- import './chunk-7BV2MBED.js';
1
+ import { formatParam, uniqueStages, runOrder, paramValues, PREVIEW_DENSITY, closeBitmaps, previewsOf, PREVIEW_SIZE } from './chunk-4TQIAU5P.js';
2
+ import './chunk-3MAKSWI2.js';
3
+ import './chunk-6EPWNUHC.js';
4
4
  import { createMixNode, createFileSourceNode, compressorNode, reverbNode, delayNode, filterNode, createPanNode, createGainNode, createNoiseNode, createOscillatorNode } from '@weasel-js/audio';
5
5
  import { createEmitter } from '@weasel-js/registry';
6
6
  import { useEffect, useSyncExternalStore, useMemo, useState } from 'react';
package/dist/effect.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { c as EffectDoc, E as EffectPipeline, d as EffectWire, e as EffectStage, f as EffectPort, g as EffectGroup, a as EffectRun, b as EffectStageType, L as LookRoutes, h as EffectParamControl, i as EffectBox } from './stageTypes-B7oF8Lww.js';
2
2
  export { j as EffectParam, k as EffectPlaces, l as EffectStageRun, m as EffectType, n as LookRoute, o as formatParam, s as stageFromType } from './stageTypes-B7oF8Lww.js';
3
- import { D as DiagramTheme, a as DiagramData, b as DiagramSceneOptions, N as NodeStyle, c as DataEdge, E as EdgeStyle, d as DataNode, e as DiagramRouter, f as DiagramSpec } from './dataTypes-1ch6cMtq.js';
4
- import { a as Row, M as MeasureRowText } from './types-D5ybp8Xh.js';
3
+ import { D as DiagramTheme, a as DiagramData, b as DiagramSceneOptions, N as NodeStyle, c as DataEdge, E as EdgeStyle, d as DataNode, e as DiagramRouter, f as DiagramSpec } from './dataTypes-knb9fWOe.js';
4
+ import { R as Row, M as MeasureRowText } from './types-DtWfIUIv.js';
5
5
  import * as react from 'react';
6
6
  import { Paint } from '@weasel-js/core';
7
7
  import { Vec2 } from '@weasel-js/core/math';
package/dist/effect.js CHANGED
@@ -1,9 +1,9 @@
1
- import { DiagramView, reorderContribution, ANYWHERE, isBodyEnd, sequenceSlots } from './chunk-6YQSQXQT.js';
2
- import './chunk-FQVZWS24.js';
3
- import { stageFromType, LOOK_THEME, drawableWires, uniqueStages, shownPorts, valueRowId, NO_VALUE, previewRowId, formatParam, stageStyle, PROBLEM_COLOR, typeColors, kindOf, boxNode, portOn, wireStyle, isControl, wireEdge, sceneStyles, uniqueGroups, wireEdges, exitLabel, splitProblem, checkPipeline, PREVIEW_DENSITY, runOrder, PREVIEW_SIZE, closeBitmaps, previewsOf, paramValues } from './chunk-LPTNAYER.js';
4
- export { LOOK_THEME, NO_VALUE, PREVIEW_SIZE, PROBLEM_COLOR, checkPipeline, drawableWires, exitLabel, formatParam, isControl, kindOf, portOn, previewRowId, runOrder, shownPorts, stageFromType, stageRows, stageStyle, typeColors, uniqueGroups, uniqueStages, valueRowId, wireEdges, wireStyle } from './chunk-LPTNAYER.js';
5
- import { diagramScene, diagramPages, edgeIdOf, titleIdOf, groupLabelIdOf, nestGroups, groupMinWidth, LABEL_PLACEMENT, EDGE_DERIVE_PATH } from './chunk-QGL6QJE4.js';
6
- import { portOf, insetOf, diagramNodeOf, DEFAULT_GROUP_INSET, SIDE_TRACK_GAP, widenForMinWidth, rankGaps, portSitesOf, labelCenter, resolveOutline } from './chunk-7BV2MBED.js';
1
+ import { DiagramView, reorderContribution, ANYWHERE, isBodyEnd, sequenceSlots } from './chunk-6EZFP3SG.js';
2
+ import './chunk-6S5QNNPB.js';
3
+ import { stageFromType, LOOK_THEME, drawableWires, uniqueStages, shownPorts, valueRowId, NO_VALUE, previewRowId, formatParam, stageStyle, PROBLEM_COLOR, typeColors, kindOf, boxNode, portOn, wireStyle, isControl, wireEdge, sceneStyles, uniqueGroups, wireEdges, exitLabel, splitProblem, checkPipeline, PREVIEW_DENSITY, runOrder, PREVIEW_SIZE, closeBitmaps, previewsOf, paramValues } from './chunk-4TQIAU5P.js';
4
+ export { LOOK_THEME, NO_VALUE, PREVIEW_SIZE, PROBLEM_COLOR, checkPipeline, drawableWires, exitLabel, formatParam, isControl, kindOf, portOn, previewRowId, runOrder, shownPorts, stageFromType, stageRows, stageStyle, typeColors, uniqueGroups, uniqueStages, valueRowId, wireEdges, wireStyle } from './chunk-4TQIAU5P.js';
5
+ import { diagramScene, diagramPages, edgeIdOf, titleIdOf, groupLabelIdOf, nestGroups, groupMinWidth, LABEL_PLACEMENT, EDGE_DERIVE_PATH } from './chunk-3MAKSWI2.js';
6
+ import { portOf, insetOf, diagramNodeOf, DEFAULT_GROUP_INSET, SIDE_TRACK_GAP, widenForMinWidth, rankGaps, portSitesOf, labelCenter, resolveOutline } from './chunk-6EPWNUHC.js';
7
7
  import { moveItems, imeKey, isNoopDrop } from '@weasel-js/ui-logic';
8
8
  import { useLatest, bitmapSrc, ActionDisabledReason, worldPosesOf, RIGID_POSE_COMPOSITION, IDENTITY_POSE_COMPOSITION, pointAlongPath } from '@weasel-js/core';
9
9
  import { polygonFromPoints } from '@weasel-js/core/math';