@cardenelabs/dragon 0.36.2 → 0.36.4

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 CHANGED
@@ -25,6 +25,30 @@ npm install @cardenelabs/dragon
25
25
  | 描く部品 | 原本から時系列図と構成図を描き、段ごとに動かす部品。cdl には頼らない |
26
26
  | 書き出し | 同じ原本から mp4、GIF、HTML、PNG を書き出す命令 |
27
27
 
28
+ ## 頁に置く
29
+
30
+ 頁で 1 度だけ字の入口 `@cardenelabs/dragon/fonts` を import し、記法を読んだ原本を `mountDiagram` に渡す。
31
+
32
+ ```ts
33
+ import "@cardenelabs/dragon/fonts";
34
+ import { mountDiagram, parseNotation } from "@cardenelabs/dragon";
35
+
36
+ const source = await (await fetch("login.dragon")).text();
37
+ const parsed = parseNotation(source);
38
+ if (!parsed.ok) throw new Error(parsed.errors.map((e) => `${e.line}: ${e.message}`).join("\n"));
39
+
40
+ const host = document.getElementById("figure");
41
+ if (host === null) throw new Error("図を置く要素が無い");
42
+ const player = mountDiagram(host, parsed.diagram);
43
+ ```
44
+
45
+ 字の入口は、同梱の 2 つの字 (Noto Sans JP と JetBrains Mono) の CSS を読み込むだけで、何も出さない。
46
+ 図は同梱の字で測った字の幅で組むため、読み込まないと端末の字で描かれ、札から字がはみ出すことがある。
47
+ CSS と字の file は、束ねる道具 (Vite など) が頁へ運ぶ。
48
+
49
+ `mountDiagram` が返す `player` で段を動かす (`next`、`prev`、`play`、`pause`、`destroy`)。
50
+ 3 つめの引数には色味や段が替わった時に呼ぶ関数などの設定 (`PlayerOptions`) を渡す。
51
+
28
52
  ## dragon記法
29
53
 
30
54
  どの行も次の決まり 4 つに従う。
package/dist/index.d.cts CHANGED
@@ -272,4 +272,4 @@ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWi
272
272
  textPx: number;
273
273
  };
274
274
 
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 PlayerOptions, type Read, type RenderOptions, type Rendered, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
275
+ export { type CarrierTime, Carry, CheckOptions, ColorKey, Diagram, type EdgeTime, type EventTime, FONTS, FORMAT_VERSION, type Family, type Fence, FieldError, type LabelTime, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PlayerOptions, type Point, type Read, type Rect, type RenderOptions, type Rendered, type SceneAction, type SceneBadge, type SceneBox, type SceneEdge, type SceneField, type SceneLabel, type SceneLifeline, type SceneRegion, type SceneStrip, type Span, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
package/dist/index.d.ts CHANGED
@@ -272,4 +272,4 @@ declare function chooseView(rendered: Pick<Rendered, "layout" | "view">, frameWi
272
272
  textPx: number;
273
273
  };
274
274
 
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 PlayerOptions, type Read, type RenderOptions, type Rendered, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
275
+ export { type CarrierTime, Carry, CheckOptions, ColorKey, Diagram, type EdgeTime, type EventTime, FONTS, FORMAT_VERSION, type Family, type Fence, FieldError, type LabelTime, type Layout, type LineError, type Migrated, NotationLang, type ParseOptions, type Parsed, type Player, type PlayerOptions, type Point, type Read, type Rect, type RenderOptions, type Rendered, type SceneAction, type SceneBadge, type SceneBox, type SceneEdge, type SceneField, type SceneLabel, type SceneLifeline, type SceneRegion, type SceneStrip, type Span, Theme, type Timeline, ViewMode, chooseView, extractDiagrams, migrateFile, mountDiagram, parseNotation, printNotation, readDiagram, renderDiagram };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cardenelabs/dragon",
3
- "version": "0.36.2",
3
+ "version": "0.36.4",
4
4
  "description": "Dragon — 動く図を、人は行ごとの記法で、AI は JSON で書く。時系列図と構成図を段ごとに動かし、mp4・GIF・HTML・PNG に書き出す。",
5
5
  "license": "MIT",
6
6
  "author": "cardene777",
package/src/index.ts CHANGED
@@ -25,10 +25,23 @@ export {
25
25
  type ViewMode,
26
26
  } from "./schema";
27
27
  export { FORMAT_VERSION, type Migrated, migrateFile, type Read, readDiagram } from "./version";
28
- export type { Layout } from "./layout/scene";
29
- export { FONTS } from "./look/fonts";
30
- export { DEFAULT_PALETTE, type Palette, PALETTES, READABLE_PX, resolvePalette, type Theme } from "./look/values";
28
+ export type {
29
+ Layout,
30
+ Point,
31
+ Rect,
32
+ SceneAction,
33
+ SceneBadge,
34
+ SceneBox,
35
+ SceneEdge,
36
+ SceneField,
37
+ SceneLabel,
38
+ SceneLifeline,
39
+ SceneRegion,
40
+ SceneStrip,
41
+ } from "./layout/scene";
42
+ export { type Family, FONTS } from "./look/fonts";
43
+ export { type ColorKey, DEFAULT_PALETTE, type Palette, PALETTES, READABLE_PX, resolvePalette, type Theme } from "./look/values";
31
44
  export { mountDiagram, type Player, type PlayerOptions } from "./player";
32
45
  export { type Rendered, type RenderOptions, renderDiagram } from "./render/svg";
33
- export type { Timeline } from "./timeline";
46
+ export type { CarrierTime, EdgeTime, EventTime, LabelTime, Span, Timeline } from "./timeline";
34
47
  export { chooseView } from "./view";