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.
Files changed (105) hide show
  1. package/CHANGELOG-ch.md +203 -194
  2. package/CHANGELOG.md +203 -194
  3. package/CONTRIBUTING-ch.md +67 -67
  4. package/CONTRIBUTING.md +69 -69
  5. package/README-ch.md +157 -157
  6. package/README-en.md +184 -184
  7. package/README.md +184 -184
  8. package/SECURITY-ch.md +81 -81
  9. package/SECURITY.md +81 -81
  10. package/THIRD_PARTY_NOTICES.md +313 -209
  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-DSC0VsNK.js → authoring-BEVyth5X.js} +1 -1
  25. package/dist-library/compiler-Cm3ppMxG.js +46044 -0
  26. package/dist-library/{react-Dk94rcOp.js → react-Bh7_oxZp.js} +20110 -20113
  27. package/dist-library/reactive-md-authoring.js +2 -2
  28. package/dist-library/reactive-md-print.css +284 -284
  29. package/dist-library/reactive-md-react-unstyled.js +1 -1
  30. package/dist-library/reactive-md-react.js +1 -1
  31. package/dist-library/reactive-md.css +1 -1
  32. package/dist-library/reactive-md.js +3 -3
  33. package/dist-library/{runtime-D8KbnCd0.js → runtime-DlFYQ4s_.js} +1 -1
  34. package/dist-library/types/local/math-display.d.ts +22 -23
  35. package/dist-library/types/local/math-view.d.ts +6 -7
  36. package/dist-standalone/reactive-md-standalone.css +1 -1
  37. package/dist-standalone/reactive-md-standalone.js +318 -62
  38. package/docs/compatibility/compatibility-ch.md +121 -119
  39. package/docs/compatibility/compatibility-en.md +121 -119
  40. package/docs/compatibility/source-versioning-ch.md +159 -159
  41. package/docs/compatibility/source-versioning-en.md +159 -159
  42. package/docs/development/component-development-ch.md +210 -210
  43. package/docs/development/component-development-en.md +210 -210
  44. package/docs/development/component-protocol-ch.md +747 -747
  45. package/docs/development/component-protocol-en.md +747 -747
  46. package/docs/development/performance-ch.md +76 -76
  47. package/docs/development/performance-en.md +76 -76
  48. package/docs/development/releasing-ch.md +108 -108
  49. package/docs/development/releasing-en.md +108 -108
  50. package/docs/integration/author-tools-ch.md +62 -62
  51. package/docs/integration/author-tools-en.md +62 -62
  52. package/docs/integration/shareable-export-ch.md +209 -209
  53. package/docs/integration/shareable-export-en.md +211 -211
  54. package/docs/reference/computations-formatting-ch.md +87 -87
  55. package/docs/reference/computations-formatting-en.md +87 -87
  56. package/docs/reference/constraints-collections-ch.md +84 -84
  57. package/docs/reference/constraints-collections-en.md +84 -84
  58. package/docs/reference/diagnostics-counting-ch.md +104 -104
  59. package/docs/reference/diagnostics-counting-en.md +104 -104
  60. package/docs/reference/local-components-v2-ch.md +138 -138
  61. package/docs/reference/local-components-v2-en.md +104 -104
  62. package/docs/reference/local-interaction-syntax-ch.md +515 -511
  63. package/docs/reference/local-interaction-syntax-en.md +511 -507
  64. package/docs/reference/theme-protocol-ch.md +107 -107
  65. package/docs/reference/theme-protocol-en.md +107 -107
  66. package/docs/releases/release-0.4.0-ch.md +89 -89
  67. package/docs/releases/release-0.4.0-en.md +89 -89
  68. package/docs/releases/release-0.4.1-ch.md +23 -23
  69. package/docs/releases/release-0.4.1-en.md +23 -23
  70. package/docs/releases/release-0.6.1-ch.md +27 -0
  71. package/docs/releases/release-0.6.1-en.md +27 -0
  72. package/examples/conformance/README.md +53 -53
  73. package/examples/conformance/component-protocol-1.json +482 -482
  74. package/examples/conformance/component-protocol-1.schema.json +76 -76
  75. package/examples/conformance/local-draft-1.json +50 -50
  76. package/examples/conformance/local-draft-2.json +212 -212
  77. package/examples/integration/README.md +47 -47
  78. package/examples/integration/core/index.mjs +32 -32
  79. package/examples/integration/worker/index.html +19 -19
  80. package/examples/integration/worker/main.js +61 -61
  81. package/examples/integration/worker/package.json +13 -13
  82. package/examples/integration/worker/worker.js +3 -3
  83. package/examples/local/README.md +74 -74
  84. package/examples/local/charts.reactive.md +73 -73
  85. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  86. package/examples/local/recipes/invoice.reactive.md +36 -36
  87. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  88. package/examples/local/recipes/workshop.reactive.md +33 -33
  89. package/examples/local/showcase/README.md +25 -25
  90. package/examples/local/showcase/explore.reactive.md +102 -102
  91. package/examples/local/showcase/flow.reactive.md +86 -86
  92. package/examples/local/showcase/forms.reactive.md +126 -126
  93. package/examples/local/showcase/functions.reactive.md +119 -119
  94. package/examples/local/showcase/layout.reactive.md +100 -100
  95. package/examples/local/showcase/statistics.reactive.md +108 -108
  96. package/examples/local/showcase/tasks.reactive.md +89 -89
  97. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  98. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  99. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  100. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  101. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  102. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  103. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  104. package/package.json +152 -152
  105. package/dist-library/compiler-CRD88BMt.js +0 -24964
@@ -1,61 +1,61 @@
1
- import { LocalCompileScheduler } from 'reactive-md';
2
-
3
- const editor = document.getElementById('source');
4
- const status = document.getElementById('status');
5
- const diagnostics = document.getElementById('diagnostics');
6
- const preview = document.getElementById('preview');
7
-
8
- const initialSource = `# Compile in a Worker
9
-
10
- Edits are compiled off the main thread after a short debounce. Keep typing and the status below updates.
11
-
12
- <slider bind="people" label="People" min="1" max="20">`;
13
-
14
- editor.value = initialSource;
15
-
16
- function createWorker() {
17
- return new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
18
- }
19
-
20
- function formatDiagnostics(list) {
21
- return list.length
22
- ? list.map((diagnostic) => `${diagnostic.line}:${diagnostic.column} ${diagnostic.code}: ${diagnostic.message}`).join('\n')
23
- : 'No diagnostics.';
24
- }
25
-
26
- function showResult(outcome) {
27
- const { result, duration, mode } = outcome;
28
- status.textContent = `Compiled in ${duration} ms (${mode})`;
29
- diagnostics.textContent = formatDiagnostics(result.diagnostics);
30
- if (!result.ok) {
31
- preview.textContent = 'No document';
32
- return;
33
- }
34
- const heading = result.document.nodes.find((node) => node.type === 'heading');
35
- const title = heading
36
- ? (heading.children ?? []).map((child) => child.value ?? '').join('') || 'Untitled'
37
- : 'Untitled';
38
- const bindings = Object.keys(result.document.bindings);
39
- preview.textContent = [
40
- `Title: ${title}`,
41
- `Nodes: ${result.document.nodes.length}`,
42
- `Bindings: ${bindings.length ? bindings.join(', ') : 'none'}`,
43
- ].join('\n');
44
- }
45
-
46
- const scheduler = new LocalCompileScheduler({
47
- createWorker,
48
- onResult: showResult,
49
- onPendingChange: (pending) => {
50
- if (pending) status.textContent = 'Compiling...';
51
- },
52
- onModeChange: (mode, detail) => {
53
- status.textContent = mode === 'worker'
54
- ? 'Compiling in a Worker...'
55
- : `Compiling on the main thread${detail ? ` (${detail})` : ''}`;
56
- },
57
- });
58
-
59
- editor.addEventListener('input', () => scheduler.schedule(editor.value));
60
- window.addEventListener('beforeunload', () => scheduler.dispose());
61
- scheduler.schedule(editor.value);
1
+ import { LocalCompileScheduler } from 'reactive-md';
2
+
3
+ const editor = document.getElementById('source');
4
+ const status = document.getElementById('status');
5
+ const diagnostics = document.getElementById('diagnostics');
6
+ const preview = document.getElementById('preview');
7
+
8
+ const initialSource = `# Compile in a Worker
9
+
10
+ Edits are compiled off the main thread after a short debounce. Keep typing and the status below updates.
11
+
12
+ <slider bind="people" label="People" min="1" max="20">`;
13
+
14
+ editor.value = initialSource;
15
+
16
+ function createWorker() {
17
+ return new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
18
+ }
19
+
20
+ function formatDiagnostics(list) {
21
+ return list.length
22
+ ? list.map((diagnostic) => `${diagnostic.line}:${diagnostic.column} ${diagnostic.code}: ${diagnostic.message}`).join('\n')
23
+ : 'No diagnostics.';
24
+ }
25
+
26
+ function showResult(outcome) {
27
+ const { result, duration, mode } = outcome;
28
+ status.textContent = `Compiled in ${duration} ms (${mode})`;
29
+ diagnostics.textContent = formatDiagnostics(result.diagnostics);
30
+ if (!result.ok) {
31
+ preview.textContent = 'No document';
32
+ return;
33
+ }
34
+ const heading = result.document.nodes.find((node) => node.type === 'heading');
35
+ const title = heading
36
+ ? (heading.children ?? []).map((child) => child.value ?? '').join('') || 'Untitled'
37
+ : 'Untitled';
38
+ const bindings = Object.keys(result.document.bindings);
39
+ preview.textContent = [
40
+ `Title: ${title}`,
41
+ `Nodes: ${result.document.nodes.length}`,
42
+ `Bindings: ${bindings.length ? bindings.join(', ') : 'none'}`,
43
+ ].join('\n');
44
+ }
45
+
46
+ const scheduler = new LocalCompileScheduler({
47
+ createWorker,
48
+ onResult: showResult,
49
+ onPendingChange: (pending) => {
50
+ if (pending) status.textContent = 'Compiling...';
51
+ },
52
+ onModeChange: (mode, detail) => {
53
+ status.textContent = mode === 'worker'
54
+ ? 'Compiling in a Worker...'
55
+ : `Compiling on the main thread${detail ? ` (${detail})` : ''}`;
56
+ },
57
+ });
58
+
59
+ editor.addEventListener('input', () => scheduler.schedule(editor.value));
60
+ window.addEventListener('beforeunload', () => scheduler.dispose());
61
+ scheduler.schedule(editor.value);
@@ -1,13 +1,13 @@
1
- {
2
- "name": "reactive-md-worker-example",
3
- "private": true,
4
- "type": "module",
5
- "engines": { "node": ">=22.12.0" },
6
- "scripts": {
7
- "dev": "vite --host 127.0.0.1",
8
- "build": "vite build",
9
- "preview": "vite preview --host 127.0.0.1"
10
- },
11
- "dependencies": { "reactive-md": "0.6.0" },
12
- "devDependencies": { "vite": "^8.3.5" }
13
- }
1
+ {
2
+ "name": "reactive-md-worker-example",
3
+ "private": true,
4
+ "type": "module",
5
+ "engines": { "node": ">=22.12.0" },
6
+ "scripts": {
7
+ "dev": "vite --host 127.0.0.1",
8
+ "build": "vite build",
9
+ "preview": "vite preview --host 127.0.0.1"
10
+ },
11
+ "dependencies": { "reactive-md": "0.6.0" },
12
+ "devDependencies": { "vite": "^8.3.5" }
13
+ }
@@ -1,3 +1,3 @@
1
- import { startLocalCompileWorker } from 'reactive-md';
2
-
3
- startLocalCompileWorker();
1
+ import { startLocalCompileWorker } from 'reactive-md';
2
+
3
+ startLocalCompileWorker();
@@ -1,74 +1,74 @@
1
- # Local interaction syntax demo
2
-
3
- These are standalone authoring examples for `local-draft-2`, described in the [local interaction syntax specification](../../docs/reference/local-interaction-syntax-en.md). The Playground starts with a [quick calculator](pricing.reactive.md), followed by six focused [feature tours](showcase/README.md). Components are distributed across these six scenarios; diagnostics has an auxiliary menu. Hosts can compile and render every document through the [local mode API](../../docs/integration/local-integration-en.md).
4
-
5
- The original eleven working examples and one intentionally broken diagnostics document remain in this directory, with Chinese versions in [zh/](zh/). The six feature tours live in [showcase/](showcase/README.md), with Chinese sources in [showcase/zh/](showcase/zh/). Each file runs independently. Controls, expressions and visualizations use local state.
6
-
7
- The new [HTML compatibility example](html-compat.reactive.md) combines rich disclosures, Markdown and a bound counter. See the [temporary HTML routing policy](../../docs/reference/html-compatibility-en.md) before enabling author CSS, JavaScript or extended HTML.
8
-
9
- ## Start with the short examples
10
-
11
- The [workshop recipe](recipes/workshop.reactive.md) ([中文](recipes/workshop-zh.reactive.md)) combines cross-field validation, conditional tones, numeric aggregates and generated table rows. See the [constraints and collections reference](../../docs/reference/constraints-collections-en.md) for rules and budgets.
12
-
13
- The [invoice recipe](recipes/invoice.reactive.md) ([中文](recipes/invoice-zh.reactive.md)) demonstrates shared calculations, constants, formatting and UTC date differences. The [calculation reference](../../docs/reference/computations-formatting-en.md) explains its rules.
14
-
15
- Start with the [plan calculator](pricing.reactive.md), then choose a [feature tour](showcase/README.md). For the smallest possible state example, read the original [counter](counter.reactive.md). If you are new to the syntax, read the [new user guide](../../docs/guides/local-guide-en.md).
16
-
17
- ## Original standalone catalog
18
-
19
- | File | Contents |
20
- | --- | --- |
21
- | [counter.reactive.md](counter.reactive.md) | One-line counter with built-in plus, minus and reset |
22
- | [pricing.reactive.md](pricing.reactive.md) | Plan calculator with parameters linked inside a panel |
23
- | [comparison.reactive.md](comparison.reactive.md) | Side-by-side comparison, a switch declared in place, tabs that manage their own selection |
24
- | [parameters.reactive.md](parameters.reactive.md) | Live parameter panel with text, date and choice inputs |
25
- | [checklist.reactive.md](checklist.reactive.md) | Fixed checkable list and an enhanced table |
26
- | [charts.reactive.md](charts.reactive.md) | Charts built from tables, with a compound-interest formula in LaTeX |
27
- | [diagram.reactive.md](diagram.reactive.md) | Auto-laid-out interactive diagram and curves |
28
- | [catalog.reactive.md](catalog.reactive.md) | Local catalog search, sorting and paging |
29
- | [planning.reactive.md](planning.reactive.md) | Timeline, timer and bill-splitting calculation |
30
- | [components.reactive.md](components.reactive.md) | Content cards, disclosures, tabs and hint components |
31
- | [gallery.reactive.md](gallery.reactive.md) | Common inputs, standalone components and code shown as-is |
32
- | [diagnostics.reactive.md](diagnostics.reactive.md) | Intentionally broken diagnostics example |
33
-
34
- The Playground example index is maintained in the repository's demo application.
35
-
36
- ## Expected behavior of the working examples
37
-
38
- The table below lists the initial values and interaction checkpoints for each document. Numbers follow the formulas in the prose.
39
-
40
- | Example | Initial display | Interaction checks |
41
- | --- | --- | --- |
42
- | comparison | Basic 100 USD, Pro 200 USD | Annual billing changes them to 80/160; switching tabs needs no declared variable; reset returns to monthly billing |
43
- | parameters | Date 2026-10-22, personal use, name empty | Entering a name updates the card; selecting team use updates the description; checking the switch shows the preparation checklist; panel reset restores fields and switches |
44
- | checklist | 1/3 items, progress about 33.33% | Selecting all shows the completion notice; reset restores only the first item; the table sorts by price, searches and pages |
45
- | charts | 4 budget comparisons; savings parameters 10000, 500, 5%, 20 years; plan bars 40/70 | With the rate at 0 the end-of-curve readout is 130000; the default compound readout is about 232643.24; with 5 people the bars are 100/175 |
46
- | diagram | Input node selected, a=1, f=1 | Clicking the compute node updates the details and prose; at a=0 the curve flattens and a notice appears; both fixed curves are shown together |
47
- | catalog | 8 catalog rows, 4 rows per page | Searching for "visual" returns chart/plot/diagram; no match shows the empty state; reset clears the query, sorting and page |
48
- | planning | 45-minute timeline, countdown paused at 60 seconds, 88 USD per person | timer start/pause/reset; with the extra charge at 0 each person pays 80 USD; the reference task starting at 15 overlaps the main section |
49
- | components | Concise explanation, first disclosure open | Selecting detailed switches the prose; the tooltip is keyboard-focusable; other disclosures open independently |
50
- | pricing | 2 people, 100 USD each, 200 USD total | Annual billing gives 160 USD; annual billing for 5 people is 400 USD and shows the team notice; reset returns to 200 USD |
51
- | counter | 0 | Three increments show 3; three decrements return to 0 and disable minus; reset returns to 0 |
52
- | gallery | Alex, quantity 3, Pro, monthly billing, cost 240 USD | Annual billing gives 192 USD; hiding and showing the express section keeps its checks; the standalone counter and timer need no bind; `example` in the code block creates no variable |
53
-
54
- In parameters, the conditional checklist sits outside the panel: its existing checks survive hiding and are outside that panel's reset scope. The standalone counter and timer in gallery also sit outside the input panel, so resetting the input panel does not affect them.
55
-
56
- ## Expected results of the diagnostics example
57
-
58
- [diagnostics.reactive.md](diagnostics.reactive.md) intentionally contains the following 9 error classes. The editor should collect recoverable, independent diagnostics, and the document as a whole must not activate interactions.
59
-
60
- 1. `seat` is not declared; the message can suggest the existing parameter `seats`.
61
- 2. `seats` has a duplicate explicit initial; both sources are reported.
62
- 3. `ratio` has initial value 12, above the maximum 10.
63
- 4. if.when receives `seats`, a number, where a boolean is required.
64
- 5. `slidr` is an unknown component; the message can suggest `slider`.
65
- 6. `on-click` is not part of counter or the local interaction event syntax.
66
- 7. The edge target `missing` does not exist.
67
- 8. The integral can be displayed but is not a computable structure in the first plot version.
68
- 9. The chart's cost column contains `20 USD`, text where a plain number is required.
69
-
70
- ## Check entry points
71
-
72
- `npm test` checks parsing, bindings, expressions, LaTeX, the runtime and examples; `npm run test:demo` checks the Playground index; `npm run verify:release` runs the complete Node-side and browser gate, including real-tarball consumption and HTML export. See the [contributing guide](../../CONTRIBUTING.md) for individual commands.
73
-
74
- The [six scenarios](showcase/README.md) include all 48 tag names: intervals, coordinates and numeric questions in Functions; input choices in Forms; linked selection in Data; jumps and prose colors in Layout; guided steps and choice questions in Flow; todos and timing in Checklists. The standalone gallery and interaction-tour sources remain available as authoring examples.
1
+ # Local interaction syntax demo
2
+
3
+ These are standalone authoring examples for `local-draft-2`, described in the [local interaction syntax specification](../../docs/reference/local-interaction-syntax-en.md). The Playground starts with a [quick calculator](pricing.reactive.md), followed by six focused [feature tours](showcase/README.md). Components are distributed across these six scenarios; diagnostics has an auxiliary menu. Hosts can compile and render every document through the [local mode API](../../docs/integration/local-integration-en.md).
4
+
5
+ The original eleven working examples and one intentionally broken diagnostics document remain in this directory, with Chinese versions in [zh/](zh/). The six feature tours live in [showcase/](showcase/README.md), with Chinese sources in [showcase/zh/](showcase/zh/). Each file runs independently. Controls, expressions and visualizations use local state.
6
+
7
+ The new [HTML compatibility example](html-compat.reactive.md) combines rich disclosures, Markdown and a bound counter. See the [temporary HTML routing policy](../../docs/reference/html-compatibility-en.md) before enabling author CSS, JavaScript or extended HTML.
8
+
9
+ ## Start with the short examples
10
+
11
+ The [workshop recipe](recipes/workshop.reactive.md) ([中文](recipes/workshop-zh.reactive.md)) combines cross-field validation, conditional tones, numeric aggregates and generated table rows. See the [constraints and collections reference](../../docs/reference/constraints-collections-en.md) for rules and budgets.
12
+
13
+ The [invoice recipe](recipes/invoice.reactive.md) ([中文](recipes/invoice-zh.reactive.md)) demonstrates shared calculations, constants, formatting and UTC date differences. The [calculation reference](../../docs/reference/computations-formatting-en.md) explains its rules.
14
+
15
+ Start with the [plan calculator](pricing.reactive.md), then choose a [feature tour](showcase/README.md). For the smallest possible state example, read the original [counter](counter.reactive.md). If you are new to the syntax, read the [new user guide](../../docs/guides/local-guide-en.md).
16
+
17
+ ## Original standalone catalog
18
+
19
+ | File | Contents |
20
+ | --- | --- |
21
+ | [counter.reactive.md](counter.reactive.md) | One-line counter with built-in plus, minus and reset |
22
+ | [pricing.reactive.md](pricing.reactive.md) | Plan calculator with parameters linked inside a panel |
23
+ | [comparison.reactive.md](comparison.reactive.md) | Side-by-side comparison, a switch declared in place, tabs that manage their own selection |
24
+ | [parameters.reactive.md](parameters.reactive.md) | Live parameter panel with text, date and choice inputs |
25
+ | [checklist.reactive.md](checklist.reactive.md) | Fixed checkable list and an enhanced table |
26
+ | [charts.reactive.md](charts.reactive.md) | Charts built from tables, with a compound-interest formula in LaTeX |
27
+ | [diagram.reactive.md](diagram.reactive.md) | Auto-laid-out interactive diagram and curves |
28
+ | [catalog.reactive.md](catalog.reactive.md) | Local catalog search, sorting and paging |
29
+ | [planning.reactive.md](planning.reactive.md) | Timeline, timer and bill-splitting calculation |
30
+ | [components.reactive.md](components.reactive.md) | Content cards, disclosures, tabs and hint components |
31
+ | [gallery.reactive.md](gallery.reactive.md) | Common inputs, standalone components and code shown as-is |
32
+ | [diagnostics.reactive.md](diagnostics.reactive.md) | Intentionally broken diagnostics example |
33
+
34
+ The Playground example index is maintained in the repository's demo application.
35
+
36
+ ## Expected behavior of the working examples
37
+
38
+ The table below lists the initial values and interaction checkpoints for each document. Numbers follow the formulas in the prose.
39
+
40
+ | Example | Initial display | Interaction checks |
41
+ | --- | --- | --- |
42
+ | comparison | Basic 100 USD, Pro 200 USD | Annual billing changes them to 80/160; switching tabs needs no declared variable; reset returns to monthly billing |
43
+ | parameters | Date 2026-10-22, personal use, name empty | Entering a name updates the card; selecting team use updates the description; checking the switch shows the preparation checklist; panel reset restores fields and switches |
44
+ | checklist | 1/3 items, progress about 33.33% | Selecting all shows the completion notice; reset restores only the first item; the table sorts by price, searches and pages |
45
+ | charts | 4 budget comparisons; savings parameters 10000, 500, 5%, 20 years; plan bars 40/70 | With the rate at 0 the end-of-curve readout is 130000; the default compound readout is about 232643.24; with 5 people the bars are 100/175 |
46
+ | diagram | Input node selected, a=1, f=1 | Clicking the compute node updates the details and prose; at a=0 the curve flattens and a notice appears; both fixed curves are shown together |
47
+ | catalog | 8 catalog rows, 4 rows per page | Searching for "visual" returns chart/plot/diagram; no match shows the empty state; reset clears the query, sorting and page |
48
+ | planning | 45-minute timeline, countdown paused at 60 seconds, 88 USD per person | timer start/pause/reset; with the extra charge at 0 each person pays 80 USD; the reference task starting at 15 overlaps the main section |
49
+ | components | Concise explanation, first disclosure open | Selecting detailed switches the prose; the tooltip is keyboard-focusable; other disclosures open independently |
50
+ | pricing | 2 people, 100 USD each, 200 USD total | Annual billing gives 160 USD; annual billing for 5 people is 400 USD and shows the team notice; reset returns to 200 USD |
51
+ | counter | 0 | Three increments show 3; three decrements return to 0 and disable minus; reset returns to 0 |
52
+ | gallery | Alex, quantity 3, Pro, monthly billing, cost 240 USD | Annual billing gives 192 USD; hiding and showing the express section keeps its checks; the standalone counter and timer need no bind; `example` in the code block creates no variable |
53
+
54
+ In parameters, the conditional checklist sits outside the panel: its existing checks survive hiding and are outside that panel's reset scope. The standalone counter and timer in gallery also sit outside the input panel, so resetting the input panel does not affect them.
55
+
56
+ ## Expected results of the diagnostics example
57
+
58
+ [diagnostics.reactive.md](diagnostics.reactive.md) intentionally contains the following 9 error classes. The editor should collect recoverable, independent diagnostics, and the document as a whole must not activate interactions.
59
+
60
+ 1. `seat` is not declared; the message can suggest the existing parameter `seats`.
61
+ 2. `seats` has a duplicate explicit initial; both sources are reported.
62
+ 3. `ratio` has initial value 12, above the maximum 10.
63
+ 4. if.when receives `seats`, a number, where a boolean is required.
64
+ 5. `slidr` is an unknown component; the message can suggest `slider`.
65
+ 6. `on-click` is not part of counter or the local interaction event syntax.
66
+ 7. The edge target `missing` does not exist.
67
+ 8. The integral can be displayed but is not a computable structure in the first plot version.
68
+ 9. The chart's cost column contains `20 USD`, text where a plain number is required.
69
+
70
+ ## Check entry points
71
+
72
+ `npm test` checks parsing, bindings, expressions, LaTeX, the runtime and examples; `npm run test:demo` checks the Playground index; `npm run verify:release` runs the complete Node-side and browser gate, including real-tarball consumption and HTML export. See the [contributing guide](../../CONTRIBUTING.md) for individual commands.
73
+
74
+ The [six scenarios](showcase/README.md) include all 48 tag names: intervals, coordinates and numeric questions in Functions; input choices in Forms; linked selection in Data; jumps and prose colors in Layout; guided steps and choice questions in Flow; todos and timing in Checklists. The standalone gallery and interaction-tour sources remain available as authoring examples.
@@ -1,73 +1,73 @@
1
- # Charts follow their inputs
2
-
3
- ## Comparing several budget series
4
-
5
- <chart title="Actual cost vs budget" y-label="USD">
6
- | Category | Actual cost | Budget |
7
- | --- | ---: | ---: |
8
- | Content | 120 | 150 |
9
- | Visual | 230 | 200 |
10
- | Interaction | 180 | 220 |
11
- | Testing | 90 | 120 |
12
- </chart>
13
-
14
- ## Savings curve
15
-
16
- Deposit a fixed amount at the end of every month, compounded monthly at a fixed annual rate. $P$ is the initial amount, $m$ is the monthly deposit, and $r$ is the annual rate in percent.
17
-
18
- <panel title="Adjust savings parameters">
19
- <number bind="P" label="Initial amount" initial="10000" min="0" step="100">
20
- <number bind="m" label="Monthly deposit" initial="500" min="0" step="100">
21
- <slider bind="r" label="Annual rate (%)" initial="5" min="0" max="10" step="0.5">
22
- <slider bind="t" label="Years" initial="20" min="1" max="40">
23
- </panel>
24
-
25
- <plot min="0" max="{{ t }}" label="Savings growth" x-label="Years" y-label="Amount">
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
- Move the pointer to the end of the curve to read the balance at the end of year {{ t }}. Set the annual rate to 0 to compare growth from deposits alone.
37
-
38
- ## Shares and scatter
39
-
40
- <grid>
41
- <card title="Cost share">
42
- <chart kind="donut" title="Share of actual cost">
43
- | Category | Actual cost |
44
- | --- | ---: |
45
- | Content | 120 |
46
- | Visual | 230 |
47
- | Interaction | 180 |
48
- | Testing | 90 |
49
- </chart>
50
- </card>
51
-
52
- <card title="Budget vs actual">
53
- <chart kind="scatter" title="Budget scatter" x="Budget" y="Actual" x-label="Budget" y-label="Actual">
54
- | Budget | Actual |
55
- | ---: | ---: |
56
- | 150 | 120 |
57
- | 200 | 230 |
58
- | 220 | 180 |
59
- | 120 | 90 |
60
- </chart>
61
- </card>
62
- </grid>
63
-
64
- ## Charts read the same parameters
65
-
66
- <slider bind="people" label="People" initial="2" min="1" max="20">
67
-
68
- <chart title="Plan cost by headcount" y-label="USD">
69
- | Plan | Monthly cost |
70
- | --- | ---: |
71
- | Basic | {{ people * 20 }} |
72
- | Pro | {{ people * 35 }} |
73
- </chart>
1
+ # Charts follow their inputs
2
+
3
+ ## Comparing several budget series
4
+
5
+ <chart title="Actual cost vs budget" y-label="USD">
6
+ | Category | Actual cost | Budget |
7
+ | --- | ---: | ---: |
8
+ | Content | 120 | 150 |
9
+ | Visual | 230 | 200 |
10
+ | Interaction | 180 | 220 |
11
+ | Testing | 90 | 120 |
12
+ </chart>
13
+
14
+ ## Savings curve
15
+
16
+ Deposit a fixed amount at the end of every month, compounded monthly at a fixed annual rate. $P$ is the initial amount, $m$ is the monthly deposit, and $r$ is the annual rate in percent.
17
+
18
+ <panel title="Adjust savings parameters">
19
+ <number bind="P" label="Initial amount" initial="10000" min="0" step="100">
20
+ <number bind="m" label="Monthly deposit" initial="500" min="0" step="100">
21
+ <slider bind="r" label="Annual rate (%)" initial="5" min="0" max="10" step="0.5">
22
+ <slider bind="t" label="Years" initial="20" min="1" max="40">
23
+ </panel>
24
+
25
+ <plot min="0" max="{{ t }}" label="Savings growth" x-label="Years" y-label="Amount">
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
+ Move the pointer to the end of the curve to read the balance at the end of year {{ t }}. Set the annual rate to 0 to compare growth from deposits alone.
37
+
38
+ ## Shares and scatter
39
+
40
+ <grid>
41
+ <card title="Cost share">
42
+ <chart kind="donut" title="Share of actual cost">
43
+ | Category | Actual cost |
44
+ | --- | ---: |
45
+ | Content | 120 |
46
+ | Visual | 230 |
47
+ | Interaction | 180 |
48
+ | Testing | 90 |
49
+ </chart>
50
+ </card>
51
+
52
+ <card title="Budget vs actual">
53
+ <chart kind="scatter" title="Budget scatter" x="Budget" y="Actual" x-label="Budget" y-label="Actual">
54
+ | Budget | Actual |
55
+ | ---: | ---: |
56
+ | 150 | 120 |
57
+ | 200 | 230 |
58
+ | 220 | 180 |
59
+ | 120 | 90 |
60
+ </chart>
61
+ </card>
62
+ </grid>
63
+
64
+ ## Charts read the same parameters
65
+
66
+ <slider bind="people" label="People" initial="2" min="1" max="20">
67
+
68
+ <chart title="Plan cost by headcount" y-label="USD">
69
+ | Plan | Monthly cost |
70
+ | --- | ---: |
71
+ | Basic | {{ people * 20 }} |
72
+ | Pro | {{ people * 35 }} |
73
+ </chart>
@@ -1,36 +1,36 @@
1
- <const name="unitPrice" value="{{ 12.5 }}">
2
- <computed name="total" value="{{ quantity * unitPrice }}">
3
- <computed name="invoice" value="{{ formatCurrency(total, 'CNY', 2, 'zh-CN') }}">
4
- <computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
5
-
6
- # 共享账单计算
7
-
8
- <panel title="调整账单">
9
- <number bind="quantity" label="数量" initial="2" min="0" max="100">
10
- <date bind="startDate" label="开始日期" initial="2026-10-24">
11
- <date bind="endDate" label="结束日期" initial="2026-10-26">
12
- </panel>
13
-
14
- 账单:**{{ invoice }}**。单价:{{ formatCurrency(unitPrice, 'CNY', 2, 'zh-CN') }}。
15
-
16
- 天数:{{ days == null ? '请选择两个日期' : formatNumber(days, 0) }}。
17
-
18
- <if when="{{ total >= 100 }}">
19
- 达到批量配送门槛。
20
- </if>
21
-
22
- <chart kind="bar" title="账单总额" x="项目" y="费用">
23
- | 项目 | 费用 |
24
- | --- | --- |
25
- | 账单 | {{ total }} |
26
- | 单件 | {{ unitPrice }} |
27
- </chart>
28
-
29
- <plot label="账单倍数" min="0" max="2" samples="21">
30
- $$
31
- y = \mathrm{total} x
32
- $$
33
- </plot>
34
-
35
- 同一数字的其他显示:{{ formatNumber(total, 0) }}、{{ formatScientific(total) }}。
36
- 比例 {{ formatPercent(0.125, 1) }} 的显示不随读者设备地区变化。
1
+ <const name="unitPrice" value="{{ 12.5 }}">
2
+ <computed name="total" value="{{ quantity * unitPrice }}">
3
+ <computed name="invoice" value="{{ formatCurrency(total, 'CNY', 2, 'zh-CN') }}">
4
+ <computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
5
+
6
+ # 共享账单计算
7
+
8
+ <panel title="调整账单">
9
+ <number bind="quantity" label="数量" initial="2" min="0" max="100">
10
+ <date bind="startDate" label="开始日期" initial="2026-10-24">
11
+ <date bind="endDate" label="结束日期" initial="2026-10-26">
12
+ </panel>
13
+
14
+ 账单:**{{ invoice }}**。单价:{{ formatCurrency(unitPrice, 'CNY', 2, 'zh-CN') }}。
15
+
16
+ 天数:{{ days == null ? '请选择两个日期' : formatNumber(days, 0) }}。
17
+
18
+ <if when="{{ total >= 100 }}">
19
+ 达到批量配送门槛。
20
+ </if>
21
+
22
+ <chart kind="bar" title="账单总额" x="项目" y="费用">
23
+ | 项目 | 费用 |
24
+ | --- | --- |
25
+ | 账单 | {{ total }} |
26
+ | 单件 | {{ unitPrice }} |
27
+ </chart>
28
+
29
+ <plot label="账单倍数" min="0" max="2" samples="21">
30
+ $$
31
+ y = \mathrm{total} x
32
+ $$
33
+ </plot>
34
+
35
+ 同一数字的其他显示:{{ formatNumber(total, 0) }}、{{ formatScientific(total) }}。
36
+ 比例 {{ formatPercent(0.125, 1) }} 的显示不随读者设备地区变化。
@@ -1,36 +1,36 @@
1
- <const name="unitPrice" value="{{ 12.5 }}">
2
- <computed name="total" value="{{ quantity * unitPrice }}">
3
- <computed name="invoice" value="{{ formatCurrency(total) }}">
4
- <computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
5
-
6
- # Shared invoice calculations
7
-
8
- <panel title="Adjust the invoice">
9
- <number bind="quantity" label="Quantity" initial="2" min="0" max="100">
10
- <date bind="startDate" label="Start" initial="2026-10-24">
11
- <date bind="endDate" label="End" initial="2026-10-26">
12
- </panel>
13
-
14
- Invoice: **{{ invoice }}**. Per item: {{ formatCurrency(unitPrice) }}.
15
-
16
- Days: {{ days == null ? 'Choose both dates' : formatNumber(days, 0) }}.
17
-
18
- <if when="{{ total >= 100 }}">
19
- Eligible for bulk delivery.
20
- </if>
21
-
22
- <chart kind="bar" title="Invoice total" x="Item" y="Cost">
23
- | Item | Cost |
24
- | --- | --- |
25
- | Invoice | {{ total }} |
26
- | One item | {{ unitPrice }} |
27
- </chart>
28
-
29
- <plot label="Scaled invoice" min="0" max="2" samples="21">
30
- $$
31
- y = \mathrm{total} x
32
- $$
33
- </plot>
34
-
35
- Other displays of the same number: {{ formatNumber(total, 0) }}, {{ formatScientific(total) }}.
36
- The fraction {{ formatPercent(0.125, 1) }} is independent of the reader's device locale.
1
+ <const name="unitPrice" value="{{ 12.5 }}">
2
+ <computed name="total" value="{{ quantity * unitPrice }}">
3
+ <computed name="invoice" value="{{ formatCurrency(total) }}">
4
+ <computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
5
+
6
+ # Shared invoice calculations
7
+
8
+ <panel title="Adjust the invoice">
9
+ <number bind="quantity" label="Quantity" initial="2" min="0" max="100">
10
+ <date bind="startDate" label="Start" initial="2026-10-24">
11
+ <date bind="endDate" label="End" initial="2026-10-26">
12
+ </panel>
13
+
14
+ Invoice: **{{ invoice }}**. Per item: {{ formatCurrency(unitPrice) }}.
15
+
16
+ Days: {{ days == null ? 'Choose both dates' : formatNumber(days, 0) }}.
17
+
18
+ <if when="{{ total >= 100 }}">
19
+ Eligible for bulk delivery.
20
+ </if>
21
+
22
+ <chart kind="bar" title="Invoice total" x="Item" y="Cost">
23
+ | Item | Cost |
24
+ | --- | --- |
25
+ | Invoice | {{ total }} |
26
+ | One item | {{ unitPrice }} |
27
+ </chart>
28
+
29
+ <plot label="Scaled invoice" min="0" max="2" samples="21">
30
+ $$
31
+ y = \mathrm{total} x
32
+ $$
33
+ </plot>
34
+
35
+ Other displays of the same number: {{ formatNumber(total, 0) }}, {{ formatScientific(total) }}.
36
+ The fraction {{ formatPercent(0.125, 1) }} is independent of the reader's device locale.