@dreamlake/dockit 0.2.8 → 0.2.9
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.
|
@@ -35,6 +35,7 @@ const ICON_BUTTON_SIZE = 28;
|
|
|
35
35
|
const SEARCH_MAX_W = 860;
|
|
36
36
|
const SEARCH_GUTTER = 24;
|
|
37
37
|
const SEARCH_INSET = `max(${SEARCH_GUTTER}px, calc((100vw - ${SEARCH_MAX_W}px) / 2))`;
|
|
38
|
+
const TABS_EDGE_MAX_W = 420;
|
|
38
39
|
function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
39
40
|
const { urlPathname } = usePageContext();
|
|
40
41
|
const current = findPage(urlPathname);
|
|
@@ -152,6 +153,31 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
152
153
|
transition: "opacity 0.25s ease"
|
|
153
154
|
});
|
|
154
155
|
const iconButtonMode = isBelowLg && !searchOpen;
|
|
156
|
+
const clusterRef = useRef(null);
|
|
157
|
+
const tabsRef = useRef(null);
|
|
158
|
+
const actionsRef = useRef(null);
|
|
159
|
+
const [tabsFit, setTabsFit] = useState(false);
|
|
160
|
+
useLayoutEffect(() => {
|
|
161
|
+
const tabsEl = tabsRef.current;
|
|
162
|
+
if (!tabsEl) return;
|
|
163
|
+
const measure = () => {
|
|
164
|
+
const tabsW = tabsEl.getBoundingClientRect().width;
|
|
165
|
+
const inset = Math.max(SEARCH_GUTTER, (window.innerWidth - SEARCH_MAX_W) / 2);
|
|
166
|
+
const actions = actionsRef.current?.getBoundingClientRect();
|
|
167
|
+
const actionsW = actions ? window.innerWidth - actions.left : 0;
|
|
168
|
+
setTabsFit(tabsW > 0 && tabsW <= TABS_EDGE_MAX_W && inset >= actionsW + 16);
|
|
169
|
+
};
|
|
170
|
+
measure();
|
|
171
|
+
const ro = new ResizeObserver(measure);
|
|
172
|
+
ro.observe(tabsEl);
|
|
173
|
+
if (actionsRef.current) ro.observe(actionsRef.current);
|
|
174
|
+
window.addEventListener("resize", measure);
|
|
175
|
+
return () => {
|
|
176
|
+
ro.disconnect();
|
|
177
|
+
window.removeEventListener("resize", measure);
|
|
178
|
+
};
|
|
179
|
+
}, []);
|
|
180
|
+
const edgeAligned = isLgUp && !iconButtonMode && !searchOpen && tabsFit;
|
|
155
181
|
const closedWidth = isXlUp ? CLOSED_WIDTH_XL : isLgUp ? CLOSED_WIDTH_LG : CLOSED_WIDTH_MD;
|
|
156
182
|
const searchStyle = iconButtonMode ? {
|
|
157
183
|
// In-flow grid item — sits at the end of column 2 next to TabStrip.
|
|
@@ -357,9 +383,16 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
357
383
|
/* @__PURE__ */ jsxs(
|
|
358
384
|
"div",
|
|
359
385
|
{
|
|
386
|
+
ref: clusterRef,
|
|
360
387
|
style: {
|
|
361
|
-
|
|
362
|
-
|
|
388
|
+
...edgeAligned ? {
|
|
389
|
+
position: "fixed",
|
|
390
|
+
top: 0,
|
|
391
|
+
right: SEARCH_INSET,
|
|
392
|
+
height: 40,
|
|
393
|
+
gridArea: "auto",
|
|
394
|
+
placeSelf: "stretch"
|
|
395
|
+
} : { gridColumn: 2, gridRow: 1 },
|
|
363
396
|
display: "flex",
|
|
364
397
|
alignItems: "center",
|
|
365
398
|
justifyContent: "flex-end",
|
|
@@ -367,7 +400,15 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
367
400
|
minWidth: 0
|
|
368
401
|
},
|
|
369
402
|
children: [
|
|
370
|
-
/* @__PURE__ */ jsx(
|
|
403
|
+
/* @__PURE__ */ jsx(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
ref: tabsRef,
|
|
407
|
+
className: "flex items-stretch",
|
|
408
|
+
style: { ...palFade(searchOpen), order: edgeAligned ? 1 : 0 },
|
|
409
|
+
children: /* @__PURE__ */ jsx(TabStrip, {})
|
|
410
|
+
}
|
|
411
|
+
),
|
|
371
412
|
/* @__PURE__ */ jsxs(
|
|
372
413
|
"label",
|
|
373
414
|
{
|
|
@@ -456,6 +497,7 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
456
497
|
/* @__PURE__ */ jsx(
|
|
457
498
|
"div",
|
|
458
499
|
{
|
|
500
|
+
ref: actionsRef,
|
|
459
501
|
className: "flex items-stretch gap-2.5 md:gap-3.5 pr-[14px] md:pr-[22px]",
|
|
460
502
|
style: { gridColumn: 3, gridRow: 1, justifySelf: "end", ...palFade(searchOpen) },
|
|
461
503
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3.5", children: [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dockit",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "The DreamLake documentation shell
|
|
3
|
+
"version": "0.2.9",
|
|
4
|
+
"description": "The DreamLake documentation shell — Vike + React + Tailwind v4 + MDX docs framework with sidebar, TOC, search, and theming",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
},
|
|
38
38
|
"./styles.css": "./dist/styles.css"
|
|
39
39
|
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "vite build",
|
|
42
|
-
"typecheck": "tsc --noEmit"
|
|
43
|
-
},
|
|
44
40
|
"peerDependencies": {
|
|
45
41
|
"@mdx-js/react": ">=3.0.0",
|
|
46
42
|
"react": ">=19.0.0",
|
|
@@ -79,5 +75,9 @@
|
|
|
79
75
|
"vite": "^7.0.0",
|
|
80
76
|
"vite-plugin-dts": "^4.3.0",
|
|
81
77
|
"tailwindcss": "^4.0.0"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "vite build",
|
|
81
|
+
"typecheck": "tsc --noEmit"
|
|
82
82
|
}
|
|
83
|
-
}
|
|
83
|
+
}
|
|
File without changes
|
|
File without changes
|