yuhwa 1.2.0 → 1.3.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 +1 -1
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +3 -2
- package/dist/cli.js +1 -1
- package/dist/editor/assets/index-DAk6b1UB.js +689 -0
- package/dist/editor/assets/{lsp.worker-sZtzIA6-.js → lsp.worker-CMSpDTsX.js} +17 -17
- package/dist/editor/index.html +1 -1
- package/dist/{figure-CA2hy0xh.d.ts → figure-QAwSU1Ry.d.ts} +1 -1
- package/dist/index-6ZPJGThY.d.ts +216 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -1
- package/dist/ironmark.d.ts +1 -1
- package/dist/ironmark.js +1 -1
- package/dist/lsp-browser.js +1 -1
- package/dist/lsp-node.js +2 -2
- package/dist/lsp-server.js +1 -1
- package/dist/lsp.js +1 -1
- package/dist/markdown-it.d.ts +1 -1
- package/dist/markdown-it.js +1 -1
- package/dist/{node-Bzn2uKXZ.js → node-CLu2Pp_2.js} +2 -1
- package/dist/plugin-Bs4eiAuz.js +4166 -0
- package/dist/{index-CnnoZYl0.d.ts → plugin-NSkNyoUj.d.ts} +79 -208
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.js +1 -0
- package/dist/remark.d.ts +1 -1
- package/dist/remark.js +1 -1
- package/dist/{server-Dxo7OG8K.js → server-D6BSNC1P.js} +1 -1
- package/dist/{service-B1fpOg_L.js → service-D7DNWBAU.js} +3 -2
- package/dist/{shared-Ddw88O9D.js → shared-6aCU_HaV.js} +489 -401
- package/dist/{src-DkQj7aIV.js → src-BjOhvTAB.js} +440 -4512
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -2
- package/dist/vuepress.d.ts +1 -1
- package/dist/yuhwa.iife.js +53 -53
- package/package.json +6 -1
- package/dist/editor/assets/index-BphHLTvA.js +0 -689
|
@@ -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.
|
|
@@ -1134,14 +1148,6 @@ const SIDES$2 = [
|
|
|
1134
1148
|
"bottom",
|
|
1135
1149
|
"left"
|
|
1136
1150
|
];
|
|
1137
|
-
const HEADS$1 = [
|
|
1138
|
-
"arrow",
|
|
1139
|
-
"open",
|
|
1140
|
-
"dot",
|
|
1141
|
-
"diamond",
|
|
1142
|
-
"bar",
|
|
1143
|
-
"none"
|
|
1144
|
-
];
|
|
1145
1151
|
const center = (b) => ({
|
|
1146
1152
|
x: b.x + b.w / 2,
|
|
1147
1153
|
y: b.y + b.h / 2
|
|
@@ -1232,7 +1238,7 @@ function avoidObstacles(a, b, s0, s1, free0, free1, obstacles) {
|
|
|
1232
1238
|
}
|
|
1233
1239
|
return best;
|
|
1234
1240
|
}
|
|
1235
|
-
const headKind = (v, dflt) => v && (
|
|
1241
|
+
const headKind = (v, dflt) => v && (v === "none" || MARKER_KINDS.has(v)) ? v : dflt;
|
|
1236
1242
|
function routeEdges(d, nodes, ctx) {
|
|
1237
1243
|
const items = [];
|
|
1238
1244
|
const pairKey = (x, y) => x < y ? `${x}\u0000${y}` : `${y}\u0000${x}`;
|
|
@@ -1510,16 +1516,9 @@ function labelSpot(samples, boxAt, it, ctx) {
|
|
|
1510
1516
|
}
|
|
1511
1517
|
const headSize = (w) => 7 + w * 2;
|
|
1512
1518
|
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
|
-
}
|
|
1519
|
+
const m = MARKER_KINDS.get(kind);
|
|
1520
|
+
if (!m) return 0;
|
|
1521
|
+
return typeof m.inset === "function" ? m.inset(hl, w) : m.inset ?? 0;
|
|
1523
1522
|
}
|
|
1524
1523
|
/** Unit direction the path travels at its start or end (pointing outwards at the end, inwards at the start reversed). */
|
|
1525
1524
|
function endDirection(g, which) {
|
|
@@ -1803,194 +1802,57 @@ const MARKER_KINDS = /* @__PURE__ */ new Map();
|
|
|
1803
1802
|
const AFTER_LAYOUT = [];
|
|
1804
1803
|
const POST_RENDER = [];
|
|
1805
1804
|
/**
|
|
1806
|
-
* An edge end marker with its tip at `at`, pointing along `angle`:
|
|
1807
|
-
*
|
|
1805
|
+
* An edge end marker with its tip at `at`, pointing along `angle`: any
|
|
1806
|
+
* registered marker (the built-in ones come from the `markers` plugin). `L` is its length; graph
|
|
1808
1807
|
* edges size it from the stroke width, panels pass their own.
|
|
1809
1808
|
*/
|
|
1810
1809
|
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
|
-
}
|
|
1810
|
+
const m = MARKER_KINDS.get(kind);
|
|
1811
|
+
return m ? m.render(at, angle, {
|
|
1812
|
+
color,
|
|
1813
|
+
width: w,
|
|
1814
|
+
size: L
|
|
1815
|
+
}) : "";
|
|
1832
1816
|
}
|
|
1833
1817
|
// 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
|
-
});
|
|
1818
|
+
/**
|
|
1819
|
+
* The registered node shapes, in registration order. The built-in ones come
|
|
1820
|
+
* from the `shapes` plugin; `use()` adds every plugin's shapes here.
|
|
1821
|
+
*/
|
|
1822
|
+
const SHAPES$2 = [];
|
|
1823
|
+
/** other names for a shape (`db` → `cylinder`), filled by `use()` from `ShapeKind.aliases` */
|
|
1824
|
+
const SHAPE_ALIASES = table({});
|
|
1868
1825
|
function normalizeShape(s) {
|
|
1869
1826
|
if (!s) return "rounded";
|
|
1870
1827
|
const k = s.toLowerCase();
|
|
1871
|
-
if (
|
|
1828
|
+
if (SHAPE_KINDS.has(k)) return k;
|
|
1872
1829
|
return SHAPE_ALIASES[k] ?? "rounded";
|
|
1873
1830
|
}
|
|
1831
|
+
/** the outer size of a rounded box around content of `cw` × `ch`: the default for shapes without `size` */
|
|
1832
|
+
function boxSize(cw, ch) {
|
|
1833
|
+
return {
|
|
1834
|
+
w: Math.max(cw + 44, 96),
|
|
1835
|
+
h: Math.max(ch + 28, 48)
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1874
1838
|
/** Grow a content box (text size) into the outer size for a shape. */
|
|
1875
1839
|
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
|
-
}
|
|
1840
|
+
return SHAPE_KINDS.get(shape)?.size?.(cw, ch) ?? boxSize(cw, ch);
|
|
1931
1841
|
}
|
|
1932
1842
|
/** Vertical offset of the text centre inside a shape (e.g. below a cylinder's lid). */
|
|
1933
1843
|
function textOffset(shape) {
|
|
1934
|
-
|
|
1935
|
-
if (shape === "document") return -4;
|
|
1936
|
-
return 0;
|
|
1844
|
+
return SHAPE_KINDS.get(shape)?.textOffset ?? 0;
|
|
1937
1845
|
}
|
|
1938
1846
|
const f$1 = (n) => (Math.round(n * 100) / 100).toString();
|
|
1939
|
-
/** SVG path data for the outline of a shape. */
|
|
1847
|
+
/** SVG path data for the outline of a shape; a rounded box when no plugin registered it. */
|
|
1940
1848
|
function shapePath(shape, b, radius) {
|
|
1941
1849
|
const custom = SHAPE_KINDS.get(shape);
|
|
1942
1850
|
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
|
-
}
|
|
1851
|
+
return rectPath(b.x, b.y, b.w, b.h, Math.min(radius, b.w / 2, b.h / 2));
|
|
1979
1852
|
}
|
|
1980
1853
|
/** Extra decoration strokes (cylinder lid line, note fold) drawn over the fill. */
|
|
1981
1854
|
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;
|
|
1855
|
+
return SHAPE_KINDS.get(shape)?.detail?.(b) ?? null;
|
|
1994
1856
|
}
|
|
1995
1857
|
function rectPath(x, y, w, h, r) {
|
|
1996
1858
|
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 +1876,22 @@ const SIDE_NORMAL = {
|
|
|
2014
1876
|
y: 0
|
|
2015
1877
|
}
|
|
2016
1878
|
};
|
|
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
1879
|
/**
|
|
2024
|
-
* Point on the outline of a
|
|
2025
|
-
*
|
|
1880
|
+
* Point on the outline of a box for a port on `side`. `t` in [-1, 1] slides
|
|
1881
|
+
* the port along that side (0 = centre); `spread` is how much of the side can
|
|
1882
|
+
* host ports (fraction of its half-length). `depth(horiz, rel, u)` gives the
|
|
1883
|
+
* distance from the centre to the outline, for outlines that are not a box:
|
|
1884
|
+
* `horiz` is true on the top and bottom sides, `rel` the scaled position along
|
|
1885
|
+
* the side and `u` the offset in px.
|
|
2026
1886
|
*/
|
|
2027
|
-
function
|
|
1887
|
+
function portOn(b, side, t, spread = .75, depth) {
|
|
2028
1888
|
const cx = b.x + b.w / 2;
|
|
2029
1889
|
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);
|
|
1890
|
+
const s = Math.max(-1, Math.min(1, t)) * spread;
|
|
2033
1891
|
const horiz = side === "top" || side === "bottom";
|
|
2034
1892
|
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
|
-
}
|
|
1893
|
+
const u = s * (horiz ? b.w / 2 : b.h / 2);
|
|
1894
|
+
const v = depth ? depth(horiz, s, u) : horiz ? b.h / 2 : b.w / 2;
|
|
2065
1895
|
if (horiz) return {
|
|
2066
1896
|
x: cx + u,
|
|
2067
1897
|
y: cy + sign * v
|
|
@@ -2071,20 +1901,19 @@ function portPoint(shape, b, side, t) {
|
|
|
2071
1901
|
y: cy + u
|
|
2072
1902
|
};
|
|
2073
1903
|
}
|
|
1904
|
+
/** Point on the outline of a shape for a port on `side`, see `portOn`. */
|
|
1905
|
+
function portPoint(shape, b, side, t) {
|
|
1906
|
+
const custom = SHAPE_KINDS.get(shape);
|
|
1907
|
+
return custom?.port ? custom.port(b, side, t) : portOn(b, side, t);
|
|
1908
|
+
}
|
|
2074
1909
|
// src/core/lint.ts
|
|
2075
1910
|
const CURVES$1 = [
|
|
2076
1911
|
"smooth",
|
|
2077
1912
|
"orthogonal",
|
|
2078
1913
|
"straight"
|
|
2079
1914
|
];
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
"open",
|
|
2083
|
-
"dot",
|
|
2084
|
-
"diamond",
|
|
2085
|
-
"bar",
|
|
2086
|
-
"none"
|
|
2087
|
-
];
|
|
1915
|
+
/** `none` is core; `use()` adds every plugin's markers (the built-in ones too) in front of it */
|
|
1916
|
+
const HEADS = ["none"];
|
|
2088
1917
|
const SIDES$1 = [
|
|
2089
1918
|
"top",
|
|
2090
1919
|
"right",
|
|
@@ -2527,7 +2356,7 @@ const CURVES = /* @__PURE__ */ new Set([
|
|
|
2527
2356
|
"orthogonal",
|
|
2528
2357
|
"straight"
|
|
2529
2358
|
]);
|
|
2530
|
-
const isShape = (k) =>
|
|
2359
|
+
const isShape = (k) => SHAPE_KINDS.has(k) || k in SHAPE_ALIASES;
|
|
2531
2360
|
/**
|
|
2532
2361
|
* Imports only read `.yu` (or the older `.yuhwa`) files: a diagram must not pull other files
|
|
2533
2362
|
* (keys, configs) into its output or errors, whatever the resolver.
|
|
@@ -3157,7 +2986,13 @@ function parse(source, opts = {}) {
|
|
|
3157
2986
|
const lead = top.lines.findIndex((l) => l.trim());
|
|
3158
2987
|
p.body = dedent(top.lines);
|
|
3159
2988
|
p.lines = [top.start, end];
|
|
3160
|
-
|
|
2989
|
+
try {
|
|
2990
|
+
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));
|
|
2991
|
+
} catch (e) {
|
|
2992
|
+
const who = ownerOf("panel", p.kind);
|
|
2993
|
+
warn(top.start, `${who ? `plugin "${who}": ` : ""}${p.kind} panel failed to parse: ${errorText(e)}`, "error");
|
|
2994
|
+
p.failed = true;
|
|
2995
|
+
}
|
|
3161
2996
|
};
|
|
3162
2997
|
/** theme body: `key: value` lines */
|
|
3163
2998
|
const themeBodyLine = (top, raw, li) => {
|
|
@@ -4079,96 +3914,96 @@ const registry = {
|
|
|
4079
3914
|
const addAll = (list, items) => {
|
|
4080
3915
|
for (const i of items ?? []) if (!list.includes(i)) list.push(i);
|
|
4081
3916
|
};
|
|
4082
|
-
/**
|
|
4083
|
-
const
|
|
3917
|
+
/** marker names go in front of `none`, so the choices list the drawn ones first */
|
|
3918
|
+
const addMarkers = (list, markers) => {
|
|
3919
|
+
for (const m of markers ?? []) {
|
|
3920
|
+
if (list.includes(m.name)) continue;
|
|
3921
|
+
const none = list.indexOf("none");
|
|
3922
|
+
list.splice(none < 0 ? list.length : none, 0, m.name);
|
|
3923
|
+
}
|
|
3924
|
+
};
|
|
4084
3925
|
const none = () => {};
|
|
3926
|
+
const empty = () => "";
|
|
3927
|
+
const zero = () => ({
|
|
3928
|
+
w: 0,
|
|
3929
|
+
h: 0
|
|
3930
|
+
});
|
|
3931
|
+
/** what each kind's functions return instead when they throw */
|
|
3932
|
+
const FALLBACK = {
|
|
3933
|
+
row: {
|
|
3934
|
+
parse: () => null,
|
|
3935
|
+
finish: none,
|
|
3936
|
+
measure: zero,
|
|
3937
|
+
render: empty
|
|
3938
|
+
},
|
|
3939
|
+
frame: {
|
|
3940
|
+
inset: () => ({ top: 0 }),
|
|
3941
|
+
render: empty
|
|
3942
|
+
},
|
|
3943
|
+
decoration: {
|
|
3944
|
+
measure: () => null,
|
|
3945
|
+
render: empty
|
|
3946
|
+
},
|
|
3947
|
+
shape: {
|
|
3948
|
+
path: (b) => rectPath(b.x, b.y, b.w, b.h, 0),
|
|
3949
|
+
size: (w, h) => ({
|
|
3950
|
+
w,
|
|
3951
|
+
h
|
|
3952
|
+
}),
|
|
3953
|
+
detail: () => null,
|
|
3954
|
+
port: (b) => ({
|
|
3955
|
+
x: b.x + b.w / 2,
|
|
3956
|
+
y: b.y + b.h / 2
|
|
3957
|
+
})
|
|
3958
|
+
},
|
|
3959
|
+
marker: {
|
|
3960
|
+
render: empty,
|
|
3961
|
+
inset: () => 0
|
|
3962
|
+
},
|
|
3963
|
+
panel: {
|
|
3964
|
+
measure: zero,
|
|
3965
|
+
render: empty,
|
|
3966
|
+
handles: () => [],
|
|
3967
|
+
parts: () => [],
|
|
3968
|
+
editPart: () => null
|
|
3969
|
+
},
|
|
3970
|
+
hook: {
|
|
3971
|
+
transform: none,
|
|
3972
|
+
afterLayout: none,
|
|
3973
|
+
postRender: (svg) => svg
|
|
3974
|
+
}
|
|
3975
|
+
};
|
|
3976
|
+
/** `k` with each function named in `fb` wrapped by `guard` */
|
|
3977
|
+
function wrap(plugin, what, k, fb) {
|
|
3978
|
+
const out = { ...k };
|
|
3979
|
+
for (const [m, f] of Object.entries(fb)) {
|
|
3980
|
+
const fn = out[m];
|
|
3981
|
+
if (typeof fn === "function") out[m] = guard(plugin, what(m), fn.bind(k), f);
|
|
3982
|
+
}
|
|
3983
|
+
return out;
|
|
3984
|
+
}
|
|
4085
3985
|
/** copies of a plugin's parts whose every function reports a throw instead of passing it on */
|
|
4086
3986
|
function guarded(p) {
|
|
4087
3987
|
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);
|
|
3988
|
+
const kinds = (list, what, fb) => (list ?? []).map((k) => wrap(n, (m) => what(k, m), k, fb));
|
|
4091
3989
|
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
|
-
}),
|
|
3990
|
+
rows: kinds(p.rows, (r) => `row "${r.kind}"`, FALLBACK.row),
|
|
3991
|
+
frames: kinds(p.frames, (f) => `frame "${f.name}"`, FALLBACK.frame),
|
|
3992
|
+
decorations: kinds(p.decorations, (d) => `decoration "${d.name}"`, FALLBACK.decoration),
|
|
3993
|
+
shapes: kinds(p.shapes, (s) => `shape "${s.name}"`, FALLBACK.shape),
|
|
3994
|
+
markers: kinds(p.markers, (k) => `marker "${k.name}"`, FALLBACK.marker),
|
|
3995
|
+
panels: kinds(p.panels, (pk, m) => `${pk.name} panel ${m === "editPart" ? "edit" : m}`, FALLBACK.panel),
|
|
4134
3996
|
statements: (p.statements ?? []).map((st) => ({
|
|
4135
3997
|
...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
|
-
}
|
|
3998
|
+
parse: guard(n, st.keyword, st.parse.bind(st), none, (msg, [, , ctx]) => ctx.warn(msg, "error"))
|
|
4143
3999
|
})),
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
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
|
|
4157
|
-
})),
|
|
4158
|
-
transform: p.transform && g("transform", (d) => p.transform(d), none),
|
|
4159
|
-
afterLayout: p.afterLayout && g("afterLayout", (L, d) => p.afterLayout(L, d), none),
|
|
4160
|
-
postRender: p.postRender && g("postRender", (svg, d, L) => p.postRender(svg, d, L), (svg) => svg)
|
|
4000
|
+
hooks: wrap(n, (m) => m, {
|
|
4001
|
+
transform: p.transform,
|
|
4002
|
+
afterLayout: p.afterLayout,
|
|
4003
|
+
postRender: p.postRender
|
|
4004
|
+
}, FALLBACK.hook)
|
|
4161
4005
|
};
|
|
4162
4006
|
}
|
|
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
4007
|
/** the tables as they were before the first plugin, so `unuse` can rebuild them */
|
|
4173
4008
|
let baseline;
|
|
4174
4009
|
function snapshot() {
|
|
@@ -4190,6 +4025,7 @@ function snapshot() {
|
|
|
4190
4025
|
BOOLS,
|
|
4191
4026
|
NUMBERS,
|
|
4192
4027
|
THEME_NAMES,
|
|
4028
|
+
SHAPES$2,
|
|
4193
4029
|
registry.rows,
|
|
4194
4030
|
registry.decorations
|
|
4195
4031
|
].map((l) => [l, [...l]]);
|
|
@@ -4199,6 +4035,7 @@ function snapshot() {
|
|
|
4199
4035
|
[...v]
|
|
4200
4036
|
]);
|
|
4201
4037
|
const themes = { ...THEMES };
|
|
4038
|
+
const aliases = { ...SHAPE_ALIASES };
|
|
4202
4039
|
return () => {
|
|
4203
4040
|
for (const [s, v] of sets) {
|
|
4204
4041
|
s.clear();
|
|
@@ -4216,9 +4053,17 @@ function snapshot() {
|
|
|
4216
4053
|
}
|
|
4217
4054
|
for (const k of Object.keys(THEMES)) delete THEMES[k];
|
|
4218
4055
|
Object.assign(THEMES, themes);
|
|
4219
|
-
|
|
4056
|
+
for (const k of Object.keys(SHAPE_ALIASES)) delete SHAPE_ALIASES[k];
|
|
4057
|
+
Object.assign(SHAPE_ALIASES, aliases);
|
|
4058
|
+
clearOwners();
|
|
4220
4059
|
};
|
|
4221
4060
|
}
|
|
4061
|
+
/** `item` replaces the entry with the same name where it was (order matters for rows), or goes last */
|
|
4062
|
+
function place$1(list, item, same) {
|
|
4063
|
+
const at = list.findIndex(same);
|
|
4064
|
+
if (at >= 0) list[at] = item;
|
|
4065
|
+
else list.push(item);
|
|
4066
|
+
}
|
|
4222
4067
|
/** Register plugins. Registering the same plugin name twice is a no-op. */
|
|
4223
4068
|
function use(...plugins) {
|
|
4224
4069
|
baseline ??= snapshot();
|
|
@@ -4226,45 +4071,37 @@ function use(...plugins) {
|
|
|
4226
4071
|
if (registry.plugins.some((q) => q.name === p.name)) continue;
|
|
4227
4072
|
registry.plugins.push(p);
|
|
4228
4073
|
const w = guarded(p);
|
|
4074
|
+
/** each item, under its name, into `into`: a map, or a function for more work */
|
|
4075
|
+
const own = (what, items, key, into) => {
|
|
4076
|
+
for (const x of items) {
|
|
4077
|
+
const k = key(x);
|
|
4078
|
+
claim(what, k, p.name);
|
|
4079
|
+
if (typeof into === "function") into(x, k);
|
|
4080
|
+
else into.set(k, x);
|
|
4081
|
+
}
|
|
4082
|
+
};
|
|
4229
4083
|
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);
|
|
4084
|
+
own("row", w.rows, (r) => r.kind, (r, k) => place$1(registry.rows, r, (x) => x.kind === k));
|
|
4085
|
+
own("decoration", w.decorations, (dec) => dec.name, (dec, k) => {
|
|
4086
|
+
place$1(registry.decorations, dec, (x) => x.name === k);
|
|
4244
4087
|
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);
|
|
4088
|
+
});
|
|
4089
|
+
own("frame", w.frames, (f) => f.name, registry.frames);
|
|
4090
|
+
own("panel", w.panels, (pk) => pk.name, PANELS);
|
|
4091
|
+
own("statement", w.statements, (st) => st.keyword, STATEMENTS);
|
|
4092
|
+
own("marker", w.markers, (mk) => mk.name, MARKER_KINDS);
|
|
4093
|
+
own("shape", w.shapes, (sh) => sh.name, (sh, k) => {
|
|
4094
|
+
SHAPE_KINDS.set(k, sh);
|
|
4095
|
+
if (!SHAPES$2.includes(k)) SHAPES$2.push(k);
|
|
4096
|
+
for (const a of sh.aliases ?? []) SHAPE_ALIASES[a] = k;
|
|
4097
|
+
});
|
|
4098
|
+
addAll(ENUMS.shape ??= [], [...p.shapes?.map((x) => x.name) ?? [], ...p.shapes?.flatMap((x) => x.aliases ?? []) ?? []]);
|
|
4099
|
+
addMarkers(ENUMS.head ??= [], p.markers);
|
|
4100
|
+
if (ENUMS.tail !== ENUMS.head) addMarkers(ENUMS.tail ??= [], p.markers);
|
|
4101
|
+
const { transform, afterLayout, postRender } = w.hooks;
|
|
4102
|
+
if (transform) TRANSFORMS.push(transform);
|
|
4103
|
+
if (afterLayout) AFTER_LAYOUT.push(afterLayout);
|
|
4104
|
+
if (postRender) POST_RENDER.push(postRender);
|
|
4268
4105
|
for (const s of p.settings ?? []) KNOWN_SETTINGS.add(s);
|
|
4269
4106
|
addAll(NODE_PROPS, p.props?.node);
|
|
4270
4107
|
addAll(EDGE_PROPS, p.props?.edge);
|
|
@@ -4275,6 +4112,286 @@ function use(...plugins) {
|
|
|
4275
4112
|
}
|
|
4276
4113
|
if (registry.frames.size) addAll(ENUMS.frame ??= [], [...registry.frames.keys()]);
|
|
4277
4114
|
}
|
|
4115
|
+
// src/core/measure.ts
|
|
4116
|
+
const NARROW = new Set("iljtfr.,;:'!|()[]{} \"`".split(""));
|
|
4117
|
+
const WIDE = new Set("mwMW@%".split(""));
|
|
4118
|
+
/** Font-independent width estimate, tuned for Inter / system UI fonts. */
|
|
4119
|
+
const approxMeasure = (text, fontSize, weight, mono) => {
|
|
4120
|
+
if (mono) return [...text].length * fontSize * .6;
|
|
4121
|
+
let w = 0;
|
|
4122
|
+
for (const ch of text) {
|
|
4123
|
+
const cp = ch.codePointAt(0);
|
|
4124
|
+
if (cp > 8192) w += cp > 126976 ? 1.2 : 1;
|
|
4125
|
+
else if (NARROW.has(ch)) w += .3;
|
|
4126
|
+
else if (WIDE.has(ch)) w += .86;
|
|
4127
|
+
else if (ch >= "A" && ch <= "Z") w += .66;
|
|
4128
|
+
else if (ch >= "0" && ch <= "9") w += .58;
|
|
4129
|
+
else w += .54;
|
|
4130
|
+
}
|
|
4131
|
+
return w * fontSize * (weight >= 600 ? 1.05 : 1);
|
|
4132
|
+
};
|
|
4133
|
+
const MONO_STACK = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
4134
|
+
let canvasCtx;
|
|
4135
|
+
/** Accurate measurement using a canvas when running in a browser. */
|
|
4136
|
+
function canvasMeasure(fontFamily) {
|
|
4137
|
+
return (text, fontSize, weight, mono) => {
|
|
4138
|
+
if (canvasCtx === void 0) try {
|
|
4139
|
+
canvasCtx = typeof document !== "undefined" ? document.createElement("canvas").getContext("2d") : null;
|
|
4140
|
+
} catch {
|
|
4141
|
+
canvasCtx = null;
|
|
4142
|
+
}
|
|
4143
|
+
if (!canvasCtx) return approxMeasure(text, fontSize, weight, mono);
|
|
4144
|
+
const family = mono && !/mono|courier|consolas|menlo/i.test(fontFamily) ? MONO_STACK : fontFamily;
|
|
4145
|
+
canvasCtx.font = `${weight} ${fontSize}px ${family}`;
|
|
4146
|
+
return canvasCtx.measureText(text).width;
|
|
4147
|
+
};
|
|
4148
|
+
}
|
|
4149
|
+
// src/plugins/shapes.ts
|
|
4150
|
+
/** the content box grown by the default padding, before a shape's minimums */
|
|
4151
|
+
const pad = (cw, ch) => ({
|
|
4152
|
+
w: cw + 44,
|
|
4153
|
+
h: ch + 28
|
|
4154
|
+
});
|
|
4155
|
+
/** a port on an ellipse that fills the box */
|
|
4156
|
+
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)));
|
|
4157
|
+
const ellipsePath = ({ x, y, w, h }) => {
|
|
4158
|
+
const rx = w / 2;
|
|
4159
|
+
const ry = h / 2;
|
|
4160
|
+
const cx = x + rx;
|
|
4161
|
+
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`;
|
|
4162
|
+
};
|
|
4163
|
+
const round = (b, radius) => Math.min(radius, b.w / 2, b.h / 2);
|
|
4164
|
+
const shapes = {
|
|
4165
|
+
name: "shapes",
|
|
4166
|
+
shapes: [
|
|
4167
|
+
{
|
|
4168
|
+
name: "rounded",
|
|
4169
|
+
aliases: ["round"],
|
|
4170
|
+
path: (b, radius) => rectPath(b.x, b.y, b.w, b.h, round(b, radius))
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
name: "box",
|
|
4174
|
+
aliases: [
|
|
4175
|
+
"rect",
|
|
4176
|
+
"rectangle",
|
|
4177
|
+
"square"
|
|
4178
|
+
],
|
|
4179
|
+
path: (b, radius) => rectPath(b.x, b.y, b.w, b.h, Math.min(round(b, radius), 3))
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
name: "pill",
|
|
4183
|
+
aliases: ["stadium", "capsule"],
|
|
4184
|
+
size: (cw, ch) => {
|
|
4185
|
+
const { w, h } = pad(cw, ch);
|
|
4186
|
+
return {
|
|
4187
|
+
w: Math.max(w + 8, 96),
|
|
4188
|
+
h: Math.max(h, 44)
|
|
4189
|
+
};
|
|
4190
|
+
},
|
|
4191
|
+
path: (b) => rectPath(b.x, b.y, b.w, b.h, b.h / 2),
|
|
4192
|
+
port: (b, side, t) => portOn(b, side, t, .55, (horiz, _rel, u) => {
|
|
4193
|
+
if (horiz) return b.h / 2;
|
|
4194
|
+
const r = b.h / 2;
|
|
4195
|
+
return b.w / 2 - r + Math.sqrt(Math.max(0, r * r - u * u));
|
|
4196
|
+
})
|
|
4197
|
+
},
|
|
4198
|
+
{
|
|
4199
|
+
name: "circle",
|
|
4200
|
+
size: (cw, ch) => {
|
|
4201
|
+
const d = Math.max(Math.hypot(cw, ch) + 16, 64);
|
|
4202
|
+
return {
|
|
4203
|
+
w: d,
|
|
4204
|
+
h: d
|
|
4205
|
+
};
|
|
4206
|
+
},
|
|
4207
|
+
path: ellipsePath,
|
|
4208
|
+
port: ellipsePort
|
|
4209
|
+
},
|
|
4210
|
+
{
|
|
4211
|
+
name: "ellipse",
|
|
4212
|
+
aliases: ["oval"],
|
|
4213
|
+
size: (cw, ch) => ({
|
|
4214
|
+
w: Math.max((cw + 16) * 1.42, 90),
|
|
4215
|
+
h: Math.max((ch + 12) * 1.42, 50)
|
|
4216
|
+
}),
|
|
4217
|
+
path: ellipsePath,
|
|
4218
|
+
port: ellipsePort
|
|
4219
|
+
},
|
|
4220
|
+
{
|
|
4221
|
+
name: "diamond",
|
|
4222
|
+
aliases: ["rhombus", "decision"],
|
|
4223
|
+
size: (cw, ch) => ({
|
|
4224
|
+
w: Math.max(cw * 1.6 + 40, 100),
|
|
4225
|
+
h: Math.max(ch * 1.8 + 32, 70)
|
|
4226
|
+
}),
|
|
4227
|
+
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`,
|
|
4228
|
+
port: (b, side, t) => portOn(b, side, t, .45, (horiz, rel) => (horiz ? b.h / 2 : b.w / 2) * (1 - Math.abs(rel)))
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
name: "hexagon",
|
|
4232
|
+
size: (cw, ch) => {
|
|
4233
|
+
const { w, h: h0 } = pad(cw, ch);
|
|
4234
|
+
const h = Math.max(h0, 48);
|
|
4235
|
+
return {
|
|
4236
|
+
w: w + h * .4,
|
|
4237
|
+
h
|
|
4238
|
+
};
|
|
4239
|
+
},
|
|
4240
|
+
path: ({ x, y, w, h }) => {
|
|
4241
|
+
const i = Math.min(h * .3, w / 4);
|
|
4242
|
+
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`;
|
|
4243
|
+
},
|
|
4244
|
+
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))
|
|
4245
|
+
},
|
|
4246
|
+
{
|
|
4247
|
+
name: "cylinder",
|
|
4248
|
+
aliases: [
|
|
4249
|
+
"database",
|
|
4250
|
+
"db",
|
|
4251
|
+
"storage"
|
|
4252
|
+
],
|
|
4253
|
+
textOffset: 5,
|
|
4254
|
+
size: (cw, ch) => {
|
|
4255
|
+
const { w, h } = pad(cw, ch);
|
|
4256
|
+
return {
|
|
4257
|
+
w: Math.max(w, 96),
|
|
4258
|
+
h: Math.max(h + 18, 66)
|
|
4259
|
+
};
|
|
4260
|
+
},
|
|
4261
|
+
path: ({ x, y, w, h }) => {
|
|
4262
|
+
const ry = Math.min(9, h / 6);
|
|
4263
|
+
const rx = w / 2;
|
|
4264
|
+
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`;
|
|
4265
|
+
},
|
|
4266
|
+
detail: ({ x, y, w, h }) => {
|
|
4267
|
+
const ry = Math.min(9, h / 6);
|
|
4268
|
+
return `M${f$2(x)},${f$2(y + ry)}a${f$2(w / 2)},${f$2(ry)} 0 0,0 ${f$2(w)},0`;
|
|
4269
|
+
},
|
|
4270
|
+
port: (b, side, t) => portOn(b, side, t, .75, (horiz, rel) => {
|
|
4271
|
+
if (!horiz) return b.w / 2;
|
|
4272
|
+
const ry = Math.min(9, b.h / 6);
|
|
4273
|
+
return b.h / 2 - ry + ry * Math.sqrt(Math.max(0, 1 - rel * rel));
|
|
4274
|
+
})
|
|
4275
|
+
},
|
|
4276
|
+
{
|
|
4277
|
+
name: "parallelogram",
|
|
4278
|
+
aliases: ["io"],
|
|
4279
|
+
size: (cw, ch) => {
|
|
4280
|
+
const { w, h } = pad(cw, ch);
|
|
4281
|
+
return {
|
|
4282
|
+
w: w + 24,
|
|
4283
|
+
h: Math.max(h, 48)
|
|
4284
|
+
};
|
|
4285
|
+
},
|
|
4286
|
+
path: ({ x, y, w, h }) => {
|
|
4287
|
+
const s = Math.min(16, w / 5);
|
|
4288
|
+
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`;
|
|
4289
|
+
}
|
|
4290
|
+
},
|
|
4291
|
+
{
|
|
4292
|
+
name: "document",
|
|
4293
|
+
aliases: ["doc"],
|
|
4294
|
+
textOffset: -4,
|
|
4295
|
+
size: (cw, ch) => {
|
|
4296
|
+
const { w, h } = pad(cw, ch);
|
|
4297
|
+
return {
|
|
4298
|
+
w: Math.max(w, 96),
|
|
4299
|
+
h: Math.max(h + 10, 56)
|
|
4300
|
+
};
|
|
4301
|
+
},
|
|
4302
|
+
path: (b, radius) => {
|
|
4303
|
+
const { x, y, w, h } = b;
|
|
4304
|
+
const r = round(b, radius);
|
|
4305
|
+
const wv = Math.min(8, h / 6);
|
|
4306
|
+
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`;
|
|
4307
|
+
}
|
|
4308
|
+
},
|
|
4309
|
+
{
|
|
4310
|
+
name: "note",
|
|
4311
|
+
aliases: ["sticky"],
|
|
4312
|
+
size: (cw, ch) => {
|
|
4313
|
+
const { w, h } = pad(cw, ch);
|
|
4314
|
+
return {
|
|
4315
|
+
w: Math.max(w + 8, 96),
|
|
4316
|
+
h: Math.max(h, 48)
|
|
4317
|
+
};
|
|
4318
|
+
},
|
|
4319
|
+
path: ({ x, y, w, h }) => {
|
|
4320
|
+
const c = Math.min(14, w / 5, h / 3);
|
|
4321
|
+
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`;
|
|
4322
|
+
},
|
|
4323
|
+
detail: ({ x, y, w, h }) => {
|
|
4324
|
+
const c = Math.min(14, w / 5, h / 3);
|
|
4325
|
+
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)}`;
|
|
4326
|
+
}
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
name: "text",
|
|
4330
|
+
aliases: [
|
|
4331
|
+
"label",
|
|
4332
|
+
"plain",
|
|
4333
|
+
"none"
|
|
4334
|
+
],
|
|
4335
|
+
size: (cw, ch) => ({
|
|
4336
|
+
w: cw + 12,
|
|
4337
|
+
h: ch + 8
|
|
4338
|
+
}),
|
|
4339
|
+
path: (b, radius) => rectPath(b.x, b.y, b.w, b.h, round(b, radius))
|
|
4340
|
+
}
|
|
4341
|
+
]
|
|
4342
|
+
};
|
|
4343
|
+
// src/plugins/markers.ts
|
|
4344
|
+
/** a point in the marker's frame: x runs along the line towards the tip, y across it */
|
|
4345
|
+
const frame = (at, angle) => {
|
|
4346
|
+
const cos = Math.cos(angle);
|
|
4347
|
+
const sin = Math.sin(angle);
|
|
4348
|
+
return (x, y) => `${f$2(at.x + x * cos - y * sin)},${f$2(at.y + x * sin + y * cos)}`;
|
|
4349
|
+
};
|
|
4350
|
+
const markers = {
|
|
4351
|
+
name: "markers",
|
|
4352
|
+
markers: [
|
|
4353
|
+
{
|
|
4354
|
+
name: "arrow",
|
|
4355
|
+
inset: (L) => L * .8,
|
|
4356
|
+
render(at, angle, { color, width: w, size: L }) {
|
|
4357
|
+
const P = frame(at, angle);
|
|
4358
|
+
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"/>`;
|
|
4359
|
+
}
|
|
4360
|
+
},
|
|
4361
|
+
{
|
|
4362
|
+
name: "open",
|
|
4363
|
+
inset: (_L, w) => w * .8,
|
|
4364
|
+
render(at, angle, { color, width: w, size: L }) {
|
|
4365
|
+
const P = frame(at, angle);
|
|
4366
|
+
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"/>`;
|
|
4367
|
+
}
|
|
4368
|
+
},
|
|
4369
|
+
{
|
|
4370
|
+
name: "dot",
|
|
4371
|
+
inset: (L) => L * .7,
|
|
4372
|
+
render(at, angle, { color, size: L }) {
|
|
4373
|
+
const r = L * .36;
|
|
4374
|
+
const [cx, cy] = frame(at, angle)(-r, 0).split(",");
|
|
4375
|
+
return `<circle cx="${cx}" cy="${cy}" r="${f$2(r)}" fill="${color}"/>`;
|
|
4376
|
+
}
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
name: "diamond",
|
|
4380
|
+
inset: (L) => L * 1.6,
|
|
4381
|
+
render(at, angle, { color, size: L }) {
|
|
4382
|
+
const P = frame(at, angle);
|
|
4383
|
+
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}"/>`;
|
|
4384
|
+
}
|
|
4385
|
+
},
|
|
4386
|
+
{
|
|
4387
|
+
name: "bar",
|
|
4388
|
+
render(at, angle, { color, width: w, size: L }) {
|
|
4389
|
+
const P = frame(at, angle);
|
|
4390
|
+
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"/>`;
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
4393
|
+
]
|
|
4394
|
+
};
|
|
4278
4395
|
const themes = {
|
|
4279
4396
|
name: "themes",
|
|
4280
4397
|
themes: [
|
|
@@ -4942,40 +5059,6 @@ const frames = {
|
|
|
4942
5059
|
],
|
|
4943
5060
|
props: { node: ["frame"] }
|
|
4944
5061
|
};
|
|
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
5062
|
// src/plugins/footer.ts
|
|
4980
5063
|
const split$1 = (v) => v.split("|").map((s) => s.trim()).filter(Boolean);
|
|
4981
5064
|
/** item widths from the last measure, so render places them with the real metrics */
|
|
@@ -8992,6 +9075,8 @@ function renderTreeview(roots, box, ctx) {
|
|
|
8992
9075
|
// src/setup.ts
|
|
8993
9076
|
/** Registers the built-in plugins. Imported for its side effect by every entry point. */
|
|
8994
9077
|
use(...[
|
|
9078
|
+
shapes,
|
|
9079
|
+
markers,
|
|
8995
9080
|
themes,
|
|
8996
9081
|
charts,
|
|
8997
9082
|
tables,
|
|
@@ -10562,7 +10647,7 @@ function layoutGroups(d, nodes, theme, measure) {
|
|
|
10562
10647
|
decl: g,
|
|
10563
10648
|
depth: depth(gid),
|
|
10564
10649
|
...box,
|
|
10565
|
-
...head
|
|
10650
|
+
...head,
|
|
10566
10651
|
style: resolveGroupStyle({
|
|
10567
10652
|
...g,
|
|
10568
10653
|
props: effectiveProps(d, g)
|
|
@@ -10694,7 +10779,10 @@ function placePanels(d, theme, measure, graph) {
|
|
|
10694
10779
|
if (!kind) continue;
|
|
10695
10780
|
const offsets = d.layout.panels?.[decl.id]?.parts ?? {};
|
|
10696
10781
|
const ctx = panelCtx(decl, offsets, panelTheme(theme, decl.props, d.themes), measure);
|
|
10697
|
-
const c =
|
|
10782
|
+
const c = decl.failed ? {
|
|
10783
|
+
w: 0,
|
|
10784
|
+
h: 0
|
|
10785
|
+
} : kind.measure(decl.data, ctx);
|
|
10698
10786
|
const head = panelHead(decl.label, ctx.fs);
|
|
10699
10787
|
const tw = decl.label ? richW(decl.label, ctx.fs * 1.05, textFont(decl.props, ctx.fs, 650).weight, theme.mono, measure) : 0;
|
|
10700
10788
|
const w = even(Math.max(c.w, tw) + 32);
|
|
@@ -10718,7 +10806,7 @@ function placePanels(d, theme, measure, graph) {
|
|
|
10718
10806
|
offsets,
|
|
10719
10807
|
ctx,
|
|
10720
10808
|
get handles() {
|
|
10721
|
-
return handles ??= kind.handles?.(decl.data, inner, ctx)
|
|
10809
|
+
return handles ??= !decl.failed && kind.handles?.(decl.data, inner, ctx) || [];
|
|
10722
10810
|
}
|
|
10723
10811
|
});
|
|
10724
10812
|
}
|
|
@@ -10866,7 +10954,7 @@ function renderPanel(p, L, measure, shadow, id) {
|
|
|
10866
10954
|
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
10955
|
if (p.decl.label) out.push(`<text x="${f(box.x + 16)}" y="${f(box.y + 16 + head * .32)}" 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
10956
|
p.ctx.idPrefix = `${id}-${p.decl.id}`;
|
|
10869
|
-
out.push(kind.render(p.decl.data, p.inner, !measure || measure === p.ctx.measure ? p.ctx : {
|
|
10957
|
+
if (!p.decl.failed) out.push(kind.render(p.decl.data, p.inner, !measure || measure === p.ctx.measure ? p.ctx : {
|
|
10870
10958
|
...p.ctx,
|
|
10871
10959
|
measure
|
|
10872
10960
|
}));
|
|
@@ -13305,5 +13393,5 @@ function onTypeEdits(text, pos, ch) {
|
|
|
13305
13393
|
}
|
|
13306
13394
|
// src/version.ts
|
|
13307
13395
|
/** the package version, inlined by the build */
|
|
13308
|
-
const VERSION = "1.
|
|
13396
|
+
const VERSION = "1.3.0";
|
|
13309
13397
|
export { PLACEMENT_PROPS as A, themeNames as B, COLORS as C, NODE_PROPS as D, GROUP_PROPS as E, spanKey as F, THEME_KEYS as I, THEME_NAMES as L, SPAN_KEYS as M, esc$1 as N, NUMBERS as O, parseSpanStyle as P, TONES as R, BOOLS as S, ENUMS as T, table as V, isYuhwaPath as _, onTypeEdits as a, parse as b, render as c, optionKind as d, registry as f, blockBraces as g, SETTING_VALUES as h, format as i, SHAPES$2 as j, PANEL_PROPS as k, toSource as l, PANELS as m, applyChange as n, tidy as o, KNOWN_SETTINGS as p, diffEdits as r, diskResolve as s, VERSION as t, canvasMeasure as u, joinPath as v, EDGE_PROPS as w, serializeProps as x, lex as y, isSafeCss as z };
|