@cardenelabs/dragon 0.42.1 → 0.43.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.md +34 -1
- package/dist/cli.cjs +1732 -501
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1732 -501
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +1635 -496
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +1635 -496
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +1651 -417
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -3
- package/dist/index.d.ts +66 -3
- package/dist/index.js +1651 -417
- package/dist/index.js.map +1 -1
- package/dist/{ink-B8EZL7JV.d.cts → ink-B6s_SMXG.d.cts} +23 -3
- package/dist/{ink-B8EZL7JV.d.ts → ink-B6s_SMXG.d.ts} +23 -3
- package/dist/node.cjs +1102 -475
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1102 -475
- package/dist/node.js.map +1 -1
- package/dist/player.global.js +3 -2
- package/package.json +1 -1
- package/src/export/fonts.ts +13 -6
- package/src/index.ts +4 -1
- package/src/layout/tree.ts +458 -0
- package/src/look/values.ts +42 -0
- package/src/messages.ts +34 -2
- package/src/parser.ts +89 -1
- package/src/printer.ts +6 -1
- package/src/render/icons.ts +2 -0
- package/src/render/svg.ts +41 -3
- package/src/render/tree.ts +164 -0
- package/src/schema.ts +27 -3
- package/src/schemas/diagram.schema.json +79 -14
- package/src/schemas/validate-diagram.js +1 -1
- package/src/timeline.ts +2 -2
- package/src/words.ts +12 -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 Colors, T as Theme, V as ViewMode, O as Overlap } from './ink-
|
|
2
|
-
export { B as Box,
|
|
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';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Markdown の中の dragon の囲み (```dragon) を、囲みごとに取り出す。
|
|
@@ -48,6 +48,7 @@ declare function parseNotation(notation: string, options?: ParseOptions): Parsed
|
|
|
48
48
|
* 枝分かれの図 (#3164) は、枝の `branch` の行を箱より前に書き、札を動かす線の運ぶ物が送る側の名前の札なら書かない。
|
|
49
49
|
* 時間軸の図 (#3165) は、目盛りと区切りと印の列と節目と拡大の範囲の行を箱より前に書き、物差しの欄の後ろに `[meter: <割合>]` を書く。
|
|
50
50
|
* 時間軸の図の `note` は属性を持てるので、`[` を含む字を `"` で囲む。
|
|
51
|
+
* 木の図 (#3233) の葉と親は、段の中に `leaf` と `node … of …` の行で書く。
|
|
51
52
|
* 段の出典 (#3199) は `say` と `code` の後ろ、段の中で起きることより前に、JSON の並びのまま 1 つずつ `source` の行に書く。
|
|
52
53
|
*/
|
|
53
54
|
|
|
@@ -188,6 +189,67 @@ interface TimeLayout extends Layout {
|
|
|
188
189
|
};
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
/**
|
|
193
|
+
* 木の図の置き場所 (#3233)。見た目の元は step 2 で本人が選んだ「根を上」の試作 (`.context/propose/merkle-look/`)。
|
|
194
|
+
*
|
|
195
|
+
* 葉 (`leaf`) と親 (`node`) の出来事を書いた順に辿り、親を持たない最後の箱を根にする。根を上に置き、根からの深さごとに段を下げて並べる。
|
|
196
|
+
* 子を持たない箱 (葉) は書いた順に左から同じ間で並べ、親は最初の子と最後の子の真ん中の上に置く。
|
|
197
|
+
* 子から親への木の線は、子の上端から縦に出て、子の段と親の段の間の高さで横に渡り、親の下端へ縦に入る。
|
|
198
|
+
* 値を持つ葉は箱に値だけを出し、名札を葉の下の札に出す。値を持つ親は値を大きく、名札を小さく出す。値を持たない箱は名札だけを出す。
|
|
199
|
+
* 根の箱は左に枝の絵柄を持ち、ほかの木の箱より大きい。
|
|
200
|
+
*
|
|
201
|
+
* 木でない箱 (`box`) は木の右に、根の上端の高さから縦に並べる。中身の帯は図の下に置く。
|
|
202
|
+
* 親子の箱どうしの線は木の線の上を走り、ほかの線は箱の向き合う辺どうしを結ぶ。
|
|
203
|
+
* 段の番号は、箱が現れる段では最初に現れた箱の左に、線を引く段では最初の線の上に置く。
|
|
204
|
+
*
|
|
205
|
+
* 原本の JSON が書く前の名札を子に持つ時や、もう親を持つ箱を子にする時は、その子を除いて描く。箱と同じ名札の木の箱は描かない。
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/** 木の箱。`lines` は箱の中の字を上から並べた行で、`baselines` と `styles` は行ごとの基準線の高さと字の形 */
|
|
209
|
+
interface TreePlaced extends Rect {
|
|
210
|
+
id: string;
|
|
211
|
+
kind: "leaf" | "node";
|
|
212
|
+
/** 根からの深さ。根が 0 */
|
|
213
|
+
depth: number;
|
|
214
|
+
parent?: string;
|
|
215
|
+
children: string[];
|
|
216
|
+
/** 箱を書いた段と、段の中の出来事の番号 */
|
|
217
|
+
step: number;
|
|
218
|
+
event: number;
|
|
219
|
+
hash?: string;
|
|
220
|
+
root: boolean;
|
|
221
|
+
cx: number;
|
|
222
|
+
cy: number;
|
|
223
|
+
color: ColorKey;
|
|
224
|
+
lines: string[];
|
|
225
|
+
baselines: number[];
|
|
226
|
+
styles: TextStyle[];
|
|
227
|
+
/** 値を持つ葉の下に置く、名札の札 */
|
|
228
|
+
card?: Rect & {
|
|
229
|
+
text: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/** 子 (`from`) から親 (`to`) への木の線。親を書いた段と出来事で現れる */
|
|
233
|
+
interface TreeLink {
|
|
234
|
+
from: string;
|
|
235
|
+
to: string;
|
|
236
|
+
step: number;
|
|
237
|
+
event: number;
|
|
238
|
+
points: Point[];
|
|
239
|
+
}
|
|
240
|
+
/** 木の線の上を走る線。`link` は走る木の線の子の名札 */
|
|
241
|
+
interface TreeRun {
|
|
242
|
+
step: number;
|
|
243
|
+
event: number;
|
|
244
|
+
link: string;
|
|
245
|
+
}
|
|
246
|
+
interface TreeLayout extends Layout {
|
|
247
|
+
kind: "tree";
|
|
248
|
+
nodes: TreePlaced[];
|
|
249
|
+
links: TreeLink[];
|
|
250
|
+
runs: TreeRun[];
|
|
251
|
+
}
|
|
252
|
+
|
|
191
253
|
/** 秒で表した、見えている間。`end` の時刻は含まない。 */
|
|
192
254
|
interface Span {
|
|
193
255
|
start: number;
|
|
@@ -334,6 +396,7 @@ declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: Pla
|
|
|
334
396
|
* `undo` (戻る矢印) と `yen` (円の印) は、注文の試作 (`docs/design/base/scenes/order.js`) が返品と返金に足した形 (#3171)。
|
|
335
397
|
* package の入口からも出し、見本帳の部品「絵」の頁がこの表から使える絵柄の一覧を作る。1 つずつの絵は `iconSvg` が描く (#3172)。
|
|
336
398
|
* `flag` (旗) は、時間軸の図の節目の丸に描く形 (#3165)。ブロックの確定の試作 (`docs/design/base/scenes/finality.js`) が持っていた。
|
|
399
|
+
* `tree` (親子に分かれる木) は、木の図の根の箱に描く形 (#3233)。step 2 で本人が選んだ試作が持っていた。
|
|
337
400
|
*/
|
|
338
401
|
declare const ICONS: Readonly<Record<string, string>>;
|
|
339
402
|
|
|
@@ -348,4 +411,4 @@ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWi
|
|
|
348
411
|
textPx: number;
|
|
349
412
|
};
|
|
350
413
|
|
|
351
|
-
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, 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, ViewMode, chooseView, extractDiagrams, iconSvg, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
|
|
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 };
|
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 Colors, T as Theme, V as ViewMode, O as Overlap } from './ink-
|
|
2
|
-
export { B as Box,
|
|
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';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Markdown の中の dragon の囲み (```dragon) を、囲みごとに取り出す。
|
|
@@ -48,6 +48,7 @@ declare function parseNotation(notation: string, options?: ParseOptions): Parsed
|
|
|
48
48
|
* 枝分かれの図 (#3164) は、枝の `branch` の行を箱より前に書き、札を動かす線の運ぶ物が送る側の名前の札なら書かない。
|
|
49
49
|
* 時間軸の図 (#3165) は、目盛りと区切りと印の列と節目と拡大の範囲の行を箱より前に書き、物差しの欄の後ろに `[meter: <割合>]` を書く。
|
|
50
50
|
* 時間軸の図の `note` は属性を持てるので、`[` を含む字を `"` で囲む。
|
|
51
|
+
* 木の図 (#3233) の葉と親は、段の中に `leaf` と `node … of …` の行で書く。
|
|
51
52
|
* 段の出典 (#3199) は `say` と `code` の後ろ、段の中で起きることより前に、JSON の並びのまま 1 つずつ `source` の行に書く。
|
|
52
53
|
*/
|
|
53
54
|
|
|
@@ -188,6 +189,67 @@ interface TimeLayout extends Layout {
|
|
|
188
189
|
};
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
/**
|
|
193
|
+
* 木の図の置き場所 (#3233)。見た目の元は step 2 で本人が選んだ「根を上」の試作 (`.context/propose/merkle-look/`)。
|
|
194
|
+
*
|
|
195
|
+
* 葉 (`leaf`) と親 (`node`) の出来事を書いた順に辿り、親を持たない最後の箱を根にする。根を上に置き、根からの深さごとに段を下げて並べる。
|
|
196
|
+
* 子を持たない箱 (葉) は書いた順に左から同じ間で並べ、親は最初の子と最後の子の真ん中の上に置く。
|
|
197
|
+
* 子から親への木の線は、子の上端から縦に出て、子の段と親の段の間の高さで横に渡り、親の下端へ縦に入る。
|
|
198
|
+
* 値を持つ葉は箱に値だけを出し、名札を葉の下の札に出す。値を持つ親は値を大きく、名札を小さく出す。値を持たない箱は名札だけを出す。
|
|
199
|
+
* 根の箱は左に枝の絵柄を持ち、ほかの木の箱より大きい。
|
|
200
|
+
*
|
|
201
|
+
* 木でない箱 (`box`) は木の右に、根の上端の高さから縦に並べる。中身の帯は図の下に置く。
|
|
202
|
+
* 親子の箱どうしの線は木の線の上を走り、ほかの線は箱の向き合う辺どうしを結ぶ。
|
|
203
|
+
* 段の番号は、箱が現れる段では最初に現れた箱の左に、線を引く段では最初の線の上に置く。
|
|
204
|
+
*
|
|
205
|
+
* 原本の JSON が書く前の名札を子に持つ時や、もう親を持つ箱を子にする時は、その子を除いて描く。箱と同じ名札の木の箱は描かない。
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/** 木の箱。`lines` は箱の中の字を上から並べた行で、`baselines` と `styles` は行ごとの基準線の高さと字の形 */
|
|
209
|
+
interface TreePlaced extends Rect {
|
|
210
|
+
id: string;
|
|
211
|
+
kind: "leaf" | "node";
|
|
212
|
+
/** 根からの深さ。根が 0 */
|
|
213
|
+
depth: number;
|
|
214
|
+
parent?: string;
|
|
215
|
+
children: string[];
|
|
216
|
+
/** 箱を書いた段と、段の中の出来事の番号 */
|
|
217
|
+
step: number;
|
|
218
|
+
event: number;
|
|
219
|
+
hash?: string;
|
|
220
|
+
root: boolean;
|
|
221
|
+
cx: number;
|
|
222
|
+
cy: number;
|
|
223
|
+
color: ColorKey;
|
|
224
|
+
lines: string[];
|
|
225
|
+
baselines: number[];
|
|
226
|
+
styles: TextStyle[];
|
|
227
|
+
/** 値を持つ葉の下に置く、名札の札 */
|
|
228
|
+
card?: Rect & {
|
|
229
|
+
text: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/** 子 (`from`) から親 (`to`) への木の線。親を書いた段と出来事で現れる */
|
|
233
|
+
interface TreeLink {
|
|
234
|
+
from: string;
|
|
235
|
+
to: string;
|
|
236
|
+
step: number;
|
|
237
|
+
event: number;
|
|
238
|
+
points: Point[];
|
|
239
|
+
}
|
|
240
|
+
/** 木の線の上を走る線。`link` は走る木の線の子の名札 */
|
|
241
|
+
interface TreeRun {
|
|
242
|
+
step: number;
|
|
243
|
+
event: number;
|
|
244
|
+
link: string;
|
|
245
|
+
}
|
|
246
|
+
interface TreeLayout extends Layout {
|
|
247
|
+
kind: "tree";
|
|
248
|
+
nodes: TreePlaced[];
|
|
249
|
+
links: TreeLink[];
|
|
250
|
+
runs: TreeRun[];
|
|
251
|
+
}
|
|
252
|
+
|
|
191
253
|
/** 秒で表した、見えている間。`end` の時刻は含まない。 */
|
|
192
254
|
interface Span {
|
|
193
255
|
start: number;
|
|
@@ -334,6 +396,7 @@ declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: Pla
|
|
|
334
396
|
* `undo` (戻る矢印) と `yen` (円の印) は、注文の試作 (`docs/design/base/scenes/order.js`) が返品と返金に足した形 (#3171)。
|
|
335
397
|
* package の入口からも出し、見本帳の部品「絵」の頁がこの表から使える絵柄の一覧を作る。1 つずつの絵は `iconSvg` が描く (#3172)。
|
|
336
398
|
* `flag` (旗) は、時間軸の図の節目の丸に描く形 (#3165)。ブロックの確定の試作 (`docs/design/base/scenes/finality.js`) が持っていた。
|
|
399
|
+
* `tree` (親子に分かれる木) は、木の図の根の箱に描く形 (#3233)。step 2 で本人が選んだ試作が持っていた。
|
|
337
400
|
*/
|
|
338
401
|
declare const ICONS: Readonly<Record<string, string>>;
|
|
339
402
|
|
|
@@ -348,4 +411,4 @@ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWi
|
|
|
348
411
|
textPx: number;
|
|
349
412
|
};
|
|
350
413
|
|
|
351
|
-
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, 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, ViewMode, chooseView, extractDiagrams, iconSvg, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
|
|
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 };
|