yuhwa 1.2.0 → 1.4.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/README.md +5 -3
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +4 -3
- package/dist/browser.d.ts +10 -3
- package/dist/browser.js +85 -21
- package/dist/canvas.d.ts +2 -0
- package/dist/canvas.js +40 -0
- package/dist/cli.js +485 -236
- package/dist/editor/assets/index-DWm3xV_v.js +689 -0
- package/dist/editor/assets/{lsp.worker-sZtzIA6-.js → lsp.worker-N6A9m364.js} +23 -17
- package/dist/editor/index.html +4 -1
- package/dist/{figure-CA2hy0xh.d.ts → figure-BLHfxz_e.d.ts} +28 -5
- package/dist/index-xVW43gqW.d.ts +261 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -1
- package/dist/ironmark.d.ts +1 -1
- package/dist/ironmark.js +1 -1
- package/dist/lsp-browser.d.ts +2 -2
- package/dist/lsp-browser.js +2 -1
- package/dist/lsp-node.js +47 -27
- package/dist/lsp-server.d.ts +5 -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 +5 -3
- package/dist/{node-Bzn2uKXZ.js → node-CkrQnPFb.js} +90 -12
- package/dist/parse--ljBMU60.js +3884 -0
- package/dist/plugin-CitzbblK.js +301 -0
- package/dist/{index-CnnoZYl0.d.ts → plugin-NMP_uf1a.d.ts} +93 -208
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.js +3 -0
- package/dist/raster-iqi6XRPU.js +299 -0
- package/dist/remark.d.ts +1 -1
- package/dist/remark.js +1 -1
- package/dist/rolldown-runtime-CEjnN5Q1.js +37 -0
- package/dist/{server-Dxo7OG8K.js → server-BTYtmr6B.js} +41 -63
- package/dist/{server--jHjJjOS.d.ts → server-DMAOtqqK.d.ts} +1 -1
- package/dist/{service-B1fpOg_L.js → service-C60VdeKS.js} +35 -3
- package/dist/{service-Brvpt7Do.d.ts → service-DimTFsE3.d.ts} +2 -0
- package/dist/{shared-Ddw88O9D.js → shared-h8tkFLY4.js} +719 -421
- package/dist/{src-DkQj7aIV.js → src-NCXCTK_4.js} +512 -4548
- package/dist/svg-uri-Dx8SGV-n.js +7 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -2
- package/dist/vuepress.d.ts +3 -2
- package/dist/vuepress.js +4 -2
- package/dist/watch-2VeW5DUN.js +35 -0
- package/dist/yuhwa.iife.js +55 -54
- package/dist/zoom-script-CaJ5MNUw.js +29 -0
- package/dist/{zoom-QeqB6QlH.js → zoom-yxhxX16c.js} +1 -1
- package/dist/zoom.d.ts +16 -7
- package/dist/zoom.js +2 -2
- package/package.json +24 -2
- package/skills/yuhwa/SKILL.md +12 -0
- package/dist/editor/assets/index-BphHLTvA.js +0 -689
- package/dist/zoom-script-CVdAzMhX.js +0 -51
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/svg-uri.ts
|
|
2
|
+
const PREFIX = "data:image/svg+xml,";
|
|
3
|
+
/** the SVG as a `data:` URI, for an `<img src>` */
|
|
4
|
+
const svgDataUri = (svg) => PREFIX + encodeURIComponent(svg);
|
|
5
|
+
/** the SVG inside a URI made by `svgDataUri`, or `undefined` for any other URI */
|
|
6
|
+
const svgFromDataUri = (uri) => uri.startsWith(PREFIX) ? decodeURIComponent(uri.slice(19)) : void 0;
|
|
7
|
+
export { svgFromDataUri as n, svgDataUri as t };
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { s as isYuhwaPath } from "./parse--ljBMU60.js";
|
|
1
2
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { i as errorMessage, t as diskResolve } from "./node-CkrQnPFb.js";
|
|
4
|
+
import { n as render } from "./src-NCXCTK_4.js";
|
|
4
5
|
// src/integrations/vite.ts
|
|
5
6
|
/**
|
|
6
7
|
* Vite plugin: `import diagram from './arch.yu'` gives the rendered SVG
|
package/dist/vuepress.d.ts
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* import { yuhwaPlugin } from 'yuhwa/vuepress';
|
|
6
6
|
* export default defineUserConfig({ plugins: [yuhwaPlugin()] });
|
|
7
7
|
*
|
|
8
|
-
* `yuhwaPlugin({ zoom: true })` also loads the pan and zoom script.
|
|
8
|
+
* `yuhwaPlugin({ zoom: true })` also loads the pan and zoom script. The
|
|
9
|
+
* canvas script always loads, for `output=canvas` fences.
|
|
9
10
|
*/
|
|
10
11
|
import yuhwaMarkdownIt from "./markdown-it.js";
|
|
11
|
-
import { t as YuhwaDocsOptions } from "./figure-
|
|
12
|
+
import { t as YuhwaDocsOptions } from "./figure-BLHfxz_e.js";
|
|
12
13
|
interface App {
|
|
13
14
|
writeTemp: (file: string, content: string) => Promise<string>;
|
|
14
15
|
}
|
package/dist/vuepress.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import yuhwaMarkdownIt from "./markdown-it.js";
|
|
2
|
+
import { r as clientImports } from "./node-CkrQnPFb.js";
|
|
2
3
|
// src/integrations/vuepress.ts
|
|
3
4
|
/**
|
|
4
5
|
* VuePress 2 plugin: renders ```yuhwa fences and adds the light/dark stylesheet.
|
|
@@ -7,7 +8,8 @@ import yuhwaMarkdownIt from "./markdown-it.js";
|
|
|
7
8
|
* import { yuhwaPlugin } from 'yuhwa/vuepress';
|
|
8
9
|
* export default defineUserConfig({ plugins: [yuhwaPlugin()] });
|
|
9
10
|
*
|
|
10
|
-
* `yuhwaPlugin({ zoom: true })` also loads the pan and zoom script.
|
|
11
|
+
* `yuhwaPlugin({ zoom: true })` also loads the pan and zoom script. The
|
|
12
|
+
* canvas script always loads, for `output=canvas` fences.
|
|
11
13
|
*/
|
|
12
14
|
function yuhwaPlugin(opts = {}) {
|
|
13
15
|
return {
|
|
@@ -16,7 +18,7 @@ function yuhwaPlugin(opts = {}) {
|
|
|
16
18
|
...opts,
|
|
17
19
|
zoom: true
|
|
18
20
|
} : opts),
|
|
19
|
-
clientConfigFile: (app) => app.writeTemp("yuhwa/client.js",
|
|
21
|
+
clientConfigFile: (app) => app.writeTemp("yuhwa/client.js", clientImports(opts).map((m) => `import '${m}';\n`).join("") + "export default {};\n")
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
export { yuhwaPlugin as default, yuhwaPlugin };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/integrations/watch.ts
|
|
2
|
+
/**
|
|
3
|
+
* Runs `attach` once the page is parsed, and again (batched to one frame)
|
|
4
|
+
* whenever elements are added, the page loads or comes back from the
|
|
5
|
+
* back/forward cache. Client-side navigation and hydration bring new figures
|
|
6
|
+
* this way. It watches `document`, not `<html>`, because hydration can replace
|
|
7
|
+
* the `<html>` element. `flag` on `window` makes a second install a no-op.
|
|
8
|
+
*
|
|
9
|
+
* Self-contained: `zoomScript` inlines its source, so it may not use imports.
|
|
10
|
+
*/
|
|
11
|
+
function watchFigures(flag, attach) {
|
|
12
|
+
const w = window;
|
|
13
|
+
if (w[flag]) return;
|
|
14
|
+
w[flag] = true;
|
|
15
|
+
let queued = false;
|
|
16
|
+
const later = () => {
|
|
17
|
+
if (queued) return;
|
|
18
|
+
queued = true;
|
|
19
|
+
requestAnimationFrame(() => {
|
|
20
|
+
queued = false;
|
|
21
|
+
attach();
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", attach, { once: true });
|
|
25
|
+
else attach();
|
|
26
|
+
addEventListener("load", later);
|
|
27
|
+
addEventListener("pageshow", later);
|
|
28
|
+
new MutationObserver((records) => {
|
|
29
|
+
if (records.some((r) => [...r.addedNodes].some((n) => n.nodeType === 1))) later();
|
|
30
|
+
}).observe(document, {
|
|
31
|
+
childList: true,
|
|
32
|
+
subtree: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { watchFigures as t };
|