@next-library/theme 1.0.6 → 1.0.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/client.js +127 -88
- package/dist/client.js.map +1 -1
- package/dist/components/navigation/navbar/mobile-menu.d.ts.map +1 -1
- package/dist/components/navigation/sidebar-left/sidebar.d.ts +7 -1
- package/dist/components/navigation/sidebar-left/sidebar.d.ts.map +1 -1
- package/dist/components/navigation/sidebar-right/github-contributors.d.ts.map +1 -1
- package/dist/index.js +127 -88
- package/dist/index.js.map +1 -1
- package/dist/lib/mobile-menu-store.d.ts +3 -0
- package/dist/lib/mobile-menu-store.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navbar/mobile-menu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE;QACb,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,YAAiB,EAAE,EAAE,eAAe,kDAuD1E"}
|
|
@@ -4,10 +4,16 @@ interface SidebarNavigationProps {
|
|
|
4
4
|
nodes: SidebarNode[];
|
|
5
5
|
currentPath?: string;
|
|
6
6
|
language?: Locale;
|
|
7
|
+
/**
|
|
8
|
+
* Called when a leaf page (a node with no children) is clicked. The mobile
|
|
9
|
+
* menu uses this to close the drawer once the user reaches an actual page,
|
|
10
|
+
* while folder navigations that only drill down leave the menu open.
|
|
11
|
+
*/
|
|
12
|
+
onNavigateLeaf?: () => void;
|
|
7
13
|
translations?: {
|
|
8
14
|
toggleFolder?: string;
|
|
9
15
|
};
|
|
10
16
|
}
|
|
11
|
-
export declare function SidebarNavigation({ nodes, currentPath, language: _language, translations, }: SidebarNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function SidebarNavigation({ nodes, currentPath, language: _language, onNavigateLeaf, translations, }: SidebarNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
12
18
|
export {};
|
|
13
19
|
//# sourceMappingURL=sidebar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar-left/sidebar.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAUtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE;QACb,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAsBD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,QAAQ,EAAE,SAAgB,EAC1B,YAAiB,GAClB,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar-left/sidebar.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAUtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAsBD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,QAAQ,EAAE,SAAgB,EAC1B,cAAc,EACd,YAAiB,GAClB,EAAE,sBAAsB,2CAyGxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-contributors.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar-right/github-contributors.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,UAAU,uBAAuB;IAC/B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE;QACb,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,UAAU,EACV,MAAM,EACN,YAAiB,GAClB,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"github-contributors.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar-right/github-contributors.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,UAAU,uBAAuB;IAC/B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE;QACb,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,UAAU,EACV,MAAM,EACN,YAAiB,GAClB,EAAE,uBAAuB,kDAuDzB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React8 from 'react';
|
|
2
|
-
import React8__default, { Suspense, useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import React8__default, { Suspense, useState, useRef, useEffect, useCallback, useMemo, useSyncExternalStore } from 'react';
|
|
3
3
|
import { Logo, TopCategories, SearchBar, GithubLink, ThemeSwitcher, LanguageSwitcher, MobileMenu, GithubStar, ReadingProgress, Banner, CookieBanner, SidebarNavigation, GithubContributors, TableOfContents, CopyPageButton } from '@next-library/theme/client';
|
|
4
4
|
import { FALLBACK_LOCALES, getDirection, getTopCategories, getSupportedLocales, getLocaleConfig, LOCALES_CONFIG } from '@next-library/core';
|
|
5
5
|
export { extractLocaleFromPathname, extractPageData, getLocaleFromParams } from '@next-library/core';
|
|
@@ -3351,7 +3351,7 @@ function StickyBanner({
|
|
|
3351
3351
|
locale = "en",
|
|
3352
3352
|
closeLabel
|
|
3353
3353
|
}) {
|
|
3354
|
-
const [
|
|
3354
|
+
const [open2, setOpen] = useState(true);
|
|
3355
3355
|
const { scrollY } = useScroll();
|
|
3356
3356
|
const translations2 = getTranslations(locale);
|
|
3357
3357
|
const ariaLabel = closeLabel || translations2.closeBanner;
|
|
@@ -3374,8 +3374,8 @@ function StickyBanner({
|
|
|
3374
3374
|
opacity: 0
|
|
3375
3375
|
},
|
|
3376
3376
|
animate: {
|
|
3377
|
-
y:
|
|
3378
|
-
opacity:
|
|
3377
|
+
y: open2 ? 0 : -100,
|
|
3378
|
+
opacity: open2 ? 1 : 0
|
|
3379
3379
|
},
|
|
3380
3380
|
transition: {
|
|
3381
3381
|
duration: 0.3,
|
|
@@ -3393,7 +3393,7 @@ function StickyBanner({
|
|
|
3393
3393
|
scale: 1
|
|
3394
3394
|
},
|
|
3395
3395
|
className: "absolute top-1/2 right-2 -translate-y-1/2 cursor-pointer",
|
|
3396
|
-
onClick: () => setOpen(!
|
|
3396
|
+
onClick: () => setOpen(!open2),
|
|
3397
3397
|
"aria-label": ariaLabel,
|
|
3398
3398
|
children: /* @__PURE__ */ jsx(CloseIcon, { className: "h-5 w-5 text-white", "aria-hidden": "true" })
|
|
3399
3399
|
}
|
|
@@ -3545,7 +3545,7 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3545
3545
|
const router = useRouter();
|
|
3546
3546
|
const translations2 = getTranslations(language);
|
|
3547
3547
|
const [mounted, setMounted] = useState(false);
|
|
3548
|
-
const [
|
|
3548
|
+
const [open2, setOpen] = useState(false);
|
|
3549
3549
|
const [query, setQuery] = useState("");
|
|
3550
3550
|
const [results, setResults] = useState([]);
|
|
3551
3551
|
const [recent, setRecent] = useState([]);
|
|
@@ -3592,7 +3592,7 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3592
3592
|
return () => window.removeEventListener("keydown", onKey);
|
|
3593
3593
|
}, [isMac]);
|
|
3594
3594
|
useEffect(() => {
|
|
3595
|
-
if (!
|
|
3595
|
+
if (!open2) return;
|
|
3596
3596
|
setRecent(readRecent());
|
|
3597
3597
|
const t = setTimeout(() => inputRef.current?.focus(), 20);
|
|
3598
3598
|
const prev = document.body.style.overflow;
|
|
@@ -3601,9 +3601,9 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3601
3601
|
clearTimeout(t);
|
|
3602
3602
|
document.body.style.overflow = prev;
|
|
3603
3603
|
};
|
|
3604
|
-
}, [
|
|
3604
|
+
}, [open2]);
|
|
3605
3605
|
useEffect(() => {
|
|
3606
|
-
if (!
|
|
3606
|
+
if (!open2) return;
|
|
3607
3607
|
if (!query.trim()) {
|
|
3608
3608
|
setResults([]);
|
|
3609
3609
|
setIsLoading(false);
|
|
@@ -3624,10 +3624,10 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3624
3624
|
}
|
|
3625
3625
|
}, 180);
|
|
3626
3626
|
return () => clearTimeout(id2);
|
|
3627
|
-
}, [query, language,
|
|
3628
|
-
const flat = query.trim() ? results : [];
|
|
3627
|
+
}, [query, language, open2]);
|
|
3628
|
+
const flat = useMemo(() => query.trim() ? results : [], [query, results]);
|
|
3629
3629
|
useEffect(() => {
|
|
3630
|
-
if (!
|
|
3630
|
+
if (!open2) return;
|
|
3631
3631
|
const onKey = (e) => {
|
|
3632
3632
|
if (e.key === "Escape") {
|
|
3633
3633
|
e.preventDefault();
|
|
@@ -3646,7 +3646,7 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3646
3646
|
};
|
|
3647
3647
|
window.addEventListener("keydown", onKey);
|
|
3648
3648
|
return () => window.removeEventListener("keydown", onKey);
|
|
3649
|
-
}, [
|
|
3649
|
+
}, [open2, flat, selected, close, go]);
|
|
3650
3650
|
useEffect(() => {
|
|
3651
3651
|
const node = listRef.current?.querySelector('[data-selected="true"]');
|
|
3652
3652
|
node?.scrollIntoView({ block: "nearest" });
|
|
@@ -3673,7 +3673,7 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3673
3673
|
]
|
|
3674
3674
|
}
|
|
3675
3675
|
);
|
|
3676
|
-
const modal =
|
|
3676
|
+
const modal = open2 && mounted ? createPortal(
|
|
3677
3677
|
/* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[100] flex items-start justify-center p-4 pt-[12vh]", role: "dialog", "aria-modal": "true", children: [
|
|
3678
3678
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/70 backdrop-blur-sm", onClick: close, "aria-hidden": "true" }),
|
|
3679
3679
|
/* @__PURE__ */ jsx("div", { className: "cl-beam relative w-full max-w-xl shadow-[0_30px_90px_-24px_rgb(0_0_0/0.55)]", children: /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-[calc(var(--radius)+2px)] bg-popover", children: [
|
|
@@ -3711,11 +3711,7 @@ function SearchBar2({ language = "en", className }) {
|
|
|
3711
3711
|
] }) : /* @__PURE__ */ jsx("p", { className: "px-2 py-8 text-center text-sm text-muted-foreground", children: translations2.searchPlaceholder }) : isLoading && !flat.length ? /* @__PURE__ */ jsxs("p", { className: "px-2 py-8 text-center text-sm text-muted-foreground", children: [
|
|
3712
3712
|
translations2.search,
|
|
3713
3713
|
"..."
|
|
3714
|
-
] }) : !flat.length ? /* @__PURE__ */
|
|
3715
|
-
'No results for "',
|
|
3716
|
-
query,
|
|
3717
|
-
'"'
|
|
3718
|
-
] }) : Object.entries(groups).map(([section, items]) => /* @__PURE__ */ jsxs("div", { className: "mb-1", children: [
|
|
3714
|
+
] }) : !flat.length ? /* @__PURE__ */ jsx("p", { className: "px-2 py-8 text-center text-sm text-muted-foreground", children: `No results for "${query}"` }) : Object.entries(groups).map(([section, items]) => /* @__PURE__ */ jsxs("div", { className: "mb-1", children: [
|
|
3719
3715
|
/* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: section }),
|
|
3720
3716
|
items.map(({ result, index }) => /* @__PURE__ */ jsxs(
|
|
3721
3717
|
"button",
|
|
@@ -4387,10 +4383,10 @@ function SidebarProvider({
|
|
|
4387
4383
|
const isMobile = useIsMobile();
|
|
4388
4384
|
const [openMobile, setOpenMobile] = React8.useState(false);
|
|
4389
4385
|
const [_open, _setOpen] = React8.useState(defaultOpen);
|
|
4390
|
-
const
|
|
4386
|
+
const open2 = openProp ?? _open;
|
|
4391
4387
|
const setOpen = React8.useCallback(
|
|
4392
4388
|
(value) => {
|
|
4393
|
-
const openState = typeof value === "function" ? value(
|
|
4389
|
+
const openState = typeof value === "function" ? value(open2) : value;
|
|
4394
4390
|
if (setOpenProp) {
|
|
4395
4391
|
setOpenProp(openState);
|
|
4396
4392
|
} else {
|
|
@@ -4398,10 +4394,10 @@ function SidebarProvider({
|
|
|
4398
4394
|
}
|
|
4399
4395
|
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
4400
4396
|
},
|
|
4401
|
-
[setOpenProp,
|
|
4397
|
+
[setOpenProp, open2]
|
|
4402
4398
|
);
|
|
4403
4399
|
const toggleSidebar = React8.useCallback(() => {
|
|
4404
|
-
return isMobile ? setOpenMobile((
|
|
4400
|
+
return isMobile ? setOpenMobile((open3) => !open3) : setOpen((open3) => !open3);
|
|
4405
4401
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
4406
4402
|
React8.useEffect(() => {
|
|
4407
4403
|
const handleKeyDown = (event) => {
|
|
@@ -4413,18 +4409,18 @@ function SidebarProvider({
|
|
|
4413
4409
|
window.addEventListener("keydown", handleKeyDown);
|
|
4414
4410
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
4415
4411
|
}, [toggleSidebar]);
|
|
4416
|
-
const state =
|
|
4412
|
+
const state = open2 ? "expanded" : "collapsed";
|
|
4417
4413
|
const contextValue = React8.useMemo(
|
|
4418
4414
|
() => ({
|
|
4419
4415
|
state,
|
|
4420
|
-
open,
|
|
4416
|
+
open: open2,
|
|
4421
4417
|
setOpen,
|
|
4422
4418
|
isMobile,
|
|
4423
4419
|
openMobile,
|
|
4424
4420
|
setOpenMobile,
|
|
4425
4421
|
toggleSidebar
|
|
4426
4422
|
}),
|
|
4427
|
-
[state,
|
|
4423
|
+
[state, open2, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
4428
4424
|
);
|
|
4429
4425
|
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
|
|
4430
4426
|
"div",
|
|
@@ -4964,6 +4960,7 @@ function SidebarNavigation2({
|
|
|
4964
4960
|
nodes,
|
|
4965
4961
|
currentPath,
|
|
4966
4962
|
language: _language = "en",
|
|
4963
|
+
onNavigateLeaf,
|
|
4967
4964
|
translations: translations2 = {}
|
|
4968
4965
|
}) {
|
|
4969
4966
|
const { toggleFolder = "Toggle folder" } = translations2;
|
|
@@ -4971,65 +4968,76 @@ function SidebarNavigation2({
|
|
|
4971
4968
|
if (!node.websitePath) return null;
|
|
4972
4969
|
const isActive = isActiveNode(node, currentPath);
|
|
4973
4970
|
const hasActiveChildNode = hasActiveChild(node, currentPath);
|
|
4974
|
-
return node.children && Object.keys(node.children).length > 0 ? /* @__PURE__ */ jsx(
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
{
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
children
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
4971
|
+
return node.children && Object.keys(node.children).length > 0 ? /* @__PURE__ */ jsx(
|
|
4972
|
+
Collapsible,
|
|
4973
|
+
{
|
|
4974
|
+
defaultOpen: isActive || hasActiveChildNode,
|
|
4975
|
+
className: "group/collapsible",
|
|
4976
|
+
children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [
|
|
4977
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-nowrap items-center gap-2", children: [
|
|
4978
|
+
/* @__PURE__ */ jsxs(
|
|
4979
|
+
Link2,
|
|
4980
|
+
{
|
|
4981
|
+
href: node.websitePath,
|
|
4982
|
+
className: `group/row relative flex flex-nowrap items-center gap-2 flex-auto py-1.5 pl-3 pr-2 rounded-md text-sm transition-colors hover:bg-accent ${isActive ? "bg-accent font-medium text-foreground before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-foreground" : hasActiveChildNode ? "text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
4983
|
+
children: [
|
|
4984
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-none", children: [
|
|
4985
|
+
/* @__PURE__ */ jsx(FolderOpenIcon, { className: "h-4 w-4 group-data-[state=closed]/collapsible:hidden" }),
|
|
4986
|
+
/* @__PURE__ */ jsx(FolderClosedIcon, { className: "h-4 w-4 group-data-[state=open]/collapsible:hidden" })
|
|
4987
|
+
] }),
|
|
4988
|
+
/* @__PURE__ */ jsx("span", { className: `flex-auto ${isActive ? "font-medium" : ""}`, children: node.title })
|
|
4989
|
+
]
|
|
4990
|
+
}
|
|
4991
|
+
),
|
|
4992
|
+
/* @__PURE__ */ jsxs(
|
|
4993
|
+
CollapsibleTrigger2,
|
|
4994
|
+
{
|
|
4995
|
+
className: "p-1.5 rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground self-center",
|
|
4996
|
+
"aria-label": `${toggleFolder}: ${node.title}`,
|
|
4997
|
+
children: [
|
|
4998
|
+
/* @__PURE__ */ jsx(
|
|
4999
|
+
ChevronRight,
|
|
5000
|
+
{
|
|
5001
|
+
className: "h-4 w-4 group-data-[state=open]/collapsible:hidden",
|
|
5002
|
+
"aria-hidden": "true"
|
|
5003
|
+
}
|
|
5004
|
+
),
|
|
5005
|
+
/* @__PURE__ */ jsx(
|
|
5006
|
+
ChevronDown,
|
|
5007
|
+
{
|
|
5008
|
+
className: "h-4 w-4 group-data-[state=closed]/collapsible:hidden",
|
|
5009
|
+
"aria-hidden": "true"
|
|
5010
|
+
}
|
|
5011
|
+
)
|
|
5012
|
+
]
|
|
5013
|
+
}
|
|
5014
|
+
)
|
|
5015
|
+
] }),
|
|
5016
|
+
/* @__PURE__ */ jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: Object.entries(node.children || {}).map(([, child]) => {
|
|
5017
|
+
if (!child.websitePath) return null;
|
|
5018
|
+
const isChildActive = isActiveNode(child, currentPath);
|
|
5019
|
+
const childIsLeaf = !child.children || Object.keys(child.children).length === 0;
|
|
5020
|
+
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
5021
|
+
Link2,
|
|
5022
|
+
{
|
|
5023
|
+
href: child.websitePath,
|
|
5024
|
+
onClick: childIsLeaf ? onNavigateLeaf : void 0,
|
|
5025
|
+
className: `group/row relative flex items-center gap-2 py-1.5 pl-3 pr-2 rounded-md text-sm transition-colors hover:bg-accent ${isChildActive ? "bg-accent font-medium text-foreground before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
5026
|
+
children: [
|
|
5027
|
+
child.children && Object.keys(child.children).length > 0 ? /* @__PURE__ */ jsx(FolderClosedIcon, { className: "h-4 w-4 flex-none" }) : /* @__PURE__ */ jsx(FileTextIcon, { className: "h-4 w-4 flex-none" }),
|
|
5028
|
+
/* @__PURE__ */ jsx("span", { className: "", children: child.title })
|
|
5029
|
+
]
|
|
5030
|
+
}
|
|
5031
|
+
) }, child.websitePath);
|
|
5032
|
+
}) }) })
|
|
5033
|
+
] }, node.websitePath) }, `menu-${node.websitePath}`)
|
|
5034
|
+
},
|
|
5035
|
+
node.websitePath
|
|
5036
|
+
) : /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
5030
5037
|
Link2,
|
|
5031
5038
|
{
|
|
5032
5039
|
href: node.websitePath,
|
|
5040
|
+
onClick: onNavigateLeaf,
|
|
5033
5041
|
className: `group/row relative flex items-center gap-2 py-1.5 pl-3 pr-2 rounded-md text-sm transition-colors hover:bg-accent ${isActive ? "bg-accent font-medium text-foreground before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
5034
5042
|
children: [
|
|
5035
5043
|
/* @__PURE__ */ jsx(FileTextIcon, { className: "h-4 w-4 flex-none" }),
|
|
@@ -5039,7 +5047,34 @@ function SidebarNavigation2({
|
|
|
5039
5047
|
) }, node.websitePath) }, `menu-${node.websitePath}`);
|
|
5040
5048
|
}) }) });
|
|
5041
5049
|
}
|
|
5050
|
+
var open = false;
|
|
5051
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
5052
|
+
function emit() {
|
|
5053
|
+
for (const listener of listeners) listener();
|
|
5054
|
+
}
|
|
5055
|
+
function setMobileMenuOpen(value) {
|
|
5056
|
+
if (open === value) return;
|
|
5057
|
+
open = value;
|
|
5058
|
+
emit();
|
|
5059
|
+
}
|
|
5060
|
+
function subscribe(listener) {
|
|
5061
|
+
listeners.add(listener);
|
|
5062
|
+
return () => {
|
|
5063
|
+
listeners.delete(listener);
|
|
5064
|
+
};
|
|
5065
|
+
}
|
|
5066
|
+
function getSnapshot() {
|
|
5067
|
+
return open;
|
|
5068
|
+
}
|
|
5069
|
+
function getServerSnapshot() {
|
|
5070
|
+
return false;
|
|
5071
|
+
}
|
|
5072
|
+
function useMobileMenuOpen() {
|
|
5073
|
+
const value = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
5074
|
+
return [value, setMobileMenuOpen];
|
|
5075
|
+
}
|
|
5042
5076
|
function MobileMenu2({ pageData, translations: translations2 = {} }) {
|
|
5077
|
+
const [open2, setOpen] = useMobileMenuOpen();
|
|
5043
5078
|
if (!pageData) {
|
|
5044
5079
|
return null;
|
|
5045
5080
|
}
|
|
@@ -5049,7 +5084,7 @@ function MobileMenu2({ pageData, translations: translations2 = {} }) {
|
|
|
5049
5084
|
mobileMenuDescription = "Mobile navigation menu"
|
|
5050
5085
|
} = translations2;
|
|
5051
5086
|
const { sidebar, navigation: nav, computed } = pageData;
|
|
5052
|
-
return /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsxs(Drawer, { direction: "right", children: [
|
|
5087
|
+
return /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsxs(Drawer, { direction: "right", open: open2, onOpenChange: setOpen, children: [
|
|
5053
5088
|
/* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "icon", className: "h-9 w-9", children: [
|
|
5054
5089
|
/* @__PURE__ */ jsx(Menu, { className: "h-4 w-4" }),
|
|
5055
5090
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: openMobileMenu })
|
|
@@ -5084,7 +5119,8 @@ function MobileMenu2({ pageData, translations: translations2 = {} }) {
|
|
|
5084
5119
|
{
|
|
5085
5120
|
nodes: sidebar.items,
|
|
5086
5121
|
currentPath: `/${computed.lang}/docs/${computed.path}`,
|
|
5087
|
-
language: computed.lang
|
|
5122
|
+
language: computed.lang,
|
|
5123
|
+
onNavigateLeaf: () => setOpen(false)
|
|
5088
5124
|
}
|
|
5089
5125
|
)
|
|
5090
5126
|
] })
|
|
@@ -5316,7 +5352,10 @@ function GithubContributors2({
|
|
|
5316
5352
|
return null;
|
|
5317
5353
|
}
|
|
5318
5354
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
5319
|
-
/* @__PURE__ */
|
|
5355
|
+
/* @__PURE__ */ jsxs("h3", { className: "mb-3 flex items-center gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
5356
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "size-3.5", children: /* @__PURE__ */ jsx("path", { d: "M16 19a4 4 0 0 0-8 0M12 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6M20 19a3.5 3.5 0 0 0-5-3.2M18.5 10.3a2.6 2.6 0 0 0 0-4.6" }) }),
|
|
5357
|
+
contributorsLabel
|
|
5358
|
+
] }),
|
|
5320
5359
|
/* @__PURE__ */ jsxs("div", { className: "isolate flex -space-x-2 overflow-hidden pl-1", children: [
|
|
5321
5360
|
contributors.slice(0, 8).map((contributor, index) => /* @__PURE__ */ jsx(
|
|
5322
5361
|
Link2,
|
|
@@ -5456,7 +5495,7 @@ function useMediaQuery(query) {
|
|
|
5456
5495
|
return value;
|
|
5457
5496
|
}
|
|
5458
5497
|
function BreadcrumbToggle({ overflowItems, className }) {
|
|
5459
|
-
const [
|
|
5498
|
+
const [open2, setOpen] = React8.useState(false);
|
|
5460
5499
|
const isDesktop = useMediaQuery("(min-width: 768px)");
|
|
5461
5500
|
const handleOverflowItemClick = useCallback(() => {
|
|
5462
5501
|
setOpen(false);
|
|
@@ -5464,7 +5503,7 @@ function BreadcrumbToggle({ overflowItems, className }) {
|
|
|
5464
5503
|
if (overflowItems.length === 0) {
|
|
5465
5504
|
return null;
|
|
5466
5505
|
}
|
|
5467
|
-
return /* @__PURE__ */ jsx(BreadcrumbItem, { className, children: isDesktop ? /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
5506
|
+
return /* @__PURE__ */ jsx(BreadcrumbItem, { className, children: isDesktop ? /* @__PURE__ */ jsxs(DropdownMenu, { open: open2, onOpenChange: setOpen, children: [
|
|
5468
5507
|
/* @__PURE__ */ jsxs(
|
|
5469
5508
|
DropdownMenuTrigger,
|
|
5470
5509
|
{
|
|
@@ -5485,7 +5524,7 @@ function BreadcrumbToggle({ overflowItems, className }) {
|
|
|
5485
5524
|
children: item.label
|
|
5486
5525
|
}
|
|
5487
5526
|
) }) }, index)) })
|
|
5488
|
-
] }) : /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange: setOpen, children: [
|
|
5527
|
+
] }) : /* @__PURE__ */ jsxs(Drawer, { open: open2, onOpenChange: setOpen, children: [
|
|
5489
5528
|
/* @__PURE__ */ jsx(DrawerTrigger, { "aria-label": "Show more breadcrumb items", children: /* @__PURE__ */ jsx(BreadcrumbEllipsis, { className: "h-4 w-4" }) }),
|
|
5490
5529
|
/* @__PURE__ */ jsxs(DrawerContent, { children: [
|
|
5491
5530
|
/* @__PURE__ */ jsx("div", { className: "grid gap-1 p-4 overflow-y-auto", children: overflowItems.map((item, index) => /* @__PURE__ */ jsx(
|