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,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
**English** · [中文](local-interaction-syntax-ch.md)
|
|
4
4
|
|
|
5
|
-
Syntax identifier: `local-draft-
|
|
5
|
+
Syntax identifier: `local-draft-4`, 2026-11-30. 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, and [Source revisions and migration](../compatibility/source-versioning-en.md) for the optional revision directive and `reactive-md migrate`. Complete examples are in the [example index](../../examples/local/README.md).
|
|
6
6
|
|
|
7
7
|
## 1. Positioning and scope
|
|
8
8
|
|
|
9
|
-
Named values, formatting and date functions, cross-field validation, conditional tones, arrays
|
|
9
|
+
Named values, formatting and date functions, cross-field validation, conditional tones, arrays, bounded table-row generation, generated chart rows, column display formats and dynamic selector options are part of this revision: [5.4 Named values](#54-named-values), [5.5 Formatting, strings and dates](#55-formatting-strings-and-dates), [5.6 Arrays and aggregates](#56-arrays-and-aggregates), [4.4 Cross-field validation](#44-cross-field-validation), [6 Inputs and parameter panels](#6-inputs-and-parameter-panels) for dynamic options, [7.2 Conditional tones](#72-conditional-tones), [9.3 Charts](#93-charts) and [9.5 Generated tables](#95-generated-tables).
|
|
10
|
+
|
|
11
|
+
`local-draft-4` adds sibling `<else>` branches, keyed Markdown datasets, conversion, collection, rounding and date helpers, and the bounded array transforms `filter`, `map` and `sortBy`. Sources that explicitly declared `local-draft-3` must migrate before this engine accepts them; the new helper and transform names may still be used as binding and declaration names.
|
|
10
12
|
|
|
11
13
|
See [Diagnostics and counting rules](diagnostics-counting-en.md) for source positions, text lengths and resource units. String `len()` and text-control length constraints count Unicode code points.
|
|
12
14
|
|
|
@@ -14,9 +16,9 @@ Reactive MD is for local interactive documents: authors write Markdown and place
|
|
|
14
16
|
|
|
15
17
|
The base language requires only two connection rules: `bind` names an input, and `{{ expression }}` reads it elsewhere. Components handle their own selection, expansion, search, sorting, timing and reset.
|
|
16
18
|
|
|
17
|
-
This revision 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 this 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
|
|
19
|
+
This revision 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 this 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`; charts accept the same generated rows through `<column>` children.
|
|
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-4 -->` 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
|
|
|
@@ -87,13 +89,14 @@ Regular attribute values are enclosed in single or double quotes; boolean attrib
|
|
|
87
89
|
| `min="{{ departure }}"` | Dynamic date bound (`date`) |
|
|
88
90
|
| `required="{{ business }}"` | Dynamic required (`input`, `textarea`, `date`) |
|
|
89
91
|
| `label="Current people: {{ people }}"` | Text interpolation |
|
|
92
|
+
| `options="{{ plans }}"` | Dynamic string-array option list (`select`, `choices`, `radio-group`, `multi-select`) |
|
|
90
93
|
| `bind="people"` | Static variable name |
|
|
91
94
|
|
|
92
95
|
Omitted boolean attributes use the component default rather than always assuming false; for example `panel.reset` defaults to true.
|
|
93
96
|
|
|
94
97
|
`"`, `'`, `&`, `<` 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.
|
|
95
98
|
|
|
96
|
-
`bind`, `initial`, `name`, `id`, `value` (option identifier), `to`, `from`, `answer`, `kind`, field mappings and
|
|
99
|
+
`bind`, `initial`, `name`, `id`, `value` (option identifier), `to`, `from`, `answer`, `kind`, field mappings, column formatting and generated-table alignment 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. `options` on `select`, `choices`, `radio-group` and `multi-select` is dynamic: one complete interpolation that evaluates to a string array. `data-table`'s `row-align` is dynamic: one complete interpolation, evaluated per body row with `item` and `index`, that produces `left`, `center` or `right`. `column` formatting attributes `format`, `digits`, `currency` and `locale` are static. `step`, length limits, static option children 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 and `chart.rows` is optional; do not confuse them.
|
|
97
100
|
|
|
98
101
|
Dynamic constraints are checked when a value is written and when the control is displayed. Writes use the constraints in effect at that moment and still commit atomically. 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, reset or snapped to a nearby legal value. Reducing the field to satisfy the new range, or restoring the dependency, clears the error. Dynamic `required` switching to true while the field is empty shows a hint and does not fill the field. A dynamic bound that cannot be evaluated, a dynamic `min` greater than `max`, or an invalid dynamic date bound rejects the related write and leaves state and revision unchanged. `runtime.validate()` keeps its cross-field meaning; dynamic constraint failures are enforced on writes and displayed on the field. Shared bindings must declare the same static range and step and, when a bound is dynamic, the same expression. `step` and text-length limits remain static.
|
|
99
102
|
|
|
@@ -117,7 +120,7 @@ The parser identifies code, math regions and tag boundaries first, then interpre
|
|
|
117
120
|
|
|
118
121
|
### 4.1 Naming and types
|
|
119
122
|
|
|
120
|
-
`bind` uses `[A-Za-z_][A-Za-z0-9_]*` and is case-sensitive. Variable types are determined by the component, not guessed from text content. `x`, `y`, `pi`, `e`, `true`, `false`, `null` and
|
|
123
|
+
`bind` uses `[A-Za-z_][A-Za-z0-9_]*` and is case-sensitive. Variable types are determined by the component, not guessed from text content. `x`, `y`, `pi`, `e`, `true`, `false`, `null` and the pre-draft-4 expression function names are reserved. The draft-4 helpers `number`, `string`, `range`, `join`, `split`, `dateAdd`, `formatDate` and `ifBlank`, and the transforms `filter`, `map` and `sortBy`, may also be bindings or declarations; a following `(` selects the call form.
|
|
121
124
|
|
|
122
125
|
| Component | Public value | Default initial value |
|
|
123
126
|
| --- | --- | --- |
|
|
@@ -132,13 +135,14 @@ The parser identifies code, math regions and tag boundaries first, then interpre
|
|
|
132
135
|
| range-slider | Two numbers, `start` / `end` slots | start=min; end=the largest valid step not exceeding max |
|
|
133
136
|
| coordinate | Two numbers, `x` / `y` slots | The valid step value on each axis closest to 0 |
|
|
134
137
|
| table, chart with `key` | Stable row key string | Empty string (unselected) |
|
|
138
|
+
| data-table | Stable row key string | Empty string (unselected) |
|
|
135
139
|
| tabs | Page string | value of the first tab |
|
|
136
140
|
| steps | Step string | value of the first step |
|
|
137
141
|
| diagram | Node ID string | id of the first node |
|
|
138
142
|
| checklist | String array of selected item IDs | Determined by the task list check marks |
|
|
139
143
|
| timer | Remaining seconds | duration, default 60 |
|
|
140
144
|
|
|
141
|
-
Scalar components use `initial` to override the default. `range-slider` and `coordinate` use `initial-start`/`initial-end` and `initial-x`/`initial-y` for their slots; `multi-select` accepts a comma-separated `initial` list of static option values. `timer` uses `duration` and `checklist` uses the check marks in its body; neither accepts `initial`. A `table` or `chart` selection accepts `initial` only together with `key
|
|
145
|
+
Scalar components use `initial` to override the default. `range-slider` and `coordinate` use `initial-start`/`initial-end` and `initial-x`/`initial-y` for their slots; `multi-select` accepts a comma-separated `initial` list of static option values. `timer` uses `duration` and `checklist` uses the check marks in its body; neither accepts `initial`. A `table` or `chart` selection accepts `initial` only together with `key`; `data-table` requires `key`, so its `initial` applies directly. A single-choice selector (`select`, `choices`, `radio-group`) that reads dynamic `options` has no compile-time option list: without an explicit `initial`, its public value starts as an empty string and moves to the first option once a nonempty list is available. Dates use real, valid `YYYY-MM-DD`; an empty string means not yet selected.
|
|
142
146
|
|
|
143
147
|
`bind` may be omitted. Unnamed components have independent internal state and do not derive a variable name from the tag. A control's `label` is required and may use dynamic text; it is also the control's accessible name.
|
|
144
148
|
|
|
@@ -146,7 +150,7 @@ Scalar components use `initial` to override the default. `range-slider` and `coo
|
|
|
146
150
|
|
|
147
151
|
The compiler collects bindings across the whole document before rendering, including bindings in conditional regions. Prose can reference parameters that appear later. Declarations and initial values do not change with condition truth, mount count or scroll position.
|
|
148
152
|
|
|
149
|
-
Number, text or boolean inputs of the same kind may bind the same variable and stay in sync; types must match, and numeric ranges and steps must be identical. When `select/choices/radio-group` share a variable, the value set and order must also be identical. Label text may differ.
|
|
153
|
+
Number, text or boolean inputs of the same kind may bind the same variable and stay in sync; types must match, and numeric ranges and steps must be identical. When `select/choices/radio-group` share a variable, the value set and order must also be identical; components using dynamic `options` share a binding only with the same expression. Label text may differ.
|
|
150
154
|
|
|
151
155
|
A variable may have at most one explicit `initial`. Without an explicit initial value, the default of the first control in the source is used, and all associated constraints are validated. Later controls omitting `initial` share the existing initial value. The public state of `timer/checklist/tabs/diagram/multi-select/steps` is owned by exactly one component and does not accept a second same-name owner or writes from other controls. Each numeric slot of `range-slider` and `coordinate` is exclusive too. A `table` and a `chart` may share a selection binding only when their ordered `key` sets are identical.
|
|
152
156
|
|
|
@@ -180,6 +184,31 @@ The renderer displays failed-rule hints and associates them with the correspondi
|
|
|
180
184
|
|
|
181
185
|
`LocalDocument.validations` contains serializable `LocalValidation` metadata. Hosts can call `runtime.validate()` at any time without changing state, and the compiled document remains transferable to a Worker with `structuredClone`.
|
|
182
186
|
|
|
187
|
+
### 4.5 Interaction macros
|
|
188
|
+
|
|
189
|
+
Enable macro syntax in the source prologue with `<!-- reactive-md: local-draft-4 + macros -->`. Write definitions at document level. Calls can appear before their definitions.
|
|
190
|
+
|
|
191
|
+
```markdown
|
|
192
|
+
<!-- reactive-md: local-draft-4 + macros -->
|
|
193
|
+
|
|
194
|
+
<use macro="count-card" title="West room" start="{{ 2 }}" bind-count="west">
|
|
195
|
+
<use macro="count-card" title="East room" start="{{ 1 }}">
|
|
196
|
+
|
|
197
|
+
<macro name="count-card" params="title, start" outputs="count">
|
|
198
|
+
<panel title="{{ title }}">
|
|
199
|
+
<number bind="count" label="Seats" initial="{{ start }}" min="0">
|
|
200
|
+
</panel>
|
|
201
|
+
</macro>
|
|
202
|
+
|
|
203
|
+
West room has **{{ west }}** reserved seats.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Each required parameter receives plain string text or one complete expression. Pass a literal of the appropriate type for static attributes such as `initial`. Macro expressions can read their own parameters, local bindings and declarations, and built-in expression functions. A nested call reads its arguments in the parent scope. Table columns can read both their own `item` and `index` and parameters resolved at the call site.
|
|
207
|
+
|
|
208
|
+
Each instance owns its bindings. An output listed in `outputs` can be shared with the caller through `bind-<output>`. Mapped controls use the existing shared binding constraints. Panel Reset restores the bindings in its subtree and updates other controls sharing those bindings.
|
|
209
|
+
|
|
210
|
+
A document can define 50 macros, declare up to 20 parameters and 20 outputs per macro, and expand up to 200 instances across eight nesting levels. The ordinary budgets for expanded nodes, controls, expressions and generated cells also apply. Macro diagnostics can carry related definition and call ranges.
|
|
211
|
+
|
|
183
212
|
## 5. Text interpolation and expressions
|
|
184
213
|
|
|
185
214
|
```markdown
|
|
@@ -199,20 +228,26 @@ Interpolation can appear in paragraphs, headings, emphasis, lists, plain table c
|
|
|
199
228
|
| Arithmetic | `+ - * / %`, unary plus/minus, parentheses |
|
|
200
229
|
| Comparison | `== != < <= > >=` |
|
|
201
230
|
| Logic | `!`, `&&`, `\|\|` |
|
|
231
|
+
| Nullish coalescing | `a ?? b`; the right side is used only when the left side is null |
|
|
202
232
|
| Conditional | `condition ? trueValue : falseValue` |
|
|
203
|
-
|
|
|
233
|
+
| Conversion | number, string |
|
|
234
|
+
| Math functions | abs, sqrt, floor, ceil, round (optional digits), min, max, pow, sin, cos, tan, asin, acos, atan, exp, log |
|
|
204
235
|
| Common functions | len, contains, clamp |
|
|
205
236
|
| Formatting | formatNumber, formatPercent, formatScientific, formatCurrency |
|
|
206
|
-
| Strings | trim, lower, upper, startsWith, endsWith, replace, slice |
|
|
207
|
-
|
|
|
208
|
-
|
|
|
237
|
+
| Strings | trim, lower, upper, startsWith, endsWith, replace, slice, ifBlank |
|
|
238
|
+
| Arrays | join, split, range, filter, map, sortBy, sum, average, minOf, maxOf |
|
|
239
|
+
| Dates | dateCompare, dateDiff, dateAdd, formatDate |
|
|
209
240
|
| Constants | pi, e |
|
|
210
241
|
|
|
211
|
-
Precedence runs from function calls/parentheses, unary operators, multiplication/division/remainder, addition/subtraction, relational comparison, equality comparison, logical AND, logical OR, to conditional expressions; conditional expressions are right-associative and other binary operators are left-associative. Logic and conditional expressions short-circuit.
|
|
242
|
+
Precedence runs from function calls/parentheses, unary operators, multiplication/division/remainder, addition/subtraction, relational comparison, equality comparison, logical AND, logical OR, nullish coalescing, to conditional expressions; conditional expressions are right-associative, and other binary operators, including nullish coalescing, are left-associative. Nullish coalescing takes its right side only when the left side is null; `0`, `false` and the empty string pass through. Logic, nullish coalescing and conditional expressions short-circuit.
|
|
212
243
|
|
|
213
244
|
`+` accepts two numbers or two strings. Comparisons do not implicitly convert between strings and numbers; relational comparison accepts only two numbers or two strings; logical operations and if conditions must be booleans. Expression string escapes use `\\`, `\'`, `\"`, `\n`, `\t`.
|
|
214
245
|
|
|
215
|
-
|
|
246
|
+
`??` is nullish coalescing: when the left side is not null it returns that value and the right side is not evaluated. For example, `{{ pickedTopic ?? 'No topic selected yet' }}` supplies a prompt until a topic is chosen. A failing left side keeps the [5.2](#52-calculation-errors) display rules and shows "Unable to compute"; evaluation does not fall through to the right side. `??` mixes with `||` and `&&` without parentheses, and precedence decides the grouping; logical operators require booleans, so a mixed expression has one reading.
|
|
247
|
+
|
|
248
|
+
min/max accept one or more numbers; pow takes a base and an exponent; clamp takes a value, lower bound and upper bound. Other math functions take one number, trigonometric functions use radians, and log is the natural logarithm. round rounds half values toward positive infinity; its optional second argument selects 0–20 decimal places with the same tie rule. len computes the number of Unicode code points in a string or the length of an array; contains checks a substring or array membership.
|
|
249
|
+
|
|
250
|
+
`number(text)` parses trimmed decimal or scientific text; empty text, grouping separators, hexadecimal, Infinity and NaN are domain errors. `string(value)` converts a string, number, boolean or null to text; null becomes an empty string, and arrays are rejected. `join(array, separator?)` joins a string or numeric array and defaults to a comma; `split(text, separator)` splits by a literal separator, and an empty separator splits into Unicode code points. `range(start, end, step?)` returns a start-inclusive, end-exclusive numeric array; step defaults to 1 and may be negative. Ranges are limited to 10,000 items, and all results keep the existing string and array budgets. `filter(values, condition)`, `map(values, projection)` and `sortBy(values, key, direction?)` derive new arrays; see [5.6](#56-arrays-and-aggregates). `dateAdd` and `formatDate` are described with the other date helpers in [5.5](#55-formatting-strings-and-dates).
|
|
216
251
|
|
|
217
252
|
Multiplication in prose expressions must be written `*`; use `pow` for exponents. LaTeX math regions follow their own mathematical writing rules. Expressions have no assignment, method calls, property access, custom functions or imports, and do not provide legacy runtime contexts such as `event` or `resources`.
|
|
218
253
|
|
|
@@ -268,13 +303,13 @@ Use a named value anywhere an expression is accepted: prose, dynamic attributes,
|
|
|
268
303
|
|
|
269
304
|
Each runtime owns its calculation cache. Computations are reused within a revision and refreshed after a successful control edit, atomic multi-slot edit or panel reset. Constants are evaluated at compilation and copied into each runtime. Hiding a section keeps its inputs and calculations; reset follows the existing control subtree rules.
|
|
270
305
|
|
|
271
|
-
A failed calculation propagates its expression error when a consumer reads it. The runtime never substitutes zero, null or a previous successful value. Independent consumers continue to work, and a valid input edit lets failed consumers recover. Runtime logical and conditional operators keep their short-circuit behavior, so an unvisited branch does not read its failed value. A constant with an invalid static value is a compile error.
|
|
306
|
+
A failed calculation propagates its expression error when a consumer reads it. The runtime never substitutes zero, null or a previous successful value. Independent consumers continue to work, and a valid input edit lets failed consumers recover. Runtime logical and conditional operators and `??` keep their short-circuit behavior, so an unvisited branch does not read its failed value. A constant with an invalid static value is a compile error.
|
|
272
307
|
|
|
273
308
|
`document.bindings` and `document.initialState` describe writable controls. `document.computations` contains serializable declaration metadata, and `document.externals` contains the read-only external declarations. `runtime.snapshot().state` also contains successful named results for the current revision; failed results are absent. Use `runtime.evaluate(name)` to read a result with its error semantics. Declarations cannot be changed through `set` or `setMany`. Returned arrays remain protected from external mutation.
|
|
274
309
|
|
|
275
310
|
Declaration diagnostics use `local.computation.*`: `placement`, `name`, `reserved`, `duplicate`, `value`, `unknown`, `cycle`, `const`, `expression` and `budget`. Expression type errors keep the existing `local.expression.*` codes, and diagnostics include source ranges, lines and columns. The graph uses an iterative dependency order, so long chains do not require recursive evaluation. Existing source, syntax-node, expression and value budgets still apply, and cycle reports are capped by the diagnostic budget.
|
|
276
311
|
|
|
277
|
-
|
|
312
|
+
The older expression function names are reserved identifiers. A binding or declaration cannot use `sum`, `formatNumber`, `dateDiff` or any other pre-draft-4 function listed in [5.1](#51-expression-set); the compiler reports the conflict with a reserved-name diagnostic. The draft-4 helpers `number`, `string`, `range`, `join`, `split`, `dateAdd`, `formatDate` and `ifBlank`, and the transforms `filter`, `map` and `sortBy`, are not reserved: a name followed by `(` is a function call, and a bare name is a variable reference.
|
|
278
313
|
|
|
279
314
|
### 5.5 Formatting, strings and dates
|
|
280
315
|
|
|
@@ -289,13 +324,14 @@ All four formatting functions return strings; optional arguments are positional.
|
|
|
289
324
|
|
|
290
325
|
`digits` is an integer from 0 to 20 and fixes both minimum and maximum fraction digits, including for currencies such as JPY. `grouping` is a boolean. Supported locales are exactly `en-US`, `zh-CN`, `de-DE`, `fr-FR` and `ja-JP`; omission uses `en-US` regardless of the renderer's UI language or device settings, and an unsupported locale is an error. Currency codes are three uppercase ASCII letters accepted by `Intl.NumberFormat`; the check is syntactic and does not consult a registry of circulating currencies.
|
|
291
326
|
|
|
292
|
-
Formatting uses decimal `halfExpand` rounding: ties round away from zero, so `formatNumber(1.005)` gives `"1.01"` and `formatNumber(-1.005)` gives `"-1.01"`. Zero displays without a negative sign. Arithmetic still uses finite JavaScript numbers; `round(x)`
|
|
327
|
+
Formatting uses decimal `halfExpand` rounding: ties round away from zero, so `formatNumber(1.005)` gives `"1.01"` and `formatNumber(-1.005)` gives `"-1.01"`. Zero displays without a negative sign. Arithmetic still uses finite JavaScript numbers; `round(x)` and `round(x, digits)` keep the `Math.round` tie rule toward positive infinity. Like other arithmetic, numeric rounding operates on binary floating-point values; use the formatting functions when decimal display rounding is required. Formatting changes presentation, not the source number.
|
|
293
328
|
|
|
294
329
|
A null value formats as an empty string. Other argument types remain strict, and strings are not converted into numbers, so guard optional dates or text explicitly before applying their functions. Locale-specific punctuation, currency symbols and spacing follow the host's `Intl` data; hosts that need byte-identical text across platforms pin their runtime and locale data.
|
|
295
330
|
|
|
296
331
|
| String function | Behavior |
|
|
297
332
|
| --- | --- |
|
|
298
333
|
| `trim(text)` | Remove leading and trailing JavaScript Unicode whitespace |
|
|
334
|
+
| `ifBlank(text, fallback)` | Trim leading and trailing whitespace; return the fallback verbatim when the result is empty, otherwise return the trimmed text; both arguments must be strings, and null is a type error |
|
|
299
335
|
| `lower(text)`, `upper(text)` | Default Unicode case conversion, independent of locale |
|
|
300
336
|
| `startsWith(text, search)`, `endsWith(text, search)` | Case-sensitive literal checks; empty search matches |
|
|
301
337
|
| `replace(text, search, replacement)` | Replace every non-overlapping literal match; empty search is an error; replacement text such as `$&` stays literal |
|
|
@@ -307,6 +343,13 @@ These functions require strings, including when the value is null. No regular ex
|
|
|
307
343
|
|
|
308
344
|
Both arguments must be valid `YYYY-MM-DD` strings in years `0001` through `9999`, matching date controls. The calendar is Gregorian and leap days are validated. Each date means midnight UTC, so device timezone and daylight saving changes do not change the result: `dateDiff("2026-03-09", "2026-03-08", "hours")` is `24`. Timestamps, timezone suffixes and ambiguous regional date strings are rejected.
|
|
309
345
|
|
|
346
|
+
`dateAdd(date, amount, unit)` adds a signed finite amount in the same units and returns the resulting UTC calendar date. The default unit is `"days"`, and the result must stay within years `0001`–`9999`; fractional amounts use the UTC instant and then take its calendar date. `formatDate(date, locale)` returns medium-style date text in UTC. Its locale defaults to `"en-US"` and must be one of the supported formatting locales. Neither function accepts an empty or invalid date.
|
|
347
|
+
|
|
348
|
+
```markdown
|
|
349
|
+
<computed name="due" value="{{ dateAdd(startDate, 90) }}">
|
|
350
|
+
Due date: {{ formatDate(due) }}.
|
|
351
|
+
```
|
|
352
|
+
|
|
310
353
|
An empty date control contains `""`, which is an absent date rather than epoch zero. Empty or invalid dates produce a domain error, and null produces a type error. Guard optional dates explicitly:
|
|
311
354
|
|
|
312
355
|
```markdown
|
|
@@ -323,20 +366,84 @@ Days: {{ days == null ? 'Choose both dates' : formatNumber(days, 0) }}
|
|
|
323
366
|
First fee: {{ fees[0] }}. Total: {{ sum(fees) }}.
|
|
324
367
|
```
|
|
325
368
|
|
|
326
|
-
Array literals contain only strings or only finite numbers. Expressions inside a literal can read the document's named values. Nested arrays, mixed element types, booleans and null elements are rejected. `[]` is an empty numeric array by default; a direct empty literal in a conditional branch
|
|
369
|
+
Array literals contain only strings or only finite numbers. Expressions inside a literal can read the document's named values. Nested arrays, mixed element types, booleans and null elements are rejected. `[]` is an empty numeric array by default; a direct empty literal in a conditional branch or in a `??` operand adopts the other side's string-array kind, so `show ? subjects : []` and `subjects ?? []` work for string selections. Checklist and multi-select values remain string arrays. The public type `LocalValue` gains `number[]`, and `LocalValueKind` gains `number-array`; the existing `array` kind continues to mean a string array.
|
|
327
370
|
|
|
328
|
-
Indexing is zero based: `values[0]` reads the first element. The index must be a finite safe integer. An integer outside the collection, including a negative index, returns null; a non-integer index is an error. Indexing a string or a scalar is a type error. Arrays cannot be interpolated as text; use an index, `len`, an aggregate or a data table.
|
|
371
|
+
Indexing is zero based: `values[0]` reads the first element. The index must be a finite safe integer. An integer outside the collection, including a negative index, returns null; a non-integer index is an error. An out-of-range index therefore yields null, and `{{ values[0] ?? 'default' }}` supplies a fallback. Indexing a string or a scalar is a type error. Arrays cannot be interpolated as text; use an index, `len`, an aggregate or a data table.
|
|
329
372
|
|
|
330
373
|
`len` counts both kinds of array. `contains` accepts a string member for a string array, a number for a numeric array, and a substring for a string. Every array is bounded by 10,000 elements; array literals also consume the existing expression-length, AST-node and evaluation budgets. The total contents of a string array keep the existing character budget. Returned runtime arrays are copied, and snapshot arrays are frozen.
|
|
331
374
|
|
|
375
|
+
`range(start, end, step)` returns a start-inclusive, end-exclusive numeric array; `step` defaults to `1` and may be negative. Comparisons use the represented JavaScript numbers. A step of zero or a step too small to advance at the current magnitude is an error, a step pointing away from the end returns an empty array, and results beyond 10,000 items are an error. `join(values, separator)` accepts a string or numeric array and returns a string; the separator defaults to a comma, and numeric members use plain JavaScript number text rather than locale formatting. `split(text, separator)` returns a string array split by a literal separator; an empty separator splits into Unicode code points. `split` and `range` share the 10,000-item array limit, and `join` keeps the 100,000-character string limit.
|
|
376
|
+
|
|
332
377
|
| Function | Result |
|
|
333
378
|
| --- | --- |
|
|
379
|
+
| `range(start, end, step)` | Start-inclusive, end-exclusive numeric array; step defaults to 1 |
|
|
380
|
+
| `join(values, separator)` | String from a string or numeric array; separator defaults to a comma |
|
|
381
|
+
| `split(text, separator)` | String array split by a literal separator, or by code points for an empty separator |
|
|
334
382
|
| `sum(values)` | Sum of a numeric array; empty input gives `0` |
|
|
335
383
|
| `average(values)` | Arithmetic mean; empty input gives null |
|
|
336
384
|
| `minOf(values)` | Smallest numeric member; empty input gives null |
|
|
337
385
|
| `maxOf(values)` | Largest numeric member; empty input gives null |
|
|
338
386
|
|
|
339
|
-
Aggregates accept numeric arrays, with no conversion of numeric-looking strings. Results use finite JavaScript numbers; an overflow in the sum or result is an expression error. `average` divides the sum by the count, so an overflowing intermediate sum is also an error. Null from an empty aggregate follows the existing nullable-expression rules, so guard it before numeric operations when needed. Scalar `min
|
|
387
|
+
Aggregates accept numeric arrays, with no conversion of numeric-looking strings. Results use finite JavaScript numbers; an overflow in the sum or result is an expression error. `average` divides the sum by the count, so an overflowing intermediate sum is also an error. Null from an empty aggregate follows the existing nullable-expression rules, so guard it before numeric operations when needed. Scalar `min` and `max` keep their existing signatures and behavior.
|
|
388
|
+
|
|
389
|
+
Three transforms derive a new array from an existing one:
|
|
390
|
+
|
|
391
|
+
| Function | Result |
|
|
392
|
+
| --- | --- |
|
|
393
|
+
| `filter(values, condition)` | Items whose boolean condition is true, in source order |
|
|
394
|
+
| `map(values, projection)` | One string or finite number per source item, in source order |
|
|
395
|
+
| `sortBy(values, key)` | Stable ascending order by key |
|
|
396
|
+
| `sortBy(values, key, 'desc')` | Stable descending order by key |
|
|
397
|
+
|
|
398
|
+
The source expression is evaluated once in the scope of the call. The second argument is evaluated in an iteration scope where `item` is the current source element and `index` is its zero-based source position; other names resolve in the enclosing scope. Nested transforms bind their own `item` and `index` inside their condition, projection or key, while their source expression still reads the outer iteration scope. Dependency collection records only free references, so `item` and `index` never become document dependencies.
|
|
399
|
+
|
|
400
|
+
The source must be a homogeneous string array or finite-number array. A filter condition must be boolean; a projection or sort key must be a string or a finite number, `map` results must stay one kind, and all sort keys must be one kind. The direction is the string literal `'asc'` or `'desc'` and defaults to `'asc'`. `filter` and `sortBy` keep the element type of the source even when the result is empty; `map` infers its result from the projection. A bare `[]` stays a numeric array. The compiler checks the condition, projection and key against empty sources too. When static information is insufficient, the result is checked during evaluation.
|
|
401
|
+
|
|
402
|
+
Each transform returns a new frozen array. An empty source returns an empty result without evaluating the condition, projection or key. `sortBy` evaluates every key once in source order and then sorts: strings compare by Unicode code point, numbers numerically, and items with equal keys keep their source order in both directions. A failing condition, projection or key fails the whole call. A failing `rows` source clears the table rows and shows an error; a failing cell shows the cell error. Server and client rendering use the same evaluation rules.
|
|
403
|
+
|
|
404
|
+
Transform results are arrays and feed every existing array position: `len`, indexing, `join`, `contains`, numeric aggregates, further transforms, `rows` and string-array `options`. Text interpolation still requires a scalar or an explicit conversion such as `join`.
|
|
405
|
+
|
|
406
|
+
| Limit | Value | Scope |
|
|
407
|
+
| --- | --- | --- |
|
|
408
|
+
| Elements per array | 10,000 | Each source and result array |
|
|
409
|
+
| String-array content | 100,000 UTF-16 code units | Each array; temporary `sortBy` keys share this limit |
|
|
410
|
+
| Transform iterations | 50,000 | All transforms in one expression |
|
|
411
|
+
| Transform nesting | 3 levels | Transform calls that enclose one position |
|
|
412
|
+
| Transform work | 1,000,000 units | All transforms in one expression |
|
|
413
|
+
| Stage work | 5,000,000 units | Each compilation evaluation, runtime transaction, server document render, or independent table or chart build |
|
|
414
|
+
|
|
415
|
+
Work units count AST visits, array elements read or created, and string code units read or created. `MAX_EVAL_STEPS` continues to limit AST visits per outer expression and per condition, projection or key evaluation.
|
|
416
|
+
|
|
417
|
+
| Diagnostic | Trigger |
|
|
418
|
+
| --- | --- |
|
|
419
|
+
| `local.transform.source` | The source argument is not a string or numeric array |
|
|
420
|
+
| `local.transform.predicate` | A filter condition does not produce a boolean |
|
|
421
|
+
| `local.transform.projection` | A projection result is invalid or mixes strings and numbers |
|
|
422
|
+
| `local.transform.key` | A sort key is invalid or mixes strings and numbers |
|
|
423
|
+
| `local.transform.order` | The direction is not the literal `'asc'` or `'desc'` |
|
|
424
|
+
| `local.transform.depth` | Transforms nest deeper than three levels |
|
|
425
|
+
| `local.budget.transform` | Iterations, work or temporary sort keys exceed a limit |
|
|
426
|
+
|
|
427
|
+
Compile-time errors point at the original argument. Runtime errors keep the call and argument source and are shown by the failing computed value, interpolation, row source or cell. See [Diagnostics and counting rules](diagnostics-counting-en.md) for the units and the remaining budgets.
|
|
428
|
+
|
|
429
|
+
### 5.7 Named datasets
|
|
430
|
+
|
|
431
|
+
Declare a read-only Markdown table at the document top level with `<dataset>`. Set its `name` and `key` column so prose, named values, and generated columns can share the same data. The declaration is hidden.
|
|
432
|
+
|
|
433
|
+
```markdown
|
|
434
|
+
<dataset name="stations" key="id">
|
|
435
|
+
| id | Station | Lead |
|
|
436
|
+
| --- | --- | --- |
|
|
437
|
+
| bikes | Bikes | Sam |
|
|
438
|
+
| electronics | Electronics | Iris |
|
|
439
|
+
</dataset>
|
|
440
|
+
|
|
441
|
+
Lead: {{ lookup(stations, 'bikes', 'Lead') }}.
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Header names and row keys must be nonempty and unique within their respective groups. Cells contain static text and are read as trimmed plain text.
|
|
445
|
+
|
|
446
|
+
In `lookup(dataset, rowKey, columnName)`, the first argument is a dataset name and the other two are string expressions. A missing row or column returns `null`. An existing empty cell returns an empty string. Dataset names support forward references and have their own namespace. Datasets use the expression array and character budgets.
|
|
340
447
|
|
|
341
448
|
## 6. Inputs and parameter panels
|
|
342
449
|
|
|
@@ -353,13 +460,13 @@ All input components support `label`, optional `bind`, optional scalar `initial`
|
|
|
353
460
|
| counter | min=0; optional max; step=1 |
|
|
354
461
|
| toggle, checkbox | Optional color |
|
|
355
462
|
| date | optional min/max dates (dynamic); required=false (dynamic) |
|
|
356
|
-
| select, choices, radio-group, multi-select | Body is one or more options; multi-select adds max-selected and uses a string-array value |
|
|
463
|
+
| select, choices, radio-group, multi-select | Body is one or more options or one dynamic `options` expression; multi-select adds max-selected and uses a string-array value |
|
|
357
464
|
|
|
358
465
|
`range-slider` and `coordinate` are leaves with required `label`, optional `color` and dynamic `disabled`. Bounds and the positive step are static finite numbers. `range-slider` defaults to 0/100/1, with start=min and end=the largest valid step not exceeding max. Crossing is rejected rather than swapping endpoints. `coordinate` defaults to -5…5 on both axes, step 1, and the nearest legal zero per axis. It supports pointer dragging, keyboard control and numeric alternatives.
|
|
359
466
|
|
|
360
467
|
Each optional `bind-start`/`bind-end` or `bind-x`/`bind-y` names one exclusive numeric slot; an omitted name keeps that slot internal. `x` and `y` remain reserved parameter names. Slots initialize at compile time and reset atomically. Host APIs extend to `runtime.get(node, slot?)`, `runtime.set(node, value, slot?)` and `runtime.setMany(node, values)`. Slots are start/end for ranges and x/y for coordinates. Every write validates canonical registered slots; an invalid batch preserves the entire snapshot and revision, and existing one-value calls remain valid.
|
|
361
468
|
|
|
362
|
-
`multi-select` requires a `label` and
|
|
469
|
+
`multi-select` requires a `label` and either option children or a dynamic `options` expression; `bind` is optional. Its exclusive string-array binding defaults to empty. `initial` is a comma-separated list of static values; values are nonempty, unique and comma-free. `max-selected` is a nonnegative integer, defaulting to the option count. Writes normalize to source order and obey the existing array budgets. Search and Clear are built in, and selected items remain removable at the limit. `disabled` may be dynamic; reset clears local search and restores the initial selection, while hiding preserves them. `multi-select` also accepts an optional `color`.
|
|
363
470
|
|
|
364
471
|
Selector example:
|
|
365
472
|
|
|
@@ -372,6 +479,16 @@ Selector example:
|
|
|
372
479
|
|
|
373
480
|
option.value is a non-empty, static, unique string; the body is the option's inline text, may contain emphasis, and must not contain another interactive component. select is a dropdown, choices is option cards, and radio-group is a radio button group; binding rules are the same.
|
|
374
481
|
|
|
482
|
+
`select`, `choices`, `radio-group` and `multi-select` also accept `options="{{ expression }}"` in place of option children. The expression must evaluate to a string array, for example an `<external type="string-array">` value or a constant or computed array; each string is both the value and the label. Option children and the expression are mutually exclusive, and same-name selectors must use the same expression. Dynamic values are deduplicated keeping the first occurrence, and empty strings are ignored.
|
|
483
|
+
|
|
484
|
+
```markdown
|
|
485
|
+
<const name="subjects" value="{{ ['mathematics', 'physics', 'chemistry'] }}">
|
|
486
|
+
|
|
487
|
+
<select bind="subject" label="Subject" options="{{ subjects }}"></select>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
The runtime reconciles choices before publishing a snapshot, including for headless hosts and SSR. It keeps the stored selection while the source is unavailable. A resolved empty array clears it. For a nonempty array, an invalid single selection falls back to the first option, and a multi-selection keeps the available values in source order. Host writes must use available values. Option expressions may read other parameters as long as the selection dependencies are acyclic. Write an explicit closing tag even with an empty body.
|
|
491
|
+
|
|
375
492
|
`required`, length and email format show hints after the first blur and update with input afterwards. Controls allow an empty initial document value; hints do not produce submissions or network operations. New text with an invalid format remains a draft and does not replace the last valid public value. An empty initial value is public as an empty string until the reader fills it in.
|
|
376
493
|
|
|
377
494
|
`counter` has built-in decrement, increment and restore-initial buttons, and disables the corresponding action at range boundaries. `timer` supports label, optional bind and duration (positive integer seconds, default 60); it has built-in start, pause and reset, stops at zero, updates according to actual elapsed time, and does not accumulate timing error after switching to the background.
|
|
@@ -384,11 +501,14 @@ option.value is a non-empty, static, unique string; the body is the option's inl
|
|
|
384
501
|
| --- | --- | --- |
|
|
385
502
|
| card | optional title | Regular Markdown; a content card |
|
|
386
503
|
| grid | columns=2 (integer 1–4, maximum column count) | Direct children are card; fewer columns in narrow containers, including nested grids and embedded documents |
|
|
504
|
+
| gallery | label required; item-width=280 (dynamic integer 180–480) | One or more gallery-item in a horizontal strip with snapping and wheel, keyboard and thumb navigation |
|
|
505
|
+
| gallery-item | optional label | One Markdown, image or card slide; the label is the caption |
|
|
387
506
|
| tabs | optional label, bind, initial | One or more tab, first selected by default |
|
|
388
507
|
| tab | label required, optional value | Regular Markdown |
|
|
389
508
|
| accordion | optional label | One or more disclosure |
|
|
390
509
|
| disclosure | label required; open=false | Click to expand; multiple entries can be open at once |
|
|
391
510
|
| if | when required, complete boolean interpolation | Shows Markdown and components when true |
|
|
511
|
+
| else | Optional `when`, a full Boolean interpolation | Shows its body when the chain reaches it and its condition is true |
|
|
392
512
|
| alert | optional title; tone=info/success/warning/error, default info | Regular Markdown |
|
|
393
513
|
| badge | tone=neutral/success/warning, default neutral | Inline text |
|
|
394
514
|
| tooltip | text required | Focusable inline explanatory text |
|
|
@@ -397,6 +517,31 @@ When tab has no value, `tab-1`, `tab-2` and so on are generated in source order;
|
|
|
397
517
|
|
|
398
518
|
When if's when is false, content is not displayed, but internal parameters are still initialized according to section 4. Unknown variables or type errors in hidden branches are still compile errors.
|
|
399
519
|
|
|
520
|
+
An `<else>` must follow an `<if>` or a conditional `<else>` in the same container. Blank lines and comments may separate the branches. Conditions are evaluated in source order and the first match is shown. An optional unconditional `<else>` ends the chain. A condition that fails to evaluate stops the chain and displays an error. Hidden branches still initialize and preserve their bindings.
|
|
521
|
+
|
|
522
|
+
```markdown
|
|
523
|
+
<toggle bind="annual" label="Annual billing">
|
|
524
|
+
|
|
525
|
+
<if when="{{ annual }}">
|
|
526
|
+
The 20% annual discount applies.
|
|
527
|
+
</if>
|
|
528
|
+
<else>
|
|
529
|
+
Monthly billing.
|
|
530
|
+
</else>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
```markdown
|
|
534
|
+
<if when="{{ people < 5 }}">
|
|
535
|
+
Small group activity.
|
|
536
|
+
</if>
|
|
537
|
+
<else when="{{ people < 15 }}">
|
|
538
|
+
Use a standard classroom.
|
|
539
|
+
</else>
|
|
540
|
+
<else>
|
|
541
|
+
Use a large classroom.
|
|
542
|
+
</else>
|
|
543
|
+
```
|
|
544
|
+
|
|
400
545
|
### 7.1 Navigation, color and guided reading
|
|
401
546
|
|
|
402
547
|
| Container or inline tag | Attributes | Body and default behavior |
|
|
@@ -453,7 +598,7 @@ progress is a void component; label/value are required, max defaults to 100, and
|
|
|
453
598
|
|
|
454
599
|
### 9.1 Shared data rules
|
|
455
600
|
|
|
456
|
-
The ReactiveMD table, chart and timeline components each contain one Markdown table. Headers are non-empty and unique, and every row has the same number of columns; cells may contain interpolation. The first column is usually a label, and other columns read types according to the component.
|
|
601
|
+
The ReactiveMD table, chart and timeline components each contain one Markdown table, except a chart that declares `rows` and uses generated columns, see [9.3 Charts](#93-charts). Headers are non-empty and unique, and every row has the same number of columns; cells may contain interpolation. The first column is usually a label, and other columns read types according to the component.
|
|
457
602
|
|
|
458
603
|
`<table>` also accepts a native HTML table body. Body structure selects the syntax; both share the rendering styles. HTML tables support merged cells and add no table interactions by default. See [HTML table compatibility](html-compatibility-en.md#two-table-syntaxes).
|
|
459
604
|
|
|
@@ -475,7 +620,7 @@ There is no need to declare a YAML array first, and remote URLs, data attributes
|
|
|
475
620
|
|
|
476
621
|
table supports optional label, searchable=true, sortable=true and page-size=10 (positive integer). It provides a search box, sortable headers and paging by default; paging controls are hidden when there is only one page.
|
|
477
622
|
|
|
478
|
-
`key` names a column of static, nonempty, unique text identifiers. Selection is enabled only when `key` is present, so `bind` and `initial` require it. The bound value is an empty string when no row is selected by default, and an explicit `initial` must match a row. Mouse or keyboard selection writes row identity. A table and a chart may share a selection binding only with identical ordered keys and at most one explicit initial. Sorting, searching, pagination and hidden chart legends preserve the selection; table filters still affect only that table, and components without `key` gain no implicit binding. Reset restores the initial selection along with the rest of the subtree.
|
|
623
|
+
`key` names a column of static, nonempty, unique text identifiers. Selection is enabled only when `key` is present, so `bind` and `initial` require it. The bound value is an empty string when no row is selected by default, and an explicit `initial` must match a row. Mouse or keyboard selection writes row identity. A table and a chart may share a selection binding only with identical ordered keys and at most one explicit initial; for generated rows, the runtime key values must also match, because compilation cannot compare dynamic arrays. Sorting, searching, pagination and hidden chart legends preserve the selection; table filters still affect only that table, and components without `key` gain no implicit binding. Reset restores the initial selection along with the rest of the subtree.
|
|
479
624
|
|
|
480
625
|
Search is a case-insensitive substring match over the displayed text of all columns, trimming whitespace from the query; sorting uses the full column type, numerically for numeric columns and by Unicode code point order for text otherwise, preserving the original order of equal rows. Clicking a header cycles ascending, descending and source order. Search or sort changes return to the first page, and reactive data changes clamp the current page to the valid range. No matches shows "No matching results". These interactions affect only the table.
|
|
481
626
|
|
|
@@ -492,6 +637,19 @@ Search is a case-insensitive substring match over the displayed text of all colu
|
|
|
492
637
|
|
|
493
638
|
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.
|
|
494
639
|
|
|
640
|
+
A chart can also generate its rows from a local array. Add `rows="{{ expression }}"` and replace the Markdown table body with one or more `<column>` children:
|
|
641
|
+
|
|
642
|
+
```markdown
|
|
643
|
+
<const name="months" value="{{ range(1, 4) }}">
|
|
644
|
+
|
|
645
|
+
<chart kind="bar" title="Fee by month" rows="{{ months }}">
|
|
646
|
+
<column label="Month" value="{{ item }}">
|
|
647
|
+
<column label="Fee" value="{{ item * 40 }}" format="currency" digits="0">
|
|
648
|
+
</chart>
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
`rows` must evaluate to a string or numeric array. Columns use the same `item` and `index` scope as `data-table`, see [9.5 Generated tables](#95-generated-tables). Column labels act as headers, so the existing `x`/`y` and `kind` rules below still apply. `max-rows` is a static integer from 1 to 1,000 and defaults to 100; more generated rows show the localized row-budget error; generated charts also count toward the document-wide generated row and cell budgets. `key` may name a generated column to expose selection through `bind`; rows without a key column keep stable internal identities. Generated chart hover readouts use the series column's `format`; category axis labels and axis ticks are not formatted in this version. Without `rows`, the Markdown table body and its behavior are unchanged.
|
|
652
|
+
|
|
495
653
|
| Type | Default column rules |
|
|
496
654
|
| --- | --- |
|
|
497
655
|
| bar, line, area | First column is the horizontal axis; other columns are numeric series |
|
|
@@ -503,7 +661,7 @@ line/area determine the horizontal axis as numeric or categorical from the full
|
|
|
503
661
|
|
|
504
662
|
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.
|
|
505
663
|
|
|
506
|
-
Numeric columns update with parameters. Calculation errors display in the corresponding chart and are not replaced with 0. With `key`, a chart exposes selection through `bind` under the same row-key rules as `table
|
|
664
|
+
Numeric columns update with parameters. Calculation errors display in the corresponding chart and are not replaced with 0. With `key`, a chart exposes selection through `bind` under the same row-key rules as `table`, in either body mode.
|
|
507
665
|
|
|
508
666
|
### 9.4 Timelines
|
|
509
667
|
|
|
@@ -521,15 +679,46 @@ timeline supports optional title and unit (display text, default "minutes"), and
|
|
|
521
679
|
</data-table>
|
|
522
680
|
```
|
|
523
681
|
|
|
524
|
-
`data-table` is a paired block component. It requires an accessible `label`, a complete array expression in `rows`, and a complete string or number expression in `key`. Its only children are 1 to 20 void `column` declarations. A column requires a static `label` and a complete scalar `value` expression. Cells output plain text; null gives an empty cell.
|
|
682
|
+
`data-table` is a paired block component. It requires an accessible `label`, a complete array expression in `rows`, and a complete string or number expression in `key`. Its only children are 1 to 20 void `column` declarations. A column requires a static `label` and a complete scalar `value` expression. Cells output plain text; null or empty text gives an empty cell, including in formatted columns.
|
|
683
|
+
|
|
684
|
+
`data-table` accepts `searchable` (default false), `sortable` (default false) and an optional positive-integer `page-size`; without `page-size` every row is shown. Search is opt-in and matches the displayed cell text, ignoring case; sorting is opt-in, compares raw values numerically when every non-empty cell in the column is numeric and otherwise compares display text by Unicode code point order; clicking a header cycles ascending, descending and source order; paging controls appear only with `page-size`. With its required `key`, `bind` exposes the selected row key as a string and `initial` sets the starting selection. Selection is preserved across search, sort and page changes. Static mode keeps the selection marker but removes interactive controls. Cells that fail to compute are omitted from search and numeric detection and sort as empty text. A static `empty` text replaces the default no-rows message for an empty data source; a search that matches no row keeps the no-matching-results message.
|
|
685
|
+
|
|
686
|
+
`data-table` also takes a static `align` (`left`, `center` or `right`, default `center`) and a dynamic `row-align`. The table alignment applies to header, body and summary cells. `row-align` is one complete interpolation evaluated for each body row with `item` and `index`; it must produce `left`, `center` or `right`, and an invalid or failing result falls back to the column and table alignment. Alignment precedence is the column `align`, then `row-align`, then the table `align`, then `center`. A column's static `align` overrides both the row and table alignment for that column's header, cells and summary cell. `row-align` affects body rows only: header and summary rows keep the column and table alignment, and selection cells stay centered.
|
|
687
|
+
|
|
688
|
+
```markdown
|
|
689
|
+
<const name="months" value="{{ ['Jan', 'Feb', 'Mar'] }}">
|
|
690
|
+
|
|
691
|
+
<data-table label="Fees" rows="{{ months }}" key="{{ item }}" searchable sortable page-size="2" bind="picked">
|
|
692
|
+
<column label="Month" value="{{ item }}" summary="count">
|
|
693
|
+
<column label="Fee" value="{{ index * 40 + 40 }}" format="currency" digits="0" summary="sum">
|
|
694
|
+
</data-table>
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
Selecting the second row writes the key `"Feb"` to `picked`.
|
|
698
|
+
|
|
699
|
+
A `column` accepts `format` = `plain` (default), `number`, `percent`, `scientific` or `currency`, plus optional `digits` (0–20), `currency` (three-letter uppercase code, default `USD`) and `locale` (`en-US` default; `en-US`, `zh-CN`, `de-DE`, `fr-FR` or `ja-JP`). In a `data-table`, a column also accepts an optional static `align` (`left`, `center` or `right`) and a static `summary` (`sum`, `average` or `count`, described below).
|
|
700
|
+
|
|
701
|
+
| `format` | Default digits | Example |
|
|
702
|
+
| --- | --- | --- |
|
|
703
|
+
| `plain` | — | `12.5` keeps the number's text |
|
|
704
|
+
| `number` | 2 | `1234.5` gives `1,234.50` |
|
|
705
|
+
| `percent` | 0 | `0.12` gives `12%` |
|
|
706
|
+
| `scientific` | 2 | `1234` gives `1.23E3` |
|
|
707
|
+
| `currency` | 2 | `12.5` gives `$12.50` |
|
|
708
|
+
|
|
709
|
+
Formatting changes display text. Sorting, chart values and summaries use the original numbers. `plain` displays the number as written. A numeric format expects a numeric result. A non-numeric cell in a formatted column shows a cell error while other cells remain readable. Column formats apply to generated table cells and generated chart readouts.
|
|
710
|
+
|
|
711
|
+
Use `summary="sum"` on a numeric column to show its sum with the column's format, `summary="average"` to show the mean of the numeric values among the successfully computed, nonempty cells, or `summary="count"` to show the number of successfully computed, nonempty cells. `sum` and `average` ignore non-numeric cells. `average` formats the mean with the column's `format`, `digits`, `currency` and `locale` and shows no value when no numeric cell remains; `sum` over empty results shows zero. `sum` and `average` require a numeric column at compile time. The footer summarizes all matching rows across pages. A sum or average that exceeds the numeric range shows an error.
|
|
712
|
+
|
|
713
|
+
Generated tables and charts preserve whitespace in string keys and convert finite numeric keys to strings. A shared selection requires identical ordered keys. When the data changes, the runtime clears a selection whose key is no longer available.
|
|
525
714
|
|
|
526
|
-
Each row has two local names: `item` is the current string or number, and `index` is its current zero-based position. These names shadow same-named document values inside column expressions. Other references use the normal document environment. The source `rows` expression uses ordinary document scope.
|
|
715
|
+
Each row has two local names: `item` is the current string or number, and `index` is its current zero-based position. These names shadow same-named document values inside column expressions. Other references use the normal document environment. The source `rows` expression uses ordinary document scope. A transform inside a `rows` or column expression binds its own `item` and `index` for its condition, projection or key, and those names shadow the row names there.
|
|
527
716
|
|
|
528
717
|
Keys depend only on `item`, including at least one reference to it. They cannot depend on `index` or other document values. The table checks that every evaluated key is a nonempty string or finite number and is unique. Numeric and string keys have distinct identities; signed numeric zeros have the same identity. React rows retain their identities when their items reorder. For records with repeated display values, use a collection of distinct local IDs as `rows` and derive the display cells from those IDs. Duplicate or invalid keys produce a whole-table error.
|
|
529
718
|
|
|
530
719
|
`max-rows` is a static integer from 1 to 1,000, defaulting to 100. Across the document, declared row budgets may total at most 2,000 and row budgets multiplied by their column counts may total at most 10,000 cells. Hidden tables count too. Each generated table also has a budget of 100,000 UTF-16 code units for header text, cell text, error and empty placeholders, and encoded row keys. The renderer checks budgets before exposing rows; exceeding them reports an error without truncating the data.
|
|
531
720
|
|
|
532
|
-
An empty array displays the headers and an empty-state message. Failure of the row source or a key clears the table's rows and displays an error. A cell-expression failure is shown in that cell while independent cells remain readable. The component creates native table rows, not arbitrary repeated document sections or controls. Markdown tables
|
|
721
|
+
An empty array displays the headers and an empty-state message: the `empty` text when supplied, otherwise the default no-rows message. A search with no matches keeps the dedicated no-matching-results message. Failure of the row source or a key clears the table's rows and displays an error. A cell-expression failure is shown in that cell while independent cells remain readable. The component creates native table rows, not arbitrary repeated document sections or controls. Markdown tables keep their original behavior, and a chart without `rows` keeps its Markdown table input.
|
|
533
722
|
|
|
534
723
|
## 10. LaTeX math and function plots
|
|
535
724
|
|
|
@@ -665,14 +854,14 @@ Nodes are clickable and keyboard-selectable by default, and the selected notes a
|
|
|
665
854
|
| --- | --- |
|
|
666
855
|
| Parameter input | input, textarea, number, slider, range-slider, coordinate, toggle, checkbox, date, select, choices, radio-group, multi-select, option |
|
|
667
856
|
| Built-in actions | counter, timer, checklist, progress |
|
|
668
|
-
| Content organization | panel, card, grid, tabs, tab, accordion, disclosure, if |
|
|
857
|
+
| Content organization | panel, card, grid, gallery, gallery-item, tabs, tab, accordion, disclosure, if, else |
|
|
669
858
|
| Navigation and prose | jump, anchor, text, section |
|
|
670
859
|
| Assessment and reading | quiz, steps, step |
|
|
671
860
|
| Hints | alert, badge, tooltip |
|
|
672
|
-
| Declarations and generated data | external, computed, const, validation, data-table, column |
|
|
861
|
+
| Declarations and generated data | external, computed, const, dataset, validation, data-table, column |
|
|
673
862
|
| Visualization | table, chart, plot, timeline, diagram, node, edge |
|
|
674
863
|
|
|
675
|
-
|
|
864
|
+
53 tag names in total. `option`, `tab`, `gallery-item`, `disclosure`, `node`, `edge`, `step` and `column` are structural children of parent components. `external`, `computed`, `const`, `dataset` 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.
|
|
676
865
|
|
|
677
866
|
This revision 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.
|
|
678
867
|
|