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
package/CHANGELOG.md CHANGED
@@ -1,173 +1,203 @@
1
- # Changelog
2
-
1
+ # Changelog
2
+
3
+ ## 0.6.1 (2026-10-27, latest and next channels)
4
+
5
+ - Typeset formulas with KaTeX HTML and accessible MathML, retaining the original LaTeX annotation and mhchem chemistry.
6
+ - Embed WOFF2 math fonts for offline preview, printing and static or interactive HTML exports. Match inline baselines, wrap inline math and reserve space for tags beside scrolling display formulas.
7
+ - Share KaTeX support detection between compilation and display. Support additional environments and style commands; invalid formulas fall back to bounded source text with source-ranged warnings.
8
+ - Keep plot evaluation and protocol revisions unchanged. `align` now numbers rows; use `align*` or `aligned` for unnumbered alignment.
9
+
10
+ See the [0.6.1 release notes](docs/releases/release-0.6.1-en.md) for installation and compatibility details.
11
+
12
+ ## 0.6.0 (2026-10-27, latest and next channels)
13
+
14
+ See [0.6.0 release notes](docs/releases/release-0.6.0-en.md). Syntax revision `local-draft-2`, component protocol `component-protocol-2` and theme protocol `reactive-md-theme-1` are unchanged.
15
+
16
+ ### Added
17
+
18
+ - Add native HTML tables to the default P0 HTML path, including `caption`, `colgroup`, `colspan`, `rowspan`, `scope`, `headers` and shared table styling. No extended HTML switch is needed.
19
+ - Add static `align` on `div`, `p` and headings, and `target`/`rel` on links with safe handling for `_blank`.
20
+ - Add `\(...\)` and `\[...\]` math delimiters, the `aligned`, `align`, `align*`, `pmatrix`, `bmatrix` and `vmatrix` environments, `\tag`, additional alphabets, arrows, delimiter sizes and functions, and mhchem `\ce{...}`.
21
+ - Add `cattca`, `mermaid` and `vue` fenced-code highlighting.
22
+ - Lay out node/edge diagrams with ELK layered routing while keeping the deterministic synchronous first paint.
23
+ - Add `insertText(text)` to the editor ref handle.
24
+
25
+ ### Changed
26
+
27
+ - Return only plain objects and arrays from `compileLocal` so results can cross a React Server Components boundary.
28
+ - Clamp tooltips to the viewport, reposition them on scroll, resize and content changes, and follow document themes.
29
+ - Use `aria-required` and local validation instead of the native `required` attribute so required controls do not block host form submission.
30
+ - Unparseable native HTML now falls back to inert source instead of failing the document; add `local.html.fallback` and `local.html.fallbackAttribute` warnings.
31
+ - Add two bundled dependencies, `elkjs` and `mhchemparser`, and update `THIRD_PARTY_NOTICES.md`.
32
+
3
33
  ## 0.5.3 (2026-10-26, next channel)
4
34
 
5
- See [0.5.3 release notes](docs/release-0.5.3-en.md). Syntax and protocol revisions are unchanged.
35
+ See [0.5.3 release notes](docs/releases/release-0.5.3-en.md). Syntax and protocol revisions are unchanged.
6
36
 
7
37
  - Add opt-in `markdownBreaks` across compilation, rendering, workers and cache keys while preserving source ranges.
8
38
  - Add an unstyled React entry, screen CSS and optional print CSS; remove global `@page` from screen styles.
9
39
  - Export `localCompileOptionsKey` and `LocalRenderContext`, and add the React-free `reactive-md/authoring` entry.
10
40
  - Accept preview compile options in analysis, completion, rename and formatting.
11
41
  - Report source-ranged diagnostics when display math falls back for unsupported commands, environments or budgets.
12
-
13
-
14
- This file records user-visible changes. The project is in a 0.x preview; version and migration rules are in [Versions and compatibility](docs/compatibility-en.md).
15
-
16
- ## 0.5.2 (2026-10-26, next channel)
17
-
18
- Compatible with 0.5.1. Syntax remains `local-draft-2`, the component protocol is `component-protocol-2` and the theme protocol is `reactive-md-theme-1`. See [0.5.2 release notes](docs/release-0.5.2-en.md).
19
-
20
- ### Added
21
-
22
- - Add an opt-in host component extension axis: `compileLocal(source, { hostComponents })` registers leaf tag schemas for one compilation. Registered tags become `hostComponent` nodes; invalid schemas return `local.options.invalid` and invalid attributes return `local.host.attribute`. A valid host node counts as one syntax node.
23
- - Add `hostData` and `hostRenderer` to `LocalDocumentView` and `LocalReactiveDocument`. Host data is keyed `${kind}:${ref}`; a missing renderer, missing data or throwing renderer renders a visible placeholder. `mode="static"` uses the same dispatch.
24
- - Export `LocalHostComponentSchema`, `LocalHostPropSchema` and `LocalHostPropKind`, and carry schemas through the compile worker without sending the renderer or host data.
25
-
26
- ### Security
27
-
28
- - Restrict host `pattern` to a linear-time-safe regex subset, apply the shared string-length budget to host attributes, bound oversized schema arrays before scheduling, reject P0 HTML tag names as host names, and keep option signatures collision-free for BigInt or cyclic schema metadata.
29
-
30
- ### Changed
31
-
32
- - Raise the component protocol to `component-protocol-2`. The syntax revision and the 48 author components are unchanged; the frozen `component-protocol-1.json` conformance baseline still applies to author components.
33
-
34
- ## 0.5.1 (2026-10-25, next channel)
35
-
36
- Compatible with 0.5.0. Syntax remains `local-draft-2`, with `component-protocol-1` and `reactive-md-theme-1`. See [0.5.1 release notes](docs/release-0.5.1-en.md).
37
-
38
- ### Added
39
-
40
- - Add P0 HTML compatibility to the default ReactiveMD rendering path, including rich disclosures, containers, headings, code, lists, links and images.
41
- - Add host-owned `enableCss`, `enableJavaScript` and `enableExtendedHtml` options, all off by default. Any enabled option routes the entire document to isolated native HTML. This temporary routing policy disables Markdown and ReactiveMD interpretation in that path; see [HTML compatibility](docs/html-compatibility-en.md).
42
- - Add localized Demo controls and preserve HTML mode in export. Static export disables author JavaScript.
43
- - Add a built-in editor status bar with Unicode character count, a keyboard hint and Edit, Split and Preview views. The host supplies preview content. View changes keep the source selection, undo history and preview state.
44
- - Narrow editor containers offer only Edit and Preview, and source-only editors keep the count and keyboard hint.
45
-
46
- ### Changed
47
-
48
- - The editor source surface, gutter, syntax highlighting, toolbar and menus now follow the editor light, dark or automatic theme instead of staying on a fixed dark background.
49
-
50
- ## 0.5.0 (2026-10-25, next channel)
51
-
52
- Compatible with 0.4.1. Syntax remains `local-draft-2`, with `component-protocol-1` and `reactive-md-theme-1`. Existing `reactive-md`, `reactive-md/react` and `reactive-md/styles.css` imports are unchanged, and the renderer entry keeps its API. See [0.5.0 release notes](docs/release-0.5.0-en.md).
53
-
54
- ### Added
55
-
56
- - Add `reactive-md/editor`, a controlled React 19 source editor extracted from the Playground, with the independent style entry `reactive-md/editor/styles.css`. It provides highlighting, formatting and insertion tools, completion, binding navigation, rename, format, undo and redo, line numbers and scroll synchronization. Locale and theme are set per instance; `diagnostics` and `document` add gutter markers and binding value types. The host owns preview, persistence and export.
57
- - Support attribute-free `<b>`, `<i>`, `<u>`, `<s>`, `<mark>` and `<br>` formatting.
58
- - Render Markdown footnotes with rich definitions, numbering, repeated references and return links.
59
- - Highlight fenced code in common languages and copy its exact source with localized feedback. Approved images open in a keyboard-accessible modal viewer.
60
-
61
- ### Fixed
62
-
63
- - Preserve ordinary generic/comparison text and currency without misreading them as component tags or formulas.
64
-
65
- ## 0.4.1 (2026-10-25)
66
-
67
- Compatible with 0.4.0; syntax remains `local-draft-2`, with `component-protocol-1` and `reactive-md-theme-1`. See [0.4.1 release notes](docs/release-0.4.1-en.md).
68
-
69
- ### Changed
70
-
71
- - Refine light/dark document surfaces, visual hierarchy, muted chart colors and control transitions.
72
- - Use rounded fields and buttons, custom slider tracks and circular selection controls. Slider `color` now colors the track.
73
- - Balance full-width table columns, show triangle sort indicators and enlarge donut charts.
74
- - Draw coordinate controls with a grid, arrow axes, dashed projections and a labeled draggable point. Keep keyboard and numeric input alternatives.
75
- - Let quiz inputs fill their container and vertically center quiz content.
76
-
77
- ### Fixed
78
-
79
- - Render LaTeX at the document body size, with black/white ink and non-overlapping piecewise conditions.
80
- - Preserve source editor scroll after toolbar insertion and keep date inputs within narrow layouts.
81
-
82
- ## 0.4.0 (2026-10-24, next channel)
83
-
84
- `0.4.0` is a 0.x preview available on both `latest` and `next`. It uses syntax revision `local-draft-2` and upgrades from `0.3.1` / `local-draft-1`; the package version, syntax revision, `component-protocol-1` component protocol and `reactive-md-theme-1` theme protocol are independent version axes. See [0.4.0 release and migration](docs/release-0.4.0-en.md) for the complete upgrade checklist.
85
-
86
- ### Fixed
87
-
88
- - Keep the Playground toolbar on one row in compact desktop layouts with wider system fonts.
89
- - Align source highlighting with the editor scroll position on first opening and give the source pane more vertical space.
90
-
91
- ### Added
92
-
93
- - Add source highlighting, completion, binding navigation, rename and formatting APIs, with corresponding Playground author tools.
94
- - Add dependency-aware rendering with browser equivalence checks for updates, resets, visual selections and locale changes.
95
- - Add `npm run verify:release` and matching CI shards, including combined-feature documents and actual tarball consumers outside the repository. Retain the verified archive with SHA256 and npm integrity records.
96
- - Add advisory cross-field `<validation>` rules with associated accessible hints and `runtime.validate()`. `alert` and `badge` accept conditional values from their existing tone enums.
97
- - Add homogeneous string/numeric array literals, array indexing, `sum`, `average`, `minOf` and `maxOf`, plus `<data-table>`/`<column>` for bounded local row generation with stable keys. See [constraints and collections](docs/constraints-collections-en.md). `LocalValueKind` gains `number-array`; aggregate names become reserved identifiers.
98
-
99
- - Add invisible, read-only `<computed>` and `<const>` declarations with dependency ordering, inferred types, cycle detection and per-runtime calculation caching. Prose, conditions, formulas and charts can share intermediate results.
100
- - Add number, percentage, scientific and currency formatting, common string functions and UTC date comparison/differences. Defaults, rounding, nulls and accepted regions are specified in [Reusing calculations and formatting values](docs/computations-formatting-en.md). New function names are reserved; rename any existing bindings with those names before upgrading to this release.
101
-
102
- - Add an optional `<!-- reactive-md: local-draft-2 -->` source revision directive. Explicit older, unknown, malformed, duplicate or misplaced revisions fail with `local.version.*` diagnostics and create no runtime; unversioned source keeps current-revision behavior. Readers built before the directive ignore it. See [Source revisions and migration](docs/source-versioning-en.md).
103
- - Add `inspectLocalSourceVersion`, `checkLocalUpgrade` and `migrateLocalSource`, plus `reactive-md migrate` with `--from`, `--check`, `--json`, `-o/--output`, `--accept-semantic-changes` and `--locale`. Migration changes only the directive, preserves body bytes, BOM and CRLF, is idempotent, blocks reserved bindings, newly recognized tags, compile errors and text-length semantic changes, and never rewrites state files.
104
-
105
- - Add a shared English/Chinese diagnostic catalogue and stable code meanings within a minor series. The Playground, React renderer and `lint --locale en|zh` localize displayed diagnostics while preserving machine fields.
106
- - Make text-control length constraints count Unicode code points, matching string `len()`. Source positions and resource budgets keep UTF-16 units. Existing emoji values may now satisfy limits that previously rejected them. See [Diagnostics and counting rules](docs/diagnostics-counting-en.md).
107
-
108
- - Add leading `<theme name="…">` declarations, host theme registration and the `reactive-md-theme-1` protocol. Both React components support independent color schemes and system preferences; `default` preserves the existing design. See the [theme protocol](docs/theme-protocol-en.md).
109
- - Add shareable single-file HTML export: the `reactive-md build` and `reactive-md lint` CLI, interactive and static modes, static-first hydration, printable current values, versioned `reactive-md-state/v1` files, verified local raster inlining, the standalone `ReactiveMD.mount`/`mountAll` IIFE and `<reactive-md-doc>`. See [Shareable documents and static export](docs/shareable-export-en.md).
110
- - Add host state APIs: name-based public parameter access on `LocalRuntime` (`parameterNames`, `getParameter`, `getParameters`, `setParameter`, `setParameters`) and `exportLocalState`/`importLocalState` for `reactive-md-state/v1` files. Writes validate before a single commit and leave state unchanged on failure.
111
- - Add retention helpers for source changes: `planLocalStateRetention` and `applyLocalStateRetention` keep only public parameters whose type and initial definition are unchanged and whose bindings are safely retainable; anonymous `@` bindings, timers and positional checklists are dropped, and rejected values are reported with a reason.
112
- - Add an optional background compile adapter: `LocalCompileScheduler` with a 150 ms debounce, one in-flight job plus the latest source, a permanent main-thread `compileLocal` fallback, and `startLocalCompileWorker`; fallback failures use the `local.worker.compile` diagnostic code.
113
-
114
- ### local-draft-2 components
115
-
116
- - Add document jumps/anchors, text/section color, multiple selection, interval and coordinate inputs, practice questions and guided steps.
117
- - Add checked-item strike-through, component accent colors and stable shared table/chart selection.
118
- - Extend runtime get/set with optional slots and add atomic setMany. New slot bindings are exclusive.
119
- - Add a bilingual feature tour and editor insertion templates. See [migration](docs/local-components-v2-en.md). The preview is published on the `next` channel.
120
-
121
- - The Playground adds a Chinese/English toggle that localizes the interface, examples, guide and built-in control labels, and saves the choice in the browser.
122
- - `LocalDocumentView` and `LocalReactiveDocument` accept `locale: 'en' | 'zh'` (default `'en'`) for built-in UI labels. Displayed compile and runtime diagnostics use the shared English/Chinese catalogue; callbacks still receive structured diagnostics with stable machine fields.
123
- - `timeline` accepts either the English columns `Task`, `Start`, `Duration` and optional `Notes` or the Chinese columns `事项`, `开始`, `时长` and optional `说明`.
124
-
125
- ## 0.3.1 (2026-10-23)
126
-
127
- Compatibility update that keeps the `local-draft-1` syntax; existing documents need no migration.
128
-
129
- - The Playground adds a Markdown editing toolbar and insertion templates for 25 native components, with format state, undo/redo, search, keyboard navigation and a compact mobile layout.
130
- - Large documents use background compilation, input coalescing and deferred storage; the syntax node budget can be configured through `limits.maxSyntaxNodes`.
131
- - Unified the document theme and the heading/body hierarchy for components; improved diagram wrapping for long labels, edge captions and fallback styles.
132
- - Added the `component-protocol-1` component contribution protocol, development proposal template, JSON Schema and representative acceptance cases, with `npm run test:components`; this protocol does not change the `local-draft-1` syntax or runtime API.
133
- - Markdown headings generate per-instance anchors; in-document table-of-contents links support Chinese, formatted headings and duplicate headings; anchors stay stable after interactive updates.
134
- - The Playground keeps compatible named parameters from the current editing session by default, with an option to turn retention off; trial state is restored after a temporary compile error is fixed, and reset when re-running, restoring an example, switching examples or importing a document.
135
- - Structurally complete unknown tags are kept as source with a warning, while other prose and interactions keep working; tags and interpolations inside the fallback region are not executed.
136
- - Footnote references and definitions keep their source text and produce a diagnostic that footnote layout is not yet supported.
137
-
138
- ## 0.3.0 (2026-10-22)
139
-
140
- The first public preview, with syntax revision `local-draft-1`. Install: `npm install reactive-md@0.3.0`. See the [README](README.md) for integration steps.
141
-
142
- ### Added
143
-
144
- - `local-draft-1` local interaction syntax: Markdown prose, 33 component names, `bind` parameters and `{{ expression }}` interpolation.
145
- - Parameter controls, panel reset, conditional content, tabs, accordions, alerts, checklists, progress and timers.
146
- - Enhanced tables, five chart types, LaTeX function curves, timelines and interactive diagrams.
147
- - Core entry `reactive-md`: `compileLocal`, `createLocalRuntime`, `compileExpression`, `compileLatex`, `samplePlot` and `LOCAL_SYNTAX_VERSION`.
148
- - React entry `reactive-md/react`: `LocalReactiveDocument`, `LocalDocumentView`, with host URL policy support.
149
- - Global style entry `reactive-md/styles.css`, with light and `data-theme="dark"` theme variables.
150
- - A beginner guide, the complete syntax specification, integration notes, version and compatibility notes, and 12 local examples (1 is an intentional diagnostics example).
151
- - Checks for documentation, examples, package entries, browser interactions and resource limits; offline installation outside the repository, strict type checking for pure core and React, and static SSR verification.
152
- - Copyable standalone Node/React integration examples, machine-readable language conformance data, performance benchmarks and a third-party license inventory.
153
- - CI checks on Node 22.12/24 and Chromium pass; private vulnerability reporting is enabled.
154
-
155
- ### Compatibility
156
-
157
- - First preview; there is no published npm version to upgrade from.
158
- - Legacy directives and YAML `state`/`data`/`computed`/`actions` and event attributes are not part of `local-draft-1`; see [Versions and compatibility](docs/compatibility-en.md) for migration.
159
- - Persist the original `.reactive.md` source; do not persist `LocalDocument`, node IDs or runtime state.
160
- - Diagnostic `line`, `column` and `range` can be used for programmatic location; `code` is not promised to be stable across versions in 0.x; `message` is display text and not guaranteed stable.
161
-
162
- ### Known limitations
163
-
164
- - ESM only; the React entry requires React 19; the core entry does not depend on React.
165
- - Node.js 22.12+ is the minimum for development and Node-side consumption.
166
- - Microsoft Edge (Chromium-based) has completed local browser verification; Firefox, Safari/WebKit and SSR hydration are unverified.
167
- - No state persistence, plugin system, arbitrary HTML, network services, Vue support, React 18 support or CommonJS entry.
168
-
169
- ### Security
170
-
171
- - Expressions and LaTeX use closed evaluators and do not execute scripts or arbitrary HTML.
172
- - Images are not loaded by default; links and images pass protocol checks first, and hosts can tighten or allow them with `urlPolicy`.
173
- - Documents, values, diagnostics and plotting computations all have resource limits. See the [security policy](SECURITY.md) for the security boundary and host responsibilities.
42
+
43
+
44
+ This file records user-visible changes. The project is in a 0.x preview; version and migration rules are in [Versions and compatibility](docs/compatibility/compatibility-en.md).
45
+
46
+ ## 0.5.2 (2026-10-26, next channel)
47
+
48
+ Compatible with 0.5.1. Syntax remains `local-draft-2`, the component protocol is `component-protocol-2` and the theme protocol is `reactive-md-theme-1`. See [0.5.2 release notes](docs/releases/release-0.5.2-en.md).
49
+
50
+ ### Added
51
+
52
+ - Add an opt-in host component extension axis: `compileLocal(source, { hostComponents })` registers leaf tag schemas for one compilation. Registered tags become `hostComponent` nodes; invalid schemas return `local.options.invalid` and invalid attributes return `local.host.attribute`. A valid host node counts as one syntax node.
53
+ - Add `hostData` and `hostRenderer` to `LocalDocumentView` and `LocalReactiveDocument`. Host data is keyed `${kind}:${ref}`; a missing renderer, missing data or throwing renderer renders a visible placeholder. `mode="static"` uses the same dispatch.
54
+ - Export `LocalHostComponentSchema`, `LocalHostPropSchema` and `LocalHostPropKind`, and carry schemas through the compile worker without sending the renderer or host data.
55
+
56
+ ### Security
57
+
58
+ - Restrict host `pattern` to a linear-time-safe regex subset, apply the shared string-length budget to host attributes, bound oversized schema arrays before scheduling, reject P0 HTML tag names as host names, and keep option signatures collision-free for BigInt or cyclic schema metadata.
59
+
60
+ ### Changed
61
+
62
+ - Raise the component protocol to `component-protocol-2`. The syntax revision and the 48 author components are unchanged; the frozen `component-protocol-1.json` conformance baseline still applies to author components.
63
+
64
+ ## 0.5.1 (2026-10-25, next channel)
65
+
66
+ Compatible with 0.5.0. Syntax remains `local-draft-2`, with `component-protocol-1` and `reactive-md-theme-1`. See [0.5.1 release notes](docs/releases/release-0.5.1-en.md).
67
+
68
+ ### Added
69
+
70
+ - Add P0 HTML compatibility to the default ReactiveMD rendering path, including rich disclosures, containers, headings, code, lists, links and images.
71
+ - Add host-owned `enableCss`, `enableJavaScript` and `enableExtendedHtml` options, all off by default. Any enabled option routes the entire document to isolated native HTML. This temporary routing policy disables Markdown and ReactiveMD interpretation in that path; see [HTML compatibility](docs/reference/html-compatibility-en.md).
72
+ - Add localized Demo controls and preserve HTML mode in export. Static export disables author JavaScript.
73
+ - Add a built-in editor status bar with Unicode character count, a keyboard hint and Edit, Split and Preview views. The host supplies preview content. View changes keep the source selection, undo history and preview state.
74
+ - Narrow editor containers offer only Edit and Preview, and source-only editors keep the count and keyboard hint.
75
+
76
+ ### Changed
77
+
78
+ - The editor source surface, gutter, syntax highlighting, toolbar and menus now follow the editor light, dark or automatic theme instead of staying on a fixed dark background.
79
+
80
+ ## 0.5.0 (2026-10-25, next channel)
81
+
82
+ Compatible with 0.4.1. Syntax remains `local-draft-2`, with `component-protocol-1` and `reactive-md-theme-1`. Existing `reactive-md`, `reactive-md/react` and `reactive-md/styles.css` imports are unchanged, and the renderer entry keeps its API. See [0.5.0 release notes](docs/releases/release-0.5.0-en.md).
83
+
84
+ ### Added
85
+
86
+ - Add `reactive-md/editor`, a controlled React 19 source editor extracted from the Playground, with the independent style entry `reactive-md/editor/styles.css`. It provides highlighting, formatting and insertion tools, completion, binding navigation, rename, format, undo and redo, line numbers and scroll synchronization. Locale and theme are set per instance; `diagnostics` and `document` add gutter markers and binding value types. The host owns preview, persistence and export.
87
+ - Support attribute-free `<b>`, `<i>`, `<u>`, `<s>`, `<mark>` and `<br>` formatting.
88
+ - Render Markdown footnotes with rich definitions, numbering, repeated references and return links.
89
+ - Highlight fenced code in common languages and copy its exact source with localized feedback. Approved images open in a keyboard-accessible modal viewer.
90
+
91
+ ### Fixed
92
+
93
+ - Preserve ordinary generic/comparison text and currency without misreading them as component tags or formulas.
94
+
95
+ ## 0.4.1 (2026-10-25)
96
+
97
+ Compatible with 0.4.0; syntax remains `local-draft-2`, with `component-protocol-1` and `reactive-md-theme-1`. See [0.4.1 release notes](docs/releases/release-0.4.1-en.md).
98
+
99
+ ### Changed
100
+
101
+ - Refine light/dark document surfaces, visual hierarchy, muted chart colors and control transitions.
102
+ - Use rounded fields and buttons, custom slider tracks and circular selection controls. Slider `color` now colors the track.
103
+ - Balance full-width table columns, show triangle sort indicators and enlarge donut charts.
104
+ - Draw coordinate controls with a grid, arrow axes, dashed projections and a labeled draggable point. Keep keyboard and numeric input alternatives.
105
+ - Let quiz inputs fill their container and vertically center quiz content.
106
+
107
+ ### Fixed
108
+
109
+ - Render LaTeX at the document body size, with black/white ink and non-overlapping piecewise conditions.
110
+ - Preserve source editor scroll after toolbar insertion and keep date inputs within narrow layouts.
111
+
112
+ ## 0.4.0 (2026-10-24, next channel)
113
+
114
+ `0.4.0` is a 0.x preview available on both `latest` and `next`. It uses syntax revision `local-draft-2` and upgrades from `0.3.1` / `local-draft-1`; the package version, syntax revision, `component-protocol-1` component protocol and `reactive-md-theme-1` theme protocol are independent version axes. See [0.4.0 release and migration](docs/releases/release-0.4.0-en.md) for the complete upgrade checklist.
115
+
116
+ ### Fixed
117
+
118
+ - Keep the Playground toolbar on one row in compact desktop layouts with wider system fonts.
119
+ - Align source highlighting with the editor scroll position on first opening and give the source pane more vertical space.
120
+
121
+ ### Added
122
+
123
+ - Add source highlighting, completion, binding navigation, rename and formatting APIs, with corresponding Playground author tools.
124
+ - Add dependency-aware rendering with browser equivalence checks for updates, resets, visual selections and locale changes.
125
+ - Add `npm run verify:release` and matching CI shards, including combined-feature documents and actual tarball consumers outside the repository. Retain the verified archive with SHA256 and npm integrity records.
126
+ - Add advisory cross-field `<validation>` rules with associated accessible hints and `runtime.validate()`. `alert` and `badge` accept conditional values from their existing tone enums.
127
+ - Add homogeneous string/numeric array literals, array indexing, `sum`, `average`, `minOf` and `maxOf`, plus `<data-table>`/`<column>` for bounded local row generation with stable keys. See [constraints and collections](docs/reference/constraints-collections-en.md). `LocalValueKind` gains `number-array`; aggregate names become reserved identifiers.
128
+
129
+ - Add invisible, read-only `<computed>` and `<const>` declarations with dependency ordering, inferred types, cycle detection and per-runtime calculation caching. Prose, conditions, formulas and charts can share intermediate results.
130
+ - Add number, percentage, scientific and currency formatting, common string functions and UTC date comparison/differences. Defaults, rounding, nulls and accepted regions are specified in [Reusing calculations and formatting values](docs/reference/computations-formatting-en.md). New function names are reserved; rename any existing bindings with those names before upgrading to this release.
131
+
132
+ - Add an optional `<!-- reactive-md: local-draft-2 -->` source revision directive. Explicit older, unknown, malformed, duplicate or misplaced revisions fail with `local.version.*` diagnostics and create no runtime; unversioned source keeps current-revision behavior. Readers built before the directive ignore it. See [Source revisions and migration](docs/compatibility/source-versioning-en.md).
133
+ - Add `inspectLocalSourceVersion`, `checkLocalUpgrade` and `migrateLocalSource`, plus `reactive-md migrate` with `--from`, `--check`, `--json`, `-o/--output`, `--accept-semantic-changes` and `--locale`. Migration changes only the directive, preserves body bytes, BOM and CRLF, is idempotent, blocks reserved bindings, newly recognized tags, compile errors and text-length semantic changes, and never rewrites state files.
134
+
135
+ - Add a shared English/Chinese diagnostic catalogue and stable code meanings within a minor series. The Playground, React renderer and `lint --locale en|zh` localize displayed diagnostics while preserving machine fields.
136
+ - Make text-control length constraints count Unicode code points, matching string `len()`. Source positions and resource budgets keep UTF-16 units. Existing emoji values may now satisfy limits that previously rejected them. See [Diagnostics and counting rules](docs/reference/diagnostics-counting-en.md).
137
+
138
+ - Add leading `<theme name="…">` declarations, host theme registration and the `reactive-md-theme-1` protocol. Both React components support independent color schemes and system preferences; `default` preserves the existing design. See the [theme protocol](docs/reference/theme-protocol-en.md).
139
+ - Add shareable single-file HTML export: the `reactive-md build` and `reactive-md lint` CLI, interactive and static modes, static-first hydration, printable current values, versioned `reactive-md-state/v1` files, verified local raster inlining, the standalone `ReactiveMD.mount`/`mountAll` IIFE and `<reactive-md-doc>`. See [Shareable documents and static export](docs/integration/shareable-export-en.md).
140
+ - Add host state APIs: name-based public parameter access on `LocalRuntime` (`parameterNames`, `getParameter`, `getParameters`, `setParameter`, `setParameters`) and `exportLocalState`/`importLocalState` for `reactive-md-state/v1` files. Writes validate before a single commit and leave state unchanged on failure.
141
+ - Add retention helpers for source changes: `planLocalStateRetention` and `applyLocalStateRetention` keep only public parameters whose type and initial definition are unchanged and whose bindings are safely retainable; anonymous `@` bindings, timers and positional checklists are dropped, and rejected values are reported with a reason.
142
+ - Add an optional background compile adapter: `LocalCompileScheduler` with a 150 ms debounce, one in-flight job plus the latest source, a permanent main-thread `compileLocal` fallback, and `startLocalCompileWorker`; fallback failures use the `local.worker.compile` diagnostic code.
143
+
144
+ ### local-draft-2 components
145
+
146
+ - Add document jumps/anchors, text/section color, multiple selection, interval and coordinate inputs, practice questions and guided steps.
147
+ - Add checked-item strike-through, component accent colors and stable shared table/chart selection.
148
+ - Extend runtime get/set with optional slots and add atomic setMany. New slot bindings are exclusive.
149
+ - Add a bilingual feature tour and editor insertion templates. See [migration](docs/reference/local-components-v2-en.md). The preview is published on the `next` channel.
150
+
151
+ - The Playground adds a Chinese/English toggle that localizes the interface, examples, guide and built-in control labels, and saves the choice in the browser.
152
+ - `LocalDocumentView` and `LocalReactiveDocument` accept `locale: 'en' | 'zh'` (default `'en'`) for built-in UI labels. Displayed compile and runtime diagnostics use the shared English/Chinese catalogue; callbacks still receive structured diagnostics with stable machine fields.
153
+ - `timeline` accepts either the English columns `Task`, `Start`, `Duration` and optional `Notes` or the Chinese columns `事项`, `开始`, `时长` and optional `说明`.
154
+
155
+ ## 0.3.1 (2026-10-23)
156
+
157
+ Compatibility update that keeps the `local-draft-1` syntax; existing documents need no migration.
158
+
159
+ - The Playground adds a Markdown editing toolbar and insertion templates for 25 native components, with format state, undo/redo, search, keyboard navigation and a compact mobile layout.
160
+ - Large documents use background compilation, input coalescing and deferred storage; the syntax node budget can be configured through `limits.maxSyntaxNodes`.
161
+ - Unified the document theme and the heading/body hierarchy for components; improved diagram wrapping for long labels, edge captions and fallback styles.
162
+ - Added the `component-protocol-1` component contribution protocol, development proposal template, JSON Schema and representative acceptance cases, with `npm run test:components`; this protocol does not change the `local-draft-1` syntax or runtime API.
163
+ - Markdown headings generate per-instance anchors; in-document table-of-contents links support Chinese, formatted headings and duplicate headings; anchors stay stable after interactive updates.
164
+ - The Playground keeps compatible named parameters from the current editing session by default, with an option to turn retention off; trial state is restored after a temporary compile error is fixed, and reset when re-running, restoring an example, switching examples or importing a document.
165
+ - Structurally complete unknown tags are kept as source with a warning, while other prose and interactions keep working; tags and interpolations inside the fallback region are not executed.
166
+ - Footnote references and definitions keep their source text and produce a diagnostic that footnote layout is not yet supported.
167
+
168
+ ## 0.3.0 (2026-10-22)
169
+
170
+ The first public preview, with syntax revision `local-draft-1`. Install: `npm install reactive-md@0.3.0`. See the [README](README.md) for integration steps.
171
+
172
+ ### Added
173
+
174
+ - `local-draft-1` local interaction syntax: Markdown prose, 33 component names, `bind` parameters and `{{ expression }}` interpolation.
175
+ - Parameter controls, panel reset, conditional content, tabs, accordions, alerts, checklists, progress and timers.
176
+ - Enhanced tables, five chart types, LaTeX function curves, timelines and interactive diagrams.
177
+ - Core entry `reactive-md`: `compileLocal`, `createLocalRuntime`, `compileExpression`, `compileLatex`, `samplePlot` and `LOCAL_SYNTAX_VERSION`.
178
+ - React entry `reactive-md/react`: `LocalReactiveDocument`, `LocalDocumentView`, with host URL policy support.
179
+ - Global style entry `reactive-md/styles.css`, with light and `data-theme="dark"` theme variables.
180
+ - A beginner guide, the complete syntax specification, integration notes, version and compatibility notes, and 12 local examples (1 is an intentional diagnostics example).
181
+ - Checks for documentation, examples, package entries, browser interactions and resource limits; offline installation outside the repository, strict type checking for pure core and React, and static SSR verification.
182
+ - Copyable standalone Node/React integration examples, machine-readable language conformance data, performance benchmarks and a third-party license inventory.
183
+ - CI checks on Node 22.12/24 and Chromium pass; private vulnerability reporting is enabled.
184
+
185
+ ### Compatibility
186
+
187
+ - First preview; there is no published npm version to upgrade from.
188
+ - Legacy directives and YAML `state`/`data`/`computed`/`actions` and event attributes are not part of `local-draft-1`; see [Versions and compatibility](docs/compatibility/compatibility-en.md) for migration.
189
+ - Persist the original `.reactive.md` source; do not persist `LocalDocument`, node IDs or runtime state.
190
+ - Diagnostic `line`, `column` and `range` can be used for programmatic location; `code` is not promised to be stable across versions in 0.x; `message` is display text and not guaranteed stable.
191
+
192
+ ### Known limitations
193
+
194
+ - ESM only; the React entry requires React 19; the core entry does not depend on React.
195
+ - Node.js 22.12+ is the minimum for development and Node-side consumption.
196
+ - Microsoft Edge (Chromium-based) has completed local browser verification; Firefox, Safari/WebKit and SSR hydration are unverified.
197
+ - No state persistence, plugin system, arbitrary HTML, network services, Vue support, React 18 support or CommonJS entry.
198
+
199
+ ### Security
200
+
201
+ - Expressions and LaTeX use closed evaluators and do not execute scripts or arbitrary HTML.
202
+ - Images are not loaded by default; links and images pass protocol checks first, and hosts can tighten or allow them with `urlPolicy`.
203
+ - Documents, values, diagnostics and plotting computations all have resource limits. See the [security policy](SECURITY.md) for the security boundary and host responsibilities.
@@ -1,62 +1,67 @@
1
- # 贡献指南
2
-
3
- Reactive MD 是 `local-draft-2` 的 0.x 预览实现。贡献可以包括语法、编译器、运行时、React 渲染器、文档、示例和 Demo。开始前先读[版本与兼容性](docs/compatibility-ch.md)和[本地交互语法规范](docs/local-interaction-syntax-ch.md)。
4
-
5
- 新增或修改组块时,按[组块协议](docs/component-protocol-ch.md)明确行为,使用[开发指南中的提案模板](docs/component-development-ch.md)记录声明、兼容性和验收证据。这里的组块包括控件、容器、可视化和结构子项。
6
-
7
- ## 环境
8
-
9
- - Node.js 22.12 或更新版本。
10
- - 仓库使用 npm workspaces;在根目录执行 `npm ci`。
11
- - 不提交 `node_modules/`、`dist-library/`、`demo/dist/`、`demo/artifacts/` 或 `.tasks/`。
12
-
13
- ## 开发与检查
14
-
15
- ```sh
16
- npm ci
17
- npm run verify:release
18
- ```
19
-
20
- | 命令 | 覆盖内容 |
21
- | --- | --- |
22
- | `npm run build` | 类型检查与语言包构建 |
23
- | `npm test` | 编译器、表达式、LaTeX、运行时和渲染器测试 |
24
- | `npm run test:components` | 组块协议的代表性用例和已有语言验收数据;新增组块还需自己的针对性测试 |
25
- | `npm run test:package` | 公开入口、示例可编译和样式边界;需先构建 |
26
- | `npm run test:packed` | 真实 tarball 的独立离线安装、核心和 React 严格类型检查、CSS 导出与静态 SSR |
27
- | `npm run notices` | 从已安装依赖生成第三方许可证清单 |
28
- | `npm run benchmark` | Node 编译、运行时和绘图性能;报告写入 `artifacts/benchmark.json` |
29
- | `npm run test:docs` | 文档相对链接和标题锚点 |
30
- | `npm run build:demo`、`npm run test:demo` | Demo 构建与示例索引 |
31
- | `npm run verify:release` | 完整发布门禁:核心与 Demo 测试、类型、第三方声明、包与文档检查、仓库外真实 tarball 消费,以及计算、集合、作者工具、状态恢复、HTML 导出和渲染等价的浏览器检查。自行管理预览服务生命周期 |
32
-
33
- CI 通过 `npm run verify:release:node` 和 `npm run verify:release:browser` 分片运行同一门禁。汇总与逐步日志写入 `artifacts/release-verification.json` 和 `artifacts/release-verification/`;经过验证的原始 tarball 及 SHA256 记录保留在 `artifacts/release-package/`。本机需已安装浏览器,门禁不会自动安装。
34
-
35
- 浏览器检查需要先启动 Demo,并准备本机浏览器。完整门禁会自行管理这些依赖;单独运行浏览器脚本时,默认地址是 `http://127.0.0.1:5173`,可用 `DEMO_URL` 指向其他地址。报告写入 `demo/artifacts/`。本地默认使用 Edge,CI 在 Linux 上使用 Playwright 的 Chromium(`PLAYWRIGHT_CHANNEL=chromium`)。
36
-
37
- ```sh
38
- npm run dev
39
- # 另一个终端
40
- npm run test:browser
41
- ```
42
-
43
- 修改语言包后重新运行 `npm run build:lib`,或使用 `npm run dev:lib` 监听重建。
44
-
45
- 性能测量条件与当前基线见[性能说明](docs/performance-ch.md),跨实现可复用的输入与预期结果见[语言验收数据](examples/conformance/README.md)。
46
-
47
- ## 改动要求
48
-
49
- - 保持改动聚焦。行为变化附带测试;用户可见变化更新文档和相关示例。
50
- - 语法或公开 API 的破坏性变化先更新[版本与兼容性](docs/compatibility-ch.md)和[变更记录](CHANGELOG-ch.md),说明旧写法、新写法和迁移方式。不要在没有语法修订的情况下悄悄改变作者语法。
51
- - 新组件或新属性必须同时实现编译校验、运行时约束、渲染、可访问名称和资源边界。不要只加展示样式。
52
- - 组块提案须给出属性与子内容声明、状态与生命周期规则、诊断、资源预算、兼容分类和对应验收结果;参考 `slider`、`tabs`、`plot` 的[协议验收数据](examples/conformance/README.md)。协议修订不自动改变包版本、语法修订或公开 API。
53
- - 资源上限集中在 `src/local/limits.ts`;新增无界输入、循环、递归或绘图计算时,先定义预算。
54
- - 不引入网络请求、任意 HTML、事件处理器、作者 CSS 或持久化状态。这些不在当前范围内。
55
- - 更新中文文档时保持与现有术语一致;英文 README 保持简洁,不重复工程细节。
56
- - 不要提交凭据、`.npmrc` token 或个人路径。不要手工修改 `dist-library/`;它由构建生成。
57
-
58
- ## 提交与 PR
59
-
60
- - PR 说明写清目的、受影响范围和验证命令及结果。没有运行的检查要明确写出,不要写成已通过。
61
- - 涉及安全的问题不要开公开 issue,按[安全策略](SECURITY-ch.md)处理。
62
- - 发布是维护者的手工流程,见[发布清单](docs/releasing-ch.md)。贡献者不需要接触 npm 凭据。
1
+ # 贡献指南
2
+
3
+ Reactive MD 是 `local-draft-2` 的 0.x 预览实现。贡献可以包括语法、编译器、运行时、React 渲染器、文档、示例和 Demo。开始前先读[版本与兼容性](docs/compatibility/compatibility-ch.md)和[本地交互语法规范](docs/reference/local-interaction-syntax-ch.md)。
4
+
5
+ 新增或修改组块时,按[组块协议](docs/development/component-protocol-ch.md)明确行为,使用[开发指南中的提案模板](docs/development/component-development-ch.md)记录声明、兼容性和验收证据。这里的组块包括控件、容器、可视化和结构子项。
6
+
7
+ ## 环境
8
+
9
+ - Node.js 22.12 或更新版本。
10
+ - 仓库使用 npm workspaces;在根目录执行 `npm ci`。
11
+ - 不提交 `node_modules/`、`dist-library/`、`demo/dist/`、`demo/artifacts/` 或 `.tasks/`。
12
+
13
+ ## 开发与检查
14
+
15
+ ```sh
16
+ npm ci
17
+ npm run verify:release
18
+ ```
19
+
20
+ | 命令 | 覆盖内容 |
21
+ | --- | --- |
22
+ | `npm run build` | 类型检查与语言包构建 |
23
+ | `npm test` | 编译器、表达式、LaTeX、运行时和渲染器测试 |
24
+ | `npm run test:components` | 组块协议的代表性用例和已有语言验收数据;新增组块还需自己的针对性测试 |
25
+ | `npm run test:package` | 公开入口、示例可编译和样式边界;需先构建 |
26
+ | `npm run test:packed` | 真实 tarball 的独立离线安装、核心和 React 严格类型检查、CSS 导出与静态 SSR |
27
+ | `npm run notices` | 从已安装依赖生成第三方许可证清单 |
28
+ | `npm run benchmark` | Node 编译、运行时和绘图性能;报告写入 `artifacts/benchmark.json` |
29
+ | `npm run test:docs` | 文档相对链接和标题锚点 |
30
+ | `npm run build:demo`、`npm run test:demo` | Demo 构建与示例索引 |
31
+ | `npm run test:browser:core` | Firefox 与 WebKit 在 1280px、375px 下的核心流程;使用已构建 Demo,并自行管理预览服务 |
32
+ | `npm run verify:release` | 完整发布门禁:核心与 Demo 测试、类型、第三方声明、包与文档检查、仓库外真实 tarball 消费,以及计算、集合、作者工具、状态恢复、HTML 导出和渲染等价的浏览器检查。自行管理预览服务生命周期 |
33
+
34
+ CI 通过 `npm run verify:release:node` 和 `npm run verify:release:browser` 分片运行同一门禁。汇总与逐步日志写入 `artifacts/release-verification.json` 和 `artifacts/release-verification/`;经过验证的原始 tarball 及 SHA256 记录保留在 `artifacts/release-package/`。本机需已安装浏览器,门禁不会自动安装。
35
+
36
+ 浏览器检查需要先启动 Demo,并准备本机浏览器。完整门禁会自行管理这些依赖;单独运行浏览器脚本时,默认地址是 `http://127.0.0.1:5173`,可用 `DEMO_URL` 指向其他地址。报告写入 `demo/artifacts/`。本地默认使用 Edge,CI 在 Linux 上使用 Playwright 的 Chromium(`PLAYWRIGHT_CHANNEL=chromium`)。
37
+
38
+ 浏览器发布门禁保留 Chromium 完整验证,并增加 Playwright Firefox、WebKit 的核心流程。通过 `npm exec --workspace=@reactive-md/demo -- playwright install firefox webkit` 安装匹配的运行时;CI 使用 `--with-deps` 安装三个引擎。先运行 `npm run build:demo`,再运行 `npm run test:browser:core`;也可用 `node scripts/verify-browser-core.mjs --browser=webkit` 选择单个引擎,或用 `DEMO_URL` 复用已有服务。报告、截图与下载的 HTML 按引擎写入 `artifacts/browser-core/`。缺少浏览器或检查失败时,命令会失败。
39
+
40
+ 核心流程覆盖示例、控件与计算、条件、日期、表格、图表、图解、编辑与诊断、个人文档保存与副本、语言切换、指南代码块主题、键盘菜单,以及 Markdown 和交互 HTML 下载。导出的 HTML 从磁盘重新打开,在阻止外部请求的条件下验证交互。WebKit 引擎检查不等同于 Apple 设备上的 Safari 实机测试。
41
+
42
+ ```sh
43
+ npm run dev
44
+ # 另一个终端
45
+ npm run test:browser
46
+ ```
47
+
48
+ 修改语言包后重新运行 `npm run build:lib`,或使用 `npm run dev:lib` 监听重建。
49
+
50
+ 性能测量条件与当前基线见[性能说明](docs/development/performance-ch.md),跨实现可复用的输入与预期结果见[语言验收数据](examples/conformance/README.md)。
51
+
52
+ ## 改动要求
53
+
54
+ - 保持改动聚焦。行为变化附带测试;用户可见变化更新文档和相关示例。
55
+ - 语法或公开 API 的破坏性变化先更新[版本与兼容性](docs/compatibility/compatibility-ch.md)和[变更记录](CHANGELOG-ch.md),说明旧写法、新写法和迁移方式。不要在没有语法修订的情况下悄悄改变作者语法。
56
+ - 新组件或新属性必须同时实现编译校验、运行时约束、渲染、可访问名称和资源边界。不要只加展示样式。
57
+ - 组块提案须给出属性与子内容声明、状态与生命周期规则、诊断、资源预算、兼容分类和对应验收结果;参考 `slider`、`tabs`、`plot` 的[协议验收数据](examples/conformance/README.md)。协议修订不自动改变包版本、语法修订或公开 API。
58
+ - 资源上限集中在 `src/local/limits.ts`;新增无界输入、循环、递归或绘图计算时,先定义预算。
59
+ - 不引入网络请求、任意 HTML、事件处理器、作者 CSS 或持久化状态。这些不在当前范围内。
60
+ - 更新中文文档时保持与现有术语一致;英文 README 保持简洁,不重复工程细节。
61
+ - 不要提交凭据、`.npmrc` token 或个人路径。不要手工修改 `dist-library/`;它由构建生成。
62
+
63
+ ## 提交与 PR
64
+
65
+ - PR 说明写清目的、受影响范围和验证命令及结果。没有运行的检查要明确写出,不要写成已通过。
66
+ - 涉及安全的问题不要开公开 issue,按[安全策略](SECURITY-ch.md)处理。
67
+ - 发布是维护者的手工流程,见[发布清单](docs/development/releasing-ch.md)。贡献者不需要接触 npm 凭据。