reactive-md 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +66 -0
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING-ch.md +6 -62
- package/CONTRIBUTING.md +5 -63
- package/README-ch.md +232 -67
- package/README-en.md +209 -71
- package/README.md +209 -71
- package/SECURITY-ch.md +3 -1
- package/SECURITY.md +3 -1
- package/THIRD_PARTY_NOTICES.md +1909 -87
- package/cli/args.mjs +33 -1
- package/cli/build.mjs +62 -1
- package/cli/check.mjs +444 -0
- package/cli/help.mjs +181 -3
- package/cli/init.mjs +1577 -0
- package/cli/main.mjs +11 -1
- package/cli/package-loader.mjs +41 -0
- package/dist-library/LocalDocumentView-6trX7xJc.js +97920 -0
- package/dist-library/{authoring-BEVyth5X.js → authoring-BsfSwQRm.js} +237 -209
- package/dist-library/compiler--ea2CKQF.js +61 -0
- package/dist-library/compiler-core-kPiH-gOV.js +11805 -0
- package/dist-library/component-state-Cq2K5gkS.js +490 -0
- package/dist-library/component-state-D_cw_EHe.js +54 -0
- package/dist-library/config-validation-DXTynAw7.js +3005 -0
- package/dist-library/default-components-Z_YMio5P.js +2346 -0
- package/dist-library/identity-MYJXKSkB.js +1443 -0
- package/dist-library/math-display-BJz4gbFc.js +24000 -0
- package/dist-library/math-sample-BGEW49zY.js +1124 -0
- package/dist-library/options-CX5m5n-J.js +115 -0
- package/dist-library/parser-standard-DlCk7sLo.js +10122 -0
- package/dist-library/props-DGlBk0e5.js +183 -0
- package/dist-library/react-ByOHunUW.js +122 -0
- package/dist-library/reactive-md-authoring.js +712 -1077
- package/dist-library/reactive-md-build.js +7966 -0
- package/dist-library/reactive-md-compiler-standard.js +33 -0
- package/dist-library/reactive-md-compiler.js +22 -0
- package/dist-library/reactive-md-default-packs.js +71 -0
- package/dist-library/reactive-md-default-preset.js +10 -0
- package/dist-library/reactive-md-export.js +111 -0
- package/dist-library/reactive-md-print.css +18 -3
- package/dist-library/reactive-md-react-runtime.js +251 -0
- package/dist-library/reactive-md-react-server.js +55 -0
- package/dist-library/reactive-md-react-unstyled.js +9 -1
- package/dist-library/reactive-md-react.js +9 -1
- package/dist-library/reactive-md-runtime-browser.js +51 -0
- package/dist-library/reactive-md-runtime.js +3 -0
- package/dist-library/reactive-md-sdk.js +6 -0
- package/dist-library/reactive-md-standalone-host.js +442 -0
- package/dist-library/reactive-md-testing-browser.js +523 -0
- package/dist-library/reactive-md-testing-react.js +221 -0
- package/dist-library/reactive-md-testing.js +638 -0
- package/dist-library/reactive-md-vite.js +959 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1080 -795
- package/dist-library/registry-B9Jc3FVe.js +1174 -0
- package/dist-library/resources-BGt8mpDA.js +204 -0
- package/dist-library/runtime-C-sbfpOX.js +1157 -0
- package/dist-library/runtime-Dkq7ldyg.js +172 -0
- package/dist-library/schema-ZFufO8V0.js +39 -0
- package/dist-library/shareable-DDVL4Fi9.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +168 -0
- package/dist-library/types/authoring/conformance.d.ts +24 -0
- package/dist-library/types/{editor → authoring}/editor-i18n.d.ts +3 -24
- package/dist-library/types/authoring/extensions.d.ts +13 -0
- package/dist-library/types/authoring/index.d.ts +14 -11
- package/dist-library/types/authoring/insert.d.ts +16 -0
- package/dist-library/types/{editor → authoring}/native-components.d.ts +19 -2
- package/dist-library/types/authoring/templates.d.ts +65 -0
- package/dist-library/types/build/diagnostics.d.ts +8 -0
- package/dist-library/types/build/digest.d.ts +5 -0
- package/dist-library/types/build/entry.d.ts +9 -0
- package/dist-library/types/build/host.d.ts +36 -0
- package/dist-library/types/build/index.d.ts +99 -0
- package/dist-library/types/build/notices.d.ts +29 -0
- package/dist-library/types/build/resources.d.ts +60 -0
- package/dist-library/types/build/vite.d.ts +15 -0
- package/dist-library/types/compiler/index.d.ts +22 -0
- package/dist-library/types/compiler/result.d.ts +30 -0
- package/dist-library/types/compiler/standard.d.ts +16 -0
- package/dist-library/types/compiler/types.d.ts +69 -0
- package/dist-library/types/components/chart-motion.d.ts +12 -0
- package/dist-library/types/components/controls.d.ts +21 -0
- package/dist-library/types/{local → components}/data-table.d.ts +10 -24
- package/dist-library/types/components/default-chart-types.d.ts +22 -0
- package/dist-library/types/components/default-chart.d.ts +2 -0
- package/dist-library/types/components/default-preset.d.ts +10 -0
- package/dist-library/types/components/diagram-inspector.d.ts +24 -0
- package/dist-library/types/components/gallery.d.ts +6 -0
- package/dist-library/types/components/layout.d.ts +23 -0
- package/dist-library/types/components/mafs-plot-grid.d.ts +57 -0
- package/dist-library/types/components/mafs-visuals.d.ts +40 -0
- package/dist-library/types/components/numeric-sliders.d.ts +3 -0
- package/dist-library/types/components/uiarc/calendar/calendar.d.ts +26 -0
- package/dist-library/types/components/uiarc/date-picker/date-picker.d.ts +29 -0
- package/dist-library/types/components/uiarc/lib/motion-tokens.d.ts +2 -0
- package/dist-library/types/components/uiarc/lib/use-today.d.ts +2 -0
- package/dist-library/types/components/uiarc/motion-tokens.d.ts +60 -0
- package/dist-library/types/components/uiarc/rmd-motion.d.ts +12 -0
- package/dist-library/types/components/uiarc/select/select.d.ts +21 -0
- package/dist-library/types/components/uiarc/slider/slider.d.ts +53 -0
- package/dist-library/types/components/use-hydrated.d.ts +6 -0
- package/dist-library/types/components/visuals.d.ts +13 -0
- package/dist-library/types/export/component-state.d.ts +39 -0
- package/dist-library/types/export/index.d.ts +47 -0
- package/dist-library/types/export/requirements.d.ts +23 -0
- package/dist-library/types/export/resources.d.ts +8 -0
- package/dist-library/types/export/restoration.d.ts +52 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +16 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +64 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +46 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +9 -0
- package/dist-library/types/local/compilation/compiler.d.ts +34 -0
- package/dist-library/types/local/compilation/component-kernel.d.ts +487 -0
- package/dist-library/types/local/{dependencies.d.ts → compilation/dependencies.d.ts} +4 -3
- package/dist-library/types/local/{diagnostics.d.ts → configuration/diagnostic-messages.d.ts} +193 -65
- package/dist-library/types/local/configuration/diagnostics.d.ts +58 -0
- package/dist-library/types/local/{limits.d.ts → configuration/limits.d.ts} +15 -2
- package/dist-library/types/local/configuration/options-core.d.ts +120 -0
- package/dist-library/types/local/configuration/options.d.ts +17 -0
- package/dist-library/types/local/configuration/portable-options.d.ts +3 -0
- package/dist-library/types/local/configuration/schema-core.d.ts +32 -0
- package/dist-library/types/local/configuration/schema.d.ts +12 -0
- package/dist-library/types/local/contracts/types.d.ts +519 -0
- package/dist-library/types/local/{version.d.ts → contracts/version.d.ts} +1 -1
- package/dist-library/types/local/{computations.d.ts → evaluation/computations.d.ts} +6 -3
- package/dist-library/types/local/{expression.d.ts → evaluation/expression.d.ts} +2 -2
- package/dist-library/types/local/{math-display.d.ts → evaluation/math-display.d.ts} +2 -16
- package/dist-library/types/local/evaluation/math-sample.d.ts +23 -0
- package/dist-library/types/local/evaluation/math.d.ts +73 -0
- package/dist-library/types/local/{validation.d.ts → evaluation/validation.d.ts} +1 -1
- package/dist-library/types/local/html/html-details.d.ts +16 -0
- package/dist-library/types/local/html/html-entities.d.ts +7 -0
- package/dist-library/types/local/html/html-policy.d.ts +43 -0
- package/dist-library/types/local/html/html-recovery.d.ts +16 -0
- package/dist-library/types/local/html/html-table-names.d.ts +9 -0
- package/dist-library/types/local/{html-table.d.ts → html/html-table.d.ts} +2 -6
- package/dist-library/types/local/{html.d.ts → html/html.d.ts} +1 -1
- package/dist-library/types/local/index.d.ts +31 -24
- package/dist-library/types/local/markdown/fast-markdown.d.ts +137 -0
- package/dist-library/types/local/{footnotes.d.ts → markdown/footnotes.d.ts} +1 -1
- package/dist-library/types/local/{heading-anchors.d.ts → markdown/heading-anchors.d.ts} +12 -2
- package/dist-library/types/local/markdown/markdown-blocks.d.ts +55 -0
- package/dist-library/types/local/markdown/markdown-structure.d.ts +3 -0
- package/dist-library/types/local/markdown/plain-paragraphs.d.ts +10 -0
- package/dist-library/types/local/parsing/lexical.d.ts +21 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +67 -0
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +42 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +65 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +7 -0
- package/dist-library/types/local/parsing/parser.d.ts +16 -0
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +48 -0
- package/dist-library/types/local/{LocalDocumentView.d.ts → rendering/LocalDocumentView.d.ts} +67 -24
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +36 -0
- package/dist-library/types/local/rendering/render-types.d.ts +57 -0
- package/dist-library/types/local/rendering/view-revision.d.ts +75 -0
- package/dist-library/types/local/{retention.d.ts → runtime/retention.d.ts} +1 -1
- package/dist-library/types/local/runtime/runtime.d.ts +34 -0
- package/dist-library/types/local/{state.d.ts → runtime/state.d.ts} +4 -4
- package/dist-library/types/local/session/compiler-cache.d.ts +44 -0
- package/dist-library/types/local/session/incremental.d.ts +48 -0
- package/dist-library/types/local/session/parse-session.d.ts +62 -0
- package/dist-library/types/local/session/row-reuse.d.ts +46 -0
- package/dist-library/types/local/{authoring.d.ts → source/authoring.d.ts} +11 -3
- package/dist-library/types/local/source/node-walk.d.ts +3 -0
- package/dist-library/types/local/source/source-context.d.ts +63 -0
- package/dist-library/types/local/{source-migration.d.ts → source/source-migration.d.ts} +2 -2
- package/dist-library/types/local/{i18n.d.ts → theme/i18n.d.ts} +2 -2
- package/dist-library/types/local/theme/theme-name.d.ts +3 -0
- package/dist-library/types/local/{theme.d.ts → theme/theme.d.ts} +3 -3
- package/dist-library/types/local/transport/compile-patch.d.ts +127 -0
- package/dist-library/types/local/{compiled-data.d.ts → transport/compiled-data.d.ts} +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +17 -0
- package/dist-library/types/local/transport/shared-data.d.ts +10 -0
- package/dist-library/types/local/transport/worker.d.ts +265 -0
- package/dist-library/types/local/widgets/visuals.d.ts +25 -0
- package/dist-library/types/presets/default-authoring.d.ts +50 -0
- package/dist-library/types/presets/default-components.d.ts +4 -0
- package/dist-library/types/presets/default-semantics.d.ts +8 -0
- package/dist-library/types/presets/default.d.ts +11 -0
- package/dist-library/types/presets/identity.d.ts +7 -0
- package/dist-library/types/presets/packs.d.ts +4 -0
- package/dist-library/types/react/component-api.d.ts +260 -0
- package/dist-library/types/react/component-primitives.d.ts +21 -0
- package/dist-library/types/react/component-utils.d.ts +125 -0
- package/dist-library/types/react/default-theme.d.ts +6 -0
- package/dist-library/types/react/field-validation.d.ts +11 -0
- package/dist-library/types/react/index.d.ts +17 -5
- package/dist-library/types/react/overflow-text-tooltip.d.ts +6 -0
- package/dist-library/types/react/package.d.ts +69 -0
- package/dist-library/types/react/runtime/common.d.ts +4 -0
- package/dist-library/types/react/runtime/index.d.ts +8 -0
- package/dist-library/types/react/runtime/useComponentState.d.ts +30 -0
- package/dist-library/types/react/runtime/useKeys.d.ts +16 -0
- package/dist-library/types/react/runtime/useSwipe.d.ts +27 -0
- package/dist-library/types/react/runtime/useTicker.d.ts +17 -0
- package/dist-library/types/react/sdk.d.ts +110 -0
- package/dist-library/types/react/server.d.ts +15 -0
- package/dist-library/types/react/tooltip-layer.d.ts +10 -0
- package/dist-library/types/react/use-draft-field.d.ts +17 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +63 -0
- package/dist-library/types/runtime-services/component-state.d.ts +152 -0
- package/dist-library/types/runtime-services/identity.d.ts +41 -0
- package/dist-library/types/runtime-services/index.d.ts +10 -0
- package/dist-library/types/runtime-services/random.d.ts +42 -0
- package/dist-library/types/runtime-services/runtime.d.ts +51 -0
- package/dist-library/types/runtime-services/scheduler.d.ts +44 -0
- package/dist-library/types/sdk/assembly.d.ts +73 -0
- package/dist-library/types/sdk/compat-profile.d.ts +57 -0
- package/dist-library/types/sdk/compiler-config.d.ts +33 -0
- package/dist-library/types/sdk/config-validation.d.ts +33 -0
- package/dist-library/types/sdk/config.d.ts +35 -0
- package/dist-library/types/sdk/hash.d.ts +9 -0
- package/dist-library/types/sdk/index.d.ts +10 -0
- package/dist-library/types/sdk/manifest.d.ts +49 -0
- package/dist-library/types/sdk/pattern.d.ts +11 -0
- package/dist-library/types/sdk/preset-core.d.ts +11 -0
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +33 -0
- package/dist-library/types/sdk/registry-core.d.ts +16 -0
- package/dist-library/types/sdk/registry.d.ts +18 -0
- package/dist-library/types/sdk/theme.d.ts +73 -0
- package/dist-library/types/sdk/types.d.ts +221 -0
- package/dist-library/types/sdk/version.d.ts +49 -0
- package/dist-library/types/shareable.d.ts +29 -3
- package/dist-library/types/standalone/diagnostics.d.ts +16 -0
- package/dist-library/types/standalone/events.d.ts +4 -0
- package/dist-library/types/standalone/library.d.ts +6 -0
- package/dist-library/types/standalone/payload.d.ts +15 -0
- package/dist-library/types/standalone/prepare.d.ts +21 -0
- package/dist-library/types/standalone/session.d.ts +68 -0
- package/dist-library/types/standalone/version.d.ts +7 -0
- package/dist-library/types/testing/behavior.d.ts +19 -0
- package/dist-library/types/testing/browser.d.ts +126 -0
- package/dist-library/types/testing/cases.d.ts +16 -0
- package/dist-library/types/testing/index.d.ts +13 -0
- package/dist-library/types/testing/manifest.d.ts +10 -0
- package/dist-library/types/testing/react.d.ts +45 -0
- package/dist-library/types/testing/report.d.ts +20 -0
- package/dist-library/types/testing/types.d.ts +125 -0
- package/dist-library/types/testing/values.d.ts +22 -0
- package/dist-library/types/vite/client.d.ts +36 -0
- package/dist-library/types/vite/discovery.d.ts +51 -0
- package/dist-library/types/vite/index.d.ts +31 -0
- package/dist-library/types/vite/registration.d.ts +109 -0
- package/dist-library/types-BFCrMrg0.js +52 -0
- package/dist-library/validation-W-bmny-x.js +2253 -0
- package/dist-library/values-CIt8AjiU.js +134 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +591 -95
- package/docs/README-ch.md +90 -0
- package/docs/README.md +87 -81
- package/docs/compatibility/compatibility-ch.md +22 -14
- package/docs/compatibility/compatibility-en.md +22 -14
- package/docs/compatibility/source-versioning-ch.md +15 -12
- package/docs/compatibility/source-versioning-en.md +16 -13
- package/docs/development/component-development-ch.md +51 -195
- package/docs/development/component-development-en.md +51 -195
- package/docs/development/component-development-reference-ch.md +253 -0
- package/docs/development/component-development-reference-en.md +238 -0
- package/docs/development/component-protocol-ch.md +51 -50
- package/docs/development/component-protocol-en.md +52 -49
- package/docs/development/local-module-layout-ch.md +59 -0
- package/docs/development/local-module-layout-en.md +59 -0
- package/docs/development/performance-overview-ch.md +402 -0
- package/docs/development/performance-overview-en.md +402 -0
- package/docs/development/releasing-ch.md +8 -104
- package/docs/development/releasing-en.md +8 -104
- package/docs/guides/local-guide-ch.md +28 -9
- package/docs/guides/local-guide-en.md +31 -12
- package/docs/integration/author-tools-ch.md +4 -2
- package/docs/integration/author-tools-en.md +4 -2
- package/docs/integration/codemirror-ch.md +52 -0
- package/docs/integration/codemirror-en.md +29 -0
- package/docs/integration/compiler-ch.md +47 -0
- package/docs/integration/compiler-en.md +34 -0
- package/docs/integration/directory-discovery-ch.md +53 -0
- package/docs/integration/directory-discovery-en.md +31 -0
- package/docs/integration/editor-ch.md +48 -21
- package/docs/integration/editor-en.md +48 -21
- package/docs/integration/extension-sdk-ch.md +392 -0
- package/docs/integration/extension-sdk-en.md +377 -0
- package/docs/integration/local-integration-ch.md +63 -9
- package/docs/integration/local-integration-en.md +89 -13
- package/docs/integration/repository-split-ch.md +40 -0
- package/docs/integration/repository-split-en.md +23 -0
- package/docs/integration/shareable-export-ch.md +46 -2
- package/docs/integration/shareable-export-en.md +46 -2
- package/docs/reference/computations-formatting-ch.md +4 -2
- package/docs/reference/computations-formatting-en.md +4 -2
- package/docs/reference/constraints-collections-ch.md +21 -1
- package/docs/reference/constraints-collections-en.md +21 -1
- package/docs/reference/diagnostics-counting-ch.md +1 -1
- package/docs/reference/diagnostics-counting-en.md +1 -1
- package/docs/reference/html-compatibility-ch.md +4 -0
- package/docs/reference/html-compatibility-en.md +4 -0
- package/docs/reference/local-components-v2-ch.md +2 -0
- package/docs/reference/local-components-v2-en.md +2 -0
- package/docs/reference/local-interaction-syntax-ch.md +51 -15
- package/docs/reference/local-interaction-syntax-en.md +58 -14
- package/docs/reference/theme-protocol-ch.md +79 -7
- package/docs/reference/theme-protocol-en.md +79 -7
- package/docs/reference/tolerance-ch.md +64 -0
- package/docs/reference/tolerance-en.md +57 -0
- package/docs/releases/release-0.4.0-ch.md +2 -0
- package/docs/releases/release-0.4.0-en.md +2 -0
- package/docs/releases/release-0.4.1-ch.md +2 -0
- package/docs/releases/release-0.4.1-en.md +2 -0
- package/docs/releases/release-0.5.0-ch.md +2 -0
- package/docs/releases/release-0.5.0-en.md +2 -0
- package/docs/releases/release-0.5.1-ch.md +2 -0
- package/docs/releases/release-0.5.1-en.md +2 -0
- package/docs/releases/release-0.5.2-ch.md +2 -0
- package/docs/releases/release-0.5.2-en.md +2 -0
- package/docs/releases/release-0.5.3-ch.md +2 -0
- package/docs/releases/release-0.5.3-en.md +2 -0
- package/docs/releases/release-0.6.0-ch.md +2 -0
- package/docs/releases/release-0.6.0-en.md +2 -0
- package/docs/releases/release-0.6.1-ch.md +2 -0
- package/docs/releases/release-0.6.1-en.md +2 -0
- package/docs/releases/release-0.7.0-ch.md +86 -0
- package/docs/releases/release-0.7.0-en.md +86 -0
- package/docs/releases/release-0.8.0-ch.md +126 -0
- package/docs/releases/release-0.8.0-en.md +126 -0
- package/examples/component-package/LICENSE +21 -0
- package/examples/component-package/NOTICES.md +12 -0
- package/examples/component-package/README-ch.md +101 -0
- package/examples/component-package/README.md +133 -0
- package/examples/component-package/package.json +35 -0
- package/examples/component-package/sample/document.reactive.md +14 -0
- package/examples/component-package/scripts/build-export.mjs +44 -0
- package/examples/component-package/scripts/build.mjs +130 -0
- package/examples/component-package/scripts/verify.mjs +257 -0
- package/examples/component-package/src/assets/notice.svg +4 -0
- package/examples/component-package/src/component.css +40 -0
- package/examples/component-package/src/components.tsx +105 -0
- package/examples/component-package/src/harness.tsx +34 -0
- package/examples/component-package/src/manifests.ts +71 -0
- package/examples/component-package/src/node-entry.ts +18 -0
- package/examples/component-package/src/sample.ts +4 -0
- package/examples/component-package/src/theme.css +44 -0
- package/examples/component-package/src/theme.ts +22 -0
- package/examples/component-package/tsconfig.json +15 -0
- package/examples/conformance/README-ch.md +55 -0
- package/examples/conformance/README.md +2 -0
- package/examples/conformance/local-draft-3.json +296 -0
- package/examples/game-2048-package/LICENSE +21 -0
- package/examples/game-2048-package/NOTICES.md +11 -0
- package/examples/game-2048-package/README-ch.md +97 -0
- package/examples/game-2048-package/README.md +102 -0
- package/examples/game-2048-package/package.json +35 -0
- package/examples/game-2048-package/sample/document.reactive.md +17 -0
- package/examples/game-2048-package/scripts/build-export.mjs +44 -0
- package/examples/game-2048-package/scripts/build.mjs +130 -0
- package/examples/game-2048-package/scripts/verify.mjs +180 -0
- package/examples/game-2048-package/src/component.css +161 -0
- package/examples/game-2048-package/src/components.tsx +326 -0
- package/examples/game-2048-package/src/game-engine.ts +228 -0
- package/examples/game-2048-package/src/harness.tsx +34 -0
- package/examples/game-2048-package/src/manifest.ts +85 -0
- package/examples/game-2048-package/src/node-entry.ts +30 -0
- package/examples/game-2048-package/src/sample.ts +4 -0
- package/examples/game-2048-package/tsconfig.json +15 -0
- package/examples/integration/README-ch.md +63 -0
- package/examples/integration/README.md +17 -1
- package/examples/integration/extension-sdk/README-ch.md +24 -0
- package/examples/integration/extension-sdk/README.md +24 -0
- package/examples/integration/extension-sdk/advanced-standalone.ts +6 -0
- package/examples/integration/extension-sdk/advanced.tsx +101 -0
- package/examples/integration/extension-sdk/env.d.ts +2 -0
- package/examples/integration/extension-sdk/extensions.tsx +97 -0
- package/examples/integration/extension-sdk/index.html +3 -0
- package/examples/integration/extension-sdk/main.tsx +10 -0
- package/examples/integration/extension-sdk/package.json +6 -0
- package/examples/integration/extension-sdk/standalone.ts +7 -0
- package/examples/integration/extension-sdk/tsconfig.json +8 -0
- package/examples/integration/react-comprehensive/index.html +12 -0
- package/examples/integration/react-comprehensive/main.jsx +123 -0
- package/examples/integration/react-comprehensive/package.json +18 -0
- package/examples/local/README-ch.md +76 -0
- package/examples/local/README.md +4 -2
- package/examples/local/scenarios/blog-zh.reactive.md +71 -0
- package/examples/local/scenarios/blog.reactive.md +71 -0
- package/examples/local/scenarios/classroom-zh.reactive.md +97 -0
- package/examples/local/scenarios/classroom.reactive.md +97 -0
- package/examples/local/scenarios/proposal-zh.reactive.md +79 -0
- package/examples/local/scenarios/proposal.reactive.md +79 -0
- package/examples/local/scenarios/survey-zh.reactive.md +74 -0
- package/examples/local/scenarios/survey.reactive.md +74 -0
- package/examples/local/showcase/README-ch.md +22 -0
- package/examples/local/showcase/README.md +9 -3
- package/examples/local/showcase/features.reactive.md +637 -0
- package/examples/local/showcase/zh/features.reactive.md +637 -0
- package/examples/sci-fi-theme/README-ch.md +131 -0
- package/examples/sci-fi-theme/README.md +146 -0
- package/examples/sci-fi-theme/demo/demo.css +532 -0
- package/examples/sci-fi-theme/demo/document.reactive.md +185 -0
- package/examples/sci-fi-theme/demo/index.html +13 -0
- package/examples/sci-fi-theme/demo/main.tsx +180 -0
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -0
- package/examples/sci-fi-theme/docs/design-system.md +474 -0
- package/examples/sci-fi-theme/package.json +27 -0
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -0
- package/examples/sci-fi-theme/src/components.css +1460 -0
- package/examples/sci-fi-theme/src/index.ts +6 -0
- package/examples/sci-fi-theme/src/sci-fi.css +5 -0
- package/examples/sci-fi-theme/src/theme.ts +37 -0
- package/examples/sci-fi-theme/src/tokens.css +408 -0
- package/examples/sci-fi-theme/tsconfig.json +20 -0
- package/examples/sci-fi-theme/vite.config.ts +24 -0
- package/examples/tetris-package/LICENSE +21 -0
- package/examples/tetris-package/NOTICES.md +11 -0
- package/examples/tetris-package/README-ch.md +91 -0
- package/examples/tetris-package/README.md +95 -0
- package/examples/tetris-package/package.json +35 -0
- package/examples/tetris-package/sample/document.reactive.md +16 -0
- package/examples/tetris-package/scripts/build-export.mjs +44 -0
- package/examples/tetris-package/scripts/build.mjs +130 -0
- package/examples/tetris-package/scripts/verify.mjs +173 -0
- package/examples/tetris-package/src/component.css +145 -0
- package/examples/tetris-package/src/components.tsx +334 -0
- package/examples/tetris-package/src/harness.tsx +34 -0
- package/examples/tetris-package/src/manifests.ts +93 -0
- package/examples/tetris-package/src/node-entry.ts +16 -0
- package/examples/tetris-package/src/sample.ts +4 -0
- package/examples/tetris-package/src/tetris-engine.ts +325 -0
- package/examples/tetris-package/tsconfig.json +15 -0
- package/package.json +98 -44
- package/dist-library/compiler-Cm3ppMxG.js +0 -46044
- package/dist-library/react-Bh7_oxZp.js +0 -59655
- package/dist-library/reactive-md-editor.css +0 -2
- package/dist-library/reactive-md-editor.js +0 -3853
- package/dist-library/runtime-DlFYQ4s_.js +0 -498
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +0 -7
- package/dist-library/types/editor/editor-toolbar.d.ts +0 -24
- package/dist-library/types/editor/editor-view-bar.d.ts +0 -11
- package/dist-library/types/editor/extended-native-components.d.ts +0 -58
- package/dist-library/types/editor/index.d.ts +0 -9
- package/dist-library/types/editor/locale.d.ts +0 -13
- package/dist-library/types/editor/source-authoring.d.ts +0 -59
- package/dist-library/types/editor/types.d.ts +0 -48
- package/dist-library/types/editor/use-gutter-metrics.d.ts +0 -5
- package/dist-library/types/editor/use-source-history.d.ts +0 -16
- package/dist-library/types/local/compiler.d.ts +0 -4
- package/dist-library/types/local/math.d.ts +0 -48
- package/dist-library/types/local/options.d.ts +0 -36
- package/dist-library/types/local/parser.d.ts +0 -13
- package/dist-library/types/local/render-types.d.ts +0 -27
- package/dist-library/types/local/runtime.d.ts +0 -2
- package/dist-library/types/local/schema.d.ts +0 -77
- package/dist-library/types/local/types.d.ts +0 -263
- package/dist-library/types/local/visuals.d.ts +0 -12
- package/dist-library/types/local/worker.d.ts +0 -98
- package/docs/development/performance-ch.md +0 -76
- package/docs/development/performance-en.md +0 -76
- /package/dist-library/types/{editor → authoring}/command-types.d.ts +0 -0
- /package/dist-library/types/{editor → authoring}/editor-commands.d.ts +0 -0
- /package/dist-library/types/local/{locale.d.ts → contracts/locale.d.ts} +0 -0
- /package/dist-library/types/local/{collection-functions.d.ts → evaluation/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/{data-functions.d.ts → evaluation/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/{dates.d.ts → evaluation/dates.d.ts} +0 -0
- /package/dist-library/types/local/{formatting.d.ts → evaluation/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{html-names.d.ts → html/html-names.d.ts} +0 -0
- /package/dist-library/types/local/{text-length.d.ts → source/text-length.d.ts} +0 -0
- /package/dist-library/types/local/{colors.d.ts → theme/colors.d.ts} +0 -0
- /package/dist-library/types/local/{code-block.d.ts → widgets/code-block.d.ts} +0 -0
- /package/dist-library/types/local/{code-languages.d.ts → widgets/code-languages.d.ts} +0 -0
- /package/dist-library/types/local/{diagram-layout.d.ts → widgets/diagram-layout.d.ts} +0 -0
- /package/dist-library/types/local/{image-view.d.ts → widgets/image-view.d.ts} +0 -0
- /package/dist-library/types/local/{math-view.d.ts → widgets/math-view.d.ts} +0 -0
- /package/dist-library/types/local/{table-surface.d.ts → widgets/table-surface.d.ts} +0 -0
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
import { D as e, G as t, W as n, k as r, q as i, rt as a, z as o } from "./identity-MYJXKSkB.js";
|
|
2
|
+
import { f as s, l as c, u as l } from "./config-validation-DXTynAw7.js";
|
|
3
|
+
import { w as u } from "./validation-W-bmny-x.js";
|
|
4
|
+
import { a as d, c as f, l as p, o as m, s as h } from "./parser-standard-DlCk7sLo.js";
|
|
5
|
+
import { s as ee, u as g } from "./registry-B9Jc3FVe.js";
|
|
6
|
+
import { n as _ } from "./options-CX5m5n-J.js";
|
|
7
|
+
import { t as v } from "./runtime-C-sbfpOX.js";
|
|
8
|
+
import { C as y, u as te, w as ne } from "./component-state-Cq2K5gkS.js";
|
|
9
|
+
import { i as re, t as ie } from "./resources-BGt8mpDA.js";
|
|
10
|
+
// src/local/runtime/state.ts
|
|
11
|
+
var b = "reactive-md-state/v1", x = 1048576, S = /^fnv1a32:[0-9a-f]{8}$/, C = /* @__PURE__ */ new Set([
|
|
12
|
+
"format",
|
|
13
|
+
"syntax",
|
|
14
|
+
"sourceDigest",
|
|
15
|
+
"parameters",
|
|
16
|
+
"generator"
|
|
17
|
+
]), w = /* @__PURE__ */ new Set(["name", "version"]), ae = new TextEncoder();
|
|
18
|
+
function T(e, t) {
|
|
19
|
+
return {
|
|
20
|
+
code: e,
|
|
21
|
+
message: t.length > 2e3 ? `${t.slice(0, a - 1)}…` : t,
|
|
22
|
+
severity: "error",
|
|
23
|
+
range: {
|
|
24
|
+
start: 0,
|
|
25
|
+
end: 0
|
|
26
|
+
},
|
|
27
|
+
line: 1,
|
|
28
|
+
column: 1
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function E(e, t, n) {
|
|
32
|
+
e.length < 100 && e.push(T(t, n));
|
|
33
|
+
}
|
|
34
|
+
function D(e) {
|
|
35
|
+
return e instanceof Error ? e.message : String(e);
|
|
36
|
+
}
|
|
37
|
+
function O(e) {
|
|
38
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
39
|
+
let n = e.charCodeAt(t);
|
|
40
|
+
if (n >= 55296 && n <= 56319) {
|
|
41
|
+
let n = e.charCodeAt(t + 1);
|
|
42
|
+
if (n >= 56320 && n <= 57343) {
|
|
43
|
+
t += 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
return !1;
|
|
47
|
+
}
|
|
48
|
+
if (n >= 56320 && n <= 57343) return !1;
|
|
49
|
+
}
|
|
50
|
+
return !0;
|
|
51
|
+
}
|
|
52
|
+
function k(e) {
|
|
53
|
+
if (typeof e == "string") return O(e) ? {
|
|
54
|
+
ok: !0,
|
|
55
|
+
value: e
|
|
56
|
+
} : {
|
|
57
|
+
ok: !1,
|
|
58
|
+
message: "contains malformed Unicode."
|
|
59
|
+
};
|
|
60
|
+
if (typeof e == "number") return Number.isFinite(e) ? {
|
|
61
|
+
ok: !0,
|
|
62
|
+
value: e
|
|
63
|
+
} : {
|
|
64
|
+
ok: !1,
|
|
65
|
+
message: "must be a finite number."
|
|
66
|
+
};
|
|
67
|
+
if (typeof e == "boolean" || e === null) return {
|
|
68
|
+
ok: !0,
|
|
69
|
+
value: e
|
|
70
|
+
};
|
|
71
|
+
if (Array.isArray(e)) {
|
|
72
|
+
let t = [], n = e.length === 0 ? "string" : typeof e[0];
|
|
73
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
74
|
+
let i = e[r];
|
|
75
|
+
if (n === "string" && typeof i == "string") {
|
|
76
|
+
if (!O(i)) return {
|
|
77
|
+
ok: !1,
|
|
78
|
+
message: "contains malformed Unicode."
|
|
79
|
+
};
|
|
80
|
+
t.push(i);
|
|
81
|
+
} else if (n === "number" && typeof i == "number" && Number.isFinite(i)) t.push(i);
|
|
82
|
+
else return {
|
|
83
|
+
ok: !1,
|
|
84
|
+
message: "must be an array of strings or finite numbers of one kind."
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
ok: !0,
|
|
89
|
+
value: Object.freeze(t)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
ok: !1,
|
|
94
|
+
message: "must be a string, finite number, boolean, null or homogeneous primitive array."
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function A(e) {
|
|
98
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
99
|
+
let t = Object.getPrototypeOf(e);
|
|
100
|
+
return t === Object.prototype || t === null;
|
|
101
|
+
}
|
|
102
|
+
function j(e) {
|
|
103
|
+
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
104
|
+
}
|
|
105
|
+
function M(e) {
|
|
106
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
107
|
+
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
108
|
+
if (!O(e.name) || !O(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
109
|
+
return Object.freeze({
|
|
110
|
+
name: e.name,
|
|
111
|
+
version: e.version
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function N(e) {
|
|
115
|
+
return typeof e == "string" ? `"${e.length > 48 ? `${e.slice(0, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
116
|
+
}
|
|
117
|
+
function P(e, t) {
|
|
118
|
+
return e.length > t ? e.length : ae.encode(e).byteLength;
|
|
119
|
+
}
|
|
120
|
+
function oe(e, t) {
|
|
121
|
+
let n;
|
|
122
|
+
try {
|
|
123
|
+
let t = JSON.stringify(e);
|
|
124
|
+
if (typeof t != "string") return null;
|
|
125
|
+
n = t;
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return P(n, t);
|
|
130
|
+
}
|
|
131
|
+
function se(e) {
|
|
132
|
+
if (e === void 0) return x;
|
|
133
|
+
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
134
|
+
let { maxLength: t } = e;
|
|
135
|
+
if (t === void 0) return x;
|
|
136
|
+
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
137
|
+
return t;
|
|
138
|
+
}
|
|
139
|
+
function F(e, t, n) {
|
|
140
|
+
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
141
|
+
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
142
|
+
let r = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), i = new Set(r), a = /* @__PURE__ */ new Map();
|
|
143
|
+
for (let n of Object.keys(t)) {
|
|
144
|
+
if (Object.hasOwn(e.computations ?? {}, n)) continue;
|
|
145
|
+
if (n.startsWith("@")) {
|
|
146
|
+
if (!Object.hasOwn(e.bindings, n)) throw Error(`Cannot persist parameter "${n}": it is not a binding of this document.`);
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (!i.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
|
|
150
|
+
let r = k(t[n]);
|
|
151
|
+
if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
|
|
152
|
+
a.set(n, r.value);
|
|
153
|
+
}
|
|
154
|
+
let o = {};
|
|
155
|
+
for (let e of r) {
|
|
156
|
+
if (!a.has(e)) throw Error(`Cannot persist the document: parameter "${e}" is missing from the supplied state.`);
|
|
157
|
+
o[e] = a.get(e);
|
|
158
|
+
}
|
|
159
|
+
let s = {
|
|
160
|
+
format: b,
|
|
161
|
+
syntax: u,
|
|
162
|
+
sourceDigest: y(e.source),
|
|
163
|
+
parameters: o
|
|
164
|
+
};
|
|
165
|
+
return n !== void 0 && (s.generator = M(n)), j(s);
|
|
166
|
+
}
|
|
167
|
+
function ce(e, t) {
|
|
168
|
+
let n = [], r = (e, t) => E(n, e, t), i = e;
|
|
169
|
+
if (typeof e == "string") {
|
|
170
|
+
if (P(e, t) > t) return {
|
|
171
|
+
ok: !1,
|
|
172
|
+
diagnostics: [T("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
173
|
+
};
|
|
174
|
+
if (!O(e)) return {
|
|
175
|
+
ok: !1,
|
|
176
|
+
diagnostics: [T("local.state.utf", "The state payload contains malformed Unicode.")]
|
|
177
|
+
};
|
|
178
|
+
try {
|
|
179
|
+
i = JSON.parse(e);
|
|
180
|
+
} catch (e) {
|
|
181
|
+
return {
|
|
182
|
+
ok: !1,
|
|
183
|
+
diagnostics: [T("local.state.json", `The state payload is not valid JSON: ${D(e)}`)]
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
let n = oe(e, t);
|
|
188
|
+
if (n === null) return {
|
|
189
|
+
ok: !1,
|
|
190
|
+
diagnostics: [T("local.state.shape", "The state payload must be a JSON object.")]
|
|
191
|
+
};
|
|
192
|
+
if (n > t) return {
|
|
193
|
+
ok: !1,
|
|
194
|
+
diagnostics: [T("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (!A(i)) return {
|
|
198
|
+
ok: !1,
|
|
199
|
+
diagnostics: [T("local.state.shape", "The state payload must be a JSON object.")]
|
|
200
|
+
};
|
|
201
|
+
Object.getOwnPropertySymbols(i).length > 0 && r("local.state.shape", "The state payload cannot use symbol keys.");
|
|
202
|
+
for (let e of Object.keys(i)) C.has(e) || r("local.state.key", `Unknown top-level state key "${e}".`);
|
|
203
|
+
let a = i.format;
|
|
204
|
+
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${N(a)}; expected "${b}".`);
|
|
205
|
+
let o = i.syntax;
|
|
206
|
+
o !== "local-draft-3" && r("local.state.syntax", `Unsupported state syntax ${N(o)}; expected "${u}".`);
|
|
207
|
+
let s = i.sourceDigest;
|
|
208
|
+
typeof s == "string" && S.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
209
|
+
let c = {}, l = i.parameters;
|
|
210
|
+
if (!A(l)) r("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
211
|
+
else for (let e of Object.keys(l).sort()) {
|
|
212
|
+
if (e === "__proto__") {
|
|
213
|
+
r("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (e.startsWith("@")) {
|
|
217
|
+
r("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
let t = k(l[e]);
|
|
221
|
+
t.ok ? c[e] = t.value : r("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
|
|
222
|
+
}
|
|
223
|
+
let d;
|
|
224
|
+
if (Object.hasOwn(i, "generator")) {
|
|
225
|
+
let e = i.generator;
|
|
226
|
+
if (!A(e)) r("local.state.generator", "generator must be an object with string name and version.");
|
|
227
|
+
else {
|
|
228
|
+
for (let t of Object.keys(e)) w.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.") : !O(e.name) || !O(e.version) ? r("local.state.utf", "generator contains malformed Unicode.") : d = Object.freeze({
|
|
230
|
+
name: e.name,
|
|
231
|
+
version: e.version
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (n.length) return {
|
|
236
|
+
ok: !1,
|
|
237
|
+
diagnostics: n
|
|
238
|
+
};
|
|
239
|
+
let f = {
|
|
240
|
+
format: b,
|
|
241
|
+
syntax: u,
|
|
242
|
+
sourceDigest: s,
|
|
243
|
+
parameters: c
|
|
244
|
+
};
|
|
245
|
+
return d && (f.generator = d), {
|
|
246
|
+
ok: !0,
|
|
247
|
+
file: j(f)
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function I(e, t) {
|
|
251
|
+
let n = se(t);
|
|
252
|
+
try {
|
|
253
|
+
return ce(e, n);
|
|
254
|
+
} catch (e) {
|
|
255
|
+
return {
|
|
256
|
+
ok: !1,
|
|
257
|
+
diagnostics: [T("local.state.invalid", `Cannot read the local state: ${D(e)}`)]
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function le(e) {
|
|
262
|
+
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
263
|
+
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
264
|
+
};
|
|
265
|
+
return n(e.nodes), t;
|
|
266
|
+
}
|
|
267
|
+
function L(e) {
|
|
268
|
+
let t = le(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
269
|
+
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
270
|
+
let e = t.get(i);
|
|
271
|
+
if (!e) continue;
|
|
272
|
+
let o = {
|
|
273
|
+
node: e,
|
|
274
|
+
slots: []
|
|
275
|
+
};
|
|
276
|
+
for (let [t, r] of Object.entries(a)) o.slots.push({
|
|
277
|
+
slot: t,
|
|
278
|
+
key: r
|
|
279
|
+
}), r.startsWith("@") || n.set(r, {
|
|
280
|
+
node: e,
|
|
281
|
+
slot: t
|
|
282
|
+
});
|
|
283
|
+
o.slots.length && r.push(o);
|
|
284
|
+
}
|
|
285
|
+
let i = [];
|
|
286
|
+
for (let [r, a] of Object.entries(e.bindings)) {
|
|
287
|
+
if (r.startsWith("@")) continue;
|
|
288
|
+
let e = n.get(r);
|
|
289
|
+
if (e) {
|
|
290
|
+
i.push({
|
|
291
|
+
key: r,
|
|
292
|
+
binding: a,
|
|
293
|
+
node: e.node,
|
|
294
|
+
slot: e.slot
|
|
295
|
+
});
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
let o = a.owner && t.has(a.owner) ? a.owner : a.nodeIds.find((e) => t.has(e));
|
|
299
|
+
i.push({
|
|
300
|
+
key: r,
|
|
301
|
+
binding: a,
|
|
302
|
+
node: o ? t.get(o) : void 0
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
plans: i,
|
|
307
|
+
groups: r
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function R(e, t, n) {
|
|
311
|
+
let r = [];
|
|
312
|
+
for (let i of t.plans) i.slot === void 0 && Object.hasOwn(n, i.key) && (i.node ? Object.is(e.get(i.node), n[i.key]) || r.push(...e.set(i.node, n[i.key])) : r.push(T("local.state.document", `The document has no component for parameter "${i.key}".`)));
|
|
313
|
+
for (let i of t.groups) {
|
|
314
|
+
let t = {}, a = !1;
|
|
315
|
+
for (let { slot: e, key: r } of i.slots) Object.hasOwn(n, r) && (t[e] = n[r], a = !0);
|
|
316
|
+
a && r.push(...e.setMany(i.node, t));
|
|
317
|
+
}
|
|
318
|
+
return r;
|
|
319
|
+
}
|
|
320
|
+
function ue(e, t) {
|
|
321
|
+
let n = e.snapshot(), r = {};
|
|
322
|
+
for (let e of t) {
|
|
323
|
+
let t = n.state[e];
|
|
324
|
+
r[e] = Array.isArray(t) ? Object.freeze([...t]) : t;
|
|
325
|
+
}
|
|
326
|
+
return Object.freeze(r);
|
|
327
|
+
}
|
|
328
|
+
function z(e, t, n, r) {
|
|
329
|
+
let i = I(t, r);
|
|
330
|
+
if (!i.ok) return i;
|
|
331
|
+
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
332
|
+
ok: !1,
|
|
333
|
+
diagnostics: [T("local.state.document", "resolveLocalState requires a compiled local document.")]
|
|
334
|
+
};
|
|
335
|
+
if (i.file.syntax !== "local-draft-3") return {
|
|
336
|
+
ok: !1,
|
|
337
|
+
diagnostics: [T("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${u}".`)]
|
|
338
|
+
};
|
|
339
|
+
if (i.file.sourceDigest !== y(e.source)) return {
|
|
340
|
+
ok: !1,
|
|
341
|
+
diagnostics: [T("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
342
|
+
};
|
|
343
|
+
let a = L(e), o = new Set(a.plans.map((e) => e.key)), s = [];
|
|
344
|
+
for (let e of Object.keys(i.file.parameters)) o.has(e) || E(s, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
345
|
+
for (let e of o) Object.hasOwn(i.file.parameters, e) || E(s, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
346
|
+
if (s.length) return {
|
|
347
|
+
ok: !1,
|
|
348
|
+
diagnostics: s
|
|
349
|
+
};
|
|
350
|
+
let c;
|
|
351
|
+
try {
|
|
352
|
+
c = v(e);
|
|
353
|
+
} catch (e) {
|
|
354
|
+
return {
|
|
355
|
+
ok: !1,
|
|
356
|
+
diagnostics: [T("local.state.document", `Cannot validate this document: ${D(e)}`)]
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
if (n) {
|
|
361
|
+
let e = R(c, a, n);
|
|
362
|
+
if (e.length) return {
|
|
363
|
+
ok: !1,
|
|
364
|
+
diagnostics: e
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
let e = R(c, a, i.file.parameters);
|
|
368
|
+
if (e.length) return {
|
|
369
|
+
ok: !1,
|
|
370
|
+
diagnostics: e
|
|
371
|
+
};
|
|
372
|
+
let t = [...o].sort();
|
|
373
|
+
return {
|
|
374
|
+
ok: !0,
|
|
375
|
+
file: i.file,
|
|
376
|
+
state: ue(c, t)
|
|
377
|
+
};
|
|
378
|
+
} finally {
|
|
379
|
+
c.dispose();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function B(e, t, n) {
|
|
383
|
+
try {
|
|
384
|
+
return z(e, t, void 0, n);
|
|
385
|
+
} catch (e) {
|
|
386
|
+
return {
|
|
387
|
+
ok: !1,
|
|
388
|
+
diagnostics: [T("local.state.invalid", `Cannot resolve the local state: ${D(e)}`)]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function V(e, t, n) {
|
|
393
|
+
let r;
|
|
394
|
+
try {
|
|
395
|
+
r = z(e.document, t, e.snapshot().state, n);
|
|
396
|
+
} catch (e) {
|
|
397
|
+
return [T("local.state.invalid", `Cannot apply the local state: ${D(e)}`)];
|
|
398
|
+
}
|
|
399
|
+
if (!r.ok) return r.diagnostics;
|
|
400
|
+
let i = L(e.document);
|
|
401
|
+
try {
|
|
402
|
+
return R(e, i, r.state);
|
|
403
|
+
} catch (e) {
|
|
404
|
+
return [T("local.state.invalid", `Cannot apply the local state: ${D(e)}`)];
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function de(e, t) {
|
|
408
|
+
return F(e.document, e.getParameters(), t);
|
|
409
|
+
}
|
|
410
|
+
function fe(e, t, n) {
|
|
411
|
+
let r = I(t, n);
|
|
412
|
+
return r.ok ? V(e, r.file, n) : r.diagnostics;
|
|
413
|
+
}
|
|
414
|
+
function pe(e) {
|
|
415
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
416
|
+
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
417
|
+
let t = Object.create(null);
|
|
418
|
+
for (let n of Object.keys(e.parameters).sort()) {
|
|
419
|
+
if (n === "__proto__" || n.startsWith("@")) throw TypeError(`Cannot serialize parameter "${n}".`);
|
|
420
|
+
let r = k(e.parameters[n]);
|
|
421
|
+
if (!r.ok) throw TypeError(`Cannot serialize parameter "${n}": the value ${r.message}`);
|
|
422
|
+
t[n] = r.value;
|
|
423
|
+
}
|
|
424
|
+
let n = {
|
|
425
|
+
format: e.format,
|
|
426
|
+
syntax: e.syntax,
|
|
427
|
+
sourceDigest: e.sourceDigest,
|
|
428
|
+
parameters: t
|
|
429
|
+
};
|
|
430
|
+
if (e.generator !== void 0) {
|
|
431
|
+
let t = M(e.generator);
|
|
432
|
+
n.generator = {
|
|
433
|
+
name: t.name,
|
|
434
|
+
version: t.version
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
return JSON.stringify(n);
|
|
438
|
+
}
|
|
439
|
+
// src/local/configuration/portable-options.ts
|
|
440
|
+
function H(e) {
|
|
441
|
+
if (e === void 0) return;
|
|
442
|
+
let t = _(e);
|
|
443
|
+
if (!t.ok) throw TypeError(`Invalid portable compile options: ${t.message}`);
|
|
444
|
+
return {
|
|
445
|
+
enableCss: t.html.enableCss,
|
|
446
|
+
enableJavaScript: t.html.enableJavaScript,
|
|
447
|
+
enableExtendedHtml: t.html.enableExtendedHtml,
|
|
448
|
+
...Object.hasOwn(e, "strict") && e.strict !== void 0 ? { strict: t.strict } : {},
|
|
449
|
+
...e.markdownBreaks === void 0 ? {} : { markdownBreaks: t.markdownBreaks },
|
|
450
|
+
...e.config === void 0 ? t.hostComponents.length ? { hostComponents: t.hostComponents } : {} : { config: g(e.config) },
|
|
451
|
+
...e.limits === void 0 ? {} : { limits: {
|
|
452
|
+
...e.limits.maxSyntaxNodes === void 0 ? {} : { maxSyntaxNodes: t.maxSyntaxNodes },
|
|
453
|
+
...e.limits.maxParseWork === void 0 ? {} : { maxParseWork: t.maxParseWork },
|
|
454
|
+
...e.limits.maxMarkdownDepth === void 0 ? {} : { maxMarkdownDepth: t.maxMarkdownDepth }
|
|
455
|
+
} }
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
// src/export/restoration.ts
|
|
459
|
+
var me = i;
|
|
460
|
+
function U(e) {
|
|
461
|
+
return i(JSON.stringify([
|
|
462
|
+
e.id,
|
|
463
|
+
e.name,
|
|
464
|
+
e.version,
|
|
465
|
+
e.protocol,
|
|
466
|
+
e.colorSchemes,
|
|
467
|
+
e.css.map(({ id: e, css: t }) => [e, t])
|
|
468
|
+
]));
|
|
469
|
+
}
|
|
470
|
+
function he(e, t) {
|
|
471
|
+
let n = g(t), r = c(n);
|
|
472
|
+
return Object.freeze({
|
|
473
|
+
protocol: "reactive-md-bundle/v1",
|
|
474
|
+
sdkVersion: o,
|
|
475
|
+
configKey: n.key,
|
|
476
|
+
scriptDigest: i(e),
|
|
477
|
+
assembly: r,
|
|
478
|
+
seal: l(n),
|
|
479
|
+
themes: Object.freeze(n.themes.map((e) => Object.freeze({
|
|
480
|
+
id: e.id,
|
|
481
|
+
name: e.name,
|
|
482
|
+
version: e.version,
|
|
483
|
+
digest: U(e)
|
|
484
|
+
})))
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
function W(t, n, r, a = []) {
|
|
488
|
+
let s = g(n), l = /* @__PURE__ */ new Set(), u = [...t.nodes];
|
|
489
|
+
for (; u.length;) {
|
|
490
|
+
let e = u.pop();
|
|
491
|
+
(e.type === "component" || e.type === "hostComponent") && e.name && l.add(e.name), e.children && u.push(...e.children);
|
|
492
|
+
}
|
|
493
|
+
let d = s.registry.filter((e) => l.has(e.name)).map((t) => Object.freeze({
|
|
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({
|
|
500
|
+
id: e.id,
|
|
501
|
+
name: e.name,
|
|
502
|
+
version: e.version,
|
|
503
|
+
digest: U(e)
|
|
504
|
+
}));
|
|
505
|
+
return Object.freeze({
|
|
506
|
+
protocol: "reactive-md-restore/v1",
|
|
507
|
+
sdk: `^${o}`,
|
|
508
|
+
configKey: s.key,
|
|
509
|
+
sourceDigest: i(t.source),
|
|
510
|
+
target: r,
|
|
511
|
+
components: Object.freeze(d),
|
|
512
|
+
themes: Object.freeze(f),
|
|
513
|
+
assembly: c(s),
|
|
514
|
+
resources: Object.freeze(a.map((e) => Object.freeze({
|
|
515
|
+
id: e.id,
|
|
516
|
+
digest: i(e.css)
|
|
517
|
+
})))
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
function G(e) {
|
|
521
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && [Object.prototype, null].includes(Object.getPrototypeOf(e));
|
|
522
|
+
}
|
|
523
|
+
function K(e) {
|
|
524
|
+
return typeof e == "string" && e.length > 0 && e.length <= 256;
|
|
525
|
+
}
|
|
526
|
+
function q(a, c) {
|
|
527
|
+
if (a === void 0) return [];
|
|
528
|
+
let l = [], u = (e, t) => l.push({
|
|
529
|
+
code: `local.extension.restore-${e}`,
|
|
530
|
+
message: t,
|
|
531
|
+
severity: "error",
|
|
532
|
+
range: {
|
|
533
|
+
start: 0,
|
|
534
|
+
end: 0
|
|
535
|
+
},
|
|
536
|
+
line: 1,
|
|
537
|
+
column: 1
|
|
538
|
+
});
|
|
539
|
+
try {
|
|
540
|
+
if (!G(a) || r(a) > 262144 || a.protocol !== "reactive-md-restore/v1" || !K(a.sdk) || !K(a.configKey) || !K(a.sourceDigest) || ![
|
|
541
|
+
"static",
|
|
542
|
+
"ssr",
|
|
543
|
+
"offline"
|
|
544
|
+
].includes(a.target) || !Array.isArray(a.components) || a.components.length > 192 || !Array.isArray(a.themes) || a.themes.length > 16 || !Array.isArray(a.resources) || a.resources.length > 128) return u("metadata", "Invalid or oversized restoration requirements."), l;
|
|
545
|
+
let d = /* @__PURE__ */ new Set([
|
|
546
|
+
"protocol",
|
|
547
|
+
"sdk",
|
|
548
|
+
"configKey",
|
|
549
|
+
"sourceDigest",
|
|
550
|
+
"target",
|
|
551
|
+
"components",
|
|
552
|
+
"themes",
|
|
553
|
+
"resources",
|
|
554
|
+
"assembly"
|
|
555
|
+
]);
|
|
556
|
+
Object.keys(a).some((e) => !d.has(e)) && u("metadata", "Unknown restoration requirement field.");
|
|
557
|
+
let f = c.config === void 0 ? ee() : g(c.config);
|
|
558
|
+
t(a.sdk) && n("0.7.0", a.sdk) || u("sdk", `SDK ${o} does not satisfy ${a.sdk}.`), s(f, a.configKey) || u("config", "The installed configuration differs from the exported configuration."), a.assembly !== void 0 && (G(a.assembly) && a.assembly.protocol === "reactive-md-assembly-seal/v1" && K(a.assembly.configKey) && s(f, a.assembly.configKey) || u("assembly", "The exported assembly identity is invalid or belongs to another configuration.")), i(c.source) !== a.sourceDigest && u("source", "The source differs from the exported source. Recompile before restoring state.");
|
|
559
|
+
let p = /* @__PURE__ */ new Set();
|
|
560
|
+
for (let r of a.components) {
|
|
561
|
+
if (!G(r) || ![
|
|
562
|
+
"id",
|
|
563
|
+
"name",
|
|
564
|
+
"version",
|
|
565
|
+
"range",
|
|
566
|
+
"digest"
|
|
567
|
+
].every((e) => K(r[e])) || !t(r.range) || p.has(r.id)) {
|
|
568
|
+
u("metadata", "Invalid or duplicate component restoration requirement.");
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
p.add(r.id);
|
|
572
|
+
let i = f.registry.find((e) => e.id === r.id);
|
|
573
|
+
if (!i) {
|
|
574
|
+
u("component-missing", `Required component ${r.id}@${r.version} is not installed.`);
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
n(i.version, r.range) || u("version", `Component ${r.id}@${i.version} does not satisfy ${r.range}.`), (i.version !== r.version || i.name !== r.name || e(i) !== r.digest) && u("contract", `Component ${r.id}@${r.version} differs from the installed contract. Recompile and validate state before upgrading.`);
|
|
578
|
+
let o = a.target === "offline" ? [
|
|
579
|
+
"interactive",
|
|
580
|
+
"static",
|
|
581
|
+
"offline"
|
|
582
|
+
] : [a.target];
|
|
583
|
+
for (let e of o) i.capabilities[e] || u("capability", `Component ${r.id} cannot render ${e}.`);
|
|
584
|
+
}
|
|
585
|
+
if (c.document) {
|
|
586
|
+
let e = W(c.document, f, a.target);
|
|
587
|
+
for (let t of e.components) p.has(t.id) || u("component-missing", `Used component ${t.id} is missing from restoration requirements.`);
|
|
588
|
+
}
|
|
589
|
+
p.clear();
|
|
590
|
+
for (let e of a.themes) {
|
|
591
|
+
if (!G(e) || ![
|
|
592
|
+
"id",
|
|
593
|
+
"name",
|
|
594
|
+
"version",
|
|
595
|
+
"digest"
|
|
596
|
+
].every((t) => K(e[t])) || p.has(e.id)) {
|
|
597
|
+
u("metadata", "Invalid or duplicate theme restoration requirement.");
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
p.add(e.id);
|
|
601
|
+
let t = f.themes.find((t) => t.id === e.id);
|
|
602
|
+
t && t.name === e.name && t.version === e.version && U(t) === e.digest || u("theme", `Required theme ${e.id}@${e.version} does not match the installed theme.`);
|
|
603
|
+
}
|
|
604
|
+
if (c.document) {
|
|
605
|
+
let e = f.themes.find((e) => e.name === c.document.theme);
|
|
606
|
+
e && !p.has(e.id) && u("theme", `Selected theme ${e.id} is missing from restoration requirements.`);
|
|
607
|
+
}
|
|
608
|
+
let m = ie(c.resources ?? []);
|
|
609
|
+
l.push(...m.diagnostics);
|
|
610
|
+
let h = new Map(m.resources.map((e) => [e.id, e.css]));
|
|
611
|
+
p.clear();
|
|
612
|
+
for (let e of a.resources) {
|
|
613
|
+
if (!G(e) || !K(e.id) || !K(e.digest) || p.has(e.id)) {
|
|
614
|
+
u("metadata", "Invalid or duplicate style restoration requirement.");
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
p.add(e.id);
|
|
618
|
+
let t = h.get(e.id);
|
|
619
|
+
t === void 0 ? u("resource-missing", `Required style resource ${e.id} is missing before state restoration.`) : i(t) !== e.digest && u("resource-digest", `Style resource ${e.id} differs from the exported content.`);
|
|
620
|
+
}
|
|
621
|
+
if (c.document) {
|
|
622
|
+
let e = W(c.document, f, a.target), t = new Set(e.components.map((e) => e.id)), n = f.registry.filter((e) => t.has(e.id)).flatMap((e) => e.styles ?? []);
|
|
623
|
+
n.push(...f.themes.filter((e) => e.name === c.document.theme).flatMap((e) => e.css.map((e) => e.id)));
|
|
624
|
+
for (let e of n) p.has(e) && h.has(e) || u("resource-missing", `Used style resource ${e} is required before state restoration.`);
|
|
625
|
+
}
|
|
626
|
+
} catch (e) {
|
|
627
|
+
u("metadata", e instanceof Error ? e.message : String(e));
|
|
628
|
+
}
|
|
629
|
+
return l;
|
|
630
|
+
}
|
|
631
|
+
// src/shareable.ts
|
|
632
|
+
var J = "reactive-md-html/v1", Y = "reactive-md-html/v2", ge = /^[A-Za-z][A-Za-z0-9_-]*$/, _e = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/, ve = /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/, ye = /[\u0000-\u001f\u007f-\u009f]/, X = 64, be = 41943040, xe = 4096;
|
|
633
|
+
function Z(e, t = !1) {
|
|
634
|
+
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
635
|
+
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
636
|
+
}
|
|
637
|
+
function Se(e) {
|
|
638
|
+
return e.replace(/<\/style/gi, "<\\/style");
|
|
639
|
+
}
|
|
640
|
+
function Ce(e) {
|
|
641
|
+
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
642
|
+
}
|
|
643
|
+
function Q(e) {
|
|
644
|
+
return Z(e, !0);
|
|
645
|
+
}
|
|
646
|
+
function $(e) {
|
|
647
|
+
let t = JSON.stringify(e);
|
|
648
|
+
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
649
|
+
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
650
|
+
switch (e) {
|
|
651
|
+
case "<": return "\\u003c";
|
|
652
|
+
case ">": return "\\u003e";
|
|
653
|
+
case "&": return "\\u0026";
|
|
654
|
+
case "\u2028": return "\\u2028";
|
|
655
|
+
default: return "\\u2029";
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
function we(e) {
|
|
660
|
+
return Array.isArray(e) ? e.slice() : e;
|
|
661
|
+
}
|
|
662
|
+
function Te(e) {
|
|
663
|
+
try {
|
|
664
|
+
return H(e);
|
|
665
|
+
} catch (e) {
|
|
666
|
+
throw TypeError(`createShareableHtml received invalid compileOptions: ${e instanceof Error ? e.message : String(e)}`);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function Ee(e) {
|
|
670
|
+
let t = [];
|
|
671
|
+
for (let n of e.childNodes) {
|
|
672
|
+
if (p.isElementNode(n)) {
|
|
673
|
+
let e = n.tagName.toLowerCase();
|
|
674
|
+
if (e === "script") continue;
|
|
675
|
+
Ee(e === "template" ? p.getTemplateContent(n) : n);
|
|
676
|
+
}
|
|
677
|
+
t.push(n);
|
|
678
|
+
}
|
|
679
|
+
e.childNodes = t;
|
|
680
|
+
}
|
|
681
|
+
function De(e, t, n) {
|
|
682
|
+
let r = !1;
|
|
683
|
+
for (let i of e.childNodes) if (p.isElementNode(i)) {
|
|
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;
|
|
696
|
+
}
|
|
697
|
+
De(i, t, n) && (r = !0);
|
|
698
|
+
}
|
|
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
|
+
}
|
|
713
|
+
function Ae(e, t) {
|
|
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) {
|
|
718
|
+
if (e === void 0) return;
|
|
719
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
720
|
+
let t = Object.entries(e);
|
|
721
|
+
if (t.length > X) throw RangeError(`images cannot contain more than ${X} entries.`);
|
|
722
|
+
let n = 0;
|
|
723
|
+
for (let [e, r] of t) {
|
|
724
|
+
if (!e || e.length > xe || ye.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
725
|
+
if (typeof r != "string" || !ve.test(r)) throw TypeError(`The image map for "${e}" must contain a base64 PNG, JPEG, GIF or WebP data URL.`);
|
|
726
|
+
if (n += r.length, n > be) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
727
|
+
}
|
|
728
|
+
return Object.fromEntries(t);
|
|
729
|
+
}
|
|
730
|
+
function Me(e, t) {
|
|
731
|
+
let n = B(e, t);
|
|
732
|
+
if (!n.ok) return n;
|
|
733
|
+
let r = {};
|
|
734
|
+
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
735
|
+
...i,
|
|
736
|
+
initial: we(n.state[t])
|
|
737
|
+
} : i;
|
|
738
|
+
let i = { ...e.initialState };
|
|
739
|
+
for (let [e, t] of Object.entries(n.state)) i[e] = we(t);
|
|
740
|
+
return {
|
|
741
|
+
ok: !0,
|
|
742
|
+
baseline: {
|
|
743
|
+
document: {
|
|
744
|
+
...e,
|
|
745
|
+
bindings: r,
|
|
746
|
+
initialState: i
|
|
747
|
+
},
|
|
748
|
+
state: n.state
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
var Ne = "\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";
|
|
753
|
+
function Pe(e) {
|
|
754
|
+
let t = e.targetId ?? "reactive-md-document";
|
|
755
|
+
if (!ge.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
756
|
+
let n = e.mode === "static" ? "static" : "interactive";
|
|
757
|
+
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
758
|
+
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
759
|
+
if (e.state.sourceDigest !== y(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
760
|
+
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
761
|
+
let r = Te(e.compileOptions), i = re(e.extensions, r?.config);
|
|
762
|
+
if (i.push(...q(e.restoration, {
|
|
763
|
+
config: r?.config,
|
|
764
|
+
source: e.source,
|
|
765
|
+
resources: e.resources
|
|
766
|
+
})), i.length) throw TypeError(i.map((e) => e.message).join(" "));
|
|
767
|
+
let a = _(r);
|
|
768
|
+
if (!a.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${a.message}`);
|
|
769
|
+
let o = a.htmlActive, s = e.documentId === void 0 ? void 0 : ne(e.documentId);
|
|
770
|
+
if (e.documentId !== void 0 && s === void 0) throw TypeError("createShareableHtml received an invalid documentId.");
|
|
771
|
+
let c;
|
|
772
|
+
if (e.randomSeed !== void 0) {
|
|
773
|
+
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
|
+
c = e.randomSeed;
|
|
775
|
+
}
|
|
776
|
+
let l;
|
|
777
|
+
if (e.componentState !== void 0) {
|
|
778
|
+
let t = te(e.componentState);
|
|
779
|
+
if (!t.ok || t.diagnostics.length > 0) {
|
|
780
|
+
let e = t.diagnostics.map((e) => e.message).join(" ");
|
|
781
|
+
throw TypeError(`createShareableHtml received an invalid component state${e ? `: ${e}` : "."}`);
|
|
782
|
+
}
|
|
783
|
+
l = t.document;
|
|
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));
|
|
794
|
+
}
|
|
795
|
+
let f = e.locale === "zh" ? "zh" : "en", p = f === "zh" ? "zh-CN" : "en", h = e.colorScheme === "light" || e.colorScheme === "dark" ? e.colorScheme : "auto", ee = e.assets === "omit" ? "omit" : "inline", g = e.generator ?? {
|
|
796
|
+
name: "reactive-md",
|
|
797
|
+
version: "unknown"
|
|
798
|
+
}, v = je(e.images), ie = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(v ?? {}).length), b = n === "interactive", x = {
|
|
799
|
+
version: e.restoration ? 2 : 1,
|
|
800
|
+
target: t,
|
|
801
|
+
source: e.source,
|
|
802
|
+
state: e.state,
|
|
803
|
+
locale: f,
|
|
804
|
+
colorScheme: h,
|
|
805
|
+
hydrate: !0,
|
|
806
|
+
...r === void 0 ? {} : { compileOptions: r },
|
|
807
|
+
...e.extensions === void 0 ? {} : { extensions: e.extensions },
|
|
808
|
+
...e.restoration === void 0 ? {} : {
|
|
809
|
+
restoration: e.restoration,
|
|
810
|
+
resources: e.resources ?? []
|
|
811
|
+
},
|
|
812
|
+
...v ? { images: v } : {},
|
|
813
|
+
...s === void 0 ? {} : { documentId: s },
|
|
814
|
+
...c === void 0 ? {} : { randomSeed: c },
|
|
815
|
+
...l === void 0 ? {} : { componentState: l }
|
|
816
|
+
}, S = Ae(b, o ? a.html : void 0), C = b ? `<script type="application/reactive-md+json" data-reactive-md-auto>${$(x)}<\/script>
|
|
817
|
+
<script>${Ce(e.runtimeScript)}<\/script>` : "", w = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${Z(e.notices)}</pre></template>` : "", ae = !b && e.extensions ? `<template id="reactive-md-extensions">${Z(JSON.stringify(e.extensions))}</template>` : "";
|
|
818
|
+
return `<!doctype html>
|
|
819
|
+
<html lang="${Z(_e.test(p) ? p : "en", !0)}">
|
|
820
|
+
<head>
|
|
821
|
+
<meta charset="utf-8">
|
|
822
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
823
|
+
<meta name="referrer" content="no-referrer">
|
|
824
|
+
<meta http-equiv="Content-Security-Policy" content="${Q(S)}">
|
|
825
|
+
<meta name="generator" content="${Q(`${g.name} ${g.version}`)}">
|
|
826
|
+
<meta name="reactive-md-html-format" content="${e.restoration ? Y : J}">
|
|
827
|
+
<meta name="reactive-md-syntax" content="${Q(e.state.syntax)}">
|
|
828
|
+
<meta name="reactive-md-output" content="${n}">
|
|
829
|
+
<meta name="reactive-md-state" content="${Q(e.state.sourceDigest)}">
|
|
830
|
+
<meta name="reactive-md-images" content="${ee}">
|
|
831
|
+
<meta name="reactive-md-image-count" content="${ie}">
|
|
832
|
+
<title>${Z(e.title || "Reactive MD document")}</title>
|
|
833
|
+
<style>${Se(e.css)}${Ne}</style>
|
|
834
|
+
</head>
|
|
835
|
+
<body class="reactive-md-export">
|
|
836
|
+
<div id="${t}" class="reactive-md-export-root">${u}</div>
|
|
837
|
+
${C}
|
|
838
|
+
${ae}
|
|
839
|
+
${w}
|
|
840
|
+
</body>
|
|
841
|
+
</html>
|
|
842
|
+
`;
|
|
843
|
+
}
|
|
844
|
+
export { I as _, $ as a, me as c, H as d, b as f, fe as g, de as h, Me as i, U as l, F as m, Y as n, he as o, V as p, Pe as r, W as s, J as t, q as u, B as v, pe as y };
|