@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,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 { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
7
|
+
import { Footer } from "./slots/footer.js";
|
|
8
|
+
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
9
|
+
import { Container } from "./slots/container.js";
|
|
10
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.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/docs/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-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] flex flex-col [grid-area:toc] w-(--fd-toc-width) pt-12 pe-4 pb-2 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/docs/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/docs/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/docs/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/docs/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/docs/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 w-full max-w-[900px] mx-auto [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14", full ? "max-w-[1168px]" : "xl:layout:[--fd-toc-width:268px]", props.className),
|
|
13
|
+
children: props.children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Container };
|
|
@@ -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/docs/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/docs/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/docs/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,166 @@
|
|
|
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 { useDocsLayout } from "../../client.js";
|
|
10
|
+
import "../../index.js";
|
|
11
|
+
import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { ChevronDown, Text } from "lucide-react";
|
|
14
|
+
//#region src/layouts/docs/page/slots/toc.tsx
|
|
15
|
+
function TOCProvider(props) {
|
|
16
|
+
return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
|
|
17
|
+
}
|
|
18
|
+
function TOC({ container, header, footer, style = "normal" }) {
|
|
19
|
+
const items = useTOCItems();
|
|
20
|
+
const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
id: "nd-toc",
|
|
23
|
+
...container,
|
|
24
|
+
className: cn("sticky top-(--fd-docs-row-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] flex flex-col [grid-area:toc] w-(--fd-toc-width) pt-12 pe-4 pb-2 max-xl:hidden", container?.className),
|
|
25
|
+
children: [
|
|
26
|
+
header,
|
|
27
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
28
|
+
id: "toc-title",
|
|
29
|
+
className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(I18nLabel, { label: "toc" })]
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
|
|
33
|
+
footer
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const TocPopoverContext = createContext(null);
|
|
38
|
+
function TOCPopover({ container, trigger, content, header, footer, style = "normal" }) {
|
|
39
|
+
const items = useTOCItems();
|
|
40
|
+
const ref = useRef(null);
|
|
41
|
+
const [open, setOpen] = useState(false);
|
|
42
|
+
const { isNavTransparent } = useDocsLayout();
|
|
43
|
+
const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
|
|
44
|
+
const onClickOutside = useEffectEvent((e) => {
|
|
45
|
+
if (!open || !(e.target instanceof HTMLElement)) return;
|
|
46
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
47
|
+
});
|
|
48
|
+
const onClickItem = () => {
|
|
49
|
+
setOpen(false);
|
|
50
|
+
};
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
window.addEventListener("click", onClickOutside);
|
|
53
|
+
return () => {
|
|
54
|
+
window.removeEventListener("click", onClickOutside);
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
return /* @__PURE__ */ jsx(TocPopoverContext, {
|
|
58
|
+
value: useMemo(() => ({
|
|
59
|
+
open,
|
|
60
|
+
setOpen
|
|
61
|
+
}), [setOpen, open]),
|
|
62
|
+
children: /* @__PURE__ */ jsx(Collapsible, {
|
|
63
|
+
open,
|
|
64
|
+
onOpenChange: setOpen,
|
|
65
|
+
"data-toc-popover": "",
|
|
66
|
+
...container,
|
|
67
|
+
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),
|
|
68
|
+
children: /* @__PURE__ */ jsxs("header", {
|
|
69
|
+
ref,
|
|
70
|
+
className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
|
|
71
|
+
children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
|
|
72
|
+
...content,
|
|
73
|
+
children: [
|
|
74
|
+
header,
|
|
75
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
|
|
76
|
+
item,
|
|
77
|
+
onClick: onClickItem
|
|
78
|
+
}, item.url))] }) }),
|
|
79
|
+
footer
|
|
80
|
+
]
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function PageTOCPopoverTrigger({ className, ...props }) {
|
|
87
|
+
const { text } = useI18n();
|
|
88
|
+
const { open } = use(TocPopoverContext);
|
|
89
|
+
const items = useItems();
|
|
90
|
+
const selectedIdx = items.findIndex((item) => item.active);
|
|
91
|
+
const path = useTreePath().at(-1);
|
|
92
|
+
const showItem = selectedIdx !== -1 && !open;
|
|
93
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
94
|
+
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),
|
|
95
|
+
"data-toc-popover-trigger": "",
|
|
96
|
+
...props,
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ jsx(ProgressCircle, {
|
|
99
|
+
value: (selectedIdx + 1) / Math.max(1, items.length),
|
|
100
|
+
max: 1,
|
|
101
|
+
className: cn("shrink-0", open && "text-fd-primary")
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsxs("span", {
|
|
104
|
+
className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
|
|
105
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
|
|
107
|
+
children: path?.name ?? text.toc
|
|
108
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
|
|
110
|
+
children: items[selectedIdx]?.original.title
|
|
111
|
+
})]
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function clamp(input, min, max) {
|
|
118
|
+
if (input < min) return min;
|
|
119
|
+
if (input > max) return max;
|
|
120
|
+
return input;
|
|
121
|
+
}
|
|
122
|
+
function ProgressCircle({ value, strokeWidth = 2, size = 24, min = 0, max = 100, ...restSvgProps }) {
|
|
123
|
+
const normalizedValue = clamp(value, min, max);
|
|
124
|
+
const radius = (size - strokeWidth) / 2;
|
|
125
|
+
const circumference = 2 * Math.PI * radius;
|
|
126
|
+
const progress = normalizedValue / max * circumference;
|
|
127
|
+
const circleProps = {
|
|
128
|
+
cx: size / 2,
|
|
129
|
+
cy: size / 2,
|
|
130
|
+
r: radius,
|
|
131
|
+
fill: "none",
|
|
132
|
+
strokeWidth
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
135
|
+
role: "progressbar",
|
|
136
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
137
|
+
"aria-valuenow": normalizedValue,
|
|
138
|
+
"aria-valuemin": min,
|
|
139
|
+
"aria-valuemax": max,
|
|
140
|
+
...restSvgProps,
|
|
141
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
142
|
+
...circleProps,
|
|
143
|
+
className: "stroke-current/25"
|
|
144
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
145
|
+
...circleProps,
|
|
146
|
+
stroke: "currentColor",
|
|
147
|
+
strokeDasharray: circumference,
|
|
148
|
+
strokeDashoffset: circumference - progress,
|
|
149
|
+
strokeLinecap: "round",
|
|
150
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`,
|
|
151
|
+
className: "transition-all"
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function PageTOCPopoverContent(props) {
|
|
156
|
+
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
157
|
+
"data-toc-popover-content": "",
|
|
158
|
+
...props,
|
|
159
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
160
|
+
className: "flex flex-col px-4 max-h-[50vh] md:px-6",
|
|
161
|
+
children: props.children
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
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/docs/slots/container.d.ts
|
|
5
|
+
declare function Container(props: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Container };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useDocsLayout } from "../client.js";
|
|
4
|
+
import "../index.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/layouts/docs/slots/container.tsx
|
|
7
|
+
function Container(props) {
|
|
8
|
+
const { slots } = useDocsLayout();
|
|
9
|
+
const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
id: "nd-docs-layout",
|
|
12
|
+
"data-sidebar-collapsed": collapsed,
|
|
13
|
+
...props,
|
|
14
|
+
style: {
|
|
15
|
+
gridTemplate: `"sidebar sidebar header toc toc"
|
|
16
|
+
"sidebar sidebar toc-popover toc toc"
|
|
17
|
+
"sidebar sidebar main toc toc" 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-width) - var(--fd-toc-width))) var(--fd-toc-width) minmax(min-content, 1fr)`,
|
|
18
|
+
"--fd-docs-row-1": "var(--fd-banner-height, 0px)",
|
|
19
|
+
"--fd-docs-row-2": "calc(var(--fd-docs-row-1) + var(--fd-header-height))",
|
|
20
|
+
"--fd-docs-row-3": "calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))",
|
|
21
|
+
"--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
|
|
22
|
+
...props.style
|
|
23
|
+
},
|
|
24
|
+
className: cn("grid transition-[grid-template-columns] overflow-x-clip min-h-(--fd-docs-height) [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px]", props.className),
|
|
25
|
+
children: props.children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
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/docs/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,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { useDocsLayout } from "../client.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { SidebarIcon } from "lucide-react";
|
|
7
|
+
//#region src/layouts/docs/slots/header.tsx
|
|
8
|
+
function Header(props) {
|
|
9
|
+
const { isNavTransparent, slots, props: { nav } } = useDocsLayout();
|
|
10
|
+
if (nav?.component) return nav.component;
|
|
11
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
12
|
+
id: "nd-subnav",
|
|
13
|
+
"data-transparent": isNavTransparent,
|
|
14
|
+
...props,
|
|
15
|
+
className: cn("[grid-area:header] sticky top-(--fd-docs-row-1) z-30 flex items-center ps-4 pe-2.5 border-b transition-colors backdrop-blur-sm h-(--fd-header-height) md:hidden max-md:layout:[--fd-header-height:--spacing(14)] data-[transparent=false]:bg-fd-background/80", props.className),
|
|
16
|
+
children: [
|
|
17
|
+
slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 font-semibold" }),
|
|
18
|
+
/* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "flex-1",
|
|
20
|
+
children: nav?.children
|
|
21
|
+
}),
|
|
22
|
+
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
23
|
+
hideIfDisabled: true,
|
|
24
|
+
className: "p-2"
|
|
25
|
+
}),
|
|
26
|
+
slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, {
|
|
27
|
+
className: cn(buttonVariants({
|
|
28
|
+
color: "ghost",
|
|
29
|
+
size: "icon-sm",
|
|
30
|
+
className: "p-2"
|
|
31
|
+
})),
|
|
32
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Header };
|