@multiplatform.one/node-graph 7.88.4 → 7.88.6
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/cjs/edges/GraphEdge.cjs +27 -2
- package/dist/cjs/edges/GraphEdge.native.js +29 -5
- package/dist/cjs/edges/GraphEdge.native.js.map +1 -1
- package/dist/cjs/edges/edgeStyle.cjs +32 -7
- package/dist/cjs/edges/edgeStyle.native.js +34 -6
- package/dist/cjs/edges/edgeStyle.native.js.map +1 -1
- package/dist/cjs/nodes/GraphNode.cjs +15 -5
- package/dist/cjs/nodes/GraphNode.native.js +15 -5
- package/dist/cjs/nodes/GraphNode.native.js.map +1 -1
- package/dist/cjs/react-flow/flowAdapter.cjs +0 -5
- package/dist/cjs/react-flow/flowAdapter.native.js +0 -5
- package/dist/cjs/react-flow/flowAdapter.native.js.map +1 -1
- package/dist/esm/edges/GraphEdge.mjs +29 -4
- package/dist/esm/edges/GraphEdge.mjs.map +1 -1
- package/dist/esm/edges/GraphEdge.native.js +31 -7
- package/dist/esm/edges/GraphEdge.native.js.map +1 -1
- package/dist/esm/edges/edgeStyle.mjs +30 -8
- package/dist/esm/edges/edgeStyle.mjs.map +1 -1
- package/dist/esm/edges/edgeStyle.native.js +32 -7
- package/dist/esm/edges/edgeStyle.native.js.map +1 -1
- package/dist/esm/nodes/GraphNode.mjs +17 -7
- package/dist/esm/nodes/GraphNode.mjs.map +1 -1
- package/dist/esm/nodes/GraphNode.native.js +17 -7
- package/dist/esm/nodes/GraphNode.native.js.map +1 -1
- package/dist/esm/react-flow/flowAdapter.mjs +0 -5
- package/dist/esm/react-flow/flowAdapter.mjs.map +1 -1
- package/dist/esm/react-flow/flowAdapter.native.js +0 -5
- package/dist/esm/react-flow/flowAdapter.native.js.map +1 -1
- package/dist/jsx/edges/GraphEdge.mjs +29 -4
- package/dist/jsx/edges/GraphEdge.mjs.map +1 -1
- package/dist/jsx/edges/GraphEdge.native.js +29 -5
- package/dist/jsx/edges/GraphEdge.native.js.map +1 -1
- package/dist/jsx/edges/edgeStyle.mjs +30 -8
- package/dist/jsx/edges/edgeStyle.mjs.map +1 -1
- package/dist/jsx/edges/edgeStyle.native.js +34 -6
- package/dist/jsx/edges/edgeStyle.native.js.map +1 -1
- package/dist/jsx/nodes/GraphNode.mjs +17 -7
- package/dist/jsx/nodes/GraphNode.mjs.map +1 -1
- package/dist/jsx/nodes/GraphNode.native.js +15 -5
- package/dist/jsx/nodes/GraphNode.native.js.map +1 -1
- package/dist/jsx/react-flow/flowAdapter.mjs +0 -5
- package/dist/jsx/react-flow/flowAdapter.mjs.map +1 -1
- package/dist/jsx/react-flow/flowAdapter.native.js +0 -5
- package/dist/jsx/react-flow/flowAdapter.native.js.map +1 -1
- package/package.json +7 -7
- package/src/edges/GraphEdge.tsx +37 -6
- package/src/edges/edgeStyle.spec.ts +73 -13
- package/src/edges/edgeStyle.ts +68 -15
- package/src/nodes/GraphNode.tsx +27 -15
- package/src/nodes/arrowheadPlacement.spec.tsx +109 -0
- package/src/react-flow/flowAdapter.ts +4 -7
- package/src/react-flow/useGraphController.spec.tsx +6 -6
- package/types/edges/GraphEdge.d.ts.map +1 -1
- package/types/edges/edgeStyle.d.ts +41 -9
- package/types/edges/edgeStyle.d.ts.map +1 -1
- package/types/nodes/GraphNode.d.ts.map +1 -1
- package/types/react-flow/flowAdapter.d.ts +4 -5
- package/types/react-flow/flowAdapter.d.ts.map +1 -1
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* table can be asserted without mounting anything, which is what makes
|
|
6
6
|
* `edgeStyle.spec.ts` a cheap test rather than a render.
|
|
7
7
|
*
|
|
8
|
-
* Stroke width
|
|
9
|
-
*
|
|
8
|
+
* Stroke width comes from the `borderWidth` knob, so one flip moves every edge
|
|
9
|
+
* on the canvas. The kind picks only a WEIGHT on top of it: control edges
|
|
10
|
+
* (flow, error) stroke `controlEdgeWeight` times the value edges (data,
|
|
11
|
+
* conditional), because a one-step shade apart the two read as one line
|
|
12
|
+
* (FZ-9012). Task 1.7's
|
|
10
13
|
* `theme/graphVars.ts` reads `edgeStrokeWidth` from here rather than repeating
|
|
11
14
|
* the ladder — §11's borderWidth row cites that file, and one ladder in two
|
|
12
15
|
* places is one ladder that can drift.
|
|
@@ -15,6 +18,7 @@ import type { Animation, BorderWidth } from "@multiplatform.one/theme";
|
|
|
15
18
|
import type { BuiltinEdgeKind } from "./edgeKinds";
|
|
16
19
|
export type EdgePathKind = "bezier" | "smoothstep" | "step" | "straight";
|
|
17
20
|
export type EdgeMarker = "arrow" | "arrowclosed";
|
|
21
|
+
export type EdgeWeight = "control" | "value";
|
|
18
22
|
export interface EdgeAppearance {
|
|
19
23
|
readonly path: EdgePathKind;
|
|
20
24
|
/** A token expression. A hex literal here fails `edgeStyle.spec.ts`. */
|
|
@@ -22,9 +26,16 @@ export interface EdgeAppearance {
|
|
|
22
26
|
/** SVG `stroke-dasharray`. Absent means a solid line. */
|
|
23
27
|
readonly dash?: string;
|
|
24
28
|
readonly marker: EdgeMarker;
|
|
29
|
+
readonly weight: EdgeWeight;
|
|
25
30
|
}
|
|
26
31
|
/** Design §4.4's table, verbatim. */
|
|
27
32
|
export declare const edgeAppearances: Readonly<Record<BuiltinEdgeKind, EdgeAppearance>>;
|
|
33
|
+
/**
|
|
34
|
+
* How much heavier a control edge strokes than a value edge, at every
|
|
35
|
+
* `borderWidth` stop. A ratio rather than a second ladder, so the knob still
|
|
36
|
+
* moves both together and the gap between them never closes.
|
|
37
|
+
*/
|
|
38
|
+
export declare const controlEdgeWeight = 1.5;
|
|
28
39
|
/**
|
|
29
40
|
* §11: an edge is a stroke, not a border, and a 0-width edge erases the graph's
|
|
30
41
|
* primary information. The theme's own border widths are 0 / hairline / 1 / 2
|
|
@@ -35,17 +46,17 @@ export declare const edgeAppearances: Readonly<Record<BuiltinEdgeKind, EdgeAppea
|
|
|
35
46
|
* not a divider.
|
|
36
47
|
*/
|
|
37
48
|
export declare const edgeStrokeWidths: Readonly<Record<BorderWidth, number>>;
|
|
38
|
-
export declare function edgeStrokeWidth(borderWidth: BorderWidth): number;
|
|
49
|
+
export declare function edgeStrokeWidth(borderWidth: BorderWidth, weight?: EdgeWeight): number;
|
|
39
50
|
/** The keyframes live in `css/graph.css`, which lands with task 1.7. */
|
|
40
51
|
export declare const dashAnimation = "mp-graph-dash 0.5s linear infinite";
|
|
41
52
|
/**
|
|
42
|
-
* The marker
|
|
53
|
+
* The marker TYPE for an edge object, for a consumer that builds React Flow
|
|
54
|
+
* edges and lets React Flow draw the head.
|
|
43
55
|
*
|
|
44
|
-
* React Flow
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* controller in task 1.11, or a story — reads the marker from here.
|
|
56
|
+
* The house canvas does not: React Flow paints its own `<marker>` defs in
|
|
57
|
+
* `defaultMarkerColor`, a grey that matches no edge kind, so `GraphEdge` draws
|
|
58
|
+
* the head itself from `resolveEdgeStyle(...).marker` in the edge's own stroke
|
|
59
|
+
* (`edgeArrowhead` below), and `flowAdapter` leaves `markerEnd` unset.
|
|
49
60
|
*/
|
|
50
61
|
export declare function edgeMarkerEnd(input: {
|
|
51
62
|
readonly kind: string;
|
|
@@ -53,6 +64,27 @@ export declare function edgeMarkerEnd(input: {
|
|
|
53
64
|
}): {
|
|
54
65
|
readonly type: EdgeMarker;
|
|
55
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* The arrowhead `GraphEdge` draws, in marker units. `markerUnits` is
|
|
69
|
+
* `strokeWidth`, so the head scales with the edge and a control edge's head is
|
|
70
|
+
* heavier with its line.
|
|
71
|
+
*
|
|
72
|
+
* The tip is the marker's origin (`refX` / `refY` 0) and every point runs back
|
|
73
|
+
* from it, so the head ends exactly where the path ends: React Flow ends a path
|
|
74
|
+
* at the handle box's outer edge, which is the outside of the port's ring.
|
|
75
|
+
*/
|
|
76
|
+
export declare const edgeArrowhead: {
|
|
77
|
+
readonly viewBox: "-10 -10 20 20";
|
|
78
|
+
readonly size: 12.5;
|
|
79
|
+
readonly refX: 0;
|
|
80
|
+
readonly refY: 0;
|
|
81
|
+
readonly points: {
|
|
82
|
+
readonly arrow: "-5,-4 0,0 -5,4";
|
|
83
|
+
readonly arrowclosed: "-5,-4 0,0 -5,4 -5,-4";
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/** How far the head reaches back from the tip, in px, for a stroke width. */
|
|
87
|
+
export declare function edgeArrowheadLength(strokeWidth: number): number;
|
|
56
88
|
export interface EdgeStyleInput {
|
|
57
89
|
/** `edge.kind` from the model, not React Flow's `edge.type`. */
|
|
58
90
|
readonly kind: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edgeStyle.d.ts","sourceRoot":"","sources":["../../src/edges/edgeStyle.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"edgeStyle.d.ts","sourceRoot":"","sources":["../../src/edges/edgeStyle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,aAAa,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,qCAAq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M,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAgBjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphNode.d.ts","sourceRoot":"","sources":["../../src/nodes/GraphNode.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphNode.d.ts","sourceRoot":"","sources":["../../src/nodes/GraphNode.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAK1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC;IACtC,0EAA0E;IAC1E,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,SAAS,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAmBD,wBAAgB,SAAS,CAAC,EACxB,EAAE,EACF,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,QAAgB,EAChB,OAAO,EACP,UAAqB,EACrB,aAAqB,EACrB,UAAU,EACV,QAAQ,GACT,EAAE,cAAc,2CAgKhB"}
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
* Document → React Flow arrays. Pure, so the mapping can be asserted without
|
|
3
3
|
* mounting anything.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* One thing happens here that cannot happen later:
|
|
6
6
|
*
|
|
7
7
|
* - **Size seeding (design §5).** Every node carries `width` / `height` from
|
|
8
8
|
* `graphNodeMeasure` BEFORE first paint, so React Flow's per-node
|
|
9
9
|
* `ResizeObserver` CORRECTS a measurement rather than discovering one. On a
|
|
10
10
|
* 200-node knob flip that is the difference between 200 observer callbacks
|
|
11
11
|
* resizing the world and 200 confirming it.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* painted and the lines did not.
|
|
12
|
+
*
|
|
13
|
+
* The edge carries no `markerEnd`. React Flow would paint that head in its own
|
|
14
|
+
* grey; `GraphEdge` draws it in the edge's stroke instead (FZ-9012).
|
|
16
15
|
*/
|
|
17
16
|
import type { EdgeKindDefs, GraphDocument, GraphSchema, NodeKindDefs, PortSpec } from "../model/index";
|
|
18
17
|
import type { GraphNodeSizeKnob } from "../nodes/nodeMeasure";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowAdapter.d.ts","sourceRoot":"","sources":["../../src/react-flow/flowAdapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"flowAdapter.d.ts","sourceRoot":"","sources":["../../src/react-flow/flowAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EAGb,WAAW,EACX,YAAY,EACZ,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,YAAY,EACxE,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC7B,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,OAAO,EAAE,kBAAkB,GAC1B,IAAI,CAAC,iBAAiB,CAAC,EAAE,CA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