reactive-md 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +13 -0
- package/CHANGELOG.md +13 -0
- package/README-ch.md +6 -6
- package/README-en.md +6 -6
- package/README.md +6 -6
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/build.mjs +1 -0
- package/cli/init.mjs +1 -1
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
- package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
- package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
- package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
- package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
- package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
- package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
- package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
- package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +16 -18
- package/dist-library/reactive-md-build.js +51 -51
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +2 -2
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +2 -2
- package/dist-library/reactive-md-plugin-gallery.js +2 -2
- package/dist-library/reactive-md-plugin-navigation.js +2 -2
- package/dist-library/reactive-md-plugin-network.js +117 -115
- package/dist-library/reactive-md-plugin-plot.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +10 -11
- package/dist-library/reactive-md-react.js +10 -11
- package/dist-library/reactive-md-sdk.js +3 -3
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +4 -4
- package/dist-library/reactive-md.js +280 -193
- package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
- package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
- package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
- package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +27 -4
- package/dist-library/types/local/types.d.ts +52 -16
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +2 -1
- package/docs/README.md +2 -1
- package/docs/compatibility/compatibility-ch.md +6 -6
- package/docs/compatibility/compatibility-en.md +6 -6
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +2 -2
- package/docs/development/component-development-reference-en.md +2 -2
- package/docs/development/component-protocol-ch.md +2 -2
- package/docs/development/component-protocol-en.md +2 -2
- package/docs/development/extension-tutorial-ch.md +3 -3
- package/docs/development/extension-tutorial-en.md +3 -3
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/compiler-ch.md +3 -1
- package/docs/integration/compiler-en.md +3 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +2 -2
- package/docs/integration/extension-sdk-en.md +2 -2
- package/docs/integration/local-integration-ch.md +130 -8
- package/docs/integration/local-integration-en.md +130 -8
- package/docs/integration/shareable-export-ch.md +4 -2
- package/docs/integration/shareable-export-en.md +4 -2
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/public-api-ch.md +10 -7
- package/docs/reference/public-api-en.md +10 -7
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/game-2048-package/README-ch.md +1 -1
- package/examples/game-2048-package/README.md +1 -1
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/minimal-extension/README-ch.md +3 -3
- package/examples/minimal-extension/README.md +3 -3
- package/examples/tetris-package/README-ch.md +1 -1
- package/examples/tetris-package/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,60 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HTML compatibility and author capabilities
|
|
2
2
|
|
|
3
3
|
**English** · [中文](html-compatibility-ch.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This feature targets the next release. Documents use Markdown, ReactiveMD controls and expressions by default, with the P0 HTML subset below. Host applications can enable author CSS, JavaScript and extended HTML separately. All three options default to `false`.
|
|
8
|
-
|
|
9
|
-
## Temporary routing policy
|
|
10
|
-
|
|
11
|
-
This release routes whole documents to avoid mixed parsing and rendering conflicts between author CSS, JavaScript, extended HTML and ReactiveMD.
|
|
12
|
-
|
|
13
|
-
| Compile options | Document behavior |
|
|
14
|
-
| --- | --- |
|
|
15
|
-
| All three options omitted or `false` | ReactiveMD parsing and the existing React renderer, including P0 HTML |
|
|
16
|
-
| Any option `true` | Native HTML for the entire source, rendered in an isolated iframe |
|
|
17
|
-
|
|
18
|
-
In native HTML mode, `# headings`, `**emphasis**`, LaTeX and `{{ expressions }}` remain ordinary text. Elements such as `input` and `table` use HTML semantics. ReactiveMD components establish no bindings. Turning all options off recompiles the document in the default mode. This is a transitional policy for this release; mixed compatibility can be evaluated later.
|
|
19
|
-
|
|
20
|
-
Options are host capabilities. Source tags and parameter state files cannot grant them. The demo displays the active mode and resets all three capabilities when the page reloads.
|
|
21
|
-
|
|
22
|
-
## Options and API
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { compileLocal } from 'reactive-md';
|
|
26
|
-
|
|
27
|
-
// Markdown, ReactiveMD and P0 HTML.
|
|
28
|
-
const reactive = compileLocal(source);
|
|
29
|
-
|
|
30
|
-
// Native HTML for the entire source; author CSS is enabled.
|
|
31
|
-
const html = compileLocal(source, {
|
|
32
|
-
enableCss: true,
|
|
33
|
-
enableJavaScript: false,
|
|
34
|
-
enableExtendedHtml: false,
|
|
35
|
-
});
|
|
36
|
-
```
|
|
5
|
+
ReactiveMD documents mix Markdown, RMD components, expressions and basic HTML. The host controls author capabilities independently.
|
|
37
6
|
|
|
38
7
|
| Option | Default | Capability |
|
|
39
8
|
| --- | --- | --- |
|
|
40
|
-
| `enableCss` | `
|
|
41
|
-
| `enableJavaScript` | `false` | Author scripts
|
|
42
|
-
| `enableExtendedHtml` | `false` |
|
|
9
|
+
| `enableCss` | `true` | Document styles, component declarations and styles in granted HTML fragments |
|
|
10
|
+
| `enableJavaScript` | `false` | Author scripts in interactive mounts |
|
|
11
|
+
| `enableExtendedHtml` | `false` | Additional native HTML fragments |
|
|
43
12
|
|
|
44
|
-
|
|
13
|
+
Give a source view its grants through `LocalReactiveDocument.compileOptions`. Give a precompiled view its own grants through `LocalDocumentView.capabilityGrants`. A direct mount defaults to CSS on, JavaScript off and extended HTML off. Effective permission requires both compilation and mount permission. Changing only these capabilities preserves the source view's runtime state.
|
|
45
14
|
|
|
46
|
-
|
|
15
|
+
### Styles
|
|
47
16
|
|
|
48
|
-
|
|
17
|
+
Place paired `<css>` blocks before the body. Multiple blocks cascade in source order. A component's `css` attribute applies declarations to its visible root. Document selectors stop at nested document roots. Ordinary inheritance still applies when the host nests documents. External author stylesheets and CSS resource loads are outside the inline style policy. A late style block or a declaration on a node without a visible root produces a source diagnostic. A registered component named `css` or `javascript` keeps its tag. A component schema's own `css` property keeps its original meaning.
|
|
49
18
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
19
|
+
### Scripts
|
|
20
|
+
|
|
21
|
+
Place code in a paired `<javascript>` block. After an interactive mount restores its state, an isolated worker initializes the blocks in source order. Each block has its own lexical scope. Use `await rmd.get(name)`, `await rmd.set(name, value)` and `await rmd.setMany(values)` to operate on named bindings. Writes follow the component's existing validation and read-only rules.
|
|
22
|
+
|
|
23
|
+
The counter exposes `increment`, `decrement` and `reset`. Give a counter an `action-id` and register `rmd.handleAction(id, "increment", callback)` to take over that action on that instance. `rmd.observeAction` observes an action without changing its default handler. Revocation, script replacement and unmount end the session. Static HTML, PDF and the static phase of hydration use the supplied RMD state.
|
|
56
24
|
|
|
57
|
-
|
|
25
|
+
Set `LocalDocumentView.authorScriptPaused` to pause author actions and binding requests while an asynchronous preview recompiles. When the script is unchanged, resume the existing session. Restoring a counter's `action-id` restores its registration within that session.
|
|
58
26
|
|
|
59
27
|
## P0 HTML in the default mode
|
|
60
28
|
|
|
@@ -116,25 +84,12 @@ Native HTML fragments that cannot compile are displayed as their original text,
|
|
|
116
84
|
|
|
117
85
|
In the native HTML route, an unsupported attribute makes its element fall back to source while neighboring elements continue to render. If whole-document parsing, serialization or compilation budget checks fail, React previews and standalone mounts display the complete source with preserved line breaks and escaped tags. Error results from `compileLocal`, resource limits and `onDiagnostics` reports are retained. Invalid host options and ReactiveMD component syntax errors keep their existing behavior.
|
|
118
86
|
|
|
119
|
-
## Extended HTML
|
|
120
|
-
|
|
121
|
-
`enableExtendedHtml` controls the following author syntax:
|
|
122
|
-
|
|
123
|
-
- Definition lists: `dl`, `dt`, `dd`.
|
|
124
|
-
- Additional text semantics: `small`, `kbd`, `samp`, `var`, `abbr`, `q`, `cite`, `ins`.
|
|
125
|
-
- Figures and structure: `figure`, `figcaption`, `article`, `section`, `aside`, `header`, `footer`, `ruby`, `rt`, `rp`, `wbr`.
|
|
126
|
-
- Native forms, `iframe`, `object`, `embed`, `dialog`, arbitrary SVG/MathML and whole-page HTML features.
|
|
127
|
-
|
|
128
|
-
In the default mode, `table` distinguishes native and ReactiveMD syntax by its body; existing components such as `section`, `input` and `select` retain their current meanings. In native HTML mode, these names use browser semantics.
|
|
129
|
-
|
|
130
|
-
## Isolation and export
|
|
131
|
-
|
|
132
|
-
Author HTML runs inside a sandboxed iframe without `allow-same-origin`. Whole-page structure, styles and scripts apply to this isolated document. CSP and sandbox restrictions still govern resources, form submission and navigation. Extended HTML does not grant unrestricted network access.
|
|
87
|
+
## Extended HTML and export
|
|
133
88
|
|
|
134
|
-
|
|
89
|
+
Registered components take precedence. For example, `<input bind="name">` remains an RMD input, and `details` keeps Markdown and expressions in its body. Sanitized definition lists and other inert structures render in the document. Embeds, fragment scripts and styles run inside a sandbox. Denied fragments appear as source at their original positions.
|
|
135
90
|
|
|
136
|
-
|
|
91
|
+
Use sanitized `srcdoc` for self-contained embeds. Grant exact remote HTTPS origins with the mount's `allowedFrameOrigins` option. Fragment styles and scripts require their respective grants. The sandbox governs navigation, forms and parent document access.
|
|
137
92
|
|
|
138
|
-
|
|
93
|
+
New interactive exports record `sourceSemantics: "mixed-rmd-v1"`, the capability flags and the chosen state baseline. Old v1/v2 files without the field retain their original interpretation, including whole-document HTML where a capability was enabled. The envelope version continues to distinguish restoration contracts.
|
|
139
94
|
|
|
140
|
-
See [integration](../integration/local-integration-en.md), [shareable export](../integration/shareable-export-en.md) and [security](../../SECURITY.md).
|
|
95
|
+
See [local integration](../integration/local-integration-en.md), [shareable export](../integration/shareable-export-en.md) and the [security policy](../../SECURITY.md).
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
| 包 | 版本 | 职责 |
|
|
10
10
|
| --- | --- | --- |
|
|
11
|
-
| `reactive-md` | `0.
|
|
12
|
-
| `reactive-md-editor` | `0.
|
|
11
|
+
| `reactive-md` | `0.9.1` | 编译器、运行时、作者服务、SDK、React 与 SSR 渲染、导出、构建适配 |
|
|
12
|
+
| `reactive-md-editor` | `0.2.0` | CodeMirror 6 源码编辑器、工具栏、编辑器侧导航 |
|
|
13
13
|
| `reactive-md-demo` | 私有 | 站点、示例与部署,不提供对外接口 |
|
|
14
14
|
|
|
15
15
|
引擎只提供 ESM 入口,Node 侧要求 Node.js 22.12 或更新版本。React 19 与 Vite 8 都是可选 peer,各自只服务一部分入口。
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
| 入口 | 类型 | 需要 React | 仅 Node | 一句话用途 |
|
|
20
20
|
| --- | --- | --- | --- | --- |
|
|
21
|
-
| `reactive-md` | ESM | 否 | 否 |
|
|
21
|
+
| `reactive-md` | ESM | 否 | 否 | 完整核心面:单次与流式编译、增量会话、运行时、状态、Worker、可分享 HTML |
|
|
22
22
|
| `reactive-md/compiler` | ESM | 否 | 否 | 单次语义编译,不带默认预设 |
|
|
23
23
|
| `reactive-md/compiler/standard` | ESM | 否 | 否 | 单次编译,带 GFM、原生 HTML、KaTeX 与默认预设 |
|
|
24
24
|
| `reactive-md/react` | ESM | 是 | 否 | React 文档渲染器与组件开发接口 |
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
| --- | --- |
|
|
65
65
|
| 单次编译 | `compileLocal`、`LocalCompileResult`、`LocalCompileOptions` |
|
|
66
66
|
| 增量编辑 | `createLocalCompileSession`、`LocalCompileSession`、`LocalIncrementalStats` |
|
|
67
|
+
| 流式源码 | `LocalSourcePhase`、`LocalCompileStatus`;会话与调度器的阶段参数 |
|
|
67
68
|
| 运行时 | `createLocalRuntime`、`updateLocalRuntime`、`notifyLocalRuntime`、`LocalRuntime`、`LocalSnapshot` |
|
|
68
69
|
| 表达式与数学 | `compileExpression`、`LocalExpressionError`、`compileLatex`、`compilePlotFormula`、`plotFormulaKind`、`implicitGridSize`、`samplePlot`、`sampleImplicit`、`sampleParametric`、`samplePolar` |
|
|
69
70
|
| 诊断 | `formatLocalDiagnostic`、`LOCAL_DIAGNOSTIC_CODES`、`isLocalDiagnosticCode`、`localDiagnosticTemplate`、`localDiagnosticTemplateKeys` |
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
| 状态保留 | `planLocalStateRetention`、`applyLocalStateRetention` |
|
|
72
73
|
| 源码版本 | `inspectLocalSourceVersion`、`checkLocalUpgrade`、`migrateLocalSource`、`LOCAL_SYNTAX_VERSION` |
|
|
73
74
|
| 作者服务(再导出) | `analyzeLocalSource`、`completeLocalSource`、`renameLocalBinding`、`formatLocalSource` |
|
|
74
|
-
| 后台编译 | `LocalCompileScheduler`、`startLocalCompileWorker`、`LOCAL_COMPILE_DELAY_MS`、`LOCAL_COMPILE_PREPARATION_DELAY_MS`、`compileFailureDiagnostic`、`localWorkerOptionsKey` |
|
|
75
|
+
| 后台编译 | `LocalCompileScheduler`、`startLocalCompileWorker`、`LOCAL_COMPILE_DELAY_MS`、`LOCAL_COMPILE_PREPARATION_DELAY_MS`、`compileFailureDiagnostic`、`localWorkerOptionsKey`、`LocalCompileOutcome`、`LocalCompileRequest`、`LocalCompileResponse` |
|
|
75
76
|
| 结果补丁 | `LOCAL_RESULT_PATCH_PROTOCOL`、`diffSourceEdit`、`applySourceEdit`、`encodeLocalResultPatch`、`applyLocalResultPatch` |
|
|
76
77
|
| 主题 | `LOCAL_THEME_PROTOCOL`、`DEFAULT_LOCAL_THEME`、`resolveLocalTheme`、`isLocalThemeName` |
|
|
77
78
|
| HTML 信封 | `createShareableHtml`、`resolveLocalStateBaseline`、`SHAREABLE_HTML_FORMAT`、`SHAREABLE_HTML_FORMAT_V2`、`serializeForScript` |
|
|
@@ -79,6 +80,8 @@
|
|
|
79
80
|
|
|
80
81
|
宿主在内存中编译、运行并持久化文档时用这个入口。`compileLocal()` 是一次性完整编译器;`createLocalCompileSession()` 在连续编辑中复用未变动的 Markdown 块;`createLocalRuntime()` 持有参数、订阅与销毁。运行时本身不写存储、Cookie 或网络。
|
|
81
82
|
|
|
83
|
+
`LocalCompileOptions.sourcePhase` 把快照标记为 `streaming` 或 `final`;会话接受 `compile(source, options?, phase?)` 和 `compileShared(source, options?, phase?)`,`LocalCompileScheduler.schedule(source, options?, hint?, phase?)` 使用同一阶段,`final` 跳过防抖。显式阶段结果增加 `status`(`partial`、`valid`、`recovered`、`failed`),流式结果还可带 `transientDiagnostics`;暂态诊断不会出现在 `diagnostics` 中。Worker 的完整请求与响应在声明了阶段时回显 `sourcePhase`(请求字段或 options 对象均可);未声明阶段的旧客户端省略该字段。`LocalCompileOutcome.sourcePhase` 报告该阶段,修订号保持单调递增,流式结果永不建立补丁基线。一次性 `compileLocal` 与编译器入口仍只做最终编译。
|
|
84
|
+
|
|
82
85
|
### `reactive-md/compiler`
|
|
83
86
|
|
|
84
87
|
单次编译器,不安装任何组件预设。保留 CommonMark、ReactiveMD 结构、表达式、绑定、语义检查与资源预算。它不创建会话、Worker、定时器或缓存,也不加载 React、CSS、主题实现或预设。
|
|
@@ -112,7 +115,7 @@ const result = createCompiler().compile('# Notes\n\nPlain Markdown.');
|
|
|
112
115
|
| 适配原语 | `compileExpression`、`compileLatex`、`compilePlotFormula`、`samplePlot`、`sampleImplicit`、`sampleParametric`、`samplePolar`、`layoutDiagram`、`diagramEdgePath`、`TableSurface`、`LatexView`、各类上限与格式化函数 |
|
|
113
116
|
| 适配工具 | `useComponentView`、`useWriter`、`useDisabled`、`useResetToken`、`useSourceAttributes`、`useValidationField`、`useValidationHint`、`formatNumber`、`snapToStep` 等 `component-utils` 成员 |
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
`LocalReactiveDocument` 还接受 `sourcePhase?: 'streaming' | 'final'` 和 `onTransientDiagnostics?: (diagnostics: Diagnostic[]) => void`。流式期间以静态模式渲染并暂缓副作用,`final` 恢复宿主交互模式。见[流式源码编译](../integration/local-integration-ch.md#流式源码编译)。渲染器属性见[本地模式集成](../integration/local-integration-ch.md)。两个组件都不接受 `className`、`style` 或子元素。
|
|
116
119
|
|
|
117
120
|
### `reactive-md/react/unstyled`
|
|
118
121
|
|
|
@@ -383,7 +386,7 @@ IIFE 产物,暴露全局 `ReactiveMD`,加载时对 `application/reactive-md+
|
|
|
383
386
|
|
|
384
387
|
| 常量 | 值 | 作用范围 |
|
|
385
388
|
| --- | --- | --- |
|
|
386
|
-
| 包版本 | `0.
|
|
389
|
+
| 包版本 | `0.9.1` | 引擎发布 |
|
|
387
390
|
| SDK 契约 | `0.7.0`(`LOCAL_SDK_VERSION`) | 组件、预设与配置清单 |
|
|
388
391
|
| 语法修订 | `local-draft-3`(`LOCAL_SYNTAX_VERSION`) | 文档源码 |
|
|
389
392
|
| 状态文件 | `reactive-md-state/v1`(`LOCAL_STATE_FORMAT`) | 导出的参数 |
|
|
@@ -395,7 +398,7 @@ IIFE 产物,暴露全局 `ReactiveMD`,加载时对 `application/reactive-md+
|
|
|
395
398
|
| 构建清单 | `reactive-md-build/v1` | 独立构建产物 |
|
|
396
399
|
| 组件协议 | `reactive-md-component/v1`、`component-protocol-3` | 组件贡献 |
|
|
397
400
|
| 主题协议 | `reactive-md-theme-1` | 文档主题 |
|
|
398
|
-
| 编辑器包 | `0.
|
|
401
|
+
| 编辑器包 | `0.2.0` | 编辑器发布,peer `reactive-md: ^0.9.0` |
|
|
399
402
|
|
|
400
403
|
每个常量独立演进:一次包发布可以引入新的 HTML 信封而不动语法修订,新的主题协议也不会改变 SDK 契约。
|
|
401
404
|
|
|
@@ -8,8 +8,8 @@ Three packages exist. Each has its own version and release workflow.
|
|
|
8
8
|
|
|
9
9
|
| Package | Version | Responsibility |
|
|
10
10
|
| --- | --- | --- |
|
|
11
|
-
| `reactive-md` | `0.
|
|
12
|
-
| `reactive-md-editor` | `0.
|
|
11
|
+
| `reactive-md` | `0.9.1` | Compiler, runtime, authoring services, SDK, React and SSR rendering, export, build adapters |
|
|
12
|
+
| `reactive-md-editor` | `0.2.0` | CodeMirror 6 source editor, toolbar, editor-side navigation |
|
|
13
13
|
| `reactive-md-demo` | private | Website, examples and deployment. No public API |
|
|
14
14
|
|
|
15
15
|
The engine ships ESM only and targets Node.js 22.12 or newer in Node builds. React 19 and Vite 8 are optional peers, each used by a subset of the entries.
|
|
@@ -18,7 +18,7 @@ The engine ships ESM only and targets Node.js 22.12 or newer in Node builds. Rea
|
|
|
18
18
|
|
|
19
19
|
| Entry | Kind | React | Node-only | One-line purpose |
|
|
20
20
|
| --- | --- | --- | --- | --- |
|
|
21
|
-
| `reactive-md` | ESM | No | No | Full core surface: compile,
|
|
21
|
+
| `reactive-md` | ESM | No | No | Full core surface: one-shot and streaming compile, incremental sessions, runtime, state, Worker, shareable HTML |
|
|
22
22
|
| `reactive-md/compiler` | ESM | No | No | One-shot semantic compiler without the default preset |
|
|
23
23
|
| `reactive-md/compiler/standard` | ESM | No | No | One-shot compiler with GFM, native HTML, KaTeX and the default preset |
|
|
24
24
|
| `reactive-md/react` | ESM | Yes | No | React document renderer and component development API |
|
|
@@ -64,6 +64,7 @@ The full core surface. No React, no stylesheet, no DOM.
|
|
|
64
64
|
| --- | --- |
|
|
65
65
|
| One-shot compile | `compileLocal`, `LocalCompileResult`, `LocalCompileOptions` |
|
|
66
66
|
| Incremental editing | `createLocalCompileSession`, `LocalCompileSession`, `LocalIncrementalStats` |
|
|
67
|
+
| Streaming source | `LocalSourcePhase`, `LocalCompileStatus`; phased session and scheduler arguments |
|
|
67
68
|
| Runtime | `createLocalRuntime`, `updateLocalRuntime`, `notifyLocalRuntime`, `LocalRuntime`, `LocalSnapshot` |
|
|
68
69
|
| Expressions and math | `compileExpression`, `LocalExpressionError`, `compileLatex`, `compilePlotFormula`, `plotFormulaKind`, `implicitGridSize`, `samplePlot`, `sampleImplicit`, `sampleParametric`, `samplePolar` |
|
|
69
70
|
| Diagnostics | `formatLocalDiagnostic`, `LOCAL_DIAGNOSTIC_CODES`, `isLocalDiagnosticCode`, `localDiagnosticTemplate`, `localDiagnosticTemplateKeys` |
|
|
@@ -71,7 +72,7 @@ The full core surface. No React, no stylesheet, no DOM.
|
|
|
71
72
|
| State retention | `planLocalStateRetention`, `applyLocalStateRetention` |
|
|
72
73
|
| Source versions | `inspectLocalSourceVersion`, `checkLocalUpgrade`, `migrateLocalSource`, `LOCAL_SYNTAX_VERSION` |
|
|
73
74
|
| Authoring (re-export) | `analyzeLocalSource`, `completeLocalSource`, `renameLocalBinding`, `formatLocalSource` |
|
|
74
|
-
| Background compile | `LocalCompileScheduler`, `startLocalCompileWorker`, `LOCAL_COMPILE_DELAY_MS`, `LOCAL_COMPILE_PREPARATION_DELAY_MS`, `compileFailureDiagnostic`, `localWorkerOptionsKey` |
|
|
75
|
+
| Background compile | `LocalCompileScheduler`, `startLocalCompileWorker`, `LOCAL_COMPILE_DELAY_MS`, `LOCAL_COMPILE_PREPARATION_DELAY_MS`, `compileFailureDiagnostic`, `localWorkerOptionsKey`, `LocalCompileOutcome`, `LocalCompileRequest`, `LocalCompileResponse` |
|
|
75
76
|
| Result patches | `LOCAL_RESULT_PATCH_PROTOCOL`, `diffSourceEdit`, `applySourceEdit`, `encodeLocalResultPatch`, `applyLocalResultPatch` |
|
|
76
77
|
| Themes | `LOCAL_THEME_PROTOCOL`, `DEFAULT_LOCAL_THEME`, `resolveLocalTheme`, `isLocalThemeName` |
|
|
77
78
|
| HTML envelope | `createShareableHtml`, `resolveLocalStateBaseline`, `SHAREABLE_HTML_FORMAT`, `SHAREABLE_HTML_FORMAT_V2`, `serializeForScript` |
|
|
@@ -79,6 +80,8 @@ The full core surface. No React, no stylesheet, no DOM.
|
|
|
79
80
|
|
|
80
81
|
Use this entry when a host compiles, runs and persists documents in memory. `compileLocal()` is the one-shot full compiler; `createLocalCompileSession()` reuses unchanged Markdown blocks across edits; `createLocalRuntime()` owns parameters, subscriptions and disposal. The runtime writes no storage, cookies or network on its own.
|
|
81
82
|
|
|
83
|
+
`LocalCompileOptions.sourcePhase` marks a snapshot as `streaming` or `final`; sessions accept `compile(source, options?, phase?)` and `compileShared(source, options?, phase?)`, and `LocalCompileScheduler.schedule(source, options?, hint?, phase?)` takes the same phase, with `final` bypassing the debounce. Explicit phases add `status` (`partial`, `valid`, `recovered`, `failed`), and streaming results may add `transientDiagnostics`; transient diagnostics never appear in `diagnostics`. Worker full requests and responses echo `sourcePhase` when a phase was declared (on the request or the options object); phase-less legacy jobs omit it. `LocalCompileOutcome.sourcePhase` reports it, revisions stay monotonic, and streaming results never become patch baselines. One-shot `compileLocal` and the compiler entries remain final-only.
|
|
84
|
+
|
|
82
85
|
### `reactive-md/compiler`
|
|
83
86
|
|
|
84
87
|
A single-pass compiler with no component preset. It keeps CommonMark, ReactiveMD structure, expressions, bindings, semantic checks and budgets. It creates no session, Worker, timer or cache, and loads no React, CSS, theme implementation or preset.
|
|
@@ -112,7 +115,7 @@ Both factories validate options at creation and freeze a snapshot. Invalid confi
|
|
|
112
115
|
| Adapter primitives | `compileExpression`, `compileLatex`, `compilePlotFormula`, `samplePlot`, `sampleImplicit`, `sampleParametric`, `samplePolar`, `layoutDiagram`, `diagramEdgePath`, `TableSurface`, `LatexView`, limits and formatting helpers |
|
|
113
116
|
| Adapter utilities | `useComponentView`, `useWriter`, `useDisabled`, `useResetToken`, `useSourceAttributes`, `useValidationField`, `useValidationHint`, `formatNumber`, `snapToStep` and the other `component-utils` helpers |
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
`LocalReactiveDocument` also accepts `sourcePhase?: 'streaming' | 'final'` and `onTransientDiagnostics?: (diagnostics: Diagnostic[]) => void`. While streaming it renders in static mode and defers side effects; `final` restores the host's interaction mode. See [Streaming source compilation](../integration/local-integration-en.md#streaming-source-compilation). Neither component accepts `className`, `style` or children.
|
|
116
119
|
|
|
117
120
|
### `reactive-md/react/unstyled`
|
|
118
121
|
|
|
@@ -383,7 +386,7 @@ The DOM-free toolbar commands, re-exported from `reactive-md/authoring`, with th
|
|
|
383
386
|
|
|
384
387
|
| Constant | Value | Scope |
|
|
385
388
|
| --- | --- | --- |
|
|
386
|
-
| Package version | `0.
|
|
389
|
+
| Package version | `0.9.1` | Engine releases |
|
|
387
390
|
| SDK contract | `0.7.0` (`LOCAL_SDK_VERSION`) | Component, preset and configuration manifests |
|
|
388
391
|
| Syntax revision | `local-draft-3` (`LOCAL_SYNTAX_VERSION`) | Document source |
|
|
389
392
|
| State file | `reactive-md-state/v1` (`LOCAL_STATE_FORMAT`) | Exported parameters |
|
|
@@ -395,7 +398,7 @@ The DOM-free toolbar commands, re-exported from `reactive-md/authoring`, with th
|
|
|
395
398
|
| Build manifest | `reactive-md-build/v1` | Standalone build output |
|
|
396
399
|
| Component protocol | `reactive-md-component/v1`, `component-protocol-3` | Component contribution |
|
|
397
400
|
| Theme protocol | `reactive-md-theme-1` | Document themes |
|
|
398
|
-
| Editor package | `0.
|
|
401
|
+
| Editor package | `0.2.0` | Editor releases, peer `reactive-md: ^0.9.0` |
|
|
399
402
|
|
|
400
403
|
Each constant is versioned independently: a package release can ship a new HTML envelope without moving the syntax revision, and a new theme protocol does not change the SDK contract.
|
|
401
404
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ReactiveMD 0.9.1
|
|
2
|
+
|
|
3
|
+
[English](release-0.9.1-en.md) · **中文**
|
|
4
|
+
|
|
5
|
+
从 npm 安装 `reactive-md@0.9.1`:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install reactive-md@0.9.1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
0.9.1 补丁版本发布说明(2026-11-22)。
|
|
12
|
+
|
|
13
|
+
## 主要更新
|
|
14
|
+
|
|
15
|
+
### 流式源码编译优化
|
|
16
|
+
|
|
17
|
+
流式源码路径现在支持显式的 `streaming` 或 `final` 阶段,覆盖编译会话、`LocalCompileScheduler`、Worker 和 `LocalReactiveDocument`。未完成的区域以原文显示,可由后续源码修复的问题通过 `transientDiagnostics` 报告。确定性错误以及最终阶段的严格与恢复语义保持不变。详见[流式源码编译](../integration/local-integration-ch.md#流式源码编译)。
|
|
18
|
+
|
|
19
|
+
### `<jump>` 跳转限定在文档滚动容器内
|
|
20
|
+
|
|
21
|
+
`<jump>` 跳转只滚动文档所在的最近宿主滚动容器。嵌入页面的预览滚动自己的视口,不再带动外层页面。
|
|
22
|
+
|
|
23
|
+
### 更严格的源码阶段校验
|
|
24
|
+
|
|
25
|
+
运行时会拒绝不支持的 `sourcePhase` 值,不再回退到交互式最终渲染。
|
|
26
|
+
|
|
27
|
+
## 兼容性
|
|
28
|
+
|
|
29
|
+
本次补丁发布不改变语法、SDK、主题、组件或状态协议版本。`local-draft-3`、`component-protocol-3`、`reactive-md-theme-1`、`reactive-md-state/v1` 和 `0.7.0` SDK 契约继续有效。升级引擎包无需迁移已有文档源码和状态文件。已发布的 `reactive-md-editor@0.2.0` 仍兼容 `0.9.x` 引擎系列;编辑器侧的对应快照优化随单独的编辑器版本发布。
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ReactiveMD 0.9.1
|
|
2
|
+
|
|
3
|
+
**English** · [中文](release-0.9.1-ch.md)
|
|
4
|
+
|
|
5
|
+
Install `reactive-md@0.9.1` from npm:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install reactive-md@0.9.1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Release notes for the 0.9.1 patch release (2026-11-22).
|
|
12
|
+
|
|
13
|
+
## Highlights
|
|
14
|
+
|
|
15
|
+
### Streaming source compilation improvements
|
|
16
|
+
|
|
17
|
+
The streaming source path now accepts explicit `streaming` or `final` phases across compile sessions, `LocalCompileScheduler`, Workers and `LocalReactiveDocument`. Unfinished regions render as literal text, and fixable issues are reported through `transientDiagnostics`. Deterministic errors and the final strict and recovery semantics remain unchanged. See [Streaming source compilation](../integration/local-integration-en.md#streaming-source-compilation).
|
|
18
|
+
|
|
19
|
+
### Document-scoped jump scrolling
|
|
20
|
+
|
|
21
|
+
`<jump>` navigation is scoped to the nearest host scroll container around the rendered document. An embedded preview scrolls its own viewport instead of the outer page.
|
|
22
|
+
|
|
23
|
+
### Stricter source-phase validation
|
|
24
|
+
|
|
25
|
+
The runtime rejects unsupported `sourcePhase` values instead of falling back to interactive final rendering.
|
|
26
|
+
|
|
27
|
+
## Compatibility
|
|
28
|
+
|
|
29
|
+
No syntax, SDK, theme, component or state protocol revision changes. `local-draft-3`, `component-protocol-3`, `reactive-md-theme-1`, `reactive-md-state/v1` and the SDK contract `0.7.0` remain current. Existing document source and state files need no migration. The published `reactive-md-editor@0.2.0` remains compatible with the `0.9.x` engine series; editor-side snapshot refinements ship in a separate editor release.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
这是一个可复制的 npm 组件包,定义评分控件与 Markdown 提示容器,附带主题包和内联 SVG 资源,并用公开合规工具验证安装后的包。所有导入都来自公开的 `reactive-md` 入口。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
本模板声明 `reactive-md@^0.8.0`。把本目录复制到仓库之外,并把范围调整为要验证的发布版本。常规安装运行 `npm install` 从 registry 获取;测试尚未发布的候选版本时,改用当前源码新打包出的引擎 tarball。SDK 契约仍为 `0.7.0`。
|
|
8
8
|
|
|
9
9
|
## 公开入口
|
|
10
10
|
|
|
@@ -7,7 +7,7 @@ container, ships a package theme and an inlined SVG asset, and runs the public
|
|
|
7
7
|
compliance tools against the installed package. Every import comes from a
|
|
8
8
|
public `reactive-md` entry.
|
|
9
9
|
|
|
10
|
-
This template
|
|
10
|
+
This template declares `reactive-md@^0.8.0`. Copy this folder outside the repository and adjust the range to the release you are validating. Install from the registry with `npm install`; for an unreleased candidate, install a tarball packed from the current source instead. The SDK contract remains at `0.7.0`.
|
|
11
11
|
|
|
12
12
|
## Public entries
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ npm pack ./examples/game-2048-package --ignore-scripts
|
|
|
25
25
|
再在宿主项目中安装生成的两个 `.tgz`:
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
npm install ../ReactiveMD/reactive-md
|
|
28
|
+
npm install ../ReactiveMD/reactive-md-<version>.tgz ../ReactiveMD/reactive-md-game-2048-package-0.1.0.tgz
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
ReactiveMD、React 和 React DOM 声明为 peer dependencies,由宿主提供同一份实例。
|
|
@@ -27,7 +27,7 @@ npm pack ./examples/game-2048-package --ignore-scripts
|
|
|
27
27
|
Then install both tarballs in the host project:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
|
-
npm install ../ReactiveMD/reactive-md
|
|
30
|
+
npm install ../ReactiveMD/reactive-md-<version>.tgz ../ReactiveMD/reactive-md-game-2048-package-0.1.0.tgz
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
ReactiveMD, React and React DOM are peer dependencies supplied by the host.
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
这些目录使用包的公开入口,可以复制到仓库之外。以下命令均从当前目录开始执行。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
以下多数示例面向 `reactive-md@0.6.0`,该版本同时发布在 `latest` 和 `next` 渠道。把所需的示例目录复制到仓库之外,然后按下面的方式从 npm 安装固定版本。React 和 Vite 在需要时从示例自身的依赖安装。
|
|
8
8
|
|
|
9
|
-
[扩展 SDK 使用方](extension-sdk/README-ch.md)面向`reactive-md@0.8.0`,通过公开导出验证静态分享和离线交互分享。准备发布时使用本地构建的 tarball,SDK 契约仍为 `0.7.0
|
|
9
|
+
[扩展 SDK 使用方](extension-sdk/README-ch.md)面向`reactive-md@0.8.0`,通过公开导出验证静态分享和离线交互分享。准备发布时使用本地构建的 tarball,SDK 契约仍为 `0.7.0`。其余较早的示例保留其 0.6.0 固定版本。
|
|
10
|
+
|
|
11
|
+
[流式源码](streaming)示例使用 `reactive-md@0.9.1`,该版本已包含流式源码编译接口。按下面的说明,从本仓库打包的 tarball 运行它。
|
|
10
12
|
|
|
11
13
|
## Node 核心
|
|
12
14
|
|
|
@@ -44,6 +46,23 @@ npm run dev
|
|
|
44
46
|
|
|
45
47
|
UI 和调度连接位于 [worker/main.js](worker/main.js);Worker 入口是 [worker/worker.js](worker/worker.js)。
|
|
46
48
|
|
|
49
|
+
## 流式源码编译
|
|
50
|
+
|
|
51
|
+
[streaming](streaming) 是流式源码编译的确定性浏览器示例。它按定时器追加固定文本片段,用 `sourcePhase: 'streaming'` 提交每个完整快照,最后用 `sourcePhase: 'final'` 提交完成后的源码。页面展示暂态状态、暂态诊断、最终诊断和编译快照摘要。取消或重新开始会使当前轮次失效;旧轮次的结果只计入丢弃数量,不会重绘页面。示例不调用模型服务、不发起网络请求,也不持有凭据。
|
|
52
|
+
|
|
53
|
+
在仓库根目录打包 tarball,然后在示例中安装:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
# 在仓库根目录
|
|
57
|
+
npm pack
|
|
58
|
+
|
|
59
|
+
cd examples/integration/streaming
|
|
60
|
+
npm install ../../../reactive-md-0.9.1.tgz
|
|
61
|
+
npm run dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
如果目录已复制到仓库之外,请改用 tarball 的绝对路径安装。示例只使用 `reactive-md` 的公开入口;调度逻辑位于 [streaming/main.js](streaming/main.js),Worker 入口是 [streaming/worker.js](streaming/worker.js)。
|
|
65
|
+
|
|
47
66
|
## 综合宿主示例
|
|
48
67
|
|
|
49
68
|
[react-comprehensive](react-comprehensive) 在一个页面中组合了面向宿主的各项新增能力:宿主提供的汇率和库存、动态 `max="{{ inventory }}"`、与内置控件共享绑定的 `host-rating` 组块、通过 `initialParameters` 和 `onParametersChange` 保存与恢复公开参数,以及通过 `onSourceNavigate` 从预览导航到源码。
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
These directories use the package's public entry points and can be copied outside the repository. The commands below start from the current directory.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Most examples below target `reactive-md@0.6.0`, published on both `latest` and `next`. Copy the desired example directory outside the repository, then install the pinned version from npm as shown below. React and Vite are installed from the example's own dependencies where needed.
|
|
8
8
|
|
|
9
|
-
The [extension SDK consumer](extension-sdk/README.md) targets `reactive-md@0.8.0` and verifies static and offline interactive sharing through public exports. Release preparation uses a locally built tarball; the SDK contract remains at `0.7.0`. The older examples
|
|
9
|
+
The [extension SDK consumer](extension-sdk/README.md) targets `reactive-md@0.8.0` and verifies static and offline interactive sharing through public exports. Release preparation uses a locally built tarball; the SDK contract remains at `0.7.0`. The other older examples retain their 0.6.0 pins.
|
|
10
|
+
|
|
11
|
+
The [streaming source](streaming) example uses `reactive-md@0.9.1`, which includes the streaming-source compilation API. Run it from a tarball packed in this repository as described below.
|
|
10
12
|
|
|
11
13
|
## Node core
|
|
12
14
|
|
|
@@ -44,6 +46,23 @@ npm run dev
|
|
|
44
46
|
|
|
45
47
|
The UI and scheduler wiring live in [worker/main.js](worker/main.js); the Worker entry is [worker/worker.js](worker/worker.js).
|
|
46
48
|
|
|
49
|
+
## Streaming source compilation
|
|
50
|
+
|
|
51
|
+
[streaming](streaming) is a deterministic browser example for streaming-source compilation. It appends fixed text chunks on a timer, submits each complete snapshot with `sourcePhase: 'streaming'`, then submits the completed source with `sourcePhase: 'final'`. The page shows the provisional status, transient diagnostics, final diagnostics and a compiled snapshot summary. Cancel or restart invalidates the current run; results from an older run are counted and discarded instead of repainting the page. It uses no model service, network request or credential.
|
|
52
|
+
|
|
53
|
+
Build a tarball in the repository root, then install it in the example:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
# in the repository root
|
|
57
|
+
npm pack
|
|
58
|
+
|
|
59
|
+
cd examples/integration/streaming
|
|
60
|
+
npm install ../../../reactive-md-0.9.1.tgz
|
|
61
|
+
npm run dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If the directory was copied outside the repository, pass the tarball's absolute path to `npm install` instead. The example uses only `reactive-md` public entries; scheduling lives in [streaming/main.js](streaming/main.js) and the Worker entry is [streaming/worker.js](streaming/worker.js).
|
|
65
|
+
|
|
47
66
|
## Comprehensive host example
|
|
48
67
|
|
|
49
68
|
[react-comprehensive](react-comprehensive) combines the host-facing additions in one page: a host-provided exchange rate and inventory, dynamic `max="{{ inventory }}"`, a `host-rating` component that shares its binding with built-in controls, saved and restored public parameters through `initialParameters` and `onParametersChange`, and preview-to-source navigation through `onSourceNavigate`.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
`advanced.tsx` 增加了坐标控件、字符串集合、数字集合和 Markdown 容器。坐标、多选和卡片契约来自 `defaultPreset.components`;项目提供自己的 React 实现。其验收检查覆盖原子回滚、数组限制与复制、重置、禁用/隐藏状态、静态输出、SSR,以及离线桌面/移动端恢复。`advanced-standalone.ts` 为该项导出打包同一组已安装实现。
|
|
8
8
|
|
|
9
|
-
本 fixture
|
|
9
|
+
本 fixture 固定 `reactive-md@0.8.0`,SDK 契约仍为 `0.7.0`。验证器在独立目录中安装引擎和 peer 依赖;请把固定版本调整为要验证的发布版本,只有测试尚未发布的候选版本时才使用新打包的引擎 tarball。
|
|
10
10
|
|
|
11
11
|
在仓库根目录:
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ This fixture defines a rating control, a Markdown hint container, and a light/da
|
|
|
6
6
|
|
|
7
7
|
`advanced.tsx` adds a coordinate control, string collection, numeric collection and Markdown container. The coordinate, multi-select and card contracts come from `defaultPreset.components`; the project supplies its own React implementations. Its acceptance checks cover atomic rollback, array limits and copies, reset, disabled/hidden states, static output, SSR and offline desktop/mobile restoration. `advanced-standalone.ts` bundles the same installed implementations for that export.
|
|
8
8
|
|
|
9
|
-
This fixture
|
|
9
|
+
This fixture pins `reactive-md@0.8.0`; its SDK contract remains at `0.7.0`. The verifier installs the engine and peer dependencies in a separate directory. Raise the pin to the release being validated; use a freshly packed engine tarball only for an unreleased candidate.
|
|
10
10
|
|
|
11
11
|
From the repository root:
|
|
12
12
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Reactive MD streaming source compilation</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font: 16px/1.5 system-ui, sans-serif; margin: 2rem auto; max-width: 72ch; padding: 0 1rem; }
|
|
9
|
+
pre { background: #f4f4f5; border: 1px solid #e4e4e7; overflow: auto; padding: 0.75rem; white-space: pre-wrap; }
|
|
10
|
+
button { margin-right: 0.5rem; }
|
|
11
|
+
.muted { color: #52525b; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<main>
|
|
16
|
+
<h1>Streaming source compilation</h1>
|
|
17
|
+
<p>
|
|
18
|
+
Fixed text chunks arrive on a timer. Each complete snapshot is submitted with
|
|
19
|
+
<code>sourcePhase: "streaming"</code>; the last submission is
|
|
20
|
+
<code>sourcePhase: "final"</code>. No model service or credential is involved.
|
|
21
|
+
</p>
|
|
22
|
+
<p>
|
|
23
|
+
<button id="start" type="button">Start / restart</button>
|
|
24
|
+
<button id="cancel" type="button">Cancel generation</button>
|
|
25
|
+
</p>
|
|
26
|
+
<p class="muted">
|
|
27
|
+
Cancel invalidates the current generation. A result that arrives later is discarded
|
|
28
|
+
instead of updating this page.
|
|
29
|
+
</p>
|
|
30
|
+
<p id="status" role="status">Starting...</p>
|
|
31
|
+
|
|
32
|
+
<h2>Source submitted</h2>
|
|
33
|
+
<pre id="source"></pre>
|
|
34
|
+
|
|
35
|
+
<h2>Transient diagnostics</h2>
|
|
36
|
+
<pre id="transient">None.</pre>
|
|
37
|
+
|
|
38
|
+
<h2>Final diagnostics</h2>
|
|
39
|
+
<pre id="diagnostics">None.</pre>
|
|
40
|
+
|
|
41
|
+
<h2>Compiled snapshot</h2>
|
|
42
|
+
<pre id="preview">Waiting for the first snapshot.</pre>
|
|
43
|
+
|
|
44
|
+
<p id="stale" class="muted">0 stale results discarded.</p>
|
|
45
|
+
</main>
|
|
46
|
+
<script type="module" src="/main.js"></script>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|