reactive-md 0.0.0-stage → 0.3.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.
- package/CHANGELOG.md +53 -0
- package/CONTRIBUTING.md +65 -0
- package/LICENSE +21 -0
- package/README.en.md +76 -0
- package/README.md +88 -2
- package/SECURITY.md +71 -0
- package/THIRD_PARTY_NOTICES.md +1967 -0
- package/dist-library/reactive-md-react.js +3649 -0
- package/dist-library/reactive-md.css +2 -0
- package/dist-library/reactive-md.js +4 -0
- package/dist-library/runtime-CPzMEMcW.js +11111 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/LocalDocumentView.d.ts +19 -0
- package/dist-library/types/local/compiler.d.ts +3 -0
- package/dist-library/types/local/expression.d.ts +37 -0
- package/dist-library/types/local/heading-anchors.d.ts +6 -0
- package/dist-library/types/local/index.d.ts +6 -0
- package/dist-library/types/local/limits.d.ts +14 -0
- package/dist-library/types/local/math-view.d.ts +14 -0
- package/dist-library/types/local/math.d.ts +43 -0
- package/dist-library/types/local/parser.d.ts +7 -0
- package/dist-library/types/local/render-types.d.ts +12 -0
- package/dist-library/types/local/runtime.d.ts +2 -0
- package/dist-library/types/local/schema.d.ts +55 -0
- package/dist-library/types/local/types.d.ts +84 -0
- package/dist-library/types/local/version.d.ts +2 -0
- package/dist-library/types/local/visuals.d.ts +3 -0
- package/dist-library/types/react/index.d.ts +2 -0
- package/docs/compatibility.md +68 -0
- package/docs/component-development.md +206 -0
- package/docs/component-protocol.md +685 -0
- package/docs/local-guide.md +941 -0
- package/docs/local-integration.md +218 -0
- package/docs/local-interaction-syntax.md +439 -0
- package/docs/performance.md +67 -0
- package/docs/releasing.md +92 -0
- package/examples/conformance/README.md +51 -0
- package/examples/conformance/component-protocol-1.json +194 -0
- package/examples/conformance/component-protocol-1.schema.json +76 -0
- package/examples/conformance/local-draft-1.json +50 -0
- package/examples/integration/README.md +29 -0
- package/examples/integration/core/index.mjs +19 -0
- package/examples/integration/core/package.json +7 -0
- package/examples/integration/react/index.html +12 -0
- package/examples/integration/react/main.jsx +21 -0
- package/examples/integration/react/package.json +9 -0
- package/examples/local/README.md +66 -0
- package/examples/local/catalog.reactive.md +20 -0
- package/examples/local/charts.reactive.md +73 -0
- package/examples/local/checklist.reactive.md +32 -0
- package/examples/local/comparison.reactive.md +47 -0
- package/examples/local/components.reactive.md +44 -0
- package/examples/local/counter.reactive.md +7 -0
- package/examples/local/diagnostics.reactive.md +54 -0
- package/examples/local/diagram.reactive.md +44 -0
- package/examples/local/gallery.reactive.md +61 -0
- package/examples/local/parameters.reactive.md +36 -0
- package/examples/local/planning.reactive.md +24 -0
- package/examples/local/pricing.reactive.md +20 -0
- package/package.json +77 -6
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# 语言验收数据
|
|
2
|
+
|
|
3
|
+
[local-draft-1.json](local-draft-1.json) 是可复制的最小语义验收集,包含源码、编译结果、初始参数、状态写入和预期文本。数据随 npm 包分发,其他工具或实现可以读取同一份 JSON。
|
|
4
|
+
|
|
5
|
+
- `syntaxVersion` 对应核心导出的 `LOCAL_SYNTAX_VERSION`。
|
|
6
|
+
- `ok` 是预期编译结果;`codes` 是去重后的预期诊断码集合,省略时应无诊断。编译成功时也可能包含降级警告。
|
|
7
|
+
- `initial` 检查公开参数的初值;`bindingNames` 在出现时检查完整绑定名集合。
|
|
8
|
+
- `actions` 按 `bind` 查找控件并提交 `value`;有 `codes` 时预期写入被拒绝,否则预期成功。
|
|
9
|
+
- `text` 用更新后的状态求值,结果应等于 `expectedText`。
|
|
10
|
+
|
|
11
|
+
运行器见仓库中的 `tests/conformance.test.ts`,执行 `npm test` 即可检查。本集覆盖共享参数、隐藏初始化、写入约束、代码隔离和诊断;完整语法验收还包含其他语言测试及浏览器检查,规则见[语法规范](../../docs/local-interaction-syntax.md)。诊断码的跨版本约定见[兼容说明](../../docs/compatibility.md)。
|
|
12
|
+
|
|
13
|
+
## 组块协议验收
|
|
14
|
+
|
|
15
|
+
[component-protocol-1.json](component-protocol-1.json) 为[组块协议](../../docs/component-protocol.md)提供代表性用例,覆盖 `slider`、`tabs`、`plot` 以及未知组块的惰性降级。[JSON Schema](component-protocol-1.schema.json) 定义验收文件格式,可供其他实现的工具读取。这个 JSON 是测试输入和预期结果,组件提案的声明模板见[开发指南](../../docs/component-development.md)。
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm run test:components
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
该命令运行组块协议用例和原有语言验收数据。新增组块应补充自己的用例、单元测试和受影响的渲染器检查;通过本集合只证明这些具体用例通过。
|
|
22
|
+
|
|
23
|
+
### 文件与用例字段
|
|
24
|
+
|
|
25
|
+
文件根对象包含 `protocolVersion`、`syntaxVersion` 和非空的 `cases`。当前分别为 `component-protocol-1` 和 `local-draft-1`。包版本另由 `package.json` 标识,不由这两个字段推断。
|
|
26
|
+
|
|
27
|
+
| 字段 | 规则 |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `id` | 必填,在文件内唯一;描述一个可观察的行为 |
|
|
30
|
+
| `component` | 必填,标明主要验收的组块;源码可同时使用其他组块 |
|
|
31
|
+
| `source` | 必填,原始文档源码 |
|
|
32
|
+
| `ok` | 必填,预期编译是否成功 |
|
|
33
|
+
| `codes` | 必填,编译诊断码的去重集合;无诊断时为 `[]`,忽略顺序、精确比较集合 |
|
|
34
|
+
| `initial` | 可选,编译成功后的初始状态期望,按给定键部分匹配 |
|
|
35
|
+
| `bindingNames` | 可选,完整公开绑定名集合;不包含匿名组块的内部状态键 |
|
|
36
|
+
| `actions` | 可选,依次写入命名绑定;每项必填 `bind`、`value`、`codes`,可选 `expectedState` |
|
|
37
|
+
| `reset` | 可选,写入完成后重置指定节点;必填 `component` 和 `expectedState`,`index` 默认为同名组件源码顺序中的第 0 个 |
|
|
38
|
+
| `text`、`expectedText` | 可选,必须成对;在写入和重置后求值并精确比较结果 |
|
|
39
|
+
| `htmlIncludes`、`htmlExcludes` | 可选,在最终状态做 React 静态渲染,逐项检查包含或不包含的片段 |
|
|
40
|
+
|
|
41
|
+
`initial`、`expectedState` 的值使用语言现有的 `LocalValue`:字符串、有限数字、布尔值、`null` 或字符串数组。`actions[].codes` 是该次写入返回的诊断码集合,无诊断仍须写 `[]`;被拒绝的写入应保留上一次合法状态。运行器通过 `bind` 查找已编译的控件,调用 `runtime.set`,不模拟浏览器输入事件。
|
|
42
|
+
|
|
43
|
+
执行顺序固定为:校验数据格式及唯一 ID,编译并比较诊断,检查初始状态及公开绑定名,依序写入,再重置,最后检查文本和可选渲染结果。创建的运行时均在结束时销毁。`ok: false` 的用例只允许编译期字段,不能附加状态、动作或渲染期望;未知字段、缺失字段和不合法值应当让验收失败。
|
|
44
|
+
|
|
45
|
+
`reset` 调用当前实例的 `runtime.reset(node)`,节点按组块名和索引查找;验收文件不保存 `node.id`。这项检查验证运行时重置语义,点击重置按钮仍需渲染器或浏览器检查。
|
|
46
|
+
|
|
47
|
+
### 可移植范围
|
|
48
|
+
|
|
49
|
+
编译结果、诊断集合、状态变化和表达式文本是可移植的语义期望。HTML 片段只检查本仓库的 React 参考渲染器;其他渲染器应验证同等用户行为,无需生成相同 DOM 或 CSS 类名。
|
|
50
|
+
|
|
51
|
+
这些用例不会证明真实键盘操作、焦点移动、中文输入法、375px 布局、计时器暂停或销毁后的计时清理。涉及这些行为的贡献仍需提交相应浏览器证据,检查方法见[开发指南](../../docs/component-development.md)。诊断码的跨版本稳定性继续遵守[兼容说明](../../docs/compatibility.md)。
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
{
|
|
2
|
+
"protocolVersion": "component-protocol-1",
|
|
3
|
+
"syntaxVersion": "local-draft-1",
|
|
4
|
+
"cases": [
|
|
5
|
+
{
|
|
6
|
+
"id": "slider-explicit-initial",
|
|
7
|
+
"component": "slider",
|
|
8
|
+
"source": "<slider bind=\"seats\" label=\"人数\" initial=\"2\" min=\"1\" max=\"20\">\n\n当前 {{ seats }} 人。",
|
|
9
|
+
"ok": true,
|
|
10
|
+
"codes": [],
|
|
11
|
+
"initial": { "seats": 2 },
|
|
12
|
+
"bindingNames": ["seats"],
|
|
13
|
+
"text": "当前 {{ seats }} 人。",
|
|
14
|
+
"expectedText": "当前 2 人。",
|
|
15
|
+
"htmlIncludes": ["人数"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "slider-default-min",
|
|
19
|
+
"component": "slider",
|
|
20
|
+
"source": "<slider bind=\"level\" label=\"档位\" min=\"5\" max=\"15\">",
|
|
21
|
+
"ok": true,
|
|
22
|
+
"codes": [],
|
|
23
|
+
"initial": { "level": 5 },
|
|
24
|
+
"bindingNames": ["level"],
|
|
25
|
+
"text": "档位:{{ level }}。",
|
|
26
|
+
"expectedText": "档位:5。"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "slider-shared-update",
|
|
30
|
+
"component": "slider",
|
|
31
|
+
"source": "<slider bind=\"n\" label=\"甲\" initial=\"1\" min=\"0\" max=\"10\">\n<slider bind=\"n\" label=\"乙\" min=\"0\" max=\"10\">\n\n共享值 {{ n }}。",
|
|
32
|
+
"ok": true,
|
|
33
|
+
"codes": [],
|
|
34
|
+
"initial": { "n": 1 },
|
|
35
|
+
"bindingNames": ["n"],
|
|
36
|
+
"actions": [
|
|
37
|
+
{ "bind": "n", "value": 7, "codes": [], "expectedState": { "n": 7 } }
|
|
38
|
+
],
|
|
39
|
+
"text": "共享值 {{ n }}。",
|
|
40
|
+
"expectedText": "共享值 7。"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "slider-rejects-invalid-writes",
|
|
44
|
+
"component": "slider",
|
|
45
|
+
"source": "<slider bind=\"amount\" label=\"数量\" initial=\"4\" min=\"0\" max=\"10\">",
|
|
46
|
+
"ok": true,
|
|
47
|
+
"codes": [],
|
|
48
|
+
"initial": { "amount": 4 },
|
|
49
|
+
"bindingNames": ["amount"],
|
|
50
|
+
"actions": [
|
|
51
|
+
{ "bind": "amount", "value": 11, "codes": ["local.runtime.value"], "expectedState": { "amount": 4 } },
|
|
52
|
+
{ "bind": "amount", "value": 6, "codes": [], "expectedState": { "amount": 6 } },
|
|
53
|
+
{ "bind": "amount", "value": 1.5, "codes": ["local.runtime.value"], "expectedState": { "amount": 6 } }
|
|
54
|
+
],
|
|
55
|
+
"text": "{{ amount }}",
|
|
56
|
+
"expectedText": "6"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "slider-shared-constraint-mismatch",
|
|
60
|
+
"component": "slider",
|
|
61
|
+
"source": "<slider bind=\"n\" label=\"甲\" min=\"0\" max=\"10\">\n<slider bind=\"n\" label=\"乙\" min=\"0\" max=\"20\">",
|
|
62
|
+
"ok": false,
|
|
63
|
+
"codes": ["local.binding.constraint"]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "slider-anonymous-controls",
|
|
67
|
+
"component": "slider",
|
|
68
|
+
"source": "<slider label=\"匿名甲\" initial=\"3\" min=\"0\" max=\"10\">\n<slider label=\"匿名乙\" initial=\"7\" min=\"0\" max=\"10\">",
|
|
69
|
+
"ok": true,
|
|
70
|
+
"codes": [],
|
|
71
|
+
"bindingNames": [],
|
|
72
|
+
"htmlIncludes": ["匿名甲", "匿名乙"]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "slider-initial-out-of-range",
|
|
76
|
+
"component": "slider",
|
|
77
|
+
"source": "<slider bind=\"ratio\" label=\"比例\" initial=\"12\" min=\"0\" max=\"10\">",
|
|
78
|
+
"ok": false,
|
|
79
|
+
"codes": ["local.initial.range"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "tabs-default-first",
|
|
83
|
+
"component": "tabs",
|
|
84
|
+
"source": "<tabs bind=\"view\" label=\"视图\">\n<tab label=\"概览\">概览内容</tab>\n<tab label=\"细节\" value=\"detail\">细节内容</tab>\n</tabs>",
|
|
85
|
+
"ok": true,
|
|
86
|
+
"codes": [],
|
|
87
|
+
"initial": { "view": "tab-1" },
|
|
88
|
+
"bindingNames": ["view"],
|
|
89
|
+
"actions": [
|
|
90
|
+
{ "bind": "view", "value": "detail", "codes": [], "expectedState": { "view": "detail" } },
|
|
91
|
+
{ "bind": "view", "value": "absent", "codes": ["local.runtime.value"], "expectedState": { "view": "detail" } }
|
|
92
|
+
],
|
|
93
|
+
"text": "当前页 {{ view }}。",
|
|
94
|
+
"expectedText": "当前页 detail。"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "tabs-explicit-initial-and-reset",
|
|
98
|
+
"component": "tabs",
|
|
99
|
+
"source": "<tabs bind=\"view\" label=\"视图\" initial=\"detail\">\n<tab label=\"概览\" value=\"summary\">摘要页</tab>\n<tab label=\"细节\" value=\"detail\">细节页</tab>\n</tabs>",
|
|
100
|
+
"ok": true,
|
|
101
|
+
"codes": [],
|
|
102
|
+
"initial": { "view": "detail" },
|
|
103
|
+
"bindingNames": ["view"],
|
|
104
|
+
"actions": [
|
|
105
|
+
{ "bind": "view", "value": "summary", "codes": [], "expectedState": { "view": "summary" } }
|
|
106
|
+
],
|
|
107
|
+
"reset": { "component": "tabs", "index": 0, "expectedState": { "view": "detail" } },
|
|
108
|
+
"text": "{{ view }}",
|
|
109
|
+
"expectedText": "detail"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "tabs-exclusive-binding",
|
|
113
|
+
"component": "tabs",
|
|
114
|
+
"source": "<tabs bind=\"view\" label=\"甲\">\n<tab label=\"A\">甲页</tab>\n</tabs>\n<tabs bind=\"view\" label=\"乙\">\n<tab label=\"B\">乙页</tab>\n</tabs>",
|
|
115
|
+
"ok": false,
|
|
116
|
+
"codes": ["local.binding.exclusive"]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "tabs-hidden-controls-and-panel-reset",
|
|
120
|
+
"component": "tabs",
|
|
121
|
+
"source": "<panel title=\"设置\">\n<tabs bind=\"view\" label=\"分页\" initial=\"basic\">\n<tab label=\"基本\" value=\"basic\">\n<slider bind=\"a\" label=\"A\" initial=\"2\" min=\"0\" max=\"10\">\n</tab>\n<tab label=\"高级\" value=\"advanced\">\n<slider bind=\"b\" label=\"B\" initial=\"7\" min=\"0\" max=\"10\">\n</tab>\n</tabs>\n</panel>",
|
|
122
|
+
"ok": true,
|
|
123
|
+
"codes": [],
|
|
124
|
+
"initial": { "view": "basic", "a": 2, "b": 7 },
|
|
125
|
+
"bindingNames": ["a", "b", "view"],
|
|
126
|
+
"actions": [
|
|
127
|
+
{ "bind": "view", "value": "advanced", "codes": [], "expectedState": { "view": "advanced", "a": 2, "b": 7 } },
|
|
128
|
+
{ "bind": "a", "value": 5, "codes": [], "expectedState": { "view": "advanced", "a": 5, "b": 7 } },
|
|
129
|
+
{ "bind": "b", "value": 9, "codes": [], "expectedState": { "view": "advanced", "a": 5, "b": 9 } }
|
|
130
|
+
],
|
|
131
|
+
"reset": { "component": "panel", "expectedState": { "view": "basic", "a": 2, "b": 7 } },
|
|
132
|
+
"text": "{{ view }}:{{ a }} / {{ b }}",
|
|
133
|
+
"expectedText": "basic:2 / 7"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "plot-valid-latex",
|
|
137
|
+
"component": "plot",
|
|
138
|
+
"source": "<slider bind=\"a\" label=\"振幅\" initial=\"1\" min=\"0\" max=\"3\" step=\"0.5\">\n\n<plot label=\"正弦波\" min=\"-2\" max=\"2\">\n$$ y = a\\sin x $$\n</plot>",
|
|
139
|
+
"ok": true,
|
|
140
|
+
"codes": [],
|
|
141
|
+
"initial": { "a": 1 },
|
|
142
|
+
"bindingNames": ["a"],
|
|
143
|
+
"htmlIncludes": ["区间 -2 到 2,200 个采样点"]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "plot-dynamic-range",
|
|
147
|
+
"component": "plot",
|
|
148
|
+
"source": "<slider bind=\"low\" label=\"下限\" initial=\"-2\" min=\"-10\" max=\"0\">\n<slider bind=\"high\" label=\"上限\" initial=\"3\" min=\"0\" max=\"10\">\n\n<plot label=\"范围曲线\" min=\"{{ low }}\" max=\"{{ high }}\">\n$$ y = x $$\n</plot>",
|
|
149
|
+
"ok": true,
|
|
150
|
+
"codes": [],
|
|
151
|
+
"initial": { "low": -2, "high": 3 },
|
|
152
|
+
"bindingNames": ["low", "high"],
|
|
153
|
+
"actions": [
|
|
154
|
+
{ "bind": "high", "value": 5, "codes": [], "expectedState": { "high": 5 } }
|
|
155
|
+
],
|
|
156
|
+
"text": "{{ high - low }}",
|
|
157
|
+
"expectedText": "7",
|
|
158
|
+
"htmlIncludes": ["区间 -2 到 5,200 个采样点"]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "plot-non-number-binding",
|
|
162
|
+
"component": "plot",
|
|
163
|
+
"source": "<toggle bind=\"a\" label=\"开关\">\n\n<plot label=\"类型错误\">\n$$ y = a\\sin x $$\n</plot>",
|
|
164
|
+
"ok": false,
|
|
165
|
+
"codes": ["local.math.binding"]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"id": "plot-invalid-range",
|
|
169
|
+
"component": "plot",
|
|
170
|
+
"source": "<plot label=\"无效范围\" min=\"5\" max=\"5\">\n$$ y = x $$\n</plot>",
|
|
171
|
+
"ok": false,
|
|
172
|
+
"codes": ["local.constraint"]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"id": "plot-point-budget",
|
|
176
|
+
"component": "plot",
|
|
177
|
+
"source": "<plot label=\"第一组\" min=\"-1\" max=\"1\" samples=\"2000\">\n$$ y = x $$\n$$ y = x^2 $$\n$$ y = \\sin x $$\n$$ y = \\cos x $$\n$$ y = x/2 $$\n$$ y = 2x $$\n</plot>\n\n<plot label=\"第二组\" min=\"-1\" max=\"1\" samples=\"2000\">\n$$ y = x + 1 $$\n$$ y = x - 1 $$\n$$ y = 3x $$\n$$ y = \\frac{x}{3} $$\n$$ y = -x $$\n</plot>",
|
|
178
|
+
"ok": false,
|
|
179
|
+
"codes": ["local.budget.plot.points"]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"id": "unknown-tag-inert-fallback",
|
|
183
|
+
"component": "slider",
|
|
184
|
+
"source": "<slidr label=\"拼写错误\">\n<slider bind=\"ghost\" label=\"不应激活\" initial=\"4\" min=\"0\" max=\"10\">\n{{ ghost }} 不应执行。\n</slidr>\n\n外部仍可计算:{{ 1 + 2 }}。",
|
|
185
|
+
"ok": true,
|
|
186
|
+
"codes": ["local.component.unknown"],
|
|
187
|
+
"bindingNames": [],
|
|
188
|
+
"text": "外部仍可计算:{{ 1 + 2 }}。",
|
|
189
|
+
"expectedText": "外部仍可计算:3。",
|
|
190
|
+
"htmlIncludes": ["未支持的语法,已按源码原样显示"],
|
|
191
|
+
"htmlExcludes": ["<input"]
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "ReactiveMD component-protocol-1 reference cases",
|
|
4
|
+
"description": "Portable semantic cases and optional React reference-renderer assertions. This is a test-data format, not a loadable component or serialized AST format.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["protocolVersion", "syntaxVersion", "cases"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"protocolVersion": { "const": "component-protocol-1" },
|
|
10
|
+
"syntaxVersion": { "const": "local-draft-1" },
|
|
11
|
+
"cases": {
|
|
12
|
+
"type": "array", "minItems": 1,
|
|
13
|
+
"items": { "$ref": "#/$defs/case" },
|
|
14
|
+
"$comment": "Case ids must also be unique across the suite; checked by the reference runner."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"$defs": {
|
|
18
|
+
"name": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
|
|
19
|
+
"strings": { "type": "array", "items": { "type": "string", "minLength": 1 } },
|
|
20
|
+
"codes": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
|
|
21
|
+
"value": {
|
|
22
|
+
"oneOf": [
|
|
23
|
+
{ "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" },
|
|
24
|
+
{ "type": "array", "items": { "type": "string" } }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"state": { "type": "object", "additionalProperties": { "$ref": "#/$defs/value" } },
|
|
28
|
+
"action": {
|
|
29
|
+
"type": "object", "additionalProperties": false,
|
|
30
|
+
"required": ["bind", "value", "codes"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"bind": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
|
|
33
|
+
"value": { "$ref": "#/$defs/value" },
|
|
34
|
+
"codes": { "$ref": "#/$defs/codes" },
|
|
35
|
+
"expectedState": { "$ref": "#/$defs/state" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"reset": {
|
|
39
|
+
"type": "object", "additionalProperties": false,
|
|
40
|
+
"required": ["component", "expectedState"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"component": { "$ref": "#/$defs/name" },
|
|
43
|
+
"index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
|
|
44
|
+
"expectedState": { "$ref": "#/$defs/state" }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"case": {
|
|
48
|
+
"type": "object", "additionalProperties": false,
|
|
49
|
+
"required": ["id", "component", "source", "ok", "codes"],
|
|
50
|
+
"properties": {
|
|
51
|
+
"id": { "type": "string", "minLength": 1 },
|
|
52
|
+
"component": { "$ref": "#/$defs/name" },
|
|
53
|
+
"source": { "type": "string" },
|
|
54
|
+
"ok": { "type": "boolean" },
|
|
55
|
+
"codes": { "$ref": "#/$defs/codes" },
|
|
56
|
+
"initial": { "$ref": "#/$defs/state" },
|
|
57
|
+
"bindingNames": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
|
|
58
|
+
"actions": { "type": "array", "items": { "$ref": "#/$defs/action" } },
|
|
59
|
+
"reset": { "$ref": "#/$defs/reset" },
|
|
60
|
+
"text": { "type": "string" }, "expectedText": { "type": "string" },
|
|
61
|
+
"htmlIncludes": { "$ref": "#/$defs/strings" },
|
|
62
|
+
"htmlExcludes": { "$ref": "#/$defs/strings" }
|
|
63
|
+
},
|
|
64
|
+
"dependentRequired": { "text": ["expectedText"], "expectedText": ["text"] },
|
|
65
|
+
"allOf": [{
|
|
66
|
+
"if": { "properties": { "ok": { "const": false } }, "required": ["ok"] },
|
|
67
|
+
"then": { "not": { "anyOf": [
|
|
68
|
+
{ "required": ["initial"] }, { "required": ["bindingNames"] },
|
|
69
|
+
{ "required": ["actions"] }, { "required": ["reset"] },
|
|
70
|
+
{ "required": ["text"] }, { "required": ["expectedText"] },
|
|
71
|
+
{ "required": ["htmlIncludes"] }, { "required": ["htmlExcludes"] }
|
|
72
|
+
] } }
|
|
73
|
+
}]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"syntaxVersion": "local-draft-1",
|
|
3
|
+
"cases": [
|
|
4
|
+
{
|
|
5
|
+
"name": "shared numeric binding has one initial value and updates prose",
|
|
6
|
+
"source": "<number bind=\"n\" label=\"Count\" initial=\"2\" min=\"0\" max=\"10\">\n<slider bind=\"n\" label=\"Shared count\" min=\"0\" max=\"10\">\n\nTotal: {{ n * 2 }}",
|
|
7
|
+
"ok": true,
|
|
8
|
+
"initial": { "n": 2 },
|
|
9
|
+
"actions": [{ "bind": "n", "value": 5 }],
|
|
10
|
+
"text": "Total: {{ n * 2 }}",
|
|
11
|
+
"expectedText": "Total: 10"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "hidden controls initialize their bindings",
|
|
15
|
+
"source": "<toggle bind=\"show\" label=\"Show\">\n<if when=\"{{ show }}\">\n<number bind=\"n\" label=\"Hidden count\" initial=\"4\">\n</if>\n\n{{ n * 2 }}",
|
|
16
|
+
"ok": true,
|
|
17
|
+
"initial": { "show": false, "n": 4 },
|
|
18
|
+
"text": "{{ n * 2 }}",
|
|
19
|
+
"expectedText": "8"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "invalid state writes keep the last valid value",
|
|
23
|
+
"source": "<number bind=\"n\" label=\"Count\" initial=\"4\" min=\"0\" max=\"10\">",
|
|
24
|
+
"ok": true,
|
|
25
|
+
"initial": { "n": 4 },
|
|
26
|
+
"actions": [{ "bind": "n", "value": 11, "codes": ["local.runtime.value"] }],
|
|
27
|
+
"text": "{{ n }}",
|
|
28
|
+
"expectedText": "4"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "code fences keep controls and interpolation literal",
|
|
32
|
+
"source": "```markdown\n<counter bind=\"n\" label=\"Literal\">\n{{ missing }}\n```",
|
|
33
|
+
"ok": true,
|
|
34
|
+
"bindingNames": []
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "unknown components preserve source with a warning",
|
|
38
|
+
"source": "<slidr label=\"Typo\">\n</slidr>",
|
|
39
|
+
"ok": true,
|
|
40
|
+
"bindingNames": [],
|
|
41
|
+
"codes": ["local.component.unknown"]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "unbound expression names produce a compiler diagnostic",
|
|
45
|
+
"source": "Total: {{ missing * 2 }}",
|
|
46
|
+
"ok": false,
|
|
47
|
+
"codes": ["local.binding.unknown"]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 独立集成示例
|
|
2
|
+
|
|
3
|
+
这些目录使用包的公开入口,可以复制到仓库外运行。以下命令从当前目录开始。
|
|
4
|
+
|
|
5
|
+
## Node 核心
|
|
6
|
+
|
|
7
|
+
需要 Node.js 22.12 或更新版本。核心示例无需 React,也不发起网络请求。
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
cd core
|
|
11
|
+
npm install reactive-md@0.3.1 --ignore-scripts --no-audit --no-fund
|
|
12
|
+
npm start
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
预期先输出 `人数:2,费用:200`,再输出 `人数:5,费用:500`。源码在 [core/index.mjs](core/index.mjs)。
|
|
16
|
+
|
|
17
|
+
## React 页面
|
|
18
|
+
|
|
19
|
+
需要 Node.js 22.12 或更新版本。第一次安装会获取 React 19 和 Vite。
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
cd react
|
|
23
|
+
npm install reactive-md@0.3.1
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
打开终端给出的本地地址,调整人数并观察费用变化。示例入口是 [react/main.jsx](react/main.jsx),库样式通过 `reactive-md/styles.css` 引入。
|
|
28
|
+
|
|
29
|
+
在源代码仓库根目录执行 `npm run test:packed`,可自动验证压缩包的独立离线安装、严格类型检查和 React 静态服务端渲染。API 与宿主策略见[集成说明](../../docs/local-integration.md)。
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { compileLocal, createLocalRuntime, LOCAL_SYNTAX_VERSION } from 'reactive-md';
|
|
2
|
+
|
|
3
|
+
const source = `<number bind="people" label="人数" initial="2" min="1" max="20">
|
|
4
|
+
|
|
5
|
+
人数:{{ people }},费用:{{ people * 100 }}`;
|
|
6
|
+
const result = compileLocal(source);
|
|
7
|
+
if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
|
|
8
|
+
|
|
9
|
+
console.log(`Syntax: ${LOCAL_SYNTAX_VERSION}`);
|
|
10
|
+
const runtime = createLocalRuntime(result.document);
|
|
11
|
+
try {
|
|
12
|
+
const print = () => console.log(runtime.text('人数:{{ people }},费用:{{ people * 100 }}'));
|
|
13
|
+
print();
|
|
14
|
+
const people = result.document.nodes.find(node => node.name === 'number');
|
|
15
|
+
if (!people) throw new Error('The example input was not compiled.');
|
|
16
|
+
const diagnostics = runtime.set(people, 5);
|
|
17
|
+
if (diagnostics.length) throw new Error(JSON.stringify(diagnostics));
|
|
18
|
+
print();
|
|
19
|
+
} finally { runtime.dispose(); }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Reactive MD integration</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/main.jsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
4
|
+
import 'reactive-md/styles.css';
|
|
5
|
+
|
|
6
|
+
const source = `# 费用估算
|
|
7
|
+
|
|
8
|
+
<panel title="调整方案">
|
|
9
|
+
<slider bind="people" label="人数" initial="2" min="1" max="20">
|
|
10
|
+
<toggle bind="annual" label="年度付款">
|
|
11
|
+
</panel>
|
|
12
|
+
|
|
13
|
+
每月费用:**{{ people * (annual ? 80 : 100) }} 元**。`;
|
|
14
|
+
|
|
15
|
+
createRoot(document.getElementById('root')).render(
|
|
16
|
+
<React.StrictMode>
|
|
17
|
+
<main style={{ padding: 24 }}>
|
|
18
|
+
<LocalReactiveDocument source={source} />
|
|
19
|
+
</main>
|
|
20
|
+
</React.StrictMode>,
|
|
21
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reactive-md-react-example",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"engines": { "node": ">=22.12.0" },
|
|
6
|
+
"scripts": { "dev": "vite --host 127.0.0.1", "build": "vite build" },
|
|
7
|
+
"dependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" },
|
|
8
|
+
"devDependencies": { "vite": "^8.3.5" }
|
|
9
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 本地交互语法 Demo
|
|
2
|
+
|
|
3
|
+
这些文件是 `local-draft-1` 的完整作者示例,对应 [本地交互语法规范](../../docs/local-interaction-syntax.md)。第一次接触语法时,先读 [新用户入门指南](../../docs/local-guide.md)。Playground 直接加载本目录;宿主通过 [本地模式 API](../../docs/local-integration.md) 编译和渲染。
|
|
4
|
+
|
|
5
|
+
本目录有 11 份正常示例、1 份故意含错的诊断示例。每份文件独立使用,不共享参数。正常示例均没有 YAML 配置、命名动作、事件处理或外部调用。
|
|
6
|
+
|
|
7
|
+
## 从短示例开始
|
|
8
|
+
|
|
9
|
+
建议先看 [计数器](counter.reactive.md)、[方案计算器](pricing.reactive.md) 和 [交互图解](diagram.reactive.md),再看较长的图表与参数面板。日常写作只需用到其中少数组件。
|
|
10
|
+
|
|
11
|
+
## 完整目录
|
|
12
|
+
|
|
13
|
+
| 文件 | 内容 |
|
|
14
|
+
| --- | --- |
|
|
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
|
+
| 示例 | 初始显示 | 交互检查 |
|
|
35
|
+
| --- | --- | --- |
|
|
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)。
|
|
@@ -0,0 +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
|
+
目录数据就在这份文档中。搜索时直接筛选表格内容,恢复默认会清空查询并回到原始顺序。
|
|
@@ -0,0 +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>
|