reactive-md 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +66 -0
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING-ch.md +6 -62
- package/CONTRIBUTING.md +5 -63
- package/README-ch.md +232 -67
- package/README-en.md +209 -71
- package/README.md +209 -71
- package/SECURITY-ch.md +3 -1
- package/SECURITY.md +3 -1
- package/THIRD_PARTY_NOTICES.md +1909 -87
- package/cli/args.mjs +33 -1
- package/cli/build.mjs +62 -1
- package/cli/check.mjs +444 -0
- package/cli/help.mjs +181 -3
- package/cli/init.mjs +1577 -0
- package/cli/main.mjs +11 -1
- package/cli/package-loader.mjs +41 -0
- package/dist-library/LocalDocumentView-6trX7xJc.js +97920 -0
- package/dist-library/{authoring-BEVyth5X.js → authoring-BsfSwQRm.js} +237 -209
- package/dist-library/compiler--ea2CKQF.js +61 -0
- package/dist-library/compiler-core-kPiH-gOV.js +11805 -0
- package/dist-library/component-state-Cq2K5gkS.js +490 -0
- package/dist-library/component-state-D_cw_EHe.js +54 -0
- package/dist-library/config-validation-DXTynAw7.js +3005 -0
- package/dist-library/default-components-Z_YMio5P.js +2346 -0
- package/dist-library/identity-MYJXKSkB.js +1443 -0
- package/dist-library/math-display-BJz4gbFc.js +24000 -0
- package/dist-library/math-sample-BGEW49zY.js +1124 -0
- package/dist-library/options-CX5m5n-J.js +115 -0
- package/dist-library/parser-standard-DlCk7sLo.js +10122 -0
- package/dist-library/props-DGlBk0e5.js +183 -0
- package/dist-library/react-ByOHunUW.js +122 -0
- package/dist-library/reactive-md-authoring.js +712 -1077
- package/dist-library/reactive-md-build.js +7966 -0
- package/dist-library/reactive-md-compiler-standard.js +33 -0
- package/dist-library/reactive-md-compiler.js +22 -0
- package/dist-library/reactive-md-default-packs.js +71 -0
- package/dist-library/reactive-md-default-preset.js +10 -0
- package/dist-library/reactive-md-export.js +111 -0
- package/dist-library/reactive-md-print.css +18 -3
- package/dist-library/reactive-md-react-runtime.js +251 -0
- package/dist-library/reactive-md-react-server.js +55 -0
- package/dist-library/reactive-md-react-unstyled.js +9 -1
- package/dist-library/reactive-md-react.js +9 -1
- package/dist-library/reactive-md-runtime-browser.js +51 -0
- package/dist-library/reactive-md-runtime.js +3 -0
- package/dist-library/reactive-md-sdk.js +6 -0
- package/dist-library/reactive-md-standalone-host.js +442 -0
- package/dist-library/reactive-md-testing-browser.js +523 -0
- package/dist-library/reactive-md-testing-react.js +221 -0
- package/dist-library/reactive-md-testing.js +638 -0
- package/dist-library/reactive-md-vite.js +959 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1080 -795
- package/dist-library/registry-B9Jc3FVe.js +1174 -0
- package/dist-library/resources-BGt8mpDA.js +204 -0
- package/dist-library/runtime-C-sbfpOX.js +1157 -0
- package/dist-library/runtime-Dkq7ldyg.js +172 -0
- package/dist-library/schema-ZFufO8V0.js +39 -0
- package/dist-library/shareable-DDVL4Fi9.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +168 -0
- package/dist-library/types/authoring/conformance.d.ts +24 -0
- package/dist-library/types/{editor → authoring}/editor-i18n.d.ts +3 -24
- package/dist-library/types/authoring/extensions.d.ts +13 -0
- package/dist-library/types/authoring/index.d.ts +14 -11
- package/dist-library/types/authoring/insert.d.ts +16 -0
- package/dist-library/types/{editor → authoring}/native-components.d.ts +19 -2
- package/dist-library/types/authoring/templates.d.ts +65 -0
- package/dist-library/types/build/diagnostics.d.ts +8 -0
- package/dist-library/types/build/digest.d.ts +5 -0
- package/dist-library/types/build/entry.d.ts +9 -0
- package/dist-library/types/build/host.d.ts +36 -0
- package/dist-library/types/build/index.d.ts +99 -0
- package/dist-library/types/build/notices.d.ts +29 -0
- package/dist-library/types/build/resources.d.ts +60 -0
- package/dist-library/types/build/vite.d.ts +15 -0
- package/dist-library/types/compiler/index.d.ts +22 -0
- package/dist-library/types/compiler/result.d.ts +30 -0
- package/dist-library/types/compiler/standard.d.ts +16 -0
- package/dist-library/types/compiler/types.d.ts +69 -0
- package/dist-library/types/components/chart-motion.d.ts +12 -0
- package/dist-library/types/components/controls.d.ts +21 -0
- package/dist-library/types/{local → components}/data-table.d.ts +10 -24
- package/dist-library/types/components/default-chart-types.d.ts +22 -0
- package/dist-library/types/components/default-chart.d.ts +2 -0
- package/dist-library/types/components/default-preset.d.ts +10 -0
- package/dist-library/types/components/diagram-inspector.d.ts +24 -0
- package/dist-library/types/components/gallery.d.ts +6 -0
- package/dist-library/types/components/layout.d.ts +23 -0
- package/dist-library/types/components/mafs-plot-grid.d.ts +57 -0
- package/dist-library/types/components/mafs-visuals.d.ts +40 -0
- package/dist-library/types/components/numeric-sliders.d.ts +3 -0
- package/dist-library/types/components/uiarc/calendar/calendar.d.ts +26 -0
- package/dist-library/types/components/uiarc/date-picker/date-picker.d.ts +29 -0
- package/dist-library/types/components/uiarc/lib/motion-tokens.d.ts +2 -0
- package/dist-library/types/components/uiarc/lib/use-today.d.ts +2 -0
- package/dist-library/types/components/uiarc/motion-tokens.d.ts +60 -0
- package/dist-library/types/components/uiarc/rmd-motion.d.ts +12 -0
- package/dist-library/types/components/uiarc/select/select.d.ts +21 -0
- package/dist-library/types/components/uiarc/slider/slider.d.ts +53 -0
- package/dist-library/types/components/use-hydrated.d.ts +6 -0
- package/dist-library/types/components/visuals.d.ts +13 -0
- package/dist-library/types/export/component-state.d.ts +39 -0
- package/dist-library/types/export/index.d.ts +47 -0
- package/dist-library/types/export/requirements.d.ts +23 -0
- package/dist-library/types/export/resources.d.ts +8 -0
- package/dist-library/types/export/restoration.d.ts +52 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +16 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +64 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +46 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +9 -0
- package/dist-library/types/local/compilation/compiler.d.ts +34 -0
- package/dist-library/types/local/compilation/component-kernel.d.ts +487 -0
- package/dist-library/types/local/{dependencies.d.ts → compilation/dependencies.d.ts} +4 -3
- package/dist-library/types/local/{diagnostics.d.ts → configuration/diagnostic-messages.d.ts} +193 -65
- package/dist-library/types/local/configuration/diagnostics.d.ts +58 -0
- package/dist-library/types/local/{limits.d.ts → configuration/limits.d.ts} +15 -2
- package/dist-library/types/local/configuration/options-core.d.ts +120 -0
- package/dist-library/types/local/configuration/options.d.ts +17 -0
- package/dist-library/types/local/configuration/portable-options.d.ts +3 -0
- package/dist-library/types/local/configuration/schema-core.d.ts +32 -0
- package/dist-library/types/local/configuration/schema.d.ts +12 -0
- package/dist-library/types/local/contracts/types.d.ts +519 -0
- package/dist-library/types/local/{version.d.ts → contracts/version.d.ts} +1 -1
- package/dist-library/types/local/{computations.d.ts → evaluation/computations.d.ts} +6 -3
- package/dist-library/types/local/{expression.d.ts → evaluation/expression.d.ts} +2 -2
- package/dist-library/types/local/{math-display.d.ts → evaluation/math-display.d.ts} +2 -16
- package/dist-library/types/local/evaluation/math-sample.d.ts +23 -0
- package/dist-library/types/local/evaluation/math.d.ts +73 -0
- package/dist-library/types/local/{validation.d.ts → evaluation/validation.d.ts} +1 -1
- package/dist-library/types/local/html/html-details.d.ts +16 -0
- package/dist-library/types/local/html/html-entities.d.ts +7 -0
- package/dist-library/types/local/html/html-policy.d.ts +43 -0
- package/dist-library/types/local/html/html-recovery.d.ts +16 -0
- package/dist-library/types/local/html/html-table-names.d.ts +9 -0
- package/dist-library/types/local/{html-table.d.ts → html/html-table.d.ts} +2 -6
- package/dist-library/types/local/{html.d.ts → html/html.d.ts} +1 -1
- package/dist-library/types/local/index.d.ts +31 -24
- package/dist-library/types/local/markdown/fast-markdown.d.ts +137 -0
- package/dist-library/types/local/{footnotes.d.ts → markdown/footnotes.d.ts} +1 -1
- package/dist-library/types/local/{heading-anchors.d.ts → markdown/heading-anchors.d.ts} +12 -2
- package/dist-library/types/local/markdown/markdown-blocks.d.ts +55 -0
- package/dist-library/types/local/markdown/markdown-structure.d.ts +3 -0
- package/dist-library/types/local/markdown/plain-paragraphs.d.ts +10 -0
- package/dist-library/types/local/parsing/lexical.d.ts +21 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +67 -0
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +42 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +65 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +7 -0
- package/dist-library/types/local/parsing/parser.d.ts +16 -0
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +48 -0
- package/dist-library/types/local/{LocalDocumentView.d.ts → rendering/LocalDocumentView.d.ts} +67 -24
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +36 -0
- package/dist-library/types/local/rendering/render-types.d.ts +57 -0
- package/dist-library/types/local/rendering/view-revision.d.ts +75 -0
- package/dist-library/types/local/{retention.d.ts → runtime/retention.d.ts} +1 -1
- package/dist-library/types/local/runtime/runtime.d.ts +34 -0
- package/dist-library/types/local/{state.d.ts → runtime/state.d.ts} +4 -4
- package/dist-library/types/local/session/compiler-cache.d.ts +44 -0
- package/dist-library/types/local/session/incremental.d.ts +48 -0
- package/dist-library/types/local/session/parse-session.d.ts +62 -0
- package/dist-library/types/local/session/row-reuse.d.ts +46 -0
- package/dist-library/types/local/{authoring.d.ts → source/authoring.d.ts} +11 -3
- package/dist-library/types/local/source/node-walk.d.ts +3 -0
- package/dist-library/types/local/source/source-context.d.ts +63 -0
- package/dist-library/types/local/{source-migration.d.ts → source/source-migration.d.ts} +2 -2
- package/dist-library/types/local/{i18n.d.ts → theme/i18n.d.ts} +2 -2
- package/dist-library/types/local/theme/theme-name.d.ts +3 -0
- package/dist-library/types/local/{theme.d.ts → theme/theme.d.ts} +3 -3
- package/dist-library/types/local/transport/compile-patch.d.ts +127 -0
- package/dist-library/types/local/{compiled-data.d.ts → transport/compiled-data.d.ts} +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +17 -0
- package/dist-library/types/local/transport/shared-data.d.ts +10 -0
- package/dist-library/types/local/transport/worker.d.ts +265 -0
- package/dist-library/types/local/widgets/visuals.d.ts +25 -0
- package/dist-library/types/presets/default-authoring.d.ts +50 -0
- package/dist-library/types/presets/default-components.d.ts +4 -0
- package/dist-library/types/presets/default-semantics.d.ts +8 -0
- package/dist-library/types/presets/default.d.ts +11 -0
- package/dist-library/types/presets/identity.d.ts +7 -0
- package/dist-library/types/presets/packs.d.ts +4 -0
- package/dist-library/types/react/component-api.d.ts +260 -0
- package/dist-library/types/react/component-primitives.d.ts +21 -0
- package/dist-library/types/react/component-utils.d.ts +125 -0
- package/dist-library/types/react/default-theme.d.ts +6 -0
- package/dist-library/types/react/field-validation.d.ts +11 -0
- package/dist-library/types/react/index.d.ts +17 -5
- package/dist-library/types/react/overflow-text-tooltip.d.ts +6 -0
- package/dist-library/types/react/package.d.ts +69 -0
- package/dist-library/types/react/runtime/common.d.ts +4 -0
- package/dist-library/types/react/runtime/index.d.ts +8 -0
- package/dist-library/types/react/runtime/useComponentState.d.ts +30 -0
- package/dist-library/types/react/runtime/useKeys.d.ts +16 -0
- package/dist-library/types/react/runtime/useSwipe.d.ts +27 -0
- package/dist-library/types/react/runtime/useTicker.d.ts +17 -0
- package/dist-library/types/react/sdk.d.ts +110 -0
- package/dist-library/types/react/server.d.ts +15 -0
- package/dist-library/types/react/tooltip-layer.d.ts +10 -0
- package/dist-library/types/react/use-draft-field.d.ts +17 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +63 -0
- package/dist-library/types/runtime-services/component-state.d.ts +152 -0
- package/dist-library/types/runtime-services/identity.d.ts +41 -0
- package/dist-library/types/runtime-services/index.d.ts +10 -0
- package/dist-library/types/runtime-services/random.d.ts +42 -0
- package/dist-library/types/runtime-services/runtime.d.ts +51 -0
- package/dist-library/types/runtime-services/scheduler.d.ts +44 -0
- package/dist-library/types/sdk/assembly.d.ts +73 -0
- package/dist-library/types/sdk/compat-profile.d.ts +57 -0
- package/dist-library/types/sdk/compiler-config.d.ts +33 -0
- package/dist-library/types/sdk/config-validation.d.ts +33 -0
- package/dist-library/types/sdk/config.d.ts +35 -0
- package/dist-library/types/sdk/hash.d.ts +9 -0
- package/dist-library/types/sdk/index.d.ts +10 -0
- package/dist-library/types/sdk/manifest.d.ts +49 -0
- package/dist-library/types/sdk/pattern.d.ts +11 -0
- package/dist-library/types/sdk/preset-core.d.ts +11 -0
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +33 -0
- package/dist-library/types/sdk/registry-core.d.ts +16 -0
- package/dist-library/types/sdk/registry.d.ts +18 -0
- package/dist-library/types/sdk/theme.d.ts +73 -0
- package/dist-library/types/sdk/types.d.ts +221 -0
- package/dist-library/types/sdk/version.d.ts +49 -0
- package/dist-library/types/shareable.d.ts +29 -3
- package/dist-library/types/standalone/diagnostics.d.ts +16 -0
- package/dist-library/types/standalone/events.d.ts +4 -0
- package/dist-library/types/standalone/library.d.ts +6 -0
- package/dist-library/types/standalone/payload.d.ts +15 -0
- package/dist-library/types/standalone/prepare.d.ts +21 -0
- package/dist-library/types/standalone/session.d.ts +68 -0
- package/dist-library/types/standalone/version.d.ts +7 -0
- package/dist-library/types/testing/behavior.d.ts +19 -0
- package/dist-library/types/testing/browser.d.ts +126 -0
- package/dist-library/types/testing/cases.d.ts +16 -0
- package/dist-library/types/testing/index.d.ts +13 -0
- package/dist-library/types/testing/manifest.d.ts +10 -0
- package/dist-library/types/testing/react.d.ts +45 -0
- package/dist-library/types/testing/report.d.ts +20 -0
- package/dist-library/types/testing/types.d.ts +125 -0
- package/dist-library/types/testing/values.d.ts +22 -0
- package/dist-library/types/vite/client.d.ts +36 -0
- package/dist-library/types/vite/discovery.d.ts +51 -0
- package/dist-library/types/vite/index.d.ts +31 -0
- package/dist-library/types/vite/registration.d.ts +109 -0
- package/dist-library/types-BFCrMrg0.js +52 -0
- package/dist-library/validation-W-bmny-x.js +2253 -0
- package/dist-library/values-CIt8AjiU.js +134 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +591 -95
- package/docs/README-ch.md +90 -0
- package/docs/README.md +87 -81
- package/docs/compatibility/compatibility-ch.md +22 -14
- package/docs/compatibility/compatibility-en.md +22 -14
- package/docs/compatibility/source-versioning-ch.md +15 -12
- package/docs/compatibility/source-versioning-en.md +16 -13
- package/docs/development/component-development-ch.md +51 -195
- package/docs/development/component-development-en.md +51 -195
- package/docs/development/component-development-reference-ch.md +253 -0
- package/docs/development/component-development-reference-en.md +238 -0
- package/docs/development/component-protocol-ch.md +51 -50
- package/docs/development/component-protocol-en.md +52 -49
- package/docs/development/local-module-layout-ch.md +59 -0
- package/docs/development/local-module-layout-en.md +59 -0
- package/docs/development/performance-overview-ch.md +402 -0
- package/docs/development/performance-overview-en.md +402 -0
- package/docs/development/releasing-ch.md +8 -104
- package/docs/development/releasing-en.md +8 -104
- package/docs/guides/local-guide-ch.md +28 -9
- package/docs/guides/local-guide-en.md +31 -12
- package/docs/integration/author-tools-ch.md +4 -2
- package/docs/integration/author-tools-en.md +4 -2
- package/docs/integration/codemirror-ch.md +52 -0
- package/docs/integration/codemirror-en.md +29 -0
- package/docs/integration/compiler-ch.md +47 -0
- package/docs/integration/compiler-en.md +34 -0
- package/docs/integration/directory-discovery-ch.md +53 -0
- package/docs/integration/directory-discovery-en.md +31 -0
- package/docs/integration/editor-ch.md +48 -21
- package/docs/integration/editor-en.md +48 -21
- package/docs/integration/extension-sdk-ch.md +392 -0
- package/docs/integration/extension-sdk-en.md +377 -0
- package/docs/integration/local-integration-ch.md +63 -9
- package/docs/integration/local-integration-en.md +89 -13
- package/docs/integration/repository-split-ch.md +40 -0
- package/docs/integration/repository-split-en.md +23 -0
- package/docs/integration/shareable-export-ch.md +46 -2
- package/docs/integration/shareable-export-en.md +46 -2
- package/docs/reference/computations-formatting-ch.md +4 -2
- package/docs/reference/computations-formatting-en.md +4 -2
- package/docs/reference/constraints-collections-ch.md +21 -1
- package/docs/reference/constraints-collections-en.md +21 -1
- package/docs/reference/diagnostics-counting-ch.md +1 -1
- package/docs/reference/diagnostics-counting-en.md +1 -1
- package/docs/reference/html-compatibility-ch.md +4 -0
- package/docs/reference/html-compatibility-en.md +4 -0
- package/docs/reference/local-components-v2-ch.md +2 -0
- package/docs/reference/local-components-v2-en.md +2 -0
- package/docs/reference/local-interaction-syntax-ch.md +51 -15
- package/docs/reference/local-interaction-syntax-en.md +58 -14
- package/docs/reference/theme-protocol-ch.md +79 -7
- package/docs/reference/theme-protocol-en.md +79 -7
- package/docs/reference/tolerance-ch.md +64 -0
- package/docs/reference/tolerance-en.md +57 -0
- package/docs/releases/release-0.4.0-ch.md +2 -0
- package/docs/releases/release-0.4.0-en.md +2 -0
- package/docs/releases/release-0.4.1-ch.md +2 -0
- package/docs/releases/release-0.4.1-en.md +2 -0
- package/docs/releases/release-0.5.0-ch.md +2 -0
- package/docs/releases/release-0.5.0-en.md +2 -0
- package/docs/releases/release-0.5.1-ch.md +2 -0
- package/docs/releases/release-0.5.1-en.md +2 -0
- package/docs/releases/release-0.5.2-ch.md +2 -0
- package/docs/releases/release-0.5.2-en.md +2 -0
- package/docs/releases/release-0.5.3-ch.md +2 -0
- package/docs/releases/release-0.5.3-en.md +2 -0
- package/docs/releases/release-0.6.0-ch.md +2 -0
- package/docs/releases/release-0.6.0-en.md +2 -0
- package/docs/releases/release-0.6.1-ch.md +2 -0
- package/docs/releases/release-0.6.1-en.md +2 -0
- package/docs/releases/release-0.7.0-ch.md +86 -0
- package/docs/releases/release-0.7.0-en.md +86 -0
- package/docs/releases/release-0.8.0-ch.md +126 -0
- package/docs/releases/release-0.8.0-en.md +126 -0
- package/examples/component-package/LICENSE +21 -0
- package/examples/component-package/NOTICES.md +12 -0
- package/examples/component-package/README-ch.md +101 -0
- package/examples/component-package/README.md +133 -0
- package/examples/component-package/package.json +35 -0
- package/examples/component-package/sample/document.reactive.md +14 -0
- package/examples/component-package/scripts/build-export.mjs +44 -0
- package/examples/component-package/scripts/build.mjs +130 -0
- package/examples/component-package/scripts/verify.mjs +257 -0
- package/examples/component-package/src/assets/notice.svg +4 -0
- package/examples/component-package/src/component.css +40 -0
- package/examples/component-package/src/components.tsx +105 -0
- package/examples/component-package/src/harness.tsx +34 -0
- package/examples/component-package/src/manifests.ts +71 -0
- package/examples/component-package/src/node-entry.ts +18 -0
- package/examples/component-package/src/sample.ts +4 -0
- package/examples/component-package/src/theme.css +44 -0
- package/examples/component-package/src/theme.ts +22 -0
- package/examples/component-package/tsconfig.json +15 -0
- package/examples/conformance/README-ch.md +55 -0
- package/examples/conformance/README.md +2 -0
- package/examples/conformance/local-draft-3.json +296 -0
- package/examples/game-2048-package/LICENSE +21 -0
- package/examples/game-2048-package/NOTICES.md +11 -0
- package/examples/game-2048-package/README-ch.md +97 -0
- package/examples/game-2048-package/README.md +102 -0
- package/examples/game-2048-package/package.json +35 -0
- package/examples/game-2048-package/sample/document.reactive.md +17 -0
- package/examples/game-2048-package/scripts/build-export.mjs +44 -0
- package/examples/game-2048-package/scripts/build.mjs +130 -0
- package/examples/game-2048-package/scripts/verify.mjs +180 -0
- package/examples/game-2048-package/src/component.css +161 -0
- package/examples/game-2048-package/src/components.tsx +326 -0
- package/examples/game-2048-package/src/game-engine.ts +228 -0
- package/examples/game-2048-package/src/harness.tsx +34 -0
- package/examples/game-2048-package/src/manifest.ts +85 -0
- package/examples/game-2048-package/src/node-entry.ts +30 -0
- package/examples/game-2048-package/src/sample.ts +4 -0
- package/examples/game-2048-package/tsconfig.json +15 -0
- package/examples/integration/README-ch.md +63 -0
- package/examples/integration/README.md +17 -1
- package/examples/integration/extension-sdk/README-ch.md +24 -0
- package/examples/integration/extension-sdk/README.md +24 -0
- package/examples/integration/extension-sdk/advanced-standalone.ts +6 -0
- package/examples/integration/extension-sdk/advanced.tsx +101 -0
- package/examples/integration/extension-sdk/env.d.ts +2 -0
- package/examples/integration/extension-sdk/extensions.tsx +97 -0
- package/examples/integration/extension-sdk/index.html +3 -0
- package/examples/integration/extension-sdk/main.tsx +10 -0
- package/examples/integration/extension-sdk/package.json +6 -0
- package/examples/integration/extension-sdk/standalone.ts +7 -0
- package/examples/integration/extension-sdk/tsconfig.json +8 -0
- package/examples/integration/react-comprehensive/index.html +12 -0
- package/examples/integration/react-comprehensive/main.jsx +123 -0
- package/examples/integration/react-comprehensive/package.json +18 -0
- package/examples/local/README-ch.md +76 -0
- package/examples/local/README.md +4 -2
- package/examples/local/scenarios/blog-zh.reactive.md +71 -0
- package/examples/local/scenarios/blog.reactive.md +71 -0
- package/examples/local/scenarios/classroom-zh.reactive.md +97 -0
- package/examples/local/scenarios/classroom.reactive.md +97 -0
- package/examples/local/scenarios/proposal-zh.reactive.md +79 -0
- package/examples/local/scenarios/proposal.reactive.md +79 -0
- package/examples/local/scenarios/survey-zh.reactive.md +74 -0
- package/examples/local/scenarios/survey.reactive.md +74 -0
- package/examples/local/showcase/README-ch.md +22 -0
- package/examples/local/showcase/README.md +9 -3
- package/examples/local/showcase/features.reactive.md +637 -0
- package/examples/local/showcase/zh/features.reactive.md +637 -0
- package/examples/sci-fi-theme/README-ch.md +131 -0
- package/examples/sci-fi-theme/README.md +146 -0
- package/examples/sci-fi-theme/demo/demo.css +532 -0
- package/examples/sci-fi-theme/demo/document.reactive.md +185 -0
- package/examples/sci-fi-theme/demo/index.html +13 -0
- package/examples/sci-fi-theme/demo/main.tsx +180 -0
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -0
- package/examples/sci-fi-theme/docs/design-system.md +474 -0
- package/examples/sci-fi-theme/package.json +27 -0
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -0
- package/examples/sci-fi-theme/src/components.css +1460 -0
- package/examples/sci-fi-theme/src/index.ts +6 -0
- package/examples/sci-fi-theme/src/sci-fi.css +5 -0
- package/examples/sci-fi-theme/src/theme.ts +37 -0
- package/examples/sci-fi-theme/src/tokens.css +408 -0
- package/examples/sci-fi-theme/tsconfig.json +20 -0
- package/examples/sci-fi-theme/vite.config.ts +24 -0
- package/examples/tetris-package/LICENSE +21 -0
- package/examples/tetris-package/NOTICES.md +11 -0
- package/examples/tetris-package/README-ch.md +91 -0
- package/examples/tetris-package/README.md +95 -0
- package/examples/tetris-package/package.json +35 -0
- package/examples/tetris-package/sample/document.reactive.md +16 -0
- package/examples/tetris-package/scripts/build-export.mjs +44 -0
- package/examples/tetris-package/scripts/build.mjs +130 -0
- package/examples/tetris-package/scripts/verify.mjs +173 -0
- package/examples/tetris-package/src/component.css +145 -0
- package/examples/tetris-package/src/components.tsx +334 -0
- package/examples/tetris-package/src/harness.tsx +34 -0
- package/examples/tetris-package/src/manifests.ts +93 -0
- package/examples/tetris-package/src/node-entry.ts +16 -0
- package/examples/tetris-package/src/sample.ts +4 -0
- package/examples/tetris-package/src/tetris-engine.ts +325 -0
- package/examples/tetris-package/tsconfig.json +15 -0
- package/package.json +98 -44
- package/dist-library/compiler-Cm3ppMxG.js +0 -46044
- package/dist-library/react-Bh7_oxZp.js +0 -59655
- package/dist-library/reactive-md-editor.css +0 -2
- package/dist-library/reactive-md-editor.js +0 -3853
- package/dist-library/runtime-DlFYQ4s_.js +0 -498
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +0 -7
- package/dist-library/types/editor/editor-toolbar.d.ts +0 -24
- package/dist-library/types/editor/editor-view-bar.d.ts +0 -11
- package/dist-library/types/editor/extended-native-components.d.ts +0 -58
- package/dist-library/types/editor/index.d.ts +0 -9
- package/dist-library/types/editor/locale.d.ts +0 -13
- package/dist-library/types/editor/source-authoring.d.ts +0 -59
- package/dist-library/types/editor/types.d.ts +0 -48
- package/dist-library/types/editor/use-gutter-metrics.d.ts +0 -5
- package/dist-library/types/editor/use-source-history.d.ts +0 -16
- package/dist-library/types/local/compiler.d.ts +0 -4
- package/dist-library/types/local/math.d.ts +0 -48
- package/dist-library/types/local/options.d.ts +0 -36
- package/dist-library/types/local/parser.d.ts +0 -13
- package/dist-library/types/local/render-types.d.ts +0 -27
- package/dist-library/types/local/runtime.d.ts +0 -2
- package/dist-library/types/local/schema.d.ts +0 -77
- package/dist-library/types/local/types.d.ts +0 -263
- package/dist-library/types/local/visuals.d.ts +0 -12
- package/dist-library/types/local/worker.d.ts +0 -98
- package/docs/development/performance-ch.md +0 -76
- package/docs/development/performance-en.md +0 -76
- /package/dist-library/types/{editor → authoring}/command-types.d.ts +0 -0
- /package/dist-library/types/{editor → authoring}/editor-commands.d.ts +0 -0
- /package/dist-library/types/local/{locale.d.ts → contracts/locale.d.ts} +0 -0
- /package/dist-library/types/local/{collection-functions.d.ts → evaluation/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/{data-functions.d.ts → evaluation/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/{dates.d.ts → evaluation/dates.d.ts} +0 -0
- /package/dist-library/types/local/{formatting.d.ts → evaluation/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{html-names.d.ts → html/html-names.d.ts} +0 -0
- /package/dist-library/types/local/{text-length.d.ts → source/text-length.d.ts} +0 -0
- /package/dist-library/types/local/{colors.d.ts → theme/colors.d.ts} +0 -0
- /package/dist-library/types/local/{code-block.d.ts → widgets/code-block.d.ts} +0 -0
- /package/dist-library/types/local/{code-languages.d.ts → widgets/code-languages.d.ts} +0 -0
- /package/dist-library/types/local/{diagram-layout.d.ts → widgets/diagram-layout.d.ts} +0 -0
- /package/dist-library/types/local/{image-view.d.ts → widgets/image-view.d.ts} +0 -0
- /package/dist-library/types/local/{math-view.d.ts → widgets/math-view.d.ts} +0 -0
- /package/dist-library/types/local/{table-surface.d.ts → widgets/table-surface.d.ts} +0 -0
|
@@ -1,210 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Build a component plugin in five minutes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [中文](component-development-ch.md) · [Full development contract](component-development-reference-en.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Start with a note container that can expand Markdown. The extension SDK ships in `reactive-md@0.7.0`; install the published package.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Create and run
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## 2. From proposal to acceptance
|
|
16
|
-
|
|
17
|
-
1. Submit the declaration template in section 5, stating purpose, syntax, state, errors, budgets and version impact. When it overlaps existing components, explain what a combination of existing components or Markdown still lacks.
|
|
18
|
-
2. Mark the applicable `CP-*` clauses. A component without bindings, timing or computation may mark the corresponding items as "not applicable" and explain why.
|
|
19
|
-
3. Check the implementation locations in the table below. When reusing existing generic logic, explain why no new branch is needed; when a new branch is needed, check the compiler and runtime consumers together.
|
|
20
|
-
4. Add a minimal normal example, invalid input and boundary cases. For state, check initialization, rejected writes, sharing, hiding and reset; for computation, check budgets.
|
|
21
|
-
5. Run the affected checks from section 6. Keep the commands, results and browser observations, and state outstanding items clearly.
|
|
22
|
-
6. Update the syntax, compatibility notes, changelog and relevant examples. Attach the declaration and evidence in the PR so maintainers can verify version and migration impact.
|
|
23
|
-
|
|
24
|
-
| Implementation surface | Location | What to check |
|
|
25
|
-
| --- | --- | --- |
|
|
26
|
-
| Tag parsing | `src/local/parser.ts` | `VOID`, `PAIRED`, `INLINE` and the `KNOWN` set generated from them; shape, nesting, code isolation and unknown-region fallback |
|
|
27
|
-
| Component declaration | `src/local/schema.ts` | Name, `form`, `childRule`, parent, attribute types and defaults, `binding`, `initialRule` |
|
|
28
|
-
| Compilation | `src/local/compiler.ts` | Attributes and child content, expression types, binding family, shared constraints, initial values and budgets |
|
|
29
|
-
| State runtime | `src/local/runtime.ts` | Canonical control lookup, write types and constraints, atomic commits, array copies, reset and disposal |
|
|
30
|
-
| Controls and layout | `src/local/LocalDocumentView.tsx` | `COMPONENTS`, input drafts, accessible names, keyboard, visibility, reset tokens and effect cleanup |
|
|
31
|
-
| Visualization | `src/local/visuals.tsx`, `src/local/math.ts` | `VISUAL_COMPONENTS`, plot or table semantics, local errors, computation budgets, readouts and reset |
|
|
32
|
-
| Styles | `src/local/local.css`, `src/local/visuals.css`, `src/theme.css` | Theme variables, class prefixes, focus, narrow screens and styling effects outside the document |
|
|
33
|
-
| Budgets and types | `src/local/limits.ts`, `src/local/types.ts`, `src/local/render-types.ts` | Boundaries for new resources; core types do not depend on React; internal nodes do not become a persistence format |
|
|
34
|
-
| Evidence and documentation | `tests/`, [conformance data](../../examples/conformance/README.md), [syntax specification](../reference/local-interaction-syntax-en.md) | Concrete behavior cases, copyable examples, migration and check records |
|
|
35
|
-
|
|
36
|
-
A new declaration does not automatically synchronize the parser, runtime and renderer. Conversely, when existing generic validation is sufficient, there is no need to add branches just to complete the file checklist.
|
|
37
|
-
|
|
38
|
-
## 3. How to judge compatibility
|
|
39
|
-
|
|
40
|
-
Judge by the [compatibility notes](../compatibility/compatibility-en.md) and the CP-COMPAT clauses of the protocol. The project currently requires author-visible syntax changes to establish a new syntax revision and raise the package minor version; "the old valid form still works" does not mean a new tag can be added within the same syntax revision.
|
|
41
|
-
|
|
42
|
-
| Change | Handling |
|
|
43
|
-
| --- | --- |
|
|
44
|
-
| New tag, new author-visible attribute | Record it as a capability addition, establish a new syntax revision, update `LOCAL_SYNTAX_VERSION`, the package minor version, the syntax specification and conformance data |
|
|
45
|
-
| Rename, removal, changed default, binding type, child item or initial-value rule | Record as a breaking change and provide the old form, new form, affected scope and migration checks |
|
|
46
|
-
| Implementation fix, optimization or style adjustment that keeps existing semantics, accessibility and resource boundaries | Add regression evidence according to actual impact; classify public API or author semantics changes separately |
|
|
47
|
-
| Diagnostic code change | Update the corresponding conformance data and changelog; follow the 0.x diagnostic code compatibility convention and do not depend on message text |
|
|
48
|
-
| Change to a MUST clause, required declaration or machine format semantics of this protocol | Raise the protocol revision; judge separately whether syntax or API changes |
|
|
49
|
-
|
|
50
|
-
A new tag has one more migration impact: the old implementation displays the complete unknown region as inert source, while the new implementation may start executing inner content after recognizing the name. This must be recorded in the proposal with before/after cases. Whether a name joins the core component set is reviewed by maintainers; do not override the meaning of an existing name or quietly add an alias.
|
|
51
|
-
|
|
52
|
-
This protocol itself adds no author tags or attributes, so it keeps `local-draft-2` and the current package version.
|
|
53
|
-
|
|
54
|
-
## 4. Filling in a declaration with existing components
|
|
55
|
-
|
|
56
|
-
The three existing components below show the contracts for a control, a container and a computational visualization. They are executable examples, not design drafts for a new API.
|
|
57
|
-
|
|
58
|
-
### slider: a numeric control
|
|
59
|
-
|
|
60
|
-
```markdown
|
|
61
|
-
<slider bind="seats" label="People" initial="2" min="1" max="20">
|
|
62
|
-
|
|
63
|
-
Current cost: {{ seats * 100 }} USD.
|
|
9
|
+
```sh
|
|
10
|
+
npx reactive-md init component ../my-note --name my-note --id acme/my-note --form container --props '{"label":{"kind":"string","default":"Note"}}' --yes
|
|
11
|
+
cd ../my-note
|
|
12
|
+
npm install reactive-md@0.7.0 react@^19 react-dom@^19
|
|
13
|
+
npm run dev
|
|
64
14
|
```
|
|
65
15
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</
|
|
16
|
+
Open the address printed by Vite. The page shows a note with Markdown children. Omit fields to answer terminal prompts, or use `--yes` for noninteractive defaults. See `init component --help` for options.
|
|
17
|
+
|
|
18
|
+
## Edit one component
|
|
19
|
+
|
|
20
|
+
Replace the generated `src/my-note.tsx` with:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { useState } from 'react';
|
|
24
|
+
import { defineReactComponentPackage, type LocalComponentContext } from 'reactive-md/react';
|
|
25
|
+
import { manifest } from './manifest.js';
|
|
26
|
+
|
|
27
|
+
function Note(ctx: LocalComponentContext) {
|
|
28
|
+
const [open, setOpen] = useState(true);
|
|
29
|
+
const title = String(ctx.props.label);
|
|
30
|
+
if (ctx.mode === 'static') {
|
|
31
|
+
return <aside className="my-note" data-my-note>
|
|
32
|
+
<strong>{title}</strong>{ctx.children.render()}
|
|
33
|
+
</aside>;
|
|
34
|
+
}
|
|
35
|
+
return <aside className="my-note" data-my-note>
|
|
36
|
+
<button disabled={ctx.disabled} onClick={() => setOpen(value => !value)}>
|
|
37
|
+
{title}
|
|
38
|
+
</button>
|
|
39
|
+
{open ? ctx.children.render() : null}
|
|
40
|
+
</aside>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const componentPackage = defineReactComponentPackage({
|
|
44
|
+
...manifest,
|
|
45
|
+
render: Note,
|
|
46
|
+
css: '.local-document .my-note { padding: 12px; color: var(--ink); border: 1px solid var(--accent); }',
|
|
47
|
+
});
|
|
83
48
|
```
|
|
84
49
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Acceptance should prove that `b` on the inactive page still initializes to 7, switching preserves child content state, unknown page values are rejected, a second component cannot declare the same binding, and panel reset restores the page and child controls. Arrow keys, Home/End, focus, and the need for the reader to start a paused hidden timer again require corresponding browser checks. Corresponding protocol clauses: CP-STATE-11, CP-VIS and CP-LIFE.
|
|
88
|
-
|
|
89
|
-
### plot: budget-constrained computation
|
|
90
|
-
|
|
91
|
-
```markdown
|
|
92
|
-
<slider bind="a" label="Amplitude" initial="1" min="0" max="3" step="0.5">
|
|
93
|
-
<slider bind="high" label="Right bound" initial="3" min="1" max="10">
|
|
94
|
-
|
|
95
|
-
<plot label="Sine wave" min="-2" max="{{ high }}">
|
|
96
|
-
$$ y = a \sin x $$
|
|
97
|
-
</plot>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Declaration points: the body is one or more standalone formula blocks, each written `y = expression`; `min/max` may be dynamic and require `min < max`; `samples` is a static integer, default 200, range 2 to 2000. Formula parameters must be declared numeric bindings.
|
|
101
|
-
|
|
102
|
-
Acceptance should cover valid LaTeX, parameter changes, dynamic ranges, non-numeric parameters and invalid ranges. Each plot has at most 16 curves; the whole document may request at most 20,000 sample points, and computation shares a budget of 2,000,000 steps, including hidden regions. Invalid samples should break the curve; empty data and local errors need explicit display. Pointer and keyboard readouts, narrow screens and legend interaction need separate browser checks. Corresponding protocol clauses: CP-STATE-12, CP-DIAG-04, CP-SEC-03.
|
|
50
|
+
Click the title to expand or collapse its Markdown. The same renderer handles static output through `ctx.mode`. Supply `renderStatic` when a different layout is needed. Components own local React state and timers; the kernel validates shared bindings and rejects writes in static mode. Timer effects should return immediately in static mode and clean up on unmount.
|
|
103
51
|
|
|
104
|
-
##
|
|
52
|
+
## Assemble the host once
|
|
105
53
|
|
|
106
|
-
|
|
54
|
+
Enable `reactiveMd()` in the consuming project and put a default `componentPackage` export in `plugin/my-note/index.ts`. Put themes in `theme/<name>/theme.css`. The plugin discovers added directories and collects CSS and offline resources. Read `host` from `virtual:reactive-md/host`; use `host.reactConfig` for React and `host.compileOptions` for compilation and Workers. See the [directory integration rules](../integration/directory-discovery-en.md).
|
|
107
55
|
|
|
108
|
-
|
|
109
|
-
# Component proposal: <name>
|
|
56
|
+
Advanced hosts can keep `reactiveMd({ extensions: './extensions.ts' })` and compose packages with `createReactHost`.
|
|
110
57
|
|
|
111
|
-
##
|
|
58
|
+
## Check and pack
|
|
112
59
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## Version and name
|
|
119
|
-
|
|
120
|
-
| Item | Decision |
|
|
121
|
-
| --- | --- |
|
|
122
|
-
| Package version | Current value, target value and rationale |
|
|
123
|
-
| Syntax revision | Current value, target value and migration impact |
|
|
124
|
-
| Protocol revision | component-protocol-2, or describe the new revision |
|
|
125
|
-
| Name | Lowercase kebab-case; conflict check and maintainer decision |
|
|
126
|
-
| Shape | leaf / inline / container |
|
|
127
|
-
| Parent, direct children | Allowed scope, count, nesting and whitespace rules |
|
|
128
|
-
|
|
129
|
-
## Syntax
|
|
130
|
-
|
|
131
|
-
Provide a minimal runnable document and one form that must be rejected.
|
|
132
|
-
|
|
133
|
-
## Attributes
|
|
134
|
-
|
|
135
|
-
| Attribute | Type and unit | Static or dynamic | Required | Default | Constraints and failure diagnostics |
|
|
136
|
-
| --- | --- | --- | --- | --- | --- |
|
|
137
|
-
| To fill in | string/number/boolean/enum | Whether interpolation is allowed, how types are preserved | Yes/No | Specific value or none | Range, enum, length, code |
|
|
138
|
-
|
|
139
|
-
## State
|
|
140
|
-
|
|
141
|
-
- Whether there is a bind; value type and family; whether it is exclusive:
|
|
142
|
-
- How explicit and default initial values are produced:
|
|
143
|
-
- Conditions under which a same-name binding may be shared:
|
|
144
|
-
- Valid writes, invalid writes, atomicity and subscriptions:
|
|
145
|
-
- Input drafts and internal UI state:
|
|
146
|
-
- Scope of panel reset, shared values and internal state:
|
|
147
|
-
- Hiding, showing again, source changes, instance isolation:
|
|
148
|
-
- Timers, subscriptions, event listeners and disposal:
|
|
149
|
-
|
|
150
|
-
## Diagnostics and fallback
|
|
151
|
-
|
|
152
|
-
| Trigger | Phase | severity and code | Location | Expected result |
|
|
153
|
-
| --- | --- | --- | --- | --- |
|
|
154
|
-
| To fill in | compile/runtime/render | warning/error, specific code | Source range | Reject, keep the old state or show locally |
|
|
155
|
-
|
|
156
|
-
Describe the old implementation's behavior when displaying the unknown tag as source, and what changes once the name is recognized.
|
|
157
|
-
|
|
158
|
-
## Security, budgets and presentation
|
|
159
|
-
|
|
160
|
-
- How untrusted input is validated; responsibilities of trusted host code:
|
|
161
|
-
- Budgets for input length, collection size, computation count, recursion or sampling:
|
|
162
|
-
- Who sets budgets, at which phases they are checked, and the result when exceeded:
|
|
163
|
-
- Accessible name, role, state, keyboard and focus:
|
|
164
|
-
- 375px, touch targets, dark theme and style scoping:
|
|
165
|
-
- Style files and theme variables added or changed:
|
|
166
|
-
|
|
167
|
-
## Compatibility and migration
|
|
168
|
-
|
|
169
|
-
- Change classification and rationale:
|
|
170
|
-
- Old form, old result:
|
|
171
|
-
- New form, new result:
|
|
172
|
-
- Affected source, host API, diagnostics, budgets or rendering behavior:
|
|
173
|
-
- Migration method and post-upgrade verification:
|
|
174
|
-
|
|
175
|
-
## Files and acceptance
|
|
176
|
-
|
|
177
|
-
| Applicable CP-* clauses | Files to change | Cases or checks | Actual results and evidence |
|
|
178
|
-
| --- | --- | --- | --- |
|
|
179
|
-
| To fill in | Real paths; explain reuse when no change is needed | Normal, invalid, boundary, state or browser checks | Pass/fail/not run |
|
|
180
|
-
|
|
181
|
-
- Portable conformance data and component-specific tests:
|
|
182
|
-
- Commands actually run and their results:
|
|
183
|
-
- Browser, viewport, specific actions and observations:
|
|
184
|
-
- Outstanding evidence; rationale and alternative evidence for SHOULD deviations:
|
|
60
|
+
```sh
|
|
61
|
+
npm run typecheck
|
|
62
|
+
npm test
|
|
63
|
+
npm pack --ignore-scripts
|
|
185
64
|
```
|
|
186
65
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
## 6. Choosing checks by impact
|
|
190
|
-
|
|
191
|
-
Install existing dependencies in the root directory before running checks; see the [contributing guide](../../CONTRIBUTING.md) for the environment and full commands. Behavior changes must have tests that directly cover the behavior; the table below is used to determine the scope of checks.
|
|
192
|
-
|
|
193
|
-
| Change | Minimum useful checks |
|
|
194
|
-
| --- | --- |
|
|
195
|
-
| Protocol, guide or links only | `npm run test:docs`; verify the rules against the current syntax, security and compatibility documentation |
|
|
196
|
-
| Conformance data or runner | `npm run test:components`, `npm run typecheck` |
|
|
197
|
-
| Parsing, compilation, bindings or runtime | Targeted tests for the component, `npm run test:components`, `npm run build`; run related regressions or `npm test` for shared logic changes |
|
|
198
|
-
| React, styles or interaction | Corresponding renderer tests, `npm run build:demo`, and affected browser actions |
|
|
199
|
-
| Public entries, types or distribution files | After building, run `npm run test:package`, `npm run test:packed` |
|
|
200
|
-
| Documentation, syntax, examples or versions | `npm run test:docs`, compilation of the corresponding examples and a migration review |
|
|
201
|
-
| Full release gate | `npm run verify:release`; it covers the Node-side and browser checks, packed consumption and combined document behavior. Use it before release or when a change spans several of the rows above |
|
|
202
|
-
|
|
203
|
-
`npm run test:components` runs the protocol's representative `slider`, `tabs` and `plot` cases plus existing language conformance data. See the [conformance notes](../../examples/conformance/README.md) for file format, field meaning and execution order. New components keep adding their own cases; this command does not prove that all 48 tag names or all browser behavior are certified. Added `tests/**/*.test.ts` or `.tsx` files are also run by the existing `npm test` and CI.
|
|
204
|
-
|
|
205
|
-
Browser checks must record the specific environment and actions. Check real keyboard and focus, IME drafts, 375px layout, touch, themes, reset, hiding and showing again, timer pause and unmount cleanup as applicable to the component. Existing automated browser checks can provide evidence for corresponding behavior; items not yet covered, such as screen reader experience, require manual checks. Static SSR proves only server output, not real input, effect lifecycles or hydration.
|
|
206
|
-
|
|
207
|
-
List the commands actually run and observations in the PR. State not run, failed and not applicable separately; do not treat checked boxes as verification evidence.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
See [local-draft-2 components and migration](../reference/local-components-v2-en.md) for new tags, colors and slot state. `0.5.2` is the preview release on the `next` channel.
|
|
66
|
+
Install the tarball in another host and import its public entries. See the [full development contract](component-development-reference-en.md) for bindings, containers, pure manifest entries, capabilities, resources, offline export and compliance evidence. The [Demo guide](https://github.com/yao1145/ReactiveMD/blob/main/demo/README.md) describes the installed-package cases for `<tetris>` and `<game-2048>`.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# 组件插件完整开发契约
|
|
2
|
+
|
|
3
|
+
**中文** · [English](component-development-reference-en.md) · [五分钟入门](component-development-ch.md)
|
|
4
|
+
|
|
5
|
+
这里的插件是宿主通过 npm 安装、显式导入并组合的组件包或主题包。组件声明、React 实现、编辑器信息与资源共同形成开发契约;宿主用 `createLocalConfig` 和 `createReactConfig` 装配它们。
|
|
6
|
+
|
|
7
|
+
扩展 SDK 随 `reactive-md@0.7.0` 发布。以下流程安装公开包;只有测试尚未发布的 SDK 改动时才需要从当前源码打包 tarball。完整类型与限制见 [SDK 指南](../integration/extension-sdk-ch.md)。历史实现与验收记录已归档,不再随文档维护。
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 便捷定义与宿主组合
|
|
11
|
+
|
|
12
|
+
简单组件从 `reactive-md/react` 使用 `defineReactComponentPackage`,声明和实现可以放在一个文件:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
const componentPackage = defineReactComponentPackage({
|
|
16
|
+
id: 'acme/score', name: 'acme-score', version: '1.0.0',
|
|
17
|
+
capabilities: { interactive: true, static: true, ssr: true, offline: true },
|
|
18
|
+
props: { label: { kind: 'string', default: 'Score' } },
|
|
19
|
+
css: '.local-document .acme-score { color: var(--ink); }',
|
|
20
|
+
render: ctx => <span className="acme-score">{String(ctx.props.label)}</span>,
|
|
21
|
+
});
|
|
22
|
+
const host = createReactHost({ packages: [componentPackage] });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
工厂默认 `protocol: reactive-md-component/v1`、`form: leaf` 和空属性声明。有 CSS 时默认资源 ID 为 `id + '.css'`;没有 CSS 时不会生成虚假的样式依赖。多资源或共享资源可显式传 `resources`、`styles`。能力仍须声明,并通过合规工具提供证据。
|
|
26
|
+
|
|
27
|
+
返回的 `componentPackage.definition` 是可序列化 manifest,`components` 是实现数组,`resources` 是经校验的 CSS。宿主通过 `createReactHost({ packages, components?, themes?, resources?, notices? })` 一次组合,得到同源的 `config`、`reactConfig`、`compileOptions`、`resources`、`css` 和 `notices`。组件名称、版本依赖和资源冲突继续走既有校验;默认预设保持启用。
|
|
28
|
+
|
|
29
|
+
正式包保留纯声明入口。分文件开发时,可将已有 manifest 展开到便捷工厂中;该 manifest 的样式身份应与组件资源一致。脚手架用一个 ID 常量推导纯 manifest 的样式声明,防止纯入口与 React 入口出现不同摘要。单文件开发也可在构建时将规范化后的 `definition` 输出为纯数据入口。React/DOM 实现留在实现入口,Worker 只接收序列化配置。
|
|
30
|
+
|
|
31
|
+
`renderStatic` 已经可选,缺省复用 `render`。用 `ctx.mode === 'static'` 或 `ctx.bindings.isReadOnly` 切换表现;静态模式拒绝共享绑定写入,但组件自己的 React state、计时器和事件处理仍需自行约束。计时器 effect 在静态模式返回并保留卸载清理。只有不同静态版式才需要额外函数。
|
|
32
|
+
|
|
33
|
+
## Vite 宿主适配与配置诊断
|
|
34
|
+
|
|
35
|
+
Vite 项目使用公开 Node 入口:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { reactiveMd } from 'reactive-md/vite';
|
|
39
|
+
export default { plugins: [reactiveMd()] };
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
默认发现宿主的 `theme/` 与 `plugin/`。完整约定见[目录接入](../integration/directory-discovery-ch.md)。手动模式 `reactiveMd({ extensions: './extensions.ts' })` 仍接受导出 `host = createReactHost(...)` 的模块。应用从 `virtual:reactive-md/host` 获取 `host`,不再维护专属别名、组件样式注入或依赖排除表。虚拟入口也导出配置与资源字段,以及 `extensions` 命名空间,供宿主读取样例等自定义元数据;这些元数据不会进入 Worker。类型入口为 `reactive-md/vite/client`。
|
|
43
|
+
|
|
44
|
+
插件合并已有 Vite 设置,排除 ReactiveMD JS 子入口的预构建并对 React 去重。组件默认样式先于主题样式注入;配置变化触发重载并清理旧样式。应用仍显式向预览提供 `host.reactConfig`,向编译器、作者工具及 Worker 提供 `host.compileOptions`,以支持多个独立宿主实例。核心基础样式由应用导入 `reactive-md/styles.css`,脚手架已包含这一步。
|
|
45
|
+
|
|
46
|
+
生产构建输出 `reactive-md-standalone.js` 和 `reactive-md-export.json`。浏览器导出器也可惰性导入 `virtual:reactive-md/bundle` 获取完整 bundle。插件复用公开构建适配器的能力、资源、预算与离线检查;只支持预览的组件保留预览,缺失能力通过错误清单和导出诊断提供。离线包包含全部登记组件,扩展模块必须能被 Node 构建入口加载。样式声明是资源身份,CSS 内容仍由包或明确资源描述提供,组件代码由宿主安装。
|
|
47
|
+
|
|
48
|
+
新编译文档携带 `componentConfigKey`,经过 Worker 和增量补丁保留。渲染、严格 SSR 和导出对照实际宿主配置,不一致时报告 `local.extension.config-mismatch`,避免漏传配置后只看到源码回退。已有扩展的版本与实现检查继续保留;旧文档缺少该字段时使用既有契约检查。
|
|
49
|
+
|
|
50
|
+
## 1. 在仓库外开始
|
|
51
|
+
|
|
52
|
+
准备 Node 22.12 或更高版本。React 适配器使用 React 19;模板的构建与浏览器测试依赖以它的 `package.json` 为准。
|
|
53
|
+
|
|
54
|
+
把 [examples/component-package](../../examples/component-package/README-ch.md) 复制到仓库之外的新目录,与 ReactiveMD 仓库并列,命名为 `my-reactivemd-plugin`。模板依赖已发布的 `reactive-md@0.7.0`。在新目录执行:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm install
|
|
58
|
+
npm run typecheck
|
|
59
|
+
npm test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
测试尚未发布的 SDK 改动时,改为从当前源码打包并安装 tarball。
|
|
63
|
+
|
|
64
|
+
`npm test` 构建 JS、类型、静态与交互 HTML,再执行 Node、SSR 和离线浏览器检查。浏览器测试需要已安装的 Playwright 浏览器;Windows 可按实际安装设置 `PLAYWRIGHT_CHANNEL=msedge`。先让原模板通过,再修改功能和对应测试。
|
|
65
|
+
|
|
66
|
+
## 2. 组织插件包
|
|
67
|
+
|
|
68
|
+
| 文件或出口 | 内容 |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `src/manifests.ts`,包出口 `.` | 数据 manifest;可由核心、Worker、作者工具读取 |
|
|
71
|
+
| `src/components.tsx`,包出口 `./react` | React 与静态实现,绑定到同一 manifest |
|
|
72
|
+
| `src/theme.ts`,包出口 `./theme` | 独立主题定义与资源身份 |
|
|
73
|
+
| `src/component.css`,包出口 `./styles.css` | 组件默认结构样式,CSS 引用的资源一起随包提供 |
|
|
74
|
+
| `scripts/build.mjs` | 生成 Node/浏览器产物与 `.d.ts`,完成示例导出 |
|
|
75
|
+
| `scripts/verify.mjs` | 执行 manifest、绑定、SSR、评分与容器各自的浏览器场景 |
|
|
76
|
+
| `LICENSE`、`NOTICES.md` | 本包及离线分发所需的许可与署名信息 |
|
|
77
|
+
|
|
78
|
+
manifest 保持可序列化,React 函数留在实现入口。发布出口指向构建后的 JavaScript 和声明文件,普通消费者通过公开包入口导入。
|
|
79
|
+
|
|
80
|
+
## 3. 定义组件契约
|
|
81
|
+
|
|
82
|
+
接下来的 `manifests.ts`、`components.tsx` 和 `host.tsx` 组成独立最小演示,`component.css` 见第 6 节。完整模板还有 note、主题与测试出口;在模板中修改组件时同步这些引用与验证场景。
|
|
83
|
+
|
|
84
|
+
以下评分契约保存为 `src/manifests.ts`:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { defineLocalComponent } from 'reactive-md/sdk';
|
|
88
|
+
|
|
89
|
+
export const rating = defineLocalComponent({
|
|
90
|
+
id: 'example/rating', name: 'rating', version: '1.0.0',
|
|
91
|
+
protocol: 'reactive-md-component/v1', form: 'leaf',
|
|
92
|
+
props: {
|
|
93
|
+
label: { kind: 'string', required: true },
|
|
94
|
+
max: { kind: 'number', dynamic: true, default: 5, min: 1, max: 10, integer: true },
|
|
95
|
+
},
|
|
96
|
+
bindings: {
|
|
97
|
+
value: {
|
|
98
|
+
kind: 'number', family: 'number', bind: 'bind', initial: 'initial',
|
|
99
|
+
initialRule: 'nearest-zero',
|
|
100
|
+
constraints: { min: { literal: 0 }, max: { prop: 'max' }, step: { literal: 1 } },
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
structure: { rule: 'none' },
|
|
104
|
+
capabilities: { interactive: true, static: true, ssr: true, offline: true },
|
|
105
|
+
authoring: {
|
|
106
|
+
title: { zh: '评分', en: 'Rating' }, category: 'input',
|
|
107
|
+
description: { zh: '与数字控件共享评分。', en: 'Share a rating with numeric controls.' },
|
|
108
|
+
insertText: '<rating bind="score" label="Score" max="5" initial="3">',
|
|
109
|
+
},
|
|
110
|
+
styles: ['example/component.css'],
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`id` 标识契约,`name` 是文档标签名,`version` 表示组件版本。注册时校验重复名称/id、协议、依赖、默认值与预算,默认拒绝覆盖内置名称。配置创建后冻结,变更组件集合时创建新配置。
|
|
115
|
+
|
|
116
|
+
声明为 number 的属性在校验后始终是数值;`max="5"` 与 `max="{{ 5 }}"` 的结果一致。实现读取归一化 props,绑定句柄负责把写入提交给内核。
|
|
117
|
+
|
|
118
|
+
形态支持 `leaf`、`inline`、`container`。容器在 manifest 中声明内容规则,由 `ctx.children.render()` 渲染 Markdown;有选项、表格或结构子项时使用对应公开内容投影。模板的 `note` 演示了容器实现。新增核心规则另见第 10 节。
|
|
119
|
+
|
|
120
|
+
## 4. 实现 React 和静态输出
|
|
121
|
+
|
|
122
|
+
`src/components.tsx` 可以提供以下独立实现:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { defineReactComponent, type LocalComponentContext } from 'reactive-md/react';
|
|
126
|
+
import { rating } from './manifests';
|
|
127
|
+
|
|
128
|
+
export function RatingControl(ctx: LocalComponentContext) {
|
|
129
|
+
const value = ctx.bindings.value.get() as number;
|
|
130
|
+
const maximum = ctx.props.max as number;
|
|
131
|
+
return <button className="rmd-example-rating"
|
|
132
|
+
disabled={ctx.disabled || !ctx.visible || value >= maximum}
|
|
133
|
+
aria-label={String(ctx.props.label)}
|
|
134
|
+
onClick={() => ctx.bindings.value.set(value + 1)}>{value}</button>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function RatingStatic(ctx: LocalComponentContext) {
|
|
138
|
+
return <span>{String(ctx.props.label)}: {String(ctx.bindings.value.get())}</span>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const ratingImplementation = defineReactComponent(rating, {
|
|
142
|
+
render: RatingControl, renderStatic: RatingStatic,
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
此处数值断言对应 manifest 中的 number 契约。静态实现显示当前值,交互实现通过内核绑定写入;非法更新保留原状态。多个数字槽位使用 `ctx.bindings.setMany` 原子提交,集合与槽位的支持范围见 SDK 指南。
|
|
147
|
+
|
|
148
|
+
局部 UI 状态可以使用 React state。计时器、订阅和事件监听在 effect 清理函数中释放;隐藏时按功能暂停工作,重置时响应 `resetToken`。静态模式下 setter 被拒绝,运行时服务忽略 reset。读者需要可访问名称、键盘操作、焦点和禁用反馈。
|
|
149
|
+
|
|
150
|
+
## 5. 在宿主注册并接入编辑器
|
|
151
|
+
|
|
152
|
+
宿主把同一配置交给编译、渲染、作者工具和导出。独立示例可在 `src/host.tsx` 装配:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { useState } from 'react';
|
|
156
|
+
import { createLocalConfig } from 'reactive-md/sdk';
|
|
157
|
+
import { createReactConfig, LocalReactiveDocument } from 'reactive-md/react';
|
|
158
|
+
import { ReactiveMarkdownEditor } from 'reactive-md-editor';
|
|
159
|
+
import { rating } from './manifests';
|
|
160
|
+
import { ratingImplementation } from './components';
|
|
161
|
+
import 'reactive-md/styles.css';
|
|
162
|
+
import 'reactive-md-editor/styles.css';
|
|
163
|
+
import './component.css';
|
|
164
|
+
|
|
165
|
+
export const config = createLocalConfig({ components: [rating] });
|
|
166
|
+
export const reactConfig = createReactConfig(config, { components: [ratingImplementation] });
|
|
167
|
+
|
|
168
|
+
export function Playground() {
|
|
169
|
+
const [source, setSource] = useState(
|
|
170
|
+
'<number bind="score" label="Score" min="0" max="5" step="1" initial="3">\n'
|
|
171
|
+
+ '<rating bind="score" label="Rating" max="5">',
|
|
172
|
+
);
|
|
173
|
+
return <ReactiveMarkdownEditor value={source} onChange={setSource}
|
|
174
|
+
compileOptions={{ config }} toolbar authoring
|
|
175
|
+
preview={<LocalReactiveDocument source={source} reactConfig={reactConfig} />} />;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
默认预设保持启用。此例的两个控件共享同一个数值绑定,仅一个控件写显式初值,约束保持一致。
|
|
180
|
+
|
|
181
|
+
编辑器从 `authoring` 读取标题、说明、分类和插入模板;属性的 `description` 提供属性帮助。外部模板在同一配置下校验,插入支持绑定名分配、选区、光标与撤销/重做。自建编辑器可使用 `createLocalComponentCatalog`、`insertLocalComponent` 和 `validateLocalComponentInsertTemplates`。
|
|
182
|
+
|
|
183
|
+
### 接入本仓库 Demo
|
|
184
|
+
|
|
185
|
+
把包的公开 React 入口转出到宿主 `plugin/<名称>/index.ts`,默认导出组件包。Demo 的 `plugin/tetris/` 与 `plugin/game-2048/` 展示了现有 npm tarball 的目录接入,主题放在 `theme/`。预览、编辑器目录和离线导出共用生成的 host。修改包源码后重新构建与打包,使用带内容摘要的 vendor 文件名更新 Demo 依赖及 lockfile。
|
|
186
|
+
|
|
187
|
+
`resources.id` 与 manifest 的 `styles` 对应。Demo 接受内联 CSS 和 data URL;包可导出 CSS 文本,或由 Vite 通过 `?inline` 读取 CSS 文件。样例源码可以直接由包导出,登记中英文元数据后自动进入目录。Vite 去重和编译选项由宿主统一设置,新增包沿用这些设置。
|
|
188
|
+
|
|
189
|
+
从仓库根目录运行 `npm run build:demo`,再运行 `node demo/scripts/verify-extensions.mjs`;加 `--dev` 复验开发模式。脚本覆盖真实 Worker、目录、控制操作与断网导出。此装配层属于 Demo,插件的公共契约仍是 manifest、React 实现、主题与资源;独立宿主按本节前面的示例装配。完整字段和限制见 [Demo 说明](https://github.com/yao1145/ReactiveMD/blob/main/demo/README.md)。
|
|
190
|
+
|
|
191
|
+
## 6. 样式与独立主题
|
|
192
|
+
|
|
193
|
+
组件默认 CSS 负责结构和基础可读性,选择器限制在文档根节点内,使用包前缀:
|
|
194
|
+
|
|
195
|
+
```css
|
|
196
|
+
.local-document .rmd-example-rating {
|
|
197
|
+
color: var(--ink);
|
|
198
|
+
background: var(--surface);
|
|
199
|
+
border: 1px solid var(--accent);
|
|
200
|
+
min-height: 44px;
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
组件专属变量使用 `--rmd-<包或组件前缀>-<用途>`。主题读取并覆盖共享语义变量,可在不知道所有组件的情况下改变基础视觉。主题包使用 `defineLocalTheme`,有序组合使用 `composeLocalTheme`,再放入配置的 `themes`;文档以 `<theme name="paper">` 选择主题。
|
|
205
|
+
|
|
206
|
+
模板的 `paper` 展示深浅模式与作用域;完整规则见[主题协议](../reference/theme-protocol-ch.md)。主题契约使用有作用域的内联 CSS/data 资源,全局字体命名和关键帧不属于当前主题定义。组件 CSS 中的本地文件引用由构建适配器收集,主题包交付前需将资源归一化为其接受的形式。
|
|
207
|
+
|
|
208
|
+
## 7. 构建、SSR 与离线分享
|
|
209
|
+
|
|
210
|
+
浏览器预览从宿主显式导入实现;离线分享使用宿主预构建的匹配 bundle。以模板的 `scripts/build-export.mjs` 为起点,Node 可加载的宿主 ESM 导出:
|
|
211
|
+
|
|
212
|
+
| 字段 | 要求 |
|
|
213
|
+
| --- | --- |
|
|
214
|
+
| `config`、`reactConfig` | 同一组声明与匹配实现 |
|
|
215
|
+
| `root`、`allowlist` | 资源根目录与其内部允许读取的目录;宿主入口也在 root 内 |
|
|
216
|
+
| `resources` | 与 manifest 的 styles 身份一致的 CSS,提供 inline CSS 或 root 相对文件路径 |
|
|
217
|
+
| `notices` | 本包、ReactiveMD 与实际分发依赖的许可/署名文本 |
|
|
218
|
+
|
|
219
|
+
先调用 `preflightLocalStandaloneBuild` 查看诊断,再由 `buildLocalStandaloneBundle` 生成单个 IIFE、内联资源、notices 和清单。Vite 8 是实际构建所需的可选 peer。远程资源、目录逃逸、循环引用、资源冲突、预算超限或不支持的离线实现会拒绝构建。
|
|
220
|
+
|
|
221
|
+
严格 SSR 使用 `renderLocalStaticDocument({ document, runtime, reactConfig, resources })`,结果先判断 `ok` 再取 `markup`。组件声明 styles 后,向 SSR、合规工具和导出器传同一份规范资源列表;构建结果的 `bundle.resources` 可直接使用。
|
|
222
|
+
|
|
223
|
+
`createLocalShareableHtml` 接收编译文档、状态、严格 SSR markup、CSS 和 bundle。导出时检查能力、组件与主题契约、bundle seal 和资源;恢复在应用状态和挂载前检查版本与摘要。新主机提供已安装实现,文档声明不会下载代码。源码或契约改变后重新编译、校验状态并重建 bundle。
|
|
224
|
+
|
|
225
|
+
## 8. 为每项能力提供证据
|
|
226
|
+
|
|
227
|
+
| 工具 | 执行内容 |
|
|
228
|
+
| --- | --- |
|
|
229
|
+
| `runLocalManifestCompliance` | manifest 往返、默认值、非法值、字段与预算 |
|
|
230
|
+
| `runLocalBehaviorCompliance` | 真实编译/运行时写入、拒绝回滚、revision、数组副本与 reset |
|
|
231
|
+
| `runLocalReactCompliance` | 静态输出、确定性 SSR、已配置的服务器错误探针 |
|
|
232
|
+
| `runLocalBrowserCompliance` | 挂载、编辑、隐藏/显示、禁用、重置、子树错误隔离和卸载;离线另要求 hydration、断网与零请求 |
|
|
233
|
+
| `createLocalComplianceReport` | 同组件、版本与配置的结果汇总,缺失证据保持显式缺失 |
|
|
234
|
+
|
|
235
|
+
`ok` 表示本次要求的检查通过;`complete` 表示所有声明能力都有实际证据。`npm run test:node` 会跳过浏览器并写 `complete:false`。评分与容器分别编写浏览器场景;容器应验证自己的内容、可见性和子项生命周期。
|
|
236
|
+
|
|
237
|
+
把模板中的示例测试替换成插件真实交互,保留失败、跳过与不支持的区别。对共享语义可用 `compareLocalComplianceParity` 比较内置组件和外部别名。浏览器证据记录实际引擎、宽度、键盘、焦点和无障碍观察。
|
|
238
|
+
|
|
239
|
+
## 9. 打包与第二消费项目
|
|
240
|
+
|
|
241
|
+
先运行 `npm run typecheck` 和 `npm test`,再执行 `npm pack --ignore-scripts`。把生成的插件 tarball 与 ReactiveMD SDK tarball 安装到另一个全新项目,通过插件的 `.`、`./react`、`./theme` 和 `./styles.css` 验证公开导入、NodeNext 类型、SSR、预览与离线 HTML。
|
|
242
|
+
|
|
243
|
+
发布前更新包名、版本、LICENSE、NOTICES 和 exports,检查文件清单、CSS 引用资源及 JS/类型是否齐全。本地 `file:` SDK 依赖要换成实际包含这些 SDK 入口的已发布版本;随后移除模板的 `private`。发布插件前固定其支持的 ReactiveMD 范围,契约变化使用插件自己的版本并给出迁移说明。
|
|
244
|
+
|
|
245
|
+
旧 `hostComponents`、`hostRenderer` 与 `hostData` 按 [SDK 迁移说明](../integration/extension-sdk-ch.md)转换,重新编译并重建 bundle。
|
|
246
|
+
|
|
247
|
+
## 10. 向默认预设或内核贡献
|
|
248
|
+
|
|
249
|
+
插件现有的公开规则足够时,只需要声明、实现和宿主装配。向默认预设贡献时,定义放入 `src/presets/default-components.ts`,实现放入 `src/components/`,作者信息放入默认作者数据;由预设走相同公开协议。
|
|
250
|
+
|
|
251
|
+
新增表达式、状态 family、结构或预算原语时,再修改相应内核并建立公开契约。按[组件协议](component-protocol-ch.md)、[兼容规则](../compatibility/compatibility-ch.md)和[提案模板](component-protocol-ch.md#13-新组块提案模板)评审,分别判断组件版本、SDK 协议、语法修订与包版本。
|
|
252
|
+
|
|
253
|
+
仓库文档修改运行 `npm run test:docs`;公开入口/类型修改构建后运行 `test:package` 和 `test:packed`;运行时行为修改运行相关测试,跨系统或发布使用 `verify:release`。历史架构与验收证据已归档,不再随文档维护。
|