@dreamlake/dockit 0.1.1

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.
Files changed (66) hide show
  1. package/dist/components/Callout.d.ts +11 -0
  2. package/dist/components/Callout.js +101 -0
  3. package/dist/components/ClientOnly.d.ts +4 -0
  4. package/dist/components/ClientOnly.js +11 -0
  5. package/dist/components/CodeBlock.d.ts +13 -0
  6. package/dist/components/CodeBlock.js +155 -0
  7. package/dist/components/DocFooter.d.ts +1 -0
  8. package/dist/components/DocFooter.js +63 -0
  9. package/dist/components/Preview.d.ts +16 -0
  10. package/dist/components/Preview.js +220 -0
  11. package/dist/components/SearchPalette.d.ts +8 -0
  12. package/dist/components/SearchPalette.js +678 -0
  13. package/dist/components/SearchResize.d.ts +11 -0
  14. package/dist/components/SearchResize.js +150 -0
  15. package/dist/components/Sidebar.d.ts +1 -0
  16. package/dist/components/Sidebar.js +134 -0
  17. package/dist/components/StatusTable.d.ts +19 -0
  18. package/dist/components/StatusTable.js +251 -0
  19. package/dist/components/TOC.d.ts +1 -0
  20. package/dist/components/TOC.js +674 -0
  21. package/dist/components/TabStrip.d.ts +8 -0
  22. package/dist/components/TabStrip.js +105 -0
  23. package/dist/components/ThemeProvider.d.ts +11 -0
  24. package/dist/components/ThemeProvider.js +40 -0
  25. package/dist/components/ThemeToggle.d.ts +2 -0
  26. package/dist/components/ThemeToggle.js +109 -0
  27. package/dist/components/Topbar.d.ts +9 -0
  28. package/dist/components/Topbar.js +818 -0
  29. package/dist/components/mdx-components.d.ts +30 -0
  30. package/dist/components/mdx-components.js +346 -0
  31. package/dist/index.d.ts +61 -0
  32. package/dist/index.js +81 -0
  33. package/dist/lib/navigation.d.ts +80 -0
  34. package/dist/lib/navigation.js +57 -0
  35. package/dist/lib/pagefind-search.d.ts +21 -0
  36. package/dist/lib/pagefind-search.js +201 -0
  37. package/dist/lib/search-index.d.ts +43 -0
  38. package/dist/lib/search-index.js +112 -0
  39. package/dist/lib/tabs.d.ts +23 -0
  40. package/dist/lib/tabs.js +30 -0
  41. package/dist/lib/use-hidden-toggle.d.ts +15 -0
  42. package/dist/lib/use-hidden-toggle.js +23 -0
  43. package/dist/lib/use-line-numbers.d.ts +9 -0
  44. package/dist/lib/use-line-numbers.js +7 -0
  45. package/dist/lib/use-local-storage.d.ts +15 -0
  46. package/dist/lib/use-local-storage.js +58 -0
  47. package/dist/lib/use-media-query.d.ts +5 -0
  48. package/dist/lib/use-media-query.js +16 -0
  49. package/dist/renderer/Layout.d.ts +5 -0
  50. package/dist/renderer/Layout.js +170 -0
  51. package/dist/renderer/onRenderClient.d.ts +1 -0
  52. package/dist/renderer/onRenderClient.js +23 -0
  53. package/dist/renderer/onRenderHtml.d.ts +5 -0
  54. package/dist/renderer/onRenderHtml.js +44 -0
  55. package/dist/site-config.d.ts +61 -0
  56. package/dist/site-config.js +21 -0
  57. package/dist/styles.css +310 -0
  58. package/dist/vike.d.ts +12 -0
  59. package/dist/vike.js +8 -0
  60. package/dist/vite.d.ts +2 -0
  61. package/dist/vite.js +80 -0
  62. package/package.json +82 -0
  63. package/templates/netlify.example.toml +33 -0
  64. package/templates/set-version.mjs +70 -0
  65. package/templates/version-branch.sh +16 -0
  66. package/templates/versions.example.json +15 -0
@@ -0,0 +1,818 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useRef, useState, useEffect, useLayoutEffect } from "react";
3
+ import { usePageContext } from "vike-react/usePageContext";
4
+ import { pages } from "../lib/navigation.js";
5
+ import { siteConfig } from "../site-config.js";
6
+ import { useMediaQuery } from "../lib/use-media-query.js";
7
+ import { useHiddenToggle } from "../lib/use-hidden-toggle.js";
8
+ import { ThemeToggle } from "./ThemeToggle.js";
9
+ import { useMerge } from "../renderer/Layout.js";
10
+ import { TabStrip } from "./TabStrip.js";
11
+ function HiddenRevealChip() {
12
+ const [show, setShow] = useHiddenToggle();
13
+ if (!show) return null;
14
+ return /* @__PURE__ */ jsx(
15
+ "button",
16
+ {
17
+ type: "button",
18
+ onClick: () => setShow(false),
19
+ "aria-label": "Dev mode on — hidden pages are visible. Click to hide again.",
20
+ title: "Dev mode on — hidden pages are visible (Cmd+Shift+D to toggle)",
21
+ style: {
22
+ display: "inline-flex",
23
+ alignItems: "center",
24
+ justifyContent: "center",
25
+ width: 16,
26
+ height: 16,
27
+ padding: 0,
28
+ border: 0,
29
+ background: "transparent",
30
+ cursor: "pointer"
31
+ },
32
+ children: /* @__PURE__ */ jsx(
33
+ "span",
34
+ {
35
+ "aria-hidden": true,
36
+ style: {
37
+ width: 8,
38
+ height: 8,
39
+ borderRadius: 999,
40
+ background: "var(--color-doc-template-warn)",
41
+ boxShadow: "0 0 0 3px var(--color-doc-template-warn-soft)"
42
+ }
43
+ }
44
+ )
45
+ }
46
+ );
47
+ }
48
+ function VersionBadge({
49
+ label,
50
+ version,
51
+ collapsed,
52
+ dropdown = false
53
+ }) {
54
+ const transition = `opacity 0.4s ease, transform 0.4s ${SPRING}, width 0.4s ${SPRING}, margin 0.4s ${SPRING}, padding 0.4s ${SPRING}`;
55
+ const [open, setOpen] = useState(false);
56
+ const [manifest, setManifest] = useState(null);
57
+ const [displayVersion, setDisplayVersion] = useState(version);
58
+ const wrapperRef = useRef(null);
59
+ useEffect(() => {
60
+ if (!dropdown) return;
61
+ let cancelled = false;
62
+ fetch("/versions.json").then((r) => r.ok ? r.json() : null).then((m) => {
63
+ if (!cancelled && m) setManifest(m);
64
+ }).catch(() => {
65
+ });
66
+ return () => {
67
+ cancelled = true;
68
+ };
69
+ }, [dropdown]);
70
+ useEffect(() => {
71
+ if (typeof window === "undefined") return;
72
+ const host = window.location.hostname;
73
+ const m = host.match(/^v(\d+(?:-\d+)+(?:[a-z]+\d+)?)\./i);
74
+ if (m) {
75
+ setDisplayVersion(m[1].replace(/-/g, "."));
76
+ } else if (host.startsWith("stable.") && manifest?.stable) {
77
+ setDisplayVersion(manifest.stable);
78
+ } else if (manifest?.current) {
79
+ setDisplayVersion(manifest.current);
80
+ }
81
+ }, [manifest]);
82
+ useEffect(() => {
83
+ if (!open) return;
84
+ function onDown(e) {
85
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) setOpen(false);
86
+ }
87
+ function onKey(e) {
88
+ if (e.key === "Escape") setOpen(false);
89
+ }
90
+ window.addEventListener("mousedown", onDown);
91
+ window.addEventListener("keydown", onKey);
92
+ return () => {
93
+ window.removeEventListener("mousedown", onDown);
94
+ window.removeEventListener("keydown", onKey);
95
+ };
96
+ }, [open]);
97
+ const labelSegStyle = {
98
+ padding: "2px 6px",
99
+ fontWeight: 600,
100
+ borderTopLeftRadius: 3,
101
+ borderBottomLeftRadius: 3
102
+ };
103
+ const versionSegStyle = {
104
+ padding: "2px 6px",
105
+ background: "color-mix(in srgb, var(--color-doc-template-ink) 5%, var(--color-doc-template-bg))",
106
+ fontWeight: 600,
107
+ borderTopRightRadius: 3,
108
+ borderBottomRightRadius: 3,
109
+ display: "inline-flex",
110
+ alignItems: "center",
111
+ gap: dropdown ? 4 : 0,
112
+ border: 0,
113
+ borderLeft: "1px solid var(--color-doc-template-faint)",
114
+ color: "inherit",
115
+ fontFamily: "inherit",
116
+ fontSize: "inherit",
117
+ letterSpacing: "inherit",
118
+ cursor: dropdown ? "pointer" : "default"
119
+ };
120
+ const wrapperBase = {
121
+ fontFamily: "var(--font-doc-template-mono)",
122
+ fontSize: 10,
123
+ fontWeight: 500,
124
+ letterSpacing: "0.02em",
125
+ marginLeft: 6,
126
+ borderRadius: 4,
127
+ transition,
128
+ ...collapsed ? {
129
+ opacity: 0,
130
+ transform: "translateX(-4px)",
131
+ pointerEvents: "none",
132
+ width: 0,
133
+ margin: 0,
134
+ padding: 0,
135
+ overflow: "hidden"
136
+ } : {}
137
+ };
138
+ const chevron = dropdown ? /* @__PURE__ */ jsx(
139
+ "svg",
140
+ {
141
+ width: "8",
142
+ height: "8",
143
+ viewBox: "0 0 24 24",
144
+ fill: "none",
145
+ stroke: "currentColor",
146
+ strokeWidth: "3",
147
+ strokeLinecap: "round",
148
+ strokeLinejoin: "round",
149
+ "aria-hidden": true,
150
+ style: {
151
+ opacity: 0.65,
152
+ transform: open ? "scaleY(-1)" : "none",
153
+ transition: "transform 0.22s ease"
154
+ },
155
+ children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6" })
156
+ }
157
+ ) : null;
158
+ return /* @__PURE__ */ jsxs(
159
+ "span",
160
+ {
161
+ ref: wrapperRef,
162
+ className: "hidden md:inline-flex items-stretch relative border border-doc-template-faint",
163
+ style: { ...wrapperBase, borderRadius: 4 },
164
+ title: dropdown ? void 0 : `${label} ${version}`,
165
+ children: [
166
+ /* @__PURE__ */ jsx(
167
+ "span",
168
+ {
169
+ className: "inline-flex items-center text-doc-template-muted",
170
+ style: labelSegStyle,
171
+ children: label
172
+ }
173
+ ),
174
+ dropdown ? /* @__PURE__ */ jsxs(
175
+ "button",
176
+ {
177
+ type: "button",
178
+ onClick: () => setOpen((o) => !o),
179
+ "aria-haspopup": "listbox",
180
+ "aria-expanded": open,
181
+ title: `Switch ${label} version (current v${displayVersion})`,
182
+ className: "text-doc-template-ink hover:bg-doc-template-search",
183
+ style: versionSegStyle,
184
+ children: [
185
+ "v",
186
+ displayVersion,
187
+ chevron
188
+ ]
189
+ }
190
+ ) : /* @__PURE__ */ jsxs(
191
+ "span",
192
+ {
193
+ className: "inline-flex items-center text-doc-template-ink",
194
+ style: versionSegStyle,
195
+ children: [
196
+ "v",
197
+ displayVersion
198
+ ]
199
+ }
200
+ ),
201
+ dropdown && open && manifest && (() => {
202
+ const aliasEntries = manifest.aliases ? Object.entries(manifest.aliases) : [];
203
+ const versionEntries = manifest.versions ?? [];
204
+ const ENTRY_STEP = 0.03;
205
+ const ENTRY_BASE = 0.13;
206
+ let idx = 0;
207
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
208
+ /* @__PURE__ */ jsxs(
209
+ "svg",
210
+ {
211
+ width: "14",
212
+ height: "11",
213
+ viewBox: "0 0 14 11",
214
+ "aria-hidden": true,
215
+ style: {
216
+ position: "absolute",
217
+ top: "calc(100% + 4.5px)",
218
+ right: 4,
219
+ zIndex: 81,
220
+ display: "block",
221
+ pointerEvents: "none",
222
+ animation: "popover-wedge-in 0.24s ease both"
223
+ },
224
+ children: [
225
+ /* @__PURE__ */ jsx("path", { d: "M0 11 L7 1 L14 11", stroke: "var(--color-doc-template-faint)", strokeWidth: "1", fill: "none" }),
226
+ /* @__PURE__ */ jsx("path", { d: "M1 11 L7 2 L13 11 Z", fill: "var(--color-doc-template-bg)" })
227
+ ]
228
+ }
229
+ ),
230
+ /* @__PURE__ */ jsxs(
231
+ "div",
232
+ {
233
+ role: "listbox",
234
+ "aria-label": `Past ${label} versions`,
235
+ className: "absolute border border-doc-template-faint bg-doc-template-bg",
236
+ style: {
237
+ top: "calc(100% + 14px)",
238
+ left: 0,
239
+ minWidth: 220,
240
+ maxHeight: "min(360px, 60vh)",
241
+ overflowY: "auto",
242
+ borderRadius: 12,
243
+ // Drop shadow + a "negative" 0-blur shadow above using the page bg
244
+ // color: it paints a bg-colored band into the strip between the
245
+ // popover top and the navbar's bottom border, masking the navbar's
246
+ // 1px box-shadow in the popover's column so the two don't visually
247
+ // collide.
248
+ boxShadow: "0 6px 24px rgb(0 0 0 / 0.10), 0 -5px 3px 0 var(--color-doc-template-bg)",
249
+ padding: 4,
250
+ zIndex: 80,
251
+ fontFamily: "var(--font-doc-template-mono)",
252
+ fontSize: 11,
253
+ animation: "popover-in 0.28s ease both",
254
+ animationDelay: "0.04s",
255
+ transformOrigin: "top right"
256
+ },
257
+ children: [
258
+ aliasEntries.length > 0 && /* @__PURE__ */ jsx(
259
+ "div",
260
+ {
261
+ style: {
262
+ padding: "4px 6px 2px",
263
+ opacity: 0.55,
264
+ fontSize: 9,
265
+ letterSpacing: "0.08em",
266
+ textTransform: "uppercase",
267
+ animation: "popover-entry-in 0.28s ease both",
268
+ animationDelay: `${ENTRY_BASE + idx++ * ENTRY_STEP}s`
269
+ },
270
+ children: "Aliases"
271
+ }
272
+ ),
273
+ aliasEntries.map(([name, url]) => /* @__PURE__ */ jsxs(
274
+ "a",
275
+ {
276
+ href: url,
277
+ className: "block text-doc-template-ink no-underline hover:bg-doc-template-search",
278
+ style: {
279
+ padding: "5px 8px",
280
+ borderRadius: 8,
281
+ animation: "popover-entry-in 0.28s ease both",
282
+ animationDelay: `${ENTRY_BASE + idx++ * ENTRY_STEP}s`
283
+ },
284
+ children: [
285
+ name,
286
+ name === "stable" && manifest.stable && /* @__PURE__ */ jsxs("span", { style: { opacity: 0.5, marginLeft: 6 }, children: [
287
+ "v",
288
+ manifest.stable
289
+ ] })
290
+ ]
291
+ },
292
+ `alias-${name}`
293
+ )),
294
+ versionEntries.length > 0 && /* @__PURE__ */ jsx(
295
+ "div",
296
+ {
297
+ style: {
298
+ padding: "6px 6px 2px",
299
+ opacity: 0.55,
300
+ fontSize: 9,
301
+ letterSpacing: "0.08em",
302
+ textTransform: "uppercase",
303
+ animation: "popover-entry-in 0.28s ease both",
304
+ animationDelay: `${ENTRY_BASE + idx++ * ENTRY_STEP}s`
305
+ },
306
+ children: "Versions"
307
+ }
308
+ ),
309
+ versionEntries.map((v) => {
310
+ const isCurrent = v.version === manifest.current;
311
+ return /* @__PURE__ */ jsxs(
312
+ "a",
313
+ {
314
+ href: v.url,
315
+ className: "text-doc-template-ink no-underline hover:bg-doc-template-search flex items-baseline justify-between gap-3",
316
+ style: {
317
+ padding: "5px 8px",
318
+ borderRadius: 8,
319
+ fontWeight: isCurrent ? 700 : 400,
320
+ background: isCurrent ? "color-mix(in srgb, var(--color-doc-template-accent) 12%, transparent)" : void 0,
321
+ animation: "popover-entry-in 0.28s ease both",
322
+ animationDelay: `${ENTRY_BASE + idx++ * ENTRY_STEP}s`
323
+ },
324
+ children: [
325
+ /* @__PURE__ */ jsxs("span", { children: [
326
+ "v",
327
+ v.version,
328
+ isCurrent && /* @__PURE__ */ jsx("span", { style: { opacity: 0.55, marginLeft: 6 }, children: "current" })
329
+ ] }),
330
+ v.date && /* @__PURE__ */ jsx("span", { style: { opacity: 0.5, fontVariantNumeric: "tabular-nums", fontSize: 10 }, children: v.date })
331
+ ]
332
+ },
333
+ v.version
334
+ );
335
+ })
336
+ ]
337
+ }
338
+ )
339
+ ] });
340
+ })()
341
+ ]
342
+ }
343
+ );
344
+ }
345
+ const SPRING = "cubic-bezier(0.4, 0.7, 0.3, 1)";
346
+ const EXPAND_EASE = "cubic-bezier(0.16, 1, 0.3, 1)";
347
+ const EXPAND_MS = 320;
348
+ const CLOSED_WIDTH_XL = 320;
349
+ const CLOSED_WIDTH_LG = 260;
350
+ const CLOSED_WIDTH_MD = 180;
351
+ const ICON_BUTTON_SIZE = 28;
352
+ const SEARCH_MAX_W = 860;
353
+ const SEARCH_GUTTER = 24;
354
+ const SEARCH_INSET = `max(${SEARCH_GUTTER}px, calc((100vw - ${SEARCH_MAX_W}px) / 2))`;
355
+ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
356
+ const { urlPathname } = usePageContext();
357
+ const current = pages.find((p) => p.path === urlPathname);
358
+ const inputRef = useRef(null);
359
+ const labelRef = useRef(null);
360
+ const focusTimerRef = useRef(null);
361
+ const closedRectRef = useRef(null);
362
+ const [isMac, setIsMac] = useState(false);
363
+ const merged = useMerge();
364
+ const isMobile = useMediaQuery("(max-width: 767px)");
365
+ const isBelowLg = useMediaQuery("(max-width: 1023px)");
366
+ const isLgUp = useMediaQuery("(min-width: 1024px)");
367
+ const isXlUp = useMediaQuery("(min-width: 1280px)");
368
+ useEffect(() => {
369
+ setIsMac(/Mac|iPod|iPhone|iPad/.test(navigator.platform));
370
+ }, []);
371
+ useEffect(() => {
372
+ function onKey(e) {
373
+ const mod = isMac ? e.metaKey : e.ctrlKey;
374
+ if (mod && e.key.toLowerCase() === "k") {
375
+ e.preventDefault();
376
+ inputRef.current?.focus();
377
+ onOpenSearch();
378
+ } else if (e.key === "/" && !(e.target instanceof HTMLInputElement) && !(e.target instanceof HTMLTextAreaElement)) {
379
+ e.preventDefault();
380
+ inputRef.current?.focus();
381
+ onOpenSearch();
382
+ }
383
+ }
384
+ window.addEventListener("keydown", onKey);
385
+ return () => window.removeEventListener("keydown", onKey);
386
+ }, [isMac, onOpenSearch]);
387
+ function clearFocusTimer() {
388
+ if (focusTimerRef.current !== null) {
389
+ window.clearTimeout(focusTimerRef.current);
390
+ focusTimerRef.current = null;
391
+ }
392
+ }
393
+ function onInputFocus() {
394
+ if (searchOpen) return;
395
+ clearFocusTimer();
396
+ focusTimerRef.current = window.setTimeout(() => {
397
+ if (document.activeElement === inputRef.current) onOpenSearch();
398
+ focusTimerRef.current = null;
399
+ }, 1e3);
400
+ }
401
+ function onInputBlur() {
402
+ clearFocusTimer();
403
+ }
404
+ function onInputChange(e) {
405
+ setQuery(e.target.value);
406
+ if (!searchOpen) {
407
+ clearFocusTimer();
408
+ onOpenSearch();
409
+ }
410
+ }
411
+ function onInputKeyDown(e) {
412
+ if (e.key === "Escape" && searchOpen) {
413
+ e.preventDefault();
414
+ onCloseSearch();
415
+ inputRef.current?.blur();
416
+ }
417
+ }
418
+ useEffect(() => {
419
+ if (!searchOpen && labelRef.current) {
420
+ closedRectRef.current = labelRef.current.getBoundingClientRect();
421
+ }
422
+ });
423
+ useLayoutEffect(() => {
424
+ if (!searchOpen) return;
425
+ const el = labelRef.current;
426
+ const first = closedRectRef.current;
427
+ if (!el || !first) return;
428
+ const last = el.getBoundingClientRect();
429
+ el.style.transition = "none";
430
+ el.style.left = `${first.left}px`;
431
+ el.style.width = `${first.width}px`;
432
+ el.style.right = "auto";
433
+ void el.offsetWidth;
434
+ el.style.transition = [
435
+ `left ${EXPAND_MS}ms ${EXPAND_EASE}`,
436
+ `width ${EXPAND_MS}ms ${EXPAND_EASE}`,
437
+ "background 0.2s ease",
438
+ "border-color 0.2s ease",
439
+ "box-shadow 0.2s ease"
440
+ ].join(", ");
441
+ el.style.left = `${last.left}px`;
442
+ el.style.width = `${last.width}px`;
443
+ const openInset = isMobile ? "12px" : SEARCH_INSET;
444
+ const tid = setTimeout(() => {
445
+ el.style.left = openInset;
446
+ el.style.right = openInset;
447
+ el.style.width = "";
448
+ el.style.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`;
449
+ }, EXPAND_MS + 20);
450
+ return () => clearTimeout(tid);
451
+ }, [searchOpen, isMobile]);
452
+ const collapsedStyle = (collapsed) => ({
453
+ transition: `opacity 0.25s ease, transform 0.25s ${SPRING}, width 0.25s ${SPRING}, margin 0.25s ${SPRING}, padding 0.25s ${SPRING}`,
454
+ ...collapsed ? {
455
+ opacity: 0,
456
+ transform: "translateX(-4px)",
457
+ pointerEvents: "none",
458
+ width: 0,
459
+ margin: 0,
460
+ padding: 0,
461
+ overflow: "hidden"
462
+ } : {}
463
+ });
464
+ const palFade = (hidden) => ({
465
+ opacity: hidden ? 0 : 1,
466
+ pointerEvents: hidden ? "none" : "auto",
467
+ transition: "opacity 0.25s ease"
468
+ });
469
+ const iconButtonMode = isBelowLg && !searchOpen;
470
+ const closedWidth = isXlUp ? CLOSED_WIDTH_XL : isLgUp ? CLOSED_WIDTH_LG : CLOSED_WIDTH_MD;
471
+ const searchStyle = iconButtonMode ? {
472
+ // In-flow grid item — sits at the end of column 2 next to TabStrip.
473
+ // Square footprint, icon-only, click opens the palette directly.
474
+ gridColumn: 2,
475
+ gridRow: 1,
476
+ justifySelf: "end",
477
+ width: ICON_BUTTON_SIZE,
478
+ maxWidth: ICON_BUTTON_SIZE,
479
+ flexShrink: 0,
480
+ height: ICON_BUTTON_SIZE,
481
+ padding: 0,
482
+ borderRadius: 8,
483
+ marginRight: 4,
484
+ display: "inline-flex",
485
+ alignItems: "center",
486
+ justifyContent: "center",
487
+ gap: 0,
488
+ transition: `width ${EXPAND_MS}ms ${EXPAND_EASE}, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease`
489
+ } : isMobile && searchOpen ? {
490
+ position: "fixed",
491
+ top: 6,
492
+ left: 12,
493
+ right: 12,
494
+ height: 28,
495
+ padding: "6px 10px",
496
+ borderRadius: 12,
497
+ zIndex: 71,
498
+ gridArea: "auto",
499
+ placeSelf: "stretch",
500
+ boxShadow: "0 4px 14px rgb(0 0 0 / 0.06)",
501
+ 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`
502
+ } : searchOpen ? {
503
+ position: "fixed",
504
+ top: 6,
505
+ left: SEARCH_INSET,
506
+ right: SEARCH_INSET,
507
+ height: 28,
508
+ padding: "6px 10px",
509
+ borderRadius: 12,
510
+ zIndex: 71,
511
+ gridArea: "auto",
512
+ placeSelf: "stretch",
513
+ boxShadow: "0 4px 14px rgb(0 0 0 / 0.06)",
514
+ 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`
515
+ } : {
516
+ gridColumn: 2,
517
+ gridRow: 1,
518
+ justifySelf: "end",
519
+ width: closedWidth,
520
+ maxWidth: closedWidth,
521
+ flexShrink: 0,
522
+ height: 28,
523
+ padding: "6px 10px",
524
+ borderRadius: 12,
525
+ marginRight: 8,
526
+ transition: `width ${EXPAND_MS}ms ${EXPAND_EASE}, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease`
527
+ };
528
+ return /* @__PURE__ */ jsxs(
529
+ "header",
530
+ {
531
+ className: "sticky top-0 z-50 grid grid-cols-[auto_minmax(0,1fr)_auto] items-center w-full m-0 py-1",
532
+ style: {
533
+ height: 40,
534
+ // Backdrop blur creates a stacking context; we keep it ON when
535
+ // closed (frosted topbar look) and turn it OFF while the palette
536
+ // is open so the now-transparent topbar doesn't blur the
537
+ // dropdown sitting just below it.
538
+ backdropFilter: searchOpen ? "none" : "saturate(140%) blur(8px)",
539
+ WebkitBackdropFilter: searchOpen ? "none" : "saturate(140%) blur(8px)",
540
+ background: searchOpen ? "transparent" : "var(--color-doc-template-bg)",
541
+ boxShadow: searchOpen ? "none" : "0 1px 0 var(--color-doc-template-faint)",
542
+ transition: "background 0.25s ease, box-shadow 0.25s ease"
543
+ },
544
+ children: [
545
+ /* @__PURE__ */ jsxs(
546
+ "a",
547
+ {
548
+ href: "/",
549
+ className: "flex items-center gap-2.5 pl-[14px] md:pl-[18px] no-underline text-doc-template-ink hover:opacity-80 min-w-[72px] shrink-0",
550
+ style: {
551
+ fontFamily: "var(--font-doc-template-ui)",
552
+ fontSize: 14,
553
+ fontWeight: 700,
554
+ letterSpacing: "-0.04em",
555
+ transition: "opacity 0.15s ease, color 0.25s ease",
556
+ ...palFade(searchOpen)
557
+ },
558
+ children: [
559
+ /* @__PURE__ */ jsxs("span", { children: [
560
+ siteConfig.brand,
561
+ /* @__PURE__ */ jsx(
562
+ "span",
563
+ {
564
+ "aria-hidden": true,
565
+ className: "text-doc-template-accent",
566
+ style: { fontWeight: 700, fontSize: "1.4em", lineHeight: 0, marginLeft: 1, verticalAlign: "baseline" },
567
+ children: "."
568
+ }
569
+ )
570
+ ] }),
571
+ /* @__PURE__ */ jsx(
572
+ "span",
573
+ {
574
+ className: "hidden md:inline text-doc-template-muted",
575
+ style: { fontWeight: 400, opacity: 0.55, marginLeft: -4, marginRight: -4, ...collapsedStyle(merged) },
576
+ children: "/"
577
+ }
578
+ ),
579
+ /* @__PURE__ */ jsx(
580
+ "span",
581
+ {
582
+ className: "hidden md:inline text-doc-template-muted",
583
+ style: { fontWeight: 500, letterSpacing: "-0.01em", ...collapsedStyle(merged) },
584
+ children: siteConfig.subtitle
585
+ }
586
+ ),
587
+ (siteConfig.versionChips ?? []).map((chip) => /* @__PURE__ */ jsx(
588
+ VersionBadge,
589
+ {
590
+ label: chip.label,
591
+ version: chip.version,
592
+ collapsed: merged,
593
+ dropdown: chip.dropdown
594
+ },
595
+ chip.label
596
+ )),
597
+ siteConfig.gitHash && /* @__PURE__ */ jsxs(
598
+ "span",
599
+ {
600
+ className: "hidden md:inline-flex items-center text-doc-template-muted border border-doc-template-faint",
601
+ style: {
602
+ fontFamily: "var(--font-doc-template-mono)",
603
+ fontSize: 10,
604
+ fontWeight: 500,
605
+ letterSpacing: "0.02em",
606
+ marginLeft: 6,
607
+ gap: 5,
608
+ padding: "2px 7px",
609
+ borderRadius: 4,
610
+ ...collapsedStyle(merged)
611
+ },
612
+ title: `git ${siteConfig.gitHash}`,
613
+ children: [
614
+ /* @__PURE__ */ jsxs(
615
+ "svg",
616
+ {
617
+ viewBox: "0 0 24 24",
618
+ fill: "none",
619
+ stroke: "currentColor",
620
+ strokeWidth: "2.5",
621
+ strokeLinecap: "round",
622
+ strokeLinejoin: "round",
623
+ "aria-hidden": true,
624
+ style: { width: 9, height: 9, opacity: 0.8, flexShrink: 0 },
625
+ children: [
626
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "3" }),
627
+ /* @__PURE__ */ jsx("circle", { cx: "6", cy: "6", r: "3" }),
628
+ /* @__PURE__ */ jsx("path", { d: "M6 9v6" }),
629
+ /* @__PURE__ */ jsx("path", { d: "M18 9a9 9 0 0 1-9 9" })
630
+ ]
631
+ }
632
+ ),
633
+ siteConfig.gitHash
634
+ ]
635
+ }
636
+ )
637
+ ]
638
+ }
639
+ ),
640
+ current && /* @__PURE__ */ jsxs(
641
+ "nav",
642
+ {
643
+ "aria-label": "Breadcrumb",
644
+ className: "hidden md:flex items-center gap-1.5 text-doc-template-muted uppercase pointer-events-none overflow-hidden",
645
+ style: {
646
+ gridColumn: 2,
647
+ gridRow: 1,
648
+ justifySelf: "start",
649
+ marginLeft: 8,
650
+ fontFamily: "var(--font-doc-template-mono)",
651
+ fontSize: 10,
652
+ fontWeight: 500,
653
+ letterSpacing: "0.04em",
654
+ whiteSpace: "nowrap",
655
+ opacity: searchOpen ? 0 : merged ? 1 : 0,
656
+ transform: merged && !searchOpen ? "translateY(0)" : "translateY(6px)",
657
+ transition: `opacity 0.25s ease, transform 0.25s ${SPRING}`
658
+ },
659
+ children: [
660
+ siteConfig.breadcrumbRoot && /* @__PURE__ */ jsxs(Fragment, { children: [
661
+ /* @__PURE__ */ jsx("span", { children: siteConfig.breadcrumbRoot }),
662
+ /* @__PURE__ */ jsx("span", { style: { opacity: 0.5 }, children: "/" })
663
+ ] }),
664
+ current.section && /* @__PURE__ */ jsxs(Fragment, { children: [
665
+ /* @__PURE__ */ jsx("span", { children: current.section }),
666
+ /* @__PURE__ */ jsx("span", { style: { opacity: 0.5 }, children: "/" })
667
+ ] }),
668
+ /* @__PURE__ */ jsx("span", { className: "text-doc-template-ink", children: current.title })
669
+ ]
670
+ }
671
+ ),
672
+ /* @__PURE__ */ jsxs(
673
+ "div",
674
+ {
675
+ style: {
676
+ gridColumn: 2,
677
+ gridRow: 1,
678
+ display: "flex",
679
+ alignItems: "center",
680
+ justifyContent: "flex-end",
681
+ gap: isMobile ? 8 : 14,
682
+ minWidth: 0
683
+ },
684
+ children: [
685
+ /* @__PURE__ */ jsx("div", { className: "flex items-stretch", style: palFade(searchOpen), children: /* @__PURE__ */ jsx(TabStrip, {}) }),
686
+ /* @__PURE__ */ jsxs(
687
+ "label",
688
+ {
689
+ ref: labelRef,
690
+ htmlFor: "doc-search-input",
691
+ onClick: iconButtonMode ? (e) => {
692
+ if (e.target instanceof HTMLInputElement) return;
693
+ e.preventDefault();
694
+ onOpenSearch();
695
+ requestAnimationFrame(() => inputRef.current?.focus());
696
+ } : void 0,
697
+ "aria-label": iconButtonMode ? "Open search" : void 0,
698
+ role: iconButtonMode ? "button" : void 0,
699
+ className: searchOpen ? "flex items-center gap-2 max-w-full bg-doc-template-search border border-doc-template-faint cursor-text" : iconButtonMode ? "flex items-center justify-center max-w-full bg-transparent border border-transparent text-doc-template-muted hover:bg-doc-template-search hover:text-doc-template-ink cursor-pointer" : "flex items-center gap-2 max-w-full bg-doc-template-search border border-transparent focus-within:border-doc-template-accent/50 cursor-text",
700
+ style: searchStyle,
701
+ children: [
702
+ /* @__PURE__ */ jsxs(
703
+ "svg",
704
+ {
705
+ viewBox: "0 0 24 24",
706
+ fill: "none",
707
+ stroke: "currentColor",
708
+ strokeWidth: "2",
709
+ strokeLinecap: "round",
710
+ strokeLinejoin: "round",
711
+ "aria-hidden": true,
712
+ className: iconButtonMode ? "shrink-0" : "text-doc-template-muted shrink-0",
713
+ style: { width: 14, height: 14, transition: "color 0.15s ease" },
714
+ children: [
715
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
716
+ /* @__PURE__ */ jsx("path", { d: "M21 21l-4.3-4.3" })
717
+ ]
718
+ }
719
+ ),
720
+ /* @__PURE__ */ jsx(
721
+ "input",
722
+ {
723
+ ref: inputRef,
724
+ id: "doc-search-input",
725
+ type: "text",
726
+ placeholder: "Search docs…",
727
+ autoComplete: "off",
728
+ value: query,
729
+ onChange: onInputChange,
730
+ onFocus: onInputFocus,
731
+ onBlur: onInputBlur,
732
+ onKeyDown: onInputKeyDown,
733
+ className: "flex-1 appearance-none border-0 outline-0 bg-transparent text-doc-template-ink min-w-0 placeholder:text-doc-template-muted placeholder:opacity-70",
734
+ style: {
735
+ fontFamily: "var(--font-doc-template-ui)",
736
+ fontSize: 13,
737
+ letterSpacing: "-0.005em",
738
+ ...iconButtonMode ? {
739
+ width: 0,
740
+ minWidth: 0,
741
+ flex: "0 0 0",
742
+ padding: 0,
743
+ margin: 0,
744
+ opacity: 0,
745
+ pointerEvents: "none"
746
+ } : {}
747
+ },
748
+ tabIndex: iconButtonMode ? -1 : 0
749
+ }
750
+ ),
751
+ !iconButtonMode && /* @__PURE__ */ jsx(
752
+ "span",
753
+ {
754
+ className: "hidden md:inline-flex font-medium text-doc-template-muted border border-doc-template-faint bg-doc-template-bg items-center",
755
+ style: {
756
+ fontFamily: "var(--font-doc-template-mono)",
757
+ fontSize: 10,
758
+ opacity: 0.8,
759
+ padding: "1px 5px",
760
+ borderRadius: 4
761
+ },
762
+ children: isMac ? "⌘K" : "Ctrl K"
763
+ }
764
+ )
765
+ ]
766
+ }
767
+ )
768
+ ]
769
+ }
770
+ ),
771
+ /* @__PURE__ */ jsx(
772
+ "div",
773
+ {
774
+ className: "flex items-stretch gap-2.5 md:gap-3.5 pr-[14px] md:pr-[22px]",
775
+ style: { gridColumn: 3, gridRow: 1, justifySelf: "end", ...palFade(searchOpen) },
776
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3.5", children: [
777
+ siteConfig.repoUrl && /* @__PURE__ */ jsx(
778
+ "a",
779
+ {
780
+ href: siteConfig.repoUrl,
781
+ target: "_blank",
782
+ rel: "noreferrer",
783
+ "aria-label": "GitHub",
784
+ title: "GitHub",
785
+ className: "hidden lg:inline-flex font-medium text-doc-template-muted no-underline items-center justify-center hover:text-doc-template-ink",
786
+ style: {
787
+ fontFamily: "var(--font-doc-template-ui)",
788
+ fontSize: 12.5,
789
+ lineHeight: 1,
790
+ letterSpacing: "-0.005em",
791
+ transition: "color 0.15s ease"
792
+ },
793
+ children: /* @__PURE__ */ jsx(
794
+ "svg",
795
+ {
796
+ width: "16",
797
+ height: "16",
798
+ viewBox: "0 0 24 24",
799
+ fill: "currentColor",
800
+ "aria-hidden": true,
801
+ style: { display: "block" },
802
+ children: /* @__PURE__ */ jsx("path", { d: "M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.1.79-.25.79-.56v-2c-3.2.7-3.87-1.36-3.87-1.36-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.75 2.69 1.25 3.34.95.1-.74.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.7 0-1.26.45-2.29 1.18-3.1-.12-.29-.51-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.05 11.05 0 015.78 0c2.2-1.49 3.18-1.18 3.18-1.18.62 1.59.23 2.76.11 3.05.74.81 1.18 1.84 1.18 3.1 0 4.43-2.7 5.4-5.27 5.69.41.36.78 1.06.78 2.14v3.17c0 .31.21.67.8.56C20.21 21.39 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5z" })
803
+ }
804
+ )
805
+ }
806
+ ),
807
+ /* @__PURE__ */ jsx(HiddenRevealChip, {}),
808
+ /* @__PURE__ */ jsx(ThemeToggle, {})
809
+ ] })
810
+ }
811
+ )
812
+ ]
813
+ }
814
+ );
815
+ }
816
+ export {
817
+ Topbar
818
+ };