reactive-md 0.3.1 → 0.4.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.
- package/CHANGELOG-ch.md +96 -0
- package/CHANGELOG.md +82 -39
- package/CONTRIBUTING-ch.md +62 -0
- package/CONTRIBUTING.md +64 -65
- package/README-ch.md +122 -0
- package/README-en.md +146 -0
- package/README.md +146 -89
- package/SECURITY-ch.md +80 -0
- package/SECURITY.md +58 -49
- package/THIRD_PARTY_NOTICES.md +85 -1
- package/bin/reactive-md.mjs +40 -0
- package/cli/args.mjs +181 -0
- package/cli/assets.mjs +390 -0
- package/cli/build.mjs +268 -0
- package/cli/document.mjs +130 -0
- package/cli/errors.mjs +61 -0
- package/cli/fs-utils.mjs +133 -0
- package/cli/glob.mjs +203 -0
- package/cli/help.mjs +138 -0
- package/cli/lint.mjs +177 -0
- package/cli/main.mjs +55 -0
- package/cli/migrate.mjs +368 -0
- package/cli/package.mjs +209 -0
- package/dist-library/reactive-md-react.js +3425 -1647
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1798 -4
- package/dist-library/runtime-DtjdPXxJ.js +15410 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/LocalDocumentView.d.ts +66 -3
- package/dist-library/types/local/authoring.d.ts +63 -0
- package/dist-library/types/local/collection-functions.d.ts +4 -0
- package/dist-library/types/local/colors.d.ts +2 -0
- package/dist-library/types/local/computations.d.ts +53 -0
- package/dist-library/types/local/data-functions.d.ts +22 -0
- package/dist-library/types/local/data-table.d.ts +65 -0
- package/dist-library/types/local/dates.d.ts +2 -0
- package/dist-library/types/local/dependencies.d.ts +31 -0
- package/dist-library/types/local/diagnostics.d.ts +1450 -0
- package/dist-library/types/local/expression.d.ts +13 -3
- package/dist-library/types/local/formatting.d.ts +41 -0
- package/dist-library/types/local/heading-anchors.d.ts +13 -2
- package/dist-library/types/local/i18n.d.ts +18 -0
- package/dist-library/types/local/index.d.ts +18 -1
- package/dist-library/types/local/limits.d.ts +32 -1
- package/dist-library/types/local/locale.d.ts +1 -0
- package/dist-library/types/local/math.d.ts +6 -1
- package/dist-library/types/local/parser.d.ts +10 -4
- package/dist-library/types/local/render-types.d.ts +5 -1
- package/dist-library/types/local/retention.d.ts +23 -0
- package/dist-library/types/local/schema.d.ts +25 -3
- package/dist-library/types/local/source-migration.d.ts +35 -0
- package/dist-library/types/local/state.d.ts +80 -0
- package/dist-library/types/local/text-length.d.ts +13 -0
- package/dist-library/types/local/theme.d.ts +30 -0
- package/dist-library/types/local/types.d.ts +112 -4
- package/dist-library/types/local/validation.d.ts +32 -0
- package/dist-library/types/local/version.d.ts +1 -1
- package/dist-library/types/local/worker.d.ts +82 -0
- package/dist-library/types/react/index.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +64 -0
- package/dist-standalone/reactive-md-standalone.css +2 -0
- package/dist-standalone/reactive-md-standalone.js +57 -0
- package/docs/author-tools-ch.md +56 -0
- package/docs/author-tools-en.md +56 -0
- package/docs/compatibility-ch.md +103 -0
- package/docs/compatibility-en.md +103 -0
- package/docs/{component-development.md → component-development-ch.md} +210 -206
- package/docs/component-development-en.md +210 -0
- package/docs/{component-protocol.md → component-protocol-ch.md} +710 -685
- package/docs/component-protocol-en.md +710 -0
- package/docs/computations-formatting-ch.md +87 -0
- package/docs/computations-formatting-en.md +87 -0
- package/docs/constraints-collections-ch.md +84 -0
- package/docs/constraints-collections-en.md +84 -0
- package/docs/diagnostics-counting-ch.md +84 -0
- package/docs/diagnostics-counting-en.md +84 -0
- package/docs/local-components-v2-ch.md +138 -0
- package/docs/local-components-v2-en.md +104 -0
- package/docs/{local-guide.md → local-guide-ch.md} +28 -8
- package/docs/local-guide-en.md +961 -0
- package/docs/local-integration-ch.md +363 -0
- package/docs/local-integration-en.md +363 -0
- package/docs/{local-interaction-syntax.md → local-interaction-syntax-ch.md} +66 -20
- package/docs/local-interaction-syntax-en.md +483 -0
- package/docs/{performance.md → performance-ch.md} +12 -3
- package/docs/performance-en.md +76 -0
- package/docs/release-0.4.0-ch.md +89 -0
- package/docs/release-0.4.0-en.md +89 -0
- package/docs/releasing-ch.md +101 -0
- package/docs/releasing-en.md +101 -0
- package/docs/shareable-export-ch.md +205 -0
- package/docs/shareable-export-en.md +207 -0
- package/docs/source-versioning-ch.md +159 -0
- package/docs/source-versioning-en.md +159 -0
- package/docs/theme-protocol-ch.md +107 -0
- package/docs/theme-protocol-en.md +107 -0
- package/examples/conformance/README.md +33 -31
- package/examples/conformance/component-protocol-1.json +482 -194
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/history/v0.3.1/catalog.reactive.md +20 -0
- package/examples/conformance/history/v0.3.1/charts.reactive.md +73 -0
- package/examples/conformance/history/v0.3.1/checklist.reactive.md +32 -0
- package/examples/conformance/history/v0.3.1/comparison.reactive.md +47 -0
- package/examples/conformance/history/v0.3.1/components.reactive.md +44 -0
- package/examples/conformance/history/v0.3.1/counter.reactive.md +7 -0
- package/examples/conformance/history/v0.3.1/diagnostics.reactive.md +54 -0
- package/examples/conformance/history/v0.3.1/diagram.reactive.md +44 -0
- package/examples/conformance/history/v0.3.1/gallery.reactive.md +61 -0
- package/examples/conformance/history/v0.3.1/local-draft-1.json +50 -0
- package/examples/conformance/history/v0.3.1/parameters.reactive.md +36 -0
- package/examples/conformance/history/v0.3.1/planning.reactive.md +24 -0
- package/examples/conformance/history/v0.3.1/pricing.reactive.md +20 -0
- package/examples/conformance/history/v0.3.1/provenance.json +72 -0
- package/examples/conformance/local-draft-2.json +212 -0
- package/examples/integration/README.md +45 -29
- package/examples/integration/core/index.mjs +32 -19
- package/examples/integration/react/index.html +1 -1
- package/examples/integration/react/main.jsx +5 -5
- package/examples/integration/worker/index.html +19 -0
- package/examples/integration/worker/main.js +61 -0
- package/examples/integration/worker/package.json +13 -0
- package/examples/integration/worker/worker.js +3 -0
- package/examples/local/README.md +64 -58
- package/examples/local/catalog.reactive.md +14 -14
- package/examples/local/charts.reactive.md +34 -34
- package/examples/local/checklist.reactive.md +19 -19
- package/examples/local/comparison.reactive.md +23 -23
- package/examples/local/components.reactive.md +20 -20
- package/examples/local/counter.reactive.md +4 -4
- package/examples/local/diagnostics.reactive.md +25 -25
- package/examples/local/diagram.reactive.md +20 -20
- package/examples/local/gallery.reactive.md +31 -31
- package/examples/local/parameters.reactive.md +19 -19
- package/examples/local/planning.reactive.md +15 -15
- package/examples/local/pricing.reactive.md +10 -10
- package/examples/local/recipes/invoice-zh.reactive.md +36 -0
- package/examples/local/recipes/invoice.reactive.md +36 -0
- package/examples/local/recipes/workshop-zh.reactive.md +33 -0
- package/examples/local/recipes/workshop.reactive.md +33 -0
- package/examples/local/showcase/README.md +25 -0
- package/examples/local/showcase/explore.reactive.md +102 -0
- package/examples/local/showcase/flow.reactive.md +86 -0
- package/examples/local/showcase/forms.reactive.md +126 -0
- package/examples/local/showcase/functions.reactive.md +119 -0
- package/examples/local/showcase/layout.reactive.md +100 -0
- package/examples/local/showcase/statistics.reactive.md +108 -0
- package/examples/local/showcase/tasks.reactive.md +89 -0
- package/examples/local/showcase/zh/explore.reactive.md +102 -0
- package/examples/local/showcase/zh/flow.reactive.md +86 -0
- package/examples/local/showcase/zh/forms.reactive.md +126 -0
- package/examples/local/showcase/zh/functions.reactive.md +119 -0
- package/examples/local/showcase/zh/layout.reactive.md +100 -0
- package/examples/local/showcase/zh/statistics.reactive.md +108 -0
- package/examples/local/showcase/zh/tasks.reactive.md +89 -0
- package/examples/local/zh/catalog.reactive.md +20 -0
- package/examples/local/zh/charts.reactive.md +73 -0
- package/examples/local/zh/checklist.reactive.md +32 -0
- package/examples/local/zh/comparison.reactive.md +47 -0
- package/examples/local/zh/components.reactive.md +44 -0
- package/examples/local/zh/counter.reactive.md +7 -0
- package/examples/local/zh/diagnostics.reactive.md +54 -0
- package/examples/local/zh/diagram.reactive.md +44 -0
- package/examples/local/zh/gallery.reactive.md +61 -0
- package/examples/local/zh/parameters.reactive.md +36 -0
- package/examples/local/zh/planning.reactive.md +24 -0
- package/examples/local/zh/pricing.reactive.md +20 -0
- package/package.json +16 -3
- package/README.en.md +0 -76
- package/dist-library/runtime-CPzMEMcW.js +0 -11111
- package/docs/compatibility.md +0 -68
- package/docs/local-integration.md +0 -218
- package/docs/releasing.md +0 -92
package/CHANGELOG-ch.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# 变更记录
|
|
2
|
+
|
|
3
|
+
本文件记录用户可见变更。项目处于 0.x 预览阶段,版本与迁移规则见[版本与兼容性](docs/compatibility-ch.md)。
|
|
4
|
+
|
|
5
|
+
## 0.4.0(2026-10-24,next 渠道)
|
|
6
|
+
|
|
7
|
+
`0.4.0` 是发布在 `next` 分发渠道的预览版,语法修订为 `local-draft-2`,从 `0.3.1` / `local-draft-1` 升级;包版本、语法修订、`component-protocol-1` 组块协议和 `reactive-md-theme-1` 主题协议是彼此独立的版本轴。`0.3.1` 仍为 `latest` 版本。完整升级清单见[0.4.0 发布与迁移](docs/release-0.4.0-ch.md)。
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
- 紧凑桌面布局使用较宽系统字体时,Playground 工具栏保持单行。
|
|
12
|
+
- 首次打开源码时同步高亮层与编辑器的滚动位置,并增加源码区的可用高度。
|
|
13
|
+
|
|
14
|
+
### 新增
|
|
15
|
+
|
|
16
|
+
- 新增源码高亮、补全、绑定导航、重命名和格式化 API,以及对应的 Playground 作者工具。
|
|
17
|
+
- 新增按依赖更新的渲染优化,浏览器等价检查覆盖参数更新、重置、可视化选择和语言切换。
|
|
18
|
+
- 新增 `npm run verify:release` 与对应 CI 分片,覆盖组合文档和仓库外的真实 tarball 消费;保留经过验证的安装包、SHA256 与 npm integrity 记录。
|
|
19
|
+
- 新增跨字段 `<validation>` 规则、关联的可访问提示及 `runtime.validate()`;`alert` 和 `badge` 支持按条件选择现有 `tone` 枚举。
|
|
20
|
+
- 新增同类型字符串/数字数组字面量、数组索引、`sum`、`average`、`minOf`、`maxOf`,以及带稳定行键和数量预算的 `<data-table>`/`<column>`。见[条件、校验与本地集合](docs/constraints-collections-ch.md)。`LocalValueKind` 增加 `number-array`,新增聚合函数名成为保留字。
|
|
21
|
+
|
|
22
|
+
- 新增不可见、只读的 `<computed>` 与 `<const>` 声明,支持依赖排序、类型推断、循环检测和各运行时独立的计算缓存。正文、条件、公式与图表可共享中间结果。
|
|
23
|
+
- 新增数字、百分比、科学计数法与货币格式化,常用字符串函数及 UTC 日期比较、日期差。默认值、舍入、空值和地区规则见[复用计算与格式化数值](docs/computations-formatting-ch.md)。新函数名成为保留字;升级到本版本前需重命名同名旧绑定。
|
|
24
|
+
|
|
25
|
+
- 新增可选的 `<!-- reactive-md: local-draft-2 -->` 源码修订指令。显式旧修订、未知、格式错误、重复或位置错误的声明会以 `local.version.*` 诊断拒绝,不创建运行时;无指令源码保持当前修订行为。早于该指令的读者会忽略它。见[源码修订与迁移](docs/source-versioning-ch.md)。
|
|
26
|
+
- 新增 `inspectLocalSourceVersion`、`checkLocalUpgrade`、`migrateLocalSource`,以及带 `--from`、`--check`、`--json`、`-o/--output`、`--accept-semantic-changes` 和 `--locale` 的 `reactive-md migrate`。迁移只改指令,保留正文原始字节、BOM 和 CRLF,幂等;阻止保留绑定、新增可识别标签、编译错误和文本长度语义变化,且从不改写状态文件。
|
|
27
|
+
|
|
28
|
+
- 增加统一的中英文诊断模板,同一 minor 系列内保持现有诊断码含义稳定。Playground、React 渲染器与 `lint --locale en|zh` 按语言显示诊断,保留机器字段。
|
|
29
|
+
- 文本控件长度约束改为按 Unicode 码点计数,与字符串 `len()` 一致;源码定位和资源预算继续使用 UTF-16。原先因 emoji 占用两个代码单元而被拒绝的值,现在可满足对应码点上限。详见[诊断与计数规则](docs/diagnostics-counting-ch.md)。
|
|
30
|
+
|
|
31
|
+
- 增加文档开头的 `<theme name="…">` 声明、宿主主题登记和 `reactive-md-theme-1` 主题协议。两个 React 组件支持独立深浅模式和系统偏好;现有外观保留为 `default`。见[主题协议](docs/theme-protocol-ch.md)。
|
|
32
|
+
- 新增可分享单文件 HTML 导出:`reactive-md build`/`lint` CLI、交互与静态模式、静态首屏水合、可打印的当前值、版本化 `reactive-md-state/v1` 状态文件、经过校验的本地位图内联、standalone `ReactiveMD.mount`/`mountAll` IIFE 和 `<reactive-md-doc>`。见[可分享文档与静态导出](docs/shareable-export-ch.md)。
|
|
33
|
+
- 新增宿主状态 API:`LocalRuntime` 可按名称访问公开参数(`parameterNames`、`getParameter`、`getParameters`、`setParameter`、`setParameters`),并提供 `exportLocalState`/`importLocalState` 读写 `reactive-md-state/v1` 状态文件。写入先统一校验再一次性提交,失败时不改变状态。
|
|
34
|
+
- 新增源码变更时的参数保留工具:`planLocalStateRetention` 和 `applyLocalStateRetention` 仅保留类型与初始定义未变、绑定可安全保留的公开参数;匿名 `@` 绑定、计时器和位置清单会被丢弃,被拒绝的值会记录原因。
|
|
35
|
+
- 新增可选的后台编译适配器:`LocalCompileScheduler` 提供 150 ms 防抖、一个进行中任务加最新源码、永久回退到主线程 `compileLocal`,并新增 `startLocalCompileWorker`;回退失败使用 `local.worker.compile` 诊断码。
|
|
36
|
+
|
|
37
|
+
### local-draft-2 组块
|
|
38
|
+
|
|
39
|
+
- 新增文档跳转与锚点、正文颜色、多选、区间与二维坐标输入、练习题及分步阅读。
|
|
40
|
+
- 清单勾选后划线,新增组件主色及表格/图表稳定标识的共享选择。
|
|
41
|
+
- runtime.get/set 支持可选槽位,新增原子 setMany;新增槽位绑定为独占。
|
|
42
|
+
- 新增双语功能馆及编辑器插入模板。见[迁移说明](docs/local-components-v2-ch.md)。预览版发布在 `next` 渠道。
|
|
43
|
+
|
|
44
|
+
- Playground 新增中英文切换,界面、示例、指南和内置控件文案会同步切换,选择保存在浏览器中。
|
|
45
|
+
- `LocalDocumentView` 和 `LocalReactiveDocument` 支持 `locale: 'en' | 'zh'`(默认 `'en'`),用于内置 UI 文案。显示用编译与运行时诊断通过中英文共享目录本地化,回调仍收到带稳定机器字段的结构化诊断。
|
|
46
|
+
- `timeline` 同时接受英文列 `Task`、`Start`、`Duration`(可选 `Notes`)和中文列 `事项`、`开始`、`时长`(可选 `说明`)。
|
|
47
|
+
|
|
48
|
+
## 0.3.1(2026-10-23)
|
|
49
|
+
|
|
50
|
+
兼容更新,继续采用 `local-draft-1` 语法,无需迁移现有文档。
|
|
51
|
+
|
|
52
|
+
- Playground 新增 Markdown 编辑工具栏和 25 个原生组件插入模板,支持格式状态、撤销/重做、搜索、键盘导航及手机紧凑布局。
|
|
53
|
+
- 大文档采用后台编译、输入合并和延迟存储;支持通过 `limits.maxSyntaxNodes` 配置语法节点预算。
|
|
54
|
+
- 统一文档主题、组块标题与正文层级,改进图解长标签换行、连线说明和回退样式。
|
|
55
|
+
- 增加 `component-protocol-1` 组块贡献协议、开发提案模板、JSON Schema 和代表性验收用例,提供 `npm run test:components`;本次协议不改变 `local-draft-1` 语法或运行时 API。
|
|
56
|
+
- Markdown 标题生成实例独立的锚点,文档内目录链接支持中文、格式化标题和重复标题;交互更新后锚点保持稳定。
|
|
57
|
+
- Playground 默认保留当前编辑会话中兼容的具名参数,支持关闭保留;临时编译错误修复后恢复试算值,重新运行、恢复示例、切换示例和导入文档时重置。
|
|
58
|
+
- 结构完整的未知标签保留为源码并给出警告,其他正文和交互继续工作;降级区域内的标签与插值不执行。
|
|
59
|
+
- 脚注引用与定义保留原文,并给出尚未支持脚注排版的诊断。
|
|
60
|
+
|
|
61
|
+
## 0.3.0(2026-10-22)
|
|
62
|
+
|
|
63
|
+
首个公开预览版,语法修订为 `local-draft-1`。安装:`npm install reactive-md@0.3.0`。集成步骤见 [README](README-ch.md)。
|
|
64
|
+
|
|
65
|
+
### 新增
|
|
66
|
+
|
|
67
|
+
- `local-draft-1` 本地交互语法:Markdown 正文、33 个组件名、`bind` 参数和 `{{ 表达式 }}` 插值。
|
|
68
|
+
- 参数控件、面板重置、条件内容、标签页、折叠、提示、清单、进度和计时器。
|
|
69
|
+
- 增强表格、五类统计图、LaTeX 函数曲线、时间轴和交互图解。
|
|
70
|
+
- 核心入口 `reactive-md`:`compileLocal`、`createLocalRuntime`、`compileExpression`、`compileLatex`、`samplePlot` 和 `LOCAL_SYNTAX_VERSION`。
|
|
71
|
+
- React 入口 `reactive-md/react`:`LocalReactiveDocument`、`LocalDocumentView`,支持宿主 URL 策略。
|
|
72
|
+
- 全局样式入口 `reactive-md/styles.css`,包含浅色与 `data-theme="dark"` 主题变量。
|
|
73
|
+
- 中文新用户指南、完整语法规范、集成说明、版本与兼容性说明,以及 12 份本地示例(其中 1 份是故意报错的诊断示例)。
|
|
74
|
+
- 文档、示例、打包入口、浏览器交互和资源上限的检查;仓库外离线安装、纯核心与 React 的严格类型检查、静态 SSR 验证。
|
|
75
|
+
- 可复制的独立 Node/React 接入示例、机器可读的语言验收数据、性能基准和第三方许可证清单。
|
|
76
|
+
- Node 22.12/24 与 Chromium 的 CI 检查通过;私密漏洞报告已启用。
|
|
77
|
+
|
|
78
|
+
### 兼容性
|
|
79
|
+
|
|
80
|
+
- 首次预览,没有已发布的 npm 版本可供升级。
|
|
81
|
+
- 旧版 directive、YAML `state`/`data`/`computed`/`actions` 和事件属性不属于 `local-draft-1`;迁移方式见[版本与兼容性](docs/compatibility-ch.md)。
|
|
82
|
+
- 持久化原始 `.reactive.md` 源码,不持久化 `LocalDocument`、节点 ID 或运行时状态。
|
|
83
|
+
- 诊断的 `line`、`column` 和 `range` 可用于程序定位;`code` 在 0.x 中不承诺跨版本稳定;`message` 是显示文本,不保证稳定。
|
|
84
|
+
|
|
85
|
+
### 已知限制
|
|
86
|
+
|
|
87
|
+
- 只提供 ESM;React 入口要求 React 19;核心入口不依赖 React。
|
|
88
|
+
- Node.js 22.12+ 是开发和 Node 端消费的最低版本。
|
|
89
|
+
- Microsoft Edge(Chromium 内核)已完成本地浏览器验证;Firefox、Safari/WebKit 和 SSR 水合未验证。
|
|
90
|
+
- 不提供状态持久化、插件系统、任意 HTML、网络服务、Vue 支持、React 18 支持或 CommonJS 入口。
|
|
91
|
+
|
|
92
|
+
### 安全
|
|
93
|
+
|
|
94
|
+
- 表达式和 LaTeX 使用封闭求值器,不执行脚本或任意 HTML。
|
|
95
|
+
- 图片默认不加载;链接和图片先经过协议检查,宿主可用 `urlPolicy` 收紧或放行。
|
|
96
|
+
- 文档、值、诊断和绘图计算都有资源上限。安全边界与宿主责任见[安全策略](SECURITY-ch.md)。
|
package/CHANGELOG.md
CHANGED
|
@@ -1,53 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
## 0.
|
|
5
|
+
## 0.4.0 (2026-10-24, next channel)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`0.4.0` is a preview release published on the `next` distribution channel. 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. `0.3.1` remains the `latest` release. See [0.4.0 release and migration](docs/release-0.4.0-en.md) for the complete upgrade checklist.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- 大文档采用后台编译、输入合并和延迟存储;支持通过 `limits.maxSyntaxNodes` 配置语法节点预算。
|
|
11
|
-
- 统一文档主题、组块标题与正文层级,改进图解长标签换行、连线说明和回退样式。
|
|
12
|
-
- 增加 `component-protocol-1` 组块贡献协议、开发提案模板、JSON Schema 和代表性验收用例,提供 `npm run test:components`;本次协议不改变 `local-draft-1` 语法或运行时 API。
|
|
13
|
-
- Markdown 标题生成实例独立的锚点,文档内目录链接支持中文、格式化标题和重复标题;交互更新后锚点保持稳定。
|
|
14
|
-
- Playground 默认保留当前编辑会话中兼容的具名参数,支持关闭保留;临时编译错误修复后恢复试算值,重新运行、恢复示例、切换示例和导入文档时重置。
|
|
15
|
-
- 结构完整的未知标签保留为源码并给出警告,其他正文和交互继续工作;降级区域内的标签与插值不执行。
|
|
16
|
-
- 脚注引用与定义保留原文,并给出尚未支持脚注排版的诊断。
|
|
9
|
+
### Fixed
|
|
17
10
|
|
|
18
|
-
|
|
11
|
+
- Keep the Playground toolbar on one row in compact desktop layouts with wider system fonts.
|
|
12
|
+
- Align source highlighting with the editor scroll position on first opening and give the source pane more vertical space.
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
### Added
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
- Add source highlighting, completion, binding navigation, rename and formatting APIs, with corresponding Playground author tools.
|
|
17
|
+
- Add dependency-aware rendering with browser equivalence checks for updates, resets, visual selections and locale changes.
|
|
18
|
+
- 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.
|
|
19
|
+
- Add advisory cross-field `<validation>` rules with associated accessible hints and `runtime.validate()`. `alert` and `badge` accept conditional values from their existing tone enums.
|
|
20
|
+
- 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.
|
|
23
21
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- 增强表格、五类统计图、LaTeX 函数曲线、时间轴和交互图解。
|
|
27
|
-
- 核心入口 `reactive-md`:`compileLocal`、`createLocalRuntime`、`compileExpression`、`compileLatex`、`samplePlot` 和 `LOCAL_SYNTAX_VERSION`。
|
|
28
|
-
- React 入口 `reactive-md/react`:`LocalReactiveDocument`、`LocalDocumentView`,支持宿主 URL 策略。
|
|
29
|
-
- 全局样式入口 `reactive-md/styles.css`,包含浅色与 `data-theme="dark"` 主题变量。
|
|
30
|
-
- 中文新用户指南、完整语法规范、集成说明、版本与兼容性说明,以及 12 份本地示例(其中 1 份是故意报错的诊断示例)。
|
|
31
|
-
- 文档、示例、打包入口、浏览器交互和资源上限的检查;仓库外离线安装、纯核心与 React 的严格类型检查、静态 SSR 验证。
|
|
32
|
-
- 可复制的独立 Node/React 接入示例、机器可读的语言验收数据、性能基准和第三方许可证清单。
|
|
33
|
-
- Node 22.12/24 与 Chromium 的 CI 检查通过;私密漏洞报告已启用。
|
|
22
|
+
- 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.
|
|
23
|
+
- 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.
|
|
34
24
|
|
|
35
|
-
|
|
25
|
+
- 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).
|
|
26
|
+
- 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.
|
|
36
27
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
- 持久化原始 `.reactive.md` 源码,不持久化 `LocalDocument`、节点 ID 或运行时状态。
|
|
40
|
-
- 诊断的 `line`、`column` 和 `range` 可用于程序定位;`code` 在 0.x 中不承诺跨版本稳定;`message` 是显示文本,不保证稳定。
|
|
28
|
+
- 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.
|
|
29
|
+
- 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).
|
|
41
30
|
|
|
42
|
-
|
|
31
|
+
- 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).
|
|
32
|
+
- 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).
|
|
33
|
+
- 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.
|
|
34
|
+
- 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.
|
|
35
|
+
- 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.
|
|
43
36
|
|
|
44
|
-
-
|
|
45
|
-
- Node.js 22.12+ 是开发和 Node 端消费的最低版本。
|
|
46
|
-
- Microsoft Edge(Chromium 内核)已完成本地浏览器验证;Firefox、Safari/WebKit 和 SSR 水合未验证。
|
|
47
|
-
- 不提供状态持久化、插件系统、任意 HTML、网络服务、Vue 支持、React 18 支持或 CommonJS 入口。
|
|
37
|
+
### local-draft-2 components
|
|
48
38
|
|
|
49
|
-
|
|
39
|
+
- Add document jumps/anchors, text/section color, multiple selection, interval and coordinate inputs, practice questions and guided steps.
|
|
40
|
+
- Add checked-item strike-through, component accent colors and stable shared table/chart selection.
|
|
41
|
+
- Extend runtime get/set with optional slots and add atomic setMany. New slot bindings are exclusive.
|
|
42
|
+
- 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.
|
|
50
43
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
44
|
+
- 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.
|
|
45
|
+
- `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.
|
|
46
|
+
- `timeline` accepts either the English columns `Task`, `Start`, `Duration` and optional `Notes` or the Chinese columns `事项`, `开始`, `时长` and optional `说明`.
|
|
47
|
+
|
|
48
|
+
## 0.3.1 (2026-10-23)
|
|
49
|
+
|
|
50
|
+
Compatibility update that keeps the `local-draft-1` syntax; existing documents need no migration.
|
|
51
|
+
|
|
52
|
+
- 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.
|
|
53
|
+
- Large documents use background compilation, input coalescing and deferred storage; the syntax node budget can be configured through `limits.maxSyntaxNodes`.
|
|
54
|
+
- Unified the document theme and the heading/body hierarchy for components; improved diagram wrapping for long labels, edge captions and fallback styles.
|
|
55
|
+
- 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.
|
|
56
|
+
- 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.
|
|
57
|
+
- 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.
|
|
58
|
+
- 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.
|
|
59
|
+
- Footnote references and definitions keep their source text and produce a diagnostic that footnote layout is not yet supported.
|
|
60
|
+
|
|
61
|
+
## 0.3.0 (2026-10-22)
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- `local-draft-1` local interaction syntax: Markdown prose, 33 component names, `bind` parameters and `{{ expression }}` interpolation.
|
|
68
|
+
- Parameter controls, panel reset, conditional content, tabs, accordions, alerts, checklists, progress and timers.
|
|
69
|
+
- Enhanced tables, five chart types, LaTeX function curves, timelines and interactive diagrams.
|
|
70
|
+
- Core entry `reactive-md`: `compileLocal`, `createLocalRuntime`, `compileExpression`, `compileLatex`, `samplePlot` and `LOCAL_SYNTAX_VERSION`.
|
|
71
|
+
- React entry `reactive-md/react`: `LocalReactiveDocument`, `LocalDocumentView`, with host URL policy support.
|
|
72
|
+
- Global style entry `reactive-md/styles.css`, with light and `data-theme="dark"` theme variables.
|
|
73
|
+
- A beginner guide, the complete syntax specification, integration notes, version and compatibility notes, and 12 local examples (1 is an intentional diagnostics example).
|
|
74
|
+
- 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.
|
|
75
|
+
- Copyable standalone Node/React integration examples, machine-readable language conformance data, performance benchmarks and a third-party license inventory.
|
|
76
|
+
- CI checks on Node 22.12/24 and Chromium pass; private vulnerability reporting is enabled.
|
|
77
|
+
|
|
78
|
+
### Compatibility
|
|
79
|
+
|
|
80
|
+
- First preview; there is no published npm version to upgrade from.
|
|
81
|
+
- 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.
|
|
82
|
+
- Persist the original `.reactive.md` source; do not persist `LocalDocument`, node IDs or runtime state.
|
|
83
|
+
- 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.
|
|
84
|
+
|
|
85
|
+
### Known limitations
|
|
86
|
+
|
|
87
|
+
- ESM only; the React entry requires React 19; the core entry does not depend on React.
|
|
88
|
+
- Node.js 22.12+ is the minimum for development and Node-side consumption.
|
|
89
|
+
- Microsoft Edge (Chromium-based) has completed local browser verification; Firefox, Safari/WebKit and SSR hydration are unverified.
|
|
90
|
+
- No state persistence, plugin system, arbitrary HTML, network services, Vue support, React 18 support or CommonJS entry.
|
|
91
|
+
|
|
92
|
+
### Security
|
|
93
|
+
|
|
94
|
+
- Expressions and LaTeX use closed evaluators and do not execute scripts or arbitrary HTML.
|
|
95
|
+
- Images are not loaded by default; links and images pass protocol checks first, and hosts can tighten or allow them with `urlPolicy`.
|
|
96
|
+
- Documents, values, diagnostics and plotting computations all have resource limits. See the [security policy](SECURITY.md) for the security boundary and host responsibilities.
|
|
@@ -0,0 +1,62 @@
|
|
|
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 凭据。
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,65 +1,64 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Reactive MD
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
- Node.js 22.12
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
npm ci
|
|
17
|
-
npm run
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
npm run build
|
|
23
|
-
npm
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
| `npm run
|
|
29
|
-
| `npm
|
|
30
|
-
| `npm run
|
|
31
|
-
| `npm run test:
|
|
32
|
-
| `npm run test:
|
|
33
|
-
| `npm run
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
- 发布是维护者的手工流程,见[发布清单](docs/releasing.md)。贡献者不需要接触 npm 凭据。
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Reactive MD is a 0.x preview implementation of `local-draft-2`. Contributions can cover syntax, the compiler, the runtime, the React renderer, documentation, examples and the demo. Before starting, read [Versions and compatibility](docs/compatibility-en.md) and the [local interaction syntax specification](docs/local-interaction-syntax-en.md).
|
|
4
|
+
|
|
5
|
+
When adding or changing a component, define its behavior according to the [component protocol](docs/component-protocol-en.md), and use the [proposal template in the development guide](docs/component-development-en.md) to record declarations, compatibility and acceptance evidence. Components here include input controls, containers, visualizations and structural children.
|
|
6
|
+
|
|
7
|
+
## Environment
|
|
8
|
+
|
|
9
|
+
- Node.js 22.12 or newer.
|
|
10
|
+
- The repository uses npm workspaces; run `npm ci` from the root.
|
|
11
|
+
- Do not commit `node_modules/`, `dist-library/`, `demo/dist/`, `demo/artifacts/` or `.tasks/`.
|
|
12
|
+
|
|
13
|
+
## Development and checks
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm ci
|
|
17
|
+
npm run verify:release
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
| Command | What it covers |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `npm run build` | Type checking and the language package build |
|
|
23
|
+
| `npm test` | Compiler, expression, LaTeX, runtime and renderer tests |
|
|
24
|
+
| `npm run lint -- <file>` | Author diagnostics for one or more documents; requires a prior build |
|
|
25
|
+
| `npm run test:diagnostics --workspace=@reactive-md/demo` | Browser checks for diagnostic localization, source jumps and Unicode text constraints; requires a running demo |
|
|
26
|
+
| `npm run test:components` | Representative cases for the component protocol and existing language acceptance data; new components still need their own targeted tests |
|
|
27
|
+
| `npm run test:package` | Public entries, example compilation and style boundaries; requires a prior build |
|
|
28
|
+
| `npm run test:packed` | Standalone offline install of the real tarball, strict type checking for core and React, CSS exports and static SSR |
|
|
29
|
+
| `npm run notices` | Generate the third-party license inventory from installed dependencies |
|
|
30
|
+
| `npm run benchmark` | Node compile, runtime and plotting performance; the report is written to `artifacts/benchmark.json` |
|
|
31
|
+
| `npm run test:docs` | Documentation relative links and heading anchors |
|
|
32
|
+
| `npm run build:demo`, `npm run test:demo` | Demo build and example index |
|
|
33
|
+
| `npm run verify:release` | Complete release gate: core and demo tests, types, notices, package and documentation checks, packed consumption outside the repository, and browser checks for calculations, collections, authoring, state restoration, HTML export and rendering equivalence. It manages the preview server lifecycle |
|
|
34
|
+
|
|
35
|
+
CI uses `npm run verify:release:node` and `npm run verify:release:browser` to split the same gate. Reports and step logs go to `artifacts/release-verification.json` and `artifacts/release-verification/`; the exact verified tarball and its SHA256 record go to `artifacts/release-package/`. A local browser must already be installed; the gate does not install one.
|
|
36
|
+
|
|
37
|
+
Browser checks require the demo to be running and a local browser available. The complete gate manages those dependencies itself; when running individual browser scripts, the default address is `http://127.0.0.1:5173` and `DEMO_URL` can point at another address. Reports are written to `demo/artifacts/`. Local runs use Edge by default; CI uses Playwright Chromium on Linux (`PLAYWRIGHT_CHANNEL=chromium`).
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm run dev
|
|
41
|
+
# another terminal
|
|
42
|
+
npm run test:browser
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
After changing the language package, rerun `npm run build:lib`, or use `npm run dev:lib` to watch and rebuild.
|
|
46
|
+
|
|
47
|
+
Performance measurement conditions and current baselines are in [Performance measurements](docs/performance-en.md); reusable inputs and expected results across implementations are in the [language conformance data](examples/conformance/README.md).
|
|
48
|
+
|
|
49
|
+
## Change requirements
|
|
50
|
+
|
|
51
|
+
- Keep changes focused. Add tests for behavior changes; update documentation and relevant examples for user-visible changes.
|
|
52
|
+
- For breaking changes to syntax or the public API, first update [Versions and compatibility](docs/compatibility-en.md) and the [changelog](CHANGELOG.md), describing the old form, the new form and the migration path. Do not silently change author syntax without a syntax revision.
|
|
53
|
+
- New components or attributes must implement compile validation, runtime constraints, rendering, accessible names and resource boundaries together. Do not add display styling only.
|
|
54
|
+
- A component proposal must state attribute and child-content declarations, state and lifecycle rules, diagnostics, resource budgets, compatibility classification and corresponding acceptance results; see the [protocol acceptance data](examples/conformance/README.md) for `slider`, `tabs` and `plot`. A protocol revision does not automatically change the package version, syntax revision or public API.
|
|
55
|
+
- Resource limits are centralized in `src/local/limits.ts`; when adding unbounded input, loops, recursion or plotting computation, define a budget first.
|
|
56
|
+
- Do not introduce network requests, arbitrary HTML, event handlers, author CSS or persisted state. These are out of the current scope.
|
|
57
|
+
- Keep terminology consistent with the existing documentation; keep the English README concise and do not repeat engineering details.
|
|
58
|
+
- Do not commit credentials, `.npmrc` tokens or personal paths. Do not edit `dist-library/` by hand; it is generated by the build.
|
|
59
|
+
|
|
60
|
+
## Commits and pull requests
|
|
61
|
+
|
|
62
|
+
- Describe the purpose, affected scope, verification commands and results in the PR. State any checks you did not run explicitly instead of presenting them as passed.
|
|
63
|
+
- Do not open a public issue for security matters; follow the [security policy](SECURITY.md).
|
|
64
|
+
- Releases are a manual maintainer process; see the [release checklist](docs/releasing-en.md). Contributors do not need npm credentials.
|
package/README-ch.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Reactive MD
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
用 Markdown 写本地交互文档。放入输入控件,用 `bind` 命名参数,用 `{{ 表达式 }}` 连接文字、公式、图表和图解。文档作者无需编写 JavaScript 或 CSS。
|
|
6
|
+
|
|
7
|
+
本地模式采用 HTML 风格标签,参数和表格数据直接写在正文中,LaTeX 公式可用于函数绘图。TypeScript 核心和 React 渲染器可独立集成。`0.4.0` 是发布在 `next` 渠道的预览版,语法修订为 `local-draft-2`。
|
|
8
|
+
|
|
9
|
+
## 从这里开始
|
|
10
|
+
|
|
11
|
+
- [新用户入门指南](docs/local-guide-ch.md):从 Markdown 过渡到交互文档,含完整练习与错误速查。
|
|
12
|
+
- [本地交互语法规范](docs/local-interaction-syntax-ch.md) · [功能演示与示例](examples/local/README.md):48 个标签名、标签、就地参数与 LaTeX 绘图。
|
|
13
|
+
- [本地模式集成](docs/local-integration-ch.md):`compileLocal`、状态运行时、React 嵌入、URL 策略与样式作用域。
|
|
14
|
+
- [可分享文档与静态导出](docs/shareable-export-ch.md):单文件交互 HTML、静态输出、版本化状态文件、图片资源、CLI 与独立浏览器 API。
|
|
15
|
+
- [主题协议](docs/theme-protocol-ch.md):文档主题选择、自定义 CSS 与深浅模式。
|
|
16
|
+
- [作者工具](docs/author-tools-ch.md):源码高亮、补全、绑定定位、重命名、格式化与命令行检查。
|
|
17
|
+
- [独立接入示例](examples/integration/README.md):可复制到仓库外运行的 Node 核心和 React 页面。
|
|
18
|
+
- [版本与兼容性](docs/compatibility-ch.md):0.x 规则、迁移、诊断契约和平台范围。
|
|
19
|
+
- [组块协议](docs/component-protocol-ch.md) · [组块开发指南](docs/component-development-ch.md):新增组件的声明、行为契约和兼容性验收。
|
|
20
|
+
- [0.4.0 发布与迁移](docs/release-0.4.0-ch.md):本次发布包含的能力,以及从 `0.3.1` / `local-draft-1` 升级的方法。
|
|
21
|
+
|
|
22
|
+
## 写一份文档
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
<panel title="费用估算">
|
|
26
|
+
<slider bind="people" label="人数" initial="2" min="1" max="20">
|
|
27
|
+
<toggle bind="annual" label="年度付款">
|
|
28
|
+
</panel>
|
|
29
|
+
|
|
30
|
+
每月费用:**{{ people * (annual ? 80 : 100) }} 元**。
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
输入立即更新结果,面板自带“恢复默认”。独立使用的计数器只需一行 `<counter label="人数">`。
|
|
34
|
+
|
|
35
|
+
`0.4.0` 新增 `local-draft-2`、命名计算、校验、集合、主题和离线 HTML 导出;仍为 `latest` 的 0.3.1 使用 `local-draft-1`。见[0.4.0 发布与迁移](docs/release-0.4.0-ch.md)。
|
|
36
|
+
|
|
37
|
+
## 安装
|
|
38
|
+
|
|
39
|
+
需要 Node.js 22.12 或更新版本,包提供 ESM 入口:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
npm install reactive-md@next
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`next` 渠道当前指向 `0.4.0`;需要固定版本时使用 `npm install reactive-md@0.4.0`。`latest` 标签仍为 `0.3.1`,使用 `local-draft-1`,从 `0.3.x` 升级无需迁移。
|
|
46
|
+
|
|
47
|
+
`reactive-md` 入口提供本地编译器、表达式和运行时,`reactive-md/react` 提供 React 渲染器。组件样式通过 `reactive-md/styles.css` 引入。
|
|
48
|
+
|
|
49
|
+
React 入口需要 React 19:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npm install react@19 react-dom@19
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
57
|
+
import 'reactive-md/styles.css';
|
|
58
|
+
|
|
59
|
+
export function Article({ source }: { source: string }) {
|
|
60
|
+
return <LocalReactiveDocument source={source} />;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`reactive-md` 核心入口不依赖 React。完整的编译与运行时 API、宿主 URL 策略、生命周期和样式覆盖见[本地模式集成](docs/local-integration-ch.md)。
|
|
65
|
+
|
|
66
|
+
0.x 次版本可能包含破坏性变更。升级前阅读[变更记录](CHANGELOG-ch.md)与[兼容规则](docs/compatibility-ch.md),并保存原始 `.reactive.md` 源码。
|
|
67
|
+
|
|
68
|
+
## 分享文档
|
|
69
|
+
|
|
70
|
+
构建读者可以离线打开的单个 HTML 文件,或不含脚本的静态快照:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
npm run build
|
|
74
|
+
npx reactive-md build examples/local/counter.reactive.md -o counter.html
|
|
75
|
+
npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
交互文件内嵌原始源码、React 19、运行时、样式以及经过校验的本地图片。它先渲染静态首屏,因此禁用 JavaScript 时仍可阅读。使用 `--state-file doc.state.json` 导出已保存的 `reactive-md-state/v1` 基线;省略时使用作者初值,并把它作为读者的重置基线。Demo 导出对话框可以把当前预览参数保存成此类状态文件。
|
|
79
|
+
|
|
80
|
+
图片上限、CSP/安全、打印、退出码、`ReactiveMD.mount`/`mountAll` 与 `<reactive-md-doc>` 见[可分享文档与静态导出](docs/shareable-export-ch.md)。单文件导出的静态首屏水合由 Playwright Chromium 和本地 Edge 检查覆盖;Firefox、Safari/WebKit 与通用 SSR 水合仍未验证。
|
|
81
|
+
|
|
82
|
+
## 体验 Demo
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
npm ci
|
|
86
|
+
npm run dev
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
该命令先构建语言包,再启动独立的 `demo/` 应用,地址为 `http://127.0.0.1:5173`。`/embed.html` 展示嵌入方式。页面顶部的语言按钮可以在中文和英文之间切换,选择会保存在浏览器中。Demo 的页面、编辑器、演示服务、资产和浏览器检查均在 `demo/`,通过语言包的公开入口集成。
|
|
90
|
+
|
|
91
|
+
## 仓库结构
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
src/ 本地语法编译、表达式、运行时和 React 渲染器
|
|
95
|
+
examples/ 可复制的本地交互示例,与 demo 应用无关
|
|
96
|
+
docs/ 本地语法规范、集成与发布文档
|
|
97
|
+
tests/ 语言与渲染器测试
|
|
98
|
+
demo/ 独立的 Playground 应用
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 文档
|
|
102
|
+
|
|
103
|
+
- [新用户入门指南](docs/local-guide-ch.md)与[本地交互语法规范](docs/local-interaction-syntax-ch.md)。
|
|
104
|
+
- [本地模式集成](docs/local-integration-ch.md):核心与 React API、URL 策略、生命周期、样式和版本固定。
|
|
105
|
+
- [可分享文档与静态导出](docs/shareable-export-ch.md):CLI build/lint、状态文件、本地图片内联、打印与独立浏览器运行时。
|
|
106
|
+
- [功能演示与示例](examples/local/README.md)与[独立接入示例](examples/integration/README.md)。
|
|
107
|
+
- [版本与兼容性](docs/compatibility-ch.md)与[0.4.0 发布与迁移](docs/release-0.4.0-ch.md)。
|
|
108
|
+
- [组块协议](docs/component-protocol-ch.md)与[组块开发指南](docs/component-development-ch.md)。
|
|
109
|
+
- [性能说明](docs/performance-ch.md)与[发布清单](docs/releasing-ch.md)。
|
|
110
|
+
|
|
111
|
+
更多开发与测试命令见[贡献指南](CONTRIBUTING-ch.md)。
|
|
112
|
+
|
|
113
|
+
## 贡献与安全
|
|
114
|
+
|
|
115
|
+
- [贡献指南](CONTRIBUTING-ch.md):环境、检查命令和改动要求。
|
|
116
|
+
- [安全策略](SECURITY-ch.md):威胁边界、资源上限、宿主责任和漏洞报告渠道。
|
|
117
|
+
- [变更记录](CHANGELOG-ch.md)。
|
|
118
|
+
- [发布清单](docs/releasing-ch.md):验证门禁、notice、tarball 和人工发布流程。
|
|
119
|
+
|
|
120
|
+
## 许可证
|
|
121
|
+
|
|
122
|
+
[MIT](LICENSE)
|