@cardenelabs/cdl 0.16.0 → 0.17.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/react.cjs CHANGED
@@ -561,6 +561,9 @@ function hasRenderedLabel(e) {
561
561
  return Boolean(e.label?.trim() || e.sub?.trim());
562
562
  }
563
563
  var KINDS_WITHOUT_TITLE_TEXT = /* @__PURE__ */ new Set([
564
+ // 時系列のやり取り (#578)。 図を丸ごと描く種別で、描くのは面々の名前と言づての語。
565
+ // 箱の `title` は使わない
566
+ "sequence-board",
564
567
  // 形だけを描く (DynShapeNode)
565
568
  "dyn-rect",
566
569
  "dyn-circle",
@@ -637,7 +640,7 @@ function genericTextCentered(kind, hasRows) {
637
640
  function genericTitleBaselineY(kind, h, hasRows) {
638
641
  return genericTextCentered(kind, hasRows) ? h / 2 + GENERIC_TITLE_CENTER_OFFSET : GENERIC_TITLE_TOP + genericTextShift(kind);
639
642
  }
640
- var ROW_TOP_STORAGE = 130;
643
+ var ROW_TOP_STORAGE = 152;
641
644
  var ROW_PITCH_STORAGE = 56;
642
645
  var ROW_TOP_GENERIC = 100;
643
646
  var ROW_PITCH_GENERIC = 28;
@@ -648,7 +651,9 @@ var GENERIC_TITLE_FONT = 20;
648
651
  var GLYPH_CAP_RATIO = 0.72;
649
652
  var ROW_FONT_STORAGE = 26;
650
653
  var ROW_FONT_GENERIC = 21;
651
- var STORAGE_TITLE_BASELINE = 78;
654
+ var STORAGE_TITLE_BASELINE = 86;
655
+ var STORAGE_TITLE_FONT = 34;
656
+ var SUBTITLE_ROW_SHIFT = 46;
652
657
  var STORAGE_ROW_DIVIDER_Y = Math.round(
653
658
  (STORAGE_TITLE_BASELINE + (ROW_TOP_STORAGE - ROW_FONT_STORAGE * GLYPH_CAP_RATIO)) / 2
654
659
  );
@@ -2079,7 +2084,10 @@ var TOKENS = {
2079
2084
  // 印は箱いっぱいに描く (線が箱の縁で止まるため) ので、この値が丸の直径になる。
2080
2085
  // 箱としての最小 (80x40) より大きく、名前を持つ箱 (card 320x150) よりは明らかに小さい
2081
2086
  "mark-start": { w: 96, h: 96 },
2082
- "mark-end": { w: 96, h: 96 }
2087
+ "mark-end": { w: 96, h: 96 },
2088
+ // 時系列のやり取り (#578)。 実寸は中身から決まる (`sequenceBoardMetrics`) ので、
2089
+ // ここは書かなかった時の受け皿
2090
+ "sequence-board": { w: 960, h: 640 }
2083
2091
  },
2084
2092
  // row gap (stack 間の vertical gap、 lane 内 / 跨ぎ共通)
2085
2093
  // edge label が node の上 36 px に配置されるため、 boxH 68 + 36 + 余裕 = 100 必要。
@@ -3742,8 +3750,12 @@ function requiredRowsWidth(rows, kind) {
3742
3750
  function autoStorageHeight(n, defaultH) {
3743
3751
  if (n.kind !== "storage") return n.h ?? defaultH;
3744
3752
  if (n.h != null) return n.h;
3745
- if (!n.rows || n.rows.length === 0) return 150;
3746
- return Math.max(defaultH, requiredRowsHeight("storage", n.rows.length) ?? defaultH);
3753
+ const \u5370\u3042\u308A = n.rowMarks !== void 0;
3754
+ const \u547C\u3073\u540D\u306E\u5206 = \u5370\u3042\u308A && n.subtitle ? SUBTITLE_ROW_SHIFT : 0;
3755
+ if (!n.rows || n.rows.length === 0) return 150 + \u547C\u3073\u540D\u306E\u5206;
3756
+ const \u5FC5\u8981 = requiredRowsHeight("storage", n.rows.length) ?? defaultH;
3757
+ if (\u5370\u3042\u308A) return \u5FC5\u8981 + \u547C\u3073\u540D\u306E\u5206;
3758
+ return Math.max(defaultH, \u5FC5\u8981);
3747
3759
  }
3748
3760
  function autoRowsWidth(n, defaultW) {
3749
3761
  if (n.w != null) return n.w;
@@ -3831,8 +3843,11 @@ function layoutNodes(diag, lanes) {
3831
3843
  continue;
3832
3844
  }
3833
3845
  const cx = lane.x + lane.width / 2;
3834
- const cy = rowCy.get(n.stack);
3835
- const h = n.h ?? rowH.get(n.stack);
3846
+ const \u6BB5\u306E\u82AF = rowCy.get(n.stack);
3847
+ const \u6BB5\u306E\u9AD8\u3055 = rowH.get(n.stack);
3848
+ const \u81EA\u524D\u306E\u9AD8\u3055 = n.rowMarks !== void 0;
3849
+ const h = n.h ?? (\u81EA\u524D\u306E\u9AD8\u3055 ? autoStorageHeight(n, size.h) : \u6BB5\u306E\u9AD8\u3055);
3850
+ const cy = \u6BB5\u306E\u82AF;
3836
3851
  const w = autoRowsWidth(n, size.w);
3837
3852
  out.push({
3838
3853
  ...n,
@@ -4161,10 +4176,24 @@ var NODE_KINDS = [
4161
4176
  // 流れの始まりと終わりの印 2 種 (#560) ... 塗った丸と輪で囲んだ丸。
4162
4177
  // 状態遷移図が使う。 印そのものが意味を持つので文字は描かない
4163
4178
  "mark-start",
4164
- "mark-end"
4179
+ "mark-end",
4180
+ // 時系列のやり取り (#578) ... 1 つの箱が図を丸ごと描く。 縦が時間で、参加者は箱を持たない
4181
+ "sequence-board"
4165
4182
  ];
4166
4183
  var EDGE_HEAD_DEFAULT = "triangle";
4167
- var EDGE_HEADS = ["triangle", "diamond", "open", "crow"];
4184
+ var EDGE_HEADS = [
4185
+ "none",
4186
+ "triangle",
4187
+ "diamond",
4188
+ "open",
4189
+ "crow",
4190
+ "one",
4191
+ "zero-one",
4192
+ "many",
4193
+ "zero-many"
4194
+ ];
4195
+ var EDGE_HEAD_FILL_DEFAULT = "solid";
4196
+ var EDGE_HEAD_FILLS = ["solid", "hollow"];
4168
4197
 
4169
4198
  // src/formula/evaluator.ts
4170
4199
  function evaluate(ast, ctxOrResolver) {
@@ -5003,7 +5032,7 @@ function pathSubpath(d, progress) {
5003
5032
  }
5004
5033
 
5005
5034
  // src/render/template-fields.ts
5006
- var TEXT_FIELDS = ["title", "eyebrow", "subtitle", "value", "wBind", "hBind", "visibleIf"];
5035
+ var TEXT_FIELDS = ["title", "eyebrow", "subtitle", "value", "wBind", "hBind", "visibleIf", "sequenceStep"];
5007
5036
  var LIST_FIELDS = ["rows"];
5008
5037
  var NUMERIC_FIELDS = ["opacity", "renderOffsetX", "renderOffsetY"];
5009
5038
  var SHAPE_TEMPLATE_FIELDS = ["source", "radius", "fillProgress", "angle", "level", "rotation", "fill"];
@@ -5459,14 +5488,42 @@ function StateDiffCard({
5459
5488
 
5460
5489
  // src/render/edge-head.ts
5461
5490
  var EDGE_HEAD_SHAPE = {
5462
- triangle: { d: "M 0 0 L 10 5 L 0 10 z", refX: 9, filled: true },
5463
- diamond: { d: "M 0 5 L 5 0 L 10 5 L 5 10 z", refX: 9, filled: true },
5464
- open: { d: "M 1 0 L 9 5 L 1 10", refX: 9, filled: false },
5465
- crow: { d: "M 10 0 L 0 5 M 10 5 L 0 5 M 10 10 L 0 5", refX: 10, filled: false }
5491
+ // 何も描かない端。 marker 自体を出さないので `d` は読まれない
5492
+ none: { d: "", w: 10, h: 10, refX: 0, filled: false },
5493
+ triangle: { d: "M 0 0 L 10 5 L 0 10 z", w: 10, h: 10, refX: 9, filled: true },
5494
+ diamond: { d: "M 0 5 L 5 0 L 10 5 L 5 10 z", w: 10, h: 10, refX: 9, filled: true },
5495
+ open: { d: "M 1 0 L 9 5 L 1 10", w: 10, h: 10, refX: 9, filled: false },
5496
+ crow: { d: "M 10 0 L 0 5 M 10 5 L 0 5 M 10 10 L 0 5", w: 10, h: 10, refX: 10, filled: false },
5497
+ // ER の端。 **箱に近い側 (x が大きい側) が個数、その外側が任意か** (#578)。
5498
+ //
5499
+ // 枠は 24 × 10 で、線の先端に合わせるのは x=24 = 箱の縁。 marker は経路の向きに回るので、
5500
+ // 行き先側でも出どころ側でも「箱に近い側」 が同じ端になる。
5501
+ //
5502
+ // 三又の真ん中の枝は **関係の線そのもの** が兼ねる。 別に引くと同じ所に 2 本重なって太く見える
5503
+ one: { d: "M 16 0 L 16 10 M 4 0 L 4 10", w: 24, h: 10, refX: 24, scale: 1.8, filled: false },
5504
+ "zero-one": { d: "M 16 0 L 16 10 M 7 5 a 3 3 0 1 0 -6 0 a 3 3 0 1 0 6 0", w: 24, h: 10, refX: 24, scale: 1.8, filled: false },
5505
+ many: { d: "M 24 0 L 13 5 L 24 10 M 4 0 L 4 10", w: 24, h: 10, refX: 24, scale: 1.8, filled: false },
5506
+ "zero-many": {
5507
+ d: "M 24 0 L 13 5 L 24 10 M 7 5 a 3 3 0 1 0 -6 0 a 3 3 0 1 0 6 0",
5508
+ w: 24,
5509
+ h: 10,
5510
+ refX: 24,
5511
+ scale: 1.8,
5512
+ filled: false
5513
+ }
5466
5514
  };
5467
- function edgeHeadMarkerId(tone, head, small) {
5515
+ function edgeHeadMarkerId(tone, head, small, fill = EDGE_HEAD_FILL_DEFAULT) {
5468
5516
  const \u5C0F = small ? "-sm" : "";
5469
- return head === EDGE_HEAD_DEFAULT ? `cdl-arrow-${tone}${\u5C0F}` : `cdl-arrow-${tone}-${head}${\u5C0F}`;
5517
+ const \u5857 = fill === EDGE_HEAD_FILL_DEFAULT || !EDGE_HEAD_SHAPE[head].filled ? "" : `-${fill}`;
5518
+ return head === EDGE_HEAD_DEFAULT && \u5857 === "" ? `cdl-arrow-${tone}${\u5C0F}` : `cdl-arrow-${tone}-${head}${\u5857}${\u5C0F}`;
5519
+ }
5520
+ function edgeHeadPaint(head, fill, color) {
5521
+ const \u5F62 = EDGE_HEAD_SHAPE[head];
5522
+ if (!\u5F62.filled) return { fill: "none", stroke: color, strokeWidth: 1.6 };
5523
+ if (fill === "hollow") {
5524
+ return { fill: "var(--cdl-node-fill, #ffffff)", stroke: color, strokeWidth: 1.4 };
5525
+ }
5526
+ return { fill: color, stroke: "none" };
5470
5527
  }
5471
5528
 
5472
5529
  // src/render/tone.ts
@@ -5520,7 +5577,13 @@ function CdlEdgeView({
5520
5577
  stateValues
5521
5578
  }) {
5522
5579
  const color = toneColor(edge.tone);
5523
- const marker = hasTone(edge.tone) ? edgeHeadMarkerId(edge.tone, edge.head ?? EDGE_HEAD_DEFAULT, !active) : "cdl-arrow-muted";
5580
+ const \u7AEF\u306E\u540D\u524D = (h, f) => {
5581
+ const \u5F62 = h ?? EDGE_HEAD_DEFAULT;
5582
+ if (\u5F62 === "none") return void 0;
5583
+ return hasTone(edge.tone) ? edgeHeadMarkerId(edge.tone, \u5F62, !active, f ?? EDGE_HEAD_FILL_DEFAULT) : "cdl-arrow-muted";
5584
+ };
5585
+ const marker = \u7AEF\u306E\u540D\u524D(edge.head, edge.headFill);
5586
+ const tailMarker = edge.tailHead === void 0 ? void 0 : \u7AEF\u306E\u540D\u524D(edge.tailHead, edge.tailHeadFill);
5524
5587
  const style = edge.style ?? "solid";
5525
5588
  const isDotted = style === "dotted-flow";
5526
5589
  const isPassThrough = isDotted && Boolean(edge.dThrough);
@@ -5568,6 +5631,8 @@ function CdlEdgeView({
5568
5631
  progress,
5569
5632
  color,
5570
5633
  marker,
5634
+ tailMarker,
5635
+ dashed: style === "dashed",
5571
5636
  stateValues
5572
5637
  }
5573
5638
  ),
@@ -5593,6 +5658,8 @@ function SolidEdgePath({
5593
5658
  progress,
5594
5659
  color,
5595
5660
  marker,
5661
+ tailMarker,
5662
+ dashed,
5596
5663
  stateValues
5597
5664
  }) {
5598
5665
  const visibleD = active ? pathSubpath(edge.d, progress) : edge.d;
@@ -5600,7 +5667,7 @@ function SolidEdgePath({
5600
5667
  const boundWidth = edge.widthBind && stateValues ? resolveNumericAttr(edge.widthBind, stateValues, defaultWidth) : defaultWidth;
5601
5668
  const boundStroke = edge.strokeBind && stateValues ? interpolate(edge.strokeBind, stateValues) : color;
5602
5669
  const boundDashOffset = edge.dashOffsetBind && stateValues ? resolveNumericAttr(edge.dashOffsetBind, stateValues, 0) : void 0;
5603
- const dashArray = active ? boundDashOffset !== void 0 ? "8 6" : void 0 : "4 5";
5670
+ const dashArray = dashed ? "10 8" : active ? boundDashOffset !== void 0 ? "8 6" : void 0 : "4 5";
5604
5671
  return /* @__PURE__ */ jsxRuntime.jsx(
5605
5672
  "path",
5606
5673
  {
@@ -5613,7 +5680,8 @@ function SolidEdgePath({
5613
5680
  strokeDasharray: dashArray,
5614
5681
  strokeDashoffset: boundDashOffset,
5615
5682
  strokeLinecap: "round",
5616
- markerEnd: `url(#${marker})`,
5683
+ markerEnd: marker === void 0 ? void 0 : `url(#${marker})`,
5684
+ markerStart: tailMarker === void 0 ? void 0 : `url(#${tailMarker})`,
5617
5685
  style: {
5618
5686
  transition: "stroke 280ms ease, stroke-opacity 280ms ease, stroke-width 280ms ease"
5619
5687
  }
@@ -5877,7 +5945,8 @@ function CardNode({ node, active }) {
5877
5945
  return /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(${x} ${y})` });
5878
5946
  }
5879
5947
  const compact = isCompactBox(node.h);
5880
- const titleY = compact ? node.h / 2 + 8 : 86;
5948
+ const \u5C0F\u578B\u306B\u547C\u3073\u540D = compact && Boolean(node.subtitle);
5949
+ const titleY = compact ? \u5C0F\u578B\u306B\u547C\u3073\u540D ? node.h / 2 - 2 : node.h / 2 + 8 : 86;
5881
5950
  const titleX = compact ? node.w / 2 : 26;
5882
5951
  const paddingX = compact ? 16 : 52;
5883
5952
  const availableW = node.w - paddingX;
@@ -5914,9 +5983,259 @@ function CardNode({ node, active }) {
5914
5983
  children: node.title
5915
5984
  }
5916
5985
  ),
5917
- !compact && node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 124, fontSize: subtitleSize, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
5986
+ !compact && node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 124, fontSize: subtitleSize, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
5987
+ \u5C0F\u578B\u306B\u547C\u3073\u540D && /* @__PURE__ */ jsxRuntime.jsx(
5988
+ "text",
5989
+ {
5990
+ "data-cdl-role": "node-subtitle",
5991
+ x: node.w / 2,
5992
+ y: node.h / 2 + 24,
5993
+ fontSize: Math.min(subtitleSize, 18),
5994
+ textAnchor: "middle",
5995
+ fill: "var(--cdl-text-dim, #5a6270)",
5996
+ children: node.subtitle
5997
+ }
5998
+ )
5999
+ ] });
6000
+ }
6001
+
6002
+ // src/kinds/sequence-board-metrics.ts
6003
+ var SEQ_EDGE = 16;
6004
+ var SEQ_ROW = 64;
6005
+ var SEQ_GUTTER_PAD = 40;
6006
+ var SEQ_GUTTER_GAP = 40;
6007
+ var SEQ_HEAD = 96;
6008
+ var SEQ_ROW_PAD = 56;
6009
+ var SEQ_COL_PAD = 80;
6010
+ var SEQ_BAND_W = 52;
6011
+ var SEQ_BAND_PAD = 24;
6012
+ var SEQ_NAME = 24;
6013
+ var SEQ_SUB = 20;
6014
+ var SEQ_LABEL = 26;
6015
+ var SEQ_DOT = 7;
6016
+ var SEQ_SELF_W = 52;
6017
+ var SEQ_COL_MIN = 200;
6018
+ var g4 = (v) => Math.round(v / 4) * 4;
6019
+ function sequenceBoardMetrics(data) {
6020
+ const \u540D\u5E45 = data.actors.map(
6021
+ (a) => Math.max(textWidth(a.name, SEQ_NAME), a.subtitle ? textWidth(a.subtitle, SEQ_SUB) : 0)
6022
+ );
6023
+ const colW = g4(Math.max(SEQ_COL_MIN, Math.max(0, ...\u540D\u5E45) + SEQ_COL_PAD));
6024
+ const \u8A9E\u5E45 = Math.max(0, ...data.messages.map((m) => textWidth(m.label, SEQ_LABEL)));
6025
+ const gutter = g4(SEQ_EDGE + SEQ_GUTTER_PAD + \u8A9E\u5E45 + SEQ_GUTTER_GAP);
6026
+ const headY = SEQ_EDGE + SEQ_HEAD;
6027
+ const rowY = (i) => headY + SEQ_ROW_PAD + i * SEQ_ROW;
6028
+ const \u6700\u7D42 = data.messages.length > 0 ? rowY(data.messages.length - 1) : headY;
6029
+ const bottom = \u6700\u7D42 + SEQ_ROW_PAD;
6030
+ const cx = (i) => gutter + colW / 2 + i * colW;
6031
+ const w = g4(cx(Math.max(0, data.actors.length - 1)) + colW / 2 + SEQ_EDGE);
6032
+ const h = g4(bottom + SEQ_EDGE);
6033
+ return { w, h, gutter, colW, headY, cx, rowY, bottom };
6034
+ }
6035
+ function SequenceBoardNode({
6036
+ node,
6037
+ stateValues
6038
+ }) {
6039
+ const data = node.sequenceData;
6040
+ if (!data) return /* @__PURE__ */ jsxRuntime.jsx("g", { "data-cdl-role": "sequence-board" });
6041
+ const m = sequenceBoardMetrics(data);
6042
+ const x = node.cx - node.w / 2;
6043
+ const y = node.cy - node.h / 2;
6044
+ const \u73FE\u5728 = (() => {
6045
+ if (!node.sequenceStep) return null;
6046
+ const v = Number.parseInt(interpolate(node.sequenceStep, stateValues ?? {}).trim(), 10);
6047
+ return Number.isFinite(v) ? v : null;
6048
+ })();
6049
+ const \u6731 = "var(--cdl-now, var(--cdl-tone-accent, #2d6a8f))";
6050
+ const \u58A8 = "var(--cdl-text-2, #4a5162)";
6051
+ const \u898B\u305F\u76EE = (i) => {
6052
+ if (\u73FE\u5728 === null) return { opacity: 1, color: \u6731 };
6053
+ if (i > \u73FE\u5728) return { opacity: 0, color: \u6731 };
6054
+ return i === \u73FE\u5728 ? { opacity: 1, color: \u6731 } : { opacity: 1, color: \u58A8 };
6055
+ };
6056
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "sequence-board", transform: `translate(${x} ${y})`, children: [
6057
+ data.bands.map((b, i) => {
6058
+ if (\u73FE\u5728 !== null && b.from > \u73FE\u5728) return null;
6059
+ const \u4E0B = \u73FE\u5728 === null ? b.to : Math.min(b.to, \u73FE\u5728);
6060
+ return /* @__PURE__ */ jsxRuntime.jsx(
6061
+ "rect",
6062
+ {
6063
+ "data-cdl-role": "sequence-band",
6064
+ x: m.cx(b.actor) - SEQ_BAND_W / 2,
6065
+ y: m.rowY(b.from) - SEQ_BAND_PAD / 2,
6066
+ width: SEQ_BAND_W,
6067
+ height: m.rowY(\u4E0B) - m.rowY(b.from) + SEQ_BAND_PAD,
6068
+ rx: 4,
6069
+ fill: \u6731,
6070
+ fillOpacity: 0.12
6071
+ },
6072
+ `band-${i}`
6073
+ );
6074
+ }),
6075
+ data.actors.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
6076
+ "line",
6077
+ {
6078
+ "data-cdl-role": "sequence-thread",
6079
+ x1: m.cx(i),
6080
+ y1: m.headY,
6081
+ x2: m.cx(i),
6082
+ y2: m.bottom,
6083
+ stroke: "var(--cdl-divider, #d4d4d8)",
6084
+ strokeWidth: 3
6085
+ },
6086
+ `thread-${i}`
6087
+ )),
6088
+ data.actors.map((a, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
6089
+ /* @__PURE__ */ jsxRuntime.jsx(
6090
+ "text",
6091
+ {
6092
+ "data-cdl-role": "sequence-actor",
6093
+ x: m.cx(i),
6094
+ y: SEQ_EDGE + 44,
6095
+ fontSize: SEQ_NAME,
6096
+ fontWeight: 700,
6097
+ textAnchor: "middle",
6098
+ fill: "var(--cdl-text, #1a1f2a)",
6099
+ style: { fontFamily: "'JetBrains Mono', monospace" },
6100
+ children: a.name
6101
+ }
6102
+ ),
6103
+ a.subtitle && /* @__PURE__ */ jsxRuntime.jsx(
6104
+ "text",
6105
+ {
6106
+ "data-cdl-role": "sequence-actor-subtitle",
6107
+ x: m.cx(i),
6108
+ y: SEQ_EDGE + 76,
6109
+ fontSize: SEQ_SUB,
6110
+ textAnchor: "middle",
6111
+ fill: "var(--cdl-text-dim, #5a6270)",
6112
+ children: a.subtitle
6113
+ }
6114
+ )
6115
+ ] }, `head-${i}`)),
6116
+ /* @__PURE__ */ jsxRuntime.jsx(
6117
+ "line",
6118
+ {
6119
+ "data-cdl-role": "sequence-rule",
6120
+ x1: SEQ_EDGE,
6121
+ y1: m.headY,
6122
+ x2: m.w - SEQ_EDGE,
6123
+ y2: m.headY,
6124
+ stroke: "var(--cdl-divider, #d4d4d8)",
6125
+ strokeWidth: 2
6126
+ }
6127
+ ),
6128
+ data.messages.map((msg, i) => /* @__PURE__ */ jsxRuntime.jsx(SequenceRow, { msg, yy: m.rowY(i), cx: m.cx, ...\u898B\u305F\u76EE(i) }, `msg-${i}`))
5918
6129
  ] });
5919
6130
  }
6131
+ function SequenceRow({
6132
+ msg,
6133
+ yy,
6134
+ cx,
6135
+ opacity,
6136
+ color
6137
+ }) {
6138
+ const \u7834 = msg.kind === "return";
6139
+ const \u5857\u308B = msg.kind === "call";
6140
+ const \u51FA = cx(msg.from);
6141
+ const \u81EA\u5206\u3078 = msg.from === msg.to;
6142
+ const dir = \u81EA\u5206\u3078 ? 1 : Math.sign(cx(msg.to) - \u51FA);
6143
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "sequence-message", "data-cdl-message-kind": msg.kind, opacity, children: [
6144
+ /* @__PURE__ */ jsxRuntime.jsx(
6145
+ "text",
6146
+ {
6147
+ "data-cdl-role": "sequence-label",
6148
+ x: SEQ_EDGE + SEQ_GUTTER_PAD,
6149
+ y: yy + 8,
6150
+ fontSize: SEQ_LABEL,
6151
+ fontWeight: 500,
6152
+ fill: "var(--cdl-text, #1a1f2a)",
6153
+ children: msg.label
6154
+ }
6155
+ ),
6156
+ \u81EA\u5206\u3078 ? (
6157
+ // 自分宛て。 相手がいないので糸の右へ小さく回して戻る
6158
+ /* @__PURE__ */ jsxRuntime.jsx(
6159
+ "path",
6160
+ {
6161
+ "data-cdl-role": "sequence-line",
6162
+ d: `M ${\u51FA + 10} ${yy - 16} H ${\u51FA + SEQ_SELF_W - 16} Q ${\u51FA + SEQ_SELF_W} ${yy - 16} ${\u51FA + SEQ_SELF_W} ${yy} Q ${\u51FA + SEQ_SELF_W} ${yy + 16} ${\u51FA + SEQ_SELF_W - 16} ${yy + 16} H ${\u51FA + 22}`,
6163
+ fill: "none",
6164
+ stroke: color,
6165
+ strokeWidth: 2.5,
6166
+ strokeLinecap: "round"
6167
+ }
6168
+ )
6169
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
6170
+ "path",
6171
+ {
6172
+ "data-cdl-role": "sequence-line",
6173
+ d: `M ${\u51FA + dir * 12} ${yy} H ${cx(msg.to) - dir * 14}`,
6174
+ fill: "none",
6175
+ stroke: color,
6176
+ strokeWidth: 2.5,
6177
+ strokeLinecap: "round",
6178
+ strokeDasharray: \u7834 ? "10 8" : void 0
6179
+ }
6180
+ ),
6181
+ /* @__PURE__ */ jsxRuntime.jsx(
6182
+ Arrow,
6183
+ {
6184
+ x: \u81EA\u5206\u3078 ? \u51FA + 14 : cx(msg.to),
6185
+ y: \u81EA\u5206\u3078 ? yy + 16 : yy,
6186
+ dir: \u81EA\u5206\u3078 ? -1 : dir,
6187
+ filled: \u5857\u308B,
6188
+ color
6189
+ }
6190
+ ),
6191
+ /* @__PURE__ */ jsxRuntime.jsx(
6192
+ "circle",
6193
+ {
6194
+ "data-cdl-role": "sequence-source",
6195
+ cx: \u51FA,
6196
+ cy: \u81EA\u5206\u3078 ? yy - 16 : yy,
6197
+ r: SEQ_DOT,
6198
+ fill: color
6199
+ }
6200
+ )
6201
+ ] });
6202
+ }
6203
+ function Arrow({
6204
+ x,
6205
+ y,
6206
+ dir,
6207
+ filled,
6208
+ color
6209
+ }) {
6210
+ const \u4E08 = 18;
6211
+ const \u534A = 8.5;
6212
+ const \u5148 = x;
6213
+ const \u80F4 = x - dir * \u4E08;
6214
+ return filled ? /* @__PURE__ */ jsxRuntime.jsx(
6215
+ "path",
6216
+ {
6217
+ "data-cdl-role": "sequence-head",
6218
+ "data-cdl-head-fill": "solid",
6219
+ d: `M ${\u5148} ${y} L ${\u80F4} ${y - \u534A} L ${\u80F4} ${y + \u534A} Z`,
6220
+ fill: color,
6221
+ stroke: color,
6222
+ strokeWidth: 3,
6223
+ strokeLinejoin: "round"
6224
+ }
6225
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
6226
+ "path",
6227
+ {
6228
+ "data-cdl-role": "sequence-head",
6229
+ "data-cdl-head-fill": "open",
6230
+ d: `M ${\u80F4} ${y - \u534A} L ${\u5148} ${y} L ${\u80F4} ${y + \u534A}`,
6231
+ fill: "none",
6232
+ stroke: color,
6233
+ strokeWidth: 2.5,
6234
+ strokeLinecap: "round",
6235
+ strokeLinejoin: "round"
6236
+ }
6237
+ );
6238
+ }
5920
6239
  function EventNode({
5921
6240
  node,
5922
6241
  active,
@@ -6018,6 +6337,29 @@ function FunctionNode({ node, active }) {
6018
6337
  node.subtitle && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 126, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
6019
6338
  ] });
6020
6339
  }
6340
+ var ROW_GLYPH_HALF = 7;
6341
+ var ROW_GLYPH_CX = ROW_PAD_X_PX + ROW_GLYPH_HALF + 1;
6342
+ var ROW_GLYPH_LEAD = 40;
6343
+ var ROW_TYPE_FONT = 22;
6344
+ var SUBTITLE_BASELINE = 118;
6345
+ var SUBTITLE_FONT = 20;
6346
+ var UNDERLINE_DROP = 7;
6347
+ function RowGlyph({ mark, x, y, color }) {
6348
+ const \u534A = ROW_GLYPH_HALF;
6349
+ const d = mark.shape === "square" ? `M ${x - \u534A} ${y - \u534A} H ${x + \u534A} V ${y + \u534A} H ${x - \u534A} Z` : `M ${x - \u534A} ${y - \u534A} L ${x + \u534A} ${y} L ${x - \u534A} ${y + \u534A} Z`;
6350
+ return /* @__PURE__ */ jsxRuntime.jsx(
6351
+ "path",
6352
+ {
6353
+ "data-cdl-role": "node-row-glyph",
6354
+ "data-cdl-row-glyph": `${mark.shape}-${mark.filled ? "filled" : "hollow"}`,
6355
+ d,
6356
+ fill: mark.filled ? color : "var(--cdl-node-fill, #ffffff)",
6357
+ stroke: color,
6358
+ strokeWidth: mark.filled ? 0 : 2.4,
6359
+ strokeLinejoin: "round"
6360
+ }
6361
+ );
6362
+ }
6021
6363
  function StorageNode({
6022
6364
  node,
6023
6365
  active,
@@ -6027,7 +6369,7 @@ function StorageNode({
6027
6369
  const accent = nodeAccent(node, "var(--cdl-tone-accent, #2d6a8f)");
6028
6370
  const x = node.cx - node.w / 2;
6029
6371
  const y = node.cy - node.h / 2;
6030
- const \u540D\u524D = titlePlacement(node, { x: 26, y: STORAGE_TITLE_BASELINE, size: 22 }, { hasEyebrow: Boolean(node.eyebrow) });
6372
+ const \u540D\u524D = titlePlacement(node, { x: 26, y: STORAGE_TITLE_BASELINE, size: STORAGE_TITLE_FONT }, { hasEyebrow: Boolean(node.eyebrow) });
6031
6373
  const splits = rows.map((r) => splitRow(r));
6032
6374
  const leftMaxWidth = splits.reduce((m, s) => Math.max(m, displayWidth(s.left)), 0);
6033
6375
  const rightColX = ROW_PAD_X_PX + leftMaxWidth * STORAGE_CHAR_ADVANCE_PX + STORAGE_COL_GAP_PX;
@@ -6035,6 +6377,8 @@ function StorageNode({
6035
6377
  const leftEndDrawn = ROW_PAD_X_PX + leftMaxWidth * STORAGE_CHAR_ADVANCE_PX;
6036
6378
  const columnDividerX = (leftEndDrawn + rightColX) / 2;
6037
6379
  const columnDividerFits = columnDividerX <= node.w - ROW_PAD_X_PX;
6380
+ const \u5370\u3067\u5206\u3051\u308B = node.rowMarks !== void 0;
6381
+ const \u884C\u306E\u4E0B\u3052 = \u5370\u3067\u5206\u3051\u308B && node.subtitle ? SUBTITLE_ROW_SHIFT : 0;
6038
6382
  const lastRowBottom = Math.min(
6039
6383
  ROW_TOP_STORAGE + (rows.length - 1) * ROW_PITCH_STORAGE + (rowGlyphDepth("storage") ?? 0),
6040
6384
  node.h - ROW_PAD_X_PX
@@ -6055,6 +6399,19 @@ function StorageNode({
6055
6399
  }
6056
6400
  ),
6057
6401
  node.eyebrow && /* @__PURE__ */ jsxRuntime.jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6402
+ \u5370\u3067\u5206\u3051\u308B && node.subtitle && // 呼び名は **印で分ける箱でだけ** 出す (#578)。 従来の箱は題の下に区切り線が来るので
6403
+ // 置き場が無い
6404
+ /* @__PURE__ */ jsxRuntime.jsx(
6405
+ "text",
6406
+ {
6407
+ "data-cdl-role": "node-subtitle",
6408
+ x: ROW_PAD_X_PX,
6409
+ y: SUBTITLE_BASELINE,
6410
+ fontSize: SUBTITLE_FONT,
6411
+ fill: "var(--cdl-text-dim, #5a6270)",
6412
+ children: node.subtitle
6413
+ }
6414
+ ),
6058
6415
  /* @__PURE__ */ jsxRuntime.jsx(
6059
6416
  "text",
6060
6417
  {
@@ -6069,7 +6426,7 @@ function StorageNode({
6069
6426
  children: node.title
6070
6427
  }
6071
6428
  ),
6072
- rows.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
6429
+ rows.length > 0 && !\u5370\u3067\u5206\u3051\u308B && /* @__PURE__ */ jsxRuntime.jsx(
6073
6430
  "line",
6074
6431
  {
6075
6432
  "data-cdl-role": "node-row-divider",
@@ -6081,7 +6438,7 @@ function StorageNode({
6081
6438
  strokeWidth: 1.25
6082
6439
  }
6083
6440
  ),
6084
- rows.length > 0 && hasRightColumn && columnDividerFits && /* @__PURE__ */ jsxRuntime.jsx(
6441
+ rows.length > 0 && hasRightColumn && columnDividerFits && !\u5370\u3067\u5206\u3051\u308B && /* @__PURE__ */ jsxRuntime.jsx(
6085
6442
  "line",
6086
6443
  {
6087
6444
  "data-cdl-role": "node-column-divider",
@@ -6094,15 +6451,37 @@ function StorageNode({
6094
6451
  }
6095
6452
  ),
6096
6453
  splits.map((s, idx) => {
6097
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(0 ${rowBaselineY("storage", idx)})`, children: [
6454
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(0 ${(rowBaselineY("storage", idx) ?? 0) + \u884C\u306E\u4E0B\u3052})`, children: [
6455
+ \u5370\u3067\u5206\u3051\u308B && node.rowMarks?.[idx] != null && /* @__PURE__ */ jsxRuntime.jsx(
6456
+ RowGlyph,
6457
+ {
6458
+ mark: node.rowMarks[idx],
6459
+ x: ROW_GLYPH_CX,
6460
+ y: -8,
6461
+ color: "var(--cdl-text, #1a1f2a)"
6462
+ }
6463
+ ),
6464
+ \u5370\u3067\u5206\u3051\u308B && node.rowMarks?.[idx]?.underline === true && // 主キーの下線 (#578)。 印の 2 軸とは別の段に載るので、外部キーの山形と重ねられる
6465
+ /* @__PURE__ */ jsxRuntime.jsx(
6466
+ "line",
6467
+ {
6468
+ "data-cdl-role": "node-row-underline",
6469
+ x1: ROW_PAD_X_PX + ROW_GLYPH_LEAD,
6470
+ y1: UNDERLINE_DROP,
6471
+ x2: ROW_PAD_X_PX + ROW_GLYPH_LEAD + displayWidth(s.left) * STORAGE_CHAR_ADVANCE_PX,
6472
+ y2: UNDERLINE_DROP,
6473
+ stroke: "var(--cdl-text, #1a1f2a)",
6474
+ strokeWidth: 2
6475
+ }
6476
+ ),
6098
6477
  /* @__PURE__ */ jsxRuntime.jsx(
6099
6478
  "text",
6100
6479
  {
6101
6480
  "data-cdl-role": "node-row",
6102
6481
  "data-cdl-row-index": idx,
6103
- x: ROW_PAD_X_PX,
6482
+ x: \u5370\u3067\u5206\u3051\u308B ? ROW_PAD_X_PX + ROW_GLYPH_LEAD : ROW_PAD_X_PX,
6104
6483
  fontSize: 26,
6105
- fontWeight: 600,
6484
+ fontWeight: \u5370\u3067\u5206\u3051\u308B ? 500 : 600,
6106
6485
  fill: "var(--cdl-text, #1a1f2a)",
6107
6486
  style: { fontFamily: "'JetBrains Mono', monospace" },
6108
6487
  children: s.left
@@ -6113,11 +6492,11 @@ function StorageNode({
6113
6492
  {
6114
6493
  "data-cdl-role": "node-row",
6115
6494
  "data-cdl-row-index": idx,
6116
- x: rightColX,
6117
- fontSize: 26,
6118
- fontWeight: highlightRows ? 700 : 600,
6119
- textAnchor: "start",
6120
- fill: highlightRows ? accent : "var(--cdl-text, #1a1f2a)",
6495
+ x: \u5370\u3067\u5206\u3051\u308B ? node.w - ROW_PAD_X_PX : rightColX,
6496
+ fontSize: \u5370\u3067\u5206\u3051\u308B ? ROW_TYPE_FONT : 26,
6497
+ fontWeight: \u5370\u3067\u5206\u3051\u308B ? 500 : highlightRows ? 700 : 600,
6498
+ textAnchor: \u5370\u3067\u5206\u3051\u308B ? "end" : "start",
6499
+ fill: \u5370\u3067\u5206\u3051\u308B ? "var(--cdl-text-dim, #5a6270)" : highlightRows ? accent : "var(--cdl-text, #1a1f2a)",
6121
6500
  style: { fontFamily: "'JetBrains Mono', monospace" },
6122
6501
  children: s.right
6123
6502
  }
@@ -13515,6 +13894,9 @@ function CdlNodeView({
13515
13894
  return /* @__PURE__ */ jsxRuntime.jsx(EventNode, { node: resolvedNode, active, progress });
13516
13895
  case "card":
13517
13896
  return /* @__PURE__ */ jsxRuntime.jsx(CardNode, { node: resolvedNode, active });
13897
+ // 時系列のやり取り (#578)。 1 つの箱が図を丸ごと描く = 縦が時間で、参加者は箱を持たない
13898
+ case "sequence-board":
13899
+ return /* @__PURE__ */ jsxRuntime.jsx(SequenceBoardNode, { node: resolvedNode, stateValues });
13518
13900
  // 図表 9 種は payload が `{signal}` を取れるので stateValues を渡す
13519
13901
  // (`render/payload-binding.ts` が描画直前に解決する)。 取れる欄は種別で違い、
13520
13902
  // 数と語を取る 7 種に対し、mind-map / tree-hierarchy は **名前だけ** を取る (#467)。
@@ -13842,36 +14224,47 @@ function CdlStage({
13842
14224
  /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
13843
14225
  Object.entries(TONE).flatMap(
13844
14226
  ([tone, color]) => [["", 14], ["-sm", 10]].flatMap(
13845
- ([suffix, size]) => EDGE_HEADS.map((head) => {
13846
- const \u5F62 = EDGE_HEAD_SHAPE[head];
13847
- return /* @__PURE__ */ jsxRuntime.jsx(
13848
- "marker",
13849
- {
13850
- id: edgeHeadMarkerId(tone, head, suffix === "-sm"),
13851
- viewBox: "0 0 10 10",
13852
- refX: \u5F62.refX,
13853
- refY: "5",
13854
- markerWidth: size,
13855
- markerHeight: size,
13856
- markerUnits: "userSpaceOnUse",
13857
- orient: "auto-start-reverse",
13858
- children: /* @__PURE__ */ jsxRuntime.jsx(
13859
- "path",
14227
+ ([suffix, size]) => EDGE_HEADS.flatMap(
14228
+ (head) => (
14229
+ // 塗り方は形と別の軸 (#578)。 塗らない形では 2 つが同じ名前に畳まれるので、
14230
+ // `edgeHeadMarkerId` が返す名前で重複を外す
14231
+ EDGE_HEAD_FILLS.map((fill) => {
14232
+ const \u5F62 = EDGE_HEAD_SHAPE[head];
14233
+ const id = edgeHeadMarkerId(tone, head, suffix === "-sm", fill);
14234
+ if (\u5F62.d === "") return null;
14235
+ if (fill !== EDGE_HEAD_FILL_DEFAULT && !\u5F62.filled) return null;
14236
+ const \u5857 = edgeHeadPaint(head, fill, color);
14237
+ return /* @__PURE__ */ jsxRuntime.jsx(
14238
+ "marker",
13860
14239
  {
13861
- "data-cdl-role": "edge-arrowhead",
13862
- "data-cdl-edge-head": head,
13863
- d: \u5F62.d,
13864
- fill: \u5F62.filled ? color : "none",
13865
- stroke: \u5F62.filled ? "none" : color,
13866
- strokeWidth: \u5F62.filled ? void 0 : 1.6,
13867
- strokeLinecap: \u5F62.filled ? void 0 : "round",
13868
- strokeLinejoin: \u5F62.filled ? void 0 : "round"
13869
- }
13870
- )
13871
- },
13872
- `${tone}${suffix}-${head}`
13873
- );
13874
- })
14240
+ id,
14241
+ viewBox: `0 0 ${\u5F62.w} ${\u5F62.h}`,
14242
+ refX: \u5F62.refX,
14243
+ refY: \u5F62.h / 2,
14244
+ markerWidth: size * (\u5F62.scale ?? 1) * \u5F62.w / \u5F62.h,
14245
+ markerHeight: size * (\u5F62.scale ?? 1),
14246
+ markerUnits: "userSpaceOnUse",
14247
+ orient: "auto-start-reverse",
14248
+ children: /* @__PURE__ */ jsxRuntime.jsx(
14249
+ "path",
14250
+ {
14251
+ "data-cdl-role": "edge-arrowhead",
14252
+ "data-cdl-edge-head": head,
14253
+ "data-cdl-edge-head-fill": fill,
14254
+ d: \u5F62.d,
14255
+ fill: \u5857.fill,
14256
+ stroke: \u5857.stroke,
14257
+ strokeWidth: \u5857.strokeWidth,
14258
+ strokeLinecap: \u5857.strokeWidth === void 0 ? void 0 : "round",
14259
+ strokeLinejoin: \u5857.strokeWidth === void 0 ? void 0 : "round"
14260
+ }
14261
+ )
14262
+ },
14263
+ id
14264
+ );
14265
+ })
14266
+ )
14267
+ )
13875
14268
  )
13876
14269
  ),
13877
14270
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -23551,6 +23944,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
23551
23944
  if (!isRenderedNode(n)) continue;
23552
23945
  for (const row of n.rows) {
23553
23946
  if (DIVIDER_ONLY.test(row)) continue;
23947
+ if (n.rowMarks !== void 0) continue;
23554
23948
  if (!ROW_FORMAT.test(row)) {
23555
23949
  push("row-format", `node "${n.id}" row "${row}" \u304C "key: value" \u5F62\u5F0F\u3067\u306A\u3044`);
23556
23950
  }
@@ -24941,7 +25335,16 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
24941
25335
  const maxGap = Math.max(...gaps);
24942
25336
  const minGap = Math.min(...gaps);
24943
25337
  const variance = maxGap - minGap;
24944
- if (variance > COLUMN_GAP_VARIANCE_TOL) {
25338
+ const \u683C\u5B50\u306B\u7F6E\u304F = group.every((n) => n.rowMarks !== void 0);
25339
+ const \u7AEF\u304C\u8DB3\u308A\u3066\u3044\u308B = minGap >= requiredNearClearance("node", "node");
25340
+ if (\u683C\u5B50\u306B\u7F6E\u304F) {
25341
+ if (!\u7AEF\u304C\u8DB3\u308A\u3066\u3044\u308B) {
25342
+ push(
25343
+ "column-gap-uniform",
25344
+ `lane "${laneId}" \u5185 node \u9593\u306E\u7AEF\u9593 gap ${minGap.toFixed(0)} world \u304C\u4E0B\u9650 ${requiredNearClearance("node", "node")} \u3092\u5272\u308B`
25345
+ );
25346
+ }
25347
+ } else if (variance > COLUMN_GAP_VARIANCE_TOL) {
24945
25348
  push(
24946
25349
  "column-gap-uniform",
24947
25350
  `lane "${laneId}" \u5185 node \u9593\u306E\u7AEF\u9593 gap variance ${variance.toFixed(1)} world \u304C spec ${COLUMN_GAP_VARIANCE_TOL} \u8D85\u904E (min=${minGap.toFixed(0)} max=${maxGap.toFixed(0)})`