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,126 @@
1
+ # 0.8.0 发布说明(2026-11-12)
2
+
3
+ **中文** · [English](release-0.8.0-en.md)
4
+
5
+ 本页记录 `reactive-md@0.8.0` 的发行内容、破坏性变更和发布检查。引擎先发布,编辑器随后发布:`reactive-md-editor@0.1.0` 是独立仓库中的独立包。
6
+
7
+ ## 发布状态
8
+
9
+ | 项目 | 值 |
10
+ | --- | --- |
11
+ | 引擎包 | `reactive-md@0.8.0`(2026-11-12;latest) |
12
+ | 编辑器包 | `reactive-md-editor@0.1.0`(独立包;在引擎之后发布) |
13
+ | SDK 契约 | `0.7.0`(`LOCAL_SDK_VERSION`,保持不变) |
14
+ | 语法 | `local-draft-3`(保持不变) |
15
+ | 组块协议 | `component-protocol-3`(保持不变) |
16
+ | 主题协议 | `reactive-md-theme-1`(保持不变) |
17
+ | 状态格式 | `reactive-md-state/v1`;`reactive-md-component-state/v1` |
18
+ | 运行环境 | Node.js 22.12 或更新版本;仅 ESM |
19
+
20
+ 引擎和编辑器发布后,安装:
21
+
22
+ ```sh
23
+ npm install reactive-md@0.8.0
24
+ npm install reactive-md-editor@0.1.0
25
+ npm install react@19 react-dom@19
26
+ ```
27
+
28
+ `reactive-md/react` 和 `reactive-md-editor` 需要 `react`、`react-dom` 19。Vite 8 是 `reactive-md` 的可选 peer,仅在使用的 `reactive-md/vite` 时需要。
29
+
30
+ ## 破坏性变更
31
+
32
+ 引擎包不再导出编辑器。旧入口属于已发布的 0.7 包,不会进入 0.8。
33
+
34
+ | `reactive-md` 0.8 移除的入口 | 替代入口 |
35
+ | --- | --- |
36
+ | `reactive-md/editor` | `reactive-md-editor` |
37
+ | `reactive-md/editor/codemirror` | `reactive-md-editor/codemirror` |
38
+ | `reactive-md/editor/styles.css` | `reactive-md-editor/styles.css` |
39
+ | `reactive-md/editor/codemirror/styles.css` | `reactive-md-editor/codemirror/styles.css` |
40
+
41
+ 编辑器仍是受控的 React 19 组件,编辑能力保持不变:高亮、工具栏与插入命令、补全、绑定导航、重命名与格式化、撤销重做、诊断和 ref 句柄。见[编辑器指南](../integration/editor-ch.md)和[三仓库迁移说明](../integration/repository-split-ch.md)。
42
+
43
+ 本次变更不附带文档语法或状态格式迁移。`local-draft-3` 仍是唯一接受的修订,SDK、组块、主题和状态协议保持原值。恢复状态时仍校验源码摘要、组件配置键和身份。
44
+
45
+ ## 最小升级步骤
46
+
47
+ 1. 将引擎升级到 `reactive-md@0.8.0`。
48
+ 2. 如果应用渲染源码编辑器,添加 `reactive-md-editor@0.1.0`,并替换上表中的四个导入与样式表路径。源码继续保存在应用状态中,预览继续使用 `reactive-md/react`。
49
+ 3. 如果应用使用 `reactive-md/vite` 的 `reactiveMd()`,保留现有 Vite 配置。目录发现不需要改导入;适配器本身需要 Vite 8。
50
+ 4. 文档源码和状态文件保持原样。升级后用应用自己的文档重新运行编译与渲染检查。
51
+
52
+ ## 编译入口
53
+
54
+ 本次发布新增两个单次编译入口,返回普通数据,由宿主执行或渲染:
55
+
56
+ ```ts
57
+ import { createCompiler } from 'reactive-md/compiler';
58
+ import { createStandardCompiler } from 'reactive-md/compiler/standard';
59
+
60
+ const minimal = createCompiler().compile('# Notes');
61
+ const standard = createStandardCompiler().compile('<number bind="n" initial="2">\n\n{{ n * 3 }}');
62
+ ```
63
+
64
+ `createCompiler` 不注册组件,保留 CommonMark、RMD 结构、表达式、绑定和预算。`createStandardCompiler` 安装默认预设和 KaTeX 展示检查。编译不创建编辑会话、Worker 或运行时,也不加载 React、主题实现或 CSS。结果使用 `status: 'valid' | 'recovered' | 'failed'`,并保留 `ok`、`document` 读取方式。最小入口的结果带有自己的组件配置键,把它交给使用默认配置的现有渲染器会报告 `local.extension.config-mismatch`;现有 React 与 SSR 宿主应使用标准入口。
65
+
66
+ 两个工厂都接受 `strict`,严格模式是默认值。设置 `strict: false` 后,未闭合或错配的区域保留为原始文本,每个最终恢复产生一条稳定 warning,编译在可靠边界继续。可恢复的结构问题不会降级绑定、类型、配置、版本或预算错误。两种模式都把无空行的 `<details>` / `<summary>` 片段映射为单个 disclosure。见[单次编译入口](../integration/compiler-ch.md)和[严格模式与局部恢复](../reference/tolerance-ch.md)。
67
+
68
+ ## 运行时服务与持久化
69
+
70
+ 新增公开入口覆盖组件的时间、随机和进度保存:
71
+
72
+ - `reactive-md/runtime` 提供文档与组件身份、可序列化种子随机、注入式时钟与调度器、组件状态注册表及其预算。
73
+ - `reactive-md/runtime/browser` 提供基于 Web Storage 的持久化后端和 `flushComponentStateOnPageHide`。注册表接受任意 `LocalComponentStateStorage`。
74
+ - `reactive-md/react/runtime` 提供 `useTicker`、`useFrame`、`useSwipe`、`useKeys` 和 `useComponentState`。
75
+
76
+ `LocalRuntimeOptions` 和 React 文档组件接受 `documentId`、`randomSeed`、`componentState`、`componentStateStorage` 与 `componentStateWriteDelayMs`。写入延迟可合并高频保存;`state.flush()` 立即写入待处理状态,运行时销毁时也会补写。后端写入失败时最新状态保持待写,下一次保存、flush 或销毁会重试。`onComponentStateChange` 报告显式保存与清除。
77
+
78
+ 组件状态使用独立的 `reactive-md-component-state/v1` sidecar,不改变 `reactive-md-state/v1`。跨编辑恢复需要显式 `state-key`;没有该属性时,只保证同一源码和同一会话内可恢复。SDK 契约版本仍为 0.7.0;扩展装配发生变化时,需要重新编译,并按实际配置重新导出。
79
+
80
+ ## Vite 目录
81
+
82
+ 当 `reactiveMd()` 未传入 `extensions` 模块时,适配器扫描 Vite 根目录下 `theme/` 与 `plugin/` 的直接子目录:
83
+
84
+ ```text
85
+ theme/paper/theme.css
86
+ theme/paper/theme.json # 可选
87
+ plugin/tetris/index.ts
88
+ plugin/tetris/component.css # 可选
89
+ ```
90
+
91
+ 主题 CSS、本地导入和相对资源通过有界构建资源收集器解析并内联。远程引用、越界路径和预算超限会失败。使用 `reactiveMd({ extensions: './extensions.ts' })` 的手动注册仍然可用;目录选项与手动选项互斥。见[目录接入规则](../integration/directory-discovery-ch.md)。
92
+
93
+ ## 默认 UI、图表、Mafs、图解与画廊
94
+
95
+ - `<gallery>` 与 `<gallery-item>` 进入默认预设和插入目录。它们混排图片、卡片与 Markdown,使用原生强制停靠,支持滚轮、键盘和拖动浏览,使用 h3 标题,并生成完整的静态输出。
96
+ - 默认图表为每个柱子提供独立的悬浮与聚焦目标,在环形图图例中显示每个可见扇区的占比,并允许图例开关系列或扇区。柱、线、点和弧的几何变化带有动画;减少动态效果偏好会跳过动画。
97
+ - 交互式 `<coordinate>` 与 `<plot>` 使用 Mafs,支持拖拽吸附点、平移缩放、点击曲线聚焦并淡化其余曲线,以及聚焦曲线上的鼠标跟随点。服务端渲染、静态导出与打印保留 SVG 输出。
98
+ - 默认主题图解在悬浮或聚焦节点时显示说明浮层,增加缩放与适应控制、关联路径高亮、整框状态配色和长标题处理。静态输出保留节点说明。
99
+ - 默认主题本轮还让函数图按轴范围适配并保持屏幕网格正方形,让 tooltip 浮层避开嵌套容器裁剪,恢复主按钮文字对比度,统一 Jump 按钮样式,并为可交互选项增加短促的选中反馈。
100
+
101
+ ## 静态、SSR 与离线边界
102
+
103
+ - 交互式导出内嵌经过校验的 `reactive-md-component-state/v1` sidecar,并在首次渲染前恢复。静态导出不运行组件运行时,并拒绝 `--component-state-file`。
104
+ - Mafs 交互只存在于客户端渲染器。服务端渲染、静态导出和打印使用 SVG 坐标与曲线输出。
105
+ - 打包消费者检查覆盖静态 SSR 与声明文件。单文件导出和水合的浏览器验收由宿主应用与 Demo 负责。
106
+ - 离线 HTML 内嵌源码、运行时、样式和经过校验的本地位图。组件状态与状态文件仅在其格式和身份匹配时参与。
107
+
108
+ ## 发布与验收
109
+
110
+ 本次发布使用手动 `.github/workflows/publish.yml`、npm trusted publishing(OIDC)、Node 24 和 npm ^11.21。workflow 文件名保持稳定,以匹配已配置的 trusted publisher。提交或推送不会发布 npm 包。发布需要明确授权。
111
+
112
+ 按以下顺序发布:
113
+
114
+ 1. 发布 `reactive-md@0.8.0`;核对 registry 中的 tarball、完整性和本次选择的 dist-tags。
115
+ 2. 引擎可用后发布 `reactive-md-editor@0.1.0`;编辑器的 peer 范围指向已发布的引擎。
116
+
117
+ 打包前,引擎运行 `npm run check` 和 `npm run notices`。检查包括构建和类型检查、保留的回归、编译入口边界,以及把实际 tarball 安装到全新消费者中验证公开 API 和 NodeNext 声明。registry 完整性与 dist-tags 属于发布后的独立检查。
118
+
119
+ ## 发布当天清单
120
+
121
+ - 对照完成的发布核对日期与状态。
122
+ - 查询 registry 中的已发布版本后,再更新 README 的安装 pin 和兼容性页的分发标签行。
123
+ - 发布编辑器前,确认其 peer 范围指向已发布的引擎。
124
+ - 记录两个包经过验证的 registry tarball 与完整性值。
125
+
126
+ 另见[版本与兼容性](../compatibility/compatibility-ch.md)、[源码修订与迁移](../compatibility/source-versioning-ch.md),以及上一个已发布版本的[0.7.0 发布说明](release-0.7.0-ch.md)。
@@ -0,0 +1,126 @@
1
+ # 0.8.0 release (2026-11-12)
2
+
3
+ **English** · [中文](release-0.8.0-ch.md)
4
+
5
+ This page records the contents, breaking change and publication checks for `reactive-md@0.8.0`. The engine publishes first, then the editor: `reactive-md-editor@0.1.0` is a separate package in a separate repository.
6
+
7
+ ## Release status
8
+
9
+ | Item | Value |
10
+ | --- | --- |
11
+ | Engine package | `reactive-md@0.8.0` (2026-11-12; latest) |
12
+ | Editor package | `reactive-md-editor@0.1.0` (separate package; publish after the engine) |
13
+ | SDK contract | `0.7.0` (`LOCAL_SDK_VERSION`, unchanged) |
14
+ | Syntax | `local-draft-3` (unchanged) |
15
+ | Component protocol | `component-protocol-3` (unchanged) |
16
+ | Theme protocol | `reactive-md-theme-1` (unchanged) |
17
+ | State formats | `reactive-md-state/v1`; `reactive-md-component-state/v1` |
18
+ | Runtime | Node.js 22.12 or newer; ESM only |
19
+
20
+ After the engine and the editor are published, install:
21
+
22
+ ```sh
23
+ npm install reactive-md@0.8.0
24
+ npm install reactive-md-editor@0.1.0
25
+ npm install react@19 react-dom@19
26
+ ```
27
+
28
+ `react` and `react-dom` 19 are required by `reactive-md/react` and `reactive-md-editor`. Vite 8 is an optional peer of `reactive-md`, needed only when using `reactive-md/vite`.
29
+
30
+ ## Breaking changes
31
+
32
+ The engine package no longer exports the editor. The old entries belong to published 0.7 packages and do not move to 0.8.
33
+
34
+ | Removed from `reactive-md` 0.8 | Replacement |
35
+ | --- | --- |
36
+ | `reactive-md/editor` | `reactive-md-editor` |
37
+ | `reactive-md/editor/codemirror` | `reactive-md-editor/codemirror` |
38
+ | `reactive-md/editor/styles.css` | `reactive-md-editor/styles.css` |
39
+ | `reactive-md/editor/codemirror/styles.css` | `reactive-md-editor/codemirror/styles.css` |
40
+
41
+ The editor remains a controlled React 19 component with the same editing surface: highlighting, toolbar and insertion commands, completion, binding navigation, rename and format, undo and redo, diagnostics and the ref handle. See the [editor guide](../integration/editor-en.md) and the [repository migration guide](../integration/repository-split-en.md).
42
+
43
+ No document-syntax or state-format migration accompanies this change. `local-draft-3` remains the only accepted revision, and the SDK, component, theme and state protocols keep their previous values. State restoration still checks the source digest, component configuration key and identity.
44
+
45
+ ## Minimal upgrade
46
+
47
+ 1. Update the engine to `reactive-md@0.8.0`.
48
+ 2. If the application renders the source editor, add `reactive-md-editor@0.1.0` and replace the four imports and stylesheet paths in the table above. Keep the source in application state and the preview in `reactive-md/react`.
49
+ 3. If the application uses `reactiveMd()` from `reactive-md/vite`, keep the existing Vite setup. Directory discovery needs no import change; the adapter itself requires Vite 8.
50
+ 4. Keep document sources and state files as they are. Run the application's compile and render checks against its own documents after the upgrade.
51
+
52
+ ## Compiler entries
53
+
54
+ The release adds two one-shot compiler entries that return plain data for a host to run or render:
55
+
56
+ ```ts
57
+ import { createCompiler } from 'reactive-md/compiler';
58
+ import { createStandardCompiler } from 'reactive-md/compiler/standard';
59
+
60
+ const minimal = createCompiler().compile('# Notes');
61
+ const standard = createStandardCompiler().compile('<number bind="n" initial="2">\n\n{{ n * 3 }}');
62
+ ```
63
+
64
+ `createCompiler` registers no components and keeps CommonMark, RMD structure, expressions, bindings and budgets. `createStandardCompiler` installs the default preset and the KaTeX display checks. Compilation creates no editing session, Worker or runtime and loads no React, theme implementation or CSS. Results use `status: 'valid' | 'recovered' | 'failed'` and keep the `ok` and `document` read path. A minimal result carries its own component configuration key, so passing it to the existing renderer with its default configuration reports `local.extension.config-mismatch`; use the standard entry for the existing React and SSR hosts.
65
+
66
+ Both factories accept `strict`. Strict mode is the default. With `strict: false`, an unclosed or mismatched region stays as literal source, each finalized recovery produces one stable warning, and compilation resumes at a reliable boundary. Recoverable structure does not downgrade binding, type, configuration, version or budget errors. Both modes map a blank-line-free `<details>` / `<summary>` fragment to one disclosure. See [one-shot compilation](../integration/compiler-en.md) and [strict parsing and local recovery](../reference/tolerance-en.md).
67
+
68
+ ## Runtime services and persistence
69
+
70
+ New public entries cover component time, randomness and saved progress:
71
+
72
+ - `reactive-md/runtime` provides document and component identity, serializable seeded randomness, an injectable clock and scheduler, the component-state registry and its budgets.
73
+ - `reactive-md/runtime/browser` provides a Web Storage persistence backend and `flushComponentStateOnPageHide`. The registry accepts any `LocalComponentStateStorage`.
74
+ - `reactive-md/react/runtime` provides `useTicker`, `useFrame`, `useSwipe`, `useKeys` and `useComponentState`.
75
+
76
+ `LocalRuntimeOptions` and the React document components accept `documentId`, `randomSeed`, `componentState`, `componentStateStorage` and `componentStateWriteDelayMs`. A write delay coalesces high-frequency saves; `state.flush()` writes pending state, and runtime disposal also flushes. A failed backend keeps the latest state pending so the next save, flush or disposal retries it. `onComponentStateChange` reports explicit saves and clears.
77
+
78
+ Component state uses the separate `reactive-md-component-state/v1` sidecar. It does not change `reactive-md-state/v1`. Cross-edit restore requires an explicit `state-key`; without it, restore is limited to the same source and session. The SDK contract remains at 0.7.0; changes to the extension assembly require recompilation and a fresh export for that configuration.
79
+
80
+ ## Vite directories
81
+
82
+ When `reactiveMd()` is called without an `extensions` module, the adapter discovers immediate children of `theme/` and `plugin/` under the Vite root:
83
+
84
+ ```text
85
+ theme/paper/theme.css
86
+ theme/paper/theme.json # optional
87
+ plugin/tetris/index.ts
88
+ plugin/tetris/component.css # optional
89
+ ```
90
+
91
+ Theme CSS, local imports and relative assets are resolved and inlined through the bounded build-resource collector. Remote references, paths outside the allowed directory and budget violations fail. Manual registration with `reactiveMd({ extensions: './extensions.ts' })` remains available; directory and manual options are mutually exclusive. See [directory integration](../integration/directory-discovery-en.md).
92
+
93
+ ## Default UI, charts, Mafs, diagrams and gallery
94
+
95
+ - `<gallery>` and `<gallery-item>` join the default preset and insertion catalog. They mix images, cards and Markdown, use native mandatory snapping, support wheel, keyboard and thumb navigation, take h3 captions and produce complete static output.
96
+ - Default charts give each bar its own hover and focus target, show each visible donut slice's share in the legend, and let legend items toggle series or slices. Bars, lines, points and arcs animate geometry changes; reduced-motion preferences skip the animation.
97
+ - Interactive `<coordinate>` and `<plot>` use Mafs for draggable snapped points, pan and zoom, click-to-focus curves with dimmed backgrounds and a pointer-tracked point on the focused curve. Server rendering, static export and print keep the SVG output.
98
+ - Default-theme diagrams show node notes in hover and focus popovers, add zoom and fit controls, highlight related paths, use full-frame status colors and handle long labels. Static output retains the node descriptions.
99
+ - The default-theme round also fits function plots to their axis ranges with square screen-space grids, lets tooltip layers escape nested clipping, restores primary-button text contrast, aligns Jump buttons with standard buttons and adds brief selection feedback to interactive options.
100
+
101
+ ## Static, SSR and offline boundaries
102
+
103
+ - Interactive export embeds the validated `reactive-md-component-state/v1` sidecar and restores it before the first render. Static export runs no component runtime and rejects `--component-state-file`.
104
+ - Mafs interaction exists only in the client renderer. Server rendering, static export and print use the SVG coordinate and plot output.
105
+ - The packed-consumer check covers static SSR and declarations. The host application and Demo own browser acceptance for single-file exports and hydration.
106
+ - Offline HTML embeds the source, runtime, styles and verified local raster images. Component state and state files participate only where their formats and identities match.
107
+
108
+ ## Publishing and acceptance
109
+
110
+ The release uses the manual `.github/workflows/publish.yml` workflow with npm trusted publishing (OIDC), Node 24 and npm ^11.21. The workflow filename stays stable to match the configured trusted publisher. A repository push does not publish npm packages. Publication requires explicit authorization.
111
+
112
+ Publish in this order:
113
+
114
+ 1. Publish `reactive-md@0.8.0`; verify the registry tarball, integrity and the selected dist-tags.
115
+ 2. Publish `reactive-md-editor@0.1.0` after the engine is available; the editor names the published engine in its peer range.
116
+
117
+ Before packing, the engine runs `npm run check` and `npm run notices`. The check builds and type-checks, runs retained regressions, verifies the compiler entry boundary and installs the actual tarball into a fresh consumer for public API and NodeNext declaration checks. Registry integrity and dist-tags are separate post-publish checks.
118
+
119
+ ## Publish-day checklist
120
+
121
+ - Confirm the release date and status against the completed publication.
122
+ - Update the README install pin and the compatibility distribution-tag row only after querying the registry for the published versions.
123
+ - Confirm the editor peer range names the published engine before publishing the editor.
124
+ - Record the verified registry tarball and integrity values for both packages.
125
+
126
+ See [versions and compatibility](../compatibility/compatibility-en.md), [source revisions and migration](../compatibility/source-versioning-en.md), and the [0.7.0 release notes](release-0.7.0-en.md) for the previous published release.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yaozitao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ # Notices
2
+
3
+ This package template is released under the MIT license.
4
+
5
+ - `src/assets/notice.svg` is an original local asset created for this template.
6
+ It is inlined as a `data:image/svg+xml` URL so exported offline documents make
7
+ no network requests.
8
+ - `react` and `react-dom` are distributed under the MIT license.
9
+ - `reactive-md` is distributed under the MIT license.
10
+
11
+ The `notices` entry passed to `buildLocalStandaloneBundle` should contain this
12
+ text so offline bundles keep attribution with their resources.
@@ -0,0 +1,101 @@
1
+ # Reactive MD 组件包模板
2
+
3
+ **中文** · [English](README.md)
4
+
5
+ 这是一个可复制的 npm 组件包,定义评分控件与 Markdown 提示容器,附带主题包和内联 SVG 资源,并用公开合规工具验证安装后的包。所有导入都来自公开的 `reactive-md` 入口。
6
+
7
+ 本模板依赖 `reactive-md@^0.8.0`。把本目录复制到仓库之外;0.8.0 发布前,安装由当前源码新打包出的引擎 tarball,发布后可运行 `npm install` 从 registry 安装。SDK 契约仍为 `0.7.0`。
8
+
9
+ ## 公开入口
10
+
11
+ 组件包只导入以下入口:
12
+
13
+ - `reactive-md/sdk`
14
+ - `reactive-md/presets/default`
15
+ - `reactive-md/react`
16
+ - `reactive-md/react/server`
17
+ - `reactive-md/standalone`
18
+ - `reactive-md/testing`
19
+ - `reactive-md/testing/react`
20
+ - `reactive-md/testing/browser`
21
+ - `reactive-md/build`(仅导出 bundle)
22
+
23
+ ## 目录内容
24
+
25
+ | 路径 | 用途 |
26
+ | --- | --- |
27
+ | `src/manifests.ts` | `rating` 与 `note` 的有界 JSON manifest。 |
28
+ | `src/components.tsx` | React 实现、主题组合与配置。 |
29
+ | `src/theme.ts`、`src/theme.css` | 使用 `defineLocalTheme` 的主题包与作用域变量。 |
30
+ | `src/component.css` | 组件结构样式。 |
31
+ | `src/assets/notice.svg`、`NOTICES.md` | 本地资源与署名声明。 |
32
+ | `src/harness.tsx` | 用于直接挂载 React 的开发页面。 |
33
+ | `sample/document.reactive.md` | 使用组件包与主题的示例文档。 |
34
+ | `scripts/build.mjs` | 构建 Node/SSR 入口、类型声明、浏览器载体页与离线 HTML。 |
35
+ | `scripts/verify.mjs` | 运行 manifest、绑定、静态、SSR 与浏览器合规检查。 |
36
+ | `scripts/build-export.mjs` | 通过 `buildLocalStandaloneBundle` 生成离线导出。 |
37
+
38
+ ## 命令
39
+
40
+ ```sh
41
+ npm install
42
+ npm run build # JS、类型、载体页与离线 HTML
43
+ npm test # 完整合规:Node、SSR、浏览器生命周期与离线
44
+ npm run test:node # 仅 manifest、运行时绑定、静态与 SSR
45
+ npm run typecheck
46
+ ```
47
+
48
+ `npm run build` 生成:
49
+
50
+ - `dist/node/entry.mjs`、`dist/node/manifest.mjs`、`dist/node/theme.mjs`
51
+ - `dist/types/*.d.ts`
52
+ - `dist/harness.html` 与 `dist/harness/harness.js`
53
+ - `dist/interactive.html`、`dist/static.html`、`dist/standalone.js`
54
+ - `dist/build-manifest.json`、`dist/resources.json`、`dist/build.json`
55
+
56
+ `npm test` 先构建,再运行完整合规套件。浏览器检查覆盖评分控件和单独的 note 生命周期,以 `file:` 打开 `dist/interactive.html`,在断网上下文中运行,并断言 http(s)/ws 请求为零。该命令需要 Playwright 和浏览器;缺少任一项时命令以非零状态退出,不会把离线或浏览器生命周期报告为通过。
57
+
58
+ `npm run test:node` 跳过浏览器套件。它打印离线与浏览器证据未执行,并写出 `complete:false`。
59
+
60
+ ## 生成的包入口
61
+
62
+ `package.json` 提供编译后的 JavaScript 和类型声明:
63
+
64
+ | 子路径 | JavaScript | 类型 |
65
+ | --- | --- | --- |
66
+ | `.` | `dist/node/manifest.mjs` | `dist/types/manifests.d.ts` |
67
+ | `./react` | `dist/node/entry.mjs` | `dist/types/node-entry.d.ts` |
68
+ | `./theme` | `dist/node/theme.mjs` | `dist/types/theme.d.ts` |
69
+ | `./styles.css` | `src/component.css` | 无 |
70
+
71
+ 类型声明从 `src` 生成,并重写相对导入以保留显式扩展名。
72
+
73
+ ## 各类检查证明什么
74
+
75
+ - Manifest 用例重新读取 JSON manifest,重新应用声明的默认值,并拒绝非法字段、默认值和取值。
76
+ - 绑定用例先编译示例源码,再执行真实的 `set` 与 `setMany` 调用。接受的写入改变参数并推进 revision;拒绝的写入保持参数与 revision 不变;重置恢复作者声明的初值并推进 reset token。
77
+ - 静态与 SSR 用例通过 `reactive-md/react/server` 渲染真实 React 实现。两次 SSR 输出必须一致。
78
+ - 浏览器用例证明挂载、编辑、隐藏/显示、禁用、重置、子组件错误隔离和卸载。离线能力还要求 hydration、断网上下文、无意外页面错误与无网络请求。
79
+ - 声明了某能力但缺少带标签的通过用例时,该能力保持 `skipped` 或 `unsupported`,汇总报告失败。
80
+
81
+ 构建步骤给出规范的资源列表。同一个 `resources` 数组同时传给 `renderLocalStaticDocument` 和 `runLocalReactCompliance`,因此 SSR 与合规检查使用完全相同的 CSS。
82
+
83
+ 报告写入 `dist/compliance.json`;载体页为 `dist/harness.html`。
84
+
85
+ ## 离线导出
86
+
87
+ `scripts/build-export.mjs` 调用 `reactive-md/build` 的 `buildLocalStandaloneBundle`。它先写出显式的宿主模块 `dist/build-host.mjs`,该模块导出:
88
+
89
+ - `config` 与 `reactConfig`
90
+ - `root`
91
+ - `allowlist`
92
+ - `resources`
93
+ - `notices`
94
+
95
+ 资源收集器读取 allowlist 内声明的文件。构建器将 JavaScript 依赖打成单个 IIFE 脚本,内联 CSS、字体和图片,返回包含 `script`、`extensions`、`seal`、`resources`、`assets`、`css`、`notices`、`manifest` 的扁平对象。脚本再把 bundle 和资源交给 `createLocalShareableHtml`,分别生成交互与静态 HTML。静态 HTML 同样经过严格 server 入口渲染;遇到不可用组件时直接失败。
96
+
97
+ 浏览器用例加载 `dist/interactive.html`,在断网状态下检查生命周期行为。
98
+
99
+ ## 发布这个包
100
+
101
+ 模板保留 `"private": true`。重命名 `name`,选择许可证并更新 `LICENSE` 和 `NOTICES.md`;准备发布到 npm 时移除 `"private": true`。
@@ -0,0 +1,133 @@
1
+ # Reactive MD component package template
2
+
3
+ **English** · [中文](README-ch.md)
4
+
5
+ A copyable npm package that defines a rating control and a Markdown note
6
+ container, ships a package theme and an inlined SVG asset, and runs the public
7
+ compliance tools against the installed package. Every import comes from a
8
+ public `reactive-md` entry.
9
+
10
+ This template targets `reactive-md@^0.8.0`. Copy this folder outside the repository. Before 0.8.0 is published, install a freshly packed engine tarball from the current source; after publication, run `npm install` against the registry. The SDK contract remains at `0.7.0`.
11
+
12
+ ## Public entries
13
+
14
+ The package imports only these entry points:
15
+
16
+ - `reactive-md/sdk`
17
+ - `reactive-md/presets/default`
18
+ - `reactive-md/react`
19
+ - `reactive-md/react/server`
20
+ - `reactive-md/standalone`
21
+ - `reactive-md/testing`
22
+ - `reactive-md/testing/react`
23
+ - `reactive-md/testing/browser`
24
+ - `reactive-md/build` (export bundle only)
25
+
26
+ ## Contents
27
+
28
+ | Path | Purpose |
29
+ | --- | --- |
30
+ | `src/manifests.ts` | Bounded JSON manifests for `rating` and `note`. |
31
+ | `src/components.tsx` | React implementations, theme composition, configs. |
32
+ | `src/theme.ts`, `src/theme.css` | `defineLocalTheme` package with scoped variables. |
33
+ | `src/component.css` | Component structure styles. |
34
+ | `src/assets/notice.svg`, `NOTICES.md` | Local asset and attribution notices. |
35
+ | `src/harness.tsx` | Optional development page for direct React mounting. |
36
+ | `sample/document.reactive.md` | Sample document using the package and theme. |
37
+ | `scripts/build.mjs` | Builds the Node/SSR entry, types, browser harness page and offline HTML. |
38
+ | `scripts/verify.mjs` | Runs manifest, binding, static, SSR and browser compliance. |
39
+ | `scripts/build-export.mjs` | Offline export through `buildLocalStandaloneBundle`. |
40
+
41
+ ## Commands
42
+
43
+ ```sh
44
+ npm install
45
+ npm run build # JS, types, harness page and offline HTML
46
+ npm test # full compliance: Node, SSR, browser lifecycle and offline
47
+ npm run test:node # manifest, runtime bindings, static and SSR only
48
+ npm run typecheck
49
+ ```
50
+
51
+ `npm run build` writes:
52
+
53
+ - `dist/node/entry.mjs`, `dist/node/manifest.mjs`, `dist/node/theme.mjs`
54
+ - `dist/types/*.d.ts`
55
+ - `dist/harness.html` and `dist/harness/harness.js`
56
+ - `dist/interactive.html`, `dist/static.html`, `dist/standalone.js`
57
+ - `dist/build-manifest.json`, `dist/resources.json`, `dist/build.json`
58
+
59
+ `npm test` runs the build, then executes the full compliance suite. The browser
60
+ run covers the rating control and a separate note lifecycle, loads
61
+ `dist/interactive.html` from `file:` in an offline context, and asserts zero
62
+ http(s)/ws requests. It requires Playwright and a browser. If either is
63
+ missing, the command exits nonzero and does not report offline or browser
64
+ lifecycle as passed.
65
+
66
+ `npm run test:node` skips the browser suite. It prints that offline and browser
67
+ evidence was not executed and writes `complete:false`.
68
+
69
+ ## Generated package exports
70
+
71
+ `package.json` exposes compiled JavaScript plus declarations:
72
+
73
+ | Subpath | JavaScript | Types |
74
+ | --- | --- | --- |
75
+ | `.` | `dist/node/manifest.mjs` | `dist/types/manifests.d.ts` |
76
+ | `./react` | `dist/node/entry.mjs` | `dist/types/node-entry.d.ts` |
77
+ | `./theme` | `dist/node/theme.mjs` | `dist/types/theme.d.ts` |
78
+ | `./styles.css` | `src/component.css` | n/a |
79
+
80
+ The declarations are emitted from `src` and rewritten so relative imports keep
81
+ explicit extensions.
82
+
83
+ ## What each suite proves
84
+
85
+ - Manifest cases re-read the JSON manifest, reapply declared defaults and reject
86
+ illegal fields, defaults and values.
87
+ - Binding cases compile the sample, then perform real `set`/`setMany` calls.
88
+ Accepted writes change parameters and advance the revision. Rejected writes
89
+ leave values and revision unchanged. Reset restores authored initials and
90
+ advances the reset token.
91
+ - Static and SSR cases render the real React implementation through
92
+ `reactive-md/react/server`. Two SSR passes must be identical.
93
+ - Browser cases prove mount, edit, hide/show, disabled, reset, descendant error
94
+ isolation and unmount. Offline capability additionally requires a hydration
95
+ pass, an offline context, no unexpected page errors and no network requests.
96
+ - A declared capability without a passed, tagged case stays `skipped` or
97
+ `unsupported`, and the aggregate report fails.
98
+
99
+ The canonical resource list comes from the build step. The same `resources`
100
+ array is passed to `renderLocalStaticDocument` and `runLocalReactCompliance`, so
101
+ SSR and the compliance run see identical CSS.
102
+
103
+ Reports are written to `dist/compliance.json`; the harness page is
104
+ `dist/harness.html`.
105
+
106
+ ## Offline export
107
+
108
+ `scripts/build-export.mjs` calls `buildLocalStandaloneBundle` from
109
+ `reactive-md/build`. It first writes an explicit host module,
110
+ `dist/build-host.mjs`, which exports:
111
+
112
+ - `config` and `reactConfig`
113
+ - `root`
114
+ - `allowlist`
115
+ - `resources`
116
+ - `notices`
117
+
118
+ The resource collector resolves files inside the declared allowlist. The builder bundles one IIFE script, inlines
119
+ CSS, fonts and images, and returns a flat object with `script`, `extensions`,
120
+ `seal`, `resources`, `assets`, `css`, `notices` and `manifest`. The script then
121
+ passes the bundle and its resources to `createLocalShareableHtml` for both
122
+ interactive and static output. The static HTML is also rendered by the same
123
+ strict server entry, so it fails on an unavailable component instead of shipping
124
+ a placeholder.
125
+
126
+ The browser suite loads `dist/interactive.html` and checks lifecycle behavior
127
+ with network access disabled.
128
+
129
+ ## Publishing this package
130
+
131
+ The template sets `"private": true`. Rename `name`, choose a license and update
132
+ `LICENSE` and `NOTICES.md`, then remove `"private": true` only when you intend to publish the
133
+ package to npm. This template does not publish anything.
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "reactive-md-component-package-template",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Copyable Reactive MD component and theme package with Node, SSR and browser compliance checks.",
7
+ "license": "MIT",
8
+ "files": ["dist/node", "dist/types", "src/component.css", "src/theme.css", "src/assets", "NOTICES.md", "README.md", "README-ch.md"],
9
+ "exports": {
10
+ ".": { "types": "./dist/types/manifests.d.ts", "import": "./dist/node/manifest.mjs" },
11
+ "./react": { "types": "./dist/types/node-entry.d.ts", "import": "./dist/node/entry.mjs" },
12
+ "./theme": { "types": "./dist/types/theme.d.ts", "import": "./dist/node/theme.mjs" },
13
+ "./styles.css": "./src/component.css"
14
+ },
15
+ "scripts": {
16
+ "build": "node scripts/build.mjs",
17
+ "build:export": "npm run build",
18
+ "test": "npm run build && node scripts/verify.mjs",
19
+ "test:node": "npm run build && node scripts/verify.mjs --no-browser",
20
+ "test:browser": "npm run build && node scripts/verify.mjs",
21
+ "typecheck": "tsc --noEmit"
22
+ },
23
+ "dependencies": {
24
+ "reactive-md": "^0.8.0",
25
+ "react": "^19.0.0",
26
+ "react-dom": "^19.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@playwright/test": "^1.64.0",
30
+ "@types/react": "^19.0.0",
31
+ "@types/react-dom": "^19.0.0",
32
+ "typescript": "^7.0.0",
33
+ "vite": "^8.0.0"
34
+ }
35
+ }
@@ -0,0 +1,14 @@
1
+ <theme name="paper">
2
+
3
+ # Component package sample
4
+
5
+ <checkbox bind="show" label="Show rating" initial="true">
6
+ <checkbox bind="lock" label="Lock rating">
7
+
8
+ <if when="{{ show }}">
9
+ <note title="Notes" tone="info" disabled="{{ lock }}">
10
+ Current score: **{{ score }}**.
11
+
12
+ <rating bind="score" label="Score" max="5" initial="3" locked="{{ lock }}">
13
+ </note>
14
+ </if>
@@ -0,0 +1,44 @@
1
+ import { readFile, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { fileURLToPath, pathToFileURL } from 'node:url';
4
+ import { buildLocalStandaloneBundle } from 'reactive-md/build';
5
+ import { compileLocal, createLocalRuntime, exportLocalState } from 'reactive-md';
6
+ import { createLocalShareableHtml } from 'reactive-md/export';
7
+ import { renderLocalStaticDocument } from 'reactive-md/react/server';
8
+
9
+ const root = path.resolve(fileURLToPath(new URL('..', import.meta.url)));
10
+ const entry = await import(pathToFileURL(path.join(root, 'dist/node/entry.mjs')).href);
11
+ const cssUrl = import.meta.resolve('reactive-md/styles.css');
12
+ const css = await readFile(fileURLToPath(cssUrl), 'utf8');
13
+ const notices = [
14
+ { id: 'example/package', license: 'MIT', text: (await readFile(path.join(root, 'LICENSE'), 'utf8')) + '\n' + await readFile(path.join(root, 'NOTICES.md'), 'utf8') },
15
+ { id: 'reactive-md/license', license: 'MIT', text: await readFile(new URL('../LICENSE', cssUrl), 'utf8') },
16
+ { id: 'reactive-md/dependencies', text: await readFile(new URL('../THIRD_PARTY_NOTICES.md', cssUrl), 'utf8') },
17
+ ...await Promise.all(['react', 'react-dom'].map(async name => ({ id: name, license: 'MIT',
18
+ text: await readFile(new URL('./LICENSE', import.meta.resolve(name + '/package.json')), 'utf8') }))),
19
+ ];
20
+ // Only this explicitly allowed host module supplies implementations and files.
21
+ const host = path.join(root, 'dist/build-host.mjs');
22
+ await writeFile(host, [
23
+ "export {config,reactConfig} from './node/entry.mjs';",
24
+ 'export const root=' + JSON.stringify(root) + ';',
25
+ "export const allowlist=['src'];",
26
+ "export const resources=[{id:'example/component.css',path:'src/component.css'}];",
27
+ 'export const notices=' + JSON.stringify(notices) + ';',
28
+ ].join('\n'));
29
+ const bundle = await buildLocalStandaloneBundle({ entry: host });
30
+ const compiled = compileLocal(entry.source, { config: entry.config });
31
+ if (!compiled.ok) throw new Error(JSON.stringify(compiled.diagnostics));
32
+ const runtime = createLocalRuntime(compiled.document);
33
+ try {
34
+ const rendered = renderLocalStaticDocument({ document: compiled.document, runtime, reactConfig: entry.reactConfig, resources: bundle.resources });
35
+ if (!rendered.ok) throw new Error(JSON.stringify(rendered.diagnostics));
36
+ const options = { source: entry.source, document: compiled.document, config: entry.config,
37
+ state: exportLocalState(runtime), staticMarkup: rendered.markup, css, title: 'Component package',
38
+ bundle, resources: bundle.resources, notices: bundle.notices };
39
+ await writeFile(path.join(root, 'dist/interactive.html'), createLocalShareableHtml({ ...options, mode: 'interactive' }));
40
+ await writeFile(path.join(root, 'dist/static.html'), createLocalShareableHtml({ ...options, mode: 'static' }));
41
+ await writeFile(path.join(root, 'dist/standalone.js'), bundle.script);
42
+ await writeFile(path.join(root, 'dist/build-manifest.json'), JSON.stringify(bundle.manifest, null, 2));
43
+ } finally { runtime.dispose(); }
44
+ console.log('Built offline interactive/static HTML with local resources and notices.');