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,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { jsx as
|
|
1
|
+
import { C as e, E as t, I as n, L as r, M as i, P as a, R as o, U as s, V as c, f as l, j as u, l as d, m as f, s as p, u as m, z as h } from "./sdk-core-BoJT1SIt.js";
|
|
2
|
+
import { c as g, s as _ } from "./visuals-BZbZYA7w.js";
|
|
3
|
+
import { useEffect as v, useId as y, useRef as b, useState as x } from "react";
|
|
4
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
5
5
|
// src/components/plot/coordinate.tsx
|
|
6
|
-
function
|
|
7
|
-
let [u,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, [l]),
|
|
11
|
-
h.current !== n && (h.current = n, p ||
|
|
6
|
+
function w({ id: e, label: t, value: n, min: r, max: a, step: o, disabled: s, onCommit: c, reset: l }) {
|
|
7
|
+
let [u, d] = x(() => String(n)), [p, m] = x(!1), h = b(n);
|
|
8
|
+
v(() => {
|
|
9
|
+
d(String(n)), m(!1);
|
|
10
|
+
}, [l]), v(() => {
|
|
11
|
+
h.current !== n && (h.current = n, p || d(String(n)));
|
|
12
12
|
}, [n, p]);
|
|
13
13
|
let g = (e) => {
|
|
14
14
|
let t = e.trim();
|
|
15
15
|
if (t === "" || t === "-" || t === "." || t === "-.") return null;
|
|
16
16
|
let n = Number(t);
|
|
17
|
-
return Number.isFinite(n) ?
|
|
17
|
+
return Number.isFinite(n) ? i(f(n, r, a), r, a, o) : null;
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ C("div", {
|
|
20
20
|
className: "local-number-field",
|
|
21
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ S("label", {
|
|
22
22
|
className: "md-label",
|
|
23
23
|
htmlFor: e,
|
|
24
24
|
children: t
|
|
25
|
-
}), /* @__PURE__ */
|
|
25
|
+
}), /* @__PURE__ */ S("input", {
|
|
26
26
|
id: e,
|
|
27
27
|
className: "md-text-input",
|
|
28
28
|
type: "text",
|
|
@@ -33,93 +33,94 @@ function C({ id: e, label: t, value: n, min: i, max: a, step: o, disabled: s, on
|
|
|
33
33
|
onBlur: () => {
|
|
34
34
|
m(!1);
|
|
35
35
|
let e = g(u);
|
|
36
|
-
|
|
36
|
+
d(String(e ?? n));
|
|
37
37
|
},
|
|
38
38
|
onChange: (e) => {
|
|
39
39
|
let t = e.target.value;
|
|
40
|
-
|
|
40
|
+
d(t);
|
|
41
41
|
let n = g(t);
|
|
42
42
|
n !== null && c(n);
|
|
43
43
|
}
|
|
44
44
|
})]
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
|
|
47
|
+
function T(v) {
|
|
48
|
+
let x = n(v), T = r(v), E = y(), { content: D, mode: O, resetToken: k, t: A } = T, { write: j, writeMany: ee, error: te, setError: ne } = s(v), M = a(v, "label", A("Coordinate", "坐标")), { disabled: N, invalid: re } = o(v), P = c(v), F = t(v, "x-min", "x-max", -5, 5, 1), I = t(v, "y-min", "y-max", -5, 5, 1), L = i(0, F.min, F.max, F.step), R = i(0, I.min, I.max, I.step), z = i(u(v, "x", L), F.min, F.max, F.step), B = i(u(v, "y", R), I.min, I.max, I.step), V = b(null), H = b(!1), U = _();
|
|
49
|
+
h(v, () => ne(null));
|
|
50
50
|
let W = `X: ${z} · Y: ${B}`;
|
|
51
|
-
if (
|
|
51
|
+
if (O === "static") return /* @__PURE__ */ S(m, {
|
|
52
|
+
authorRoot: x(),
|
|
52
53
|
className: "local-coordinate",
|
|
53
|
-
label:
|
|
54
|
+
label: M,
|
|
54
55
|
value: W
|
|
55
56
|
});
|
|
56
|
-
let G = (e) => F.max > F.min ? 40 + (e - F.min) / (F.max - F.min) * 320 : 200, K = (e) => I.max > I.min ? 360 - (e - I.min) / (I.max - I.min) * 320 : 200, q = G(z), J = K(B), Y = G(
|
|
57
|
+
let G = (e) => F.max > F.min ? 40 + (e - F.min) / (F.max - F.min) * 320 : 200, K = (e) => I.max > I.min ? 360 - (e - I.min) / (I.max - I.min) * 320 : 200, q = G(z), J = K(B), Y = G(f(0, F.min, F.max)), X = K(f(0, I.min, I.max)), Z = (e) => {
|
|
57
58
|
let t = e.step * Math.max(1, Math.ceil((e.max - e.min) / (e.step * 10))), n = Math.min(11, Math.floor((e.max - e.min) / t) + 1);
|
|
58
59
|
return Array.from({ length: n }, (n, r) => e.min + r * t);
|
|
59
60
|
}, Q = (e) => {
|
|
60
61
|
let t = V.current?.getBoundingClientRect();
|
|
61
62
|
if (!t || t.width === 0 || t.height === 0) return null;
|
|
62
|
-
let n =
|
|
63
|
+
let n = f(((e.clientX - t.left) / t.width - .1) / .8, 0, 1), r = f(((e.clientY - t.top) / t.height - .1) / .8, 0, 1);
|
|
63
64
|
return {
|
|
64
|
-
x:
|
|
65
|
-
y:
|
|
65
|
+
x: i(F.min + n * (F.max - F.min), F.min, F.max, F.step),
|
|
66
|
+
y: i(I.min + (1 - r) * (I.max - I.min), I.min, I.max, I.step)
|
|
66
67
|
};
|
|
67
68
|
}, $ = (e, t) => {
|
|
68
|
-
(e !== z || t !== B) &&
|
|
69
|
+
(e !== z || t !== B) && ee({
|
|
69
70
|
x: e,
|
|
70
71
|
y: t
|
|
71
72
|
});
|
|
73
|
+
}, ie = (e) => {
|
|
74
|
+
if (N) return;
|
|
75
|
+
let t = z, n = B;
|
|
76
|
+
switch (e.key) {
|
|
77
|
+
case "ArrowLeft":
|
|
78
|
+
t = i(z - F.step, F.min, F.max, F.step);
|
|
79
|
+
break;
|
|
80
|
+
case "ArrowRight":
|
|
81
|
+
t = i(z + F.step, F.min, F.max, F.step);
|
|
82
|
+
break;
|
|
83
|
+
case "ArrowDown":
|
|
84
|
+
n = i(B - I.step, I.min, I.max, I.step);
|
|
85
|
+
break;
|
|
86
|
+
case "ArrowUp":
|
|
87
|
+
n = i(B + I.step, I.min, I.max, I.step);
|
|
88
|
+
break;
|
|
89
|
+
case "Home":
|
|
90
|
+
t = F.min, n = I.min;
|
|
91
|
+
break;
|
|
92
|
+
case "End":
|
|
93
|
+
t = i(F.max, F.min, F.max, F.step), n = i(I.max, I.min, I.max, I.step);
|
|
94
|
+
break;
|
|
95
|
+
default: return;
|
|
96
|
+
}
|
|
97
|
+
e.preventDefault(), e.stopPropagation(), $(t, n);
|
|
72
98
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ C("div", {
|
|
74
100
|
className: "local-coordinate",
|
|
75
|
-
|
|
101
|
+
...x(l(e(D))),
|
|
76
102
|
role: "group",
|
|
77
|
-
"aria-label":
|
|
103
|
+
"aria-label": M,
|
|
78
104
|
"data-rmd-component": "coordinate",
|
|
79
105
|
"aria-invalid": P.invalid || void 0,
|
|
80
106
|
"aria-describedby": P.describedBy,
|
|
81
107
|
children: [
|
|
82
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ S("span", {
|
|
83
109
|
className: "md-label",
|
|
84
|
-
children:
|
|
110
|
+
children: M
|
|
85
111
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ C("div", {
|
|
87
113
|
className: `local-coordinate-surface${U ? " local-mafs-surface" : ""}`,
|
|
88
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ S("div", {
|
|
89
115
|
ref: V,
|
|
90
116
|
className: `local-coordinate-pad${U ? " local-mafs-coordinate" : ""}`,
|
|
91
117
|
role: "group",
|
|
92
|
-
"aria-label":
|
|
93
|
-
"aria-disabled":
|
|
94
|
-
tabIndex:
|
|
95
|
-
onKeyDownCapture:
|
|
96
|
-
if (M) return;
|
|
97
|
-
let t = z, n = B;
|
|
98
|
-
switch (e.key) {
|
|
99
|
-
case "ArrowLeft":
|
|
100
|
-
t = r(z - F.step, F.min, F.max, F.step);
|
|
101
|
-
break;
|
|
102
|
-
case "ArrowRight":
|
|
103
|
-
t = r(z + F.step, F.min, F.max, F.step);
|
|
104
|
-
break;
|
|
105
|
-
case "ArrowDown":
|
|
106
|
-
n = r(B - I.step, I.min, I.max, I.step);
|
|
107
|
-
break;
|
|
108
|
-
case "ArrowUp":
|
|
109
|
-
n = r(B + I.step, I.min, I.max, I.step);
|
|
110
|
-
break;
|
|
111
|
-
case "Home":
|
|
112
|
-
t = F.min, n = I.min;
|
|
113
|
-
break;
|
|
114
|
-
case "End":
|
|
115
|
-
t = r(F.max, F.min, F.max, F.step), n = r(I.max, I.min, I.max, I.step);
|
|
116
|
-
break;
|
|
117
|
-
default: return;
|
|
118
|
-
}
|
|
119
|
-
e.preventDefault(), e.stopPropagation(), $(t, n);
|
|
120
|
-
},
|
|
118
|
+
"aria-label": A(`${M} drag area`, `${M} 拖拽区`),
|
|
119
|
+
"aria-disabled": N || void 0,
|
|
120
|
+
tabIndex: N ? -1 : 0,
|
|
121
|
+
onKeyDownCapture: ie,
|
|
121
122
|
onPointerDown: U ? void 0 : (e) => {
|
|
122
|
-
if (
|
|
123
|
+
if (N) return;
|
|
123
124
|
e.preventDefault(), H.current = !0, V.current?.focus({ preventScroll: !0 });
|
|
124
125
|
try {
|
|
125
126
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
@@ -128,7 +129,7 @@ function w(_) {
|
|
|
128
129
|
t && $(t.x, t.y);
|
|
129
130
|
},
|
|
130
131
|
onPointerMove: U ? void 0 : (e) => {
|
|
131
|
-
if (!H.current ||
|
|
132
|
+
if (!H.current || N) return;
|
|
132
133
|
let t = Q(e);
|
|
133
134
|
t && $(t.x, t.y);
|
|
134
135
|
},
|
|
@@ -141,50 +142,50 @@ function w(_) {
|
|
|
141
142
|
onPointerCancel: U ? void 0 : () => {
|
|
142
143
|
H.current = !1;
|
|
143
144
|
},
|
|
144
|
-
children: U ? /* @__PURE__ */
|
|
145
|
+
children: U ? /* @__PURE__ */ S(g, {
|
|
145
146
|
x: z,
|
|
146
147
|
y: B,
|
|
147
148
|
xRange: F,
|
|
148
149
|
yRange: I,
|
|
149
150
|
step: F.step,
|
|
150
|
-
disabled:
|
|
151
|
+
disabled: N,
|
|
151
152
|
accent: "var(--local-accent, var(--coordinate-point))",
|
|
152
153
|
onMove: $
|
|
153
|
-
}) : /* @__PURE__ */
|
|
154
|
+
}) : /* @__PURE__ */ C("svg", {
|
|
154
155
|
className: "local-coordinate-svg",
|
|
155
156
|
viewBox: "0 0 400 400",
|
|
156
157
|
"aria-hidden": "true",
|
|
157
158
|
focusable: "false",
|
|
158
159
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
id: `${
|
|
160
|
+
/* @__PURE__ */ S("defs", { children: /* @__PURE__ */ S("marker", {
|
|
161
|
+
id: `${E}-coordinate-arrow`,
|
|
161
162
|
markerWidth: "8",
|
|
162
163
|
markerHeight: "8",
|
|
163
164
|
refX: "6",
|
|
164
165
|
refY: "4",
|
|
165
166
|
orient: "auto",
|
|
166
167
|
viewBox: "0 0 8 8",
|
|
167
|
-
children: /* @__PURE__ */
|
|
168
|
+
children: /* @__PURE__ */ S("path", {
|
|
168
169
|
className: "local-coordinate-arrow",
|
|
169
170
|
d: "M1 1 L6 4 L1 7"
|
|
170
171
|
})
|
|
171
172
|
}) }),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ C("g", {
|
|
173
174
|
className: "local-coordinate-grid",
|
|
174
175
|
children: [
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ S("rect", {
|
|
176
177
|
x: "40",
|
|
177
178
|
y: "40",
|
|
178
179
|
width: "320",
|
|
179
180
|
height: "320"
|
|
180
181
|
}),
|
|
181
|
-
Z(F).map((e, t) => /* @__PURE__ */
|
|
182
|
+
Z(F).map((e, t) => /* @__PURE__ */ S("line", {
|
|
182
183
|
x1: G(e),
|
|
183
184
|
y1: "40",
|
|
184
185
|
x2: G(e),
|
|
185
186
|
y2: "360"
|
|
186
187
|
}, `x-${t}`)),
|
|
187
|
-
Z(I).map((e, t) => /* @__PURE__ */
|
|
188
|
+
Z(I).map((e, t) => /* @__PURE__ */ S("line", {
|
|
188
189
|
x1: "40",
|
|
189
190
|
y1: K(e),
|
|
190
191
|
x2: "360",
|
|
@@ -192,57 +193,57 @@ function w(_) {
|
|
|
192
193
|
}, `y-${t}`))
|
|
193
194
|
]
|
|
194
195
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ C("g", {
|
|
196
197
|
className: "local-coordinate-axes",
|
|
197
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ S("line", {
|
|
198
199
|
className: "local-coordinate-horizontal",
|
|
199
200
|
x1: "26",
|
|
200
201
|
y1: X,
|
|
201
202
|
x2: "372",
|
|
202
203
|
y2: X,
|
|
203
|
-
markerEnd: `url(#${
|
|
204
|
-
}), /* @__PURE__ */
|
|
204
|
+
markerEnd: `url(#${E}-coordinate-arrow)`
|
|
205
|
+
}), /* @__PURE__ */ S("line", {
|
|
205
206
|
className: "local-coordinate-vertical",
|
|
206
207
|
x1: Y,
|
|
207
208
|
y1: "374",
|
|
208
209
|
x2: Y,
|
|
209
210
|
y2: "24",
|
|
210
|
-
markerEnd: `url(#${
|
|
211
|
+
markerEnd: `url(#${E}-coordinate-arrow)`
|
|
211
212
|
})]
|
|
212
213
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ C("g", {
|
|
214
215
|
className: "local-coordinate-axis-label",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ S("text", {
|
|
216
217
|
x: "358",
|
|
217
218
|
y: X - 14,
|
|
218
219
|
children: "x"
|
|
219
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ S("text", {
|
|
220
221
|
x: Y + 12,
|
|
221
222
|
y: "40",
|
|
222
223
|
children: "y"
|
|
223
224
|
})]
|
|
224
225
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ C("g", {
|
|
226
227
|
className: "local-coordinate-projection",
|
|
227
|
-
children: [/* @__PURE__ */
|
|
228
|
+
children: [/* @__PURE__ */ S("line", {
|
|
228
229
|
x1: q,
|
|
229
230
|
y1: J,
|
|
230
231
|
x2: q,
|
|
231
232
|
y2: X
|
|
232
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ S("line", {
|
|
233
234
|
x1: q,
|
|
234
235
|
y1: J,
|
|
235
236
|
x2: Y,
|
|
236
237
|
y2: J
|
|
237
238
|
})]
|
|
238
239
|
}),
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ S("circle", {
|
|
240
241
|
className: "local-coordinate-dot",
|
|
241
242
|
cx: q,
|
|
242
243
|
cy: J,
|
|
243
244
|
r: "10"
|
|
244
245
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ S("text", {
|
|
246
247
|
className: "local-coordinate-value",
|
|
247
248
|
x: q,
|
|
248
249
|
y: J > 330 ? J - 22 : J + 30,
|
|
@@ -251,42 +252,42 @@ function w(_) {
|
|
|
251
252
|
})
|
|
252
253
|
]
|
|
253
254
|
})
|
|
254
|
-
}), /* @__PURE__ */
|
|
255
|
+
}), /* @__PURE__ */ S("span", {
|
|
255
256
|
className: "local-coordinate-caption",
|
|
256
|
-
children:
|
|
257
|
+
children: A("Draggable coordinate plane", "可拖动的坐标平面")
|
|
257
258
|
})]
|
|
258
259
|
}),
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ S("span", {
|
|
260
261
|
className: "md-hint local-hint",
|
|
261
|
-
children:
|
|
262
|
+
children: A("Arrow keys adjust the point; Home and End jump to the lower or upper bounds.", "方向键调整坐标;Home 和 End 跳到最小或最大边界。")
|
|
262
263
|
}),
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ C("div", {
|
|
264
265
|
className: "local-coordinate-fields",
|
|
265
|
-
children: [/* @__PURE__ */
|
|
266
|
-
id: `${
|
|
267
|
-
reset:
|
|
268
|
-
label: `${
|
|
266
|
+
children: [/* @__PURE__ */ S(w, {
|
|
267
|
+
id: `${E}-coordinate-x`,
|
|
268
|
+
reset: k,
|
|
269
|
+
label: `${M} X`,
|
|
269
270
|
value: z,
|
|
270
271
|
min: F.min,
|
|
271
272
|
max: F.max,
|
|
272
273
|
step: F.step,
|
|
273
|
-
disabled:
|
|
274
|
-
onCommit: (e) =>
|
|
275
|
-
}), /* @__PURE__ */
|
|
276
|
-
id: `${
|
|
277
|
-
reset:
|
|
278
|
-
label: `${
|
|
274
|
+
disabled: N,
|
|
275
|
+
onCommit: (e) => j(e, "x")
|
|
276
|
+
}), /* @__PURE__ */ S(w, {
|
|
277
|
+
id: `${E}-coordinate-y`,
|
|
278
|
+
reset: k,
|
|
279
|
+
label: `${M} Y`,
|
|
279
280
|
value: B,
|
|
280
281
|
min: I.min,
|
|
281
282
|
max: I.max,
|
|
282
283
|
step: I.step,
|
|
283
|
-
disabled:
|
|
284
|
-
onCommit: (e) =>
|
|
284
|
+
disabled: N,
|
|
285
|
+
onCommit: (e) => j(e, "y")
|
|
285
286
|
})]
|
|
286
287
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ S(d, { value: W }),
|
|
289
|
+
/* @__PURE__ */ S(p, { message: re ? A("Cannot compute", "无法计算") : te })
|
|
289
290
|
]
|
|
290
291
|
});
|
|
291
292
|
}
|
|
292
|
-
export {
|
|
293
|
+
export { T as t };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { rt as e } from "./preset-core-CKc5YXSM.js";
|
|
2
|
-
import { t } from "./compile-
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as
|
|
2
|
+
import { t } from "./compile-wUv8KEge.js";
|
|
3
|
+
import { I as n, L as r, P as i } from "./sdk-core-BoJT1SIt.js";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
5
|
// src/components/table/data-table.tsx
|
|
6
|
-
var
|
|
6
|
+
var s = class extends Error {
|
|
7
7
|
failure;
|
|
8
8
|
constructor(e) {
|
|
9
9
|
super(e), this.name = "DataTableFailureError", this.failure = e;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function c(e) {
|
|
13
13
|
return e === null ? "" : typeof e == "string" ? e : typeof e == "number" ? Number.isFinite(e) ? String(e) : null : typeof e == "boolean" ? e ? "true" : "false" : null;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function l(e) {
|
|
16
16
|
return typeof e == "string" ? e === "" ? null : `s:${e}` : typeof e == "number" && Number.isFinite(e) ? `n:${e === 0 ? 0 : e}` : null;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function u(e, t, n) {
|
|
19
19
|
let r = { ...n };
|
|
20
20
|
for (let i of t) Object.hasOwn(n, i) || Object.defineProperty(r, i, {
|
|
21
21
|
enumerable: !0,
|
|
@@ -26,34 +26,34 @@ function l(e, t, n) {
|
|
|
26
26
|
});
|
|
27
27
|
return r;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function d(e) {
|
|
30
30
|
if (e.length === 0) return null;
|
|
31
31
|
let t = typeof e[0];
|
|
32
32
|
if (t !== "string" && t !== "number") return "rows";
|
|
33
33
|
for (let n of e) if (typeof n !== t || typeof n == "number" && !Number.isFinite(n)) return "rows";
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function f(e, n) {
|
|
37
37
|
let r;
|
|
38
38
|
try {
|
|
39
39
|
r = t(n);
|
|
40
40
|
} catch {
|
|
41
|
-
throw new
|
|
41
|
+
throw new s("rows");
|
|
42
42
|
}
|
|
43
43
|
let i;
|
|
44
44
|
try {
|
|
45
|
-
i = r.evaluate(
|
|
45
|
+
i = r.evaluate(u(e, r.dependencies, {}));
|
|
46
46
|
} catch {
|
|
47
|
-
throw new
|
|
47
|
+
throw new s("rows");
|
|
48
48
|
}
|
|
49
|
-
if (!Array.isArray(i)) throw new
|
|
50
|
-
let a =
|
|
51
|
-
if (a) throw new
|
|
49
|
+
if (!Array.isArray(i)) throw new s("rows");
|
|
50
|
+
let a = d(i);
|
|
51
|
+
if (a) throw new s(a);
|
|
52
52
|
return i;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
let { rows: n, columns: r, keyExpression: i, runtime: a } = e,
|
|
56
|
-
if (!Number.isSafeInteger(
|
|
54
|
+
function p(e) {
|
|
55
|
+
let { rows: n, columns: r, keyExpression: i, runtime: a } = e, o = e.maxRows ?? 100, f = e.budget ?? 1e5;
|
|
56
|
+
if (!Number.isSafeInteger(o) || o <= 0 || o > 1e3) return {
|
|
57
57
|
ok: !1,
|
|
58
58
|
failure: "max-rows"
|
|
59
59
|
};
|
|
@@ -61,12 +61,12 @@ function f(e) {
|
|
|
61
61
|
ok: !1,
|
|
62
62
|
failure: "columns"
|
|
63
63
|
};
|
|
64
|
-
let p =
|
|
64
|
+
let p = d(n);
|
|
65
65
|
if (p) return {
|
|
66
66
|
ok: !1,
|
|
67
67
|
failure: p
|
|
68
68
|
};
|
|
69
|
-
if (n.length >
|
|
69
|
+
if (n.length > o) return {
|
|
70
70
|
ok: !1,
|
|
71
71
|
failure: "rows-budget"
|
|
72
72
|
};
|
|
@@ -103,7 +103,7 @@ function f(e) {
|
|
|
103
103
|
failure: "text-budget"
|
|
104
104
|
};
|
|
105
105
|
let v = (e) => {
|
|
106
|
-
if (_ += e, _ > f) throw new
|
|
106
|
+
if (_ += e, _ > f) throw new s("text-budget");
|
|
107
107
|
}, y = /* @__PURE__ */ new Set(), b = [];
|
|
108
108
|
try {
|
|
109
109
|
for (let e = 0; e < n.length; e += 1) {
|
|
@@ -112,7 +112,7 @@ function f(e) {
|
|
|
112
112
|
index: e
|
|
113
113
|
}, r = null;
|
|
114
114
|
try {
|
|
115
|
-
r =
|
|
115
|
+
r = l(m.evaluate(t));
|
|
116
116
|
} catch {
|
|
117
117
|
return {
|
|
118
118
|
ok: !1,
|
|
@@ -135,7 +135,7 @@ function f(e) {
|
|
|
135
135
|
}
|
|
136
136
|
let n = null;
|
|
137
137
|
try {
|
|
138
|
-
n =
|
|
138
|
+
n = c(e.expression.evaluate(u(a, e.expression.dependencies, t)));
|
|
139
139
|
} catch {
|
|
140
140
|
n = null;
|
|
141
141
|
}
|
|
@@ -153,7 +153,7 @@ function f(e) {
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
} catch (e) {
|
|
156
|
-
return e instanceof
|
|
156
|
+
return e instanceof s ? {
|
|
157
157
|
ok: !1,
|
|
158
158
|
failure: e.failure
|
|
159
159
|
} : {
|
|
@@ -170,7 +170,7 @@ function f(e) {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function m(t, n) {
|
|
174
174
|
switch (n) {
|
|
175
175
|
case "label": return t("Data table requires a label.", "数据表需要标签。");
|
|
176
176
|
case "columns": return t("Data table requires between 1 and 20 column definitions.", "数据表需要 1 到 20 个列定义。");
|
|
@@ -181,28 +181,28 @@ function p(t, n) {
|
|
|
181
181
|
case "text-budget": return t("The table content exceeds the text budget.", "数据表内容超过文本上限。");
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
var
|
|
185
|
-
function
|
|
184
|
+
var h = /^\s*\{\{([\s\S]*)\}\}\s*$/;
|
|
185
|
+
function g(e) {
|
|
186
186
|
if (e === void 0) return null;
|
|
187
|
-
let t =
|
|
187
|
+
let t = h.exec(e), n = t ? t[1].trim() : "";
|
|
188
188
|
return n === "" ? null : n;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function _(e) {
|
|
191
191
|
return e.kind === "comment" || e.kind === "text" && e.text.trim() === "" || e.kind === "paragraph" && e.children.length === 0 && e.text.trim() === "";
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
let t =
|
|
193
|
+
function v(e) {
|
|
194
|
+
let t = i(e, "label", "").trim();
|
|
195
195
|
if (t === "") return {
|
|
196
196
|
ok: !1,
|
|
197
197
|
failure: "label"
|
|
198
198
|
};
|
|
199
|
-
let n =
|
|
199
|
+
let n = g(e.content.attrs.rows);
|
|
200
200
|
if (!n) return {
|
|
201
201
|
ok: !1,
|
|
202
202
|
failure: "rows"
|
|
203
203
|
};
|
|
204
|
-
let
|
|
205
|
-
if (!
|
|
204
|
+
let r = g(e.content.attrs.key);
|
|
205
|
+
if (!r) return {
|
|
206
206
|
ok: !1,
|
|
207
207
|
failure: "key"
|
|
208
208
|
};
|
|
@@ -211,14 +211,14 @@ function _(e) {
|
|
|
211
211
|
ok: !1,
|
|
212
212
|
failure: "max-rows"
|
|
213
213
|
};
|
|
214
|
-
let s = e.content.children.filter((e) => !
|
|
214
|
+
let s = e.content.children.filter((e) => !_(e)), c = [];
|
|
215
215
|
for (let e of s) {
|
|
216
|
-
let t = e.children.filter((e) => !
|
|
216
|
+
let t = e.children.filter((e) => !_(e));
|
|
217
217
|
if (e.kind !== "component" || e.name !== "column" || t.length > 0) return {
|
|
218
218
|
ok: !1,
|
|
219
219
|
failure: "columns"
|
|
220
220
|
};
|
|
221
|
-
let n = (e.attrs.label ?? "").trim(), r =
|
|
221
|
+
let n = (e.attrs.label ?? "").trim(), r = g(e.attrs.value);
|
|
222
222
|
if (n === "" || !r) return {
|
|
223
223
|
ok: !1,
|
|
224
224
|
failure: "columns"
|
|
@@ -236,58 +236,61 @@ function _(e) {
|
|
|
236
236
|
table: {
|
|
237
237
|
label: t,
|
|
238
238
|
rows: n,
|
|
239
|
-
key:
|
|
239
|
+
key: r,
|
|
240
240
|
maxRows: o,
|
|
241
241
|
columns: c
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
let t = n(e), r =
|
|
247
|
-
if (!
|
|
245
|
+
function y(e) {
|
|
246
|
+
let t = n(e), i = r(e), c = v(e);
|
|
247
|
+
if (!c.ok) return /* @__PURE__ */ a("div", {
|
|
248
|
+
...t(),
|
|
248
249
|
className: "local-error local-data-table-error",
|
|
249
250
|
role: "alert",
|
|
250
|
-
children:
|
|
251
|
+
children: m(i.t, c.failure)
|
|
251
252
|
});
|
|
252
|
-
let
|
|
253
|
+
let l = { evaluate: (t) => e.runtime.evaluate(t) }, u;
|
|
253
254
|
try {
|
|
254
|
-
|
|
255
|
-
rows:
|
|
256
|
-
columns:
|
|
257
|
-
keyExpression:
|
|
258
|
-
maxRows:
|
|
259
|
-
runtime:
|
|
255
|
+
u = p({
|
|
256
|
+
rows: f(l, c.table.rows),
|
|
257
|
+
columns: c.table.columns,
|
|
258
|
+
keyExpression: c.table.key,
|
|
259
|
+
maxRows: c.table.maxRows,
|
|
260
|
+
runtime: l
|
|
260
261
|
});
|
|
261
262
|
} catch (e) {
|
|
262
|
-
|
|
263
|
+
u = {
|
|
263
264
|
ok: !1,
|
|
264
|
-
failure: e instanceof
|
|
265
|
+
failure: e instanceof s ? e.failure : "rows"
|
|
265
266
|
};
|
|
266
267
|
}
|
|
267
|
-
if (!
|
|
268
|
+
if (!u.ok) return /* @__PURE__ */ a("div", {
|
|
269
|
+
...t(),
|
|
268
270
|
className: "local-error local-data-table-error",
|
|
269
271
|
role: "alert",
|
|
270
|
-
children:
|
|
272
|
+
children: m(i.t, u.failure)
|
|
271
273
|
});
|
|
272
|
-
let { model:
|
|
273
|
-
return /* @__PURE__ */
|
|
274
|
+
let { model: d } = u;
|
|
275
|
+
return /* @__PURE__ */ a("div", {
|
|
276
|
+
...t(),
|
|
274
277
|
className: "md-table-scroll local-data-table-scroll",
|
|
275
278
|
"data-local-data-table": "",
|
|
276
|
-
children: /* @__PURE__ */
|
|
279
|
+
children: /* @__PURE__ */ o("table", {
|
|
277
280
|
className: "md-table local-data-table",
|
|
278
|
-
"aria-label":
|
|
279
|
-
children: [/* @__PURE__ */
|
|
281
|
+
"aria-label": c.table.label,
|
|
282
|
+
children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: d.columns.map((e, t) => /* @__PURE__ */ a("th", {
|
|
280
283
|
scope: "col",
|
|
281
284
|
children: e
|
|
282
|
-
}, `column-${t}`)) }) }), /* @__PURE__ */
|
|
285
|
+
}, `column-${t}`)) }) }), /* @__PURE__ */ a("tbody", { children: d.empty ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", {
|
|
283
286
|
className: "local-data-table-empty",
|
|
284
|
-
colSpan:
|
|
285
|
-
children:
|
|
286
|
-
}) }) :
|
|
287
|
+
colSpan: d.columns.length,
|
|
288
|
+
children: i.t("No rows", "没有数据")
|
|
289
|
+
}) }) : d.rows.map((e) => /* @__PURE__ */ a("tr", { children: e.cells.map((e, t) => /* @__PURE__ */ a("td", { children: e.ok ? e.text : /* @__PURE__ */ a("span", {
|
|
287
290
|
className: "local-error local-data-table-cell-error",
|
|
288
|
-
children:
|
|
289
|
-
}) }, `cell-${
|
|
291
|
+
children: i.t("Cannot compute", "无法计算")
|
|
292
|
+
}) }, `cell-${t}`)) }, e.key)) })]
|
|
290
293
|
})
|
|
291
294
|
});
|
|
292
295
|
}
|
|
293
|
-
export {
|
|
296
|
+
export { y as t };
|