yuhwa 1.5.1 → 1.5.2

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/README.md +1 -1
  2. package/dist/astro.d.ts +1 -1
  3. package/dist/astro.js +1 -1
  4. package/dist/browser.d.ts +1 -1
  5. package/dist/browser.js +9 -6
  6. package/dist/canvas.js +1 -1
  7. package/dist/cli.js +32 -11
  8. package/dist/editor/assets/index-DyXXchTq.js +689 -0
  9. package/dist/editor/assets/{lsp.worker-C3Z1Mv2o.js → lsp.worker-BuZEbjK9.js} +22 -22
  10. package/dist/editor/index.html +1 -1
  11. package/dist/{figure-BA0baRTM.d.ts → figure-BtRpJvZ9.d.ts} +1 -1
  12. package/dist/{index-DG5JlX3s.d.ts → index-C6v0NhkF.d.ts} +1 -0
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +4 -4
  15. package/dist/ironmark.d.ts +1 -1
  16. package/dist/ironmark.js +1 -1
  17. package/dist/lsp-browser.js +1 -1
  18. package/dist/lsp-node.js +6 -3
  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-sVTeEPkh.js → node-Cdzt2Mis.js} +6 -6
  24. package/dist/{parse-B8adkq5n.js → parse-fnqTkelX.js} +48 -21
  25. package/dist/{plugin-D0dl0pi7.js → plugin-DX1Pv2Tq.js} +1 -1
  26. package/dist/plugin.js +2 -2
  27. package/dist/{raster-C9Ks31AI.js → raster-B_SJsm-q.js} +3 -3
  28. package/dist/remark.d.ts +1 -1
  29. package/dist/remark.js +1 -1
  30. package/dist/satteri.d.ts +1 -1
  31. package/dist/satteri.js +1 -1
  32. package/dist/{server-CnVuHCkF.js → server-BW2tKjSu.js} +6 -3
  33. package/dist/{service-CrHH2VV_.js → service-CXRIavFP.js} +4 -4
  34. package/dist/{shared-H9nq7QLk.js → shared-DJCDEbFf.js} +1560 -1208
  35. package/dist/{src-DyMPSQux.js → src-CQ8ltV_K.js} +1512 -1184
  36. package/dist/vite.d.ts +1 -1
  37. package/dist/vite.js +3 -3
  38. package/dist/vuepress.d.ts +1 -1
  39. package/dist/vuepress.js +1 -1
  40. package/dist/yuhwa.iife.js +54 -54
  41. package/dist/{zoom-yxhxX16c.js → zoom-D3Lahr1T.js} +1 -1
  42. package/dist/{zoom-script-CaJ5MNUw.js → zoom-script-DPxmav2F.js} +1 -1
  43. package/dist/zoom.js +2 -2
  44. package/package.json +1 -1
  45. package/dist/editor/assets/index-B-h3Fc8X.js +0 -689
package/README.md CHANGED
@@ -260,7 +260,7 @@ Rules-file and skill snippets: [AI guide](https://ph1p.github.io/yuhwa/guide/ai)
260
260
  `yuhwa-lsp` ships with the `yuhwa` package: diagnostics, quick fixes,
261
261
  completion, hover, rename, formatting and semantic colouring.
262
262
 
263
- - **VS Code, Cursor, VSCodium:** the extension in [`packages/vscode`](https://github.com/ph1p/yuhwa/blob/main/packages/vscode) bundles the server.
263
+ - **VS Code, Cursor, VSCodium:** the [extension](https://marketplace.visualstudio.com/items?itemName=ph1p.yuhwa-vscode) bundles the server (source in [`packages/vscode`](https://github.com/ph1p/yuhwa/blob/main/packages/vscode)).
264
264
  - **Zed:** extension in [`packages/zed`](https://github.com/ph1p/yuhwa/blob/main/packages/zed).
265
265
  - **Neovim, Helix, Sublime, Emacs, JetBrains, Vim, Kate:** point the editor at `yuhwa-lsp --stdio` for `.yu` files.
266
266
 
package/dist/astro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as YuhwaDocsOptions } from "./figure-BA0baRTM.js";
1
+ import { t as YuhwaDocsOptions } from "./figure-BtRpJvZ9.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-sVTeEPkh.js";
3
+ import { n as onTrack, o as clientImports, r as pagesUsing } from "./node-Cdzt2Mis.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
@@ -12,7 +12,7 @@
12
12
  * el.source = 'a -> b' // re-renders
13
13
  */
14
14
  import { $ as Point, A as Diagnostic, At as registry, B as LaidNode, C as setLineProp, Cn as canvasMeasure, Ct as RowKind, D as Box, Dt as optionKind, Et as YuhwaPlugin, F as GroupDecl, Ft as renderHead, G as NodeOverride, Gt as segsW, H as Layout, Ht as parseInline, I as HeadKind, It as InkColors, J as PanelOverride, Jt as tspans, K as PanelDecl, L as LabelRef, Lt as Seg, M as Direction, Mt as use, N as EdgeDecl, Nt as MarkerKind, O as Component, Ot as perPass, P as EdgeOverride, Pt as ShapeKind, Q as PartEdit, Qt as RAMPS, R as LaidEdge, Rt as esc, S as serializeProps, Sn as approxMeasure, St as RowCtx, T as splitTrailingProps, Tt as StatementKind, U as LayoutOverrides, V as LaidPanel, W as NodeDecl, Wt as renderSegs, X as PartAction, Xt as LineStyle, Y as PanelPart, Z as PartChange, _ as joinPath, _n as ramp, _t as Decoration, a as portOn, an as ThemeInput, at as SourceRef, b as parse, bn as themeNames, bt as PanelKind, c as KNOWN_SETTINGS, ct as groupPath, d as ParseOptions, dn as getTheme, en as THEMES, et as Props, f as SETTING_VALUES, g as isYuhwaPath, gn as isToneOrHex, h as blockBraces, hn as isSafeLink, in as Theme, it as Side, j as Diagram, jt as unuse, k as Curve, kt as recolor, l as LexedLine, ln as fontFamilies, lt as layout, m as TokKind, mn as isSafeCss, nn as THEME_NAMES, nt as ResolvedNodeStyle, ot as GRID, p as Tok, pn as isGenericFont, pt as lineStyle, q as PanelHandle, r as SHAPES, rn as TONES, rt as ShapeName, sn as createTheme, tn as THEME_KEYS, tt as ResolvedEdgeStyle, u as PANELS, un as fontStack, ut as dashFor, v as lex, vn as registerTheme, vt as FrameKind, w as setTrailingProp, wt as RowPaint, x as parseProps, xt as PanelOption, y as onlyColor, yt as PanelCtx, z as LaidGroup } from "./plugin-DhSeDLo1.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 fromJSON, et as editPart, f as mindmap, ft as renderSvg, g as sequence, h as timeline, i as hash, it as setPartTone, j as NODE_PROPS, k as ENUMS, l as kanban, lt as DiagramJSON, m as chart, n as Options, nt as removeElement, o as toSource, ot as setSetting, p as git, 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 JsonResult, v as footer, w as shapes, x as charts, y as frames, z as MD_LANGUAGES } from "./index-DG5JlX3s.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 fromJSON, et as editPart, f as mindmap, ft as renderSvg, g as sequence, h as timeline, i as hash, it as setPartTone, j as NODE_PROPS, k as ENUMS, l as kanban, lt as DiagramJSON, m as chart, n as Options, nt as removeElement, o as toSource, ot as setSetting, p as git, 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 JsonResult, v as footer, w as shapes, x as charts, y as frames, z as MD_LANGUAGES } from "./index-C6v0NhkF.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 treeview, B as footer, C as isMermaid, D as groupPath, E as GRID, F as git, G as markers, H as tables, I as chart, K as shapes, L as timeline, M as quadrant, N as gantt, O as layout, P as mindmap, R as sequence, S as fromMermaid, T as renderSvg, U as charts, V as frames, W as themes, _ 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 kanban, k as builtins, 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 legend } from "./src-DyMPSQux.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-D0dl0pi7.js";
3
- import { n as zoomable, t as zoomHeight } from "./zoom-yxhxX16c.js";
4
- import { a as svgFamilies, c as swapForRaster, n as embedFonts, r as loadFonts, s as svgToCanvas } from "./raster-C9Ks31AI.js";
5
- import { $ as lineStyle, C as EDGE_PROPS, D as NUMBERS, E as NODE_PROPS, Ft as THEME_KEYS, Gt as isGenericFont, Ht as fontStack, It as THEME_NAMES, Jt as isToneOrHex, Kt as isSafeCss, L as portOn, Lt as TONES, Mt as RAMPS, O as PANEL_PROPS, P as SHAPES, Pt as THEMES, Qt as themeNames, S as COLORS, St as segsW, T as GROUP_PROPS, Ut as getTheme, Vt as fontFamilies, Xt as registerTheme, Y as dashFor, Yt as ramp, _ as setLineProp, b as unquote, c as joinPath, d as parse, f as parseProps, gt as parseInline, h as serializeProps, j as lint, k as PANEL_PROP_HELP, kt as tspans, l as lex, n as PANELS, o as blockBraces, q as renderHead, qt as isSafeLink, r as SETTING_VALUES, s as isYuhwaPath, t as KNOWN_SETTINGS, u as onlyColor, ut as esc, v as setTrailingProp, w as ENUMS, x as BOOLS, y as splitTrailingProps, yt as renderSegs, zt as createTheme } from "./parse-B8adkq5n.js";
1
+ import { A as treeview, B as footer, C as isMermaid, D as groupPath, E as GRID, F as git, G as markers, H as tables, I as chart, K as shapes, L as timeline, M as quadrant, N as gantt, O as layout, P as mindmap, R as sequence, S as fromMermaid, T as renderSvg, U as charts, V as frames, W as themes, _ 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 kanban, k as builtins, 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 legend } from "./src-CQ8ltV_K.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-DX1Pv2Tq.js";
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-B_SJsm-q.js";
5
+ import { $ as lineStyle, C as EDGE_PROPS, D as NUMBERS, E as NODE_PROPS, Ft as THEME_KEYS, Gt as isGenericFont, Ht as fontStack, It as THEME_NAMES, Jt as isToneOrHex, Kt as isSafeCss, L as portOn, Lt as TONES, Mt as RAMPS, O as PANEL_PROPS, P as SHAPES, Pt as THEMES, Qt as themeNames, S as COLORS, St as segsW, T as GROUP_PROPS, Ut as getTheme, Vt as fontFamilies, Xt as registerTheme, Y as dashFor, Yt as ramp, _ as setLineProp, b as unquote, c as joinPath, d as parse, f as parseProps, gt as parseInline, h as serializeProps, j as lint, k as PANEL_PROP_HELP, kt as tspans, l as lex, n as PANELS, o as blockBraces, q as renderHead, qt as isSafeLink, r as SETTING_VALUES, s as isYuhwaPath, t as KNOWN_SETTINGS, u as onlyColor, ut as esc, v as setTrailingProp, w as ENUMS, x as BOOLS, y as splitTrailingProps, yt as renderSegs, zt as createTheme } from "./parse-fnqTkelX.js";
6
6
  // src/browser.ts
7
7
  /**
8
8
  * Drop-in browser runtime: <script src="yuhwa.js"><\/script>
@@ -176,7 +176,10 @@ var YuhwaDiagram = class extends Base {
176
176
  this.#draw();
177
177
  }
178
178
  connectedCallback() {
179
- if (document.readyState === "loading" && !this.textContent?.trim() && !this.hasAttribute("src")) return void document.addEventListener("DOMContentLoaded", () => this.connectedCallback(), { once: true });
179
+ if (document.readyState === "loading" && !this.textContent?.trim() && !this.hasAttribute("src")) {
180
+ document.addEventListener("DOMContentLoaded", () => this.connectedCallback(), { once: true });
181
+ return;
182
+ }
180
183
  if (this.#source === null && !this.hasAttribute("src")) this.#source = this.textContent ?? "";
181
184
  this.#update();
182
185
  }
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-C9Ks31AI.js").then((n) => n.i);
20
+ const { swapForRaster } = await import("./raster-B_SJsm-q.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 { B as SHAPES, F as NODE_PROPS, G as THEME_KEYS, H as esc, J as isSafeCss, K as THEME_NAMES, L as PANEL_PROPS, M as EDGE_PROPS, N as ENUMS, P as GROUP_PROPS, S as SETTING_VALUES, T as joinPath, _ 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, j as COLORS, k as unquote, l as render$1, m as pageBlocks, p as isMarkdown, q as TONES, s as tidy, t as VERSION, u as toSource, v as optionKind, w as isYuhwaPath, y as registry } from "./shared-H9nq7QLk.js";
3
+ import { B as SHAPES, F as NODE_PROPS, G as THEME_KEYS, H as esc, J as isSafeCss, K as THEME_NAMES, L as PANEL_PROPS, M as EDGE_PROPS, N as ENUMS, P as GROUP_PROPS, S as SETTING_VALUES, T as joinPath, _ 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, j as COLORS, k as unquote, l as render$1, m as pageBlocks, p as isMarkdown, q as TONES, s as tidy, t as VERSION, u as toSource, v as optionKind, w as isYuhwaPath, y as registry } from "./shared-DJCDEbFf.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";
@@ -109,7 +109,7 @@ function inUnicodeRange(range, chars) {
109
109
  /** first downloadable `url(...)` in an @font-face src, resolved against `base` */
110
110
  function srcUrl(src, base) {
111
111
  const m = src.match(/url\(\s*(['"]?)(.*?)\1\s*\)/);
112
- if (!m) return void 0;
112
+ if (!m) return;
113
113
  try {
114
114
  return new URL(m[2], base).href;
115
115
  } catch {
@@ -119,7 +119,7 @@ function srcUrl(src, base) {
119
119
  function faceFrom(get, base) {
120
120
  const url = srcUrl(get("src"), base);
121
121
  const family = unquote(get("font-family"));
122
- if (!url || !family) return void 0;
122
+ if (!url || !family) return;
123
123
  return {
124
124
  family,
125
125
  url,
@@ -806,7 +806,7 @@ function zoomable(host, opts = {}) {
806
806
  */
807
807
  function zoomHeight(value) {
808
808
  const v = value?.trim();
809
- if (!v || v === "true") return void 0;
809
+ if (!v || v === "true") return;
810
810
  return /^\d+(\.\d+)?$/.test(v) ? `${v}px` : v;
811
811
  }
812
812
  // src/integrations/png.ts
@@ -973,7 +973,10 @@ const HOME = (origin) => `<!doctype html><meta charset="utf-8"><title>yuhwa rend
973
973
  function handler(req, res) {
974
974
  res.setHeader("access-control-allow-origin", "*");
975
975
  res.setHeader("access-control-allow-headers", "content-type");
976
- if (req.method === "OPTIONS") return void res.writeHead(204).end();
976
+ if (req.method === "OPTIONS") {
977
+ res.writeHead(204).end();
978
+ return;
979
+ }
977
980
  const url = new URL(req.url ?? "/", "http://localhost");
978
981
  const path = url.pathname;
979
982
  const theme = url.searchParams.get("theme") ?? void 0;
@@ -1007,8 +1010,14 @@ function handler(req, res) {
1007
1010
  const fail = (status, message) => sendJson(status, { error: message });
1008
1011
  try {
1009
1012
  if (req.method === "GET") {
1010
- if (path === "/") return void res.writeHead(200, { "content-type": "text/html; charset=utf-8" }).end(HOME(`http://${req.headers.host ?? "localhost"}`));
1011
- if (path === "/llms.txt" || path === "/guide") return void res.writeHead(200, { "content-type": "text/plain; charset=utf-8" }).end(GUIDE);
1013
+ if (path === "/") {
1014
+ res.writeHead(200, { "content-type": "text/html; charset=utf-8" }).end(HOME(`http://${req.headers.host ?? "localhost"}`));
1015
+ return;
1016
+ }
1017
+ if (path === "/llms.txt" || path === "/guide") {
1018
+ res.writeHead(200, { "content-type": "text/plain; charset=utf-8" }).end(GUIDE);
1019
+ return;
1020
+ }
1012
1021
  if (path === "/health") return sendJson(200, { ok: true });
1013
1022
  if (path === "/svg" || path === "/svg.svg") {
1014
1023
  const src = url.searchParams.get("src");
@@ -1270,7 +1279,10 @@ var YuhwaDiagram = class extends Base {
1270
1279
  this.#draw();
1271
1280
  }
1272
1281
  connectedCallback() {
1273
- if (document.readyState === "loading" && !this.textContent?.trim() && !this.hasAttribute("src")) return void document.addEventListener("DOMContentLoaded", () => this.connectedCallback(), { once: true });
1282
+ if (document.readyState === "loading" && !this.textContent?.trim() && !this.hasAttribute("src")) {
1283
+ document.addEventListener("DOMContentLoaded", () => this.connectedCallback(), { once: true });
1284
+ return;
1285
+ }
1274
1286
  if (this.#source === null && !this.hasAttribute("src")) this.#source = this.textContent ?? "";
1275
1287
  this.#update();
1276
1288
  }
@@ -1462,7 +1474,10 @@ const fileOpts = (file) => ({
1462
1474
  });
1463
1475
  const readInput = (file) => file === "-" ? readFileSync(0, "utf8") : readFileSync(file, "utf8");
1464
1476
  function writeOut(out, text) {
1465
- if (!out) return void process.stdout.write(text);
1477
+ if (!out) {
1478
+ process.stdout.write(text);
1479
+ return;
1480
+ }
1466
1481
  mkdirSync(dirname(resolve(out)), { recursive: true });
1467
1482
  writeFileSync(out, text);
1468
1483
  process.stderr.write(`wrote ${out}\n`);
@@ -1610,14 +1625,20 @@ function cmdConvert(a) {
1610
1625
  if (!file) throw new Error("convert: missing input file");
1611
1626
  const r = toSource(readInput(file));
1612
1627
  printDiagnostics(file, r.diagnostics);
1613
- if (r.diagnostics.some((d) => d.severity === "error")) return void (process.exitCode = 1);
1628
+ if (r.diagnostics.some((d) => d.severity === "error")) {
1629
+ process.exitCode = 1;
1630
+ return;
1631
+ }
1614
1632
  writeOut(str(a.out), r.source);
1615
1633
  }
1616
1634
  function cmdUrl(a) {
1617
1635
  const file = a._[1];
1618
1636
  if (!file) throw new Error("url: missing input file");
1619
1637
  const source = readInput(file);
1620
- if (a.view) return void process.stdout.write(`${viewUrl(source, str(a.base))}\n`);
1638
+ if (a.view) {
1639
+ process.stdout.write(`${viewUrl(source, str(a.base))}\n`);
1640
+ return;
1641
+ }
1621
1642
  const base = (str(a.base) ?? "http://localhost:4749").replace(/\/$/, "");
1622
1643
  process.stdout.write(`${base}/yuhwa/svg/${encodeSource(source)}\n`);
1623
1644
  }