@fumadocs/base-ui 16.17.8 → 16.17.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/generated/flux.css +1 -1
- package/css/generated/glass.css +1 -1
- package/css/generated/shared.css +1 -1
- package/css/generated/spacious.css +1 -1
- package/css/lib/base.css +8 -7
- package/dist/.translations/index.d.ts +1 -3
- package/dist/.translations/keys.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/components/accordion.d.ts +1 -3
- package/dist/components/accordion.js +1 -2
- package/dist/components/banner.d.ts +0 -2
- package/dist/components/banner.js +1 -2
- package/dist/components/callout.d.ts +1 -3
- package/dist/components/callout.js +1 -2
- package/dist/components/card.d.ts +1 -3
- package/dist/components/card.js +1 -2
- package/dist/components/codeblock.d.ts +1 -3
- package/dist/components/codeblock.js +1 -2
- package/dist/components/codeblock.rsc.d.ts +1 -3
- package/dist/components/codeblock.rsc.js +1 -2
- package/dist/components/dialog/search-algolia.d.ts +1 -3
- package/dist/components/dialog/search-algolia.js +1 -2
- package/dist/components/dialog/search-default.d.ts +1 -3
- package/dist/components/dialog/search-default.js +1 -2
- package/dist/components/dialog/search-orama.d.ts +1 -3
- package/dist/components/dialog/search-orama.js +1 -2
- package/dist/components/dialog/search.d.ts +0 -2
- package/dist/components/dialog/search.js +1 -2
- package/dist/components/dynamic-codeblock.core.d.ts +0 -2
- package/dist/components/dynamic-codeblock.core.js +1 -2
- package/dist/components/dynamic-codeblock.d.ts +1 -3
- package/dist/components/dynamic-codeblock.js +1 -2
- package/dist/components/files.d.ts +1 -3
- package/dist/components/files.js +1 -2
- package/dist/components/github-info.d.ts +1 -3
- package/dist/components/github-info.js +1 -2
- package/dist/components/heading.d.ts +0 -2
- package/dist/components/heading.js +1 -2
- package/dist/components/image-zoom.d.ts +1 -3
- package/dist/components/image-zoom.js +1 -2
- package/dist/components/inline-toc.d.ts +1 -3
- package/dist/components/inline-toc.js +1 -2
- package/dist/components/sidebar/base.d.ts +0 -1
- package/dist/components/sidebar/base.js +5 -3
- package/dist/components/sidebar/link-item.d.ts +0 -2
- package/dist/components/sidebar/link-item.js +1 -2
- package/dist/components/sidebar/page-tree.d.ts +0 -2
- package/dist/components/sidebar/page-tree.js +1 -2
- package/dist/components/sidebar/tabs/dropdown.d.ts +1 -3
- package/dist/components/sidebar/tabs/dropdown.js +1 -2
- package/dist/components/sidebar/tabs/index.d.ts +1 -3
- package/dist/components/sidebar/tabs/index.js +1 -2
- package/dist/components/steps.d.ts +1 -3
- package/dist/components/steps.js +1 -2
- package/dist/components/tabs.d.ts +1 -3
- package/dist/components/tabs.js +1 -2
- package/dist/components/toc/block.d.ts +1 -3
- package/dist/components/toc/block.js +6 -13
- package/dist/components/toc/clerk.d.ts +2 -4
- package/dist/components/toc/clerk.js +85 -120
- package/dist/components/toc/default.d.ts +2 -4
- package/dist/components/toc/default.js +112 -149
- package/dist/components/toc/index.d.ts +1 -3
- package/dist/components/toc/index.js +1 -2
- package/dist/components/type-table.d.ts +1 -3
- package/dist/components/type-table.js +1 -2
- package/dist/components/ui/accordion.d.ts +1 -3
- package/dist/components/ui/accordion.js +1 -2
- package/dist/components/ui/button.d.ts +1 -3
- package/dist/components/ui/button.js +1 -2
- package/dist/components/ui/collapsible.d.ts +1 -3
- package/dist/components/ui/collapsible.js +1 -2
- package/dist/components/ui/popover.d.ts +1 -3
- package/dist/components/ui/popover.js +1 -2
- package/dist/components/ui/tabs.d.ts +1 -3
- package/dist/components/ui/tabs.js +1 -2
- package/dist/contexts/i18n.d.ts +0 -2
- package/dist/contexts/i18n.js +1 -2
- package/dist/contexts/search.d.ts +0 -2
- package/dist/contexts/search.js +1 -2
- package/dist/contexts/tree.d.ts +0 -2
- package/dist/contexts/tree.js +1 -2
- package/dist/i18n.d.ts +0 -2
- package/dist/i18n.js +1 -2
- package/dist/layouts/docs/client.d.ts +0 -2
- package/dist/layouts/docs/client.js +1 -2
- package/dist/layouts/docs/index.d.ts +0 -2
- package/dist/layouts/docs/index.js +1 -2
- package/dist/layouts/docs/page/index.d.ts +0 -2
- package/dist/layouts/docs/page/index.js +1 -2
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/docs/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/docs/page/slots/container.d.ts +1 -3
- package/dist/layouts/docs/page/slots/container.js +1 -2
- package/dist/layouts/docs/page/slots/footer.d.ts +0 -2
- package/dist/layouts/docs/page/slots/footer.js +1 -2
- package/dist/layouts/docs/page/slots/toc.d.ts +1 -3
- package/dist/layouts/docs/page/slots/toc.js +1 -2
- package/dist/layouts/docs/slots/container.d.ts +1 -3
- package/dist/layouts/docs/slots/container.js +1 -2
- package/dist/layouts/docs/slots/header.d.ts +1 -3
- package/dist/layouts/docs/slots/header.js +1 -2
- package/dist/layouts/docs/slots/sidebar.d.ts +1 -3
- package/dist/layouts/docs/slots/sidebar.js +5 -9
- package/dist/layouts/flux/index.d.ts +0 -2
- package/dist/layouts/flux/index.js +1 -2
- package/dist/layouts/flux/page/index.d.ts +0 -2
- package/dist/layouts/flux/page/index.js +1 -2
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/flux/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/flux/page/slots/container.d.ts +1 -3
- package/dist/layouts/flux/page/slots/container.js +1 -2
- package/dist/layouts/flux/page/slots/footer.d.ts +0 -2
- package/dist/layouts/flux/page/slots/footer.js +1 -2
- package/dist/layouts/flux/page/slots/toc.d.ts +1 -3
- package/dist/layouts/flux/page/slots/toc.js +1 -2
- package/dist/layouts/flux/slots/container.d.ts +1 -3
- package/dist/layouts/flux/slots/container.js +1 -2
- package/dist/layouts/flux/slots/sidebar.d.ts +1 -3
- package/dist/layouts/flux/slots/sidebar.js +1 -2
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +1 -3
- package/dist/layouts/flux/slots/tab-dropdown.js +1 -2
- package/dist/layouts/glass/index.d.ts +0 -2
- package/dist/layouts/glass/index.js +1 -2
- package/dist/layouts/glass/layout-tabs.js +1 -2
- package/dist/layouts/glass/page/index.d.ts +0 -2
- package/dist/layouts/glass/page/index.js +1 -2
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/glass/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/glass/page/slots/footer.d.ts +0 -2
- package/dist/layouts/glass/page/slots/footer.js +1 -2
- package/dist/layouts/glass/page/slots/toc.d.ts +1 -3
- package/dist/layouts/glass/page/slots/toc.js +1 -2
- package/dist/layouts/glass/slots/header.d.ts +1 -3
- package/dist/layouts/glass/slots/header.js +1 -2
- package/dist/layouts/glass/slots/sidebar.d.ts +1 -3
- package/dist/layouts/glass/slots/sidebar.js +7 -5
- package/dist/layouts/home/index.d.ts +0 -2
- package/dist/layouts/home/index.js +1 -2
- package/dist/layouts/home/navbar.d.ts +1 -3
- package/dist/layouts/home/navbar.js +1 -2
- package/dist/layouts/home/not-found.d.ts +1 -3
- package/dist/layouts/home/not-found.js +1 -2
- package/dist/layouts/home/slots/container.d.ts +1 -3
- package/dist/layouts/home/slots/container.js +1 -2
- package/dist/layouts/home/slots/header.d.ts +1 -3
- package/dist/layouts/home/slots/header.js +1 -2
- package/dist/layouts/notebook/client.d.ts +0 -2
- package/dist/layouts/notebook/client.js +1 -2
- package/dist/layouts/notebook/index.d.ts +0 -2
- package/dist/layouts/notebook/index.js +1 -2
- package/dist/layouts/notebook/page/index.d.ts +0 -2
- package/dist/layouts/notebook/page/index.js +1 -2
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/notebook/page/slots/container.d.ts +1 -3
- package/dist/layouts/notebook/page/slots/container.js +1 -2
- package/dist/layouts/notebook/page/slots/footer.d.ts +0 -2
- package/dist/layouts/notebook/page/slots/footer.js +1 -2
- package/dist/layouts/notebook/page/slots/toc.d.ts +1 -3
- package/dist/layouts/notebook/page/slots/toc.js +1 -2
- package/dist/layouts/notebook/slots/container.d.ts +1 -3
- package/dist/layouts/notebook/slots/container.js +1 -2
- package/dist/layouts/notebook/slots/header.d.ts +1 -3
- package/dist/layouts/notebook/slots/header.js +1 -2
- package/dist/layouts/notebook/slots/sidebar.d.ts +0 -2
- package/dist/layouts/notebook/slots/sidebar.js +5 -9
- package/dist/layouts/shared/client.d.ts +1 -3
- package/dist/layouts/shared/client.js +1 -2
- package/dist/layouts/shared/index.d.ts +0 -2
- package/dist/layouts/shared/index.js +1 -2
- package/dist/layouts/shared/page-actions.d.ts +1 -3
- package/dist/layouts/shared/page-actions.js +1 -2
- package/dist/layouts/shared/slots/language-select.d.ts +1 -3
- package/dist/layouts/shared/slots/language-select.js +1 -2
- package/dist/layouts/shared/slots/search-trigger.d.ts +1 -3
- package/dist/layouts/shared/slots/search-trigger.js +1 -2
- package/dist/layouts/shared/slots/theme-switch.d.ts +1 -3
- package/dist/layouts/shared/slots/theme-switch.js +1 -2
- package/dist/layouts/spacious/index.d.ts +0 -2
- package/dist/layouts/spacious/index.js +1 -2
- package/dist/layouts/spacious/page/index.d.ts +0 -2
- package/dist/layouts/spacious/page/index.js +1 -2
- package/dist/layouts/spacious/page/slots/breadcrumb.d.ts +1 -3
- package/dist/layouts/spacious/page/slots/breadcrumb.js +1 -2
- package/dist/layouts/spacious/page/slots/footer.d.ts +0 -2
- package/dist/layouts/spacious/page/slots/footer.js +1 -2
- package/dist/layouts/spacious/page/slots/toc.d.ts +0 -2
- package/dist/layouts/spacious/page/slots/toc.js +1 -2
- package/dist/layouts/spacious/slots/actions.d.ts +1 -3
- package/dist/layouts/spacious/slots/actions.js +1 -2
- package/dist/layouts/spacious/slots/header.d.ts +1 -3
- package/dist/layouts/spacious/slots/header.js +1 -2
- package/dist/layouts/spacious/slots/sidebar.d.ts +1 -3
- package/dist/layouts/spacious/slots/sidebar.js +21 -25
- package/dist/mdx.d.ts +0 -2
- package/dist/mdx.js +1 -2
- package/dist/mdx.server.d.ts +0 -2
- package/dist/mdx.server.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/controlled.d.ts +0 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/controlled.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +1 -3
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/uncontrolled.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +1 -2
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +1 -2
- package/dist/og/takumi.d.ts +1 -3
- package/dist/og/takumi.js +1 -2
- package/dist/og.d.ts +0 -2
- package/dist/og.js +1 -2
- package/dist/page.d.ts +0 -2
- package/dist/page.js +1 -2
- package/dist/provider/astro.d.ts +1 -3
- package/dist/provider/astro.js +17 -2
- package/dist/provider/base.d.ts +0 -2
- package/dist/provider/base.js +1 -2
- package/dist/provider/next.d.ts +1 -3
- package/dist/provider/next.js +1 -2
- package/dist/provider/react-router.d.ts +1 -3
- package/dist/provider/react-router.js +1 -2
- package/dist/provider/tanstack.d.ts +1 -3
- package/dist/provider/tanstack.js +1 -2
- package/dist/provider/waku.d.ts +1 -3
- package/dist/provider/waku.js +1 -2
- package/dist/style.css +21 -24
- package/dist/utils/hotkey.js +1 -2
- package/dist/utils/merge-refs.js +1 -2
- package/dist/utils/urls.js +1 -2
- package/dist/utils/use-copy-button.d.ts +1 -3
- package/dist/utils/use-copy-button.js +1 -2
- package/dist/utils/use-footer-items.d.ts +1 -3
- package/dist/utils/use-footer-items.js +1 -2
- package/dist/utils/use-is-scroll-top.d.ts +1 -3
- package/dist/utils/use-is-scroll-top.js +1 -2
- package/package.json +5 -5
|
@@ -1,119 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
4
|
import { useTOCItems } from "./index.js";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useCallback,
|
|
6
|
+
import { useCallback, useMemo } from "react";
|
|
8
7
|
import { useTranslations } from "@fuma-translate/react";
|
|
9
8
|
import * as Primitive from "fumadocs-core/toc";
|
|
10
|
-
|
|
9
|
+
// src/components/toc/default.tsx
|
|
11
10
|
var default_exports = /* @__PURE__ */ __exportAll({
|
|
12
11
|
TOCEmpty: () => TOCEmpty,
|
|
13
12
|
TOCItem: () => TOCItem,
|
|
14
13
|
TOCItems: () => TOCItems
|
|
15
14
|
});
|
|
16
|
-
function TOCItems({
|
|
17
|
-
const containerRef = useRef(null);
|
|
15
|
+
function TOCItems({ className, thumbBox = true, children, ...props }) {
|
|
18
16
|
const items = useTOCItems();
|
|
19
|
-
const [svg, setSvg] = useState(null);
|
|
20
|
-
const onPrint = useCallback(() => {
|
|
21
|
-
const container = containerRef.current;
|
|
22
|
-
if (!container || container.clientHeight === 0) return;
|
|
23
|
-
if (items.length === 0) {
|
|
24
|
-
setSvg(null);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let w = 0;
|
|
28
|
-
let h = 0;
|
|
29
|
-
let d = "";
|
|
30
|
-
const positions = [];
|
|
31
|
-
const output = [];
|
|
32
|
-
for (let i = 0; i < items.length; i++) {
|
|
33
|
-
const item = items[i];
|
|
34
|
-
const element = container.querySelector(`a[href="${item.url}"]`);
|
|
35
|
-
if (!element) continue;
|
|
36
|
-
const styles = getComputedStyle(element);
|
|
37
|
-
const x = getLineOffset(item.depth) + .5;
|
|
38
|
-
const top = element.offsetTop + parseFloat(styles.paddingTop);
|
|
39
|
-
const bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
|
|
40
|
-
w = Math.max(x + 8, w);
|
|
41
|
-
h = Math.max(h, bottom);
|
|
42
|
-
if (i === 0) d += ` M${x} ${top} L${x} ${bottom}`;
|
|
43
|
-
else {
|
|
44
|
-
const [, upperBottom, upperX] = i > 0 ? positions[i - 1] : [
|
|
45
|
-
0,
|
|
46
|
-
0,
|
|
47
|
-
0
|
|
48
|
-
];
|
|
49
|
-
d += ` C ${upperX} ${top - 4} ${x} ${upperBottom + 4} ${x} ${top} L${x} ${bottom}`;
|
|
50
|
-
}
|
|
51
|
-
if (item._step !== void 0) output.push(/* @__PURE__ */ jsxs("g", {
|
|
52
|
-
transform: `translate(${x}, ${(top + bottom) / 2})`,
|
|
53
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
54
|
-
cx: "0",
|
|
55
|
-
cy: "0",
|
|
56
|
-
r: "8",
|
|
57
|
-
className: "fill-fd-primary"
|
|
58
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
59
|
-
cx: "0",
|
|
60
|
-
cy: "0",
|
|
61
|
-
textAnchor: "middle",
|
|
62
|
-
alignmentBaseline: "central",
|
|
63
|
-
dominantBaseline: "middle",
|
|
64
|
-
className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
|
|
65
|
-
children: item._step
|
|
66
|
-
})]
|
|
67
|
-
}, i));
|
|
68
|
-
positions.push([
|
|
69
|
-
top,
|
|
70
|
-
bottom,
|
|
71
|
-
x
|
|
72
|
-
]);
|
|
73
|
-
}
|
|
74
|
-
output.unshift(/* @__PURE__ */ jsx("path", {
|
|
75
|
-
d,
|
|
76
|
-
className: "stroke-fd-primary",
|
|
77
|
-
strokeWidth: "1",
|
|
78
|
-
fill: "none"
|
|
79
|
-
}, "path"));
|
|
80
|
-
const itemLineLengths = [];
|
|
81
|
-
if (thumbBox) {
|
|
82
|
-
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
83
|
-
path.setAttribute("d", d);
|
|
84
|
-
const n = path.getTotalLength();
|
|
85
|
-
for (let i = 0; i < positions.length; i++) {
|
|
86
|
-
const [top, bottom] = positions[i];
|
|
87
|
-
let l = i > 0 ? itemLineLengths[i - 1][1] + (top - positions[i - 1][1]) : top;
|
|
88
|
-
while (l < n && path.getPointAtLength(l).y < top) l++;
|
|
89
|
-
itemLineLengths.push([l, l + bottom - top]);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
setSvg({
|
|
93
|
-
content: output,
|
|
94
|
-
width: w,
|
|
95
|
-
height: h,
|
|
96
|
-
d,
|
|
97
|
-
itemLineLengths,
|
|
98
|
-
positions
|
|
99
|
-
});
|
|
100
|
-
}, [items, thumbBox]);
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
const container = containerRef.current;
|
|
103
|
-
if (!container) return;
|
|
104
|
-
const observer = new ResizeObserver(onPrint);
|
|
105
|
-
observer.observe(container);
|
|
106
|
-
onPrint();
|
|
107
|
-
return () => {
|
|
108
|
-
observer.unobserve(container);
|
|
109
|
-
};
|
|
110
|
-
}, [onPrint]);
|
|
111
17
|
return /* @__PURE__ */ jsxs("div", {
|
|
112
|
-
ref: mergeRefs(containerRef, ref),
|
|
113
18
|
className: cn("relative flex flex-col", className),
|
|
114
19
|
...props,
|
|
115
|
-
children: [
|
|
116
|
-
|
|
20
|
+
children: [items.length > 0 && /* @__PURE__ */ jsx(ThumbTrack, {
|
|
21
|
+
items,
|
|
117
22
|
thumbBox
|
|
118
23
|
}), children]
|
|
119
24
|
});
|
|
@@ -125,60 +30,119 @@ function TOCEmpty() {
|
|
|
125
30
|
children: t("No Headings")
|
|
126
31
|
});
|
|
127
32
|
}
|
|
128
|
-
function ThumbTrack({
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
33
|
+
function ThumbTrack({ items, thumbBox }) {
|
|
34
|
+
const toc = Primitive.useTOC();
|
|
35
|
+
const ref = useCallback((track) => {
|
|
36
|
+
const container = track.parentElement;
|
|
37
|
+
const svg = track.querySelector("svg");
|
|
38
|
+
const path = svg.querySelector("path");
|
|
39
|
+
const steps = svg.getElementsByTagName("g");
|
|
40
|
+
const thumb = thumbBox ? track.querySelector("div") : null;
|
|
41
|
+
const segment = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
42
|
+
const positions = /* @__PURE__ */ new Map();
|
|
43
|
+
let previous;
|
|
44
|
+
const update = (infos) => {
|
|
45
|
+
let start = -1;
|
|
46
|
+
let end = -1;
|
|
47
|
+
for (let i = 0; i < infos.length; i++) {
|
|
48
|
+
if (!infos[i].active || !positions.has(infos[i].original.url)) continue;
|
|
49
|
+
if (start === -1) start = i;
|
|
50
|
+
end = i;
|
|
144
51
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
52
|
+
if (start === -1) return;
|
|
53
|
+
const first = positions.get(infos[start].original.url);
|
|
54
|
+
const last = positions.get(infos[end].original.url);
|
|
55
|
+
svg.style.clipPath = `polygon(0 ${first.top}px, 100% ${first.top}px, 100% ${last.bottom}px, 0 ${last.bottom}px)`;
|
|
56
|
+
if (!thumb) return;
|
|
57
|
+
const isUp = previous !== void 0 && (previous.start > start || previous.end > end || previous.start === start && previous.end === end && previous.isUp);
|
|
58
|
+
previous = {
|
|
59
|
+
start,
|
|
60
|
+
end,
|
|
148
61
|
isUp
|
|
149
62
|
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
63
|
+
thumb.style.offsetDistance = `${isUp ? first.offset : last.offset + last.bottom - last.top}px`;
|
|
64
|
+
thumb.style.opacity = infos[isUp ? start : end].original._step === void 0 ? "1" : "0";
|
|
65
|
+
};
|
|
66
|
+
const observer = new ResizeObserver(() => {
|
|
67
|
+
if (container.clientHeight === 0) return;
|
|
68
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const anchor of container.getElementsByTagName("a")) anchors.set(anchor.getAttribute("href"), anchor);
|
|
70
|
+
let d = "";
|
|
71
|
+
let width = 0;
|
|
72
|
+
let height = 0;
|
|
73
|
+
let length = 0;
|
|
74
|
+
let last;
|
|
75
|
+
positions.clear();
|
|
76
|
+
for (const item of items) {
|
|
77
|
+
const anchor = anchors.get(item.url);
|
|
78
|
+
if (!anchor) continue;
|
|
79
|
+
const styles = getComputedStyle(anchor);
|
|
80
|
+
const x = getLineOffset(item.depth) + .5;
|
|
81
|
+
const top = anchor.offsetTop + parseFloat(styles.paddingTop);
|
|
82
|
+
const bottom = anchor.offsetTop + anchor.clientHeight - parseFloat(styles.paddingBottom);
|
|
83
|
+
if (last) {
|
|
84
|
+
const curve = `C ${last.x} ${top - 4} ${x} ${last.bottom + 4} ${x} ${top}`;
|
|
85
|
+
d += ` ${curve} L${x} ${bottom}`;
|
|
86
|
+
if (thumb) {
|
|
87
|
+
segment.setAttribute("d", `M${last.x} ${last.bottom} ${curve}`);
|
|
88
|
+
length += segment.getTotalLength();
|
|
89
|
+
}
|
|
90
|
+
} else d += `M${x} ${top} L${x} ${bottom}`;
|
|
91
|
+
last = {
|
|
92
|
+
x,
|
|
93
|
+
top,
|
|
94
|
+
bottom,
|
|
95
|
+
offset: length
|
|
96
|
+
};
|
|
97
|
+
positions.set(item.url, last);
|
|
98
|
+
length += bottom - top;
|
|
99
|
+
width = Math.max(width, x + 8);
|
|
100
|
+
height = Math.max(height, bottom);
|
|
101
|
+
}
|
|
102
|
+
let step = 0;
|
|
103
|
+
for (const item of items) {
|
|
104
|
+
if (item._step === void 0) continue;
|
|
105
|
+
const position = positions.get(item.url);
|
|
106
|
+
const g = steps[step++];
|
|
107
|
+
if (position) g.setAttribute("transform", `translate(${position.x}, ${(position.top + position.bottom) / 2})`);
|
|
108
|
+
}
|
|
109
|
+
path.setAttribute("d", d);
|
|
110
|
+
track.style.width = `${width}px`;
|
|
111
|
+
track.style.height = `${height}px`;
|
|
112
|
+
if (thumb) thumb.style.offsetPath = `path("${d}")`;
|
|
113
|
+
update(toc.get());
|
|
114
|
+
});
|
|
115
|
+
observer.observe(container);
|
|
116
|
+
toc.listen(update);
|
|
117
|
+
return () => {
|
|
118
|
+
observer.disconnect();
|
|
119
|
+
toc.unlisten(update);
|
|
120
|
+
};
|
|
121
|
+
}, [
|
|
122
|
+
items,
|
|
123
|
+
thumbBox,
|
|
124
|
+
toc
|
|
125
|
+
]);
|
|
160
126
|
return /* @__PURE__ */ jsxs("div", {
|
|
161
127
|
ref,
|
|
162
128
|
className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
style: { offsetPath: `path("${computed.d}")` }
|
|
181
|
-
})]
|
|
129
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
130
|
+
className: "absolute size-full [clip-path:polygon(0_0,100%_0,100%_0,0_0)] transition-[clip-path]",
|
|
131
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
132
|
+
className: "stroke-fd-primary",
|
|
133
|
+
strokeWidth: "1",
|
|
134
|
+
fill: "none"
|
|
135
|
+
}), items.map((item) => item._step !== void 0 && /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("circle", {
|
|
136
|
+
r: "8",
|
|
137
|
+
className: "fill-fd-primary"
|
|
138
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
139
|
+
textAnchor: "middle",
|
|
140
|
+
alignmentBaseline: "central",
|
|
141
|
+
dominantBaseline: "middle",
|
|
142
|
+
className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
|
|
143
|
+
children: item._step
|
|
144
|
+
})] }, item.url))]
|
|
145
|
+
}), thumbBox && /* @__PURE__ */ jsx("div", { className: "absolute left-0 size-1 bg-fd-primary rounded-full opacity-0 transition-[opacity,offset-distance]" })]
|
|
182
146
|
});
|
|
183
147
|
}
|
|
184
148
|
const BASE = 8;
|
|
@@ -256,5 +220,4 @@ function TOCItem({ item, ...props }) {
|
|
|
256
220
|
children: [svg, item.title]
|
|
257
221
|
});
|
|
258
222
|
}
|
|
259
|
-
//#endregion
|
|
260
223
|
export { TOCEmpty, TOCItem, TOCItems, default_exports };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import * as Primitive from "fumadocs-core/toc";
|
|
3
|
-
//#region src/components/toc/index.d.ts
|
|
4
3
|
export declare function useTOCItems(): Primitive.TOCItemType[];
|
|
5
4
|
export type TOCProviderProps = Primitive.AnchorProviderProps;
|
|
6
5
|
export declare const useActiveAnchor: typeof Primitive.useActiveAnchor, useActiveAnchors: typeof Primitive.useActiveAnchors, useItems: typeof Primitive.useItems;
|
|
7
6
|
export declare function TOCProvider({ toc, children, ...props }: TOCProviderProps): import("react").JSX.Element;
|
|
8
|
-
export declare function TOCScrollArea({ ref, className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function TOCScrollArea({ ref, className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { mergeRefs } from "../../utils/merge-refs.js";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { createContext, use, useRef } from "react";
|
|
7
7
|
import * as Primitive from "fumadocs-core/toc";
|
|
8
|
-
|
|
8
|
+
// src/components/toc/index.tsx
|
|
9
9
|
var toc_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
TOCProvider: () => TOCProvider,
|
|
11
11
|
TOCScrollArea: () => TOCScrollArea,
|
|
@@ -41,5 +41,4 @@ function TOCScrollArea({ ref, className, ...props }) {
|
|
|
41
41
|
})
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { TOCProvider, TOCScrollArea, toc_exports, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from "react";
|
|
2
|
-
//#region src/components/type-table.d.ts
|
|
3
2
|
export interface ParameterNode {
|
|
4
3
|
name: string;
|
|
5
4
|
description: ReactNode;
|
|
@@ -32,5 +31,4 @@ export interface TypeNode {
|
|
|
32
31
|
}
|
|
33
32
|
export declare function TypeTable({ id, type, className, ...props }: {
|
|
34
33
|
type: Record<string, TypeNode>;
|
|
35
|
-
} & ComponentProps<'div'>): import("react").JSX.Element;
|
|
36
|
-
//#endregion
|
|
34
|
+
} & ComponentProps<'div'>): import("react").JSX.Element;
|
|
@@ -7,7 +7,7 @@ import { ChevronDown } from "lucide-react";
|
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
8
8
|
import { useEffect, useState } from "react";
|
|
9
9
|
import { useTranslations } from "@fuma-translate/react";
|
|
10
|
-
|
|
10
|
+
// src/components/type-table.tsx
|
|
11
11
|
const fieldVariants = cva("text-fd-muted-foreground not-prose pe-2");
|
|
12
12
|
function TypeTable({ id, type, className, ...props }) {
|
|
13
13
|
const t = useTranslations({ note: "type table" });
|
|
@@ -113,5 +113,4 @@ function Item({ parentId, name, item: { parameters = [], description, required =
|
|
|
113
113
|
}) })]
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
//#endregion
|
|
117
116
|
export { TypeTable };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
3
|
-
//#region src/components/ui/accordion.d.ts
|
|
4
3
|
export declare function Accordion({ className, ...props }: ComponentProps<typeof Accordion$1.Root>): import("react").JSX.Element;
|
|
5
4
|
export declare function AccordionItem({ children, ...props }: ComponentProps<typeof Accordion$1.Item>): import("react").JSX.Element;
|
|
6
5
|
export declare function AccordionHeader({ className, children, ...props }: ComponentProps<typeof Accordion$1.Header>): import("react").JSX.Element;
|
|
7
6
|
export declare function AccordionTrigger({ className, children, ...props }: ComponentProps<typeof Accordion$1.Trigger>): import("react").JSX.Element;
|
|
8
|
-
export declare function AccordionContent({ className, children, ...props }: ComponentProps<typeof Accordion$1.Panel>): import("react").JSX.Element;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function AccordionContent({ className, children, ...props }: ComponentProps<typeof Accordion$1.Panel>): import("react").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../utils/cn.js";
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { ChevronRight } from "lucide-react";
|
|
5
5
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
6
|
-
|
|
6
|
+
// src/components/ui/accordion.tsx
|
|
7
7
|
function Accordion({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
9
9
|
className: (s) => cn("divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card", typeof className === "function" ? className(s) : className),
|
|
@@ -37,5 +37,4 @@ function AccordionContent({ className, children, ...props }) {
|
|
|
37
37
|
children
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
//#endregion
|
|
41
40
|
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
|
-
//#region src/components/ui/button.d.ts
|
|
3
2
|
export declare const buttonVariants: (props?: ({
|
|
4
3
|
variant?: "default" | "ghost" | "outline" | "primary" | "secondary" | null | undefined;
|
|
5
4
|
color?: "default" | "ghost" | "outline" | "primary" | "secondary" | null | undefined;
|
|
6
5
|
size?: "icon" | "icon-sm" | "icon-xs" | "sm" | null | undefined;
|
|
7
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
-
export type ButtonProps = VariantProps<typeof buttonVariants>;
|
|
9
|
-
//#endregion
|
|
7
|
+
export type ButtonProps = VariantProps<typeof buttonVariants>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
2
|
+
// src/components/ui/button.tsx
|
|
3
3
|
const primary = "bg-fd-primary text-fd-primary-foreground hover:bg-fd-primary/80";
|
|
4
4
|
const variants = {
|
|
5
5
|
default: primary,
|
|
@@ -18,5 +18,4 @@ const buttonVariants = cva("inline-flex items-center justify-center rounded-md p
|
|
|
18
18
|
"icon-xs": "p-1 [&_svg]:size-4"
|
|
19
19
|
}
|
|
20
20
|
} });
|
|
21
|
-
//#endregion
|
|
22
21
|
export { buttonVariants };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
3
|
-
//#region src/components/ui/collapsible.d.ts
|
|
4
3
|
export declare const Collapsible: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
4
|
export declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
5
|
export declare function CollapsibleContent({ children, className, ...props }: ComponentProps<typeof Collapsible$1.Panel>): import("react").JSX.Element;
|
|
7
6
|
export type CollapsibleProps = Collapsible$1.Root.Props;
|
|
8
7
|
export type CollapsibleContentProps = Collapsible$1.Panel.Props;
|
|
9
|
-
export type CollapsibleTriggerProps = Collapsible$1.Trigger.Props;
|
|
10
|
-
//#endregion
|
|
8
|
+
export type CollapsibleTriggerProps = Collapsible$1.Trigger.Props;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
5
|
-
|
|
5
|
+
// src/components/ui/collapsible.tsx
|
|
6
6
|
const Collapsible = Collapsible$1.Root;
|
|
7
7
|
const CollapsibleTrigger = Collapsible$1.Trigger;
|
|
8
8
|
function CollapsibleContent({ children, className, ...props }) {
|
|
@@ -12,5 +12,4 @@ function CollapsibleContent({ children, className, ...props }) {
|
|
|
12
12
|
children
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
3
|
-
//#region src/components/ui/popover.d.ts
|
|
4
3
|
export declare const Popover: typeof Popover$1.Root;
|
|
5
4
|
export declare const PopoverTrigger: Popover$1.Trigger;
|
|
6
5
|
export declare function PopoverContent({ className, align, sideOffset, ...props }: React$1.ComponentProps<typeof Popover$1.Popup> & Pick<Popover$1.Positioner.Props, 'sideOffset' | 'align'>): React$1.JSX.Element;
|
|
7
|
-
export declare const PopoverClose: React$1.ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
|
-
//#endregion
|
|
6
|
+
export declare const PopoverClose: React$1.ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../utils/cn.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
6
|
-
|
|
6
|
+
// src/components/ui/popover.tsx
|
|
7
7
|
const Popover = Popover$1.Root;
|
|
8
8
|
const PopoverTrigger = Popover$1.Trigger;
|
|
9
9
|
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
@@ -19,5 +19,4 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
|
|
|
19
19
|
}) });
|
|
20
20
|
}
|
|
21
21
|
const PopoverClose = Popover$1.Close;
|
|
22
|
-
//#endregion
|
|
23
22
|
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
3
|
-
//#region src/components/ui/tabs.d.ts
|
|
4
3
|
export interface TabsProps extends ComponentProps<typeof Tabs$1.Root> {
|
|
5
4
|
/**
|
|
6
5
|
* Identifier for Sharing value of tabs
|
|
@@ -19,5 +18,4 @@ export interface TabsProps extends ComponentProps<typeof Tabs$1.Root> {
|
|
|
19
18
|
export declare const TabsList: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").TabsListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
19
|
export declare function TabsTrigger({ value, ref, ...props }: ComponentProps<typeof Tabs$1.Tab>): import("react").JSX.Element;
|
|
21
20
|
export declare function Tabs({ ref, groupId, persist, updateAnchor, defaultValue, value: _value, onValueChange: _onValueChange, ...props }: TabsProps): import("react").JSX.Element;
|
|
22
|
-
export declare function TabsContent({ value, ref, ...props }: ComponentProps<typeof Tabs$1.Panel>): import("react").JSX.Element;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare function TabsContent({ value, ref, ...props }: ComponentProps<typeof Tabs$1.Panel>): import("react").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { mergeRefs } from "../../utils/merge-refs.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
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
|
+
// src/components/ui/tabs.tsx
|
|
7
7
|
const listeners = /* @__PURE__ */ new Map();
|
|
8
8
|
const TabsContext = createContext(null);
|
|
9
9
|
function useTabContext() {
|
|
@@ -109,5 +109,4 @@ function TabsContent({ value, ref, ...props }) {
|
|
|
109
109
|
children: props.children
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
//#endregion
|
|
113
112
|
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
package/dist/contexts/i18n.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { I18nConfig } from "fumadocs-core/i18n";
|
|
3
|
-
//#region src/contexts/i18n.d.ts
|
|
4
3
|
interface LocaleItem {
|
|
5
4
|
name: string;
|
|
6
5
|
locale: string;
|
|
@@ -19,5 +18,4 @@ export interface I18nProviderProps extends Partial<Pick<I18nConfig, 'defaultLang
|
|
|
19
18
|
children?: ReactNode;
|
|
20
19
|
}
|
|
21
20
|
export declare function I18nProvider({ locales, locale, defaultLanguage, hideLocale, onLocaleChange, children, translations }: I18nProviderProps): import("react").JSX.Element;
|
|
22
|
-
//#endregion
|
|
23
21
|
export {};
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -3,7 +3,7 @@ import { usePathname, useRouter } from "fumadocs-core/framework";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { createContext, use, useMemo, useRef } from "react";
|
|
5
5
|
import { TranslationProvider } from "@fuma-translate/react";
|
|
6
|
-
|
|
6
|
+
// src/contexts/i18n.tsx
|
|
7
7
|
const LocaleContext = createContext({});
|
|
8
8
|
function useI18n() {
|
|
9
9
|
return use(LocaleContext);
|
|
@@ -36,5 +36,4 @@ function I18nProvider({ locales = [], locale, defaultLanguage, hideLocale = "nev
|
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { I18nProvider, useI18n };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DefaultSearchDialogProps } from "../components/dialog/search-default.js";
|
|
2
2
|
import { ComponentType, ReactNode } from "react";
|
|
3
3
|
import { Dialog } from "@base-ui/react/dialog";
|
|
4
|
-
//#region src/contexts/search.d.ts
|
|
5
4
|
interface HotKey {
|
|
6
5
|
display: ReactNode;
|
|
7
6
|
/**
|
|
@@ -64,5 +63,4 @@ export declare function SearchProvider<DialogProps extends SharedProps = Default
|
|
|
64
63
|
export declare function SearchOnly({ children }: {
|
|
65
64
|
children: ReactNode;
|
|
66
65
|
}): ReactNode;
|
|
67
|
-
//#endregion
|
|
68
66
|
export {};
|
package/dist/contexts/search.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useHotKey } from "../utils/hotkey.js";
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Suspense, createContext, lazy, use, useMemo, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Dialog } from "@base-ui/react/dialog";
|
|
6
|
-
|
|
6
|
+
// src/contexts/search.tsx
|
|
7
7
|
/** built-in Base UI Dialog handle */
|
|
8
8
|
const dialogHandle = Dialog.createHandle();
|
|
9
9
|
const SearchContext = createContext({
|
|
@@ -62,5 +62,4 @@ function SearchProvider({ SearchDialog = DefaultSearchDialog, children, options,
|
|
|
62
62
|
function SearchOnly({ children }) {
|
|
63
63
|
if (useSearchContext().enabled) return children;
|
|
64
64
|
}
|
|
65
|
-
//#endregion
|
|
66
65
|
export { SearchOnly, SearchProvider, useSearchContext };
|
package/dist/contexts/tree.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LayoutTab } from "../layouts/shared/index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import * as PageTree from "fumadocs-core/page-tree";
|
|
4
|
-
//#region src/contexts/tree.d.ts
|
|
5
4
|
type MakeRequired<O, K extends keyof O> = Omit<O, K> & Pick<Required<O>, K>;
|
|
6
5
|
interface TreeContextType {
|
|
7
6
|
root: MakeRequired<PageTree.Root | PageTree.Folder, '$id'>;
|
|
@@ -25,5 +24,4 @@ export interface TabsGroup {
|
|
|
25
24
|
* Tabs not bound to the page tree are appended to the group of `root: true` folders.
|
|
26
25
|
*/
|
|
27
26
|
export declare function useTabsGroups(tabs: LayoutTab[]): TabsGroup[];
|
|
28
|
-
//#endregion
|
|
29
27
|
export {};
|
package/dist/contexts/tree.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { createContext, use, useMemo, useRef } from "react";
|
|
5
5
|
import * as PageTree from "fumadocs-core/page-tree";
|
|
6
6
|
import { searchPath } from "fumadocs-core/breadcrumb";
|
|
7
|
-
|
|
7
|
+
// src/contexts/tree.tsx
|
|
8
8
|
const TreeContext = createContext(null);
|
|
9
9
|
const PathContext = createContext([]);
|
|
10
10
|
function TreeContextProvider({ tree: rawTree, children }) {
|
|
@@ -87,5 +87,4 @@ function collectTabs(scope, active, page, tabs, out) {
|
|
|
87
87
|
} else if (!node.root) collectTabs(node.children, active, page, tabs, out);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
//#endregion
|
|
91
90
|
export { TreeContextProvider, useTabsGroups, useTreeContext, useTreePath };
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { I18nProviderProps } from "./contexts/i18n.js";
|
|
2
2
|
import { Translations } from "./.translations/index.js";
|
|
3
3
|
import { I18nConfig, SingularTranslationsAPI, TranslationExtension, TranslationsAPI } from "fumadocs-core/i18n";
|
|
4
|
-
//#region src/i18n.d.ts
|
|
5
4
|
export declare function uiTranslations(): TranslationExtension<keyof Translations>;
|
|
6
5
|
export declare function i18nProvider(translations: SingularTranslationsAPI): I18nProviderProps;
|
|
7
6
|
export declare function i18nProvider<Languages extends string>(translations: TranslationsAPI<Languages>, lang?: NoInfer<Languages> | (string & {})): I18nProviderProps;
|
|
@@ -11,5 +10,4 @@ export interface I18nUIConfig<Languages extends string> extends I18nConfig<Langu
|
|
|
11
10
|
export declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, localeTranslations?: Partial<Record<Languages, Record<string, string> & {
|
|
12
11
|
displayName?: string;
|
|
13
12
|
}>>): I18nUIConfig<Languages>;
|
|
14
|
-
//#endregion
|
|
15
13
|
export type { Translations };
|
package/dist/i18n.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import keys_default from "./.translations/keys.js";
|
|
2
|
-
|
|
2
|
+
// src/i18n.tsx
|
|
3
3
|
function uiTranslations() {
|
|
4
4
|
return { keys: keys_default };
|
|
5
5
|
}
|
|
@@ -39,5 +39,4 @@ function defineI18nUI(config, localeTranslations = {}) {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { defineI18nUI, i18nProvider, uiTranslations };
|
|
@@ -3,7 +3,6 @@ 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
|
-
//#region src/layouts/docs/client.d.ts
|
|
7
6
|
export interface DocsSlots extends BaseSlots {
|
|
8
7
|
container: FC<ComponentProps<'div'>>;
|
|
9
8
|
header: FC<ComponentProps<'header'>>;
|
|
@@ -30,5 +29,4 @@ export declare function useDocsLayout(): {
|
|
|
30
29
|
menuItems: LinkItemType[];
|
|
31
30
|
slots: DocsSlots;
|
|
32
31
|
};
|
|
33
|
-
//#endregion
|
|
34
32
|
export {};
|
|
@@ -11,7 +11,7 @@ import Link from "fumadocs-core/link";
|
|
|
11
11
|
import { usePathname } from "fumadocs-core/framework";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { createContext, use, useMemo } from "react";
|
|
14
|
-
|
|
14
|
+
// src/layouts/docs/client.tsx
|
|
15
15
|
const { useBaseSlots } = baseSlots({ useProps() {
|
|
16
16
|
return useDocsLayout().props;
|
|
17
17
|
} });
|
|
@@ -102,5 +102,4 @@ function LayoutTabs({ tabs: allTabs, ...props }) {
|
|
|
102
102
|
}, i))
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
//#endregion
|
|
106
105
|
export { LayoutBody, useDocsLayout, useIsDocsLayout };
|