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
|
@@ -94,12 +94,20 @@ export declare function numericRange(context: LocalComponentContext, minName: st
|
|
|
94
94
|
};
|
|
95
95
|
export declare const EMPTY_STATIC_VALUE = "\u2014";
|
|
96
96
|
export declare function staticText(value: string): string;
|
|
97
|
-
export declare function
|
|
97
|
+
export declare function useAuthorComponentRoot(context: LocalComponentContext): (defaults?: CSSProperties) => {
|
|
98
|
+
style: CSSProperties | undefined;
|
|
99
|
+
ref: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
style: CSSProperties;
|
|
102
|
+
ref: (element: HTMLElement | null) => void;
|
|
103
|
+
};
|
|
104
|
+
export declare function StaticValue({ label, value, hint, className, multiline, authorRoot, }: {
|
|
98
105
|
label: string;
|
|
99
106
|
value: ReactNode;
|
|
100
107
|
hint?: ReactNode;
|
|
101
108
|
className?: string;
|
|
102
109
|
multiline?: boolean;
|
|
110
|
+
authorRoot?: ReturnType<ReturnType<typeof useAuthorComponentRoot>>;
|
|
103
111
|
}): import("react").JSX.Element;
|
|
104
112
|
export declare function PrintValue({ value, block }: {
|
|
105
113
|
value: ReactNode;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { LocalDocumentView, LocalReactiveDocument } from '../local/rendering/LocalDocumentView.js';
|
|
2
|
-
export type { LocalDocumentViewProps, LocalReactiveDocumentProps, LocalUrlPolicy, LocalImageResolver, } from '../local/rendering/LocalDocumentView.js';
|
|
1
|
+
export { LocalDocumentView, LocalReactiveDocument } from '../local/rendering/document/LocalDocumentView.js';
|
|
2
|
+
export type { LocalDocumentViewProps, LocalReactiveDocumentProps, LocalUrlPolicy, LocalImageResolver, } from '../local/rendering/document/LocalDocumentView.js';
|
|
3
3
|
export type { LocalRenderMode, LocalRenderContext, LocalHostData, LocalHostRenderer, LocalHostComponentContext, LocalHostPropValue, LocalSourceTarget, } from '../local/rendering/render-types.js';
|
|
4
|
-
export type { LocalLocale } from '../local/
|
|
5
|
-
export type { LocalColorScheme, LocalThemeDefinition } from '../
|
|
4
|
+
export type { LocalLocale } from '../local/types.js';
|
|
5
|
+
export type { LocalColorScheme, LocalThemeDefinition } from '../themes/document-theme.js';
|
|
6
|
+
export { LOCAL_STYLE_CONTRACT, LOCAL_STYLE_LAYERS, LOCAL_THEME_STYLE_LAYER, LOCAL_STYLE_LAYER_ORDER } from '../themes/contract.js';
|
|
6
7
|
export { defineReactComponentPackage, createReactHost, defineReactPreset, defaultReactPresetPackage } from './package.js';
|
|
7
8
|
export type { LocalReactComponentPackageInput, LocalReactComponentPackage, LocalReactPackage, LocalReactPresetPackage, LocalReactHostInput, LocalReactHost, LocalPackageNotice } from './package.js';
|
|
8
9
|
export { LocalReactExtensionMissingError, createReactConfig, defineReactComponent, localReactExtensionRenderer, reportLocalComponentError, safeLocalComponentEvent, validateLocalReactExtensions, } from './sdk.js';
|
|
@@ -11,7 +12,7 @@ export type { LocalComponentChildrenApi, LocalComponentContent, LocalComponentFi
|
|
|
11
12
|
export type { LocalComponentDefinition, LocalComponentProp, LocalConfig, LocalExtensionRequirements, } from '../sdk/types.js';
|
|
12
13
|
export type { LocalComponentStateDocument, LocalComponentStateRecord, LocalComponentStateSaveResult, } from '../runtime-services/component-state.js';
|
|
13
14
|
export type { LocalRuntimeServices } from '../runtime-services/runtime.js';
|
|
14
|
-
export { DEFAULT_LOCAL_DATA_TABLE_ROWS, LatexError, LatexView, MAX_LOCAL_ARRAY_LENGTH, MAX_LOCAL_DATA_TABLE_COLUMNS, MAX_LOCAL_DATA_TABLE_ROWS, MAX_LOCAL_PLOT_CURVES, MAX_LOCAL_PLOT_POINTS, MAX_LOCAL_PLOT_STEPS, MAX_LOCAL_STRING_LENGTH, MAX_LOCAL_VALUE_CHARACTERS, MAX_IMPLICIT_GRID, MIN_IMPLICIT_GRID, TableSurface, compileExpression, compileLatex, compilePlotFormula, countLocalCodePoints, createDiagramLayoutFallback, diagramEdgePath, diagramLayoutKey, formatLocalDiagnostic, implicitGridSize, isLocalColor, isLocalEmail, layoutDiagram, plotFormulaKind, sampleImplicit, sampleParametric, samplePlot, } from './component-primitives.js';
|
|
15
|
+
export { DEFAULT_LOCAL_DATA_TABLE_ROWS, LatexError, LatexView, MAX_LOCAL_ARRAY_LENGTH, MAX_LOCAL_DATA_TABLE_COLUMNS, MAX_LOCAL_DATA_TABLE_ROWS, MAX_LOCAL_PLOT_CURVES, MAX_LOCAL_PLOT_POINTS, MAX_LOCAL_PLOT_STEPS, MAX_LOCAL_STRING_LENGTH, MAX_LOCAL_VALUE_CHARACTERS, MAX_IMPLICIT_GRID, MIN_IMPLICIT_GRID, TableSurface, compileExpression, compileLatex, compilePlotFormula, countLocalCodePoints, createDiagramLayoutFallback, diagramEdgePath, diagramLayoutKey, formatLocalDiagnostic, implicitGridSize, isLocalColor, isLocalEmail, layoutDiagram, plotFormulaKind, sampleImplicit, sampleParametric, samplePlot, samplePolar, } from './component-primitives.js';
|
|
15
16
|
export type { CompiledPlotFormula, DiagramLayoutInput, DiagramLayoutResult, LatexEvaluationBudget, LocalExpression, LocalValue, PlotFormulaKind, PlotPoint, PlotSample, } from './component-primitives.js';
|
|
16
17
|
export { FieldError, LocalError, PrintValue, StaticValue, ToneProblem, accentStyle, boolAttr, clamp, currentValue, dateConstraint, displayValue, formatNumber, formatSeconds, inlinePlainText, itemBool, itemText, localColor, numberAttr, numberConstraint, numericRange, optionLabel, rawAttr, readBooleanAttr, scalarText, slotNumber, snapToStep, staticText, textAttr, toneAttr, useComponentView, useDisabled, useResetToken, useSourceAttributes, useValidationField, useValidationHint, useWriter, } from './component-utils.js';
|
|
17
18
|
export type { ConstraintRead, LocalComponentView, } from './component-utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { LocalLocale } from '../
|
|
3
|
-
export type { LocalLocale } from '../
|
|
2
|
+
import type { LocalLocale } from '../local/types.js';
|
|
3
|
+
export type { LocalLocale } from '../local/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* A localizer pair supplied at the call site. The English half is returned for
|
|
6
6
|
* `en`, so the default renderer output stays byte-identical to the original
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LocalDocumentViewProps, type LocalReactiveDocumentProps } from '../local/rendering/document/LocalDocumentViewCore.js';
|
|
2
|
+
import { type LocalReactHostInput } from './package-core.js';
|
|
3
|
+
import { type CreateLocalReactConfigOptions, type LocalReactConfig } from './sdk-core.js';
|
|
4
|
+
import type { LocalConfig } from '../sdk/types.js';
|
|
5
|
+
export type { LocalDocumentViewProps, LocalReactiveDocumentProps, LocalUrlPolicy, LocalImageResolver } from '../local/rendering/document/LocalDocumentViewCore.js';
|
|
6
|
+
export { defineReactComponentPackage, defineReactPreset } from './package-core.js';
|
|
7
|
+
export type { LocalReactPackage, LocalReactPresetPackage, LocalReactHostInput, LocalReactHost } from './package-core.js';
|
|
8
|
+
export { defineReactComponent } from './sdk-core.js';
|
|
9
|
+
export type { LocalComponentContext, LocalReactConfig } from './sdk-core.js';
|
|
10
|
+
export declare function createReactHost(input?: LocalReactHostInput): import("./package-core.js").LocalReactHost;
|
|
11
|
+
export declare function createReactConfig(input: LocalConfig, options: CreateLocalReactConfigOptions): LocalReactConfig;
|
|
12
|
+
export declare function LocalDocumentView(props: LocalDocumentViewProps): import("react").JSX.Element;
|
|
13
|
+
export declare function LocalReactiveDocument(props: LocalReactiveDocumentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LOCAL_REACT_PRESET_PROTOCOL, type LocalComponentDefinition, type LocalPresetPackage } from '../sdk/types.js';
|
|
2
|
+
import type { LocalStyleResource, LocalThemePackage } from '../sdk/theme.js';
|
|
3
|
+
import { type LocalReactConfig } from './sdk-core.js';
|
|
4
|
+
import { type LocalReactComponent, type LocalReactComponentImplementation } from './component-api.js';
|
|
5
|
+
export interface LocalPackageNotice {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly version?: string;
|
|
9
|
+
readonly license?: string;
|
|
10
|
+
readonly url?: string;
|
|
11
|
+
readonly text?: string;
|
|
12
|
+
}
|
|
13
|
+
export type LocalReactComponentPackageInput = Omit<LocalComponentDefinition, 'protocol' | 'form' | 'props'> & Partial<Pick<LocalComponentDefinition, 'protocol' | 'form' | 'props'>> & LocalReactComponentImplementation & {
|
|
14
|
+
readonly css?: string;
|
|
15
|
+
readonly resources?: readonly LocalStyleResource[];
|
|
16
|
+
};
|
|
17
|
+
export interface LocalReactPackage {
|
|
18
|
+
readonly components: readonly LocalReactComponent[];
|
|
19
|
+
readonly resources?: readonly LocalStyleResource[];
|
|
20
|
+
readonly themes?: readonly LocalThemePackage[];
|
|
21
|
+
readonly notices?: readonly LocalPackageNotice[];
|
|
22
|
+
}
|
|
23
|
+
export interface LocalReactComponentPackage extends LocalReactPackage {
|
|
24
|
+
readonly definition: LocalComponentDefinition;
|
|
25
|
+
readonly resources: readonly LocalStyleResource[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Pairs one semantic preset with the React implementations and resources the
|
|
29
|
+
* host installs for it. The pairing is validated by manifest identity, not by
|
|
30
|
+
* array position or preset version alone.
|
|
31
|
+
*/
|
|
32
|
+
export interface LocalReactPresetPackage {
|
|
33
|
+
readonly protocol: typeof LOCAL_REACT_PRESET_PROTOCOL;
|
|
34
|
+
readonly preset: LocalPresetPackage;
|
|
35
|
+
readonly components: readonly LocalReactComponent[];
|
|
36
|
+
readonly resources?: readonly LocalStyleResource[];
|
|
37
|
+
readonly notices?: readonly LocalPackageNotice[];
|
|
38
|
+
}
|
|
39
|
+
/** Validate a semantic preset and its React pairing. */
|
|
40
|
+
export declare function defineReactPreset(input: LocalReactPresetPackage): LocalReactPresetPackage;
|
|
41
|
+
/** One authoring declaration; its manifest stays plain data for Worker use. */
|
|
42
|
+
export declare function defineReactComponentPackage(input: LocalReactComponentPackageInput): LocalReactComponentPackage;
|
|
43
|
+
export interface LocalReactHostInput {
|
|
44
|
+
/**
|
|
45
|
+
* React preset packages. Omitted keeps the default preset; `[]` installs no
|
|
46
|
+
* preset. Explicit packages/components never restore the default silently.
|
|
47
|
+
*/
|
|
48
|
+
readonly presets?: readonly (LocalReactPresetPackage | 'default')[];
|
|
49
|
+
readonly replacements?: 'allow' | 'forbid';
|
|
50
|
+
readonly packages?: readonly LocalReactPackage[];
|
|
51
|
+
readonly components?: readonly LocalReactComponent[];
|
|
52
|
+
readonly themes?: readonly LocalThemePackage[];
|
|
53
|
+
readonly resources?: readonly LocalStyleResource[];
|
|
54
|
+
readonly notices?: readonly LocalPackageNotice[];
|
|
55
|
+
}
|
|
56
|
+
export interface LocalReactHost {
|
|
57
|
+
readonly config: LocalReactConfig['config'];
|
|
58
|
+
readonly reactConfig: LocalReactConfig;
|
|
59
|
+
readonly compileOptions: Readonly<{
|
|
60
|
+
config: LocalReactConfig['config'];
|
|
61
|
+
}>;
|
|
62
|
+
readonly resources: readonly LocalStyleResource[];
|
|
63
|
+
readonly css: string;
|
|
64
|
+
readonly notices: readonly LocalPackageNotice[];
|
|
65
|
+
}
|
|
66
|
+
/** Compose packages once for compiler, renderer, authoring and export. */
|
|
67
|
+
export declare function createReactHostWithBase(input: LocalReactHostInput, base: LocalReactPresetPackage): LocalReactHost;
|
|
@@ -1,69 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { type LocalReactConfig } from './sdk.js';
|
|
4
|
-
import { type LocalReactComponent, type LocalReactComponentImplementation } from './component-api.js';
|
|
5
|
-
export interface LocalPackageNotice {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
readonly name?: string;
|
|
8
|
-
readonly version?: string;
|
|
9
|
-
readonly license?: string;
|
|
10
|
-
readonly url?: string;
|
|
11
|
-
readonly text?: string;
|
|
12
|
-
}
|
|
13
|
-
export type LocalReactComponentPackageInput = Omit<LocalComponentDefinition, 'protocol' | 'form' | 'props'> & Partial<Pick<LocalComponentDefinition, 'protocol' | 'form' | 'props'>> & LocalReactComponentImplementation & {
|
|
14
|
-
readonly css?: string;
|
|
15
|
-
readonly resources?: readonly LocalStyleResource[];
|
|
16
|
-
};
|
|
17
|
-
export interface LocalReactPackage {
|
|
18
|
-
readonly components: readonly LocalReactComponent[];
|
|
19
|
-
readonly resources?: readonly LocalStyleResource[];
|
|
20
|
-
readonly themes?: readonly LocalThemePackage[];
|
|
21
|
-
readonly notices?: readonly LocalPackageNotice[];
|
|
22
|
-
}
|
|
23
|
-
export interface LocalReactComponentPackage extends LocalReactPackage {
|
|
24
|
-
readonly definition: LocalComponentDefinition;
|
|
25
|
-
readonly resources: readonly LocalStyleResource[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Pairs one semantic preset with the React implementations and resources the
|
|
29
|
-
* host installs for it. The pairing is validated by manifest identity, not by
|
|
30
|
-
* array position or preset version alone.
|
|
31
|
-
*/
|
|
32
|
-
export interface LocalReactPresetPackage {
|
|
33
|
-
readonly protocol: typeof LOCAL_REACT_PRESET_PROTOCOL;
|
|
34
|
-
readonly preset: LocalPresetPackage;
|
|
35
|
-
readonly components: readonly LocalReactComponent[];
|
|
36
|
-
readonly resources?: readonly LocalStyleResource[];
|
|
37
|
-
readonly notices?: readonly LocalPackageNotice[];
|
|
38
|
-
}
|
|
39
|
-
/** Validate a semantic preset and its React pairing. */
|
|
40
|
-
export declare function defineReactPreset(input: LocalReactPresetPackage): LocalReactPresetPackage;
|
|
1
|
+
import { type LocalReactHostInput, type LocalReactPresetPackage } from './package-core.js';
|
|
2
|
+
export * from './package-core.js';
|
|
41
3
|
/** Default semantic preset paired with the built-in React implementation table. */
|
|
42
4
|
export declare const defaultReactPresetPackage: LocalReactPresetPackage;
|
|
43
|
-
|
|
44
|
-
export declare function defineReactComponentPackage(input: LocalReactComponentPackageInput): LocalReactComponentPackage;
|
|
45
|
-
export interface LocalReactHostInput {
|
|
46
|
-
/**
|
|
47
|
-
* React preset packages. Omitted keeps the default preset; `[]` installs no
|
|
48
|
-
* preset. Explicit packages/components never restore the default silently.
|
|
49
|
-
*/
|
|
50
|
-
readonly presets?: readonly (LocalReactPresetPackage | 'default')[];
|
|
51
|
-
readonly replacements?: 'allow' | 'forbid';
|
|
52
|
-
readonly packages?: readonly LocalReactPackage[];
|
|
53
|
-
readonly components?: readonly LocalReactComponent[];
|
|
54
|
-
readonly themes?: readonly LocalThemePackage[];
|
|
55
|
-
readonly resources?: readonly LocalStyleResource[];
|
|
56
|
-
readonly notices?: readonly LocalPackageNotice[];
|
|
57
|
-
}
|
|
58
|
-
export interface LocalReactHost {
|
|
59
|
-
readonly config: LocalReactConfig['config'];
|
|
60
|
-
readonly reactConfig: LocalReactConfig;
|
|
61
|
-
readonly compileOptions: Readonly<{
|
|
62
|
-
config: LocalReactConfig['config'];
|
|
63
|
-
}>;
|
|
64
|
-
readonly resources: readonly LocalStyleResource[];
|
|
65
|
-
readonly css: string;
|
|
66
|
-
readonly notices: readonly LocalPackageNotice[];
|
|
67
|
-
}
|
|
68
|
-
/** Compose packages once for compiler, renderer, authoring and export. */
|
|
69
|
-
export declare function createReactHost(input?: LocalReactHostInput): LocalReactHost;
|
|
5
|
+
export declare function createReactHost(input?: LocalReactHostInput): import("./package-core.js").LocalReactHost;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Diagnostic } from '../../local/
|
|
1
|
+
import type { Diagnostic } from '../../local/types.js';
|
|
2
2
|
import type { LocalComponentContext } from '../component-api.js';
|
|
3
3
|
export declare function componentDiagnostic(context: LocalComponentContext, code: string, message: string): Diagnostic;
|
|
4
4
|
export declare function reportError(context: LocalComponentContext, code: string, error: unknown): void;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Diagnostic, LocalNode, LocalRuntime } from '../local/types.js';
|
|
3
|
+
import type { LocalHostRenderer, LocalRenderMode } from '../local/rendering/render-types.js';
|
|
4
|
+
import type { LocalUrlPolicy } from '../local/rendering/document/LocalDocumentView.js';
|
|
5
|
+
import type { LocalLocale } from './localization.js';
|
|
6
|
+
import type { LocalThemePackage } from '../sdk/theme.js';
|
|
7
|
+
import type { LocalRuntimeServices } from '../runtime-services/runtime.js';
|
|
8
|
+
import type { ComponentNetwork } from '../runtime-services/network.js';
|
|
9
|
+
import type { LocalComponentDefinition, LocalConfig } from '../sdk/types.js';
|
|
10
|
+
import { type LocalComponentAdapterEnvironment, type LocalComponentContext, type LocalReactComponent, type LocalReactPreset } from './component-api.js';
|
|
11
|
+
export type { LocalComponentRender } from './component-api.js';
|
|
12
|
+
export { defineReactComponent, type LocalComponentBindingHandle, type LocalComponentContext, type LocalComponentInstance, type LocalComponentPropValue, type LocalComponentSetResult, type LocalComponentValue, type LocalReactComponent, type LocalReactComponentImplementation, type LocalReactPreset, } from './component-api.js';
|
|
13
|
+
/** Everything a renderer needs from the document view. */
|
|
14
|
+
export interface LocalReactRenderEnvironment {
|
|
15
|
+
runtime: LocalRuntime;
|
|
16
|
+
authorStyle?: LocalComponentAdapterEnvironment['authorStyle'];
|
|
17
|
+
authorStyleText?: LocalComponentAdapterEnvironment['authorStyleText'];
|
|
18
|
+
dispatchAuthorAction?: LocalComponentAdapterEnvironment['dispatchAuthorAction'];
|
|
19
|
+
network?: ComponentNetwork;
|
|
20
|
+
/** Runtime-scoped services; omitted only by hand-built render environments. */
|
|
21
|
+
services?: LocalRuntimeServices;
|
|
22
|
+
mode: LocalRenderMode;
|
|
23
|
+
visible: boolean;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
disabledInvalid: boolean;
|
|
26
|
+
resetToken: number;
|
|
27
|
+
/** UI locale for built-in labels and diagnostics inside components. */
|
|
28
|
+
locale: LocalLocale;
|
|
29
|
+
/** Render this component's children at the inherited visibility. */
|
|
30
|
+
renderChildren(nodes: LocalNode[] | undefined, visible: boolean): ReactNode;
|
|
31
|
+
/** Render projected children as inline content. */
|
|
32
|
+
renderInline(nodes: LocalNode[] | undefined, visible: boolean): ReactNode;
|
|
33
|
+
/** Plain text projection of nodes. */
|
|
34
|
+
renderToText(nodes: LocalNode[] | undefined): string;
|
|
35
|
+
report(diagnostics: Diagnostic[]): void;
|
|
36
|
+
positionOf?(offset: number): {
|
|
37
|
+
line: number;
|
|
38
|
+
column: number;
|
|
39
|
+
};
|
|
40
|
+
definitionFor(name: string): LocalComponentDefinition | undefined;
|
|
41
|
+
validationField(node: LocalNode): {
|
|
42
|
+
describedBy?: string;
|
|
43
|
+
invalid: boolean;
|
|
44
|
+
};
|
|
45
|
+
validationHint(node: LocalNode): {
|
|
46
|
+
id: string;
|
|
47
|
+
failed: boolean;
|
|
48
|
+
error: boolean;
|
|
49
|
+
message: string;
|
|
50
|
+
} | null;
|
|
51
|
+
sourceAttributes(node: LocalNode, componentName?: string): Record<string, string>;
|
|
52
|
+
targetId(to: string): string | undefined;
|
|
53
|
+
anchorId(node: LocalNode): string | undefined;
|
|
54
|
+
jumpAllowed(to: string): boolean;
|
|
55
|
+
jumpTo(target: string): 'ok' | 'missing' | 'hidden';
|
|
56
|
+
urlPolicy?: LocalUrlPolicy;
|
|
57
|
+
imageResolver?: (url: string) => string | null;
|
|
58
|
+
}
|
|
59
|
+
export type LocalReactExtensionRenderer = (node: LocalNode, environment: LocalReactRenderEnvironment) => ReactNode;
|
|
60
|
+
export interface CreateLocalReactConfigOptions {
|
|
61
|
+
/** One implementation per external component declared by the config. */
|
|
62
|
+
components: readonly LocalReactComponent[];
|
|
63
|
+
/**
|
|
64
|
+
* Additional installed component implementations grouped into presets.
|
|
65
|
+
* The default preset is always installed; duplicate names are rejected.
|
|
66
|
+
*/
|
|
67
|
+
presets?: readonly LocalReactPreset[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Host implementation map for one immutable `LocalConfig`. The serializable
|
|
71
|
+
* config is available as `.config`; React functions stay on this object and
|
|
72
|
+
* never enter it.
|
|
73
|
+
*/
|
|
74
|
+
export interface LocalReactConfig {
|
|
75
|
+
readonly config: LocalConfig;
|
|
76
|
+
/** Selected implementations that are not supplied by the default React preset. */
|
|
77
|
+
readonly components: readonly LocalReactComponent[];
|
|
78
|
+
/** Every implementation selected for the active registry, in registry order. */
|
|
79
|
+
readonly implementations: readonly LocalReactComponent[];
|
|
80
|
+
/** Derived from `config.themes`; pass straight to the document view. */
|
|
81
|
+
readonly themes: readonly LocalThemePackage[];
|
|
82
|
+
/** Compatibility bridge for the legacy `hostRenderer` prop. */
|
|
83
|
+
readonly hostRenderer: LocalHostRenderer;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Validate implementations against an immutable config and expose the bridge
|
|
87
|
+
* used by the document views. Implementations are selected by manifest
|
|
88
|
+
* identity (id, name, version and semantic digest), not by preset identity.
|
|
89
|
+
* Candidates that are not active in the registry are ignored, so packs and
|
|
90
|
+
* replacements can ship a superset without duplicating implementations.
|
|
91
|
+
*/
|
|
92
|
+
export declare function createReactConfigWithDefaults(input: LocalConfig, options: CreateLocalReactConfigOptions, defaults: readonly LocalReactComponent[]): LocalReactConfig;
|
|
93
|
+
export declare class LocalReactExtensionMissingError extends Error {
|
|
94
|
+
readonly componentName: string;
|
|
95
|
+
constructor(name: string);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Renderer for `hostComponent` nodes produced from an SDK config. Unlike the
|
|
99
|
+
* legacy host bridge it does not require host data, so a stateless leaf can
|
|
100
|
+
* render on its own.
|
|
101
|
+
*/
|
|
102
|
+
export declare function localReactExtensionRenderer(config: LocalReactConfig): LocalReactExtensionRenderer;
|
|
103
|
+
/**
|
|
104
|
+
* Validate a compiled document against the React config before rendering.
|
|
105
|
+
* Missing or mismatched components are reported instead of executed.
|
|
106
|
+
*/
|
|
107
|
+
export declare function validateLocalReactExtensions(config: LocalReactConfig, requirements: unknown): Diagnostic[];
|
|
108
|
+
/**
|
|
109
|
+
* Safely report an error raised outside React's render phase (an event handler
|
|
110
|
+
* or an effect). The component itself stays mounted and the diagnostic points
|
|
111
|
+
* at its source range.
|
|
112
|
+
*/
|
|
113
|
+
export declare function reportLocalComponentError(context: Pick<LocalComponentContext, 'report' | 'instance'>, error: unknown, source?: string): void;
|
|
114
|
+
/** Wrap an event handler so an exception is reported instead of escaping. */
|
|
115
|
+
export declare function safeLocalComponentEvent<T extends unknown[]>(context: Pick<LocalComponentContext, 'report' | 'instance'>, handler: (...args: T) => void, source?: string): (...args: T) => void;
|
|
@@ -1,110 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { LocalLocale } from '../local/theme/i18n.js';
|
|
6
|
-
import type { LocalThemePackage } from '../sdk/theme.js';
|
|
7
|
-
import type { LocalRuntimeServices } from '../runtime-services/runtime.js';
|
|
8
|
-
import type { LocalComponentDefinition, LocalConfig } from '../sdk/types.js';
|
|
9
|
-
import { type LocalComponentContext, type LocalReactComponent, type LocalReactPreset } from './component-api.js';
|
|
10
|
-
export type { LocalComponentRender } from './component-api.js';
|
|
11
|
-
export { defineReactComponent, type LocalComponentBindingHandle, type LocalComponentContext, type LocalComponentInstance, type LocalComponentPropValue, type LocalComponentSetResult, type LocalComponentValue, type LocalReactComponent, type LocalReactComponentImplementation, type LocalReactPreset, } from './component-api.js';
|
|
12
|
-
/** Everything a renderer needs from the document view. */
|
|
13
|
-
export interface LocalReactRenderEnvironment {
|
|
14
|
-
runtime: LocalRuntime;
|
|
15
|
-
/** Runtime-scoped services; omitted only by hand-built render environments. */
|
|
16
|
-
services?: LocalRuntimeServices;
|
|
17
|
-
mode: LocalRenderMode;
|
|
18
|
-
visible: boolean;
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
disabledInvalid: boolean;
|
|
21
|
-
resetToken: number;
|
|
22
|
-
/** UI locale for built-in labels and diagnostics inside components. */
|
|
23
|
-
locale: LocalLocale;
|
|
24
|
-
/** Render this component's children at the inherited visibility. */
|
|
25
|
-
renderChildren(nodes: LocalNode[] | undefined, visible: boolean): ReactNode;
|
|
26
|
-
/** Render projected children as inline content. */
|
|
27
|
-
renderInline(nodes: LocalNode[] | undefined, visible: boolean): ReactNode;
|
|
28
|
-
/** Plain text projection of nodes. */
|
|
29
|
-
renderToText(nodes: LocalNode[] | undefined): string;
|
|
30
|
-
report(diagnostics: Diagnostic[]): void;
|
|
31
|
-
positionOf?(offset: number): {
|
|
32
|
-
line: number;
|
|
33
|
-
column: number;
|
|
34
|
-
};
|
|
35
|
-
definitionFor(name: string): LocalComponentDefinition | undefined;
|
|
36
|
-
validationField(node: LocalNode): {
|
|
37
|
-
describedBy?: string;
|
|
38
|
-
invalid: boolean;
|
|
39
|
-
};
|
|
40
|
-
validationHint(node: LocalNode): {
|
|
41
|
-
id: string;
|
|
42
|
-
failed: boolean;
|
|
43
|
-
error: boolean;
|
|
44
|
-
message: string;
|
|
45
|
-
} | null;
|
|
46
|
-
sourceAttributes(node: LocalNode, componentName?: string): Record<string, string>;
|
|
47
|
-
targetId(to: string): string | undefined;
|
|
48
|
-
anchorId(node: LocalNode): string | undefined;
|
|
49
|
-
jumpAllowed(to: string): boolean;
|
|
50
|
-
jumpTo(target: string): 'ok' | 'missing' | 'hidden';
|
|
51
|
-
urlPolicy?: LocalUrlPolicy;
|
|
52
|
-
imageResolver?: (url: string) => string | null;
|
|
53
|
-
}
|
|
54
|
-
export type LocalReactExtensionRenderer = (node: LocalNode, environment: LocalReactRenderEnvironment) => ReactNode;
|
|
55
|
-
export interface CreateLocalReactConfigOptions {
|
|
56
|
-
/** One implementation per external component declared by the config. */
|
|
57
|
-
components: readonly LocalReactComponent[];
|
|
58
|
-
/**
|
|
59
|
-
* Additional installed component implementations grouped into presets.
|
|
60
|
-
* The default preset is always installed; duplicate names are rejected.
|
|
61
|
-
*/
|
|
62
|
-
presets?: readonly LocalReactPreset[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Host implementation map for one immutable `LocalConfig`. The serializable
|
|
66
|
-
* config is available as `.config`; React functions stay on this object and
|
|
67
|
-
* never enter it.
|
|
68
|
-
*/
|
|
69
|
-
export interface LocalReactConfig {
|
|
70
|
-
readonly config: LocalConfig;
|
|
71
|
-
/** Selected implementations that are not supplied by the default React preset. */
|
|
72
|
-
readonly components: readonly LocalReactComponent[];
|
|
73
|
-
/** Every implementation selected for the active registry, in registry order. */
|
|
74
|
-
readonly implementations: readonly LocalReactComponent[];
|
|
75
|
-
/** Derived from `config.themes`; pass straight to the document view. */
|
|
76
|
-
readonly themes: readonly LocalThemePackage[];
|
|
77
|
-
/** Compatibility bridge for the legacy `hostRenderer` prop. */
|
|
78
|
-
readonly hostRenderer: LocalHostRenderer;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Validate implementations against an immutable config and expose the bridge
|
|
82
|
-
* used by the document views. Implementations are selected by manifest
|
|
83
|
-
* identity (id, name, version and semantic digest), not by preset identity.
|
|
84
|
-
* Candidates that are not active in the registry are ignored, so packs and
|
|
85
|
-
* replacements can ship a superset without duplicating implementations.
|
|
86
|
-
*/
|
|
87
|
-
export declare function createReactConfig(input: LocalConfig, options: CreateLocalReactConfigOptions): LocalReactConfig;
|
|
88
|
-
export declare class LocalReactExtensionMissingError extends Error {
|
|
89
|
-
readonly componentName: string;
|
|
90
|
-
constructor(name: string);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Renderer for `hostComponent` nodes produced from an SDK config. Unlike the
|
|
94
|
-
* legacy host bridge it does not require host data, so a stateless leaf can
|
|
95
|
-
* render on its own.
|
|
96
|
-
*/
|
|
97
|
-
export declare function localReactExtensionRenderer(config: LocalReactConfig): LocalReactExtensionRenderer;
|
|
98
|
-
/**
|
|
99
|
-
* Validate a compiled document against the React config before rendering.
|
|
100
|
-
* Missing or mismatched components are reported instead of executed.
|
|
101
|
-
*/
|
|
102
|
-
export declare function validateLocalReactExtensions(config: LocalReactConfig, requirements: unknown): Diagnostic[];
|
|
103
|
-
/**
|
|
104
|
-
* Safely report an error raised outside React's render phase (an event handler
|
|
105
|
-
* or an effect). The component itself stays mounted and the diagnostic points
|
|
106
|
-
* at its source range.
|
|
107
|
-
*/
|
|
108
|
-
export declare function reportLocalComponentError(context: Pick<LocalComponentContext, 'report' | 'instance'>, error: unknown, source?: string): void;
|
|
109
|
-
/** Wrap an event handler so an exception is reported instead of escaping. */
|
|
110
|
-
export declare function safeLocalComponentEvent<T extends unknown[]>(context: Pick<LocalComponentContext, 'report' | 'instance'>, handler: (...args: T) => void, source?: string): (...args: T) => void;
|
|
1
|
+
import type { LocalConfig } from '../sdk/types.js';
|
|
2
|
+
import { type CreateLocalReactConfigOptions } from './sdk-core.js';
|
|
3
|
+
export * from './sdk-core.js';
|
|
4
|
+
export declare function createReactConfig(input: LocalConfig, options: CreateLocalReactConfigOptions): import("./sdk-core.js").LocalReactConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type LocalDocumentViewProps } from '../local/rendering/LocalDocumentView.js';
|
|
2
|
-
import type { Diagnostic } from '../local/
|
|
1
|
+
import { type LocalDocumentViewProps } from '../local/rendering/document/LocalDocumentView.js';
|
|
2
|
+
import type { Diagnostic } from '../local/types.js';
|
|
3
3
|
import type { LocalStyleResource } from '../sdk/theme.js';
|
|
4
4
|
export type LocalStaticRenderResult = {
|
|
5
5
|
readonly ok: true;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { LocalSubmissionFieldCheck } from '../local/types.js';
|
|
1
2
|
import type { LocalComponentContext } from './component-api.js';
|
|
3
|
+
/** Keep only committed field constraints in the runtime's submission checks. */
|
|
4
|
+
export declare function useSubmissionField(context: LocalComponentContext, check: LocalSubmissionFieldCheck): void;
|
|
2
5
|
/**
|
|
3
6
|
* Editable draft state shared by text-like controls. The draft follows the
|
|
4
7
|
* bound display value while the field is neither focused nor composing; a
|
|
@@ -10,7 +13,8 @@ export declare function useDraftField(context: LocalComponentContext, display: s
|
|
|
10
13
|
touched: boolean;
|
|
11
14
|
draftError: string | null;
|
|
12
15
|
composing: import("react").RefObject<boolean>;
|
|
13
|
-
|
|
16
|
+
pendingDraft: import("react").RefObject<string | undefined>;
|
|
17
|
+
setDraft(value: string): void;
|
|
14
18
|
setFocused: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
15
19
|
setTouched: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
16
20
|
setDraftError: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bidirectional (submit + subscribe) network adapters over WebSocket and
|
|
3
|
+
* WebRTC data channels.
|
|
4
|
+
*
|
|
5
|
+
* The default wire protocol is JSON:
|
|
6
|
+
*
|
|
7
|
+
* client -> server {"type":"submit","requestId":"1","payload":{...},"idempotencyKey":"..."}
|
|
8
|
+
* server -> client {"type":"ack","requestId":"1"}
|
|
9
|
+
* {"type":"reject","requestId":"1","message":"..."}
|
|
10
|
+
* {"type":"data","value":...}
|
|
11
|
+
*
|
|
12
|
+
* `data` messages are pushes and carry no request id. Hosts with a different
|
|
13
|
+
* protocol pass a `codec`; the core still performs inbound validation and byte
|
|
14
|
+
* budgeting before any component sees a value.
|
|
15
|
+
*
|
|
16
|
+
* Every runtime session (identified by the adapter's `sessionSignal`) owns one
|
|
17
|
+
* connection. Subscriptions and pending submissions in that session share it;
|
|
18
|
+
* a session that still waits for an ack keeps the connection open after its
|
|
19
|
+
* last subscription leaves. Submits are never replayed, whether after a
|
|
20
|
+
* timeout, a disconnect or a reconnect.
|
|
21
|
+
*
|
|
22
|
+
* The module only touches `WebSocket` (or host-injected factories) when a
|
|
23
|
+
* connection is actually opened, so importing it on the server is safe.
|
|
24
|
+
*/
|
|
25
|
+
import type { ChannelValidator, Json, JsonPayload, NetworkChannel } from '../network.js';
|
|
26
|
+
/** A decoded inbound message. Unknown types are ignored by the adapter. */
|
|
27
|
+
export interface DuplexAck {
|
|
28
|
+
readonly type: 'ack';
|
|
29
|
+
readonly requestId: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DuplexReject {
|
|
32
|
+
readonly type: 'reject';
|
|
33
|
+
readonly requestId: string;
|
|
34
|
+
readonly message?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface DuplexPush {
|
|
37
|
+
readonly type: 'data';
|
|
38
|
+
readonly value: unknown;
|
|
39
|
+
}
|
|
40
|
+
export type DuplexInbound = DuplexAck | DuplexReject | DuplexPush;
|
|
41
|
+
export interface DuplexSubmit {
|
|
42
|
+
readonly type: 'submit';
|
|
43
|
+
readonly requestId: string;
|
|
44
|
+
readonly payload: JsonPayload;
|
|
45
|
+
readonly idempotencyKey?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Wire mapping for a duplex channel. `encodeSubmit` returns whatever the
|
|
49
|
+
* transport accepts (`string` or binary). `decode` receives the raw message
|
|
50
|
+
* from the transport and returns a normalized message, or `undefined` to
|
|
51
|
+
* ignore it. Throwing from `decode` is reported as invalid data.
|
|
52
|
+
*/
|
|
53
|
+
export interface DuplexCodec {
|
|
54
|
+
encodeSubmit(message: DuplexSubmit): unknown;
|
|
55
|
+
decode(raw: unknown): DuplexInbound | undefined;
|
|
56
|
+
}
|
|
57
|
+
export interface DuplexTimers {
|
|
58
|
+
setTimeout(callback: () => void, delayMs: number): unknown;
|
|
59
|
+
clearTimeout(handle: unknown): void;
|
|
60
|
+
}
|
|
61
|
+
export interface DuplexReconnectOptions {
|
|
62
|
+
/** First retry delay in milliseconds. Defaults to 1000. */
|
|
63
|
+
readonly delayMs?: number;
|
|
64
|
+
/** Exponential backoff cap in milliseconds. Defaults to 30000. */
|
|
65
|
+
readonly maxDelayMs?: number;
|
|
66
|
+
/** Maximum consecutive attempts. Defaults to unbounded. */
|
|
67
|
+
readonly attempts?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface DuplexChannelOptions {
|
|
70
|
+
/** Enables submission and authorizes outbound payloads. */
|
|
71
|
+
readonly validateSubmit?: ChannelValidator<JsonPayload>;
|
|
72
|
+
/** Enables subscription and authorizes inbound values. */
|
|
73
|
+
readonly validateSubscribe?: ChannelValidator<Json>;
|
|
74
|
+
/** Encoded JSON byte budget handed to the core. Omitted uses the core default. */
|
|
75
|
+
readonly maxBytes?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Raw inbound message budget in UTF-8 bytes for text and bytes for binary
|
|
78
|
+
* messages. Defaults to 64 KiB and applies before decoding.
|
|
79
|
+
*/
|
|
80
|
+
readonly maxMessageBytes?: number;
|
|
81
|
+
/** Defaults to `jsonDuplexCodec`. */
|
|
82
|
+
readonly codec?: DuplexCodec;
|
|
83
|
+
/** How long a sent submit waits for an ack. Defaults to 15000 ms. */
|
|
84
|
+
readonly ackTimeoutMs?: number;
|
|
85
|
+
/**
|
|
86
|
+
* How long one connection attempt may take before it counts as a transport
|
|
87
|
+
* failure. Defaults to 15000 ms.
|
|
88
|
+
*/
|
|
89
|
+
readonly connectTimeoutMs?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Reconnect a session's subscription transport after an unexpected close.
|
|
92
|
+
* Disabled by default; a session only reconnects while a subscription is
|
|
93
|
+
* still attached. Submits are never replayed either way.
|
|
94
|
+
*/
|
|
95
|
+
readonly reconnect?: boolean | DuplexReconnectOptions;
|
|
96
|
+
/** Timer injection for tests. Defaults to the global timers. */
|
|
97
|
+
readonly timers?: DuplexTimers;
|
|
98
|
+
}
|
|
99
|
+
/** Minimal structural WebSocket surface used by the adapter. */
|
|
100
|
+
export interface DuplexSocketLike {
|
|
101
|
+
send(data: unknown): void;
|
|
102
|
+
close(): void;
|
|
103
|
+
addEventListener(type: string, listener: (event: unknown) => void): void;
|
|
104
|
+
removeEventListener(type: string, listener: (event: unknown) => void): void;
|
|
105
|
+
}
|
|
106
|
+
export type DuplexSocketFactory = (url: string, protocols: readonly string[]) => DuplexSocketLike;
|
|
107
|
+
export interface WebSocketEndpoint {
|
|
108
|
+
readonly url?: string;
|
|
109
|
+
readonly protocols?: string | readonly string[];
|
|
110
|
+
}
|
|
111
|
+
export interface WebSocketChannelOptions extends DuplexChannelOptions {
|
|
112
|
+
/** Absolute `ws:` or `wss:` URL. */
|
|
113
|
+
readonly endpoint: string;
|
|
114
|
+
/** Subprotocols sent during the upgrade; often used for authentication. */
|
|
115
|
+
readonly protocols?: string | readonly string[];
|
|
116
|
+
/**
|
|
117
|
+
* Resolve the URL and subprotocols for each connection attempt, for example
|
|
118
|
+
* to attach a short-lived token. Runs only on connect, never at import time.
|
|
119
|
+
*/
|
|
120
|
+
readonly prepare?: (context: {
|
|
121
|
+
readonly signal: AbortSignal;
|
|
122
|
+
}) => WebSocketEndpoint | Promise<WebSocketEndpoint>;
|
|
123
|
+
/** Injected socket factory for tests or non-browser hosts. */
|
|
124
|
+
readonly webSocket?: DuplexSocketFactory;
|
|
125
|
+
}
|
|
126
|
+
/** Minimal structural RTCDataChannel surface used by the adapter. */
|
|
127
|
+
export interface DuplexDataChannelLike {
|
|
128
|
+
readonly readyState?: string;
|
|
129
|
+
send(data: unknown): void;
|
|
130
|
+
addEventListener(type: string, listener: (event: unknown) => void): void;
|
|
131
|
+
removeEventListener(type: string, listener: (event: unknown) => void): void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* A data channel borrowed from the host. The adapter never closes it; on
|
|
135
|
+
* teardown it removes its listeners and calls `release`, if provided.
|
|
136
|
+
*/
|
|
137
|
+
export interface WebRtcPeer {
|
|
138
|
+
readonly channel: DuplexDataChannelLike;
|
|
139
|
+
readonly release?: () => void;
|
|
140
|
+
}
|
|
141
|
+
export type WebRtcConnect = (endpoint: string, signal: AbortSignal) => WebRtcPeer | Promise<WebRtcPeer>;
|
|
142
|
+
export interface WebRtcChannelOptions extends DuplexChannelOptions {
|
|
143
|
+
/** Signaling path or peer identifier handed to `connect`. */
|
|
144
|
+
readonly endpoint: string;
|
|
145
|
+
/**
|
|
146
|
+
* Select a trusted peer and return its data channel. `signal` aborts when
|
|
147
|
+
* the session no longer needs the connection. The host owns signaling,
|
|
148
|
+
* authentication and peer selection.
|
|
149
|
+
*/
|
|
150
|
+
readonly connect: WebRtcConnect;
|
|
151
|
+
}
|
|
152
|
+
export declare const DEFAULT_DUPLEX_ACK_TIMEOUT_MS = 15000;
|
|
153
|
+
export declare const DEFAULT_DUPLEX_MESSAGE_BYTES: number;
|
|
154
|
+
/** Default JSON wire protocol; see the module comment for the message shapes. */
|
|
155
|
+
export declare const jsonDuplexCodec: DuplexCodec;
|
|
156
|
+
/** WebSocket channel factory; supports protocols, prepared URLs and auth. */
|
|
157
|
+
export declare function webSocketChannel(options: WebSocketChannelOptions): NetworkChannel;
|
|
158
|
+
/**
|
|
159
|
+
* WebRTC data-channel factory. The host selects the trusted peer in `connect`
|
|
160
|
+
* and owns everything it hands over; the adapter only detaches listeners and
|
|
161
|
+
* calls `release` on teardown.
|
|
162
|
+
*/
|
|
163
|
+
export declare function webRtcChannel(options: WebRtcChannelOptions): NetworkChannel;
|