@cardenelabs/cdl 0.70.0 → 0.71.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/CHANGELOG.md CHANGED
@@ -5,11 +5,45 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.71.0] - 2026-09-26
9
+
10
+ ### Added
11
+
12
+ - **分かれ道の図で並べる向きを選べるようにした** (#880 / #881)
13
+
14
+ 分かれ道の図 (`flowchart`) の入口は縦列を横に並べる形に固定で、向きを選べなかった。
15
+ 使う側 ([cardene777/dragon](https://github.com/cardene777/dragon)) は記法に `direction` を
16
+ 持ち、`flow` と `swimlane` では効くのに、分かれ道の図では知らせが出て効かなかった。
17
+
18
+ `FlowchartPreset` に `direction` を足す。
19
+
20
+ | 値 | 並び | 役割の見せ方 |
21
+ |---|---|---|
22
+ | `horizontal` (既定) | 今のまま。 縦列を横に並べ、箱をその中に上から積む | 縦列の見出し |
23
+ | `vertical` | 縦列 1 本に全部の箱を書いた順で積む | 箱の上の小さな字 |
24
+
25
+ `vertical` は縦列を 1 本しか作らないため、役割の名前を出す場所が無くなる。
26
+ 黙って消すと書いた `lane` が図から読めなくなるので、箱の上の小さな字へ移す。
27
+
28
+ ```
29
+ 横に並べる ... 箱の上は 判断 (役割は縦列の見出し 承認者)
30
+ 縦に積む ... 箱の上は 承認者 · 判断
31
+ ```
32
+
33
+ 縦列を 1 つしか書いていない図では足さない (全部の箱に同じ字が並ぶだけ)。
34
+ 1 本の縦列に見出しも付けない = 役割が 1 つに畳まれるので、どれか 1 つを見出しにすると
35
+ 他の役割の箱にもその名前が掛かって読める。
36
+
37
+ **縦列を横の帯にして縦に積む形は持たない**。 配置は格子で、縦列が横の位置を、段が縦の
38
+ 位置を決める。 帯にするには軸の入れ替えが要り、入口の option では足りない。
39
+
40
+ 既定は変えていない。 向きを渡さない図は 1 枚も並びが動かない (対照で確認)。
41
+
8
42
  ## [0.70.0] - 2026-09-26
9
43
 
10
44
  ### Fixed
11
45
 
12
- - **箱の読み取り値を右端へ寄せ、縦の矢印が数字を割らないようにした** (#870)
46
+ - **箱の読み取り値を右端へ寄せ、縦の矢印が数字を割らないようにした** (#870 / #879)
13
47
 
14
48
  箱に読み取り値 (`10 / 10` のような現在値と上限) を書くと、値は箱の上端の中央に出る。
15
49
  同じ帯の上下に置いた箱を矢印で繋ぐと、道筋は受け手の上端の中央へ真下から入る。
@@ -2968,7 +3002,9 @@ Initial OSS release.
2968
3002
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
2969
3003
  行き止まりになる。
2970
3004
 
2971
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.69.0...HEAD
3005
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.71.0...HEAD
3006
+ [0.71.0]: https://github.com/cardene777/cdl/compare/v0.70.0...v0.71.0
3007
+ [0.70.0]: https://github.com/cardene777/cdl/compare/v0.69.0...v0.70.0
2972
3008
  [0.69.0]: https://github.com/cardene777/cdl/compare/v0.68.0...v0.69.0
2973
3009
  [0.68.0]: https://github.com/cardene777/cdl/compare/v0.67.0...v0.68.0
2974
3010
  [0.67.0]: https://github.com/cardene777/cdl/compare/v0.66.0...v0.67.0
package/dist/index.cjs CHANGED
@@ -33621,30 +33621,39 @@ var SHAPE_EYEBROW = {
33621
33621
  end: "\u7D42\u4E86",
33622
33622
  loop: "\u7E70\u308A\u8FD4\u3057"
33623
33623
  };
33624
+ var VERTICAL_LANE_ID = "flowchart-main";
33624
33625
  function flowchart(preset) {
33625
33626
  const laneW = preset.laneWidth ?? 380;
33626
33627
  const tone = preset.defaultTone ?? "accent";
33628
+ const \u7E26\u306B\u7A4D\u3080 = (preset.direction ?? "horizontal") === "vertical";
33627
33629
  const b = diagram(preset.id, { topic: preset.topic, type: "flowchart" });
33628
33630
  const laneToId = /* @__PURE__ */ new Map();
33629
33631
  const laneStackCount = /* @__PURE__ */ new Map();
33630
- for (const label of preset.lanes) {
33631
- const id = slugify(label) || `lane-${laneToId.size}`;
33632
- laneToId.set(label, id);
33633
- laneStackCount.set(id, 0);
33634
- b.lane(id, { width: laneW, label });
33632
+ if (\u7E26\u306B\u7A4D\u3080) {
33633
+ b.lane(VERTICAL_LANE_ID, { width: laneW });
33634
+ laneStackCount.set(VERTICAL_LANE_ID, 0);
33635
+ } else {
33636
+ for (const label of preset.lanes) {
33637
+ const id = slugify(label) || `lane-${laneToId.size}`;
33638
+ laneToId.set(label, id);
33639
+ laneStackCount.set(id, 0);
33640
+ b.lane(id, { width: laneW, label });
33641
+ }
33635
33642
  }
33636
33643
  const phaseActivate = [];
33637
33644
  let edgeIdx = 0;
33645
+ const \u5F79\u5272\u3092\u8DB3\u3059 = \u7E26\u306B\u7A4D\u3080 && preset.lanes.length >= 2;
33646
+ const \u7BB1\u306E\u4E0A\u306E\u5B57 = (n) => \u5F79\u5272\u3092\u8DB3\u3059 ? `${n.lane} \xB7 ${SHAPE_EYEBROW[n.shape]}` : SHAPE_EYEBROW[n.shape];
33638
33647
  const api = {
33639
33648
  node(n) {
33640
- const laneId = laneToId.get(n.lane) ?? n.lane;
33649
+ const laneId = \u7E26\u306B\u7A4D\u3080 ? VERTICAL_LANE_ID : laneToId.get(n.lane) ?? n.lane;
33641
33650
  const stack = laneStackCount.get(laneId) ?? 0;
33642
33651
  b.node(n.id, {
33643
33652
  lane: laneId,
33644
33653
  stack,
33645
33654
  kind: SHAPE_KIND[n.shape],
33646
33655
  title: n.title,
33647
- eyebrow: SHAPE_EYEBROW[n.shape]
33656
+ eyebrow: \u7BB1\u306E\u4E0A\u306E\u5B57(n)
33648
33657
  });
33649
33658
  laneStackCount.set(laneId, stack + 1);
33650
33659
  phaseActivate.push(n.id);