reactive-md 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +54 -4
- package/CHANGELOG.md +55 -4
- package/CONTRIBUTING-ch.md +13 -2
- package/CONTRIBUTING.md +13 -2
- package/README-ch.md +132 -23
- package/README-en.md +130 -21
- package/README.md +128 -21
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/args.mjs +51 -1
- package/cli/assets.mjs +6 -1
- package/cli/build.mjs +125 -9
- package/cli/fs-utils.mjs +3 -3
- package/cli/help.mjs +12 -5
- package/cli/init.mjs +1 -1
- package/cli/package.mjs +1 -0
- package/dist-library/LocalDocumentView-sthUP0ct.js +109 -0
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-BsfSwQRm.js → authoring-Dsune4Hy.js} +240 -218
- package/dist-library/compile-wUv8KEge.js +1249 -0
- package/dist-library/{compiler-core-kPiH-gOV.js → compiler-core-As_m-MNm.js} +5372 -5559
- package/dist-library/compiler-eOfcinZs.js +62 -0
- package/dist-library/component-state-BoLCGee4.js +801 -0
- package/dist-library/{component-state-D_cw_EHe.js → component-state-C52ZFJGl.js} +2 -2
- package/dist-library/{registry-B9Jc3FVe.js → config-BadfhjdP.js} +374 -457
- package/dist-library/{config-validation-DXTynAw7.js → config-validation-F47AcE6o.js} +549 -751
- package/dist-library/controls-CcT6n7k_.js +6740 -0
- package/dist-library/coordinate-CWS9p5q_.js +293 -0
- package/dist-library/data-table-Bgccxd7h.js +296 -0
- package/dist-library/{default-components-Z_YMio5P.js → default-components-BwQf0oP-.js} +344 -334
- package/dist-library/{math-display-BJz4gbFc.js → display-B-VhqVND.js} +1299 -1299
- package/dist-library/export-BqVmTXm8.js +369 -0
- package/dist-library/gallery-CY6mTx8i.js +360 -0
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{math-sample-BGEW49zY.js → incremental-Dv0FSp_U.js} +476 -394
- package/dist-library/latex-1w7aQgD5.js +928 -0
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/mount-preset-KxvtKgJb.js +13 -0
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{react-ByOHunUW.js → package-core-WFK1RhAZ.js} +49 -55
- package/dist-library/{parser-standard-DlCk7sLo.js → parser-standard-Yuf3A_VI.js} +6605 -7097
- package/dist-library/plugin-packs-B1XPWcFs.js +18 -0
- package/dist-library/{identity-MYJXKSkB.js → preset-core-CKc5YXSM.js} +31 -31
- package/dist-library/{props-DGlBk0e5.js → props-sJ8vk0cr.js} +1 -1
- package/dist-library/react-BbyAgeXc.js +6070 -0
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +222 -223
- package/dist-library/reactive-md-build.js +126 -72
- package/dist-library/reactive-md-compiler-standard.js +12 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +2 -2
- package/dist-library/reactive-md-default-preset.js +4 -4
- package/dist-library/reactive-md-export-assets.js +57 -0
- package/dist-library/reactive-md-export.js +5 -111
- package/dist-library/reactive-md-minimal-preset.js +24 -0
- package/dist-library/reactive-md-minimal-react-preset.js +26 -0
- package/dist-library/reactive-md-minimal-styles.js +80 -0
- package/dist-library/reactive-md-minimal.css +2 -0
- package/dist-library/reactive-md-pdf.js +7582 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -0
- package/dist-library/reactive-md-plugin-data.js +17 -0
- package/dist-library/reactive-md-plugin-diagram.js +18 -0
- package/dist-library/reactive-md-plugin-forms.js +18 -0
- package/dist-library/reactive-md-plugin-gallery.js +12 -0
- package/dist-library/reactive-md-plugin-navigation.js +15 -0
- package/dist-library/reactive-md-plugin-network.js +222 -0
- package/dist-library/reactive-md-plugin-plot.js +24 -0
- package/dist-library/reactive-md-print.css +5 -0
- package/dist-library/reactive-md-react-minimal.js +28 -0
- package/dist-library/reactive-md-react-server.js +34 -32
- package/dist-library/reactive-md-react-unstyled.js +14 -9
- package/dist-library/reactive-md-react.js +14 -9
- package/dist-library/reactive-md-runtime-browser.js +847 -15
- package/dist-library/reactive-md-runtime.js +3 -3
- package/dist-library/reactive-md-sdk.js +8 -6
- package/dist-library/reactive-md-standalone-configured.js +16 -0
- package/dist-library/reactive-md-standalone-host.js +9 -438
- package/dist-library/reactive-md-testing-browser.js +5 -4
- package/dist-library/reactive-md-testing-react.js +46 -44
- package/dist-library/reactive-md-testing.js +45 -44
- package/dist-library/reactive-md-vite.js +135 -37
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +590 -498
- package/dist-library/registry-B9NGct4d.js +20 -0
- package/dist-library/registry-core-Bbad9Bm2.js +479 -0
- package/dist-library/{resources-BGt8mpDA.js → resources-D2GDQS0p.js} +45 -45
- package/dist-library/{runtime-Dkq7ldyg.js → runtime-B2fxeveq.js} +1 -1
- package/dist-library/runtime-kcA7bG7G.js +1282 -0
- package/dist-library/sample-bP4zHB3L.js +289 -0
- package/dist-library/{schema-ZFufO8V0.js → schema-BufhKUSM.js} +12 -11
- package/dist-library/sdk-core-BoJT1SIt.js +1166 -0
- package/dist-library/session-core-nmJHuR9c.js +452 -0
- package/dist-library/{shareable-DDVL4Fi9.js → shareable-DpbE-59H.js} +250 -283
- package/dist-library/tooltip-layer-HDLrSWs0.js +28 -0
- package/dist-library/types/authoring/catalog.d.ts +2 -3
- package/dist-library/types/authoring/editor-i18n.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/authoring/insert.d.ts +1 -1
- package/dist-library/types/authoring/templates.d.ts +2 -2
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/build/host.d.ts +1 -1
- package/dist-library/types/build/index.d.ts +1 -1
- package/dist-library/types/build/notices.d.ts +1 -1
- package/dist-library/types/build/resources.d.ts +1 -1
- package/dist-library/types/build/vite.d.ts +1 -1
- package/dist-library/types/compiler/index.d.ts +2 -2
- package/dist-library/types/compiler/result.d.ts +1 -1
- package/dist-library/types/compiler/standard.d.ts +2 -2
- package/dist-library/types/compiler/types.d.ts +1 -1
- package/dist-library/types/components/{controls.d.ts → controls/controls.d.ts} +2 -3
- package/dist-library/types/components/{numeric-sliders.d.ts → controls/numeric-sliders.d.ts} +1 -1
- package/dist-library/types/components/{gallery.d.ts → gallery/gallery.d.ts} +1 -1
- package/dist-library/types/components/{layout.d.ts → layout/layout.d.ts} +1 -1
- package/dist-library/types/components/minimal-preset.d.ts +2 -0
- package/dist-library/types/components/mount-preset.d.ts +4 -0
- package/dist-library/types/components/network/submit-button.d.ts +10 -0
- package/dist-library/types/components/plot/coordinate.d.ts +2 -0
- package/dist-library/types/components/plugins/chart.d.ts +2 -0
- package/dist-library/types/components/plugins/data.d.ts +2 -0
- package/dist-library/types/components/plugins/diagram.d.ts +2 -0
- package/dist-library/types/components/plugins/forms.d.ts +2 -0
- package/dist-library/types/components/plugins/gallery.d.ts +2 -0
- package/dist-library/types/components/plugins/navigation.d.ts +2 -0
- package/dist-library/types/components/plugins/network.d.ts +2 -0
- package/dist-library/types/components/plugins/plot.d.ts +2 -0
- package/dist-library/types/components/shared/visual-frame.d.ts +12 -0
- package/dist-library/types/components/{visuals.d.ts → shared/visuals.d.ts} +1 -7
- package/dist-library/types/components/{data-table.d.ts → table/data-table.d.ts} +2 -2
- package/dist-library/types/export/component-state.d.ts +1 -1
- package/dist-library/types/export/index.d.ts +2 -1
- package/dist-library/types/export/print-document.d.ts +18 -0
- package/dist-library/types/export/render-markup.d.ts +23 -0
- package/dist-library/types/export/requirements.d.ts +1 -1
- package/dist-library/types/export/resources.d.ts +1 -1
- package/dist-library/types/export/restoration.d.ts +1 -1
- package/dist-library/types/export-assets/index.d.ts +25 -0
- package/dist-library/types/local/compilation/compiler-attributes.d.ts +8 -0
- package/dist-library/types/local/compilation/compiler-bindings.d.ts +19 -0
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +32 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +32 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +62 -16
- package/dist-library/types/local/compilation/compiler-structure.d.ts +38 -3
- package/dist-library/types/local/compilation/compiler-tables.d.ts +30 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +15 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +39 -1
- package/dist-library/types/local/compilation/compiler.d.ts +7 -14
- package/dist-library/types/local/compilation/dependencies.d.ts +1 -1
- package/dist-library/types/local/compilation/session/incremental.d.ts +75 -0
- package/dist-library/types/local/{session → compilation/session}/row-reuse.d.ts +1 -1
- package/dist-library/types/local/{session/compiler-cache.d.ts → compilation/session/semantic-cache.d.ts} +5 -19
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/{compilation → configuration}/component-kernel.d.ts +3 -79
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +1104 -1056
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +731 -0
- package/dist-library/types/local/configuration/diagnostics.d.ts +1 -1
- package/dist-library/types/local/configuration/kernel-value-rules.d.ts +66 -0
- package/dist-library/types/local/configuration/official-leaf-syntax.d.ts +24 -0
- package/dist-library/types/local/configuration/options-core.d.ts +5 -4
- package/dist-library/types/local/configuration/options.d.ts +2 -1
- package/dist-library/types/local/configuration/portable-options.d.ts +1 -1
- package/dist-library/types/local/configuration/schema-core.d.ts +1 -1
- package/dist-library/types/local/configuration/schema.d.ts +1 -1
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/evaluation/computations.d.ts +2 -2
- package/dist-library/types/local/evaluation/expression/compile.d.ts +30 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -0
- package/dist-library/types/local/evaluation/expression/inference.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +72 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +56 -0
- package/dist-library/types/local/evaluation/{math-display.d.ts → math/display.d.ts} +2 -2
- package/dist-library/types/local/evaluation/math/evaluation.d.ts +10 -0
- package/dist-library/types/local/evaluation/{math.d.ts → math/latex.d.ts} +58 -17
- package/dist-library/types/local/evaluation/{math-sample.d.ts → math/sample.d.ts} +4 -2
- package/dist-library/types/local/evaluation/math/syntax.d.ts +72 -0
- package/dist-library/types/local/evaluation/validation.d.ts +1 -1
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html-details.d.ts +1 -1
- package/dist-library/types/local/html/html-entities.d.ts +11 -2
- package/dist-library/types/local/html/html-recovery.d.ts +1 -1
- package/dist-library/types/local/html/html-table.d.ts +1 -1
- package/dist-library/types/local/html/html.d.ts +40 -4
- package/dist-library/types/local/index.d.ts +14 -13
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/{markdown → parsing}/fast-markdown.d.ts +1 -1
- package/dist-library/types/local/{markdown → parsing}/footnotes.d.ts +1 -1
- package/dist-library/types/local/{markdown → parsing}/heading-anchors.d.ts +1 -1
- package/dist-library/types/local/parsing/html-attributes.d.ts +14 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +1 -1
- package/dist-library/types/local/{session → parsing}/parse-session.d.ts +5 -5
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +7 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +26 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +10 -4
- package/dist-library/types/local/parsing/parser-internals.d.ts +54 -0
- package/dist-library/types/local/parsing/parser-region.d.ts +46 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +3 -0
- package/dist-library/types/local/parsing/parser-tags.d.ts +108 -0
- package/dist-library/types/local/parsing/parser.d.ts +3 -3
- package/dist-library/types/local/{markdown → parsing}/plain-paragraphs.d.ts +1 -1
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +1 -1
- package/dist-library/types/local/parsing/theme-declaration.d.ts +22 -0
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentView.d.ts +5 -0
- package/dist-library/types/local/rendering/{LocalDocumentView.d.ts → document/LocalDocumentViewCore.d.ts} +48 -9
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
- package/dist-library/types/local/rendering/document/render-nodes.d.ts +24 -0
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/use-color-scheme.d.ts +10 -0
- package/dist-library/types/local/rendering/document/validation-state.d.ts +31 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +146 -0
- package/dist-library/types/local/rendering/{view-revision.d.ts → document/view-revision.d.ts} +31 -4
- package/dist-library/types/local/rendering/render-types.d.ts +1 -1
- package/dist-library/types/local/{widgets/table-surface.d.ts → rendering/table/data-table.d.ts} +3 -0
- package/dist-library/types/local/rendering/table/table-numeric-columns.d.ts +7 -0
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/runtime/retention.d.ts +1 -1
- package/dist-library/types/local/runtime/runtime-document.d.ts +71 -0
- package/dist-library/types/local/runtime/runtime-migration.d.ts +19 -0
- package/dist-library/types/local/runtime/runtime-values.d.ts +39 -0
- package/dist-library/types/local/runtime/runtime.d.ts +4 -2
- package/dist-library/types/local/runtime/state.d.ts +1 -1
- package/dist-library/types/local/source/authoring-syntax.d.ts +48 -0
- package/dist-library/types/local/source/authoring.d.ts +1 -1
- package/dist-library/types/local/source/source-context.d.ts +23 -0
- package/dist-library/types/local/source/source-migration.d.ts +2 -2
- package/dist-library/types/local/transport/compile-patch.d.ts +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +1 -1
- package/dist-library/types/local/transport/shared-data.d.ts +1 -1
- package/dist-library/types/local/transport/worker-handler.d.ts +30 -0
- package/dist-library/types/local/transport/worker-job.d.ts +28 -0
- package/dist-library/types/local/transport/worker.d.ts +32 -46
- package/dist-library/types/local/{contracts/types.d.ts → types.d.ts} +78 -21
- package/dist-library/types/pdf.d.ts +22 -0
- package/dist-library/types/presets/identity.d.ts +1 -0
- package/dist-library/types/presets/minimal.d.ts +2 -0
- package/dist-library/types/presets/plugin-packs.d.ts +1 -0
- package/dist-library/types/react/component-api.d.ts +20 -4
- package/dist-library/types/react/component-primitives.d.ts +10 -10
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/index.d.ts +6 -5
- package/dist-library/types/{local/theme/i18n.d.ts → react/localization.d.ts} +2 -2
- package/dist-library/types/react/minimal.d.ts +13 -0
- package/dist-library/types/react/package-core.d.ts +67 -0
- package/dist-library/types/react/package.d.ts +3 -67
- package/dist-library/types/react/runtime/common.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +115 -0
- package/dist-library/types/react/sdk.d.ts +4 -110
- package/dist-library/types/react/server.d.ts +2 -2
- package/dist-library/types/react/use-draft-field.d.ts +5 -1
- package/dist-library/types/runtime-services/browser/duplex.d.ts +163 -0
- package/dist-library/types/runtime-services/browser/http-sse.d.ts +117 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +2 -1
- package/dist-library/types/runtime-services/component-state.d.ts +1 -1
- package/dist-library/types/runtime-services/index.d.ts +2 -0
- package/dist-library/types/runtime-services/network.d.ts +86 -0
- package/dist-library/types/runtime-services/runtime.d.ts +1 -1
- package/dist-library/types/sdk/config.d.ts +1 -1
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/props.d.ts +1 -1
- package/dist-library/types/sdk/registry-core.d.ts +1 -1
- package/dist-library/types/sdk/theme.d.ts +5 -4
- package/dist-library/types/sdk/types.d.ts +2 -2
- package/dist-library/types/shareable.d.ts +6 -5
- package/dist-library/types/standalone/diagnostics.d.ts +1 -1
- package/dist-library/types/standalone/host.d.ts +5 -0
- package/dist-library/types/standalone/payload.d.ts +1 -1
- package/dist-library/types/standalone/prepare.d.ts +2 -2
- package/dist-library/types/standalone/session-core.d.ts +68 -0
- package/dist-library/types/standalone/session.d.ts +6 -68
- package/dist-library/types/themes/contract.d.ts +7 -0
- package/dist-library/types/{local/theme/theme.d.ts → themes/document-theme.d.ts} +4 -3
- package/dist-library/types/vite/client.d.ts +19 -0
- package/dist-library/types/vite/index.d.ts +18 -3
- package/dist-library/types/vite/registration.d.ts +2 -2
- package/dist-library/{types-BFCrMrg0.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/validation-BEBA_HvS.js +1121 -0
- package/dist-library/visual-frame-CyV1FXzs.js +48 -0
- package/dist-library/visuals-B5KSafVk.js +3 -0
- package/dist-library/visuals-BZbZYA7w.js +72572 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +146 -137
- package/docs/README-ch.md +16 -11
- package/docs/README.md +16 -11
- package/docs/compatibility/compatibility-ch.md +8 -8
- package/docs/compatibility/compatibility-en.md +8 -8
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +4 -4
- package/docs/development/component-development-reference-en.md +4 -4
- package/docs/development/component-protocol-ch.md +14 -14
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/development/extension-tutorial-ch.md +308 -0
- package/docs/development/extension-tutorial-en.md +308 -0
- package/docs/development/local-module-layout-ch.md +10 -50
- package/docs/development/local-module-layout-en.md +9 -49
- package/docs/development/performance-overview-ch.md +174 -154
- package/docs/development/performance-overview-en.md +174 -154
- package/docs/guides/local-guide-ch.md +2 -2
- package/docs/guides/local-guide-en.md +2 -2
- package/docs/integration/author-tools-ch.md +2 -2
- package/docs/integration/author-tools-en.md +2 -2
- package/docs/integration/compiler-ch.md +4 -2
- package/docs/integration/compiler-en.md +4 -2
- package/docs/integration/directory-discovery-ch.md +5 -1
- package/docs/integration/directory-discovery-en.md +5 -1
- package/docs/integration/editor-ch.md +35 -5
- package/docs/integration/editor-en.md +42 -4
- package/docs/integration/extension-sdk-ch.md +6 -4
- package/docs/integration/extension-sdk-en.md +6 -4
- package/docs/integration/local-integration-ch.md +201 -19
- package/docs/integration/local-integration-en.md +194 -18
- package/docs/integration/network-host-ch.md +75 -0
- package/docs/integration/network-host-en.md +75 -0
- package/docs/integration/shareable-export-ch.md +58 -16
- package/docs/integration/shareable-export-en.md +57 -15
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/local-interaction-syntax-ch.md +199 -26
- package/docs/reference/local-interaction-syntax-en.md +194 -27
- package/docs/reference/public-api-ch.md +416 -0
- package/docs/reference/public-api-en.md +416 -0
- package/docs/reference/theme-protocol-ch.md +27 -8
- package/docs/reference/theme-protocol-en.md +46 -8
- package/docs/releases/release-0.4.0-ch.md +2 -2
- package/docs/releases/release-0.4.0-en.md +2 -2
- package/docs/releases/release-0.8.0-ch.md +19 -3
- package/docs/releases/release-0.8.0-en.md +19 -3
- package/docs/releases/release-0.9.0-ch.md +44 -0
- package/docs/releases/release-0.9.0-en.md +44 -0
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/game-2048-package/README-ch.md +3 -9
- package/examples/game-2048-package/README.md +8 -12
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/local/README-ch.md +3 -3
- package/examples/local/README.md +2 -2
- package/examples/local/minimal-budget.reactive.md +48 -0
- package/examples/minimal-extension/README-ch.md +78 -0
- package/examples/minimal-extension/README.md +78 -0
- package/examples/minimal-extension/index.html +15 -0
- package/examples/minimal-extension/package.json +26 -0
- package/examples/minimal-extension/sample/document.reactive.md +10 -0
- package/examples/minimal-extension/scripts/build.mjs +32 -0
- package/examples/minimal-extension/scripts/export.mjs +72 -0
- package/examples/minimal-extension/scripts/test-node.mjs +75 -0
- package/examples/minimal-extension/src/extension.tsx +90 -0
- package/examples/minimal-extension/src/preview.tsx +12 -0
- package/examples/minimal-extension/src/source.ts +4 -0
- package/examples/minimal-extension/tsconfig.json +14 -0
- package/examples/network-survey/README.md +200 -0
- package/examples/network-survey/index.html +49 -0
- package/examples/network-survey/package.json +26 -0
- package/examples/network-survey/sample/document.reactive.md +51 -0
- package/examples/network-survey/src/components.tsx +325 -0
- package/examples/network-survey/src/host.ts +316 -0
- package/examples/network-survey/src/main.tsx +91 -0
- package/examples/network-survey/src/source.ts +1 -0
- package/examples/network-survey/tsconfig.json +26 -0
- package/examples/network-survey/vite.config.ts +227 -0
- package/examples/sci-fi-theme/README-ch.md +4 -2
- package/examples/sci-fi-theme/README.md +4 -2
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -0
- package/examples/sci-fi-theme/demo/demo.css +129 -23
- package/examples/sci-fi-theme/demo/document.reactive.md +27 -6
- package/examples/sci-fi-theme/demo/main.tsx +45 -10
- package/examples/sci-fi-theme/docs/design-system-ch.md +6 -6
- package/examples/sci-fi-theme/package.json +2 -1
- package/examples/sci-fi-theme/src/components.css +1064 -154
- package/examples/sci-fi-theme/src/notch.css +142 -0
- package/examples/sci-fi-theme/src/sci-fi.css +3 -1
- package/examples/sci-fi-theme/src/theme.ts +2 -0
- package/examples/sci-fi-theme/src/tokens.css +512 -408
- package/examples/tetris-package/README-ch.md +4 -4
- package/examples/tetris-package/README.md +4 -4
- package/package.json +70 -3
- package/dist-library/LocalDocumentView-6trX7xJc.js +0 -97920
- package/dist-library/compiler--ea2CKQF.js +0 -61
- package/dist-library/component-state-Cq2K5gkS.js +0 -490
- package/dist-library/options-CX5m5n-J.js +0 -115
- package/dist-library/runtime-C-sbfpOX.js +0 -1157
- package/dist-library/types/local/contracts/locale.d.ts +0 -1
- package/dist-library/types/local/contracts/version.d.ts +0 -2
- package/dist-library/types/local/evaluation/dates.d.ts +0 -2
- package/dist-library/types/local/evaluation/expression.d.ts +0 -47
- package/dist-library/types/local/markdown/markdown-structure.d.ts +0 -3
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +0 -36
- package/dist-library/types/local/session/incremental.d.ts +0 -48
- package/dist-library/types/local/source/node-walk.d.ts +0 -3
- package/dist-library/types/local/source/text-length.d.ts +0 -13
- package/dist-library/types/local/theme/theme-name.d.ts +0 -3
- package/dist-library/types/local/widgets/visuals.d.ts +0 -25
- package/dist-library/types/react/default-theme.d.ts +0 -6
- package/dist-library/validation-W-bmny-x.js +0 -2253
- package/docs/development/releasing-ch.md +0 -12
- package/docs/development/releasing-en.md +0 -12
- package/docs/integration/codemirror-ch.md +0 -52
- package/docs/integration/codemirror-en.md +0 -29
- package/docs/integration/repository-split-ch.md +0 -40
- package/docs/integration/repository-split-en.md +0 -23
- package/docs/reference/computations-formatting-ch.md +0 -89
- package/docs/reference/computations-formatting-en.md +0 -89
- package/docs/reference/constraints-collections-ch.md +0 -104
- package/docs/reference/constraints-collections-en.md +0 -104
- package/docs/reference/local-components-v2-ch.md +0 -140
- package/docs/reference/local-components-v2-en.md +0 -106
- package/docs/reference/tolerance-ch.md +0 -64
- package/docs/reference/tolerance-en.md +0 -57
- /package/dist-library/types/components/{chart-motion.d.ts → chart/chart-motion.d.ts} +0 -0
- /package/dist-library/types/components/{default-chart-types.d.ts → chart/default-chart-types.d.ts} +0 -0
- /package/dist-library/types/components/{default-chart.d.ts → chart/default-chart.d.ts} +0 -0
- /package/dist-library/types/components/{diagram-inspector.d.ts → diagram/diagram-inspector.d.ts} +0 -0
- /package/dist-library/types/{local/widgets/diagram-layout.d.ts → components/diagram/layout.d.ts} +0 -0
- /package/dist-library/types/components/{mafs-plot-grid.d.ts → plot/mafs-plot-grid.d.ts} +0 -0
- /package/dist-library/types/components/{mafs-visuals.d.ts → plot/mafs-visuals.d.ts} +0 -0
- /package/dist-library/types/components/{use-hydrated.d.ts → shared/use-hydrated.d.ts} +0 -0
- /package/dist-library/types/local/{theme/colors.d.ts → configuration/color-values.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{collection-functions.d.ts → expression/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{data-functions.d.ts → expression/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{formatting.d.ts → expression/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{markdown → parsing}/markdown-blocks.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/code}/code-block.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/code}/code-languages.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/image}/image-view.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering}/math-view.d.ts +0 -0
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
-
Reactive MD bundles its Markdown, HTML parsing, syntax-highlighting, diagram-layout and KaTeX math typesetting dependencies, including KaTeX fonts and the mhchem extension. The standalone HTML runtime also bundles React, React DOM and scheduler. This file preserves license texts for those installed dependency trees, including supporting type packages. The library React entry uses host-provided React and React DOM peers.
|
|
3
|
+
Reactive MD bundles its Markdown, HTML parsing, syntax-highlighting, diagram-layout and KaTeX math typesetting dependencies, including KaTeX fonts and the mhchem extension. The author script worker bundles QuickJS and the Emscripten bindings. The standalone HTML runtime also bundles React, React DOM and scheduler. This file preserves license texts for those installed dependency trees, including supporting type packages. The library React entry uses host-provided React and React DOM peers.
|
|
4
4
|
|
|
5
5
|
Regenerate after dependency updates with `node scripts/generate-notices.mjs`.
|
|
6
6
|
|
|
@@ -140,6 +140,88 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
140
140
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
+
## @jitl/quickjs-ffi-types@0.32.0
|
|
144
|
+
|
|
145
|
+
Declared license: MIT
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
The MIT License
|
|
149
|
+
|
|
150
|
+
quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
|
|
151
|
+
|
|
152
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
153
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
154
|
+
in the Software without restriction, including without limitation the rights
|
|
155
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
156
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
157
|
+
furnished to do so, subject to the following conditions:
|
|
158
|
+
|
|
159
|
+
The above copyright notice and this permission notice shall be included in all
|
|
160
|
+
copies or substantial portions of the Software.
|
|
161
|
+
|
|
162
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
163
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
164
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
165
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
166
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
167
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
168
|
+
SOFTWARE.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## @jitl/quickjs-singlefile-browser-release-sync@0.32.0
|
|
172
|
+
|
|
173
|
+
Declared license: MIT
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
quickjs-emscripten:
|
|
177
|
+
The MIT License
|
|
178
|
+
|
|
179
|
+
quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
|
|
180
|
+
|
|
181
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
182
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
183
|
+
in the Software without restriction, including without limitation the rights
|
|
184
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
185
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
186
|
+
furnished to do so, subject to the following conditions:
|
|
187
|
+
|
|
188
|
+
The above copyright notice and this permission notice shall be included in all
|
|
189
|
+
copies or substantial portions of the Software.
|
|
190
|
+
|
|
191
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
192
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
193
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
194
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
195
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
196
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
197
|
+
SOFTWARE.
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
quickjs:
|
|
201
|
+
QuickJS Javascript Engine
|
|
202
|
+
|
|
203
|
+
Copyright (c) 2017-2021 Fabrice Bellard
|
|
204
|
+
Copyright (c) 2017-2021 Charlie Gordon
|
|
205
|
+
|
|
206
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
207
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
208
|
+
in the Software without restriction, including without limitation the rights
|
|
209
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
210
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
211
|
+
furnished to do so, subject to the following conditions:
|
|
212
|
+
|
|
213
|
+
The above copyright notice and this permission notice shall be included in
|
|
214
|
+
all copies or substantial portions of the Software.
|
|
215
|
+
|
|
216
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
217
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
218
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
219
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
220
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
221
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
222
|
+
THE SOFTWARE.
|
|
223
|
+
```
|
|
224
|
+
|
|
143
225
|
## @juggle/resize-observer@3.4.0
|
|
144
226
|
|
|
145
227
|
Declared license: Apache-2.0
|
|
@@ -3696,6 +3778,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
3696
3778
|
THE SOFTWARE.
|
|
3697
3779
|
```
|
|
3698
3780
|
|
|
3781
|
+
## quickjs-emscripten-core@0.32.0
|
|
3782
|
+
|
|
3783
|
+
Declared license: MIT
|
|
3784
|
+
|
|
3785
|
+
```text
|
|
3786
|
+
The MIT License
|
|
3787
|
+
|
|
3788
|
+
quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
|
|
3789
|
+
|
|
3790
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3791
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
3792
|
+
in the Software without restriction, including without limitation the rights
|
|
3793
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3794
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
3795
|
+
furnished to do so, subject to the following conditions:
|
|
3796
|
+
|
|
3797
|
+
The above copyright notice and this permission notice shall be included in all
|
|
3798
|
+
copies or substantial portions of the Software.
|
|
3799
|
+
|
|
3800
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3801
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3802
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3803
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3804
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3805
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3806
|
+
SOFTWARE.
|
|
3807
|
+
```
|
|
3808
|
+
|
|
3699
3809
|
## react-dom@19.3.1
|
|
3700
3810
|
|
|
3701
3811
|
Declared license: MIT
|
package/cli/args.mjs
CHANGED
|
@@ -81,10 +81,34 @@ function choice(value, option, choices) {
|
|
|
81
81
|
return normalized;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/** Playwright paper names are case-sensitive, so accept any case and spell them canonically. */
|
|
85
|
+
const PDF_PAPER_SIZES = Object.freeze([
|
|
86
|
+
'Letter', 'Legal', 'Tabloid', 'Ledger', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6',
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
/** @param {unknown} value */
|
|
90
|
+
function paperSize(value) {
|
|
91
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
92
|
+
throw usageError('Option "--pdf-paper" requires a paper size such as "A4" or "Letter".');
|
|
93
|
+
}
|
|
94
|
+
const normalized = value.trim().toLowerCase();
|
|
95
|
+
const match = PDF_PAPER_SIZES.find((size) => size.toLowerCase() === normalized);
|
|
96
|
+
if (!match) {
|
|
97
|
+
throw usageError(`Invalid value for "--pdf-paper": "${value}". Expected ${PDF_PAPER_SIZES.join(', ')}.`);
|
|
98
|
+
}
|
|
99
|
+
return match;
|
|
100
|
+
}
|
|
101
|
+
|
|
84
102
|
const BUILD_SPEC = new Map([
|
|
85
103
|
['-o', { key: 'output' }],
|
|
86
104
|
['--output', { key: 'output' }],
|
|
87
105
|
['--mode', { key: 'mode' }],
|
|
106
|
+
['--format', { key: 'format' }],
|
|
107
|
+
['--project-root', { key: 'projectRoot' }],
|
|
108
|
+
['--pdf-paper', { key: 'pdfPaper' }],
|
|
109
|
+
['--pdf-landscape', { key: 'pdfLandscape', boolean: true }],
|
|
110
|
+
['--pdf-margin', { key: 'pdfMargin' }],
|
|
111
|
+
['--pdf-background', { key: 'pdfBackground' }],
|
|
88
112
|
['--state-file', { key: 'stateFile' }],
|
|
89
113
|
['--component-state-file', { key: 'componentStateFile' }],
|
|
90
114
|
['--document-id', { key: 'documentId' }],
|
|
@@ -110,6 +134,7 @@ const LINT_SPEC = new Map([
|
|
|
110
134
|
* @param {string[]} argv
|
|
111
135
|
* @returns {{
|
|
112
136
|
* help: boolean, input?: string, output?: string, mode?: 'interactive'|'static',
|
|
137
|
+
* format?: 'html'|'pdf', projectRoot?: string, pdf?: import('../dist-library/types/pdf.js').LocalPdfOptions,
|
|
113
138
|
* stateFile?: string, componentStateFile?: string, documentId?: string,
|
|
114
139
|
* randomSeed?: number, assets?: 'inline'|'omit', assetRoot?: string,
|
|
115
140
|
* locale?: 'en'|'zh', colorScheme?: 'auto'|'light'|'dark', title?: string,
|
|
@@ -131,7 +156,29 @@ export function parseBuildArgs(argv) {
|
|
|
131
156
|
throw usageError('Missing required option "--output" (-o). Usage: reactive-md build <doc.reactive.md> -o <doc.html>.');
|
|
132
157
|
}
|
|
133
158
|
const output = requireText(options.output, '--output');
|
|
134
|
-
const
|
|
159
|
+
const format = options.format === undefined ? 'html' : choice(options.format, '--format', ['html', 'pdf']);
|
|
160
|
+
const mode = options.mode === undefined
|
|
161
|
+
? (format === 'pdf' ? 'static' : 'interactive')
|
|
162
|
+
: choice(options.mode, '--mode', ['interactive', 'static']);
|
|
163
|
+
if (format === 'pdf' && mode !== 'static') throw usageError('PDF output requires static mode.');
|
|
164
|
+
const pdfKeys = ['pdfPaper', 'pdfLandscape', 'pdfMargin', 'pdfBackground'];
|
|
165
|
+
if (format !== 'pdf' && pdfKeys.some((key) => options[key] !== undefined)) {
|
|
166
|
+
throw usageError('PDF layout options require "--format pdf".');
|
|
167
|
+
}
|
|
168
|
+
const projectRoot = options.projectRoot === undefined ? undefined : requireText(options.projectRoot, '--project-root');
|
|
169
|
+
if (projectRoot !== undefined && isUrlLike(projectRoot)) throw usageError('Option "--project-root" must be a local directory path.');
|
|
170
|
+
const pdfMargin = options.pdfMargin === undefined ? undefined : requireText(options.pdfMargin, '--pdf-margin');
|
|
171
|
+
if (pdfMargin !== undefined && !/^(?:\d+(?:\.\d+)?)(?:px|in|cm|mm)?$/i.test(pdfMargin)) {
|
|
172
|
+
throw usageError('Option "--pdf-margin" requires a non-negative length such as "12mm".');
|
|
173
|
+
}
|
|
174
|
+
const pdf = format === 'pdf' ? {
|
|
175
|
+
format: options.pdfPaper === undefined ? 'A4' : paperSize(options.pdfPaper),
|
|
176
|
+
landscape: options.pdfLandscape === true,
|
|
177
|
+
margin: pdfMargin === undefined ? undefined : { top: pdfMargin, right: pdfMargin, bottom: pdfMargin, left: pdfMargin },
|
|
178
|
+
printBackground: options.pdfBackground === undefined
|
|
179
|
+
? true
|
|
180
|
+
: choice(options.pdfBackground, '--pdf-background', ['on', 'off']) === 'on',
|
|
181
|
+
} : undefined;
|
|
135
182
|
const assets = options.assets === undefined ? 'inline' : choice(options.assets, '--assets', ['inline', 'omit']);
|
|
136
183
|
const locale = options.locale === undefined ? 'en' : choice(options.locale, '--locale', ['en', 'zh']);
|
|
137
184
|
const colorScheme = options.colorScheme === undefined
|
|
@@ -178,6 +225,9 @@ export function parseBuildArgs(argv) {
|
|
|
178
225
|
input,
|
|
179
226
|
output,
|
|
180
227
|
mode,
|
|
228
|
+
format,
|
|
229
|
+
projectRoot,
|
|
230
|
+
pdf,
|
|
181
231
|
stateFile,
|
|
182
232
|
componentStateFile,
|
|
183
233
|
documentId,
|
package/cli/assets.mjs
CHANGED
|
@@ -22,7 +22,12 @@ const WINDOWS_DRIVE_PATH = /^[a-z]:[\\/]/i;
|
|
|
22
22
|
*/
|
|
23
23
|
export function displayAssetUrl(value) {
|
|
24
24
|
const text = typeof value === 'string' ? value : String(value ?? '');
|
|
25
|
-
|
|
25
|
+
let clipped = text;
|
|
26
|
+
if (text.length > 200) {
|
|
27
|
+
// Do not leave half of a surrogate pair before the ellipsis.
|
|
28
|
+
const end = /[\uD800-\uDBFF]/.test(text[196]) ? 196 : 197;
|
|
29
|
+
clipped = `${text.slice(0, end)}...`;
|
|
30
|
+
}
|
|
26
31
|
return clipped.replace(CONTROL_CHARACTERS, (character) => (
|
|
27
32
|
`\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`
|
|
28
33
|
));
|
package/cli/build.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { CliError, EXIT, errorText } from './errors.mjs';
|
|
|
5
5
|
import {
|
|
6
6
|
assertDistinctPaths,
|
|
7
7
|
assertOutputDirectory,
|
|
8
|
-
|
|
8
|
+
atomicWriteFile,
|
|
9
9
|
readTextFile,
|
|
10
10
|
} from './fs-utils.mjs';
|
|
11
11
|
import {
|
|
@@ -24,6 +24,42 @@ function writeDiagnostics(stream, file, diagnostics) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* PDF adapter diagnostics carry a code and message but no document position.
|
|
29
|
+
* Print one line each so a relaxed build still explains the dropped image and
|
|
30
|
+
* a strict build reports the same problem as an error. Exported for the CLI
|
|
31
|
+
* regression test; not part of the package API.
|
|
32
|
+
*
|
|
33
|
+
* @param {NodeJS.WritableStream} stream
|
|
34
|
+
* @param {string} file
|
|
35
|
+
* @param {{code: string, message: string}[]} diagnostics
|
|
36
|
+
* @param {'warning'|'error'} severity
|
|
37
|
+
*/
|
|
38
|
+
export function reportPdfDiagnostics(stream, file, diagnostics, severity) {
|
|
39
|
+
for (const diagnostic of diagnostics) {
|
|
40
|
+
stream.write(`reactive-md: ${severity}: ${file}: ${diagnostic.code}: ${diagnostic.message}\n`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Adapter messages are printed verbatim; keep one bounded line per diagnostic. */
|
|
45
|
+
const MAX_PDF_DIAGNOSTIC_LENGTH = 500;
|
|
46
|
+
|
|
47
|
+
/** @param {unknown} diagnostic @returns {{code: string, message: string}} */
|
|
48
|
+
export function readPdfDiagnostic(diagnostic) {
|
|
49
|
+
const record = diagnostic && typeof diagnostic === 'object' ? diagnostic : {};
|
|
50
|
+
const rawCode = typeof record.code === 'string' ? record.code.trim() : '';
|
|
51
|
+
const code = rawCode === '' ? 'local.pdf.diagnostic' : rawCode.slice(0, 128);
|
|
52
|
+
const rawMessage = typeof record.message === 'string'
|
|
53
|
+
? record.message.replace(/\s*\r?\n\s*/g, ' ').trim()
|
|
54
|
+
: '';
|
|
55
|
+
const message = rawMessage === ''
|
|
56
|
+
? 'The PDF adapter reported a problem without a message.'
|
|
57
|
+
: rawMessage.length > MAX_PDF_DIAGNOSTIC_LENGTH
|
|
58
|
+
? `${rawMessage.slice(0, MAX_PDF_DIAGNOSTIC_LENGTH)}...`
|
|
59
|
+
: rawMessage;
|
|
60
|
+
return { code, message };
|
|
61
|
+
}
|
|
62
|
+
|
|
27
63
|
/**
|
|
28
64
|
* `reactive-md build`
|
|
29
65
|
* @param {any} options
|
|
@@ -44,6 +80,20 @@ export async function runBuild(options, context) {
|
|
|
44
80
|
|
|
45
81
|
const packageInfo = await readPackageInfo(packageRoot);
|
|
46
82
|
const generator = { name: 'reactive-md', version: packageInfo.version };
|
|
83
|
+
let project;
|
|
84
|
+
if (options.projectRoot !== undefined) {
|
|
85
|
+
try {
|
|
86
|
+
const { loadLocalDirectoryHost } = await import('reactive-md/vite');
|
|
87
|
+
project = await loadLocalDirectoryHost(options.projectRoot, {
|
|
88
|
+
defaultPreset: 'minimal', interactive: options.mode === 'interactive',
|
|
89
|
+
});
|
|
90
|
+
} catch (error) {
|
|
91
|
+
throw new CliError(
|
|
92
|
+
`Cannot assemble project plugins: ${errorText(error)}. Directory export requires the optional Vite peer.`,
|
|
93
|
+
EXIT.DOCUMENT, { cause: error },
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
47
97
|
|
|
48
98
|
const core = await loadCore(packageRoot, [
|
|
49
99
|
'compileLocal',
|
|
@@ -56,7 +106,7 @@ export async function runBuild(options, context) {
|
|
|
56
106
|
|
|
57
107
|
let compiled;
|
|
58
108
|
try {
|
|
59
|
-
compiled = core.compileLocal(source);
|
|
109
|
+
compiled = core.compileLocal(source, project?.host.compileOptions);
|
|
60
110
|
} catch (error) {
|
|
61
111
|
throw new CliError(
|
|
62
112
|
`The compiler failed on "${fileLabel}": ${errorText(error)}`,
|
|
@@ -226,9 +276,9 @@ export async function runBuild(options, context) {
|
|
|
226
276
|
const { urlPolicy, imageResolver } = createAssetPolicy(byUrl);
|
|
227
277
|
|
|
228
278
|
/* ------------------------------------------------------------- build inputs */
|
|
229
|
-
const css = `${await readArtifactText(packageRoot, 'css')}\n${await readArtifactText(packageRoot, 'printCss')}`;
|
|
279
|
+
const css = `${await readArtifactText(packageRoot, project ? 'minimalCss' : 'css')}\n${await readArtifactText(packageRoot, 'printCss')}`;
|
|
230
280
|
let runtimeScript;
|
|
231
|
-
if (options.mode === 'interactive') {
|
|
281
|
+
if (options.mode === 'interactive' && project === undefined) {
|
|
232
282
|
runtimeScript = await readArtifactText(packageRoot, 'standalone');
|
|
233
283
|
}
|
|
234
284
|
// The shared shell records verified image URLs in the auto-mount payload so
|
|
@@ -265,15 +315,28 @@ export async function runBuild(options, context) {
|
|
|
265
315
|
const props = {
|
|
266
316
|
document: baseline.document,
|
|
267
317
|
runtime,
|
|
318
|
+
capabilityGrants: project?.host.compileOptions,
|
|
268
319
|
mode: options.mode,
|
|
269
320
|
locale: options.locale,
|
|
270
321
|
colorScheme: options.colorScheme,
|
|
271
322
|
urlPolicy,
|
|
272
323
|
imageResolver,
|
|
324
|
+
...(project === undefined ? {} : { reactConfig: project.host.reactConfig }),
|
|
273
325
|
};
|
|
274
|
-
if (options.
|
|
275
|
-
|
|
326
|
+
if (project !== undefined || options.format === 'pdf') {
|
|
327
|
+
const { renderLocalStaticDocument } = await import('reactive-md/react/server');
|
|
328
|
+
const rendered = renderLocalStaticDocument({ ...props, resources: project?.host.resources });
|
|
329
|
+
writeDiagnostics(stderr, fileLabel, rendered.diagnostics);
|
|
330
|
+
if (!rendered.ok || (options.strict && rendered.diagnostics.length > 0)) {
|
|
331
|
+
throw new CliError('', EXIT.DOCUMENT, { reported: true });
|
|
332
|
+
}
|
|
333
|
+
staticMarkup = rendered.markup;
|
|
334
|
+
} else {
|
|
335
|
+
if (options.mode === 'interactive') props.staticFirst = true;
|
|
336
|
+
staticMarkup = renderToString(createElement(LocalDocumentView, props));
|
|
337
|
+
}
|
|
276
338
|
} catch (error) {
|
|
339
|
+
if (error instanceof CliError) throw error;
|
|
277
340
|
throw new CliError(
|
|
278
341
|
`HTML rendering failed for "${fileLabel}": ${errorText(error)}`,
|
|
279
342
|
EXIT.DOCUMENT,
|
|
@@ -296,7 +359,7 @@ export async function runBuild(options, context) {
|
|
|
296
359
|
|
|
297
360
|
let html;
|
|
298
361
|
try {
|
|
299
|
-
|
|
362
|
+
const htmlOptions = {
|
|
300
363
|
title,
|
|
301
364
|
source: baseline.document.source,
|
|
302
365
|
state: stateFile,
|
|
@@ -314,7 +377,20 @@ export async function runBuild(options, context) {
|
|
|
314
377
|
...(options.randomSeed === undefined ? {} : { randomSeed: options.randomSeed }),
|
|
315
378
|
...(componentState === undefined ? {} : { componentState }),
|
|
316
379
|
notices,
|
|
317
|
-
}
|
|
380
|
+
};
|
|
381
|
+
if (project === undefined) {
|
|
382
|
+
html = core.createShareableHtml(htmlOptions);
|
|
383
|
+
} else {
|
|
384
|
+
const { createLocalShareableHtml } = await import('reactive-md/export');
|
|
385
|
+
html = createLocalShareableHtml({
|
|
386
|
+
...htmlOptions,
|
|
387
|
+
document: baseline.document,
|
|
388
|
+
config: project.host.config,
|
|
389
|
+
resources: project.host.resources,
|
|
390
|
+
bundle: project.bundle,
|
|
391
|
+
notices: [notices, ...project.host.notices.map((notice) => notice.text ?? notice.name ?? notice.id)].filter(Boolean).join('\n\n'),
|
|
392
|
+
});
|
|
393
|
+
}
|
|
318
394
|
} catch (error) {
|
|
319
395
|
throw new CliError(
|
|
320
396
|
`Cannot assemble the shareable HTML for "${fileLabel}": ${errorText(error)}`,
|
|
@@ -323,7 +399,47 @@ export async function runBuild(options, context) {
|
|
|
323
399
|
);
|
|
324
400
|
}
|
|
325
401
|
|
|
326
|
-
|
|
402
|
+
let output = html;
|
|
403
|
+
if (options.format === 'pdf') {
|
|
404
|
+
/** @type {{code: string, message: string}[]} */
|
|
405
|
+
const pdfDiagnostics = [];
|
|
406
|
+
// Image-decode failures are warnings in a relaxed build and errors under
|
|
407
|
+
// --strict. The adapter reports them through `onDiagnostic`; the CLI also
|
|
408
|
+
// re-checks the collected list so a strict build never writes a PDF even
|
|
409
|
+
// if the adapter returns bytes.
|
|
410
|
+
const pdfOptions = {
|
|
411
|
+
...options.pdf,
|
|
412
|
+
strict: options.strict,
|
|
413
|
+
onDiagnostic(diagnostic) {
|
|
414
|
+
pdfDiagnostics.push(readPdfDiagnostic(diagnostic));
|
|
415
|
+
},
|
|
416
|
+
};
|
|
417
|
+
try {
|
|
418
|
+
const { renderLocalPdf } = await import('reactive-md/pdf');
|
|
419
|
+
output = await renderLocalPdf(html, pdfOptions);
|
|
420
|
+
} catch (error) {
|
|
421
|
+
// An adapter that fails after reporting keeps the same code. Under
|
|
422
|
+
// --strict its own rejection is already fatal, so print the collected
|
|
423
|
+
// diagnostics as errors and let the failure message name the cause.
|
|
424
|
+
if (pdfDiagnostics.length > 0) {
|
|
425
|
+
reportPdfDiagnostics(stderr, fileLabel, pdfDiagnostics, options.strict ? 'error' : 'warning');
|
|
426
|
+
}
|
|
427
|
+
throw new CliError(
|
|
428
|
+
`PDF export failed for "${fileLabel}": ${errorText(error)}`,
|
|
429
|
+
EXIT.DOCUMENT,
|
|
430
|
+
{ cause: error },
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
if (pdfDiagnostics.length > 0) {
|
|
434
|
+
if (options.strict) {
|
|
435
|
+
reportPdfDiagnostics(stderr, fileLabel, pdfDiagnostics, 'error');
|
|
436
|
+
stderr.write('reactive-md: error: PDF warnings are treated as errors because --strict is set.\n');
|
|
437
|
+
throw new CliError('', EXIT.DOCUMENT, { reported: true });
|
|
438
|
+
}
|
|
439
|
+
reportPdfDiagnostics(stderr, fileLabel, pdfDiagnostics, 'warning');
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
await atomicWriteFile(outputPath, output);
|
|
327
443
|
stdout.write(`Wrote ${options.output}\n`);
|
|
328
444
|
return EXIT.OK;
|
|
329
445
|
}
|
package/cli/fs-utils.mjs
CHANGED
|
@@ -104,13 +104,13 @@ export async function assertOutputDirectory(outputPath) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Write
|
|
107
|
+
* Write through a unique temporary file in the destination directory and
|
|
108
108
|
* rename it into place. The temporary file is removed on every failure path.
|
|
109
109
|
*
|
|
110
110
|
* @param {string} outputPath
|
|
111
|
-
* @param {string} content
|
|
111
|
+
* @param {string | Uint8Array} content
|
|
112
112
|
*/
|
|
113
|
-
export async function
|
|
113
|
+
export async function atomicWriteFile(outputPath, content) {
|
|
114
114
|
const absolute = path.resolve(outputPath);
|
|
115
115
|
await assertOutputDirectory(absolute);
|
|
116
116
|
const directory = path.dirname(absolute);
|
package/cli/help.mjs
CHANGED
|
@@ -44,17 +44,23 @@ Init exit codes: 0 success, 2 usage error, 4 I/O error.
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export function buildHelp() {
|
|
47
|
-
return `Usage: reactive-md build <doc.reactive.md> -o <
|
|
47
|
+
return `Usage: reactive-md build <doc.reactive.md> -o <output> [options]
|
|
48
48
|
|
|
49
49
|
Compile one document with the packaged core, optionally validate a parameter
|
|
50
50
|
state file, verify and inline local images, server-render the document with
|
|
51
|
-
React 19, and write
|
|
52
|
-
same shareable-HTML shell used by the interactive runtime (CSP, escaped JSON,
|
|
53
|
-
notices and print styles included).
|
|
51
|
+
React 19, and write shareable HTML or a static PDF.
|
|
54
52
|
|
|
55
53
|
Options:
|
|
56
|
-
-o, --output <file> Output
|
|
54
|
+
-o, --output <file> Output path (required). The parent
|
|
57
55
|
directory must already exist.
|
|
56
|
+
--format <html|pdf> Output format (default html). PDF uses
|
|
57
|
+
static rendering and optional Playwright.
|
|
58
|
+
--project-root <dir> Use the minimal preset and discover the
|
|
59
|
+
trusted project's plugin/ and theme/ entries.
|
|
60
|
+
--pdf-paper <A4|Letter|...> Paper size (default A4).
|
|
61
|
+
--pdf-landscape Use landscape orientation.
|
|
62
|
+
--pdf-margin <length> Set every page margin (for example 12mm).
|
|
63
|
+
--pdf-background <on|off> Print backgrounds (default on).
|
|
58
64
|
--mode <interactive|static> Output mode (default interactive). Static
|
|
59
65
|
output has no runtime script and no
|
|
60
66
|
auto-mount payload.
|
|
@@ -85,6 +91,7 @@ Options:
|
|
|
85
91
|
|
|
86
92
|
Interactive HTML requires React 19 and react-dom, plus the prebuilt
|
|
87
93
|
dist-standalone IIFE. Every build requires the prebuilt dist-library artifacts.
|
|
94
|
+
PDF output requires "npm install playwright" and "npx playwright install chromium".
|
|
88
95
|
From a source checkout, run "npm run build" before building documents.
|
|
89
96
|
|
|
90
97
|
${EXIT_CODES}
|
package/cli/init.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const SEMANTIC_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)
|
|
|
10
10
|
const SCAFFOLD_PACKAGE_VERSION = '0.1.0';
|
|
11
11
|
// The published engine package version used for generated npm dependencies and
|
|
12
12
|
// install instructions. Kept in sync with package.json by check-versions.
|
|
13
|
-
const SCAFFOLD_ENGINE_VERSION = '0.
|
|
13
|
+
const SCAFFOLD_ENGINE_VERSION = '0.9.1';
|
|
14
14
|
// The SDK data contract version, independent of the engine release. Kept in
|
|
15
15
|
// sync with src/sdk/version.ts by scripts/check-versions.mjs.
|
|
16
16
|
const SCAFFOLD_SDK_VERSION = '0.7.0';
|
package/cli/package.mjs
CHANGED
|
@@ -11,6 +11,7 @@ export const ARTIFACTS = Object.freeze({
|
|
|
11
11
|
core: { relative: 'dist-library/reactive-md.js', label: 'core build' },
|
|
12
12
|
react: { relative: 'dist-library/reactive-md-react.js', label: 'React renderer build' },
|
|
13
13
|
css: { relative: 'dist-library/reactive-md.css', label: 'stylesheet build' },
|
|
14
|
+
minimalCss: { relative: 'dist-library/reactive-md-minimal.css', label: 'minimal stylesheet build' },
|
|
14
15
|
printCss: { relative: 'dist-library/reactive-md-print.css', label: 'print stylesheet build' },
|
|
15
16
|
standalone: { relative: 'dist-standalone/reactive-md-standalone.js', label: 'standalone runtime build' },
|
|
16
17
|
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z as e } from "./preset-core-CKc5YXSM.js";
|
|
2
|
+
import t from "./reactive-md-default-preset.js";
|
|
3
|
+
import { G as n } from "./sdk-core-BoJT1SIt.js";
|
|
4
|
+
import { _ as r, a as ee, c as te, d as ne, f as re, g as ie, h as ae, i as oe, l as i, m as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./controls-CcT6n7k_.js";
|
|
5
|
+
import { t as p } from "./data-table-Bgccxd7h.js";
|
|
6
|
+
import { a as m, i as h, n as g, o as _, r as v, t as y } from "./visuals-BZbZYA7w.js";
|
|
7
|
+
import { t as b } from "./coordinate-CWS9p5q_.js";
|
|
8
|
+
import { _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as se, i as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, u as L, v as R, x as z, y as B } from "./layout-C0YlEPGr.js";
|
|
9
|
+
import { n as V, t as H } from "./gallery-CY6mTx8i.js";
|
|
10
|
+
import { r as U, t as W } from "./package-core-WFK1RhAZ.js";
|
|
11
|
+
import { t as G } from "./LocalDocumentViewCore-GiWV3bey.js";
|
|
12
|
+
import { t as K } from "./LocalReactiveDocumentCore-ZjQSGyHE.js";
|
|
13
|
+
import { jsx as q } from "react/jsx-runtime";
|
|
14
|
+
// src/components/default-preset.ts
|
|
15
|
+
function J() {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
var ce = Object.freeze({
|
|
19
|
+
input: s,
|
|
20
|
+
textarea: c,
|
|
21
|
+
number: te,
|
|
22
|
+
slider: r,
|
|
23
|
+
"range-slider": ie,
|
|
24
|
+
coordinate: b,
|
|
25
|
+
toggle: ae,
|
|
26
|
+
checkbox: d,
|
|
27
|
+
date: ee,
|
|
28
|
+
select: re,
|
|
29
|
+
choices: l,
|
|
30
|
+
"radio-group": ne,
|
|
31
|
+
"multi-select": u,
|
|
32
|
+
option: E,
|
|
33
|
+
counter: oe,
|
|
34
|
+
timer: a,
|
|
35
|
+
checklist: o,
|
|
36
|
+
progress: i,
|
|
37
|
+
jump: T,
|
|
38
|
+
anchor: P,
|
|
39
|
+
text: B,
|
|
40
|
+
section: A,
|
|
41
|
+
quiz: f,
|
|
42
|
+
panel: N,
|
|
43
|
+
card: S,
|
|
44
|
+
grid: k,
|
|
45
|
+
gallery: V,
|
|
46
|
+
"gallery-item": H,
|
|
47
|
+
tabs: R,
|
|
48
|
+
tab: x,
|
|
49
|
+
steps: D,
|
|
50
|
+
step: se,
|
|
51
|
+
accordion: I,
|
|
52
|
+
disclosure: F,
|
|
53
|
+
if: L,
|
|
54
|
+
alert: j,
|
|
55
|
+
badge: O,
|
|
56
|
+
tooltip: C,
|
|
57
|
+
validation: z,
|
|
58
|
+
"data-table": p,
|
|
59
|
+
column: M,
|
|
60
|
+
table: m,
|
|
61
|
+
chart: y,
|
|
62
|
+
plot: h,
|
|
63
|
+
timeline: _,
|
|
64
|
+
diagram: g,
|
|
65
|
+
node: v,
|
|
66
|
+
edge: w,
|
|
67
|
+
computed: J,
|
|
68
|
+
const: J,
|
|
69
|
+
external: J
|
|
70
|
+
}), Y = null;
|
|
71
|
+
function X() {
|
|
72
|
+
if (Y) return Y;
|
|
73
|
+
let e = [];
|
|
74
|
+
for (let r of t.components) {
|
|
75
|
+
let t = ce[r.name];
|
|
76
|
+
if (!t) throw Error(`Default React preset has no implementation for builtin component <${r.name}>.`);
|
|
77
|
+
e.push(n(r, { render: t }));
|
|
78
|
+
}
|
|
79
|
+
return Y = Object.freeze({
|
|
80
|
+
id: t.id,
|
|
81
|
+
version: t.version,
|
|
82
|
+
components: Object.freeze(e)
|
|
83
|
+
}), Y;
|
|
84
|
+
}
|
|
85
|
+
X();
|
|
86
|
+
// src/react/package.ts
|
|
87
|
+
var Z = U({
|
|
88
|
+
protocol: e,
|
|
89
|
+
preset: t,
|
|
90
|
+
components: X().components
|
|
91
|
+
});
|
|
92
|
+
function Q(e = {}) {
|
|
93
|
+
return W(e, Z);
|
|
94
|
+
}
|
|
95
|
+
// src/local/rendering/document/LocalDocumentView.tsx
|
|
96
|
+
var le, $ = () => le ??= Q().reactConfig;
|
|
97
|
+
function ue(e) {
|
|
98
|
+
return /* @__PURE__ */ q(G, {
|
|
99
|
+
...e,
|
|
100
|
+
getBaseConfig: $
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function de(e) {
|
|
104
|
+
return /* @__PURE__ */ q(K, {
|
|
105
|
+
...e,
|
|
106
|
+
getBaseConfig: $
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
export { X as a, Z as i, de as n, Q as r, ue as t };
|