@dreamlake/dockit 0.2.6 → 0.2.8
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/dist/components/TabStrip.js +18 -2
- package/dist/components/Topbar.js +4 -1
- package/dist/components/VersionBadge.js +3 -1
- package/dist/lib/tabs.d.ts +4 -0
- package/dist/site-config.d.ts +4 -1
- package/package.json +7 -7
- package/templates/set-version.mjs +0 -0
- package/templates/version-branch.sh +0 -0
|
@@ -51,7 +51,22 @@ function TabStrip() {
|
|
|
51
51
|
ref: containerRef,
|
|
52
52
|
"aria-label": "Documentation sections",
|
|
53
53
|
className: "flex items-stretch relative m-0 p-0 list-none",
|
|
54
|
-
style: {
|
|
54
|
+
style: {
|
|
55
|
+
height: "100%",
|
|
56
|
+
// Labels never wrap. A second line would grow this row and push
|
|
57
|
+
// the topbar past its fixed 40px, so each tab keeps its
|
|
58
|
+
// intrinsic width (`shrink-0` on the <li>) and the strip clips
|
|
59
|
+
// whatever no longer fits rather than reflowing.
|
|
60
|
+
//
|
|
61
|
+
// `clip`, not `hidden`: the underbar below sits at bottom:-13px,
|
|
62
|
+
// deliberately outside this box. Setting `overflow-x: hidden`
|
|
63
|
+
// makes CSS compute the still-`visible` overflow-y to `auto`,
|
|
64
|
+
// which would clip that bar away (and risk a stray scrollbar).
|
|
65
|
+
// `clip` is the one overflow value that leaves the other axis
|
|
66
|
+
// genuinely visible.
|
|
67
|
+
overflowX: "clip",
|
|
68
|
+
overflowY: "visible"
|
|
69
|
+
},
|
|
55
70
|
onMouseLeave: () => setHovered(null),
|
|
56
71
|
children: [
|
|
57
72
|
visibleTabs.map((tab) => {
|
|
@@ -59,7 +74,7 @@ function TabStrip() {
|
|
|
59
74
|
return /* @__PURE__ */ jsx(
|
|
60
75
|
"li",
|
|
61
76
|
{
|
|
62
|
-
className: "flex items-stretch",
|
|
77
|
+
className: "flex items-stretch shrink-0",
|
|
63
78
|
onMouseEnter: () => setHovered(tab.id),
|
|
64
79
|
children: /* @__PURE__ */ jsx(
|
|
65
80
|
"a",
|
|
@@ -76,6 +91,7 @@ function TabStrip() {
|
|
|
76
91
|
fontWeight: 600,
|
|
77
92
|
letterSpacing: "0.12em",
|
|
78
93
|
textTransform: "uppercase",
|
|
94
|
+
whiteSpace: "nowrap",
|
|
79
95
|
color: isActive || hovered === tab.id ? "var(--color-doc-template-ink)" : "var(--color-doc-template-muted)",
|
|
80
96
|
cursor: "pointer",
|
|
81
97
|
transition: "color 0.18s ease"
|
|
@@ -10,6 +10,7 @@ import { ThemeToggle } from "./ThemeToggle.js";
|
|
|
10
10
|
import { VersionBadge } from "./VersionBadge.js";
|
|
11
11
|
import { useMerge } from "../renderer/Layout.js";
|
|
12
12
|
import { TabStrip } from "./TabStrip.js";
|
|
13
|
+
import { TABS, tabForUrl } from "../lib/tabs.js";
|
|
13
14
|
function HiddenRevealChip() {
|
|
14
15
|
const [show, setShow] = useHiddenToggle();
|
|
15
16
|
if (!show) return null;
|
|
@@ -37,6 +38,8 @@ const SEARCH_INSET = `max(${SEARCH_GUTTER}px, calc((100vw - ${SEARCH_MAX_W}px) /
|
|
|
37
38
|
function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
38
39
|
const { urlPathname } = usePageContext();
|
|
39
40
|
const current = findPage(urlPathname);
|
|
41
|
+
const activeTab = TABS.find((t) => t.id === tabForUrl(urlPathname));
|
|
42
|
+
const versionChips = activeTab?.versionChips ?? siteConfig.versionChips ?? [];
|
|
40
43
|
const inputRef = useRef(null);
|
|
41
44
|
const labelRef = useRef(null);
|
|
42
45
|
const focusTimerRef = useRef(null);
|
|
@@ -266,7 +269,7 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
266
269
|
children: siteConfig.subtitle
|
|
267
270
|
}
|
|
268
271
|
),
|
|
269
|
-
|
|
272
|
+
versionChips.map((chip) => /* @__PURE__ */ jsx(
|
|
270
273
|
VersionBadge,
|
|
271
274
|
{
|
|
272
275
|
label: chip.label,
|
|
@@ -17,8 +17,10 @@ function VersionBadge({
|
|
|
17
17
|
if (!dropdown) return;
|
|
18
18
|
let cancelled = false;
|
|
19
19
|
const origin = (siteConfig.url || "").replace(/\/+$/, "");
|
|
20
|
+
const isLocal = typeof window !== "undefined" && /^(localhost|127\.|0\.0\.0\.0)/.test(window.location.hostname);
|
|
20
21
|
const sameOrigin = () => fetch("/versions.json").then((r) => r.ok ? r.json() : null);
|
|
21
|
-
const
|
|
22
|
+
const fromOrigin = () => fetch(`${origin}/versions.json`).then((r) => r.ok ? r.json() : Promise.reject(new Error(String(r.status))));
|
|
23
|
+
const load = !origin ? sameOrigin() : isLocal ? sameOrigin().then((m) => m ?? fromOrigin().catch(() => null)) : fromOrigin().catch(sameOrigin);
|
|
22
24
|
load.then((m) => {
|
|
23
25
|
if (!cancelled && m) setManifest(m);
|
|
24
26
|
}).catch(() => {
|
package/dist/lib/tabs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VersionChip } from '../site-config';
|
|
1
2
|
export interface TabDef {
|
|
2
3
|
id: string;
|
|
3
4
|
label: string;
|
|
@@ -8,6 +9,9 @@ export interface TabDef {
|
|
|
8
9
|
/** URL prefix that scopes pages to this tab. A page belongs to a tab
|
|
9
10
|
* iff its path starts with this prefix (or equals `/` for the first tab). */
|
|
10
11
|
urlPrefix: string;
|
|
12
|
+
/** Per-tab override of `site.versionChips`. Omit to inherit the global
|
|
13
|
+
* chips; set to `[]` to show none on this tab. */
|
|
14
|
+
versionChips?: VersionChip[];
|
|
11
15
|
}
|
|
12
16
|
/** Module-level singleton, populated by `initTabs()`. Mutated in place —
|
|
13
17
|
* never reassigned — so importing components keep a live reference. */
|
package/dist/site-config.d.ts
CHANGED
|
@@ -47,7 +47,10 @@ export interface SiteConfig {
|
|
|
47
47
|
* deploys"). When unset, the generator falls back to the site's section
|
|
48
48
|
* names. */
|
|
49
49
|
skillTriggers?: string[];
|
|
50
|
-
/** Version chips rendered next to the brand in the topbar.
|
|
50
|
+
/** Version chips rendered next to the brand in the topbar. Individual
|
|
51
|
+
* top-level tabs can override this list via `TabDef.versionChips` — a tab
|
|
52
|
+
* omitting the field inherits these global chips, `[]` shows none on that
|
|
53
|
+
* tab, and a non-empty array replaces them for that tab only. */
|
|
51
54
|
versionChips?: VersionChip[];
|
|
52
55
|
/** Short git hash chip in the topbar. Omit to hide the chip. */
|
|
53
56
|
gitHash?: string;
|
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.8",
|
|
4
|
+
"description": "The DreamLake documentation shell \u2014 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,6 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"./styles.css": "./dist/styles.css"
|
|
39
39
|
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "vite build",
|
|
42
|
+
"typecheck": "tsc --noEmit"
|
|
43
|
+
},
|
|
40
44
|
"peerDependencies": {
|
|
41
45
|
"@mdx-js/react": ">=3.0.0",
|
|
42
46
|
"react": ">=19.0.0",
|
|
@@ -75,9 +79,5 @@
|
|
|
75
79
|
"vite": "^7.0.0",
|
|
76
80
|
"vite-plugin-dts": "^4.3.0",
|
|
77
81
|
"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
|