@cardenelabs/cdl 0.23.0 → 0.24.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/dist/react.cjs CHANGED
@@ -9489,6 +9489,12 @@ function edgeHeadPaint(head, fill, color) {
9489
9489
  }
9490
9490
  return { fill: color, stroke: "none" };
9491
9491
  }
9492
+ function defaultEdgeWidth(active) {
9493
+ return active ? 2.5 : 1.25;
9494
+ }
9495
+ function edgeColor(edge) {
9496
+ return edge.role === "main" ? "var(--cdl-now, #c0421f)" : toneColor(edge.tone);
9497
+ }
9492
9498
  function opacityAttr(opacity) {
9493
9499
  return opacity < 1 ? opacity : void 0;
9494
9500
  }
@@ -9502,7 +9508,7 @@ function CdlEdgeView({
9502
9508
  progress,
9503
9509
  stateValues
9504
9510
  }) {
9505
- const color = toneColor(edge.tone);
9511
+ const color = edgeColor(edge);
9506
9512
  const \u7AEF\u306E\u540D\u524D = (h, f) => {
9507
9513
  const \u5F62 = h ?? EDGE_HEAD_DEFAULT;
9508
9514
  if (\u5F62 === "none") return void 0;
@@ -9592,7 +9598,7 @@ function SolidEdgePath({
9592
9598
  stateValues
9593
9599
  }) {
9594
9600
  const visibleD = drawing ? pathSubpath(edge.d, progress) : edge.d;
9595
- const defaultWidth = active ? 5 : 2.5;
9601
+ const defaultWidth = defaultEdgeWidth(active);
9596
9602
  const boundWidth = edge.widthBind && stateValues ? resolveNumericAttr(edge.widthBind, stateValues, defaultWidth) : defaultWidth;
9597
9603
  const boundStroke = edge.strokeBind && stateValues ? interpolate(edge.strokeBind, stateValues) : color;
9598
9604
  const boundDashOffset = edge.dashOffsetBind && stateValues ? resolveNumericAttr(edge.dashOffsetBind, stateValues, 0) : void 0;
@@ -9669,7 +9675,7 @@ function CdlEdgeGlowView({
9669
9675
  active
9670
9676
  }) {
9671
9677
  if (!active) return null;
9672
- const color = toneColor(edge.tone);
9678
+ const color = edgeColor(edge);
9673
9679
  return /* @__PURE__ */ jsxRuntime.jsx(EdgeGlowCircles, { color, edgeId: edge.id });
9674
9680
  }
9675
9681
  function CdlEdgeLabelView({
@@ -9677,7 +9683,7 @@ function CdlEdgeLabelView({
9677
9683
  active
9678
9684
  }) {
9679
9685
  if (!hasRenderedLabel(edge)) return null;
9680
- const color = toneColor(edge.tone);
9686
+ const color = edgeColor(edge);
9681
9687
  const bbox = computeLabelBBoxWorld(edge);
9682
9688
  const boxW = bbox.w;
9683
9689
  const boxH = bbox.h;
@@ -9695,7 +9701,7 @@ function CdlEdgeLabelView({
9695
9701
  "data-cdl-edge-label-text": edge.label,
9696
9702
  "data-cdl-edge-sub-text": edge.sub ?? "",
9697
9703
  children: [
9698
- /* @__PURE__ */ jsxRuntime.jsx(
9704
+ edge.labelPlate !== false && /* @__PURE__ */ jsxRuntime.jsx(
9699
9705
  "rect",
9700
9706
  {
9701
9707
  "data-cdl-role": "edge-label-bg",
@@ -10415,9 +10421,29 @@ function StorageNode({
10415
10421
  })
10416
10422
  ] });
10417
10423
  }
10424
+ var TINT_FILL = "color-mix(in srgb, var(--cdl-text, #1a1f2a) 6%, transparent)";
10425
+ function lookPaint(look, accent, active) {
10426
+ const \u65E2\u5B9A\u67A0 = active ? accent : "var(--cdl-divider, #d4d4d8)";
10427
+ const \u65E2\u5B9A\u592A\u3055 = active ? 3 : 1.25;
10428
+ switch (look) {
10429
+ case "outline":
10430
+ return { fill: "none", stroke: \u65E2\u5B9A\u67A0, strokeWidth: \u65E2\u5B9A\u592A\u3055, onSolid: false };
10431
+ case "tint":
10432
+ return { fill: TINT_FILL, stroke: \u65E2\u5B9A\u67A0, strokeWidth: \u65E2\u5B9A\u592A\u3055, onSolid: false };
10433
+ case "solid":
10434
+ return { fill: "var(--cdl-text, #1a1f2a)", stroke: \u65E2\u5B9A\u67A0, strokeWidth: \u65E2\u5B9A\u592A\u3055, onSolid: true };
10435
+ case "ledger":
10436
+ return { fill: "var(--cdl-node-fill, #ffffff)", stroke: \u65E2\u5B9A\u67A0, strokeWidth: \u65E2\u5B9A\u592A\u3055, onSolid: false };
10437
+ case "dashed":
10438
+ return { fill: "none", stroke: \u65E2\u5B9A\u67A0, strokeWidth: \u65E2\u5B9A\u592A\u3055, dash: "6 4", onSolid: false };
10439
+ default:
10440
+ return { fill: "var(--cdl-node-fill, #ffffff)", stroke: \u65E2\u5B9A\u67A0, strokeWidth: \u65E2\u5B9A\u592A\u3055, onSolid: false };
10441
+ }
10442
+ }
10418
10443
  var STYLES = {
10419
10444
  // 人系
10420
10445
  person: {
10446
+ look: "outline",
10421
10447
  accent: "var(--cdl-tone-accent, #2d6a8f)",
10422
10448
  eyebrowColor: "var(--cdl-tone-accent, #2d6a8f)",
10423
10449
  icon: "M12 12c2.2 0 4-1.8 4-4s-1.8-4-4-4-4 1.8-4 4 1.8 4 4 4zm0 2c-2.7 0-8 1.3-8 4v2h16v-2c0-2.7-5.3-4-8-4z"
@@ -10450,11 +10476,13 @@ var STYLES = {
10450
10476
  shape: "cylinder"
10451
10477
  },
10452
10478
  cache: {
10479
+ look: "dashed",
10453
10480
  accent: "var(--cdl-tone-warning, #a67a2e)",
10454
10481
  eyebrowColor: "var(--cdl-tone-warning, #a67a2e)",
10455
10482
  icon: "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"
10456
10483
  },
10457
10484
  queue: {
10485
+ look: "ledger",
10458
10486
  accent: "var(--cdl-tone-warning, #a67a2e)",
10459
10487
  eyebrowColor: "var(--cdl-tone-warning, #a67a2e)",
10460
10488
  icon: "M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z"
@@ -10471,12 +10499,14 @@ var STYLES = {
10471
10499
  shape: "cloud"
10472
10500
  },
10473
10501
  cdn: {
10502
+ look: "tint",
10474
10503
  accent: "var(--cdl-tone-info, #5a8ec1)",
10475
10504
  eyebrowColor: "var(--cdl-tone-info, #5a8ec1)",
10476
10505
  icon: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"
10477
10506
  },
10478
10507
  // アプリ系
10479
10508
  service: {
10509
+ look: "solid",
10480
10510
  accent: "var(--cdl-tone-teal, #2f8770)",
10481
10511
  eyebrowColor: "var(--cdl-tone-teal, #2f8770)",
10482
10512
  icon: "M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"
@@ -10548,6 +10578,7 @@ function GenericNode({
10548
10578
  const w = node.w;
10549
10579
  const h = node.h;
10550
10580
  const shape = style.shape ?? "rect";
10581
+ const paint = lookPaint(style.look, style.accent, active);
10551
10582
  const shapeEl = (() => {
10552
10583
  if (shape === "cylinder") {
10553
10584
  const rx = w / 2;
@@ -10605,19 +10636,23 @@ function GenericNode({
10605
10636
  circles.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: c.cx, cy: c.cy, r: c.r - (active ? 1.5 : 0.75), fill: "var(--cdl-node-fill, #ffffff)" }, `mask-${i}`))
10606
10637
  ] });
10607
10638
  }
10608
- return /* @__PURE__ */ jsxRuntime.jsx(
10609
- "rect",
10610
- {
10611
- x: 0,
10612
- y: 0,
10613
- width: w,
10614
- height: h,
10615
- rx: 18,
10616
- fill: "var(--cdl-node-fill, #ffffff)",
10617
- stroke: active ? style.accent : "var(--cdl-divider, #d4d4d8)",
10618
- strokeWidth: active ? 3 : 1.25
10619
- }
10620
- );
10639
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10640
+ /* @__PURE__ */ jsxRuntime.jsx(
10641
+ "rect",
10642
+ {
10643
+ x: 0,
10644
+ y: 0,
10645
+ width: w,
10646
+ height: h,
10647
+ rx: 18,
10648
+ fill: paint.fill,
10649
+ stroke: paint.stroke,
10650
+ strokeWidth: paint.strokeWidth,
10651
+ strokeDasharray: paint.dash
10652
+ }
10653
+ ),
10654
+ style.look === "ledger" && /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 1, y1: h - 7, x2: w - 1, y2: h - 7, stroke: paint.stroke, strokeWidth: 1 })
10655
+ ] });
10621
10656
  })();
10622
10657
  const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
10623
10658
  const hasRows = (node.rows?.length ?? 0) > 0;
@@ -10640,56 +10675,64 @@ function GenericNode({
10640
10675
  const iconX = centered ? w / 2 + 40 : w - 48;
10641
10676
  const iconY = centered ? h / 2 - 44 - \u7D75\u306E\u82AF : 18 + cylinderShift;
10642
10677
  const dominantBaseline = centered ? "middle" : void 0;
10643
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x} ${y})`, "data-cdl-role": "node-body", children: [
10644
- shapeEl,
10645
- /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${iconX} ${iconY}) scale(1)`, "data-cdl-role": "node-kind-icon", children: [
10646
- /* @__PURE__ */ jsxRuntime.jsx("rect", { width: 24, height: 24, fill: "transparent" }),
10647
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: style.icon, fill: style.eyebrowColor, opacity: 0.7, transform: "scale(1)" })
10648
- ] }),
10649
- node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: textX, y: eyebrowY, fontSize: 17, fontWeight: 700, letterSpacing: 1.5, fill: style.eyebrowColor, textAnchor, dominantBaseline, children: node.eyebrow }),
10650
- /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": "node-label", x: textX, y: titleY, fontSize: 20, fontWeight: 700, fill: "var(--cdl-text, #1a1f2a)", textAnchor, dominantBaseline, style: node.kind === "function" || node.kind === "api" ? { fontFamily: "'JetBrains Mono', monospace" } : void 0, children: node.title }),
10651
- node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: textX, y: subtitleY, fontSize: 17, fill: "var(--cdl-text-dim, #5a6270)", textAnchor, dominantBaseline, style: { fontFamily: "'JetBrains Mono', monospace" }, children: node.subtitle }),
10652
- resolvedValue && /* @__PURE__ */ jsxRuntime.jsx(
10653
- "text",
10654
- {
10655
- x: w - 20,
10656
- y: h - 24,
10657
- fontSize: 32,
10658
- fontWeight: 700,
10659
- textAnchor: "end",
10660
- fill: "var(--cdl-text, #1a1f2a)",
10661
- style: { fontFamily: "'JetBrains Mono', monospace" },
10662
- children: resolvedValue
10663
- }
10664
- ),
10665
- node.rows && node.rows.length > 0 && (() => {
10666
- const resolved = node.rows.map((row) => interpolate(row, stateValues));
10667
- const splits = resolved.map(splitRow);
10668
- const leftMaxWidth = splits.reduce(
10669
- (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
10670
- 0
10671
- );
10672
- const rightColX = ROW_PAD_X_PX + leftMaxWidth + ROW_COL_GAP_PX;
10673
- return /* @__PURE__ */ jsxRuntime.jsx("g", { children: splits.map((s, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(0 ${rowBaselineY(node.kind, i)})`, children: [
10674
- /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": "node-row", "data-cdl-row-index": i, x: ROW_PAD_X_PX, y: 0, fontSize: 18, fill: "var(--cdl-text-dim, #5a6270)", children: s.left }),
10675
- /* @__PURE__ */ jsxRuntime.jsx(
10678
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10679
+ "g",
10680
+ {
10681
+ transform: `translate(${x} ${y})`,
10682
+ "data-cdl-role": "node-body",
10683
+ "data-cdl-look": style.look,
10684
+ children: [
10685
+ shapeEl,
10686
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${iconX} ${iconY}) scale(1)`, "data-cdl-role": "node-kind-icon", children: [
10687
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: 24, height: 24, fill: "transparent" }),
10688
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: style.icon, fill: style.eyebrowColor, opacity: 0.7, transform: "scale(1)" })
10689
+ ] }),
10690
+ node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: textX, y: eyebrowY, fontSize: 17, fontWeight: 700, letterSpacing: 1.5, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : style.eyebrowColor, textAnchor, dominantBaseline, children: node.eyebrow }),
10691
+ /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": "node-label", x: textX, y: titleY, fontSize: 20, fontWeight: 700, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : "var(--cdl-text, #1a1f2a)", textAnchor, dominantBaseline, style: node.kind === "function" || node.kind === "api" ? { fontFamily: "'JetBrains Mono', monospace" } : void 0, children: node.title }),
10692
+ node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: textX, y: subtitleY, fontSize: 17, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : "var(--cdl-text-dim, #5a6270)", textAnchor, dominantBaseline, style: { fontFamily: "'JetBrains Mono', monospace" }, children: node.subtitle }),
10693
+ resolvedValue && /* @__PURE__ */ jsxRuntime.jsx(
10676
10694
  "text",
10677
10695
  {
10678
- "data-cdl-role": "node-row",
10679
- "data-cdl-row-index": i,
10680
- x: rightColX,
10681
- y: 0,
10682
- fontSize: 21,
10696
+ x: w - 20,
10697
+ y: h - 24,
10698
+ fontSize: 32,
10683
10699
  fontWeight: 700,
10684
- textAnchor: "start",
10700
+ textAnchor: "end",
10685
10701
  fill: "var(--cdl-text, #1a1f2a)",
10686
10702
  style: { fontFamily: "'JetBrains Mono', monospace" },
10687
- children: s.right
10703
+ children: resolvedValue
10688
10704
  }
10689
- )
10690
- ] }, i)) });
10691
- })()
10692
- ] });
10705
+ ),
10706
+ node.rows && node.rows.length > 0 && (() => {
10707
+ const resolved = node.rows.map((row) => interpolate(row, stateValues));
10708
+ const splits = resolved.map(splitRow);
10709
+ const leftMaxWidth = splits.reduce(
10710
+ (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
10711
+ 0
10712
+ );
10713
+ const rightColX = ROW_PAD_X_PX + leftMaxWidth + ROW_COL_GAP_PX;
10714
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { children: splits.map((s, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(0 ${rowBaselineY(node.kind, i)})`, children: [
10715
+ /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": "node-row", "data-cdl-row-index": i, x: ROW_PAD_X_PX, y: 0, fontSize: 18, fill: "var(--cdl-text-dim, #5a6270)", children: s.left }),
10716
+ /* @__PURE__ */ jsxRuntime.jsx(
10717
+ "text",
10718
+ {
10719
+ "data-cdl-role": "node-row",
10720
+ "data-cdl-row-index": i,
10721
+ x: rightColX,
10722
+ y: 0,
10723
+ fontSize: 21,
10724
+ fontWeight: 700,
10725
+ textAnchor: "start",
10726
+ fill: "var(--cdl-text, #1a1f2a)",
10727
+ style: { fontFamily: "'JetBrains Mono', monospace" },
10728
+ children: s.right
10729
+ }
10730
+ )
10731
+ ] }, i)) });
10732
+ })()
10733
+ ]
10734
+ }
10735
+ );
10693
10736
  }
10694
10737
  var MARK_INNER_RATIO = 0.56;
10695
10738
  var RING_WIDTH_ACTIVE = 6;