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
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { i as
|
|
1
|
+
import { A as e, B as t, G as n, J as r, K as i, O as a, it as o } from "./preset-core-CKc5YXSM.js";
|
|
2
|
+
import { V as s, f as c, l, u } from "./config-validation-F47AcE6o.js";
|
|
3
|
+
import { S as d } from "./validation-BEBA_HvS.js";
|
|
4
|
+
import { l as f, o as p } from "./parser-standard-Yuf3A_VI.js";
|
|
5
|
+
import { i as m, s as h } from "./config-BadfhjdP.js";
|
|
6
|
+
import { r as g } from "./options-1aDLK7JY.js";
|
|
7
|
+
import { C as _, u as ee, w as te } from "./component-state-BoLCGee4.js";
|
|
8
|
+
import { n as v } from "./runtime-kcA7bG7G.js";
|
|
9
|
+
import { i as ne, t as y } from "./resources-D2GDQS0p.js";
|
|
10
10
|
// src/local/runtime/state.ts
|
|
11
11
|
var b = "reactive-md-state/v1", x = 1048576, S = /^fnv1a32:[0-9a-f]{8}$/, C = /* @__PURE__ */ new Set([
|
|
12
12
|
"format",
|
|
@@ -14,11 +14,11 @@ var b = "reactive-md-state/v1", x = 1048576, S = /^fnv1a32:[0-9a-f]{8}$/, C = /*
|
|
|
14
14
|
"sourceDigest",
|
|
15
15
|
"parameters",
|
|
16
16
|
"generator"
|
|
17
|
-
]),
|
|
18
|
-
function
|
|
17
|
+
]), re = /* @__PURE__ */ new Set(["name", "version"]), ie = new TextEncoder();
|
|
18
|
+
function w(e, t) {
|
|
19
19
|
return {
|
|
20
20
|
code: e,
|
|
21
|
-
message: t.length > 2e3 ? `${t
|
|
21
|
+
message: t.length > 2e3 ? `${s(t, o - 1)}…` : t,
|
|
22
22
|
severity: "error",
|
|
23
23
|
range: {
|
|
24
24
|
start: 0,
|
|
@@ -28,13 +28,13 @@ function T(e, t) {
|
|
|
28
28
|
column: 1
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
e.length < 100 && e.push(
|
|
31
|
+
function T(e, t, n) {
|
|
32
|
+
e.length < 100 && e.push(w(t, n));
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function E(e) {
|
|
35
35
|
return e instanceof Error ? e.message : String(e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function D(e) {
|
|
38
38
|
for (let t = 0; t < e.length; t += 1) {
|
|
39
39
|
let n = e.charCodeAt(t);
|
|
40
40
|
if (n >= 55296 && n <= 56319) {
|
|
@@ -49,8 +49,8 @@ function O(e) {
|
|
|
49
49
|
}
|
|
50
50
|
return !0;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
if (typeof e == "string") return
|
|
52
|
+
function O(e) {
|
|
53
|
+
if (typeof e == "string") return D(e) ? {
|
|
54
54
|
ok: !0,
|
|
55
55
|
value: e
|
|
56
56
|
} : {
|
|
@@ -73,7 +73,7 @@ function k(e) {
|
|
|
73
73
|
for (let r = 0; r < e.length; r += 1) {
|
|
74
74
|
let i = e[r];
|
|
75
75
|
if (n === "string" && typeof i == "string") {
|
|
76
|
-
if (!
|
|
76
|
+
if (!D(i)) return {
|
|
77
77
|
ok: !1,
|
|
78
78
|
message: "contains malformed Unicode."
|
|
79
79
|
};
|
|
@@ -94,30 +94,30 @@ function k(e) {
|
|
|
94
94
|
message: "must be a string, finite number, boolean, null or homogeneous primitive array."
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function k(e) {
|
|
98
98
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
99
99
|
let t = Object.getPrototypeOf(e);
|
|
100
100
|
return t === Object.prototype || t === null;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function A(e) {
|
|
103
103
|
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function j(e) {
|
|
106
106
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
107
107
|
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
108
|
-
if (!
|
|
108
|
+
if (!D(e.name) || !D(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
109
109
|
return Object.freeze({
|
|
110
110
|
name: e.name,
|
|
111
111
|
version: e.version
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
return typeof e == "string" ? `"${e.length > 48 ? `${e
|
|
114
|
+
function M(e) {
|
|
115
|
+
return typeof e == "string" ? `"${e.length > 48 ? `${s(e, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
return e.length > t ? e.length :
|
|
117
|
+
function N(e, t) {
|
|
118
|
+
return e.length > t ? e.length : ie.encode(e).byteLength;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function ae(e, t) {
|
|
121
121
|
let n;
|
|
122
122
|
try {
|
|
123
123
|
let t = JSON.stringify(e);
|
|
@@ -126,9 +126,9 @@ function oe(e, t) {
|
|
|
126
126
|
} catch {
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
|
-
return
|
|
129
|
+
return N(n, t);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function oe(e) {
|
|
132
132
|
if (e === void 0) return x;
|
|
133
133
|
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
134
134
|
let { maxLength: t } = e;
|
|
@@ -136,7 +136,7 @@ function se(e) {
|
|
|
136
136
|
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
137
137
|
return t;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function P(e, t, n) {
|
|
140
140
|
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
141
141
|
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
142
142
|
let r = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), i = new Set(r), a = /* @__PURE__ */ new Map();
|
|
@@ -147,7 +147,7 @@ function F(e, t, n) {
|
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
149
|
if (!i.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
|
|
150
|
-
let r =
|
|
150
|
+
let r = O(t[n]);
|
|
151
151
|
if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
|
|
152
152
|
a.set(n, r.value);
|
|
153
153
|
}
|
|
@@ -158,56 +158,56 @@ function F(e, t, n) {
|
|
|
158
158
|
}
|
|
159
159
|
let s = {
|
|
160
160
|
format: b,
|
|
161
|
-
syntax:
|
|
162
|
-
sourceDigest:
|
|
161
|
+
syntax: d,
|
|
162
|
+
sourceDigest: _(e.source),
|
|
163
163
|
parameters: o
|
|
164
164
|
};
|
|
165
|
-
return n !== void 0 && (s.generator =
|
|
165
|
+
return n !== void 0 && (s.generator = j(n)), A(s);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
let n = [], r = (e, t) =>
|
|
167
|
+
function se(e, t) {
|
|
168
|
+
let n = [], r = (e, t) => T(n, e, t), i = e;
|
|
169
169
|
if (typeof e == "string") {
|
|
170
|
-
if (
|
|
170
|
+
if (N(e, t) > t) return {
|
|
171
171
|
ok: !1,
|
|
172
|
-
diagnostics: [
|
|
172
|
+
diagnostics: [w("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
173
173
|
};
|
|
174
|
-
if (!
|
|
174
|
+
if (!D(e)) return {
|
|
175
175
|
ok: !1,
|
|
176
|
-
diagnostics: [
|
|
176
|
+
diagnostics: [w("local.state.utf", "The state payload contains malformed Unicode.")]
|
|
177
177
|
};
|
|
178
178
|
try {
|
|
179
179
|
i = JSON.parse(e);
|
|
180
180
|
} catch (e) {
|
|
181
181
|
return {
|
|
182
182
|
ok: !1,
|
|
183
|
-
diagnostics: [
|
|
183
|
+
diagnostics: [w("local.state.json", `The state payload is not valid JSON: ${E(e)}`)]
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
} else {
|
|
187
|
-
let n =
|
|
187
|
+
let n = ae(e, t);
|
|
188
188
|
if (n === null) return {
|
|
189
189
|
ok: !1,
|
|
190
|
-
diagnostics: [
|
|
190
|
+
diagnostics: [w("local.state.shape", "The state payload must be a JSON object.")]
|
|
191
191
|
};
|
|
192
192
|
if (n > t) return {
|
|
193
193
|
ok: !1,
|
|
194
|
-
diagnostics: [
|
|
194
|
+
diagnostics: [w("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
if (!
|
|
197
|
+
if (!k(i)) return {
|
|
198
198
|
ok: !1,
|
|
199
|
-
diagnostics: [
|
|
199
|
+
diagnostics: [w("local.state.shape", "The state payload must be a JSON object.")]
|
|
200
200
|
};
|
|
201
201
|
Object.getOwnPropertySymbols(i).length > 0 && r("local.state.shape", "The state payload cannot use symbol keys.");
|
|
202
202
|
for (let e of Object.keys(i)) C.has(e) || r("local.state.key", `Unknown top-level state key "${e}".`);
|
|
203
203
|
let a = i.format;
|
|
204
|
-
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${
|
|
204
|
+
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${M(a)}; expected "${b}".`);
|
|
205
205
|
let o = i.syntax;
|
|
206
|
-
o !== "local-draft-3" && r("local.state.syntax", `Unsupported state syntax ${
|
|
206
|
+
o !== "local-draft-3" && r("local.state.syntax", `Unsupported state syntax ${M(o)}; expected "${d}".`);
|
|
207
207
|
let s = i.sourceDigest;
|
|
208
208
|
typeof s == "string" && S.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
209
209
|
let c = {}, l = i.parameters;
|
|
210
|
-
if (!
|
|
210
|
+
if (!k(l)) r("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
211
211
|
else for (let e of Object.keys(l).sort()) {
|
|
212
212
|
if (e === "__proto__") {
|
|
213
213
|
r("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
|
|
@@ -217,16 +217,16 @@ function ce(e, t) {
|
|
|
217
217
|
r("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
|
-
let t =
|
|
220
|
+
let t = O(l[e]);
|
|
221
221
|
t.ok ? c[e] = t.value : r("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
|
|
222
222
|
}
|
|
223
|
-
let
|
|
223
|
+
let u;
|
|
224
224
|
if (Object.hasOwn(i, "generator")) {
|
|
225
225
|
let e = i.generator;
|
|
226
|
-
if (!
|
|
226
|
+
if (!k(e)) r("local.state.generator", "generator must be an object with string name and version.");
|
|
227
227
|
else {
|
|
228
|
-
for (let t of Object.keys(e))
|
|
229
|
-
typeof e.name != "string" || typeof e.version != "string" ? r("local.state.generator", "generator must have string name and version.") : !
|
|
228
|
+
for (let t of Object.keys(e)) re.has(t) || r("local.state.generator", `generator has unknown key "${t}".`);
|
|
229
|
+
typeof e.name != "string" || typeof e.version != "string" ? r("local.state.generator", "generator must have string name and version.") : !D(e.name) || !D(e.version) ? r("local.state.utf", "generator contains malformed Unicode.") : u = Object.freeze({
|
|
230
230
|
name: e.name,
|
|
231
231
|
version: e.version
|
|
232
232
|
});
|
|
@@ -238,34 +238,34 @@ function ce(e, t) {
|
|
|
238
238
|
};
|
|
239
239
|
let f = {
|
|
240
240
|
format: b,
|
|
241
|
-
syntax:
|
|
241
|
+
syntax: d,
|
|
242
242
|
sourceDigest: s,
|
|
243
243
|
parameters: c
|
|
244
244
|
};
|
|
245
|
-
return
|
|
245
|
+
return u && (f.generator = u), {
|
|
246
246
|
ok: !0,
|
|
247
|
-
file:
|
|
247
|
+
file: A(f)
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
let n =
|
|
250
|
+
function F(e, t) {
|
|
251
|
+
let n = oe(t);
|
|
252
252
|
try {
|
|
253
|
-
return
|
|
253
|
+
return se(e, n);
|
|
254
254
|
} catch (e) {
|
|
255
255
|
return {
|
|
256
256
|
ok: !1,
|
|
257
|
-
diagnostics: [
|
|
257
|
+
diagnostics: [w("local.state.invalid", `Cannot read the local state: ${E(e)}`)]
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function ce(e) {
|
|
262
262
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
263
263
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
264
264
|
};
|
|
265
265
|
return n(e.nodes), t;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
let t =
|
|
267
|
+
function I(e) {
|
|
268
|
+
let t = ce(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
269
269
|
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
270
270
|
let e = t.get(i);
|
|
271
271
|
if (!e) continue;
|
|
@@ -307,9 +307,11 @@ function L(e) {
|
|
|
307
307
|
groups: r
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
let r = [];
|
|
312
|
-
for (let
|
|
310
|
+
function L(e, t, n) {
|
|
311
|
+
let r = [], i = Object.create(null);
|
|
312
|
+
for (let a of t.plans) a.slot === void 0 && Object.hasOwn(n, a.key) && (a.node ? Object.is(e.get(a.node), n[a.key]) || (i[a.key] = n[a.key]) : r.push(w("local.state.document", `The document has no component for parameter "${a.key}".`)));
|
|
313
|
+
if (r.length) return r;
|
|
314
|
+
r.push(...e.setParameters(i));
|
|
313
315
|
for (let i of t.groups) {
|
|
314
316
|
let t = {}, a = !1;
|
|
315
317
|
for (let { slot: e, key: r } of i.slots) Object.hasOwn(n, r) && (t[e] = n[r], a = !0);
|
|
@@ -317,7 +319,7 @@ function R(e, t, n) {
|
|
|
317
319
|
}
|
|
318
320
|
return r;
|
|
319
321
|
}
|
|
320
|
-
function
|
|
322
|
+
function le(e, t) {
|
|
321
323
|
let n = e.snapshot(), r = {};
|
|
322
324
|
for (let e of t) {
|
|
323
325
|
let t = n.state[e];
|
|
@@ -325,24 +327,24 @@ function ue(e, t) {
|
|
|
325
327
|
}
|
|
326
328
|
return Object.freeze(r);
|
|
327
329
|
}
|
|
328
|
-
function
|
|
329
|
-
let i =
|
|
330
|
+
function R(e, t, n, r) {
|
|
331
|
+
let i = F(t, r);
|
|
330
332
|
if (!i.ok) return i;
|
|
331
333
|
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
332
334
|
ok: !1,
|
|
333
|
-
diagnostics: [
|
|
335
|
+
diagnostics: [w("local.state.document", "resolveLocalState requires a compiled local document.")]
|
|
334
336
|
};
|
|
335
337
|
if (i.file.syntax !== "local-draft-3") return {
|
|
336
338
|
ok: !1,
|
|
337
|
-
diagnostics: [
|
|
339
|
+
diagnostics: [w("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${d}".`)]
|
|
338
340
|
};
|
|
339
|
-
if (i.file.sourceDigest !==
|
|
341
|
+
if (i.file.sourceDigest !== _(e.source)) return {
|
|
340
342
|
ok: !1,
|
|
341
|
-
diagnostics: [
|
|
343
|
+
diagnostics: [w("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
342
344
|
};
|
|
343
|
-
let a =
|
|
344
|
-
for (let e of Object.keys(i.file.parameters)) o.has(e) ||
|
|
345
|
-
for (let e of o) Object.hasOwn(i.file.parameters, e) ||
|
|
345
|
+
let a = I(e), o = new Set(a.plans.map((e) => e.key)), s = [];
|
|
346
|
+
for (let e of Object.keys(i.file.parameters)) o.has(e) || T(s, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
347
|
+
for (let e of o) Object.hasOwn(i.file.parameters, e) || T(s, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
346
348
|
if (s.length) return {
|
|
347
349
|
ok: !1,
|
|
348
350
|
diagnostics: s
|
|
@@ -353,18 +355,18 @@ function z(e, t, n, r) {
|
|
|
353
355
|
} catch (e) {
|
|
354
356
|
return {
|
|
355
357
|
ok: !1,
|
|
356
|
-
diagnostics: [
|
|
358
|
+
diagnostics: [w("local.state.document", `Cannot validate this document: ${E(e)}`)]
|
|
357
359
|
};
|
|
358
360
|
}
|
|
359
361
|
try {
|
|
360
362
|
if (n) {
|
|
361
|
-
let e =
|
|
363
|
+
let e = L(c, a, n);
|
|
362
364
|
if (e.length) return {
|
|
363
365
|
ok: !1,
|
|
364
366
|
diagnostics: e
|
|
365
367
|
};
|
|
366
368
|
}
|
|
367
|
-
let e =
|
|
369
|
+
let e = L(c, a, i.file.parameters);
|
|
368
370
|
if (e.length) return {
|
|
369
371
|
ok: !1,
|
|
370
372
|
diagnostics: e
|
|
@@ -373,51 +375,51 @@ function z(e, t, n, r) {
|
|
|
373
375
|
return {
|
|
374
376
|
ok: !0,
|
|
375
377
|
file: i.file,
|
|
376
|
-
state:
|
|
378
|
+
state: le(c, t)
|
|
377
379
|
};
|
|
378
380
|
} finally {
|
|
379
381
|
c.dispose();
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
|
-
function
|
|
384
|
+
function z(e, t, n) {
|
|
383
385
|
try {
|
|
384
|
-
return
|
|
386
|
+
return R(e, t, void 0, n);
|
|
385
387
|
} catch (e) {
|
|
386
388
|
return {
|
|
387
389
|
ok: !1,
|
|
388
|
-
diagnostics: [
|
|
390
|
+
diagnostics: [w("local.state.invalid", `Cannot resolve the local state: ${E(e)}`)]
|
|
389
391
|
};
|
|
390
392
|
}
|
|
391
393
|
}
|
|
392
|
-
function
|
|
394
|
+
function B(e, t, n) {
|
|
393
395
|
let r;
|
|
394
396
|
try {
|
|
395
|
-
r =
|
|
397
|
+
r = R(e.document, t, e.snapshot().state, n);
|
|
396
398
|
} catch (e) {
|
|
397
|
-
return [
|
|
399
|
+
return [w("local.state.invalid", `Cannot apply the local state: ${E(e)}`)];
|
|
398
400
|
}
|
|
399
401
|
if (!r.ok) return r.diagnostics;
|
|
400
|
-
let i =
|
|
402
|
+
let i = I(e.document);
|
|
401
403
|
try {
|
|
402
|
-
return
|
|
404
|
+
return L(e, i, r.state);
|
|
403
405
|
} catch (e) {
|
|
404
|
-
return [
|
|
406
|
+
return [w("local.state.invalid", `Cannot apply the local state: ${E(e)}`)];
|
|
405
407
|
}
|
|
406
408
|
}
|
|
407
|
-
function
|
|
408
|
-
return
|
|
409
|
+
function ue(e, t) {
|
|
410
|
+
return P(e.document, e.getParameters(), t);
|
|
409
411
|
}
|
|
410
|
-
function
|
|
411
|
-
let r =
|
|
412
|
-
return r.ok ?
|
|
412
|
+
function de(e, t, n) {
|
|
413
|
+
let r = F(t, n);
|
|
414
|
+
return r.ok ? B(e, r.file, n) : r.diagnostics;
|
|
413
415
|
}
|
|
414
|
-
function
|
|
416
|
+
function fe(e) {
|
|
415
417
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
416
418
|
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
417
419
|
let t = Object.create(null);
|
|
418
420
|
for (let n of Object.keys(e.parameters).sort()) {
|
|
419
421
|
if (n === "__proto__" || n.startsWith("@")) throw TypeError(`Cannot serialize parameter "${n}".`);
|
|
420
|
-
let r =
|
|
422
|
+
let r = O(e.parameters[n]);
|
|
421
423
|
if (!r.ok) throw TypeError(`Cannot serialize parameter "${n}": the value ${r.message}`);
|
|
422
424
|
t[n] = r.value;
|
|
423
425
|
}
|
|
@@ -428,7 +430,7 @@ function pe(e) {
|
|
|
428
430
|
parameters: t
|
|
429
431
|
};
|
|
430
432
|
if (e.generator !== void 0) {
|
|
431
|
-
let t =
|
|
433
|
+
let t = j(e.generator);
|
|
432
434
|
n.generator = {
|
|
433
435
|
name: t.name,
|
|
434
436
|
version: t.version
|
|
@@ -437,9 +439,9 @@ function pe(e) {
|
|
|
437
439
|
return JSON.stringify(n);
|
|
438
440
|
}
|
|
439
441
|
// src/local/configuration/portable-options.ts
|
|
440
|
-
function
|
|
442
|
+
function V(e) {
|
|
441
443
|
if (e === void 0) return;
|
|
442
|
-
let t =
|
|
444
|
+
let t = g(e);
|
|
443
445
|
if (!t.ok) throw TypeError(`Invalid portable compile options: ${t.message}`);
|
|
444
446
|
return {
|
|
445
447
|
enableCss: t.html.enableCss,
|
|
@@ -447,7 +449,7 @@ function H(e) {
|
|
|
447
449
|
enableExtendedHtml: t.html.enableExtendedHtml,
|
|
448
450
|
...Object.hasOwn(e, "strict") && e.strict !== void 0 ? { strict: t.strict } : {},
|
|
449
451
|
...e.markdownBreaks === void 0 ? {} : { markdownBreaks: t.markdownBreaks },
|
|
450
|
-
...e.config === void 0 ? t.hostComponents.length ? { hostComponents: t.hostComponents } : {} : { config:
|
|
452
|
+
...e.config === void 0 ? t.hostComponents.length ? { hostComponents: t.hostComponents } : {} : { config: h(e.config) },
|
|
451
453
|
...e.limits === void 0 ? {} : { limits: {
|
|
452
454
|
...e.limits.maxSyntaxNodes === void 0 ? {} : { maxSyntaxNodes: t.maxSyntaxNodes },
|
|
453
455
|
...e.limits.maxParseWork === void 0 ? {} : { maxParseWork: t.maxParseWork },
|
|
@@ -456,9 +458,9 @@ function H(e) {
|
|
|
456
458
|
};
|
|
457
459
|
}
|
|
458
460
|
// src/export/restoration.ts
|
|
459
|
-
var
|
|
460
|
-
function
|
|
461
|
-
return
|
|
461
|
+
var pe = r;
|
|
462
|
+
function H(e) {
|
|
463
|
+
return r(JSON.stringify([
|
|
462
464
|
e.id,
|
|
463
465
|
e.name,
|
|
464
466
|
e.version,
|
|
@@ -467,64 +469,64 @@ function U(e) {
|
|
|
467
469
|
e.css.map(({ id: e, css: t }) => [e, t])
|
|
468
470
|
]));
|
|
469
471
|
}
|
|
470
|
-
function
|
|
471
|
-
let
|
|
472
|
+
function me(e, n) {
|
|
473
|
+
let i = h(n), a = l(i);
|
|
472
474
|
return Object.freeze({
|
|
473
475
|
protocol: "reactive-md-bundle/v1",
|
|
474
|
-
sdkVersion:
|
|
475
|
-
configKey:
|
|
476
|
-
scriptDigest:
|
|
477
|
-
assembly:
|
|
478
|
-
seal:
|
|
479
|
-
themes: Object.freeze(
|
|
476
|
+
sdkVersion: t,
|
|
477
|
+
configKey: i.key,
|
|
478
|
+
scriptDigest: r(e),
|
|
479
|
+
assembly: a,
|
|
480
|
+
seal: u(i),
|
|
481
|
+
themes: Object.freeze(i.themes.map((e) => Object.freeze({
|
|
480
482
|
id: e.id,
|
|
481
483
|
name: e.name,
|
|
482
484
|
version: e.version,
|
|
483
|
-
digest:
|
|
485
|
+
digest: H(e)
|
|
484
486
|
})))
|
|
485
487
|
});
|
|
486
488
|
}
|
|
487
|
-
function
|
|
488
|
-
let s =
|
|
489
|
+
function U(e, n, i, o = []) {
|
|
490
|
+
let s = h(n), c = /* @__PURE__ */ new Set(), u = [...e.nodes];
|
|
489
491
|
for (; u.length;) {
|
|
490
492
|
let e = u.pop();
|
|
491
|
-
(e.type === "component" || e.type === "hostComponent") && e.name &&
|
|
493
|
+
(e.type === "component" || e.type === "hostComponent") && e.name && c.add(e.name), e.children && u.push(...e.children);
|
|
492
494
|
}
|
|
493
|
-
let d = s.registry.filter((e) =>
|
|
494
|
-
id: t.id,
|
|
495
|
-
name: t.name,
|
|
496
|
-
version: t.version,
|
|
497
|
-
range: t.version,
|
|
498
|
-
digest: e(t)
|
|
499
|
-
})).sort((e, t) => e.id.localeCompare(t.id)), f = s.themes.filter((e) => e.name === t.theme).map((e) => Object.freeze({
|
|
495
|
+
let d = s.registry.filter((e) => c.has(e.name)).map((e) => Object.freeze({
|
|
500
496
|
id: e.id,
|
|
501
497
|
name: e.name,
|
|
502
498
|
version: e.version,
|
|
503
|
-
|
|
499
|
+
range: e.version,
|
|
500
|
+
digest: a(e)
|
|
501
|
+
})).sort((e, t) => e.id.localeCompare(t.id)), f = s.themes.filter((t) => t.name === e.theme).map((e) => Object.freeze({
|
|
502
|
+
id: e.id,
|
|
503
|
+
name: e.name,
|
|
504
|
+
version: e.version,
|
|
505
|
+
digest: H(e)
|
|
504
506
|
}));
|
|
505
507
|
return Object.freeze({
|
|
506
508
|
protocol: "reactive-md-restore/v1",
|
|
507
|
-
sdk: `^${
|
|
509
|
+
sdk: `^${t}`,
|
|
508
510
|
configKey: s.key,
|
|
509
|
-
sourceDigest:
|
|
510
|
-
target:
|
|
511
|
+
sourceDigest: r(e.source),
|
|
512
|
+
target: i,
|
|
511
513
|
components: Object.freeze(d),
|
|
512
514
|
themes: Object.freeze(f),
|
|
513
|
-
assembly:
|
|
514
|
-
resources: Object.freeze(
|
|
515
|
+
assembly: l(s),
|
|
516
|
+
resources: Object.freeze(o.map((e) => Object.freeze({
|
|
515
517
|
id: e.id,
|
|
516
|
-
digest:
|
|
518
|
+
digest: r(e.css)
|
|
517
519
|
})))
|
|
518
520
|
});
|
|
519
521
|
}
|
|
520
|
-
function
|
|
522
|
+
function W(e) {
|
|
521
523
|
return typeof e == "object" && !!e && !Array.isArray(e) && [Object.prototype, null].includes(Object.getPrototypeOf(e));
|
|
522
524
|
}
|
|
523
|
-
function
|
|
525
|
+
function G(e) {
|
|
524
526
|
return typeof e == "string" && e.length > 0 && e.length <= 256;
|
|
525
527
|
}
|
|
526
|
-
function
|
|
527
|
-
if (
|
|
528
|
+
function K(o, s) {
|
|
529
|
+
if (o === void 0) return [];
|
|
528
530
|
let l = [], u = (e, t) => l.push({
|
|
529
531
|
code: `local.extension.restore-${e}`,
|
|
530
532
|
message: t,
|
|
@@ -537,11 +539,11 @@ function q(a, c) {
|
|
|
537
539
|
column: 1
|
|
538
540
|
});
|
|
539
541
|
try {
|
|
540
|
-
if (!
|
|
542
|
+
if (!W(o) || e(o) > 262144 || o.protocol !== "reactive-md-restore/v1" || !G(o.sdk) || !G(o.configKey) || !G(o.sourceDigest) || ![
|
|
541
543
|
"static",
|
|
542
544
|
"ssr",
|
|
543
545
|
"offline"
|
|
544
|
-
].includes(
|
|
546
|
+
].includes(o.target) || !Array.isArray(o.components) || o.components.length > 192 || !Array.isArray(o.themes) || o.themes.length > 16 || !Array.isArray(o.resources) || o.resources.length > 128) return u("metadata", "Invalid or oversized restoration requirements."), l;
|
|
545
547
|
let d = /* @__PURE__ */ new Set([
|
|
546
548
|
"protocol",
|
|
547
549
|
"sdk",
|
|
@@ -553,75 +555,75 @@ function q(a, c) {
|
|
|
553
555
|
"resources",
|
|
554
556
|
"assembly"
|
|
555
557
|
]);
|
|
556
|
-
Object.keys(
|
|
557
|
-
let f =
|
|
558
|
-
|
|
558
|
+
Object.keys(o).some((e) => !d.has(e)) && u("metadata", "Unknown restoration requirement field.");
|
|
559
|
+
let f = s.config === void 0 ? m() : h(s.config);
|
|
560
|
+
i(o.sdk) && n("0.7.0", o.sdk) || u("sdk", `SDK ${t} does not satisfy ${o.sdk}.`), c(f, o.configKey) || u("config", "The installed configuration differs from the exported configuration."), o.assembly !== void 0 && (W(o.assembly) && o.assembly.protocol === "reactive-md-assembly-seal/v1" && G(o.assembly.configKey) && c(f, o.assembly.configKey) || u("assembly", "The exported assembly identity is invalid or belongs to another configuration.")), r(s.source) !== o.sourceDigest && u("source", "The source differs from the exported source. Recompile before restoring state.");
|
|
559
561
|
let p = /* @__PURE__ */ new Set();
|
|
560
|
-
for (let
|
|
561
|
-
if (!
|
|
562
|
+
for (let e of o.components) {
|
|
563
|
+
if (!W(e) || ![
|
|
562
564
|
"id",
|
|
563
565
|
"name",
|
|
564
566
|
"version",
|
|
565
567
|
"range",
|
|
566
568
|
"digest"
|
|
567
|
-
].every((
|
|
569
|
+
].every((t) => G(e[t])) || !i(e.range) || p.has(e.id)) {
|
|
568
570
|
u("metadata", "Invalid or duplicate component restoration requirement.");
|
|
569
571
|
continue;
|
|
570
572
|
}
|
|
571
|
-
p.add(
|
|
572
|
-
let
|
|
573
|
-
if (!
|
|
574
|
-
u("component-missing", `Required component ${
|
|
573
|
+
p.add(e.id);
|
|
574
|
+
let t = f.registry.find((t) => t.id === e.id);
|
|
575
|
+
if (!t) {
|
|
576
|
+
u("component-missing", `Required component ${e.id}@${e.version} is not installed.`);
|
|
575
577
|
continue;
|
|
576
578
|
}
|
|
577
|
-
n(
|
|
578
|
-
let
|
|
579
|
+
n(t.version, e.range) || u("version", `Component ${e.id}@${t.version} does not satisfy ${e.range}.`), (t.version !== e.version || t.name !== e.name || a(t) !== e.digest) && u("contract", `Component ${e.id}@${e.version} differs from the installed contract. Recompile and validate state before upgrading.`);
|
|
580
|
+
let r = o.target === "offline" ? [
|
|
579
581
|
"interactive",
|
|
580
582
|
"static",
|
|
581
583
|
"offline"
|
|
582
|
-
] : [
|
|
583
|
-
for (let
|
|
584
|
+
] : [o.target];
|
|
585
|
+
for (let n of r) t.capabilities[n] || u("capability", `Component ${e.id} cannot render ${n}.`);
|
|
584
586
|
}
|
|
585
|
-
if (
|
|
586
|
-
let e =
|
|
587
|
+
if (s.document) {
|
|
588
|
+
let e = U(s.document, f, o.target);
|
|
587
589
|
for (let t of e.components) p.has(t.id) || u("component-missing", `Used component ${t.id} is missing from restoration requirements.`);
|
|
588
590
|
}
|
|
589
591
|
p.clear();
|
|
590
|
-
for (let e of
|
|
591
|
-
if (!
|
|
592
|
+
for (let e of o.themes) {
|
|
593
|
+
if (!W(e) || ![
|
|
592
594
|
"id",
|
|
593
595
|
"name",
|
|
594
596
|
"version",
|
|
595
597
|
"digest"
|
|
596
|
-
].every((t) =>
|
|
598
|
+
].every((t) => G(e[t])) || p.has(e.id)) {
|
|
597
599
|
u("metadata", "Invalid or duplicate theme restoration requirement.");
|
|
598
600
|
continue;
|
|
599
601
|
}
|
|
600
602
|
p.add(e.id);
|
|
601
603
|
let t = f.themes.find((t) => t.id === e.id);
|
|
602
|
-
t && t.name === e.name && t.version === e.version &&
|
|
604
|
+
t && t.name === e.name && t.version === e.version && H(t) === e.digest || u("theme", `Required theme ${e.id}@${e.version} does not match the installed theme.`);
|
|
603
605
|
}
|
|
604
|
-
if (
|
|
605
|
-
let e = f.themes.find((e) => e.name ===
|
|
606
|
+
if (s.document) {
|
|
607
|
+
let e = f.themes.find((e) => e.name === s.document.theme);
|
|
606
608
|
e && !p.has(e.id) && u("theme", `Selected theme ${e.id} is missing from restoration requirements.`);
|
|
607
609
|
}
|
|
608
|
-
let
|
|
609
|
-
l.push(...
|
|
610
|
-
let
|
|
610
|
+
let g = y(s.resources ?? []);
|
|
611
|
+
l.push(...g.diagnostics);
|
|
612
|
+
let _ = new Map(g.resources.map((e) => [e.id, e.css]));
|
|
611
613
|
p.clear();
|
|
612
|
-
for (let e of
|
|
613
|
-
if (!
|
|
614
|
+
for (let e of o.resources) {
|
|
615
|
+
if (!W(e) || !G(e.id) || !G(e.digest) || p.has(e.id)) {
|
|
614
616
|
u("metadata", "Invalid or duplicate style restoration requirement.");
|
|
615
617
|
continue;
|
|
616
618
|
}
|
|
617
619
|
p.add(e.id);
|
|
618
|
-
let t =
|
|
619
|
-
t === void 0 ? u("resource-missing", `Required style resource ${e.id} is missing before state restoration.`) :
|
|
620
|
+
let t = _.get(e.id);
|
|
621
|
+
t === void 0 ? u("resource-missing", `Required style resource ${e.id} is missing before state restoration.`) : r(t) !== e.digest && u("resource-digest", `Style resource ${e.id} differs from the exported content.`);
|
|
620
622
|
}
|
|
621
|
-
if (
|
|
622
|
-
let e =
|
|
623
|
-
n.push(...f.themes.filter((e) => e.name ===
|
|
624
|
-
for (let e of n) p.has(e) &&
|
|
623
|
+
if (s.document) {
|
|
624
|
+
let e = U(s.document, f, o.target), t = new Set(e.components.map((e) => e.id)), n = f.registry.filter((e) => t.has(e.id)).flatMap((e) => e.styles ?? []);
|
|
625
|
+
n.push(...f.themes.filter((e) => e.name === s.document.theme).flatMap((e) => e.css.map((e) => e.id)));
|
|
626
|
+
for (let e of n) p.has(e) && _.has(e) || u("resource-missing", `Used style resource ${e} is required before state restoration.`);
|
|
625
627
|
}
|
|
626
628
|
} catch (e) {
|
|
627
629
|
u("metadata", e instanceof Error ? e.message : String(e));
|
|
@@ -629,21 +631,21 @@ function q(a, c) {
|
|
|
629
631
|
return l;
|
|
630
632
|
}
|
|
631
633
|
// src/shareable.ts
|
|
632
|
-
var
|
|
633
|
-
function
|
|
634
|
+
var q = "reactive-md-html/v1", J = "reactive-md-html/v2", he = /^[A-Za-z][A-Za-z0-9_-]*$/, ge = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/, _e = /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/, ve = /[\u0000-\u001f\u007f-\u009f]/, Y = 64, ye = 41943040, be = 4096;
|
|
635
|
+
function X(e, t = !1) {
|
|
634
636
|
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
635
637
|
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
636
638
|
}
|
|
637
|
-
function
|
|
639
|
+
function xe(e) {
|
|
638
640
|
return e.replace(/<\/style/gi, "<\\/style");
|
|
639
641
|
}
|
|
640
|
-
function
|
|
642
|
+
function Se(e) {
|
|
641
643
|
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
642
644
|
}
|
|
643
|
-
function
|
|
644
|
-
return
|
|
645
|
+
function Z(e) {
|
|
646
|
+
return X(e, !0);
|
|
645
647
|
}
|
|
646
|
-
function
|
|
648
|
+
function Q(e) {
|
|
647
649
|
let t = JSON.stringify(e);
|
|
648
650
|
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
649
651
|
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
@@ -656,87 +658,57 @@ function $(e) {
|
|
|
656
658
|
}
|
|
657
659
|
});
|
|
658
660
|
}
|
|
659
|
-
function
|
|
661
|
+
function $(e) {
|
|
660
662
|
return Array.isArray(e) ? e.slice() : e;
|
|
661
663
|
}
|
|
662
|
-
function
|
|
664
|
+
function Ce(e) {
|
|
663
665
|
try {
|
|
664
|
-
return
|
|
666
|
+
return V(e);
|
|
665
667
|
} catch (e) {
|
|
666
668
|
throw TypeError(`createShareableHtml received invalid compileOptions: ${e instanceof Error ? e.message : String(e)}`);
|
|
667
669
|
}
|
|
668
670
|
}
|
|
669
|
-
function
|
|
670
|
-
let t =
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
if (i.tagName.toLowerCase() === "iframe") {
|
|
685
|
-
let e = i.attrs.filter((e) => {
|
|
686
|
-
let t = e.name.toLowerCase();
|
|
687
|
-
return t !== "srcdoc" && t !== "sandbox";
|
|
688
|
-
});
|
|
689
|
-
e.push({
|
|
690
|
-
name: "srcdoc",
|
|
691
|
-
value: t
|
|
692
|
-
}), e.push({
|
|
693
|
-
name: "sandbox",
|
|
694
|
-
value: n
|
|
695
|
-
}), i.attrs = e, r = !0;
|
|
671
|
+
function we(e, t) {
|
|
672
|
+
let n = t.enableExtendedHtml ? "frame-src about: data: blob:" : "frame-src 'none'", r = e ? "script-src 'unsafe-inline'" + (t.enableJavaScript ? " 'wasm-unsafe-eval'" : "") : "script-src 'none'", i = e && t.enableJavaScript ? "worker-src blob:" : "worker-src 'none'";
|
|
673
|
+
return `default-src 'none'; img-src data:; style-src 'unsafe-inline'; ${r}; font-src data:; ${e ? "connect-src 'none'; media-src 'none'; " : ""}object-src 'none'; ${n}; ${i}; base-uri 'none'; form-action 'none'`;
|
|
674
|
+
}
|
|
675
|
+
function Te(e, t) {
|
|
676
|
+
if (t.enableCss && t.enableExtendedHtml || !/data-(?:rmd-(?:snapshot|author)-css|extended-html)/i.test(e)) return;
|
|
677
|
+
let n = [...p(e).childNodes];
|
|
678
|
+
for (; n.length;) {
|
|
679
|
+
let e = n.pop();
|
|
680
|
+
if (f.isElementNode(e)) {
|
|
681
|
+
for (let { name: n, value: r } of e.attrs) {
|
|
682
|
+
if (!t.enableCss && (n === "data-rmd-snapshot-css" || e.tagName === "style" && n === "data-rmd-author-css")) throw TypeError("Render staticMarkup with author CSS disabled before exporting with enableCss: false.");
|
|
683
|
+
if (!t.enableExtendedHtml && n === "data-extended-html" && (r === "direct" || r === "sandbox")) throw TypeError("Render staticMarkup with Extended HTML disabled before exporting with enableExtendedHtml: false.");
|
|
684
|
+
}
|
|
685
|
+
for (let t of e.childNodes) n.push(t);
|
|
696
686
|
}
|
|
697
|
-
De(i, t, n) && (r = !0);
|
|
698
687
|
}
|
|
699
|
-
return r;
|
|
700
|
-
}
|
|
701
|
-
function Oe(e) {
|
|
702
|
-
let t = "";
|
|
703
|
-
for (let n of e.childNodes) t += f(n, { scriptingEnabled: !1 });
|
|
704
|
-
return t;
|
|
705
|
-
}
|
|
706
|
-
function ke(e, t, n) {
|
|
707
|
-
try {
|
|
708
|
-
let r = h(e, { scriptingEnabled: !1 });
|
|
709
|
-
if (Ee(r), De(r, t, n)) return Oe(r);
|
|
710
|
-
} catch {}
|
|
711
|
-
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${Z(n, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${Z(t, !0)}"></iframe></div>`;
|
|
712
688
|
}
|
|
713
|
-
function
|
|
714
|
-
let n = t?.enableExtendedHtml === !0, r = t ? `frame-src about:${n ? " data: blob: http: https:" : ""}` : "frame-src 'none'", i = n ? "base-uri 'self' http: https:" : "base-uri 'none'", a = n ? "form-action http: https:" : "form-action 'none'";
|
|
715
|
-
return e ? `default-src 'none'; img-src data:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src data:; connect-src 'none'; media-src 'none'; object-src 'none'; ${r}; ${i}; ${a}` : `default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; object-src 'none'; ${r}; ${i}; ${a}`;
|
|
716
|
-
}
|
|
717
|
-
function je(e) {
|
|
689
|
+
function Ee(e) {
|
|
718
690
|
if (e === void 0) return;
|
|
719
691
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
720
692
|
let t = Object.entries(e);
|
|
721
|
-
if (t.length >
|
|
693
|
+
if (t.length > Y) throw RangeError(`images cannot contain more than ${Y} entries.`);
|
|
722
694
|
let n = 0;
|
|
723
695
|
for (let [e, r] of t) {
|
|
724
|
-
if (!e || e.length >
|
|
725
|
-
if (typeof r != "string" || !
|
|
726
|
-
if (n += r.length, n >
|
|
696
|
+
if (!e || e.length > be || ve.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
697
|
+
if (typeof r != "string" || !_e.test(r)) throw TypeError(`The image map for "${e}" must contain a base64 PNG, JPEG, GIF or WebP data URL.`);
|
|
698
|
+
if (n += r.length, n > ye) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
727
699
|
}
|
|
728
700
|
return Object.fromEntries(t);
|
|
729
701
|
}
|
|
730
|
-
function
|
|
731
|
-
let n =
|
|
702
|
+
function De(e, t) {
|
|
703
|
+
let n = z(e, t);
|
|
732
704
|
if (!n.ok) return n;
|
|
733
705
|
let r = {};
|
|
734
706
|
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
735
707
|
...i,
|
|
736
|
-
initial:
|
|
708
|
+
initial: $(n.state[t])
|
|
737
709
|
} : i;
|
|
738
710
|
let i = { ...e.initialState };
|
|
739
|
-
for (let [e, t] of Object.entries(n.state)) i[e] =
|
|
711
|
+
for (let [e, t] of Object.entries(n.state)) i[e] = $(t);
|
|
740
712
|
return {
|
|
741
713
|
ok: !0,
|
|
742
714
|
baseline: {
|
|
@@ -749,96 +721,91 @@ function Me(e, t) {
|
|
|
749
721
|
}
|
|
750
722
|
};
|
|
751
723
|
}
|
|
752
|
-
var
|
|
753
|
-
function
|
|
724
|
+
var Oe = "\n:root { color-scheme: light; background: #f5f7fb; }\nhtml, body { margin: 0; }\nbody.reactive-md-export {\n min-height: 100vh;\n padding: clamp(16px, 4vw, 48px);\n background: #f5f7fb;\n color: #17233d;\n font-family: system-ui, -apple-system, \"Segoe UI\", sans-serif;\n}\n.reactive-md-export-root { max-width: 840px; margin: 0 auto; }\n@media print {\n :root, html, body.reactive-md-export { background: #fff !important; }\n body.reactive-md-export { min-height: 0; padding: 0 !important; }\n .reactive-md-export-root { max-width: none !important; margin: 0 !important; }\n}\n";
|
|
725
|
+
function ke(e) {
|
|
754
726
|
let t = e.targetId ?? "reactive-md-document";
|
|
755
|
-
if (!
|
|
727
|
+
if (!he.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
756
728
|
let n = e.mode === "static" ? "static" : "interactive";
|
|
757
729
|
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
758
730
|
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
759
|
-
if (e.state.sourceDigest !==
|
|
731
|
+
if (e.state.sourceDigest !== _(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
760
732
|
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
761
|
-
let r =
|
|
762
|
-
if (i.push(...
|
|
733
|
+
let r = Ce(e.compileOptions), i = ne(e.extensions, r?.config);
|
|
734
|
+
if (i.push(...K(e.restoration, {
|
|
763
735
|
config: r?.config,
|
|
764
736
|
source: e.source,
|
|
765
737
|
resources: e.resources
|
|
766
738
|
})), i.length) throw TypeError(i.map((e) => e.message).join(" "));
|
|
767
|
-
let a =
|
|
739
|
+
let a = g(r);
|
|
768
740
|
if (!a.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${a.message}`);
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
741
|
+
Te(e.staticMarkup, a.html);
|
|
742
|
+
let o = e.documentId === void 0 ? void 0 : te(e.documentId);
|
|
743
|
+
if (e.documentId !== void 0 && o === void 0) throw TypeError("createShareableHtml received an invalid documentId.");
|
|
744
|
+
let s;
|
|
772
745
|
if (e.randomSeed !== void 0) {
|
|
773
746
|
if (!Number.isInteger(e.randomSeed) || e.randomSeed < 0 || e.randomSeed > 4294967295) throw TypeError("createShareableHtml received an invalid randomSeed; expected a 32-bit unsigned integer.");
|
|
774
|
-
|
|
747
|
+
s = e.randomSeed;
|
|
775
748
|
}
|
|
776
|
-
let
|
|
749
|
+
let c;
|
|
777
750
|
if (e.componentState !== void 0) {
|
|
778
|
-
let t =
|
|
751
|
+
let t = ee(e.componentState);
|
|
779
752
|
if (!t.ok || t.diagnostics.length > 0) {
|
|
780
753
|
let e = t.diagnostics.map((e) => e.message).join(" ");
|
|
781
754
|
throw TypeError(`createShareableHtml received an invalid component state${e ? `: ${e}` : "."}`);
|
|
782
755
|
}
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
let u = e.staticMarkup;
|
|
786
|
-
if (o && (n === "static" || !a.html.enableJavaScript)) {
|
|
787
|
-
let t = {
|
|
788
|
-
enableCss: a.html.enableCss,
|
|
789
|
-
enableJavaScript: !1,
|
|
790
|
-
enableExtendedHtml: a.html.enableExtendedHtml
|
|
791
|
-
}, n = m(e.source, t, a.maxSyntaxNodes);
|
|
792
|
-
if (!n.markup) throw Error("The native HTML document could not be regenerated without author JavaScript.");
|
|
793
|
-
u = ke(e.staticMarkup, n.markup, d(t));
|
|
756
|
+
c = t.document;
|
|
794
757
|
}
|
|
795
|
-
let
|
|
758
|
+
let l = e.locale === "zh" ? "zh" : "en", u = l === "zh" ? "zh-CN" : "en", d = e.colorScheme === "light" || e.colorScheme === "dark" ? e.colorScheme : "auto", f = e.assets === "omit" ? "omit" : "inline", p = e.generator ?? {
|
|
796
759
|
name: "reactive-md",
|
|
797
760
|
version: "unknown"
|
|
798
|
-
},
|
|
761
|
+
}, m = Ee(e.images), h = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(m ?? {}).length), v = n === "interactive", y = {
|
|
799
762
|
version: e.restoration ? 2 : 1,
|
|
763
|
+
sourceSemantics: "mixed-rmd-v1",
|
|
800
764
|
target: t,
|
|
801
765
|
source: e.source,
|
|
802
766
|
state: e.state,
|
|
803
|
-
locale:
|
|
804
|
-
colorScheme:
|
|
767
|
+
locale: l,
|
|
768
|
+
colorScheme: d,
|
|
805
769
|
hydrate: !0,
|
|
806
|
-
|
|
770
|
+
compileOptions: {
|
|
771
|
+
...r,
|
|
772
|
+
...a.html
|
|
773
|
+
},
|
|
807
774
|
...e.extensions === void 0 ? {} : { extensions: e.extensions },
|
|
808
775
|
...e.restoration === void 0 ? {} : {
|
|
809
776
|
restoration: e.restoration,
|
|
810
777
|
resources: e.resources ?? []
|
|
811
778
|
},
|
|
812
|
-
...
|
|
813
|
-
...
|
|
814
|
-
...
|
|
815
|
-
...
|
|
816
|
-
},
|
|
817
|
-
<script>${
|
|
779
|
+
...m ? { images: m } : {},
|
|
780
|
+
...o === void 0 ? {} : { documentId: o },
|
|
781
|
+
...s === void 0 ? {} : { randomSeed: s },
|
|
782
|
+
...c === void 0 ? {} : { componentState: c }
|
|
783
|
+
}, b = we(v, a.html), x = v ? `<script type="application/reactive-md+json" data-reactive-md-auto>${Q(y)}<\/script>
|
|
784
|
+
<script>${Se(e.runtimeScript)}<\/script>` : "", S = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${X(e.notices)}</pre></template>` : "", C = !v && e.extensions ? `<template id="reactive-md-extensions">${X(JSON.stringify(e.extensions))}</template>` : "";
|
|
818
785
|
return `<!doctype html>
|
|
819
|
-
<html lang="${
|
|
786
|
+
<html lang="${X(ge.test(u) ? u : "en", !0)}">
|
|
820
787
|
<head>
|
|
821
788
|
<meta charset="utf-8">
|
|
822
789
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
823
790
|
<meta name="referrer" content="no-referrer">
|
|
824
|
-
<meta http-equiv="Content-Security-Policy" content="${
|
|
825
|
-
<meta name="generator" content="${
|
|
826
|
-
<meta name="reactive-md-html-format" content="${e.restoration ?
|
|
827
|
-
<meta name="reactive-md-syntax" content="${
|
|
791
|
+
<meta http-equiv="Content-Security-Policy" content="${Z(b)}">
|
|
792
|
+
<meta name="generator" content="${Z(`${p.name} ${p.version}`)}">
|
|
793
|
+
<meta name="reactive-md-html-format" content="${e.restoration ? J : q}">
|
|
794
|
+
<meta name="reactive-md-syntax" content="${Z(e.state.syntax)}">
|
|
828
795
|
<meta name="reactive-md-output" content="${n}">
|
|
829
|
-
<meta name="reactive-md-state" content="${
|
|
830
|
-
<meta name="reactive-md-images" content="${
|
|
831
|
-
<meta name="reactive-md-image-count" content="${
|
|
832
|
-
<title>${
|
|
833
|
-
<style>${
|
|
796
|
+
<meta name="reactive-md-state" content="${Z(e.state.sourceDigest)}">
|
|
797
|
+
<meta name="reactive-md-images" content="${f}">
|
|
798
|
+
<meta name="reactive-md-image-count" content="${h}">
|
|
799
|
+
<title>${X(e.title || "Reactive MD document")}</title>
|
|
800
|
+
<style>${xe(e.css)}${Oe}</style>
|
|
834
801
|
</head>
|
|
835
802
|
<body class="reactive-md-export">
|
|
836
|
-
<div id="${t}" class="reactive-md-export-root">${
|
|
803
|
+
<div id="${t}" class="reactive-md-export-root">${e.staticMarkup}</div>
|
|
804
|
+
${x}
|
|
837
805
|
${C}
|
|
838
|
-
${
|
|
839
|
-
${w}
|
|
806
|
+
${S}
|
|
840
807
|
</body>
|
|
841
808
|
</html>
|
|
842
809
|
`;
|
|
843
810
|
}
|
|
844
|
-
export {
|
|
811
|
+
export { F as _, Q as a, pe as c, V as d, b as f, de as g, ue as h, De as i, H as l, P as m, J as n, me as o, B as p, ke as r, U as s, q as t, K as u, z as v, fe as y };
|