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,44 +1,44 @@
1
- # 让解释可以被探索
1
+ # Make explanations explorable
2
2
 
3
- 点击节点或使用键盘选择一个环节,查看它的说明。
3
+ Click a node or use the keyboard to select a step and read its description.
4
4
 
5
- <diagram bind="selected" initial="input" label="响应式状态流">
6
- <node id="input" label="输入">
7
- 读者通过滑块、开关和输入框改变参数。
5
+ <diagram bind="selected" initial="input" label="Reactive state flow">
6
+ <node id="input" label="Input">
7
+ Readers change parameters with sliders, switches and text fields.
8
8
  </node>
9
9
 
10
- <node id="compute" label="计算">
11
- 重新计算依赖这些参数的公式。
10
+ <node id="compute" label="Compute">
11
+ Formulas that depend on those parameters are recalculated.
12
12
  </node>
13
13
 
14
- <node id="view" label="显示">
15
- 正文、图表和提示随结果更新。
14
+ <node id="view" label="View">
15
+ Prose, charts and hints update with the result.
16
16
  </node>
17
17
 
18
- <edge from="input" to="compute" label="参数变化">
19
- <edge from="compute" to="view" label="更新结果">
18
+ <edge from="input" to="compute" label="Parameter change">
19
+ <edge from="compute" to="view" label="Updated result">
20
20
  </diagram>
21
21
 
22
- 当前环节:{{ selected == 'input' ? '输入' : selected == 'compute' ? '计算' : '显示' }}。
22
+ Current step: {{ selected == 'input' ? 'Input' : selected == 'compute' ? 'Compute' : 'View' }}.
23
23
 
24
- ## 改变参数,观察曲线
24
+ ## Change parameters and watch the curve
25
25
 
26
- <panel title="正弦波参数">
27
- <slider bind="a" label="振幅" initial="1" min="0" max="3" step="0.5">
28
- <slider bind="f" label="频率参数" initial="1" min="0.5" max="3" step="0.5">
26
+ <panel title="Sine wave parameters">
27
+ <slider bind="a" label="Amplitude" initial="1" min="0" max="3" step="0.5">
28
+ <slider bind="f" label="Frequency parameter" initial="1" min="0.5" max="3" step="0.5">
29
29
  </panel>
30
30
 
31
- <plot min="0" max="12.56" label="正弦波" x-label="x" y-label="位移">
31
+ <plot min="0" max="12.56" label="Sine wave" x-label="x" y-label="Displacement">
32
32
  $$ y = a\sin(fx) $$
33
33
  </plot>
34
34
 
35
35
  <if when="{{ a == 0 }}">
36
- 振幅为零,曲线与横轴重合。
36
+ The amplitude is zero, so the curve lies flat on the horizontal axis.
37
37
  </if>
38
38
 
39
- ## 叠加两条曲线
39
+ ## Overlay two curves
40
40
 
41
- <plot min="-5" max="5" label="抛物线与直线">
41
+ <plot min="-5" max="5" label="Parabola and line">
42
42
  $$ y = x^2 $$
43
43
  $$ y = 2x + 1 $$
44
44
  </plot>
@@ -1,61 +1,61 @@
1
- # 常用组件画廊
1
+ # Common component gallery
2
2
 
3
- ## 输入与实时结果
3
+ ## Inputs and live results
4
4
 
5
- <panel title="填写你的方案">
6
- <input bind="name" label="称呼" initial="小林" placeholder="请输入名字">
7
- <number bind="quantity" label="数量" initial="3" min="1" max="20">
5
+ <panel title="Describe your plan">
6
+ <input bind="name" label="Name" initial="Alex" placeholder="Enter a name">
7
+ <number bind="quantity" label="Quantity" initial="3" min="1" max="20">
8
8
 
9
- <select bind="plan" label="方案" initial="pro">
10
- <option value="basic">基础版</option>
11
- <option value="pro">专业版</option>
9
+ <select bind="plan" label="Plan" initial="pro">
10
+ <option value="basic">Basic</option>
11
+ <option value="pro">Pro</option>
12
12
  </select>
13
13
 
14
- <toggle bind="annual" label="年度付款(八折)">
15
- <toggle bind="express" label="显示加急清单" initial="true">
16
- <slider bind="budgetLevel" label="预算档位" initial="50" step="10">
14
+ <toggle bind="annual" label="Annual billing (20% off)">
15
+ <toggle bind="express" label="Show express checklist" initial="true">
16
+ <slider bind="budgetLevel" label="Budget level" initial="50" step="10">
17
17
  </panel>
18
18
 
19
- 你好,**{{ name }}**。
19
+ Hello, **{{ name }}**.
20
20
 
21
- 预估费用:**{{ round(quantity * 80 * (plan == 'pro' ? 1 : 0.8) * (annual ? 0.8 : 1)) }} 元**。
21
+ Estimated cost: **{{ round(quantity * 80 * (plan == 'pro' ? 1 : 0.8) * (annual ? 0.8 : 1)) }} USD**.
22
22
 
23
23
  <if when="{{ quantity >= 5 }}">
24
- <badge tone="success">已达到团队档</badge>
24
+ <badge tone="success">Team tier reached</badge>
25
25
  </if>
26
26
 
27
- | 条件 | 当前选择 |
27
+ | Condition | Current choice |
28
28
  | --- | --- |
29
- | 方案 | {{ plan == 'pro' ? '专业版' : '基础版' }} |
30
- | 年度付款 | {{ annual ? '已开启' : '未开启' }} |
31
- | 预算档位 | {{ budgetLevel }} |
29
+ | Plan | {{ plan == 'pro' ? 'Pro' : 'Basic' }} |
30
+ | Annual billing | {{ annual ? 'On' : 'Off' }} |
31
+ | Budget level | {{ budgetLevel }} |
32
32
 
33
33
  <if when="{{ express }}">
34
- <checklist label="加急准备">
35
- - [x] 已选加急展示
36
- - [ ] 确认交付时间
34
+ <checklist label="Express preparation">
35
+ - [x] Express checklist shown
36
+ - [ ] Confirm the delivery time
37
37
  </checklist>
38
38
  </if>
39
39
 
40
- ## 独立操作的组件
40
+ ## Components that work on their own
41
41
 
42
- 下面的组件不需要向正文公开参数,所以省略 bind。
42
+ These components do not expose parameters to the prose, so they omit bind.
43
43
 
44
44
  <grid>
45
- <card title="人数计数">
46
- <counter label="参与人数" initial="2" min="1" max="20">
45
+ <card title="People counter">
46
+ <counter label="Participants" initial="2" min="1" max="20">
47
47
  </card>
48
48
 
49
- <card title="短时专注">
50
- <timer label="一分钟倒计时">
49
+ <card title="Short focus">
50
+ <timer label="One-minute countdown">
51
51
  </card>
52
52
  </grid>
53
53
 
54
- ## 原样展示代码
54
+ ## Show code as-is
55
55
 
56
56
  ```markdown
57
- <slider bind="example" label="示例参数">
58
- 当前值:{{ example }}。
57
+ <slider bind="example" label="Example parameter">
58
+ Current value: {{ example }}.
59
59
  ```
60
60
 
61
- 以上代码只作为示例显示,不会生成控件。
61
+ The code above is displayed as an example only and does not create a control.
@@ -1,36 +1,36 @@
1
- # 边填写,边看结果
1
+ # Fill it in, watch the result
2
2
 
3
- 填写你的偏好,下方说明会立即变化。
3
+ Enter your preferences and the description below updates immediately.
4
4
 
5
- <panel title="交流准备">
6
- <input bind="name" label="称呼" placeholder="怎么称呼你?">
5
+ <panel title="Meeting preparation">
6
+ <input bind="name" label="Name" placeholder="What should we call you?">
7
7
 
8
- <choices bind="role" label="使用方式">
9
- <option value="personal">个人使用</option>
10
- <option value="team">团队使用</option>
8
+ <choices bind="role" label="Usage">
9
+ <option value="personal">Personal use</option>
10
+ <option value="team">Team use</option>
11
11
  </choices>
12
12
 
13
- <date bind="appointment" label="计划交流的日期" initial="2026-10-22">
13
+ <date bind="appointment" label="Preferred meeting date" initial="2026-10-22">
14
14
 
15
- <textarea bind="message" label="想做什么交互文档?" placeholder="例如:一份可以调整参数的课程讲义">
15
+ <textarea bind="message" label="What interactive document do you want to build?" placeholder="For example: a course handout with adjustable parameters">
16
16
 
17
- <checkbox bind="showNotes" label="显示准备清单">
17
+ <checkbox bind="showNotes" label="Show the preparation checklist">
18
18
  </panel>
19
19
 
20
- <card title="当前计划">
21
- 称呼:**{{ name == '' ? '尚未填写' : name }}**。
20
+ <card title="Current plan">
21
+ Name: **{{ name == '' ? 'Not provided yet' : name }}**.
22
22
 
23
- 使用方式:{{ role == 'personal' ? '个人使用' : '团队使用' }}。
23
+ Usage: {{ role == 'personal' ? 'Personal use' : 'Team use' }}.
24
24
 
25
- 计划日期:{{ appointment }}。
25
+ Planned date: {{ appointment }}.
26
26
 
27
- 想法:{{ message == '' ? '可以先从一个小计算器开始。' : message }}
27
+ Idea: {{ message == '' ? 'Start with a small calculator.' : message }}
28
28
  </card>
29
29
 
30
30
  <if when="{{ showNotes }}">
31
- <checklist label="交流前准备">
32
- - [ ] 想清楚读者需要调整哪些参数
33
- - [ ] 准备一个具体的计算或图表示例
34
- - [ ] 写出希望读者观察到的变化
31
+ <checklist label="Before the meeting">
32
+ - [ ] Decide which parameters readers need to adjust
33
+ - [ ] Prepare a concrete calculation or chart example
34
+ - [ ] Write down the changes you want readers to notice
35
35
  </checklist>
36
36
  </if>
@@ -1,24 +1,24 @@
1
- # 计划、计时和简单工具
1
+ # Planning, timing and simple tools
2
2
 
3
- <timeline title="45 分钟工作计划">
4
- | 事项 | 开始 | 时长 | 说明 |
3
+ <timeline title="45-minute work plan">
4
+ | Task | Start | Duration | Notes |
5
5
  | --- | ---: | ---: | --- |
6
- | 准备材料 | 0 | 10 | 先列出所需内容 |
7
- | 完成主体 | 10 | 25 | 集中完成主要部分 |
8
- | 整理参考 | 15 | 15 | 可以与主体阶段并行 |
9
- | 检查与交付 | 35 | 10 | 留出复核时间 |
6
+ | Prepare materials | 0 | 10 | List what you need first |
7
+ | Draft the main section | 10 | 25 | Focus on the core content |
8
+ | Assemble references | 15 | 15 | Can run in parallel with the main section |
9
+ | Review and deliver | 35 | 10 | Leave time for a final check |
10
10
  </timeline>
11
11
 
12
- <timer label="一分钟专注计时" duration="60">
12
+ <timer label="One-minute focus timer" duration="60">
13
13
 
14
- ## 聚餐分账
14
+ ## Splitting a dinner bill
15
15
 
16
- <panel title="分账参数">
17
- <number bind="total" label="账单金额" initial="240" min="0">
18
- <slider bind="people" label="分账人数" initial="3" min="1" max="12">
19
- <slider bind="tip" label="额外费用(%)" initial="10" min="0" max="20">
16
+ <panel title="Bill parameters">
17
+ <number bind="total" label="Bill amount" initial="240" min="0">
18
+ <slider bind="people" label="People" initial="3" min="1" max="12">
19
+ <slider bind="tip" label="Extra charge (%)" initial="10" min="0" max="20">
20
20
  </panel>
21
21
 
22
- 每人支付 **{{ round(total * (1 + tip / 100) / people * 100) / 100 }} 元**。
22
+ Each person pays **{{ round(total * (1 + tip / 100) / people * 100) / 100 }} USD**.
23
23
 
24
- 金额按两位小数四舍五入显示,不补齐末尾的零。
24
+ Amounts are rounded to two decimals without padding trailing zeros.
@@ -1,20 +1,20 @@
1
- # 方案计算器
1
+ # Plan calculator
2
2
 
3
- 调整人数和付款方式,比较每月平均费用。每人每月 100 元,年度付款享受八折。
3
+ Adjust the headcount and billing cycle to compare the average monthly cost. Each person costs 100 USD per month, and annual billing takes 20% off.
4
4
 
5
- <panel title="你的方案">
6
- <slider bind="seats" label="人数" initial="2" min="1" max="20">
7
- <toggle bind="annual" label="年度付款">
5
+ <panel title="Your plan">
6
+ <slider bind="seats" label="People" initial="2" min="1" max="20">
7
+ <toggle bind="annual" label="Annual billing">
8
8
  </panel>
9
9
 
10
- 当前人数:**{{ seats }}**。
10
+ Current headcount: **{{ seats }}**.
11
11
 
12
- 每人每月:**{{ annual ? 80 : 100 }} 元**。
12
+ Per person per month: **{{ annual ? 80 : 100 }} USD**.
13
13
 
14
- 每月合计:**{{ seats * (annual ? 80 : 100) }} 元**。
14
+ Monthly total: **{{ seats * (annual ? 80 : 100) }} USD**.
15
15
 
16
16
  <if when="{{ seats >= 5 }}">
17
- <alert title="团队方案">
18
- 你选择了至少 5 人,可以继续切换付款方式比较费用。
17
+ <alert title="Team plan">
18
+ You selected at least 5 people. Switch the billing cycle to compare costs.
19
19
  </alert>
20
20
  </if>
@@ -0,0 +1,36 @@
1
+ <const name="unitPrice" value="{{ 12.5 }}">
2
+ <computed name="total" value="{{ quantity * unitPrice }}">
3
+ <computed name="invoice" value="{{ formatCurrency(total, 'CNY', 2, 'zh-CN') }}">
4
+ <computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
5
+
6
+ # 共享账单计算
7
+
8
+ <panel title="调整账单">
9
+ <number bind="quantity" label="数量" initial="2" min="0" max="100">
10
+ <date bind="startDate" label="开始日期" initial="2026-10-24">
11
+ <date bind="endDate" label="结束日期" initial="2026-10-26">
12
+ </panel>
13
+
14
+ 账单:**{{ invoice }}**。单价:{{ formatCurrency(unitPrice, 'CNY', 2, 'zh-CN') }}。
15
+
16
+ 天数:{{ days == null ? '请选择两个日期' : formatNumber(days, 0) }}。
17
+
18
+ <if when="{{ total >= 100 }}">
19
+ 达到批量配送门槛。
20
+ </if>
21
+
22
+ <chart kind="bar" title="账单总额" x="项目" y="费用">
23
+ | 项目 | 费用 |
24
+ | --- | --- |
25
+ | 账单 | {{ total }} |
26
+ | 单件 | {{ unitPrice }} |
27
+ </chart>
28
+
29
+ <plot label="账单倍数" min="0" max="2" samples="21">
30
+ $$
31
+ y = \mathrm{total} x
32
+ $$
33
+ </plot>
34
+
35
+ 同一数字的其他显示:{{ formatNumber(total, 0) }}、{{ formatScientific(total) }}。
36
+ 比例 {{ formatPercent(0.125, 1) }} 的显示不随读者设备地区变化。
@@ -0,0 +1,36 @@
1
+ <const name="unitPrice" value="{{ 12.5 }}">
2
+ <computed name="total" value="{{ quantity * unitPrice }}">
3
+ <computed name="invoice" value="{{ formatCurrency(total) }}">
4
+ <computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
5
+
6
+ # Shared invoice calculations
7
+
8
+ <panel title="Adjust the invoice">
9
+ <number bind="quantity" label="Quantity" initial="2" min="0" max="100">
10
+ <date bind="startDate" label="Start" initial="2026-10-24">
11
+ <date bind="endDate" label="End" initial="2026-10-26">
12
+ </panel>
13
+
14
+ Invoice: **{{ invoice }}**. Per item: {{ formatCurrency(unitPrice) }}.
15
+
16
+ Days: {{ days == null ? 'Choose both dates' : formatNumber(days, 0) }}.
17
+
18
+ <if when="{{ total >= 100 }}">
19
+ Eligible for bulk delivery.
20
+ </if>
21
+
22
+ <chart kind="bar" title="Invoice total" x="Item" y="Cost">
23
+ | Item | Cost |
24
+ | --- | --- |
25
+ | Invoice | {{ total }} |
26
+ | One item | {{ unitPrice }} |
27
+ </chart>
28
+
29
+ <plot label="Scaled invoice" min="0" max="2" samples="21">
30
+ $$
31
+ y = \mathrm{total} x
32
+ $$
33
+ </plot>
34
+
35
+ Other displays of the same number: {{ formatNumber(total, 0) }}, {{ formatScientific(total) }}.
36
+ The fraction {{ formatPercent(0.125, 1) }} is independent of the reader's device locale.
@@ -0,0 +1,33 @@
1
+ <computed name="costs" value="{{ [seats * 80, materials ? seats * 20 : 0] }}">
2
+ <computed name="total" value="{{ sum(costs) }}">
3
+
4
+ # 校验工作坊计划
5
+
6
+ <panel title="工作坊计划">
7
+ <number bind="seats" label="人数" initial="4" min="1" max="20">
8
+ <number bind="budget" label="预算" initial="500" min="0" max="5000">
9
+ <toggle bind="materials" label="包含材料">
10
+ <date bind="startDate" label="开始日期" initial="2026-10-24">
11
+ <date bind="endDate" label="结束日期" initial="2026-10-26">
12
+ <multi-select bind="subjects" label="主题" max-selected="3">
13
+ <option value="mathematics">数学</option>
14
+ <option value="physics">物理</option>
15
+ <option value="chemistry">化学</option>
16
+ </multi-select>
17
+ </panel>
18
+
19
+ <validation when="{{ total <= budget }}" message="预估 {{ formatCurrency(total, 'CNY', 2, 'zh-CN') }} 已超出预算。" fields="seats budget materials">
20
+ <validation when="{{ startDate == '' || endDate == '' || dateCompare(endDate, startDate) >= 0 }}" message="结束日期应不早于开始日期。" fields="startDate endDate">
21
+
22
+ <badge tone="{{ total <= budget ? 'success' : 'warning' }}">预估:{{ formatCurrency(total, 'CNY', 2, 'zh-CN') }}</badge>
23
+
24
+ 教学:{{ formatCurrency(costs[0], 'CNY', 2, 'zh-CN') }}。材料:{{ formatCurrency(costs[1], 'CNY', 2, 'zh-CN') }}。
25
+ 平均费用类别:{{ formatCurrency(average(costs), 'CNY', 2, 'zh-CN') }}。
26
+
27
+ <data-table label="已选主题" rows="{{ subjects }}" key="{{ item }}" max-rows="3">
28
+ <column label="主题标识" value="{{ item }}">
29
+ <column label="序号" value="{{ index + 1 }}">
30
+ <column label="准备工作" value="{{ item == 'chemistry' ? '准备材料' : '准备例题' }}">
31
+ </data-table>
32
+
33
+ 选择主题后表格自动生成行。调低预算可查看警告,再修改预算或人数即可消除。重置面板恢复初始计划。
@@ -0,0 +1,33 @@
1
+ <computed name="costs" value="{{ [seats * 80, materials ? seats * 20 : 0] }}">
2
+ <computed name="total" value="{{ sum(costs) }}">
3
+
4
+ # Check a workshop plan
5
+
6
+ <panel title="Workshop plan">
7
+ <number bind="seats" label="Participants" initial="4" min="1" max="20">
8
+ <number bind="budget" label="Budget" initial="500" min="0" max="5000">
9
+ <toggle bind="materials" label="Include materials">
10
+ <date bind="startDate" label="Start date" initial="2026-10-24">
11
+ <date bind="endDate" label="End date" initial="2026-10-26">
12
+ <multi-select bind="subjects" label="Subjects" max-selected="3">
13
+ <option value="mathematics">Mathematics</option>
14
+ <option value="physics">Physics</option>
15
+ <option value="chemistry">Chemistry</option>
16
+ </multi-select>
17
+ </panel>
18
+
19
+ <validation when="{{ total <= budget }}" message="The estimated {{ formatCurrency(total) }} exceeds the budget." fields="seats budget materials">
20
+ <validation when="{{ startDate == '' || endDate == '' || dateCompare(endDate, startDate) >= 0 }}" message="End date must be on or after start date." fields="startDate endDate">
21
+
22
+ <badge tone="{{ total <= budget ? 'success' : 'warning' }}">Estimate: {{ formatCurrency(total) }}</badge>
23
+
24
+ Teaching: {{ formatCurrency(costs[0]) }}. Materials: {{ formatCurrency(costs[1]) }}.
25
+ Average cost category: {{ formatCurrency(average(costs)) }}.
26
+
27
+ <data-table label="Selected subjects" rows="{{ subjects }}" key="{{ item }}" max-rows="3">
28
+ <column label="Subject ID" value="{{ item }}">
29
+ <column label="Position" value="{{ index + 1 }}">
30
+ <column label="Preparation" value="{{ item == 'chemistry' ? 'Prepare materials' : 'Prepare examples' }}">
31
+ </data-table>
32
+
33
+ Choose subjects to populate the table. Lower the budget to see the warning, then edit either the budget or participant count to clear it. Reset the panel to restore the plan.
@@ -0,0 +1,25 @@
1
+ # Feature tours / 功能演示
2
+
3
+ The Playground has a short [Quick start](../pricing.reactive.md) and six feature tours. Each tour opens with a suggested interaction, develops one example and ends with expandable source snippets. Choose Show source to edit the whole document. Controls, calculations, validation, layout and visualizations appear within these six scenarios. [Errors & debugging](../diagnostics.reactive.md) is available from the auxiliary menu.
4
+
5
+ Playground 按“快速体验 + 六个场景”组织。每个场景开头给出明确操作,围绕一个案例展开,结尾可以查看关键源码。点击“显示源码”可编辑完整文档。控件、计算、校验、布局和可视化分布在这六个场景中,“错误与调试”保留在辅助菜单。
6
+
7
+ | Feature / 功能 | English source | 中文源码 | Try this / 操作提示 |
8
+ | --- | --- | --- | --- |
9
+ | Functions & formulas / 函数与公式 | [functions](functions.reactive.md) | [functions](zh/functions.reactive.md) | Share the monthly rate between a curve and balance; read currency, decimals and scientific notation / 曲线与期末金额共用月利率,读取货币、小数与科学计数法 |
10
+ | Forms & bindings / 表单与联动 | [forms](forms.reactive.md) | [forms](zh/forms.reactive.md) | Check dates and spending, trim the organizer name and generate a plan for up to two selected subjects / 校验日期与费用,整理称呼,并为最多两个所选主题生成准备清单 |
11
+ | Data & charts / 数据与统计图表 | [statistics](statistics.reactive.md) | [statistics](zh/statistics.reactive.md) | Aggregate one expense array and select the same category across tables and charts / 汇总同一份费用数组,并在表格与图表间联动选择项目 |
12
+ | Content & layout / 内容与布局 | [layout](layout.reactive.md) | [layout](zh/layout.reactive.md) | Move the reading date across workshop day, switch roles and open details / 调整阅读日期,观察活动前后提示,切换角色并展开细节 |
13
+ | Diagrams & flow / 图解与流程 | [flow](flow.reactive.md) | [flow](zh/flow.reactive.md) | Follow a constant rate and named total through nodes and explanations / 沿节点追踪固定单价与命名合计,查看各处共享的结果 |
14
+ | Checklists & timing / 清单与计时 | [tasks](tasks.reactive.md) | [tasks](zh/tasks.reactive.md) | Generate reflection rows from completed tasks, read percentage progress and start the timer / 按完成事项生成回顾表,读取百分比进度并启动计时 |
15
+
16
+
17
+ The data tour builds one numeric array from four expense controls. Its total, average, minimum, maximum and indexed chart values read that collection. Currency and percentage formatting stay in the prose, so chart inputs remain numeric. Selecting a category links the table and all charts; filtering affects only that table.
18
+
19
+ 统计场景把四个费用控件组成一个数字数组,合计、均值、最小值、最大值以及图表中的索引读数共用该集合。正文使用货币与百分比格式,图表继续读取数字。项目选择在表格与图表间联动,筛选仅影响该表。
20
+
21
+ Generated tables declare small row budgets: two subject rows in Forms and three completed-task rows in Checklists. Both use the selected item's stable ID as the row key. Workshop validation hints clear when the dates and spending are consistent again. Reading dates are explicit inputs, so calendar guidance is reproducible across machines.
22
+
23
+ 生成表格声明了明确的行预算:表单最多两个主题行,清单最多三个已完成事项行,均以选项的稳定标识作为行键。活动日期和费用重新满足约束后,校验提示自动消失。阅读日期由读者明确选择,同一日期在不同机器上得到相同提示。
24
+
25
+ Each source is a complete document using the public local interaction syntax. The original [standalone examples](../README.md) remain available for smaller snippets and component regression checks.
@@ -0,0 +1,102 @@
1
+ # Choose, explore and learn
2
+
3
+ Select two subjects, narrow the interval and drag the point. Check an answer, then choose a project in the table or chart.
4
+
5
+ <jump to="results" appearance="button" color="#2563eb">Jump to the results</jump>
6
+
7
+ <panel title="Try the new interactions">
8
+
9
+ <anchor id="settings">
10
+
11
+ <section color="#45536f">
12
+ These paragraphs use a shared color. <text color="#a2273a">**This reminder has its own color.**</text> Links and controls keep their own appearance.
13
+ </section>
14
+
15
+ <grid>
16
+ <card title="Choose up to two subjects">
17
+ <multi-select bind="subjects" label="Subjects" max-selected="2" color="#167875">
18
+ <option value="math">Mathematics</option>
19
+ <option value="physics">Physics</option>
20
+ <option value="chemistry">Chemistry</option>
21
+ </multi-select>
22
+
23
+ Selected: **{{ len(subjects) }} / 2**.
24
+ <if when="{{ contains(subjects, 'chemistry') }}">
25
+ <badge color="#167875">Chemistry selected</badge>
26
+ </if>
27
+ </card>
28
+ <card title="Explore an interval">
29
+ <range-slider label="Observation interval" bind-start="low" bind-end="high" initial-start="20" initial-end="80" min="0" max="100" color="#7c3aed">
30
+
31
+ Interval: **{{ low }}–{{ high }}**. Width: **{{ high - low }}**.
32
+ </card>
33
+ </grid>
34
+
35
+ ## Move a point
36
+
37
+ <coordinate label="Point position" bind-x="px" bind-y="py" initial-x="1" initial-y="2" x-min="-5" x-max="5" y-min="-5" y-max="5" color="#2563eb">
38
+
39
+ Point: **({{ px }}, {{ py }})**. Distance from the origin: **{{ round(sqrt(px * px + py * py) * 100) / 100 }}**.
40
+
41
+ ## Follow the learning path
42
+
43
+ <steps label="Learning path" bind="lesson">
44
+ <step label="Observe" value="observe">
45
+ Drag the point and watch its distance change.
46
+ </step>
47
+ <step label="Calculate" value="calculate">
48
+ The distance is the square root of the sum of the squared coordinates.
49
+ </step>
50
+ <step label="Practice" value="practice">
51
+ Try the questions below, then mark your checklist.
52
+ </step>
53
+ </steps>
54
+
55
+ Current step: **{{ lesson }}**.
56
+
57
+ <quiz type="choice" label="What is 2 + 3?" answer="b" explanation="Add the two numbers to get 5.">
58
+ <option value="a">4</option>
59
+ <option value="b">5</option>
60
+ <option value="c">6</option>
61
+ </quiz>
62
+
63
+ <quiz type="number" label="Approximate pi" answer="3.14" tolerance="0.01" explanation="Any value within 0.01 of 3.14 is accepted.">
64
+ </quiz>
65
+
66
+ ## Mark completed tasks
67
+
68
+ <checklist bind="done" label="Exploration checklist" color="#167875">
69
+ - [x] Read the instructions
70
+ - [ ] Move the point
71
+ - [ ] Check an answer
72
+ </checklist>
73
+
74
+ <progress label="Exploration progress" value="{{ len(done) / 3 * 100 }}" color="#167875">
75
+
76
+ <anchor id="results">
77
+
78
+ ## One selection, two views
79
+
80
+ Choose a project below. The table and chart share the selection; searching or sorting the table keeps the selected project.
81
+
82
+ <table label="Project selection" bind="project" key="Project" initial="Content" page-size="2">
83
+ | Project | Actual | Budget |
84
+ | --- | ---: | ---: |
85
+ | Content | 120 | 150 |
86
+ | Visual | 230 | 200 |
87
+ | Testing | 90 | 120 |
88
+ </table>
89
+
90
+ <chart kind="bar" title="Selected project" bind="project" key="Project" y="Actual,Budget">
91
+ | Project | Actual | Budget |
92
+ | --- | ---: | ---: |
93
+ | Content | 120 | 150 |
94
+ | Visual | 230 | 200 |
95
+ | Testing | 90 | 120 |
96
+ </chart>
97
+
98
+ Selected project: **{{ project }}**.
99
+
100
+ <jump to="settings" appearance="button" color="#2563eb">Return to the settings</jump>
101
+
102
+ </panel>