reactive-md 0.9.0 → 0.9.1
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 +13 -0
- package/CHANGELOG.md +13 -0
- package/README-ch.md +6 -6
- package/README-en.md +6 -6
- package/README.md +6 -6
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/build.mjs +1 -0
- package/cli/init.mjs +1 -1
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
- package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
- package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
- package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
- package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
- package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
- package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
- package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
- package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +16 -18
- package/dist-library/reactive-md-build.js +51 -51
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +2 -2
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +2 -2
- package/dist-library/reactive-md-plugin-gallery.js +2 -2
- package/dist-library/reactive-md-plugin-navigation.js +2 -2
- package/dist-library/reactive-md-plugin-network.js +117 -115
- package/dist-library/reactive-md-plugin-plot.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +10 -11
- package/dist-library/reactive-md-react.js +10 -11
- package/dist-library/reactive-md-sdk.js +3 -3
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +4 -4
- package/dist-library/reactive-md.js +280 -193
- package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
- package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
- package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
- package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +27 -4
- package/dist-library/types/local/types.d.ts +52 -16
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +2 -1
- package/docs/README.md +2 -1
- package/docs/compatibility/compatibility-ch.md +6 -6
- package/docs/compatibility/compatibility-en.md +6 -6
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +2 -2
- package/docs/development/component-development-reference-en.md +2 -2
- package/docs/development/component-protocol-ch.md +2 -2
- package/docs/development/component-protocol-en.md +2 -2
- package/docs/development/extension-tutorial-ch.md +3 -3
- package/docs/development/extension-tutorial-en.md +3 -3
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/compiler-ch.md +3 -1
- package/docs/integration/compiler-en.md +3 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +2 -2
- package/docs/integration/extension-sdk-en.md +2 -2
- package/docs/integration/local-integration-ch.md +130 -8
- package/docs/integration/local-integration-en.md +130 -8
- package/docs/integration/shareable-export-ch.md +4 -2
- package/docs/integration/shareable-export-en.md +4 -2
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/public-api-ch.md +10 -7
- package/docs/reference/public-api-en.md +10 -7
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/game-2048-package/README-ch.md +1 -1
- package/examples/game-2048-package/README.md +1 -1
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/minimal-extension/README-ch.md +3 -3
- package/examples/minimal-extension/README.md +3 -3
- package/examples/tetris-package/README-ch.md +1 -1
- package/examples/tetris-package/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { M as e, w as t } from "./config-validation-F47AcE6o.js";
|
|
2
|
+
import { s as n } from "./config-BadfhjdP.js";
|
|
3
|
+
import { n as r, r as ee, t as te } from "./options-1aDLK7JY.js";
|
|
4
|
+
import { n as ne } from "./incremental-Dv0FSp_U.js";
|
|
5
|
+
import { i as re, n as ie, r as ae } from "./runtime-kcA7bG7G.js";
|
|
6
|
+
import { a as oe, c as i, i as a, n as se, o as ce, r as le, s as ue, t as de } from "./LocalDocumentViewCore-GiWV3bey.js";
|
|
7
|
+
import { useCallback as o, useEffect as s, useMemo as fe, useRef as c } from "react";
|
|
8
|
+
import { jsx as l, jsxs as pe } from "react/jsx-runtime";
|
|
9
|
+
// src/local/rendering/document/LocalReactiveDocumentCore.tsx
|
|
10
|
+
var me = Symbol("implicit document identity");
|
|
11
|
+
function u({ source: u, onDiagnostics: he, sourcePhase: d, onTransientDiagnostics: ge, urlPolicy: _e, locale: f = "en", themes: p, colorScheme: ve = "auto", mode: m = "interactive", staticFirst: ye = !1, imageResolver: be, hostData: xe, hostRenderer: Se, reactConfig: h, useBaseCompileConfig: Ce, externalValues: g, network: we, documentId: _, randomSeed: v, componentState: Te, componentStateStorage: Ee, componentStateWriteDelayMs: De, onComponentStateChange: y, initialParameters: b, onParametersChange: x, onSourceNavigate: Oe, compileOptions: S, capabilityGrants: C, allowedFrameOrigins: ke, getBaseConfig: w }) {
|
|
12
|
+
if (ue(h, {
|
|
13
|
+
hostData: xe,
|
|
14
|
+
hostRenderer: Se,
|
|
15
|
+
themes: p
|
|
16
|
+
}), h !== void 0) {
|
|
17
|
+
let e = S?.config;
|
|
18
|
+
if (e !== void 0 && e !== h.config) {
|
|
19
|
+
let t = !1;
|
|
20
|
+
try {
|
|
21
|
+
t = n(e).key === h.config.key;
|
|
22
|
+
} catch {
|
|
23
|
+
t = !1;
|
|
24
|
+
}
|
|
25
|
+
if (!t) throw Error("reactConfig and compileOptions.config must be the same local config.");
|
|
26
|
+
}
|
|
27
|
+
if (S?.hostComponents !== void 0) throw Error("reactConfig cannot be combined with compileOptions.hostComponents.");
|
|
28
|
+
}
|
|
29
|
+
let T = h === void 0 && Ce ? w() : void 0, Ae = T !== void 0 && S?.config === void 0 && S?.hostComponents === void 0, E = h === void 0 ? Ae ? {
|
|
30
|
+
...S ?? {},
|
|
31
|
+
config: T.config
|
|
32
|
+
} : S : {
|
|
33
|
+
...S ?? {},
|
|
34
|
+
config: h.config
|
|
35
|
+
}, D = h?.themes ?? p ?? T?.themes, O = te(E), k = `${r(E)}|${_ ?? ""}|${v ?? ""}`, A = d === void 0 ? E?.sourcePhase : d, j = A === "streaming" || A === "final" ? A : A === void 0 ? "final" : A, M = j === "streaming", je = c(g);
|
|
36
|
+
je.current = g;
|
|
37
|
+
let N = c(_);
|
|
38
|
+
N.current = _;
|
|
39
|
+
let Me = c(v);
|
|
40
|
+
Me.current = v;
|
|
41
|
+
let Ne = c(Te);
|
|
42
|
+
Ne.current = Te;
|
|
43
|
+
let P = c(Ee);
|
|
44
|
+
P.current = Ee;
|
|
45
|
+
let F = c(De);
|
|
46
|
+
F.current = De;
|
|
47
|
+
let Pe = c(y);
|
|
48
|
+
Pe.current = y;
|
|
49
|
+
let Fe = c(b);
|
|
50
|
+
Fe.current = b;
|
|
51
|
+
let Ie = c(x);
|
|
52
|
+
Ie.current = x;
|
|
53
|
+
let Le = c([]), Re = E?.config, ze = Re?.key, Be = Re?.legacyKeys.map((e) => e.key) ?? [], Ve = (e) => {
|
|
54
|
+
let t = ie(e, {
|
|
55
|
+
externalValues: je.current,
|
|
56
|
+
documentId: N.current,
|
|
57
|
+
randomSeed: Me.current,
|
|
58
|
+
componentState: Ne.current,
|
|
59
|
+
...P.current === void 0 ? {} : { componentStateStorage: P.current },
|
|
60
|
+
...F.current === void 0 ? {} : { componentStateWriteDelayMs: F.current },
|
|
61
|
+
...(ze ?? e.componentConfigKey) === void 0 ? {} : { configKey: ze ?? e.componentConfigKey },
|
|
62
|
+
...Be.length === 0 ? {} : { legacyConfigKeys: Be }
|
|
63
|
+
}), n = Fe.current;
|
|
64
|
+
return Le.current = n && Object.keys(n).length ? t.setParameters(se(n)) : [], t;
|
|
65
|
+
}, I = c(null), L = c(null), R = fe(() => {
|
|
66
|
+
I.current && L.current === O || (I.current?.dispose(), I.current = ne(), L.current = O);
|
|
67
|
+
let e = I.current;
|
|
68
|
+
return typeof e.compileShared == "function" ? e.compileShared(u, E, j) : e.compile(u, E, j);
|
|
69
|
+
}, [
|
|
70
|
+
u,
|
|
71
|
+
O,
|
|
72
|
+
j
|
|
73
|
+
]), z = c(null), B = c(null), V = c([]), H = c(!1), U = z.current;
|
|
74
|
+
if (!R.ok) U = null;
|
|
75
|
+
else {
|
|
76
|
+
let e = R.document;
|
|
77
|
+
if (U && B.current !== k) {
|
|
78
|
+
try {
|
|
79
|
+
U.services?.state.flush();
|
|
80
|
+
} catch {}
|
|
81
|
+
V.current.push(U), U = null, z.current = null;
|
|
82
|
+
}
|
|
83
|
+
if (!U) {
|
|
84
|
+
try {
|
|
85
|
+
U = Ve(e);
|
|
86
|
+
} catch {
|
|
87
|
+
U = null;
|
|
88
|
+
}
|
|
89
|
+
z.current = U;
|
|
90
|
+
} else if (U.document !== e) {
|
|
91
|
+
let t = !1;
|
|
92
|
+
try {
|
|
93
|
+
let n = re(U, e, { notify: !1 });
|
|
94
|
+
t = n.ok, n.ok && n.changed && (H.current = !0);
|
|
95
|
+
} catch {
|
|
96
|
+
t = !1;
|
|
97
|
+
}
|
|
98
|
+
if (!t) {
|
|
99
|
+
try {
|
|
100
|
+
U.services?.state.flush();
|
|
101
|
+
} catch {}
|
|
102
|
+
V.current.push(U);
|
|
103
|
+
let t = null;
|
|
104
|
+
try {
|
|
105
|
+
t = Ve(e);
|
|
106
|
+
} catch {
|
|
107
|
+
t = null;
|
|
108
|
+
}
|
|
109
|
+
U = t, z.current = t;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
B.current = k;
|
|
113
|
+
}
|
|
114
|
+
let He = c(he);
|
|
115
|
+
He.current = he;
|
|
116
|
+
let W = c(0), G = c(ge);
|
|
117
|
+
G.current = ge;
|
|
118
|
+
let Ue = c(""), K = c(!1), q = R.transientDiagnostics ?? [], J = q.length === 0 ? "" : a(q);
|
|
119
|
+
s(() => {
|
|
120
|
+
if (J !== Ue.current) {
|
|
121
|
+
if (Ue.current = J, q.length === 0) {
|
|
122
|
+
if (!K.current) return;
|
|
123
|
+
K.current = !1, G.current?.([]);
|
|
124
|
+
} else K.current = !0, G.current?.(q);
|
|
125
|
+
}
|
|
126
|
+
}, [J]);
|
|
127
|
+
let We = ce(D), Ge = fe(() => {
|
|
128
|
+
if (!R.ok) return [];
|
|
129
|
+
try {
|
|
130
|
+
return t(R.document.theme, D, R.document.themeRange, R.document.source).diagnostics;
|
|
131
|
+
} catch {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
}, [R, We]), Ke = c(null), qe = o((e) => {
|
|
135
|
+
let t = a(e);
|
|
136
|
+
t !== Ke.current && (Ke.current = t, He.current?.(e));
|
|
137
|
+
}, []), Y = c([]), X = c([]), Z = o(() => {
|
|
138
|
+
qe(le(R.diagnostics, Ge, Le.current, Y.current, X.current));
|
|
139
|
+
}, [
|
|
140
|
+
R,
|
|
141
|
+
Ge,
|
|
142
|
+
qe
|
|
143
|
+
]), Q = c(Z);
|
|
144
|
+
Q.current = Z, s(() => {
|
|
145
|
+
let e = U?.services, t = e === void 0 ? [] : e.state.diagnostics(), n = X.current;
|
|
146
|
+
t.length === n.length && t.every((e, t) => e === n[t]) || (X.current = [...t], Q.current());
|
|
147
|
+
}), s(() => {
|
|
148
|
+
Y.current = [];
|
|
149
|
+
}, [R]), s(() => {
|
|
150
|
+
Z();
|
|
151
|
+
}, [Z]);
|
|
152
|
+
let Je = o((e) => {
|
|
153
|
+
Y.current = e, Q.current();
|
|
154
|
+
}, []);
|
|
155
|
+
if (s(() => {
|
|
156
|
+
if (!U) return;
|
|
157
|
+
Q.current();
|
|
158
|
+
let e = !0, t;
|
|
159
|
+
try {
|
|
160
|
+
t = U.getParameters();
|
|
161
|
+
} catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
let n = () => {};
|
|
165
|
+
try {
|
|
166
|
+
n = U.subscribe(() => {
|
|
167
|
+
if (!e) return;
|
|
168
|
+
let n, r;
|
|
169
|
+
try {
|
|
170
|
+
n = U.getParameters(), r = U.snapshot();
|
|
171
|
+
} catch {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (!oe(t, n)) {
|
|
175
|
+
t = n;
|
|
176
|
+
try {
|
|
177
|
+
Ie.current?.(n, r);
|
|
178
|
+
} catch {}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
} catch {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
return () => {
|
|
185
|
+
e = !1, n();
|
|
186
|
+
};
|
|
187
|
+
}, [U]), s(() => (W.current += 1, () => {
|
|
188
|
+
--W.current, queueMicrotask(() => {
|
|
189
|
+
if (W.current !== 0) return;
|
|
190
|
+
let e = z.current;
|
|
191
|
+
z.current = null;
|
|
192
|
+
try {
|
|
193
|
+
e?.dispose();
|
|
194
|
+
} catch {}
|
|
195
|
+
try {
|
|
196
|
+
I.current?.dispose();
|
|
197
|
+
} catch {}
|
|
198
|
+
I.current = null, L.current = null;
|
|
199
|
+
});
|
|
200
|
+
}), []), s(() => {
|
|
201
|
+
let e = V.current;
|
|
202
|
+
V.current = [];
|
|
203
|
+
for (let t of e) queueMicrotask(() => {
|
|
204
|
+
if (z.current !== t) try {
|
|
205
|
+
t.dispose();
|
|
206
|
+
} catch {}
|
|
207
|
+
});
|
|
208
|
+
if (!R.ok || !U) {
|
|
209
|
+
let e = z.current;
|
|
210
|
+
e && (z.current = null, B.current = null, queueMicrotask(() => {
|
|
211
|
+
if (z.current !== e) try {
|
|
212
|
+
e.dispose();
|
|
213
|
+
} catch {}
|
|
214
|
+
})), I.current && (I.current.dispose(), I.current = null, L.current = null);
|
|
215
|
+
}
|
|
216
|
+
if (H.current) {
|
|
217
|
+
H.current = !1;
|
|
218
|
+
let e = z.current;
|
|
219
|
+
e && ae(e);
|
|
220
|
+
}
|
|
221
|
+
}), s(() => {
|
|
222
|
+
let e = U?.services;
|
|
223
|
+
if (e && y !== void 0) return e.state.subscribe(() => {
|
|
224
|
+
Pe.current?.(e.state.snapshot());
|
|
225
|
+
});
|
|
226
|
+
}, [U, y]), s(() => {
|
|
227
|
+
let e = U?.services?.state;
|
|
228
|
+
if (e === void 0) return;
|
|
229
|
+
let t = () => e.flush(), n = () => {
|
|
230
|
+
document.visibilityState === "hidden" && t();
|
|
231
|
+
};
|
|
232
|
+
return window.addEventListener("pagehide", t), document.addEventListener("visibilitychange", n), () => {
|
|
233
|
+
window.removeEventListener("pagehide", t), document.removeEventListener("visibilitychange", n);
|
|
234
|
+
};
|
|
235
|
+
}, [U]), !R.ok || !U) return /* @__PURE__ */ pe("div", {
|
|
236
|
+
className: `md-document local-document local-inactive${m === "static" ? " local-static" : ""}`,
|
|
237
|
+
"data-render-mode": m,
|
|
238
|
+
role: "alert",
|
|
239
|
+
children: [/* @__PURE__ */ l("p", {
|
|
240
|
+
className: "local-inactive-title",
|
|
241
|
+
children: R.ok ? i(f, "Interactive initialization failed; preview is disabled.", "交互初始化失败,预览已停用。") : i(f, "The document contains syntax errors; interactive preview is disabled.", "文档包含语法错误,交互预览已停用。")
|
|
242
|
+
}), R.diagnostics.length ? /* @__PURE__ */ l("ul", {
|
|
243
|
+
className: "local-inactive-list",
|
|
244
|
+
children: R.diagnostics.map((t, n) => /* @__PURE__ */ pe("li", { children: [e(t, f), i(f, ` (line ${t.line}, column ${t.column})`, `(第 ${t.line} 行,第 ${t.column} 列)`)] }, `${t.code}-${n}`))
|
|
245
|
+
}) : null]
|
|
246
|
+
});
|
|
247
|
+
let $ = ee(E), Ye = $.ok ? {
|
|
248
|
+
enableCss: $.html.enableCss && (C?.enableCss ?? !0) === !0,
|
|
249
|
+
enableJavaScript: $.html.enableJavaScript && (C?.enableJavaScript ?? !0) === !0,
|
|
250
|
+
enableExtendedHtml: $.html.enableExtendedHtml && (C?.enableExtendedHtml ?? !0) === !0
|
|
251
|
+
} : void 0;
|
|
252
|
+
return /* @__PURE__ */ l(de, {
|
|
253
|
+
document: R.document,
|
|
254
|
+
runtime: U,
|
|
255
|
+
capabilityGrants: Ye,
|
|
256
|
+
allowedFrameOrigins: ke,
|
|
257
|
+
network: we,
|
|
258
|
+
networkScope: _ ?? me,
|
|
259
|
+
onDiagnostics: Je,
|
|
260
|
+
urlPolicy: _e,
|
|
261
|
+
locale: f,
|
|
262
|
+
themes: h === void 0 ? D : void 0,
|
|
263
|
+
colorScheme: ve,
|
|
264
|
+
mode: M ? "static" : m,
|
|
265
|
+
staticFirst: !M && ye,
|
|
266
|
+
imageResolver: be,
|
|
267
|
+
hostData: xe,
|
|
268
|
+
hostRenderer: Se,
|
|
269
|
+
reactConfig: h,
|
|
270
|
+
getBaseConfig: w,
|
|
271
|
+
externalValues: g,
|
|
272
|
+
onSourceNavigate: Oe
|
|
273
|
+
}, k);
|
|
274
|
+
}
|
|
275
|
+
export { u as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as e } from "./latex-1w7aQgD5.js";
|
|
2
|
-
import { D as t } from "./config-validation-
|
|
3
|
-
import { o as n } from "./compile-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as a } from "./compiler-
|
|
7
|
-
import { c as o } from "./schema-
|
|
2
|
+
import { D as t } from "./config-validation-F47AcE6o.js";
|
|
3
|
+
import { o as n } from "./compile-wUv8KEge.js";
|
|
4
|
+
import { N as r } from "./validation-BEBA_HvS.js";
|
|
5
|
+
import { r as i } from "./options-1aDLK7JY.js";
|
|
6
|
+
import { t as a } from "./compiler-eOfcinZs.js";
|
|
7
|
+
import { c as o } from "./schema-BufhKUSM.js";
|
|
8
8
|
// src/local/source/authoring-syntax.ts
|
|
9
9
|
var s = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)(?=[\s/>])/;
|
|
10
10
|
function c(e, t) {
|
|
@@ -233,7 +233,10 @@ var g = /^[A-Za-z_][A-Za-z0-9_]*$/, _ = 128, v = /* @__PURE__ */ new Set([
|
|
|
233
233
|
"inlineMath",
|
|
234
234
|
"fallback",
|
|
235
235
|
"comment",
|
|
236
|
-
"footnoteDefinition"
|
|
236
|
+
"footnoteDefinition",
|
|
237
|
+
"authorCss",
|
|
238
|
+
"authorJavaScript",
|
|
239
|
+
"extendedHtmlRaw"
|
|
237
240
|
]), y = /* @__PURE__ */ new Set([
|
|
238
241
|
"local.version.unsupported",
|
|
239
242
|
"local.version.malformed",
|
|
@@ -265,8 +268,7 @@ function S(e, t) {
|
|
|
265
268
|
}
|
|
266
269
|
}
|
|
267
270
|
function C(e) {
|
|
268
|
-
|
|
269
|
-
return t.ok ? t.htmlActive ? "html" : "markdown" : "invalid";
|
|
271
|
+
return i(e).ok;
|
|
270
272
|
}
|
|
271
273
|
function w(e) {
|
|
272
274
|
let t = i(e);
|
|
@@ -492,7 +494,7 @@ function A(e, t, n = {}) {
|
|
|
492
494
|
bindings: [],
|
|
493
495
|
diagnostics: []
|
|
494
496
|
};
|
|
495
|
-
if (C(t)
|
|
497
|
+
if (!C(t)) return {
|
|
496
498
|
tokens: [],
|
|
497
499
|
bindings: [],
|
|
498
500
|
diagnostics: n.diagnostics === !1 ? [] : S(e, t)
|
|
@@ -737,8 +739,23 @@ function B(e, t, n, r) {
|
|
|
737
739
|
if (!i) return [];
|
|
738
740
|
let a = e.slice(n.partialStart, t);
|
|
739
741
|
if (a && !/^[A-Za-z0-9_-]*$/.test(a)) return [];
|
|
740
|
-
let o = new Set(n.attrs.filter((e) => e.nameEnd < n.partialStart).map((e) => e.name));
|
|
741
|
-
return
|
|
742
|
+
let o = new Set(n.attrs.filter((e) => e.nameEnd < n.partialStart).map((e) => e.name)), s = { ...i };
|
|
743
|
+
return ![
|
|
744
|
+
"computed",
|
|
745
|
+
"const",
|
|
746
|
+
"external",
|
|
747
|
+
"validation",
|
|
748
|
+
"option",
|
|
749
|
+
"column",
|
|
750
|
+
"edge",
|
|
751
|
+
"step"
|
|
752
|
+
].includes(n.name) && !Object.hasOwn(i, "css") && (s.css = {
|
|
753
|
+
kind: "string",
|
|
754
|
+
static: !0
|
|
755
|
+
}), n.name === "counter" && !Object.hasOwn(i, "action-id") && (s["action-id"] = {
|
|
756
|
+
kind: "string",
|
|
757
|
+
static: !0
|
|
758
|
+
}), Object.entries(s).filter(([e]) => !o.has(e) && e.startsWith(a)).map(([r, i]) => ({
|
|
742
759
|
label: r,
|
|
743
760
|
insertText: r,
|
|
744
761
|
range: L(e, n.partialStart, t, r),
|
|
@@ -753,17 +770,17 @@ function V(e, t, n) {
|
|
|
753
770
|
if (e[o] !== "<" || e[o - 1] === "\\") return [];
|
|
754
771
|
let s = e[o + 1] === "/", c = o + (s ? 2 : 1);
|
|
755
772
|
if (c > t) return [];
|
|
756
|
-
let l = a[1] ?? "";
|
|
757
|
-
return
|
|
773
|
+
let l = a[1] ?? "", u = s ? n.filter((e) => e.form !== "leaf").map((e) => e.name) : n.map((e) => e.name), d = ["css", "javascript"].filter((e) => !n.some((t) => t.name === e));
|
|
774
|
+
return [...u, ...d].filter((e) => e.startsWith(l)).map((n) => ({
|
|
758
775
|
label: n,
|
|
759
|
-
insertText: n,
|
|
776
|
+
insertText: !s && d.includes(n) && e[L(e, c, t, n).end] !== ">" ? `${n}>\n\n</${n}>` : n,
|
|
760
777
|
range: L(e, c, t, n),
|
|
761
778
|
kind: "tag",
|
|
762
|
-
detail: s ? "closing tag" : "component"
|
|
779
|
+
detail: s ? "closing tag" : d.includes(n) ? "document declaration" : "component"
|
|
763
780
|
}));
|
|
764
781
|
}
|
|
765
782
|
function H(e, t, n) {
|
|
766
|
-
if (typeof e != "string" || !Number.isFinite(t) || C(n)
|
|
783
|
+
if (typeof e != "string" || !Number.isFinite(t) || !C(n)) return [];
|
|
767
784
|
let r = Math.max(0, Math.min(e.length, Math.floor(t))), i = w(n), a = o(e, n), s = [...E(a.nodes), ...D(e, a.nodes)].sort((e, t) => e.start - t.start);
|
|
768
785
|
if (I(s, r) || r === e.length && s.some((e) => e.end === r && e.start < r)) return [];
|
|
769
786
|
let c = k(e, a.nodes, i), l = P(e, r);
|
|
@@ -771,7 +788,10 @@ function H(e, t, n) {
|
|
|
771
788
|
let t = M(e, r, a.nodes);
|
|
772
789
|
if (t >= 0) {
|
|
773
790
|
let n = j(e, t, r);
|
|
774
|
-
if (n?.inValue && n.currentAttribute
|
|
791
|
+
if (n?.inValue && n.currentAttribute) {
|
|
792
|
+
let e = O(n.name, i)?.[n.currentAttribute.name];
|
|
793
|
+
if (e?.static || !e && ["css", "action-id"].includes(n.currentAttribute.name)) return [];
|
|
794
|
+
}
|
|
775
795
|
}
|
|
776
796
|
return R(e, r, l, c.bindings);
|
|
777
797
|
}
|
|
@@ -795,7 +815,7 @@ function U(e, t) {
|
|
|
795
815
|
}
|
|
796
816
|
function W(e, t, n, r) {
|
|
797
817
|
if (typeof e != "string" || typeof t != "string" || typeof n != "string") throw Error("Rename requires string arguments.");
|
|
798
|
-
if (C(r)
|
|
818
|
+
if (!C(r)) throw Error("Bindings cannot be renamed with invalid compile options.");
|
|
799
819
|
if (!b(n)) throw Error(`"${n}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
|
|
800
820
|
let i = k(e, o(e, r).nodes, w(r)), s = i.bindings.find((e) => e.name === t);
|
|
801
821
|
if (!s || s.declarations.length === 0) throw Error(`Binding "${t}" is not declared in this document.`);
|
|
@@ -829,7 +849,7 @@ function G(e, t) {
|
|
|
829
849
|
return t.selfClosing ? `${i} />` : `${i}>`;
|
|
830
850
|
}
|
|
831
851
|
function K(e, t) {
|
|
832
|
-
if (typeof e != "string" || C(t)
|
|
852
|
+
if (typeof e != "string" || !C(t)) return e;
|
|
833
853
|
let n;
|
|
834
854
|
try {
|
|
835
855
|
n = a(e, t);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as e, lt as t, ut as n } from "./preset-core-CKc5YXSM.js";
|
|
2
|
-
import { B as r, P as i, j as a } from "./config-validation-
|
|
2
|
+
import { B as r, P as i, j as a } from "./config-validation-F47AcE6o.js";
|
|
3
3
|
// src/local/evaluation/expression/values.ts
|
|
4
4
|
var o = class extends Error {
|
|
5
5
|
offset;
|