reactive-md 0.9.1 → 0.9.2

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.
Files changed (292) hide show
  1. package/CHANGELOG-ch.md +333 -319
  2. package/CHANGELOG.md +334 -320
  3. package/CONTRIBUTING-ch.md +22 -22
  4. package/CONTRIBUTING.md +22 -22
  5. package/README-ch.md +431 -431
  6. package/README-en.md +431 -431
  7. package/README.md +429 -429
  8. package/SECURITY-ch.md +83 -83
  9. package/SECURITY.md +83 -83
  10. package/bin/reactive-md.mjs +39 -39
  11. package/cli/args.mjs +263 -263
  12. package/cli/assets.mjs +395 -395
  13. package/cli/build.mjs +445 -445
  14. package/cli/check.mjs +444 -444
  15. package/cli/document.mjs +130 -130
  16. package/cli/errors.mjs +61 -61
  17. package/cli/fs-utils.mjs +133 -133
  18. package/cli/glob.mjs +203 -203
  19. package/cli/help.mjs +323 -323
  20. package/cli/init.mjs +1577 -1577
  21. package/cli/lint.mjs +177 -177
  22. package/cli/main.mjs +65 -65
  23. package/cli/migrate.mjs +368 -368
  24. package/cli/package-loader.mjs +41 -41
  25. package/cli/package.mjs +211 -211
  26. package/dist-library/{LocalDocumentView-sthUP0ct.js → LocalDocumentView-BuqgJZEY.js} +11 -11
  27. package/dist-library/{LocalDocumentViewCore-GiWV3bey.js → LocalDocumentViewCore-DXE0I0Qc.js} +210 -209
  28. package/dist-library/{LocalReactiveDocumentCore-ZjQSGyHE.js → LocalReactiveDocumentCore-CWBe4Mm5.js} +8 -8
  29. package/dist-library/{authoring-Dsune4Hy.js → authoring-Ci_KzJ0q.js} +53 -53
  30. package/dist-library/{compile-wUv8KEge.js → compile-Dx6Uw3D9.js} +11 -11
  31. package/dist-library/{compiler-core-As_m-MNm.js → compiler-core-DDDdvuLy.js} +883 -818
  32. package/dist-library/compiler-dxLPB9Ym.js +86 -0
  33. package/dist-library/{component-state-C52ZFJGl.js → component-state-BRwvTV0d.js} +15 -14
  34. package/dist-library/component-state-CwKX_SN5.js +763 -0
  35. package/dist-library/{config-BadfhjdP.js → config-DXLvctiZ.js} +68 -66
  36. package/dist-library/config-validation-D3D7Dy2J.js +586 -0
  37. package/dist-library/{controls-CcT6n7k_.js → controls-DoZyLCrV.js} +3 -3
  38. package/dist-library/{coordinate-CWS9p5q_.js → coordinate-B1VFK9fd.js} +2 -2
  39. package/dist-library/{data-table-Bgccxd7h.js → data-table-8-3F15Jf.js} +3 -3
  40. package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
  41. package/dist-library/{display-B-VhqVND.js → display-B_uutKkN.js} +1 -1
  42. package/dist-library/{config-validation-F47AcE6o.js → document-theme-C8J6UyNO.js} +193 -731
  43. package/dist-library/{export-BqVmTXm8.js → export-CIAIPBov.js} +35 -34
  44. package/dist-library/{gallery-CY6mTx8i.js → gallery-Dv1rOvL0.js} +1 -1
  45. package/dist-library/{html-CNT4KD-2.js → html-Cr4CBwAH.js} +42 -41
  46. package/dist-library/identity-BUx0Q_-d.js +40 -0
  47. package/dist-library/{incremental-Dv0FSp_U.js → incremental-9nx92u9c.js} +12 -10
  48. package/dist-library/{layout-C0YlEPGr.js → layout-BBB2VF0S.js} +1 -1
  49. package/dist-library/{mount-preset-KxvtKgJb.js → mount-preset-DMZ5wd3t.js} +3 -3
  50. package/dist-library/observability-4KqXhIEU.js +421 -0
  51. package/dist-library/observability-core-Bcu7vpnl.js +24 -0
  52. package/dist-library/{options-1aDLK7JY.js → options-BBp9IcHm.js} +4 -4
  53. package/dist-library/{package-core-WFK1RhAZ.js → package-core-K5xesGqy.js} +30 -29
  54. package/dist-library/{parser-standard-Yuf3A_VI.js → parser-standard-CBA1-hdG.js} +352 -352
  55. package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
  56. package/dist-library/preset-core-DeZPA8IE.js +1298 -0
  57. package/dist-library/react-0DCh-Mar.js +7 -0
  58. package/dist-library/reactive-md-authoring.js +19 -19
  59. package/dist-library/reactive-md-build.js +48 -10
  60. package/dist-library/reactive-md-compiler-standard.js +6 -6
  61. package/dist-library/reactive-md-compiler.js +3 -3
  62. package/dist-library/reactive-md-default-packs.js +3 -2
  63. package/dist-library/reactive-md-default-preset.js +3 -2
  64. package/dist-library/reactive-md-export.js +4 -4
  65. package/dist-library/reactive-md-minimal-preset.js +2 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  67. package/dist-library/reactive-md-observability.js +4 -0
  68. package/dist-library/reactive-md-plugin-chart.js +3 -3
  69. package/dist-library/reactive-md-plugin-data.js +5 -5
  70. package/dist-library/reactive-md-plugin-diagram.js +4 -4
  71. package/dist-library/reactive-md-plugin-forms.js +4 -4
  72. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  73. package/dist-library/reactive-md-plugin-navigation.js +3 -3
  74. package/dist-library/reactive-md-plugin-network.js +4 -3
  75. package/dist-library/reactive-md-plugin-plot.js +4 -4
  76. package/dist-library/reactive-md-print.css +304 -304
  77. package/dist-library/reactive-md-react-minimal.js +4 -4
  78. package/dist-library/reactive-md-react-server.js +6 -6
  79. package/dist-library/reactive-md-react-unstyled.js +11 -11
  80. package/dist-library/reactive-md-react.js +11 -11
  81. package/dist-library/reactive-md-runtime-browser.js +2 -1
  82. package/dist-library/reactive-md-runtime.js +4 -3
  83. package/dist-library/reactive-md-sdk.js +8 -7
  84. package/dist-library/reactive-md-standalone-configured.js +2 -2
  85. package/dist-library/reactive-md-standalone-host.js +2 -2
  86. package/dist-library/reactive-md-testing-browser.js +2 -2
  87. package/dist-library/reactive-md-testing-react.js +6 -6
  88. package/dist-library/reactive-md-testing.js +5 -5
  89. package/dist-library/reactive-md.js +556 -367
  90. package/dist-library/{registry-B9NGct4d.js → registry-D6OGkOcX.js} +3 -3
  91. package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
  92. package/dist-library/{resources-D2GDQS0p.js → resources-B0x_w3s9.js} +71 -46
  93. package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
  94. package/dist-library/{runtime-kcA7bG7G.js → runtime-BpQdZmFI.js} +311 -305
  95. package/dist-library/{schema-BufhKUSM.js → schema-BryM_VRW.js} +14 -14
  96. package/dist-library/{sdk-core-BoJT1SIt.js → sdk-core-ChslheKs.js} +33 -32
  97. package/dist-library/{session-core-nmJHuR9c.js → session-core-dxQCJBNa.js} +15 -14
  98. package/dist-library/{shareable-DpbE-59H.js → shareable-B8xMoGEa.js} +179 -176
  99. package/dist-library/types/build/diagnostics.d.ts +1 -1
  100. package/dist-library/types/local/index.d.ts +6 -0
  101. package/dist-library/types/local/observability-codes.d.ts +2 -0
  102. package/dist-library/types/local/observability-core.d.ts +25 -0
  103. package/dist-library/types/local/observability-messages.d.ts +6 -0
  104. package/dist-library/types/local/observability.d.ts +43 -0
  105. package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
  106. package/dist-library/types/local/transport/worker.d.ts +52 -1
  107. package/dist-library/types/local/types.d.ts +8 -0
  108. package/dist-library/types/observability.d.ts +7 -0
  109. package/dist-library/{types-BeNtPqdY.js → types-Ib5kSScP.js} +1 -1
  110. package/dist-library/types-daDo2c_w.js +3 -0
  111. package/dist-library/{validation-BEBA_HvS.js → validation-B3RI0xOk.js} +251 -249
  112. package/dist-library/version-DAxuGOG2.js +147 -0
  113. package/dist-library/{visual-frame-CyV1FXzs.js → visual-frame-_rcd5HUv.js} +1 -1
  114. package/dist-library/{visuals-BZbZYA7w.js → visuals-DkDhNdEZ.js} +17 -17
  115. package/dist-standalone/reactive-md-standalone.js +118 -118
  116. package/docs/README-ch.md +101 -95
  117. package/docs/README.md +101 -95
  118. package/docs/compatibility/api-stability-ch.md +25 -0
  119. package/docs/compatibility/api-stability-en.md +25 -0
  120. package/docs/compatibility/compatibility-ch.md +146 -129
  121. package/docs/compatibility/compatibility-en.md +146 -129
  122. package/docs/compatibility/compatibility-manifest.schema.json +161 -0
  123. package/docs/compatibility/deprecation-ch.md +21 -0
  124. package/docs/compatibility/deprecation-en.md +21 -0
  125. package/docs/compatibility/source-versioning-ch.md +162 -162
  126. package/docs/compatibility/source-versioning-en.md +162 -162
  127. package/docs/compatibility/support-matrix-ch.md +108 -0
  128. package/docs/compatibility/support-matrix-en.md +108 -0
  129. package/docs/development/component-development-ch.md +66 -66
  130. package/docs/development/component-development-en.md +66 -66
  131. package/docs/development/component-development-reference-ch.md +253 -253
  132. package/docs/development/component-development-reference-en.md +238 -238
  133. package/docs/development/component-protocol-ch.md +748 -748
  134. package/docs/development/component-protocol-en.md +750 -750
  135. package/docs/development/extension-tutorial-ch.md +308 -308
  136. package/docs/development/extension-tutorial-en.md +308 -308
  137. package/docs/development/performance-overview-ch.md +422 -422
  138. package/docs/development/performance-overview-en.md +422 -422
  139. package/docs/guides/local-guide-ch.md +532 -532
  140. package/docs/guides/local-guide-en.md +532 -532
  141. package/docs/integration/author-tools-ch.md +64 -64
  142. package/docs/integration/author-tools-en.md +64 -64
  143. package/docs/integration/compiler-ch.md +49 -49
  144. package/docs/integration/compiler-en.md +36 -36
  145. package/docs/integration/directory-discovery-en.md +1 -1
  146. package/docs/integration/editor-ch.md +295 -295
  147. package/docs/integration/editor-en.md +303 -303
  148. package/docs/integration/extension-sdk-ch.md +394 -394
  149. package/docs/integration/extension-sdk-en.md +379 -379
  150. package/docs/integration/local-integration-ch.md +646 -646
  151. package/docs/integration/local-integration-en.md +662 -662
  152. package/docs/integration/shareable-export-ch.md +307 -307
  153. package/docs/integration/shareable-export-en.md +309 -309
  154. package/docs/reference/diagnostics-counting-ch.md +104 -104
  155. package/docs/reference/diagnostics-counting-en.md +104 -104
  156. package/docs/reference/html-compatibility-ch.md +93 -93
  157. package/docs/reference/html-compatibility-en.md +95 -95
  158. package/docs/reference/local-interaction-syntax-ch.md +724 -724
  159. package/docs/reference/local-interaction-syntax-en.md +722 -722
  160. package/docs/reference/public-api-ch.md +33 -4
  161. package/docs/reference/public-api-en.md +33 -4
  162. package/docs/reference/theme-protocol-ch.md +198 -198
  163. package/docs/reference/theme-protocol-en.md +217 -217
  164. package/docs/releases/release-0.4.0-ch.md +91 -91
  165. package/docs/releases/release-0.4.0-en.md +91 -91
  166. package/docs/releases/release-0.4.1-ch.md +25 -25
  167. package/docs/releases/release-0.4.1-en.md +25 -25
  168. package/docs/releases/release-0.5.0-ch.md +43 -43
  169. package/docs/releases/release-0.5.0-en.md +43 -43
  170. package/docs/releases/release-0.5.1-ch.md +41 -41
  171. package/docs/releases/release-0.5.1-en.md +41 -41
  172. package/docs/releases/release-0.5.2-ch.md +37 -37
  173. package/docs/releases/release-0.5.2-en.md +37 -37
  174. package/docs/releases/release-0.5.3-ch.md +26 -26
  175. package/docs/releases/release-0.5.3-en.md +26 -26
  176. package/docs/releases/release-0.6.0-ch.md +59 -59
  177. package/docs/releases/release-0.6.0-en.md +59 -59
  178. package/docs/releases/release-0.6.1-ch.md +29 -29
  179. package/docs/releases/release-0.6.1-en.md +29 -29
  180. package/docs/releases/release-0.7.0-ch.md +86 -86
  181. package/docs/releases/release-0.7.0-en.md +86 -86
  182. package/docs/releases/release-0.9.2-ch.md +33 -0
  183. package/docs/releases/release-0.9.2-en.md +33 -0
  184. package/examples/component-package/README-ch.md +101 -101
  185. package/examples/component-package/README.md +133 -133
  186. package/examples/conformance/README-ch.md +55 -55
  187. package/examples/conformance/README.md +55 -55
  188. package/examples/conformance/component-protocol-1.json +482 -482
  189. package/examples/conformance/component-protocol-1.schema.json +76 -76
  190. package/examples/conformance/local-draft-1.json +50 -50
  191. package/examples/conformance/local-draft-2.json +212 -212
  192. package/examples/game-2048-package/LICENSE +21 -21
  193. package/examples/game-2048-package/NOTICES.md +11 -11
  194. package/examples/game-2048-package/README-ch.md +91 -91
  195. package/examples/game-2048-package/README.md +98 -98
  196. package/examples/game-2048-package/package.json +35 -35
  197. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  198. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  199. package/examples/game-2048-package/scripts/build.mjs +130 -130
  200. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  201. package/examples/game-2048-package/src/component.css +161 -161
  202. package/examples/game-2048-package/src/components.tsx +326 -326
  203. package/examples/game-2048-package/src/game-engine.ts +228 -228
  204. package/examples/game-2048-package/src/harness.tsx +34 -34
  205. package/examples/game-2048-package/src/manifest.ts +85 -85
  206. package/examples/game-2048-package/src/node-entry.ts +30 -30
  207. package/examples/game-2048-package/src/sample.ts +4 -4
  208. package/examples/game-2048-package/tsconfig.json +15 -15
  209. package/examples/integration/README-ch.md +82 -82
  210. package/examples/integration/README.md +82 -82
  211. package/examples/integration/core/index.mjs +32 -32
  212. package/examples/integration/extension-sdk/README-ch.md +24 -24
  213. package/examples/integration/extension-sdk/README.md +24 -24
  214. package/examples/integration/worker/index.html +19 -19
  215. package/examples/integration/worker/main.js +61 -61
  216. package/examples/integration/worker/package.json +13 -13
  217. package/examples/integration/worker/worker.js +3 -3
  218. package/examples/local/README-ch.md +76 -76
  219. package/examples/local/README.md +76 -76
  220. package/examples/local/charts.reactive.md +73 -73
  221. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  222. package/examples/local/recipes/invoice.reactive.md +36 -36
  223. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  224. package/examples/local/recipes/workshop.reactive.md +33 -33
  225. package/examples/local/showcase/README-ch.md +22 -22
  226. package/examples/local/showcase/README.md +31 -31
  227. package/examples/local/showcase/explore.reactive.md +102 -102
  228. package/examples/local/showcase/flow.reactive.md +86 -86
  229. package/examples/local/showcase/forms.reactive.md +126 -126
  230. package/examples/local/showcase/functions.reactive.md +119 -119
  231. package/examples/local/showcase/layout.reactive.md +100 -100
  232. package/examples/local/showcase/statistics.reactive.md +108 -108
  233. package/examples/local/showcase/tasks.reactive.md +89 -89
  234. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  235. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  236. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  237. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  238. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  239. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  240. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  241. package/examples/minimal-extension/README-ch.md +78 -78
  242. package/examples/minimal-extension/README.md +78 -78
  243. package/examples/minimal-extension/index.html +15 -15
  244. package/examples/minimal-extension/package.json +26 -26
  245. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  246. package/examples/minimal-extension/scripts/build.mjs +32 -32
  247. package/examples/minimal-extension/scripts/export.mjs +72 -72
  248. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  249. package/examples/minimal-extension/src/extension.tsx +90 -90
  250. package/examples/minimal-extension/src/preview.tsx +12 -12
  251. package/examples/minimal-extension/src/source.ts +4 -4
  252. package/examples/minimal-extension/tsconfig.json +14 -14
  253. package/examples/sci-fi-theme/README-ch.md +133 -133
  254. package/examples/sci-fi-theme/README.md +148 -148
  255. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  256. package/examples/sci-fi-theme/demo/demo.css +638 -638
  257. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  258. package/examples/sci-fi-theme/demo/index.html +13 -13
  259. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  260. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  261. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  262. package/examples/sci-fi-theme/package.json +28 -28
  263. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  264. package/examples/sci-fi-theme/src/components.css +2370 -2370
  265. package/examples/sci-fi-theme/src/index.ts +6 -6
  266. package/examples/sci-fi-theme/src/notch.css +142 -142
  267. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  268. package/examples/sci-fi-theme/src/theme.ts +39 -39
  269. package/examples/sci-fi-theme/tsconfig.json +20 -20
  270. package/examples/sci-fi-theme/vite.config.ts +24 -24
  271. package/examples/tetris-package/LICENSE +21 -21
  272. package/examples/tetris-package/NOTICES.md +11 -11
  273. package/examples/tetris-package/README-ch.md +91 -91
  274. package/examples/tetris-package/README.md +95 -95
  275. package/examples/tetris-package/package.json +35 -35
  276. package/examples/tetris-package/sample/document.reactive.md +16 -16
  277. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  278. package/examples/tetris-package/scripts/build.mjs +130 -130
  279. package/examples/tetris-package/scripts/verify.mjs +173 -173
  280. package/examples/tetris-package/src/component.css +145 -145
  281. package/examples/tetris-package/src/components.tsx +334 -334
  282. package/examples/tetris-package/src/harness.tsx +34 -34
  283. package/examples/tetris-package/src/manifests.ts +93 -93
  284. package/examples/tetris-package/src/node-entry.ts +16 -16
  285. package/examples/tetris-package/src/sample.ts +4 -4
  286. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  287. package/examples/tetris-package/tsconfig.json +15 -15
  288. package/package.json +7 -1
  289. package/dist-library/compiler-eOfcinZs.js +0 -62
  290. package/dist-library/component-state-BoLCGee4.js +0 -801
  291. package/dist-library/preset-core-CKc5YXSM.js +0 -1443
  292. package/dist-library/react-D5iGiUdL.js +0 -7
@@ -1,32 +1,32 @@
1
- import {
2
- compileLocal,
3
- createLocalRuntime,
4
- exportLocalState,
5
- importLocalState,
6
- LOCAL_SYNTAX_VERSION,
7
- } from 'reactive-md';
8
-
9
- const source = `<number bind="people" label="People" initial="2" min="1" max="20">
10
-
11
- People: {{ people }}, cost: {{ people * 100 }}`;
12
- const result = compileLocal(source);
13
- if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
14
-
15
- console.log(`Syntax: ${LOCAL_SYNTAX_VERSION}`);
16
- const runtime = createLocalRuntime(result.document);
17
- try {
18
- const print = () => console.log(runtime.text('People: {{ people }}, cost: {{ people * 100 }}'));
19
- print();
20
- console.log(`People parameter: ${runtime.getParameter('people')}`);
21
-
22
- const diagnostics = runtime.setParameters({ people: 5 });
23
- if (diagnostics.length) throw new Error(JSON.stringify(diagnostics));
24
- print();
25
-
26
- const file = exportLocalState(runtime, { name: 'reactive-md-core-example', version: '1' });
27
- runtime.setParameter('people', 1);
28
- const imported = importLocalState(runtime, JSON.stringify(file));
29
- if (imported.length) throw new Error(JSON.stringify(imported));
30
- print();
31
- console.log(`State: ${file.format}, document ${file.sourceDigest}`);
32
- } finally { runtime.dispose(); }
1
+ import {
2
+ compileLocal,
3
+ createLocalRuntime,
4
+ exportLocalState,
5
+ importLocalState,
6
+ LOCAL_SYNTAX_VERSION,
7
+ } from 'reactive-md';
8
+
9
+ const source = `<number bind="people" label="People" initial="2" min="1" max="20">
10
+
11
+ People: {{ people }}, cost: {{ people * 100 }}`;
12
+ const result = compileLocal(source);
13
+ if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
14
+
15
+ console.log(`Syntax: ${LOCAL_SYNTAX_VERSION}`);
16
+ const runtime = createLocalRuntime(result.document);
17
+ try {
18
+ const print = () => console.log(runtime.text('People: {{ people }}, cost: {{ people * 100 }}'));
19
+ print();
20
+ console.log(`People parameter: ${runtime.getParameter('people')}`);
21
+
22
+ const diagnostics = runtime.setParameters({ people: 5 });
23
+ if (diagnostics.length) throw new Error(JSON.stringify(diagnostics));
24
+ print();
25
+
26
+ const file = exportLocalState(runtime, { name: 'reactive-md-core-example', version: '1' });
27
+ runtime.setParameter('people', 1);
28
+ const imported = importLocalState(runtime, JSON.stringify(file));
29
+ if (imported.length) throw new Error(JSON.stringify(imported));
30
+ print();
31
+ console.log(`State: ${file.format}, document ${file.sourceDigest}`);
32
+ } finally { runtime.dispose(); }
@@ -1,24 +1,24 @@
1
- # 扩展 SDK 使用方
2
-
3
- **中文** · [English](README.md)
4
-
5
- 该 fixture 通过公开包导出定义了一个评分控件、一个 Markdown 提示容器,以及明暗纸张主题。评分控件与内置数字控件共享数值绑定。
6
-
7
- `advanced.tsx` 增加了坐标控件、字符串集合、数字集合和 Markdown 容器。坐标、多选和卡片契约来自 `defaultPreset.components`;项目提供自己的 React 实现。其验收检查覆盖原子回滚、数组限制与复制、重置、禁用/隐藏状态、静态输出、SSR,以及离线桌面/移动端恢复。`advanced-standalone.ts` 为该项导出打包同一组已安装实现。
8
-
9
- 本 fixture 固定 `reactive-md@0.8.0`,SDK 契约仍为 `0.7.0`。验证器在独立目录中安装引擎和 peer 依赖;请把固定版本调整为要验证的发布版本,只有测试尚未发布的候选版本时才使用新打包的引擎 tarball。
10
-
11
- 在仓库根目录:
12
-
13
- ```powershell
14
- npm.cmd run build:lib
15
- npm.cmd run test:sdk-consumer
16
- ```
17
-
18
- 验证器把该项目复制到独立的临时目录,安装实际的包与 peer tarball,检查 TypeScript 和 Node SSR,构建宿主专用的独立入口,并在全新的浏览器上下文中验证静态及离线交互 HTML。它不使用源码别名或仓库依赖 junction。结果和使用方目录见 `artifacts/sdk-consumer/verification.json`。
19
-
20
- 手动开发时,在该目录的副本中安装经验证的 tarball,安装其开发依赖,然后运行 `npm run dev`。主题样式表由 `main.tsx` 显式加载。`standalone.ts` 是可信入口,用于在离线输出中恢复同一组已安装实现。
21
-
22
- 运行时不根据文档声明获取组件代码。宿主代码在挂载前导入实现。导出器在生成 HTML 前检查组件契约、能力、主题和声明的资源。
23
-
24
- 中文接口说明:[扩展 SDK 预览](../../../docs/integration/extension-sdk-ch.md)。
1
+ # 扩展 SDK 使用方
2
+
3
+ **中文** · [English](README.md)
4
+
5
+ 该 fixture 通过公开包导出定义了一个评分控件、一个 Markdown 提示容器,以及明暗纸张主题。评分控件与内置数字控件共享数值绑定。
6
+
7
+ `advanced.tsx` 增加了坐标控件、字符串集合、数字集合和 Markdown 容器。坐标、多选和卡片契约来自 `defaultPreset.components`;项目提供自己的 React 实现。其验收检查覆盖原子回滚、数组限制与复制、重置、禁用/隐藏状态、静态输出、SSR,以及离线桌面/移动端恢复。`advanced-standalone.ts` 为该项导出打包同一组已安装实现。
8
+
9
+ 本 fixture 固定 `reactive-md@0.8.0`,SDK 契约仍为 `0.7.0`。验证器在独立目录中安装引擎和 peer 依赖;请把固定版本调整为要验证的发布版本,只有测试尚未发布的候选版本时才使用新打包的引擎 tarball。
10
+
11
+ 在仓库根目录:
12
+
13
+ ```powershell
14
+ npm.cmd run build:lib
15
+ npm.cmd run test:sdk-consumer
16
+ ```
17
+
18
+ 验证器把该项目复制到独立的临时目录,安装实际的包与 peer tarball,检查 TypeScript 和 Node SSR,构建宿主专用的独立入口,并在全新的浏览器上下文中验证静态及离线交互 HTML。它不使用源码别名或仓库依赖 junction。结果和使用方目录见 `artifacts/sdk-consumer/verification.json`。
19
+
20
+ 手动开发时,在该目录的副本中安装经验证的 tarball,安装其开发依赖,然后运行 `npm run dev`。主题样式表由 `main.tsx` 显式加载。`standalone.ts` 是可信入口,用于在离线输出中恢复同一组已安装实现。
21
+
22
+ 运行时不根据文档声明获取组件代码。宿主代码在挂载前导入实现。导出器在生成 HTML 前检查组件契约、能力、主题和声明的资源。
23
+
24
+ 中文接口说明:[扩展 SDK 预览](../../../docs/integration/extension-sdk-ch.md)。
@@ -1,24 +1,24 @@
1
- # Extension SDK consumer
2
-
3
- **English** · [中文](README-ch.md)
4
-
5
- This fixture defines a rating control, a Markdown hint container, and a light/dark paper theme through public package exports. The rating shares its numeric binding with the built-in number control.
6
-
7
- `advanced.tsx` adds a coordinate control, string collection, numeric collection and Markdown container. The coordinate, multi-select and card contracts come from `defaultPreset.components`; the project supplies its own React implementations. Its acceptance checks cover atomic rollback, array limits and copies, reset, disabled/hidden states, static output, SSR and offline desktop/mobile restoration. `advanced-standalone.ts` bundles the same installed implementations for that export.
8
-
9
- This fixture pins `reactive-md@0.8.0`; its SDK contract remains at `0.7.0`. The verifier installs the engine and peer dependencies in a separate directory. Raise the pin to the release being validated; use a freshly packed engine tarball only for an unreleased candidate.
10
-
11
- From the repository root:
12
-
13
- ```powershell
14
- npm.cmd run build:lib
15
- npm.cmd run test:sdk-consumer
16
- ```
17
-
18
- The verifier copies this project to a separate temporary directory, installs the actual package and peer tarballs, checks TypeScript and Node SSR, builds a host-specific standalone entry, and verifies static and offline interactive HTML in fresh browser contexts. It uses no source aliases or repository dependency junctions. See `artifacts/sdk-consumer/verification.json` for the result and consumer directory.
19
-
20
- For manual development, install the verified tarball in a copy of this directory, install its development dependencies, then run `npm run dev`. The theme stylesheet is loaded explicitly by `main.tsx`. `standalone.ts` is the trusted entry used to restore the same installed implementations in offline output.
21
-
22
- The runtime does not fetch component code based on document declarations. Host code imports the implementations before mounting. The exporter checks the component contracts, capabilities, theme, and declared resources before producing the HTML.
23
-
24
- 中文接口说明:[扩展 SDK 预览](../../../docs/integration/extension-sdk-ch.md)。
1
+ # Extension SDK consumer
2
+
3
+ **English** · [中文](README-ch.md)
4
+
5
+ This fixture defines a rating control, a Markdown hint container, and a light/dark paper theme through public package exports. The rating shares its numeric binding with the built-in number control.
6
+
7
+ `advanced.tsx` adds a coordinate control, string collection, numeric collection and Markdown container. The coordinate, multi-select and card contracts come from `defaultPreset.components`; the project supplies its own React implementations. Its acceptance checks cover atomic rollback, array limits and copies, reset, disabled/hidden states, static output, SSR and offline desktop/mobile restoration. `advanced-standalone.ts` bundles the same installed implementations for that export.
8
+
9
+ This fixture pins `reactive-md@0.8.0`; its SDK contract remains at `0.7.0`. The verifier installs the engine and peer dependencies in a separate directory. Raise the pin to the release being validated; use a freshly packed engine tarball only for an unreleased candidate.
10
+
11
+ From the repository root:
12
+
13
+ ```powershell
14
+ npm.cmd run build:lib
15
+ npm.cmd run test:sdk-consumer
16
+ ```
17
+
18
+ The verifier copies this project to a separate temporary directory, installs the actual package and peer tarballs, checks TypeScript and Node SSR, builds a host-specific standalone entry, and verifies static and offline interactive HTML in fresh browser contexts. It uses no source aliases or repository dependency junctions. See `artifacts/sdk-consumer/verification.json` for the result and consumer directory.
19
+
20
+ For manual development, install the verified tarball in a copy of this directory, install its development dependencies, then run `npm run dev`. The theme stylesheet is loaded explicitly by `main.tsx`. `standalone.ts` is the trusted entry used to restore the same installed implementations in offline output.
21
+
22
+ The runtime does not fetch component code based on document declarations. Host code imports the implementations before mounting. The exporter checks the component contracts, capabilities, theme, and declared resources before producing the HTML.
23
+
24
+ 中文接口说明:[扩展 SDK 预览](../../../docs/integration/extension-sdk-ch.md)。
@@ -1,19 +1,19 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Reactive MD worker compilation</title>
7
- </head>
8
- <body>
9
- <main>
10
- <h1>Worker compilation</h1>
11
- <p>Edit the source; compilation is debounced and runs in a module Worker, falling back to the main thread if needed.</p>
12
- <textarea id="source" rows="12" cols="80" spellcheck="false"></textarea>
13
- <p id="status">Starting...</p>
14
- <pre id="diagnostics"></pre>
15
- <pre id="preview"></pre>
16
- </main>
17
- <script type="module" src="/main.js"></script>
18
- </body>
19
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Reactive MD worker compilation</title>
7
+ </head>
8
+ <body>
9
+ <main>
10
+ <h1>Worker compilation</h1>
11
+ <p>Edit the source; compilation is debounced and runs in a module Worker, falling back to the main thread if needed.</p>
12
+ <textarea id="source" rows="12" cols="80" spellcheck="false"></textarea>
13
+ <p id="status">Starting...</p>
14
+ <pre id="diagnostics"></pre>
15
+ <pre id="preview"></pre>
16
+ </main>
17
+ <script type="module" src="/main.js"></script>
18
+ </body>
19
+ </html>
@@ -1,61 +1,61 @@
1
- import { LocalCompileScheduler } from 'reactive-md';
2
-
3
- const editor = document.getElementById('source');
4
- const status = document.getElementById('status');
5
- const diagnostics = document.getElementById('diagnostics');
6
- const preview = document.getElementById('preview');
7
-
8
- const initialSource = `# Compile in a Worker
9
-
10
- Edits are compiled off the main thread after a short debounce. Keep typing and the status below updates.
11
-
12
- <slider bind="people" label="People" min="1" max="20">`;
13
-
14
- editor.value = initialSource;
15
-
16
- function createWorker() {
17
- return new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
18
- }
19
-
20
- function formatDiagnostics(list) {
21
- return list.length
22
- ? list.map((diagnostic) => `${diagnostic.line}:${diagnostic.column} ${diagnostic.code}: ${diagnostic.message}`).join('\n')
23
- : 'No diagnostics.';
24
- }
25
-
26
- function showResult(outcome) {
27
- const { result, duration, mode } = outcome;
28
- status.textContent = `Compiled in ${duration} ms (${mode})`;
29
- diagnostics.textContent = formatDiagnostics(result.diagnostics);
30
- if (!result.ok) {
31
- preview.textContent = 'No document';
32
- return;
33
- }
34
- const heading = result.document.nodes.find((node) => node.type === 'heading');
35
- const title = heading
36
- ? (heading.children ?? []).map((child) => child.value ?? '').join('') || 'Untitled'
37
- : 'Untitled';
38
- const bindings = Object.keys(result.document.bindings);
39
- preview.textContent = [
40
- `Title: ${title}`,
41
- `Nodes: ${result.document.nodes.length}`,
42
- `Bindings: ${bindings.length ? bindings.join(', ') : 'none'}`,
43
- ].join('\n');
44
- }
45
-
46
- const scheduler = new LocalCompileScheduler({
47
- createWorker,
48
- onResult: showResult,
49
- onPendingChange: (pending) => {
50
- if (pending) status.textContent = 'Compiling...';
51
- },
52
- onModeChange: (mode, detail) => {
53
- status.textContent = mode === 'worker'
54
- ? 'Compiling in a Worker...'
55
- : `Compiling on the main thread${detail ? ` (${detail})` : ''}`;
56
- },
57
- });
58
-
59
- editor.addEventListener('input', () => scheduler.schedule(editor.value));
60
- window.addEventListener('beforeunload', () => scheduler.dispose());
61
- scheduler.schedule(editor.value);
1
+ import { LocalCompileScheduler } from 'reactive-md';
2
+
3
+ const editor = document.getElementById('source');
4
+ const status = document.getElementById('status');
5
+ const diagnostics = document.getElementById('diagnostics');
6
+ const preview = document.getElementById('preview');
7
+
8
+ const initialSource = `# Compile in a Worker
9
+
10
+ Edits are compiled off the main thread after a short debounce. Keep typing and the status below updates.
11
+
12
+ <slider bind="people" label="People" min="1" max="20">`;
13
+
14
+ editor.value = initialSource;
15
+
16
+ function createWorker() {
17
+ return new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
18
+ }
19
+
20
+ function formatDiagnostics(list) {
21
+ return list.length
22
+ ? list.map((diagnostic) => `${diagnostic.line}:${diagnostic.column} ${diagnostic.code}: ${diagnostic.message}`).join('\n')
23
+ : 'No diagnostics.';
24
+ }
25
+
26
+ function showResult(outcome) {
27
+ const { result, duration, mode } = outcome;
28
+ status.textContent = `Compiled in ${duration} ms (${mode})`;
29
+ diagnostics.textContent = formatDiagnostics(result.diagnostics);
30
+ if (!result.ok) {
31
+ preview.textContent = 'No document';
32
+ return;
33
+ }
34
+ const heading = result.document.nodes.find((node) => node.type === 'heading');
35
+ const title = heading
36
+ ? (heading.children ?? []).map((child) => child.value ?? '').join('') || 'Untitled'
37
+ : 'Untitled';
38
+ const bindings = Object.keys(result.document.bindings);
39
+ preview.textContent = [
40
+ `Title: ${title}`,
41
+ `Nodes: ${result.document.nodes.length}`,
42
+ `Bindings: ${bindings.length ? bindings.join(', ') : 'none'}`,
43
+ ].join('\n');
44
+ }
45
+
46
+ const scheduler = new LocalCompileScheduler({
47
+ createWorker,
48
+ onResult: showResult,
49
+ onPendingChange: (pending) => {
50
+ if (pending) status.textContent = 'Compiling...';
51
+ },
52
+ onModeChange: (mode, detail) => {
53
+ status.textContent = mode === 'worker'
54
+ ? 'Compiling in a Worker...'
55
+ : `Compiling on the main thread${detail ? ` (${detail})` : ''}`;
56
+ },
57
+ });
58
+
59
+ editor.addEventListener('input', () => scheduler.schedule(editor.value));
60
+ window.addEventListener('beforeunload', () => scheduler.dispose());
61
+ scheduler.schedule(editor.value);
@@ -1,13 +1,13 @@
1
- {
2
- "name": "reactive-md-worker-example",
3
- "private": true,
4
- "type": "module",
5
- "engines": { "node": ">=22.12.0" },
6
- "scripts": {
7
- "dev": "vite --host 127.0.0.1",
8
- "build": "vite build",
9
- "preview": "vite preview --host 127.0.0.1"
10
- },
11
- "dependencies": { "reactive-md": "0.6.0" },
12
- "devDependencies": { "vite": "^8.3.5" }
13
- }
1
+ {
2
+ "name": "reactive-md-worker-example",
3
+ "private": true,
4
+ "type": "module",
5
+ "engines": { "node": ">=22.12.0" },
6
+ "scripts": {
7
+ "dev": "vite --host 127.0.0.1",
8
+ "build": "vite build",
9
+ "preview": "vite preview --host 127.0.0.1"
10
+ },
11
+ "dependencies": { "reactive-md": "0.6.0" },
12
+ "devDependencies": { "vite": "^8.3.5" }
13
+ }
@@ -1,3 +1,3 @@
1
- import { startLocalCompileWorker } from 'reactive-md';
2
-
3
- startLocalCompileWorker();
1
+ import { startLocalCompileWorker } from 'reactive-md';
2
+
3
+ startLocalCompileWorker();
@@ -1,76 +1,76 @@
1
- # 本地交互语法演示
2
-
3
- **中文** · [English](README.md)
4
-
5
- 这些是 `local-draft-3` 的独立创作示例,说明见[本地交互语法规范](../../docs/reference/local-interaction-syntax-ch.md)。Playground 以[快速计算器](pricing.reactive.md)开始,随后是六个聚焦的[功能演示](showcase/README-ch.md)。组块分布在这六个场景中;诊断有独立的辅助菜单。宿主可通过[本地模式 API](../../docs/integration/local-integration-ch.md) 编译并渲染每份文档。
6
-
7
- 原有的十一个工作示例和一份故意损坏的诊断文档仍保留在本目录,中文版本在 [zh/](zh/)。六个功能演示位于 [showcase/](showcase/README-ch.md),中文源码在 [showcase/zh/](showcase/zh/)。每个文件都可独立运行。控件、表达式和可视化都使用本地状态。
8
-
9
- 新增的 [HTML 兼容示例](html-compat.reactive.md) 组合了富文本 disclosure、Markdown 和绑定计数器。启用作者 CSS、JavaScript 或扩展 HTML 前,请先阅读[临时 HTML 分流政策](../../docs/reference/html-compatibility-ch.md)。
10
-
11
- ## 从简短示例开始
12
-
13
- [工作坊配方](recipes/workshop.reactive.md)([中文](recipes/workshop-zh.reactive.md))组合了跨字段校验、条件色调、数字聚合和生成表格行。规则与预算见[本地交互语法规范](../../docs/reference/local-interaction-syntax-ch.md)。
14
-
15
- [账单配方](recipes/invoice.reactive.md)([中文](recipes/invoice-zh.reactive.md))演示共享计算、常量、格式化和 UTC 日期差。[命名值与格式化](../../docs/reference/local-interaction-syntax-ch.md)解释其规则。
16
-
17
- 从[套餐计算器](pricing.reactive.md)开始,然后选择一个[功能演示](showcase/README-ch.md)。如需最小的状态示例,请阅读最初的[计数器](counter.reactive.md)。如果你刚接触该语法,请阅读[新用户指南](../../docs/guides/local-guide-ch.md)。
18
-
19
- ## 原有独立示例目录
20
-
21
- | 文件 | 内容 |
22
- | --- | --- |
23
- | [counter.reactive.md](counter.reactive.md) | 单行计数器,内置加、减和重置 |
24
- | [pricing.reactive.md](pricing.reactive.md) | 套餐计算器,参数在面板内联动 |
25
- | [comparison.reactive.md](comparison.reactive.md) | 并排比较、就地声明的开关、自行管理选择的标签页 |
26
- | [parameters.reactive.md](parameters.reactive.md) | 实时参数面板,含文本、日期和选项输入 |
27
- | [checklist.reactive.md](checklist.reactive.md) | 固定可勾选列表和增强表格 |
28
- | [charts.reactive.md](charts.reactive.md) | 由表格构建的图表,含 LaTeX 复利公式 |
29
- | [diagram.reactive.md](diagram.reactive.md) | 自动布局的交互图与曲线 |
30
- | [catalog.reactive.md](catalog.reactive.md) | 本地目录搜索、排序和分页 |
31
- | [planning.reactive.md](planning.reactive.md) | 时间线、计时器和分摊计算 |
32
- | [components.reactive.md](components.reactive.md) | 内容卡片、disclosure、标签页和提示组块 |
33
- | [gallery.reactive.md](gallery.reactive.md) | 常用输入、独立组块和原样展示的代码 |
34
- | [diagnostics.reactive.md](diagnostics.reactive.md) | 故意损坏的诊断示例 |
35
-
36
- Playground 的示例索引维护在仓库的演示应用中。
37
-
38
- ## 工作示例的预期行为
39
-
40
- 下表列出每份文档的初始值和交互检查点。数字遵循正文中的公式。
41
-
42
- | 示例 | 初始显示 | 交互检查 |
43
- | --- | --- | --- |
44
- | comparison | Basic 100 USD,Pro 200 USD | 切换年付后变为 80/160;切换标签页无需声明变量;重置后恢复月付 |
45
- | parameters | 日期 2026-10-22、个人用途、名称为空 | 输入名称会更新卡片;选择团队用途会更新描述;勾选开关会显示准备清单;面板重置会恢复字段和开关 |
46
- | checklist | 1/3 项,进度约 33.33% | 全选后显示完成提示;重置只恢复第一项;表格可按价格排序、搜索和分页 |
47
- | charts | 4 项预算对比;储蓄参数 10000、500、5%、20 年;方案柱 40/70 | 利率为 0 时曲线末端读数为 130000;默认复利读数约为 232643.24;5 人时柱为 100/175 |
48
- | diagram | 选中输入节点,a=1,f=1 | 点击计算节点会更新详情和正文;a=0 时曲线变平并出现提示;两条固定曲线同时显示 |
49
- | catalog | 8 行目录,每页 4 行 | 搜索 "visual" 返回 chart/plot/diagram;无匹配时显示空状态;重置会清除查询、排序和页码 |
50
- | planning | 45 分钟时间线,倒计时暂停在 60 秒,每人 88 USD | 计时器启动/暂停/重置;额外费用为 0 时每人支付 80 USD;从 15 开始的参考任务与主段重叠 |
51
- | components | 简明说明,第一个 disclosure 展开 | 选择详细会切换正文;工具提示可通过键盘聚焦;其他 disclosure 可独立展开 |
52
- | pricing | 2 人,每人 100 USD,共 200 USD | 年付为 160 USD;5 人年付为 400 USD 并显示团队提示;重置恢复 200 USD |
53
- | counter | 0 | 三次增量显示 3;三次减量回到 0 并禁用减号;重置回到 0 |
54
- | gallery | Alex、数量 3、Pro、月付、费用 240 USD | 年付为 192 USD;隐藏再显示快递段会保留其勾选;独立计数器和计时器无需 bind;代码块中的 `example` 不会创建变量 |
55
-
56
- 在 parameters 中,条件清单位于面板之外:其现有勾选在隐藏后仍保留,也不在该面板的重置范围内。gallery 中的独立计数器和计时器同样位于输入面板之外,因此重置输入面板不会影响它们。
57
-
58
- ## 诊断示例的预期结果
59
-
60
- [diagnostics.reactive.md](diagnostics.reactive.md) 故意包含以下 9 类错误。编辑器应收集可恢复的独立诊断,整份文档不得激活交互。
61
-
62
- 1. `seat` 未声明;消息可以建议已有的参数 `seats`。
63
- 2. `seats` 有重复的显式初始值;两处来源都会被报告。
64
- 3. `ratio` 的初始值为 12,超过最大值 10。
65
- 4. if.when 收到数字 `seats`,但需要布尔值。
66
- 5. `slidr` 是未知组块;消息可以建议 `slider`。
67
- 6. `on-click` 不属于 counter 或本地交互事件语法。
68
- 7. 边目标 `missing` 不存在。
69
- 8. 积分可以显示,但在第一版 plot 中不是可计算结构。
70
- 9. 图表的 cost 列包含 `20 USD`,即需要纯数字处出现文本。
71
-
72
- ## 检查入口
73
-
74
- `npm test` 检查解析、绑定、表达式、LaTeX、运行时和示例;`npm test (in ReactiveMD-Demo)` 检查 Playground 索引;`npm run check` 运行完整的 Node 端和浏览器门禁,包括实际 tarball 消费和 HTML 导出。各命令见[参与开发指南](../../CONTRIBUTING-ch.md)。
75
-
76
- [六个场景](showcase/README-ch.md)包含全部 49 个标签名:Functions 中的区间、坐标和数值题;Forms 中的输入选项;Data 中的联动选择;Layout 中的跳转和正文颜色;Flow 中的分步引导和选择题;Checklists 中的待办和计时。独立 gallery 和交互演示源文件仍作为创作示例保留。
1
+ # 本地交互语法演示
2
+
3
+ **中文** · [English](README.md)
4
+
5
+ 这些是 `local-draft-3` 的独立创作示例,说明见[本地交互语法规范](../../docs/reference/local-interaction-syntax-ch.md)。Playground 以[快速计算器](pricing.reactive.md)开始,随后是六个聚焦的[功能演示](showcase/README-ch.md)。组块分布在这六个场景中;诊断有独立的辅助菜单。宿主可通过[本地模式 API](../../docs/integration/local-integration-ch.md) 编译并渲染每份文档。
6
+
7
+ 原有的十一个工作示例和一份故意损坏的诊断文档仍保留在本目录,中文版本在 [zh/](zh/)。六个功能演示位于 [showcase/](showcase/README-ch.md),中文源码在 [showcase/zh/](showcase/zh/)。每个文件都可独立运行。控件、表达式和可视化都使用本地状态。
8
+
9
+ 新增的 [HTML 兼容示例](html-compat.reactive.md) 组合了富文本 disclosure、Markdown 和绑定计数器。启用作者 CSS、JavaScript 或扩展 HTML 前,请先阅读[临时 HTML 分流政策](../../docs/reference/html-compatibility-ch.md)。
10
+
11
+ ## 从简短示例开始
12
+
13
+ [工作坊配方](recipes/workshop.reactive.md)([中文](recipes/workshop-zh.reactive.md))组合了跨字段校验、条件色调、数字聚合和生成表格行。规则与预算见[本地交互语法规范](../../docs/reference/local-interaction-syntax-ch.md)。
14
+
15
+ [账单配方](recipes/invoice.reactive.md)([中文](recipes/invoice-zh.reactive.md))演示共享计算、常量、格式化和 UTC 日期差。[命名值与格式化](../../docs/reference/local-interaction-syntax-ch.md)解释其规则。
16
+
17
+ 从[套餐计算器](pricing.reactive.md)开始,然后选择一个[功能演示](showcase/README-ch.md)。如需最小的状态示例,请阅读最初的[计数器](counter.reactive.md)。如果你刚接触该语法,请阅读[新用户指南](../../docs/guides/local-guide-ch.md)。
18
+
19
+ ## 原有独立示例目录
20
+
21
+ | 文件 | 内容 |
22
+ | --- | --- |
23
+ | [counter.reactive.md](counter.reactive.md) | 单行计数器,内置加、减和重置 |
24
+ | [pricing.reactive.md](pricing.reactive.md) | 套餐计算器,参数在面板内联动 |
25
+ | [comparison.reactive.md](comparison.reactive.md) | 并排比较、就地声明的开关、自行管理选择的标签页 |
26
+ | [parameters.reactive.md](parameters.reactive.md) | 实时参数面板,含文本、日期和选项输入 |
27
+ | [checklist.reactive.md](checklist.reactive.md) | 固定可勾选列表和增强表格 |
28
+ | [charts.reactive.md](charts.reactive.md) | 由表格构建的图表,含 LaTeX 复利公式 |
29
+ | [diagram.reactive.md](diagram.reactive.md) | 自动布局的交互图与曲线 |
30
+ | [catalog.reactive.md](catalog.reactive.md) | 本地目录搜索、排序和分页 |
31
+ | [planning.reactive.md](planning.reactive.md) | 时间线、计时器和分摊计算 |
32
+ | [components.reactive.md](components.reactive.md) | 内容卡片、disclosure、标签页和提示组块 |
33
+ | [gallery.reactive.md](gallery.reactive.md) | 常用输入、独立组块和原样展示的代码 |
34
+ | [diagnostics.reactive.md](diagnostics.reactive.md) | 故意损坏的诊断示例 |
35
+
36
+ Playground 的示例索引维护在仓库的演示应用中。
37
+
38
+ ## 工作示例的预期行为
39
+
40
+ 下表列出每份文档的初始值和交互检查点。数字遵循正文中的公式。
41
+
42
+ | 示例 | 初始显示 | 交互检查 |
43
+ | --- | --- | --- |
44
+ | comparison | Basic 100 USD,Pro 200 USD | 切换年付后变为 80/160;切换标签页无需声明变量;重置后恢复月付 |
45
+ | parameters | 日期 2026-10-22、个人用途、名称为空 | 输入名称会更新卡片;选择团队用途会更新描述;勾选开关会显示准备清单;面板重置会恢复字段和开关 |
46
+ | checklist | 1/3 项,进度约 33.33% | 全选后显示完成提示;重置只恢复第一项;表格可按价格排序、搜索和分页 |
47
+ | charts | 4 项预算对比;储蓄参数 10000、500、5%、20 年;方案柱 40/70 | 利率为 0 时曲线末端读数为 130000;默认复利读数约为 232643.24;5 人时柱为 100/175 |
48
+ | diagram | 选中输入节点,a=1,f=1 | 点击计算节点会更新详情和正文;a=0 时曲线变平并出现提示;两条固定曲线同时显示 |
49
+ | catalog | 8 行目录,每页 4 行 | 搜索 "visual" 返回 chart/plot/diagram;无匹配时显示空状态;重置会清除查询、排序和页码 |
50
+ | planning | 45 分钟时间线,倒计时暂停在 60 秒,每人 88 USD | 计时器启动/暂停/重置;额外费用为 0 时每人支付 80 USD;从 15 开始的参考任务与主段重叠 |
51
+ | components | 简明说明,第一个 disclosure 展开 | 选择详细会切换正文;工具提示可通过键盘聚焦;其他 disclosure 可独立展开 |
52
+ | pricing | 2 人,每人 100 USD,共 200 USD | 年付为 160 USD;5 人年付为 400 USD 并显示团队提示;重置恢复 200 USD |
53
+ | counter | 0 | 三次增量显示 3;三次减量回到 0 并禁用减号;重置回到 0 |
54
+ | gallery | Alex、数量 3、Pro、月付、费用 240 USD | 年付为 192 USD;隐藏再显示快递段会保留其勾选;独立计数器和计时器无需 bind;代码块中的 `example` 不会创建变量 |
55
+
56
+ 在 parameters 中,条件清单位于面板之外:其现有勾选在隐藏后仍保留,也不在该面板的重置范围内。gallery 中的独立计数器和计时器同样位于输入面板之外,因此重置输入面板不会影响它们。
57
+
58
+ ## 诊断示例的预期结果
59
+
60
+ [diagnostics.reactive.md](diagnostics.reactive.md) 故意包含以下 9 类错误。编辑器应收集可恢复的独立诊断,整份文档不得激活交互。
61
+
62
+ 1. `seat` 未声明;消息可以建议已有的参数 `seats`。
63
+ 2. `seats` 有重复的显式初始值;两处来源都会被报告。
64
+ 3. `ratio` 的初始值为 12,超过最大值 10。
65
+ 4. if.when 收到数字 `seats`,但需要布尔值。
66
+ 5. `slidr` 是未知组块;消息可以建议 `slider`。
67
+ 6. `on-click` 不属于 counter 或本地交互事件语法。
68
+ 7. 边目标 `missing` 不存在。
69
+ 8. 积分可以显示,但在第一版 plot 中不是可计算结构。
70
+ 9. 图表的 cost 列包含 `20 USD`,即需要纯数字处出现文本。
71
+
72
+ ## 检查入口
73
+
74
+ `npm test` 检查解析、绑定、表达式、LaTeX、运行时和示例;`npm test (in ReactiveMD-Demo)` 检查 Playground 索引;`npm run check` 运行完整的 Node 端和浏览器门禁,包括实际 tarball 消费和 HTML 导出。各命令见[参与开发指南](../../CONTRIBUTING-ch.md)。
75
+
76
+ [六个场景](showcase/README-ch.md)包含全部 49 个标签名:Functions 中的区间、坐标和数值题;Forms 中的输入选项;Data 中的联动选择;Layout 中的跳转和正文颜色;Flow 中的分步引导和选择题;Checklists 中的待办和计时。独立 gallery 和交互演示源文件仍作为创作示例保留。