@dreamlake/dockit 0.2.10 → 0.2.11

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.
@@ -160,6 +160,7 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
160
160
  const [tabsFit, setTabsFit] = useState(false);
161
161
  const [tabsW, setTabsW] = useState(0);
162
162
  const [pinLeft, setPinLeft] = useState(0);
163
+ const [searchPinRight, setSearchPinRight] = useState(null);
163
164
  useLayoutEffect(() => {
164
165
  const tabsEl = tabsRef.current;
165
166
  if (!tabsEl) return;
@@ -167,16 +168,24 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
167
168
  const measure = () => {
168
169
  const w = tabsEl.getBoundingClientRect().width;
169
170
  const rect = content?.getBoundingClientRect();
170
- const textLeft = rect ? rect.left + parseFloat(getComputedStyle(content).paddingLeft) : Math.max(SEARCH_GUTTER, (window.innerWidth - SEARCH_MAX_W) / 2);
171
+ const cs = content ? getComputedStyle(content) : null;
172
+ const fallbackInset = Math.max(SEARCH_GUTTER, (window.innerWidth - SEARCH_MAX_W) / 2);
173
+ const textLeft = rect ? rect.left + parseFloat(cs.paddingLeft) : fallbackInset;
174
+ const textRight = rect ? rect.right - parseFloat(cs.paddingRight) : window.innerWidth - fallbackInset;
171
175
  const pin = textLeft - 10;
172
176
  const brand = brandRef.current?.getBoundingClientRect();
173
177
  if (brand) brandMaxRight.current = Math.max(brandMaxRight.current, brand.right);
174
178
  const brandClear = brandMaxRight.current + 16 <= pin;
175
179
  const actions = actionsRef.current?.getBoundingClientRect();
176
- const searchLeft = (actions ? actions.left : window.innerWidth) - 8 - closedWidth;
180
+ const actionsLeft = actions ? actions.left : window.innerWidth;
181
+ const pinnedSearchLeft = textRight - closedWidth;
182
+ const packedSearchLeft = actionsLeft - 8 - closedWidth;
183
+ const fits = (searchLeft) => w > 0 && brandClear && pin + w + 16 <= searchLeft;
184
+ const fullPin = textRight + 16 <= actionsLeft && fits(pinnedSearchLeft);
177
185
  setTabsW(w);
178
186
  setPinLeft(pin);
179
- setTabsFit(w > 0 && brandClear && pin + w + 16 <= searchLeft);
187
+ setSearchPinRight(fullPin ? window.innerWidth - textRight : null);
188
+ setTabsFit(fullPin || fits(packedSearchLeft));
180
189
  };
181
190
  measure();
182
191
  const ro = new ResizeObserver(measure);
@@ -235,6 +244,22 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
235
244
  placeSelf: "stretch",
236
245
  boxShadow: "0 4px 14px rgb(0 0 0 / 0.06)",
237
246
  transition: `left ${EXPAND_MS}ms ${EXPAND_EASE}, right ${EXPAND_MS}ms ${EXPAND_EASE}, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease`
247
+ } : searchPinRight != null ? {
248
+ // Closed, right-aligned to the content column's right
249
+ // edge (mirrors the pinned tab strip on the left edge).
250
+ // (gridArea/placeSelf: see the note above about
251
+ // fixed-positioned grid items.)
252
+ position: "fixed",
253
+ top: 6,
254
+ right: searchPinRight,
255
+ width: closedWidth,
256
+ maxWidth: closedWidth,
257
+ height: 28,
258
+ padding: "6px 10px",
259
+ borderRadius: 12,
260
+ gridArea: "auto",
261
+ placeSelf: "stretch",
262
+ transition: `width ${EXPAND_MS}ms ${EXPAND_EASE}, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease`
238
263
  } : {
239
264
  gridColumn: 2,
240
265
  gridRow: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dockit",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
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",