@cardenelabs/dragon 0.42.2 → 0.44.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 (43) hide show
  1. package/README.md +34 -1
  2. package/dist/cli.cjs +4630 -1690
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +4630 -1690
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +4267 -1555
  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 +4267 -1555
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +4348 -1381
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +118 -3
  15. package/dist/index.d.ts +118 -3
  16. package/dist/index.js +4348 -1381
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-B8EZL7JV.d.cts → ink-DeDtzaTL.d.cts} +47 -3
  19. package/dist/{ink-B8EZL7JV.d.ts → ink-DeDtzaTL.d.ts} +47 -3
  20. package/dist/node.cjs +3504 -1625
  21. package/dist/node.cjs.map +1 -1
  22. package/dist/node.js +3504 -1625
  23. package/dist/node.js.map +1 -1
  24. package/dist/player.global.js +3 -2
  25. package/package.json +1 -1
  26. package/src/field-messages.ts +6 -0
  27. package/src/index.ts +8 -1
  28. package/src/layout/lineup.ts +219 -0
  29. package/src/layout/tree.ts +458 -0
  30. package/src/look/values.ts +73 -2
  31. package/src/messages.ts +88 -2
  32. package/src/parser.ts +212 -2
  33. package/src/printer.ts +36 -2
  34. package/src/render/icons.ts +2 -0
  35. package/src/render/lineup.ts +184 -0
  36. package/src/render/parts.ts +16 -7
  37. package/src/render/svg.ts +72 -6
  38. package/src/render/tree.ts +165 -0
  39. package/src/schema.ts +76 -4
  40. package/src/schemas/diagram.schema.json +207 -19
  41. package/src/schemas/validate-diagram.js +1 -1
  42. package/src/timeline.ts +16 -2
  43. package/src/words.ts +25 -2
@@ -36,6 +36,11 @@ type Colors = Partial<Record<ColorName, string>>;
36
36
  /** 区画や箱を分ける色の役。灰 (slate) と硬貨 (coin) は分類の色として順に配らない。 */
37
37
  declare const COLOR_ORDER: readonly ["blue", "amber", "green", "violet", "rose"];
38
38
  type ColorKey = (typeof COLOR_ORDER)[number] | "slate" | "coin";
39
+ interface TextStyle {
40
+ size: number;
41
+ weight: number;
42
+ family: Family;
43
+ }
39
44
  /** 見せ方を決める字の大きさ。全体を枠に収めた時の箱の名前がこれを下回ると寄って追う。 */
40
45
  declare const READABLE_PX = 10.5;
41
46
 
@@ -114,7 +119,10 @@ type DiagramEvent = {
114
119
  } | {
115
120
  type: "now";
116
121
  to: number;
117
- } | TimeMarkEvent | TimeSpanEvent;
122
+ } | TimeMarkEvent | TimeSpanEvent | TreeLeaf | TreeNode | LineupOrder | {
123
+ type: "seal" | "open" | "pick";
124
+ box: string;
125
+ } | LineupStamp;
118
126
  /** 時間軸の図 (#3165) の、印の列 `row` の `from` から `to` の目盛りの印の色を変える出来事 */
119
127
  interface TimeMarkEvent {
120
128
  type: "mark";
@@ -187,6 +195,39 @@ interface GitCommit {
187
195
  hash?: string;
188
196
  note?: string;
189
197
  }
198
+ /**
199
+ * 木の図 (#3233) の葉を出す出来事。書いた段で葉の箱が現れる。`hash` を書くと箱に値を出し、名札を葉の下の札に出す
200
+ */
201
+ interface TreeLeaf {
202
+ type: "leaf";
203
+ id: string;
204
+ hash?: string;
205
+ }
206
+ /** 木の図の、1 つ以上の子から親を組む出来事。書いた段で親の箱と、子から親への木の線が現れる */
207
+ interface TreeNode {
208
+ type: "node";
209
+ id: string;
210
+ children: string[];
211
+ hash?: string;
212
+ }
213
+ /** 列の図 (#3239) の、列 `box` の並びを `items` に書き換える出来事。前の段との差分を描く部品が滑る動きに変える */
214
+ interface LineupOrder {
215
+ type: "line";
216
+ box: string;
217
+ items: string[];
218
+ }
219
+ /** 列の図の、列 `box` の右に `text` の札を押す出来事 */
220
+ interface LineupStamp {
221
+ type: "stamp";
222
+ box: string;
223
+ text: string;
224
+ }
225
+ /** 列の図のチップ。`color` を書かないチップは薄い色で、`label` を書かないチップは色だけで出す */
226
+ interface LineupItem {
227
+ id: string;
228
+ color?: Color;
229
+ label?: string;
230
+ }
190
231
  /** 枝分かれの図の枝。上から宣言した順に帯を並べる */
191
232
  interface GitBranch {
192
233
  id: string;
@@ -213,7 +254,7 @@ interface Step {
213
254
  }
214
255
  interface Diagram {
215
256
  version: number;
216
- kind: "sequence" | "architecture" | "state" | "git" | "time";
257
+ kind: "sequence" | "architecture" | "state" | "git" | "time" | "tree" | "lineup";
217
258
  title: string;
218
259
  view?: ViewMode;
219
260
  regions?: Region[];
@@ -234,6 +275,9 @@ interface Diagram {
234
275
  branches: GitBranch[];
235
276
  };
236
277
  time?: TimeSpec;
278
+ lineup?: {
279
+ items: LineupItem[];
280
+ };
237
281
  }
238
282
  interface FieldError {
239
283
  /** 誤った欄の場所 (JSON Pointer) */
@@ -449,4 +493,4 @@ type Overlap = {
449
493
  */
450
494
  declare function describeOverlap(overlap: Overlap, lang?: NotationLang): string;
451
495
 
452
- export { type TimeSpec as $, type SceneSide as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneStrip as E, type FieldError as F, type GitBranch as G, type SceneTrail as H, type InkPart as I, type StatePath as J, type Step as K, type Layout as L, type StepSource as M, type NotationLang as N, type Overlap as O, type Point as P, type StripMeter as Q, type Rect as R, type SceneBox as S, type Theme as T, type TimeMarkEvent as U, type ViewMode as V, type TimePeriod as W, type TimePoint as X, type TimeRow as Y, type TimeScale as Z, type TimeSpanEvent as _, type ColorKey as a, describeOverlap as a0, resolvePalette as a1, validateDiagram as a2, type Colors as b, type Carry as c, type Checked as d, type Color as e, type ColorName as f, DEFAULT_PALETTE as g, type DiagramEvent as h, FONTS as i, type Family as j, type GitCommit as k, type LabelSide as l, type OverlapSpot as m, PALETTES as n, type Palette as o, READABLE_PX as p, type Region as q, type SceneAction as r, type SceneBadge as s, type SceneEdge as t, type SceneEnd as u, type SceneField as v, type SceneLabel as w, type SceneLifeline as x, type ScenePath as y, type SceneRegion as z };
496
+ export { type TimePoint as $, type SceneLabel as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneLifeline as E, type FieldError as F, type GitBranch as G, type ScenePath as H, type InkPart as I, type SceneRegion as J, type SceneSide as K, type Layout as L, type SceneStrip as M, type NotationLang as N, type Overlap as O, type Point as P, type SceneTrail as Q, type Rect as R, type SceneBox as S, type Theme as T, type StatePath as U, type ViewMode as V, type Step as W, type StepSource as X, type StripMeter as Y, type TimeMarkEvent as Z, type TimePeriod as _, type ColorKey as a, type TimeRow as a0, type TimeScale as a1, type TimeSpanEvent as a2, type TimeSpec as a3, type TreeLeaf as a4, type TreeNode as a5, describeOverlap as a6, resolvePalette as a7, validateDiagram as a8, type TextStyle as b, type Colors as c, type Carry as d, type Checked as e, type Color as f, type ColorName as g, DEFAULT_PALETTE as h, type DiagramEvent as i, FONTS as j, type Family as k, type GitCommit as l, type LabelSide as m, type LineupItem as n, type LineupOrder as o, type LineupStamp as p, type OverlapSpot as q, PALETTES as r, type Palette as s, READABLE_PX as t, type Region as u, type SceneAction as v, type SceneBadge as w, type SceneEdge as x, type SceneEnd as y, type SceneField as z };
@@ -36,6 +36,11 @@ type Colors = Partial<Record<ColorName, string>>;
36
36
  /** 区画や箱を分ける色の役。灰 (slate) と硬貨 (coin) は分類の色として順に配らない。 */
37
37
  declare const COLOR_ORDER: readonly ["blue", "amber", "green", "violet", "rose"];
38
38
  type ColorKey = (typeof COLOR_ORDER)[number] | "slate" | "coin";
39
+ interface TextStyle {
40
+ size: number;
41
+ weight: number;
42
+ family: Family;
43
+ }
39
44
  /** 見せ方を決める字の大きさ。全体を枠に収めた時の箱の名前がこれを下回ると寄って追う。 */
40
45
  declare const READABLE_PX = 10.5;
41
46
 
@@ -114,7 +119,10 @@ type DiagramEvent = {
114
119
  } | {
115
120
  type: "now";
116
121
  to: number;
117
- } | TimeMarkEvent | TimeSpanEvent;
122
+ } | TimeMarkEvent | TimeSpanEvent | TreeLeaf | TreeNode | LineupOrder | {
123
+ type: "seal" | "open" | "pick";
124
+ box: string;
125
+ } | LineupStamp;
118
126
  /** 時間軸の図 (#3165) の、印の列 `row` の `from` から `to` の目盛りの印の色を変える出来事 */
119
127
  interface TimeMarkEvent {
120
128
  type: "mark";
@@ -187,6 +195,39 @@ interface GitCommit {
187
195
  hash?: string;
188
196
  note?: string;
189
197
  }
198
+ /**
199
+ * 木の図 (#3233) の葉を出す出来事。書いた段で葉の箱が現れる。`hash` を書くと箱に値を出し、名札を葉の下の札に出す
200
+ */
201
+ interface TreeLeaf {
202
+ type: "leaf";
203
+ id: string;
204
+ hash?: string;
205
+ }
206
+ /** 木の図の、1 つ以上の子から親を組む出来事。書いた段で親の箱と、子から親への木の線が現れる */
207
+ interface TreeNode {
208
+ type: "node";
209
+ id: string;
210
+ children: string[];
211
+ hash?: string;
212
+ }
213
+ /** 列の図 (#3239) の、列 `box` の並びを `items` に書き換える出来事。前の段との差分を描く部品が滑る動きに変える */
214
+ interface LineupOrder {
215
+ type: "line";
216
+ box: string;
217
+ items: string[];
218
+ }
219
+ /** 列の図の、列 `box` の右に `text` の札を押す出来事 */
220
+ interface LineupStamp {
221
+ type: "stamp";
222
+ box: string;
223
+ text: string;
224
+ }
225
+ /** 列の図のチップ。`color` を書かないチップは薄い色で、`label` を書かないチップは色だけで出す */
226
+ interface LineupItem {
227
+ id: string;
228
+ color?: Color;
229
+ label?: string;
230
+ }
190
231
  /** 枝分かれの図の枝。上から宣言した順に帯を並べる */
191
232
  interface GitBranch {
192
233
  id: string;
@@ -213,7 +254,7 @@ interface Step {
213
254
  }
214
255
  interface Diagram {
215
256
  version: number;
216
- kind: "sequence" | "architecture" | "state" | "git" | "time";
257
+ kind: "sequence" | "architecture" | "state" | "git" | "time" | "tree" | "lineup";
217
258
  title: string;
218
259
  view?: ViewMode;
219
260
  regions?: Region[];
@@ -234,6 +275,9 @@ interface Diagram {
234
275
  branches: GitBranch[];
235
276
  };
236
277
  time?: TimeSpec;
278
+ lineup?: {
279
+ items: LineupItem[];
280
+ };
237
281
  }
238
282
  interface FieldError {
239
283
  /** 誤った欄の場所 (JSON Pointer) */
@@ -449,4 +493,4 @@ type Overlap = {
449
493
  */
450
494
  declare function describeOverlap(overlap: Overlap, lang?: NotationLang): string;
451
495
 
452
- export { type TimeSpec as $, type SceneSide as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneStrip as E, type FieldError as F, type GitBranch as G, type SceneTrail as H, type InkPart as I, type StatePath as J, type Step as K, type Layout as L, type StepSource as M, type NotationLang as N, type Overlap as O, type Point as P, type StripMeter as Q, type Rect as R, type SceneBox as S, type Theme as T, type TimeMarkEvent as U, type ViewMode as V, type TimePeriod as W, type TimePoint as X, type TimeRow as Y, type TimeScale as Z, type TimeSpanEvent as _, type ColorKey as a, describeOverlap as a0, resolvePalette as a1, validateDiagram as a2, type Colors as b, type Carry as c, type Checked as d, type Color as e, type ColorName as f, DEFAULT_PALETTE as g, type DiagramEvent as h, FONTS as i, type Family as j, type GitCommit as k, type LabelSide as l, type OverlapSpot as m, PALETTES as n, type Palette as o, READABLE_PX as p, type Region as q, type SceneAction as r, type SceneBadge as s, type SceneEdge as t, type SceneEnd as u, type SceneField as v, type SceneLabel as w, type SceneLifeline as x, type ScenePath as y, type SceneRegion as z };
496
+ export { type TimePoint as $, type SceneLabel as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneLifeline as E, type FieldError as F, type GitBranch as G, type ScenePath as H, type InkPart as I, type SceneRegion as J, type SceneSide as K, type Layout as L, type SceneStrip as M, type NotationLang as N, type Overlap as O, type Point as P, type SceneTrail as Q, type Rect as R, type SceneBox as S, type Theme as T, type StatePath as U, type ViewMode as V, type Step as W, type StepSource as X, type StripMeter as Y, type TimeMarkEvent as Z, type TimePeriod as _, type ColorKey as a, type TimeRow as a0, type TimeScale as a1, type TimeSpanEvent as a2, type TimeSpec as a3, type TreeLeaf as a4, type TreeNode as a5, describeOverlap as a6, resolvePalette as a7, validateDiagram as a8, type TextStyle as b, type Colors as c, type Carry as d, type Checked as e, type Color as f, type ColorName as g, DEFAULT_PALETTE as h, type DiagramEvent as i, FONTS as j, type Family as k, type GitCommit as l, type LabelSide as m, type LineupItem as n, type LineupOrder as o, type LineupStamp as p, type OverlapSpot as q, PALETTES as r, type Palette as s, READABLE_PX as t, type Region as u, type SceneAction as v, type SceneBadge as w, type SceneEdge as x, type SceneEnd as y, type SceneField as z };