reactive-md 0.4.1 → 0.5.1

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 (98) hide show
  1. package/CHANGELOG-ch.md +144 -113
  2. package/CHANGELOG.md +144 -113
  3. package/LICENSE +21 -21
  4. package/README-ch.md +154 -123
  5. package/README-en.md +179 -147
  6. package/README.md +179 -147
  7. package/SECURITY-ch.md +4 -3
  8. package/SECURITY.md +4 -3
  9. package/THIRD_PARTY_NOTICES.md +138 -1
  10. package/bin/reactive-md.mjs +1 -1
  11. package/dist-library/reactive-md-editor.css +2 -0
  12. package/dist-library/reactive-md-editor.js +3834 -0
  13. package/dist-library/reactive-md-react.js +9324 -1670
  14. package/dist-library/reactive-md.css +1 -1
  15. package/dist-library/reactive-md.js +426 -305
  16. package/dist-library/{runtime-D3QTVYaz.js → runtime-CXBdLQ3A.js} +8950 -2895
  17. package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
  18. package/dist-library/types/editor/editor-commands.d.ts +50 -0
  19. package/dist-library/types/editor/editor-i18n.d.ts +109 -0
  20. package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
  21. package/dist-library/types/editor/editor-view-bar.d.ts +11 -0
  22. package/dist-library/types/editor/extended-native-components.d.ts +58 -0
  23. package/dist-library/types/editor/index.d.ts +9 -0
  24. package/dist-library/types/editor/locale.d.ts +13 -0
  25. package/dist-library/types/editor/native-components.d.ts +47 -0
  26. package/dist-library/types/editor/source-authoring.d.ts +57 -0
  27. package/dist-library/types/editor/types.d.ts +51 -0
  28. package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
  29. package/dist-library/types/editor/use-source-history.d.ts +16 -0
  30. package/dist-library/types/local/LocalDocumentView.d.ts +10 -3
  31. package/dist-library/types/local/code-block.d.ts +26 -0
  32. package/dist-library/types/local/diagnostics.d.ts +25 -0
  33. package/dist-library/types/local/footnotes.d.ts +51 -0
  34. package/dist-library/types/local/heading-anchors.d.ts +2 -0
  35. package/dist-library/types/local/html.d.ts +16 -0
  36. package/dist-library/types/local/image-view.d.ts +23 -0
  37. package/dist-library/types/local/index.d.ts +1 -1
  38. package/dist-library/types/local/options.d.ts +29 -0
  39. package/dist-library/types/local/types.d.ts +42 -1
  40. package/dist-library/types/local/worker.d.ts +18 -6
  41. package/dist-library/types/shareable.d.ts +9 -1
  42. package/dist-standalone/reactive-md-standalone.css +1 -1
  43. package/dist-standalone/reactive-md-standalone.js +49 -38
  44. package/docs/compatibility-ch.md +12 -8
  45. package/docs/compatibility-en.md +12 -8
  46. package/docs/component-protocol-ch.md +2 -2
  47. package/docs/component-protocol-en.md +2 -2
  48. package/docs/editor-ch.md +235 -0
  49. package/docs/editor-en.md +235 -0
  50. package/docs/html-compatibility-ch.md +98 -0
  51. package/docs/html-compatibility-en.md +98 -0
  52. package/docs/local-guide-ch.md +11 -5
  53. package/docs/local-guide-en.md +11 -5
  54. package/docs/local-integration-ch.md +4 -1
  55. package/docs/local-integration-en.md +4 -1
  56. package/docs/local-interaction-syntax-ch.md +9 -2
  57. package/docs/local-interaction-syntax-en.md +7 -2
  58. package/docs/release-0.4.1-ch.md +23 -23
  59. package/docs/release-0.4.1-en.md +23 -23
  60. package/docs/release-0.5.0-ch.md +41 -0
  61. package/docs/release-0.5.0-en.md +41 -0
  62. package/docs/release-0.5.1-ch.md +39 -0
  63. package/docs/release-0.5.1-en.md +39 -0
  64. package/docs/releasing-ch.md +108 -101
  65. package/docs/releasing-en.md +108 -101
  66. package/docs/shareable-export-ch.md +6 -2
  67. package/docs/shareable-export-en.md +6 -2
  68. package/examples/integration/core/package.json +7 -7
  69. package/examples/integration/react/index.html +12 -12
  70. package/examples/integration/react/main.jsx +21 -21
  71. package/examples/integration/react/package.json +9 -9
  72. package/examples/integration/react-editor.tsx +74 -0
  73. package/examples/local/README.md +2 -0
  74. package/examples/local/catalog.reactive.md +20 -20
  75. package/examples/local/checklist.reactive.md +32 -32
  76. package/examples/local/comparison.reactive.md +47 -47
  77. package/examples/local/components.reactive.md +44 -44
  78. package/examples/local/counter.reactive.md +7 -7
  79. package/examples/local/diagnostics.reactive.md +54 -54
  80. package/examples/local/diagram.reactive.md +44 -44
  81. package/examples/local/gallery.reactive.md +61 -61
  82. package/examples/local/html-compat.reactive.md +24 -0
  83. package/examples/local/parameters.reactive.md +36 -36
  84. package/examples/local/planning.reactive.md +24 -24
  85. package/examples/local/pricing.reactive.md +20 -20
  86. package/examples/local/zh/catalog.reactive.md +20 -20
  87. package/examples/local/zh/charts.reactive.md +73 -73
  88. package/examples/local/zh/checklist.reactive.md +32 -32
  89. package/examples/local/zh/comparison.reactive.md +47 -47
  90. package/examples/local/zh/components.reactive.md +44 -44
  91. package/examples/local/zh/counter.reactive.md +7 -7
  92. package/examples/local/zh/diagnostics.reactive.md +54 -54
  93. package/examples/local/zh/diagram.reactive.md +44 -44
  94. package/examples/local/zh/gallery.reactive.md +61 -61
  95. package/examples/local/zh/parameters.reactive.md +36 -36
  96. package/examples/local/zh/planning.reactive.md +24 -24
  97. package/examples/local/zh/pricing.reactive.md +20 -20
  98. package/package.json +135 -91
@@ -1,44 +1,44 @@
1
- # Make explanations explorable
2
-
3
- Click a node or use the keyboard to select a step and read its description.
4
-
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
- </node>
9
-
10
- <node id="compute" label="Compute">
11
- Formulas that depend on those parameters are recalculated.
12
- </node>
13
-
14
- <node id="view" label="View">
15
- Prose, charts and hints update with the result.
16
- </node>
17
-
18
- <edge from="input" to="compute" label="Parameter change">
19
- <edge from="compute" to="view" label="Updated result">
20
- </diagram>
21
-
22
- Current step: {{ selected == 'input' ? 'Input' : selected == 'compute' ? 'Compute' : 'View' }}.
23
-
24
- ## Change parameters and watch the curve
25
-
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
- </panel>
30
-
31
- <plot min="0" max="12.56" label="Sine wave" x-label="x" y-label="Displacement">
32
- $$ y = a\sin(fx) $$
33
- </plot>
34
-
35
- <if when="{{ a == 0 }}">
36
- The amplitude is zero, so the curve lies flat on the horizontal axis.
37
- </if>
38
-
39
- ## Overlay two curves
40
-
41
- <plot min="-5" max="5" label="Parabola and line">
42
- $$ y = x^2 $$
43
- $$ y = 2x + 1 $$
44
- </plot>
1
+ # Make explanations explorable
2
+
3
+ Click a node or use the keyboard to select a step and read its description.
4
+
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
+ </node>
9
+
10
+ <node id="compute" label="Compute">
11
+ Formulas that depend on those parameters are recalculated.
12
+ </node>
13
+
14
+ <node id="view" label="View">
15
+ Prose, charts and hints update with the result.
16
+ </node>
17
+
18
+ <edge from="input" to="compute" label="Parameter change">
19
+ <edge from="compute" to="view" label="Updated result">
20
+ </diagram>
21
+
22
+ Current step: {{ selected == 'input' ? 'Input' : selected == 'compute' ? 'Compute' : 'View' }}.
23
+
24
+ ## Change parameters and watch the curve
25
+
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
+ </panel>
30
+
31
+ <plot min="0" max="12.56" label="Sine wave" x-label="x" y-label="Displacement">
32
+ $$ y = a\sin(fx) $$
33
+ </plot>
34
+
35
+ <if when="{{ a == 0 }}">
36
+ The amplitude is zero, so the curve lies flat on the horizontal axis.
37
+ </if>
38
+
39
+ ## Overlay two curves
40
+
41
+ <plot min="-5" max="5" label="Parabola and line">
42
+ $$ y = x^2 $$
43
+ $$ y = 2x + 1 $$
44
+ </plot>
@@ -1,61 +1,61 @@
1
- # Common component gallery
2
-
3
- ## Inputs and live results
4
-
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
-
9
- <select bind="plan" label="Plan" initial="pro">
10
- <option value="basic">Basic</option>
11
- <option value="pro">Pro</option>
12
- </select>
13
-
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
- </panel>
18
-
19
- Hello, **{{ name }}**.
20
-
21
- Estimated cost: **{{ round(quantity * 80 * (plan == 'pro' ? 1 : 0.8) * (annual ? 0.8 : 1)) }} USD**.
22
-
23
- <if when="{{ quantity >= 5 }}">
24
- <badge tone="success">Team tier reached</badge>
25
- </if>
26
-
27
- | Condition | Current choice |
28
- | --- | --- |
29
- | Plan | {{ plan == 'pro' ? 'Pro' : 'Basic' }} |
30
- | Annual billing | {{ annual ? 'On' : 'Off' }} |
31
- | Budget level | {{ budgetLevel }} |
32
-
33
- <if when="{{ express }}">
34
- <checklist label="Express preparation">
35
- - [x] Express checklist shown
36
- - [ ] Confirm the delivery time
37
- </checklist>
38
- </if>
39
-
40
- ## Components that work on their own
41
-
42
- These components do not expose parameters to the prose, so they omit bind.
43
-
44
- <grid>
45
- <card title="People counter">
46
- <counter label="Participants" initial="2" min="1" max="20">
47
- </card>
48
-
49
- <card title="Short focus">
50
- <timer label="One-minute countdown">
51
- </card>
52
- </grid>
53
-
54
- ## Show code as-is
55
-
56
- ```markdown
57
- <slider bind="example" label="Example parameter">
58
- Current value: {{ example }}.
59
- ```
60
-
61
- The code above is displayed as an example only and does not create a control.
1
+ # Common component gallery
2
+
3
+ ## Inputs and live results
4
+
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
+
9
+ <select bind="plan" label="Plan" initial="pro">
10
+ <option value="basic">Basic</option>
11
+ <option value="pro">Pro</option>
12
+ </select>
13
+
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
+ </panel>
18
+
19
+ Hello, **{{ name }}**.
20
+
21
+ Estimated cost: **{{ round(quantity * 80 * (plan == 'pro' ? 1 : 0.8) * (annual ? 0.8 : 1)) }} USD**.
22
+
23
+ <if when="{{ quantity >= 5 }}">
24
+ <badge tone="success">Team tier reached</badge>
25
+ </if>
26
+
27
+ | Condition | Current choice |
28
+ | --- | --- |
29
+ | Plan | {{ plan == 'pro' ? 'Pro' : 'Basic' }} |
30
+ | Annual billing | {{ annual ? 'On' : 'Off' }} |
31
+ | Budget level | {{ budgetLevel }} |
32
+
33
+ <if when="{{ express }}">
34
+ <checklist label="Express preparation">
35
+ - [x] Express checklist shown
36
+ - [ ] Confirm the delivery time
37
+ </checklist>
38
+ </if>
39
+
40
+ ## Components that work on their own
41
+
42
+ These components do not expose parameters to the prose, so they omit bind.
43
+
44
+ <grid>
45
+ <card title="People counter">
46
+ <counter label="Participants" initial="2" min="1" max="20">
47
+ </card>
48
+
49
+ <card title="Short focus">
50
+ <timer label="One-minute countdown">
51
+ </card>
52
+ </grid>
53
+
54
+ ## Show code as-is
55
+
56
+ ```markdown
57
+ <slider bind="example" label="Example parameter">
58
+ Current value: {{ example }}.
59
+ ```
60
+
61
+ The code above is displayed as an example only and does not create a control.
@@ -0,0 +1,24 @@
1
+ # HTML 与 ReactiveMD
2
+
3
+ <details open>
4
+ <summary>展开查看<strong>交互示例</strong></summary>
5
+
6
+ ## 调整参数
7
+
8
+ <counter bind="count" label="次数" initial="2">
9
+
10
+ 当前值:**{{ count }}**。HTML 上下标:H<sub>2</sub>O、x<sup>2</sup>。
11
+
12
+ <details>
13
+ <summary>补充说明</summary>
14
+
15
+ 折叠正文支持 Markdown、公式与 ReactiveMD 控件。
16
+
17
+ </details>
18
+ </details>
19
+
20
+ <blockquote>默认模式使用现有渲染器和主题。</blockquote>
21
+
22
+ <ol start="3"><li>支持 HTML 列表。</li><li>代码按原样显示。</li></ol>
23
+
24
+ <pre><code>&lt;counter label="这里是代码"&gt; {{ count }}</code></pre>
@@ -1,36 +1,36 @@
1
- # Fill it in, watch the result
2
-
3
- Enter your preferences and the description below updates immediately.
4
-
5
- <panel title="Meeting preparation">
6
- <input bind="name" label="Name" placeholder="What should we call you?">
7
-
8
- <choices bind="role" label="Usage">
9
- <option value="personal">Personal use</option>
10
- <option value="team">Team use</option>
11
- </choices>
12
-
13
- <date bind="appointment" label="Preferred meeting date" initial="2026-10-22">
14
-
15
- <textarea bind="message" label="What interactive document do you want to build?" placeholder="For example: a course handout with adjustable parameters">
16
-
17
- <checkbox bind="showNotes" label="Show the preparation checklist">
18
- </panel>
19
-
20
- <card title="Current plan">
21
- Name: **{{ name == '' ? 'Not provided yet' : name }}**.
22
-
23
- Usage: {{ role == 'personal' ? 'Personal use' : 'Team use' }}.
24
-
25
- Planned date: {{ appointment }}.
26
-
27
- Idea: {{ message == '' ? 'Start with a small calculator.' : message }}
28
- </card>
29
-
30
- <if when="{{ showNotes }}">
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
- </checklist>
36
- </if>
1
+ # Fill it in, watch the result
2
+
3
+ Enter your preferences and the description below updates immediately.
4
+
5
+ <panel title="Meeting preparation">
6
+ <input bind="name" label="Name" placeholder="What should we call you?">
7
+
8
+ <choices bind="role" label="Usage">
9
+ <option value="personal">Personal use</option>
10
+ <option value="team">Team use</option>
11
+ </choices>
12
+
13
+ <date bind="appointment" label="Preferred meeting date" initial="2026-10-22">
14
+
15
+ <textarea bind="message" label="What interactive document do you want to build?" placeholder="For example: a course handout with adjustable parameters">
16
+
17
+ <checkbox bind="showNotes" label="Show the preparation checklist">
18
+ </panel>
19
+
20
+ <card title="Current plan">
21
+ Name: **{{ name == '' ? 'Not provided yet' : name }}**.
22
+
23
+ Usage: {{ role == 'personal' ? 'Personal use' : 'Team use' }}.
24
+
25
+ Planned date: {{ appointment }}.
26
+
27
+ Idea: {{ message == '' ? 'Start with a small calculator.' : message }}
28
+ </card>
29
+
30
+ <if when="{{ showNotes }}">
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
+ </checklist>
36
+ </if>
@@ -1,24 +1,24 @@
1
- # Planning, timing and simple tools
2
-
3
- <timeline title="45-minute work plan">
4
- | Task | Start | Duration | Notes |
5
- | --- | ---: | ---: | --- |
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
- </timeline>
11
-
12
- <timer label="One-minute focus timer" duration="60">
13
-
14
- ## Splitting a dinner bill
15
-
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
- </panel>
21
-
22
- Each person pays **{{ round(total * (1 + tip / 100) / people * 100) / 100 }} USD**.
23
-
24
- Amounts are rounded to two decimals without padding trailing zeros.
1
+ # Planning, timing and simple tools
2
+
3
+ <timeline title="45-minute work plan">
4
+ | Task | Start | Duration | Notes |
5
+ | --- | ---: | ---: | --- |
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
+ </timeline>
11
+
12
+ <timer label="One-minute focus timer" duration="60">
13
+
14
+ ## Splitting a dinner bill
15
+
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
+ </panel>
21
+
22
+ Each person pays **{{ round(total * (1 + tip / 100) / people * 100) / 100 }} USD**.
23
+
24
+ Amounts are rounded to two decimals without padding trailing zeros.
@@ -1,20 +1,20 @@
1
- # Plan calculator
2
-
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
-
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
- </panel>
9
-
10
- Current headcount: **{{ seats }}**.
11
-
12
- Per person per month: **{{ annual ? 80 : 100 }} USD**.
13
-
14
- Monthly total: **{{ seats * (annual ? 80 : 100) }} USD**.
15
-
16
- <if when="{{ seats >= 5 }}">
17
- <alert title="Team plan">
18
- You selected at least 5 people. Switch the billing cycle to compare costs.
19
- </alert>
20
- </if>
1
+ # Plan calculator
2
+
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
+
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
+ </panel>
9
+
10
+ Current headcount: **{{ seats }}**.
11
+
12
+ Per person per month: **{{ annual ? 80 : 100 }} USD**.
13
+
14
+ Monthly total: **{{ seats * (annual ? 80 : 100) }} USD**.
15
+
16
+ <if when="{{ seats >= 5 }}">
17
+ <alert title="Team plan">
18
+ You selected at least 5 people. Switch the billing cycle to compare costs.
19
+ </alert>
20
+ </if>
@@ -1,20 +1,20 @@
1
- # 在文档里查找组件
2
-
3
- 在表格的搜索框输入“视觉”“参数”或其他关键词。点击列名可以排序,分页控件用于翻页。
4
-
5
- <panel title="本地组件目录">
6
- <table label="组件目录" page-size="4">
7
- | 名称 | 分类 | 用途 |
8
- | --- | --- | --- |
9
- | slider | 参数 | 拖动调整数字 |
10
- | toggle | 参数 | 切换开关 |
11
- | choices | 参数 | 从几个方案中选择 |
12
- | chart | 视觉 | 把 Markdown 表格变成图表 |
13
- | plot | 视觉 | 使用 LaTeX 绘制函数 |
14
- | diagram | 视觉 | 点击节点探索说明 |
15
- | checklist | 内容 | 勾选完成事项 |
16
- | timer | 工具 | 开始、暂停和重置倒计时 |
17
- </table>
18
- </panel>
19
-
20
- 目录数据就在这份文档中。搜索时直接筛选表格内容,恢复默认会清空查询并回到原始顺序。
1
+ # 在文档里查找组件
2
+
3
+ 在表格的搜索框输入“视觉”“参数”或其他关键词。点击列名可以排序,分页控件用于翻页。
4
+
5
+ <panel title="本地组件目录">
6
+ <table label="组件目录" page-size="4">
7
+ | 名称 | 分类 | 用途 |
8
+ | --- | --- | --- |
9
+ | slider | 参数 | 拖动调整数字 |
10
+ | toggle | 参数 | 切换开关 |
11
+ | choices | 参数 | 从几个方案中选择 |
12
+ | chart | 视觉 | 把 Markdown 表格变成图表 |
13
+ | plot | 视觉 | 使用 LaTeX 绘制函数 |
14
+ | diagram | 视觉 | 点击节点探索说明 |
15
+ | checklist | 内容 | 勾选完成事项 |
16
+ | timer | 工具 | 开始、暂停和重置倒计时 |
17
+ </table>
18
+ </panel>
19
+
20
+ 目录数据就在这份文档中。搜索时直接筛选表格内容,恢复默认会清空查询并回到原始顺序。
@@ -1,73 +1,73 @@
1
- # 图表跟着输入变化
2
-
3
- ## 多系列预算比较
4
-
5
- <chart title="实际费用与预算" y-label="元">
6
- | 项目 | 实际费用 | 预算 |
7
- | --- | ---: | ---: |
8
- | 内容 | 120 | 150 |
9
- | 视觉 | 230 | 200 |
10
- | 交互 | 180 | 220 |
11
- | 测试 | 90 | 120 |
12
- </chart>
13
-
14
- ## 储蓄曲线
15
-
16
- 每月末存入固定金额,按固定年利率、每月复利计算。$P$ 为初始金额,$m$ 为每月存入金额,$r$ 为年利率的百分数。
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">
23
- </panel>
24
-
25
- <plot min="0" max="{{ t }}" label="储蓄增长曲线" x-label="年" y-label="金额">
26
- $$
27
- y =
28
- \begin{cases}
29
- P + 12mx, & r = 0 \\
30
- P\left(1+\frac{r}{1200}\right)^{12x}
31
- + m\frac{\left(1+\frac{r}{1200}\right)^{12x}-1}{r/1200}, & r \ne 0
32
- \end{cases}
33
- $$
34
- </plot>
35
-
36
- 把指针移到曲线末端,可以读取第 {{ t }} 年的期末金额。将年利率调到 0,可以比较只存入本金时的变化。
37
-
38
- ## 占比与散点
39
-
40
- <grid>
41
- <card title="费用占比">
42
- <chart kind="donut" title="各项实际费用占比">
43
- | 项目 | 实际费用 |
44
- | --- | ---: |
45
- | 内容 | 120 |
46
- | 视觉 | 230 |
47
- | 交互 | 180 |
48
- | 测试 | 90 |
49
- </chart>
50
- </card>
51
-
52
- <card title="预算与实际">
53
- <chart kind="scatter" title="预算散点" x="预算" y="实际" x-label="预算" y-label="实际">
54
- | 预算 | 实际 |
55
- | ---: | ---: |
56
- | 150 | 120 |
57
- | 200 | 230 |
58
- | 220 | 180 |
59
- | 120 | 90 |
60
- </chart>
61
- </card>
62
- </grid>
63
-
64
- ## 图表读取同一份参数
65
-
66
- <slider bind="people" label="人数" initial="2" min="1" max="20">
67
-
68
- <chart title="按人数比较方案费用" y-label="元">
69
- | 方案 | 每月费用 |
70
- | --- | ---: |
71
- | 基础版 | {{ people * 20 }} |
72
- | 专业版 | {{ people * 35 }} |
73
- </chart>
1
+ # 图表跟着输入变化
2
+
3
+ ## 多系列预算比较
4
+
5
+ <chart title="实际费用与预算" y-label="元">
6
+ | 项目 | 实际费用 | 预算 |
7
+ | --- | ---: | ---: |
8
+ | 内容 | 120 | 150 |
9
+ | 视觉 | 230 | 200 |
10
+ | 交互 | 180 | 220 |
11
+ | 测试 | 90 | 120 |
12
+ </chart>
13
+
14
+ ## 储蓄曲线
15
+
16
+ 每月末存入固定金额,按固定年利率、每月复利计算。$P$ 为初始金额,$m$ 为每月存入金额,$r$ 为年利率的百分数。
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">
23
+ </panel>
24
+
25
+ <plot min="0" max="{{ t }}" label="储蓄增长曲线" x-label="年" y-label="金额">
26
+ $$
27
+ y =
28
+ \begin{cases}
29
+ P + 12mx, & r = 0 \\
30
+ P\left(1+\frac{r}{1200}\right)^{12x}
31
+ + m\frac{\left(1+\frac{r}{1200}\right)^{12x}-1}{r/1200}, & r \ne 0
32
+ \end{cases}
33
+ $$
34
+ </plot>
35
+
36
+ 把指针移到曲线末端,可以读取第 {{ t }} 年的期末金额。将年利率调到 0,可以比较只存入本金时的变化。
37
+
38
+ ## 占比与散点
39
+
40
+ <grid>
41
+ <card title="费用占比">
42
+ <chart kind="donut" title="各项实际费用占比">
43
+ | 项目 | 实际费用 |
44
+ | --- | ---: |
45
+ | 内容 | 120 |
46
+ | 视觉 | 230 |
47
+ | 交互 | 180 |
48
+ | 测试 | 90 |
49
+ </chart>
50
+ </card>
51
+
52
+ <card title="预算与实际">
53
+ <chart kind="scatter" title="预算散点" x="预算" y="实际" x-label="预算" y-label="实际">
54
+ | 预算 | 实际 |
55
+ | ---: | ---: |
56
+ | 150 | 120 |
57
+ | 200 | 230 |
58
+ | 220 | 180 |
59
+ | 120 | 90 |
60
+ </chart>
61
+ </card>
62
+ </grid>
63
+
64
+ ## 图表读取同一份参数
65
+
66
+ <slider bind="people" label="人数" initial="2" min="1" max="20">
67
+
68
+ <chart title="按人数比较方案费用" y-label="元">
69
+ | 方案 | 每月费用 |
70
+ | --- | ---: |
71
+ | 基础版 | {{ people * 20 }} |
72
+ | 专业版 | {{ people * 35 }} |
73
+ </chart>
@@ -1,32 +1,32 @@
1
- # 用清单组织体验过程
2
-
3
- <panel title="体验清单">
4
- <checklist bind="done" label="完成这些操作">
5
- - [x] 读懂源文档
6
- - [ ] 调整参数并观察结果
7
- - [ ] 在手机宽度试用
8
- </checklist>
9
-
10
- 已完成 **{{ len(done) }} / 3** 项。
11
-
12
- <progress label="完成进度" value="{{ len(done) / 3 * 100 }}">
13
-
14
- <if when="{{ len(done) == 3 }}">
15
- <alert tone="success" title="体验完成">
16
- 你已经看过源码、试过交互,也检查了窄屏效果。
17
- </alert>
18
- </if>
19
- </panel>
20
-
21
- ## 搜索、排序和分页
22
-
23
- <table label="组件费用示例" page-size="3">
24
- | 名称 | 分类 | 价格 |
25
- | --- | --- | ---: |
26
- | 文档 | 基础 | 20 |
27
- | 参数面板 | 输入 | 45 |
28
- | 图表 | 视觉 | 80 |
29
- | 图解 | 视觉 | 65 |
30
- | 清单 | 基础 | 30 |
31
- | 计划 | 工具 | 35 |
32
- </table>
1
+ # 用清单组织体验过程
2
+
3
+ <panel title="体验清单">
4
+ <checklist bind="done" label="完成这些操作">
5
+ - [x] 读懂源文档
6
+ - [ ] 调整参数并观察结果
7
+ - [ ] 在手机宽度试用
8
+ </checklist>
9
+
10
+ 已完成 **{{ len(done) }} / 3** 项。
11
+
12
+ <progress label="完成进度" value="{{ len(done) / 3 * 100 }}">
13
+
14
+ <if when="{{ len(done) == 3 }}">
15
+ <alert tone="success" title="体验完成">
16
+ 你已经看过源码、试过交互,也检查了窄屏效果。
17
+ </alert>
18
+ </if>
19
+ </panel>
20
+
21
+ ## 搜索、排序和分页
22
+
23
+ <table label="组件费用示例" page-size="3">
24
+ | 名称 | 分类 | 价格 |
25
+ | --- | --- | ---: |
26
+ | 文档 | 基础 | 20 |
27
+ | 参数面板 | 输入 | 45 |
28
+ | 图表 | 视觉 | 80 |
29
+ | 图解 | 视觉 | 65 |
30
+ | 清单 | 基础 | 30 |
31
+ | 计划 | 工具 | 35 |
32
+ </table>