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