@cardenelabs/dragon 0.17.0 → 0.18.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 +1 -0
- package/dist/index.cjs +101 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -13
- package/dist/index.d.ts +42 -13
- package/dist/index.js +101 -7
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/src/compile.ts +86 -5
- package/src/json-parser.ts +8 -0
- package/src/keywords.ts +28 -0
- package/src/schemas/diagram.json +5 -0
- package/src/types.ts +12 -0
- package/src/v05/parser.ts +42 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeKind, Tone, CdlDiagram, EdgeStyle, EdgeHead, EdgeHeadFill, ClassRelationType, SequenceMessageKind, EdgeReveal, LaidDiagram } from '@cardenelabs/cdl';
|
|
2
2
|
export { CdlDiagram } from '@cardenelabs/cdl';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -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"];
|
|
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"];
|
|
62
62
|
/** 受け付ける図種。 記法一覧はここを見る。 */
|
|
63
63
|
declare const PRESET_TYPES: ReadonlySet<PresetType>;
|
|
64
64
|
/**
|
|
@@ -132,6 +132,25 @@ declare const DRAW_TARGETS: ReadonlyMap<string, PresetType>;
|
|
|
132
132
|
/** `draw:` に書ける語。 表から導く (#1314) */
|
|
133
133
|
declare const DRAW_WORDS: ReadonlySet<string>;
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Text DSL i18n キーワード一覧
|
|
137
|
+
* 日本語 / 英語両対応 (大文字小文字無視)
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 図の並ぶ向き (`direction:`、 #1494)。
|
|
142
|
+
*
|
|
143
|
+
* 縦列 (`lane`) は横、段 (`stack`) は縦に置かれるので、向きは「1 つの縦列に積む」 か
|
|
144
|
+
* 「1 人ずつ縦列を作る」 かの選択になる。 どちらも組み立て側に既にある経路で、
|
|
145
|
+
* 記法から名指しできる言葉が無かった。
|
|
146
|
+
*/
|
|
147
|
+
declare const DIRECTIONS: readonly ["縦", "横"];
|
|
148
|
+
type DslDirection = (typeof DIRECTIONS)[number];
|
|
149
|
+
/** NodeKind 別名 (日本語 → English) */
|
|
150
|
+
declare const NODE_KIND_ALIAS: Record<string, NodeKind>;
|
|
151
|
+
/** Tone 別名 */
|
|
152
|
+
declare const TONE_ALIAS: Record<string, Tone>;
|
|
153
|
+
|
|
135
154
|
/**
|
|
136
155
|
* 位置を他の要素からの相対で書くための解決。
|
|
137
156
|
*
|
|
@@ -350,6 +369,19 @@ type DslDocument = {
|
|
|
350
369
|
* 段に関わらず最初から全部描く。 描き手の `CdlDiagram.edgeReveal` にそのまま渡る。
|
|
351
370
|
*/
|
|
352
371
|
reveal?: EdgeReveal;
|
|
372
|
+
/**
|
|
373
|
+
* 図の並ぶ向き (`direction:`、 #1494)。
|
|
374
|
+
*
|
|
375
|
+
* `縦` は 1 つの縦列に積み、`横` は 1 人ずつ縦列を作る。 効くのは流れ図と泳法図だけで、
|
|
376
|
+
* 他の図種は並び方そのものが読み方を担うため書いても効かない (知らせを出す)。
|
|
377
|
+
*
|
|
378
|
+
* 全ての箱が縦列を書いた形では、書いた縦列が勝つ (同じく知らせを出す)。
|
|
379
|
+
*/
|
|
380
|
+
direction?: DslDirection;
|
|
381
|
+
/** `direction:` を書いた行。 効かない時の知らせで、書いた場所を指すために持つ */
|
|
382
|
+
directionPos?: {
|
|
383
|
+
line: number;
|
|
384
|
+
};
|
|
353
385
|
groups?: Record<string, DslGroup>;
|
|
354
386
|
/**
|
|
355
387
|
* 値を見せる部品 (`readouts:`、 #1374)。 割合の輪や数え上げを図の脇に出す。
|
|
@@ -893,7 +925,7 @@ interface CompileToCdlOpts {
|
|
|
893
925
|
}
|
|
894
926
|
/** 図は出せるが書いた通りにならなかった、 という知らせ。 */
|
|
895
927
|
type CompileNotice = {
|
|
896
|
-
kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "scale-reserved" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch" | "formula-unresolved" | "event-target-missing" | "actor-kind-not-honored" | "sub-node-not-found" | "message-option-not-honored";
|
|
928
|
+
kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "direction-not-honored" | "scale-reserved" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch" | "formula-unresolved" | "event-target-missing" | "actor-kind-not-honored" | "sub-node-not-found" | "message-option-not-honored";
|
|
897
929
|
/** 対象の名前。 光らせる相手なら書かれた指定そのまま */
|
|
898
930
|
actor: string;
|
|
899
931
|
/** 書かれていた行 */
|
|
@@ -1098,16 +1130,6 @@ declare function partsGridCenters(baseRows: number, items: ReadonlyArray<{
|
|
|
1098
1130
|
cy: number;
|
|
1099
1131
|
}>;
|
|
1100
1132
|
|
|
1101
|
-
/**
|
|
1102
|
-
* Text DSL i18n キーワード一覧
|
|
1103
|
-
* 日本語 / 英語両対応 (大文字小文字無視)
|
|
1104
|
-
*/
|
|
1105
|
-
|
|
1106
|
-
/** NodeKind 別名 (日本語 → English) */
|
|
1107
|
-
declare const NODE_KIND_ALIAS: Record<string, NodeKind>;
|
|
1108
|
-
/** Tone 別名 */
|
|
1109
|
-
declare const TONE_ALIAS: Record<string, Tone>;
|
|
1110
|
-
|
|
1111
1133
|
/**
|
|
1112
1134
|
* Notation lint (author 向け修正システム)。
|
|
1113
1135
|
*
|
|
@@ -1574,6 +1596,8 @@ interface DragonJson {
|
|
|
1574
1596
|
}[];
|
|
1575
1597
|
/** 矢印をいつ出すか (#1470)。 記法の最上位 `reveal:` と同じ */
|
|
1576
1598
|
reveal?: EdgeReveal;
|
|
1599
|
+
/** 図の並ぶ向き (#1494)。 記法の最上位 `direction:` と同じ。 JSON は英語の語で書く */
|
|
1600
|
+
direction?: "vertical" | "horizontal";
|
|
1577
1601
|
}
|
|
1578
1602
|
interface JsonActor {
|
|
1579
1603
|
name: string;
|
|
@@ -3054,6 +3078,11 @@ declare const diagramJsonSchema: {
|
|
|
3054
3078
|
pattern: string;
|
|
3055
3079
|
};
|
|
3056
3080
|
};
|
|
3081
|
+
direction: {
|
|
3082
|
+
type: string;
|
|
3083
|
+
enum: string[];
|
|
3084
|
+
description: string;
|
|
3085
|
+
};
|
|
3057
3086
|
reveal: {
|
|
3058
3087
|
type: string;
|
|
3059
3088
|
enum: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeKind, Tone, CdlDiagram, EdgeStyle, EdgeHead, EdgeHeadFill, ClassRelationType, SequenceMessageKind, EdgeReveal, LaidDiagram } from '@cardenelabs/cdl';
|
|
2
2
|
export { CdlDiagram } from '@cardenelabs/cdl';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -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"];
|
|
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"];
|
|
62
62
|
/** 受け付ける図種。 記法一覧はここを見る。 */
|
|
63
63
|
declare const PRESET_TYPES: ReadonlySet<PresetType>;
|
|
64
64
|
/**
|
|
@@ -132,6 +132,25 @@ declare const DRAW_TARGETS: ReadonlyMap<string, PresetType>;
|
|
|
132
132
|
/** `draw:` に書ける語。 表から導く (#1314) */
|
|
133
133
|
declare const DRAW_WORDS: ReadonlySet<string>;
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Text DSL i18n キーワード一覧
|
|
137
|
+
* 日本語 / 英語両対応 (大文字小文字無視)
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 図の並ぶ向き (`direction:`、 #1494)。
|
|
142
|
+
*
|
|
143
|
+
* 縦列 (`lane`) は横、段 (`stack`) は縦に置かれるので、向きは「1 つの縦列に積む」 か
|
|
144
|
+
* 「1 人ずつ縦列を作る」 かの選択になる。 どちらも組み立て側に既にある経路で、
|
|
145
|
+
* 記法から名指しできる言葉が無かった。
|
|
146
|
+
*/
|
|
147
|
+
declare const DIRECTIONS: readonly ["縦", "横"];
|
|
148
|
+
type DslDirection = (typeof DIRECTIONS)[number];
|
|
149
|
+
/** NodeKind 別名 (日本語 → English) */
|
|
150
|
+
declare const NODE_KIND_ALIAS: Record<string, NodeKind>;
|
|
151
|
+
/** Tone 別名 */
|
|
152
|
+
declare const TONE_ALIAS: Record<string, Tone>;
|
|
153
|
+
|
|
135
154
|
/**
|
|
136
155
|
* 位置を他の要素からの相対で書くための解決。
|
|
137
156
|
*
|
|
@@ -350,6 +369,19 @@ type DslDocument = {
|
|
|
350
369
|
* 段に関わらず最初から全部描く。 描き手の `CdlDiagram.edgeReveal` にそのまま渡る。
|
|
351
370
|
*/
|
|
352
371
|
reveal?: EdgeReveal;
|
|
372
|
+
/**
|
|
373
|
+
* 図の並ぶ向き (`direction:`、 #1494)。
|
|
374
|
+
*
|
|
375
|
+
* `縦` は 1 つの縦列に積み、`横` は 1 人ずつ縦列を作る。 効くのは流れ図と泳法図だけで、
|
|
376
|
+
* 他の図種は並び方そのものが読み方を担うため書いても効かない (知らせを出す)。
|
|
377
|
+
*
|
|
378
|
+
* 全ての箱が縦列を書いた形では、書いた縦列が勝つ (同じく知らせを出す)。
|
|
379
|
+
*/
|
|
380
|
+
direction?: DslDirection;
|
|
381
|
+
/** `direction:` を書いた行。 効かない時の知らせで、書いた場所を指すために持つ */
|
|
382
|
+
directionPos?: {
|
|
383
|
+
line: number;
|
|
384
|
+
};
|
|
353
385
|
groups?: Record<string, DslGroup>;
|
|
354
386
|
/**
|
|
355
387
|
* 値を見せる部品 (`readouts:`、 #1374)。 割合の輪や数え上げを図の脇に出す。
|
|
@@ -893,7 +925,7 @@ interface CompileToCdlOpts {
|
|
|
893
925
|
}
|
|
894
926
|
/** 図は出せるが書いた通りにならなかった、 という知らせ。 */
|
|
895
927
|
type CompileNotice = {
|
|
896
|
-
kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "scale-reserved" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch" | "formula-unresolved" | "event-target-missing" | "actor-kind-not-honored" | "sub-node-not-found" | "message-option-not-honored";
|
|
928
|
+
kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "direction-not-honored" | "scale-reserved" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch" | "formula-unresolved" | "event-target-missing" | "actor-kind-not-honored" | "sub-node-not-found" | "message-option-not-honored";
|
|
897
929
|
/** 対象の名前。 光らせる相手なら書かれた指定そのまま */
|
|
898
930
|
actor: string;
|
|
899
931
|
/** 書かれていた行 */
|
|
@@ -1098,16 +1130,6 @@ declare function partsGridCenters(baseRows: number, items: ReadonlyArray<{
|
|
|
1098
1130
|
cy: number;
|
|
1099
1131
|
}>;
|
|
1100
1132
|
|
|
1101
|
-
/**
|
|
1102
|
-
* Text DSL i18n キーワード一覧
|
|
1103
|
-
* 日本語 / 英語両対応 (大文字小文字無視)
|
|
1104
|
-
*/
|
|
1105
|
-
|
|
1106
|
-
/** NodeKind 別名 (日本語 → English) */
|
|
1107
|
-
declare const NODE_KIND_ALIAS: Record<string, NodeKind>;
|
|
1108
|
-
/** Tone 別名 */
|
|
1109
|
-
declare const TONE_ALIAS: Record<string, Tone>;
|
|
1110
|
-
|
|
1111
1133
|
/**
|
|
1112
1134
|
* Notation lint (author 向け修正システム)。
|
|
1113
1135
|
*
|
|
@@ -1574,6 +1596,8 @@ interface DragonJson {
|
|
|
1574
1596
|
}[];
|
|
1575
1597
|
/** 矢印をいつ出すか (#1470)。 記法の最上位 `reveal:` と同じ */
|
|
1576
1598
|
reveal?: EdgeReveal;
|
|
1599
|
+
/** 図の並ぶ向き (#1494)。 記法の最上位 `direction:` と同じ。 JSON は英語の語で書く */
|
|
1600
|
+
direction?: "vertical" | "horizontal";
|
|
1577
1601
|
}
|
|
1578
1602
|
interface JsonActor {
|
|
1579
1603
|
name: string;
|
|
@@ -3054,6 +3078,11 @@ declare const diagramJsonSchema: {
|
|
|
3054
3078
|
pattern: string;
|
|
3055
3079
|
};
|
|
3056
3080
|
};
|
|
3081
|
+
direction: {
|
|
3082
|
+
type: string;
|
|
3083
|
+
enum: string[];
|
|
3084
|
+
description: string;
|
|
3085
|
+
};
|
|
3057
3086
|
reveal: {
|
|
3058
3087
|
type: string;
|
|
3059
3088
|
enum: string[];
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,17 @@ var HEADERS = {
|
|
|
9
9
|
animate: ["\u30A2\u30CB\u30E1\u30FC\u30B7\u30E7\u30F3", "animate", "animation"]
|
|
10
10
|
};
|
|
11
11
|
var PRESET_NAMES = ["sequence", "flow", "swimlane", "er", "state", "topology"];
|
|
12
|
+
var DIRECTIONS = ["\u7E26", "\u6A2A"];
|
|
13
|
+
var DIRECTION_ALIAS = {
|
|
14
|
+
\u7E26: "\u7E26",
|
|
15
|
+
\u6A2A: "\u6A2A",
|
|
16
|
+
vertical: "\u7E26",
|
|
17
|
+
horizontal: "\u6A2A"
|
|
18
|
+
};
|
|
19
|
+
function resolveDirection(s) {
|
|
20
|
+
const k = s.trim().toLowerCase();
|
|
21
|
+
return Object.hasOwn(DIRECTION_ALIAS, k) ? DIRECTION_ALIAS[k] : null;
|
|
22
|
+
}
|
|
12
23
|
var NODE_KIND_ALIAS = {
|
|
13
24
|
// 日本語
|
|
14
25
|
\u4EBA: "actor",
|
|
@@ -1915,7 +1926,18 @@ var TOP_LEVEL_KEYS = [
|
|
|
1915
1926
|
// 動いている間の帯 (#1466)。 順序図だけが読む
|
|
1916
1927
|
"bands",
|
|
1917
1928
|
// 矢印をいつ出すか (#1470)
|
|
1918
|
-
"reveal"
|
|
1929
|
+
"reveal",
|
|
1930
|
+
/*
|
|
1931
|
+
* 図の並ぶ向き (#1494)。
|
|
1932
|
+
*
|
|
1933
|
+
* **最上位の語は英語にする**。 日本語の見出し (`タイトル:` / `種類:` 等) は v0.4 の
|
|
1934
|
+
* 書き方で、2026-12-31 に廃止する側にある。 ここで日本語の語を足すと、消す予定の形を
|
|
1935
|
+
* 増やすことになる。
|
|
1936
|
+
*
|
|
1937
|
+
* 値は日本語と英語の両方を受ける。 箱の項目 (`色` / `種類` / `位置` / `大きさ`) は v0.5 でも
|
|
1938
|
+
* 日本語で書けるので、書き手が自然に言う語 (`縦` / `横`) を残せる。
|
|
1939
|
+
*/
|
|
1940
|
+
"direction"
|
|
1919
1941
|
];
|
|
1920
1942
|
var LANE_ID_ENTRY = /^([\p{L}\p{N}_-]+)\s*:\s*\{([^}]*)\}\s*$/u;
|
|
1921
1943
|
function \u540D\u524D\u3068\u4E2D\u62EC\u5F27\u306B\u5272\u308B(\u884C) {
|
|
@@ -2076,6 +2098,8 @@ function parseTextDslV05(src) {
|
|
|
2076
2098
|
let eyebrow = null;
|
|
2077
2099
|
let eyebrowLine = 0;
|
|
2078
2100
|
let reveal = null;
|
|
2101
|
+
let direction = null;
|
|
2102
|
+
let directionLine = 0;
|
|
2079
2103
|
let axes = void 0;
|
|
2080
2104
|
let axesLine = 0;
|
|
2081
2105
|
let actors = [];
|
|
@@ -2133,6 +2157,24 @@ function parseTextDslV05(src) {
|
|
|
2133
2157
|
i += 1;
|
|
2134
2158
|
continue;
|
|
2135
2159
|
}
|
|
2160
|
+
if (head.key === "direction") {
|
|
2161
|
+
const v = (head.value ?? "").trim();
|
|
2162
|
+
if (v.length > 0) {
|
|
2163
|
+
const \u89E3\u3051\u305F = resolveDirection(v);
|
|
2164
|
+
if (\u89E3\u3051\u305F !== null) {
|
|
2165
|
+
direction = \u89E3\u3051\u305F;
|
|
2166
|
+
directionLine = line.no;
|
|
2167
|
+
} else {
|
|
2168
|
+
errors.push({
|
|
2169
|
+
line: line.no,
|
|
2170
|
+
message: `direction \u304C\u8AAD\u3081\u307E\u305B\u3093 (\u66F8\u3044\u305F\u5024: ${v})`,
|
|
2171
|
+
hint: `\u4F7F\u3048\u308B\u8A9E = ${DIRECTIONS.join(" / ")} / vertical / horizontal`
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
i += 1;
|
|
2176
|
+
continue;
|
|
2177
|
+
}
|
|
2136
2178
|
if (head.key === "eyebrow") {
|
|
2137
2179
|
const v = (head.value ?? "").trim();
|
|
2138
2180
|
eyebrow = v.length > 0 ? v : null;
|
|
@@ -2546,6 +2588,7 @@ function parseTextDslV05(src) {
|
|
|
2546
2588
|
type,
|
|
2547
2589
|
...eyebrow !== null ? { eyebrow, eyebrowPos: { line: eyebrowLine } } : {},
|
|
2548
2590
|
...reveal !== null ? { reveal } : {},
|
|
2591
|
+
...direction !== null ? { direction, directionPos: { line: directionLine } } : {},
|
|
2549
2592
|
...axes !== void 0 ? { axes, axesPos: { line: axesLine } } : {},
|
|
2550
2593
|
actors,
|
|
2551
2594
|
flow: flow2,
|
|
@@ -5012,6 +5055,7 @@ function compileToCdl(doc, opts) {
|
|
|
5012
5055
|
reportActorKindNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
5013
5056
|
reportMessageOptionNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
5014
5057
|
reportDocEyebrowNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
5058
|
+
reportDirectionNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
5015
5059
|
reportDrawNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
5016
5060
|
reportChartFieldsNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
5017
5061
|
reportAxesNotHonored(\u66F8\u3044\u305F\u307E\u307E, opts?.onNotice);
|
|
@@ -8230,7 +8274,7 @@ function slugLookup(byName, wanted) {
|
|
|
8230
8274
|
return hit;
|
|
8231
8275
|
}
|
|
8232
8276
|
function compileFlow(doc) {
|
|
8233
|
-
if (doc.animate && doc.animate.phases.length > 0 || \u66F8\u3044\u305F\u7E26\u5217\u306B\u7F6E\u304F("flow", doc)) {
|
|
8277
|
+
if (doc.animate && doc.animate.phases.length > 0 || \u66F8\u3044\u305F\u7E26\u5217\u306B\u7F6E\u304F("flow", doc) || doc.direction !== void 0) {
|
|
8234
8278
|
return compileGenericWithAnimate(doc, { kind: "flow", laneId: "main", laneWidth: 400 });
|
|
8235
8279
|
}
|
|
8236
8280
|
if (doc.actors.length === 0) {
|
|
@@ -8256,7 +8300,7 @@ function compileFlow(doc) {
|
|
|
8256
8300
|
return flowBuilder.build();
|
|
8257
8301
|
}
|
|
8258
8302
|
function compileSwimlane(doc) {
|
|
8259
|
-
if (doc.animate && doc.animate.phases.length > 0 || \u66F8\u3044\u305F\u7E26\u5217\u306B\u7F6E\u304F("swimlane", doc)) {
|
|
8303
|
+
if (doc.animate && doc.animate.phases.length > 0 || \u66F8\u3044\u305F\u7E26\u5217\u306B\u7F6E\u304F("swimlane", doc) || doc.direction !== void 0) {
|
|
8260
8304
|
return compileGenericWithAnimate(doc, { kind: "swimlane", laneWidth: 400 });
|
|
8261
8305
|
}
|
|
8262
8306
|
const swim = swimlane({
|
|
@@ -8416,6 +8460,39 @@ function \u5F8C\u308D\u3078\u623B\u308B\u77E2\u5370\u304B(kind, fromId, toId, \u
|
|
|
8416
8460
|
if (\u5143 === void 0 || \u5148 === void 0) return false;
|
|
8417
8461
|
return \u5148 < \u5143;
|
|
8418
8462
|
}
|
|
8463
|
+
var \u5411\u304D\u3092\u9078\u3079\u308B\u56F3\u7A2E = /* @__PURE__ */ new Set(["flow", "swimlane"]);
|
|
8464
|
+
function \u65E2\u5B9A\u306E\u5411\u304D(kind) {
|
|
8465
|
+
return kind === "flow" || kind === "topology" ? "\u7E26" : "\u6A2A";
|
|
8466
|
+
}
|
|
8467
|
+
function \u4E26\u3079\u308B\u5411\u304D(kind, doc) {
|
|
8468
|
+
if (doc.direction === void 0) return \u65E2\u5B9A\u306E\u5411\u304D(kind);
|
|
8469
|
+
if (!\u5411\u304D\u3092\u9078\u3079\u308B\u56F3\u7A2E.has(kind)) return \u65E2\u5B9A\u306E\u5411\u304D(kind);
|
|
8470
|
+
return doc.direction;
|
|
8471
|
+
}
|
|
8472
|
+
function reportDirectionNotHonored(doc, onNotice) {
|
|
8473
|
+
if (!onNotice) return;
|
|
8474
|
+
if (doc.direction === void 0) return;
|
|
8475
|
+
const \u884C = doc.directionPos?.line ?? doc.pos?.line ?? 0;
|
|
8476
|
+
if (!\u5411\u304D\u3092\u9078\u3079\u308B\u56F3\u7A2E.has(doc.type)) {
|
|
8477
|
+
onNotice({
|
|
8478
|
+
kind: "direction-not-honored",
|
|
8479
|
+
actor: doc.title,
|
|
8480
|
+
line: \u884C,
|
|
8481
|
+
message: `\u66F8\u3044\u305F direction \u306F\u52B9\u304D\u307E\u305B\u3093 (type: ${doc.type} \u306F\u4E26\u3073\u65B9\u305D\u306E\u3082\u306E\u304C\u8AAD\u307F\u65B9\u3092\u6C7A\u3081\u307E\u3059)`,
|
|
8482
|
+
hint: `direction \u3092\u66F8\u3051\u308B\u306E\u306F ${[...\u5411\u304D\u3092\u9078\u3079\u308B\u56F3\u7A2E].join(" / ")} \u3067\u3059`
|
|
8483
|
+
});
|
|
8484
|
+
return;
|
|
8485
|
+
}
|
|
8486
|
+
if (\u66F8\u3044\u305F\u7E26\u5217\u306B\u7F6E\u304F(doc.type, doc)) {
|
|
8487
|
+
onNotice({
|
|
8488
|
+
kind: "direction-not-honored",
|
|
8489
|
+
actor: doc.title,
|
|
8490
|
+
line: \u884C,
|
|
8491
|
+
message: "\u66F8\u3044\u305F direction \u306F\u52B9\u304D\u307E\u305B\u3093 (\u5168\u3066\u306E\u7BB1\u304C\u7E26\u5217\u3092\u66F8\u3044\u3066\u3044\u308B\u306E\u3067\u3001\u305D\u3061\u3089\u304C\u512A\u5148\u3055\u308C\u307E\u3059)",
|
|
8492
|
+
hint: "direction \u3067\u4E26\u3079\u305F\u3044\u6642\u306F\u7BB1\u306E `lane` \u3092\u5916\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
8493
|
+
});
|
|
8494
|
+
}
|
|
8495
|
+
}
|
|
8419
8496
|
var \u7E26\u5217\u3092\u9078\u3079\u308B\u56F3\u7A2E = /* @__PURE__ */ new Set([
|
|
8420
8497
|
"flow",
|
|
8421
8498
|
"topology",
|
|
@@ -8473,11 +8550,17 @@ function compileGenericWithAnimate(doc, opts) {
|
|
|
8473
8550
|
title: \u7BB1\u306E\u984C(a)
|
|
8474
8551
|
});
|
|
8475
8552
|
});
|
|
8476
|
-
} else if (kind
|
|
8553
|
+
} else if (\u4E26\u3079\u308B\u5411\u304D(kind, doc) === "\u7E26") {
|
|
8477
8554
|
const lid = opts.laneId ?? "main";
|
|
8478
8555
|
b.lane(lid, {
|
|
8479
8556
|
width: laneWidth,
|
|
8480
|
-
|
|
8557
|
+
/*
|
|
8558
|
+
* **見出しは自然に縦へ積む図種だけ** (#1494)。
|
|
8559
|
+
*
|
|
8560
|
+
* `direction: 縦` を書いた泳法図がここへ来るようになった。 その図に題を渡すと、図の題が
|
|
8561
|
+
* 縦列の見出しとしてもう 1 度出る (実測 = 「認証の流れ」 が題と見出しの 2 箇所に並んだ)。
|
|
8562
|
+
*/
|
|
8563
|
+
...kind === "flow" || kind === "topology" ? { label: doc.title } : {},
|
|
8481
8564
|
...kind === "topology" ? { contain: true } : {}
|
|
8482
8565
|
});
|
|
8483
8566
|
doc.actors.forEach((a, idx) => {
|
|
@@ -9221,7 +9304,9 @@ var ACCEPTED_KEYS = {
|
|
|
9221
9304
|
// 順序図で面が動いている間の帯 (#1466)
|
|
9222
9305
|
"bands",
|
|
9223
9306
|
// 矢印をいつ出すか (#1470)
|
|
9224
|
-
"reveal"
|
|
9307
|
+
"reveal",
|
|
9308
|
+
// 図の並ぶ向き (#1494)
|
|
9309
|
+
"direction"
|
|
9225
9310
|
],
|
|
9226
9311
|
actor: [
|
|
9227
9312
|
"name",
|
|
@@ -9329,7 +9414,9 @@ var \u6B04\u306E\u578B\u8868 = {
|
|
|
9329
9414
|
// 順序図で面が動いている間の帯 (#1466)
|
|
9330
9415
|
bands: "\u4E26\u3073",
|
|
9331
9416
|
// 矢印をいつ出すか (#1470)
|
|
9332
|
-
reveal: "\u975E\u7A7A\u306E\u6587\u5B57\u5217"
|
|
9417
|
+
reveal: "\u975E\u7A7A\u306E\u6587\u5B57\u5217",
|
|
9418
|
+
// 図の並ぶ向き (#1494)
|
|
9419
|
+
direction: "\u975E\u7A7A\u306E\u6587\u5B57\u5217"
|
|
9333
9420
|
},
|
|
9334
9421
|
actor: {
|
|
9335
9422
|
name: "\u5FC5\u9808\u306E\u975E\u7A7A\u6587\u5B57\u5217",
|
|
@@ -10650,6 +10737,8 @@ function jsonToDoc(json) {
|
|
|
10650
10737
|
bands: json.bands,
|
|
10651
10738
|
// 矢印をいつ出すか (#1470)
|
|
10652
10739
|
reveal: json.reveal,
|
|
10740
|
+
// 図の並ぶ向き (#1494)。 JSON は英語で書くので、記法と同じ語に直してから渡す
|
|
10741
|
+
...json.direction !== void 0 ? { direction: json.direction === "horizontal" ? "\u6A2A" : "\u7E26" } : {},
|
|
10653
10742
|
pos: p0
|
|
10654
10743
|
};
|
|
10655
10744
|
}
|
|
@@ -12466,6 +12555,11 @@ var diagram_default = {
|
|
|
12466
12555
|
pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
12467
12556
|
}
|
|
12468
12557
|
},
|
|
12558
|
+
direction: {
|
|
12559
|
+
type: "string",
|
|
12560
|
+
enum: ["vertical", "horizontal"],
|
|
12561
|
+
description: "\u56F3\u306E\u4E26\u3076\u5411\u304D\u3002 vertical = 1 \u3064\u306E\u7E26\u5217\u306B\u7A4D\u3080\u3002 horizontal = 1 \u4EBA\u305A\u3064\u7E26\u5217\u3092\u4F5C\u308B\u3002 \u52B9\u304F\u306E\u306F flow \u3068 swimlane \u3060\u3051\u3002"
|
|
12562
|
+
},
|
|
12469
12563
|
reveal: {
|
|
12470
12564
|
type: "string",
|
|
12471
12565
|
enum: ["phase", "all"],
|