@cardenelabs/dragon 0.43.0 → 0.45.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 (97) hide show
  1. package/README.md +21 -0
  2. package/dist/cli.cjs +6804 -5032
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +6804 -5032
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +7172 -5536
  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 +7171 -5537
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +12244 -10449
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +55 -3
  15. package/dist/index.d.ts +55 -3
  16. package/dist/index.js +12244 -10449
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-B6s_SMXG.d.cts → ink-DeDtzaTL.d.cts} +27 -3
  19. package/dist/{ink-B6s_SMXG.d.ts → ink-DeDtzaTL.d.ts} +27 -3
  20. package/dist/light/chunk-6ZUKJ3VO.js +489 -0
  21. package/dist/light/chunk-6ZUKJ3VO.js.map +1 -0
  22. package/dist/light/chunk-CLS6JVKK.cjs +84 -0
  23. package/dist/light/chunk-CLS6JVKK.cjs.map +1 -0
  24. package/dist/light/chunk-JNSHZTPF.js +1141 -0
  25. package/dist/light/chunk-JNSHZTPF.js.map +1 -0
  26. package/dist/light/chunk-OUQ44P45.cjs +489 -0
  27. package/dist/light/chunk-OUQ44P45.cjs.map +1 -0
  28. package/dist/light/chunk-VRAW7VAQ.cjs +1141 -0
  29. package/dist/light/chunk-VRAW7VAQ.cjs.map +1 -0
  30. package/dist/light/chunk-YDKPEKGZ.js +84 -0
  31. package/dist/light/chunk-YDKPEKGZ.js.map +1 -0
  32. package/dist/light/git-C4RVNFT6.js +637 -0
  33. package/dist/light/git-C4RVNFT6.js.map +1 -0
  34. package/dist/light/git-I7D7RIW2.cjs +637 -0
  35. package/dist/light/git-I7D7RIW2.cjs.map +1 -0
  36. package/dist/light/index.cjs +9885 -0
  37. package/dist/light/index.cjs.map +1 -0
  38. package/dist/light/index.d.cts +976 -0
  39. package/dist/light/index.d.ts +976 -0
  40. package/dist/light/index.js +9885 -0
  41. package/dist/light/index.js.map +1 -0
  42. package/dist/light/lineup-FAIKTH3Y.cjs +283 -0
  43. package/dist/light/lineup-FAIKTH3Y.cjs.map +1 -0
  44. package/dist/light/lineup-YEG4HHEI.js +283 -0
  45. package/dist/light/lineup-YEG4HHEI.js.map +1 -0
  46. package/dist/light/state-P3LIVI3K.js +335 -0
  47. package/dist/light/state-P3LIVI3K.js.map +1 -0
  48. package/dist/light/state-ZZUK6AQT.cjs +335 -0
  49. package/dist/light/state-ZZUK6AQT.cjs.map +1 -0
  50. package/dist/light/time-64DJKYAL.cjs +719 -0
  51. package/dist/light/time-64DJKYAL.cjs.map +1 -0
  52. package/dist/light/time-B5WUQOFP.js +719 -0
  53. package/dist/light/time-B5WUQOFP.js.map +1 -0
  54. package/dist/light/tree-5HPREYW2.js +478 -0
  55. package/dist/light/tree-5HPREYW2.js.map +1 -0
  56. package/dist/light/tree-66EH4QVI.cjs +478 -0
  57. package/dist/light/tree-66EH4QVI.cjs.map +1 -0
  58. package/dist/node.cjs +1932 -680
  59. package/dist/node.cjs.map +1 -1
  60. package/dist/node.js +1932 -680
  61. package/dist/node.js.map +1 -1
  62. package/dist/player.global.js +3 -3
  63. package/package.json +14 -2
  64. package/src/api.ts +71 -0
  65. package/src/field-messages.ts +6 -0
  66. package/src/figure-text.ts +4 -0
  67. package/src/index.ts +6 -65
  68. package/src/kinds/all.ts +16 -0
  69. package/src/kinds/git.ts +3 -0
  70. package/src/kinds/lineup.ts +3 -0
  71. package/src/kinds/registry.ts +46 -0
  72. package/src/kinds/state.ts +2 -0
  73. package/src/kinds/time.ts +3 -0
  74. package/src/kinds/tree.ts +3 -0
  75. package/src/layout/git.ts +0 -1
  76. package/src/layout/lineup.ts +218 -0
  77. package/src/layout/time.ts +0 -1
  78. package/src/layout/tree.ts +0 -1
  79. package/src/light.ts +31 -0
  80. package/src/look/values.ts +31 -2
  81. package/src/messages.ts +54 -0
  82. package/src/parser.ts +123 -1
  83. package/src/player-global.ts +3 -0
  84. package/src/player.ts +1 -1
  85. package/src/printer.ts +30 -1
  86. package/src/render/draw.ts +731 -0
  87. package/src/render/lineup.ts +184 -0
  88. package/src/render/parts.ts +19 -7
  89. package/src/render/svg.ts +4 -697
  90. package/src/render/time.ts +1 -4
  91. package/src/render/tree.ts +3 -2
  92. package/src/schema.ts +52 -4
  93. package/src/schemas/diagram.schema.json +145 -22
  94. package/src/schemas/validate-diagram.js +1 -1
  95. package/src/timeline.ts +14 -0
  96. package/src/view.ts +1 -1
  97. package/src/words.ts +15 -2
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, S as SceneBox, R as Rect, L as Layout, a as ColorKey, P as Point, b as TextStyle, c as Colors, T as Theme, V as ViewMode, O as Overlap } from './ink-B6s_SMXG.cjs';
2
- export { B as Box, d as Carry, e as Checked, f as Color, g as ColorName, h as DEFAULT_PALETTE, i as DiagramEvent, j as FONTS, k as Family, G as GitBranch, l as GitCommit, I as InkPart, m as LabelSide, n as OverlapSpot, o as PALETTES, p as Palette, q as READABLE_PX, r as Region, s as SceneAction, t as SceneBadge, u as SceneEdge, v as SceneEnd, w as SceneField, x as SceneLabel, y as SceneLifeline, z as ScenePath, A as SceneRegion, E as SceneSide, H as SceneStrip, J as SceneTrail, K as StatePath, M as Step, Q as StepSource, U as StripMeter, W as TimeMarkEvent, X as TimePeriod, Y as TimePoint, Z as TimeRow, _ as TimeScale, $ as TimeSpanEvent, a0 as TimeSpec, a1 as TreeLeaf, a2 as TreeNode, a3 as describeOverlap, a4 as resolvePalette, a5 as validateDiagram } from './ink-B6s_SMXG.cjs';
1
+ import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, S as SceneBox, R as Rect, L as Layout, a as ColorKey, P as Point, b as TextStyle, c as Colors, T as Theme, V as ViewMode, O as Overlap } from './ink-DeDtzaTL.cjs';
2
+ export { B as Box, d as Carry, e as Checked, f as Color, g as ColorName, h as DEFAULT_PALETTE, i as DiagramEvent, j as FONTS, k as Family, G as GitBranch, l as GitCommit, I as InkPart, m as LabelSide, n as LineupItem, o as LineupOrder, p as LineupStamp, q as OverlapSpot, r as PALETTES, s as Palette, t as READABLE_PX, u as Region, v as SceneAction, w as SceneBadge, x as SceneEdge, y as SceneEnd, z as SceneField, A as SceneLabel, E as SceneLifeline, H as ScenePath, J as SceneRegion, K as SceneSide, M as SceneStrip, Q as SceneTrail, U as StatePath, W as Step, X as StepSource, Y as StripMeter, Z as TimeMarkEvent, _ as TimePeriod, $ as TimePoint, a0 as TimeRow, a1 as TimeScale, a2 as TimeSpanEvent, a3 as TimeSpec, a4 as TreeLeaf, a5 as TreeNode, a6 as describeOverlap, a7 as resolvePalette, a8 as validateDiagram } from './ink-DeDtzaTL.cjs';
3
3
 
4
4
  /**
5
5
  * Markdown の中の dragon の囲み (```dragon) を、囲みごとに取り出す。
@@ -49,6 +49,7 @@ declare function parseNotation(notation: string, options?: ParseOptions): Parsed
49
49
  * 時間軸の図 (#3165) は、目盛りと区切りと印の列と節目と拡大の範囲の行を箱より前に書き、物差しの欄の後ろに `[meter: <割合>]` を書く。
50
50
  * 時間軸の図の `note` は属性を持てるので、`[` を含む字を `"` で囲む。
51
51
  * 木の図 (#3233) の葉と親は、段の中に `leaf` と `node … of …` の行で書く。
52
+ * 列の図 (#3239) のチップは箱の後ろに `item` の行で書き、色が同じで字を持たないチップが続く所は 1 行に並べる。
52
53
  * 段の出典 (#3199) は `say` と `code` の後ろ、段の中で起きることより前に、JSON の並びのまま 1 つずつ `source` の行に書く。
53
54
  */
54
55
 
@@ -250,6 +251,57 @@ interface TreeLayout extends Layout {
250
251
  runs: TreeRun[];
251
252
  }
252
253
 
254
+ /** 列の中の字。`text` は描く字で、`y` から `h` は字の形の高さ */
255
+ interface LaneText extends Rect {
256
+ text: string;
257
+ /** 基準線の高さ */
258
+ baseline: number;
259
+ }
260
+ /** 列。`track` はチップを並べる所で、上限の枚数の席が入る */
261
+ interface LineupLane extends SceneBox {
262
+ title: LaneText;
263
+ /** 右上の字の最初の字。書かない列は持たない */
264
+ note?: LaneText;
265
+ /** 右上の字の右端 */
266
+ noteRight: number;
267
+ track: Rect;
268
+ }
269
+ /** 段の出来事の場所 */
270
+ interface LineupAt {
271
+ step: number;
272
+ event: number;
273
+ }
274
+ /** チップが列の席に居る間 1 回分。`from` は滑り始める左上で、弾んで現れるチップは持たない。`until` は席を離れる出来事 */
275
+ interface LineupSeat extends Rect, LineupAt {
276
+ id: string;
277
+ lane: string;
278
+ index: number;
279
+ from?: Point;
280
+ until?: LineupAt;
281
+ }
282
+ /** 封。`until` は開ける出来事 */
283
+ interface LineupSeal extends Rect, LineupAt {
284
+ lane: string;
285
+ until?: LineupAt;
286
+ }
287
+ /** 札 */
288
+ interface LineupStamp extends Rect, LineupAt {
289
+ lane: string;
290
+ text: string;
291
+ }
292
+ /** 列を選ぶ出来事。同じ列を続けて選んだ時は最初の 1 つだけを持つ */
293
+ interface LineupPick extends LineupAt {
294
+ lane: string;
295
+ }
296
+ interface LineupLayout extends Layout {
297
+ kind: "lineup";
298
+ lanes: LineupLane[];
299
+ chips: LineupSeat[];
300
+ seals: LineupSeal[];
301
+ stamps: LineupStamp[];
302
+ picks: LineupPick[];
303
+ }
304
+
253
305
  /** 秒で表した、見えている間。`end` の時刻は含まない。 */
254
306
  interface Span {
255
307
  start: number;
@@ -411,4 +463,4 @@ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWi
411
463
  textPx: number;
412
464
  };
413
465
 
414
- export { type CarrierTime, CheckOptions, ColorKey, Colors, Diagram, type EdgeTime, type EventTime, FORMAT_VERSION, type Fence, FieldError, ICONS, type LabelTime, Layout, type LineError, NotationLang, Overlap, type ParseOptions, type Parsed, type Player, type PlayerOptions, Point, type Read, Rect, type RenderOptions, type Rendered, SceneBox, type Span, type StateTime, TextStyle, Theme, type TimeAxis, type TimeBox, type TimeColumn, type TimeLayout, type TimeMark, type TimePeriodPlaced, type TimePointPlaced, type TimeRowPlaced, type TimeSpanPlaced, type TimeTick, type TimeWire, type TimeZoom, type Timeline, type TreeLayout, type TreeLink, type TreePlaced, type TreeRun, ViewMode, chooseView, extractDiagrams, iconSvg, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
466
+ export { type CarrierTime, CheckOptions, ColorKey, Colors, Diagram, type EdgeTime, type EventTime, FORMAT_VERSION, type Fence, FieldError, ICONS, type LabelTime, type LaneText, Layout, type LineError, type LineupAt, type LineupLane, type LineupLayout, type LineupPick, type LineupSeal, type LineupSeat, type LineupStamp as LineupStampPlaced, NotationLang, Overlap, type ParseOptions, type Parsed, type Player, type PlayerOptions, Point, type Read, Rect, type RenderOptions, type Rendered, SceneBox, type Span, type StateTime, TextStyle, Theme, type TimeAxis, type TimeBox, type TimeColumn, type TimeLayout, type TimeMark, type TimePeriodPlaced, type TimePointPlaced, type TimeRowPlaced, type TimeSpanPlaced, type TimeTick, type TimeWire, type TimeZoom, type Timeline, type TreeLayout, type TreeLink, type TreePlaced, type TreeRun, ViewMode, chooseView, extractDiagrams, iconSvg, 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, S as SceneBox, R as Rect, L as Layout, a as ColorKey, P as Point, b as TextStyle, c as Colors, T as Theme, V as ViewMode, O as Overlap } from './ink-B6s_SMXG.js';
2
- export { B as Box, d as Carry, e as Checked, f as Color, g as ColorName, h as DEFAULT_PALETTE, i as DiagramEvent, j as FONTS, k as Family, G as GitBranch, l as GitCommit, I as InkPart, m as LabelSide, n as OverlapSpot, o as PALETTES, p as Palette, q as READABLE_PX, r as Region, s as SceneAction, t as SceneBadge, u as SceneEdge, v as SceneEnd, w as SceneField, x as SceneLabel, y as SceneLifeline, z as ScenePath, A as SceneRegion, E as SceneSide, H as SceneStrip, J as SceneTrail, K as StatePath, M as Step, Q as StepSource, U as StripMeter, W as TimeMarkEvent, X as TimePeriod, Y as TimePoint, Z as TimeRow, _ as TimeScale, $ as TimeSpanEvent, a0 as TimeSpec, a1 as TreeLeaf, a2 as TreeNode, a3 as describeOverlap, a4 as resolvePalette, a5 as validateDiagram } from './ink-B6s_SMXG.js';
1
+ import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, S as SceneBox, R as Rect, L as Layout, a as ColorKey, P as Point, b as TextStyle, c as Colors, T as Theme, V as ViewMode, O as Overlap } from './ink-DeDtzaTL.js';
2
+ export { B as Box, d as Carry, e as Checked, f as Color, g as ColorName, h as DEFAULT_PALETTE, i as DiagramEvent, j as FONTS, k as Family, G as GitBranch, l as GitCommit, I as InkPart, m as LabelSide, n as LineupItem, o as LineupOrder, p as LineupStamp, q as OverlapSpot, r as PALETTES, s as Palette, t as READABLE_PX, u as Region, v as SceneAction, w as SceneBadge, x as SceneEdge, y as SceneEnd, z as SceneField, A as SceneLabel, E as SceneLifeline, H as ScenePath, J as SceneRegion, K as SceneSide, M as SceneStrip, Q as SceneTrail, U as StatePath, W as Step, X as StepSource, Y as StripMeter, Z as TimeMarkEvent, _ as TimePeriod, $ as TimePoint, a0 as TimeRow, a1 as TimeScale, a2 as TimeSpanEvent, a3 as TimeSpec, a4 as TreeLeaf, a5 as TreeNode, a6 as describeOverlap, a7 as resolvePalette, a8 as validateDiagram } from './ink-DeDtzaTL.js';
3
3
 
4
4
  /**
5
5
  * Markdown の中の dragon の囲み (```dragon) を、囲みごとに取り出す。
@@ -49,6 +49,7 @@ declare function parseNotation(notation: string, options?: ParseOptions): Parsed
49
49
  * 時間軸の図 (#3165) は、目盛りと区切りと印の列と節目と拡大の範囲の行を箱より前に書き、物差しの欄の後ろに `[meter: <割合>]` を書く。
50
50
  * 時間軸の図の `note` は属性を持てるので、`[` を含む字を `"` で囲む。
51
51
  * 木の図 (#3233) の葉と親は、段の中に `leaf` と `node … of …` の行で書く。
52
+ * 列の図 (#3239) のチップは箱の後ろに `item` の行で書き、色が同じで字を持たないチップが続く所は 1 行に並べる。
52
53
  * 段の出典 (#3199) は `say` と `code` の後ろ、段の中で起きることより前に、JSON の並びのまま 1 つずつ `source` の行に書く。
53
54
  */
54
55
 
@@ -250,6 +251,57 @@ interface TreeLayout extends Layout {
250
251
  runs: TreeRun[];
251
252
  }
252
253
 
254
+ /** 列の中の字。`text` は描く字で、`y` から `h` は字の形の高さ */
255
+ interface LaneText extends Rect {
256
+ text: string;
257
+ /** 基準線の高さ */
258
+ baseline: number;
259
+ }
260
+ /** 列。`track` はチップを並べる所で、上限の枚数の席が入る */
261
+ interface LineupLane extends SceneBox {
262
+ title: LaneText;
263
+ /** 右上の字の最初の字。書かない列は持たない */
264
+ note?: LaneText;
265
+ /** 右上の字の右端 */
266
+ noteRight: number;
267
+ track: Rect;
268
+ }
269
+ /** 段の出来事の場所 */
270
+ interface LineupAt {
271
+ step: number;
272
+ event: number;
273
+ }
274
+ /** チップが列の席に居る間 1 回分。`from` は滑り始める左上で、弾んで現れるチップは持たない。`until` は席を離れる出来事 */
275
+ interface LineupSeat extends Rect, LineupAt {
276
+ id: string;
277
+ lane: string;
278
+ index: number;
279
+ from?: Point;
280
+ until?: LineupAt;
281
+ }
282
+ /** 封。`until` は開ける出来事 */
283
+ interface LineupSeal extends Rect, LineupAt {
284
+ lane: string;
285
+ until?: LineupAt;
286
+ }
287
+ /** 札 */
288
+ interface LineupStamp extends Rect, LineupAt {
289
+ lane: string;
290
+ text: string;
291
+ }
292
+ /** 列を選ぶ出来事。同じ列を続けて選んだ時は最初の 1 つだけを持つ */
293
+ interface LineupPick extends LineupAt {
294
+ lane: string;
295
+ }
296
+ interface LineupLayout extends Layout {
297
+ kind: "lineup";
298
+ lanes: LineupLane[];
299
+ chips: LineupSeat[];
300
+ seals: LineupSeal[];
301
+ stamps: LineupStamp[];
302
+ picks: LineupPick[];
303
+ }
304
+
253
305
  /** 秒で表した、見えている間。`end` の時刻は含まない。 */
254
306
  interface Span {
255
307
  start: number;
@@ -411,4 +463,4 @@ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWi
411
463
  textPx: number;
412
464
  };
413
465
 
414
- export { type CarrierTime, CheckOptions, ColorKey, Colors, Diagram, type EdgeTime, type EventTime, FORMAT_VERSION, type Fence, FieldError, ICONS, type LabelTime, Layout, type LineError, NotationLang, Overlap, type ParseOptions, type Parsed, type Player, type PlayerOptions, Point, type Read, Rect, type RenderOptions, type Rendered, SceneBox, type Span, type StateTime, TextStyle, Theme, type TimeAxis, type TimeBox, type TimeColumn, type TimeLayout, type TimeMark, type TimePeriodPlaced, type TimePointPlaced, type TimeRowPlaced, type TimeSpanPlaced, type TimeTick, type TimeWire, type TimeZoom, type Timeline, type TreeLayout, type TreeLink, type TreePlaced, type TreeRun, ViewMode, chooseView, extractDiagrams, iconSvg, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
466
+ export { type CarrierTime, CheckOptions, ColorKey, Colors, Diagram, type EdgeTime, type EventTime, FORMAT_VERSION, type Fence, FieldError, ICONS, type LabelTime, type LaneText, Layout, type LineError, type LineupAt, type LineupLane, type LineupLayout, type LineupPick, type LineupSeal, type LineupSeat, type LineupStamp as LineupStampPlaced, NotationLang, Overlap, type ParseOptions, type Parsed, type Player, type PlayerOptions, Point, type Read, Rect, type RenderOptions, type Rendered, SceneBox, type Span, type StateTime, TextStyle, Theme, type TimeAxis, type TimeBox, type TimeColumn, type TimeLayout, type TimeMark, type TimePeriodPlaced, type TimePointPlaced, type TimeRowPlaced, type TimeSpanPlaced, type TimeTick, type TimeWire, type TimeZoom, type Timeline, type TreeLayout, type TreeLink, type TreePlaced, type TreeRun, ViewMode, chooseView, extractDiagrams, iconSvg, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };