fumadocs-ui 16.2.4 → 16.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/css/black.css +1 -39
- package/css/catppuccin.css +1 -49
- package/css/dusk.css +1 -47
- package/css/neutral.css +1 -7
- package/css/ocean.css +1 -48
- package/css/preset.css +1 -215
- package/css/purple.css +1 -39
- package/css/shadcn.css +1 -35
- package/css/solar.css +1 -75
- package/css/vitepress.css +1 -77
- package/dist/components/accordion.d.ts +5 -6
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +12 -14
- package/dist/components/banner.js +2 -2
- package/dist/components/callout.d.ts.map +1 -1
- package/dist/components/callout.js +2 -2
- package/dist/components/card.js +1 -1
- package/dist/components/codeblock.d.ts +1 -1
- package/dist/components/codeblock.d.ts.map +1 -1
- package/dist/components/codeblock.js +5 -5
- package/dist/components/dialog/search.js +2 -2
- package/dist/components/dynamic-codeblock.js +1 -1
- package/dist/components/files.js +2 -2
- package/dist/components/github-info.js +2 -2
- package/dist/components/heading.js +2 -2
- package/dist/components/inline-toc.js +2 -2
- package/dist/components/sidebar/base.d.ts +2 -2
- package/dist/components/sidebar/base.d.ts.map +1 -1
- package/dist/components/sidebar/base.js +4 -4
- package/dist/components/sidebar/link-item.d.ts +1 -1
- package/dist/components/sidebar/link-item.d.ts.map +1 -1
- package/dist/components/sidebar/tabs/dropdown.d.ts +1 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +1 -1
- package/dist/components/sidebar/tabs/dropdown.js +8 -3
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/toc/clerk.d.ts +1 -2
- package/dist/components/toc/clerk.d.ts.map +1 -1
- package/dist/components/toc/clerk.js +1 -76
- package/dist/components/toc/default.d.ts +1 -2
- package/dist/components/toc/default.d.ts.map +1 -1
- package/dist/components/toc/default.js +1 -19
- package/dist/components/toc/index.d.ts +1 -10
- package/dist/components/toc/index.d.ts.map +1 -1
- package/dist/components/toc/index.js +1 -64
- package/dist/components/type-table.js +2 -2
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +20 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/collapsible.d.ts +7 -4
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +6 -7
- package/dist/components/ui/navigation-menu.d.ts +2 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/scroll-area.d.ts +5 -4
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +8 -8
- package/dist/components/{tabs.unstyled.d.ts → ui/tabs.d.ts} +1 -1
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/{tabs.unstyled.js → ui/tabs.js} +1 -1
- package/dist/contexts/i18n.d.ts +1 -29
- package/dist/contexts/i18n.d.ts.map +1 -1
- package/dist/contexts/i18n.js +1 -23
- package/dist/contexts/search.d.ts +1 -60
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +1 -58
- package/dist/contexts/tree.d.ts +1 -14
- package/dist/contexts/tree.d.ts.map +1 -1
- package/dist/contexts/tree.js +1 -31
- package/dist/i18n.d.ts +1 -14
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +1 -16
- package/dist/layouts/docs/client.d.ts.map +1 -1
- package/dist/layouts/docs/client.js +3 -3
- package/dist/layouts/docs/index.js +4 -4
- package/dist/layouts/docs/page/client.js +6 -6
- package/dist/layouts/docs/page/index.js +2 -2
- package/dist/layouts/docs/sidebar.d.ts +1 -1
- package/dist/layouts/docs/sidebar.js +4 -4
- package/dist/layouts/home/client.d.ts +1 -1
- package/dist/layouts/home/client.js +4 -4
- package/dist/layouts/home/index.js +1 -1
- package/dist/layouts/home/navbar.d.ts +1 -1
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/home/navbar.js +1 -1
- package/dist/layouts/notebook/client.d.ts +3 -3
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js +5 -5
- package/dist/layouts/notebook/index.js +4 -4
- package/dist/layouts/notebook/page/client.js +6 -6
- package/dist/layouts/notebook/page/index.js +2 -2
- package/dist/layouts/notebook/sidebar.d.ts +1 -1
- package/dist/layouts/notebook/sidebar.js +2 -2
- package/dist/layouts/shared/index.d.ts +2 -2
- package/dist/layouts/shared/index.d.ts.map +1 -1
- package/dist/layouts/shared/language-toggle.js +1 -1
- package/dist/layouts/shared/search-toggle.js +2 -2
- package/dist/layouts/shared/theme-toggle.js +2 -2
- package/dist/mdx.js +1 -1
- package/dist/mdx.server.d.ts +1 -1
- package/dist/mdx.server.d.ts.map +1 -1
- package/dist/mdx.server.js +1 -14
- package/dist/og.d.ts +1 -14
- package/dist/og.d.ts.map +1 -1
- package/dist/og.js +1 -45
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +1 -1
- package/dist/provider/base.d.ts +3 -22
- package/dist/provider/base.d.ts.map +1 -1
- package/dist/provider/base.js +4 -34
- package/dist/style.css +64 -131
- package/dist/utils/use-copy-button.d.ts +1 -2
- package/dist/utils/use-copy-button.d.ts.map +1 -1
- package/dist/utils/use-copy-button.js +1 -27
- package/dist/utils/use-footer-items.d.ts +1 -5
- package/dist/utils/use-footer-items.d.ts.map +1 -1
- package/dist/utils/use-footer-items.js +1 -27
- package/dist/utils/use-is-scroll-top.d.ts +1 -3
- package/dist/utils/use-is-scroll-top.d.ts.map +1 -1
- package/dist/utils/use-is-scroll-top.js +1 -17
- package/package.json +12 -25
- package/css/colors/index.css +0 -51
- package/css/shiki.css +0 -90
- package/dist/components/tabs.unstyled.d.ts.map +0 -1
- package/dist/icons.d.ts +0 -49
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js +0 -282
- package/dist/layouts/shared/link-item.d.ts +0 -78
- package/dist/layouts/shared/link-item.d.ts.map +0 -1
- package/dist/layouts/shared/link-item.js +0 -12
- package/dist/theme/typography/index.d.ts +0 -10
- package/dist/theme/typography/index.d.ts.map +0 -1
- package/dist/theme/typography/index.js +0 -137
- package/dist/theme/typography/styles.d.ts +0 -93
- package/dist/theme/typography/styles.d.ts.map +0 -1
- package/dist/theme/typography/styles.js +0 -433
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/cn.js +0 -1
- package/dist/utils/is-active.d.ts +0 -4
- package/dist/utils/is-active.d.ts.map +0 -1
- package/dist/utils/is-active.js +0 -15
- package/dist/utils/merge-refs.d.ts +0 -3
- package/dist/utils/merge-refs.d.ts.map +0 -1
- package/dist/utils/merge-refs.js +0 -12
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
export declare const Accordion: import("react").ForwardRefExoticComponent<Omit<Omit<AccordionPrimitive.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "title" | "value"> & {
|
|
1
|
+
import { ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
import { Accordion as Root, AccordionItem } from '../components/ui/accordion.js';
|
|
3
|
+
export declare function Accordions({ type, ref, className, defaultValue, ...props }: ComponentProps<typeof Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function Accordion({ title, id, value, children, ...props }: Omit<ComponentProps<typeof AccordionItem>, 'value' | 'title'> & {
|
|
6
5
|
title: string | ReactNode;
|
|
7
6
|
value?: string;
|
|
8
|
-
}
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,SAAS,IAAI,IAAI,EAGjB,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,UAAU,CAAC,EACzB,IAAe,EACf,GAAG,EACH,SAAS,EACT,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,2CAmC7B;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,EAAE,EACF,KAAqB,EACrB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG;IACjE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAcA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useCopyButton } from '../utils/use-copy-button.js';
|
|
3
|
+
import { Check, Link as LinkIcon } from '@fumadocs/ui/icons';
|
|
4
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
|
+
import { useCopyButton } from '@fumadocs/ui/hooks/use-copy-button';
|
|
8
7
|
import { buttonVariants } from '../components/ui/button.js';
|
|
9
|
-
import { mergeRefs } from '
|
|
10
|
-
|
|
8
|
+
import { mergeRefs } from '@fumadocs/ui/merge-refs';
|
|
9
|
+
import { Accordion as Root, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, } from '../components/ui/accordion.js';
|
|
10
|
+
export function Accordions({ type = 'single', ref, className, defaultValue, ...props }) {
|
|
11
11
|
const rootRef = useRef(null);
|
|
12
12
|
const composedRef = mergeRefs(ref, rootRef);
|
|
13
13
|
const [value, setValue] = useState(() => type === 'single' ? (defaultValue ?? '') : (defaultValue ?? []));
|
|
@@ -25,12 +25,11 @@ export const Accordions = forwardRef(({ type = 'single', className, defaultValue
|
|
|
25
25
|
}, []);
|
|
26
26
|
return (
|
|
27
27
|
// @ts-expect-error -- Multiple types
|
|
28
|
-
_jsx(
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
28
|
+
_jsx(Root, { type: type, ref: composedRef, value: value, onValueChange: setValue, collapsible: type === 'single' ? true : undefined, className: cn('divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card', className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
export function Accordion({ title, id, value = String(title), children, ...props }) {
|
|
31
|
+
return (_jsxs(AccordionItem, { value: value, ...props, children: [_jsxs(AccordionHeader, { id: id, "data-accordion-value": value, children: [_jsx(AccordionTrigger, { children: title }), id ? _jsx(CopyButton, { id: id }) : null] }), _jsx(AccordionContent, { children: _jsx("div", { className: "px-4 pb-2 text-[0.9375rem] prose-no-margin", children: children }) })] }));
|
|
32
|
+
}
|
|
34
33
|
function CopyButton({ id }) {
|
|
35
34
|
const [checked, onClick] = useCopyButton(() => {
|
|
36
35
|
const url = new URL(window.location.href);
|
|
@@ -42,4 +41,3 @@ function CopyButton({ id }) {
|
|
|
42
41
|
className: 'text-fd-muted-foreground me-2',
|
|
43
42
|
})), onClick: onClick, children: checked ? (_jsx(Check, { className: "size-3.5" })) : (_jsx(LinkIcon, { className: "size-3.5" })) }));
|
|
44
43
|
}
|
|
45
|
-
Accordion.displayName = 'Accordion';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { X } from '
|
|
5
|
-
import { cn } from '
|
|
4
|
+
import { X } from '@fumadocs/ui/icons';
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
6
|
import { buttonVariants } from '../components/ui/button.js';
|
|
7
7
|
export function Banner({ id, variant = 'normal', changeLayout = true, height = '3rem', rainbowColors = [
|
|
8
8
|
'rgba(0,149,255,0.56)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,CAAC;AAIX,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,2CAO9D;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAClE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EAAE,SAAkB,EACxB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA6BvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAMrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAYrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CircleCheck, CircleX, Info, TriangleAlert,
|
|
3
|
-
import { cn } from '
|
|
2
|
+
import { CircleCheck, CircleX, Info, Sun, TriangleAlert, } from '@fumadocs/ui/icons';
|
|
3
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
4
4
|
const iconClass = 'size-5 -me-0.5 fill-(--callout-color) text-fd-card';
|
|
5
5
|
export function Callout({ children, title, ...props }) {
|
|
6
6
|
return (_jsxs(CalloutContainer, { ...props, children: [title && _jsx(CalloutTitle, { children: title }), _jsx(CalloutDescription, { children: children })] }));
|
package/dist/components/card.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from 'fumadocs-core/link';
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
4
4
|
export function Cards(props) {
|
|
5
5
|
return (_jsx("div", { ...props, className: cn('grid grid-cols-2 gap-3 @container', props.className), children: props.children }));
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../components/tabs.
|
|
2
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../components/ui/tabs.js';
|
|
3
3
|
export interface CodeBlockProps extends ComponentProps<'figure'> {
|
|
4
4
|
/**
|
|
5
5
|
* Icon of code block
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/components/codeblock.tsx"],"names":[],"mappings":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;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,QAAQ,CAAC,2CAYvE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,2CAapC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,2CAErE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Check, Clipboard } from '
|
|
3
|
+
import { Check, Clipboard } from '@fumadocs/ui/icons';
|
|
4
4
|
import { createContext, use, useMemo, useRef, } from 'react';
|
|
5
|
-
import { cn } from '
|
|
6
|
-
import { useCopyButton } from '
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
|
+
import { useCopyButton } from '@fumadocs/ui/hooks/use-copy-button';
|
|
7
7
|
import { buttonVariants } from '../components/ui/button.js';
|
|
8
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger
|
|
9
|
-
import { mergeRefs } from '
|
|
8
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../components/ui/tabs.js';
|
|
9
|
+
import { mergeRefs } from '@fumadocs/ui/merge-refs';
|
|
10
10
|
const TabsContext = createContext(null);
|
|
11
11
|
export function Pre(props) {
|
|
12
12
|
return (_jsx("pre", { ...props, className: cn('min-w-full w-max *:flex *:flex-col', props.className), children: props.children }));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronRight, Hash, Search as SearchIcon } from '
|
|
3
|
+
import { ChevronRight, Hash, Search as SearchIcon } from '@fumadocs/ui/icons';
|
|
4
4
|
import { createContext, Fragment, useCallback, useContext, useEffect, useEffectEvent, useMemo, useRef, useState, } from 'react';
|
|
5
5
|
import { I18nLabel, useI18n } from '../../contexts/i18n.js';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { Dialog, DialogContent, DialogOverlay, DialogTitle, } from '@radix-ui/react-dialog';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import { useRouter } from 'fumadocs-core/framework';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { CodeBlock, Pre } from '../components/codeblock.js';
|
|
4
4
|
import { useShiki } from 'fumadocs-core/highlight/client';
|
|
5
|
-
import { cn } from '
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
6
|
import { createContext, Suspense, use, useDeferredValue, useId, } from 'react';
|
|
7
7
|
const PropsContext = createContext(undefined);
|
|
8
8
|
function DefaultPre(props) {
|
package/dist/components/files.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { File as FileIcon, Folder as FolderIcon, FolderOpen, } from '
|
|
4
|
+
import { File as FileIcon, Folder as FolderIcon, FolderOpen, } from '@fumadocs/ui/icons';
|
|
5
5
|
import { useState } from 'react';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from './ui/collapsible.js';
|
|
8
8
|
const itemVariants = cva('flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4');
|
|
9
9
|
export function Files({ className, ...props }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
3
|
-
import { Star } from '
|
|
2
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
3
|
+
import { Star } from '@fumadocs/ui/icons';
|
|
4
4
|
async function getRepoStarsAndForks(owner, repo, token, baseUrl = 'https://api.github.com') {
|
|
5
5
|
const endpoint = `${baseUrl}/repos/${owner}/${repo}`;
|
|
6
6
|
const headers = new Headers({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Link } from '
|
|
3
|
-
import { cn } from '
|
|
2
|
+
import { Link } from '@fumadocs/ui/icons';
|
|
3
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
4
4
|
export function Heading({ as, className, ...props }) {
|
|
5
5
|
const As = as ?? 'h1';
|
|
6
6
|
if (!props.id)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronDown } from '
|
|
3
|
+
import { ChevronDown } from '@fumadocs/ui/icons';
|
|
4
4
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from './ui/collapsible.js';
|
|
5
|
-
import { cn } from '
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
6
|
export function InlineTOC({ items, ...props }) {
|
|
7
7
|
return (_jsxs(Collapsible, { ...props, className: cn('not-prose rounded-lg border bg-fd-card text-fd-card-foreground', props.className), children: [_jsxs(CollapsibleTrigger, { className: "group inline-flex w-full items-center justify-between px-4 py-2.5 font-medium", children: [props.children ?? 'Table of Contents', _jsx(ChevronDown, { className: "size-4 transition-transform duration-200 group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col p-4 pt-0 text-sm text-fd-muted-foreground", children: items.map((item) => (_jsx("a", { href: item.url, className: "border-s py-1.5 hover:text-fd-accent-foreground", style: {
|
|
8
8
|
paddingInlineStart: 12 * Math.max(item.depth - 1, 0),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, type PointerEvent, type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import { type LinkProps } from 'fumadocs-core/link';
|
|
3
|
-
import { type ScrollAreaProps } from '
|
|
4
|
-
import type
|
|
3
|
+
import { type ScrollAreaProps } from '../../components/ui/scroll-area.js';
|
|
4
|
+
import { type CollapsibleContentProps, type CollapsibleTriggerProps } from '../../components/ui/collapsible.js';
|
|
5
5
|
interface SidebarContext {
|
|
6
6
|
open: boolean;
|
|
7
7
|
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAC;AAMrC,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE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,uDAahE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,CAAC,uDAmBzB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,2CAgBrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAc1D;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,GAAG;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,2CAeA;AAED,wBAAgB,aAAa,CAAC,EAC5B,WAAW,EAAE,eAAe,EAC5B,WAAkB,EAClB,MAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CA8BA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAgBzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,2CAuClE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAElE;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAY1B;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronDown, ExternalLink } from '
|
|
3
|
+
import { ChevronDown, ExternalLink } from '@fumadocs/ui/icons';
|
|
4
4
|
import { createContext, use, useEffect, useMemo, useRef, useState, } from 'react';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
6
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
7
|
-
import { cn } from '
|
|
8
|
-
import { ScrollArea, ScrollViewport } from '../../components/ui/scroll-area.js';
|
|
9
|
-
import { isActive } from '
|
|
7
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
8
|
+
import { ScrollArea, ScrollViewport, } from '../../components/ui/scroll-area.js';
|
|
9
|
+
import { isActive } from '@fumadocs/ui/urls';
|
|
10
10
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../../components/ui/collapsible.js';
|
|
11
11
|
import { useMediaQuery } from 'fumadocs-core/utils/use-media-query';
|
|
12
12
|
import { Presence } from '@radix-ui/react-presence';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
2
|
import type * as Base from './base.js';
|
|
3
|
-
import type { LinkItemType } from '
|
|
3
|
+
import type { LinkItemType } from '@fumadocs/ui/link-item';
|
|
4
4
|
type InternalComponents = Pick<typeof Base, 'SidebarFolder' | 'SidebarFolderLink' | 'SidebarFolderContent' | 'SidebarFolderTrigger' | 'SidebarItem'>;
|
|
5
5
|
export declare function createLinkItemRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, }: InternalComponents): ({ item, ...props }: HTMLAttributes<HTMLElement> & {
|
|
6
6
|
item: Exclude<LinkItemType, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-item.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/link-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"link-item.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/link-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,KAAK,kBAAkB,GAAG,IAAI,CAC5B,OAAO,IAAI,EACT,eAAe,GACf,mBAAmB,GACnB,sBAAsB,GACtB,sBAAsB,GACtB,aAAa,CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,GACZ,EAAE,kBAAkB,IAIa,oBAG7B,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C,6CAoCF"}
|
|
@@ -7,4 +7,5 @@ export declare function SidebarTabsDropdown({ options, placeholder, ...props }:
|
|
|
7
7
|
placeholder?: ReactNode;
|
|
8
8
|
options: SidebarTabWithProps[];
|
|
9
9
|
} & ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function isTabActive(tab: SidebarTab, pathname: string): boolean;
|
|
10
11
|
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/sidebar/tabs/dropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAW/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAEpC,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC,GAAG,cAAc,CAAC,QAAQ,CAAC,2CAkF3B"}
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/sidebar/tabs/dropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAW/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAEpC,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC,GAAG,cAAc,CAAC,QAAQ,CAAC,2CAkF3B;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAI5D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Check, ChevronsUpDown } from '
|
|
3
|
+
import { Check, ChevronsUpDown } from '@fumadocs/ui/icons';
|
|
4
4
|
import { useMemo, useState } from 'react';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
6
|
import { usePathname } from 'fumadocs-core/framework';
|
|
7
|
-
import { cn } from '
|
|
8
|
-
import {
|
|
7
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
8
|
+
import { isActive, normalize } from '@fumadocs/ui/urls';
|
|
9
9
|
import { useSidebar } from '../../../components/sidebar/base.js';
|
|
10
10
|
import { Popover, PopoverContent, PopoverTrigger, } from '../../../components/ui/popover.js';
|
|
11
11
|
export function SidebarTabsDropdown({ options, placeholder, ...props }) {
|
|
@@ -27,3 +27,8 @@ export function SidebarTabsDropdown({ options, placeholder, ...props }) {
|
|
|
27
27
|
return (_jsxs(Link, { href: item.url, onClick: onClick, ...item.props, className: cn('flex items-center gap-2 rounded-lg p-1.5 hover:bg-fd-accent hover:text-fd-accent-foreground', item.props?.className), children: [_jsx("div", { className: "shrink-0 size-9 md:mt-1 md:mb-auto md:size-5 empty:hidden", children: item.icon }), _jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium", children: item.title }), _jsx("p", { className: "text-[0.8125rem] text-fd-muted-foreground empty:hidden", children: item.description })] }), _jsx(Check, { className: cn('shrink-0 ms-auto size-3.5 text-fd-primary', !isActive && 'invisible') })] }, item.url));
|
|
28
28
|
}) })] }));
|
|
29
29
|
}
|
|
30
|
+
export function isTabActive(tab, pathname) {
|
|
31
|
+
if (tab.urls)
|
|
32
|
+
return tab.urls.has(normalize(pathname));
|
|
33
|
+
return isActive(tab.url, pathname, true);
|
|
34
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ComponentProps, type ReactNode } from 'react';
|
|
3
|
-
import * as Unstyled from './tabs.
|
|
3
|
+
import * as Unstyled from './ui/tabs.js';
|
|
4
4
|
export interface TabsProps extends Omit<ComponentProps<typeof Unstyled.Tabs>, 'value' | 'onValueChange'> {
|
|
5
5
|
/**
|
|
6
6
|
* Use simple mode instead of advanced usage as documented in https://radix-ui.com/primitives/docs/components/tabs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,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 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { createContext, useContext, useEffect, useId, useMemo, useState, } from 'react';
|
|
5
|
-
import { cn } from '
|
|
6
|
-
import * as Unstyled from './tabs.
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
|
+
import * as Unstyled from './ui/tabs.js';
|
|
7
7
|
const TabsContext = createContext(null);
|
|
8
8
|
function useTabContext() {
|
|
9
9
|
const ctx = useContext(TabsContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clerk.d.ts","sourceRoot":"","sources":["../../../src/components/toc/clerk.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clerk.d.ts","sourceRoot":"","sources":["../../../src/components/toc/clerk.tsx"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
|
@@ -1,76 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as Primitive from 'fumadocs-core/toc';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { cn } from '../../utils/cn.js';
|
|
6
|
-
import { useTOCItems, TocThumb } from './index.js';
|
|
7
|
-
import { mergeRefs } from '../../utils/merge-refs.js';
|
|
8
|
-
import { useI18n } from '../../contexts/i18n.js';
|
|
9
|
-
export function TOCItems({ ref, className, ...props }) {
|
|
10
|
-
const containerRef = useRef(null);
|
|
11
|
-
const items = useTOCItems();
|
|
12
|
-
const { text } = useI18n();
|
|
13
|
-
const [svg, setSvg] = useState();
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (!containerRef.current)
|
|
16
|
-
return;
|
|
17
|
-
const container = containerRef.current;
|
|
18
|
-
function onResize() {
|
|
19
|
-
if (container.clientHeight === 0)
|
|
20
|
-
return;
|
|
21
|
-
let w = 0, h = 0;
|
|
22
|
-
const d = [];
|
|
23
|
-
for (let i = 0; i < items.length; i++) {
|
|
24
|
-
const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
|
|
25
|
-
if (!element)
|
|
26
|
-
continue;
|
|
27
|
-
const styles = getComputedStyle(element);
|
|
28
|
-
const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop +
|
|
29
|
-
element.clientHeight -
|
|
30
|
-
parseFloat(styles.paddingBottom);
|
|
31
|
-
w = Math.max(offset, w);
|
|
32
|
-
h = Math.max(h, bottom);
|
|
33
|
-
d.push(`${i === 0 ? 'M' : 'L'}${offset} ${top}`);
|
|
34
|
-
d.push(`L${offset} ${bottom}`);
|
|
35
|
-
}
|
|
36
|
-
setSvg({
|
|
37
|
-
path: d.join(' '),
|
|
38
|
-
width: w + 1,
|
|
39
|
-
height: h,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
const observer = new ResizeObserver(onResize);
|
|
43
|
-
onResize();
|
|
44
|
-
observer.observe(container);
|
|
45
|
-
return () => {
|
|
46
|
-
observer.disconnect();
|
|
47
|
-
};
|
|
48
|
-
}, [items]);
|
|
49
|
-
if (items.length === 0)
|
|
50
|
-
return (_jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings }));
|
|
51
|
-
return (_jsxs(_Fragment, { children: [svg && (_jsx("div", { className: "absolute start-0 top-0 rtl:-scale-x-100", style: {
|
|
52
|
-
width: svg.width,
|
|
53
|
-
height: svg.height,
|
|
54
|
-
maskImage: `url("data:image/svg+xml,${
|
|
55
|
-
// Inline SVG
|
|
56
|
-
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>`)}")`,
|
|
57
|
-
}, children: _jsx(TocThumb, { containerRef: containerRef, className: "mt-(--fd-top) h-(--fd-height) bg-fd-primary transition-all" }) })), _jsx("div", { ref: mergeRefs(containerRef, ref), className: cn('flex flex-col', className), ...props, children: items.map((item, i) => (_jsx(TOCItem, { item: item, upper: items[i - 1]?.depth, lower: items[i + 1]?.depth }, item.url))) })] }));
|
|
58
|
-
}
|
|
59
|
-
function getItemOffset(depth) {
|
|
60
|
-
if (depth <= 2)
|
|
61
|
-
return 14;
|
|
62
|
-
if (depth === 3)
|
|
63
|
-
return 26;
|
|
64
|
-
return 36;
|
|
65
|
-
}
|
|
66
|
-
function getLineOffset(depth) {
|
|
67
|
-
return depth >= 3 ? 10 : 0;
|
|
68
|
-
}
|
|
69
|
-
function TOCItem({ item, upper = item.depth, lower = item.depth, }) {
|
|
70
|
-
const offset = getLineOffset(item.depth), upperOffset = getLineOffset(upper), lowerOffset = getLineOffset(lower);
|
|
71
|
-
return (_jsxs(Primitive.TOCItem, { href: item.url, style: {
|
|
72
|
-
paddingInlineStart: getItemOffset(item.depth),
|
|
73
|
-
}, 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", children: [offset !== upperOffset && (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", className: "absolute -top-1.5 start-0 size-4 rtl:-scale-x-100", children: _jsx("line", { x1: upperOffset, y1: "0", x2: offset, y2: "12", className: "stroke-fd-foreground/10", strokeWidth: "1" }) })), _jsx("div", { className: cn('absolute inset-y-0 w-px bg-fd-foreground/10', offset !== upperOffset && 'top-1.5', offset !== lowerOffset && 'bottom-1.5'), style: {
|
|
74
|
-
insetInlineStart: offset,
|
|
75
|
-
} }), item.title] }));
|
|
76
|
-
}
|
|
1
|
+
export * from '@fumadocs/ui/components/toc/clerk';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/components/toc/default.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/components/toc/default.tsx"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useI18n } from '../../contexts/i18n.js';
|
|
4
|
-
import { cn } from '../../utils/cn.js';
|
|
5
|
-
import { mergeRefs } from '../../utils/merge-refs.js';
|
|
6
|
-
import { useRef } from 'react';
|
|
7
|
-
import { useTOCItems, TocThumb } from './index.js';
|
|
8
|
-
import * as Primitive from 'fumadocs-core/toc';
|
|
9
|
-
export function TOCItems({ ref, className, ...props }) {
|
|
10
|
-
const containerRef = useRef(null);
|
|
11
|
-
const items = useTOCItems();
|
|
12
|
-
const { text } = useI18n();
|
|
13
|
-
if (items.length === 0)
|
|
14
|
-
return (_jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings }));
|
|
15
|
-
return (_jsxs(_Fragment, { children: [_jsx(TocThumb, { containerRef: containerRef, className: "absolute top-(--fd-top) h-(--fd-height) w-px bg-fd-primary transition-all" }), _jsx("div", { ref: mergeRefs(ref, containerRef), className: cn('flex flex-col border-s border-fd-foreground/10', className), ...props, children: items.map((item) => (_jsx(TOCItem, { item: item }, item.url))) })] }));
|
|
16
|
-
}
|
|
17
|
-
function TOCItem({ item }) {
|
|
18
|
-
return (_jsx(Primitive.TOCItem, { href: item.url, className: cn('prose py-1.5 text-sm text-fd-muted-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary', item.depth <= 2 && 'ps-3', item.depth === 3 && 'ps-6', item.depth >= 4 && 'ps-8'), children: item.title }));
|
|
19
|
-
}
|
|
1
|
+
export * from '@fumadocs/ui/components/toc/default';
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type ComponentProps, type RefObject } from 'react';
|
|
3
|
-
export declare function useTOCItems(): Primitive.TOCItemType[];
|
|
4
|
-
export declare function TOCProvider({ toc, children, ...props }: ComponentProps<typeof Primitive.AnchorProvider>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare function TOCScrollArea({ ref, className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
interface RefProps {
|
|
7
|
-
containerRef: RefObject<HTMLElement | null>;
|
|
8
|
-
}
|
|
9
|
-
export declare function TocThumb({ containerRef, ...props }: ComponentProps<'div'> & RefProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
1
|
+
export * from '@fumadocs/ui/components/toc/index';
|
|
11
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toc/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toc/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as Primitive from 'fumadocs-core/toc';
|
|
4
|
-
import { createContext, use, useEffect, useEffectEvent, useRef, } from 'react';
|
|
5
|
-
import { cn } from '../../utils/cn.js';
|
|
6
|
-
import { mergeRefs } from '../../utils/merge-refs.js';
|
|
7
|
-
const TOCContext = createContext([]);
|
|
8
|
-
export function useTOCItems() {
|
|
9
|
-
return use(TOCContext);
|
|
10
|
-
}
|
|
11
|
-
export function TOCProvider({ toc, children, ...props }) {
|
|
12
|
-
return (_jsx(TOCContext, { value: toc, children: _jsx(Primitive.AnchorProvider, { toc: toc, ...props, children: children }) }));
|
|
13
|
-
}
|
|
14
|
-
export function TOCScrollArea({ ref, className, ...props }) {
|
|
15
|
-
const viewRef = useRef(null);
|
|
16
|
-
return (_jsx("div", { ref: mergeRefs(viewRef, ref), className: cn('relative min-h-0 text-sm ms-px overflow-auto [scrollbar-width:none] mask-[linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)] py-3', className), ...props, children: _jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: props.children }) }));
|
|
17
|
-
}
|
|
18
|
-
export function TocThumb({ containerRef, ...props }) {
|
|
19
|
-
const thumbRef = useRef(null);
|
|
20
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: thumbRef, role: "none", ...props }), _jsx(Updater, { containerRef: containerRef, thumbRef: thumbRef })] }));
|
|
21
|
-
}
|
|
22
|
-
function Updater({ containerRef, thumbRef, }) {
|
|
23
|
-
const active = Primitive.useActiveAnchors();
|
|
24
|
-
const onPrint = useEffectEvent(() => {
|
|
25
|
-
if (!containerRef.current || !thumbRef.current)
|
|
26
|
-
return;
|
|
27
|
-
update(thumbRef.current, calc(containerRef.current, active));
|
|
28
|
-
});
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!containerRef.current)
|
|
31
|
-
return;
|
|
32
|
-
const container = containerRef.current;
|
|
33
|
-
const observer = new ResizeObserver(onPrint);
|
|
34
|
-
observer.observe(container);
|
|
35
|
-
return () => {
|
|
36
|
-
observer.disconnect();
|
|
37
|
-
};
|
|
38
|
-
}, [containerRef]);
|
|
39
|
-
if (containerRef.current && thumbRef.current) {
|
|
40
|
-
update(thumbRef.current, calc(containerRef.current, active));
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
function calc(container, active) {
|
|
45
|
-
if (active.length === 0 || container.clientHeight === 0) {
|
|
46
|
-
return [0, 0];
|
|
47
|
-
}
|
|
48
|
-
let upper = Number.MAX_VALUE, lower = 0;
|
|
49
|
-
for (const item of active) {
|
|
50
|
-
const element = container.querySelector(`a[href="#${item}"]`);
|
|
51
|
-
if (!element)
|
|
52
|
-
continue;
|
|
53
|
-
const styles = getComputedStyle(element);
|
|
54
|
-
upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
|
|
55
|
-
lower = Math.max(lower, element.offsetTop +
|
|
56
|
-
element.clientHeight -
|
|
57
|
-
parseFloat(styles.paddingBottom));
|
|
58
|
-
}
|
|
59
|
-
return [upper, lower - upper];
|
|
60
|
-
}
|
|
61
|
-
function update(element, info) {
|
|
62
|
-
element.style.setProperty('--fd-top', `${info[0]}px`);
|
|
63
|
-
element.style.setProperty('--fd-height', `${info[1]}px`);
|
|
64
|
-
}
|
|
1
|
+
export * from '@fumadocs/ui/components/toc/index';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronDown } from '
|
|
3
|
+
import { ChevronDown } from '@fumadocs/ui/icons';
|
|
4
4
|
import Link from 'fumadocs-core/link';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { useState } from 'react';
|
|
8
8
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../components/ui/collapsible.js';
|
|
9
9
|
const keyVariants = cva('text-fd-primary', {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Primitive from '@radix-ui/react-accordion';
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
|
+
export declare function Accordion({ className, ...props }: ComponentProps<typeof Primitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function AccordionItem({ className, children, ...props }: ComponentProps<typeof Primitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function AccordionHeader({ className, children, ...props }: ComponentProps<typeof Primitive.Header>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function AccordionTrigger({ className, children, ...props }: ComponentProps<typeof Primitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function AccordionContent({ className, children, ...props }: ComponentProps<typeof Primitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,2CAUvC;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,2CAMvC;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,2CAYzC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,2CAa1C;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,2CAY1C"}
|