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
@@ -1,5 +1,10 @@
1
- import { S as e, X as t, d as n, m as r, q as i, t as a, w as o } from "./compiler-Cm3ppMxG.js";
2
- // src/local/authoring.ts
1
+ import { v as e } from "./compiler-core-kPiH-gOV.js";
2
+ import { D as t } from "./config-validation-DXTynAw7.js";
3
+ import { $ as n, S as r } from "./validation-W-bmny-x.js";
4
+ import { n as i } from "./options-CX5m5n-J.js";
5
+ import { t as a } from "./compiler--ea2CKQF.js";
6
+ import { c as o } from "./schema-ZFufO8V0.js";
7
+ // src/local/source/authoring.ts
3
8
  var s = /^[A-Za-z_][A-Za-z0-9_]*$/, c = 128, l = /* @__PURE__ */ new Set([
4
9
  "code",
5
10
  "inlineCode",
@@ -32,7 +37,7 @@ function p(e) {
32
37
  return e !== void 0 && /\s/.test(e);
33
38
  }
34
39
  function m(e) {
35
- return e.length > 0 && e.length <= c && s.test(e) && !t.has(e);
40
+ return e.length > 0 && e.length <= c && s.test(e) && !n.has(e);
36
41
  }
37
42
  function h(e) {
38
43
  return {
@@ -48,13 +53,17 @@ function g(e, t) {
48
53
  }
49
54
  }
50
55
  function _(e) {
51
- let t = r(e);
56
+ let t = i(e);
52
57
  return t.ok ? t.htmlActive ? "html" : "markdown" : "invalid";
53
58
  }
54
- var v = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)(?=[\s/>])/;
55
- function y(e, t) {
59
+ function v(e) {
60
+ let t = i(e);
61
+ return t.ok ? [...t.schemaByName.values()] : [];
62
+ }
63
+ var y = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)(?=[\s/>])/;
64
+ function b(e, t) {
56
65
  if (e[t] !== "<") return null;
57
- let n = v.exec(e.slice(t));
66
+ let n = y.exec(e.slice(t));
58
67
  if (!n) return null;
59
68
  let r = !!n[1], i = n[2], a = t + (r ? 2 : 1), o = "", s = t + n[0].length;
60
69
  for (; s < e.length; s += 1) {
@@ -169,14 +178,14 @@ function y(e, t) {
169
178
  attrs: u
170
179
  };
171
180
  }
172
- function b(e, t, n) {
173
- if (t.range.end <= n) return null;
174
- let r = e.lastIndexOf("</", t.range.end - 1);
175
- if (r < n) return null;
176
- let i = y(e, r);
177
- return !i || !i.closing || i.name !== t.name || i.end > t.range.end ? null : i;
181
+ function x(e, n, i) {
182
+ if (n.range.end <= i) return null;
183
+ let a = e.lastIndexOf("</", n.range.end - 1);
184
+ if (a < i) return null;
185
+ let o = b(e, a);
186
+ return !o || !o.closing || o.end > n.range.end || o.name !== n.name && (!t.has(o.name.toLowerCase()) && !r.has(o.name.toLowerCase()) || o.name.toLowerCase() !== n.name?.toLowerCase()) ? null : o;
178
187
  }
179
- function x(e, t, n) {
188
+ function S(e, t, n) {
180
189
  let r = [];
181
190
  for (let i = t; i < n;) {
182
191
  if (e[i] === "\\" && e.startsWith("{{", i + 1)) {
@@ -204,7 +213,7 @@ function x(e, t, n) {
204
213
  }
205
214
  return r;
206
215
  }
207
- function S(e, t) {
216
+ function C(e, t) {
208
217
  let n = {
209
218
  quot: "\"",
210
219
  apos: "'",
@@ -221,38 +230,38 @@ function S(e, t) {
221
230
  offsets: r
222
231
  };
223
232
  }
224
- function C(e, n, r) {
233
+ function w(e, t, r) {
225
234
  let i = [];
226
- for (let a = n; a < r;) {
227
- let n = e[a];
228
- if (n === "\"" || n === "'") {
229
- let t = n;
235
+ for (let a = t; a < r;) {
236
+ let t = e[a];
237
+ if (t === "\"" || t === "'") {
238
+ let n = t;
230
239
  for (a += 1; a < r;) if (e[a] === "\\") a += 2;
231
240
  else {
232
- if (e[a] === t) {
241
+ if (e[a] === n) {
233
242
  a += 1;
234
243
  break;
235
244
  }
236
245
  a += 1;
237
246
  }
238
247
  } else {
239
- if (/[0-9]/.test(n) || n === "." && e[a + 1] !== void 0 && /[0-9]/.test(e[a + 1])) {
248
+ if (/[0-9]/.test(t) || t === "." && e[a + 1] !== void 0 && /[0-9]/.test(e[a + 1])) {
240
249
  let t = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(a, r));
241
250
  if (t) {
242
251
  a += t[0].length;
243
252
  continue;
244
253
  }
245
254
  }
246
- if (d(n)) {
247
- let n = a;
255
+ if (d(t)) {
256
+ let t = a;
248
257
  for (a += 1; a < r && f(e[a]);) a += 1;
249
- let o = e.slice(n, a), s = a;
258
+ let o = e.slice(t, a), s = a;
250
259
  for (; s < r && p(e[s]);) s += 1;
251
- if (e[s] === "(" || o === "true" || o === "false" || o === "null" || o === "pi" || o === "e" || t.has(o)) continue;
260
+ if (e[s] === "(" || o === "true" || o === "false" || o === "null" || o === "pi" || o === "e" || n.has(o)) continue;
252
261
  i.push({
253
262
  name: o,
254
263
  range: {
255
- start: n,
264
+ start: t,
256
265
  end: a
257
266
  }
258
267
  });
@@ -261,18 +270,18 @@ function C(e, n, r) {
261
270
  }
262
271
  return i;
263
272
  }
264
- function w(e, t) {
265
- return Object.hasOwn(e.props, t) ? t === "bind" || !!e.slots?.some((e) => e.bind === t) : !1;
273
+ function T(e, t) {
274
+ return Object.values(e.bindings ?? {}).some((e) => e.bind === t);
266
275
  }
267
- function T(e, t = []) {
268
- for (let n of e) l.has(n.type) && t.push(h(n.range)), n.type !== "fallback" && n.children && T(n.children, t);
276
+ function E(e, t = []) {
277
+ for (let n of e) l.has(n.type) && t.push(h(n.range)), n.type !== "fallback" && n.children && E(n.children, t);
269
278
  return t;
270
279
  }
271
- function E(e, t) {
272
- let n = T(t), r = (t) => {
280
+ function D(e, t) {
281
+ let n = E(t), r = (t) => {
273
282
  for (let i of t) {
274
283
  if (i.type === "component" || i.type === "hostComponent") {
275
- let t = y(e, i.range.start);
284
+ let t = b(e, i.range.start);
276
285
  t && n.push({
277
286
  start: t.start,
278
287
  end: t.end
@@ -300,163 +309,182 @@ function E(e, t) {
300
309
  }
301
310
  return i;
302
311
  }
303
- function D(e, t) {
304
- let n = o(e);
305
- if (n) return n.props;
306
- let r = t?.hostComponents?.find((t) => t.name === e);
307
- return r ? Object.fromEntries(Object.entries(r.props).map(([e, t]) => [e, {
308
- ...t,
309
- values: t.enum
310
- }])) : void 0;
311
- }
312
- function O(e, t, n) {
313
- let r = [], a = /* @__PURE__ */ new Map(), s = [], c = [], l = (t, n) => {
314
- for (let r of C(e, t, n)) s.push(r);
315
- }, u = (e, t) => {
316
- let n = a.get(e);
317
- n ? n.push(h(t)) : a.set(e, [h(t)]);
318
- }, d = (t, i) => {
319
- let a = y(e, t.range.start);
320
- if (!a || a.closing) return;
321
- r.push({
312
+ function O(e, t) {
313
+ return t.find((t) => t.name === e)?.props;
314
+ }
315
+ function k(n, i, a, o) {
316
+ let s = [];
317
+ o?.themeRange && s.push({
318
+ type: "component",
319
+ name: "theme",
320
+ id: "author-theme",
321
+ range: o.themeRange
322
+ });
323
+ for (let e of Object.values(o?.computations ?? {})) s.push({
324
+ type: "component",
325
+ name: e.kind,
326
+ id: e.nodeId,
327
+ range: e.range
328
+ });
329
+ let c = s.length ? i.concat(s) : i, u = /* @__PURE__ */ new Set(), d = [], f = /* @__PURE__ */ new Map(), p = [], g = [], _ = (e, t) => {
330
+ for (let r of w(n, e, t)) p.push(r);
331
+ }, v = (e, t) => {
332
+ let n = f.get(e);
333
+ n ? n.push(h(t)) : f.set(e, [h(t)]);
334
+ }, y = (e, t) => {
335
+ if (u.has(e.range.start)) return;
336
+ let r = b(n, e.range.start);
337
+ if (!r || r.closing) return;
338
+ u.add(e.range.start), d.push({
322
339
  kind: "tag",
323
- range: h(a.nameRange)
340
+ range: h(r.nameRange)
324
341
  });
325
- let c = o(t.name ?? ""), l = a.attrs.some((e) => e.name === "key");
326
- for (let o of a.attrs) {
327
- if (r.push({
342
+ let i = a.find((t) => t.name === e.name);
343
+ for (let t of r.attrs) {
344
+ if (d.push({
328
345
  kind: "attribute",
329
- range: h(o.nameRange)
330
- }), !o.valueRange) continue;
331
- let a = D(t.name ?? "", n)?.[o.name], d = c !== void 0 && w(c, o.name) && (t.name !== "table" && t.name !== "chart" || !!l), f = (t.name === "computed" || t.name === "const") && o.name === "name", p = e.slice(o.valueRange.start, o.valueRange.end), g = S(e, o.valueRange);
332
- if (t.name === "validation" && o.name === "fields") {
333
- for (let e of g.text.matchAll(/\S+/g)) {
346
+ range: h(t.nameRange)
347
+ }), !t.valueRange) continue;
348
+ let o = O(e.name ?? "", a)?.[t.name], s = i !== void 0 && T(i, t.name) && Object.values(i.bindings ?? {}).some((e) => e.bind === t.name && (e.requiresAttributes ?? []).every((e) => r.attrs.some((t) => t.name === e))), c = (e.name === "computed" || e.name === "const" || e.name === "external") && t.name === "name", l = n.slice(t.valueRange.start, t.valueRange.end), u = C(n, t.valueRange);
349
+ if (i?.rules?.some((e) => e.kind === "validation-rule" && e.fields === t.name)) {
350
+ for (let e of u.text.matchAll(/\S+/g)) {
334
351
  if (!m(e[0])) continue;
335
352
  let t = {
336
- start: g.offsets[e.index],
337
- end: g.offsets[e.index + e[0].length]
353
+ start: u.offsets[e.index],
354
+ end: u.offsets[e.index + e[0].length]
338
355
  };
339
- s.push({
356
+ p.push({
340
357
  name: e[0],
341
358
  range: t
342
- }), r.push({
359
+ }), d.push({
343
360
  kind: "binding",
344
361
  range: t
345
362
  });
346
363
  }
347
364
  continue;
348
365
  }
349
- let _ = a && !a.static ? x(g.text, 0, g.text.length) : [];
350
- if (_.length > 0) {
366
+ let f = o && !o.static ? S(u.text, 0, u.text.length) : [];
367
+ if (f.length > 0) {
351
368
  let e = 0;
352
- for (let n of _) {
353
- n.start > e && r.push({
369
+ for (let n of f) {
370
+ n.start > e && d.push({
354
371
  kind: "string",
355
372
  range: {
356
- start: g.offsets[e],
357
- end: g.offsets[n.start]
373
+ start: u.offsets[e],
374
+ end: u.offsets[n.start]
358
375
  }
359
- }), r.push({
376
+ }), d.push({
360
377
  kind: "expression",
361
378
  range: {
362
- start: g.offsets[n.start],
363
- end: g.offsets[n.end]
379
+ start: u.offsets[n.start],
380
+ end: u.offsets[n.end]
364
381
  }
365
382
  });
366
- for (let e of C(g.text, n.innerStart, n.innerEnd)) ((i !== "data-table" || t.name !== "column") && (t.name !== "data-table" || o.name !== "key") || e.name !== "item" && e.name !== "index") && s.push({
383
+ for (let e of w(u.text, n.innerStart, n.innerEnd)) (!i?.rules?.some((e) => e.kind === "scoped-expressions" && e.scope === "row" && e.attributes.includes(t.name) || e.kind === "row-values" && e.key === t.name) || e.name !== "item" && e.name !== "index") && p.push({
367
384
  name: e.name,
368
385
  range: {
369
- start: g.offsets[e.range.start],
370
- end: g.offsets[e.range.end]
386
+ start: u.offsets[e.range.start],
387
+ end: u.offsets[e.range.end]
371
388
  }
372
389
  });
373
390
  e = n.end;
374
391
  }
375
- e < g.text.length && r.push({
392
+ e < u.text.length && d.push({
376
393
  kind: "string",
377
394
  range: {
378
- start: g.offsets[e],
379
- end: o.valueRange.end
395
+ start: u.offsets[e],
396
+ end: t.valueRange.end
380
397
  }
381
398
  });
382
- } else (d || f) && m(p) ? (r.push({
399
+ } else (s || c) && m(l) ? (d.push({
383
400
  kind: "binding",
384
- range: h(o.valueRange)
385
- }), u(p, o.valueRange)) : o.valueRange.end > o.valueRange.start && r.push({
401
+ range: h(t.valueRange)
402
+ }), v(l, t.valueRange)) : t.valueRange.end > t.valueRange.start && d.push({
386
403
  kind: "string",
387
- range: h(o.valueRange)
404
+ range: h(t.valueRange)
388
405
  });
389
406
  }
390
- let d = b(e, t, a.end);
391
- d && r.push({
407
+ let o = x(n, e, r.end);
408
+ o && d.push({
392
409
  kind: "tag",
393
- range: h(d.nameRange)
410
+ range: h(o.nameRange)
394
411
  });
395
- }, f = (t, n) => {
396
- for (let a of t) {
397
- if ((a.type === "component" || a.type === "hostComponent") && a.name) d(a, n);
398
- else if (a.type === "interpolation") r.push({
412
+ }, E = (i, o) => {
413
+ for (let s of i) {
414
+ if ((s.type === "component" || s.type === "hostComponent") && s.name) y(s, o);
415
+ else if (s.type === "interpolation") d.push({
399
416
  kind: "expression",
400
- range: h(a.range)
401
- }), l(a.range.start + 2, Math.max(a.range.start + 2, a.range.end - 2));
402
- else if (a.type === "math" || a.type === "inlineMath") {
403
- if (r.push({
417
+ range: h(s.range)
418
+ }), _(s.range.start + 2, Math.max(s.range.start + 2, s.range.end - 2));
419
+ else if (s.type === "math" || s.type === "inlineMath") {
420
+ if (d.push({
404
421
  kind: "math",
405
- range: h(a.range)
406
- }), n === "plot" && a.type === "math") {
407
- let t = a.range.start + 2;
422
+ range: h(s.range)
423
+ }), a.find((e) => e.name === o)?.rules?.some((e) => e.kind === "inline-math-reads") && s.type === "math") {
424
+ let t = s.range.start + 2;
408
425
  try {
409
- for (let n of i(e.slice(t, a.range.end - 2))) {
426
+ for (let r of e(n.slice(t, s.range.end - 2))) {
410
427
  let e = {
411
- name: n.name,
428
+ name: r.name,
412
429
  range: {
413
- start: t + n.range.start,
414
- end: t + n.range.end
430
+ start: t + r.range.start,
431
+ end: t + r.range.end
415
432
  }
416
433
  };
417
- s.push(e), c.push(e);
434
+ p.push(e), g.push(e);
418
435
  }
419
436
  } catch {}
420
437
  }
421
- } else a.type === "code" || a.type === "inlineCode" ? r.push({
438
+ } else s.type === "code" || s.type === "inlineCode" ? d.push({
422
439
  kind: "code",
423
- range: h(a.range)
424
- }) : a.type === "comment" && r.push({
440
+ range: h(s.range)
441
+ }) : s.type === "comment" && d.push({
425
442
  kind: "comment",
426
- range: h(a.range)
443
+ range: h(s.range)
427
444
  });
428
- a.type !== "fallback" && a.children && f(a.children, a.name);
445
+ if (!l.has(s.type) && n[s.range.start] === "<" && !u.has(s.range.start)) {
446
+ let e = b(n, s.range.start);
447
+ e && !e.closing && (t.has(e.name.toLowerCase()) || r.has(e.name.toLowerCase())) && y({
448
+ ...s,
449
+ name: e.name
450
+ }, o);
451
+ }
452
+ s.type !== "fallback" && s.children && E(s.children, s.name);
429
453
  }
430
454
  };
431
- f(t);
432
- for (let n of E(e, t)) r.push({
455
+ E(c);
456
+ for (let e of D(n, c)) d.push({
433
457
  kind: "comment",
434
- range: n
458
+ range: e
435
459
  });
436
- r.sort((e, t) => e.range.start - t.range.start || e.range.end - t.range.end);
437
- let p = [];
438
- for (let e of r) {
460
+ d.sort((e, t) => e.range.start - t.range.start || e.range.end - t.range.end);
461
+ let k = [];
462
+ for (let e of d) {
439
463
  if (e.range.end <= e.range.start) continue;
440
- let t = p[p.length - 1];
441
- t && e.range.start < t.range.end || p.push(e);
464
+ let t = k[k.length - 1];
465
+ t && e.range.start < t.range.end || k.push(e);
442
466
  }
443
- let g = [];
444
- for (let [e, t] of a) {
445
- let n = [];
446
- for (let t of s) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(h(t.range)));
447
- n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end), g.push({
467
+ let A = [];
468
+ for (let [e, t] of f) {
469
+ let n = [], r = /* @__PURE__ */ new Set();
470
+ for (let t of p) {
471
+ if (t.name !== e) continue;
472
+ let i = `${t.range.start}:${t.range.end}`;
473
+ r.has(i) || (r.add(i), n.push(h(t.range)));
474
+ }
475
+ n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end), A.push({
448
476
  name: e,
449
477
  declarations: t,
450
478
  references: n
451
479
  });
452
480
  }
453
- return g.sort((e, t) => e.declarations[0].start - t.declarations[0].start || e.name.localeCompare(t.name)), {
454
- tokens: p,
455
- bindings: g,
456
- mathReferences: c
481
+ return A.sort((e, t) => e.declarations[0].start - t.declarations[0].start || e.name.localeCompare(t.name)), {
482
+ tokens: k,
483
+ bindings: A,
484
+ mathReferences: g
457
485
  };
458
486
  }
459
- function k(e, t) {
487
+ function A(e, t, n = {}) {
460
488
  if (typeof e != "string") return {
461
489
  tokens: [],
462
490
  bindings: [],
@@ -465,16 +493,16 @@ function k(e, t) {
465
493
  if (_(t) !== "markdown") return {
466
494
  tokens: [],
467
495
  bindings: [],
468
- diagnostics: g(e, t)
496
+ diagnostics: n.diagnostics === !1 ? [] : g(e, t)
469
497
  };
470
- let r = O(e, n(e, t).nodes, t);
498
+ let r = n.document?.source === e ? n.document : o(e, t), i = k(e, r.nodes, v(t), r);
471
499
  return {
472
- tokens: r.tokens,
473
- bindings: r.bindings,
474
- diagnostics: g(e, t)
500
+ tokens: i.tokens,
501
+ bindings: i.bindings,
502
+ diagnostics: n.diagnostics === !1 ? [] : g(e, t)
475
503
  };
476
504
  }
477
- function A(e, t, n) {
505
+ function j(e, t, n) {
478
506
  let r = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)/.exec(e.slice(t, Math.min(e.length, n + 1)));
479
507
  if (!r) return null;
480
508
  let i = !!r[1], a = r[2], o = t + r[0].length, s = [], c = !1, l, u = !1;
@@ -582,7 +610,7 @@ function A(e, t, n) {
582
610
  partialStart: d
583
611
  };
584
612
  }
585
- function j(e, t, n) {
613
+ function M(e, t, n) {
586
614
  let r = [], i = (e) => {
587
615
  for (let t of e) t.type === "component" && r.push(t.range.start), t.type !== "fallback" && t.children && i(t.children);
588
616
  };
@@ -590,7 +618,7 @@ function j(e, t, n) {
590
618
  for (let n = r.length - 1; n >= 0; --n) {
591
619
  let i = r[n];
592
620
  if (i >= t) continue;
593
- let a = y(e, i);
621
+ let a = b(e, i);
594
622
  if (a && t <= a.end) return i;
595
623
  if (a && a.end < t) break;
596
624
  }
@@ -604,12 +632,12 @@ function j(e, t, n) {
604
632
  }
605
633
  let r = e[n + 1];
606
634
  if (r !== "/" && !d(r)) a = n;
607
- else if (M(e, n, t)) a = n;
635
+ else if (N(e, n, t)) a = n;
608
636
  else return n;
609
637
  }
610
638
  return -1;
611
639
  }
612
- function M(e, t, n) {
640
+ function N(e, t, n) {
613
641
  let r = "";
614
642
  for (let i = t; i < n; i += 1) {
615
643
  let t = e[i];
@@ -619,7 +647,7 @@ function M(e, t, n) {
619
647
  }
620
648
  return !1;
621
649
  }
622
- function N(e, t) {
650
+ function P(e, t) {
623
651
  let n = t;
624
652
  for (; n > 0;) {
625
653
  let r = e.lastIndexOf("{{", n - 1);
@@ -648,7 +676,7 @@ function N(e, t) {
648
676
  }
649
677
  return null;
650
678
  }
651
- function P(e, t, n) {
679
+ function F(e, t, n) {
652
680
  let r = "";
653
681
  for (let i = t; i < n; i += 1) {
654
682
  let t = e[i];
@@ -656,7 +684,7 @@ function P(e, t, n) {
656
684
  }
657
685
  return r !== "";
658
686
  }
659
- function F(e, t) {
687
+ function I(e, t) {
660
688
  let n = 0, r = e.length - 1;
661
689
  for (; n <= r;) {
662
690
  let i = n + r >> 1, a = e[i];
@@ -666,15 +694,15 @@ function F(e, t) {
666
694
  }
667
695
  return !1;
668
696
  }
669
- function I(e, t, n, r) {
697
+ function L(e, t, n, r) {
670
698
  let i = e.slice(t, n), a = i && r.startsWith(i) ? r.slice(i.length) : "";
671
699
  return {
672
700
  start: t,
673
701
  end: a && e.startsWith(a, n) ? n + a.length : n
674
702
  };
675
703
  }
676
- function L(e, t, n, r) {
677
- if (P(e, n.innerStart, t)) return [];
704
+ function R(e, t, n, r) {
705
+ if (F(e, n.innerStart, t)) return [];
678
706
  let i = t;
679
707
  for (; i > n.innerStart && f(e[i - 1]);) --i;
680
708
  if (e[i - 1] === ".") return [];
@@ -682,28 +710,28 @@ function L(e, t, n, r) {
682
710
  return a && !d(a[0]) ? [] : r.filter((e) => e.name.startsWith(a)).map((n) => ({
683
711
  label: n.name,
684
712
  insertText: n.name,
685
- range: I(e, i, t, n.name),
713
+ range: L(e, i, t, n.name),
686
714
  kind: "binding",
687
715
  detail: `${n.declarations.length} declaration${n.declarations.length === 1 ? "" : "s"}, ${n.references.length} reference${n.references.length === 1 ? "" : "s"}`
688
716
  }));
689
717
  }
690
- function R(e, t, n, r) {
718
+ function z(e, t, n, r) {
691
719
  let i = n.currentAttribute;
692
720
  if (!i) return [];
693
- let a = D(n.name, r)?.[i.name];
721
+ let a = O(n.name, r)?.[i.name];
694
722
  if (!a || a.kind !== "enum" || !a.values) return [];
695
723
  let o = i.valueRange?.start ?? t, s = e.slice(o, t);
696
724
  return a.values.filter((e) => e.startsWith(s)).map((n) => ({
697
725
  label: n,
698
726
  insertText: n,
699
- range: I(e, o, t, n),
727
+ range: L(e, o, t, n),
700
728
  kind: "value",
701
729
  detail: `${i.name} value`
702
730
  }));
703
731
  }
704
- function z(e, t, n, r) {
732
+ function B(e, t, n, r) {
705
733
  if (n.closing || n.inValue || n.partialStart < 0) return [];
706
- let i = D(n.name, r);
734
+ let i = O(n.name, r);
707
735
  if (!i) return [];
708
736
  let a = e.slice(n.partialStart, t);
709
737
  if (a && !/^[A-Za-z0-9_-]*$/.test(a)) return [];
@@ -711,119 +739,119 @@ function z(e, t, n, r) {
711
739
  return Object.entries(i).filter(([e]) => !o.has(e) && e.startsWith(a)).map(([r, i]) => ({
712
740
  label: r,
713
741
  insertText: r,
714
- range: I(e, n.partialStart, t, r),
742
+ range: L(e, n.partialStart, t, r),
715
743
  kind: "attribute",
716
744
  detail: i.required ? `${i.kind}, required` : i.kind
717
745
  }));
718
746
  }
719
- function B(t, n, r) {
720
- let i = Math.max(0, n - 256), a = t.slice(i, n), o = /<\/?([A-Za-z][A-Za-z0-9-]*)?$/.exec(a);
721
- if (!o) return [];
722
- let s = i + o.index;
723
- if (t[s] !== "<" || t[s - 1] === "\\") return [];
724
- let c = t[s + 1] === "/", l = s + (c ? 2 : 1);
725
- if (l > n) return [];
726
- let u = o[1] ?? "";
727
- return [...e, ...c ? [] : r?.hostComponents?.map((e) => e.name) ?? []].filter((e) => e.startsWith(u)).map((e) => ({
728
- label: e,
729
- insertText: e,
730
- range: I(t, l, n, e),
747
+ function V(e, t, n) {
748
+ let r = Math.max(0, t - 256), i = e.slice(r, t), a = /<\/?([A-Za-z][A-Za-z0-9-]*)?$/.exec(i);
749
+ if (!a) return [];
750
+ let o = r + a.index;
751
+ if (e[o] !== "<" || e[o - 1] === "\\") return [];
752
+ let s = e[o + 1] === "/", c = o + (s ? 2 : 1);
753
+ if (c > t) return [];
754
+ let l = a[1] ?? "";
755
+ return (s ? n.filter((e) => e.form !== "leaf").map((e) => e.name) : n.map((e) => e.name)).filter((e) => e.startsWith(l)).map((n) => ({
756
+ label: n,
757
+ insertText: n,
758
+ range: L(e, c, t, n),
731
759
  kind: "tag",
732
- detail: c ? "closing tag" : "component"
760
+ detail: s ? "closing tag" : "component"
733
761
  }));
734
762
  }
735
- function V(e, t, r) {
736
- if (typeof e != "string" || !Number.isFinite(t) || _(r) !== "markdown") return [];
737
- let i = Math.max(0, Math.min(e.length, Math.floor(t))), a = n(e, r), o = [...T(a.nodes), ...E(e, a.nodes)].sort((e, t) => e.start - t.start);
738
- if (F(o, i) || i === e.length && o.some((e) => e.end === i && e.start < i)) return [];
739
- let s = O(e, a.nodes, r), c = N(e, i);
740
- if (c) {
741
- let t = j(e, i, a.nodes);
763
+ function H(e, t, n) {
764
+ if (typeof e != "string" || !Number.isFinite(t) || _(n) !== "markdown") return [];
765
+ let r = Math.max(0, Math.min(e.length, Math.floor(t))), i = v(n), a = o(e, n), s = [...E(a.nodes), ...D(e, a.nodes)].sort((e, t) => e.start - t.start);
766
+ if (I(s, r) || r === e.length && s.some((e) => e.end === r && e.start < r)) return [];
767
+ let c = k(e, a.nodes, i), l = P(e, r);
768
+ if (l) {
769
+ let t = M(e, r, a.nodes);
742
770
  if (t >= 0) {
743
- let n = A(e, t, i);
744
- if (n?.inValue && n.currentAttribute && D(n.name, r)?.[n.currentAttribute.name]?.static) return [];
771
+ let n = j(e, t, r);
772
+ if (n?.inValue && n.currentAttribute && O(n.name, i)?.[n.currentAttribute.name]?.static) return [];
745
773
  }
746
- return L(e, i, c, s.bindings);
774
+ return R(e, r, l, c.bindings);
747
775
  }
748
- let l = j(e, i, a.nodes);
749
- if (l >= 0) {
750
- let t = A(e, l, i);
751
- if (t?.inValue) return R(e, i, t, r);
776
+ let u = M(e, r, a.nodes);
777
+ if (u >= 0) {
778
+ let t = j(e, u, r);
779
+ if (t?.inValue) return z(e, r, t, i);
752
780
  }
753
- let u = B(e, i, r);
754
- if (u.length > 0) return u;
755
- if (l >= 0) {
756
- let t = A(e, l, i);
757
- if (t) return z(e, i, t, r);
781
+ let d = V(e, r, i);
782
+ if (d.length > 0) return d;
783
+ if (u >= 0) {
784
+ let t = j(e, u, r);
785
+ if (t) return B(e, r, t, i);
758
786
  }
759
787
  return [];
760
788
  }
761
- function H(e, t) {
789
+ function U(e, t) {
762
790
  let n = "", r = 0;
763
791
  for (let i of t) n += e.slice(r, i.range.start) + i.text, r = i.range.end;
764
792
  return n + e.slice(r);
765
793
  }
766
- function U(e, t, r, i) {
767
- if (typeof e != "string" || typeof t != "string" || typeof r != "string") throw Error("Rename requires string arguments.");
768
- if (_(i) === "html") throw Error("Bindings cannot be renamed in HTML mode.");
769
- if (!m(r)) throw Error(`"${r}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
770
- let o = O(e, n(e, i).nodes, i), s = o.bindings.find((e) => e.name === t);
794
+ function W(e, t, n, r) {
795
+ if (typeof e != "string" || typeof t != "string" || typeof n != "string") throw Error("Rename requires string arguments.");
796
+ if (_(r) === "html") throw Error("Bindings cannot be renamed in HTML mode.");
797
+ if (!m(n)) throw Error(`"${n}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
798
+ let i = k(e, o(e, r).nodes, v(r)), s = i.bindings.find((e) => e.name === t);
771
799
  if (!s || s.declarations.length === 0) throw Error(`Binding "${t}" is not declared in this document.`);
772
- if (t === r) return {
800
+ if (t === n) return {
773
801
  source: e,
774
802
  edits: []
775
803
  };
776
- if (o.bindings.some((e) => e.name === r)) throw Error(`Binding "${r}" already exists.`);
777
- if (g(e, i).some((e) => e.severity === "error" && u.has(e.code))) throw Error("The document cannot be renamed safely while parse errors remain.");
804
+ if (i.bindings.some((e) => e.name === n)) throw Error(`Binding "${n}" already exists.`);
805
+ if (g(e, r).some((e) => e.severity === "error" && u.has(e.code))) throw Error("The document cannot be renamed safely while parse errors remain.");
778
806
  let c = /* @__PURE__ */ new Set(), l = [];
779
807
  for (let e of [...s.declarations, ...s.references]) {
780
808
  let t = `${e.start}:${e.end}`;
781
809
  c.has(t) || (c.add(t), l.push(h(e)));
782
810
  }
783
811
  l.sort((e, t) => e.start - t.start || e.end - t.end);
784
- let d = new Set(o.mathReferences.filter((e) => e.name === t).map((e) => `${e.range.start}:${e.range.end}`)), f = l.map((e) => ({
812
+ let d = new Set(i.mathReferences.filter((e) => e.name === t).map((e) => `${e.range.start}:${e.range.end}`)), f = l.map((e) => ({
785
813
  range: h(e),
786
- text: d.has(`${e.start}:${e.end}`) ? `\\mathrm{${r}}` : r
787
- })), p = H(e, f);
788
- if (a(e, i).ok && !a(p, i).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
814
+ text: d.has(`${e.start}:${e.end}`) ? `\\mathrm{${n}}` : n
815
+ })), p = U(e, f);
816
+ if (a(e, r).ok && !a(p, r).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
789
817
  return {
790
818
  source: p,
791
819
  edits: f
792
820
  };
793
821
  }
794
- function W(e, t) {
822
+ function G(e, t) {
795
823
  let n = e.slice(t.nameRange.start, t.nameRange.end), r = t.attrs.map((t) => {
796
824
  let n = e.slice(t.nameRange.start, t.nameRange.end);
797
825
  return t.valueRange === void 0 ? n : t.quoteStart !== void 0 && t.quoteEnd !== void 0 ? `${n}=${e.slice(t.quoteStart, t.quoteEnd + 1)}` : n;
798
826
  }), i = r.length > 0 ? `<${n} ${r.join(" ")}` : `<${n}`;
799
827
  return t.selfClosing ? `${i} />` : `${i}>`;
800
828
  }
801
- function G(e, t) {
829
+ function K(e, t) {
802
830
  if (typeof e != "string" || _(t) !== "markdown") return e;
803
- let r;
831
+ let n;
804
832
  try {
805
- r = a(e, t);
833
+ n = a(e, t);
806
834
  } catch {
807
835
  return e;
808
836
  }
809
- if (r.diagnostics.some((e) => e.severity === "error")) return e;
810
- let i = n(e, t), o = [], s = (t) => {
837
+ if (n.diagnostics.some((e) => e.severity === "error")) return e;
838
+ let r = o(e, t), i = [], s = (t) => {
811
839
  for (let n of t) {
812
840
  if ((n.type === "component" || n.type === "hostComponent") && n.name) {
813
- let t = y(e, n.range.start);
841
+ let t = b(e, n.range.start);
814
842
  if (t && !t.closing && !/[\r\n]/.test(e.slice(t.start, t.end))) {
815
- let n = W(e, t);
816
- n !== e.slice(t.start, t.end) && o.push({
843
+ let n = G(e, t);
844
+ n !== e.slice(t.start, t.end) && i.push({
817
845
  start: t.start,
818
846
  end: t.end,
819
847
  text: n
820
848
  });
821
849
  }
822
850
  if (t) {
823
- let r = b(e, n, t.end);
851
+ let r = x(e, n, t.end);
824
852
  if (r && !/[\r\n]/.test(e.slice(r.start, r.end))) {
825
853
  let t = `</${e.slice(r.nameRange.start, r.nameRange.end)}>`;
826
- t !== e.slice(r.start, r.end) && o.push({
854
+ t !== e.slice(r.start, r.end) && i.push({
827
855
  start: r.start,
828
856
  end: r.end,
829
857
  text: t
@@ -834,9 +862,9 @@ function G(e, t) {
834
862
  n.type !== "fallback" && n.children && s(n.children);
835
863
  }
836
864
  };
837
- s(i.nodes), o.sort((e, t) => e.start - t.start || e.end - t.end);
865
+ s(r.nodes), i.sort((e, t) => e.start - t.start || e.end - t.end);
838
866
  let c = "", l = 0;
839
- for (let t of o) t.start < l || (c += e.slice(l, t.start) + t.text, l = t.end);
867
+ for (let t of i) t.start < l || (c += e.slice(l, t.start) + t.text, l = t.end);
840
868
  return c + e.slice(l);
841
869
  }
842
- export { U as i, V as n, G as r, k as t };
870
+ export { W as i, H as n, K as r, A as t };