@cardenelabs/dragon 0.35.1 → 0.36.1

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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-BBWfniwH.cjs';
2
- export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as Region, S as Step, n as notationLanguage, r as resolvePalette, v as validateDiagram } from './schema-BBWfniwH.cjs';
1
+ import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-9VLameDG.cjs';
2
+ export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as READABLE_PX, h as Region, S as Step, r as resolvePalette, v as validateDiagram } from './schema-9VLameDG.cjs';
3
3
 
4
4
  /**
5
5
  * 図が使う 2 つの字。どちらも package の依存として同梱する。
@@ -41,28 +41,25 @@ type Parsed = {
41
41
  errors: LineError[];
42
42
  };
43
43
  interface ParseOptions {
44
- /** 最初の行が読めず file の言葉が決まらない時に、誤りの文に使う言葉。既定は日本語 */
44
+ /** 誤りの文の言葉。既定は日本語 */
45
45
  lang?: NotationLang;
46
46
  }
47
47
  declare function parseNotation(notation: string, options?: ParseOptions): Parsed;
48
48
 
49
49
  /**
50
- * 図の原本の JSON を、人が書く記法へ書き戻す。
50
+ * 図の原本の JSON を、人が書く dragon記法へ書き戻す (#3137)。
51
51
  *
52
52
  * 並べ方は決まった形に整える。JSON の欄の並び順は見ず、欄の名前で読むので、
53
53
  * 同じ内容の JSON からは毎回同じ文字列になる。書き手の行の並べ方とコメントは保たない。
54
54
  * 段の中で起きることは JSON の並び順 (起きる順) のまま書く。
55
55
  *
56
- * 語は渡した言葉で書く (#2997)。渡さなければ日本語で書く。
57
- * 英語では添え書きと下の字と書き換えの字を `"…"` で囲み、名前か字に `"` を含む物だけ「」で囲む。
58
- * 英語の語の file でも「」は読めるので、読み直すと同じ JSON に戻る。
56
+ * `"` で囲むのは要る時だけにする。`[` を含む名前と、`,` か `]` を含む属性の値と、`"` で始まる字を囲む。
57
+ * 箱は JSON の並びのまま書き、同じ区画の箱が続く所を 1 つの `group … end` にする。
58
+ * 区画の箱が飛び飛びの時は同じ `group` を開き直す。区画の並びが箱の現れる順と違う時と、
59
+ * 箱の無い区画がある時は、先に全ての区画を中の無い `group … end` で宣言してから開き直す。
59
60
  */
60
61
 
61
- interface PrintOptions {
62
- /** 記法の語の言葉。既定は日本語 */
63
- lang?: NotationLang;
64
- }
65
- declare function printNotation(diagram: Diagram, options?: PrintOptions): string;
62
+ declare function printNotation(diagram: Diagram): string;
66
63
 
67
64
  /** この道具が読める原本の版 */
68
65
  declare const FORMAT_VERSION = 1;
@@ -248,6 +245,15 @@ interface Rendered {
248
245
  /** 原本の JSON から図を描く。原本が形に合わない時は、誤りの場所を添えて断る。 */
249
246
  declare function renderDiagram(input: unknown, options?: RenderOptions): Rendered;
250
247
 
248
+ interface PlayerOptions extends RenderOptions {
249
+ /** 段が替わるたびに今の段 (0 から) を受け取る。置いた時にも最初の段で 1 度呼ぶ。頁の側で段の札や進み具合を出す時に使う (#3031) */
250
+ onStep?: (step: number) => void;
251
+ /**
252
+ * 図を、図の枠の中で見える高さに収める (#3047)。高さに収めると字が読めない図は寄って追う図にし、寄って追う窓と全体図をその高さに収める。
253
+ * 枠の高さが決まっている置き場 (カタログの拡大の重ね窓) で使う。枠の高さが図に合わせて伸びる置き場で使うと、描くたびに低くなる
254
+ */
255
+ fitHeight?: boolean;
256
+ }
251
257
  interface Player {
252
258
  /** 今の段 (0 から) */
253
259
  readonly step: number;
@@ -259,11 +265,11 @@ interface Player {
259
265
  pause(): void;
260
266
  destroy(): void;
261
267
  }
262
- declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: RenderOptions): Player;
268
+ declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: PlayerOptions): Player;
263
269
 
264
- declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWidth: number): {
270
+ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWidth: number, frameHeight?: number): {
265
271
  mode: ViewMode;
266
272
  textPx: number;
267
273
  };
268
274
 
269
- export { Carry, CheckOptions, Diagram, FONTS, FORMAT_VERSION, type Fence, FieldError, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PrintOptions, type Read, type RenderOptions, type Rendered, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
275
+ export { Carry, CheckOptions, Diagram, FONTS, FORMAT_VERSION, type Fence, FieldError, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type Read, type RenderOptions, type Rendered, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, 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, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-BBWfniwH.js';
2
- export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as Region, S as Step, n as notationLanguage, r as resolvePalette, v as validateDiagram } from './schema-BBWfniwH.js';
1
+ import { N as NotationLang, D as Diagram, F as FieldError, C as CheckOptions, a as ColorKey, b as Carry, T as Theme, V as ViewMode } from './schema-9VLameDG.js';
2
+ export { B as Box, c as Checked, d as Color, e as DEFAULT_PALETTE, f as DiagramEvent, L as LabelSide, P as PALETTES, g as Palette, R as READABLE_PX, h as Region, S as Step, r as resolvePalette, v as validateDiagram } from './schema-9VLameDG.js';
3
3
 
4
4
  /**
5
5
  * 図が使う 2 つの字。どちらも package の依存として同梱する。
@@ -41,28 +41,25 @@ type Parsed = {
41
41
  errors: LineError[];
42
42
  };
43
43
  interface ParseOptions {
44
- /** 最初の行が読めず file の言葉が決まらない時に、誤りの文に使う言葉。既定は日本語 */
44
+ /** 誤りの文の言葉。既定は日本語 */
45
45
  lang?: NotationLang;
46
46
  }
47
47
  declare function parseNotation(notation: string, options?: ParseOptions): Parsed;
48
48
 
49
49
  /**
50
- * 図の原本の JSON を、人が書く記法へ書き戻す。
50
+ * 図の原本の JSON を、人が書く dragon記法へ書き戻す (#3137)。
51
51
  *
52
52
  * 並べ方は決まった形に整える。JSON の欄の並び順は見ず、欄の名前で読むので、
53
53
  * 同じ内容の JSON からは毎回同じ文字列になる。書き手の行の並べ方とコメントは保たない。
54
54
  * 段の中で起きることは JSON の並び順 (起きる順) のまま書く。
55
55
  *
56
- * 語は渡した言葉で書く (#2997)。渡さなければ日本語で書く。
57
- * 英語では添え書きと下の字と書き換えの字を `"…"` で囲み、名前か字に `"` を含む物だけ「」で囲む。
58
- * 英語の語の file でも「」は読めるので、読み直すと同じ JSON に戻る。
56
+ * `"` で囲むのは要る時だけにする。`[` を含む名前と、`,` か `]` を含む属性の値と、`"` で始まる字を囲む。
57
+ * 箱は JSON の並びのまま書き、同じ区画の箱が続く所を 1 つの `group … end` にする。
58
+ * 区画の箱が飛び飛びの時は同じ `group` を開き直す。区画の並びが箱の現れる順と違う時と、
59
+ * 箱の無い区画がある時は、先に全ての区画を中の無い `group … end` で宣言してから開き直す。
59
60
  */
60
61
 
61
- interface PrintOptions {
62
- /** 記法の語の言葉。既定は日本語 */
63
- lang?: NotationLang;
64
- }
65
- declare function printNotation(diagram: Diagram, options?: PrintOptions): string;
62
+ declare function printNotation(diagram: Diagram): string;
66
63
 
67
64
  /** この道具が読める原本の版 */
68
65
  declare const FORMAT_VERSION = 1;
@@ -248,6 +245,15 @@ interface Rendered {
248
245
  /** 原本の JSON から図を描く。原本が形に合わない時は、誤りの場所を添えて断る。 */
249
246
  declare function renderDiagram(input: unknown, options?: RenderOptions): Rendered;
250
247
 
248
+ interface PlayerOptions extends RenderOptions {
249
+ /** 段が替わるたびに今の段 (0 から) を受け取る。置いた時にも最初の段で 1 度呼ぶ。頁の側で段の札や進み具合を出す時に使う (#3031) */
250
+ onStep?: (step: number) => void;
251
+ /**
252
+ * 図を、図の枠の中で見える高さに収める (#3047)。高さに収めると字が読めない図は寄って追う図にし、寄って追う窓と全体図をその高さに収める。
253
+ * 枠の高さが決まっている置き場 (カタログの拡大の重ね窓) で使う。枠の高さが図に合わせて伸びる置き場で使うと、描くたびに低くなる
254
+ */
255
+ fitHeight?: boolean;
256
+ }
251
257
  interface Player {
252
258
  /** 今の段 (0 から) */
253
259
  readonly step: number;
@@ -259,11 +265,11 @@ interface Player {
259
265
  pause(): void;
260
266
  destroy(): void;
261
267
  }
262
- declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: RenderOptions): Player;
268
+ declare function mountDiagram(host: HTMLElement, diagram: unknown, options?: PlayerOptions): Player;
263
269
 
264
- declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWidth: number): {
270
+ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWidth: number, frameHeight?: number): {
265
271
  mode: ViewMode;
266
272
  textPx: number;
267
273
  };
268
274
 
269
- export { Carry, CheckOptions, Diagram, FONTS, FORMAT_VERSION, type Fence, FieldError, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PrintOptions, type Read, type RenderOptions, type Rendered, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
275
+ export { Carry, CheckOptions, Diagram, FONTS, FORMAT_VERSION, type Fence, FieldError, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type Read, type RenderOptions, type Rendered, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };