reactive-md 0.9.3 → 0.10.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 +34 -0
- package/CHANGELOG.md +34 -0
- package/README-ch.md +7 -7
- package/README-en.md +7 -7
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/cli/help.mjs +6 -4
- package/cli/init.mjs +1 -1
- package/cli/migrate.mjs +1 -1
- package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
- package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
- package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
- package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
- package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
- package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
- package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
- package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
- package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
- package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
- package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
- package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
- package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
- package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
- package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
- package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
- package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
- package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
- package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
- package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
- package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
- package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
- package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
- package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
- package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
- package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
- package/dist-library/reactive-md-authoring.js +277 -269
- package/dist-library/reactive-md-build.js +327 -33
- package/dist-library/reactive-md-compiler-session.js +3 -3
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +4 -4
- package/dist-library/reactive-md-default-packs.js +4 -3
- package/dist-library/reactive-md-default-preset.js +3 -3
- package/dist-library/reactive-md-export.js +6 -6
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +18 -17
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +2 -2
- package/dist-library/reactive-md-pack-style-manifest.js +8 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -9
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +5 -5
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +10 -10
- package/dist-library/reactive-md-plugin-network.js +5 -5
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-react-component-accordion.js +3 -3
- package/dist-library/reactive-md-react-component-alert.js +3 -3
- package/dist-library/reactive-md-react-component-anchor.js +3 -3
- package/dist-library/reactive-md-react-component-badge.js +3 -3
- package/dist-library/reactive-md-react-component-card.js +3 -3
- package/dist-library/reactive-md-react-component-chart.js +2 -2
- package/dist-library/reactive-md-react-component-checkbox.js +2 -2
- package/dist-library/reactive-md-react-component-checklist.js +2 -2
- package/dist-library/reactive-md-react-component-choices.js +2 -2
- package/dist-library/reactive-md-react-component-column.js +1 -1
- package/dist-library/reactive-md-react-component-coordinate.js +2 -2
- package/dist-library/reactive-md-react-component-counter.js +2 -2
- package/dist-library/reactive-md-react-component-data-table.js +2 -2
- package/dist-library/reactive-md-react-component-date.js +2 -2
- package/dist-library/reactive-md-react-component-diagram.js +2 -2
- package/dist-library/reactive-md-react-component-disclosure.js +3 -3
- package/dist-library/reactive-md-react-component-edge.js +1 -1
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
- package/dist-library/reactive-md-react-component-gallery.js +2 -2
- package/dist-library/reactive-md-react-component-grid.js +3 -3
- package/dist-library/reactive-md-react-component-if.js +3 -3
- package/dist-library/reactive-md-react-component-input.js +2 -2
- package/dist-library/reactive-md-react-component-jump.js +3 -3
- package/dist-library/reactive-md-react-component-multi-select.js +2 -2
- package/dist-library/reactive-md-react-component-node.js +2 -2
- package/dist-library/reactive-md-react-component-number.js +2 -2
- package/dist-library/reactive-md-react-component-option.js +1 -1
- package/dist-library/reactive-md-react-component-panel.js +3 -3
- package/dist-library/reactive-md-react-component-plot.js +2 -2
- package/dist-library/reactive-md-react-component-progress.js +2 -2
- package/dist-library/reactive-md-react-component-quiz.js +2 -2
- package/dist-library/reactive-md-react-component-radio-group.js +2 -2
- package/dist-library/reactive-md-react-component-range-slider.js +2 -2
- package/dist-library/reactive-md-react-component-section.js +3 -3
- package/dist-library/reactive-md-react-component-select.js +2 -2
- package/dist-library/reactive-md-react-component-slider.js +2 -2
- package/dist-library/reactive-md-react-component-step.js +3 -3
- package/dist-library/reactive-md-react-component-steps.js +3 -3
- package/dist-library/reactive-md-react-component-tab.js +3 -3
- package/dist-library/reactive-md-react-component-table.js +2 -2
- package/dist-library/reactive-md-react-component-tabs.js +3 -3
- package/dist-library/reactive-md-react-component-text.js +3 -3
- package/dist-library/reactive-md-react-component-textarea.js +2 -2
- package/dist-library/reactive-md-react-component-timeline.js +2 -2
- package/dist-library/reactive-md-react-component-timer.js +2 -2
- package/dist-library/reactive-md-react-component-toggle.js +2 -2
- package/dist-library/reactive-md-react-component-tooltip.js +3 -3
- package/dist-library/reactive-md-react-component-validation.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +4 -4
- package/dist-library/reactive-md-react-pack-data.js +3 -3
- package/dist-library/reactive-md-react-pack-layout.js +25 -24
- package/dist-library/reactive-md-react-pack-visuals.js +2 -2
- package/dist-library/reactive-md-react-packed.js +6 -6
- package/dist-library/reactive-md-react-server.js +37 -36
- package/dist-library/reactive-md-react-static-server.js +2 -2
- package/dist-library/reactive-md-react-static.js +1 -1
- package/dist-library/reactive-md-react-unstyled.js +12 -12
- package/dist-library/reactive-md-react.js +12 -12
- package/dist-library/reactive-md-scan.js +1 -1
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +6 -6
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +3 -3
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +52 -43
- package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
- package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
- package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
- package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
- package/dist-library/rmd-pack-layout.css +9 -0
- package/dist-library/rmd-pack-resource-layout.css +9 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
- package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
- package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
- package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
- package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +3 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +5 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -1
- package/dist-library/types/components/table/data-table-model.d.ts +95 -2
- package/dist-library/types/components/table/data-table.d.ts +2 -2
- package/dist-library/types/contracts/component-kernel.d.ts +5 -0
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
- package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +4 -3
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/types.d.ts +33 -2
- package/dist-library/types/react/component-api.d.ts +21 -2
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/package-core.d.ts +3 -0
- package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
- package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
- package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +3 -1
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +6 -0
- package/dist-library/types/sdk/version.d.ts +1 -1
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +4 -1
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
- package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +128 -368
- package/docs/README-ch.md +3 -1
- package/docs/README.md +3 -1
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +15 -15
- package/docs/compatibility/compatibility-en.md +15 -15
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +22 -14
- package/docs/compatibility/source-versioning-en.md +22 -13
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-protocol-ch.md +18 -18
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/guides/local-guide-ch.md +109 -20
- package/docs/guides/local-guide-en.md +109 -20
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +29 -3
- package/docs/integration/extension-sdk-en.md +29 -3
- package/docs/integration/local-integration-ch.md +3 -3
- package/docs/integration/local-integration-en.md +3 -3
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +11 -19
- package/docs/integration/shareable-export-en.md +11 -19
- package/docs/reference/diagnostics-counting-ch.md +24 -1
- package/docs/reference/diagnostics-counting-en.md +24 -1
- package/docs/reference/local-interaction-syntax-ch.md +222 -33
- package/docs/reference/local-interaction-syntax-en.md +220 -31
- package/docs/reference/public-api-ch.md +24 -18
- package/docs/reference/public-api-en.md +24 -18
- package/docs/reference/theme-protocol-ch.md +1 -1
- package/docs/reference/theme-protocol-en.md +1 -1
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/integration/README-ch.md +3 -3
- package/examples/integration/README.md +3 -3
- package/examples/integration/chat-session/package.json +1 -1
- package/examples/local/README-ch.md +1 -1
- package/examples/local/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
- package/dist-library/authoring-B14SsOXZ.js +0 -893
- package/dist-library/compile-D50B5_Ww.js +0 -1249
- package/dist-library/computations-CffoW7Ff.js +0 -340
- package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
- package/dist-library/default-options-DU5dxuU6.js +0 -125
- package/dist-library/layout-BfUzzO2b.js +0 -553
- package/dist-library/runtime-CuJndKqK.js +0 -1289
- package/dist-library/shareable-C6mUerpQ.js +0 -817
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
- package/dist-library/visuals-CoVSjVD8.js +0 -49159
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**中文** · [English](component-protocol-en.md)
|
|
4
4
|
|
|
5
|
-
协议修订 `component-protocol-3` · 适用语法 `local-draft-
|
|
5
|
+
协议修订 `component-protocol-3` · 适用语法 `local-draft-4` · 当前包版本 `0.10.0`
|
|
6
6
|
|
|
7
7
|
Reactive MD 的组块就是语言中的组件。本协议规定组块在贡献、实现和验收中的共同契约,连接作者语法、编译器、运行时、React 参考适配器和机器验收数据。作者写文档时以[本地交互语法规范](../reference/local-interaction-syntax-ch.md)为准;宿主接入以[本地模式集成](../integration/local-integration-ch.md)为准;本文供贡献者、评审和测试使用。
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@ Reactive MD 分别维护以下版本轴:
|
|
|
23
23
|
| 版本轴 | 当前值 | 决定什么 |
|
|
24
24
|
| --- | --- | --- |
|
|
25
25
|
| 包版本 | `0.5.2` | npm 发布、核心与 React 入口、升级兼容规则 |
|
|
26
|
-
| 语法修订 | `local-draft-
|
|
26
|
+
| 语法修订 | `local-draft-4` | 作者可以写出的标签、属性和表达式 |
|
|
27
27
|
| 协议修订 | `component-protocol-3` | 组块贡献要求、验收门槛和机器数据语义 |
|
|
28
28
|
| 主题协议 | `reactive-md-theme-1` | 主题登记、样式变量、深浅模式与主题验收 |
|
|
29
29
|
|
|
@@ -62,7 +62,7 @@ Reactive MD 分别维护以下版本轴:
|
|
|
62
62
|
|
|
63
63
|
### CP-SCOPE-05 适用范围(边界)
|
|
64
64
|
|
|
65
|
-
本协议适用于 `local-draft-
|
|
65
|
+
本协议适用于 `local-draft-4` 的 52 个标签名、它们的编译、运行时和参考渲染行为,以及向仓库提交新组块或修改现有组块的流程。
|
|
66
66
|
|
|
67
67
|
本文规定贡献与验收契约。作者教程和宿主 API 各有独立文档,HTML 可移植范围见 CP-CORE-03,扩展接口边界见 CP-CORE-05。
|
|
68
68
|
|
|
@@ -70,20 +70,20 @@ Reactive MD 分别维护以下版本轴:
|
|
|
70
70
|
|
|
71
71
|
### CP-MODEL-01 组块分类(现有)
|
|
72
72
|
|
|
73
|
-
`local-draft-
|
|
73
|
+
`local-draft-4` 固定 52 个标签名,分为以下类别:
|
|
74
74
|
|
|
75
75
|
| 类别 | 组块 | 说明 |
|
|
76
76
|
| --- | --- | --- |
|
|
77
77
|
| 输入控件 | `input`、`textarea`、`number`、`slider`、`range-slider`、`coordinate`、`toggle`、`checkbox`、`date`、`select`、`choices`、`radio-group`、`multi-select`、`option` | 读取读者输入并可选公开参数 |
|
|
78
78
|
| 自操作控件 | `counter`、`timer`、`checklist`、`progress` | 自带增减、计时、勾选或进度显示 |
|
|
79
|
-
| 组织与结构 | `panel`、`card`、`grid`、`tabs`、`tab`、`steps`、`step`、`accordion`、`disclosure`、`if` | 排版、切换、折叠、分步阅读和条件显示 |
|
|
79
|
+
| 组织与结构 | `panel`、`card`、`grid`、`gallery`、`gallery-item`、`tabs`、`tab`、`steps`、`step`、`accordion`、`disclosure`、`if`、`else` | 排版、切换、折叠、分步阅读和条件显示 |
|
|
80
80
|
| 跳转与正文 | `jump`、`anchor`、`text`、`section` | 跳转、显式锚点和受控前景色 |
|
|
81
81
|
| 练习 | `quiz` | 选择或数字自测题;不公开绑定 |
|
|
82
82
|
| 反馈 | `alert`、`badge`、`tooltip` | 提示和行内说明 |
|
|
83
|
-
| 声明 | `computed`、`const`、`validation` | 按标签解析但不渲染为控件 |
|
|
83
|
+
| 声明 | `external`、`computed`、`const`、`validation` | 按标签解析但不渲染为控件 |
|
|
84
84
|
| 生成数据与可视化 | `data-table`、`column`、`table`、`chart`、`plot`、`timeline`、`diagram`、`node`、`edge` | 生成行、表格、图表、函数曲线、时间轴和图解 |
|
|
85
85
|
|
|
86
|
-
`option`、`tab`、`disclosure`、`node`、`edge`、`step`、`column` 是结构子项,只在指定父组块内出现。`computed`、`const` 是不可见声明;`validation` 在规则不满足时生成可访问的提示。开头的 `<theme>` 声明是文档元数据,不是组块。完整名称和用途见[语法规范第 12 节](../reference/local-interaction-syntax-ch.md#12-组件速查与语法裁剪)。
|
|
86
|
+
`option`、`tab`、`gallery-item`、`disclosure`、`node`、`edge`、`step`、`column` 是结构子项,只在指定父组块内出现。`computed`、`const` 是不可见声明;`validation` 在规则不满足时生成可访问的提示。开头的 `<theme>` 声明是文档元数据,不是组块。完整名称和用途见[语法规范第 12 节](../reference/local-interaction-syntax-ch.md#12-组件速查与语法裁剪)。
|
|
87
87
|
|
|
88
88
|
### CP-MODEL-02 三种形态(现有)
|
|
89
89
|
|
|
@@ -118,7 +118,7 @@ Reactive MD 分别维护以下版本轴:
|
|
|
118
118
|
|
|
119
119
|
### CP-MODEL-04 名称集合(现有)
|
|
120
120
|
|
|
121
|
-
`local-draft-
|
|
121
|
+
`local-draft-4` 的 52 个名称是当前语法的完整集合。新增名称、删除名称或改变名称含义都属于作者可见变化,按第 10 节处理。实现可以在内部使用未公开的节点类型,但作者只能使用这里和语法规范列出的名称。
|
|
122
122
|
|
|
123
123
|
### CP-MODEL-05 raw 正文容器(要求)
|
|
124
124
|
|
|
@@ -193,7 +193,7 @@ $$ y = x^2 $$
|
|
|
193
193
|
| 公式 | 一个或多个 `$$...$$` 公式块 | `plot` |
|
|
194
194
|
| 内容 | 任务列表或静态说明 | `checklist`、`node` |
|
|
195
195
|
| 普通内容 | Markdown 和组块,按组块附加规则 | `panel`、`card`、`tab`、`step`、`if`、`alert`、`section` |
|
|
196
|
-
| raw 正文 | 单个惰性原文正文;不解析 Markdown、插值或子组块 | 声明 `raw-body` 的 SDK 或宿主容器;
|
|
196
|
+
| raw 正文 | 单个惰性原文正文;不解析 Markdown、插值或子组块 | 声明 `raw-body` 的 SDK 或宿主容器;49 个作者标签均不使用 |
|
|
197
197
|
|
|
198
198
|
`checklist` 的正文必须正好是一层 Markdown 任务列表;`node` 的说明可以包含文本插值,但不得包含交互组块。`choice` 类型的 `quiz` 接受 `option` 子项,`number` 类型的正文为空。结构子项出现在错误父级、容器缺少必需子项或子项类型不符时,编译失败。
|
|
199
199
|
|
|
@@ -203,7 +203,7 @@ $$ y = x^2 $$
|
|
|
203
203
|
|
|
204
204
|
### CP-SYNTAX-08 作者能力边界(现有)
|
|
205
205
|
|
|
206
|
-
作者不能执行脚本、写入可执行 HTML、提供作者 CSS、注册事件处理器或声明网络服务调用。图片与链接受 CP-SEC-02 的宿主 URL 策略约束。`<script>`、`<style>`、`on-*`、`class`、`style` 和旧版 directive 都不属于 `local-draft-
|
|
206
|
+
作者不能执行脚本、写入可执行 HTML、提供作者 CSS、注册事件处理器或声明网络服务调用。图片与链接受 CP-SEC-02 的宿主 URL 策略约束。`<script>`、`<style>`、`on-*`、`class`、`style` 和旧版 directive 都不属于 `local-draft-4`。完整未知标签按源码降级,结构不完整或无法恢复的标签产生错误。文档内容不会作为任意 HTML 执行。
|
|
207
207
|
|
|
208
208
|
## 4. 绑定与状态
|
|
209
209
|
|
|
@@ -515,7 +515,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
|
|
|
515
515
|
|
|
516
516
|
本修订描述组件贡献要求和第 14 节的旧宿主接口。`LOCAL_COMPONENTS` 是默认预设的内部兼容投影;`hostComponents` 为单次编译接受纯 schema 数据,并作为输入适配到统一内核,组件实现由宿主提供。
|
|
517
517
|
|
|
518
|
-
[扩展 SDK](../integration/extension-sdk-ch.md)自 `reactive-md@0.8.0` 起提供,使用独立的 `reactive-md-component/v1` 数据契约和实例级配置,提供注册校验、React 实现绑定、编辑器目录、离线构建、版本恢复和公开合规工具。
|
|
518
|
+
[扩展 SDK](../integration/extension-sdk-ch.md)自 `reactive-md@0.8.0` 起提供,使用独立的 `reactive-md-component/v1` 数据契约和实例级配置,提供注册校验、React 实现绑定、编辑器目录、离线构建、版本恢复和公开合规工具。49 个默认渲染与结构组件采用同一公开契约。组件代码由宿主主动安装,文档声明不会装载代码。
|
|
519
519
|
|
|
520
520
|
## 10. 兼容、名称治理、修订和迁移
|
|
521
521
|
|
|
@@ -531,7 +531,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
|
|
|
531
531
|
|
|
532
532
|
### CP-COMPAT-02 语法修订(现有)
|
|
533
533
|
|
|
534
|
-
作者可见的语法变化会建立新的语法修订,例如 `local-draft-
|
|
534
|
+
作者可见的语法变化会建立新的语法修订,例如 `local-draft-4`,同时提升包次版本并更新 `LOCAL_SYNTAX_VERSION`。项目不自动改写源码;升级后由作者或宿主按变更记录迁移。一个包版本只接受一个语法修订。
|
|
535
535
|
|
|
536
536
|
### CP-COMPAT-03 协议修订(要求)
|
|
537
537
|
|
|
@@ -546,7 +546,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
|
|
|
546
546
|
|
|
547
547
|
### CP-COMPAT-04 名称治理(要求)
|
|
548
548
|
|
|
549
|
-
- 新名称必须是小写 kebab-case,语义明确,避免与现有
|
|
549
|
+
- 新名称必须是小写 kebab-case,语义明确,避免与现有 52 个名称冲突。
|
|
550
550
|
- 不使用 `script`、`style`、`div`、`span`、`a` 等 HTML 名称,也不使用 `on-*`、`class`、`style` 作为作者属性。
|
|
551
551
|
- 在 `component-protocol-1` 内,现有 48 个名称保留给现有语义;复用名称表示破坏性变更。
|
|
552
552
|
- 不提供隐式别名。别名需要单独名称、文档和验收证据。
|
|
@@ -585,7 +585,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
|
|
|
585
585
|
|
|
586
586
|
### CP-ACCEPT-02 机器验收数据(要求)
|
|
587
587
|
|
|
588
|
-
机器验收集的根对象只包含 `protocolVersion`、`syntaxVersion` 和非空 `cases`。冻结的作者组块集 `examples/conformance/component-protocol-1.json` 仍为 `component-protocol-1` / `local-draft-2`;当前可移植语法集为 `examples/conformance/local-draft-
|
|
588
|
+
机器验收集的根对象只包含 `protocolVersion`、`syntaxVersion` 和非空 `cases`。冻结的作者组块集 `examples/conformance/component-protocol-1.json` 仍为 `component-protocol-1` / `local-draft-2`;当前可移植语法集为 `examples/conformance/local-draft-4.json`。两者都按各自声明的修订校验。
|
|
589
589
|
|
|
590
590
|
每个 case 至少包含唯一字符串 `id`、组块名 `component`、源码 `source`、布尔 `ok` 和去重诊断码集合 `codes`。可选字段 `initial`、`bindingNames`、`actions`、`reset`、`text`、`expectedText`、`htmlIncludes`、`htmlExcludes` 按[语言验收数据说明](../../examples/conformance/README.md)和仓库附带的 JSON Schema 使用。完整格式以该说明和 Schema 为准,本协议只规定语义门槛。
|
|
591
591
|
|
|
@@ -656,7 +656,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
|
|
|
656
656
|
|
|
657
657
|
### CP-IMPL-03 扩展接口(边界)
|
|
658
658
|
|
|
659
|
-
第 14 节保留旧 schema 与 renderer 接口;新组件使用[扩展 SDK](../integration/extension-sdk-ch.md)的 manifest、实例配置和适配器。SDK 协议、组件版本、主题协议、恢复载荷与 `local-draft-
|
|
659
|
+
第 14 节保留旧 schema 与 renderer 接口;新组件使用[扩展 SDK](../integration/extension-sdk-ch.md)的 manifest、实例配置和适配器。SDK 协议、组件版本、主题协议、恢复载荷与 `local-draft-4` 语法修订分别管理。
|
|
660
660
|
|
|
661
661
|
manifest 与绑定测试使用 `reactive-md/testing`,渲染与生命周期证据分别使用 `testing/react` 和 `testing/browser`。组件仍须满足本协议的预算、可访问性与行为要求。宿主显式安装实现并负责其代码权限;SDK 校验契约和资源,不提供第三方代码沙箱。
|
|
662
662
|
|
|
@@ -721,7 +721,7 @@ manifest 与绑定测试使用 `reactive-md/testing`,渲染与生命周期证
|
|
|
721
721
|
|
|
722
722
|
### CP-HOST-01 宿主组件是可选扩展(现有)
|
|
723
723
|
|
|
724
|
-
`compileLocal(source, { hostComponents })` 为编译器增加一条宿主拥有的扩展轴。不传 `hostComponents` 时,作者行为不变:
|
|
724
|
+
`compileLocal(source, { hostComponents })` 为编译器增加一条宿主拥有的扩展轴。不传 `hostComponents` 时,作者行为不变:52 个作者标签名照常解析,集合之外的标签仍是未知标签,并按 CP-DIAG-03 降级为原文。该选项只改变本次调用识别的标签名,不增加作者语法。协议修订为 `component-protocol-3`。
|
|
725
725
|
|
|
726
726
|
### CP-HOST-02 宿主 Schema 是普通数据(要求)
|
|
727
727
|
|
|
@@ -729,7 +729,7 @@ manifest 与绑定测试使用 `reactive-md/testing`,渲染与生命周期证
|
|
|
729
729
|
|
|
730
730
|
| 字段 | 内容 |
|
|
731
731
|
| --- | --- |
|
|
732
|
-
| `name` | 小写 kebab-case,在集合内唯一,不能是
|
|
732
|
+
| `name` | 小写 kebab-case,在集合内唯一,不能是 52 个作者标签名、P0 HTML 标签名或主题声明名 `theme` |
|
|
733
733
|
| `form` | `'leaf'`、`'inline'` 或 `'container'`;inline 与 container 的正文按普通 Markdown 编译,可包含组件;`body` 可选择 raw 交付 |
|
|
734
734
|
| `props` | 宿主属性表;属性名使用小写 kebab-case |
|
|
735
735
|
| `body` | 可选的容器正文交付方式:`'markdown'`(默认)或 `'raw'`。`'raw'` 按 CP-MODEL-05 降为内部 `raw-body` 结构规则;其他形态会被拒绝 |
|
|
@@ -752,7 +752,7 @@ React 视图把 `hostComponent` 节点分发给 `hostRenderer(node, data, ctx)`
|
|
|
752
752
|
|
|
753
753
|
缺少渲染器、缺少 `${kind}:${ref}` 键或渲染器抛出异常时,显示可见的诊断占位,不得让异常冒出文档或使其余内容变空白。`mode === 'static'` 走同一分发路径,因此宿主未提供渲染器或数据时,静态渲染显示相同的占位。
|
|
754
754
|
|
|
755
|
-
可移植的机器用例仍是 `examples/conformance/component-protocol-1.json`,它作为作者组块的基线保持冻结;当前语法用例位于 `examples/conformance/local-draft-
|
|
755
|
+
可移植的机器用例仍是 `examples/conformance/component-protocol-1.json`,它作为作者组块的基线保持冻结;当前语法用例位于 `examples/conformance/local-draft-4.json`。宿主组块不提供可移植验收用例,因为渲染由宿主拥有,普通读者只能看到未知组块降级。
|
|
756
756
|
|
|
757
757
|
## 15. 修订记录
|
|
758
758
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**English** · [中文](component-protocol-ch.md)
|
|
4
4
|
|
|
5
|
-
Protocol revision `component-protocol-3` · applicable syntax `local-draft-
|
|
5
|
+
Protocol revision `component-protocol-3` · applicable syntax `local-draft-4` · current package version `0.10.0`
|
|
6
6
|
|
|
7
7
|
Components are the building blocks of the Reactive MD language. This protocol defines the shared contract for contribution, implementation and acceptance, connecting author syntax, the compiler, the runtime, the React reference adapter and machine conformance data. Authors writing documents follow the [local interaction syntax specification](../reference/local-interaction-syntax-en.md); hosts integrating follow [local mode integration](../integration/local-integration-en.md); this document is for contributors, reviewers and tests.
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@ Reactive MD maintains the following independent version axes:
|
|
|
23
23
|
| Version axis | Current value | Determines |
|
|
24
24
|
| --- | --- | --- |
|
|
25
25
|
| Package version | `0.5.2` | npm release, core and React entries, upgrade compatibility rules |
|
|
26
|
-
| Syntax revision | `local-draft-
|
|
26
|
+
| Syntax revision | `local-draft-4` | Tags, attributes and expressions authors can write |
|
|
27
27
|
| Protocol revision | `component-protocol-3` | Component contribution requirements, acceptance gates and machine data semantics |
|
|
28
28
|
| Theme protocol | `reactive-md-theme-1` | Theme registration, style variables, color schemes and theme acceptance |
|
|
29
29
|
|
|
@@ -62,7 +62,7 @@ When a clause restating existing behavior conflicts with the syntax specificatio
|
|
|
62
62
|
|
|
63
63
|
### CP-SCOPE-05 Scope (boundary)
|
|
64
64
|
|
|
65
|
-
This protocol applies to the
|
|
65
|
+
This protocol applies to the 52 tag names of `local-draft-4`, their compilation, runtime and reference rendering behavior, and the process for submitting new components or changing existing ones to the repository.
|
|
66
66
|
|
|
67
67
|
This document defines contribution and acceptance contracts. The author tutorial and host API have separate documents; see CP-CORE-03 for the portable HTML scope and CP-CORE-05 for extension interface boundaries.
|
|
68
68
|
|
|
@@ -70,20 +70,20 @@ This document defines contribution and acceptance contracts. The author tutorial
|
|
|
70
70
|
|
|
71
71
|
### CP-MODEL-01 Component classification (existing)
|
|
72
72
|
|
|
73
|
-
`local-draft-
|
|
73
|
+
`local-draft-4` fixes 52 tag names in the following groups:
|
|
74
74
|
|
|
75
75
|
| Category | Components | Notes |
|
|
76
76
|
| --- | --- | --- |
|
|
77
77
|
| Input controls | `input`, `textarea`, `number`, `slider`, `range-slider`, `coordinate`, `toggle`, `checkbox`, `date`, `select`, `choices`, `radio-group`, `multi-select`, `option` | Read reader input and optionally expose parameters |
|
|
78
78
|
| Self-operating controls | `counter`, `timer`, `checklist`, `progress` | Provide increment/decrement, timing, checking or progress display |
|
|
79
|
-
| Organization and structure | `panel`, `card`, `grid`, `tabs`, `tab`, `steps`, `step`, `accordion`, `disclosure`, `if` | Layout, switching, collapsing, guided reading and conditional display |
|
|
79
|
+
| Organization and structure | `panel`, `card`, `grid`, `gallery`, `gallery-item`, `tabs`, `tab`, `steps`, `step`, `accordion`, `disclosure`, `if`, `else` | Layout, switching, collapsing, guided reading and conditional display |
|
|
80
80
|
| Navigation and prose | `jump`, `anchor`, `text`, `section` | Jumps, explicit anchors and bounded foreground colors |
|
|
81
81
|
| Assessment | `quiz` | Choice or numeric self-study questions; no public binding |
|
|
82
82
|
| Feedback | `alert`, `badge`, `tooltip` | Alerts and inline explanations |
|
|
83
83
|
| Declarations | `external`, `computed`, `const`, `validation` | Parsed tags that are not rendered controls; `external` is a read-only host-data declaration |
|
|
84
84
|
| Generated data and visualization | `data-table`, `column`, `table`, `chart`, `plot`, `timeline`, `diagram`, `node`, `edge` | Generated rows, tables, charts, function curves, timelines and diagrams |
|
|
85
85
|
|
|
86
|
-
`option`, `tab`, `disclosure`, `node`, `edge`, `step` and `column` are structural children that appear only inside their specified parent components. `computed` and `const` are invisible declarations; `validation` produces accessible hints when its rule fails. The leading `<theme>` declaration is document metadata, not a component. See [section 12 of the syntax specification](../reference/local-interaction-syntax-en.md#12-component-reference-and-syntax-scope) for the complete names and purposes.
|
|
86
|
+
`option`, `tab`, `gallery-item`, `disclosure`, `node`, `edge`, `step` and `column` are structural children that appear only inside their specified parent components. `computed` and `const` are invisible declarations; `validation` produces accessible hints when its rule fails. The leading `<theme>` declaration is document metadata, not a component. See [section 12 of the syntax specification](../reference/local-interaction-syntax-en.md#12-component-reference-and-syntax-scope) for the complete names and purposes.
|
|
87
87
|
|
|
88
88
|
### CP-MODEL-02 Three shapes (existing)
|
|
89
89
|
|
|
@@ -118,7 +118,7 @@ Default component data lives in `src/presets/default-semantics.ts`, with its loc
|
|
|
118
118
|
|
|
119
119
|
### CP-MODEL-04 Name set (existing)
|
|
120
120
|
|
|
121
|
-
The
|
|
121
|
+
The 52 names of `local-draft-4` are the complete set for the current syntax. Adding, removing or changing the meaning of a name is an author-visible change and is handled under section 10. Implementations may use undocumented node types internally, but authors can only use the names listed here and in the syntax specification.
|
|
122
122
|
|
|
123
123
|
### CP-MODEL-05 Raw-body containers (required)
|
|
124
124
|
|
|
@@ -193,7 +193,7 @@ Whether `label` is required, optional or not applicable is determined by the com
|
|
|
193
193
|
| Formulas | One or more `$$...$$` formula blocks | `plot` |
|
|
194
194
|
| Content | A task list or static notes | `checklist`, `node` |
|
|
195
195
|
| General content | Markdown and components, with component-specific rules | `panel`, `card`, `tab`, `step`, `if`, `alert`, `section` |
|
|
196
|
-
| Raw body | One lazy raw text body; no Markdown, interpolation or child components | SDK or host containers declaring `raw-body`; none of the
|
|
196
|
+
| Raw body | One lazy raw text body; no Markdown, interpolation or child components | SDK or host containers declaring `raw-body`; none of the 49 author tags |
|
|
197
197
|
|
|
198
198
|
The `checklist` body must be exactly one level of Markdown task list; `node` notes may contain text interpolation but must not contain interactive components. A `choice` quiz accepts `option` children and a `number` quiz has an empty body. Compilation fails when a structural child appears under the wrong parent, a container lacks a required child, or a child type does not match.
|
|
199
199
|
|
|
@@ -516,7 +516,7 @@ Components that reuse public rules need a definition, implementation and registr
|
|
|
516
516
|
|
|
517
517
|
This revision describes contribution requirements and the legacy host interface in section 14. `LOCAL_COMPONENTS` is an internal compatibility projection of the default preset. `hostComponents` accepts plain schema data for one compilation and adapts it to the shared kernel, with implementations supplied by the host.
|
|
518
518
|
|
|
519
|
-
The source tree's [extension SDK](../integration/extension-sdk-en.md) has shipped since `reactive-md@0.8.0` and uses a separate `reactive-md-component/v1` data contract and instance configuration for registration validation, React implementations, editor catalogs, offline builds, versioned restoration and public compliance tools. All
|
|
519
|
+
The source tree's [extension SDK](../integration/extension-sdk-en.md) has shipped since `reactive-md@0.8.0` and uses a separate `reactive-md-component/v1` data contract and instance configuration for registration validation, React implementations, editor catalogs, offline builds, versioned restoration and public compliance tools. All 49 default rendered and structural components use this contract. Hosts explicitly install component code; document declarations never load it.
|
|
520
520
|
|
|
521
521
|
## 10. Compatibility, name governance, revisions and migration
|
|
522
522
|
|
|
@@ -547,7 +547,7 @@ Editorial changes do not raise the protocol revision. Protocol revisions can shi
|
|
|
547
547
|
|
|
548
548
|
### CP-COMPAT-04 Name governance (required)
|
|
549
549
|
|
|
550
|
-
- New names must be lowercase kebab-case, semantically clear, and avoid conflicts with the existing
|
|
550
|
+
- New names must be lowercase kebab-case, semantically clear, and avoid conflicts with the existing 52 names.
|
|
551
551
|
- Do not use HTML names such as `script`, `style`, `div`, `span` or `a`, and do not use `on-*`, `class` or `style` as author attributes.
|
|
552
552
|
- Within `component-protocol-1`, the existing 48 names are reserved for existing semantics; reusing a name is a breaking change.
|
|
553
553
|
- No implicit aliases. An alias needs its own name, documentation and acceptance evidence.
|
|
@@ -586,7 +586,7 @@ Persist only the original `.reactive.md` source and the syntax revision used. `L
|
|
|
586
586
|
|
|
587
587
|
### CP-ACCEPT-02 Machine conformance data (required)
|
|
588
588
|
|
|
589
|
-
The root object of a machine conformance set contains only `protocolVersion`, `syntaxVersion` and a non-empty `cases` array. The frozen author-component set `examples/conformance/component-protocol-1.json` remains `component-protocol-1` / `local-draft-2`. The current portable syntax set is `examples/conformance/local-draft-
|
|
589
|
+
The root object of a machine conformance set contains only `protocolVersion`, `syntaxVersion` and a non-empty `cases` array. The frozen author-component set `examples/conformance/component-protocol-1.json` remains `component-protocol-1` / `local-draft-2`. The current portable syntax set is `examples/conformance/local-draft-4.json`; both are checked for their declared revisions. The package version is identified by `package.json` and is not inferred from these fields.
|
|
590
590
|
|
|
591
591
|
Each case contains at least a unique string `id`, component name `component`, source `source`, boolean `ok` and a deduplicated diagnostic code set `codes`. Optional fields `initial`, `bindingNames`, `actions`, `reset`, `text`, `expectedText`, `htmlIncludes` and `htmlExcludes` follow the [language conformance data notes](../../examples/conformance/README.md) and the JSON Schema shipped with the repository. The full format follows that document and the Schema; this protocol defines only the semantic gates.
|
|
592
592
|
|
|
@@ -601,7 +601,7 @@ The runner must:
|
|
|
601
601
|
|
|
602
602
|
`initial` and `reset.expectedState` use partial matching; `bindingNames` checks the complete public binding name set; `text` and `expectedText` must appear in pairs.
|
|
603
603
|
|
|
604
|
-
The frozen author-component set covers representative `slider`, `tabs` and `plot` cases and at least one complete unknown-tag fallback case. It remains a representative gate, not full certification of the
|
|
604
|
+
The frozen author-component set covers representative `slider`, `tabs` and `plot` cases and at least one complete unknown-tag fallback case. It remains a representative gate, not full certification of the 52 tag names; host components have no portable machine cases.
|
|
605
605
|
|
|
606
606
|
### CP-ACCEPT-03 Component-level evidence (required)
|
|
607
607
|
|
|
@@ -653,11 +653,11 @@ Only SHOULD clauses can be exempted; exemptions must record the rationale, alter
|
|
|
653
653
|
|
|
654
654
|
### CP-IMPL-02 Current coverage (existing / boundary)
|
|
655
655
|
|
|
656
|
-
The current implementation covers parsing, declarations, compilation, runtime, React rendering, resource budgets and release checks. Real keyboard input, IME, 375px layout and timer pause require corresponding automated browser checks or manual checks; general SSR hydration outside the single-file export is unverified. The machine data of `component-protocol-1` is a representative gate, not certification of all
|
|
656
|
+
The current implementation covers parsing, declarations, compilation, runtime, React rendering, resource budgets and release checks. Real keyboard input, IME, 375px layout and timer pause require corresponding automated browser checks or manual checks; general SSR hydration outside the single-file export is unverified. The machine data of `component-protocol-1` is a representative gate, not certification of all 52 tag names.
|
|
657
657
|
|
|
658
658
|
### CP-IMPL-03 Extension interfaces (boundary)
|
|
659
659
|
|
|
660
|
-
Section 14 retains the legacy schema and renderer interfaces. New components use the [extension SDK](../integration/extension-sdk-en.md) manifest, instance configuration and adapters. The SDK protocol, component versions, theme protocol, restoration payload and `local-draft-
|
|
660
|
+
Section 14 retains the legacy schema and renderer interfaces. New components use the [extension SDK](../integration/extension-sdk-en.md) manifest, instance configuration and adapters. The SDK protocol, component versions, theme protocol, restoration payload and `local-draft-4` syntax revision are managed separately.
|
|
661
661
|
|
|
662
662
|
Use `reactive-md/testing` for manifest and binding checks, and `testing/react` and `testing/browser` for rendering and lifecycle evidence. Components must meet this protocol's budget, accessibility and behavior requirements. Hosts install implementations explicitly and control their code permissions; SDK contract and resource validation does not sandbox third-party code.
|
|
663
663
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
在 Markdown 中加入控件,正文、计算结果和图表就会随读者的操作更新。打开[在线 Playground](https://yaozi.raricy.com/),把示例粘贴到编辑器,在预览中直接试用。
|
|
6
6
|
|
|
7
|
-
本文对应当前工作区,语法修订为 `local-draft-
|
|
7
|
+
本文对应当前工作区,语法修订为 `local-draft-4`。每一节先给一份可运行的示例,再解释其中的写法;文末汇总全部组块。
|
|
8
8
|
|
|
9
9
|
## 1. 第一份交互文档
|
|
10
10
|
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
输入控件都需要 `label`。需要读取控件的值时加 `bind`;控件不需要被正文或其他组件读取时,可以省略 `bind`,例如 `<timer label="专注计时" duration="60">` 仍然可以独立使用。
|
|
62
62
|
|
|
63
|
-
参数名由英文字母、数字和下划线组成,以字母或下划线开头,区分大小写。`x`、`y`、`pi`、`e`
|
|
63
|
+
参数名由英文字母、数字和下划线组成,以字母或下划线开头,区分大小写。`x`、`y`、`pi`、`e` 和较早的内置函数名是保留名称。draft-4 的辅助函数名(`number`、`string`、`range`、`join`、`split`、`dateAdd`、`formatDate`、`ifBlank`)和变换名(`filter`、`map`、`sortBy`)也可以作为参数名;`name(` 表示调用函数,裸名称读取参数。中文显示文字放在 `label` 中。
|
|
64
64
|
|
|
65
65
|
多个控件共享参数时,类型必须相同。数字控件的 `min`、`max` 和 `step` 要一致,同一个参数只写一次显式 `initial`。
|
|
66
66
|
|
|
@@ -108,6 +108,28 @@
|
|
|
108
108
|
|
|
109
109
|
数组不能直接写进 `{{ }}` 显示,需要用 `len`、索引或聚合函数转换。数组中只能放同一种类型的值:全部是数字,或全部是字符串。
|
|
110
110
|
|
|
111
|
+
### 筛选、投影与排序数组
|
|
112
|
+
|
|
113
|
+
`filter`、`map` 和 `sortBy` 从现有数组派生新数组。
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
<const name="routes" value="{{ ['滨河绿道', '丘陵环线', '林间土路'] }}">
|
|
117
|
+
<const name="distances" value="{{ [35.5, 48, 26] }}">
|
|
118
|
+
|
|
119
|
+
<computed name="open" value="{{ filter(routes, item != '林间土路') }}">
|
|
120
|
+
<computed name="ranked" value="{{ sortBy(map(distances, round(item * 1.2, 1)), item, 'desc') }}">
|
|
121
|
+
|
|
122
|
+
<select bind="route" label="路线" options="{{ open }}"></select>
|
|
123
|
+
|
|
124
|
+
可选路线 {{ len(open) }} 条,最远距离 {{ ranked[0] }}。
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`filter` 保留条件为真的元素,`map` 用投影替换每个元素,`sortBy` 按键排序,默认升序,写 `'desc'` 改为降序。第二个实参在迭代作用域求值,`item` 是当前元素,`index` 是从零开始的位置;`round` 等其他名字照常读取外层作用域。变换中的条件、投影或键再嵌套变换时,内层有自己的 `item` 和 `index`。
|
|
128
|
+
|
|
129
|
+
源必须是字符串数组或数字数组。条件必须是布尔值;投影或排序键必须是字符串或数字,且所有投影或键同属一类。`filter` 和 `sortBy` 保留源元素类型,`map` 取投影类型。结果可用于任何数组位置:`options`、`rows`、`len`、索引、`join`、聚合和其他变换。正文插值需要标量,先用 `len`、`join` 或索引转换。
|
|
130
|
+
|
|
131
|
+
文档预算为变换设定上限:每个数组最多 10,000 项,一次表达式最多 50,000 次条件、投影或键求值,最多三层嵌套;字符串数组内容(含临时排序键)共享 100,000 个 UTF-16 代码单元。
|
|
132
|
+
|
|
111
133
|
## 4. 计算表达式
|
|
112
134
|
|
|
113
135
|
`{{ }}` 中可以写表达式。这门表达式语言只做本地计算,不执行 JavaScript,也不发起网络请求。
|
|
@@ -129,6 +151,7 @@
|
|
|
129
151
|
| 算术 | `+ - * / %` | `people * 100` |
|
|
130
152
|
| 比较 | `== != < <= > >=` | `people >= 5` |
|
|
131
153
|
| 逻辑 | `! && \|\|` | `people > 0 && people < 10` |
|
|
154
|
+
| 空值合并 | `a ?? b` | `picked ?? '还没有选择'` |
|
|
132
155
|
| 条件 | `条件 ? 成立时的值 : 否则的值` | `annual ? 80 : 100` |
|
|
133
156
|
| 函数 | 数学、字符串、日期和格式化函数 | `round(2.6)`、`len(topics)` |
|
|
134
157
|
|
|
@@ -149,6 +172,20 @@
|
|
|
149
172
|
|
|
150
173
|
`formatCurrency` 的参数依次是数值、货币代码、小数位和地区。`formatNumber`、`formatPercent`、`formatScientific` 的写法类似。
|
|
151
174
|
|
|
175
|
+
转换、文本数组和日期也已内置:
|
|
176
|
+
|
|
177
|
+
```markdown
|
|
178
|
+
解析数字:{{ number('12.5') * 2 }}
|
|
179
|
+
转回文本:{{ string(3) }}
|
|
180
|
+
保留两位:{{ round(1.2345, 2) }}
|
|
181
|
+
月份:{{ join(range(1, 4), '、') }}
|
|
182
|
+
第二段:{{ split('a,b,c', ',')[1] }}
|
|
183
|
+
截止:{{ dateAdd('2026-01-30', 3) }}
|
|
184
|
+
可读日期:{{ formatDate('2026-02-02') }}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`number(text)` 接受十进制或科学计数文本,`string(value)` 把标量转回文本。`join` 拼接字符串或数字数组,`split` 生成字符串数组,`range(start, end)` 生成不含终点的数字数组。`round(value, digits)` 按小数位做数值舍入,`dateAdd` 增加天数或其他支持的时间单位,`formatDate` 使用受支持的地区格式。`ifBlank(text, fallback)` 去除首尾空白后为空时返回 fallback;`??` 只在左侧为 null 时取右侧,`0`、`false` 和空字符串照常保留。
|
|
188
|
+
|
|
152
189
|
除零、类型错误或结果不是有限数字时,对应位置显示“无法计算”,其他内容继续更新。在 Markdown 表格中写逻辑或 `||` 时,要转义为 `\|\|`。
|
|
153
190
|
|
|
154
191
|
## 5. 输入控件
|
|
@@ -190,6 +227,8 @@
|
|
|
190
227
|
|
|
191
228
|
`option` 的 `value` 是公开给表达式的值,标签文字只负责显示。可以用 `initial` 指定默认选项的 `value`。
|
|
192
229
|
|
|
230
|
+
选择器也可以用 `options="{{ 表达式 }}"` 从字符串数组取选项,代替 `<option>` 子项。每个字符串同时作为 value 和标签,两种写法不能混用;第 6 节有示例。
|
|
231
|
+
|
|
193
232
|
`multi-select` 的 `label` 必填,`max-selected` 限制最多选择几项。`checklist` 用 `[ ]` 和 `[x]` 标记初始状态,公开值是已勾选条目的数组。
|
|
194
233
|
|
|
195
234
|
需要区间时用 `range-slider`,需要二维坐标时用 `coordinate`。它们分别用 `bind-start`/`bind-end` 和 `bind-x`/`bind-y` 公开两个数字。
|
|
@@ -215,6 +254,31 @@
|
|
|
215
254
|
|
|
216
255
|
图表会自动更新。需要搜索、排序和分页时,把同样的 Markdown 表格放进 `<table label="目录">...</table>`。
|
|
217
256
|
|
|
257
|
+
### 生成行、格式与选项
|
|
258
|
+
|
|
259
|
+
生成数据来自数组,而不是 Markdown 表格单元格。`data-table` 生成表格,`chart` 加上 `rows` 后也按同样方式生成。两种组件都为每行提供 `item`(当前值)和 `index`(位置)。
|
|
260
|
+
|
|
261
|
+
```markdown
|
|
262
|
+
<const name="months" value="{{ ['一月', '二月', '三月'] }}">
|
|
263
|
+
|
|
264
|
+
<select bind="month" label="关注月份" options="{{ months }}"></select>
|
|
265
|
+
|
|
266
|
+
<data-table label="费用方案" rows="{{ months }}" key="{{ item }}" bind="picked" searchable sortable page-size="2">
|
|
267
|
+
<column label="月份" value="{{ item }}">
|
|
268
|
+
<column label="费用" value="{{ index * 100 + 100 }}" format="currency" currency="CNY" locale="zh-CN" digits="0" align="right">
|
|
269
|
+
<column label="占比" value="{{ (index + 1) / 3 }}" format="percent" summary="average">
|
|
270
|
+
</data-table>
|
|
271
|
+
|
|
272
|
+
<chart kind="bar" title="按月费用" rows="{{ months }}">
|
|
273
|
+
<column label="月份" value="{{ item }}">
|
|
274
|
+
<column label="费用" value="{{ index * 100 + 100 }}" format="currency" currency="CNY" locale="zh-CN" digits="0">
|
|
275
|
+
</chart>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
`data-table` 用 `searchable` 开启搜索、`sortable` 开启排序、`page-size` 开启分页。静态 `empty` 替换数据为空时的默认占位文字;搜索没有匹配行时仍显示“没有匹配结果”。`key` 指定稳定的行值,选中一行会把它写入 `picked`。带 `rows` 的 `chart` 读取 `<column>` 子项,而不是 Markdown 表格。列的 `format` 只改变显示文字,排序、图表取值和计算仍使用原始数字。`align` 为整张表或某一列设置固定对齐(`left`、`center`、`right`),表格默认 `center`;`row-align` 用完整 `{{ }}` 插值按正文行选择对齐,作用域内有 `item` 和 `index`。优先级为列 `align` 高于 `row-align`,`row-align` 高于表格 `align`;选择列单元格始终居中。数值列加 `summary="sum"` 或 `summary="average"` 会在表尾按列格式显示合计或平均值,没有数值单元格时平均值不显示。`options` 用字符串数组填充选择器:每个字符串同时作为 value 和标签,不能与 `<option>` 子项混用;单选组件在列表可用后默认选中第一项。
|
|
279
|
+
|
|
280
|
+
首版格式化生成的列和图表读数;静态 Markdown 表格单元格与图表坐标轴保持原有显示。
|
|
281
|
+
|
|
218
282
|
### 函数曲线
|
|
219
283
|
|
|
220
284
|
绘图使用 LaTeX。每个 `$$...$$` 公式块定义一条曲线,可以是显式 `y = f(x)`、参数方程 `cases` 块,或关于 `x` 和 `y` 的隐式方程。
|
|
@@ -322,21 +386,22 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
322
386
|
|
|
323
387
|
## 8. 高级功能
|
|
324
388
|
|
|
325
|
-
### if 与
|
|
389
|
+
### if 与 else
|
|
326
390
|
|
|
327
391
|
```markdown
|
|
328
392
|
<number bind="people" label="人数" initial="3" min="1" max="30">
|
|
329
393
|
|
|
330
394
|
<if when="{{ people >= 5 }}">
|
|
331
|
-
<alert tone="success" title="团体优惠">
|
|
332
395
|
人数达到 5 人,可以申请团体价格。
|
|
333
|
-
</alert>
|
|
334
396
|
</if>
|
|
397
|
+
<else>
|
|
398
|
+
少于 5 人按标准价格计算。
|
|
399
|
+
</else>
|
|
335
400
|
```
|
|
336
401
|
|
|
337
402
|
`if` 的 `when` 必须是完整的布尔插值,写成 `when="{{ people >= 5 }}"`。条件为真时显示内部内容,为假时隐藏。
|
|
338
403
|
|
|
339
|
-
`
|
|
404
|
+
`else` 是 else 分支,必须紧跟在同一个容器中的 `<if>` 之后;注释和空行可以隔开,其他内容不行。一个 `<if>` 最多配一个 `<else>`,需要更多分支时在分支内部再嵌套 `<if>`。
|
|
340
405
|
|
|
341
406
|
### accordion 与 disclosure
|
|
342
407
|
|
|
@@ -371,6 +436,10 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
371
436
|
|
|
372
437
|
`anchor` 标记一个显式跳转目标,`id` 必填,在文档内唯一。`jump` 也可以指向标题自动生成的锚点,例如 `## 细节` 对应 `to="细节"`;标题重复时会自动加后缀,显式 `anchor` 的名称更容易控制。目标不存在或 ID 重复会产生编译错误。
|
|
373
438
|
|
|
439
|
+
### 用宏复用一组控件
|
|
440
|
+
|
|
441
|
+
在文首写 `<!-- reactive-md: local-draft-4 + macros -->`,用 `<macro name="room" params="title" outputs="count">` 定义一组控件,再用 `<use macro="room" title="西教室" bind-count="west">` 创建实例。每次调用有自己的控件状态。将内部的 `count` 映射到 `west` 后,正文可用 `{{ west }}` 读取它。编辑器可补全宏名、必填参数和输出映射,也可折叠定义区。完整示例见[交互宏语法](../reference/local-interaction-syntax-ch.md#45-交互宏)。
|
|
442
|
+
|
|
374
443
|
## 9. 其它功能
|
|
375
444
|
|
|
376
445
|
### color
|
|
@@ -387,6 +456,12 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
387
456
|
|
|
388
457
|
颜色写静态颜色名或 `#RGB`、`#RRGGBB`。它不接受表达式、CSS 函数或变量。
|
|
389
458
|
|
|
459
|
+
`<text>` 至少填写 `color`、`size`、`font` 中的一项。省略的样式由上下文继承。`size` 接受主题字号 `sm`、`md`、`lg`、`xl` 或以像素为单位的正数,`size="20"` 表示 20px。`font` 接受 `sans`、`serif`、`mono`。
|
|
460
|
+
|
|
461
|
+
```markdown
|
|
462
|
+
<text size="20">报名截止</text> · 工单 <text font="mono">REF-24</text>
|
|
463
|
+
```
|
|
464
|
+
|
|
390
465
|
### badge
|
|
391
466
|
|
|
392
467
|
```markdown
|
|
@@ -407,6 +482,16 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
407
482
|
|
|
408
483
|
`tooltip` 是行内说明,`text` 必填。读者用指针悬停或键盘聚焦时可以看到说明,适合补充一个短语或名称。
|
|
409
484
|
|
|
485
|
+
### alert
|
|
486
|
+
|
|
487
|
+
```markdown
|
|
488
|
+
<alert tone="success" title="团体优惠">
|
|
489
|
+
人数达到 5 人,可以申请团体价格。
|
|
490
|
+
</alert>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
`alert` 是一块提示,`tone` 可取 `info`、`success`、`warning` 或 `error`,默认 `info`;`error` 使用红色危险色调。`title` 可选,正文继续使用 Markdown。
|
|
494
|
+
|
|
410
495
|
## 常见错误
|
|
411
496
|
|
|
412
497
|
| 现象 | 原因与修改 |
|
|
@@ -417,6 +502,7 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
417
502
|
| `if` 条件不生效 | 写成 `when="{{ people >= 5 }}"` 这样的完整布尔插值。 |
|
|
418
503
|
| 图表数值列报错 | 单元格写纯数字或完整插值,单位移到 `y-label` 或表头。 |
|
|
419
504
|
| 数组显示为空白或报错 | 不要直接写 `{{ topics }}`,改用 `len`、索引或 `sum` 等聚合函数。 |
|
|
505
|
+
| 变换报错 | 检查源是否为字符串或数字数组、条件是否为布尔值,以及投影或排序键是否为同类的字符串或数字。 |
|
|
420
506
|
| 容器内容跑到外面 | 检查结束标签和嵌套顺序,容器必须显式闭合。 |
|
|
421
507
|
| 标签或插值显示为原文 | 检查是否写在代码中或被转义;未知标签会产生降级警告。 |
|
|
422
508
|
| 表格中的逻辑或破坏了分列 | 在 Markdown 表格单元格内将竖线转义为 `\|\|`。 |
|
|
@@ -430,7 +516,7 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
430
516
|
|
|
431
517
|
## 组块全集
|
|
432
518
|
|
|
433
|
-
下面按用途列出 `local-draft-
|
|
519
|
+
下面按用途列出 `local-draft-4` 的全部 52 个标签。“形态”一列说明写法:无正文组件不写结束标签,容器必须显式闭合,行内组件可以放进句子,子项只能出现在指定父容器内,声明不渲染为界面。
|
|
434
520
|
|
|
435
521
|
多数交互控件都支持 `label`、可选 `bind`、可选 `initial` 和动态 `disabled`。表中只列出常用的关键属性。
|
|
436
522
|
|
|
@@ -448,10 +534,10 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
448
534
|
| `checkbox` | 无正文 | `label`、`bind`、`initial`、`color` | 勾选框;布尔值,默认 `false` |
|
|
449
535
|
| `date` | 无正文 | `label`、`bind`、`initial`、`min`、`max`、`required`(三者均可动态) | 日期;值为 `YYYY-MM-DD` 或空字符串 |
|
|
450
536
|
| `counter` | 无正文 | `label`、`bind`、`initial`、`min=0`、`max`、`step=1` | 数字加减;自带减、加、恢复 |
|
|
451
|
-
| `select` | 容器 | `label`、`bind`、`initial`、`color`;子项 `option` | 下拉单选;默认第一项 |
|
|
452
|
-
| `choices` | 容器 | `label`、`bind`、`initial`、`color`;子项 `option` | 选项卡片单选 |
|
|
453
|
-
| `radio-group` | 容器 | `label`、`bind`、`initial`、`color`;子项 `option` | 单选按钮组 |
|
|
454
|
-
| `multi-select` | 容器 | `label`、`bind`、`initial`、`max-selected`、`color`;子项 `option` | 多选;值为字符串数组 |
|
|
537
|
+
| `select` | 容器 | `label`、`bind`、`initial`、`options`、`color`;子项 `option` | 下拉单选;默认第一项 |
|
|
538
|
+
| `choices` | 容器 | `label`、`bind`、`initial`、`options`、`color`;子项 `option` | 选项卡片单选 |
|
|
539
|
+
| `radio-group` | 容器 | `label`、`bind`、`initial`、`options`、`color`;子项 `option` | 单选按钮组 |
|
|
540
|
+
| `multi-select` | 容器 | `label`、`bind`、`initial`、`options`、`max-selected`、`color`;子项 `option` | 多选;值为字符串数组 |
|
|
455
541
|
| `option` | 子项 | `value` 必填;正文为显示文字 | 用于 `select`、`choices`、`radio-group`、`multi-select` 和 `quiz` |
|
|
456
542
|
|
|
457
543
|
### 自带操作与进度
|
|
@@ -469,19 +555,22 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
469
555
|
| `panel` | 容器 | `title`、`reset=true` | 控件分组;重置内部状态 |
|
|
470
556
|
| `card` | 容器 | `title` | 内容卡片;正文继续使用 Markdown |
|
|
471
557
|
| `grid` | 容器 | `columns=2`(1–4) | 卡片网格;直接子项必须是 `card` |
|
|
558
|
+
| `gallery` | 容器 | `label` 必填、`item-width=280`(180–480);子项 `gallery-item` | 横向条带,支持吸附、滚轮、键盘与缩略图导航 |
|
|
559
|
+
| `gallery-item` | 子项 | `label` 可选 | 一项 Markdown、图片或卡片内容 |
|
|
472
560
|
| `tabs` | 容器 | `label`、`bind`、`initial`;子项 `tab` | 标签页;默认第一项 |
|
|
473
561
|
| `tab` | 子项 | `label` 必填、`value` 可选 | 标签页子项;省略 `value` 时按顺序生成 |
|
|
474
562
|
| `accordion` | 容器 | `label`;子项 `disclosure` | 折叠条目组 |
|
|
475
563
|
| `disclosure` | 子项 | `label` 必填、`open=false` | 可展开条目;多个可同时打开 |
|
|
476
564
|
| `if` | 容器 | `when` 必填,完整布尔插值 | 条件显示;条件为假时隐藏 |
|
|
565
|
+
| `else` | 容器 | 无 | 否则分支;必须紧跟在同一容器内的 `if` 之后 |
|
|
477
566
|
|
|
478
|
-
###
|
|
567
|
+
### 跳转与文字样式
|
|
479
568
|
|
|
480
569
|
| 标签 | 形态 | 主要属性 | 用途 |
|
|
481
570
|
| --- | --- | --- | --- |
|
|
482
571
|
| `jump` | 行内 | `to` 必填、`appearance=link/button`、`color` | 跳转到标题锚点或显式 `anchor` |
|
|
483
572
|
| `anchor` | 无正文 | `id` 必填且文档内唯一 | 显式跳转目标 |
|
|
484
|
-
| `text` | 行内 | `color`
|
|
573
|
+
| `text` | 行内 | `color`、`size`、`font` 至少填一项 | 行内颜色、字号和字体 |
|
|
485
574
|
| `section` | 容器 | `color` 必填 | 整段文字颜色;内部继续解析 Markdown |
|
|
486
575
|
|
|
487
576
|
### 练习与分步
|
|
@@ -508,25 +597,25 @@ $$ (x^2 + y^2)^2 = 2a^2(x^2 - y^2) $$
|
|
|
508
597
|
| `computed` | 声明 | `name`、`value` 必填 | 顶层计算值;可读控件、常量和其他计算值;不渲染 |
|
|
509
598
|
| `const` | 声明 | `name`、`value` 必填 | 顶层常量;只能读常量和内置常量;不渲染 |
|
|
510
599
|
| `validation` | 声明 | `when`、`message`、`fields` 必填 | 跨字段校验;失败时显示提示 |
|
|
511
|
-
| `data-table` | 容器 | `label`、`rows`、`key`、`max-rows=100`;子项 `column` | 从本地数组生成表格行;行内可用 `item`、`index` |
|
|
512
|
-
| `column` | 子项 | `label`、`value`
|
|
600
|
+
| `data-table` | 容器 | `label`、`rows`、`key`、`searchable=false`、`sortable=false`、`page-size`、`max-rows=100`、`align=center`、`row-align`、`empty`、`bind`、`initial`;子项 `column` | 从本地数组生成表格行;行内可用 `item`、`index`;`row-align` 设置正文行对齐;`empty` 替换数据为空时的默认占位文字 |
|
|
601
|
+
| `column` | 子项 | `label`、`value` 必填;`format=plain`、`digits`、`currency`、`locale`、`summary`、`align` | 生成 `data-table` 或 `chart` 的列;单元格只输出文本;`summary=sum/average/count` 与 `align` 作用于生成表格 |
|
|
513
602
|
|
|
514
603
|
### 可视化
|
|
515
604
|
|
|
516
605
|
| 标签 | 形态 | 主要属性 | 用途 |
|
|
517
606
|
| --- | --- | --- | --- |
|
|
518
607
|
| `table` | 容器 | `label`、`searchable=true`、`sortable=true`、`page-size=10`、`key`、`bind`、`initial` | 增强表格;正文为 Markdown 表格 |
|
|
519
|
-
| `chart` | 容器 | `kind=bar`、`title`、`x`、`y`、`x-label`、`y-label`、`key`、`bind`、`initial` | 图表;正文为 Markdown
|
|
608
|
+
| `chart` | 容器 | `kind=bar`、`title`、`rows`、`max-rows=100`、`x`、`y`、`x-label`、`y-label`、`key`、`bind`、`initial` | 图表;正文为 Markdown 表格,写了 `rows` 时为 `column` 子项 |
|
|
520
609
|
| `plot` | 容器 | `min=-10`、`max=10`、`samples=200`、`label`、`x-label`、`y-label` | 函数曲线;正文为一个或多个 `$$...$$` 公式块 |
|
|
521
610
|
| `timeline` | 容器 | `title`、`unit="分钟"` | 时间轴;正文表格使用 `事项`、`开始`、`时长`,可选 `说明` |
|
|
522
611
|
| `diagram` | 容器 | `label`、`bind`、`initial`、`direction=right/down`;子项 `node`、`edge` | 交互图解 |
|
|
523
612
|
| `node` | 子项 | `id` 必填且唯一、`label` 必填、`tone` 可动态 | 图解节点 |
|
|
524
613
|
| `edge` | 子项 | `from`、`to` 必填、`label` | 图解连线 |
|
|
525
614
|
|
|
526
|
-
以上共
|
|
615
|
+
以上共 52 个标签。`option`、`tab`、`gallery-item`、`disclosure`、`node`、`edge`、`step`、`column` 是结构子项,只能放在对应父容器内,不能单独使用。
|
|
527
616
|
|
|
528
|
-
`table` 和 `chart` 的 `bind`、`initial` 需要同时提供 `key`,用于公开选中行的稳定标识。`plot` 的每个 `$$...$$` 块定义一条显式、参数或隐式曲线,每个 `plot` 最多 16 条曲线。
|
|
617
|
+
`table` 和 `chart` 的 `bind`、`initial` 需要同时提供 `key`,用于公开选中行的稳定标识。`data-table` 必须提供 `key`,`bind` 公开选中行的键。带 `rows` 的 `chart` 用一至多个 `column` 子项代替 Markdown 表格。`plot` 的每个 `$$...$$` 块定义一条显式、参数或隐式曲线,每个 `plot` 最多 16 条曲线。
|
|
529
618
|
|
|
530
|
-
另有 `<theme name="default">`,写在正文之前,用于选择整份文档的主题。它是文档级元数据,不计入
|
|
619
|
+
另有 `<theme name="default">`,写在正文之前,用于选择整份文档的主题。它是文档级元数据,不计入 52 个标签。
|
|
531
620
|
|
|
532
|
-
默认模式还支持 P0 HTML 的 `div`、`span`、`p`、`h1` 至 `h6` 等元素。其中 `div`、`p` 和 `h1` 至 `h6` 接受静态 `align`(`left`、`center`、`right`、`justify`)。这些是 HTML 元素,不计入上面的
|
|
621
|
+
默认模式还支持 P0 HTML 的 `div`、`span`、`p`、`h1` 至 `h6` 等元素。其中 `div`、`p` 和 `h1` 至 `h6` 接受静态 `align`(`left`、`center`、`right`、`justify`)。这些是 HTML 元素,不计入上面的 52 个标签。
|