@pixerate/editor 0.164.0 → 0.166.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/agent/index.cjs +54 -39
- package/dist/agent/index.js +24 -9
- package/dist/animation/index.cjs +6 -5
- package/dist/animation/index.js +5 -4
- package/dist/animation-editor/index.cjs +65 -64
- package/dist/animation-editor/index.js +8 -7
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/canvas/index.cjs +89 -87
- package/dist/canvas/index.js +11 -9
- package/dist/chart/controller.d.cts +60 -2
- package/dist/chart/controller.d.ts +60 -2
- package/dist/chart/index.cjs +657 -163
- package/dist/chart/index.d.cts +3 -0
- package/dist/chart/index.d.ts +3 -0
- package/dist/chart/index.js +512 -18
- package/dist/chart/layout-families.d.cts +14 -0
- package/dist/chart/layout-families.d.ts +14 -0
- package/dist/chart/layout-shared.d.cts +5 -0
- package/dist/chart/layout-shared.d.ts +5 -0
- package/dist/chart/links.d.cts +34 -0
- package/dist/chart/links.d.ts +34 -0
- package/dist/chart/mermaid.d.cts +9 -6
- package/dist/chart/mermaid.d.ts +9 -6
- package/dist/chart/race.d.cts +26 -0
- package/dist/chart/race.d.ts +26 -0
- package/dist/chart/schemas.d.cts +5 -0
- package/dist/chart/schemas.d.ts +5 -0
- package/dist/chart/spec.d.cts +3 -2
- package/dist/chart/spec.d.ts +3 -2
- package/dist/chart/style.d.cts +33 -0
- package/dist/chart/style.d.ts +33 -0
- package/dist/chart/types.d.cts +28 -2
- package/dist/chart/types.d.ts +28 -2
- package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
- package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
- package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
- package/dist/{chunk-5FNGLV2D.js → chunk-5UNQDC3Q.js} +18 -3
- package/dist/{chunk-YSAGBIRW.cjs → chunk-6FYIFGBW.cjs} +16 -16
- package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
- package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
- package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
- package/dist/{chunk-R3P2M7HU.cjs → chunk-BPX4Z3N3.cjs} +355 -207
- package/dist/{chunk-D54JHQK2.cjs → chunk-CHLV7UFP.cjs} +51 -51
- package/dist/{chunk-OXERWBKE.js → chunk-DFCAR7AW.js} +3 -3
- package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
- package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
- package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
- package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-3NEZJCBY.js → chunk-FR432ROA.js} +349 -201
- package/dist/chunk-HIDFL5LQ.js +484 -0
- package/dist/{chunk-22KLZZGH.cjs → chunk-HXOBOHH2.cjs} +8 -8
- package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
- package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
- package/dist/{chunk-Z4P2RBMJ.js → chunk-ITANXMZD.js} +177 -3
- package/dist/chunk-KGRZMHZB.js +204 -0
- package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
- package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
- package/dist/{chunk-NZD2MZJC.cjs → chunk-MZFZSVUJ.cjs} +38 -23
- package/dist/{chunk-DAPQGA55.js → chunk-NQQDGGXY.js} +2 -2
- package/dist/chunk-O6OGNDND.js +164 -0
- package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
- package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
- package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
- package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
- package/dist/{chunk-YGG7WDWT.cjs → chunk-SZWVMB3B.cjs} +24 -18
- package/dist/chunk-TFF2GTGN.cjs +153 -0
- package/dist/chunk-TTCJPX4U.cjs +204 -0
- package/dist/{chunk-SBQVEBSU.cjs → chunk-UUUTEVX6.cjs} +242 -68
- package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
- package/dist/{chunk-GKNEJ6EN.cjs → chunk-V5L2G22R.cjs} +321 -107
- package/dist/{chunk-TALQONZ5.js → chunk-VB2CY6EG.js} +3 -3
- package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
- package/dist/chunk-VU6WQSMB.cjs +164 -0
- package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
- package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
- package/dist/{chunk-POR54B55.js → chunk-XNU45TYA.js} +7 -1
- package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
- package/dist/chunk-YBAPT7NL.js +153 -0
- package/dist/{chunk-SZA42R4N.js → chunk-YUFTVNLX.js} +230 -16
- package/dist/chunk-Z2UQYMPS.cjs +484 -0
- package/dist/color/index.cjs +5 -3
- package/dist/color/index.js +12 -10
- package/dist/diagram/index.cjs +55 -243
- package/dist/diagram/index.js +12 -200
- package/dist/export/index.cjs +7 -6
- package/dist/export/index.js +6 -5
- package/dist/extensions/index.cjs +12 -9
- package/dist/extensions/index.js +11 -8
- package/dist/gradient/index.cjs +29 -27
- package/dist/gradient/index.js +6 -4
- package/dist/image-editor/index.cjs +644 -643
- package/dist/image-editor/index.js +7 -6
- package/dist/index.cjs +21 -18
- package/dist/index.js +14 -11
- package/dist/paint-editor/index.cjs +19 -18
- package/dist/paint-editor/index.js +7 -6
- package/dist/parameters/index.cjs +2 -2
- package/dist/parameters/index.js +1 -1
- package/dist/persistence/assetWrites.d.cts +22 -0
- package/dist/persistence/assetWrites.d.ts +22 -0
- package/dist/persistence/assets.d.cts +71 -0
- package/dist/persistence/assets.d.ts +71 -0
- package/dist/persistence/documentStore.d.cts +17 -1
- package/dist/persistence/documentStore.d.ts +17 -1
- package/dist/persistence/documentTools.d.cts +5 -1
- package/dist/persistence/documentTools.d.ts +5 -1
- package/dist/persistence/editorAutosave.d.cts +7 -0
- package/dist/persistence/editorAutosave.d.ts +7 -0
- package/dist/persistence/index.cjs +141 -21
- package/dist/persistence/index.js +130 -10
- package/dist/persistence/storage.d.cts +13 -1
- package/dist/persistence/storage.d.ts +13 -1
- package/dist/spreadsheet/index.cjs +3 -3
- package/dist/spreadsheet/index.js +2 -2
- package/dist/tokens/index.cjs +11 -3
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +10 -2
- package/dist/tokens/style.d.cts +36 -0
- package/dist/tokens/style.d.ts +36 -0
- package/dist/tools/index.cjs +15 -3
- package/dist/tools/index.d.cts +2 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +14 -2
- package/dist/tools/style-tools.d.cts +19 -0
- package/dist/tools/style-tools.d.ts +19 -0
- package/dist/tools/style.d.cts +212 -0
- package/dist/tools/style.d.ts +212 -0
- package/dist/tools/view.d.cts +6 -0
- package/dist/tools/view.d.ts +6 -0
- package/dist/typography/index.cjs +8 -6
- package/dist/typography/index.js +5 -3
- package/dist/vector/index.cjs +953 -952
- package/dist/vector/index.js +7 -6
- package/dist/video-editor/index.cjs +8 -7
- package/dist/video-editor/index.js +6 -5
- package/package.json +1 -1
- package/skills/pixerate-chart/SKILL.md +20 -2
- package/dist/chunk-ERAGQL2N.cjs +0 -68
- package/dist/chunk-KMU6QJB7.js +0 -68
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; } var _class
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; } var _class;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkVU6WQSMBcjs = require('./chunk-VU6WQSMB.cjs');
|
|
6
|
+
|
|
7
|
+
// src/diagram/layout-registry.ts
|
|
2
8
|
var familyLayouts = /* @__PURE__ */ new Map();
|
|
3
9
|
function registerFamilyLayout(family, layout) {
|
|
4
10
|
familyLayouts.set(family, layout);
|
|
@@ -20,165 +26,6 @@ function sharedFrameLayout(box) {
|
|
|
20
26
|
};
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
// src/diagram/source/lines.ts
|
|
24
|
-
var HEADER_PATTERNS = [
|
|
25
|
-
[/^\s*(flowchart|graph)(?:-elk)?\b/i, "flowchart"],
|
|
26
|
-
[/^\s*stateDiagram(?:-v2)?\b/i, "state"],
|
|
27
|
-
[/^\s*classDiagram(?:-v2)?\b/i, "class"],
|
|
28
|
-
[/^\s*erDiagram\b/i, "er"],
|
|
29
|
-
[/^\s*requirementDiagram\b/i, "requirement"],
|
|
30
|
-
[/^\s*mindmap\b/i, "mindmap"],
|
|
31
|
-
[/^\s*sequenceDiagram\b/i, "sequence"],
|
|
32
|
-
[/^\s*gantt\b/i, "gantt"],
|
|
33
|
-
[/^\s*pie\b/i, "pie"],
|
|
34
|
-
[/^\s*journey\b/i, "journey"],
|
|
35
|
-
[/^\s*timeline\b/i, "timeline"],
|
|
36
|
-
[/^\s*gitGraph\b/i, "gitGraph"],
|
|
37
|
-
[/^\s*C4(Context|Container|Component|Dynamic|Deployment)\b/, "c4"],
|
|
38
|
-
[/^\s*quadrantChart\b/i, "quadrant"],
|
|
39
|
-
[/^\s*sankey(?:-beta)?\b/i, "sankey"],
|
|
40
|
-
[/^\s*xychart(?:-beta)?\b/i, "xychart"],
|
|
41
|
-
[/^\s*block(?:-beta)?\b/i, "block"],
|
|
42
|
-
[/^\s*architecture(?:-beta)?\b/i, "architecture"],
|
|
43
|
-
[/^\s*packet(?:-beta)?\b/i, "packet"],
|
|
44
|
-
[/^\s*kanban\b/i, "kanban"],
|
|
45
|
-
[/^\s*radar(?:-beta)?\b/i, "radar"],
|
|
46
|
-
[/^\s*treemap(?:-beta)?\b/i, "treemap"],
|
|
47
|
-
[/^\s*info\b/i, "info"]
|
|
48
|
-
];
|
|
49
|
-
function detectFamilyFromHeader(header) {
|
|
50
|
-
for (const [re, family] of HEADER_PATTERNS) {
|
|
51
|
-
if (re.test(header)) return family;
|
|
52
|
-
}
|
|
53
|
-
return "unknown";
|
|
54
|
-
}
|
|
55
|
-
function isCommentLine(line) {
|
|
56
|
-
const t = line.trim();
|
|
57
|
-
return t.startsWith("%%") && !t.startsWith("%%{");
|
|
58
|
-
}
|
|
59
|
-
function isDirectiveLine(line) {
|
|
60
|
-
return /^\s*%%\{.*\}%%\s*$/.test(line);
|
|
61
|
-
}
|
|
62
|
-
function splitSource(source) {
|
|
63
|
-
const eol = source.includes("\r\n") ? "\r\n" : "\n";
|
|
64
|
-
const rawLines = source.split(/\r\n|\n/);
|
|
65
|
-
let end = rawLines.length;
|
|
66
|
-
while (end > 0 && rawLines[end - 1].trim() === "") end--;
|
|
67
|
-
const trailingLines = rawLines.slice(end);
|
|
68
|
-
const trailing = trailingLines.length ? eol + trailingLines.join(eol) : "";
|
|
69
|
-
const lines = rawLines.slice(0, end);
|
|
70
|
-
const preambleLines = [];
|
|
71
|
-
let i = 0;
|
|
72
|
-
let frontmatter;
|
|
73
|
-
if (lines[0] !== void 0 && /^---\s*$/.test(lines[0])) {
|
|
74
|
-
preambleLines.push(lines[0]);
|
|
75
|
-
i = 1;
|
|
76
|
-
const fm = [];
|
|
77
|
-
while (i < lines.length && !/^---\s*$/.test(lines[i])) {
|
|
78
|
-
fm.push(lines[i]);
|
|
79
|
-
preambleLines.push(lines[i]);
|
|
80
|
-
i++;
|
|
81
|
-
}
|
|
82
|
-
if (i < lines.length) {
|
|
83
|
-
preambleLines.push(lines[i]);
|
|
84
|
-
i++;
|
|
85
|
-
}
|
|
86
|
-
frontmatter = parseSimpleYaml(fm);
|
|
87
|
-
}
|
|
88
|
-
while (i < lines.length) {
|
|
89
|
-
const line = lines[i];
|
|
90
|
-
if (line.trim() === "" || isDirectiveLine(line) || isCommentLine(line)) {
|
|
91
|
-
preambleLines.push(line);
|
|
92
|
-
i++;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
const headerIndex = i;
|
|
98
|
-
const header = _nullishCoalesce(lines[i], () => ( ""));
|
|
99
|
-
const bodyLines = lines.slice(i + 1);
|
|
100
|
-
return {
|
|
101
|
-
eol,
|
|
102
|
-
preamble: { lines: preambleLines, frontmatter },
|
|
103
|
-
header,
|
|
104
|
-
headerIndex,
|
|
105
|
-
bodyLines,
|
|
106
|
-
trailing
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function parseSimpleYaml(lines) {
|
|
110
|
-
const out = {};
|
|
111
|
-
let currentKey = null;
|
|
112
|
-
let nested = null;
|
|
113
|
-
for (const raw of lines) {
|
|
114
|
-
if (raw.trim() === "" || raw.trim().startsWith("#")) continue;
|
|
115
|
-
const indent = raw.length - raw.trimStart().length;
|
|
116
|
-
const m = /^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(raw.trim());
|
|
117
|
-
if (!m) continue;
|
|
118
|
-
const [, key, valueRaw] = m;
|
|
119
|
-
const value = parseYamlScalar(valueRaw);
|
|
120
|
-
if (indent === 0) {
|
|
121
|
-
currentKey = key;
|
|
122
|
-
if (valueRaw.trim() === "") {
|
|
123
|
-
nested = {};
|
|
124
|
-
out[key] = nested;
|
|
125
|
-
} else {
|
|
126
|
-
nested = null;
|
|
127
|
-
out[key] = value;
|
|
128
|
-
}
|
|
129
|
-
} else if (nested && currentKey) {
|
|
130
|
-
nested[key] = value;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return out;
|
|
134
|
-
}
|
|
135
|
-
function parseYamlScalar(v) {
|
|
136
|
-
const t = v.trim();
|
|
137
|
-
if (t === "") return "";
|
|
138
|
-
if (t.startsWith("{") || t.startsWith("[")) {
|
|
139
|
-
try {
|
|
140
|
-
return JSON.parse(t);
|
|
141
|
-
} catch (e2) {
|
|
142
|
-
return t;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (/^(true|false)$/i.test(t)) return t.toLowerCase() === "true";
|
|
146
|
-
if (/^-?\d+(\.\d+)?$/.test(t)) return Number(t);
|
|
147
|
-
if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'")) {
|
|
148
|
-
return t.slice(1, -1);
|
|
149
|
-
}
|
|
150
|
-
return t;
|
|
151
|
-
}
|
|
152
|
-
function splitStatements(line) {
|
|
153
|
-
const parts = [];
|
|
154
|
-
let depth = 0;
|
|
155
|
-
let quote2 = null;
|
|
156
|
-
let cur = "";
|
|
157
|
-
for (let i = 0; i < line.length; i++) {
|
|
158
|
-
const ch = line[i];
|
|
159
|
-
if (quote2) {
|
|
160
|
-
cur += ch;
|
|
161
|
-
if (ch === quote2) quote2 = null;
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (ch === '"' || ch === "`") {
|
|
165
|
-
quote2 = ch;
|
|
166
|
-
cur += ch;
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
if (ch === "[" || ch === "(" || ch === "{") depth++;
|
|
170
|
-
else if (ch === "]" || ch === ")" || ch === "}") depth = Math.max(0, depth - 1);
|
|
171
|
-
if (ch === ";" && depth === 0) {
|
|
172
|
-
parts.push(cur);
|
|
173
|
-
cur = "";
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
cur += ch;
|
|
177
|
-
}
|
|
178
|
-
parts.push(cur);
|
|
179
|
-
return parts;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
29
|
// src/diagram/source/metadata.ts
|
|
183
30
|
var META_COMMENT_PREFIX = "%% @pixerate ";
|
|
184
31
|
var META_FRONTMATTER_KEY = "pixerate";
|
|
@@ -221,7 +68,7 @@ function safeParseMeta(json) {
|
|
|
221
68
|
try {
|
|
222
69
|
const value = JSON.parse(json);
|
|
223
70
|
return normaliseMeta(value);
|
|
224
|
-
} catch (
|
|
71
|
+
} catch (e2) {
|
|
225
72
|
return null;
|
|
226
73
|
}
|
|
227
74
|
}
|
|
@@ -1108,7 +955,7 @@ function tokenizeBody(bodyLines) {
|
|
|
1108
955
|
statements.push(parseStatement(logical));
|
|
1109
956
|
continue;
|
|
1110
957
|
}
|
|
1111
|
-
const segments = splitStatements(logical);
|
|
958
|
+
const segments = _chunkVU6WQSMBcjs.splitStatements.call(void 0, logical);
|
|
1112
959
|
const nonEmpty = segments.filter((s) => s.trim() !== "");
|
|
1113
960
|
if (nonEmpty.length <= 1) {
|
|
1114
961
|
const stmt = parseStatement(_nullishCoalesce(nonEmpty[0], () => ( logical)));
|
|
@@ -1977,7 +1824,7 @@ function doc_dirty(work, structural) {
|
|
|
1977
1824
|
return work.dirty || structural;
|
|
1978
1825
|
}
|
|
1979
1826
|
function parseFlowchartSource(source, carrier) {
|
|
1980
|
-
const split = splitSource(source);
|
|
1827
|
+
const split = _chunkVU6WQSMBcjs.splitSource.call(void 0, source);
|
|
1981
1828
|
const fromBody = extractMetaFromBody(split.bodyLines);
|
|
1982
1829
|
const fromFm = extractMetaFromFrontmatter(split.preamble);
|
|
1983
1830
|
let meta = emptyMeta();
|
|
@@ -2509,7 +2356,7 @@ function detectIndent2(statements) {
|
|
|
2509
2356
|
return " ";
|
|
2510
2357
|
}
|
|
2511
2358
|
function parseFull(grammar, source, carrier) {
|
|
2512
|
-
const split = splitSource(source);
|
|
2359
|
+
const split = _chunkVU6WQSMBcjs.splitSource.call(void 0, source);
|
|
2513
2360
|
const fromBody = extractMetaFromBody(split.bodyLines);
|
|
2514
2361
|
const fromFm = extractMetaFromFrontmatter(split.preamble);
|
|
2515
2362
|
let meta = emptyMeta();
|
|
@@ -3782,7 +3629,7 @@ function serializeStatementDocument(grammar, doc) {
|
|
|
3782
3629
|
);
|
|
3783
3630
|
}
|
|
3784
3631
|
function parseFull2(grammar, source, carrier) {
|
|
3785
|
-
const split = splitSource(source);
|
|
3632
|
+
const split = _chunkVU6WQSMBcjs.splitSource.call(void 0, source);
|
|
3786
3633
|
const fromBody = extractMetaFromBody(split.bodyLines);
|
|
3787
3634
|
const fromFm = extractMetaFromFrontmatter(split.preamble);
|
|
3788
3635
|
let meta = emptyMeta();
|
|
@@ -9733,7 +9580,7 @@ function textWidth2(text, fontSize = M4.fontSize, bold = false) {
|
|
|
9733
9580
|
if (browser)
|
|
9734
9581
|
try {
|
|
9735
9582
|
measurer = document.createElement("canvas").getContext("2d");
|
|
9736
|
-
} catch (
|
|
9583
|
+
} catch (e3) {
|
|
9737
9584
|
measurer = null;
|
|
9738
9585
|
}
|
|
9739
9586
|
}
|
|
@@ -10067,7 +9914,7 @@ function textWidth3(text, fontSize = M5.fontSize, bold = false) {
|
|
|
10067
9914
|
if (browser)
|
|
10068
9915
|
try {
|
|
10069
9916
|
measurer2 = document.createElement("canvas").getContext("2d");
|
|
10070
|
-
} catch (
|
|
9917
|
+
} catch (e4) {
|
|
10071
9918
|
measurer2 = null;
|
|
10072
9919
|
}
|
|
10073
9920
|
}
|
|
@@ -10927,11 +10774,11 @@ for (const family of [
|
|
|
10927
10774
|
|
|
10928
10775
|
// src/diagram/document.ts
|
|
10929
10776
|
function detectFamily(source) {
|
|
10930
|
-
return detectFamilyFromHeader(splitSource(source).header);
|
|
10777
|
+
return _chunkVU6WQSMBcjs.detectFamilyFromHeader.call(void 0, _chunkVU6WQSMBcjs.splitSource.call(void 0, source).header);
|
|
10931
10778
|
}
|
|
10932
10779
|
function parseMermaid(source, options = {}) {
|
|
10933
|
-
const split = splitSource(source);
|
|
10934
|
-
const family = detectFamilyFromHeader(split.header);
|
|
10780
|
+
const split = _chunkVU6WQSMBcjs.splitSource.call(void 0, source);
|
|
10781
|
+
const family = _chunkVU6WQSMBcjs.detectFamilyFromHeader.call(void 0, split.header);
|
|
10935
10782
|
const fromBody = extractMetaFromBody(split.bodyLines);
|
|
10936
10783
|
const fromFm = extractMetaFromFrontmatter(split.preamble);
|
|
10937
10784
|
let meta = emptyMeta();
|
|
@@ -11099,7 +10946,4 @@ function applyEdits(doc, ops) {
|
|
|
11099
10946
|
|
|
11100
10947
|
|
|
11101
10948
|
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
exports.registerFamilyLayout = registerFamilyLayout; exports.getFamilyLayout = getFamilyLayout; exports.XY_CHART_BOX = XY_CHART_BOX; exports.RADAR_CHART_BOX = RADAR_CHART_BOX; exports.sharedFrameLayout = sharedFrameLayout; exports.detectFamilyFromHeader = detectFamilyFromHeader; exports.splitSource = splitSource; exports.splitStatements = splitStatements; exports.META_COMMENT_PREFIX = META_COMMENT_PREFIX; exports.META_FRONTMATTER_KEY = META_FRONTMATTER_KEY; exports.emptyMeta = emptyMeta; exports.mergeMeta = mergeMeta; exports.isMetaEmpty = isMetaEmpty; exports.serializeMeta = serializeMeta; exports.parseLink = parseLink; exports.quoteLabelIfNeeded = quoteLabelIfNeeded; exports.formatLink = formatLink; exports.FLOWCHART_SHAPES = FLOWCHART_SHAPES; exports.resolveShape = resolveShape; exports.canonicalShape = canonicalShape; exports.parseChain = parseChain; exports.parseStatement = parseStatement; exports.formatNode = formatNode; exports.formatChain = formatChain; exports.parseFlowchartSource = parseFlowchartSource; exports.flowchartAdapter = flowchartAdapter; exports.createLineAdapter = createLineAdapter; exports.createPassthroughAdapter = createPassthroughAdapter; exports.STATE_SHAPES = STATE_SHAPES; exports.stateGrammar = stateGrammar; exports.CLASS_RELATIONS = CLASS_RELATIONS; exports.relationFor = relationFor; exports.parseMembers = parseMembers; exports.classGrammar = classGrammar; exports.ER_CARDINALITIES = ER_CARDINALITIES; exports.parseAttributes = parseAttributes; exports.erGrammar = erGrammar; exports.ER_PATTERNS = ER_PATTERNS; exports.PIE_METRICS = PIE_METRICS; exports.pieGeometry = pieGeometry; exports.parseStatementDocument = parseStatementDocument; exports.serializeStatementDocument = serializeStatementDocument; exports.applyStatementEdit = applyStatementEdit; exports.createStatementAdapter = createStatementAdapter; exports.indentOf = indentOf; exports.slugId = slugId; exports.uniqueId = uniqueId; exports.filterInPlace = filterInPlace3; exports.renameMetaKey = renameMetaKey; exports.dropMetaKeys = dropMetaKeys; exports.quote = quote; exports.unquote = unquote; exports.splitOutsideQuotes = splitOutsideQuotes; exports.pieGrammar = pieGrammar; exports.pieAdapter = pieAdapter; exports.MINDMAP_METRICS = MINDMAP_METRICS; exports.mindmapGeometry = mindmapGeometry; exports.mindmapGrammar = mindmapGrammar; exports.mindmapAdapter = mindmapAdapter; exports.QUADRANT_METRICS = QUADRANT_METRICS; exports.POINT_BOX = POINT_BOX; exports.quadrantSpace = quadrantSpace; exports.spaceInput = spaceInput; exports.pointCentre = pointCentre; exports.pointPosition = pointPosition; exports.positionToData = positionToData; exports.quadrantGeometry = quadrantGeometry; exports.quadrantGrammar = quadrantGrammar; exports.quadrantAdapter = quadrantAdapter; exports.C4_METRICS = C4_METRICS; exports.c4ElementType = c4ElementType; exports.c4Stereotype = c4Stereotype; exports.c4ElementGeometry = c4ElementGeometry; exports.c4BoundaryText = c4BoundaryText; exports.c4Layout = c4Layout; exports.c4RelGeometry = c4RelGeometry; exports.c4ArrowHead = c4ArrowHead; exports.c4Grammar = c4Grammar; exports.c4Adapter = c4Adapter; exports.ARCH_METRICS = ARCH_METRICS; exports.isSide = isSide; exports.serviceLabelLines = serviceLabelLines; exports.architectureLayout = architectureLayout; exports.architectureEdgeRoute = architectureEdgeRoute; exports.architectureArrow = architectureArrow; exports.shiftEndpoint = shiftEndpoint; exports.architectureGrammar = architectureGrammar; exports.architectureAdapter = architectureAdapter; exports.SEQUENCE_METRICS = SEQUENCE_METRICS; exports.sequenceGeometry = sequenceGeometry; exports.sequenceGrammar = sequenceGrammar; exports.sequenceAdapter = sequenceAdapter; exports.GIT_METRICS = GIT_METRICS; exports.estimateTextWidth = estimateTextWidth3; exports.gitGraphGeometry = gitGraphGeometry; exports.gitGraphGrammar = gitGraphGrammar; exports.gitGraphAdapter = gitGraphAdapter; exports.GANTT_METRICS = GANTT_METRICS; exports.ganttGeometry = ganttGeometry; exports.formatAxis = formatAxis; exports.GANTT_TAGS = GANTT_TAGS; exports.GANTT_CONFIG_KEYS = GANTT_CONFIG_KEYS; exports.afterIds = afterIds; exports.parseGanttDate = parseGanttDate; exports.formatGanttDate = formatGanttDate; exports.ganttGrammar = ganttGrammar; exports.ganttAdapter = ganttAdapter; exports.TIMELINE_METRICS = TIMELINE_METRICS; exports.textWidth = textWidth2; exports.timelineGeometry = timelineGeometry; exports.timelineGrammar = timelineGrammar; exports.timelineAdapter = timelineAdapter; exports.timelineLayout = timelineLayout; exports.JOURNEY_METRICS = JOURNEY_METRICS; exports.journeyGeometry = journeyGeometry; exports.journeyGrammar = journeyGrammar; exports.journeyAdapter = journeyAdapter; exports.journeyLayout = journeyLayout; exports.xyChartGrammar = xyChartGrammar; exports.xyChartAdapter = xyChartAdapter; exports.radarGrammar = radarGrammar; exports.radarAdapter = radarAdapter; exports.registerDiagramAdapter = registerDiagramAdapter; exports.getDiagramAdapter = getDiagramAdapter; exports.supportTierOf = supportTierOf; exports.detectFamily = detectFamily; exports.parseMermaid = parseMermaid; exports.serializeMermaid = serializeMermaid; exports.applyEdit = applyEdit; exports.applyEdits = applyEdits;
|
|
10949
|
+
exports.registerFamilyLayout = registerFamilyLayout; exports.getFamilyLayout = getFamilyLayout; exports.XY_CHART_BOX = XY_CHART_BOX; exports.RADAR_CHART_BOX = RADAR_CHART_BOX; exports.sharedFrameLayout = sharedFrameLayout; exports.META_COMMENT_PREFIX = META_COMMENT_PREFIX; exports.META_FRONTMATTER_KEY = META_FRONTMATTER_KEY; exports.emptyMeta = emptyMeta; exports.mergeMeta = mergeMeta; exports.isMetaEmpty = isMetaEmpty; exports.serializeMeta = serializeMeta; exports.parseLink = parseLink; exports.quoteLabelIfNeeded = quoteLabelIfNeeded; exports.formatLink = formatLink; exports.FLOWCHART_SHAPES = FLOWCHART_SHAPES; exports.resolveShape = resolveShape; exports.canonicalShape = canonicalShape; exports.parseChain = parseChain; exports.parseStatement = parseStatement; exports.formatNode = formatNode; exports.formatChain = formatChain; exports.parseFlowchartSource = parseFlowchartSource; exports.flowchartAdapter = flowchartAdapter; exports.createLineAdapter = createLineAdapter; exports.createPassthroughAdapter = createPassthroughAdapter; exports.STATE_SHAPES = STATE_SHAPES; exports.stateGrammar = stateGrammar; exports.CLASS_RELATIONS = CLASS_RELATIONS; exports.relationFor = relationFor; exports.parseMembers = parseMembers; exports.classGrammar = classGrammar; exports.ER_CARDINALITIES = ER_CARDINALITIES; exports.parseAttributes = parseAttributes; exports.erGrammar = erGrammar; exports.ER_PATTERNS = ER_PATTERNS; exports.PIE_METRICS = PIE_METRICS; exports.pieGeometry = pieGeometry; exports.parseStatementDocument = parseStatementDocument; exports.serializeStatementDocument = serializeStatementDocument; exports.applyStatementEdit = applyStatementEdit; exports.createStatementAdapter = createStatementAdapter; exports.indentOf = indentOf; exports.slugId = slugId; exports.uniqueId = uniqueId; exports.filterInPlace = filterInPlace3; exports.renameMetaKey = renameMetaKey; exports.dropMetaKeys = dropMetaKeys; exports.quote = quote; exports.unquote = unquote; exports.splitOutsideQuotes = splitOutsideQuotes; exports.pieGrammar = pieGrammar; exports.pieAdapter = pieAdapter; exports.MINDMAP_METRICS = MINDMAP_METRICS; exports.mindmapGeometry = mindmapGeometry; exports.mindmapGrammar = mindmapGrammar; exports.mindmapAdapter = mindmapAdapter; exports.QUADRANT_METRICS = QUADRANT_METRICS; exports.POINT_BOX = POINT_BOX; exports.quadrantSpace = quadrantSpace; exports.spaceInput = spaceInput; exports.pointCentre = pointCentre; exports.pointPosition = pointPosition; exports.positionToData = positionToData; exports.quadrantGeometry = quadrantGeometry; exports.quadrantGrammar = quadrantGrammar; exports.quadrantAdapter = quadrantAdapter; exports.C4_METRICS = C4_METRICS; exports.c4ElementType = c4ElementType; exports.c4Stereotype = c4Stereotype; exports.c4ElementGeometry = c4ElementGeometry; exports.c4BoundaryText = c4BoundaryText; exports.c4Layout = c4Layout; exports.c4RelGeometry = c4RelGeometry; exports.c4ArrowHead = c4ArrowHead; exports.c4Grammar = c4Grammar; exports.c4Adapter = c4Adapter; exports.ARCH_METRICS = ARCH_METRICS; exports.isSide = isSide; exports.serviceLabelLines = serviceLabelLines; exports.architectureLayout = architectureLayout; exports.architectureEdgeRoute = architectureEdgeRoute; exports.architectureArrow = architectureArrow; exports.shiftEndpoint = shiftEndpoint; exports.architectureGrammar = architectureGrammar; exports.architectureAdapter = architectureAdapter; exports.SEQUENCE_METRICS = SEQUENCE_METRICS; exports.sequenceGeometry = sequenceGeometry; exports.sequenceGrammar = sequenceGrammar; exports.sequenceAdapter = sequenceAdapter; exports.GIT_METRICS = GIT_METRICS; exports.estimateTextWidth = estimateTextWidth3; exports.gitGraphGeometry = gitGraphGeometry; exports.gitGraphGrammar = gitGraphGrammar; exports.gitGraphAdapter = gitGraphAdapter; exports.GANTT_METRICS = GANTT_METRICS; exports.ganttGeometry = ganttGeometry; exports.formatAxis = formatAxis; exports.GANTT_TAGS = GANTT_TAGS; exports.GANTT_CONFIG_KEYS = GANTT_CONFIG_KEYS; exports.afterIds = afterIds; exports.parseGanttDate = parseGanttDate; exports.formatGanttDate = formatGanttDate; exports.ganttGrammar = ganttGrammar; exports.ganttAdapter = ganttAdapter; exports.TIMELINE_METRICS = TIMELINE_METRICS; exports.textWidth = textWidth2; exports.timelineGeometry = timelineGeometry; exports.timelineGrammar = timelineGrammar; exports.timelineAdapter = timelineAdapter; exports.timelineLayout = timelineLayout; exports.JOURNEY_METRICS = JOURNEY_METRICS; exports.journeyGeometry = journeyGeometry; exports.journeyGrammar = journeyGrammar; exports.journeyAdapter = journeyAdapter; exports.journeyLayout = journeyLayout; exports.xyChartGrammar = xyChartGrammar; exports.xyChartAdapter = xyChartAdapter; exports.radarGrammar = radarGrammar; exports.radarAdapter = radarAdapter; exports.registerDiagramAdapter = registerDiagramAdapter; exports.getDiagramAdapter = getDiagramAdapter; exports.supportTierOf = supportTierOf; exports.detectFamily = detectFamily; exports.parseMermaid = parseMermaid; exports.serializeMermaid = serializeMermaid; exports.applyEdit = applyEdit; exports.applyEdits = applyEdits;
|
|
@@ -44,7 +44,7 @@ var _chunk55AKPTLMcjs = require('./chunk-55AKPTLM.cjs');
|
|
|
44
44
|
var _chunkN3KJFGXTcjs = require('./chunk-N3KJFGXT.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var _chunkSJ2CPTQCcjs = require('./chunk-SJ2CPTQC.cjs');
|
|
48
48
|
|
|
49
49
|
// src/spreadsheet/formula/dependency-graph.ts
|
|
50
50
|
function extractNameDependencies(node) {
|
|
@@ -6440,7 +6440,7 @@ function checkWorkbook(document) {
|
|
|
6440
6440
|
if (document.names !== void 0 && !Array.isArray(document.names)) throw new Error(`names must be an array. ${hint}`);
|
|
6441
6441
|
}
|
|
6442
6442
|
function createSpreadsheetEditorDocument(controller) {
|
|
6443
|
-
return
|
|
6443
|
+
return _chunkSJ2CPTQCcjs.defineEditorDocument.call(void 0, {
|
|
6444
6444
|
kind: "spreadsheet",
|
|
6445
6445
|
get: () => controller.getWorkbook(),
|
|
6446
6446
|
load: (document, { history }) => {
|
|
@@ -6,15 +6,15 @@ var _chunkA6QWKBJPcjs = require('./chunk-A6QWKBJP.cjs');
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk5UEFBM2Mcjs = require('./chunk-5UEFBM2M.cjs');
|
|
10
10
|
|
|
11
11
|
// src/animation/color.ts
|
|
12
12
|
function rgbToOklab2(r, g, b, alpha = 1) {
|
|
13
|
-
const lab =
|
|
13
|
+
const lab = _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, { r, g, b, a: alpha });
|
|
14
14
|
return { l: lab.l, a: lab.a, b: lab.b, alpha: lab.alpha };
|
|
15
15
|
}
|
|
16
16
|
function oklabToRgb2(color) {
|
|
17
|
-
const c =
|
|
17
|
+
const c = _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, { l: color.l, a: color.a, b: color.b, alpha: color.alpha });
|
|
18
18
|
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
19
19
|
return {
|
|
20
20
|
r: clamp01(c.r),
|
|
@@ -551,117 +551,6 @@ function isColor(input) {
|
|
|
551
551
|
return parseColor(input) !== null;
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
// src/color/gamut.ts
|
|
555
|
-
var clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
556
|
-
function inSrgbGamut(c, epsilon = 1e-5) {
|
|
557
|
-
return c.r >= -epsilon && c.r <= 1 + epsilon && c.g >= -epsilon && c.g <= 1 + epsilon && c.b >= -epsilon && c.b <= 1 + epsilon;
|
|
558
|
-
}
|
|
559
|
-
function deltaEOK(a, b) {
|
|
560
|
-
const la = rgbToOklab(a);
|
|
561
|
-
const lb = rgbToOklab(b);
|
|
562
|
-
return Math.hypot(la.l - lb.l, la.a - lb.a, la.b - lb.b);
|
|
563
|
-
}
|
|
564
|
-
function toSrgbGamut(c) {
|
|
565
|
-
const lch = oklabToOklch(rgbToOklab(c));
|
|
566
|
-
if (lch.l >= 1) return { r: 1, g: 1, b: 1, a: c.a };
|
|
567
|
-
if (lch.l <= 0) return { r: 0, g: 0, b: 0, a: c.a };
|
|
568
|
-
if (inSrgbGamut(c)) {
|
|
569
|
-
return { r: clamp01(c.r), g: clamp01(c.g), b: clamp01(c.b), a: c.a };
|
|
570
|
-
}
|
|
571
|
-
let low = 0;
|
|
572
|
-
let high = lch.c;
|
|
573
|
-
let clippedCandidate = { r: clamp01(c.r), g: clamp01(c.g), b: clamp01(c.b), a: c.a };
|
|
574
|
-
const JND = 0.02;
|
|
575
|
-
const EPS = 1e-4;
|
|
576
|
-
for (let i = 0; i < 30; i++) {
|
|
577
|
-
const mid = (low + high) / 2;
|
|
578
|
-
const candidate = oklabToRgb(oklchToOklab({ l: lch.l, c: mid, h: lch.h, alpha: c.a }));
|
|
579
|
-
const clipped = {
|
|
580
|
-
r: clamp01(candidate.r),
|
|
581
|
-
g: clamp01(candidate.g),
|
|
582
|
-
b: clamp01(candidate.b),
|
|
583
|
-
a: c.a
|
|
584
|
-
};
|
|
585
|
-
clippedCandidate = clipped;
|
|
586
|
-
const dE = deltaEOK(candidate, clipped);
|
|
587
|
-
if (dE < JND) {
|
|
588
|
-
if (JND - dE < EPS) {
|
|
589
|
-
return clipped;
|
|
590
|
-
}
|
|
591
|
-
low = mid;
|
|
592
|
-
} else {
|
|
593
|
-
high = mid;
|
|
594
|
-
}
|
|
595
|
-
if (high - low < 1e-4) {
|
|
596
|
-
break;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
return clippedCandidate;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// src/color/format.ts
|
|
603
|
-
var clamp012 = (v) => Math.min(1, Math.max(0, v));
|
|
604
|
-
var byte = (v) => Math.round(clamp012(v) * 255);
|
|
605
|
-
var hex2 = (n) => n.toString(16).padStart(2, "0");
|
|
606
|
-
var round2 = (n) => (Math.round(n * 100) / 100).toString();
|
|
607
|
-
function formatHex(c) {
|
|
608
|
-
const mapped = toSrgbGamut(c);
|
|
609
|
-
const head = `#${hex2(byte(mapped.r))}${hex2(byte(mapped.g))}${hex2(byte(mapped.b))}`;
|
|
610
|
-
const alpha = byte(mapped.a);
|
|
611
|
-
return alpha === 255 ? head : head + hex2(alpha);
|
|
612
|
-
}
|
|
613
|
-
function formatColor(c, format) {
|
|
614
|
-
switch (format) {
|
|
615
|
-
case "hex":
|
|
616
|
-
return formatHex(c);
|
|
617
|
-
case "rgb": {
|
|
618
|
-
const inGamut = toSrgbGamut(c);
|
|
619
|
-
const r = byte(inGamut.r);
|
|
620
|
-
const g = byte(inGamut.g);
|
|
621
|
-
const b = byte(inGamut.b);
|
|
622
|
-
return c.a < 1 ? `rgb(${r} ${g} ${b} / ${round2(c.a)})` : `rgb(${r} ${g} ${b})`;
|
|
623
|
-
}
|
|
624
|
-
case "hsl": {
|
|
625
|
-
const hsl = rgbToHsl(toSrgbGamut(c));
|
|
626
|
-
const h = (Math.round(hsl.h * 100) / 100).toString();
|
|
627
|
-
const s = (Math.round(hsl.s * 1e4) / 100).toString();
|
|
628
|
-
const l = (Math.round(hsl.l * 1e4) / 100).toString();
|
|
629
|
-
return c.a < 1 ? `hsl(${h} ${s}% ${l}% / ${round2(c.a)})` : `hsl(${h} ${s}% ${l}%)`;
|
|
630
|
-
}
|
|
631
|
-
case "oklch": {
|
|
632
|
-
const lch = oklabToOklch(rgbToOklab(c));
|
|
633
|
-
const l = (lch.l * 100).toFixed(2);
|
|
634
|
-
const ch = lch.c.toFixed(4);
|
|
635
|
-
const h = lch.h.toFixed(2);
|
|
636
|
-
return c.a < 1 ? `oklch(${l}% ${ch} ${h} / ${round2(c.a)})` : `oklch(${l}% ${ch} ${h})`;
|
|
637
|
-
}
|
|
638
|
-
case "oklab": {
|
|
639
|
-
const lab = rgbToOklab(c);
|
|
640
|
-
const l = (lab.l * 100).toFixed(2);
|
|
641
|
-
const a = lab.a.toFixed(4);
|
|
642
|
-
const b = lab.b.toFixed(4);
|
|
643
|
-
return c.a < 1 ? `oklab(${l}% ${a} ${b} / ${round2(c.a)})` : `oklab(${l}% ${a} ${b})`;
|
|
644
|
-
}
|
|
645
|
-
case "p3": {
|
|
646
|
-
const linSrgb = {
|
|
647
|
-
r: srgbToLinear(c.r),
|
|
648
|
-
g: srgbToLinear(c.g),
|
|
649
|
-
b: srgbToLinear(c.b),
|
|
650
|
-
a: c.a
|
|
651
|
-
};
|
|
652
|
-
const linP3 = linearSrgbToDisplayP3(linSrgb);
|
|
653
|
-
const r = linearToSrgb(linP3.r).toFixed(4);
|
|
654
|
-
const g = linearToSrgb(linP3.g).toFixed(4);
|
|
655
|
-
const b = linearToSrgb(linP3.b).toFixed(4);
|
|
656
|
-
return c.a < 1 ? `color(display-p3 ${r} ${g} ${b} / ${round2(c.a)})` : `color(display-p3 ${r} ${g} ${b})`;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
function normalizeColor(input) {
|
|
661
|
-
const parsed = parseColor(input);
|
|
662
|
-
return parsed ? formatHex(parsed) : null;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
554
|
// src/color/contrast.ts
|
|
666
555
|
var BLACK = { r: 0, g: 0, b: 0, a: 1 };
|
|
667
556
|
var WHITE = { r: 1, g: 1, b: 1, a: 1 };
|
|
@@ -720,32 +609,6 @@ function readableTextColor(background, candidates = [BLACK, WHITE]) {
|
|
|
720
609
|
return bestCandidate;
|
|
721
610
|
}
|
|
722
611
|
|
|
723
|
-
// src/color/suggest.ts
|
|
724
|
-
function suggestAccessibleForeground(foreground, background, options = {}) {
|
|
725
|
-
const large = _nullishCoalesce(options.large, () => ( false));
|
|
726
|
-
const lch = oklabToOklch(rgbToOklab(foreground));
|
|
727
|
-
const asHex = (l) => parseColor(formatHex(toSrgbGamut(oklabToRgb(oklchToOklab({ ...lch, l })))));
|
|
728
|
-
for (let d = 0.01; d <= 1; d += 0.01) {
|
|
729
|
-
const downCand = asHex(Math.max(0, lch.l - d));
|
|
730
|
-
const upCand = asHex(Math.min(1, lch.l + d));
|
|
731
|
-
const downRatio = contrastRatio(downCand, background);
|
|
732
|
-
const upRatio = contrastRatio(upCand, background);
|
|
733
|
-
const downPass = contrastLevel(downRatio, { large }) !== "fail";
|
|
734
|
-
const upPass = contrastLevel(upRatio, { large }) !== "fail";
|
|
735
|
-
if (downPass && upPass) return formatHex(downRatio >= upRatio ? downCand : upCand);
|
|
736
|
-
if (downPass) return formatHex(downCand);
|
|
737
|
-
if (upPass) return formatHex(upCand);
|
|
738
|
-
}
|
|
739
|
-
return void 0;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
612
|
|
|
750
613
|
|
|
751
614
|
|
|
@@ -766,4 +629,4 @@ function suggestAccessibleForeground(foreground, background, options = {}) {
|
|
|
766
629
|
|
|
767
630
|
|
|
768
631
|
|
|
769
|
-
exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.rgbToHsv = rgbToHsv; exports.hsvToRgb = hsvToRgb; exports.rgbToOklab = rgbToOklab; exports.oklabToRgb = oklabToRgb; exports.oklabToOklch = oklabToOklch; exports.oklchToOklab = oklchToOklab; exports.linearSrgbToDisplayP3 = linearSrgbToDisplayP3; exports.displayP3ToLinearSrgb = displayP3ToLinearSrgb; exports.NAMED_COLORS = NAMED_COLORS; exports.parseColor = parseColor; exports.isColor = isColor; exports.
|
|
632
|
+
exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.rgbToHsv = rgbToHsv; exports.hsvToRgb = hsvToRgb; exports.rgbToOklab = rgbToOklab; exports.oklabToRgb = oklabToRgb; exports.oklabToOklch = oklabToOklch; exports.oklchToOklab = oklchToOklab; exports.linearSrgbToDisplayP3 = linearSrgbToDisplayP3; exports.displayP3ToLinearSrgb = displayP3ToLinearSrgb; exports.NAMED_COLORS = NAMED_COLORS; exports.parseColor = parseColor; exports.isColor = isColor; exports.relativeLuminance = relativeLuminance; exports.contrastRatio = contrastRatio; exports.contrastLevel = contrastLevel; exports.readableTextColor = readableTextColor;
|
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
CHART_ORIENTATIONS,
|
|
14
14
|
CHART_RADAR_GRATICULES,
|
|
15
15
|
CHART_REFERENCE_AXES,
|
|
16
|
+
CHART_SANKEY_LINK_COLORS,
|
|
16
17
|
CHART_SERIES_TYPES,
|
|
17
18
|
CHART_STACKINGS,
|
|
18
19
|
CHART_TRENDLINE_TYPES,
|
|
19
20
|
CHART_TYPES
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FR432ROA.js";
|
|
21
22
|
|
|
22
23
|
// src/chart/schemas.ts
|
|
23
24
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -112,6 +113,14 @@ var TREE_NODE = {
|
|
|
112
113
|
};
|
|
113
114
|
var TREE_DEFS = { chartTreeNode: TREE_NODE };
|
|
114
115
|
var TREE_PATH = { type: "array", items: { type: "string" }, minItems: 1, description: 'Names from the top level down to the node, e.g. ["Europe", "France"] (from get_chart treeTable or spec.tree).' };
|
|
116
|
+
var LINK_PROPS = {
|
|
117
|
+
source: { type: "string", description: "Name of the node the flow leaves." },
|
|
118
|
+
target: { type: "string", description: "Name of the node it reaches (a different node; flows only go forwards, no loops)." },
|
|
119
|
+
value: { type: "number", exclusiveMinimum: 0, description: "How much flows, above 0 (its width)." },
|
|
120
|
+
color: { type: "string", description: "CSS colour (default: by sankeyLinkColor)." }
|
|
121
|
+
};
|
|
122
|
+
var RACE_TIME = { type: ["string", "number"], description: 'Time point label (a category, e.g. "2023") or index from 0; an index may be fractional, 2.5 being halfway between the third and fourth time points.' };
|
|
123
|
+
var LINK_INDEX = { type: "integer", minimum: 0, description: "Flow index (0 = first), as get_chart lists them in spec.links." };
|
|
115
124
|
var ERROR_BARS = (what) => ({
|
|
116
125
|
type: ["object", "null"],
|
|
117
126
|
description: `${what} null removes them.`,
|
|
@@ -149,7 +158,7 @@ var SERIES_PROPS = {
|
|
|
149
158
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
150
159
|
};
|
|
151
160
|
var CHART_UPDATE_PROPERTIES = {
|
|
152
|
-
type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups." },
|
|
161
|
+
type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups; sankey draws the flows (set_chart_links); barrace reads categories as time points and series as names, and animates their ranking." },
|
|
153
162
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
154
163
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
155
164
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -185,7 +194,10 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
185
194
|
parliamentArc: { type: "number", minimum: 90, maximum: 360, description: "Parliament: sweep of the hemicycle in degrees (default 180)." },
|
|
186
195
|
parliamentMajority: { type: ["integer", "null"], minimum: 1, description: "Parliament: seats needed for a majority, drawn as a dashed line (null: half of the seats plus one)." },
|
|
187
196
|
parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
|
|
188
|
-
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' }
|
|
197
|
+
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' },
|
|
198
|
+
sankeyLinkColor: { type: "string", enum: [...CHART_SANKEY_LINK_COLORS], description: "Sankey: colour each flow by its source node (default), its target node, or grey." },
|
|
199
|
+
raceTopN: { type: "integer", minimum: 1, maximum: 30, description: "Bar race: how many bars each moment shows (default 10)." },
|
|
200
|
+
sankeyNodes: { type: "array", items: { type: "string" }, description: "Sankey: node names in the order to stack them within their columns (reorder to untangle crossing flows); nodes left out follow in the order the flows name them." }
|
|
189
201
|
};
|
|
190
202
|
|
|
191
203
|
export {
|
|
@@ -202,6 +214,9 @@ export {
|
|
|
202
214
|
REFERENCE_INDEX,
|
|
203
215
|
TREE_DEFS,
|
|
204
216
|
TREE_PATH,
|
|
217
|
+
LINK_PROPS,
|
|
218
|
+
RACE_TIME,
|
|
219
|
+
LINK_INDEX,
|
|
205
220
|
SERIES_PROPS,
|
|
206
221
|
CHART_UPDATE_PROPERTIES
|
|
207
222
|
};
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkV5L2G22Rcjs = require('./chunk-V5L2G22R.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkUUUTEVX6cjs = require('./chunk-UUUTEVX6.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkBPX4Z3N3cjs = require('./chunk-BPX4Z3N3.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
@@ -1211,7 +1211,7 @@ var ChartNodeView = (_class = class {
|
|
|
1211
1211
|
this.dom.contentEditable = "false";
|
|
1212
1212
|
this.syncAttributes();
|
|
1213
1213
|
this.key = specKey(this.node.attrs.spec);
|
|
1214
|
-
this.controller = new (0,
|
|
1214
|
+
this.controller = new (0, _chunkV5L2G22Rcjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1215
1215
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1216
1216
|
if (!state.gesture) this.writeBack();
|
|
1217
1217
|
});
|
|
@@ -1444,7 +1444,7 @@ function readSpec(value) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
1447
|
-
return
|
|
1447
|
+
return _chunkBPX4Z3N3cjs.normalizeChartSpec.call(void 0, input).spec;
|
|
1448
1448
|
}
|
|
1449
1449
|
var readSize = (value) => {
|
|
1450
1450
|
const n = value === null ? NaN : Number(value);
|
|
@@ -1470,10 +1470,10 @@ function staticChartSvg(node, options) {
|
|
|
1470
1470
|
const spec = node.attrs.spec;
|
|
1471
1471
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1472
1472
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1473
|
-
const scene =
|
|
1474
|
-
return
|
|
1473
|
+
const scene = _chunkUUUTEVX6cjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1474
|
+
return _chunkV5L2G22Rcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1475
1475
|
ariaLabel: spec.title || "Chart",
|
|
1476
|
-
description:
|
|
1476
|
+
description: _chunkV5L2G22Rcjs.describeChart.call(void 0, spec),
|
|
1477
1477
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
@@ -1489,7 +1489,7 @@ var Chart = _core.Node.create({
|
|
|
1489
1489
|
return {
|
|
1490
1490
|
HTMLAttributes: {},
|
|
1491
1491
|
nodeView: null,
|
|
1492
|
-
theme:
|
|
1492
|
+
theme: _chunkBPX4Z3N3cjs.DEFAULT_CHART_THEME,
|
|
1493
1493
|
defaultWidth: 640,
|
|
1494
1494
|
defaultHeight: 320,
|
|
1495
1495
|
generateId: () => generateStructureId("chart")
|
|
@@ -1503,7 +1503,7 @@ var Chart = _core.Node.create({
|
|
|
1503
1503
|
renderHTML: (attributes) => attributes.id ? { "data-chart-id": attributes.id } : {}
|
|
1504
1504
|
},
|
|
1505
1505
|
spec: {
|
|
1506
|
-
default:
|
|
1506
|
+
default: _chunkBPX4Z3N3cjs.normalizeChartSpec.call(void 0, {}).spec,
|
|
1507
1507
|
// null (no `data-chart`) keeps what the parse rule found, e.g. a mermaid block's spec.
|
|
1508
1508
|
parseHTML: (element) => readSpec(element.getAttribute("data-chart")),
|
|
1509
1509
|
renderHTML: (attributes) => ({
|
|
@@ -1541,7 +1541,7 @@ var Chart = _core.Node.create({
|
|
|
1541
1541
|
const code = element.querySelector("code");
|
|
1542
1542
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _34 => _34.getAttribute, 'call', _35 => _35("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1543
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
|
-
const result =
|
|
1544
|
+
const result = _chunkV5L2G22Rcjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1545
|
return result.family ? { spec: result.spec } : false;
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1565,7 +1565,7 @@ var Chart = _core.Node.create({
|
|
|
1565
1565
|
return {
|
|
1566
1566
|
markdown: {
|
|
1567
1567
|
serialize(state, node) {
|
|
1568
|
-
const text =
|
|
1568
|
+
const text = _chunkV5L2G22Rcjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1569
1569
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1570
1570
|
state.write(`${fence}mermaid
|
|
1571
1571
|
`);
|
|
@@ -1587,7 +1587,7 @@ var Chart = _core.Node.create({
|
|
|
1587
1587
|
type: this.name,
|
|
1588
1588
|
attrs: {
|
|
1589
1589
|
id: _nullishCoalesce(options.id, () => ( this.options.generateId())),
|
|
1590
|
-
spec:
|
|
1590
|
+
spec: _chunkBPX4Z3N3cjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {}))).spec,
|
|
1591
1591
|
width: _nullishCoalesce(options.width, () => ( null)),
|
|
1592
1592
|
height: _nullishCoalesce(options.height, () => ( this.options.defaultHeight))
|
|
1593
1593
|
}
|
|
@@ -1598,7 +1598,7 @@ var Chart = _core.Node.create({
|
|
|
1598
1598
|
if (dispatch) {
|
|
1599
1599
|
tr.setNodeMarkup(chart.pos, void 0, {
|
|
1600
1600
|
...chart.node.attrs,
|
|
1601
|
-
...changes.spec !== void 0 ? { spec:
|
|
1601
|
+
...changes.spec !== void 0 ? { spec: _chunkBPX4Z3N3cjs.normalizeChartSpec.call(void 0, changes.spec).spec } : {},
|
|
1602
1602
|
...changes.width !== void 0 ? { width: changes.width } : {},
|
|
1603
1603
|
...changes.height !== void 0 ? { height: changes.height } : {}
|
|
1604
1604
|
});
|
|
@@ -1705,14 +1705,14 @@ var Sparkline = _core.Node.create({
|
|
|
1705
1705
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1706
1706
|
},
|
|
1707
1707
|
renderHTML({ node, HTMLAttributes }) {
|
|
1708
|
-
const scene =
|
|
1708
|
+
const scene = _chunkV5L2G22Rcjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1709
1709
|
kind: node.attrs.kind,
|
|
1710
1710
|
width: node.attrs.width,
|
|
1711
1711
|
height: node.attrs.height,
|
|
1712
1712
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1713
1713
|
negativeColor: this.options.negativeColor
|
|
1714
1714
|
});
|
|
1715
|
-
const svg =
|
|
1715
|
+
const svg = _chunkV5L2G22Rcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1716
1716
|
ariaLabel: sparklineLabel(node),
|
|
1717
1717
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1718
1718
|
});
|