@cardenelabs/cdl 0.63.0 → 0.64.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/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 CdlState, i as CdlInputOption, j as CdlEventTarget, k as CdlLang, l as Computed, m as CdlDerivedValue, n as CdlScrollTrigger, L as LaidDiagram, o as CdlDiagramViewProps, p as LaidEdge, q as LaidNode, r as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-Dk8_6ua6.cjs';
2
- export { s as CdlDiagramView, t as CdlEventBinding, u as CdlEventKind, v as CdlFormula, w as CdlPhase, x as ChartPieForm, y as ChartSlopeForm, z as EDGE_HEADS, A as EDGE_HEAD_DEFAULT, D as EDGE_HEAD_FILLS, F as EDGE_HEAD_FILL_DEFAULT, G as EDGE_REVEALS, H as EDGE_REVEAL_DEFAULT, I as EDGE_STYLES, K as EdgeReveal, M as InteractiveHandlerMap, O as InteractiveSignalsAccessor, P as LaidLane, U as NODE_KINDS, V as RELATION_FOCUSES, W as RELATION_FOCUS_DEFAULT, X as RelationFocus, Y as ScrollProgressHandle, Z as TONES, _ as computeEventBindingKey, $ as computeFormulaKey, a0 as computeInputSignalKey, a1 as computeScrollTriggerKey, a2 as computed, a3 as createInteractiveSignalsAccessor, a4 as createScrollProgressHandle, a5 as createScrollProgressSignals, a6 as hasInteractivePrimitives, a7 as resolveLang, a8 as sequenceBoardMetrics, a9 as sequenceStepId, aa as signal } from './render-Dk8_6ua6.cjs';
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 CdlState, i as CdlInputOption, j as CdlEventTarget, k as CdlLang, l as Computed, m as CdlDerivedValue, n as CdlScrollTrigger, L as LaidDiagram, o as CdlDiagramViewProps, p as LaidEdge, q as LaidNode, r as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-DfXCs3Eh.cjs';
2
+ export { s as CdlDiagramView, t as CdlEventBinding, u as CdlEventKind, v as CdlFormula, w as CdlPhase, x as ChartPieForm, y as ChartSlopeForm, z as EDGE_HEADS, A as EDGE_HEAD_DEFAULT, D as EDGE_HEAD_FILLS, F as EDGE_HEAD_FILL_DEFAULT, G as EDGE_REVEALS, H as EDGE_REVEAL_DEFAULT, I as EDGE_STYLES, K as EdgeReveal, M as InteractiveHandlerMap, O as InteractiveSignalsAccessor, P as LaidLane, U as NODE_KINDS, V as RELATION_FOCUSES, W as RELATION_FOCUS_DEFAULT, X as RelationFocus, Y as ScrollProgressHandle, Z as TONES, _ as computeEventBindingKey, $ as computeFormulaKey, a0 as computeInputSignalKey, a1 as computeScrollTriggerKey, a2 as computed, a3 as createInteractiveSignalsAccessor, a4 as createScrollProgressHandle, a5 as createScrollProgressSignals, a6 as hasInteractivePrimitives, a7 as resolveLang, a8 as sequenceBoardMetrics, a9 as sequenceStepId, aa as signal } from './render-DfXCs3Eh.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 CdlState, i as CdlInputOption, j as CdlEventTarget, k as CdlLang, l as Computed, m as CdlDerivedValue, n as CdlScrollTrigger, L as LaidDiagram, o as CdlDiagramViewProps, p as LaidEdge, q as LaidNode, r as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-Dk8_6ua6.js';
2
- export { s as CdlDiagramView, t as CdlEventBinding, u as CdlEventKind, v as CdlFormula, w as CdlPhase, x as ChartPieForm, y as ChartSlopeForm, z as EDGE_HEADS, A as EDGE_HEAD_DEFAULT, D as EDGE_HEAD_FILLS, F as EDGE_HEAD_FILL_DEFAULT, G as EDGE_REVEALS, H as EDGE_REVEAL_DEFAULT, I as EDGE_STYLES, K as EdgeReveal, M as InteractiveHandlerMap, O as InteractiveSignalsAccessor, P as LaidLane, U as NODE_KINDS, V as RELATION_FOCUSES, W as RELATION_FOCUS_DEFAULT, X as RelationFocus, Y as ScrollProgressHandle, Z as TONES, _ as computeEventBindingKey, $ as computeFormulaKey, a0 as computeInputSignalKey, a1 as computeScrollTriggerKey, a2 as computed, a3 as createInteractiveSignalsAccessor, a4 as createScrollProgressHandle, a5 as createScrollProgressSignals, a6 as hasInteractivePrimitives, a7 as resolveLang, a8 as sequenceBoardMetrics, a9 as sequenceStepId, aa as signal } from './render-Dk8_6ua6.js';
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 CdlState, i as CdlInputOption, j as CdlEventTarget, k as CdlLang, l as Computed, m as CdlDerivedValue, n as CdlScrollTrigger, L as LaidDiagram, o as CdlDiagramViewProps, p as LaidEdge, q as LaidNode, r as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-DfXCs3Eh.js';
2
+ export { s as CdlDiagramView, t as CdlEventBinding, u as CdlEventKind, v as CdlFormula, w as CdlPhase, x as ChartPieForm, y as ChartSlopeForm, z as EDGE_HEADS, A as EDGE_HEAD_DEFAULT, D as EDGE_HEAD_FILLS, F as EDGE_HEAD_FILL_DEFAULT, G as EDGE_REVEALS, H as EDGE_REVEAL_DEFAULT, I as EDGE_STYLES, K as EdgeReveal, M as InteractiveHandlerMap, O as InteractiveSignalsAccessor, P as LaidLane, U as NODE_KINDS, V as RELATION_FOCUSES, W as RELATION_FOCUS_DEFAULT, X as RelationFocus, Y as ScrollProgressHandle, Z as TONES, _ as computeEventBindingKey, $ as computeFormulaKey, a0 as computeInputSignalKey, a1 as computeScrollTriggerKey, a2 as computed, a3 as createInteractiveSignalsAccessor, a4 as createScrollProgressHandle, a5 as createScrollProgressSignals, a6 as hasInteractivePrimitives, a7 as resolveLang, a8 as sequenceBoardMetrics, a9 as sequenceStepId, aa as signal } from './render-DfXCs3Eh.js';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
package/dist/index.js CHANGED
@@ -2695,16 +2695,12 @@ function ReadoutWidget({
2695
2695
  colors: readout.colors ?? ["#e0e6ef", "#2d6a8f"]
2696
2696
  }
2697
2697
  );
2698
- case "badge":
2699
- return /* @__PURE__ */ jsx(
2700
- BadgeReadout,
2701
- {
2702
- id: readout.id,
2703
- label,
2704
- value: typeof rawValue === "string" ? rawValue : String(rawValue ?? ""),
2705
- map: readout.map
2706
- }
2707
- );
2698
+ case "badge": {
2699
+ const value = typeof rawValue === "string" ? rawValue : String(rawValue ?? "");
2700
+ const colorRaw = readout.colorSource === void 0 ? void 0 : stateOverrides[readout.colorSource];
2701
+ const colorKey = readout.colorSource === void 0 ? value : colorRaw === void 0 ? void 0 : String(colorRaw);
2702
+ return /* @__PURE__ */ jsx(BadgeReadout, { id: readout.id, label, value, colorKey, map: readout.map });
2703
+ }
2708
2704
  case "status-dot":
2709
2705
  return /* @__PURE__ */ jsx(
2710
2706
  StatusDotReadout,
@@ -4426,9 +4422,10 @@ function BadgeReadout({
4426
4422
  id,
4427
4423
  label,
4428
4424
  value,
4425
+ colorKey,
4429
4426
  map
4430
4427
  }) {
4431
- const entry = map?.find((m) => m.value === value);
4428
+ const entry = colorKey === void 0 ? void 0 : map?.find((m) => m.value === colorKey);
4432
4429
  const color = entry?.color;
4433
4430
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-badge", "data-cdl-readout": id, children: [
4434
4431
  /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
@@ -12558,6 +12555,25 @@ var ARROW_ENDPOINT_CENTER_TOL = 8;
12558
12555
  var ROW_GAP_VARIANCE_TOL = 40;
12559
12556
  var COLUMN_GAP_VARIANCE_TOL = 40;
12560
12557
  var LANE_BORDER_CLEARANCE_TOL = 2;
12558
+ function laneVerticalRange(lane, nodes) {
12559
+ const pinnedWithHeight = lane.posX !== void 0 && lane.posY !== void 0 && lane.posH !== void 0;
12560
+ if (!lane.contain && !pinnedWithHeight) return void 0;
12561
+ let top = lane.y;
12562
+ let bottom = lane.y + lane.height;
12563
+ for (const n of nodes) {
12564
+ if (n.lane !== lane.id) continue;
12565
+ top = Math.min(top, n.cy - n.h / 2);
12566
+ bottom = Math.max(bottom, n.cy + n.h / 2);
12567
+ }
12568
+ return { top, bottom };
12569
+ }
12570
+ function rectCrossesLaneBorder(rect, lane, range) {
12571
+ if (range !== void 0 && (rect.y + rect.h <= range.top || rect.y >= range.bottom)) return void 0;
12572
+ const crosses = (lineX) => rect.x < lineX - LANE_BORDER_CLEARANCE_TOL && rect.x + rect.w > lineX + LANE_BORDER_CLEARANCE_TOL;
12573
+ if (crosses(lane.x)) return "left";
12574
+ if (crosses(lane.x + lane.width)) return "right";
12575
+ return void 0;
12576
+ }
12561
12577
  var NEAR_COLLISION_POLICY = {
12562
12578
  "node|node": 70,
12563
12579
  "node|edge-label": 32,
@@ -18149,6 +18165,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
18149
18165
  }
18150
18166
  }
18151
18167
  {
18168
+ const rangeByLane = new Map(laid.lanes.map((lane) => [lane.id, laneVerticalRange(lane, laid.nodes)]));
18152
18169
  for (const e of laid.edges) {
18153
18170
  if (!hasRenderedLabel(e)) continue;
18154
18171
  const fromNode = nodeById.get(e.from);
@@ -18157,21 +18174,14 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
18157
18174
  const allowedLanes = /* @__PURE__ */ new Set();
18158
18175
  if (fromNode) allowedLanes.add(fromNode.lane);
18159
18176
  if (toNode) allowedLanes.add(toNode.lane);
18160
- const boxW = computeLabelBoxW(e.label, e.sub);
18161
- const anchor = e.labelAnchor;
18162
- const boxLeftX = anchor === "start" ? 0 : anchor === "end" ? -boxW : -boxW / 2;
18163
- const bx = e.labelX + boxLeftX;
18164
- const bxRight = bx + boxW;
18177
+ const box = computeLabelBBoxWorld(e);
18165
18178
  for (const lane of laid.lanes) {
18166
18179
  if (allowedLanes.has(lane.id)) continue;
18167
- const laneLeft = lane.x;
18168
- const laneRight = lane.x + lane.width;
18169
- const crossesLeft = bx < laneLeft - LANE_BORDER_CLEARANCE_TOL && bxRight > laneLeft + LANE_BORDER_CLEARANCE_TOL;
18170
- const crossesRight = bx < laneRight - LANE_BORDER_CLEARANCE_TOL && bxRight > laneRight + LANE_BORDER_CLEARANCE_TOL;
18171
- if (crossesLeft || crossesRight) {
18180
+ const side = rectCrossesLaneBorder(box, lane, rangeByLane.get(lane.id));
18181
+ if (side !== void 0) {
18172
18182
  push(
18173
18183
  "lane-border-clearance",
18174
- `edge "${e.id}" label bbox (${bx.toFixed(0)}..${bxRight.toFixed(0)}) \u304C\u975E\u767A\u7740 lane "${lane.id}" (${laneLeft.toFixed(0)}..${laneRight.toFixed(0)}) \u306E ${crossesLeft ? "\u5DE6" : "\u53F3"} border \u3092\u8CAB\u901A`
18184
+ `edge "${e.id}" label bbox (${box.x.toFixed(0)}..${(box.x + box.w).toFixed(0)}) \u304C\u975E\u767A\u7740 lane "${lane.id}" (${lane.x.toFixed(0)}..${(lane.x + lane.width).toFixed(0)}) \u306E ${side === "left" ? "\u5DE6" : "\u53F3"} border \u3092\u8CAB\u901A`
18175
18185
  );
18176
18186
  break;
18177
18187
  }
@@ -18794,6 +18804,7 @@ function layoutEdges(diag, nodes, lanes = []) {
18794
18804
  const labelMarginExtra = (diag.viewport?.labelMargin ?? diag.viewport?.gap ?? DEFAULT_LABEL_MARGIN) - DEFAULT_LABEL_MARGIN;
18795
18805
  const nmap = new Map(nodes.map((n) => [n.id, n]));
18796
18806
  const lmap = new Map(lanes.map((l) => [l.id, l]));
18807
+ const laneRangeById = new Map(lanes.map((l) => [l.id, laneVerticalRange(l, nodes)]));
18797
18808
  const positionedEdges = [];
18798
18809
  const autoEdges = [];
18799
18810
  const selfLoopEdges = [];
@@ -19018,7 +19029,7 @@ function layoutEdges(diag, nodes, lanes = []) {
19018
19029
  nodes.filter((n) => n.id === c.from || n.id === c.to).map((n) => n.lane)
19019
19030
  );
19020
19031
  return lanes.some(
19021
- (l) => !endpointLanes.has(l.id) && (crossesVerticalLine(pill, l.x) || crossesVerticalLine(pill, l.x + l.width))
19032
+ (l) => !endpointLanes.has(l.id) && rectCrossesLaneBorder(pill, l, laneRangeById.get(l.id)) !== void 0
19022
19033
  );
19023
19034
  };
19024
19035
  const assignDetourSides = () => {
@@ -19238,7 +19249,7 @@ function layoutEdges(diag, nodes, lanes = []) {
19238
19249
  );
19239
19250
  const crossesLaneBorder = lanes.some((l) => {
19240
19251
  if (endpointLanes.has(l.id)) return false;
19241
- return crossesVerticalLine(alt, l.x) || crossesVerticalLine(alt, l.x + l.width);
19252
+ return rectCrossesLaneBorder(alt, l, laneRangeById.get(l.id)) !== void 0;
19242
19253
  });
19243
19254
  if (crossesLaneBorder) continue;
19244
19255
  r.baseLabelX = r.labelAltX;
@@ -19529,9 +19540,6 @@ function segmentsBBox2(segs) {
19529
19540
  }
19530
19541
  return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };
19531
19542
  }
19532
- function crossesVerticalLine(rect, lineX) {
19533
- return rect.x < lineX - LANE_BORDER_CLEARANCE_TOL && rect.x + rect.w > lineX + LANE_BORDER_CLEARANCE_TOL;
19534
- }
19535
19543
  function distributeBySides(list) {
19536
19544
  const from = list[0].from;
19537
19545
  const tol = 20;