yuhwa 1.4.0 → 1.5.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.
- package/dist/astro.d.ts +28 -2
- package/dist/astro.js +27 -4
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -4
- package/dist/canvas.js +1 -1
- package/dist/cli.js +4 -1
- package/dist/editor/assets/index-BAdhu8vV.js +689 -0
- package/dist/editor/assets/lsp.worker-PVetuBwo.js +36 -0
- package/dist/editor/index.html +1 -1
- package/dist/{figure-BLHfxz_e.d.ts → figure-BXrdbiqy.d.ts} +1 -1
- package/dist/{index-xVW43gqW.d.ts → index-DVU2kSdX.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/ironmark.d.ts +7 -3
- package/dist/ironmark.js +13 -5
- package/dist/lsp-browser.d.ts +2 -2
- package/dist/lsp-browser.js +1 -1
- package/dist/lsp-node.js +7 -8
- package/dist/lsp-server.d.ts +1 -1
- package/dist/lsp-server.js +1 -1
- package/dist/lsp.d.ts +1 -1
- package/dist/lsp.js +1 -1
- package/dist/markdown-it.d.ts +1 -1
- package/dist/markdown-it.js +17 -5
- package/dist/{node-CkrQnPFb.js → node-B8dLsEzl.js} +61 -12
- package/dist/{parse--ljBMU60.js → parse-CD6SmUc1.js} +57 -72
- package/dist/{plugin-NMP_uf1a.d.ts → plugin-Dj66dvC1.d.ts} +2 -1
- package/dist/{plugin-CitzbblK.js → plugin-Dq5VmHe8.js} +2 -3
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +2 -2
- package/dist/{raster-iqi6XRPU.js → raster-Cul5L1bT.js} +1 -1
- package/dist/remark.d.ts +1 -1
- package/dist/remark.js +8 -20
- package/dist/satteri.d.ts +32 -0
- package/dist/satteri.js +41 -0
- package/dist/{server-DMAOtqqK.d.ts → server-Bb5_7tRV.d.ts} +1 -1
- package/dist/{server-BTYtmr6B.js → server-DCZj9bmz.js} +3 -3
- package/dist/{service-C60VdeKS.js → service-Cno307YA.js} +8 -9
- package/dist/{service-DimTFsE3.d.ts → service-wlaqtXGz.d.ts} +1 -1
- package/dist/{shared-h8tkFLY4.js → shared-DgVcoAJb.js} +231 -264
- package/dist/{src-NCXCTK_4.js → src-CBd46GH5.js} +42 -59
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -3
- package/dist/vuepress.d.ts +1 -1
- package/dist/vuepress.js +1 -1
- package/dist/yuhwa.iife.js +28 -28
- package/package.json +6 -1
- package/dist/editor/assets/index-DWm3xV_v.js +0 -689
- package/dist/editor/assets/lsp.worker-N6A9m364.js +0 -36
package/dist/astro.d.ts
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
import { t as YuhwaDocsOptions } from "./figure-
|
|
1
|
+
import { t as YuhwaDocsOptions } from "./figure-BXrdbiqy.js";
|
|
2
|
+
interface Watcher {
|
|
3
|
+
on: (event: "change" | "add", fn: (file: string) => void) => unknown;
|
|
4
|
+
add: (files: string[]) => unknown;
|
|
5
|
+
emit: (event: "change", file: string) => unknown;
|
|
6
|
+
}
|
|
7
|
+
interface DevPlugin {
|
|
8
|
+
name: string;
|
|
9
|
+
apply: "serve";
|
|
10
|
+
configureServer: (server: {
|
|
11
|
+
watcher: Watcher;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
2
14
|
interface SetupParams {
|
|
15
|
+
command?: string;
|
|
16
|
+
config?: {
|
|
17
|
+
markdown?: {
|
|
18
|
+
processor?: {
|
|
19
|
+
name: string;
|
|
20
|
+
options: {
|
|
21
|
+
mdastPlugins?: unknown[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
3
26
|
updateConfig: (config: {
|
|
4
|
-
markdown
|
|
27
|
+
markdown?: {
|
|
5
28
|
remarkPlugins: unknown[];
|
|
6
29
|
};
|
|
30
|
+
vite?: {
|
|
31
|
+
plugins: DevPlugin[];
|
|
32
|
+
};
|
|
7
33
|
}) => unknown;
|
|
8
34
|
injectScript: (stage: "page-ssr" | "page", content: string) => void;
|
|
9
35
|
}
|
package/dist/astro.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import remarkYuhwa from "./remark.js";
|
|
2
|
-
import
|
|
2
|
+
import satteriYuhwa from "./satteri.js";
|
|
3
|
+
import { n as onTrack, o as clientImports, r as pagesUsing } from "./node-B8dLsEzl.js";
|
|
3
4
|
// src/integrations/astro.ts
|
|
4
5
|
/**
|
|
5
6
|
* Astro integration, also for Starlight: renders ```yuhwa blocks in .md and
|
|
6
|
-
* .mdx and adds the light/dark stylesheet.
|
|
7
|
+
* .mdx and adds the light/dark stylesheet. It plugs into whichever Markdown
|
|
8
|
+
* processor the site uses: Sätteri (the Astro 7 default) or unified/remark.
|
|
7
9
|
*
|
|
8
10
|
* // astro.config.mjs
|
|
9
11
|
* import yuhwa from 'yuhwa/astro';
|
|
@@ -12,6 +14,24 @@ import { r as clientImports } from "./node-CkrQnPFb.js";
|
|
|
12
14
|
* `yuhwa({ zoom: true })` also loads the pan and zoom script. The canvas
|
|
13
15
|
* script always loads, for `output=canvas` fences.
|
|
14
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* Dev only: when a diagram file a page read changes (`file="..."` or an
|
|
19
|
+
* import), report its pages as changed, so Astro renders them again.
|
|
20
|
+
*/
|
|
21
|
+
function watchDiagrams() {
|
|
22
|
+
return {
|
|
23
|
+
name: "yuhwa-watch",
|
|
24
|
+
apply: "serve",
|
|
25
|
+
configureServer({ watcher }) {
|
|
26
|
+
onTrack((files) => watcher.add(files));
|
|
27
|
+
const changed = (file) => {
|
|
28
|
+
for (const page of pagesUsing(file)) watcher.emit("change", page);
|
|
29
|
+
};
|
|
30
|
+
watcher.on("change", changed);
|
|
31
|
+
watcher.on("add", changed);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
15
35
|
function yuhwa(opts = {}) {
|
|
16
36
|
const docs = opts.zoom ? {
|
|
17
37
|
...opts,
|
|
@@ -19,8 +39,11 @@ function yuhwa(opts = {}) {
|
|
|
19
39
|
} : opts;
|
|
20
40
|
return {
|
|
21
41
|
name: "yuhwa",
|
|
22
|
-
hooks: { "astro:config:setup": ({ updateConfig, injectScript }) => {
|
|
23
|
-
|
|
42
|
+
hooks: { "astro:config:setup": ({ command, config, updateConfig, injectScript }) => {
|
|
43
|
+
const processor = config?.markdown?.processor;
|
|
44
|
+
if (processor?.name === "satteri") (processor.options.mdastPlugins ??= []).push(satteriYuhwa(docs));
|
|
45
|
+
else updateConfig({ markdown: { remarkPlugins: [[remarkYuhwa, docs]] } });
|
|
46
|
+
if (command === "dev") updateConfig({ vite: { plugins: [watchDiagrams()] } });
|
|
24
47
|
for (const m of clientImports(opts)) injectScript(m.endsWith(".css") ? "page-ssr" : "page", `import '${m}';`);
|
|
25
48
|
} }
|
|
26
49
|
};
|
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 PanelDecl, A as setLineProp, At as registry, B as EdgeDecl, C as isYuhwaPath, Cn as canvasMeasure, Ct as RowKind, D as parse, Dt as optionKind, E as onlyColor, Et as YuhwaPlugin, F as Component, Ft as renderHead, G as LaidEdge, Gt as segsW, H as GroupDecl, Ht as parseInline, I as Curve, It as InkColors, J as LaidPanel, Jt as tspans, K as LaidGroup, L as Diagnostic, Lt as Seg, M as splitTrailingProps, Mt as use, Nt as MarkerKind, O as parseProps, Ot as perPass, P as Box, Pt as ShapeKind, Q as NodeOverride, Qt as RAMPS, R as Diagram, Rt as esc, S as blockBraces, Sn as approxMeasure, St as RowCtx, T as lex, Tt as StatementKind, U as HeadKind, V as EdgeOverride, W as LabelRef, Wt as renderSegs, X as LayoutOverrides, Xt as LineStyle, Y as Layout, Z as NodeDecl, _ as PANELS, _n as ramp, _t as Decoration, an as ThemeInput, at as PartEdit, b as Tok, bn as themeNames, bt as PanelKind, ct as ResolvedEdgeStyle, dn as getTheme, dt as Side, en as THEMES, et as PanelHandle, f as portOn, ft as SourceRef, g as LexedLine, gn as isToneOrHex, gt as layout, h as KNOWN_SETTINGS, hn as isSafeLink, ht as groupPath, in as Theme, it as PartChange, j as setTrailingProp, jt as unuse, k as serializeProps, kt as recolor, ln as fontFamilies, lt as ResolvedNodeStyle, mn as isSafeCss, nn as THEME_NAMES, nt as PanelPart, o as lineStyle, ot as Point, pn as isGenericFont, pt as GRID, q as LaidNode, r as dashFor, rn as TONES, rt as PartAction, sn as createTheme, st as Props, tn as THEME_KEYS, tt as PanelOverride, u as SHAPES, un as fontStack, ut as ShapeName, v as ParseOptions, vn as registerTheme, vt as FrameKind, w as joinPath, wt as RowPaint, x as TokKind, xt as PanelOption, y as SETTING_VALUES, yt as PanelCtx, z as Direction } from "./plugin-
|
|
15
|
-
import { $ as setPartTone, A as GROUP_PROPS, B as MdOptions, C as markers, D as COLORS, E as BOOLS, F as ConvertResult, G as FontSource, H as findBlocks, I as fromMermaid, J as loadFonts, K as RasterOptions, L as isMermaid, M as NUMBERS, N as PANEL_PROPS, O as EDGE_PROPS, P as lint, Q as setLabel, R as MD_LANGUAGES, S as themes, T as GUIDE, U as processMarkdown, V as MdResult, W as replaceBlockSource, X as editPart, Y as svgToCanvas, Z as formatLayout, _ as legend, at as JsonResult, b as tables, c as treeview, d as gantt, et as setProp, f as mindmap, g as sequence, h as timeline, i as hash, it as DiagramJSON, j as NODE_PROPS, k as ENUMS, l as kanban, m as chart, n as Options, nt as writeLayout, o as toSource, ot as fromJSON, p as git, q as embedFonts, r as Result, rt as writePanelDrag, s as builtins, st as renderSvg, t as InputFormat, tt as setSetting, u as quadrant, v as footer, w as shapes, x as charts, y as frames, z as MdBlock } from "./index-
|
|
14
|
+
import { $ as PanelDecl, A as setLineProp, At as registry, B as EdgeDecl, C as isYuhwaPath, Cn as canvasMeasure, Ct as RowKind, D as parse, Dt as optionKind, E as onlyColor, Et as YuhwaPlugin, F as Component, Ft as renderHead, G as LaidEdge, Gt as segsW, H as GroupDecl, Ht as parseInline, I as Curve, It as InkColors, J as LaidPanel, Jt as tspans, K as LaidGroup, L as Diagnostic, Lt as Seg, M as splitTrailingProps, Mt as use, Nt as MarkerKind, O as parseProps, Ot as perPass, P as Box, Pt as ShapeKind, Q as NodeOverride, Qt as RAMPS, R as Diagram, Rt as esc, S as blockBraces, Sn as approxMeasure, St as RowCtx, T as lex, Tt as StatementKind, U as HeadKind, V as EdgeOverride, W as LabelRef, Wt as renderSegs, X as LayoutOverrides, Xt as LineStyle, Y as Layout, Z as NodeDecl, _ as PANELS, _n as ramp, _t as Decoration, an as ThemeInput, at as PartEdit, b as Tok, bn as themeNames, bt as PanelKind, ct as ResolvedEdgeStyle, dn as getTheme, dt as Side, en as THEMES, et as PanelHandle, f as portOn, ft as SourceRef, g as LexedLine, gn as isToneOrHex, gt as layout, h as KNOWN_SETTINGS, hn as isSafeLink, ht as groupPath, in as Theme, it as PartChange, j as setTrailingProp, jt as unuse, k as serializeProps, kt as recolor, ln as fontFamilies, lt as ResolvedNodeStyle, mn as isSafeCss, nn as THEME_NAMES, nt as PanelPart, o as lineStyle, ot as Point, pn as isGenericFont, pt as GRID, q as LaidNode, r as dashFor, rn as TONES, rt as PartAction, sn as createTheme, st as Props, tn as THEME_KEYS, tt as PanelOverride, u as SHAPES, un as fontStack, ut as ShapeName, v as ParseOptions, vn as registerTheme, vt as FrameKind, w as joinPath, wt as RowPaint, x as TokKind, xt as PanelOption, y as SETTING_VALUES, yt as PanelCtx, z as Direction } from "./plugin-Dj66dvC1.js";
|
|
15
|
+
import { $ as setPartTone, A as GROUP_PROPS, B as MdOptions, C as markers, D as COLORS, E as BOOLS, F as ConvertResult, G as FontSource, H as findBlocks, I as fromMermaid, J as loadFonts, K as RasterOptions, L as isMermaid, M as NUMBERS, N as PANEL_PROPS, O as EDGE_PROPS, P as lint, Q as setLabel, R as MD_LANGUAGES, S as themes, T as GUIDE, U as processMarkdown, V as MdResult, W as replaceBlockSource, X as editPart, Y as svgToCanvas, Z as formatLayout, _ as legend, at as JsonResult, b as tables, c as treeview, d as gantt, et as setProp, f as mindmap, g as sequence, h as timeline, i as hash, it as DiagramJSON, j as NODE_PROPS, k as ENUMS, l as kanban, m as chart, n as Options, nt as writeLayout, o as toSource, ot as fromJSON, p as git, q as embedFonts, r as Result, rt as writePanelDrag, s as builtins, st as renderSvg, t as InputFormat, tt as setSetting, u as quadrant, v as footer, w as shapes, x as charts, y as frames, z as MdBlock } from "./index-DVU2kSdX.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 gantt, B as charts, C as GRID, D as treeview, E as builtins, F as sequence, H as markers, I as legend, L as footer, M as git, N as chart, O as kanban, P as timeline, R as frames, S as renderSvg, T as layout, U as shapes, V as themes, _ as writeLayout, a as MD_LANGUAGES, b as isMermaid, d as editPart, f as formatLayout, g as setSetting, h as setProp, i as GUIDE, j as mindmap, k as quadrant, l as processMarkdown, m as setPartTone, n as render$1, o as findBlocks, p as setLabel, r as toSource, t as hash, u as replaceBlockSource, v as writePanelDrag, w as groupPath, x as fromJSON, y as fromMermaid, z as tables } from "./src-
|
|
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-
|
|
1
|
+
import { A as gantt, B as charts, C as GRID, D as treeview, E as builtins, F as sequence, H as markers, I as legend, L as footer, M as git, N as chart, O as kanban, P as timeline, R as frames, S as renderSvg, T as layout, U as shapes, V as themes, _ as writeLayout, a as MD_LANGUAGES, b as isMermaid, d as editPart, f as formatLayout, g as setSetting, h as setProp, i as GUIDE, j as mindmap, k as quadrant, l as processMarkdown, m as setPartTone, n as render$1, o as findBlocks, p as setLabel, r as toSource, t as hash, u as replaceBlockSource, v as writePanelDrag, w as groupPath, x as fromJSON, y as fromMermaid, z as tables } from "./src-CBd46GH5.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-Dq5VmHe8.js";
|
|
3
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-
|
|
5
|
-
import { Bt as getTheme, C as ENUMS, D as PANEL_PROPS, E as NUMBERS, Et as tspans, F as portOn, G as renderHead, Gt as isToneOrHex, Ht as isGenericFont, It as createTheme, Kt as ramp, M as SHAPES, Mt as THEME_KEYS, Nt as THEME_NAMES, Pt as TONES, Rt as fontFamilies, S as EDGE_PROPS, T as NODE_PROPS, Ut as isSafeCss, Wt as isSafeLink, Yt as themeNames, Z as lineStyle, _ as setTrailingProp, b as BOOLS, c as joinPath, ct as esc, d as parse, f as parseProps, g as setLineProp, gt as renderSegs, h as serializeProps, jt as THEMES, k as lint, kt as RAMPS, l as lex, n as PANELS, o as blockBraces, pt as parseInline, q as dashFor, qt as registerTheme, r as SETTING_VALUES, s as isYuhwaPath, t as KNOWN_SETTINGS, u as onlyColor, v as splitTrailingProps, w as GROUP_PROPS, x as COLORS, y as unquote, yt as segsW, zt as fontStack } from "./parse
|
|
4
|
+
import { a as svgFamilies, c as swapForRaster, n as embedFonts, r as loadFonts, s as svgToCanvas } from "./raster-Cul5L1bT.js";
|
|
5
|
+
import { Bt as getTheme, C as ENUMS, D as PANEL_PROPS, E as NUMBERS, Et as tspans, F as portOn, G as renderHead, Gt as isToneOrHex, Ht as isGenericFont, It as createTheme, Kt as ramp, M as SHAPES, Mt as THEME_KEYS, Nt as THEME_NAMES, Pt as TONES, Rt as fontFamilies, S as EDGE_PROPS, T as NODE_PROPS, Ut as isSafeCss, Wt as isSafeLink, Yt as themeNames, Z as lineStyle, _ as setTrailingProp, b as BOOLS, c as joinPath, ct as esc, d as parse, f as parseProps, g as setLineProp, gt as renderSegs, h as serializeProps, jt as THEMES, k as lint, kt as RAMPS, l as lex, n as PANELS, o as blockBraces, pt as parseInline, q as dashFor, qt as registerTheme, r as SETTING_VALUES, s as isYuhwaPath, t as KNOWN_SETTINGS, u as onlyColor, v as splitTrailingProps, w as GROUP_PROPS, x as COLORS, y as unquote, yt as segsW, zt as fontStack } from "./parse-CD6SmUc1.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-
|
|
20
|
+
const { swapForRaster } = await import("./raster-Cul5L1bT.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 { F as NODE_PROPS, G as THEME_NAMES, K as TONES, L as PANEL_PROPS, M as EDGE_PROPS, N as ENUMS, P as GROUP_PROPS, S as SETTING_VALUES, T as joinPath, V as esc, W as THEME_KEYS, _ 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 isSafeCss, s as tidy, t as VERSION, u as toSource, v as optionKind, w as isYuhwaPath, y as registry, z as SHAPES } from "./shared-
|
|
3
|
+
import { F as NODE_PROPS, G as THEME_NAMES, K as TONES, L as PANEL_PROPS, M as EDGE_PROPS, N as ENUMS, P as GROUP_PROPS, S as SETTING_VALUES, T as joinPath, V as esc, W as THEME_KEYS, _ 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 isSafeCss, s as tidy, t as VERSION, u as toSource, v as optionKind, w as isYuhwaPath, y as registry, z as SHAPES } from "./shared-DgVcoAJb.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";
|
|
@@ -1710,6 +1710,9 @@ function cmdEdit(a) {
|
|
|
1710
1710
|
name: mainName,
|
|
1711
1711
|
mtime: statSync(file).mtimeMs
|
|
1712
1712
|
}));
|
|
1713
|
+
}).catch((e) => {
|
|
1714
|
+
res.statusCode = 500;
|
|
1715
|
+
res.end(JSON.stringify({ error: String(e) }));
|
|
1713
1716
|
});
|
|
1714
1717
|
return;
|
|
1715
1718
|
}
|