@cardenelabs/dragon 0.41.0 → 0.42.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 +21 -1
- package/dist/cli.cjs +4122 -969
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4122 -969
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +3704 -942
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +3704 -942
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +4016 -815
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +159 -3
- package/dist/index.d.ts +159 -3
- package/dist/index.js +4016 -815
- package/dist/index.js.map +1 -1
- package/dist/{ink-B_7OXxtb.d.cts → ink-B8EZL7JV.d.cts} +95 -3
- package/dist/{ink-B_7OXxtb.d.ts → ink-B8EZL7JV.d.ts} +95 -3
- package/dist/node.cjs +2461 -726
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2461 -726
- package/dist/node.js.map +1 -1
- package/dist/player.global.js +2 -2
- package/package.json +1 -1
- package/src/export/capture.ts +17 -5
- package/src/export/fonts.ts +19 -1
- package/src/export/index.ts +2 -2
- package/src/field-messages.ts +12 -0
- package/src/figure-text.ts +26 -0
- package/src/index.ts +11 -1
- package/src/layout/scene.ts +23 -2
- package/src/layout/time.ts +680 -0
- package/src/look/values.ts +142 -2
- package/src/messages.ts +108 -5
- package/src/parser.ts +427 -6
- package/src/player.ts +48 -10
- package/src/printer.ts +63 -12
- package/src/render/icons.ts +2 -0
- package/src/render/parts.ts +29 -9
- package/src/render/svg.ts +129 -21
- package/src/render/time.ts +291 -0
- package/src/schema.ts +109 -10
- package/src/schemas/diagram.schema.json +224 -12
- package/src/schemas/validate-diagram.js +1 -1
- package/src/timeline.ts +147 -10
- package/src/words.ts +39 -6
package/src/schema.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface Box {
|
|
|
33
33
|
color?: Color;
|
|
34
34
|
icon?: string;
|
|
35
35
|
region?: string;
|
|
36
|
+
/** 飛び先。描いた図ではこの箱がここへの link になる。`/` で始まる path か、http:// か https:// で始まる URL (#3199) */
|
|
37
|
+
link?: string;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export type Carry = { kind: "envelope" } | { kind: "tag"; text: string } | { kind: "coin" } | { kind: "none" };
|
|
@@ -43,12 +45,79 @@ export type LabelSide = "above" | "below" | "left" | "right";
|
|
|
43
45
|
export type ViewMode = "fixed" | "follow";
|
|
44
46
|
|
|
45
47
|
export type DiagramEvent =
|
|
46
|
-
| { type: "edge"; from: string; to: string; label?: string; carry: Carry; labelSide?: LabelSide }
|
|
48
|
+
| { type: "edge"; from: string; to: string; label?: string; carry: Carry; labelSide?: LabelSide; at?: number; into?: number }
|
|
47
49
|
| { type: "action"; box: string; label: string }
|
|
48
|
-
| { type: "swap"; box: string; text: string }
|
|
50
|
+
| { type: "swap"; box: string; text: string; color?: Color }
|
|
49
51
|
| { type: "strip"; field: string; value?: string; tag?: string }
|
|
50
52
|
| GitCommit
|
|
51
|
-
| { type: "branch"; branch: string; from: string }
|
|
53
|
+
| { type: "branch"; branch: string; from: string }
|
|
54
|
+
| { type: "now"; to: number }
|
|
55
|
+
| TimeMarkEvent
|
|
56
|
+
| TimeSpanEvent;
|
|
57
|
+
|
|
58
|
+
/** 時間軸の図 (#3165) の、印の列 `row` の `from` から `to` の目盛りの印の色を変える出来事 */
|
|
59
|
+
export interface TimeMarkEvent {
|
|
60
|
+
type: "mark";
|
|
61
|
+
row: string;
|
|
62
|
+
from: number;
|
|
63
|
+
to: number;
|
|
64
|
+
color: Color;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 時間軸の図の、`from` から `to` の目盛りの括弧と字。`shape` が `box` なら印の列を囲み、字を縁の札にする */
|
|
68
|
+
export interface TimeSpanEvent {
|
|
69
|
+
type: "span";
|
|
70
|
+
from: number;
|
|
71
|
+
to: number;
|
|
72
|
+
text: string;
|
|
73
|
+
shape?: "box";
|
|
74
|
+
color?: Color;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 時間軸の図の目盛り。`unit` の名前の目盛りを `length` の長さ (`12s` など) で `count` 個並べ、最初の目盛りの番号を `from` にする */
|
|
78
|
+
export interface TimeScale {
|
|
79
|
+
unit: string;
|
|
80
|
+
length: string;
|
|
81
|
+
count: number;
|
|
82
|
+
from?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** 時間軸の図の区切り。目盛り `length` 個ごとに `name` の区切りを置き、最初の区切りの番号を `from` にする */
|
|
86
|
+
export interface TimePeriod {
|
|
87
|
+
name: string;
|
|
88
|
+
length: number;
|
|
89
|
+
from?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** 時間軸の図の印の列。目盛りごとに印を 1 つ置き、`empty` の目盛りは空きの印にする */
|
|
93
|
+
export interface TimeRow {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
color?: Color;
|
|
97
|
+
empty?: number[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** 時間軸の図の節目。`at` の目盛りの印の下に旗の丸と名札を置く */
|
|
101
|
+
export interface TimePoint {
|
|
102
|
+
id: string;
|
|
103
|
+
at: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 時間軸の図の種類の欄 */
|
|
107
|
+
export interface TimeSpec {
|
|
108
|
+
scale: TimeScale;
|
|
109
|
+
period?: TimePeriod;
|
|
110
|
+
rows: TimeRow[];
|
|
111
|
+
points?: TimePoint[];
|
|
112
|
+
/** 拡大の帯に列を作る目盛りの範囲 */
|
|
113
|
+
zoom?: { from: number; to: number };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** 中身の帯の物差しの欄。`line` の割合 (`2/3` か `97%`) の所に線を引く */
|
|
117
|
+
export interface StripMeter {
|
|
118
|
+
field: string;
|
|
119
|
+
line: string;
|
|
120
|
+
}
|
|
52
121
|
|
|
53
122
|
/**
|
|
54
123
|
* 枝分かれの図 (#3164) の commit を積む出来事。積んだ枝の札と、その枝を指す HEAD が新しい commit へ進む。
|
|
@@ -77,25 +146,34 @@ export interface StatePath {
|
|
|
77
146
|
label?: string;
|
|
78
147
|
}
|
|
79
148
|
|
|
149
|
+
/** 段の出典。読み上げの段の一覧に、名前を URL への link にして出す。URL の形は箱の飛び先と同じ (#3199) */
|
|
150
|
+
export interface StepSource {
|
|
151
|
+
name: string;
|
|
152
|
+
url: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
80
155
|
export interface Step {
|
|
81
156
|
title: string;
|
|
82
157
|
body: string;
|
|
83
158
|
code?: string;
|
|
159
|
+
/** 書いた順の出典。書かない段は欄を持たない */
|
|
160
|
+
sources?: StepSource[];
|
|
84
161
|
events: DiagramEvent[];
|
|
85
162
|
}
|
|
86
163
|
|
|
87
164
|
export interface Diagram {
|
|
88
165
|
version: number;
|
|
89
|
-
kind: "sequence" | "architecture" | "state" | "git";
|
|
166
|
+
kind: "sequence" | "architecture" | "state" | "git" | "time";
|
|
90
167
|
title: string;
|
|
91
168
|
view?: ViewMode;
|
|
92
169
|
regions?: Region[];
|
|
93
170
|
boxes: Box[];
|
|
94
|
-
strip?: { title: string; fields: string[] };
|
|
171
|
+
strip?: { title: string; fields: string[]; meters?: StripMeter[] };
|
|
95
172
|
steps: Step[];
|
|
96
173
|
sequence?: { lifelines: string[] };
|
|
97
174
|
state?: { paths: StatePath[] };
|
|
98
175
|
git?: { branches: GitBranch[] };
|
|
176
|
+
time?: TimeSpec;
|
|
99
177
|
}
|
|
100
178
|
|
|
101
179
|
export interface FieldError {
|
|
@@ -112,15 +190,18 @@ export interface CheckOptions {
|
|
|
112
190
|
}
|
|
113
191
|
|
|
114
192
|
/** 段の中で起きることの種類。schema の event の `discriminator` が見る `type` の値 */
|
|
115
|
-
const EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"] as const satisfies readonly DiagramEvent["type"][];
|
|
193
|
+
const EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span"] as const satisfies readonly DiagramEvent["type"][];
|
|
116
194
|
|
|
117
195
|
/**
|
|
118
196
|
* その種類の図に書けない根の欄を書いた時の決まりの場所 (#3164)。根の欄に `not: {}` を置く決まり (`absent`) を指し、
|
|
119
197
|
* 誤りの場所の最後の欄が書いた欄になる。種類の欄は、その欄と同じ名前の図の種類だけが書ける
|
|
120
198
|
*/
|
|
121
199
|
const ABSENT = "#/definitions/absent/not";
|
|
122
|
-
/**
|
|
123
|
-
|
|
200
|
+
/**
|
|
201
|
+
* 種類の欄でない欄を書ける図の種類。区画は枝分かれの図と時間軸の図に書けない。
|
|
202
|
+
* 線の列 (`at` と `into`)、節目の丸の色 (`color`)、物差し (`meters`) は時間軸の図だけが書ける (#3165)
|
|
203
|
+
*/
|
|
204
|
+
const ABSENT_KINDS: Record<string, string> = { regions: "sequence / architecture / state", at: "time", into: "time", color: "time", meters: "time" };
|
|
124
205
|
/** 運ぶ物の書けない組み合わせ (`not: { required: [欄] }`)。誤りの場所の最後の欄で引く */
|
|
125
206
|
const NOT_ALLOWED: Record<string, Allowed> = {
|
|
126
207
|
carry: { field: "text", kind: "tag" },
|
|
@@ -132,9 +213,20 @@ const RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
|
|
|
132
213
|
const GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
|
|
133
214
|
/** 枝分かれの図だけが書ける出来事 */
|
|
134
215
|
const GIT_EVENTS = ["commit", "branch"] as const satisfies readonly DiagramEvent["type"][];
|
|
216
|
+
/** 時間軸の図でない図に、時間軸の図だけの出来事を書いた時の決まりの場所 (#3165)。出来事に `not` を置く */
|
|
217
|
+
const TIME_EVENT = /\/events\/items\/not$/u;
|
|
218
|
+
/** 時間軸の図だけが書ける出来事 */
|
|
219
|
+
const TIME_EVENTS = ["now", "mark", "span"] as const satisfies readonly DiagramEvent["type"][];
|
|
220
|
+
/** 時間軸の図の目盛りの長さの決まり (`^[0-9]+(\.[0-9]+)?(<単位>|<単位>)$`)。書ける単位を読む */
|
|
221
|
+
const DURATION = /^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u;
|
|
222
|
+
/** 割合の決まり。百分率の `%` を持つ */
|
|
223
|
+
const RATIO = /%\)\$$/u;
|
|
135
224
|
|
|
136
225
|
const escape = (key: string): string => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
137
226
|
|
|
227
|
+
/** 箱の飛び先と段の出典の URL の決まりの場所 (#3199) */
|
|
228
|
+
const URL_RULE = "#/definitions/url/pattern";
|
|
229
|
+
|
|
138
230
|
/** commit の hash の決まり (`^[0-9a-f]{<最小>,<最大>}$`)。字の数の幅を読む */
|
|
139
231
|
const HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
140
232
|
|
|
@@ -170,6 +262,7 @@ function toFieldError(error: ErrorObject, errors: readonly ErrorObject[], m: Fie
|
|
|
170
262
|
case "not": {
|
|
171
263
|
if (RESERVED_ID.test(error.schemaPath)) return { pointer: at, message: m.reserved(STATE_ENDS) };
|
|
172
264
|
if (GIT_EVENT.test(error.schemaPath)) return { pointer: at, message: m.kindOnly(GIT_EVENTS, "git") };
|
|
265
|
+
if (TIME_EVENT.test(error.schemaPath)) return { pointer: `${at}/type`, message: m.kindOnly(TIME_EVENTS, "time") };
|
|
173
266
|
const last = at.slice(at.lastIndexOf("/") + 1);
|
|
174
267
|
if (error.schemaPath === ABSENT) return { pointer: at, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
|
|
175
268
|
const allowed = NOT_ALLOWED[last];
|
|
@@ -191,8 +284,14 @@ function toFieldError(error: ErrorObject, errors: readonly ErrorObject[], m: Fie
|
|
|
191
284
|
case "minLength":
|
|
192
285
|
return { pointer: at, message: m.minLength(Number(params.limit)) };
|
|
193
286
|
case "pattern": {
|
|
194
|
-
|
|
195
|
-
|
|
287
|
+
if (error.schemaPath === URL_RULE) return { pointer: at, message: m.url };
|
|
288
|
+
const pattern = String(params.pattern);
|
|
289
|
+
const hex = HEX.exec(pattern);
|
|
290
|
+
if (hex) return { pointer: at, message: m.hex(Number(hex[1]), Number(hex[2])) };
|
|
291
|
+
const duration = DURATION.exec(pattern);
|
|
292
|
+
if (duration) return { pointer: at, message: m.duration((duration[1] ?? "").split("|")) };
|
|
293
|
+
if (RATIO.test(pattern)) return { pointer: at, message: m.ratio };
|
|
294
|
+
return { pointer: at, message: m.pattern(forbiddenOf(pattern)) };
|
|
196
295
|
}
|
|
197
296
|
case "minItems":
|
|
198
297
|
return { pointer: at, message: m.minItems(Number(params.limit)) };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "dragon の図の原本",
|
|
3
|
-
"description": "区画、箱、線、運ぶ物、段、中身の帯の 6
|
|
3
|
+
"description": "区画、箱、線、運ぶ物、段、中身の帯の 6 部品を共通の骨組みに置き、図の種類だけの物は種類の欄に置く。座標は持たない。箱は枝分かれの図と時間軸の図だけが持たなくてよい。",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": ["version", "kind", "title", "boxes", "steps"],
|
|
7
7
|
"properties": {
|
|
8
8
|
"version": { "description": "形式の版", "type": "integer", "minimum": 1 },
|
|
9
|
-
"kind": { "description": "図の種類", "enum": ["sequence", "architecture", "state", "git"] },
|
|
9
|
+
"kind": { "description": "図の種類", "enum": ["sequence", "architecture", "state", "git", "time"] },
|
|
10
10
|
"title": { "$ref": "#/definitions/text" },
|
|
11
11
|
"view": { "description": "見せ方。書かなければ字の大きさで選ぶ。fixed は全体を止めて中だけ動かし、follow は寄って動かし全体図で今どこかを示す", "enum": ["fixed", "follow"] },
|
|
12
12
|
"regions": { "type": "array", "items": { "$ref": "#/definitions/region" } },
|
|
@@ -15,12 +15,20 @@
|
|
|
15
15
|
"steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } },
|
|
16
16
|
"sequence": { "$ref": "#/definitions/sequence" },
|
|
17
17
|
"state": { "$ref": "#/definitions/state" },
|
|
18
|
-
"git": { "$ref": "#/definitions/git" }
|
|
18
|
+
"git": { "$ref": "#/definitions/git" },
|
|
19
|
+
"time": { "$ref": "#/definitions/time" }
|
|
19
20
|
},
|
|
20
21
|
"if": { "required": ["kind"], "properties": { "kind": { "const": "sequence" } } },
|
|
21
22
|
"then": {
|
|
22
23
|
"required": ["sequence"],
|
|
23
|
-
"properties": {
|
|
24
|
+
"properties": {
|
|
25
|
+
"boxes": { "minItems": 1 },
|
|
26
|
+
"steps": { "$ref": "#/definitions/plainSteps" },
|
|
27
|
+
"strip": { "$ref": "#/definitions/plainStrip" },
|
|
28
|
+
"state": { "$ref": "#/definitions/absent" },
|
|
29
|
+
"git": { "$ref": "#/definitions/absent" },
|
|
30
|
+
"time": { "$ref": "#/definitions/absent" }
|
|
31
|
+
}
|
|
24
32
|
},
|
|
25
33
|
"else": {
|
|
26
34
|
"properties": { "sequence": { "$ref": "#/definitions/absent" } },
|
|
@@ -29,14 +37,44 @@
|
|
|
29
37
|
"properties": {
|
|
30
38
|
"boxes": { "minItems": 1, "items": { "properties": { "id": { "description": "始まりと終わりの印の名前は箱の名札に使えない", "not": { "enum": ["start", "finish"] } } } } },
|
|
31
39
|
"steps": { "$ref": "#/definitions/plainSteps" },
|
|
32
|
-
"
|
|
40
|
+
"strip": { "$ref": "#/definitions/plainStrip" },
|
|
41
|
+
"git": { "$ref": "#/definitions/absent" },
|
|
42
|
+
"time": { "$ref": "#/definitions/absent" }
|
|
33
43
|
}
|
|
34
44
|
},
|
|
35
45
|
"else": {
|
|
36
46
|
"if": { "required": ["kind"], "properties": { "kind": { "const": "git" } } },
|
|
37
|
-
"then": {
|
|
47
|
+
"then": {
|
|
48
|
+
"required": ["git"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"steps": { "$ref": "#/definitions/gitSteps" },
|
|
51
|
+
"strip": { "$ref": "#/definitions/plainStrip" },
|
|
52
|
+
"state": { "$ref": "#/definitions/absent" },
|
|
53
|
+
"regions": { "$ref": "#/definitions/absent" },
|
|
54
|
+
"time": { "$ref": "#/definitions/absent" }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
38
57
|
"else": {
|
|
39
|
-
"
|
|
58
|
+
"if": { "required": ["kind"], "properties": { "kind": { "const": "time" } } },
|
|
59
|
+
"then": {
|
|
60
|
+
"required": ["time"],
|
|
61
|
+
"properties": {
|
|
62
|
+
"steps": { "$ref": "#/definitions/timeSteps" },
|
|
63
|
+
"state": { "$ref": "#/definitions/absent" },
|
|
64
|
+
"git": { "$ref": "#/definitions/absent" },
|
|
65
|
+
"regions": { "$ref": "#/definitions/absent" }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"else": {
|
|
69
|
+
"properties": {
|
|
70
|
+
"boxes": { "minItems": 1 },
|
|
71
|
+
"steps": { "$ref": "#/definitions/plainSteps" },
|
|
72
|
+
"strip": { "$ref": "#/definitions/plainStrip" },
|
|
73
|
+
"state": { "$ref": "#/definitions/absent" },
|
|
74
|
+
"git": { "$ref": "#/definitions/absent" },
|
|
75
|
+
"time": { "$ref": "#/definitions/absent" }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
40
78
|
}
|
|
41
79
|
}
|
|
42
80
|
},
|
|
@@ -44,9 +82,49 @@
|
|
|
44
82
|
"text": { "type": "string", "minLength": 1 },
|
|
45
83
|
"absent": { "description": "この図の種類では書けない欄", "not": {} },
|
|
46
84
|
"plainSteps": {
|
|
47
|
-
"description": "
|
|
85
|
+
"description": "枝分かれの図でも時間軸の図でもない図の段。枝分かれの図だけの出来事 (commit と branch) と、時間軸の図だけの出来事 (now と mark と span) と欄 (at と into と color) を書けない",
|
|
86
|
+
"items": {
|
|
87
|
+
"properties": {
|
|
88
|
+
"events": {
|
|
89
|
+
"items": {
|
|
90
|
+
"not": { "$ref": "#/definitions/timeEvent" },
|
|
91
|
+
"properties": {
|
|
92
|
+
"type": { "not": { "enum": ["commit", "branch"] } },
|
|
93
|
+
"at": { "$ref": "#/definitions/absent" },
|
|
94
|
+
"into": { "$ref": "#/definitions/absent" },
|
|
95
|
+
"color": { "$ref": "#/definitions/absent" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"gitSteps": {
|
|
103
|
+
"description": "枝分かれの図の段。時間軸の図だけの出来事 (now と mark と span) と欄 (at と into と color) を書けない",
|
|
104
|
+
"items": {
|
|
105
|
+
"properties": {
|
|
106
|
+
"events": {
|
|
107
|
+
"items": {
|
|
108
|
+
"not": { "$ref": "#/definitions/timeEvent" },
|
|
109
|
+
"properties": { "at": { "$ref": "#/definitions/absent" }, "into": { "$ref": "#/definitions/absent" }, "color": { "$ref": "#/definitions/absent" } }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"timeSteps": {
|
|
116
|
+
"description": "時間軸の図の段。枝分かれの図だけの出来事 (commit と branch) を書けない",
|
|
48
117
|
"items": { "properties": { "events": { "items": { "properties": { "type": { "not": { "enum": ["commit", "branch"] } } } } } } }
|
|
49
118
|
},
|
|
119
|
+
"timeEvent": {
|
|
120
|
+
"description": "時間軸の図だけが書ける出来事",
|
|
121
|
+
"required": ["type"],
|
|
122
|
+
"properties": { "type": { "enum": ["now", "mark", "span"] } }
|
|
123
|
+
},
|
|
124
|
+
"plainStrip": {
|
|
125
|
+
"description": "時間軸の図でない図の中身の帯。物差しを書けない",
|
|
126
|
+
"properties": { "meters": { "$ref": "#/definitions/absent" } }
|
|
127
|
+
},
|
|
50
128
|
"id": { "type": "string", "pattern": "^[^\\s\\[\\]「」=:]+$" },
|
|
51
129
|
"color": { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] },
|
|
52
130
|
"region": {
|
|
@@ -71,7 +149,8 @@
|
|
|
71
149
|
"sub": { "$ref": "#/definitions/text" },
|
|
72
150
|
"color": { "$ref": "#/definitions/color" },
|
|
73
151
|
"icon": { "$ref": "#/definitions/text" },
|
|
74
|
-
"region": { "$ref": "#/definitions/id" }
|
|
152
|
+
"region": { "$ref": "#/definitions/id" },
|
|
153
|
+
"link": { "description": "飛び先。描いた図ではこの箱がここへの link になる", "$ref": "#/definitions/url" }
|
|
75
154
|
}
|
|
76
155
|
},
|
|
77
156
|
"strip": {
|
|
@@ -80,9 +159,21 @@
|
|
|
80
159
|
"required": ["title", "fields"],
|
|
81
160
|
"properties": {
|
|
82
161
|
"title": { "$ref": "#/definitions/text" },
|
|
83
|
-
"fields": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/text" } }
|
|
162
|
+
"fields": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/text" } },
|
|
163
|
+
"meters": { "description": "物差しにする欄。時間軸の図だけが書ける", "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/meter" } }
|
|
84
164
|
}
|
|
85
165
|
},
|
|
166
|
+
"meter": {
|
|
167
|
+
"description": "物差しの欄。line の割合の所に線を引き、set の値まで針と一緒に満ちる",
|
|
168
|
+
"type": "object",
|
|
169
|
+
"additionalProperties": false,
|
|
170
|
+
"required": ["field", "line"],
|
|
171
|
+
"properties": {
|
|
172
|
+
"field": { "$ref": "#/definitions/text" },
|
|
173
|
+
"line": { "$ref": "#/definitions/ratio" }
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"ratio": { "description": "割合。分数 (2/3) か百分率 (97%)", "type": "string", "pattern": "^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$" },
|
|
86
177
|
"step": {
|
|
87
178
|
"type": "object",
|
|
88
179
|
"additionalProperties": false,
|
|
@@ -91,9 +182,20 @@
|
|
|
91
182
|
"title": { "$ref": "#/definitions/text" },
|
|
92
183
|
"body": { "$ref": "#/definitions/text" },
|
|
93
184
|
"code": { "$ref": "#/definitions/text" },
|
|
185
|
+
"sources": { "description": "段の出典。読み上げの段の一覧に、名前を URL への link にして書いた順に出す", "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/source" } },
|
|
94
186
|
"events": { "type": "array", "items": { "$ref": "#/definitions/event" } }
|
|
95
187
|
}
|
|
96
188
|
},
|
|
189
|
+
"source": {
|
|
190
|
+
"type": "object",
|
|
191
|
+
"additionalProperties": false,
|
|
192
|
+
"required": ["name", "url"],
|
|
193
|
+
"properties": {
|
|
194
|
+
"name": { "$ref": "#/definitions/text" },
|
|
195
|
+
"url": { "$ref": "#/definitions/url" }
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"url": { "description": "頁を移る形。/ で始まる path か、http:// か https:// で始まる URL", "type": "string", "pattern": "^(/|https?://)" },
|
|
97
199
|
"event": {
|
|
98
200
|
"description": "段の中で起きること。起きる順に並べる",
|
|
99
201
|
"type": "object",
|
|
@@ -111,7 +213,9 @@
|
|
|
111
213
|
"to": { "$ref": "#/definitions/id" },
|
|
112
214
|
"label": { "$ref": "#/definitions/text" },
|
|
113
215
|
"carry": { "$ref": "#/definitions/carry" },
|
|
114
|
-
"labelSide": { "description": "線の名前を置く側 (寄せの指示)", "enum": ["above", "below", "left", "right"] }
|
|
216
|
+
"labelSide": { "description": "線の名前を置く側 (寄せの指示)", "enum": ["above", "below", "left", "right"] },
|
|
217
|
+
"at": { "description": "時間軸の図の拡大の帯で、線を引く列の目盛り", "$ref": "#/definitions/unit" },
|
|
218
|
+
"into": { "description": "時間軸の図の拡大の帯で、受ける箱を選ぶ列の目盛り。書かなければ at の列", "$ref": "#/definitions/unit" }
|
|
115
219
|
}
|
|
116
220
|
},
|
|
117
221
|
{
|
|
@@ -133,7 +237,8 @@
|
|
|
133
237
|
"properties": {
|
|
134
238
|
"type": { "const": "swap" },
|
|
135
239
|
"box": { "$ref": "#/definitions/id" },
|
|
136
|
-
"text": { "$ref": "#/definitions/text" }
|
|
240
|
+
"text": { "$ref": "#/definitions/text" },
|
|
241
|
+
"color": { "description": "時間軸の図の節目の丸の色", "$ref": "#/definitions/color" }
|
|
137
242
|
}
|
|
138
243
|
},
|
|
139
244
|
{
|
|
@@ -162,6 +267,43 @@
|
|
|
162
267
|
"from": { "$ref": "#/definitions/id" }
|
|
163
268
|
}
|
|
164
269
|
},
|
|
270
|
+
{
|
|
271
|
+
"description": "時間軸の図の今の時刻の針を、to の目盛りの終わりまで進める",
|
|
272
|
+
"type": "object",
|
|
273
|
+
"additionalProperties": false,
|
|
274
|
+
"required": ["type", "to"],
|
|
275
|
+
"properties": {
|
|
276
|
+
"type": { "const": "now" },
|
|
277
|
+
"to": { "$ref": "#/definitions/unit" }
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"description": "時間軸の図の印の列 row の、from から to の目盛りの印の色を変える",
|
|
282
|
+
"type": "object",
|
|
283
|
+
"additionalProperties": false,
|
|
284
|
+
"required": ["type", "row", "from", "to", "color"],
|
|
285
|
+
"properties": {
|
|
286
|
+
"type": { "const": "mark" },
|
|
287
|
+
"row": { "$ref": "#/definitions/id" },
|
|
288
|
+
"from": { "$ref": "#/definitions/unit" },
|
|
289
|
+
"to": { "$ref": "#/definitions/unit" },
|
|
290
|
+
"color": { "$ref": "#/definitions/color" }
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"description": "時間軸の図の from から to の目盛りに、括弧と字を出す。shape が box なら印の列を囲み、字を縁の札にする",
|
|
295
|
+
"type": "object",
|
|
296
|
+
"additionalProperties": false,
|
|
297
|
+
"required": ["type", "from", "to", "text"],
|
|
298
|
+
"properties": {
|
|
299
|
+
"type": { "const": "span" },
|
|
300
|
+
"from": { "$ref": "#/definitions/unit" },
|
|
301
|
+
"to": { "$ref": "#/definitions/unit" },
|
|
302
|
+
"text": { "$ref": "#/definitions/text" },
|
|
303
|
+
"shape": { "enum": ["box"] },
|
|
304
|
+
"color": { "$ref": "#/definitions/color" }
|
|
305
|
+
}
|
|
306
|
+
},
|
|
165
307
|
{
|
|
166
308
|
"description": "中身の帯の欄の値と札",
|
|
167
309
|
"type": "object",
|
|
@@ -228,6 +370,76 @@
|
|
|
228
370
|
}
|
|
229
371
|
},
|
|
230
372
|
"hash": { "description": "commit の hash。16 進の字で 4 から 40 字", "type": "string", "pattern": "^[0-9a-f]{4,40}$" },
|
|
373
|
+
"time": {
|
|
374
|
+
"description": "時間軸の図の種類の欄。目盛り、区切り、印の列、節目、拡大の範囲",
|
|
375
|
+
"type": "object",
|
|
376
|
+
"additionalProperties": false,
|
|
377
|
+
"required": ["scale", "rows"],
|
|
378
|
+
"properties": {
|
|
379
|
+
"scale": { "$ref": "#/definitions/scale" },
|
|
380
|
+
"period": { "$ref": "#/definitions/period" },
|
|
381
|
+
"rows": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/row" } },
|
|
382
|
+
"points": { "type": "array", "items": { "$ref": "#/definitions/point" } },
|
|
383
|
+
"zoom": { "$ref": "#/definitions/zoom" }
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"scale": {
|
|
387
|
+
"description": "目盛り。unit の名前の目盛りを length の長さで count 個並べ、最初の目盛りの番号を from にする",
|
|
388
|
+
"type": "object",
|
|
389
|
+
"additionalProperties": false,
|
|
390
|
+
"required": ["unit", "length", "count"],
|
|
391
|
+
"properties": {
|
|
392
|
+
"unit": { "$ref": "#/definitions/text" },
|
|
393
|
+
"length": { "$ref": "#/definitions/duration" },
|
|
394
|
+
"count": { "type": "integer", "minimum": 1 },
|
|
395
|
+
"from": { "type": "integer", "minimum": 0 }
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"duration": { "description": "長さ。数と単位 (ms、s、min、h、d) の組", "type": "string", "pattern": "^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$" },
|
|
399
|
+
"unit": { "description": "目盛りの位置。0 から数える", "type": "integer", "minimum": 0 },
|
|
400
|
+
"period": {
|
|
401
|
+
"description": "区切り。目盛り length 個ごとに name の区切りを置き、最初の区切りの番号を from にする",
|
|
402
|
+
"type": "object",
|
|
403
|
+
"additionalProperties": false,
|
|
404
|
+
"required": ["name", "length"],
|
|
405
|
+
"properties": {
|
|
406
|
+
"name": { "$ref": "#/definitions/text" },
|
|
407
|
+
"length": { "type": "integer", "minimum": 1 },
|
|
408
|
+
"from": { "type": "integer", "minimum": 0 }
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
"row": {
|
|
412
|
+
"description": "印の列。目盛りごとに印を 1 つ置き、empty の目盛りは空きの印にする",
|
|
413
|
+
"type": "object",
|
|
414
|
+
"additionalProperties": false,
|
|
415
|
+
"required": ["id", "name"],
|
|
416
|
+
"properties": {
|
|
417
|
+
"id": { "$ref": "#/definitions/id" },
|
|
418
|
+
"name": { "$ref": "#/definitions/text" },
|
|
419
|
+
"color": { "$ref": "#/definitions/color" },
|
|
420
|
+
"empty": { "type": "array", "items": { "$ref": "#/definitions/unit" } }
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"point": {
|
|
424
|
+
"description": "節目。at の目盛りの印の下に旗の丸と名札を置く",
|
|
425
|
+
"type": "object",
|
|
426
|
+
"additionalProperties": false,
|
|
427
|
+
"required": ["id", "at"],
|
|
428
|
+
"properties": {
|
|
429
|
+
"id": { "$ref": "#/definitions/id" },
|
|
430
|
+
"at": { "$ref": "#/definitions/unit" }
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"zoom": {
|
|
434
|
+
"description": "拡大の範囲。from から to の目盛りごとに拡大の帯に列を作る",
|
|
435
|
+
"type": "object",
|
|
436
|
+
"additionalProperties": false,
|
|
437
|
+
"required": ["from", "to"],
|
|
438
|
+
"properties": {
|
|
439
|
+
"from": { "$ref": "#/definitions/unit" },
|
|
440
|
+
"to": { "$ref": "#/definitions/unit" }
|
|
441
|
+
}
|
|
442
|
+
},
|
|
231
443
|
"path": {
|
|
232
444
|
"description": "移れる道。送る側に始まりの印 start、受ける側に終わりの印 finish を書ける。どの段にも出ない道は点線で描き、運ぶ物を走らせない",
|
|
233
445
|
"type": "object",
|