@cardenelabs/dragon 0.46.3 → 0.47.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 (86) hide show
  1. package/README.ja.md +4 -2
  2. package/README.md +4 -2
  3. package/dist/cli.cjs +71 -70
  4. package/dist/cli.cjs.map +1 -1
  5. package/dist/cli.js +71 -70
  6. package/dist/cli.js.map +1 -1
  7. package/dist/export.cjs +13 -10
  8. package/dist/export.cjs.map +1 -1
  9. package/dist/export.d.cts +2 -2
  10. package/dist/export.d.ts +2 -2
  11. package/dist/export.js +13 -10
  12. package/dist/export.js.map +1 -1
  13. package/dist/index.cjs +18 -12
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +5 -5
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.js +18 -12
  18. package/dist/index.js.map +1 -1
  19. package/dist/{ink-DeDtzaTL.d.cts → ink-Sz5_zWte.d.cts} +1 -1
  20. package/dist/{ink-DeDtzaTL.d.ts → ink-Sz5_zWte.d.ts} +1 -1
  21. package/dist/light/{chunk-YO3UBEC3.js → chunk-AHUJ37R3.js} +4 -3
  22. package/dist/light/chunk-AHUJ37R3.js.map +1 -0
  23. package/dist/light/{chunk-SUL4AJLI.cjs → chunk-KNA5HH2H.cjs} +85 -2
  24. package/dist/light/chunk-KNA5HH2H.cjs.map +1 -0
  25. package/dist/light/{chunk-V34DCH34.cjs → chunk-O7RQ6R54.cjs} +84 -83
  26. package/dist/light/chunk-O7RQ6R54.cjs.map +1 -0
  27. package/dist/light/{chunk-DVGDEPCV.js → chunk-VUVRSYH6.js} +84 -1
  28. package/dist/light/chunk-VUVRSYH6.js.map +1 -0
  29. package/dist/light/{git-WBGFDRBD.cjs → git-M63KYUUK.cjs} +66 -68
  30. package/dist/light/git-M63KYUUK.cjs.map +1 -0
  31. package/dist/light/{git-WEJL6VAY.js → git-NMPPSCRM.js} +4 -6
  32. package/dist/light/{git-WEJL6VAY.js.map → git-NMPPSCRM.js.map} +1 -1
  33. package/dist/light/index.cjs +300 -296
  34. package/dist/light/index.cjs.map +1 -1
  35. package/dist/light/index.d.cts +4 -4
  36. package/dist/light/index.d.ts +4 -4
  37. package/dist/light/index.js +49 -45
  38. package/dist/light/index.js.map +1 -1
  39. package/dist/light/{lineup-WLGNGTFX.cjs → lineup-2VWQ74CU.cjs} +42 -44
  40. package/dist/light/lineup-2VWQ74CU.cjs.map +1 -0
  41. package/dist/light/{lineup-6LN6Z5T2.js → lineup-HZ5YTQ36.js} +4 -6
  42. package/dist/light/{lineup-6LN6Z5T2.js.map → lineup-HZ5YTQ36.js.map} +1 -1
  43. package/dist/light/{state-JVAH4TSM.cjs → state-MFCHMESP.cjs} +42 -44
  44. package/dist/light/state-MFCHMESP.cjs.map +1 -0
  45. package/dist/light/{state-DFYTMQI7.js → state-RRAJPRO3.js} +3 -5
  46. package/dist/light/{state-DFYTMQI7.js.map → state-RRAJPRO3.js.map} +1 -1
  47. package/dist/light/{time-M3EGEFDU.js → time-7V7RUEYS.js} +5 -4
  48. package/dist/light/time-7V7RUEYS.js.map +1 -0
  49. package/dist/light/{time-EXRPI34B.cjs → time-RISQEAB7.cjs} +86 -85
  50. package/dist/light/time-RISQEAB7.cjs.map +1 -0
  51. package/dist/light/{tree-MFU54QKY.js → tree-PWSU7R6R.js} +3 -3
  52. package/dist/light/{tree-DECHTXFU.cjs → tree-S23P2PW7.cjs} +62 -62
  53. package/dist/light/{tree-DECHTXFU.cjs.map → tree-S23P2PW7.cjs.map} +1 -1
  54. package/dist/node.cjs +5 -2
  55. package/dist/node.cjs.map +1 -1
  56. package/dist/node.js +5 -2
  57. package/dist/node.js.map +1 -1
  58. package/dist/player.global.js +3 -3
  59. package/package.json +1 -1
  60. package/src/cli.ts +10 -10
  61. package/src/export/index.ts +3 -3
  62. package/src/figure-text.ts +2 -2
  63. package/src/kinds/registry.ts +2 -2
  64. package/src/layout/time.ts +2 -2
  65. package/src/messages.ts +1 -1
  66. package/src/parser.ts +3 -2
  67. package/src/player.ts +13 -5
  68. package/src/render/draw.ts +4 -4
  69. package/src/render/ink.ts +2 -2
  70. package/src/schema.ts +4 -4
  71. package/src/version.ts +3 -3
  72. package/src/words.ts +6 -0
  73. package/dist/light/chunk-CLS6JVKK.cjs +0 -84
  74. package/dist/light/chunk-CLS6JVKK.cjs.map +0 -1
  75. package/dist/light/chunk-DVGDEPCV.js.map +0 -1
  76. package/dist/light/chunk-SUL4AJLI.cjs.map +0 -1
  77. package/dist/light/chunk-V34DCH34.cjs.map +0 -1
  78. package/dist/light/chunk-YDKPEKGZ.js +0 -84
  79. package/dist/light/chunk-YDKPEKGZ.js.map +0 -1
  80. package/dist/light/chunk-YO3UBEC3.js.map +0 -1
  81. package/dist/light/git-WBGFDRBD.cjs.map +0 -1
  82. package/dist/light/lineup-WLGNGTFX.cjs.map +0 -1
  83. package/dist/light/state-JVAH4TSM.cjs.map +0 -1
  84. package/dist/light/time-EXRPI34B.cjs.map +0 -1
  85. package/dist/light/time-M3EGEFDU.js.map +0 -1
  86. /package/dist/light/{tree-MFU54QKY.js.map → tree-PWSU7R6R.js.map} +0 -0
@@ -231,7 +231,7 @@ type Checked = {
231
231
  errors: FieldError[];
232
232
  };
233
233
  interface CheckOptions {
234
- /** 誤りの文の言葉。渡さなければ日本語 */
234
+ /** 誤りの文の言葉。渡さなければ英語 (#3338) */
235
235
  lang?: NotationLang;
236
236
  }
237
237
  /** 原本の JSON を検査する。版が道具より新しいかは見ない (`readDiagram` が見る)。 */
@@ -324,7 +324,7 @@ type Parsed = {
324
324
  errors: LineError[];
325
325
  };
326
326
  interface ParseOptions {
327
- /** 誤りの文の言葉。既定は日本語 */
327
+ /** 誤りの文の言葉。既定は英語 (#3338) */
328
328
  lang?: NotationLang;
329
329
  }
330
330
  declare function parseNotation(notation: string, options?: ParseOptions): Parsed;
@@ -361,7 +361,7 @@ type Read = {
361
361
  ok: false;
362
362
  errors: FieldError[];
363
363
  };
364
- /** 原本を読む。道具より新しい版は描かずに断り、形の誤りは検査の誤りとして返す。誤りの文は `options.lang` (渡さなければ日本語) で出す。 */
364
+ /** 原本を読む。道具より新しい版は描かずに断り、形の誤りは検査の誤りとして返す。誤りの文は `options.lang` (渡さなければ英語) で出す。 */
365
365
  declare function readDiagram(input: unknown, options?: CheckOptions): Read;
366
366
 
367
367
  /** 時間軸。`x` から目盛り 1 つの幅 `unit` で `count` 個並べ、`line` の高さに時刻の目盛りの線を引く */
@@ -722,7 +722,7 @@ interface RenderOptions {
722
722
  */
723
723
  colors?: Colors;
724
724
  theme?: Theme;
725
- /** 描く部品が出す字 (断りの文、全体図の札、読み上げの名前) の言葉。書かなければ日本語 (#3001) */
725
+ /** 描く部品が出す字 (断りの文、全体図の札、読み上げの名前) の言葉。書かなければ英語 (#3001、#3338) */
726
726
  lang?: NotationLang;
727
727
  /**
728
728
  * 最後の段の止め絵に、全ての段の線の名前と箱の中の処理を最後の段と同じ濃さで出す (#3200)。途中の段の止め絵は今の段の名前だけを出す。
@@ -231,7 +231,7 @@ type Checked = {
231
231
  errors: FieldError[];
232
232
  };
233
233
  interface CheckOptions {
234
- /** 誤りの文の言葉。渡さなければ日本語 */
234
+ /** 誤りの文の言葉。渡さなければ英語 (#3338) */
235
235
  lang?: NotationLang;
236
236
  }
237
237
  /** 原本の JSON を検査する。版が道具より新しいかは見ない (`readDiagram` が見る)。 */
@@ -324,7 +324,7 @@ type Parsed = {
324
324
  errors: LineError[];
325
325
  };
326
326
  interface ParseOptions {
327
- /** 誤りの文の言葉。既定は日本語 */
327
+ /** 誤りの文の言葉。既定は英語 (#3338) */
328
328
  lang?: NotationLang;
329
329
  }
330
330
  declare function parseNotation(notation: string, options?: ParseOptions): Parsed;
@@ -361,7 +361,7 @@ type Read = {
361
361
  ok: false;
362
362
  errors: FieldError[];
363
363
  };
364
- /** 原本を読む。道具より新しい版は描かずに断り、形の誤りは検査の誤りとして返す。誤りの文は `options.lang` (渡さなければ日本語) で出す。 */
364
+ /** 原本を読む。道具より新しい版は描かずに断り、形の誤りは検査の誤りとして返す。誤りの文は `options.lang` (渡さなければ英語) で出す。 */
365
365
  declare function readDiagram(input: unknown, options?: CheckOptions): Read;
366
366
 
367
367
  /** 時間軸。`x` から目盛り 1 つの幅 `unit` で `count` 個並べ、`line` の高さに時刻の目盛りの線を引く */
@@ -722,7 +722,7 @@ interface RenderOptions {
722
722
  */
723
723
  colors?: Colors;
724
724
  theme?: Theme;
725
- /** 描く部品が出す字 (断りの文、全体図の札、読み上げの名前) の言葉。書かなければ日本語 (#3001) */
725
+ /** 描く部品が出す字 (断りの文、全体図の札、読み上げの名前) の言葉。書かなければ英語 (#3001、#3338) */
726
726
  lang?: NotationLang;
727
727
  /**
728
728
  * 最後の段の止め絵に、全ての段の線の名前と箱の中の処理を最後の段と同じ濃さで出す (#3200)。途中の段の止め絵は今の段の名前だけを出す。
@@ -1,31 +1,3 @@
1
- import {
2
- AS,
3
- AT,
4
- ATTRS,
5
- CARRIES,
6
- COPY,
7
- DURATION_UNITS,
8
- FROM,
9
- HEAD,
10
- HEADS,
11
- KINDS,
12
- LABEL_MOST,
13
- LANE_ATTRS,
14
- LANE_MOST,
15
- LINEUP_HEADS,
16
- MERGE,
17
- NOW,
18
- OF,
19
- OLD_HEADS,
20
- ON,
21
- SIDES,
22
- SPAN_SHAPES,
23
- STATE_ENDS,
24
- TIME_EDGE_ATTRS,
25
- TIME_HEADS,
26
- TREE_HEADS,
27
- VIEWS
28
- } from "./chunk-YDKPEKGZ.js";
29
1
  import {
30
2
  ICONS,
31
3
  action,
@@ -51,19 +23,46 @@ import {
51
23
  sansOf,
52
24
  side,
53
25
  strip
54
- } from "./chunk-YO3UBEC3.js";
26
+ } from "./chunk-AHUJ37R3.js";
55
27
  import {
28
+ AS,
29
+ AT,
30
+ ATTRS,
31
+ CARRIES,
32
+ COPY,
33
+ DEFAULT_LANG,
56
34
  DEFAULT_PALETTE,
35
+ DURATION_UNITS,
57
36
  EASE,
58
37
  FIGURE_TEXT,
59
38
  FONTS,
60
39
  FONT_VARS,
40
+ FROM,
41
+ HEAD,
42
+ HEADS,
43
+ KINDS,
44
+ LABEL_MOST,
45
+ LANE_ATTRS,
46
+ LANE_MOST,
47
+ LINEUP_HEADS,
61
48
  LOOK,
62
49
  LOOP_ROOM,
50
+ MERGE,
63
51
  MOTION,
52
+ NOW,
53
+ OF,
54
+ OLD_HEADS,
55
+ ON,
64
56
  PALETTES,
65
57
  READABLE_PX,
58
+ SIDES,
59
+ SPAN_SHAPES,
60
+ STATE_ENDS,
61
+ TIME_EDGE_ATTRS,
62
+ TIME_HEADS,
63
+ TREE_HEADS,
66
64
  TYPE,
65
+ VIEWS,
67
66
  badgeOnPath,
68
67
  badgeRect,
69
68
  boxColors,
@@ -94,7 +93,7 @@ import {
94
93
  slotRooms,
95
94
  stripNeed,
96
95
  textWidth
97
- } from "./chunk-DVGDEPCV.js";
96
+ } from "./chunk-VUVRSYH6.js";
98
97
 
99
98
  // src/kinds/registry.ts
100
99
  var LATER_KINDS = ["git", "lineup", "state", "time", "tree"];
@@ -105,7 +104,7 @@ function registerKind(kind, parts) {
105
104
  function kindLoaded(kind) {
106
105
  return !LATER_KINDS.includes(kind) || registered[kind] !== void 0;
107
106
  }
108
- function kindParts(kind, lang = "ja") {
107
+ function kindParts(kind, lang = DEFAULT_LANG) {
109
108
  const parts = registered[kind];
110
109
  if (parts === void 0) throw new Error(FIGURE_TEXT[lang].kindNotLoaded(kind));
111
110
  return parts;
@@ -6699,7 +6698,7 @@ function validateDiagram(input, options = {}) {
6699
6698
  if (validate_diagram_default(input)) return { ok: true };
6700
6699
  const all = validate_diagram_default.errors ?? [];
6701
6700
  const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
6702
- const m = FIELD_MESSAGES[options.lang ?? "ja"];
6701
+ const m = FIELD_MESSAGES[options.lang ?? DEFAULT_LANG];
6703
6702
  const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m, input));
6704
6703
  return { ok: false, errors };
6705
6704
  }
@@ -7016,7 +7015,7 @@ var newerError = (version, lang) => ({
7016
7015
  });
7017
7016
  function readDiagram(input, options = {}) {
7018
7017
  const newer = newerThanTool(input);
7019
- if (newer !== void 0) return { ok: false, errors: [newerError(newer, options.lang ?? "ja")] };
7018
+ if (newer !== void 0) return { ok: false, errors: [newerError(newer, options.lang ?? DEFAULT_LANG)] };
7020
7019
  const checked = validateDiagram(input, options);
7021
7020
  if (!checked.ok) return checked;
7022
7021
  return { ok: true, diagram: input, warnings: [] };
@@ -8037,7 +8036,7 @@ function parseLines(lines, m) {
8037
8036
  }
8038
8037
  function parseNotation(notation, options = {}) {
8039
8038
  try {
8040
- return { ok: true, diagram: parseLines(tokenize(notation), messagesFor(options.lang ?? "ja")) };
8039
+ return { ok: true, diagram: parseLines(tokenize(notation), messagesFor(options.lang ?? DEFAULT_LANG)) };
8041
8040
  } catch (error) {
8042
8041
  if (!(error instanceof NotationError)) throw error;
8043
8042
  return { ok: false, errors: [{ line: error.line, column: error.column, message: error.message }] };
@@ -9529,13 +9528,13 @@ function followView(layout, timeline, diagram, m, id, content, follow, heads, dr
9529
9528
  function paletteOf(options, theme) {
9530
9529
  const palette = resolvePalette(options.palette);
9531
9530
  if (!options.colors) return palette;
9532
- const words = FIGURE_TEXT[options.lang ?? "ja"];
9531
+ const words = FIGURE_TEXT[options.lang ?? DEFAULT_LANG];
9533
9532
  const errors = Object.entries(options.colors).flatMap(([name2, value2]) => !isColorName(name2) ? [words.unknownColor(name2)] : isColorValue(value2) ? [] : [words.unreadableColor(name2)]);
9534
9533
  if (errors.length > 0) throw new Error(words.cannotDraw(errors.join(" / ")));
9535
9534
  return { ...palette, [theme]: { ...palette[theme], ...options.colors } };
9536
9535
  }
9537
9536
  function renderDiagram(input, options = {}) {
9538
- const lang = options.lang ?? "ja";
9537
+ const lang = options.lang ?? DEFAULT_LANG;
9539
9538
  const read = readDiagram(input, { lang });
9540
9539
  if (!read.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
9541
9540
  const diagram = read.diagram;
@@ -9621,7 +9620,7 @@ function mountDiagram(host, diagram, options = {}) {
9621
9620
  const win = doc.defaultView;
9622
9621
  const reduce = Boolean(win?.matchMedia?.("(prefers-reduced-motion: reduce)").matches);
9623
9622
  const rendered = renderDiagram(diagram, options);
9624
- const lang = options.lang ?? "ja";
9623
+ const lang = options.lang ?? DEFAULT_LANG;
9625
9624
  const words = FIGURE_TEXT[lang];
9626
9625
  const palette = paletteOf(options, rendered.theme);
9627
9626
  const { timeline } = rendered;
@@ -9764,9 +9763,14 @@ function mountDiagram(host, diagram, options = {}) {
9764
9763
  next = svg ? svg.cloneNode(true) : null;
9765
9764
  }
9766
9765
  if (!next) return;
9767
- next.setAttribute("aria-hidden", "true");
9768
- next.removeAttribute("role");
9769
- next.removeAttribute("aria-label");
9766
+ if (next.querySelector("a[href]")) {
9767
+ next.removeAttribute("aria-hidden");
9768
+ next.setAttribute("role", "group");
9769
+ } else {
9770
+ next.setAttribute("aria-hidden", "true");
9771
+ next.removeAttribute("role");
9772
+ next.removeAttribute("aria-label");
9773
+ }
9770
9774
  next.style.setProperty("--at", String(at));
9771
9775
  next.style.setProperty("--play", playing ? "running" : "paused");
9772
9776
  next.dataset.motion = playing ? "play" : "still";
@@ -9890,11 +9894,11 @@ function mountDiagram(host, diagram, options = {}) {
9890
9894
 
9891
9895
  // src/light.ts
9892
9896
  var LOADERS = {
9893
- git: () => import("./git-WEJL6VAY.js"),
9894
- lineup: () => import("./lineup-6LN6Z5T2.js"),
9895
- state: () => import("./state-DFYTMQI7.js"),
9896
- time: () => import("./time-M3EGEFDU.js"),
9897
- tree: () => import("./tree-MFU54QKY.js")
9897
+ git: () => import("./git-NMPPSCRM.js"),
9898
+ lineup: () => import("./lineup-HZ5YTQ36.js"),
9899
+ state: () => import("./state-RRAJPRO3.js"),
9900
+ time: () => import("./time-7V7RUEYS.js"),
9901
+ tree: () => import("./tree-PWSU7R6R.js")
9898
9902
  };
9899
9903
  var isLater = (kind) => LATER_KINDS.includes(kind);
9900
9904
  async function loadKind(kind) {