reactive-md 0.3.1 → 0.4.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.
Files changed (172) hide show
  1. package/CHANGELOG-ch.md +96 -0
  2. package/CHANGELOG.md +82 -39
  3. package/CONTRIBUTING-ch.md +62 -0
  4. package/CONTRIBUTING.md +64 -65
  5. package/README-ch.md +122 -0
  6. package/README-en.md +146 -0
  7. package/README.md +146 -89
  8. package/SECURITY-ch.md +80 -0
  9. package/SECURITY.md +58 -49
  10. package/THIRD_PARTY_NOTICES.md +85 -1
  11. package/bin/reactive-md.mjs +40 -0
  12. package/cli/args.mjs +181 -0
  13. package/cli/assets.mjs +390 -0
  14. package/cli/build.mjs +268 -0
  15. package/cli/document.mjs +130 -0
  16. package/cli/errors.mjs +61 -0
  17. package/cli/fs-utils.mjs +133 -0
  18. package/cli/glob.mjs +203 -0
  19. package/cli/help.mjs +138 -0
  20. package/cli/lint.mjs +177 -0
  21. package/cli/main.mjs +55 -0
  22. package/cli/migrate.mjs +368 -0
  23. package/cli/package.mjs +209 -0
  24. package/dist-library/reactive-md-react.js +3425 -1647
  25. package/dist-library/reactive-md.css +1 -1
  26. package/dist-library/reactive-md.js +1798 -4
  27. package/dist-library/runtime-DtjdPXxJ.js +15410 -0
  28. package/dist-library/types/index.d.ts +1 -0
  29. package/dist-library/types/local/LocalDocumentView.d.ts +66 -3
  30. package/dist-library/types/local/authoring.d.ts +63 -0
  31. package/dist-library/types/local/collection-functions.d.ts +4 -0
  32. package/dist-library/types/local/colors.d.ts +2 -0
  33. package/dist-library/types/local/computations.d.ts +53 -0
  34. package/dist-library/types/local/data-functions.d.ts +22 -0
  35. package/dist-library/types/local/data-table.d.ts +65 -0
  36. package/dist-library/types/local/dates.d.ts +2 -0
  37. package/dist-library/types/local/dependencies.d.ts +31 -0
  38. package/dist-library/types/local/diagnostics.d.ts +1450 -0
  39. package/dist-library/types/local/expression.d.ts +13 -3
  40. package/dist-library/types/local/formatting.d.ts +41 -0
  41. package/dist-library/types/local/heading-anchors.d.ts +13 -2
  42. package/dist-library/types/local/i18n.d.ts +18 -0
  43. package/dist-library/types/local/index.d.ts +18 -1
  44. package/dist-library/types/local/limits.d.ts +32 -1
  45. package/dist-library/types/local/locale.d.ts +1 -0
  46. package/dist-library/types/local/math.d.ts +6 -1
  47. package/dist-library/types/local/parser.d.ts +10 -4
  48. package/dist-library/types/local/render-types.d.ts +5 -1
  49. package/dist-library/types/local/retention.d.ts +23 -0
  50. package/dist-library/types/local/schema.d.ts +25 -3
  51. package/dist-library/types/local/source-migration.d.ts +35 -0
  52. package/dist-library/types/local/state.d.ts +80 -0
  53. package/dist-library/types/local/text-length.d.ts +13 -0
  54. package/dist-library/types/local/theme.d.ts +30 -0
  55. package/dist-library/types/local/types.d.ts +112 -4
  56. package/dist-library/types/local/validation.d.ts +32 -0
  57. package/dist-library/types/local/version.d.ts +1 -1
  58. package/dist-library/types/local/worker.d.ts +82 -0
  59. package/dist-library/types/react/index.d.ts +4 -1
  60. package/dist-library/types/shareable.d.ts +64 -0
  61. package/dist-standalone/reactive-md-standalone.css +2 -0
  62. package/dist-standalone/reactive-md-standalone.js +57 -0
  63. package/docs/author-tools-ch.md +56 -0
  64. package/docs/author-tools-en.md +56 -0
  65. package/docs/compatibility-ch.md +103 -0
  66. package/docs/compatibility-en.md +103 -0
  67. package/docs/{component-development.md → component-development-ch.md} +210 -206
  68. package/docs/component-development-en.md +210 -0
  69. package/docs/{component-protocol.md → component-protocol-ch.md} +710 -685
  70. package/docs/component-protocol-en.md +710 -0
  71. package/docs/computations-formatting-ch.md +87 -0
  72. package/docs/computations-formatting-en.md +87 -0
  73. package/docs/constraints-collections-ch.md +84 -0
  74. package/docs/constraints-collections-en.md +84 -0
  75. package/docs/diagnostics-counting-ch.md +84 -0
  76. package/docs/diagnostics-counting-en.md +84 -0
  77. package/docs/local-components-v2-ch.md +138 -0
  78. package/docs/local-components-v2-en.md +104 -0
  79. package/docs/{local-guide.md → local-guide-ch.md} +28 -8
  80. package/docs/local-guide-en.md +961 -0
  81. package/docs/local-integration-ch.md +363 -0
  82. package/docs/local-integration-en.md +363 -0
  83. package/docs/{local-interaction-syntax.md → local-interaction-syntax-ch.md} +66 -20
  84. package/docs/local-interaction-syntax-en.md +483 -0
  85. package/docs/{performance.md → performance-ch.md} +12 -3
  86. package/docs/performance-en.md +76 -0
  87. package/docs/release-0.4.0-ch.md +89 -0
  88. package/docs/release-0.4.0-en.md +89 -0
  89. package/docs/releasing-ch.md +101 -0
  90. package/docs/releasing-en.md +101 -0
  91. package/docs/shareable-export-ch.md +205 -0
  92. package/docs/shareable-export-en.md +207 -0
  93. package/docs/source-versioning-ch.md +159 -0
  94. package/docs/source-versioning-en.md +159 -0
  95. package/docs/theme-protocol-ch.md +107 -0
  96. package/docs/theme-protocol-en.md +107 -0
  97. package/examples/conformance/README.md +33 -31
  98. package/examples/conformance/component-protocol-1.json +482 -194
  99. package/examples/conformance/component-protocol-1.schema.json +76 -76
  100. package/examples/conformance/history/v0.3.1/catalog.reactive.md +20 -0
  101. package/examples/conformance/history/v0.3.1/charts.reactive.md +73 -0
  102. package/examples/conformance/history/v0.3.1/checklist.reactive.md +32 -0
  103. package/examples/conformance/history/v0.3.1/comparison.reactive.md +47 -0
  104. package/examples/conformance/history/v0.3.1/components.reactive.md +44 -0
  105. package/examples/conformance/history/v0.3.1/counter.reactive.md +7 -0
  106. package/examples/conformance/history/v0.3.1/diagnostics.reactive.md +54 -0
  107. package/examples/conformance/history/v0.3.1/diagram.reactive.md +44 -0
  108. package/examples/conformance/history/v0.3.1/gallery.reactive.md +61 -0
  109. package/examples/conformance/history/v0.3.1/local-draft-1.json +50 -0
  110. package/examples/conformance/history/v0.3.1/parameters.reactive.md +36 -0
  111. package/examples/conformance/history/v0.3.1/planning.reactive.md +24 -0
  112. package/examples/conformance/history/v0.3.1/pricing.reactive.md +20 -0
  113. package/examples/conformance/history/v0.3.1/provenance.json +72 -0
  114. package/examples/conformance/local-draft-2.json +212 -0
  115. package/examples/integration/README.md +45 -29
  116. package/examples/integration/core/index.mjs +32 -19
  117. package/examples/integration/react/index.html +1 -1
  118. package/examples/integration/react/main.jsx +5 -5
  119. package/examples/integration/worker/index.html +19 -0
  120. package/examples/integration/worker/main.js +61 -0
  121. package/examples/integration/worker/package.json +13 -0
  122. package/examples/integration/worker/worker.js +3 -0
  123. package/examples/local/README.md +64 -58
  124. package/examples/local/catalog.reactive.md +14 -14
  125. package/examples/local/charts.reactive.md +34 -34
  126. package/examples/local/checklist.reactive.md +19 -19
  127. package/examples/local/comparison.reactive.md +23 -23
  128. package/examples/local/components.reactive.md +20 -20
  129. package/examples/local/counter.reactive.md +4 -4
  130. package/examples/local/diagnostics.reactive.md +25 -25
  131. package/examples/local/diagram.reactive.md +20 -20
  132. package/examples/local/gallery.reactive.md +31 -31
  133. package/examples/local/parameters.reactive.md +19 -19
  134. package/examples/local/planning.reactive.md +15 -15
  135. package/examples/local/pricing.reactive.md +10 -10
  136. package/examples/local/recipes/invoice-zh.reactive.md +36 -0
  137. package/examples/local/recipes/invoice.reactive.md +36 -0
  138. package/examples/local/recipes/workshop-zh.reactive.md +33 -0
  139. package/examples/local/recipes/workshop.reactive.md +33 -0
  140. package/examples/local/showcase/README.md +25 -0
  141. package/examples/local/showcase/explore.reactive.md +102 -0
  142. package/examples/local/showcase/flow.reactive.md +86 -0
  143. package/examples/local/showcase/forms.reactive.md +126 -0
  144. package/examples/local/showcase/functions.reactive.md +119 -0
  145. package/examples/local/showcase/layout.reactive.md +100 -0
  146. package/examples/local/showcase/statistics.reactive.md +108 -0
  147. package/examples/local/showcase/tasks.reactive.md +89 -0
  148. package/examples/local/showcase/zh/explore.reactive.md +102 -0
  149. package/examples/local/showcase/zh/flow.reactive.md +86 -0
  150. package/examples/local/showcase/zh/forms.reactive.md +126 -0
  151. package/examples/local/showcase/zh/functions.reactive.md +119 -0
  152. package/examples/local/showcase/zh/layout.reactive.md +100 -0
  153. package/examples/local/showcase/zh/statistics.reactive.md +108 -0
  154. package/examples/local/showcase/zh/tasks.reactive.md +89 -0
  155. package/examples/local/zh/catalog.reactive.md +20 -0
  156. package/examples/local/zh/charts.reactive.md +73 -0
  157. package/examples/local/zh/checklist.reactive.md +32 -0
  158. package/examples/local/zh/comparison.reactive.md +47 -0
  159. package/examples/local/zh/components.reactive.md +44 -0
  160. package/examples/local/zh/counter.reactive.md +7 -0
  161. package/examples/local/zh/diagnostics.reactive.md +54 -0
  162. package/examples/local/zh/diagram.reactive.md +44 -0
  163. package/examples/local/zh/gallery.reactive.md +61 -0
  164. package/examples/local/zh/parameters.reactive.md +36 -0
  165. package/examples/local/zh/planning.reactive.md +24 -0
  166. package/examples/local/zh/pricing.reactive.md +20 -0
  167. package/package.json +16 -3
  168. package/README.en.md +0 -76
  169. package/dist-library/runtime-CPzMEMcW.js +0 -11111
  170. package/docs/compatibility.md +0 -68
  171. package/docs/local-integration.md +0 -218
  172. package/docs/releasing.md +0 -92
@@ -1,66 +1,72 @@
1
- # 本地交互语法 Demo
1
+ # Local interaction syntax demo
2
2
 
3
- 这些文件是 `local-draft-1` 的完整作者示例,对应 [本地交互语法规范](../../docs/local-interaction-syntax.md)。第一次接触语法时,先读 [新用户入门指南](../../docs/local-guide.md)。Playground 直接加载本目录;宿主通过 [本地模式 API](../../docs/local-integration.md) 编译和渲染。
3
+ These are standalone authoring examples for `local-draft-2`, described in the [local interaction syntax specification](../../docs/local-interaction-syntax-en.md). The Playground starts with a [quick calculator](pricing.reactive.md), followed by six focused [feature tours](showcase/README.md). Components are distributed across these six scenarios; diagnostics has an auxiliary menu. Hosts can compile and render every document through the [local mode API](../../docs/local-integration-en.md).
4
4
 
5
- 本目录有 11 份正常示例、1 份故意含错的诊断示例。每份文件独立使用,不共享参数。正常示例均没有 YAML 配置、命名动作、事件处理或外部调用。
5
+ The original eleven working examples and one intentionally broken diagnostics document remain in this directory, with Chinese versions in [zh/](zh/). The six feature tours live in [showcase/](showcase/README.md), with Chinese sources in [showcase/zh/](showcase/zh/). Each file runs independently. Controls, expressions and visualizations use local state.
6
6
 
7
- ## 从短示例开始
7
+ ## Start with the short examples
8
8
 
9
- 建议先看 [计数器](counter.reactive.md)、[方案计算器](pricing.reactive.md) 和 [交互图解](diagram.reactive.md),再看较长的图表与参数面板。日常写作只需用到其中少数组件。
9
+ The [workshop recipe](recipes/workshop.reactive.md) ([中文](recipes/workshop-zh.reactive.md)) combines cross-field validation, conditional tones, numeric aggregates and generated table rows. See the [constraints and collections reference](../../docs/constraints-collections-en.md) for rules and budgets.
10
10
 
11
- ## 完整目录
11
+ The [invoice recipe](recipes/invoice.reactive.md) ([中文](recipes/invoice-zh.reactive.md)) demonstrates shared calculations, constants, formatting and UTC date differences. The [calculation reference](../../docs/computations-formatting-en.md) explains its rules.
12
12
 
13
- | 文件 | 内容 |
13
+ Start with the [plan calculator](pricing.reactive.md), then choose a [feature tour](showcase/README.md). For the smallest possible state example, read the original [counter](counter.reactive.md). If you are new to the syntax, read the [new user guide](../../docs/local-guide-en.md).
14
+
15
+ ## Original standalone catalog
16
+
17
+ | File | Contents |
14
18
  | --- | --- |
15
- | [counter.reactive.md](counter.reactive.md) | 一行计数器,自带加、减和重置 |
16
- | [pricing.reactive.md](pricing.reactive.md) | 方案计算器,面板内参数联动 |
17
- | [comparison.reactive.md](comparison.reactive.md) | 并排比较,开关就地声明,标签页内部管理选择 |
18
- | [parameters.reactive.md](parameters.reactive.md) | 实时参数面板,含输入、日期和选择器 |
19
- | [checklist.reactive.md](checklist.reactive.md) | 固定可勾选清单与增强表格 |
20
- | [charts.reactive.md](charts.reactive.md) | 表格生成图表,复利公式使用 LaTeX |
21
- | [diagram.reactive.md](diagram.reactive.md) | 自动布局的交互图解与曲线 |
22
- | [catalog.reactive.md](catalog.reactive.md) | 本地目录搜索、排序和分页 |
23
- | [planning.reactive.md](planning.reactive.md) | 时间轴、计时器与分账计算 |
24
- | [components.reactive.md](components.reactive.md) | 内容卡片、折叠、标签页与提示组件 |
25
- | [gallery.reactive.md](gallery.reactive.md) | 常用输入、独立组件和原样代码 |
26
- | [diagnostics.reactive.md](diagnostics.reactive.md) | 故意含错的诊断示例 |
27
-
28
- Playground 的示例索引位于仓库中的 [demo/src/examples.ts](https://github.com/yao1145/ReactiveMD/blob/main/demo/src/examples.ts)。
29
-
30
- ## 正常示例的预期行为
31
-
32
- 下表列出每份文档的初值与交互验收点。数值按正文公式计算。
33
-
34
- | 示例 | 初始显示 | 交互检查 |
19
+ | [counter.reactive.md](counter.reactive.md) | One-line counter with built-in plus, minus and reset |
20
+ | [pricing.reactive.md](pricing.reactive.md) | Plan calculator with parameters linked inside a panel |
21
+ | [comparison.reactive.md](comparison.reactive.md) | Side-by-side comparison, a switch declared in place, tabs that manage their own selection |
22
+ | [parameters.reactive.md](parameters.reactive.md) | Live parameter panel with text, date and choice inputs |
23
+ | [checklist.reactive.md](checklist.reactive.md) | Fixed checkable list and an enhanced table |
24
+ | [charts.reactive.md](charts.reactive.md) | Charts built from tables, with a compound-interest formula in LaTeX |
25
+ | [diagram.reactive.md](diagram.reactive.md) | Auto-laid-out interactive diagram and curves |
26
+ | [catalog.reactive.md](catalog.reactive.md) | Local catalog search, sorting and paging |
27
+ | [planning.reactive.md](planning.reactive.md) | Timeline, timer and bill-splitting calculation |
28
+ | [components.reactive.md](components.reactive.md) | Content cards, disclosures, tabs and hint components |
29
+ | [gallery.reactive.md](gallery.reactive.md) | Common inputs, standalone components and code shown as-is |
30
+ | [diagnostics.reactive.md](diagnostics.reactive.md) | Intentionally broken diagnostics example |
31
+
32
+ The Playground example index is maintained in the repository's demo application.
33
+
34
+ ## Expected behavior of the working examples
35
+
36
+ The table below lists the initial values and interaction checkpoints for each document. Numbers follow the formulas in the prose.
37
+
38
+ | Example | Initial display | Interaction checks |
35
39
  | --- | --- | --- |
36
- | comparison | 基础 100 元,专业 200 元 | 开启年度付款变为 80/160;切换标签页不用声明变量;恢复默认回到月付 |
37
- | parameters | 日期 2026-10-22,个人使用,称呼未填 | 输入称呼更新卡片;选择团队更新说明;勾选开关显示准备清单;面板重置恢复字段和开关 |
38
- | checklist | 1/3 项,进度约 33.33% | 全选后显示完成提示;重置恢复仅第一项勾选;表格按价格排序、搜索和分页 |
39
- | charts | 4 组预算比较;储蓄参数 10000、500、5%、20 年;方案柱高 40/70 | 利率调为 0 时曲线末端读数 130000;默认复利末端读数约 232643.24;人数调为 5 时柱高 100/175 |
40
- | diagram | 选中输入节点,a=1、f=1 | 点击计算节点更新详情和正文;a=0 时曲线变平并出现提示;两条固定曲线同时显示 |
41
- | catalog | 8 行目录,每页 4 行 | 搜索“视觉”得到 chart/plot/diagram;无匹配显示空态;恢复默认清空查询、排序和页码 |
42
- | planning | 45 分钟时间轴,倒计时暂停在 60 秒,每人 88 元 | timer 开始/暂停/重置;额外费用改为 0 时每人 80 元;开始 15 的参考任务与主体时间重叠 |
43
- | components | 简洁说明,首个折叠项展开 | 选择详细后切换正文;提示可用键盘聚焦;其他折叠项独立展开 |
44
- | pricing | 2 人,每人 100 元,合计 200 元 | 年付后 160 元;年付 5 人为 400 元且显示团队提示;重置回到 200 元 |
45
- | counter | 0 | 连续加三次显示 3;减三次回到 0 后禁用减号;重置回到 0 |
46
- | gallery | 小林、数量 3、专业版、月付,费用 240 元 | 年付后 192 元;加急区隐藏再出现保留勾选;独立计数器和计时器无需 bind;代码中的 example 不生成变量 |
47
-
48
- parameters 中条件清单位于面板外:它的已有勾选在隐藏后保留,不属于该面板的重置范围。gallery 的独立计数器与计时器也位于输入面板外,输入面板重置不影响它们。
49
-
50
- ## 诊断示例的预期结果
51
-
52
- [diagnostics.reactive.md](diagnostics.reactive.md) 故意包含以下 9 类错误。编辑器应收集可恢复的独立诊断,文件整体不能激活交互。
53
-
54
- 1. `seat` 未声明,可提示已有参数 `seats`。
55
- 2. `seats` 的显式 initial 重复,指出两处来源。
56
- 3. `ratio` 初值 12 超过最大值 10。
57
- 4. if.when 的 `seats` 为数字,要求布尔值。
58
- 5. `slidr` 是未知组件,可提示 slider。
59
- 6. `on-click` 不属于 counter,也不属于本地交互事件语法。
60
- 7. edge 的目标 `missing` 不存在。
61
- 8. 积分可以显示,但不属于首版绘图的可计算结构。
62
- 9. 图表费用列的 `20 元` 是文本,需要纯数值。
63
-
64
- ## 检查入口
65
-
66
- `npm test` 检查解析、绑定、表达式、LaTeX、运行时和示例;`npm run test:demo` 检查 Playground 索引;启动应用后用 `npm run test:browser` 检查实际交互。`npm run test:docs` 检查文档链接。实际运行结果见[仓库实现说明](https://github.com/yao1145/ReactiveMD/blob/main/demo/IMPLEMENTATION.md)。
40
+ | comparison | Basic 100 USD, Pro 200 USD | Annual billing changes them to 80/160; switching tabs needs no declared variable; reset returns to monthly billing |
41
+ | parameters | Date 2026-10-22, personal use, name empty | Entering a name updates the card; selecting team use updates the description; checking the switch shows the preparation checklist; panel reset restores fields and switches |
42
+ | checklist | 1/3 items, progress about 33.33% | Selecting all shows the completion notice; reset restores only the first item; the table sorts by price, searches and pages |
43
+ | charts | 4 budget comparisons; savings parameters 10000, 500, 5%, 20 years; plan bars 40/70 | With the rate at 0 the end-of-curve readout is 130000; the default compound readout is about 232643.24; with 5 people the bars are 100/175 |
44
+ | diagram | Input node selected, a=1, f=1 | Clicking the compute node updates the details and prose; at a=0 the curve flattens and a notice appears; both fixed curves are shown together |
45
+ | catalog | 8 catalog rows, 4 rows per page | Searching for "visual" returns chart/plot/diagram; no match shows the empty state; reset clears the query, sorting and page |
46
+ | planning | 45-minute timeline, countdown paused at 60 seconds, 88 USD per person | timer start/pause/reset; with the extra charge at 0 each person pays 80 USD; the reference task starting at 15 overlaps the main section |
47
+ | components | Concise explanation, first disclosure open | Selecting detailed switches the prose; the tooltip is keyboard-focusable; other disclosures open independently |
48
+ | pricing | 2 people, 100 USD each, 200 USD total | Annual billing gives 160 USD; annual billing for 5 people is 400 USD and shows the team notice; reset returns to 200 USD |
49
+ | counter | 0 | Three increments show 3; three decrements return to 0 and disable minus; reset returns to 0 |
50
+ | gallery | Alex, quantity 3, Pro, monthly billing, cost 240 USD | Annual billing gives 192 USD; hiding and showing the express section keeps its checks; the standalone counter and timer need no bind; `example` in the code block creates no variable |
51
+
52
+ In parameters, the conditional checklist sits outside the panel: its existing checks survive hiding and are outside that panel's reset scope. The standalone counter and timer in gallery also sit outside the input panel, so resetting the input panel does not affect them.
53
+
54
+ ## Expected results of the diagnostics example
55
+
56
+ [diagnostics.reactive.md](diagnostics.reactive.md) intentionally contains the following 9 error classes. The editor should collect recoverable, independent diagnostics, and the document as a whole must not activate interactions.
57
+
58
+ 1. `seat` is not declared; the message can suggest the existing parameter `seats`.
59
+ 2. `seats` has a duplicate explicit initial; both sources are reported.
60
+ 3. `ratio` has initial value 12, above the maximum 10.
61
+ 4. if.when receives `seats`, a number, where a boolean is required.
62
+ 5. `slidr` is an unknown component; the message can suggest `slider`.
63
+ 6. `on-click` is not part of counter or the local interaction event syntax.
64
+ 7. The edge target `missing` does not exist.
65
+ 8. The integral can be displayed but is not a computable structure in the first plot version.
66
+ 9. The chart's cost column contains `20 USD`, text where a plain number is required.
67
+
68
+ ## Check entry points
69
+
70
+ `npm test` checks parsing, bindings, expressions, LaTeX, the runtime and examples; `npm run test:demo` checks the Playground index; `npm run verify:release` runs the complete Node-side and browser gate, including real-tarball consumption and HTML export. See the [contributing guide](../../CONTRIBUTING.md) for individual commands.
71
+
72
+ The [six scenarios](showcase/README.md) include all 48 tag names: intervals, coordinates and numeric questions in Functions; input choices in Forms; linked selection in Data; jumps and prose colors in Layout; guided steps and choice questions in Flow; todos and timing in Checklists. The standalone gallery and interaction-tour sources remain available as authoring examples.
@@ -1,20 +1,20 @@
1
- # 在文档里查找组件
1
+ # Find components in the document
2
2
 
3
- 在表格的搜索框输入“视觉”“参数”或其他关键词。点击列名可以排序,分页控件用于翻页。
3
+ Type "visual", "input" or another keyword into the search box above the table. Click a column name to sort, and use the paging controls to move between pages.
4
4
 
5
- <panel title="本地组件目录">
6
- <table label="组件目录" page-size="4">
7
- | 名称 | 分类 | 用途 |
5
+ <panel title="Local component catalog">
6
+ <table label="Component catalog" page-size="4">
7
+ | Name | Category | Purpose |
8
8
  | --- | --- | --- |
9
- | slider | 参数 | 拖动调整数字 |
10
- | toggle | 参数 | 切换开关 |
11
- | choices | 参数 | 从几个方案中选择 |
12
- | chart | 视觉 | 把 Markdown 表格变成图表 |
13
- | plot | 视觉 | 使用 LaTeX 绘制函数 |
14
- | diagram | 视觉 | 点击节点探索说明 |
15
- | checklist | 内容 | 勾选完成事项 |
16
- | timer | 工具 | 开始、暂停和重置倒计时 |
9
+ | slider | Input | Drag to adjust a number |
10
+ | toggle | Input | Flip a switch |
11
+ | choices | Input | Pick from a few options |
12
+ | chart | Visual | Turn a Markdown table into a chart |
13
+ | plot | Visual | Draw a function with LaTeX |
14
+ | diagram | Visual | Select nodes to explore explanations |
15
+ | checklist | Content | Tick off completed items |
16
+ | timer | Utility | Start, pause and reset a countdown |
17
17
  </table>
18
18
  </panel>
19
19
 
20
- 目录数据就在这份文档中。搜索时直接筛选表格内容,恢复默认会清空查询并回到原始顺序。
20
+ The catalog data lives in this document. Searching filters the table directly, and restoring the defaults clears the query and returns to the original order.
@@ -1,28 +1,28 @@
1
- # 图表跟着输入变化
1
+ # Charts follow their inputs
2
2
 
3
- ## 多系列预算比较
3
+ ## Comparing several budget series
4
4
 
5
- <chart title="实际费用与预算" y-label="元">
6
- | 项目 | 实际费用 | 预算 |
5
+ <chart title="Actual cost vs budget" y-label="USD">
6
+ | Category | Actual cost | Budget |
7
7
  | --- | ---: | ---: |
8
- | 内容 | 120 | 150 |
9
- | 视觉 | 230 | 200 |
10
- | 交互 | 180 | 220 |
11
- | 测试 | 90 | 120 |
8
+ | Content | 120 | 150 |
9
+ | Visual | 230 | 200 |
10
+ | Interaction | 180 | 220 |
11
+ | Testing | 90 | 120 |
12
12
  </chart>
13
13
 
14
- ## 储蓄曲线
14
+ ## Savings curve
15
15
 
16
- 每月末存入固定金额,按固定年利率、每月复利计算。$P$ 为初始金额,$m$ 为每月存入金额,$r$ 为年利率的百分数。
16
+ Deposit a fixed amount at the end of every month, compounded monthly at a fixed annual rate. $P$ is the initial amount, $m$ is the monthly deposit, and $r$ is the annual rate in percent.
17
17
 
18
- <panel title="调整储蓄参数">
19
- <number bind="P" label="初始金额" initial="10000" min="0" step="100">
20
- <number bind="m" label="每月存入" initial="500" min="0" step="100">
21
- <slider bind="r" label="年利率(%)" initial="5" min="0" max="10" step="0.5">
22
- <slider bind="t" label="年数" initial="20" min="1" max="40">
18
+ <panel title="Adjust savings parameters">
19
+ <number bind="P" label="Initial amount" initial="10000" min="0" step="100">
20
+ <number bind="m" label="Monthly deposit" initial="500" min="0" step="100">
21
+ <slider bind="r" label="Annual rate (%)" initial="5" min="0" max="10" step="0.5">
22
+ <slider bind="t" label="Years" initial="20" min="1" max="40">
23
23
  </panel>
24
24
 
25
- <plot min="0" max="{{ t }}" label="储蓄增长曲线" x-label="年" y-label="金额">
25
+ <plot min="0" max="{{ t }}" label="Savings growth" x-label="Years" y-label="Amount">
26
26
  $$
27
27
  y =
28
28
  \begin{cases}
@@ -33,25 +33,25 @@ P\left(1+\frac{r}{1200}\right)^{12x}
33
33
  $$
34
34
  </plot>
35
35
 
36
- 把指针移到曲线末端,可以读取第 {{ t }} 年的期末金额。将年利率调到 0,可以比较只存入本金时的变化。
36
+ Move the pointer to the end of the curve to read the balance at the end of year {{ t }}. Set the annual rate to 0 to compare growth from deposits alone.
37
37
 
38
- ## 占比与散点
38
+ ## Shares and scatter
39
39
 
40
40
  <grid>
41
- <card title="费用占比">
42
- <chart kind="donut" title="各项实际费用占比">
43
- | 项目 | 实际费用 |
41
+ <card title="Cost share">
42
+ <chart kind="donut" title="Share of actual cost">
43
+ | Category | Actual cost |
44
44
  | --- | ---: |
45
- | 内容 | 120 |
46
- | 视觉 | 230 |
47
- | 交互 | 180 |
48
- | 测试 | 90 |
45
+ | Content | 120 |
46
+ | Visual | 230 |
47
+ | Interaction | 180 |
48
+ | Testing | 90 |
49
49
  </chart>
50
50
  </card>
51
51
 
52
- <card title="预算与实际">
53
- <chart kind="scatter" title="预算散点" x="预算" y="实际" x-label="预算" y-label="实际">
54
- | 预算 | 实际 |
52
+ <card title="Budget vs actual">
53
+ <chart kind="scatter" title="Budget scatter" x="Budget" y="Actual" x-label="Budget" y-label="Actual">
54
+ | Budget | Actual |
55
55
  | ---: | ---: |
56
56
  | 150 | 120 |
57
57
  | 200 | 230 |
@@ -61,13 +61,13 @@ $$
61
61
  </card>
62
62
  </grid>
63
63
 
64
- ## 图表读取同一份参数
64
+ ## Charts read the same parameters
65
65
 
66
- <slider bind="people" label="人数" initial="2" min="1" max="20">
66
+ <slider bind="people" label="People" initial="2" min="1" max="20">
67
67
 
68
- <chart title="按人数比较方案费用" y-label="元">
69
- | 方案 | 每月费用 |
68
+ <chart title="Plan cost by headcount" y-label="USD">
69
+ | Plan | Monthly cost |
70
70
  | --- | ---: |
71
- | 基础版 | {{ people * 20 }} |
72
- | 专业版 | {{ people * 35 }} |
71
+ | Basic | {{ people * 20 }} |
72
+ | Pro | {{ people * 35 }} |
73
73
  </chart>
@@ -1,32 +1,32 @@
1
- # 用清单组织体验过程
1
+ # Organize a walkthrough with a checklist
2
2
 
3
- <panel title="体验清单">
4
- <checklist bind="done" label="完成这些操作">
5
- - [x] 读懂源文档
6
- - [ ] 调整参数并观察结果
7
- - [ ] 在手机宽度试用
3
+ <panel title="Walkthrough checklist">
4
+ <checklist bind="done" label="Complete these steps">
5
+ - [x] Read the source document
6
+ - [ ] Adjust parameters and watch the results
7
+ - [ ] Try it at phone width
8
8
  </checklist>
9
9
 
10
- 已完成 **{{ len(done) }} / 3** 项。
10
+ Done: **{{ len(done) }} / 3**.
11
11
 
12
- <progress label="完成进度" value="{{ len(done) / 3 * 100 }}">
12
+ <progress label="Completion" value="{{ len(done) / 3 * 100 }}">
13
13
 
14
14
  <if when="{{ len(done) == 3 }}">
15
- <alert tone="success" title="体验完成">
16
- 你已经看过源码、试过交互,也检查了窄屏效果。
15
+ <alert tone="success" title="Walkthrough complete">
16
+ You have read the source, tried the interactions and checked the narrow layout.
17
17
  </alert>
18
18
  </if>
19
19
  </panel>
20
20
 
21
- ## 搜索、排序和分页
21
+ ## Search, sorting and paging
22
22
 
23
- <table label="组件费用示例" page-size="3">
24
- | 名称 | 分类 | 价格 |
23
+ <table label="Component price examples" page-size="3">
24
+ | Name | Category | Price |
25
25
  | --- | --- | ---: |
26
- | 文档 | 基础 | 20 |
27
- | 参数面板 | 输入 | 45 |
28
- | 图表 | 视觉 | 80 |
29
- | 图解 | 视觉 | 65 |
30
- | 清单 | 基础 | 30 |
31
- | 计划 | 工具 | 35 |
26
+ | Document | Basic | 20 |
27
+ | Parameter panel | Input | 45 |
28
+ | Chart | Visual | 80 |
29
+ | Diagram | Visual | 65 |
30
+ | Checklist | Basic | 30 |
31
+ | Plan | Utility | 35 |
32
32
  </table>
@@ -1,47 +1,47 @@
1
- # 放在一起,比较更清楚
1
+ # Side by side, easier to compare
2
2
 
3
- <panel title="付款方式">
4
- <toggle bind="annual" label="按年付款,享受八折">
3
+ <panel title="Payment method">
4
+ <toggle bind="annual" label="Pay annually and save 20%">
5
5
  </panel>
6
6
 
7
7
  <grid>
8
- <card title="基础方案">
9
- 适合个人与小型项目。
8
+ <card title="Basic plan">
9
+ For individuals and small projects.
10
10
 
11
- 每月 **{{ annual ? 80 : 100 }} 元**。
11
+ **{{ annual ? 80 : 100 }} USD per month**.
12
12
 
13
- <badge>本地文档</badge>
13
+ <badge>Local documents</badge>
14
14
  </card>
15
15
 
16
- <card title="专业方案">
17
- 适合需要协作与扩展的团队。
16
+ <card title="Pro plan">
17
+ For teams that need collaboration and room to grow.
18
18
 
19
- 每月 **{{ annual ? 160 : 200 }} 元**。
19
+ **{{ annual ? 160 : 200 }} USD per month**.
20
20
 
21
- <badge tone="success">更多组件</badge>
21
+ <badge tone="success">More components</badge>
22
22
  </card>
23
23
  </grid>
24
24
 
25
- <tabs label="方案说明">
26
- <tab label="功能比较">
27
- | 能力 | 基础方案 | 专业方案 |
25
+ <tabs label="Plan details">
26
+ <tab label="Feature comparison">
27
+ | Capability | Basic plan | Pro plan |
28
28
  | --- | --- | --- |
29
- | 参数调整 | 支持 | 支持 |
30
- | 文本联动 | 支持 | 支持 |
31
- | 内容组织 | 基础排版 | 图表与图解 |
29
+ | Parameter adjustment | Included | Included |
30
+ | Text binding | Included | Included |
31
+ | Content organization | Basic layout | Charts and diagrams |
32
32
  </tab>
33
33
 
34
- <tab label="选购建议">
35
- 先根据实际用途选择方案,再比较付款周期带来的费用变化。
34
+ <tab label="Buying advice">
35
+ Choose a plan for what you need, then compare how the billing cycle changes the cost.
36
36
  </tab>
37
37
  </tabs>
38
38
 
39
39
  <accordion>
40
- <disclosure label="费用如何计算?">
41
- 年度付款按每月标价的八折计算,上方显示折算后的每月费用。
40
+ <disclosure label="How is the cost calculated?">
41
+ Annual billing applies a 20% discount to the monthly list price, and the equivalent monthly cost is shown above.
42
42
  </disclosure>
43
43
 
44
- <disclosure label="可以随时切换吗?">
45
- 切换上方开关即可比较两种付款周期。这是一份本地计算示例。
44
+ <disclosure label="Can I switch at any time?">
45
+ Toggle the switch above to compare the two billing cycles. This is a local calculation example.
46
46
  </disclosure>
47
47
  </accordion>
@@ -1,44 +1,44 @@
1
- # 用内容组织交互
1
+ # Organize interactions with content
2
2
 
3
- 将鼠标移到 <tooltip text="输入改变后,相关文字和图表自动更新。">响应式绑定</tooltip>,或使用键盘聚焦查看说明。
3
+ Hover over <tooltip text="When an input changes, the related text and charts update automatically.">reactive bindings</tooltip>, or focus it with the keyboard to read the explanation.
4
4
 
5
- <panel title="阅读偏好">
6
- <radio-group bind="preference" label="说明风格">
7
- <option value="concise">简洁</option>
8
- <option value="detailed">详细</option>
5
+ <panel title="Reading preferences">
6
+ <radio-group bind="preference" label="Explanation style">
7
+ <option value="concise">Concise</option>
8
+ <option value="detailed">Detailed</option>
9
9
  </radio-group>
10
10
  </panel>
11
11
 
12
12
  <if when="{{ preference == 'concise' }}">
13
- 给输入命名,在正文中引用它。
13
+ Name the input and reference it in the prose.
14
14
  </if>
15
15
 
16
16
  <if when="{{ preference == 'detailed' }}">
17
- 用 `bind` 为输入参数命名,用 `{{ }}` 读取参数并计算结果。读者调整控件后,相关内容立即更新。
17
+ Name an input parameter with `bind` and read it with `{{ }}` to compute results. When readers adjust a control, the related content updates immediately.
18
18
  </if>
19
19
 
20
- ## 按自己的节奏阅读
20
+ ## Read at your own pace
21
21
 
22
- <accordion label="阅读顺序">
23
- <disclosure label="理解参数" open>
24
- 找出读者可以改变的内容,例如人数、单价或振幅。
22
+ <accordion label="Reading order">
23
+ <disclosure label="Understand the parameters" open>
24
+ Find what readers can change, such as headcount, unit price or amplitude.
25
25
  </disclosure>
26
26
 
27
- <disclosure label="写下关系">
28
- 用算式连接输入和结果,例如 `{{ people * 100 }}`。
27
+ <disclosure label="Write down the relationship">
28
+ Connect inputs and results with an expression, for example `{{ people * 100 }}`.
29
29
  </disclosure>
30
30
 
31
- <disclosure label="选择展示方式">
32
- 一句结果用正文,数据比较用图表,数学关系用函数曲线。
31
+ <disclosure label="Choose how to present it">
32
+ Use prose for a single result, charts for comparisons, and function curves for mathematical relationships.
33
33
  </disclosure>
34
34
  </accordion>
35
35
 
36
- <alert title="继续尝试">
37
- 切换上方选项,观察说明文字的变化。
36
+ <alert title="Keep exploring">
37
+ Switch the option above and watch the explanation change.
38
38
  </alert>
39
39
 
40
- <badge tone="success">本地交互</badge>
40
+ <badge tone="success">Local interaction</badge>
41
41
 
42
42
  ---
43
43
 
44
- > 标题、引用、链接和图片都沿用 Markdown。组件只负责需要交互的部分。
44
+ > Headings, blockquotes, links and images still follow Markdown. Components only handle the parts that need interaction.
@@ -1,7 +1,7 @@
1
- # 计数器
1
+ # Counter
2
2
 
3
- <counter bind="count" label="当前数值">
3
+ <counter bind="count" label="Current value">
4
4
 
5
- 正文也可以读取它:**{{ count }}**。
5
+ The prose can read it too: **{{ count }}**.
6
6
 
7
- 使用组件自带的加、减和重置按钮操作。
7
+ Use the component's own plus, minus and reset buttons.
@@ -1,54 +1,54 @@
1
- # 诊断示例
1
+ # Diagnostics example
2
2
 
3
- 这份文档故意保留错误,用于检查诊断提示。正确示例请从同目录的其他文档开始。
3
+ This document intentionally keeps errors to exercise the diagnostic messages. Start with the other documents in this folder for correct examples.
4
4
 
5
- ## 引用拼错的参数名
5
+ ## Reference to a misspelled parameter name
6
6
 
7
- <slider bind="seats" label="人数" initial="2" min="1" max="20">
7
+ <slider bind="seats" label="People" initial="2" min="1" max="20">
8
8
 
9
- 当前人数:{{ seat }}。
9
+ Current headcount: {{ seat }}.
10
10
 
11
- ## 重复声明初值
11
+ ## Duplicate initial declaration
12
12
 
13
- <number bind="seats" label="另一处人数输入" initial="3" min="1" max="20">
13
+ <number bind="seats" label="Another headcount input" initial="3" min="1" max="20">
14
14
 
15
- ## 超出范围的初值
15
+ ## Initial value out of range
16
16
 
17
- <slider bind="ratio" label="比例" initial="12" min="0" max="10">
17
+ <slider bind="ratio" label="Ratio" initial="12" min="0" max="10">
18
18
 
19
- ## 条件类型错误
19
+ ## Condition type error
20
20
 
21
21
  <if when="{{ seats }}">
22
- 这里需要布尔条件,例如 seats 大于 5。
22
+ This needs a boolean condition, such as seats greater than 5.
23
23
  </if>
24
24
 
25
- ## 未知标签
25
+ ## Unknown tag
26
26
 
27
- <slidr label="拼错的滑块" />
27
+ <slidr label="Misspelled slider" />
28
28
 
29
- ## 不属于本地交互语言的事件
29
+ ## Event outside the local interaction language
30
30
 
31
- <counter label="计数" on-click="increment">
31
+ <counter label="Counter" on-click="increment">
32
32
 
33
- ## 缺少节点
33
+ ## Missing node
34
34
 
35
- <diagram label="错误连线">
36
- <node id="input" label="输入">
37
- 只有这一个节点。
35
+ <diagram label="Broken edge">
36
+ <node id="input" label="Input">
37
+ This is the only node.
38
38
  </node>
39
39
  <edge from="input" to="missing">
40
40
  </diagram>
41
41
 
42
- ## 不支持计算的数学结构
42
+ ## Unsupported math structure
43
43
 
44
- <plot label="积分计算尚不属于绘图语法">
44
+ <plot label="Integrals are not part of the plot grammar">
45
45
  $$ y = \int_0^x t^2\,dt $$
46
46
  </plot>
47
47
 
48
- ## 无效的图表数据
48
+ ## Invalid chart data
49
49
 
50
- <chart title="数值列中混入了单位">
51
- | 项目 | 费用 |
50
+ <chart title="Units mixed into a numeric column">
51
+ | Item | Cost |
52
52
  | --- | ---: |
53
- | 内容 | 20 元 |
53
+ | Content | 20 USD |
54
54
  </chart>