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