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,7 +1,11 @@
|
|
|
1
1
|
# HTML 部分兼容与暂时性分流政策
|
|
2
2
|
|
|
3
|
+
**中文** · [English](html-compatibility-en.md)
|
|
4
|
+
|
|
3
5
|
此功能面向下个发行版。默认文档继续使用 Markdown、ReactiveMD 控件和表达式,并支持下表中的 P0 HTML。CSS、JavaScript 和扩展 HTML 由宿主分别开启,默认全部关闭。
|
|
4
6
|
|
|
7
|
+
`strict: false` 可在默认文档路径中启用[局部结构恢复](tolerance-ch.md),无需开启上述能力。`details` 的 `summary` 与正文可连续换行,呈现为单个 disclosure 的 accordion,支持富文本标题和键盘切换。
|
|
8
|
+
|
|
5
9
|
## 暂时性分流政策
|
|
6
10
|
|
|
7
11
|
为了避开作者 CSS、JavaScript、扩展 HTML 与 ReactiveMD 之间的混合解析和渲染冲突,本版采用整篇分流:
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Partial HTML compatibility and temporary routing policy
|
|
2
2
|
|
|
3
|
+
**English** · [中文](html-compatibility-ch.md)
|
|
4
|
+
|
|
5
|
+
Pass `strict: false` to enable [local structural recovery](tolerance-en.md) in the default document path. It grants no additional HTML capability. A details summary and body can use consecutive lines without blank separators; they render as a single disclosure in an accordion, with rich summary text and keyboard support.
|
|
6
|
+
|
|
3
7
|
This feature targets the next release. Documents use Markdown, ReactiveMD controls and expressions by default, with the P0 HTML subset below. Host applications can enable author CSS, JavaScript and extended HTML separately. All three options default to `false`.
|
|
4
8
|
|
|
5
9
|
## Temporary routing policy
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# New components and migration: local-draft-2
|
|
2
2
|
|
|
3
|
+
**English** · [中文](local-components-v2-ch.md)
|
|
4
|
+
|
|
3
5
|
This page describes the new components in `0.4.0` and the `local-draft-2` syntax. It supplements the [syntax reference](local-interaction-syntax-en.md). The contribution protocol remains component-protocol-1; its portable fixture format is unchanged.
|
|
4
6
|
|
|
5
7
|
## Navigation and text color
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Reactive MD 本地交互语法规范
|
|
2
2
|
|
|
3
|
+
**中文** · [English](local-interaction-syntax-en.md)
|
|
4
|
+
|
|
3
5
|
本次新增的跳转、正文颜色、多选、区间、坐标、练习题、分步阅读和选择联动,见[新增组块与迁移](local-components-v2-ch.md)。
|
|
4
6
|
|
|
5
7
|
语法标识:`local-draft-2`,2026-10-23。第一次接触这套语法,建议先读 [新用户入门指南](../guides/local-guide-ch.md);本文是完整规范。宿主通过 `compileLocal` 和 `LocalReactiveDocument` 选择本地交互模式,见 [集成说明](../integration/local-integration-ch.md)。包版本关系、0.x 兼容规则和迁移见 [版本与兼容性](../compatibility/compatibility-ch.md),可选修订指令与 `reactive-md migrate` 见[源码修订与迁移](../compatibility/source-versioning-ch.md),从 `0.3.1` / `local-draft-1` 升级见[0.4.0 发布与迁移](../releases/release-0.4.0-ch.md)。完整示例见 [示例索引](../../examples/local/README.md)。
|
|
@@ -20,7 +22,7 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
|
|
|
20
22
|
|
|
21
23
|
本草案不包含外部服务调用、提交表单、异步资源、命名动作、事件处理器、可编程集合增删、通用循环模板或任意脚本。旧版 `state/data/computed/actions` 配置块不属于新语法。表达式可以产生字符串或数字数组,清单与多选组件继续产生字符串数组。表格可直接写为 Markdown,也可通过带预算的 `data-table` 从本地值生成行。
|
|
22
24
|
|
|
23
|
-
文档默认只保存当前实例的内存状态。重新打开从初值开始;持久化不属于作者语法。无需声明语言版本、导入组件或编写 YAML。文档可以在前导区、主题和正文之前用一行 `<!-- reactive-md: local-draft-
|
|
25
|
+
文档默认只保存当前实例的内存状态。重新打开从初值开始;持久化不属于作者语法。无需声明语言版本、导入组件或编写 YAML。文档可以在前导区、主题和正文之前用一行 `<!-- reactive-md: local-draft-3 -->` 可选地声明修订;无指令文档使用当前修订。见[源码修订与迁移](../compatibility/source-versioning-ch.md)。宿主应明确选择草案解析模式,不能把旧语法与新语法混合猜测解析。
|
|
24
26
|
|
|
25
27
|
文档可在正文前用 `<theme name="default">` 选择整份文档的主题,省略时为 `default`。这是静态元数据声明,不是组件;自定义主题须由宿主登记并同时支持深浅模式,见[主题协议](theme-protocol-ch.md)。
|
|
26
28
|
|
|
@@ -60,7 +62,7 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
|
|
|
60
62
|
| 无正文组件 | `<slider bind="a" label="振幅">` | 不写结束标签;也接受末尾的 `/>` |
|
|
61
63
|
| 有正文容器 | `<card title="说明">` 和 `</card>` | 必须显式闭合,允许嵌套 |
|
|
62
64
|
|
|
63
|
-
无正文组件固定为 `input`、`textarea`、`number`、`slider`、`range-slider`、`coordinate`、`toggle`、`checkbox`、`date`、`counter`、`timer`、`progress`、`anchor`、`edge`。声明标签 `computed`、`const`、`validation` 以及结构子项 `column` 同样没有正文。其余本草案列出的组件均使用成对标签。`textarea` 的文本通过 `initial` 设置,因此属于无正文组件。
|
|
65
|
+
无正文组件固定为 `input`、`textarea`、`number`、`slider`、`range-slider`、`coordinate`、`toggle`、`checkbox`、`date`、`counter`、`timer`、`progress`、`anchor`、`edge`。声明标签 `external`、`computed`、`const`、`validation` 以及结构子项 `column` 同样没有正文。其余本草案列出的组件均使用成对标签。`textarea` 的文本通过 `initial` 设置,因此属于无正文组件。
|
|
64
66
|
|
|
65
67
|
例如:
|
|
66
68
|
|
|
@@ -87,6 +89,9 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
|
|
|
87
89
|
| `required` | 布尔值 true |
|
|
88
90
|
| `required="false"` | 布尔值 false |
|
|
89
91
|
| `disabled="{{ people >= 20 }}"` | 动态布尔值 |
|
|
92
|
+
| `max="{{ rooms * 4 }}"` | 动态数值约束(`number`、`slider`) |
|
|
93
|
+
| `min="{{ departure }}"` | 动态日期边界(`date`) |
|
|
94
|
+
| `required="{{ business }}"` | 动态必填(`input`、`textarea`、`date`) |
|
|
90
95
|
| `label="当前人数:{{ people }}"` | 文本插值 |
|
|
91
96
|
| `bind="people"` | 静态变量名 |
|
|
92
97
|
|
|
@@ -94,7 +99,9 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
|
|
|
94
99
|
|
|
95
100
|
属性中的 `"`、`'`、`&`、`<`、`>` 解码为相应文字;反斜杠不用于转义属性引号。数值和布尔属性的动态值必须是一个完整插值,结果保持原类型;文本属性可包含多段插值。
|
|
96
101
|
|
|
97
|
-
`bind`、`initial`、`name`、`id`、`value`(选项标识)、`to`、`from`、`answer`、`kind
|
|
102
|
+
`bind`、`initial`、`name`、`id`、`value`(选项标识)、`to`、`from`、`answer`、`kind`、字段映射以及布局枚举是静态属性。`number`、`slider` 的 `min/max`,`date` 的 `min/max/required`,以及 `input`、`textarea` 的 `required` 可以使用一个完整插值动态求值;`step`、长度限制、选项列表和 range-slider/coordinate 的边界仍为静态。绘图的 `min/max` 也可以动态,以支持调整观察区间。`textarea` 的 `rows` 是静态行数,`data-table.rows` 则是必填表达式,两者不要混淆。
|
|
103
|
+
|
|
104
|
+
动态约束在写入和显示时检查。其他参数使范围收窄、已有值不再合法时,保留该值并在控件上显示约束错误,绝不自动裁剪或静默改成最近合法值。同名绑定必须声明相同的静态范围和步长;边界为动态时,表达式也必须相同。
|
|
98
105
|
|
|
99
106
|
未知组件、未知属性、错误位置或错误属性类型都给出源码诊断。注册的标签不直接作为任意 HTML 执行;作者不能使用 `script`、`style`、`onclick` 或其他脚本入口。
|
|
100
107
|
|
|
@@ -203,6 +210,22 @@ GFM 表格中的竖线须写成 `\|`,例如逻辑或写 `\|\|`。表格解析
|
|
|
203
210
|
|
|
204
211
|
除零、定义域错误、非有限结果和类型错误显示在对应内容附近。参数本身合法时仍保留用户的新输入,其他独立内容正常更新;出错结果显示“无法计算”,不沿用旧数值冒充新结果。
|
|
205
212
|
|
|
213
|
+
### 5.3 宿主提供的只读外部数据
|
|
214
|
+
|
|
215
|
+
文档可以声明由宿主提供的只读值:
|
|
216
|
+
|
|
217
|
+
```markdown
|
|
218
|
+
<external name="exchangeRate" type="number">
|
|
219
|
+
<external name="inventory" type="number">
|
|
220
|
+
<computed name="priceCny" value="{{ priceUsd * exchangeRate }}">
|
|
221
|
+
|
|
222
|
+
价格:{{ priceCny }} 元
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`name` 与绑定使用相同的标识符和保留名规则;`type` 为 `string`、`number`、`boolean`、`string-array` 或 `number-array`。声明必须独占一行并位于文档顶层,不能与控件参数或其他 external 重名,不会出现在渲染结果或状态文件中。文本插值、条件、图表和 computed 可以读取它们;`setParameter()` 不能写入。
|
|
226
|
+
|
|
227
|
+
宿主通过 `LocalReactiveDocument` 的 `externalValues` 或 `runtime.setExternalValues()` 提供值,值按声明类型和常规容量预算校验。值缺失时只影响读取它的表达式,其他内容继续工作;值到达后相关结果自动重算。缺失值不会被隐式转换为 `0`、`false` 或空字符串。静态导出和 SSR 行为相同:由宿主集成传入值,导出文件本身不抓取也不嵌入外部数据。
|
|
228
|
+
|
|
206
229
|
本版本通过顶层 `computed` 与 `const` 声明增加只读命名值。简短计算仍可就地书写;需要被正文、条件、公式和图表共享的中间结果使用声明。依赖、错误和缓存规则见[复用计算与格式化数值](computations-formatting-ch.md)。
|
|
207
230
|
|
|
208
231
|
## 6. 输入与参数面板
|
|
@@ -211,15 +234,15 @@ GFM 表格中的竖线须写成 `\|`,例如逻辑或写 `\|\|`。表格解析
|
|
|
211
234
|
|
|
212
235
|
| 组件 | 附加属性及默认值 |
|
|
213
236
|
| --- | --- |
|
|
214
|
-
| input | type=text/email;placeholder;required=false
|
|
215
|
-
| textarea | placeholder;rows=4;required=false
|
|
216
|
-
| number | 可选 min/max
|
|
217
|
-
| slider | min=0;max=100
|
|
237
|
+
| input | type=text/email;placeholder;required=false(可动态);min-length=0;可选 max-length |
|
|
238
|
+
| textarea | placeholder;rows=4;required=false(可动态);min-length=0;可选 max-length |
|
|
239
|
+
| number | 可选 min/max(可动态);step=1 |
|
|
240
|
+
| slider | min=0;max=100(均可动态);step=1 |
|
|
218
241
|
| range-slider | bind-start/bind-end 与 initial-start/initial-end;min=0;max=100;step=1;可选 color |
|
|
219
242
|
| coordinate | bind-x/bind-y 与 initial-x/initial-y;x-min/y-min=-5;x-max/y-max=5;step=1;可选 color |
|
|
220
243
|
| counter | min=0;可选 max;step=1 |
|
|
221
244
|
| toggle、checkbox | 可选 color |
|
|
222
|
-
| date | 可选 min/max
|
|
245
|
+
| date | 可选 min/max 日期(可动态);required=false(可动态) |
|
|
223
246
|
| select、choices、radio-group、multi-select | 正文为一个或多个 option;multi-select 增加 max-selected,值为字符串数组 |
|
|
224
247
|
|
|
225
248
|
`range-slider` 和 `coordinate` 公开彼此独立的数字槽位。省略 `bind-start`/`bind-end` 或 `bind-x`/`bind-y` 时对应槽位只保留内部状态;每个槽位最多一处显式初值。端点交叉会被拒绝,不会自动交换。`multi-select` 的 `label` 必填,支持 `max-selected`,写入按源码顺序规范化。这些组件都支持可选 `color`。完整规则见[local-draft-2 扩展说明](local-components-v2-ch.md)。
|
|
@@ -334,15 +357,18 @@ table 支持可选 label、searchable=true、sortable=true、page-size=10(正
|
|
|
334
357
|
</chart>
|
|
335
358
|
```
|
|
336
359
|
|
|
337
|
-
chart.kind 默认为 bar,支持 bar、line、area、scatter、donut。支持可选 title、x、y、x-label、y-label。x/y 为静态表头名称,y 可使用逗号分隔的多个列名,因此列名不能包含逗号。
|
|
360
|
+
chart.kind 默认为 bar,支持 bar、line、area、scatter、donut、pie。支持可选 title、x、y、x-label、y-label。x/y 为静态表头名称,y 可使用逗号分隔的多个列名,因此列名不能包含逗号。
|
|
338
361
|
|
|
339
362
|
| 类型 | 默认列规则 |
|
|
340
363
|
| --- | --- |
|
|
341
364
|
| bar、line、area | 第一列为横轴,其余列为数值系列 |
|
|
342
365
|
| scatter | 第一列为数值横轴,其余为数值纵轴;也可用 x/y 指定 |
|
|
343
366
|
| donut | 第一列为标签,第二列为数值;多于两列时必须用 y 指定唯一数值列 |
|
|
367
|
+
| pie | 与 donut 使用相同的表格规则,以实心饼图显示占比 |
|
|
368
|
+
|
|
369
|
+
line/area 的横轴按整列类型确定为数值轴或分类轴,按源码顺序连接。donut/pie 数值必须非负,总和为零时显示“暂无占比”。系列名称自动成为图例;默认提供指针与键盘读数,无需事件逻辑。
|
|
344
370
|
|
|
345
|
-
|
|
371
|
+
default theme 的交互图表提供主题化提示框、图例聚焦与 200ms 数据过渡。折线和面积图读取同一行的可见系列;柱状图仅读取当前一根柱;散点图定位最近点;饼图和环形图显示数值及当前可见总和中的占比。静态模式保留完整数据图形,关闭悬浮交互与动效。
|
|
346
372
|
|
|
347
373
|
数值列会随参数更新。计算错误显示在对应图表,不将错误值替换为 0。提供 `key` 时,图表可以通过 `bind` 公开选择,使用与 `table` 相同的稳定行标识规则;表格与图表只有在有序 key 一致时才能共享该绑定。
|
|
348
374
|
|
|
@@ -383,9 +409,19 @@ $$ y = a \sin x + \frac{x^2}{10} $$
|
|
|
383
409
|
</plot>
|
|
384
410
|
```
|
|
385
411
|
|
|
386
|
-
plot
|
|
412
|
+
plot 正文只能是空白和一个或多个独立公式块。每块按以下三种形式之一定义一条曲线:
|
|
413
|
+
|
|
414
|
+
```markdown
|
|
415
|
+
<plot min="-10" max="10">
|
|
416
|
+
$$ y = a \sin x + \frac{x^2}{10} $$
|
|
417
|
+
$$ \begin{cases} x = t - \sin t \\ y = 1 - \cos t \end{cases} $$
|
|
418
|
+
$$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
419
|
+
</plot>
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
第一块是显式 `y = f(x)`。第二块是参数方程:`x` 与 `y` 写成 `t` 的函数,`t` 从 `min` 取到 `max`,两轴按采样点自动适配。其余关于 `x` 和 `y` 的方程按隐式处理,在 `min` 到 `max` 的方形区域内追踪等值线,两轴再按追踪结果适配。多曲线用多个公式块,不把普通换行作为分隔符。
|
|
387
423
|
|
|
388
|
-
plot 支持 min=-10、max=10(可动态,要求 min < max)、samples=200(静态整数 2–2000)、可选 label、x-label="x"、y-label="y"。每个 plot 最多 16
|
|
424
|
+
plot 支持 min=-10、max=10(可动态,要求 min < max)、samples=200(静态整数 2–2000)、可选 label、x-label="x"、y-label="y"。每个 plot 最多 16 条曲线。显式或参数曲线请求 `samples` 个采样点;隐式曲线每轴使用 `samples`×`samples` 网格(上限 100、下限 32),按网格面积计入请求点数。整篇文档所有曲线合计最多请求 20,000 点,包括隐藏区域。各曲线共享计算预算,超限会停止计算并报告。纵轴依据当前范围内的有限采样值自动确定;没有有效值则给出空态。常量曲线应增加可见纵轴余量。
|
|
389
425
|
|
|
390
426
|
### 10.2 可计算的 LaTeX
|
|
391
427
|
|
|
@@ -415,7 +451,7 @@ plot 支持 min=-10、max=10(可动态,要求 min < max)、samples=200(
|
|
|
415
451
|
|
|
416
452
|
`\left`、`\right`、数学空白命令 `\,`、`\;`、`\!`、`\quad` 和 `%` 到行尾的注释不改变计算。分段函数的 `&` 分隔值和条件,`\\` 分隔分支;按顺序取首个条件为真的分支。可用 `\text{otherwise}` 作为最后默认分支,没有命中分支则该点无定义。条件仅支持单次比较;用多个分支表达复杂分段。
|
|
417
453
|
|
|
418
|
-
|
|
454
|
+
矩阵、求和、积分、导数以及自定义宏不在可计算集合中。遇到这些结构应保留公式显示并指出不能计算的命令或结构,不能按另一个公式猜测绘图。参数方程的 `cases` 块中,`t` 是参数,分支不能读取 `x`。数学渲染器须禁用文件、网络、HTML 和宏执行入口。
|
|
419
455
|
|
|
420
456
|
### 10.3 参数名映射
|
|
421
457
|
|
|
@@ -469,10 +505,10 @@ node.id 为当前图解内唯一的 `[A-Za-z_][A-Za-z0-9_-]*`。edge 必填 from
|
|
|
469
505
|
| 跳转与正文 | jump、anchor、text、section |
|
|
470
506
|
| 练习与分步 | quiz、steps、step |
|
|
471
507
|
| 提示 | alert、badge、tooltip |
|
|
472
|
-
| 声明与生成数据 | computed、const、validation、data-table、column |
|
|
508
|
+
| 声明与生成数据 | external、computed、const、validation、data-table、column |
|
|
473
509
|
| 可视化 | table、chart、plot、timeline、diagram、node、edge |
|
|
474
510
|
|
|
475
|
-
共
|
|
511
|
+
共 49 个标签名。`option`、`tab`、`disclosure`、`node`、`edge`、`step`、`column` 为父组件的结构子项。`external`、`computed`、`const`、`validation` 是文档声明,按标签解析但不渲染为控件。开头的 `<theme>` 声明是元数据,不计入这里。大部分文章只需 Markdown 和两三个输入/展示组件。普通金额可以直接写 `{{ total }} 元`;货币格式、统计卡片不作为入门必需品。
|
|
476
512
|
|
|
477
513
|
本草案不接受旧版 form、submit、button、each、list、spinner、stat、value 等标签,也不接受 set/reset 动作属性或 on-* 事件属性。面板的 reset 是固定布尔选项,不是可编程动作。
|
|
478
514
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Reactive MD local interaction syntax specification
|
|
2
2
|
|
|
3
|
+
**English** · [中文](local-interaction-syntax-ch.md)
|
|
4
|
+
|
|
3
5
|
Syntax identifier: `local-draft-2`, 2026-10-23. If this is your first time with the syntax, read the [beginner guide](../guides/local-guide-en.md) first; this document is the complete specification. Hosts select local interaction mode through `compileLocal` and `LocalReactiveDocument`, see [integration notes](../integration/local-integration-en.md). See [Versions and compatibility](../compatibility/compatibility-en.md) for package version relationships, 0.x compatibility rules and migration, [Source revisions and migration](../compatibility/source-versioning-en.md) for the optional revision directive and `reactive-md migrate`, and [0.4.0 release and migration](../releases/release-0.4.0-en.md) for the upgrade from `0.3.1` / `local-draft-1`. Complete examples are in the [example index](../../examples/local/README.md).
|
|
4
6
|
|
|
5
7
|
## 1. Positioning and scope
|
|
@@ -16,7 +18,7 @@ The base language requires only two connection rules: `bind` names an input, and
|
|
|
16
18
|
|
|
17
19
|
This draft does not include external service calls, form submission, asynchronous resources, named actions, event handlers, programmable collection edits, general loop templates or arbitrary scripts. Legacy `state/data/computed/actions` configuration blocks are not part of the new syntax. Expressions can produce string or numeric arrays; checklist and multi-select components produce string arrays. Tables can use prose Markdown or bounded local row generation through `data-table`.
|
|
18
20
|
|
|
19
|
-
By default a document only keeps in-memory state for the current instance. Reopening starts from initial values; persistence is not part of the author syntax. No language version declaration, component import or YAML is required. A document may optionally declare its revision with one `<!-- reactive-md: local-draft-
|
|
21
|
+
By default a document only keeps in-memory state for the current instance. Reopening starts from initial values; persistence is not part of the author syntax. No language version declaration, component import or YAML is required. A document may optionally declare its revision with one `<!-- reactive-md: local-draft-3 -->` line in the prologue, before the theme and body; unversioned documents use the current revision. See [Source revisions and migration](../compatibility/source-versioning-en.md). Hosts should explicitly select draft parsing mode and must not guess by mixing old and new syntax.
|
|
20
22
|
|
|
21
23
|
Documents may select a theme with `<theme name="default">` before the body; omission uses `default`. This is static metadata, not a component. Custom themes must be registered by the host and support both color schemes; see the [theme protocol](theme-protocol-en.md).
|
|
22
24
|
|
|
@@ -83,6 +85,9 @@ Regular attribute values are enclosed in single or double quotes; boolean attrib
|
|
|
83
85
|
| `required` | Boolean true |
|
|
84
86
|
| `required="false"` | Boolean false |
|
|
85
87
|
| `disabled="{{ people >= 20 }}"` | Dynamic boolean |
|
|
88
|
+
| `max="{{ rooms * 4 }}"` | Dynamic number constraint (`number`, `slider`) |
|
|
89
|
+
| `min="{{ departure }}"` | Dynamic date bound (`date`) |
|
|
90
|
+
| `required="{{ business }}"` | Dynamic required (`input`, `textarea`, `date`) |
|
|
86
91
|
| `label="Current people: {{ people }}"` | Text interpolation |
|
|
87
92
|
| `bind="people"` | Static variable name |
|
|
88
93
|
|
|
@@ -90,7 +95,9 @@ Omitted boolean attributes use the component default rather than always assuming
|
|
|
90
95
|
|
|
91
96
|
`"`, `'`, `&`, `<` and `>` in attribute values decode to the corresponding characters; backslashes are not used to escape attribute quotes. Dynamic values for numeric and boolean attributes must be one complete interpolation and keep the original type; text attributes may contain multiple interpolations.
|
|
92
97
|
|
|
93
|
-
`bind`, `initial`, `name`, `id`, `value` (option identifier), `to`, `from`, `answer`, `kind`, field mappings and layout enums are static attributes.
|
|
98
|
+
`bind`, `initial`, `name`, `id`, `value` (option identifier), `to`, `from`, `answer`, `kind`, field mappings and layout enums are static attributes. `min`, `max` and `required` are dynamic on `number`, `slider`, `date`, `input` and `textarea`: use one complete interpolation whose result is a number, a `YYYY-MM-DD` string (or empty string) or a boolean respectively. `step`, length limits, selector options and the range-slider/coordinate bounds remain static. Plot `min/max` may be dynamic to adjust the observed range. The `rows` attribute of `textarea` is a static row count, while `data-table.rows` is a required expression; do not confuse the two.
|
|
99
|
+
|
|
100
|
+
Dynamic constraints are checked when a value is written and when the control is displayed. If another parameter narrows a range so that an existing value becomes invalid, the stored value is kept and the field shows the constraint error; it is never clamped or silently replaced. Shared bindings must declare the same static range and step and, when a bound is dynamic, the same expression.
|
|
94
101
|
|
|
95
102
|
Unknown components, unknown attributes, wrong positions or wrong attribute types all produce source diagnostics. Registered tags are not executed as arbitrary HTML; authors cannot use `script`, `style`, `onclick` or other script entry points.
|
|
96
103
|
|
|
@@ -199,6 +206,22 @@ Pipes in GFM tables must be written `\|`, for example logical OR as `\|\|`. Tabl
|
|
|
199
206
|
|
|
200
207
|
Division by zero, domain errors, non-finite results and type errors are shown near the corresponding content. When the parameter itself is valid, the user's new input is kept, and other independent content keeps updating; the error result shows "Unable to compute" instead of reusing an old number as a new result.
|
|
201
208
|
|
|
209
|
+
### 5.3 Host-provided external data
|
|
210
|
+
|
|
211
|
+
A document may declare read-only values supplied by the host:
|
|
212
|
+
|
|
213
|
+
```markdown
|
|
214
|
+
<external name="exchangeRate" type="number">
|
|
215
|
+
<external name="inventory" type="number">
|
|
216
|
+
<computed name="priceCny" value="{{ priceUsd * exchangeRate }}">
|
|
217
|
+
|
|
218
|
+
Price: {{ priceCny }} CNY
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
`name` follows the same identifier and reserved-name rules as bindings. `type` is one of `string`, `number`, `boolean`, `string-array` or `number-array`. Declarations must be standalone tags at the document top level, cannot repeat a control parameter or another external name, and do not appear in the rendered document or in a state file. Text interpolation, conditions, charts and computations may read them; `setParameter()` cannot write them.
|
|
222
|
+
|
|
223
|
+
The host supplies values through `externalValues` on `LocalReactiveDocument` or `runtime.setExternalValues()`. Values are validated against the declared type and the usual size budgets. When a value is missing, only expressions that read that name fail locally; independent content keeps working, and the dependent content recalculates when the value arrives. A missing value is never converted to `0`, `false` or an empty string. Static export and SSR behave the same way: pass the values into the host integration; an export does not fetch or embed them.
|
|
224
|
+
|
|
202
225
|
This build adds named read-only values through top-level `computed` and `const` declarations. Short calculations can still be written in place; use declarations for intermediate results shared by prose, conditions, formulas and charts. See [Reusing calculations and formatting values](computations-formatting-en.md) for dependency, error and caching rules.
|
|
203
226
|
|
|
204
227
|
## 6. Inputs and parameter panels
|
|
@@ -207,15 +230,15 @@ All input components support `label`, optional `bind`, optional scalar `initial`
|
|
|
207
230
|
|
|
208
231
|
| Component | Additional attributes and defaults |
|
|
209
232
|
| --- | --- |
|
|
210
|
-
| input | type=text/email; placeholder; required=false; min-length=0; optional max-length |
|
|
211
|
-
| textarea | placeholder; rows=4; required=false; min-length=0; optional max-length |
|
|
212
|
-
| number | optional min/max; step=1 |
|
|
213
|
-
| slider | min=0; max=100; step=1 |
|
|
233
|
+
| input | type=text/email; placeholder; required=false (dynamic); min-length=0; optional max-length |
|
|
234
|
+
| textarea | placeholder; rows=4; required=false (dynamic); min-length=0; optional max-length |
|
|
235
|
+
| number | optional min/max (dynamic); step=1 |
|
|
236
|
+
| slider | min=0; max=100 (both dynamic); step=1 |
|
|
214
237
|
| range-slider | bind-start/bind-end and initial-start/initial-end; min=0; max=100; step=1; optional color |
|
|
215
238
|
| coordinate | bind-x/bind-y and initial-x/initial-y; x-min/y-min=-5; x-max/y-max=5; step=1; optional color |
|
|
216
239
|
| counter | min=0; optional max; step=1 |
|
|
217
240
|
| toggle, checkbox | Optional color |
|
|
218
|
-
| date | optional min/max dates; required=false |
|
|
241
|
+
| date | optional min/max dates (dynamic); required=false (dynamic) |
|
|
219
242
|
| select, choices, radio-group, multi-select | Body is one or more options; multi-select adds max-selected and uses a string-array value |
|
|
220
243
|
|
|
221
244
|
`range-slider` and `coordinate` expose independent number slots. Omit a slot's `bind-start`/`bind-end` or `bind-x`/`bind-y` to keep that slot internal; provide at most one explicit initial per slot. Crossing endpoints is rejected, not silently swapped. `multi-select` requires `label`, accepts `max-selected`, and normalizes writes to source order. These components also accept an optional `color`. See [local-draft-2 components and migration](local-components-v2-en.md) for the complete rules.
|
|
@@ -330,15 +353,18 @@ Search is a case-insensitive substring match over the displayed text of all colu
|
|
|
330
353
|
</chart>
|
|
331
354
|
```
|
|
332
355
|
|
|
333
|
-
chart.kind defaults to bar and supports bar, line, area, scatter and
|
|
356
|
+
chart.kind defaults to bar and supports bar, line, area, scatter, donut and pie. Supports optional title, x, y, x-label and y-label. x/y are static header names; y may be a comma-separated list of column names, so column names cannot contain commas.
|
|
334
357
|
|
|
335
358
|
| Type | Default column rules |
|
|
336
359
|
| --- | --- |
|
|
337
360
|
| bar, line, area | First column is the horizontal axis; other columns are numeric series |
|
|
338
361
|
| scatter | First column is the numeric horizontal axis and the rest are numeric vertical axes; x/y may also specify them |
|
|
339
362
|
| donut | First column is the label and second is the value; with more than two columns, y must specify the single numeric column |
|
|
363
|
+
| pie | Uses the same table rules as donut, with solid slices to show shares |
|
|
364
|
+
|
|
365
|
+
line/area determine the horizontal axis as numeric or categorical from the full column type and connect in source order. donut/pie values must be non-negative, and a zero total shows "No share to display". Series names become legends automatically; pointer and keyboard readouts are provided by default without event logic.
|
|
340
366
|
|
|
341
|
-
|
|
367
|
+
Interactive default-theme charts provide themed tooltips, legend highlighting and 200ms data transitions. Line and area charts read visible series in the same row; bars read one hovered bar; scatter charts find the nearest point; pie and donut charts show values and shares of the visible total. Static mode keeps the data graphics and removes hover interaction and animation.
|
|
342
368
|
|
|
343
369
|
Numeric columns update with parameters. Calculation errors display in the corresponding chart and are not replaced with 0. With `key`, a chart can expose selection through `bind`, using the same stable row-key rules as `table`; a table and chart may share that binding only when their ordered keys match.
|
|
344
370
|
|
|
@@ -379,9 +405,19 @@ $$ y = a \sin x + \frac{x^2}{10} $$
|
|
|
379
405
|
</plot>
|
|
380
406
|
```
|
|
381
407
|
|
|
382
|
-
The plot body may contain only whitespace and one or more display formula blocks. Each block
|
|
408
|
+
The plot body may contain only whitespace and one or more display formula blocks. Each block defines one curve in one of three forms:
|
|
383
409
|
|
|
384
|
-
|
|
410
|
+
```markdown
|
|
411
|
+
<plot min="-10" max="10">
|
|
412
|
+
$$ y = a \sin x + \frac{x^2}{10} $$
|
|
413
|
+
$$ \begin{cases} x = t - \sin t \\ y = 1 - \cos t \end{cases} $$
|
|
414
|
+
$$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
415
|
+
</plot>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
The first block is explicit `y = f(x)`. The second is parametric: `x` and `y` are written as functions of `t`, and `t` runs from `min` to `max`; both axes fit the sampled points. Any other equation in `x` and `y` is implicit and is traced as a contour over `min` to `max` on both axes; the axes then fit the traced curve. Use multiple formula blocks for multiple curves; do not use plain line breaks as separators.
|
|
419
|
+
|
|
420
|
+
plot supports min=-10, max=10 (dynamic allowed, requiring min < max), samples=200 (static integer 2–2000), optional label, x-label="x" and y-label="y". Each plot has at most 16 curves. An explicit or parametric curve requests `samples` points; an implicit curve uses a `samples`×`samples` grid per axis, capped at 100 and raised to at least 32, and requests the corresponding grid area. The whole document may request at most 20,000 points across all curves, including hidden regions. Curves share a computation budget, and exceeding it stops computation and reports an error. The vertical axis is determined automatically from finite sample values in the current range; if there are no valid values, an empty state is shown. Constant curves should add visible vertical-axis headroom.
|
|
385
421
|
|
|
386
422
|
### 10.2 Computable LaTeX
|
|
387
423
|
|
|
@@ -411,7 +447,7 @@ A function without parentheses reads the product of the following term and ends
|
|
|
411
447
|
|
|
412
448
|
`\left`, `\right`, the math spacing commands `\,`, `\;`, `\!`, `\quad` and `%` comments to end of line do not change computation. In piecewise functions, `&` separates values from conditions and `\\` separates branches; the first branch whose condition is true is used. `\text{otherwise}` may serve as the final default branch; if no branch matches, the point is undefined. Conditions support only a single comparison; express complex piecewise behavior with multiple branches.
|
|
413
449
|
|
|
414
|
-
|
|
450
|
+
Matrices, sums, integrals, derivatives and custom macros are not in the computable set. When these structures are encountered, keep displaying the formula and point out the command or structure that cannot be computed; do not guess a plot from another formula. Within a parametric `cases` block, `t` is the parameter and the branches may not read `x`. The math renderer must disable file, network, HTML and macro execution entry points.
|
|
415
451
|
|
|
416
452
|
### 10.3 Parameter name mapping
|
|
417
453
|
|
|
@@ -465,10 +501,10 @@ Nodes are clickable and keyboard-selectable by default, and the selected notes a
|
|
|
465
501
|
| Navigation and prose | jump, anchor, text, section |
|
|
466
502
|
| Assessment and reading | quiz, steps, step |
|
|
467
503
|
| Hints | alert, badge, tooltip |
|
|
468
|
-
| Declarations and generated data | computed, const, validation, data-table, column |
|
|
504
|
+
| Declarations and generated data | external, computed, const, validation, data-table, column |
|
|
469
505
|
| Visualization | table, chart, plot, timeline, diagram, node, edge |
|
|
470
506
|
|
|
471
|
-
|
|
507
|
+
49 tag names in total. `option`, `tab`, `disclosure`, `node`, `edge`, `step` and `column` are structural children of parent components. `external`, `external`, `computed`, `const` and `validation` are document declarations; they are parsed as tags but are not rendered controls. The leading `<theme>` declaration is metadata and is not counted here. Most articles only need Markdown and two or three input/display components. Plain amounts can be written directly as `{{ total }} USD`; currency formatting and statistic cards are not entry-level requirements.
|
|
472
508
|
|
|
473
509
|
This draft does not accept legacy tags such as form, submit, button, each, list, spinner, stat or value, nor set/reset action attributes or on-* event attributes. The panel reset is a fixed boolean option, not a programmable action.
|
|
474
510
|
|
|
@@ -507,5 +543,13 @@ Implementation acceptance must cover:
|
|
|
507
543
|
|
|
508
544
|
These rules cover compiler, runtime and browser acceptance. See the [example index](../../examples/local/README.md) for example mappings and expected observations, and the [language conformance data](../../examples/conformance/README.md) for the machine-readable minimum acceptance set. Actual repository check records stay in the repository and are not part of the package.
|
|
509
545
|
|
|
546
|
+
## 14. Host components (host extension)
|
|
547
|
+
|
|
548
|
+
Host components are not part of the portable author tag set. When the host registers a schema through the `hostComponents` compile option, a document may use that tag in one of three forms: `leaf`, `inline` or `container`. Inline and container tags use a closing tag; their body follows the normal Markdown and ReactiveMD rules, and a container renderer can render its children through `ctx.render()`. Without the schema, the same tag is an unknown component and keeps the inert source fallback.
|
|
549
|
+
|
|
550
|
+
A host schema may declare an optional scalar binding for `string`, `number` or `boolean`. The component then accepts `bind`, `initial` and dynamic `disabled` implicitly and shares the built-in binding families: a `number` binding can pair with `<number>` or `<slider>` when its static `min`, `max` and `step` match. The host renderer receives the current `value`, a validating `setValue`, `disabled`, `resetToken`, resolved `props` and a `report` function. Host schemas remain plain data; the renderer is trusted host code and never enters a worker.
|
|
551
|
+
|
|
552
|
+
**local-draft-3** adds `<external>` and the dynamic constraint attributes; host component forms and bindings are controlled by the host component protocol, not by the author syntax revision.
|
|
553
|
+
|
|
510
554
|
|
|
511
555
|
See [local-draft-2 components and migration](local-components-v2-en.md) for new tags, colors and slot state, and [0.4.0 release and migration](../releases/release-0.4.0-en.md) for the upgrade checklist. `0.6.0` is available on both the `latest` and `next` channels.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Reactive MD 主题协议
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**中文** · [English](theme-protocol-en.md)
|
|
4
|
+
|
|
5
|
+
协议修订:`reactive-md-theme-1`。本功能从 `0.4.0` 起提供;内置 `default` 主题使用产品界面外观。其他主题(包括保留本包原始外观的 `soft` 示例)都属于外部主题,必须由宿主登记。
|
|
6
|
+
|
|
7
|
+
源码中的[扩展 SDK 预览](../integration/extension-sdk-ch.md)提供 `defineLocalTheme`、`composeLocalTheme` 和主题包资源约定,构建适配器可将主题 CSS、字体与图片纳入离线导出。语义变量和下述作用域规则继续适用。SDK 预览使用当前源码构建的 tarball。
|
|
4
8
|
|
|
5
9
|
## 文档选择主题
|
|
6
10
|
|
|
@@ -14,6 +18,8 @@
|
|
|
14
18
|
|
|
15
19
|
也接受 `<theme name="default" />`。省略声明时使用 `default`。声明前允许空白、BOM 和注释;声明只允许出现一次,不能嵌入组件。`name` 是静态字符串,使用小写 kebab-case,首字符为字母,最多 64 个字符。声明不接受表达式或其他属性。
|
|
16
20
|
|
|
21
|
+
只有 `default` 是内置主题。文档要选择其他主题,宿主必须已经登记该名称,例如产品界面示例中保留原始外观的 `<theme name="soft">`,或宿主自定义设计 `<theme name="paper">`。登记方式见下文。
|
|
22
|
+
|
|
17
23
|
声明是文档元数据,不属于组块,不生成可见组件。编译结果的 `document.theme` 保存选择,`document.themeRange` 保存声明在原文中的位置;正文节点继续使用原始源码位置。代码围栏、行内代码、注释和转义中的示例保持字面含义。
|
|
18
24
|
|
|
19
25
|
无效声明产生 `local.theme.*` 警告并使用 `default`。重复声明不改变第一次的选择;正文之后或组件内的声明不影响主题。正常正文和控件继续工作。
|
|
@@ -39,7 +45,7 @@ export function Article({ source }: { source: string }) {
|
|
|
39
45
|
}
|
|
40
46
|
```
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
此示例说明登记方式;仓库仅将 `default` 作为内置主题,宿主定义不能替换它。其余主题都是外部主题:保留原始外观的 `soft` 名称与完整的 sci-fi 参考包都需要宿主登记;`soft` 没有独立样式表,产品界面示例只登记名称,外观由核心基线 CSS 提供。上文 `paper` 示例没有配套设计或 CSS,完整参考包包含 tokens、组件样式、亮暗两套模式与现场示例,见 [examples/sci-fi-theme](../../examples/sci-fi-theme/README-ch.md)。
|
|
43
49
|
|
|
44
50
|
| 字段 | 要求 |
|
|
45
51
|
| --- | --- |
|
|
@@ -49,7 +55,7 @@ export function Article({ source }: { source: string }) {
|
|
|
49
55
|
|
|
50
56
|
宿主负责加载 CSS;登记信息不触发下载或注入样式。文档按名称选择宿主允许的主题,不接受 CSS、样式地址或脚本。主题 CSS 属于宿主信任的代码,宿主负责审查其作用域和资源引用。
|
|
51
57
|
|
|
52
|
-
未知主题、所选名称重复、所选登记信息无效、协议不兼容或缺少深浅模式时,渲染器警告并回退到 `default`。纯核心宿主可调用 `resolveLocalTheme(name, themes, range?, source?)`,得到 `{ name, diagnostics }`。编译器只处理声明,不查询宿主的主题列表。
|
|
58
|
+
未知主题、所选名称重复、所选登记信息无效、协议不兼容或缺少深浅模式时,渲染器警告并回退到 `default`。内置 `default` 始终可用;未登记就选择 `soft` 或其他外部名称时,同样回退到 `default`。纯核心宿主可调用 `resolveLocalTheme(name, themes, range?, source?)`,得到 `{ name, diagnostics }`。编译器只处理声明,不查询宿主的主题列表。
|
|
53
59
|
|
|
54
60
|
## 深浅模式与实例作用域
|
|
55
61
|
|
|
@@ -81,21 +87,87 @@ export function Article({ source }: { source: string }) {
|
|
|
81
87
|
|
|
82
88
|
| 用途 | 公共变量 |
|
|
83
89
|
| --- | --- |
|
|
84
|
-
| 背景 | `--paper`、`--surface`、`--document-bg`(默认跟随 `--surface`)、`--surface-subtle`、`--surface-hover`、`--surface-active` |
|
|
90
|
+
| 背景 | `--paper`、`--surface`、`--document-bg`(默认跟随 `--surface`)、`--surface-subtle`、`--surface-hover`、`--surface-active`、`--image-zoom-backdrop` |
|
|
85
91
|
| 文字与边框 | `--ink`、`--ink-soft`、`--ink-muted`、`--line`、`--line-strong` |
|
|
86
|
-
| 强调色 | `--accent`、`--accent-hover`、`--accent-soft`、`--accent-line
|
|
92
|
+
| 强调色 | `--accent`、`--accent-hover`、`--accent-soft`、`--accent-line`、`--accent-ink`(填充强调色上的文字)、`--accent-text`(作为文字使用的强调色) |
|
|
87
93
|
| 状态 | `--info`、`--info-soft`、`--success`、`--success-soft`、`--success-line`、`--warning`、`--warning-soft`、`--warning-line`、`--danger`、`--danger-soft`、`--danger-line`、`--neutral-soft` |
|
|
88
94
|
| 焦点 | `--focus`、`--focus-outline`、`--focus-ring` |
|
|
89
95
|
| 数据与代码 | `--chart-1` 至 `--chart-8`、`--chart-grid`、`--chart-axis`、`--code-bg`、`--code-bg-deep`、`--code-ink` |
|
|
90
96
|
| 字体 | `--font-sans`、`--font-mono`、`--text-xs` 至 `--text-xl`、`--text-2xl`、`--text-block-title`、`--text-block-subtitle` |
|
|
91
97
|
| 行高与字重 | `--leading-tight`、`--leading-snug`、`--leading-normal`、`--leading-relaxed`、`--weight-regular`、`--weight-medium`、`--weight-semibold`、`--weight-bold` |
|
|
92
98
|
| 间距 | `--space-1` 至 `--space-7`、`--field-gap` |
|
|
93
|
-
| 圆角 | `--radius-control`、`--radius-card`、`--radius-panel`、`--radius-pill` |
|
|
94
|
-
| 控件 | `--control-height-sm`、`--control-height`、`--control-height-lg`、`--control-padding-x`、`--control-padding-y`、`--disabled-opacity` |
|
|
99
|
+
| 圆角 | `--radius-control`、`--radius-card`、`--radius-panel`、`--radius-pill`、`--radius-field`、`--radius-field-multiline` |
|
|
100
|
+
| 控件 | `--control-height-sm`、`--control-height`、`--control-height-lg`、`--control-padding-x`、`--control-padding-y`、`--control-inset-x`、`--control-selected`、`--control-selected-ink`、`--control-track`、`--control-thumb`、`--disabled-opacity` |
|
|
101
|
+
| 表格 | `--table-cell-padding-y`、`--table-cell-padding-x` |
|
|
95
102
|
| 动效与阴影 | `--motion-fast`、`--motion-base`、`--motion-slow`、`--ease-standard`、`--shadow-sm`、`--shadow-md` |
|
|
96
103
|
|
|
97
104
|
已有 `--blue`、`--blue-deep`、`--blue-soft`、`--blue-line` 保留兼容;新主题优先使用强调色变量。组件的局部 `color` 属性覆盖对应局部颜色,其余样式继续使用主题。数据序列、状态提示等保留各自的语义颜色。
|
|
98
105
|
|
|
106
|
+
## 主题化原生按钮
|
|
107
|
+
|
|
108
|
+
`reactive-md/styles.css` 包含 `controls.css` 公共按钮样式。组件作者在 `.md-document` 内输出原生 `<button>` 或 `type` 为 `button`、`submit`、`reset` 的 `<input>`,即可获得当前文档的 secondary 外观:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<button type="button">暂停</button>
|
|
112
|
+
<button type="button" className="md-button-primary">开始</button>
|
|
113
|
+
<button type="button" className="game-direction">←</button>
|
|
114
|
+
<button type="button" data-rmd-appearance="custom">特殊按钮</button>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| 用法 | 外观责任 |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| 普通原生按钮、兼容类 `md-button` | 默认 secondary,包含 hover、active、focus-visible 和 disabled |
|
|
120
|
+
| `md-button-primary`、`md-button-secondary`、`md-button-quiet` | 显式选择语义变体,可单独使用 |
|
|
121
|
+
| 组件自己的 CSS 类 | 按属性覆盖;只改宽度时,颜色、禁用态与焦点仍跟随公共样式 |
|
|
122
|
+
| `data-rmd-appearance="custom"` | 当前元素退出公共按钮皮肤,组件负责完整外观与交互状态,仍可读取主题变量 |
|
|
123
|
+
|
|
124
|
+
`data-rmd-appearance` 是组件输出的 DOM 属性,无须修改 RMD 语法,也不影响后代按钮。公共规则以 `:where()` 保持零选择器权重,不使用 `!important`;组件的普通类选择器可覆盖声明过的属性,包括交互状态中的同一属性。公共按钮不设置外边距,间距由容器 `gap` 或组件布局决定,并保留 `[hidden]` 的隐藏行为。禁用态也适用于禁用 `fieldset` 内的按钮。
|
|
125
|
+
|
|
126
|
+
主题通过 `--surface`、`--surface-hover`、`--surface-active`、`--ink`、`--line-strong`、`--accent`、`--accent-hover`、`--accent-ink`、`--control-height`、`--control-inset-x`、`--control-padding-y`、`--radius-field`、`--focus-outline` 和现有字体、动效变量调整按钮。棋盘、方块颜色和游戏动画由组件包维护;内置与外部按钮使用同一公共实现。
|
|
127
|
+
|
|
128
|
+
宿主按公共样式、主题资源、组件资源的顺序加载。SSR 页面应在首屏加载同一 `reactive-md/styles.css`;离线 HTML 应包含公共样式、所选主题和组件 CSS。各文档根节点的变量决定实例外观,切换主题保留组件运行状态。纯编译器入口保持无 CSS 依赖。
|
|
129
|
+
|
|
130
|
+
自动匹配只作用于文档内的原生按钮。`[role="button"]` 由组件自行设计;文档外的导航、工具栏及宿主按钮保持各自样式。Portal、Shadow DOM 和 iframe 内容需要宿主单独接入主题。下文列出的原生控件和组件类同样使用自动皮肤。
|
|
131
|
+
|
|
132
|
+
## 主题化原生控件
|
|
133
|
+
|
|
134
|
+
公共样式对 `.md-document` 内的下列原生控件提供皮肤。匹配依据是真实元素和 input 类型,不从 role、容器类或 `div` 推断控件。键盘操作、校验时机、日期选择器、数字步进和平台交互保持原生;标签、ARIA、状态和行为由组件负责。在匹配元素上设置 `data-rmd-appearance="custom"` 可让该元素退出公共皮肤,主题变量仍可使用。
|
|
135
|
+
|
|
136
|
+
**输入字段。** 省略 `type` 或类型为 `text`、`search`、`email`、`url`、`tel`、`password`、`number`、`date`、`time`、`datetime-local`、`month`、`week` 的输入、`textarea`,以及单选和多选 `select`,使用主题背景、边框、圆角和控件高度。焦点使用 `--focus` 与 `--focus-ring`。`aria-invalid="true"` 和平台 `:user-invalid` 显示危险色边框;公共样式不处理裸 `:invalid`,校验时机仍由作者控制。只读字段保留主题和焦点;禁用字段使用 `--disabled-opacity`,禁用 `fieldset` 内的控件同样生效。原生日期时间选择器、数字步进和下拉箭头保持可用。字段占满容器宽度、上限 420px,并可在 375px 下收缩。
|
|
137
|
+
|
|
138
|
+
`.md-field` 与兼容的 `.md-control` 以纵向间距组合标签、控件、提示与错误。`.md-label`、`.md-hint`、`.md-error`、`.md-required` 分别设置这些部分;原生 `label` 和 `legend` 获得基础排版。`required` 或 `aria-required` 由作者写在控件上。`.md-text-input`、`.md-select-input` 作为兼容类继续使用同一皮肤。
|
|
139
|
+
|
|
140
|
+
**选择与进度。** 原生 `input[type="checkbox"]`、`input[type="radio"]` 保留平台形状,选中标记使用 `--control-selected`,缺失时回退到 `--accent`。原生 checkbox 可通过 `.md-switch`,或在该 checkbox 上设置 `role="switch"` 来选择开关外观;公共样式不会把容器或普通 `div` 变成开关。`input[type="range"]` 在 WebKit 和 Firefox 中设置轨道与滑块,同时保留原生输入语义。`progress` 支持确定与不确定进度;`meter` 保留 low、high、optimum 语义并用状态色显示。`.md-progress`、`.md-meter` 是同一原生元素上的可选类。各类控件分别设置尺寸。
|
|
141
|
+
|
|
142
|
+
**折叠内容。** 原生 `details`、`summary` 获得基础外观;标记、键盘行为和关闭状态保持原生,公共样式不对关闭元素设置 `display`。`.md-disclosure`、`.md-disclosure-title`、`.md-disclosure-panel` 是作者自有折叠结构上的可选外观类。
|
|
143
|
+
|
|
144
|
+
**对话框与浮层。** 原生 `dialog` 仅在打开时设置外观,原生 `[popover]` 仅在 `:popover-open` 时设置。公共样式不设置 display、定位或指针行为。`dialog::backdrop` 使用 `--image-zoom-backdrop`,缺失时使用中性回退色。`.md-dialog`、`.md-popover`、`.md-tooltip`、`.md-menu`、`.md-menu-item`、`.md-menu-separator` 为作者自有结构提供外观;打开状态、位置、焦点、键盘处理和挂载位置由作者负责。这些类不会显示已关闭的 dialog 或 popover,尺寸约束保证 375px 下可用。
|
|
145
|
+
|
|
146
|
+
## 主题化组件类
|
|
147
|
+
|
|
148
|
+
其余公共 UI 由共享类覆盖。共享类提供外观;语义、行为、焦点和位置由作者负责。
|
|
149
|
+
|
|
150
|
+
| 区域 | 公共类 |
|
|
151
|
+
| --- | --- |
|
|
152
|
+
| 容器 | `md-card`、`md-card-title`、`md-card-body`、`md-panel`、`md-panel-title`、`md-panel-body`、`md-group` |
|
|
153
|
+
| 状态 | `md-badge`、`md-status`,以及 `md-badge-neutral`、`md-badge-success`、`md-badge-warning`、`md-badge-danger`、`md-badge-info` 和对应的 `md-status-*` 变体 |
|
|
154
|
+
| 反馈 | `md-alert` 及 `md-alert-success`、`md-alert-warning`、`md-alert-danger`、`md-alert-info`、`md-alert-title`、`md-alert-body`;`md-empty-state`、`md-empty-state-title`、`md-empty-state-description`;`md-spinner`、`md-loading`、`md-skeleton` |
|
|
155
|
+
| 导航 | `md-tabs`、`md-tablist`、`md-tab`、`md-tabpanel`、`md-pagination`、`md-page`、`md-steps`、`md-step` |
|
|
156
|
+
| 正文 | 标题、段落、链接、列表、引用、分隔线、`kbd`、行内代码和代码块的文档排版;原生表格和 `md-table` |
|
|
157
|
+
| 图表 | `md-chart`、`md-chart-axis`、`md-chart-grid`、`md-chart-legend`、`md-chart-node`、`md-chart-edge`、`md-chart-series-line`、`md-chart-series-area` |
|
|
158
|
+
|
|
159
|
+
标签页和步骤根据 `aria-selected`、`aria-current`、`aria-expanded` 及禁用状态显示外观;`aria-current="step"` 和 `data-state="complete"` 标记步骤进度。表格使用 `md-table-striped` 显示斑马行,使用 `aria-selected="true"` 或 `data-state="selected"` 标记选中行。单元格内边距读取 `--table-cell-padding-y` 和 `--table-cell-padding-x`。
|
|
160
|
+
|
|
161
|
+
图表序列元素设置 `--series-color`,缺失时回退到 `--chart-1`。`data-series="1"` 至 `"8"` 映射现有 `--chart-1` 至 `--chart-8` 调色板。SVG 几何、可访问名称和交互由作者提供。
|
|
162
|
+
|
|
163
|
+
文档排版使用共享的字体、间距和行高变量。行内代码和代码块使用 `--code-bg`、`--code-bg-deep`、`--code-ink`;`kbd` 使用控件背景和边框。原生表格与 `md-table` 共用单元格内边距和边框。专用组件保持各自外观。
|
|
164
|
+
|
|
165
|
+
所有新增皮肤都限制在 `.md-document` 内,基础和状态选择器主体统一用 `:where()` 保持零权重;伪元素追加在该主体之后,不新增 `!important`。组件的普通类选择器无论样式表加载顺序如何,都能覆盖其声明的属性。`[data-rmd-appearance="custom"]` 只让标记的元素退出皮肤,后代仍保留皮肤。隐藏元素保持隐藏。打印保留原生控件值和现有内置打印摘要。
|
|
166
|
+
|
|
167
|
+
## 密度
|
|
168
|
+
|
|
169
|
+
在文档根节点或子树上设置 `data-rmd-density="compact"` 或 `"comfortable"`,可通过共享变量调整控件高度和表格单元格内边距。组件和主题仍可覆盖单个尺寸。
|
|
170
|
+
|
|
99
171
|
## 组件 CSS 与验收
|
|
100
172
|
|
|
101
173
|
主题可在共享变量之外覆盖现有 `.md-*`、`.local-*` 组件类。文档根类、组件外层类和语义状态属性是主题的样式接口;内部节点的排列不是扩展 API。主题规则遵守文档作用域,并在公共样式之后加载。使用足够明确的根节点与组件选择器覆盖基础规则,避免依赖 `!important`。
|