type Theme = "light" | "dark"; interface Palette { id: string; name: string; note: string; light: Record; dark: Record; } /** 色味を指定しない時と、知らない名前を渡した時に使う色味。 */ declare const DEFAULT_PALETTE = "paper"; declare const PALETTES: Readonly>; /** 名前から色味を引く。指定が無いか、知らない名前 (外した墨と朱の `ink` を含む) なら紙と墨。 */ declare function resolvePalette(id?: string): Palette; /** 区画や箱を分ける色の役。灰 (slate) と硬貨 (coin) は分類の色として順に配らない。 */ declare const COLOR_ORDER: readonly ["blue", "amber", "green", "violet", "rose"]; type ColorKey = (typeof COLOR_ORDER)[number] | "slate" | "coin"; /** 見せ方を決める字の大きさ。全体を枠に収めた時の箱の名前がこれを下回ると寄って追う。 */ declare const READABLE_PX = 10.5; /** * dragon記法の語 (#3137)。 * * 行の種類は行の頭の英語の語で決まり、属性は `[<鍵>: <値>]` で書く。 * 語は英語だけで、原本の JSON が使う名前に揃え、記法と JSON で覚える語を 1 組にする。 * * 言葉の型 (`NotationLang`) は、誤りの文と図の中の字の言葉を選ぶために持つ。 * 語が英語だけなので、記法の file から言葉は決めず、呼ぶ側が渡す。 * * 型が欠けを止める。原本の JSON の値 (図の種類、運ぶ物、見せ方、名前の側) に語が無い時は、型の検査が落ちる。 */ type NotationLang = "ja" | "en"; type Color = "blue" | "amber" | "green" | "violet" | "rose" | "slate" | "coin"; interface Region { id: string; name: string; note?: string; color?: Color; icon?: string; } interface Box { id: string; name: string; sub?: string; color?: Color; icon?: string; region?: string; } type Carry = { kind: "envelope"; } | { kind: "tag"; text: string; } | { kind: "coin"; } | { kind: "none"; }; type LabelSide = "above" | "below" | "left" | "right"; /** 見せ方。`fixed` は全体を止めて中だけ動かし、`follow` は寄って動かし全体図で今どこかを示す。 */ type ViewMode = "fixed" | "follow"; type DiagramEvent = { type: "edge"; from: string; to: string; label?: string; carry: Carry; labelSide?: LabelSide; } | { type: "action"; box: string; label: string; } | { type: "swap"; box: string; text: string; } | { type: "strip"; field: string; value?: string; tag?: string; }; /** 状態遷移図の、最初の段より前に書いた移れる道。`from` に `start`、`to` に `finish` を書ける */ interface StatePath { from: string; to: string; label?: string; } interface Step { title: string; body: string; code?: string; events: DiagramEvent[]; } interface Diagram { version: number; kind: "sequence" | "architecture" | "state"; title: string; view?: ViewMode; regions?: Region[]; boxes: Box[]; strip?: { title: string; fields: string[]; }; steps: Step[]; sequence?: { lifelines: string[]; }; state?: { paths: StatePath[]; }; } interface FieldError { /** 誤った欄の場所 (JSON Pointer) */ pointer: string; message: string; } type Checked = { ok: true; } | { ok: false; errors: FieldError[]; }; interface CheckOptions { /** 誤りの文の言葉。渡さなければ日本語 */ lang?: NotationLang; } /** 原本の JSON を検査する。版が道具より新しいかは見ない (`readDiagram` が見る)。 */ declare function validateDiagram(input: unknown, options?: CheckOptions): Checked; export { type Box as B, type CheckOptions as C, type Diagram as D, type FieldError as F, type LabelSide as L, type NotationLang as N, PALETTES as P, READABLE_PX as R, type StatePath as S, type Theme as T, type ViewMode as V, type ColorKey as a, type Carry as b, type Checked as c, type Color as d, DEFAULT_PALETTE as e, type DiagramEvent as f, type Palette as g, type Region as h, type Step as i, resolvePalette as r, validateDiagram as v };