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,73 @@
1
+ import type { LocalValue, SourceRange } from '../contracts/types.js';
2
+ /**
3
+ * Computable LaTeX for local plots.
4
+ *
5
+ * The parser builds an explicit AST; evaluation never uses eval/Function and
6
+ * only reads the independent variable x plus numeric bindings from the
7
+ * document. Unsupported structures (integrals, matrices, macros, ...) are
8
+ * rejected at compile time with an offset into the LaTeX source.
9
+ */
10
+ export declare class LatexError extends Error {
11
+ readonly code: string;
12
+ readonly offset: number;
13
+ constructor(code: string, message: string, offset?: number);
14
+ }
15
+ export interface LatexExpression {
16
+ readonly source: string;
17
+ dependencies: string[];
18
+ evaluate(x: number, env: Record<string, LocalValue>, budget?: LatexEvaluationBudget): number;
19
+ }
20
+ /** Shared step budget used by samplePlot so the whole curve has one bound. */
21
+ export interface LatexEvaluationBudget {
22
+ steps: number;
23
+ limit: number;
24
+ }
25
+ export interface PlotPoint {
26
+ x: number;
27
+ y: number | null;
28
+ /** Parameter value for parametric curves; absent for explicit and implicit curves. */
29
+ t?: number;
30
+ }
31
+ export interface PlotSample {
32
+ points: PlotPoint[];
33
+ endpoint: number | null;
34
+ }
35
+ /** A point on an implicit contour; both coordinates are defined. */
36
+ export interface PlotSegmentPoint {
37
+ x: number;
38
+ y: number;
39
+ }
40
+ /** One formula block inside a plot, ready for sampling. */
41
+ export type PlotFormulaKind = 'explicit' | 'parametric' | 'implicit';
42
+ export interface CompiledPlotFormula {
43
+ kind: PlotFormulaKind;
44
+ source: string;
45
+ /** Explicit y(x), parametric x(t), or implicit F(x, y). */
46
+ expression: LatexExpression;
47
+ /** Parametric y(t); null for the other kinds. */
48
+ yExpression: LatexExpression | null;
49
+ /** Parameters only; independent variables x and y are removed. */
50
+ dependencies: string[];
51
+ }
52
+ /** Internal authoring support: only AST variable nodes represent plot reads. */
53
+ export declare function localLatexReferences(source: string): {
54
+ name: string;
55
+ range: SourceRange;
56
+ }[];
57
+ export declare function compileLatex(source: string): LatexExpression;
58
+ /** Cheap classification used before compiling and sampling a plot block. */
59
+ export declare function plotFormulaKind(source: string): PlotFormulaKind | null;
60
+ /**
61
+ * Classifies one plot formula block.
62
+ *
63
+ * - `y = f(x)` is an explicit curve.
64
+ * - `\begin{cases} x = f(t) \\ y = g(t) \end{cases}` is a parametric curve.
65
+ * - Any other equation in x and y is implicit and traced as `left - right = 0`.
66
+ */
67
+ export declare function compilePlotFormula(source: string): CompiledPlotFormula;
68
+ /** Upper bound for the per-axis grid used to trace an implicit equation. */
69
+ export declare const MAX_IMPLICIT_GRID = 100;
70
+ /** Minimum grid resolution; smaller `samples` values are raised to this. */
71
+ export declare const MIN_IMPLICIT_GRID = 32;
72
+ /** Grid cells per axis for an implicit curve at a given plot sample count. */
73
+ export declare function implicitGridSize(samples: number): number;
@@ -1,4 +1,4 @@
1
- import type { Diagnostic, LocalValidation, SourceRange } from './types.js';
1
+ import type { Diagnostic, LocalValidation, SourceRange } from '../contracts/types.js';
2
2
  /**
3
3
  * Shared pieces for advisory cross-field rules (`<validation>`).
4
4
  *
@@ -0,0 +1,16 @@
1
+ import type { LocalNode } from '../contracts/types.js';
2
+ /**
3
+ * Split a `<details>` child list into its summary and body. A direct summary
4
+ * wins, matching the parser's historical behavior; only when none exists is a
5
+ * summary-bearing paragraph inspected. Later summaries stay in the body, and
6
+ * nested details are left untouched.
7
+ */
8
+ export declare function splitHtmlDetailsChildren(nodes: readonly LocalNode[]): {
9
+ summary?: LocalNode;
10
+ body: LocalNode[];
11
+ };
12
+ /**
13
+ * Parser-level normalization: store the summary first and the body afterwards.
14
+ * Idempotent, and safe to call on an already normalized list.
15
+ */
16
+ export declare function normalizeHtmlDetailsChildren(nodes: readonly LocalNode[]): LocalNode[];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decode character references with the browser grammar, never activating
3
+ * markup. This is the shared implementation for the strict HTML parser and
4
+ * the isolated HTML repair pass; `replaceNul` keeps the repaired tree free of
5
+ * NUL characters.
6
+ */
7
+ export declare function decodeLocalHtmlEntities(value: string, replaceNul?: boolean): string;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Shared P0 HTML policy and raw tag scanning.
3
+ *
4
+ * The strict Markdown parser, the structural recovery planner and the isolated
5
+ * HTML repair pass must agree on which tags, attributes and URL shapes are
6
+ * accepted. Keeping the tables and the lexical scanners here means a change to
7
+ * the accepted surface reaches every consumer, while each pass keeps its own
8
+ * structural decisions.
9
+ */
10
+ /** Inline P0 names and the Markdown node type they lower to. */
11
+ export declare const HTML_INLINE_NODE_TYPES: Readonly<Record<string, string>>;
12
+ /** Elements with no end tag in HTML, including the table-only `col`. */
13
+ export declare const HTML_VOID_ELEMENTS: ReadonlySet<string>;
14
+ /** Raw-text elements: markup-looking text inside them is inert source. */
15
+ export declare const HTML_RAW_TEXT_ELEMENTS: ReadonlySet<string>;
16
+ /** Attributes accepted on every P0 element. */
17
+ export declare const HTML_GLOBAL_ATTRIBUTES: ReadonlySet<string>;
18
+ /** Per-tag attribute surface beyond globals, ARIA and `data-*`. */
19
+ export declare const HTML_TAG_ATTRIBUTES: Readonly<Record<string, ReadonlySet<string>>>;
20
+ /**
21
+ * End offset (exclusive) of the tag starting at `from`, honoring quoted
22
+ * attribute values. Returns -1 when no `>` is found before `limit`.
23
+ */
24
+ export declare function htmlTagEnd(source: string, from: number, limit: number): number;
25
+ /**
26
+ * End offset of the comment starting at `start`. `<!-->` and `<!--->` are
27
+ * empty comments that end at their first `>`; searching only for `-->` would
28
+ * hide following markup from the validator.
29
+ */
30
+ export declare function htmlCommentEnd(source: string, start: number, limit: number): number;
31
+ /** URL comparison form: trimmed with embedded controls and spaces removed. */
32
+ export declare function normalizedHtmlUrl(value: string): string;
33
+ /** True when a URL scheme would escape the accepted P0 link/image surface. */
34
+ export declare function unsafeHtmlUrl(value: string, kind: 'link' | 'image'): boolean;
35
+ /**
36
+ * Attribute-name policy. `align` is handled separately because callers
37
+ * normalize it; `class`, `style` and event handlers never activate.
38
+ */
39
+ export declare function isHtmlAttributeNameAllowed(tag: string, name: string): boolean;
40
+ /** Value policy shared by inline HTML and isolated HTML repair. */
41
+ export declare function isValidHtmlAttributeValue(name: string, value: string): boolean;
42
+ /** Normalized `align` value for a tag that declares it, or null. */
43
+ export declare function htmlAlignValue(tag: string, value: string): string | null;
@@ -0,0 +1,16 @@
1
+ import type { LocalNode, LocalRecovery } from '../contracts/types.js';
2
+ /**
3
+ * Recover an isolated HTML fragment inside `[start, end)`.
4
+ *
5
+ * The caller passes a range already confirmed to need structural repair. The
6
+ * function parses only that slice, maps the repaired tree to the existing
7
+ * `LocalNode` model through `createNode`, and never writes the source back.
8
+ * Anything outside the supported P0 surface, any registered component tag,
9
+ * and any interpolation that cannot be kept inert returns `null`, which tells
10
+ * the caller to fall back to literal text for the whole range.
11
+ */
12
+ export declare function recoverLocalHtml(source: string, start: number, end: number, createNode: (type: string, start: number, end: number, extra?: Partial<LocalNode>) => LocalNode, componentNames: ReadonlySet<string>, contextTag?: string): {
13
+ nodes: LocalNode[];
14
+ recovery: LocalRecovery;
15
+ end: number;
16
+ } | null;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Theme-free table vocabulary shared by the parser, HTML policy and audit
3
+ * passes. Kept separate from `html-table.ts` so importing the accepted names
4
+ * never pulls the HTML parser into a compiler assembly that does not use it.
5
+ */
6
+ /** Contextual names: they do not reserve new component names globally. */
7
+ export declare const HTML_TABLE_NAMES: ReadonlySet<string>;
8
+ export declare const HTML_TABLE_ATTRIBUTES: Readonly<Record<string, ReadonlySet<string>>>;
9
+ export declare function validHtmlTableValue(name: string, value: string): boolean;
@@ -1,8 +1,5 @@
1
- import type { LocalNode } from './types.js';
2
- /** Contextual names: they do not reserve new component names globally. */
3
- export declare const HTML_TABLE_NAMES: ReadonlySet<string>;
4
- export declare const HTML_TABLE_ATTRIBUTES: Readonly<Record<string, ReadonlySet<string>>>;
5
- export declare function validHtmlTableValue(name: string, value: string): boolean;
1
+ import type { LocalNode } from '../contracts/types.js';
2
+ export { HTML_TABLE_NAMES, HTML_TABLE_ATTRIBUTES, validHtmlTableValue } from './html-table-names.js';
6
3
  export type HtmlTableProblem = 'structure' | 'mixed' | 'attribute' | 'value' | 'unclosed';
7
4
  interface Hooks {
8
5
  shield(offset: number, end: number): number | null;
@@ -22,4 +19,3 @@ export declare function readHtmlTable(source: string, start: number, limit: numb
22
19
  node: LocalNode;
23
20
  end: number;
24
21
  } | null;
25
- export {};
@@ -1,4 +1,4 @@
1
- import type { Diagnostic, LocalHtmlPolicy } from './types.js';
1
+ import type { Diagnostic, LocalHtmlPolicy } from '../contracts/types.js';
2
2
  export interface LocalHtmlSanitizeResult {
3
3
  markup: string;
4
4
  diagnostics: Diagnostic[];
@@ -1,24 +1,31 @@
1
- export { analyzeLocalSource, completeLocalSource, renameLocalBinding, formatLocalSource } from './authoring.js';
2
- export type { AuthorToken, AuthorBinding, AuthorAnalysis, AuthorCompletion, AuthorCompletionKind, AuthorRename } from './authoring.js';
3
- export { compileLocal } from './compiler.js';
4
- export { localCompileOptionsKey } from './options.js';
5
- export { formatLocalDiagnostic, LOCAL_DIAGNOSTIC_CODES, isLocalDiagnosticCode, localDiagnosticTemplate, localDiagnosticTemplateKeys, } from './diagnostics.js';
6
- export type { LocalDiagnosticDetails } from './diagnostics.js';
7
- export { countLocalCodePoints } from './text-length.js';
8
- export { createLocalRuntime } from './runtime.js';
9
- export { compileExpression, LocalExpressionError } from './expression.js';
10
- export { compileLatex, samplePlot } from './math.js';
11
- export { LOCAL_SYNTAX_VERSION } from './version.js';
12
- export { inspectLocalSourceVersion, checkLocalUpgrade, migrateLocalSource } from './source-migration.js';
13
- export type { LocalSourceVersion, LocalUpgradeOptions, LocalUpgradeReport, LocalMigrationResult } from './source-migration.js';
14
- export type { LocalVersionDeclaration } from './types.js';
15
- export type { LocalLocale } from './locale.js';
16
- export { LOCAL_THEME_PROTOCOL, DEFAULT_LOCAL_THEME, resolveLocalTheme, isLocalThemeName } from './theme.js';
17
- export type { LocalColorScheme, LocalThemeDefinition, LocalThemeResolution } from './theme.js';
18
- export type { Diagnostic, LocalDiagnosticParam, LocalDiagnosticParams, SourceRange, LocalValue, LocalValueKind, LocalNode, LocalBinding, LocalComputation, LocalValidation, LocalDocument, LocalHtmlOptions, LocalHtmlPolicy, LocalCompileLimits, LocalCompileOptions, LocalCompileResult, LocalRuntime, LocalSnapshot, LocalHostPropKind, LocalHostPropSchema, LocalHostComponentSchema } from './types.js';
19
- export { LOCAL_STATE_FORMAT, localSourceDigest, createLocalStateFile, parseLocalState, resolveLocalState, applyLocalState, exportLocalState, importLocalState, serializeLocalState, } from './state.js';
20
- export type { LocalStateGenerator, LocalStateFile, LocalStateParseResult, LocalStateResolution, } from './state.js';
21
- export { planLocalStateRetention, applyLocalStateRetention } from './retention.js';
22
- export type { LocalStateRetentionReason, LocalStateRetentionDrop, LocalStateRetentionInput, LocalRetainedState, LocalStateRetentionResult, } from './retention.js';
23
- export { LOCAL_COMPILE_DELAY_MS, LocalCompileScheduler, compileFailureDiagnostic, startLocalCompileWorker, } from './worker.js';
24
- export type { LocalCompileRequest, LocalCompileResponse, LocalCompileWorker, LocalCompileMode, LocalCompileOutcome, LocalCompileSchedulerOptions, LocalCompileWorkerScope, } from './worker.js';
1
+ export { analyzeLocalSource, completeLocalSource, renameLocalBinding, formatLocalSource } from './source/authoring.js';
2
+ export type { AuthorToken, AuthorBinding, AuthorAnalysis, AuthorCompletion, AuthorCompletionKind, AuthorRename } from './source/authoring.js';
3
+ export { compileLocal } from './compilation/compiler.js';
4
+ export { createLocalCompileSession, LocalCompileSession } from './session/incremental.js';
5
+ export type { LocalIncrementalStats } from './session/incremental.js';
6
+ export { localCompileOptionsKey } from './configuration/options.js';
7
+ export { formatLocalDiagnostic, LOCAL_DIAGNOSTIC_CODES, isLocalDiagnosticCode, localDiagnosticTemplate, localDiagnosticTemplateKeys, } from './configuration/diagnostics.js';
8
+ export type { LocalDiagnosticDetails } from './configuration/diagnostics.js';
9
+ export { countLocalCodePoints } from './source/text-length.js';
10
+ export { createLocalRuntime, updateLocalRuntime, notifyLocalRuntime } from './runtime/runtime.js';
11
+ export type { LocalRuntimeUpdateOptions, LocalRuntimeDocumentUpdate } from './runtime/runtime.js';
12
+ export { compileExpression, LocalExpressionError } from './evaluation/expression.js';
13
+ export { compileLatex, compilePlotFormula, implicitGridSize, plotFormulaKind } from './evaluation/math.js';
14
+ export { sampleImplicit, sampleParametric, samplePlot } from './evaluation/math-sample.js';
15
+ export type { CompiledPlotFormula, PlotFormulaKind, PlotPoint, PlotSample } from './evaluation/math.js';
16
+ export { LOCAL_SYNTAX_VERSION } from './contracts/version.js';
17
+ export { inspectLocalSourceVersion, checkLocalUpgrade, migrateLocalSource } from './source/source-migration.js';
18
+ export type { LocalSourceVersion, LocalUpgradeOptions, LocalUpgradeReport, LocalMigrationResult } from './source/source-migration.js';
19
+ export type { LocalVersionDeclaration } from './contracts/types.js';
20
+ export type { LocalLocale } from './contracts/locale.js';
21
+ export { LOCAL_THEME_PROTOCOL, DEFAULT_LOCAL_THEME, resolveLocalTheme, isLocalThemeName } from './theme/theme.js';
22
+ export type { LocalColorScheme, LocalThemeDefinition, LocalThemeResolution } from './theme/theme.js';
23
+ export type { Diagnostic, LocalDiagnosticParam, LocalDiagnosticParams, SourceRange, LocalRecovery, LocalValue, LocalValueKind, LocalNode, LocalBinding, LocalComputation, LocalExternal, LocalDynamicConstraint, LocalDynamicConstraints, LocalValidation, LocalDocument, LocalHtmlOptions, LocalHtmlPolicy, LocalCompileLimits, LocalCompileOptions, LocalCompileResult, LocalRuntime, LocalRuntimeOptions, LocalSnapshot, LocalHostPropKind, LocalHostPropSchema, LocalHostComponentForm, LocalHostBindingSchema, LocalHostComponentSchema } from './contracts/types.js';
24
+ export { LOCAL_STATE_FORMAT, localSourceDigest, createLocalStateFile, parseLocalState, resolveLocalState, applyLocalState, exportLocalState, importLocalState, serializeLocalState, } from './runtime/state.js';
25
+ export type { LocalStateGenerator, LocalStateFile, LocalStateParseResult, LocalStateResolution, } from './runtime/state.js';
26
+ export { planLocalStateRetention, applyLocalStateRetention } from './runtime/retention.js';
27
+ export type { LocalStateRetentionReason, LocalStateRetentionDrop, LocalStateRetentionInput, LocalRetainedState, LocalStateRetentionResult, } from './runtime/retention.js';
28
+ export { LOCAL_COMPILE_DELAY_MS, LOCAL_COMPILE_PREPARATION_DELAY_MS, localWorkerOptionsKey, LocalCompileScheduler, compileFailureDiagnostic, startLocalCompileWorker, } from './transport/worker.js';
29
+ export type { LocalCompileRequest, LocalCompileEditHint, LocalCompileResponse, LocalCompileWorker, LocalCompileMode, LocalCompileOutcome, LocalCompileSchedulerOptions, LocalCompileWorkerScope, LocalCompilePatchRequest, LocalCompileWorkerRequest, LocalCompilePatchResponse, LocalCompileWorkerResponse, LocalCompileFlatResponse, LocalCompileWorkerMetrics, LocalCompileMetrics, LocalCompileWorkerControl, LocalCompileWorkerControlMessage, LocalCompileWorkerOptions, } from './transport/worker.js';
30
+ export { LOCAL_RESULT_PATCH_PROTOCOL, diffSourceEdit, applySourceEdit, encodeLocalResultPatch, applyLocalResultPatch } from './transport/compile-patch.js';
31
+ export type { LocalSourceEdit, LocalResultPatch, LocalNodePatch, LocalDocumentPatch, LocalRecordPatch } from './transport/compile-patch.js';
@@ -0,0 +1,137 @@
1
+ import type { LocalNode } from '../contracts/types.js';
2
+ /** Offset-only Markdown nodes consumed by the existing semantic transform. */
3
+ interface FastNode {
4
+ type: string;
5
+ position: {
6
+ start: {
7
+ offset: number;
8
+ };
9
+ end: {
10
+ offset: number;
11
+ };
12
+ };
13
+ children?: FastNode[];
14
+ value?: string;
15
+ ordered?: boolean;
16
+ start?: number | null;
17
+ checked?: null;
18
+ align?: ('left' | 'right' | 'center' | null)[];
19
+ }
20
+ /**
21
+ * A fully validated scan of the simple Markdown subset. `nodeCount` and the
22
+ * overflow ranges are exact, not estimates: `emit` creates the final
23
+ * `LocalNode`s in the same children-first order as the remark transform, so a
24
+ * caller can enforce its cumulative budget without an intermediate tree.
25
+ */
26
+ export interface FastMarkdownPlan {
27
+ /** Advisory shielding scan; never materialize this plan as document nodes. */
28
+ readonly shieldOnly?: boolean;
29
+ /** Exact number of `LocalNode` constructions, excluding the root. */
30
+ readonly nodeCount: number;
31
+ /** Number of top-level nodes. */
32
+ readonly blockCount: number;
33
+ /** Exact scanned text this plan was validated against. */
34
+ readonly source: string;
35
+ /**
36
+ * Inline plans discovered while validating this block, keyed by exact inline
37
+ * text. A caller that recompiles a structurally similar block can hand this
38
+ * map back as an `InlinePlanLookup` so unchanged rows/items never have to be
39
+ * rescanned. Values may be `undefined` (a cached rejection).
40
+ */
41
+ readonly rows: ReadonlyMap<string, InlinePlan | undefined>;
42
+ /**
43
+ * Range of the `(remaining + 1)`-th node in transform order, or `undefined`
44
+ * when the plan does not construct that many nodes. Never creates nodes.
45
+ */
46
+ overflowAt(remaining: number): {
47
+ start: number;
48
+ end: number;
49
+ } | undefined;
50
+ /**
51
+ * Build the final nodes children-first. Validation already succeeded when a
52
+ * plan exists, so `create` is never called for an ambiguous document.
53
+ */
54
+ emit(create: (type: string, start: number, end: number, extra?: Partial<LocalNode>) => LocalNode): LocalNode[];
55
+ }
56
+ /** One validated inline token; offsets are relative to the scanned text. */
57
+ export interface InlineTextToken {
58
+ readonly type: 'text';
59
+ readonly from: number;
60
+ readonly to: number;
61
+ readonly value: string;
62
+ }
63
+ export interface InlineStrongToken {
64
+ readonly type: 'strong';
65
+ readonly from: number;
66
+ readonly to: number;
67
+ /** Inner text value; the inner range is `[from + 2, to - 2)`. */
68
+ readonly value: string;
69
+ }
70
+ export interface InlineOpaqueToken {
71
+ readonly type: 'opaque';
72
+ readonly from: number;
73
+ readonly to: number;
74
+ readonly value: string;
75
+ }
76
+ export type InlineToken = InlineTextToken | InlineStrongToken | InlineOpaqueToken;
77
+ /** Only parser-created interpolation placeholders may bypass Markdown syntax. */
78
+ export interface FastMarkdownContext {
79
+ /** Parser-owned same-line interpolation masking for the advisory first pass. */
80
+ readonly shield?: (text: string, offset: number) => string | undefined;
81
+ readonly allowBraces?: boolean;
82
+ readonly offset?: number;
83
+ readonly placeholders?: ReadonlyMap<number, {
84
+ readonly end: number;
85
+ readonly marker: string;
86
+ }>;
87
+ }
88
+ /** Read-only inline plan. `undefined` means the text is outside the subset. */
89
+ export type InlinePlan = readonly InlineToken[];
90
+ /**
91
+ * Row-level inline plans carried by a previous compile. Used in preference to
92
+ * the bounded global LRU so a sequence of edits over a large list/table never
93
+ * has to re-scan unchanged rows (and cannot thrash the LRU).
94
+ */
95
+ export type InlinePlanLookup = ReadonlyMap<string, InlinePlan | undefined>;
96
+ /** Distinguishes a cached rejection from a cache miss. */
97
+ export type CacheLookup<T> = {
98
+ readonly hit: true;
99
+ readonly value: T | undefined;
100
+ } | {
101
+ readonly hit: false;
102
+ };
103
+ /**
104
+ * Optional session cache used by the parser. Only read-only scan results are
105
+ * stored; implementations must bound their entry count.
106
+ */
107
+ export interface FastMarkdownCache {
108
+ readPlan(text: string): CacheLookup<FastMarkdownPlan>;
109
+ writePlan(text: string, value: FastMarkdownPlan | undefined): void;
110
+ readInline(text: string): CacheLookup<InlinePlan>;
111
+ writeInline(text: string, value: InlinePlan | undefined): void;
112
+ /** Called when an inline plan was served from this cache. */
113
+ noteInlineReuse?(kind: 'row' | 'item'): void;
114
+ /** Called when a non-rejected fast plan was served from this cache. */
115
+ notePlanReuse?(): void;
116
+ }
117
+ /**
118
+ * Legacy offset-only scanner. Its entry restriction is unchanged: inputs
119
+ * without a pipe or a list marker stay with remark. New production callers
120
+ * should use `planFastMarkdown`, which also accepts single-line prose.
121
+ */
122
+ export declare function parseFastMarkdown(source: string): FastNode | undefined;
123
+ /**
124
+ * Validate the whole input before exposing a plan. The counting pass uses
125
+ * placeholder values, so no `LocalNode` and no identifier/budget state exists
126
+ * until `emit` runs. Prose-only inputs are accepted here; the legacy entry
127
+ * restriction above applies only to `parseFastMarkdown`.
128
+ *
129
+ * When a session cache is supplied, identical block text reuses the complete
130
+ * plan (and, on a plan miss, identical rows/items reuse their inline plans).
131
+ * `rowPlans` is an additional, caller-owned hint from the previous revision;
132
+ * it is consulted before the bounded cache so large row blocks cannot thrash
133
+ * it. Inline plans are pure functions of their text, so this never changes
134
+ * validation, emission order or node counts.
135
+ */
136
+ export declare function planFastMarkdown(source: string, cache?: FastMarkdownCache, rowPlans?: InlinePlanLookup, context?: FastMarkdownContext): FastMarkdownPlan | undefined;
137
+ export {};
@@ -1,4 +1,4 @@
1
- import type { LocalDocument, LocalNode } from './types.js';
1
+ import type { LocalDocument, LocalNode } from '../contracts/types.js';
2
2
  /** One rendered reference occurrence and the endnote it points at. */
3
3
  export interface LocalFootnoteReferenceSite {
4
4
  node: LocalNode;
@@ -1,4 +1,14 @@
1
- import type { LocalDocument, LocalNode } from './types.js';
1
+ import type { LocalDocument, LocalNode } from '../contracts/types.js';
2
+ import type { LocalComponentDefinition } from '../../sdk/types.js';
3
+ /**
4
+ * Public anchor rules used by both navigation and its memo projection.
5
+ *
6
+ * The caller supplies the component semantics installed for this document
7
+ * (compiled documents carry their own `componentDefinitions`). This module
8
+ * never fills in a default preset: a document compiled without components
9
+ * contributes no explicit anchor rules.
10
+ */
11
+ export declare function anchorRuleAttributes(document: LocalDocument, installed?: readonly LocalComponentDefinition[]): ReadonlyMap<string, string>;
2
12
  /**
3
13
  * Heading slugs and explicit `<anchor>` ids share one per-render-instance
4
14
  * namespace. Author fragments (`#result`) resolve against either kind of
@@ -8,7 +18,7 @@ import type { LocalDocument, LocalNode } from './types.js';
8
18
  * Fragments use source initial values, so editing parameters preserves
9
19
  * navigation.
10
20
  */
11
- export declare function createHeadingAnchors(document: LocalDocument, namespace: string, includeExplicitAnchors?: boolean): {
21
+ export declare function createHeadingAnchors(document: LocalDocument, namespace: string, includeExplicitAnchors?: boolean, installed?: readonly LocalComponentDefinition[]): {
12
22
  ids: Map<LocalNode, string>;
13
23
  anchorIds: Map<LocalNode, string>;
14
24
  htmlIds: Map<LocalNode, string>;
@@ -0,0 +1,55 @@
1
+ import { type FastMarkdownCache, type InlinePlanLookup, type FastMarkdownContext } from './fast-markdown.js';
2
+ import type { SourceContext } from '../source/source-context.js';
3
+ /** Per-parse accounting used by the compiler's performance diagnostics. */
4
+ export interface MarkdownBlockStats {
5
+ fastBlocks: number;
6
+ generalBlocks: number;
7
+ fastCharacters: number;
8
+ generalCharacters: number;
9
+ lines: number;
10
+ }
11
+ export interface Candidate {
12
+ from: number;
13
+ to: number;
14
+ type: string;
15
+ }
16
+ export interface MarkdownStructure {
17
+ candidates: Candidate[];
18
+ maxDepth: number;
19
+ codeRanges: {
20
+ start: number;
21
+ end: number;
22
+ }[];
23
+ }
24
+ /**
25
+ * Split a Markdown document into independently parseable simple blocks.
26
+ *
27
+ * A whole-document fast plan is used when possible. Otherwise Lezer only
28
+ * proposes top-level boundaries; every proposal is re-validated with the fast
29
+ * planner, which rejects syntax whose meaning depends on surrounding context.
30
+ * Safe ranges are blanked with equal-length spaces (line endings preserved) and
31
+ * parsed once by the general parser, so reference and footnote resolution still
32
+ * sees the whole document. Any overlap between a general node and a blanked
33
+ * range means the boundaries were not trustworthy and the whole source is
34
+ * re-parsed normally.
35
+ */
36
+ export declare function parseMarkdownBlocks(source: string, parseGeneral: (source: string) => any, context?: SourceContext, cache?: FastMarkdownCache, structure?: MarkdownStructure, rowPlans?: InlinePlanLookup, fastContext?: FastMarkdownContext): {
37
+ tree: any;
38
+ stats: MarkdownBlockStats;
39
+ };
40
+ export interface MarkdownTreeFacts {
41
+ codeRanges: {
42
+ start: number;
43
+ end: number;
44
+ }[];
45
+ definitions: {
46
+ start: number;
47
+ end: number;
48
+ }[];
49
+ mathLiterals: {
50
+ start: number;
51
+ end: number;
52
+ }[];
53
+ }
54
+ /** One iterative semantic-fact traversal shared by shielding and containers. */
55
+ export declare function markdownTreeFacts(tree: any, enterFootnotes?: boolean): MarkdownTreeFacts;
@@ -0,0 +1,3 @@
1
+ import type { MarkdownStructure } from './markdown-blocks.js';
2
+ /** Lezer is advisory only: its top-level nodes seed candidate ranges. */
3
+ export declare function scanMarkdownStructure(source: string): MarkdownStructure;
@@ -0,0 +1,10 @@
1
+ import type { LocalNode } from '../contracts/types.js';
2
+ type CreateNode = (type: string, start: number, end: number, extra?: Partial<LocalNode>) => LocalNode;
3
+ /**
4
+ * Parse the text-only subset without allocating Markdown tokenizer events.
5
+ * Validate the entire input before constructing nodes: a later definition,
6
+ * delimiter or indented line can change the meaning of earlier paragraphs.
7
+ * Ambiguous inputs return undefined and use the ordinary Markdown pipeline.
8
+ */
9
+ export declare function parsePlainParagraphs(source: string, markdownBreaks: boolean, node: CreateNode): LocalNode[] | undefined;
10
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Small lexical scanners shared by the strict parser and the recovery planner.
3
+ *
4
+ * These routines answer only "where does this token end". Callers decide
5
+ * whether a missing closer is an error, a recovery boundary or literal text.
6
+ */
7
+ /**
8
+ * End offset (exclusive) of the `{{ ... }}` opened at `start`, honoring quoted
9
+ * strings and backslash escapes. Returns -1 when the closer is missing.
10
+ */
11
+ export declare function scanInterpolationEnd(source: string, start: number, limit: number): number;
12
+ /** End of an escaped `\X ... X` pair opening at `from`. */
13
+ export declare function escapedPairEnd(source: string, from: number, end: number, close: string): number | null;
14
+ /** End of an escaped `\\[ ... \\]` display wrapper. */
15
+ export declare function escapedDisplayEnd(source: string, from: number, end: number): number | null;
16
+ /**
17
+ * End of the formula token starting at `start`, or null when the token is not
18
+ * a formula. Formula spans are opaque so tags inside TeX never look
19
+ * structural.
20
+ */
21
+ export declare function mathTokenEnd(source: string, start: number, end: number): number | null;
@@ -0,0 +1,67 @@
1
+ import type { FastMarkdownCache } from '../markdown/fast-markdown.js';
2
+ /** Which deterministic parser budget a rejection belongs to. */
3
+ export type ParseBudgetKind = 'parse-work' | 'markdown-depth';
4
+ export interface ParseBudgetLimits {
5
+ readonly maxParseWork: number;
6
+ readonly maxMarkdownDepth: number;
7
+ }
8
+ /**
9
+ * Deterministic budget failure. The parser converts this into a
10
+ * `local.budget` diagnostic; it is never derived from wall-clock time, so a
11
+ * document that fits the budget always compiles the same way.
12
+ */
13
+ export declare class ParseBudgetError extends Error {
14
+ readonly kind: ParseBudgetKind;
15
+ readonly limit: number;
16
+ readonly start: number;
17
+ readonly end: number;
18
+ constructor(kind: ParseBudgetKind, limit: number, start: number, end: number);
19
+ }
20
+ /**
21
+ * Per-parse work and depth accounting.
22
+ *
23
+ * Work units are deliberately abstract: roughly one source code unit scanned
24
+ * or submitted to a general Markdown parse. Cache hits still charge the same
25
+ * units as cache misses so that a session never changes whether a document is
26
+ * accepted. Fenced code, inline code and indented code never contribute
27
+ * Markdown depth; depth is observed from the shared `SourceContext` facts.
28
+ */
29
+ export declare class ParseWorkBudget {
30
+ readonly limits: ParseBudgetLimits;
31
+ private usedWork;
32
+ private observedDepth;
33
+ constructor(limits: ParseBudgetLimits);
34
+ get parseWork(): number;
35
+ get maxDepth(): number;
36
+ charge(units: number, start: number, end: number): void;
37
+ observeDepth(depth: number, start: number, end: number): void;
38
+ }
39
+ /** Cumulative counters exposed by a parse session to the parser. */
40
+ export interface ParseSessionCounters {
41
+ readonly hits: number;
42
+ readonly misses: number;
43
+ readonly reusedBlocks: number;
44
+ readonly reusedRows: number;
45
+ readonly reusedItems: number;
46
+ readonly reusedRowNodes: number;
47
+ readonly reusedItemNodes: number;
48
+ readonly reusedAst: number;
49
+ }
50
+ /**
51
+ * Internal bridge between `parseLocal` and `LocalParseSession`.
52
+ *
53
+ * Only read-only intermediate data (fast plans, inline plans and remark ASTs)
54
+ * is cached. Final `LocalNode` objects are never stored here because the
55
+ * compiler mutates them; `parseLocal` always rebuilds nodes through its own
56
+ * factory with fresh ids and the exact cumulative budget.
57
+ */
58
+ export interface ParseSessionCache extends FastMarkdownCache {
59
+ counters(): ParseSessionCounters;
60
+ readTree(text: string): {
61
+ readonly hit: true;
62
+ readonly value: unknown;
63
+ } | {
64
+ readonly hit: false;
65
+ };
66
+ writeTree(text: string, value: unknown): void;
67
+ }
@@ -0,0 +1,42 @@
1
+ import type { MarkdownStructure } from '../markdown/markdown-blocks.js';
2
+ import type { LocalNode, LocalRecovery } from '../contracts/types.js';
3
+ /**
4
+ * Optional parser abilities installed by the compiler assembly.
5
+ *
6
+ * The Markdown body, RMD structure, expressions and budgets are core. GFM
7
+ * syntax, native HTML support and the Lezer block planner are capabilities:
8
+ * the minimal entry installs none, while the standard and compatibility
9
+ * entries install `STANDARD_PARSER_CAPABILITIES`.
10
+ */
11
+ /** Structural signature of the raw HTML table reader. */
12
+ export type LocalHtmlTableReader = (source: string, start: number, limit: number, hooks: any) => {
13
+ node: LocalNode;
14
+ end: number;
15
+ } | null;
16
+ /** Structural signature of isolated HTML fragment repair. */
17
+ export type LocalHtmlFragmentRecovery = (source: string, start: number, end: number, createNode: (type: string, start: number, end: number, extra?: Partial<LocalNode>) => LocalNode, componentNames: ReadonlySet<string>, contextTag?: string) => {
18
+ nodes: LocalNode[];
19
+ recovery: LocalRecovery;
20
+ end: number;
21
+ } | null;
22
+ export interface LocalParserHtmlCapability {
23
+ /** Browser-recognized tag names used to keep ordinary native HTML inert. */
24
+ readonly nativeTagNames: ReadonlySet<string>;
25
+ /** Decode character references without activating markup. */
26
+ decodeEntities(value: string): string;
27
+ /** Raw HTML table reader used before Markdown table handling. */
28
+ readonly readTable: LocalHtmlTableReader;
29
+ /** Isolated fragment repair for non-strict mode. */
30
+ readonly recoverFragment: LocalHtmlFragmentRecovery;
31
+ }
32
+ /** A remark plugin attached to the core CommonMark processor. */
33
+ export type LocalMarkdownPlugin = (...args: any[]) => unknown;
34
+ export interface LocalParserCapabilities {
35
+ /** remark plugins beyond CommonMark; the standard assembly adds GFM. */
36
+ readonly markdownPlugins?: readonly LocalMarkdownPlugin[];
37
+ readonly html?: LocalParserHtmlCapability;
38
+ /** Advisory top-level block planning; omitted assemblies parse one block. */
39
+ readonly markdownStructure?: (source: string) => MarkdownStructure;
40
+ }
41
+ /** Empty assembly used by the minimal compiler. */
42
+ export declare const NO_PARSER_CAPABILITIES: LocalParserCapabilities;