@cardenelabs/dragon 0.18.3 → 0.20.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/README.md +3 -0
- package/dist/index.cjs +706 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +706 -149
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/compile.ts +104 -9
- package/src/json-parser.ts +41 -0
- package/src/keywords.ts +38 -0
- package/src/schemas/diagram.json +586 -140
- package/src/types.ts +15 -1
- package/src/v05/parser.ts +79 -3
package/dist/index.d.cts
CHANGED
|
@@ -58,7 +58,7 @@ type V05ParseResult = {
|
|
|
58
58
|
* 書くと、項目を足した時に案内か一覧のどちらかが取り残される (実際に `states` / `values` が
|
|
59
59
|
* 一覧に 1 件も無い状態で放置されていた)。
|
|
60
60
|
*/
|
|
61
|
-
declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts", "inputs", "formulas", "events", "scrolls", "bands", "reveal", "direction"];
|
|
61
|
+
declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts", "inputs", "formulas", "events", "scrolls", "bands", "reveal", "direction", "palette"];
|
|
62
62
|
/** 受け付ける図種。 記法一覧はここを見る。 */
|
|
63
63
|
declare const PRESET_TYPES: ReadonlySet<PresetType>;
|
|
64
64
|
/**
|
|
@@ -146,6 +146,18 @@ declare const DRAW_WORDS: ReadonlySet<string>;
|
|
|
146
146
|
*/
|
|
147
147
|
declare const DIRECTIONS: readonly ["縦", "横"];
|
|
148
148
|
type DslDirection = (typeof DIRECTIONS)[number];
|
|
149
|
+
/**
|
|
150
|
+
* 図の配色 (`palette:`、 #1553)。
|
|
151
|
+
*
|
|
152
|
+
* cdl は色を持たない (形だけを描く)。 名前を `data-cdl-palette` として markup に出すので、
|
|
153
|
+
* dragon の `cdl-theme.css` がその名前を見て 7 つの口 (台 / 行の面 / 縞 / 枠 / 字 / 型名 / 線)
|
|
154
|
+
* に色を当てる。
|
|
155
|
+
*
|
|
156
|
+
* **名前を自由文字列にしない**。 書き間違えると既定の色みのまま出るので、書き手には
|
|
157
|
+
* 「効かない」 としか見えない。 語を絞れば読めない語をその場で知らせられる。
|
|
158
|
+
*/
|
|
159
|
+
declare const PALETTES: readonly ["kinari", "celadon"];
|
|
160
|
+
type DslPalette = (typeof PALETTES)[number];
|
|
149
161
|
/** NodeKind 別名 (日本語 → English) */
|
|
150
162
|
declare const NODE_KIND_ALIAS: Record<string, NodeKind>;
|
|
151
163
|
/** Tone 別名 */
|
|
@@ -382,6 +394,16 @@ type DslDocument = {
|
|
|
382
394
|
directionPos?: {
|
|
383
395
|
line: number;
|
|
384
396
|
};
|
|
397
|
+
/**
|
|
398
|
+
* 図の配色 (`palette:`、 #1553)。
|
|
399
|
+
*
|
|
400
|
+
* 名前だけを持つ。 実際の色は消費側 (`cdl-theme.css`) が決めるので、ここには値を書かない。
|
|
401
|
+
* ER 図とクラス図は書かなくても `kinari` (生成りに茶) になる。 どちらも箱の作りが同じ
|
|
402
|
+
* (行頭の印 + 左に名前 + 右に型) で、名前と型が離れて並ぶため、行を横に追う目印
|
|
403
|
+
* (行の縞) が要る。 縞の色は配色からしか来ないので、既定が無いと縞が箱の面と同じ色に
|
|
404
|
+
* 落ちて 1 本も出ない。 書き手が `palette:` を書いた時はそちらが勝つ。
|
|
405
|
+
*/
|
|
406
|
+
palette?: DslPalette;
|
|
385
407
|
groups?: Record<string, DslGroup>;
|
|
386
408
|
/**
|
|
387
409
|
* 値を見せる部品 (`readouts:`、 #1374)。 割合の輪や数え上げを図の脇に出す。
|
|
@@ -686,6 +708,10 @@ type DslStep = {
|
|
|
686
708
|
* `kind` にしないのは、箱の種類 (`DslActor.kind`) と同じ語が別の意味を持つため。
|
|
687
709
|
*/
|
|
688
710
|
msgKind?: SequenceMessageKind;
|
|
711
|
+
/** 辺の役目 (cdl#618)。 `main` を書いた辺だけ「いま」 の色で引く */
|
|
712
|
+
role?: "main";
|
|
713
|
+
/** 名前の下地を敷くか (cdl#618)。 書かなければ敷く */
|
|
714
|
+
labelPlate?: boolean;
|
|
689
715
|
labelOffsetX?: number;
|
|
690
716
|
labelOffsetY?: number;
|
|
691
717
|
/** true で説明文を矢印の線の上に重ねる。 分岐図の条件ラベル用。 */
|
|
@@ -1598,6 +1624,16 @@ interface DragonJson {
|
|
|
1598
1624
|
reveal?: EdgeReveal;
|
|
1599
1625
|
/** 図の並ぶ向き (#1494)。 記法の最上位 `direction:` と同じ。 JSON は英語の語で書く */
|
|
1600
1626
|
direction?: "vertical" | "horizontal";
|
|
1627
|
+
/**
|
|
1628
|
+
* 図の配色 (#1553)。 記法の最上位 `palette:` と同じ。
|
|
1629
|
+
*
|
|
1630
|
+
* 名前だけを図に載せる = cdl は色を持たず、値は `cdl-theme.css` が決める。
|
|
1631
|
+
* ER 図とクラス図は書かなくても `kinari` (生成りに茶) になる。 どちらも箱の作りが同じ
|
|
1632
|
+
* (行頭の印 + 左に名前 + 右に型) で、名前と型が離れて並ぶため、行を横に追う目印
|
|
1633
|
+
* (行の縞) が要る。 縞の色は配色からしか来ないので、既定が無いと縞が箱の面と同じ色に
|
|
1634
|
+
* 落ちて 1 本も出ない。 書き手が `palette:` を書いた時はそちらが勝つ。
|
|
1635
|
+
*/
|
|
1636
|
+
palette?: DslPalette;
|
|
1601
1637
|
}
|
|
1602
1638
|
interface JsonActor {
|
|
1603
1639
|
name: string;
|
|
@@ -1758,6 +1794,14 @@ interface JsonStep {
|
|
|
1758
1794
|
tailHead?: EdgeHead;
|
|
1759
1795
|
headFill?: EdgeHeadFill;
|
|
1760
1796
|
tailHeadFill?: EdgeHeadFill;
|
|
1797
|
+
/**
|
|
1798
|
+
* 辺の役目 (cdl#618)。 記法の `{ role: main }` と同じ。
|
|
1799
|
+
*
|
|
1800
|
+
* `main` を書いた辺だけ「いま」 の色で引く。 主となる 1 本 (または 1 続き) にだけ書く。
|
|
1801
|
+
*/
|
|
1802
|
+
role?: "main";
|
|
1803
|
+
/** 名前の下地を敷くか (cdl#618)。 記法の `{ labelPlate: false }` と同じ。 既定は敷く */
|
|
1804
|
+
labelPlate?: boolean;
|
|
1761
1805
|
/** クラス図の関係の語 (#1466)。 書くと端の形 / 塗り / 線種がまとめて決まる */
|
|
1762
1806
|
relation?: ClassRelationType;
|
|
1763
1807
|
/** 順序図の言づての種類 (#1466)。 `call` / `return` / `fire` */
|
|
@@ -2309,6 +2353,15 @@ declare const diagramJsonSchema: {
|
|
|
2309
2353
|
enum: string[];
|
|
2310
2354
|
description: string;
|
|
2311
2355
|
};
|
|
2356
|
+
role: {
|
|
2357
|
+
type: string;
|
|
2358
|
+
enum: string[];
|
|
2359
|
+
description: string;
|
|
2360
|
+
};
|
|
2361
|
+
labelPlate: {
|
|
2362
|
+
type: string;
|
|
2363
|
+
description: string;
|
|
2364
|
+
};
|
|
2312
2365
|
kind: {
|
|
2313
2366
|
type: string;
|
|
2314
2367
|
enum: string[];
|
|
@@ -3083,6 +3136,11 @@ declare const diagramJsonSchema: {
|
|
|
3083
3136
|
enum: string[];
|
|
3084
3137
|
description: string;
|
|
3085
3138
|
};
|
|
3139
|
+
palette: {
|
|
3140
|
+
type: string;
|
|
3141
|
+
enum: string[];
|
|
3142
|
+
description: string;
|
|
3143
|
+
};
|
|
3086
3144
|
reveal: {
|
|
3087
3145
|
type: string;
|
|
3088
3146
|
enum: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ type V05ParseResult = {
|
|
|
58
58
|
* 書くと、項目を足した時に案内か一覧のどちらかが取り残される (実際に `states` / `values` が
|
|
59
59
|
* 一覧に 1 件も無い状態で放置されていた)。
|
|
60
60
|
*/
|
|
61
|
-
declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts", "inputs", "formulas", "events", "scrolls", "bands", "reveal", "direction"];
|
|
61
|
+
declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts", "inputs", "formulas", "events", "scrolls", "bands", "reveal", "direction", "palette"];
|
|
62
62
|
/** 受け付ける図種。 記法一覧はここを見る。 */
|
|
63
63
|
declare const PRESET_TYPES: ReadonlySet<PresetType>;
|
|
64
64
|
/**
|
|
@@ -146,6 +146,18 @@ declare const DRAW_WORDS: ReadonlySet<string>;
|
|
|
146
146
|
*/
|
|
147
147
|
declare const DIRECTIONS: readonly ["縦", "横"];
|
|
148
148
|
type DslDirection = (typeof DIRECTIONS)[number];
|
|
149
|
+
/**
|
|
150
|
+
* 図の配色 (`palette:`、 #1553)。
|
|
151
|
+
*
|
|
152
|
+
* cdl は色を持たない (形だけを描く)。 名前を `data-cdl-palette` として markup に出すので、
|
|
153
|
+
* dragon の `cdl-theme.css` がその名前を見て 7 つの口 (台 / 行の面 / 縞 / 枠 / 字 / 型名 / 線)
|
|
154
|
+
* に色を当てる。
|
|
155
|
+
*
|
|
156
|
+
* **名前を自由文字列にしない**。 書き間違えると既定の色みのまま出るので、書き手には
|
|
157
|
+
* 「効かない」 としか見えない。 語を絞れば読めない語をその場で知らせられる。
|
|
158
|
+
*/
|
|
159
|
+
declare const PALETTES: readonly ["kinari", "celadon"];
|
|
160
|
+
type DslPalette = (typeof PALETTES)[number];
|
|
149
161
|
/** NodeKind 別名 (日本語 → English) */
|
|
150
162
|
declare const NODE_KIND_ALIAS: Record<string, NodeKind>;
|
|
151
163
|
/** Tone 別名 */
|
|
@@ -382,6 +394,16 @@ type DslDocument = {
|
|
|
382
394
|
directionPos?: {
|
|
383
395
|
line: number;
|
|
384
396
|
};
|
|
397
|
+
/**
|
|
398
|
+
* 図の配色 (`palette:`、 #1553)。
|
|
399
|
+
*
|
|
400
|
+
* 名前だけを持つ。 実際の色は消費側 (`cdl-theme.css`) が決めるので、ここには値を書かない。
|
|
401
|
+
* ER 図とクラス図は書かなくても `kinari` (生成りに茶) になる。 どちらも箱の作りが同じ
|
|
402
|
+
* (行頭の印 + 左に名前 + 右に型) で、名前と型が離れて並ぶため、行を横に追う目印
|
|
403
|
+
* (行の縞) が要る。 縞の色は配色からしか来ないので、既定が無いと縞が箱の面と同じ色に
|
|
404
|
+
* 落ちて 1 本も出ない。 書き手が `palette:` を書いた時はそちらが勝つ。
|
|
405
|
+
*/
|
|
406
|
+
palette?: DslPalette;
|
|
385
407
|
groups?: Record<string, DslGroup>;
|
|
386
408
|
/**
|
|
387
409
|
* 値を見せる部品 (`readouts:`、 #1374)。 割合の輪や数え上げを図の脇に出す。
|
|
@@ -686,6 +708,10 @@ type DslStep = {
|
|
|
686
708
|
* `kind` にしないのは、箱の種類 (`DslActor.kind`) と同じ語が別の意味を持つため。
|
|
687
709
|
*/
|
|
688
710
|
msgKind?: SequenceMessageKind;
|
|
711
|
+
/** 辺の役目 (cdl#618)。 `main` を書いた辺だけ「いま」 の色で引く */
|
|
712
|
+
role?: "main";
|
|
713
|
+
/** 名前の下地を敷くか (cdl#618)。 書かなければ敷く */
|
|
714
|
+
labelPlate?: boolean;
|
|
689
715
|
labelOffsetX?: number;
|
|
690
716
|
labelOffsetY?: number;
|
|
691
717
|
/** true で説明文を矢印の線の上に重ねる。 分岐図の条件ラベル用。 */
|
|
@@ -1598,6 +1624,16 @@ interface DragonJson {
|
|
|
1598
1624
|
reveal?: EdgeReveal;
|
|
1599
1625
|
/** 図の並ぶ向き (#1494)。 記法の最上位 `direction:` と同じ。 JSON は英語の語で書く */
|
|
1600
1626
|
direction?: "vertical" | "horizontal";
|
|
1627
|
+
/**
|
|
1628
|
+
* 図の配色 (#1553)。 記法の最上位 `palette:` と同じ。
|
|
1629
|
+
*
|
|
1630
|
+
* 名前だけを図に載せる = cdl は色を持たず、値は `cdl-theme.css` が決める。
|
|
1631
|
+
* ER 図とクラス図は書かなくても `kinari` (生成りに茶) になる。 どちらも箱の作りが同じ
|
|
1632
|
+
* (行頭の印 + 左に名前 + 右に型) で、名前と型が離れて並ぶため、行を横に追う目印
|
|
1633
|
+
* (行の縞) が要る。 縞の色は配色からしか来ないので、既定が無いと縞が箱の面と同じ色に
|
|
1634
|
+
* 落ちて 1 本も出ない。 書き手が `palette:` を書いた時はそちらが勝つ。
|
|
1635
|
+
*/
|
|
1636
|
+
palette?: DslPalette;
|
|
1601
1637
|
}
|
|
1602
1638
|
interface JsonActor {
|
|
1603
1639
|
name: string;
|
|
@@ -1758,6 +1794,14 @@ interface JsonStep {
|
|
|
1758
1794
|
tailHead?: EdgeHead;
|
|
1759
1795
|
headFill?: EdgeHeadFill;
|
|
1760
1796
|
tailHeadFill?: EdgeHeadFill;
|
|
1797
|
+
/**
|
|
1798
|
+
* 辺の役目 (cdl#618)。 記法の `{ role: main }` と同じ。
|
|
1799
|
+
*
|
|
1800
|
+
* `main` を書いた辺だけ「いま」 の色で引く。 主となる 1 本 (または 1 続き) にだけ書く。
|
|
1801
|
+
*/
|
|
1802
|
+
role?: "main";
|
|
1803
|
+
/** 名前の下地を敷くか (cdl#618)。 記法の `{ labelPlate: false }` と同じ。 既定は敷く */
|
|
1804
|
+
labelPlate?: boolean;
|
|
1761
1805
|
/** クラス図の関係の語 (#1466)。 書くと端の形 / 塗り / 線種がまとめて決まる */
|
|
1762
1806
|
relation?: ClassRelationType;
|
|
1763
1807
|
/** 順序図の言づての種類 (#1466)。 `call` / `return` / `fire` */
|
|
@@ -2309,6 +2353,15 @@ declare const diagramJsonSchema: {
|
|
|
2309
2353
|
enum: string[];
|
|
2310
2354
|
description: string;
|
|
2311
2355
|
};
|
|
2356
|
+
role: {
|
|
2357
|
+
type: string;
|
|
2358
|
+
enum: string[];
|
|
2359
|
+
description: string;
|
|
2360
|
+
};
|
|
2361
|
+
labelPlate: {
|
|
2362
|
+
type: string;
|
|
2363
|
+
description: string;
|
|
2364
|
+
};
|
|
2312
2365
|
kind: {
|
|
2313
2366
|
type: string;
|
|
2314
2367
|
enum: string[];
|
|
@@ -3083,6 +3136,11 @@ declare const diagramJsonSchema: {
|
|
|
3083
3136
|
enum: string[];
|
|
3084
3137
|
description: string;
|
|
3085
3138
|
};
|
|
3139
|
+
palette: {
|
|
3140
|
+
type: string;
|
|
3141
|
+
enum: string[];
|
|
3142
|
+
description: string;
|
|
3143
|
+
};
|
|
3086
3144
|
reveal: {
|
|
3087
3145
|
type: string;
|
|
3088
3146
|
enum: string[];
|