fumadocs-ui 14.2.0 → 14.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/dist/components/accordion.d.ts +4 -7
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +32 -104
- package/dist/components/api.d.ts +4 -13
- package/dist/components/api.d.ts.map +1 -0
- package/dist/components/api.js +3 -16
- package/dist/components/banner.d.ts +3 -5
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +53 -120
- package/dist/components/callout.d.ts +4 -7
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +13 -9
- package/dist/components/card.d.ts +5 -7
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +10 -10
- package/dist/components/codeblock.d.ts +6 -9
- package/dist/components/codeblock.d.ts.map +1 -0
- package/dist/components/codeblock.js +41 -15
- package/dist/components/dialog/search-algolia.d.ts +7 -11
- package/dist/components/dialog/search-algolia.d.ts.map +1 -0
- package/dist/components/dialog/search-algolia.js +19 -79
- package/dist/components/dialog/search-default.d.ts +6 -10
- package/dist/components/dialog/search-default.d.ts.map +1 -0
- package/dist/components/dialog/search-default.js +24 -73
- package/dist/components/dialog/search-orama.d.ts +7 -11
- package/dist/components/dialog/search-orama.d.ts.map +1 -0
- package/dist/components/dialog/search-orama.js +22 -79
- package/dist/components/dialog/search.d.ts +7 -9
- package/dist/components/dialog/search.d.ts.map +1 -0
- package/dist/components/dialog/search.js +98 -13
- package/dist/components/dialog/tag-list.d.ts +13 -0
- package/dist/components/dialog/tag-list.d.ts.map +1 -0
- package/dist/components/dialog/tag-list.js +20 -0
- package/dist/components/files.d.ts +7 -9
- package/dist/components/files.d.ts.map +1 -0
- package/dist/components/files.js +15 -63
- package/dist/components/heading.d.ts +4 -5
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +9 -9
- package/dist/components/image-zoom.d.ts +7 -8
- package/dist/components/image-zoom.d.ts.map +1 -0
- package/dist/components/image-zoom.js +16 -40
- package/dist/components/inline-toc.d.ts +4 -6
- package/dist/components/inline-toc.d.ts.map +1 -0
- package/dist/components/inline-toc.js +8 -46
- package/dist/components/layout/breadcrumb.d.ts +11 -0
- package/dist/components/layout/breadcrumb.d.ts.map +1 -0
- package/dist/components/layout/breadcrumb.js +20 -0
- package/dist/components/layout/language-toggle.d.ts +5 -7
- package/dist/components/layout/language-toggle.d.ts.map +1 -0
- package/dist/components/layout/language-toggle.js +24 -14
- package/dist/components/layout/nav.d.ts +28 -0
- package/dist/components/layout/nav.d.ts.map +1 -0
- package/dist/components/layout/nav.js +29 -0
- package/dist/components/layout/root-toggle.d.ts +5 -7
- package/dist/components/layout/root-toggle.d.ts.map +1 -0
- package/dist/components/layout/root-toggle.js +28 -13
- package/dist/components/layout/search-toggle.d.ts +4 -0
- package/dist/components/layout/search-toggle.d.ts.map +1 -0
- package/dist/components/layout/search-toggle.js +24 -0
- package/dist/components/layout/theme-toggle.d.ts +3 -0
- package/dist/components/layout/theme-toggle.d.ts.map +1 -0
- package/dist/components/layout/theme-toggle.js +21 -0
- package/dist/components/layout/toc-clerk.d.ts +6 -0
- package/dist/components/layout/toc-clerk.d.ts.map +1 -0
- package/dist/components/layout/toc-clerk.js +76 -0
- package/dist/components/layout/toc-popover.d.ts +8 -0
- package/dist/components/layout/toc-popover.d.ts.map +1 -0
- package/dist/components/layout/toc-popover.js +20 -0
- package/dist/components/layout/toc-thumb.d.ts +6 -0
- package/dist/components/layout/toc-thumb.d.ts.map +1 -0
- package/dist/components/layout/toc-thumb.js +53 -0
- package/dist/components/layout/toc.d.ts +19 -0
- package/dist/components/layout/toc.d.ts.map +1 -0
- package/dist/components/layout/toc.js +25 -0
- package/dist/components/registry.d.ts +3 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +70 -0
- package/dist/components/steps.d.ts +4 -6
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +5 -16
- package/dist/components/tabs.d.ts +7 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +61 -171
- package/dist/components/type-table.d.ts +5 -6
- package/dist/components/type-table.d.ts.map +1 -0
- package/dist/components/type-table.js +18 -59
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +14 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +12 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +15 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +16 -0
- package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
- package/dist/contexts/i18n.d.ts.map +1 -0
- package/dist/contexts/i18n.js +23 -0
- package/dist/contexts/search.d.ts +50 -0
- package/dist/contexts/search.d.ts.map +1 -0
- package/dist/contexts/search.js +50 -0
- package/dist/contexts/sidebar.d.ts +18 -0
- package/dist/contexts/sidebar.d.ts.map +1 -0
- package/dist/contexts/sidebar.js +31 -0
- package/dist/contexts/tree.d.ts +13 -0
- package/dist/contexts/tree.d.ts.map +1 -0
- package/dist/contexts/tree.js +25 -0
- package/dist/i18n.d.ts +5 -6
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +31 -49
- package/dist/layouts/docs/navbar.d.ts +4 -0
- package/dist/layouts/docs/navbar.d.ts.map +1 -0
- package/dist/layouts/docs/navbar.js +22 -0
- package/dist/layouts/docs/sidebar.d.ts +40 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +146 -0
- package/dist/layouts/docs.client.d.ts +14 -25
- package/dist/layouts/docs.client.d.ts.map +1 -0
- package/dist/layouts/docs.client.js +53 -195
- package/dist/layouts/docs.d.ts +34 -19
- package/dist/layouts/docs.d.ts.map +1 -0
- package/dist/layouts/docs.js +67 -202
- package/dist/layouts/home/menu.d.ts +6 -0
- package/dist/layouts/home/menu.d.ts.map +1 -0
- package/dist/layouts/home/menu.js +33 -0
- package/dist/layouts/home/navbar.d.ts +16 -0
- package/dist/layouts/home/navbar.d.ts.map +1 -0
- package/dist/layouts/home/navbar.js +48 -0
- package/dist/layouts/home.d.ts +5 -7
- package/dist/layouts/home.d.ts.map +1 -0
- package/dist/layouts/home.js +51 -59
- package/dist/layouts/links.d.ts +80 -0
- package/dist/layouts/links.d.ts.map +1 -0
- package/dist/layouts/links.js +14 -0
- package/dist/layouts/shared.d.ts +48 -2
- package/dist/layouts/shared.d.ts.map +1 -0
- package/dist/layouts/shared.js +27 -9
- package/dist/mdx.client.d.ts +3 -6
- package/dist/mdx.client.d.ts.map +1 -0
- package/dist/mdx.client.js +12 -19
- package/dist/mdx.d.ts +18 -20
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +47 -56
- package/dist/og.d.ts +6 -7
- package/dist/og.d.ts.map +1 -0
- package/dist/og.js +43 -102
- package/dist/page.client.d.ts +8 -41
- package/dist/page.client.d.ts.map +1 -0
- package/dist/page.client.js +71 -261
- package/dist/page.d.ts +28 -30
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +80 -168
- package/dist/provider.d.ts +12 -72
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +19 -55
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.d.ts +9 -20
- package/dist/tailwind-plugin.d.ts.map +1 -0
- package/dist/tailwind-plugin.js +191 -699
- package/dist/theme/animations.d.ts +170 -0
- package/dist/theme/animations.d.ts.map +1 -0
- package/dist/theme/animations.js +95 -0
- package/dist/theme/colors.d.ts +11 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +327 -0
- package/dist/theme/typography.d.ts +70 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +71 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +1 -0
- package/dist/utils/get-sidebar-tabs.d.ts +7 -0
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
- package/dist/utils/get-sidebar-tabs.js +20 -0
- package/dist/utils/is-active.d.ts +2 -0
- package/dist/utils/is-active.d.ts.map +1 -0
- package/dist/utils/is-active.js +3 -0
- package/dist/utils/use-copy-button.d.ts +3 -0
- package/dist/utils/use-copy-button.d.ts.map +1 -0
- package/dist/utils/use-copy-button.js +25 -0
- package/package.json +9 -9
- package/dist/chunk-27HFSL7N.js +0 -53
- package/dist/chunk-2FLZOPQN.js +0 -54
- package/dist/chunk-2KMKNVSN.js +0 -29
- package/dist/chunk-45REPLUI.js +0 -259
- package/dist/chunk-5KVEK5A7.js +0 -139
- package/dist/chunk-5QPVK7QM.js +0 -542
- package/dist/chunk-CDPVENXR.js +0 -8
- package/dist/chunk-CPGKWLLV.js +0 -43
- package/dist/chunk-DGKCMOIC.js +0 -56
- package/dist/chunk-DN6Z5VW6.js +0 -61
- package/dist/chunk-E3VO2QQT.js +0 -29
- package/dist/chunk-EFMHXXHW.js +0 -24
- package/dist/chunk-ET4TW6M5.js +0 -70
- package/dist/chunk-GHOAONNQ.js +0 -48
- package/dist/chunk-IHIFNFRB.js +0 -38
- package/dist/chunk-IVBHRX3O.js +0 -31
- package/dist/chunk-JUOW3DZK.js +0 -212
- package/dist/chunk-KZTWSBYY.js +0 -68
- package/dist/chunk-MCX7E6ZW.js +0 -57
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-PZTQPB4U.js +0 -125
- package/dist/chunk-QKOA6KEZ.js +0 -22
- package/dist/chunk-TK3TM3MR.js +0 -6
- package/dist/chunk-TQJ6YPJ3.js +0 -31
- package/dist/chunk-V6RONFCQ.js +0 -69
- package/dist/chunk-WRBUXI2A.js +0 -82
- package/dist/chunk-YL3MZH7N.js +0 -66
- package/dist/components/api.client.d.ts +0 -5
- package/dist/components/api.client.js +0 -8
- package/dist/dynamic-sidebar-MEINO4E2.js +0 -129
- package/dist/edit-on-github-PCTRDRD6.js +0 -49
- package/dist/layouts/home.client.d.ts +0 -11
- package/dist/layouts/home.client.js +0 -274
- package/dist/shared-SScCiV7b.d.ts +0 -152
- package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
- package/dist/tag-list-BsEgfE3x.d.ts +0 -6
- package/dist/toc-clerk-SKE4LBT7.js +0 -158
- package/dist/tree-06ley65N.d.ts +0 -21
package/dist/chunk-CPGKWLLV.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CircleX,
|
|
3
|
-
Info,
|
|
4
|
-
TriangleAlert
|
|
5
|
-
} from "./chunk-5QPVK7QM.js";
|
|
6
|
-
import {
|
|
7
|
-
twMerge
|
|
8
|
-
} from "./chunk-TK3TM3MR.js";
|
|
9
|
-
|
|
10
|
-
// src/components/callout.tsx
|
|
11
|
-
import { forwardRef } from "react";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
var Callout = forwardRef(
|
|
14
|
-
({ className, children, title, type = "info", icon, ...props }, ref) => {
|
|
15
|
-
return /* @__PURE__ */ jsxs(
|
|
16
|
-
"div",
|
|
17
|
-
{
|
|
18
|
-
ref,
|
|
19
|
-
className: twMerge(
|
|
20
|
-
"my-6 flex flex-row gap-2 rounded-lg border bg-fd-card p-3 text-sm text-fd-card-foreground shadow-md",
|
|
21
|
-
className
|
|
22
|
-
),
|
|
23
|
-
...props,
|
|
24
|
-
children: [
|
|
25
|
-
icon ?? {
|
|
26
|
-
info: /* @__PURE__ */ jsx(Info, { className: "size-5 fill-blue-500 text-fd-card" }),
|
|
27
|
-
warn: /* @__PURE__ */ jsx(TriangleAlert, { className: "size-5 fill-orange-500 text-fd-card" }),
|
|
28
|
-
error: /* @__PURE__ */ jsx(CircleX, { className: "size-5 fill-red-500 text-fd-card" })
|
|
29
|
-
}[type],
|
|
30
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
31
|
-
title ? /* @__PURE__ */ jsx("p", { className: "not-prose mb-2 font-medium", children: title }) : null,
|
|
32
|
-
/* @__PURE__ */ jsx("div", { className: "text-fd-muted-foreground prose-no-margin", children })
|
|
33
|
-
] })
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
Callout.displayName = "Callout";
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
Callout
|
|
43
|
-
};
|
package/dist/chunk-DGKCMOIC.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
twMerge
|
|
3
|
-
} from "./chunk-TK3TM3MR.js";
|
|
4
|
-
|
|
5
|
-
// src/components/dialog/tag-list.tsx
|
|
6
|
-
import { cva } from "class-variance-authority";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
var itemVariants = cva(
|
|
9
|
-
"rounded-md border px-2 py-0.5 text-xs font-medium text-fd-muted-foreground transition-colors",
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
active: {
|
|
13
|
-
true: "bg-fd-accent text-fd-accent-foreground"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
function TagsList({
|
|
19
|
-
tag,
|
|
20
|
-
onTagChange,
|
|
21
|
-
items,
|
|
22
|
-
allowClear,
|
|
23
|
-
...props
|
|
24
|
-
}) {
|
|
25
|
-
return /* @__PURE__ */ jsxs(
|
|
26
|
-
"div",
|
|
27
|
-
{
|
|
28
|
-
...props,
|
|
29
|
-
className: twMerge("flex flex-row items-center gap-1", props.className),
|
|
30
|
-
children: [
|
|
31
|
-
items.map((item) => /* @__PURE__ */ jsx(
|
|
32
|
-
"button",
|
|
33
|
-
{
|
|
34
|
-
type: "button",
|
|
35
|
-
className: twMerge(itemVariants({ active: tag === item.value })),
|
|
36
|
-
onClick: () => {
|
|
37
|
-
if (tag === item.value && allowClear) {
|
|
38
|
-
onTagChange(void 0);
|
|
39
|
-
} else {
|
|
40
|
-
onTagChange(item.value);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
tabIndex: -1,
|
|
44
|
-
children: item.name
|
|
45
|
-
},
|
|
46
|
-
item.value
|
|
47
|
-
)),
|
|
48
|
-
props.children
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export {
|
|
55
|
-
TagsList
|
|
56
|
-
};
|
package/dist/chunk-DN6Z5VW6.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// src/components/layout/toc-thumb.tsx
|
|
2
|
-
import {
|
|
3
|
-
useEffect,
|
|
4
|
-
useRef
|
|
5
|
-
} from "react";
|
|
6
|
-
import * as Primitive from "fumadocs-core/toc";
|
|
7
|
-
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
function calc(container, active) {
|
|
10
|
-
if (active.length === 0 || container.clientHeight === 0) {
|
|
11
|
-
return [0, 0];
|
|
12
|
-
}
|
|
13
|
-
let upper = Number.MAX_VALUE, lower = 0;
|
|
14
|
-
for (const item of active) {
|
|
15
|
-
const element = container.querySelector(`a[href="#${item}"]`);
|
|
16
|
-
if (!element) continue;
|
|
17
|
-
const styles = getComputedStyle(element);
|
|
18
|
-
upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
|
|
19
|
-
lower = Math.max(
|
|
20
|
-
lower,
|
|
21
|
-
element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom)
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return [upper, lower - upper];
|
|
25
|
-
}
|
|
26
|
-
function update(element, info) {
|
|
27
|
-
element.style.setProperty("--fd-top", `${info[0]}px`);
|
|
28
|
-
element.style.setProperty("--fd-height", `${info[1]}px`);
|
|
29
|
-
}
|
|
30
|
-
function TocThumb({
|
|
31
|
-
containerRef,
|
|
32
|
-
...props
|
|
33
|
-
}) {
|
|
34
|
-
const active = Primitive.useActiveAnchors();
|
|
35
|
-
const thumbRef = useRef(null);
|
|
36
|
-
const activeRef = useRef(active);
|
|
37
|
-
activeRef.current = active;
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (!containerRef.current) return;
|
|
40
|
-
const container = containerRef.current;
|
|
41
|
-
const onResize = () => {
|
|
42
|
-
if (!thumbRef.current) return;
|
|
43
|
-
update(thumbRef.current, calc(container, activeRef.current));
|
|
44
|
-
};
|
|
45
|
-
onResize();
|
|
46
|
-
const observer = new ResizeObserver(onResize);
|
|
47
|
-
observer.observe(container);
|
|
48
|
-
return () => {
|
|
49
|
-
observer.disconnect();
|
|
50
|
-
};
|
|
51
|
-
}, [containerRef]);
|
|
52
|
-
useOnChange(active, () => {
|
|
53
|
-
if (!containerRef.current || !thumbRef.current) return;
|
|
54
|
-
update(thumbRef.current, calc(containerRef.current, active));
|
|
55
|
-
});
|
|
56
|
-
return /* @__PURE__ */ jsx("div", { ref: thumbRef, role: "none", ...props });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
TocThumb
|
|
61
|
-
};
|
package/dist/chunk-E3VO2QQT.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// src/layouts/shared.tsx
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
function getLinks(links, githubUrl) {
|
|
5
|
-
let result = links ?? [];
|
|
6
|
-
if (githubUrl)
|
|
7
|
-
result = [
|
|
8
|
-
...result,
|
|
9
|
-
{
|
|
10
|
-
type: "icon",
|
|
11
|
-
url: githubUrl,
|
|
12
|
-
text: "Github",
|
|
13
|
-
icon: /* @__PURE__ */ jsx("svg", { role: "img", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" }) }),
|
|
14
|
-
external: true
|
|
15
|
-
}
|
|
16
|
-
];
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
function replaceOrDefault(obj, def, customComponentProps, disabled) {
|
|
20
|
-
if (obj?.enabled === false) return disabled;
|
|
21
|
-
if (obj?.component !== void 0)
|
|
22
|
-
return /* @__PURE__ */ jsx(Slot, { ...customComponentProps, children: obj.component });
|
|
23
|
-
return def;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
getLinks,
|
|
28
|
-
replaceOrDefault
|
|
29
|
-
};
|
package/dist/chunk-EFMHXXHW.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/contexts/i18n.tsx
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
var I18nContext = createContext({
|
|
4
|
-
text: {
|
|
5
|
-
search: "Search",
|
|
6
|
-
searchNoResult: "No results found",
|
|
7
|
-
toc: "On this page",
|
|
8
|
-
tocNoHeadings: "No Headings",
|
|
9
|
-
lastUpdate: "Last updated on",
|
|
10
|
-
chooseLanguage: "Choose a language",
|
|
11
|
-
nextPage: "Next",
|
|
12
|
-
previousPage: "Previous",
|
|
13
|
-
chooseTheme: "Theme",
|
|
14
|
-
editOnGithub: "Edit on GitHub"
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
function useI18n() {
|
|
18
|
-
return useContext(I18nContext);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
I18nContext,
|
|
23
|
-
useI18n
|
|
24
|
-
};
|
package/dist/chunk-ET4TW6M5.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// src/contexts/search.tsx
|
|
2
|
-
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
var SearchContext = createContext({
|
|
5
|
-
enabled: false,
|
|
6
|
-
hotKey: [],
|
|
7
|
-
setOpenSearch: () => void 0
|
|
8
|
-
});
|
|
9
|
-
function useSearchContext() {
|
|
10
|
-
return useContext(SearchContext);
|
|
11
|
-
}
|
|
12
|
-
function SearchProvider({
|
|
13
|
-
SearchDialog,
|
|
14
|
-
children,
|
|
15
|
-
preload = true,
|
|
16
|
-
options,
|
|
17
|
-
hotKey = [
|
|
18
|
-
{
|
|
19
|
-
key: (e) => e.metaKey || e.ctrlKey,
|
|
20
|
-
display: "\u2318"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: "k",
|
|
24
|
-
display: "K"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
links
|
|
28
|
-
}) {
|
|
29
|
-
const [isOpen, setIsOpen] = useState(preload ? false : void 0);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const handler = (e) => {
|
|
32
|
-
if (hotKey.every(
|
|
33
|
-
(v) => typeof v.key === "string" ? e.key === v.key : v.key(e)
|
|
34
|
-
)) {
|
|
35
|
-
setIsOpen(true);
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
window.addEventListener("keydown", handler);
|
|
40
|
-
return () => {
|
|
41
|
-
window.removeEventListener("keydown", handler);
|
|
42
|
-
};
|
|
43
|
-
}, [hotKey]);
|
|
44
|
-
return /* @__PURE__ */ jsxs(
|
|
45
|
-
SearchContext.Provider,
|
|
46
|
-
{
|
|
47
|
-
value: useMemo(
|
|
48
|
-
() => ({ enabled: true, hotKey, setOpenSearch: setIsOpen }),
|
|
49
|
-
[hotKey]
|
|
50
|
-
),
|
|
51
|
-
children: [
|
|
52
|
-
isOpen !== void 0 && /* @__PURE__ */ jsx(
|
|
53
|
-
SearchDialog,
|
|
54
|
-
{
|
|
55
|
-
open: isOpen,
|
|
56
|
-
onOpenChange: setIsOpen,
|
|
57
|
-
links,
|
|
58
|
-
...options
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
children
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export {
|
|
68
|
-
useSearchContext,
|
|
69
|
-
SearchProvider
|
|
70
|
-
};
|
package/dist/chunk-GHOAONNQ.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
twMerge
|
|
3
|
-
} from "./chunk-TK3TM3MR.js";
|
|
4
|
-
|
|
5
|
-
// src/components/card.tsx
|
|
6
|
-
import Link from "fumadocs-core/link";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
function Cards(props) {
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
-
"div",
|
|
11
|
-
{
|
|
12
|
-
...props,
|
|
13
|
-
className: twMerge("grid grid-cols-1 gap-4 sm:grid-cols-2", props.className),
|
|
14
|
-
children: props.children
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
function Card({
|
|
19
|
-
icon,
|
|
20
|
-
title,
|
|
21
|
-
description,
|
|
22
|
-
...props
|
|
23
|
-
}) {
|
|
24
|
-
const E = props.href ? Link : "div";
|
|
25
|
-
return /* @__PURE__ */ jsxs(
|
|
26
|
-
E,
|
|
27
|
-
{
|
|
28
|
-
...props,
|
|
29
|
-
"data-card": true,
|
|
30
|
-
className: twMerge(
|
|
31
|
-
"block rounded-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors",
|
|
32
|
-
props.href && "hover:bg-fd-accent/80",
|
|
33
|
-
props.className
|
|
34
|
-
),
|
|
35
|
-
children: [
|
|
36
|
-
icon ? /* @__PURE__ */ jsx("div", { className: "not-prose mb-2 w-fit rounded-md border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon }) : null,
|
|
37
|
-
/* @__PURE__ */ jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }),
|
|
38
|
-
description ? /* @__PURE__ */ jsx("p", { className: "my-0 text-sm text-fd-muted-foreground", children: description }) : null,
|
|
39
|
-
props.children ? /* @__PURE__ */ jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children }) : null
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
Cards,
|
|
47
|
-
Card
|
|
48
|
-
};
|
package/dist/chunk-IHIFNFRB.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Link
|
|
3
|
-
} from "./chunk-5QPVK7QM.js";
|
|
4
|
-
import {
|
|
5
|
-
twMerge
|
|
6
|
-
} from "./chunk-TK3TM3MR.js";
|
|
7
|
-
|
|
8
|
-
// src/components/heading.tsx
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
function Heading({
|
|
11
|
-
as,
|
|
12
|
-
className,
|
|
13
|
-
...props
|
|
14
|
-
}) {
|
|
15
|
-
const As = as ?? "h1";
|
|
16
|
-
if (!props.id) return /* @__PURE__ */ jsx(As, { className, ...props });
|
|
17
|
-
return /* @__PURE__ */ jsxs(
|
|
18
|
-
As,
|
|
19
|
-
{
|
|
20
|
-
className: twMerge("flex scroll-m-28 flex-row items-center gap-2", className),
|
|
21
|
-
...props,
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsx("a", { "data-card": "", href: `#${props.id}`, className: "peer", children: props.children }),
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
Link,
|
|
26
|
-
{
|
|
27
|
-
"aria-label": "Link to section",
|
|
28
|
-
className: "size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
Heading
|
|
38
|
-
};
|
package/dist/chunk-IVBHRX3O.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
twMerge
|
|
3
|
-
} from "./chunk-TK3TM3MR.js";
|
|
4
|
-
|
|
5
|
-
// src/components/ui/popover.tsx
|
|
6
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var Popover = PopoverPrimitive.Root;
|
|
10
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
11
|
-
var PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
12
|
-
PopoverPrimitive.Content,
|
|
13
|
-
{
|
|
14
|
-
ref,
|
|
15
|
-
align,
|
|
16
|
-
sideOffset,
|
|
17
|
-
side: "bottom",
|
|
18
|
-
className: twMerge(
|
|
19
|
-
"z-50 min-w-[220px] max-w-[98vw] rounded-lg border bg-fd-popover p-2 text-sm text-fd-popover-foreground shadow-md focus-visible:outline-none data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in",
|
|
20
|
-
className
|
|
21
|
-
),
|
|
22
|
-
...props
|
|
23
|
-
}
|
|
24
|
-
) }));
|
|
25
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
Popover,
|
|
29
|
-
PopoverTrigger,
|
|
30
|
-
PopoverContent
|
|
31
|
-
};
|
package/dist/chunk-JUOW3DZK.js
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LargeSearchToggle
|
|
3
|
-
} from "./chunk-V6RONFCQ.js";
|
|
4
|
-
import {
|
|
5
|
-
isActive
|
|
6
|
-
} from "./chunk-CDPVENXR.js";
|
|
7
|
-
import {
|
|
8
|
-
Collapsible,
|
|
9
|
-
CollapsibleContent,
|
|
10
|
-
CollapsibleTrigger
|
|
11
|
-
} from "./chunk-TQJ6YPJ3.js";
|
|
12
|
-
import {
|
|
13
|
-
ScrollArea,
|
|
14
|
-
ScrollViewport
|
|
15
|
-
} from "./chunk-2FLZOPQN.js";
|
|
16
|
-
import {
|
|
17
|
-
ChevronDown,
|
|
18
|
-
ExternalLink
|
|
19
|
-
} from "./chunk-5QPVK7QM.js";
|
|
20
|
-
import {
|
|
21
|
-
twMerge
|
|
22
|
-
} from "./chunk-TK3TM3MR.js";
|
|
23
|
-
import {
|
|
24
|
-
useSearchContext
|
|
25
|
-
} from "./chunk-ET4TW6M5.js";
|
|
26
|
-
import {
|
|
27
|
-
useTreeContext
|
|
28
|
-
} from "./chunk-YL3MZH7N.js";
|
|
29
|
-
|
|
30
|
-
// src/components/layout/sidebar.tsx
|
|
31
|
-
import * as Base from "fumadocs-core/sidebar";
|
|
32
|
-
import { usePathname } from "next/navigation";
|
|
33
|
-
import {
|
|
34
|
-
createContext,
|
|
35
|
-
memo,
|
|
36
|
-
useContext,
|
|
37
|
-
useMemo,
|
|
38
|
-
useState
|
|
39
|
-
} from "react";
|
|
40
|
-
import Link from "fumadocs-core/link";
|
|
41
|
-
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
42
|
-
|
|
43
|
-
// src/components/layout/variants.ts
|
|
44
|
-
import { cva } from "class-variance-authority";
|
|
45
|
-
var itemVariants = cva([
|
|
46
|
-
"flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-fd-muted-foreground transition-colors duration-100 [overflow-wrap:anywhere] [&_svg]:size-4",
|
|
47
|
-
"data-[active=false]:hover:bg-fd-accent/50 data-[active=false]:hover:text-fd-accent-foreground/80 data-[active=false]:hover:transition-none",
|
|
48
|
-
"data-[active=true]:bg-fd-primary/10 data-[active=true]:font-medium data-[active=true]:text-fd-primary"
|
|
49
|
-
]);
|
|
50
|
-
|
|
51
|
-
// src/components/layout/sidebar.tsx
|
|
52
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
53
|
-
var Context = createContext(void 0);
|
|
54
|
-
var Sidebar = memo(
|
|
55
|
-
({
|
|
56
|
-
components,
|
|
57
|
-
defaultOpenLevel = 0,
|
|
58
|
-
prefetch = true,
|
|
59
|
-
...props
|
|
60
|
-
}) => {
|
|
61
|
-
const search = useSearchContext();
|
|
62
|
-
const hasSearch = search.enabled && !props.hideSearch;
|
|
63
|
-
const context = useMemo(
|
|
64
|
-
() => ({
|
|
65
|
-
defaultOpenLevel,
|
|
66
|
-
components: {
|
|
67
|
-
Folder: FolderNode,
|
|
68
|
-
Separator: SeparatorNode,
|
|
69
|
-
Item: PageNode,
|
|
70
|
-
...components
|
|
71
|
-
},
|
|
72
|
-
prefetch
|
|
73
|
-
}),
|
|
74
|
-
[components, defaultOpenLevel, prefetch]
|
|
75
|
-
);
|
|
76
|
-
return /* @__PURE__ */ jsx(
|
|
77
|
-
Base.SidebarList,
|
|
78
|
-
{
|
|
79
|
-
id: "nd-sidebar",
|
|
80
|
-
blockScrollingWidth: 768,
|
|
81
|
-
...props.aside,
|
|
82
|
-
className: twMerge(
|
|
83
|
-
"fixed top-fd-layout-top z-30 bg-fd-card text-sm md:sticky md:h-[var(--fd-sidebar-height)] md:flex-1",
|
|
84
|
-
"max-md:inset-x-0 max-md:bottom-0 max-md:bg-fd-background/80 max-md:text-[15px] max-md:backdrop-blur-lg max-md:data-[open=false]:invisible",
|
|
85
|
-
props.aside?.className
|
|
86
|
-
),
|
|
87
|
-
style: {
|
|
88
|
-
...props.aside?.style,
|
|
89
|
-
"--fd-sidebar-height": "calc(100dvh - var(--fd-banner-height) - var(--fd-nav-height))"
|
|
90
|
-
},
|
|
91
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col pt-2 md:ms-auto md:w-[var(--fd-sidebar-width)] md:border-e md:pt-4", children: [
|
|
92
|
-
props.banner,
|
|
93
|
-
hasSearch ? /* @__PURE__ */ jsx(LargeSearchToggle, { className: "mx-4 rounded-lg max-md:hidden md:mx-3" }) : null,
|
|
94
|
-
/* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs(
|
|
95
|
-
ScrollViewport,
|
|
96
|
-
{
|
|
97
|
-
style: {
|
|
98
|
-
maskImage: "linear-gradient(to bottom, transparent 2px, white 16px)"
|
|
99
|
-
},
|
|
100
|
-
children: [
|
|
101
|
-
props.children,
|
|
102
|
-
/* @__PURE__ */ jsx(Context.Provider, { value: context, children: /* @__PURE__ */ jsx(RootNodeList, {}) })
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
) }),
|
|
106
|
-
props.footer
|
|
107
|
-
] })
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
Sidebar.displayName = "Sidebar";
|
|
113
|
-
var SeparatorNode = memo(({ item }) => {
|
|
114
|
-
return /* @__PURE__ */ jsx("p", { className: "mb-2 mt-8 px-2 text-sm font-medium first:mt-0", children: item.name });
|
|
115
|
-
});
|
|
116
|
-
SeparatorNode.displayName = "SeparatorNode";
|
|
117
|
-
function RootNodeList() {
|
|
118
|
-
const { root } = useTreeContext();
|
|
119
|
-
const { components } = useInternalContext();
|
|
120
|
-
return /* @__PURE__ */ jsx("div", { className: "px-2 py-4 md:px-3", children: renderList(root.children, 0, components) });
|
|
121
|
-
}
|
|
122
|
-
function renderList(items, level, { Separator, Item, Folder }) {
|
|
123
|
-
return items.map((item, i) => {
|
|
124
|
-
const id = `${item.type}_${i.toString()}`;
|
|
125
|
-
switch (item.type) {
|
|
126
|
-
case "separator":
|
|
127
|
-
return /* @__PURE__ */ jsx(Separator, { item }, id);
|
|
128
|
-
case "folder":
|
|
129
|
-
return /* @__PURE__ */ jsx(Folder, { item, level: level + 1 }, id);
|
|
130
|
-
default:
|
|
131
|
-
return /* @__PURE__ */ jsx(Item, { item }, item.url);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
var PageNode = memo(({ item }) => {
|
|
136
|
-
const pathname = usePathname();
|
|
137
|
-
const active = isActive(item.url, pathname, false);
|
|
138
|
-
const { prefetch } = useInternalContext();
|
|
139
|
-
return /* @__PURE__ */ jsxs(
|
|
140
|
-
Link,
|
|
141
|
-
{
|
|
142
|
-
href: item.url,
|
|
143
|
-
external: item.external,
|
|
144
|
-
"data-active": active,
|
|
145
|
-
className: twMerge(itemVariants()),
|
|
146
|
-
prefetch,
|
|
147
|
-
children: [
|
|
148
|
-
item.icon ?? (item.external ? /* @__PURE__ */ jsx(ExternalLink, {}) : null),
|
|
149
|
-
item.name
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
PageNode.displayName = "PageNode";
|
|
155
|
-
var FolderNode = memo(
|
|
156
|
-
({ item, level }) => {
|
|
157
|
-
const { defaultOpenLevel, prefetch, components } = useInternalContext();
|
|
158
|
-
const { path } = useTreeContext();
|
|
159
|
-
const pathname = usePathname();
|
|
160
|
-
const active = item.index !== void 0 && isActive(item.index.url, pathname, false);
|
|
161
|
-
const className = twMerge(itemVariants(), "w-full md:pe-1.5");
|
|
162
|
-
const shouldExtend = active || path.includes(item) || (item.defaultOpen ?? defaultOpenLevel >= level);
|
|
163
|
-
const [open, setOpen] = useState(shouldExtend);
|
|
164
|
-
useOnChange(shouldExtend, (v) => {
|
|
165
|
-
if (v) setOpen(v);
|
|
166
|
-
});
|
|
167
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
168
|
-
item.icon,
|
|
169
|
-
item.name,
|
|
170
|
-
/* @__PURE__ */ jsx(
|
|
171
|
-
ChevronDown,
|
|
172
|
-
{
|
|
173
|
-
"data-icon": true,
|
|
174
|
-
className: twMerge("ms-auto transition-transform", !open && "-rotate-90")
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
] });
|
|
178
|
-
return /* @__PURE__ */ jsxs(Collapsible, { open, onOpenChange: setOpen, children: [
|
|
179
|
-
item.index ? /* @__PURE__ */ jsx(
|
|
180
|
-
Link,
|
|
181
|
-
{
|
|
182
|
-
"data-active": active,
|
|
183
|
-
className,
|
|
184
|
-
href: item.index.url,
|
|
185
|
-
onClick: (e) => {
|
|
186
|
-
if (
|
|
187
|
-
// clicking on icon
|
|
188
|
-
e.target.hasAttribute("data-icon") || active
|
|
189
|
-
) {
|
|
190
|
-
setOpen((prev) => !prev);
|
|
191
|
-
e.preventDefault();
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
prefetch,
|
|
195
|
-
children: content
|
|
196
|
-
}
|
|
197
|
-
) : /* @__PURE__ */ jsx(CollapsibleTrigger, { "data-active": active, className, children: content }),
|
|
198
|
-
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "ms-2 border-s py-1.5 ps-1", children: renderList(item.children, level, components) }) })
|
|
199
|
-
] });
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
FolderNode.displayName = "FolderNode";
|
|
203
|
-
function useInternalContext() {
|
|
204
|
-
const ctx = useContext(Context);
|
|
205
|
-
if (!ctx) throw new Error("<Sidebar /> component required.");
|
|
206
|
-
return ctx;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export {
|
|
210
|
-
itemVariants,
|
|
211
|
-
Sidebar
|
|
212
|
-
};
|
package/dist/chunk-KZTWSBYY.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buttonVariants
|
|
3
|
-
} from "./chunk-QKOA6KEZ.js";
|
|
4
|
-
import {
|
|
5
|
-
Popover,
|
|
6
|
-
PopoverContent,
|
|
7
|
-
PopoverTrigger
|
|
8
|
-
} from "./chunk-IVBHRX3O.js";
|
|
9
|
-
import {
|
|
10
|
-
twMerge
|
|
11
|
-
} from "./chunk-TK3TM3MR.js";
|
|
12
|
-
import {
|
|
13
|
-
useI18n
|
|
14
|
-
} from "./chunk-EFMHXXHW.js";
|
|
15
|
-
|
|
16
|
-
// src/components/layout/language-toggle.tsx
|
|
17
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
function LanguageToggle(props) {
|
|
19
|
-
const context = useI18n();
|
|
20
|
-
if (!context.locales) throw new Error("Missing `<I18nProvider />`");
|
|
21
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
22
|
-
/* @__PURE__ */ jsx(
|
|
23
|
-
PopoverTrigger,
|
|
24
|
-
{
|
|
25
|
-
"aria-label": context.text.chooseLanguage,
|
|
26
|
-
...props,
|
|
27
|
-
className: twMerge(
|
|
28
|
-
buttonVariants({
|
|
29
|
-
color: "ghost",
|
|
30
|
-
className: "gap-1.5 p-1.5"
|
|
31
|
-
}),
|
|
32
|
-
props.className
|
|
33
|
-
),
|
|
34
|
-
children: props.children
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
/* @__PURE__ */ jsxs(PopoverContent, { className: "flex flex-col overflow-hidden p-0", children: [
|
|
38
|
-
/* @__PURE__ */ jsx("p", { className: "mb-1 p-2 text-xs font-medium text-fd-muted-foreground", children: context.text.chooseLanguage }),
|
|
39
|
-
context.locales.map((item) => /* @__PURE__ */ jsx(
|
|
40
|
-
"button",
|
|
41
|
-
{
|
|
42
|
-
type: "button",
|
|
43
|
-
className: twMerge(
|
|
44
|
-
"p-2 text-start text-sm",
|
|
45
|
-
item.locale === context.locale ? "bg-fd-primary/10 font-medium text-fd-primary" : "hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
46
|
-
),
|
|
47
|
-
onClick: () => {
|
|
48
|
-
context.onChange?.(item.locale);
|
|
49
|
-
},
|
|
50
|
-
children: item.name
|
|
51
|
-
},
|
|
52
|
-
item.locale
|
|
53
|
-
))
|
|
54
|
-
] })
|
|
55
|
-
] });
|
|
56
|
-
}
|
|
57
|
-
function LanguageToggleText(props) {
|
|
58
|
-
const context = useI18n();
|
|
59
|
-
const text = context.locales?.find(
|
|
60
|
-
(item) => item.locale === context.locale
|
|
61
|
-
)?.name;
|
|
62
|
-
return /* @__PURE__ */ jsx("span", { ...props, children: text });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export {
|
|
66
|
-
LanguageToggle,
|
|
67
|
-
LanguageToggleText
|
|
68
|
-
};
|