reactive-md 0.5.2 → 0.5.3

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 (45) hide show
  1. package/CHANGELOG-ch.md +11 -0
  2. package/CHANGELOG.md +11 -0
  3. package/README-ch.md +7 -7
  4. package/README-en.md +8 -8
  5. package/README.md +8 -8
  6. package/cli/build.mjs +1 -1
  7. package/cli/package.mjs +1 -0
  8. package/dist-library/authoring-DJJjKYg9.js +842 -0
  9. package/dist-library/{runtime-UiQPz5ZV.js → compiler-UyPwGzJZ.js} +5631 -5389
  10. package/dist-library/react-fizgU3i8.js +12764 -0
  11. package/dist-library/reactive-md-authoring.js +1514 -0
  12. package/dist-library/reactive-md-editor.js +577 -571
  13. package/dist-library/reactive-md-print.css +284 -0
  14. package/dist-library/reactive-md-react-unstyled.js +1 -0
  15. package/dist-library/reactive-md-react.js +1 -13208
  16. package/dist-library/reactive-md.css +1 -1
  17. package/dist-library/reactive-md.js +244 -1062
  18. package/dist-library/runtime-DXtle_6c.js +498 -0
  19. package/dist-library/types/authoring/index.d.ts +24 -0
  20. package/dist-library/types/editor/command-types.d.ts +10 -0
  21. package/dist-library/types/editor/editor-commands.d.ts +2 -2
  22. package/dist-library/types/editor/editor-i18n.d.ts +1 -1
  23. package/dist-library/types/editor/native-components.d.ts +1 -1
  24. package/dist-library/types/editor/source-authoring.d.ts +5 -3
  25. package/dist-library/types/editor/types.d.ts +5 -10
  26. package/dist-library/types/local/LocalDocumentView.d.ts +4 -2
  27. package/dist-library/types/local/authoring.d.ts +9 -5
  28. package/dist-library/types/local/diagnostics.d.ts +40 -0
  29. package/dist-library/types/local/index.d.ts +1 -0
  30. package/dist-library/types/local/math-display.d.ts +72 -0
  31. package/dist-library/types/local/math-view.d.ts +2 -0
  32. package/dist-library/types/local/options.d.ts +3 -1
  33. package/dist-library/types/local/types.d.ts +10 -0
  34. package/dist-library/types/local/worker.d.ts +3 -2
  35. package/dist-library/types/react/index.d.ts +1 -1
  36. package/dist-standalone/reactive-md-standalone.js +54 -50
  37. package/docs/author-tools-ch.md +11 -5
  38. package/docs/author-tools-en.md +11 -5
  39. package/docs/editor-ch.md +237 -235
  40. package/docs/editor-en.md +237 -235
  41. package/docs/local-integration-ch.md +392 -390
  42. package/docs/local-integration-en.md +392 -390
  43. package/docs/release-0.5.3-ch.md +25 -0
  44. package/docs/release-0.5.3-en.md +25 -0
  45. package/package.json +12 -2
package/CHANGELOG-ch.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.5.3(2026-10-26,next 渠道)
4
+
5
+ 参见 [0.5.3 发布说明](docs/release-0.5.3-ch.md)。语法与协议修订保持不变。
6
+
7
+ - 新增可选 `markdownBreaks`,贯通编译、渲染、worker 和缓存键,保留源码范围。
8
+ - 拆出无样式 React 入口、屏幕 CSS 和可选打印 CSS,屏幕样式移除全局 `@page`。
9
+ - 导出 `localCompileOptionsKey`、`LocalRenderContext`,新增无需 React 的 `reactive-md/authoring` 入口。
10
+ - 分析、补全、重命名和格式化接受与预览一致的编译配置。
11
+ - 数学显示因不支持的命令、环境或预算降级时,报告带源码范围的诊断。
12
+
13
+
3
14
  本文件记录用户可见变更。项目处于 0.x 预览阶段,版本与迁移规则见[版本与兼容性](docs/compatibility-ch.md)。
4
15
 
5
16
  ## 0.5.2(2026-10-26,next 渠道)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.3 (2026-10-26, next channel)
4
+
5
+ See [0.5.3 release notes](docs/release-0.5.3-en.md). Syntax and protocol revisions are unchanged.
6
+
7
+ - Add opt-in `markdownBreaks` across compilation, rendering, workers and cache keys while preserving source ranges.
8
+ - Add an unstyled React entry, screen CSS and optional print CSS; remove global `@page` from screen styles.
9
+ - Export `localCompileOptionsKey` and `LocalRenderContext`, and add the React-free `reactive-md/authoring` entry.
10
+ - Accept preview compile options in analysis, completion, rename and formatting.
11
+ - Report source-ranged diagnostics when display math falls back for unsupported commands, environments or budgets.
12
+
13
+
3
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).
4
15
 
5
16
  ## 0.5.2 (2026-10-26, next channel)
package/README-ch.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  用 Markdown 写本地交互文档。放入输入控件,用 `bind` 命名参数,用 `{{ 表达式 }}` 连接文字、公式、图表和图解。文档作者无需编写 JavaScript 或 CSS。
6
6
 
7
- 本地模式采用 HTML 风格标签,参数和表格数据直接写在正文中,LaTeX 公式可用于函数绘图。TypeScript 核心和 React 渲染器可独立集成。`0.5.2` 是面向 `next` 渠道的预览版,新增宿主组件扩展轴;`latest` 仍为 `0.4.0`。语法修订继续为 `local-draft-2`,组块协议为 `component-protocol-2`。
7
+ 本地模式采用 HTML 风格标签,参数和表格数据直接写在正文中,LaTeX 公式可用于函数绘图。TypeScript 核心和 React 渲染器可独立集成。`0.5.3` 是面向 `next` 渠道的预览版,补齐宿主作者工具、编译选项与数学降级诊断;`latest` 仍为 `0.4.0`。语法修订继续为 `local-draft-2`,组块协议为 `component-protocol-2`。
8
8
 
9
9
  ## 从这里开始
10
10
 
@@ -19,7 +19,7 @@
19
19
  - [独立接入示例](examples/integration/README.md):可复制到仓库外运行的 Node 核心和 React 页面。
20
20
  - [版本与兼容性](docs/compatibility-ch.md):0.x 规则、迁移、诊断契约和平台范围。
21
21
  - [组块协议](docs/component-protocol-ch.md) · [组块开发指南](docs/component-development-ch.md):新增组件的声明、行为契约和兼容性验收。
22
- - [0.5.2 发布说明](docs/release-0.5.2-ch.md):宿主组件与 `component-protocol-2`。
22
+ - [0.5.3 发布说明](docs/release-0.5.3-ch.md):宿主集成补丁与作者工具。
23
23
  - [0.5.1 发布说明](docs/release-0.5.1-ch.md):编辑器视图与主题,以及 HTML 兼容。
24
24
  - [0.5.0 发布说明](docs/release-0.5.0-ch.md):编辑器入口与文档渲染修复。
25
25
  - [0.4.1 发布说明](docs/release-0.4.1-ch.md):界面与交互修复,兼容 0.4.0。
@@ -48,17 +48,17 @@
48
48
  npm install reactive-md
49
49
  ```
50
50
 
51
- `latest` 当前为 `0.4.0`。0.5.2 预览版面向 `next` 渠道:
51
+ `latest` 当前为 `0.4.0`。0.5.3 预览版面向 `next` 渠道:
52
52
 
53
53
  ```sh
54
54
  npm install reactive-md@next
55
55
  # 或固定预览版
56
- npm install reactive-md@0.5.2
56
+ npm install reactive-md@0.5.3
57
57
  ```
58
58
 
59
- 使用预览版前请阅读[0.5.2 发布说明](docs/release-0.5.2-ch.md);从 `0.3.1` / `local-draft-1` 升级前请阅读[迁移说明](docs/release-0.4.0-ch.md)。
59
+ 使用预览版前请阅读[0.5.3 发布说明](docs/release-0.5.3-ch.md);从 `0.3.1` / `local-draft-1` 升级前请阅读[迁移说明](docs/release-0.4.0-ch.md)。
60
60
 
61
- `reactive-md` 入口提供本地编译器、表达式和运行时,`reactive-md/react` 提供 React 渲染器。组件样式通过 `reactive-md/styles.css` 引入。`reactive-md/editor` 提供源码编辑器,并使用独立样式 `reactive-md/editor/styles.css`。现有渲染器和样式导入在 0.5.2 中保持不变。
61
+ `reactive-md` 入口提供本地编译器、表达式和运行时,`reactive-md/react` 提供 React 渲染器。组件样式通过 `reactive-md/styles.css` 引入。`reactive-md/editor` 提供源码编辑器,并使用独立样式 `reactive-md/editor/styles.css`。现有渲染器和样式导入在 0.5.3 中保持不变。
62
62
 
63
63
  React 入口需要 React 19:
64
64
 
@@ -136,7 +136,7 @@ demo/ 独立的 Playground 应用
136
136
  - [可分享文档与静态导出](docs/shareable-export-ch.md):CLI build/lint、状态文件、本地图片内联、打印与独立浏览器运行时。
137
137
  - [功能演示与示例](examples/local/README.md)与[独立接入示例](examples/integration/README.md)。
138
138
  - [React 源码编辑器](docs/editor-ch.md):编辑 `.reactive.md` 源码的受控组件,使用独立样式表。
139
- - [版本与兼容性](docs/compatibility-ch.md)、[0.5.2 发布说明](docs/release-0.5.2-ch.md)与[0.5.1 发布说明](docs/release-0.5.1-ch.md)。
139
+ - [版本与兼容性](docs/compatibility-ch.md)、[0.5.3 发布说明](docs/release-0.5.3-ch.md)与[0.5.1 发布说明](docs/release-0.5.1-ch.md)。
140
140
  - [0.4.0 发布与迁移](docs/release-0.4.0-ch.md)。
141
141
  - [组块协议](docs/component-protocol-ch.md)与[组块开发指南](docs/component-development-ch.md)。
142
142
  - [性能说明](docs/performance-ch.md)与[发布清单](docs/releasing-ch.md)。
package/README-en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Write local interactive documents in Markdown. Add input controls, name parameters with `bind`, and connect prose, formulas, charts and diagrams with `{{ expressions }}`. Document authors do not write JavaScript or CSS.
6
6
 
7
- Local mode uses HTML-style tags, with parameters and table data written directly in the prose; LaTeX formulas can drive function plots. The TypeScript core and the React renderer can be integrated independently. `0.5.2` is the preview for the `next` channel and adds the host component extension axis; `latest` remains `0.4.0`. Syntax revision stays `local-draft-2`, and the component protocol is `component-protocol-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
7
+ Local mode uses HTML-style tags, with parameters and table data written directly in the prose; LaTeX formulas can drive function plots. The TypeScript core and the React renderer can be integrated independently. `0.5.3` is the preview for the `next` channel and adds host integration and authoring patches; `latest` remains `0.4.0`. Syntax revision stays `local-draft-2`, and the component protocol is `component-protocol-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
8
8
 
9
9
  ## Start here
10
10
 
@@ -19,7 +19,7 @@ Local mode uses HTML-style tags, with parameters and table data written directly
19
19
  - [Standalone integration examples](examples/integration/README.md): Node core and React pages you can copy and run outside the repository.
20
20
  - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, the diagnostics contract and supported platforms.
21
21
  - [Component protocol](docs/component-protocol-en.md) · [Component development guide](docs/component-development-en.md): declarations, behavior contracts and compatibility acceptance for new components.
22
- - [0.5.2 release notes](docs/release-0.5.2-en.md): host components and `component-protocol-2`.
22
+ - [0.5.3 release notes](docs/release-0.5.3-en.md): host integration and authoring patches.
23
23
  - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
24
24
  - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
25
25
  - [0.4.1 release notes](docs/release-0.4.1-en.md): visual and interaction fixes, compatible with 0.4.0.
@@ -48,17 +48,17 @@ Reactive MD requires Node.js 22.12 or newer and ships only ESM entries:
48
48
  npm install reactive-md
49
49
  ```
50
50
 
51
- `latest` resolves to `0.4.0`. The 0.5.2 preview targets `next`:
51
+ `latest` resolves to `0.4.0`. The 0.5.3 preview targets `next`:
52
52
 
53
53
  ```sh
54
54
  npm install reactive-md@next
55
55
  # or pin the preview
56
- npm install reactive-md@0.5.2
56
+ npm install reactive-md@0.5.3
57
57
  ```
58
58
 
59
- Read the [0.5.2 release notes](docs/release-0.5.2-en.md) before using the preview, and the [migration guide](docs/release-0.4.0-en.md) before upgrading from `0.3.1` / `local-draft-1`.
59
+ Read the [0.5.3 release notes](docs/release-0.5.3-en.md) before using the preview, and the [migration guide](docs/release-0.4.0-en.md) before upgrading from `0.3.1` / `local-draft-1`.
60
60
 
61
- The `reactive-md` entry provides the local compiler, expressions and runtime; `reactive-md/react` provides the React renderer. Import component styles from `reactive-md/styles.css`. The `reactive-md/editor` entry provides the source editor with its own stylesheet at `reactive-md/editor/styles.css`. Existing renderer and style imports are unchanged in 0.5.2.
61
+ The `reactive-md` entry provides the local compiler, expressions and runtime; `reactive-md/react` provides the React renderer. Import component styles from `reactive-md/styles.css`. The `reactive-md/editor` entry provides the source editor with its own stylesheet at `reactive-md/editor/styles.css`. Existing renderer and style imports are unchanged in 0.5.3.
62
62
 
63
63
  The core `reactive-md` entry does not depend on React:
64
64
 
@@ -154,7 +154,7 @@ demo/ Standalone Playground app
154
154
  - [Feature tours and examples](examples/local/README.md) and [standalone integrations](examples/integration/README.md).
155
155
  - [React source editor](docs/editor-en.md): controlled editor for `.reactive.md` source, with its own stylesheet.
156
156
  - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, diagnostics and supported platforms.
157
- - [0.5.2 release notes](docs/release-0.5.2-en.md): host components and `component-protocol-2`.
157
+ - [0.5.3 release notes](docs/release-0.5.3-en.md): host integration and authoring patches.
158
158
  - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
159
159
  - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
160
160
  - [0.4.0 release and migration](docs/release-0.4.0-en.md): the upgrade checklist for that minor series.
@@ -167,7 +167,7 @@ See the [contributing guide](CONTRIBUTING.md) for development and test commands.
167
167
 
168
168
  - CI targets Node 22.12 and Node 24 with Playwright Chromium; local browser checks use Microsoft Edge. The packed check covers static SSR, and `npm run test:shareable` covers the single-file export's static-first hydration. General SSR hydration outside that path, Firefox and WebKit remain unverified.
169
169
  - 0.x minor releases may contain breaking changes. Persist the original `.reactive.md` source, not the runtime AST or in-memory state.
170
- - `latest` is `0.4.0`; the `0.5.2` preview targets `next`. Security fixes may ship in minor releases.
170
+ - `latest` is `0.4.0`; the `0.5.3` preview targets `next`. Security fixes may ship in minor releases.
171
171
 
172
172
  ## Contributing and security
173
173
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Write local interactive documents in Markdown. Add input controls, name parameters with `bind`, and connect prose, formulas, charts and diagrams with `{{ expressions }}`. Document authors do not write JavaScript or CSS.
6
6
 
7
- Local mode uses HTML-style tags, with parameters and table data written directly in the prose; LaTeX formulas can drive function plots. The TypeScript core and the React renderer can be integrated independently. `0.5.2` is the preview for the `next` channel and adds the host component extension axis; `latest` remains `0.4.0`. Syntax revision stays `local-draft-2`, and the component protocol is `component-protocol-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
7
+ Local mode uses HTML-style tags, with parameters and table data written directly in the prose; LaTeX formulas can drive function plots. The TypeScript core and the React renderer can be integrated independently. `0.5.3` is the preview for the `next` channel and adds host integration and authoring patches; `latest` remains `0.4.0`. Syntax revision stays `local-draft-2`, and the component protocol is `component-protocol-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
8
8
 
9
9
  ## Start here
10
10
 
@@ -19,7 +19,7 @@ Local mode uses HTML-style tags, with parameters and table data written directly
19
19
  - [Standalone integration examples](examples/integration/README.md): Node core and React pages you can copy and run outside the repository.
20
20
  - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, the diagnostics contract and supported platforms.
21
21
  - [Component protocol](docs/component-protocol-en.md) · [Component development guide](docs/component-development-en.md): declarations, behavior contracts and compatibility acceptance for new components.
22
- - [0.5.2 release notes](docs/release-0.5.2-en.md): host components and `component-protocol-2`.
22
+ - [0.5.3 release notes](docs/release-0.5.3-en.md): host integration and authoring patches.
23
23
  - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
24
24
  - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
25
25
  - [0.4.1 release notes](docs/release-0.4.1-en.md): visual and interaction fixes, compatible with 0.4.0.
@@ -48,17 +48,17 @@ Reactive MD requires Node.js 22.12 or newer and ships only ESM entries:
48
48
  npm install reactive-md
49
49
  ```
50
50
 
51
- `latest` resolves to `0.4.0`. The 0.5.2 preview targets `next`:
51
+ `latest` resolves to `0.4.0`. The 0.5.3 preview targets `next`:
52
52
 
53
53
  ```sh
54
54
  npm install reactive-md@next
55
55
  # or pin the preview
56
- npm install reactive-md@0.5.2
56
+ npm install reactive-md@0.5.3
57
57
  ```
58
58
 
59
- Read the [0.5.2 release notes](docs/release-0.5.2-en.md) before using the preview, and the [migration guide](docs/release-0.4.0-en.md) before upgrading from `0.3.1` / `local-draft-1`.
59
+ Read the [0.5.3 release notes](docs/release-0.5.3-en.md) before using the preview, and the [migration guide](docs/release-0.4.0-en.md) before upgrading from `0.3.1` / `local-draft-1`.
60
60
 
61
- The `reactive-md` entry provides the local compiler, expressions and runtime; `reactive-md/react` provides the React renderer. Import component styles from `reactive-md/styles.css`. The `reactive-md/editor` entry provides the source editor with its own stylesheet at `reactive-md/editor/styles.css`. Existing renderer and style imports are unchanged in 0.5.2.
61
+ The `reactive-md` entry provides the local compiler, expressions and runtime; `reactive-md/react` provides the React renderer. Import component styles from `reactive-md/styles.css`. The `reactive-md/editor` entry provides the source editor with its own stylesheet at `reactive-md/editor/styles.css`. Existing renderer and style imports are unchanged in 0.5.3.
62
62
 
63
63
  The core `reactive-md` entry does not depend on React:
64
64
 
@@ -154,7 +154,7 @@ demo/ Standalone Playground app
154
154
  - [Feature tours and examples](examples/local/README.md) and [standalone integrations](examples/integration/README.md).
155
155
  - [React source editor](docs/editor-en.md): controlled editor for `.reactive.md` source, with its own stylesheet.
156
156
  - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, diagnostics and supported platforms.
157
- - [0.5.2 release notes](docs/release-0.5.2-en.md): host components and `component-protocol-2`.
157
+ - [0.5.3 release notes](docs/release-0.5.3-en.md): host integration and authoring patches.
158
158
  - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
159
159
  - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
160
160
  - [0.4.0 release and migration](docs/release-0.4.0-en.md): the upgrade checklist for that minor series.
@@ -167,7 +167,7 @@ See the [contributing guide](CONTRIBUTING.md) for development and test commands.
167
167
 
168
168
  - CI targets Node 22.12 and Node 24 with Playwright Chromium; local browser checks use Microsoft Edge. The packed check covers static SSR, and `npm run test:shareable` covers the single-file export's static-first hydration. General SSR hydration outside that path, Firefox and WebKit remain unverified.
169
169
  - 0.x minor releases may contain breaking changes. Persist the original `.reactive.md` source, not the runtime AST or in-memory state.
170
- - `latest` is `0.4.0`; the `0.5.2` preview targets `next`. Security fixes may ship in minor releases.
170
+ - `latest` is `0.4.0`; the `0.5.3` preview targets `next`. Security fixes may ship in minor releases.
171
171
 
172
172
  ## Contributing and security
173
173
 
package/cli/build.mjs CHANGED
@@ -175,7 +175,7 @@ export async function runBuild(options, context) {
175
175
  const { urlPolicy, imageResolver } = createAssetPolicy(byUrl);
176
176
 
177
177
  /* ------------------------------------------------------------- build inputs */
178
- const css = await readArtifactText(packageRoot, 'css');
178
+ const css = `${await readArtifactText(packageRoot, 'css')}\n${await readArtifactText(packageRoot, 'printCss')}`;
179
179
  let runtimeScript;
180
180
  if (options.mode === 'interactive') {
181
181
  runtimeScript = await readArtifactText(packageRoot, 'standalone');
package/cli/package.mjs CHANGED
@@ -11,6 +11,7 @@ export const ARTIFACTS = Object.freeze({
11
11
  core: { relative: 'dist-library/reactive-md.js', label: 'core build' },
12
12
  react: { relative: 'dist-library/reactive-md-react.js', label: 'React renderer build' },
13
13
  css: { relative: 'dist-library/reactive-md.css', label: 'stylesheet build' },
14
+ printCss: { relative: 'dist-library/reactive-md-print.css', label: 'print stylesheet build' },
14
15
  standalone: { relative: 'dist-standalone/reactive-md-standalone.js', label: 'standalone runtime build' },
15
16
  });
16
17