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
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { M as e, w as t } from "./config-validation-C5kJYk-J.js";
|
|
2
|
-
import { s as n } from "./config-BUo-8O5C.js";
|
|
3
|
-
import { n as r, t as ee } from "./options-CdSKOi7p.js";
|
|
4
|
-
import { n as te } from "./incremental-D_6vwAAE.js";
|
|
5
|
-
import { i as ne, n as re, r as ie } from "./runtime-CuOyRe9f.js";
|
|
6
|
-
import { a as ae, c as oe, i as se, l as i, n as ce, o as le, r as ue, s as de, t as fe } from "./LocalDocumentViewCore-BLG4hMuO.js";
|
|
7
|
-
import { useCallback as a, useEffect as o, useMemo as s, useRef as c } from "react";
|
|
8
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
-
// src/local/rendering/document/LocalReactiveDocumentCore.tsx
|
|
10
|
-
var pe = Symbol("implicit document identity");
|
|
11
|
-
function d({ source: d, onDiagnostics: me, urlPolicy: he, locale: f = "en", themes: ge, colorScheme: _e = "auto", mode: p = "interactive", staticFirst: ve = !1, imageResolver: ye, hostData: be, hostRenderer: m, reactConfig: h, useBaseCompileConfig: xe, externalValues: g, network: Se, documentId: _, randomSeed: v, componentState: y, componentStateStorage: b, componentStateWriteDelayMs: x, onComponentStateChange: S, initialParameters: C, onParametersChange: w, onSourceNavigate: Ce, compileOptions: T, getBaseConfig: E }) {
|
|
12
|
-
if (oe(h, {
|
|
13
|
-
hostData: be,
|
|
14
|
-
hostRenderer: m,
|
|
15
|
-
themes: ge
|
|
16
|
-
}), h !== void 0) {
|
|
17
|
-
let e = T?.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 (T?.hostComponents !== void 0) throw Error("reactConfig cannot be combined with compileOptions.hostComponents.");
|
|
28
|
-
}
|
|
29
|
-
let D = h === void 0 && xe ? E() : void 0, we = D !== void 0 && T?.config === void 0 && T?.hostComponents === void 0, O = h === void 0 ? we ? {
|
|
30
|
-
...T ?? {},
|
|
31
|
-
config: D.config
|
|
32
|
-
} : T : {
|
|
33
|
-
...T ?? {},
|
|
34
|
-
config: h.config
|
|
35
|
-
}, k = h?.themes ?? ge ?? D?.themes, A = ee(O), j = `${A}|${_ ?? ""}|${v ?? ""}`, M = c(g);
|
|
36
|
-
M.current = g;
|
|
37
|
-
let N = c(_);
|
|
38
|
-
N.current = _;
|
|
39
|
-
let P = c(v);
|
|
40
|
-
P.current = v;
|
|
41
|
-
let F = c(y);
|
|
42
|
-
F.current = y;
|
|
43
|
-
let I = c(b);
|
|
44
|
-
I.current = b;
|
|
45
|
-
let L = c(x);
|
|
46
|
-
L.current = x;
|
|
47
|
-
let R = c(S);
|
|
48
|
-
R.current = S;
|
|
49
|
-
let z = c(C);
|
|
50
|
-
z.current = C;
|
|
51
|
-
let B = c(w);
|
|
52
|
-
B.current = w;
|
|
53
|
-
let Te = c([]), Ee = O?.config, De = Ee?.key, Oe = Ee?.legacyKeys.map((e) => e.key) ?? [], ke = (e) => {
|
|
54
|
-
let t = re(e, {
|
|
55
|
-
externalValues: M.current,
|
|
56
|
-
documentId: N.current,
|
|
57
|
-
randomSeed: P.current,
|
|
58
|
-
componentState: F.current,
|
|
59
|
-
...I.current === void 0 ? {} : { componentStateStorage: I.current },
|
|
60
|
-
...L.current === void 0 ? {} : { componentStateWriteDelayMs: L.current },
|
|
61
|
-
...(De ?? e.componentConfigKey) === void 0 ? {} : { configKey: De ?? e.componentConfigKey },
|
|
62
|
-
...Oe.length === 0 ? {} : { legacyConfigKeys: Oe }
|
|
63
|
-
}), n = z.current;
|
|
64
|
-
return Te.current = n && Object.keys(n).length ? t.setParameters(ue(n)) : [], t;
|
|
65
|
-
}, V = c(null), H = c(null), U = s(() => {
|
|
66
|
-
V.current && H.current === A || (V.current?.dispose(), V.current = te(), H.current = A);
|
|
67
|
-
let e = V.current;
|
|
68
|
-
return typeof e.compileShared == "function" ? e.compileShared(d, O) : e.compile(d, O);
|
|
69
|
-
}, [d, A]), W = c(null), G = c(null), K = c([]), q = c(!1), J = W.current;
|
|
70
|
-
if (!U.ok) J = null;
|
|
71
|
-
else {
|
|
72
|
-
let e = U.document;
|
|
73
|
-
if (J && G.current !== j) {
|
|
74
|
-
try {
|
|
75
|
-
J.services?.state.flush();
|
|
76
|
-
} catch {}
|
|
77
|
-
K.current.push(J), J = null, W.current = null;
|
|
78
|
-
}
|
|
79
|
-
if (!J) {
|
|
80
|
-
try {
|
|
81
|
-
J = ke(e);
|
|
82
|
-
} catch {
|
|
83
|
-
J = null;
|
|
84
|
-
}
|
|
85
|
-
W.current = J;
|
|
86
|
-
} else if (J.document !== e) {
|
|
87
|
-
let t = !1;
|
|
88
|
-
try {
|
|
89
|
-
let n = ne(J, e, { notify: !1 });
|
|
90
|
-
t = n.ok, n.ok && n.changed && (q.current = !0);
|
|
91
|
-
} catch {
|
|
92
|
-
t = !1;
|
|
93
|
-
}
|
|
94
|
-
if (!t) {
|
|
95
|
-
try {
|
|
96
|
-
J.services?.state.flush();
|
|
97
|
-
} catch {}
|
|
98
|
-
K.current.push(J);
|
|
99
|
-
let t = null;
|
|
100
|
-
try {
|
|
101
|
-
t = ke(e);
|
|
102
|
-
} catch {
|
|
103
|
-
t = null;
|
|
104
|
-
}
|
|
105
|
-
J = t, W.current = t;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
G.current = j;
|
|
109
|
-
}
|
|
110
|
-
let Ae = c(me);
|
|
111
|
-
Ae.current = me;
|
|
112
|
-
let Y = c(0), je = de(k), Me = s(() => {
|
|
113
|
-
if (!U.ok) return [];
|
|
114
|
-
try {
|
|
115
|
-
return t(U.document.theme, k, U.document.themeRange, U.document.source).diagnostics;
|
|
116
|
-
} catch {
|
|
117
|
-
return [];
|
|
118
|
-
}
|
|
119
|
-
}, [U, je]), Ne = c(null), Pe = a((e) => {
|
|
120
|
-
let t = ae(e);
|
|
121
|
-
t !== Ne.current && (Ne.current = t, Ae.current?.(e));
|
|
122
|
-
}, []), X = c([]), Z = c([]), Q = a(() => {
|
|
123
|
-
Pe(se(U.diagnostics, Me, Te.current, X.current, Z.current));
|
|
124
|
-
}, [
|
|
125
|
-
U,
|
|
126
|
-
Me,
|
|
127
|
-
Pe
|
|
128
|
-
]), $ = c(Q);
|
|
129
|
-
$.current = Q, o(() => {
|
|
130
|
-
let e = J?.services, t = e === void 0 ? [] : e.state.diagnostics(), n = Z.current;
|
|
131
|
-
t.length === n.length && t.every((e, t) => e === n[t]) || (Z.current = [...t], $.current());
|
|
132
|
-
}), o(() => {
|
|
133
|
-
X.current = [];
|
|
134
|
-
}, [U]), o(() => {
|
|
135
|
-
Q();
|
|
136
|
-
}, [Q]);
|
|
137
|
-
let Fe = a((e) => {
|
|
138
|
-
X.current = e, $.current();
|
|
139
|
-
}, []);
|
|
140
|
-
if (o(() => {
|
|
141
|
-
if (!J) return;
|
|
142
|
-
$.current();
|
|
143
|
-
let e = !0, t;
|
|
144
|
-
try {
|
|
145
|
-
t = J.getParameters();
|
|
146
|
-
} catch {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
let n = () => {};
|
|
150
|
-
try {
|
|
151
|
-
n = J.subscribe(() => {
|
|
152
|
-
if (!e) return;
|
|
153
|
-
let n, r;
|
|
154
|
-
try {
|
|
155
|
-
n = J.getParameters(), r = J.snapshot();
|
|
156
|
-
} catch {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (!le(t, n)) {
|
|
160
|
-
t = n;
|
|
161
|
-
try {
|
|
162
|
-
B.current?.(n, r);
|
|
163
|
-
} catch {}
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
} catch {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
return () => {
|
|
170
|
-
e = !1, n();
|
|
171
|
-
};
|
|
172
|
-
}, [J]), o(() => (Y.current += 1, () => {
|
|
173
|
-
--Y.current, queueMicrotask(() => {
|
|
174
|
-
if (Y.current !== 0) return;
|
|
175
|
-
let e = W.current;
|
|
176
|
-
W.current = null;
|
|
177
|
-
try {
|
|
178
|
-
e?.dispose();
|
|
179
|
-
} catch {}
|
|
180
|
-
try {
|
|
181
|
-
V.current?.dispose();
|
|
182
|
-
} catch {}
|
|
183
|
-
V.current = null, H.current = null;
|
|
184
|
-
});
|
|
185
|
-
}), []), o(() => {
|
|
186
|
-
let e = K.current;
|
|
187
|
-
K.current = [];
|
|
188
|
-
for (let t of e) queueMicrotask(() => {
|
|
189
|
-
if (W.current !== t) try {
|
|
190
|
-
t.dispose();
|
|
191
|
-
} catch {}
|
|
192
|
-
});
|
|
193
|
-
if (!U.ok || !J) {
|
|
194
|
-
let e = W.current;
|
|
195
|
-
e && (W.current = null, G.current = null, queueMicrotask(() => {
|
|
196
|
-
if (W.current !== e) try {
|
|
197
|
-
e.dispose();
|
|
198
|
-
} catch {}
|
|
199
|
-
})), V.current && (V.current.dispose(), V.current = null, H.current = null);
|
|
200
|
-
}
|
|
201
|
-
if (q.current) {
|
|
202
|
-
q.current = !1;
|
|
203
|
-
let e = W.current;
|
|
204
|
-
e && ie(e);
|
|
205
|
-
}
|
|
206
|
-
}), o(() => {
|
|
207
|
-
let e = J?.services;
|
|
208
|
-
if (e && S !== void 0) return e.state.subscribe(() => {
|
|
209
|
-
R.current?.(e.state.snapshot());
|
|
210
|
-
});
|
|
211
|
-
}, [J, S]), o(() => {
|
|
212
|
-
let e = J?.services?.state;
|
|
213
|
-
if (e === void 0) return;
|
|
214
|
-
let t = () => e.flush(), n = () => {
|
|
215
|
-
document.visibilityState === "hidden" && t();
|
|
216
|
-
};
|
|
217
|
-
return window.addEventListener("pagehide", t), document.addEventListener("visibilitychange", n), () => {
|
|
218
|
-
window.removeEventListener("pagehide", t), document.removeEventListener("visibilitychange", n);
|
|
219
|
-
};
|
|
220
|
-
}, [J]), !U.ok || !J) {
|
|
221
|
-
let t = r(O);
|
|
222
|
-
return typeof d == "string" && t.ok && t.htmlActive ? /* @__PURE__ */ l(ce, {
|
|
223
|
-
source: d,
|
|
224
|
-
mode: p
|
|
225
|
-
}) : /* @__PURE__ */ u("div", {
|
|
226
|
-
className: `md-document local-document local-inactive${p === "static" ? " local-static" : ""}`,
|
|
227
|
-
"data-render-mode": p,
|
|
228
|
-
role: "alert",
|
|
229
|
-
children: [/* @__PURE__ */ l("p", {
|
|
230
|
-
className: "local-inactive-title",
|
|
231
|
-
children: U.ok ? i(f, "Interactive initialization failed; preview is disabled.", "交互初始化失败,预览已停用。") : i(f, "The document contains syntax errors; interactive preview is disabled.", "文档包含语法错误,交互预览已停用。")
|
|
232
|
-
}), U.diagnostics.length ? /* @__PURE__ */ l("ul", {
|
|
233
|
-
className: "local-inactive-list",
|
|
234
|
-
children: U.diagnostics.map((t, n) => /* @__PURE__ */ u("li", { children: [e(t, f), i(f, ` (line ${t.line}, column ${t.column})`, `(第 ${t.line} 行,第 ${t.column} 列)`)] }, `${t.code}-${n}`))
|
|
235
|
-
}) : null]
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
return /* @__PURE__ */ l(fe, {
|
|
239
|
-
document: U.document,
|
|
240
|
-
runtime: J,
|
|
241
|
-
network: Se,
|
|
242
|
-
networkScope: _ ?? pe,
|
|
243
|
-
onDiagnostics: Fe,
|
|
244
|
-
urlPolicy: he,
|
|
245
|
-
locale: f,
|
|
246
|
-
themes: h === void 0 ? k : void 0,
|
|
247
|
-
colorScheme: _e,
|
|
248
|
-
mode: p,
|
|
249
|
-
staticFirst: ve,
|
|
250
|
-
imageResolver: ye,
|
|
251
|
-
hostData: be,
|
|
252
|
-
hostRenderer: m,
|
|
253
|
-
reactConfig: h,
|
|
254
|
-
getBaseConfig: E,
|
|
255
|
-
externalValues: g,
|
|
256
|
-
onSourceNavigate: Ce
|
|
257
|
-
}, A);
|
|
258
|
-
}
|
|
259
|
-
export { d as t };
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import { M as e } from "./config-validation-C5kJYk-J.js";
|
|
2
|
-
import { o as t } from "./props-sJ8vk0cr.js";
|
|
3
|
-
import { l as n } from "./sdk-core-BJLJaVR5.js";
|
|
4
|
-
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
-
// src/react/component-utils.tsx
|
|
7
|
-
function l(e) {
|
|
8
|
-
return {
|
|
9
|
-
context: e,
|
|
10
|
-
content: e.content,
|
|
11
|
-
props: e.props,
|
|
12
|
-
runtime: e.runtime,
|
|
13
|
-
bindings: e.bindings,
|
|
14
|
-
children: e.children,
|
|
15
|
-
mode: e.mode,
|
|
16
|
-
visible: e.visible,
|
|
17
|
-
disabled: e.disabled,
|
|
18
|
-
disabledInvalid: e.disabledInvalid,
|
|
19
|
-
resetToken: e.resetToken,
|
|
20
|
-
t: e.locale.t,
|
|
21
|
-
locale: e.locale.locale,
|
|
22
|
-
validation: e.validation,
|
|
23
|
-
source: e.source,
|
|
24
|
-
navigation: e.navigation,
|
|
25
|
-
url: e.url,
|
|
26
|
-
report: e.report,
|
|
27
|
-
render: (t, n) => e.children.renderItems(t ?? e.children.items(), n),
|
|
28
|
-
renderInline: (t, n) => e.children.renderInlineItems(t ?? e.children.items(), n)
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function u(t) {
|
|
32
|
-
let [n, i] = o(null), { locale: a, report: s, bindings: c } = t, l = r((t) => t.map((t) => e(t, a.locale)).join("; "), [a.locale]);
|
|
33
|
-
return {
|
|
34
|
-
write: r((e, t = "value") => {
|
|
35
|
-
let n = c.set(t, e);
|
|
36
|
-
return n.ok ? (i(null), !0) : (n.diagnostics.length > 0 ? (i(l(n.diagnostics)), s(n.diagnostics)) : i(a.t("Cannot write this value", "无法写入此值")), !1);
|
|
37
|
-
}, [
|
|
38
|
-
c,
|
|
39
|
-
a,
|
|
40
|
-
l,
|
|
41
|
-
s
|
|
42
|
-
]),
|
|
43
|
-
writeMany: r((e) => {
|
|
44
|
-
let t = c.setMany(e);
|
|
45
|
-
return t.ok ? (i(null), !0) : (t.diagnostics.length > 0 ? (i(l(t.diagnostics)), s(t.diagnostics)) : i(a.t("Cannot write this value", "无法写入此值")), !1);
|
|
46
|
-
}, [
|
|
47
|
-
c,
|
|
48
|
-
a,
|
|
49
|
-
l,
|
|
50
|
-
s
|
|
51
|
-
]),
|
|
52
|
-
error: n,
|
|
53
|
-
setError: i
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function d(e) {
|
|
57
|
-
return {
|
|
58
|
-
disabled: e.disabled,
|
|
59
|
-
invalid: e.disabledInvalid
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function f(e, t) {
|
|
63
|
-
return e.validation.fieldFor(t ?? e.content);
|
|
64
|
-
}
|
|
65
|
-
function p(e, t) {
|
|
66
|
-
return e.validation.hintFor(t ?? e.content);
|
|
67
|
-
}
|
|
68
|
-
function m(e, t) {
|
|
69
|
-
return e.source.attributes(t);
|
|
70
|
-
}
|
|
71
|
-
function h(e, t) {
|
|
72
|
-
let n = e.resetToken, r = a(n), o = a(t);
|
|
73
|
-
o.current = t, i(() => {
|
|
74
|
-
r.current !== n && (r.current = n, o.current());
|
|
75
|
-
}, [n]);
|
|
76
|
-
}
|
|
77
|
-
function g(e, t) {
|
|
78
|
-
return e.attrs[t];
|
|
79
|
-
}
|
|
80
|
-
function _(e, t, n = "") {
|
|
81
|
-
let r = e.props[t];
|
|
82
|
-
return typeof r == "string" ? r : typeof r == "number" ? Number.isFinite(r) ? String(r) : n : typeof r == "boolean" ? r ? "true" : "false" : e.content.attrs[t] === void 0 ? n : e.locale.t("Cannot compute", "无法计算");
|
|
83
|
-
}
|
|
84
|
-
function v(e, t, n) {
|
|
85
|
-
let r = e.props[t];
|
|
86
|
-
return typeof r == "number" && Number.isFinite(r) ? r : n;
|
|
87
|
-
}
|
|
88
|
-
function y(e, t, n, r = "") {
|
|
89
|
-
let i = t.props[n];
|
|
90
|
-
return typeof i == "string" ? i : typeof i == "number" ? Number.isFinite(i) ? String(i) : r : typeof i == "boolean" ? i ? "true" : "false" : t.attrs[n] === void 0 ? r : e.locale.t("Cannot compute", "无法计算");
|
|
91
|
-
}
|
|
92
|
-
function b(e, t, n, r = !1) {
|
|
93
|
-
let i = t.props[n];
|
|
94
|
-
return typeof i == "boolean" ? i : r;
|
|
95
|
-
}
|
|
96
|
-
function x(e, t) {
|
|
97
|
-
if (e.content.attrs[t] === void 0) return {
|
|
98
|
-
present: !1,
|
|
99
|
-
error: !1
|
|
100
|
-
};
|
|
101
|
-
let n = e.props[t];
|
|
102
|
-
return typeof n == "number" && Number.isFinite(n) ? {
|
|
103
|
-
present: !0,
|
|
104
|
-
error: !1,
|
|
105
|
-
value: n
|
|
106
|
-
} : {
|
|
107
|
-
present: !0,
|
|
108
|
-
error: !0
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function S(e, t) {
|
|
112
|
-
if (e.content.attrs[t] === void 0) return {
|
|
113
|
-
present: !1,
|
|
114
|
-
error: !1
|
|
115
|
-
};
|
|
116
|
-
let n = e.props[t];
|
|
117
|
-
return typeof n == "string" ? {
|
|
118
|
-
present: !0,
|
|
119
|
-
error: !1,
|
|
120
|
-
value: n
|
|
121
|
-
} : {
|
|
122
|
-
present: !0,
|
|
123
|
-
error: !0
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function C(e, t, n) {
|
|
127
|
-
if (e.content.attrs[t] === void 0) return {
|
|
128
|
-
ok: !0,
|
|
129
|
-
value: n
|
|
130
|
-
};
|
|
131
|
-
let r = e.props[t];
|
|
132
|
-
return typeof r == "boolean" ? {
|
|
133
|
-
ok: !0,
|
|
134
|
-
value: r
|
|
135
|
-
} : { ok: !1 };
|
|
136
|
-
}
|
|
137
|
-
function w(e, t, n = !1) {
|
|
138
|
-
let r = C(e, t, n);
|
|
139
|
-
return r.ok ? r.value : n;
|
|
140
|
-
}
|
|
141
|
-
function T(e, t, n, r) {
|
|
142
|
-
if (e.content.attrs[t] === void 0) return {
|
|
143
|
-
tone: r,
|
|
144
|
-
error: !1
|
|
145
|
-
};
|
|
146
|
-
let i = e.props[t];
|
|
147
|
-
return typeof i == "string" && n.includes(i) ? {
|
|
148
|
-
tone: i,
|
|
149
|
-
error: !1
|
|
150
|
-
} : {
|
|
151
|
-
tone: r,
|
|
152
|
-
error: /\{\{/.test(e.content.attrs[t] ?? "")
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function E(e) {
|
|
156
|
-
let n = e.attrs.color;
|
|
157
|
-
if (n === void 0) return;
|
|
158
|
-
let r = n.trim();
|
|
159
|
-
return r !== "" && t(r) ? r : void 0;
|
|
160
|
-
}
|
|
161
|
-
function D(e) {
|
|
162
|
-
if (e) return {
|
|
163
|
-
"--local-accent": e,
|
|
164
|
-
"--local-accent-soft": `color-mix(in srgb, ${e} 14%, var(--surface))`,
|
|
165
|
-
"--local-accent-strong": e
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function O(e) {
|
|
169
|
-
return e === null ? "" : typeof e == "string" ? e : typeof e == "number" ? Number.isFinite(e) ? String(e) : null : typeof e == "boolean" ? e ? "true" : "false" : null;
|
|
170
|
-
}
|
|
171
|
-
function k(e) {
|
|
172
|
-
return O(e) ?? "";
|
|
173
|
-
}
|
|
174
|
-
function A(e) {
|
|
175
|
-
try {
|
|
176
|
-
return e.runtime.get(e.content);
|
|
177
|
-
} catch {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
function j(e, t, n) {
|
|
182
|
-
try {
|
|
183
|
-
let r = e.runtime.get(e.content, t);
|
|
184
|
-
return typeof r == "number" && Number.isFinite(r) ? r : n;
|
|
185
|
-
} catch {
|
|
186
|
-
return n;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function M(e, t, n) {
|
|
190
|
-
return Math.min(n, Math.max(t, e));
|
|
191
|
-
}
|
|
192
|
-
function N(e, t, n, r) {
|
|
193
|
-
let i = Number.isFinite(r) && r > 0 ? r : 1, a = Math.max(0, Math.floor((n - t) / i + 1e-9)), o = t + Math.max(0, Math.min(a, Math.round((e - t) / i))) * i;
|
|
194
|
-
return Number(o.toPrecision(15));
|
|
195
|
-
}
|
|
196
|
-
function P(e, t, n, r, i, a = 1) {
|
|
197
|
-
let o = v(e, t, r), s = v(e, n, i);
|
|
198
|
-
o > s && ([o, s] = [s, o]);
|
|
199
|
-
let c = v(e, "step", a);
|
|
200
|
-
return {
|
|
201
|
-
min: o,
|
|
202
|
-
max: s,
|
|
203
|
-
step: Number.isFinite(c) && c > 0 ? c : 1
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function F(e) {
|
|
207
|
-
return e.trim() === "" ? "—" : e;
|
|
208
|
-
}
|
|
209
|
-
function I({ label: e, value: t, hint: n, className: r = "", multiline: i = !1 }) {
|
|
210
|
-
return /* @__PURE__ */ c("div", {
|
|
211
|
-
className: `md-control local-static-control ${r}`.trim(),
|
|
212
|
-
children: [
|
|
213
|
-
/* @__PURE__ */ s("span", {
|
|
214
|
-
className: "md-label",
|
|
215
|
-
children: e
|
|
216
|
-
}),
|
|
217
|
-
/* @__PURE__ */ s("span", {
|
|
218
|
-
className: `local-static-value${i ? " local-static-multiline" : ""}`,
|
|
219
|
-
"data-local-static-value": "",
|
|
220
|
-
children: t
|
|
221
|
-
}),
|
|
222
|
-
n ? /* @__PURE__ */ s("span", {
|
|
223
|
-
className: "md-hint",
|
|
224
|
-
children: n
|
|
225
|
-
}) : null
|
|
226
|
-
]
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
function L({ value: e, block: t = !1 }) {
|
|
230
|
-
return t ? /* @__PURE__ */ s("div", {
|
|
231
|
-
className: "local-print-value local-print-block",
|
|
232
|
-
"aria-hidden": "true",
|
|
233
|
-
"data-local-print-value": "",
|
|
234
|
-
children: e
|
|
235
|
-
}) : /* @__PURE__ */ s("span", {
|
|
236
|
-
className: "local-print-value",
|
|
237
|
-
"aria-hidden": "true",
|
|
238
|
-
"data-local-print-value": "",
|
|
239
|
-
children: e
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
function R({ message: e, id: t }) {
|
|
243
|
-
return e ? /* @__PURE__ */ s("span", {
|
|
244
|
-
id: t,
|
|
245
|
-
className: "field-error",
|
|
246
|
-
role: "alert",
|
|
247
|
-
children: e
|
|
248
|
-
}) : null;
|
|
249
|
-
}
|
|
250
|
-
function z({ message: e }) {
|
|
251
|
-
return /* @__PURE__ */ s("span", {
|
|
252
|
-
className: "local-error",
|
|
253
|
-
role: "alert",
|
|
254
|
-
children: e ?? "Cannot compute"
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
function B({ message: e }) {
|
|
258
|
-
return /* @__PURE__ */ s("span", {
|
|
259
|
-
className: "local-error local-tone-error",
|
|
260
|
-
role: "status",
|
|
261
|
-
children: e
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
function V(e, t) {
|
|
265
|
-
let n = Math.max(0, Math.floor(e)), r = Math.floor(n / 60), i = n % 60;
|
|
266
|
-
return r === 0 ? t(`${i} seconds`, `${i} 秒`) : `${r}:${String(i).padStart(2, "0")}`;
|
|
267
|
-
}
|
|
268
|
-
function H(e) {
|
|
269
|
-
return n(e);
|
|
270
|
-
}
|
|
271
|
-
function U(e, t, n = 0) {
|
|
272
|
-
if (!t || n > 64) return "";
|
|
273
|
-
let r = "";
|
|
274
|
-
for (let i of t) switch (i.kind) {
|
|
275
|
-
case "text":
|
|
276
|
-
case "inlineCode":
|
|
277
|
-
case "fallback":
|
|
278
|
-
r += i.text;
|
|
279
|
-
break;
|
|
280
|
-
case "interpolation":
|
|
281
|
-
try {
|
|
282
|
-
let t = O(e.runtime.evaluate(i.text));
|
|
283
|
-
r += t ?? e.locale.t("Cannot compute", "无法计算");
|
|
284
|
-
} catch {
|
|
285
|
-
r += e.locale.t("Cannot compute", "无法计算");
|
|
286
|
-
}
|
|
287
|
-
break;
|
|
288
|
-
case "break":
|
|
289
|
-
r += " ";
|
|
290
|
-
break;
|
|
291
|
-
default: r += U(e, i.children, n + 1);
|
|
292
|
-
}
|
|
293
|
-
return r;
|
|
294
|
-
}
|
|
295
|
-
function W(e, t) {
|
|
296
|
-
return U(e, t.content.children) || t.content.attrs.value || "";
|
|
297
|
-
}
|
|
298
|
-
export { l as A, C, F as D, N as E, p as F, u as I, h as M, m as N, _ as O, f as P, g as S, j as T, E as _, B as a, P as b, M as c, k as d, H as f, y as g, b as h, I as i, d as j, T as k, A as l, U as m, z as n, D as o, V as p, L as r, w as s, R as t, S as u, v, O as w, W as x, x as y };
|