yuhwa 1.0.2 → 1.2.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.
Files changed (51) hide show
  1. package/README.md +13 -12
  2. package/client.d.ts +9 -1
  3. package/dist/astro.d.ts +2 -2
  4. package/dist/astro.js +8 -1
  5. package/dist/browser.d.ts +11 -5
  6. package/dist/browser.js +27 -7
  7. package/dist/cli.js +612 -49
  8. package/dist/editor/assets/index-BphHLTvA.js +689 -0
  9. package/dist/editor/assets/lsp.worker-sZtzIA6-.js +30 -0
  10. package/dist/editor/index.html +5 -4
  11. package/dist/figure-CA2hy0xh.d.ts +48 -0
  12. package/dist/{index-Dl845tUQ.d.ts → index-CnnoZYl0.d.ts} +76 -7
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/dist/ironmark.d.ts +4 -2
  16. package/dist/ironmark.js +18 -7
  17. package/dist/llms.txt +26 -17
  18. package/dist/lsp-browser.d.ts +2 -2
  19. package/dist/lsp-browser.js +1 -1
  20. package/dist/lsp-node.js +208 -212
  21. package/dist/lsp-server.d.ts +1 -1
  22. package/dist/lsp-server.js +1 -1
  23. package/dist/lsp.d.ts +44 -2
  24. package/dist/lsp.js +1 -1
  25. package/dist/markdown-it.d.ts +2 -1
  26. package/dist/markdown-it.js +7 -6
  27. package/dist/node-Bzn2uKXZ.js +224 -0
  28. package/dist/remark.d.ts +2 -1
  29. package/dist/remark.js +16 -5
  30. package/dist/{server-DJC_fQMe.d.ts → server--jHjJjOS.d.ts} +2 -2
  31. package/dist/{server-DmQuHQrG.js → server-Dxo7OG8K.js} +19 -2
  32. package/dist/{service-BYS9Qfkq.js → service-B1fpOg_L.js} +348 -44
  33. package/dist/{service-ClZ8clSQ.d.ts → service-Brvpt7Do.d.ts} +3 -1
  34. package/dist/{shared-qo_r6RUN.js → shared-Ddw88O9D.js} +3069 -742
  35. package/dist/{src-wk7tBpWs.js → src-DkQj7aIV.js} +2842 -744
  36. package/dist/style.css +14 -0
  37. package/dist/vite.d.ts +1 -1
  38. package/dist/vite.js +19 -12
  39. package/dist/vuepress.d.ts +3 -1
  40. package/dist/vuepress.js +7 -2
  41. package/dist/yuhwa.iife.js +91 -75
  42. package/dist/zoom-CCSUbX1X.d.ts +49 -0
  43. package/dist/zoom-QeqB6QlH.js +275 -0
  44. package/dist/zoom-script-CVdAzMhX.js +51 -0
  45. package/dist/zoom.d.ts +35 -0
  46. package/dist/zoom.js +19 -0
  47. package/package.json +10 -2
  48. package/dist/editor/assets/index-BQLsumas.js +0 -587
  49. package/dist/editor/assets/lsp.worker-RlPj9blG.js +0 -26
  50. package/dist/figure-BZHIKnxv.d.ts +0 -27
  51. package/dist/node-Bneu5eJV.js +0 -108
@@ -9,7 +9,7 @@
9
9
  rel="icon"
10
10
  href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%232563eb'/%3E%3Cstop offset='1' stop-color='%239333ea'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='64' height='64' rx='15' fill='url%28%23g%29'/%3E%3Crect x='9' y='11' width='26' height='17' rx='5' fill='%23fff'/%3E%3Cpath d='M15 17.5h10M15 22h14' stroke='%237c3aed' stroke-opacity='.35' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M18 28v5a11 11 0 0 0 11 11h1' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='m29 38 6 6-6 6' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Crect x='38' y='36' width='17' height='16' rx='5' fill='%23fff' fill-opacity='.9'/%3E%3C/svg%3E"
11
11
  />
12
- <script type="module" crossorigin src="./assets/index-BQLsumas.js"></script>
12
+ <script type="module" crossorigin src="./assets/index-BphHLTvA.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="./assets/index-DaWl0OPj.css">
14
14
  </head>
15
15
  <body>
@@ -161,7 +161,7 @@
161
161
  <svg><use href="#i-reset" /></svg>
162
162
  </button>
163
163
  </div>
164
- <button id="import" title="Import a Mermaid flowchart, JSON or a .yuhwa file">
164
+ <button id="import" title="Import a Mermaid flowchart, JSON or a .yu file">
165
165
  <svg><use href="#i-import" /></svg><span class="wide">Import</span>
166
166
  </button>
167
167
  <div class="spacer"></div>
@@ -192,7 +192,7 @@
192
192
  <button
193
193
  id="add-file"
194
194
  class="icon ghost"
195
- title='New file (import it with import "./name.yuhwa")'
195
+ title='New file (import it with import "./name.yu")'
196
196
  aria-label="New file"
197
197
  >
198
198
  <svg><use href="#i-plus" /></svg>
@@ -224,7 +224,8 @@
224
224
  <div id="import-msg" role="status"></div>
225
225
  <div class="row">
226
226
  <label class="button"
227
- ><input id="import-file" type="file" accept=".mmd,.mermaid,.json,.yuhwa,.txt,.md" hidden />Open file…</label
227
+ ><input id="import-file" type="file" accept=".mmd,.mermaid,.json,.yu,.yuhwa,.txt,.md" hidden />Open
228
+ file…</label
228
229
  >
229
230
  <label class="check"><input id="import-new" type="checkbox" checked /> as a new file</label>
230
231
  <span class="spacer"></span>
@@ -0,0 +1,48 @@
1
+ import { n as Options } from "./index-CnnoZYl0.js";
2
+ interface YuhwaDocsOptions extends Omit<Options, "theme" | "file"> {
3
+ /** theme for light mode (default `paper`) */
4
+ theme?: string;
5
+ /**
6
+ * theme for dark mode (default `midnight`); `false` renders one image only.
7
+ * A block that sets `theme:` itself always renders one image.
8
+ */
9
+ darkTheme?: string | false;
10
+ /**
11
+ * How the dark image is picked:
12
+ * - `class` (default): two images; `yuhwa/style.css` shows the one
13
+ * matching the site's colour toggle (`.dark`, `[data-theme="dark"]` ...)
14
+ * - `media`: a `<picture>` that follows the OS setting; needs no CSS.
15
+ * Only with `output: 'img'`: inline SVGs fall back to `class`
16
+ */
17
+ darkMode?: "class" | "media";
18
+ /**
19
+ * `svg` inlines the SVG instead of an `<img>` (markdown-it only; keeps
20
+ * diagram text selectable and links clickable). Not for Vue-based sites.
21
+ */
22
+ output?: "img" | "svg";
23
+ /** throw on errors and fail the build (default `true`); `false` shows them under the diagram */
24
+ strict?: boolean;
25
+ /** fence languages handled (default `['yuhwa']`) */
26
+ languages?: string[];
27
+ /**
28
+ * Folder that `file="..."` blocks and imports must stay inside. A `file`
29
+ * path that starts with `/` resolves against it. Unset: any `.yu` file.
30
+ */
31
+ root?: string;
32
+ /**
33
+ * Pan and zoom every diagram in a small viewer: drag, Ctrl/⌘ + wheel,
34
+ * pinch, buttons and full screen (default `false`). A fence turns it on or
35
+ * off for one block with `zoom`, `zoom=480` or `no-zoom`.
36
+ * - `true`: marks the figures; load `yuhwa/zoom` once in the site's client
37
+ * code (Astro and VuePress do that for you)
38
+ * - `'inline'`: also adds the script inline, once per page; for plain HTML
39
+ * output, not for MDX or Vue-based sites
40
+ */
41
+ zoom?: boolean | "inline";
42
+ /**
43
+ * Height of the zoom viewer, a CSS length or a number of pixels. Unset: the
44
+ * diagram's own height. `zoom=480` on a fence sets it for one block.
45
+ */
46
+ zoomHeight?: string | number;
47
+ }
48
+ export { YuhwaDocsOptions as t };
@@ -125,6 +125,10 @@ interface Seg {
125
125
  kind: SegKind;
126
126
  text: string;
127
127
  color?: string;
128
+ /** set by a `{size: 18, weight: 700, italic | …}` span */
129
+ size?: number;
130
+ weight?: number;
131
+ italic?: boolean;
128
132
  /** measured width, set by segsW */
129
133
  w?: number;
130
134
  }
@@ -264,7 +268,21 @@ interface PanelCtx {
264
268
  * has its distance in `x`.
265
269
  */
266
270
  offsets: Record<string, Point>;
271
+ /**
272
+ * unique per diagram and panel: prefix ids the panel defines (`<pattern
273
+ * id>`, gradients) with it, so two diagrams on one page do not clash
274
+ */
275
+ idPrefix?: string;
267
276
  }
277
+ /** a header prop's values, or the kind of field that edits it */
278
+ type PanelOption = readonly string[] | "color" | "number" | "flag" | "text";
279
+ /** what `options[key]` asks for: a select of values, or one kind of field */
280
+ declare function optionKind(o: PanelOption): {
281
+ kind: "select";
282
+ values: readonly string[];
283
+ } | {
284
+ kind: Exclude<PanelOption, readonly string[]>;
285
+ };
268
286
  /**
269
287
  * A diagram type drawn as a panel next to (or instead of) the graph:
270
288
  *
@@ -295,10 +313,11 @@ interface PanelKind<P = any> {
295
313
  */
296
314
  handles?(data: P, box: Box, ctx: PanelCtx): PanelHandle[];
297
315
  /**
298
- * header props an editor offers, e.g. `{ direction: ['right', 'down'] }`:
299
- * a select of the values, or a text field for an empty list
316
+ * header props an editor offers: a list of values is a select
317
+ * (`{ direction: ['right', 'down'] }`), and `'color'`, `'number'`, `'text'`
318
+ * or `'flag'` (off unless written, a checkbox) picks the field
300
319
  */
301
- options?: Record<string, string[]>;
320
+ options?: Record<string, PanelOption>;
302
321
  /** the parts an editor lists with a colour picker */
303
322
  parts?(data: P): PanelPart[];
304
323
  /**
@@ -338,7 +357,7 @@ interface YuhwaPlugin {
338
357
  shapes?: ShapeKind[];
339
358
  /** edge end markers, usable as `[head: name]` / `[tail: name]` */
340
359
  markers?: MarkerKind[];
341
- /** change the parsed diagram (add nodes, derive classes, …); runs after every `parse` */
360
+ /** change the parsed diagram (add nodes, derive classes, …); runs once per `parse`, after imports are merged */
342
361
  transform?(d: Diagram): void;
343
362
  /** move or annotate laid out nodes and edges; runs at the end of `layout` */
344
363
  afterLayout?(L: Layout, d: Diagram): void;
@@ -355,6 +374,7 @@ interface YuhwaPlugin {
355
374
  /** allowed values for enum props (checked against the first word) */
356
375
  enums?: Record<string, string[]>;
357
376
  bools?: string[];
377
+ /** props that take a number of 0 or more */
358
378
  numbers?: string[];
359
379
  }
360
380
  interface Registry {
@@ -379,6 +399,12 @@ declare function recolor<P>(fn: (body: string[], id: string, tone: string | null
379
399
  declare const registry: Registry;
380
400
  /** Register plugins. Registering the same plugin name twice is a no-op. */
381
401
  declare function use(...plugins: YuhwaPlugin[]): void;
402
+ /**
403
+ * Unregister a plugin by name: every table is rebuilt from the state before
404
+ * the first `use` and the other plugins are registered again, in order.
405
+ * Returns false when no plugin has that name.
406
+ */
407
+ declare function unuse(name: string): boolean;
382
408
  /** a parsed body row; plugin rows carry their own fields */
383
409
  type Row = {
384
410
  kind: "text";
@@ -397,6 +423,8 @@ interface BodyMetrics {
397
423
  fs: number;
398
424
  lh: number;
399
425
  mono: boolean;
426
+ /** base font weight of text rows */
427
+ weight?: number;
400
428
  /** y offset and height per row */
401
429
  ys: number[];
402
430
  hs: number[];
@@ -414,6 +442,7 @@ interface CardBlock {
414
442
  icon?: string;
415
443
  meta?: string;
416
444
  caps: boolean;
445
+ italic: boolean;
417
446
  labelSize: number;
418
447
  labelLh: number;
419
448
  subSize: number;
@@ -456,12 +485,15 @@ interface TextBlock {
456
485
  iconSize: number;
457
486
  /** letter spacing for `caps` labels */
458
487
  letterSpacing: number;
488
+ /** `caps`: lines are upper-cased when drawn, so their markup survives */
489
+ caps: boolean;
459
490
  /** set for nodes drawn as cards (a body or `meta`) */
460
491
  card?: CardBlock;
461
492
  w: number;
462
493
  h: number;
463
494
  }
464
495
  declare function groupPath(d: Diagram, groupId: string | undefined): string[];
496
+ /** place nodes, route edges and size panels; a plugin that throws becomes a diagnostic on `d` */
465
497
  declare function layout(d: Diagram, opts?: LayoutOptions): Layout;
466
498
  /** Snap step for editors, in diagram units. The `grid: true` pattern is drawn every 2 steps. */
467
499
  declare const GRID = 12;
@@ -484,6 +516,8 @@ interface Diagnostic {
484
516
  line: number;
485
517
  message: string;
486
518
  severity: "error" | "warning";
519
+ /** stable id for a finding kind, e.g. `unused-class` from `yuhwa lint` */
520
+ code?: string;
487
521
  }
488
522
  /** Where a statement lives in the source, so tools can edit it in place. */
489
523
  interface SourceRef {
@@ -541,6 +575,8 @@ interface NodeDecl {
541
575
  bodyLines?: [number, number];
542
576
  ref?: SourceRef;
543
577
  labelRef?: LabelRef;
578
+ /** the 0-based line each `[prop]` was last written on, for messages: `ref` is only the latest declaration */
579
+ propAt?: Record<string, number>;
544
580
  }
545
581
  interface EdgeDecl {
546
582
  key: string;
@@ -597,6 +633,11 @@ interface Diagram {
597
633
  classes: Record<string, Props>;
598
634
  /** 0-based line where each class was (last) defined */
599
635
  classLines?: Record<string, number>;
636
+ /** 0-based line where each `$variable` and `def` component was (last) defined */
637
+ varLines?: Record<string, number>;
638
+ defLines?: Record<string, number>;
639
+ /** variables (`$x`) and components (`f`) this file uses, for `yuhwa lint` */
640
+ used?: Set<string>;
600
641
  layout: LayoutOverrides;
601
642
  /** 0-based inclusive line range of the `layout { ... }` block */
602
643
  layoutBlock?: [number, number];
@@ -730,6 +771,12 @@ interface LaidGroup extends Box {
730
771
  text: string;
731
772
  dash: string | null;
732
773
  };
774
+ /** the label's lines, when it wraps (or has `\n`) */
775
+ lines?: string[];
776
+ /** header height when it is taller than one line (default GROUP_HEADER) */
777
+ header?: number;
778
+ /** line height of `lines` */
779
+ lineHeight?: number;
733
780
  }
734
781
  interface LaidEdge {
735
782
  key: string;
@@ -757,6 +804,9 @@ interface LaidEdge {
757
804
  w: number;
758
805
  h: number;
759
806
  };
807
+ /** line height of the label text and of the caption */
808
+ lineHeight: number;
809
+ captionLineHeight: number;
760
810
  rotate: boolean;
761
811
  };
762
812
  heads: {
@@ -777,6 +827,11 @@ interface ResolvedNodeStyle {
777
827
  radius: number;
778
828
  fontSize: number;
779
829
  fontWeight: number;
830
+ /** card body: text colour, font size, weight and row height (× bodySize) */
831
+ body: string;
832
+ bodySize: number;
833
+ bodyWeight: number;
834
+ lineHeight: number;
780
835
  italic: boolean;
781
836
  shadow: boolean;
782
837
  opacity: number;
@@ -787,6 +842,10 @@ interface ResolvedEdgeStyle {
787
842
  dash: string | null;
788
843
  curve: Curve;
789
844
  text: string;
845
+ /** label font: `font-size`, `font-weight`, `italic` */
846
+ fontSize: number;
847
+ fontWeight: number;
848
+ italic: boolean;
790
849
  labelBg: string;
791
850
  flow: boolean;
792
851
  opacity: number;
@@ -841,7 +900,7 @@ interface ParseOptions {
841
900
  seen?: Set<string>;
842
901
  }
843
902
  /**
844
- * Imports only read `.yuhwa` files: a diagram must not pull other files
903
+ * Imports only read `.yu` (or the older `.yuhwa`) files: a diagram must not pull other files
845
904
  * (keys, configs) into its output or errors, whatever the resolver.
846
905
  */
847
906
  declare const isYuhwaPath: (path: string) => boolean;
@@ -894,6 +953,7 @@ interface RenderOptions {
894
953
  /** draw a dot every n units, from the origin: shows an editor's snap grid */
895
954
  snapGrid?: number;
896
955
  }
956
+ /** the SVG for a laid out diagram; a plugin that throws becomes a diagnostic on `d` */
897
957
  declare function renderSvg(d: Diagram, L: Layout, opts?: RenderOptions): string;
898
958
  type Scalar = string | number | boolean;
899
959
  type PropBag = Record<string, unknown>;
@@ -1002,6 +1062,11 @@ interface MdOptions {
1002
1062
  resolve?: (path: string) => string | undefined;
1003
1063
  /** path of the markdown file; imports in blocks resolve against its folder */
1004
1064
  file?: string;
1065
+ /**
1066
+ * Link each image to this URL, such as a page that pans and zooms the
1067
+ * diagram (`yuhwa md --view`). Gets the block's source.
1068
+ */
1069
+ view?: (source: string) => string;
1005
1070
  }
1006
1071
  interface MdResult {
1007
1072
  markdown: string;
@@ -1038,9 +1103,13 @@ declare const GROUP_PROPS: string[];
1038
1103
  declare const PANEL_PROPS: string[];
1039
1104
  /** allowed values for enum-like props */
1040
1105
  declare const ENUMS: Record<string, string[]>;
1106
+ /** props whose value must be a colour (or `none`/`transparent`), on nodes, edges, groups and panels */
1107
+ declare const COLORS: string[];
1041
1108
  declare const BOOLS: string[];
1042
1109
  declare const NUMBERS: string[];
1043
- declare function lint(d: Diagram): void;
1110
+ /** a panel kind's typed header props, looked up by kind name */
1111
+ type PanelOptions = (kind: string) => Record<string, PanelOption> | undefined;
1112
+ declare function lint(d: Diagram, panelOptions?: PanelOptions): void;
1044
1113
  declare const GUIDE: string;
1045
1114
  declare const themes: YuhwaPlugin;
1046
1115
  declare const charts: YuhwaPlugin;
@@ -1086,4 +1155,4 @@ declare function toSource(input: string | DiagramJSON): {
1086
1155
  };
1087
1156
  /** Parse, lay out and render a diagram to an SVG string. Never throws on bad input. */
1088
1157
  declare function render(input: string | DiagramJSON, opts?: Options): Result;
1089
- export { PANELS as $, PanelCtx as $t, MdBlock as A, isSafeLink as An, Layout as At, setProp as B, PartEdit as Bt, NODE_PROPS as C, THEME_NAMES as Cn, GroupDecl as Ct, ConvertResult as D, createTheme as Dn, LaidGroup as Dt, lint as E, ThemeInput as En, LaidEdge as Et, replaceBlockSource as F, approxMeasure as Fn, PanelHandle as Ft, lineStyle as G, ShapeName as Gt, writeLayout as H, Props as Ht, editPart as I, canvasMeasure as In, PanelOverride as It, JsonResult as J, GRID as Jt, SHAPES as K, Side as Kt, formatLayout as L, PanelPart as Lt, MdResult as M, ramp as Mn, NodeDecl as Mt, findBlocks as N, registerTheme as Nn, NodeOverride as Nt, fromMermaid as O, getTheme as On, LaidNode as Ot, processMarkdown as P, themeNames as Pn, PanelDecl as Pt, LexedLine as Q, FrameKind as Qt, setLabel as R, PartAction as Rt, GROUP_PROPS as S, THEME_KEYS as Sn, EdgeOverride as St, PANEL_PROPS as T, Theme as Tn, LabelRef as Tt, writePanelDrag as U, ResolvedEdgeStyle as Ut, setSetting as V, Point as Vt, dashFor as W, ResolvedNodeStyle as Wt, renderSvg as X, layout as Xt, fromJSON as Y, groupPath as Yt, KNOWN_SETTINGS as Z, Decoration as Zt, themes as _, segsW as _n, Curve as _t, render as a, YuhwaPlugin as an, isYuhwaPath as at, EDGE_PROPS as b, RAMPS as bn, Direction as bt, git as c, registry as cn, onlyColor as ct, sequence as d, ShapeKind as dn, serializeProps as dt, PanelKind as en, ParseOptions as et, legend as f, renderHead as fn, setLineProp as ft, charts as g, renderSegs as gn, Component as gt, tables as h, parseInline as hn, Box as ht, hash as i, StatementKind as in, blockBraces as it, MdOptions as j, isToneOrHex as jn, LayoutOverrides as jt, isMermaid as k, isSafeCss as kn, LaidPanel as kt, chart as l, use as ln, parse as lt, frames as m, Seg as mn, splitTrailingProps as mt, Options as n, RowKind as nn, Tok as nt, toSource as o, perPass as on, joinPath as ot, footer as p, InkColors as pn, setTrailingProp as pt, DiagramJSON as q, SourceRef as qt, Result as r, RowPaint as rn, TokKind as rt, builtins as s, recolor as sn, lex as st, InputFormat as t, RowCtx as tn, SETTING_VALUES as tt, timeline as u, MarkerKind as un, parseProps as ut, GUIDE as v, tspans as vn, Diagnostic as vt, NUMBERS as w, TONES as wn, HeadKind as wt, ENUMS as x, THEMES as xn, EdgeDecl as xt, BOOLS as y, LineStyle$1 as yn, Diagram as yt, setPartTone as z, PartChange as zt };
1158
+ export { LexedLine as $, FrameKind as $t, isMermaid as A, ThemeInput as An, LaidPanel as At, setPartTone as B, canvasMeasure as Bn, PartChange as Bt, GROUP_PROPS as C, LineStyle$1 as Cn, EdgeOverride as Ct, lint as D, THEME_NAMES as Dn, LaidEdge as Dt, PANEL_PROPS as E, THEME_KEYS as En, LabelRef as Et, processMarkdown as F, isToneOrHex as Fn, PanelDecl as Ft, dashFor as G, ResolvedNodeStyle as Gt, setSetting as H, Point as Ht, replaceBlockSource as I, ramp as In, PanelHandle as It, DiagramJSON as J, SourceRef as Jt, lineStyle as K, ShapeName as Kt, editPart as L, registerTheme as Ln, PanelOverride as Lt, MdOptions as M, getTheme as Mn, LayoutOverrides as Mt, MdResult as N, isSafeCss as Nn, NodeDecl as Nt, ConvertResult as O, TONES as On, LaidGroup as Ot, findBlocks as P, isSafeLink as Pn, NodeOverride as Pt, KNOWN_SETTINGS as Q, Decoration as Qt, formatLayout as R, themeNames as Rn, PanelPart as Rt, ENUMS as S, tspans as Sn, EdgeDecl as St, NUMBERS as T, THEMES as Tn, HeadKind as Tt, writeLayout as U, Props as Ut, setProp as V, PartEdit as Vt, writePanelDrag as W, ResolvedEdgeStyle as Wt, fromJSON as X, groupPath as Xt, JsonResult as Y, GRID as Yt, renderSvg as Z, layout as Zt, themes as _, InkColors as _n, Component as _t, render as a, RowPaint as an, blockBraces as at, COLORS as b, renderSegs as bn, Diagram as bt, git as c, optionKind as cn, lex as ct, sequence as d, registry as dn, parseProps as dt, PanelCtx as en, PANELS as et, legend as f, unuse as fn, serializeProps as ft, charts as g, renderHead as gn, Box as gt, tables as h, ShapeKind as hn, splitTrailingProps as ht, hash as i, RowKind as in, TokKind as it, MdBlock as j, createTheme as jn, Layout as jt, fromMermaid as k, Theme as kn, LaidNode as kt, chart as l, perPass as ln, onlyColor as lt, frames as m, MarkerKind as mn, setTrailingProp as mt, Options as n, PanelOption as nn, SETTING_VALUES as nt, toSource as o, StatementKind as on, isYuhwaPath as ot, footer as p, use as pn, setLineProp as pt, SHAPES as q, Side as qt, Result as r, RowCtx as rn, Tok as rt, builtins as s, YuhwaPlugin as sn, joinPath as st, InputFormat as t, PanelKind as tn, ParseOptions as tt, timeline as u, recolor as un, parse as ut, GUIDE as v, Seg as vn, Curve as vt, NODE_PROPS as w, RAMPS as wn, GroupDecl as wt, EDGE_PROPS as x, segsW as xn, Direction as xt, BOOLS as y, parseInline as yn, Diagnostic as yt, setLabel as z, approxMeasure as zn, PartAction as zt };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as PANELS, $t as PanelCtx, A as MdBlock, An as isSafeLink, At as Layout, B as setProp, Bt as PartEdit, C as NODE_PROPS, Cn as THEME_NAMES, Ct as GroupDecl, D as ConvertResult, Dn as createTheme, Dt as LaidGroup, E as lint, En as ThemeInput, Et as LaidEdge, F as replaceBlockSource, Fn as approxMeasure, Ft as PanelHandle, G as lineStyle, Gt as ShapeName, H as writeLayout, Ht as Props, I as editPart, In as canvasMeasure, It as PanelOverride, J as JsonResult, Jt as GRID, K as SHAPES, Kt as Side, L as formatLayout, Lt as PanelPart, M as MdResult, Mn as ramp, Mt as NodeDecl, N as findBlocks, Nn as registerTheme, Nt as NodeOverride, O as fromMermaid, On as getTheme, Ot as LaidNode, P as processMarkdown, Pn as themeNames, Pt as PanelDecl, Q as LexedLine, Qt as FrameKind, R as setLabel, Rt as PartAction, S as GROUP_PROPS, Sn as THEME_KEYS, St as EdgeOverride, T as PANEL_PROPS, Tn as Theme, Tt as LabelRef, U as writePanelDrag, Ut as ResolvedEdgeStyle, V as setSetting, Vt as Point, W as dashFor, Wt as ResolvedNodeStyle, X as renderSvg, Xt as layout, Y as fromJSON, Yt as groupPath, Z as KNOWN_SETTINGS, Zt as Decoration, _ as themes, _n as segsW, _t as Curve, a as render, an as YuhwaPlugin, at as isYuhwaPath, b as EDGE_PROPS, bn as RAMPS, bt as Direction, c as git, cn as registry, ct as onlyColor, d as sequence, dn as ShapeKind, dt as serializeProps, en as PanelKind, et as ParseOptions, f as legend, fn as renderHead, ft as setLineProp, g as charts, gn as renderSegs, gt as Component, h as tables, hn as parseInline, ht as Box, i as hash, in as StatementKind, it as blockBraces, j as MdOptions, jn as isToneOrHex, jt as LayoutOverrides, k as isMermaid, kn as isSafeCss, kt as LaidPanel, l as chart, ln as use, lt as parse, m as frames, mn as Seg, mt as splitTrailingProps, n as Options, nn as RowKind, nt as Tok, o as toSource, on as perPass, ot as joinPath, p as footer, pn as InkColors, pt as setTrailingProp, q as DiagramJSON, qt as SourceRef, r as Result, rn as RowPaint, rt as TokKind, s as builtins, sn as recolor, st as lex, t as InputFormat, tn as RowCtx, tt as SETTING_VALUES, u as timeline, un as MarkerKind, ut as parseProps, v as GUIDE, vn as tspans, vt as Diagnostic, w as NUMBERS, wn as TONES, wt as HeadKind, x as ENUMS, xn as THEMES, xt as EdgeDecl, y as BOOLS, yn as LineStyle, yt as Diagram, z as setPartTone, zt as PartChange } from "./index-Dl845tUQ.js";
2
- export { BOOLS, type Box, type Component, type ConvertResult, type Curve, type Decoration, type Diagnostic, type Diagram, type DiagramJSON, type Direction, EDGE_PROPS, ENUMS, type EdgeDecl, type EdgeOverride, type FrameKind, GRID, GROUP_PROPS, GUIDE, type GroupDecl, type HeadKind, type InkColors, InputFormat, type JsonResult, KNOWN_SETTINGS, type LabelRef, type LaidEdge, type LaidGroup, type LaidNode, type LaidPanel, type Layout, type LayoutOverrides, type LexedLine, type LineStyle, type MarkerKind, type MdBlock, type MdOptions, type MdResult, NODE_PROPS, NUMBERS, type NodeDecl, type NodeOverride, Options, PANELS, PANEL_PROPS, type PanelCtx, type PanelDecl, type PanelHandle, type PanelKind, type PanelOverride, type PanelPart, type ParseOptions, type PartAction, type PartChange, type PartEdit, type Point, type Props, RAMPS, type ResolvedEdgeStyle, type ResolvedNodeStyle, Result, type RowCtx, type RowKind, type RowPaint, SETTING_VALUES, SHAPES, type Seg, type ShapeKind, type ShapeName, type Side, type SourceRef, type StatementKind, THEMES, THEME_KEYS, THEME_NAMES, TONES, type Theme, type ThemeInput, type Tok, type TokKind, type YuhwaPlugin, approxMeasure, blockBraces, builtins, canvasMeasure, chart, charts, createTheme, dashFor, editPart, findBlocks, footer, formatLayout, frames, fromJSON, fromMermaid, getTheme, git, groupPath, hash, isMermaid, isSafeCss, isSafeLink, isToneOrHex, isYuhwaPath, joinPath, layout, legend, lex, lineStyle, lint, onlyColor, parse, parseInline, parseProps, perPass, processMarkdown, ramp, recolor, registerTheme, registry, render, renderHead, renderSegs, renderSvg, replaceBlockSource, segsW, sequence, serializeProps, setLabel, setLineProp, setPartTone, setProp, setSetting, setTrailingProp, splitTrailingProps, tables, themeNames, themes, timeline, toSource, tspans, use, writeLayout, writePanelDrag };
1
+ import { $ as LexedLine, $t as FrameKind, A as isMermaid, An as ThemeInput, At as LaidPanel, B as setPartTone, Bn as canvasMeasure, Bt as PartChange, C as GROUP_PROPS, Cn as LineStyle, Ct as EdgeOverride, D as lint, Dn as THEME_NAMES, Dt as LaidEdge, E as PANEL_PROPS, En as THEME_KEYS, Et as LabelRef, F as processMarkdown, Fn as isToneOrHex, Ft as PanelDecl, G as dashFor, Gt as ResolvedNodeStyle, H as setSetting, Ht as Point, I as replaceBlockSource, In as ramp, It as PanelHandle, J as DiagramJSON, Jt as SourceRef, K as lineStyle, Kt as ShapeName, L as editPart, Ln as registerTheme, Lt as PanelOverride, M as MdOptions, Mn as getTheme, Mt as LayoutOverrides, N as MdResult, Nn as isSafeCss, Nt as NodeDecl, O as ConvertResult, On as TONES, Ot as LaidGroup, P as findBlocks, Pn as isSafeLink, Pt as NodeOverride, Q as KNOWN_SETTINGS, Qt as Decoration, R as formatLayout, Rn as themeNames, Rt as PanelPart, S as ENUMS, Sn as tspans, St as EdgeDecl, T as NUMBERS, Tn as THEMES, Tt as HeadKind, U as writeLayout, Ut as Props, V as setProp, Vt as PartEdit, W as writePanelDrag, Wt as ResolvedEdgeStyle, X as fromJSON, Xt as groupPath, Y as JsonResult, Yt as GRID, Z as renderSvg, Zt as layout, _ as themes, _n as InkColors, _t as Component, a as render, an as RowPaint, at as blockBraces, b as COLORS, bn as renderSegs, bt as Diagram, c as git, cn as optionKind, ct as lex, d as sequence, dn as registry, dt as parseProps, en as PanelCtx, et as PANELS, f as legend, fn as unuse, ft as serializeProps, g as charts, gn as renderHead, gt as Box, h as tables, hn as ShapeKind, ht as splitTrailingProps, i as hash, in as RowKind, it as TokKind, j as MdBlock, jn as createTheme, jt as Layout, k as fromMermaid, kn as Theme, kt as LaidNode, l as chart, ln as perPass, lt as onlyColor, m as frames, mn as MarkerKind, mt as setTrailingProp, n as Options, nn as PanelOption, nt as SETTING_VALUES, o as toSource, on as StatementKind, ot as isYuhwaPath, p as footer, pn as use, pt as setLineProp, q as SHAPES, qt as Side, r as Result, rn as RowCtx, rt as Tok, s as builtins, sn as YuhwaPlugin, st as joinPath, t as InputFormat, tn as PanelKind, tt as ParseOptions, u as timeline, un as recolor, ut as parse, v as GUIDE, vn as Seg, vt as Curve, w as NODE_PROPS, wn as RAMPS, wt as GroupDecl, x as EDGE_PROPS, xn as segsW, xt as Direction, y as BOOLS, yn as parseInline, yt as Diagnostic, z as setLabel, zn as approxMeasure, zt as PartAction } from "./index-CnnoZYl0.js";
2
+ export { BOOLS, type Box, COLORS, type Component, type ConvertResult, type Curve, type Decoration, type Diagnostic, type Diagram, type DiagramJSON, type Direction, EDGE_PROPS, ENUMS, type EdgeDecl, type EdgeOverride, type FrameKind, GRID, GROUP_PROPS, GUIDE, type GroupDecl, type HeadKind, type InkColors, InputFormat, type JsonResult, KNOWN_SETTINGS, type LabelRef, type LaidEdge, type LaidGroup, type LaidNode, type LaidPanel, type Layout, type LayoutOverrides, type LexedLine, type LineStyle, type MarkerKind, type MdBlock, type MdOptions, type MdResult, NODE_PROPS, NUMBERS, type NodeDecl, type NodeOverride, Options, PANELS, PANEL_PROPS, type PanelCtx, type PanelDecl, type PanelHandle, type PanelKind, type PanelOption, type PanelOverride, type PanelPart, type ParseOptions, type PartAction, type PartChange, type PartEdit, type Point, type Props, RAMPS, type ResolvedEdgeStyle, type ResolvedNodeStyle, Result, type RowCtx, type RowKind, type RowPaint, SETTING_VALUES, SHAPES, type Seg, type ShapeKind, type ShapeName, type Side, type SourceRef, type StatementKind, THEMES, THEME_KEYS, THEME_NAMES, TONES, type Theme, type ThemeInput, type Tok, type TokKind, type YuhwaPlugin, approxMeasure, blockBraces, builtins, canvasMeasure, chart, charts, createTheme, dashFor, editPart, findBlocks, footer, formatLayout, frames, fromJSON, fromMermaid, getTheme, git, groupPath, hash, isMermaid, isSafeCss, isSafeLink, isToneOrHex, isYuhwaPath, joinPath, layout, legend, lex, lineStyle, lint, onlyColor, optionKind, parse, parseInline, parseProps, perPass, processMarkdown, ramp, recolor, registerTheme, registry, render, renderHead, renderSegs, renderSvg, replaceBlockSource, segsW, sequence, serializeProps, setLabel, setLineProp, setPartTone, setProp, setSetting, setTrailingProp, splitTrailingProps, tables, themeNames, themes, timeline, toSource, tspans, unuse, use, writeLayout, writePanelDrag };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { et as BOOLS, tt as EDGE_PROPS, nt as ENUMS, b as GRID, rt as GROUP_PROPS, i as GUIDE, B as KNOWN_SETTINGS, it as NODE_PROPS, at as NUMBERS, V as PANELS, ot as PANEL_PROPS, gt as RAMPS, H as SETTING_VALUES, ct as SHAPES, _t as THEMES, vt as THEME_KEYS, yt as THEME_NAMES, bt as TONES, k as approxMeasure, U as blockBraces, C as builtins, A as canvasMeasure, T as chart, P as charts, xt as createTheme, ut as dashFor, c as editPart, a as findBlocks, j as footer, l as formatLayout, M as frames, v as fromJSON, g as fromMermaid, St as getTheme, w as git, x as groupPath, t as hash, _ as isMermaid, Ct as isSafeCss, wt as isSafeLink, Tt as isToneOrHex, W as isYuhwaPath, G as joinPath, S as layout, O as legend, K as lex, dt as lineStyle, st as lint, q as onlyColor, J as parse, ft as parseInline, Y as parseProps, I as perPass, o as processMarkdown, Et as ramp, L as recolor, Dt as registerTheme, R as registry, n as render, lt as renderHead, pt as renderSegs, y as renderSvg, s as replaceBlockSource, mt as segsW, D as sequence, X as serializeProps, u as setLabel, Z as setLineProp, d as setPartTone, f as setProp, p as setSetting, Q as setTrailingProp, $ as splitTrailingProps, N as tables, Ot as themeNames, F as themes, E as timeline, r as toSource, ht as tspans, z as use, m as writeLayout, h as writePanelDrag } from "./src-wk7tBpWs.js";
1
+ export { nt as BOOLS, rt as COLORS, it as EDGE_PROPS, at as ENUMS, b as GRID, ot as GROUP_PROPS, i as GUIDE, H as KNOWN_SETTINGS, st as NODE_PROPS, ct as NUMBERS, U as PANELS, lt as PANEL_PROPS, Ct as RAMPS, W as SETTING_VALUES, ft as SHAPES, wt as THEMES, Tt as THEME_KEYS, Et as THEME_NAMES, Dt as TONES, A as approxMeasure, G as blockBraces, C as builtins, j as canvasMeasure, T as chart, P as charts, Ot as createTheme, mt as dashFor, c as editPart, a as findBlocks, k as footer, l as formatLayout, M as frames, v as fromJSON, g as fromMermaid, kt as getTheme, w as git, x as groupPath, t as hash, _ as isMermaid, At as isSafeCss, jt as isSafeLink, Mt as isToneOrHex, K as isYuhwaPath, q as joinPath, S as layout, O as legend, J as lex, ht as lineStyle, dt as lint, Y as onlyColor, I as optionKind, X as parse, _t as parseInline, Z as parseProps, L as perPass, o as processMarkdown, Nt as ramp, R as recolor, Pt as registerTheme, z as registry, n as render, pt as renderHead, yt as renderSegs, y as renderSvg, s as replaceBlockSource, bt as segsW, D as sequence, Q as serializeProps, u as setLabel, $ as setLineProp, d as setPartTone, f as setProp, p as setSetting, et as setTrailingProp, tt as splitTrailingProps, N as tables, Ft as themeNames, F as themes, E as timeline, r as toSource, St as tspans, B as unuse, V as use, m as writeLayout, h as writePanelDrag } from "./src-DkQj7aIV.js";
@@ -13,10 +13,12 @@
13
13
  *
14
14
  * Each block becomes the same `<figure class="yuhwa">` as in the other docs
15
15
  * integrations; void tags are self-closed and `.mdx` files get `className`, so
16
- * MDX takes it as JSX.
16
+ * MDX takes it as JSX. `.mdx` files always get images (`output: 'img'`).
17
17
  * A fence with `no-render` (```yuhwa no-render) stays a code block.
18
+ * ```yuhwa file="diagrams/arch.yu" renders that file instead of the block.
19
+ * `zoom: 'inline'` adds the zoom script to `.md` output only; in `.mdx`, import `yuhwa/zoom`.
18
20
  */
19
- import { t as YuhwaDocsOptions } from "./figure-BZHIKnxv.js";
21
+ import { t as YuhwaDocsOptions } from "./figure-CA2hy0xh.js";
20
22
  /** replaces every yuhwa fence in `md` with its rendered figure */
21
23
  export declare function renderFences(md: string, opts?: YuhwaDocsOptions, file?: string): string;
22
24
  interface VitePlugin {
package/dist/ironmark.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as wantsRender, r as renderFigure, t as diskResolve } from "./node-Bneu5eJV.js";
1
+ import { a as wantsRender, i as toHtml, n as renderBlock, o as zoomTag } from "./node-Bzn2uKXZ.js";
2
2
  // src/integrations/ironmark.ts
3
3
  /**
4
4
  * ironmark support: renders ```yuhwa fences before ironmark parses the file.
@@ -15,15 +15,22 @@ import { i as wantsRender, r as renderFigure, t as diskResolve } from "./node-Bn
15
15
  *
16
16
  * Each block becomes the same `<figure class="yuhwa">` as in the other docs
17
17
  * integrations; void tags are self-closed and `.mdx` files get `className`, so
18
- * MDX takes it as JSX.
18
+ * MDX takes it as JSX. `.mdx` files always get images (`output: 'img'`).
19
19
  * A fence with `no-render` (```yuhwa no-render) stays a code block.
20
+ * ```yuhwa file="diagrams/arch.yu" renders that file instead of the block.
21
+ * `zoom: 'inline'` adds the zoom script to `.md` output only; in `.mdx`, import `yuhwa/zoom`.
20
22
  */
23
+ const JSX_ATTR = {
24
+ class: "className",
25
+ srcset: "srcSet"
26
+ };
21
27
  const FENCE = /^ {0,3}(`{3,}|~{3,})\s*([^\s`]*)(.*)$/;
22
28
  /** replaces every yuhwa fence in `md` with its rendered figure */
23
29
  function renderFences(md, opts = {}, file) {
24
30
  const lines = md.split("\n");
25
31
  const out = [];
26
32
  const jsx = /\.mdx$/i.test(file ?? "");
33
+ let script = opts.zoom === "inline" && !jsx;
27
34
  for (let i = 0; i < lines.length; i++) {
28
35
  const m = lines[i].match(FENCE);
29
36
  if (!m) {
@@ -40,14 +47,18 @@ function renderFences(md, opts = {}, file) {
40
47
  continue;
41
48
  }
42
49
  const source = lines.slice(i + 1, j).join("\n");
43
- let { html } = renderFigure(source, {
44
- resolve: diskResolve,
45
- ...opts
46
- }, {
50
+ let { html } = renderBlock(source, meta.trim(), jsx ? {
51
+ ...opts,
52
+ output: "img"
53
+ } : opts, {
47
54
  file,
48
55
  line: i + 1
49
56
  });
50
- if (jsx) html = html.replace(/ (class|srcset)="/g, (_, a) => ` ${a === "class" ? "className" : "srcSet"}="`);
57
+ if (jsx) html = html.replace(/ (class|srcset)="/g, (_, a) => ` ${JSX_ATTR[a]}="`).replace(/[{}]/g, (c) => c === "{" ? "&#123;" : "&#125;");
58
+ if (script) {
59
+ html += toHtml(zoomTag());
60
+ script = false;
61
+ }
51
62
  out.push("", html.replace(/\n\s*\n/g, "\n"), "");
52
63
  i = j;
53
64
  }
package/dist/llms.txt CHANGED
@@ -4,7 +4,7 @@ yuhwa is a text diagram language that renders to a self-contained SVG. One
4
4
  statement per line. `//` at line start or after a space starts a comment, so
5
5
  URLs in labels stay text. There is no `#` comment.
6
6
 
7
- Workflow: write the source, run `yuhwa check file.yuhwa --json` (or read the
7
+ Workflow: write the source, run `yuhwa check file.yu --json` (or read the
8
8
  `diagnostics` of `render`), fix every error and warning, then render. Done
9
9
  when it reports 0 diagnostics; they name the fix ("did you mean ...").
10
10
 
@@ -31,7 +31,7 @@ orders --> queue "Events" [shape: hexagon]: publish [flow: true]
31
31
 
32
32
  ## Statements
33
33
 
34
- - Setting: `key: value` at top level. Keys: title, subtitle, theme, accent, direction (right|down|left|up), curve (smooth|orthogonal|straight), gap, rank-gap, font, font-size, background, padding, shadow, radius, stroke-width, shape, grid, panels (row|column|grid|wrap), panel-gap, wrap, edge-color, edge-width, legend, footer.
34
+ - Setting: `key: value` at top level. Keys: title, subtitle, theme, accent, direction (right|down|left|up), curve (smooth|orthogonal|straight), gap, rank-gap, max-width, font, font-size, background, padding, shadow, radius, stroke-width, shape, grid, panels (row|column|grid|wrap), panel-gap, wrap, edge-color, edge-width, legend, footer.
35
35
  - Node: `id "Label" .class [props]`; label, classes and props are optional.
36
36
  Ids: letters (any script), digits, `_`, inner `-`; start with a letter or `_`.
37
37
  The label defaults to the id; multi-word labels need quotes. `\n` breaks a
@@ -51,7 +51,7 @@ orders --> queue "Events" [shape: hexagon]: publish [flow: true]
51
51
  `$a`. `name(x, "Label, with comma", b: y)` stamps it out. Use one per
52
52
  repeated shape of nodes instead of copying lines.
53
53
  - Group: `group id "Label" .class [props] { ... }`, may nest. `group "Label" {`
54
- gets a slug id. Edges connect nodes only, never groups.
54
+ gets a slug id. Edges connect nodes and panel ids (`plan -> sales`), never groups.
55
55
  - Props: `[key: value, key: "a, b", flag]`; a bare flag means true, a bare
56
56
  value names its key: `[cylinder, amber, dashed]`.
57
57
  - Props on their own lines: a `key: value` line indented under a node, edge,
@@ -64,13 +64,14 @@ orders --> queue "Events" [shape: hexagon]: publish [flow: true]
64
64
  ```
65
65
  - Card: a node line ending in `{` takes body lines until a line that is only
66
66
  `}`. It draws a header (label, `meta` right, `caps` small caps), a divider
67
- and a monospace body.
67
+ and a monospace body. `font-size`/`font-weight`/`text` style the header;
68
+ `body-size`, `body-weight`, `body-color` and `line-height` style the body.
68
69
 
69
70
  ## Values
70
71
 
71
72
  - `color` sets fill, border and text in one: `[blue]` or `[color: blue]`.
72
- Palette: slate, gray, red, orange, amber, lime, green, teal, cyan, blue, indigo, purple, pink; shades like blue-600; any CSS colour. `fill`,
73
- `stroke` and `text` colour one part.
73
+ Palette: slate, gray, red, orange, amber, lime, green, teal, cyan, blue, indigo, purple, pink; shades like blue-600; any CSS colour. The colour
74
+ props (color, fill, stroke, text, sub-color, body-color, label-color, label-bg, background, edge-color) take the same values and colour one part.
74
75
  - Shapes: rounded, box, pill, circle, ellipse, diamond, hexagon, cylinder, parallelogram, document, note, text.
75
76
  - Line styles: solid, dashed, dotted. Heads: arrow, open, dot, diamond, bar, none. Sides (`exit`, `enter`): top, right, bottom, left, auto.
76
77
  - Themes: paper, midnight, blueprint, mono, pastel, terminal, sepia, frost, contrast, ocean, ember, dusk. Define one with `theme brand [base: midnight, accent: orange]`
@@ -79,13 +80,16 @@ orders --> queue "Events" [shape: hexagon]: publish [flow: true]
79
80
 
80
81
  ## Props
81
82
 
82
- - Node: shape, color, fill, stroke, text, sub, sub-color, icon, border, stroke-width, border-style, dashed, dotted, radius, bold, italic, font-size, font-weight, shadow, opacity, width, height, link, tooltip, meta, caps, mono, max-width, frame.
83
- - Edge: style, width, color, stroke, curve, head, tail, flow, animate, opacity, label-color, label-bg, dashed, dotted, thick, exit, from-side, enter, to-side, constraint, caption, rotate, length.
84
- - Group: color, fill, stroke, text, border-style, dashed, dotted, meta, caps.
83
+ - Node: shape, color, fill, stroke, text, font-size, font-weight, italic, sub, sub-color, icon, border, stroke-width, border-style, dashed, dotted, radius, bold, shadow, opacity, width, height, link, tooltip, meta, caps, mono, body-size, body-color, body-weight, line-height, max-width, below, above, right-of, left-of, rank, frame.
84
+ - Edge: style, width, color, stroke, curve, head, tail, flow, animate, opacity, text, font-size, font-weight, italic, label-color, label-bg, dashed, dotted, thick, exit, from-side, enter, to-side, constraint, caption, rotate, length.
85
+ - Group: color, fill, stroke, text, font-size, font-weight, italic, border-style, dashed, dotted, meta, caps.
85
86
 
86
87
  `sub` is a second, smaller line; `icon` an emoji before the label; `link`
87
88
  makes a node clickable; `flow: true` animates an edge; `constraint: false`
88
89
  keeps an edge out of the layout; `shape: text` is an annotation without a box.
90
+ `below: <id>`, `above`, `right-of`, `left-of` and `rank` place a node next to another
91
+ node without drawing an edge; do not use invisible edges for that. The `max-width: <px>` setting
92
+ wraps the ranks of a right or left diagram into rows that fit that width.
89
93
  `frame: <kind> <text>` draws window chrome: browser, window, terminal.
90
94
 
91
95
  ## Card bodies
@@ -105,8 +109,12 @@ checks "checks" [meta: 42s, caps: true] {
105
109
 
106
110
  Lines: text, `left || right` (right-aligned part), `---` divider, empty gap.
107
111
  Rows: `bars [color]: 3 5 4 8 6`, `spark [color]: 3 5 4 8 6`, `progress [color]: 72% Label`, `stat [color]: 99.9% uptime | 42ms p95`, `| a | b |`; a `|---|` row makes a table header.
108
- Inline markup (also in `title`, `subtitle`, `footer`): `**bold**`, `*muted*`,
109
- `~~strike~~`, ``code``, `[[chip]]` / `[[green: chip]]`, `{red: text}`.
112
+ Inline markup (in every text: labels, `sub`, edge labels, group and panel titles,
113
+ `title`, `subtitle`, `footer`): `**bold**`, `*muted*`, `~~strike~~`, ``code``,
114
+ `[[chip]]` / `[[green: chip]]`, `{red: text}`, and styled spans
115
+ `{color: red, size: 18, weight: 700, italic | text}` (short: `{red, bold | text}`).
116
+ Text props on every element (node, edge label, group and panel title): `text`,
117
+ `font-size`, `font-weight`, `italic`; a panel's `font-size` scales all its text.
110
118
 
111
119
  `legend: .svc Service | --> async | red Deprecated` and `footer: a | b` draw
112
120
  strips under the diagram; a legend item starts with a class, colour or arrow.
@@ -133,24 +141,25 @@ chart p95 "Latency p95" [type: column, unit: ms] {
133
141
  }
134
142
  ```
135
143
 
136
- Every panel takes `color`, `theme`, `background`, `fill`, `border`, `stroke`, `text`, `border-width`, `border-style`, `radius`, `shadow`, `frame`, `edge-color`, `edge-width`; `frame: false` drops the box. Body
144
+ Every panel takes `color`, `theme`, `background`, `fill`, `border`, `stroke`, `text`, `font-size`, `font-weight`, `italic`, `border-width`, `border-style`, `radius`, `shadow`, `frame`, `edge-color`, `edge-width`; `frame: false` drops the box. Body
137
145
  lines take `[props]` before the colon or at the end of the line.
138
146
 
139
- - `sequence`: `participant|actor id "Label" [color]` (`participant a, b, c` fixes the order), `a -> b: msg` (`-->` reply, `..>` dotted, `=>` thick, `a -> a` self call), `note a, b: text`, `--- section ---`. A message takes edge props at its end: `a -> b: retry [red, style: dotted]`. Header: `numbered: true|false`, `lifeline: …`, `lifeline-style: dashed|dotted|solid`.
147
+ - `sequence`: `participant|actor id "Label" [color]` (`participant a, b, c` fixes the order), `a -> b: msg` (`-->` reply, `..>` dotted, `=>` thick, `a -> a` self call), `note a, b: text`, `--- section ---`. A message takes edge props at its end: `a -> b: retry [red, style: dotted]`. Header: `numbered`, `lifeline: <colour>`, `lifeline-style: dashed|dotted|solid`.
140
148
  - `timeline`: `when [color]: title`, then indented `- detail` lines. The colon needs a space after it, so `12:30: deploy` works. Header: `direction: right|down`.
141
149
  - `chart`: `label [color]: number` per line; `unit` is appended to values. Header: `type: bar|column|line|pie|donut`, `unit: …`.
142
150
  - `git`: `commit ["msg"] [tag: v1, id: a1b2, color, highlight|reverse]`, `branch name [from <branch|commit id|tag>] [color, order: 2, label: "…"]` (creates and checks out), `checkout name` / `switch name`, `merge name ["msg"] [tag: v2]`, `cherry-pick <id|tag|branch>`, `tag v1`. Starts on `main` (`[main: trunk]` renames it); `order` moves a lane. Header: `direction: right|down`.
143
- - `mindmap`: indentation is the tree, the first line the root; `-` / `*` bullets are optional. A trailing `[color]` tints a subtree, `[shape: box|pill|plain|circle]` changes one node. Header: `layout: both|right|left|down`, `colors: branches|mono`.
151
+ - `mindmap`: indentation is the tree, the first line the root; `-` / `*` bullets are optional. A trailing `[color]` tints a subtree, `[shape: box|pill|plain|circle]` changes one node, `[text: red, font-size: 18, font-weight: 700]` styles its text. Header: `layout: both|vertical|right|left|down|up`, `colors: branches|mono`.
144
152
  - `gantt`: `id "Label" [color, done, active, crit, milestone, progress: 60%, owner: ana]: start, length`. start: a date or `after a b` (empty: after the task above); length: 3h, 5d, 2w or an end date. `--- Section [color] ---` groups rows. Header: `today: …`, `scale: day|week|month`, `bars: soft|solid|outline|thin`, `labels: left|bar`, `notes: length|dates|none`, `density: compact|normal|loose`, `rows: striped|plain`, `grid: show|none`, `summary: show|hide`, `weekends: hide|show`, `arrows: elbow|curved|hide`.
145
153
  - `quadrant`: `x-axis Low -> High`, `y-axis Low -> High`, `q1..q4 [color]: label` (q1 top right, counter-clockwise), points `Name [color]: x, y` from 0 to 1.
146
154
  - `kanban`: a line at the outer indent is a column `Todo [color, limit: 3]`, `- text [owner: ana, ticket: X-1, priority: low|medium|high, color]` a card, deeper lines its details.
155
+ - `treeview`: indentation is the tree (several top-level entries are fine); `-` bullets and the `├──` / `│` prefixes of `tree` output are optional; `...` stands for more files. A folder has children, ends in `/` or says `[folder]`. `name: note` or `name # note` adds a note. Trailing props: a colour, `icon: folder|folder-open|file|code|doc|image|config|lock|package|git|database|test|font|media|terminal|yuhwa|<emoji>`, `badge: text`, `size: text`, `collapsed`, `highlight`, `dim`, `added|modified|deleted|renamed|ignored`. `match <glob> [props]` gives every matching entry those props (`*`, `**`, `?`, `{a,b}`; a trailing `/` matches folders only). Header: `icons: color|mono|emoji|none`, `lines: solid|rounded|dashed|dotted|none`, `sort: none|name|folders`, `notes: column|inline`, `chevrons`, `rows: plain|striped`, `spacing: compact|normal|relaxed`, `slashes: true|false`, `compact`, `counts: collapsed|all|none`, `marks: letter|dot|none`, `rollup: true|false`, `depth: N`, `indent: N`, `folder-color: <colour>`, `line-color: <colour>`, `highlight-color: <colour>`, `badge-color: <colour>`, `note-color: <colour>`, `strike-color: <colour>`, `strike-width: N`.
147
156
 
148
157
  ## Imports
149
158
 
150
- `import "./shared.yuhwa"` at top level pulls in another file's classes,
159
+ `import "./shared.yu"` at top level pulls in another file's classes,
151
160
  nodes, groups, edges, panels, variables and components; paths resolve against
152
161
  the importing file, and the importing file wins on conflicts.
153
- `import { api, .svc as .service, $brand } from "./x.yuhwa"` takes only those.
162
+ `import { api, .svc as .service, $brand } from "./x.yu"` takes only those.
154
163
  A file with `export api, .svc` (or `export` before a declaration:
155
164
  `export def ...`, `export $x: 1`, `export theme brand {`) offers only those.
156
165
  Custom themes come along with every import. Settings stay in their file unless
@@ -175,7 +184,7 @@ layout {
175
184
  `panel at X Y` pins a panel. `panel:part D` (`panel:part DX DY` for free
176
185
  parts) nudges one part:
177
186
 
178
- - `sequence`: a participant id moves its lifeline and the ones after it; `m<n>` (message), `note<n>`, `d<n>` (divider) add room above that row.
187
+ - `sequence`: a participant id (`p-<id>` when the id looks like a row) moves its lifeline and the ones after it; `m<n>` (message), `note<n>`, `d<n>` (divider) add room above that row.
179
188
  - `timeline`: an event by its one-word `when`, else `e<n>`, adds room before it.
180
189
  - `chart`: `size DX DY` grows the plot.
181
190
  - `git`: a branch name (its lane), a commit (id, first tag or `c<n>`; a branch name wins), `<commit>^1` / `^2` (the bend from its first / second parent), `<commit>^pick`.
@@ -1,3 +1,3 @@
1
- import { t as ServerOptions } from "./server-DJC_fQMe.js";
2
- import { a as YuhwaService } from "./service-ClZ8clSQ.js";
1
+ import { t as ServerOptions } from "./server--jHjJjOS.js";
2
+ import { a as YuhwaService } from "./service-Brvpt7Do.js";
3
3
  export declare function startWorkerServer(opts?: ServerOptions): YuhwaService;
@@ -1,4 +1,4 @@
1
- import { a as __commonJSMin, i as require_api, n as require_api$2, r as require_api$1, t as startServer } from "./server-DmQuHQrG.js";
1
+ import { a as __commonJSMin, i as require_api, n as require_api$2, r as require_api$1, t as startServer } from "./server-Dxo7OG8K.js";
2
2
  // ../../node_modules/.pnpm/vscode-jsonrpc@10.0.0/node_modules/vscode-jsonrpc/lib/browser/ril.js
3
3
  var require_ril = /* @__PURE__ */ __commonJSMin(((exports) => {
4
4
  Object.defineProperty(exports, "__esModule", { value: true });