@cardenelabs/cdl 0.62.0 → 0.63.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 +19 -1
- package/dist/index.cjs +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/presets.ts +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardenelabs/cdl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.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",
|
package/src/presets.ts
CHANGED
|
@@ -1030,7 +1030,9 @@ export type StateMachineBuilder = {
|
|
|
1030
1030
|
export function stateMachine(preset: StateMachinePreset): StateMachineBuilder {
|
|
1031
1031
|
const stateW = resolveStateW(preset.stateWidth, "stateMachine");
|
|
1032
1032
|
const tone: Tone = preset.defaultTone ?? "accent";
|
|
1033
|
-
|
|
1033
|
+
// 図の型と最後の段の札は同じ綴り (#859)。 札を別の字にすると、消費側が型の一覧で引けない
|
|
1034
|
+
const diagramType = "state";
|
|
1035
|
+
const b = diagram(preset.id, { topic: preset.topic, type: diagramType });
|
|
1034
1036
|
|
|
1035
1037
|
const phaseActivate: string[] = [];
|
|
1036
1038
|
const stateOrder = new Map<string, number>();
|
|
@@ -1159,7 +1161,7 @@ export function stateMachine(preset: StateMachinePreset): StateMachineBuilder {
|
|
|
1159
1161
|
b.phase(
|
|
1160
1162
|
"fsm",
|
|
1161
1163
|
{ duration: 2400, title: preset.topic, body: "すべての状態と遷移を並べた姿。" },
|
|
1162
|
-
(p) => p.activate(...phaseActivate).badge(
|
|
1164
|
+
(p) => p.activate(...phaseActivate).badge(diagramType),
|
|
1163
1165
|
);
|
|
1164
1166
|
return b.build();
|
|
1165
1167
|
},
|
|
@@ -1810,7 +1812,10 @@ export type MindMapBuilder = {
|
|
|
1810
1812
|
export function mindMap(preset: MindMapPreset): MindMapBuilder {
|
|
1811
1813
|
const canvasW = preset.branchWidth ? preset.branchWidth * 2 : 720;
|
|
1812
1814
|
const canvasH = 480;
|
|
1813
|
-
|
|
1815
|
+
// 型は他の組み立て関数と同じく短い名前 (`state` / `class` / `journey` と並ぶ `mind`)。
|
|
1816
|
+
// 最後の段の札も同じ綴り (#859)
|
|
1817
|
+
const diagramType = "mind";
|
|
1818
|
+
const b = diagram(preset.id, { topic: preset.topic, type: diagramType });
|
|
1814
1819
|
const branches: MindBranch[] = [];
|
|
1815
1820
|
|
|
1816
1821
|
const api: MindMapBuilder = {
|
|
@@ -1845,7 +1850,7 @@ export function mindMap(preset: MindMapPreset): MindMapBuilder {
|
|
|
1845
1850
|
b.phase(
|
|
1846
1851
|
"mindmap",
|
|
1847
1852
|
{ duration: 2400, title: preset.topic, body: "中心の主題から、すべての枝を放射状に広げた姿。" },
|
|
1848
|
-
(p) => p.activate(nodeId).badge(
|
|
1853
|
+
(p) => p.activate(nodeId).badge(diagramType),
|
|
1849
1854
|
);
|
|
1850
1855
|
return b.build();
|
|
1851
1856
|
},
|
|
@@ -2581,7 +2586,9 @@ export function stateMachine2(preset: StateMachine2Preset): StateMachine2Builder
|
|
|
2581
2586
|
const stateW = resolveStateW(preset.stateWidth, "stateMachine2");
|
|
2582
2587
|
const laneW = boxLaneW(stateW);
|
|
2583
2588
|
const tone: Tone = preset.defaultTone ?? "accent";
|
|
2584
|
-
|
|
2589
|
+
// 入れ子を持つ状態の図も型は `state`。 最後の段の札も同じ綴りで、1 つ目の図との見分けは題が持つ (#859)
|
|
2590
|
+
const diagramType = "state";
|
|
2591
|
+
const b = diagram(preset.id, { topic: preset.topic, type: diagramType });
|
|
2585
2592
|
|
|
2586
2593
|
const stateOrder = new Map<string, number>();
|
|
2587
2594
|
const phaseActivate: string[] = [];
|
|
@@ -2645,7 +2652,7 @@ export function stateMachine2(preset: StateMachine2Preset): StateMachine2Builder
|
|
|
2645
2652
|
title: preset.topic,
|
|
2646
2653
|
body: "入れ子の状態と、入る時・出る時の処理を含めた、すべての状態と遷移。",
|
|
2647
2654
|
},
|
|
2648
|
-
(p) => p.activate(...phaseActivate).badge(
|
|
2655
|
+
(p) => p.activate(...phaseActivate).badge(diagramType),
|
|
2649
2656
|
);
|
|
2650
2657
|
const d = b.build();
|
|
2651
2658
|
// 入れ子の札に親の題を足す。 識別子 (`active`) を出すと、図のどこにも無い字になる
|