reactive-md 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. package/CHANGELOG-ch.md +54 -4
  2. package/CHANGELOG.md +55 -4
  3. package/CONTRIBUTING-ch.md +13 -2
  4. package/CONTRIBUTING.md +13 -2
  5. package/README-ch.md +132 -23
  6. package/README-en.md +130 -21
  7. package/README.md +128 -21
  8. package/SECURITY-ch.md +3 -3
  9. package/SECURITY.md +3 -3
  10. package/THIRD_PARTY_NOTICES.md +111 -1
  11. package/cli/args.mjs +51 -1
  12. package/cli/assets.mjs +6 -1
  13. package/cli/build.mjs +125 -9
  14. package/cli/fs-utils.mjs +3 -3
  15. package/cli/help.mjs +12 -5
  16. package/cli/init.mjs +1 -1
  17. package/cli/package.mjs +1 -0
  18. package/dist-library/LocalDocumentView-sthUP0ct.js +109 -0
  19. package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
  20. package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
  21. package/dist-library/{authoring-BsfSwQRm.js → authoring-Dsune4Hy.js} +240 -218
  22. package/dist-library/compile-wUv8KEge.js +1249 -0
  23. package/dist-library/{compiler-core-kPiH-gOV.js → compiler-core-As_m-MNm.js} +5372 -5559
  24. package/dist-library/compiler-eOfcinZs.js +62 -0
  25. package/dist-library/component-state-BoLCGee4.js +801 -0
  26. package/dist-library/{component-state-D_cw_EHe.js → component-state-C52ZFJGl.js} +2 -2
  27. package/dist-library/{registry-B9Jc3FVe.js → config-BadfhjdP.js} +374 -457
  28. package/dist-library/{config-validation-DXTynAw7.js → config-validation-F47AcE6o.js} +549 -751
  29. package/dist-library/controls-CcT6n7k_.js +6740 -0
  30. package/dist-library/coordinate-CWS9p5q_.js +293 -0
  31. package/dist-library/data-table-Bgccxd7h.js +296 -0
  32. package/dist-library/{default-components-Z_YMio5P.js → default-components-BwQf0oP-.js} +344 -334
  33. package/dist-library/{math-display-BJz4gbFc.js → display-B-VhqVND.js} +1299 -1299
  34. package/dist-library/export-BqVmTXm8.js +369 -0
  35. package/dist-library/gallery-CY6mTx8i.js +360 -0
  36. package/dist-library/html-CNT4KD-2.js +757 -0
  37. package/dist-library/{math-sample-BGEW49zY.js → incremental-Dv0FSp_U.js} +476 -394
  38. package/dist-library/latex-1w7aQgD5.js +928 -0
  39. package/dist-library/layout-C0YlEPGr.js +562 -0
  40. package/dist-library/mount-preset-KxvtKgJb.js +13 -0
  41. package/dist-library/options-1aDLK7JY.js +121 -0
  42. package/dist-library/{react-ByOHunUW.js → package-core-WFK1RhAZ.js} +49 -55
  43. package/dist-library/{parser-standard-DlCk7sLo.js → parser-standard-Yuf3A_VI.js} +6605 -7097
  44. package/dist-library/plugin-packs-B1XPWcFs.js +18 -0
  45. package/dist-library/{identity-MYJXKSkB.js → preset-core-CKc5YXSM.js} +31 -31
  46. package/dist-library/{props-DGlBk0e5.js → props-sJ8vk0cr.js} +1 -1
  47. package/dist-library/react-BbyAgeXc.js +6070 -0
  48. package/dist-library/react-D5iGiUdL.js +7 -0
  49. package/dist-library/reactive-md-authoring.js +222 -223
  50. package/dist-library/reactive-md-build.js +126 -72
  51. package/dist-library/reactive-md-compiler-standard.js +12 -10
  52. package/dist-library/reactive-md-compiler.js +3 -3
  53. package/dist-library/reactive-md-default-packs.js +2 -2
  54. package/dist-library/reactive-md-default-preset.js +4 -4
  55. package/dist-library/reactive-md-export-assets.js +57 -0
  56. package/dist-library/reactive-md-export.js +5 -111
  57. package/dist-library/reactive-md-minimal-preset.js +24 -0
  58. package/dist-library/reactive-md-minimal-react-preset.js +26 -0
  59. package/dist-library/reactive-md-minimal-styles.js +80 -0
  60. package/dist-library/reactive-md-minimal.css +2 -0
  61. package/dist-library/reactive-md-pdf.js +7582 -0
  62. package/dist-library/reactive-md-plugin-chart.js +13 -0
  63. package/dist-library/reactive-md-plugin-data.js +17 -0
  64. package/dist-library/reactive-md-plugin-diagram.js +18 -0
  65. package/dist-library/reactive-md-plugin-forms.js +18 -0
  66. package/dist-library/reactive-md-plugin-gallery.js +12 -0
  67. package/dist-library/reactive-md-plugin-navigation.js +15 -0
  68. package/dist-library/reactive-md-plugin-network.js +222 -0
  69. package/dist-library/reactive-md-plugin-plot.js +24 -0
  70. package/dist-library/reactive-md-print.css +5 -0
  71. package/dist-library/reactive-md-react-minimal.js +28 -0
  72. package/dist-library/reactive-md-react-server.js +34 -32
  73. package/dist-library/reactive-md-react-unstyled.js +14 -9
  74. package/dist-library/reactive-md-react.js +14 -9
  75. package/dist-library/reactive-md-runtime-browser.js +847 -15
  76. package/dist-library/reactive-md-runtime.js +3 -3
  77. package/dist-library/reactive-md-sdk.js +8 -6
  78. package/dist-library/reactive-md-standalone-configured.js +16 -0
  79. package/dist-library/reactive-md-standalone-host.js +9 -438
  80. package/dist-library/reactive-md-testing-browser.js +5 -4
  81. package/dist-library/reactive-md-testing-react.js +46 -44
  82. package/dist-library/reactive-md-testing.js +45 -44
  83. package/dist-library/reactive-md-vite.js +135 -37
  84. package/dist-library/reactive-md.css +1 -1
  85. package/dist-library/reactive-md.js +590 -498
  86. package/dist-library/registry-B9NGct4d.js +20 -0
  87. package/dist-library/registry-core-Bbad9Bm2.js +479 -0
  88. package/dist-library/{resources-BGt8mpDA.js → resources-D2GDQS0p.js} +45 -45
  89. package/dist-library/{runtime-Dkq7ldyg.js → runtime-B2fxeveq.js} +1 -1
  90. package/dist-library/runtime-kcA7bG7G.js +1282 -0
  91. package/dist-library/sample-bP4zHB3L.js +289 -0
  92. package/dist-library/{schema-ZFufO8V0.js → schema-BufhKUSM.js} +12 -11
  93. package/dist-library/sdk-core-BoJT1SIt.js +1166 -0
  94. package/dist-library/session-core-nmJHuR9c.js +452 -0
  95. package/dist-library/{shareable-DDVL4Fi9.js → shareable-DpbE-59H.js} +250 -283
  96. package/dist-library/tooltip-layer-HDLrSWs0.js +28 -0
  97. package/dist-library/types/authoring/catalog.d.ts +2 -3
  98. package/dist-library/types/authoring/editor-i18n.d.ts +1 -1
  99. package/dist-library/types/authoring/index.d.ts +1 -1
  100. package/dist-library/types/authoring/insert.d.ts +1 -1
  101. package/dist-library/types/authoring/templates.d.ts +2 -2
  102. package/dist-library/types/build/diagnostics.d.ts +1 -1
  103. package/dist-library/types/build/host.d.ts +1 -1
  104. package/dist-library/types/build/index.d.ts +1 -1
  105. package/dist-library/types/build/notices.d.ts +1 -1
  106. package/dist-library/types/build/resources.d.ts +1 -1
  107. package/dist-library/types/build/vite.d.ts +1 -1
  108. package/dist-library/types/compiler/index.d.ts +2 -2
  109. package/dist-library/types/compiler/result.d.ts +1 -1
  110. package/dist-library/types/compiler/standard.d.ts +2 -2
  111. package/dist-library/types/compiler/types.d.ts +1 -1
  112. package/dist-library/types/components/{controls.d.ts → controls/controls.d.ts} +2 -3
  113. package/dist-library/types/components/{numeric-sliders.d.ts → controls/numeric-sliders.d.ts} +1 -1
  114. package/dist-library/types/components/{gallery.d.ts → gallery/gallery.d.ts} +1 -1
  115. package/dist-library/types/components/{layout.d.ts → layout/layout.d.ts} +1 -1
  116. package/dist-library/types/components/minimal-preset.d.ts +2 -0
  117. package/dist-library/types/components/mount-preset.d.ts +4 -0
  118. package/dist-library/types/components/network/submit-button.d.ts +10 -0
  119. package/dist-library/types/components/plot/coordinate.d.ts +2 -0
  120. package/dist-library/types/components/plugins/chart.d.ts +2 -0
  121. package/dist-library/types/components/plugins/data.d.ts +2 -0
  122. package/dist-library/types/components/plugins/diagram.d.ts +2 -0
  123. package/dist-library/types/components/plugins/forms.d.ts +2 -0
  124. package/dist-library/types/components/plugins/gallery.d.ts +2 -0
  125. package/dist-library/types/components/plugins/navigation.d.ts +2 -0
  126. package/dist-library/types/components/plugins/network.d.ts +2 -0
  127. package/dist-library/types/components/plugins/plot.d.ts +2 -0
  128. package/dist-library/types/components/shared/visual-frame.d.ts +12 -0
  129. package/dist-library/types/components/{visuals.d.ts → shared/visuals.d.ts} +1 -7
  130. package/dist-library/types/components/{data-table.d.ts → table/data-table.d.ts} +2 -2
  131. package/dist-library/types/export/component-state.d.ts +1 -1
  132. package/dist-library/types/export/index.d.ts +2 -1
  133. package/dist-library/types/export/print-document.d.ts +18 -0
  134. package/dist-library/types/export/render-markup.d.ts +23 -0
  135. package/dist-library/types/export/requirements.d.ts +1 -1
  136. package/dist-library/types/export/resources.d.ts +1 -1
  137. package/dist-library/types/export/restoration.d.ts +1 -1
  138. package/dist-library/types/export-assets/index.d.ts +25 -0
  139. package/dist-library/types/local/compilation/compiler-attributes.d.ts +8 -0
  140. package/dist-library/types/local/compilation/compiler-bindings.d.ts +19 -0
  141. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  142. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  143. package/dist-library/types/local/compilation/compiler-declarations.d.ts +32 -0
  144. package/dist-library/types/local/compilation/compiler-expressions.d.ts +32 -0
  145. package/dist-library/types/local/compilation/compiler-services.d.ts +62 -16
  146. package/dist-library/types/local/compilation/compiler-structure.d.ts +38 -3
  147. package/dist-library/types/local/compilation/compiler-tables.d.ts +30 -0
  148. package/dist-library/types/local/compilation/compiler-validation.d.ts +15 -0
  149. package/dist-library/types/local/compilation/compiler-values.d.ts +39 -1
  150. package/dist-library/types/local/compilation/compiler.d.ts +7 -14
  151. package/dist-library/types/local/compilation/dependencies.d.ts +1 -1
  152. package/dist-library/types/local/compilation/session/incremental.d.ts +75 -0
  153. package/dist-library/types/local/{session → compilation/session}/row-reuse.d.ts +1 -1
  154. package/dist-library/types/local/{session/compiler-cache.d.ts → compilation/session/semantic-cache.d.ts} +5 -19
  155. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  156. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  157. package/dist-library/types/local/{compilation → configuration}/component-kernel.d.ts +3 -79
  158. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +1104 -1056
  159. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +731 -0
  160. package/dist-library/types/local/configuration/diagnostics.d.ts +1 -1
  161. package/dist-library/types/local/configuration/kernel-value-rules.d.ts +66 -0
  162. package/dist-library/types/local/configuration/official-leaf-syntax.d.ts +24 -0
  163. package/dist-library/types/local/configuration/options-core.d.ts +5 -4
  164. package/dist-library/types/local/configuration/options.d.ts +2 -1
  165. package/dist-library/types/local/configuration/portable-options.d.ts +1 -1
  166. package/dist-library/types/local/configuration/schema-core.d.ts +1 -1
  167. package/dist-library/types/local/configuration/schema.d.ts +1 -1
  168. package/dist-library/types/local/css/author-css.d.ts +66 -0
  169. package/dist-library/types/local/evaluation/computations.d.ts +2 -2
  170. package/dist-library/types/local/evaluation/expression/compile.d.ts +30 -0
  171. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -0
  172. package/dist-library/types/local/evaluation/expression/inference.d.ts +4 -0
  173. package/dist-library/types/local/evaluation/expression/syntax.d.ts +72 -0
  174. package/dist-library/types/local/evaluation/expression/values.d.ts +56 -0
  175. package/dist-library/types/local/evaluation/{math-display.d.ts → math/display.d.ts} +2 -2
  176. package/dist-library/types/local/evaluation/math/evaluation.d.ts +10 -0
  177. package/dist-library/types/local/evaluation/{math.d.ts → math/latex.d.ts} +58 -17
  178. package/dist-library/types/local/evaluation/{math-sample.d.ts → math/sample.d.ts} +4 -2
  179. package/dist-library/types/local/evaluation/math/syntax.d.ts +72 -0
  180. package/dist-library/types/local/evaluation/validation.d.ts +1 -1
  181. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  182. package/dist-library/types/local/html/html-details.d.ts +1 -1
  183. package/dist-library/types/local/html/html-entities.d.ts +11 -2
  184. package/dist-library/types/local/html/html-recovery.d.ts +1 -1
  185. package/dist-library/types/local/html/html-table.d.ts +1 -1
  186. package/dist-library/types/local/html/html.d.ts +40 -4
  187. package/dist-library/types/local/index.d.ts +14 -13
  188. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  189. package/dist-library/types/local/{markdown → parsing}/fast-markdown.d.ts +1 -1
  190. package/dist-library/types/local/{markdown → parsing}/footnotes.d.ts +1 -1
  191. package/dist-library/types/local/{markdown → parsing}/heading-anchors.d.ts +1 -1
  192. package/dist-library/types/local/parsing/html-attributes.d.ts +14 -0
  193. package/dist-library/types/local/parsing/parse-budget.d.ts +1 -1
  194. package/dist-library/types/local/{session → parsing}/parse-session.d.ts +5 -5
  195. package/dist-library/types/local/parsing/parser-capabilities.d.ts +7 -2
  196. package/dist-library/types/local/parsing/parser-convert.d.ts +26 -0
  197. package/dist-library/types/local/parsing/parser-core.d.ts +10 -4
  198. package/dist-library/types/local/parsing/parser-internals.d.ts +54 -0
  199. package/dist-library/types/local/parsing/parser-region.d.ts +46 -0
  200. package/dist-library/types/local/parsing/parser-standard.d.ts +3 -0
  201. package/dist-library/types/local/parsing/parser-tags.d.ts +108 -0
  202. package/dist-library/types/local/parsing/parser.d.ts +3 -3
  203. package/dist-library/types/local/{markdown → parsing}/plain-paragraphs.d.ts +1 -1
  204. package/dist-library/types/local/parsing/rmd-recovery.d.ts +1 -1
  205. package/dist-library/types/local/parsing/theme-declaration.d.ts +22 -0
  206. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  207. package/dist-library/types/local/rendering/document/LocalDocumentView.d.ts +5 -0
  208. package/dist-library/types/local/rendering/{LocalDocumentView.d.ts → document/LocalDocumentViewCore.d.ts} +48 -9
  209. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
  210. package/dist-library/types/local/rendering/document/render-nodes.d.ts +24 -0
  211. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  212. package/dist-library/types/local/rendering/document/use-color-scheme.d.ts +10 -0
  213. package/dist-library/types/local/rendering/document/validation-state.d.ts +31 -0
  214. package/dist-library/types/local/rendering/document/view-render-context.d.ts +146 -0
  215. package/dist-library/types/local/rendering/{view-revision.d.ts → document/view-revision.d.ts} +31 -4
  216. package/dist-library/types/local/rendering/render-types.d.ts +1 -1
  217. package/dist-library/types/local/{widgets/table-surface.d.ts → rendering/table/data-table.d.ts} +3 -0
  218. package/dist-library/types/local/rendering/table/table-numeric-columns.d.ts +7 -0
  219. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  220. package/dist-library/types/local/runtime/retention.d.ts +1 -1
  221. package/dist-library/types/local/runtime/runtime-document.d.ts +71 -0
  222. package/dist-library/types/local/runtime/runtime-migration.d.ts +19 -0
  223. package/dist-library/types/local/runtime/runtime-values.d.ts +39 -0
  224. package/dist-library/types/local/runtime/runtime.d.ts +4 -2
  225. package/dist-library/types/local/runtime/state.d.ts +1 -1
  226. package/dist-library/types/local/source/authoring-syntax.d.ts +48 -0
  227. package/dist-library/types/local/source/authoring.d.ts +1 -1
  228. package/dist-library/types/local/source/source-context.d.ts +23 -0
  229. package/dist-library/types/local/source/source-migration.d.ts +2 -2
  230. package/dist-library/types/local/transport/compile-patch.d.ts +1 -1
  231. package/dist-library/types/local/transport/flat-compiled-data.d.ts +1 -1
  232. package/dist-library/types/local/transport/shared-data.d.ts +1 -1
  233. package/dist-library/types/local/transport/worker-handler.d.ts +30 -0
  234. package/dist-library/types/local/transport/worker-job.d.ts +28 -0
  235. package/dist-library/types/local/transport/worker.d.ts +32 -46
  236. package/dist-library/types/local/{contracts/types.d.ts → types.d.ts} +78 -21
  237. package/dist-library/types/pdf.d.ts +22 -0
  238. package/dist-library/types/presets/identity.d.ts +1 -0
  239. package/dist-library/types/presets/minimal.d.ts +2 -0
  240. package/dist-library/types/presets/plugin-packs.d.ts +1 -0
  241. package/dist-library/types/react/component-api.d.ts +20 -4
  242. package/dist-library/types/react/component-primitives.d.ts +10 -10
  243. package/dist-library/types/react/component-utils.d.ts +9 -1
  244. package/dist-library/types/react/index.d.ts +6 -5
  245. package/dist-library/types/{local/theme/i18n.d.ts → react/localization.d.ts} +2 -2
  246. package/dist-library/types/react/minimal.d.ts +13 -0
  247. package/dist-library/types/react/package-core.d.ts +67 -0
  248. package/dist-library/types/react/package.d.ts +3 -67
  249. package/dist-library/types/react/runtime/common.d.ts +1 -1
  250. package/dist-library/types/react/sdk-core.d.ts +115 -0
  251. package/dist-library/types/react/sdk.d.ts +4 -110
  252. package/dist-library/types/react/server.d.ts +2 -2
  253. package/dist-library/types/react/use-draft-field.d.ts +5 -1
  254. package/dist-library/types/runtime-services/browser/duplex.d.ts +163 -0
  255. package/dist-library/types/runtime-services/browser/http-sse.d.ts +117 -0
  256. package/dist-library/types/runtime-services/browser/index.d.ts +2 -1
  257. package/dist-library/types/runtime-services/component-state.d.ts +1 -1
  258. package/dist-library/types/runtime-services/index.d.ts +2 -0
  259. package/dist-library/types/runtime-services/network.d.ts +86 -0
  260. package/dist-library/types/runtime-services/runtime.d.ts +1 -1
  261. package/dist-library/types/sdk/config.d.ts +1 -1
  262. package/dist-library/types/sdk/index.d.ts +1 -0
  263. package/dist-library/types/sdk/props.d.ts +1 -1
  264. package/dist-library/types/sdk/registry-core.d.ts +1 -1
  265. package/dist-library/types/sdk/theme.d.ts +5 -4
  266. package/dist-library/types/sdk/types.d.ts +2 -2
  267. package/dist-library/types/shareable.d.ts +6 -5
  268. package/dist-library/types/standalone/diagnostics.d.ts +1 -1
  269. package/dist-library/types/standalone/host.d.ts +5 -0
  270. package/dist-library/types/standalone/payload.d.ts +1 -1
  271. package/dist-library/types/standalone/prepare.d.ts +2 -2
  272. package/dist-library/types/standalone/session-core.d.ts +68 -0
  273. package/dist-library/types/standalone/session.d.ts +6 -68
  274. package/dist-library/types/themes/contract.d.ts +7 -0
  275. package/dist-library/types/{local/theme/theme.d.ts → themes/document-theme.d.ts} +4 -3
  276. package/dist-library/types/vite/client.d.ts +19 -0
  277. package/dist-library/types/vite/index.d.ts +18 -3
  278. package/dist-library/types/vite/registration.d.ts +2 -2
  279. package/dist-library/{types-BFCrMrg0.js → types-BeNtPqdY.js} +1 -1
  280. package/dist-library/validation-BEBA_HvS.js +1121 -0
  281. package/dist-library/visual-frame-CyV1FXzs.js +48 -0
  282. package/dist-library/visuals-B5KSafVk.js +3 -0
  283. package/dist-library/visuals-BZbZYA7w.js +72572 -0
  284. package/dist-standalone/reactive-md-standalone.css +1 -1
  285. package/dist-standalone/reactive-md-standalone.js +146 -137
  286. package/docs/README-ch.md +16 -11
  287. package/docs/README.md +16 -11
  288. package/docs/compatibility/compatibility-ch.md +8 -8
  289. package/docs/compatibility/compatibility-en.md +8 -8
  290. package/docs/compatibility/source-versioning-ch.md +1 -1
  291. package/docs/compatibility/source-versioning-en.md +1 -1
  292. package/docs/development/component-development-ch.md +2 -2
  293. package/docs/development/component-development-en.md +2 -2
  294. package/docs/development/component-development-reference-ch.md +4 -4
  295. package/docs/development/component-development-reference-en.md +4 -4
  296. package/docs/development/component-protocol-ch.md +14 -14
  297. package/docs/development/component-protocol-en.md +14 -14
  298. package/docs/development/extension-tutorial-ch.md +308 -0
  299. package/docs/development/extension-tutorial-en.md +308 -0
  300. package/docs/development/local-module-layout-ch.md +10 -50
  301. package/docs/development/local-module-layout-en.md +9 -49
  302. package/docs/development/performance-overview-ch.md +174 -154
  303. package/docs/development/performance-overview-en.md +174 -154
  304. package/docs/guides/local-guide-ch.md +2 -2
  305. package/docs/guides/local-guide-en.md +2 -2
  306. package/docs/integration/author-tools-ch.md +2 -2
  307. package/docs/integration/author-tools-en.md +2 -2
  308. package/docs/integration/compiler-ch.md +4 -2
  309. package/docs/integration/compiler-en.md +4 -2
  310. package/docs/integration/directory-discovery-ch.md +5 -1
  311. package/docs/integration/directory-discovery-en.md +5 -1
  312. package/docs/integration/editor-ch.md +35 -5
  313. package/docs/integration/editor-en.md +42 -4
  314. package/docs/integration/extension-sdk-ch.md +6 -4
  315. package/docs/integration/extension-sdk-en.md +6 -4
  316. package/docs/integration/local-integration-ch.md +201 -19
  317. package/docs/integration/local-integration-en.md +194 -18
  318. package/docs/integration/network-host-ch.md +75 -0
  319. package/docs/integration/network-host-en.md +75 -0
  320. package/docs/integration/shareable-export-ch.md +58 -16
  321. package/docs/integration/shareable-export-en.md +57 -15
  322. package/docs/reference/html-compatibility-ch.md +20 -67
  323. package/docs/reference/html-compatibility-en.md +19 -64
  324. package/docs/reference/local-interaction-syntax-ch.md +199 -26
  325. package/docs/reference/local-interaction-syntax-en.md +194 -27
  326. package/docs/reference/public-api-ch.md +416 -0
  327. package/docs/reference/public-api-en.md +416 -0
  328. package/docs/reference/theme-protocol-ch.md +27 -8
  329. package/docs/reference/theme-protocol-en.md +46 -8
  330. package/docs/releases/release-0.4.0-ch.md +2 -2
  331. package/docs/releases/release-0.4.0-en.md +2 -2
  332. package/docs/releases/release-0.8.0-ch.md +19 -3
  333. package/docs/releases/release-0.8.0-en.md +19 -3
  334. package/docs/releases/release-0.9.0-ch.md +44 -0
  335. package/docs/releases/release-0.9.0-en.md +44 -0
  336. package/docs/releases/release-0.9.1-ch.md +29 -0
  337. package/docs/releases/release-0.9.1-en.md +29 -0
  338. package/examples/component-package/README-ch.md +1 -1
  339. package/examples/component-package/README.md +1 -1
  340. package/examples/conformance/README-ch.md +3 -3
  341. package/examples/conformance/README.md +3 -3
  342. package/examples/game-2048-package/README-ch.md +3 -9
  343. package/examples/game-2048-package/README.md +8 -12
  344. package/examples/integration/README-ch.md +21 -2
  345. package/examples/integration/README.md +21 -2
  346. package/examples/integration/extension-sdk/README-ch.md +1 -1
  347. package/examples/integration/extension-sdk/README.md +1 -1
  348. package/examples/integration/streaming/index.html +48 -0
  349. package/examples/integration/streaming/main.js +175 -0
  350. package/examples/integration/streaming/package.json +13 -0
  351. package/examples/integration/streaming/worker.js +3 -0
  352. package/examples/local/README-ch.md +3 -3
  353. package/examples/local/README.md +2 -2
  354. package/examples/local/minimal-budget.reactive.md +48 -0
  355. package/examples/minimal-extension/README-ch.md +78 -0
  356. package/examples/minimal-extension/README.md +78 -0
  357. package/examples/minimal-extension/index.html +15 -0
  358. package/examples/minimal-extension/package.json +26 -0
  359. package/examples/minimal-extension/sample/document.reactive.md +10 -0
  360. package/examples/minimal-extension/scripts/build.mjs +32 -0
  361. package/examples/minimal-extension/scripts/export.mjs +72 -0
  362. package/examples/minimal-extension/scripts/test-node.mjs +75 -0
  363. package/examples/minimal-extension/src/extension.tsx +90 -0
  364. package/examples/minimal-extension/src/preview.tsx +12 -0
  365. package/examples/minimal-extension/src/source.ts +4 -0
  366. package/examples/minimal-extension/tsconfig.json +14 -0
  367. package/examples/network-survey/README.md +200 -0
  368. package/examples/network-survey/index.html +49 -0
  369. package/examples/network-survey/package.json +26 -0
  370. package/examples/network-survey/sample/document.reactive.md +51 -0
  371. package/examples/network-survey/src/components.tsx +325 -0
  372. package/examples/network-survey/src/host.ts +316 -0
  373. package/examples/network-survey/src/main.tsx +91 -0
  374. package/examples/network-survey/src/source.ts +1 -0
  375. package/examples/network-survey/tsconfig.json +26 -0
  376. package/examples/network-survey/vite.config.ts +227 -0
  377. package/examples/sci-fi-theme/README-ch.md +4 -2
  378. package/examples/sci-fi-theme/README.md +4 -2
  379. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -0
  380. package/examples/sci-fi-theme/demo/demo.css +129 -23
  381. package/examples/sci-fi-theme/demo/document.reactive.md +27 -6
  382. package/examples/sci-fi-theme/demo/main.tsx +45 -10
  383. package/examples/sci-fi-theme/docs/design-system-ch.md +6 -6
  384. package/examples/sci-fi-theme/package.json +2 -1
  385. package/examples/sci-fi-theme/src/components.css +1064 -154
  386. package/examples/sci-fi-theme/src/notch.css +142 -0
  387. package/examples/sci-fi-theme/src/sci-fi.css +3 -1
  388. package/examples/sci-fi-theme/src/theme.ts +2 -0
  389. package/examples/sci-fi-theme/src/tokens.css +512 -408
  390. package/examples/tetris-package/README-ch.md +4 -4
  391. package/examples/tetris-package/README.md +4 -4
  392. package/package.json +70 -3
  393. package/dist-library/LocalDocumentView-6trX7xJc.js +0 -97920
  394. package/dist-library/compiler--ea2CKQF.js +0 -61
  395. package/dist-library/component-state-Cq2K5gkS.js +0 -490
  396. package/dist-library/options-CX5m5n-J.js +0 -115
  397. package/dist-library/runtime-C-sbfpOX.js +0 -1157
  398. package/dist-library/types/local/contracts/locale.d.ts +0 -1
  399. package/dist-library/types/local/contracts/version.d.ts +0 -2
  400. package/dist-library/types/local/evaluation/dates.d.ts +0 -2
  401. package/dist-library/types/local/evaluation/expression.d.ts +0 -47
  402. package/dist-library/types/local/markdown/markdown-structure.d.ts +0 -3
  403. package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +0 -36
  404. package/dist-library/types/local/session/incremental.d.ts +0 -48
  405. package/dist-library/types/local/source/node-walk.d.ts +0 -3
  406. package/dist-library/types/local/source/text-length.d.ts +0 -13
  407. package/dist-library/types/local/theme/theme-name.d.ts +0 -3
  408. package/dist-library/types/local/widgets/visuals.d.ts +0 -25
  409. package/dist-library/types/react/default-theme.d.ts +0 -6
  410. package/dist-library/validation-W-bmny-x.js +0 -2253
  411. package/docs/development/releasing-ch.md +0 -12
  412. package/docs/development/releasing-en.md +0 -12
  413. package/docs/integration/codemirror-ch.md +0 -52
  414. package/docs/integration/codemirror-en.md +0 -29
  415. package/docs/integration/repository-split-ch.md +0 -40
  416. package/docs/integration/repository-split-en.md +0 -23
  417. package/docs/reference/computations-formatting-ch.md +0 -89
  418. package/docs/reference/computations-formatting-en.md +0 -89
  419. package/docs/reference/constraints-collections-ch.md +0 -104
  420. package/docs/reference/constraints-collections-en.md +0 -104
  421. package/docs/reference/local-components-v2-ch.md +0 -140
  422. package/docs/reference/local-components-v2-en.md +0 -106
  423. package/docs/reference/tolerance-ch.md +0 -64
  424. package/docs/reference/tolerance-en.md +0 -57
  425. /package/dist-library/types/components/{chart-motion.d.ts → chart/chart-motion.d.ts} +0 -0
  426. /package/dist-library/types/components/{default-chart-types.d.ts → chart/default-chart-types.d.ts} +0 -0
  427. /package/dist-library/types/components/{default-chart.d.ts → chart/default-chart.d.ts} +0 -0
  428. /package/dist-library/types/components/{diagram-inspector.d.ts → diagram/diagram-inspector.d.ts} +0 -0
  429. /package/dist-library/types/{local/widgets/diagram-layout.d.ts → components/diagram/layout.d.ts} +0 -0
  430. /package/dist-library/types/components/{mafs-plot-grid.d.ts → plot/mafs-plot-grid.d.ts} +0 -0
  431. /package/dist-library/types/components/{mafs-visuals.d.ts → plot/mafs-visuals.d.ts} +0 -0
  432. /package/dist-library/types/components/{use-hydrated.d.ts → shared/use-hydrated.d.ts} +0 -0
  433. /package/dist-library/types/local/{theme/colors.d.ts → configuration/color-values.d.ts} +0 -0
  434. /package/dist-library/types/local/evaluation/{collection-functions.d.ts → expression/collection-functions.d.ts} +0 -0
  435. /package/dist-library/types/local/evaluation/{data-functions.d.ts → expression/data-functions.d.ts} +0 -0
  436. /package/dist-library/types/local/evaluation/{formatting.d.ts → expression/formatting.d.ts} +0 -0
  437. /package/dist-library/types/local/{markdown → parsing}/markdown-blocks.d.ts +0 -0
  438. /package/dist-library/types/local/{widgets → rendering/code}/code-block.d.ts +0 -0
  439. /package/dist-library/types/local/{widgets → rendering/code}/code-languages.d.ts +0 -0
  440. /package/dist-library/types/local/{widgets → rendering/image}/image-view.d.ts +0 -0
  441. /package/dist-library/types/local/{widgets → rendering}/math-view.d.ts +0 -0
@@ -0,0 +1,801 @@
1
+ // src/runtime-services/network.ts
2
+ var e = 65536, t = Object.freeze({
3
+ code: "unavailable",
4
+ message: "This channel operation is unavailable."
5
+ }), n = Object.freeze({
6
+ code: "cancelled",
7
+ message: "The operation was cancelled."
8
+ }), r = Object.freeze({
9
+ code: "invalid-data",
10
+ message: "The channel data is invalid."
11
+ }), i = Object.freeze({
12
+ code: "transport",
13
+ message: "The channel could not communicate with its endpoint."
14
+ }), a = Object.freeze({
15
+ code: "rejected",
16
+ message: "A channel listener failed."
17
+ }), o = 0;
18
+ function s(e) {
19
+ return {
20
+ ok: !1,
21
+ error: e
22
+ };
23
+ }
24
+ var c = Object.freeze({
25
+ supports: () => !1,
26
+ submit: async () => s(t),
27
+ subscribe(e, n) {
28
+ let r = !0;
29
+ return queueMicrotask(() => {
30
+ if (r) try {
31
+ n({
32
+ type: "error",
33
+ error: t
34
+ });
35
+ } catch {}
36
+ }), () => {
37
+ r = !1;
38
+ };
39
+ }
40
+ });
41
+ function l(t = e) {
42
+ if (!Number.isSafeInteger(t) || t < 1) throw TypeError("A channel byte budget must be a positive integer.");
43
+ return t;
44
+ }
45
+ function u(e, t) {
46
+ let n = t;
47
+ function r(e) {
48
+ if (n -= e, n < 0) throw RangeError();
49
+ }
50
+ function i(e, t) {
51
+ if (r(1), t > 64) throw RangeError();
52
+ if (e === null || typeof e == "boolean") return e;
53
+ if (typeof e == "string") return r(e.length), e;
54
+ if (typeof e == "number" && Number.isFinite(e)) return e;
55
+ if (Array.isArray(e)) {
56
+ if (e.length > n) throw RangeError();
57
+ let r = [];
58
+ for (let n = 0; n < e.length; n += 1) {
59
+ let a = Object.getOwnPropertyDescriptor(e, String(n));
60
+ if (!a || !("value" in a)) throw TypeError();
61
+ r.push(i(a.value, t + 1));
62
+ }
63
+ return Object.freeze(r);
64
+ }
65
+ if (typeof e != "object" || !e) throw TypeError();
66
+ let a = Object.getPrototypeOf(e);
67
+ if (a !== Object.prototype && a !== null) throw TypeError();
68
+ let o = Object.create(null);
69
+ for (let n of Object.keys(e)) {
70
+ r(n.length);
71
+ let a = Object.getOwnPropertyDescriptor(e, n);
72
+ if (!a || !("value" in a)) throw TypeError();
73
+ o[n] = i(a.value, t + 1);
74
+ }
75
+ return Object.freeze(o);
76
+ }
77
+ let a = i(e, 0);
78
+ if (new TextEncoder().encode(JSON.stringify(a)).length > t) throw RangeError();
79
+ return a;
80
+ }
81
+ function d(t) {
82
+ if (!t.ok) return t;
83
+ try {
84
+ let n = Object.getOwnPropertyDescriptor(t, "data");
85
+ if (n && "value" in n && n.value !== void 0) return {
86
+ ok: !0,
87
+ data: u(n.value, e)
88
+ };
89
+ } catch {}
90
+ return { ok: !0 };
91
+ }
92
+ function f(e, t) {
93
+ let n = t(e);
94
+ if (n !== !0) return typeof n == "string" && n.trim() ? Object.freeze({
95
+ code: "invalid-data",
96
+ message: n
97
+ }) : r;
98
+ }
99
+ function p(e) {
100
+ if (!e) return {
101
+ network: c,
102
+ bindExternalValues: () => void 0,
103
+ dispose() {}
104
+ };
105
+ let p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
106
+ for (let [t, n] of Object.entries(e.channels)) {
107
+ let { submit: e, subscribe: r, mapExternalValues: i } = n;
108
+ if (e && (typeof e.validate != "function" || typeof e.send != "function")) throw TypeError("A submit channel requires a validator and a send function.");
109
+ if (r && (typeof r.validate != "function" || typeof r.open != "function")) throw TypeError("A subscription channel requires a validator and an open function.");
110
+ if (i !== void 0) {
111
+ if (!r || typeof i != "function") throw TypeError("Mapping external values requires a subscription and a mapper function.");
112
+ m.set(t, i.bind(n));
113
+ }
114
+ p.set(t, {
115
+ ...e && { submit: {
116
+ maxBytes: l(e.maxBytes),
117
+ validate: e.validate.bind(e),
118
+ send: e.send.bind(e)
119
+ } },
120
+ ...r && { subscribe: {
121
+ maxBytes: l(r.maxBytes),
122
+ validate: r.validate.bind(r),
123
+ open: r.open.bind(r)
124
+ } }
125
+ });
126
+ }
127
+ let h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), v = !1;
128
+ function y(e) {
129
+ let t = h.get(e);
130
+ return t || h.set(e, t = new AbortController()), t.signal;
131
+ }
132
+ function b(t, n) {
133
+ try {
134
+ t.notify(Object.freeze(n));
135
+ } catch {
136
+ try {
137
+ e?.onListenerError?.(a);
138
+ } catch {}
139
+ }
140
+ }
141
+ function x(e) {
142
+ try {
143
+ e?.();
144
+ } catch {}
145
+ }
146
+ function S(e, t) {
147
+ _.delete(e), t.listeners.clear(), t.events.length = 0, t.controller.abort(), x(t.release);
148
+ }
149
+ function C(e, t) {
150
+ if (!(v || e.controller.signal.aborted) && (e.events.push({
151
+ event: t,
152
+ recipients: [...e.listeners],
153
+ status: e.status
154
+ }), !e.dispatching)) {
155
+ e.dispatching = !0;
156
+ try {
157
+ for (let t = 0; t < e.events.length; t += 1) {
158
+ let { event: n, recipients: r, status: i } = e.events[t];
159
+ for (let t of r) e.listeners.has(t) && (t.initial || (t.initial = !0, n.type !== "status" && b(t, {
160
+ type: "status",
161
+ state: i
162
+ })), e.listeners.has(t) && b(t, n));
163
+ }
164
+ } finally {
165
+ e.events.length = 0, e.dispatching = !1;
166
+ }
167
+ }
168
+ }
169
+ function w(e, t, n) {
170
+ let a = t.controller.signal;
171
+ if (a.aborted) return;
172
+ let o = (e) => {
173
+ a.aborted || t.status === e || (t.status = e, C(t, {
174
+ type: "status",
175
+ state: e
176
+ }));
177
+ }, s = (e) => {
178
+ C(t, {
179
+ type: "error",
180
+ error: Object.freeze({ ...e })
181
+ });
182
+ }, c = (e) => {
183
+ if (a.aborted) return;
184
+ let i, o;
185
+ try {
186
+ i = u(e, n.maxBytes ?? 65536), o = f(i, n.validate);
187
+ } catch {
188
+ s(r);
189
+ return;
190
+ }
191
+ o ? s(o) : C(t, {
192
+ type: "data",
193
+ value: i
194
+ });
195
+ }, l = () => {
196
+ a.aborted || (s(i), o("closed"));
197
+ }, d = (e) => {
198
+ a.aborted ? x(e) : t.release = e;
199
+ };
200
+ try {
201
+ let t = n.open({
202
+ signal: a,
203
+ sessionSignal: y(e),
204
+ status: o,
205
+ error: s,
206
+ data: c
207
+ });
208
+ typeof t == "function" ? d(t) : Promise.resolve(t).then(d, l);
209
+ } catch {
210
+ l();
211
+ }
212
+ }
213
+ let T = {
214
+ supports(e, t) {
215
+ return !v && (t === "submit" || t === "subscribe") && p.get(e)?.[t] !== void 0;
216
+ },
217
+ async submit(e, a, c) {
218
+ let l = v ? void 0 : p.get(e)?.submit;
219
+ if (!l) return s(t);
220
+ if (c?.signal?.aborted) return s(n);
221
+ let m;
222
+ try {
223
+ let e = u(a, l.maxBytes ?? 65536);
224
+ if (typeof e != "object" || !e || Array.isArray(e)) return s(r);
225
+ m = e;
226
+ let t = f(m, l.validate);
227
+ if (t) return s(t);
228
+ } catch {
229
+ return s(r);
230
+ }
231
+ let h = c?.signal;
232
+ if (v || h?.aborted) return s(n);
233
+ let _ = new AbortController();
234
+ return new Promise((t) => {
235
+ let r = !1, a = (e) => {
236
+ r || (r = !0, h?.removeEventListener("abort", u), g.delete(u), t(d(e)));
237
+ }, u = () => {
238
+ a(s(n)), _.abort();
239
+ };
240
+ g.add(u), h?.addEventListener("abort", u, { once: !0 });
241
+ try {
242
+ let t = l.send(m, {
243
+ signal: _.signal,
244
+ sessionSignal: y(e),
245
+ requestId: String(++o),
246
+ ...c?.idempotencyKey === void 0 ? {} : { idempotencyKey: c.idempotencyKey }
247
+ });
248
+ Promise.resolve(t).then(a, () => a(s(i)));
249
+ } catch {
250
+ a(s(i));
251
+ }
252
+ });
253
+ },
254
+ subscribe(e, n) {
255
+ if (v) return c.subscribe(e, n);
256
+ let r = {
257
+ notify: n,
258
+ initial: !1
259
+ }, i = p.get(e)?.subscribe;
260
+ if (!i) {
261
+ let e = !0;
262
+ return queueMicrotask(() => {
263
+ e && !v && b(r, {
264
+ type: "error",
265
+ error: t
266
+ });
267
+ }), () => {
268
+ e = !1;
269
+ };
270
+ }
271
+ let a = _.get(e), o = a ?? {
272
+ controller: new AbortController(),
273
+ listeners: /* @__PURE__ */ new Set(),
274
+ events: [],
275
+ status: "connecting",
276
+ dispatching: !1
277
+ };
278
+ return o.listeners.add(r), a || _.set(e, o), queueMicrotask(() => {
279
+ o.listeners.has(r) && !r.initial && (r.initial = !0, b(r, {
280
+ type: "status",
281
+ state: o.status
282
+ })), a || w(e, o, i);
283
+ }), () => {
284
+ o.listeners.delete(r) && o.listeners.size === 0 && S(e, o);
285
+ };
286
+ }
287
+ };
288
+ return {
289
+ network: Object.freeze(T),
290
+ bindExternalValues(e) {
291
+ if (v || m.size === 0) return;
292
+ let t = [...m].map(([t, n]) => T.subscribe(t, (t) => {
293
+ if (t.type !== "data") return;
294
+ let r = n(t.value);
295
+ r !== void 0 && e(r);
296
+ }));
297
+ return () => {
298
+ for (let e of t) e();
299
+ };
300
+ },
301
+ dispose() {
302
+ if (!v) {
303
+ v = !0;
304
+ for (let e of g) e();
305
+ for (let [e, t] of _) S(e, t);
306
+ for (let e of h.values()) e.abort();
307
+ h.clear(), p.clear(), m.clear();
308
+ }
309
+ }
310
+ };
311
+ }
312
+ // src/runtime-services/identity.ts
313
+ var m = 2166136261, h = 16777619, g = new TextEncoder(), _ = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/, v = /^[^\u0000-\u001f\u007f]{1,256}$/;
314
+ function y(e) {
315
+ let t = g.encode(e), n = m;
316
+ for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n, h) >>> 0;
317
+ return n >>> 0;
318
+ }
319
+ function b(e) {
320
+ if (typeof e != "string") throw TypeError("localSourceDigest requires a source string.");
321
+ return `fnv1a32:${y(e).toString(16).padStart(8, "0")}`;
322
+ }
323
+ function x(e) {
324
+ if (typeof e != "string") return;
325
+ let t = e.trim();
326
+ return v.test(t) ? t : void 0;
327
+ }
328
+ function S(e) {
329
+ if (typeof e != "string") return;
330
+ let t = e.trim();
331
+ return _.test(t) ? t : void 0;
332
+ }
333
+ function C(e) {
334
+ return x(e.documentId) ?? e.sourceDigest;
335
+ }
336
+ function w(e) {
337
+ let t = C(e), n = S(e.stateKey), r = n === void 0 ? `node:${e.nodeId}` : `state:${n}`, i = encodeURIComponent(t);
338
+ return `doc:${i.length <= 256 ? i : `h${y(t).toString(16).padStart(8, "0")}`}:${r}`;
339
+ }
340
+ function T(e, t) {
341
+ return y(`${e >>> 0}:${t}`);
342
+ }
343
+ function ee(e) {
344
+ if (typeof e.explicitSeed == "number" && Number.isFinite(e.explicitSeed)) return Math.trunc(e.explicitSeed) >>> 0;
345
+ let t = S(e.stateKey), n = t === void 0 ? `node:${e.nodeId}` : `state:${t}`;
346
+ return T(e.documentSeed, `${e.componentId}|${n}`);
347
+ }
348
+ function E(e) {
349
+ return Number.isFinite(e) ? Math.trunc(e) >>> 0 : 0;
350
+ }
351
+ // src/runtime-services/random.ts
352
+ var D = "mulberry32", te = 1;
353
+ function O(e) {
354
+ return Object.freeze({
355
+ algorithm: D,
356
+ version: 1,
357
+ state: E(e)
358
+ });
359
+ }
360
+ function k(e) {
361
+ if (typeof e != "object" || !e || Array.isArray(e)) return null;
362
+ let t = e;
363
+ if (t.algorithm !== "mulberry32" || t.version !== 1 || typeof t.state != "number" || !Number.isFinite(t.state)) return null;
364
+ let n = E(t.state);
365
+ return n === t.state ? Object.freeze({
366
+ algorithm: D,
367
+ version: 1,
368
+ state: n
369
+ }) : null;
370
+ }
371
+ function A(e) {
372
+ let t = E(e.state + 1831565813), n = Math.imul(t ^ t >>> 15, t | 1);
373
+ return n ^= n + Math.imul(n ^ n >>> 7, n | 61), {
374
+ value: ((n ^ n >>> 14) >>> 0) / 4294967296,
375
+ state: Object.freeze({
376
+ algorithm: D,
377
+ version: 1,
378
+ state: t
379
+ })
380
+ };
381
+ }
382
+ function j(e, t, n) {
383
+ let r = A(e);
384
+ if (!Number.isFinite(t) || !Number.isFinite(n)) return {
385
+ value: 0,
386
+ state: r.state
387
+ };
388
+ let i = Math.ceil(Math.min(t, n)), a = Math.floor(Math.max(t, n));
389
+ return a < i ? {
390
+ value: i,
391
+ state: r.state
392
+ } : {
393
+ value: i + Math.floor(r.value * (a - i + 1)),
394
+ state: r.state
395
+ };
396
+ }
397
+ function ne(e, t) {
398
+ let n = t.slice(), r = e;
399
+ for (let e = n.length - 1; e > 0; --e) {
400
+ let t = j(r, 0, e);
401
+ r = t.state;
402
+ let i = n[e];
403
+ n[e] = n[t.value], n[t.value] = i;
404
+ }
405
+ return {
406
+ items: n,
407
+ state: r
408
+ };
409
+ }
410
+ function M(e, t) {
411
+ return O(T(e, t));
412
+ }
413
+ function re(e, t = .5) {
414
+ let n = A(e);
415
+ return {
416
+ value: n.value < t,
417
+ state: n.state
418
+ };
419
+ }
420
+ // src/runtime-services/component-state.ts
421
+ var N = "reactive-md-component-state/v1", P = "reactive-md-component-state-document/v1", F = 16384, I = 262144, ie = 16, L = 1e4, R = 1e5, z = 1048576, B = 128, V = 64, H = 512, U = 1e6, W = 128, ae = /[\u0000-\u001f\u007f-\u009f]/, G = new TextEncoder();
422
+ function K(e, t, n = "error") {
423
+ return {
424
+ code: e,
425
+ message: t,
426
+ severity: n,
427
+ range: {
428
+ start: 0,
429
+ end: 0
430
+ },
431
+ line: 1,
432
+ column: 1
433
+ };
434
+ }
435
+ function q(e) {
436
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
437
+ let t = Object.getPrototypeOf(e);
438
+ return t === Object.prototype || t === null;
439
+ }
440
+ function J(e) {
441
+ for (let t = 0; t < e.length; t += 1) {
442
+ let n = e.charCodeAt(t);
443
+ if (n >= 55296 && n <= 56319) {
444
+ let n = e.charCodeAt(t + 1);
445
+ if (n >= 56320 && n <= 57343) {
446
+ t += 1;
447
+ continue;
448
+ }
449
+ return !1;
450
+ }
451
+ if (n >= 56320 && n <= 57343) return !1;
452
+ }
453
+ return !0;
454
+ }
455
+ function Y(e) {
456
+ return typeof e == "string" && e.length > 0 && e.length <= W && !ae.test(e) && J(e);
457
+ }
458
+ function oe(e, t, n) {
459
+ return t === void 0 || e === t || n.includes(e);
460
+ }
461
+ function X(e, t) {
462
+ if (e === null) return null;
463
+ if (typeof e == "boolean") return e;
464
+ if (typeof e == "number") {
465
+ if (!Number.isFinite(e)) throw TypeError("numbers must be finite");
466
+ return e;
467
+ }
468
+ if (typeof e == "string") {
469
+ if (e.length > 1e5) throw RangeError(`strings exceed ${R} characters`);
470
+ if (!J(e)) throw TypeError("strings must be well-formed Unicode");
471
+ return e;
472
+ }
473
+ if (t >= 16) throw RangeError("nesting exceeds 16 levels");
474
+ if (Array.isArray(e)) {
475
+ if (e.length > 1e4) throw RangeError(`arrays exceed ${L} items`);
476
+ if (Object.getOwnPropertySymbols(e).length > 0) throw TypeError("arrays cannot use symbol keys");
477
+ return e.map((e) => X(e, t + 1));
478
+ }
479
+ if (q(e)) {
480
+ if (Object.getOwnPropertySymbols(e).length > 0) throw TypeError("objects cannot use symbol keys");
481
+ let n = Object.keys(e);
482
+ if (n.length > 1e4) throw RangeError(`objects exceed ${L} keys`);
483
+ let r = {};
484
+ for (let i of n) {
485
+ if (i === "__proto__") throw TypeError("the key \"__proto__\" is not allowed");
486
+ if (i.length > 1e5) throw RangeError(`keys exceed ${R} characters`);
487
+ if (!J(i)) throw TypeError("keys must be well-formed Unicode");
488
+ r[i] = X(e[i], t + 1);
489
+ }
490
+ return r;
491
+ }
492
+ throw TypeError("values must be JSON-safe primitives, arrays or plain objects");
493
+ }
494
+ function se(e) {
495
+ return X(e, 0);
496
+ }
497
+ function Z(e) {
498
+ return Object.freeze({
499
+ ...e,
500
+ data: X(e.data, 0),
501
+ ...e.random === void 0 ? {} : { random: k(e.random) ?? e.random }
502
+ });
503
+ }
504
+ function Q(e) {
505
+ if (!q(e)) return {
506
+ ok: !1,
507
+ diagnostics: [K("local.runtime.state.shape", "A component state record must be a plain object.")]
508
+ };
509
+ let t = /* @__PURE__ */ new Set([
510
+ "format",
511
+ "component",
512
+ "componentVersion",
513
+ "stateVersion",
514
+ "key",
515
+ "documentId",
516
+ "data",
517
+ "random"
518
+ ]);
519
+ for (let n of Object.keys(e)) if (!t.has(n)) return {
520
+ ok: !1,
521
+ diagnostics: [K("local.runtime.state.key", `Unknown component state key "${n}".`)]
522
+ };
523
+ if (e.format !== "reactive-md-component-state/v1") return {
524
+ ok: !1,
525
+ diagnostics: [K("local.runtime.state.format", `Unsupported component state format; expected "${N}".`)]
526
+ };
527
+ let n = e.component;
528
+ if (typeof n != "string" || n.trim() === "" || n.length > B) return {
529
+ ok: !1,
530
+ diagnostics: [K("local.runtime.state.component", "Component name must be a non-empty string.")]
531
+ };
532
+ let r = e.componentVersion;
533
+ if (typeof r != "string" || r.trim() === "" || r.length > V) return {
534
+ ok: !1,
535
+ diagnostics: [K("local.runtime.state.component-version", "Component version must be a non-empty string.")]
536
+ };
537
+ let i = e.stateVersion;
538
+ if (typeof i != "number" || !Number.isInteger(i) || i < 0 || i > U) return {
539
+ ok: !1,
540
+ diagnostics: [K("local.runtime.state.version", "State version must be a non-negative integer.")]
541
+ };
542
+ let a = e.key;
543
+ if (typeof a != "string" || a.trim() === "" || a.length > H) return {
544
+ ok: !1,
545
+ diagnostics: [K("local.runtime.state.key-name", "State key must be a non-empty string.")]
546
+ };
547
+ let o = e.documentId;
548
+ if (o !== void 0 && (typeof o != "string" || o.trim() === "" || o.length > 256)) return {
549
+ ok: !1,
550
+ diagnostics: [K("local.runtime.state.document", "State documentId must be a non-empty string.")]
551
+ };
552
+ let s;
553
+ try {
554
+ s = se(e.data);
555
+ } catch (e) {
556
+ return {
557
+ ok: !1,
558
+ diagnostics: [K("local.runtime.state.data", `Invalid component state data: ${e instanceof Error ? e.message : String(e)}.`)]
559
+ };
560
+ }
561
+ let c;
562
+ if (e.random !== void 0 && (c = k(e.random) ?? void 0, c === void 0)) return {
563
+ ok: !1,
564
+ diagnostics: [K("local.runtime.state.random", "Invalid random state.")]
565
+ };
566
+ let l = {
567
+ format: N,
568
+ component: n,
569
+ componentVersion: r,
570
+ stateVersion: i,
571
+ key: a,
572
+ ...o === void 0 ? {} : { documentId: o },
573
+ data: s,
574
+ ...c === void 0 ? {} : { random: c }
575
+ };
576
+ return G.encode(JSON.stringify(l)).length > 16384 ? {
577
+ ok: !1,
578
+ diagnostics: [K("local.runtime.state.size", `Component state exceeds the ${F}-byte limit.`)]
579
+ } : {
580
+ ok: !0,
581
+ record: Object.freeze(l)
582
+ };
583
+ }
584
+ function $(e) {
585
+ let t = e;
586
+ if (typeof e == "string") {
587
+ if (e.length > 1048576) return {
588
+ ok: !1,
589
+ diagnostics: [K("local.runtime.state.size", "The component state payload is too large.")]
590
+ };
591
+ try {
592
+ t = JSON.parse(e);
593
+ } catch {
594
+ return {
595
+ ok: !1,
596
+ diagnostics: [K("local.runtime.state.json", "The component state payload is not valid JSON.")]
597
+ };
598
+ }
599
+ }
600
+ if (!q(t)) return {
601
+ ok: !1,
602
+ diagnostics: [K("local.runtime.state.shape", "The component state document must be a plain object.")]
603
+ };
604
+ if (t.format !== "reactive-md-component-state-document/v1") return {
605
+ ok: !1,
606
+ diagnostics: [K("local.runtime.state.document-format", `Unsupported component state document format; expected "${P}".`)]
607
+ };
608
+ let n = t.configKey;
609
+ if (n !== void 0 && !Y(n)) return {
610
+ ok: !1,
611
+ diagnostics: [K("local.runtime.state.config-key", "The component state configKey must be a non-empty bounded string.")]
612
+ };
613
+ if (!q(t.records)) return {
614
+ ok: !1,
615
+ diagnostics: [K("local.runtime.state.records", "Component state records must be a plain object.")]
616
+ };
617
+ let r = {}, i = [], a = [], o = 0;
618
+ for (let e of Object.keys(t.records)) {
619
+ let n = Q(t.records[e]);
620
+ n.ok ? n.record.key === e ? (o += G.encode(JSON.stringify(n.record)).length, o > 262144 ? (a.push(e), i.push(K("local.runtime.state.total-size", `Component state exceeds the ${I}-byte document limit.`))) : r[e] = n.record) : (a.push(e), i.push(K("local.runtime.state.key-mismatch", `Component state record "${e}" declares a different key "${n.record.key}".`))) : (a.push(e), i.push(...n.diagnostics));
621
+ }
622
+ return {
623
+ ok: !0,
624
+ ...n === void 0 ? {} : { configKey: n },
625
+ records: r,
626
+ diagnostics: i,
627
+ skipped: a
628
+ };
629
+ }
630
+ function ce(e) {
631
+ let t = $(e);
632
+ if (!t.ok) return t;
633
+ let n = {};
634
+ for (let [e, r] of Object.entries(t.records)) n[e] = r;
635
+ return {
636
+ ok: !0,
637
+ document: Object.freeze({
638
+ format: P,
639
+ ...t.configKey === void 0 ? {} : { configKey: t.configKey },
640
+ records: Object.freeze(n)
641
+ }),
642
+ records: Object.freeze(n),
643
+ diagnostics: t.diagnostics,
644
+ skipped: t.skipped
645
+ };
646
+ }
647
+ function le(e) {
648
+ let t = C(e), n = e.sourceDigest, r = e.knownKeys, i = e.configKey;
649
+ if (i !== void 0 && !Y(i)) throw TypeError("configKey must be a non-empty bounded string.");
650
+ let a = Object.freeze((e.legacyConfigKeys ?? []).filter(Y)), o = e.writeDelayMs ?? 0;
651
+ if (typeof o != "number" || !Number.isFinite(o) || o < 0) throw TypeError("writeDelayMs must be a non-negative finite number.");
652
+ let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = [], f = e.storage, p = null, m = null, h = !1, g = () => {
653
+ for (let e of u) e();
654
+ };
655
+ function _() {
656
+ if (f === void 0) return !0;
657
+ try {
658
+ let e = S.snapshot();
659
+ return Object.keys(e.records).length === 0 ? f.remove() : f.write(e), p = null, !0;
660
+ } catch (e) {
661
+ let t = e instanceof Error ? e.message : String(e);
662
+ return t !== p && (p = t, d.push(K("local.runtime.state.storage", `The component state could not be persisted: ${t}`, "warning"))), !1;
663
+ }
664
+ }
665
+ let v = () => {
666
+ m !== null && (clearTimeout(m), m = null);
667
+ };
668
+ function y() {
669
+ h && (v(), _() && (h = !1));
670
+ }
671
+ let b = () => {
672
+ f !== void 0 && (o <= 0 ? _() : (h = !0, m === null && (m = setTimeout(() => {
673
+ m = null, y();
674
+ }, Math.min(o, 2147483647)))));
675
+ }, x = (e) => {
676
+ let t = 0;
677
+ for (let [n, r] of s) n !== e && (t += G.encode(JSON.stringify(r)).length);
678
+ return t;
679
+ }, S = {
680
+ documentId: t,
681
+ sourceDigest: n,
682
+ key(e) {
683
+ return w({
684
+ documentId: t,
685
+ sourceDigest: n,
686
+ nodeId: e.nodeId,
687
+ stateKey: e.stateKey
688
+ });
689
+ },
690
+ handle(e) {
691
+ let n = S.key({
692
+ nodeId: e.nodeId,
693
+ stateKey: e.stateKey
694
+ }), r = c.get(n), i = !1;
695
+ r !== void 0 && r !== e.nodeId ? (i = !0, l.has(n) || (l.add(n), d.push(K("local.runtime.state.duplicate-key", `Component state key "${n}" is used by more than one component instance.`)))) : c.set(n, e.nodeId);
696
+ let a = {
697
+ key: n,
698
+ component: e.component,
699
+ componentVersion: e.componentVersion,
700
+ duplicate: i,
701
+ load() {
702
+ if (i) return null;
703
+ let e = s.get(n);
704
+ return e === void 0 ? null : Z(e);
705
+ },
706
+ save(r, a) {
707
+ if (i) return {
708
+ ok: !1,
709
+ diagnostics: [K("local.runtime.state.duplicate-key", `Component state key "${n}" is used by more than one component instance.`)]
710
+ };
711
+ let o = a?.version ?? e.stateVersion ?? 0, c = Q({
712
+ format: N,
713
+ component: e.component,
714
+ componentVersion: e.componentVersion,
715
+ stateVersion: o,
716
+ key: n,
717
+ documentId: t,
718
+ data: r,
719
+ ...a?.random === void 0 ? {} : { random: a.random }
720
+ });
721
+ if (!c.ok) return {
722
+ ok: !1,
723
+ diagnostics: c.diagnostics
724
+ };
725
+ let l = G.encode(JSON.stringify(c.record)).length;
726
+ return x(n) + l > 262144 ? {
727
+ ok: !1,
728
+ diagnostics: [K("local.runtime.state.total-size", `Component state exceeds the ${I}-byte document limit.`)]
729
+ } : (s.set(n, c.record), b(), g(), {
730
+ ok: !0,
731
+ diagnostics: [],
732
+ record: Z(c.record)
733
+ });
734
+ },
735
+ clear() {
736
+ i || s.delete(n) && (b(), g());
737
+ }
738
+ };
739
+ return Object.freeze(a);
740
+ },
741
+ load(e) {
742
+ let t = s.get(e);
743
+ return t === void 0 ? null : Z(t);
744
+ },
745
+ clear(e) {
746
+ s.delete(e) && (b(), g());
747
+ },
748
+ snapshot() {
749
+ let e = {};
750
+ for (let [t, n] of s) e[t] = Z(n);
751
+ return Object.freeze({
752
+ format: P,
753
+ ...i === void 0 ? {} : { configKey: i },
754
+ records: Object.freeze(e)
755
+ });
756
+ },
757
+ restore(e) {
758
+ let n = $(e);
759
+ if (!n.ok) return d.push(...n.diagnostics), {
760
+ accepted: [],
761
+ skipped: [],
762
+ diagnostics: n.diagnostics
763
+ };
764
+ if (n.configKey !== void 0 && !oe(n.configKey, i, a)) {
765
+ let e = [.../* @__PURE__ */ new Set([...n.skipped, ...Object.keys(n.records)])];
766
+ return n.diagnostics.push(K("local.runtime.state.config-mismatch", `Saved component state belongs to configuration "${n.configKey}", not "${i}".`, "warning")), d.push(...n.diagnostics), {
767
+ accepted: [],
768
+ skipped: e,
769
+ diagnostics: n.diagnostics
770
+ };
771
+ }
772
+ let o = [], c = typeof r == "function" ? r() : r;
773
+ for (let [e, r] of Object.entries(n.records)) r.documentId !== void 0 && r.documentId !== t ? (n.skipped.push(e), n.diagnostics.push(K("local.runtime.state.document-mismatch", `Saved state key "${e}" belongs to a different document.`))) : c !== void 0 && !c.has(e) ? (n.skipped.push(e), n.diagnostics.push(K("local.runtime.state.unknown-component", `Saved state key "${e}" does not match any component in this document.`))) : (s.set(e, r), o.push(e));
774
+ return n.diagnostics.length && d.push(...n.diagnostics), o.length && g(), {
775
+ accepted: o,
776
+ skipped: n.skipped,
777
+ diagnostics: n.diagnostics
778
+ };
779
+ },
780
+ flush() {
781
+ y();
782
+ },
783
+ diagnostics() {
784
+ return Object.freeze([...d]);
785
+ },
786
+ subscribe(e) {
787
+ return u.add(e), () => {
788
+ u.delete(e);
789
+ };
790
+ }
791
+ }, T = e.initial;
792
+ if (T === void 0 && f !== void 0) try {
793
+ let e = f.read();
794
+ e !== null && (T = e);
795
+ } catch (e) {
796
+ let t = e instanceof Error ? e.message : String(e);
797
+ d.push(K("local.runtime.state.storage", `The component state could not be read: ${t}`, "warning"));
798
+ }
799
+ return T !== void 0 && S.restore(T), Object.freeze(S);
800
+ }
801
+ export { p as A, b as C, C as D, ee as E, E as O, y as S, S as T, re as _, z as a, w as b, I as c, D as d, te as f, k as g, A as h, ie as i, c as j, e as k, le as l, M as m, N as n, L as o, O as p, F as r, R as s, P as t, ce as u, j as v, x as w, T as x, ne as y };