@hanzo/docs-base-ui 16.5.3 → 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/css/generated/docs.css +68 -33
- package/css/generated/flux.css +44 -34
- package/css/generated/home.css +88 -4
- package/css/generated/notebook.css +65 -31
- package/css/generated/shared.css +199 -59
- package/css/lib/base.css +1 -4
- package/css/lib/shiki.css +49 -41
- package/css/preset.css +3 -0
- package/dist/_virtual/_rolldown/runtime.js +6 -11
- package/dist/components/accordion.d.ts +1 -2
- package/dist/components/accordion.js +3 -7
- package/dist/components/banner.d.ts +1 -2
- package/dist/components/banner.js +1 -5
- package/dist/components/callout.d.ts +1 -2
- package/dist/components/callout.js +0 -3
- package/dist/components/card.d.ts +1 -2
- package/dist/components/card.js +0 -3
- package/dist/components/codeblock.d.ts +1 -2
- package/dist/components/codeblock.js +2 -6
- 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 +1 -3
- package/dist/components/dialog/search-algolia.js +1 -5
- package/dist/components/dialog/search-default.d.ts +1 -3
- package/dist/components/dialog/search-default.js +1 -5
- package/dist/components/dialog/search-orama.d.ts +1 -3
- package/dist/components/dialog/search-orama.js +1 -5
- package/dist/components/dialog/search.d.ts +5 -5
- package/dist/components/dialog/search.js +124 -47
- package/dist/components/dynamic-codeblock.core.d.ts +7 -5
- package/dist/components/dynamic-codeblock.core.js +17 -32
- package/dist/components/dynamic-codeblock.d.ts +5 -3
- package/dist/components/dynamic-codeblock.js +8 -13
- package/dist/components/files.d.ts +1 -2
- package/dist/components/files.js +4 -8
- package/dist/components/github-info.d.ts +22 -9
- package/dist/components/github-info.js +33 -28
- package/dist/components/heading.d.ts +1 -2
- package/dist/components/heading.js +2 -5
- package/dist/components/image-zoom.d.ts +1 -2
- package/dist/components/image-zoom.js +2 -5
- package/dist/components/inline-toc.d.ts +1 -2
- package/dist/components/inline-toc.js +1 -5
- package/dist/components/sidebar/base.d.ts +7 -3
- package/dist/components/sidebar/base.js +6 -16
- package/dist/components/sidebar/link-item.d.ts +2 -3
- package/dist/components/sidebar/link-item.js +6 -3
- package/dist/components/sidebar/page-tree.d.ts +1 -2
- package/dist/components/sidebar/page-tree.js +54 -43
- package/dist/components/sidebar/tabs/dropdown.d.ts +4 -7
- package/dist/components/sidebar/tabs/dropdown.js +4 -11
- 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 +1 -2
- package/dist/components/steps.js +0 -3
- package/dist/components/tabs.d.ts +11 -7
- package/dist/components/tabs.js +13 -18
- package/dist/components/toc/clerk.d.ts +9 -2
- package/dist/components/toc/clerk.js +117 -62
- package/dist/components/toc/default.d.ts +9 -2
- package/dist/components/toc/default.js +28 -21
- package/dist/components/toc/index.d.ts +8 -5
- package/dist/components/toc/index.js +50 -25
- package/dist/components/type-table.d.ts +10 -5
- package/dist/components/type-table.js +22 -17
- package/dist/components/ui/accordion.d.ts +1 -2
- package/dist/components/ui/accordion.js +1 -5
- package/dist/components/ui/button.d.ts +2 -3
- package/dist/components/ui/button.js +0 -3
- package/dist/components/ui/collapsible.d.ts +1 -2
- package/dist/components/ui/collapsible.js +2 -6
- package/dist/components/ui/navigation-menu.d.ts +26 -12
- package/dist/components/ui/navigation-menu.js +52 -30
- package/dist/components/ui/popover.d.ts +10 -5
- package/dist/components/ui/popover.js +14 -18
- package/dist/components/ui/scroll-area.d.ts +17 -7
- package/dist/components/ui/scroll-area.js +26 -30
- package/dist/components/ui/tabs.d.ts +1 -2
- package/dist/components/ui/tabs.js +1 -5
- package/dist/contexts/i18n.d.ts +7 -5
- package/dist/contexts/i18n.js +3 -8
- package/dist/contexts/search.d.ts +2 -2
- package/dist/contexts/search.js +4 -6
- package/dist/contexts/tree.d.ts +1 -2
- package/dist/contexts/tree.js +1 -5
- package/dist/i18n.d.ts +16 -9
- package/dist/i18n.js +14 -14
- package/dist/layouts/docs/client.d.ts +30 -29
- package/dist/layouts/docs/client.js +72 -48
- package/dist/layouts/docs/index.d.ts +19 -33
- package/dist/layouts/docs/index.js +16 -172
- package/dist/layouts/docs/page/index.d.ts +67 -55
- package/dist/layouts/docs/page/index.js +74 -54
- 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 +34 -39
- package/dist/layouts/flux/index.js +77 -99
- package/dist/layouts/flux/page/index.d.ts +56 -49
- package/dist/layouts/flux/page/index.js +63 -35
- 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/{sidebar.js → slots/sidebar.js} +74 -34
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +17 -0
- package/dist/layouts/flux/{tab-dropdown.js → slots/tab-dropdown.js} +13 -24
- package/dist/layouts/home/index.d.ts +24 -7
- package/dist/layouts/home/index.js +39 -19
- package/dist/layouts/home/navbar.d.ts +5 -14
- package/dist/layouts/home/navbar.js +10 -12
- 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 +57 -147
- package/dist/layouts/notebook/index.d.ts +25 -24
- package/dist/layouts/notebook/index.js +16 -212
- package/dist/layouts/notebook/page/index.d.ts +67 -55
- package/dist/layouts/notebook/page/index.js +74 -54
- 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 +136 -34
- package/dist/layouts/shared/index.js +49 -17
- 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} +11 -15
- package/dist/layouts/shared/slots/search-trigger.d.ts +23 -0
- package/dist/layouts/shared/{search-toggle.js → slots/search-trigger.js} +9 -13
- package/dist/layouts/shared/slots/theme-switch.d.ts +14 -0
- package/dist/layouts/shared/{theme-toggle.js → slots/theme-switch.js} +5 -9
- package/dist/mdx.d.ts +13 -3
- package/dist/mdx.js +0 -4
- package/dist/mdx.server.d.ts +1 -2
- 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 +1 -2
- package/dist/og.js +6 -6
- package/dist/page.d.ts +3 -4
- package/dist/page.js +6 -11
- package/dist/provider/base.d.ts +1 -2
- package/dist/provider/base.js +2 -6
- package/dist/provider/next.d.ts +1 -2
- package/dist/provider/next.js +1 -5
- package/dist/provider/react-router.d.ts +1 -2
- package/dist/provider/react-router.js +1 -5
- package/dist/provider/tanstack.d.ts +1 -2
- package/dist/provider/tanstack.js +1 -5
- package/dist/provider/waku.d.ts +1 -2
- package/dist/provider/waku.js +1 -5
- package/dist/style.css +433 -166
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +1 -2
- package/dist/utils/merge-refs.js +0 -2
- package/dist/utils/urls.js +1 -3
- package/dist/utils/use-copy-button.d.ts +1 -2
- package/dist/utils/use-copy-button.js +1 -5
- package/dist/utils/use-footer-items.d.ts +1 -2
- package/dist/utils/use-footer-items.js +4 -8
- package/dist/utils/use-is-scroll-top.d.ts +1 -2
- package/dist/utils/use-is-scroll-top.js +1 -5
- package/package.json +139 -103
- package/LICENSE +0 -21
- 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.core.d.ts.map +0 -1
- package/dist/components/dynamic-codeblock.core.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-DGvp66QF.css +0 -80
- package/dist/components/image-zoom-DGvp66QF.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.d.ts.map +0 -1
- package/dist/components/toc/clerk.js.map +0 -1
- package/dist/components/toc/default.d.ts.map +0 -1
- package/dist/components/toc/default.js.map +0 -1
- package/dist/components/toc/index.d.ts.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.d.ts.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.d.ts.map +0 -1
- package/dist/contexts/tree.js.map +0 -1
- package/dist/i18n.d.ts.map +0 -1
- package/dist/i18n.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 -48
- 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 -64
- 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/flux/index.d.ts.map +0 -1
- package/dist/layouts/flux/index.js.map +0 -1
- package/dist/layouts/flux/page/client.d.ts +0 -45
- package/dist/layouts/flux/page/client.d.ts.map +0 -1
- package/dist/layouts/flux/page/client.js +0 -255
- package/dist/layouts/flux/page/client.js.map +0 -1
- package/dist/layouts/flux/page/index.d.ts.map +0 -1
- package/dist/layouts/flux/page/index.js.map +0 -1
- package/dist/layouts/flux/sidebar.d.ts +0 -59
- package/dist/layouts/flux/sidebar.d.ts.map +0 -1
- package/dist/layouts/flux/sidebar.js.map +0 -1
- package/dist/layouts/flux/tab-dropdown.d.ts +0 -21
- package/dist/layouts/flux/tab-dropdown.d.ts.map +0 -1
- package/dist/layouts/flux/tab-dropdown.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 -267
- 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 -48
- 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 -60
- 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/og.d.ts.map +0 -1
- package/dist/og.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/utils/link-item.d.ts +0 -86
- package/dist/utils/link-item.d.ts.map +0 -1
- package/dist/utils/link-item.js +0 -25
- package/dist/utils/link-item.js.map +0 -1
- package/dist/utils/merge-refs.js.map +0 -1
- package/dist/utils/urls.js.map +0 -1
- package/dist/utils/use-copy-button.d.ts.map +0 -1
- package/dist/utils/use-copy-button.js.map +0 -1
- package/dist/utils/use-footer-items.d.ts.map +0 -1
- package/dist/utils/use-footer-items.js.map +0 -1
- package/dist/utils/use-is-scroll-top.d.ts.map +0 -1
- package/dist/utils/use-is-scroll-top.js.map +0 -1
|
@@ -1,218 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { TreeContextProvider } from "../../contexts/tree.js";
|
|
4
|
-
import { SidebarTabsDropdown } from "../../components/sidebar/tabs/dropdown.js";
|
|
5
|
-
import { LinkItem } from "../../utils/link-item.js";
|
|
6
|
-
import { LayoutBody, LayoutContextProvider, LayoutHeader, LayoutHeaderTabs, NavbarLinkItem } from "./client.js";
|
|
7
|
-
import { LargeSearchToggle, SearchToggle } from "../shared/search-toggle.js";
|
|
8
|
-
import { renderTitleNav, useLinkItems } from "../shared/index.js";
|
|
9
|
-
import { LanguageToggle } from "../shared/language-toggle.js";
|
|
10
|
-
import { ThemeToggle } from "../shared/theme-toggle.js";
|
|
11
|
-
import { getSidebarTabs } from "../../components/sidebar/tabs/index.js";
|
|
12
|
-
import { Sidebar as Sidebar$1, SidebarCollapseTrigger, SidebarContent, SidebarDrawer, SidebarLinkItem, SidebarPageTree, SidebarTrigger, SidebarViewport } from "./sidebar.js";
|
|
1
|
+
import { getLayoutTabs } from "../shared/index.js";
|
|
2
|
+
import { LayoutBody, useNotebookLayout } from "./client.js";
|
|
13
3
|
import { useMemo } from "react";
|
|
14
|
-
import {
|
|
15
|
-
import { Languages, Sidebar, X } from "lucide-react";
|
|
16
|
-
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
5
|
//#region src/layouts/notebook/index.tsx
|
|
18
|
-
function DocsLayout(props) {
|
|
19
|
-
|
|
20
|
-
const navMode = nav.mode ?? "auto";
|
|
21
|
-
const { menuItems, navItems } = useLinkItems(props);
|
|
22
|
-
const tabs = useMemo(() => {
|
|
23
|
-
if (Array.isArray(tabOptions)) return tabOptions;
|
|
24
|
-
if (typeof tabOptions === "object") return getSidebarTabs(tree, tabOptions);
|
|
25
|
-
if (tabOptions !== false) return getSidebarTabs(tree);
|
|
26
|
-
return [];
|
|
27
|
-
}, [tabOptions, tree]);
|
|
28
|
-
function sidebar() {
|
|
29
|
-
const { banner, footer, components, collapsible = true, ...rest } = sidebarProps;
|
|
30
|
-
const iconLinks = menuItems.filter((item) => item.type === "icon");
|
|
31
|
-
const Header = typeof banner === "function" ? banner : ({ className, ...props }) => /* @__PURE__ */ jsxs("div", {
|
|
32
|
-
className: cn("flex flex-col gap-3 p-4 pb-2 empty:hidden", className),
|
|
33
|
-
...props,
|
|
34
|
-
children: [props.children, banner]
|
|
35
|
-
});
|
|
36
|
-
const Footer = typeof footer === "function" ? footer : ({ className, ...props }) => /* @__PURE__ */ jsxs("div", {
|
|
37
|
-
className: cn("hidden flex-row text-fd-muted-foreground items-center border-t p-4 pt-2", iconLinks.length > 0 && "max-lg:flex", className),
|
|
38
|
-
...props,
|
|
39
|
-
children: [props.children, footer]
|
|
40
|
-
});
|
|
41
|
-
const viewport = /* @__PURE__ */ jsxs(SidebarViewport, { children: [menuItems.filter((item) => item.type !== "icon").map((item, i, arr) => /* @__PURE__ */ jsx(SidebarLinkItem, {
|
|
42
|
-
item,
|
|
43
|
-
className: cn("lg:hidden", i === arr.length - 1 && "mb-4")
|
|
44
|
-
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })] });
|
|
45
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
|
|
46
|
-
...rest,
|
|
47
|
-
children: [
|
|
48
|
-
/* @__PURE__ */ jsxs(Header, { children: [navMode === "auto" && /* @__PURE__ */ jsxs("div", {
|
|
49
|
-
className: "flex justify-between",
|
|
50
|
-
children: [renderTitleNav(nav, { className: "inline-flex items-center gap-2.5 font-medium" }), collapsible && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
|
|
51
|
-
className: cn(buttonVariants({
|
|
52
|
-
color: "ghost",
|
|
53
|
-
size: "icon-sm",
|
|
54
|
-
className: "mt-px mb-auto text-fd-muted-foreground"
|
|
55
|
-
})),
|
|
56
|
-
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
57
|
-
})]
|
|
58
|
-
}), tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, {
|
|
59
|
-
options: tabs,
|
|
60
|
-
className: cn(tabMode === "navbar" && "lg:hidden")
|
|
61
|
-
})] }),
|
|
62
|
-
viewport,
|
|
63
|
-
/* @__PURE__ */ jsx(Footer, { children: iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
64
|
-
item,
|
|
65
|
-
className: cn(buttonVariants({
|
|
66
|
-
size: "icon-sm",
|
|
67
|
-
color: "ghost",
|
|
68
|
-
className: "lg:hidden"
|
|
69
|
-
})),
|
|
70
|
-
"aria-label": item.label,
|
|
71
|
-
children: item.icon
|
|
72
|
-
}, i)) })
|
|
73
|
-
]
|
|
74
|
-
}), /* @__PURE__ */ jsxs(SidebarDrawer, {
|
|
75
|
-
...rest,
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ jsxs(Header, { children: [/* @__PURE__ */ jsx(SidebarTrigger, {
|
|
78
|
-
className: cn(buttonVariants({
|
|
79
|
-
size: "icon-sm",
|
|
80
|
-
color: "ghost",
|
|
81
|
-
className: "ms-auto text-fd-muted-foreground"
|
|
82
|
-
})),
|
|
83
|
-
children: /* @__PURE__ */ jsx(X, {})
|
|
84
|
-
}), tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, { options: tabs })] }),
|
|
85
|
-
viewport,
|
|
86
|
-
/* @__PURE__ */ jsxs(Footer, {
|
|
87
|
-
className: cn("hidden flex-row items-center justify-end", (i18n || themeSwitch.enabled !== false) && "flex", iconLinks.length > 0 && "max-lg:flex"),
|
|
88
|
-
children: [
|
|
89
|
-
iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
90
|
-
item,
|
|
91
|
-
className: cn(buttonVariants({
|
|
92
|
-
size: "icon-sm",
|
|
93
|
-
color: "ghost"
|
|
94
|
-
}), "text-fd-muted-foreground lg:hidden", i === iconLinks.length - 1 && "me-auto"),
|
|
95
|
-
"aria-label": item.label,
|
|
96
|
-
children: item.icon
|
|
97
|
-
}, i)),
|
|
98
|
-
i18n && /* @__PURE__ */ jsx(LanguageToggle, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) }),
|
|
99
|
-
themeSwitch.enabled !== false && (themeSwitch.component ?? /* @__PURE__ */ jsx(ThemeToggle, { mode: themeSwitch.mode ?? "light-dark-system" }))
|
|
100
|
-
]
|
|
101
|
-
})
|
|
102
|
-
]
|
|
103
|
-
})] });
|
|
104
|
-
}
|
|
105
|
-
return /* @__PURE__ */ jsx(TreeContextProvider, {
|
|
6
|
+
function DocsLayout({ tree, tabMode = "sidebar", sidebar: { tabs: defaultTabs, ...sidebarProps } = {}, children, tabs = defaultTabs, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(LayoutBody, {
|
|
106
8
|
tree,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
sidebar(),
|
|
118
|
-
/* @__PURE__ */ jsx(DocsNavbar, {
|
|
119
|
-
...props,
|
|
120
|
-
links: navItems,
|
|
121
|
-
tabs
|
|
122
|
-
}),
|
|
123
|
-
props.children
|
|
124
|
-
]
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
})
|
|
9
|
+
tabs: useMemo(() => {
|
|
10
|
+
if (Array.isArray(tabs)) return tabs;
|
|
11
|
+
if (typeof tabs === "object") return getLayoutTabs(tree, tabs);
|
|
12
|
+
if (tabs !== false) return getLayoutTabs(tree);
|
|
13
|
+
return [];
|
|
14
|
+
}, [tabs, tree]),
|
|
15
|
+
tabMode,
|
|
16
|
+
sidebar: sidebarProps,
|
|
17
|
+
...props,
|
|
18
|
+
children
|
|
128
19
|
});
|
|
129
20
|
}
|
|
130
|
-
function DocsNavbar({ links, tabs, tabMode = "sidebar", sidebar: { collapsible: sidebarCollapsible = true } = {}, searchToggle = {}, themeSwitch = {}, nav = {}, i18n }) {
|
|
131
|
-
const navMode = nav.mode ?? "auto";
|
|
132
|
-
const showLayoutTabs = tabMode === "navbar" && tabs.length > 0;
|
|
133
|
-
return /* @__PURE__ */ jsxs(LayoutHeader, {
|
|
134
|
-
id: "nd-subnav",
|
|
135
|
-
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)]"),
|
|
136
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
137
|
-
"data-header-body": "",
|
|
138
|
-
className: "flex border-b px-4 gap-2 h-14 md:px-6",
|
|
139
|
-
children: [
|
|
140
|
-
/* @__PURE__ */ jsxs("div", {
|
|
141
|
-
className: cn("items-center", navMode === "top" && "flex flex-1", navMode === "auto" && "hidden has-data-[collapsed=true]:md:flex max-md:flex"),
|
|
142
|
-
children: [
|
|
143
|
-
sidebarCollapsible && navMode === "auto" && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
|
|
144
|
-
className: cn(buttonVariants({
|
|
145
|
-
color: "ghost",
|
|
146
|
-
size: "icon-sm"
|
|
147
|
-
}), "text-fd-muted-foreground data-[collapsed=false]:hidden max-md:hidden"),
|
|
148
|
-
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
149
|
-
}),
|
|
150
|
-
renderTitleNav(nav, { className: cn("inline-flex items-center gap-2.5 font-semibold", navMode === "auto" && "md:hidden") }),
|
|
151
|
-
nav.children
|
|
152
|
-
]
|
|
153
|
-
}),
|
|
154
|
-
searchToggle.enabled !== false && (searchToggle.components?.lg ? /* @__PURE__ */ jsx("div", {
|
|
155
|
-
className: cn("w-full my-auto max-md:hidden", navMode === "top" ? "rounded-xl max-w-sm" : "max-w-[240px]"),
|
|
156
|
-
children: searchToggle.components.lg
|
|
157
|
-
}) : /* @__PURE__ */ jsx(LargeSearchToggle, {
|
|
158
|
-
hideIfDisabled: true,
|
|
159
|
-
className: cn("w-full my-auto max-md:hidden", navMode === "top" ? "rounded-xl max-w-sm ps-2.5" : "max-w-[240px]")
|
|
160
|
-
})),
|
|
161
|
-
/* @__PURE__ */ jsxs("div", {
|
|
162
|
-
className: "flex flex-1 items-center justify-end md:gap-2",
|
|
163
|
-
children: [
|
|
164
|
-
/* @__PURE__ */ jsx("div", {
|
|
165
|
-
className: "flex items-center gap-6 empty:hidden max-lg:hidden",
|
|
166
|
-
children: links.filter((item) => item.type !== "icon").map((item, i) => /* @__PURE__ */ jsx(NavbarLinkItem, { item }, i))
|
|
167
|
-
}),
|
|
168
|
-
links.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
169
|
-
item,
|
|
170
|
-
className: cn(buttonVariants({
|
|
171
|
-
size: "icon-sm",
|
|
172
|
-
color: "ghost"
|
|
173
|
-
}), "text-fd-muted-foreground max-lg:hidden"),
|
|
174
|
-
"aria-label": item.label,
|
|
175
|
-
children: item.icon
|
|
176
|
-
}, i)),
|
|
177
|
-
/* @__PURE__ */ jsxs("div", {
|
|
178
|
-
className: "flex items-center md:hidden",
|
|
179
|
-
children: [searchToggle.enabled !== false && (searchToggle.components?.sm ?? /* @__PURE__ */ jsx(SearchToggle, {
|
|
180
|
-
hideIfDisabled: true,
|
|
181
|
-
className: "p-2"
|
|
182
|
-
})), /* @__PURE__ */ jsx(SidebarTrigger, {
|
|
183
|
-
className: cn(buttonVariants({
|
|
184
|
-
color: "ghost",
|
|
185
|
-
size: "icon-sm",
|
|
186
|
-
className: "p-2 -me-1.5"
|
|
187
|
-
})),
|
|
188
|
-
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
189
|
-
})]
|
|
190
|
-
}),
|
|
191
|
-
/* @__PURE__ */ jsxs("div", {
|
|
192
|
-
className: "flex items-center gap-2 max-md:hidden",
|
|
193
|
-
children: [
|
|
194
|
-
i18n && /* @__PURE__ */ jsx(LanguageToggle, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) }),
|
|
195
|
-
themeSwitch.enabled !== false && (themeSwitch.component ?? /* @__PURE__ */ jsx(ThemeToggle, { mode: themeSwitch.mode ?? "light-dark-system" })),
|
|
196
|
-
sidebarCollapsible && navMode === "top" && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
|
|
197
|
-
className: cn(buttonVariants({
|
|
198
|
-
color: "secondary",
|
|
199
|
-
size: "icon-sm"
|
|
200
|
-
}), "text-fd-muted-foreground rounded-full -me-1.5"),
|
|
201
|
-
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
202
|
-
})
|
|
203
|
-
]
|
|
204
|
-
})
|
|
205
|
-
]
|
|
206
|
-
})
|
|
207
|
-
]
|
|
208
|
-
}), showLayoutTabs && /* @__PURE__ */ jsx(LayoutHeaderTabs, {
|
|
209
|
-
"data-header-tabs": "",
|
|
210
|
-
className: "overflow-x-auto border-b px-6 h-10 max-lg:hidden",
|
|
211
|
-
options: tabs
|
|
212
|
-
})]
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
21
|
//#endregion
|
|
217
|
-
export { DocsLayout };
|
|
218
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
export { DocsLayout, useNotebookLayout };
|
|
@@ -1,86 +1,93 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
2
|
+
import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
3
|
+
import { Footer, FooterProps } from "./slots/footer.js";
|
|
4
|
+
import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
5
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
3
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
7
|
+
import { TOCItemType } from "@hanzo/docs-core/toc";
|
|
5
8
|
|
|
6
9
|
//#region src/layouts/notebook/page/index.d.ts
|
|
7
|
-
interface
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
component: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
interface FooterOptions extends FooterProps {
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
component: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
interface DocsPageProps {
|
|
10
|
+
interface DocsPageProps extends ComponentProps<'article'> {
|
|
16
11
|
toc?: TOCItemType[];
|
|
17
|
-
tableOfContent?: Partial<TableOfContentOptions>;
|
|
18
|
-
tableOfContentPopover?: Partial<TableOfContentPopoverOptions>;
|
|
19
12
|
/**
|
|
20
13
|
* Extend the page to fill all available space
|
|
21
14
|
*
|
|
22
15
|
* @defaultValue false
|
|
23
16
|
*/
|
|
24
17
|
full?: boolean;
|
|
18
|
+
slots?: Partial<DocsPageSlots>;
|
|
19
|
+
footer?: FooterOptions;
|
|
20
|
+
breadcrumb?: BreadcrumbOptions;
|
|
21
|
+
tableOfContent?: TableOfContentOptions;
|
|
22
|
+
tableOfContentPopover?: TableOfContentPopoverOptions;
|
|
23
|
+
}
|
|
24
|
+
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
25
|
+
enabled?: boolean;
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
breadcrumb?: Partial<BreadcrumbOptions>;
|
|
29
|
-
/**
|
|
30
|
-
* Footer navigation, located under the page body.
|
|
31
|
-
*
|
|
32
|
-
* You can specify `footer.children` to add extra components under the footer.
|
|
33
|
-
*/
|
|
34
|
-
footer?: Partial<FooterOptions>;
|
|
35
|
-
children?: ReactNode;
|
|
36
|
-
/**
|
|
37
|
-
* Apply class names to the `#nd-page` container.
|
|
27
|
+
* @deprecated use `slots.breadcrumb` instead.
|
|
38
28
|
*/
|
|
39
|
-
|
|
29
|
+
component?: ReactNode;
|
|
40
30
|
}
|
|
41
|
-
|
|
31
|
+
interface FooterOptions extends FooterProps {
|
|
32
|
+
enabled?: boolean;
|
|
42
33
|
/**
|
|
43
|
-
*
|
|
34
|
+
* @deprecated use `slots.footer` instead.
|
|
44
35
|
*/
|
|
45
|
-
|
|
36
|
+
component?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
|
|
39
|
+
enabled?: boolean;
|
|
46
40
|
/**
|
|
47
|
-
*
|
|
41
|
+
* @deprecated use `slots.toc` instead.
|
|
48
42
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
component?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
interface TableOfContentPopoverOptions extends TOCPopoverProps {
|
|
46
|
+
enabled?: boolean;
|
|
52
47
|
/**
|
|
53
|
-
* @
|
|
48
|
+
* @deprecated use `slots.tocPopover` instead.
|
|
54
49
|
*/
|
|
55
|
-
|
|
50
|
+
component?: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
interface DocsPageSlots {
|
|
53
|
+
toc: {
|
|
54
|
+
provider: FC<TOCProviderProps>;
|
|
55
|
+
main: FC<TOCProps>;
|
|
56
|
+
popover: FC<TOCPopoverProps>;
|
|
57
|
+
};
|
|
58
|
+
container: FC<ComponentProps<'article'>>;
|
|
59
|
+
footer: FC<FooterProps>;
|
|
60
|
+
breadcrumb: FC<BreadcrumbProps>;
|
|
61
|
+
}
|
|
62
|
+
type PageSlotsProps = Pick<DocsPageProps, 'full'>;
|
|
63
|
+
declare function useDocsPage(): {
|
|
64
|
+
props: PageSlotsProps;
|
|
65
|
+
slots: DocsPageSlots;
|
|
56
66
|
};
|
|
57
|
-
type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
|
|
58
67
|
declare function DocsPage({
|
|
68
|
+
tableOfContent: {
|
|
69
|
+
enabled: tocEnabled,
|
|
70
|
+
single,
|
|
71
|
+
...tocProps
|
|
72
|
+
},
|
|
73
|
+
tableOfContentPopover: {
|
|
74
|
+
enabled: tocPopoverEnabled,
|
|
75
|
+
...tocPopoverProps
|
|
76
|
+
},
|
|
59
77
|
breadcrumb: {
|
|
60
78
|
enabled: breadcrumbEnabled,
|
|
61
|
-
|
|
62
|
-
...breadcrumbProps
|
|
79
|
+
...breadcrumb
|
|
63
80
|
},
|
|
64
81
|
footer: {
|
|
65
82
|
enabled: footerEnabled,
|
|
66
|
-
|
|
67
|
-
...footerProps
|
|
83
|
+
...footer
|
|
68
84
|
},
|
|
69
85
|
full,
|
|
70
|
-
tableOfContentPopover: {
|
|
71
|
-
enabled: tocPopoverEnabled,
|
|
72
|
-
component: tocPopover,
|
|
73
|
-
...tocPopoverOptions
|
|
74
|
-
},
|
|
75
|
-
tableOfContent: {
|
|
76
|
-
enabled: tocEnabled,
|
|
77
|
-
component: tocReplace,
|
|
78
|
-
...tocOptions
|
|
79
|
-
},
|
|
80
86
|
toc,
|
|
87
|
+
slots: defaultSlots,
|
|
81
88
|
children,
|
|
82
|
-
|
|
83
|
-
}: DocsPageProps):
|
|
89
|
+
...containerProps
|
|
90
|
+
}: DocsPageProps): react_jsx_runtime0.JSX.Element;
|
|
84
91
|
declare function EditOnGitHub(props: ComponentProps<'a'>): react_jsx_runtime0.JSX.Element;
|
|
85
92
|
/**
|
|
86
93
|
* Add typography styles
|
|
@@ -100,6 +107,11 @@ declare function DocsTitle({
|
|
|
100
107
|
className,
|
|
101
108
|
...props
|
|
102
109
|
}: ComponentProps<'h1'>): react_jsx_runtime0.JSX.Element;
|
|
110
|
+
declare function PageLastUpdate({
|
|
111
|
+
date: value,
|
|
112
|
+
...props
|
|
113
|
+
}: Omit<ComponentProps<'p'>, 'children'> & {
|
|
114
|
+
date: Date;
|
|
115
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
103
116
|
//#endregion
|
|
104
|
-
export { DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, PageBreadcrumb, PageLastUpdate };
|
|
105
|
-
//# sourceMappingURL=index.d.ts.map
|
|
117
|
+
export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { I18nLabel } from "../../../contexts/i18n.js";
|
|
3
|
+
import { I18nLabel, useI18n } from "../../../contexts/i18n.js";
|
|
3
4
|
import { cn } from "../../../utils/cn.js";
|
|
4
5
|
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
6
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
7
|
+
import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
8
|
+
import { Footer } from "./slots/footer.js";
|
|
9
|
+
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
10
|
+
import { Container } from "./slots/container.js";
|
|
11
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Edit } from "lucide-react";
|
|
12
14
|
//#region src/layouts/notebook/page/index.tsx
|
|
13
15
|
var page_exports = /* @__PURE__ */ __exportAll({
|
|
14
16
|
DocsBody: () => DocsBody,
|
|
@@ -16,49 +18,54 @@ var page_exports = /* @__PURE__ */ __exportAll({
|
|
|
16
18
|
DocsPage: () => DocsPage,
|
|
17
19
|
DocsTitle: () => DocsTitle,
|
|
18
20
|
EditOnGitHub: () => EditOnGitHub,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
MarkdownCopyButton: () => MarkdownCopyButton,
|
|
22
|
+
PageBreadcrumb: () => Breadcrumb,
|
|
23
|
+
PageFooter: () => Footer,
|
|
24
|
+
PageLastUpdate: () => PageLastUpdate,
|
|
25
|
+
ViewOptionsPopover: () => ViewOptionsPopover,
|
|
26
|
+
useDocsPage: () => useDocsPage
|
|
21
27
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
className: "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",
|
|
28
|
+
const PageContext = createContext(null);
|
|
29
|
+
function useDocsPage() {
|
|
30
|
+
const context = use(PageContext);
|
|
31
|
+
if (!context) throw new Error("Please use page components under <DocsPage /> (`@hanzo/docs-ui/layouts/notebook/page`).");
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
function DocsPage({ tableOfContent: { enabled: tocEnabled, single, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, breadcrumb: { enabled: breadcrumbEnabled = true, ...breadcrumb } = {}, footer: { enabled: footerEnabled = true, ...footer } = {}, full = false, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
|
|
35
|
+
tocEnabled ??= Boolean(!full && (toc.length > 0 || tocProps.footer || tocProps.header));
|
|
36
|
+
tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
|
|
37
|
+
const slots = {
|
|
38
|
+
breadcrumb: defaultSlots.breadcrumb ?? Breadcrumb,
|
|
39
|
+
footer: defaultSlots.footer ?? Footer,
|
|
40
|
+
toc: defaultSlots.toc ?? {
|
|
41
|
+
provider: TOCProvider,
|
|
42
|
+
main: TOC,
|
|
43
|
+
popover: TOCPopover
|
|
44
|
+
},
|
|
45
|
+
container: defaultSlots.container ?? Container
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ jsx(PageContext, {
|
|
48
|
+
value: {
|
|
49
|
+
props: { full },
|
|
50
|
+
slots
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ jsxs(slots.toc.provider, {
|
|
53
|
+
single,
|
|
54
|
+
toc: tocEnabled || tocPopoverEnabled ? toc : [],
|
|
50
55
|
children: [
|
|
51
|
-
|
|
52
|
-
/* @__PURE__ */ jsxs(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
tocPopoverEnabled && (tocPopoverProps.component ?? /* @__PURE__ */ jsx(slots.toc.popover, { ...tocPopoverProps })),
|
|
57
|
+
/* @__PURE__ */ jsxs(slots.container, {
|
|
58
|
+
...containerProps,
|
|
59
|
+
children: [
|
|
60
|
+
breadcrumbEnabled && (breadcrumb.component ?? /* @__PURE__ */ jsx(slots.breadcrumb, { ...breadcrumb })),
|
|
61
|
+
children,
|
|
62
|
+
footerEnabled && (footer.component ?? /* @__PURE__ */ jsx(slots.footer, { ...footer }))
|
|
63
|
+
]
|
|
56
64
|
}),
|
|
57
|
-
|
|
58
|
-
tocOptions.footer
|
|
65
|
+
tocEnabled && (tocProps.component ?? /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps }))
|
|
59
66
|
]
|
|
60
|
-
})
|
|
61
|
-
|
|
67
|
+
})
|
|
68
|
+
});
|
|
62
69
|
}
|
|
63
70
|
function EditOnGitHub(props) {
|
|
64
71
|
return /* @__PURE__ */ jsx("a", {
|
|
@@ -67,10 +74,9 @@ function EditOnGitHub(props) {
|
|
|
67
74
|
...props,
|
|
68
75
|
className: cn(buttonVariants({
|
|
69
76
|
color: "secondary",
|
|
70
|
-
size: "sm"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), /* @__PURE__ */ jsx(I18nLabel, { label: "editOnGithub" })] })
|
|
77
|
+
size: "sm"
|
|
78
|
+
}), "gap-1.5 not-prose", props.className),
|
|
79
|
+
children: props.children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), /* @__PURE__ */ jsx(I18nLabel, { label: "editOnGithub" })] })
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
82
|
/**
|
|
@@ -98,7 +104,21 @@ function DocsTitle({ children, className, ...props }) {
|
|
|
98
104
|
children
|
|
99
105
|
});
|
|
100
106
|
}
|
|
101
|
-
|
|
107
|
+
function PageLastUpdate({ date: value, ...props }) {
|
|
108
|
+
const { text } = useI18n();
|
|
109
|
+
const [date, setDate] = useState("");
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
setDate(value.toLocaleDateString());
|
|
112
|
+
}, [value]);
|
|
113
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
114
|
+
...props,
|
|
115
|
+
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
116
|
+
children: [
|
|
117
|
+
text.lastUpdate,
|
|
118
|
+
" ",
|
|
119
|
+
date
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
102
123
|
//#endregion
|
|
103
|
-
export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, PageBreadcrumb, PageLastUpdate, page_exports };
|
|
104
|
-
//# sourceMappingURL=index.js.map
|
|
124
|
+
export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, page_exports, useDocsPage };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { BreadcrumbOptions } from "@hanzo/docs-core/breadcrumb";
|
|
4
|
+
|
|
5
|
+
//#region src/layouts/notebook/page/slots/breadcrumb.d.ts
|
|
6
|
+
type BreadcrumbProps = BreadcrumbOptions & ComponentProps<'div'>;
|
|
7
|
+
declare function Breadcrumb({
|
|
8
|
+
includeRoot,
|
|
9
|
+
includeSeparator,
|
|
10
|
+
includePage,
|
|
11
|
+
...props
|
|
12
|
+
}: BreadcrumbProps): react_jsx_runtime0.JSX.Element | null;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Breadcrumb, BreadcrumbProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
|
|
4
|
+
import { Fragment, useMemo } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import Link from "@hanzo/docs-core/link";
|
|
7
|
+
import { ChevronRight } from "lucide-react";
|
|
8
|
+
import { getBreadcrumbItemsFromPath } from "@hanzo/docs-core/breadcrumb";
|
|
9
|
+
//#region src/layouts/notebook/page/slots/breadcrumb.tsx
|
|
10
|
+
function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
11
|
+
const path = useTreePath();
|
|
12
|
+
const { root } = useTreeContext();
|
|
13
|
+
const items = useMemo(() => {
|
|
14
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
15
|
+
includePage,
|
|
16
|
+
includeSeparator,
|
|
17
|
+
includeRoot
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
includePage,
|
|
21
|
+
includeRoot,
|
|
22
|
+
includeSeparator,
|
|
23
|
+
path,
|
|
24
|
+
root
|
|
25
|
+
]);
|
|
26
|
+
if (items.length === 0) return null;
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
...props,
|
|
29
|
+
className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
|
|
30
|
+
children: items.map((item, i) => {
|
|
31
|
+
const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
33
|
+
href: item.url,
|
|
34
|
+
className: cn(className, "transition-opacity hover:opacity-80"),
|
|
35
|
+
children: item.name
|
|
36
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className,
|
|
38
|
+
children: item.name
|
|
39
|
+
})] }, i);
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Breadcrumb };
|
|
@@ -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/page/slots/container.d.ts
|
|
5
|
+
declare function Container(props: ComponentProps<'article'>): react_jsx_runtime0.JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Container };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useDocsPage } from "../index.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/layouts/notebook/page/slots/container.tsx
|
|
6
|
+
function Container(props) {
|
|
7
|
+
const { props: { full } } = useDocsPage();
|
|
8
|
+
return /* @__PURE__ */ jsx("article", {
|
|
9
|
+
id: "nd-page",
|
|
10
|
+
"data-full": full,
|
|
11
|
+
...props,
|
|
12
|
+
className: cn("flex flex-col [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14 *:max-w-[900px]", full && "*:max-w-[1285px]", props.className),
|
|
13
|
+
children: props.children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Container };
|