@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.
Files changed (47) hide show
  1. package/README.md +21 -1
  2. package/dist/cli.cjs +4122 -969
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +4122 -969
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +3704 -942
  7. package/dist/export.cjs.map +1 -1
  8. package/dist/export.d.cts +1 -1
  9. package/dist/export.d.ts +1 -1
  10. package/dist/export.js +3704 -942
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +4016 -815
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +159 -3
  15. package/dist/index.d.ts +159 -3
  16. package/dist/index.js +4016 -815
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-B_7OXxtb.d.cts → ink-B8EZL7JV.d.cts} +95 -3
  19. package/dist/{ink-B_7OXxtb.d.ts → ink-B8EZL7JV.d.ts} +95 -3
  20. package/dist/node.cjs +2461 -726
  21. package/dist/node.cjs.map +1 -1
  22. package/dist/node.js +2461 -726
  23. package/dist/node.js.map +1 -1
  24. package/dist/player.global.js +2 -2
  25. package/package.json +1 -1
  26. package/src/export/capture.ts +17 -5
  27. package/src/export/fonts.ts +19 -1
  28. package/src/export/index.ts +2 -2
  29. package/src/field-messages.ts +12 -0
  30. package/src/figure-text.ts +26 -0
  31. package/src/index.ts +11 -1
  32. package/src/layout/scene.ts +23 -2
  33. package/src/layout/time.ts +680 -0
  34. package/src/look/values.ts +142 -2
  35. package/src/messages.ts +108 -5
  36. package/src/parser.ts +427 -6
  37. package/src/player.ts +48 -10
  38. package/src/printer.ts +63 -12
  39. package/src/render/icons.ts +2 -0
  40. package/src/render/parts.ts +29 -9
  41. package/src/render/svg.ts +129 -21
  42. package/src/render/time.ts +291 -0
  43. package/src/schema.ts +109 -10
  44. package/src/schemas/diagram.schema.json +224 -12
  45. package/src/schemas/validate-diagram.js +1 -1
  46. package/src/timeline.ts +147 -10
  47. package/src/words.ts +39 -6
@@ -31,6 +31,41 @@ export function resolvePalette(id?: string): Palette {
31
31
  return found ?? (PALETTES[DEFAULT_PALETTE] as Palette);
32
32
  }
33
33
 
34
+ /**
35
+ * 色味が持つ色の変数の名前 (#3198)。呼ぶ側が `colors` で値を渡せる鍵。
36
+ * 外へ出す型を `palettes.json` から作ると、束ねた型の file に JSON の中身が初期値付きで写り、型の検査を通らなくなるため、名前を並べて作る。
37
+ * 並びが `palettes.json` の明るい背景の名前と食い違うと、下の 2 つの `_` で始まる型が、余る名前か足りない名前を挙げて型の検査で落ちる
38
+ */
39
+ const COLOR_NAMES = ["page", "bg", "surf", "sunk", "ink", "ink2", "mute", "hair", "line", "sh", "on-c", "c-blue", "t-blue", "c-amber", "t-amber", "c-green", "t-green", "c-violet", "t-violet", "c-rose", "t-rose", "c-slate", "t-slate", "coin", "coint", "coinin", "tint", "edge", "shA", "shB", "carry"] as const;
40
+ export type ColorName = (typeof COLOR_NAMES)[number];
41
+ type Never<T extends never> = T;
42
+ type PaletteColor = keyof (typeof palettes)[typeof DEFAULT_PALETTE]["light"];
43
+ type _NotInPalette = Never<Exclude<ColorName, PaletteColor>>;
44
+ type _NotListed = Never<Exclude<PaletteColor, ColorName>>;
45
+
46
+ /** 名前で選んだ色味に重ねる色の値。渡さない色は色味の値のまま残る (#3198) */
47
+ export type Colors = Partial<Record<ColorName, string>>;
48
+
49
+ const COLOR_NAME_SET: ReadonlySet<string> = new Set(COLOR_NAMES);
50
+
51
+ /** 色味が持つ色の変数の名前か。 */
52
+ export const isColorName = (name: string): name is ColorName => COLOR_NAME_SET.has(name);
53
+
54
+ /**
55
+ * 色の値として読めるか。値は CSS の変数として SVG の style と頁の要素の style にそのまま入るので、
56
+ * 宣言と要素から抜け出す字 (`;`、`{`、`}`、`"`、`'`、`<`、`>`、`&`、`\`、`:` など) を持たない字の並びで、
57
+ * 括弧が閉じていて (閉じない括弧は後ろの宣言を呑む)、外の file を読む `url(` を持たない値だけを通す
58
+ */
59
+ export function isColorValue(value: unknown): value is string {
60
+ if (typeof value !== "string" || !/^[\w\s#%.,()/+-]+$/u.test(value) || /url\(/iu.test(value)) return false;
61
+ let depth = 0;
62
+ for (const char of value) {
63
+ depth += char === "(" ? 1 : char === ")" ? -1 : 0;
64
+ if (depth < 0) return false;
65
+ }
66
+ return depth === 0;
67
+ }
68
+
34
69
  /** 色味の値を CSS の変数として並べる。 */
35
70
  export function paletteVars(palette: Palette, theme: Theme): string {
36
71
  return Object.entries(palette[theme])
@@ -80,6 +115,20 @@ export const TYPE = {
80
115
  gitId: text(11, 700),
81
116
  gitHash: text(10.5, 600, "mono"),
82
117
  gitNote: text(10.5, 650),
118
+ /**
119
+ * 時間軸の図 (#3165)。拡大の帯の列の上の字、印の列の名前、時刻の字、区切りの名前と目盛りの番号の範囲、
120
+ * 節目の名札と状態、範囲の括弧の字、空きの枠の字、物差しの線の字。和文を含む字は同じ大きさと太さの和文の字で描く
121
+ */
122
+ timeHead: text(11, 650, "mono"),
123
+ timeRow: text(11, 600),
124
+ timeTick: text(10.5, 600, "mono"),
125
+ timePeriod: text(11.5, 650),
126
+ timeRange: text(10.5, 500, "mono"),
127
+ pointName: text(11, 700, "mono"),
128
+ pointState: text(11.5, 700),
129
+ spanText: text(11, 650),
130
+ emptyText: text(11, 700),
131
+ meterLine: text(10.5, 700, "mono"),
83
132
  } as const;
84
133
 
85
134
  /** 置き場所と部品の大きさ。単位は図の座標 (字が原寸の時の px)。 */
@@ -160,6 +209,60 @@ export const LOOK = {
160
209
  labelUnder: 50,
161
210
  colors: ["blue", "violet", "green", "amber", "rose"],
162
211
  },
212
+ /**
213
+ * 時間軸の図 (#3165)。見本帳の試作 (`scenes/finality.js`) の寸法を写す。
214
+ * 図の幅は `width` で、時間軸は左の `axisX` から右の余白 `right` の手前まで。印の列の名前が長い時は、名前の右に `gutterGap` を空けて軸を右へ寄せる。
215
+ * 拡大の帯は列ごとに、上端から `head` に列の上の字の基準線を、`boxTop` に最初の箱の上端を置き、箱を `boxGap` ずつ空けて縦に並べ、
216
+ * 最後の箱の下に `zoomBottom` を空ける。`sep` は列の区切りの点線を帯の上下から縮める長さ、`zoomGap` は拡大の帯と時間軸の帯の間。
217
+ * 時間軸の帯は、上端から `rowsTop` に最初の印の列を置き、列の高さ `row` と間 `rowGap` で並べる。
218
+ * 印の幅は目盛りの幅の `markRatio` で、`markMin` と `markMax` の間に収める。`shade` は区切りの地を印の列の上下へ広げる長さ、
219
+ * `frame` は拡大した目盛りを囲む枠を印の外へ広げる長さ、`emptyR` は空きの印の点の半径。
220
+ * `point` は節目で、印の下端から丸の真ん中まで `drop`、丸の半径 `r`、丸の真ん中から字の左端まで `text`、名札と状態の基準線の高さ `nameY` と `stateY`。
221
+ * 節目どうしの線は名札の右から `link` 空けて引き始め、次の丸の手前 `end` で止める。`room` は線の名前を下に置く時に丸の下に空ける高さ、`plain` は置かない時。
222
+ * `bracket` は範囲の括弧で、上の物から `gap` 空けて置き、`tick` は括弧の足の長さ、`text` は足の先から字の基準線まで、`lane` は括弧を重ねる時の間。
223
+ * `box` は範囲の囲みで、`pad` は印の列の外へ広げる長さ、`tagX` は左端から縁の札まで、`tagH` と `tagPadX` は札の高さと字の左右の余白。
224
+ * `axisGap` は上の物から時刻の目盛りの線まで、`major` と `minor` は目盛りの線の長さ、`minorPx` は細かい目盛りの間の下限、
225
+ * `tickY` は目盛りの線から時刻の字の基準線まで、`rangeY` は区切りの名前の基準線から目盛りの番号の範囲の基準線まで、`nameGap` は時刻の字と区切りの名前の間の下限、
226
+ * `ticks` は区切りの無い図の時刻の字の数の上限、`bottom` は時刻の字の下の余白。
227
+ * `needle` は針で、印の列の上下へ `over` だけ伸ばし、`head` は上の三角の高さ、`dot` は目盛りの線の上の点の半径。
228
+ * `meter` は中身の帯の物差しで、幅 `w`、高さ `h`、欄の上端から棒の上端まで `y`、線の印を棒の上下へ伸ばす長さ `mark`、欄の上端から線の字の基準線まで `textY`。色は `color`
229
+ */
230
+ time: {
231
+ width: 728,
232
+ axisX: 118,
233
+ right: 16,
234
+ gutterGap: 12,
235
+ head: 22,
236
+ boxTop: 34,
237
+ boxGap: 36,
238
+ zoomBottom: 14,
239
+ sep: 12,
240
+ zoomGap: 12,
241
+ rowsTop: 24,
242
+ row: 20,
243
+ rowGap: 6,
244
+ markRatio: 0.5,
245
+ markMin: 1.5,
246
+ markMax: 18,
247
+ markRadius: 1.5,
248
+ shade: 8,
249
+ frame: 2.5,
250
+ emptyR: 1.7,
251
+ point: { drop: 40, r: 9, text: 15, nameY: -2, stateY: 12, link: 10, end: 6, room: 30, plain: 12, glyph: 0.62 },
252
+ bracket: { gap: 12, tick: 6, text: 16, lane: 34 },
253
+ box: { pad: 6, tagX: 12, tagH: 16, tagPadX: 7 },
254
+ axisGap: 18,
255
+ major: 12,
256
+ minor: 6,
257
+ minorPx: 40,
258
+ tickY: 18,
259
+ rangeY: 14,
260
+ nameGap: 8,
261
+ ticks: 6,
262
+ bottom: 12,
263
+ needle: { over: 8, head: 6, dot: 3.5 },
264
+ meter: { w: 150, h: 6, y: 36, mark: 5, textY: 59, color: "amber" },
265
+ },
163
266
  /** `bend` は線の曲がりを丸める半径 (#3171) */
164
267
  edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
165
268
  /** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
@@ -180,7 +283,37 @@ export const LOOK = {
180
283
  * `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
181
284
  */
182
285
  strip: { h: 72, line: 44, pad: 12, icon: 24, titleX: 44, fieldGap: 22, sepInset: 14, tagGap: 6, tagH: 15, tagPadX: 7, nameY: 22, valueY: 43, trail: { r: 5.4, step: 16 }, now: { r: 3, gap: 7 } },
183
- stroke: { git: 2.25, gitOrphan: 1.5, mark: 1.6, slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
286
+ /** `time` から始まる値は時間軸の図 (#3165) の、目盛りの印の枠、拡大の枠、時刻の線、範囲の括弧と囲み、節目へ下ろす点線、節目の丸、針、物差しの線の印 */
287
+ stroke: {
288
+ git: 2.25,
289
+ gitOrphan: 1.5,
290
+ mark: 1.6,
291
+ slot: 1.2,
292
+ hair: 1,
293
+ edge: 1.7,
294
+ edgeOn: 2.25,
295
+ arrow: 1.5,
296
+ flow: 1.3,
297
+ halo: 7,
298
+ on: 1.75,
299
+ glyph: 2,
300
+ lifeline: 1.2,
301
+ envelope: 1.5,
302
+ badgeRing: 1.5,
303
+ path: 1.6,
304
+ end: 1.6,
305
+ done: 1.2,
306
+ trail: 1.2,
307
+ timeSlot: 0.6,
308
+ timeFrame: 1.25,
309
+ timeAxis: 1,
310
+ timeSpan: 1.5,
311
+ timeDrop: 1.4,
312
+ timePoint: 1.75,
313
+ timeFlag: 1.8,
314
+ timeNeedle: 1.25,
315
+ timeMeter: 1.25,
316
+ },
184
317
  shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
185
318
  mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
186
319
  /**
@@ -194,7 +327,8 @@ export const LOOK = {
194
327
  */
195
328
  follow: { aspect: 0.75, minH: 320, fitMinH: 160, ease: 0.6, narrow: 440, badgeRoom: 8, headRoom: 10, head: { pad: 8, h: 40, nameY: 17, subY: 31 } },
196
329
  /** 色を混ぜる割合 (%) */
197
- mix: { slot: 45, icon: 14, regionIcon: 16, regionIconEdge: 34, cap: 12, capEdge: 42, badgePast: 14, badgePastEdge: 70, mini: 62, miniBand: 16, miniBandEdge: 36, view: 6, side: 4, sideEdge: 36, ghostEdge: 60, path: 55, past: 72 },
330
+ /** `time` から始まる値は時間軸の図 (#3165) の、区切りの地、範囲の囲みの地、空きの枠の地、拡大の点線の濃さ */
331
+ mix: { slot: 45, icon: 14, regionIcon: 16, regionIconEdge: 34, cap: 12, capEdge: 42, badgePast: 14, badgePastEdge: 70, mini: 62, miniBand: 16, miniBandEdge: 36, view: 6, side: 4, sideEdge: 36, ghostEdge: 60, path: 55, past: 72, timeShade: 3.5, timeSpan: 6, timeEmpty: 8, timeGuide: 50 },
198
332
  /** 字の並びの基準線を、置きたい高さの真ん中からどれだけ下げるか */
199
333
  baseline: { label: 3.8, badge: 3.5, carrier: 3.7, stripTitle: 4.5, tag: 3.6, action: 3.8, mark: 4 },
200
334
  /** 浮いて出る物が下から上がる長さと、弾んで出る物の始まりの大きさ */
@@ -242,6 +376,12 @@ export const MOTION = {
242
376
  still: 0.45,
243
377
  /** 状態遷移図で、札が状態を出てから済んだ印が出るまで */
244
378
  done: 0.3,
379
+ /**
380
+ * 時間軸の図 (#3165) の針。目盛り 1 つを進む長さは、軸の端から端までを `axis` 秒で進む長さを `unitMin` と `unitMax` の間に収めた値で、どの段でも同じ。
381
+ * 拡大した目盛りでは、その段のその列の線を引き終えてから `wait` 秒待って次の目盛りへ進む。
382
+ * `after` は針が止まってから次の出来事を起こすまで、`reset` は区切りが替わって物差しが 0 に戻る長さ
383
+ */
384
+ time: { axis: 11.5, unitMin: 0.12, unitMax: 0.4, wait: 0.15, after: 0.15, reset: 0.05 },
245
385
  } as const;
246
386
 
247
387
  /** 見せ方を決める字の大きさ。全体を枠に収めた時の箱の名前がこれを下回ると寄って追う。 */
package/src/messages.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * (渡さなければ日本語) で出す。文の中の記法の語は語の表から引き、表と文で語が食い違わないようにする。
6
6
  */
7
7
  import { COLORS } from "./schema";
8
- import { CARRIES, HEADS, KINDS, type NotationLang, SIDES, VIEWS } from "./words";
8
+ import { CARRIES, DURATION_UNITS, HEADS, KINDS, type NotationLang, SIDES, SPAN_SHAPES, VIEWS } from "./words";
9
9
 
10
10
  /** 新しい形のどの行の書き方を示すか。前の形の行に当たった時に、誤りの文が書き方を示す */
11
11
  export type Shape = "sequence" | "architecture" | "group" | "box" | "strip" | "view" | "step" | "say" | "code" | "act" | "note" | "set";
@@ -29,6 +29,8 @@ export interface Messages {
29
29
  sayTwice: string;
30
30
  codeTwice: string;
31
31
  emptyCode: string;
32
+ /** 段の出典の行の形 (#3199) */
33
+ sourceShape: string;
32
34
  declarationInStep: string;
33
35
  stepLineBeforeStep: string;
34
36
  nestedGroup: string;
@@ -58,6 +60,8 @@ export interface Messages {
58
60
  badView: string;
59
61
  badCarry: string;
60
62
  badSide: string;
63
+ /** 箱の飛び先 (`link`) か段の出典 (`url`) に、頁を移る形でない URL を書いた (#3199) */
64
+ badUrl: (key: string) => string;
61
65
  carryTwice: string;
62
66
  /** 状態遷移図の箱の名札に、始まりか終わりの印の名前を書いた */
63
67
  reservedId: (id: string) => string;
@@ -82,6 +86,43 @@ export interface Messages {
82
86
  /** 枝分かれの図で、今いる場所の札の名前 (`name`) を名札にした */
83
87
  headReserved: (name: string) => string;
84
88
  badHash: string;
89
+ /** 時間軸の図だけの行か属性 (`word`) を、別の種類の図に書いた (#3165) */
90
+ timeOnly: (word: string) => string;
91
+ /** 時間軸の図の宣言の行を 2 つ書いた */
92
+ timeTwice: (word: string) => string;
93
+ noScale: string;
94
+ noRows: string;
95
+ scaleShape: string;
96
+ periodShape: string;
97
+ rowShape: string;
98
+ pointShape: string;
99
+ zoomShape: string;
100
+ nowShape: string;
101
+ markShape: string;
102
+ spanShape: string;
103
+ badLength: string;
104
+ badCount: (word: string) => string;
105
+ /** 目盛りの位置か範囲 (`text`) が、0 から `count - 1` の外か、範囲の形でない */
106
+ badUnit: (text: string, count: number) => string;
107
+ /** 針を前の時刻 (`at` の目盛りの終わり) より先へ進めない `now` */
108
+ nowBack: (text: string, at: number) => string;
109
+ /** 拡大の帯の外の列 */
110
+ outOfZoom: (from: number, to: number) => string;
111
+ noZoom: string;
112
+ /** 時間軸の図の箱を宣言したのに、拡大の帯 (`zoom`) が無い */
113
+ boxNeedsZoom: string;
114
+ boxLineNeedsAt: string;
115
+ pointLineNoAt: string;
116
+ mixedLine: string;
117
+ undeclaredRow: (id: string) => string;
118
+ /** 時間軸の図の note の行の名札が、箱でも節目でもない */
119
+ undeclaredNote: (id: string) => string;
120
+ nowReserved: (name: string) => string;
121
+ noteColorPointOnly: string;
122
+ badShape: string;
123
+ badRatio: string;
124
+ /** 物差しの欄 `field` の値が割合でない */
125
+ meterValue: (field: string) => string;
85
126
  }
86
127
 
87
128
  const list = (words: readonly string[]): string => words.join(" / ");
@@ -119,8 +160,9 @@ const ja = (): Messages => {
119
160
  sayTwice: "1 つの段に say は 1 つまで。長い本文は say の下に字下げして続ける",
120
161
  codeTwice: "1 つの段に code は 1 行まで",
121
162
  emptyCode: "code の後ろに命令を書く",
122
- declarationInStep: "group と box と strip と branch は最初の step より前に書く",
123
- stepLineBeforeStep: "線と say と code と act と note と set と commit と枝を切る行は step の下に書く",
163
+ sourceShape: "source は source <名前> [url: <URL>] の形で書く",
164
+ declarationInStep: "group と box と strip と branch と、scale と period と row と point と zoom は最初の step より前に書く",
165
+ stepLineBeforeStep: "線と say と code と source と act と note と set と commit と枝を切る行と、now と mark と span の行は step の下に書く",
124
166
  nestedGroup: "group の中に group は書けない。先に end で閉じる",
125
167
  strayEnd: "end の前に、閉じる group が無い",
126
168
  endTakesNothing: "end の後ろには何も書かない",
@@ -148,6 +190,7 @@ const ja = (): Messages => {
148
190
  badView: `view は ${list(VIEWS)} のどれか`,
149
191
  badCarry: `carry は ${list(CARRIES)} のどれか。札は tag: <値> で書く`,
150
192
  badSide: `side は ${list(SIDES)} のどれか`,
193
+ badUrl: (key) => `${key} には / で始まる path か、http:// か https:// で始まる URL を書く`,
151
194
  carryTwice: "運ぶ物は 1 本の線に 1 つまで。carry と tag は一緒に書かない",
152
195
  reservedId: (id) => `${id} は状態遷移図の始まりと終わりの印の名前で、箱の名札に使えない`,
153
196
  intoStart: "start へ入る線は書けない。start は始まりの印で、線は start から出る",
@@ -166,6 +209,35 @@ const ja = (): Messages => {
166
209
  mergeSelf: (id) => `${id} は積む枝なので、取り込む枝にできない`,
167
210
  headReserved: (name) => `${name} は枝分かれの図で今いる場所の札の名前で、名札に使えない`,
168
211
  badHash: "hash は 0 から 9 と a から f の字で 4 から 40 字にする",
212
+ timeOnly: (word) => `${word} は time (時間軸の図) でだけ書ける`,
213
+ timeTwice: (word) => `${word} は 1 つだけ宣言する`,
214
+ noScale: "scale の行で目盛りを宣言する",
215
+ noRows: "row の行で印の列を 1 つ以上宣言する",
216
+ scaleShape: "scale は scale <単位> <長さ> <数> [from: <番号>] の形で書く",
217
+ periodShape: "period は period <名前> <目盛りの数> [from: <番号>] の形で書く",
218
+ rowShape: "row は row <名札> as <名前> [color: <色>, empty: <目盛り> <目盛り>] の形で書く",
219
+ pointShape: "point は point <名札> at <目盛り> の形で書く",
220
+ zoomShape: "zoom は zoom <目盛り>-<目盛り> の形で書く",
221
+ nowShape: "針を進める行は now -> <目盛り> の形で書く",
222
+ markShape: "mark は mark <列> <目盛り>-<目盛り> [color: <色>] の形で書く",
223
+ spanShape: `span は span <目盛り>-<目盛り>: <字> [shape: ${list(SPAN_SHAPES)}, color: <色>] の形で書く`,
224
+ badLength: `長さは数と単位 (${list(DURATION_UNITS)}) の組で書く (12s など)`,
225
+ badCount: (word) => `${word} の目盛りの数は 1 以上の整数にする`,
226
+ badUnit: (text, count) => `${text} は目盛りの位置にできない。0 から ${count - 1} の数か、その範囲 (0-3 など) を書く`,
227
+ nowBack: (text, at) => `now -> ${text} は針を進めない。前の now (${at}) より後の目盛りを書く`,
228
+ outOfZoom: (from, to) => `拡大の帯の列は ${from} から ${to} の目盛りから選ぶ`,
229
+ noZoom: "at と into は、zoom で拡大の帯を宣言した図の箱どうしの線にだけ書ける",
230
+ boxNeedsZoom: "時間軸の図の箱は拡大の帯に置く。zoom <目盛り>-<目盛り> で拡大の範囲を書く",
231
+ boxLineNeedsAt: "拡大の帯の箱どうしの線には [at: <目盛り>] で列を書く",
232
+ pointLineNoAt: "節目どうしの線は軸の上に引くので、at と into を書けない",
233
+ mixedLine: "線は箱どうしか、節目どうしで引く",
234
+ undeclaredRow: (id) => `${id} という印の列は宣言していない`,
235
+ undeclaredNote: (id) => `${id} という箱か節目は宣言していない`,
236
+ nowReserved: (name) => `${name} は時間軸の図で針を進める行の語で、名札に使えない`,
237
+ noteColorPointOnly: "note の color は節目の丸の色で、節目の note にだけ書ける",
238
+ badShape: `shape は ${list(SPAN_SHAPES)} だけ書ける。括弧は shape を書かない`,
239
+ badRatio: "物差しの線は分数 (2/3) か百分率 (97%) で書く",
240
+ meterValue: (field) => `${field} は物差しの欄なので、値を分数 (2/3) か百分率 (97%) で書く`,
169
241
  };
170
242
  };
171
243
 
@@ -202,8 +274,9 @@ const en = (): Messages => {
202
274
  sayTwice: "A step takes one say. Continue a long body on indented lines below it",
203
275
  codeTwice: "A step takes at most one code line",
204
276
  emptyCode: "Write the command after code",
205
- declarationInStep: "Write group, box, strip and branch before the first step",
206
- stepLineBeforeStep: "Write lines, say, code, act, note, set, commit and branch cuts under a step",
277
+ sourceShape: "Write a source as source <name> [url: <URL>]",
278
+ declarationInStep: "Write group, box, strip, branch, scale, period, row, point and zoom before the first step",
279
+ stepLineBeforeStep: "Write lines, say, code, source, act, note, set, commit, branch cuts, now, mark and span under a step",
207
280
  nestedGroup: "A group cannot hold another group. Close it with end first",
208
281
  strayEnd: "There is no group for this end to close",
209
282
  endTakesNothing: "Write nothing after end",
@@ -231,6 +304,7 @@ const en = (): Messages => {
231
304
  badView: `view is one of ${list(VIEWS)}`,
232
305
  badCarry: `carry is one of ${list(CARRIES)}. Write a tag as tag: <value>`,
233
306
  badSide: `side is one of ${list(SIDES)}`,
307
+ badUrl: (key) => `Write a path that starts with / or a URL that starts with http:// or https:// for ${key}`,
234
308
  carryTwice: "A line carries one thing. Do not write carry and tag together",
235
309
  reservedId: (id) => `${id} names the start or end mark of a state diagram and cannot be a box id`,
236
310
  intoStart: "A line cannot go into start. start is the start mark, and lines leave it",
@@ -249,6 +323,35 @@ const en = (): Messages => {
249
323
  mergeSelf: (id) => `${id} is the branch being committed to, so it cannot be the branch merged in`,
250
324
  headReserved: (name) => `${name} names where you are in a git diagram and cannot be an id`,
251
325
  badHash: "Write a hash as 4 to 40 characters of 0-9 and a-f",
326
+ timeOnly: (word) => `${word} can be written only in time diagrams`,
327
+ timeTwice: (word) => `Declare only one ${word}`,
328
+ noScale: "Declare the scale with a scale line",
329
+ noRows: "Declare at least one row with a row line",
330
+ scaleShape: "Write a scale as scale <unit> <length> <count> [from: <number>]",
331
+ periodShape: "Write a period as period <name> <units> [from: <number>]",
332
+ rowShape: "Write a row as row <id> as <name> [color: <color>, empty: <unit> <unit>]",
333
+ pointShape: "Write a point as point <id> at <unit>",
334
+ zoomShape: "Write a zoom as zoom <unit>-<unit>",
335
+ nowShape: "Write a needle line as now -> <unit>",
336
+ markShape: "Write a mark as mark <row> <unit>-<unit> [color: <color>]",
337
+ spanShape: `Write a span as span <unit>-<unit>: <text> [shape: ${list(SPAN_SHAPES)}, color: <color>]`,
338
+ badLength: `Write a length as a number and a unit (${list(DURATION_UNITS)}), such as 12s`,
339
+ badCount: (word) => `The unit count of ${word} is a whole number of 1 or more`,
340
+ badUnit: (text, count) => `${text} cannot be a unit. Write a number from 0 to ${count - 1}, or a range such as 0-3`,
341
+ nowBack: (text, at) => `now -> ${text} does not move the needle forward. Write a unit after the previous now (${at})`,
342
+ outOfZoom: (from, to) => `Pick a zoom column from units ${from} to ${to}`,
343
+ noZoom: "at and into are allowed only on lines between boxes in a diagram that declares a zoom",
344
+ boxNeedsZoom: "Boxes of a time diagram sit in the zoom band. Write the zoom range as zoom <unit>-<unit>",
345
+ boxLineNeedsAt: "Write the column of a line between zoom boxes as [at: <unit>]",
346
+ pointLineNoAt: "A line between points runs along the axis, so it takes no at or into",
347
+ mixedLine: "Draw a line between two boxes or between two points",
348
+ undeclaredRow: (id) => `No row named ${id} is declared`,
349
+ undeclaredNote: (id) => `No box or point named ${id} is declared`,
350
+ nowReserved: (name) => `${name} starts the needle line of a time diagram and cannot be an id`,
351
+ noteColorPointOnly: "The color of a note colors the circle of a point, so write it only on the note of a point",
352
+ badShape: `shape takes only ${list(SPAN_SHAPES)}. A bracket takes no shape`,
353
+ badRatio: "Write the meter line as a fraction (2/3) or a percentage (97%)",
354
+ meterValue: (field) => `${field} is a meter, so write its value as a fraction (2/3) or a percentage (97%)`,
252
355
  };
253
356
  };
254
357