@cardenelabs/cdl 0.28.0 → 0.29.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,6 +5,35 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.29.0] - 2026-09-04
9
+
10
+ ### Added
11
+
12
+ - **図の種類を絵の根に出すようにした** (#645)
13
+
14
+ これまで絵の根に出ていたのは `data-cdl-stage` と `data-cdl-scale` と `data-cdl-palette` の
15
+ 3 つだけで、図の種類が出ていなかった。 そのため消費側が図の種類で描き分けられない。
16
+
17
+ 実際に困った例は、消費側の dragon でクラス図の関係の線だけを太くしようとした時。
18
+ 線の規則は `[data-cdl-role="edge-line"]` 1 つしかなく、直すと ER 図 ・ 状態遷移図 ・
19
+ 流れ図 ・ 並び図 の線まで同時に太くなる。
20
+
21
+ `data-cdl-palette` では選び分けられない = クラス図と ER 図がどちらも `kinari` を出すため。
22
+
23
+ `palette` (#1553) と同じ形にした = **cdl は名前だけを出し、見た目は消費側が決める**。
24
+ 値を engine に持たせると、消費側が表現を変えるたびに engine の release が要る。
25
+
26
+ 種類名は組み立て器の名前をそのまま小文字で使う。 例外は 4 件。
27
+
28
+ | 組み立て器 | 種類名 | なぜ |
29
+ |---|---|---|
30
+ | `classDiagram` | `class` | 消費側の記法が `class` を使う |
31
+ | `userJourney` | `journey` | 同上 |
32
+ | `mindMap` | `mindmap` | 大文字小文字を混ぜない |
33
+ | `stateMachine` と `stateMachine2` | どちらも `state` | 後者は入れ子と動作を足した拡張で、図の種類としては同じ |
34
+
35
+ 組み立て器を通さず `diagram()` を直に呼んだ図と、空文字を渡した図には属性を出さない。
36
+
8
37
  ## [0.28.0] - 2026-09-04
9
38
 
10
39
  ### Changed
@@ -1411,7 +1440,8 @@ Initial OSS release.
1411
1440
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
1412
1441
  行き止まりになる。
1413
1442
 
1414
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.28.0...HEAD
1443
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.29.0...HEAD
1444
+ [0.29.0]: https://github.com/cardene777/cdl/compare/v0.28.0...v0.29.0
1415
1445
  [0.28.0]: https://github.com/cardene777/cdl/compare/v0.27.0...v0.28.0
1416
1446
  [0.27.0]: https://github.com/cardene777/cdl/compare/v0.26.0...v0.27.0
1417
1447
  [0.26.0]: https://github.com/cardene777/cdl/compare/v0.25.0...v0.26.0
package/dist/index.cjs CHANGED
@@ -11486,6 +11486,8 @@ function diagram(id, options) {
11486
11486
  ...options.structuredData === "exclude" ? { structuredData: "exclude" } : {},
11487
11487
  // 配色の名前は素通しする。 空文字の遮断は `layout` が持つ (後段が必ず通るため)
11488
11488
  ...options.palette !== void 0 ? { palette: options.palette } : {},
11489
+ // 種類の名前も同じ経路で渡し、空文字の扱いを `layout` の 1 箇所に揃える
11490
+ ...options.type !== void 0 ? { type: options.type } : {},
11489
11491
  // inputs / formulas / scrollTriggers / eventBindings は空なら省略 (static diagram の JSON 形状維持)
11490
11492
  ...inputs.length > 0 ? { inputs: [...inputs] } : {},
11491
11493
  ...formulas.length > 0 ? { formulas: [...formulas] } : {},
@@ -20282,6 +20284,8 @@ function layout(diag) {
20282
20284
  // **遮断はここだけに置く**。 描画は必ず組み立てを通り、組み立て API も `er` も
20283
20285
  // 素通しにしてある。 上流にも置くと、どの入力でも通らない分岐が残る
20284
20286
  ...diag.palette ? { palette: diag.palette } : {},
20287
+ // 種類も配色と同じく空の目印を出さない。 遮断をここに揃えると手書きの図にも効く
20288
+ ...diag.type ? { type: diag.type } : {},
20285
20289
  bboxes,
20286
20290
  collisions,
20287
20291
  nearCollisions,
@@ -29701,6 +29705,7 @@ function CdlStage({
29701
29705
  "data-cdl-stage": "",
29702
29706
  "data-cdl-scale": diagramScale === 1 ? void 0 : diagramScale,
29703
29707
  "data-cdl-palette": laid.palette,
29708
+ "data-cdl-type": laid.type,
29704
29709
  children: [
29705
29710
  /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
29706
29711
  Object.entries(TONE).flatMap(
@@ -30370,7 +30375,7 @@ function fitRowsWidth(boxW, rows) {
30370
30375
  }
30371
30376
  function swimlane(preset) {
30372
30377
  const w = preset.laneWidth ?? 400;
30373
- const b = diagram(preset.id, { topic: preset.topic });
30378
+ const b = diagram(preset.id, { topic: preset.topic, type: "swimlane" });
30374
30379
  const labelToId = /* @__PURE__ */ new Map();
30375
30380
  const idsInOrder = [];
30376
30381
  for (const label of preset.lanes) {
@@ -30390,7 +30395,7 @@ function swimlane(preset) {
30390
30395
  }
30391
30396
  function flow(preset) {
30392
30397
  const w = preset.laneWidth ?? 400;
30393
- const b = diagram(preset.id, { topic: preset.topic });
30398
+ const b = diagram(preset.id, { topic: preset.topic, type: "flow" });
30394
30399
  b.lane("flow", { width: w, ...preset.laneLabel ? { label: preset.laneLabel } : {} });
30395
30400
  const tone = preset.defaultTone ?? "accent";
30396
30401
  const style = preset.defaultStyle ?? "dotted-flow";
@@ -30451,7 +30456,7 @@ var SEQUENCE_MESSAGE_LOOK = {
30451
30456
  };
30452
30457
  function sequence(preset) {
30453
30458
  const tone = preset.defaultTone ?? "accent";
30454
- const b = diagram(preset.id, { topic: preset.topic });
30459
+ const b = diagram(preset.id, { topic: preset.topic, type: "sequence" });
30455
30460
  const \u9762\u3005 = preset.actors.map(
30456
30461
  (a) => typeof a === "string" ? { name: a } : { name: a.name, ...a.subtitle ? { subtitle: a.subtitle } : {} }
30457
30462
  );
@@ -30506,7 +30511,7 @@ function topology(preset) {
30506
30511
  const groupW = preset.groupWidth ?? 460;
30507
30512
  const tone = preset.defaultTone ?? "accent";
30508
30513
  const style = preset.defaultStyle ?? "solid";
30509
- const b = diagram(preset.id, { topic: preset.topic });
30514
+ const b = diagram(preset.id, { topic: preset.topic, type: "topology" });
30510
30515
  const groupOrder = [];
30511
30516
  const groupStackCount = /* @__PURE__ */ new Map();
30512
30517
  const phaseActivate = [];
@@ -30575,7 +30580,7 @@ function er(preset) {
30575
30580
  const entityW = resolveStorageBoxW(preset.entityWidth, "er", "entityWidth");
30576
30581
  const tone = preset.defaultTone ?? "info";
30577
30582
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30578
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30583
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "er" });
30579
30584
  const entities = [];
30580
30585
  const phaseActivate = [];
30581
30586
  let relIdx = 0;
@@ -30661,7 +30666,7 @@ var FSM_ACTION_MARK = {
30661
30666
  function stateMachine(preset) {
30662
30667
  const stateW = resolveStateW(preset.stateWidth, "stateMachine");
30663
30668
  const tone = preset.defaultTone ?? "accent";
30664
- const b = diagram(preset.id, { topic: preset.topic });
30669
+ const b = diagram(preset.id, { topic: preset.topic, type: "state" });
30665
30670
  const phaseActivate = [];
30666
30671
  const stateOrder = /* @__PURE__ */ new Map();
30667
30672
  const \u72B6\u614B = [];
@@ -30773,7 +30778,7 @@ function infrastructure(preset) {
30773
30778
  const laneW = preset.laneWidth ?? 380;
30774
30779
  const tone = preset.defaultTone ?? "accent";
30775
30780
  const style = preset.defaultStyle ?? "solid";
30776
- const b = diagram(preset.id, { topic: preset.topic });
30781
+ const b = diagram(preset.id, { topic: preset.topic, type: "infrastructure" });
30777
30782
  const colLaneIds = /* @__PURE__ */ new Map();
30778
30783
  const phaseActivate = [];
30779
30784
  let connIdx = 0;
@@ -30854,7 +30859,7 @@ function classDiagram(preset) {
30854
30859
  const classW = resolveStorageBoxW(preset.classWidth, "classDiagram", "classWidth");
30855
30860
  const \u56F3\u306E\u65E2\u5B9A = preset.defaultTone;
30856
30861
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30857
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30862
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "class" });
30858
30863
  const classes = [];
30859
30864
  const phaseActivate = [];
30860
30865
  const \u7BB1 = [];
@@ -30941,7 +30946,7 @@ function classDiagram(preset) {
30941
30946
  function tree(preset) {
30942
30947
  const canvasW = preset.nodeWidth ? preset.nodeWidth * 2 : 720;
30943
30948
  const canvasH = 480;
30944
- const b = diagram(preset.id, { topic: preset.topic });
30949
+ const b = diagram(preset.id, { topic: preset.topic, type: "tree" });
30945
30950
  const treeNodes = [];
30946
30951
  const api = {
30947
30952
  node(n) {
@@ -30979,7 +30984,7 @@ function tree(preset) {
30979
30984
  function userJourney(preset) {
30980
30985
  const canvasW = preset.stepWidth ? preset.stepWidth * 2 : 720;
30981
30986
  const canvasH = 480;
30982
- const b = diagram(preset.id, { topic: preset.topic });
30987
+ const b = diagram(preset.id, { topic: preset.topic, type: "journey" });
30983
30988
  const steps = [];
30984
30989
  const api = {
30985
30990
  step(s) {
@@ -31018,7 +31023,7 @@ function userJourney(preset) {
31018
31023
  function mindMap(preset) {
31019
31024
  const canvasW = preset.branchWidth ? preset.branchWidth * 2 : 720;
31020
31025
  const canvasH = 480;
31021
- const b = diagram(preset.id, { topic: preset.topic });
31026
+ const b = diagram(preset.id, { topic: preset.topic, type: "mindmap" });
31022
31027
  const branches = [];
31023
31028
  const api = {
31024
31029
  branch(br) {
@@ -31062,7 +31067,7 @@ function mindMap(preset) {
31062
31067
  function funnel(preset) {
31063
31068
  const canvasW = toGridSize(preset.stageWidth ?? 560);
31064
31069
  const canvasH = 480;
31065
- const b = diagram(preset.id, { topic: preset.topic });
31070
+ const b = diagram(preset.id, { topic: preset.topic, type: "funnel" });
31066
31071
  const stages = [];
31067
31072
  const api = {
31068
31073
  stage(s) {
@@ -31100,7 +31105,7 @@ function funnel(preset) {
31100
31105
  function quadrant(preset) {
31101
31106
  const canvasW = 640;
31102
31107
  const canvasH = 480;
31103
- const b = diagram(preset.id, { topic: preset.topic });
31108
+ const b = diagram(preset.id, { topic: preset.topic, type: "quadrant" });
31104
31109
  const items = [];
31105
31110
  const api = {
31106
31111
  item(it) {
@@ -31151,7 +31156,7 @@ function chart(preset) {
31151
31156
  const canvasH = toGridSize(
31152
31157
  preset.type === "pie" || preset.type === "gauge" || preset.type === "radial" || preset.type === "stat" || preset.type === "waffle" || preset.type === "stacked-bar" ? 320 : 360
31153
31158
  );
31154
- const b = diagram(preset.id, { topic: preset.topic });
31159
+ const b = diagram(preset.id, { topic: preset.topic, type: "chart" });
31155
31160
  const data = [];
31156
31161
  const kindMap = {
31157
31162
  line: "chart-line",
@@ -31200,7 +31205,7 @@ function gantt(preset) {
31200
31205
  const canvasW = preset.laneWidth ? preset.laneWidth * 2 : 720;
31201
31206
  const canvasH = 360;
31202
31207
  const tone = preset.defaultTone ?? "teal";
31203
- const b = diagram(preset.id, { topic: preset.topic });
31208
+ const b = diagram(preset.id, { topic: preset.topic, type: "gantt" });
31204
31209
  const tasks = [];
31205
31210
  const api = {
31206
31211
  task(t) {
@@ -31266,7 +31271,7 @@ var SHAPE_EYEBROW = {
31266
31271
  function flowchart(preset) {
31267
31272
  const laneW = preset.laneWidth ?? 380;
31268
31273
  const tone = preset.defaultTone ?? "accent";
31269
- const b = diagram(preset.id, { topic: preset.topic });
31274
+ const b = diagram(preset.id, { topic: preset.topic, type: "flowchart" });
31270
31275
  const laneToId = /* @__PURE__ */ new Map();
31271
31276
  const laneStackCount = /* @__PURE__ */ new Map();
31272
31277
  for (const label of preset.lanes) {
@@ -31327,7 +31332,7 @@ var NET_KIND_MAP = {
31327
31332
  function network(preset) {
31328
31333
  const laneW = preset.laneWidth ?? 320;
31329
31334
  const tone = preset.defaultTone ?? "info";
31330
- const b = diagram(preset.id, { topic: preset.topic });
31335
+ const b = diagram(preset.id, { topic: preset.topic, type: "network" });
31331
31336
  const colLaneIds = /* @__PURE__ */ new Map();
31332
31337
  const phaseActivate = [];
31333
31338
  let edgeIdx = 0;
@@ -31377,7 +31382,7 @@ function stateMachine2(preset) {
31377
31382
  const stateW = resolveStateW(preset.stateWidth, "stateMachine2");
31378
31383
  const laneW = boxLaneW(stateW);
31379
31384
  const tone = preset.defaultTone ?? "accent";
31380
- const b = diagram(preset.id, { topic: preset.topic });
31385
+ const b = diagram(preset.id, { topic: preset.topic, type: "state" });
31381
31386
  const stateOrder = /* @__PURE__ */ new Map();
31382
31387
  const phaseActivate = [];
31383
31388
  let transIdx = 0;