reactive-md 0.4.1 → 0.5.0

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 (79) hide show
  1. package/CHANGELOG-ch.md +128 -113
  2. package/CHANGELOG.md +128 -113
  3. package/LICENSE +21 -21
  4. package/README-ch.md +152 -123
  5. package/README-en.md +176 -147
  6. package/README.md +176 -147
  7. package/THIRD_PARTY_NOTICES.md +94 -1
  8. package/bin/reactive-md.mjs +1 -1
  9. package/dist-library/reactive-md-editor.css +2 -0
  10. package/dist-library/reactive-md-editor.js +3710 -0
  11. package/dist-library/reactive-md-react.js +9035 -1558
  12. package/dist-library/reactive-md.css +1 -1
  13. package/dist-library/reactive-md.js +98 -97
  14. package/dist-library/{runtime-D3QTVYaz.js → runtime-DPuMxM_y.js} +1978 -1583
  15. package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
  16. package/dist-library/types/editor/editor-commands.d.ts +50 -0
  17. package/dist-library/types/editor/editor-i18n.d.ts +102 -0
  18. package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
  19. package/dist-library/types/editor/extended-native-components.d.ts +58 -0
  20. package/dist-library/types/editor/index.d.ts +9 -0
  21. package/dist-library/types/editor/locale.d.ts +13 -0
  22. package/dist-library/types/editor/native-components.d.ts +47 -0
  23. package/dist-library/types/editor/source-authoring.d.ts +57 -0
  24. package/dist-library/types/editor/types.d.ts +44 -0
  25. package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
  26. package/dist-library/types/editor/use-source-history.d.ts +16 -0
  27. package/dist-library/types/local/code-block.d.ts +24 -0
  28. package/dist-library/types/local/footnotes.d.ts +51 -0
  29. package/dist-library/types/local/image-view.d.ts +21 -0
  30. package/dist-library/types/local/types.d.ts +7 -0
  31. package/dist-standalone/reactive-md-standalone.css +1 -1
  32. package/dist-standalone/reactive-md-standalone.js +47 -36
  33. package/docs/compatibility-ch.md +12 -8
  34. package/docs/compatibility-en.md +12 -8
  35. package/docs/component-protocol-ch.md +2 -2
  36. package/docs/component-protocol-en.md +2 -2
  37. package/docs/editor-ch.md +216 -0
  38. package/docs/editor-en.md +216 -0
  39. package/docs/local-guide-ch.md +11 -5
  40. package/docs/local-guide-en.md +11 -5
  41. package/docs/local-interaction-syntax-ch.md +7 -2
  42. package/docs/local-interaction-syntax-en.md +7 -2
  43. package/docs/release-0.4.1-ch.md +23 -23
  44. package/docs/release-0.4.1-en.md +23 -23
  45. package/docs/release-0.5.0-ch.md +41 -0
  46. package/docs/release-0.5.0-en.md +41 -0
  47. package/docs/releasing-ch.md +108 -101
  48. package/docs/releasing-en.md +108 -101
  49. package/docs/shareable-export-ch.md +4 -2
  50. package/docs/shareable-export-en.md +4 -2
  51. package/examples/integration/core/package.json +7 -7
  52. package/examples/integration/react/index.html +12 -12
  53. package/examples/integration/react/main.jsx +21 -21
  54. package/examples/integration/react/package.json +9 -9
  55. package/examples/integration/react-editor.tsx +74 -0
  56. package/examples/local/catalog.reactive.md +20 -20
  57. package/examples/local/checklist.reactive.md +32 -32
  58. package/examples/local/comparison.reactive.md +47 -47
  59. package/examples/local/components.reactive.md +44 -44
  60. package/examples/local/counter.reactive.md +7 -7
  61. package/examples/local/diagnostics.reactive.md +54 -54
  62. package/examples/local/diagram.reactive.md +44 -44
  63. package/examples/local/gallery.reactive.md +61 -61
  64. package/examples/local/parameters.reactive.md +36 -36
  65. package/examples/local/planning.reactive.md +24 -24
  66. package/examples/local/pricing.reactive.md +20 -20
  67. package/examples/local/zh/catalog.reactive.md +20 -20
  68. package/examples/local/zh/charts.reactive.md +73 -73
  69. package/examples/local/zh/checklist.reactive.md +32 -32
  70. package/examples/local/zh/comparison.reactive.md +47 -47
  71. package/examples/local/zh/components.reactive.md +44 -44
  72. package/examples/local/zh/counter.reactive.md +7 -7
  73. package/examples/local/zh/diagnostics.reactive.md +54 -54
  74. package/examples/local/zh/diagram.reactive.md +44 -44
  75. package/examples/local/zh/gallery.reactive.md +61 -61
  76. package/examples/local/zh/parameters.reactive.md +36 -36
  77. package/examples/local/zh/planning.reactive.md +24 -24
  78. package/examples/local/zh/pricing.reactive.md +20 -20
  79. package/package.json +133 -91
package/CHANGELOG-ch.md CHANGED
@@ -1,113 +1,128 @@
1
- # 变更记录
2
-
3
- 本文件记录用户可见变更。项目处于 0.x 预览阶段,版本与迁移规则见[版本与兼容性](docs/compatibility-ch.md)。
4
-
5
- ## 0.4.1(2026-10-25)
6
-
7
- 兼容 0.4.0;语法仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`。见[0.4.1 发布说明](docs/release-0.4.1-ch.md)。
8
-
9
- ### 调整
10
-
11
- - 改进深浅色文档底色、视觉层级、低饱和图表配色和控件切换动效。
12
- - 输入框与按钮采用气泡圆角,滑块与圆形选择控件采用统一样式;滑块 `color` 可设置轨道背景色。
13
- - 表格占满容器并均衡分配列宽,用三角形表示排序方向,增大环形图。
14
- - 坐标控件增加网格、箭头轴、虚线投影和可拖动的坐标标注点,保留键盘与数字输入操作。
15
- - quiz 输入框适应容器宽度,题目与操作区整体垂直居中。
16
-
17
- ### 修复
18
-
19
- - LaTeX 使用正文字号和黑白文字颜色,分段函数的表达式与条件不再重叠。
20
- - 工具栏插入内容后保留源码编辑器滚动位置,日期输入框适应窄屏。
21
-
22
- ## 0.4.0(2026-10-24,next 渠道)
23
-
24
- `0.4.0` 是同时提供于 `latest` 和 `next` 渠道的 0.x 预览版,语法修订为 `local-draft-2`,从 `0.3.1` / `local-draft-1` 升级;包版本、语法修订、`component-protocol-1` 组块协议和 `reactive-md-theme-1` 主题协议是彼此独立的版本轴。完整升级清单见[0.4.0 发布与迁移](docs/release-0.4.0-ch.md)。
25
-
26
- ### 修复
27
-
28
- - 紧凑桌面布局使用较宽系统字体时,Playground 工具栏保持单行。
29
- - 首次打开源码时同步高亮层与编辑器的滚动位置,并增加源码区的可用高度。
30
-
31
- ### 新增
32
-
33
- - 新增源码高亮、补全、绑定导航、重命名和格式化 API,以及对应的 Playground 作者工具。
34
- - 新增按依赖更新的渲染优化,浏览器等价检查覆盖参数更新、重置、可视化选择和语言切换。
35
- - 新增 `npm run verify:release` 与对应 CI 分片,覆盖组合文档和仓库外的真实 tarball 消费;保留经过验证的安装包、SHA256 与 npm integrity 记录。
36
- - 新增跨字段 `<validation>` 规则、关联的可访问提示及 `runtime.validate()`;`alert` 和 `badge` 支持按条件选择现有 `tone` 枚举。
37
- - 新增同类型字符串/数字数组字面量、数组索引、`sum`、`average`、`minOf`、`maxOf`,以及带稳定行键和数量预算的 `<data-table>`/`<column>`。见[条件、校验与本地集合](docs/constraints-collections-ch.md)。`LocalValueKind` 增加 `number-array`,新增聚合函数名成为保留字。
38
-
39
- - 新增不可见、只读的 `<computed>` 与 `<const>` 声明,支持依赖排序、类型推断、循环检测和各运行时独立的计算缓存。正文、条件、公式与图表可共享中间结果。
40
- - 新增数字、百分比、科学计数法与货币格式化,常用字符串函数及 UTC 日期比较、日期差。默认值、舍入、空值和地区规则见[复用计算与格式化数值](docs/computations-formatting-ch.md)。新函数名成为保留字;升级到本版本前需重命名同名旧绑定。
41
-
42
- - 新增可选的 `<!-- reactive-md: local-draft-2 -->` 源码修订指令。显式旧修订、未知、格式错误、重复或位置错误的声明会以 `local.version.*` 诊断拒绝,不创建运行时;无指令源码保持当前修订行为。早于该指令的读者会忽略它。见[源码修订与迁移](docs/source-versioning-ch.md)。
43
- - 新增 `inspectLocalSourceVersion`、`checkLocalUpgrade`、`migrateLocalSource`,以及带 `--from`、`--check`、`--json`、`-o/--output`、`--accept-semantic-changes` 和 `--locale` 的 `reactive-md migrate`。迁移只改指令,保留正文原始字节、BOM 和 CRLF,幂等;阻止保留绑定、新增可识别标签、编译错误和文本长度语义变化,且从不改写状态文件。
44
-
45
- - 增加统一的中英文诊断模板,同一 minor 系列内保持现有诊断码含义稳定。Playground、React 渲染器与 `lint --locale en|zh` 按语言显示诊断,保留机器字段。
46
- - 文本控件长度约束改为按 Unicode 码点计数,与字符串 `len()` 一致;源码定位和资源预算继续使用 UTF-16。原先因 emoji 占用两个代码单元而被拒绝的值,现在可满足对应码点上限。详见[诊断与计数规则](docs/diagnostics-counting-ch.md)。
47
-
48
- - 增加文档开头的 `<theme name="…">` 声明、宿主主题登记和 `reactive-md-theme-1` 主题协议。两个 React 组件支持独立深浅模式和系统偏好;现有外观保留为 `default`。见[主题协议](docs/theme-protocol-ch.md)。
49
- - 新增可分享单文件 HTML 导出:`reactive-md build`/`lint` CLI、交互与静态模式、静态首屏水合、可打印的当前值、版本化 `reactive-md-state/v1` 状态文件、经过校验的本地位图内联、standalone `ReactiveMD.mount`/`mountAll` IIFE 和 `<reactive-md-doc>`。见[可分享文档与静态导出](docs/shareable-export-ch.md)。
50
- - 新增宿主状态 API:`LocalRuntime` 可按名称访问公开参数(`parameterNames`、`getParameter`、`getParameters`、`setParameter`、`setParameters`),并提供 `exportLocalState`/`importLocalState` 读写 `reactive-md-state/v1` 状态文件。写入先统一校验再一次性提交,失败时不改变状态。
51
- - 新增源码变更时的参数保留工具:`planLocalStateRetention` 和 `applyLocalStateRetention` 仅保留类型与初始定义未变、绑定可安全保留的公开参数;匿名 `@` 绑定、计时器和位置清单会被丢弃,被拒绝的值会记录原因。
52
- - 新增可选的后台编译适配器:`LocalCompileScheduler` 提供 150 ms 防抖、一个进行中任务加最新源码、永久回退到主线程 `compileLocal`,并新增 `startLocalCompileWorker`;回退失败使用 `local.worker.compile` 诊断码。
53
-
54
- ### local-draft-2 组块
55
-
56
- - 新增文档跳转与锚点、正文颜色、多选、区间与二维坐标输入、练习题及分步阅读。
57
- - 清单勾选后划线,新增组件主色及表格/图表稳定标识的共享选择。
58
- - runtime.get/set 支持可选槽位,新增原子 setMany;新增槽位绑定为独占。
59
- - 新增双语功能馆及编辑器插入模板。见[迁移说明](docs/local-components-v2-ch.md)。预览版发布在 `next` 渠道。
60
-
61
- - Playground 新增中英文切换,界面、示例、指南和内置控件文案会同步切换,选择保存在浏览器中。
62
- - `LocalDocumentView` 和 `LocalReactiveDocument` 支持 `locale: 'en' | 'zh'`(默认 `'en'`),用于内置 UI 文案。显示用编译与运行时诊断通过中英文共享目录本地化,回调仍收到带稳定机器字段的结构化诊断。
63
- - `timeline` 同时接受英文列 `Task`、`Start`、`Duration`(可选 `Notes`)和中文列 `事项`、`开始`、`时长`(可选 `说明`)。
64
-
65
- ## 0.3.1(2026-10-23)
66
-
67
- 兼容更新,继续采用 `local-draft-1` 语法,无需迁移现有文档。
68
-
69
- - Playground 新增 Markdown 编辑工具栏和 25 个原生组件插入模板,支持格式状态、撤销/重做、搜索、键盘导航及手机紧凑布局。
70
- - 大文档采用后台编译、输入合并和延迟存储;支持通过 `limits.maxSyntaxNodes` 配置语法节点预算。
71
- - 统一文档主题、组块标题与正文层级,改进图解长标签换行、连线说明和回退样式。
72
- - 增加 `component-protocol-1` 组块贡献协议、开发提案模板、JSON Schema 和代表性验收用例,提供 `npm run test:components`;本次协议不改变 `local-draft-1` 语法或运行时 API。
73
- - Markdown 标题生成实例独立的锚点,文档内目录链接支持中文、格式化标题和重复标题;交互更新后锚点保持稳定。
74
- - Playground 默认保留当前编辑会话中兼容的具名参数,支持关闭保留;临时编译错误修复后恢复试算值,重新运行、恢复示例、切换示例和导入文档时重置。
75
- - 结构完整的未知标签保留为源码并给出警告,其他正文和交互继续工作;降级区域内的标签与插值不执行。
76
- - 脚注引用与定义保留原文,并给出尚未支持脚注排版的诊断。
77
-
78
- ## 0.3.0(2026-10-22)
79
-
80
- 首个公开预览版,语法修订为 `local-draft-1`。安装:`npm install reactive-md@0.3.0`。集成步骤见 [README](README-ch.md)。
81
-
82
- ### 新增
83
-
84
- - `local-draft-1` 本地交互语法:Markdown 正文、33 个组件名、`bind` 参数和 `{{ 表达式 }}` 插值。
85
- - 参数控件、面板重置、条件内容、标签页、折叠、提示、清单、进度和计时器。
86
- - 增强表格、五类统计图、LaTeX 函数曲线、时间轴和交互图解。
87
- - 核心入口 `reactive-md`:`compileLocal`、`createLocalRuntime`、`compileExpression`、`compileLatex`、`samplePlot` 和 `LOCAL_SYNTAX_VERSION`。
88
- - React 入口 `reactive-md/react`:`LocalReactiveDocument`、`LocalDocumentView`,支持宿主 URL 策略。
89
- - 全局样式入口 `reactive-md/styles.css`,包含浅色与 `data-theme="dark"` 主题变量。
90
- - 中文新用户指南、完整语法规范、集成说明、版本与兼容性说明,以及 12 份本地示例(其中 1 份是故意报错的诊断示例)。
91
- - 文档、示例、打包入口、浏览器交互和资源上限的检查;仓库外离线安装、纯核心与 React 的严格类型检查、静态 SSR 验证。
92
- - 可复制的独立 Node/React 接入示例、机器可读的语言验收数据、性能基准和第三方许可证清单。
93
- - Node 22.12/24 与 Chromium 的 CI 检查通过;私密漏洞报告已启用。
94
-
95
- ### 兼容性
96
-
97
- - 首次预览,没有已发布的 npm 版本可供升级。
98
- - 旧版 directive、YAML `state`/`data`/`computed`/`actions` 和事件属性不属于 `local-draft-1`;迁移方式见[版本与兼容性](docs/compatibility-ch.md)。
99
- - 持久化原始 `.reactive.md` 源码,不持久化 `LocalDocument`、节点 ID 或运行时状态。
100
- - 诊断的 `line`、`column` 和 `range` 可用于程序定位;`code` 在 0.x 中不承诺跨版本稳定;`message` 是显示文本,不保证稳定。
101
-
102
- ### 已知限制
103
-
104
- - 只提供 ESM;React 入口要求 React 19;核心入口不依赖 React。
105
- - Node.js 22.12+ 是开发和 Node 端消费的最低版本。
106
- - Microsoft Edge(Chromium 内核)已完成本地浏览器验证;Firefox、Safari/WebKit 和 SSR 水合未验证。
107
- - 不提供状态持久化、插件系统、任意 HTML、网络服务、Vue 支持、React 18 支持或 CommonJS 入口。
108
-
109
- ### 安全
110
-
111
- - 表达式和 LaTeX 使用封闭求值器,不执行脚本或任意 HTML。
112
- - 图片默认不加载;链接和图片先经过协议检查,宿主可用 `urlPolicy` 收紧或放行。
113
- - 文档、值、诊断和绘图计算都有资源上限。安全边界与宿主责任见[安全策略](SECURITY-ch.md)。
1
+ # 变更记录
2
+
3
+ 本文件记录用户可见变更。项目处于 0.x 预览阶段,版本与迁移规则见[版本与兼容性](docs/compatibility-ch.md)。
4
+
5
+ ## 0.5.0(2026-10-25,next 渠道)
6
+
7
+ 兼容 0.4.1。语法仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`。现有 `reactive-md`、`reactive-md/react` 和 `reactive-md/styles.css` 导入保持不变,渲染器入口 API 不变。见[0.5.0 发布说明](docs/release-0.5.0-ch.md)。
8
+
9
+ ### 新增
10
+
11
+ - 新增 `reactive-md/editor`,这是从 Playground 抽出的受控 React 19 源码编辑器,并提供独立样式入口 `reactive-md/editor/styles.css`。它包含高亮、格式与插入工具、补全、绑定导航、重命名、格式化、撤销重做、行号和滚动同步。语言与主题按实例设置;`diagnostics` 和 `document` 用于行号标记与绑定值类型。预览、持久化和导出由宿主负责。
12
+ - 支持无属性的 `<b>`、`<i>`、`<u>`、`<s>`、`<mark>` 和 `<br>` 基础格式。
13
+ - 脚注支持 Markdown 正文排版、编号、重复引用及返回链接。
14
+ - 代码围栏支持常见语言高亮和原文复制,并提供中英文结果反馈。获准加载的图片可点击放大,支持键盘操作与关闭后焦点恢复。
15
+
16
+ ### 修复
17
+
18
+ - 泛型、比较式和货币按普通正文显示,避免误识别为组件标签或公式。
19
+
20
+ ## 0.4.1(2026-10-25)
21
+
22
+ 兼容 0.4.0;语法仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`。见[0.4.1 发布说明](docs/release-0.4.1-ch.md)。
23
+
24
+ ### 调整
25
+
26
+ - 改进深浅色文档底色、视觉层级、低饱和图表配色和控件切换动效。
27
+ - 输入框与按钮采用气泡圆角,滑块与圆形选择控件采用统一样式;滑块 `color` 可设置轨道背景色。
28
+ - 表格占满容器并均衡分配列宽,用三角形表示排序方向,增大环形图。
29
+ - 坐标控件增加网格、箭头轴、虚线投影和可拖动的坐标标注点,保留键盘与数字输入操作。
30
+ - quiz 输入框适应容器宽度,题目与操作区整体垂直居中。
31
+
32
+ ### 修复
33
+
34
+ - LaTeX 使用正文字号和黑白文字颜色,分段函数的表达式与条件不再重叠。
35
+ - 工具栏插入内容后保留源码编辑器滚动位置,日期输入框适应窄屏。
36
+
37
+ ## 0.4.0(2026-10-24,next 渠道)
38
+
39
+ `0.4.0` 是同时提供于 `latest` 和 `next` 渠道的 0.x 预览版,语法修订为 `local-draft-2`,从 `0.3.1` / `local-draft-1` 升级;包版本、语法修订、`component-protocol-1` 组块协议和 `reactive-md-theme-1` 主题协议是彼此独立的版本轴。完整升级清单见[0.4.0 发布与迁移](docs/release-0.4.0-ch.md)。
40
+
41
+ ### 修复
42
+
43
+ - 紧凑桌面布局使用较宽系统字体时,Playground 工具栏保持单行。
44
+ - 首次打开源码时同步高亮层与编辑器的滚动位置,并增加源码区的可用高度。
45
+
46
+ ### 新增
47
+
48
+ - 新增源码高亮、补全、绑定导航、重命名和格式化 API,以及对应的 Playground 作者工具。
49
+ - 新增按依赖更新的渲染优化,浏览器等价检查覆盖参数更新、重置、可视化选择和语言切换。
50
+ - 新增 `npm run verify:release` 与对应 CI 分片,覆盖组合文档和仓库外的真实 tarball 消费;保留经过验证的安装包、SHA256 与 npm integrity 记录。
51
+ - 新增跨字段 `<validation>` 规则、关联的可访问提示及 `runtime.validate()`;`alert` 和 `badge` 支持按条件选择现有 `tone` 枚举。
52
+ - 新增同类型字符串/数字数组字面量、数组索引、`sum`、`average`、`minOf`、`maxOf`,以及带稳定行键和数量预算的 `<data-table>`/`<column>`。见[条件、校验与本地集合](docs/constraints-collections-ch.md)。`LocalValueKind` 增加 `number-array`,新增聚合函数名成为保留字。
53
+
54
+ - 新增不可见、只读的 `<computed>` 与 `<const>` 声明,支持依赖排序、类型推断、循环检测和各运行时独立的计算缓存。正文、条件、公式与图表可共享中间结果。
55
+ - 新增数字、百分比、科学计数法与货币格式化,常用字符串函数及 UTC 日期比较、日期差。默认值、舍入、空值和地区规则见[复用计算与格式化数值](docs/computations-formatting-ch.md)。新函数名成为保留字;升级到本版本前需重命名同名旧绑定。
56
+
57
+ - 新增可选的 `<!-- reactive-md: local-draft-2 -->` 源码修订指令。显式旧修订、未知、格式错误、重复或位置错误的声明会以 `local.version.*` 诊断拒绝,不创建运行时;无指令源码保持当前修订行为。早于该指令的读者会忽略它。见[源码修订与迁移](docs/source-versioning-ch.md)。
58
+ - 新增 `inspectLocalSourceVersion`、`checkLocalUpgrade`、`migrateLocalSource`,以及带 `--from`、`--check`、`--json`、`-o/--output`、`--accept-semantic-changes` 和 `--locale` 的 `reactive-md migrate`。迁移只改指令,保留正文原始字节、BOM 和 CRLF,幂等;阻止保留绑定、新增可识别标签、编译错误和文本长度语义变化,且从不改写状态文件。
59
+
60
+ - 增加统一的中英文诊断模板,同一 minor 系列内保持现有诊断码含义稳定。Playground、React 渲染器与 `lint --locale en|zh` 按语言显示诊断,保留机器字段。
61
+ - 文本控件长度约束改为按 Unicode 码点计数,与字符串 `len()` 一致;源码定位和资源预算继续使用 UTF-16。原先因 emoji 占用两个代码单元而被拒绝的值,现在可满足对应码点上限。详见[诊断与计数规则](docs/diagnostics-counting-ch.md)。
62
+
63
+ - 增加文档开头的 `<theme name="…">` 声明、宿主主题登记和 `reactive-md-theme-1` 主题协议。两个 React 组件支持独立深浅模式和系统偏好;现有外观保留为 `default`。见[主题协议](docs/theme-protocol-ch.md)。
64
+ - 新增可分享单文件 HTML 导出:`reactive-md build`/`lint` CLI、交互与静态模式、静态首屏水合、可打印的当前值、版本化 `reactive-md-state/v1` 状态文件、经过校验的本地位图内联、standalone `ReactiveMD.mount`/`mountAll` IIFE 和 `<reactive-md-doc>`。见[可分享文档与静态导出](docs/shareable-export-ch.md)。
65
+ - 新增宿主状态 API:`LocalRuntime` 可按名称访问公开参数(`parameterNames`、`getParameter`、`getParameters`、`setParameter`、`setParameters`),并提供 `exportLocalState`/`importLocalState` 读写 `reactive-md-state/v1` 状态文件。写入先统一校验再一次性提交,失败时不改变状态。
66
+ - 新增源码变更时的参数保留工具:`planLocalStateRetention` 和 `applyLocalStateRetention` 仅保留类型与初始定义未变、绑定可安全保留的公开参数;匿名 `@` 绑定、计时器和位置清单会被丢弃,被拒绝的值会记录原因。
67
+ - 新增可选的后台编译适配器:`LocalCompileScheduler` 提供 150 ms 防抖、一个进行中任务加最新源码、永久回退到主线程 `compileLocal`,并新增 `startLocalCompileWorker`;回退失败使用 `local.worker.compile` 诊断码。
68
+
69
+ ### local-draft-2 组块
70
+
71
+ - 新增文档跳转与锚点、正文颜色、多选、区间与二维坐标输入、练习题及分步阅读。
72
+ - 清单勾选后划线,新增组件主色及表格/图表稳定标识的共享选择。
73
+ - runtime.get/set 支持可选槽位,新增原子 setMany;新增槽位绑定为独占。
74
+ - 新增双语功能馆及编辑器插入模板。见[迁移说明](docs/local-components-v2-ch.md)。预览版发布在 `next` 渠道。
75
+
76
+ - Playground 新增中英文切换,界面、示例、指南和内置控件文案会同步切换,选择保存在浏览器中。
77
+ - `LocalDocumentView` 和 `LocalReactiveDocument` 支持 `locale: 'en' | 'zh'`(默认 `'en'`),用于内置 UI 文案。显示用编译与运行时诊断通过中英文共享目录本地化,回调仍收到带稳定机器字段的结构化诊断。
78
+ - `timeline` 同时接受英文列 `Task`、`Start`、`Duration`(可选 `Notes`)和中文列 `事项`、`开始`、`时长`(可选 `说明`)。
79
+
80
+ ## 0.3.1(2026-10-23)
81
+
82
+ 兼容更新,继续采用 `local-draft-1` 语法,无需迁移现有文档。
83
+
84
+ - Playground 新增 Markdown 编辑工具栏和 25 个原生组件插入模板,支持格式状态、撤销/重做、搜索、键盘导航及手机紧凑布局。
85
+ - 大文档采用后台编译、输入合并和延迟存储;支持通过 `limits.maxSyntaxNodes` 配置语法节点预算。
86
+ - 统一文档主题、组块标题与正文层级,改进图解长标签换行、连线说明和回退样式。
87
+ - 增加 `component-protocol-1` 组块贡献协议、开发提案模板、JSON Schema 和代表性验收用例,提供 `npm run test:components`;本次协议不改变 `local-draft-1` 语法或运行时 API。
88
+ - Markdown 标题生成实例独立的锚点,文档内目录链接支持中文、格式化标题和重复标题;交互更新后锚点保持稳定。
89
+ - Playground 默认保留当前编辑会话中兼容的具名参数,支持关闭保留;临时编译错误修复后恢复试算值,重新运行、恢复示例、切换示例和导入文档时重置。
90
+ - 结构完整的未知标签保留为源码并给出警告,其他正文和交互继续工作;降级区域内的标签与插值不执行。
91
+ - 脚注引用与定义保留原文,并给出尚未支持脚注排版的诊断。
92
+
93
+ ## 0.3.0(2026-10-22)
94
+
95
+ 首个公开预览版,语法修订为 `local-draft-1`。安装:`npm install reactive-md@0.3.0`。集成步骤见 [README](README-ch.md)。
96
+
97
+ ### 新增
98
+
99
+ - `local-draft-1` 本地交互语法:Markdown 正文、33 个组件名、`bind` 参数和 `{{ 表达式 }}` 插值。
100
+ - 参数控件、面板重置、条件内容、标签页、折叠、提示、清单、进度和计时器。
101
+ - 增强表格、五类统计图、LaTeX 函数曲线、时间轴和交互图解。
102
+ - 核心入口 `reactive-md`:`compileLocal`、`createLocalRuntime`、`compileExpression`、`compileLatex`、`samplePlot` 和 `LOCAL_SYNTAX_VERSION`。
103
+ - React 入口 `reactive-md/react`:`LocalReactiveDocument`、`LocalDocumentView`,支持宿主 URL 策略。
104
+ - 全局样式入口 `reactive-md/styles.css`,包含浅色与 `data-theme="dark"` 主题变量。
105
+ - 中文新用户指南、完整语法规范、集成说明、版本与兼容性说明,以及 12 份本地示例(其中 1 份是故意报错的诊断示例)。
106
+ - 文档、示例、打包入口、浏览器交互和资源上限的检查;仓库外离线安装、纯核心与 React 的严格类型检查、静态 SSR 验证。
107
+ - 可复制的独立 Node/React 接入示例、机器可读的语言验收数据、性能基准和第三方许可证清单。
108
+ - Node 22.12/24 与 Chromium 的 CI 检查通过;私密漏洞报告已启用。
109
+
110
+ ### 兼容性
111
+
112
+ - 首次预览,没有已发布的 npm 版本可供升级。
113
+ - 旧版 directive、YAML `state`/`data`/`computed`/`actions` 和事件属性不属于 `local-draft-1`;迁移方式见[版本与兼容性](docs/compatibility-ch.md)。
114
+ - 持久化原始 `.reactive.md` 源码,不持久化 `LocalDocument`、节点 ID 或运行时状态。
115
+ - 诊断的 `line`、`column` 和 `range` 可用于程序定位;`code` 在 0.x 中不承诺跨版本稳定;`message` 是显示文本,不保证稳定。
116
+
117
+ ### 已知限制
118
+
119
+ - 只提供 ESM;React 入口要求 React 19;核心入口不依赖 React。
120
+ - Node.js 22.12+ 是开发和 Node 端消费的最低版本。
121
+ - Microsoft Edge(Chromium 内核)已完成本地浏览器验证;Firefox、Safari/WebKit 和 SSR 水合未验证。
122
+ - 不提供状态持久化、插件系统、任意 HTML、网络服务、Vue 支持、React 18 支持或 CommonJS 入口。
123
+
124
+ ### 安全
125
+
126
+ - 表达式和 LaTeX 使用封闭求值器,不执行脚本或任意 HTML。
127
+ - 图片默认不加载;链接和图片先经过协议检查,宿主可用 `urlPolicy` 收紧或放行。
128
+ - 文档、值、诊断和绘图计算都有资源上限。安全边界与宿主责任见[安全策略](SECURITY-ch.md)。
package/CHANGELOG.md CHANGED
@@ -1,113 +1,128 @@
1
- # Changelog
2
-
3
- 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
-
5
- ## 0.4.1 (2026-10-25)
6
-
7
- 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).
8
-
9
- ### Changed
10
-
11
- - Refine light/dark document surfaces, visual hierarchy, muted chart colors and control transitions.
12
- - Use rounded fields and buttons, custom slider tracks and circular selection controls. Slider `color` now colors the track.
13
- - Balance full-width table columns, show triangle sort indicators and enlarge donut charts.
14
- - Draw coordinate controls with a grid, arrow axes, dashed projections and a labeled draggable point. Keep keyboard and numeric input alternatives.
15
- - Let quiz inputs fill their container and vertically center quiz content.
16
-
17
- ### Fixed
18
-
19
- - Render LaTeX at the document body size, with black/white ink and non-overlapping piecewise conditions.
20
- - Preserve source editor scroll after toolbar insertion and keep date inputs within narrow layouts.
21
-
22
- ## 0.4.0 (2026-10-24, next channel)
23
-
24
- `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.
25
-
26
- ### Fixed
27
-
28
- - Keep the Playground toolbar on one row in compact desktop layouts with wider system fonts.
29
- - Align source highlighting with the editor scroll position on first opening and give the source pane more vertical space.
30
-
31
- ### Added
32
-
33
- - Add source highlighting, completion, binding navigation, rename and formatting APIs, with corresponding Playground author tools.
34
- - Add dependency-aware rendering with browser equivalence checks for updates, resets, visual selections and locale changes.
35
- - 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.
36
- - Add advisory cross-field `<validation>` rules with associated accessible hints and `runtime.validate()`. `alert` and `badge` accept conditional values from their existing tone enums.
37
- - 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.
38
-
39
- - 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.
40
- - 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.
41
-
42
- - 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).
43
- - 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.
44
-
45
- - 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.
46
- - 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).
47
-
48
- - 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).
49
- - 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).
50
- - 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.
51
- - 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.
52
- - 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.
53
-
54
- ### local-draft-2 components
55
-
56
- - Add document jumps/anchors, text/section color, multiple selection, interval and coordinate inputs, practice questions and guided steps.
57
- - Add checked-item strike-through, component accent colors and stable shared table/chart selection.
58
- - Extend runtime get/set with optional slots and add atomic setMany. New slot bindings are exclusive.
59
- - 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.
60
-
61
- - 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.
62
- - `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.
63
- - `timeline` accepts either the English columns `Task`, `Start`, `Duration` and optional `Notes` or the Chinese columns `事项`, `开始`, `时长` and optional `说明`.
64
-
65
- ## 0.3.1 (2026-10-23)
66
-
67
- Compatibility update that keeps the `local-draft-1` syntax; existing documents need no migration.
68
-
69
- - 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.
70
- - Large documents use background compilation, input coalescing and deferred storage; the syntax node budget can be configured through `limits.maxSyntaxNodes`.
71
- - Unified the document theme and the heading/body hierarchy for components; improved diagram wrapping for long labels, edge captions and fallback styles.
72
- - 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.
73
- - 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.
74
- - 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.
75
- - 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.
76
- - Footnote references and definitions keep their source text and produce a diagnostic that footnote layout is not yet supported.
77
-
78
- ## 0.3.0 (2026-10-22)
79
-
80
- 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.
81
-
82
- ### Added
83
-
84
- - `local-draft-1` local interaction syntax: Markdown prose, 33 component names, `bind` parameters and `{{ expression }}` interpolation.
85
- - Parameter controls, panel reset, conditional content, tabs, accordions, alerts, checklists, progress and timers.
86
- - Enhanced tables, five chart types, LaTeX function curves, timelines and interactive diagrams.
87
- - Core entry `reactive-md`: `compileLocal`, `createLocalRuntime`, `compileExpression`, `compileLatex`, `samplePlot` and `LOCAL_SYNTAX_VERSION`.
88
- - React entry `reactive-md/react`: `LocalReactiveDocument`, `LocalDocumentView`, with host URL policy support.
89
- - Global style entry `reactive-md/styles.css`, with light and `data-theme="dark"` theme variables.
90
- - A beginner guide, the complete syntax specification, integration notes, version and compatibility notes, and 12 local examples (1 is an intentional diagnostics example).
91
- - 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.
92
- - Copyable standalone Node/React integration examples, machine-readable language conformance data, performance benchmarks and a third-party license inventory.
93
- - CI checks on Node 22.12/24 and Chromium pass; private vulnerability reporting is enabled.
94
-
95
- ### Compatibility
96
-
97
- - First preview; there is no published npm version to upgrade from.
98
- - 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.
99
- - Persist the original `.reactive.md` source; do not persist `LocalDocument`, node IDs or runtime state.
100
- - 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.
101
-
102
- ### Known limitations
103
-
104
- - ESM only; the React entry requires React 19; the core entry does not depend on React.
105
- - Node.js 22.12+ is the minimum for development and Node-side consumption.
106
- - Microsoft Edge (Chromium-based) has completed local browser verification; Firefox, Safari/WebKit and SSR hydration are unverified.
107
- - No state persistence, plugin system, arbitrary HTML, network services, Vue support, React 18 support or CommonJS entry.
108
-
109
- ### Security
110
-
111
- - Expressions and LaTeX use closed evaluators and do not execute scripts or arbitrary HTML.
112
- - Images are not loaded by default; links and images pass protocol checks first, and hosts can tighten or allow them with `urlPolicy`.
113
- - Documents, values, diagnostics and plotting computations all have resource limits. See the [security policy](SECURITY.md) for the security boundary and host responsibilities.
1
+ # Changelog
2
+
3
+ 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
+
5
+ ## 0.5.0 (2026-10-25, next channel)
6
+
7
+ 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).
8
+
9
+ ### Added
10
+
11
+ - 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.
12
+ - Support attribute-free `<b>`, `<i>`, `<u>`, `<s>`, `<mark>` and `<br>` formatting.
13
+ - Render Markdown footnotes with rich definitions, numbering, repeated references and return links.
14
+ - Highlight fenced code in common languages and copy its exact source with localized feedback. Approved images open in a keyboard-accessible modal viewer.
15
+
16
+ ### Fixed
17
+
18
+ - Preserve ordinary generic/comparison text and currency without misreading them as component tags or formulas.
19
+
20
+ ## 0.4.1 (2026-10-25)
21
+
22
+ 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).
23
+
24
+ ### Changed
25
+
26
+ - Refine light/dark document surfaces, visual hierarchy, muted chart colors and control transitions.
27
+ - Use rounded fields and buttons, custom slider tracks and circular selection controls. Slider `color` now colors the track.
28
+ - Balance full-width table columns, show triangle sort indicators and enlarge donut charts.
29
+ - Draw coordinate controls with a grid, arrow axes, dashed projections and a labeled draggable point. Keep keyboard and numeric input alternatives.
30
+ - Let quiz inputs fill their container and vertically center quiz content.
31
+
32
+ ### Fixed
33
+
34
+ - Render LaTeX at the document body size, with black/white ink and non-overlapping piecewise conditions.
35
+ - Preserve source editor scroll after toolbar insertion and keep date inputs within narrow layouts.
36
+
37
+ ## 0.4.0 (2026-10-24, next channel)
38
+
39
+ `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.
40
+
41
+ ### Fixed
42
+
43
+ - Keep the Playground toolbar on one row in compact desktop layouts with wider system fonts.
44
+ - Align source highlighting with the editor scroll position on first opening and give the source pane more vertical space.
45
+
46
+ ### Added
47
+
48
+ - Add source highlighting, completion, binding navigation, rename and formatting APIs, with corresponding Playground author tools.
49
+ - Add dependency-aware rendering with browser equivalence checks for updates, resets, visual selections and locale changes.
50
+ - 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.
51
+ - Add advisory cross-field `<validation>` rules with associated accessible hints and `runtime.validate()`. `alert` and `badge` accept conditional values from their existing tone enums.
52
+ - 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.
53
+
54
+ - 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.
55
+ - 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.
56
+
57
+ - 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).
58
+ - 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.
59
+
60
+ - 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.
61
+ - 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).
62
+
63
+ - 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).
64
+ - 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).
65
+ - 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.
66
+ - 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.
67
+ - 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.
68
+
69
+ ### local-draft-2 components
70
+
71
+ - Add document jumps/anchors, text/section color, multiple selection, interval and coordinate inputs, practice questions and guided steps.
72
+ - Add checked-item strike-through, component accent colors and stable shared table/chart selection.
73
+ - Extend runtime get/set with optional slots and add atomic setMany. New slot bindings are exclusive.
74
+ - 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.
75
+
76
+ - 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.
77
+ - `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.
78
+ - `timeline` accepts either the English columns `Task`, `Start`, `Duration` and optional `Notes` or the Chinese columns `事项`, `开始`, `时长` and optional `说明`.
79
+
80
+ ## 0.3.1 (2026-10-23)
81
+
82
+ Compatibility update that keeps the `local-draft-1` syntax; existing documents need no migration.
83
+
84
+ - 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.
85
+ - Large documents use background compilation, input coalescing and deferred storage; the syntax node budget can be configured through `limits.maxSyntaxNodes`.
86
+ - Unified the document theme and the heading/body hierarchy for components; improved diagram wrapping for long labels, edge captions and fallback styles.
87
+ - 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.
88
+ - 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.
89
+ - 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.
90
+ - 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.
91
+ - Footnote references and definitions keep their source text and produce a diagnostic that footnote layout is not yet supported.
92
+
93
+ ## 0.3.0 (2026-10-22)
94
+
95
+ 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.
96
+
97
+ ### Added
98
+
99
+ - `local-draft-1` local interaction syntax: Markdown prose, 33 component names, `bind` parameters and `{{ expression }}` interpolation.
100
+ - Parameter controls, panel reset, conditional content, tabs, accordions, alerts, checklists, progress and timers.
101
+ - Enhanced tables, five chart types, LaTeX function curves, timelines and interactive diagrams.
102
+ - Core entry `reactive-md`: `compileLocal`, `createLocalRuntime`, `compileExpression`, `compileLatex`, `samplePlot` and `LOCAL_SYNTAX_VERSION`.
103
+ - React entry `reactive-md/react`: `LocalReactiveDocument`, `LocalDocumentView`, with host URL policy support.
104
+ - Global style entry `reactive-md/styles.css`, with light and `data-theme="dark"` theme variables.
105
+ - A beginner guide, the complete syntax specification, integration notes, version and compatibility notes, and 12 local examples (1 is an intentional diagnostics example).
106
+ - 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.
107
+ - Copyable standalone Node/React integration examples, machine-readable language conformance data, performance benchmarks and a third-party license inventory.
108
+ - CI checks on Node 22.12/24 and Chromium pass; private vulnerability reporting is enabled.
109
+
110
+ ### Compatibility
111
+
112
+ - First preview; there is no published npm version to upgrade from.
113
+ - 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.
114
+ - Persist the original `.reactive.md` source; do not persist `LocalDocument`, node IDs or runtime state.
115
+ - 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.
116
+
117
+ ### Known limitations
118
+
119
+ - ESM only; the React entry requires React 19; the core entry does not depend on React.
120
+ - Node.js 22.12+ is the minimum for development and Node-side consumption.
121
+ - Microsoft Edge (Chromium-based) has completed local browser verification; Firefox, Safari/WebKit and SSR hydration are unverified.
122
+ - No state persistence, plugin system, arbitrary HTML, network services, Vue support, React 18 support or CommonJS entry.
123
+
124
+ ### Security
125
+
126
+ - Expressions and LaTeX use closed evaluators and do not execute scripts or arbitrary HTML.
127
+ - Images are not loaded by default; links and images pass protocol checks first, and hosts can tighten or allow them with `urlPolicy`.
128
+ - Documents, values, diagnostics and plotting computations all have resource limits. See the [security policy](SECURITY.md) for the security boundary and host responsibilities.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 yaozitao
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yaozitao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.