@takazudo/zudo-doc 0.2.0-next.5 → 0.2.0-next.6
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.
|
@@ -44,14 +44,52 @@ interface HtmlPreviewWrapperProps {
|
|
|
44
44
|
defaultOpen?: boolean;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* HTML preview
|
|
47
|
+
* Bare HTML preview body — the actual island **hydration target**.
|
|
48
48
|
*
|
|
49
|
-
* Merges `settings.htmlPreview`
|
|
50
|
-
* forwards everything to `<HtmlPreview>`.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
49
|
+
* Merges global (`settings.htmlPreview`) config with per-usage props and
|
|
50
|
+
* forwards everything to `<HtmlPreview>`. Renders the preview tree
|
|
51
|
+
* **directly**: it does NOT wrap itself in `<Island>`. `HtmlPreviewWrapper`
|
|
52
|
+
* below applies the `<Island when="visible">` wrapper around it.
|
|
53
|
+
*
|
|
54
|
+
* ## Island invariant (read before touching the displayName / Island wiring)
|
|
55
|
+
*
|
|
56
|
+
* The hydration-target export's NAME must equal its `displayName` (which
|
|
57
|
+
* becomes the `data-zfb-island="…"` marker), AND that export must NOT itself
|
|
58
|
+
* render an `<Island>`. The zfb scanner resolves the client hydration
|
|
59
|
+
* component by marker-name → export-name lookup; if the resolved export
|
|
60
|
+
* re-wraps in `Island()`, the client re-emits a second `data-zfb-island`
|
|
61
|
+
* wrapper and Preact reuses the SSR'd children one level off — re-parenting
|
|
62
|
+
* the preview + code sections inside the flex title bar (the broken
|
|
63
|
+
* side-by-side layout). This is the same class of bug fixed for
|
|
64
|
+
* Toc / MobileToc / Sidebar in zudolab/zudo-doc#1355 and was the original
|
|
65
|
+
* defect here (zudolab/zudo-doc#1925, an Astro→zfb migration regression):
|
|
66
|
+
* the inner bare component carried the *outer* wrapper's name
|
|
67
|
+
* (`displayName = "HtmlPreviewWrapper"`) and was not exported, so the marker
|
|
68
|
+
* resolved to the exported self-wrapping `HtmlPreviewWrapper` and the client
|
|
69
|
+
* double-wrapped. Fix: the bare component carries its OWN name
|
|
70
|
+
* (`HtmlPreviewWrapperInner`) and is exported, so the marker resolves to
|
|
71
|
+
* THIS bare component and the bundle hydrates it in-place.
|
|
72
|
+
*/
|
|
73
|
+
declare function HtmlPreviewWrapperInner(props: HtmlPreviewWrapperProps): VNode;
|
|
74
|
+
declare namespace HtmlPreviewWrapperInner {
|
|
75
|
+
var displayName: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* HTML preview wrapper component — the public MDX-registered binding
|
|
79
|
+
* (`HtmlPreview: HtmlPreviewWrapper`).
|
|
80
|
+
*
|
|
81
|
+
* Wraps the bare `HtmlPreviewWrapperInner` in `<Island when="visible">`,
|
|
82
|
+
* mirroring the legacy `client:visible` hydration timing — the iframe is
|
|
83
|
+
* heavy and not on the critical path, so hydration is deferred until the
|
|
84
|
+
* preview enters the viewport. The SSG output emits
|
|
85
|
+
* `data-zfb-island="HtmlPreviewWrapperInner"` around the bare tree, and the
|
|
86
|
+
* client bundle hydrates `HtmlPreviewWrapperInner` against it in-place.
|
|
87
|
+
*
|
|
88
|
+
* The public export name and signature are unchanged from before the
|
|
89
|
+
* zudolab/zudo-doc#1925 fix, so existing consumers that register
|
|
90
|
+
* `HtmlPreview: HtmlPreviewWrapper` keep working (and now hydrate correctly)
|
|
91
|
+
* with no call-site change.
|
|
54
92
|
*/
|
|
55
93
|
declare function HtmlPreviewWrapper(props: HtmlPreviewWrapperProps): VNode;
|
|
56
94
|
|
|
57
|
-
export { type HtmlPreviewGlobalConfig, HtmlPreviewWrapper, type HtmlPreviewWrapperProps };
|
|
95
|
+
export { type HtmlPreviewGlobalConfig, HtmlPreviewWrapper, HtmlPreviewWrapperInner, type HtmlPreviewWrapperProps };
|
|
@@ -23,7 +23,7 @@ function HtmlPreviewWrapperInner(props) {
|
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
HtmlPreviewWrapperInner.displayName = "
|
|
26
|
+
HtmlPreviewWrapperInner.displayName = "HtmlPreviewWrapperInner";
|
|
27
27
|
function HtmlPreviewWrapper(props) {
|
|
28
28
|
const rendered = Island({
|
|
29
29
|
when: "visible",
|
|
@@ -32,5 +32,6 @@ function HtmlPreviewWrapper(props) {
|
|
|
32
32
|
return rendered;
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
35
|
-
HtmlPreviewWrapper
|
|
35
|
+
HtmlPreviewWrapper,
|
|
36
|
+
HtmlPreviewWrapperInner
|
|
36
37
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { HtmlPreviewGlobalConfig, HtmlPreviewWrapper, HtmlPreviewWrapperProps } from './html-preview-wrapper.js';
|
|
1
|
+
export { HtmlPreviewGlobalConfig, HtmlPreviewWrapper, HtmlPreviewWrapperInner, HtmlPreviewWrapperProps } from './html-preview-wrapper.js';
|
|
2
2
|
export { HtmlPreview, HtmlPreviewProps } from './html-preview.js';
|
|
3
3
|
export { CodeBlockData, PreviewBase, PreviewBaseProps } from './preview-base.js';
|
|
4
4
|
export { HighlightedCode, HighlightedCodeProps } from './highlighted-code.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
HtmlPreviewWrapper
|
|
2
|
+
HtmlPreviewWrapper,
|
|
3
|
+
HtmlPreviewWrapperInner
|
|
3
4
|
} from "./html-preview-wrapper.js";
|
|
4
5
|
import { HtmlPreview } from "./html-preview.js";
|
|
5
6
|
import { PreviewBase } from "./preview-base.js";
|
|
@@ -8,5 +9,6 @@ export {
|
|
|
8
9
|
HighlightedCode,
|
|
9
10
|
HtmlPreview,
|
|
10
11
|
HtmlPreviewWrapper,
|
|
12
|
+
HtmlPreviewWrapperInner,
|
|
11
13
|
PreviewBase
|
|
12
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zudo-doc",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"@takazudo/zfb": "^0.1.0-next.31",
|
|
162
162
|
"@takazudo/zfb-runtime": "^0.1.0-next.31",
|
|
163
163
|
"@takazudo/zdtp": "^0.2.0-next.2",
|
|
164
|
-
"@takazudo/zudo-doc-history-server": "^0.2.0-next.
|
|
164
|
+
"@takazudo/zudo-doc-history-server": "^0.2.0-next.6"
|
|
165
165
|
},
|
|
166
166
|
"peerDependenciesMeta": {
|
|
167
167
|
"@takazudo/zudo-doc-history-server": {
|