@cardenelabs/cdl 0.116.0 → 0.117.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cardenelabs/cdl",
3
- "version": "0.116.0",
3
+ "version": "0.117.0",
4
4
  "description": "CDL (Chainome Diagram Language). Mermaid-like declarative DSL that compiles to animated SVG diagrams. Built for blockchain / Solidity flows, generic enough for sequence / flow / state / ER / topology diagrams.",
5
5
  "license": "MIT",
6
6
  "author": "cardene777",
@@ -1945,6 +1945,21 @@ function visualValidateInner(
1945
1945
  }
1946
1946
  }
1947
1947
 
1948
+ /**
1949
+ * 位置を手で書いた箱か (#972)。
1950
+ *
1951
+ * `posX` と `posY` を **両方** 書いた箱は、自動の配置の並びから外して置くためにある
1952
+ * (`types.ts` の `posX` の説明が「置いた位置に置く」 と定める)。 揃っていないこと自体が
1953
+ * 書き手の指定なので、揃えを見る軸の判定から外す。
1954
+ *
1955
+ * 軸 15 (`lane-cx-consistency`) が同じ条件を先に持っており、その 1 行をここへ括り出した。
1956
+ * **片方だけ書いた箱は外さない** = 片方だけでは自動の配置が生きており、並びから外す指定に
1957
+ * ならない (採用の条件も `posX !== undefined && posY !== undefined` で揃えてある)。
1958
+ */
1959
+ function 位置を手で書いた(n: { posX?: number; posY?: number }): boolean {
1960
+ return n.posX !== undefined && n.posY !== undefined;
1961
+ }
1962
+
1948
1963
  function runAxes(
1949
1964
  laid: LaidDiagram,
1950
1965
  diag: CdlDiagram,
@@ -2087,8 +2102,12 @@ function runAxes(
2087
2102
  // ───────────────────────────────────────────────────────────
2088
2103
  // Axis 5: alignment (同 lane 内 node の cx 一致)
2089
2104
  // ───────────────────────────────────────────────────────────
2105
+ //
2106
+ // 位置を手で書いた箱は判定にも基準にも使わない (#972)。 **基準から先に外す** =
2107
+ // 先頭の 1 つが手で置かれていると、自動で置いた箱が全部その位置と比べられて落ちる。
2090
2108
  const byLane = new Map<string, typeof laid.nodes>();
2091
2109
  for (const n of laid.nodes) {
2110
+ if (位置を手で書いた(n)) continue;
2092
2111
  const list = byLane.get(n.lane) ?? [];
2093
2112
  list.push(n);
2094
2113
  byLane.set(n.lane, list);
@@ -2691,11 +2710,13 @@ function runAxes(
2691
2710
  // positive-check 経路 (両者 同 tolerance を持つが、 SSOT 経由で spec-driven 判定にする)。
2692
2711
  //
2693
2712
  // spacer / lifeline は intentional な cx 差を持つので判定対象外。
2713
+ // 位置を手で書いた箱も同じ理由で外す (#972、 軸 5 と同じ条件)。
2694
2714
  // ───────────────────────────────────────────────────────────
2695
2715
  {
2696
2716
  const byLaneCol = new Map<string, LaidDiagram["nodes"]>();
2697
2717
  for (const n of laid.nodes) {
2698
2718
  if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
2719
+ if (位置を手で書いた(n)) continue;
2699
2720
  const list = byLaneCol.get(n.lane) ?? [];
2700
2721
  list.push(n);
2701
2722
  byLaneCol.set(n.lane, list);
@@ -2846,7 +2867,7 @@ function runAxes(
2846
2867
  if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
2847
2868
  // 座標を明示した node は lane 中心から外れているのが指定どおりの状態なので対象外。
2848
2869
  // 「lane 中心と一致しない」 を症状として報告すると、 意図した配置が毎回 warn になる。
2849
- if (n.posX !== undefined && n.posY !== undefined) continue;
2870
+ if (位置を手で書いた(n)) continue;
2850
2871
  const lane = laneById.get(n.lane);
2851
2872
  if (!lane) continue;
2852
2873
  const laneCx = lane.x + lane.width / 2;