@cardenelabs/dragon 0.36.4 → 0.37.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-9VLameDG.cjs';
2
- export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as READABLE_PX, h as Region, S as Step, r as resolvePalette, v as validateDiagram } from './schema-9VLameDG.cjs';
1
+ import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-B2MTRv66.cjs';
2
+ export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as READABLE_PX, h as Region, S as StatePath, i as Step, r as resolvePalette, v as validateDiagram } from './schema-B2MTRv66.cjs';
3
3
 
4
4
  /**
5
5
  * 図が使う 2 つの字。どちらも package の依存として同梱する。
@@ -52,6 +52,7 @@ declare function parseNotation(notation: string, options?: ParseOptions): Parsed
52
52
  * 並べ方は決まった形に整える。JSON の欄の並び順は見ず、欄の名前で読むので、
53
53
  * 同じ内容の JSON からは毎回同じ文字列になる。書き手の行の並べ方とコメントは保たない。
54
54
  * 段の中で起きることは JSON の並び順 (起きる順) のまま書く。
55
+ * 状態遷移図の移れる道 (`state.paths`) は、帯の宣言の後、最初の `step` より前に JSON の並びのまま書く (#3163)。
55
56
  *
56
57
  * `"` で囲むのは要る時だけにする。`[` を含む名前と、`,` か `]` を含む属性の値と、`"` で始まる字を囲む。
57
58
  * 箱は JSON の並びのまま書き、同じ区画の箱が続く所を 1 つの `group … end` にする。
@@ -100,6 +101,8 @@ interface SceneBox extends Rect {
100
101
  color: ColorKey;
101
102
  cx: number;
102
103
  cy: number;
104
+ /** 状態遷移図で、どの段も辿り着かない状態。点線の箱で脇道の囲みに描く */
105
+ ghost?: boolean;
103
106
  }
104
107
  interface SceneRegion extends Rect {
105
108
  id: string;
@@ -130,6 +133,34 @@ interface SceneLabel extends Rect {
130
133
  family: Family;
131
134
  color: ColorKey;
132
135
  }
136
+ /** 状態遷移図の、最初の段より前に書いてどの段にも出ない線。点線で描き、運ぶ物を走らせない */
137
+ interface ScenePath {
138
+ from: string;
139
+ to: string;
140
+ points: Point[];
141
+ label?: Rect & {
142
+ text: string;
143
+ family: Family;
144
+ };
145
+ }
146
+ /** 状態遷移図の始まりと終わりの印。`ghost` は脇道の中の終わりの印 */
147
+ interface SceneEnd {
148
+ kind: "start" | "finish";
149
+ x: number;
150
+ y: number;
151
+ r: number;
152
+ ghost: boolean;
153
+ /** 印の右に添える字 */
154
+ text: string;
155
+ /** 終わりの印へ線を引く状態 */
156
+ box?: string;
157
+ }
158
+ /** 状態遷移図の脇道の囲み。`title` と `notes` は囲みの左上に置く字 */
159
+ interface SceneSide extends Rect {
160
+ title: string;
161
+ /** 囲みの名前の下に 1 行ずつ置く添え書き */
162
+ notes: string[];
163
+ }
133
164
  /** 時系列図の箱の中の処理。生存線の上に札で出す。 */
134
165
  interface SceneAction extends Rect {
135
166
  step: number;
@@ -156,9 +187,21 @@ interface SceneField {
156
187
  y: number;
157
188
  w: number;
158
189
  }
190
+ /** 状態遷移図の帯の最後の欄。段が辿り着く順に状態を点で並べ、着いた状態を塗る (#3171) */
191
+ interface SceneTrail {
192
+ title: string;
193
+ states: {
194
+ box: string;
195
+ color: ColorKey;
196
+ }[];
197
+ x: number;
198
+ y: number;
199
+ w: number;
200
+ }
159
201
  interface SceneStrip extends Rect {
160
202
  title: string;
161
203
  fields: SceneField[];
204
+ trail?: SceneTrail;
162
205
  }
163
206
  interface Layout {
164
207
  kind: Diagram["kind"];
@@ -172,6 +215,12 @@ interface Layout {
172
215
  actions: SceneAction[];
173
216
  badges: SceneBadge[];
174
217
  strip?: SceneStrip;
218
+ /** 状態遷移図の通らない道。他の図の種類では空 */
219
+ paths: ScenePath[];
220
+ /** 状態遷移図の始まりと終わりの印。他の図の種類では空 */
221
+ ends: SceneEnd[];
222
+ /** 状態遷移図の脇道の囲み。通らない状態が無ければ無い */
223
+ side?: SceneSide;
175
224
  }
176
225
 
177
226
  /** 秒で表した、見えている間。`end` の時刻は含まない。 */
@@ -196,6 +245,8 @@ interface CarrierTime extends Span {
196
245
  interface LabelTime extends Span {
197
246
  step: number;
198
247
  event: number;
248
+ /** 状態遷移図だけが持つ。段が終わった後に薄く残す間 */
249
+ after?: Span;
199
250
  }
200
251
  /** 処理、箱の字の書き換え、中身の帯の値が起きる時刻。 */
201
252
  interface EventTime {
@@ -203,6 +254,12 @@ interface EventTime {
203
254
  event: number;
204
255
  at: number;
205
256
  }
257
+ /** 状態遷移図の状態ごとの、光っている間と、済んだ印が出る時刻。運ぶ物が出ていない状態は `done` を持たない */
258
+ interface StateTime {
259
+ box: string;
260
+ lit: Span[];
261
+ done?: number;
262
+ }
206
263
  interface Timeline {
207
264
  /** 1 周の長さ */
208
265
  total: number;
@@ -219,6 +276,8 @@ interface Timeline {
219
276
  events: EventTime[];
220
277
  /** 段ごとの止め絵の時刻。その段で起きることが全部見えている */
221
278
  stills: number[];
279
+ /** 状態遷移図だけが持つ */
280
+ states?: StateTime[];
222
281
  }
223
282
 
224
283
  interface RenderOptions {
@@ -267,9 +326,24 @@ interface Player {
267
326
  }
268
327
  declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: PlayerOptions): Player;
269
328
 
329
+ /**
330
+ * 箱と区画の印の形。どれも (0, 0) を中心に 20 四方へ収める。
331
+ *
332
+ * 見本帳 (`docs/design/base/engine.js` の `G`) と同じ形を持つ。`block` だけは見本帳が絵を手で描いていたので、ここで足した。
333
+ * `undo` (戻る矢印) と `yen` (円の印) は、注文の試作 (`docs/design/base/scenes/order.js`) が返品と返金に足した形 (#3171)。
334
+ * package の入口からも出し、見本帳の部品「絵」の頁がこの表から使える絵柄の一覧を作る。1 つずつの絵は `iconSvg` が描く (#3172)。
335
+ */
336
+ declare const ICONS: Readonly<Record<string, string>>;
337
+
338
+ /**
339
+ * 絵柄を 1 つだけ描いた SVG (#3172)。見本帳の部品「絵」の頁が、使える絵柄を並べる時に使う。
340
+ * 線の太さは箱の印と同じ割合 (印の線の太さ × 印の縮み) で、色は置いた所の字の色 (`currentColor`) を使う。知らない名前は `undefined`
341
+ */
342
+ declare function iconSvg(name: string): string | undefined;
343
+
270
344
  declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWidth: number, frameHeight?: number): {
271
345
  mode: ViewMode;
272
346
  textPx: number;
273
347
  };
274
348
 
275
- export { type CarrierTime, Carry, CheckOptions, ColorKey, Diagram, type EdgeTime, type EventTime, FONTS, FORMAT_VERSION, type Family, type Fence, FieldError, type LabelTime, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PlayerOptions, type Point, type Read, type Rect, type RenderOptions, type Rendered, type SceneAction, type SceneBadge, type SceneBox, type SceneEdge, type SceneField, type SceneLabel, type SceneLifeline, type SceneRegion, type SceneStrip, type Span, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
349
+ export { type CarrierTime, Carry, CheckOptions, ColorKey, Diagram, type EdgeTime, type EventTime, FONTS, FORMAT_VERSION, type Family, type Fence, FieldError, ICONS, type LabelTime, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PlayerOptions, type Point, type Read, type Rect, type RenderOptions, type Rendered, type SceneAction, type SceneBadge, type SceneBox, type SceneEdge, type SceneEnd, type SceneField, type SceneLabel, type SceneLifeline, type ScenePath, type SceneRegion, type SceneSide, type SceneStrip, type SceneTrail, type Span, type StateTime, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, iconSvg, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-9VLameDG.js';
2
- export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as READABLE_PX, h as Region, S as Step, r as resolvePalette, v as validateDiagram } from './schema-9VLameDG.js';
1
+ import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-B2MTRv66.js';
2
+ export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as READABLE_PX, h as Region, S as StatePath, i as Step, r as resolvePalette, v as validateDiagram } from './schema-B2MTRv66.js';
3
3
 
4
4
  /**
5
5
  * 図が使う 2 つの字。どちらも package の依存として同梱する。
@@ -52,6 +52,7 @@ declare function parseNotation(notation: string, options?: ParseOptions): Parsed
52
52
  * 並べ方は決まった形に整える。JSON の欄の並び順は見ず、欄の名前で読むので、
53
53
  * 同じ内容の JSON からは毎回同じ文字列になる。書き手の行の並べ方とコメントは保たない。
54
54
  * 段の中で起きることは JSON の並び順 (起きる順) のまま書く。
55
+ * 状態遷移図の移れる道 (`state.paths`) は、帯の宣言の後、最初の `step` より前に JSON の並びのまま書く (#3163)。
55
56
  *
56
57
  * `"` で囲むのは要る時だけにする。`[` を含む名前と、`,` か `]` を含む属性の値と、`"` で始まる字を囲む。
57
58
  * 箱は JSON の並びのまま書き、同じ区画の箱が続く所を 1 つの `group … end` にする。
@@ -100,6 +101,8 @@ interface SceneBox extends Rect {
100
101
  color: ColorKey;
101
102
  cx: number;
102
103
  cy: number;
104
+ /** 状態遷移図で、どの段も辿り着かない状態。点線の箱で脇道の囲みに描く */
105
+ ghost?: boolean;
103
106
  }
104
107
  interface SceneRegion extends Rect {
105
108
  id: string;
@@ -130,6 +133,34 @@ interface SceneLabel extends Rect {
130
133
  family: Family;
131
134
  color: ColorKey;
132
135
  }
136
+ /** 状態遷移図の、最初の段より前に書いてどの段にも出ない線。点線で描き、運ぶ物を走らせない */
137
+ interface ScenePath {
138
+ from: string;
139
+ to: string;
140
+ points: Point[];
141
+ label?: Rect & {
142
+ text: string;
143
+ family: Family;
144
+ };
145
+ }
146
+ /** 状態遷移図の始まりと終わりの印。`ghost` は脇道の中の終わりの印 */
147
+ interface SceneEnd {
148
+ kind: "start" | "finish";
149
+ x: number;
150
+ y: number;
151
+ r: number;
152
+ ghost: boolean;
153
+ /** 印の右に添える字 */
154
+ text: string;
155
+ /** 終わりの印へ線を引く状態 */
156
+ box?: string;
157
+ }
158
+ /** 状態遷移図の脇道の囲み。`title` と `notes` は囲みの左上に置く字 */
159
+ interface SceneSide extends Rect {
160
+ title: string;
161
+ /** 囲みの名前の下に 1 行ずつ置く添え書き */
162
+ notes: string[];
163
+ }
133
164
  /** 時系列図の箱の中の処理。生存線の上に札で出す。 */
134
165
  interface SceneAction extends Rect {
135
166
  step: number;
@@ -156,9 +187,21 @@ interface SceneField {
156
187
  y: number;
157
188
  w: number;
158
189
  }
190
+ /** 状態遷移図の帯の最後の欄。段が辿り着く順に状態を点で並べ、着いた状態を塗る (#3171) */
191
+ interface SceneTrail {
192
+ title: string;
193
+ states: {
194
+ box: string;
195
+ color: ColorKey;
196
+ }[];
197
+ x: number;
198
+ y: number;
199
+ w: number;
200
+ }
159
201
  interface SceneStrip extends Rect {
160
202
  title: string;
161
203
  fields: SceneField[];
204
+ trail?: SceneTrail;
162
205
  }
163
206
  interface Layout {
164
207
  kind: Diagram["kind"];
@@ -172,6 +215,12 @@ interface Layout {
172
215
  actions: SceneAction[];
173
216
  badges: SceneBadge[];
174
217
  strip?: SceneStrip;
218
+ /** 状態遷移図の通らない道。他の図の種類では空 */
219
+ paths: ScenePath[];
220
+ /** 状態遷移図の始まりと終わりの印。他の図の種類では空 */
221
+ ends: SceneEnd[];
222
+ /** 状態遷移図の脇道の囲み。通らない状態が無ければ無い */
223
+ side?: SceneSide;
175
224
  }
176
225
 
177
226
  /** 秒で表した、見えている間。`end` の時刻は含まない。 */
@@ -196,6 +245,8 @@ interface CarrierTime extends Span {
196
245
  interface LabelTime extends Span {
197
246
  step: number;
198
247
  event: number;
248
+ /** 状態遷移図だけが持つ。段が終わった後に薄く残す間 */
249
+ after?: Span;
199
250
  }
200
251
  /** 処理、箱の字の書き換え、中身の帯の値が起きる時刻。 */
201
252
  interface EventTime {
@@ -203,6 +254,12 @@ interface EventTime {
203
254
  event: number;
204
255
  at: number;
205
256
  }
257
+ /** 状態遷移図の状態ごとの、光っている間と、済んだ印が出る時刻。運ぶ物が出ていない状態は `done` を持たない */
258
+ interface StateTime {
259
+ box: string;
260
+ lit: Span[];
261
+ done?: number;
262
+ }
206
263
  interface Timeline {
207
264
  /** 1 周の長さ */
208
265
  total: number;
@@ -219,6 +276,8 @@ interface Timeline {
219
276
  events: EventTime[];
220
277
  /** 段ごとの止め絵の時刻。その段で起きることが全部見えている */
221
278
  stills: number[];
279
+ /** 状態遷移図だけが持つ */
280
+ states?: StateTime[];
222
281
  }
223
282
 
224
283
  interface RenderOptions {
@@ -267,9 +326,24 @@ interface Player {
267
326
  }
268
327
  declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: PlayerOptions): Player;
269
328
 
329
+ /**
330
+ * 箱と区画の印の形。どれも (0, 0) を中心に 20 四方へ収める。
331
+ *
332
+ * 見本帳 (`docs/design/base/engine.js` の `G`) と同じ形を持つ。`block` だけは見本帳が絵を手で描いていたので、ここで足した。
333
+ * `undo` (戻る矢印) と `yen` (円の印) は、注文の試作 (`docs/design/base/scenes/order.js`) が返品と返金に足した形 (#3171)。
334
+ * package の入口からも出し、見本帳の部品「絵」の頁がこの表から使える絵柄の一覧を作る。1 つずつの絵は `iconSvg` が描く (#3172)。
335
+ */
336
+ declare const ICONS: Readonly<Record<string, string>>;
337
+
338
+ /**
339
+ * 絵柄を 1 つだけ描いた SVG (#3172)。見本帳の部品「絵」の頁が、使える絵柄を並べる時に使う。
340
+ * 線の太さは箱の印と同じ割合 (印の線の太さ × 印の縮み) で、色は置いた所の字の色 (`currentColor`) を使う。知らない名前は `undefined`
341
+ */
342
+ declare function iconSvg(name: string): string | undefined;
343
+
270
344
  declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWidth: number, frameHeight?: number): {
271
345
  mode: ViewMode;
272
346
  textPx: number;
273
347
  };
274
348
 
275
- export { type CarrierTime, Carry, CheckOptions, ColorKey, Diagram, type EdgeTime, type EventTime, FONTS, FORMAT_VERSION, type Family, type Fence, FieldError, type LabelTime, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PlayerOptions, type Point, type Read, type Rect, type RenderOptions, type Rendered, type SceneAction, type SceneBadge, type SceneBox, type SceneEdge, type SceneField, type SceneLabel, type SceneLifeline, type SceneRegion, type SceneStrip, type Span, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
349
+ export { type CarrierTime, Carry, CheckOptions, ColorKey, Diagram, type EdgeTime, type EventTime, FONTS, FORMAT_VERSION, type Family, type Fence, FieldError, ICONS, type LabelTime, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PlayerOptions, type Point, type Read, type Rect, type RenderOptions, type Rendered, type SceneAction, type SceneBadge, type SceneBox, type SceneEdge, type SceneEnd, type SceneField, type SceneLabel, type SceneLifeline, type ScenePath, type SceneRegion, type SceneSide, type SceneStrip, type SceneTrail, type Span, type StateTime, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, iconSvg, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };