yuhwa 1.11.0 → 1.12.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.
@@ -1,6 +1,6 @@
1
1
  import { $ as AFTER_LAYOUT, $t as f$1, A as MAX_NUMBER, B as placementOf, Bt as panelTheme, C as SETTING_VALUES, Cn as SCHEMES, D as EDGE_PROPS, Dn as TONES, Dt as listsIds, Et as alignSide, Fn as isColor, G as normalizeShape, Gt as resolvePanelStyle, Ht as resolveEdgeStyle, I as SIDES$2, It as inheritedProp, Jn as errorText, Jt as withEdgeInk, Kt as size, L as didYouMean, Lt as isLane, Mn as fontStack, Mt as groupGap, Nn as getScheme, Nt as groupPadding, On as bool, Pn as getTheme, Pt as groupPath, Q as textOffset, Qt as esc, R as inRange, Rn as isSafeLink, S as SETTING_NAMES, Tn as THEME_KEYS, Tt as alignSets, Un as resolveColor, Ut as resolveGroupStyle, V as propLine, Vt as posNum, W as SIDE_NORMAL, Wn as themeNames, Wt as resolveNodeStyle, X as shapePath, Xn as ownerOf, Xt as bakeBaselines, Y as shapeDetail, Z as sizeForShape, Zn as table, Zt as dedent, _ as unescape, _n as tspans, _t as sub, a as lex, at as headSize, b as KNOWN_SETTINGS, c as parseProps, cn as richText, ct as trimFor, d as serializeProps, dt as center, en as fontAttrs, et as MARKER_KINDS, f as serializeValue, fn as splitWords, ft as hits, g as stripComment$1, gn as textLines, gt as sample, hn as textEl, ht as pointAtHalf, i as blockBraces, in as parseInline, it as endDirection, j as NODE_PROPS, jt as effectiveProps, k as GROUP_PROPS, kt as edgeFont, l as propKey, ln as richW, lt as SIDES$1, mn as sumW, mt as pathData, n as addNodeProps, nn as lineHeight, o as nodeProps, on as plain, ot as labelSpot, pn as subInk, pt as norm, q as portPoint, qn as collecting, qt as textFont, r as arrowInfo, rn as nodeInk, rt as renderHead, sn as renderSegs, st as trim, t as KEYED_TAIL_RE, tt as POST_RENDER, u as quote$1, un as segsW, ut as add, v as unquote, vt as orthoRoute, w as STATEMENT_KEYWORDS, wt as ALIGN_SIDES_HINT, y as DIRECTION_ALIASES, yn as MONO, yt as smoothRoute, z as lint, zt as num } from "./lex-BODknbgk.js";
2
- import { C as TRANSFORMS, S as STATEMENTS, b as unknownPanelHint, c as drawText, f as startMeasure, g as registry, u as approxMeasure, x as PANELS, y as foreignHint } from "./plugin-0SWraI4f.js";
3
- import { J as indentTree, a as taskLine, d as csvFields, r as labelToken, s as clampScore, u as toEbnf } from "./edit-CGlOr7JF.js";
2
+ import { C as STATEMENTS, S as PANELS, b as foreignHint, c as drawText, f as startMeasure, g as registry, u as approxMeasure, w as TRANSFORMS, x as unknownPanelHint, y as HASH_COMMENT } from "./plugin-BCLARrq1.js";
3
+ import { J as indentTree, a as taskLine, d as csvFields, r as labelToken, s as clampScore, u as toEbnf } from "./edit-Cm8DW_KO.js";
4
4
  // src/core/route/sides.ts
5
5
  /** Choose the side of `box` facing `target`. */
6
6
  function autoSide(box, target, other, dir) {
@@ -1588,6 +1588,10 @@ function groupStmt(p, t, raw, li) {
1588
1588
  if (close >= 0) {
1589
1589
  ref.end = li;
1590
1590
  for (let j = k; j < close; j++) if (t[j].kind === "ident") touchNode(p, t[j].value).group = id;
1591
+ else if (t[j].value !== ",") {
1592
+ p.warn(li, `A one-line group lists ids only ("${t[j].value}" is ignored): declare labels and props inside a multi-line { } body`);
1593
+ break;
1594
+ }
1591
1595
  return;
1592
1596
  }
1593
1597
  p.stack.push({
@@ -2007,7 +2011,7 @@ function parse(source, opts = {}) {
2007
2011
  /** one source line: variables, components, then the statement itself */
2008
2012
  function step(p, raw0, li, done = false, scope = p.defs) {
2009
2013
  if (/^\s*#(\s|$)/.test(raw0)) {
2010
- p.warn(li, "Comments start with \"//\", not \"#\"", "error");
2014
+ p.warn(li, HASH_COMMENT, "error");
2011
2015
  return;
2012
2016
  }
2013
2017
  const top = p.stack[p.stack.length - 1];
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-CT1lI4A1.js";
3
+ import { n as onTrack, o as clientImports, r as pagesUsing } from "./node-BIfDM5Y3.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.js CHANGED
@@ -1,10 +1,10 @@
1
- import { t as GUIDE } from "./src-DmT2jkJ-.js";
2
- import { _ as unuse, d as canvasMeasure, g as registry, h as recolor, m as perPass, p as optionKind, u as approxMeasure, v as use, x as PANELS } from "./plugin-0SWraI4f.js";
1
+ import { t as GUIDE } from "./src-DUTNi3wt.js";
2
+ import { S as PANELS, _ as unuse, d as canvasMeasure, g as registry, h as recolor, m as perPass, p as optionKind, u as approxMeasure, v as use } from "./plugin-BCLARrq1.js";
3
3
  import { n as zoomable, t as zoomHeight } from "./zoom-D3Lahr1T.js";
4
- import { A as shapes, C as legend, D as charts, E as tables, O as themes, S as sequence, T as frames, _ as gantt, b as chart, g as quadrant, h as kanban, k as markers, m as treeview, t as builtins, v as mindmap, w as footer, x as timeline, y as git } from "./plugins-3oYK28f5.js";
4
+ import { A as shapes, C as legend, D as charts, E as tables, O as themes, S as sequence, T as frames, _ as gantt, b as chart, g as quadrant, h as kanban, k as markers, m as treeview, t as builtins, v as mindmap, w as footer, x as timeline, y as git } from "./plugins-BoaNpGLq.js";
5
5
  import { a as svgFamilies, c as swapForRaster, n as embedFonts, r as loadFonts, s as svgToCanvas } from "./raster-D1uJMbl7.js";
6
6
  import { Bn as plainThemeNames, C as SETTING_VALUES, Cn as SCHEMES, Ct as ALIGN_SIDES, D as EDGE_PROPS, Dn as TONES, E as COLORS, En as THEME_NAMES, Ft as groupProp, H as SHAPES, Hn as registerTheme, In as isGenericFont, K as portOn, Ln as isSafeCss, M as NUMBERS, Mn as fontStack, N as PANEL_PROPS, Nn as getScheme, O as ENUMS, Ot as dashFor, P as PANEL_PROP_HELP, Pn as getTheme, Pt as groupPath, Qt as esc, Rn as isSafeLink, Rt as lineStyle, T as BOOLS, Tn as THEME_KEYS, Vn as ramp, Wn as themeNames, _n as tspans, a as lex, b as KNOWN_SETTINGS, bn as PLAIN_THEMES, c as parseProps, d as serializeProps, h as splitTrailingProps, i as blockBraces, in as parseInline, j as NODE_PROPS, jn as fontFamilies, k as GROUP_PROPS, kn as createTheme, m as setTrailingProp, p as setLineProp, rt as renderHead, s as onlyColor, sn as renderSegs, un as segsW, v as unquote, wn as THEMES, x as SETTING_HELP, xn as RAMPS, z as lint, zn as isToneOrHex } from "./lex-BODknbgk.js";
7
- import { A as joinPath, C as isMermaid, D as GRID, E as layout, O as parse, S as fromMermaid, T as renderSvg, _ as setPartTone, a as MD_LANGUAGES, b as writeLayout, d as addEdge, f as addNode, g as setLabel, h as removeElement, i as toSource, k as isYuhwaPath, l as processMarkdown, m as formatLayout, n as render$1, o as findBlocks, p as editPart, r as renderText, t as hash, u as replaceBlockSource, v as setProp, w as fromJSON, x as writePanelDrag, y as setSetting } from "./api-DgN94Ia1.js";
7
+ import { A as joinPath, C as isMermaid, D as GRID, E as layout, O as parse, S as fromMermaid, T as renderSvg, _ as setPartTone, a as MD_LANGUAGES, b as writeLayout, d as addEdge, f as addNode, g as setLabel, h as removeElement, i as toSource, k as isYuhwaPath, l as processMarkdown, m as formatLayout, n as render$1, o as findBlocks, p as editPart, r as renderText, t as hash, u as replaceBlockSource, v as setProp, w as fromJSON, x as writePanelDrag, y as setSetting } from "./api-B9O53_5U.js";
8
8
  // src/browser.ts
9
9
  /**
10
10
  * Drop-in browser runtime: <script src="yuhwa.js"><\/script>
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 { $ as THEME_KEYS, A as SETTING_VALUES, E as unquote, F as ENUMS, G as ALIGN_SIDES_HINT, I as GROUP_PROPS, J as esc, L as NODE_PROPS, N as COLORS, O as KNOWN_SETTINGS, P as EDGE_PROPS, Q as SCHEMES, S as registry, U as SHAPES, Z as PLAIN_THEMES, _ as replaceBlockSource, a as formatPage, b as canvasMeasure, c as diskResolve, d as toSource, et as THEME_NAMES, f as MD_LANGUAGES, g as processMarkdown, h as pageBlocks, i as format, l as render$1, m as isMarkdown, nt as isSafeCss, ot as isYuhwaPath, p as findBlocks, s as tidy, st as joinPath, t as VERSION, tt as TONES, u as renderText, x as optionKind, z as PANEL_PROPS } from "./shared-pKyDW6fZ.js";
3
+ import { $ as THEME_KEYS, A as SETTING_VALUES, E as unquote, F as ENUMS, G as ALIGN_SIDES_HINT, I as GROUP_PROPS, J as esc, L as NODE_PROPS, N as COLORS, O as KNOWN_SETTINGS, P as EDGE_PROPS, Q as SCHEMES, S as registry, U as SHAPES, Z as PLAIN_THEMES, _ as replaceBlockSource, a as formatPage, b as canvasMeasure, c as diskResolve, d as toSource, et as THEME_NAMES, f as MD_LANGUAGES, g as processMarkdown, h as pageBlocks, i as format, l as render$1, m as isMarkdown, nt as isSafeCss, ot as isYuhwaPath, p as findBlocks, s as tidy, st as joinPath, t as VERSION, tt as TONES, u as renderText, x as optionKind, z as PANEL_PROPS } from "./shared-DF-gLxrJ.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";
@@ -335,6 +335,9 @@ Workflow: write the source, run \`yuhwa check file.yu --strict\` (\`--json\`
335
335
  for a machine-readable report, or read the \`diagnostics\` of \`render\`), fix
336
336
  every error and warning, then \`yuhwa render file.yu -o file.svg\`. Done when
337
337
  it reports 0 diagnostics; they name the fix ("did you mean ...", "write ...").
338
+ To see the layout without an image viewer, \`yuhwa render file.yu --text\`
339
+ draws it with box-drawing characters: check that every node, edge and label
340
+ landed where you meant.
338
341
 
339
342
  ## Example
340
343
 
@@ -1532,7 +1535,8 @@ url Print an embeddable image URL for a diagram (for \`serve\`).
1532
1535
  --view prints a link to a page that pans and zooms it instead:
1533
1536
  the hosted viewer, or your \`serve\` with --base.
1534
1537
  guide Print the language reference (same as llms.txt). AI agents: read
1535
- this first, then write source and run \`check --json\` until it is clean.
1538
+ this first, then write source and run \`check --json\` until it is clean,
1539
+ and \`render --text\` to look at the layout.
1536
1540
  `;
1537
1541
  /** flags that take a value; repeatable ones collect every value in a list */
1538
1542
  const VALUE_FLAGS = /* @__PURE__ */ new Set([
@@ -1,5 +1,5 @@
1
1
  import { $t as f, Fn as isColor, Qt as esc, Un as resolveColor, Vn as ramp, _n as tspans, h as splitTrailingProps, in as parseInline, m as setTrailingProp, p as setLineProp, rn as nodeInk, s as onlyColor, tn as inkColor, u as quote$1, un as segsW, v as unquote, zt as num } from "./lex-BODknbgk.js";
2
- import { m as perPass } from "./plugin-0SWraI4f.js";
2
+ import { m as perPass } from "./plugin-BCLARrq1.js";
3
3
  // src/plugins/shared.ts
4
4
  /** the moves item `k` of `n` has: up unless first, down unless last */
5
5
  const moveActions = (k, n) => [...k > 0 ? ["up"] : [], ...k < n - 1 ? ["down"] : []];