reactive-md 0.9.1 → 0.9.2
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 +333 -319
- package/CHANGELOG.md +334 -320
- package/CONTRIBUTING-ch.md +22 -22
- package/CONTRIBUTING.md +22 -22
- package/README-ch.md +431 -431
- package/README-en.md +431 -431
- package/README.md +429 -429
- package/SECURITY-ch.md +83 -83
- package/SECURITY.md +83 -83
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -445
- package/cli/check.mjs +444 -444
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +323 -323
- package/cli/init.mjs +1577 -1577
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +65 -65
- package/cli/migrate.mjs +368 -368
- package/cli/package-loader.mjs +41 -41
- package/cli/package.mjs +211 -211
- package/dist-library/{LocalDocumentView-sthUP0ct.js → LocalDocumentView-BuqgJZEY.js} +11 -11
- package/dist-library/{LocalDocumentViewCore-GiWV3bey.js → LocalDocumentViewCore-DXE0I0Qc.js} +210 -209
- package/dist-library/{LocalReactiveDocumentCore-ZjQSGyHE.js → LocalReactiveDocumentCore-CWBe4Mm5.js} +8 -8
- package/dist-library/{authoring-Dsune4Hy.js → authoring-Ci_KzJ0q.js} +53 -53
- package/dist-library/{compile-wUv8KEge.js → compile-Dx6Uw3D9.js} +11 -11
- package/dist-library/{compiler-core-As_m-MNm.js → compiler-core-DDDdvuLy.js} +883 -818
- package/dist-library/compiler-dxLPB9Ym.js +86 -0
- package/dist-library/{component-state-C52ZFJGl.js → component-state-BRwvTV0d.js} +15 -14
- package/dist-library/component-state-CwKX_SN5.js +763 -0
- package/dist-library/{config-BadfhjdP.js → config-DXLvctiZ.js} +68 -66
- package/dist-library/config-validation-D3D7Dy2J.js +586 -0
- package/dist-library/{controls-CcT6n7k_.js → controls-DoZyLCrV.js} +3 -3
- package/dist-library/{coordinate-CWS9p5q_.js → coordinate-B1VFK9fd.js} +2 -2
- package/dist-library/{data-table-Bgccxd7h.js → data-table-8-3F15Jf.js} +3 -3
- package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
- package/dist-library/{display-B-VhqVND.js → display-B_uutKkN.js} +1 -1
- package/dist-library/{config-validation-F47AcE6o.js → document-theme-C8J6UyNO.js} +193 -731
- package/dist-library/{export-BqVmTXm8.js → export-CIAIPBov.js} +35 -34
- package/dist-library/{gallery-CY6mTx8i.js → gallery-Dv1rOvL0.js} +1 -1
- package/dist-library/{html-CNT4KD-2.js → html-Cr4CBwAH.js} +42 -41
- package/dist-library/identity-BUx0Q_-d.js +40 -0
- package/dist-library/{incremental-Dv0FSp_U.js → incremental-9nx92u9c.js} +12 -10
- package/dist-library/{layout-C0YlEPGr.js → layout-BBB2VF0S.js} +1 -1
- package/dist-library/{mount-preset-KxvtKgJb.js → mount-preset-DMZ5wd3t.js} +3 -3
- package/dist-library/observability-4KqXhIEU.js +421 -0
- package/dist-library/observability-core-Bcu7vpnl.js +24 -0
- package/dist-library/{options-1aDLK7JY.js → options-BBp9IcHm.js} +4 -4
- package/dist-library/{package-core-WFK1RhAZ.js → package-core-K5xesGqy.js} +30 -29
- package/dist-library/{parser-standard-Yuf3A_VI.js → parser-standard-CBA1-hdG.js} +352 -352
- package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
- package/dist-library/preset-core-DeZPA8IE.js +1298 -0
- package/dist-library/react-0DCh-Mar.js +7 -0
- package/dist-library/reactive-md-authoring.js +19 -19
- package/dist-library/reactive-md-build.js +48 -10
- package/dist-library/reactive-md-compiler-standard.js +6 -6
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +3 -2
- package/dist-library/reactive-md-default-preset.js +3 -2
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-preset.js +2 -2
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-observability.js +4 -0
- package/dist-library/reactive-md-plugin-chart.js +3 -3
- package/dist-library/reactive-md-plugin-data.js +5 -5
- package/dist-library/reactive-md-plugin-diagram.js +4 -4
- package/dist-library/reactive-md-plugin-forms.js +4 -4
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +3 -3
- package/dist-library/reactive-md-plugin-network.js +4 -3
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-print.css +304 -304
- 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 +11 -11
- package/dist-library/reactive-md-react.js +11 -11
- package/dist-library/reactive-md-runtime-browser.js +2 -1
- package/dist-library/reactive-md-runtime.js +4 -3
- package/dist-library/reactive-md-sdk.js +8 -7
- 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 +5 -5
- package/dist-library/reactive-md.js +556 -367
- package/dist-library/{registry-B9NGct4d.js → registry-D6OGkOcX.js} +3 -3
- package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
- package/dist-library/{resources-D2GDQS0p.js → resources-B0x_w3s9.js} +71 -46
- package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
- package/dist-library/{runtime-kcA7bG7G.js → runtime-BpQdZmFI.js} +311 -305
- package/dist-library/{schema-BufhKUSM.js → schema-BryM_VRW.js} +14 -14
- package/dist-library/{sdk-core-BoJT1SIt.js → sdk-core-ChslheKs.js} +33 -32
- package/dist-library/{session-core-nmJHuR9c.js → session-core-dxQCJBNa.js} +15 -14
- package/dist-library/{shareable-DpbE-59H.js → shareable-B8xMoGEa.js} +179 -176
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/local/index.d.ts +6 -0
- package/dist-library/types/local/observability-codes.d.ts +2 -0
- package/dist-library/types/local/observability-core.d.ts +25 -0
- package/dist-library/types/local/observability-messages.d.ts +6 -0
- package/dist-library/types/local/observability.d.ts +43 -0
- package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
- package/dist-library/types/local/transport/worker.d.ts +52 -1
- package/dist-library/types/local/types.d.ts +8 -0
- package/dist-library/types/observability.d.ts +7 -0
- package/dist-library/{types-BeNtPqdY.js → types-Ib5kSScP.js} +1 -1
- package/dist-library/types-daDo2c_w.js +3 -0
- package/dist-library/{validation-BEBA_HvS.js → validation-B3RI0xOk.js} +251 -249
- package/dist-library/version-DAxuGOG2.js +147 -0
- package/dist-library/{visual-frame-CyV1FXzs.js → visual-frame-_rcd5HUv.js} +1 -1
- package/dist-library/{visuals-BZbZYA7w.js → visuals-DkDhNdEZ.js} +17 -17
- package/dist-standalone/reactive-md-standalone.js +118 -118
- package/docs/README-ch.md +101 -95
- package/docs/README.md +101 -95
- package/docs/compatibility/api-stability-ch.md +25 -0
- package/docs/compatibility/api-stability-en.md +25 -0
- package/docs/compatibility/compatibility-ch.md +146 -129
- package/docs/compatibility/compatibility-en.md +146 -129
- package/docs/compatibility/compatibility-manifest.schema.json +161 -0
- package/docs/compatibility/deprecation-ch.md +21 -0
- package/docs/compatibility/deprecation-en.md +21 -0
- package/docs/compatibility/source-versioning-ch.md +162 -162
- package/docs/compatibility/source-versioning-en.md +162 -162
- package/docs/compatibility/support-matrix-ch.md +108 -0
- package/docs/compatibility/support-matrix-en.md +108 -0
- package/docs/development/component-development-ch.md +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +253 -253
- package/docs/development/component-development-reference-en.md +238 -238
- package/docs/development/component-protocol-ch.md +748 -748
- package/docs/development/component-protocol-en.md +750 -750
- package/docs/development/extension-tutorial-ch.md +308 -308
- package/docs/development/extension-tutorial-en.md +308 -308
- package/docs/development/performance-overview-ch.md +422 -422
- package/docs/development/performance-overview-en.md +422 -422
- package/docs/guides/local-guide-ch.md +532 -532
- package/docs/guides/local-guide-en.md +532 -532
- package/docs/integration/author-tools-ch.md +64 -64
- package/docs/integration/author-tools-en.md +64 -64
- package/docs/integration/compiler-ch.md +49 -49
- package/docs/integration/compiler-en.md +36 -36
- package/docs/integration/directory-discovery-en.md +1 -1
- package/docs/integration/editor-ch.md +295 -295
- package/docs/integration/editor-en.md +303 -303
- package/docs/integration/extension-sdk-ch.md +394 -394
- package/docs/integration/extension-sdk-en.md +379 -379
- package/docs/integration/local-integration-ch.md +646 -646
- package/docs/integration/local-integration-en.md +662 -662
- package/docs/integration/shareable-export-ch.md +307 -307
- package/docs/integration/shareable-export-en.md +309 -309
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -104
- package/docs/reference/html-compatibility-ch.md +93 -93
- package/docs/reference/html-compatibility-en.md +95 -95
- package/docs/reference/local-interaction-syntax-ch.md +724 -724
- package/docs/reference/local-interaction-syntax-en.md +722 -722
- package/docs/reference/public-api-ch.md +33 -4
- package/docs/reference/public-api-en.md +33 -4
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.4.0-ch.md +91 -91
- package/docs/releases/release-0.4.0-en.md +91 -91
- package/docs/releases/release-0.4.1-ch.md +25 -25
- package/docs/releases/release-0.4.1-en.md +25 -25
- package/docs/releases/release-0.5.0-ch.md +43 -43
- package/docs/releases/release-0.5.0-en.md +43 -43
- package/docs/releases/release-0.5.1-ch.md +41 -41
- package/docs/releases/release-0.5.1-en.md +41 -41
- package/docs/releases/release-0.5.2-ch.md +37 -37
- package/docs/releases/release-0.5.2-en.md +37 -37
- package/docs/releases/release-0.5.3-ch.md +26 -26
- package/docs/releases/release-0.5.3-en.md +26 -26
- package/docs/releases/release-0.6.0-ch.md +59 -59
- package/docs/releases/release-0.6.0-en.md +59 -59
- package/docs/releases/release-0.6.1-ch.md +29 -29
- package/docs/releases/release-0.6.1-en.md +29 -29
- package/docs/releases/release-0.7.0-ch.md +86 -86
- package/docs/releases/release-0.7.0-en.md +86 -86
- package/docs/releases/release-0.9.2-ch.md +33 -0
- package/docs/releases/release-0.9.2-en.md +33 -0
- package/examples/component-package/README-ch.md +101 -101
- package/examples/component-package/README.md +133 -133
- package/examples/conformance/README-ch.md +55 -55
- package/examples/conformance/README.md +55 -55
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/game-2048-package/LICENSE +21 -21
- package/examples/game-2048-package/NOTICES.md +11 -11
- package/examples/game-2048-package/README-ch.md +91 -91
- package/examples/game-2048-package/README.md +98 -98
- package/examples/game-2048-package/package.json +35 -35
- package/examples/game-2048-package/sample/document.reactive.md +17 -17
- package/examples/game-2048-package/scripts/build-export.mjs +44 -44
- package/examples/game-2048-package/scripts/build.mjs +130 -130
- package/examples/game-2048-package/scripts/verify.mjs +180 -180
- package/examples/game-2048-package/src/component.css +161 -161
- package/examples/game-2048-package/src/components.tsx +326 -326
- package/examples/game-2048-package/src/game-engine.ts +228 -228
- package/examples/game-2048-package/src/harness.tsx +34 -34
- package/examples/game-2048-package/src/manifest.ts +85 -85
- package/examples/game-2048-package/src/node-entry.ts +30 -30
- package/examples/game-2048-package/src/sample.ts +4 -4
- package/examples/game-2048-package/tsconfig.json +15 -15
- package/examples/integration/README-ch.md +82 -82
- package/examples/integration/README.md +82 -82
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/extension-sdk/README-ch.md +24 -24
- package/examples/integration/extension-sdk/README.md +24 -24
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README-ch.md +76 -76
- package/examples/local/README.md +76 -76
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README-ch.md +22 -22
- package/examples/local/showcase/README.md +31 -31
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/examples/minimal-extension/README-ch.md +78 -78
- package/examples/minimal-extension/README.md +78 -78
- package/examples/minimal-extension/index.html +15 -15
- package/examples/minimal-extension/package.json +26 -26
- package/examples/minimal-extension/sample/document.reactive.md +10 -10
- package/examples/minimal-extension/scripts/build.mjs +32 -32
- package/examples/minimal-extension/scripts/export.mjs +72 -72
- package/examples/minimal-extension/scripts/test-node.mjs +75 -75
- package/examples/minimal-extension/src/extension.tsx +90 -90
- package/examples/minimal-extension/src/preview.tsx +12 -12
- package/examples/minimal-extension/src/source.ts +4 -4
- package/examples/minimal-extension/tsconfig.json +14 -14
- package/examples/sci-fi-theme/README-ch.md +133 -133
- package/examples/sci-fi-theme/README.md +148 -148
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
- package/examples/sci-fi-theme/demo/demo.css +638 -638
- package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
- package/examples/sci-fi-theme/demo/index.html +13 -13
- package/examples/sci-fi-theme/demo/main.tsx +215 -215
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
- package/examples/sci-fi-theme/docs/design-system.md +474 -474
- package/examples/sci-fi-theme/package.json +28 -28
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
- package/examples/sci-fi-theme/src/components.css +2370 -2370
- package/examples/sci-fi-theme/src/index.ts +6 -6
- package/examples/sci-fi-theme/src/notch.css +142 -142
- package/examples/sci-fi-theme/src/sci-fi.css +7 -7
- package/examples/sci-fi-theme/src/theme.ts +39 -39
- package/examples/sci-fi-theme/tsconfig.json +20 -20
- package/examples/sci-fi-theme/vite.config.ts +24 -24
- package/examples/tetris-package/LICENSE +21 -21
- package/examples/tetris-package/NOTICES.md +11 -11
- package/examples/tetris-package/README-ch.md +91 -91
- package/examples/tetris-package/README.md +95 -95
- package/examples/tetris-package/package.json +35 -35
- package/examples/tetris-package/sample/document.reactive.md +16 -16
- package/examples/tetris-package/scripts/build-export.mjs +44 -44
- package/examples/tetris-package/scripts/build.mjs +130 -130
- package/examples/tetris-package/scripts/verify.mjs +173 -173
- package/examples/tetris-package/src/component.css +145 -145
- package/examples/tetris-package/src/components.tsx +334 -334
- package/examples/tetris-package/src/harness.tsx +34 -34
- package/examples/tetris-package/src/manifests.ts +93 -93
- package/examples/tetris-package/src/node-entry.ts +16 -16
- package/examples/tetris-package/src/sample.ts +4 -4
- package/examples/tetris-package/src/tetris-engine.ts +325 -325
- package/examples/tetris-package/tsconfig.json +15 -15
- package/package.json +7 -1
- package/dist-library/compiler-eOfcinZs.js +0 -62
- package/dist-library/component-state-BoLCGee4.js +0 -801
- package/dist-library/preset-core-CKc5YXSM.js +0 -1443
- package/dist-library/react-D5iGiUdL.js +0 -7
|
@@ -1,121 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a, c as o, r as s, s as c, t as l } from "./compile-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { j as e } from "./version-DAxuGOG2.js";
|
|
2
|
+
import { _ as t, l as n, o as r, y as i } from "./document-theme-C8J6UyNO.js";
|
|
3
|
+
import { a, c as o, r as s, s as c, t as l } from "./compile-Dx6Uw3D9.js";
|
|
4
|
+
import { a as u, c as d, h as f, i as p, l as ee, n as m, o as h, p as g, r as _, t as v, u as y } from "./validation-B3RI0xOk.js";
|
|
5
|
+
import { n as b, t as x } from "./types-daDo2c_w.js";
|
|
6
|
+
import { i as S } from "./registry-core-C9xOunaw.js";
|
|
7
|
+
import { t as C } from "./registry-D6OGkOcX.js";
|
|
8
|
+
import { x as te } from "./component-state-CwKX_SN5.js";
|
|
9
|
+
import { i as ne, t as w } from "./identity-BUx0Q_-d.js";
|
|
10
|
+
import { n as T } from "./runtime-BDnnimPA.js";
|
|
9
11
|
// src/local/runtime/runtime-values.ts
|
|
10
|
-
function
|
|
12
|
+
function E(e, t) {
|
|
11
13
|
return e.attrs?.[t];
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
let n =
|
|
15
|
+
function D(e, t) {
|
|
16
|
+
let n = E(e, t);
|
|
15
17
|
if (n === "true") return !0;
|
|
16
18
|
if (n === "false") return !1;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
let n =
|
|
20
|
+
function O(e, t) {
|
|
21
|
+
let n = E(e, t);
|
|
20
22
|
if (n === void 0) return;
|
|
21
23
|
let r = Number(n);
|
|
22
24
|
return Number.isFinite(r) ? r : void 0;
|
|
23
25
|
}
|
|
24
|
-
function
|
|
26
|
+
function k(e) {
|
|
25
27
|
return t(e);
|
|
26
28
|
}
|
|
27
|
-
function
|
|
29
|
+
function A(e, t) {
|
|
28
30
|
return {
|
|
29
31
|
ok: !1,
|
|
30
|
-
detail:
|
|
32
|
+
detail: n(e, t)
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
if (t !== void 0) return
|
|
35
|
+
function j(e, t) {
|
|
36
|
+
if (t !== void 0) return E(e, t);
|
|
35
37
|
}
|
|
36
|
-
function
|
|
37
|
-
if (t !== void 0) return
|
|
38
|
+
function M(e, t) {
|
|
39
|
+
if (t !== void 0) return O(e, t);
|
|
38
40
|
}
|
|
39
|
-
function
|
|
41
|
+
function N(t, n, r, i = {}) {
|
|
40
42
|
for (let a of r) if (a.kind === "date") {
|
|
41
|
-
if (!
|
|
42
|
-
let e = i.required ?? (a.required !== void 0 &&
|
|
43
|
-
if (n === "" && e) return
|
|
44
|
-
let r = i.min ??
|
|
45
|
-
if (n !== "" && r && n < r) return
|
|
46
|
-
if (n !== "" && o && n > o) return
|
|
43
|
+
if (!S(n)) return A("local.runtime.value.date-invalid");
|
|
44
|
+
let e = i.required ?? (a.required !== void 0 && D(t, a.required) === !0);
|
|
45
|
+
if (n === "" && e) return A("local.runtime.value.date-required");
|
|
46
|
+
let r = i.min ?? j(t, a.min), o = i.max ?? j(t, a.max);
|
|
47
|
+
if (n !== "" && r && n < r) return A("local.runtime.value.date-earlier", { min: r });
|
|
48
|
+
if (n !== "" && o && n > o) return A("local.runtime.value.date-later", { max: o });
|
|
47
49
|
} else if (a.kind === "required") {
|
|
48
|
-
let e = i.required ??
|
|
49
|
-
if (n === "" && e) return
|
|
50
|
+
let e = i.required ?? D(t, a.required) === !0;
|
|
51
|
+
if (n === "" && e) return A("local.runtime.value.field-required");
|
|
50
52
|
} else if (a.kind === "length") {
|
|
51
|
-
let e =
|
|
52
|
-
if (r !== void 0 && r > 0 && n !== "" && e < r) return
|
|
53
|
-
if (i !== void 0 && e > i) return
|
|
54
|
-
} else if (a.kind === "email" && (
|
|
55
|
-
if (n.length > 254) return
|
|
56
|
-
if (!e(n)) return
|
|
53
|
+
let e = k(n), r = M(t, a.min), i = M(t, a.max);
|
|
54
|
+
if (r !== void 0 && r > 0 && n !== "" && e < r) return A("local.runtime.value.min-length", { min: r });
|
|
55
|
+
if (i !== void 0 && e > i) return A("local.runtime.value.max-length", { max: i });
|
|
56
|
+
} else if (a.kind === "email" && (j(t, a.type) ?? "text") === a.value && n !== "") {
|
|
57
|
+
if (n.length > 254) return A("local.runtime.value.email-length", { limit: 254 });
|
|
58
|
+
if (!e(n)) return A("local.runtime.value.email-invalid");
|
|
57
59
|
}
|
|
58
60
|
return {
|
|
59
61
|
ok: !0,
|
|
60
62
|
value: n
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
|
-
var
|
|
64
|
-
function
|
|
65
|
-
if (!e.name) return
|
|
66
|
-
let t =
|
|
67
|
-
if (t !== void 0) return t ??
|
|
68
|
-
let n =
|
|
69
|
-
return
|
|
65
|
+
var P = /* @__PURE__ */ new Map();
|
|
66
|
+
function F(e) {
|
|
67
|
+
if (!e.name) return I;
|
|
68
|
+
let t = P.get(e.name);
|
|
69
|
+
if (t !== void 0) return t ?? I;
|
|
70
|
+
let n = C(e.name), r = n ? f(n) : I;
|
|
71
|
+
return P.set(e.name, n ? r : null), r;
|
|
70
72
|
}
|
|
71
|
-
var
|
|
72
|
-
function
|
|
73
|
+
var I = Object.freeze([]);
|
|
74
|
+
function L(e, t, n, i, a, s = !1) {
|
|
73
75
|
switch (e.type) {
|
|
74
76
|
case "number": {
|
|
75
|
-
if (typeof n != "number" || !Number.isFinite(n)) return
|
|
76
|
-
let
|
|
77
|
-
for (let
|
|
78
|
-
let t = r
|
|
79
|
-
if (t.present && !t.ok) return
|
|
77
|
+
if (typeof n != "number" || !Number.isFinite(n)) return A("local.runtime.value.finite-number", { name: e.name });
|
|
78
|
+
let r = e.step ?? 1, a = e.min ?? 0;
|
|
79
|
+
for (let r of t) {
|
|
80
|
+
let t = i(r, "min");
|
|
81
|
+
if (t.present && !t.ok) return A("local.runtime.value.constraint", {
|
|
80
82
|
name: e.name,
|
|
81
83
|
attribute: "min"
|
|
82
84
|
});
|
|
83
85
|
if (t.present && t.ok) {
|
|
84
|
-
if (typeof t.value != "number" || !Number.isFinite(t.value)) return
|
|
86
|
+
if (typeof t.value != "number" || !Number.isFinite(t.value)) return A("local.runtime.value.constraint", {
|
|
85
87
|
name: e.name,
|
|
86
88
|
attribute: "min"
|
|
87
89
|
});
|
|
88
|
-
if (a = t.value, n < t.value) return
|
|
90
|
+
if (a = t.value, n < t.value) return A("local.runtime.value.min", {
|
|
89
91
|
name: e.name,
|
|
90
92
|
min: t.value
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
|
-
let o = r
|
|
94
|
-
if (o.present && !o.ok) return
|
|
95
|
+
let o = i(r, "max");
|
|
96
|
+
if (o.present && !o.ok) return A("local.runtime.value.constraint", {
|
|
95
97
|
name: e.name,
|
|
96
98
|
attribute: "max"
|
|
97
99
|
});
|
|
98
100
|
if (o.present && o.ok) {
|
|
99
|
-
if (typeof o.value != "number" || !Number.isFinite(o.value)) return
|
|
101
|
+
if (typeof o.value != "number" || !Number.isFinite(o.value)) return A("local.runtime.value.constraint", {
|
|
100
102
|
name: e.name,
|
|
101
103
|
attribute: "max"
|
|
102
104
|
});
|
|
103
|
-
if (n > o.value) return
|
|
105
|
+
if (n > o.value) return A("local.runtime.value.max", {
|
|
104
106
|
name: e.name,
|
|
105
107
|
max: o.value
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
|
-
if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return
|
|
110
|
+
if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return A("local.runtime.value.constraint-range", { name: e.name });
|
|
109
111
|
}
|
|
110
|
-
return e.min !== void 0 && n < e.min ?
|
|
112
|
+
return e.min !== void 0 && n < e.min ? A("local.runtime.value.min", {
|
|
111
113
|
name: e.name,
|
|
112
114
|
min: e.min
|
|
113
|
-
}) : e.max !== void 0 && n > e.max ?
|
|
115
|
+
}) : e.max !== void 0 && n > e.max ? A("local.runtime.value.max", {
|
|
114
116
|
name: e.name,
|
|
115
117
|
max: e.max
|
|
116
|
-
}) :
|
|
118
|
+
}) : r > 0 && !V(n, a, r) ? A("local.runtime.value.step", {
|
|
117
119
|
name: e.name,
|
|
118
|
-
step:
|
|
120
|
+
step: r,
|
|
119
121
|
base: a
|
|
120
122
|
}) : {
|
|
121
123
|
ok: !0,
|
|
@@ -125,40 +127,40 @@ function R(e, t, n, r, a, s = !1) {
|
|
|
125
127
|
case "boolean": return typeof n == "boolean" ? {
|
|
126
128
|
ok: !0,
|
|
127
129
|
value: n
|
|
128
|
-
} :
|
|
130
|
+
} : A("local.runtime.value.boolean", { name: e.name });
|
|
129
131
|
case "string": {
|
|
130
|
-
if (typeof n != "string") return
|
|
132
|
+
if (typeof n != "string") return A("local.runtime.value.string", { name: e.name });
|
|
131
133
|
let c = o(n);
|
|
132
|
-
if (c) return
|
|
134
|
+
if (c) return A("local.runtime.value.budget", {
|
|
133
135
|
name: e.name,
|
|
134
|
-
detail:
|
|
136
|
+
detail: r(c),
|
|
135
137
|
detailKey: c.key,
|
|
136
138
|
...c.params
|
|
137
139
|
});
|
|
138
|
-
for (let
|
|
139
|
-
let t = a?.get(
|
|
140
|
+
for (let r of t) {
|
|
141
|
+
let t = a?.get(r.id) ?? (s ? F(r) : I);
|
|
140
142
|
if (!t.length) continue;
|
|
141
143
|
let o = {};
|
|
142
144
|
for (let n of t) {
|
|
143
145
|
if (n.kind === "date") {
|
|
144
146
|
for (let t of ["min", "max"]) {
|
|
145
147
|
if (n[t] === void 0) continue;
|
|
146
|
-
let a = r
|
|
148
|
+
let a = i(r, t);
|
|
147
149
|
if (a.present) {
|
|
148
|
-
if (!a.ok || typeof a.value != "string" || !
|
|
150
|
+
if (!a.ok || typeof a.value != "string" || !S(a.value)) return A("local.runtime.value.constraint-date", {
|
|
149
151
|
name: e.name,
|
|
150
152
|
attribute: t
|
|
151
153
|
});
|
|
152
154
|
o[t] = a.value;
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
|
-
let t = o.min ??
|
|
156
|
-
if (t && a &&
|
|
157
|
+
let t = o.min ?? j(r, n.min), a = o.max ?? j(r, n.max);
|
|
158
|
+
if (t && a && S(t) && S(a) && t > a) return A("local.runtime.value.constraint-range", { name: e.name });
|
|
157
159
|
}
|
|
158
160
|
if ((n.kind === "date" || n.kind === "required" ? n.required : void 0) !== void 0) {
|
|
159
|
-
let t = r
|
|
161
|
+
let t = i(r, "required");
|
|
160
162
|
if (t.present) {
|
|
161
|
-
if (!t.ok || typeof t.value != "boolean") return
|
|
163
|
+
if (!t.ok || typeof t.value != "boolean") return A("local.runtime.value.constraint", {
|
|
162
164
|
name: e.name,
|
|
163
165
|
attribute: "required"
|
|
164
166
|
});
|
|
@@ -166,10 +168,10 @@ function R(e, t, n, r, a, s = !1) {
|
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
|
-
let c =
|
|
171
|
+
let c = N(r, n, t, o);
|
|
170
172
|
if (!c.ok) return c;
|
|
171
173
|
}
|
|
172
|
-
return e.options?.length && !e.options.includes(n) ?
|
|
174
|
+
return e.options?.length && !e.options.includes(n) ? A("local.runtime.value.option", {
|
|
173
175
|
value: n,
|
|
174
176
|
options: e.options.join(", ")
|
|
175
177
|
}) : {
|
|
@@ -178,29 +180,29 @@ function R(e, t, n, r, a, s = !1) {
|
|
|
178
180
|
};
|
|
179
181
|
}
|
|
180
182
|
case "array": {
|
|
181
|
-
if (!Array.isArray(n)) return
|
|
183
|
+
if (!Array.isArray(n)) return A("local.runtime.value.array", { name: e.name });
|
|
182
184
|
let t = o(n);
|
|
183
|
-
if (t) return
|
|
185
|
+
if (t) return A("local.runtime.value.budget", {
|
|
184
186
|
name: e.name,
|
|
185
|
-
detail:
|
|
187
|
+
detail: r(t),
|
|
186
188
|
detailKey: t.key,
|
|
187
189
|
...t.params
|
|
188
190
|
});
|
|
189
|
-
for (let t of n) if (typeof t != "string") return
|
|
190
|
-
if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ?
|
|
191
|
+
for (let t of n) if (typeof t != "string") return A("local.runtime.value.array-members", { name: e.name });
|
|
192
|
+
if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
|
|
191
193
|
name: e.name,
|
|
192
194
|
max: e.maxItems
|
|
193
195
|
}) : {
|
|
194
196
|
ok: !0,
|
|
195
197
|
value: n.slice()
|
|
196
198
|
};
|
|
197
|
-
let
|
|
199
|
+
let i = /* @__PURE__ */ new Set();
|
|
198
200
|
for (let t of n) {
|
|
199
|
-
if (e.options && !e.options.includes(t)) return
|
|
200
|
-
|
|
201
|
+
if (e.options && !e.options.includes(t)) return A("local.runtime.value.checklist-option", { value: t });
|
|
202
|
+
i.add(t);
|
|
201
203
|
}
|
|
202
|
-
let a = e.options ? e.options.filter((e) =>
|
|
203
|
-
return e.maxItems !== void 0 && a.length > e.maxItems ?
|
|
204
|
+
let a = e.options ? e.options.filter((e) => i.has(e)) : [...i];
|
|
205
|
+
return e.maxItems !== void 0 && a.length > e.maxItems ? A("local.runtime.value.max-items", {
|
|
204
206
|
name: e.name,
|
|
205
207
|
max: e.maxItems
|
|
206
208
|
}) : {
|
|
@@ -209,16 +211,16 @@ function R(e, t, n, r, a, s = !1) {
|
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
213
|
case "number-array": {
|
|
212
|
-
if (!Array.isArray(n)) return
|
|
214
|
+
if (!Array.isArray(n)) return A("local.runtime.value.number-array", { name: e.name });
|
|
213
215
|
let t = o(n);
|
|
214
|
-
if (t) return
|
|
216
|
+
if (t) return A("local.runtime.value.budget", {
|
|
215
217
|
name: e.name,
|
|
216
|
-
detail:
|
|
218
|
+
detail: r(t),
|
|
217
219
|
detailKey: t.key,
|
|
218
220
|
...t.params
|
|
219
221
|
});
|
|
220
|
-
for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return
|
|
221
|
-
return e.maxItems !== void 0 && n.length > e.maxItems ?
|
|
222
|
+
for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return A("local.runtime.value.number-array-members", { name: e.name });
|
|
223
|
+
return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
|
|
222
224
|
name: e.name,
|
|
223
225
|
max: e.maxItems
|
|
224
226
|
}) : {
|
|
@@ -229,11 +231,11 @@ function R(e, t, n, r, a, s = !1) {
|
|
|
229
231
|
case "null": return n === null ? {
|
|
230
232
|
ok: !0,
|
|
231
233
|
value: n
|
|
232
|
-
} :
|
|
234
|
+
} : A("local.runtime.value.null", { name: e.name });
|
|
233
235
|
}
|
|
234
|
-
return
|
|
236
|
+
return A("local.runtime.value.unsupported-type", { name: e.name });
|
|
235
237
|
}
|
|
236
|
-
function
|
|
238
|
+
function R(e) {
|
|
237
239
|
return e instanceof a ? e : new a("expression-eval", e instanceof Error ? e.message : String(e), 0);
|
|
238
240
|
}
|
|
239
241
|
function re(e, t) {
|
|
@@ -336,11 +338,11 @@ function V(e, t, n) {
|
|
|
336
338
|
let r = (e - t) / n;
|
|
337
339
|
return Math.abs(r - Math.round(r)) <= z * Math.max(1, Math.abs(r));
|
|
338
340
|
}
|
|
339
|
-
function H(e, t, n,
|
|
341
|
+
function H(e, t, n, i) {
|
|
340
342
|
let a = Math.max(0, Math.min(e.source.length, t.range.start)), o = e.source.slice(0, a).split("\n");
|
|
341
343
|
return {
|
|
342
344
|
code: n,
|
|
343
|
-
message: i
|
|
345
|
+
message: r(i),
|
|
344
346
|
severity: "error",
|
|
345
347
|
range: {
|
|
346
348
|
start: a,
|
|
@@ -348,8 +350,10 @@ function H(e, t, n, r) {
|
|
|
348
350
|
},
|
|
349
351
|
line: o.length,
|
|
350
352
|
column: (o.at(-1) ?? "").length + 1,
|
|
351
|
-
messageKey:
|
|
352
|
-
|
|
353
|
+
messageKey: i.key,
|
|
354
|
+
phase: "runtime",
|
|
355
|
+
recoverable: !0,
|
|
356
|
+
...i.params ? { params: i.params } : {}
|
|
353
357
|
};
|
|
354
358
|
}
|
|
355
359
|
function U(e, t, n) {
|
|
@@ -363,6 +367,8 @@ function U(e, t, n) {
|
|
|
363
367
|
},
|
|
364
368
|
line: 1,
|
|
365
369
|
column: 1,
|
|
370
|
+
phase: "runtime",
|
|
371
|
+
recoverable: !0,
|
|
366
372
|
...n ? {
|
|
367
373
|
messageKey: n.key,
|
|
368
374
|
...n.params ? { params: n.params } : {}
|
|
@@ -410,91 +416,91 @@ function ie(e, t) {
|
|
|
410
416
|
} catch (e) {
|
|
411
417
|
return {
|
|
412
418
|
expression: null,
|
|
413
|
-
error:
|
|
419
|
+
error: R(e)
|
|
414
420
|
};
|
|
415
421
|
}
|
|
416
422
|
}
|
|
417
423
|
function ae(e, t) {
|
|
418
|
-
let
|
|
419
|
-
for (let t of
|
|
424
|
+
let n = /* @__PURE__ */ new Map();
|
|
425
|
+
for (let t of i(e.nodes)) n.set(t.id, t);
|
|
420
426
|
let s = {}, l = /* @__PURE__ */ new Map();
|
|
421
|
-
for (let [t,
|
|
422
|
-
let e = o(
|
|
423
|
-
if (e) throw new a("expression-budget", `Parameter "${t}": ${
|
|
424
|
-
s[t] = B(
|
|
427
|
+
for (let [t, i] of Object.entries(e.bindings)) {
|
|
428
|
+
let e = o(i.initial);
|
|
429
|
+
if (e) throw new a("expression-budget", `Parameter "${t}": ${r(e)}`, 0);
|
|
430
|
+
s[t] = B(i.initial);
|
|
425
431
|
let c = [];
|
|
426
|
-
for (let e of
|
|
427
|
-
let t =
|
|
432
|
+
for (let e of i.nodeIds) {
|
|
433
|
+
let t = n.get(e);
|
|
428
434
|
t && c.push(t);
|
|
429
435
|
}
|
|
430
436
|
l.set(t, c);
|
|
431
437
|
}
|
|
432
|
-
let
|
|
433
|
-
for (let [t, n] of Object.entries(e.bindingSlots ?? {}))
|
|
434
|
-
let
|
|
435
|
-
if (
|
|
436
|
-
let t =
|
|
438
|
+
let d = /* @__PURE__ */ new Map();
|
|
439
|
+
for (let [t, n] of Object.entries(e.bindingSlots ?? {})) d.set(t, { ...n });
|
|
440
|
+
let f = g(e), p = new Map(Object.entries(f?.valueRules ?? {})), ee = f === void 0, m = /* @__PURE__ */ new Map();
|
|
441
|
+
if (f) for (let e of f.slotRelations) {
|
|
442
|
+
let t = d.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
|
|
437
443
|
if (!n || !r) continue;
|
|
438
|
-
let i =
|
|
444
|
+
let i = m.get(e.nodeId) ?? [];
|
|
439
445
|
i.push({
|
|
440
446
|
lower: n,
|
|
441
447
|
upper: r
|
|
442
|
-
}),
|
|
448
|
+
}), m.set(e.nodeId, i);
|
|
443
449
|
}
|
|
444
|
-
else for (let [e, t] of
|
|
450
|
+
else for (let [e, t] of d) t.start && t.end && m.set(e, [{
|
|
445
451
|
lower: t.start,
|
|
446
452
|
upper: t.end
|
|
447
453
|
}]);
|
|
448
|
-
let
|
|
454
|
+
let _ = /* @__PURE__ */ new Map();
|
|
449
455
|
for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
|
|
450
|
-
if (
|
|
451
|
-
let n =
|
|
452
|
-
(n === void 0 || n.startsWith("@") && !t.startsWith("@")) &&
|
|
456
|
+
if (d.has(e)) continue;
|
|
457
|
+
let n = _.get(e);
|
|
458
|
+
(n === void 0 || n.startsWith("@") && !t.startsWith("@")) && _.set(e, t);
|
|
453
459
|
}
|
|
454
|
-
let
|
|
455
|
-
for (let [e, t] of
|
|
460
|
+
let v = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
|
|
461
|
+
for (let [e, t] of d) for (let n of Object.values(t)) {
|
|
456
462
|
if (n.startsWith("@")) continue;
|
|
457
463
|
let t = b.get(n) ?? /* @__PURE__ */ new Set();
|
|
458
464
|
t.add(e), b.set(n, t);
|
|
459
465
|
}
|
|
460
|
-
let x = e.computations ?? {},
|
|
466
|
+
let x = e.computations ?? {}, S = Object.keys(x), C = /* @__PURE__ */ new Map();
|
|
461
467
|
for (let [e, n] of Object.entries(x)) {
|
|
462
468
|
let r = ie(n.source, t);
|
|
463
|
-
r.expression &&
|
|
469
|
+
r.expression && C.set(e, r.expression);
|
|
464
470
|
}
|
|
465
|
-
let { order:
|
|
466
|
-
for (let e of
|
|
471
|
+
let { order: te, cyclic: ne } = y(x), w = {}, T = /* @__PURE__ */ new Map();
|
|
472
|
+
for (let e of te) {
|
|
467
473
|
let t = x[e];
|
|
468
474
|
if (!t || t.kind !== "const") continue;
|
|
469
475
|
if (Object.hasOwn(t, "value")) {
|
|
470
476
|
let n = t.value, r = c(n);
|
|
471
477
|
if (r) {
|
|
472
|
-
|
|
478
|
+
T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
|
|
473
479
|
continue;
|
|
474
480
|
}
|
|
475
|
-
|
|
481
|
+
w[e] = B(n);
|
|
476
482
|
continue;
|
|
477
483
|
}
|
|
478
|
-
let n =
|
|
479
|
-
if (!n)
|
|
484
|
+
let n = C.get(e);
|
|
485
|
+
if (!n) T.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
|
|
480
486
|
else try {
|
|
481
|
-
let t = n.evaluate({ ...
|
|
487
|
+
let t = n.evaluate({ ...w }), r = c(t);
|
|
482
488
|
if (r) {
|
|
483
|
-
|
|
489
|
+
T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
|
|
484
490
|
continue;
|
|
485
491
|
}
|
|
486
|
-
|
|
492
|
+
w[e] = B(t);
|
|
487
493
|
} catch (t) {
|
|
488
|
-
|
|
494
|
+
T.set(e, R(t));
|
|
489
495
|
}
|
|
490
496
|
}
|
|
491
|
-
let
|
|
492
|
-
for (let e of
|
|
493
|
-
let
|
|
497
|
+
let E = /* @__PURE__ */ new Map();
|
|
498
|
+
for (let e of ne) E.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
|
|
499
|
+
let D = [];
|
|
494
500
|
if (Array.isArray(e.validations)) for (let n of e.validations) {
|
|
495
|
-
if (!
|
|
501
|
+
if (!u(n)) continue;
|
|
496
502
|
let e = ie(n.expression, t);
|
|
497
|
-
|
|
503
|
+
D.push({
|
|
498
504
|
rule: n,
|
|
499
505
|
expression: e.expression,
|
|
500
506
|
error: e.error
|
|
@@ -502,37 +508,37 @@ function ae(e, t) {
|
|
|
502
508
|
}
|
|
503
509
|
return {
|
|
504
510
|
document: e,
|
|
505
|
-
nodeIndex:
|
|
511
|
+
nodeIndex: n,
|
|
506
512
|
controls: l,
|
|
507
|
-
slotKeys:
|
|
508
|
-
publicNames:
|
|
513
|
+
slotKeys: d,
|
|
514
|
+
publicNames: v,
|
|
509
515
|
publicSlotOwners: b,
|
|
510
516
|
initial: s,
|
|
511
517
|
valueRules: p,
|
|
512
|
-
legacyValueRules:
|
|
513
|
-
slotRelations:
|
|
514
|
-
bindingByNode:
|
|
518
|
+
legacyValueRules: ee,
|
|
519
|
+
slotRelations: m,
|
|
520
|
+
bindingByNode: _,
|
|
515
521
|
computationMetadata: x,
|
|
516
|
-
computationNames:
|
|
517
|
-
computationOrder:
|
|
518
|
-
cyclicComputations:
|
|
519
|
-
computationExpressions:
|
|
520
|
-
constValues:
|
|
521
|
-
constErrors:
|
|
522
|
-
cycleErrors:
|
|
523
|
-
validationRules:
|
|
524
|
-
validationLineStarts:
|
|
522
|
+
computationNames: S,
|
|
523
|
+
computationOrder: te,
|
|
524
|
+
cyclicComputations: ne,
|
|
525
|
+
computationExpressions: C,
|
|
526
|
+
constValues: w,
|
|
527
|
+
constErrors: T,
|
|
528
|
+
cycleErrors: E,
|
|
529
|
+
validationRules: D,
|
|
530
|
+
validationLineStarts: h(typeof e.source == "string" ? e.source : "")
|
|
525
531
|
};
|
|
526
532
|
}
|
|
527
533
|
function oe(e) {
|
|
528
|
-
return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-3" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-3" ? `createLocalRuntime requires ${
|
|
534
|
+
return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-3" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-3" ? `createLocalRuntime requires ${x}; migrate the source before constructing a runtime.` : null;
|
|
529
535
|
}
|
|
530
536
|
function G(e, t) {
|
|
531
537
|
return (e.controls.get(t.name) ?? [])[0] ?? (t.owner ? e.nodeIndex.get(t.owner) : void 0) ?? (t.nodeIds[0] ? e.nodeIndex.get(t.nodeIds[0]) : void 0);
|
|
532
538
|
}
|
|
533
539
|
function se(e, t, n) {
|
|
534
|
-
let
|
|
535
|
-
return
|
|
540
|
+
let i = G(e, t);
|
|
541
|
+
return i ? H(e.document, i, "local.runtime.value", n) : U("local.runtime.value", r(n));
|
|
536
542
|
}
|
|
537
543
|
function K(e, t, n) {
|
|
538
544
|
let r = e.slotRelations.get(t);
|
|
@@ -542,13 +548,13 @@ function K(e, t, n) {
|
|
|
542
548
|
}) : !1;
|
|
543
549
|
}
|
|
544
550
|
function ce(e, t) {
|
|
545
|
-
let
|
|
546
|
-
return
|
|
551
|
+
let i = e.nodeIndex.get(t);
|
|
552
|
+
return i ? H(e.document, i, "local.runtime.value", n("local.runtime.value.range-order")) : U("local.runtime.value", r(n("local.runtime.value.range-order")));
|
|
547
553
|
}
|
|
548
554
|
// src/local/runtime/retention.ts
|
|
549
555
|
function q(e) {
|
|
550
556
|
let t = /* @__PURE__ */ new Map();
|
|
551
|
-
for (let
|
|
557
|
+
for (let n of i(e.nodes)) t.set(n.id, n);
|
|
552
558
|
return t;
|
|
553
559
|
}
|
|
554
560
|
function le(e, t, n) {
|
|
@@ -556,14 +562,14 @@ function le(e, t, n) {
|
|
|
556
562
|
return r !== void 0 && Object.values(r).includes(n);
|
|
557
563
|
}
|
|
558
564
|
function J(e, t, n) {
|
|
559
|
-
let r = t.name ?
|
|
565
|
+
let r = t.name ? C(t.name) : void 0;
|
|
560
566
|
if (r?.bindings) {
|
|
561
567
|
let i = e.bindingSlots?.[t.id];
|
|
562
568
|
for (let [e, a] of Object.entries(r.bindings)) if (t.attrs?.[a.bind] === n || e !== "value" && i?.[e] === n) return a.retain === !1 ? void 0 : a.initial;
|
|
563
569
|
} else if (t.attrs?.bind === n || le(e, t, n)) return "initial";
|
|
564
570
|
}
|
|
565
571
|
function Y(e) {
|
|
566
|
-
let t = q(e), n =
|
|
572
|
+
let t = q(e), n = g(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
|
|
567
573
|
for (let [a, o] of Object.entries(e.bindings)) {
|
|
568
574
|
let s = o.nodeIds.flatMap((e) => {
|
|
569
575
|
let n = t.get(e);
|
|
@@ -663,7 +669,7 @@ function de(e, t, n, r, i) {
|
|
|
663
669
|
for (let e of a.dropped) s.set(e.name, Object.freeze({ ...e }));
|
|
664
670
|
let c = [], l = {}, u = [], d = /* @__PURE__ */ new Set(), f, p = (n) => {
|
|
665
671
|
let o = e.document.bindings[n], s = e.controls.get(n) ?? [];
|
|
666
|
-
return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t),
|
|
672
|
+
return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t), L(o, s, a.values[n], f, e.valueRules, e.legacyValueRules).ok) ? !1 : W(e, n) === W(r, n);
|
|
667
673
|
};
|
|
668
674
|
for (let e of a.retained) {
|
|
669
675
|
let t = n.bindings[e];
|
|
@@ -672,26 +678,26 @@ function de(e, t, n, r, i) {
|
|
|
672
678
|
d.add(e), l[e] = B(a.values[e]), u.push(e);
|
|
673
679
|
continue;
|
|
674
680
|
}
|
|
675
|
-
let f =
|
|
681
|
+
let f = L(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
|
|
676
682
|
f.ok ? (l[e] = B(f.value), u.push(e)) : (c.push(se(r, t, f.detail)), s.set(e, Object.freeze({
|
|
677
683
|
name: e,
|
|
678
684
|
reason: "invalid"
|
|
679
685
|
})));
|
|
680
686
|
}
|
|
681
|
-
let
|
|
687
|
+
let ee = {
|
|
682
688
|
...o,
|
|
683
689
|
...l
|
|
684
|
-
},
|
|
685
|
-
for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? [])
|
|
686
|
-
let
|
|
687
|
-
for (let e of [...
|
|
688
|
-
|
|
690
|
+
}, m = /* @__PURE__ */ new Set();
|
|
691
|
+
for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? []) m.add(t);
|
|
692
|
+
let h = !1;
|
|
693
|
+
for (let e of [...m].sort()) if (K(r, e, ee)) {
|
|
694
|
+
h = !0;
|
|
689
695
|
break;
|
|
690
696
|
}
|
|
691
|
-
let
|
|
692
|
-
if (!
|
|
697
|
+
let g;
|
|
698
|
+
if (!h) Object.assign(o, l), g = u;
|
|
693
699
|
else {
|
|
694
|
-
|
|
700
|
+
g = [];
|
|
695
701
|
for (let e of u) {
|
|
696
702
|
let t = o[e];
|
|
697
703
|
o[e] = l[e];
|
|
@@ -700,7 +706,7 @@ function de(e, t, n, r, i) {
|
|
|
700
706
|
n ? (o[e] = t, s.set(e, Object.freeze({
|
|
701
707
|
name: e,
|
|
702
708
|
reason: "invalid"
|
|
703
|
-
}))) :
|
|
709
|
+
}))) : g.push(e);
|
|
704
710
|
}
|
|
705
711
|
}
|
|
706
712
|
for (let [e, t] of r.slotRelations) if (K(r, e, o)) {
|
|
@@ -708,8 +714,8 @@ function de(e, t, n, r, i) {
|
|
|
708
714
|
let e = n.bindings[t];
|
|
709
715
|
if (!e) continue;
|
|
710
716
|
o[t] = B(e.initial);
|
|
711
|
-
let r =
|
|
712
|
-
r >= 0 &&
|
|
717
|
+
let r = g.indexOf(t);
|
|
718
|
+
r >= 0 && g.splice(r, 1), s.set(t, Object.freeze({
|
|
713
719
|
name: t,
|
|
714
720
|
reason: "invalid"
|
|
715
721
|
}));
|
|
@@ -721,25 +727,25 @@ function de(e, t, n, r, i) {
|
|
|
721
727
|
diagnostics: []
|
|
722
728
|
};
|
|
723
729
|
}
|
|
724
|
-
let
|
|
725
|
-
for (;
|
|
730
|
+
let _ = !0;
|
|
731
|
+
for (; _;) {
|
|
726
732
|
let e = i({}, r, o), t = [];
|
|
727
|
-
for (let i of
|
|
733
|
+
for (let i of g) {
|
|
728
734
|
if (d.has(i)) continue;
|
|
729
|
-
let a = n.bindings[i], s =
|
|
735
|
+
let a = n.bindings[i], s = L(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
|
|
730
736
|
s.ok || (c.push(se(r, a, s.detail)), t.push(i));
|
|
731
737
|
}
|
|
732
|
-
for (let e of t) o[e] = B(n.bindings[e].initial),
|
|
738
|
+
for (let e of t) o[e] = B(n.bindings[e].initial), g.splice(g.indexOf(e), 1), s.set(e, Object.freeze({
|
|
733
739
|
name: e,
|
|
734
740
|
reason: "invalid"
|
|
735
741
|
}));
|
|
736
|
-
|
|
742
|
+
_ = t.length > 0;
|
|
737
743
|
}
|
|
738
|
-
let
|
|
739
|
-
return
|
|
744
|
+
let v = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
|
|
745
|
+
return g.sort(), {
|
|
740
746
|
values: o,
|
|
741
|
-
retained:
|
|
742
|
-
dropped:
|
|
747
|
+
retained: g,
|
|
748
|
+
dropped: v,
|
|
743
749
|
diagnostics: c
|
|
744
750
|
};
|
|
745
751
|
}
|
|
@@ -782,33 +788,33 @@ function ve(e, t, n) {
|
|
|
782
788
|
function ye(e, t) {
|
|
783
789
|
let c = oe(e);
|
|
784
790
|
if (c) throw Error(c);
|
|
785
|
-
let
|
|
791
|
+
let u = t?.services === void 0, f = te(t?.network), h = /* @__PURE__ */ new Map(), g = ne(e.source), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = ae(e, x), C = () => S, E = () => {
|
|
786
792
|
let e = /* @__PURE__ */ new Set();
|
|
787
|
-
for (let
|
|
793
|
+
for (let n of i(S.document.nodes)) n.name !== void 0 && e.add(w({
|
|
788
794
|
documentId: t?.documentId,
|
|
789
|
-
sourceDigest:
|
|
790
|
-
nodeId:
|
|
791
|
-
stateKey:
|
|
795
|
+
sourceDigest: g,
|
|
796
|
+
nodeId: n.id,
|
|
797
|
+
stateKey: n.attrs?.["state-key"]
|
|
792
798
|
}));
|
|
793
799
|
return e;
|
|
794
|
-
},
|
|
800
|
+
}, D = t?.services ?? T({
|
|
795
801
|
documentId: t?.documentId,
|
|
796
|
-
sourceDigest:
|
|
802
|
+
sourceDigest: g,
|
|
797
803
|
randomSeed: t?.randomSeed,
|
|
798
804
|
componentState: t?.componentState,
|
|
799
805
|
...t?.componentStateStorage === void 0 ? {} : { componentStateStorage: t.componentStateStorage },
|
|
800
806
|
...t?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: t.componentStateWriteDelayMs },
|
|
801
807
|
...t?.configKey === void 0 ? {} : { configKey: t.configKey },
|
|
802
808
|
...t?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: t.legacyConfigKeys },
|
|
803
|
-
...
|
|
804
|
-
}),
|
|
809
|
+
...u ? { knownStateKeys: E } : {}
|
|
810
|
+
}), O = {}, k = /* @__PURE__ */ new Map();
|
|
805
811
|
for (let [n, r] of Object.entries(e.externals ?? {})) {
|
|
806
812
|
let e = t?.externalValues?.[n];
|
|
807
813
|
if (e === void 0) continue;
|
|
808
814
|
let i = re(r.type, e);
|
|
809
|
-
i.ok && (
|
|
815
|
+
i.ok && (O[n] = i.value);
|
|
810
816
|
}
|
|
811
|
-
let
|
|
817
|
+
let A = (e, t) => {
|
|
812
818
|
let n = {};
|
|
813
819
|
for (let [r, i] of Object.entries(e.document.externals ?? {})) {
|
|
814
820
|
if (!Object.hasOwn(t, r)) continue;
|
|
@@ -816,14 +822,14 @@ function ye(e, t) {
|
|
|
816
822
|
e.ok && (n[r] = e.value);
|
|
817
823
|
}
|
|
818
824
|
return n;
|
|
819
|
-
},
|
|
820
|
-
let t =
|
|
821
|
-
for (let n of
|
|
825
|
+
}, j = (e) => {
|
|
826
|
+
let t = A(e, O);
|
|
827
|
+
for (let n of k.keys()) Object.assign(t, A(e, n));
|
|
822
828
|
return t;
|
|
823
|
-
},
|
|
829
|
+
}, M = (e, t, n, r = C()) => {
|
|
824
830
|
let i = r.document.dynamicConstraints?.[e.id]?.[t];
|
|
825
831
|
if (!i) return { present: !1 };
|
|
826
|
-
let a = ie(i.source,
|
|
832
|
+
let a = ie(i.source, x);
|
|
827
833
|
if (!a.expression) return {
|
|
828
834
|
present: !0,
|
|
829
835
|
ok: !1
|
|
@@ -844,21 +850,21 @@ function ye(e, t) {
|
|
|
844
850
|
ok: !1
|
|
845
851
|
};
|
|
846
852
|
}
|
|
847
|
-
},
|
|
853
|
+
}, N = S.initial, P = 0, F = {}, I = {}, R = {
|
|
848
854
|
revision: 0,
|
|
849
855
|
state: me({})
|
|
850
856
|
}, z = !1, V = null, W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), q = () => {
|
|
851
857
|
if (z) throw Error("The local interaction runtime has been disposed.");
|
|
852
858
|
};
|
|
853
859
|
function le(e, t) {
|
|
854
|
-
if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(
|
|
860
|
+
if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(N, t) ? N[t] : void 0;
|
|
855
861
|
}
|
|
856
862
|
let J = (e, t) => {
|
|
857
|
-
let n =
|
|
863
|
+
let n = j(e), r = /* @__PURE__ */ new Map();
|
|
858
864
|
for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(n, t) || r.set(t, new a("external-missing", "External data \"" + t + "\" is not available.", 0));
|
|
859
865
|
let i = {}, o = /* @__PURE__ */ new Map();
|
|
860
866
|
if (e.computationNames.length > 0) {
|
|
861
|
-
let a =
|
|
867
|
+
let a = ee(e.computationMetadata, e.computationOrder, e.computationExpressions, {
|
|
862
868
|
...t,
|
|
863
869
|
...n
|
|
864
870
|
}, e.constValues, r);
|
|
@@ -886,63 +892,63 @@ function ye(e, t) {
|
|
|
886
892
|
snapshotState: c
|
|
887
893
|
};
|
|
888
894
|
}, Y = () => {
|
|
889
|
-
let e = J(
|
|
890
|
-
|
|
891
|
-
}, X = (e, t =
|
|
895
|
+
let e = J(C(), N);
|
|
896
|
+
F = e.environment, I = e.snapshotState;
|
|
897
|
+
}, X = (e, t = C(), n = N) => {
|
|
892
898
|
let r;
|
|
893
899
|
return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= J(t, {
|
|
894
900
|
...n,
|
|
895
901
|
...e
|
|
896
|
-
}).environment,
|
|
902
|
+
}).environment, M(i, a, r, t)) : { present: !1 };
|
|
897
903
|
}, Z = () => {
|
|
898
|
-
|
|
899
|
-
revision:
|
|
900
|
-
state: me(
|
|
904
|
+
R = {
|
|
905
|
+
revision: P,
|
|
906
|
+
state: me(I)
|
|
901
907
|
};
|
|
902
908
|
}, ue = () => {
|
|
903
909
|
for (let e of W) e();
|
|
904
910
|
}, Q = (e) => {
|
|
905
|
-
|
|
911
|
+
N = e, P += 1, Y(), Z(), ue();
|
|
906
912
|
}, ge = () => {
|
|
907
|
-
|
|
908
|
-
}, _e = (e, t =
|
|
913
|
+
P += 1, Y(), Z(), ue();
|
|
914
|
+
}, _e = (e, t = O) => {
|
|
909
915
|
if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
|
|
910
|
-
let
|
|
916
|
+
let i = [], a = {}, o = Object.keys(e).sort();
|
|
911
917
|
for (let t of o) {
|
|
912
918
|
if (t === "__proto__") {
|
|
913
|
-
|
|
919
|
+
i.push(U("local.runtime.external", "External names cannot be \"__proto__\"."));
|
|
914
920
|
continue;
|
|
915
921
|
}
|
|
916
|
-
let o =
|
|
922
|
+
let o = C().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
|
|
917
923
|
if (!s) {
|
|
918
|
-
let e =
|
|
919
|
-
|
|
924
|
+
let e = n("local.runtime.external", { name: t });
|
|
925
|
+
i.push(U("local.runtime.external", r(e), e));
|
|
920
926
|
continue;
|
|
921
927
|
}
|
|
922
928
|
let c = re(s.type, e[t]);
|
|
923
929
|
if (c.ok) a[t] = c.value;
|
|
924
930
|
else {
|
|
925
|
-
let e =
|
|
931
|
+
let e = n(c.key, {
|
|
926
932
|
name: t,
|
|
927
933
|
...c.params ?? {}
|
|
928
934
|
});
|
|
929
|
-
|
|
935
|
+
i.push(U("local.runtime.external", r(e), e));
|
|
930
936
|
}
|
|
931
937
|
}
|
|
932
|
-
return
|
|
938
|
+
return i.length ? i : (o.some((e) => !pe(t[e], a[e])) && (Object.assign(t, a), ge()), []);
|
|
933
939
|
}, ve = (e, t) => {
|
|
934
940
|
if (z) return () => {};
|
|
935
941
|
let n = {}, r = e.bindExternalValues((e) => {
|
|
936
|
-
if (z || !
|
|
942
|
+
if (z || !k.has(n)) return;
|
|
937
943
|
let r = _e(e, n);
|
|
938
944
|
r.length && t?.(r);
|
|
939
945
|
});
|
|
940
|
-
return r ? (
|
|
941
|
-
|
|
946
|
+
return r ? (k.set(n, r), () => {
|
|
947
|
+
k.delete(n) && (r(), !z && Object.keys(n).length && ge());
|
|
942
948
|
}) : () => {};
|
|
943
949
|
}, ye = (e) => {
|
|
944
950
|
q();
|
|
945
|
-
let t =
|
|
951
|
+
let t = C(), n = [], r = {}, i = Object.keys(e).sort(), a = X(e);
|
|
946
952
|
for (let o of i) {
|
|
947
953
|
if (o === "__proto__") {
|
|
948
954
|
n.push(U("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
|
|
@@ -956,13 +962,13 @@ function ye(e, t) {
|
|
|
956
962
|
n.push(U("local.runtime.parameter", `Unknown parameter "${o}".`));
|
|
957
963
|
continue;
|
|
958
964
|
}
|
|
959
|
-
let i = t.document.bindings[o], s =
|
|
965
|
+
let i = t.document.bindings[o], s = L(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
|
|
960
966
|
s.ok ? r[o] = B(s.value) : n.push(se(t, i, s.detail));
|
|
961
967
|
}
|
|
962
968
|
if (n.length) return n;
|
|
963
|
-
if (!i.some((e) => !pe(
|
|
969
|
+
if (!i.some((e) => !pe(N[e], r[e]))) return [];
|
|
964
970
|
let o = {
|
|
965
|
-
...
|
|
971
|
+
...N,
|
|
966
972
|
...r
|
|
967
973
|
}, s = /* @__PURE__ */ new Set();
|
|
968
974
|
for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
|
|
@@ -979,36 +985,36 @@ function ye(e, t) {
|
|
|
979
985
|
}
|
|
980
986
|
return t;
|
|
981
987
|
}, xe = () => {
|
|
982
|
-
let e =
|
|
988
|
+
let e = C(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
|
|
983
989
|
for (let r of e.validationRules) {
|
|
984
990
|
if (r.error) {
|
|
985
|
-
t.push(
|
|
991
|
+
t.push(d(n, e.validationLineStarts, r.rule.range, v, p(`Validation expression is invalid: ${r.error.message}`)));
|
|
986
992
|
continue;
|
|
987
993
|
}
|
|
988
994
|
if (!r.expression) continue;
|
|
989
995
|
let i;
|
|
990
996
|
try {
|
|
991
|
-
i = r.expression.evaluate(
|
|
997
|
+
i = r.expression.evaluate(F);
|
|
992
998
|
} catch (i) {
|
|
993
|
-
t.push(
|
|
999
|
+
t.push(d(n, e.validationLineStarts, r.rule.range, v, p(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
|
|
994
1000
|
continue;
|
|
995
1001
|
}
|
|
996
|
-
typeof i == "boolean" ? i || t.push(
|
|
1002
|
+
typeof i == "boolean" ? i || t.push(d(n, e.validationLineStarts, r.rule.range, m, Se(r.rule.message))) : t.push(d(n, e.validationLineStarts, r.rule.range, v, "Validation expression must evaluate to a boolean."));
|
|
997
1003
|
}
|
|
998
1004
|
return t;
|
|
999
1005
|
}, Se = (e) => {
|
|
1000
1006
|
let t;
|
|
1001
1007
|
try {
|
|
1002
|
-
t = s(e,
|
|
1008
|
+
t = s(e, F);
|
|
1003
1009
|
} catch {
|
|
1004
|
-
t =
|
|
1010
|
+
t = _;
|
|
1005
1011
|
}
|
|
1006
|
-
return
|
|
1012
|
+
return p(t);
|
|
1007
1013
|
}, Ce = (e, t) => {
|
|
1008
|
-
if (q(), e ===
|
|
1014
|
+
if (q(), e === S.document) return $({
|
|
1009
1015
|
ok: !0,
|
|
1010
1016
|
changed: !1,
|
|
1011
|
-
revision:
|
|
1017
|
+
revision: P,
|
|
1012
1018
|
retained: [],
|
|
1013
1019
|
dropped: [],
|
|
1014
1020
|
diagnostics: []
|
|
@@ -1016,29 +1022,29 @@ function ye(e, t) {
|
|
|
1016
1022
|
if (oe(e)) return $({
|
|
1017
1023
|
ok: !1,
|
|
1018
1024
|
changed: !1,
|
|
1019
|
-
revision:
|
|
1025
|
+
revision: P,
|
|
1020
1026
|
retained: [],
|
|
1021
1027
|
dropped: [],
|
|
1022
1028
|
diagnostics: []
|
|
1023
1029
|
});
|
|
1024
1030
|
let n;
|
|
1025
1031
|
try {
|
|
1026
|
-
n = ae(e,
|
|
1032
|
+
n = ae(e, x);
|
|
1027
1033
|
} catch {
|
|
1028
1034
|
return $({
|
|
1029
1035
|
ok: !1,
|
|
1030
1036
|
changed: !1,
|
|
1031
|
-
revision:
|
|
1037
|
+
revision: P,
|
|
1032
1038
|
retained: [],
|
|
1033
1039
|
dropped: [],
|
|
1034
1040
|
diagnostics: []
|
|
1035
1041
|
});
|
|
1036
1042
|
}
|
|
1037
|
-
let r = de(
|
|
1043
|
+
let r = de(S, N, e, n, X);
|
|
1038
1044
|
if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
|
|
1039
1045
|
ok: !1,
|
|
1040
1046
|
changed: !1,
|
|
1041
|
-
revision:
|
|
1047
|
+
revision: P,
|
|
1042
1048
|
retained: [],
|
|
1043
1049
|
dropped: [],
|
|
1044
1050
|
diagnostics: []
|
|
@@ -1050,108 +1056,108 @@ function ye(e, t) {
|
|
|
1050
1056
|
return $({
|
|
1051
1057
|
ok: !1,
|
|
1052
1058
|
changed: !1,
|
|
1053
|
-
revision:
|
|
1059
|
+
revision: P,
|
|
1054
1060
|
retained: [],
|
|
1055
1061
|
dropped: [],
|
|
1056
1062
|
diagnostics: []
|
|
1057
1063
|
});
|
|
1058
1064
|
}
|
|
1059
|
-
for (let e of [
|
|
1060
|
-
let t =
|
|
1065
|
+
for (let e of [O, ...k.keys()]) {
|
|
1066
|
+
let t = A(n, e);
|
|
1061
1067
|
for (let t of Object.keys(e)) delete e[t];
|
|
1062
1068
|
Object.assign(e, t);
|
|
1063
1069
|
}
|
|
1064
|
-
if (
|
|
1070
|
+
if (S = n, N = r.values, F = i.environment, I = i.snapshotState, V = null, P += 1, Z(), t) for (let e of W) e();
|
|
1065
1071
|
return $({
|
|
1066
1072
|
ok: !0,
|
|
1067
1073
|
changed: !0,
|
|
1068
|
-
revision:
|
|
1074
|
+
revision: P,
|
|
1069
1075
|
retained: r.retained,
|
|
1070
1076
|
dropped: r.dropped,
|
|
1071
1077
|
diagnostics: r.diagnostics
|
|
1072
1078
|
});
|
|
1073
1079
|
}, we = (e) => {
|
|
1074
1080
|
let t = /* @__PURE__ */ new Set();
|
|
1075
|
-
for (let
|
|
1081
|
+
for (let n of i([e])) t.add(n.id);
|
|
1076
1082
|
return t;
|
|
1077
1083
|
}, Te = {
|
|
1078
1084
|
network: f.network,
|
|
1079
1085
|
get document() {
|
|
1080
|
-
return
|
|
1086
|
+
return S.document;
|
|
1081
1087
|
},
|
|
1082
|
-
services:
|
|
1088
|
+
services: D,
|
|
1083
1089
|
snapshot() {
|
|
1084
|
-
return q(),
|
|
1090
|
+
return q(), R;
|
|
1085
1091
|
},
|
|
1086
1092
|
get(e, t) {
|
|
1087
1093
|
q();
|
|
1088
|
-
let n =
|
|
1094
|
+
let n = C(), r = n.nodeIndex.get(e.id);
|
|
1089
1095
|
if (!r) return null;
|
|
1090
|
-
let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ??
|
|
1091
|
-
return i && Object.hasOwn(
|
|
1096
|
+
let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? b(r) : n.slotKeys.get(r.id)?.[t];
|
|
1097
|
+
return i && Object.hasOwn(N, i) ? B(N[i]) : null;
|
|
1092
1098
|
},
|
|
1093
|
-
set(e, t,
|
|
1099
|
+
set(e, t, r) {
|
|
1094
1100
|
q();
|
|
1095
|
-
let i =
|
|
1096
|
-
if (!a) return [H(i.document, e, "local.runtime.binding",
|
|
1101
|
+
let i = C(), a = i.nodeIndex.get(e.id);
|
|
1102
|
+
if (!a) return [H(i.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
|
|
1097
1103
|
let o = i.slotKeys.get(a.id), s;
|
|
1098
|
-
if (
|
|
1099
|
-
if (o && !o.value) return [H(i.document, a, "local.runtime.binding",
|
|
1100
|
-
s = o?.value ?? i.bindingByNode.get(a.id) ??
|
|
1101
|
-
} else if (s = o?.[
|
|
1104
|
+
if (r === void 0) {
|
|
1105
|
+
if (o && !o.value) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.needs-slot"))];
|
|
1106
|
+
s = o?.value ?? i.bindingByNode.get(a.id) ?? b(a);
|
|
1107
|
+
} else if (s = o?.[r], !s) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: r }))];
|
|
1102
1108
|
let c = Object.hasOwn(i.document.bindings, s) ? i.document.bindings[s] : void 0;
|
|
1103
|
-
if (!c) return [H(i.document, a, "local.runtime.binding",
|
|
1104
|
-
let l =
|
|
1109
|
+
if (!c) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
|
|
1110
|
+
let l = L(c, i.controls.get(s) ?? [], t, X({ [s]: t }), i.valueRules, i.legacyValueRules);
|
|
1105
1111
|
if (!l.ok) return [H(i.document, a, "local.runtime.value", l.detail)];
|
|
1106
|
-
let
|
|
1107
|
-
if (pe(
|
|
1108
|
-
let
|
|
1109
|
-
...
|
|
1110
|
-
[s]:
|
|
1112
|
+
let u = B(l.value);
|
|
1113
|
+
if (pe(N[s], u)) return [];
|
|
1114
|
+
let d = {
|
|
1115
|
+
...N,
|
|
1116
|
+
[s]: u
|
|
1111
1117
|
};
|
|
1112
|
-
return K(i, a.id,
|
|
1118
|
+
return K(i, a.id, d) ? [H(i.document, a, "local.runtime.value", n("local.runtime.value.range-order"))] : (Q(d), []);
|
|
1113
1119
|
},
|
|
1114
1120
|
setMany(e, t) {
|
|
1115
1121
|
q();
|
|
1116
|
-
let
|
|
1117
|
-
if (!i) return [H(
|
|
1118
|
-
let a =
|
|
1119
|
-
if (!a) return [H(
|
|
1122
|
+
let r = C(), i = r.nodeIndex.get(e.id);
|
|
1123
|
+
if (!i) return [H(r.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
|
|
1124
|
+
let a = r.slotKeys.get(i.id);
|
|
1125
|
+
if (!a) return [H(r.document, i, "local.runtime.binding", n("local.runtime.binding.no-multi-slot"))];
|
|
1120
1126
|
let o = Object.entries(t);
|
|
1121
1127
|
if (!o.length) return [];
|
|
1122
|
-
let s = { ...
|
|
1123
|
-
...
|
|
1128
|
+
let s = { ...N }, c = J(r, {
|
|
1129
|
+
...N,
|
|
1124
1130
|
...Object.fromEntries(o.map(([e, t]) => [a[e], t]))
|
|
1125
1131
|
}).environment;
|
|
1126
1132
|
for (let [e, t] of o) {
|
|
1127
1133
|
let o = a[e];
|
|
1128
|
-
if (!o || !Object.hasOwn(
|
|
1129
|
-
let l =
|
|
1130
|
-
if (!l.ok) return [H(
|
|
1134
|
+
if (!o || !Object.hasOwn(r.document.bindings, o)) return [H(r.document, i, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: e }))];
|
|
1135
|
+
let l = L(r.document.bindings[o], r.controls.get(o) ?? [], t, (e, t) => M(e, t, c), r.valueRules, r.legacyValueRules);
|
|
1136
|
+
if (!l.ok) return [H(r.document, i, "local.runtime.value", l.detail)];
|
|
1131
1137
|
s[o] = B(l.value);
|
|
1132
1138
|
}
|
|
1133
|
-
return K(
|
|
1139
|
+
return K(r, i.id, s) ? [H(r.document, i, "local.runtime.value", n("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(N[a[e]], t)) || Q(s), []);
|
|
1134
1140
|
},
|
|
1135
1141
|
parameterNames() {
|
|
1136
|
-
return q(),
|
|
1142
|
+
return q(), C().publicNames;
|
|
1137
1143
|
},
|
|
1138
1144
|
getParameter(e) {
|
|
1139
1145
|
q();
|
|
1140
|
-
let t = le(
|
|
1146
|
+
let t = le(C(), e);
|
|
1141
1147
|
return t === void 0 ? void 0 : B(t);
|
|
1142
1148
|
},
|
|
1143
1149
|
getParameters() {
|
|
1144
1150
|
q();
|
|
1145
|
-
let e =
|
|
1151
|
+
let e = C(), t = {};
|
|
1146
1152
|
for (let n of e.publicNames) {
|
|
1147
|
-
let e =
|
|
1153
|
+
let e = N[n];
|
|
1148
1154
|
t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
|
|
1149
1155
|
}
|
|
1150
1156
|
return Object.freeze(t);
|
|
1151
1157
|
},
|
|
1152
1158
|
readSubmissionFields(e) {
|
|
1153
1159
|
q();
|
|
1154
|
-
let t =
|
|
1160
|
+
let t = C(), n = /* @__PURE__ */ new Map(), r = (e, n) => M(e, n, F, t);
|
|
1155
1161
|
if (e.length === 0) return {
|
|
1156
1162
|
ok: !1,
|
|
1157
1163
|
field: "",
|
|
@@ -1164,7 +1170,7 @@ function ye(e, t) {
|
|
|
1164
1170
|
field: i,
|
|
1165
1171
|
reason: "unavailable"
|
|
1166
1172
|
};
|
|
1167
|
-
let a =
|
|
1173
|
+
let a = L(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
|
|
1168
1174
|
if (!a.ok) {
|
|
1169
1175
|
let e = a.detail.key;
|
|
1170
1176
|
return {
|
|
@@ -1177,7 +1183,7 @@ function ye(e, t) {
|
|
|
1177
1183
|
}
|
|
1178
1184
|
let i = Object.create(null);
|
|
1179
1185
|
for (let [e, r] of n) {
|
|
1180
|
-
for (let [n, i] of
|
|
1186
|
+
for (let [n, i] of h.get(e) ?? []) {
|
|
1181
1187
|
if (!t.controls.get(e)?.some((e) => e.id === i)) continue;
|
|
1182
1188
|
let a = n(B(r));
|
|
1183
1189
|
if (a) return {
|
|
@@ -1195,11 +1201,11 @@ function ye(e, t) {
|
|
|
1195
1201
|
},
|
|
1196
1202
|
registerSubmissionField(e, t) {
|
|
1197
1203
|
if (z) return () => {};
|
|
1198
|
-
let n =
|
|
1204
|
+
let n = C(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
|
|
1199
1205
|
if (!r || r.startsWith("@")) return () => {};
|
|
1200
|
-
let i =
|
|
1201
|
-
return i ||
|
|
1202
|
-
i.delete(t), i.size === 0 &&
|
|
1206
|
+
let i = h.get(r);
|
|
1207
|
+
return i || h.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
|
|
1208
|
+
i.delete(t), i.size === 0 && h.get(r) === i && h.delete(r);
|
|
1203
1209
|
};
|
|
1204
1210
|
},
|
|
1205
1211
|
setParameter(e, t) {
|
|
@@ -1212,12 +1218,12 @@ function ye(e, t) {
|
|
|
1212
1218
|
return ye(e);
|
|
1213
1219
|
},
|
|
1214
1220
|
getExternal(e) {
|
|
1215
|
-
if (q(), Object.hasOwn(
|
|
1221
|
+
if (q(), Object.hasOwn(C().document.externals ?? {}, e) && Object.hasOwn(I, e)) return B(I[e]);
|
|
1216
1222
|
},
|
|
1217
1223
|
getExternalValues() {
|
|
1218
1224
|
q();
|
|
1219
1225
|
let e = {};
|
|
1220
|
-
for (let [t, n] of Object.entries(
|
|
1226
|
+
for (let [t, n] of Object.entries(j(C()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
|
|
1221
1227
|
return Object.freeze(e);
|
|
1222
1228
|
},
|
|
1223
1229
|
setExternalValues(e) {
|
|
@@ -1225,37 +1231,37 @@ function ye(e, t) {
|
|
|
1225
1231
|
},
|
|
1226
1232
|
evaluate(e) {
|
|
1227
1233
|
q();
|
|
1228
|
-
let t = be(e).evaluate(
|
|
1234
|
+
let t = be(e).evaluate(F);
|
|
1229
1235
|
return Array.isArray(t) ? t.slice() : t;
|
|
1230
1236
|
},
|
|
1231
1237
|
validate() {
|
|
1232
|
-
if (q(), V && V.revision ===
|
|
1238
|
+
if (q(), V && V.revision === P) return V.diagnostics.map(fe);
|
|
1233
1239
|
let e = xe();
|
|
1234
1240
|
return V = {
|
|
1235
|
-
revision:
|
|
1241
|
+
revision: P,
|
|
1236
1242
|
diagnostics: e
|
|
1237
1243
|
}, e.map(fe);
|
|
1238
1244
|
},
|
|
1239
1245
|
text(e) {
|
|
1240
|
-
return q(), s(e,
|
|
1246
|
+
return q(), s(e, F);
|
|
1241
1247
|
},
|
|
1242
1248
|
reset(e) {
|
|
1243
1249
|
q();
|
|
1244
|
-
let t =
|
|
1250
|
+
let t = C(), n = t.nodeIndex.get(e.id);
|
|
1245
1251
|
if (!n) return;
|
|
1246
|
-
let
|
|
1252
|
+
let i = we(n), s = { ...N };
|
|
1247
1253
|
for (let [e, n] of Object.entries(t.document.bindings)) {
|
|
1248
|
-
if (!(t.controls.get(e) ?? []).some((e) =>
|
|
1254
|
+
if (!(t.controls.get(e) ?? []).some((e) => i.has(e.id))) continue;
|
|
1249
1255
|
let c = o(n.initial);
|
|
1250
|
-
if (c) throw new a("expression-budget", `Parameter "${e}": ${
|
|
1256
|
+
if (c) throw new a("expression-budget", `Parameter "${e}": ${r(c)}`, 0);
|
|
1251
1257
|
s[e] = B(n.initial);
|
|
1252
1258
|
}
|
|
1253
|
-
for (let e of
|
|
1259
|
+
for (let e of i) G.set(e, (G.get(e) ?? 0) + 1);
|
|
1254
1260
|
Q(s);
|
|
1255
1261
|
},
|
|
1256
1262
|
resetToken(e) {
|
|
1257
1263
|
q();
|
|
1258
|
-
let t =
|
|
1264
|
+
let t = C().nodeIndex.get(e.id);
|
|
1259
1265
|
return t ? G.get(t.id) ?? 0 : 0;
|
|
1260
1266
|
},
|
|
1261
1267
|
subscribe(e) {
|
|
@@ -1266,8 +1272,8 @@ function ye(e, t) {
|
|
|
1266
1272
|
dispose() {
|
|
1267
1273
|
if (!z) {
|
|
1268
1274
|
z = !0, f.dispose();
|
|
1269
|
-
for (let e of
|
|
1270
|
-
|
|
1275
|
+
for (let e of k.values()) e();
|
|
1276
|
+
k.clear(), h.clear(), D.state.flush(), u && D.scheduler.dispose(), W.clear(), y.clear(), x.clear(), S.computationExpressions.clear(), S.constErrors.clear(), S.cycleErrors.clear(), S.validationRules.length = 0, G.clear();
|
|
1271
1277
|
}
|
|
1272
1278
|
}
|
|
1273
1279
|
};
|