reactive-md 0.5.3 → 0.6.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/CHANGELOG-ch.md +45 -24
- package/CHANGELOG.md +45 -24
- package/CONTRIBUTING-ch.md +10 -5
- package/CONTRIBUTING.md +10 -5
- package/README-ch.md +38 -36
- package/README-en.md +45 -42
- package/README.md +45 -42
- package/SECURITY-ch.md +1 -1
- package/SECURITY.md +1 -1
- package/THIRD_PARTY_NOTICES.md +481 -1
- package/dist-library/{authoring-DJJjKYg9.js → authoring-DSC0VsNK.js} +58 -58
- package/dist-library/{compiler-UyPwGzJZ.js → compiler-CRD88BMt.js} +6218 -3363
- package/dist-library/react-Dk94rcOp.js +59658 -0
- package/dist-library/reactive-md-authoring.js +2 -2
- package/dist-library/reactive-md-editor.js +13 -0
- package/dist-library/reactive-md-react-unstyled.js +1 -1
- package/dist-library/reactive-md-react.js +1 -1
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +123 -123
- package/dist-library/{runtime-DXtle_6c.js → runtime-D8KbnCd0.js} +151 -151
- package/dist-library/types/editor/types.d.ts +2 -0
- package/dist-library/types/local/code-block.d.ts +3 -1
- package/dist-library/types/local/code-languages.d.ts +7 -0
- package/dist-library/types/local/compiled-data.d.ts +6 -0
- package/dist-library/types/local/compiler.d.ts +1 -0
- package/dist-library/types/local/diagnostics.d.ts +31 -0
- package/dist-library/types/local/diagram-layout.d.ts +69 -0
- package/dist-library/types/local/html-names.d.ts +6 -0
- package/dist-library/types/local/html-table.d.ts +25 -0
- package/dist-library/types/local/math-display.d.ts +1 -0
- package/dist-library/types/local/table-surface.d.ts +10 -0
- package/dist-library/types/local/types.d.ts +2 -0
- package/dist-library/types/local/visuals.d.ts +9 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +75 -51
- package/docs/README.md +84 -0
- package/docs/{compatibility-ch.md → compatibility/compatibility-ch.md} +28 -18
- package/docs/{compatibility-en.md → compatibility/compatibility-en.md} +28 -18
- package/docs/{source-versioning-ch.md → compatibility/source-versioning-ch.md} +2 -2
- package/docs/{source-versioning-en.md → compatibility/source-versioning-en.md} +2 -2
- package/docs/{component-development-ch.md → development/component-development-ch.md} +7 -7
- package/docs/{component-development-en.md → development/component-development-en.md} +7 -7
- package/docs/{component-protocol-ch.md → development/component-protocol-ch.md} +17 -17
- package/docs/{component-protocol-en.md → development/component-protocol-en.md} +17 -17
- package/docs/{performance-ch.md → development/performance-ch.md} +2 -2
- package/docs/{performance-en.md → development/performance-en.md} +2 -2
- package/docs/{releasing-ch.md → development/releasing-ch.md} +12 -12
- package/docs/{releasing-en.md → development/releasing-en.md} +12 -12
- package/docs/guides/local-guide-ch.md +513 -0
- package/docs/guides/local-guide-en.md +513 -0
- package/docs/{author-tools-ch.md → integration/author-tools-ch.md} +8 -8
- package/docs/{author-tools-en.md → integration/author-tools-en.md} +8 -8
- package/docs/{editor-ch.md → integration/editor-ch.md} +7 -6
- package/docs/{editor-en.md → integration/editor-en.md} +7 -6
- package/docs/{local-integration-ch.md → integration/local-integration-ch.md} +33 -15
- package/docs/{local-integration-en.md → integration/local-integration-en.md} +33 -15
- package/docs/{shareable-export-ch.md → integration/shareable-export-ch.md} +16 -4
- package/docs/{shareable-export-en.md → integration/shareable-export-en.md} +16 -4
- package/docs/{computations-formatting-ch.md → reference/computations-formatting-ch.md} +2 -2
- package/docs/{computations-formatting-en.md → reference/computations-formatting-en.md} +2 -2
- package/docs/{constraints-collections-ch.md → reference/constraints-collections-ch.md} +2 -2
- package/docs/{constraints-collections-en.md → reference/constraints-collections-en.md} +2 -2
- package/docs/{diagnostics-counting-ch.md → reference/diagnostics-counting-ch.md} +22 -2
- package/docs/{diagnostics-counting-en.md → reference/diagnostics-counting-en.md} +22 -2
- package/docs/{html-compatibility-ch.md → reference/html-compatibility-ch.md} +42 -4
- package/docs/{html-compatibility-en.md → reference/html-compatibility-en.md} +42 -4
- package/docs/{local-components-v2-ch.md → reference/local-components-v2-ch.md} +2 -2
- package/docs/{local-components-v2-en.md → reference/local-components-v2-en.md} +2 -2
- package/docs/{local-interaction-syntax-ch.md → reference/local-interaction-syntax-ch.md} +26 -7
- package/docs/{local-interaction-syntax-en.md → reference/local-interaction-syntax-en.md} +26 -7
- package/docs/{theme-protocol-ch.md → reference/theme-protocol-ch.md} +1 -1
- package/docs/{theme-protocol-en.md → reference/theme-protocol-en.md} +1 -1
- package/docs/{release-0.4.0-ch.md → releases/release-0.4.0-ch.md} +6 -6
- package/docs/{release-0.4.0-en.md → releases/release-0.4.0-en.md} +6 -6
- package/docs/{release-0.4.1-ch.md → releases/release-0.4.1-ch.md} +2 -2
- package/docs/{release-0.4.1-en.md → releases/release-0.4.1-en.md} +2 -2
- package/docs/{release-0.5.0-ch.md → releases/release-0.5.0-ch.md} +4 -4
- package/docs/{release-0.5.0-en.md → releases/release-0.5.0-en.md} +4 -4
- package/docs/{release-0.5.1-ch.md → releases/release-0.5.1-ch.md} +4 -4
- package/docs/{release-0.5.1-en.md → releases/release-0.5.1-en.md} +4 -4
- package/docs/{release-0.5.2-ch.md → releases/release-0.5.2-ch.md} +3 -3
- package/docs/{release-0.5.2-en.md → releases/release-0.5.2-en.md} +3 -3
- package/docs/{release-0.5.3-ch.md → releases/release-0.5.3-ch.md} +1 -1
- package/docs/{release-0.5.3-en.md → releases/release-0.5.3-en.md} +1 -1
- package/docs/releases/release-0.6.0-ch.md +57 -0
- package/docs/releases/release-0.6.0-en.md +57 -0
- package/examples/conformance/README.md +4 -4
- package/examples/integration/README.md +10 -8
- package/examples/integration/worker/package.json +1 -1
- package/examples/local/README.md +5 -5
- package/examples/local/html-compat.reactive.md +19 -0
- package/package.json +9 -2
- package/dist-library/react-fizgU3i8.js +0 -12764
- package/docs/local-guide-ch.md +0 -967
- package/docs/local-guide-en.md +0 -967
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as oe, n as se, r as ce, t as le } from "./authoring-
|
|
3
|
-
import { t as ue } from "./runtime-
|
|
1
|
+
import { F as e, J as t, K as n, M as r, N as i, P as a, Y as o, Z as s, _ as c, at as l, b as u, ct as d, d as f, f as p, ft as m, it as h, lt as g, m as _, n as ee, nt as v, ot as y, p as b, r as te, rt as ne, st as re, t as x, v as ie, y as ae } from "./compiler-CRD88BMt.js";
|
|
2
|
+
import { i as oe, n as se, r as ce, t as le } from "./authoring-DSC0VsNK.js";
|
|
3
|
+
import { t as ue } from "./runtime-D8KbnCd0.js";
|
|
4
4
|
// src/local/source-migration.ts
|
|
5
5
|
var de = /* @__PURE__ */ new Set([
|
|
6
6
|
"sum",
|
|
@@ -36,7 +36,7 @@ var de = /* @__PURE__ */ new Set([
|
|
|
36
36
|
"validation",
|
|
37
37
|
"data-table",
|
|
38
38
|
"column"
|
|
39
|
-
]), pe = `<!-- reactive-md: ${
|
|
39
|
+
]), pe = `<!-- reactive-md: ${r} -->`;
|
|
40
40
|
function me(e) {
|
|
41
41
|
let t = e.diagnostics.filter((t) => t.code.startsWith("local.version.") || t.code === "local.budget" || t.code === "local.parse" && !e.nodes.length), n = e.versionDeclaration?.version ?? null;
|
|
42
42
|
return {
|
|
@@ -48,15 +48,15 @@ function me(e) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
function he(e) {
|
|
51
|
-
return me(
|
|
51
|
+
return me(f(e));
|
|
52
52
|
}
|
|
53
53
|
function ge(e, t, n, r, i = "error") {
|
|
54
|
-
let a =
|
|
54
|
+
let a = re(t, r), o = e.slice(0, n.start), s = o.lastIndexOf("\n");
|
|
55
55
|
return {
|
|
56
56
|
code: t,
|
|
57
57
|
severity: i,
|
|
58
58
|
range: { ...n },
|
|
59
|
-
message:
|
|
59
|
+
message: h(a),
|
|
60
60
|
line: o.split("\n").length,
|
|
61
61
|
column: n.start - s,
|
|
62
62
|
messageKey: a.key,
|
|
@@ -64,42 +64,42 @@ function ge(e, t, n, r, i = "error") {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function S(e, t = {}) {
|
|
67
|
-
let n =
|
|
67
|
+
let n = f(e), i = me(n), a = typeof t == "object" && !!t && !Array.isArray(t), o = a ? t.fromVersion ?? i.effectiveVersion : i.effectiveVersion, s = typeof o == "string" ? o : "", c = {
|
|
68
68
|
ok: !1,
|
|
69
|
-
fromVersion:
|
|
70
|
-
toVersion:
|
|
71
|
-
needsMigration: !n.versionDeclaration ||
|
|
72
|
-
diagnostics:
|
|
73
|
-
},
|
|
74
|
-
report:
|
|
69
|
+
fromVersion: s,
|
|
70
|
+
toVersion: r,
|
|
71
|
+
needsMigration: !n.versionDeclaration || s !== "local-draft-2",
|
|
72
|
+
diagnostics: i.diagnostics.filter((e) => e.code !== "local.version.unsupported")
|
|
73
|
+
}, l = {
|
|
74
|
+
report: c,
|
|
75
75
|
declaration: n.versionDeclaration
|
|
76
76
|
};
|
|
77
|
-
if (typeof e != "string" ||
|
|
78
|
-
let
|
|
77
|
+
if (typeof e != "string" || c.diagnostics.some((e) => e.severity === "error")) return l;
|
|
78
|
+
let u = i.range ?? {
|
|
79
79
|
start: 0,
|
|
80
80
|
end: 0
|
|
81
81
|
}, d = (e) => {
|
|
82
|
-
if (
|
|
82
|
+
if (c.diagnostics.length >= 100) {
|
|
83
83
|
if (e.severity === "warning") return;
|
|
84
|
-
let t =
|
|
85
|
-
for (; t >= 0 &&
|
|
84
|
+
let t = c.diagnostics.length - 1;
|
|
85
|
+
for (; t >= 0 && c.diagnostics[t].severity !== "warning";) --t;
|
|
86
86
|
if (t < 0) return;
|
|
87
|
-
|
|
87
|
+
c.diagnostics.splice(t, 1);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
},
|
|
89
|
+
c.diagnostics.push(e);
|
|
90
|
+
}, p = (t, n, r, i) => {
|
|
91
91
|
d(ge(e, t, n, r, i));
|
|
92
92
|
};
|
|
93
|
-
if (!
|
|
94
|
-
from:
|
|
93
|
+
if (!a || typeof o != "string" || !["local-draft-1", "local-draft-2"].includes(s) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && i.declaredVersion !== null && s !== i.declaredVersion) return p("local.upgrade.from-version", u, {
|
|
94
|
+
from: s,
|
|
95
95
|
detail: "use local-draft-1 or local-draft-2 and match the source declaration"
|
|
96
|
-
}),
|
|
97
|
-
let
|
|
98
|
-
if (
|
|
96
|
+
}), l;
|
|
97
|
+
let m = n.versionDeclaration ? e.slice(0, u.start) + e.slice(u.start, u.end).replace(/[^\r\n]/g, " ") + e.slice(u.end) : e, h = n.versionDeclaration ? f(m) : n;
|
|
98
|
+
if (s === "local-draft-1") {
|
|
99
99
|
let e = (n) => {
|
|
100
100
|
for (let r of n) {
|
|
101
101
|
if (r.name && fe.has(r.name)) {
|
|
102
|
-
|
|
102
|
+
p("local.upgrade.tag", r.range, { name: r.name });
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
105
|
for (let e of [
|
|
@@ -110,26 +110,26 @@ function S(e, t = {}) {
|
|
|
110
110
|
"bind-y"
|
|
111
111
|
]) {
|
|
112
112
|
let t = r.attrs?.[e];
|
|
113
|
-
t && de.has(t) &&
|
|
113
|
+
t && de.has(t) && p("local.upgrade.reserved-binding", r.range, { name: t });
|
|
114
114
|
}
|
|
115
|
-
(r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) &&
|
|
115
|
+
(r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) && p("local.upgrade.text-length", r.range, void 0, t.allowSemanticChanges ? "warning" : "error");
|
|
116
116
|
let n = [...r.type === "interpolation" ? [r.value ?? ""] : [], ...Object.values(r.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
|
|
117
117
|
for (let e of n) {
|
|
118
118
|
let t = e.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
|
|
119
|
-
(t.includes("[") || [...de].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) &&
|
|
119
|
+
(t.includes("[") || [...de].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) && p("local.upgrade.expression", r.range);
|
|
120
120
|
}
|
|
121
121
|
r.type !== "fallback" && r.children && e(r.children);
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
-
e(
|
|
124
|
+
e(h.nodes);
|
|
125
125
|
}
|
|
126
|
-
if (
|
|
127
|
-
let g = x(
|
|
126
|
+
if (c.diagnostics.some((e) => e.severity === "error")) return l;
|
|
127
|
+
let g = x(m);
|
|
128
128
|
for (let e of g.diagnostics) d(e);
|
|
129
|
-
return g.ok && (!n.versionDeclaration &&
|
|
129
|
+
return g.ok && (!n.versionDeclaration && c.diagnostics.length < 100 && p("local.upgrade.version-missing", {
|
|
130
130
|
start: +(e.charCodeAt(0) === 65279),
|
|
131
131
|
end: +(e.charCodeAt(0) === 65279)
|
|
132
|
-
}, { version:
|
|
132
|
+
}, { version: r }, "warning"), c.ok = !0), l;
|
|
133
133
|
}
|
|
134
134
|
function _e(e, t) {
|
|
135
135
|
return S(e, t).report;
|
|
@@ -167,7 +167,7 @@ var C = "reactive-md-state/v1", w = 1048576, ye = /^fnv1a32:[0-9a-f]{8}$/, be =
|
|
|
167
167
|
function E(e, t) {
|
|
168
168
|
return {
|
|
169
169
|
code: e,
|
|
170
|
-
message: t.length > 2e3 ? `${t.slice(0,
|
|
170
|
+
message: t.length > 2e3 ? `${t.slice(0, m - 1)}…` : t,
|
|
171
171
|
severity: "error",
|
|
172
172
|
range: {
|
|
173
173
|
start: 0,
|
|
@@ -292,33 +292,33 @@ function Te(e) {
|
|
|
292
292
|
function L(e, t, n) {
|
|
293
293
|
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
294
294
|
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
295
|
-
let
|
|
295
|
+
let i = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), a = new Set(i), o = /* @__PURE__ */ new Map();
|
|
296
296
|
for (let n of Object.keys(t)) {
|
|
297
297
|
if (Object.hasOwn(e.computations ?? {}, n)) continue;
|
|
298
298
|
if (n.startsWith("@")) {
|
|
299
299
|
if (!Object.hasOwn(e.bindings, n)) throw Error(`Cannot persist parameter "${n}": it is not a binding of this document.`);
|
|
300
300
|
continue;
|
|
301
301
|
}
|
|
302
|
-
if (!
|
|
302
|
+
if (!a.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
|
|
303
303
|
let r = j(t[n]);
|
|
304
304
|
if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
|
|
305
|
-
|
|
305
|
+
o.set(n, r.value);
|
|
306
306
|
}
|
|
307
|
-
let
|
|
308
|
-
for (let e of
|
|
309
|
-
if (!
|
|
310
|
-
|
|
307
|
+
let s = {};
|
|
308
|
+
for (let e of i) {
|
|
309
|
+
if (!o.has(e)) throw Error(`Cannot persist the document: parameter "${e}" is missing from the supplied state.`);
|
|
310
|
+
s[e] = o.get(e);
|
|
311
311
|
}
|
|
312
|
-
let
|
|
312
|
+
let c = {
|
|
313
313
|
format: C,
|
|
314
|
-
syntax:
|
|
314
|
+
syntax: r,
|
|
315
315
|
sourceDigest: A(e.source),
|
|
316
|
-
parameters:
|
|
316
|
+
parameters: s
|
|
317
317
|
};
|
|
318
|
-
return n !== void 0 && (
|
|
318
|
+
return n !== void 0 && (c.generator = P(n)), N(c);
|
|
319
319
|
}
|
|
320
320
|
function Ee(e, t) {
|
|
321
|
-
let n = [],
|
|
321
|
+
let n = [], i = (e, t) => D(n, e, t), a = e;
|
|
322
322
|
if (typeof e == "string") {
|
|
323
323
|
if (I(e, t) > t) return {
|
|
324
324
|
ok: !1,
|
|
@@ -329,7 +329,7 @@ function Ee(e, t) {
|
|
|
329
329
|
diagnostics: [E("local.state.utf", "The state payload contains malformed Unicode.")]
|
|
330
330
|
};
|
|
331
331
|
try {
|
|
332
|
-
|
|
332
|
+
a = JSON.parse(e);
|
|
333
333
|
} catch (e) {
|
|
334
334
|
return {
|
|
335
335
|
ok: !1,
|
|
@@ -347,39 +347,39 @@ function Ee(e, t) {
|
|
|
347
347
|
diagnostics: [E("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
|
-
if (!M(
|
|
350
|
+
if (!M(a)) return {
|
|
351
351
|
ok: !1,
|
|
352
352
|
diagnostics: [E("local.state.shape", "The state payload must be a JSON object.")]
|
|
353
353
|
};
|
|
354
|
-
Object.getOwnPropertySymbols(
|
|
355
|
-
for (let e of Object.keys(
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
let
|
|
359
|
-
|
|
360
|
-
let
|
|
361
|
-
typeof
|
|
362
|
-
let
|
|
363
|
-
if (!M(
|
|
364
|
-
else for (let e of Object.keys(
|
|
354
|
+
Object.getOwnPropertySymbols(a).length > 0 && i("local.state.shape", "The state payload cannot use symbol keys.");
|
|
355
|
+
for (let e of Object.keys(a)) Se.has(e) || i("local.state.key", `Unknown top-level state key "${e}".`);
|
|
356
|
+
let o = a.format;
|
|
357
|
+
o !== "reactive-md-state/v1" && i("local.state.format", `Unsupported state format ${F(o)}; expected "${C}".`);
|
|
358
|
+
let s = a.syntax;
|
|
359
|
+
s !== "local-draft-2" && i("local.state.syntax", `Unsupported state syntax ${F(s)}; expected "${r}".`);
|
|
360
|
+
let c = a.sourceDigest;
|
|
361
|
+
typeof c == "string" && ye.test(c) || i("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
362
|
+
let l = {}, u = a.parameters;
|
|
363
|
+
if (!M(u)) i("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
364
|
+
else for (let e of Object.keys(u).sort()) {
|
|
365
365
|
if (e === "__proto__") {
|
|
366
|
-
|
|
366
|
+
i("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
|
|
367
367
|
continue;
|
|
368
368
|
}
|
|
369
369
|
if (e.startsWith("@")) {
|
|
370
|
-
|
|
370
|
+
i("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
|
|
371
371
|
continue;
|
|
372
372
|
}
|
|
373
|
-
let t = j(
|
|
374
|
-
t.ok ?
|
|
373
|
+
let t = j(u[e]);
|
|
374
|
+
t.ok ? l[e] = t.value : i("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
|
|
375
375
|
}
|
|
376
|
-
let
|
|
377
|
-
if (Object.hasOwn(
|
|
378
|
-
let e =
|
|
379
|
-
if (!M(e))
|
|
376
|
+
let d;
|
|
377
|
+
if (Object.hasOwn(a, "generator")) {
|
|
378
|
+
let e = a.generator;
|
|
379
|
+
if (!M(e)) i("local.state.generator", "generator must be an object with string name and version.");
|
|
380
380
|
else {
|
|
381
|
-
for (let t of Object.keys(e)) Ce.has(t) ||
|
|
382
|
-
typeof e.name != "string" || typeof e.version != "string" ?
|
|
381
|
+
for (let t of Object.keys(e)) Ce.has(t) || i("local.state.generator", `generator has unknown key "${t}".`);
|
|
382
|
+
typeof e.name != "string" || typeof e.version != "string" ? i("local.state.generator", "generator must have string name and version.") : !k(e.name) || !k(e.version) ? i("local.state.utf", "generator contains malformed Unicode.") : d = Object.freeze({
|
|
383
383
|
name: e.name,
|
|
384
384
|
version: e.version
|
|
385
385
|
});
|
|
@@ -389,15 +389,15 @@ function Ee(e, t) {
|
|
|
389
389
|
ok: !1,
|
|
390
390
|
diagnostics: n
|
|
391
391
|
};
|
|
392
|
-
let
|
|
392
|
+
let f = {
|
|
393
393
|
format: C,
|
|
394
|
-
syntax:
|
|
395
|
-
sourceDigest:
|
|
396
|
-
parameters:
|
|
394
|
+
syntax: r,
|
|
395
|
+
sourceDigest: c,
|
|
396
|
+
parameters: l
|
|
397
397
|
};
|
|
398
|
-
return
|
|
398
|
+
return d && (f.generator = d), {
|
|
399
399
|
ok: !0,
|
|
400
|
-
file: N(
|
|
400
|
+
file: N(f)
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
function R(e, t) {
|
|
@@ -478,31 +478,31 @@ function Oe(e, t) {
|
|
|
478
478
|
}
|
|
479
479
|
return Object.freeze(r);
|
|
480
480
|
}
|
|
481
|
-
function V(e, t, n,
|
|
482
|
-
let
|
|
483
|
-
if (!
|
|
481
|
+
function V(e, t, n, i) {
|
|
482
|
+
let a = R(t, i);
|
|
483
|
+
if (!a.ok) return a;
|
|
484
484
|
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
485
485
|
ok: !1,
|
|
486
486
|
diagnostics: [E("local.state.document", "resolveLocalState requires a compiled local document.")]
|
|
487
487
|
};
|
|
488
|
-
if (
|
|
488
|
+
if (a.file.syntax !== "local-draft-2") return {
|
|
489
489
|
ok: !1,
|
|
490
|
-
diagnostics: [E("local.state.syntax", `This state file uses syntax "${
|
|
490
|
+
diagnostics: [E("local.state.syntax", `This state file uses syntax "${a.file.syntax}", but this build accepts "${r}".`)]
|
|
491
491
|
};
|
|
492
|
-
if (
|
|
492
|
+
if (a.file.sourceDigest !== A(e.source)) return {
|
|
493
493
|
ok: !1,
|
|
494
494
|
diagnostics: [E("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
495
495
|
};
|
|
496
|
-
let
|
|
497
|
-
for (let e of Object.keys(
|
|
498
|
-
for (let e of
|
|
499
|
-
if (
|
|
496
|
+
let o = z(e), s = new Set(o.plans.map((e) => e.key)), c = [];
|
|
497
|
+
for (let e of Object.keys(a.file.parameters)) s.has(e) || D(c, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
498
|
+
for (let e of s) Object.hasOwn(a.file.parameters, e) || D(c, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
499
|
+
if (c.length) return {
|
|
500
500
|
ok: !1,
|
|
501
|
-
diagnostics:
|
|
501
|
+
diagnostics: c
|
|
502
502
|
};
|
|
503
|
-
let
|
|
503
|
+
let l;
|
|
504
504
|
try {
|
|
505
|
-
|
|
505
|
+
l = ue(e);
|
|
506
506
|
} catch (e) {
|
|
507
507
|
return {
|
|
508
508
|
ok: !1,
|
|
@@ -511,25 +511,25 @@ function V(e, t, n, r) {
|
|
|
511
511
|
}
|
|
512
512
|
try {
|
|
513
513
|
if (n) {
|
|
514
|
-
let e = B(
|
|
514
|
+
let e = B(l, o, n);
|
|
515
515
|
if (e.length) return {
|
|
516
516
|
ok: !1,
|
|
517
517
|
diagnostics: e
|
|
518
518
|
};
|
|
519
519
|
}
|
|
520
|
-
let e = B(
|
|
520
|
+
let e = B(l, o, a.file.parameters);
|
|
521
521
|
if (e.length) return {
|
|
522
522
|
ok: !1,
|
|
523
523
|
diagnostics: e
|
|
524
524
|
};
|
|
525
|
-
let t = [...
|
|
525
|
+
let t = [...s].sort();
|
|
526
526
|
return {
|
|
527
527
|
ok: !0,
|
|
528
|
-
file:
|
|
529
|
-
state: Oe(
|
|
528
|
+
file: a.file,
|
|
529
|
+
state: Oe(l, t)
|
|
530
530
|
};
|
|
531
531
|
} finally {
|
|
532
|
-
|
|
532
|
+
l.dispose();
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
function H(e, t, n) {
|
|
@@ -695,7 +695,7 @@ function Be(e) {
|
|
|
695
695
|
if (e !== void 0) try {
|
|
696
696
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
697
697
|
let t = e, n = {};
|
|
698
|
-
for (let e of
|
|
698
|
+
for (let e of p) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
699
699
|
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "limits")) {
|
|
700
700
|
let e = t.limits;
|
|
701
701
|
n.limits = e && typeof e == "object" && !Array.isArray(e) && Object.hasOwn(e, "maxSyntaxNodes") ? { maxSyntaxNodes: e.maxSyntaxNodes } : e;
|
|
@@ -970,49 +970,49 @@ function rt(e) {
|
|
|
970
970
|
limits: { maxSyntaxNodes: t.maxSyntaxNodes }
|
|
971
971
|
} : n;
|
|
972
972
|
}
|
|
973
|
-
function it(
|
|
974
|
-
let
|
|
975
|
-
for (let
|
|
976
|
-
if (
|
|
977
|
-
let
|
|
978
|
-
if (
|
|
979
|
-
it(
|
|
973
|
+
function it(t) {
|
|
974
|
+
let n = [];
|
|
975
|
+
for (let r of t.childNodes) {
|
|
976
|
+
if (e.isElementNode(r)) {
|
|
977
|
+
let t = r.tagName.toLowerCase();
|
|
978
|
+
if (t === "script") continue;
|
|
979
|
+
it(t === "template" ? e.getTemplateContent(r) : r);
|
|
980
980
|
}
|
|
981
|
-
|
|
981
|
+
n.push(r);
|
|
982
982
|
}
|
|
983
|
-
|
|
983
|
+
t.childNodes = n;
|
|
984
984
|
}
|
|
985
|
-
function $(
|
|
986
|
-
let
|
|
987
|
-
for (let
|
|
988
|
-
if (
|
|
989
|
-
let e =
|
|
985
|
+
function $(t, n, r) {
|
|
986
|
+
let i = !1;
|
|
987
|
+
for (let a of t.childNodes) if (e.isElementNode(a)) {
|
|
988
|
+
if (a.tagName.toLowerCase() === "iframe") {
|
|
989
|
+
let e = a.attrs.filter((e) => {
|
|
990
990
|
let t = e.name.toLowerCase();
|
|
991
991
|
return t !== "srcdoc" && t !== "sandbox";
|
|
992
992
|
});
|
|
993
993
|
e.push({
|
|
994
994
|
name: "srcdoc",
|
|
995
|
-
value:
|
|
995
|
+
value: n
|
|
996
996
|
}), e.push({
|
|
997
997
|
name: "sandbox",
|
|
998
|
-
value:
|
|
999
|
-
}),
|
|
998
|
+
value: r
|
|
999
|
+
}), a.attrs = e, i = !0;
|
|
1000
1000
|
}
|
|
1001
|
-
$(
|
|
1001
|
+
$(a, n, r) && (i = !0);
|
|
1002
1002
|
}
|
|
1003
|
-
return
|
|
1003
|
+
return i;
|
|
1004
1004
|
}
|
|
1005
1005
|
function at(e) {
|
|
1006
1006
|
let t = "";
|
|
1007
|
-
for (let n of e.childNodes) t +=
|
|
1007
|
+
for (let n of e.childNodes) t += a(n, { scriptingEnabled: !1 });
|
|
1008
1008
|
return t;
|
|
1009
1009
|
}
|
|
1010
|
-
function ot(e,
|
|
1010
|
+
function ot(e, t, n) {
|
|
1011
1011
|
try {
|
|
1012
|
-
let
|
|
1013
|
-
if (it(
|
|
1012
|
+
let r = i(e, { scriptingEnabled: !1 });
|
|
1013
|
+
if (it(r), $(r, t, n)) return at(r);
|
|
1014
1014
|
} catch {}
|
|
1015
|
-
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${X(
|
|
1015
|
+
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${X(n, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${X(t, !0)}"></iframe></div>`;
|
|
1016
1016
|
}
|
|
1017
1017
|
function st(e, t) {
|
|
1018
1018
|
let n = t?.enableExtendedHtml === !0, r = t ? `frame-src about:${n ? " data: blob: http: https:" : ""}` : "frame-src 'none'", i = n ? "base-uri 'self' http: https:" : "base-uri 'none'", a = n ? "form-action http: https:" : "form-action 'none'";
|
|
@@ -1114,4 +1114,4 @@ ${y}
|
|
|
1114
1114
|
</html>
|
|
1115
1115
|
`;
|
|
1116
1116
|
}
|
|
1117
|
-
export {
|
|
1117
|
+
export { c as DEFAULT_LOCAL_THEME, Re as LOCAL_COMPILE_DELAY_MS, ne as LOCAL_DIAGNOSTIC_CODES, C as LOCAL_STATE_FORMAT, r as LOCAL_SYNTAX_VERSION, ie as LOCAL_THEME_PROTOCOL, Ue as LocalCompileScheduler, o as LocalExpressionError, Ke as SHAREABLE_HTML_FORMAT, le as analyzeLocalSource, U as applyLocalState, Le as applyLocalStateRetention, _e as checkLocalUpgrade, s as compileExpression, Y as compileFailureDiagnostic, n as compileLatex, x as compileLocal, se as completeLocalSource, v as countLocalCodePoints, ue as createLocalRuntime, L as createLocalStateFile, dt as createShareableHtml, ke as exportLocalState, l as formatLocalDiagnostic, ce as formatLocalSource, Ae as importLocalState, he as inspectLocalSourceVersion, y as isLocalDiagnosticCode, ae as isLocalThemeName, b as localCompileOptionsKey, d as localDiagnosticTemplate, g as localDiagnosticTemplateKeys, A as localSourceDigest, ve as migrateLocalSource, R as parseLocalState, Fe as planLocalStateRetention, oe as renameLocalBinding, H as resolveLocalState, lt as resolveLocalStateBaseline, u as resolveLocalTheme, t as samplePlot, nt as serializeForScript, je as serializeLocalState, Ge as startLocalCompileWorker };
|