@veluai/velu 0.2.11 → 0.2.13
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/package.json +1 -1
- package/src/runtime/App.jsx +11 -2
package/package.json
CHANGED
package/src/runtime/App.jsx
CHANGED
|
@@ -913,15 +913,24 @@ function DocsPage() {
|
|
|
913
913
|
if (!header) return;
|
|
914
914
|
const root = document.documentElement;
|
|
915
915
|
const remPx = parseFloat(getComputedStyle(root).fontSize) || 16;
|
|
916
|
+
// Skip same-value writes: these CSS vars affect layout, and an
|
|
917
|
+
// unconditional write on every ResizeObserver fire can feed back into
|
|
918
|
+
// layout (scrollbar appear/disappear flutter at narrow widths — observed
|
|
919
|
+
// as a permanent relayout storm inside the instant-preview iframe).
|
|
920
|
+
let lastHeaderH = -1;
|
|
921
|
+
let lastTocBarH = -1;
|
|
916
922
|
const apply = () => {
|
|
917
|
-
const headerH = header.getBoundingClientRect().height;
|
|
923
|
+
const headerH = Math.round(header.getBoundingClientRect().height);
|
|
918
924
|
// Re-query each apply — the TocBar toggle button is mounted
|
|
919
925
|
// after first paint and its parent may also remount on
|
|
920
926
|
// theme/viewport changes.
|
|
921
927
|
const tocBarToggle = document.querySelector('.velu-toc-bar__toggle');
|
|
922
928
|
const tocBarH = tocBarToggle
|
|
923
|
-
? tocBarToggle.getBoundingClientRect().height
|
|
929
|
+
? Math.round(tocBarToggle.getBoundingClientRect().height)
|
|
924
930
|
: 0;
|
|
931
|
+
if (headerH === lastHeaderH && tocBarH === lastTocBarH) return;
|
|
932
|
+
lastHeaderH = headerH;
|
|
933
|
+
lastTocBarH = tocBarH;
|
|
925
934
|
if (headerH > 0)
|
|
926
935
|
root.style.setProperty('--velu-header-height', `${headerH}px`);
|
|
927
936
|
root.style.setProperty('--velu-tocbar-height', `${tocBarH}px`);
|