@mui/internal-docs-infra 0.11.1-canary.8 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/ChunkProvider/ChunkContext.d.mts +10 -0
  2. package/ChunkProvider/ChunkContext.mjs +15 -0
  3. package/ChunkProvider/ChunkProvider.d.mts +14 -0
  4. package/ChunkProvider/ChunkProvider.mjs +38 -0
  5. package/ChunkProvider/PreloadContext.d.mts +14 -0
  6. package/ChunkProvider/PreloadContext.mjs +18 -0
  7. package/ChunkProvider/PreloadProvider.d.mts +13 -0
  8. package/ChunkProvider/PreloadProvider.mjs +33 -0
  9. package/ChunkProvider/index.d.mts +7 -0
  10. package/ChunkProvider/index.mjs +7 -0
  11. package/ChunkProvider/types.d.mts +23 -0
  12. package/ChunkProvider/types.mjs +1 -0
  13. package/ChunkProvider/usePreload.d.mts +8 -0
  14. package/ChunkProvider/usePreload.mjs +21 -0
  15. package/CodeControllerContext/CodeControllerContext.d.mts +11 -0
  16. package/CodeControllerContext/CodeControllerContext.mjs +2 -1
  17. package/CodeHighlighter/CodeHighlighter.d.mts +15 -1
  18. package/CodeHighlighter/CodeHighlighter.mjs +97 -319
  19. package/CodeHighlighter/CodeHighlighterChunk.d.mts +42 -0
  20. package/CodeHighlighter/CodeHighlighterChunk.mjs +77 -0
  21. package/CodeHighlighter/CodeHighlighterClient.mjs +597 -128
  22. package/CodeHighlighter/CodeHighlighterContext.d.mts +57 -1
  23. package/CodeHighlighter/CodeHighlighterFallbackContext.d.mts +14 -2
  24. package/CodeHighlighter/CodeHighlighterFallbackContext.mjs +1 -3
  25. package/CodeHighlighter/CodeInitialSourceLoader.d.mts +10 -0
  26. package/CodeHighlighter/CodeInitialSourceLoader.mjs +108 -0
  27. package/CodeHighlighter/CodeSourceLoader.d.mts +11 -0
  28. package/CodeHighlighter/CodeSourceLoader.mjs +128 -0
  29. package/CodeHighlighter/buildCodeHighlighterChunkProps.d.mts +47 -0
  30. package/CodeHighlighter/buildCodeHighlighterChunkProps.mjs +61 -0
  31. package/CodeHighlighter/buildStringFallback.d.mts +29 -0
  32. package/CodeHighlighter/buildStringFallback.mjs +42 -0
  33. package/CodeHighlighter/codeToFallbackProps.d.mts +31 -2
  34. package/CodeHighlighter/codeToFallbackProps.mjs +347 -42
  35. package/CodeHighlighter/createClientProps.d.mts +17 -0
  36. package/CodeHighlighter/createClientProps.mjs +78 -0
  37. package/CodeHighlighter/errors.d.mts +6 -0
  38. package/CodeHighlighter/errors.mjs +10 -0
  39. package/CodeHighlighter/fallbackCompression.d.mts +96 -0
  40. package/CodeHighlighter/fallbackCompression.mjs +253 -0
  41. package/CodeHighlighter/fallbackFormat.d.mts +137 -0
  42. package/CodeHighlighter/fallbackFormat.mjs +422 -0
  43. package/CodeHighlighter/index.d.mts +4 -1
  44. package/CodeHighlighter/index.mjs +3 -1
  45. package/CodeHighlighter/mergeComments.d.mts +38 -0
  46. package/CodeHighlighter/mergeComments.mjs +80 -0
  47. package/CodeHighlighter/prepareInitialSource.d.mts +42 -0
  48. package/CodeHighlighter/prepareInitialSource.mjs +292 -0
  49. package/CodeHighlighter/resolveFallbackCritical.d.mts +23 -0
  50. package/CodeHighlighter/resolveFallbackCritical.mjs +44 -0
  51. package/CodeHighlighter/types.d.mts +272 -8
  52. package/CodeHighlighter/useCodeFallback.d.mts +94 -0
  53. package/CodeHighlighter/useCodeFallback.mjs +204 -0
  54. package/CodeHighlighter/useGrammarsReady.d.mts +18 -0
  55. package/CodeHighlighter/useGrammarsReady.mjs +45 -0
  56. package/CodeHighlighter/useSpeculativeCodePreload.d.mts +26 -0
  57. package/CodeHighlighter/useSpeculativeCodePreload.mjs +40 -0
  58. package/CodeHighlighter/useSpeculativeEditingPreload.d.mts +33 -0
  59. package/CodeHighlighter/useSpeculativeEditingPreload.mjs +58 -0
  60. package/CodeHighlighter/useSpeculativeGrammarPreload.d.mts +23 -0
  61. package/CodeHighlighter/useSpeculativeGrammarPreload.mjs +31 -0
  62. package/CodeHighlighter/useSpeculativeUseCodePreload.d.mts +22 -0
  63. package/CodeHighlighter/useSpeculativeUseCodePreload.mjs +41 -0
  64. package/CodeProvider/CodeContext.d.mts +47 -12
  65. package/CodeProvider/CodeContext.mjs +7 -0
  66. package/CodeProvider/CodeProvider.d.mts +4 -2
  67. package/CodeProvider/CodeProvider.mjs +40 -102
  68. package/CodeProvider/CodeProviderLazy.d.mts +40 -0
  69. package/CodeProvider/CodeProviderLazy.mjs +96 -0
  70. package/CodeProvider/constants.d.mts +26 -0
  71. package/CodeProvider/constants.mjs +24 -0
  72. package/CodeProvider/createParseSourceWorkerClient.d.mts +6 -0
  73. package/CodeProvider/createParseSourceWorkerClient.mjs +22 -2
  74. package/CodeProvider/index.d.mts +2 -1
  75. package/CodeProvider/index.mjs +9 -1
  76. package/CodeProvider/parseSourceWorker.mjs +33 -0
  77. package/CodeProvider/useCodeProviderValue.d.mts +54 -0
  78. package/CodeProvider/useCodeProviderValue.mjs +188 -0
  79. package/CoordinatedLazy/ChunkServerLoader.d.mts +25 -0
  80. package/CoordinatedLazy/ChunkServerLoader.mjs +97 -0
  81. package/CoordinatedLazy/CoordinatedContentContext.d.mts +15 -0
  82. package/CoordinatedLazy/CoordinatedContentContext.mjs +22 -0
  83. package/CoordinatedLazy/CoordinatedFallbackContext.d.mts +11 -0
  84. package/CoordinatedLazy/CoordinatedFallbackContext.mjs +13 -0
  85. package/CoordinatedLazy/CoordinatedGateContext.d.mts +14 -0
  86. package/CoordinatedLazy/CoordinatedGateContext.mjs +19 -0
  87. package/CoordinatedLazy/CoordinatedLazy.d.mts +14 -0
  88. package/CoordinatedLazy/CoordinatedLazy.mjs +86 -0
  89. package/CoordinatedLazy/CoordinatedLazyClient.d.mts +24 -0
  90. package/CoordinatedLazy/CoordinatedLazyClient.mjs +65 -0
  91. package/CoordinatedLazy/LazyContent.d.mts +26 -0
  92. package/CoordinatedLazy/LazyContent.mjs +80 -0
  93. package/CoordinatedLazy/LazyContentServer.d.mts +18 -0
  94. package/CoordinatedLazy/LazyContentServer.mjs +25 -0
  95. package/CoordinatedLazy/buildChunkRenderInputs.d.mts +8 -0
  96. package/CoordinatedLazy/buildChunkRenderInputs.mjs +35 -0
  97. package/CoordinatedLazy/createCoordinatedLazy.d.mts +32 -0
  98. package/CoordinatedLazy/createCoordinatedLazy.mjs +127 -0
  99. package/CoordinatedLazy/index.d.mts +14 -0
  100. package/CoordinatedLazy/index.mjs +18 -0
  101. package/CoordinatedLazy/resolveChunkRender.d.mts +26 -0
  102. package/CoordinatedLazy/resolveChunkRender.mjs +73 -0
  103. package/CoordinatedLazy/types.d.mts +408 -0
  104. package/CoordinatedLazy/types.mjs +1 -0
  105. package/CoordinatedLazy/useChunk.d.mts +30 -0
  106. package/CoordinatedLazy/useChunk.mjs +135 -0
  107. package/CoordinatedLazy/useCoordinatedFallback.d.mts +12 -0
  108. package/CoordinatedLazy/useCoordinatedFallback.mjs +40 -0
  109. package/CoordinatedLazy/useCoordinatedSwap.d.mts +16 -0
  110. package/CoordinatedLazy/useCoordinatedSwap.mjs +124 -0
  111. package/LICENSE +1 -1
  112. package/abstractCreateDemo/abstractCreateDemo.d.mts +54 -3
  113. package/abstractCreateDemo/abstractCreateDemo.mjs +47 -7
  114. package/abstractCreateDemo/resolveDemoFlag.d.mts +20 -0
  115. package/abstractCreateDemo/resolveDemoFlag.mjs +25 -0
  116. package/abstractCreateStream/abstractCreateStream.d.mts +18 -0
  117. package/abstractCreateStream/abstractCreateStream.mjs +45 -0
  118. package/abstractCreateStream/index.d.mts +2 -0
  119. package/abstractCreateStream/index.mjs +1 -0
  120. package/abstractCreateStream/types.d.mts +34 -0
  121. package/abstractCreateStream/types.mjs +1 -0
  122. package/abstractCreateTypes/TypeCode.mjs +12 -11
  123. package/abstractCreateTypes/typesToJsx.mjs +30 -9
  124. package/cli/ensureDemoClients.mjs +4 -148
  125. package/cli/ensureDemoPages.d.mts +45 -0
  126. package/cli/ensureDemoPages.mjs +99 -0
  127. package/cli/fileUtils/index.d.mts +11 -0
  128. package/cli/fileUtils/index.mjs +48 -0
  129. package/cli/findDemoIndexFiles.d.mts +15 -0
  130. package/cli/findDemoIndexFiles.mjs +121 -0
  131. package/cli/index.mjs +1 -1
  132. package/cli/loadNextConfig.d.mts +25 -0
  133. package/cli/loadNextConfig.mjs +60 -1
  134. package/cli/runBrowser.mjs +1 -1
  135. package/cli/runValidate.mjs +44 -1
  136. package/package.json +85 -5
  137. package/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasis.mjs +30 -0
  138. package/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasisLazy.d.mts +17 -0
  139. package/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasisLazy.mjs +52 -0
  140. package/pipeline/hastUtils/frameFallbackFromSpans.d.mts +18 -0
  141. package/pipeline/hastUtils/frameFallbackFromSpans.mjs +24 -0
  142. package/pipeline/hastUtils/hast.d.mts +27 -0
  143. package/pipeline/hastUtils/hastCompression.d.mts +3 -1
  144. package/pipeline/hastUtils/hastCompression.mjs +9 -1
  145. package/pipeline/hastUtils/hastDecompress.mjs +10 -4
  146. package/pipeline/hastUtils/hastDictionary.mjs +9 -0
  147. package/pipeline/hastUtils/hastUtils.d.mts +4 -3
  148. package/pipeline/hastUtils/hastUtils.mjs +24 -12
  149. package/pipeline/hastUtils/index.d.mts +2 -1
  150. package/pipeline/hastUtils/index.mjs +2 -1
  151. package/pipeline/hastUtils/stripHighlightingSpans.d.mts +6 -2
  152. package/pipeline/hastUtils/stripHighlightingSpans.mjs +22 -10
  153. package/pipeline/lintJavascriptDemoFocus/lintJavascriptDemoFocus.mjs +10 -7
  154. package/pipeline/loadIsomorphicCodeVariant/applyCodeTransform.d.mts +31 -13
  155. package/pipeline/loadIsomorphicCodeVariant/applyCodeTransform.mjs +50 -55
  156. package/pipeline/loadIsomorphicCodeVariant/applyCodeTransformWithComments.d.mts +78 -0
  157. package/pipeline/loadIsomorphicCodeVariant/applyCodeTransformWithComments.mjs +405 -0
  158. package/pipeline/loadIsomorphicCodeVariant/computeHastDeltas.d.mts +5 -5
  159. package/pipeline/loadIsomorphicCodeVariant/computeHastDeltas.mjs +36 -66
  160. package/pipeline/loadIsomorphicCodeVariant/decodeHastSource.d.mts +23 -0
  161. package/pipeline/loadIsomorphicCodeVariant/decodeHastSource.mjs +92 -0
  162. package/pipeline/loadIsomorphicCodeVariant/decodeSource.d.mts +19 -0
  163. package/pipeline/loadIsomorphicCodeVariant/decodeSource.mjs +25 -0
  164. package/pipeline/loadIsomorphicCodeVariant/decodeSourceToText.d.mts +17 -0
  165. package/pipeline/loadIsomorphicCodeVariant/decodeSourceToText.mjs +26 -0
  166. package/pipeline/loadIsomorphicCodeVariant/diffHast.d.mts +26 -2
  167. package/pipeline/loadIsomorphicCodeVariant/diffHast.mjs +563 -19
  168. package/pipeline/loadIsomorphicCodeVariant/embedTransforms.d.mts +49 -0
  169. package/pipeline/loadIsomorphicCodeVariant/embedTransforms.mjs +152 -0
  170. package/pipeline/loadIsomorphicCodeVariant/findExpandingRanges.d.mts +51 -0
  171. package/pipeline/loadIsomorphicCodeVariant/findExpandingRanges.mjs +161 -0
  172. package/pipeline/loadIsomorphicCodeVariant/flattenCodeVariant.mjs +6 -3
  173. package/pipeline/loadIsomorphicCodeVariant/getAvailableTransforms.d.mts +12 -0
  174. package/pipeline/loadIsomorphicCodeVariant/getAvailableTransforms.mjs +44 -0
  175. package/pipeline/loadIsomorphicCodeVariant/getInitialVisibleSourceLines.d.mts +16 -0
  176. package/pipeline/loadIsomorphicCodeVariant/getInitialVisibleSourceLines.mjs +74 -0
  177. package/pipeline/loadIsomorphicCodeVariant/loadCodeFallback.mjs +17 -5
  178. package/pipeline/loadIsomorphicCodeVariant/loadIsomorphicCodeVariant.mjs +229 -15
  179. package/pipeline/loadIsomorphicCodeVariant/transformSource.d.mts +2 -2
  180. package/pipeline/loadIsomorphicCodeVariant/transformSource.mjs +56 -22
  181. package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.mts +18 -0
  182. package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.mjs +11 -7
  183. package/pipeline/loadServerTypes/hastTypeUtils.d.mts +2 -2
  184. package/pipeline/loadServerTypes/hastTypeUtils.mjs +4 -4
  185. package/pipeline/loadServerTypes/loadServerTypes.mjs +1 -1
  186. package/pipeline/loadServerTypesMeta/extractJSDocText.d.mts +14 -0
  187. package/pipeline/loadServerTypesMeta/extractJSDocText.mjs +60 -0
  188. package/pipeline/loadServerTypesMeta/processTypes.mjs +43 -46
  189. package/pipeline/loadServerTypesText/order.mjs +1 -1
  190. package/pipeline/loadServerTypesText/parseTypesMarkdown.mjs +3 -1
  191. package/pipeline/loaderUtils/index.d.mts +0 -1
  192. package/pipeline/loaderUtils/index.mjs +0 -1
  193. package/pipeline/loaderUtils/parseImportsAndComments.d.mts +5 -1
  194. package/pipeline/loaderUtils/parseImportsAndComments.mjs +19 -9
  195. package/pipeline/loaderUtils/resolveModulePath.mjs +23 -1
  196. package/pipeline/parseCreateFactoryCall/parseCreateFactoryCall.d.mts +12 -0
  197. package/pipeline/parseCreateFactoryCall/parseCreateFactoryCall.mjs +17 -13
  198. package/pipeline/parseSource/addLineGutters.mjs +45 -11
  199. package/pipeline/parseSource/calculateFrameRanges.d.mts +22 -0
  200. package/pipeline/parseSource/calculateFrameRanges.mjs +69 -25
  201. package/pipeline/parseSource/detectGrammarScopes.d.mts +13 -0
  202. package/pipeline/parseSource/detectGrammarScopes.mjs +35 -0
  203. package/pipeline/parseSource/extendSyntaxTokens.mjs +501 -43
  204. package/pipeline/parseSource/frameVisibility.d.mts +47 -0
  205. package/pipeline/parseSource/frameVisibility.mjs +114 -0
  206. package/pipeline/parseSource/grammarCache.d.mts +33 -0
  207. package/pipeline/parseSource/grammarCache.mjs +73 -0
  208. package/pipeline/parseSource/grammarLoaders.d.mts +14 -0
  209. package/pipeline/parseSource/grammarLoaders.mjs +24 -0
  210. package/pipeline/parseSource/grammarMaps.d.mts +21 -1
  211. package/pipeline/parseSource/grammarMaps.mjs +36 -0
  212. package/pipeline/parseSource/isFrameSpan.d.mts +19 -0
  213. package/pipeline/parseSource/isFrameSpan.mjs +24 -0
  214. package/pipeline/parseSource/parseSource.d.mts +41 -6
  215. package/pipeline/parseSource/parseSource.mjs +184 -36
  216. package/pipeline/parseSource/redistributeFrameFallbacks.d.mts +40 -0
  217. package/pipeline/parseSource/redistributeFrameFallbacks.mjs +138 -0
  218. package/pipeline/parseSource/restructureFrames.d.mts +5 -0
  219. package/pipeline/parseSource/restructureFrames.mjs +179 -16
  220. package/pipeline/syncPageIndex/metadataToMarkdown.mjs +6 -2
  221. package/pipeline/transformHtmlCodeBlock/transformHtmlCodeBlock.d.mts +26 -0
  222. package/pipeline/transformHtmlCodeBlock/transformHtmlCodeBlock.mjs +181 -114
  223. package/pipeline/transformHtmlCodeInline/removeSuffixFromHighlightedNodes.d.mts +12 -0
  224. package/pipeline/transformHtmlCodeInline/removeSuffixFromHighlightedNodes.mjs +52 -0
  225. package/pipeline/transformHtmlCodeInline/transformHtmlCodeInline.mjs +22 -1
  226. package/pipeline/transformTypescriptToJavascript/removeTypes.d.mts +5 -8
  227. package/pipeline/transformTypescriptToJavascript/removeTypes.mjs +27 -93
  228. package/useCode/EditableEngine.d.mts +233 -0
  229. package/useCode/EditableEngine.mjs +1712 -0
  230. package/useCode/EditingEngine.d.mts +13 -0
  231. package/useCode/EditingEngine.mjs +14 -0
  232. package/useCode/Pre.browser.mjs +5 -1
  233. package/useCode/Pre.d.mts +127 -1
  234. package/useCode/Pre.mjs +417 -165
  235. package/useCode/SourceEditingEngine.d.mts +50 -0
  236. package/useCode/SourceEditingEngine.mjs +461 -0
  237. package/useCode/TransformEngine.d.mts +39 -0
  238. package/useCode/TransformEngine.mjs +208 -0
  239. package/useCode/editingEngineCache.d.mts +29 -0
  240. package/useCode/editingEngineCache.mjs +68 -0
  241. package/useCode/sourceLineCounts.d.mts +80 -0
  242. package/useCode/sourceLineCounts.mjs +284 -0
  243. package/useCode/subscribeToggleNudge.d.mts +3 -0
  244. package/useCode/subscribeToggleNudge.mjs +95 -0
  245. package/useCode/transformEngineCache.d.mts +21 -0
  246. package/useCode/transformEngineCache.mjs +60 -0
  247. package/useCode/useCode.d.mts +140 -1
  248. package/useCode/useCode.mjs +250 -19
  249. package/useCode/useCodeUtils.d.mts +131 -20
  250. package/useCode/useCodeUtils.mjs +267 -194
  251. package/useCode/useCopyFunctionality.d.mts +13 -1
  252. package/useCode/useCopyFunctionality.mjs +39 -9
  253. package/useCode/useEditable.browser.mjs +10 -2
  254. package/useCode/useEditable.d.mts +27 -106
  255. package/useCode/useEditable.integration.browser.d.mts +1 -0
  256. package/useCode/useEditable.integration.browser.mjs +870 -0
  257. package/useCode/useEditable.mjs +198 -1247
  258. package/useCode/useEditableUtils.d.mts +50 -1
  259. package/useCode/useEditableUtils.mjs +29 -0
  260. package/useCode/useFileNavigation.d.mts +91 -3
  261. package/useCode/useFileNavigation.mjs +201 -41
  262. package/useCode/useHighlightGate.d.mts +17 -0
  263. package/useCode/useHighlightGate.mjs +147 -0
  264. package/useCode/useSourceEditing.d.mts +8 -0
  265. package/useCode/useSourceEditing.mjs +158 -314
  266. package/useCode/useSourceEnhancing.d.mts +5 -1
  267. package/useCode/useSourceEnhancing.mjs +22 -36
  268. package/useCode/useTransformManagement.d.mts +93 -5
  269. package/useCode/useTransformManagement.mjs +496 -28
  270. package/useCode/useTransitionPhase.d.mts +24 -0
  271. package/useCode/useTransitionPhase.mjs +49 -0
  272. package/useCode/useUIState.d.mts +2 -2
  273. package/useCode/useUIState.mjs +8 -8
  274. package/useCode/useVariantSelection.d.mts +130 -6
  275. package/useCode/useVariantSelection.mjs +529 -93
  276. package/useCodeWindow/useCodeWindow.d.mts +19 -2
  277. package/useCodeWindow/useCodeWindow.mjs +98 -71
  278. package/useCoordinated/coordinatePreference.d.mts +439 -0
  279. package/useCoordinated/coordinatePreference.mjs +951 -0
  280. package/useCoordinated/coordinatePreference.testUtils.d.mts +21 -0
  281. package/useCoordinated/coordinatePreference.testUtils.mjs +69 -0
  282. package/useCoordinated/createSettleGate.d.mts +96 -0
  283. package/useCoordinated/createSettleGate.mjs +171 -0
  284. package/useCoordinated/index.d.mts +8 -0
  285. package/useCoordinated/index.mjs +8 -0
  286. package/useCoordinated/layoutShiftGate.d.mts +24 -0
  287. package/useCoordinated/layoutShiftGate.mjs +79 -0
  288. package/useCoordinated/pageSettleGate.d.mts +11 -0
  289. package/useCoordinated/pageSettleGate.mjs +13 -0
  290. package/useCoordinated/scheduleTasks.d.mts +23 -0
  291. package/useCoordinated/scheduleTasks.mjs +45 -0
  292. package/useCoordinated/useCoordinated.d.mts +193 -0
  293. package/useCoordinated/useCoordinated.mjs +469 -0
  294. package/useCoordinated/useCoordinatedLazy.d.mts +17 -0
  295. package/useCoordinated/useCoordinatedLazy.mjs +38 -0
  296. package/useCoordinated/useCoordinatedLocalStorage.d.mts +16 -0
  297. package/useCoordinated/useCoordinatedLocalStorage.mjs +22 -0
  298. package/useCoordinated/useCoordinatedPreference.d.mts +20 -0
  299. package/useCoordinated/useCoordinatedPreference.mjs +26 -0
  300. package/useCoordinated/useSettleGate.d.mts +11 -0
  301. package/useCoordinated/useSettleGate.mjs +34 -0
  302. package/useDemo/exportVariant.d.mts +12 -5
  303. package/useDemo/exportVariant.mjs +59 -5
  304. package/useDemo/useDemo.d.mts +5 -2
  305. package/useScrollAnchor/useScrollAnchor.mjs +28 -5
  306. package/useStream/index.d.mts +6 -0
  307. package/useStream/index.mjs +6 -0
  308. package/useStream/streamChunks.d.mts +23 -0
  309. package/useStream/streamChunks.mjs +85 -0
  310. package/useStream/types.d.mts +45 -0
  311. package/useStream/types.mjs +1 -0
  312. package/useStream/useStream.d.mts +57 -0
  313. package/useStream/useStream.mjs +119 -0
  314. package/useStream/useStreamController.d.mts +15 -0
  315. package/useStream/useStreamController.mjs +90 -0
  316. package/withDocsInfra/withDocsInfra.d.mts +19 -0
  317. package/withDocsInfra/withDocsInfra.mjs +13 -5
  318. package/pipeline/loaderUtils/convertCommentsToOneIndexed.d.mts +0 -8
  319. package/pipeline/loaderUtils/convertCommentsToOneIndexed.mjs +0 -16
@@ -0,0 +1,97 @@
1
+ import * as React from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * Server render path for a chunk: an async server component that produces the
5
+ * content on the server, to be rendered under a Suspense boundary so React
6
+ * streams the fallback until it resolves (per-chunk Suspense). It is a plain
7
+ * async render function (no Node-only imports), so it bundles harmlessly with
8
+ * the client surface - it just never runs there.
9
+ *
10
+ * With `initial`, it renders the server `InitialLoader` (the quick initial
11
+ * state). Otherwise it prefers the server `Loader` component (dynamically
12
+ * imported, never shipped to the client), falling back to a server-side
13
+ * `data`-mode `load`. When none applies it renders the loading placeholder (the
14
+ * client then takes over).
15
+ *
16
+ * Readiness/coordination is a client concern, so there is no gate here - the
17
+ * parent Suspense owns the fallback, and the streamed content hydrates into the
18
+ * client swap.
19
+ */
20
+ export async function ChunkServerLoader(args) {
21
+ const {
22
+ config,
23
+ props = {},
24
+ initial = false
25
+ } = args;
26
+ const options = props.loaderOptions ?? config.loaderOptions;
27
+ const userProps = props.userProps ?? {};
28
+
29
+ // Server initial: render the InitialLoader's quick state (still `loading`, as
30
+ // the full data is not in yet - a client source can upgrade it afterwards).
31
+ if (initial && config.InitialLoader) {
32
+ const loaded = await config.InitialLoader();
33
+ const Loaded = loaded.default;
34
+ const loadingProps = {
35
+ ...userProps,
36
+ data: props.preloaded,
37
+ loading: true
38
+ };
39
+ return /*#__PURE__*/_jsx(Loaded, {
40
+ ...loadingProps
41
+ });
42
+ }
43
+
44
+ // Server initial from a `data`-mode source: compute the quick `initial()` value
45
+ // (synchronous, no await) on the server and render it into `ChunkContent` still
46
+ // marked `loading`. `source.initial()` must return serializable data, since
47
+ // `ChunkContent` may be a Client Component. `InitialLoader` above wins when both
48
+ // are present.
49
+ if (initial && config.source && config.source.mode === 'data' && config.source.initial) {
50
+ const data = config.source.initial(options);
51
+ const ChunkContent = config.ChunkContent;
52
+ const loadingProps = {
53
+ ...userProps,
54
+ data,
55
+ loading: true
56
+ };
57
+ return /*#__PURE__*/_jsx(ChunkContent, {
58
+ ...loadingProps
59
+ });
60
+ }
61
+ if (!initial && config.Loader) {
62
+ const loaded = await config.Loader();
63
+ const Loaded = loaded.default;
64
+ const contentProps = {
65
+ ...userProps,
66
+ data: props.preloaded,
67
+ loading: false
68
+ };
69
+ return /*#__PURE__*/_jsx(Loaded, {
70
+ ...contentProps
71
+ });
72
+ }
73
+ if (!initial && config.source && config.source.mode === 'data') {
74
+ const data = await config.source.load(options, new AbortController().signal);
75
+ const ChunkContent = config.ChunkContent;
76
+ const contentProps = {
77
+ ...userProps,
78
+ data,
79
+ loading: false
80
+ };
81
+ return /*#__PURE__*/_jsx(ChunkContent, {
82
+ ...contentProps
83
+ });
84
+ }
85
+ const ChunkLoading = config.ChunkLoading;
86
+ if (ChunkLoading) {
87
+ const loadingProps = {
88
+ ...userProps,
89
+ data: props.preloaded,
90
+ loading: true
91
+ };
92
+ return /*#__PURE__*/_jsx(ChunkLoading, {
93
+ ...loadingProps
94
+ });
95
+ }
96
+ return null;
97
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import type { CoordinatedContentContextValue } from "./types.mjs";
3
+ /**
4
+ * Carries the data the fallback hoisted down into the full content. A
5
+ * `CoordinatedLazy` provides it around `content` after the swap; content reads
6
+ * it via {@link useCoordinatedContent}.
7
+ */
8
+ export declare const CoordinatedContentContext: React.Context<CoordinatedContentContextValue>;
9
+ /**
10
+ * Read the data the fallback hoisted, from inside the full content. Lets the
11
+ * content use what the fallback fetched (e.g. a decompression dictionary)
12
+ * without the consumer threading it through props. Returns an empty map when
13
+ * rendered outside a `CoordinatedLazy`.
14
+ */
15
+ export declare function useCoordinatedContent(): Record<string, unknown>;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ /**
5
+ * Carries the data the fallback hoisted down into the full content. A
6
+ * `CoordinatedLazy` provides it around `content` after the swap; content reads
7
+ * it via {@link useCoordinatedContent}.
8
+ */
9
+ export const CoordinatedContentContext = /*#__PURE__*/React.createContext({
10
+ hoisted: {}
11
+ });
12
+
13
+ /**
14
+ * Read the data the fallback hoisted, from inside the full content. Lets the
15
+ * content use what the fallback fetched (e.g. a decompression dictionary)
16
+ * without the consumer threading it through props. Returns an empty map when
17
+ * rendered outside a `CoordinatedLazy`.
18
+ */
19
+ if (process.env.NODE_ENV !== "production") CoordinatedContentContext.displayName = "CoordinatedContentContext";
20
+ export function useCoordinatedContent() {
21
+ return React.useContext(CoordinatedContentContext).hoisted;
22
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import type { CoordinatedFallbackContextValue } from "./types.mjs";
3
+ /**
4
+ * Provided by a `CoordinatedLazy` to its fallback subtree while the fallback is
5
+ * shown. Carries the upward hoist channel and the nested-suppression flag.
6
+ *
7
+ * `undefined` outside a fallback subtree: a fallback reads it via
8
+ * `useCoordinatedFallback`, and a nested `CoordinatedLazy` detects its presence
9
+ * to know it is rendered inside an outer instance's still-loading fallback.
10
+ */
11
+ export declare const CoordinatedFallbackContext: React.Context<CoordinatedFallbackContextValue | undefined>;
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ /**
5
+ * Provided by a `CoordinatedLazy` to its fallback subtree while the fallback is
6
+ * shown. Carries the upward hoist channel and the nested-suppression flag.
7
+ *
8
+ * `undefined` outside a fallback subtree: a fallback reads it via
9
+ * `useCoordinatedFallback`, and a nested `CoordinatedLazy` detects its presence
10
+ * to know it is rendered inside an outer instance's still-loading fallback.
11
+ */
12
+ export const CoordinatedFallbackContext = /*#__PURE__*/React.createContext(undefined);
13
+ if (process.env.NODE_ENV !== "production") CoordinatedFallbackContext.displayName = "CoordinatedFallbackContext";
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import type { SettleGate } from "../useCoordinated/createSettleGate.mjs";
3
+ /**
4
+ * The ambient settle gate that a {@link CoordinatedLazy} swap registers with
5
+ * when it isn't given an explicit `gate` prop. A coordinator (e.g. the
6
+ * `useStream` controller) provides its gate here so every swap rendered beneath
7
+ * it reports into the same gate - that is how a group's `loading` reflects each
8
+ * piece's swap without threading a `gate` prop through every one. `null` outside
9
+ * any coordinator, in which case the swap registers only with the page-global
10
+ * gate.
11
+ */
12
+ export declare const CoordinatedGateContext: React.Context<SettleGate | null>;
13
+ /** Read the ambient settle gate, or `null` when there is no surrounding coordinator. */
14
+ export declare function useCoordinatedGate(): SettleGate | null;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ /**
5
+ * The ambient settle gate that a {@link CoordinatedLazy} swap registers with
6
+ * when it isn't given an explicit `gate` prop. A coordinator (e.g. the
7
+ * `useStream` controller) provides its gate here so every swap rendered beneath
8
+ * it reports into the same gate - that is how a group's `loading` reflects each
9
+ * piece's swap without threading a `gate` prop through every one. `null` outside
10
+ * any coordinator, in which case the swap registers only with the page-global
11
+ * gate.
12
+ */
13
+ export const CoordinatedGateContext = /*#__PURE__*/React.createContext(null);
14
+
15
+ /** Read the ambient settle gate, or `null` when there is no surrounding coordinator. */
16
+ if (process.env.NODE_ENV !== "production") CoordinatedGateContext.displayName = "CoordinatedGateContext";
17
+ export function useCoordinatedGate() {
18
+ return React.useContext(CoordinatedGateContext);
19
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import type { CoordinatedLazyProps } from "./types.mjs";
3
+ /**
4
+ * Show `fallback` until `ready` (and the page-coordinated swap conditions) are
5
+ * met, then swap to `content`. The fallback is force-mounted once so its
6
+ * `useCoordinatedFallback` hoist runs even when the content is precomputed; the
7
+ * hoisted data is handed down to `content` via `useCoordinatedContent`.
8
+ *
9
+ * Generalizes the state-driven fallback<->content swap from
10
+ * `CodeHighlighterClient`. Advanced consumers that need to fold the hoisted data
11
+ * into their own `ready` computation should use {@link useCoordinatedSwap}
12
+ * directly instead of this component.
13
+ */
14
+ export declare function CoordinatedLazy(props: CoordinatedLazyProps): React.ReactElement;
@@ -0,0 +1,86 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { useCoordinatedSwap } from "./useCoordinatedSwap.mjs";
5
+ import { CoordinatedFallbackContext } from "./CoordinatedFallbackContext.mjs";
6
+ import { CoordinatedContentContext } from "./CoordinatedContentContext.mjs";
7
+
8
+ /**
9
+ * Show `fallback` until `ready` (and the page-coordinated swap conditions) are
10
+ * met, then swap to `content`. The fallback is force-mounted once so its
11
+ * `useCoordinatedFallback` hoist runs even when the content is precomputed; the
12
+ * hoisted data is handed down to `content` via `useCoordinatedContent`.
13
+ *
14
+ * Generalizes the state-driven fallback<->content swap from
15
+ * `CodeHighlighterClient`. Advanced consumers that need to fold the hoisted data
16
+ * into their own `ready` computation should use {@link useCoordinatedSwap}
17
+ * directly instead of this component.
18
+ */
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ export function CoordinatedLazy(props) {
21
+ const {
22
+ content,
23
+ fallback,
24
+ ready,
25
+ defer,
26
+ holdGate,
27
+ skipFallback,
28
+ requireHoist,
29
+ awaitContent,
30
+ gate,
31
+ data,
32
+ preload
33
+ } = props;
34
+ const {
35
+ showFallback,
36
+ fallbackContext,
37
+ hoisted,
38
+ reportContentReady
39
+ } = useCoordinatedSwap({
40
+ ready,
41
+ defer,
42
+ holdGate,
43
+ hasFallback: fallback != null,
44
+ skipFallback,
45
+ requireHoist,
46
+ awaitContent,
47
+ gate,
48
+ data,
49
+ preload
50
+ });
51
+
52
+ // Forward `fallback` so a code-split `content` (e.g. `LazyContent`) can show
53
+ // the same placeholder via `useCoordinatedContent().fallback` while its
54
+ // dynamic import resolves - no empty flash on the content-side swap. In
55
+ // `awaitContent` mode the fallback is already rendered alongside the content,
56
+ // so the content must stay null while loading (no duplicate placeholder).
57
+ const contentContext = React.useMemo(() => ({
58
+ hoisted,
59
+ reportReady: reportContentReady,
60
+ fallback: awaitContent ? undefined : fallback
61
+ }), [hoisted, reportContentReady, fallback, awaitContent]);
62
+ const contentNode = /*#__PURE__*/_jsx(CoordinatedContentContext.Provider, {
63
+ value: contentContext,
64
+ children: content
65
+ });
66
+ const fallbackNode = showFallback ? /*#__PURE__*/_jsx(CoordinatedFallbackContext.Provider, {
67
+ value: fallbackContext,
68
+ children: fallback
69
+ }) : null;
70
+
71
+ // awaitContent: mount the content behind the fallback so a code-split content
72
+ // (e.g. `LazyContent`) loads in the background and reveals once it reports
73
+ // ready. The content returns `null` until then, so only the fallback shows.
74
+ if (awaitContent) {
75
+ return /*#__PURE__*/_jsxs(React.Fragment, {
76
+ children: [fallbackNode, contentNode]
77
+ });
78
+ }
79
+
80
+ // Default: show the fallback OR the content (the content only mounts once the
81
+ // swap commits to it).
82
+ return showFallback ? /*#__PURE__*/_jsx(CoordinatedFallbackContext.Provider, {
83
+ value: fallbackContext,
84
+ children: fallback
85
+ }) : contentNode;
86
+ }
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import type { ChunkComponentProps, ClientChunkConfig } from "./types.mjs";
3
+ /** Props for {@link CoordinatedLazyClient}. */
4
+ export interface CoordinatedLazyClientProps<T extends {}, P, O> {
5
+ /**
6
+ * The chunk config with the server-only loader functions
7
+ * (`source`/`Loader`/`InitialLoader`) already stripped, so no function is ever
8
+ * serialized into this Client Component. Client loading comes from a
9
+ * {@link ChunkProvider} source in context (via {@link useChunk}).
10
+ */
11
+ config: ClientChunkConfig<T, P, O>;
12
+ props: ChunkComponentProps<T, P, O>;
13
+ }
14
+ /**
15
+ * The client-loading half of {@link createCoordinatedLazy}: loads the piece's
16
+ * data on the client via {@link useChunk}, shows `ChunkLoading` until it is
17
+ * ready, then swaps to `ChunkContent` through {@link CoordinatedLazy}. The
18
+ * isomorphic router renders this only for the client-driven render modes, so the
19
+ * content/loading components here are always client components.
20
+ */
21
+ export declare function CoordinatedLazyClient<T extends {}, P, O>({
22
+ config,
23
+ props
24
+ }: CoordinatedLazyClientProps<T, P, O>): React.ReactElement;
@@ -0,0 +1,65 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { useChunk } from "./useChunk.mjs";
5
+ import { CoordinatedLazy } from "./CoordinatedLazy.mjs";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ function RenderNull() {
8
+ return null;
9
+ }
10
+
11
+ /** Props for {@link CoordinatedLazyClient}. */
12
+
13
+ /**
14
+ * The client-loading half of {@link createCoordinatedLazy}: loads the piece's
15
+ * data on the client via {@link useChunk}, shows `ChunkLoading` until it is
16
+ * ready, then swaps to `ChunkContent` through {@link CoordinatedLazy}. The
17
+ * isomorphic router renders this only for the client-driven render modes, so the
18
+ * content/loading components here are always client components.
19
+ */
20
+ export function CoordinatedLazyClient({
21
+ config,
22
+ props
23
+ }) {
24
+ const ChunkContent = config.ChunkContent;
25
+ const ChunkLoading = config.ChunkLoading ?? RenderNull;
26
+ const {
27
+ data,
28
+ loading,
29
+ revalidating,
30
+ refresh
31
+ } = useChunk(config, props);
32
+ const userProps = props.userProps ?? {};
33
+
34
+ // Spreading the generic `T` alongside the fixed fields needs an assertion; the
35
+ // shape matches `ChunkContentProps<T, P>` / `ChunkLoadingProps<T, P>`. The
36
+ // content also receives `refresh`/`revalidating` so it can trigger a
37
+ // stale-while-revalidate reload.
38
+ const contentProps = {
39
+ ...userProps,
40
+ data,
41
+ loading: false,
42
+ refresh,
43
+ revalidating
44
+ };
45
+ const loadingProps = {
46
+ ...userProps,
47
+ data,
48
+ loading: true
49
+ };
50
+
51
+ // `gate` is left to `CoordinatedLazy`: an explicit `props.gate` wins, otherwise
52
+ // it registers with the ambient controller gate (if any).
53
+ return /*#__PURE__*/_jsx(CoordinatedLazy, {
54
+ ready: !loading,
55
+ defer: config.swap?.defer,
56
+ requireHoist: config.swap?.requireHoist,
57
+ gate: props.gate,
58
+ content: /*#__PURE__*/_jsx(ChunkContent, {
59
+ ...contentProps
60
+ }),
61
+ fallback: /*#__PURE__*/_jsx(ChunkLoading, {
62
+ ...loadingProps
63
+ })
64
+ });
65
+ }
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import type { LazyContentProps } from "./types.mjs";
3
+ /**
4
+ * Lazily import a component and render it once its chunk has loaded, reporting
5
+ * readiness to the settle gate - so the page can coordinate the swap and a
6
+ * `StreamController` can reflect it in `loading`.
7
+ *
8
+ * The import runs in an effect (not `React.lazy` + Suspense) on purpose: the swap
9
+ * that reveals this content mounts/unmounts the subtree around a pending `import()`,
10
+ * and a Suspense boundary that comes and goes around a pending promise trips React's
11
+ * async-info-on-boundary tracking ("cleaning up async info that was not on the
12
+ * parent Suspense boundary"). Loading in an effect avoids a Suspense boundary
13
+ * entirely, and renders only the fallback during SSR (effects don't run there).
14
+ *
15
+ * The import factory is captured once (via lazy `useState`), so an inline
16
+ * `content={() => import('./X')}` doesn't restart the import every render. While
17
+ * the module loads, the explicit `fallback` (or, if none, the coordinating swap's
18
+ * fallback from {@link CoordinatedContentContext}) is shown - so the same
19
+ * placeholder keeps covering the load, with no empty flash.
20
+ */
21
+ export declare function LazyContent<T extends {} = {}>({
22
+ content,
23
+ props,
24
+ fallback,
25
+ gate
26
+ }: LazyContentProps<T>): React.ReactElement;
@@ -0,0 +1,80 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { CoordinatedContentContext } from "./CoordinatedContentContext.mjs";
5
+ import { useSettleGate } from "../useCoordinated/useSettleGate.mjs";
6
+ import { pageSettleGate } from "../useCoordinated/pageSettleGate.mjs";
7
+
8
+ /**
9
+ * Lazily import a component and render it once its chunk has loaded, reporting
10
+ * readiness to the settle gate - so the page can coordinate the swap and a
11
+ * `StreamController` can reflect it in `loading`.
12
+ *
13
+ * The import runs in an effect (not `React.lazy` + Suspense) on purpose: the swap
14
+ * that reveals this content mounts/unmounts the subtree around a pending `import()`,
15
+ * and a Suspense boundary that comes and goes around a pending promise trips React's
16
+ * async-info-on-boundary tracking ("cleaning up async info that was not on the
17
+ * parent Suspense boundary"). Loading in an effect avoids a Suspense boundary
18
+ * entirely, and renders only the fallback during SSR (effects don't run there).
19
+ *
20
+ * The import factory is captured once (via lazy `useState`), so an inline
21
+ * `content={() => import('./X')}` doesn't restart the import every render. While
22
+ * the module loads, the explicit `fallback` (or, if none, the coordinating swap's
23
+ * fallback from {@link CoordinatedContentContext}) is shown - so the same
24
+ * placeholder keeps covering the load, with no empty flash.
25
+ */
26
+ import { jsx as _jsx } from "react/jsx-runtime";
27
+ export function LazyContent({
28
+ content,
29
+ props,
30
+ fallback = null,
31
+ gate
32
+ }) {
33
+ // Capture the import thunk once - consumers pass an inline thunk (new identity
34
+ // each render), and we must not restart the import on every render.
35
+ const [importContent] = React.useState(() => content);
36
+ const [Loaded, setLoaded] = React.useState(null);
37
+ const coordinated = React.useContext(CoordinatedContentContext);
38
+ const reportReady = coordinated.reportReady;
39
+ React.useEffect(() => {
40
+ let active = true;
41
+ importContent().then(mod => {
42
+ if (active) {
43
+ // Function form: the stored value is itself a component (a function),
44
+ // so a bare `setLoaded(mod.default)` would be treated as an updater.
45
+ setLoaded(() => mod.default);
46
+ }
47
+ }).catch(() => {
48
+ // Leave the fallback in place on a failed import (network error, missing
49
+ // chunk); a parent error boundary can handle a hard failure if needed.
50
+ });
51
+ return () => {
52
+ active = false;
53
+ };
54
+ }, [importContent]);
55
+
56
+ // Signal the coordinating swap (and settle gate) that the content has loaded.
57
+ const loaded = Loaded !== null;
58
+ React.useEffect(() => {
59
+ if (loaded) {
60
+ reportReady?.();
61
+ }
62
+ }, [loaded, reportReady]);
63
+
64
+ // Pending until the module loads; report to the page-global gate and, when
65
+ // given, an additional controller gate.
66
+ useSettleGate(loaded, pageSettleGate);
67
+ useSettleGate(loaded, gate ?? null);
68
+ if (Loaded) {
69
+ const componentProps = props ?? {};
70
+ return /*#__PURE__*/_jsx(Loaded, {
71
+ ...componentProps
72
+ });
73
+ }
74
+
75
+ // While loading, show the explicit `fallback` prop if given, otherwise the
76
+ // coordinating swap's fallback (e.g. CodeHighlighter's `ContentLoading`).
77
+ return /*#__PURE__*/_jsx(React.Fragment, {
78
+ children: fallback ?? coordinated.fallback ?? null
79
+ });
80
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import type { LazyContentProps } from "./types.mjs";
3
+ /**
4
+ * Server variant of {@link LazyContent}: an async server component that awaits
5
+ * the dynamic import and renders the component. Render it under a Suspense
6
+ * boundary so React streams the `fallback` until the import resolves, then
7
+ * streams the resolved component in. It is a plain async render function (no
8
+ * Node-only imports), so it bundles harmlessly with the client surface - it
9
+ * just never runs there.
10
+ *
11
+ * Readiness is a client-side concern (the swap and gate live on the client), so
12
+ * there is no gate here - `fallback`/`gate` on the shared props are ignored by
13
+ * the server path (the parent Suspense owns the fallback).
14
+ */
15
+ export declare function LazyContentServer<T extends {} = {}>({
16
+ content,
17
+ props
18
+ }: LazyContentProps<T>): Promise<React.ReactElement>;
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * Server variant of {@link LazyContent}: an async server component that awaits
5
+ * the dynamic import and renders the component. Render it under a Suspense
6
+ * boundary so React streams the `fallback` until the import resolves, then
7
+ * streams the resolved component in. It is a plain async render function (no
8
+ * Node-only imports), so it bundles harmlessly with the client surface - it
9
+ * just never runs there.
10
+ *
11
+ * Readiness is a client-side concern (the swap and gate live on the client), so
12
+ * there is no gate here - `fallback`/`gate` on the shared props are ignored by
13
+ * the server path (the parent Suspense owns the fallback).
14
+ */
15
+ export async function LazyContentServer({
16
+ content,
17
+ props
18
+ }) {
19
+ const loaded = await content();
20
+ const Component = loaded.default;
21
+ const componentProps = props ?? {};
22
+ return /*#__PURE__*/_jsx(Component, {
23
+ ...componentProps
24
+ });
25
+ }
@@ -0,0 +1,8 @@
1
+ import type { ChunkComponentProps, ChunkRenderInputs, CreateChunkConfig } from "./types.mjs";
2
+ /**
3
+ * Evaluate a chunk's config + per-instance props into the already-resolved
4
+ * {@link ChunkRenderInputs} that `resolveChunkRender` consumes. Pure, so
5
+ * the same inputs drive the render decision identically on the server and the
6
+ * client's first render. Mirrors the `isLoaded` rule {@link useChunk} uses.
7
+ */
8
+ export declare function buildChunkRenderInputs<T extends {}, P, O>(config: CreateChunkConfig<T, P, O>, props: ChunkComponentProps<T, P, O>): ChunkRenderInputs;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Evaluate a chunk's config + per-instance props into the already-resolved
3
+ * {@link ChunkRenderInputs} that `resolveChunkRender` consumes. Pure, so
4
+ * the same inputs drive the render decision identically on the server and the
5
+ * client's first render. Mirrors the `isLoaded` rule {@link useChunk} uses.
6
+ */
7
+ export function buildChunkRenderInputs(config, props) {
8
+ const {
9
+ preloaded,
10
+ controlled,
11
+ forceClient,
12
+ skipInitialLoad
13
+ } = props;
14
+ const isLoaded = Boolean(controlled) || (config.isLoaded ? config.isLoaded(preloaded) : preloaded !== undefined);
15
+ // A per-render `props.isInitial` override wins over the config predicate, for
16
+ // consumers whose initial-readiness depends on context they cannot express as
17
+ // a pure `config.isInitial(preloaded)`.
18
+ const isInitial = props.isInitial ?? (config.isInitial ? config.isInitial(preloaded) : false);
19
+
20
+ // A `data`-mode `source` is a SERVER loader (run by `ChunkServerLoader`), so it
21
+ // folds into the server flags alongside `Loader`/`InitialLoader` - it never
22
+ // drives a client mode. (`urls`/`stream` sources have no server-execution branch
23
+ // yet, so they set no server flag; supply them via a `ChunkProvider` to load on
24
+ // the client.) `forceClient` opts a source out of the server path too, exactly
25
+ // like `Loader`/`InitialLoader`; such a chunk falls to the client path and loads
26
+ // via a `ChunkProvider`. `skipInitialLoad` drops the initial stage.
27
+ const source = config.source;
28
+ const dataSource = source && source.mode === 'data' ? source : undefined;
29
+ return {
30
+ isLoaded,
31
+ isInitial,
32
+ hasServerInitial: !forceClient && !skipInitialLoad && Boolean(config.InitialLoader || dataSource?.initial),
33
+ hasServerLoader: !forceClient && Boolean(config.Loader || dataSource)
34
+ };
35
+ }
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+ import type { ChunkComponentProps, CreateChunkConfig } from "./types.mjs";
3
+ /**
4
+ * Build a self-loading {@link CoordinatedLazy} component. The returned component
5
+ * is **isomorphic**: per render it evaluates {@link buildChunkRenderInputs} and
6
+ * routes via `resolveChunkRender`, so one component covers build, server,
7
+ * and client loading, and server or client rendering:
8
+ *
9
+ * - **content** (preloaded/controlled) - renders `ChunkContent` directly, so
10
+ * build-precomputed data lands in the server HTML. `ChunkContent` may be a
11
+ * server OR client component here.
12
+ * - **server-loader / server-initial** - renders the server `ChunkServerLoader`
13
+ * under a Suspense boundary (server `Loader`/`InitialLoader` or a server-side
14
+ * `data`-mode load), so content loads and renders on the server and streams
15
+ * in. Requires a server (RSC) render context; supports server-component content.
16
+ * - **client modes** (async/initial/null) - delegates to the `'use client'`
17
+ * {@link CoordinatedLazyClient}, which loads on the client and swaps the
18
+ * fallback to content. `ChunkContent` here must be a client component.
19
+ *
20
+ * The client-mode branch hands the (function-bearing) `config` to a `'use client'`
21
+ * component, so a client-loaded chunk must render inside a client subtree - call
22
+ * `createCoordinatedLazy` from a client module, or wrap it in a client provider
23
+ * (e.g. `abstractCreateStream`'s `ClientProvider`). Server-loaded and
24
+ * preloaded/precomputed chunks have no such constraint - they render entirely on
25
+ * the server path.
26
+ *
27
+ * The user's generic props `T` flow through to both components; `data` (type
28
+ * `P`) is the loaded value (or the initial value while loading). Use it
29
+ * standalone for any deferred piece (a demo, a chart, a code frame); `useStream`
30
+ * renders a streamed list of them.
31
+ */
32
+ export declare function createCoordinatedLazy<T extends {} = {}, P = unknown, O = unknown>(config: CreateChunkConfig<T, P, O>): React.ComponentType<ChunkComponentProps<T, P, O>>;