@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,101 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { useI18n } from "../../contexts/i18n.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
6
6
|
import { TocThumb, useTOCItems } from "./index.js";
|
|
7
|
-
import { useEffect, useRef, useState } from "react";
|
|
7
|
+
import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import * as Primitive from "@hanzo/docs-core/toc";
|
|
10
|
-
|
|
11
10
|
//#region src/components/toc/clerk.tsx
|
|
11
|
+
var clerk_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
TOCEmpty: () => TOCEmpty,
|
|
13
|
+
TOCItem: () => TOCItem,
|
|
14
|
+
TOCItems: () => TOCItems
|
|
15
|
+
});
|
|
12
16
|
function TOCItems({ ref, className, ...props }) {
|
|
13
17
|
const containerRef = useRef(null);
|
|
14
18
|
const items = useTOCItems();
|
|
15
|
-
const { text } = useI18n();
|
|
16
19
|
const [svg, setSvg] = useState();
|
|
17
|
-
|
|
18
|
-
if (!containerRef.current) return;
|
|
20
|
+
const onResize = useEffectEvent(() => {
|
|
19
21
|
const container = containerRef.current;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
if (!container || container.clientHeight === 0) return;
|
|
23
|
+
let w = 0;
|
|
24
|
+
let h = 0;
|
|
25
|
+
let b0 = 0;
|
|
26
|
+
let d = "";
|
|
27
|
+
for (let i = 0; i < items.length; i++) {
|
|
28
|
+
const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
|
|
29
|
+
if (!element) continue;
|
|
30
|
+
const styles = getComputedStyle(element);
|
|
31
|
+
const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
|
|
32
|
+
w = Math.max(offset, w);
|
|
33
|
+
h = Math.max(h, bottom);
|
|
34
|
+
if (i === 0) d += ` M${offset} ${top} L${offset} ${bottom}`;
|
|
35
|
+
else {
|
|
36
|
+
const pOffset = getLineOffset(items[i - 1].depth) + 1;
|
|
37
|
+
d += ` C ${pOffset} ${top - 4} ${offset} ${b0 + 4} ${offset} ${top} L${offset} ${bottom}`;
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
path: d.join(" "),
|
|
36
|
-
width: w + 1,
|
|
37
|
-
height: h
|
|
38
|
-
});
|
|
39
|
+
b0 = bottom;
|
|
39
40
|
}
|
|
41
|
+
setSvg({
|
|
42
|
+
d,
|
|
43
|
+
width: w + 1,
|
|
44
|
+
height: h
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!containerRef.current) return;
|
|
40
49
|
const observer = new ResizeObserver(onResize);
|
|
41
50
|
onResize();
|
|
42
|
-
observer.observe(
|
|
51
|
+
observer.observe(containerRef.current);
|
|
43
52
|
return () => {
|
|
44
53
|
observer.disconnect();
|
|
45
54
|
};
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsx("div", {
|
|
52
|
-
className: "absolute start-0 top-0 rtl:-scale-x-100",
|
|
55
|
+
}, []);
|
|
56
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsxs(TocThumb, {
|
|
57
|
+
containerRef,
|
|
58
|
+
className: "absolute top-0 inset-s-0",
|
|
53
59
|
style: {
|
|
54
60
|
width: svg.width,
|
|
55
|
-
height: svg.height
|
|
56
|
-
maskImage: `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`)}")`
|
|
61
|
+
height: svg.height
|
|
57
62
|
},
|
|
58
|
-
children: /* @__PURE__ */ jsx(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
children: [/* @__PURE__ */ jsx("svg", {
|
|
64
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
+
viewBox: `0 0 ${svg.width} ${svg.height}`,
|
|
66
|
+
className: "absolute transition-[clip-path]",
|
|
67
|
+
style: {
|
|
68
|
+
width: svg.width,
|
|
69
|
+
height: svg.height,
|
|
70
|
+
clipPath: `polygon(0 var(--fd-top), 100% var(--fd-top), 100% calc(var(--fd-top) + var(--fd-height)), 0 calc(var(--fd-top) + var(--fd-height)))`
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
73
|
+
d: svg.d,
|
|
74
|
+
className: "stroke-fd-primary",
|
|
75
|
+
strokeWidth: "1",
|
|
76
|
+
fill: "none"
|
|
77
|
+
})
|
|
78
|
+
}), /* @__PURE__ */ jsx(ThumbBox, {})]
|
|
62
79
|
}), /* @__PURE__ */ jsx("div", {
|
|
63
80
|
ref: mergeRefs(containerRef, ref),
|
|
64
81
|
className: cn("flex flex-col", className),
|
|
65
|
-
...props
|
|
66
|
-
children: items.map((item, i) => /* @__PURE__ */ jsx(TOCItem, {
|
|
67
|
-
item,
|
|
68
|
-
upper: items[i - 1]?.depth,
|
|
69
|
-
lower: items[i + 1]?.depth
|
|
70
|
-
}, item.url))
|
|
82
|
+
...props
|
|
71
83
|
})] });
|
|
72
84
|
}
|
|
85
|
+
function TOCEmpty() {
|
|
86
|
+
const { text } = useI18n();
|
|
87
|
+
return /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
|
|
89
|
+
children: text.tocNoHeadings
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function ThumbBox() {
|
|
93
|
+
const items = Primitive.useItems();
|
|
94
|
+
let startIdx = -1;
|
|
95
|
+
let endIdx = -1;
|
|
96
|
+
let lastInactiveIdx = -1;
|
|
97
|
+
for (let i = 0; i < items.length; i++) {
|
|
98
|
+
const item = items[i];
|
|
99
|
+
if (item.active) {
|
|
100
|
+
if (startIdx === -1) startIdx = i;
|
|
101
|
+
endIdx = i;
|
|
102
|
+
} else if (lastInactiveIdx === -1 || items[lastInactiveIdx].t < item.t) lastInactiveIdx = i;
|
|
103
|
+
}
|
|
104
|
+
if (startIdx === -1) return;
|
|
105
|
+
const isStart = endIdx < lastInactiveIdx;
|
|
106
|
+
return /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: "absolute size-1 bg-fd-primary rounded-full transition-transform",
|
|
108
|
+
style: { translate: `calc(${getLineOffset(items[isStart ? startIdx : endIdx].original.depth)}px - 1.25px) ${isStart ? "var(--fd-top)" : "calc(var(--fd-top) + var(--fd-height))"}` }
|
|
109
|
+
});
|
|
110
|
+
}
|
|
73
111
|
function getItemOffset(depth) {
|
|
74
112
|
if (depth <= 2) return 14;
|
|
75
113
|
if (depth === 3) return 26;
|
|
76
114
|
return 36;
|
|
77
115
|
}
|
|
78
116
|
function getLineOffset(depth) {
|
|
79
|
-
|
|
117
|
+
if (depth <= 2) return 2;
|
|
118
|
+
if (depth === 3) return 10;
|
|
119
|
+
return 20;
|
|
80
120
|
}
|
|
81
|
-
function TOCItem({ item,
|
|
82
|
-
const
|
|
121
|
+
function TOCItem({ item, ...props }) {
|
|
122
|
+
const items = useTOCItems();
|
|
123
|
+
const { lowerOffset, offset, upperOffset } = useMemo(() => {
|
|
124
|
+
const index = items.indexOf(item);
|
|
125
|
+
const offset = getLineOffset(item.depth);
|
|
126
|
+
return {
|
|
127
|
+
offset,
|
|
128
|
+
upperOffset: index > 0 ? getLineOffset(items[index - 1].depth) : offset,
|
|
129
|
+
lowerOffset: index + 1 < items.length ? getLineOffset(items[index + 1].depth) : offset
|
|
130
|
+
};
|
|
131
|
+
}, [items, item]);
|
|
83
132
|
return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
|
|
84
133
|
href: item.url,
|
|
85
|
-
|
|
86
|
-
className: "prose relative py-1.5 text-sm text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
134
|
+
...props,
|
|
135
|
+
className: cn("prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary", props.className),
|
|
136
|
+
style: {
|
|
137
|
+
paddingInlineStart: getItemOffset(item.depth),
|
|
138
|
+
...props.style
|
|
139
|
+
},
|
|
87
140
|
children: [
|
|
88
141
|
offset !== upperOffset && /* @__PURE__ */ jsx("svg", {
|
|
89
142
|
xmlns: "http://www.w3.org/2000/svg",
|
|
90
|
-
viewBox:
|
|
91
|
-
className: "absolute -top-1.5
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
143
|
+
viewBox: `${Math.min(offset, upperOffset)} 0 ${Math.abs(upperOffset - offset)} 12`,
|
|
144
|
+
className: "absolute -top-1.5",
|
|
145
|
+
style: {
|
|
146
|
+
width: Math.abs(upperOffset - offset) + 1,
|
|
147
|
+
height: 12,
|
|
148
|
+
insetInlineStart: Math.min(offset, upperOffset)
|
|
149
|
+
},
|
|
150
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
151
|
+
d: `M ${upperOffset} 0 C ${upperOffset} 8 ${offset} 4 ${offset} 12`,
|
|
152
|
+
stroke: "black",
|
|
153
|
+
strokeWidth: "1",
|
|
154
|
+
fill: "none",
|
|
155
|
+
className: "stroke-fd-foreground/10"
|
|
99
156
|
})
|
|
100
157
|
}),
|
|
101
158
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -106,7 +163,5 @@ function TOCItem({ item, upper = item.depth, lower = item.depth }) {
|
|
|
106
163
|
]
|
|
107
164
|
});
|
|
108
165
|
}
|
|
109
|
-
|
|
110
166
|
//#endregion
|
|
111
|
-
export { TOCItems };
|
|
112
|
-
//# sourceMappingURL=clerk.js.map
|
|
167
|
+
export { TOCEmpty, TOCItem, TOCItems, clerk_exports };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import * as Primitive from "@hanzo/docs-core/toc";
|
|
3
4
|
|
|
4
5
|
//#region src/components/toc/default.d.ts
|
|
5
6
|
declare function TOCItems({
|
|
@@ -7,6 +8,12 @@ declare function TOCItems({
|
|
|
7
8
|
className,
|
|
8
9
|
...props
|
|
9
10
|
}: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
|
|
11
|
+
declare function TOCEmpty(): react_jsx_runtime0.JSX.Element;
|
|
12
|
+
declare function TOCItem({
|
|
13
|
+
item,
|
|
14
|
+
...props
|
|
15
|
+
}: Primitive.TOCItemProps & {
|
|
16
|
+
item: Primitive.TOCItemType;
|
|
17
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
10
18
|
//#endregion
|
|
11
|
-
export { TOCItems };
|
|
12
|
-
//# sourceMappingURL=default.d.ts.map
|
|
19
|
+
export { TOCEmpty, TOCItem, TOCItems };
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { useI18n } from "../../contexts/i18n.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
6
|
-
import { TocThumb
|
|
6
|
+
import { TocThumb } from "./index.js";
|
|
7
7
|
import { useRef } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import * as Primitive from "@hanzo/docs-core/toc";
|
|
10
|
-
|
|
11
10
|
//#region src/components/toc/default.tsx
|
|
11
|
+
var default_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
TOCEmpty: () => TOCEmpty,
|
|
13
|
+
TOCItem: () => TOCItem,
|
|
14
|
+
TOCItems: () => TOCItems
|
|
15
|
+
});
|
|
12
16
|
function TOCItems({ ref, className, ...props }) {
|
|
13
17
|
const containerRef = useRef(null);
|
|
14
|
-
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "relative",
|
|
20
|
+
children: [/* @__PURE__ */ jsx(TocThumb, {
|
|
21
|
+
containerRef,
|
|
22
|
+
className: "absolute inset-y-0 inset-s-0 bg-fd-primary w-px transition-[clip-path]",
|
|
23
|
+
style: { clipPath: "polygon(0 var(--fd-top), 100% var(--fd-top), 100% calc(var(--fd-top) + var(--fd-height)), 0 calc(var(--fd-top) + var(--fd-height)))" }
|
|
24
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
25
|
+
ref: mergeRefs(ref, containerRef),
|
|
26
|
+
className: cn("flex flex-col border-s border-fd-foreground/10", className),
|
|
27
|
+
...props
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TOCEmpty() {
|
|
15
32
|
const { text } = useI18n();
|
|
16
|
-
|
|
33
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
34
|
className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
|
|
18
35
|
children: text.tocNoHeadings
|
|
19
36
|
});
|
|
20
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(TocThumb, {
|
|
21
|
-
containerRef,
|
|
22
|
-
className: "absolute top-(--fd-top) h-(--fd-height) w-0.5 rounded-e-sm bg-fd-primary transition-[top,height] ease-linear"
|
|
23
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
24
|
-
ref: mergeRefs(ref, containerRef),
|
|
25
|
-
className: cn("flex flex-col border-s border-fd-foreground/10", className),
|
|
26
|
-
...props,
|
|
27
|
-
children: items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))
|
|
28
|
-
})] });
|
|
29
37
|
}
|
|
30
|
-
function TOCItem({ item }) {
|
|
38
|
+
function TOCItem({ item, ...props }) {
|
|
31
39
|
return /* @__PURE__ */ jsx(Primitive.TOCItem, {
|
|
32
40
|
href: item.url,
|
|
33
|
-
|
|
41
|
+
...props,
|
|
42
|
+
className: cn("prose py-1.5 text-sm text-fd-muted-foreground scroll-m-4 transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary hover:text-fd-accent-foreground", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8", props.className),
|
|
34
43
|
children: item.title
|
|
35
44
|
});
|
|
36
45
|
}
|
|
37
|
-
|
|
38
46
|
//#endregion
|
|
39
|
-
export { TOCItems };
|
|
40
|
-
//# sourceMappingURL=default.js.map
|
|
47
|
+
export { TOCEmpty, TOCItem, TOCItems, default_exports };
|
|
@@ -4,23 +4,26 @@ import * as Primitive from "@hanzo/docs-core/toc";
|
|
|
4
4
|
|
|
5
5
|
//#region src/components/toc/index.d.ts
|
|
6
6
|
declare function useTOCItems(): Primitive.TOCItemType[];
|
|
7
|
+
type TOCProviderProps = Primitive.AnchorProviderProps;
|
|
8
|
+
declare const useActiveAnchor: typeof Primitive.useActiveAnchor, useActiveAnchors: typeof Primitive.useActiveAnchors, useItems: typeof Primitive.useItems;
|
|
7
9
|
declare function TOCProvider({
|
|
8
10
|
toc,
|
|
9
11
|
children,
|
|
10
12
|
...props
|
|
11
|
-
}:
|
|
13
|
+
}: TOCProviderProps): react_jsx_runtime0.JSX.Element;
|
|
12
14
|
declare function TOCScrollArea({
|
|
13
15
|
ref,
|
|
14
16
|
className,
|
|
15
17
|
...props
|
|
16
18
|
}: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
|
|
17
|
-
interface
|
|
19
|
+
interface TocThumbProps extends ComponentProps<'div'> {
|
|
18
20
|
containerRef: RefObject<HTMLElement | null>;
|
|
21
|
+
align?: 'center' | 'end';
|
|
19
22
|
}
|
|
20
23
|
declare function TocThumb({
|
|
21
24
|
containerRef,
|
|
25
|
+
align,
|
|
22
26
|
...props
|
|
23
|
-
}:
|
|
27
|
+
}: TocThumbProps): react_jsx_runtime0.JSX.Element;
|
|
24
28
|
//#endregion
|
|
25
|
-
export { TOCProvider, TOCScrollArea, TocThumb, useTOCItems };
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
29
|
+
export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
5
|
import { createContext, use, useEffect, useEffectEvent, useRef } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import * as Primitive from "@hanzo/docs-core/toc";
|
|
8
8
|
import { useOnChange } from "@hanzo/docs-core/utils/use-on-change";
|
|
9
|
-
|
|
10
9
|
//#region src/components/toc/index.tsx
|
|
10
|
+
var toc_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
TOCProvider: () => TOCProvider,
|
|
12
|
+
TOCScrollArea: () => TOCScrollArea,
|
|
13
|
+
TocThumb: () => TocThumb,
|
|
14
|
+
useActiveAnchor: () => useActiveAnchor,
|
|
15
|
+
useActiveAnchors: () => useActiveAnchors,
|
|
16
|
+
useItems: () => useItems,
|
|
17
|
+
useTOCItems: () => useTOCItems
|
|
18
|
+
});
|
|
11
19
|
const TOCContext = createContext([]);
|
|
12
20
|
function useTOCItems() {
|
|
13
21
|
return use(TOCContext);
|
|
14
22
|
}
|
|
23
|
+
const { useActiveAnchor, useActiveAnchors, useItems } = Primitive;
|
|
15
24
|
function TOCProvider({ toc, children, ...props }) {
|
|
16
25
|
return /* @__PURE__ */ jsx(TOCContext, {
|
|
17
26
|
value: toc,
|
|
@@ -34,17 +43,46 @@ function TOCScrollArea({ ref, className, ...props }) {
|
|
|
34
43
|
})
|
|
35
44
|
});
|
|
36
45
|
}
|
|
37
|
-
function TocThumb({ containerRef, ...props }) {
|
|
46
|
+
function TocThumb({ containerRef, align = "end", ...props }) {
|
|
38
47
|
const thumbRef = useRef(null);
|
|
39
|
-
const active =
|
|
48
|
+
const active = useActiveAnchors();
|
|
40
49
|
function update(info) {
|
|
41
50
|
const element = thumbRef.current;
|
|
42
|
-
|
|
43
|
-
element
|
|
44
|
-
element.style.setProperty("--fd-
|
|
51
|
+
const container = containerRef.current;
|
|
52
|
+
if (!element || !container) return;
|
|
53
|
+
element.style.setProperty("--fd-top", `${info.top}px`);
|
|
54
|
+
element.style.setProperty("--fd-height", `${info.height}px`);
|
|
55
|
+
}
|
|
56
|
+
function calc(active) {
|
|
57
|
+
const container = containerRef.current;
|
|
58
|
+
if (!container || container.clientHeight === 0) return null;
|
|
59
|
+
if (active.length === 0) return {
|
|
60
|
+
height: 0,
|
|
61
|
+
top: 0
|
|
62
|
+
};
|
|
63
|
+
let upper = Number.MAX_VALUE;
|
|
64
|
+
let lower = 0;
|
|
65
|
+
for (const item of active) {
|
|
66
|
+
const element = container.querySelector(`a[href="#${item}"]`);
|
|
67
|
+
if (!element) continue;
|
|
68
|
+
if (align === "center") {
|
|
69
|
+
const y = element.offsetTop + element.clientHeight / 2;
|
|
70
|
+
upper = Math.min(upper, y);
|
|
71
|
+
lower = Math.max(lower, y);
|
|
72
|
+
} else {
|
|
73
|
+
const styles = getComputedStyle(element);
|
|
74
|
+
upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
|
|
75
|
+
lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
top: upper,
|
|
80
|
+
height: lower - upper
|
|
81
|
+
};
|
|
45
82
|
}
|
|
46
83
|
const onPrint = useEffectEvent(() => {
|
|
47
|
-
|
|
84
|
+
const result = calc(active);
|
|
85
|
+
if (result) update(result);
|
|
48
86
|
});
|
|
49
87
|
useEffect(() => {
|
|
50
88
|
if (!containerRef.current) return;
|
|
@@ -56,7 +94,8 @@ function TocThumb({ containerRef, ...props }) {
|
|
|
56
94
|
};
|
|
57
95
|
}, [containerRef]);
|
|
58
96
|
useOnChange(active, () => {
|
|
59
|
-
|
|
97
|
+
const result = calc(active);
|
|
98
|
+
if (result) update(result);
|
|
60
99
|
});
|
|
61
100
|
return /* @__PURE__ */ jsx("div", {
|
|
62
101
|
ref: thumbRef,
|
|
@@ -64,19 +103,5 @@ function TocThumb({ containerRef, ...props }) {
|
|
|
64
103
|
...props
|
|
65
104
|
});
|
|
66
105
|
}
|
|
67
|
-
function calc(container, active) {
|
|
68
|
-
if (active.length === 0 || container.clientHeight === 0) return [0, 0];
|
|
69
|
-
let upper = Number.MAX_VALUE, lower = 0;
|
|
70
|
-
for (const item of active) {
|
|
71
|
-
const element = container.querySelector(`a[href="#${item}"]`);
|
|
72
|
-
if (!element) continue;
|
|
73
|
-
const styles = getComputedStyle(element);
|
|
74
|
-
upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
|
|
75
|
-
lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
|
|
76
|
-
}
|
|
77
|
-
return [upper, lower - upper];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
106
|
//#endregion
|
|
81
|
-
export { TOCProvider, TOCScrollArea, TocThumb, useTOCItems };
|
|
82
|
-
//# sourceMappingURL=index.js.map
|
|
107
|
+
export { TOCProvider, TOCScrollArea, TocThumb, toc_exports, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/type-table.d.ts
|
|
@@ -26,14 +26,19 @@ interface TypeNode {
|
|
|
26
26
|
default?: ReactNode;
|
|
27
27
|
required?: boolean;
|
|
28
28
|
deprecated?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* a list of parameters info if the type is a function.
|
|
31
|
+
*/
|
|
29
32
|
parameters?: ParameterNode[];
|
|
30
33
|
returns?: ReactNode;
|
|
31
34
|
}
|
|
32
35
|
declare function TypeTable({
|
|
33
|
-
|
|
36
|
+
id,
|
|
37
|
+
type,
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
34
40
|
}: {
|
|
35
41
|
type: Record<string, TypeNode>;
|
|
36
|
-
}): react_jsx_runtime0.JSX.Element;
|
|
42
|
+
} & ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
|
|
37
43
|
//#endregion
|
|
38
|
-
export { ParameterNode, TypeNode, TypeTable };
|
|
39
|
-
//# sourceMappingURL=type-table.d.ts.map
|
|
44
|
+
export { ParameterNode, TypeNode, TypeTable };
|
|
@@ -1,48 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
3
2
|
import { cn } from "../utils/cn.js";
|
|
4
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
5
|
-
import { useState } from "react";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
6
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import Link from "@hanzo/docs-core/link";
|
|
8
7
|
import { ChevronDown } from "lucide-react";
|
|
9
8
|
import { cva } from "class-variance-authority";
|
|
10
|
-
|
|
11
9
|
//#region src/components/type-table.tsx
|
|
12
|
-
const keyVariants = cva("text-fd-primary", { variants: { deprecated: { true: "line-through text-fd-primary/50" } } });
|
|
13
10
|
const fieldVariants = cva("text-fd-muted-foreground not-prose pe-2");
|
|
14
|
-
function TypeTable({ type }) {
|
|
11
|
+
function TypeTable({ id, type, className, ...props }) {
|
|
15
12
|
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
-
|
|
13
|
+
id,
|
|
14
|
+
className: cn("@container flex flex-col p-1 bg-fd-card text-fd-card-foreground rounded-2xl border my-6 text-sm overflow-hidden", className),
|
|
15
|
+
...props,
|
|
17
16
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
18
17
|
className: "flex font-medium items-center px-3 py-1 not-prose text-fd-muted-foreground",
|
|
19
18
|
children: [/* @__PURE__ */ jsx("p", {
|
|
20
|
-
className: "w-
|
|
19
|
+
className: "w-1/4",
|
|
21
20
|
children: "Prop"
|
|
22
21
|
}), /* @__PURE__ */ jsx("p", {
|
|
23
22
|
className: "@max-xl:hidden",
|
|
24
23
|
children: "Type"
|
|
25
24
|
})]
|
|
26
25
|
}), Object.entries(type).map(([key, value]) => /* @__PURE__ */ jsx(Item, {
|
|
26
|
+
parentId: id,
|
|
27
27
|
name: key,
|
|
28
28
|
item: value
|
|
29
29
|
}, key))]
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function Item({ name, item: { parameters = [], description, required = false, deprecated, typeDescription, default: defaultValue, type, typeDescriptionLink, returns } }) {
|
|
32
|
+
function Item({ parentId, name, item: { parameters = [], description, required = false, deprecated, typeDescription, default: defaultValue, type, typeDescriptionLink, returns } }) {
|
|
33
33
|
const [open, setOpen] = useState(false);
|
|
34
|
+
const id = parentId ? `${parentId}-${name}` : void 0;
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const hash = window.location.hash;
|
|
37
|
+
if (!id || !hash) return;
|
|
38
|
+
if (`#${id}` === hash) setOpen(true);
|
|
39
|
+
}, [id]);
|
|
34
40
|
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
41
|
+
id,
|
|
35
42
|
open,
|
|
36
|
-
onOpenChange:
|
|
37
|
-
|
|
43
|
+
onOpenChange: (v) => {
|
|
44
|
+
if (v && id) window.history.replaceState(null, "", `#${id}`);
|
|
45
|
+
setOpen(v);
|
|
46
|
+
},
|
|
47
|
+
className: cn("rounded-xl border overflow-hidden scroll-m-20 transition-all", open ? "shadow-sm bg-fd-background not-last:mb-2" : "border-transparent"),
|
|
38
48
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
39
49
|
className: "relative flex flex-row items-center w-full group text-start px-3 py-2 not-prose hover:bg-fd-accent",
|
|
40
50
|
children: [
|
|
41
51
|
/* @__PURE__ */ jsxs("code", {
|
|
42
|
-
className: cn(
|
|
43
|
-
deprecated,
|
|
44
|
-
className: "min-w-fit w-[25%] font-medium pe-2"
|
|
45
|
-
})),
|
|
52
|
+
className: cn("text-fd-primary min-w-fit w-1/4 font-mono font-medium pe-2", deprecated && "line-through text-fd-primary/50"),
|
|
46
53
|
children: [name, !required && "?"]
|
|
47
54
|
}),
|
|
48
55
|
typeDescriptionLink ? /* @__PURE__ */ jsx(Link, {
|
|
@@ -103,7 +110,5 @@ function Item({ name, item: { parameters = [], description, required = false, de
|
|
|
103
110
|
}) })]
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
|
-
|
|
107
113
|
//#endregion
|
|
108
114
|
export { TypeTable };
|
|
109
|
-
//# sourceMappingURL=type-table.js.map
|
|
@@ -27,5 +27,4 @@ declare function AccordionContent({
|
|
|
27
27
|
...props
|
|
28
28
|
}: ComponentProps<typeof Accordion$1.Panel>): react_jsx_runtime0.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
|
-
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
31
|
-
//# sourceMappingURL=accordion.d.ts.map
|
|
30
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
3
2
|
import { cn } from "../../utils/cn.js";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { ChevronRight } from "lucide-react";
|
|
6
5
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
7
|
-
|
|
8
6
|
//#region src/components/ui/accordion.tsx
|
|
9
7
|
function Accordion({ className, ...props }) {
|
|
10
8
|
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
@@ -39,7 +37,5 @@ function AccordionContent({ className, children, ...props }) {
|
|
|
39
37
|
children
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
|
-
|
|
43
40
|
//#endregion
|
|
44
41
|
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
45
|
-
//# sourceMappingURL=accordion.js.map
|
|
@@ -5,9 +5,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
6
|
variant?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
|
|
7
7
|
color?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
|
|
8
|
-
size?: "
|
|
8
|
+
size?: "icon" | "sm" | "icon-sm" | "icon-xs" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
type ButtonProps = VariantProps<typeof buttonVariants>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { ButtonProps, buttonVariants };
|
|
13
|
-
//# sourceMappingURL=button.d.ts.map
|
|
12
|
+
export { ButtonProps, buttonVariants };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
2
|
//#region src/components/ui/button.tsx
|
|
4
3
|
const variants = {
|
|
5
4
|
primary: "bg-fd-primary text-fd-primary-foreground hover:bg-fd-primary/80",
|
|
@@ -17,7 +16,5 @@ const buttonVariants = cva("inline-flex items-center justify-center rounded-md p
|
|
|
17
16
|
"icon-xs": "p-1 [&_svg]:size-4"
|
|
18
17
|
}
|
|
19
18
|
} });
|
|
20
|
-
|
|
21
19
|
//#endregion
|
|
22
20
|
export { buttonVariants };
|
|
23
|
-
//# sourceMappingURL=button.js.map
|
|
@@ -16,5 +16,4 @@ type CollapsibleProps = Collapsible$1.Root.Props;
|
|
|
16
16
|
type CollapsibleContentProps = Collapsible$1.Panel.Props;
|
|
17
17
|
type CollapsibleTriggerProps = Collapsible$1.Trigger.Props;
|
|
18
18
|
//#endregion
|
|
19
|
-
export { Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps };
|
|
20
|
-
//# sourceMappingURL=collapsible.d.ts.map
|
|
19
|
+
export { Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps };
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
3
2
|
import { cn } from "../../utils/cn.js";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
6
|
-
|
|
7
5
|
//#region src/components/ui/collapsible.tsx
|
|
8
6
|
const Collapsible = Collapsible$1.Root;
|
|
9
7
|
const CollapsibleTrigger = Collapsible$1.Trigger;
|
|
10
8
|
function CollapsibleContent({ children, className, ...props }) {
|
|
11
9
|
return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
|
|
12
10
|
...props,
|
|
13
|
-
className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height] data-
|
|
11
|
+
className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height,opacity] data-starting-style:opacity-0 data-starting-style:h-0 data-ending-style:h-0 data-ending-style:opacity-0", typeof className === "function" ? className(s) : className),
|
|
14
12
|
children
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
//#endregion
|
|
19
16
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
20
|
-
//# sourceMappingURL=collapsible.js.map
|