yuhwa 1.6.0 → 1.7.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 (45) hide show
  1. package/dist/astro.d.ts +1 -1
  2. package/dist/astro.js +1 -1
  3. package/dist/browser.d.ts +2 -2
  4. package/dist/browser.js +4 -4
  5. package/dist/canvas.js +1 -1
  6. package/dist/cli.js +124 -35
  7. package/dist/editor/assets/index-Qlffmtt7.js +689 -0
  8. package/dist/editor/assets/{lsp.worker-bwlomb1r.js → lsp.worker-waLMr9u-.js} +22 -22
  9. package/dist/editor/index.html +1 -1
  10. package/dist/{figure-CqzRbgF5.d.ts → figure-BCgY5uVw.d.ts} +1 -1
  11. package/dist/{index-CT7AJAf8.d.ts → index-HrJIjhCS.d.ts} +16 -2
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +4 -4
  14. package/dist/ironmark.d.ts +1 -1
  15. package/dist/ironmark.js +1 -1
  16. package/dist/llms.txt +97 -14
  17. package/dist/lsp-browser.js +1 -1
  18. package/dist/lsp-node.js +1 -1
  19. package/dist/lsp-server.js +1 -1
  20. package/dist/lsp.js +1 -1
  21. package/dist/markdown-it.d.ts +1 -1
  22. package/dist/markdown-it.js +2 -2
  23. package/dist/{node-MjVxKTHg.js → node-BerWCoTJ.js} +4 -4
  24. package/dist/{parse-BT2Xuqty.js → parse-B4TOA3gC.js} +1484 -1241
  25. package/dist/{plugin-Dckiw3N9.js → plugin-C3Y1OsdZ.js} +1 -1
  26. package/dist/{plugin-y9uy8ayQ.d.ts → plugin-DD34oni4.d.ts} +15 -29
  27. package/dist/plugin.d.ts +1 -1
  28. package/dist/plugin.js +2 -2
  29. package/dist/{raster-Dz9_MPsh.js → raster-C7BAAu8q.js} +1 -1
  30. package/dist/remark.d.ts +1 -1
  31. package/dist/remark.js +1 -1
  32. package/dist/satteri.d.ts +1 -1
  33. package/dist/satteri.js +1 -1
  34. package/dist/{server-Bgqav5i4.js → server-G_aomh0d.js} +2 -2
  35. package/dist/{service-BFj8Un47.js → service-CihRTF6I.js} +3 -3
  36. package/dist/{shared-BuNGLF8_.js → shared-DiOHyqG5.js} +2966 -2847
  37. package/dist/{src-WJP0qnZY.js → src-DOnn1bDA.js} +1508 -1549
  38. package/dist/vite.d.ts +1 -1
  39. package/dist/vite.js +3 -3
  40. package/dist/vuepress.d.ts +1 -1
  41. package/dist/vuepress.js +1 -1
  42. package/dist/yuhwa.iife.js +150 -67
  43. package/package.json +1 -1
  44. package/skills/yuhwa/SKILL.md +15 -6
  45. package/dist/editor/assets/index-ChQpisN7.js +0 -689
package/dist/astro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as YuhwaDocsOptions } from "./figure-CqzRbgF5.js";
1
+ import { t as YuhwaDocsOptions } from "./figure-BCgY5uVw.js";
2
2
  interface Watcher {
3
3
  on: (event: "change" | "add", fn: (file: string) => void) => unknown;
4
4
  add: (files: string[]) => unknown;
package/dist/astro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import remarkYuhwa from "./remark.js";
2
2
  import satteriYuhwa from "./satteri.js";
3
- import { n as onTrack, o as clientImports, r as pagesUsing } from "./node-MjVxKTHg.js";
3
+ import { n as onTrack, o as clientImports, r as pagesUsing } from "./node-BerWCoTJ.js";
4
4
  // src/integrations/astro.ts
5
5
  /**
6
6
  * Astro integration, also for Starlight: renders ```yuhwa blocks in .md and
package/dist/browser.d.ts CHANGED
@@ -11,8 +11,8 @@
11
11
  * <yuhwa-diagram render="canvas">a -> b</yuhwa-diagram> // or png; default svg
12
12
  * el.source = 'a -> b' // re-renders
13
13
  */
14
- import { $ as PartAction, A as Box, At as YuhwaPlugin, B as LabelRef, Bt as InkColors, C as serializeProps, Ct as PanelCtx, Dn as canvasMeasure, Dt as RowKind, E as splitTrailingProps, En as approxMeasure, Et as RowCtx, F as Direction, Ft as unuse, G as Layout, H as LaidGroup, Ht as esc, I as EdgeDecl, It as use, J as NodeOverride, Jt as renderSegs, K as LayoutOverrides, Kt as parseInline, L as EdgeOverride, Lt as MarkerKind, M as Curve, Mt as perPass, N as Diagnostic, Nt as recolor, O as Align, Ot as RowPaint, P as Diagram, Pt as registry, Q as PanelPart, Qt as tspans, R as GroupDecl, Rt as ShapeKind, S as parseProps, Sn as registerTheme, St as FrameKind, T as setTrailingProp, Tt as PanelOption, U as LaidNode, V as LaidEdge, Vt as Seg, W as LaidPanel, X as PanelHandle, Y as PanelDecl, Yt as segsW, Z as PanelOverride, _ as isYuhwaPath, _n as isGenericFont, _t as lineStyle, a as portOn, an as THEME_KEYS, at as ResolvedNodeStyle, b as onlyColor, bn as isToneOrHex, c as KNOWN_SETTINGS, cn as Theme, ct as SourceRef, d as ParseOptions, dn as createTheme, dt as layout, en as LineStyle, et as PartChange, f as SETTING_HELP, ft as dashFor, g as blockBraces, gt as groupProp, h as TokKind, hn as getTheme, ht as groupPath, in as THEMES, it as ResolvedEdgeStyle, j as Component, jt as optionKind, k as AlignSide, kt as StatementKind, l as LexedLine, ln as ThemeInput, lt as GRID, m as Tok, mn as fontStack, nn as RAMPS, nt as Point, on as THEME_NAMES, ot as ShapeName, p as SETTING_VALUES, pn as fontFamilies, q as NodeDecl, r as SHAPES, rt as Props, sn as TONES, st as Side, tt as PartEdit, u as PANELS, v as joinPath, vn as isSafeCss, w as setLineProp, wn as themeNames, wt as PanelKind, x as parse, xn as ramp, xt as Decoration, y as lex, yn as isSafeLink, z as HeadKind, zt as renderHead } from "./plugin-y9uy8ayQ.js";
15
- import { $ as addNode, A as GROUP_PROPS, B as MdBlock, C as markers, D as COLORS, E as BOOLS, F as lint, G as replaceBlockSource, H as MdResult, I as ConvertResult, J as embedFonts, K as FontSource, L as fromMermaid, M as NUMBERS, N as PANEL_PROPS, O as EDGE_PROPS, P as PANEL_PROP_HELP, Q as addEdge, R as isMermaid, S as themes, T as GUIDE, U as findBlocks, V as MdOptions, W as processMarkdown, X as svgToCanvas, Y as loadFonts, Z as Target, _ as legend, at as setProp, b as tables, c as treeview, ct as writePanelDrag, d as gantt, dt as JsonResult, et as editPart, f as mindmap, ft as fromJSON, g as sequence, h as timeline, i as hash, it as setPartTone, j as NODE_PROPS, k as ENUMS, l as kanban, lt as ALIGN_SIDES, m as chart, n as Options, nt as removeElement, o as toSource, ot as setSetting, p as git, pt as renderSvg, q as RasterOptions, r as Result, rt as setLabel, s as builtins, st as writeLayout, t as InputFormat, tt as formatLayout, u as quadrant, ut as DiagramJSON, v as footer, w as shapes, x as charts, y as frames, z as MD_LANGUAGES } from "./index-CT7AJAf8.js";
14
+ import { $ as PartAction, $t as RAMPS, A as Box, At as recolor, B as LabelRef, C as SETTING_VALUES, Cn as approxMeasure, Ct as RowCtx, Dt as YuhwaPlugin, E as parse, Et as StatementKind, F as Direction, Ft as ShapeKind, G as Layout, Gt as renderSegs, H as LaidGroup, I as EdgeDecl, It as renderHead, J as NodeOverride, K as LayoutOverrides, Kt as segsW, L as EdgeOverride, Lt as InkColors, M as Curve, Mt as unuse, N as Diagnostic, Nt as use, O as Align, Ot as optionKind, P as Diagram, Pt as MarkerKind, Q as PanelPart, R as GroupDecl, Rt as Seg, S as SETTING_HELP, St as PanelOption, T as joinPath, Tt as RowPaint, U as LaidNode, Ut as parseInline, V as LaidEdge, W as LaidPanel, X as PanelHandle, Y as PanelDecl, Yt as tspans, Z as PanelOverride, Zt as LineStyle, _ as setTrailingProp, _n as isToneOrHex, a as portOn, an as Theme, at as ResolvedNodeStyle, b as PANELS, bt as PanelCtx, c as LexedLine, cn as createTheme, ct as SourceRef, d as blockBraces, dn as fontStack, et as PartChange, f as lex, fn as getTheme, ft as groupPath, g as setLineProp, gn as isSafeLink, h as serializeProps, hn as isSafeCss, in as TONES, it as ResolvedEdgeStyle, j as Component, jt as registry, k as AlignSide, kt as perPass, l as Tok, lt as dashFor, m as parseProps, mn as isGenericFont, mt as lineStyle, nn as THEME_KEYS, nt as Point, on as ThemeInput, ot as ShapeName, p as onlyColor, pt as groupProp, q as NodeDecl, r as SHAPES, rn as THEME_NAMES, rt as Props, st as Side, tn as THEMES, tt as PartEdit, u as TokKind, un as fontFamilies, v as splitTrailingProps, vn as ramp, vt as Decoration, w as isYuhwaPath, wn as canvasMeasure, wt as RowKind, x as ParseOptions, xn as themeNames, xt as PanelKind, y as KNOWN_SETTINGS, yn as registerTheme, yt as FrameKind, z as HeadKind, zt as esc } from "./plugin-DD34oni4.js";
15
+ import { $ as addNode, A as GROUP_PROPS, B as MdBlock, C as markers, D as COLORS, E as BOOLS, F as lint, G as replaceBlockSource, H as MdResult, I as ConvertResult, J as embedFonts, K as FontSource, L as fromMermaid, M as NUMBERS, N as PANEL_PROPS, O as EDGE_PROPS, P as PANEL_PROP_HELP, Q as addEdge, R as isMermaid, S as themes, T as GUIDE, U as findBlocks, V as MdOptions, W as processMarkdown, X as svgToCanvas, Y as loadFonts, Z as Target, _ as legend, at as setProp, b as tables, c as treeview, ct as writePanelDrag, d as gantt, dt as DiagramJSON, et as editPart, f as mindmap, ft as JsonResult, g as sequence, h as timeline, ht as layout, i as hash, it as setPartTone, j as NODE_PROPS, k as ENUMS, l as kanban, lt as ALIGN_SIDES, m as chart, mt as renderSvg, n as Options, nt as removeElement, o as toSource, ot as setSetting, p as git, pt as fromJSON, q as RasterOptions, r as Result, rt as setLabel, s as builtins, st as writeLayout, t as InputFormat, tt as formatLayout, u as quadrant, ut as GRID, v as footer, w as shapes, x as charts, y as frames, z as MD_LANGUAGES } from "./index-HrJIjhCS.js";
16
16
  import { i as zoomable, n as Zoomer, r as zoomHeight, t as ZoomOptions } from "./zoom-CCSUbX1X.js";
17
17
  export declare function render(source: string, opts?: Options): Result;
18
18
  /** `render`, then draw the diagram into a canvas. */
package/dist/browser.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as kanban, B as frames, C as isMermaid, D as layout, E as GRID, F as chart, G as shapes, H as charts, I as timeline, L as sequence, M as gantt, N as mindmap, O as builtins, P as git, R as legend, S as fromMermaid, T as renderSvg, U as themes, V as tables, W as markers, _ as setPartTone, a as MD_LANGUAGES, b as writeLayout, d as addEdge, f as addNode, g as setLabel, h as removeElement, i as GUIDE, j as quadrant, k as treeview, l as processMarkdown, m as formatLayout, n as render$1, o as findBlocks, p as editPart, r as toSource, t as hash, u as replaceBlockSource, v as setProp, w as fromJSON, x as writePanelDrag, y as setSetting, z as footer } from "./src-WJP0qnZY.js";
2
- import { a as perPass, c as unuse, i as optionKind, l as use, n as approxMeasure, o as recolor, r as canvasMeasure, s as registry } from "./plugin-Dckiw3N9.js";
1
+ import { A as kanban, B as frames, C as isMermaid, D as GRID, E as layout, F as chart, G as shapes, H as charts, I as timeline, L as sequence, M as gantt, N as mindmap, O as builtins, P as git, R as legend, S as fromMermaid, T as renderSvg, U as themes, V as tables, W as markers, _ as setPartTone, a as MD_LANGUAGES, b as writeLayout, d as addEdge, f as addNode, g as setLabel, h as removeElement, i as GUIDE, j as quadrant, k as treeview, l as processMarkdown, m as formatLayout, n as render$1, o as findBlocks, p as editPart, r as toSource, t as hash, u as replaceBlockSource, v as setProp, w as fromJSON, x as writePanelDrag, y as setSetting, z as footer } from "./src-DOnn1bDA.js";
2
+ import { a as perPass, c as unuse, i as optionKind, l as use, n as approxMeasure, o as recolor, r as canvasMeasure, s as registry } from "./plugin-C3Y1OsdZ.js";
3
3
  import { n as zoomable, t as zoomHeight } from "./zoom-D3Lahr1T.js";
4
- import { a as svgFamilies, c as swapForRaster, n as embedFonts, r as loadFonts, s as svgToCanvas } from "./raster-Dz9_MPsh.js";
5
- import { $t as fontStack, A as PANEL_PROP_HELP, At as renderSegs, Bt as tspans, C as COLORS, D as NODE_PROPS, Dt as parseInline, E as GROUP_PROPS, F as SHAPES, Gt as THEMES, J as renderHead, Jt as TONES, Kt as THEME_KEYS, M as lint, Nt as segsW, O as NUMBERS, Q as ALIGN_SIDES, Qt as fontFamilies, R as portOn, S as BOOLS, T as ENUMS, Ut as RAMPS, Xt as createTheme, an as isToneOrHex, b as splitTrailingProps, c as isYuhwaPath, ct as groupPath, d as onlyColor, en as getTheme, f as parse, g as serializeProps, i as SETTING_VALUES, in as isSafeLink, k as PANEL_PROPS, l as joinPath, ln as themeNames, lt as groupProp, n as PANELS, nn as isGenericFont, nt as dashFor, on as ramp, p as parseProps, qt as THEME_NAMES, r as SETTING_HELP, rn as isSafeCss, s as blockBraces, sn as registerTheme, t as KNOWN_SETTINGS, u as lex, ut as lineStyle, v as setLineProp, w as EDGE_PROPS, x as unquote, xt as esc, y as setTrailingProp } from "./parse-BT2Xuqty.js";
4
+ import { a as svgFamilies, c as swapForRaster, n as embedFonts, r as loadFonts, s as svgToCanvas } from "./raster-C7BAAu8q.js";
5
+ import { $ as SHAPES, A as lex, B as BOOLS, Cn as isToneOrHex, Dn as themeNames, Dt as groupProp, Et as groupPath, F as serializeProps, G as NODE_PROPS, Gt as parseInline, H as EDGE_PROPS, J as PANEL_PROP_HELP, Jt as renderSegs, K as NUMBERS, L as setLineProp, M as parseProps, Ot as lineStyle, R as setTrailingProp, Sn as isSafeLink, Tn as registerTheme, U as ENUMS, V as COLORS, W as GROUP_PROPS, X as lint, Zt as segsW, _n as fontStack, bn as isGenericFont, bt as dashFor, c as joinPath, dn as THEME_NAMES, fn as TONES, ft as renderHead, gn as fontFamilies, gt as ALIGN_SIDES, i as SETTING_VALUES, in as tspans, j as onlyColor, k as blockBraces, l as parse, ln as THEMES, mn as createTheme, n as PANELS, nt as portOn, q as PANEL_PROPS, r as SETTING_HELP, s as isYuhwaPath, sn as RAMPS, t as KNOWN_SETTINGS, u as unquote, un as THEME_KEYS, vn as getTheme, wn as ramp, xn as isSafeCss, z as splitTrailingProps, zt as esc } from "./parse-B4TOA3gC.js";
6
6
  // src/browser.ts
7
7
  /**
8
8
  * Drop-in browser runtime: <script src="yuhwa.js"><\/script>
package/dist/canvas.js CHANGED
@@ -17,7 +17,7 @@ function installCanvas() {
17
17
  const swap = async (img) => {
18
18
  const svg = svgFromDataUri(img.getAttribute("src") ?? "");
19
19
  if (svg === void 0) return;
20
- const { swapForRaster } = await import("./raster-Dz9_MPsh.js").then((n) => n.i);
20
+ const { swapForRaster } = await import("./raster-C7BAAu8q.js").then((n) => n.i);
21
21
  const canvas = await swapForRaster(img, svg, "canvas", img.alt);
22
22
  if (canvas) canvas.className = img.className;
23
23
  };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
3
- import { A as unquote, C as SETTING_VALUES, E as joinPath, F as GROUP_PROPS, I as NODE_PROPS, K as esc, M as COLORS, N as EDGE_PROPS, P as ENUMS, Q as isSafeCss, R as PANEL_PROPS, T as isYuhwaPath, U as ALIGN_SIDES_HINT, V as SHAPES, X as THEME_NAMES, Y as THEME_KEYS, Z as TONES, _ as canvasMeasure, a as formatPage, b as KNOWN_SETTINGS, c as diskResolve, d as MD_LANGUAGES, f as findBlocks, g as replaceBlockSource, h as processMarkdown, i as format, l as render$1, m as pageBlocks, p as isMarkdown, s as tidy, t as VERSION, u as toSource, v as optionKind, y as registry } from "./shared-BuNGLF8_.js";
3
+ import { C as SETTING_VALUES, D as unquote, F as GROUP_PROPS, I as NODE_PROPS, K as esc, M as COLORS, N as EDGE_PROPS, P as ENUMS, Q as isSafeCss, R as PANEL_PROPS, T as joinPath, U as ALIGN_SIDES_HINT, V as SHAPES, X as THEME_NAMES, Y as THEME_KEYS, Z as TONES, _ as canvasMeasure, a as formatPage, b as KNOWN_SETTINGS, c as diskResolve, d as MD_LANGUAGES, f as findBlocks, g as replaceBlockSource, h as processMarkdown, i as format, l as render$1, m as pageBlocks, p as isMarkdown, s as tidy, t as VERSION, u as toSource, v as optionKind, w as isYuhwaPath, y as registry } from "./shared-DiOHyqG5.js";
4
4
  import { createServer } from "node:http";
5
5
  import { basename, dirname, extname, join, resolve, sep } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -328,9 +328,10 @@ yuhwa is a text diagram language that renders to a self-contained SVG. One
328
328
  statement per line. \`//\` at line start or after a space starts a comment, so
329
329
  URLs in labels stay text. There is no \`#\` comment.
330
330
 
331
- Workflow: write the source, run \`yuhwa check file.yu --json\` (or read the
332
- \`diagnostics\` of \`render\`), fix every error and warning, then render. Done
333
- when it reports 0 diagnostics; they name the fix ("did you mean ...").
331
+ Workflow: write the source, run \`yuhwa check file.yu --strict\` (\`--json\`
332
+ for a machine-readable report, or read the \`diagnostics\` of \`render\`), fix
333
+ every error and warning, then \`yuhwa render file.yu -o file.svg\`. Done when
334
+ it reports 0 diagnostics; they name the fix ("did you mean ...", "write ...").
334
335
 
335
336
  ## Example
336
337
 
@@ -353,6 +354,52 @@ orders -> db: SQL
353
354
  orders --> queue "Events" [shape: hexagon]: publish [flow: true]
354
355
  \`\`\`
355
356
 
357
+ ## Pick the construct
358
+
359
+ - Architecture, components, data flow: nodes, edges and groups (the graph).
360
+ - Process or flowchart: the graph with \`[diamond]\` decisions and \`yes\`/\`no\` edge labels.
361
+ - State machine: the graph with \`[pill]\` states and edges labelled by events.
362
+ - Calls over time (login flow, API handshake): a \`sequence\` panel.
363
+ - Project plan or schedule: \`gantt\`. Milestones or history: \`timeline\`.
364
+ - Branches and releases: \`git\`. Files and folders: \`treeview\`.
365
+ - Topic breakdown: \`mindmap\`. Task board: \`kanban\`.
366
+ - Numbers: \`chart\`. Two-axis prioritisation: \`quadrant\`.
367
+
368
+ Graph and panels mix in one file (see Panels).
369
+
370
+ ## Recipes
371
+
372
+ Flowchart with a decision and a loop back:
373
+
374
+ \`\`\`yuhwa
375
+ direction: down
376
+ start "Start" [pill, green]
377
+ form "Fill in form"
378
+ valid "Valid?" [diamond, amber]
379
+ save "Save order"
380
+ done "Done" [pill, green]
381
+ start -> form -> valid
382
+ valid -> save: yes
383
+ valid -> form: no [dashed]
384
+ save -> done
385
+ \`\`\`
386
+
387
+ State machine:
388
+
389
+ \`\`\`yuhwa
390
+ direction: right
391
+ .state [pill]
392
+ idle "Idle" .state
393
+ running "Running" .state [blue]
394
+ paused "Paused" .state
395
+ failed "Failed" .state [red]
396
+ idle -> running: start
397
+ running -> paused: pause
398
+ paused -> running: resume
399
+ running -> failed: error
400
+ failed -> idle: reset [dashed]
401
+ \`\`\`
402
+
356
403
  ## Statements
357
404
 
358
405
  - Setting: \`key: value\` at top level. Keys: ${settings}.
@@ -410,14 +457,21 @@ orders --> queue "Events" [shape: hexagon]: publish [flow: true]
410
457
 
411
458
  \`sub\` is a second, smaller line; \`icon\` an emoji before the label; \`link\`
412
459
  makes a node clickable; \`flow: true\` animates an edge; \`constraint: false\`
413
- keeps an edge out of the layout; \`merge: in|out|both\` joins edges sharing a node and side into one
414
- trunk with a single arrow head: as a setting, on a node or group (the edges ending there) or on an
415
- edge (its own ends); \`shape: text\` is an annotation without a box.
416
- \`below: <id>\`, \`above\`, \`right-of\`, \`left-of\` and \`rank\` place a node next to another
417
- node without drawing an edge; do not use invisible edges for that. \`align: [side] <id>\` lines a
418
- node or group up with another; on a group, \`align: <side>\` alone puts its members' <side> edges on one line, keeping their ranks. A group's
419
- \`gap: <px>\` spaces its members, also between ranks its own edges join (nested groups inherit it) and \`padding\` takes 1 to 4 numbers like
420
- CSS (\`8 24\` = top/bottom 8, left/right 24). The \`max-width: <px>\` setting
460
+ keeps an edge out of the layout; \`shape: text\` is an annotation without a box.
461
+
462
+ \`merge: in|out|both\` joins edges sharing a node and side into one trunk with
463
+ a single arrow head. It works as a setting, on a node or group (the edges
464
+ ending there) or on an edge (its own ends).
465
+
466
+ \`below: <id>\`, \`above\`, \`right-of\`, \`left-of\` and \`rank\` place a node
467
+ next to another node without drawing an edge; do not use invisible edges for
468
+ that. \`align: [side] <id>\` lines a node or group up with another. On a
469
+ group, \`align: <side>\` alone puts its members' <side> edges on one line,
470
+ keeping their ranks.
471
+
472
+ A group's \`gap: <px>\` spaces its members, also between ranks its own edges
473
+ join; nested groups inherit it. \`padding\` takes 1 to 4 numbers like CSS
474
+ (\`8 24\` = top/bottom 8, left/right 24). The \`max-width: <px>\` setting
421
475
  wraps the ranks of a right or left diagram into rows that fit that width.
422
476
  \`frame: <kind> <text>\` draws window chrome: ${list$1(registry.frames.keys())}.
423
477
 
@@ -475,6 +529,31 @@ lines take \`[props]\` before the colon or at the end of the line.
475
529
 
476
530
  ${panelLines}
477
531
 
532
+ \`\`\`yuhwa
533
+ panels: row
534
+ gantt plan "Launch" [today: 2026-03-10] {
535
+ --- Build ---
536
+ api "API": 2026-03-02, 5d
537
+ ui "UI" [active]: after api, 4d
538
+ --- Ship ---
539
+ beta "Beta" [milestone]: after ui, 0d
540
+ }
541
+ treeview repo "Repo" {
542
+ src/
543
+ index.ts
544
+ core/
545
+ parse.ts [modified]
546
+ package.json
547
+ }
548
+ git flow "Release" {
549
+ commit "init"
550
+ branch feature
551
+ commit "add login"
552
+ checkout main
553
+ merge feature [tag: v1.0]
554
+ }
555
+ \`\`\`
556
+
478
557
  ## Imports
479
558
 
480
559
  \`import "./shared.yu"\` at top level pulls in another file's classes,
@@ -505,8 +584,9 @@ layout {
505
584
  \`rank a b c\` keeps nodes in one rank. \`align ${ALIGN_SIDES_HINT} a b c\`
506
585
  lines up nodes or groups on one edge or their centres; neither pins anything.
507
586
 
508
- \`panel at X Y\` pins a panel. \`panel:part D\` (\`panel:part DX DY\` for free
509
- parts) nudges one part:
587
+ The editor also writes \`panel at X Y\` (pins a panel) and \`panel:part D\`
588
+ (\`panel:part DX DY\` for free parts, nudges one part). Keep them when editing;
589
+ never write them from scratch:
510
590
 
511
591
  ${partLines}
512
592
 
@@ -535,6 +615,9 @@ panel. \`yuhwa convert file.mmd\` prints the yuhwa source.
535
615
  - \`a -> b "calls"\` renames b. Edge labels: \`a -> b: calls\`.
536
616
  - Mermaid habits (\`%%\`, \`-->|label|\`, \`subgraph ... end\`, \`A[Label]\`) are
537
617
  \`//\`, \`a -> b: label\`, \`group id "Label" { }\`, \`a "Label"\` here.
618
+ Shapes are props: \`B{Ok?}\` is \`b "Ok?" [diamond]\`, \`C((Hub))\` is
619
+ \`c "Hub" [circle]\`, \`D[(DB)]\` is \`d "DB" [cylinder]\`.
620
+ - There is no \`label\` prop: the label is the quoted text after the id.
538
621
  - A node lives in one group; declaring it in a second one moves it.
539
622
  - A \`layout { }\` line for a node that no longer exists warns: delete it.
540
623
 
@@ -851,7 +934,7 @@ function svgToPng(svg, { scale = 2, fonts = [], systemFonts = true } = {}) {
851
934
  try {
852
935
  resvg = createRequire(import.meta.url)("@resvg/resvg-js").Resvg;
853
936
  } catch {
854
- throw new Error("PNG output needs @resvg/resvg-js: npm install -D @resvg/resvg-js, or pnpm add -D @resvg/resvg-js");
937
+ throw new Error("PNG output needs @resvg/resvg-js: npm install -D @resvg/resvg-js, or pnpm add -D @resvg/resvg-js. Through npx or pnpm dlx, fetch both: npx -p yuhwa -p @resvg/resvg-js yuhwa render diagram.yu -o diagram.png, or pnpm --package=yuhwa --package=@resvg/resvg-js dlx yuhwa render diagram.yu -o diagram.png");
855
938
  }
856
939
  }
857
940
  const { fontFiles, fontDirs } = fontPaths(fonts);
@@ -876,6 +959,16 @@ function parseLanguages(v) {
876
959
  if (!langs.length) throw new Error("--lang: give at least one fence language, e.g. --lang yuhwa,yu");
877
960
  return langs;
878
961
  }
962
+ // src/cli/report.ts
963
+ /** what a check report counts, shared by `yuhwa check` and `POST /check` */
964
+ const stats = (d) => ({
965
+ nodes: d.nodes.size,
966
+ edges: d.edges.length,
967
+ groups: d.groups.size,
968
+ panels: d.panels.length
969
+ });
970
+ /** no errors; with `strict` no warnings either */
971
+ const passes = (ds, strict = false) => !ds.some((d) => d.severity === "error" || strict && d.severity === "warning");
879
972
  // src/cli/view.ts
880
973
  /**
881
974
  * A standalone HTML page that shows one diagram in a full-window pan and zoom
@@ -914,7 +1007,7 @@ ${svg}
914
1007
  * GET /view?src=…, /view/<base64url>, /yuhwa/view/<deflate + base64url>
915
1008
  * the same as a page with pan and zoom
916
1009
  * POST /svg body: source (yuhwa, Mermaid or JSON)
917
- * POST /check body: source → { ok, format, diagnostics }
1010
+ * POST /check body: source → { ok, format, nodes, edges, groups, panels, diagnostics }
918
1011
  * GET /llms.txt language reference for AI tools
919
1012
  *
920
1013
  * Output is deterministic, so GET responses are cacheable forever.
@@ -1055,8 +1148,9 @@ function handler(req, res) {
1055
1148
  if (path !== "/check") return sendSvg(source, false);
1056
1149
  const r = render$1(source, { theme });
1057
1150
  sendJson(200, {
1058
- ok: !r.diagnostics.some((d) => d.severity === "error"),
1151
+ ok: passes(r.diagnostics),
1059
1152
  format: r.format,
1153
+ ...stats(r.diagram),
1060
1154
  diagnostics: r.diagnostics
1061
1155
  });
1062
1156
  }).catch((e) => {
@@ -1367,7 +1461,7 @@ const HELP = `yuhwa — diagrams that look good and stay where you put them
1367
1461
 
1368
1462
  Usage
1369
1463
  yuhwa render <file|-> [-o out.svg|out.html|out.png] [--html] [--png] [--scale 2] [--font f] [--no-system-fonts] [--theme name] [--block n]
1370
- yuhwa check <file|-...> [--json] [--lang yuhwa,yu]
1464
+ yuhwa check <file|-...> [--json] [--strict] [--lang yuhwa,yu]
1371
1465
  yuhwa lint <file...> [--fix] [--json] [--lang yuhwa,yu]
1372
1466
  yuhwa convert <file.mmd|file.json|-> [-o out.yu]
1373
1467
  yuhwa md <file.md...> [--out-dir diagrams] [--dark] [--keep-fences] [--view[=base]]
@@ -1390,6 +1484,7 @@ render Render one diagram to SVG (stdout unless -o is given). From a
1390
1484
  uses system fonts; --font adds a font file or folder (repeatable),
1391
1485
  --no-system-fonts uses only those, the same on every machine.
1392
1486
  check Validate without rendering. --json prints machine-readable diagnostics.
1487
+ --strict fails on warnings too (exit code 1, \`ok: false\`).
1393
1488
  A .md/.mdx/.markdown file is checked block by block: every
1394
1489
  \`\`\`yuhwa and \`\`\`yu fence (--lang picks others) and every
1395
1490
  <!--yuhwa --> comment, with line numbers in the Markdown file.
@@ -1474,7 +1569,7 @@ function cmdRender(a) {
1474
1569
  background: r.layout.theme.background
1475
1570
  }));
1476
1571
  } else writeOut(out, r.svg + "\n");
1477
- if (r.diagnostics.some((d) => d.severity === "error")) process.exitCode = 1;
1572
+ if (!passes(r.diagnostics)) process.exitCode = 1;
1478
1573
  }
1479
1574
  const fileOpts = (file) => ({
1480
1575
  resolve: diskResolve,
@@ -1509,7 +1604,8 @@ function checkPage(file, a) {
1509
1604
  const counts = {
1510
1605
  nodes: 0,
1511
1606
  edges: 0,
1512
- groups: 0
1607
+ groups: 0,
1608
+ panels: 0
1513
1609
  };
1514
1610
  const entries = blocks.map((b) => {
1515
1611
  const r = renderAs(a, file, b.source);
@@ -1517,18 +1613,14 @@ function checkPage(file, a) {
1517
1613
  ...d,
1518
1614
  block: b.index
1519
1615
  });
1520
- const { nodes, edges, groups } = r.diagram;
1521
- counts.nodes += nodes.size;
1522
- counts.edges += edges.length;
1523
- counts.groups += groups.size;
1616
+ const n = stats(r.diagram);
1617
+ for (const k of Object.keys(counts)) counts[k] += n[k];
1524
1618
  const { source: _, ...where } = b;
1525
1619
  return {
1526
1620
  ...where,
1527
- ok: !r.diagnostics.some((d) => d.severity === "error"),
1621
+ ok: passes(r.diagnostics, !!a.strict),
1528
1622
  format: r.format,
1529
- nodes: nodes.size,
1530
- edges: edges.length,
1531
- groups: groups.size
1623
+ ...n
1532
1624
  };
1533
1625
  });
1534
1626
  const ok = entries.every((e) => e.ok);
@@ -1558,9 +1650,8 @@ function cmdCheck(a) {
1558
1650
  perFile(a, "check", (file) => {
1559
1651
  if (isMarkdown(file)) return checkPage(file, a);
1560
1652
  const r = renderAs(a, file, readInput(file));
1561
- const ok = !r.diagnostics.some((d) => d.severity === "error");
1653
+ const ok = passes(r.diagnostics, !!a.strict);
1562
1654
  if (!ok) process.exitCode = 1;
1563
- const { nodes, edges, groups } = r.diagram;
1564
1655
  if (!a.json) {
1565
1656
  printDiagnostics(file, r.diagnostics);
1566
1657
  process.stderr.write(`${file}: ${ok ? "ok" : "errors"} (${r.format}, ${r.diagnostics.length} diagnostic(s))\n`);
@@ -1569,9 +1660,7 @@ function cmdCheck(a) {
1569
1660
  file,
1570
1661
  ok,
1571
1662
  format: r.format,
1572
- nodes: nodes.size,
1573
- edges: edges.length,
1574
- groups: groups.size,
1663
+ ...stats(r.diagram),
1575
1664
  diagnostics: r.diagnostics
1576
1665
  };
1577
1666
  });
@@ -1633,7 +1722,7 @@ function cmdConvert(a) {
1633
1722
  if (!file) throw new Error("convert: missing input file");
1634
1723
  const r = toSource(readInput(file));
1635
1724
  printDiagnostics(file, r.diagnostics);
1636
- if (r.diagnostics.some((d) => d.severity === "error")) {
1725
+ if (!passes(r.diagnostics)) {
1637
1726
  process.exitCode = 1;
1638
1727
  return;
1639
1728
  }
@@ -1664,7 +1753,7 @@ function cmdMd(a) {
1664
1753
  ...fileOpts(file)
1665
1754
  });
1666
1755
  for (const d of res.diagnostics) process.stderr.write(`${file} [${d.block}]:${d.line}: ${d.severity}: ${d.message}\n`);
1667
- if (res.diagnostics.some((d) => d.severity === "error")) process.exitCode = 1;
1756
+ if (!passes(res.diagnostics)) process.exitCode = 1;
1668
1757
  const base = dirname(resolve(file));
1669
1758
  for (const f of res.files) {
1670
1759
  const p = join(base, f.path);