fumadocs-ui 16.2.5 → 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 -36
- 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 +63 -130
- 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 +10 -23
- 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,6 +1,6 @@
|
|
|
1
1
|
import type { HomeLayoutProps } from './index.js';
|
|
2
2
|
export declare const navItemVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "icon" | "button" | "main" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
5
|
export declare function Header({ nav, i18n, links, githubUrl, themeSwitch, searchToggle, }: HomeLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -3,16 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { Fragment, useMemo, useState } from 'react';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { resolveLinkItems, } from '../../layouts/shared/index.js';
|
|
8
|
-
import { LinkItem } from '
|
|
8
|
+
import { LinkItem } from '@fumadocs/ui/link-item';
|
|
9
9
|
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, } from '../../components/ui/navigation-menu.js';
|
|
10
10
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
11
11
|
import { LargeSearchToggle, SearchToggle, } from '../../layouts/shared/search-toggle.js';
|
|
12
12
|
import { ThemeToggle } from '../../layouts/shared/theme-toggle.js';
|
|
13
13
|
import { LanguageToggle, LanguageToggleText, } from '../../layouts/shared/language-toggle.js';
|
|
14
|
-
import { ChevronDown, Languages } from '
|
|
15
|
-
import { useIsScrollTop } from '
|
|
14
|
+
import { ChevronDown, Languages } from '@fumadocs/ui/icons';
|
|
15
|
+
import { useIsScrollTop } from '@fumadocs/ui/hooks/use-is-scroll-top';
|
|
16
16
|
export const navItemVariants = cva('[&_svg]:size-4', {
|
|
17
17
|
variants: {
|
|
18
18
|
variant: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
3
3
|
import { Header } from '../../layouts/home/client.js';
|
|
4
4
|
export function HomeLayout(props) {
|
|
5
5
|
const { nav = {}, links, githubUrl, i18n, themeSwitch = {}, searchToggle, ...rest } = props;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type LinkProps } from 'fumadocs-core/link';
|
|
2
|
-
import type
|
|
2
|
+
import { type NavigationMenuContentProps, type NavigationMenuTriggerProps } from '../../components/ui/navigation-menu.js';
|
|
3
3
|
export declare const NavbarMenu: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-navigation-menu").NavigationMenuItemProps & import("react").RefAttributes<HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
|
|
4
4
|
export declare function NavbarMenuContent(props: NavigationMenuContentProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function NavbarMenuTrigger(props: NavigationMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAEL,KAAK,0BAA0B,EAI/B,KAAK,0BAA0B,EAChC,MAAM,iCAAiC,CAAC;AAGzC,eAAO,MAAM,UAAU,yNAAqB,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CAYlE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CASlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,2CAc9C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import Link from 'fumadocs-core/link';
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
5
5
|
import { NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, } from '../../components/ui/navigation-menu.js';
|
|
6
6
|
import { navItemVariants } from './client.js';
|
|
7
7
|
export const NavbarMenu = NavigationMenuItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import { type LinkItemType } from '
|
|
3
|
-
import type
|
|
2
|
+
import { type LinkItemType } from '@fumadocs/ui/link-item';
|
|
3
|
+
import { type SidebarTabWithProps } from '../../components/sidebar/tabs/dropdown.js';
|
|
4
4
|
export declare const LayoutContext: import("react").Context<(LayoutInfo & {
|
|
5
5
|
isNavTransparent: boolean;
|
|
6
6
|
}) | null>;
|
|
@@ -19,5 +19,5 @@ export declare function LayoutHeaderTabs({ options, className, ...props }: Compo
|
|
|
19
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export declare function NavbarLinkItem({ item, className, ...props }: {
|
|
21
21
|
item: LinkItemType;
|
|
22
|
-
} & HTMLAttributes<HTMLElement>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> |
|
|
22
|
+
} & HTMLAttributes<HTMLElement>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
23
23
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAMf,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAE5C,eAAO,MAAM,aAAa;sBAEF,OAAO;UAGxB,CAAC;AAER,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC9B,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,kBAA2B,EAC3B,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,UAAU,GAAG;IACd,kBAAkB,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAoBA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAS3D;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,2CAqCvB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC,2CAmCA;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GAAG,cAAc,CAAC,WAAW,CAAC,2UAmBtD"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
4
4
|
import { createContext, Fragment, use, useMemo, useRef, useState, } from 'react';
|
|
5
5
|
import { useSidebar } from '../../components/sidebar/base.js';
|
|
6
|
-
import { ChevronDown } from '
|
|
6
|
+
import { ChevronDown } from '@fumadocs/ui/icons';
|
|
7
7
|
import Link from 'fumadocs-core/link';
|
|
8
8
|
import { usePathname } from 'fumadocs-core/framework';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { LinkItem, } from '../shared/link-item.js';
|
|
9
|
+
import { useIsScrollTop } from '@fumadocs/ui/hooks/use-is-scroll-top';
|
|
10
|
+
import { LinkItem, } from '@fumadocs/ui/link-item';
|
|
12
11
|
import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover.js';
|
|
12
|
+
import { isTabActive, } from '../../components/sidebar/tabs/dropdown.js';
|
|
13
13
|
export const LayoutContext = createContext(null);
|
|
14
14
|
export function LayoutContextProvider({ navTransparentMode = 'none', navMode, tabMode, children, }) {
|
|
15
15
|
const isTop = useIsScrollTop({ enabled: navTransparentMode === 'top' }) ?? true;
|
|
@@ -3,15 +3,15 @@ import { useMemo, } from 'react';
|
|
|
3
3
|
import { resolveLinkItems } from '../../layouts/shared/index.js';
|
|
4
4
|
import { Sidebar, SidebarCollapseTrigger, SidebarContent, SidebarDrawer, SidebarLinkItem, SidebarPageTree, SidebarTrigger, SidebarViewport, } from './sidebar.js';
|
|
5
5
|
import { TreeContextProvider } from '../../contexts/tree.js';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
8
|
-
import { Languages, Sidebar as SidebarIcon, X } from '
|
|
8
|
+
import { Languages, Sidebar as SidebarIcon, X } from '@fumadocs/ui/icons';
|
|
9
9
|
import { LanguageToggle } from '../../layouts/shared/language-toggle.js';
|
|
10
10
|
import { ThemeToggle } from '../../layouts/shared/theme-toggle.js';
|
|
11
|
-
import { LayoutBody, LayoutContextProvider,
|
|
11
|
+
import { LayoutBody, LayoutContextProvider, LayoutHeader, LayoutHeaderTabs, NavbarLinkItem, } from '../../layouts/notebook/client.js';
|
|
12
12
|
import Link from 'fumadocs-core/link';
|
|
13
13
|
import { LargeSearchToggle, SearchToggle, } from '../../layouts/shared/search-toggle.js';
|
|
14
|
-
import { LinkItem } from '
|
|
14
|
+
import { LinkItem } from '@fumadocs/ui/link-item';
|
|
15
15
|
import { getSidebarTabs, } from '../../components/sidebar/tabs/index.js';
|
|
16
16
|
import { SidebarTabsDropdown, } from '../../components/sidebar/tabs/dropdown.js';
|
|
17
17
|
export function DocsLayout(props) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Fragment, useEffect, useEffectEvent,
|
|
4
|
-
import { ChevronDown, ChevronLeft, ChevronRight } from '
|
|
3
|
+
import { createContext, Fragment, use, useEffect, useEffectEvent, useMemo, useRef, useState, } from 'react';
|
|
4
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from '@fumadocs/ui/icons';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { useI18n } from '../../../contexts/i18n.js';
|
|
8
8
|
import { useTreeContext, useTreePath } from '../../../contexts/tree.js';
|
|
9
9
|
import { usePathname } from 'fumadocs-core/framework';
|
|
10
10
|
import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
|
|
11
|
-
import { isActive } from '
|
|
11
|
+
import { isActive } from '@fumadocs/ui/urls';
|
|
12
12
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../../../components/ui/collapsible.js';
|
|
13
13
|
import { useTOCItems } from '../../../components/toc/index.js';
|
|
14
14
|
import { useActiveAnchor } from 'fumadocs-core/toc';
|
|
15
15
|
import { LayoutContext } from '../client.js';
|
|
16
|
-
import { useFooterItems } from '
|
|
16
|
+
import { useFooterItems } from '@fumadocs/ui/hooks/use-footer-items';
|
|
17
17
|
const TocPopoverContext = createContext(null);
|
|
18
18
|
export function PageTOCPopover({ className, children, ...rest }) {
|
|
19
19
|
const ref = useRef(null);
|
|
@@ -44,7 +44,7 @@ export function PageTOCPopoverTrigger({ className, ...props }) {
|
|
|
44
44
|
const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
|
|
45
45
|
const path = useTreePath().at(-1);
|
|
46
46
|
const showItem = selected !== -1 && !open;
|
|
47
|
-
return (_jsxs(CollapsibleTrigger, { className: cn('flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6', className), "data-toc-popover-trigger": "", ...props, children: [_jsx(ProgressCircle, { value: (selected + 1) / Math.max(1, items.length), max: 1, className: cn('shrink-0', open && 'text-fd-primary') }), _jsxs("span", { className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1", children: [_jsx("span", { className: cn('truncate transition-
|
|
47
|
+
return (_jsxs(CollapsibleTrigger, { className: cn('flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6', className), "data-toc-popover-trigger": "", ...props, children: [_jsx(ProgressCircle, { value: (selected + 1) / Math.max(1, items.length), max: 1, className: cn('shrink-0', open && 'text-fd-primary') }), _jsxs("span", { className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1", children: [_jsx("span", { className: cn('truncate transition-[opacity,translate,color]', open && 'text-fd-foreground', showItem && 'opacity-0 -translate-y-full pointer-events-none'), children: path?.name ?? text.toc }), _jsx("span", { className: cn('truncate transition-[opacity,translate]', !showItem && 'opacity-0 translate-y-full pointer-events-none'), children: items[selected]?.title })] }), _jsx(ChevronDown, { className: cn('shrink-0 transition-transform mx-0.5', open && 'rotate-180') })] }));
|
|
48
48
|
}
|
|
49
49
|
function clamp(input, min, max) {
|
|
50
50
|
if (input < min)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
3
3
|
import { buttonVariants } from '../../../components/ui/button.js';
|
|
4
|
-
import { Edit, Text } from '
|
|
4
|
+
import { Edit, Text } from '@fumadocs/ui/icons';
|
|
5
5
|
import { I18nLabel } from '../../../contexts/i18n.js';
|
|
6
6
|
import { PageBreadcrumb, PageFooter, PageTOCPopover, PageTOCPopoverContent, PageTOCPopoverTrigger, } from './client.js';
|
|
7
7
|
import * as TocDefault from '../../../components/toc/default.js';
|
|
@@ -10,7 +10,7 @@ export declare function SidebarFolderLink({ className, style, ...props }: Compon
|
|
|
10
10
|
export declare function SidebarFolderContent({ className, children, ...props }: ComponentProps<typeof Base.SidebarFolderContent>): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export declare const SidebarPageTree: (components: Partial<import("../../components/sidebar/page-tree.js").SidebarPageTreeComponents>) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare const SidebarLinkItem: ({ item, ...props }: import("react").HTMLAttributes<HTMLElement> & {
|
|
13
|
-
item: Exclude<import("
|
|
13
|
+
item: Exclude<import("@fumadocs/ui/link-item").LinkItemType, {
|
|
14
14
|
type: "icon";
|
|
15
15
|
}>;
|
|
16
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as Base from '../../components/sidebar/base.js';
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
5
5
|
import { use, useRef } from 'react';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
import { LayoutContext } from './client.js';
|
|
8
8
|
import { createPageTreeRenderer } from '../../components/sidebar/page-tree.js';
|
|
9
9
|
import { createLinkItemRenderer } from '../../components/sidebar/link-item.js';
|
|
10
|
-
import { mergeRefs } from '
|
|
10
|
+
import { mergeRefs } from '@fumadocs/ui/merge-refs';
|
|
11
11
|
const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { I18nConfig } from 'fumadocs-core/i18n';
|
|
3
|
-
import type { LinkItemType } from '
|
|
3
|
+
import type { LinkItemType } from '@fumadocs/ui/link-item';
|
|
4
4
|
export interface NavOptions {
|
|
5
5
|
enabled: boolean;
|
|
6
6
|
component: ReactNode;
|
|
@@ -52,5 +52,5 @@ export interface BaseLayoutProps {
|
|
|
52
52
|
* Get link items with shortcuts
|
|
53
53
|
*/
|
|
54
54
|
export declare function resolveLinkItems({ links, githubUrl, }: Pick<BaseLayoutProps, 'links' | 'githubUrl'>): LinkItemType[];
|
|
55
|
-
export type * from '
|
|
55
|
+
export type * from '@fumadocs/ui/link-item';
|
|
56
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/shared/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAE5C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,GAAG,mBAAmB,CAAC;KAC3C,CAAC;IAEF,YAAY,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,OAAO,CAAC;YAClB,EAAE,EAAE,SAAS,CAAC;YACd,EAAE,EAAE,SAAS,CAAC;SACf,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAU,EACV,SAAS,GACV,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG,YAAY,EAAE,CAkB/D;AAED,mBAAmB,wBAAwB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useI18n } from '../../contexts/i18n.js';
|
|
4
4
|
import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover.js';
|
|
5
|
-
import { cn } from '
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
6
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
7
7
|
export function LanguageToggle(props) {
|
|
8
8
|
const context = useI18n();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Search } from '
|
|
3
|
+
import { Search } from '@fumadocs/ui/icons';
|
|
4
4
|
import { useSearchContext } from '../../contexts/search.js';
|
|
5
5
|
import { useI18n } from '../../contexts/i18n.js';
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
7
7
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
8
8
|
export function SearchToggle({ hideIfDisabled, size = 'icon-sm', color = 'ghost', ...props }) {
|
|
9
9
|
const { setOpenSearch, enabled } = useSearchContext();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { Moon, Sun
|
|
4
|
+
import { Airplay, Moon, Sun } from '@fumadocs/ui/icons';
|
|
5
5
|
import { useTheme } from 'next-themes';
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
7
|
-
import { cn } from '
|
|
7
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
8
8
|
const itemVariants = cva('size-6.5 rounded-full p-1.5 text-fd-muted-foreground', {
|
|
9
9
|
variants: {
|
|
10
10
|
active: {
|
package/dist/mdx.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Image as FrameworkImage } from 'fumadocs-core/framework';
|
|
|
4
4
|
import { Card, Cards } from './components/card.js';
|
|
5
5
|
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from './components/callout.js';
|
|
6
6
|
import { Heading } from './components/heading.js';
|
|
7
|
-
import { cn } from '
|
|
7
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
8
8
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre, } from './components/codeblock.js';
|
|
9
9
|
function Image(props) {
|
|
10
10
|
return (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, src: props.src, className: cn('rounded-lg', props.className) }));
|
package/dist/mdx.server.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ import defaultMdxComponents from './mdx.js';
|
|
|
8
8
|
* @param source the source object
|
|
9
9
|
* @param OverrideLink The component to override from
|
|
10
10
|
*/
|
|
11
|
-
export declare function createRelativeLink(source: LoaderOutput<
|
|
11
|
+
export declare function createRelativeLink<C extends LoaderConfig>(source: LoaderOutput<C>, page: Page, OverrideLink?: FC<ComponentProps<'a'>>): FC<ComponentProps<'a'>>;
|
|
12
12
|
export { defaultMdxComponents as default };
|
|
13
13
|
//# sourceMappingURL=mdx.server.d.ts.map
|
package/dist/mdx.server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,YAAY,EACvD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAA0B,GAC7D,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CASzB;AAED,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/mdx.server.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import defaultMdxComponents from './mdx.js';
|
|
3
|
-
import * as path from 'node:path';
|
|
4
3
|
/**
|
|
5
4
|
* Extend the default Link component to resolve relative file paths in `href`.
|
|
6
5
|
*
|
|
@@ -10,19 +9,7 @@ import * as path from 'node:path';
|
|
|
10
9
|
*/
|
|
11
10
|
export function createRelativeLink(source, page, OverrideLink = defaultMdxComponents.a) {
|
|
12
11
|
return async function RelativeLink({ href, ...props }) {
|
|
13
|
-
|
|
14
|
-
if (href && href.startsWith('.')) {
|
|
15
|
-
const target = source.getPageByHref(href, {
|
|
16
|
-
dir: path.dirname(page.path),
|
|
17
|
-
language: page.locale,
|
|
18
|
-
});
|
|
19
|
-
if (target) {
|
|
20
|
-
href = target.hash
|
|
21
|
-
? `${target.page.url}#${target.hash}`
|
|
22
|
-
: target.page.url;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return _jsx(OverrideLink, { href: href, ...props });
|
|
12
|
+
return (_jsx(OverrideLink, { href: href ? source.resolveHref(href, page) : href, ...props }));
|
|
26
13
|
};
|
|
27
14
|
}
|
|
28
15
|
export { defaultMdxComponents as default };
|
package/dist/og.d.ts
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types';
|
|
4
|
-
interface GenerateProps {
|
|
5
|
-
title: ReactNode;
|
|
6
|
-
description?: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
primaryColor?: string;
|
|
9
|
-
primaryTextColor?: string;
|
|
10
|
-
site?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare function generateOGImage(options: GenerateProps & ImageResponseOptions): ImageResponse;
|
|
13
|
-
export declare function generate({ primaryColor, primaryTextColor, ...props }: GenerateProps): ReactElement;
|
|
14
|
-
export {};
|
|
1
|
+
export * from '@fumadocs/ui/og/next';
|
|
15
2
|
//# sourceMappingURL=og.d.ts.map
|
package/dist/og.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../src/og.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../src/og.tsx"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
package/dist/og.js
CHANGED
|
@@ -1,45 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ImageResponse } from 'next/og';
|
|
3
|
-
export function generateOGImage(options) {
|
|
4
|
-
const { title, description, icon, site, primaryColor, primaryTextColor, ...rest } = options;
|
|
5
|
-
return new ImageResponse(generate({
|
|
6
|
-
title,
|
|
7
|
-
description,
|
|
8
|
-
icon,
|
|
9
|
-
site,
|
|
10
|
-
primaryTextColor,
|
|
11
|
-
primaryColor,
|
|
12
|
-
}), {
|
|
13
|
-
width: 1200,
|
|
14
|
-
height: 630,
|
|
15
|
-
...rest,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export function generate({ primaryColor = 'rgba(255,150,255,0.3)', primaryTextColor = 'rgb(255,150,255)', ...props }) {
|
|
19
|
-
return (_jsxs("div", { style: {
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
width: '100%',
|
|
23
|
-
height: '100%',
|
|
24
|
-
color: 'white',
|
|
25
|
-
padding: '4rem',
|
|
26
|
-
backgroundColor: '#0c0c0c',
|
|
27
|
-
backgroundImage: `linear-gradient(to top right, ${primaryColor}, transparent)`,
|
|
28
|
-
}, children: [_jsxs("div", { style: {
|
|
29
|
-
display: 'flex',
|
|
30
|
-
flexDirection: 'row',
|
|
31
|
-
alignItems: 'center',
|
|
32
|
-
gap: '16px',
|
|
33
|
-
marginBottom: '12px',
|
|
34
|
-
color: primaryTextColor,
|
|
35
|
-
}, children: [props.icon, _jsx("p", { style: {
|
|
36
|
-
fontSize: '56px',
|
|
37
|
-
fontWeight: 600,
|
|
38
|
-
}, children: props.site })] }), _jsx("p", { style: {
|
|
39
|
-
fontWeight: 800,
|
|
40
|
-
fontSize: '82px',
|
|
41
|
-
}, children: props.title }), _jsx("p", { style: {
|
|
42
|
-
fontSize: '52px',
|
|
43
|
-
color: 'rgba(240,240,240,0.8)',
|
|
44
|
-
}, children: props.description })] }));
|
|
45
|
-
}
|
|
1
|
+
export * from '@fumadocs/ui/og/next';
|
package/dist/page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAO,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAM5C,OAAO,EACL,eAAe,EACf,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,UAAU,mBAAoB,SAAQ,IAAI,CACxC,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,UAAU,CACpB;IACC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,aAAa;IACvD,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAYxD;AAED,wBAAgB,QAAQ,CAAC,EACvB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,2CAmBf"}
|
package/dist/page.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { use } from 'react';
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
5
5
|
import * as Docs from './layouts/docs/page/index.js';
|
|
6
6
|
import * as Notebook from './layouts/notebook/page/index.js';
|
|
7
7
|
import { LayoutContext } from './layouts/docs/client.js';
|
package/dist/provider/base.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ThemeProvider } from 'next-themes';
|
|
2
1
|
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
3
2
|
import type { DefaultSearchDialogProps } from '../components/dialog/search-default.js';
|
|
4
|
-
import {
|
|
5
|
-
import { type
|
|
3
|
+
import { ThemeProvider } from 'next-themes';
|
|
4
|
+
import { type I18nProviderProps } from '@fumadocs/ui/contexts/i18n';
|
|
5
|
+
import { type SearchProviderProps } from '@fumadocs/ui/contexts/search';
|
|
6
6
|
interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'> {
|
|
7
7
|
options?: Partial<DefaultSearchDialogProps>;
|
|
8
8
|
/**
|
|
@@ -35,25 +35,6 @@ export interface RootProviderProps {
|
|
|
35
35
|
i18n?: Omit<I18nProviderProps, 'children'>;
|
|
36
36
|
children?: ReactNode;
|
|
37
37
|
}
|
|
38
|
-
export interface I18nProviderProps {
|
|
39
|
-
/**
|
|
40
|
-
* Current locale
|
|
41
|
-
*/
|
|
42
|
-
locale: string;
|
|
43
|
-
/**
|
|
44
|
-
* Handle changes to the locale, redirect user when not specified.
|
|
45
|
-
*/
|
|
46
|
-
onLocaleChange?: (v: string) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Translations of current locale
|
|
49
|
-
*/
|
|
50
|
-
translations?: Partial<Translations>;
|
|
51
|
-
/**
|
|
52
|
-
* Available languages
|
|
53
|
-
*/
|
|
54
|
-
locales?: LocaleItem[];
|
|
55
|
-
children?: ReactNode;
|
|
56
|
-
}
|
|
57
38
|
export declare function RootProvider({ children, dir, theme, search, i18n, }: RootProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
58
39
|
export {};
|
|
59
40
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/provider/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/provider/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,wBAAwB,EAAQ,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AAEtC,UAAU,aAAc,SAAQ,IAAI,CAClC,mBAAmB,EACnB,SAAS,GAAG,UAAU,CACvB;IACC,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAE5C;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,CAAC,GAAG;QAChE;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAEF,IAAI,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAE3C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,GAAW,EACX,KAAU,EACV,MAAM,EACN,IAAI,GACL,EAAE,iBAAiB,2CA4BnB"}
|
package/dist/provider/base.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { lazy, useMemo, useRef, } from 'react';
|
|
3
|
+
import { lazy } from 'react';
|
|
5
4
|
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { ThemeProvider } from 'next-themes';
|
|
6
|
+
import { I18nProvider, } from '@fumadocs/ui/contexts/i18n';
|
|
7
|
+
import { SearchProvider, } from '@fumadocs/ui/contexts/search';
|
|
9
8
|
const DefaultSearchDialog = lazy(() => import('../components/dialog/search-default.js'));
|
|
10
9
|
export function RootProvider({ children, dir = 'ltr', theme = {}, search, i18n, }) {
|
|
11
10
|
let body = children;
|
|
@@ -18,32 +17,3 @@ export function RootProvider({ children, dir = 'ltr', theme = {}, search, i18n,
|
|
|
18
17
|
}
|
|
19
18
|
return _jsx(DirectionProvider, { dir: dir, children: body });
|
|
20
19
|
}
|
|
21
|
-
function I18nProvider({ locales = [], locale, onLocaleChange, children, translations, }) {
|
|
22
|
-
const router = useRouter();
|
|
23
|
-
const pathname = usePathname();
|
|
24
|
-
const onChange = (value) => {
|
|
25
|
-
if (onLocaleChange) {
|
|
26
|
-
return onLocaleChange(value);
|
|
27
|
-
}
|
|
28
|
-
const segments = pathname.split('/').filter((v) => v.length > 0);
|
|
29
|
-
// If locale prefix hidden
|
|
30
|
-
if (segments[0] !== locale) {
|
|
31
|
-
segments.unshift(value);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
segments[0] = value;
|
|
35
|
-
}
|
|
36
|
-
router.push(`/${segments.join('/')}`);
|
|
37
|
-
};
|
|
38
|
-
const onChangeRef = useRef(onChange);
|
|
39
|
-
onChangeRef.current = onChange;
|
|
40
|
-
return (_jsx(I18nContext, { value: useMemo(() => ({
|
|
41
|
-
locale,
|
|
42
|
-
locales,
|
|
43
|
-
text: {
|
|
44
|
-
...defaultTranslations,
|
|
45
|
-
...translations,
|
|
46
|
-
},
|
|
47
|
-
onChange: (v) => onChangeRef.current(v),
|
|
48
|
-
}), [locale, locales, translations]), children: children }));
|
|
49
|
-
}
|