@vx-oss/docs-react 1.0.4 → 1.0.5
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/README.md +3 -3
- package/css/generated/docs.css +1 -1
- package/css/generated/flux.css +1 -1
- package/css/generated/glass.css +1 -1
- package/css/generated/home.css +1 -1
- package/css/generated/notebook.css +1 -1
- package/css/generated/shared.css +1 -1
- package/css/lib/base.css +0 -127
- package/css/preset.css +1 -2
- package/css/style.css +1 -0
- package/dist/components/accordion.js +1 -68
- package/dist/components/banner.js +1 -85
- package/dist/components/callout.js +1 -60
- package/dist/components/card.js +1 -39
- package/dist/components/codeblock.js +1 -126
- package/dist/components/codeblock.rsc.js +1 -22
- package/dist/components/dialog/search-algolia.js +2 -64
- package/dist/components/dialog/search-default.js +2 -66
- package/dist/components/dialog/search-orama.js +2 -69
- package/dist/components/dialog/search.js +1 -351
- package/dist/components/dynamic-codeblock.core.js +1 -51
- package/dist/components/dynamic-codeblock.js +1 -17
- package/dist/components/files.js +1 -40
- package/dist/components/github-info.js +1 -75
- package/dist/components/heading.js +1 -38
- package/dist/components/image-zoom.js +1 -32
- package/dist/components/inline-toc.js +1 -28
- package/dist/components/sidebar/base.js +1 -277
- package/dist/components/sidebar/link-item.js +1 -37
- package/dist/components/sidebar/page-tree.js +1 -69
- package/dist/components/sidebar/tabs/dropdown.js +1 -83
- package/dist/components/sidebar/tabs/index.js +1 -46
- package/dist/components/steps.js +1 -16
- package/dist/components/tabs.js +1 -95
- package/dist/components/toc/clerk.js +1 -227
- package/dist/components/toc/default.js +1 -260
- package/dist/components/toc/index.js +1 -45
- package/dist/components/type-table.js +1 -117
- package/dist/components/ui/accordion.js +1 -42
- package/dist/components/ui/button.js +1 -20
- package/dist/components/ui/collapsible.js +1 -21
- package/dist/components/ui/popover.js +1 -20
- package/dist/components/ui/scroll-area.js +1 -34
- package/dist/components/ui/tabs.js +1 -102
- package/dist/contexts/i18n.js +1 -37
- package/dist/contexts/search.js +1 -68
- package/dist/contexts/tree.js +1 -91
- package/dist/i18n.js +1 -38
- package/dist/index.js +1 -0
- package/dist/layouts/docs/index.js +1 -23
- package/dist/layouts/docs/page/index.js +1 -124
- package/dist/layouts/docs/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/docs/page/slots/container.js +1 -22
- package/dist/layouts/docs/page/slots/footer.js +1 -56
- package/dist/layouts/docs/page/slots/toc.js +1 -182
- package/dist/layouts/docs/slots/container.js +1 -36
- package/dist/layouts/docs/slots/header.js +1 -38
- package/dist/layouts/docs/slots/sidebar.js +1 -268
- package/dist/layouts/flux/index.js +1 -146
- package/dist/layouts/flux/page/index.js +1 -104
- package/dist/layouts/flux/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/flux/page/slots/container.js +1 -22
- package/dist/layouts/flux/page/slots/footer.js +1 -56
- package/dist/layouts/flux/page/slots/toc.js +1 -181
- package/dist/layouts/flux/slots/container.js +1 -13
- package/dist/layouts/flux/slots/sidebar.js +1 -243
- package/dist/layouts/flux/slots/tab-dropdown.js +1 -88
- package/dist/layouts/glass/index.js +1 -70
- package/dist/layouts/glass/page/index.js +1 -92
- package/dist/layouts/glass/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/glass/page/slots/footer.js +1 -56
- package/dist/layouts/glass/page/slots/toc.js +1 -108
- package/dist/layouts/glass/slots/header.js +1 -68
- package/dist/layouts/glass/slots/sidebar.js +1 -267
- package/dist/layouts/home/index.js +1 -40
- package/dist/layouts/home/navbar.js +1 -34
- package/dist/layouts/home/not-found.js +1 -41
- package/dist/layouts/home/slots/container.js +1 -13
- package/dist/layouts/home/slots/header.js +1 -239
- package/dist/layouts/notebook/index.js +1 -23
- package/dist/layouts/notebook/page/index.js +1 -124
- package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/notebook/page/slots/container.js +1 -22
- package/dist/layouts/notebook/page/slots/footer.js +1 -56
- package/dist/layouts/notebook/page/slots/toc.js +1 -181
- package/dist/layouts/notebook/slots/container.js +1 -38
- package/dist/layouts/notebook/slots/header.js +1 -204
- package/dist/layouts/notebook/slots/sidebar.js +1 -240
- package/dist/layouts/shared/index.js +1 -98
- package/dist/layouts/shared/slots/language-select.js +1 -43
- package/dist/layouts/shared/slots/search-trigger.js +1 -53
- package/dist/layouts/shared/slots/theme-switch.js +1 -70
- package/dist/mdx.d.ts +2 -44
- package/dist/mdx.js +2 -70
- package/dist/mdx.server.js +2 -20
- package/dist/og/takumi.js +1 -91
- package/dist/og.js +1 -91
- package/dist/page.js +1 -33
- package/dist/primitives/accordion.js +1 -0
- package/dist/primitives/collapsible.js +1 -0
- package/dist/primitives/dialog.js +1 -0
- package/dist/primitives/direction-provider.js +1 -0
- package/dist/primitives/drawer.js +1 -0
- package/dist/primitives/navigation-menu.js +1 -0
- package/dist/primitives/popover.js +1 -0
- package/dist/primitives/scroll-area.js +1 -0
- package/dist/primitives/shared.js +1 -0
- package/dist/primitives/tabs.js +1 -0
- package/dist/provider/astro.js +1 -20
- package/dist/provider/base.js +1 -73
- package/dist/provider/next.js +1 -17
- package/dist/provider/react-router.js +1 -17
- package/dist/provider/tanstack.js +1 -17
- package/dist/provider/waku.js +1 -17
- package/dist/style.css +11577 -310
- package/dist/utils/use-copy-button.js +1 -26
- package/dist/utils/use-footer-items.js +1 -24
- package/dist/utils/use-is-scroll-top.js +1 -20
- package/package.json +28 -66
- package/css/preset-legacy.css +0 -43
- package/dist/.translations/index.d.ts +0 -55
- package/dist/.translations/keys.js +0 -55
- package/dist/_virtual/_rolldown/runtime.js +0 -13
- package/dist/components/accordion.d.ts +0 -10
- package/dist/components/banner.d.ts +0 -25
- package/dist/components/callout.d.ts +0 -21
- package/dist/components/card.d.ts +0 -13
- package/dist/components/codeblock.d.ts +0 -45
- package/dist/components/codeblock.rsc.d.ts +0 -15
- package/dist/components/dialog/search-algolia.d.ts +0 -27
- package/dist/components/dialog/search-default.d.ts +0 -29
- package/dist/components/dialog/search-orama.d.ts +0 -32
- package/dist/components/dialog/search.d.ts +0 -76
- package/dist/components/dynamic-codeblock.core.d.ts +0 -26
- package/dist/components/dynamic-codeblock.d.ts +0 -8
- package/dist/components/files.d.ts +0 -21
- package/dist/components/github-info.d.ts +0 -20
- package/dist/components/heading.d.ts +0 -9
- package/dist/components/image-zoom.d.ts +0 -18
- package/dist/components/inline-toc.d.ts +0 -10
- package/dist/components/sidebar/base.d.ts +0 -85
- package/dist/components/sidebar/link-item.d.ts +0 -12
- package/dist/components/sidebar/page-tree.d.ts +0 -20
- package/dist/components/sidebar/tabs/dropdown.d.ts +0 -15
- package/dist/components/sidebar/tabs/index.d.ts +0 -8
- package/dist/components/steps.d.ts +0 -10
- package/dist/components/tabs.d.ts +0 -33
- package/dist/components/toc/clerk.d.ts +0 -11
- package/dist/components/toc/default.d.ts +0 -13
- package/dist/components/toc/index.d.ts +0 -10
- package/dist/components/type-table.d.ts +0 -37
- package/dist/components/ui/accordion.d.ts +0 -10
- package/dist/components/ui/button.d.ts +0 -10
- package/dist/components/ui/collapsible.d.ts +0 -11
- package/dist/components/ui/navigation-menu.d.ts +0 -14
- package/dist/components/ui/navigation-menu.js +0 -41
- package/dist/components/ui/popover.d.ts +0 -9
- package/dist/components/ui/scroll-area.d.ts +0 -9
- package/dist/components/ui/tabs.d.ts +0 -23
- package/dist/contexts/i18n.d.ts +0 -34
- package/dist/contexts/search.d.ts +0 -64
- package/dist/contexts/tree.d.ts +0 -29
- package/dist/i18n.d.ts +0 -15
- package/dist/layouts/docs/client.d.ts +0 -33
- package/dist/layouts/docs/client.js +0 -94
- package/dist/layouts/docs/index.d.ts +0 -32
- package/dist/layouts/docs/page/index.d.ts +0 -76
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/docs/page/slots/container.d.ts +0 -5
- package/dist/layouts/docs/page/slots/footer.d.ts +0 -16
- package/dist/layouts/docs/page/slots/toc.d.ts +0 -47
- package/dist/layouts/docs/slots/container.d.ts +0 -5
- package/dist/layouts/docs/slots/header.d.ts +0 -5
- package/dist/layouts/docs/slots/sidebar.d.ts +0 -22
- package/dist/layouts/flux/index.d.ts +0 -61
- package/dist/layouts/flux/page/index.d.ts +0 -67
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/flux/page/slots/container.d.ts +0 -5
- package/dist/layouts/flux/page/slots/footer.d.ts +0 -16
- package/dist/layouts/flux/page/slots/toc.d.ts +0 -29
- package/dist/layouts/flux/slots/container.d.ts +0 -5
- package/dist/layouts/flux/slots/sidebar.d.ts +0 -16
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +0 -10
- package/dist/layouts/glass/index.d.ts +0 -39
- package/dist/layouts/glass/layout-tabs.js +0 -54
- package/dist/layouts/glass/page/index.d.ts +0 -31
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/glass/page/slots/footer.d.ts +0 -16
- package/dist/layouts/glass/page/slots/toc.d.ts +0 -19
- package/dist/layouts/glass/slots/header.d.ts +0 -6
- package/dist/layouts/glass/slots/sidebar.d.ts +0 -21
- package/dist/layouts/home/index.d.ts +0 -27
- package/dist/layouts/home/navbar.d.ts +0 -9
- package/dist/layouts/home/not-found.d.ts +0 -7
- package/dist/layouts/home/slots/container.d.ts +0 -5
- package/dist/layouts/home/slots/header.d.ts +0 -8
- package/dist/layouts/notebook/client.d.ts +0 -35
- package/dist/layouts/notebook/client.js +0 -69
- package/dist/layouts/notebook/index.d.ts +0 -26
- package/dist/layouts/notebook/page/index.d.ts +0 -76
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/notebook/page/slots/container.d.ts +0 -5
- package/dist/layouts/notebook/page/slots/footer.d.ts +0 -16
- package/dist/layouts/notebook/page/slots/toc.d.ts +0 -47
- package/dist/layouts/notebook/slots/container.d.ts +0 -5
- package/dist/layouts/notebook/slots/header.d.ts +0 -5
- package/dist/layouts/notebook/slots/sidebar.d.ts +0 -23
- package/dist/layouts/shared/client.d.ts +0 -37
- package/dist/layouts/shared/client.js +0 -85
- package/dist/layouts/shared/index.d.ts +0 -169
- package/dist/layouts/shared/page-actions.d.ts +0 -27
- package/dist/layouts/shared/page-actions.js +0 -199
- package/dist/layouts/shared/slots/language-select.d.ts +0 -12
- package/dist/layouts/shared/slots/search-trigger.d.ts +0 -13
- package/dist/layouts/shared/slots/theme-switch.d.ts +0 -8
- package/dist/legacy/layout.d.ts +0 -29
- package/dist/legacy/layout.js +0 -44
- package/dist/legacy/sidebar.d.ts +0 -14
- package/dist/legacy/sidebar.js +0 -34
- package/dist/mdx.server.d.ts +0 -14
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +0 -30
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +0 -461
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +0 -3
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +0 -6
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +0 -17
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +0 -53
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +0 -25
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +0 -12
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +0 -45
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +0 -10
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +0 -57
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +0 -21
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +0 -14
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +0 -22
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +0 -27
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +0 -31
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +0 -75
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +0 -4
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +0 -7
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +0 -5
- package/dist/og/takumi.d.ts +0 -15
- package/dist/og.d.ts +0 -16
- package/dist/page.d.ts +0 -29
- package/dist/provider/astro.d.ts +0 -29
- package/dist/provider/base.d.ts +0 -48
- package/dist/provider/next.d.ts +0 -16
- package/dist/provider/react-router.d.ts +0 -16
- package/dist/provider/tanstack.d.ts +0 -16
- package/dist/provider/waku.d.ts +0 -16
- package/dist/utils/cn.js +0 -2
- package/dist/utils/merge-refs.js +0 -11
- package/dist/utils/urls.js +0 -15
- package/dist/utils/use-copy-button.d.ts +0 -5
- package/dist/utils/use-footer-items.d.ts +0 -8
- package/dist/utils/use-is-scroll-top.d.ts +0 -6
|
@@ -1,108 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../../../utils/cn.js";
|
|
3
|
-
import { TOCProvider as TOCProvider$1, TOCScrollArea, useTOCItems } from "../../../../components/toc/index.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { Text } from "lucide-react";
|
|
6
|
-
import { createContext, use, useMemo, useRef, useState } from "react";
|
|
7
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
-
import { TOCItem } from "@vx-oss/docs-core/toc";
|
|
9
|
-
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
10
|
-
//#region src/layouts/glass/page/slots/toc.tsx
|
|
11
|
-
const Context = createContext(null);
|
|
12
|
-
function TOCProvider(props) {
|
|
13
|
-
return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
|
|
14
|
-
}
|
|
15
|
-
function useContext$1() {
|
|
16
|
-
return use(Context);
|
|
17
|
-
}
|
|
18
|
-
function TOC({ container, header, footer }) {
|
|
19
|
-
const t = useTranslations({ note: "table of contents" });
|
|
20
|
-
const items = useTOCItems();
|
|
21
|
-
const [hover, setHover] = useState(false);
|
|
22
|
-
const [mobileOpen, setMobileOpen] = useState(false);
|
|
23
|
-
const [inAnimation, setInAnimation] = useState(false);
|
|
24
|
-
const exitTimerRef = useRef(null);
|
|
25
|
-
const transitionTimerRef = useRef(null);
|
|
26
|
-
const open = hover || mobileOpen;
|
|
27
|
-
useOnChange(open, () => {
|
|
28
|
-
setInAnimation(true);
|
|
29
|
-
if (transitionTimerRef.current) window.clearTimeout(transitionTimerRef.current);
|
|
30
|
-
transitionTimerRef.current = window.setTimeout(() => {
|
|
31
|
-
setInAnimation(false);
|
|
32
|
-
}, 300);
|
|
33
|
-
});
|
|
34
|
-
const ctx = useMemo(() => ({
|
|
35
|
-
open,
|
|
36
|
-
setMobileOpen,
|
|
37
|
-
inAnimation
|
|
38
|
-
}), [open, inAnimation]);
|
|
39
|
-
if (items.length === 0 && !footer && !header) return;
|
|
40
|
-
return /* @__PURE__ */ jsxs(Context, {
|
|
41
|
-
value: ctx,
|
|
42
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
43
|
-
className: cn("fixed inset-0 z-10 backdrop-blur-sm transition-opacity duration-300 [mask-image:radial-gradient(circle_at_center_right,white,white_200px,transparent_500px)] xl:hidden", !open && "opacity-0 pointer-events-none"),
|
|
44
|
-
onClick: () => setMobileOpen(false)
|
|
45
|
-
}), /* @__PURE__ */ jsx(TOCScrollArea, {
|
|
46
|
-
id: "nd-toc",
|
|
47
|
-
...container,
|
|
48
|
-
className: cn("z-10 grid transition-[width,padding] duration-300 [grid-area:right]", "xl:sticky xl:top-10 xl:h-[calc(100dvh---spacing(10))] md:layout:[--fd-right-width:12px] xl:layout:[--fd-right-width:240px] xl:items-center xl:pe-4", "max-xl:fixed max-xl:top-1/2 max-xl:-translate-y-1/2 max-xl:end-1 max-xl:bg-fd-popover max-xl:text-fd-popover-foreground max-xl:border max-xl:rounded-xl max-xl:shadow-md max-xl:mask-none max-xl:max-h-[calc(100dvh---spacing(32))] max-xl:grid-cols-[calc(240px---spacing(6))]", inAnimation && "overflow-y-hidden", open ? "max-xl:w-[240px] max-xl:p-3" : "max-md:w-4 max-md:ps-[calc(--spacing(1.5)-1px)] max-xl:w-6 max-xl:ps-[calc(--spacing(2.5)-1px)] max-xl:overflow-clip", container?.className),
|
|
49
|
-
onPointerDown: (e) => {
|
|
50
|
-
if (!mobileOpen && (e.pointerType === "touch" || e.pointerType === "pen")) setMobileOpen(true);
|
|
51
|
-
},
|
|
52
|
-
onPointerEnter: (e) => {
|
|
53
|
-
if (e.pointerType === "mouse") {
|
|
54
|
-
if (exitTimerRef.current) window.clearTimeout(exitTimerRef.current);
|
|
55
|
-
if (!hover) setHover(true);
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
onPointerLeave: (e) => {
|
|
59
|
-
if (hover && e.pointerType === "mouse") {
|
|
60
|
-
if (exitTimerRef.current) window.clearTimeout(exitTimerRef.current);
|
|
61
|
-
exitTimerRef.current = window.setTimeout(() => {
|
|
62
|
-
setHover(false);
|
|
63
|
-
}, window.innerWidth - e.clientX < 30 ? 700 : 50);
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
67
|
-
className: "flex flex-col xl:items-end xl:text-end",
|
|
68
|
-
children: [
|
|
69
|
-
header,
|
|
70
|
-
/* @__PURE__ */ jsxs("h3", {
|
|
71
|
-
id: "nd-toc-title",
|
|
72
|
-
className: cn("inline-flex items-center gap-1.5 overflow-hidden text-xs text-fd-muted-foreground transition-[opacity,height] opacity-0 h-0", open ? "opacity-100 h-6" : "xl:[@media(hover:none)]:opacity-100 xl:[@media(hover:none)]:h-6"),
|
|
73
|
-
children: [/* @__PURE__ */ jsx(Text, { className: "size-3.5 shrink-0" }), t("On this page")]
|
|
74
|
-
}),
|
|
75
|
-
/* @__PURE__ */ jsx(TOCPanel, {}),
|
|
76
|
-
footer
|
|
77
|
-
]
|
|
78
|
-
})
|
|
79
|
-
})]
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function TOCPanel({ className, style, ...props }) {
|
|
83
|
-
const items = useTOCItems();
|
|
84
|
-
const { open, inAnimation, setMobileOpen } = useContext$1();
|
|
85
|
-
return /* @__PURE__ */ jsx("div", {
|
|
86
|
-
className: cn("grid grid-cols-1 transition-[grid-template-rows]", open ? "[--row:calc(6*var(--spacing))]" : "[--row:calc(3*var(--spacing))] xl:[@media(hover:none)]:[--row:calc(6*var(--spacing))]", (!open || inAnimation) && "pointer-events-none xl:[@media(hover:none)]:pointer-events-auto", className),
|
|
87
|
-
style: {
|
|
88
|
-
...style,
|
|
89
|
-
gridTemplateRows: `repeat(${items.length}, var(--row))`
|
|
90
|
-
},
|
|
91
|
-
...props,
|
|
92
|
-
children: items.map((item) => /* @__PURE__ */ jsxs(TOCItem, {
|
|
93
|
-
href: item.url,
|
|
94
|
-
className: "group prose prose-sm flex items-center gap-2 text-xs text-fd-muted-foreground transition-colors data-[active=true]:text-fd-primary data-[active=false]:hover:text-fd-accent-foreground xl:flex-row-reverse",
|
|
95
|
-
onClick: () => setMobileOpen(false),
|
|
96
|
-
autoScroll: open && !inAnimation,
|
|
97
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
98
|
-
className: cn("shrink-0 bg-fd-muted-foreground/50 rounded-full size-1 transition-[background-color,width,height] group-data-[active=true]:bg-fd-primary", open ? "w-(--width) h-px" : "transition-[width,height] duration-300 xl:[@media(hover:none)]:w-(--width) xl:[@media(hover:none)]:h-px"),
|
|
99
|
-
style: { "--width": `calc(pow(${item.depth}, 1.5) * var(--spacing))` }
|
|
100
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
101
|
-
className: cn("truncate transition-opacity opacity-0", open ? "opacity-100" : "xl:[@media(hover:none)]:opacity-100"),
|
|
102
|
-
children: item.title
|
|
103
|
-
})]
|
|
104
|
-
}, item.url))
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
//#endregion
|
|
108
|
-
export { TOC, TOCProvider };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/glass/page/slots/toc';
|
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../../utils/cn.js";
|
|
3
|
-
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
-
import { SidebarTrigger } from "../../../components/sidebar/base.js";
|
|
5
|
-
import { LayoutTabsDropdown } from "../layout-tabs.js";
|
|
6
|
-
import { useGlassLayout } from "../index.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { ChevronsUpDown, LanguagesIcon, MessageCircleIcon, SidebarIcon } from "lucide-react";
|
|
9
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
10
|
-
//#region src/layouts/glass/slots/header.tsx
|
|
11
|
-
const baseVariants = "rounded-full bg-fd-popover/80 text-fd-popover-foreground border backdrop-blur-sm shadow-sm";
|
|
12
|
-
function Header({ className, ...props }) {
|
|
13
|
-
const { props: { tabs, aiChat }, slots } = useGlassLayout();
|
|
14
|
-
const t = useTranslations();
|
|
15
|
-
const sidebar = slots.sidebar.use();
|
|
16
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
-
className: cn("sticky flex flex-row justify-end gap-2 [grid-area:left-margin/left-margin/right/right] z-20 px-4 md:top-0 md:pt-2 md:px-2 md:h-12 md:bg-linear-to-b md:from-fd-background max-md:bottom-0 max-md:mt-auto max-md:h-16 max-md:pb-4 max-md:bg-linear-to-t max-md:from-fd-background", className),
|
|
18
|
-
...props,
|
|
19
|
-
children: [
|
|
20
|
-
sidebar.collapsible && sidebar.collapsed && /* @__PURE__ */ jsx("button", {
|
|
21
|
-
"aria-label": t("Show Sidebar", { note: "sidebar" }),
|
|
22
|
-
className: cn(buttonVariants({
|
|
23
|
-
size: "icon-sm",
|
|
24
|
-
variant: "secondary"
|
|
25
|
-
}), baseVariants, "size-10 me-auto shrink-0 max-md:hidden"),
|
|
26
|
-
onClick: () => sidebar.setCollapsed(false),
|
|
27
|
-
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
28
|
-
}),
|
|
29
|
-
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
30
|
-
color: "secondary",
|
|
31
|
-
size: "icon",
|
|
32
|
-
className: cn(baseVariants, "size-12 shrink-0 md:hidden")
|
|
33
|
-
}),
|
|
34
|
-
tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabsDropdown, {
|
|
35
|
-
tabs,
|
|
36
|
-
size: "lg",
|
|
37
|
-
className: cn(baseVariants, "min-w-0 ps-4 pe-3 flex-1 [&_svg]:size-5 md:hidden")
|
|
38
|
-
}),
|
|
39
|
-
slots.searchTrigger && /* @__PURE__ */ jsx("div", {
|
|
40
|
-
className: "@container flex justify-end flex-1 max-md:hidden",
|
|
41
|
-
children: /* @__PURE__ */ jsx(slots.searchTrigger.full, { className: cn(baseVariants, "text-fd-muted-foreground ps-3 w-full @sm:max-w-[200px]") })
|
|
42
|
-
}),
|
|
43
|
-
aiChat && !aiChat.open && /* @__PURE__ */ jsxs("button", {
|
|
44
|
-
className: cn(buttonVariants({ variant: "secondary" }), baseVariants, "px-3 gap-2 text-fd-muted-foreground shrink-0 max-md:hidden"),
|
|
45
|
-
onClick: () => aiChat.onOpenChange(true),
|
|
46
|
-
children: [/* @__PURE__ */ jsx(MessageCircleIcon, { className: "size-4" }), t("Ask AI", { note: "AI chat button" })]
|
|
47
|
-
}),
|
|
48
|
-
slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
|
|
49
|
-
className: cn(baseVariants, "px-3 rounded-full max-md:hidden"),
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ jsx(LanguagesIcon, { className: "size-4 text-fd-muted-foreground shrink-0" }),
|
|
52
|
-
/* @__PURE__ */ jsx(slots.languageSelect.text, {}),
|
|
53
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-3.5 text-fd-muted-foreground shrink-0" })
|
|
54
|
-
]
|
|
55
|
-
}),
|
|
56
|
-
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: cn(baseVariants, "shrink-0 px-1.5 max-md:hidden") }),
|
|
57
|
-
/* @__PURE__ */ jsx(SidebarTrigger, {
|
|
58
|
-
className: cn(buttonVariants({
|
|
59
|
-
variant: "secondary",
|
|
60
|
-
size: "icon"
|
|
61
|
-
}), baseVariants, "shrink-0 size-12 md:hidden"),
|
|
62
|
-
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
63
|
-
})
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
export { Header };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/glass/slots/header';
|
|
@@ -1,267 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../../utils/cn.js";
|
|
3
|
-
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
-
import { useTreeContext, useTreePath } from "../../../contexts/tree.js";
|
|
5
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
|
|
6
|
-
import { isLinkItemActive } from "../../shared/index.js";
|
|
7
|
-
import { ScrollArea, ScrollViewport } from "../../../components/ui/scroll-area.js";
|
|
8
|
-
import { SidebarDrawerContent, SidebarDrawerOverlay, SidebarProvider as SidebarProvider$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
|
|
9
|
-
import { LayoutTabsDropdown } from "../layout-tabs.js";
|
|
10
|
-
import { useGlassLayout } from "../index.js";
|
|
11
|
-
import Link from "@vx-oss/docs-core/link";
|
|
12
|
-
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
13
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { ChevronDown, ChevronsUpDown, LanguagesIcon, MessageCircleIcon, SidebarIcon, XIcon } from "lucide-react";
|
|
15
|
-
import { cva } from "class-variance-authority";
|
|
16
|
-
import { cloneElement, createContext, use, useState } from "react";
|
|
17
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
18
|
-
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
19
|
-
//#region src/layouts/glass/slots/sidebar.tsx
|
|
20
|
-
const itemTriggerVariants = cva("inline-flex text-sm items-center gap-2 rounded-lg px-2.5 py-2 md:py-1.5 [&_svg]:size-4 outline-none focus-visible:ring-2 focus-visible:ring-fd-ring", { variants: { active: {
|
|
21
|
-
true: "bg-fd-primary/10 text-fd-primary",
|
|
22
|
-
false: "text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
23
|
-
} } });
|
|
24
|
-
const CollapsibleContext = createContext(true);
|
|
25
|
-
function SidebarProvider({ children, collapsible = true }) {
|
|
26
|
-
return /* @__PURE__ */ jsx(SidebarProvider$1, { children: /* @__PURE__ */ jsx(CollapsibleContext, {
|
|
27
|
-
value: collapsible,
|
|
28
|
-
children
|
|
29
|
-
}) });
|
|
30
|
-
}
|
|
31
|
-
function useSidebar() {
|
|
32
|
-
const collapsible = use(CollapsibleContext);
|
|
33
|
-
const { collapsed, setCollapsed } = useSidebar$1();
|
|
34
|
-
return {
|
|
35
|
-
collapsible,
|
|
36
|
-
collapsed,
|
|
37
|
-
setCollapsed
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function SidebarDrawer({ contentProps }) {
|
|
41
|
-
const { menuItems, props: { aiChat }, slots } = useGlassLayout();
|
|
42
|
-
const { root } = useTreeContext();
|
|
43
|
-
const { setOpen } = useSidebar$1();
|
|
44
|
-
const t = useTranslations();
|
|
45
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarDrawerOverlay, { className: "fixed z-40 inset-0 bg-fd-overlay backdrop-blur-sm data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), /* @__PURE__ */ jsx(SidebarDrawerContent, {
|
|
46
|
-
className: "fixed z-40 inset-e-0 inset-y-0 flex flex-col w-[360px] max-w-[calc(100vw-3rem)] border-s bg-fd-background text-fd-foreground shadow-md data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out",
|
|
47
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
48
|
-
...contentProps,
|
|
49
|
-
className: cn("flex flex-col px-3 size-full overflow-y-auto fd-scroll-container", contentProps?.className),
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ jsxs("div", {
|
|
52
|
-
className: "sticky flex flex-col gap-2 top-0 py-2 bg-fd-background shadow-lg shadow-fd-background",
|
|
53
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
54
|
-
className: "flex items-center gap-1.5 ps-2.5",
|
|
55
|
-
children: [
|
|
56
|
-
/* @__PURE__ */ jsx(slots.navTitle, { className: "flex text-sm items-center font-semibold gap-2 flex-1" }),
|
|
57
|
-
aiChat && /* @__PURE__ */ jsxs("button", {
|
|
58
|
-
type: "button",
|
|
59
|
-
className: cn(buttonVariants({
|
|
60
|
-
variant: "secondary",
|
|
61
|
-
size: "sm"
|
|
62
|
-
}), "rounded-full h-8 gap-1.5"),
|
|
63
|
-
onClick: () => {
|
|
64
|
-
aiChat.onOpenChange(!aiChat.open);
|
|
65
|
-
setOpen(false);
|
|
66
|
-
},
|
|
67
|
-
children: [/* @__PURE__ */ jsx(MessageCircleIcon, { className: "size-4 text-fd-muted-foreground" }), t("Ask AI", { note: "AI chat button" })]
|
|
68
|
-
}),
|
|
69
|
-
/* @__PURE__ */ jsx("button", {
|
|
70
|
-
type: "button",
|
|
71
|
-
"aria-label": t("Close Sidebar", { note: "aria-label" }),
|
|
72
|
-
onClick: () => setOpen(false),
|
|
73
|
-
className: cn(buttonVariants({
|
|
74
|
-
variant: "secondary",
|
|
75
|
-
size: "icon-sm"
|
|
76
|
-
}), "rounded-full"),
|
|
77
|
-
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
78
|
-
})
|
|
79
|
-
]
|
|
80
|
-
}), slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
|
|
81
|
-
variant: "secondary",
|
|
82
|
-
className: "px-2.5 gap-2 rounded-lg",
|
|
83
|
-
children: [
|
|
84
|
-
/* @__PURE__ */ jsx(LanguagesIcon, { className: "size-4 text-fd-muted-foreground shrink-0" }),
|
|
85
|
-
/* @__PURE__ */ jsx(slots.languageSelect.text, {}),
|
|
86
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ms-auto size-3.5 text-fd-muted-foreground shrink-0" })
|
|
87
|
-
]
|
|
88
|
-
})]
|
|
89
|
-
}),
|
|
90
|
-
/* @__PURE__ */ jsxs("div", {
|
|
91
|
-
className: "flex flex-col py-2 flex-1",
|
|
92
|
-
children: [menuItems.map((item, i) => item.type !== "icon" && /* @__PURE__ */ jsx(SidebarLinkItem, { item }, i)), root.children.map((item, i) => cloneElement(renderNode(item), { key: i }))]
|
|
93
|
-
}),
|
|
94
|
-
/* @__PURE__ */ jsxs("div", {
|
|
95
|
-
className: "flex items-center sticky bottom-0 bg-fd-background px-1 pt-2 pb-4 border-t mt-2 empty:hidden",
|
|
96
|
-
children: [menuItems.map((item, i) => item.type === "icon" && /* @__PURE__ */ jsx(SidebarIconLinkItem, { item }, i)), slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-0 ms-auto" })]
|
|
97
|
-
})
|
|
98
|
-
]
|
|
99
|
-
})
|
|
100
|
-
})] });
|
|
101
|
-
}
|
|
102
|
-
function Sidebar({ className, children, ...props }) {
|
|
103
|
-
const { menuItems, props: { tabs }, slots } = useGlassLayout();
|
|
104
|
-
const { root } = useTreeContext();
|
|
105
|
-
const { collapsible, collapsed, setCollapsed } = useSidebar();
|
|
106
|
-
const t = useTranslations({ note: "sidebar" });
|
|
107
|
-
return /* @__PURE__ */ jsxs("aside", {
|
|
108
|
-
id: "nd-sidebar",
|
|
109
|
-
className: cn("sticky flex flex-col transition-transform [grid-area:left] my-2 ms-2 z-30 top-2 border rounded-2xl bg-fd-popover/80 text-fd-popover-foreground backdrop-blur-sm shadow-sm h-[calc(100dvh---spacing(4))] max-md:hidden md:layout:[--fd-left-width:280px]", collapsed && "w-[calc(280px---spacing(2))] -translate-x-[280px] md:layout:[--fd-left-width:0px]", className),
|
|
110
|
-
...props,
|
|
111
|
-
children: [
|
|
112
|
-
/* @__PURE__ */ jsxs("div", {
|
|
113
|
-
className: "flex items-start gap-1 pt-4 ps-4.5 pe-3.5 empty:hidden",
|
|
114
|
-
children: [/* @__PURE__ */ jsx(slots.navTitle, { className: "flex text-sm items-center font-semibold gap-2 me-auto" }), /* @__PURE__ */ jsxs("div", {
|
|
115
|
-
className: "flex -mt-1.5 -me-1.5 empty:hidden",
|
|
116
|
-
children: [menuItems.map((item, i) => item.type === "icon" && /* @__PURE__ */ jsx(SidebarIconLinkItem, { item }, i)), collapsible && /* @__PURE__ */ jsx("button", {
|
|
117
|
-
"aria-label": collapsed ? t("Show Sidebar") : t("Hide Sidebar"),
|
|
118
|
-
className: cn(buttonVariants({
|
|
119
|
-
variant: "ghost",
|
|
120
|
-
size: "icon-sm"
|
|
121
|
-
}), "text-fd-muted-foreground"),
|
|
122
|
-
onClick: () => setCollapsed(!collapsed),
|
|
123
|
-
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
124
|
-
})]
|
|
125
|
-
})]
|
|
126
|
-
}),
|
|
127
|
-
tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabsDropdown, {
|
|
128
|
-
tabs,
|
|
129
|
-
className: "min-w-0 bg-fd-secondary text-fd-secondary-foreground rounded-xl px-2.5 py-2 [&_svg]:size-4 border rounded-xl shadow-sm mx-2 mt-2.5 empty:hidden"
|
|
130
|
-
}),
|
|
131
|
-
/* @__PURE__ */ jsx(ScrollArea, {
|
|
132
|
-
className: "min-h-0 flex-1",
|
|
133
|
-
children: /* @__PURE__ */ jsxs(ScrollViewport, {
|
|
134
|
-
className: "flex flex-col p-2 [mask-image:linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent))]",
|
|
135
|
-
children: [menuItems.map((item, i) => item.type !== "icon" && /* @__PURE__ */ jsx(SidebarLinkItem, { item }, i)), root.children.map((item, i) => cloneElement(renderNode(item), { key: i }))]
|
|
136
|
-
})
|
|
137
|
-
}),
|
|
138
|
-
children
|
|
139
|
-
]
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
function SidebarIconLinkItem({ item, className }) {
|
|
143
|
-
return /* @__PURE__ */ jsx(Link, {
|
|
144
|
-
href: item.url,
|
|
145
|
-
external: item.external,
|
|
146
|
-
"aria-label": item.label,
|
|
147
|
-
className: cn(buttonVariants({
|
|
148
|
-
variant: "ghost",
|
|
149
|
-
size: "icon-sm"
|
|
150
|
-
}), "text-fd-muted-foreground", className),
|
|
151
|
-
children: item.icon
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
function SidebarLinkItem({ item, className }) {
|
|
155
|
-
const pathname = usePathname();
|
|
156
|
-
const [open, setOpen] = useState(true);
|
|
157
|
-
switch (item.type) {
|
|
158
|
-
case "custom": return /* @__PURE__ */ jsx("div", {
|
|
159
|
-
className,
|
|
160
|
-
children: item.children
|
|
161
|
-
});
|
|
162
|
-
case "menu": {
|
|
163
|
-
const rightIcon = /* @__PURE__ */ jsx(ChevronDown, { className: cn("ms-auto text-fd-muted-foreground size-3.5! transition-transform", !open && "-rotate-90") });
|
|
164
|
-
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
165
|
-
open,
|
|
166
|
-
onOpenChange: setOpen,
|
|
167
|
-
className: cn("mt-4 first:mt-0", className),
|
|
168
|
-
children: [item.url ? /* @__PURE__ */ jsxs("div", {
|
|
169
|
-
className: "flex w-full text-sm px-2.5 py-1.5 font-medium",
|
|
170
|
-
children: [/* @__PURE__ */ jsxs(Link, {
|
|
171
|
-
href: item.url,
|
|
172
|
-
external: item.external,
|
|
173
|
-
className: cn("inline-flex items-center gap-2 [&_svg]:size-4", isLinkItemActive(item, pathname) ? "text-fd-primary" : "hover:underline hover:decoration-fd-muted-foreground hover:underline-offset-4 hover:decoration-dashed hover:text-fd-accent-foreground"),
|
|
174
|
-
children: [item.icon, item.text]
|
|
175
|
-
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
176
|
-
className: "flex-1",
|
|
177
|
-
children: rightIcon
|
|
178
|
-
})]
|
|
179
|
-
}) : /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
180
|
-
className: "w-full text-sm px-2.5 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4",
|
|
181
|
-
children: [
|
|
182
|
-
item.icon,
|
|
183
|
-
item.text,
|
|
184
|
-
rightIcon
|
|
185
|
-
]
|
|
186
|
-
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
187
|
-
className: "flex flex-col",
|
|
188
|
-
children: item.items.map((item, i) => /* @__PURE__ */ jsx(SidebarLinkItem, { item }, i))
|
|
189
|
-
})]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
default: return /* @__PURE__ */ jsxs(Link, {
|
|
193
|
-
href: item.url,
|
|
194
|
-
external: item.external,
|
|
195
|
-
className: cn(itemTriggerVariants({
|
|
196
|
-
active: isLinkItemActive(item, pathname),
|
|
197
|
-
className
|
|
198
|
-
})),
|
|
199
|
-
children: [item.icon, item.text]
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
function renderNode(node) {
|
|
204
|
-
if (node.type === "page") return /* @__PURE__ */ jsx(SidebarItem, { item: node });
|
|
205
|
-
if (node.type === "folder") return /* @__PURE__ */ jsx(SidebarFolder, { folder: node });
|
|
206
|
-
return /* @__PURE__ */ jsxs("p", {
|
|
207
|
-
className: "mt-4 w-full text-sm px-2.5 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4 empty:hidden first:mt-0",
|
|
208
|
-
children: [node.icon, node.name]
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function SidebarItem({ item }) {
|
|
212
|
-
const path = useTreePath();
|
|
213
|
-
return /* @__PURE__ */ jsxs(Link, {
|
|
214
|
-
href: item.url,
|
|
215
|
-
external: item.external,
|
|
216
|
-
className: itemTriggerVariants({ active: isNodeInPath(item, path) }),
|
|
217
|
-
children: [item.icon, item.name]
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
function SidebarFolder({ folder }) {
|
|
221
|
-
const path = useTreePath();
|
|
222
|
-
const shouldOpen = (folder.defaultOpen ?? true) || isNodeInPath(folder, path);
|
|
223
|
-
const [open, setOpen] = useState(shouldOpen);
|
|
224
|
-
useOnChange(shouldOpen, () => shouldOpen && setOpen(true));
|
|
225
|
-
if (folder.collapsible === false) return /* @__PURE__ */ jsxs(Fragment, { children: [folder.index ? /* @__PURE__ */ jsxs(Link, {
|
|
226
|
-
href: folder.index.url,
|
|
227
|
-
external: folder.index.external,
|
|
228
|
-
className: cn("inline-flex text-sm px-2.5 py-1.5 font-medium items-center gap-2 [&_svg]:size-4 mt-4 first:mt-0", isNodeInPath(folder.index, path) ? "text-fd-primary" : "hover:underline hover:decoration-fd-muted-foreground hover:underline-offset-4 hover:decoration-dashed hover:text-fd-accent-foreground"),
|
|
229
|
-
children: [folder.icon, folder.name]
|
|
230
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
231
|
-
className: "w-full text-sm px-3 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4 mt-4 first:mt-0",
|
|
232
|
-
children: [folder.icon, folder.name]
|
|
233
|
-
}), folder.children.map((item, i) => cloneElement(renderNode(item), { key: i }))] });
|
|
234
|
-
const rightIcon = /* @__PURE__ */ jsx(ChevronDown, { className: cn("ms-auto text-fd-muted-foreground size-3.5! transition-transform", !open && "-rotate-90") });
|
|
235
|
-
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
236
|
-
open,
|
|
237
|
-
onOpenChange: setOpen,
|
|
238
|
-
className: "mt-4 first:mt-0",
|
|
239
|
-
children: [folder.index ? /* @__PURE__ */ jsxs("div", {
|
|
240
|
-
className: "flex w-full text-sm px-2.5 py-1.5 font-medium",
|
|
241
|
-
children: [/* @__PURE__ */ jsxs(Link, {
|
|
242
|
-
href: folder.index.url,
|
|
243
|
-
external: folder.index.external,
|
|
244
|
-
className: cn("inline-flex items-center gap-2 [&_svg]:size-4", isNodeInPath(folder.index, path) ? "text-fd-primary" : "hover:underline hover:decoration-fd-muted-foreground hover:underline-offset-4 hover:decoration-dashed hover:text-fd-accent-foreground"),
|
|
245
|
-
children: [folder.icon, folder.name]
|
|
246
|
-
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
247
|
-
className: "flex-1",
|
|
248
|
-
children: rightIcon
|
|
249
|
-
})]
|
|
250
|
-
}) : /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
251
|
-
className: "w-full text-sm px-2.5 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4",
|
|
252
|
-
children: [
|
|
253
|
-
folder.icon,
|
|
254
|
-
folder.name,
|
|
255
|
-
rightIcon
|
|
256
|
-
]
|
|
257
|
-
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
258
|
-
className: "flex flex-col",
|
|
259
|
-
children: folder.children.map((item, i) => cloneElement(renderNode(item), { key: i }))
|
|
260
|
-
})]
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
function isNodeInPath(node, path) {
|
|
264
|
-
return path.some((other) => other.$id === node.$id || other === node);
|
|
265
|
-
}
|
|
266
|
-
//#endregion
|
|
267
|
-
export { Sidebar, SidebarDrawer, SidebarProvider, useSidebar };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/glass/slots/sidebar';
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { baseSlots } from "../shared/client.js";
|
|
3
|
-
import { useLinkItems } from "../shared/index.js";
|
|
4
|
-
import { Container } from "./slots/container.js";
|
|
5
|
-
import { Header } from "./slots/header.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { createContext, use } from "react";
|
|
8
|
-
//#region src/layouts/home/index.tsx
|
|
9
|
-
const LayoutContext = createContext(null);
|
|
10
|
-
function useHomeLayout() {
|
|
11
|
-
const context = use(LayoutContext);
|
|
12
|
-
if (!context) throw new Error("Please use this component under <HomeLayout /> (`@vx-oss/docs-react/layouts/home`).");
|
|
13
|
-
return context;
|
|
14
|
-
}
|
|
15
|
-
const { useBaseSlots } = baseSlots({ useProps() {
|
|
16
|
-
return useHomeLayout().props;
|
|
17
|
-
} });
|
|
18
|
-
function HomeLayout(props) {
|
|
19
|
-
const { nav: { enabled: navEnabled = true } = {}, slots: defaultSlots, children, i18n: _i18n, githubUrl: _githubUrl, links: _links, themeSwitch: _themeSwitch, searchToggle: _searchToggle, ...rest } = props;
|
|
20
|
-
const { baseSlots, baseProps } = useBaseSlots(props);
|
|
21
|
-
const linkItems = useLinkItems(props);
|
|
22
|
-
const slots = {
|
|
23
|
-
...baseSlots,
|
|
24
|
-
header: defaultSlots?.header ?? Header,
|
|
25
|
-
container: defaultSlots?.container ?? Container
|
|
26
|
-
};
|
|
27
|
-
return /* @__PURE__ */ jsx(LayoutContext, {
|
|
28
|
-
value: {
|
|
29
|
-
props: baseProps,
|
|
30
|
-
slots,
|
|
31
|
-
...linkItems
|
|
32
|
-
},
|
|
33
|
-
children: /* @__PURE__ */ jsxs(slots.container, {
|
|
34
|
-
...rest,
|
|
35
|
-
children: [navEnabled && /* @__PURE__ */ jsx(slots.header, {}), children]
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { HomeLayout, useHomeLayout };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/home';
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger } from "../../components/ui/navigation-menu.js";
|
|
4
|
-
import { navItemVariants } from "./slots/header.js";
|
|
5
|
-
import Link from "@vx-oss/docs-core/link";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
//#region src/layouts/home/navbar.tsx
|
|
8
|
-
const NavbarMenu = NavigationMenuItem;
|
|
9
|
-
function NavbarMenuContent(props) {
|
|
10
|
-
return /* @__PURE__ */ jsx(NavigationMenuContent, {
|
|
11
|
-
...props,
|
|
12
|
-
className: cn("grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", props.className),
|
|
13
|
-
children: props.children
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function NavbarMenuTrigger(props) {
|
|
17
|
-
return /* @__PURE__ */ jsx(NavigationMenuTrigger, {
|
|
18
|
-
...props,
|
|
19
|
-
className: cn(navItemVariants(), "text-sm rounded-md", props.className),
|
|
20
|
-
children: props.children
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function NavbarMenuLink(props) {
|
|
24
|
-
return /* @__PURE__ */ jsx(NavigationMenuLink, {
|
|
25
|
-
asChild: true,
|
|
26
|
-
children: /* @__PURE__ */ jsx(Link, {
|
|
27
|
-
...props,
|
|
28
|
-
className: cn("flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground", props.className),
|
|
29
|
-
children: props.children
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/home/navbar';
|
|
@@ -1,41 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { buttonVariants } from "../../components/ui/button.js";
|
|
4
|
-
import Link from "@vx-oss/docs-core/link";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { HomeIcon } from "lucide-react";
|
|
7
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
-
//#region src/layouts/home/not-found.tsx
|
|
9
|
-
/**
|
|
10
|
-
* the default not found page content, please make your own if you want to customize it.
|
|
11
|
-
*/
|
|
12
|
-
function DefaultNotFound() {
|
|
13
|
-
const t = useTranslations({ note: "404 page" });
|
|
14
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
-
className: "flex flex-col px-8 justify-center flex-1 text-center items-center gap-4",
|
|
16
|
-
children: [
|
|
17
|
-
/* @__PURE__ */ jsx("h1", {
|
|
18
|
-
className: "text-6xl font-bold text-fd-muted-foreground",
|
|
19
|
-
children: "404"
|
|
20
|
-
}),
|
|
21
|
-
/* @__PURE__ */ jsx("h2", {
|
|
22
|
-
className: "text-2xl font-semibold",
|
|
23
|
-
children: t("Page Not Found")
|
|
24
|
-
}),
|
|
25
|
-
/* @__PURE__ */ jsx("p", {
|
|
26
|
-
className: "text-fd-muted-foreground max-w-md",
|
|
27
|
-
children: t("The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.")
|
|
28
|
-
}),
|
|
29
|
-
/* @__PURE__ */ jsxs(Link, {
|
|
30
|
-
href: "/",
|
|
31
|
-
className: cn(buttonVariants({
|
|
32
|
-
className: "mt-4 gap-1.5",
|
|
33
|
-
variant: "primary"
|
|
34
|
-
})),
|
|
35
|
-
children: [/* @__PURE__ */ jsx(HomeIcon, { className: "size-4" }), t("Back to Home")]
|
|
36
|
-
})
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { DefaultNotFound };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/home/not-found';
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../../utils/cn.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
//#region src/layouts/home/slots/container.tsx
|
|
5
|
-
function Container(props) {
|
|
6
|
-
return /* @__PURE__ */ jsx("main", {
|
|
7
|
-
id: "nd-home-layout",
|
|
8
|
-
...props,
|
|
9
|
-
className: cn("flex flex-1 flex-col [--fd-layout-width:1400px]", props.className)
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { Container };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/home/slots/container';
|