@cardenelabs/dragon 0.46.4 → 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.
- package/README.ja.md +4 -2
- package/README.md +4 -2
- package/dist/cli.cjs +71 -70
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +71 -70
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +13 -10
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +2 -2
- package/dist/export.d.ts +2 -2
- package/dist/export.js +13 -10
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/{ink-DeDtzaTL.d.cts → ink-Sz5_zWte.d.cts} +1 -1
- package/dist/{ink-DeDtzaTL.d.ts → ink-Sz5_zWte.d.ts} +1 -1
- package/dist/light/{chunk-YO3UBEC3.js → chunk-AHUJ37R3.js} +4 -3
- package/dist/light/chunk-AHUJ37R3.js.map +1 -0
- package/dist/light/{chunk-SUL4AJLI.cjs → chunk-KNA5HH2H.cjs} +85 -2
- package/dist/light/chunk-KNA5HH2H.cjs.map +1 -0
- package/dist/light/{chunk-V34DCH34.cjs → chunk-O7RQ6R54.cjs} +84 -83
- package/dist/light/chunk-O7RQ6R54.cjs.map +1 -0
- package/dist/light/{chunk-DVGDEPCV.js → chunk-VUVRSYH6.js} +84 -1
- package/dist/light/chunk-VUVRSYH6.js.map +1 -0
- package/dist/light/{git-WBGFDRBD.cjs → git-M63KYUUK.cjs} +66 -68
- package/dist/light/git-M63KYUUK.cjs.map +1 -0
- package/dist/light/{git-WEJL6VAY.js → git-NMPPSCRM.js} +4 -6
- package/dist/light/{git-WEJL6VAY.js.map → git-NMPPSCRM.js.map} +1 -1
- package/dist/light/index.cjs +292 -293
- package/dist/light/index.cjs.map +1 -1
- package/dist/light/index.d.cts +4 -4
- package/dist/light/index.d.ts +4 -4
- package/dist/light/index.js +41 -42
- package/dist/light/index.js.map +1 -1
- package/dist/light/{lineup-WLGNGTFX.cjs → lineup-2VWQ74CU.cjs} +42 -44
- package/dist/light/lineup-2VWQ74CU.cjs.map +1 -0
- package/dist/light/{lineup-6LN6Z5T2.js → lineup-HZ5YTQ36.js} +4 -6
- package/dist/light/{lineup-6LN6Z5T2.js.map → lineup-HZ5YTQ36.js.map} +1 -1
- package/dist/light/{state-JVAH4TSM.cjs → state-MFCHMESP.cjs} +42 -44
- package/dist/light/state-MFCHMESP.cjs.map +1 -0
- package/dist/light/{state-DFYTMQI7.js → state-RRAJPRO3.js} +3 -5
- package/dist/light/{state-DFYTMQI7.js.map → state-RRAJPRO3.js.map} +1 -1
- package/dist/light/{time-M3EGEFDU.js → time-7V7RUEYS.js} +5 -4
- package/dist/light/time-7V7RUEYS.js.map +1 -0
- package/dist/light/{time-EXRPI34B.cjs → time-RISQEAB7.cjs} +86 -85
- package/dist/light/time-RISQEAB7.cjs.map +1 -0
- package/dist/light/{tree-MFU54QKY.js → tree-PWSU7R6R.js} +3 -3
- package/dist/light/{tree-DECHTXFU.cjs → tree-S23P2PW7.cjs} +62 -62
- package/dist/light/tree-S23P2PW7.cjs.map +1 -0
- package/dist/node.cjs +5 -2
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +5 -2
- package/dist/node.js.map +1 -1
- package/dist/player.global.js +3 -3
- package/package.json +1 -1
- package/src/cli.ts +10 -10
- package/src/export/index.ts +3 -3
- package/src/figure-text.ts +2 -2
- package/src/kinds/registry.ts +2 -2
- package/src/layout/time.ts +2 -2
- package/src/messages.ts +1 -1
- package/src/parser.ts +3 -2
- package/src/player.ts +3 -2
- package/src/render/draw.ts +4 -4
- package/src/render/ink.ts +2 -2
- package/src/schema.ts +4 -4
- package/src/version.ts +3 -3
- package/src/words.ts +6 -0
- package/dist/light/chunk-CLS6JVKK.cjs +0 -84
- package/dist/light/chunk-CLS6JVKK.cjs.map +0 -1
- package/dist/light/chunk-DVGDEPCV.js.map +0 -1
- package/dist/light/chunk-SUL4AJLI.cjs.map +0 -1
- package/dist/light/chunk-V34DCH34.cjs.map +0 -1
- package/dist/light/chunk-YDKPEKGZ.js +0 -84
- package/dist/light/chunk-YDKPEKGZ.js.map +0 -1
- package/dist/light/chunk-YO3UBEC3.js.map +0 -1
- package/dist/light/git-WBGFDRBD.cjs.map +0 -1
- package/dist/light/lineup-WLGNGTFX.cjs.map +0 -1
- package/dist/light/state-JVAH4TSM.cjs.map +0 -1
- package/dist/light/time-EXRPI34B.cjs.map +0 -1
- package/dist/light/time-M3EGEFDU.js.map +0 -1
- package/dist/light/tree-DECHTXFU.cjs.map +0 -1
- /package/dist/light/{tree-MFU54QKY.js.map → tree-PWSU7R6R.js.map} +0 -0
package/README.ja.md
CHANGED
|
@@ -60,6 +60,8 @@ const player = mountDiagram(host, parsed.diagram);
|
|
|
60
60
|
図は同梱の字で測った字の幅で組むため、読み込まないと端末の字で描かれ、札から字がはみ出すことがある。
|
|
61
61
|
CSS と字の file は、束ねる道具 (Vite など) が頁へ運ぶ。
|
|
62
62
|
この入口は Node の組み込みの module を読まないため、Next.js の Turbopack のように頁を束ねる道具でもそのまま読める。
|
|
63
|
+
再生の部品が出す字 (釦の読み上げの名前、全体図の札) は英語で出る。
|
|
64
|
+
日本語で出すには、`mountDiagram` の 3 つ目の引数に `{ lang: "ja" }` を渡し、誤りの文を日本語にするには `parseNotation` にも渡す。
|
|
63
65
|
原本の file を今の版へ移す `migrateFile` は、Node でだけ動く入口 `@cardenelabs/dragon/node` から引く。
|
|
64
66
|
|
|
65
67
|
`mountDiagram` が返す `player` で段を動かす (`next`、`prev`、`play`、`pause`、`destroy`)。
|
|
@@ -136,7 +138,7 @@ step 出荷に回す
|
|
|
136
138
|
```
|
|
137
139
|
|
|
138
140
|
`parseNotation` は記法を原本の JSON に、`printNotation` は原本の JSON を記法に直す。
|
|
139
|
-
誤りの文の言葉は `parseNotation(text, { lang: "
|
|
141
|
+
誤りの文の言葉は `parseNotation(text, { lang: "ja" })` のように渡した言葉で決まり、渡さなければ英語になる。
|
|
140
142
|
前の形の記法 (`時系列図` か `構成図` で始まる形) は読まず、その行の新しい形を示す誤りで止まる。
|
|
141
143
|
前の形と新しい形の対応表は [`CHANGELOG.ja.md`](https://github.com/cardene777/dragon/blob/main/CHANGELOG.ja.md) にある。
|
|
142
144
|
|
|
@@ -316,7 +318,7 @@ dragon export ccip.json --out out
|
|
|
316
318
|
| `--width <px>` | 枠の幅。見せ方 (全体を止める / 寄って追う) を選び、寄って追う窓の幅になる |
|
|
317
319
|
| `--palette <名前>` | 色味 (`clear` / `paper` / `night`、既定は `paper`) |
|
|
318
320
|
| `--theme <明暗>` | `light` か `dark` |
|
|
319
|
-
| `--lang <言葉>` | 図の中の字 (全体図の札、HTML の読み上げの名前、描けない時の断りの文) と、命令が出す使い方の文と誤りの文の言葉 (`ja` か `en`)。記法の file でも JSON の原本でも、既定は `
|
|
321
|
+
| `--lang <言葉>` | 図の中の字 (全体図の札、HTML の読み上げの名前、描けない時の断りの文) と、命令が出す使い方の文と誤りの文の言葉 (`ja` か `en`)。記法の file でも JSON の原本でも、既定は `en` |
|
|
320
322
|
| `--fps <数>` | mp4 の 1 秒のコマの数 (既定 30) |
|
|
321
323
|
| `--gif-fps <数>` | GIF の 1 秒のコマの数 (既定 10) |
|
|
322
324
|
| `--format <形>` | 書き出す形を `,` で区切る (既定 `mp4,gif,html,png`) |
|
package/README.md
CHANGED
|
@@ -58,6 +58,8 @@ The font entry only loads the CSS for the two bundled fonts (Noto Sans JP and Je
|
|
|
58
58
|
Diagrams are laid out with character widths measured from the bundled fonts, so without it they are drawn in the device's fonts and text can overflow its labels.
|
|
59
59
|
A bundler (such as Vite) carries the CSS and font files to the page.
|
|
60
60
|
The entry does not read Node's built-in modules, so it also works with bundlers such as Next.js Turbopack.
|
|
61
|
+
The text the player shows, such as the names read aloud for its buttons and the overview label, is in English.
|
|
62
|
+
For Japanese, pass `{ lang: "ja" }` to `mountDiagram` as the third argument, and to `parseNotation` for its error messages.
|
|
61
63
|
`migrateFile`, which moves a source file to the current format version, comes from the Node-only entry `@cardenelabs/dragon/node`.
|
|
62
64
|
|
|
63
65
|
Use the `player` returned by `mountDiagram` to move through the steps (`next`, `prev`, `play`, `pause`, `destroy`).
|
|
@@ -134,7 +136,7 @@ step Pass to shipping
|
|
|
134
136
|
```
|
|
135
137
|
|
|
136
138
|
`parseNotation` turns the notation into the source JSON, and `printNotation` turns the source JSON back into the notation.
|
|
137
|
-
Error messages are in the language you pass, as in `parseNotation(text, { lang: "
|
|
139
|
+
Error messages are in the language you pass, as in `parseNotation(text, { lang: "ja" })`, and are in English when you pass none.
|
|
138
140
|
The old form of the notation (starting with `時系列図` or `構成図`) is not read, and stops with an error that shows the new form of that line.
|
|
139
141
|
The table from the old form to the new one is in [`CHANGELOG.md`](https://github.com/cardene777/dragon/blob/main/CHANGELOG.md).
|
|
140
142
|
|
|
@@ -314,7 +316,7 @@ dragon export ccip.json --out out
|
|
|
314
316
|
| `--width <px>` | Frame width. Picks the view (`fixed` / `follow`) and sets the window width for `follow` |
|
|
315
317
|
| `--palette <name>` | Colors (`clear` / `paper` / `night`, default `paper`) |
|
|
316
318
|
| `--theme <mode>` | `light` or `dark` |
|
|
317
|
-
| `--lang <lang>` | Language of the text in the diagram (overview labels, the names read in HTML, and the message when it cannot draw) and of the command's usage and error messages (`ja` or `en`). Defaults to `
|
|
319
|
+
| `--lang <lang>` | Language of the text in the diagram (overview labels, the names read in HTML, and the message when it cannot draw) and of the command's usage and error messages (`ja` or `en`). Defaults to `en` for both notation files and source JSON |
|
|
318
320
|
| `--fps <n>` | Frames per second of the MP4 (default 30) |
|
|
319
321
|
| `--gif-fps <n>` | Frames per second of the GIF (default 10) |
|
|
320
322
|
| `--format <formats>` | The formats to write, separated by `,` (default `mp4,gif,html,png`) |
|
package/dist/cli.cjs
CHANGED
|
@@ -1640,12 +1640,68 @@ function badges(diagram, layout) {
|
|
|
1640
1640
|
return replaceSameSpot(placed);
|
|
1641
1641
|
}
|
|
1642
1642
|
|
|
1643
|
+
// src/words.ts
|
|
1644
|
+
var DEFAULT_LANG = "en";
|
|
1645
|
+
var keys = (table) => Object.keys(table);
|
|
1646
|
+
var KINDS = keys({ sequence: true, architecture: true, state: true, git: true, time: true, tree: true, lineup: true });
|
|
1647
|
+
var STATE_ENDS = ["start", "finish"];
|
|
1648
|
+
var TIME_HEADS = ["scale", "period", "row", "point", "zoom", "mark", "span"];
|
|
1649
|
+
var NOW = "now";
|
|
1650
|
+
var TREE_HEADS = ["leaf", "node"];
|
|
1651
|
+
var LINEUP_HEADS = ["item", "line", "seal", "open", "pick", "stamp"];
|
|
1652
|
+
var LANE_MOST = 12;
|
|
1653
|
+
var LABEL_MOST = 4;
|
|
1654
|
+
var LANE_ATTRS = ["note", "color"];
|
|
1655
|
+
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "source", "act", "note", "set", "branch", "commit", ...TIME_HEADS, ...TREE_HEADS, ...LINEUP_HEADS];
|
|
1656
|
+
var AS = "as";
|
|
1657
|
+
var ON = "on";
|
|
1658
|
+
var COPY = "copy";
|
|
1659
|
+
var MERGE = "merge";
|
|
1660
|
+
var FROM = "from";
|
|
1661
|
+
var HEAD = "HEAD";
|
|
1662
|
+
var AT = "at";
|
|
1663
|
+
var OF = "of";
|
|
1664
|
+
var ATTRS = {
|
|
1665
|
+
diagram: ["view"],
|
|
1666
|
+
group: ["note", "color", "icon"],
|
|
1667
|
+
box: ["note", "color", "icon", "link"],
|
|
1668
|
+
source: ["url"],
|
|
1669
|
+
edge: ["carry", "tag", "side", "at", "into"],
|
|
1670
|
+
note: ["color"],
|
|
1671
|
+
set: ["tag"],
|
|
1672
|
+
strip: ["meter"],
|
|
1673
|
+
branch: ["note"],
|
|
1674
|
+
commit: ["hash", "note"],
|
|
1675
|
+
leaf: ["hash"],
|
|
1676
|
+
node: ["hash"],
|
|
1677
|
+
item: ["color", "label"],
|
|
1678
|
+
scale: ["from"],
|
|
1679
|
+
period: ["from"],
|
|
1680
|
+
row: ["color", "empty"],
|
|
1681
|
+
mark: ["color"],
|
|
1682
|
+
span: ["shape", "color"]
|
|
1683
|
+
};
|
|
1684
|
+
var TIME_EDGE_ATTRS = ["at", "into"];
|
|
1685
|
+
var SPAN_SHAPES = ["box"];
|
|
1686
|
+
var DURATION_UNITS = ["ms", "s", "min", "h", "d"];
|
|
1687
|
+
var CARRIES = keys({ coin: true, none: true });
|
|
1688
|
+
var VIEWS = keys({ fixed: true, follow: true });
|
|
1689
|
+
var SIDES = keys({ above: true, below: true, left: true, right: true });
|
|
1690
|
+
var OLD_HEADS = {
|
|
1691
|
+
\u6642\u7CFB\u5217\u56F3: "sequence",
|
|
1692
|
+
\u69CB\u6210\u56F3: "architecture",
|
|
1693
|
+
\u533A\u753B: "group",
|
|
1694
|
+
\u898B\u305B\u65B9: "view",
|
|
1695
|
+
region: "group",
|
|
1696
|
+
view: "view"
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1643
1699
|
// src/kinds/registry.ts
|
|
1644
1700
|
var registered = {};
|
|
1645
1701
|
function registerKind(kind, parts) {
|
|
1646
1702
|
registered[kind] = parts;
|
|
1647
1703
|
}
|
|
1648
|
-
function kindParts(kind, lang =
|
|
1704
|
+
function kindParts(kind, lang = DEFAULT_LANG) {
|
|
1649
1705
|
const parts = registered[kind];
|
|
1650
1706
|
if (parts === void 0) throw new Error(FIGURE_TEXT[lang].kindNotLoaded(kind));
|
|
1651
1707
|
return parts;
|
|
@@ -8111,61 +8167,6 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
8111
8167
|
return errors === 0;
|
|
8112
8168
|
}
|
|
8113
8169
|
|
|
8114
|
-
// src/words.ts
|
|
8115
|
-
var keys = (table) => Object.keys(table);
|
|
8116
|
-
var KINDS = keys({ sequence: true, architecture: true, state: true, git: true, time: true, tree: true, lineup: true });
|
|
8117
|
-
var STATE_ENDS = ["start", "finish"];
|
|
8118
|
-
var TIME_HEADS = ["scale", "period", "row", "point", "zoom", "mark", "span"];
|
|
8119
|
-
var NOW = "now";
|
|
8120
|
-
var TREE_HEADS = ["leaf", "node"];
|
|
8121
|
-
var LINEUP_HEADS = ["item", "line", "seal", "open", "pick", "stamp"];
|
|
8122
|
-
var LANE_MOST = 12;
|
|
8123
|
-
var LABEL_MOST = 4;
|
|
8124
|
-
var LANE_ATTRS = ["note", "color"];
|
|
8125
|
-
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "source", "act", "note", "set", "branch", "commit", ...TIME_HEADS, ...TREE_HEADS, ...LINEUP_HEADS];
|
|
8126
|
-
var AS = "as";
|
|
8127
|
-
var ON = "on";
|
|
8128
|
-
var COPY = "copy";
|
|
8129
|
-
var MERGE = "merge";
|
|
8130
|
-
var FROM = "from";
|
|
8131
|
-
var HEAD = "HEAD";
|
|
8132
|
-
var AT = "at";
|
|
8133
|
-
var OF = "of";
|
|
8134
|
-
var ATTRS = {
|
|
8135
|
-
diagram: ["view"],
|
|
8136
|
-
group: ["note", "color", "icon"],
|
|
8137
|
-
box: ["note", "color", "icon", "link"],
|
|
8138
|
-
source: ["url"],
|
|
8139
|
-
edge: ["carry", "tag", "side", "at", "into"],
|
|
8140
|
-
note: ["color"],
|
|
8141
|
-
set: ["tag"],
|
|
8142
|
-
strip: ["meter"],
|
|
8143
|
-
branch: ["note"],
|
|
8144
|
-
commit: ["hash", "note"],
|
|
8145
|
-
leaf: ["hash"],
|
|
8146
|
-
node: ["hash"],
|
|
8147
|
-
item: ["color", "label"],
|
|
8148
|
-
scale: ["from"],
|
|
8149
|
-
period: ["from"],
|
|
8150
|
-
row: ["color", "empty"],
|
|
8151
|
-
mark: ["color"],
|
|
8152
|
-
span: ["shape", "color"]
|
|
8153
|
-
};
|
|
8154
|
-
var TIME_EDGE_ATTRS = ["at", "into"];
|
|
8155
|
-
var SPAN_SHAPES = ["box"];
|
|
8156
|
-
var DURATION_UNITS = ["ms", "s", "min", "h", "d"];
|
|
8157
|
-
var CARRIES = keys({ coin: true, none: true });
|
|
8158
|
-
var VIEWS = keys({ fixed: true, follow: true });
|
|
8159
|
-
var SIDES = keys({ above: true, below: true, left: true, right: true });
|
|
8160
|
-
var OLD_HEADS = {
|
|
8161
|
-
\u6642\u7CFB\u5217\u56F3: "sequence",
|
|
8162
|
-
\u69CB\u6210\u56F3: "architecture",
|
|
8163
|
-
\u533A\u753B: "group",
|
|
8164
|
-
\u898B\u305B\u65B9: "view",
|
|
8165
|
-
region: "group",
|
|
8166
|
-
view: "view"
|
|
8167
|
-
};
|
|
8168
|
-
|
|
8169
8170
|
// src/schema.ts
|
|
8170
8171
|
var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
8171
8172
|
var ICON_NAMES = Object.keys(ICONS);
|
|
@@ -8291,7 +8292,7 @@ function validateDiagram(input, options = {}) {
|
|
|
8291
8292
|
if (validate_diagram_default(input)) return { ok: true };
|
|
8292
8293
|
const all = validate_diagram_default.errors ?? [];
|
|
8293
8294
|
const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
|
|
8294
|
-
const m = FIELD_MESSAGES[options.lang ??
|
|
8295
|
+
const m = FIELD_MESSAGES[options.lang ?? DEFAULT_LANG];
|
|
8295
8296
|
const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m, input));
|
|
8296
8297
|
return { ok: false, errors };
|
|
8297
8298
|
}
|
|
@@ -8309,7 +8310,7 @@ var newerError = (version, lang) => ({
|
|
|
8309
8310
|
});
|
|
8310
8311
|
function readDiagram(input, options = {}) {
|
|
8311
8312
|
const newer = newerThanTool(input);
|
|
8312
|
-
if (newer !== void 0) return { ok: false, errors: [newerError(newer, options.lang ??
|
|
8313
|
+
if (newer !== void 0) return { ok: false, errors: [newerError(newer, options.lang ?? DEFAULT_LANG)] };
|
|
8313
8314
|
const checked = validateDiagram(input, options);
|
|
8314
8315
|
if (!checked.ok) return checked;
|
|
8315
8316
|
return { ok: true, diagram: input, warnings: [] };
|
|
@@ -8579,7 +8580,7 @@ function findOverlaps(inks, stills, traces = []) {
|
|
|
8579
8580
|
});
|
|
8580
8581
|
return out;
|
|
8581
8582
|
}
|
|
8582
|
-
function describeOverlap(overlap, lang =
|
|
8583
|
+
function describeOverlap(overlap, lang = DEFAULT_LANG) {
|
|
8583
8584
|
const t = FIGURE_TEXT[lang];
|
|
8584
8585
|
const partName = (part) => part.kind === "icon" ? t.iconOf(part.box) : part.kind === "coin" ? t.coin : t.envelope;
|
|
8585
8586
|
const name = (spot) => spot.badge ? t.badgeName(spot.text) : spot.part ? partName(spot.part) : t.quoted(spot.text);
|
|
@@ -9524,13 +9525,13 @@ function followView(layout, timeline, diagram, m, id, content, follow, heads, dr
|
|
|
9524
9525
|
function paletteOf(options, theme) {
|
|
9525
9526
|
const palette = resolvePalette(options.palette);
|
|
9526
9527
|
if (!options.colors) return palette;
|
|
9527
|
-
const words = FIGURE_TEXT[options.lang ??
|
|
9528
|
+
const words = FIGURE_TEXT[options.lang ?? DEFAULT_LANG];
|
|
9528
9529
|
const errors = Object.entries(options.colors).flatMap(([name, value]) => !isColorName(name) ? [words.unknownColor(name)] : isColorValue(value) ? [] : [words.unreadableColor(name)]);
|
|
9529
9530
|
if (errors.length > 0) throw new Error(words.cannotDraw(errors.join(" / ")));
|
|
9530
9531
|
return { ...palette, [theme]: { ...palette[theme], ...options.colors } };
|
|
9531
9532
|
}
|
|
9532
9533
|
function renderDiagram(input, options = {}) {
|
|
9533
|
-
const lang = options.lang ??
|
|
9534
|
+
const lang = options.lang ?? DEFAULT_LANG;
|
|
9534
9535
|
const read2 = readDiagram(input, { lang });
|
|
9535
9536
|
if (!read2.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read2.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
|
|
9536
9537
|
const diagram = read2.diagram;
|
|
@@ -10798,7 +10799,7 @@ function needleSteps(diagram) {
|
|
|
10798
10799
|
return [from, at2];
|
|
10799
10800
|
});
|
|
10800
10801
|
}
|
|
10801
|
-
function layoutTime(diagram, lang =
|
|
10802
|
+
function layoutTime(diagram, lang = DEFAULT_LANG) {
|
|
10802
10803
|
const T = LOOK.time;
|
|
10803
10804
|
const { margin, gap } = LOOK;
|
|
10804
10805
|
const R = LOOK.region;
|
|
@@ -12174,7 +12175,7 @@ function drawnTexts(rendered, followSvg) {
|
|
|
12174
12175
|
}
|
|
12175
12176
|
async function exportDiagram(input, options) {
|
|
12176
12177
|
const formats = options.formats ?? FORMATS;
|
|
12177
|
-
const lang = options.lang ??
|
|
12178
|
+
const lang = options.lang ?? DEFAULT_LANG;
|
|
12178
12179
|
const rendered = renderDiagram(input, {
|
|
12179
12180
|
...options.palette ? { palette: options.palette } : {},
|
|
12180
12181
|
...options.theme ? { theme: options.theme } : {},
|
|
@@ -13552,7 +13553,7 @@ function parseLines(lines, m) {
|
|
|
13552
13553
|
}
|
|
13553
13554
|
function parseNotation(notation, options = {}) {
|
|
13554
13555
|
try {
|
|
13555
|
-
return { ok: true, diagram: parseLines(tokenize(notation), messagesFor(options.lang ??
|
|
13556
|
+
return { ok: true, diagram: parseLines(tokenize(notation), messagesFor(options.lang ?? DEFAULT_LANG)) };
|
|
13556
13557
|
} catch (error) {
|
|
13557
13558
|
if (!(error instanceof NotationError)) throw error;
|
|
13558
13559
|
return { ok: false, errors: [{ line: error.line, column: error.column, message: error.message }] };
|
|
@@ -13580,7 +13581,7 @@ var CLI_TEXT = {
|
|
|
13580
13581
|
" --width <px> \u67A0\u306E\u5E45\u3002\u898B\u305B\u65B9\u3092\u9078\u3073\u3001\u5BC4\u3063\u3066\u898B\u305B\u308B\u7A93\u306E\u5E45\u306B\u306A\u308B",
|
|
13581
13582
|
` --palette <\u540D\u524D> \u8272\u5473 (${PALETTE_NAMES})`,
|
|
13582
13583
|
" --theme <\u660E\u6697> light \u304B dark",
|
|
13583
|
-
" --lang <\u8A00\u8449> \u56F3\u306E\u4E2D\u306E\u5B57\u3068\u547D\u4EE4\u306E\u6587\u306E\u8A00\u8449 (ja \u304B en)\u3002\u65E2\u5B9A\u306F
|
|
13584
|
+
" --lang <\u8A00\u8449> \u56F3\u306E\u4E2D\u306E\u5B57\u3068\u547D\u4EE4\u306E\u6587\u306E\u8A00\u8449 (ja \u304B en)\u3002\u65E2\u5B9A\u306F en",
|
|
13584
13585
|
" --fps <\u6570> mp4 \u306E 1 \u79D2\u306E\u30B3\u30DE\u306E\u6570 (\u65E2\u5B9A 30)",
|
|
13585
13586
|
" --gif-fps <\u6570> GIF \u306E 1 \u79D2\u306E\u30B3\u30DE\u306E\u6570 (\u65E2\u5B9A 10)",
|
|
13586
13587
|
" --format <\u5F62> \u66F8\u304D\u51FA\u3059\u5F62\u3092 , \u3067\u533A\u5207\u308B (\u65E2\u5B9A mp4,gif,html,png)"
|
|
@@ -13603,7 +13604,7 @@ var CLI_TEXT = {
|
|
|
13603
13604
|
" --width <px> Frame width. Picks the view and sets the window width when following",
|
|
13604
13605
|
` --palette <name> Colors (${PALETTE_NAMES})`,
|
|
13605
13606
|
" --theme <mode> light or dark",
|
|
13606
|
-
" --lang <lang> Language of the diagram text and command messages (ja or en). Defaults to
|
|
13607
|
+
" --lang <lang> Language of the diagram text and command messages (ja or en). Defaults to en",
|
|
13607
13608
|
" --fps <n> Frames per second of the mp4 (default 30)",
|
|
13608
13609
|
" --gif-fps <n> Frames per second of the GIF (default 10)",
|
|
13609
13610
|
" --format <list> Formats to write, separated by , (default mp4,gif,html,png)"
|
|
@@ -13679,7 +13680,7 @@ function read(file, text2, lang) {
|
|
|
13679
13680
|
async function main(argv) {
|
|
13680
13681
|
const [command, ...rest] = argv;
|
|
13681
13682
|
const chosen = langOf(argv);
|
|
13682
|
-
const early = CLI_TEXT[isLang(chosen) ? chosen :
|
|
13683
|
+
const early = CLI_TEXT[isLang(chosen) ? chosen : DEFAULT_LANG];
|
|
13683
13684
|
if (command !== "export") {
|
|
13684
13685
|
console.error(early.usage);
|
|
13685
13686
|
return 2;
|
|
@@ -13711,7 +13712,7 @@ ${early.usage}`);
|
|
|
13711
13712
|
const fps = number(values.fps);
|
|
13712
13713
|
const gifFps = number(values["gif-fps"]);
|
|
13713
13714
|
const lang = isLang(chosen) ? chosen : void 0;
|
|
13714
|
-
const diagram = read(file, early, lang ??
|
|
13715
|
+
const diagram = read(file, early, lang ?? DEFAULT_LANG);
|
|
13715
13716
|
let result;
|
|
13716
13717
|
try {
|
|
13717
13718
|
result = await exportDiagram(diagram, {
|
|
@@ -13727,11 +13728,11 @@ ${early.usage}`);
|
|
|
13727
13728
|
});
|
|
13728
13729
|
} catch (error) {
|
|
13729
13730
|
const path2 = failedPath(error);
|
|
13730
|
-
if (path2 !== void 0) throw new Error(CLI_TEXT[lang ??
|
|
13731
|
+
if (path2 !== void 0) throw new Error(CLI_TEXT[lang ?? DEFAULT_LANG].cannotWrite(path2, detail(error)));
|
|
13731
13732
|
throw error instanceof Error ? error : new Error(String(error));
|
|
13732
13733
|
}
|
|
13733
13734
|
for (const path2 of Object.values(result.files)) console.log(path2);
|
|
13734
|
-
const said = lang ??
|
|
13735
|
+
const said = lang ?? DEFAULT_LANG;
|
|
13735
13736
|
for (const overlap of result.overlaps) console.error(CLI_TEXT[said].overlap(overlap.step + 1, describeOverlap(overlap, said)));
|
|
13736
13737
|
return 0;
|
|
13737
13738
|
}
|