@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
package/dist/components/files.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
4
|
-
import { cn } from "@hanzo/docs-ui/cn";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { File as File$1, Folder as Folder$1, FolderOpen } from "lucide-react";
|
|
7
4
|
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { FileIcon, FolderIcon, FolderOpen } from "lucide-react";
|
|
8
7
|
import { cva } from "class-variance-authority";
|
|
9
|
-
|
|
10
8
|
//#region src/components/files.tsx
|
|
11
9
|
const itemVariants = cva("flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4");
|
|
12
10
|
function Files({ className, ...props }) {
|
|
@@ -16,7 +14,7 @@ function Files({ className, ...props }) {
|
|
|
16
14
|
children: props.children
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
|
-
function File({ name, icon = /* @__PURE__ */ jsx(
|
|
17
|
+
function File({ name, icon = /* @__PURE__ */ jsx(FileIcon, {}), className, ...rest }) {
|
|
20
18
|
return /* @__PURE__ */ jsxs("div", {
|
|
21
19
|
className: cn(itemVariants({ className })),
|
|
22
20
|
...rest,
|
|
@@ -31,14 +29,12 @@ function Folder({ name, defaultOpen = false, ...props }) {
|
|
|
31
29
|
...props,
|
|
32
30
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
33
31
|
className: cn(itemVariants({ className: "w-full" })),
|
|
34
|
-
children: [open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(
|
|
32
|
+
children: [open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(FolderIcon, {}), name]
|
|
35
33
|
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
|
|
36
34
|
className: "ms-2 flex flex-col border-l ps-2",
|
|
37
35
|
children: props.children
|
|
38
36
|
}) })]
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
|
-
|
|
42
39
|
//#endregion
|
|
43
40
|
export { File, Files, Folder };
|
|
44
|
-
//# sourceMappingURL=files.js.map
|
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/github-info.d.ts
|
|
5
|
+
interface FetchRepositoryInfoOptions {
|
|
6
|
+
owner: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
fetchOptions?: RequestInit;
|
|
11
|
+
}
|
|
12
|
+
interface RepositoryInfo {
|
|
13
|
+
stars: number;
|
|
14
|
+
forks: number;
|
|
15
|
+
}
|
|
16
|
+
declare function fetchRepositoryInfo({
|
|
17
|
+
owner,
|
|
18
|
+
repo,
|
|
19
|
+
token,
|
|
20
|
+
baseUrl,
|
|
21
|
+
fetchOptions
|
|
22
|
+
}: FetchRepositoryInfoOptions): Promise<RepositoryInfo>;
|
|
5
23
|
declare function GithubInfo({
|
|
6
24
|
repo,
|
|
7
25
|
owner,
|
|
8
26
|
token,
|
|
9
27
|
baseUrl,
|
|
28
|
+
fetchOptions,
|
|
10
29
|
...props
|
|
11
|
-
}:
|
|
12
|
-
owner: string;
|
|
13
|
-
repo: string;
|
|
14
|
-
token?: string;
|
|
15
|
-
baseUrl?: string;
|
|
16
|
-
}): Promise<react_jsx_runtime130.JSX.Element>;
|
|
30
|
+
}: ComponentProps<'a'> & FetchRepositoryInfoOptions): react_jsx_runtime0.JSX.Element;
|
|
17
31
|
//#endregion
|
|
18
|
-
export { GithubInfo };
|
|
19
|
-
//# sourceMappingURL=github-info.d.ts.map
|
|
32
|
+
export { FetchRepositoryInfoOptions, GithubInfo, RepositoryInfo, fetchRepositoryInfo };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { cn } from "
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import { use } from "react";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Star } from "lucide-react";
|
|
4
|
-
|
|
4
|
+
import { GitFork, Star } from "lucide-react";
|
|
5
5
|
//#region src/components/github-info.tsx
|
|
6
|
-
async function
|
|
6
|
+
async function fetchRepositoryInfo({ owner, repo, token, baseUrl = "https://api.github.com", fetchOptions = { next: { revalidate: 60 } } }) {
|
|
7
7
|
const endpoint = `${baseUrl}/repos/${owner}/${repo}`;
|
|
8
|
-
const headers = new Headers(
|
|
8
|
+
const headers = new Headers(fetchOptions.headers);
|
|
9
|
+
headers.set("Content-Type", "application/json");
|
|
9
10
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
10
11
|
const response = await fetch(endpoint, {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
...fetchOptions,
|
|
13
|
+
headers
|
|
13
14
|
});
|
|
14
15
|
if (!response.ok) {
|
|
15
16
|
const message = await response.text();
|
|
@@ -21,15 +22,29 @@ async function getRepoStarsAndForks(owner, repo, token, baseUrl = "https://api.g
|
|
|
21
22
|
forks: data.forks_count
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Uses compact notation (e.g., 1.5K, 2.3M).
|
|
27
|
+
*/
|
|
28
|
+
const defaultFormatter = new Intl.NumberFormat("en", {
|
|
29
|
+
notation: "compact",
|
|
30
|
+
maximumFractionDigits: 1
|
|
31
|
+
});
|
|
32
|
+
const promises = {};
|
|
33
|
+
function GithubInfo({ repo, owner, token, baseUrl, fetchOptions, ...props }) {
|
|
34
|
+
const options = {
|
|
35
|
+
repo,
|
|
36
|
+
owner,
|
|
37
|
+
token,
|
|
38
|
+
baseUrl,
|
|
39
|
+
fetchOptions
|
|
40
|
+
};
|
|
41
|
+
const { stars, forks } = use(promises[JSON.stringify(options)] ??= fetchRepositoryInfo(options));
|
|
27
42
|
return /* @__PURE__ */ jsxs("a", {
|
|
28
43
|
href: `https://github.com/${owner}/${repo}`,
|
|
29
44
|
rel: "noreferrer noopener",
|
|
30
45
|
target: "_blank",
|
|
31
46
|
...props,
|
|
32
|
-
className: cn("flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors
|
|
47
|
+
className: cn("flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors hover:text-fd-accent-foreground hover:bg-fd-accent", props.className),
|
|
33
48
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
34
49
|
className: "flex items-center gap-2 truncate",
|
|
35
50
|
children: [
|
|
@@ -43,26 +58,16 @@ async function GithubInfo({ repo, owner, token, baseUrl, ...props }) {
|
|
|
43
58
|
"/",
|
|
44
59
|
repo
|
|
45
60
|
]
|
|
46
|
-
}), /* @__PURE__ */ jsxs("
|
|
61
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
47
62
|
className: "flex text-xs items-center gap-1 text-fd-muted-foreground",
|
|
48
|
-
children: [
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Star, { className: "size-3" }),
|
|
65
|
+
/* @__PURE__ */ jsx("span", { children: defaultFormatter.format(stars) }),
|
|
66
|
+
/* @__PURE__ */ jsx(GitFork, { className: "size-3 ms-2" }),
|
|
67
|
+
/* @__PURE__ */ jsx("span", { children: defaultFormatter.format(forks) })
|
|
68
|
+
]
|
|
49
69
|
})]
|
|
50
70
|
});
|
|
51
71
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Converts a number to a human-readable string with K suffix for thousands
|
|
54
|
-
* @example 1500 -> "1.5K", 1000000 -> "1000000"
|
|
55
|
-
*/
|
|
56
|
-
function humanizeNumber(num) {
|
|
57
|
-
if (num < 1e3) return num.toString();
|
|
58
|
-
if (num < 1e5) {
|
|
59
|
-
const value = (num / 1e3).toFixed(1);
|
|
60
|
-
return `${value.endsWith(".0") ? value.slice(0, -2) : value}K`;
|
|
61
|
-
}
|
|
62
|
-
if (num < 1e6) return `${Math.floor(num / 1e3)}K`;
|
|
63
|
-
return num.toString();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
72
|
//#endregion
|
|
67
|
-
export { GithubInfo };
|
|
68
|
-
//# sourceMappingURL=github-info.js.map
|
|
73
|
+
export { GithubInfo, fetchRepositoryInfo };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { cn } from "
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { LinkIcon } from "lucide-react";
|
|
5
4
|
//#region src/components/heading.tsx
|
|
6
5
|
function Heading({ as, className, ...props }) {
|
|
7
6
|
const As = as ?? "h1";
|
|
@@ -17,13 +16,11 @@ function Heading({ as, className, ...props }) {
|
|
|
17
16
|
href: `#${props.id}`,
|
|
18
17
|
className: "peer",
|
|
19
18
|
children: props.children
|
|
20
|
-
}), /* @__PURE__ */ jsx(
|
|
19
|
+
}), /* @__PURE__ */ jsx(LinkIcon, {
|
|
21
20
|
"aria-hidden": true,
|
|
22
21
|
className: "size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
|
|
23
22
|
})]
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
export { Heading };
|
|
29
|
-
//# sourceMappingURL=heading.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ImageProps } from "@hanzo/docs-core/framework";
|
|
2
|
-
import * as react_jsx_runtime129 from "react/jsx-runtime";
|
|
3
1
|
import { ComponentProps } from "react";
|
|
2
|
+
import { ImageProps } from "@hanzo/docs-core/framework";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { UncontrolledProps } from "react-medium-image-zoom";
|
|
5
5
|
|
|
6
6
|
//#region src/components/image-zoom.d.ts
|
|
@@ -19,7 +19,6 @@ declare function ImageZoom({
|
|
|
19
19
|
children,
|
|
20
20
|
rmiz,
|
|
21
21
|
...props
|
|
22
|
-
}: ImageZoomProps):
|
|
22
|
+
}: ImageZoomProps): react_jsx_runtime0.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
|
-
export { ImageZoom, ImageZoomProps };
|
|
25
|
-
//# sourceMappingURL=image-zoom.d.ts.map
|
|
24
|
+
export { ImageZoom, ImageZoomProps };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
3
2
|
import "./image-zoom.css";
|
|
3
|
+
/* empty css */
|
|
4
4
|
import { Image } from "@hanzo/docs-core/framework";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import Zoom from "react-medium-image-zoom";
|
|
7
|
-
|
|
8
7
|
//#region src/components/image-zoom.tsx
|
|
9
8
|
function getImageSrc(src) {
|
|
10
9
|
if (typeof src === "string") return src;
|
|
@@ -30,7 +29,5 @@ function ImageZoom({ zoomInProps, children, rmiz, ...props }) {
|
|
|
30
29
|
})
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
33
|
export { ImageZoom };
|
|
36
|
-
//# sourceMappingURL=image-zoom.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Collapsible } from "./ui/collapsible.js";
|
|
2
|
-
import * as react_jsx_runtime82 from "react/jsx-runtime";
|
|
3
2
|
import { ComponentProps } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { TOCItemType } from "@hanzo/docs-core/toc";
|
|
5
5
|
|
|
6
6
|
//#region src/components/inline-toc.d.ts
|
|
@@ -11,7 +11,6 @@ declare function InlineTOC({
|
|
|
11
11
|
items,
|
|
12
12
|
className,
|
|
13
13
|
...props
|
|
14
|
-
}: InlineTocProps):
|
|
14
|
+
}: InlineTocProps): react_jsx_runtime0.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { InlineTOC, InlineTocProps };
|
|
17
|
-
//# sourceMappingURL=inline-toc.d.ts.map
|
|
16
|
+
export { InlineTOC, InlineTocProps };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
4
|
-
import { cn } from "@hanzo/docs-ui/cn";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { ChevronDown } from "lucide-react";
|
|
7
|
-
|
|
8
6
|
//#region src/components/inline-toc.tsx
|
|
9
7
|
function InlineTOC({ items, className, ...props }) {
|
|
10
8
|
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
@@ -24,7 +22,5 @@ function InlineTOC({ items, className, ...props }) {
|
|
|
24
22
|
}) })]
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
//#endregion
|
|
29
26
|
export { InlineTOC };
|
|
30
|
-
//# sourceMappingURL=inline-toc.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CollapsibleContentProps, CollapsibleTriggerProps } from "../ui/collapsible.js";
|
|
2
2
|
import { ScrollAreaProps } from "../ui/scroll-area.js";
|
|
3
|
-
import
|
|
4
|
-
import * as react_jsx_runtime105 from "react/jsx-runtime";
|
|
5
|
-
import * as react20 from "react";
|
|
3
|
+
import * as react from "react";
|
|
6
4
|
import { ComponentProps, PointerEvent, ReactNode, RefObject } from "react";
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
import { LinkProps } from "@hanzo/docs-core/link";
|
|
7
7
|
|
|
8
8
|
//#region src/components/sidebar/base.d.ts
|
|
9
9
|
declare namespace base_d_exports {
|
|
10
|
-
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarProviderProps, SidebarSeparator, SidebarTrigger, SidebarViewport, useFolder, useFolderDepth, useSidebar };
|
|
10
|
+
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarProviderProps, SidebarSeparator, SidebarTrigger, SidebarViewport, useAutoScroll, useFolder, useFolderDepth, useSidebar };
|
|
11
11
|
}
|
|
12
12
|
interface SidebarContext {
|
|
13
13
|
open: boolean;
|
|
@@ -19,7 +19,7 @@ interface SidebarContext {
|
|
|
19
19
|
*/
|
|
20
20
|
closeOnRedirect: RefObject<boolean>;
|
|
21
21
|
defaultOpenLevel: number;
|
|
22
|
-
prefetch
|
|
22
|
+
prefetch?: boolean;
|
|
23
23
|
mode: Mode;
|
|
24
24
|
}
|
|
25
25
|
interface SidebarProviderProps {
|
|
@@ -31,20 +31,18 @@ interface SidebarProviderProps {
|
|
|
31
31
|
*/
|
|
32
32
|
defaultOpenLevel?: number;
|
|
33
33
|
/**
|
|
34
|
-
* Prefetch links
|
|
35
|
-
*
|
|
36
|
-
* @defaultValue true
|
|
34
|
+
* Prefetch links, default behaviour depends on your React.js framework.
|
|
37
35
|
*/
|
|
38
36
|
prefetch?: boolean;
|
|
39
37
|
children?: ReactNode;
|
|
40
38
|
}
|
|
41
39
|
type Mode = 'drawer' | 'full';
|
|
42
|
-
declare const SidebarContext:
|
|
40
|
+
declare const SidebarContext: react.Context<SidebarContext | null>;
|
|
43
41
|
declare function SidebarProvider({
|
|
44
42
|
defaultOpenLevel,
|
|
45
43
|
prefetch,
|
|
46
44
|
children
|
|
47
|
-
}: SidebarProviderProps):
|
|
45
|
+
}: SidebarProviderProps): react_jsx_runtime0.JSX.Element;
|
|
48
46
|
declare function useSidebar(): SidebarContext;
|
|
49
47
|
declare function useFolder(): {
|
|
50
48
|
open: boolean;
|
|
@@ -64,24 +62,26 @@ declare function SidebarContent({
|
|
|
64
62
|
onPointerLeave: (event: PointerEvent) => void;
|
|
65
63
|
}) => ReactNode;
|
|
66
64
|
}): ReactNode;
|
|
67
|
-
declare function SidebarDrawerOverlay(props: ComponentProps<'div'>):
|
|
65
|
+
declare function SidebarDrawerOverlay(props: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element | undefined;
|
|
68
66
|
declare function SidebarDrawerContent({
|
|
69
67
|
className,
|
|
70
68
|
children,
|
|
71
69
|
...props
|
|
72
|
-
}: ComponentProps<'aside'>):
|
|
70
|
+
}: ComponentProps<'aside'>): react_jsx_runtime0.JSX.Element | undefined;
|
|
73
71
|
declare function SidebarViewport({
|
|
74
72
|
className,
|
|
75
73
|
...props
|
|
76
|
-
}: ScrollAreaProps):
|
|
77
|
-
declare function SidebarSeparator(props: ComponentProps<'p'>):
|
|
74
|
+
}: ScrollAreaProps): react_jsx_runtime0.JSX.Element;
|
|
75
|
+
declare function SidebarSeparator(props: ComponentProps<'p'>): react_jsx_runtime0.JSX.Element;
|
|
78
76
|
declare function SidebarItem({
|
|
79
77
|
icon,
|
|
78
|
+
active,
|
|
80
79
|
children,
|
|
81
80
|
...props
|
|
82
81
|
}: LinkProps & {
|
|
82
|
+
active?: boolean;
|
|
83
83
|
icon?: ReactNode;
|
|
84
|
-
}):
|
|
84
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
85
85
|
declare function SidebarFolder({
|
|
86
86
|
defaultOpen: defaultOpenProp,
|
|
87
87
|
collapsible,
|
|
@@ -92,21 +92,27 @@ declare function SidebarFolder({
|
|
|
92
92
|
active?: boolean;
|
|
93
93
|
defaultOpen?: boolean;
|
|
94
94
|
collapsible?: boolean;
|
|
95
|
-
}):
|
|
95
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
96
96
|
declare function SidebarFolderTrigger({
|
|
97
97
|
children,
|
|
98
98
|
...props
|
|
99
|
-
}: CollapsibleTriggerProps):
|
|
99
|
+
}: CollapsibleTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
100
100
|
declare function SidebarFolderLink({
|
|
101
101
|
children,
|
|
102
|
+
active,
|
|
102
103
|
...props
|
|
103
|
-
}: LinkProps
|
|
104
|
-
|
|
104
|
+
}: LinkProps & {
|
|
105
|
+
active?: boolean;
|
|
106
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
107
|
+
declare function SidebarFolderContent(props: CollapsibleContentProps): react_jsx_runtime0.JSX.Element;
|
|
105
108
|
declare function SidebarTrigger({
|
|
106
109
|
children,
|
|
107
110
|
...props
|
|
108
|
-
}: ComponentProps<'button'>):
|
|
109
|
-
declare function SidebarCollapseTrigger(props: ComponentProps<'button'>):
|
|
111
|
+
}: ComponentProps<'button'>): react_jsx_runtime0.JSX.Element;
|
|
112
|
+
declare function SidebarCollapseTrigger(props: ComponentProps<'button'>): react_jsx_runtime0.JSX.Element;
|
|
113
|
+
/**
|
|
114
|
+
* scroll to the element if `active` is true
|
|
115
|
+
*/
|
|
116
|
+
declare function useAutoScroll(active: boolean, ref: RefObject<HTMLElement | null>): void;
|
|
110
117
|
//#endregion
|
|
111
|
-
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarProviderProps, SidebarSeparator, SidebarTrigger, SidebarViewport, base_d_exports, useFolder, useFolderDepth, useSidebar };
|
|
112
|
-
//# sourceMappingURL=base.d.ts.map
|
|
118
|
+
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarProviderProps, SidebarSeparator, SidebarTrigger, SidebarViewport, base_d_exports, useAutoScroll, useFolder, useFolderDepth, useSidebar };
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
|
|
5
5
|
import { ScrollArea, ScrollViewport } from "../ui/scroll-area.js";
|
|
6
|
-
import
|
|
6
|
+
import { createContext, use, useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { usePathname } from "@hanzo/docs-core/framework";
|
|
8
|
-
import { cn } from "@hanzo/docs-ui/cn";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import Link from "@hanzo/docs-core/link";
|
|
10
10
|
import { ChevronDown, ExternalLink } from "lucide-react";
|
|
11
|
-
import { createContext, use, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
import { isActive } from "@hanzo/docs-ui/urls";
|
|
13
11
|
import { useOnChange } from "@hanzo/docs-core/utils/use-on-change";
|
|
14
12
|
import { useMediaQuery } from "@hanzo/docs-core/utils/use-media-query";
|
|
15
13
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
16
14
|
import ReactDOM from "react-dom";
|
|
17
|
-
|
|
18
15
|
//#region src/components/sidebar/base.tsx
|
|
19
16
|
var base_exports = /* @__PURE__ */ __exportAll({
|
|
20
17
|
SidebarCollapseTrigger: () => SidebarCollapseTrigger,
|
|
@@ -30,13 +27,14 @@ var base_exports = /* @__PURE__ */ __exportAll({
|
|
|
30
27
|
SidebarSeparator: () => SidebarSeparator,
|
|
31
28
|
SidebarTrigger: () => SidebarTrigger,
|
|
32
29
|
SidebarViewport: () => SidebarViewport,
|
|
30
|
+
useAutoScroll: () => useAutoScroll,
|
|
33
31
|
useFolder: () => useFolder,
|
|
34
32
|
useFolderDepth: () => useFolderDepth,
|
|
35
33
|
useSidebar: () => useSidebar
|
|
36
34
|
});
|
|
37
35
|
const SidebarContext = createContext(null);
|
|
38
36
|
const FolderContext = createContext(null);
|
|
39
|
-
function SidebarProvider({ defaultOpenLevel = 0, prefetch
|
|
37
|
+
function SidebarProvider({ defaultOpenLevel = 0, prefetch, children }) {
|
|
40
38
|
const closeOnRedirect = useRef(true);
|
|
41
39
|
const [open, setOpen] = useState(false);
|
|
42
40
|
const [collapsed, setCollapsed] = useState(false);
|
|
@@ -142,8 +140,7 @@ function SidebarViewport({ className, ...props }) {
|
|
|
142
140
|
className: (s) => cn("min-h-0 flex-1", typeof className === "function" ? className(s) : className),
|
|
143
141
|
...props,
|
|
144
142
|
children: /* @__PURE__ */ jsx(ScrollViewport, {
|
|
145
|
-
className: "p-4 overscroll-contain",
|
|
146
|
-
style: { maskImage: "linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)" },
|
|
143
|
+
className: "p-4 overscroll-contain mask-[linear-gradient(to_bottom,transparent,white_12px,white_calc(100%-12px),transparent)]",
|
|
147
144
|
children: props.children
|
|
148
145
|
})
|
|
149
146
|
});
|
|
@@ -156,11 +153,9 @@ function SidebarSeparator(props) {
|
|
|
156
153
|
children: props.children
|
|
157
154
|
});
|
|
158
155
|
}
|
|
159
|
-
function SidebarItem({ icon, children, ...props }) {
|
|
160
|
-
const pathname = usePathname();
|
|
156
|
+
function SidebarItem({ icon, active = false, children, ...props }) {
|
|
161
157
|
const ref = useRef(null);
|
|
162
158
|
const { prefetch } = useSidebar();
|
|
163
|
-
const active = props.href !== void 0 && isActive(props.href, pathname, false);
|
|
164
159
|
useAutoScroll(active, ref);
|
|
165
160
|
return /* @__PURE__ */ jsxs(Link, {
|
|
166
161
|
ref,
|
|
@@ -204,7 +199,7 @@ function SidebarFolderTrigger({ children, ...props }) {
|
|
|
204
199
|
...props,
|
|
205
200
|
children: [children, /* @__PURE__ */ jsx(ChevronDown, {
|
|
206
201
|
"data-icon": true,
|
|
207
|
-
className: cn("ms-auto transition-transform", !open && "-rotate-90")
|
|
202
|
+
className: cn("ms-auto transition-transform", !open && "-rotate-90 rtl:rotate-90")
|
|
208
203
|
})]
|
|
209
204
|
});
|
|
210
205
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -212,12 +207,10 @@ function SidebarFolderTrigger({ children, ...props }) {
|
|
|
212
207
|
children
|
|
213
208
|
});
|
|
214
209
|
}
|
|
215
|
-
function SidebarFolderLink({ children, ...props }) {
|
|
210
|
+
function SidebarFolderLink({ children, active = false, ...props }) {
|
|
216
211
|
const ref = useRef(null);
|
|
217
212
|
const { open, setOpen, collapsible } = use(FolderContext);
|
|
218
213
|
const { prefetch } = useSidebar();
|
|
219
|
-
const pathname = usePathname();
|
|
220
|
-
const active = props.href !== void 0 && isActive(props.href, pathname, false);
|
|
221
214
|
useAutoScroll(active, ref);
|
|
222
215
|
return /* @__PURE__ */ jsxs(Link, {
|
|
223
216
|
ref,
|
|
@@ -233,7 +226,7 @@ function SidebarFolderLink({ children, ...props }) {
|
|
|
233
226
|
...props,
|
|
234
227
|
children: [children, collapsible && /* @__PURE__ */ jsx(ChevronDown, {
|
|
235
228
|
"data-icon": true,
|
|
236
|
-
className: cn("ms-auto transition-transform", !open && "-rotate-90")
|
|
229
|
+
className: cn("ms-auto transition-transform", !open && "-rotate-90 rtl:rotate-90")
|
|
237
230
|
})]
|
|
238
231
|
});
|
|
239
232
|
}
|
|
@@ -265,6 +258,9 @@ function SidebarCollapseTrigger(props) {
|
|
|
265
258
|
children: props.children
|
|
266
259
|
});
|
|
267
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* scroll to the element if `active` is true
|
|
263
|
+
*/
|
|
268
264
|
function useAutoScroll(active, ref) {
|
|
269
265
|
const { mode } = useSidebar();
|
|
270
266
|
useEffect(() => {
|
|
@@ -278,7 +274,5 @@ function useAutoScroll(active, ref) {
|
|
|
278
274
|
ref
|
|
279
275
|
]);
|
|
280
276
|
}
|
|
281
|
-
|
|
282
277
|
//#endregion
|
|
283
|
-
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarSeparator, SidebarTrigger, SidebarViewport, base_exports, useFolder, useFolderDepth, useSidebar };
|
|
284
|
-
//# sourceMappingURL=base.js.map
|
|
278
|
+
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarSeparator, SidebarTrigger, SidebarViewport, base_exports, useAutoScroll, useFolder, useFolderDepth, useSidebar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { base_d_exports } from "./base.js";
|
|
2
|
-
import
|
|
2
|
+
import { LinkItemType } from "../../layouts/shared/index.js";
|
|
3
3
|
import { HTMLAttributes } from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/sidebar/link-item.d.ts
|
|
7
7
|
type InternalComponents = Pick<typeof base_d_exports, 'SidebarFolder' | 'SidebarFolderLink' | 'SidebarFolderContent' | 'SidebarFolderTrigger' | 'SidebarItem'>;
|
|
@@ -20,5 +20,4 @@ declare function createLinkItemRenderer({
|
|
|
20
20
|
}>;
|
|
21
21
|
}) => react_jsx_runtime0.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
|
-
export { createLinkItemRenderer };
|
|
24
|
-
//# sourceMappingURL=link-item.d.ts.map
|
|
23
|
+
export { createLinkItemRenderer };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { isLinkItemActive } from "../../layouts/shared/index.js";
|
|
3
|
+
import { usePathname } from "@hanzo/docs-core/framework";
|
|
1
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
5
|
//#region src/components/sidebar/link-item.tsx
|
|
4
6
|
function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem }) {
|
|
5
7
|
/**
|
|
6
8
|
* Render sidebar items from page tree
|
|
7
9
|
*/
|
|
8
10
|
return function SidebarLinkItem({ item, ...props }) {
|
|
11
|
+
const active = isLinkItemActive(item, usePathname());
|
|
9
12
|
if (item.type === "custom") return /* @__PURE__ */ jsx("div", {
|
|
10
13
|
...props,
|
|
11
14
|
children: item.children
|
|
@@ -14,6 +17,7 @@ function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFo
|
|
|
14
17
|
...props,
|
|
15
18
|
children: [item.url ? /* @__PURE__ */ jsxs(SidebarFolderLink, {
|
|
16
19
|
href: item.url,
|
|
20
|
+
active,
|
|
17
21
|
external: item.external,
|
|
18
22
|
children: [item.icon, item.text]
|
|
19
23
|
}) : /* @__PURE__ */ jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] }), /* @__PURE__ */ jsx(SidebarFolderContent, { children: item.items.map((child, i) => /* @__PURE__ */ jsx(SidebarLinkItem, { item: child }, i)) })]
|
|
@@ -22,12 +26,11 @@ function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFo
|
|
|
22
26
|
href: item.url,
|
|
23
27
|
icon: item.icon,
|
|
24
28
|
external: item.external,
|
|
29
|
+
active,
|
|
25
30
|
...props,
|
|
26
31
|
children: item.text
|
|
27
32
|
});
|
|
28
33
|
};
|
|
29
34
|
}
|
|
30
|
-
|
|
31
35
|
//#endregion
|
|
32
36
|
export { createLinkItemRenderer };
|
|
33
|
-
//# sourceMappingURL=link-item.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { base_d_exports } from "./base.js";
|
|
2
|
-
import * as react_jsx_runtime99 from "react/jsx-runtime";
|
|
3
2
|
import { FC, ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import * as PageTree from "@hanzo/docs-core/page-tree";
|
|
5
5
|
|
|
6
6
|
//#region src/components/sidebar/page-tree.d.ts
|
|
@@ -24,7 +24,6 @@ declare function createPageTreeRenderer({
|
|
|
24
24
|
SidebarFolderTrigger,
|
|
25
25
|
SidebarSeparator,
|
|
26
26
|
SidebarItem
|
|
27
|
-
}: InternalComponents): (components: Partial<SidebarPageTreeComponents>) =>
|
|
27
|
+
}: InternalComponents): (components: Partial<SidebarPageTreeComponents>) => react_jsx_runtime0.JSX.Element;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { SidebarPageTreeComponents, createPageTreeRenderer };
|
|
30
|
-
//# sourceMappingURL=page-tree.d.ts.map
|
|
29
|
+
export { SidebarPageTreeComponents, createPageTreeRenderer };
|