reactive-md 0.9.0 → 0.9.2
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 +333 -306
- package/CHANGELOG.md +334 -307
- package/CONTRIBUTING-ch.md +22 -22
- package/CONTRIBUTING.md +22 -22
- package/README-ch.md +431 -431
- package/README-en.md +431 -431
- package/README.md +429 -429
- package/SECURITY-ch.md +83 -83
- package/SECURITY.md +83 -83
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -444
- package/cli/check.mjs +444 -444
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +323 -323
- package/cli/init.mjs +1577 -1577
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +65 -65
- package/cli/migrate.mjs +368 -368
- package/cli/package-loader.mjs +41 -41
- package/cli/package.mjs +211 -211
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-BuqgJZEY.js} +11 -11
- package/dist-library/LocalDocumentViewCore-DXE0I0Qc.js +9830 -0
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Ci_KzJ0q.js} +87 -67
- package/dist-library/{compile-LhpTKqCR.js → compile-Dx6Uw3D9.js} +11 -11
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-DDDdvuLy.js} +2618 -1846
- package/dist-library/compiler-dxLPB9Ym.js +86 -0
- package/dist-library/{component-state-BBJ08vML.js → component-state-BRwvTV0d.js} +15 -14
- package/dist-library/component-state-CwKX_SN5.js +763 -0
- package/dist-library/{config-BUo-8O5C.js → config-DXLvctiZ.js} +68 -66
- package/dist-library/config-validation-D3D7Dy2J.js +586 -0
- package/dist-library/{controls-BWiLLtBO.js → controls-DoZyLCrV.js} +2434 -2410
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-B1VFK9fd.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-8-3F15Jf.js} +69 -66
- package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
- package/dist-library/{display-lw3BT1TA.js → display-B_uutKkN.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → document-theme-C8J6UyNO.js} +241 -731
- package/dist-library/export-CIAIPBov.js +370 -0
- package/dist-library/{gallery-B8kSt1oI.js → gallery-Dv1rOvL0.js} +151 -147
- package/dist-library/html-Cr4CBwAH.js +758 -0
- package/dist-library/identity-BUx0Q_-d.js +40 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-9nx92u9c.js} +407 -143
- package/dist-library/layout-BBB2VF0S.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-DMZ5wd3t.js} +3 -3
- package/dist-library/observability-4KqXhIEU.js +421 -0
- package/dist-library/observability-core-Bcu7vpnl.js +24 -0
- package/dist-library/options-BBp9IcHm.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-K5xesGqy.js} +30 -29
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-CBA1-hdG.js} +3332 -3840
- package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
- package/dist-library/preset-core-DeZPA8IE.js +1298 -0
- package/dist-library/react-0DCh-Mar.js +7 -0
- package/dist-library/reactive-md-authoring.js +28 -30
- package/dist-library/reactive-md-build.js +99 -61
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +3 -2
- package/dist-library/reactive-md-default-preset.js +3 -2
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-preset.js +2 -2
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-observability.js +4 -0
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +3 -3
- package/dist-library/reactive-md-plugin-data.js +5 -5
- package/dist-library/reactive-md-plugin-diagram.js +4 -4
- package/dist-library/reactive-md-plugin-forms.js +4 -4
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +3 -3
- package/dist-library/reactive-md-plugin-network.js +119 -116
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-print.css +304 -304
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +11 -12
- package/dist-library/reactive-md-react.js +11 -12
- package/dist-library/reactive-md-runtime-browser.js +2 -1
- package/dist-library/reactive-md-runtime.js +4 -3
- package/dist-library/reactive-md-sdk.js +8 -7
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +5 -5
- package/dist-library/reactive-md.js +649 -373
- package/dist-library/{registry-05JiqmEp.js → registry-D6OGkOcX.js} +3 -3
- package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-B0x_w3s9.js} +71 -46
- package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
- package/dist-library/{runtime-CuOyRe9f.js → runtime-BpQdZmFI.js} +269 -263
- package/dist-library/{schema-C-AeByPp.js → schema-BryM_VRW.js} +14 -14
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-ChslheKs.js} +499 -158
- package/dist-library/{session-core-BGka5D1J.js → session-core-dxQCJBNa.js} +171 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-B8xMoGEa.js} +265 -297
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- 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-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- 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/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +7 -1
- package/dist-library/types/local/observability-codes.d.ts +2 -0
- package/dist-library/types/local/observability-core.d.ts +25 -0
- package/dist-library/types/local/observability-messages.d.ts +6 -0
- package/dist-library/types/local/observability.d.ts +43 -0
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +79 -5
- package/dist-library/types/local/types.d.ts +60 -16
- package/dist-library/types/observability.d.ts +7 -0
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-Ib5kSScP.js} +1 -1
- package/dist-library/types-daDo2c_w.js +3 -0
- package/dist-library/{validation-BlDL2uD9.js → validation-B3RI0xOk.js} +218 -200
- package/dist-library/version-DAxuGOG2.js +147 -0
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-_rcd5HUv.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-DkDhNdEZ.js} +24191 -24190
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +101 -94
- package/docs/README.md +101 -94
- package/docs/compatibility/api-stability-ch.md +25 -0
- package/docs/compatibility/api-stability-en.md +25 -0
- package/docs/compatibility/compatibility-ch.md +146 -129
- package/docs/compatibility/compatibility-en.md +146 -129
- package/docs/compatibility/compatibility-manifest.schema.json +161 -0
- package/docs/compatibility/deprecation-ch.md +21 -0
- package/docs/compatibility/deprecation-en.md +21 -0
- package/docs/compatibility/source-versioning-ch.md +162 -162
- package/docs/compatibility/source-versioning-en.md +162 -162
- package/docs/compatibility/support-matrix-ch.md +108 -0
- package/docs/compatibility/support-matrix-en.md +108 -0
- package/docs/development/component-development-ch.md +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +253 -253
- package/docs/development/component-development-reference-en.md +238 -238
- package/docs/development/component-protocol-ch.md +748 -748
- package/docs/development/component-protocol-en.md +750 -750
- package/docs/development/extension-tutorial-ch.md +308 -308
- package/docs/development/extension-tutorial-en.md +308 -308
- package/docs/development/performance-overview-ch.md +422 -422
- package/docs/development/performance-overview-en.md +422 -422
- package/docs/guides/local-guide-ch.md +532 -532
- package/docs/guides/local-guide-en.md +532 -532
- package/docs/integration/author-tools-ch.md +64 -64
- package/docs/integration/author-tools-en.md +64 -64
- package/docs/integration/compiler-ch.md +49 -47
- package/docs/integration/compiler-en.md +36 -34
- package/docs/integration/directory-discovery-en.md +1 -1
- package/docs/integration/editor-ch.md +295 -295
- package/docs/integration/editor-en.md +303 -303
- package/docs/integration/extension-sdk-ch.md +394 -394
- package/docs/integration/extension-sdk-en.md +379 -379
- package/docs/integration/local-integration-ch.md +646 -524
- package/docs/integration/local-integration-en.md +662 -540
- package/docs/integration/shareable-export-ch.md +307 -305
- package/docs/integration/shareable-export-en.md +309 -307
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -104
- package/docs/reference/html-compatibility-ch.md +93 -140
- package/docs/reference/html-compatibility-en.md +95 -140
- package/docs/reference/local-interaction-syntax-ch.md +724 -724
- package/docs/reference/local-interaction-syntax-en.md +722 -722
- package/docs/reference/public-api-ch.md +39 -7
- package/docs/reference/public-api-en.md +39 -7
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.4.0-ch.md +91 -91
- package/docs/releases/release-0.4.0-en.md +91 -91
- package/docs/releases/release-0.4.1-ch.md +25 -25
- package/docs/releases/release-0.4.1-en.md +25 -25
- package/docs/releases/release-0.5.0-ch.md +43 -43
- package/docs/releases/release-0.5.0-en.md +43 -43
- package/docs/releases/release-0.5.1-ch.md +41 -41
- package/docs/releases/release-0.5.1-en.md +41 -41
- package/docs/releases/release-0.5.2-ch.md +37 -37
- package/docs/releases/release-0.5.2-en.md +37 -37
- package/docs/releases/release-0.5.3-ch.md +26 -26
- package/docs/releases/release-0.5.3-en.md +26 -26
- package/docs/releases/release-0.6.0-ch.md +59 -59
- package/docs/releases/release-0.6.0-en.md +59 -59
- package/docs/releases/release-0.6.1-ch.md +29 -29
- package/docs/releases/release-0.6.1-en.md +29 -29
- package/docs/releases/release-0.7.0-ch.md +86 -86
- package/docs/releases/release-0.7.0-en.md +86 -86
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/docs/releases/release-0.9.2-ch.md +33 -0
- package/docs/releases/release-0.9.2-en.md +33 -0
- package/examples/component-package/README-ch.md +101 -101
- package/examples/component-package/README.md +133 -133
- package/examples/conformance/README-ch.md +55 -55
- package/examples/conformance/README.md +55 -55
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/game-2048-package/LICENSE +21 -21
- package/examples/game-2048-package/NOTICES.md +11 -11
- package/examples/game-2048-package/README-ch.md +91 -91
- package/examples/game-2048-package/README.md +98 -98
- package/examples/game-2048-package/package.json +35 -35
- package/examples/game-2048-package/sample/document.reactive.md +17 -17
- package/examples/game-2048-package/scripts/build-export.mjs +44 -44
- package/examples/game-2048-package/scripts/build.mjs +130 -130
- package/examples/game-2048-package/scripts/verify.mjs +180 -180
- package/examples/game-2048-package/src/component.css +161 -161
- package/examples/game-2048-package/src/components.tsx +326 -326
- package/examples/game-2048-package/src/game-engine.ts +228 -228
- package/examples/game-2048-package/src/harness.tsx +34 -34
- package/examples/game-2048-package/src/manifest.ts +85 -85
- package/examples/game-2048-package/src/node-entry.ts +30 -30
- package/examples/game-2048-package/src/sample.ts +4 -4
- package/examples/game-2048-package/tsconfig.json +15 -15
- package/examples/integration/README-ch.md +82 -63
- package/examples/integration/README.md +82 -63
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/extension-sdk/README-ch.md +24 -24
- package/examples/integration/extension-sdk/README.md +24 -24
- 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/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README-ch.md +76 -76
- package/examples/local/README.md +76 -76
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README-ch.md +22 -22
- package/examples/local/showcase/README.md +31 -31
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/examples/minimal-extension/README-ch.md +78 -78
- package/examples/minimal-extension/README.md +78 -78
- package/examples/minimal-extension/index.html +15 -15
- package/examples/minimal-extension/package.json +26 -26
- package/examples/minimal-extension/sample/document.reactive.md +10 -10
- package/examples/minimal-extension/scripts/build.mjs +32 -32
- package/examples/minimal-extension/scripts/export.mjs +72 -72
- package/examples/minimal-extension/scripts/test-node.mjs +75 -75
- package/examples/minimal-extension/src/extension.tsx +90 -90
- package/examples/minimal-extension/src/preview.tsx +12 -12
- package/examples/minimal-extension/src/source.ts +4 -4
- package/examples/minimal-extension/tsconfig.json +14 -14
- package/examples/sci-fi-theme/README-ch.md +133 -133
- package/examples/sci-fi-theme/README.md +148 -148
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
- package/examples/sci-fi-theme/demo/demo.css +638 -638
- package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
- package/examples/sci-fi-theme/demo/index.html +13 -13
- package/examples/sci-fi-theme/demo/main.tsx +215 -215
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
- package/examples/sci-fi-theme/docs/design-system.md +474 -474
- package/examples/sci-fi-theme/package.json +28 -28
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
- package/examples/sci-fi-theme/src/components.css +2370 -2370
- package/examples/sci-fi-theme/src/index.ts +6 -6
- package/examples/sci-fi-theme/src/notch.css +142 -142
- package/examples/sci-fi-theme/src/sci-fi.css +7 -7
- package/examples/sci-fi-theme/src/theme.ts +39 -39
- package/examples/sci-fi-theme/tsconfig.json +20 -20
- package/examples/sci-fi-theme/vite.config.ts +24 -24
- package/examples/tetris-package/LICENSE +21 -21
- package/examples/tetris-package/NOTICES.md +11 -11
- package/examples/tetris-package/README-ch.md +91 -91
- package/examples/tetris-package/README.md +95 -95
- package/examples/tetris-package/package.json +35 -35
- package/examples/tetris-package/sample/document.reactive.md +16 -16
- package/examples/tetris-package/scripts/build-export.mjs +44 -44
- package/examples/tetris-package/scripts/build.mjs +130 -130
- package/examples/tetris-package/scripts/verify.mjs +173 -173
- package/examples/tetris-package/src/component.css +145 -145
- package/examples/tetris-package/src/components.tsx +334 -334
- package/examples/tetris-package/src/harness.tsx +34 -34
- package/examples/tetris-package/src/manifests.ts +93 -93
- package/examples/tetris-package/src/node-entry.ts +16 -16
- package/examples/tetris-package/src/sample.ts +4 -4
- package/examples/tetris-package/src/tetris-engine.ts +325 -325
- package/examples/tetris-package/tsconfig.json +15 -15
- package/package.json +12 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/compiler-DfGbQhyD.js +0 -62
- package/dist-library/component-state-BoLCGee4.js +0 -801
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/export-C7IDW9ul.js +0 -311
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/preset-core-CKc5YXSM.js +0 -1443
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { c as e, m as t, p as n, w as r } from "./version-DAxuGOG2.js";
|
|
2
|
+
import { v as i } from "./document-theme-C8J6UyNO.js";
|
|
3
|
+
import { f as a, l as o, u as s } from "./config-validation-D3D7Dy2J.js";
|
|
4
|
+
import { t as c } from "./types-daDo2c_w.js";
|
|
5
|
+
import { A as l, O as u, P as d } from "./preset-core-DeZPA8IE.js";
|
|
6
|
+
import { l as f, o as p } from "./parser-standard-CBA1-hdG.js";
|
|
7
|
+
import { i as m, s as h } from "./config-DXLvctiZ.js";
|
|
8
|
+
import { r as g } from "./options-BBp9IcHm.js";
|
|
9
|
+
import { u as _ } from "./component-state-CwKX_SN5.js";
|
|
10
|
+
import { n as v } from "./runtime-BpQdZmFI.js";
|
|
11
|
+
import { a as ee, i as y } from "./identity-BUx0Q_-d.js";
|
|
12
|
+
import { i as te, t as b } from "./resources-B0x_w3s9.js";
|
|
10
13
|
// src/local/runtime/state.ts
|
|
11
14
|
var x = "reactive-md-state/v1", S = 1048576, C = /^fnv1a32:[0-9a-f]{8}$/, w = /* @__PURE__ */ new Set([
|
|
12
15
|
"format",
|
|
@@ -14,11 +17,11 @@ var x = "reactive-md-state/v1", S = 1048576, C = /^fnv1a32:[0-9a-f]{8}$/, w = /*
|
|
|
14
17
|
"sourceDigest",
|
|
15
18
|
"parameters",
|
|
16
19
|
"generator"
|
|
17
|
-
]),
|
|
18
|
-
function
|
|
20
|
+
]), ne = /* @__PURE__ */ new Set(["name", "version"]), re = new TextEncoder();
|
|
21
|
+
function T(e, t) {
|
|
19
22
|
return {
|
|
20
23
|
code: e,
|
|
21
|
-
message: t.length > 2e3 ? `${
|
|
24
|
+
message: t.length > 2e3 ? `${i(t, r - 1)}…` : t,
|
|
22
25
|
severity: "error",
|
|
23
26
|
range: {
|
|
24
27
|
start: 0,
|
|
@@ -28,13 +31,13 @@ function E(e, t) {
|
|
|
28
31
|
column: 1
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
e.length < 100 && e.push(
|
|
34
|
+
function E(e, t, n) {
|
|
35
|
+
e.length < 100 && e.push(T(t, n));
|
|
33
36
|
}
|
|
34
|
-
function
|
|
37
|
+
function D(e) {
|
|
35
38
|
return e instanceof Error ? e.message : String(e);
|
|
36
39
|
}
|
|
37
|
-
function
|
|
40
|
+
function O(e) {
|
|
38
41
|
for (let t = 0; t < e.length; t += 1) {
|
|
39
42
|
let n = e.charCodeAt(t);
|
|
40
43
|
if (n >= 55296 && n <= 56319) {
|
|
@@ -49,8 +52,8 @@ function k(e) {
|
|
|
49
52
|
}
|
|
50
53
|
return !0;
|
|
51
54
|
}
|
|
52
|
-
function
|
|
53
|
-
if (typeof e == "string") return
|
|
55
|
+
function k(e) {
|
|
56
|
+
if (typeof e == "string") return O(e) ? {
|
|
54
57
|
ok: !0,
|
|
55
58
|
value: e
|
|
56
59
|
} : {
|
|
@@ -73,7 +76,7 @@ function A(e) {
|
|
|
73
76
|
for (let r = 0; r < e.length; r += 1) {
|
|
74
77
|
let i = e[r];
|
|
75
78
|
if (n === "string" && typeof i == "string") {
|
|
76
|
-
if (!
|
|
79
|
+
if (!O(i)) return {
|
|
77
80
|
ok: !1,
|
|
78
81
|
message: "contains malformed Unicode."
|
|
79
82
|
};
|
|
@@ -94,30 +97,30 @@ function A(e) {
|
|
|
94
97
|
message: "must be a string, finite number, boolean, null or homogeneous primitive array."
|
|
95
98
|
};
|
|
96
99
|
}
|
|
97
|
-
function
|
|
100
|
+
function A(e) {
|
|
98
101
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
99
102
|
let t = Object.getPrototypeOf(e);
|
|
100
103
|
return t === Object.prototype || t === null;
|
|
101
104
|
}
|
|
102
|
-
function
|
|
105
|
+
function j(e) {
|
|
103
106
|
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
104
107
|
}
|
|
105
|
-
function
|
|
108
|
+
function M(e) {
|
|
106
109
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
107
110
|
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
108
|
-
if (!
|
|
111
|
+
if (!O(e.name) || !O(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
109
112
|
return Object.freeze({
|
|
110
113
|
name: e.name,
|
|
111
114
|
version: e.version
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
|
-
function
|
|
115
|
-
return typeof e == "string" ? `"${e.length > 48 ? `${
|
|
117
|
+
function N(e) {
|
|
118
|
+
return typeof e == "string" ? `"${e.length > 48 ? `${i(e, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
116
119
|
}
|
|
117
|
-
function
|
|
118
|
-
return e.length > t ? e.length :
|
|
120
|
+
function P(e, t) {
|
|
121
|
+
return e.length > t ? e.length : re.encode(e).byteLength;
|
|
119
122
|
}
|
|
120
|
-
function
|
|
123
|
+
function ie(e, t) {
|
|
121
124
|
let n;
|
|
122
125
|
try {
|
|
123
126
|
let t = JSON.stringify(e);
|
|
@@ -126,9 +129,9 @@ function oe(e, t) {
|
|
|
126
129
|
} catch {
|
|
127
130
|
return null;
|
|
128
131
|
}
|
|
129
|
-
return
|
|
132
|
+
return P(n, t);
|
|
130
133
|
}
|
|
131
|
-
function
|
|
134
|
+
function ae(e) {
|
|
132
135
|
if (e === void 0) return S;
|
|
133
136
|
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
134
137
|
let { maxLength: t } = e;
|
|
@@ -136,7 +139,7 @@ function se(e) {
|
|
|
136
139
|
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
137
140
|
return t;
|
|
138
141
|
}
|
|
139
|
-
function
|
|
142
|
+
function F(e, t, n) {
|
|
140
143
|
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
141
144
|
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
142
145
|
let r = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), i = new Set(r), a = /* @__PURE__ */ new Map();
|
|
@@ -147,7 +150,7 @@ function I(e, t, n) {
|
|
|
147
150
|
continue;
|
|
148
151
|
}
|
|
149
152
|
if (!i.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
|
|
150
|
-
let r =
|
|
153
|
+
let r = k(t[n]);
|
|
151
154
|
if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
|
|
152
155
|
a.set(n, r.value);
|
|
153
156
|
}
|
|
@@ -158,57 +161,57 @@ function I(e, t, n) {
|
|
|
158
161
|
}
|
|
159
162
|
let s = {
|
|
160
163
|
format: x,
|
|
161
|
-
syntax:
|
|
162
|
-
sourceDigest:
|
|
164
|
+
syntax: c,
|
|
165
|
+
sourceDigest: y(e.source),
|
|
163
166
|
parameters: o
|
|
164
167
|
};
|
|
165
|
-
return n !== void 0 && (s.generator =
|
|
168
|
+
return n !== void 0 && (s.generator = M(n)), j(s);
|
|
166
169
|
}
|
|
167
|
-
function
|
|
168
|
-
let n = [], r = (e, t) =>
|
|
170
|
+
function oe(e, t) {
|
|
171
|
+
let n = [], r = (e, t) => E(n, e, t), i = e;
|
|
169
172
|
if (typeof e == "string") {
|
|
170
|
-
if (
|
|
173
|
+
if (P(e, t) > t) return {
|
|
171
174
|
ok: !1,
|
|
172
|
-
diagnostics: [
|
|
175
|
+
diagnostics: [T("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
173
176
|
};
|
|
174
|
-
if (!
|
|
177
|
+
if (!O(e)) return {
|
|
175
178
|
ok: !1,
|
|
176
|
-
diagnostics: [
|
|
179
|
+
diagnostics: [T("local.state.utf", "The state payload contains malformed Unicode.")]
|
|
177
180
|
};
|
|
178
181
|
try {
|
|
179
182
|
i = JSON.parse(e);
|
|
180
183
|
} catch (e) {
|
|
181
184
|
return {
|
|
182
185
|
ok: !1,
|
|
183
|
-
diagnostics: [
|
|
186
|
+
diagnostics: [T("local.state.json", `The state payload is not valid JSON: ${D(e)}`)]
|
|
184
187
|
};
|
|
185
188
|
}
|
|
186
189
|
} else {
|
|
187
|
-
let n =
|
|
190
|
+
let n = ie(e, t);
|
|
188
191
|
if (n === null) return {
|
|
189
192
|
ok: !1,
|
|
190
|
-
diagnostics: [
|
|
193
|
+
diagnostics: [T("local.state.shape", "The state payload must be a JSON object.")]
|
|
191
194
|
};
|
|
192
195
|
if (n > t) return {
|
|
193
196
|
ok: !1,
|
|
194
|
-
diagnostics: [
|
|
197
|
+
diagnostics: [T("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
195
198
|
};
|
|
196
199
|
}
|
|
197
|
-
if (!
|
|
200
|
+
if (!A(i)) return {
|
|
198
201
|
ok: !1,
|
|
199
|
-
diagnostics: [
|
|
202
|
+
diagnostics: [T("local.state.shape", "The state payload must be a JSON object.")]
|
|
200
203
|
};
|
|
201
204
|
Object.getOwnPropertySymbols(i).length > 0 && r("local.state.shape", "The state payload cannot use symbol keys.");
|
|
202
205
|
for (let e of Object.keys(i)) w.has(e) || r("local.state.key", `Unknown top-level state key "${e}".`);
|
|
203
206
|
let a = i.format;
|
|
204
|
-
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${
|
|
207
|
+
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${N(a)}; expected "${x}".`);
|
|
205
208
|
let o = i.syntax;
|
|
206
|
-
o !== "local-draft-3" && r("local.state.syntax", `Unsupported state syntax ${
|
|
209
|
+
o !== "local-draft-3" && r("local.state.syntax", `Unsupported state syntax ${N(o)}; expected "${c}".`);
|
|
207
210
|
let s = i.sourceDigest;
|
|
208
211
|
typeof s == "string" && C.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
209
|
-
let
|
|
210
|
-
if (!
|
|
211
|
-
else for (let e of Object.keys(
|
|
212
|
+
let l = {}, u = i.parameters;
|
|
213
|
+
if (!A(u)) r("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
214
|
+
else for (let e of Object.keys(u).sort()) {
|
|
212
215
|
if (e === "__proto__") {
|
|
213
216
|
r("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
|
|
214
217
|
continue;
|
|
@@ -217,16 +220,16 @@ function ce(e, t) {
|
|
|
217
220
|
r("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
|
|
218
221
|
continue;
|
|
219
222
|
}
|
|
220
|
-
let t =
|
|
221
|
-
t.ok ?
|
|
223
|
+
let t = k(u[e]);
|
|
224
|
+
t.ok ? l[e] = t.value : r("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
|
|
222
225
|
}
|
|
223
|
-
let
|
|
226
|
+
let d;
|
|
224
227
|
if (Object.hasOwn(i, "generator")) {
|
|
225
228
|
let e = i.generator;
|
|
226
|
-
if (!
|
|
229
|
+
if (!A(e)) r("local.state.generator", "generator must be an object with string name and version.");
|
|
227
230
|
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.") : !
|
|
231
|
+
for (let t of Object.keys(e)) ne.has(t) || r("local.state.generator", `generator has unknown key "${t}".`);
|
|
232
|
+
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
233
|
name: e.name,
|
|
231
234
|
version: e.version
|
|
232
235
|
});
|
|
@@ -238,34 +241,34 @@ function ce(e, t) {
|
|
|
238
241
|
};
|
|
239
242
|
let f = {
|
|
240
243
|
format: x,
|
|
241
|
-
syntax:
|
|
244
|
+
syntax: c,
|
|
242
245
|
sourceDigest: s,
|
|
243
|
-
parameters:
|
|
246
|
+
parameters: l
|
|
244
247
|
};
|
|
245
|
-
return
|
|
248
|
+
return d && (f.generator = d), {
|
|
246
249
|
ok: !0,
|
|
247
|
-
file:
|
|
250
|
+
file: j(f)
|
|
248
251
|
};
|
|
249
252
|
}
|
|
250
|
-
function
|
|
251
|
-
let n =
|
|
253
|
+
function I(e, t) {
|
|
254
|
+
let n = ae(t);
|
|
252
255
|
try {
|
|
253
|
-
return
|
|
256
|
+
return oe(e, n);
|
|
254
257
|
} catch (e) {
|
|
255
258
|
return {
|
|
256
259
|
ok: !1,
|
|
257
|
-
diagnostics: [
|
|
260
|
+
diagnostics: [T("local.state.invalid", `Cannot read the local state: ${D(e)}`)]
|
|
258
261
|
};
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
|
-
function
|
|
264
|
+
function se(e) {
|
|
262
265
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
263
266
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
264
267
|
};
|
|
265
268
|
return n(e.nodes), t;
|
|
266
269
|
}
|
|
267
|
-
function
|
|
268
|
-
let t =
|
|
270
|
+
function ce(e) {
|
|
271
|
+
let t = se(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
269
272
|
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
270
273
|
let e = t.get(i);
|
|
271
274
|
if (!e) continue;
|
|
@@ -307,9 +310,9 @@ function R(e) {
|
|
|
307
310
|
groups: r
|
|
308
311
|
};
|
|
309
312
|
}
|
|
310
|
-
function
|
|
313
|
+
function L(e, t, n) {
|
|
311
314
|
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(
|
|
315
|
+
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(T("local.state.document", `The document has no component for parameter "${a.key}".`)));
|
|
313
316
|
if (r.length) return r;
|
|
314
317
|
r.push(...e.setParameters(i));
|
|
315
318
|
for (let i of t.groups) {
|
|
@@ -319,7 +322,7 @@ function z(e, t, n) {
|
|
|
319
322
|
}
|
|
320
323
|
return r;
|
|
321
324
|
}
|
|
322
|
-
function
|
|
325
|
+
function le(e, t) {
|
|
323
326
|
let n = e.snapshot(), r = {};
|
|
324
327
|
for (let e of t) {
|
|
325
328
|
let t = n.state[e];
|
|
@@ -327,46 +330,46 @@ function ue(e, t) {
|
|
|
327
330
|
}
|
|
328
331
|
return Object.freeze(r);
|
|
329
332
|
}
|
|
330
|
-
function
|
|
331
|
-
let i =
|
|
333
|
+
function R(e, t, n, r) {
|
|
334
|
+
let i = I(t, r);
|
|
332
335
|
if (!i.ok) return i;
|
|
333
336
|
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
334
337
|
ok: !1,
|
|
335
|
-
diagnostics: [
|
|
338
|
+
diagnostics: [T("local.state.document", "resolveLocalState requires a compiled local document.")]
|
|
336
339
|
};
|
|
337
340
|
if (i.file.syntax !== "local-draft-3") return {
|
|
338
341
|
ok: !1,
|
|
339
|
-
diagnostics: [
|
|
342
|
+
diagnostics: [T("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${c}".`)]
|
|
340
343
|
};
|
|
341
|
-
if (i.file.sourceDigest !==
|
|
344
|
+
if (i.file.sourceDigest !== y(e.source)) return {
|
|
342
345
|
ok: !1,
|
|
343
|
-
diagnostics: [
|
|
346
|
+
diagnostics: [T("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
344
347
|
};
|
|
345
|
-
let a =
|
|
346
|
-
for (let e of Object.keys(i.file.parameters)) o.has(e) ||
|
|
347
|
-
for (let e of o) Object.hasOwn(i.file.parameters, e) ||
|
|
348
|
+
let a = ce(e), o = new Set(a.plans.map((e) => e.key)), s = [];
|
|
349
|
+
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.`);
|
|
350
|
+
for (let e of o) Object.hasOwn(i.file.parameters, e) || E(s, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
348
351
|
if (s.length) return {
|
|
349
352
|
ok: !1,
|
|
350
353
|
diagnostics: s
|
|
351
354
|
};
|
|
352
|
-
let
|
|
355
|
+
let l;
|
|
353
356
|
try {
|
|
354
|
-
|
|
357
|
+
l = v(e);
|
|
355
358
|
} catch (e) {
|
|
356
359
|
return {
|
|
357
360
|
ok: !1,
|
|
358
|
-
diagnostics: [
|
|
361
|
+
diagnostics: [T("local.state.document", `Cannot validate this document: ${D(e)}`)]
|
|
359
362
|
};
|
|
360
363
|
}
|
|
361
364
|
try {
|
|
362
365
|
if (n) {
|
|
363
|
-
let e =
|
|
366
|
+
let e = L(l, a, n);
|
|
364
367
|
if (e.length) return {
|
|
365
368
|
ok: !1,
|
|
366
369
|
diagnostics: e
|
|
367
370
|
};
|
|
368
371
|
}
|
|
369
|
-
let e =
|
|
372
|
+
let e = L(l, a, i.file.parameters);
|
|
370
373
|
if (e.length) return {
|
|
371
374
|
ok: !1,
|
|
372
375
|
diagnostics: e
|
|
@@ -375,51 +378,51 @@ function B(e, t, n, r) {
|
|
|
375
378
|
return {
|
|
376
379
|
ok: !0,
|
|
377
380
|
file: i.file,
|
|
378
|
-
state:
|
|
381
|
+
state: le(l, t)
|
|
379
382
|
};
|
|
380
383
|
} finally {
|
|
381
|
-
|
|
384
|
+
l.dispose();
|
|
382
385
|
}
|
|
383
386
|
}
|
|
384
|
-
function
|
|
387
|
+
function z(e, t, n) {
|
|
385
388
|
try {
|
|
386
|
-
return
|
|
389
|
+
return R(e, t, void 0, n);
|
|
387
390
|
} catch (e) {
|
|
388
391
|
return {
|
|
389
392
|
ok: !1,
|
|
390
|
-
diagnostics: [
|
|
393
|
+
diagnostics: [T("local.state.invalid", `Cannot resolve the local state: ${D(e)}`)]
|
|
391
394
|
};
|
|
392
395
|
}
|
|
393
396
|
}
|
|
394
|
-
function
|
|
397
|
+
function B(e, t, n) {
|
|
395
398
|
let r;
|
|
396
399
|
try {
|
|
397
|
-
r =
|
|
400
|
+
r = R(e.document, t, e.snapshot().state, n);
|
|
398
401
|
} catch (e) {
|
|
399
|
-
return [
|
|
402
|
+
return [T("local.state.invalid", `Cannot apply the local state: ${D(e)}`)];
|
|
400
403
|
}
|
|
401
404
|
if (!r.ok) return r.diagnostics;
|
|
402
|
-
let i =
|
|
405
|
+
let i = ce(e.document);
|
|
403
406
|
try {
|
|
404
|
-
return
|
|
407
|
+
return L(e, i, r.state);
|
|
405
408
|
} catch (e) {
|
|
406
|
-
return [
|
|
409
|
+
return [T("local.state.invalid", `Cannot apply the local state: ${D(e)}`)];
|
|
407
410
|
}
|
|
408
411
|
}
|
|
409
|
-
function
|
|
410
|
-
return
|
|
412
|
+
function ue(e, t) {
|
|
413
|
+
return F(e.document, e.getParameters(), t);
|
|
411
414
|
}
|
|
412
|
-
function
|
|
413
|
-
let r =
|
|
414
|
-
return r.ok ?
|
|
415
|
+
function de(e, t, n) {
|
|
416
|
+
let r = I(t, n);
|
|
417
|
+
return r.ok ? B(e, r.file, n) : r.diagnostics;
|
|
415
418
|
}
|
|
416
|
-
function
|
|
419
|
+
function fe(e) {
|
|
417
420
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
418
421
|
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
419
422
|
let t = Object.create(null);
|
|
420
423
|
for (let n of Object.keys(e.parameters).sort()) {
|
|
421
424
|
if (n === "__proto__" || n.startsWith("@")) throw TypeError(`Cannot serialize parameter "${n}".`);
|
|
422
|
-
let r =
|
|
425
|
+
let r = k(e.parameters[n]);
|
|
423
426
|
if (!r.ok) throw TypeError(`Cannot serialize parameter "${n}": the value ${r.message}`);
|
|
424
427
|
t[n] = r.value;
|
|
425
428
|
}
|
|
@@ -430,7 +433,7 @@ function pe(e) {
|
|
|
430
433
|
parameters: t
|
|
431
434
|
};
|
|
432
435
|
if (e.generator !== void 0) {
|
|
433
|
-
let t =
|
|
436
|
+
let t = M(e.generator);
|
|
434
437
|
n.generator = {
|
|
435
438
|
name: t.name,
|
|
436
439
|
version: t.version
|
|
@@ -439,9 +442,9 @@ function pe(e) {
|
|
|
439
442
|
return JSON.stringify(n);
|
|
440
443
|
}
|
|
441
444
|
// src/local/configuration/portable-options.ts
|
|
442
|
-
function
|
|
445
|
+
function V(e) {
|
|
443
446
|
if (e === void 0) return;
|
|
444
|
-
let t =
|
|
447
|
+
let t = g(e);
|
|
445
448
|
if (!t.ok) throw TypeError(`Invalid portable compile options: ${t.message}`);
|
|
446
449
|
return {
|
|
447
450
|
enableCss: t.html.enableCss,
|
|
@@ -449,7 +452,7 @@ function U(e) {
|
|
|
449
452
|
enableExtendedHtml: t.html.enableExtendedHtml,
|
|
450
453
|
...Object.hasOwn(e, "strict") && e.strict !== void 0 ? { strict: t.strict } : {},
|
|
451
454
|
...e.markdownBreaks === void 0 ? {} : { markdownBreaks: t.markdownBreaks },
|
|
452
|
-
...e.config === void 0 ? t.hostComponents.length ? { hostComponents: t.hostComponents } : {} : { config:
|
|
455
|
+
...e.config === void 0 ? t.hostComponents.length ? { hostComponents: t.hostComponents } : {} : { config: h(e.config) },
|
|
453
456
|
...e.limits === void 0 ? {} : { limits: {
|
|
454
457
|
...e.limits.maxSyntaxNodes === void 0 ? {} : { maxSyntaxNodes: t.maxSyntaxNodes },
|
|
455
458
|
...e.limits.maxParseWork === void 0 ? {} : { maxParseWork: t.maxParseWork },
|
|
@@ -458,9 +461,9 @@ function U(e) {
|
|
|
458
461
|
};
|
|
459
462
|
}
|
|
460
463
|
// src/export/restoration.ts
|
|
461
|
-
var
|
|
462
|
-
function
|
|
463
|
-
return
|
|
464
|
+
var pe = d;
|
|
465
|
+
function H(e) {
|
|
466
|
+
return d(JSON.stringify([
|
|
464
467
|
e.id,
|
|
465
468
|
e.name,
|
|
466
469
|
e.version,
|
|
@@ -469,65 +472,65 @@ function W(e) {
|
|
|
469
472
|
e.css.map(({ id: e, css: t }) => [e, t])
|
|
470
473
|
]));
|
|
471
474
|
}
|
|
472
|
-
function
|
|
473
|
-
let
|
|
475
|
+
function me(t, n) {
|
|
476
|
+
let r = h(n), i = o(r);
|
|
474
477
|
return Object.freeze({
|
|
475
478
|
protocol: "reactive-md-bundle/v1",
|
|
476
|
-
sdkVersion:
|
|
477
|
-
configKey:
|
|
478
|
-
scriptDigest:
|
|
479
|
-
assembly:
|
|
480
|
-
seal:
|
|
481
|
-
themes: Object.freeze(
|
|
479
|
+
sdkVersion: e,
|
|
480
|
+
configKey: r.key,
|
|
481
|
+
scriptDigest: d(t),
|
|
482
|
+
assembly: i,
|
|
483
|
+
seal: s(r),
|
|
484
|
+
themes: Object.freeze(r.themes.map((e) => Object.freeze({
|
|
482
485
|
id: e.id,
|
|
483
486
|
name: e.name,
|
|
484
487
|
version: e.version,
|
|
485
|
-
digest:
|
|
488
|
+
digest: H(e)
|
|
486
489
|
})))
|
|
487
490
|
});
|
|
488
491
|
}
|
|
489
|
-
function
|
|
490
|
-
let
|
|
491
|
-
for (;
|
|
492
|
-
let e =
|
|
493
|
-
(e.type === "component" || e.type === "hostComponent") && e.name &&
|
|
492
|
+
function U(t, n, r, i = []) {
|
|
493
|
+
let a = h(n), s = /* @__PURE__ */ new Set(), c = [...t.nodes];
|
|
494
|
+
for (; c.length;) {
|
|
495
|
+
let e = c.pop();
|
|
496
|
+
(e.type === "component" || e.type === "hostComponent") && e.name && s.add(e.name), e.children && c.push(...e.children);
|
|
494
497
|
}
|
|
495
|
-
let
|
|
498
|
+
let l = a.registry.filter((e) => s.has(e.name)).map((e) => Object.freeze({
|
|
496
499
|
id: e.id,
|
|
497
500
|
name: e.name,
|
|
498
501
|
version: e.version,
|
|
499
502
|
range: e.version,
|
|
500
|
-
digest:
|
|
501
|
-
})).sort((e, t) => e.id.localeCompare(t.id)), f =
|
|
503
|
+
digest: u(e)
|
|
504
|
+
})).sort((e, t) => e.id.localeCompare(t.id)), f = a.themes.filter((e) => e.name === t.theme).map((e) => Object.freeze({
|
|
502
505
|
id: e.id,
|
|
503
506
|
name: e.name,
|
|
504
507
|
version: e.version,
|
|
505
|
-
digest:
|
|
508
|
+
digest: H(e)
|
|
506
509
|
}));
|
|
507
510
|
return Object.freeze({
|
|
508
511
|
protocol: "reactive-md-restore/v1",
|
|
509
|
-
sdk: `^${
|
|
510
|
-
configKey:
|
|
511
|
-
sourceDigest:
|
|
512
|
-
target:
|
|
513
|
-
components: Object.freeze(
|
|
512
|
+
sdk: `^${e}`,
|
|
513
|
+
configKey: a.key,
|
|
514
|
+
sourceDigest: d(t.source),
|
|
515
|
+
target: r,
|
|
516
|
+
components: Object.freeze(l),
|
|
514
517
|
themes: Object.freeze(f),
|
|
515
|
-
assembly:
|
|
516
|
-
resources: Object.freeze(
|
|
518
|
+
assembly: o(a),
|
|
519
|
+
resources: Object.freeze(i.map((e) => Object.freeze({
|
|
517
520
|
id: e.id,
|
|
518
|
-
digest:
|
|
521
|
+
digest: d(e.css)
|
|
519
522
|
})))
|
|
520
523
|
});
|
|
521
524
|
}
|
|
522
|
-
function
|
|
525
|
+
function W(e) {
|
|
523
526
|
return typeof e == "object" && !!e && !Array.isArray(e) && [Object.prototype, null].includes(Object.getPrototypeOf(e));
|
|
524
527
|
}
|
|
525
|
-
function
|
|
528
|
+
function G(e) {
|
|
526
529
|
return typeof e == "string" && e.length > 0 && e.length <= 256;
|
|
527
530
|
}
|
|
528
|
-
function
|
|
529
|
-
if (
|
|
530
|
-
let
|
|
531
|
+
function K(r, i) {
|
|
532
|
+
if (r === void 0) return [];
|
|
533
|
+
let o = [], s = (e, t) => o.push({
|
|
531
534
|
code: `local.extension.restore-${e}`,
|
|
532
535
|
message: t,
|
|
533
536
|
severity: "error",
|
|
@@ -539,12 +542,12 @@ function J(o, s) {
|
|
|
539
542
|
column: 1
|
|
540
543
|
});
|
|
541
544
|
try {
|
|
542
|
-
if (!
|
|
545
|
+
if (!W(r) || l(r) > 262144 || r.protocol !== "reactive-md-restore/v1" || !G(r.sdk) || !G(r.configKey) || !G(r.sourceDigest) || ![
|
|
543
546
|
"static",
|
|
544
547
|
"ssr",
|
|
545
548
|
"offline"
|
|
546
|
-
].includes(
|
|
547
|
-
let
|
|
549
|
+
].includes(r.target) || !Array.isArray(r.components) || r.components.length > 192 || !Array.isArray(r.themes) || r.themes.length > 16 || !Array.isArray(r.resources) || r.resources.length > 128) return s("metadata", "Invalid or oversized restoration requirements."), o;
|
|
550
|
+
let c = /* @__PURE__ */ new Set([
|
|
548
551
|
"protocol",
|
|
549
552
|
"sdk",
|
|
550
553
|
"configKey",
|
|
@@ -555,97 +558,97 @@ function J(o, s) {
|
|
|
555
558
|
"resources",
|
|
556
559
|
"assembly"
|
|
557
560
|
]);
|
|
558
|
-
Object.keys(
|
|
559
|
-
let f =
|
|
560
|
-
|
|
561
|
+
Object.keys(r).some((e) => !c.has(e)) && s("metadata", "Unknown restoration requirement field.");
|
|
562
|
+
let f = i.config === void 0 ? m() : h(i.config);
|
|
563
|
+
t(r.sdk) && n("0.7.0", r.sdk) || s("sdk", `SDK ${e} does not satisfy ${r.sdk}.`), a(f, r.configKey) || s("config", "The installed configuration differs from the exported configuration."), r.assembly !== void 0 && (W(r.assembly) && r.assembly.protocol === "reactive-md-assembly-seal/v1" && G(r.assembly.configKey) && a(f, r.assembly.configKey) || s("assembly", "The exported assembly identity is invalid or belongs to another configuration.")), d(i.source) !== r.sourceDigest && s("source", "The source differs from the exported source. Recompile before restoring state.");
|
|
561
564
|
let p = /* @__PURE__ */ new Set();
|
|
562
|
-
for (let e of
|
|
563
|
-
if (!
|
|
565
|
+
for (let e of r.components) {
|
|
566
|
+
if (!W(e) || ![
|
|
564
567
|
"id",
|
|
565
568
|
"name",
|
|
566
569
|
"version",
|
|
567
570
|
"range",
|
|
568
571
|
"digest"
|
|
569
|
-
].every((t) =>
|
|
570
|
-
|
|
572
|
+
].every((t) => G(e[t])) || !t(e.range) || p.has(e.id)) {
|
|
573
|
+
s("metadata", "Invalid or duplicate component restoration requirement.");
|
|
571
574
|
continue;
|
|
572
575
|
}
|
|
573
576
|
p.add(e.id);
|
|
574
|
-
let
|
|
575
|
-
if (!
|
|
576
|
-
|
|
577
|
+
let i = f.registry.find((t) => t.id === e.id);
|
|
578
|
+
if (!i) {
|
|
579
|
+
s("component-missing", `Required component ${e.id}@${e.version} is not installed.`);
|
|
577
580
|
continue;
|
|
578
581
|
}
|
|
579
|
-
n(
|
|
580
|
-
let
|
|
582
|
+
n(i.version, e.range) || s("version", `Component ${e.id}@${i.version} does not satisfy ${e.range}.`), (i.version !== e.version || i.name !== e.name || u(i) !== e.digest) && s("contract", `Component ${e.id}@${e.version} differs from the installed contract. Recompile and validate state before upgrading.`);
|
|
583
|
+
let a = r.target === "offline" ? [
|
|
581
584
|
"interactive",
|
|
582
585
|
"static",
|
|
583
586
|
"offline"
|
|
584
|
-
] : [
|
|
585
|
-
for (let
|
|
587
|
+
] : [r.target];
|
|
588
|
+
for (let t of a) i.capabilities[t] || s("capability", `Component ${e.id} cannot render ${t}.`);
|
|
586
589
|
}
|
|
587
|
-
if (
|
|
588
|
-
let e =
|
|
589
|
-
for (let t of e.components) p.has(t.id) ||
|
|
590
|
+
if (i.document) {
|
|
591
|
+
let e = U(i.document, f, r.target);
|
|
592
|
+
for (let t of e.components) p.has(t.id) || s("component-missing", `Used component ${t.id} is missing from restoration requirements.`);
|
|
590
593
|
}
|
|
591
594
|
p.clear();
|
|
592
|
-
for (let e of
|
|
593
|
-
if (!
|
|
595
|
+
for (let e of r.themes) {
|
|
596
|
+
if (!W(e) || ![
|
|
594
597
|
"id",
|
|
595
598
|
"name",
|
|
596
599
|
"version",
|
|
597
600
|
"digest"
|
|
598
|
-
].every((t) =>
|
|
599
|
-
|
|
601
|
+
].every((t) => G(e[t])) || p.has(e.id)) {
|
|
602
|
+
s("metadata", "Invalid or duplicate theme restoration requirement.");
|
|
600
603
|
continue;
|
|
601
604
|
}
|
|
602
605
|
p.add(e.id);
|
|
603
606
|
let t = f.themes.find((t) => t.id === e.id);
|
|
604
|
-
t && t.name === e.name && t.version === e.version &&
|
|
607
|
+
t && t.name === e.name && t.version === e.version && H(t) === e.digest || s("theme", `Required theme ${e.id}@${e.version} does not match the installed theme.`);
|
|
605
608
|
}
|
|
606
|
-
if (
|
|
607
|
-
let e = f.themes.find((e) => e.name ===
|
|
608
|
-
e && !p.has(e.id) &&
|
|
609
|
+
if (i.document) {
|
|
610
|
+
let e = f.themes.find((e) => e.name === i.document.theme);
|
|
611
|
+
e && !p.has(e.id) && s("theme", `Selected theme ${e.id} is missing from restoration requirements.`);
|
|
609
612
|
}
|
|
610
|
-
let
|
|
611
|
-
|
|
612
|
-
let
|
|
613
|
+
let g = b(i.resources ?? []);
|
|
614
|
+
o.push(...g.diagnostics);
|
|
615
|
+
let _ = new Map(g.resources.map((e) => [e.id, e.css]));
|
|
613
616
|
p.clear();
|
|
614
|
-
for (let e of
|
|
615
|
-
if (!
|
|
616
|
-
|
|
617
|
+
for (let e of r.resources) {
|
|
618
|
+
if (!W(e) || !G(e.id) || !G(e.digest) || p.has(e.id)) {
|
|
619
|
+
s("metadata", "Invalid or duplicate style restoration requirement.");
|
|
617
620
|
continue;
|
|
618
621
|
}
|
|
619
622
|
p.add(e.id);
|
|
620
|
-
let t =
|
|
621
|
-
t === void 0 ?
|
|
623
|
+
let t = _.get(e.id);
|
|
624
|
+
t === void 0 ? s("resource-missing", `Required style resource ${e.id} is missing before state restoration.`) : d(t) !== e.digest && s("resource-digest", `Style resource ${e.id} differs from the exported content.`);
|
|
622
625
|
}
|
|
623
|
-
if (
|
|
624
|
-
let e =
|
|
625
|
-
n.push(...f.themes.filter((e) => e.name ===
|
|
626
|
-
for (let e of n) p.has(e) &&
|
|
626
|
+
if (i.document) {
|
|
627
|
+
let e = U(i.document, f, r.target), t = new Set(e.components.map((e) => e.id)), n = f.registry.filter((e) => t.has(e.id)).flatMap((e) => e.styles ?? []);
|
|
628
|
+
n.push(...f.themes.filter((e) => e.name === i.document.theme).flatMap((e) => e.css.map((e) => e.id)));
|
|
629
|
+
for (let e of n) p.has(e) && _.has(e) || s("resource-missing", `Used style resource ${e} is required before state restoration.`);
|
|
627
630
|
}
|
|
628
631
|
} catch (e) {
|
|
629
|
-
|
|
632
|
+
s("metadata", e instanceof Error ? e.message : String(e));
|
|
630
633
|
}
|
|
631
|
-
return
|
|
634
|
+
return o;
|
|
632
635
|
}
|
|
633
636
|
// src/shareable.ts
|
|
634
|
-
var
|
|
635
|
-
function
|
|
637
|
+
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;
|
|
638
|
+
function X(e, t = !1) {
|
|
636
639
|
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
637
640
|
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
638
641
|
}
|
|
639
|
-
function
|
|
642
|
+
function xe(e) {
|
|
640
643
|
return e.replace(/<\/style/gi, "<\\/style");
|
|
641
644
|
}
|
|
642
|
-
function
|
|
645
|
+
function Se(e) {
|
|
643
646
|
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
644
647
|
}
|
|
645
|
-
function
|
|
646
|
-
return
|
|
648
|
+
function Z(e) {
|
|
649
|
+
return X(e, !0);
|
|
647
650
|
}
|
|
648
|
-
function
|
|
651
|
+
function Q(e) {
|
|
649
652
|
let t = JSON.stringify(e);
|
|
650
653
|
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
651
654
|
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
@@ -658,87 +661,57 @@ function Te(e) {
|
|
|
658
661
|
}
|
|
659
662
|
});
|
|
660
663
|
}
|
|
661
|
-
function
|
|
664
|
+
function $(e) {
|
|
662
665
|
return Array.isArray(e) ? e.slice() : e;
|
|
663
666
|
}
|
|
664
|
-
function
|
|
667
|
+
function Ce(e) {
|
|
665
668
|
try {
|
|
666
|
-
return
|
|
669
|
+
return V(e);
|
|
667
670
|
} catch (e) {
|
|
668
671
|
throw TypeError(`createShareableHtml received invalid compileOptions: ${e instanceof Error ? e.message : String(e)}`);
|
|
669
672
|
}
|
|
670
673
|
}
|
|
671
|
-
function
|
|
672
|
-
let t =
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
if (i.tagName.toLowerCase() === "iframe") {
|
|
687
|
-
let e = i.attrs.filter((e) => {
|
|
688
|
-
let t = e.name.toLowerCase();
|
|
689
|
-
return t !== "srcdoc" && t !== "sandbox";
|
|
690
|
-
});
|
|
691
|
-
e.push({
|
|
692
|
-
name: "srcdoc",
|
|
693
|
-
value: t
|
|
694
|
-
}), e.push({
|
|
695
|
-
name: "sandbox",
|
|
696
|
-
value: n
|
|
697
|
-
}), i.attrs = e, r = !0;
|
|
674
|
+
function we(e, t) {
|
|
675
|
+
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'";
|
|
676
|
+
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'`;
|
|
677
|
+
}
|
|
678
|
+
function Te(e, t) {
|
|
679
|
+
if (t.enableCss && t.enableExtendedHtml || !/data-(?:rmd-(?:snapshot|author)-css|extended-html)/i.test(e)) return;
|
|
680
|
+
let n = [...p(e).childNodes];
|
|
681
|
+
for (; n.length;) {
|
|
682
|
+
let e = n.pop();
|
|
683
|
+
if (f.isElementNode(e)) {
|
|
684
|
+
for (let { name: n, value: r } of e.attrs) {
|
|
685
|
+
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.");
|
|
686
|
+
if (!t.enableExtendedHtml && n === "data-extended-html" && (r === "direct" || r === "sandbox")) throw TypeError("Render staticMarkup with Extended HTML disabled before exporting with enableExtendedHtml: false.");
|
|
687
|
+
}
|
|
688
|
+
for (let t of e.childNodes) n.push(t);
|
|
698
689
|
}
|
|
699
|
-
Oe(i, t, n) && (r = !0);
|
|
700
690
|
}
|
|
701
|
-
return r;
|
|
702
|
-
}
|
|
703
|
-
function ke(e) {
|
|
704
|
-
let t = "";
|
|
705
|
-
for (let n of e.childNodes) t += ee(n, { scriptingEnabled: !1 });
|
|
706
|
-
return t;
|
|
707
691
|
}
|
|
708
|
-
function
|
|
709
|
-
try {
|
|
710
|
-
let r = p(e, { scriptingEnabled: !1 });
|
|
711
|
-
if ($(r), Oe(r, t, n)) return ke(r);
|
|
712
|
-
} catch {}
|
|
713
|
-
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>`;
|
|
714
|
-
}
|
|
715
|
-
function je(e, t) {
|
|
716
|
-
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'";
|
|
717
|
-
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}`;
|
|
718
|
-
}
|
|
719
|
-
function Me(e) {
|
|
692
|
+
function Ee(e) {
|
|
720
693
|
if (e === void 0) return;
|
|
721
694
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
722
695
|
let t = Object.entries(e);
|
|
723
|
-
if (t.length >
|
|
696
|
+
if (t.length > Y) throw RangeError(`images cannot contain more than ${Y} entries.`);
|
|
724
697
|
let n = 0;
|
|
725
698
|
for (let [e, r] of t) {
|
|
726
|
-
if (!e || e.length >
|
|
727
|
-
if (typeof r != "string" || !
|
|
728
|
-
if (n += r.length, n >
|
|
699
|
+
if (!e || e.length > be || ve.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
700
|
+
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.`);
|
|
701
|
+
if (n += r.length, n > ye) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
729
702
|
}
|
|
730
703
|
return Object.fromEntries(t);
|
|
731
704
|
}
|
|
732
|
-
function
|
|
733
|
-
let n =
|
|
705
|
+
function De(e, t) {
|
|
706
|
+
let n = z(e, t);
|
|
734
707
|
if (!n.ok) return n;
|
|
735
708
|
let r = {};
|
|
736
709
|
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
737
710
|
...i,
|
|
738
|
-
initial:
|
|
711
|
+
initial: $(n.state[t])
|
|
739
712
|
} : i;
|
|
740
713
|
let i = { ...e.initialState };
|
|
741
|
-
for (let [e, t] of Object.entries(n.state)) i[e] =
|
|
714
|
+
for (let [e, t] of Object.entries(n.state)) i[e] = $(t);
|
|
742
715
|
return {
|
|
743
716
|
ok: !0,
|
|
744
717
|
baseline: {
|
|
@@ -751,96 +724,91 @@ function Ne(e, t) {
|
|
|
751
724
|
}
|
|
752
725
|
};
|
|
753
726
|
}
|
|
754
|
-
var
|
|
755
|
-
function
|
|
727
|
+
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";
|
|
728
|
+
function ke(e) {
|
|
756
729
|
let t = e.targetId ?? "reactive-md-document";
|
|
757
|
-
if (!
|
|
730
|
+
if (!he.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
758
731
|
let n = e.mode === "static" ? "static" : "interactive";
|
|
759
732
|
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
760
733
|
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
761
|
-
if (e.state.sourceDigest !==
|
|
734
|
+
if (e.state.sourceDigest !== y(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
762
735
|
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
763
|
-
let r =
|
|
764
|
-
if (i.push(...
|
|
736
|
+
let r = Ce(e.compileOptions), i = te(e.extensions, r?.config);
|
|
737
|
+
if (i.push(...K(e.restoration, {
|
|
765
738
|
config: r?.config,
|
|
766
739
|
source: e.source,
|
|
767
740
|
resources: e.resources
|
|
768
741
|
})), i.length) throw TypeError(i.map((e) => e.message).join(" "));
|
|
769
|
-
let a =
|
|
742
|
+
let a = g(r);
|
|
770
743
|
if (!a.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${a.message}`);
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
744
|
+
Te(e.staticMarkup, a.html);
|
|
745
|
+
let o = e.documentId === void 0 ? void 0 : ee(e.documentId);
|
|
746
|
+
if (e.documentId !== void 0 && o === void 0) throw TypeError("createShareableHtml received an invalid documentId.");
|
|
747
|
+
let s;
|
|
774
748
|
if (e.randomSeed !== void 0) {
|
|
775
749
|
if (!Number.isInteger(e.randomSeed) || e.randomSeed < 0 || e.randomSeed > 4294967295) throw TypeError("createShareableHtml received an invalid randomSeed; expected a 32-bit unsigned integer.");
|
|
776
|
-
|
|
750
|
+
s = e.randomSeed;
|
|
777
751
|
}
|
|
778
|
-
let
|
|
752
|
+
let c;
|
|
779
753
|
if (e.componentState !== void 0) {
|
|
780
|
-
let t =
|
|
754
|
+
let t = _(e.componentState);
|
|
781
755
|
if (!t.ok || t.diagnostics.length > 0) {
|
|
782
756
|
let e = t.diagnostics.map((e) => e.message).join(" ");
|
|
783
757
|
throw TypeError(`createShareableHtml received an invalid component state${e ? `: ${e}` : "."}`);
|
|
784
758
|
}
|
|
785
|
-
|
|
786
|
-
}
|
|
787
|
-
let u = e.staticMarkup;
|
|
788
|
-
if (o && (n === "static" || !a.html.enableJavaScript)) {
|
|
789
|
-
let t = {
|
|
790
|
-
enableCss: a.html.enableCss,
|
|
791
|
-
enableJavaScript: !1,
|
|
792
|
-
enableExtendedHtml: a.html.enableExtendedHtml
|
|
793
|
-
}, n = h(e.source, t, a.maxSyntaxNodes);
|
|
794
|
-
if (!n.markup) throw Error("The native HTML document could not be regenerated without author JavaScript.");
|
|
795
|
-
u = Ae(e.staticMarkup, n.markup, f(t));
|
|
759
|
+
c = t.document;
|
|
796
760
|
}
|
|
797
|
-
let
|
|
761
|
+
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 ?? {
|
|
798
762
|
name: "reactive-md",
|
|
799
763
|
version: "unknown"
|
|
800
|
-
},
|
|
764
|
+
}, m = Ee(e.images), h = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(m ?? {}).length), v = n === "interactive", b = {
|
|
801
765
|
version: e.restoration ? 2 : 1,
|
|
766
|
+
sourceSemantics: "mixed-rmd-v1",
|
|
802
767
|
target: t,
|
|
803
768
|
source: e.source,
|
|
804
769
|
state: e.state,
|
|
805
|
-
locale:
|
|
806
|
-
colorScheme:
|
|
770
|
+
locale: l,
|
|
771
|
+
colorScheme: d,
|
|
807
772
|
hydrate: !0,
|
|
808
|
-
|
|
773
|
+
compileOptions: {
|
|
774
|
+
...r,
|
|
775
|
+
...a.html
|
|
776
|
+
},
|
|
809
777
|
...e.extensions === void 0 ? {} : { extensions: e.extensions },
|
|
810
778
|
...e.restoration === void 0 ? {} : {
|
|
811
779
|
restoration: e.restoration,
|
|
812
780
|
resources: e.resources ?? []
|
|
813
781
|
},
|
|
814
|
-
...
|
|
815
|
-
...
|
|
816
|
-
...
|
|
817
|
-
...
|
|
818
|
-
},
|
|
819
|
-
<script>${
|
|
782
|
+
...m ? { images: m } : {},
|
|
783
|
+
...o === void 0 ? {} : { documentId: o },
|
|
784
|
+
...s === void 0 ? {} : { randomSeed: s },
|
|
785
|
+
...c === void 0 ? {} : { componentState: c }
|
|
786
|
+
}, x = we(v, a.html), S = v ? `<script type="application/reactive-md+json" data-reactive-md-auto>${Q(b)}<\/script>
|
|
787
|
+
<script>${Se(e.runtimeScript)}<\/script>` : "", C = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${X(e.notices)}</pre></template>` : "", w = !v && e.extensions ? `<template id="reactive-md-extensions">${X(JSON.stringify(e.extensions))}</template>` : "";
|
|
820
788
|
return `<!doctype html>
|
|
821
|
-
<html lang="${
|
|
789
|
+
<html lang="${X(ge.test(u) ? u : "en", !0)}">
|
|
822
790
|
<head>
|
|
823
791
|
<meta charset="utf-8">
|
|
824
792
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
825
793
|
<meta name="referrer" content="no-referrer">
|
|
826
|
-
<meta http-equiv="Content-Security-Policy" content="${
|
|
827
|
-
<meta name="generator" content="${
|
|
828
|
-
<meta name="reactive-md-html-format" content="${e.restoration ?
|
|
829
|
-
<meta name="reactive-md-syntax" content="${
|
|
794
|
+
<meta http-equiv="Content-Security-Policy" content="${Z(x)}">
|
|
795
|
+
<meta name="generator" content="${Z(`${p.name} ${p.version}`)}">
|
|
796
|
+
<meta name="reactive-md-html-format" content="${e.restoration ? J : q}">
|
|
797
|
+
<meta name="reactive-md-syntax" content="${Z(e.state.syntax)}">
|
|
830
798
|
<meta name="reactive-md-output" content="${n}">
|
|
831
|
-
<meta name="reactive-md-state" content="${
|
|
832
|
-
<meta name="reactive-md-images" content="${
|
|
833
|
-
<meta name="reactive-md-image-count" content="${
|
|
834
|
-
<title>${
|
|
835
|
-
<style>${
|
|
799
|
+
<meta name="reactive-md-state" content="${Z(e.state.sourceDigest)}">
|
|
800
|
+
<meta name="reactive-md-images" content="${f}">
|
|
801
|
+
<meta name="reactive-md-image-count" content="${h}">
|
|
802
|
+
<title>${X(e.title || "Reactive MD document")}</title>
|
|
803
|
+
<style>${xe(e.css)}${Oe}</style>
|
|
836
804
|
</head>
|
|
837
805
|
<body class="reactive-md-export">
|
|
838
|
-
<div id="${t}" class="reactive-md-export-root">${
|
|
839
|
-
${
|
|
840
|
-
${T}
|
|
806
|
+
<div id="${t}" class="reactive-md-export-root">${e.staticMarkup}</div>
|
|
807
|
+
${S}
|
|
841
808
|
${w}
|
|
809
|
+
${C}
|
|
842
810
|
</body>
|
|
843
811
|
</html>
|
|
844
812
|
`;
|
|
845
813
|
}
|
|
846
|
-
export {
|
|
814
|
+
export { I as _, Q as a, pe as c, V as d, x as f, de as g, ue as h, De as i, H as l, F 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 };
|