@hanzo/docs-base-ui 16.5.0 → 16.7.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/aspen.css +39 -0
- package/css/black.css +39 -1
- package/css/catppuccin.css +49 -1
- package/css/dusk.css +47 -1
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +490 -0
- package/css/generated/flux.css +429 -0
- package/css/generated/home.css +285 -0
- package/css/generated/notebook.css +526 -0
- package/css/generated/shared.css +1173 -0
- package/css/lib/base.css +214 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +98 -0
- package/css/neutral.css +7 -1
- package/css/ocean.css +44 -1
- package/css/preset.css +9 -7
- package/css/purple.css +39 -1
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -1
- package/css/solar.css +75 -1
- package/css/vitepress.css +65 -1
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +2 -3
- package/dist/components/accordion.js +9 -13
- package/dist/components/banner.d.ts +3 -4
- package/dist/components/banner.js +5 -9
- package/dist/components/callout.d.ts +6 -7
- package/dist/components/callout.js +1 -4
- package/dist/components/card.d.ts +4 -5
- package/dist/components/card.js +2 -5
- package/dist/components/codeblock.d.ts +8 -9
- package/dist/components/codeblock.js +9 -13
- package/dist/components/codeblock.rsc.d.ts +21 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +7 -9
- package/dist/components/dialog/search-algolia.js +8 -12
- package/dist/components/dialog/search-default.d.ts +7 -9
- package/dist/components/dialog/search-default.js +8 -12
- package/dist/components/dialog/search-orama.d.ts +7 -9
- package/dist/components/dialog/search-orama.js +8 -12
- package/dist/components/dialog/search.d.ts +21 -21
- package/dist/components/dialog/search.js +137 -60
- package/dist/components/dynamic-codeblock.core.d.ts +35 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +7 -29
- package/dist/components/dynamic-codeblock.js +11 -60
- package/dist/components/files.d.ts +1 -2
- package/dist/components/files.js +6 -10
- package/dist/components/github-info.d.ts +23 -10
- package/dist/components/github-info.js +34 -29
- package/dist/components/heading.d.ts +1 -2
- package/dist/components/heading.js +3 -6
- package/dist/components/image-zoom.d.ts +4 -5
- package/dist/components/image-zoom.js +2 -5
- package/dist/components/inline-toc.d.ts +3 -4
- package/dist/components/inline-toc.js +2 -6
- package/dist/components/sidebar/base.d.ts +29 -23
- package/dist/components/sidebar/base.js +16 -22
- package/dist/components/sidebar/link-item.d.ts +3 -4
- package/dist/components/sidebar/link-item.js +6 -3
- package/dist/components/sidebar/page-tree.d.ts +3 -4
- package/dist/components/sidebar/page-tree.js +56 -45
- package/dist/components/sidebar/tabs/dropdown.d.ts +6 -9
- package/dist/components/sidebar/tabs/dropdown.js +22 -29
- package/dist/components/sidebar/tabs/index.d.ts +3 -17
- package/dist/components/sidebar/tabs/index.js +0 -3
- package/dist/components/steps.d.ts +4 -5
- package/dist/components/steps.js +0 -3
- package/dist/components/tabs.d.ts +15 -11
- package/dist/components/tabs.js +15 -20
- package/dist/components/toc/clerk.d.ts +19 -1
- package/dist/components/toc/clerk.js +165 -10
- package/dist/components/toc/default.d.ts +19 -1
- package/dist/components/toc/default.js +45 -10
- package/dist/components/toc/index.d.ts +29 -1
- package/dist/components/toc/index.js +105 -10
- package/dist/components/type-table.d.ts +11 -6
- package/dist/components/type-table.js +28 -23
- package/dist/components/ui/accordion.d.ts +7 -8
- package/dist/components/ui/accordion.js +2 -6
- package/dist/components/ui/button.d.ts +1 -2
- package/dist/components/ui/button.js +0 -3
- package/dist/components/ui/collapsible.d.ts +6 -7
- package/dist/components/ui/collapsible.js +3 -7
- package/dist/components/ui/navigation-menu.d.ts +27 -13
- package/dist/components/ui/navigation-menu.js +53 -31
- package/dist/components/ui/popover.d.ts +11 -6
- package/dist/components/ui/popover.js +15 -19
- package/dist/components/ui/scroll-area.d.ts +17 -7
- package/dist/components/ui/scroll-area.js +27 -31
- package/dist/components/ui/tabs.d.ts +8 -9
- package/dist/components/ui/tabs.js +5 -9
- package/dist/contexts/i18n.d.ts +62 -1
- package/dist/contexts/i18n.js +53 -10
- package/dist/contexts/search.d.ts +71 -5
- package/dist/contexts/search.js +64 -10
- package/dist/contexts/tree.d.ts +21 -1
- package/dist/contexts/tree.js +36 -10
- package/dist/i18n.d.ts +21 -1
- package/dist/i18n.js +20 -3
- package/dist/layouts/docs/client.d.ts +30 -29
- package/dist/layouts/docs/client.js +76 -52
- package/dist/layouts/docs/index.d.ts +21 -35
- package/dist/layouts/docs/index.js +16 -172
- package/dist/layouts/docs/page/index.d.ts +75 -52
- package/dist/layouts/docs/page/index.js +76 -56
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +7 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +23 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +55 -0
- package/dist/layouts/docs/page/slots/toc.js +166 -0
- package/dist/layouts/docs/slots/container.d.ts +7 -0
- package/dist/layouts/docs/slots/container.js +29 -0
- package/dist/layouts/docs/slots/header.d.ts +8 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +30 -0
- package/dist/layouts/docs/slots/sidebar.js +319 -0
- package/dist/layouts/flux/index.d.ts +74 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +105 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +7 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +23 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +34 -0
- package/dist/layouts/flux/page/slots/toc.js +172 -0
- package/dist/layouts/flux/slots/container.d.ts +7 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +23 -0
- package/dist/layouts/flux/slots/sidebar.js +237 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +17 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
- package/dist/layouts/home/index.d.ts +25 -8
- package/dist/layouts/home/index.js +39 -19
- package/dist/layouts/home/navbar.d.ts +7 -16
- package/dist/layouts/home/navbar.js +12 -14
- package/dist/layouts/home/not-found.d.ts +9 -0
- package/dist/layouts/home/not-found.js +38 -0
- package/dist/layouts/home/slots/container.d.ts +7 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +11 -0
- package/dist/layouts/home/slots/header.js +242 -0
- package/dist/layouts/notebook/client.d.ts +32 -44
- package/dist/layouts/notebook/client.js +58 -148
- package/dist/layouts/notebook/index.d.ts +26 -25
- package/dist/layouts/notebook/index.js +16 -213
- package/dist/layouts/notebook/page/index.d.ts +75 -52
- package/dist/layouts/notebook/page/index.js +76 -56
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +23 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +55 -0
- package/dist/layouts/notebook/page/slots/toc.js +165 -0
- package/dist/layouts/notebook/slots/container.d.ts +7 -0
- package/dist/layouts/notebook/slots/container.js +31 -0
- package/dist/layouts/notebook/slots/header.d.ts +8 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +40 -0
- package/dist/layouts/notebook/slots/sidebar.js +297 -0
- package/dist/layouts/shared/client.d.ts +45 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +144 -35
- package/dist/layouts/shared/index.js +74 -15
- package/dist/layouts/shared/page-actions.d.ts +36 -0
- package/dist/layouts/shared/page-actions.js +190 -0
- package/dist/layouts/shared/slots/language-select.d.ts +10 -0
- package/dist/layouts/shared/{language-toggle.js → slots/language-select.js} +12 -16
- package/dist/layouts/shared/slots/search-trigger.d.ts +23 -0
- package/dist/layouts/shared/{search-toggle.js → slots/search-trigger.js} +12 -16
- package/dist/layouts/shared/slots/theme-switch.d.ts +14 -0
- package/dist/layouts/shared/{theme-toggle.js → slots/theme-switch.js} +11 -15
- package/dist/mdx.d.ts +23 -13
- package/dist/mdx.js +2 -6
- package/dist/mdx.server.d.ts +1 -3
- package/dist/mdx.server.js +0 -3
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +70 -0
- package/dist/og.d.ts +22 -1
- package/dist/og.js +70 -3
- package/dist/page.d.ts +6 -7
- package/dist/page.js +9 -14
- package/dist/provider/base.d.ts +5 -6
- package/dist/provider/base.js +5 -9
- package/dist/provider/next.d.ts +4 -5
- package/dist/provider/next.js +1 -5
- package/dist/provider/react-router.d.ts +4 -5
- package/dist/provider/react-router.js +1 -5
- package/dist/provider/tanstack.d.ts +4 -5
- package/dist/provider/tanstack.js +1 -5
- package/dist/provider/waku.d.ts +4 -5
- package/dist/provider/waku.js +1 -5
- package/dist/style.css +594 -192
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +6 -1
- package/dist/utils/use-copy-button.js +26 -3
- package/dist/utils/use-footer-items.d.ts +9 -1
- package/dist/utils/use-footer-items.js +24 -3
- package/dist/utils/use-is-scroll-top.d.ts +8 -1
- package/dist/utils/use-is-scroll-top.js +20 -3
- package/package.json +133 -81
- package/css/layouts/docs.css +0 -1
- package/css/layouts/home.css +0 -1
- package/css/layouts/notebook.css +0 -1
- package/dist/_virtual/rolldown_runtime.js +0 -36
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/accordion.js.map +0 -1
- package/dist/components/banner.d.ts.map +0 -1
- package/dist/components/banner.js.map +0 -1
- package/dist/components/callout.d.ts.map +0 -1
- package/dist/components/callout.js.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/card.js.map +0 -1
- package/dist/components/codeblock.d.ts.map +0 -1
- package/dist/components/codeblock.js.map +0 -1
- package/dist/components/dialog/search-algolia.d.ts.map +0 -1
- package/dist/components/dialog/search-algolia.js.map +0 -1
- package/dist/components/dialog/search-default.d.ts.map +0 -1
- package/dist/components/dialog/search-default.js.map +0 -1
- package/dist/components/dialog/search-orama.d.ts.map +0 -1
- package/dist/components/dialog/search-orama.js.map +0 -1
- package/dist/components/dialog/search.d.ts.map +0 -1
- package/dist/components/dialog/search.js.map +0 -1
- package/dist/components/dynamic-codeblock.d.ts.map +0 -1
- package/dist/components/dynamic-codeblock.js.map +0 -1
- package/dist/components/files.d.ts.map +0 -1
- package/dist/components/files.js.map +0 -1
- package/dist/components/github-info.d.ts.map +0 -1
- package/dist/components/github-info.js.map +0 -1
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/heading.js.map +0 -1
- package/dist/components/image-zoom-CtfZieBH.css +0 -80
- package/dist/components/image-zoom-CtfZieBH.css.map +0 -1
- package/dist/components/image-zoom.d.ts.map +0 -1
- package/dist/components/image-zoom.js.map +0 -1
- package/dist/components/image-zoom2.js +0 -1
- package/dist/components/inline-toc.d.ts.map +0 -1
- package/dist/components/inline-toc.js.map +0 -1
- package/dist/components/sidebar/base.d.ts.map +0 -1
- package/dist/components/sidebar/base.js.map +0 -1
- package/dist/components/sidebar/link-item.d.ts.map +0 -1
- package/dist/components/sidebar/link-item.js.map +0 -1
- package/dist/components/sidebar/page-tree.d.ts.map +0 -1
- package/dist/components/sidebar/page-tree.js.map +0 -1
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +0 -1
- package/dist/components/sidebar/tabs/dropdown.js.map +0 -1
- package/dist/components/sidebar/tabs/index.d.ts.map +0 -1
- package/dist/components/sidebar/tabs/index.js.map +0 -1
- package/dist/components/steps.d.ts.map +0 -1
- package/dist/components/steps.js.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.js.map +0 -1
- package/dist/components/toc/clerk.js.map +0 -1
- package/dist/components/toc/default.js.map +0 -1
- package/dist/components/toc/index.js.map +0 -1
- package/dist/components/type-table.d.ts.map +0 -1
- package/dist/components/type-table.js.map +0 -1
- package/dist/components/ui/accordion.d.ts.map +0 -1
- package/dist/components/ui/accordion.js.map +0 -1
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/button.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/navigation-menu.d.ts.map +0 -1
- package/dist/components/ui/navigation-menu.js.map +0 -1
- package/dist/components/ui/popover.d.ts.map +0 -1
- package/dist/components/ui/popover.js.map +0 -1
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.js.map +0 -1
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/ui/tabs.js.map +0 -1
- package/dist/contexts/i18n.js.map +0 -1
- package/dist/contexts/search.d.ts.map +0 -1
- package/dist/contexts/search.js.map +0 -1
- package/dist/contexts/tree.js.map +0 -1
- package/dist/layouts/docs/client.d.ts.map +0 -1
- package/dist/layouts/docs/client.js.map +0 -1
- package/dist/layouts/docs/index.d.ts.map +0 -1
- package/dist/layouts/docs/index.js.map +0 -1
- package/dist/layouts/docs/page/client.d.ts +0 -46
- package/dist/layouts/docs/page/client.d.ts.map +0 -1
- package/dist/layouts/docs/page/client.js +0 -227
- package/dist/layouts/docs/page/client.js.map +0 -1
- package/dist/layouts/docs/page/index.d.ts.map +0 -1
- package/dist/layouts/docs/page/index.js.map +0 -1
- package/dist/layouts/docs/sidebar.d.ts +0 -63
- package/dist/layouts/docs/sidebar.d.ts.map +0 -1
- package/dist/layouts/docs/sidebar.js +0 -162
- package/dist/layouts/docs/sidebar.js.map +0 -1
- package/dist/layouts/home/client.d.ts +0 -19
- package/dist/layouts/home/client.d.ts.map +0 -1
- package/dist/layouts/home/client.js +0 -285
- package/dist/layouts/home/client.js.map +0 -1
- package/dist/layouts/home/index.d.ts.map +0 -1
- package/dist/layouts/home/index.js.map +0 -1
- package/dist/layouts/home/navbar.d.ts.map +0 -1
- package/dist/layouts/home/navbar.js.map +0 -1
- package/dist/layouts/notebook/client.d.ts.map +0 -1
- package/dist/layouts/notebook/client.js.map +0 -1
- package/dist/layouts/notebook/index.d.ts.map +0 -1
- package/dist/layouts/notebook/index.js.map +0 -1
- package/dist/layouts/notebook/page/client.d.ts +0 -46
- package/dist/layouts/notebook/page/client.d.ts.map +0 -1
- package/dist/layouts/notebook/page/client.js +0 -227
- package/dist/layouts/notebook/page/client.js.map +0 -1
- package/dist/layouts/notebook/page/index.d.ts.map +0 -1
- package/dist/layouts/notebook/page/index.js.map +0 -1
- package/dist/layouts/notebook/sidebar.d.ts +0 -59
- package/dist/layouts/notebook/sidebar.d.ts.map +0 -1
- package/dist/layouts/notebook/sidebar.js +0 -133
- package/dist/layouts/notebook/sidebar.js.map +0 -1
- package/dist/layouts/shared/index.d.ts.map +0 -1
- package/dist/layouts/shared/index.js.map +0 -1
- package/dist/layouts/shared/language-toggle.d.ts +0 -10
- package/dist/layouts/shared/language-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/language-toggle.js.map +0 -1
- package/dist/layouts/shared/search-toggle.d.ts +0 -23
- package/dist/layouts/shared/search-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/search-toggle.js.map +0 -1
- package/dist/layouts/shared/theme-toggle.d.ts +0 -14
- package/dist/layouts/shared/theme-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/theme-toggle.js.map +0 -1
- package/dist/mdx.d.ts.map +0 -1
- package/dist/mdx.js.map +0 -1
- package/dist/mdx.server.d.ts.map +0 -1
- package/dist/mdx.server.js.map +0 -1
- package/dist/page.d.ts.map +0 -1
- package/dist/page.js.map +0 -1
- package/dist/provider/base.d.ts.map +0 -1
- package/dist/provider/base.js.map +0 -1
- package/dist/provider/next.d.ts.map +0 -1
- package/dist/provider/next.js.map +0 -1
- package/dist/provider/react-router.d.ts.map +0 -1
- package/dist/provider/react-router.js.map +0 -1
- package/dist/provider/tanstack.d.ts.map +0 -1
- package/dist/provider/tanstack.js.map +0 -1
- package/dist/provider/waku.d.ts.map +0 -1
- package/dist/provider/waku.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import * as PageTree from "@hanzo/docs-core/page-tree";
|
|
4
|
+
|
|
5
|
+
//#region src/layouts/notebook/page/slots/footer.d.ts
|
|
6
|
+
type Item = Pick<PageTree.Item, 'name' | 'description' | 'url'>;
|
|
7
|
+
interface FooterProps extends ComponentProps<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* Items including information for the next and previous page
|
|
10
|
+
*/
|
|
11
|
+
items?: {
|
|
12
|
+
previous?: Item;
|
|
13
|
+
next?: Item;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare function Footer({
|
|
17
|
+
items,
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: FooterProps): react_jsx_runtime0.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Footer, FooterProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useI18n } from "../../../../contexts/i18n.js";
|
|
3
|
+
import { cn } from "../../../../utils/cn.js";
|
|
4
|
+
import { isActive } from "../../../../utils/urls.js";
|
|
5
|
+
import { useFooterItems } from "../../../../utils/use-footer-items.js";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import { usePathname } from "@hanzo/docs-core/framework";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import Link from "@hanzo/docs-core/link";
|
|
10
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
11
|
+
//#region src/layouts/notebook/page/slots/footer.tsx
|
|
12
|
+
function Footer({ items, children, className, ...props }) {
|
|
13
|
+
const footerList = useFooterItems();
|
|
14
|
+
const pathname = usePathname();
|
|
15
|
+
const { previous, next } = useMemo(() => {
|
|
16
|
+
if (items) return items;
|
|
17
|
+
const idx = footerList.findIndex((item) => isActive(item.url, pathname));
|
|
18
|
+
if (idx === -1) return {};
|
|
19
|
+
return {
|
|
20
|
+
previous: footerList[idx - 1],
|
|
21
|
+
next: footerList[idx + 1]
|
|
22
|
+
};
|
|
23
|
+
}, [
|
|
24
|
+
footerList,
|
|
25
|
+
items,
|
|
26
|
+
pathname
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cn("@container grid gap-4", previous && next ? "grid-cols-2" : "grid-cols-1", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: [previous && /* @__PURE__ */ jsx(FooterItem, {
|
|
32
|
+
item: previous,
|
|
33
|
+
index: 0
|
|
34
|
+
}), next && /* @__PURE__ */ jsx(FooterItem, {
|
|
35
|
+
item: next,
|
|
36
|
+
index: 1
|
|
37
|
+
})]
|
|
38
|
+
}), children] });
|
|
39
|
+
}
|
|
40
|
+
function FooterItem({ item, index }) {
|
|
41
|
+
const { text } = useI18n();
|
|
42
|
+
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
43
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
44
|
+
href: item.url,
|
|
45
|
+
className: cn("flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full", index === 1 && "text-end"),
|
|
46
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: cn("inline-flex items-center gap-1.5 font-medium", index === 1 && "flex-row-reverse"),
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), /* @__PURE__ */ jsx("p", { children: item.name })]
|
|
49
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
50
|
+
className: "text-fd-muted-foreground truncate",
|
|
51
|
+
children: item.description ?? (index === 0 ? text.previousPage : text.nextPage)
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Footer };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/layouts/notebook/page/slots/toc.d.ts
|
|
6
|
+
type TOCProviderProps = TOCProviderProps$1;
|
|
7
|
+
declare function TOCProvider(props: TOCProviderProps): react_jsx_runtime0.JSX.Element;
|
|
8
|
+
interface TOCProps {
|
|
9
|
+
container?: ComponentProps<'div'>;
|
|
10
|
+
/**
|
|
11
|
+
* Custom content in TOC container, before the main TOC
|
|
12
|
+
*/
|
|
13
|
+
header?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Custom content in TOC container, after the main TOC
|
|
16
|
+
*/
|
|
17
|
+
footer?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* @defaultValue 'normal'
|
|
20
|
+
*/
|
|
21
|
+
style?: 'normal' | 'clerk';
|
|
22
|
+
}
|
|
23
|
+
declare function TOC({
|
|
24
|
+
container,
|
|
25
|
+
header,
|
|
26
|
+
footer,
|
|
27
|
+
style
|
|
28
|
+
}: TOCProps): react_jsx_runtime0.JSX.Element;
|
|
29
|
+
interface TOCPopoverProps {
|
|
30
|
+
container?: ComponentProps<'div'>;
|
|
31
|
+
trigger?: ComponentProps<'button'>;
|
|
32
|
+
content?: ComponentProps<'div'>;
|
|
33
|
+
/**
|
|
34
|
+
* Custom content in TOC container, before the main TOC
|
|
35
|
+
*/
|
|
36
|
+
header?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Custom content in TOC container, after the main TOC
|
|
39
|
+
*/
|
|
40
|
+
footer?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* @defaultValue 'normal'
|
|
43
|
+
*/
|
|
44
|
+
style?: 'normal' | 'clerk';
|
|
45
|
+
}
|
|
46
|
+
declare function TOCPopover({
|
|
47
|
+
container,
|
|
48
|
+
trigger,
|
|
49
|
+
content,
|
|
50
|
+
header,
|
|
51
|
+
footer,
|
|
52
|
+
style
|
|
53
|
+
}: TOCPopoverProps): react_jsx_runtime0.JSX.Element;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { TOC, TOCPopover, TOCPopoverProps, TOCProps, TOCProvider, TOCProviderProps };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { I18nLabel, useI18n } from "../../../../contexts/i18n.js";
|
|
3
|
+
import { cn } from "../../../../utils/cn.js";
|
|
4
|
+
import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
|
|
5
|
+
import { default_exports } from "../../../../components/toc/default.js";
|
|
6
|
+
import { clerk_exports } from "../../../../components/toc/clerk.js";
|
|
7
|
+
import { useTreePath } from "../../../../contexts/tree.js";
|
|
8
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
|
|
9
|
+
import { useNotebookLayout } from "../../client.js";
|
|
10
|
+
import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { ChevronDown, Text } from "lucide-react";
|
|
13
|
+
//#region src/layouts/notebook/page/slots/toc.tsx
|
|
14
|
+
function TOCProvider(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
|
|
16
|
+
}
|
|
17
|
+
function TOC({ container, header, footer, style = "normal" }) {
|
|
18
|
+
const items = useTOCItems();
|
|
19
|
+
const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
id: "nd-toc",
|
|
22
|
+
...container,
|
|
23
|
+
className: cn("sticky top-(--fd-docs-row-3) [grid-area:toc] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] flex flex-col w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", container?.className),
|
|
24
|
+
children: [
|
|
25
|
+
header,
|
|
26
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
27
|
+
id: "toc-title",
|
|
28
|
+
className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
|
|
29
|
+
children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(I18nLabel, { label: "toc" })]
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
|
|
32
|
+
footer
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const TocPopoverContext = createContext(null);
|
|
37
|
+
function TOCPopover({ container, trigger, content, header, footer, style = "normal" }) {
|
|
38
|
+
const items = useTOCItems();
|
|
39
|
+
const ref = useRef(null);
|
|
40
|
+
const [open, setOpen] = useState(false);
|
|
41
|
+
const { isNavTransparent } = useNotebookLayout();
|
|
42
|
+
const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
|
|
43
|
+
const onClickOutside = useEffectEvent((e) => {
|
|
44
|
+
if (!open || !(e.target instanceof HTMLElement)) return;
|
|
45
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
46
|
+
});
|
|
47
|
+
const onClickItem = () => {
|
|
48
|
+
setOpen(false);
|
|
49
|
+
};
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
window.addEventListener("click", onClickOutside);
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener("click", onClickOutside);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
return /* @__PURE__ */ jsx(TocPopoverContext, {
|
|
57
|
+
value: useMemo(() => ({
|
|
58
|
+
open,
|
|
59
|
+
setOpen
|
|
60
|
+
}), [setOpen, open]),
|
|
61
|
+
children: /* @__PURE__ */ jsx(Collapsible, {
|
|
62
|
+
open,
|
|
63
|
+
onOpenChange: setOpen,
|
|
64
|
+
"data-toc-popover": "",
|
|
65
|
+
...container,
|
|
66
|
+
className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
|
|
67
|
+
children: /* @__PURE__ */ jsxs("header", {
|
|
68
|
+
ref,
|
|
69
|
+
className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
|
|
70
|
+
children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
|
|
71
|
+
...content,
|
|
72
|
+
children: [
|
|
73
|
+
header,
|
|
74
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
|
|
75
|
+
item,
|
|
76
|
+
onClick: onClickItem
|
|
77
|
+
}, item.url))] }) }),
|
|
78
|
+
footer
|
|
79
|
+
]
|
|
80
|
+
})]
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function PageTOCPopoverTrigger({ className, ...props }) {
|
|
86
|
+
const { text } = useI18n();
|
|
87
|
+
const { open } = use(TocPopoverContext);
|
|
88
|
+
const items = useItems();
|
|
89
|
+
const selectedIdx = items.findIndex((item) => item.active);
|
|
90
|
+
const path = useTreePath().at(-1);
|
|
91
|
+
const showItem = selectedIdx !== -1 && !open;
|
|
92
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
93
|
+
className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
|
|
94
|
+
"data-toc-popover-trigger": "",
|
|
95
|
+
...props,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(ProgressCircle, {
|
|
98
|
+
value: (selectedIdx + 1) / Math.max(1, items.length),
|
|
99
|
+
max: 1,
|
|
100
|
+
className: cn("shrink-0", open && "text-fd-primary")
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ jsxs("span", {
|
|
103
|
+
className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
|
|
104
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
105
|
+
className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
|
|
106
|
+
children: path?.name ?? text.toc
|
|
107
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
|
|
109
|
+
children: items[selectedIdx]?.original.title
|
|
110
|
+
})]
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function clamp(input, min, max) {
|
|
117
|
+
if (input < min) return min;
|
|
118
|
+
if (input > max) return max;
|
|
119
|
+
return input;
|
|
120
|
+
}
|
|
121
|
+
function ProgressCircle({ value, strokeWidth = 2, size = 24, min = 0, max = 100, ...restSvgProps }) {
|
|
122
|
+
const normalizedValue = clamp(value, min, max);
|
|
123
|
+
const radius = (size - strokeWidth) / 2;
|
|
124
|
+
const circumference = 2 * Math.PI * radius;
|
|
125
|
+
const progress = normalizedValue / max * circumference;
|
|
126
|
+
const circleProps = {
|
|
127
|
+
cx: size / 2,
|
|
128
|
+
cy: size / 2,
|
|
129
|
+
r: radius,
|
|
130
|
+
fill: "none",
|
|
131
|
+
strokeWidth
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
134
|
+
role: "progressbar",
|
|
135
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
136
|
+
"aria-valuenow": normalizedValue,
|
|
137
|
+
"aria-valuemin": min,
|
|
138
|
+
"aria-valuemax": max,
|
|
139
|
+
...restSvgProps,
|
|
140
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
141
|
+
...circleProps,
|
|
142
|
+
className: "stroke-current/25"
|
|
143
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
144
|
+
...circleProps,
|
|
145
|
+
stroke: "currentColor",
|
|
146
|
+
strokeDasharray: circumference,
|
|
147
|
+
strokeDashoffset: circumference - progress,
|
|
148
|
+
strokeLinecap: "round",
|
|
149
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`,
|
|
150
|
+
className: "transition-all"
|
|
151
|
+
})]
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function PageTOCPopoverContent(props) {
|
|
155
|
+
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
156
|
+
"data-toc-popover-content": "",
|
|
157
|
+
...props,
|
|
158
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: "flex flex-col px-4 max-h-[50vh] md:px-6",
|
|
160
|
+
children: props.children
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { TOC, TOCPopover, TOCProvider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/notebook/slots/container.d.ts
|
|
5
|
+
declare function Container(props: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Container };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useNotebookLayout } from "../client.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/layouts/notebook/slots/container.tsx
|
|
6
|
+
function Container(props) {
|
|
7
|
+
const { props: { nav }, slots } = useNotebookLayout();
|
|
8
|
+
const pageCol = "calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-col) - var(--fd-toc-width))";
|
|
9
|
+
const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
id: "nd-notebook-layout",
|
|
12
|
+
"data-sidebar-collapsed": collapsed,
|
|
13
|
+
...props,
|
|
14
|
+
style: {
|
|
15
|
+
gridTemplate: nav?.mode === "top" ? `". header header header ."
|
|
16
|
+
"sidebar sidebar toc-popover toc-popover ."
|
|
17
|
+
"sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)` : `"sidebar sidebar header header ."
|
|
18
|
+
"sidebar sidebar toc-popover toc-popover ."
|
|
19
|
+
"sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)`,
|
|
20
|
+
"--fd-docs-row-1": "var(--fd-banner-height, 0px)",
|
|
21
|
+
"--fd-docs-row-2": "calc(var(--fd-docs-row-1) + var(--fd-header-height))",
|
|
22
|
+
"--fd-docs-row-3": "calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))",
|
|
23
|
+
"--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
|
|
24
|
+
...props.style
|
|
25
|
+
},
|
|
26
|
+
className: cn("grid overflow-x-clip min-h-(--fd-docs-height) transition-[grid-template-columns] auto-cols-auto auto-rows-auto [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px]", props.className),
|
|
27
|
+
children: props.children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Container };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react from "react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/layouts/notebook/slots/header.d.ts
|
|
6
|
+
declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | react_jsx_runtime0.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Header };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
|
|
5
|
+
import { LinkItem } from "../../shared/client.js";
|
|
6
|
+
import { isLayoutTabActive } from "../../shared/index.js";
|
|
7
|
+
import { useNotebookLayout } from "../client.js";
|
|
8
|
+
import { Fragment, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { usePathname } from "@hanzo/docs-core/framework";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import Link from "@hanzo/docs-core/link";
|
|
12
|
+
import { ChevronDown, Languages, Sidebar } from "lucide-react";
|
|
13
|
+
//#region src/layouts/notebook/slots/header.tsx
|
|
14
|
+
function Header(props) {
|
|
15
|
+
const { slots, navItems, isNavTransparent, props: { tabMode, nav, tabs, sidebar } } = useNotebookLayout();
|
|
16
|
+
const { open } = slots.sidebar?.useSidebar?.() ?? {};
|
|
17
|
+
const navMode = nav?.mode ?? "auto";
|
|
18
|
+
const sidebarCollapsible = sidebar.collapsible ?? true;
|
|
19
|
+
const showLayoutTabs = tabMode === "navbar" && tabs.length > 0;
|
|
20
|
+
if (nav?.component) return nav.component;
|
|
21
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
22
|
+
id: "nd-subnav",
|
|
23
|
+
"data-transparent": isNavTransparent && !open,
|
|
24
|
+
...props,
|
|
25
|
+
className: cn("sticky [grid-area:header] flex flex-col top-(--fd-docs-row-1) z-10 backdrop-blur-sm transition-colors data-[transparent=false]:bg-fd-background/80 layout:[--fd-header-height:--spacing(14)]", showLayoutTabs && "lg:layout:[--fd-header-height:--spacing(24)]", props.className),
|
|
26
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
27
|
+
"data-header-body": "",
|
|
28
|
+
className: "flex border-b px-4 gap-2 h-14 md:px-6",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", {
|
|
31
|
+
className: cn("items-center", navMode === "top" && "flex flex-1", navMode === "auto" && "hidden has-data-[collapsed=true]:md:flex max-md:flex"),
|
|
32
|
+
children: [
|
|
33
|
+
sidebarCollapsible && slots.sidebar && navMode === "auto" && /* @__PURE__ */ jsx(slots.sidebar.collapseTrigger, {
|
|
34
|
+
className: cn(buttonVariants({
|
|
35
|
+
color: "ghost",
|
|
36
|
+
size: "icon-sm"
|
|
37
|
+
}), "text-fd-muted-foreground data-[collapsed=false]:hidden max-md:hidden"),
|
|
38
|
+
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
39
|
+
}),
|
|
40
|
+
slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: cn("inline-flex items-center gap-2.5 font-semibold", navMode === "auto" && "md:hidden") }),
|
|
41
|
+
nav?.children
|
|
42
|
+
]
|
|
43
|
+
}),
|
|
44
|
+
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
|
|
45
|
+
hideIfDisabled: true,
|
|
46
|
+
className: cn("w-full my-auto max-md:hidden", navMode === "top" ? "ps-2.5 rounded-xl max-w-sm" : "max-w-[240px]")
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsxs("div", {
|
|
49
|
+
className: "flex flex-1 items-center justify-end md:gap-2",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx("div", {
|
|
52
|
+
className: "flex items-center gap-6 empty:hidden max-lg:hidden",
|
|
53
|
+
children: navItems.filter((item) => item.type !== "icon").map((item, i) => /* @__PURE__ */ jsx(NavbarLinkItem, { item }, i))
|
|
54
|
+
}),
|
|
55
|
+
navItems.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
56
|
+
item,
|
|
57
|
+
className: cn(buttonVariants({
|
|
58
|
+
size: "icon-sm",
|
|
59
|
+
color: "ghost"
|
|
60
|
+
}), "text-fd-muted-foreground max-lg:hidden"),
|
|
61
|
+
"aria-label": item.label,
|
|
62
|
+
children: item.icon
|
|
63
|
+
}, i)),
|
|
64
|
+
/* @__PURE__ */ jsxs("div", {
|
|
65
|
+
className: "flex items-center md:hidden",
|
|
66
|
+
children: [slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
67
|
+
hideIfDisabled: true,
|
|
68
|
+
className: "p-2"
|
|
69
|
+
}), slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, {
|
|
70
|
+
className: cn(buttonVariants({
|
|
71
|
+
color: "ghost",
|
|
72
|
+
size: "icon-sm",
|
|
73
|
+
className: "p-2 -me-1.5"
|
|
74
|
+
})),
|
|
75
|
+
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
76
|
+
})]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", {
|
|
79
|
+
className: "flex items-center gap-2 max-md:hidden",
|
|
80
|
+
children: [
|
|
81
|
+
slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) }),
|
|
82
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {}),
|
|
83
|
+
sidebarCollapsible && slots.sidebar && navMode === "top" && /* @__PURE__ */ jsx(slots.sidebar.collapseTrigger, {
|
|
84
|
+
className: cn(buttonVariants({
|
|
85
|
+
color: "secondary",
|
|
86
|
+
size: "icon-sm"
|
|
87
|
+
}), "text-fd-muted-foreground rounded-full -me-1.5"),
|
|
88
|
+
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}), showLayoutTabs && /* @__PURE__ */ jsx(LayoutHeaderTabs, {
|
|
96
|
+
"data-header-tabs": "",
|
|
97
|
+
className: "overflow-x-auto border-b px-6 h-10 max-lg:hidden",
|
|
98
|
+
tabs
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function LayoutHeaderTabs({ tabs, className, ...props }) {
|
|
103
|
+
const pathname = usePathname();
|
|
104
|
+
const selectedIdx = useMemo(() => {
|
|
105
|
+
return tabs.findLastIndex((option) => isLayoutTabActive(option, pathname));
|
|
106
|
+
}, [tabs, pathname]);
|
|
107
|
+
return /* @__PURE__ */ jsx("div", {
|
|
108
|
+
className: cn("flex flex-row items-end gap-6", className),
|
|
109
|
+
...props,
|
|
110
|
+
children: tabs.map((option, i) => {
|
|
111
|
+
const { title, url, unlisted, props: { className, ...rest } = {} } = option;
|
|
112
|
+
const isSelected = selectedIdx === i;
|
|
113
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
114
|
+
href: url,
|
|
115
|
+
className: cn("inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground", unlisted && !isSelected && "hidden", isSelected && "border-fd-primary text-fd-primary", className),
|
|
116
|
+
...rest,
|
|
117
|
+
children: title
|
|
118
|
+
}, i);
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function NavbarLinkItem({ item, className, ...props }) {
|
|
123
|
+
if (item.type === "custom") return item.children;
|
|
124
|
+
if (item.type === "menu") return /* @__PURE__ */ jsx(NavbarLinkItemMenu, {
|
|
125
|
+
item,
|
|
126
|
+
className,
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
return /* @__PURE__ */ jsx(LinkItem, {
|
|
130
|
+
item,
|
|
131
|
+
className: cn("text-sm text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary", className),
|
|
132
|
+
...props,
|
|
133
|
+
children: item.text
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function NavbarLinkItemMenu({ item, hoverDelay = 50, className, ...props }) {
|
|
137
|
+
const [open, setOpen] = useState(false);
|
|
138
|
+
const timeoutRef = useRef(null);
|
|
139
|
+
const freezeUntil = useRef(null);
|
|
140
|
+
const delaySetOpen = (value) => {
|
|
141
|
+
if (timeoutRef.current) {
|
|
142
|
+
clearTimeout(timeoutRef.current);
|
|
143
|
+
timeoutRef.current = null;
|
|
144
|
+
}
|
|
145
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
146
|
+
setOpen(value);
|
|
147
|
+
freezeUntil.current = Date.now() + 300;
|
|
148
|
+
}, hoverDelay);
|
|
149
|
+
};
|
|
150
|
+
const onPointerEnter = (e) => {
|
|
151
|
+
if (e.pointerType === "touch") return;
|
|
152
|
+
delaySetOpen(true);
|
|
153
|
+
};
|
|
154
|
+
const onPointerLeave = (e) => {
|
|
155
|
+
if (e.pointerType === "touch") return;
|
|
156
|
+
delaySetOpen(false);
|
|
157
|
+
};
|
|
158
|
+
function isTouchDevice() {
|
|
159
|
+
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
160
|
+
}
|
|
161
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
162
|
+
open,
|
|
163
|
+
onOpenChange: (value) => {
|
|
164
|
+
if (freezeUntil.current === null || Date.now() >= freezeUntil.current) setOpen(value);
|
|
165
|
+
},
|
|
166
|
+
children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
167
|
+
className: cn("inline-flex items-center gap-1.5 p-1 text-sm text-fd-muted-foreground transition-colors has-data-[active=true]:text-fd-primary data-[state=open]:text-fd-accent-foreground focus-visible:outline-none", className),
|
|
168
|
+
onPointerEnter,
|
|
169
|
+
onPointerLeave,
|
|
170
|
+
...props,
|
|
171
|
+
children: [item.url ? /* @__PURE__ */ jsx(LinkItem, {
|
|
172
|
+
item,
|
|
173
|
+
children: item.text
|
|
174
|
+
}) : item.text, /* @__PURE__ */ jsx(ChevronDown, { className: "size-3" })]
|
|
175
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
176
|
+
className: "flex flex-col p-1 text-fd-muted-foreground text-start",
|
|
177
|
+
onPointerEnter,
|
|
178
|
+
onPointerLeave,
|
|
179
|
+
children: item.items.map((child, i) => {
|
|
180
|
+
if (child.type === "custom") return /* @__PURE__ */ jsx(Fragment, { children: child.children }, i);
|
|
181
|
+
return /* @__PURE__ */ jsxs(LinkItem, {
|
|
182
|
+
item: child,
|
|
183
|
+
className: "inline-flex items-center gap-2 rounded-md p-2 transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4",
|
|
184
|
+
onClick: () => {
|
|
185
|
+
if (isTouchDevice()) setOpen(false);
|
|
186
|
+
},
|
|
187
|
+
children: [child.icon, child.text]
|
|
188
|
+
}, i);
|
|
189
|
+
})
|
|
190
|
+
})]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
export { Header };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SidebarProviderProps as SidebarProviderProps$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
|
|
2
|
+
import { LayoutTab } from "../../shared/index.js";
|
|
3
|
+
import { SidebarPageTreeComponents } from "../../../components/sidebar/page-tree.js";
|
|
4
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/layouts/notebook/slots/sidebar.d.ts
|
|
8
|
+
interface SidebarProps extends ComponentProps<'aside'> {
|
|
9
|
+
components?: Partial<SidebarPageTreeComponents>;
|
|
10
|
+
banner?: ReactNode | FC<ComponentProps<'div'>>;
|
|
11
|
+
footer?: ReactNode | FC<ComponentProps<'div'>>;
|
|
12
|
+
/**
|
|
13
|
+
* Support collapsing the sidebar on desktop mode
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue true
|
|
16
|
+
*/
|
|
17
|
+
collapsible?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type SidebarProviderProps = SidebarProviderProps$1;
|
|
20
|
+
declare const useSidebar: typeof useSidebar$1;
|
|
21
|
+
declare function SidebarProvider(props: SidebarProviderProps): react_jsx_runtime0.JSX.Element;
|
|
22
|
+
declare function SidebarTrigger(props: ComponentProps<'button'>): react_jsx_runtime0.JSX.Element;
|
|
23
|
+
declare function SidebarCollapseTrigger(props: ComponentProps<'button'>): react_jsx_runtime0.JSX.Element;
|
|
24
|
+
declare function Sidebar({
|
|
25
|
+
banner,
|
|
26
|
+
footer,
|
|
27
|
+
components,
|
|
28
|
+
collapsible,
|
|
29
|
+
...rest
|
|
30
|
+
}: SidebarProps): react_jsx_runtime0.JSX.Element;
|
|
31
|
+
declare function SidebarTabsDropdown({
|
|
32
|
+
options,
|
|
33
|
+
placeholder,
|
|
34
|
+
...props
|
|
35
|
+
}: {
|
|
36
|
+
placeholder?: ReactNode;
|
|
37
|
+
options: LayoutTab[];
|
|
38
|
+
} & ComponentProps<'button'>): react_jsx_runtime0.JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Sidebar, SidebarCollapseTrigger, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarTabsDropdown, SidebarTrigger, useSidebar };
|