@mui/internal-docs-infra 0.12.1-canary.1 → 0.12.1-canary.3
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/CodeHighlighter/CodeHighlighter.mjs +1 -1
- package/CodeHighlighter/CodeHighlighterClient.mjs +6 -6
- package/CodeHighlighter/createClientProps.mjs +1 -1
- package/CodeHighlighter/fallbackFormat.d.mts +1 -1
- package/CodeHighlighter/fallbackFormat.mjs +1 -1
- package/CodeHighlighter/prepareInitialSource.mjs +1 -1
- package/CodeHighlighter/resolveFallbackCritical.d.mts +1 -1
- package/CodeHighlighter/resolveFallbackCritical.mjs +1 -1
- package/CodeHighlighter/types.d.mts +1 -1
- package/package.json +12 -5
- package/useCode/Pre.mjs +1 -1
- package/withDocsInfra/withDeploymentConfig.mjs +1 -0
|
@@ -107,7 +107,7 @@ export function CodeHighlighter(props) {
|
|
|
107
107
|
|
|
108
108
|
// No ContentLoading: render the content/full-load directly, with no loading
|
|
109
109
|
// fallback (the client shows nothing until content is ready). For
|
|
110
|
-
// `
|
|
110
|
+
// `highlightAfter: 'init'`, `createClientProps` folds each variant's highlighted-visible
|
|
111
111
|
// `fallbackCritical` over its plain `fallback`, so `<Pre>` paints the visible frames
|
|
112
112
|
// highlighted on the first render (no decompression) and decodes the full tree after
|
|
113
113
|
// paint (the `decodeAllowed` latch).
|
|
@@ -120,7 +120,7 @@ function useInitialData({
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// Fold each variant's highlighted-visible `fallbackCritical` over its plain
|
|
123
|
-
// `fallback` (under `
|
|
123
|
+
// `fallback` (under `highlightAfter: 'init'`) and strip the staging field, so the
|
|
124
124
|
// hoisted loading fallback is already highlighted and nothing leaks to the
|
|
125
125
|
// content. `collapseToEmpty` isn't threaded into the client here, so the `false`
|
|
126
126
|
// form is assumed: under collapse-to-empty this may promote a few frames that are
|
|
@@ -343,7 +343,7 @@ function useCodeParsing({
|
|
|
343
343
|
}, [highlightAfter]);
|
|
344
344
|
|
|
345
345
|
// Highlight instantly once hydrated, as a non-blocking client transition,
|
|
346
|
-
// rather than deferring to a scheduled task. (`
|
|
346
|
+
// rather than deferring to a scheduled task. (`highlightAfter: 'idle'` above is
|
|
347
347
|
// the mode that deliberately keeps the unhighlighted first paint and swaps in
|
|
348
348
|
// the highlighted tree on a later idle render.)
|
|
349
349
|
React.useEffect(() => {
|
|
@@ -421,9 +421,9 @@ function useCodeParsing({
|
|
|
421
421
|
const waitingForParsedCode = shouldHighlight && !!code && !allVariantsAlreadyHighlighted && !parsedCode;
|
|
422
422
|
|
|
423
423
|
// Only signal `deferHighlight` while a highlight pass is actively in
|
|
424
|
-
// flight. When `shouldHighlight` is `false` (e.g. `
|
|
425
|
-
// before the idle window fires
|
|
426
|
-
//
|
|
424
|
+
// flight. When `shouldHighlight` is `false` (e.g. `highlightAfter: 'idle'`
|
|
425
|
+
// before the idle window fires) we render the un-highlighted source
|
|
426
|
+
// as-is — downstream
|
|
427
427
|
// consumers like `useTransformManagement`'s `awaitHighlight` gate must
|
|
428
428
|
// commit eagerly against that source instead of blocking the barrier
|
|
429
429
|
// indefinitely. Once the trigger fires, `shouldHighlight` flips true,
|
|
@@ -436,7 +436,7 @@ function useCodeParsing({
|
|
|
436
436
|
// needs to know whether the published `code` should be rendered as
|
|
437
437
|
// highlighted HAST *now*. That answer is false in two distinct
|
|
438
438
|
// windows that `deferHighlight` deliberately collapses out:
|
|
439
|
-
// 1. The trigger for `
|
|
439
|
+
// 1. The trigger for `highlightAfter: 'hydration' | 'idle'`
|
|
440
440
|
// hasn't fired yet — `shouldHighlight` is still false. The
|
|
441
441
|
// precomputed `codeWithGlobals` already contains HAST, so
|
|
442
442
|
// without a render-side gate `<Pre>` would render highlighted
|
|
@@ -13,7 +13,7 @@ export function createClientProps(props) {
|
|
|
13
13
|
const enhanceAfter = props.enhanceAfter === 'stream' ? 'init' : props.enhanceAfter;
|
|
14
14
|
|
|
15
15
|
// Resolve the staging `fallbackCritical` on every variant of both carriers before
|
|
16
|
-
// they cross to the client: under `
|
|
16
|
+
// they cross to the client: under `highlightAfter: 'init'` (not `collapseToEmpty`)
|
|
17
17
|
// promote it over the plain `fallback` so the first paint is highlighted with no
|
|
18
18
|
// decompression, and always strip it so it never reaches `Content`/`ContentLoading`
|
|
19
19
|
// or bloats the payload. `code` and `precompute` are forwarded separately (the
|
|
@@ -79,7 +79,7 @@ export declare function fallbackIsHighlighted(fallback: FallbackNode[]): boolean
|
|
|
79
79
|
* render (`visibleFrames`). Off-screen frames are omitted — they flatten to exactly
|
|
80
80
|
* {@link buildRootFallback}'s plain output, so storing them would just duplicate
|
|
81
81
|
* `fallback` in the precompute. {@link promoteCriticalFallback} splices these back
|
|
82
|
-
* over the plain fallback for `
|
|
82
|
+
* over the plain fallback for `highlightAfter: 'init'` (paint highlighted on the first
|
|
83
83
|
* render, zero decompression). Frame indices count `span.frame` children only,
|
|
84
84
|
* matching `getInitialVisibleFrames`.
|
|
85
85
|
*
|
|
@@ -259,7 +259,7 @@ export function fallbackIsHighlighted(fallback) {
|
|
|
259
259
|
* render (`visibleFrames`). Off-screen frames are omitted — they flatten to exactly
|
|
260
260
|
* {@link buildRootFallback}'s plain output, so storing them would just duplicate
|
|
261
261
|
* `fallback` in the precompute. {@link promoteCriticalFallback} splices these back
|
|
262
|
-
* over the plain fallback for `
|
|
262
|
+
* over the plain fallback for `highlightAfter: 'init'` (paint highlighted on the first
|
|
263
263
|
* render, zero decompression). Frame indices count `span.frame` children only,
|
|
264
264
|
* matching `getInitialVisibleFrames`.
|
|
265
265
|
*
|
|
@@ -33,7 +33,7 @@ export function prepareInitialSource(props) {
|
|
|
33
33
|
const initialExpandedEnabled = initialExpanded === true;
|
|
34
34
|
|
|
35
35
|
// Fold each variant's staging `fallbackCritical` into its plain `fallback` up front
|
|
36
|
-
// (under `
|
|
36
|
+
// (under `highlightAfter: 'init'`, not `collapseToEmpty`), then strip it. The hoisted
|
|
37
37
|
// loading fallback is therefore already highlighted-visible — so the first paint is
|
|
38
38
|
// highlighted with no decompression — while the rest of this function (strip, hoist,
|
|
39
39
|
// window, compress) operates on a single `fallback` field with no awareness of the
|
|
@@ -4,7 +4,7 @@ type HighlightAfter = CodeHighlighterBaseProps<{}>['highlightAfter'];
|
|
|
4
4
|
* Resolve the staging `fallbackCritical` field at a server→client (or client-load)
|
|
5
5
|
* boundary, returning a clone of `code` ready to cross to the client:
|
|
6
6
|
*
|
|
7
|
-
* - **Promote** — under `
|
|
7
|
+
* - **Promote** — under `highlightAfter: 'init'` (and not `collapseToEmpty`), each
|
|
8
8
|
* variant whose `fallbackCritical` *and* plain `fallback` are both present has the
|
|
9
9
|
* sparse `fallbackCritical` diff spliced over its `fallback` (`promoteCriticalFallback`)
|
|
10
10
|
* — the visible frames become highlighted, the rest stay plain — so the first paint is
|
|
@@ -3,7 +3,7 @@ import { promoteCriticalFallback } from "./fallbackFormat.mjs";
|
|
|
3
3
|
* Resolve the staging `fallbackCritical` field at a server→client (or client-load)
|
|
4
4
|
* boundary, returning a clone of `code` ready to cross to the client:
|
|
5
5
|
*
|
|
6
|
-
* - **Promote** — under `
|
|
6
|
+
* - **Promote** — under `highlightAfter: 'init'` (and not `collapseToEmpty`), each
|
|
7
7
|
* variant whose `fallbackCritical` *and* plain `fallback` are both present has the
|
|
8
8
|
* sparse `fallbackCritical` diff spliced over its `fallback` (`promoteCriticalFallback`)
|
|
9
9
|
* — the visible frames become highlighted, the rest stay plain — so the first paint is
|
|
@@ -170,7 +170,7 @@ export type VariantCode = CodeMeta & {
|
|
|
170
170
|
* are byte-identical to `fallback`'s plain output, so storing them would just
|
|
171
171
|
* duplicate `fallback` in the precompute. Computed at load time (where the source is
|
|
172
172
|
* still a live `HastRoot`, so no decompression) and carried in precomputed payloads
|
|
173
|
-
* alongside `fallback`. Under `
|
|
173
|
+
* alongside `fallback`. Under `highlightAfter: 'init'` the server/client boundary
|
|
174
174
|
* `promoteCriticalFallback`s it over `fallback` so the first paint is highlighted with
|
|
175
175
|
* no client-side decompression, then deletes it: `fallbackCritical` must NEVER reach
|
|
176
176
|
* the `Content`/`ContentLoading` components. The promoted `fallback` has byte-identical
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-docs-infra",
|
|
3
|
-
"version": "0.12.1-canary.
|
|
3
|
+
"version": "0.12.1-canary.3",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "MUI Infra - internal documentation creation tools.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,9 +8,16 @@
|
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
10
10
|
"react-component",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"docs",
|
|
12
|
+
"code highlighting",
|
|
13
|
+
"syntax highlighting",
|
|
14
|
+
"typescript docs",
|
|
15
|
+
"live demos",
|
|
16
|
+
"code editor",
|
|
17
|
+
"local search",
|
|
18
|
+
"client-side search",
|
|
19
|
+
"markdown",
|
|
20
|
+
"next.js docs"
|
|
14
21
|
],
|
|
15
22
|
"repository": {
|
|
16
23
|
"type": "git",
|
|
@@ -768,5 +775,5 @@
|
|
|
768
775
|
"bin": {
|
|
769
776
|
"docs-infra": "./cli/index.mjs"
|
|
770
777
|
},
|
|
771
|
-
"gitSha": "
|
|
778
|
+
"gitSha": "b652e3d89b09d3c556f2b1df043b0dc9cbaf7a88"
|
|
772
779
|
}
|
package/useCode/Pre.mjs
CHANGED
|
@@ -244,7 +244,7 @@ export function Pre({
|
|
|
244
244
|
}) {
|
|
245
245
|
// Defer the decompressing `decodeHastSource` to a post-paint render ONLY when the
|
|
246
246
|
// first-paint `.fallback` is ALREADY highlighted — i.e. the promoted highlighted-visible
|
|
247
|
-
// fallback the server ships for `
|
|
247
|
+
// fallback the server ships for `highlightAfter: 'init'`. Then paint that highlighted
|
|
248
248
|
// fallback first (no decompression on the critical path) and swap in the full decoded
|
|
249
249
|
// tree after. When the fallback is plain — every other mode, including a late-mounted
|
|
250
250
|
// `'hydration'` block where `shouldHighlight` is also true on the first render — decode
|