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
|
@@ -11,26 +11,40 @@ function collecting(diags, fn) {
|
|
|
11
11
|
sink = prev;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/** a thrown value as text */
|
|
15
|
+
const errorText = (e) => e instanceof Error ? e.message : String(e);
|
|
16
|
+
/** the default: an error on the diagram being processed, once per message */
|
|
17
|
+
const toSink = (message) => {
|
|
17
18
|
if (sink && !sink.some((d) => d.message === message)) sink.push({
|
|
18
|
-
line,
|
|
19
|
+
line: 1,
|
|
19
20
|
message,
|
|
20
21
|
severity: "error"
|
|
21
22
|
});
|
|
22
|
-
}
|
|
23
|
-
/** `fn`, but a throw
|
|
24
|
-
function guard(plugin, what, fn, fallback) {
|
|
23
|
+
};
|
|
24
|
+
/** `fn`, but a throw is reported and returns `fallback(...args)` */
|
|
25
|
+
function guard(plugin, what, fn, fallback, report = toSink) {
|
|
25
26
|
return function(...args) {
|
|
26
27
|
try {
|
|
27
28
|
return fn.apply(this, args);
|
|
28
29
|
} catch (e) {
|
|
29
|
-
|
|
30
|
+
report(`plugin "${plugin}": ${what} failed: ${errorText(e)}`, args);
|
|
30
31
|
return fallback(...args);
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
/** who registered each kind, by `"<what> <name>"` */
|
|
36
|
+
const owners = /* @__PURE__ */ new Map();
|
|
37
|
+
/** record that `plugin` registered `what` `name`; replacing another plugin's is allowed, but worth a word */
|
|
38
|
+
function claim(what, name, plugin) {
|
|
39
|
+
const key = `${what} ${name}`;
|
|
40
|
+
const prev = owners.get(key);
|
|
41
|
+
if (prev && prev !== plugin) console.warn(`yuhwa: plugin "${plugin}" replaces ${what} "${name}" of plugin "${prev}"`);
|
|
42
|
+
owners.set(key, plugin);
|
|
43
|
+
}
|
|
44
|
+
/** forget every owner, when `unuse` rebuilds the tables */
|
|
45
|
+
const clearOwners = () => owners.clear();
|
|
46
|
+
/** the plugin that registered `what` `name`, if one did */
|
|
47
|
+
const ownerOf = (what, name) => owners.get(`${what} ${name}`);
|
|
34
48
|
/**
|
|
35
49
|
* `o` without a prototype: a lookup by a name from the source (`theme:
|
|
36
50
|
* constructor`, `$toString`) then finds only the table's own keys.
|
|
@@ -250,6 +264,7 @@ function ramp(tone, level) {
|
|
|
250
264
|
}
|
|
251
265
|
const SANS = "Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
|
|
252
266
|
const MONO = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
267
|
+
const SERIF$1 = "ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif";
|
|
253
268
|
const lightTone = (t) => RAMPS[t] && {
|
|
254
269
|
fill: ramp(t, 50),
|
|
255
270
|
stroke: ramp(t, 300),
|
|
@@ -391,15 +406,31 @@ const LINE_STYLES = [
|
|
|
391
406
|
];
|
|
392
407
|
/** the group border dash for a line style; `fallback` when no style is set */
|
|
393
408
|
const groupDash = (style, fallback) => style === "dashed" ? "6 4" : style === "dotted" ? "1.5 4" : style === "solid" ? null : fallback;
|
|
394
|
-
|
|
409
|
+
const FONT_KEYWORDS = {
|
|
410
|
+
sans: SANS,
|
|
411
|
+
serif: SERIF$1,
|
|
412
|
+
mono: MONO
|
|
413
|
+
};
|
|
414
|
+
const GENERIC_FONT = /^(serif|sans-serif|monospace|cursive|fantasy|math|emoji|system-ui|ui-(serif|sans-serif|monospace|rounded))$/i;
|
|
415
|
+
/** whether `family` is a CSS generic family such as `serif` or `system-ui` */
|
|
416
|
+
const isGenericFont = (family) => GENERIC_FONT.test(family);
|
|
417
|
+
/** the family names of a CSS font stack, unquoted */
|
|
418
|
+
const fontFamilies = (stack) => stack.split(",").map((f) => f.trim().replace(/^(['"])(.*)\1$/, "$2")).filter(Boolean);
|
|
419
|
+
/**
|
|
420
|
+
* a font setting as a CSS font stack: a family name or a fallback list such
|
|
421
|
+
* as `Lora, Georgia, serif`. `sans`, `serif` and `mono` expand to their
|
|
422
|
+
* stacks; a list that ends without a generic family gets one that matches
|
|
423
|
+
* the first font
|
|
424
|
+
*/
|
|
395
425
|
function fontStack(font) {
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
426
|
+
const names = font.split(",").map((f) => f.trim()).filter(Boolean);
|
|
427
|
+
const first = fontFamilies(font)[0] ?? "sans";
|
|
428
|
+
const mono = first === "mono" || /mono|code|courier/i.test(first);
|
|
429
|
+
const stack = names.map((f) => FONT_KEYWORDS[f] ?? f);
|
|
430
|
+
const last = names.at(-1) ?? "";
|
|
431
|
+
if (!FONT_KEYWORDS[last] && !isGenericFont(last)) stack.push(mono ? "ui-monospace, monospace" : "ui-sans-serif, system-ui, sans-serif");
|
|
401
432
|
return {
|
|
402
|
-
font:
|
|
433
|
+
font: stack.join(", "),
|
|
403
434
|
mono
|
|
404
435
|
};
|
|
405
436
|
}
|
|
@@ -1134,14 +1165,6 @@ const SIDES$2 = [
|
|
|
1134
1165
|
"bottom",
|
|
1135
1166
|
"left"
|
|
1136
1167
|
];
|
|
1137
|
-
const HEADS$1 = [
|
|
1138
|
-
"arrow",
|
|
1139
|
-
"open",
|
|
1140
|
-
"dot",
|
|
1141
|
-
"diamond",
|
|
1142
|
-
"bar",
|
|
1143
|
-
"none"
|
|
1144
|
-
];
|
|
1145
1168
|
const center = (b) => ({
|
|
1146
1169
|
x: b.x + b.w / 2,
|
|
1147
1170
|
y: b.y + b.h / 2
|
|
@@ -1232,7 +1255,7 @@ function avoidObstacles(a, b, s0, s1, free0, free1, obstacles) {
|
|
|
1232
1255
|
}
|
|
1233
1256
|
return best;
|
|
1234
1257
|
}
|
|
1235
|
-
const headKind = (v, dflt) => v && (
|
|
1258
|
+
const headKind = (v, dflt) => v && (v === "none" || MARKER_KINDS.has(v)) ? v : dflt;
|
|
1236
1259
|
function routeEdges(d, nodes, ctx) {
|
|
1237
1260
|
const items = [];
|
|
1238
1261
|
const pairKey = (x, y) => x < y ? `${x}\u0000${y}` : `${y}\u0000${x}`;
|
|
@@ -1510,16 +1533,9 @@ function labelSpot(samples, boxAt, it, ctx) {
|
|
|
1510
1533
|
}
|
|
1511
1534
|
const headSize = (w) => 7 + w * 2;
|
|
1512
1535
|
function trimFor(kind, hl, w) {
|
|
1513
|
-
const
|
|
1514
|
-
if (
|
|
1515
|
-
|
|
1516
|
-
case "arrow": return hl * .8;
|
|
1517
|
-
case "open": return w * .8;
|
|
1518
|
-
case "dot": return hl * .7;
|
|
1519
|
-
case "diamond": return hl * 1.6;
|
|
1520
|
-
case "bar": return 0;
|
|
1521
|
-
default: return 0;
|
|
1522
|
-
}
|
|
1536
|
+
const m = MARKER_KINDS.get(kind);
|
|
1537
|
+
if (!m) return 0;
|
|
1538
|
+
return typeof m.inset === "function" ? m.inset(hl, w) : m.inset ?? 0;
|
|
1523
1539
|
}
|
|
1524
1540
|
/** Unit direction the path travels at its start or end (pointing outwards at the end, inwards at the start reversed). */
|
|
1525
1541
|
function endDirection(g, which) {
|
|
@@ -1803,194 +1819,57 @@ const MARKER_KINDS = /* @__PURE__ */ new Map();
|
|
|
1803
1819
|
const AFTER_LAYOUT = [];
|
|
1804
1820
|
const POST_RENDER = [];
|
|
1805
1821
|
/**
|
|
1806
|
-
* An edge end marker with its tip at `at`, pointing along `angle`:
|
|
1807
|
-
*
|
|
1822
|
+
* An edge end marker with its tip at `at`, pointing along `angle`: any
|
|
1823
|
+
* registered marker (the built-in ones come from the `markers` plugin). `L` is its length; graph
|
|
1808
1824
|
* edges size it from the stroke width, panels pass their own.
|
|
1809
1825
|
*/
|
|
1810
1826
|
function renderHead(at, angle, kind, color, w, L = headSize(w)) {
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
case "dot": {
|
|
1818
|
-
const r = L * .36;
|
|
1819
|
-
return `<circle cx="${P(-r, 0).split(",")[0]}" cy="${P(-r, 0).split(",")[1]}" r="${f$2(r)}" fill="${color}"/>`;
|
|
1820
|
-
}
|
|
1821
|
-
case "diamond": return `<path d="M${P(0, 0)}L${P(-L * .8, L * .45)}L${P(-L * 1.6, 0)}L${P(-L * .8, -L * .45)}Z" fill="${color}"/>`;
|
|
1822
|
-
case "bar": return `<path d="M${P(-4, L * .6)}L${P(-4, -L * .6)}" stroke="${color}" stroke-width="${f$2(w * 1.2)}" stroke-linecap="round"/>`;
|
|
1823
|
-
default: {
|
|
1824
|
-
const m = MARKER_KINDS.get(kind);
|
|
1825
|
-
return m ? m.render(at, angle, {
|
|
1826
|
-
color,
|
|
1827
|
-
width: w,
|
|
1828
|
-
size: L
|
|
1829
|
-
}) : "";
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1827
|
+
const m = MARKER_KINDS.get(kind);
|
|
1828
|
+
return m ? m.render(at, angle, {
|
|
1829
|
+
color,
|
|
1830
|
+
width: w,
|
|
1831
|
+
size: L
|
|
1832
|
+
}) : "";
|
|
1832
1833
|
}
|
|
1833
1834
|
// src/core/shapes.ts
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
"hexagon",
|
|
1842
|
-
"cylinder",
|
|
1843
|
-
"parallelogram",
|
|
1844
|
-
"document",
|
|
1845
|
-
"note",
|
|
1846
|
-
"text"
|
|
1847
|
-
];
|
|
1848
|
-
const SHAPE_ALIASES = table({
|
|
1849
|
-
rect: "box",
|
|
1850
|
-
rectangle: "box",
|
|
1851
|
-
square: "box",
|
|
1852
|
-
round: "rounded",
|
|
1853
|
-
stadium: "pill",
|
|
1854
|
-
capsule: "pill",
|
|
1855
|
-
oval: "ellipse",
|
|
1856
|
-
rhombus: "diamond",
|
|
1857
|
-
decision: "diamond",
|
|
1858
|
-
database: "cylinder",
|
|
1859
|
-
db: "cylinder",
|
|
1860
|
-
storage: "cylinder",
|
|
1861
|
-
doc: "document",
|
|
1862
|
-
io: "parallelogram",
|
|
1863
|
-
sticky: "note",
|
|
1864
|
-
label: "text",
|
|
1865
|
-
plain: "text",
|
|
1866
|
-
none: "text"
|
|
1867
|
-
});
|
|
1835
|
+
/**
|
|
1836
|
+
* The registered node shapes, in registration order. The built-in ones come
|
|
1837
|
+
* from the `shapes` plugin; `use()` adds every plugin's shapes here.
|
|
1838
|
+
*/
|
|
1839
|
+
const SHAPES$2 = [];
|
|
1840
|
+
/** other names for a shape (`db` → `cylinder`), filled by `use()` from `ShapeKind.aliases` */
|
|
1841
|
+
const SHAPE_ALIASES = table({});
|
|
1868
1842
|
function normalizeShape(s) {
|
|
1869
1843
|
if (!s) return "rounded";
|
|
1870
1844
|
const k = s.toLowerCase();
|
|
1871
|
-
if (
|
|
1845
|
+
if (SHAPE_KINDS.has(k)) return k;
|
|
1872
1846
|
return SHAPE_ALIASES[k] ?? "rounded";
|
|
1873
1847
|
}
|
|
1848
|
+
/** the outer size of a rounded box around content of `cw` × `ch`: the default for shapes without `size` */
|
|
1849
|
+
function boxSize(cw, ch) {
|
|
1850
|
+
return {
|
|
1851
|
+
w: Math.max(cw + 44, 96),
|
|
1852
|
+
h: Math.max(ch + 28, 48)
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1874
1855
|
/** Grow a content box (text size) into the outer size for a shape. */
|
|
1875
1856
|
function sizeForShape(shape, cw, ch) {
|
|
1876
|
-
|
|
1877
|
-
if (custom?.size) return custom.size(cw, ch);
|
|
1878
|
-
let w = cw + 44;
|
|
1879
|
-
let h = ch + 28;
|
|
1880
|
-
switch (shape) {
|
|
1881
|
-
case "circle": {
|
|
1882
|
-
const d = Math.max(Math.hypot(cw, ch) + 16, 64);
|
|
1883
|
-
return {
|
|
1884
|
-
w: d,
|
|
1885
|
-
h: d
|
|
1886
|
-
};
|
|
1887
|
-
}
|
|
1888
|
-
case "ellipse": return {
|
|
1889
|
-
w: Math.max((cw + 16) * 1.42, 90),
|
|
1890
|
-
h: Math.max((ch + 12) * 1.42, 50)
|
|
1891
|
-
};
|
|
1892
|
-
case "diamond": return {
|
|
1893
|
-
w: Math.max(cw * 1.6 + 40, 100),
|
|
1894
|
-
h: Math.max(ch * 1.8 + 32, 70)
|
|
1895
|
-
};
|
|
1896
|
-
case "hexagon":
|
|
1897
|
-
h = Math.max(h, 48);
|
|
1898
|
-
return {
|
|
1899
|
-
w: w + h * .4,
|
|
1900
|
-
h
|
|
1901
|
-
};
|
|
1902
|
-
case "cylinder": return {
|
|
1903
|
-
w: Math.max(w, 96),
|
|
1904
|
-
h: Math.max(h + 18, 66)
|
|
1905
|
-
};
|
|
1906
|
-
case "parallelogram": return {
|
|
1907
|
-
w: w + 24,
|
|
1908
|
-
h: Math.max(h, 48)
|
|
1909
|
-
};
|
|
1910
|
-
case "document": return {
|
|
1911
|
-
w: Math.max(w, 96),
|
|
1912
|
-
h: Math.max(h + 10, 56)
|
|
1913
|
-
};
|
|
1914
|
-
case "note": return {
|
|
1915
|
-
w: Math.max(w + 8, 96),
|
|
1916
|
-
h: Math.max(h, 48)
|
|
1917
|
-
};
|
|
1918
|
-
case "pill": return {
|
|
1919
|
-
w: Math.max(w + 8, 96),
|
|
1920
|
-
h: Math.max(h, 44)
|
|
1921
|
-
};
|
|
1922
|
-
case "text": return {
|
|
1923
|
-
w: cw + 12,
|
|
1924
|
-
h: ch + 8
|
|
1925
|
-
};
|
|
1926
|
-
default: return {
|
|
1927
|
-
w: Math.max(w, 96),
|
|
1928
|
-
h: Math.max(h, 48)
|
|
1929
|
-
};
|
|
1930
|
-
}
|
|
1857
|
+
return SHAPE_KINDS.get(shape)?.size?.(cw, ch) ?? boxSize(cw, ch);
|
|
1931
1858
|
}
|
|
1932
1859
|
/** Vertical offset of the text centre inside a shape (e.g. below a cylinder's lid). */
|
|
1933
1860
|
function textOffset(shape) {
|
|
1934
|
-
|
|
1935
|
-
if (shape === "document") return -4;
|
|
1936
|
-
return 0;
|
|
1861
|
+
return SHAPE_KINDS.get(shape)?.textOffset ?? 0;
|
|
1937
1862
|
}
|
|
1938
1863
|
const f$1 = (n) => (Math.round(n * 100) / 100).toString();
|
|
1939
|
-
/** SVG path data for the outline of a shape. */
|
|
1864
|
+
/** SVG path data for the outline of a shape; a rounded box when no plugin registered it. */
|
|
1940
1865
|
function shapePath(shape, b, radius) {
|
|
1941
1866
|
const custom = SHAPE_KINDS.get(shape);
|
|
1942
1867
|
if (custom) return custom.path(b, radius);
|
|
1943
|
-
|
|
1944
|
-
const r = Math.min(radius, w / 2, h / 2);
|
|
1945
|
-
switch (shape) {
|
|
1946
|
-
case "box": return rectPath(x, y, w, h, Math.min(r, 3));
|
|
1947
|
-
case "pill": return rectPath(x, y, w, h, h / 2);
|
|
1948
|
-
case "circle":
|
|
1949
|
-
case "ellipse": {
|
|
1950
|
-
const rx = w / 2;
|
|
1951
|
-
const ry = h / 2;
|
|
1952
|
-
const cx = x + rx;
|
|
1953
|
-
return `M${f$1(cx - rx)},${f$1(y + ry)}a${f$1(rx)},${f$1(ry)} 0 1,0 ${f$1(rx * 2)},0a${f$1(rx)},${f$1(ry)} 0 1,0 ${f$1(-rx * 2)},0Z`;
|
|
1954
|
-
}
|
|
1955
|
-
case "diamond": return `M${f$1(x + w / 2)},${f$1(y)}L${f$1(x + w)},${f$1(y + h / 2)}L${f$1(x + w / 2)},${f$1(y + h)}L${f$1(x)},${f$1(y + h / 2)}Z`;
|
|
1956
|
-
case "hexagon": {
|
|
1957
|
-
const i = Math.min(h * .3, w / 4);
|
|
1958
|
-
return `M${f$1(x + i)},${f$1(y)}L${f$1(x + w - i)},${f$1(y)}L${f$1(x + w)},${f$1(y + h / 2)}L${f$1(x + w - i)},${f$1(y + h)}L${f$1(x + i)},${f$1(y + h)}L${f$1(x)},${f$1(y + h / 2)}Z`;
|
|
1959
|
-
}
|
|
1960
|
-
case "parallelogram": {
|
|
1961
|
-
const s = Math.min(16, w / 5);
|
|
1962
|
-
return `M${f$1(x + s)},${f$1(y)}L${f$1(x + w)},${f$1(y)}L${f$1(x + w - s)},${f$1(y + h)}L${f$1(x)},${f$1(y + h)}Z`;
|
|
1963
|
-
}
|
|
1964
|
-
case "cylinder": {
|
|
1965
|
-
const ry = Math.min(9, h / 6);
|
|
1966
|
-
const rx = w / 2;
|
|
1967
|
-
return `M${f$1(x)},${f$1(y + ry)}a${f$1(rx)},${f$1(ry)} 0 0,1 ${f$1(w)},0L${f$1(x + w)},${f$1(y + h - ry)}a${f$1(rx)},${f$1(ry)} 0 0,1 ${f$1(-w)},0Z`;
|
|
1968
|
-
}
|
|
1969
|
-
case "document": {
|
|
1970
|
-
const wv = Math.min(8, h / 6);
|
|
1971
|
-
return `M${f$1(x + r)},${f$1(y)}L${f$1(x + w - r)},${f$1(y)}Q${f$1(x + w)},${f$1(y)} ${f$1(x + w)},${f$1(y + r)}L${f$1(x + w)},${f$1(y + h - wv)}C${f$1(x + w * .75)},${f$1(y + h - wv * 3)} ${f$1(x + w * .25)},${f$1(y + h + wv)} ${f$1(x)},${f$1(y + h - wv)}L${f$1(x)},${f$1(y + r)}Q${f$1(x)},${f$1(y)} ${f$1(x + r)},${f$1(y)}Z`;
|
|
1972
|
-
}
|
|
1973
|
-
case "note": {
|
|
1974
|
-
const c = Math.min(14, w / 5, h / 3);
|
|
1975
|
-
return `M${f$1(x)},${f$1(y)}L${f$1(x + w - c)},${f$1(y)}L${f$1(x + w)},${f$1(y + c)}L${f$1(x + w)},${f$1(y + h)}L${f$1(x)},${f$1(y + h)}Z`;
|
|
1976
|
-
}
|
|
1977
|
-
default: return rectPath(x, y, w, h, r);
|
|
1978
|
-
}
|
|
1868
|
+
return rectPath(b.x, b.y, b.w, b.h, Math.min(radius, b.w / 2, b.h / 2));
|
|
1979
1869
|
}
|
|
1980
1870
|
/** Extra decoration strokes (cylinder lid line, note fold) drawn over the fill. */
|
|
1981
1871
|
function shapeDetail(shape, b) {
|
|
1982
|
-
|
|
1983
|
-
if (custom) return custom.detail?.(b) ?? null;
|
|
1984
|
-
const { x, y, w, h } = b;
|
|
1985
|
-
if (shape === "cylinder") {
|
|
1986
|
-
const ry = Math.min(9, h / 6);
|
|
1987
|
-
return `M${f$1(x)},${f$1(y + ry)}a${f$1(w / 2)},${f$1(ry)} 0 0,0 ${f$1(w)},0`;
|
|
1988
|
-
}
|
|
1989
|
-
if (shape === "note") {
|
|
1990
|
-
const c = Math.min(14, w / 5, h / 3);
|
|
1991
|
-
return `M${f$1(x + w - c)},${f$1(y)}L${f$1(x + w - c)},${f$1(y + c)}L${f$1(x + w)},${f$1(y + c)}`;
|
|
1992
|
-
}
|
|
1993
|
-
return null;
|
|
1872
|
+
return SHAPE_KINDS.get(shape)?.detail?.(b) ?? null;
|
|
1994
1873
|
}
|
|
1995
1874
|
function rectPath(x, y, w, h, r) {
|
|
1996
1875
|
if (r <= 0) return `M${f$1(x)},${f$1(y)}h${f$1(w)}v${f$1(h)}h${f$1(-w)}Z`;
|
|
@@ -2014,54 +1893,22 @@ const SIDE_NORMAL = {
|
|
|
2014
1893
|
y: 0
|
|
2015
1894
|
}
|
|
2016
1895
|
};
|
|
2017
|
-
/** How much of a side can host ports (fraction of the side's half-length). */
|
|
2018
|
-
function portSpread(shape) {
|
|
2019
|
-
if (shape === "circle" || shape === "ellipse" || shape === "diamond") return .45;
|
|
2020
|
-
if (shape === "hexagon" || shape === "pill") return .55;
|
|
2021
|
-
return .75;
|
|
2022
|
-
}
|
|
2023
1896
|
/**
|
|
2024
|
-
* Point on the outline of a
|
|
2025
|
-
*
|
|
1897
|
+
* Point on the outline of a box for a port on `side`. `t` in [-1, 1] slides
|
|
1898
|
+
* the port along that side (0 = centre); `spread` is how much of the side can
|
|
1899
|
+
* host ports (fraction of its half-length). `depth(horiz, rel, u)` gives the
|
|
1900
|
+
* distance from the centre to the outline, for outlines that are not a box:
|
|
1901
|
+
* `horiz` is true on the top and bottom sides, `rel` the scaled position along
|
|
1902
|
+
* the side and `u` the offset in px.
|
|
2026
1903
|
*/
|
|
2027
|
-
function
|
|
1904
|
+
function portOn(b, side, t, spread = .75, depth) {
|
|
2028
1905
|
const cx = b.x + b.w / 2;
|
|
2029
1906
|
const cy = b.y + b.h / 2;
|
|
2030
|
-
const
|
|
2031
|
-
const bb = b.h / 2;
|
|
2032
|
-
const s = Math.max(-1, Math.min(1, t)) * portSpread(shape);
|
|
1907
|
+
const s = Math.max(-1, Math.min(1, t)) * spread;
|
|
2033
1908
|
const horiz = side === "top" || side === "bottom";
|
|
2034
1909
|
const sign = side === "bottom" || side === "right" ? 1 : -1;
|
|
2035
|
-
const u = s * (horiz ?
|
|
2036
|
-
|
|
2037
|
-
const rel = s;
|
|
2038
|
-
switch (shape) {
|
|
2039
|
-
case "circle":
|
|
2040
|
-
case "ellipse":
|
|
2041
|
-
v = (horiz ? bb : a) * Math.sqrt(Math.max(0, 1 - rel * rel));
|
|
2042
|
-
break;
|
|
2043
|
-
case "diamond":
|
|
2044
|
-
v = (horiz ? bb : a) * (1 - Math.abs(rel));
|
|
2045
|
-
break;
|
|
2046
|
-
case "hexagon":
|
|
2047
|
-
if (horiz) v = bb;
|
|
2048
|
-
else v = a - Math.min(b.h * .3, b.w / 4) * Math.abs(rel);
|
|
2049
|
-
break;
|
|
2050
|
-
case "pill":
|
|
2051
|
-
if (horiz) v = bb;
|
|
2052
|
-
else {
|
|
2053
|
-
const r = bb;
|
|
2054
|
-
v = a - r + Math.sqrt(Math.max(0, r * r - u * u));
|
|
2055
|
-
}
|
|
2056
|
-
break;
|
|
2057
|
-
case "cylinder":
|
|
2058
|
-
if (horiz) {
|
|
2059
|
-
const ry = Math.min(9, b.h / 6);
|
|
2060
|
-
v = bb - ry + ry * Math.sqrt(Math.max(0, 1 - rel * rel));
|
|
2061
|
-
} else v = a;
|
|
2062
|
-
break;
|
|
2063
|
-
default: v = horiz ? bb : a;
|
|
2064
|
-
}
|
|
1910
|
+
const u = s * (horiz ? b.w / 2 : b.h / 2);
|
|
1911
|
+
const v = depth ? depth(horiz, s, u) : horiz ? b.h / 2 : b.w / 2;
|
|
2065
1912
|
if (horiz) return {
|
|
2066
1913
|
x: cx + u,
|
|
2067
1914
|
y: cy + sign * v
|
|
@@ -2071,20 +1918,19 @@ function portPoint(shape, b, side, t) {
|
|
|
2071
1918
|
y: cy + u
|
|
2072
1919
|
};
|
|
2073
1920
|
}
|
|
1921
|
+
/** Point on the outline of a shape for a port on `side`, see `portOn`. */
|
|
1922
|
+
function portPoint(shape, b, side, t) {
|
|
1923
|
+
const custom = SHAPE_KINDS.get(shape);
|
|
1924
|
+
return custom?.port ? custom.port(b, side, t) : portOn(b, side, t);
|
|
1925
|
+
}
|
|
2074
1926
|
// src/core/lint.ts
|
|
2075
1927
|
const CURVES$1 = [
|
|
2076
1928
|
"smooth",
|
|
2077
1929
|
"orthogonal",
|
|
2078
1930
|
"straight"
|
|
2079
1931
|
];
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
"open",
|
|
2083
|
-
"dot",
|
|
2084
|
-
"diamond",
|
|
2085
|
-
"bar",
|
|
2086
|
-
"none"
|
|
2087
|
-
];
|
|
1932
|
+
/** `none` is core; `use()` adds every plugin's markers (the built-in ones too) in front of it */
|
|
1933
|
+
const HEADS = ["none"];
|
|
2088
1934
|
const SIDES$1 = [
|
|
2089
1935
|
"top",
|
|
2090
1936
|
"right",
|
|
@@ -2527,14 +2373,14 @@ const CURVES = /* @__PURE__ */ new Set([
|
|
|
2527
2373
|
"orthogonal",
|
|
2528
2374
|
"straight"
|
|
2529
2375
|
]);
|
|
2530
|
-
const isShape = (k) =>
|
|
2376
|
+
const isShape = (k) => SHAPE_KINDS.has(k) || k in SHAPE_ALIASES;
|
|
2531
2377
|
/**
|
|
2532
2378
|
* Imports only read `.yu` (or the older `.yuhwa`) files: a diagram must not pull other files
|
|
2533
2379
|
* (keys, configs) into its output or errors, whatever the resolver.
|
|
2534
2380
|
*/
|
|
2535
2381
|
const isYuhwaPath = (path) => /\.(yu|yuhwa)$/i.test(path);
|
|
2536
2382
|
/** Join an import path to the importing file's folder and normalise `.`/`..`. */
|
|
2537
|
-
function joinPath(from, rel) {
|
|
2383
|
+
function joinPath$1(from, rel) {
|
|
2538
2384
|
if (/^[a-z][a-z0-9+.-]*:/i.test(rel)) return rel;
|
|
2539
2385
|
const base = rel.startsWith("/") || !from ? "" : from.replace(/[^/]*$/, "");
|
|
2540
2386
|
const abs = (base + rel).startsWith("/");
|
|
@@ -2973,7 +2819,7 @@ function parse(source, opts = {}) {
|
|
|
2973
2819
|
*/
|
|
2974
2820
|
const importFile = (rel, li, names) => {
|
|
2975
2821
|
if (!opts.resolve) return warn(li, `Cannot import "${rel}": no resolver (pass { resolve } to render, or use the CLI)`, "error");
|
|
2976
|
-
const path = joinPath(opts.file, rel);
|
|
2822
|
+
const path = joinPath$1(opts.file, rel);
|
|
2977
2823
|
if (!isYuhwaPath(path)) return warn(li, `Cannot import "${rel}": imports must be .yu files`, "error");
|
|
2978
2824
|
const chain = [...opts.chain ?? (opts.file ? [opts.file] : [])];
|
|
2979
2825
|
if (chain.includes(path)) return warn(li, `Import cycle: ${[...chain, path].join(" -> ")}`, "error");
|
|
@@ -3157,7 +3003,13 @@ function parse(source, opts = {}) {
|
|
|
3157
3003
|
const lead = top.lines.findIndex((l) => l.trim());
|
|
3158
3004
|
p.body = dedent(top.lines);
|
|
3159
3005
|
p.lines = [top.start, end];
|
|
3160
|
-
|
|
3006
|
+
try {
|
|
3007
|
+
p.data = PANELS.get(p.kind).parse(p.body, p.props, (i, msg) => warn(i < 0 ? top.start : top.start + 1 + Math.max(0, lead) + i, msg));
|
|
3008
|
+
} catch (e) {
|
|
3009
|
+
const who = ownerOf("panel", p.kind);
|
|
3010
|
+
warn(top.start, `${who ? `plugin "${who}": ` : ""}${p.kind} panel failed to parse: ${errorText(e)}`, "error");
|
|
3011
|
+
p.failed = true;
|
|
3012
|
+
}
|
|
3161
3013
|
};
|
|
3162
3014
|
/** theme body: `key: value` lines */
|
|
3163
3015
|
const themeBodyLine = (top, raw, li) => {
|
|
@@ -4079,96 +3931,96 @@ const registry = {
|
|
|
4079
3931
|
const addAll = (list, items) => {
|
|
4080
3932
|
for (const i of items ?? []) if (!list.includes(i)) list.push(i);
|
|
4081
3933
|
};
|
|
4082
|
-
/**
|
|
4083
|
-
const
|
|
3934
|
+
/** marker names go in front of `none`, so the choices list the drawn ones first */
|
|
3935
|
+
const addMarkers = (list, markers) => {
|
|
3936
|
+
for (const m of markers ?? []) {
|
|
3937
|
+
if (list.includes(m.name)) continue;
|
|
3938
|
+
const none = list.indexOf("none");
|
|
3939
|
+
list.splice(none < 0 ? list.length : none, 0, m.name);
|
|
3940
|
+
}
|
|
3941
|
+
};
|
|
4084
3942
|
const none = () => {};
|
|
3943
|
+
const empty = () => "";
|
|
3944
|
+
const zero = () => ({
|
|
3945
|
+
w: 0,
|
|
3946
|
+
h: 0
|
|
3947
|
+
});
|
|
3948
|
+
/** what each kind's functions return instead when they throw */
|
|
3949
|
+
const FALLBACK = {
|
|
3950
|
+
row: {
|
|
3951
|
+
parse: () => null,
|
|
3952
|
+
finish: none,
|
|
3953
|
+
measure: zero,
|
|
3954
|
+
render: empty
|
|
3955
|
+
},
|
|
3956
|
+
frame: {
|
|
3957
|
+
inset: () => ({ top: 0 }),
|
|
3958
|
+
render: empty
|
|
3959
|
+
},
|
|
3960
|
+
decoration: {
|
|
3961
|
+
measure: () => null,
|
|
3962
|
+
render: empty
|
|
3963
|
+
},
|
|
3964
|
+
shape: {
|
|
3965
|
+
path: (b) => rectPath(b.x, b.y, b.w, b.h, 0),
|
|
3966
|
+
size: (w, h) => ({
|
|
3967
|
+
w,
|
|
3968
|
+
h
|
|
3969
|
+
}),
|
|
3970
|
+
detail: () => null,
|
|
3971
|
+
port: (b) => ({
|
|
3972
|
+
x: b.x + b.w / 2,
|
|
3973
|
+
y: b.y + b.h / 2
|
|
3974
|
+
})
|
|
3975
|
+
},
|
|
3976
|
+
marker: {
|
|
3977
|
+
render: empty,
|
|
3978
|
+
inset: () => 0
|
|
3979
|
+
},
|
|
3980
|
+
panel: {
|
|
3981
|
+
measure: zero,
|
|
3982
|
+
render: empty,
|
|
3983
|
+
handles: () => [],
|
|
3984
|
+
parts: () => [],
|
|
3985
|
+
editPart: () => null
|
|
3986
|
+
},
|
|
3987
|
+
hook: {
|
|
3988
|
+
transform: none,
|
|
3989
|
+
afterLayout: none,
|
|
3990
|
+
postRender: (svg) => svg
|
|
3991
|
+
}
|
|
3992
|
+
};
|
|
3993
|
+
/** `k` with each function named in `fb` wrapped by `guard` */
|
|
3994
|
+
function wrap(plugin, what, k, fb) {
|
|
3995
|
+
const out = { ...k };
|
|
3996
|
+
for (const [m, f] of Object.entries(fb)) {
|
|
3997
|
+
const fn = out[m];
|
|
3998
|
+
if (typeof fn === "function") out[m] = guard(plugin, what(m), fn.bind(k), f);
|
|
3999
|
+
}
|
|
4000
|
+
return out;
|
|
4001
|
+
}
|
|
4085
4002
|
/** copies of a plugin's parts whose every function reports a throw instead of passing it on */
|
|
4086
4003
|
function guarded(p) {
|
|
4087
4004
|
const n = p.name;
|
|
4088
|
-
const
|
|
4089
|
-
const opt = (what, fn, fb) => fn && g(what, fn.bind(void 0), fb);
|
|
4090
|
-
const live = (what, fn, fb) => fn && g(what, (data, ...a) => data === FAILED_PANEL ? fb : fn(data, ...a), () => fb);
|
|
4005
|
+
const kinds = (list, what, fb) => (list ?? []).map((k) => wrap(n, (m) => what(k, m), k, fb));
|
|
4091
4006
|
return {
|
|
4092
|
-
rows: (p.rows
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
h: 0
|
|
4099
|
-
})),
|
|
4100
|
-
render: g(`row "${r.kind}"`, r.render.bind(r), () => "")
|
|
4101
|
-
})),
|
|
4102
|
-
frames: (p.frames ?? []).map((fr) => ({
|
|
4103
|
-
...fr,
|
|
4104
|
-
inset: g(`frame "${fr.name}"`, fr.inset.bind(fr), () => ({ top: 0 })),
|
|
4105
|
-
render: g(`frame "${fr.name}"`, fr.render.bind(fr), () => "")
|
|
4106
|
-
})),
|
|
4107
|
-
decorations: (p.decorations ?? []).map((dc) => ({
|
|
4108
|
-
...dc,
|
|
4109
|
-
measure: g(`decoration "${dc.name}"`, dc.measure.bind(dc), () => null),
|
|
4110
|
-
render: g(`decoration "${dc.name}"`, dc.render.bind(dc), () => "")
|
|
4111
|
-
})),
|
|
4112
|
-
panels: (p.panels ?? []).map((pk) => {
|
|
4113
|
-
const what = `${pk.name} panel`;
|
|
4114
|
-
return {
|
|
4115
|
-
...pk,
|
|
4116
|
-
parse(body, props, warn) {
|
|
4117
|
-
try {
|
|
4118
|
-
return pk.parse(body, props, warn);
|
|
4119
|
-
} catch (e) {
|
|
4120
|
-
warn(-1, `plugin "${n}": ${what} failed to parse: ${e instanceof Error ? e.message : String(e)}`, "error");
|
|
4121
|
-
return FAILED_PANEL;
|
|
4122
|
-
}
|
|
4123
|
-
},
|
|
4124
|
-
measure: live(`${what} measure`, pk.measure.bind(pk), {
|
|
4125
|
-
w: 0,
|
|
4126
|
-
h: 0
|
|
4127
|
-
}),
|
|
4128
|
-
render: live(`${what} render`, pk.render.bind(pk), ""),
|
|
4129
|
-
handles: live(`${what} handles`, pk.handles?.bind(pk), []),
|
|
4130
|
-
parts: live(`${what} parts`, pk.parts?.bind(pk), []),
|
|
4131
|
-
editPart: pk.editPart && g(`${what} edit`, (body, edit, data) => data === FAILED_PANEL ? null : pk.editPart(body, edit, data), () => null)
|
|
4132
|
-
};
|
|
4133
|
-
}),
|
|
4007
|
+
rows: kinds(p.rows, (r) => `row "${r.kind}"`, FALLBACK.row),
|
|
4008
|
+
frames: kinds(p.frames, (f) => `frame "${f.name}"`, FALLBACK.frame),
|
|
4009
|
+
decorations: kinds(p.decorations, (d) => `decoration "${d.name}"`, FALLBACK.decoration),
|
|
4010
|
+
shapes: kinds(p.shapes, (s) => `shape "${s.name}"`, FALLBACK.shape),
|
|
4011
|
+
markers: kinds(p.markers, (k) => `marker "${k.name}"`, FALLBACK.marker),
|
|
4012
|
+
panels: kinds(p.panels, (pk, m) => `${pk.name} panel ${m === "editPart" ? "edit" : m}`, FALLBACK.panel),
|
|
4134
4013
|
statements: (p.statements ?? []).map((st) => ({
|
|
4135
4014
|
...st,
|
|
4136
|
-
parse(
|
|
4137
|
-
try {
|
|
4138
|
-
st.parse(args, d, ctx);
|
|
4139
|
-
} catch (e) {
|
|
4140
|
-
ctx.warn(`plugin "${n}": ${st.keyword} failed: ${e instanceof Error ? e.message : String(e)}`, "error");
|
|
4141
|
-
}
|
|
4142
|
-
}
|
|
4143
|
-
})),
|
|
4144
|
-
shapes: (p.shapes ?? []).map((sh) => ({
|
|
4145
|
-
...sh,
|
|
4146
|
-
path: g(`shape "${sh.name}"`, sh.path.bind(sh), (b) => `M${b.x},${b.y}h${b.w}v${b.h}h${-b.w}Z`),
|
|
4147
|
-
size: sh.size && g(`shape "${sh.name}"`, (cw, ch) => sh.size(cw, ch), (w, h) => ({
|
|
4148
|
-
w,
|
|
4149
|
-
h
|
|
4150
|
-
})),
|
|
4151
|
-
detail: sh.detail && g(`shape "${sh.name}"`, (b) => sh.detail(b), () => null)
|
|
4152
|
-
})),
|
|
4153
|
-
markers: (p.markers ?? []).map((mk) => ({
|
|
4154
|
-
...mk,
|
|
4155
|
-
render: g(`marker "${mk.name}"`, mk.render.bind(mk), () => ""),
|
|
4156
|
-
inset: typeof mk.inset === "function" ? g(`marker "${mk.name}"`, mk.inset.bind(mk), () => 0) : mk.inset
|
|
4015
|
+
parse: guard(n, st.keyword, st.parse.bind(st), none, (msg, [, , ctx]) => ctx.warn(msg, "error"))
|
|
4157
4016
|
})),
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4017
|
+
hooks: wrap(n, (m) => m, {
|
|
4018
|
+
transform: p.transform,
|
|
4019
|
+
afterLayout: p.afterLayout,
|
|
4020
|
+
postRender: p.postRender
|
|
4021
|
+
}, FALLBACK.hook)
|
|
4161
4022
|
};
|
|
4162
4023
|
}
|
|
4163
|
-
/** who registered each panel, statement, shape, marker, frame and row kind */
|
|
4164
|
-
const owners = /* @__PURE__ */ new Map();
|
|
4165
|
-
/** a plugin replacing what another one registered is allowed, but worth a word */
|
|
4166
|
-
function claim(what, name, plugin) {
|
|
4167
|
-
const key = `${what} ${name}`;
|
|
4168
|
-
const prev = owners.get(key);
|
|
4169
|
-
if (prev && prev !== plugin) console.warn(`yuhwa: plugin "${plugin}" replaces ${what} "${name}" of plugin "${prev}"`);
|
|
4170
|
-
owners.set(key, plugin);
|
|
4171
|
-
}
|
|
4172
4024
|
/** the tables as they were before the first plugin, so `unuse` can rebuild them */
|
|
4173
4025
|
let baseline;
|
|
4174
4026
|
function snapshot() {
|
|
@@ -4190,6 +4042,7 @@ function snapshot() {
|
|
|
4190
4042
|
BOOLS,
|
|
4191
4043
|
NUMBERS,
|
|
4192
4044
|
THEME_NAMES,
|
|
4045
|
+
SHAPES$2,
|
|
4193
4046
|
registry.rows,
|
|
4194
4047
|
registry.decorations
|
|
4195
4048
|
].map((l) => [l, [...l]]);
|
|
@@ -4199,6 +4052,7 @@ function snapshot() {
|
|
|
4199
4052
|
[...v]
|
|
4200
4053
|
]);
|
|
4201
4054
|
const themes = { ...THEMES };
|
|
4055
|
+
const aliases = { ...SHAPE_ALIASES };
|
|
4202
4056
|
return () => {
|
|
4203
4057
|
for (const [s, v] of sets) {
|
|
4204
4058
|
s.clear();
|
|
@@ -4216,9 +4070,17 @@ function snapshot() {
|
|
|
4216
4070
|
}
|
|
4217
4071
|
for (const k of Object.keys(THEMES)) delete THEMES[k];
|
|
4218
4072
|
Object.assign(THEMES, themes);
|
|
4219
|
-
|
|
4073
|
+
for (const k of Object.keys(SHAPE_ALIASES)) delete SHAPE_ALIASES[k];
|
|
4074
|
+
Object.assign(SHAPE_ALIASES, aliases);
|
|
4075
|
+
clearOwners();
|
|
4220
4076
|
};
|
|
4221
4077
|
}
|
|
4078
|
+
/** `item` replaces the entry with the same name where it was (order matters for rows), or goes last */
|
|
4079
|
+
function place$1(list, item, same) {
|
|
4080
|
+
const at = list.findIndex(same);
|
|
4081
|
+
if (at >= 0) list[at] = item;
|
|
4082
|
+
else list.push(item);
|
|
4083
|
+
}
|
|
4222
4084
|
/** Register plugins. Registering the same plugin name twice is a no-op. */
|
|
4223
4085
|
function use(...plugins) {
|
|
4224
4086
|
baseline ??= snapshot();
|
|
@@ -4226,45 +4088,37 @@ function use(...plugins) {
|
|
|
4226
4088
|
if (registry.plugins.some((q) => q.name === p.name)) continue;
|
|
4227
4089
|
registry.plugins.push(p);
|
|
4228
4090
|
const w = guarded(p);
|
|
4091
|
+
/** each item, under its name, into `into`: a map, or a function for more work */
|
|
4092
|
+
const own = (what, items, key, into) => {
|
|
4093
|
+
for (const x of items) {
|
|
4094
|
+
const k = key(x);
|
|
4095
|
+
claim(what, k, p.name);
|
|
4096
|
+
if (typeof into === "function") into(x, k);
|
|
4097
|
+
else into.set(k, x);
|
|
4098
|
+
}
|
|
4099
|
+
};
|
|
4229
4100
|
for (const t of p.themes ?? []) registerTheme(t);
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
if (at >= 0) registry.rows[at] = r;
|
|
4234
|
-
else registry.rows.push(r);
|
|
4235
|
-
}
|
|
4236
|
-
for (const fr of w.frames) {
|
|
4237
|
-
claim("frame", fr.name, p.name);
|
|
4238
|
-
registry.frames.set(fr.name, fr);
|
|
4239
|
-
}
|
|
4240
|
-
for (const dec of w.decorations) {
|
|
4241
|
-
const at = registry.decorations.findIndex((x) => x.name === dec.name);
|
|
4242
|
-
if (at >= 0) registry.decorations[at] = dec;
|
|
4243
|
-
else registry.decorations.push(dec);
|
|
4101
|
+
own("row", w.rows, (r) => r.kind, (r, k) => place$1(registry.rows, r, (x) => x.kind === k));
|
|
4102
|
+
own("decoration", w.decorations, (dec) => dec.name, (dec, k) => {
|
|
4103
|
+
place$1(registry.decorations, dec, (x) => x.name === k);
|
|
4244
4104
|
KNOWN_SETTINGS.add(dec.setting);
|
|
4245
|
-
}
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
addAll(ENUMS.shape ??= [], p.shapes?.map((x) => x.name));
|
|
4263
|
-
addAll(ENUMS.head ??= [], p.markers?.map((x) => x.name));
|
|
4264
|
-
if (ENUMS.tail !== ENUMS.head) addAll(ENUMS.tail ??= [], p.markers?.map((x) => x.name));
|
|
4265
|
-
if (w.transform) TRANSFORMS.push(w.transform);
|
|
4266
|
-
if (w.afterLayout) AFTER_LAYOUT.push(w.afterLayout);
|
|
4267
|
-
if (w.postRender) POST_RENDER.push(w.postRender);
|
|
4105
|
+
});
|
|
4106
|
+
own("frame", w.frames, (f) => f.name, registry.frames);
|
|
4107
|
+
own("panel", w.panels, (pk) => pk.name, PANELS);
|
|
4108
|
+
own("statement", w.statements, (st) => st.keyword, STATEMENTS);
|
|
4109
|
+
own("marker", w.markers, (mk) => mk.name, MARKER_KINDS);
|
|
4110
|
+
own("shape", w.shapes, (sh) => sh.name, (sh, k) => {
|
|
4111
|
+
SHAPE_KINDS.set(k, sh);
|
|
4112
|
+
if (!SHAPES$2.includes(k)) SHAPES$2.push(k);
|
|
4113
|
+
for (const a of sh.aliases ?? []) SHAPE_ALIASES[a] = k;
|
|
4114
|
+
});
|
|
4115
|
+
addAll(ENUMS.shape ??= [], [...p.shapes?.map((x) => x.name) ?? [], ...p.shapes?.flatMap((x) => x.aliases ?? []) ?? []]);
|
|
4116
|
+
addMarkers(ENUMS.head ??= [], p.markers);
|
|
4117
|
+
if (ENUMS.tail !== ENUMS.head) addMarkers(ENUMS.tail ??= [], p.markers);
|
|
4118
|
+
const { transform, afterLayout, postRender } = w.hooks;
|
|
4119
|
+
if (transform) TRANSFORMS.push(transform);
|
|
4120
|
+
if (afterLayout) AFTER_LAYOUT.push(afterLayout);
|
|
4121
|
+
if (postRender) POST_RENDER.push(postRender);
|
|
4268
4122
|
for (const s of p.settings ?? []) KNOWN_SETTINGS.add(s);
|
|
4269
4123
|
addAll(NODE_PROPS, p.props?.node);
|
|
4270
4124
|
addAll(EDGE_PROPS, p.props?.edge);
|
|
@@ -4275,6 +4129,286 @@ function use(...plugins) {
|
|
|
4275
4129
|
}
|
|
4276
4130
|
if (registry.frames.size) addAll(ENUMS.frame ??= [], [...registry.frames.keys()]);
|
|
4277
4131
|
}
|
|
4132
|
+
// src/core/measure.ts
|
|
4133
|
+
const NARROW = new Set("iljtfr.,;:'!|()[]{} \"`".split(""));
|
|
4134
|
+
const WIDE = new Set("mwMW@%".split(""));
|
|
4135
|
+
/** Font-independent width estimate, tuned for Inter / system UI fonts. */
|
|
4136
|
+
const approxMeasure = (text, fontSize, weight, mono) => {
|
|
4137
|
+
if (mono) return [...text].length * fontSize * .6;
|
|
4138
|
+
let w = 0;
|
|
4139
|
+
for (const ch of text) {
|
|
4140
|
+
const cp = ch.codePointAt(0);
|
|
4141
|
+
if (cp > 8192) w += cp > 126976 ? 1.2 : 1;
|
|
4142
|
+
else if (NARROW.has(ch)) w += .3;
|
|
4143
|
+
else if (WIDE.has(ch)) w += .86;
|
|
4144
|
+
else if (ch >= "A" && ch <= "Z") w += .66;
|
|
4145
|
+
else if (ch >= "0" && ch <= "9") w += .58;
|
|
4146
|
+
else w += .54;
|
|
4147
|
+
}
|
|
4148
|
+
return w * fontSize * (weight >= 600 ? 1.05 : 1);
|
|
4149
|
+
};
|
|
4150
|
+
const MONO_STACK = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
4151
|
+
let canvasCtx;
|
|
4152
|
+
/** Accurate measurement using a canvas when running in a browser. */
|
|
4153
|
+
function canvasMeasure(fontFamily) {
|
|
4154
|
+
return (text, fontSize, weight, mono) => {
|
|
4155
|
+
if (canvasCtx === void 0) try {
|
|
4156
|
+
canvasCtx = typeof document !== "undefined" ? document.createElement("canvas").getContext("2d") : null;
|
|
4157
|
+
} catch {
|
|
4158
|
+
canvasCtx = null;
|
|
4159
|
+
}
|
|
4160
|
+
if (!canvasCtx) return approxMeasure(text, fontSize, weight, mono);
|
|
4161
|
+
const family = mono && !/mono|courier|consolas|menlo/i.test(fontFamily) ? MONO_STACK : fontFamily;
|
|
4162
|
+
canvasCtx.font = `${weight} ${fontSize}px ${family}`;
|
|
4163
|
+
return canvasCtx.measureText(text).width;
|
|
4164
|
+
};
|
|
4165
|
+
}
|
|
4166
|
+
// src/plugins/shapes.ts
|
|
4167
|
+
/** the content box grown by the default padding, before a shape's minimums */
|
|
4168
|
+
const pad = (cw, ch) => ({
|
|
4169
|
+
w: cw + 44,
|
|
4170
|
+
h: ch + 28
|
|
4171
|
+
});
|
|
4172
|
+
/** a port on an ellipse that fills the box */
|
|
4173
|
+
const ellipsePort = (b, side, t) => portOn(b, side, t, .45, (horiz, rel) => (horiz ? b.h / 2 : b.w / 2) * Math.sqrt(Math.max(0, 1 - rel * rel)));
|
|
4174
|
+
const ellipsePath = ({ x, y, w, h }) => {
|
|
4175
|
+
const rx = w / 2;
|
|
4176
|
+
const ry = h / 2;
|
|
4177
|
+
const cx = x + rx;
|
|
4178
|
+
return `M${f$2(cx - rx)},${f$2(y + ry)}a${f$2(rx)},${f$2(ry)} 0 1,0 ${f$2(rx * 2)},0a${f$2(rx)},${f$2(ry)} 0 1,0 ${f$2(-rx * 2)},0Z`;
|
|
4179
|
+
};
|
|
4180
|
+
const round = (b, radius) => Math.min(radius, b.w / 2, b.h / 2);
|
|
4181
|
+
const shapes = {
|
|
4182
|
+
name: "shapes",
|
|
4183
|
+
shapes: [
|
|
4184
|
+
{
|
|
4185
|
+
name: "rounded",
|
|
4186
|
+
aliases: ["round"],
|
|
4187
|
+
path: (b, radius) => rectPath(b.x, b.y, b.w, b.h, round(b, radius))
|
|
4188
|
+
},
|
|
4189
|
+
{
|
|
4190
|
+
name: "box",
|
|
4191
|
+
aliases: [
|
|
4192
|
+
"rect",
|
|
4193
|
+
"rectangle",
|
|
4194
|
+
"square"
|
|
4195
|
+
],
|
|
4196
|
+
path: (b, radius) => rectPath(b.x, b.y, b.w, b.h, Math.min(round(b, radius), 3))
|
|
4197
|
+
},
|
|
4198
|
+
{
|
|
4199
|
+
name: "pill",
|
|
4200
|
+
aliases: ["stadium", "capsule"],
|
|
4201
|
+
size: (cw, ch) => {
|
|
4202
|
+
const { w, h } = pad(cw, ch);
|
|
4203
|
+
return {
|
|
4204
|
+
w: Math.max(w + 8, 96),
|
|
4205
|
+
h: Math.max(h, 44)
|
|
4206
|
+
};
|
|
4207
|
+
},
|
|
4208
|
+
path: (b) => rectPath(b.x, b.y, b.w, b.h, b.h / 2),
|
|
4209
|
+
port: (b, side, t) => portOn(b, side, t, .55, (horiz, _rel, u) => {
|
|
4210
|
+
if (horiz) return b.h / 2;
|
|
4211
|
+
const r = b.h / 2;
|
|
4212
|
+
return b.w / 2 - r + Math.sqrt(Math.max(0, r * r - u * u));
|
|
4213
|
+
})
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
name: "circle",
|
|
4217
|
+
size: (cw, ch) => {
|
|
4218
|
+
const d = Math.max(Math.hypot(cw, ch) + 16, 64);
|
|
4219
|
+
return {
|
|
4220
|
+
w: d,
|
|
4221
|
+
h: d
|
|
4222
|
+
};
|
|
4223
|
+
},
|
|
4224
|
+
path: ellipsePath,
|
|
4225
|
+
port: ellipsePort
|
|
4226
|
+
},
|
|
4227
|
+
{
|
|
4228
|
+
name: "ellipse",
|
|
4229
|
+
aliases: ["oval"],
|
|
4230
|
+
size: (cw, ch) => ({
|
|
4231
|
+
w: Math.max((cw + 16) * 1.42, 90),
|
|
4232
|
+
h: Math.max((ch + 12) * 1.42, 50)
|
|
4233
|
+
}),
|
|
4234
|
+
path: ellipsePath,
|
|
4235
|
+
port: ellipsePort
|
|
4236
|
+
},
|
|
4237
|
+
{
|
|
4238
|
+
name: "diamond",
|
|
4239
|
+
aliases: ["rhombus", "decision"],
|
|
4240
|
+
size: (cw, ch) => ({
|
|
4241
|
+
w: Math.max(cw * 1.6 + 40, 100),
|
|
4242
|
+
h: Math.max(ch * 1.8 + 32, 70)
|
|
4243
|
+
}),
|
|
4244
|
+
path: ({ x, y, w, h }) => `M${f$2(x + w / 2)},${f$2(y)}L${f$2(x + w)},${f$2(y + h / 2)}L${f$2(x + w / 2)},${f$2(y + h)}L${f$2(x)},${f$2(y + h / 2)}Z`,
|
|
4245
|
+
port: (b, side, t) => portOn(b, side, t, .45, (horiz, rel) => (horiz ? b.h / 2 : b.w / 2) * (1 - Math.abs(rel)))
|
|
4246
|
+
},
|
|
4247
|
+
{
|
|
4248
|
+
name: "hexagon",
|
|
4249
|
+
size: (cw, ch) => {
|
|
4250
|
+
const { w, h: h0 } = pad(cw, ch);
|
|
4251
|
+
const h = Math.max(h0, 48);
|
|
4252
|
+
return {
|
|
4253
|
+
w: w + h * .4,
|
|
4254
|
+
h
|
|
4255
|
+
};
|
|
4256
|
+
},
|
|
4257
|
+
path: ({ x, y, w, h }) => {
|
|
4258
|
+
const i = Math.min(h * .3, w / 4);
|
|
4259
|
+
return `M${f$2(x + i)},${f$2(y)}L${f$2(x + w - i)},${f$2(y)}L${f$2(x + w)},${f$2(y + h / 2)}L${f$2(x + w - i)},${f$2(y + h)}L${f$2(x + i)},${f$2(y + h)}L${f$2(x)},${f$2(y + h / 2)}Z`;
|
|
4260
|
+
},
|
|
4261
|
+
port: (b, side, t) => portOn(b, side, t, .55, (horiz, rel) => horiz ? b.h / 2 : b.w / 2 - Math.min(b.h * .3, b.w / 4) * Math.abs(rel))
|
|
4262
|
+
},
|
|
4263
|
+
{
|
|
4264
|
+
name: "cylinder",
|
|
4265
|
+
aliases: [
|
|
4266
|
+
"database",
|
|
4267
|
+
"db",
|
|
4268
|
+
"storage"
|
|
4269
|
+
],
|
|
4270
|
+
textOffset: 5,
|
|
4271
|
+
size: (cw, ch) => {
|
|
4272
|
+
const { w, h } = pad(cw, ch);
|
|
4273
|
+
return {
|
|
4274
|
+
w: Math.max(w, 96),
|
|
4275
|
+
h: Math.max(h + 18, 66)
|
|
4276
|
+
};
|
|
4277
|
+
},
|
|
4278
|
+
path: ({ x, y, w, h }) => {
|
|
4279
|
+
const ry = Math.min(9, h / 6);
|
|
4280
|
+
const rx = w / 2;
|
|
4281
|
+
return `M${f$2(x)},${f$2(y + ry)}a${f$2(rx)},${f$2(ry)} 0 0,1 ${f$2(w)},0L${f$2(x + w)},${f$2(y + h - ry)}a${f$2(rx)},${f$2(ry)} 0 0,1 ${f$2(-w)},0Z`;
|
|
4282
|
+
},
|
|
4283
|
+
detail: ({ x, y, w, h }) => {
|
|
4284
|
+
const ry = Math.min(9, h / 6);
|
|
4285
|
+
return `M${f$2(x)},${f$2(y + ry)}a${f$2(w / 2)},${f$2(ry)} 0 0,0 ${f$2(w)},0`;
|
|
4286
|
+
},
|
|
4287
|
+
port: (b, side, t) => portOn(b, side, t, .75, (horiz, rel) => {
|
|
4288
|
+
if (!horiz) return b.w / 2;
|
|
4289
|
+
const ry = Math.min(9, b.h / 6);
|
|
4290
|
+
return b.h / 2 - ry + ry * Math.sqrt(Math.max(0, 1 - rel * rel));
|
|
4291
|
+
})
|
|
4292
|
+
},
|
|
4293
|
+
{
|
|
4294
|
+
name: "parallelogram",
|
|
4295
|
+
aliases: ["io"],
|
|
4296
|
+
size: (cw, ch) => {
|
|
4297
|
+
const { w, h } = pad(cw, ch);
|
|
4298
|
+
return {
|
|
4299
|
+
w: w + 24,
|
|
4300
|
+
h: Math.max(h, 48)
|
|
4301
|
+
};
|
|
4302
|
+
},
|
|
4303
|
+
path: ({ x, y, w, h }) => {
|
|
4304
|
+
const s = Math.min(16, w / 5);
|
|
4305
|
+
return `M${f$2(x + s)},${f$2(y)}L${f$2(x + w)},${f$2(y)}L${f$2(x + w - s)},${f$2(y + h)}L${f$2(x)},${f$2(y + h)}Z`;
|
|
4306
|
+
}
|
|
4307
|
+
},
|
|
4308
|
+
{
|
|
4309
|
+
name: "document",
|
|
4310
|
+
aliases: ["doc"],
|
|
4311
|
+
textOffset: -4,
|
|
4312
|
+
size: (cw, ch) => {
|
|
4313
|
+
const { w, h } = pad(cw, ch);
|
|
4314
|
+
return {
|
|
4315
|
+
w: Math.max(w, 96),
|
|
4316
|
+
h: Math.max(h + 10, 56)
|
|
4317
|
+
};
|
|
4318
|
+
},
|
|
4319
|
+
path: (b, radius) => {
|
|
4320
|
+
const { x, y, w, h } = b;
|
|
4321
|
+
const r = round(b, radius);
|
|
4322
|
+
const wv = Math.min(8, h / 6);
|
|
4323
|
+
return `M${f$2(x + r)},${f$2(y)}L${f$2(x + w - r)},${f$2(y)}Q${f$2(x + w)},${f$2(y)} ${f$2(x + w)},${f$2(y + r)}L${f$2(x + w)},${f$2(y + h - wv)}C${f$2(x + w * .75)},${f$2(y + h - wv * 3)} ${f$2(x + w * .25)},${f$2(y + h + wv)} ${f$2(x)},${f$2(y + h - wv)}L${f$2(x)},${f$2(y + r)}Q${f$2(x)},${f$2(y)} ${f$2(x + r)},${f$2(y)}Z`;
|
|
4324
|
+
}
|
|
4325
|
+
},
|
|
4326
|
+
{
|
|
4327
|
+
name: "note",
|
|
4328
|
+
aliases: ["sticky"],
|
|
4329
|
+
size: (cw, ch) => {
|
|
4330
|
+
const { w, h } = pad(cw, ch);
|
|
4331
|
+
return {
|
|
4332
|
+
w: Math.max(w + 8, 96),
|
|
4333
|
+
h: Math.max(h, 48)
|
|
4334
|
+
};
|
|
4335
|
+
},
|
|
4336
|
+
path: ({ x, y, w, h }) => {
|
|
4337
|
+
const c = Math.min(14, w / 5, h / 3);
|
|
4338
|
+
return `M${f$2(x)},${f$2(y)}L${f$2(x + w - c)},${f$2(y)}L${f$2(x + w)},${f$2(y + c)}L${f$2(x + w)},${f$2(y + h)}L${f$2(x)},${f$2(y + h)}Z`;
|
|
4339
|
+
},
|
|
4340
|
+
detail: ({ x, y, w, h }) => {
|
|
4341
|
+
const c = Math.min(14, w / 5, h / 3);
|
|
4342
|
+
return `M${f$2(x + w - c)},${f$2(y)}L${f$2(x + w - c)},${f$2(y + c)}L${f$2(x + w)},${f$2(y + c)}`;
|
|
4343
|
+
}
|
|
4344
|
+
},
|
|
4345
|
+
{
|
|
4346
|
+
name: "text",
|
|
4347
|
+
aliases: [
|
|
4348
|
+
"label",
|
|
4349
|
+
"plain",
|
|
4350
|
+
"none"
|
|
4351
|
+
],
|
|
4352
|
+
size: (cw, ch) => ({
|
|
4353
|
+
w: cw + 12,
|
|
4354
|
+
h: ch + 8
|
|
4355
|
+
}),
|
|
4356
|
+
path: (b, radius) => rectPath(b.x, b.y, b.w, b.h, round(b, radius))
|
|
4357
|
+
}
|
|
4358
|
+
]
|
|
4359
|
+
};
|
|
4360
|
+
// src/plugins/markers.ts
|
|
4361
|
+
/** a point in the marker's frame: x runs along the line towards the tip, y across it */
|
|
4362
|
+
const frame = (at, angle) => {
|
|
4363
|
+
const cos = Math.cos(angle);
|
|
4364
|
+
const sin = Math.sin(angle);
|
|
4365
|
+
return (x, y) => `${f$2(at.x + x * cos - y * sin)},${f$2(at.y + x * sin + y * cos)}`;
|
|
4366
|
+
};
|
|
4367
|
+
const markers = {
|
|
4368
|
+
name: "markers",
|
|
4369
|
+
markers: [
|
|
4370
|
+
{
|
|
4371
|
+
name: "arrow",
|
|
4372
|
+
inset: (L) => L * .8,
|
|
4373
|
+
render(at, angle, { color, width: w, size: L }) {
|
|
4374
|
+
const P = frame(at, angle);
|
|
4375
|
+
return `<path d="M${P(0, 0)}L${P(-L, L * .5)}Q${P(-L * .78, 0)} ${P(-L, -L * .5)}Z" fill="${color}" stroke="${color}" stroke-width="${f$2(w * .5)}" stroke-linejoin="round"/>`;
|
|
4376
|
+
}
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
name: "open",
|
|
4380
|
+
inset: (_L, w) => w * .8,
|
|
4381
|
+
render(at, angle, { color, width: w, size: L }) {
|
|
4382
|
+
const P = frame(at, angle);
|
|
4383
|
+
return `<path d="M${P(-L * .95, L * .55)}L${P(0, 0)}L${P(-L * .95, -L * .55)}" fill="none" stroke="${color}" stroke-width="${f$2(w)}" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
4384
|
+
}
|
|
4385
|
+
},
|
|
4386
|
+
{
|
|
4387
|
+
name: "dot",
|
|
4388
|
+
inset: (L) => L * .7,
|
|
4389
|
+
render(at, angle, { color, size: L }) {
|
|
4390
|
+
const r = L * .36;
|
|
4391
|
+
const [cx, cy] = frame(at, angle)(-r, 0).split(",");
|
|
4392
|
+
return `<circle cx="${cx}" cy="${cy}" r="${f$2(r)}" fill="${color}"/>`;
|
|
4393
|
+
}
|
|
4394
|
+
},
|
|
4395
|
+
{
|
|
4396
|
+
name: "diamond",
|
|
4397
|
+
inset: (L) => L * 1.6,
|
|
4398
|
+
render(at, angle, { color, size: L }) {
|
|
4399
|
+
const P = frame(at, angle);
|
|
4400
|
+
return `<path d="M${P(0, 0)}L${P(-L * .8, L * .45)}L${P(-L * 1.6, 0)}L${P(-L * .8, -L * .45)}Z" fill="${color}"/>`;
|
|
4401
|
+
}
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
name: "bar",
|
|
4405
|
+
render(at, angle, { color, width: w, size: L }) {
|
|
4406
|
+
const P = frame(at, angle);
|
|
4407
|
+
return `<path d="M${P(-4, L * .6)}L${P(-4, -L * .6)}" stroke="${color}" stroke-width="${f$2(w * 1.2)}" stroke-linecap="round"/>`;
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
]
|
|
4411
|
+
};
|
|
4278
4412
|
const themes = {
|
|
4279
4413
|
name: "themes",
|
|
4280
4414
|
themes: [
|
|
@@ -4942,40 +5076,6 @@ const frames = {
|
|
|
4942
5076
|
],
|
|
4943
5077
|
props: { node: ["frame"] }
|
|
4944
5078
|
};
|
|
4945
|
-
// src/core/measure.ts
|
|
4946
|
-
const NARROW = new Set("iljtfr.,;:'!|()[]{} \"`".split(""));
|
|
4947
|
-
const WIDE = new Set("mwMW@%".split(""));
|
|
4948
|
-
/** Font-independent width estimate, tuned for Inter / system UI fonts. */
|
|
4949
|
-
const approxMeasure = (text, fontSize, weight, mono) => {
|
|
4950
|
-
if (mono) return [...text].length * fontSize * .6;
|
|
4951
|
-
let w = 0;
|
|
4952
|
-
for (const ch of text) {
|
|
4953
|
-
const cp = ch.codePointAt(0);
|
|
4954
|
-
if (cp > 8192) w += cp > 126976 ? 1.2 : 1;
|
|
4955
|
-
else if (NARROW.has(ch)) w += .3;
|
|
4956
|
-
else if (WIDE.has(ch)) w += .86;
|
|
4957
|
-
else if (ch >= "A" && ch <= "Z") w += .66;
|
|
4958
|
-
else if (ch >= "0" && ch <= "9") w += .58;
|
|
4959
|
-
else w += .54;
|
|
4960
|
-
}
|
|
4961
|
-
return w * fontSize * (weight >= 600 ? 1.05 : 1);
|
|
4962
|
-
};
|
|
4963
|
-
const MONO_STACK = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
4964
|
-
let canvasCtx;
|
|
4965
|
-
/** Accurate measurement using a canvas when running in a browser. */
|
|
4966
|
-
function canvasMeasure(fontFamily) {
|
|
4967
|
-
return (text, fontSize, weight, mono) => {
|
|
4968
|
-
if (canvasCtx === void 0) try {
|
|
4969
|
-
canvasCtx = typeof document !== "undefined" ? document.createElement("canvas").getContext("2d") : null;
|
|
4970
|
-
} catch {
|
|
4971
|
-
canvasCtx = null;
|
|
4972
|
-
}
|
|
4973
|
-
if (!canvasCtx) return approxMeasure(text, fontSize, weight, mono);
|
|
4974
|
-
const family = mono && !/mono|courier|consolas|menlo/i.test(fontFamily) ? MONO_STACK : fontFamily;
|
|
4975
|
-
canvasCtx.font = `${weight} ${fontSize}px ${family}`;
|
|
4976
|
-
return canvasCtx.measureText(text).width;
|
|
4977
|
-
};
|
|
4978
|
-
}
|
|
4979
5079
|
// src/plugins/footer.ts
|
|
4980
5080
|
const split$1 = (v) => v.split("|").map((s) => s.trim()).filter(Boolean);
|
|
4981
5081
|
/** item widths from the last measure, so render places them with the real metrics */
|
|
@@ -8318,7 +8418,7 @@ const STATUS_MARK = {
|
|
|
8318
8418
|
renamed: "R",
|
|
8319
8419
|
ignored: ""
|
|
8320
8420
|
};
|
|
8321
|
-
const FLAGS = [
|
|
8421
|
+
const FLAGS$1 = [
|
|
8322
8422
|
"collapsed",
|
|
8323
8423
|
"highlight",
|
|
8324
8424
|
"dim",
|
|
@@ -8488,7 +8588,7 @@ function outsideBrackets(s) {
|
|
|
8488
8588
|
}
|
|
8489
8589
|
const bare$1 = (text) => text.replace(/\/$/, "");
|
|
8490
8590
|
function checkProps(props, warn) {
|
|
8491
|
-
for (const k of Object.keys(props)) if (!FLAGS.includes(k) && !KEYS.includes(k)) warn(`treeview: unknown prop "${k}" (use a colour, ${[...KEYS.slice(1), ...FLAGS].join(", ")})`);
|
|
8591
|
+
for (const k of Object.keys(props)) if (!FLAGS$1.includes(k) && !KEYS.includes(k)) warn(`treeview: unknown prop "${k}" (use a colour, ${[...KEYS.slice(1), ...FLAGS$1].join(", ")})`);
|
|
8492
8592
|
if (props.status && !STATUSES.includes(props.status)) warn(`treeview: unknown status "${props.status}" (use one of: ${STATUSES.join(", ")})`);
|
|
8493
8593
|
if (props.color && !isSafeCss(props.color)) delete props.color;
|
|
8494
8594
|
}
|
|
@@ -8992,6 +9092,8 @@ function renderTreeview(roots, box, ctx) {
|
|
|
8992
9092
|
// src/setup.ts
|
|
8993
9093
|
/** Registers the built-in plugins. Imported for its side effect by every entry point. */
|
|
8994
9094
|
use(...[
|
|
9095
|
+
shapes,
|
|
9096
|
+
markers,
|
|
8995
9097
|
themes,
|
|
8996
9098
|
charts,
|
|
8997
9099
|
tables,
|
|
@@ -10562,7 +10664,7 @@ function layoutGroups(d, nodes, theme, measure) {
|
|
|
10562
10664
|
decl: g,
|
|
10563
10665
|
depth: depth(gid),
|
|
10564
10666
|
...box,
|
|
10565
|
-
...head
|
|
10667
|
+
...head,
|
|
10566
10668
|
style: resolveGroupStyle({
|
|
10567
10669
|
...g,
|
|
10568
10670
|
props: effectiveProps(d, g)
|
|
@@ -10670,8 +10772,8 @@ function computeBounds(box, d, theme, measure) {
|
|
|
10670
10772
|
decor
|
|
10671
10773
|
};
|
|
10672
10774
|
}
|
|
10673
|
-
/** height of a panel's title row
|
|
10674
|
-
const panelHead = (label, fs) => label ? fs *
|
|
10775
|
+
/** height of a panel's title row: the capitals (about 0.74 fs) plus a PANEL_PAD-sized gap to the content */
|
|
10776
|
+
const panelHead = (label, fs) => label ? fs * 1.95 : 0;
|
|
10675
10777
|
/** what a panel plugin gets in `measure`, `render` and `handles` */
|
|
10676
10778
|
function panelCtx(decl, offsets, theme, measure) {
|
|
10677
10779
|
return {
|
|
@@ -10694,7 +10796,10 @@ function placePanels(d, theme, measure, graph) {
|
|
|
10694
10796
|
if (!kind) continue;
|
|
10695
10797
|
const offsets = d.layout.panels?.[decl.id]?.parts ?? {};
|
|
10696
10798
|
const ctx = panelCtx(decl, offsets, panelTheme(theme, decl.props, d.themes), measure);
|
|
10697
|
-
const c =
|
|
10799
|
+
const c = decl.failed ? {
|
|
10800
|
+
w: 0,
|
|
10801
|
+
h: 0
|
|
10802
|
+
} : kind.measure(decl.data, ctx);
|
|
10698
10803
|
const head = panelHead(decl.label, ctx.fs);
|
|
10699
10804
|
const tw = decl.label ? richW(decl.label, ctx.fs * 1.05, textFont(decl.props, ctx.fs, 650).weight, theme.mono, measure) : 0;
|
|
10700
10805
|
const w = even(Math.max(c.w, tw) + 32);
|
|
@@ -10718,7 +10823,7 @@ function placePanels(d, theme, measure, graph) {
|
|
|
10718
10823
|
offsets,
|
|
10719
10824
|
ctx,
|
|
10720
10825
|
get handles() {
|
|
10721
|
-
return handles ??= kind.handles?.(decl.data, inner, ctx)
|
|
10826
|
+
return handles ??= !decl.failed && kind.handles?.(decl.data, inner, ctx) || [];
|
|
10722
10827
|
}
|
|
10723
10828
|
});
|
|
10724
10829
|
}
|
|
@@ -10860,13 +10965,13 @@ function renderPanel(p, L, measure, shadow, id) {
|
|
|
10860
10965
|
const T = p.ctx.theme;
|
|
10861
10966
|
const s = resolvePanelStyle(p.decl.props, T, base);
|
|
10862
10967
|
const { box } = p;
|
|
10863
|
-
const
|
|
10968
|
+
const capMid = p.ctx.fs * 1.05 * .35;
|
|
10864
10969
|
const tf = textFont(p.decl.props, p.ctx.fs, 650);
|
|
10865
10970
|
const out = [`<g${attr("data-panel", p.decl.id)}${attr("class", `panel panel-${p.decl.kind}`)}>`];
|
|
10866
10971
|
if (s.framed) out.push(`<rect x="${f(box.x)}" y="${f(box.y)}" width="${f(box.w)}" height="${f(box.h)}" rx="${f(s.radius)}" fill="${s.fill}" stroke="${s.stroke}" stroke-width="${f(s.width)}"${attr("stroke-dasharray", s.dash)}${s.shadow && shadow ? ` filter="url(#${shadow})"` : ""}/>`);
|
|
10867
|
-
if (p.decl.label) out.push(`<text x="${f(box.x + 16)}" y="${f(box.y + 16 +
|
|
10972
|
+
if (p.decl.label) out.push(`<text x="${f(box.x + 16)}" y="${f(box.y + 16 + capMid)}" dominant-baseline="central" font-size="${f(p.ctx.fs * 1.05)}" font-weight="${tf.weight}"${tf.italic ? " font-style=\"italic\"" : ""} fill="${s.text}" xml:space="preserve">${tspans(parseInline(p.decl.label), nodeInk(T, s.text), T)}</text>`);
|
|
10868
10973
|
p.ctx.idPrefix = `${id}-${p.decl.id}`;
|
|
10869
|
-
out.push(kind.render(p.decl.data, p.inner, !measure || measure === p.ctx.measure ? p.ctx : {
|
|
10974
|
+
if (!p.decl.failed) out.push(kind.render(p.decl.data, p.inner, !measure || measure === p.ctx.measure ? p.ctx : {
|
|
10870
10975
|
...p.ctx,
|
|
10871
10976
|
measure
|
|
10872
10977
|
}));
|
|
@@ -10882,9 +10987,11 @@ function renderGroup(g, L, interactive) {
|
|
|
10882
10987
|
const text = g.decl.label;
|
|
10883
10988
|
const ink = nodeInk(T, s.text, s.stroke);
|
|
10884
10989
|
const lines = g.lines ?? [text];
|
|
10885
|
-
const
|
|
10886
|
-
const
|
|
10887
|
-
const
|
|
10990
|
+
const inset = 14;
|
|
10991
|
+
const base = g.y + inset + Math.round(font.size * .7);
|
|
10992
|
+
const body = lines.length > 1 ? textLines(lines, g.x + inset, (i) => base + i * g.lineHeight, (l) => richText(l, ink, T, font.caps)) : richText(text, ink, T, font.caps);
|
|
10993
|
+
const label = text ? `<text x="${f(g.x + inset)}" y="${f(base)}" font-size="${f(font.size)}" font-weight="${font.weight}"${font.italic ? " font-style=\"italic\"" : ""} letter-spacing="${font.caps ? "0.1em" : "0.02em"}" fill="${s.text}" xml:space="preserve">${body}</text>` : "";
|
|
10994
|
+
const meta = p.meta ? `<text x="${f(g.x + g.w - inset)}" y="${f(base)}" text-anchor="end" font-size="${f(fs)}" fill="${T.node.sub}" xml:space="preserve">${richText(p.meta, subInk(ink), T)}</text>` : "";
|
|
10888
10995
|
return `<g${attr("data-group", g.id)}${interactive ? " cursor=\"move\"" : ""}><rect x="${f(g.x)}" y="${f(g.y)}" width="${f(g.w)}" height="${f(g.h)}" rx="${f(Math.min(14, T.radius + 4))}" fill="${s.fill}" stroke="${s.stroke}" stroke-width="1"${attr("stroke-dasharray", s.dash)}/>` + label + meta + "</g>";
|
|
10889
10996
|
}
|
|
10890
10997
|
/**
|
|
@@ -12943,6 +13050,171 @@ function findClose(s, from, close) {
|
|
|
12943
13050
|
}
|
|
12944
13051
|
return -1;
|
|
12945
13052
|
}
|
|
13053
|
+
// src/markdown.ts
|
|
13054
|
+
/**
|
|
13055
|
+
* Markdown integration.
|
|
13056
|
+
*
|
|
13057
|
+
* Diagrams live in Markdown as HTML comments, so the source stays next to the
|
|
13058
|
+
* docs but is invisible when rendered:
|
|
13059
|
+
*
|
|
13060
|
+
* <!--yuhwa checkout
|
|
13061
|
+
* a -> b
|
|
13062
|
+
* -->
|
|
13063
|
+
* 
|
|
13064
|
+
*
|
|
13065
|
+
* Fenced ```yuhwa (or ```yu) blocks are converted to that form on the first
|
|
13066
|
+
* run. `<!--yu name` opens a comment block too.
|
|
13067
|
+
* The image line right after a block is inserted or kept up to date.
|
|
13068
|
+
*/
|
|
13069
|
+
/** fence languages that hold a diagram */
|
|
13070
|
+
const MD_LANGUAGES = ["yuhwa", "yu"];
|
|
13071
|
+
const LANG = [...MD_LANGUAGES].sort((a, b) => b.length - a.length).join("|");
|
|
13072
|
+
/** `<!--yuhwa name` or `<!--yu name` */
|
|
13073
|
+
const COMMENT_OPEN = new RegExp(`^<!--\\s*(?:${LANG})(?:\\s+([\\w.-]+))?\\s*$`);
|
|
13074
|
+
/**
|
|
13075
|
+
* The diagrams of a Markdown page: fenced blocks in one of `languages` and
|
|
13076
|
+
* `<!--yuhwa name … -->` (or `<!--yu`) comments. Fences in other languages are
|
|
13077
|
+
* skipped whole, so a ```markdown fence that shows a yuhwa block is left alone.
|
|
13078
|
+
*/
|
|
13079
|
+
const isMarkdown = (file) => /\.(md|mdx|markdown)$/i.test(file);
|
|
13080
|
+
/** fence flags that are not a block name */
|
|
13081
|
+
const FLAGS = /* @__PURE__ */ new Set([
|
|
13082
|
+
"no-code",
|
|
13083
|
+
"zoom",
|
|
13084
|
+
"no-zoom"
|
|
13085
|
+
]);
|
|
13086
|
+
const FENCE = /^ {0,3}(`{3,}|~{3,})\s*([^\s`]*)(.*)$/;
|
|
13087
|
+
function pageBlocks(md, languages = MD_LANGUAGES) {
|
|
13088
|
+
const lines = md.split("\n");
|
|
13089
|
+
const blocks = [];
|
|
13090
|
+
for (let i = 0; i < lines.length; i++) {
|
|
13091
|
+
const line = lines[i].replace(/\r$/, "");
|
|
13092
|
+
let close;
|
|
13093
|
+
let lang;
|
|
13094
|
+
let meta = "";
|
|
13095
|
+
let m = line.match(FENCE);
|
|
13096
|
+
if (m) {
|
|
13097
|
+
const fence = m[1];
|
|
13098
|
+
const closer = new RegExp(`^ {0,3}${fence[0]}{${fence.length},}\\s*$`);
|
|
13099
|
+
close = (l) => closer.test(l);
|
|
13100
|
+
lang = m[2];
|
|
13101
|
+
meta = m[3].trim();
|
|
13102
|
+
} else if (m = line.match(COMMENT_OPEN)) {
|
|
13103
|
+
close = (l) => l.trim() === "-->";
|
|
13104
|
+
lang = "comment";
|
|
13105
|
+
meta = m[1] ?? "";
|
|
13106
|
+
} else continue;
|
|
13107
|
+
let j = i + 1;
|
|
13108
|
+
while (j < lines.length && !close(lines[j].replace(/\r$/, ""))) j++;
|
|
13109
|
+
if (j >= lines.length) break;
|
|
13110
|
+
if (lang === "comment" || languages.includes(lang) && !/(^|\s)no-render(\s|$)/.test(meta)) {
|
|
13111
|
+
const name = meta.split(/\s+/).find((w) => /^[\w.-]+$/.test(w) && !FLAGS.has(w));
|
|
13112
|
+
blocks.push({
|
|
13113
|
+
index: blocks.length,
|
|
13114
|
+
lang,
|
|
13115
|
+
...name ? { name } : {},
|
|
13116
|
+
line: i + 1,
|
|
13117
|
+
end: j + 1,
|
|
13118
|
+
source: lines.slice(i + 1, j).join("\n")
|
|
13119
|
+
});
|
|
13120
|
+
}
|
|
13121
|
+
i = j;
|
|
13122
|
+
}
|
|
13123
|
+
return blocks;
|
|
13124
|
+
}
|
|
13125
|
+
function imageRef(name, lightPath, darkPath, href) {
|
|
13126
|
+
if (darkPath) {
|
|
13127
|
+
const pic = `<picture><source media="(prefers-color-scheme: dark)" srcset="${darkPath}"><img alt="${name}" src="${lightPath}"></picture>`;
|
|
13128
|
+
return href ? `<a href="${href.replace(/"/g, "%22")}">${pic}</a>` : pic;
|
|
13129
|
+
}
|
|
13130
|
+
return href ? `[](${href})` : ``;
|
|
13131
|
+
}
|
|
13132
|
+
/** an image reference without the link `view` wraps it in */
|
|
13133
|
+
const unlinked = (ref) => ref.match(/^\[(!\[[^\]]*\]\([^)]*\))\]\([^)]*\)$/)?.[1] ?? ref.match(/^<a href="[^"]*">(<picture>.*<\/picture>)<\/a>$/)?.[1] ?? ref;
|
|
13134
|
+
function findBlocks(md, baseName = "diagram", outDir = "diagrams") {
|
|
13135
|
+
const lines = md.split("\n");
|
|
13136
|
+
const used = /* @__PURE__ */ new Set();
|
|
13137
|
+
return pageBlocks(md).map(({ index, name, source, lang, line, end }) => {
|
|
13138
|
+
let n = name ?? `${baseName}-${index + 1}`;
|
|
13139
|
+
while (used.has(n)) n += "-" + (index + 1);
|
|
13140
|
+
used.add(n);
|
|
13141
|
+
const b = {
|
|
13142
|
+
index,
|
|
13143
|
+
name: n,
|
|
13144
|
+
source,
|
|
13145
|
+
kind: lang === "comment" ? "comment" : "fence",
|
|
13146
|
+
start: line - 1,
|
|
13147
|
+
end: end - 1
|
|
13148
|
+
};
|
|
13149
|
+
let k = b.end + 1;
|
|
13150
|
+
while (k < lines.length && lines[k].trim() === "" && k <= b.end + 1) k++;
|
|
13151
|
+
const candidate = unlinked(lines[k]?.trim() ?? "");
|
|
13152
|
+
const path = joinPath(outDir, `${n}.svg`);
|
|
13153
|
+
if (candidate === imageRef(n, path) || candidate === imageRef(n, path, joinPath(outDir, `${n}.dark.svg`))) b.image = [k, k];
|
|
13154
|
+
return b;
|
|
13155
|
+
});
|
|
13156
|
+
}
|
|
13157
|
+
const joinPath = (dir, file) => dir ? dir.replace(/\/+$/, "") + "/" + file : file;
|
|
13158
|
+
function processMarkdown(md, opts = {}) {
|
|
13159
|
+
const outDir = opts.outDir ?? "diagrams";
|
|
13160
|
+
const blocks = findBlocks(md, opts.baseName, outDir);
|
|
13161
|
+
const lines = md.split("\n");
|
|
13162
|
+
const files = [];
|
|
13163
|
+
const diagnostics = [];
|
|
13164
|
+
for (const b of [...blocks].reverse()) {
|
|
13165
|
+
const io = {
|
|
13166
|
+
resolve: opts.resolve,
|
|
13167
|
+
file: opts.file
|
|
13168
|
+
};
|
|
13169
|
+
const light = render(b.source, io);
|
|
13170
|
+
for (const dg of light.diagnostics) diagnostics.push({
|
|
13171
|
+
block: b.name,
|
|
13172
|
+
line: dg.line,
|
|
13173
|
+
message: dg.message,
|
|
13174
|
+
severity: dg.severity
|
|
13175
|
+
});
|
|
13176
|
+
const lightPath = joinPath(outDir, `${b.name}.svg`);
|
|
13177
|
+
files.push({
|
|
13178
|
+
path: lightPath,
|
|
13179
|
+
svg: light.svg + "\n"
|
|
13180
|
+
});
|
|
13181
|
+
const href = light.diagram.imports?.length ? void 0 : opts.view?.(b.source);
|
|
13182
|
+
let ref = imageRef(b.name, lightPath, void 0, href);
|
|
13183
|
+
if (opts.dark) {
|
|
13184
|
+
const dark = render(b.source, {
|
|
13185
|
+
...io,
|
|
13186
|
+
theme: "midnight"
|
|
13187
|
+
});
|
|
13188
|
+
const darkPath = joinPath(outDir, `${b.name}.dark.svg`);
|
|
13189
|
+
files.push({
|
|
13190
|
+
path: darkPath,
|
|
13191
|
+
svg: dark.svg + "\n"
|
|
13192
|
+
});
|
|
13193
|
+
ref = imageRef(b.name, lightPath, darkPath, href);
|
|
13194
|
+
}
|
|
13195
|
+
const replacement = [];
|
|
13196
|
+
if (b.kind === "fence" && !opts.keepFences) replacement.push(`<!--yuhwa ${b.name}`, ...b.source.split("\n"), "-->");
|
|
13197
|
+
else replacement.push(...lines.slice(b.start, b.end + 1));
|
|
13198
|
+
replacement.push(ref);
|
|
13199
|
+
const end = b.image ? b.image[1] : b.end;
|
|
13200
|
+
lines.splice(b.start, end - b.start + 1, ...replacement);
|
|
13201
|
+
}
|
|
13202
|
+
files.reverse();
|
|
13203
|
+
return {
|
|
13204
|
+
markdown: lines.join("\n"),
|
|
13205
|
+
files,
|
|
13206
|
+
blocks,
|
|
13207
|
+
diagnostics
|
|
13208
|
+
};
|
|
13209
|
+
}
|
|
13210
|
+
/** Replace the source of block `index` in a markdown document. */
|
|
13211
|
+
function replaceBlockSource(md, index, source) {
|
|
13212
|
+
const b = findBlocks(md)[index];
|
|
13213
|
+
if (!b) throw new Error(`No yuhwa block #${index}`);
|
|
13214
|
+
const lines = md.split("\n");
|
|
13215
|
+
lines.splice(b.start + 1, b.end - b.start - 1, ...source.split("\n"));
|
|
13216
|
+
return lines.join("\n");
|
|
13217
|
+
}
|
|
12946
13218
|
// src/index.ts
|
|
12947
13219
|
/** Stable short hash, used for deterministic SVG ids. */
|
|
12948
13220
|
function hash(s) {
|
|
@@ -13097,7 +13369,7 @@ function verbatimBlocks(text, lines) {
|
|
|
13097
13369
|
}
|
|
13098
13370
|
/** Format yuhwa source. Returns the new text; whitespace is all that changes. */
|
|
13099
13371
|
function format(text) {
|
|
13100
|
-
if (isMermaid(text)) return text;
|
|
13372
|
+
if (isMermaid(text) || /^\s*\{/.test(text)) return text;
|
|
13101
13373
|
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
13102
13374
|
const lines = text.split(/\r?\n/);
|
|
13103
13375
|
const verbatim = /* @__PURE__ */ new Map();
|
|
@@ -13193,6 +13465,32 @@ function format(text) {
|
|
|
13193
13465
|
while (kept.length && kept[kept.length - 1] === "") kept.pop();
|
|
13194
13466
|
return kept.length ? kept.join(eol) + eol : "";
|
|
13195
13467
|
}
|
|
13468
|
+
/**
|
|
13469
|
+
* A Markdown page with its diagram blocks formatted like `.yu` files: fences
|
|
13470
|
+
* in `languages` and `<!--yuhwa` comments. `only` limits it to some blocks.
|
|
13471
|
+
* A fence indented by up to three spaces keeps that indent on every line.
|
|
13472
|
+
*/
|
|
13473
|
+
function formatPage(md, languages) {
|
|
13474
|
+
const lines = md.split("\n");
|
|
13475
|
+
const changed = [];
|
|
13476
|
+
for (const b of pageBlocks(md, languages).reverse()) {
|
|
13477
|
+
const body = lines.slice(b.line, b.end - 1);
|
|
13478
|
+
const cr = body.some((l) => l.endsWith("\r")) ? "\r" : "";
|
|
13479
|
+
const indent = lines[b.line - 1].match(/^ */)[0];
|
|
13480
|
+
const inner = body.map((l) => l.replace(/\r$/, ""));
|
|
13481
|
+
const strip = indent && inner.every((l) => !l.trim() || l.startsWith(indent)) ? indent.length : 0;
|
|
13482
|
+
const source = inner.map((l) => l.slice(strip)).join("\n");
|
|
13483
|
+
const out = format(source).replace(/\n+$/, "");
|
|
13484
|
+
if (out === source) continue;
|
|
13485
|
+
changed.unshift(b);
|
|
13486
|
+
const next = out ? out.split("\n").map((l) => (l && strip ? indent + l : l) + cr) : [];
|
|
13487
|
+
lines.splice(b.line, body.length, ...next);
|
|
13488
|
+
}
|
|
13489
|
+
return {
|
|
13490
|
+
text: lines.join("\n"),
|
|
13491
|
+
changed
|
|
13492
|
+
};
|
|
13493
|
+
}
|
|
13196
13494
|
/** One edit that turns `a` into `b`, covering only what differs. */
|
|
13197
13495
|
function diffEdits(a, b) {
|
|
13198
13496
|
if (a === b) return [];
|
|
@@ -13305,5 +13603,5 @@ function onTypeEdits(text, pos, ch) {
|
|
|
13305
13603
|
}
|
|
13306
13604
|
// src/version.ts
|
|
13307
13605
|
/** the package version, inlined by the build */
|
|
13308
|
-
const VERSION = "1.
|
|
13309
|
-
export {
|
|
13606
|
+
const VERSION = "1.4.0";
|
|
13607
|
+
export { BOOLS as A, SPAN_KEYS as B, blockBraces as C, parse as D, lex as E, NODE_PROPS as F, THEME_NAMES as G, parseSpanStyle as H, NUMBERS as I, themeNames as J, TONES as K, PANEL_PROPS as L, EDGE_PROPS as M, ENUMS as N, serializeProps as O, GROUP_PROPS as P, PLACEMENT_PROPS as R, SETTING_VALUES as S, joinPath$1 as T, spanKey as U, esc$1 as V, THEME_KEYS as W, table as Y, canvasMeasure as _, formatPage as a, KNOWN_SETTINGS as b, diskResolve as c, MD_LANGUAGES as d, findBlocks as f, replaceBlockSource as g, processMarkdown as h, format as i, COLORS as j, unquote as k, render as l, pageBlocks as m, applyChange as n, onTypeEdits as o, isMarkdown as p, isSafeCss as q, diffEdits as r, tidy as s, VERSION as t, toSource as u, optionKind as v, isYuhwaPath as w, PANELS as x, registry as y, SHAPES$2 as z };
|