reactive-md 0.4.0 → 0.5.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 +33 -1
- package/CHANGELOG.md +33 -1
- package/README-ch.md +36 -6
- package/README-en.md +37 -7
- package/README.md +37 -7
- package/THIRD_PARTY_NOTICES.md +94 -1
- package/dist-library/reactive-md-editor.css +2 -0
- package/dist-library/reactive-md-editor.js +3710 -0
- package/dist-library/reactive-md-react.js +9179 -1606
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +98 -97
- package/dist-library/{runtime-DtjdPXxJ.js → runtime-DPuMxM_y.js} +1856 -1461
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
- package/dist-library/types/editor/editor-commands.d.ts +50 -0
- package/dist-library/types/editor/editor-i18n.d.ts +102 -0
- package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
- package/dist-library/types/editor/extended-native-components.d.ts +58 -0
- package/dist-library/types/editor/index.d.ts +9 -0
- package/dist-library/types/editor/locale.d.ts +13 -0
- package/dist-library/types/editor/native-components.d.ts +47 -0
- package/dist-library/types/editor/source-authoring.d.ts +57 -0
- package/dist-library/types/editor/types.d.ts +44 -0
- package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
- package/dist-library/types/editor/use-source-history.d.ts +16 -0
- package/dist-library/types/local/code-block.d.ts +24 -0
- package/dist-library/types/local/footnotes.d.ts +51 -0
- package/dist-library/types/local/image-view.d.ts +21 -0
- package/dist-library/types/local/types.d.ts +7 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +47 -36
- package/docs/compatibility-ch.md +12 -8
- package/docs/compatibility-en.md +12 -8
- package/docs/component-protocol-ch.md +2 -2
- package/docs/component-protocol-en.md +2 -2
- package/docs/editor-ch.md +216 -0
- package/docs/editor-en.md +216 -0
- package/docs/local-guide-ch.md +11 -5
- package/docs/local-guide-en.md +11 -5
- package/docs/local-interaction-syntax-ch.md +7 -2
- package/docs/local-interaction-syntax-en.md +7 -2
- package/docs/release-0.4.0-ch.md +4 -4
- package/docs/release-0.4.0-en.md +4 -4
- package/docs/release-0.4.1-ch.md +23 -0
- package/docs/release-0.4.1-en.md +23 -0
- package/docs/release-0.5.0-ch.md +41 -0
- package/docs/release-0.5.0-en.md +41 -0
- package/docs/releasing-ch.md +18 -11
- package/docs/releasing-en.md +18 -11
- package/docs/shareable-export-ch.md +4 -2
- package/docs/shareable-export-en.md +4 -2
- package/examples/integration/react-editor.tsx +74 -0
- package/package.json +54 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, O as a, P as o, S as s, T as c, b as l, c as u, d, f, j as p, k as m, l as h, n as g, o as ee, r as _, s as te, t as v, u as ne, w as re, x as ie, y as ae } from "./runtime-DPuMxM_y.js";
|
|
2
2
|
// src/local/authoring.ts
|
|
3
3
|
var oe = /^[A-Za-z_][A-Za-z0-9_]*$/, se = 128, ce = /* @__PURE__ */ new Set([
|
|
4
4
|
"code",
|
|
@@ -6,7 +6,8 @@ var oe = /^[A-Za-z_][A-Za-z0-9_]*$/, se = 128, ce = /* @__PURE__ */ new Set([
|
|
|
6
6
|
"math",
|
|
7
7
|
"inlineMath",
|
|
8
8
|
"fallback",
|
|
9
|
-
"comment"
|
|
9
|
+
"comment",
|
|
10
|
+
"footnoteDefinition"
|
|
10
11
|
]), le = /* @__PURE__ */ new Set([
|
|
11
12
|
"local.version.unsupported",
|
|
12
13
|
"local.version.malformed",
|
|
@@ -31,7 +32,7 @@ function x(e) {
|
|
|
31
32
|
return e !== void 0 && /\s/.test(e);
|
|
32
33
|
}
|
|
33
34
|
function S(e) {
|
|
34
|
-
return e.length > 0 && e.length <= se && oe.test(e) && !
|
|
35
|
+
return e.length > 0 && e.length <= se && oe.test(e) && !t.has(e);
|
|
35
36
|
}
|
|
36
37
|
function C(e) {
|
|
37
38
|
return {
|
|
@@ -41,7 +42,7 @@ function C(e) {
|
|
|
41
42
|
}
|
|
42
43
|
function ue(e) {
|
|
43
44
|
try {
|
|
44
|
-
return
|
|
45
|
+
return g(e).diagnostics;
|
|
45
46
|
} catch {
|
|
46
47
|
return [];
|
|
47
48
|
}
|
|
@@ -216,45 +217,45 @@ function me(e, t) {
|
|
|
216
217
|
offsets: r
|
|
217
218
|
};
|
|
218
219
|
}
|
|
219
|
-
function he(e,
|
|
220
|
-
let
|
|
221
|
-
for (let
|
|
222
|
-
let
|
|
223
|
-
if (
|
|
224
|
-
let
|
|
225
|
-
for (
|
|
220
|
+
function he(e, n, r) {
|
|
221
|
+
let i = [];
|
|
222
|
+
for (let a = n; a < r;) {
|
|
223
|
+
let n = e[a];
|
|
224
|
+
if (n === "\"" || n === "'") {
|
|
225
|
+
let t = n;
|
|
226
|
+
for (a += 1; a < r;) if (e[a] === "\\") a += 2;
|
|
226
227
|
else {
|
|
227
|
-
if (e[
|
|
228
|
-
|
|
228
|
+
if (e[a] === t) {
|
|
229
|
+
a += 1;
|
|
229
230
|
break;
|
|
230
231
|
}
|
|
231
|
-
|
|
232
|
+
a += 1;
|
|
232
233
|
}
|
|
233
234
|
} else {
|
|
234
|
-
if (/[0-9]/.test(
|
|
235
|
-
let t = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(
|
|
235
|
+
if (/[0-9]/.test(n) || n === "." && e[a + 1] !== void 0 && /[0-9]/.test(e[a + 1])) {
|
|
236
|
+
let t = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(a, r));
|
|
236
237
|
if (t) {
|
|
237
|
-
|
|
238
|
+
a += t[0].length;
|
|
238
239
|
continue;
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
|
-
if (y(
|
|
242
|
-
let
|
|
243
|
-
for (
|
|
244
|
-
let
|
|
245
|
-
for (;
|
|
246
|
-
if (e[
|
|
247
|
-
|
|
248
|
-
name:
|
|
242
|
+
if (y(n)) {
|
|
243
|
+
let n = a;
|
|
244
|
+
for (a += 1; a < r && b(e[a]);) a += 1;
|
|
245
|
+
let o = e.slice(n, a), s = a;
|
|
246
|
+
for (; s < r && x(e[s]);) s += 1;
|
|
247
|
+
if (e[s] === "(" || o === "true" || o === "false" || o === "null" || o === "pi" || o === "e" || t.has(o)) continue;
|
|
248
|
+
i.push({
|
|
249
|
+
name: o,
|
|
249
250
|
range: {
|
|
250
|
-
start:
|
|
251
|
-
end:
|
|
251
|
+
start: n,
|
|
252
|
+
end: a
|
|
252
253
|
}
|
|
253
254
|
});
|
|
254
|
-
} else
|
|
255
|
+
} else a += 1;
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
|
-
return
|
|
258
|
+
return i;
|
|
258
259
|
}
|
|
259
260
|
function ge(e, t) {
|
|
260
261
|
return Object.hasOwn(e.props, t) ? t === "bind" || !!e.slots?.some((e) => e.bind === t) : !1;
|
|
@@ -296,25 +297,25 @@ function _e(e, t) {
|
|
|
296
297
|
return i;
|
|
297
298
|
}
|
|
298
299
|
function E(e, t) {
|
|
299
|
-
let n = [], r = /* @__PURE__ */ new Map(), i = [], a = [],
|
|
300
|
+
let n = [], r = /* @__PURE__ */ new Map(), i = [], a = [], o = (t, n) => {
|
|
300
301
|
for (let r of he(e, t, n)) i.push(r);
|
|
301
|
-
},
|
|
302
|
+
}, s = (e, t) => {
|
|
302
303
|
let n = r.get(e);
|
|
303
304
|
n ? n.push(C(t)) : r.set(e, [C(t)]);
|
|
304
|
-
},
|
|
305
|
+
}, c = (t, r) => {
|
|
305
306
|
let a = w(e, t.range.start);
|
|
306
307
|
if (!a || a.closing) return;
|
|
307
308
|
n.push({
|
|
308
309
|
kind: "tag",
|
|
309
310
|
range: C(a.nameRange)
|
|
310
311
|
});
|
|
311
|
-
let o =
|
|
312
|
+
let o = d(t.name ?? ""), c = a.attrs.some((e) => e.name === "key");
|
|
312
313
|
for (let l of a.attrs) {
|
|
313
314
|
if (n.push({
|
|
314
315
|
kind: "attribute",
|
|
315
316
|
range: C(l.nameRange)
|
|
316
317
|
}), !l.valueRange) continue;
|
|
317
|
-
let a = o?.props[l.name], u = o !== void 0 && ge(o, l.name) && (t.name !== "table" && t.name !== "chart" || !!
|
|
318
|
+
let a = o?.props[l.name], u = o !== void 0 && ge(o, l.name) && (t.name !== "table" && t.name !== "chart" || !!c), d = (t.name === "computed" || t.name === "const") && l.name === "name", f = e.slice(l.valueRange.start, l.valueRange.end), p = me(e, l.valueRange);
|
|
318
319
|
if (t.name === "validation" && l.name === "fields") {
|
|
319
320
|
for (let e of p.text.matchAll(/\S+/g)) {
|
|
320
321
|
if (!S(e[0])) continue;
|
|
@@ -368,7 +369,7 @@ function E(e, t) {
|
|
|
368
369
|
} else (u || d) && S(f) ? (n.push({
|
|
369
370
|
kind: "binding",
|
|
370
371
|
range: C(l.valueRange)
|
|
371
|
-
}),
|
|
372
|
+
}), s(f, l.valueRange)) : l.valueRange.end > l.valueRange.start && n.push({
|
|
372
373
|
kind: "string",
|
|
373
374
|
range: C(l.valueRange)
|
|
374
375
|
});
|
|
@@ -379,20 +380,20 @@ function E(e, t) {
|
|
|
379
380
|
range: C(l.nameRange)
|
|
380
381
|
});
|
|
381
382
|
}, u = (t, r) => {
|
|
382
|
-
for (let
|
|
383
|
-
if (
|
|
384
|
-
else if (
|
|
383
|
+
for (let s of t) {
|
|
384
|
+
if (s.type === "component" && s.name) c(s, r);
|
|
385
|
+
else if (s.type === "interpolation") n.push({
|
|
385
386
|
kind: "expression",
|
|
386
|
-
range: C(
|
|
387
|
-
}), s
|
|
388
|
-
else if (
|
|
387
|
+
range: C(s.range)
|
|
388
|
+
}), o(s.range.start + 2, Math.max(s.range.start + 2, s.range.end - 2));
|
|
389
|
+
else if (s.type === "math" || s.type === "inlineMath") {
|
|
389
390
|
if (n.push({
|
|
390
391
|
kind: "math",
|
|
391
|
-
range: C(
|
|
392
|
-
}), r === "plot" &&
|
|
393
|
-
let t =
|
|
392
|
+
range: C(s.range)
|
|
393
|
+
}), r === "plot" && s.type === "math") {
|
|
394
|
+
let t = s.range.start + 2;
|
|
394
395
|
try {
|
|
395
|
-
for (let n of
|
|
396
|
+
for (let n of l(e.slice(t, s.range.end - 2))) {
|
|
396
397
|
let e = {
|
|
397
398
|
name: n.name,
|
|
398
399
|
range: {
|
|
@@ -404,14 +405,14 @@ function E(e, t) {
|
|
|
404
405
|
}
|
|
405
406
|
} catch {}
|
|
406
407
|
}
|
|
407
|
-
} else
|
|
408
|
+
} else s.type === "code" || s.type === "inlineCode" ? n.push({
|
|
408
409
|
kind: "code",
|
|
409
|
-
range: C(
|
|
410
|
-
}) :
|
|
410
|
+
range: C(s.range)
|
|
411
|
+
}) : s.type === "comment" && n.push({
|
|
411
412
|
kind: "comment",
|
|
412
|
-
range: C(
|
|
413
|
+
range: C(s.range)
|
|
413
414
|
});
|
|
414
|
-
|
|
415
|
+
s.type !== "fallback" && s.children && u(s.children, s.name);
|
|
415
416
|
}
|
|
416
417
|
};
|
|
417
418
|
u(t);
|
|
@@ -420,25 +421,25 @@ function E(e, t) {
|
|
|
420
421
|
range: r
|
|
421
422
|
});
|
|
422
423
|
n.sort((e, t) => e.range.start - t.range.start || e.range.end - t.range.end);
|
|
423
|
-
let
|
|
424
|
+
let f = [];
|
|
424
425
|
for (let e of n) {
|
|
425
426
|
if (e.range.end <= e.range.start) continue;
|
|
426
|
-
let t =
|
|
427
|
-
t && e.range.start < t.range.end ||
|
|
427
|
+
let t = f[f.length - 1];
|
|
428
|
+
t && e.range.start < t.range.end || f.push(e);
|
|
428
429
|
}
|
|
429
|
-
let
|
|
430
|
+
let p = [];
|
|
430
431
|
for (let [e, t] of r) {
|
|
431
432
|
let n = [];
|
|
432
433
|
for (let t of i) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(C(t.range)));
|
|
433
|
-
n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end),
|
|
434
|
+
n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end), p.push({
|
|
434
435
|
name: e,
|
|
435
436
|
declarations: t,
|
|
436
437
|
references: n
|
|
437
438
|
});
|
|
438
439
|
}
|
|
439
|
-
return
|
|
440
|
-
tokens:
|
|
441
|
-
bindings:
|
|
440
|
+
return p.sort((e, t) => e.declarations[0].start - t.declarations[0].start || e.name.localeCompare(t.name)), {
|
|
441
|
+
tokens: f,
|
|
442
|
+
bindings: p,
|
|
442
443
|
mathReferences: a
|
|
443
444
|
};
|
|
444
445
|
}
|
|
@@ -448,7 +449,7 @@ function ve(e) {
|
|
|
448
449
|
bindings: [],
|
|
449
450
|
diagnostics: []
|
|
450
451
|
};
|
|
451
|
-
let t = E(e,
|
|
452
|
+
let t = E(e, _(e).nodes);
|
|
452
453
|
return {
|
|
453
454
|
tokens: t.tokens,
|
|
454
455
|
bindings: t.bindings,
|
|
@@ -671,7 +672,7 @@ function Ce(e, t, n, r) {
|
|
|
671
672
|
function we(e, t, n) {
|
|
672
673
|
let r = n.currentAttribute;
|
|
673
674
|
if (!r) return [];
|
|
674
|
-
let i =
|
|
675
|
+
let i = d(n.name)?.props[r.name];
|
|
675
676
|
if (!i || i.kind !== "enum" || !i.values) return [];
|
|
676
677
|
let a = r.valueRange?.start ?? t, o = e.slice(a, t);
|
|
677
678
|
return i.values.filter((e) => e.startsWith(o)).map((n) => ({
|
|
@@ -684,7 +685,7 @@ function we(e, t, n) {
|
|
|
684
685
|
}
|
|
685
686
|
function Te(e, t, n) {
|
|
686
687
|
if (n.closing || n.inValue || n.partialStart < 0) return [];
|
|
687
|
-
let r =
|
|
688
|
+
let r = d(n.name);
|
|
688
689
|
if (!r) return [];
|
|
689
690
|
let i = e.slice(n.partialStart, t);
|
|
690
691
|
if (i && !/^[A-Za-z0-9_-]*$/.test(i)) return [];
|
|
@@ -705,7 +706,7 @@ function Ee(e, t) {
|
|
|
705
706
|
let o = e[a + 1] === "/", s = a + (o ? 2 : 1);
|
|
706
707
|
if (s > t) return [];
|
|
707
708
|
let c = i[1] ?? "";
|
|
708
|
-
return
|
|
709
|
+
return ne.filter((e) => e.startsWith(c)).map((n) => ({
|
|
709
710
|
label: n,
|
|
710
711
|
insertText: n,
|
|
711
712
|
range: k(e, s, t, n),
|
|
@@ -715,14 +716,14 @@ function Ee(e, t) {
|
|
|
715
716
|
}
|
|
716
717
|
function De(e, t) {
|
|
717
718
|
if (typeof e != "string" || !Number.isFinite(t)) return [];
|
|
718
|
-
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r =
|
|
719
|
+
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r = _(e), i = [...T(r.nodes), ..._e(e, r.nodes)].sort((e, t) => e.start - t.start);
|
|
719
720
|
if (Se(i, n) || n === e.length && i.some((e) => e.end === n && e.start < n)) return [];
|
|
720
721
|
let a = E(e, r.nodes), o = be(e, n);
|
|
721
722
|
if (o) {
|
|
722
723
|
let t = O(e, n, r.nodes);
|
|
723
724
|
if (t >= 0) {
|
|
724
725
|
let r = D(e, t, n);
|
|
725
|
-
if (r?.inValue && r.currentAttribute &&
|
|
726
|
+
if (r?.inValue && r.currentAttribute && d(r.name)?.props[r.currentAttribute.name]?.static) return [];
|
|
726
727
|
}
|
|
727
728
|
return Ce(e, n, o, a.bindings);
|
|
728
729
|
}
|
|
@@ -747,7 +748,7 @@ function Oe(e, t) {
|
|
|
747
748
|
function ke(e, t, n) {
|
|
748
749
|
if (typeof e != "string" || typeof t != "string" || typeof n != "string") throw Error("Rename requires string arguments.");
|
|
749
750
|
if (!S(n)) throw Error(`"${n}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
|
|
750
|
-
let r = E(e,
|
|
751
|
+
let r = E(e, _(e).nodes), i = r.bindings.find((e) => e.name === t);
|
|
751
752
|
if (!i || i.declarations.length === 0) throw Error(`Binding "${t}" is not declared in this document.`);
|
|
752
753
|
if (t === n) return {
|
|
753
754
|
source: e,
|
|
@@ -765,7 +766,7 @@ function ke(e, t, n) {
|
|
|
765
766
|
range: C(e),
|
|
766
767
|
text: s.has(`${e.start}:${e.end}`) ? `\\mathrm{${n}}` : n
|
|
767
768
|
})), l = Oe(e, c);
|
|
768
|
-
if (
|
|
769
|
+
if (g(e).ok && !g(l).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
|
|
769
770
|
return {
|
|
770
771
|
source: l,
|
|
771
772
|
edits: c
|
|
@@ -782,12 +783,12 @@ function je(e) {
|
|
|
782
783
|
if (typeof e != "string") return e;
|
|
783
784
|
let t;
|
|
784
785
|
try {
|
|
785
|
-
t =
|
|
786
|
+
t = g(e);
|
|
786
787
|
} catch {
|
|
787
788
|
return e;
|
|
788
789
|
}
|
|
789
790
|
if (t.diagnostics.some((e) => e.severity === "error")) return e;
|
|
790
|
-
let n =
|
|
791
|
+
let n = _(e), r = [], i = (t) => {
|
|
791
792
|
for (let n of t) {
|
|
792
793
|
if (n.type === "component" && n.name) {
|
|
793
794
|
let t = w(e, n.range.start);
|
|
@@ -854,7 +855,7 @@ var A = /* @__PURE__ */ new Set([
|
|
|
854
855
|
"validation",
|
|
855
856
|
"data-table",
|
|
856
857
|
"column"
|
|
857
|
-
]), j = `<!-- reactive-md: ${
|
|
858
|
+
]), j = `<!-- reactive-md: ${f} -->`;
|
|
858
859
|
function M(e) {
|
|
859
860
|
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;
|
|
860
861
|
return {
|
|
@@ -866,26 +867,26 @@ function M(e) {
|
|
|
866
867
|
};
|
|
867
868
|
}
|
|
868
869
|
function Ne(e) {
|
|
869
|
-
return M(
|
|
870
|
+
return M(_(e));
|
|
870
871
|
}
|
|
871
|
-
function Pe(
|
|
872
|
-
let
|
|
872
|
+
function Pe(t, r, i, a, o = "error") {
|
|
873
|
+
let s = e(r, a), c = t.slice(0, i.start), l = c.lastIndexOf("\n");
|
|
873
874
|
return {
|
|
874
|
-
code:
|
|
875
|
-
severity:
|
|
876
|
-
range: { ...
|
|
877
|
-
message:
|
|
878
|
-
line:
|
|
879
|
-
column:
|
|
880
|
-
messageKey:
|
|
881
|
-
...
|
|
875
|
+
code: r,
|
|
876
|
+
severity: o,
|
|
877
|
+
range: { ...i },
|
|
878
|
+
message: n(s),
|
|
879
|
+
line: c.split("\n").length,
|
|
880
|
+
column: i.start - l,
|
|
881
|
+
messageKey: s.key,
|
|
882
|
+
...s.params ? { params: s.params } : {}
|
|
882
883
|
};
|
|
883
884
|
}
|
|
884
885
|
function N(e, t = {}) {
|
|
885
|
-
let n =
|
|
886
|
+
let n = _(e), r = M(n), i = typeof t == "object" && !!t && !Array.isArray(t), a = i ? t.fromVersion ?? r.effectiveVersion : r.effectiveVersion, o = typeof a == "string" ? a : "", s = {
|
|
886
887
|
ok: !1,
|
|
887
888
|
fromVersion: o,
|
|
888
|
-
toVersion:
|
|
889
|
+
toVersion: f,
|
|
889
890
|
needsMigration: !n.versionDeclaration || o !== "local-draft-2",
|
|
890
891
|
diagnostics: r.diagnostics.filter((e) => e.code !== "local.version.unsupported")
|
|
891
892
|
}, c = {
|
|
@@ -912,7 +913,7 @@ function N(e, t = {}) {
|
|
|
912
913
|
from: o,
|
|
913
914
|
detail: "use local-draft-1 or local-draft-2 and match the source declaration"
|
|
914
915
|
}), c;
|
|
915
|
-
let
|
|
916
|
+
let p = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, m = n.versionDeclaration ? _(p) : n;
|
|
916
917
|
if (o === "local-draft-1") {
|
|
917
918
|
let e = (n) => {
|
|
918
919
|
for (let r of n) {
|
|
@@ -939,15 +940,15 @@ function N(e, t = {}) {
|
|
|
939
940
|
r.type !== "fallback" && r.children && e(r.children);
|
|
940
941
|
}
|
|
941
942
|
};
|
|
942
|
-
e(
|
|
943
|
+
e(m.nodes);
|
|
943
944
|
}
|
|
944
945
|
if (s.diagnostics.some((e) => e.severity === "error")) return c;
|
|
945
|
-
let
|
|
946
|
-
for (let e of
|
|
947
|
-
return
|
|
946
|
+
let h = g(p);
|
|
947
|
+
for (let e of h.diagnostics) u(e);
|
|
948
|
+
return h.ok && (!n.versionDeclaration && s.diagnostics.length < 100 && d("local.upgrade.version-missing", {
|
|
948
949
|
start: +(e.charCodeAt(0) === 65279),
|
|
949
950
|
end: +(e.charCodeAt(0) === 65279)
|
|
950
|
-
}, { version:
|
|
951
|
+
}, { version: f }, "warning"), s.ok = !0), c;
|
|
951
952
|
}
|
|
952
953
|
function Fe(e, t) {
|
|
953
954
|
return N(e, t).report;
|
|
@@ -985,7 +986,7 @@ var P = "reactive-md-state/v1", F = 1048576, Le = /^fnv1a32:[0-9a-f]{8}$/, Re =
|
|
|
985
986
|
function L(e, t) {
|
|
986
987
|
return {
|
|
987
988
|
code: e,
|
|
988
|
-
message: t.length > 2e3 ? `${t.slice(0,
|
|
989
|
+
message: t.length > 2e3 ? `${t.slice(0, o - 1)}…` : t,
|
|
989
990
|
severity: "error",
|
|
990
991
|
range: {
|
|
991
992
|
start: 0,
|
|
@@ -1129,7 +1130,7 @@ function Je(e, t, n) {
|
|
|
1129
1130
|
}
|
|
1130
1131
|
let s = {
|
|
1131
1132
|
format: P,
|
|
1132
|
-
syntax:
|
|
1133
|
+
syntax: f,
|
|
1133
1134
|
sourceDigest: V(e.source),
|
|
1134
1135
|
parameters: o
|
|
1135
1136
|
};
|
|
@@ -1174,7 +1175,7 @@ function Ye(e, t) {
|
|
|
1174
1175
|
let a = i.format;
|
|
1175
1176
|
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${We(a)}; expected "${P}".`);
|
|
1176
1177
|
let o = i.syntax;
|
|
1177
|
-
o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${We(o)}; expected "${
|
|
1178
|
+
o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${We(o)}; expected "${f}".`);
|
|
1178
1179
|
let s = i.sourceDigest;
|
|
1179
1180
|
typeof s == "string" && Le.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
1180
1181
|
let c = {}, l = i.parameters;
|
|
@@ -1209,7 +1210,7 @@ function Ye(e, t) {
|
|
|
1209
1210
|
};
|
|
1210
1211
|
let d = {
|
|
1211
1212
|
format: P,
|
|
1212
|
-
syntax:
|
|
1213
|
+
syntax: f,
|
|
1213
1214
|
sourceDigest: s,
|
|
1214
1215
|
parameters: c
|
|
1215
1216
|
};
|
|
@@ -1305,7 +1306,7 @@ function $e(e, t, n, r) {
|
|
|
1305
1306
|
};
|
|
1306
1307
|
if (i.file.syntax !== "local-draft-2") return {
|
|
1307
1308
|
ok: !1,
|
|
1308
|
-
diagnostics: [L("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${
|
|
1309
|
+
diagnostics: [L("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${f}".`)]
|
|
1309
1310
|
};
|
|
1310
1311
|
if (i.file.sourceDigest !== V(e.source)) return {
|
|
1311
1312
|
ok: !1,
|
|
@@ -1320,7 +1321,7 @@ function $e(e, t, n, r) {
|
|
|
1320
1321
|
};
|
|
1321
1322
|
let c;
|
|
1322
1323
|
try {
|
|
1323
|
-
c =
|
|
1324
|
+
c = v(e);
|
|
1324
1325
|
} catch (e) {
|
|
1325
1326
|
return {
|
|
1326
1327
|
ok: !1,
|
|
@@ -1584,7 +1585,7 @@ var ft = class {
|
|
|
1584
1585
|
if (this.disposed) return;
|
|
1585
1586
|
let t = J(), n;
|
|
1586
1587
|
try {
|
|
1587
|
-
n = (this.options.fallbackCompile ??
|
|
1588
|
+
n = (this.options.fallbackCompile ?? g)(e);
|
|
1588
1589
|
} catch (e) {
|
|
1589
1590
|
n = {
|
|
1590
1591
|
ok: !1,
|
|
@@ -1665,7 +1666,7 @@ function mt(e) {
|
|
|
1665
1666
|
if (!n || typeof n.id != "number" || typeof n.source != "string") return;
|
|
1666
1667
|
let r = J();
|
|
1667
1668
|
try {
|
|
1668
|
-
let e =
|
|
1669
|
+
let e = g(n.source), i = Y(J() - r);
|
|
1669
1670
|
try {
|
|
1670
1671
|
t.postMessage({
|
|
1671
1672
|
id: n.id,
|
|
@@ -1795,4 +1796,4 @@ ${m}
|
|
|
1795
1796
|
</html>
|
|
1796
1797
|
`;
|
|
1797
1798
|
}
|
|
1798
|
-
export {
|
|
1799
|
+
export { ee as DEFAULT_LOCAL_THEME, dt as LOCAL_COMPILE_DELAY_MS, r as LOCAL_DIAGNOSTIC_CODES, P as LOCAL_STATE_FORMAT, f as LOCAL_SYNTAX_VERSION, te as LOCAL_THEME_PROTOCOL, ft as LocalCompileScheduler, s as LocalExpressionError, ht as SHAREABLE_HTML_FORMAT, ve as analyzeLocalSource, tt as applyLocalState, ut as applyLocalStateRetention, Fe as checkLocalUpgrade, re as compileExpression, X as compileFailureDiagnostic, ae as compileLatex, g as compileLocal, De as completeLocalSource, c as countLocalCodePoints, v as createLocalRuntime, Je as createLocalStateFile, kt as createShareableHtml, nt as exportLocalState, a as formatLocalDiagnostic, je as formatLocalSource, rt as importLocalState, Ne as inspectLocalSourceVersion, m as isLocalDiagnosticCode, u as isLocalThemeName, p as localDiagnosticTemplate, i as localDiagnosticTemplateKeys, V as localSourceDigest, Ie as migrateLocalSource, W as parseLocalState, ct as planLocalStateRetention, ke as renameLocalBinding, et as resolveLocalState, Dt as resolveLocalStateBaseline, h as resolveLocalTheme, ie as samplePlot, Tt as serializeForScript, it as serializeLocalState, mt as startLocalCompileWorker };
|