@dreamlake/dockit 0.2.5 → 0.2.7

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.
@@ -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
- (siteConfig.versionChips ?? []).map((chip) => /* @__PURE__ */ jsx(
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 load = origin ? fetch(`${origin}/versions.json`).then((r) => r.ok ? r.json() : Promise.reject(new Error(String(r.status)))).catch(sameOrigin) : sameOrigin();
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(() => {
@@ -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. */
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dockit",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
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",
@@ -39,11 +39,12 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@mdx-js/react": ">=3.0.0",
42
- "react": "^19.0.0",
43
- "react-dom": "^19.0.0",
42
+ "react": ">=19.0.0",
43
+ "react-dom": ">=19.0.0",
44
44
  "vike": "^0.4.210",
45
45
  "vike-react": "^0.5.0",
46
- "vite": ">=6.0.0"
46
+ "vite": ">=6.0.0",
47
+ "tailwindcss": "^4.0.0"
47
48
  },
48
49
  "peerDependenciesMeta": {
49
50
  "vite": {
@@ -59,21 +60,21 @@
59
60
  "remark-frontmatter": "^5.0.0",
60
61
  "remark-gfm": "^4.0.0",
61
62
  "remark-mdx-frontmatter": "^5.2.0",
62
- "shiki": "^1.24.0",
63
- "tailwindcss": "^4.0.0"
63
+ "shiki": "^1.24.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@mdx-js/react": "^3.1.0",
67
67
  "@types/node": "^22.20.1",
68
- "@types/react": "^19.0.0",
69
- "@types/react-dom": "^19.0.0",
70
- "react": "^19.0.0",
71
- "react-dom": "^19.0.0",
68
+ "@types/react": "latest",
69
+ "@types/react-dom": "latest",
70
+ "react": "latest",
71
+ "react-dom": "latest",
72
72
  "typescript": "^5.7.0",
73
73
  "vike": "^0.4.210",
74
74
  "vike-react": "^0.5.0",
75
75
  "vite": "^7.0.0",
76
- "vite-plugin-dts": "^4.3.0"
76
+ "vite-plugin-dts": "^4.3.0",
77
+ "tailwindcss": "^4.0.0"
77
78
  },
78
79
  "scripts": {
79
80
  "build": "vite build",