reactive-md 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +66 -0
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING-ch.md +6 -62
- package/CONTRIBUTING.md +5 -63
- package/README-ch.md +232 -67
- package/README-en.md +209 -71
- package/README.md +209 -71
- package/SECURITY-ch.md +3 -1
- package/SECURITY.md +3 -1
- package/THIRD_PARTY_NOTICES.md +1909 -87
- package/cli/args.mjs +33 -1
- package/cli/build.mjs +62 -1
- package/cli/check.mjs +444 -0
- package/cli/help.mjs +181 -3
- package/cli/init.mjs +1577 -0
- package/cli/main.mjs +11 -1
- package/cli/package-loader.mjs +41 -0
- package/dist-library/LocalDocumentView-6trX7xJc.js +97920 -0
- package/dist-library/{authoring-BEVyth5X.js → authoring-BsfSwQRm.js} +237 -209
- package/dist-library/compiler--ea2CKQF.js +61 -0
- package/dist-library/compiler-core-kPiH-gOV.js +11805 -0
- package/dist-library/component-state-Cq2K5gkS.js +490 -0
- package/dist-library/component-state-D_cw_EHe.js +54 -0
- package/dist-library/config-validation-DXTynAw7.js +3005 -0
- package/dist-library/default-components-Z_YMio5P.js +2346 -0
- package/dist-library/identity-MYJXKSkB.js +1443 -0
- package/dist-library/math-display-BJz4gbFc.js +24000 -0
- package/dist-library/math-sample-BGEW49zY.js +1124 -0
- package/dist-library/options-CX5m5n-J.js +115 -0
- package/dist-library/parser-standard-DlCk7sLo.js +10122 -0
- package/dist-library/props-DGlBk0e5.js +183 -0
- package/dist-library/react-ByOHunUW.js +122 -0
- package/dist-library/reactive-md-authoring.js +712 -1077
- package/dist-library/reactive-md-build.js +7966 -0
- package/dist-library/reactive-md-compiler-standard.js +33 -0
- package/dist-library/reactive-md-compiler.js +22 -0
- package/dist-library/reactive-md-default-packs.js +71 -0
- package/dist-library/reactive-md-default-preset.js +10 -0
- package/dist-library/reactive-md-export.js +111 -0
- package/dist-library/reactive-md-print.css +18 -3
- package/dist-library/reactive-md-react-runtime.js +251 -0
- package/dist-library/reactive-md-react-server.js +55 -0
- package/dist-library/reactive-md-react-unstyled.js +9 -1
- package/dist-library/reactive-md-react.js +9 -1
- package/dist-library/reactive-md-runtime-browser.js +51 -0
- package/dist-library/reactive-md-runtime.js +3 -0
- package/dist-library/reactive-md-sdk.js +6 -0
- package/dist-library/reactive-md-standalone-host.js +442 -0
- package/dist-library/reactive-md-testing-browser.js +523 -0
- package/dist-library/reactive-md-testing-react.js +221 -0
- package/dist-library/reactive-md-testing.js +638 -0
- package/dist-library/reactive-md-vite.js +959 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1080 -795
- package/dist-library/registry-B9Jc3FVe.js +1174 -0
- package/dist-library/resources-BGt8mpDA.js +204 -0
- package/dist-library/runtime-C-sbfpOX.js +1157 -0
- package/dist-library/runtime-Dkq7ldyg.js +172 -0
- package/dist-library/schema-ZFufO8V0.js +39 -0
- package/dist-library/shareable-DDVL4Fi9.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +168 -0
- package/dist-library/types/authoring/conformance.d.ts +24 -0
- package/dist-library/types/{editor → authoring}/editor-i18n.d.ts +3 -24
- package/dist-library/types/authoring/extensions.d.ts +13 -0
- package/dist-library/types/authoring/index.d.ts +14 -11
- package/dist-library/types/authoring/insert.d.ts +16 -0
- package/dist-library/types/{editor → authoring}/native-components.d.ts +19 -2
- package/dist-library/types/authoring/templates.d.ts +65 -0
- package/dist-library/types/build/diagnostics.d.ts +8 -0
- package/dist-library/types/build/digest.d.ts +5 -0
- package/dist-library/types/build/entry.d.ts +9 -0
- package/dist-library/types/build/host.d.ts +36 -0
- package/dist-library/types/build/index.d.ts +99 -0
- package/dist-library/types/build/notices.d.ts +29 -0
- package/dist-library/types/build/resources.d.ts +60 -0
- package/dist-library/types/build/vite.d.ts +15 -0
- package/dist-library/types/compiler/index.d.ts +22 -0
- package/dist-library/types/compiler/result.d.ts +30 -0
- package/dist-library/types/compiler/standard.d.ts +16 -0
- package/dist-library/types/compiler/types.d.ts +69 -0
- package/dist-library/types/components/chart-motion.d.ts +12 -0
- package/dist-library/types/components/controls.d.ts +21 -0
- package/dist-library/types/{local → components}/data-table.d.ts +10 -24
- package/dist-library/types/components/default-chart-types.d.ts +22 -0
- package/dist-library/types/components/default-chart.d.ts +2 -0
- package/dist-library/types/components/default-preset.d.ts +10 -0
- package/dist-library/types/components/diagram-inspector.d.ts +24 -0
- package/dist-library/types/components/gallery.d.ts +6 -0
- package/dist-library/types/components/layout.d.ts +23 -0
- package/dist-library/types/components/mafs-plot-grid.d.ts +57 -0
- package/dist-library/types/components/mafs-visuals.d.ts +40 -0
- package/dist-library/types/components/numeric-sliders.d.ts +3 -0
- package/dist-library/types/components/uiarc/calendar/calendar.d.ts +26 -0
- package/dist-library/types/components/uiarc/date-picker/date-picker.d.ts +29 -0
- package/dist-library/types/components/uiarc/lib/motion-tokens.d.ts +2 -0
- package/dist-library/types/components/uiarc/lib/use-today.d.ts +2 -0
- package/dist-library/types/components/uiarc/motion-tokens.d.ts +60 -0
- package/dist-library/types/components/uiarc/rmd-motion.d.ts +12 -0
- package/dist-library/types/components/uiarc/select/select.d.ts +21 -0
- package/dist-library/types/components/uiarc/slider/slider.d.ts +53 -0
- package/dist-library/types/components/use-hydrated.d.ts +6 -0
- package/dist-library/types/components/visuals.d.ts +13 -0
- package/dist-library/types/export/component-state.d.ts +39 -0
- package/dist-library/types/export/index.d.ts +47 -0
- package/dist-library/types/export/requirements.d.ts +23 -0
- package/dist-library/types/export/resources.d.ts +8 -0
- package/dist-library/types/export/restoration.d.ts +52 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +16 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +64 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +46 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +9 -0
- package/dist-library/types/local/compilation/compiler.d.ts +34 -0
- package/dist-library/types/local/compilation/component-kernel.d.ts +487 -0
- package/dist-library/types/local/{dependencies.d.ts → compilation/dependencies.d.ts} +4 -3
- package/dist-library/types/local/{diagnostics.d.ts → configuration/diagnostic-messages.d.ts} +193 -65
- package/dist-library/types/local/configuration/diagnostics.d.ts +58 -0
- package/dist-library/types/local/{limits.d.ts → configuration/limits.d.ts} +15 -2
- package/dist-library/types/local/configuration/options-core.d.ts +120 -0
- package/dist-library/types/local/configuration/options.d.ts +17 -0
- package/dist-library/types/local/configuration/portable-options.d.ts +3 -0
- package/dist-library/types/local/configuration/schema-core.d.ts +32 -0
- package/dist-library/types/local/configuration/schema.d.ts +12 -0
- package/dist-library/types/local/contracts/types.d.ts +519 -0
- package/dist-library/types/local/{version.d.ts → contracts/version.d.ts} +1 -1
- package/dist-library/types/local/{computations.d.ts → evaluation/computations.d.ts} +6 -3
- package/dist-library/types/local/{expression.d.ts → evaluation/expression.d.ts} +2 -2
- package/dist-library/types/local/{math-display.d.ts → evaluation/math-display.d.ts} +2 -16
- package/dist-library/types/local/evaluation/math-sample.d.ts +23 -0
- package/dist-library/types/local/evaluation/math.d.ts +73 -0
- package/dist-library/types/local/{validation.d.ts → evaluation/validation.d.ts} +1 -1
- package/dist-library/types/local/html/html-details.d.ts +16 -0
- package/dist-library/types/local/html/html-entities.d.ts +7 -0
- package/dist-library/types/local/html/html-policy.d.ts +43 -0
- package/dist-library/types/local/html/html-recovery.d.ts +16 -0
- package/dist-library/types/local/html/html-table-names.d.ts +9 -0
- package/dist-library/types/local/{html-table.d.ts → html/html-table.d.ts} +2 -6
- package/dist-library/types/local/{html.d.ts → html/html.d.ts} +1 -1
- package/dist-library/types/local/index.d.ts +31 -24
- package/dist-library/types/local/markdown/fast-markdown.d.ts +137 -0
- package/dist-library/types/local/{footnotes.d.ts → markdown/footnotes.d.ts} +1 -1
- package/dist-library/types/local/{heading-anchors.d.ts → markdown/heading-anchors.d.ts} +12 -2
- package/dist-library/types/local/markdown/markdown-blocks.d.ts +55 -0
- package/dist-library/types/local/markdown/markdown-structure.d.ts +3 -0
- package/dist-library/types/local/markdown/plain-paragraphs.d.ts +10 -0
- package/dist-library/types/local/parsing/lexical.d.ts +21 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +67 -0
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +42 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +65 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +7 -0
- package/dist-library/types/local/parsing/parser.d.ts +16 -0
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +48 -0
- package/dist-library/types/local/{LocalDocumentView.d.ts → rendering/LocalDocumentView.d.ts} +67 -24
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +36 -0
- package/dist-library/types/local/rendering/render-types.d.ts +57 -0
- package/dist-library/types/local/rendering/view-revision.d.ts +75 -0
- package/dist-library/types/local/{retention.d.ts → runtime/retention.d.ts} +1 -1
- package/dist-library/types/local/runtime/runtime.d.ts +34 -0
- package/dist-library/types/local/{state.d.ts → runtime/state.d.ts} +4 -4
- package/dist-library/types/local/session/compiler-cache.d.ts +44 -0
- package/dist-library/types/local/session/incremental.d.ts +48 -0
- package/dist-library/types/local/session/parse-session.d.ts +62 -0
- package/dist-library/types/local/session/row-reuse.d.ts +46 -0
- package/dist-library/types/local/{authoring.d.ts → source/authoring.d.ts} +11 -3
- package/dist-library/types/local/source/node-walk.d.ts +3 -0
- package/dist-library/types/local/source/source-context.d.ts +63 -0
- package/dist-library/types/local/{source-migration.d.ts → source/source-migration.d.ts} +2 -2
- package/dist-library/types/local/{i18n.d.ts → theme/i18n.d.ts} +2 -2
- package/dist-library/types/local/theme/theme-name.d.ts +3 -0
- package/dist-library/types/local/{theme.d.ts → theme/theme.d.ts} +3 -3
- package/dist-library/types/local/transport/compile-patch.d.ts +127 -0
- package/dist-library/types/local/{compiled-data.d.ts → transport/compiled-data.d.ts} +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +17 -0
- package/dist-library/types/local/transport/shared-data.d.ts +10 -0
- package/dist-library/types/local/transport/worker.d.ts +265 -0
- package/dist-library/types/local/widgets/visuals.d.ts +25 -0
- package/dist-library/types/presets/default-authoring.d.ts +50 -0
- package/dist-library/types/presets/default-components.d.ts +4 -0
- package/dist-library/types/presets/default-semantics.d.ts +8 -0
- package/dist-library/types/presets/default.d.ts +11 -0
- package/dist-library/types/presets/identity.d.ts +7 -0
- package/dist-library/types/presets/packs.d.ts +4 -0
- package/dist-library/types/react/component-api.d.ts +260 -0
- package/dist-library/types/react/component-primitives.d.ts +21 -0
- package/dist-library/types/react/component-utils.d.ts +125 -0
- package/dist-library/types/react/default-theme.d.ts +6 -0
- package/dist-library/types/react/field-validation.d.ts +11 -0
- package/dist-library/types/react/index.d.ts +17 -5
- package/dist-library/types/react/overflow-text-tooltip.d.ts +6 -0
- package/dist-library/types/react/package.d.ts +69 -0
- package/dist-library/types/react/runtime/common.d.ts +4 -0
- package/dist-library/types/react/runtime/index.d.ts +8 -0
- package/dist-library/types/react/runtime/useComponentState.d.ts +30 -0
- package/dist-library/types/react/runtime/useKeys.d.ts +16 -0
- package/dist-library/types/react/runtime/useSwipe.d.ts +27 -0
- package/dist-library/types/react/runtime/useTicker.d.ts +17 -0
- package/dist-library/types/react/sdk.d.ts +110 -0
- package/dist-library/types/react/server.d.ts +15 -0
- package/dist-library/types/react/tooltip-layer.d.ts +10 -0
- package/dist-library/types/react/use-draft-field.d.ts +17 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +63 -0
- package/dist-library/types/runtime-services/component-state.d.ts +152 -0
- package/dist-library/types/runtime-services/identity.d.ts +41 -0
- package/dist-library/types/runtime-services/index.d.ts +10 -0
- package/dist-library/types/runtime-services/random.d.ts +42 -0
- package/dist-library/types/runtime-services/runtime.d.ts +51 -0
- package/dist-library/types/runtime-services/scheduler.d.ts +44 -0
- package/dist-library/types/sdk/assembly.d.ts +73 -0
- package/dist-library/types/sdk/compat-profile.d.ts +57 -0
- package/dist-library/types/sdk/compiler-config.d.ts +33 -0
- package/dist-library/types/sdk/config-validation.d.ts +33 -0
- package/dist-library/types/sdk/config.d.ts +35 -0
- package/dist-library/types/sdk/hash.d.ts +9 -0
- package/dist-library/types/sdk/index.d.ts +10 -0
- package/dist-library/types/sdk/manifest.d.ts +49 -0
- package/dist-library/types/sdk/pattern.d.ts +11 -0
- package/dist-library/types/sdk/preset-core.d.ts +11 -0
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +33 -0
- package/dist-library/types/sdk/registry-core.d.ts +16 -0
- package/dist-library/types/sdk/registry.d.ts +18 -0
- package/dist-library/types/sdk/theme.d.ts +73 -0
- package/dist-library/types/sdk/types.d.ts +221 -0
- package/dist-library/types/sdk/version.d.ts +49 -0
- package/dist-library/types/shareable.d.ts +29 -3
- package/dist-library/types/standalone/diagnostics.d.ts +16 -0
- package/dist-library/types/standalone/events.d.ts +4 -0
- package/dist-library/types/standalone/library.d.ts +6 -0
- package/dist-library/types/standalone/payload.d.ts +15 -0
- package/dist-library/types/standalone/prepare.d.ts +21 -0
- package/dist-library/types/standalone/session.d.ts +68 -0
- package/dist-library/types/standalone/version.d.ts +7 -0
- package/dist-library/types/testing/behavior.d.ts +19 -0
- package/dist-library/types/testing/browser.d.ts +126 -0
- package/dist-library/types/testing/cases.d.ts +16 -0
- package/dist-library/types/testing/index.d.ts +13 -0
- package/dist-library/types/testing/manifest.d.ts +10 -0
- package/dist-library/types/testing/react.d.ts +45 -0
- package/dist-library/types/testing/report.d.ts +20 -0
- package/dist-library/types/testing/types.d.ts +125 -0
- package/dist-library/types/testing/values.d.ts +22 -0
- package/dist-library/types/vite/client.d.ts +36 -0
- package/dist-library/types/vite/discovery.d.ts +51 -0
- package/dist-library/types/vite/index.d.ts +31 -0
- package/dist-library/types/vite/registration.d.ts +109 -0
- package/dist-library/types-BFCrMrg0.js +52 -0
- package/dist-library/validation-W-bmny-x.js +2253 -0
- package/dist-library/values-CIt8AjiU.js +134 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +591 -95
- package/docs/README-ch.md +90 -0
- package/docs/README.md +87 -81
- package/docs/compatibility/compatibility-ch.md +22 -14
- package/docs/compatibility/compatibility-en.md +22 -14
- package/docs/compatibility/source-versioning-ch.md +15 -12
- package/docs/compatibility/source-versioning-en.md +16 -13
- package/docs/development/component-development-ch.md +51 -195
- package/docs/development/component-development-en.md +51 -195
- package/docs/development/component-development-reference-ch.md +253 -0
- package/docs/development/component-development-reference-en.md +238 -0
- package/docs/development/component-protocol-ch.md +51 -50
- package/docs/development/component-protocol-en.md +52 -49
- package/docs/development/local-module-layout-ch.md +59 -0
- package/docs/development/local-module-layout-en.md +59 -0
- package/docs/development/performance-overview-ch.md +402 -0
- package/docs/development/performance-overview-en.md +402 -0
- package/docs/development/releasing-ch.md +8 -104
- package/docs/development/releasing-en.md +8 -104
- package/docs/guides/local-guide-ch.md +28 -9
- package/docs/guides/local-guide-en.md +31 -12
- package/docs/integration/author-tools-ch.md +4 -2
- package/docs/integration/author-tools-en.md +4 -2
- package/docs/integration/codemirror-ch.md +52 -0
- package/docs/integration/codemirror-en.md +29 -0
- package/docs/integration/compiler-ch.md +47 -0
- package/docs/integration/compiler-en.md +34 -0
- package/docs/integration/directory-discovery-ch.md +53 -0
- package/docs/integration/directory-discovery-en.md +31 -0
- package/docs/integration/editor-ch.md +48 -21
- package/docs/integration/editor-en.md +48 -21
- package/docs/integration/extension-sdk-ch.md +392 -0
- package/docs/integration/extension-sdk-en.md +377 -0
- package/docs/integration/local-integration-ch.md +63 -9
- package/docs/integration/local-integration-en.md +89 -13
- package/docs/integration/repository-split-ch.md +40 -0
- package/docs/integration/repository-split-en.md +23 -0
- package/docs/integration/shareable-export-ch.md +46 -2
- package/docs/integration/shareable-export-en.md +46 -2
- package/docs/reference/computations-formatting-ch.md +4 -2
- package/docs/reference/computations-formatting-en.md +4 -2
- package/docs/reference/constraints-collections-ch.md +21 -1
- package/docs/reference/constraints-collections-en.md +21 -1
- package/docs/reference/diagnostics-counting-ch.md +1 -1
- package/docs/reference/diagnostics-counting-en.md +1 -1
- package/docs/reference/html-compatibility-ch.md +4 -0
- package/docs/reference/html-compatibility-en.md +4 -0
- package/docs/reference/local-components-v2-ch.md +2 -0
- package/docs/reference/local-components-v2-en.md +2 -0
- package/docs/reference/local-interaction-syntax-ch.md +51 -15
- package/docs/reference/local-interaction-syntax-en.md +58 -14
- package/docs/reference/theme-protocol-ch.md +79 -7
- package/docs/reference/theme-protocol-en.md +79 -7
- package/docs/reference/tolerance-ch.md +64 -0
- package/docs/reference/tolerance-en.md +57 -0
- package/docs/releases/release-0.4.0-ch.md +2 -0
- package/docs/releases/release-0.4.0-en.md +2 -0
- package/docs/releases/release-0.4.1-ch.md +2 -0
- package/docs/releases/release-0.4.1-en.md +2 -0
- package/docs/releases/release-0.5.0-ch.md +2 -0
- package/docs/releases/release-0.5.0-en.md +2 -0
- package/docs/releases/release-0.5.1-ch.md +2 -0
- package/docs/releases/release-0.5.1-en.md +2 -0
- package/docs/releases/release-0.5.2-ch.md +2 -0
- package/docs/releases/release-0.5.2-en.md +2 -0
- package/docs/releases/release-0.5.3-ch.md +2 -0
- package/docs/releases/release-0.5.3-en.md +2 -0
- package/docs/releases/release-0.6.0-ch.md +2 -0
- package/docs/releases/release-0.6.0-en.md +2 -0
- package/docs/releases/release-0.6.1-ch.md +2 -0
- package/docs/releases/release-0.6.1-en.md +2 -0
- package/docs/releases/release-0.7.0-ch.md +86 -0
- package/docs/releases/release-0.7.0-en.md +86 -0
- package/docs/releases/release-0.8.0-ch.md +126 -0
- package/docs/releases/release-0.8.0-en.md +126 -0
- package/examples/component-package/LICENSE +21 -0
- package/examples/component-package/NOTICES.md +12 -0
- package/examples/component-package/README-ch.md +101 -0
- package/examples/component-package/README.md +133 -0
- package/examples/component-package/package.json +35 -0
- package/examples/component-package/sample/document.reactive.md +14 -0
- package/examples/component-package/scripts/build-export.mjs +44 -0
- package/examples/component-package/scripts/build.mjs +130 -0
- package/examples/component-package/scripts/verify.mjs +257 -0
- package/examples/component-package/src/assets/notice.svg +4 -0
- package/examples/component-package/src/component.css +40 -0
- package/examples/component-package/src/components.tsx +105 -0
- package/examples/component-package/src/harness.tsx +34 -0
- package/examples/component-package/src/manifests.ts +71 -0
- package/examples/component-package/src/node-entry.ts +18 -0
- package/examples/component-package/src/sample.ts +4 -0
- package/examples/component-package/src/theme.css +44 -0
- package/examples/component-package/src/theme.ts +22 -0
- package/examples/component-package/tsconfig.json +15 -0
- package/examples/conformance/README-ch.md +55 -0
- package/examples/conformance/README.md +2 -0
- package/examples/conformance/local-draft-3.json +296 -0
- package/examples/game-2048-package/LICENSE +21 -0
- package/examples/game-2048-package/NOTICES.md +11 -0
- package/examples/game-2048-package/README-ch.md +97 -0
- package/examples/game-2048-package/README.md +102 -0
- package/examples/game-2048-package/package.json +35 -0
- package/examples/game-2048-package/sample/document.reactive.md +17 -0
- package/examples/game-2048-package/scripts/build-export.mjs +44 -0
- package/examples/game-2048-package/scripts/build.mjs +130 -0
- package/examples/game-2048-package/scripts/verify.mjs +180 -0
- package/examples/game-2048-package/src/component.css +161 -0
- package/examples/game-2048-package/src/components.tsx +326 -0
- package/examples/game-2048-package/src/game-engine.ts +228 -0
- package/examples/game-2048-package/src/harness.tsx +34 -0
- package/examples/game-2048-package/src/manifest.ts +85 -0
- package/examples/game-2048-package/src/node-entry.ts +30 -0
- package/examples/game-2048-package/src/sample.ts +4 -0
- package/examples/game-2048-package/tsconfig.json +15 -0
- package/examples/integration/README-ch.md +63 -0
- package/examples/integration/README.md +17 -1
- package/examples/integration/extension-sdk/README-ch.md +24 -0
- package/examples/integration/extension-sdk/README.md +24 -0
- package/examples/integration/extension-sdk/advanced-standalone.ts +6 -0
- package/examples/integration/extension-sdk/advanced.tsx +101 -0
- package/examples/integration/extension-sdk/env.d.ts +2 -0
- package/examples/integration/extension-sdk/extensions.tsx +97 -0
- package/examples/integration/extension-sdk/index.html +3 -0
- package/examples/integration/extension-sdk/main.tsx +10 -0
- package/examples/integration/extension-sdk/package.json +6 -0
- package/examples/integration/extension-sdk/standalone.ts +7 -0
- package/examples/integration/extension-sdk/tsconfig.json +8 -0
- package/examples/integration/react-comprehensive/index.html +12 -0
- package/examples/integration/react-comprehensive/main.jsx +123 -0
- package/examples/integration/react-comprehensive/package.json +18 -0
- package/examples/local/README-ch.md +76 -0
- package/examples/local/README.md +4 -2
- package/examples/local/scenarios/blog-zh.reactive.md +71 -0
- package/examples/local/scenarios/blog.reactive.md +71 -0
- package/examples/local/scenarios/classroom-zh.reactive.md +97 -0
- package/examples/local/scenarios/classroom.reactive.md +97 -0
- package/examples/local/scenarios/proposal-zh.reactive.md +79 -0
- package/examples/local/scenarios/proposal.reactive.md +79 -0
- package/examples/local/scenarios/survey-zh.reactive.md +74 -0
- package/examples/local/scenarios/survey.reactive.md +74 -0
- package/examples/local/showcase/README-ch.md +22 -0
- package/examples/local/showcase/README.md +9 -3
- package/examples/local/showcase/features.reactive.md +637 -0
- package/examples/local/showcase/zh/features.reactive.md +637 -0
- package/examples/sci-fi-theme/README-ch.md +131 -0
- package/examples/sci-fi-theme/README.md +146 -0
- package/examples/sci-fi-theme/demo/demo.css +532 -0
- package/examples/sci-fi-theme/demo/document.reactive.md +185 -0
- package/examples/sci-fi-theme/demo/index.html +13 -0
- package/examples/sci-fi-theme/demo/main.tsx +180 -0
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -0
- package/examples/sci-fi-theme/docs/design-system.md +474 -0
- package/examples/sci-fi-theme/package.json +27 -0
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -0
- package/examples/sci-fi-theme/src/components.css +1460 -0
- package/examples/sci-fi-theme/src/index.ts +6 -0
- package/examples/sci-fi-theme/src/sci-fi.css +5 -0
- package/examples/sci-fi-theme/src/theme.ts +37 -0
- package/examples/sci-fi-theme/src/tokens.css +408 -0
- package/examples/sci-fi-theme/tsconfig.json +20 -0
- package/examples/sci-fi-theme/vite.config.ts +24 -0
- package/examples/tetris-package/LICENSE +21 -0
- package/examples/tetris-package/NOTICES.md +11 -0
- package/examples/tetris-package/README-ch.md +91 -0
- package/examples/tetris-package/README.md +95 -0
- package/examples/tetris-package/package.json +35 -0
- package/examples/tetris-package/sample/document.reactive.md +16 -0
- package/examples/tetris-package/scripts/build-export.mjs +44 -0
- package/examples/tetris-package/scripts/build.mjs +130 -0
- package/examples/tetris-package/scripts/verify.mjs +173 -0
- package/examples/tetris-package/src/component.css +145 -0
- package/examples/tetris-package/src/components.tsx +334 -0
- package/examples/tetris-package/src/harness.tsx +34 -0
- package/examples/tetris-package/src/manifests.ts +93 -0
- package/examples/tetris-package/src/node-entry.ts +16 -0
- package/examples/tetris-package/src/sample.ts +4 -0
- package/examples/tetris-package/src/tetris-engine.ts +325 -0
- package/examples/tetris-package/tsconfig.json +15 -0
- package/package.json +98 -44
- package/dist-library/compiler-Cm3ppMxG.js +0 -46044
- package/dist-library/react-Bh7_oxZp.js +0 -59655
- package/dist-library/reactive-md-editor.css +0 -2
- package/dist-library/reactive-md-editor.js +0 -3853
- package/dist-library/runtime-DlFYQ4s_.js +0 -498
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +0 -7
- package/dist-library/types/editor/editor-toolbar.d.ts +0 -24
- package/dist-library/types/editor/editor-view-bar.d.ts +0 -11
- package/dist-library/types/editor/extended-native-components.d.ts +0 -58
- package/dist-library/types/editor/index.d.ts +0 -9
- package/dist-library/types/editor/locale.d.ts +0 -13
- package/dist-library/types/editor/source-authoring.d.ts +0 -59
- package/dist-library/types/editor/types.d.ts +0 -48
- package/dist-library/types/editor/use-gutter-metrics.d.ts +0 -5
- package/dist-library/types/editor/use-source-history.d.ts +0 -16
- package/dist-library/types/local/compiler.d.ts +0 -4
- package/dist-library/types/local/math.d.ts +0 -48
- package/dist-library/types/local/options.d.ts +0 -36
- package/dist-library/types/local/parser.d.ts +0 -13
- package/dist-library/types/local/render-types.d.ts +0 -27
- package/dist-library/types/local/runtime.d.ts +0 -2
- package/dist-library/types/local/schema.d.ts +0 -77
- package/dist-library/types/local/types.d.ts +0 -263
- package/dist-library/types/local/visuals.d.ts +0 -12
- package/dist-library/types/local/worker.d.ts +0 -98
- package/docs/development/performance-ch.md +0 -76
- package/docs/development/performance-en.md +0 -76
- /package/dist-library/types/{editor → authoring}/command-types.d.ts +0 -0
- /package/dist-library/types/{editor → authoring}/editor-commands.d.ts +0 -0
- /package/dist-library/types/local/{locale.d.ts → contracts/locale.d.ts} +0 -0
- /package/dist-library/types/local/{collection-functions.d.ts → evaluation/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/{data-functions.d.ts → evaluation/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/{dates.d.ts → evaluation/dates.d.ts} +0 -0
- /package/dist-library/types/local/{formatting.d.ts → evaluation/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{html-names.d.ts → html/html-names.d.ts} +0 -0
- /package/dist-library/types/local/{text-length.d.ts → source/text-length.d.ts} +0 -0
- /package/dist-library/types/local/{colors.d.ts → theme/colors.d.ts} +0 -0
- /package/dist-library/types/local/{code-block.d.ts → widgets/code-block.d.ts} +0 -0
- /package/dist-library/types/local/{code-languages.d.ts → widgets/code-languages.d.ts} +0 -0
- /package/dist-library/types/local/{diagram-layout.d.ts → widgets/diagram-layout.d.ts} +0 -0
- /package/dist-library/types/local/{image-view.d.ts → widgets/image-view.d.ts} +0 -0
- /package/dist-library/types/local/{math-view.d.ts → widgets/math-view.d.ts} +0 -0
- /package/dist-library/types/local/{table-surface.d.ts → widgets/table-surface.d.ts} +0 -0
|
@@ -0,0 +1,1157 @@
|
|
|
1
|
+
import { ut as e } from "./identity-MYJXKSkB.js";
|
|
2
|
+
import { $ as t, F as n, X as r, j as i, nt as a } from "./config-validation-DXTynAw7.js";
|
|
3
|
+
import { J as o, Q as s, Y as c, Z as l, a as u, at as d, c as f, et as p, i as m, n as h, nt as g, o as _, ot as v, r as ee, rt as y, t as b, tt as x, w as S } from "./validation-W-bmny-x.js";
|
|
4
|
+
import { t as C } from "./registry-B9Jc3FVe.js";
|
|
5
|
+
import { C as w, b as te } from "./component-state-Cq2K5gkS.js";
|
|
6
|
+
import { n as T } from "./runtime-Dkq7ldyg.js";
|
|
7
|
+
// src/local/runtime/retention.ts
|
|
8
|
+
function E(e) {
|
|
9
|
+
let t = /* @__PURE__ */ new Map();
|
|
10
|
+
for (let n of l(e.nodes)) t.set(n.id, n);
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
function D(e, t, n) {
|
|
14
|
+
let r = e.bindingSlots?.[t.id];
|
|
15
|
+
return r !== void 0 && Object.values(r).includes(n);
|
|
16
|
+
}
|
|
17
|
+
function O(e, t, n) {
|
|
18
|
+
let r = t.name ? C(t.name) : void 0;
|
|
19
|
+
if (r?.bindings) {
|
|
20
|
+
let i = e.bindingSlots?.[t.id];
|
|
21
|
+
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;
|
|
22
|
+
} else if (t.attrs?.bind === n || D(e, t, n)) return "initial";
|
|
23
|
+
}
|
|
24
|
+
function k(e) {
|
|
25
|
+
let t = E(e), r = n(e), i = new Set(r?.retentionExclusions ?? []), a = /* @__PURE__ */ new Map();
|
|
26
|
+
for (let [n, o] of Object.entries(e.bindings)) {
|
|
27
|
+
let s = o.nodeIds.flatMap((e) => {
|
|
28
|
+
let n = t.get(e);
|
|
29
|
+
return n ? [n] : [];
|
|
30
|
+
});
|
|
31
|
+
if (!s.length || n.startsWith("@") || i.has(n)) continue;
|
|
32
|
+
let c;
|
|
33
|
+
if (r === void 0) {
|
|
34
|
+
let t = s.map((t) => O(e, t, n));
|
|
35
|
+
if (t.some((e) => e === void 0)) continue;
|
|
36
|
+
c = t;
|
|
37
|
+
} else {
|
|
38
|
+
let e = r.bindingAttributes?.[n]?.initial ?? "initial";
|
|
39
|
+
c = s.map(() => e);
|
|
40
|
+
}
|
|
41
|
+
let l = s.flatMap((e, t) => Object.hasOwn(e.attrs ?? {}, c[t]) ? [e.attrs[c[t]]] : []).sort();
|
|
42
|
+
a.set(n, {
|
|
43
|
+
type: o.type,
|
|
44
|
+
initialDefinition: JSON.stringify([o.initial, l])
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return a;
|
|
48
|
+
}
|
|
49
|
+
function A(e, t) {
|
|
50
|
+
return Object.freeze({
|
|
51
|
+
name: e,
|
|
52
|
+
reason: t
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function ne(e) {
|
|
56
|
+
let t = k(e.previous), n = k(e.next), r = {}, i = [], a = [];
|
|
57
|
+
for (let o of Object.keys(e.state).sort()) {
|
|
58
|
+
if (o.startsWith("@")) {
|
|
59
|
+
a.push(A(o, "internal"));
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
|
|
63
|
+
a.push(A(o, "unknown"));
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
let s = t.get(o), c = n.get(o);
|
|
67
|
+
if (!s || !c) {
|
|
68
|
+
a.push(A(o, "unretainable"));
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (s.type !== c.type) {
|
|
72
|
+
a.push(A(o, "type"));
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (s.initialDefinition !== c.initialDefinition) {
|
|
76
|
+
a.push(A(o, "initial"));
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
let l = e.state[o];
|
|
80
|
+
r[o] = Array.isArray(l) ? Object.freeze([...l]) : l, i.push(o);
|
|
81
|
+
}
|
|
82
|
+
return Object.freeze({
|
|
83
|
+
values: Object.freeze(r),
|
|
84
|
+
retained: Object.freeze(i),
|
|
85
|
+
dropped: Object.freeze(a)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function j(e, t, n) {
|
|
89
|
+
return Object.freeze({
|
|
90
|
+
retained: Object.freeze([...e]),
|
|
91
|
+
dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
|
|
92
|
+
diagnostics: Object.freeze([...n])
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function M(e, t) {
|
|
96
|
+
let n = Object.keys(t.values).sort();
|
|
97
|
+
if (!e.setParameters(t.values).length) return j(n, t.dropped, []);
|
|
98
|
+
let r = [], i = [...t.dropped], a = [];
|
|
99
|
+
for (let o of n) {
|
|
100
|
+
let n = e.setParameter(o, t.values[o]);
|
|
101
|
+
n.length ? (i.push(A(o, "invalid")), a.push(...n)) : r.push(o);
|
|
102
|
+
}
|
|
103
|
+
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), j(r, i, a);
|
|
104
|
+
}
|
|
105
|
+
// src/local/runtime/runtime.ts
|
|
106
|
+
var N = 1e-9, re = 200;
|
|
107
|
+
function P(e) {
|
|
108
|
+
return Array.isArray(e) ? e.slice() : e;
|
|
109
|
+
}
|
|
110
|
+
function ie(e) {
|
|
111
|
+
return {
|
|
112
|
+
...e,
|
|
113
|
+
range: { ...e.range }
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function F(e, t) {
|
|
117
|
+
return Array.isArray(e) || Array.isArray(t) ? !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => e === t[n]) : e === t;
|
|
118
|
+
}
|
|
119
|
+
function I(e, t, n) {
|
|
120
|
+
let r = (e - t) / n;
|
|
121
|
+
return Math.abs(r - Math.round(r)) <= N * Math.max(1, Math.abs(r));
|
|
122
|
+
}
|
|
123
|
+
function ae(e) {
|
|
124
|
+
for (let [t, n] of Object.entries(e)) Array.isArray(n) && !Object.isFrozen(n) && (e[t] = Object.freeze([...n]));
|
|
125
|
+
return Object.freeze(e);
|
|
126
|
+
}
|
|
127
|
+
function L(e, n, r, i) {
|
|
128
|
+
let a = Math.max(0, Math.min(e.source.length, n.range.start)), o = e.source.slice(0, a).split("\n");
|
|
129
|
+
return {
|
|
130
|
+
code: r,
|
|
131
|
+
message: t(i),
|
|
132
|
+
severity: "error",
|
|
133
|
+
range: {
|
|
134
|
+
start: a,
|
|
135
|
+
end: Math.max(a + 1, Math.min(e.source.length, n.range.end))
|
|
136
|
+
},
|
|
137
|
+
line: o.length,
|
|
138
|
+
column: (o.at(-1) ?? "").length + 1,
|
|
139
|
+
messageKey: i.key,
|
|
140
|
+
...i.params ? { params: i.params } : {}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function R(e, t, n) {
|
|
144
|
+
return {
|
|
145
|
+
code: e,
|
|
146
|
+
message: t,
|
|
147
|
+
severity: "error",
|
|
148
|
+
range: {
|
|
149
|
+
start: 0,
|
|
150
|
+
end: 0
|
|
151
|
+
},
|
|
152
|
+
line: 1,
|
|
153
|
+
column: 1,
|
|
154
|
+
...n ? {
|
|
155
|
+
messageKey: n.key,
|
|
156
|
+
...n.params ? { params: n.params } : {}
|
|
157
|
+
} : {}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function z(e, t) {
|
|
161
|
+
return e.attrs?.[t];
|
|
162
|
+
}
|
|
163
|
+
function B(e, t) {
|
|
164
|
+
let n = z(e, t);
|
|
165
|
+
if (n === "true") return !0;
|
|
166
|
+
if (n === "false") return !1;
|
|
167
|
+
}
|
|
168
|
+
function V(e, t) {
|
|
169
|
+
let n = z(e, t);
|
|
170
|
+
if (n === void 0) return;
|
|
171
|
+
let r = Number(n);
|
|
172
|
+
return Number.isFinite(r) ? r : void 0;
|
|
173
|
+
}
|
|
174
|
+
function H(e) {
|
|
175
|
+
return v(e);
|
|
176
|
+
}
|
|
177
|
+
function U(e, t) {
|
|
178
|
+
return {
|
|
179
|
+
ok: !1,
|
|
180
|
+
detail: a(e, t)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function W(e, t) {
|
|
184
|
+
if (t !== void 0) return z(e, t);
|
|
185
|
+
}
|
|
186
|
+
function G(e, t) {
|
|
187
|
+
if (t !== void 0) return V(e, t);
|
|
188
|
+
}
|
|
189
|
+
function K(t, n, r, a = {}) {
|
|
190
|
+
for (let o of r) if (o.kind === "date") {
|
|
191
|
+
if (!i(n)) return U("local.runtime.value.date-invalid");
|
|
192
|
+
let e = a.required ?? (o.required !== void 0 && B(t, o.required) === !0);
|
|
193
|
+
if (n === "" && e) return U("local.runtime.value.date-required");
|
|
194
|
+
let r = a.min ?? W(t, o.min), s = a.max ?? W(t, o.max);
|
|
195
|
+
if (n !== "" && r && n < r) return U("local.runtime.value.date-earlier", { min: r });
|
|
196
|
+
if (n !== "" && s && n > s) return U("local.runtime.value.date-later", { max: s });
|
|
197
|
+
} else if (o.kind === "required") {
|
|
198
|
+
let e = a.required ?? B(t, o.required) === !0;
|
|
199
|
+
if (n === "" && e) return U("local.runtime.value.field-required");
|
|
200
|
+
} else if (o.kind === "length") {
|
|
201
|
+
let e = H(n), r = G(t, o.min), i = G(t, o.max);
|
|
202
|
+
if (r !== void 0 && r > 0 && n !== "" && e < r) return U("local.runtime.value.min-length", { min: r });
|
|
203
|
+
if (i !== void 0 && e > i) return U("local.runtime.value.max-length", { max: i });
|
|
204
|
+
} else if (o.kind === "email" && (W(t, o.type) ?? "text") === o.value && n !== "") {
|
|
205
|
+
if (n.length > 254) return U("local.runtime.value.email-length", { limit: 254 });
|
|
206
|
+
if (!e(n)) return U("local.runtime.value.email-invalid");
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
ok: !0,
|
|
210
|
+
value: n
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
var q = /* @__PURE__ */ new Map();
|
|
214
|
+
function J(e) {
|
|
215
|
+
if (!e.name) return Y;
|
|
216
|
+
let t = q.get(e.name);
|
|
217
|
+
if (t !== void 0) return t ?? Y;
|
|
218
|
+
let n = C(e.name), i = n ? r(n) : Y;
|
|
219
|
+
return q.set(e.name, n ? i : null), i;
|
|
220
|
+
}
|
|
221
|
+
var Y = Object.freeze([]);
|
|
222
|
+
function X(e, n, r, a, o, s = !1) {
|
|
223
|
+
switch (e.type) {
|
|
224
|
+
case "number": {
|
|
225
|
+
if (typeof r != "number" || !Number.isFinite(r)) return U("local.runtime.value.finite-number", { name: e.name });
|
|
226
|
+
let t = e.step ?? 1, i = e.min ?? 0;
|
|
227
|
+
for (let t of n) {
|
|
228
|
+
let n = a(t, "min");
|
|
229
|
+
if (n.present && !n.ok) return U("local.runtime.value.constraint", {
|
|
230
|
+
name: e.name,
|
|
231
|
+
attribute: "min"
|
|
232
|
+
});
|
|
233
|
+
if (n.present && n.ok) {
|
|
234
|
+
if (typeof n.value != "number" || !Number.isFinite(n.value)) return U("local.runtime.value.constraint", {
|
|
235
|
+
name: e.name,
|
|
236
|
+
attribute: "min"
|
|
237
|
+
});
|
|
238
|
+
if (i = n.value, r < n.value) return U("local.runtime.value.min", {
|
|
239
|
+
name: e.name,
|
|
240
|
+
min: n.value
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
let o = a(t, "max");
|
|
244
|
+
if (o.present && !o.ok) return U("local.runtime.value.constraint", {
|
|
245
|
+
name: e.name,
|
|
246
|
+
attribute: "max"
|
|
247
|
+
});
|
|
248
|
+
if (o.present && o.ok) {
|
|
249
|
+
if (typeof o.value != "number" || !Number.isFinite(o.value)) return U("local.runtime.value.constraint", {
|
|
250
|
+
name: e.name,
|
|
251
|
+
attribute: "max"
|
|
252
|
+
});
|
|
253
|
+
if (r > o.value) return U("local.runtime.value.max", {
|
|
254
|
+
name: e.name,
|
|
255
|
+
max: o.value
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (n.present && n.ok && o.present && o.ok && typeof n.value == "number" && typeof o.value == "number" && n.value > o.value) return U("local.runtime.value.constraint-range", { name: e.name });
|
|
259
|
+
}
|
|
260
|
+
return e.min !== void 0 && r < e.min ? U("local.runtime.value.min", {
|
|
261
|
+
name: e.name,
|
|
262
|
+
min: e.min
|
|
263
|
+
}) : e.max !== void 0 && r > e.max ? U("local.runtime.value.max", {
|
|
264
|
+
name: e.name,
|
|
265
|
+
max: e.max
|
|
266
|
+
}) : t > 0 && !I(r, i, t) ? U("local.runtime.value.step", {
|
|
267
|
+
name: e.name,
|
|
268
|
+
step: t,
|
|
269
|
+
base: i
|
|
270
|
+
}) : {
|
|
271
|
+
ok: !0,
|
|
272
|
+
value: r
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
case "boolean": return typeof r == "boolean" ? {
|
|
276
|
+
ok: !0,
|
|
277
|
+
value: r
|
|
278
|
+
} : U("local.runtime.value.boolean", { name: e.name });
|
|
279
|
+
case "string": {
|
|
280
|
+
if (typeof r != "string") return U("local.runtime.value.string", { name: e.name });
|
|
281
|
+
let c = y(r);
|
|
282
|
+
if (c) return U("local.runtime.value.budget", {
|
|
283
|
+
name: e.name,
|
|
284
|
+
detail: t(c),
|
|
285
|
+
detailKey: c.key,
|
|
286
|
+
...c.params
|
|
287
|
+
});
|
|
288
|
+
for (let t of n) {
|
|
289
|
+
let n = o?.get(t.id) ?? (s ? J(t) : Y);
|
|
290
|
+
if (!n.length) continue;
|
|
291
|
+
let c = {};
|
|
292
|
+
for (let r of n) {
|
|
293
|
+
if (r.kind === "date") {
|
|
294
|
+
for (let n of ["min", "max"]) {
|
|
295
|
+
if (r[n] === void 0) continue;
|
|
296
|
+
let o = a(t, n);
|
|
297
|
+
if (o.present) {
|
|
298
|
+
if (!o.ok || typeof o.value != "string" || !i(o.value)) return U("local.runtime.value.constraint-date", {
|
|
299
|
+
name: e.name,
|
|
300
|
+
attribute: n
|
|
301
|
+
});
|
|
302
|
+
c[n] = o.value;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
let n = c.min ?? W(t, r.min), o = c.max ?? W(t, r.max);
|
|
306
|
+
if (n && o && i(n) && i(o) && n > o) return U("local.runtime.value.constraint-range", { name: e.name });
|
|
307
|
+
}
|
|
308
|
+
if ((r.kind === "date" || r.kind === "required" ? r.required : void 0) !== void 0) {
|
|
309
|
+
let n = a(t, "required");
|
|
310
|
+
if (n.present) {
|
|
311
|
+
if (!n.ok || typeof n.value != "boolean") return U("local.runtime.value.constraint", {
|
|
312
|
+
name: e.name,
|
|
313
|
+
attribute: "required"
|
|
314
|
+
});
|
|
315
|
+
c.required = n.value;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
let l = K(t, r, n, c);
|
|
320
|
+
if (!l.ok) return l;
|
|
321
|
+
}
|
|
322
|
+
return e.options?.length && !e.options.includes(r) ? U("local.runtime.value.option", {
|
|
323
|
+
value: r,
|
|
324
|
+
options: e.options.join(", ")
|
|
325
|
+
}) : {
|
|
326
|
+
ok: !0,
|
|
327
|
+
value: r
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
case "array": {
|
|
331
|
+
if (!Array.isArray(r)) return U("local.runtime.value.array", { name: e.name });
|
|
332
|
+
let n = y(r);
|
|
333
|
+
if (n) return U("local.runtime.value.budget", {
|
|
334
|
+
name: e.name,
|
|
335
|
+
detail: t(n),
|
|
336
|
+
detailKey: n.key,
|
|
337
|
+
...n.params
|
|
338
|
+
});
|
|
339
|
+
for (let t of r) if (typeof t != "string") return U("local.runtime.value.array-members", { name: e.name });
|
|
340
|
+
if (e.family === "collection") return e.maxItems !== void 0 && r.length > e.maxItems ? U("local.runtime.value.max-items", {
|
|
341
|
+
name: e.name,
|
|
342
|
+
max: e.maxItems
|
|
343
|
+
}) : {
|
|
344
|
+
ok: !0,
|
|
345
|
+
value: r.slice()
|
|
346
|
+
};
|
|
347
|
+
let i = /* @__PURE__ */ new Set();
|
|
348
|
+
for (let t of r) {
|
|
349
|
+
if (e.options && !e.options.includes(t)) return U("local.runtime.value.checklist-option", { value: t });
|
|
350
|
+
i.add(t);
|
|
351
|
+
}
|
|
352
|
+
let a = e.options ? e.options.filter((e) => i.has(e)) : [...i];
|
|
353
|
+
return e.maxItems !== void 0 && a.length > e.maxItems ? U("local.runtime.value.max-items", {
|
|
354
|
+
name: e.name,
|
|
355
|
+
max: e.maxItems
|
|
356
|
+
}) : {
|
|
357
|
+
ok: !0,
|
|
358
|
+
value: a
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
case "number-array": {
|
|
362
|
+
if (!Array.isArray(r)) return U("local.runtime.value.number-array", { name: e.name });
|
|
363
|
+
let n = y(r);
|
|
364
|
+
if (n) return U("local.runtime.value.budget", {
|
|
365
|
+
name: e.name,
|
|
366
|
+
detail: t(n),
|
|
367
|
+
detailKey: n.key,
|
|
368
|
+
...n.params
|
|
369
|
+
});
|
|
370
|
+
for (let t of r) if (typeof t != "number" || !Number.isFinite(t)) return U("local.runtime.value.number-array-members", { name: e.name });
|
|
371
|
+
return e.maxItems !== void 0 && r.length > e.maxItems ? U("local.runtime.value.max-items", {
|
|
372
|
+
name: e.name,
|
|
373
|
+
max: e.maxItems
|
|
374
|
+
}) : {
|
|
375
|
+
ok: !0,
|
|
376
|
+
value: r.slice()
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
case "null": return r === null ? {
|
|
380
|
+
ok: !0,
|
|
381
|
+
value: r
|
|
382
|
+
} : U("local.runtime.value.null", { name: e.name });
|
|
383
|
+
}
|
|
384
|
+
return U("local.runtime.value.unsupported-type", { name: e.name });
|
|
385
|
+
}
|
|
386
|
+
function Z(e) {
|
|
387
|
+
return e instanceof s ? e : new s("expression-eval", e instanceof Error ? e.message : String(e), 0);
|
|
388
|
+
}
|
|
389
|
+
function oe(e, t) {
|
|
390
|
+
switch (e) {
|
|
391
|
+
case "string": {
|
|
392
|
+
if (typeof t != "string") return {
|
|
393
|
+
ok: !1,
|
|
394
|
+
key: "local.runtime.external-value",
|
|
395
|
+
params: { kind: "string" }
|
|
396
|
+
};
|
|
397
|
+
let e = y(t);
|
|
398
|
+
return e ? {
|
|
399
|
+
ok: !1,
|
|
400
|
+
key: "local.runtime.external-budget",
|
|
401
|
+
params: {
|
|
402
|
+
detailKey: e.key,
|
|
403
|
+
...e.params ?? {}
|
|
404
|
+
}
|
|
405
|
+
} : {
|
|
406
|
+
ok: !0,
|
|
407
|
+
value: t
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
case "number": return typeof t == "number" && Number.isFinite(t) ? {
|
|
411
|
+
ok: !0,
|
|
412
|
+
value: t
|
|
413
|
+
} : {
|
|
414
|
+
ok: !1,
|
|
415
|
+
key: "local.runtime.external-value",
|
|
416
|
+
params: { kind: "number" }
|
|
417
|
+
};
|
|
418
|
+
case "boolean": return typeof t == "boolean" ? {
|
|
419
|
+
ok: !0,
|
|
420
|
+
value: t
|
|
421
|
+
} : {
|
|
422
|
+
ok: !1,
|
|
423
|
+
key: "local.runtime.external-value",
|
|
424
|
+
params: { kind: "boolean" }
|
|
425
|
+
};
|
|
426
|
+
case "array": {
|
|
427
|
+
if (!Array.isArray(t)) return {
|
|
428
|
+
ok: !1,
|
|
429
|
+
key: "local.runtime.external-value",
|
|
430
|
+
params: { kind: "string-array" }
|
|
431
|
+
};
|
|
432
|
+
for (let e of t) if (typeof e != "string") return {
|
|
433
|
+
ok: !1,
|
|
434
|
+
key: "local.runtime.external-value",
|
|
435
|
+
params: { kind: "string-array" }
|
|
436
|
+
};
|
|
437
|
+
let e = y(t);
|
|
438
|
+
return e ? {
|
|
439
|
+
ok: !1,
|
|
440
|
+
key: "local.runtime.external-budget",
|
|
441
|
+
params: {
|
|
442
|
+
detailKey: e.key,
|
|
443
|
+
...e.params ?? {}
|
|
444
|
+
}
|
|
445
|
+
} : {
|
|
446
|
+
ok: !0,
|
|
447
|
+
value: t.slice()
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
case "number-array": {
|
|
451
|
+
if (!Array.isArray(t)) return {
|
|
452
|
+
ok: !1,
|
|
453
|
+
key: "local.runtime.external-value",
|
|
454
|
+
params: { kind: "number-array" }
|
|
455
|
+
};
|
|
456
|
+
for (let e of t) if (typeof e != "number" || !Number.isFinite(e)) return {
|
|
457
|
+
ok: !1,
|
|
458
|
+
key: "local.runtime.external-value",
|
|
459
|
+
params: { kind: "number-array" }
|
|
460
|
+
};
|
|
461
|
+
let e = y(t);
|
|
462
|
+
return e ? {
|
|
463
|
+
ok: !1,
|
|
464
|
+
key: "local.runtime.external-budget",
|
|
465
|
+
params: {
|
|
466
|
+
detailKey: e.key,
|
|
467
|
+
...e.params ?? {}
|
|
468
|
+
}
|
|
469
|
+
} : {
|
|
470
|
+
ok: !0,
|
|
471
|
+
value: t.slice()
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
default: return {
|
|
475
|
+
ok: !1,
|
|
476
|
+
key: "local.runtime.external-value",
|
|
477
|
+
params: { kind: String(e) }
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function se(e, t) {
|
|
482
|
+
let n = t.get(e);
|
|
483
|
+
if (n) return {
|
|
484
|
+
expression: n,
|
|
485
|
+
error: null
|
|
486
|
+
};
|
|
487
|
+
try {
|
|
488
|
+
let n = p(e);
|
|
489
|
+
if (t.size >= re) {
|
|
490
|
+
let e = t.keys().next().value;
|
|
491
|
+
e !== void 0 && t.delete(e);
|
|
492
|
+
}
|
|
493
|
+
return t.set(e, n), {
|
|
494
|
+
expression: n,
|
|
495
|
+
error: null
|
|
496
|
+
};
|
|
497
|
+
} catch (e) {
|
|
498
|
+
return {
|
|
499
|
+
expression: null,
|
|
500
|
+
error: Z(e)
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function ce(e, r) {
|
|
505
|
+
let i = /* @__PURE__ */ new Map();
|
|
506
|
+
for (let t of l(e.nodes)) i.set(t.id, t);
|
|
507
|
+
let a = {}, o = /* @__PURE__ */ new Map();
|
|
508
|
+
for (let [n, r] of Object.entries(e.bindings)) {
|
|
509
|
+
let e = y(r.initial);
|
|
510
|
+
if (e) throw new s("expression-budget", `Parameter "${n}": ${t(e)}`, 0);
|
|
511
|
+
a[n] = P(r.initial);
|
|
512
|
+
let c = [];
|
|
513
|
+
for (let e of r.nodeIds) {
|
|
514
|
+
let t = i.get(e);
|
|
515
|
+
t && c.push(t);
|
|
516
|
+
}
|
|
517
|
+
o.set(n, c);
|
|
518
|
+
}
|
|
519
|
+
let d = /* @__PURE__ */ new Map();
|
|
520
|
+
for (let [t, n] of Object.entries(e.bindingSlots ?? {})) d.set(t, { ...n });
|
|
521
|
+
let f = n(e), p = new Map(Object.entries(f?.valueRules ?? {})), m = f === void 0, h = /* @__PURE__ */ new Map();
|
|
522
|
+
if (f) for (let e of f.slotRelations) {
|
|
523
|
+
let t = d.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
|
|
524
|
+
if (!n || !r) continue;
|
|
525
|
+
let i = h.get(e.nodeId) ?? [];
|
|
526
|
+
i.push({
|
|
527
|
+
lower: n,
|
|
528
|
+
upper: r
|
|
529
|
+
}), h.set(e.nodeId, i);
|
|
530
|
+
}
|
|
531
|
+
else for (let [e, t] of d) t.start && t.end && h.set(e, [{
|
|
532
|
+
lower: t.start,
|
|
533
|
+
upper: t.end
|
|
534
|
+
}]);
|
|
535
|
+
let v = /* @__PURE__ */ new Map();
|
|
536
|
+
for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
|
|
537
|
+
if (d.has(e)) continue;
|
|
538
|
+
let n = v.get(e);
|
|
539
|
+
(n === void 0 || n.startsWith("@") && !t.startsWith("@")) && v.set(e, t);
|
|
540
|
+
}
|
|
541
|
+
let ee = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
|
|
542
|
+
for (let [e, t] of d) for (let n of Object.values(t)) {
|
|
543
|
+
if (n.startsWith("@")) continue;
|
|
544
|
+
let t = b.get(n) ?? /* @__PURE__ */ new Set();
|
|
545
|
+
t.add(e), b.set(n, t);
|
|
546
|
+
}
|
|
547
|
+
let x = e.computations ?? {}, S = Object.keys(x), C = /* @__PURE__ */ new Map();
|
|
548
|
+
for (let [e, t] of Object.entries(x)) {
|
|
549
|
+
let n = se(t.source, r);
|
|
550
|
+
n.expression && C.set(e, n.expression);
|
|
551
|
+
}
|
|
552
|
+
let { order: w, cyclic: te } = c(x), T = {}, E = /* @__PURE__ */ new Map();
|
|
553
|
+
for (let e of w) {
|
|
554
|
+
let t = x[e];
|
|
555
|
+
if (!t || t.kind !== "const") continue;
|
|
556
|
+
if (Object.hasOwn(t, "value")) {
|
|
557
|
+
let n = t.value, r = g(n);
|
|
558
|
+
if (r) {
|
|
559
|
+
E.set(e, new s("expression-budget", `Constant "${e}": ${r}`, 0));
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
T[e] = P(n);
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
let n = C.get(e);
|
|
566
|
+
if (!n) E.set(e, new s("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
|
|
567
|
+
else try {
|
|
568
|
+
let t = n.evaluate({ ...T }), r = g(t);
|
|
569
|
+
if (r) {
|
|
570
|
+
E.set(e, new s("expression-budget", `Constant "${e}": ${r}`, 0));
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
T[e] = P(t);
|
|
574
|
+
} catch (t) {
|
|
575
|
+
E.set(e, Z(t));
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
let D = /* @__PURE__ */ new Map();
|
|
579
|
+
for (let e of te) D.set(e, new s("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
|
|
580
|
+
let O = [];
|
|
581
|
+
if (Array.isArray(e.validations)) for (let t of e.validations) {
|
|
582
|
+
if (!u(t)) continue;
|
|
583
|
+
let e = se(t.expression, r);
|
|
584
|
+
O.push({
|
|
585
|
+
rule: t,
|
|
586
|
+
expression: e.expression,
|
|
587
|
+
error: e.error
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
return {
|
|
591
|
+
document: e,
|
|
592
|
+
nodeIndex: i,
|
|
593
|
+
controls: o,
|
|
594
|
+
slotKeys: d,
|
|
595
|
+
publicNames: ee,
|
|
596
|
+
publicSlotOwners: b,
|
|
597
|
+
initial: a,
|
|
598
|
+
valueRules: p,
|
|
599
|
+
legacyValueRules: m,
|
|
600
|
+
slotRelations: h,
|
|
601
|
+
bindingByNode: v,
|
|
602
|
+
computationMetadata: x,
|
|
603
|
+
computationNames: S,
|
|
604
|
+
computationOrder: w,
|
|
605
|
+
cyclicComputations: te,
|
|
606
|
+
computationExpressions: C,
|
|
607
|
+
constValues: T,
|
|
608
|
+
constErrors: E,
|
|
609
|
+
cycleErrors: D,
|
|
610
|
+
validationRules: O,
|
|
611
|
+
validationLineStarts: _(typeof e.source == "string" ? e.source : "")
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function le(e) {
|
|
615
|
+
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 ${S}; migrate the source before constructing a runtime.` : null;
|
|
616
|
+
}
|
|
617
|
+
function ue(e, t) {
|
|
618
|
+
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);
|
|
619
|
+
}
|
|
620
|
+
function de(e, n, r) {
|
|
621
|
+
let i = ue(e, n);
|
|
622
|
+
return i ? L(e.document, i, "local.runtime.value", r) : R("local.runtime.value", t(r));
|
|
623
|
+
}
|
|
624
|
+
function Q(e, t, n) {
|
|
625
|
+
let r = e.slotRelations.get(t);
|
|
626
|
+
return r?.length ? r.some(({ lower: e, upper: t }) => {
|
|
627
|
+
let r = n[e], i = n[t];
|
|
628
|
+
return typeof r == "number" && typeof i == "number" && r > i;
|
|
629
|
+
}) : !1;
|
|
630
|
+
}
|
|
631
|
+
function fe(e, n) {
|
|
632
|
+
let r = e.nodeIndex.get(n);
|
|
633
|
+
return r ? L(e.document, r, "local.runtime.value", a("local.runtime.value.range-order")) : R("local.runtime.value", t(a("local.runtime.value.range-order")));
|
|
634
|
+
}
|
|
635
|
+
var pe = /* @__PURE__ */ new WeakMap();
|
|
636
|
+
function $(e) {
|
|
637
|
+
return Object.freeze({
|
|
638
|
+
ok: e.ok,
|
|
639
|
+
changed: e.changed,
|
|
640
|
+
revision: e.revision,
|
|
641
|
+
retained: Object.freeze([...e.retained]),
|
|
642
|
+
dropped: Object.freeze(e.dropped.map((e) => Object.freeze({ ...e }))),
|
|
643
|
+
diagnostics: Object.freeze([...e.diagnostics])
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function me(e, t, n) {
|
|
647
|
+
let r = pe.get(e);
|
|
648
|
+
if (!r) throw TypeError("updateLocalRuntime requires a runtime created by createLocalRuntime.");
|
|
649
|
+
return r.update(t, n?.notify !== !1);
|
|
650
|
+
}
|
|
651
|
+
function he(e) {
|
|
652
|
+
pe.get(e)?.notify();
|
|
653
|
+
}
|
|
654
|
+
function ge(e, n) {
|
|
655
|
+
let r = le(e);
|
|
656
|
+
if (r) throw Error(r);
|
|
657
|
+
let i = n?.services === void 0, c = w(e.source), u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = ce(e, g), v = () => _, S = () => {
|
|
658
|
+
let e = /* @__PURE__ */ new Set();
|
|
659
|
+
for (let t of l(_.document.nodes)) t.name !== void 0 && e.add(te({
|
|
660
|
+
documentId: n?.documentId,
|
|
661
|
+
sourceDigest: c,
|
|
662
|
+
nodeId: t.id,
|
|
663
|
+
stateKey: t.attrs?.["state-key"]
|
|
664
|
+
}));
|
|
665
|
+
return e;
|
|
666
|
+
}, C = n?.services ?? T({
|
|
667
|
+
documentId: n?.documentId,
|
|
668
|
+
sourceDigest: c,
|
|
669
|
+
randomSeed: n?.randomSeed,
|
|
670
|
+
componentState: n?.componentState,
|
|
671
|
+
...n?.componentStateStorage === void 0 ? {} : { componentStateStorage: n.componentStateStorage },
|
|
672
|
+
...n?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: n.componentStateWriteDelayMs },
|
|
673
|
+
...n?.configKey === void 0 ? {} : { configKey: n.configKey },
|
|
674
|
+
...n?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: n.legacyConfigKeys },
|
|
675
|
+
...i ? { knownStateKeys: S } : {}
|
|
676
|
+
}), E = {};
|
|
677
|
+
for (let [t, r] of Object.entries(e.externals ?? {})) {
|
|
678
|
+
let e = n?.externalValues?.[t];
|
|
679
|
+
if (e === void 0) continue;
|
|
680
|
+
let i = oe(r.type, e);
|
|
681
|
+
i.ok && (E[t] = i.value);
|
|
682
|
+
}
|
|
683
|
+
let D = (e) => {
|
|
684
|
+
let t = {};
|
|
685
|
+
for (let [n, r] of Object.entries(e.document.externals ?? {})) {
|
|
686
|
+
if (!Object.hasOwn(E, n)) continue;
|
|
687
|
+
let e = oe(r.type, E[n]);
|
|
688
|
+
e.ok && (t[n] = e.value);
|
|
689
|
+
}
|
|
690
|
+
return t;
|
|
691
|
+
}, O = (e, t, n, r = v()) => {
|
|
692
|
+
let i = r.document.dynamicConstraints?.[e.id]?.[t];
|
|
693
|
+
if (!i) return { present: !1 };
|
|
694
|
+
let a = se(i.source, g);
|
|
695
|
+
if (!a.expression) return {
|
|
696
|
+
present: !0,
|
|
697
|
+
ok: !1
|
|
698
|
+
};
|
|
699
|
+
try {
|
|
700
|
+
let e = a.expression.evaluate(n), t = i.numeric;
|
|
701
|
+
return t && (typeof e != "number" || !Number.isFinite(e) || t.integer === !0 && !Number.isInteger(e) || t.min !== void 0 && e < t.min || t.max !== void 0 && e > t.max) ? {
|
|
702
|
+
present: !0,
|
|
703
|
+
ok: !1
|
|
704
|
+
} : {
|
|
705
|
+
present: !0,
|
|
706
|
+
ok: !0,
|
|
707
|
+
value: e
|
|
708
|
+
};
|
|
709
|
+
} catch {
|
|
710
|
+
return {
|
|
711
|
+
present: !0,
|
|
712
|
+
ok: !1
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
}, k = _.initial, A = 0, j = {}, M = {}, N = {
|
|
716
|
+
revision: 0,
|
|
717
|
+
state: ae({})
|
|
718
|
+
}, I = !1, z = null, B = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map(), H = () => {
|
|
719
|
+
if (I) throw Error("The local interaction runtime has been disposed.");
|
|
720
|
+
}, U = (e, t) => {
|
|
721
|
+
let n = D(e), r = /* @__PURE__ */ new Map();
|
|
722
|
+
for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(n, t) || r.set(t, new s("external-missing", "External data \"" + t + "\" is not available.", 0));
|
|
723
|
+
let i = {}, a = /* @__PURE__ */ new Map();
|
|
724
|
+
if (e.computationNames.length > 0) {
|
|
725
|
+
let s = o(e.computationMetadata, e.computationOrder, e.computationExpressions, {
|
|
726
|
+
...t,
|
|
727
|
+
...n
|
|
728
|
+
}, e.constValues, r);
|
|
729
|
+
i = s.values, a = s.errors;
|
|
730
|
+
for (let [t, n] of e.constErrors) Object.hasOwn(i, t) || a.set(t, n);
|
|
731
|
+
for (let [t, n] of e.cycleErrors) Object.hasOwn(i, t) || a.set(t, n);
|
|
732
|
+
}
|
|
733
|
+
let c = {};
|
|
734
|
+
for (let [e, n] of Object.entries(t)) c[e] = n;
|
|
735
|
+
for (let [e, t] of Object.entries(n)) c[e] = t;
|
|
736
|
+
for (let [e, t] of Object.entries(i)) c[e] = t;
|
|
737
|
+
for (let [e, t] of [...r, ...a]) Object.hasOwn(i, e) || Object.defineProperty(c, e, {
|
|
738
|
+
enumerable: !0,
|
|
739
|
+
configurable: !0,
|
|
740
|
+
get() {
|
|
741
|
+
throw t;
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
let l = {};
|
|
745
|
+
for (let [e, n] of Object.entries(t)) l[e] = n;
|
|
746
|
+
for (let [e, t] of Object.entries(n)) l[e] = t;
|
|
747
|
+
for (let [e, t] of Object.entries(i)) l[e] = t;
|
|
748
|
+
return {
|
|
749
|
+
environment: c,
|
|
750
|
+
snapshotState: l
|
|
751
|
+
};
|
|
752
|
+
}, W = () => {
|
|
753
|
+
let e = U(v(), k);
|
|
754
|
+
j = e.environment, M = e.snapshotState;
|
|
755
|
+
}, G = (e, t = v(), n = k) => {
|
|
756
|
+
let r;
|
|
757
|
+
return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= U(t, {
|
|
758
|
+
...n,
|
|
759
|
+
...e
|
|
760
|
+
}).environment, O(i, a, r, t)) : { present: !1 };
|
|
761
|
+
}, K = () => {
|
|
762
|
+
N = {
|
|
763
|
+
revision: A,
|
|
764
|
+
state: ae(M)
|
|
765
|
+
};
|
|
766
|
+
}, q = () => {
|
|
767
|
+
for (let e of B) e();
|
|
768
|
+
}, J = (e) => {
|
|
769
|
+
k = e, A += 1, W(), K(), q();
|
|
770
|
+
}, Y = (e) => {
|
|
771
|
+
if (H(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
|
|
772
|
+
let n = [], r = {}, i = Object.keys(e).sort();
|
|
773
|
+
for (let o of i) {
|
|
774
|
+
if (o === "__proto__") {
|
|
775
|
+
n.push(R("local.runtime.external", "External names cannot be \"__proto__\"."));
|
|
776
|
+
continue;
|
|
777
|
+
}
|
|
778
|
+
let i = v().document.externals ?? {}, s = Object.hasOwn(i, o) ? i[o] : void 0;
|
|
779
|
+
if (!s) {
|
|
780
|
+
let e = a("local.runtime.external", { name: o });
|
|
781
|
+
n.push(R("local.runtime.external", t(e), e));
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
let c = oe(s.type, e[o]);
|
|
785
|
+
if (c.ok) r[o] = c.value;
|
|
786
|
+
else {
|
|
787
|
+
let e = a(c.key, {
|
|
788
|
+
name: o,
|
|
789
|
+
...c.params ?? {}
|
|
790
|
+
});
|
|
791
|
+
n.push(R("local.runtime.external", t(e), e));
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
if (n.length) return n;
|
|
795
|
+
if (!i.some((e) => !F(E[e], r[e]))) return [];
|
|
796
|
+
for (let [e, t] of Object.entries(r)) E[e] = t;
|
|
797
|
+
return A += 1, W(), K(), q(), [];
|
|
798
|
+
}, Z = (e) => {
|
|
799
|
+
H();
|
|
800
|
+
let t = v(), n = [], r = {}, i = Object.keys(e).sort(), a = G(e);
|
|
801
|
+
for (let o of i) {
|
|
802
|
+
if (o === "__proto__") {
|
|
803
|
+
n.push(R("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
if (o.startsWith("@")) {
|
|
807
|
+
n.push(R("local.runtime.parameter", `Internal parameter "${o}" cannot be written by name.`));
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
if (!Object.hasOwn(t.document.bindings, o)) {
|
|
811
|
+
n.push(R("local.runtime.parameter", `Unknown parameter "${o}".`));
|
|
812
|
+
continue;
|
|
813
|
+
}
|
|
814
|
+
let i = t.document.bindings[o], s = X(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
|
|
815
|
+
s.ok ? r[o] = P(s.value) : n.push(de(t, i, s.detail));
|
|
816
|
+
}
|
|
817
|
+
if (n.length) return n;
|
|
818
|
+
if (!i.some((e) => !F(k[e], r[e]))) return [];
|
|
819
|
+
let o = {
|
|
820
|
+
...k,
|
|
821
|
+
...r
|
|
822
|
+
}, s = /* @__PURE__ */ new Set();
|
|
823
|
+
for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
|
|
824
|
+
for (let e of [...s].sort()) Q(t, e, o) && n.push(fe(t, e));
|
|
825
|
+
return n.length ? n : (J(o), []);
|
|
826
|
+
}, ue = (e) => {
|
|
827
|
+
let t = u.get(e);
|
|
828
|
+
if (!t) {
|
|
829
|
+
if (t = p(e), u.size >= re) {
|
|
830
|
+
let e = u.keys().next().value;
|
|
831
|
+
e !== void 0 && u.delete(e);
|
|
832
|
+
}
|
|
833
|
+
u.set(e, t);
|
|
834
|
+
}
|
|
835
|
+
return t;
|
|
836
|
+
}, me = () => {
|
|
837
|
+
let e = v(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
|
|
838
|
+
for (let r of e.validationRules) {
|
|
839
|
+
if (r.error) {
|
|
840
|
+
t.push(f(n, e.validationLineStarts, r.rule.range, b, m(`Validation expression is invalid: ${r.error.message}`)));
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
if (!r.expression) continue;
|
|
844
|
+
let i;
|
|
845
|
+
try {
|
|
846
|
+
i = r.expression.evaluate(j);
|
|
847
|
+
} catch (i) {
|
|
848
|
+
t.push(f(n, e.validationLineStarts, r.rule.range, b, m(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
typeof i == "boolean" ? i || t.push(f(n, e.validationLineStarts, r.rule.range, h, he(r.rule.message))) : t.push(f(n, e.validationLineStarts, r.rule.range, b, "Validation expression must evaluate to a boolean."));
|
|
852
|
+
}
|
|
853
|
+
return t;
|
|
854
|
+
}, he = (e) => {
|
|
855
|
+
let t;
|
|
856
|
+
try {
|
|
857
|
+
t = x(e, j);
|
|
858
|
+
} catch {
|
|
859
|
+
t = ee;
|
|
860
|
+
}
|
|
861
|
+
return m(t);
|
|
862
|
+
}, ge = (e, t) => {
|
|
863
|
+
let n = ne({
|
|
864
|
+
previous: _.document,
|
|
865
|
+
state: k,
|
|
866
|
+
next: e
|
|
867
|
+
}), r = {};
|
|
868
|
+
for (let [t, n] of Object.entries(e.bindings)) r[t] = P(n.initial);
|
|
869
|
+
let i = /* @__PURE__ */ new Map();
|
|
870
|
+
for (let e of n.dropped) i.set(e.name, Object.freeze({ ...e }));
|
|
871
|
+
let a = [], o = {}, s = [];
|
|
872
|
+
for (let c of n.retained) {
|
|
873
|
+
let l = e.bindings[c];
|
|
874
|
+
if (!l) continue;
|
|
875
|
+
let u = X(l, t.controls.get(c) ?? [], n.values[c], G(n.values, t, r), t.valueRules, t.legacyValueRules);
|
|
876
|
+
u.ok ? (o[c] = P(u.value), s.push(c)) : (a.push(de(t, l, u.detail)), i.set(c, Object.freeze({
|
|
877
|
+
name: c,
|
|
878
|
+
reason: "invalid"
|
|
879
|
+
})));
|
|
880
|
+
}
|
|
881
|
+
let c = {
|
|
882
|
+
...r,
|
|
883
|
+
...o
|
|
884
|
+
}, l = /* @__PURE__ */ new Set();
|
|
885
|
+
for (let e of s) for (let n of t.publicSlotOwners.get(e) ?? []) l.add(n);
|
|
886
|
+
let u = !1;
|
|
887
|
+
for (let e of [...l].sort()) if (Q(t, e, c)) {
|
|
888
|
+
u = !0;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
let d;
|
|
892
|
+
if (!u) Object.assign(r, o), d = s;
|
|
893
|
+
else {
|
|
894
|
+
d = [];
|
|
895
|
+
for (let e of s) {
|
|
896
|
+
let n = r[e];
|
|
897
|
+
r[e] = o[e];
|
|
898
|
+
let s = !1;
|
|
899
|
+
for (let n of [...t.publicSlotOwners.get(e) ?? []].sort()) Q(t, n, r) && (a.push(fe(t, n)), s = !0);
|
|
900
|
+
s ? (r[e] = n, i.set(e, Object.freeze({
|
|
901
|
+
name: e,
|
|
902
|
+
reason: "invalid"
|
|
903
|
+
}))) : d.push(e);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
for (let [n, o] of t.slotRelations) if (Q(t, n, r)) {
|
|
907
|
+
for (let t of o) for (let n of [t.lower, t.upper]) {
|
|
908
|
+
let t = e.bindings[n];
|
|
909
|
+
if (!t) continue;
|
|
910
|
+
r[n] = P(t.initial);
|
|
911
|
+
let a = d.indexOf(n);
|
|
912
|
+
a >= 0 && d.splice(a, 1), i.set(n, Object.freeze({
|
|
913
|
+
name: n,
|
|
914
|
+
reason: "invalid"
|
|
915
|
+
}));
|
|
916
|
+
}
|
|
917
|
+
if (a.push(fe(t, n)), Q(t, n, r)) return {
|
|
918
|
+
values: {},
|
|
919
|
+
retained: [],
|
|
920
|
+
dropped: [],
|
|
921
|
+
diagnostics: []
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
let f = !0;
|
|
925
|
+
for (; f;) {
|
|
926
|
+
let n = G({}, t, r), o = [];
|
|
927
|
+
for (let i of d) {
|
|
928
|
+
let s = e.bindings[i], c = X(s, t.controls.get(i) ?? [], r[i], n, t.valueRules, t.legacyValueRules);
|
|
929
|
+
c.ok || (a.push(de(t, s, c.detail)), o.push(i));
|
|
930
|
+
}
|
|
931
|
+
for (let t of o) r[t] = P(e.bindings[t].initial), d.splice(d.indexOf(t), 1), i.set(t, Object.freeze({
|
|
932
|
+
name: t,
|
|
933
|
+
reason: "invalid"
|
|
934
|
+
}));
|
|
935
|
+
f = o.length > 0;
|
|
936
|
+
}
|
|
937
|
+
let p = [...i.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
|
|
938
|
+
return d.sort(), {
|
|
939
|
+
values: r,
|
|
940
|
+
retained: d,
|
|
941
|
+
dropped: p,
|
|
942
|
+
diagnostics: a
|
|
943
|
+
};
|
|
944
|
+
}, _e = (e, t) => {
|
|
945
|
+
if (H(), e === _.document) return $({
|
|
946
|
+
ok: !0,
|
|
947
|
+
changed: !1,
|
|
948
|
+
revision: A,
|
|
949
|
+
retained: [],
|
|
950
|
+
dropped: [],
|
|
951
|
+
diagnostics: []
|
|
952
|
+
});
|
|
953
|
+
if (le(e)) return $({
|
|
954
|
+
ok: !1,
|
|
955
|
+
changed: !1,
|
|
956
|
+
revision: A,
|
|
957
|
+
retained: [],
|
|
958
|
+
dropped: [],
|
|
959
|
+
diagnostics: []
|
|
960
|
+
});
|
|
961
|
+
let n;
|
|
962
|
+
try {
|
|
963
|
+
n = ce(e, g);
|
|
964
|
+
} catch {
|
|
965
|
+
return $({
|
|
966
|
+
ok: !1,
|
|
967
|
+
changed: !1,
|
|
968
|
+
revision: A,
|
|
969
|
+
retained: [],
|
|
970
|
+
dropped: [],
|
|
971
|
+
diagnostics: []
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
let r = ge(e, n);
|
|
975
|
+
if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
|
|
976
|
+
ok: !1,
|
|
977
|
+
changed: !1,
|
|
978
|
+
revision: A,
|
|
979
|
+
retained: [],
|
|
980
|
+
dropped: [],
|
|
981
|
+
diagnostics: []
|
|
982
|
+
});
|
|
983
|
+
let i;
|
|
984
|
+
try {
|
|
985
|
+
i = U(n, r.values);
|
|
986
|
+
} catch {
|
|
987
|
+
return $({
|
|
988
|
+
ok: !1,
|
|
989
|
+
changed: !1,
|
|
990
|
+
revision: A,
|
|
991
|
+
retained: [],
|
|
992
|
+
dropped: [],
|
|
993
|
+
diagnostics: []
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
let a = D(n);
|
|
997
|
+
for (let e of Object.keys(E)) delete E[e];
|
|
998
|
+
if (Object.assign(E, a), _ = n, k = r.values, j = i.environment, M = i.snapshotState, z = null, A += 1, K(), t) for (let e of B) e();
|
|
999
|
+
return $({
|
|
1000
|
+
ok: !0,
|
|
1001
|
+
changed: !0,
|
|
1002
|
+
revision: A,
|
|
1003
|
+
retained: r.retained,
|
|
1004
|
+
dropped: r.dropped,
|
|
1005
|
+
diagnostics: r.diagnostics
|
|
1006
|
+
});
|
|
1007
|
+
}, ve = (e) => {
|
|
1008
|
+
let t = /* @__PURE__ */ new Set();
|
|
1009
|
+
for (let n of l([e])) t.add(n.id);
|
|
1010
|
+
return t;
|
|
1011
|
+
}, ye = {
|
|
1012
|
+
get document() {
|
|
1013
|
+
return _.document;
|
|
1014
|
+
},
|
|
1015
|
+
services: C,
|
|
1016
|
+
snapshot() {
|
|
1017
|
+
return H(), N;
|
|
1018
|
+
},
|
|
1019
|
+
get(e, t) {
|
|
1020
|
+
H();
|
|
1021
|
+
let n = v(), r = n.nodeIndex.get(e.id);
|
|
1022
|
+
if (!r) return null;
|
|
1023
|
+
let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? d(r) : n.slotKeys.get(r.id)?.[t];
|
|
1024
|
+
return i && Object.hasOwn(k, i) ? P(k[i]) : null;
|
|
1025
|
+
},
|
|
1026
|
+
set(e, t, n) {
|
|
1027
|
+
H();
|
|
1028
|
+
let r = v(), i = r.nodeIndex.get(e.id);
|
|
1029
|
+
if (!i) return [L(r.document, e, "local.runtime.binding", a("local.runtime.binding.no-writable"))];
|
|
1030
|
+
let o = r.slotKeys.get(i.id), s;
|
|
1031
|
+
if (n === void 0) {
|
|
1032
|
+
if (o && !o.value) return [L(r.document, i, "local.runtime.binding", a("local.runtime.binding.needs-slot"))];
|
|
1033
|
+
s = o?.value ?? r.bindingByNode.get(i.id) ?? d(i);
|
|
1034
|
+
} else if (s = o?.[n], !s) return [L(r.document, i, "local.runtime.binding", a("local.runtime.binding.unknown-slot", { slot: n }))];
|
|
1035
|
+
let c = Object.hasOwn(r.document.bindings, s) ? r.document.bindings[s] : void 0;
|
|
1036
|
+
if (!c) return [L(r.document, i, "local.runtime.binding", a("local.runtime.binding.no-writable"))];
|
|
1037
|
+
let l = X(c, r.controls.get(s) ?? [], t, G({ [s]: t }), r.valueRules, r.legacyValueRules);
|
|
1038
|
+
if (!l.ok) return [L(r.document, i, "local.runtime.value", l.detail)];
|
|
1039
|
+
let u = P(l.value);
|
|
1040
|
+
if (F(k[s], u)) return [];
|
|
1041
|
+
let f = {
|
|
1042
|
+
...k,
|
|
1043
|
+
[s]: u
|
|
1044
|
+
};
|
|
1045
|
+
return Q(r, i.id, f) ? [L(r.document, i, "local.runtime.value", a("local.runtime.value.range-order"))] : (J(f), []);
|
|
1046
|
+
},
|
|
1047
|
+
setMany(e, t) {
|
|
1048
|
+
H();
|
|
1049
|
+
let n = v(), r = n.nodeIndex.get(e.id);
|
|
1050
|
+
if (!r) return [L(n.document, e, "local.runtime.binding", a("local.runtime.binding.no-writable"))];
|
|
1051
|
+
let i = n.slotKeys.get(r.id);
|
|
1052
|
+
if (!i) return [L(n.document, r, "local.runtime.binding", a("local.runtime.binding.no-multi-slot"))];
|
|
1053
|
+
let o = Object.entries(t);
|
|
1054
|
+
if (!o.length) return [];
|
|
1055
|
+
let s = { ...k }, c = U(n, {
|
|
1056
|
+
...k,
|
|
1057
|
+
...Object.fromEntries(o.map(([e, t]) => [i[e], t]))
|
|
1058
|
+
}).environment;
|
|
1059
|
+
for (let [e, t] of o) {
|
|
1060
|
+
let o = i[e];
|
|
1061
|
+
if (!o || !Object.hasOwn(n.document.bindings, o)) return [L(n.document, r, "local.runtime.binding", a("local.runtime.binding.unknown-slot", { slot: e }))];
|
|
1062
|
+
let l = X(n.document.bindings[o], n.controls.get(o) ?? [], t, (e, t) => O(e, t, c), n.valueRules, n.legacyValueRules);
|
|
1063
|
+
if (!l.ok) return [L(n.document, r, "local.runtime.value", l.detail)];
|
|
1064
|
+
s[o] = P(l.value);
|
|
1065
|
+
}
|
|
1066
|
+
return Q(n, r.id, s) ? [L(n.document, r, "local.runtime.value", a("local.runtime.value.range-order"))] : (o.every(([e, t]) => F(k[i[e]], t)) || J(s), []);
|
|
1067
|
+
},
|
|
1068
|
+
parameterNames() {
|
|
1069
|
+
return H(), v().publicNames;
|
|
1070
|
+
},
|
|
1071
|
+
getParameter(e) {
|
|
1072
|
+
H();
|
|
1073
|
+
let t = v();
|
|
1074
|
+
if (!e.startsWith("@") && Object.hasOwn(t.document.bindings, e)) return Object.hasOwn(k, e) ? P(k[e]) : void 0;
|
|
1075
|
+
},
|
|
1076
|
+
getParameters() {
|
|
1077
|
+
H();
|
|
1078
|
+
let e = v(), t = {};
|
|
1079
|
+
for (let n of e.publicNames) {
|
|
1080
|
+
let e = k[n];
|
|
1081
|
+
t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
|
|
1082
|
+
}
|
|
1083
|
+
return Object.freeze(t);
|
|
1084
|
+
},
|
|
1085
|
+
setParameter(e, t) {
|
|
1086
|
+
H();
|
|
1087
|
+
let n = Object.create(null);
|
|
1088
|
+
return n[e] = t, Z(n);
|
|
1089
|
+
},
|
|
1090
|
+
setParameters(e) {
|
|
1091
|
+
if (H(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
|
|
1092
|
+
return Z(e);
|
|
1093
|
+
},
|
|
1094
|
+
getExternal(e) {
|
|
1095
|
+
if (H(), Object.hasOwn(v().document.externals ?? {}, e) && Object.hasOwn(E, e)) return P(E[e]);
|
|
1096
|
+
},
|
|
1097
|
+
getExternalValues() {
|
|
1098
|
+
H();
|
|
1099
|
+
let e = {};
|
|
1100
|
+
for (let [t, n] of Object.entries(E)) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
|
|
1101
|
+
return Object.freeze(e);
|
|
1102
|
+
},
|
|
1103
|
+
setExternalValues(e) {
|
|
1104
|
+
return Y(e);
|
|
1105
|
+
},
|
|
1106
|
+
evaluate(e) {
|
|
1107
|
+
H();
|
|
1108
|
+
let t = ue(e).evaluate(j);
|
|
1109
|
+
return Array.isArray(t) ? t.slice() : t;
|
|
1110
|
+
},
|
|
1111
|
+
validate() {
|
|
1112
|
+
if (H(), z && z.revision === A) return z.diagnostics.map(ie);
|
|
1113
|
+
let e = me();
|
|
1114
|
+
return z = {
|
|
1115
|
+
revision: A,
|
|
1116
|
+
diagnostics: e
|
|
1117
|
+
}, e.map(ie);
|
|
1118
|
+
},
|
|
1119
|
+
text(e) {
|
|
1120
|
+
return H(), x(e, j);
|
|
1121
|
+
},
|
|
1122
|
+
reset(e) {
|
|
1123
|
+
H();
|
|
1124
|
+
let n = v(), r = n.nodeIndex.get(e.id);
|
|
1125
|
+
if (!r) return;
|
|
1126
|
+
let i = ve(r), a = { ...k };
|
|
1127
|
+
for (let [e, r] of Object.entries(n.document.bindings)) {
|
|
1128
|
+
if (!(n.controls.get(e) ?? []).some((e) => i.has(e.id))) continue;
|
|
1129
|
+
let o = y(r.initial);
|
|
1130
|
+
if (o) throw new s("expression-budget", `Parameter "${e}": ${t(o)}`, 0);
|
|
1131
|
+
a[e] = P(r.initial);
|
|
1132
|
+
}
|
|
1133
|
+
for (let e of i) V.set(e, (V.get(e) ?? 0) + 1);
|
|
1134
|
+
J(a);
|
|
1135
|
+
},
|
|
1136
|
+
resetToken(e) {
|
|
1137
|
+
H();
|
|
1138
|
+
let t = v().nodeIndex.get(e.id);
|
|
1139
|
+
return t ? V.get(t.id) ?? 0 : 0;
|
|
1140
|
+
},
|
|
1141
|
+
subscribe(e) {
|
|
1142
|
+
return H(), B.add(e), () => {
|
|
1143
|
+
B.delete(e);
|
|
1144
|
+
};
|
|
1145
|
+
},
|
|
1146
|
+
dispose() {
|
|
1147
|
+
I || (I = !0, C.state.flush(), i && C.scheduler.dispose(), B.clear(), u.clear(), g.clear(), _.computationExpressions.clear(), _.constErrors.clear(), _.cycleErrors.clear(), _.validationRules.length = 0, V.clear());
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
return pe.set(ye, {
|
|
1151
|
+
update: _e,
|
|
1152
|
+
notify() {
|
|
1153
|
+
if (!I) for (let e of B) e();
|
|
1154
|
+
}
|
|
1155
|
+
}), W(), K(), ye;
|
|
1156
|
+
}
|
|
1157
|
+
export { ne as a, M as i, he as n, me as r, ge as t };
|