@fumadocs/base-ui 16.8.11 → 16.9.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/css/generated/docs.css +0 -2
- package/css/generated/flux.css +0 -2
- package/css/generated/home.css +0 -8
- package/css/generated/notebook.css +0 -2
- package/css/generated/shared.css +59 -4
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +4 -2
- package/dist/components/banner.d.ts +1 -1
- package/dist/components/banner.js +6 -4
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/codeblock.d.ts +1 -1
- package/dist/components/codeblock.js +4 -2
- package/dist/components/dialog/search-algolia.d.ts +1 -1
- package/dist/components/dialog/search-algolia.js +1 -1
- package/dist/components/dialog/search-default.d.ts +1 -1
- package/dist/components/dialog/search-default.js +1 -1
- package/dist/components/dialog/search-orama.d.ts +1 -1
- package/dist/components/dialog/search-orama.js +1 -1
- package/dist/components/dialog/search.d.ts +1 -1
- package/dist/components/dialog/search.js +13 -12
- package/dist/components/dynamic-codeblock.core.js +1 -1
- package/dist/components/files.js +1 -1
- package/dist/components/github-info.d.ts +7 -3
- package/dist/components/github-info.js +8 -6
- package/dist/components/heading.d.ts +1 -1
- package/dist/components/heading.js +3 -1
- package/dist/components/image-zoom.d.ts +1 -1
- package/dist/components/inline-toc.d.ts +1 -1
- package/dist/components/inline-toc.js +3 -1
- package/dist/components/sidebar/base.d.ts +2 -2
- package/dist/components/sidebar/base.js +5 -4
- package/dist/components/sidebar/link-item.d.ts +1 -1
- package/dist/components/sidebar/page-tree.d.ts +1 -1
- package/dist/components/sidebar/page-tree.js +2 -2
- package/dist/components/sidebar/tabs/dropdown.d.ts +1 -1
- package/dist/components/sidebar/tabs/dropdown.js +4 -4
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/toc/clerk.d.ts +1 -1
- package/dist/components/toc/clerk.js +3 -4
- package/dist/components/toc/default.d.ts +1 -1
- package/dist/components/toc/default.js +3 -4
- package/dist/components/toc/index.d.ts +1 -1
- package/dist/components/toc/index.js +1 -1
- package/dist/components/type-table.d.ts +1 -1
- package/dist/components/type-table.js +16 -13
- package/dist/components/ui/accordion.d.ts +1 -1
- package/dist/components/ui/collapsible.d.ts +1 -1
- package/dist/components/ui/navigation-menu.d.ts +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/scroll-area.d.ts +1 -1
- package/dist/components/ui/scroll-area.js +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/contexts/i18n.d.ts +14 -22
- package/dist/contexts/i18n.js +12 -19
- package/dist/contexts/search.d.ts +1 -1
- package/dist/contexts/search.js +1 -1
- package/dist/contexts/tree.d.ts +1 -1
- package/dist/contexts/tree.js +1 -1
- package/dist/i18n.d.ts +55 -6
- package/dist/i18n.js +68 -2
- package/dist/layouts/docs/client.d.ts +1 -0
- package/dist/layouts/docs/client.js +2 -2
- package/dist/layouts/docs/index.d.ts +1 -1
- package/dist/layouts/docs/index.js +1 -1
- package/dist/layouts/docs/page/index.d.ts +1 -1
- package/dist/layouts/docs/page/index.js +6 -6
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +1 -1
- package/dist/layouts/docs/page/slots/breadcrumb.js +3 -3
- package/dist/layouts/docs/page/slots/container.d.ts +1 -1
- package/dist/layouts/docs/page/slots/footer.d.ts +1 -1
- package/dist/layouts/docs/page/slots/footer.js +7 -7
- package/dist/layouts/docs/page/slots/toc.d.ts +1 -1
- package/dist/layouts/docs/page/slots/toc.js +4 -4
- package/dist/layouts/docs/slots/container.d.ts +1 -1
- package/dist/layouts/docs/slots/container.js +1 -1
- package/dist/layouts/docs/slots/header.d.ts +1 -1
- package/dist/layouts/docs/slots/sidebar.d.ts +1 -1
- package/dist/layouts/docs/slots/sidebar.js +7 -7
- package/dist/layouts/flux/index.d.ts +1 -1
- package/dist/layouts/flux/index.js +5 -5
- package/dist/layouts/flux/page/index.d.ts +1 -1
- package/dist/layouts/flux/page/index.js +6 -6
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +1 -1
- package/dist/layouts/flux/page/slots/breadcrumb.js +3 -3
- package/dist/layouts/flux/page/slots/container.d.ts +1 -1
- package/dist/layouts/flux/page/slots/footer.d.ts +1 -1
- package/dist/layouts/flux/page/slots/footer.js +5 -5
- package/dist/layouts/flux/page/slots/toc.d.ts +1 -1
- package/dist/layouts/flux/page/slots/toc.js +4 -4
- package/dist/layouts/flux/slots/container.d.ts +1 -1
- package/dist/layouts/flux/slots/sidebar.d.ts +1 -1
- package/dist/layouts/flux/slots/sidebar.js +1 -1
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +1 -1
- package/dist/layouts/flux/slots/tab-dropdown.js +4 -4
- package/dist/layouts/home/index.d.ts +1 -1
- package/dist/layouts/home/index.js +1 -1
- package/dist/layouts/home/navbar.d.ts +1 -1
- package/dist/layouts/home/navbar.js +1 -1
- package/dist/layouts/home/not-found.js +5 -4
- package/dist/layouts/home/slots/container.d.ts +1 -1
- package/dist/layouts/home/slots/header.d.ts +1 -1
- package/dist/layouts/home/slots/header.js +8 -6
- package/dist/layouts/notebook/client.d.ts +1 -0
- package/dist/layouts/notebook/client.js +1 -1
- package/dist/layouts/notebook/index.d.ts +1 -1
- package/dist/layouts/notebook/index.js +1 -1
- package/dist/layouts/notebook/page/index.d.ts +1 -1
- package/dist/layouts/notebook/page/index.js +6 -6
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +1 -1
- package/dist/layouts/notebook/page/slots/breadcrumb.js +3 -3
- package/dist/layouts/notebook/page/slots/container.d.ts +1 -1
- package/dist/layouts/notebook/page/slots/footer.d.ts +1 -1
- package/dist/layouts/notebook/page/slots/footer.js +7 -7
- package/dist/layouts/notebook/page/slots/toc.d.ts +1 -1
- package/dist/layouts/notebook/page/slots/toc.js +4 -4
- package/dist/layouts/notebook/slots/container.d.ts +1 -1
- package/dist/layouts/notebook/slots/container.js +1 -1
- package/dist/layouts/notebook/slots/header.d.ts +1 -1
- package/dist/layouts/notebook/slots/header.js +3 -3
- package/dist/layouts/notebook/slots/sidebar.d.ts +1 -1
- package/dist/layouts/notebook/slots/sidebar.js +9 -9
- package/dist/layouts/shared/client.d.ts +1 -1
- package/dist/layouts/shared/client.js +1 -1
- package/dist/layouts/shared/index.d.ts +1 -1
- package/dist/layouts/shared/index.js +1 -1
- package/dist/layouts/shared/page-actions.d.ts +1 -1
- package/dist/layouts/shared/page-actions.js +17 -11
- package/dist/layouts/shared/slots/language-select.d.ts +1 -1
- package/dist/layouts/shared/slots/language-select.js +1 -1
- package/dist/layouts/shared/slots/search-trigger.d.ts +1 -1
- package/dist/layouts/shared/slots/search-trigger.js +5 -4
- package/dist/layouts/shared/slots/theme-switch.d.ts +1 -1
- package/dist/layouts/shared/slots/theme-switch.js +21 -7
- package/dist/mdx.d.ts +1 -1
- package/dist/mdx.js +1 -1
- package/dist/og/takumi.d.ts +1 -1
- package/dist/og.d.ts +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/provider/base.d.ts +1 -1
- package/dist/provider/base.js +1 -1
- package/dist/provider/next.d.ts +1 -1
- package/dist/provider/react-router.d.ts +1 -1
- package/dist/provider/tanstack.d.ts +1 -1
- package/dist/provider/waku.d.ts +1 -1
- package/dist/style.css +11 -9
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import "react";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import "react";
|
|
5
5
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
6
6
|
//#region src/components/ui/popover.tsx
|
|
7
7
|
const Popover = Popover$1.Root;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
|
-
import "react";
|
|
3
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
4
|
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
5
5
|
//#region src/components/ui/scroll-area.tsx
|
|
6
6
|
function ScrollArea({ children, ...props }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
1
2
|
import * as _$react from "react";
|
|
2
3
|
import { ComponentProps } from "react";
|
|
3
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
5
5
|
import * as _$_base_ui_react0 from "@base-ui/react";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
3
|
-
import { createContext, use, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
6
6
|
//#region src/components/ui/tabs.tsx
|
|
7
7
|
const listeners = /* @__PURE__ */ new Map();
|
package/dist/contexts/i18n.d.ts
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Translations } from "../i18n.js";
|
|
2
2
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { TranslationObject, TranslationValue } from "fumadocs-core/i18n";
|
|
3
5
|
|
|
4
6
|
//#region src/contexts/i18n.d.ts
|
|
5
|
-
interface Translations {
|
|
6
|
-
search: string;
|
|
7
|
-
searchNoResult: string;
|
|
8
|
-
toc: string;
|
|
9
|
-
tocNoHeadings: string;
|
|
10
|
-
lastUpdate: string;
|
|
11
|
-
chooseLanguage: string;
|
|
12
|
-
nextPage: string;
|
|
13
|
-
previousPage: string;
|
|
14
|
-
chooseTheme: string;
|
|
15
|
-
editOnGithub: string;
|
|
16
|
-
}
|
|
17
|
-
type TranslationsOption = {
|
|
18
|
-
[key: string]: string | TranslationsOption;
|
|
19
|
-
};
|
|
20
7
|
interface LocaleItem {
|
|
21
8
|
name: string;
|
|
22
9
|
locale: string;
|
|
23
10
|
}
|
|
24
11
|
interface I18nContextType {
|
|
25
|
-
text: Translations &
|
|
12
|
+
text: Translations & Record<string, string | Record<string, string>>;
|
|
26
13
|
locale?: string;
|
|
27
14
|
onChange?: (v: string) => void;
|
|
28
15
|
locales?: LocaleItem[];
|
|
29
16
|
}
|
|
30
|
-
declare
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
declare function I18nLabel<K extends keyof Translations = keyof Translations>({
|
|
18
|
+
label,
|
|
19
|
+
params
|
|
20
|
+
}: {
|
|
21
|
+
label: K;
|
|
22
|
+
params?: Translations[K] extends TranslationValue<infer Params> ? Record<Params, string> : never;
|
|
33
23
|
}): string;
|
|
34
24
|
declare function useI18n(): I18nContextType;
|
|
25
|
+
declare function useTranslations(): Translations;
|
|
26
|
+
declare function useTranslations<Obj extends TranslationObject>(namespace: string): Obj | undefined;
|
|
35
27
|
interface I18nProviderProps {
|
|
36
28
|
/**
|
|
37
29
|
* Current locale
|
|
@@ -44,7 +36,7 @@ interface I18nProviderProps {
|
|
|
44
36
|
/**
|
|
45
37
|
* Translations of current locale
|
|
46
38
|
*/
|
|
47
|
-
translations?:
|
|
39
|
+
translations?: Partial<I18nContextType['text']>;
|
|
48
40
|
/**
|
|
49
41
|
* Available languages
|
|
50
42
|
*/
|
|
@@ -59,4 +51,4 @@ declare function I18nProvider({
|
|
|
59
51
|
translations
|
|
60
52
|
}: I18nProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
61
53
|
//#endregion
|
|
62
|
-
export { I18nLabel, I18nProvider, I18nProviderProps,
|
|
54
|
+
export { I18nLabel, I18nProvider, I18nProviderProps, useI18n, useTranslations };
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { defaultTranslations } from "../i18n.js";
|
|
3
3
|
import { usePathname, useRouter } from "fumadocs-core/framework";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { createContext, use, useMemo, useRef } from "react";
|
|
6
|
+
import { renderTranslation } from "fumadocs-core/i18n";
|
|
5
7
|
//#region src/contexts/i18n.tsx
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
toc: "On this page",
|
|
10
|
-
tocNoHeadings: "No Headings",
|
|
11
|
-
lastUpdate: "Last updated on",
|
|
12
|
-
chooseLanguage: "Choose a language",
|
|
13
|
-
nextPage: "Next Page",
|
|
14
|
-
previousPage: "Previous Page",
|
|
15
|
-
chooseTheme: "Theme",
|
|
16
|
-
editOnGithub: "Edit on GitHub"
|
|
17
|
-
};
|
|
18
|
-
const I18nContext = createContext({ text: { ...defaultTranslations } });
|
|
19
|
-
function I18nLabel(props) {
|
|
20
|
-
return useI18n().text[props.label];
|
|
8
|
+
const I18nContext = createContext({ text: defaultTranslations });
|
|
9
|
+
function I18nLabel({ label, params }) {
|
|
10
|
+
return renderTranslation(useTranslations()[label], params);
|
|
21
11
|
}
|
|
22
12
|
function useI18n() {
|
|
23
|
-
return
|
|
13
|
+
return use(I18nContext);
|
|
14
|
+
}
|
|
15
|
+
function useTranslations(namespace) {
|
|
16
|
+
return namespace ? use(I18nContext).text[namespace] : use(I18nContext).text;
|
|
24
17
|
}
|
|
25
18
|
function I18nProvider({ locales = [], locale, onLocaleChange, children, translations }) {
|
|
26
19
|
const router = useRouter();
|
|
@@ -28,7 +21,7 @@ function I18nProvider({ locales = [], locale, onLocaleChange, children, translat
|
|
|
28
21
|
const onChange = (value) => {
|
|
29
22
|
if (onLocaleChange) return onLocaleChange(value);
|
|
30
23
|
const segments = pathname.split("/").filter((v) => v.length > 0);
|
|
31
|
-
if (segments[0] !== locale) segments.unshift(value);
|
|
24
|
+
if (segments.length === 0 || segments[0] !== locale) segments.unshift(value);
|
|
32
25
|
else segments[0] = value;
|
|
33
26
|
router.push(`/${segments.join("/")}`);
|
|
34
27
|
};
|
|
@@ -52,4 +45,4 @@ function I18nProvider({ locales = [], locale, onLocaleChange, children, translat
|
|
|
52
45
|
});
|
|
53
46
|
}
|
|
54
47
|
//#endregion
|
|
55
|
-
export { I18nLabel, I18nProvider,
|
|
48
|
+
export { I18nLabel, I18nProvider, useI18n, useTranslations };
|
package/dist/contexts/search.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Suspense, createContext, use, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
3
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Suspense, createContext, use, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
4
4
|
//#region src/contexts/search.tsx
|
|
5
5
|
const SearchContext = createContext({
|
|
6
6
|
enabled: false,
|
package/dist/contexts/tree.d.ts
CHANGED
package/dist/contexts/tree.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, use, useMemo, useRef } from "react";
|
|
3
2
|
import { usePathname } from "fumadocs-core/framework";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use, useMemo, useRef } from "react";
|
|
5
5
|
import { searchPath } from "fumadocs-core/breadcrumb";
|
|
6
6
|
//#region src/contexts/tree.tsx
|
|
7
7
|
const TreeContext = createContext(null);
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,16 +1,65 @@
|
|
|
1
|
-
import { I18nProviderProps
|
|
2
|
-
import { I18nConfig } from "fumadocs-core/i18n";
|
|
1
|
+
import { I18nProviderProps } from "./contexts/i18n.js";
|
|
2
|
+
import { I18nConfig, TranslationValue, TranslationsAPI, TranslationsAPIExtension } from "fumadocs-core/i18n";
|
|
3
3
|
|
|
4
4
|
//#region src/i18n.d.ts
|
|
5
|
+
type Translations = {
|
|
6
|
+
displayName: string;
|
|
7
|
+
search: string;
|
|
8
|
+
searchNoResult: string;
|
|
9
|
+
searchOpen: string;
|
|
10
|
+
searchClose: string;
|
|
11
|
+
toc: string;
|
|
12
|
+
tocNoHeadings: string;
|
|
13
|
+
tocInline: string;
|
|
14
|
+
lastUpdate: string;
|
|
15
|
+
chooseLanguage: string;
|
|
16
|
+
nextPage: string;
|
|
17
|
+
previousPage: string;
|
|
18
|
+
chooseTheme: string;
|
|
19
|
+
editOnGithub: string;
|
|
20
|
+
themeToggle: string;
|
|
21
|
+
themeLight: string;
|
|
22
|
+
themeDark: string;
|
|
23
|
+
themeSystem: string;
|
|
24
|
+
codeBlockCopy: string;
|
|
25
|
+
codeBlockCopied: string;
|
|
26
|
+
accordionCopyAnchor: string;
|
|
27
|
+
headingCopyAnchor: string;
|
|
28
|
+
bannerClose: string;
|
|
29
|
+
menuToggle: string;
|
|
30
|
+
pageActionsCopyMarkdown: string;
|
|
31
|
+
pageActionsOpen: string;
|
|
32
|
+
pageActionsOpenGitHub: string;
|
|
33
|
+
pageActionsViewMarkdown: string;
|
|
34
|
+
pageActionsOpenScira: string;
|
|
35
|
+
pageActionsOpenChatGPT: string;
|
|
36
|
+
pageActionsOpenClaude: string;
|
|
37
|
+
pageActionsOpenCursor: string;
|
|
38
|
+
pageActionsOpenInLLMPrompt: TranslationValue<'url'>;
|
|
39
|
+
sidebarOpen: string;
|
|
40
|
+
sidebarCollapse: string;
|
|
41
|
+
typeTableProp: string;
|
|
42
|
+
typeTableType: string;
|
|
43
|
+
typeTableDefault: string;
|
|
44
|
+
typeTableParameters: string;
|
|
45
|
+
typeTableReturns: string;
|
|
46
|
+
notFoundTitle: string;
|
|
47
|
+
notFoundDescription: string;
|
|
48
|
+
notFoundLink: string;
|
|
49
|
+
};
|
|
50
|
+
declare const defaultTranslations: Translations;
|
|
51
|
+
type TranslationsConfig<Languages extends string> = { [K in Languages]?: Partial<Translations> };
|
|
52
|
+
declare function uiTranslations(): TranslationsAPIExtension<'ui', Translations>;
|
|
53
|
+
declare function i18nProvider<Languages extends string, P extends {
|
|
54
|
+
ui: Translations;
|
|
55
|
+
}>(translations: TranslationsAPI<Languages, P>, lang?: NoInfer<Languages> | (string & {})): I18nProviderProps;
|
|
5
56
|
interface I18nUIConfig<Languages extends string> extends I18nConfig<Languages> {
|
|
6
57
|
/**
|
|
7
58
|
* get i18n config for Fumadocs UI `<RootProvider i18n={config} />`.
|
|
8
59
|
*/
|
|
9
60
|
provider: (locale?: Languages | (string & {})) => I18nProviderProps;
|
|
10
61
|
}
|
|
11
|
-
|
|
12
|
-
displayName?: string;
|
|
13
|
-
} };
|
|
62
|
+
/** @deprecated use the `i18n.translations()` & `uiTranslations()` APIs instead */
|
|
14
63
|
declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, options?: {
|
|
15
64
|
/**
|
|
16
65
|
* @deprecated you can directly define the translations in outer scope (the parent object of `translations`)
|
|
@@ -18,4 +67,4 @@ declare function defineI18nUI<Languages extends string>(config: I18nConfig<Langu
|
|
|
18
67
|
translations: TranslationsConfig<Languages>;
|
|
19
68
|
} | TranslationsConfig<Languages>): I18nUIConfig<Languages>;
|
|
20
69
|
//#endregion
|
|
21
|
-
export {
|
|
70
|
+
export { I18nUIConfig, Translations, defaultTranslations, defineI18nUI, i18nProvider, uiTranslations };
|
package/dist/i18n.js
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
|
-
import { defaultTranslations } from "./contexts/i18n.js";
|
|
2
1
|
//#region src/i18n.tsx
|
|
2
|
+
const defaultTranslations = {
|
|
3
|
+
displayName: "English",
|
|
4
|
+
search: "Search",
|
|
5
|
+
searchNoResult: "No results found",
|
|
6
|
+
toc: "On this page",
|
|
7
|
+
tocNoHeadings: "No Headings",
|
|
8
|
+
lastUpdate: "Last updated on",
|
|
9
|
+
chooseLanguage: "Choose a language",
|
|
10
|
+
nextPage: "Next Page",
|
|
11
|
+
previousPage: "Previous Page",
|
|
12
|
+
chooseTheme: "Theme",
|
|
13
|
+
editOnGithub: "Edit on GitHub",
|
|
14
|
+
themeLight: "Light",
|
|
15
|
+
themeDark: "Dark",
|
|
16
|
+
themeSystem: "System",
|
|
17
|
+
codeBlockCopy: "Copy Text",
|
|
18
|
+
codeBlockCopied: "Copied Text",
|
|
19
|
+
accordionCopyAnchor: "Copy Link",
|
|
20
|
+
headingCopyAnchor: "Copy Anchor Link",
|
|
21
|
+
pageActionsCopyMarkdown: "Copy Markdown",
|
|
22
|
+
pageActionsOpen: "Open",
|
|
23
|
+
pageActionsOpenGitHub: "Open in GitHub",
|
|
24
|
+
pageActionsViewMarkdown: "View as Markdown",
|
|
25
|
+
pageActionsOpenScira: "Open in Scira AI",
|
|
26
|
+
pageActionsOpenChatGPT: "Open in ChatGPT",
|
|
27
|
+
pageActionsOpenClaude: "Open in Claude",
|
|
28
|
+
pageActionsOpenCursor: "Open in Cursor",
|
|
29
|
+
pageActionsOpenInLLMPrompt: "Read {url}, I want to ask questions about it.",
|
|
30
|
+
bannerClose: "Close Banner",
|
|
31
|
+
searchOpen: "Open Search",
|
|
32
|
+
searchClose: "Close Search",
|
|
33
|
+
menuToggle: "Toggle Menu",
|
|
34
|
+
themeToggle: "Toggle Theme",
|
|
35
|
+
sidebarOpen: "Open Sidebar",
|
|
36
|
+
sidebarCollapse: "Collapse Sidebar",
|
|
37
|
+
tocInline: "Table of Contents",
|
|
38
|
+
typeTableProp: "Prop",
|
|
39
|
+
typeTableType: "Type",
|
|
40
|
+
typeTableDefault: "Default",
|
|
41
|
+
typeTableParameters: "Parameters",
|
|
42
|
+
typeTableReturns: "Returns",
|
|
43
|
+
notFoundTitle: "Page Not Found",
|
|
44
|
+
notFoundDescription: "The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.",
|
|
45
|
+
notFoundLink: "Back to Home"
|
|
46
|
+
};
|
|
47
|
+
function uiTranslations() {
|
|
48
|
+
return {
|
|
49
|
+
namespace: "ui",
|
|
50
|
+
defaultValue: defaultTranslations
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function i18nProvider(translations, lang) {
|
|
54
|
+
const { defaultLanguage, languages } = translations.config;
|
|
55
|
+
const { ui, ...rest } = translations.get(lang ?? defaultLanguage) ?? translations.get(defaultLanguage);
|
|
56
|
+
return {
|
|
57
|
+
locale: lang,
|
|
58
|
+
translations: {
|
|
59
|
+
...ui,
|
|
60
|
+
...rest
|
|
61
|
+
},
|
|
62
|
+
locales: languages.map((locale) => ({
|
|
63
|
+
locale,
|
|
64
|
+
name: translations.get(locale).ui.displayName ?? locale
|
|
65
|
+
}))
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** @deprecated use the `i18n.translations()` & `uiTranslations()` APIs instead */
|
|
3
69
|
function defineI18nUI(config, options = {}) {
|
|
4
70
|
const translations = "translations" in options ? options.translations : options;
|
|
5
71
|
return {
|
|
@@ -17,4 +83,4 @@ function defineI18nUI(config, options = {}) {
|
|
|
17
83
|
};
|
|
18
84
|
}
|
|
19
85
|
//#endregion
|
|
20
|
-
export { defaultTranslations, defineI18nUI };
|
|
86
|
+
export { defaultTranslations, defineI18nUI, i18nProvider, uiTranslations };
|
|
@@ -3,6 +3,7 @@ import { LayoutTab, LinkItemType } from "../shared/index.js";
|
|
|
3
3
|
import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
|
|
4
4
|
import { DocsLayoutProps } from "./index.js";
|
|
5
5
|
import { ComponentProps, FC } from "react";
|
|
6
|
+
|
|
6
7
|
//#region src/layouts/docs/client.d.ts
|
|
7
8
|
interface DocsSlots extends BaseSlots {
|
|
8
9
|
container: FC<ComponentProps<'div'>>;
|
|
@@ -7,10 +7,10 @@ import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
|
|
|
7
7
|
import { Sidebar, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
|
|
8
8
|
import { Header } from "./slots/header.js";
|
|
9
9
|
import { Container } from "./slots/container.js";
|
|
10
|
-
import
|
|
10
|
+
import Link from "fumadocs-core/link";
|
|
11
11
|
import { usePathname } from "fumadocs-core/framework";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
13
|
+
import { createContext, use, useMemo } from "react";
|
|
14
14
|
//#region src/layouts/docs/client.tsx
|
|
15
15
|
const { useProvider } = baseSlots({ useProps() {
|
|
16
16
|
return useDocsLayout().props;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab } from "../shared/index.js";
|
|
2
2
|
import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
|
|
3
3
|
import { DocsSlots, useDocsLayout } from "./client.js";
|
|
4
|
-
import { HTMLAttributes, ReactNode } from "react";
|
|
5
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
6
6
|
import * as PageTree from "fumadocs-core/page-tree";
|
|
7
7
|
|
|
8
8
|
//#region src/layouts/docs/index.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLayoutTabs } from "../shared/index.js";
|
|
2
2
|
import { LayoutBody, useDocsLayout } from "./client.js";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
5
|
//#region src/layouts/docs/index.tsx
|
|
6
6
|
function DocsLayout({ tree, sidebar: { tabs: _tabs, tabMode: _tabMode, ...sidebarProps } = {}, tabs: layoutTabs = _tabs, tabMode = _tabMode, children, ...props }) {
|
|
7
7
|
return /* @__PURE__ */ jsx(LayoutBody, {
|
|
@@ -2,8 +2,8 @@ import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
|
2
2
|
import { Footer, FooterProps } from "./slots/footer.js";
|
|
3
3
|
import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
4
4
|
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
5
|
-
import { ComponentProps, FC, ReactNode } from "react";
|
|
6
5
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
7
7
|
import { TOCItemType } from "fumadocs-core/toc";
|
|
8
8
|
|
|
9
9
|
//#region src/layouts/docs/page/index.d.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { I18nLabel, useI18n } from "../../../contexts/i18n.js";
|
|
4
3
|
import { cn } from "../../../utils/cn.js";
|
|
5
4
|
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
+
import { I18nLabel, useTranslations } from "../../../contexts/i18n.js";
|
|
6
6
|
import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
7
7
|
import { Footer } from "./slots/footer.js";
|
|
8
8
|
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
9
9
|
import { Container } from "./slots/container.js";
|
|
10
10
|
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
11
|
-
import {
|
|
12
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { Edit } from "lucide-react";
|
|
13
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
14
14
|
//#region src/layouts/docs/page/index.tsx
|
|
15
15
|
var page_exports = /* @__PURE__ */ __exportAll({
|
|
16
16
|
DocsBody: () => DocsBody,
|
|
@@ -76,7 +76,7 @@ function EditOnGitHub(props) {
|
|
|
76
76
|
color: "secondary",
|
|
77
77
|
size: "sm"
|
|
78
78
|
}), "gap-1.5 not-prose", props.className),
|
|
79
|
-
children: props.children ?? /* @__PURE__ */ jsxs(Fragment
|
|
79
|
+
children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), /* @__PURE__ */ jsx(I18nLabel, { label: "editOnGithub" })] })
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -105,7 +105,7 @@ function DocsTitle({ children, className, ...props }) {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
function PageLastUpdate({ date: value, ...props }) {
|
|
108
|
-
const
|
|
108
|
+
const t = useTranslations();
|
|
109
109
|
const [date, setDate] = useState("");
|
|
110
110
|
useEffect(() => {
|
|
111
111
|
setDate(value.toLocaleDateString());
|
|
@@ -114,7 +114,7 @@ function PageLastUpdate({ date: value, ...props }) {
|
|
|
114
114
|
...props,
|
|
115
115
|
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
116
116
|
children: [
|
|
117
|
-
|
|
117
|
+
t.lastUpdate,
|
|
118
118
|
" ",
|
|
119
119
|
date
|
|
120
120
|
]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../../../utils/cn.js";
|
|
3
3
|
import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
|
|
4
|
-
import { Fragment, useMemo } from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
4
|
import Link from "fumadocs-core/link";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { ChevronRight } from "lucide-react";
|
|
7
|
+
import { Fragment as Fragment$1, useMemo } from "react";
|
|
8
8
|
import { getBreadcrumbItemsFromPath } from "fumadocs-core/breadcrumb";
|
|
9
9
|
//#region src/layouts/docs/page/slots/breadcrumb.tsx
|
|
10
10
|
function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
@@ -29,7 +29,7 @@ function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
|
29
29
|
className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
|
|
30
30
|
children: items.map((item, i) => {
|
|
31
31
|
const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
|
|
32
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
33
33
|
href: item.url,
|
|
34
34
|
className: cn(className, "transition-opacity hover:opacity-80"),
|
|
35
35
|
children: item.name
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
1
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/layouts/docs/page/slots/container.d.ts
|
|
5
5
|
declare function Container(props: ComponentProps<'article'>): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useI18n } from "../../../../contexts/i18n.js";
|
|
3
2
|
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useTranslations } from "../../../../contexts/i18n.js";
|
|
4
4
|
import { isActive } from "../../../../utils/urls.js";
|
|
5
5
|
import { useFooterItems } from "../../../../utils/use-footer-items.js";
|
|
6
|
-
import { useMemo } from "react";
|
|
7
|
-
import { usePathname } from "fumadocs-core/framework";
|
|
8
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
6
|
import Link from "fumadocs-core/link";
|
|
7
|
+
import { usePathname } from "fumadocs-core/framework";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
10
|
+
import { useMemo } from "react";
|
|
11
11
|
//#region src/layouts/docs/page/slots/footer.tsx
|
|
12
12
|
function Footer({ items, children, className, ...props }) {
|
|
13
13
|
const footerList = useFooterItems();
|
|
@@ -25,7 +25,7 @@ function Footer({ items, children, className, ...props }) {
|
|
|
25
25
|
items,
|
|
26
26
|
pathname
|
|
27
27
|
]);
|
|
28
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
29
29
|
className: cn("@container grid gap-4", previous && next ? "grid-cols-2" : "grid-cols-1", className),
|
|
30
30
|
...props,
|
|
31
31
|
children: [previous && /* @__PURE__ */ jsx(FooterItem, {
|
|
@@ -38,7 +38,7 @@ function Footer({ items, children, className, ...props }) {
|
|
|
38
38
|
}), children] });
|
|
39
39
|
}
|
|
40
40
|
function FooterItem({ item, index }) {
|
|
41
|
-
const
|
|
41
|
+
const t = useTranslations();
|
|
42
42
|
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
43
43
|
return /* @__PURE__ */ jsxs(Link, {
|
|
44
44
|
href: item.url,
|
|
@@ -48,7 +48,7 @@ function FooterItem({ item, index }) {
|
|
|
48
48
|
children: [/* @__PURE__ */ jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), /* @__PURE__ */ jsx("p", { children: item.name })]
|
|
49
49
|
}), /* @__PURE__ */ jsx("p", {
|
|
50
50
|
className: "text-fd-muted-foreground truncate",
|
|
51
|
-
children: item.description ?? (index === 0 ?
|
|
51
|
+
children: item.description ?? (index === 0 ? t.previousPage : t.nextPage)
|
|
52
52
|
})]
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TOCItemsProps } from "../../../../components/toc/clerk.js";
|
|
2
2
|
import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
|
|
3
3
|
import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
|
|
4
|
-
import { ComponentProps, ReactNode } from "react";
|
|
5
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/layouts/docs/page/slots/toc.d.ts
|
|
8
8
|
type TOCProviderProps = TOCProviderProps$1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { I18nLabel, useI18n } from "../../../../contexts/i18n.js";
|
|
3
2
|
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { I18nLabel, useTranslations } from "../../../../contexts/i18n.js";
|
|
4
4
|
import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
|
|
5
5
|
import { default_exports } from "../../../../components/toc/default.js";
|
|
6
6
|
import { clerk_exports } from "../../../../components/toc/clerk.js";
|
|
@@ -8,9 +8,9 @@ import { useTreePath } from "../../../../contexts/tree.js";
|
|
|
8
8
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
|
|
9
9
|
import { useDocsLayout } from "../../client.js";
|
|
10
10
|
import "../../index.js";
|
|
11
|
-
import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
12
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { ChevronDown, Text } from "lucide-react";
|
|
13
|
+
import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
14
14
|
//#region src/layouts/docs/page/slots/toc.tsx
|
|
15
15
|
function TOCProvider(props) {
|
|
16
16
|
return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
|
|
@@ -90,7 +90,7 @@ function TOCPopover({ container, trigger, content, header, footer, style = "norm
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
function PageTOCPopoverTrigger({ className, ...props }) {
|
|
93
|
-
const
|
|
93
|
+
const t = useTranslations();
|
|
94
94
|
const { open } = use(TocPopoverContext);
|
|
95
95
|
const items = useItems();
|
|
96
96
|
const selectedIdx = items.findIndex((item) => item.active);
|
|
@@ -110,7 +110,7 @@ function PageTOCPopoverTrigger({ className, ...props }) {
|
|
|
110
110
|
className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
|
|
111
111
|
children: [/* @__PURE__ */ jsx("span", {
|
|
112
112
|
className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
|
|
113
|
-
children: path?.name ??
|
|
113
|
+
children: path?.name ?? t.toc
|
|
114
114
|
}), /* @__PURE__ */ jsx("span", {
|
|
115
115
|
className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
|
|
116
116
|
children: items[selectedIdx]?.original.title
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
1
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/layouts/docs/slots/container.d.ts
|
|
5
5
|
declare function Container(props: ComponentProps<'div'>): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { cn } from "../../../utils/cn.js";
|
|
3
3
|
import { useDocsLayout } from "../client.js";
|
|
4
4
|
import "../index.js";
|
|
5
|
-
import { useEffect, useState } from "react";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
7
|
//#region src/layouts/docs/slots/container.tsx
|
|
8
8
|
function Container(props) {
|
|
9
9
|
const { slots } = useDocsLayout();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
1
2
|
import * as _$react from "react";
|
|
2
3
|
import { ComponentProps } from "react";
|
|
3
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/layouts/docs/slots/header.d.ts
|
|
6
6
|
declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | _$react_jsx_runtime0.JSX.Element | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SidebarProviderProps as SidebarProviderProps$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
|
|
2
2
|
import { SidebarPageTreeComponents } from "../../../components/sidebar/page-tree.js";
|
|
3
|
-
import { ComponentProps, ReactNode } from "react";
|
|
4
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/layouts/docs/slots/sidebar.d.ts
|
|
7
7
|
interface SidebarProps extends ComponentProps<'aside'> {
|