reactive-md 0.6.1 → 0.8.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 (471) hide show
  1. package/CHANGELOG-ch.md +66 -0
  2. package/CHANGELOG.md +66 -0
  3. package/CONTRIBUTING-ch.md +6 -62
  4. package/CONTRIBUTING.md +5 -63
  5. package/README-ch.md +232 -67
  6. package/README-en.md +209 -71
  7. package/README.md +209 -71
  8. package/SECURITY-ch.md +3 -1
  9. package/SECURITY.md +3 -1
  10. package/THIRD_PARTY_NOTICES.md +1909 -87
  11. package/cli/args.mjs +33 -1
  12. package/cli/build.mjs +62 -1
  13. package/cli/check.mjs +444 -0
  14. package/cli/help.mjs +181 -3
  15. package/cli/init.mjs +1577 -0
  16. package/cli/main.mjs +11 -1
  17. package/cli/package-loader.mjs +41 -0
  18. package/dist-library/LocalDocumentView-6trX7xJc.js +97920 -0
  19. package/dist-library/{authoring-BEVyth5X.js → authoring-BsfSwQRm.js} +237 -209
  20. package/dist-library/compiler--ea2CKQF.js +61 -0
  21. package/dist-library/compiler-core-kPiH-gOV.js +11805 -0
  22. package/dist-library/component-state-Cq2K5gkS.js +490 -0
  23. package/dist-library/component-state-D_cw_EHe.js +54 -0
  24. package/dist-library/config-validation-DXTynAw7.js +3005 -0
  25. package/dist-library/default-components-Z_YMio5P.js +2346 -0
  26. package/dist-library/identity-MYJXKSkB.js +1443 -0
  27. package/dist-library/math-display-BJz4gbFc.js +24000 -0
  28. package/dist-library/math-sample-BGEW49zY.js +1124 -0
  29. package/dist-library/options-CX5m5n-J.js +115 -0
  30. package/dist-library/parser-standard-DlCk7sLo.js +10122 -0
  31. package/dist-library/props-DGlBk0e5.js +183 -0
  32. package/dist-library/react-ByOHunUW.js +122 -0
  33. package/dist-library/reactive-md-authoring.js +712 -1077
  34. package/dist-library/reactive-md-build.js +7966 -0
  35. package/dist-library/reactive-md-compiler-standard.js +33 -0
  36. package/dist-library/reactive-md-compiler.js +22 -0
  37. package/dist-library/reactive-md-default-packs.js +71 -0
  38. package/dist-library/reactive-md-default-preset.js +10 -0
  39. package/dist-library/reactive-md-export.js +111 -0
  40. package/dist-library/reactive-md-print.css +18 -3
  41. package/dist-library/reactive-md-react-runtime.js +251 -0
  42. package/dist-library/reactive-md-react-server.js +55 -0
  43. package/dist-library/reactive-md-react-unstyled.js +9 -1
  44. package/dist-library/reactive-md-react.js +9 -1
  45. package/dist-library/reactive-md-runtime-browser.js +51 -0
  46. package/dist-library/reactive-md-runtime.js +3 -0
  47. package/dist-library/reactive-md-sdk.js +6 -0
  48. package/dist-library/reactive-md-standalone-host.js +442 -0
  49. package/dist-library/reactive-md-testing-browser.js +523 -0
  50. package/dist-library/reactive-md-testing-react.js +221 -0
  51. package/dist-library/reactive-md-testing.js +638 -0
  52. package/dist-library/reactive-md-vite.js +959 -0
  53. package/dist-library/reactive-md.css +1 -1
  54. package/dist-library/reactive-md.js +1080 -795
  55. package/dist-library/registry-B9Jc3FVe.js +1174 -0
  56. package/dist-library/resources-BGt8mpDA.js +204 -0
  57. package/dist-library/runtime-C-sbfpOX.js +1157 -0
  58. package/dist-library/runtime-Dkq7ldyg.js +172 -0
  59. package/dist-library/schema-ZFufO8V0.js +39 -0
  60. package/dist-library/shareable-DDVL4Fi9.js +844 -0
  61. package/dist-library/types/authoring/catalog.d.ts +168 -0
  62. package/dist-library/types/authoring/conformance.d.ts +24 -0
  63. package/dist-library/types/{editor → authoring}/editor-i18n.d.ts +3 -24
  64. package/dist-library/types/authoring/extensions.d.ts +13 -0
  65. package/dist-library/types/authoring/index.d.ts +14 -11
  66. package/dist-library/types/authoring/insert.d.ts +16 -0
  67. package/dist-library/types/{editor → authoring}/native-components.d.ts +19 -2
  68. package/dist-library/types/authoring/templates.d.ts +65 -0
  69. package/dist-library/types/build/diagnostics.d.ts +8 -0
  70. package/dist-library/types/build/digest.d.ts +5 -0
  71. package/dist-library/types/build/entry.d.ts +9 -0
  72. package/dist-library/types/build/host.d.ts +36 -0
  73. package/dist-library/types/build/index.d.ts +99 -0
  74. package/dist-library/types/build/notices.d.ts +29 -0
  75. package/dist-library/types/build/resources.d.ts +60 -0
  76. package/dist-library/types/build/vite.d.ts +15 -0
  77. package/dist-library/types/compiler/index.d.ts +22 -0
  78. package/dist-library/types/compiler/result.d.ts +30 -0
  79. package/dist-library/types/compiler/standard.d.ts +16 -0
  80. package/dist-library/types/compiler/types.d.ts +69 -0
  81. package/dist-library/types/components/chart-motion.d.ts +12 -0
  82. package/dist-library/types/components/controls.d.ts +21 -0
  83. package/dist-library/types/{local → components}/data-table.d.ts +10 -24
  84. package/dist-library/types/components/default-chart-types.d.ts +22 -0
  85. package/dist-library/types/components/default-chart.d.ts +2 -0
  86. package/dist-library/types/components/default-preset.d.ts +10 -0
  87. package/dist-library/types/components/diagram-inspector.d.ts +24 -0
  88. package/dist-library/types/components/gallery.d.ts +6 -0
  89. package/dist-library/types/components/layout.d.ts +23 -0
  90. package/dist-library/types/components/mafs-plot-grid.d.ts +57 -0
  91. package/dist-library/types/components/mafs-visuals.d.ts +40 -0
  92. package/dist-library/types/components/numeric-sliders.d.ts +3 -0
  93. package/dist-library/types/components/uiarc/calendar/calendar.d.ts +26 -0
  94. package/dist-library/types/components/uiarc/date-picker/date-picker.d.ts +29 -0
  95. package/dist-library/types/components/uiarc/lib/motion-tokens.d.ts +2 -0
  96. package/dist-library/types/components/uiarc/lib/use-today.d.ts +2 -0
  97. package/dist-library/types/components/uiarc/motion-tokens.d.ts +60 -0
  98. package/dist-library/types/components/uiarc/rmd-motion.d.ts +12 -0
  99. package/dist-library/types/components/uiarc/select/select.d.ts +21 -0
  100. package/dist-library/types/components/uiarc/slider/slider.d.ts +53 -0
  101. package/dist-library/types/components/use-hydrated.d.ts +6 -0
  102. package/dist-library/types/components/visuals.d.ts +13 -0
  103. package/dist-library/types/export/component-state.d.ts +39 -0
  104. package/dist-library/types/export/index.d.ts +47 -0
  105. package/dist-library/types/export/requirements.d.ts +23 -0
  106. package/dist-library/types/export/resources.d.ts +8 -0
  107. package/dist-library/types/export/restoration.d.ts +52 -0
  108. package/dist-library/types/index.d.ts +1 -0
  109. package/dist-library/types/local/compilation/compiler-core.d.ts +16 -0
  110. package/dist-library/types/local/compilation/compiler-services.d.ts +64 -0
  111. package/dist-library/types/local/compilation/compiler-structure.d.ts +46 -0
  112. package/dist-library/types/local/compilation/compiler-values.d.ts +9 -0
  113. package/dist-library/types/local/compilation/compiler.d.ts +34 -0
  114. package/dist-library/types/local/compilation/component-kernel.d.ts +487 -0
  115. package/dist-library/types/local/{dependencies.d.ts → compilation/dependencies.d.ts} +4 -3
  116. package/dist-library/types/local/{diagnostics.d.ts → configuration/diagnostic-messages.d.ts} +193 -65
  117. package/dist-library/types/local/configuration/diagnostics.d.ts +58 -0
  118. package/dist-library/types/local/{limits.d.ts → configuration/limits.d.ts} +15 -2
  119. package/dist-library/types/local/configuration/options-core.d.ts +120 -0
  120. package/dist-library/types/local/configuration/options.d.ts +17 -0
  121. package/dist-library/types/local/configuration/portable-options.d.ts +3 -0
  122. package/dist-library/types/local/configuration/schema-core.d.ts +32 -0
  123. package/dist-library/types/local/configuration/schema.d.ts +12 -0
  124. package/dist-library/types/local/contracts/types.d.ts +519 -0
  125. package/dist-library/types/local/{version.d.ts → contracts/version.d.ts} +1 -1
  126. package/dist-library/types/local/{computations.d.ts → evaluation/computations.d.ts} +6 -3
  127. package/dist-library/types/local/{expression.d.ts → evaluation/expression.d.ts} +2 -2
  128. package/dist-library/types/local/{math-display.d.ts → evaluation/math-display.d.ts} +2 -16
  129. package/dist-library/types/local/evaluation/math-sample.d.ts +23 -0
  130. package/dist-library/types/local/evaluation/math.d.ts +73 -0
  131. package/dist-library/types/local/{validation.d.ts → evaluation/validation.d.ts} +1 -1
  132. package/dist-library/types/local/html/html-details.d.ts +16 -0
  133. package/dist-library/types/local/html/html-entities.d.ts +7 -0
  134. package/dist-library/types/local/html/html-policy.d.ts +43 -0
  135. package/dist-library/types/local/html/html-recovery.d.ts +16 -0
  136. package/dist-library/types/local/html/html-table-names.d.ts +9 -0
  137. package/dist-library/types/local/{html-table.d.ts → html/html-table.d.ts} +2 -6
  138. package/dist-library/types/local/{html.d.ts → html/html.d.ts} +1 -1
  139. package/dist-library/types/local/index.d.ts +31 -24
  140. package/dist-library/types/local/markdown/fast-markdown.d.ts +137 -0
  141. package/dist-library/types/local/{footnotes.d.ts → markdown/footnotes.d.ts} +1 -1
  142. package/dist-library/types/local/{heading-anchors.d.ts → markdown/heading-anchors.d.ts} +12 -2
  143. package/dist-library/types/local/markdown/markdown-blocks.d.ts +55 -0
  144. package/dist-library/types/local/markdown/markdown-structure.d.ts +3 -0
  145. package/dist-library/types/local/markdown/plain-paragraphs.d.ts +10 -0
  146. package/dist-library/types/local/parsing/lexical.d.ts +21 -0
  147. package/dist-library/types/local/parsing/parse-budget.d.ts +67 -0
  148. package/dist-library/types/local/parsing/parser-capabilities.d.ts +42 -0
  149. package/dist-library/types/local/parsing/parser-core.d.ts +65 -0
  150. package/dist-library/types/local/parsing/parser-standard.d.ts +7 -0
  151. package/dist-library/types/local/parsing/parser.d.ts +16 -0
  152. package/dist-library/types/local/parsing/rmd-recovery.d.ts +48 -0
  153. package/dist-library/types/local/{LocalDocumentView.d.ts → rendering/LocalDocumentView.d.ts} +67 -24
  154. package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +36 -0
  155. package/dist-library/types/local/rendering/render-types.d.ts +57 -0
  156. package/dist-library/types/local/rendering/view-revision.d.ts +75 -0
  157. package/dist-library/types/local/{retention.d.ts → runtime/retention.d.ts} +1 -1
  158. package/dist-library/types/local/runtime/runtime.d.ts +34 -0
  159. package/dist-library/types/local/{state.d.ts → runtime/state.d.ts} +4 -4
  160. package/dist-library/types/local/session/compiler-cache.d.ts +44 -0
  161. package/dist-library/types/local/session/incremental.d.ts +48 -0
  162. package/dist-library/types/local/session/parse-session.d.ts +62 -0
  163. package/dist-library/types/local/session/row-reuse.d.ts +46 -0
  164. package/dist-library/types/local/{authoring.d.ts → source/authoring.d.ts} +11 -3
  165. package/dist-library/types/local/source/node-walk.d.ts +3 -0
  166. package/dist-library/types/local/source/source-context.d.ts +63 -0
  167. package/dist-library/types/local/{source-migration.d.ts → source/source-migration.d.ts} +2 -2
  168. package/dist-library/types/local/{i18n.d.ts → theme/i18n.d.ts} +2 -2
  169. package/dist-library/types/local/theme/theme-name.d.ts +3 -0
  170. package/dist-library/types/local/{theme.d.ts → theme/theme.d.ts} +3 -3
  171. package/dist-library/types/local/transport/compile-patch.d.ts +127 -0
  172. package/dist-library/types/local/{compiled-data.d.ts → transport/compiled-data.d.ts} +1 -1
  173. package/dist-library/types/local/transport/flat-compiled-data.d.ts +17 -0
  174. package/dist-library/types/local/transport/shared-data.d.ts +10 -0
  175. package/dist-library/types/local/transport/worker.d.ts +265 -0
  176. package/dist-library/types/local/widgets/visuals.d.ts +25 -0
  177. package/dist-library/types/presets/default-authoring.d.ts +50 -0
  178. package/dist-library/types/presets/default-components.d.ts +4 -0
  179. package/dist-library/types/presets/default-semantics.d.ts +8 -0
  180. package/dist-library/types/presets/default.d.ts +11 -0
  181. package/dist-library/types/presets/identity.d.ts +7 -0
  182. package/dist-library/types/presets/packs.d.ts +4 -0
  183. package/dist-library/types/react/component-api.d.ts +260 -0
  184. package/dist-library/types/react/component-primitives.d.ts +21 -0
  185. package/dist-library/types/react/component-utils.d.ts +125 -0
  186. package/dist-library/types/react/default-theme.d.ts +6 -0
  187. package/dist-library/types/react/field-validation.d.ts +11 -0
  188. package/dist-library/types/react/index.d.ts +17 -5
  189. package/dist-library/types/react/overflow-text-tooltip.d.ts +6 -0
  190. package/dist-library/types/react/package.d.ts +69 -0
  191. package/dist-library/types/react/runtime/common.d.ts +4 -0
  192. package/dist-library/types/react/runtime/index.d.ts +8 -0
  193. package/dist-library/types/react/runtime/useComponentState.d.ts +30 -0
  194. package/dist-library/types/react/runtime/useKeys.d.ts +16 -0
  195. package/dist-library/types/react/runtime/useSwipe.d.ts +27 -0
  196. package/dist-library/types/react/runtime/useTicker.d.ts +17 -0
  197. package/dist-library/types/react/sdk.d.ts +110 -0
  198. package/dist-library/types/react/server.d.ts +15 -0
  199. package/dist-library/types/react/tooltip-layer.d.ts +10 -0
  200. package/dist-library/types/react/use-draft-field.d.ts +17 -0
  201. package/dist-library/types/runtime-services/browser/index.d.ts +63 -0
  202. package/dist-library/types/runtime-services/component-state.d.ts +152 -0
  203. package/dist-library/types/runtime-services/identity.d.ts +41 -0
  204. package/dist-library/types/runtime-services/index.d.ts +10 -0
  205. package/dist-library/types/runtime-services/random.d.ts +42 -0
  206. package/dist-library/types/runtime-services/runtime.d.ts +51 -0
  207. package/dist-library/types/runtime-services/scheduler.d.ts +44 -0
  208. package/dist-library/types/sdk/assembly.d.ts +73 -0
  209. package/dist-library/types/sdk/compat-profile.d.ts +57 -0
  210. package/dist-library/types/sdk/compiler-config.d.ts +33 -0
  211. package/dist-library/types/sdk/config-validation.d.ts +33 -0
  212. package/dist-library/types/sdk/config.d.ts +35 -0
  213. package/dist-library/types/sdk/hash.d.ts +9 -0
  214. package/dist-library/types/sdk/index.d.ts +10 -0
  215. package/dist-library/types/sdk/manifest.d.ts +49 -0
  216. package/dist-library/types/sdk/pattern.d.ts +11 -0
  217. package/dist-library/types/sdk/preset-core.d.ts +11 -0
  218. package/dist-library/types/sdk/preset.d.ts +9 -0
  219. package/dist-library/types/sdk/props.d.ts +33 -0
  220. package/dist-library/types/sdk/registry-core.d.ts +16 -0
  221. package/dist-library/types/sdk/registry.d.ts +18 -0
  222. package/dist-library/types/sdk/theme.d.ts +73 -0
  223. package/dist-library/types/sdk/types.d.ts +221 -0
  224. package/dist-library/types/sdk/version.d.ts +49 -0
  225. package/dist-library/types/shareable.d.ts +29 -3
  226. package/dist-library/types/standalone/diagnostics.d.ts +16 -0
  227. package/dist-library/types/standalone/events.d.ts +4 -0
  228. package/dist-library/types/standalone/library.d.ts +6 -0
  229. package/dist-library/types/standalone/payload.d.ts +15 -0
  230. package/dist-library/types/standalone/prepare.d.ts +21 -0
  231. package/dist-library/types/standalone/session.d.ts +68 -0
  232. package/dist-library/types/standalone/version.d.ts +7 -0
  233. package/dist-library/types/testing/behavior.d.ts +19 -0
  234. package/dist-library/types/testing/browser.d.ts +126 -0
  235. package/dist-library/types/testing/cases.d.ts +16 -0
  236. package/dist-library/types/testing/index.d.ts +13 -0
  237. package/dist-library/types/testing/manifest.d.ts +10 -0
  238. package/dist-library/types/testing/react.d.ts +45 -0
  239. package/dist-library/types/testing/report.d.ts +20 -0
  240. package/dist-library/types/testing/types.d.ts +125 -0
  241. package/dist-library/types/testing/values.d.ts +22 -0
  242. package/dist-library/types/vite/client.d.ts +36 -0
  243. package/dist-library/types/vite/discovery.d.ts +51 -0
  244. package/dist-library/types/vite/index.d.ts +31 -0
  245. package/dist-library/types/vite/registration.d.ts +109 -0
  246. package/dist-library/types-BFCrMrg0.js +52 -0
  247. package/dist-library/validation-W-bmny-x.js +2253 -0
  248. package/dist-library/values-CIt8AjiU.js +134 -0
  249. package/dist-standalone/reactive-md-standalone.css +1 -1
  250. package/dist-standalone/reactive-md-standalone.js +591 -95
  251. package/docs/README-ch.md +90 -0
  252. package/docs/README.md +87 -81
  253. package/docs/compatibility/compatibility-ch.md +22 -14
  254. package/docs/compatibility/compatibility-en.md +22 -14
  255. package/docs/compatibility/source-versioning-ch.md +15 -12
  256. package/docs/compatibility/source-versioning-en.md +16 -13
  257. package/docs/development/component-development-ch.md +51 -195
  258. package/docs/development/component-development-en.md +51 -195
  259. package/docs/development/component-development-reference-ch.md +253 -0
  260. package/docs/development/component-development-reference-en.md +238 -0
  261. package/docs/development/component-protocol-ch.md +51 -50
  262. package/docs/development/component-protocol-en.md +52 -49
  263. package/docs/development/local-module-layout-ch.md +59 -0
  264. package/docs/development/local-module-layout-en.md +59 -0
  265. package/docs/development/performance-overview-ch.md +402 -0
  266. package/docs/development/performance-overview-en.md +402 -0
  267. package/docs/development/releasing-ch.md +8 -104
  268. package/docs/development/releasing-en.md +8 -104
  269. package/docs/guides/local-guide-ch.md +28 -9
  270. package/docs/guides/local-guide-en.md +31 -12
  271. package/docs/integration/author-tools-ch.md +4 -2
  272. package/docs/integration/author-tools-en.md +4 -2
  273. package/docs/integration/codemirror-ch.md +52 -0
  274. package/docs/integration/codemirror-en.md +29 -0
  275. package/docs/integration/compiler-ch.md +47 -0
  276. package/docs/integration/compiler-en.md +34 -0
  277. package/docs/integration/directory-discovery-ch.md +53 -0
  278. package/docs/integration/directory-discovery-en.md +31 -0
  279. package/docs/integration/editor-ch.md +48 -21
  280. package/docs/integration/editor-en.md +48 -21
  281. package/docs/integration/extension-sdk-ch.md +392 -0
  282. package/docs/integration/extension-sdk-en.md +377 -0
  283. package/docs/integration/local-integration-ch.md +63 -9
  284. package/docs/integration/local-integration-en.md +89 -13
  285. package/docs/integration/repository-split-ch.md +40 -0
  286. package/docs/integration/repository-split-en.md +23 -0
  287. package/docs/integration/shareable-export-ch.md +46 -2
  288. package/docs/integration/shareable-export-en.md +46 -2
  289. package/docs/reference/computations-formatting-ch.md +4 -2
  290. package/docs/reference/computations-formatting-en.md +4 -2
  291. package/docs/reference/constraints-collections-ch.md +21 -1
  292. package/docs/reference/constraints-collections-en.md +21 -1
  293. package/docs/reference/diagnostics-counting-ch.md +1 -1
  294. package/docs/reference/diagnostics-counting-en.md +1 -1
  295. package/docs/reference/html-compatibility-ch.md +4 -0
  296. package/docs/reference/html-compatibility-en.md +4 -0
  297. package/docs/reference/local-components-v2-ch.md +2 -0
  298. package/docs/reference/local-components-v2-en.md +2 -0
  299. package/docs/reference/local-interaction-syntax-ch.md +51 -15
  300. package/docs/reference/local-interaction-syntax-en.md +58 -14
  301. package/docs/reference/theme-protocol-ch.md +79 -7
  302. package/docs/reference/theme-protocol-en.md +79 -7
  303. package/docs/reference/tolerance-ch.md +64 -0
  304. package/docs/reference/tolerance-en.md +57 -0
  305. package/docs/releases/release-0.4.0-ch.md +2 -0
  306. package/docs/releases/release-0.4.0-en.md +2 -0
  307. package/docs/releases/release-0.4.1-ch.md +2 -0
  308. package/docs/releases/release-0.4.1-en.md +2 -0
  309. package/docs/releases/release-0.5.0-ch.md +2 -0
  310. package/docs/releases/release-0.5.0-en.md +2 -0
  311. package/docs/releases/release-0.5.1-ch.md +2 -0
  312. package/docs/releases/release-0.5.1-en.md +2 -0
  313. package/docs/releases/release-0.5.2-ch.md +2 -0
  314. package/docs/releases/release-0.5.2-en.md +2 -0
  315. package/docs/releases/release-0.5.3-ch.md +2 -0
  316. package/docs/releases/release-0.5.3-en.md +2 -0
  317. package/docs/releases/release-0.6.0-ch.md +2 -0
  318. package/docs/releases/release-0.6.0-en.md +2 -0
  319. package/docs/releases/release-0.6.1-ch.md +2 -0
  320. package/docs/releases/release-0.6.1-en.md +2 -0
  321. package/docs/releases/release-0.7.0-ch.md +86 -0
  322. package/docs/releases/release-0.7.0-en.md +86 -0
  323. package/docs/releases/release-0.8.0-ch.md +126 -0
  324. package/docs/releases/release-0.8.0-en.md +126 -0
  325. package/examples/component-package/LICENSE +21 -0
  326. package/examples/component-package/NOTICES.md +12 -0
  327. package/examples/component-package/README-ch.md +101 -0
  328. package/examples/component-package/README.md +133 -0
  329. package/examples/component-package/package.json +35 -0
  330. package/examples/component-package/sample/document.reactive.md +14 -0
  331. package/examples/component-package/scripts/build-export.mjs +44 -0
  332. package/examples/component-package/scripts/build.mjs +130 -0
  333. package/examples/component-package/scripts/verify.mjs +257 -0
  334. package/examples/component-package/src/assets/notice.svg +4 -0
  335. package/examples/component-package/src/component.css +40 -0
  336. package/examples/component-package/src/components.tsx +105 -0
  337. package/examples/component-package/src/harness.tsx +34 -0
  338. package/examples/component-package/src/manifests.ts +71 -0
  339. package/examples/component-package/src/node-entry.ts +18 -0
  340. package/examples/component-package/src/sample.ts +4 -0
  341. package/examples/component-package/src/theme.css +44 -0
  342. package/examples/component-package/src/theme.ts +22 -0
  343. package/examples/component-package/tsconfig.json +15 -0
  344. package/examples/conformance/README-ch.md +55 -0
  345. package/examples/conformance/README.md +2 -0
  346. package/examples/conformance/local-draft-3.json +296 -0
  347. package/examples/game-2048-package/LICENSE +21 -0
  348. package/examples/game-2048-package/NOTICES.md +11 -0
  349. package/examples/game-2048-package/README-ch.md +97 -0
  350. package/examples/game-2048-package/README.md +102 -0
  351. package/examples/game-2048-package/package.json +35 -0
  352. package/examples/game-2048-package/sample/document.reactive.md +17 -0
  353. package/examples/game-2048-package/scripts/build-export.mjs +44 -0
  354. package/examples/game-2048-package/scripts/build.mjs +130 -0
  355. package/examples/game-2048-package/scripts/verify.mjs +180 -0
  356. package/examples/game-2048-package/src/component.css +161 -0
  357. package/examples/game-2048-package/src/components.tsx +326 -0
  358. package/examples/game-2048-package/src/game-engine.ts +228 -0
  359. package/examples/game-2048-package/src/harness.tsx +34 -0
  360. package/examples/game-2048-package/src/manifest.ts +85 -0
  361. package/examples/game-2048-package/src/node-entry.ts +30 -0
  362. package/examples/game-2048-package/src/sample.ts +4 -0
  363. package/examples/game-2048-package/tsconfig.json +15 -0
  364. package/examples/integration/README-ch.md +63 -0
  365. package/examples/integration/README.md +17 -1
  366. package/examples/integration/extension-sdk/README-ch.md +24 -0
  367. package/examples/integration/extension-sdk/README.md +24 -0
  368. package/examples/integration/extension-sdk/advanced-standalone.ts +6 -0
  369. package/examples/integration/extension-sdk/advanced.tsx +101 -0
  370. package/examples/integration/extension-sdk/env.d.ts +2 -0
  371. package/examples/integration/extension-sdk/extensions.tsx +97 -0
  372. package/examples/integration/extension-sdk/index.html +3 -0
  373. package/examples/integration/extension-sdk/main.tsx +10 -0
  374. package/examples/integration/extension-sdk/package.json +6 -0
  375. package/examples/integration/extension-sdk/standalone.ts +7 -0
  376. package/examples/integration/extension-sdk/tsconfig.json +8 -0
  377. package/examples/integration/react-comprehensive/index.html +12 -0
  378. package/examples/integration/react-comprehensive/main.jsx +123 -0
  379. package/examples/integration/react-comprehensive/package.json +18 -0
  380. package/examples/local/README-ch.md +76 -0
  381. package/examples/local/README.md +4 -2
  382. package/examples/local/scenarios/blog-zh.reactive.md +71 -0
  383. package/examples/local/scenarios/blog.reactive.md +71 -0
  384. package/examples/local/scenarios/classroom-zh.reactive.md +97 -0
  385. package/examples/local/scenarios/classroom.reactive.md +97 -0
  386. package/examples/local/scenarios/proposal-zh.reactive.md +79 -0
  387. package/examples/local/scenarios/proposal.reactive.md +79 -0
  388. package/examples/local/scenarios/survey-zh.reactive.md +74 -0
  389. package/examples/local/scenarios/survey.reactive.md +74 -0
  390. package/examples/local/showcase/README-ch.md +22 -0
  391. package/examples/local/showcase/README.md +9 -3
  392. package/examples/local/showcase/features.reactive.md +637 -0
  393. package/examples/local/showcase/zh/features.reactive.md +637 -0
  394. package/examples/sci-fi-theme/README-ch.md +131 -0
  395. package/examples/sci-fi-theme/README.md +146 -0
  396. package/examples/sci-fi-theme/demo/demo.css +532 -0
  397. package/examples/sci-fi-theme/demo/document.reactive.md +185 -0
  398. package/examples/sci-fi-theme/demo/index.html +13 -0
  399. package/examples/sci-fi-theme/demo/main.tsx +180 -0
  400. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -0
  401. package/examples/sci-fi-theme/docs/design-system.md +474 -0
  402. package/examples/sci-fi-theme/package.json +27 -0
  403. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -0
  404. package/examples/sci-fi-theme/src/components.css +1460 -0
  405. package/examples/sci-fi-theme/src/index.ts +6 -0
  406. package/examples/sci-fi-theme/src/sci-fi.css +5 -0
  407. package/examples/sci-fi-theme/src/theme.ts +37 -0
  408. package/examples/sci-fi-theme/src/tokens.css +408 -0
  409. package/examples/sci-fi-theme/tsconfig.json +20 -0
  410. package/examples/sci-fi-theme/vite.config.ts +24 -0
  411. package/examples/tetris-package/LICENSE +21 -0
  412. package/examples/tetris-package/NOTICES.md +11 -0
  413. package/examples/tetris-package/README-ch.md +91 -0
  414. package/examples/tetris-package/README.md +95 -0
  415. package/examples/tetris-package/package.json +35 -0
  416. package/examples/tetris-package/sample/document.reactive.md +16 -0
  417. package/examples/tetris-package/scripts/build-export.mjs +44 -0
  418. package/examples/tetris-package/scripts/build.mjs +130 -0
  419. package/examples/tetris-package/scripts/verify.mjs +173 -0
  420. package/examples/tetris-package/src/component.css +145 -0
  421. package/examples/tetris-package/src/components.tsx +334 -0
  422. package/examples/tetris-package/src/harness.tsx +34 -0
  423. package/examples/tetris-package/src/manifests.ts +93 -0
  424. package/examples/tetris-package/src/node-entry.ts +16 -0
  425. package/examples/tetris-package/src/sample.ts +4 -0
  426. package/examples/tetris-package/src/tetris-engine.ts +325 -0
  427. package/examples/tetris-package/tsconfig.json +15 -0
  428. package/package.json +98 -44
  429. package/dist-library/compiler-Cm3ppMxG.js +0 -46044
  430. package/dist-library/react-Bh7_oxZp.js +0 -59655
  431. package/dist-library/reactive-md-editor.css +0 -2
  432. package/dist-library/reactive-md-editor.js +0 -3853
  433. package/dist-library/runtime-DlFYQ4s_.js +0 -498
  434. package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +0 -7
  435. package/dist-library/types/editor/editor-toolbar.d.ts +0 -24
  436. package/dist-library/types/editor/editor-view-bar.d.ts +0 -11
  437. package/dist-library/types/editor/extended-native-components.d.ts +0 -58
  438. package/dist-library/types/editor/index.d.ts +0 -9
  439. package/dist-library/types/editor/locale.d.ts +0 -13
  440. package/dist-library/types/editor/source-authoring.d.ts +0 -59
  441. package/dist-library/types/editor/types.d.ts +0 -48
  442. package/dist-library/types/editor/use-gutter-metrics.d.ts +0 -5
  443. package/dist-library/types/editor/use-source-history.d.ts +0 -16
  444. package/dist-library/types/local/compiler.d.ts +0 -4
  445. package/dist-library/types/local/math.d.ts +0 -48
  446. package/dist-library/types/local/options.d.ts +0 -36
  447. package/dist-library/types/local/parser.d.ts +0 -13
  448. package/dist-library/types/local/render-types.d.ts +0 -27
  449. package/dist-library/types/local/runtime.d.ts +0 -2
  450. package/dist-library/types/local/schema.d.ts +0 -77
  451. package/dist-library/types/local/types.d.ts +0 -263
  452. package/dist-library/types/local/visuals.d.ts +0 -12
  453. package/dist-library/types/local/worker.d.ts +0 -98
  454. package/docs/development/performance-ch.md +0 -76
  455. package/docs/development/performance-en.md +0 -76
  456. /package/dist-library/types/{editor → authoring}/command-types.d.ts +0 -0
  457. /package/dist-library/types/{editor → authoring}/editor-commands.d.ts +0 -0
  458. /package/dist-library/types/local/{locale.d.ts → contracts/locale.d.ts} +0 -0
  459. /package/dist-library/types/local/{collection-functions.d.ts → evaluation/collection-functions.d.ts} +0 -0
  460. /package/dist-library/types/local/{data-functions.d.ts → evaluation/data-functions.d.ts} +0 -0
  461. /package/dist-library/types/local/{dates.d.ts → evaluation/dates.d.ts} +0 -0
  462. /package/dist-library/types/local/{formatting.d.ts → evaluation/formatting.d.ts} +0 -0
  463. /package/dist-library/types/local/{html-names.d.ts → html/html-names.d.ts} +0 -0
  464. /package/dist-library/types/local/{text-length.d.ts → source/text-length.d.ts} +0 -0
  465. /package/dist-library/types/local/{colors.d.ts → theme/colors.d.ts} +0 -0
  466. /package/dist-library/types/local/{code-block.d.ts → widgets/code-block.d.ts} +0 -0
  467. /package/dist-library/types/local/{code-languages.d.ts → widgets/code-languages.d.ts} +0 -0
  468. /package/dist-library/types/local/{diagram-layout.d.ts → widgets/diagram-layout.d.ts} +0 -0
  469. /package/dist-library/types/local/{image-view.d.ts → widgets/image-view.d.ts} +0 -0
  470. /package/dist-library/types/local/{math-view.d.ts → widgets/math-view.d.ts} +0 -0
  471. /package/dist-library/types/local/{table-surface.d.ts → widgets/table-surface.d.ts} +0 -0
@@ -0,0 +1,238 @@
1
+ # Component plugin development contract
2
+
3
+ **English** · [中文](component-development-reference-ch.md) · [Five-minute quick start](component-development-en.md)
4
+
5
+ A plugin is an npm component or theme package that a host installs, imports and composes explicitly. Its contract consists of data manifests, React implementations, authoring information and resources. Hosts assemble it with `createLocalConfig` and `createReactConfig`.
6
+
7
+ The SDK ships in `reactive-md@0.7.0`. Install the published package for this workflow; use a tarball built from the current source only when testing unreleased SDK changes. See the [SDK reference](../integration/extension-sdk-en.md) for types and limits. Historical delivery evidence is archived outside the published documentation.
8
+
9
+
10
+ ## Convenience packages and host composition
11
+
12
+ Use `defineReactComponentPackage` from `reactive-md/react` for simple components. It accepts an inline manifest, `render`, optional `renderStatic`, inline `css` and explicit `resources`. Defaults are protocol `reactive-md-component/v1`, form `leaf` and empty props. CSS defaults its resource ID to `id + '.css'`; components without CSS acquire no style requirement. Capabilities stay explicit and require compliance evidence.
13
+
14
+ The result exposes a serializable `definition`, implementation array `components` and validated `resources`. `createReactHost({ packages, components?, themes?, resources?, notices? })` composes them once and returns matching `config`, `reactConfig`, `compileOptions`, resources, CSS and notices. Existing collision, dependency and resource checks remain in use, with the default preset enabled.
15
+
16
+ Distributable packages retain a pure manifest entry. A separate manifest can be spread into the convenience factory, with matching style identities. The scaffold derives its style identity from one ID constant so the pure and React entries have the same digest. Single-file authors can emit the normalized `definition` as pure data during their build. Workers receive serialized configuration; implementation code stays in its own entry.
17
+
18
+ `renderStatic` is already optional and falls back to `render`. Branch on `ctx.mode === 'static'` or `ctx.bindings.isReadOnly`. The kernel rejects shared binding writes in static mode; components still control their own React state, timers and event handlers. Timer effects should return in static mode and clean up on unmount. Separate static renderers are useful for different layouts.
19
+
20
+ ## Vite integration and configuration diagnostics
21
+
22
+ ```ts
23
+ import { reactiveMd } from 'reactive-md/vite';
24
+ export default { plugins: [reactiveMd()] };
25
+ ```
26
+
27
+ The plugin discovers the host project's `theme/` and `plugin/` directories. See [directory integration](../integration/directory-discovery-en.md). Manual mode, `reactiveMd({ extensions: './extensions.ts' })`, still accepts a module exporting `host = createReactHost(...)`. Applications import it from `virtual:reactive-md/host`, which supplies styles without a private alias or manual injection. It also exposes configuration/resource fields and an `extensions` namespace for host-owned metadata such as examples. Metadata never enters the Worker. Reference `reactive-md/vite/client` for virtual-module types.
28
+
29
+ The adapter merges Vite settings, excludes ReactiveMD JS entries from prebundling and deduplicates React. Component defaults precede theme CSS; configuration changes reload the host and dispose old styles. Applications explicitly pass `host.reactConfig` to views and `host.compileOptions` to compilers, editors and Workers. Import the core stylesheet `reactive-md/styles.css`; the scaffold includes it.
30
+
31
+ Production builds emit `reactive-md-standalone.js` and `reactive-md-export.json`. Browser exporters can lazily import the complete bundle through `virtual:reactive-md/bundle`. The adapter reuses public build capability, resource, budget and offline checks. Preview-only packages remain usable, with missing export capabilities recorded in the error manifest and export diagnostics. An offline bundle covers every registered component, and registration modules must be loadable by the Node build entry. Style declarations identify resources; packages or explicit resource records provide their CSS.
32
+
33
+ New documents carry `componentConfigKey` through Worker transport and incremental patches. Views, strict SSR and export compare it with the installed host and report `local.extension.config-mismatch` when compilation used another registry. Existing version/implementation validation remains in place. Documents without the new field retain contract-based checks.
34
+
35
+ ## 1. Start outside the repository
36
+
37
+ Use Node 22.12 or later and React 19 for the React adapter. The template's `package.json` declares its build and browser test dependencies.
38
+
39
+ Copy [examples/component-package](../../examples/component-package/README.md) into a new sibling directory named `my-reactivemd-plugin`. The template depends on the published `reactive-md@0.7.0`. From that directory run:
40
+
41
+ ```sh
42
+ npm install
43
+ npm run typecheck
44
+ npm test
45
+ ```
46
+
47
+ When testing unreleased SDK changes, pack the current source and install that tarball instead of the registry version.
48
+
49
+ `npm test` builds JavaScript, declarations, static and interactive HTML, then runs Node, SSR and offline browser checks. Install a Playwright browser first; on Windows, select an installed channel with `PLAYWRIGHT_CHANNEL=msedge` when appropriate. Get the unchanged template passing before changing its behavior and tests.
50
+
51
+ ## 2. Package layout
52
+
53
+ | File or export | Purpose |
54
+ | --- | --- |
55
+ | `src/manifests.ts`, package `.` | Data manifests for core, Worker and authoring consumers |
56
+ | `src/components.tsx`, `./react` | React and static implementations bound to those manifests |
57
+ | `src/theme.ts`, `./theme` | Independent theme definition and resource identities |
58
+ | `src/component.css`, `./styles.css` | Default structural styles, shipped with their referenced assets |
59
+ | `scripts/build.mjs` | Node/browser output, `.d.ts` files and example exports |
60
+ | `scripts/verify.mjs` | Manifest, binding, SSR and separate rating/container browser scenarios |
61
+ | `LICENSE`, `NOTICES.md` | Package license and attribution for offline distribution |
62
+
63
+ Keep manifests serializable and functions in the implementation entry. Package exports point to built JavaScript and declarations. Consumers import public package entries.
64
+
65
+ ## 3. Define the contract
66
+
67
+ The following `manifests.ts`, `components.tsx` and `host.tsx` form a standalone minimal example; section 6 supplies `component.css`. The full template also has note, theme and test exports. Update those references and scenarios when changing template components.
68
+
69
+ Save this rating contract as `src/manifests.ts`:
70
+
71
+ ```ts
72
+ import { defineLocalComponent } from 'reactive-md/sdk';
73
+
74
+ export const rating = defineLocalComponent({
75
+ id: 'example/rating', name: 'rating', version: '1.0.0',
76
+ protocol: 'reactive-md-component/v1', form: 'leaf',
77
+ props: {
78
+ label: { kind: 'string', required: true },
79
+ max: { kind: 'number', dynamic: true, default: 5, min: 1, max: 10, integer: true },
80
+ },
81
+ bindings: {
82
+ value: {
83
+ kind: 'number', family: 'number', bind: 'bind', initial: 'initial',
84
+ initialRule: 'nearest-zero',
85
+ constraints: { min: { literal: 0 }, max: { prop: 'max' }, step: { literal: 1 } },
86
+ },
87
+ },
88
+ structure: { rule: 'none' },
89
+ capabilities: { interactive: true, static: true, ssr: true, offline: true },
90
+ authoring: {
91
+ title: { zh: '评分', en: 'Rating' }, category: 'input',
92
+ description: { zh: '与数字控件共享评分。', en: 'Share a rating with numeric controls.' },
93
+ insertText: '<rating bind="score" label="Score" max="5" initial="3">',
94
+ },
95
+ styles: ['example/component.css'],
96
+ });
97
+ ```
98
+
99
+ `id` identifies the contract, `name` is the document tag and `version` is the component version. Registration checks duplicate names/ids, protocol, dependencies, defaults and budgets. Built-in name overrides are rejected. Configurations are frozen; create a new configuration when the component set changes.
100
+
101
+ Validated number props are numbers for both `max="5"` and `max="{{ 5 }}"`. Implementations read normalized props and submit state changes through binding handles.
102
+
103
+ Forms are `leaf`, `inline` and `container`. Containers declare content rules and render Markdown through `ctx.children.render()`. Use public content projections for options, tables and structural children. The template's `note` demonstrates a container. Section 10 covers new kernel primitives.
104
+
105
+ ## 4. React and static output
106
+
107
+ A standalone `src/components.tsx` implementation can be:
108
+
109
+ ```tsx
110
+ import { defineReactComponent, type LocalComponentContext } from 'reactive-md/react';
111
+ import { rating } from './manifests';
112
+
113
+ export function RatingControl(ctx: LocalComponentContext) {
114
+ const value = ctx.bindings.value.get() as number;
115
+ const maximum = ctx.props.max as number;
116
+ return <button className="rmd-example-rating"
117
+ disabled={ctx.disabled || !ctx.visible || value >= maximum}
118
+ aria-label={String(ctx.props.label)}
119
+ onClick={() => ctx.bindings.value.set(value + 1)}>{value}</button>;
120
+ }
121
+
122
+ export function RatingStatic(ctx: LocalComponentContext) {
123
+ return <span>{String(ctx.props.label)}: {String(ctx.bindings.value.get())}</span>;
124
+ }
125
+
126
+ export const ratingImplementation = defineReactComponent(rating, {
127
+ render: RatingControl, renderStatic: RatingStatic,
128
+ });
129
+ ```
130
+
131
+ The assertions correspond to the manifest's number contracts. Static rendering reads the current value; interactive rendering writes through the kernel, which preserves state on invalid updates. Multiple numeric slots commit atomically with `ctx.bindings.setMany`. The SDK reference defines supported slot and collection combinations.
132
+
133
+ Use React state for local UI state. Release timers, subscriptions and listeners in effect cleanup. Pause work when hidden where appropriate, and respond to `resetToken`. Static setters are rejected and runtime reset is ignored in static mode. Provide accessible names, keyboard operation, focus and disabled feedback.
134
+
135
+ ## 5. Host registration and editor support
136
+
137
+ Pass the same configuration to compilation, rendering, authoring and export. A standalone `src/host.tsx` can assemble the example:
138
+
139
+ ```tsx
140
+ import { useState } from 'react';
141
+ import { createLocalConfig } from 'reactive-md/sdk';
142
+ import { createReactConfig, LocalReactiveDocument } from 'reactive-md/react';
143
+ import { ReactiveMarkdownEditor } from 'reactive-md-editor';
144
+ import { rating } from './manifests';
145
+ import { ratingImplementation } from './components';
146
+ import 'reactive-md/styles.css';
147
+ import 'reactive-md-editor/styles.css';
148
+ import './component.css';
149
+
150
+ export const config = createLocalConfig({ components: [rating] });
151
+ export const reactConfig = createReactConfig(config, { components: [ratingImplementation] });
152
+
153
+ export function Playground() {
154
+ const [source, setSource] = useState(
155
+ '<number bind="score" label="Score" min="0" max="5" step="1" initial="3">\n'
156
+ + '<rating bind="score" label="Rating" max="5">',
157
+ );
158
+ return <ReactiveMarkdownEditor value={source} onChange={setSource}
159
+ compileOptions={{ config }} toolbar authoring
160
+ preview={<LocalReactiveDocument source={source} reactConfig={reactConfig} />} />;
161
+ }
162
+ ```
163
+
164
+ The default preset stays enabled. These controls share a numeric binding with matching constraints and one explicit initial value.
165
+
166
+ The editor reads titles, descriptions, category and insertion template from `authoring`; prop `description` supplies help. Supplied templates are validated under the same configuration. Insertion supports fresh binding names, selections, caret placement and undo/redo. Custom editors can use `createLocalComponentCatalog`, `insertLocalComponent` and `validateLocalComponentInsertTemplates`.
167
+
168
+ ### Use the repository Demo
169
+
170
+ Forward the package's public React entry from the host project's `plugin/<name>/index.ts` as the default package export. The Demo's `plugin/tetris/` and `plugin/game-2048/` directories consume its existing npm tarballs, with CSS themes under `theme/`. Preview, authoring and offline export share the generated host. After changing a package, rebuild and pack it, then update the Demo vendor dependency and lockfile using a content-addressed filename.
171
+
172
+ Resource IDs match manifest `styles`. Supply inline CSS with data URLs, either exported by the package or imported from a CSS file with Vite's `?inline`. Example source can come directly from the package; bilingual metadata registers it in the catalog. The host maintains Vite deduplication and compiler options for every package.
173
+
174
+ From the repository root, run `npm run build:demo`, then `node demo/scripts/verify-extensions.mjs`. Add `--dev` to exercise development mode. The script checks the real Worker, catalog, controls and exports opened offline. This assembly layer belongs to the Demo; packages retain the public manifest, React, theme and resource contracts. Independent hosts use the assembly example above. See the [Demo guide](https://github.com/yao1145/ReactiveMD/blob/main/demo/README.md) for fields and limits.
175
+
176
+ ## 6. Styles and independent themes
177
+
178
+ Default component CSS supplies structure and readable basics. Scope selectors to the document and use a package prefix:
179
+
180
+ ```css
181
+ .local-document .rmd-example-rating {
182
+ color: var(--ink);
183
+ background: var(--surface);
184
+ border: 1px solid var(--accent);
185
+ min-height: 44px;
186
+ }
187
+ ```
188
+
189
+ Use `--rmd-<package-or-component>-<purpose>` for component variables. Themes override shared semantic variables without needing to know every component. Define a theme with `defineLocalTheme`, compose ordered overrides with `composeLocalTheme`, and include the result in configuration `themes`. Documents select it with `<theme name="paper">`.
190
+
191
+ The template's `paper` demonstrates light/dark modes and scope; see the [theme protocol](../reference/theme-protocol-en.md). Theme definitions accept scoped inline CSS/data resources. Font-face names and matching literal references are scoped to the theme; keyframes remain unsupported. The build adapter resolves local files referenced by component CSS; normalize theme resources into the accepted form before distributing a theme package.
192
+
193
+ ## 7. Build, SSR and offline sharing
194
+
195
+ Preview uses implementations explicitly imported by the host. Offline sharing uses a matching prebuilt bundle. Start from the template's `scripts/build-export.mjs`. Its Node-loadable host ESM exports:
196
+
197
+ | Field | Requirement |
198
+ | --- | --- |
199
+ | `config`, `reactConfig` | Matching declarations and implementations |
200
+ | `root`, `allowlist` | Resource root and allowed directories inside it; the host entry is also inside root |
201
+ | `resources` | CSS identities matching manifest styles, supplied as inline CSS or root-relative file paths |
202
+ | `notices` | License/attribution for the package, ReactiveMD and distributed dependencies |
203
+
204
+ Use `preflightLocalStandaloneBuild` for diagnostics, then `buildLocalStandaloneBundle` for one IIFE, inline resources, notices and a manifest. Vite 8 is the optional peer needed for actual builds. Missing/remote resources, directory escapes, cycles, conflicts, exceeded budgets and unsupported offline implementations reject the build.
205
+
206
+ Strict SSR calls `renderLocalStaticDocument({ document, runtime, reactConfig, resources })`. Check `ok` before reading `markup`. Pass the same canonical resources to SSR, compliance and export when a component declares styles. `bundle.resources` is suitable for all three.
207
+
208
+ `createLocalShareableHtml` receives the compiled document, state, strict SSR markup, CSS and bundle. Export validates capabilities, component/theme contracts, the bundle seal and resources. Restoration validates versions and digests before applying state or mounting. Hosts supply installed code; document declarations never download it. Changed source or contracts require recompilation, state validation and a rebuilt bundle.
209
+
210
+ ## 8. Evidence for each capability
211
+
212
+ | Tool | Executed checks |
213
+ | --- | --- |
214
+ | `runLocalManifestCompliance` | Manifest round trips, defaults, invalid values, fields and budgets |
215
+ | `runLocalBehaviorCompliance` | Real compiler/runtime writes, rollback, revision, array copies and reset |
216
+ | `runLocalReactCompliance` | Static output, deterministic SSR and configured server error probes |
217
+ | `runLocalBrowserCompliance` | Mount/edit/hide/disable/reset, descendant error isolation and unmount; offline also requires hydration, disabled networking and zero requests |
218
+ | `createLocalComplianceReport` | Evidence for the same component, version and config; missing evidence stays explicit |
219
+
220
+ `ok` means the requested checks passed; `complete` means every declared capability has executed evidence. `npm run test:node` skips the browser and writes `complete:false`. Give the rating and container separate browser scenarios; the container must exercise its own content, visibility and child lifecycle.
221
+
222
+ Replace template scenarios with the plugin's actual interactions. Preserve distinctions between failed, skipped and unsupported. `compareLocalComplianceParity` compares shared semantics of default components and external aliases. Record actual engines, widths, keyboard/focus behavior and accessibility observations.
223
+
224
+ ## 9. Pack and consume in a second project
225
+
226
+ Run `npm run typecheck` and `npm test`, then `npm pack --ignore-scripts`. Install that plugin tarball and the ReactiveMD SDK tarball in another fresh project. Exercise the plugin's `.`, `./react`, `./theme` and `./styles.css` exports, NodeNext types, SSR, preview and offline HTML.
227
+
228
+ Before publishing, update name, version, LICENSE, NOTICES and exports. Inspect built JS/types, CSS and referenced assets. Replace local `file:` SDK dependencies with an actually published version containing these SDK entries, then remove template `private`. Declare the ReactiveMD range the package supports; version changed plugin contracts and document migrations.
229
+
230
+ Migrate `hostComponents`, `hostRenderer` and `hostData` through the [SDK migration guide](../integration/extension-sdk-en.md), then recompile and rebuild the bundle.
231
+
232
+ ## 10. Contribute to the default preset or kernel
233
+
234
+ Public rules usually require only a definition, implementation and host assembly. For default preset contributions, definitions live in `src/presets/default-components.ts`, implementations in `src/components/`, and authoring information in the default authoring data. The preset uses the same public protocol.
235
+
236
+ Add kernel code when introducing expression, state-family, structure or budget primitives, and define their public contracts. Review them through the [component protocol](component-protocol-en.md), [compatibility rules](../compatibility/compatibility-en.md) and [proposal template](component-protocol-en.md#13-new-component-proposal-template). Component version, SDK protocol, syntax revision and package version are separate decisions.
237
+
238
+ Run `npm run test:docs` for repository documentation. Build before `test:package`/`test:packed` when public entries or types change. Exercise affected runtime behavior with focused tests, and use `verify:release` for cross-system work or releases. Historical architecture evidence is archived outside the published documentation.
@@ -1,6 +1,8 @@
1
1
  # Reactive MD 组块协议
2
2
 
3
- 协议修订 `component-protocol-2` · 适用语法 `local-draft-2` · 当前包版本 `0.5.2`(预览)
3
+ **中文** · [English](component-protocol-en.md)
4
+
5
+ 协议修订 `component-protocol-3` · 适用语法 `local-draft-3` · 当前包版本 `0.7.0`
4
6
 
5
7
  Reactive MD 的组块就是语言中的组件。本协议规定组块在贡献、实现和验收中的共同契约,连接作者语法、编译器、运行时、React 参考适配器和机器验收数据。作者写文档时以[本地交互语法规范](../reference/local-interaction-syntax-ch.md)为准;宿主接入以[本地模式集成](../integration/local-integration-ch.md)为准;本文供贡献者、评审和测试使用。
6
8
 
@@ -21,8 +23,8 @@ Reactive MD 分别维护以下版本轴:
21
23
  | 版本轴 | 当前值 | 决定什么 |
22
24
  | --- | --- | --- |
23
25
  | 包版本 | `0.5.2` | npm 发布、核心与 React 入口、升级兼容规则 |
24
- | 语法修订 | `local-draft-2` | 作者可以写出的标签、属性和表达式 |
25
- | 协议修订 | `component-protocol-2` | 组块贡献要求、验收门槛和机器数据语义 |
26
+ | 语法修订 | `local-draft-3` | 作者可以写出的标签、属性和表达式 |
27
+ | 协议修订 | `component-protocol-3` | 组块贡献要求、验收门槛和机器数据语义 |
26
28
  | 主题协议 | `reactive-md-theme-1` | 主题登记、样式变量、深浅模式与主题验收 |
27
29
 
28
30
  协议修订独立于包版本和语法版本。一个包版本只接受一个语法修订。协议修订可以在不改变作者语法的前提下提高贡献和验收要求;语法修订变化也不必自动提升协议修订。
@@ -37,7 +39,7 @@ Reactive MD 分别维护以下版本轴:
37
39
  - 版本、诊断契约与平台范围:[版本与兼容性](../compatibility/compatibility-ch.md)。
38
40
  - 实现代码:`src/local/` 下的解析器、声明表、编译器、运行时和渲染器。
39
41
 
40
- 本协议不复制完整属性表。属性默认值、允许值和静态/动态标记以 `src/local/schema.ts` 和语法规范为准。
42
+ 本协议不复制完整属性表。属性默认值、允许值和静态/动态标记以 `src/local/configuration/schema.ts` 和语法规范为准。
41
43
 
42
44
  ### CP-SCOPE-03 规范用词(要求)
43
45
 
@@ -60,7 +62,7 @@ Reactive MD 分别维护以下版本轴:
60
62
 
61
63
  ### CP-SCOPE-05 适用范围(边界)
62
64
 
63
- 本协议适用于 `local-draft-2` 的 48 个标签名、它们的编译、运行时和参考渲染行为,以及向仓库提交新组块或修改现有组块的流程。
65
+ 本协议适用于 `local-draft-3` 的 49 个标签名、它们的编译、运行时和参考渲染行为,以及向仓库提交新组块或修改现有组块的流程。
64
66
 
65
67
  本文规定贡献与验收契约。作者教程和宿主 API 各有独立文档,HTML 可移植范围见 CP-CORE-03,扩展接口边界见 CP-CORE-05。
66
68
 
@@ -68,7 +70,7 @@ Reactive MD 分别维护以下版本轴:
68
70
 
69
71
  ### CP-MODEL-01 组块分类(现有)
70
72
 
71
- `local-draft-2` 固定 48 个标签名,分为以下类别:
73
+ `local-draft-3` 固定 49 个标签名,分为以下类别:
72
74
 
73
75
  | 类别 | 组块 | 说明 |
74
76
  | --- | --- | --- |
@@ -112,11 +114,11 @@ Reactive MD 分别维护以下版本轴:
112
114
  | 兼容分类 | 能力新增、破坏性变更或实现/编辑性变更 |
113
115
  | 验收证据 | 自动测试、机器验收数据和人工浏览器检查 |
114
116
 
115
- 当前声明表是 `src/local/schema.ts`,标签词法集合在 `src/local/parser.ts`,语义校验在 `src/local/compiler.ts`,写入约束在 `src/local/runtime.ts`,渲染在 `src/local/LocalDocumentView.tsx` 和 `src/local/visuals.tsx`。只改声明表不会自动获得解析、校验或渲染能力。
117
+ 当前声明表是 `src/local/configuration/schema.ts`,标签词法集合在 `src/local/parsing/parser.ts`,语义校验在 `src/local/compilation/compiler.ts`,写入约束在 `src/local/runtime/runtime.ts`,渲染在 `src/local/rendering/LocalDocumentView.tsx` 和 `src/local/widgets/visuals.tsx`。只改声明表不会自动获得解析、校验或渲染能力。
116
118
 
117
119
  ### CP-MODEL-04 名称集合(现有)
118
120
 
119
- `local-draft-2` 的 48 个名称是当前语法的完整集合。新增名称、删除名称或改变名称含义都属于作者可见变化,按第 10 节处理。实现可以在内部使用未公开的节点类型,但作者只能使用这里和语法规范列出的名称。
121
+ `local-draft-3` 的 49 个名称是当前语法的完整集合。新增名称、删除名称或改变名称含义都属于作者可见变化,按第 10 节处理。实现可以在内部使用未公开的节点类型,但作者只能使用这里和语法规范列出的名称。
120
122
 
121
123
  ## 3. 名称、语法和属性
122
124
 
@@ -185,7 +187,7 @@ $$ y = x^2 $$
185
187
 
186
188
  ### CP-SYNTAX-08 作者能力边界(现有)
187
189
 
188
- 作者不能执行脚本、写入可执行 HTML、提供作者 CSS、注册事件处理器或声明网络服务调用。图片与链接受 CP-SEC-02 的宿主 URL 策略约束。`<script>`、`<style>`、`on-*`、`class`、`style` 和旧版 directive 都不属于 `local-draft-2`。完整未知标签按源码降级,结构不完整或无法恢复的标签产生错误。文档内容不会作为任意 HTML 执行。
190
+ 作者不能执行脚本、写入可执行 HTML、提供作者 CSS、注册事件处理器或声明网络服务调用。图片与链接受 CP-SEC-02 的宿主 URL 策略约束。`<script>`、`<style>`、`on-*`、`class`、`style` 和旧版 directive 都不属于 `local-draft-3`。完整未知标签按源码降级,结构不完整或无法恢复的标签产生错误。文档内容不会作为任意 HTML 执行。
189
191
 
190
192
  ## 4. 绑定与状态
191
193
 
@@ -312,11 +314,12 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
312
314
 
313
315
  `plot` 是计算型可视化的代表:
314
316
 
315
- - 正文只能是空白和一个或多个 `$$...$$` 公式块;每块显式写成 `y = 表达式`。
316
- - `min`、`max` 可以动态,要求 `min < max`;静态范围在编译期校验,动态范围在渲染时校验,非法范围显示局部错误,不静默截断。
317
+ - 正文只能是空白和一个或多个 `$$...$$` 公式块;每块定义一条显式 `y = 表达式` 曲线、一条参数方程 `\begin{cases} x = f(t) \\ y = g(t) \end{cases}` 曲线,或一条关于 `x` 和 `y` 的隐式方程。
318
+ - `min`、`max` 可以动态,要求 `min < max`;静态范围在编译期校验,动态范围在渲染时校验,非法范围显示局部错误,不静默截断。对显式曲线它们是横轴范围,对参数方程是 `t` 的范围,对隐式方程决定方形追踪区域。
317
319
  - `samples` 是静态整数,范围 2 到 2000;每个 `plot` 最多 16 条曲线。
320
+ - 显式或参数曲线请求 `samples` 个采样点;隐式曲线每轴追踪 `samples`×`samples` 网格(上限 100、下限 32),按网格面积计入请求点数。
318
321
  - 整篇文档的曲线采样点总数最多 20,000,包括隐藏区域;绘图计算共享 2,000,000 步预算。
319
- - 公式只能引用已声明的数字参数;未声明参数或非数字参数在编译期诊断。
322
+ - 公式只能引用已声明的数字参数;未声明参数或非数字参数在编译期诊断。参数方程块内的 `t` 是局部参数,在那里不能读取为文档参数。
320
323
  - 非有限采样形成断点,不把断点两侧直接连线;没有有效值时显示空态。
321
324
  - 参考适配器提供图例、指针和键盘读数;真实指针、键盘和窄屏行为按第 11 节人工检查。
322
325
 
@@ -401,7 +404,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
401
404
 
402
405
  ### CP-LIFE-02 源码变化(现有)
403
406
 
404
- `LocalReactiveDocument` 在 `source` 变化时重新编译并创建新运行时,旧实例状态不保留。宿主自行管理生命周期时,用 `LocalDocumentView` 传入已编译文档和运行时,并负责在卸载时销毁运行时。React StrictMode 下的重复挂载由延迟销毁逻辑处理,不重复释放仍在使用的运行时。
407
+ `LocalReactiveDocument` 在 `source` 变化时重新编译,并尝试在原运行时中采用新文档,保留仍符合契约的绑定状态。影响编译语义的选项变化或文档无法采用时创建新运行时;切换为独立文档时可更换 React `key`。宿主自行管理生命周期时,用 `LocalDocumentView` 传入已编译文档和运行时,并在卸载时销毁运行时。React StrictMode 下的重复挂载由延迟销毁逻辑处理,不重复释放仍在使用的运行时。
405
408
 
406
409
  ### CP-LIFE-03 销毁(现有)
407
410
 
@@ -458,7 +461,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
458
461
 
459
462
  ### CP-SEC-05 扩展信任边界(边界)
460
463
 
461
- 本语言不为可信宿主扩展代码提供沙箱。若宿主自行注册或包装组块,安全边界由宿主负责,不能把作者文档中的 `disabled`、条件显示或客户端状态当作权限控制。`hostComponents` 选项只为单次编译登记纯 schema 数据,不携带可执行代码。宿主 renderer 是文档沙箱之外的可信宿主代码,安全边界仍由宿主负责;更完整的 SDK 需要单独定义信任模型。
464
+ 本语言不为可信宿主扩展代码提供沙箱。若宿主自行注册或包装组块,安全边界由宿主负责,不能把作者文档中的 `disabled`、条件显示或客户端状态当作权限控制。`hostComponents` 选项只为单次编译登记纯 schema 数据,不携带可执行代码。SDK 同样将数据 manifest 与宿主显式导入的实现分开;宿主 renderer 和 SDK 实现都由宿主管理代码权限。
462
465
 
463
466
  ## 9. 核心与渲染器分离
464
467
 
@@ -481,19 +484,21 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
481
484
 
482
485
  新增组块必须检查以下接入点,按其行为修改对应实现;复用现有通用校验时,应在提案中说明:
483
486
 
484
- 1. `src/local/parser.ts` 的 `VOID`、`PAIRED`、`INLINE` 形态集合(按形态)。
485
- 2. `src/local/schema.ts` 的声明表。
486
- 3. `src/local/compiler.ts` 的结构、属性、绑定和初值校验。
487
- 4. `src/local/runtime.ts` 的写入约束(若引入新的公开值或状态)。
488
- 5. `src/local/LocalDocumentView.tsx` 和 `src/local/visuals.tsx` 的参考渲染。
489
- 6. `src/local/limits.ts` 的预算(若引入新的计算或集合)。
487
+ 1. 公开 manifest 的 `form`;解析器从实例配置读取形态。
488
+ 2. 组件定义与实例注册;默认组件定义位于 `src/presets/default-components.ts`,`src/local/configuration/schema.ts` 是其兼容投影。
489
+ 3. manifest 的属性、结构、绑定、初值与规则;编译器统一执行声明。
490
+ 4. 通用内核原语的写入约束(若现有公开规则无法表达新的值或状态)。
491
+ 5. 通过公开 React SDK 注册的实现;默认实现位于 `src/components/`。
492
+ 6. `src/local/configuration/limits.ts` 的预算(若引入新的计算或集合)。
490
493
  7. 样式、测试、示例、语法文档、集成文档和验收数据。
491
494
 
492
- 只加 `schema.ts` 一项不会自动获得解析、校验或渲染能力。
495
+ 使用现有公开规则的组件只需定义、实现和注册。新增内核原语时,同时补充其公开契约与验收用例。
493
496
 
494
497
  ### CP-CORE-05 扩展接口边界(边界)
495
498
 
496
- 当前修订没有运行时可装载的组块实现、`registerComponent` API、全局注册器或作者插件入口。`LOCAL_COMPONENTS` 是内部冻结表。`hostComponents` 选项(第 14 节)只为单次编译接受纯 schema 数据;组块实现留在宿主代码中,绝不从文档内容装载。未来 SDK 若提供通用注册接口,需要新的协议修订,并明确信任模型、版本协商、预算和验收方式。
499
+ 本修订描述组件贡献要求和第 14 节的旧宿主接口。`LOCAL_COMPONENTS` 是默认预设的内部兼容投影;`hostComponents` 为单次编译接受纯 schema 数据,并作为输入适配到统一内核,组件实现由宿主提供。
500
+
501
+ [扩展 SDK](../integration/extension-sdk-ch.md)随 `reactive-md@0.7.0` 发布,使用独立的 `reactive-md-component/v1` 数据契约和实例级配置,提供注册校验、React 实现绑定、编辑器目录、离线构建、版本恢复和公开合规工具。46 个默认渲染与结构组件采用同一公开契约。组件代码由宿主主动安装,文档声明不会装载代码。
497
502
 
498
503
  ## 10. 兼容、名称治理、修订和迁移
499
504
 
@@ -509,11 +514,11 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
509
514
 
510
515
  ### CP-COMPAT-02 语法修订(现有)
511
516
 
512
- 作者可见的语法变化会建立新的语法修订,例如 `local-draft-2`,同时提升包次版本并更新 `LOCAL_SYNTAX_VERSION`。项目不自动改写源码;升级后由作者或宿主按变更记录迁移。一个包版本只接受一个语法修订。
517
+ 作者可见的语法变化会建立新的语法修订,例如 `local-draft-3`,同时提升包次版本并更新 `LOCAL_SYNTAX_VERSION`。项目不自动改写源码;升级后由作者或宿主按变更记录迁移。一个包版本只接受一个语法修订。
513
518
 
514
519
  ### CP-COMPAT-03 协议修订(要求)
515
520
 
516
- 以下变化提升协议修订,例如从 `component-protocol-1` 到 `component-protocol-2`:
521
+ 以下变化提升协议修订,例如从 `component-protocol-2` 到 `component-protocol-3`:
517
522
 
518
523
  - 修改 MUST 或 MUST NOT 条款。
519
524
  - 新增必填的组块声明信息或验收门槛。
@@ -524,7 +529,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
524
529
 
525
530
  ### CP-COMPAT-04 名称治理(要求)
526
531
 
527
- - 新名称必须是小写 kebab-case,语义明确,避免与现有 48 个名称冲突。
532
+ - 新名称必须是小写 kebab-case,语义明确,避免与现有 49 个名称冲突。
528
533
  - 不使用 `script`、`style`、`div`、`span`、`a` 等 HTML 名称,也不使用 `on-*`、`class`、`style` 作为作者属性。
529
534
  - 在 `component-protocol-1` 内,现有 48 个名称保留给现有语义;复用名称表示破坏性变更。
530
535
  - 不提供隐式别名。别名需要单独名称、文档和验收证据。
@@ -563,7 +568,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
563
568
 
564
569
  ### CP-ACCEPT-02 机器验收数据(要求)
565
570
 
566
- 机器验收集的根对象只包含 `protocolVersion`、`syntaxVersion` 和非空 `cases`。现有作者组块集把前两者固定为 `component-protocol-1` 和 `local-draft-2`,并作为第 14 节所述的 v1 冻结基线;包版本由 `package.json` 标识,不从这两个字段推断。
571
+ 机器验收集的根对象只包含 `protocolVersion`、`syntaxVersion` 和非空 `cases`。冻结的作者组块集 `examples/conformance/component-protocol-1.json` 仍为 `component-protocol-1` / `local-draft-2`;当前可移植语法集为 `examples/conformance/local-draft-3.json`。两者都按各自声明的修订校验。
567
572
 
568
573
  每个 case 至少包含唯一字符串 `id`、组块名 `component`、源码 `source`、布尔 `ok` 和去重诊断码集合 `codes`。可选字段 `initial`、`bindingNames`、`actions`、`reset`、`text`、`expectedText`、`htmlIncludes`、`htmlExcludes` 按[语言验收数据说明](../../examples/conformance/README.md)和仓库附带的 JSON Schema 使用。完整格式以该说明和 Schema 为准,本协议只规定语义门槛。
569
574
 
@@ -578,7 +583,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
578
583
 
579
584
  `initial` 和 `reset.expectedState` 做部分匹配;`bindingNames` 检查完整公开绑定名集合;`text` 与 `expectedText` 必须成对。
580
585
 
581
- 冻结的作者组块集覆盖 `slider`、`tabs`、`plot` 的代表性用例和至少一个完整未知标签降级用例。它仍是代表性门槛,不是 48 个标签名的全面认证;宿主组块没有可移植机器用例。
586
+ 冻结的作者组块集覆盖 `slider`、`tabs`、`plot` 的代表性用例和至少一个完整未知标签降级用例。它仍是代表性门槛,不是全部标签名的全面认证;宿主组块没有可移植机器用例。
582
587
 
583
588
  ### CP-ACCEPT-03 组件级证据(要求)
584
589
 
@@ -616,32 +621,27 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
616
621
 
617
622
  | 契约面 | 主要位置 | 说明 |
618
623
  | --- | --- | --- |
619
- | 标签词法与形态 | `src/local/parser.ts` | `VOID`、`PAIRED`、`INLINE`,未知标签降级,脚注屏蔽 |
620
- | 组块声明 | `src/local/schema.ts` | 名称、形态、子项规则、属性、绑定、初值规则 |
621
- | 编译校验 | `src/local/compiler.ts` | 结构、属性、初值、共享约束、表达式、表格和绘图预算 |
622
- | 运行时 | `src/local/runtime.ts` | `get`、`set`、`evaluate`、`text`、`reset`、`resetToken`、`dispose` |
623
- | React 参考适配器 | `src/local/LocalDocumentView.tsx` | 文档容器、控件、布局、可访问名称、重置和生命周期 |
624
- | 可视化适配器 | `src/local/visuals.tsx`、`src/local/math.ts`、`src/local/math-view.tsx` | 表格、图表、绘图、时间轴、图解和数学渲染 |
625
- | 样式 | `src/styles.css`、`src/theme.css`、`src/base.css`、`src/local/local.css`、`src/local/visuals.css` | 全局样式表、主题变量和组件样式 |
626
- | 预算 | `src/local/limits.ts` | 共享资源上限 |
627
- | 版本 | `src/local/version.ts`、`package.json` | 语法修订和包版本 |
624
+ | 标签词法与形态 | `src/local/parsing/parser.ts` | `VOID`、`PAIRED`、`INLINE`,未知标签降级,脚注屏蔽 |
625
+ | 组块声明 | `src/local/configuration/schema.ts` | 名称、形态、子项规则、属性、绑定、初值规则 |
626
+ | 编译校验 | `src/local/compilation/compiler.ts` | 结构、属性、初值、共享约束、表达式、表格和绘图预算 |
627
+ | 运行时 | `src/local/runtime/runtime.ts` | `get`、`set`、`evaluate`、`text`、`reset`、`resetToken`、`dispose` |
628
+ | React 参考适配器 | `src/local/rendering/LocalDocumentView.tsx` | 文档容器、控件、布局、可访问名称、重置和生命周期 |
629
+ | 可视化适配器 | `src/local/widgets/visuals.tsx`、`src/local/evaluation/math.ts`、`src/local/widgets/math-view.tsx` | 表格、图表、绘图、时间轴、图解和数学渲染 |
630
+ | 样式 | `src/styles.css`、`src/theme.css`、`src/base.css`、`src/local/rendering/local.css`、`src/local/widgets/visuals.css` | 全局样式表、主题变量和组件样式 |
631
+ | 预算 | `src/local/configuration/limits.ts` | 共享资源上限 |
632
+ | 版本 | `src/local/contracts/version.ts`、`package.json` | 语法修订和包版本 |
628
633
  | 验收 | `tests/`、`examples/conformance/` | 语言测试和机器验收数据 |
629
634
  | 文档 | `docs/`、`README.md`、`CONTRIBUTING-ch.md`、`SECURITY-ch.md` | 语法、集成、兼容、安全和贡献规则 |
630
635
 
631
636
  ### CP-IMPL-02 当前覆盖范围(现有 / 边界)
632
637
 
633
- 当前实现已覆盖解析、声明、编译、运行时、React 渲染、资源预算和发布检查。真实键盘、输入法、375px 和计时器暂停需要对应的浏览器自动检查或人工检查;单文件导出之外的通用 SSR 水合未验证。`component-protocol-1` 的机器数据是代表性门槛,不是全部 48 个标签名的认证。
638
+ 当前实现已覆盖解析、声明、编译、运行时、React 渲染、资源预算和发布检查。真实键盘、输入法、375px 和计时器暂停需要对应的浏览器自动检查或人工检查;单文件导出之外的通用 SSR 水合未验证。`component-protocol-1` 的机器数据是代表性门槛,不是全部标签名的认证。
634
639
 
635
640
  ### CP-IMPL-03 扩展接口(边界)
636
641
 
637
- 除第 14 节的编译期 schema 和 React renderer 扩展轴外,更完整的 SDK 还需要单独定义:
638
-
639
- - 组块声明的机器格式和版本协商。
640
- - 宿主注册 API 的信任模型和沙箱边界。
641
- - 新增组块的预算、可访问性和验收门槛。
642
- - 与 `local-draft-2` 语法修订的关系。
642
+ 第 14 节保留旧 schema 与 renderer 接口;新组件使用[扩展 SDK](../integration/extension-sdk-ch.md)的 manifest、实例配置和适配器。SDK 协议、组件版本、主题协议、恢复载荷与 `local-draft-3` 语法修订分别管理。
643
643
 
644
- 这些能力属于后续工作,不能作为当前验收依据,也不能在文档中写成已经提供。
644
+ manifest 与绑定测试使用 `reactive-md/testing`,渲染与生命周期证据分别使用 `testing/react` 和 `testing/browser`。组件仍须满足本协议的预算、可访问性与行为要求。宿主显式安装实现并负责其代码权限;SDK 校验契约和资源,不提供第三方代码沙箱。
645
645
 
646
646
  ## 13. 新组块提案模板
647
647
 
@@ -652,7 +652,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
652
652
  | 项目 | 填写内容 |
653
653
  | --- | --- |
654
654
  | 组块名 | `<name>`(小写 kebab-case) |
655
- | 协议修订 | `component-protocol-2` |
655
+ | 协议修订 | `component-protocol-3` |
656
656
  | 用途 | 解决什么问题,读者如何使用 |
657
657
  | 非目标 | 本组块不承担的能力 |
658
658
  | 版本影响 | 包版本、语法修订、协议修订 |
@@ -704,7 +704,7 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
704
704
 
705
705
  ### CP-HOST-01 宿主组件是可选扩展(现有)
706
706
 
707
- `compileLocal(source, { hostComponents })` 为编译器增加一条宿主拥有的扩展轴。不传 `hostComponents` 时,作者行为不变:48 个作者标签名照常解析,集合之外的标签仍是未知标签,并按 CP-DIAG-03 降级为原文。该选项只改变本次调用识别的标签名,不增加作者语法。语法修订仍为 `local-draft-2`,协议修订变为 `component-protocol-2`。
707
+ `compileLocal(source, { hostComponents })` 为编译器增加一条宿主拥有的扩展轴。不传 `hostComponents` 时,作者行为不变:49 个作者标签名照常解析,集合之外的标签仍是未知标签,并按 CP-DIAG-03 降级为原文。该选项只改变本次调用识别的标签名,不增加作者语法。协议修订为 `component-protocol-3`。
708
708
 
709
709
  ### CP-HOST-02 宿主 Schema 是普通数据(要求)
710
710
 
@@ -712,15 +712,15 @@ range-slider 和 coordinate 的每个数值槽位也独占拥有绑定;范围
712
712
 
713
713
  | 字段 | 内容 |
714
714
  | --- | --- |
715
- | `name` | 小写 kebab-case,在集合内唯一,不能是 48 个作者标签名、P0 HTML 标签名或主题声明名 `theme` |
716
- | `form` | `'leaf'`;宿主组块没有正文 |
715
+ | `name` | 小写 kebab-case,在集合内唯一,不能是 49 个作者标签名、P0 HTML 标签名或主题声明名 `theme` |
716
+ | `form` | `'leaf'`、`'inline'` 或 `'container'`;inline 与 container 的正文按普通 Markdown 编译,可包含组件 |
717
717
  | `props` | 宿主属性表;属性名使用小写 kebab-case |
718
718
 
719
719
  每次编译最多接受 32 个宿主组块 Schema。每个属性声明 `kind`(`string`、`number`、`boolean` 或 `enum`)、`required`、`static`、`enum` 和 `pattern`。`enum` 用于 `enum` 属性,`pattern` 用于 `string` 属性。P0 HTML 标签名保留给解析器优先处理的 HTML,不得复用。`pattern` 限制在线性时间安全子集内:拒绝反向引用、环视、命名组、嵌套量词和被量词修饰的分支。非法 Schema 以 `local.options.invalid` 诊断拒绝;编译失败,该集合不会部分生效。
720
720
 
721
721
  ### CP-HOST-03 宿主组块不是作者语法(边界)
722
722
 
723
- 宿主组块不属于 `local-draft-2`,不能当作可移植的作者语法。使用它们的文档只有在登记了相同名称和兼容 Schema 的宿主中才能渲染;普通读者会把每个名称当作未知组块,按 CP-DIAG-03 的既有降级处理。作者不能假定宿主组块一定存在,面向可移植的文档不应使用它们。
723
+ 宿主组块不属于作者语法修订,不能当作可移植的作者语法。使用它们的文档只有在登记了相同名称和兼容 Schema 的宿主中才能渲染;普通读者会把每个名称当作未知组块,按 CP-DIAG-03 的既有降级处理。作者不能假定宿主组块一定存在,面向可移植的文档不应使用它们。
724
724
 
725
725
  ### CP-HOST-04 属性校验与预算(要求)
726
726
 
@@ -734,12 +734,13 @@ React 视图把 `hostComponent` 节点分发给 `hostRenderer(node, data, ctx)`
734
734
 
735
735
  缺少渲染器、缺少 `${kind}:${ref}` 键或渲染器抛出异常时,显示可见的诊断占位,不得让异常冒出文档或使其余内容变空白。`mode === 'static'` 走同一分发路径,因此宿主未提供渲染器或数据时,静态渲染显示相同的占位。
736
736
 
737
- 可移植的机器用例仍是 `examples/conformance/component-protocol-1.json`,它作为 48 个作者组块的基线保持冻结。宿主组块不提供可移植验收用例,因为渲染由宿主拥有,普通读者只能看到未知组块降级。
737
+ 可移植的机器用例仍是 `examples/conformance/component-protocol-1.json`,它作为作者组块的基线保持冻结;当前语法用例位于 `examples/conformance/local-draft-3.json`。宿主组块不提供可移植验收用例,因为渲染由宿主拥有,普通读者只能看到未知组块降级。
738
738
 
739
739
  ## 15. 修订记录
740
740
 
741
741
  | 修订 | 日期 | 说明 |
742
742
  | --- | --- | --- |
743
+ | `component-protocol-3` | 2026-10-29 | 宿主组件新增 inline/container 形态和标量绑定;`local-draft-3` 增加 `<external>` 和动态约束。 |
743
744
  | `component-protocol-2` | 2026-10-25 | 新增宿主组件扩展轴;作者语法仍为 `local-draft-2`。 |
744
745
  | `component-protocol-1` | 2026-10-23 | 初版;最初适用于 `local-draft-1` 和包版本 `0.3.0`,定义组块贡献、验收和扩展边界。现在适用于 `local-draft-2` 和 `0.4.0` 预览版,MUST 条款和机器格式不变。 |
745
746