reactive-md 0.5.3 → 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.
Files changed (141) hide show
  1. package/CHANGELOG-ch.md +195 -165
  2. package/CHANGELOG.md +195 -165
  3. package/CONTRIBUTING-ch.md +67 -62
  4. package/CONTRIBUTING.md +69 -64
  5. package/README-ch.md +157 -155
  6. package/README-en.md +184 -181
  7. package/README.md +184 -181
  8. package/SECURITY-ch.md +81 -81
  9. package/SECURITY.md +81 -81
  10. package/THIRD_PARTY_NOTICES.md +585 -1
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +181 -181
  13. package/cli/assets.mjs +390 -390
  14. package/cli/build.mjs +268 -268
  15. package/cli/document.mjs +130 -130
  16. package/cli/errors.mjs +61 -61
  17. package/cli/fs-utils.mjs +133 -133
  18. package/cli/glob.mjs +203 -203
  19. package/cli/help.mjs +138 -138
  20. package/cli/lint.mjs +177 -177
  21. package/cli/main.mjs +55 -55
  22. package/cli/migrate.mjs +368 -368
  23. package/cli/package.mjs +210 -210
  24. package/dist-library/{authoring-DJJjKYg9.js → authoring-BEVyth5X.js} +58 -58
  25. package/dist-library/compiler-Cm3ppMxG.js +46044 -0
  26. package/dist-library/react-Bh7_oxZp.js +59655 -0
  27. package/dist-library/reactive-md-authoring.js +2 -2
  28. package/dist-library/reactive-md-editor.js +13 -0
  29. package/dist-library/reactive-md-print.css +284 -284
  30. package/dist-library/reactive-md-react-unstyled.js +1 -1
  31. package/dist-library/reactive-md-react.js +1 -1
  32. package/dist-library/reactive-md.css +1 -1
  33. package/dist-library/reactive-md.js +123 -123
  34. package/dist-library/{runtime-DXtle_6c.js → runtime-DlFYQ4s_.js} +151 -151
  35. package/dist-library/types/editor/types.d.ts +2 -0
  36. package/dist-library/types/local/code-block.d.ts +3 -1
  37. package/dist-library/types/local/code-languages.d.ts +7 -0
  38. package/dist-library/types/local/compiled-data.d.ts +6 -0
  39. package/dist-library/types/local/compiler.d.ts +1 -0
  40. package/dist-library/types/local/diagnostics.d.ts +31 -0
  41. package/dist-library/types/local/diagram-layout.d.ts +69 -0
  42. package/dist-library/types/local/html-names.d.ts +6 -0
  43. package/dist-library/types/local/html-table.d.ts +25 -0
  44. package/dist-library/types/local/math-display.d.ts +22 -22
  45. package/dist-library/types/local/math-view.d.ts +6 -7
  46. package/dist-library/types/local/table-surface.d.ts +10 -0
  47. package/dist-library/types/local/types.d.ts +2 -0
  48. package/dist-library/types/local/visuals.d.ts +9 -0
  49. package/dist-standalone/reactive-md-standalone.css +1 -1
  50. package/dist-standalone/reactive-md-standalone.js +331 -51
  51. package/docs/README.md +84 -0
  52. package/docs/{compatibility-ch.md → compatibility/compatibility-ch.md} +121 -109
  53. package/docs/{compatibility-en.md → compatibility/compatibility-en.md} +121 -109
  54. package/docs/{source-versioning-ch.md → compatibility/source-versioning-ch.md} +159 -159
  55. package/docs/{source-versioning-en.md → compatibility/source-versioning-en.md} +159 -159
  56. package/docs/{component-development-ch.md → development/component-development-ch.md} +210 -210
  57. package/docs/{component-development-en.md → development/component-development-en.md} +210 -210
  58. package/docs/{component-protocol-ch.md → development/component-protocol-ch.md} +747 -747
  59. package/docs/{component-protocol-en.md → development/component-protocol-en.md} +747 -747
  60. package/docs/{performance-ch.md → development/performance-ch.md} +76 -76
  61. package/docs/{performance-en.md → development/performance-en.md} +76 -76
  62. package/docs/{releasing-ch.md → development/releasing-ch.md} +108 -108
  63. package/docs/{releasing-en.md → development/releasing-en.md} +108 -108
  64. package/docs/guides/local-guide-ch.md +513 -0
  65. package/docs/guides/local-guide-en.md +513 -0
  66. package/docs/{author-tools-ch.md → integration/author-tools-ch.md} +57 -57
  67. package/docs/{author-tools-en.md → integration/author-tools-en.md} +57 -57
  68. package/docs/{editor-ch.md → integration/editor-ch.md} +7 -6
  69. package/docs/{editor-en.md → integration/editor-en.md} +7 -6
  70. package/docs/{local-integration-ch.md → integration/local-integration-ch.md} +33 -15
  71. package/docs/{local-integration-en.md → integration/local-integration-en.md} +33 -15
  72. package/docs/{shareable-export-ch.md → integration/shareable-export-ch.md} +221 -209
  73. package/docs/{shareable-export-en.md → integration/shareable-export-en.md} +223 -211
  74. package/docs/{computations-formatting-ch.md → reference/computations-formatting-ch.md} +87 -87
  75. package/docs/{computations-formatting-en.md → reference/computations-formatting-en.md} +87 -87
  76. package/docs/{constraints-collections-ch.md → reference/constraints-collections-ch.md} +84 -84
  77. package/docs/{constraints-collections-en.md → reference/constraints-collections-en.md} +84 -84
  78. package/docs/{diagnostics-counting-ch.md → reference/diagnostics-counting-ch.md} +104 -84
  79. package/docs/{diagnostics-counting-en.md → reference/diagnostics-counting-en.md} +104 -84
  80. package/docs/{html-compatibility-ch.md → reference/html-compatibility-ch.md} +42 -4
  81. package/docs/{html-compatibility-en.md → reference/html-compatibility-en.md} +42 -4
  82. package/docs/{local-components-v2-ch.md → reference/local-components-v2-ch.md} +138 -138
  83. package/docs/{local-components-v2-en.md → reference/local-components-v2-en.md} +104 -104
  84. package/docs/{local-interaction-syntax-ch.md → reference/local-interaction-syntax-ch.md} +515 -492
  85. package/docs/{local-interaction-syntax-en.md → reference/local-interaction-syntax-en.md} +511 -488
  86. package/docs/{theme-protocol-ch.md → reference/theme-protocol-ch.md} +107 -107
  87. package/docs/{theme-protocol-en.md → reference/theme-protocol-en.md} +107 -107
  88. package/docs/{release-0.4.0-ch.md → releases/release-0.4.0-ch.md} +89 -89
  89. package/docs/{release-0.4.0-en.md → releases/release-0.4.0-en.md} +89 -89
  90. package/docs/{release-0.4.1-ch.md → releases/release-0.4.1-ch.md} +23 -23
  91. package/docs/{release-0.4.1-en.md → releases/release-0.4.1-en.md} +23 -23
  92. package/docs/{release-0.5.0-ch.md → releases/release-0.5.0-ch.md} +4 -4
  93. package/docs/{release-0.5.0-en.md → releases/release-0.5.0-en.md} +4 -4
  94. package/docs/{release-0.5.1-ch.md → releases/release-0.5.1-ch.md} +4 -4
  95. package/docs/{release-0.5.1-en.md → releases/release-0.5.1-en.md} +4 -4
  96. package/docs/{release-0.5.2-ch.md → releases/release-0.5.2-ch.md} +3 -3
  97. package/docs/{release-0.5.2-en.md → releases/release-0.5.2-en.md} +3 -3
  98. package/docs/{release-0.5.3-ch.md → releases/release-0.5.3-ch.md} +1 -1
  99. package/docs/{release-0.5.3-en.md → releases/release-0.5.3-en.md} +1 -1
  100. package/docs/releases/release-0.6.0-ch.md +57 -0
  101. package/docs/releases/release-0.6.0-en.md +57 -0
  102. package/docs/releases/release-0.6.1-ch.md +27 -0
  103. package/docs/releases/release-0.6.1-en.md +27 -0
  104. package/examples/conformance/README.md +53 -53
  105. package/examples/conformance/component-protocol-1.json +482 -482
  106. package/examples/conformance/component-protocol-1.schema.json +76 -76
  107. package/examples/conformance/local-draft-1.json +50 -50
  108. package/examples/conformance/local-draft-2.json +212 -212
  109. package/examples/integration/README.md +47 -45
  110. package/examples/integration/core/index.mjs +32 -32
  111. package/examples/integration/worker/index.html +19 -19
  112. package/examples/integration/worker/main.js +61 -61
  113. package/examples/integration/worker/package.json +13 -13
  114. package/examples/integration/worker/worker.js +3 -3
  115. package/examples/local/README.md +74 -74
  116. package/examples/local/charts.reactive.md +73 -73
  117. package/examples/local/html-compat.reactive.md +19 -0
  118. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  119. package/examples/local/recipes/invoice.reactive.md +36 -36
  120. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  121. package/examples/local/recipes/workshop.reactive.md +33 -33
  122. package/examples/local/showcase/README.md +25 -25
  123. package/examples/local/showcase/explore.reactive.md +102 -102
  124. package/examples/local/showcase/flow.reactive.md +86 -86
  125. package/examples/local/showcase/forms.reactive.md +126 -126
  126. package/examples/local/showcase/functions.reactive.md +119 -119
  127. package/examples/local/showcase/layout.reactive.md +100 -100
  128. package/examples/local/showcase/statistics.reactive.md +108 -108
  129. package/examples/local/showcase/tasks.reactive.md +89 -89
  130. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  131. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  132. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  133. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  134. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  135. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  136. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  137. package/package.json +152 -145
  138. package/dist-library/compiler-UyPwGzJZ.js +0 -22109
  139. package/dist-library/react-fizgU3i8.js +0 -12764
  140. package/docs/local-guide-ch.md +0 -967
  141. package/docs/local-guide-en.md +0 -967
@@ -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,45 +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 `0.4.0`, the preview release on the `next` channel. First run `npm pack` in the repository, then copy the desired example directory outside the repository. In each command below, replace `/path/to/reactive-md-0.4.0.tgz` with the tarball's absolute path. The install uses the built package; 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 needs no React and makes no network requests.
10
-
11
- ```sh
12
- cd core
13
- npm install /path/to/reactive-md-0.4.0.tgz --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
- The core and worker examples use host APIs added in the `0.4.0` preview.
20
-
21
- ## React page
22
-
23
- Requires Node.js 22.12 or newer. The first install fetches React 19 and Vite.
24
-
25
- ```sh
26
- cd react
27
- npm install /path/to/reactive-md-0.4.0.tgz
28
- npm run dev
29
- ```
30
-
31
- 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`.
32
-
33
- ## Worker compilation
34
-
35
- [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.
36
-
37
- ```sh
38
- cd worker
39
- npm install /path/to/reactive-md-0.4.0.tgz
40
- npm run dev
41
- ```
42
-
43
- The UI and scheduler wiring live in [worker/main.js](worker/main.js); the Worker entry is [worker/worker.js](worker/worker.js).
44
-
45
- 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/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>