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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Diagnostic, LocalHtmlPolicy } from '../../types.js';
|
|
2
|
+
export interface ExtendedHtmlFragmentProps {
|
|
3
|
+
/** Raw fragment source as it appeared in the document, without its fence. */
|
|
4
|
+
source: string;
|
|
5
|
+
/** Effective policy for this mount (compile ceiling ∩ grants). */
|
|
6
|
+
policy: LocalHtmlPolicy;
|
|
7
|
+
/** Exact HTTPS origins this mount may frame; omission denies every remote frame. */
|
|
8
|
+
allowedFrameOrigins?: readonly string[];
|
|
9
|
+
inline?: boolean;
|
|
10
|
+
sourceAttributes?: Record<string, string>;
|
|
11
|
+
onDiagnostics?: (items: Diagnostic[]) => void;
|
|
12
|
+
}
|
|
13
|
+
/** Render sanitized inert HTML in the document and isolate active fragments. */
|
|
14
|
+
export declare function ExtendedHtmlFragment({ source, policy, allowedFrameOrigins, inline, sourceAttributes, onDiagnostics, }: ExtendedHtmlFragmentProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Diagnostic, LocalCompileOptions, LocalDocument, LocalRuntime, LocalSnapshot, LocalValue } from '../../types.js';
|
|
1
|
+
import type { Diagnostic, LocalCompileOptions, LocalDocument, LocalHtmlOptions, LocalRuntime, LocalSnapshot, LocalSourcePhase, LocalValue } from '../../types.js';
|
|
2
2
|
import { type NetworkConfig } from '../../../runtime-services/network.js';
|
|
3
3
|
import { type Localize, type LocalLocale } from '../../../react/localization.js';
|
|
4
4
|
import { type LocalColorScheme, type LocalThemeDefinition } from '../../../themes/document-theme.js';
|
|
@@ -21,6 +21,12 @@ export type LocalImageResolver = (url: string) => string | null;
|
|
|
21
21
|
export interface LocalDocumentViewProps {
|
|
22
22
|
document: LocalDocument;
|
|
23
23
|
runtime: LocalRuntime;
|
|
24
|
+
/** Mount-local grants, bounded by the permissions recorded at compilation. */
|
|
25
|
+
capabilityGrants?: LocalHtmlOptions;
|
|
26
|
+
/** Pause author script binding requests and actions while source validation is pending. */
|
|
27
|
+
authorScriptPaused?: boolean;
|
|
28
|
+
/** Exact HTTPS origins available to an extended iframe in this mount. */
|
|
29
|
+
allowedFrameOrigins?: readonly string[];
|
|
24
30
|
/** Optional view-scoped channels. Keep the reference stable while authorization is unchanged. */
|
|
25
31
|
network?: NetworkConfig;
|
|
26
32
|
onDiagnostics?: (diagnostics: Diagnostic[]) => void;
|
|
@@ -70,9 +76,27 @@ export interface LocalDocumentViewProps {
|
|
|
70
76
|
}
|
|
71
77
|
export interface LocalReactiveDocumentProps {
|
|
72
78
|
source: string;
|
|
79
|
+
/** Further restrict the grants given by compileOptions for this mount. */
|
|
80
|
+
capabilityGrants?: LocalHtmlOptions;
|
|
81
|
+
allowedFrameOrigins?: readonly string[];
|
|
73
82
|
/** Channels granted to the current document and user. */
|
|
74
83
|
network?: NetworkConfig;
|
|
75
84
|
onDiagnostics?: (diagnostics: Diagnostic[]) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Marks the source snapshot as still being generated. Streaming snapshots
|
|
87
|
+
* are provisional: the document renders read-only (`static`), and network
|
|
88
|
+
* sessions, submissions and component side effects stay deferred until the
|
|
89
|
+
* phase returns to `final`. Omit it (or pass `final`) for the historical
|
|
90
|
+
* compile and interaction semantics. It is independent of `strict` and does
|
|
91
|
+
* not rebuild the session or reset runtime state.
|
|
92
|
+
*/
|
|
93
|
+
sourcePhase?: LocalSourcePhase;
|
|
94
|
+
/**
|
|
95
|
+
* Fixable issues from a streaming snapshot. They never appear in
|
|
96
|
+
* `onDiagnostics`; when the source finalizes, hosts that received transient
|
|
97
|
+
* diagnostics get one `[]` call. Omit it to ignore provisional issues.
|
|
98
|
+
*/
|
|
99
|
+
onTransientDiagnostics?: (diagnostics: Diagnostic[]) => void;
|
|
76
100
|
urlPolicy?: LocalUrlPolicy;
|
|
77
101
|
/** UI language for built-in labels and validation messages; defaults to English. */
|
|
78
102
|
locale?: LocalLocale;
|
|
@@ -2,5 +2,5 @@ import { type BaseConfigProps, type LocalReactiveDocumentProps } from './LocalDo
|
|
|
2
2
|
type LocalReactiveDocumentCoreProps = LocalReactiveDocumentProps & BaseConfigProps & {
|
|
3
3
|
readonly useBaseCompileConfig?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare function LocalReactiveDocumentCore({ source, onDiagnostics, urlPolicy, locale, themes, colorScheme, mode, staticFirst, imageResolver, hostData, hostRenderer, reactConfig, useBaseCompileConfig, externalValues, network, documentId, randomSeed, componentState, componentStateStorage, componentStateWriteDelayMs, onComponentStateChange, initialParameters, onParametersChange, onSourceNavigate, compileOptions, getBaseConfig, }: LocalReactiveDocumentCoreProps): import("react").JSX.Element;
|
|
5
|
+
export declare function LocalReactiveDocumentCore({ source, onDiagnostics, sourcePhase, onTransientDiagnostics, urlPolicy, locale, themes, colorScheme, mode, staticFirst, imageResolver, hostData, hostRenderer, reactConfig, useBaseCompileConfig, externalValues, network, documentId, randomSeed, componentState, componentStateStorage, componentStateWriteDelayMs, onComponentStateChange, initialParameters, onParametersChange, onSourceNavigate, compileOptions, capabilityGrants, allowedFrameOrigins, getBaseConfig, }: LocalReactiveDocumentCoreProps): import("react").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Diagnostic, LocalDocument, LocalRuntime } from '../../types.js';
|
|
2
|
+
import type { AuthorAction } from '../../runtime/author-script-protocol.js';
|
|
3
|
+
export declare function useAuthorScript(document: LocalDocument, runtime: LocalRuntime, enabled: boolean, paused: boolean, report: (diagnostics: Diagnostic[]) => void): (nodeId: string, action: AuthorAction) => boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { LocalHostData, LocalHostRenderer, LocalRenderContext, LocalRenderMode, LocalSourceTarget } from '../render-types.js';
|
|
2
2
|
import type { LocalComponentDefinition } from '../../../sdk/types.js';
|
|
3
3
|
import { type Localize, type LocalLocale } from '../../../react/localization.js';
|
|
4
|
-
import type { Diagnostic, LocalNode, LocalRuntime, LocalValue } from '../../types.js';
|
|
4
|
+
import type { Diagnostic, LocalHtmlPolicy, LocalNode, LocalRuntime, LocalValue } from '../../types.js';
|
|
5
|
+
import type { AuthorAction } from '../../runtime/author-script-protocol.js';
|
|
5
6
|
import type { LocalImageResolver, LocalUrlPolicy } from './LocalDocumentViewCore.js';
|
|
6
7
|
import { createHeadingAnchors } from '../../parsing/heading-anchors.js';
|
|
7
8
|
import { Component, type ReactNode, type RefObject } from 'react';
|
|
@@ -68,6 +69,10 @@ interface LocalComponentProps {
|
|
|
68
69
|
export declare function safeUrl(raw: string | undefined, kind: 'image' | 'link', policy?: LocalUrlPolicy): string | null;
|
|
69
70
|
export interface RenderEnv {
|
|
70
71
|
network?: ComponentNetwork;
|
|
72
|
+
capabilityPolicy?: LocalHtmlPolicy;
|
|
73
|
+
allowedFrameOrigins?: readonly string[];
|
|
74
|
+
componentStyles?: Readonly<Record<string, string>>;
|
|
75
|
+
dispatchAuthorAction?: (nodeId: string, action: AuthorAction) => boolean;
|
|
71
76
|
runtime: LocalRuntime;
|
|
72
77
|
rootRef: RefObject<HTMLElement | null>;
|
|
73
78
|
urlPolicy?: LocalUrlPolicy;
|
|
@@ -104,6 +109,11 @@ export interface RenderEnv {
|
|
|
104
109
|
report?: (diagnostics: Diagnostic[]) => void;
|
|
105
110
|
}
|
|
106
111
|
export declare function sourceProps(env: RenderEnv, node: LocalNode, componentName?: string): Record<string, string>;
|
|
112
|
+
/** Line/column for an adapter-owned diagnostic, clamped to the source. */
|
|
113
|
+
export declare function sourcePosition(env: RenderEnv, offset: number): {
|
|
114
|
+
line: number;
|
|
115
|
+
column: number;
|
|
116
|
+
};
|
|
107
117
|
/**
|
|
108
118
|
* Build the public render environment handed to one SDK component. The
|
|
109
119
|
* renderer owns the internal node graph; components receive adapter services
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { LocalValue } from '../types.js';
|
|
2
|
+
export declare const COUNTER_ACTIONS: readonly ['increment', 'decrement', 'reset'];
|
|
3
|
+
export type AuthorAction = (typeof COUNTER_ACTIONS)[number];
|
|
4
|
+
export type AuthorBindingRequest = {
|
|
5
|
+
operation: 'get';
|
|
6
|
+
name: string;
|
|
7
|
+
} | {
|
|
8
|
+
operation: 'set';
|
|
9
|
+
name: string;
|
|
10
|
+
value: LocalValue;
|
|
11
|
+
} | {
|
|
12
|
+
operation: 'setMany';
|
|
13
|
+
values: Record<string, LocalValue>;
|
|
14
|
+
};
|
|
15
|
+
export type AuthorBindingReply = {
|
|
16
|
+
ok: true;
|
|
17
|
+
value?: LocalValue;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
export interface AuthorActionRegistration {
|
|
23
|
+
target: string;
|
|
24
|
+
action: AuthorAction;
|
|
25
|
+
takeover: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthorActionTarget {
|
|
28
|
+
id: string;
|
|
29
|
+
epoch: number;
|
|
30
|
+
}
|
|
31
|
+
export type AuthorWorkerInput = {
|
|
32
|
+
kind: 'start';
|
|
33
|
+
blocks: readonly string[];
|
|
34
|
+
targets: readonly string[];
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'reply';
|
|
37
|
+
id: number;
|
|
38
|
+
result: AuthorBindingReply;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'action';
|
|
41
|
+
target: AuthorActionTarget;
|
|
42
|
+
action: AuthorAction;
|
|
43
|
+
};
|
|
44
|
+
export type AuthorWorkerOutput = {
|
|
45
|
+
kind: 'request';
|
|
46
|
+
id: number;
|
|
47
|
+
request: AuthorBindingRequest;
|
|
48
|
+
target?: AuthorActionTarget;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'registered';
|
|
51
|
+
registrations: AuthorActionRegistration[];
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'diagnostic';
|
|
54
|
+
block: number;
|
|
55
|
+
message: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'failed';
|
|
58
|
+
message: string;
|
|
59
|
+
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { LOCAL_RESULT_PATCH_PROTOCOL, type LocalResultPatch, type LocalSourceEdit } from './compile-patch.js';
|
|
2
2
|
import { FLAT_COMPILED_DATA_PROTOCOL, type FlatCompiledData } from './flat-compiled-data.js';
|
|
3
|
-
import type { Diagnostic, LocalCompileOptions, LocalCompileResult } from '../types.js';
|
|
3
|
+
import type { Diagnostic, LocalCompileOptions, LocalCompileResult, LocalSourcePhase } from '../types.js';
|
|
4
|
+
import { type LocalObserver } from '../observability-core.js';
|
|
4
5
|
import type { AuthorAnalysis } from '../source/authoring.js';
|
|
5
6
|
import { type LocalIncrementalStats } from '../compilation/session/incremental.js';
|
|
6
7
|
export type LocalCompileProtocol = typeof LOCAL_RESULT_PATCH_PROTOCOL;
|
|
7
8
|
export interface LocalCompileRequest {
|
|
9
|
+
traceId?: string;
|
|
10
|
+
/** Alias of id for trace consumers. */
|
|
11
|
+
requestId?: number;
|
|
12
|
+
sourceRevision?: number;
|
|
8
13
|
/** Opt into depth-independent full results. Absent on legacy clients. */
|
|
9
14
|
flatResults?: typeof FLAT_COMPILED_DATA_PROTOCOL;
|
|
10
15
|
/** Return authoring data from the same compiled document. Off by default. */
|
|
@@ -19,6 +24,13 @@ export interface LocalCompileRequest {
|
|
|
19
24
|
* reference path.
|
|
20
25
|
*/
|
|
21
26
|
options?: LocalCompileOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Source generation phase. Omitted keeps the legacy final compile: the
|
|
29
|
+
* response then has the historical shape without `status`. `streaming`
|
|
30
|
+
* returns the provisional snapshot in the result itself; the transport does
|
|
31
|
+
* not alter or patch it.
|
|
32
|
+
*/
|
|
33
|
+
sourcePhase?: LocalSourcePhase;
|
|
22
34
|
/**
|
|
23
35
|
* Advertised by a client that understands `patch-v1`. A worker echoes its
|
|
24
36
|
* support on the full response, after which both sides may exchange edits
|
|
@@ -30,6 +42,9 @@ export interface LocalCompileRequest {
|
|
|
30
42
|
}
|
|
31
43
|
/** An incremental request; only sent once a `patch-v1` worker was confirmed. */
|
|
32
44
|
export interface LocalCompilePatchRequest {
|
|
45
|
+
traceId?: string;
|
|
46
|
+
requestId?: number;
|
|
47
|
+
sourceRevision?: number;
|
|
33
48
|
includeAuthorAnalysis?: boolean;
|
|
34
49
|
id: number;
|
|
35
50
|
protocol: LocalCompileProtocol;
|
|
@@ -78,6 +93,9 @@ export interface LocalCompileMetrics {
|
|
|
78
93
|
worker?: LocalCompileWorkerMetrics;
|
|
79
94
|
}
|
|
80
95
|
export interface LocalCompilePatchResponse {
|
|
96
|
+
traceId?: string;
|
|
97
|
+
requestId?: number;
|
|
98
|
+
sourceRevision?: number;
|
|
81
99
|
analysis?: AuthorAnalysis;
|
|
82
100
|
id: number;
|
|
83
101
|
ok: true;
|
|
@@ -86,14 +104,21 @@ export interface LocalCompilePatchResponse {
|
|
|
86
104
|
revision: number;
|
|
87
105
|
patch: LocalResultPatch;
|
|
88
106
|
duration: number;
|
|
107
|
+
/** Phase of the result this patch extends; present when the client asked for one. */
|
|
108
|
+
sourcePhase?: LocalSourcePhase;
|
|
89
109
|
incremental?: Readonly<LocalIncrementalStats>;
|
|
90
110
|
metrics?: LocalCompileWorkerMetrics;
|
|
91
111
|
}
|
|
92
112
|
export type LocalCompileResponse = {
|
|
93
113
|
id: number;
|
|
114
|
+
traceId?: string;
|
|
115
|
+
requestId?: number;
|
|
116
|
+
sourceRevision?: number;
|
|
94
117
|
ok: true;
|
|
95
118
|
result: LocalCompileResult;
|
|
96
119
|
duration: number;
|
|
120
|
+
/** Echo of the request phase; omitted for legacy clients. */
|
|
121
|
+
sourcePhase?: LocalSourcePhase;
|
|
97
122
|
incremental?: Readonly<LocalIncrementalStats>;
|
|
98
123
|
protocol?: LocalCompileProtocol;
|
|
99
124
|
revision?: number;
|
|
@@ -101,6 +126,9 @@ export type LocalCompileResponse = {
|
|
|
101
126
|
analysis?: AuthorAnalysis;
|
|
102
127
|
} | {
|
|
103
128
|
id: number;
|
|
129
|
+
traceId?: string;
|
|
130
|
+
requestId?: number;
|
|
131
|
+
sourceRevision?: number;
|
|
104
132
|
ok: false;
|
|
105
133
|
message: string;
|
|
106
134
|
/** The request cannot be served incrementally; resend the full source. */
|
|
@@ -145,15 +173,23 @@ export interface LocalCompileOutcome {
|
|
|
145
173
|
metrics?: LocalCompileMetrics;
|
|
146
174
|
/** Source revision when the worker negotiated `patch-v1`. */
|
|
147
175
|
revision?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Set for streaming snapshots and for callers that supplied a phase
|
|
178
|
+
* themselves. Legacy final jobs omit it and keep the historical shape.
|
|
179
|
+
*/
|
|
180
|
+
sourcePhase?: LocalSourcePhase;
|
|
148
181
|
}
|
|
149
182
|
export interface LocalCompileSchedulerOptions {
|
|
183
|
+
observer?: LocalObserver;
|
|
184
|
+
timeoutMs?: number;
|
|
150
185
|
includeAuthorAnalysis?: boolean;
|
|
151
186
|
createWorker(): LocalCompileWorker;
|
|
152
187
|
/**
|
|
153
188
|
* Defaults to compileLocal. Runs on the main thread only when the worker is
|
|
154
|
-
* unavailable or failed. One-argument callbacks remain supported
|
|
189
|
+
* unavailable or failed. One- and two-argument callbacks remain supported;
|
|
190
|
+
* an explicit source phase is passed as the third argument.
|
|
155
191
|
*/
|
|
156
|
-
fallbackCompile?(source: string, options?: LocalCompileOptions): LocalCompileResult;
|
|
192
|
+
fallbackCompile?(source: string, options?: LocalCompileOptions, sourcePhase?: LocalSourcePhase): LocalCompileResult;
|
|
157
193
|
onResult(outcome: LocalCompileOutcome): void;
|
|
158
194
|
onPendingChange?(pending: boolean): void;
|
|
159
195
|
onModeChange?(mode: LocalCompileMode, detail?: string): void;
|
|
@@ -188,31 +224,67 @@ export declare class LocalCompileScheduler {
|
|
|
188
224
|
private inFlight;
|
|
189
225
|
private nextId;
|
|
190
226
|
private nextRevision;
|
|
227
|
+
private nextSourceRevision;
|
|
228
|
+
/**
|
|
229
|
+
* Source revision of the newest scheduled job. Observer callbacks may
|
|
230
|
+
* schedule another source; a run whose revision is not current must not
|
|
231
|
+
* deliver results, diagnostics or terminal traces.
|
|
232
|
+
*/
|
|
233
|
+
private currentSourceRevision;
|
|
191
234
|
private pending;
|
|
192
235
|
private fallbackSession;
|
|
193
236
|
private disposed;
|
|
237
|
+
private timeout;
|
|
238
|
+
private readonly requestContexts;
|
|
239
|
+
private readonly obsoleteRequestIds;
|
|
240
|
+
private readonly reportedStaleRequestIds;
|
|
194
241
|
private baseline;
|
|
195
242
|
private patchState;
|
|
243
|
+
/**
|
|
244
|
+
* Bounded reason the worker factory threw, kept until the first task that
|
|
245
|
+
* actually runs on the fallback thread reports it once. `null` afterwards.
|
|
246
|
+
*/
|
|
247
|
+
private startupFailure;
|
|
196
248
|
constructor(options: LocalCompileSchedulerOptions);
|
|
197
249
|
/**
|
|
198
250
|
* Queue the newest source and its compile options; the previous timer, if
|
|
199
251
|
* any, is replaced. Options are copied so a later mutation cannot change the
|
|
200
252
|
* permissions of an in-flight compile. An options-only edit still supersedes
|
|
201
253
|
* an older result for the same source.
|
|
254
|
+
*
|
|
255
|
+
* `sourcePhase` is optional. Streaming snapshots keep the debounce; a
|
|
256
|
+
* snapshot that explicitly declares `final` is dispatched immediately so it
|
|
257
|
+
* can replace a queued intermediate one and settle as soon as any in-flight
|
|
258
|
+
* compile returns. Calls that declare no phase keep the historical debounce
|
|
259
|
+
* and wire shape.
|
|
202
260
|
*/
|
|
203
|
-
schedule(source: string, options?: LocalCompileOptions, hint?: LocalCompileEditHint): void;
|
|
261
|
+
schedule(source: string, options?: LocalCompileOptions, hint?: LocalCompileEditHint, sourcePhase?: LocalSourcePhase): void;
|
|
204
262
|
/** Stop the timer and terminate the worker. No callbacks fire afterwards. */
|
|
205
263
|
dispose(): void;
|
|
206
264
|
private drain;
|
|
207
265
|
private compile;
|
|
208
266
|
private compileFallback;
|
|
267
|
+
/**
|
|
268
|
+
* The newest scheduled source revision identifies the current generation.
|
|
269
|
+
* Observer callbacks run between delivery steps and may schedule a newer
|
|
270
|
+
* source, which retires the running one.
|
|
271
|
+
*/
|
|
272
|
+
private isCurrentJob;
|
|
209
273
|
private receive;
|
|
210
274
|
/**
|
|
211
275
|
* Apply a patch response against the last accepted baseline. Returns null
|
|
212
276
|
* for any mismatch so the caller can resend a complete source once.
|
|
213
277
|
*/
|
|
214
278
|
private applyResponsePatch;
|
|
215
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Re-dispatch the same job with a complete source, at most once per job.
|
|
281
|
+
*
|
|
282
|
+
* The response trace runs observer callbacks before this call, and one may
|
|
283
|
+
* synchronously schedule an explicit final request that already reached the
|
|
284
|
+
* worker. The retry is sent only while this job is still the current source
|
|
285
|
+
* generation and no request is in flight, so it can never replace a newer
|
|
286
|
+
* request or deliver a stale failure.
|
|
287
|
+
*/
|
|
216
288
|
private recoverWithFullResult;
|
|
217
289
|
private handleWorkerFailure;
|
|
218
290
|
/** Permanently switch to the fallback; a crashed worker is never restarted. */
|
|
@@ -220,6 +292,8 @@ export declare class LocalCompileScheduler {
|
|
|
220
292
|
private resetProtocol;
|
|
221
293
|
private finishRun;
|
|
222
294
|
private deliver;
|
|
295
|
+
private traceWorker;
|
|
296
|
+
private reportStale;
|
|
223
297
|
private setPending;
|
|
224
298
|
private clearTimer;
|
|
225
299
|
}
|
|
@@ -38,6 +38,12 @@ export interface Diagnostic {
|
|
|
38
38
|
messageKey?: string;
|
|
39
39
|
/** Bounded scalar parameters for `messageKey`. */
|
|
40
40
|
params?: LocalDiagnosticParams;
|
|
41
|
+
/** Processing stage for host-side filtering and reporting. */
|
|
42
|
+
phase?: 'source' | 'parse' | 'semantic' | 'runtime' | 'worker' | 'resource' | 'export' | 'host';
|
|
43
|
+
/** Whether the affected operation can continue after this diagnostic. */
|
|
44
|
+
recoverable?: boolean;
|
|
45
|
+
/** Bounded, structured values safe to expose to host observers. */
|
|
46
|
+
details?: Readonly<Record<string, string | number | boolean>>;
|
|
41
47
|
}
|
|
42
48
|
export type LocalValue = string | number | boolean | null | string[] | number[];
|
|
43
49
|
/** `array` retains its existing meaning: a homogeneous string array. */
|
|
@@ -223,6 +229,18 @@ export interface LocalDocumentKernel {
|
|
|
223
229
|
inlineMathReads?: boolean;
|
|
224
230
|
}>>;
|
|
225
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Source generation phase supplied by a streaming host. Omitted keeps the
|
|
234
|
+
* historical final-compilation semantics; `strict` remains an independent
|
|
235
|
+
* structural-recovery switch.
|
|
236
|
+
*/
|
|
237
|
+
export type LocalSourcePhase = 'streaming' | 'final';
|
|
238
|
+
/**
|
|
239
|
+
* Compilation status. `partial` is only produced for an explicit streaming
|
|
240
|
+
* snapshot; final callers that do not opt into phases keep the historical
|
|
241
|
+
* result shape without a `status` field.
|
|
242
|
+
*/
|
|
243
|
+
export type LocalCompileStatus = 'partial' | 'valid' | 'recovered' | 'failed';
|
|
226
244
|
/** Compiler-produced documents contain only plain records, arrays and primitives. */
|
|
227
245
|
export interface LocalDocument {
|
|
228
246
|
syntax: 'local';
|
|
@@ -232,12 +250,12 @@ export interface LocalDocument {
|
|
|
232
250
|
/** Effective syntax revision; absent on older hand-built runtime documents. */
|
|
233
251
|
syntaxVersion?: 'local-draft-3';
|
|
234
252
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* original source is preserved and `nodes` carries one `htmlDocument` node
|
|
238
|
-
* whose `value` is the sanitized, complete iframe document.
|
|
253
|
+
* Policy on legacy whole-document HTML results. Mixed-source compilers
|
|
254
|
+
* record author content in `capabilities`.
|
|
239
255
|
*/
|
|
240
256
|
html?: LocalHtmlPolicy;
|
|
257
|
+
/** Serializable author content and its compile-time permission ceiling. */
|
|
258
|
+
capabilities?: LocalDocumentCapabilities;
|
|
241
259
|
versionDeclaration?: LocalVersionDeclaration;
|
|
242
260
|
nodes: LocalNode[];
|
|
243
261
|
initialState: Record<string, LocalValue>;
|
|
@@ -330,28 +348,33 @@ export interface LocalCompileLimits {
|
|
|
330
348
|
readonly maxMarkdownDepth?: number;
|
|
331
349
|
}
|
|
332
350
|
/**
|
|
333
|
-
* Host-owned capability flags for the
|
|
334
|
-
*
|
|
335
|
-
* All flags default to `false`. When every flag is false the existing
|
|
336
|
-
* Markdown/ReactiveMD pipeline runs unchanged. When any flag is true the whole
|
|
337
|
-
* source is interpreted as native HTML and rendered inside a sandboxed iframe;
|
|
338
|
-
* Markdown, interpolation, bindings, formulas and ReactiveMD components are not
|
|
339
|
-
* interpreted in that mode.
|
|
351
|
+
* Host-owned capability flags for the mixed Markdown and ReactiveMD pipeline.
|
|
340
352
|
*/
|
|
341
353
|
export interface LocalHtmlOptions {
|
|
342
|
-
/** Allow
|
|
354
|
+
/** Allow document styles and component declarations. Defaults to true. */
|
|
343
355
|
readonly enableCss?: boolean;
|
|
344
|
-
/** Allow
|
|
356
|
+
/** Allow author JavaScript in interactive mounts. Defaults to false. */
|
|
345
357
|
readonly enableJavaScript?: boolean;
|
|
346
|
-
/** Allow
|
|
358
|
+
/** Allow additional native HTML fragments. Defaults to false. */
|
|
347
359
|
readonly enableExtendedHtml?: boolean;
|
|
348
360
|
}
|
|
349
|
-
/**
|
|
361
|
+
/** Resolved document capability flags. */
|
|
350
362
|
export interface LocalHtmlPolicy {
|
|
351
363
|
readonly enableCss: boolean;
|
|
352
364
|
readonly enableJavaScript: boolean;
|
|
353
365
|
readonly enableExtendedHtml: boolean;
|
|
354
366
|
}
|
|
367
|
+
export interface LocalAuthorBlock {
|
|
368
|
+
readonly text: string;
|
|
369
|
+
readonly range: SourceRange;
|
|
370
|
+
}
|
|
371
|
+
export interface LocalDocumentCapabilities {
|
|
372
|
+
readonly policy: LocalHtmlPolicy;
|
|
373
|
+
readonly styles: readonly LocalAuthorBlock[];
|
|
374
|
+
readonly scripts: readonly LocalAuthorBlock[];
|
|
375
|
+
readonly componentStyles: Readonly<Record<string, string>>;
|
|
376
|
+
readonly actionTargets: Readonly<Record<string, string>>;
|
|
377
|
+
}
|
|
355
378
|
export type LocalHostPropKind = 'string' | 'number' | 'boolean' | 'enum';
|
|
356
379
|
export interface LocalHostPropSchema {
|
|
357
380
|
readonly kind: LocalHostPropKind;
|
|
@@ -391,6 +414,8 @@ export interface LocalHostComponentSchema {
|
|
|
391
414
|
readonly binding?: LocalHostBindingSchema;
|
|
392
415
|
}
|
|
393
416
|
export interface LocalCompileOptions extends LocalHtmlOptions {
|
|
417
|
+
/** Optional host observer for direct compiler calls. */
|
|
418
|
+
readonly observer?: import('./observability.js').LocalObserver;
|
|
394
419
|
readonly limits?: LocalCompileLimits;
|
|
395
420
|
/**
|
|
396
421
|
* Render ordinary Markdown soft line breaks as `<br>`.
|
|
@@ -418,17 +443,36 @@ export interface LocalCompileOptions extends LocalHtmlOptions {
|
|
|
418
443
|
* errors remain errors. Only booleans are accepted.
|
|
419
444
|
*/
|
|
420
445
|
readonly strict?: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Marks the snapshot as still being generated. Omitted or `final` keeps the
|
|
448
|
+
* historical final-compilation semantics, including `strict` recovery.
|
|
449
|
+
* `streaming` selects provisional rendering and diagnostics; it is not part
|
|
450
|
+
* of the compile identity and must not be used as a structural-recovery
|
|
451
|
+
* switch. Only accepted values are `streaming` and `final`.
|
|
452
|
+
*/
|
|
453
|
+
readonly sourcePhase?: LocalSourcePhase;
|
|
421
454
|
}
|
|
422
|
-
/**
|
|
455
|
+
/**
|
|
456
|
+
* Public compiler output is plain data, including nested attributes and
|
|
457
|
+
* dependencies. `status` and `transientDiagnostics` are present only for
|
|
458
|
+
* callers that explicitly supplied a source phase; legacy callers keep the
|
|
459
|
+
* historical shape.
|
|
460
|
+
*/
|
|
423
461
|
export type LocalCompileResult = {
|
|
424
462
|
ok: true;
|
|
425
463
|
document: LocalDocument;
|
|
426
464
|
diagnostics: Diagnostic[];
|
|
427
465
|
recoveries?: LocalRecovery[];
|
|
466
|
+
status?: Exclude<LocalCompileStatus, 'failed'>;
|
|
467
|
+
/** Fixable issues from a streaming snapshot; never merged into `diagnostics`. */
|
|
468
|
+
transientDiagnostics?: Diagnostic[];
|
|
428
469
|
} | {
|
|
429
470
|
ok: false;
|
|
430
471
|
diagnostics: Diagnostic[];
|
|
431
472
|
recoveries?: LocalRecovery[];
|
|
473
|
+
status?: 'failed';
|
|
474
|
+
/** Fixable issues observed before a deterministic failure. */
|
|
475
|
+
transientDiagnostics?: Diagnostic[];
|
|
432
476
|
};
|
|
433
477
|
/**
|
|
434
478
|
* Frozen state of the current revision. It contains controls, successful
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createDiagnosticReport, createLocalObservabilityDiagnostic, } from './local/observability.js';
|
|
2
|
+
export { createLocalTraceId, emitLocalDiagnostic, emitLocalTrace } from './local/observability-core.js';
|
|
3
|
+
export { LOCAL_OBSERVABILITY_MESSAGES, formatObservabilityMessage } from './local/observability-messages.js';
|
|
4
|
+
export type { DiagnosticReportOptions, LocalDiagnosticReport, LocalObserver, LocalTraceEvent, } from './local/observability.js';
|
|
5
|
+
export type { LocalObservabilityMessageKey } from './local/observability-messages.js';
|
|
6
|
+
export { formatLocalDiagnostic } from './local/configuration/diagnostics.js';
|
|
7
|
+
export type { Diagnostic, SourceRange } from './local/types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType, type ReactNode } from 'react';
|
|
1
|
+
import { type ComponentType, type CSSProperties, type ReactNode } from 'react';
|
|
2
2
|
import type { Diagnostic, LocalNode, LocalRuntime, LocalSnapshot, LocalSubmissionFieldCheck, LocalSubmissionFieldsResult, LocalValue, SourceRange } from '../local/types.js';
|
|
3
3
|
import type { LocalRenderMode, LocalSourceTarget } from '../local/rendering/render-types.js';
|
|
4
4
|
import type { LocalUrlPolicy } from '../local/rendering/document/LocalDocumentView.js';
|
|
@@ -149,6 +149,12 @@ export interface LocalComponentServices {
|
|
|
149
149
|
/** Context passed to every SDK component. It contains no AST. */
|
|
150
150
|
export interface LocalComponentContext {
|
|
151
151
|
readonly props: Readonly<Record<string, LocalComponentValue>>;
|
|
152
|
+
/** Author declarations for the component's visible root. */
|
|
153
|
+
readonly authorStyle?: CSSProperties;
|
|
154
|
+
/** Sanitized ordered declarations when repeated properties need browser fallbacks. */
|
|
155
|
+
readonly authorStyleText?: string;
|
|
156
|
+
/** Return true when the current mount delegates this action to author JavaScript. */
|
|
157
|
+
readonly dispatchAuthorAction?: (action: import('../local/runtime/author-script-protocol.js').AuthorAction) => boolean;
|
|
152
158
|
readonly content: LocalComponentContent;
|
|
153
159
|
readonly services: LocalComponentServices;
|
|
154
160
|
readonly bindings: {
|
|
@@ -203,6 +209,9 @@ export interface LocalReactPreset {
|
|
|
203
209
|
* internal nodes only to `component-api`, never to component implementations.
|
|
204
210
|
*/
|
|
205
211
|
export interface LocalComponentAdapterEnvironment {
|
|
212
|
+
readonly authorStyle?: LocalComponentContext['authorStyle'];
|
|
213
|
+
readonly authorStyleText?: LocalComponentContext['authorStyleText'];
|
|
214
|
+
readonly dispatchAuthorAction?: LocalComponentContext['dispatchAuthorAction'];
|
|
206
215
|
readonly runtime: LocalRuntime;
|
|
207
216
|
readonly network?: ComponentNetwork;
|
|
208
217
|
/** Optional runtime-scoped services. Falls back to detached services. */
|
|
@@ -94,12 +94,20 @@ export declare function numericRange(context: LocalComponentContext, minName: st
|
|
|
94
94
|
};
|
|
95
95
|
export declare const EMPTY_STATIC_VALUE = "\u2014";
|
|
96
96
|
export declare function staticText(value: string): string;
|
|
97
|
-
export declare function
|
|
97
|
+
export declare function useAuthorComponentRoot(context: LocalComponentContext): (defaults?: CSSProperties) => {
|
|
98
|
+
style: CSSProperties | undefined;
|
|
99
|
+
ref: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
style: CSSProperties;
|
|
102
|
+
ref: (element: HTMLElement | null) => void;
|
|
103
|
+
};
|
|
104
|
+
export declare function StaticValue({ label, value, hint, className, multiline, authorRoot, }: {
|
|
98
105
|
label: string;
|
|
99
106
|
value: ReactNode;
|
|
100
107
|
hint?: ReactNode;
|
|
101
108
|
className?: string;
|
|
102
109
|
multiline?: boolean;
|
|
110
|
+
authorRoot?: ReturnType<ReturnType<typeof useAuthorComponentRoot>>;
|
|
103
111
|
}): import("react").JSX.Element;
|
|
104
112
|
export declare function PrintValue({ value, block }: {
|
|
105
113
|
value: ReactNode;
|
|
@@ -7,12 +7,15 @@ import type { LocalThemePackage } from '../sdk/theme.js';
|
|
|
7
7
|
import type { LocalRuntimeServices } from '../runtime-services/runtime.js';
|
|
8
8
|
import type { ComponentNetwork } from '../runtime-services/network.js';
|
|
9
9
|
import type { LocalComponentDefinition, LocalConfig } from '../sdk/types.js';
|
|
10
|
-
import { type LocalComponentContext, type LocalReactComponent, type LocalReactPreset } from './component-api.js';
|
|
10
|
+
import { type LocalComponentAdapterEnvironment, type LocalComponentContext, type LocalReactComponent, type LocalReactPreset } from './component-api.js';
|
|
11
11
|
export type { LocalComponentRender } from './component-api.js';
|
|
12
12
|
export { defineReactComponent, type LocalComponentBindingHandle, type LocalComponentContext, type LocalComponentInstance, type LocalComponentPropValue, type LocalComponentSetResult, type LocalComponentValue, type LocalReactComponent, type LocalReactComponentImplementation, type LocalReactPreset, } from './component-api.js';
|
|
13
13
|
/** Everything a renderer needs from the document view. */
|
|
14
14
|
export interface LocalReactRenderEnvironment {
|
|
15
15
|
runtime: LocalRuntime;
|
|
16
|
+
authorStyle?: LocalComponentAdapterEnvironment['authorStyle'];
|
|
17
|
+
authorStyleText?: LocalComponentAdapterEnvironment['authorStyleText'];
|
|
18
|
+
dispatchAuthorAction?: LocalComponentAdapterEnvironment['dispatchAuthorAction'];
|
|
16
19
|
network?: ComponentNetwork;
|
|
17
20
|
/** Runtime-scoped services; omitted only by hand-built render environments. */
|
|
18
21
|
services?: LocalRuntimeServices;
|
|
@@ -11,6 +11,8 @@ export type ShareableHtmlMode = 'interactive' | 'static';
|
|
|
11
11
|
export type ShareableAssetMode = 'inline' | 'omit';
|
|
12
12
|
export interface ShareableMountPayload {
|
|
13
13
|
version: 1 | 2;
|
|
14
|
+
/** Source interpretation, independent of the restoration envelope. */
|
|
15
|
+
sourceSemantics?: 'mixed-rmd-v1';
|
|
14
16
|
target: string;
|
|
15
17
|
source: string;
|
|
16
18
|
state: LocalStateFile;
|
|
@@ -37,7 +39,7 @@ export interface ShareableHtmlOptions {
|
|
|
37
39
|
title: string;
|
|
38
40
|
source: string;
|
|
39
41
|
state: LocalStateFile;
|
|
40
|
-
/**
|
|
42
|
+
/** Trusted static markup. Render it with the same CSS and Extended HTML grants as the export. */
|
|
41
43
|
staticMarkup: string;
|
|
42
44
|
/** Trusted host stylesheet, normally the built reactive-md.css. */
|
|
43
45
|
css: string;
|
|
@@ -61,9 +63,8 @@ export interface ShareableHtmlOptions {
|
|
|
61
63
|
notices?: string;
|
|
62
64
|
targetId?: string;
|
|
63
65
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* re-sanitized with author JavaScript forced off.
|
|
66
|
+
* Capabilities granted by the host and used to compile this document.
|
|
67
|
+
* Interactive exports replay them after state restoration.
|
|
67
68
|
*/
|
|
68
69
|
compileOptions?: LocalCompileOptions;
|
|
69
70
|
/** Companion component requirements, separate from the v1 state format. */
|
|
@@ -18,4 +18,4 @@ export interface PreparedStandaloneDocument {
|
|
|
18
18
|
* `compileOptions` replays the capability flags and limits an export was
|
|
19
19
|
* created with; omitting them keeps the default ReactiveMD route.
|
|
20
20
|
*/
|
|
21
|
-
export declare function prepareStandaloneDocument(source: string, state?: LocalStateFile | string, theme?: string, compileOptions?: LocalCompileOptions, beforeState?: (document: LocalDocument) => void): PreparedStandaloneDocument;
|
|
21
|
+
export declare function prepareStandaloneDocument(source: string, state?: LocalStateFile | string, theme?: string, compileOptions?: LocalCompileOptions, beforeState?: (document: LocalDocument) => void, legacyPayload?: boolean): PreparedStandaloneDocument;
|
|
@@ -23,8 +23,7 @@ export interface ReactiveMDMountOptions {
|
|
|
23
23
|
hydrate?: boolean;
|
|
24
24
|
generator?: LocalStateGenerator;
|
|
25
25
|
/**
|
|
26
|
-
* Capability flags and limits used by the export.
|
|
27
|
-
* payload values enable the native HTML route; source text and state never do.
|
|
26
|
+
* Capability flags and limits used by the export.
|
|
28
27
|
*/
|
|
29
28
|
compileOptions?: LocalCompileOptions;
|
|
30
29
|
/** Trusted implementations explicitly installed by the standalone host. */
|
|
@@ -47,6 +46,8 @@ export interface ReactiveMDHandle {
|
|
|
47
46
|
}
|
|
48
47
|
/** Internal hooks used by the Web Component; not part of the public mount API. */
|
|
49
48
|
export interface StandaloneHostHooks {
|
|
49
|
+
/** Version 1 and 2 payloads created before sourceSemantics was introduced. */
|
|
50
|
+
legacyPayload?: boolean;
|
|
50
51
|
/** Host-only theme override, applied to an immutable document clone. */
|
|
51
52
|
theme?: string;
|
|
52
53
|
onDiagnostics?: (diagnostics: Diagnostic[]) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as e } from "./compiler-core-DDDdvuLy.js";
|
|
2
2
|
// src/compiler/result.ts
|
|
3
3
|
var t = Object.freeze({ optional: Object.freeze([]) }), n = Object.freeze({ optional: Object.freeze([Object.freeze({
|
|
4
4
|
id: "math-display",
|