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