reactive-md 0.6.0 → 0.6.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-ch.md +203 -194
- package/CHANGELOG.md +203 -194
- package/CONTRIBUTING-ch.md +67 -67
- package/CONTRIBUTING.md +69 -69
- package/README-ch.md +157 -157
- package/README-en.md +184 -184
- package/README.md +184 -184
- package/SECURITY-ch.md +81 -81
- package/SECURITY.md +81 -81
- package/THIRD_PARTY_NOTICES.md +313 -209
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +181 -181
- package/cli/assets.mjs +390 -390
- package/cli/build.mjs +268 -268
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +138 -138
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +55 -55
- package/cli/migrate.mjs +368 -368
- package/cli/package.mjs +210 -210
- package/dist-library/{authoring-DSC0VsNK.js → authoring-BEVyth5X.js} +1 -1
- package/dist-library/compiler-Cm3ppMxG.js +46044 -0
- package/dist-library/{react-Dk94rcOp.js → react-Bh7_oxZp.js} +20110 -20113
- package/dist-library/reactive-md-authoring.js +2 -2
- package/dist-library/reactive-md-print.css +284 -284
- package/dist-library/reactive-md-react-unstyled.js +1 -1
- package/dist-library/reactive-md-react.js +1 -1
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +3 -3
- package/dist-library/{runtime-D8KbnCd0.js → runtime-DlFYQ4s_.js} +1 -1
- package/dist-library/types/local/math-display.d.ts +22 -23
- package/dist-library/types/local/math-view.d.ts +6 -7
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +318 -62
- package/docs/compatibility/compatibility-ch.md +121 -119
- package/docs/compatibility/compatibility-en.md +121 -119
- package/docs/compatibility/source-versioning-ch.md +159 -159
- package/docs/compatibility/source-versioning-en.md +159 -159
- package/docs/development/component-development-ch.md +210 -210
- package/docs/development/component-development-en.md +210 -210
- package/docs/development/component-protocol-ch.md +747 -747
- package/docs/development/component-protocol-en.md +747 -747
- package/docs/development/performance-ch.md +76 -76
- package/docs/development/performance-en.md +76 -76
- package/docs/development/releasing-ch.md +108 -108
- package/docs/development/releasing-en.md +108 -108
- package/docs/integration/author-tools-ch.md +62 -62
- package/docs/integration/author-tools-en.md +62 -62
- package/docs/integration/shareable-export-ch.md +209 -209
- package/docs/integration/shareable-export-en.md +211 -211
- package/docs/reference/computations-formatting-ch.md +87 -87
- package/docs/reference/computations-formatting-en.md +87 -87
- package/docs/reference/constraints-collections-ch.md +84 -84
- package/docs/reference/constraints-collections-en.md +84 -84
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -104
- package/docs/reference/local-components-v2-ch.md +138 -138
- package/docs/reference/local-components-v2-en.md +104 -104
- package/docs/reference/local-interaction-syntax-ch.md +515 -511
- package/docs/reference/local-interaction-syntax-en.md +511 -507
- package/docs/reference/theme-protocol-ch.md +107 -107
- package/docs/reference/theme-protocol-en.md +107 -107
- package/docs/releases/release-0.4.0-ch.md +89 -89
- package/docs/releases/release-0.4.0-en.md +89 -89
- package/docs/releases/release-0.4.1-ch.md +23 -23
- package/docs/releases/release-0.4.1-en.md +23 -23
- package/docs/releases/release-0.6.1-ch.md +27 -0
- package/docs/releases/release-0.6.1-en.md +27 -0
- package/examples/conformance/README.md +53 -53
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/integration/README.md +47 -47
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README.md +74 -74
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README.md +25 -25
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/package.json +152 -152
- package/dist-library/compiler-CRD88BMt.js +0 -24964
|
@@ -1,212 +1,212 @@
|
|
|
1
|
-
{
|
|
2
|
-
"syntaxVersion": "local-draft-2",
|
|
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": {
|
|
9
|
-
"n": 2
|
|
10
|
-
},
|
|
11
|
-
"actions": [
|
|
12
|
-
{
|
|
13
|
-
"bind": "n",
|
|
14
|
-
"value": 5
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"text": "Total: {{ n * 2 }}",
|
|
18
|
-
"expectedText": "Total: 10"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"name": "hidden controls initialize their bindings",
|
|
22
|
-
"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 }}",
|
|
23
|
-
"ok": true,
|
|
24
|
-
"initial": {
|
|
25
|
-
"show": false,
|
|
26
|
-
"n": 4
|
|
27
|
-
},
|
|
28
|
-
"text": "{{ n * 2 }}",
|
|
29
|
-
"expectedText": "8"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "invalid state writes keep the last valid value",
|
|
33
|
-
"source": "<number bind=\"n\" label=\"Count\" initial=\"4\" min=\"0\" max=\"10\">",
|
|
34
|
-
"ok": true,
|
|
35
|
-
"initial": {
|
|
36
|
-
"n": 4
|
|
37
|
-
},
|
|
38
|
-
"actions": [
|
|
39
|
-
{
|
|
40
|
-
"bind": "n",
|
|
41
|
-
"value": 11,
|
|
42
|
-
"codes": [
|
|
43
|
-
"local.runtime.value"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"text": "{{ n }}",
|
|
48
|
-
"expectedText": "4"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": "code fences keep controls and interpolation literal",
|
|
52
|
-
"source": "```markdown\n<counter bind=\"n\" label=\"Literal\">\n{{ missing }}\n```",
|
|
53
|
-
"ok": true,
|
|
54
|
-
"bindingNames": []
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"name": "unknown components preserve source with a warning",
|
|
58
|
-
"source": "<slidr label=\"Typo\">\n</slidr>",
|
|
59
|
-
"ok": true,
|
|
60
|
-
"bindingNames": [],
|
|
61
|
-
"codes": [
|
|
62
|
-
"local.component.unknown"
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"name": "unbound expression names produce a compiler diagnostic",
|
|
67
|
-
"source": "Total: {{ missing * 2 }}",
|
|
68
|
-
"ok": false,
|
|
69
|
-
"codes": [
|
|
70
|
-
"local.binding.unknown"
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "multi-select-values",
|
|
75
|
-
"source": "<multi-select bind=\"subjects\" label=\"Subjects\" max-selected=\"2\">\n<option value=\"math\">Math</option>\n<option value=\"physics\">Physics</option>\n</multi-select>",
|
|
76
|
-
"ok": true,
|
|
77
|
-
"codes": [],
|
|
78
|
-
"initial": {
|
|
79
|
-
"subjects": []
|
|
80
|
-
},
|
|
81
|
-
"bindingNames": [
|
|
82
|
-
"subjects"
|
|
83
|
-
],
|
|
84
|
-
"actions": [
|
|
85
|
-
{
|
|
86
|
-
"bind": "subjects",
|
|
87
|
-
"value": [
|
|
88
|
-
"physics",
|
|
89
|
-
"math"
|
|
90
|
-
],
|
|
91
|
-
"codes": []
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"text": "{{ len(subjects) }}",
|
|
95
|
-
"expectedText": "2"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"name": "range-slots",
|
|
99
|
-
"source": "<range-slider label=\"Interval\" bind-start=\"low\" bind-end=\"high\" initial-start=\"20\" initial-end=\"80\">",
|
|
100
|
-
"ok": true,
|
|
101
|
-
"codes": [],
|
|
102
|
-
"initial": {
|
|
103
|
-
"low": 20,
|
|
104
|
-
"high": 80
|
|
105
|
-
},
|
|
106
|
-
"bindingNames": [
|
|
107
|
-
"low",
|
|
108
|
-
"high"
|
|
109
|
-
],
|
|
110
|
-
"text": "{{ high - low }}",
|
|
111
|
-
"expectedText": "60"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"name": "coordinate-slots",
|
|
115
|
-
"source": "<coordinate label=\"Point\" bind-x=\"px\" bind-y=\"py\" initial-x=\"1\" initial-y=\"2\">",
|
|
116
|
-
"ok": true,
|
|
117
|
-
"codes": [],
|
|
118
|
-
"initial": {
|
|
119
|
-
"px": 1,
|
|
120
|
-
"py": 2
|
|
121
|
-
},
|
|
122
|
-
"bindingNames": [
|
|
123
|
-
"px",
|
|
124
|
-
"py"
|
|
125
|
-
],
|
|
126
|
-
"text": "{{ px + py }}",
|
|
127
|
-
"expectedText": "3"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "steps-initialization",
|
|
131
|
-
"source": "<steps label=\"Path\" bind=\"lesson\">\n<step label=\"Read\">\nRead first.\n</step>\n<step label=\"Try\">\nTry next.\n</step>\n</steps>",
|
|
132
|
-
"ok": true,
|
|
133
|
-
"codes": [],
|
|
134
|
-
"initial": {
|
|
135
|
-
"lesson": "step-1"
|
|
136
|
-
},
|
|
137
|
-
"bindingNames": [
|
|
138
|
-
"lesson"
|
|
139
|
-
],
|
|
140
|
-
"actions": [
|
|
141
|
-
{
|
|
142
|
-
"bind": "lesson",
|
|
143
|
-
"value": "step-2",
|
|
144
|
-
"codes": []
|
|
145
|
-
}
|
|
146
|
-
],
|
|
147
|
-
"text": "{{ lesson }}",
|
|
148
|
-
"expectedText": "step-2"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"name": "jump-colored-prose",
|
|
152
|
-
"source": "<jump to=\"result\">Results</jump>\n\n<section color=\"#123\">\n\n<text color=\"red\">Important</text>\n\n</section>\n\n<anchor id=\"result\">\n\nDone.",
|
|
153
|
-
"ok": true,
|
|
154
|
-
"codes": []
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"name": "quiz-choice",
|
|
158
|
-
"source": "<quiz label=\"Two plus three\" answer=\"b\">\n<option value=\"a\">4</option>\n<option value=\"b\">5</option>\n</quiz>",
|
|
159
|
-
"ok": true,
|
|
160
|
-
"codes": []
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"name": "selection-key",
|
|
164
|
-
"source": "<table bind=\"project\" key=\"Project\" initial=\"Visual\">\n| Project | Cost |\n| --- | ---: |\n| Content | 120 |\n| Visual | 230 |\n</table>",
|
|
165
|
-
"ok": true,
|
|
166
|
-
"codes": [],
|
|
167
|
-
"initial": {
|
|
168
|
-
"project": "Visual"
|
|
169
|
-
},
|
|
170
|
-
"bindingNames": [
|
|
171
|
-
"project"
|
|
172
|
-
],
|
|
173
|
-
"actions": [
|
|
174
|
-
{
|
|
175
|
-
"bind": "project",
|
|
176
|
-
"value": "Content",
|
|
177
|
-
"codes": []
|
|
178
|
-
}
|
|
179
|
-
],
|
|
180
|
-
"text": "{{ project }}",
|
|
181
|
-
"expectedText": "Content"
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"name": "computed-values-recalculate-from-controls-and-arrays",
|
|
185
|
-
"source": "<computed name=\"costs\" value=\"{{ [seats * 80, materials ? seats * 20 : 0] }}\">\n<computed name=\"total\" value=\"{{ sum(costs) }}\">\n\n<number bind=\"seats\" label=\"Seats\" initial=\"4\" min=\"1\" max=\"20\">\n<toggle bind=\"materials\" label=\"Materials\">\n\nTotal: {{ total }}.",
|
|
186
|
-
"ok": true,
|
|
187
|
-
"codes": [],
|
|
188
|
-
"initial": {
|
|
189
|
-
"seats": 4,
|
|
190
|
-
"materials": false
|
|
191
|
-
},
|
|
192
|
-
"bindingNames": [
|
|
193
|
-
"materials",
|
|
194
|
-
"seats"
|
|
195
|
-
],
|
|
196
|
-
"actions": [
|
|
197
|
-
{
|
|
198
|
-
"bind": "materials",
|
|
199
|
-
"value": true,
|
|
200
|
-
"codes": []
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"bind": "seats",
|
|
204
|
-
"value": 6,
|
|
205
|
-
"codes": []
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"text": "Total: {{ total }}.",
|
|
209
|
-
"expectedText": "Total: 600."
|
|
210
|
-
}
|
|
211
|
-
]
|
|
212
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"syntaxVersion": "local-draft-2",
|
|
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": {
|
|
9
|
+
"n": 2
|
|
10
|
+
},
|
|
11
|
+
"actions": [
|
|
12
|
+
{
|
|
13
|
+
"bind": "n",
|
|
14
|
+
"value": 5
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"text": "Total: {{ n * 2 }}",
|
|
18
|
+
"expectedText": "Total: 10"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "hidden controls initialize their bindings",
|
|
22
|
+
"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 }}",
|
|
23
|
+
"ok": true,
|
|
24
|
+
"initial": {
|
|
25
|
+
"show": false,
|
|
26
|
+
"n": 4
|
|
27
|
+
},
|
|
28
|
+
"text": "{{ n * 2 }}",
|
|
29
|
+
"expectedText": "8"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "invalid state writes keep the last valid value",
|
|
33
|
+
"source": "<number bind=\"n\" label=\"Count\" initial=\"4\" min=\"0\" max=\"10\">",
|
|
34
|
+
"ok": true,
|
|
35
|
+
"initial": {
|
|
36
|
+
"n": 4
|
|
37
|
+
},
|
|
38
|
+
"actions": [
|
|
39
|
+
{
|
|
40
|
+
"bind": "n",
|
|
41
|
+
"value": 11,
|
|
42
|
+
"codes": [
|
|
43
|
+
"local.runtime.value"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"text": "{{ n }}",
|
|
48
|
+
"expectedText": "4"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "code fences keep controls and interpolation literal",
|
|
52
|
+
"source": "```markdown\n<counter bind=\"n\" label=\"Literal\">\n{{ missing }}\n```",
|
|
53
|
+
"ok": true,
|
|
54
|
+
"bindingNames": []
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "unknown components preserve source with a warning",
|
|
58
|
+
"source": "<slidr label=\"Typo\">\n</slidr>",
|
|
59
|
+
"ok": true,
|
|
60
|
+
"bindingNames": [],
|
|
61
|
+
"codes": [
|
|
62
|
+
"local.component.unknown"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "unbound expression names produce a compiler diagnostic",
|
|
67
|
+
"source": "Total: {{ missing * 2 }}",
|
|
68
|
+
"ok": false,
|
|
69
|
+
"codes": [
|
|
70
|
+
"local.binding.unknown"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "multi-select-values",
|
|
75
|
+
"source": "<multi-select bind=\"subjects\" label=\"Subjects\" max-selected=\"2\">\n<option value=\"math\">Math</option>\n<option value=\"physics\">Physics</option>\n</multi-select>",
|
|
76
|
+
"ok": true,
|
|
77
|
+
"codes": [],
|
|
78
|
+
"initial": {
|
|
79
|
+
"subjects": []
|
|
80
|
+
},
|
|
81
|
+
"bindingNames": [
|
|
82
|
+
"subjects"
|
|
83
|
+
],
|
|
84
|
+
"actions": [
|
|
85
|
+
{
|
|
86
|
+
"bind": "subjects",
|
|
87
|
+
"value": [
|
|
88
|
+
"physics",
|
|
89
|
+
"math"
|
|
90
|
+
],
|
|
91
|
+
"codes": []
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"text": "{{ len(subjects) }}",
|
|
95
|
+
"expectedText": "2"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "range-slots",
|
|
99
|
+
"source": "<range-slider label=\"Interval\" bind-start=\"low\" bind-end=\"high\" initial-start=\"20\" initial-end=\"80\">",
|
|
100
|
+
"ok": true,
|
|
101
|
+
"codes": [],
|
|
102
|
+
"initial": {
|
|
103
|
+
"low": 20,
|
|
104
|
+
"high": 80
|
|
105
|
+
},
|
|
106
|
+
"bindingNames": [
|
|
107
|
+
"low",
|
|
108
|
+
"high"
|
|
109
|
+
],
|
|
110
|
+
"text": "{{ high - low }}",
|
|
111
|
+
"expectedText": "60"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "coordinate-slots",
|
|
115
|
+
"source": "<coordinate label=\"Point\" bind-x=\"px\" bind-y=\"py\" initial-x=\"1\" initial-y=\"2\">",
|
|
116
|
+
"ok": true,
|
|
117
|
+
"codes": [],
|
|
118
|
+
"initial": {
|
|
119
|
+
"px": 1,
|
|
120
|
+
"py": 2
|
|
121
|
+
},
|
|
122
|
+
"bindingNames": [
|
|
123
|
+
"px",
|
|
124
|
+
"py"
|
|
125
|
+
],
|
|
126
|
+
"text": "{{ px + py }}",
|
|
127
|
+
"expectedText": "3"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "steps-initialization",
|
|
131
|
+
"source": "<steps label=\"Path\" bind=\"lesson\">\n<step label=\"Read\">\nRead first.\n</step>\n<step label=\"Try\">\nTry next.\n</step>\n</steps>",
|
|
132
|
+
"ok": true,
|
|
133
|
+
"codes": [],
|
|
134
|
+
"initial": {
|
|
135
|
+
"lesson": "step-1"
|
|
136
|
+
},
|
|
137
|
+
"bindingNames": [
|
|
138
|
+
"lesson"
|
|
139
|
+
],
|
|
140
|
+
"actions": [
|
|
141
|
+
{
|
|
142
|
+
"bind": "lesson",
|
|
143
|
+
"value": "step-2",
|
|
144
|
+
"codes": []
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"text": "{{ lesson }}",
|
|
148
|
+
"expectedText": "step-2"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "jump-colored-prose",
|
|
152
|
+
"source": "<jump to=\"result\">Results</jump>\n\n<section color=\"#123\">\n\n<text color=\"red\">Important</text>\n\n</section>\n\n<anchor id=\"result\">\n\nDone.",
|
|
153
|
+
"ok": true,
|
|
154
|
+
"codes": []
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "quiz-choice",
|
|
158
|
+
"source": "<quiz label=\"Two plus three\" answer=\"b\">\n<option value=\"a\">4</option>\n<option value=\"b\">5</option>\n</quiz>",
|
|
159
|
+
"ok": true,
|
|
160
|
+
"codes": []
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "selection-key",
|
|
164
|
+
"source": "<table bind=\"project\" key=\"Project\" initial=\"Visual\">\n| Project | Cost |\n| --- | ---: |\n| Content | 120 |\n| Visual | 230 |\n</table>",
|
|
165
|
+
"ok": true,
|
|
166
|
+
"codes": [],
|
|
167
|
+
"initial": {
|
|
168
|
+
"project": "Visual"
|
|
169
|
+
},
|
|
170
|
+
"bindingNames": [
|
|
171
|
+
"project"
|
|
172
|
+
],
|
|
173
|
+
"actions": [
|
|
174
|
+
{
|
|
175
|
+
"bind": "project",
|
|
176
|
+
"value": "Content",
|
|
177
|
+
"codes": []
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"text": "{{ project }}",
|
|
181
|
+
"expectedText": "Content"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "computed-values-recalculate-from-controls-and-arrays",
|
|
185
|
+
"source": "<computed name=\"costs\" value=\"{{ [seats * 80, materials ? seats * 20 : 0] }}\">\n<computed name=\"total\" value=\"{{ sum(costs) }}\">\n\n<number bind=\"seats\" label=\"Seats\" initial=\"4\" min=\"1\" max=\"20\">\n<toggle bind=\"materials\" label=\"Materials\">\n\nTotal: {{ total }}.",
|
|
186
|
+
"ok": true,
|
|
187
|
+
"codes": [],
|
|
188
|
+
"initial": {
|
|
189
|
+
"seats": 4,
|
|
190
|
+
"materials": false
|
|
191
|
+
},
|
|
192
|
+
"bindingNames": [
|
|
193
|
+
"materials",
|
|
194
|
+
"seats"
|
|
195
|
+
],
|
|
196
|
+
"actions": [
|
|
197
|
+
{
|
|
198
|
+
"bind": "materials",
|
|
199
|
+
"value": true,
|
|
200
|
+
"codes": []
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"bind": "seats",
|
|
204
|
+
"value": 6,
|
|
205
|
+
"codes": []
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"text": "Total: {{ total }}.",
|
|
209
|
+
"expectedText": "Total: 600."
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
# Standalone integration examples
|
|
2
|
-
|
|
3
|
-
These directories use the package's public entry points and can be copied outside the repository. The commands below start from the current directory.
|
|
4
|
-
|
|
5
|
-
These examples target `reactive-md@0.6.0`, published on both `latest` and `next`. Copy the desired example directory outside the repository, then install the pinned version from npm as shown below. React and Vite are installed from the example's own dependencies where needed.
|
|
6
|
-
|
|
7
|
-
## Node core
|
|
8
|
-
|
|
9
|
-
Requires Node.js 22.12 or newer. The core example runs without React or network access after installation.
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
cd core
|
|
13
|
-
npm install reactive-md@0.6.0 --ignore-scripts --no-audit --no-fund
|
|
14
|
-
npm start
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
It should print `People: 2, cost: 200` first, then `People: 5, cost: 500`. The source is in [core/index.mjs](core/index.mjs).
|
|
18
|
-
|
|
19
|
-
## React page
|
|
20
|
-
|
|
21
|
-
Requires Node.js 22.12 or newer. The first install fetches React 19 and Vite.
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
cd react
|
|
25
|
-
npm install reactive-md@0.6.0
|
|
26
|
-
npm run dev
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Open the local URL printed by the terminal, adjust the headcount and watch the cost change. The example entry is [react/main.jsx](react/main.jsx), and the library styles are imported through `reactive-md/styles.css`.
|
|
30
|
-
|
|
31
|
-
## Worker compilation
|
|
32
|
-
|
|
33
|
-
[worker](worker) is a copyable browser page that keeps compilation off the main thread. It debounces edits, compiles in a module Worker, and falls back to the main thread when a Worker cannot start or crashes.
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
cd worker
|
|
37
|
-
npm install reactive-md@0.6.0
|
|
38
|
-
npm run dev
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
The UI and scheduler wiring live in [worker/main.js](worker/main.js); the Worker entry is [worker/worker.js](worker/worker.js).
|
|
42
|
-
|
|
43
|
-
## Local package verification
|
|
44
|
-
|
|
45
|
-
To try an unpublished build, run `npm pack` in the repository root and replace `reactive-md@0.6.0` in the install commands with the absolute path to the generated `reactive-md-0.6.0.tgz`.
|
|
46
|
-
|
|
47
|
-
From the source repository root, `npm run verify:release` runs the complete gate, including standalone offline installation from the packed tarball, strict type checking, combined-feature checks, React rendering and HTML export. Use `npm run test:packed` for the focused package check after building. See the [integration guide](../../docs/integration/local-integration-en.md) for the API and host policies.
|
|
1
|
+
# Standalone integration examples
|
|
2
|
+
|
|
3
|
+
These directories use the package's public entry points and can be copied outside the repository. The commands below start from the current directory.
|
|
4
|
+
|
|
5
|
+
These examples target `reactive-md@0.6.0`, published on both `latest` and `next`. Copy the desired example directory outside the repository, then install the pinned version from npm as shown below. React and Vite are installed from the example's own dependencies where needed.
|
|
6
|
+
|
|
7
|
+
## Node core
|
|
8
|
+
|
|
9
|
+
Requires Node.js 22.12 or newer. The core example runs without React or network access after installation.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
cd core
|
|
13
|
+
npm install reactive-md@0.6.0 --ignore-scripts --no-audit --no-fund
|
|
14
|
+
npm start
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It should print `People: 2, cost: 200` first, then `People: 5, cost: 500`. The source is in [core/index.mjs](core/index.mjs).
|
|
18
|
+
|
|
19
|
+
## React page
|
|
20
|
+
|
|
21
|
+
Requires Node.js 22.12 or newer. The first install fetches React 19 and Vite.
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
cd react
|
|
25
|
+
npm install reactive-md@0.6.0
|
|
26
|
+
npm run dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Open the local URL printed by the terminal, adjust the headcount and watch the cost change. The example entry is [react/main.jsx](react/main.jsx), and the library styles are imported through `reactive-md/styles.css`.
|
|
30
|
+
|
|
31
|
+
## Worker compilation
|
|
32
|
+
|
|
33
|
+
[worker](worker) is a copyable browser page that keeps compilation off the main thread. It debounces edits, compiles in a module Worker, and falls back to the main thread when a Worker cannot start or crashes.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
cd worker
|
|
37
|
+
npm install reactive-md@0.6.0
|
|
38
|
+
npm run dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The UI and scheduler wiring live in [worker/main.js](worker/main.js); the Worker entry is [worker/worker.js](worker/worker.js).
|
|
42
|
+
|
|
43
|
+
## Local package verification
|
|
44
|
+
|
|
45
|
+
To try an unpublished build, run `npm pack` in the repository root and replace `reactive-md@0.6.0` in the install commands with the absolute path to the generated `reactive-md-0.6.0.tgz`.
|
|
46
|
+
|
|
47
|
+
From the source repository root, `npm run verify:release` runs the complete gate, including standalone offline installation from the packed tarball, strict type checking, combined-feature checks, React rendering and HTML export. Use `npm run test:packed` for the focused package check after building. See the [integration guide](../../docs/integration/local-integration-en.md) for the API and host policies.
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
compileLocal,
|
|
3
|
-
createLocalRuntime,
|
|
4
|
-
exportLocalState,
|
|
5
|
-
importLocalState,
|
|
6
|
-
LOCAL_SYNTAX_VERSION,
|
|
7
|
-
} from 'reactive-md';
|
|
8
|
-
|
|
9
|
-
const source = `<number bind="people" label="People" initial="2" min="1" max="20">
|
|
10
|
-
|
|
11
|
-
People: {{ people }}, cost: {{ people * 100 }}`;
|
|
12
|
-
const result = compileLocal(source);
|
|
13
|
-
if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
|
|
14
|
-
|
|
15
|
-
console.log(`Syntax: ${LOCAL_SYNTAX_VERSION}`);
|
|
16
|
-
const runtime = createLocalRuntime(result.document);
|
|
17
|
-
try {
|
|
18
|
-
const print = () => console.log(runtime.text('People: {{ people }}, cost: {{ people * 100 }}'));
|
|
19
|
-
print();
|
|
20
|
-
console.log(`People parameter: ${runtime.getParameter('people')}`);
|
|
21
|
-
|
|
22
|
-
const diagnostics = runtime.setParameters({ people: 5 });
|
|
23
|
-
if (diagnostics.length) throw new Error(JSON.stringify(diagnostics));
|
|
24
|
-
print();
|
|
25
|
-
|
|
26
|
-
const file = exportLocalState(runtime, { name: 'reactive-md-core-example', version: '1' });
|
|
27
|
-
runtime.setParameter('people', 1);
|
|
28
|
-
const imported = importLocalState(runtime, JSON.stringify(file));
|
|
29
|
-
if (imported.length) throw new Error(JSON.stringify(imported));
|
|
30
|
-
print();
|
|
31
|
-
console.log(`State: ${file.format}, document ${file.sourceDigest}`);
|
|
32
|
-
} finally { runtime.dispose(); }
|
|
1
|
+
import {
|
|
2
|
+
compileLocal,
|
|
3
|
+
createLocalRuntime,
|
|
4
|
+
exportLocalState,
|
|
5
|
+
importLocalState,
|
|
6
|
+
LOCAL_SYNTAX_VERSION,
|
|
7
|
+
} from 'reactive-md';
|
|
8
|
+
|
|
9
|
+
const source = `<number bind="people" label="People" initial="2" min="1" max="20">
|
|
10
|
+
|
|
11
|
+
People: {{ people }}, cost: {{ people * 100 }}`;
|
|
12
|
+
const result = compileLocal(source);
|
|
13
|
+
if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
|
|
14
|
+
|
|
15
|
+
console.log(`Syntax: ${LOCAL_SYNTAX_VERSION}`);
|
|
16
|
+
const runtime = createLocalRuntime(result.document);
|
|
17
|
+
try {
|
|
18
|
+
const print = () => console.log(runtime.text('People: {{ people }}, cost: {{ people * 100 }}'));
|
|
19
|
+
print();
|
|
20
|
+
console.log(`People parameter: ${runtime.getParameter('people')}`);
|
|
21
|
+
|
|
22
|
+
const diagnostics = runtime.setParameters({ people: 5 });
|
|
23
|
+
if (diagnostics.length) throw new Error(JSON.stringify(diagnostics));
|
|
24
|
+
print();
|
|
25
|
+
|
|
26
|
+
const file = exportLocalState(runtime, { name: 'reactive-md-core-example', version: '1' });
|
|
27
|
+
runtime.setParameter('people', 1);
|
|
28
|
+
const imported = importLocalState(runtime, JSON.stringify(file));
|
|
29
|
+
if (imported.length) throw new Error(JSON.stringify(imported));
|
|
30
|
+
print();
|
|
31
|
+
console.log(`State: ${file.format}, document ${file.sourceDigest}`);
|
|
32
|
+
} finally { runtime.dispose(); }
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Reactive MD worker compilation</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<main>
|
|
10
|
-
<h1>Worker compilation</h1>
|
|
11
|
-
<p>Edit the source; compilation is debounced and runs in a module Worker, falling back to the main thread if needed.</p>
|
|
12
|
-
<textarea id="source" rows="12" cols="80" spellcheck="false"></textarea>
|
|
13
|
-
<p id="status">Starting...</p>
|
|
14
|
-
<pre id="diagnostics"></pre>
|
|
15
|
-
<pre id="preview"></pre>
|
|
16
|
-
</main>
|
|
17
|
-
<script type="module" src="/main.js"></script>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Reactive MD worker compilation</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<main>
|
|
10
|
+
<h1>Worker compilation</h1>
|
|
11
|
+
<p>Edit the source; compilation is debounced and runs in a module Worker, falling back to the main thread if needed.</p>
|
|
12
|
+
<textarea id="source" rows="12" cols="80" spellcheck="false"></textarea>
|
|
13
|
+
<p id="status">Starting...</p>
|
|
14
|
+
<pre id="diagnostics"></pre>
|
|
15
|
+
<pre id="preview"></pre>
|
|
16
|
+
</main>
|
|
17
|
+
<script type="module" src="/main.js"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|