@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.
- package/ChunkProvider/ChunkContext.d.mts +10 -0
- package/ChunkProvider/ChunkContext.mjs +15 -0
- package/ChunkProvider/ChunkProvider.d.mts +14 -0
- package/ChunkProvider/ChunkProvider.mjs +38 -0
- package/ChunkProvider/PreloadContext.d.mts +14 -0
- package/ChunkProvider/PreloadContext.mjs +18 -0
- package/ChunkProvider/PreloadProvider.d.mts +13 -0
- package/ChunkProvider/PreloadProvider.mjs +33 -0
- package/ChunkProvider/index.d.mts +7 -0
- package/ChunkProvider/index.mjs +7 -0
- package/ChunkProvider/types.d.mts +23 -0
- package/ChunkProvider/types.mjs +1 -0
- package/ChunkProvider/usePreload.d.mts +8 -0
- package/ChunkProvider/usePreload.mjs +21 -0
- package/CodeControllerContext/CodeControllerContext.d.mts +11 -0
- package/CodeControllerContext/CodeControllerContext.mjs +2 -1
- package/CodeHighlighter/CodeHighlighter.d.mts +15 -1
- package/CodeHighlighter/CodeHighlighter.mjs +97 -319
- package/CodeHighlighter/CodeHighlighterChunk.d.mts +42 -0
- package/CodeHighlighter/CodeHighlighterChunk.mjs +77 -0
- package/CodeHighlighter/CodeHighlighterClient.mjs +597 -128
- package/CodeHighlighter/CodeHighlighterContext.d.mts +57 -1
- package/CodeHighlighter/CodeHighlighterFallbackContext.d.mts +14 -2
- package/CodeHighlighter/CodeHighlighterFallbackContext.mjs +1 -3
- package/CodeHighlighter/CodeInitialSourceLoader.d.mts +10 -0
- package/CodeHighlighter/CodeInitialSourceLoader.mjs +108 -0
- package/CodeHighlighter/CodeSourceLoader.d.mts +11 -0
- package/CodeHighlighter/CodeSourceLoader.mjs +128 -0
- package/CodeHighlighter/buildCodeHighlighterChunkProps.d.mts +47 -0
- package/CodeHighlighter/buildCodeHighlighterChunkProps.mjs +61 -0
- package/CodeHighlighter/buildStringFallback.d.mts +29 -0
- package/CodeHighlighter/buildStringFallback.mjs +42 -0
- package/CodeHighlighter/codeToFallbackProps.d.mts +31 -2
- package/CodeHighlighter/codeToFallbackProps.mjs +347 -42
- package/CodeHighlighter/createClientProps.d.mts +17 -0
- package/CodeHighlighter/createClientProps.mjs +78 -0
- package/CodeHighlighter/errors.d.mts +6 -0
- package/CodeHighlighter/errors.mjs +10 -0
- package/CodeHighlighter/fallbackCompression.d.mts +96 -0
- package/CodeHighlighter/fallbackCompression.mjs +253 -0
- package/CodeHighlighter/fallbackFormat.d.mts +137 -0
- package/CodeHighlighter/fallbackFormat.mjs +422 -0
- package/CodeHighlighter/index.d.mts +4 -1
- package/CodeHighlighter/index.mjs +3 -1
- package/CodeHighlighter/mergeComments.d.mts +38 -0
- package/CodeHighlighter/mergeComments.mjs +80 -0
- package/CodeHighlighter/prepareInitialSource.d.mts +42 -0
- package/CodeHighlighter/prepareInitialSource.mjs +292 -0
- package/CodeHighlighter/resolveFallbackCritical.d.mts +23 -0
- package/CodeHighlighter/resolveFallbackCritical.mjs +44 -0
- package/CodeHighlighter/types.d.mts +272 -8
- package/CodeHighlighter/useCodeFallback.d.mts +94 -0
- package/CodeHighlighter/useCodeFallback.mjs +204 -0
- package/CodeHighlighter/useGrammarsReady.d.mts +18 -0
- package/CodeHighlighter/useGrammarsReady.mjs +45 -0
- package/CodeHighlighter/useSpeculativeCodePreload.d.mts +26 -0
- package/CodeHighlighter/useSpeculativeCodePreload.mjs +40 -0
- package/CodeHighlighter/useSpeculativeEditingPreload.d.mts +33 -0
- package/CodeHighlighter/useSpeculativeEditingPreload.mjs +58 -0
- package/CodeHighlighter/useSpeculativeGrammarPreload.d.mts +23 -0
- package/CodeHighlighter/useSpeculativeGrammarPreload.mjs +31 -0
- package/CodeHighlighter/useSpeculativeUseCodePreload.d.mts +22 -0
- package/CodeHighlighter/useSpeculativeUseCodePreload.mjs +41 -0
- package/CodeProvider/CodeContext.d.mts +47 -12
- package/CodeProvider/CodeContext.mjs +7 -0
- package/CodeProvider/CodeProvider.d.mts +4 -2
- package/CodeProvider/CodeProvider.mjs +40 -102
- package/CodeProvider/CodeProviderLazy.d.mts +40 -0
- package/CodeProvider/CodeProviderLazy.mjs +96 -0
- package/CodeProvider/constants.d.mts +26 -0
- package/CodeProvider/constants.mjs +24 -0
- package/CodeProvider/createParseSourceWorkerClient.d.mts +6 -0
- package/CodeProvider/createParseSourceWorkerClient.mjs +22 -2
- package/CodeProvider/index.d.mts +2 -1
- package/CodeProvider/index.mjs +9 -1
- package/CodeProvider/parseSourceWorker.mjs +33 -0
- package/CodeProvider/useCodeProviderValue.d.mts +54 -0
- package/CodeProvider/useCodeProviderValue.mjs +188 -0
- package/CoordinatedLazy/ChunkServerLoader.d.mts +25 -0
- package/CoordinatedLazy/ChunkServerLoader.mjs +97 -0
- package/CoordinatedLazy/CoordinatedContentContext.d.mts +15 -0
- package/CoordinatedLazy/CoordinatedContentContext.mjs +22 -0
- package/CoordinatedLazy/CoordinatedFallbackContext.d.mts +11 -0
- package/CoordinatedLazy/CoordinatedFallbackContext.mjs +13 -0
- package/CoordinatedLazy/CoordinatedGateContext.d.mts +14 -0
- package/CoordinatedLazy/CoordinatedGateContext.mjs +19 -0
- package/CoordinatedLazy/CoordinatedLazy.d.mts +14 -0
- package/CoordinatedLazy/CoordinatedLazy.mjs +86 -0
- package/CoordinatedLazy/CoordinatedLazyClient.d.mts +24 -0
- package/CoordinatedLazy/CoordinatedLazyClient.mjs +65 -0
- package/CoordinatedLazy/LazyContent.d.mts +26 -0
- package/CoordinatedLazy/LazyContent.mjs +80 -0
- package/CoordinatedLazy/LazyContentServer.d.mts +18 -0
- package/CoordinatedLazy/LazyContentServer.mjs +25 -0
- package/CoordinatedLazy/buildChunkRenderInputs.d.mts +8 -0
- package/CoordinatedLazy/buildChunkRenderInputs.mjs +35 -0
- package/CoordinatedLazy/createCoordinatedLazy.d.mts +32 -0
- package/CoordinatedLazy/createCoordinatedLazy.mjs +127 -0
- package/CoordinatedLazy/index.d.mts +14 -0
- package/CoordinatedLazy/index.mjs +18 -0
- package/CoordinatedLazy/resolveChunkRender.d.mts +26 -0
- package/CoordinatedLazy/resolveChunkRender.mjs +73 -0
- package/CoordinatedLazy/types.d.mts +408 -0
- package/CoordinatedLazy/types.mjs +1 -0
- package/CoordinatedLazy/useChunk.d.mts +30 -0
- package/CoordinatedLazy/useChunk.mjs +135 -0
- package/CoordinatedLazy/useCoordinatedFallback.d.mts +12 -0
- package/CoordinatedLazy/useCoordinatedFallback.mjs +40 -0
- package/CoordinatedLazy/useCoordinatedSwap.d.mts +16 -0
- package/CoordinatedLazy/useCoordinatedSwap.mjs +124 -0
- package/LICENSE +1 -1
- package/abstractCreateDemo/abstractCreateDemo.d.mts +54 -3
- package/abstractCreateDemo/abstractCreateDemo.mjs +47 -7
- package/abstractCreateDemo/resolveDemoFlag.d.mts +20 -0
- package/abstractCreateDemo/resolveDemoFlag.mjs +25 -0
- package/abstractCreateStream/abstractCreateStream.d.mts +18 -0
- package/abstractCreateStream/abstractCreateStream.mjs +45 -0
- package/abstractCreateStream/index.d.mts +2 -0
- package/abstractCreateStream/index.mjs +1 -0
- package/abstractCreateStream/types.d.mts +34 -0
- package/abstractCreateStream/types.mjs +1 -0
- package/abstractCreateTypes/TypeCode.mjs +12 -11
- package/abstractCreateTypes/typesToJsx.mjs +30 -9
- package/cli/ensureDemoClients.mjs +4 -148
- package/cli/ensureDemoPages.d.mts +45 -0
- package/cli/ensureDemoPages.mjs +99 -0
- package/cli/fileUtils/index.d.mts +11 -0
- package/cli/fileUtils/index.mjs +48 -0
- package/cli/findDemoIndexFiles.d.mts +15 -0
- package/cli/findDemoIndexFiles.mjs +121 -0
- package/cli/index.mjs +1 -1
- package/cli/loadNextConfig.d.mts +25 -0
- package/cli/loadNextConfig.mjs +60 -1
- package/cli/runBrowser.mjs +1 -1
- package/cli/runValidate.mjs +44 -1
- package/package.json +85 -5
- package/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasis.mjs +30 -0
- package/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasisLazy.d.mts +17 -0
- package/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasisLazy.mjs +52 -0
- package/pipeline/hastUtils/frameFallbackFromSpans.d.mts +18 -0
- package/pipeline/hastUtils/frameFallbackFromSpans.mjs +24 -0
- package/pipeline/hastUtils/hast.d.mts +27 -0
- package/pipeline/hastUtils/hastCompression.d.mts +3 -1
- package/pipeline/hastUtils/hastCompression.mjs +9 -1
- package/pipeline/hastUtils/hastDecompress.mjs +10 -4
- package/pipeline/hastUtils/hastDictionary.mjs +9 -0
- package/pipeline/hastUtils/hastUtils.d.mts +4 -3
- package/pipeline/hastUtils/hastUtils.mjs +24 -12
- package/pipeline/hastUtils/index.d.mts +2 -1
- package/pipeline/hastUtils/index.mjs +2 -1
- package/pipeline/hastUtils/stripHighlightingSpans.d.mts +6 -2
- package/pipeline/hastUtils/stripHighlightingSpans.mjs +22 -10
- package/pipeline/lintJavascriptDemoFocus/lintJavascriptDemoFocus.mjs +10 -7
- package/pipeline/loadIsomorphicCodeVariant/applyCodeTransform.d.mts +31 -13
- package/pipeline/loadIsomorphicCodeVariant/applyCodeTransform.mjs +50 -55
- package/pipeline/loadIsomorphicCodeVariant/applyCodeTransformWithComments.d.mts +78 -0
- package/pipeline/loadIsomorphicCodeVariant/applyCodeTransformWithComments.mjs +405 -0
- package/pipeline/loadIsomorphicCodeVariant/computeHastDeltas.d.mts +5 -5
- package/pipeline/loadIsomorphicCodeVariant/computeHastDeltas.mjs +36 -66
- package/pipeline/loadIsomorphicCodeVariant/decodeHastSource.d.mts +23 -0
- package/pipeline/loadIsomorphicCodeVariant/decodeHastSource.mjs +92 -0
- package/pipeline/loadIsomorphicCodeVariant/decodeSource.d.mts +19 -0
- package/pipeline/loadIsomorphicCodeVariant/decodeSource.mjs +25 -0
- package/pipeline/loadIsomorphicCodeVariant/decodeSourceToText.d.mts +17 -0
- package/pipeline/loadIsomorphicCodeVariant/decodeSourceToText.mjs +26 -0
- package/pipeline/loadIsomorphicCodeVariant/diffHast.d.mts +26 -2
- package/pipeline/loadIsomorphicCodeVariant/diffHast.mjs +563 -19
- package/pipeline/loadIsomorphicCodeVariant/embedTransforms.d.mts +49 -0
- package/pipeline/loadIsomorphicCodeVariant/embedTransforms.mjs +152 -0
- package/pipeline/loadIsomorphicCodeVariant/findExpandingRanges.d.mts +51 -0
- package/pipeline/loadIsomorphicCodeVariant/findExpandingRanges.mjs +161 -0
- package/pipeline/loadIsomorphicCodeVariant/flattenCodeVariant.mjs +6 -3
- package/pipeline/loadIsomorphicCodeVariant/getAvailableTransforms.d.mts +12 -0
- package/pipeline/loadIsomorphicCodeVariant/getAvailableTransforms.mjs +44 -0
- package/pipeline/loadIsomorphicCodeVariant/getInitialVisibleSourceLines.d.mts +16 -0
- package/pipeline/loadIsomorphicCodeVariant/getInitialVisibleSourceLines.mjs +74 -0
- package/pipeline/loadIsomorphicCodeVariant/loadCodeFallback.mjs +17 -5
- package/pipeline/loadIsomorphicCodeVariant/loadIsomorphicCodeVariant.mjs +229 -15
- package/pipeline/loadIsomorphicCodeVariant/transformSource.d.mts +2 -2
- package/pipeline/loadIsomorphicCodeVariant/transformSource.mjs +56 -22
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.mts +18 -0
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.mjs +11 -7
- package/pipeline/loadServerTypes/hastTypeUtils.d.mts +2 -2
- package/pipeline/loadServerTypes/hastTypeUtils.mjs +4 -4
- package/pipeline/loadServerTypes/loadServerTypes.mjs +1 -1
- package/pipeline/loadServerTypesMeta/extractJSDocText.d.mts +14 -0
- package/pipeline/loadServerTypesMeta/extractJSDocText.mjs +60 -0
- package/pipeline/loadServerTypesMeta/processTypes.mjs +43 -46
- package/pipeline/loadServerTypesText/order.mjs +1 -1
- package/pipeline/loadServerTypesText/parseTypesMarkdown.mjs +3 -1
- package/pipeline/loaderUtils/index.d.mts +0 -1
- package/pipeline/loaderUtils/index.mjs +0 -1
- package/pipeline/loaderUtils/parseImportsAndComments.d.mts +5 -1
- package/pipeline/loaderUtils/parseImportsAndComments.mjs +19 -9
- package/pipeline/loaderUtils/resolveModulePath.mjs +23 -1
- package/pipeline/parseCreateFactoryCall/parseCreateFactoryCall.d.mts +12 -0
- package/pipeline/parseCreateFactoryCall/parseCreateFactoryCall.mjs +17 -13
- package/pipeline/parseSource/addLineGutters.mjs +45 -11
- package/pipeline/parseSource/calculateFrameRanges.d.mts +22 -0
- package/pipeline/parseSource/calculateFrameRanges.mjs +69 -25
- package/pipeline/parseSource/detectGrammarScopes.d.mts +13 -0
- package/pipeline/parseSource/detectGrammarScopes.mjs +35 -0
- package/pipeline/parseSource/extendSyntaxTokens.mjs +501 -43
- package/pipeline/parseSource/frameVisibility.d.mts +47 -0
- package/pipeline/parseSource/frameVisibility.mjs +114 -0
- package/pipeline/parseSource/grammarCache.d.mts +33 -0
- package/pipeline/parseSource/grammarCache.mjs +73 -0
- package/pipeline/parseSource/grammarLoaders.d.mts +14 -0
- package/pipeline/parseSource/grammarLoaders.mjs +24 -0
- package/pipeline/parseSource/grammarMaps.d.mts +21 -1
- package/pipeline/parseSource/grammarMaps.mjs +36 -0
- package/pipeline/parseSource/isFrameSpan.d.mts +19 -0
- package/pipeline/parseSource/isFrameSpan.mjs +24 -0
- package/pipeline/parseSource/parseSource.d.mts +41 -6
- package/pipeline/parseSource/parseSource.mjs +184 -36
- package/pipeline/parseSource/redistributeFrameFallbacks.d.mts +40 -0
- package/pipeline/parseSource/redistributeFrameFallbacks.mjs +138 -0
- package/pipeline/parseSource/restructureFrames.d.mts +5 -0
- package/pipeline/parseSource/restructureFrames.mjs +179 -16
- package/pipeline/syncPageIndex/metadataToMarkdown.mjs +6 -2
- package/pipeline/transformHtmlCodeBlock/transformHtmlCodeBlock.d.mts +26 -0
- package/pipeline/transformHtmlCodeBlock/transformHtmlCodeBlock.mjs +181 -114
- package/pipeline/transformHtmlCodeInline/removeSuffixFromHighlightedNodes.d.mts +12 -0
- package/pipeline/transformHtmlCodeInline/removeSuffixFromHighlightedNodes.mjs +52 -0
- package/pipeline/transformHtmlCodeInline/transformHtmlCodeInline.mjs +22 -1
- package/pipeline/transformTypescriptToJavascript/removeTypes.d.mts +5 -8
- package/pipeline/transformTypescriptToJavascript/removeTypes.mjs +27 -93
- package/useCode/EditableEngine.d.mts +233 -0
- package/useCode/EditableEngine.mjs +1712 -0
- package/useCode/EditingEngine.d.mts +13 -0
- package/useCode/EditingEngine.mjs +14 -0
- package/useCode/Pre.browser.mjs +5 -1
- package/useCode/Pre.d.mts +127 -1
- package/useCode/Pre.mjs +417 -165
- package/useCode/SourceEditingEngine.d.mts +50 -0
- package/useCode/SourceEditingEngine.mjs +461 -0
- package/useCode/TransformEngine.d.mts +39 -0
- package/useCode/TransformEngine.mjs +208 -0
- package/useCode/editingEngineCache.d.mts +29 -0
- package/useCode/editingEngineCache.mjs +68 -0
- package/useCode/sourceLineCounts.d.mts +80 -0
- package/useCode/sourceLineCounts.mjs +284 -0
- package/useCode/subscribeToggleNudge.d.mts +3 -0
- package/useCode/subscribeToggleNudge.mjs +95 -0
- package/useCode/transformEngineCache.d.mts +21 -0
- package/useCode/transformEngineCache.mjs +60 -0
- package/useCode/useCode.d.mts +140 -1
- package/useCode/useCode.mjs +250 -19
- package/useCode/useCodeUtils.d.mts +131 -20
- package/useCode/useCodeUtils.mjs +267 -194
- package/useCode/useCopyFunctionality.d.mts +13 -1
- package/useCode/useCopyFunctionality.mjs +39 -9
- package/useCode/useEditable.browser.mjs +10 -2
- package/useCode/useEditable.d.mts +27 -106
- package/useCode/useEditable.integration.browser.d.mts +1 -0
- package/useCode/useEditable.integration.browser.mjs +870 -0
- package/useCode/useEditable.mjs +198 -1247
- package/useCode/useEditableUtils.d.mts +50 -1
- package/useCode/useEditableUtils.mjs +29 -0
- package/useCode/useFileNavigation.d.mts +91 -3
- package/useCode/useFileNavigation.mjs +201 -41
- package/useCode/useHighlightGate.d.mts +17 -0
- package/useCode/useHighlightGate.mjs +147 -0
- package/useCode/useSourceEditing.d.mts +8 -0
- package/useCode/useSourceEditing.mjs +158 -314
- package/useCode/useSourceEnhancing.d.mts +5 -1
- package/useCode/useSourceEnhancing.mjs +22 -36
- package/useCode/useTransformManagement.d.mts +93 -5
- package/useCode/useTransformManagement.mjs +496 -28
- package/useCode/useTransitionPhase.d.mts +24 -0
- package/useCode/useTransitionPhase.mjs +49 -0
- package/useCode/useUIState.d.mts +2 -2
- package/useCode/useUIState.mjs +8 -8
- package/useCode/useVariantSelection.d.mts +130 -6
- package/useCode/useVariantSelection.mjs +529 -93
- package/useCodeWindow/useCodeWindow.d.mts +19 -2
- package/useCodeWindow/useCodeWindow.mjs +98 -71
- package/useCoordinated/coordinatePreference.d.mts +439 -0
- package/useCoordinated/coordinatePreference.mjs +951 -0
- package/useCoordinated/coordinatePreference.testUtils.d.mts +21 -0
- package/useCoordinated/coordinatePreference.testUtils.mjs +69 -0
- package/useCoordinated/createSettleGate.d.mts +96 -0
- package/useCoordinated/createSettleGate.mjs +171 -0
- package/useCoordinated/index.d.mts +8 -0
- package/useCoordinated/index.mjs +8 -0
- package/useCoordinated/layoutShiftGate.d.mts +24 -0
- package/useCoordinated/layoutShiftGate.mjs +79 -0
- package/useCoordinated/pageSettleGate.d.mts +11 -0
- package/useCoordinated/pageSettleGate.mjs +13 -0
- package/useCoordinated/scheduleTasks.d.mts +23 -0
- package/useCoordinated/scheduleTasks.mjs +45 -0
- package/useCoordinated/useCoordinated.d.mts +193 -0
- package/useCoordinated/useCoordinated.mjs +469 -0
- package/useCoordinated/useCoordinatedLazy.d.mts +17 -0
- package/useCoordinated/useCoordinatedLazy.mjs +38 -0
- package/useCoordinated/useCoordinatedLocalStorage.d.mts +16 -0
- package/useCoordinated/useCoordinatedLocalStorage.mjs +22 -0
- package/useCoordinated/useCoordinatedPreference.d.mts +20 -0
- package/useCoordinated/useCoordinatedPreference.mjs +26 -0
- package/useCoordinated/useSettleGate.d.mts +11 -0
- package/useCoordinated/useSettleGate.mjs +34 -0
- package/useDemo/exportVariant.d.mts +12 -5
- package/useDemo/exportVariant.mjs +59 -5
- package/useDemo/useDemo.d.mts +5 -2
- package/useScrollAnchor/useScrollAnchor.mjs +28 -5
- package/useStream/index.d.mts +6 -0
- package/useStream/index.mjs +6 -0
- package/useStream/streamChunks.d.mts +23 -0
- package/useStream/streamChunks.mjs +85 -0
- package/useStream/types.d.mts +45 -0
- package/useStream/types.mjs +1 -0
- package/useStream/useStream.d.mts +57 -0
- package/useStream/useStream.mjs +119 -0
- package/useStream/useStreamController.d.mts +15 -0
- package/useStream/useStreamController.mjs +90 -0
- package/withDocsInfra/withDocsInfra.d.mts +19 -0
- package/withDocsInfra/withDocsInfra.mjs +13 -5
- package/pipeline/loaderUtils/convertCommentsToOneIndexed.d.mts +0 -8
- package/pipeline/loaderUtils/convertCommentsToOneIndexed.mjs +0 -16
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic same-tab preference coordinator. Its primary purpose is
|
|
3
|
+
* to **fold many concurrent value changes into a single layout-shift
|
|
4
|
+
* commit**: sibling component instances that share a `channelKey`
|
|
5
|
+
* coordinate so the visible flip happens together rather than as a
|
|
6
|
+
* cascade of independent re-layouts.
|
|
7
|
+
*
|
|
8
|
+
* Each peer self-classifies a given target value via
|
|
9
|
+
* `causesLayoutShift` (consulted for non-originator peers only;
|
|
10
|
+
* originators always take the barrier path so a user click always
|
|
11
|
+
* feels coordinated):
|
|
12
|
+
*
|
|
13
|
+
* - **`causesLayoutShift(target) === true`** — the peer joins a
|
|
14
|
+
* channel-wide barrier. Every joining peer's `preload` runs
|
|
15
|
+
* serially across the channel (so no main-thread contention
|
|
16
|
+
* while we prepare the swap), and all `onCommit`s fire together
|
|
17
|
+
* in a single microtask once everyone is ready. Use for changes
|
|
18
|
+
* that visibly resize content (collapse/expand, code transforms,
|
|
19
|
+
* image swaps with different aspect ratios).
|
|
20
|
+
* - **`causesLayoutShift(target) === false`** — the peer runs its
|
|
21
|
+
* `preload`+`commit` on its own self-serial chain. Multiple
|
|
22
|
+
* peers' lazy chains run concurrently with each other and with
|
|
23
|
+
* any in-flight barrier. Use for changes that are visually
|
|
24
|
+
* non-disruptive (e.g. updating a value that only shows on hover).
|
|
25
|
+
*
|
|
26
|
+
* Different peers may classify the same target differently — each
|
|
27
|
+
* peer's classification governs only that peer's path through the
|
|
28
|
+
* coordinator.
|
|
29
|
+
*
|
|
30
|
+
* **Cross-tab behavior is intentionally out of scope.** Tabs sync via
|
|
31
|
+
* the underlying state primitive (`useLocalStorageState` etc.); this
|
|
32
|
+
* coordinator only handles peers in the same JS context. A receiving
|
|
33
|
+
* tab independently runs its own barrier across its local peers,
|
|
34
|
+
* which is sequenced naturally after the originator's commit because
|
|
35
|
+
* the originator defers the underlying `setValue` write until its
|
|
36
|
+
* own barrier commits (see `useCoordinated`).
|
|
37
|
+
*
|
|
38
|
+
* No React, no DOM, no BroadcastChannel — pure module-scoped state
|
|
39
|
+
* suitable for any state primitive.
|
|
40
|
+
*
|
|
41
|
+
* **Browser-only.** All state (channels, barriers, lazy queues) is
|
|
42
|
+
* held in module scope and would persist across requests if this
|
|
43
|
+
* module were ever evaluated in a long-lived server-side runtime.
|
|
44
|
+
* The consuming surface is the `useCoordinated` React hook, whose
|
|
45
|
+
* `registerPeer`/`announceTarget` calls are gated behind
|
|
46
|
+
* `useLayoutEffect`/event handlers and therefore never reached
|
|
47
|
+
* during SSR. Do not import this module from server-side code
|
|
48
|
+
* paths that fan out per request.
|
|
49
|
+
*/
|
|
50
|
+
/** Identifier assigned to each peer at registration time. */
|
|
51
|
+
export type PeerId = string;
|
|
52
|
+
/** Channel scope. Peers sharing a `channelKey` coordinate with each other. */
|
|
53
|
+
export type ChannelKey = string;
|
|
54
|
+
/**
|
|
55
|
+
* Sentinel returned by the coordinator's `announceTarget` when no
|
|
56
|
+
* commit is needed for this peer (e.g. its current value already
|
|
57
|
+
* matches the target). Always-defined to keep the API ergonomic.
|
|
58
|
+
*/
|
|
59
|
+
export interface AnnounceHandle {
|
|
60
|
+
/**
|
|
61
|
+
* Abort a pending announcement (e.g. before the preload has run, or
|
|
62
|
+
* before the barrier has resolved). After `cancel()` no `onCommit`
|
|
63
|
+
* fires for this peer.
|
|
64
|
+
*/
|
|
65
|
+
cancel(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Resolves when this peer's `onCommit` has fired or the announcement
|
|
68
|
+
* has been cancelled. Useful for tests and for callers that want to
|
|
69
|
+
* `await` a settled coordination.
|
|
70
|
+
*/
|
|
71
|
+
settled: Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export interface AnnounceOptions<TValue, TPreload> {
|
|
74
|
+
/**
|
|
75
|
+
* Per-target classifier consulted for **non-originator peers only**.
|
|
76
|
+
* Return `true` when applying this target would visibly shift
|
|
77
|
+
* layout — the peer will join the channel-wide barrier so all
|
|
78
|
+
* such peers commit together. Return `false` for non-disruptive
|
|
79
|
+
* changes — the peer will commit lazily on its own self-serial
|
|
80
|
+
* chain. Originators (the peer the user is directly interacting
|
|
81
|
+
* with) always take the barrier path regardless of this
|
|
82
|
+
* classifier, so a click always feels coordinated with whichever
|
|
83
|
+
* peers join. Different peers may classify the same target
|
|
84
|
+
* differently.
|
|
85
|
+
*/
|
|
86
|
+
causesLayoutShift: (target: TValue) => boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Per-peer preload work. The returned value is handed back to
|
|
89
|
+
* `onCommit`. Receives an `AbortSignal` that fires if the
|
|
90
|
+
* announcement is cancelled (e.g. superseded by a newer target).
|
|
91
|
+
* Barrier peers run their `preload` in serial across the channel;
|
|
92
|
+
* lazy peers run their own self-serial chain. May be omitted for
|
|
93
|
+
* pure value-flip use cases.
|
|
94
|
+
*/
|
|
95
|
+
preload?: (target: TValue, signal: AbortSignal) => TPreload | Promise<TPreload>;
|
|
96
|
+
/**
|
|
97
|
+
* Fired when this peer's slice of the coordination has settled.
|
|
98
|
+
* For the barrier path this is inside the batched commit (all
|
|
99
|
+
* barrier peers' `onCommit`s run in the same microtask). For the
|
|
100
|
+
* lazy path this is immediately after this peer's own preload
|
|
101
|
+
* completes.
|
|
102
|
+
*
|
|
103
|
+
* `preloaded` may be `undefined` even when `preload` was provided:
|
|
104
|
+
* - the barrier force-resolved at `ultimateTimeoutMs` before this
|
|
105
|
+
* peer's slow preload settled,
|
|
106
|
+
* - the preload threw (logged via `console.error`, treated as a
|
|
107
|
+
* no-op so the rest of the channel still commits), or
|
|
108
|
+
* - the preload returned `undefined`/no value.
|
|
109
|
+
*
|
|
110
|
+
* A superseded announce does not call this `onCommit` — the
|
|
111
|
+
* superseding announce takes over and only its `onCommit` runs.
|
|
112
|
+
*
|
|
113
|
+
* Callers must tolerate `preloaded === undefined` and fall back to
|
|
114
|
+
* a synchronous render path (or skip the side effect entirely)
|
|
115
|
+
* rather than throwing.
|
|
116
|
+
*/
|
|
117
|
+
onCommit: (target: TValue, preloaded: TPreload | undefined) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Minimum wall-clock time before commit, measured from
|
|
120
|
+
* `announceTime`. On the barrier path: the barrier stays open at
|
|
121
|
+
* least this long so consumers can play an exit animation on the
|
|
122
|
+
* outgoing state. On the lazy path: the per-peer self-serial chain
|
|
123
|
+
* waits at least this long after `announceTime` (anchored, not
|
|
124
|
+
* relative to when preload resolves) so a non-layout-shift peer
|
|
125
|
+
* can land its swap on the same wall-clock window as a sibling
|
|
126
|
+
* barrier instead of cascading. Default 0.
|
|
127
|
+
*/
|
|
128
|
+
minWaitMs?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Additional wait applied to `minWaitMs` on the barrier path when
|
|
131
|
+
* more than one peer is registered on the channel at the time the
|
|
132
|
+
* barrier opens. Lets callers express "no extra delay when this
|
|
133
|
+
* demo is alone, but give late siblings a frame to join when they
|
|
134
|
+
* exist" without leaking solo-peer churn through a baseline
|
|
135
|
+
* `minWaitMs`. Default 0.
|
|
136
|
+
*/
|
|
137
|
+
multiPeerExtraMinWaitMs?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Overrides `minWaitMs` for the lazy path only. Useful when
|
|
140
|
+
* non-layout-shift peers should land their swap *after* the
|
|
141
|
+
* sibling barrier has finished its expand-swap-collapse window
|
|
142
|
+
* (e.g. `2 * minWaitMs`) so the page settles in one paint instead
|
|
143
|
+
* of cascading. Falls back to `minWaitMs` when unset.
|
|
144
|
+
*/
|
|
145
|
+
lazyMinWaitMs?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Lazy-path opt-in: when a same-target barrier is pending at the
|
|
148
|
+
* moment this peer announces, run its `preload` concurrently with
|
|
149
|
+
* the barrier's preloads instead of waiting for the barrier to
|
|
150
|
+
* commit. Use only for I/O-bound preloads that don't tax the main
|
|
151
|
+
* thread (e.g. fetching a JSON payload) — main-thread-heavy
|
|
152
|
+
* preloads (parsing, highlighting, layout measurement) should
|
|
153
|
+
* leave this `false` so the barrier's layout-shifting peers get
|
|
154
|
+
* uncontended CPU time to settle their swap.
|
|
155
|
+
*
|
|
156
|
+
* The lazy peer's `onCommit` still waits until the render after
|
|
157
|
+
* the barrier commits, regardless of this flag — the visible flip
|
|
158
|
+
* never lands before the layout-shifting siblings have painted.
|
|
159
|
+
*
|
|
160
|
+
* No effect when no barrier exists at announce time (the lazy
|
|
161
|
+
* pipeline runs immediately on its own clock).
|
|
162
|
+
*
|
|
163
|
+
* Default `false`.
|
|
164
|
+
*/
|
|
165
|
+
preloadAll?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Lazy-path only: scheduling priority for the per-peer commit.
|
|
168
|
+
*
|
|
169
|
+
* - `'idle'` (default) — the commit is scheduled via
|
|
170
|
+
* `requestIdleCallback` so the browser can yield to
|
|
171
|
+
* higher-priority work (input, in-flight barrier paints)
|
|
172
|
+
* before the swap lands. Useful when the lazy peer's commit
|
|
173
|
+
* itself is main-thread heavy (DOM reconciliation of a
|
|
174
|
+
* freshly transformed tree, etc.).
|
|
175
|
+
* - `'normal'` — the commit lands as soon as the preload
|
|
176
|
+
* resolves, without an idle defer. Use this for I/O-bound
|
|
177
|
+
* preloads where the commit is cheap and you want each peer's
|
|
178
|
+
* swap to surface immediately; otherwise idle scheduling can
|
|
179
|
+
* cluster commits together near the slowest peer's settle,
|
|
180
|
+
* defeating the visible "cascade" the lazy path is meant to
|
|
181
|
+
* provide.
|
|
182
|
+
*
|
|
183
|
+
* Has no effect on the barrier path — barrier commits are batched
|
|
184
|
+
* synchronously inside the barrier's resolve microtask regardless.
|
|
185
|
+
*
|
|
186
|
+
* `'idle'` falls back to a synchronous commit if
|
|
187
|
+
* `requestIdleCallback` isn't available on `globalThis`.
|
|
188
|
+
*/
|
|
189
|
+
lazyCommitPriority?: 'idle' | 'normal';
|
|
190
|
+
/**
|
|
191
|
+
* Time past `minWaitMs` after which `onWaitingForPeers` fires if
|
|
192
|
+
* the barrier still hasn't resolved. The barrier itself keeps
|
|
193
|
+
* waiting up to `ultimateTimeoutMs`. Default 300ms.
|
|
194
|
+
*/
|
|
195
|
+
gracePeriodMs?: number;
|
|
196
|
+
/**
|
|
197
|
+
* Absolute ceiling past announcement after which the barrier
|
|
198
|
+
* force-resolves and logs a warning, regardless of outstanding
|
|
199
|
+
* peers. Default 10s.
|
|
200
|
+
*/
|
|
201
|
+
ultimateTimeoutMs?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Called once when `gracePeriodMs` elapses with the barrier still
|
|
204
|
+
* unresolved. Only meaningful for originators (the peer that the
|
|
205
|
+
* user is directly interacting with) so they can surface a
|
|
206
|
+
* "waiting for peers" indicator.
|
|
207
|
+
*/
|
|
208
|
+
onWaitingForPeers?: () => void;
|
|
209
|
+
/**
|
|
210
|
+
* Whether this peer originated the change (user click) versus
|
|
211
|
+
* received it from elsewhere (storage event from another tab). Only
|
|
212
|
+
* affects which peer's `onWaitingForPeers` may fire and which peer
|
|
213
|
+
* opens the channel-wide barrier.
|
|
214
|
+
*/
|
|
215
|
+
isOriginator: boolean;
|
|
216
|
+
/** Wall-clock anchor (`Date.now()`) for barrier timers. */
|
|
217
|
+
announceTime: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Fired on a registered peer when *another* peer in the same channel
|
|
221
|
+
* calls `announceTarget`. Lets a peer learn about a sibling-driven
|
|
222
|
+
* change without having to wait for the underlying state primitive
|
|
223
|
+
* (e.g. `useLocalStorageState`) to echo the new value back — that
|
|
224
|
+
* echo only happens after the originator commits, which itself is
|
|
225
|
+
* gated on every sibling joining the barrier. Without this hook
|
|
226
|
+
* sibling peers would deadlock the barrier until
|
|
227
|
+
* `ultimateTimeoutMs` for any same-tab coordination where the
|
|
228
|
+
* underlying primitive only notifies after the originator's write.
|
|
229
|
+
*
|
|
230
|
+
* Implementations should typically call into their local equivalent
|
|
231
|
+
* of `runCoordination(target, isOriginator=false)` so the peer
|
|
232
|
+
* joins the active barrier (or kicks off its own lazy chain on the
|
|
233
|
+
* same wall-clock window). Implementations must be idempotent for
|
|
234
|
+
* repeated calls with the same `target` because notifications can
|
|
235
|
+
* fan out from each subsequent join.
|
|
236
|
+
*/
|
|
237
|
+
export type OnSiblingAnnounce<TValue> = (target: TValue) => void;
|
|
238
|
+
interface RegisteredPeer<TValue> {
|
|
239
|
+
id: PeerId;
|
|
240
|
+
/**
|
|
241
|
+
* Last value this peer reported via `reportValue`. Used to skip
|
|
242
|
+
* peers that are already at the target when classifying barrier
|
|
243
|
+
* expectations. Initialized lazily on first `reportValue`.
|
|
244
|
+
*/
|
|
245
|
+
currentValue: {
|
|
246
|
+
has: false;
|
|
247
|
+
} | {
|
|
248
|
+
has: true;
|
|
249
|
+
value: TValue;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Optional notifier invoked when *another* peer on the channel
|
|
253
|
+
* announces a target. See {@link OnSiblingAnnounce}.
|
|
254
|
+
*/
|
|
255
|
+
onSiblingAnnounce?: OnSiblingAnnounce<TValue>;
|
|
256
|
+
/**
|
|
257
|
+
* In-flight lazy-path work, keyed by the AbortController used to
|
|
258
|
+
* cancel it. The value is the target each entry is committing to,
|
|
259
|
+
* so barrier creation can selectively skip a peer only when its
|
|
260
|
+
* pending lazy work matches the new barrier's target.
|
|
261
|
+
* Cancelled when the peer is unregistered or a new lazy-path
|
|
262
|
+
* announcement supersedes a still-queued one.
|
|
263
|
+
*/
|
|
264
|
+
lazyInFlight: Map<AbortController, TValue>;
|
|
265
|
+
/**
|
|
266
|
+
* Per-peer serialization queue for lazy-path announcements. Each
|
|
267
|
+
* entry is a starter callback that kicks off its preload + commit
|
|
268
|
+
* pipeline. We drain via callback chaining (not Promise.then) so
|
|
269
|
+
* the entire pipeline stays on macrotasks — important for tests
|
|
270
|
+
* driving fake timers without microtask drains.
|
|
271
|
+
*/
|
|
272
|
+
lazyQueue: Array<() => void>;
|
|
273
|
+
lazyActive: boolean;
|
|
274
|
+
}
|
|
275
|
+
interface BarrierWaiter<TValue, TPreload> {
|
|
276
|
+
peerId: PeerId;
|
|
277
|
+
isOriginator: boolean;
|
|
278
|
+
preloaded: {
|
|
279
|
+
has: false;
|
|
280
|
+
} | {
|
|
281
|
+
has: true;
|
|
282
|
+
value: TPreload | undefined;
|
|
283
|
+
};
|
|
284
|
+
onCommit: (target: TValue, preloaded: TPreload | undefined) => void;
|
|
285
|
+
onWaitingForPeers?: () => void;
|
|
286
|
+
/** Resolves the waiter's `settled` promise. */
|
|
287
|
+
settle: () => void;
|
|
288
|
+
/** Cancel handle for the waiter's enqueued preload work. */
|
|
289
|
+
abort: AbortController;
|
|
290
|
+
}
|
|
291
|
+
interface PendingBarrier<TValue, TPreload> {
|
|
292
|
+
target: TValue;
|
|
293
|
+
/**
|
|
294
|
+
* Wall-clock anchor (`Date.now()`) recorded when the barrier was
|
|
295
|
+
* opened. Used by {@link getBarrierAnnounceTime} so late-joining
|
|
296
|
+
* peers can align their local timers to the originator's window
|
|
297
|
+
* instead of restarting a fresh one.
|
|
298
|
+
*/
|
|
299
|
+
announceTime: number;
|
|
300
|
+
/**
|
|
301
|
+
* Performance mark name recorded when the barrier was opened.
|
|
302
|
+
* Used as the start mark when measuring the barrier's resolution
|
|
303
|
+
* duration so a single {@link PerformanceObserver} entry captures
|
|
304
|
+
* the full open → resolve window for the channel.
|
|
305
|
+
*/
|
|
306
|
+
openMark?: string;
|
|
307
|
+
/**
|
|
308
|
+
* Peers expected to participate. Set when the barrier opens and on
|
|
309
|
+
* each waiter join (peers register themselves as they classify the
|
|
310
|
+
* target as 'high'). The barrier resolves when every expected peer
|
|
311
|
+
* has its `preloaded` field populated AND the minimum wait has
|
|
312
|
+
* elapsed.
|
|
313
|
+
*/
|
|
314
|
+
waiters: Map<PeerId, BarrierWaiter<TValue, TPreload>>;
|
|
315
|
+
/**
|
|
316
|
+
* Peers that explicitly opted out of this barrier by taking the
|
|
317
|
+
* lazy path for the same `target`. The barrier may resolve once
|
|
318
|
+
* `waiters.size + skipped.size >= channel.peers.size`.
|
|
319
|
+
*/
|
|
320
|
+
skipped: Set<PeerId>;
|
|
321
|
+
/** `true` once the minimum-wait timer has fired. */
|
|
322
|
+
minWaitPassed: boolean;
|
|
323
|
+
minWaitTimer: ReturnType<typeof setTimeout>;
|
|
324
|
+
waitingForPeersTimer: ReturnType<typeof setTimeout>;
|
|
325
|
+
waitingForPeersNotified: boolean;
|
|
326
|
+
ultimateTimer: ReturnType<typeof setTimeout>;
|
|
327
|
+
ultimateTimeoutMs: number;
|
|
328
|
+
/**
|
|
329
|
+
* Callbacks queued by lazy peers that announced the same target
|
|
330
|
+
* while this barrier was pending. Fired one macrotask after every
|
|
331
|
+
* waiter's `onCommit` runs, so the lazy peers' commits land in
|
|
332
|
+
* the render *after* the barrier's batched commit — keeping the
|
|
333
|
+
* main thread clear while the layout-shifting siblings paint.
|
|
334
|
+
*/
|
|
335
|
+
deferredLazyReleases: Array<() => void>;
|
|
336
|
+
}
|
|
337
|
+
interface Channel<TValue> {
|
|
338
|
+
channelKey: ChannelKey;
|
|
339
|
+
peers: Map<PeerId, RegisteredPeer<TValue>>;
|
|
340
|
+
/**
|
|
341
|
+
* `true` once any peer has called `announceTarget` on this channel
|
|
342
|
+
* since the channel was created. Surfaced by
|
|
343
|
+
* {@link hasEverAnnounced} so callers can distinguish "first
|
|
344
|
+
* paint, nobody has interacted" from "someone interacted then
|
|
345
|
+
* everyone settled". Never reset — a channel that's been
|
|
346
|
+
* announced on and then emptied will still report `true` until
|
|
347
|
+
* its last peer unregisters and the channel disposes.
|
|
348
|
+
*/
|
|
349
|
+
hasEverAnnounced: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Channel-wide serial queue for barrier-path preloads. Each barrier-path
|
|
352
|
+
* announcement appends its preload work; only one preload runs at a
|
|
353
|
+
* time across all this-tab barrier-path peers, preventing main-thread
|
|
354
|
+
* contention when many sibling demos all need to precompute.
|
|
355
|
+
*/
|
|
356
|
+
barrierTail: Promise<unknown>;
|
|
357
|
+
/**
|
|
358
|
+
* At most one pending barrier-path barrier per encoded target value.
|
|
359
|
+
* Keyed by the result of `encodeTarget` so any hashable target
|
|
360
|
+
* works.
|
|
361
|
+
*/
|
|
362
|
+
pendingBarriers: Map<string, PendingBarrier<TValue, unknown>>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Set a custom target encoder. Returns a function that restores the
|
|
366
|
+
* previous encoder. Intended for tests; consumed via
|
|
367
|
+
* `coordinatePreference.testUtils`.
|
|
368
|
+
*/
|
|
369
|
+
declare function setTargetEncoder(impl: (value: unknown) => string): () => void;
|
|
370
|
+
/**
|
|
371
|
+
* Register a peer with a channel. Returns an `unregister` function
|
|
372
|
+
* that removes the peer; calling it cancels any in-flight lazy-path
|
|
373
|
+
* work owned by the peer and drops it from any open barrier-path barriers.
|
|
374
|
+
*
|
|
375
|
+
* Pass `onSiblingAnnounce` to learn about target announcements made
|
|
376
|
+
* by other peers on the channel — this is what lets a peer join the
|
|
377
|
+
* originator's barrier window without waiting for the underlying
|
|
378
|
+
* state primitive to echo the new value (which only happens after
|
|
379
|
+
* the originator commits, creating a deadlock when every peer is
|
|
380
|
+
* waiting on it).
|
|
381
|
+
*/
|
|
382
|
+
export declare function registerPeer<TValue>(channelKey: ChannelKey, peerId: PeerId, onSiblingAnnounce?: OnSiblingAnnounce<TValue>): () => void;
|
|
383
|
+
/**
|
|
384
|
+
* Report a peer's current value to the coordinator. Used to exclude
|
|
385
|
+
* already-at-target peers from barrier expectations.
|
|
386
|
+
*/
|
|
387
|
+
export declare function reportValue<TValue>(channelKey: ChannelKey, peerId: PeerId, currentValue: TValue): void;
|
|
388
|
+
/**
|
|
389
|
+
* Announce a target value for this peer. Routes into the barrier or
|
|
390
|
+
* lazy path based on `causesLayoutShift(target)`.
|
|
391
|
+
*
|
|
392
|
+
* For the barrier path: the peer joins the channel-wide barrier for
|
|
393
|
+
* this target (creating it if needed), enqueues its `preload` into
|
|
394
|
+
* the channel's serial queue, and awaits the barrier's batched
|
|
395
|
+
* commit.
|
|
396
|
+
*
|
|
397
|
+
* For the lazy path: the peer enqueues `preload` + `onCommit` onto
|
|
398
|
+
* its own self-serial chain and returns immediately. Multiple peers'
|
|
399
|
+
* lazy chains run concurrently with each other and with any
|
|
400
|
+
* in-flight barrier work.
|
|
401
|
+
*/
|
|
402
|
+
export declare function announceTarget<TValue, TPreload>(channelKey: ChannelKey, peerId: PeerId, target: TValue, options: AnnounceOptions<TValue, TPreload>): AnnounceHandle;
|
|
403
|
+
/**
|
|
404
|
+
* Returns `true` if any peer has ever called `announceTarget` on this
|
|
405
|
+
* channel since the channel was created (i.e., since the first peer
|
|
406
|
+
* registered without an existing channel object). Useful for
|
|
407
|
+
* first-render reconciliation: a peer that wakes up post-hydration
|
|
408
|
+
* and finds the channel "fresh" (no announcements yet) can safely
|
|
409
|
+
* fast-forward its committed value to the latest underlying value
|
|
410
|
+
* without going through a barrier, because no peer is mid-animation.
|
|
411
|
+
*
|
|
412
|
+
* Returns `false` when the channel doesn't exist (no peers have
|
|
413
|
+
* registered yet) or exists but hasn't seen an announce.
|
|
414
|
+
*/
|
|
415
|
+
export declare function hasEverAnnounced(channelKey: ChannelKey): boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Returns the `announceTime` recorded when the active barrier for
|
|
418
|
+
* `target` was opened, or `null` if no barrier is currently pending
|
|
419
|
+
* for that target on `channelKey`. Late-joining peers can use this
|
|
420
|
+
* to anchor their local timers to the originator's wall-clock window
|
|
421
|
+
* instead of restarting a fresh one \u2014 e.g. a peer whose state
|
|
422
|
+
* propagated 200ms after the originator's click should commit 200ms
|
|
423
|
+
* earlier than its local `Date.now()` would suggest, so the visible
|
|
424
|
+
* paint lines up.
|
|
425
|
+
*/
|
|
426
|
+
export declare function getBarrierAnnounceTime<TValue>(channelKey: ChannelKey, target: TValue): number | null;
|
|
427
|
+
/**
|
|
428
|
+
* Internal handles for the `coordinatePreference.testUtils` sibling.
|
|
429
|
+
*
|
|
430
|
+
* Not part of the public API. Do not import this from production
|
|
431
|
+
* code or from tests directly — use the helpers re-exported from
|
|
432
|
+
* `./coordinatePreference.testUtils` instead so that the boundary
|
|
433
|
+
* between runtime API and test affordances stays clear.
|
|
434
|
+
*/
|
|
435
|
+
export declare const __testInternals: {
|
|
436
|
+
channels: Map<string, Channel<unknown>>;
|
|
437
|
+
setTargetEncoder: typeof setTargetEncoder;
|
|
438
|
+
};
|
|
439
|
+
export {};
|