@fumadocs/base-ui 16.17.8 → 16.17.10
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/flux.css +1 -1
- package/css/generated/glass.css +1 -1
- package/css/generated/shared.css +1 -1
- package/css/generated/spacious.css +1 -1
- package/css/lib/base.css +8 -7
- package/dist/.translations/index.d.ts +1 -3
- package/dist/.translations/keys.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/components/accordion.d.ts +1 -3
- package/dist/components/accordion.js +1 -2
- package/dist/components/banner.d.ts +0 -2
- package/dist/components/banner.js +1 -2
- package/dist/components/callout.d.ts +1 -3
- package/dist/components/callout.js +1 -2
- package/dist/components/card.d.ts +1 -3
- package/dist/components/card.js +1 -2
- package/dist/components/codeblock.d.ts +1 -3
- package/dist/components/codeblock.js +1 -2
- package/dist/components/codeblock.rsc.d.ts +1 -3
- package/dist/components/codeblock.rsc.js +1 -2
- package/dist/components/dialog/search-algolia.d.ts +1 -3
- package/dist/components/dialog/search-algolia.js +1 -2
- package/dist/components/dialog/search-default.d.ts +1 -3
- package/dist/components/dialog/search-default.js +1 -2
- package/dist/components/dialog/search-orama.d.ts +1 -3
- package/dist/components/dialog/search-orama.js +1 -2
- package/dist/components/dialog/search.d.ts +0 -2
- package/dist/components/dialog/search.js +1 -2
- package/dist/components/dynamic-codeblock.core.d.ts +0 -2
- package/dist/components/dynamic-codeblock.core.js +1 -2
- package/dist/components/dynamic-codeblock.d.ts +1 -3
- package/dist/components/dynamic-codeblock.js +1 -2
- package/dist/components/files.d.ts +1 -3
- package/dist/components/files.js +1 -2
- package/dist/components/github-info.d.ts +1 -3
- package/dist/components/github-info.js +1 -2
- package/dist/components/heading.d.ts +0 -2
- package/dist/components/heading.js +1 -2
- package/dist/components/image-zoom.d.ts +1 -3
- package/dist/components/image-zoom.js +1 -2
- package/dist/components/inline-toc.d.ts +1 -3
- package/dist/components/inline-toc.js +1 -2
- package/dist/components/sidebar/base.d.ts +0 -1
- package/dist/components/sidebar/base.js +5 -3
- package/dist/components/sidebar/link-item.d.ts +0 -2
- package/dist/components/sidebar/link-item.js +1 -2
- package/dist/components/sidebar/page-tree.d.ts +0 -2
- package/dist/components/sidebar/page-tree.js +1 -2
- package/dist/components/sidebar/tabs/dropdown.d.ts +1 -3
- package/dist/components/sidebar/tabs/dropdown.js +1 -2
- package/dist/components/sidebar/tabs/index.d.ts +1 -3
- package/dist/components/sidebar/tabs/index.js +1 -2
- package/dist/components/steps.d.ts +1 -3
- package/dist/components/steps.js +1 -2
- package/dist/components/tabs.d.ts +1 -3
- package/dist/components/tabs.js +1 -2
- package/dist/components/toc/block.d.ts +1 -3
- package/dist/components/toc/block.js +6 -13
- package/dist/components/toc/clerk.d.ts +2 -4
- package/dist/components/toc/clerk.js +85 -120
- package/dist/components/toc/default.d.ts +2 -4
- package/dist/components/toc/default.js +112 -149
- package/dist/components/toc/index.d.ts +1 -3
- package/dist/components/toc/index.js +1 -2
- package/dist/components/type-table.d.ts +1 -3
- package/dist/components/type-table.js +1 -2
- package/dist/components/ui/accordion.d.ts +1 -3
- package/dist/components/ui/accordion.js +1 -2
- package/dist/components/ui/button.d.ts +1 -3
- package/dist/components/ui/button.js +1 -2
- package/dist/components/ui/collapsible.d.ts +1 -3
- package/dist/components/ui/collapsible.js +1 -2
- package/dist/components/ui/popover.d.ts +1 -3
- package/dist/components/ui/popover.js +1 -2
- package/dist/components/ui/tabs.d.ts +1 -3
- package/dist/components/ui/tabs.js +1 -2
- package/dist/contexts/i18n.d.ts +0 -2
- package/dist/contexts/i18n.js +1 -2
- package/dist/contexts/search.d.ts +0 -2
- package/dist/contexts/search.js +1 -2
- package/dist/contexts/tree.d.ts +0 -2
- package/dist/contexts/tree.js +1 -2
- package/dist/i18n.d.ts +0 -2
- package/dist/i18n.js +1 -2
- package/dist/layouts/docs/client.d.ts +0 -2
- package/dist/layouts/docs/client.js +1 -2
- package/dist/layouts/docs/index.d.ts +0 -2
- package/dist/layouts/docs/index.js +1 -2
- package/dist/layouts/docs/page/index.d.ts +0 -2
- package/dist/layouts/docs/page/index.js +1 -2
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/docs/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/docs/page/slots/container.d.ts +1 -3
- package/dist/layouts/docs/page/slots/container.js +1 -2
- package/dist/layouts/docs/page/slots/footer.d.ts +0 -2
- package/dist/layouts/docs/page/slots/footer.js +1 -2
- package/dist/layouts/docs/page/slots/toc.d.ts +1 -3
- package/dist/layouts/docs/page/slots/toc.js +1 -2
- package/dist/layouts/docs/slots/container.d.ts +1 -3
- package/dist/layouts/docs/slots/container.js +1 -2
- package/dist/layouts/docs/slots/header.d.ts +1 -3
- package/dist/layouts/docs/slots/header.js +1 -2
- package/dist/layouts/docs/slots/sidebar.d.ts +1 -3
- package/dist/layouts/docs/slots/sidebar.js +5 -9
- package/dist/layouts/flux/index.d.ts +0 -2
- package/dist/layouts/flux/index.js +1 -2
- package/dist/layouts/flux/page/index.d.ts +0 -2
- package/dist/layouts/flux/page/index.js +1 -2
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/flux/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/flux/page/slots/container.d.ts +1 -3
- package/dist/layouts/flux/page/slots/container.js +1 -2
- package/dist/layouts/flux/page/slots/footer.d.ts +0 -2
- package/dist/layouts/flux/page/slots/footer.js +1 -2
- package/dist/layouts/flux/page/slots/toc.d.ts +1 -3
- package/dist/layouts/flux/page/slots/toc.js +1 -2
- package/dist/layouts/flux/slots/container.d.ts +1 -3
- package/dist/layouts/flux/slots/container.js +1 -2
- package/dist/layouts/flux/slots/sidebar.d.ts +1 -3
- package/dist/layouts/flux/slots/sidebar.js +1 -2
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +1 -3
- package/dist/layouts/flux/slots/tab-dropdown.js +1 -2
- package/dist/layouts/glass/index.d.ts +0 -2
- package/dist/layouts/glass/index.js +1 -2
- package/dist/layouts/glass/layout-tabs.js +1 -2
- package/dist/layouts/glass/page/index.d.ts +0 -2
- package/dist/layouts/glass/page/index.js +1 -2
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/glass/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/glass/page/slots/footer.d.ts +0 -2
- package/dist/layouts/glass/page/slots/footer.js +1 -2
- package/dist/layouts/glass/page/slots/toc.d.ts +1 -3
- package/dist/layouts/glass/page/slots/toc.js +1 -2
- package/dist/layouts/glass/slots/header.d.ts +1 -3
- package/dist/layouts/glass/slots/header.js +1 -2
- package/dist/layouts/glass/slots/sidebar.d.ts +1 -3
- package/dist/layouts/glass/slots/sidebar.js +7 -5
- package/dist/layouts/home/index.d.ts +0 -2
- package/dist/layouts/home/index.js +1 -2
- package/dist/layouts/home/navbar.d.ts +1 -3
- package/dist/layouts/home/navbar.js +1 -2
- package/dist/layouts/home/not-found.d.ts +1 -3
- package/dist/layouts/home/not-found.js +1 -2
- package/dist/layouts/home/slots/container.d.ts +1 -3
- package/dist/layouts/home/slots/container.js +1 -2
- package/dist/layouts/home/slots/header.d.ts +1 -3
- package/dist/layouts/home/slots/header.js +1 -2
- package/dist/layouts/notebook/client.d.ts +0 -2
- package/dist/layouts/notebook/client.js +1 -2
- package/dist/layouts/notebook/index.d.ts +0 -2
- package/dist/layouts/notebook/index.js +1 -2
- package/dist/layouts/notebook/page/index.d.ts +0 -2
- package/dist/layouts/notebook/page/index.js +1 -2
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/notebook/page/slots/container.d.ts +1 -3
- package/dist/layouts/notebook/page/slots/container.js +1 -2
- package/dist/layouts/notebook/page/slots/footer.d.ts +0 -2
- package/dist/layouts/notebook/page/slots/footer.js +1 -2
- package/dist/layouts/notebook/page/slots/toc.d.ts +1 -3
- package/dist/layouts/notebook/page/slots/toc.js +1 -2
- package/dist/layouts/notebook/slots/container.d.ts +1 -3
- package/dist/layouts/notebook/slots/container.js +1 -2
- package/dist/layouts/notebook/slots/header.d.ts +1 -3
- package/dist/layouts/notebook/slots/header.js +1 -2
- package/dist/layouts/notebook/slots/sidebar.d.ts +0 -2
- package/dist/layouts/notebook/slots/sidebar.js +5 -9
- package/dist/layouts/shared/client.d.ts +1 -3
- package/dist/layouts/shared/client.js +1 -2
- package/dist/layouts/shared/index.d.ts +0 -2
- package/dist/layouts/shared/index.js +1 -2
- package/dist/layouts/shared/page-actions.d.ts +1 -3
- package/dist/layouts/shared/page-actions.js +1 -2
- package/dist/layouts/shared/slots/language-select.d.ts +1 -3
- package/dist/layouts/shared/slots/language-select.js +1 -2
- package/dist/layouts/shared/slots/search-trigger.d.ts +1 -3
- package/dist/layouts/shared/slots/search-trigger.js +1 -2
- package/dist/layouts/shared/slots/theme-switch.d.ts +1 -3
- package/dist/layouts/shared/slots/theme-switch.js +1 -2
- package/dist/layouts/spacious/index.d.ts +0 -2
- package/dist/layouts/spacious/index.js +1 -2
- package/dist/layouts/spacious/page/index.d.ts +0 -2
- package/dist/layouts/spacious/page/index.js +1 -2
- package/dist/layouts/spacious/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/spacious/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/spacious/page/slots/footer.d.ts +0 -2
- package/dist/layouts/spacious/page/slots/footer.js +1 -2
- package/dist/layouts/spacious/page/slots/toc.d.ts +0 -2
- package/dist/layouts/spacious/page/slots/toc.js +1 -2
- package/dist/layouts/spacious/slots/actions.d.ts +1 -3
- package/dist/layouts/spacious/slots/actions.js +1 -2
- package/dist/layouts/spacious/slots/header.d.ts +1 -3
- package/dist/layouts/spacious/slots/header.js +1 -2
- package/dist/layouts/spacious/slots/sidebar.d.ts +1 -3
- package/dist/layouts/spacious/slots/sidebar.js +21 -25
- package/dist/mdx.d.ts +0 -2
- package/dist/mdx.js +1 -2
- package/dist/mdx.server.d.ts +0 -2
- package/dist/mdx.server.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/controlled.d.ts +0 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/controlled.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +1 -3
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/uncontrolled.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +1 -2
- package/dist/og/takumi.d.ts +1 -3
- package/dist/og/takumi.js +1 -2
- package/dist/og.d.ts +0 -2
- package/dist/og.js +1 -2
- package/dist/page.d.ts +0 -2
- package/dist/page.js +1 -2
- package/dist/provider/astro.d.ts +1 -3
- package/dist/provider/astro.js +17 -2
- package/dist/provider/base.d.ts +0 -2
- package/dist/provider/base.js +1 -2
- package/dist/provider/next.d.ts +1 -3
- package/dist/provider/next.js +1 -2
- package/dist/provider/react-router.d.ts +1 -3
- package/dist/provider/react-router.js +1 -2
- package/dist/provider/tanstack.d.ts +1 -3
- package/dist/provider/tanstack.js +1 -2
- package/dist/provider/waku.d.ts +1 -3
- package/dist/provider/waku.js +1 -2
- package/dist/style.css +21 -24
- package/dist/utils/hotkey.js +1 -2
- package/dist/utils/merge-refs.js +1 -2
- package/dist/utils/urls.js +1 -2
- package/dist/utils/use-copy-button.d.ts +1 -3
- package/dist/utils/use-copy-button.js +1 -2
- package/dist/utils/use-footer-items.d.ts +1 -3
- package/dist/utils/use-footer-items.js +1 -2
- package/dist/utils/use-is-scroll-top.d.ts +1 -3
- package/dist/utils/use-is-scroll-top.js +1 -2
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import { cn } from "../utils/cn.js";
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { GitFork, Star } from "lucide-react";
|
|
4
4
|
import { use } from "react";
|
|
5
|
-
|
|
5
|
+
// src/components/github-info.tsx
|
|
6
6
|
async function fetchRepositoryInfo({ owner, repo, token, baseUrl = "https://api.github.com", fetchOptions = { next: { revalidate: 60 } } }) {
|
|
7
7
|
const endpoint = `${baseUrl}/repos/${owner}/${repo}`;
|
|
8
8
|
const headers = new Headers(fetchOptions.headers);
|
|
@@ -71,5 +71,4 @@ function GithubInfo({ repo, owner, token, baseUrl, fetchOptions, locale, ...prop
|
|
|
71
71
|
})]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
export { GithubInfo, fetchRepositoryInfo };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
//#region src/components/heading.d.ts
|
|
3
2
|
type Types = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
3
|
type HeadingProps<T extends Types> = Omit<ComponentPropsWithoutRef<T>, 'as'> & {
|
|
5
4
|
as?: T;
|
|
6
5
|
};
|
|
7
6
|
export declare function Heading<T extends Types = 'h1'>({ as, ...props }: HeadingProps<T>): import("react").JSX.Element;
|
|
8
|
-
//#endregion
|
|
9
7
|
export {};
|
|
@@ -5,7 +5,7 @@ import { useCopyButton } from "../utils/use-copy-button.js";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CopyCheckIcon, LinkIcon } from "lucide-react";
|
|
7
7
|
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
-
|
|
8
|
+
// src/components/heading.tsx
|
|
9
9
|
function Heading({ as, ...props }) {
|
|
10
10
|
const As = as ?? "h1";
|
|
11
11
|
const t = useTranslations({ note: "heading anchor" });
|
|
@@ -37,5 +37,4 @@ function Heading({ as, ...props }) {
|
|
|
37
37
|
})]
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
//#endregion
|
|
41
40
|
export { Heading };
|
|
@@ -2,7 +2,6 @@ import { UncontrolledProps } from "../node_modules/.pnpm/react-medium-image-zoom
|
|
|
2
2
|
import "../node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/index.js";
|
|
3
3
|
import { ImageProps } from "fumadocs-core/framework";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
|
-
//#region src/components/image-zoom.d.ts
|
|
6
5
|
export type ImageZoomProps = ImageProps & {
|
|
7
6
|
/**
|
|
8
7
|
* Image props when zoom in
|
|
@@ -25,5 +24,4 @@ export declare function ImageZoom({ zoomInProps, children, rmiz, caption, ...pro
|
|
|
25
24
|
*/
|
|
26
25
|
export declare function Lightbox({ children }: {
|
|
27
26
|
children: ReactNode;
|
|
28
|
-
}): import("react").JSX.Element;
|
|
29
|
-
//#endregion
|
|
27
|
+
}): import("react").JSX.Element;
|
|
@@ -9,7 +9,7 @@ import { ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
|
9
9
|
import { createContext, use, useRef, useState } from "react";
|
|
10
10
|
import { useTranslations } from "@fuma-translate/react";
|
|
11
11
|
import { createPortal, flushSync } from "react-dom";
|
|
12
|
-
|
|
12
|
+
// src/components/image-zoom.tsx
|
|
13
13
|
const LightboxContext = createContext(null);
|
|
14
14
|
function getImageSrc(src) {
|
|
15
15
|
if (typeof src === "string") return src;
|
|
@@ -253,5 +253,4 @@ function transition(from, update) {
|
|
|
253
253
|
if (to) to.style.viewTransitionName = "";
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
//#endregion
|
|
257
256
|
export { ImageZoom, Lightbox };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Collapsible } from "./ui/collapsible.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
3
|
import { TOCItemType } from "fumadocs-core/toc";
|
|
4
|
-
//#region src/components/inline-toc.d.ts
|
|
5
4
|
export interface InlineTocProps extends ComponentProps<typeof Collapsible> {
|
|
6
5
|
items: TOCItemType[];
|
|
7
6
|
}
|
|
8
|
-
export declare function InlineTOC({ items, className, ...props }: InlineTocProps): import("react").JSX.Element;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function InlineTOC({ items, className, ...props }: InlineTocProps): import("react").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collap
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { ChevronDown } from "lucide-react";
|
|
6
6
|
import { useTranslations } from "@fuma-translate/react";
|
|
7
|
-
|
|
7
|
+
// src/components/inline-toc.tsx
|
|
8
8
|
function InlineTOC({ items, className, ...props }) {
|
|
9
9
|
const t = useTranslations({ note: "inline table of contents" });
|
|
10
10
|
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
@@ -24,5 +24,4 @@ function InlineTOC({ items, className, ...props }) {
|
|
|
24
24
|
}) })]
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { InlineTOC };
|
|
@@ -82,5 +82,4 @@ export declare function SidebarCollapseTrigger(props: ComponentProps<'button'>):
|
|
|
82
82
|
* scroll to the element if `active` is true
|
|
83
83
|
*/
|
|
84
84
|
export declare function useAutoScroll(active: boolean, ref: RefObject<HTMLElement | null>): void;
|
|
85
|
-
//#endregion
|
|
86
85
|
export { base_d_exports };
|
|
@@ -14,7 +14,7 @@ import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
|
14
14
|
import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
15
15
|
import { useMediaQuery } from "fumadocs-core/utils/use-media-query";
|
|
16
16
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
17
|
-
|
|
17
|
+
// src/components/sidebar/base.tsx
|
|
18
18
|
var base_exports = /* @__PURE__ */ __exportAll({
|
|
19
19
|
SidebarCollapseTrigger: () => SidebarCollapseTrigger,
|
|
20
20
|
SidebarContent: () => SidebarContent,
|
|
@@ -152,7 +152,10 @@ function SidebarViewport({ className, ...props }) {
|
|
|
152
152
|
children: [
|
|
153
153
|
/* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
154
154
|
className: "size-full rounded-[inherit] p-4 overscroll-contain mask-[linear-gradient(to_bottom,transparent,white_12px,white_calc(100%-12px),transparent)]",
|
|
155
|
-
children:
|
|
155
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Content, {
|
|
156
|
+
className: "flex flex-col gap-0.5",
|
|
157
|
+
children: props.children
|
|
158
|
+
})
|
|
156
159
|
}),
|
|
157
160
|
/* @__PURE__ */ jsx(ScrollArea.Corner, {}),
|
|
158
161
|
/* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
|
|
@@ -300,5 +303,4 @@ function useAutoScroll(active, ref) {
|
|
|
300
303
|
ref
|
|
301
304
|
]);
|
|
302
305
|
}
|
|
303
|
-
//#endregion
|
|
304
306
|
export { SidebarCollapseTrigger, SidebarContent, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, SidebarProvider, SidebarSeparator, SidebarTrigger, SidebarViewport, base_exports, useAutoScroll, useFolder, useFolderDepth, useSidebar };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { base_d_exports } from "./base.js";
|
|
2
2
|
import { LinkItemType } from "../../layouts/shared/index.js";
|
|
3
3
|
import { HTMLAttributes } from "react";
|
|
4
|
-
//#region src/components/sidebar/link-item.d.ts
|
|
5
4
|
type InternalComponents = Pick<typeof base_d_exports, 'SidebarFolder' | 'SidebarFolderLink' | 'SidebarFolderContent' | 'SidebarFolderTrigger' | 'SidebarItem'>;
|
|
6
5
|
export declare function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem }: InternalComponents): ({ item, ...props }: HTMLAttributes<HTMLElement> & {
|
|
7
6
|
item: Exclude<LinkItemType, {
|
|
8
7
|
type: 'icon';
|
|
9
8
|
}>;
|
|
10
9
|
}) => import("react").JSX.Element;
|
|
11
|
-
//#endregion
|
|
12
10
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { isLinkItemActive } from "../../layouts/shared/index.js";
|
|
3
3
|
import { usePathname } from "fumadocs-core/framework";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/sidebar/link-item.tsx
|
|
6
6
|
function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem }) {
|
|
7
7
|
/**
|
|
8
8
|
* Render sidebar items from page tree
|
|
@@ -33,5 +33,4 @@ function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFo
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { createLinkItemRenderer };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { base_d_exports } from "./base.js";
|
|
2
2
|
import { FC, ReactNode } from "react";
|
|
3
3
|
import * as PageTree from "fumadocs-core/page-tree";
|
|
4
|
-
//#region src/components/sidebar/page-tree.d.ts
|
|
5
4
|
export interface SidebarPageTreeComponents {
|
|
6
5
|
Item: FC<{
|
|
7
6
|
item: PageTree.Item;
|
|
@@ -16,5 +15,4 @@ export interface SidebarPageTreeComponents {
|
|
|
16
15
|
}
|
|
17
16
|
type InternalComponents = Pick<typeof base_d_exports, 'SidebarSeparator' | 'SidebarFolder' | 'SidebarFolderLink' | 'SidebarFolderContent' | 'SidebarFolderTrigger' | 'SidebarItem'>;
|
|
18
17
|
export declare function createPageTreeRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarSeparator, SidebarItem }: InternalComponents): (components: Partial<SidebarPageTreeComponents>) => import("react").JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
18
|
export {};
|
|
@@ -3,7 +3,7 @@ import { isActive } from "../../utils/urls.js";
|
|
|
3
3
|
import { usePathname } from "fumadocs-core/framework";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Fragment as Fragment$1, createContext, use, useMemo } from "react";
|
|
6
|
-
|
|
6
|
+
// src/components/sidebar/page-tree.tsx
|
|
7
7
|
const RendererContext = createContext(null);
|
|
8
8
|
function createPageTreeRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarSeparator, SidebarItem }) {
|
|
9
9
|
function renderList(nodes) {
|
|
@@ -65,5 +65,4 @@ function createPageTreeRenderer({ SidebarFolder, SidebarFolderContent, SidebarFo
|
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
//#endregion
|
|
69
68
|
export { createPageTreeRenderer };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LayoutTab } from "../../../layouts/shared/index.js";
|
|
2
2
|
import { ComponentProps, ReactNode } from "react";
|
|
3
|
-
//#region src/components/sidebar/tabs/dropdown.d.ts
|
|
4
3
|
export type SidebarTabWithProps = LayoutTab;
|
|
5
4
|
/**
|
|
6
5
|
* Renders the given tabs as a dropdown per tabs group, one for each root folder on the
|
|
@@ -9,5 +8,4 @@ export type SidebarTabWithProps = LayoutTab;
|
|
|
9
8
|
export declare function SidebarTabsDropdown({ options, placeholder, ...props }: {
|
|
10
9
|
placeholder?: ReactNode;
|
|
11
10
|
options: LayoutTab[];
|
|
12
|
-
} & ComponentProps<'button'>): import("react").JSX.Element[];
|
|
13
|
-
//#endregion
|
|
11
|
+
} & ComponentProps<'button'>): import("react").JSX.Element[];
|
|
@@ -9,7 +9,7 @@ import { usePathname } from "fumadocs-core/framework";
|
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { Check, ChevronsUpDown } from "lucide-react";
|
|
11
11
|
import { useMemo, useState } from "react";
|
|
12
|
-
|
|
12
|
+
// src/components/sidebar/tabs/dropdown.tsx
|
|
13
13
|
/**
|
|
14
14
|
* Renders the given tabs as a dropdown per tabs group, one for each root folder on the
|
|
15
15
|
* current page's path, letting users switch between root folders of the same type.
|
|
@@ -83,5 +83,4 @@ function Dropdown({ options, placeholder, ...props }) {
|
|
|
83
83
|
})]
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
//#endregion
|
|
87
86
|
export { SidebarTabsDropdown };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { LayoutTab } from "../../../layouts/shared/index.js";
|
|
2
2
|
import * as PageTree from "fumadocs-core/page-tree";
|
|
3
|
-
//#region src/components/sidebar/tabs/index.d.ts
|
|
4
3
|
export type SidebarTab = LayoutTab;
|
|
5
4
|
export interface GetSidebarTabsOptions {
|
|
6
5
|
transform?: (option: SidebarTab, node: PageTree.Folder) => SidebarTab | null;
|
|
7
6
|
}
|
|
8
|
-
export declare function getSidebarTabs(tree: PageTree.Root, { transform }?: GetSidebarTabsOptions): SidebarTab[];
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function getSidebarTabs(tree: PageTree.Root, { transform }?: GetSidebarTabsOptions): SidebarTab[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
// src/components/sidebar/tabs/index.tsx
|
|
3
3
|
const defaultTransform = (option, node) => {
|
|
4
4
|
if (!node.icon) return option;
|
|
5
5
|
return {
|
|
@@ -42,5 +42,4 @@ function getFolderUrls(folder, output = /* @__PURE__ */ new Set()) {
|
|
|
42
42
|
}
|
|
43
43
|
return output;
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { getSidebarTabs };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
//#region src/components/steps.d.ts
|
|
3
2
|
export declare function Steps({ children }: {
|
|
4
3
|
children: ReactNode;
|
|
5
4
|
}): import("react").JSX.Element;
|
|
6
5
|
export declare function Step({ children }: {
|
|
7
6
|
children: ReactNode;
|
|
8
|
-
}): import("react").JSX.Element;
|
|
9
|
-
//#endregion
|
|
7
|
+
}): import("react").JSX.Element;
|
package/dist/components/steps.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
// src/components/steps.tsx
|
|
3
3
|
function Steps({ children }) {
|
|
4
4
|
return /* @__PURE__ */ jsx("div", {
|
|
5
5
|
className: "fd-steps",
|
|
@@ -12,5 +12,4 @@ function Step({ children }) {
|
|
|
12
12
|
children
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { Step, Steps };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import { ComponentProps, ReactNode } from "react";
|
|
4
|
-
//#region src/components/tabs.d.ts
|
|
5
4
|
export interface TabsProps extends Omit<ComponentProps<typeof Tabs$1>, 'value' | 'onValueChange'> {
|
|
6
5
|
/**
|
|
7
6
|
* Use simple mode instead of advanced usage as documented in https://radix-ui.com/primitives/docs/components/tabs.
|
|
@@ -28,5 +27,4 @@ export interface TabProps extends Omit<ComponentProps<typeof TabsContent$1>, 'va
|
|
|
28
27
|
value?: string;
|
|
29
28
|
}
|
|
30
29
|
export declare function Tab({ value, ...props }: TabProps): React$1.JSX.Element;
|
|
31
|
-
export declare function TabsContent({ value, className, ...props }: ComponentProps<typeof TabsContent$1>): React$1.JSX.Element;
|
|
32
|
-
//#endregion
|
|
30
|
+
export declare function TabsContent({ value, className, ...props }: ComponentProps<typeof TabsContent$1>): React$1.JSX.Element;
|
package/dist/components/tabs.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cn } from "../utils/cn.js";
|
|
|
3
3
|
import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { createContext, useContext, useEffect, useId, useMemo } from "react";
|
|
6
|
-
|
|
6
|
+
// src/components/tabs.tsx
|
|
7
7
|
const TabsContext = createContext(null);
|
|
8
8
|
function useTabContext() {
|
|
9
9
|
const ctx = useContext(TabsContext);
|
|
@@ -86,5 +86,4 @@ function useCollectionIndex() {
|
|
|
86
86
|
function escapeValue(v) {
|
|
87
87
|
return v.toLowerCase().replace(/\s/, "-");
|
|
88
88
|
}
|
|
89
|
-
//#endregion
|
|
90
89
|
export { Tab, Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { TOCEmpty } from "./default.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
3
|
import * as Primitive from "fumadocs-core/toc";
|
|
4
|
-
//#region src/components/toc/block.d.ts
|
|
5
4
|
export type TOCItemsProps = ComponentProps<'div'>;
|
|
6
|
-
export declare function TOCItems({
|
|
5
|
+
export declare function TOCItems({ className, children, ...props }: TOCItemsProps): import("react").JSX.Element;
|
|
7
6
|
export declare function TOCItem({ item, ...props }: Primitive.TOCItemProps & {
|
|
8
7
|
item: Primitive.TOCItemType;
|
|
9
8
|
}): import("react").JSX.Element;
|
|
10
|
-
//#endregion
|
|
11
9
|
export { TOCEmpty };
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
4
|
import { TOCEmpty } from "./default.js";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
6
|
+
import { useCallback } from "react";
|
|
8
7
|
import * as Primitive from "fumadocs-core/toc";
|
|
9
|
-
|
|
8
|
+
// src/components/toc/block.tsx
|
|
10
9
|
var block_exports = /* @__PURE__ */ __exportAll({
|
|
11
10
|
TOCEmpty: () => TOCEmpty,
|
|
12
11
|
TOCItem: () => TOCItem,
|
|
13
12
|
TOCItems: () => TOCItems
|
|
14
13
|
});
|
|
15
|
-
function TOCItems({
|
|
16
|
-
const containerRef = useRef(null);
|
|
17
|
-
const blockRef = useRef(null);
|
|
14
|
+
function TOCItems({ className, children, ...props }) {
|
|
18
15
|
const tocInfo = Primitive.useTOC();
|
|
19
|
-
|
|
20
|
-
const container =
|
|
21
|
-
const block = blockRef.current;
|
|
22
|
-
if (!container || !block) return;
|
|
16
|
+
const ref = useCallback((block) => {
|
|
17
|
+
const container = block.parentElement;
|
|
23
18
|
const positions = /* @__PURE__ */ new Map();
|
|
24
19
|
let height = 0;
|
|
25
20
|
const update = (items) => {
|
|
@@ -53,11 +48,10 @@ function TOCItems({ ref, className, children, ...props }) {
|
|
|
53
48
|
};
|
|
54
49
|
}, [tocInfo]);
|
|
55
50
|
return /* @__PURE__ */ jsxs("div", {
|
|
56
|
-
ref: mergeRefs(containerRef, ref),
|
|
57
51
|
className: cn("relative flex flex-col", className),
|
|
58
52
|
...props,
|
|
59
53
|
children: [/* @__PURE__ */ jsx("div", {
|
|
60
|
-
ref
|
|
54
|
+
ref,
|
|
61
55
|
className: "absolute inset-0 bg-linear-to-r from-fd-primary/10 [clip-path:inset(0_0_100%)] data-ready:transition-[clip-path] duration-300 ease-out"
|
|
62
56
|
}), children]
|
|
63
57
|
});
|
|
@@ -82,5 +76,4 @@ function TOCItem({ item, ...props }) {
|
|
|
82
76
|
}), item.title]
|
|
83
77
|
});
|
|
84
78
|
}
|
|
85
|
-
//#endregion
|
|
86
79
|
export { TOCEmpty, TOCItem, TOCItems, block_exports };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import * as Primitive from "fumadocs-core/toc";
|
|
3
|
-
//#region src/components/toc/clerk.d.ts
|
|
4
3
|
export type TOCItemsProps = ComponentProps<'div'>;
|
|
5
|
-
export declare function TOCItems({
|
|
4
|
+
export declare function TOCItems({ className, children, ...props }: TOCItemsProps): import("react").JSX.Element;
|
|
6
5
|
export declare function TOCEmpty(): import("react").JSX.Element;
|
|
7
6
|
export declare function TOCItem({ item, ...props }: Primitive.TOCItemProps & {
|
|
8
7
|
item: Primitive.TOCItemType;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
10
|
-
//#endregion
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -1,106 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
4
|
import { useTOCItems } from "./index.js";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useCallback,
|
|
6
|
+
import { useCallback, useMemo } from "react";
|
|
8
7
|
import { useTranslations } from "@fuma-translate/react";
|
|
9
8
|
import * as Primitive from "fumadocs-core/toc";
|
|
10
|
-
|
|
9
|
+
// src/components/toc/clerk.tsx
|
|
11
10
|
var clerk_exports = /* @__PURE__ */ __exportAll({
|
|
12
11
|
TOCEmpty: () => TOCEmpty,
|
|
13
12
|
TOCItem: () => TOCItem,
|
|
14
13
|
TOCItems: () => TOCItems
|
|
15
14
|
});
|
|
16
|
-
function TOCItems({
|
|
17
|
-
const containerRef = useRef(null);
|
|
15
|
+
function TOCItems({ className, children, ...props }) {
|
|
18
16
|
const items = useTOCItems();
|
|
19
|
-
const [svg, setSvg] = useState(null);
|
|
20
|
-
const onPrint = useCallback(() => {
|
|
21
|
-
const container = containerRef.current;
|
|
22
|
-
if (!container || container.clientHeight === 0) return;
|
|
23
|
-
if (items.length === 0) {
|
|
24
|
-
setSvg(null);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let w = 0;
|
|
28
|
-
let h = 0;
|
|
29
|
-
let d = "";
|
|
30
|
-
const positions = [];
|
|
31
|
-
const output = [];
|
|
32
|
-
for (let i = 0; i < items.length; i++) {
|
|
33
|
-
const item = items[i];
|
|
34
|
-
const element = container.querySelector(`a[href="${item.url}"]`);
|
|
35
|
-
if (!element) continue;
|
|
36
|
-
const styles = getComputedStyle(element);
|
|
37
|
-
const x = getLineOffset(item.depth) + .5;
|
|
38
|
-
const top = element.offsetTop + parseFloat(styles.paddingTop);
|
|
39
|
-
const bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
|
|
40
|
-
w = Math.max(x + 8, w);
|
|
41
|
-
h = Math.max(h, bottom);
|
|
42
|
-
if (i === 0) d += ` M${x} ${top} L${x} ${bottom}`;
|
|
43
|
-
else {
|
|
44
|
-
const [, upperBottom, upperX] = i > 0 ? positions[i - 1] : [
|
|
45
|
-
0,
|
|
46
|
-
0,
|
|
47
|
-
0
|
|
48
|
-
];
|
|
49
|
-
d += ` L ${upperX} ${upperBottom} ${x} ${top} L${x} ${bottom}`;
|
|
50
|
-
}
|
|
51
|
-
if (item._step !== void 0) output.push(/* @__PURE__ */ jsxs("g", {
|
|
52
|
-
transform: `translate(${x}, ${(top + bottom) / 2})`,
|
|
53
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
54
|
-
cx: "0",
|
|
55
|
-
cy: "0",
|
|
56
|
-
r: "8",
|
|
57
|
-
className: "fill-fd-primary"
|
|
58
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
59
|
-
cx: "0",
|
|
60
|
-
cy: "0",
|
|
61
|
-
textAnchor: "middle",
|
|
62
|
-
alignmentBaseline: "central",
|
|
63
|
-
dominantBaseline: "middle",
|
|
64
|
-
className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
|
|
65
|
-
children: item._step
|
|
66
|
-
})]
|
|
67
|
-
}, i));
|
|
68
|
-
positions.push([
|
|
69
|
-
top,
|
|
70
|
-
bottom,
|
|
71
|
-
x
|
|
72
|
-
]);
|
|
73
|
-
}
|
|
74
|
-
output.unshift(/* @__PURE__ */ jsx("path", {
|
|
75
|
-
d,
|
|
76
|
-
className: "stroke-fd-primary",
|
|
77
|
-
strokeWidth: "1",
|
|
78
|
-
fill: "none"
|
|
79
|
-
}, "path"));
|
|
80
|
-
setSvg({
|
|
81
|
-
content: output,
|
|
82
|
-
width: w,
|
|
83
|
-
height: h,
|
|
84
|
-
d,
|
|
85
|
-
itemLineLengths: [],
|
|
86
|
-
positions
|
|
87
|
-
});
|
|
88
|
-
}, [items]);
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
const container = containerRef.current;
|
|
91
|
-
if (!container) return;
|
|
92
|
-
const observer = new ResizeObserver(onPrint);
|
|
93
|
-
observer.observe(container);
|
|
94
|
-
onPrint();
|
|
95
|
-
return () => {
|
|
96
|
-
observer.unobserve(container);
|
|
97
|
-
};
|
|
98
|
-
}, [onPrint]);
|
|
99
17
|
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
-
ref: mergeRefs(containerRef, ref),
|
|
101
18
|
className: cn("relative flex flex-col", className),
|
|
102
19
|
...props,
|
|
103
|
-
children: [
|
|
20
|
+
children: [items.length > 0 && /* @__PURE__ */ jsx(ThumbTrack, { items }), children]
|
|
104
21
|
});
|
|
105
22
|
}
|
|
106
23
|
function TOCEmpty() {
|
|
@@ -110,41 +27,90 @@ function TOCEmpty() {
|
|
|
110
27
|
children: t("No Headings")
|
|
111
28
|
});
|
|
112
29
|
}
|
|
113
|
-
function ThumbTrack({
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
30
|
+
function ThumbTrack({ items }) {
|
|
31
|
+
const toc = Primitive.useTOC();
|
|
32
|
+
const ref = useCallback((track) => {
|
|
33
|
+
const container = track.parentElement;
|
|
34
|
+
const svg = track.querySelector("svg");
|
|
35
|
+
const path = svg.querySelector("path");
|
|
36
|
+
const steps = svg.getElementsByTagName("g");
|
|
37
|
+
const positions = /* @__PURE__ */ new Map();
|
|
38
|
+
const update = (infos) => {
|
|
39
|
+
let top = -1;
|
|
40
|
+
let bottom = -1;
|
|
41
|
+
for (const info of infos) {
|
|
42
|
+
const position = info.active ? positions.get(info.original.url) : void 0;
|
|
43
|
+
if (!position) continue;
|
|
44
|
+
if (top === -1) top = position.top;
|
|
45
|
+
bottom = position.bottom;
|
|
46
|
+
}
|
|
47
|
+
if (top !== -1) svg.style.clipPath = `polygon(0 ${top}px, 100% ${top}px, 100% ${bottom}px, 0 ${bottom}px)`;
|
|
48
|
+
};
|
|
49
|
+
const observer = new ResizeObserver(() => {
|
|
50
|
+
if (container.clientHeight === 0) return;
|
|
51
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const anchor of container.getElementsByTagName("a")) anchors.set(anchor.getAttribute("href"), anchor);
|
|
53
|
+
let d = "";
|
|
54
|
+
let width = 0;
|
|
55
|
+
let height = 0;
|
|
56
|
+
let last;
|
|
57
|
+
positions.clear();
|
|
58
|
+
for (const item of items) {
|
|
59
|
+
const anchor = anchors.get(item.url);
|
|
60
|
+
if (!anchor) continue;
|
|
61
|
+
const styles = getComputedStyle(anchor);
|
|
62
|
+
const x = getLineOffset(item.depth) + .5;
|
|
63
|
+
const top = anchor.offsetTop + parseFloat(styles.paddingTop);
|
|
64
|
+
const bottom = anchor.offsetTop + anchor.clientHeight - parseFloat(styles.paddingBottom);
|
|
65
|
+
d += last ? ` L ${last.x} ${last.bottom} ${x} ${top}` : `M${x} ${top}`;
|
|
66
|
+
d += ` L${x} ${bottom}`;
|
|
67
|
+
last = {
|
|
68
|
+
x,
|
|
69
|
+
top,
|
|
70
|
+
bottom
|
|
71
|
+
};
|
|
72
|
+
positions.set(item.url, last);
|
|
73
|
+
width = Math.max(width, x + 8);
|
|
74
|
+
height = Math.max(height, bottom);
|
|
75
|
+
}
|
|
76
|
+
let step = 0;
|
|
77
|
+
for (const item of items) {
|
|
78
|
+
if (item._step === void 0) continue;
|
|
79
|
+
const position = positions.get(item.url);
|
|
80
|
+
const g = steps[step++];
|
|
81
|
+
if (position) g.setAttribute("transform", `translate(${position.x}, ${(position.top + position.bottom) / 2})`);
|
|
82
|
+
}
|
|
83
|
+
path.setAttribute("d", d);
|
|
84
|
+
track.style.width = `${width}px`;
|
|
85
|
+
track.style.height = `${height}px`;
|
|
86
|
+
update(toc.get());
|
|
87
|
+
});
|
|
88
|
+
observer.observe(container);
|
|
89
|
+
toc.listen(update);
|
|
90
|
+
return () => {
|
|
91
|
+
observer.disconnect();
|
|
92
|
+
toc.unlisten(update);
|
|
93
|
+
};
|
|
94
|
+
}, [items, toc]);
|
|
130
95
|
return /* @__PURE__ */ jsx("div", {
|
|
131
96
|
ref,
|
|
132
97
|
className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
98
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
99
|
+
className: "absolute size-full [clip-path:polygon(0_0,100%_0,100%_0,0_0)] transition-[clip-path]",
|
|
100
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
101
|
+
className: "stroke-fd-primary",
|
|
102
|
+
strokeWidth: "1",
|
|
103
|
+
fill: "none"
|
|
104
|
+
}), items.map((item) => item._step !== void 0 && /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("circle", {
|
|
105
|
+
r: "8",
|
|
106
|
+
className: "fill-fd-primary"
|
|
107
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
108
|
+
textAnchor: "middle",
|
|
109
|
+
alignmentBaseline: "central",
|
|
110
|
+
dominantBaseline: "middle",
|
|
111
|
+
className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
|
|
112
|
+
children: item._step
|
|
113
|
+
})] }, item.url))]
|
|
148
114
|
})
|
|
149
115
|
});
|
|
150
116
|
}
|
|
@@ -223,5 +189,4 @@ function TOCItem({ item, ...props }) {
|
|
|
223
189
|
children: [svg, item.title]
|
|
224
190
|
});
|
|
225
191
|
}
|
|
226
|
-
//#endregion
|
|
227
192
|
export { TOCEmpty, TOCItem, TOCItems, clerk_exports };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import * as Primitive from "fumadocs-core/toc";
|
|
3
|
-
//#region src/components/toc/default.d.ts
|
|
4
3
|
export interface TOCItemsProps extends ComponentProps<'div'> {
|
|
5
4
|
thumbBox?: boolean;
|
|
6
5
|
}
|
|
7
|
-
export declare function TOCItems({
|
|
6
|
+
export declare function TOCItems({ className, thumbBox, children, ...props }: TOCItemsProps): import("react").JSX.Element;
|
|
8
7
|
export declare function TOCEmpty(): import("react").JSX.Element;
|
|
9
8
|
export declare function TOCItem({ item, ...props }: Primitive.TOCItemProps & {
|
|
10
9
|
item: Primitive.TOCItemType;
|
|
11
|
-
}): import("react").JSX.Element;
|
|
12
|
-
//#endregion
|
|
10
|
+
}): import("react").JSX.Element;
|