reactive-md 0.9.0 → 0.9.2

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 (338) hide show
  1. package/CHANGELOG-ch.md +333 -306
  2. package/CHANGELOG.md +334 -307
  3. package/CONTRIBUTING-ch.md +22 -22
  4. package/CONTRIBUTING.md +22 -22
  5. package/README-ch.md +431 -431
  6. package/README-en.md +431 -431
  7. package/README.md +429 -429
  8. package/SECURITY-ch.md +83 -83
  9. package/SECURITY.md +83 -83
  10. package/THIRD_PARTY_NOTICES.md +111 -1
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +263 -263
  13. package/cli/assets.mjs +395 -395
  14. package/cli/build.mjs +445 -444
  15. package/cli/check.mjs +444 -444
  16. package/cli/document.mjs +130 -130
  17. package/cli/errors.mjs +61 -61
  18. package/cli/fs-utils.mjs +133 -133
  19. package/cli/glob.mjs +203 -203
  20. package/cli/help.mjs +323 -323
  21. package/cli/init.mjs +1577 -1577
  22. package/cli/lint.mjs +177 -177
  23. package/cli/main.mjs +65 -65
  24. package/cli/migrate.mjs +368 -368
  25. package/cli/package-loader.mjs +41 -41
  26. package/cli/package.mjs +211 -211
  27. package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-BuqgJZEY.js} +11 -11
  28. package/dist-library/LocalDocumentViewCore-DXE0I0Qc.js +9830 -0
  29. package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +275 -0
  30. package/dist-library/{authoring-Co_TiE-P.js → authoring-Ci_KzJ0q.js} +87 -67
  31. package/dist-library/{compile-LhpTKqCR.js → compile-Dx6Uw3D9.js} +11 -11
  32. package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-DDDdvuLy.js} +2618 -1846
  33. package/dist-library/compiler-dxLPB9Ym.js +86 -0
  34. package/dist-library/{component-state-BBJ08vML.js → component-state-BRwvTV0d.js} +15 -14
  35. package/dist-library/component-state-CwKX_SN5.js +763 -0
  36. package/dist-library/{config-BUo-8O5C.js → config-DXLvctiZ.js} +68 -66
  37. package/dist-library/config-validation-D3D7Dy2J.js +586 -0
  38. package/dist-library/{controls-BWiLLtBO.js → controls-DoZyLCrV.js} +2434 -2410
  39. package/dist-library/{coordinate-BSl6enWV.js → coordinate-B1VFK9fd.js} +108 -107
  40. package/dist-library/{data-table-DfvytZKQ.js → data-table-8-3F15Jf.js} +69 -66
  41. package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
  42. package/dist-library/{display-lw3BT1TA.js → display-B_uutKkN.js} +1 -1
  43. package/dist-library/{config-validation-C5kJYk-J.js → document-theme-C8J6UyNO.js} +241 -731
  44. package/dist-library/export-CIAIPBov.js +370 -0
  45. package/dist-library/{gallery-B8kSt1oI.js → gallery-Dv1rOvL0.js} +151 -147
  46. package/dist-library/html-Cr4CBwAH.js +758 -0
  47. package/dist-library/identity-BUx0Q_-d.js +40 -0
  48. package/dist-library/{incremental-D_6vwAAE.js → incremental-9nx92u9c.js} +407 -143
  49. package/dist-library/layout-BBB2VF0S.js +562 -0
  50. package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-DMZ5wd3t.js} +3 -3
  51. package/dist-library/observability-4KqXhIEU.js +421 -0
  52. package/dist-library/observability-core-Bcu7vpnl.js +24 -0
  53. package/dist-library/options-BBp9IcHm.js +121 -0
  54. package/dist-library/{package-core-D0POW4Gd.js → package-core-K5xesGqy.js} +30 -29
  55. package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-CBA1-hdG.js} +3332 -3840
  56. package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
  57. package/dist-library/preset-core-DeZPA8IE.js +1298 -0
  58. package/dist-library/react-0DCh-Mar.js +7 -0
  59. package/dist-library/reactive-md-authoring.js +28 -30
  60. package/dist-library/reactive-md-build.js +99 -61
  61. package/dist-library/reactive-md-compiler-standard.js +10 -9
  62. package/dist-library/reactive-md-compiler.js +3 -3
  63. package/dist-library/reactive-md-default-packs.js +3 -2
  64. package/dist-library/reactive-md-default-preset.js +3 -2
  65. package/dist-library/reactive-md-export.js +4 -4
  66. package/dist-library/reactive-md-minimal-preset.js +2 -2
  67. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  68. package/dist-library/reactive-md-observability.js +4 -0
  69. package/dist-library/reactive-md-pdf.js +127 -3
  70. package/dist-library/reactive-md-plugin-chart.js +3 -3
  71. package/dist-library/reactive-md-plugin-data.js +5 -5
  72. package/dist-library/reactive-md-plugin-diagram.js +4 -4
  73. package/dist-library/reactive-md-plugin-forms.js +4 -4
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +3 -3
  76. package/dist-library/reactive-md-plugin-network.js +119 -116
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-print.css +304 -304
  79. package/dist-library/reactive-md-react-minimal.js +4 -4
  80. package/dist-library/reactive-md-react-server.js +6 -6
  81. package/dist-library/reactive-md-react-unstyled.js +11 -12
  82. package/dist-library/reactive-md-react.js +11 -12
  83. package/dist-library/reactive-md-runtime-browser.js +2 -1
  84. package/dist-library/reactive-md-runtime.js +4 -3
  85. package/dist-library/reactive-md-sdk.js +8 -7
  86. package/dist-library/reactive-md-standalone-configured.js +2 -2
  87. package/dist-library/reactive-md-standalone-host.js +2 -2
  88. package/dist-library/reactive-md-testing-browser.js +2 -2
  89. package/dist-library/reactive-md-testing-react.js +6 -6
  90. package/dist-library/reactive-md-testing.js +5 -5
  91. package/dist-library/reactive-md.js +649 -373
  92. package/dist-library/{registry-05JiqmEp.js → registry-D6OGkOcX.js} +3 -3
  93. package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
  94. package/dist-library/{resources-IeJomeUT.js → resources-B0x_w3s9.js} +71 -46
  95. package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
  96. package/dist-library/{runtime-CuOyRe9f.js → runtime-BpQdZmFI.js} +269 -263
  97. package/dist-library/{schema-C-AeByPp.js → schema-BryM_VRW.js} +14 -14
  98. package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-ChslheKs.js} +499 -158
  99. package/dist-library/{session-core-BGka5D1J.js → session-core-dxQCJBNa.js} +171 -156
  100. package/dist-library/{shareable-jkGi2g6y.js → shareable-B8xMoGEa.js} +265 -297
  101. package/dist-library/types/authoring/catalog.d.ts +1 -2
  102. package/dist-library/types/build/diagnostics.d.ts +1 -1
  103. package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
  104. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  105. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  106. package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
  107. package/dist-library/types/local/compilation/compiler.d.ts +3 -3
  108. package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
  109. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  110. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  111. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
  112. package/dist-library/types/local/configuration/options-core.d.ts +1 -2
  113. package/dist-library/types/local/configuration/options.d.ts +1 -0
  114. package/dist-library/types/local/css/author-css.d.ts +66 -0
  115. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  116. package/dist-library/types/local/html/html.d.ts +39 -3
  117. package/dist-library/types/local/index.d.ts +7 -1
  118. package/dist-library/types/local/observability-codes.d.ts +2 -0
  119. package/dist-library/types/local/observability-core.d.ts +25 -0
  120. package/dist-library/types/local/observability-messages.d.ts +6 -0
  121. package/dist-library/types/local/observability.d.ts +43 -0
  122. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  123. package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
  124. package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
  125. package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
  126. package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
  127. package/dist-library/types/local/parsing/parser.d.ts +2 -2
  128. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  129. package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
  130. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
  131. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  132. package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
  133. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  134. package/dist-library/types/local/transport/worker.d.ts +79 -5
  135. package/dist-library/types/local/types.d.ts +60 -16
  136. package/dist-library/types/observability.d.ts +7 -0
  137. package/dist-library/types/react/component-api.d.ts +10 -1
  138. package/dist-library/types/react/component-utils.d.ts +9 -1
  139. package/dist-library/types/react/sdk-core.d.ts +4 -1
  140. package/dist-library/types/shareable.d.ts +5 -4
  141. package/dist-library/types/standalone/prepare.d.ts +1 -1
  142. package/dist-library/types/standalone/session-core.d.ts +3 -2
  143. package/dist-library/{types-BFC5rzC4.js → types-Ib5kSScP.js} +1 -1
  144. package/dist-library/types-daDo2c_w.js +3 -0
  145. package/dist-library/{validation-BlDL2uD9.js → validation-B3RI0xOk.js} +218 -200
  146. package/dist-library/version-DAxuGOG2.js +147 -0
  147. package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-_rcd5HUv.js} +6 -5
  148. package/dist-library/{visuals-BkYRmYGO.js → visuals-DkDhNdEZ.js} +24191 -24190
  149. package/dist-standalone/reactive-md-standalone.js +124 -117
  150. package/docs/README-ch.md +101 -94
  151. package/docs/README.md +101 -94
  152. package/docs/compatibility/api-stability-ch.md +25 -0
  153. package/docs/compatibility/api-stability-en.md +25 -0
  154. package/docs/compatibility/compatibility-ch.md +146 -129
  155. package/docs/compatibility/compatibility-en.md +146 -129
  156. package/docs/compatibility/compatibility-manifest.schema.json +161 -0
  157. package/docs/compatibility/deprecation-ch.md +21 -0
  158. package/docs/compatibility/deprecation-en.md +21 -0
  159. package/docs/compatibility/source-versioning-ch.md +162 -162
  160. package/docs/compatibility/source-versioning-en.md +162 -162
  161. package/docs/compatibility/support-matrix-ch.md +108 -0
  162. package/docs/compatibility/support-matrix-en.md +108 -0
  163. package/docs/development/component-development-ch.md +66 -66
  164. package/docs/development/component-development-en.md +66 -66
  165. package/docs/development/component-development-reference-ch.md +253 -253
  166. package/docs/development/component-development-reference-en.md +238 -238
  167. package/docs/development/component-protocol-ch.md +748 -748
  168. package/docs/development/component-protocol-en.md +750 -750
  169. package/docs/development/extension-tutorial-ch.md +308 -308
  170. package/docs/development/extension-tutorial-en.md +308 -308
  171. package/docs/development/performance-overview-ch.md +422 -422
  172. package/docs/development/performance-overview-en.md +422 -422
  173. package/docs/guides/local-guide-ch.md +532 -532
  174. package/docs/guides/local-guide-en.md +532 -532
  175. package/docs/integration/author-tools-ch.md +64 -64
  176. package/docs/integration/author-tools-en.md +64 -64
  177. package/docs/integration/compiler-ch.md +49 -47
  178. package/docs/integration/compiler-en.md +36 -34
  179. package/docs/integration/directory-discovery-en.md +1 -1
  180. package/docs/integration/editor-ch.md +295 -295
  181. package/docs/integration/editor-en.md +303 -303
  182. package/docs/integration/extension-sdk-ch.md +394 -394
  183. package/docs/integration/extension-sdk-en.md +379 -379
  184. package/docs/integration/local-integration-ch.md +646 -524
  185. package/docs/integration/local-integration-en.md +662 -540
  186. package/docs/integration/shareable-export-ch.md +307 -305
  187. package/docs/integration/shareable-export-en.md +309 -307
  188. package/docs/reference/diagnostics-counting-ch.md +104 -104
  189. package/docs/reference/diagnostics-counting-en.md +104 -104
  190. package/docs/reference/html-compatibility-ch.md +93 -140
  191. package/docs/reference/html-compatibility-en.md +95 -140
  192. package/docs/reference/local-interaction-syntax-ch.md +724 -724
  193. package/docs/reference/local-interaction-syntax-en.md +722 -722
  194. package/docs/reference/public-api-ch.md +39 -7
  195. package/docs/reference/public-api-en.md +39 -7
  196. package/docs/reference/theme-protocol-ch.md +198 -198
  197. package/docs/reference/theme-protocol-en.md +217 -217
  198. package/docs/releases/release-0.4.0-ch.md +91 -91
  199. package/docs/releases/release-0.4.0-en.md +91 -91
  200. package/docs/releases/release-0.4.1-ch.md +25 -25
  201. package/docs/releases/release-0.4.1-en.md +25 -25
  202. package/docs/releases/release-0.5.0-ch.md +43 -43
  203. package/docs/releases/release-0.5.0-en.md +43 -43
  204. package/docs/releases/release-0.5.1-ch.md +41 -41
  205. package/docs/releases/release-0.5.1-en.md +41 -41
  206. package/docs/releases/release-0.5.2-ch.md +37 -37
  207. package/docs/releases/release-0.5.2-en.md +37 -37
  208. package/docs/releases/release-0.5.3-ch.md +26 -26
  209. package/docs/releases/release-0.5.3-en.md +26 -26
  210. package/docs/releases/release-0.6.0-ch.md +59 -59
  211. package/docs/releases/release-0.6.0-en.md +59 -59
  212. package/docs/releases/release-0.6.1-ch.md +29 -29
  213. package/docs/releases/release-0.6.1-en.md +29 -29
  214. package/docs/releases/release-0.7.0-ch.md +86 -86
  215. package/docs/releases/release-0.7.0-en.md +86 -86
  216. package/docs/releases/release-0.9.1-ch.md +29 -0
  217. package/docs/releases/release-0.9.1-en.md +29 -0
  218. package/docs/releases/release-0.9.2-ch.md +33 -0
  219. package/docs/releases/release-0.9.2-en.md +33 -0
  220. package/examples/component-package/README-ch.md +101 -101
  221. package/examples/component-package/README.md +133 -133
  222. package/examples/conformance/README-ch.md +55 -55
  223. package/examples/conformance/README.md +55 -55
  224. package/examples/conformance/component-protocol-1.json +482 -482
  225. package/examples/conformance/component-protocol-1.schema.json +76 -76
  226. package/examples/conformance/local-draft-1.json +50 -50
  227. package/examples/conformance/local-draft-2.json +212 -212
  228. package/examples/game-2048-package/LICENSE +21 -21
  229. package/examples/game-2048-package/NOTICES.md +11 -11
  230. package/examples/game-2048-package/README-ch.md +91 -91
  231. package/examples/game-2048-package/README.md +98 -98
  232. package/examples/game-2048-package/package.json +35 -35
  233. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  234. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  235. package/examples/game-2048-package/scripts/build.mjs +130 -130
  236. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  237. package/examples/game-2048-package/src/component.css +161 -161
  238. package/examples/game-2048-package/src/components.tsx +326 -326
  239. package/examples/game-2048-package/src/game-engine.ts +228 -228
  240. package/examples/game-2048-package/src/harness.tsx +34 -34
  241. package/examples/game-2048-package/src/manifest.ts +85 -85
  242. package/examples/game-2048-package/src/node-entry.ts +30 -30
  243. package/examples/game-2048-package/src/sample.ts +4 -4
  244. package/examples/game-2048-package/tsconfig.json +15 -15
  245. package/examples/integration/README-ch.md +82 -63
  246. package/examples/integration/README.md +82 -63
  247. package/examples/integration/core/index.mjs +32 -32
  248. package/examples/integration/extension-sdk/README-ch.md +24 -24
  249. package/examples/integration/extension-sdk/README.md +24 -24
  250. package/examples/integration/streaming/index.html +48 -0
  251. package/examples/integration/streaming/main.js +175 -0
  252. package/examples/integration/streaming/package.json +13 -0
  253. package/examples/integration/streaming/worker.js +3 -0
  254. package/examples/integration/worker/index.html +19 -19
  255. package/examples/integration/worker/main.js +61 -61
  256. package/examples/integration/worker/package.json +13 -13
  257. package/examples/integration/worker/worker.js +3 -3
  258. package/examples/local/README-ch.md +76 -76
  259. package/examples/local/README.md +76 -76
  260. package/examples/local/charts.reactive.md +73 -73
  261. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  262. package/examples/local/recipes/invoice.reactive.md +36 -36
  263. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  264. package/examples/local/recipes/workshop.reactive.md +33 -33
  265. package/examples/local/showcase/README-ch.md +22 -22
  266. package/examples/local/showcase/README.md +31 -31
  267. package/examples/local/showcase/explore.reactive.md +102 -102
  268. package/examples/local/showcase/flow.reactive.md +86 -86
  269. package/examples/local/showcase/forms.reactive.md +126 -126
  270. package/examples/local/showcase/functions.reactive.md +119 -119
  271. package/examples/local/showcase/layout.reactive.md +100 -100
  272. package/examples/local/showcase/statistics.reactive.md +108 -108
  273. package/examples/local/showcase/tasks.reactive.md +89 -89
  274. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  275. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  276. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  277. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  278. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  279. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  280. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  281. package/examples/minimal-extension/README-ch.md +78 -78
  282. package/examples/minimal-extension/README.md +78 -78
  283. package/examples/minimal-extension/index.html +15 -15
  284. package/examples/minimal-extension/package.json +26 -26
  285. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  286. package/examples/minimal-extension/scripts/build.mjs +32 -32
  287. package/examples/minimal-extension/scripts/export.mjs +72 -72
  288. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  289. package/examples/minimal-extension/src/extension.tsx +90 -90
  290. package/examples/minimal-extension/src/preview.tsx +12 -12
  291. package/examples/minimal-extension/src/source.ts +4 -4
  292. package/examples/minimal-extension/tsconfig.json +14 -14
  293. package/examples/sci-fi-theme/README-ch.md +133 -133
  294. package/examples/sci-fi-theme/README.md +148 -148
  295. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  296. package/examples/sci-fi-theme/demo/demo.css +638 -638
  297. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  298. package/examples/sci-fi-theme/demo/index.html +13 -13
  299. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  300. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  301. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  302. package/examples/sci-fi-theme/package.json +28 -28
  303. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  304. package/examples/sci-fi-theme/src/components.css +2370 -2370
  305. package/examples/sci-fi-theme/src/index.ts +6 -6
  306. package/examples/sci-fi-theme/src/notch.css +142 -142
  307. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  308. package/examples/sci-fi-theme/src/theme.ts +39 -39
  309. package/examples/sci-fi-theme/tsconfig.json +20 -20
  310. package/examples/sci-fi-theme/vite.config.ts +24 -24
  311. package/examples/tetris-package/LICENSE +21 -21
  312. package/examples/tetris-package/NOTICES.md +11 -11
  313. package/examples/tetris-package/README-ch.md +91 -91
  314. package/examples/tetris-package/README.md +95 -95
  315. package/examples/tetris-package/package.json +35 -35
  316. package/examples/tetris-package/sample/document.reactive.md +16 -16
  317. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  318. package/examples/tetris-package/scripts/build.mjs +130 -130
  319. package/examples/tetris-package/scripts/verify.mjs +173 -173
  320. package/examples/tetris-package/src/component.css +145 -145
  321. package/examples/tetris-package/src/components.tsx +334 -334
  322. package/examples/tetris-package/src/harness.tsx +34 -34
  323. package/examples/tetris-package/src/manifests.ts +93 -93
  324. package/examples/tetris-package/src/node-entry.ts +16 -16
  325. package/examples/tetris-package/src/sample.ts +4 -4
  326. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  327. package/examples/tetris-package/tsconfig.json +15 -15
  328. package/package.json +12 -1
  329. package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
  330. package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
  331. package/dist-library/compiler-DfGbQhyD.js +0 -62
  332. package/dist-library/component-state-BoLCGee4.js +0 -801
  333. package/dist-library/component-utils-BvHL8VGt.js +0 -298
  334. package/dist-library/export-C7IDW9ul.js +0 -311
  335. package/dist-library/layout-C22VjZh0.js +0 -542
  336. package/dist-library/options-CdSKOi7p.js +0 -116
  337. package/dist-library/preset-core-CKc5YXSM.js +0 -1443
  338. package/dist-library/react-LY5qsVeP.js +0 -7
@@ -1,542 +0,0 @@
1
- import { A as e, I as t, M as n, O as r, P as i, S as a, _ as o, a as s, g as c, k as l, n as u, o as d, r as f, s as p, t as m } from "./component-utils-BvHL8VGt.js";
2
- import { n as h, t as g } from "./tooltip-layer-HDLrSWs0.js";
3
- import { useEffect as _, useId as v, useRef as y, useState as b } from "react";
4
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
5
- // src/components/layout/layout.tsx
6
- function w(t) {
7
- let n = e(t), { content: i, runtime: a, mode: o, t: s } = n, c = r(t, "title", ""), l = p(t, "reset", !0) && o !== "static", [u, d] = b(null);
8
- return /* @__PURE__ */ C("section", {
9
- className: "md-panel local-panel",
10
- "aria-label": c || s("Parameter panel", "参数面板"),
11
- children: [
12
- c || l ? /* @__PURE__ */ C("div", {
13
- className: "local-panel-head",
14
- children: [c ? /* @__PURE__ */ S("h3", {
15
- className: "md-panel-title local-panel-title",
16
- children: c
17
- }) : /* @__PURE__ */ S("span", {}), l ? /* @__PURE__ */ S("button", {
18
- type: "button",
19
- className: "md-button md-button-quiet local-panel-reset",
20
- onClick: () => {
21
- try {
22
- a.reset(i), d(null);
23
- } catch (e) {
24
- d(e instanceof Error ? e.message : s("Cannot reset", "无法恢复默认"));
25
- }
26
- },
27
- "aria-label": c ? s(`Reset ${c}`, `${c} 恢复默认`) : s("Reset", "恢复默认"),
28
- children: s("Reset", "恢复默认")
29
- }) : null]
30
- }) : null,
31
- /* @__PURE__ */ S("div", {
32
- className: "md-panel-body local-panel-body",
33
- children: n.render()
34
- }),
35
- /* @__PURE__ */ S(m, { message: u })
36
- ]
37
- });
38
- }
39
- function T(t) {
40
- let n = e(t), i = r(t, "title", "");
41
- return /* @__PURE__ */ C("section", {
42
- className: "md-card local-card",
43
- children: [i ? /* @__PURE__ */ S("h3", {
44
- className: "md-card-title",
45
- children: i
46
- }) : null, /* @__PURE__ */ S("div", {
47
- className: "md-card-body",
48
- children: n.render()
49
- })]
50
- });
51
- }
52
- function E(t) {
53
- let n = e(t), r = Math.min(4, Math.max(1, Math.floor(Number(t.props.columns ?? 2) || 2)));
54
- return /* @__PURE__ */ S("div", {
55
- className: "local-grid",
56
- style: { "--local-grid-columns": String(r) },
57
- children: n.render()
58
- });
59
- }
60
- function D(t) {
61
- let n = e(t);
62
- return /* @__PURE__ */ S("div", {
63
- className: "local-tabpanel-body",
64
- children: n.render()
65
- });
66
- }
67
- function O() {
68
- return null;
69
- }
70
- function k() {
71
- return null;
72
- }
73
- function A() {
74
- return null;
75
- }
76
- function j(o) {
77
- let s = e(o), l = v(), { content: d, mode: p, visible: h, t: g } = s, { write: _, error: x } = t(o), w = r(o, "label", ""), T = i(o), E = d.children.filter((e) => e.kind === "component" && e.name === "tab"), D = E.map((e, t) => a(e, "value") ?? `tab-${t + 1}`), O = E.map((e, t) => c(o, e, "label", D[t])), k = a(d, "initial") ?? D[0] ?? "", A = a(d, "bind") !== void 0, j = o.runtime.get(d), M = typeof j == "string" ? j : "", [N, P] = b(() => D.includes(k) ? k : D[0] ?? ""), F = y([]);
78
- if (n(o, () => {
79
- P(D.includes(k) ? k : D[0] ?? "");
80
- }), E.length === 0) return /* @__PURE__ */ S(u, { message: g("Tabs requires at least one tab", "标签页至少需要一个 tab") });
81
- if (p === "static") return /* @__PURE__ */ C("section", {
82
- className: "local-tabs local-static-tabs",
83
- "aria-label": w || g("Tabs", "选项卡"),
84
- children: [w ? /* @__PURE__ */ S("div", {
85
- className: "local-tabs-label",
86
- children: w
87
- }) : null, E.map((e, t) => /* @__PURE__ */ C("section", {
88
- className: "local-static-tab",
89
- children: [/* @__PURE__ */ S("h4", {
90
- className: "local-static-tab-label",
91
- children: O[t]
92
- }), /* @__PURE__ */ S("div", {
93
- className: "local-static-tab-body",
94
- children: s.render(e.children, h)
95
- })]
96
- }, e.id))]
97
- });
98
- let I = A ? D.includes(M) ? M : D[0] : D.includes(N) ? N : D[0], L = Math.max(0, D.indexOf(I)), R = (e) => {
99
- let t = D[e];
100
- t !== void 0 && (A ? _(t) : P(t), F.current[e]?.focus());
101
- };
102
- return /* @__PURE__ */ C("section", {
103
- className: "md-tabs local-tabs",
104
- "aria-label": w || g("Tabs", "选项卡"),
105
- "aria-invalid": T.invalid || void 0,
106
- "aria-describedby": T.describedBy,
107
- children: [
108
- w ? /* @__PURE__ */ S("div", {
109
- className: "local-tabs-label",
110
- children: w
111
- }) : null,
112
- /* @__PURE__ */ S("div", {
113
- className: "md-tablist local-tablist",
114
- role: "tablist",
115
- "aria-label": w || g("Tabs", "选项卡"),
116
- onKeyDown: (e) => {
117
- let t = -1;
118
- e.key === "ArrowRight" ? t = (L + 1) % E.length : e.key === "ArrowLeft" ? t = (L - 1 + E.length) % E.length : e.key === "Home" ? t = 0 : e.key === "End" && (t = E.length - 1), !(t < 0) && (e.preventDefault(), R(t));
119
- },
120
- children: E.map((e, t) => {
121
- let n = D[t], r = n === I;
122
- return /* @__PURE__ */ S("button", {
123
- ref: (e) => {
124
- F.current[t] = e;
125
- },
126
- id: `${l}-tab-${t}`,
127
- type: "button",
128
- role: "tab",
129
- className: `md-tab local-tab${r ? " is-selected" : ""}`,
130
- "aria-selected": r,
131
- "aria-controls": `${l}-panel-${t}`,
132
- tabIndex: r ? 0 : -1,
133
- onClick: () => {
134
- A ? _(n) : P(n);
135
- },
136
- children: O[t]
137
- }, e.id);
138
- })
139
- }),
140
- E.map((e, t) => {
141
- let n = D[t] === I;
142
- return /* @__PURE__ */ C("div", {
143
- id: `${l}-panel-${t}`,
144
- className: "md-tabpanel local-tabpanel",
145
- role: "tabpanel",
146
- "aria-labelledby": `${l}-tab-${t}`,
147
- tabIndex: 0,
148
- hidden: !n,
149
- children: [/* @__PURE__ */ S(f, {
150
- block: !0,
151
- value: O[t]
152
- }), s.render(e.children, h && n)]
153
- }, e.id);
154
- }),
155
- /* @__PURE__ */ S(m, { message: x })
156
- ]
157
- });
158
- }
159
- function M(o) {
160
- let s = e(o), l = v(), { content: d, mode: f, visible: p, t: h } = s, { write: g, error: b, setError: x } = t(o), w = r(o, "label", ""), T = i(o), E = d.children.filter((e) => e.kind === "component" && e.name === "step"), D = E.map((e, t) => a(e, "value") ?? `step-${t + 1}`), O = E.map((e, t) => c(o, e, "label", D[t])), k = a(d, "initial") ?? "", A = D.includes(k) ? k : D[0] ?? "", j = o.runtime.get(d), M = typeof j == "string" ? j : "", N = y([]), P = y(!1);
161
- n(o, () => {
162
- x(null), P.current = !1;
163
- });
164
- let F = D.includes(M) ? M : A, I = Math.max(0, D.indexOf(F));
165
- if (_(() => {
166
- P.current && (P.current = !1, N.current[I]?.focus({ preventScroll: !0 }));
167
- }, [I, F]), E.length === 0) return /* @__PURE__ */ S(u, { message: h("Steps requires at least one step", "步骤至少需要一个 step") });
168
- if (f === "static") {
169
- let e = E[I];
170
- return /* @__PURE__ */ C("section", {
171
- className: "local-steps local-static-steps",
172
- "aria-label": w || h("Steps", "步骤"),
173
- children: [
174
- w ? /* @__PURE__ */ S("div", {
175
- className: "local-steps-label",
176
- children: w
177
- }) : null,
178
- /* @__PURE__ */ S("ol", {
179
- className: "local-steps-rail",
180
- "aria-hidden": "true",
181
- style: { "--local-steps-progress": `${E.length <= 1 ? 100 : I / (E.length - 1) * 100}%` },
182
- children: E.map((e, t) => /* @__PURE__ */ S("li", {
183
- className: `local-steps-dot${t < I ? " is-complete" : t === I ? " is-current" : ""}`,
184
- children: /* @__PURE__ */ S("span", { children: t + 1 })
185
- }, e.id))
186
- }),
187
- /* @__PURE__ */ S("div", {
188
- className: "local-steps-nav local-static-steps-nav",
189
- children: /* @__PURE__ */ S("span", {
190
- className: "local-steps-status",
191
- role: "status",
192
- "aria-live": "polite",
193
- children: h(`Step ${I + 1} of ${E.length}`, `第 ${I + 1} 步,共 ${E.length} 步`)
194
- })
195
- }),
196
- /* @__PURE__ */ S("div", {
197
- className: "local-steps-panel",
198
- role: "group",
199
- "aria-label": O[I],
200
- children: s.render(e.children, p)
201
- })
202
- ]
203
- });
204
- }
205
- let L = (e) => {
206
- let t = D[e];
207
- t !== void 0 && (P.current = !0, g(t));
208
- };
209
- return /* @__PURE__ */ C("section", {
210
- className: "local-steps",
211
- "aria-label": w || h("Steps", "步骤"),
212
- "aria-invalid": T.invalid || void 0,
213
- "aria-describedby": T.describedBy,
214
- children: [
215
- w ? /* @__PURE__ */ S("div", {
216
- className: "local-steps-label",
217
- children: w
218
- }) : null,
219
- /* @__PURE__ */ S("ol", {
220
- className: "local-steps-rail",
221
- "aria-hidden": "true",
222
- style: { "--local-steps-progress": `${E.length <= 1 ? 100 : I / (E.length - 1) * 100}%` },
223
- children: E.map((e, t) => /* @__PURE__ */ S("li", {
224
- className: `local-steps-dot${t < I ? " is-complete" : t === I ? " is-current" : ""}`,
225
- children: /* @__PURE__ */ S("span", { children: t + 1 })
226
- }, e.id))
227
- }),
228
- /* @__PURE__ */ C("div", {
229
- className: "local-steps-nav",
230
- children: [
231
- /* @__PURE__ */ S("button", {
232
- type: "button",
233
- className: "md-button md-button-secondary local-steps-prev",
234
- disabled: I <= 0,
235
- onClick: () => L(I - 1),
236
- children: h("Previous", "上一步")
237
- }),
238
- /* @__PURE__ */ S("span", {
239
- className: "local-steps-status",
240
- role: "status",
241
- "aria-live": "polite",
242
- children: h(`Step ${I + 1} of ${E.length}`, `第 ${I + 1} 步,共 ${E.length} 步`)
243
- }),
244
- /* @__PURE__ */ S("button", {
245
- type: "button",
246
- className: "md-button md-button-secondary local-steps-next",
247
- disabled: I >= E.length - 1,
248
- onClick: () => L(I + 1),
249
- children: h("Next", "下一步")
250
- })
251
- ]
252
- }),
253
- E.map((e, t) => {
254
- let n = t === I;
255
- return /* @__PURE__ */ S("div", {
256
- id: `${l}-step-${t}`,
257
- ref: (e) => {
258
- N.current[t] = e;
259
- },
260
- className: "local-steps-panel",
261
- role: "group",
262
- "aria-label": O[t],
263
- tabIndex: -1,
264
- hidden: !n,
265
- children: s.render(e.children, p && n)
266
- }, e.id);
267
- }),
268
- /* @__PURE__ */ S(m, { message: b })
269
- ]
270
- });
271
- }
272
- function N() {
273
- return null;
274
- }
275
- function P(t) {
276
- let n = e(t), i = r(t, "label", "");
277
- return /* @__PURE__ */ C("div", {
278
- className: "local-accordion",
279
- role: "group",
280
- "aria-label": i || n.t("Accordion", "折叠面板"),
281
- children: [i ? /* @__PURE__ */ S("div", {
282
- className: "local-accordion-label",
283
- children: i
284
- }) : null, n.render()]
285
- });
286
- }
287
- function F(t) {
288
- let i = e(t), a = v(), { mode: o, visible: s, t: c } = i, l = r(t, "label", c("Details", "折叠内容")), u = p(t, "open", !1), [d, m] = b(u);
289
- if (n(t, () => {
290
- m(u);
291
- }), o === "static") return /* @__PURE__ */ C("section", {
292
- className: "local-disclosure local-static-disclosure",
293
- children: [/* @__PURE__ */ S("h3", {
294
- className: "local-disclosure-heading",
295
- children: l
296
- }), /* @__PURE__ */ S("div", {
297
- className: "local-disclosure-panel",
298
- children: i.render()
299
- })]
300
- });
301
- let h = `${a}-disclosure-trigger`, g = `${a}-disclosure-panel`;
302
- return /* @__PURE__ */ C("div", {
303
- className: "local-disclosure",
304
- children: [/* @__PURE__ */ C("h3", {
305
- className: "local-disclosure-heading",
306
- children: [/* @__PURE__ */ C("button", {
307
- id: h,
308
- type: "button",
309
- className: "local-disclosure-trigger",
310
- "data-rmd-appearance": "custom",
311
- "aria-expanded": d,
312
- "aria-controls": g,
313
- onClick: () => m((e) => !e),
314
- children: [/* @__PURE__ */ S("span", {
315
- className: "local-disclosure-label",
316
- children: l
317
- }), /* @__PURE__ */ S("svg", {
318
- className: `local-chevron${d ? " is-open" : ""}`,
319
- viewBox: "0 0 24 24",
320
- width: "17",
321
- height: "17",
322
- fill: "none",
323
- stroke: "currentColor",
324
- strokeWidth: "1.75",
325
- strokeLinecap: "round",
326
- strokeLinejoin: "round",
327
- "aria-hidden": "true",
328
- focusable: "false",
329
- children: /* @__PURE__ */ S("path", { d: "m6 9 6 6 6-6" })
330
- })]
331
- }), /* @__PURE__ */ S(f, { value: l })]
332
- }), /* @__PURE__ */ S("div", {
333
- id: g,
334
- className: "local-disclosure-panel",
335
- role: "region",
336
- "aria-labelledby": h,
337
- hidden: !d,
338
- inert: !d,
339
- children: /* @__PURE__ */ S("div", {
340
- className: "local-disclosure-body",
341
- children: i.render(void 0, s)
342
- })
343
- })]
344
- });
345
- }
346
- function I(t) {
347
- let n = e(t), { content: r, t: i, visible: o } = n, s = a(r, "when"), c = t.props.when, l = typeof c == "boolean" && c, d = s !== void 0 && typeof c != "boolean", f = y(null), p = y(l), m = y(!1);
348
- return _(() => {
349
- if (p.current && !l) {
350
- if (m.current) {
351
- let e = f.current?.closest(".local-document");
352
- e && (e.tabIndex = -1, e.focus({ preventScroll: !0 }));
353
- }
354
- m.current = !1;
355
- }
356
- p.current = l;
357
- }, [l]), /* @__PURE__ */ C(x, { children: [d ? /* @__PURE__ */ S(u, { message: i("Cannot compute", "无法计算") }) : null, /* @__PURE__ */ S("div", {
358
- ref: f,
359
- className: "local-if md-if",
360
- role: "group",
361
- "aria-label": i("Conditional content", "条件内容"),
362
- tabIndex: -1,
363
- hidden: !l,
364
- "aria-hidden": !l,
365
- onFocus: () => {
366
- m.current = !0;
367
- },
368
- onBlur: (e) => {
369
- f.current?.contains(e.relatedTarget) || (m.current = !1);
370
- },
371
- children: n.render(void 0, o && l)
372
- })] });
373
- }
374
- function L(t) {
375
- let n = e(t), i = r(t, "title", ""), { tone: a, error: o } = l(t, "tone", [
376
- "info",
377
- "success",
378
- "warning",
379
- "error"
380
- ], "info"), c = a === "warning" || a === "error" ? "alert" : "status";
381
- return /* @__PURE__ */ C(x, { children: [o ? /* @__PURE__ */ S(s, { message: n.t("Invalid tone; using the default style", "色调无效,已使用默认样式") }) : null, /* @__PURE__ */ C("div", {
382
- className: `md-alert md-alert-${a} local-alert local-alert-${a}`,
383
- role: c,
384
- children: [i ? /* @__PURE__ */ S("div", {
385
- className: "md-alert-title local-alert-title",
386
- children: i
387
- }) : null, /* @__PURE__ */ S("div", {
388
- className: "md-alert-body local-alert-body",
389
- children: n.render()
390
- })]
391
- })] });
392
- }
393
- function R(t) {
394
- let n = e(t), { tone: r, error: i } = l(t, "tone", [
395
- "neutral",
396
- "success",
397
- "warning"
398
- ], "neutral"), a = o(n.content);
399
- return /* @__PURE__ */ C(x, { children: [i ? /* @__PURE__ */ S(s, { message: n.t("Invalid tone; using the default style", "色调无效,已使用默认样式") }) : null, /* @__PURE__ */ S("span", {
400
- className: `md-badge md-badge-${r} local-badge`,
401
- style: a ? { color: a } : void 0,
402
- children: /* @__PURE__ */ S("span", {
403
- className: "md-badge-label",
404
- children: n.renderInline()
405
- })
406
- })] });
407
- }
408
- function z(t) {
409
- let n = e(t), i = v(), { mode: a, t: o } = n, s = r(t, "text", o("Tooltip", "提示")), [c, l] = b(!1), u = y(null), d = y(null), p = `${i}-tooltip`, m = c && t.visible && a !== "static";
410
- return h(d, m), _(() => l(!1), [
411
- t.visible,
412
- t.resetToken,
413
- a
414
- ]), g(() => {
415
- let e = d.current, t = u.current;
416
- if (!m || !e || !t) return;
417
- let n = () => {
418
- let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = Number.parseFloat(getComputedStyle(e).getPropertyValue("--space-2")) || 8, a = Math.max(8, Math.min(r.left, window.innerWidth - n.width - 8)), o = r.top - n.height - i, s = o >= 8 ? o : Math.max(8, Math.min(r.bottom + i, window.innerHeight - n.height - 8));
419
- e.style.left = `${a}px`, e.style.top = `${s}px`;
420
- };
421
- n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, {
422
- capture: !0,
423
- passive: !0
424
- });
425
- let r = new ResizeObserver(n);
426
- return r.observe(t), r.observe(e), () => {
427
- window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0), r.disconnect();
428
- };
429
- }, [m, s]), a === "static" ? /* @__PURE__ */ C("span", {
430
- className: "local-tooltip local-static-tooltip",
431
- children: [/* @__PURE__ */ S("span", {
432
- className: "local-tooltip-trigger",
433
- children: n.renderInline()
434
- }), /* @__PURE__ */ S("span", {
435
- className: "md-tooltip local-tooltip-bubble is-visible",
436
- role: "note",
437
- children: s
438
- })]
439
- }) : /* @__PURE__ */ C("span", {
440
- className: "local-tooltip",
441
- onMouseEnter: () => l(!0),
442
- onMouseLeave: () => l(!1),
443
- children: [
444
- /* @__PURE__ */ S("span", {
445
- className: "local-tooltip-trigger",
446
- ref: u,
447
- tabIndex: 0,
448
- "aria-describedby": p,
449
- onFocus: () => l(!0),
450
- onBlur: () => l(!1),
451
- onKeyDown: (e) => {
452
- e.key === "Escape" && (e.stopPropagation(), l(!1));
453
- },
454
- children: n.renderInline()
455
- }),
456
- /* @__PURE__ */ S("span", {
457
- id: p,
458
- ref: d,
459
- role: "tooltip",
460
- popover: "manual",
461
- className: `md-tooltip local-tooltip-bubble${m ? " is-visible" : ""}`,
462
- children: s
463
- }),
464
- /* @__PURE__ */ S(f, { value: s })
465
- ]
466
- });
467
- }
468
- function B(t) {
469
- let r = e(t), i = v(), { content: s, mode: c, t: l } = r, u = `${i}-jump-feedback`, [f, p] = b(null), m = a(s, "to") ?? "", h = r.navigation.targetId(m), g = a(s, "appearance") === "button" ? "button" : "link", _ = o(s), y = h ? `#${h}` : "#", w = h !== void 0 && r.navigation.allowed(m);
470
- return n(t, () => p(null)), c === "static" ? w && h ? /* @__PURE__ */ S("a", {
471
- href: `#${h}`,
472
- className: "local-jump local-jump-link local-jump-static",
473
- style: d(_),
474
- children: r.renderInline()
475
- }) : /* @__PURE__ */ S("span", {
476
- className: "local-jump local-jump-static-blocked",
477
- style: d(_),
478
- children: r.renderInline()
479
- }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("a", {
480
- href: w ? y : "#",
481
- className: g === "button" ? "local-jump local-jump-button md-button md-button-secondary" : "local-jump local-jump-link",
482
- style: d(_),
483
- "data-local-custom-color": _ ? "true" : void 0,
484
- "data-local-target-missing": h ? void 0 : "true",
485
- "data-local-jump-blocked": h && !w ? "true" : void 0,
486
- "aria-describedby": f ? u : void 0,
487
- onClick: (e) => {
488
- if (!w || !h) {
489
- e.preventDefault(), p(h ? l("Jump is blocked by the host", "跳转已被主机策略阻止") : l("Jump target not found", "找不到跳转目标"));
490
- return;
491
- }
492
- if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
493
- let t = r.navigation.jump(m);
494
- t === "missing" ? (e.preventDefault(), p(l("Jump target not found", "找不到跳转目标"))) : t === "hidden" ? (e.preventDefault(), p(l("Jump target is hidden", "跳转目标当前隐藏"))) : (e.preventDefault(), p(null));
495
- },
496
- children: r.renderInline()
497
- }), f ? /* @__PURE__ */ S("span", {
498
- id: u,
499
- className: "local-jump-feedback",
500
- role: "status",
501
- "aria-live": "polite",
502
- children: f
503
- }) : null] });
504
- }
505
- function V(t) {
506
- let n = e(t).navigation.anchorId();
507
- return n ? /* @__PURE__ */ S("span", {
508
- className: "local-anchor",
509
- id: n,
510
- "data-local-anchor": ""
511
- }) : null;
512
- }
513
- function H(t) {
514
- let n = e(t), r = o(n.content);
515
- return /* @__PURE__ */ S("span", {
516
- className: "local-text",
517
- style: r ? { color: r } : void 0,
518
- children: n.renderInline()
519
- });
520
- }
521
- function U(t) {
522
- let n = e(t), r = o(n.content);
523
- return /* @__PURE__ */ S("div", {
524
- className: "local-section",
525
- style: r ? { color: r } : void 0,
526
- children: n.render()
527
- });
528
- }
529
- function W(t) {
530
- let n = e(t), r = t.validation.hintFor(t.content);
531
- if (!r) return null;
532
- let i = r.failed || r.error, a = n.visible && i;
533
- return /* @__PURE__ */ S("span", {
534
- id: r.id,
535
- className: "local-validation-hint",
536
- "data-local-validation": r.error ? "error" : r.failed ? "failed" : "passed",
537
- role: a ? "status" : void 0,
538
- "aria-live": a ? "polite" : void 0,
539
- children: i ? r.message : null
540
- });
541
- }
542
- export { D as _, T as a, z as b, A as c, B as d, O as f, M as g, N as h, R as i, E as l, U as m, L as n, k as o, w as p, V as r, F as s, P as t, I as u, j as v, W as x, H as y };
@@ -1,116 +0,0 @@
1
- import { g as e, y as t } from "./validation-BlDL2uD9.js";
2
- import { t as n } from "./parser-standard-OToYcOBL.js";
3
- import r from "./reactive-md-default-preset.js";
4
- import { a as i, o as a, s as o } from "./config-BUo-8O5C.js";
5
- import { n as s } from "./registry-05JiqmEp.js";
6
- // src/local/configuration/options.ts
7
- function c(e) {
8
- return t(e, {
9
- defaults: s(),
10
- preset: {
11
- id: r.id,
12
- version: r.version
13
- },
14
- defaultConfigKey: i(),
15
- readConfig: (e) => o(e),
16
- configKey: (e) => i(e),
17
- capabilities: n
18
- });
19
- }
20
- function l(e) {
21
- return typeof e == "object" && !!e && !Array.isArray(e);
22
- }
23
- var u = 256, d = 4096, f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new WeakMap(), h = 0;
24
- function g() {
25
- return h += 1, h;
26
- }
27
- function _(e) {
28
- if (typeof e == "object" && e || typeof e == "function") {
29
- let t = e, n = m.get(t);
30
- return n === void 0 && (n = g(), m.set(t, n)), `unreadable#${n}`;
31
- }
32
- return `unreadable:${typeof e}:${String(e)}`;
33
- }
34
- function v(e) {
35
- let t = [], n = 0, r = (e) => {
36
- if (n += 1, n > d) throw RangeError("signature budget");
37
- switch (typeof e) {
38
- case "string": return `s${JSON.stringify(e)}`;
39
- case "number": return `n${Object.is(e, -0) ? "-0" : String(e)}`;
40
- case "boolean": return e ? "b1" : "b0";
41
- case "undefined": return "u";
42
- case "bigint": return `g${e.toString()}`;
43
- case "symbol": {
44
- let t = p.get(e);
45
- return t === void 0 && (t = g(), p.set(e, t)), `y${t}`;
46
- }
47
- case "function": {
48
- let t = f.get(e);
49
- return t === void 0 && (t = g(), f.set(e, t)), `f${t}`;
50
- }
51
- }
52
- if (e === null) return "null";
53
- let i = e, a = t.indexOf(i);
54
- if (a >= 0) return `r${a}`;
55
- t.push(i);
56
- try {
57
- if (Array.isArray(i)) {
58
- let e = Math.min(i.length, 8);
59
- if (i.length > u) {
60
- let t = `a#${i.length}[`;
61
- for (let n = 0; n < e; n += 1) t += `${r(i[n])},`;
62
- return `${t}]`;
63
- }
64
- let t = `a${i.length}[`;
65
- for (let e = 0; e < i.length; e += 1) t += `${r(i[e])},`;
66
- return `${t}]`;
67
- }
68
- let e = Object.keys(i);
69
- if (e.length > u) {
70
- let t = `o#${e.length}{`;
71
- for (let n of e.slice(0, 8)) t += `${r(n)},`;
72
- return `${t}}`;
73
- }
74
- e.sort();
75
- let t = "o{";
76
- for (let n of e) t += `${r(n)}:${r(i[n])},`;
77
- return `${t}}`;
78
- } finally {
79
- t.pop();
80
- }
81
- };
82
- try {
83
- return r(e);
84
- } catch {
85
- return _(e);
86
- }
87
- }
88
- function y(t) {
89
- if (t === void 0 && (t = {}), !l(t)) return "invalid";
90
- let n = e.map((e) => {
91
- if (!Object.hasOwn(t, e)) return "-";
92
- let n = t[e];
93
- return n === void 0 ? "-" : n === !0 ? "1" : n === !1 ? "0" : "!";
94
- }).join(""), r = "";
95
- if (Object.hasOwn(t, "limits")) {
96
- let e = t.limits;
97
- if (e === void 0) r = "default";
98
- else if (!l(e)) r = "invalid";
99
- else {
100
- let t = (t) => !Object.hasOwn(e, t) || e[t] === void 0 ? "default" : String(e[t]);
101
- r = `${t("maxSyntaxNodes")}:${t("maxParseWork")}:${t("maxMarkdownDepth")}`;
102
- }
103
- }
104
- let i = "";
105
- if (Object.hasOwn(t, "hostComponents") && t.hostComponents !== void 0) {
106
- let e = t.hostComponents;
107
- try {
108
- Array.isArray(e) ? e.length > 0 && (i = e.length > 32 ? `:hosts=oversize:${e.length}` : `:hosts=${v(e)}`) : i = `:hosts=${v(e)}`;
109
- } catch {
110
- i = `:hosts=${_(e)}`;
111
- }
112
- }
113
- let o = !Object.hasOwn(t, "markdownBreaks") || t.markdownBreaks === void 0 ? "-" : t.markdownBreaks === !0 ? "1" : t.markdownBreaks === !1 ? "0" : "!", s = !Object.hasOwn(t, "strict") || t.strict === void 0 || t.strict === !0 ? "strict=1" : t.strict === !1 ? "strict=0:recovery=2" : "strict=!", c = "";
114
- return Object.hasOwn(t, "config") && t.config !== void 0 && (c = `:config=${a(t.config)}`), `${n}:${r}:${o}:${s}${i}${c}`;
115
- }
116
- export { c as n, y as t };