@dreamlake/dockit 0.2.0 → 0.2.2

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.
@@ -1,11 +1,20 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useRef, useState, useLayoutEffect } from "react";
2
+ import { useMemo, useRef, useState, useLayoutEffect } from "react";
3
3
  import { usePageContext } from "vike-react/usePageContext";
4
- import { tabForUrl, TABS } from "../lib/tabs.js";
4
+ import { tabForUrl, TABS, urlInTab } from "../lib/tabs.js";
5
+ import { pages } from "../lib/navigation.js";
6
+ import { useHiddenToggle } from "../lib/use-hidden-toggle.js";
5
7
  const SPRING = "cubic-bezier(0.4, 0.7, 0.3, 1)";
6
8
  function TabStrip() {
7
9
  const { urlPathname } = usePageContext();
8
10
  const activeTab = tabForUrl(urlPathname);
11
+ const [showHidden] = useHiddenToggle();
12
+ const visibleTabs = useMemo(() => {
13
+ if (showHidden) return TABS;
14
+ return TABS.filter(
15
+ (tab) => tab.id === activeTab || pages.some((p) => !p.hidden && urlInTab(p.path, tab.id))
16
+ );
17
+ }, [showHidden, activeTab]);
9
18
  const containerRef = useRef(null);
10
19
  const linkRefs = useRef({});
11
20
  const [hovered, setHovered] = useState(null);
@@ -35,7 +44,7 @@ function TabStrip() {
35
44
  window.addEventListener("resize", onResize);
36
45
  return () => window.removeEventListener("resize", onResize);
37
46
  }, [targetTab]);
38
- if (TABS.length === 0) return null;
47
+ if (visibleTabs.length === 0) return null;
39
48
  return /* @__PURE__ */ jsxs(
40
49
  "ol",
41
50
  {
@@ -45,7 +54,7 @@ function TabStrip() {
45
54
  style: { height: "100%" },
46
55
  onMouseLeave: () => setHovered(null),
47
56
  children: [
48
- TABS.map((tab) => {
57
+ visibleTabs.map((tab) => {
49
58
  const isActive = tab.id === activeTab;
50
59
  return /* @__PURE__ */ jsx(
51
60
  "li",
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useState, useContext, createContext, useEffect } from "react";
2
+ import { useState, useMemo, useContext, createContext, useEffect } from "react";
3
3
  import { MDXProvider } from "@mdx-js/react";
4
4
  import { usePageContext } from "vike-react/usePageContext";
5
5
  import { ThemeProvider } from "../components/ThemeProvider.js";
@@ -117,7 +117,14 @@ function Layout({ children }) {
117
117
  const [searchQuery, setSearchQuery] = useState("");
118
118
  const [merged, setMerged] = useState(false);
119
119
  const [sidebarOpen, setSidebarOpen] = useState(false);
120
- return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(MDXProvider, { components: mdxComponents, children: /* @__PURE__ */ jsxs(MergeContext.Provider, { value: merged, children: [
120
+ const mergedMdxComponents = useMemo(
121
+ () => ({
122
+ ...mdxComponents,
123
+ ...siteConfig.mdxComponents ?? {}
124
+ }),
125
+ []
126
+ );
127
+ return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(MDXProvider, { components: mergedMdxComponents, children: /* @__PURE__ */ jsxs(MergeContext.Provider, { value: merged, children: [
121
128
  /* @__PURE__ */ jsx(
122
129
  Topbar,
123
130
  {
@@ -59,6 +59,11 @@ export interface SiteConfig {
59
59
  * that steps light → system → dark; `'segmented'` is the three-button
60
60
  * slider with a sliding indicator (the uikit/dreamlake docs style). */
61
61
  themeToggle?: 'cycle' | 'segmented';
62
+ /** Site-specific MDX components merged over the library's provider map,
63
+ * so pages can use custom tags (e.g. `<Card>`, `<ApiStatus>`) without
64
+ * per-page imports. Same-name entries override the library's. Typed
65
+ * loosely to avoid coupling this module to React. */
66
+ mdxComponents?: Record<string, unknown>;
62
67
  }
63
68
  export declare const siteConfig: SiteConfig;
64
69
  /** Merge site-provided values into the singleton (mutates in place). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dockit",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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",