yuhwa 1.0.2 → 1.2.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 +13 -12
- package/client.d.ts +9 -1
- package/dist/astro.d.ts +2 -2
- package/dist/astro.js +8 -1
- package/dist/browser.d.ts +11 -5
- package/dist/browser.js +27 -7
- package/dist/cli.js +612 -49
- package/dist/editor/assets/index-BphHLTvA.js +689 -0
- package/dist/editor/assets/lsp.worker-sZtzIA6-.js +30 -0
- package/dist/editor/index.html +5 -4
- package/dist/figure-CA2hy0xh.d.ts +48 -0
- package/dist/{index-Dl845tUQ.d.ts → index-CnnoZYl0.d.ts} +76 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/ironmark.d.ts +4 -2
- package/dist/ironmark.js +18 -7
- package/dist/llms.txt +26 -17
- package/dist/lsp-browser.d.ts +2 -2
- package/dist/lsp-browser.js +1 -1
- package/dist/lsp-node.js +208 -212
- package/dist/lsp-server.d.ts +1 -1
- package/dist/lsp-server.js +1 -1
- package/dist/lsp.d.ts +44 -2
- package/dist/lsp.js +1 -1
- package/dist/markdown-it.d.ts +2 -1
- package/dist/markdown-it.js +7 -6
- package/dist/node-Bzn2uKXZ.js +224 -0
- package/dist/remark.d.ts +2 -1
- package/dist/remark.js +16 -5
- package/dist/{server-DJC_fQMe.d.ts → server--jHjJjOS.d.ts} +2 -2
- package/dist/{server-DmQuHQrG.js → server-Dxo7OG8K.js} +19 -2
- package/dist/{service-BYS9Qfkq.js → service-B1fpOg_L.js} +348 -44
- package/dist/{service-ClZ8clSQ.d.ts → service-Brvpt7Do.d.ts} +3 -1
- package/dist/{shared-qo_r6RUN.js → shared-Ddw88O9D.js} +3069 -742
- package/dist/{src-wk7tBpWs.js → src-DkQj7aIV.js} +2842 -744
- package/dist/style.css +14 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +19 -12
- package/dist/vuepress.d.ts +3 -1
- package/dist/vuepress.js +7 -2
- package/dist/yuhwa.iife.js +91 -75
- package/dist/zoom-CCSUbX1X.d.ts +49 -0
- package/dist/zoom-QeqB6QlH.js +275 -0
- package/dist/zoom-script-CVdAzMhX.js +51 -0
- package/dist/zoom.d.ts +35 -0
- package/dist/zoom.js +19 -0
- package/package.json +10 -2
- package/dist/editor/assets/index-BQLsumas.js +0 -587
- package/dist/editor/assets/lsp.worker-RlPj9blG.js +0 -26
- package/dist/figure-BZHIKnxv.d.ts +0 -27
- package/dist/node-Bneu5eJV.js +0 -108
package/dist/style.css
CHANGED
|
@@ -46,3 +46,17 @@ figure.yuhwa .yuhwa-error {
|
|
|
46
46
|
background: rgba(239, 68, 68, 0.08);
|
|
47
47
|
border-radius: 6px;
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
/* pan and zoom (`zoom` option and `yuhwa/zoom`): a framed viewer, full screen follows the site's colours */
|
|
51
|
+
figure.yuhwa .yuhwa-view {
|
|
52
|
+
border: 1px solid rgb(128 128 128 / 0.25);
|
|
53
|
+
border-radius: 8px;
|
|
54
|
+
}
|
|
55
|
+
:is(.dark, [data-theme='dark'], [data-mode='dark'], .theme-dark) figure.yuhwa .yuhwa-view {
|
|
56
|
+
color-scheme: dark;
|
|
57
|
+
}
|
|
58
|
+
@media (prefers-color-scheme: dark) {
|
|
59
|
+
:root:not(.light):not(.dark):not([data-theme]):not([data-mode]) figure.yuhwa .yuhwa-view {
|
|
60
|
+
color-scheme: dark;
|
|
61
|
+
}
|
|
62
|
+
}
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as render } from "./src-
|
|
2
|
+
import { r as errorMessage, t as diskResolve } from "./node-Bzn2uKXZ.js";
|
|
3
|
+
import { K as isYuhwaPath, n as render } from "./src-DkQj7aIV.js";
|
|
4
4
|
// src/integrations/vite.ts
|
|
5
5
|
/**
|
|
6
|
-
* Vite plugin: `import diagram from './arch.
|
|
6
|
+
* Vite plugin: `import diagram from './arch.yu'` gives the rendered SVG
|
|
7
7
|
* string, for apps (React, Vue, Svelte ...) and Vite-based docs sites.
|
|
8
8
|
*
|
|
9
9
|
* import yuhwa from 'yuhwa/vite';
|
|
10
10
|
* export default defineConfig({ plugins: [yuhwa({ theme: 'midnight' })] });
|
|
11
11
|
*
|
|
12
|
-
* import svg, { source, darkSvg } from './arch.
|
|
12
|
+
* import svg, { source, darkSvg } from './arch.yu';
|
|
13
13
|
*
|
|
14
|
-
* Errors fail the build; imported .
|
|
14
|
+
* Errors fail the build; imported .yu files are watched. A diagram that sets
|
|
15
|
+
* `theme:` itself gets the same SVG as `darkSvg`.
|
|
15
16
|
*/
|
|
16
17
|
function yuhwaVite(opts = {}) {
|
|
17
18
|
return {
|
|
@@ -19,7 +20,7 @@ function yuhwaVite(opts = {}) {
|
|
|
19
20
|
enforce: "pre",
|
|
20
21
|
load(id) {
|
|
21
22
|
const [path] = id.split("?");
|
|
22
|
-
if (!path
|
|
23
|
+
if (!isYuhwaPath(path)) return null;
|
|
23
24
|
const source = readFileSync(path, "utf8");
|
|
24
25
|
const cache = /* @__PURE__ */ new Map();
|
|
25
26
|
const resolve = (p) => {
|
|
@@ -37,12 +38,18 @@ function yuhwaVite(opts = {}) {
|
|
|
37
38
|
});
|
|
38
39
|
const errors = r.diagnostics.filter((d) => d.severity === "error");
|
|
39
40
|
if (errors.length) this.error(errorMessage(errors, { file: path }));
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
let dark = r.svg;
|
|
42
|
+
if (opts.darkTheme !== false && !("theme" in r.diagram.settings)) {
|
|
43
|
+
const d = render(source, {
|
|
44
|
+
theme: opts.darkTheme ?? "midnight",
|
|
45
|
+
measure: opts.measure,
|
|
46
|
+
file: path,
|
|
47
|
+
resolve
|
|
48
|
+
});
|
|
49
|
+
const darkErrors = d.diagnostics.filter((x) => x.severity === "error");
|
|
50
|
+
if (darkErrors.length) this.error(errorMessage(darkErrors, { file: `${path} (dark)` }));
|
|
51
|
+
dark = d.svg;
|
|
52
|
+
}
|
|
46
53
|
return [
|
|
47
54
|
`export default ${JSON.stringify(r.svg)};`,
|
|
48
55
|
`export const darkSvg = ${JSON.stringify(dark)};`,
|
package/dist/vuepress.d.ts
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* // .vuepress/config.ts
|
|
5
5
|
* import { yuhwaPlugin } from 'yuhwa/vuepress';
|
|
6
6
|
* export default defineUserConfig({ plugins: [yuhwaPlugin()] });
|
|
7
|
+
*
|
|
8
|
+
* `yuhwaPlugin({ zoom: true })` also loads the pan and zoom script.
|
|
7
9
|
*/
|
|
8
10
|
import yuhwaMarkdownIt from "./markdown-it.js";
|
|
9
|
-
import { t as YuhwaDocsOptions } from "./figure-
|
|
11
|
+
import { t as YuhwaDocsOptions } from "./figure-CA2hy0xh.js";
|
|
10
12
|
interface App {
|
|
11
13
|
writeTemp: (file: string, content: string) => Promise<string>;
|
|
12
14
|
}
|
package/dist/vuepress.js
CHANGED
|
@@ -6,12 +6,17 @@ import yuhwaMarkdownIt from "./markdown-it.js";
|
|
|
6
6
|
* // .vuepress/config.ts
|
|
7
7
|
* import { yuhwaPlugin } from 'yuhwa/vuepress';
|
|
8
8
|
* export default defineUserConfig({ plugins: [yuhwaPlugin()] });
|
|
9
|
+
*
|
|
10
|
+
* `yuhwaPlugin({ zoom: true })` also loads the pan and zoom script.
|
|
9
11
|
*/
|
|
10
12
|
function yuhwaPlugin(opts = {}) {
|
|
11
13
|
return {
|
|
12
14
|
name: "yuhwa",
|
|
13
|
-
extendsMarkdown: (md) => yuhwaMarkdownIt(md, opts
|
|
14
|
-
|
|
15
|
+
extendsMarkdown: (md) => yuhwaMarkdownIt(md, opts.zoom ? {
|
|
16
|
+
...opts,
|
|
17
|
+
zoom: true
|
|
18
|
+
} : opts),
|
|
19
|
+
clientConfigFile: (app) => app.writeTemp("yuhwa/client.js", `import 'yuhwa/style.css';\n${opts.zoom ? `import 'yuhwa/zoom';\n` : ""}export default {};\n`)
|
|
15
20
|
};
|
|
16
21
|
}
|
|
17
22
|
export { yuhwaPlugin as default, yuhwaPlugin };
|