@cardenelabs/cdl 0.123.0 → 0.124.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.
- package/CHANGELOG.md +13 -1
- package/README.md +6 -1
- package/dist/index.cjs +60 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +60 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +60 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +60 -1
- package/dist/react.js.map +1 -1
- package/dist/{render-CVczwfRb.d.cts → render-U6omSNH2.d.cts} +3 -2
- package/dist/{render-CVczwfRb.d.ts → render-U6omSNH2.d.ts} +3 -2
- package/package.json +1 -1
- package/src/layout/edges.ts +103 -4
- package/src/types.ts +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as EdgeRouting, i as CdlState, j as CdlInputOption, k as CdlEventTarget, l as CdlLang, m as CdlTextMetrics, n as Computed, o as CdlDerivedValue, p as CdlScrollTrigger, L as LaidDiagram, q as CdlDiagramViewProps, r as LaidEdge, s as LaidNode, t as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey, u as TreeNodePayload } from './render-
|
|
2
|
-
export { v as CdlDiagramView, w as CdlEventBinding, x as CdlEventKind, y as CdlFormula, z as CdlPhase, A as ChartPieForm, D as ChartSlopeForm, F as EDGE_HEADS, G as EDGE_HEAD_DEFAULT, H as EDGE_HEAD_FILLS, I as EDGE_HEAD_FILL_DEFAULT, K as EDGE_REVEALS, M as EDGE_REVEAL_DEFAULT, O as EDGE_STYLES, P as EdgeReveal, U as InteractiveHandlerMap, V as InteractiveSignalsAccessor, W as LaidLane, X as NODE_KINDS, Y as RELATION_FOCUSES, Z as RELATION_FOCUS_DEFAULT, _ as RelationFocus, $ as ScrollProgressHandle, a0 as TONES, a1 as computeEventBindingKey, a2 as computeFormulaKey, a3 as computeInputSignalKey, a4 as computeScrollTriggerKey, a5 as computed, a6 as createInteractiveSignalsAccessor, a7 as createScrollProgressHandle, a8 as createScrollProgressSignals, a9 as hasInteractivePrimitives, aa as resolveLang, ab as sequenceBoardMetrics, ac as sequenceStepId, ad as signal } from './render-
|
|
1
|
+
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as EdgeRouting, i as CdlState, j as CdlInputOption, k as CdlEventTarget, l as CdlLang, m as CdlTextMetrics, n as Computed, o as CdlDerivedValue, p as CdlScrollTrigger, L as LaidDiagram, q as CdlDiagramViewProps, r as LaidEdge, s as LaidNode, t as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey, u as TreeNodePayload } from './render-U6omSNH2.cjs';
|
|
2
|
+
export { v as CdlDiagramView, w as CdlEventBinding, x as CdlEventKind, y as CdlFormula, z as CdlPhase, A as ChartPieForm, D as ChartSlopeForm, F as EDGE_HEADS, G as EDGE_HEAD_DEFAULT, H as EDGE_HEAD_FILLS, I as EDGE_HEAD_FILL_DEFAULT, K as EDGE_REVEALS, M as EDGE_REVEAL_DEFAULT, O as EDGE_STYLES, P as EdgeReveal, U as InteractiveHandlerMap, V as InteractiveSignalsAccessor, W as LaidLane, X as NODE_KINDS, Y as RELATION_FOCUSES, Z as RELATION_FOCUS_DEFAULT, _ as RelationFocus, $ as ScrollProgressHandle, a0 as TONES, a1 as computeEventBindingKey, a2 as computeFormulaKey, a3 as computeInputSignalKey, a4 as computeScrollTriggerKey, a5 as computed, a6 as createInteractiveSignalsAccessor, a7 as createScrollProgressHandle, a8 as createScrollProgressSignals, a9 as hasInteractivePrimitives, aa as resolveLang, ab as sequenceBoardMetrics, ac as sequenceStepId, ad as signal } from './render-U6omSNH2.cjs';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as EdgeRouting, i as CdlState, j as CdlInputOption, k as CdlEventTarget, l as CdlLang, m as CdlTextMetrics, n as Computed, o as CdlDerivedValue, p as CdlScrollTrigger, L as LaidDiagram, q as CdlDiagramViewProps, r as LaidEdge, s as LaidNode, t as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey, u as TreeNodePayload } from './render-
|
|
2
|
-
export { v as CdlDiagramView, w as CdlEventBinding, x as CdlEventKind, y as CdlFormula, z as CdlPhase, A as ChartPieForm, D as ChartSlopeForm, F as EDGE_HEADS, G as EDGE_HEAD_DEFAULT, H as EDGE_HEAD_FILLS, I as EDGE_HEAD_FILL_DEFAULT, K as EDGE_REVEALS, M as EDGE_REVEAL_DEFAULT, O as EDGE_STYLES, P as EdgeReveal, U as InteractiveHandlerMap, V as InteractiveSignalsAccessor, W as LaidLane, X as NODE_KINDS, Y as RELATION_FOCUSES, Z as RELATION_FOCUS_DEFAULT, _ as RelationFocus, $ as ScrollProgressHandle, a0 as TONES, a1 as computeEventBindingKey, a2 as computeFormulaKey, a3 as computeInputSignalKey, a4 as computeScrollTriggerKey, a5 as computed, a6 as createInteractiveSignalsAccessor, a7 as createScrollProgressHandle, a8 as createScrollProgressSignals, a9 as hasInteractivePrimitives, aa as resolveLang, ab as sequenceBoardMetrics, ac as sequenceStepId, ad as signal } from './render-
|
|
1
|
+
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as EdgeRouting, i as CdlState, j as CdlInputOption, k as CdlEventTarget, l as CdlLang, m as CdlTextMetrics, n as Computed, o as CdlDerivedValue, p as CdlScrollTrigger, L as LaidDiagram, q as CdlDiagramViewProps, r as LaidEdge, s as LaidNode, t as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey, u as TreeNodePayload } from './render-U6omSNH2.js';
|
|
2
|
+
export { v as CdlDiagramView, w as CdlEventBinding, x as CdlEventKind, y as CdlFormula, z as CdlPhase, A as ChartPieForm, D as ChartSlopeForm, F as EDGE_HEADS, G as EDGE_HEAD_DEFAULT, H as EDGE_HEAD_FILLS, I as EDGE_HEAD_FILL_DEFAULT, K as EDGE_REVEALS, M as EDGE_REVEAL_DEFAULT, O as EDGE_STYLES, P as EdgeReveal, U as InteractiveHandlerMap, V as InteractiveSignalsAccessor, W as LaidLane, X as NODE_KINDS, Y as RELATION_FOCUSES, Z as RELATION_FOCUS_DEFAULT, _ as RelationFocus, $ as ScrollProgressHandle, a0 as TONES, a1 as computeEventBindingKey, a2 as computeFormulaKey, a3 as computeInputSignalKey, a4 as computeScrollTriggerKey, a5 as computed, a6 as createInteractiveSignalsAccessor, a7 as createScrollProgressHandle, a8 as createScrollProgressSignals, a9 as hasInteractivePrimitives, aa as resolveLang, ab as sequenceBoardMetrics, ac as sequenceStepId, ad as signal } from './render-U6omSNH2.js';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
package/dist/index.js
CHANGED
|
@@ -20512,6 +20512,55 @@ function bowSharedStraightPaths(edges, nodes, skipIds, textMetrics = "proportion
|
|
|
20512
20512
|
function nodeRect(n) {
|
|
20513
20513
|
return { x: n.cx - n.w / 2, y: n.cy - n.h / 2, w: n.w, h: n.h };
|
|
20514
20514
|
}
|
|
20515
|
+
function countPathObstacleCrossings(d, obstacles) {
|
|
20516
|
+
const segments = flattenPathSegments(extractPathSegments(d));
|
|
20517
|
+
return obstacles.filter((obstacle) => segmentsCrossRect(segments, nodeRect(obstacle))).length;
|
|
20518
|
+
}
|
|
20519
|
+
function makeBackDetourCandidate(A, B, from, to, obstacles, detourY, side) {
|
|
20520
|
+
const lowIsA = A.y >= B.y;
|
|
20521
|
+
const low = lowIsA ? A : B;
|
|
20522
|
+
const lowBendY = low.y - VERTICAL_DETOUR_EXIT;
|
|
20523
|
+
const bandTop = Math.min(detourY, lowBendY);
|
|
20524
|
+
const bandBottom = Math.max(detourY, lowBendY);
|
|
20525
|
+
const bandObstacles = obstacles.map(nodeRect).filter((rect) => rect.y + rect.h >= bandTop && rect.y <= bandBottom);
|
|
20526
|
+
let columnX = detourColumnFor([from, to], side);
|
|
20527
|
+
while (true) {
|
|
20528
|
+
const blockers = bandObstacles.filter(
|
|
20529
|
+
(rect) => rect.x - VERTICAL_DETOUR_GAP < columnX && columnX < rect.x + rect.w + VERTICAL_DETOUR_GAP
|
|
20530
|
+
);
|
|
20531
|
+
if (blockers.length === 0) break;
|
|
20532
|
+
columnX = side === "left" ? Math.min(...blockers.map((rect) => rect.x - VERTICAL_DETOUR_GAP)) : Math.max(...blockers.map((rect) => rect.x + rect.w + VERTICAL_DETOUR_GAP));
|
|
20533
|
+
}
|
|
20534
|
+
const bendAY = lowIsA ? lowBendY : detourY;
|
|
20535
|
+
const bendBY = lowIsA ? detourY : lowBendY;
|
|
20536
|
+
const vertices = [
|
|
20537
|
+
A,
|
|
20538
|
+
{ x: A.x, y: bendAY },
|
|
20539
|
+
{ x: columnX, y: bendAY },
|
|
20540
|
+
{ x: columnX, y: bendBY },
|
|
20541
|
+
{ x: B.x, y: bendBY },
|
|
20542
|
+
B
|
|
20543
|
+
];
|
|
20544
|
+
const d = verticesToPath(vertices);
|
|
20545
|
+
const high = lowIsA ? B : A;
|
|
20546
|
+
return {
|
|
20547
|
+
d,
|
|
20548
|
+
labelX: (high.x + columnX) / 2,
|
|
20549
|
+
crossings: countPathObstacleCrossings(d, obstacles),
|
|
20550
|
+
length: vertices.slice(1).reduce((sum, vertex, index) => {
|
|
20551
|
+
const previous = vertices[index];
|
|
20552
|
+
return sum + Math.hypot(vertex.x - previous.x, vertex.y - previous.y);
|
|
20553
|
+
}, 0)
|
|
20554
|
+
};
|
|
20555
|
+
}
|
|
20556
|
+
function chooseBackDetourCandidate(A, B, from, to, obstacles, detourY) {
|
|
20557
|
+
const left = makeBackDetourCandidate(A, B, from, to, obstacles, detourY, "left");
|
|
20558
|
+
const right = makeBackDetourCandidate(A, B, from, to, obstacles, detourY, "right");
|
|
20559
|
+
if (left.crossings !== right.crossings) return left.crossings < right.crossings ? left : right;
|
|
20560
|
+
if (Math.abs(left.length - right.length) >= 0.5) return left.length < right.length ? left : right;
|
|
20561
|
+
const preferred = Math.abs(A.x - B.x) < 0.5 ? "right" : A.x < B.x ? "left" : "right";
|
|
20562
|
+
return preferred === "left" ? left : right;
|
|
20563
|
+
}
|
|
20515
20564
|
function rectGap(a, b) {
|
|
20516
20565
|
const dx = Math.max(0, a.x - (b.x + b.w), b.x - (a.x + a.w));
|
|
20517
20566
|
const dy = Math.max(0, a.y - (b.y + b.h), b.y - (a.y + a.h));
|
|
@@ -20962,7 +21011,7 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
|
|
|
20962
21011
|
const detourY = Math.min(A.y, B.y) - 100;
|
|
20963
21012
|
const corner = 14;
|
|
20964
21013
|
const xDir = B.x > A.x ? 1 : -1;
|
|
20965
|
-
|
|
21014
|
+
const existing = {
|
|
20966
21015
|
d: `M ${A.x} ${A.y}
|
|
20967
21016
|
L ${A.x} ${detourY + corner}
|
|
20968
21017
|
Q ${A.x} ${detourY}, ${A.x + xDir * corner} ${detourY}
|
|
@@ -20976,6 +21025,16 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
|
|
|
20976
21025
|
labelY: detourY - labelInit,
|
|
20977
21026
|
labelAnchor: "middle"
|
|
20978
21027
|
};
|
|
21028
|
+
const existingCrossings = countPathObstacleCrossings(existing.d, obstacles);
|
|
21029
|
+
if (existingCrossings === 0) return existing;
|
|
21030
|
+
const candidate = chooseBackDetourCandidate(A, B, from, to, obstacles, detourY);
|
|
21031
|
+
if (candidate.crossings >= existingCrossings) return existing;
|
|
21032
|
+
return {
|
|
21033
|
+
d: candidate.d,
|
|
21034
|
+
labelX: candidate.labelX,
|
|
21035
|
+
labelY: detourY - labelInit,
|
|
21036
|
+
labelAnchor: "middle"
|
|
21037
|
+
};
|
|
20979
21038
|
}
|
|
20980
21039
|
const midX = fromSide === "left" || fromSide === "right" ? B.x : A.x;
|
|
20981
21040
|
const midY = fromSide === "top" || fromSide === "bottom" ? B.y : A.y;
|