@vx-oss/docs-react 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/css/generated/docs.css +1 -1
- package/css/generated/flux.css +1 -1
- package/css/generated/glass.css +1 -1
- package/css/generated/home.css +1 -1
- package/css/generated/notebook.css +1 -1
- package/css/generated/shared.css +1 -1
- package/css/lib/base.css +0 -127
- package/css/preset.css +1 -2
- package/css/style.css +1 -0
- package/dist/components/accordion.js +1 -68
- package/dist/components/banner.js +1 -85
- package/dist/components/callout.js +1 -60
- package/dist/components/card.js +1 -39
- package/dist/components/codeblock.js +1 -126
- package/dist/components/codeblock.rsc.js +1 -22
- package/dist/components/dialog/search-algolia.js +2 -64
- package/dist/components/dialog/search-default.js +2 -66
- package/dist/components/dialog/search-orama.js +2 -69
- package/dist/components/dialog/search.js +1 -351
- package/dist/components/dynamic-codeblock.core.js +1 -51
- package/dist/components/dynamic-codeblock.js +1 -17
- package/dist/components/files.js +1 -40
- package/dist/components/github-info.js +1 -75
- package/dist/components/heading.js +1 -38
- package/dist/components/image-zoom.js +1 -32
- package/dist/components/inline-toc.js +1 -28
- package/dist/components/sidebar/base.js +1 -277
- package/dist/components/sidebar/link-item.js +1 -37
- package/dist/components/sidebar/page-tree.js +1 -69
- package/dist/components/sidebar/tabs/dropdown.js +1 -83
- package/dist/components/sidebar/tabs/index.js +1 -46
- package/dist/components/steps.js +1 -16
- package/dist/components/tabs.js +1 -95
- package/dist/components/toc/clerk.js +1 -227
- package/dist/components/toc/default.js +1 -260
- package/dist/components/toc/index.js +1 -45
- package/dist/components/type-table.js +1 -117
- package/dist/components/ui/accordion.js +1 -42
- package/dist/components/ui/button.js +1 -20
- package/dist/components/ui/collapsible.js +1 -21
- package/dist/components/ui/popover.js +1 -20
- package/dist/components/ui/scroll-area.js +1 -34
- package/dist/components/ui/tabs.js +1 -102
- package/dist/contexts/i18n.js +1 -37
- package/dist/contexts/search.js +1 -68
- package/dist/contexts/tree.js +1 -91
- package/dist/i18n.js +1 -38
- package/dist/index.js +1 -0
- package/dist/layouts/docs/index.js +1 -23
- package/dist/layouts/docs/page/index.js +1 -124
- package/dist/layouts/docs/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/docs/page/slots/container.js +1 -22
- package/dist/layouts/docs/page/slots/footer.js +1 -56
- package/dist/layouts/docs/page/slots/toc.js +1 -182
- package/dist/layouts/docs/slots/container.js +1 -36
- package/dist/layouts/docs/slots/header.js +1 -38
- package/dist/layouts/docs/slots/sidebar.js +1 -268
- package/dist/layouts/flux/index.js +1 -146
- package/dist/layouts/flux/page/index.js +1 -104
- package/dist/layouts/flux/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/flux/page/slots/container.js +1 -22
- package/dist/layouts/flux/page/slots/footer.js +1 -56
- package/dist/layouts/flux/page/slots/toc.js +1 -181
- package/dist/layouts/flux/slots/container.js +1 -13
- package/dist/layouts/flux/slots/sidebar.js +1 -243
- package/dist/layouts/flux/slots/tab-dropdown.js +1 -88
- package/dist/layouts/glass/index.js +1 -70
- package/dist/layouts/glass/page/index.js +1 -92
- package/dist/layouts/glass/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/glass/page/slots/footer.js +1 -56
- package/dist/layouts/glass/page/slots/toc.js +1 -108
- package/dist/layouts/glass/slots/header.js +1 -68
- package/dist/layouts/glass/slots/sidebar.js +1 -267
- package/dist/layouts/home/index.js +1 -40
- package/dist/layouts/home/navbar.js +1 -34
- package/dist/layouts/home/not-found.js +1 -41
- package/dist/layouts/home/slots/container.js +1 -13
- package/dist/layouts/home/slots/header.js +1 -239
- package/dist/layouts/notebook/index.js +1 -23
- package/dist/layouts/notebook/page/index.js +1 -124
- package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -44
- package/dist/layouts/notebook/page/slots/container.js +1 -22
- package/dist/layouts/notebook/page/slots/footer.js +1 -56
- package/dist/layouts/notebook/page/slots/toc.js +1 -181
- package/dist/layouts/notebook/slots/container.js +1 -38
- package/dist/layouts/notebook/slots/header.js +1 -204
- package/dist/layouts/notebook/slots/sidebar.js +1 -240
- package/dist/layouts/shared/index.js +1 -98
- package/dist/layouts/shared/slots/language-select.js +1 -43
- package/dist/layouts/shared/slots/search-trigger.js +1 -53
- package/dist/layouts/shared/slots/theme-switch.js +1 -70
- package/dist/mdx.d.ts +2 -44
- package/dist/mdx.js +2 -70
- package/dist/mdx.server.js +2 -20
- package/dist/og/takumi.js +1 -91
- package/dist/og.js +1 -91
- package/dist/page.js +1 -33
- package/dist/primitives/accordion.js +1 -0
- package/dist/primitives/collapsible.js +1 -0
- package/dist/primitives/dialog.js +1 -0
- package/dist/primitives/direction-provider.js +1 -0
- package/dist/primitives/drawer.js +1 -0
- package/dist/primitives/navigation-menu.js +1 -0
- package/dist/primitives/popover.js +1 -0
- package/dist/primitives/scroll-area.js +1 -0
- package/dist/primitives/shared.js +1 -0
- package/dist/primitives/tabs.js +1 -0
- package/dist/provider/astro.js +1 -20
- package/dist/provider/base.js +1 -73
- package/dist/provider/next.js +1 -17
- package/dist/provider/react-router.js +1 -17
- package/dist/provider/tanstack.js +1 -17
- package/dist/provider/waku.js +1 -17
- package/dist/style.css +11577 -310
- package/dist/utils/use-copy-button.js +1 -26
- package/dist/utils/use-footer-items.js +1 -24
- package/dist/utils/use-is-scroll-top.js +1 -20
- package/package.json +28 -66
- package/css/preset-legacy.css +0 -43
- package/dist/.translations/index.d.ts +0 -55
- package/dist/.translations/keys.js +0 -55
- package/dist/_virtual/_rolldown/runtime.js +0 -13
- package/dist/components/accordion.d.ts +0 -10
- package/dist/components/banner.d.ts +0 -25
- package/dist/components/callout.d.ts +0 -21
- package/dist/components/card.d.ts +0 -13
- package/dist/components/codeblock.d.ts +0 -45
- package/dist/components/codeblock.rsc.d.ts +0 -15
- package/dist/components/dialog/search-algolia.d.ts +0 -27
- package/dist/components/dialog/search-default.d.ts +0 -29
- package/dist/components/dialog/search-orama.d.ts +0 -32
- package/dist/components/dialog/search.d.ts +0 -76
- package/dist/components/dynamic-codeblock.core.d.ts +0 -26
- package/dist/components/dynamic-codeblock.d.ts +0 -8
- package/dist/components/files.d.ts +0 -21
- package/dist/components/github-info.d.ts +0 -20
- package/dist/components/heading.d.ts +0 -9
- package/dist/components/image-zoom.d.ts +0 -18
- package/dist/components/inline-toc.d.ts +0 -10
- package/dist/components/sidebar/base.d.ts +0 -85
- package/dist/components/sidebar/link-item.d.ts +0 -12
- package/dist/components/sidebar/page-tree.d.ts +0 -20
- package/dist/components/sidebar/tabs/dropdown.d.ts +0 -15
- package/dist/components/sidebar/tabs/index.d.ts +0 -8
- package/dist/components/steps.d.ts +0 -10
- package/dist/components/tabs.d.ts +0 -33
- package/dist/components/toc/clerk.d.ts +0 -11
- package/dist/components/toc/default.d.ts +0 -13
- package/dist/components/toc/index.d.ts +0 -10
- package/dist/components/type-table.d.ts +0 -37
- package/dist/components/ui/accordion.d.ts +0 -10
- package/dist/components/ui/button.d.ts +0 -10
- package/dist/components/ui/collapsible.d.ts +0 -11
- package/dist/components/ui/navigation-menu.d.ts +0 -14
- package/dist/components/ui/navigation-menu.js +0 -41
- package/dist/components/ui/popover.d.ts +0 -9
- package/dist/components/ui/scroll-area.d.ts +0 -9
- package/dist/components/ui/tabs.d.ts +0 -23
- package/dist/contexts/i18n.d.ts +0 -34
- package/dist/contexts/search.d.ts +0 -64
- package/dist/contexts/tree.d.ts +0 -29
- package/dist/i18n.d.ts +0 -15
- package/dist/layouts/docs/client.d.ts +0 -33
- package/dist/layouts/docs/client.js +0 -94
- package/dist/layouts/docs/index.d.ts +0 -32
- package/dist/layouts/docs/page/index.d.ts +0 -76
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/docs/page/slots/container.d.ts +0 -5
- package/dist/layouts/docs/page/slots/footer.d.ts +0 -16
- package/dist/layouts/docs/page/slots/toc.d.ts +0 -47
- package/dist/layouts/docs/slots/container.d.ts +0 -5
- package/dist/layouts/docs/slots/header.d.ts +0 -5
- package/dist/layouts/docs/slots/sidebar.d.ts +0 -22
- package/dist/layouts/flux/index.d.ts +0 -61
- package/dist/layouts/flux/page/index.d.ts +0 -67
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/flux/page/slots/container.d.ts +0 -5
- package/dist/layouts/flux/page/slots/footer.d.ts +0 -16
- package/dist/layouts/flux/page/slots/toc.d.ts +0 -29
- package/dist/layouts/flux/slots/container.d.ts +0 -5
- package/dist/layouts/flux/slots/sidebar.d.ts +0 -16
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +0 -10
- package/dist/layouts/glass/index.d.ts +0 -39
- package/dist/layouts/glass/layout-tabs.js +0 -54
- package/dist/layouts/glass/page/index.d.ts +0 -31
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/glass/page/slots/footer.d.ts +0 -16
- package/dist/layouts/glass/page/slots/toc.d.ts +0 -19
- package/dist/layouts/glass/slots/header.d.ts +0 -6
- package/dist/layouts/glass/slots/sidebar.d.ts +0 -21
- package/dist/layouts/home/index.d.ts +0 -27
- package/dist/layouts/home/navbar.d.ts +0 -9
- package/dist/layouts/home/not-found.d.ts +0 -7
- package/dist/layouts/home/slots/container.d.ts +0 -5
- package/dist/layouts/home/slots/header.d.ts +0 -8
- package/dist/layouts/notebook/client.d.ts +0 -35
- package/dist/layouts/notebook/client.js +0 -69
- package/dist/layouts/notebook/index.d.ts +0 -26
- package/dist/layouts/notebook/page/index.d.ts +0 -76
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +0 -7
- package/dist/layouts/notebook/page/slots/container.d.ts +0 -5
- package/dist/layouts/notebook/page/slots/footer.d.ts +0 -16
- package/dist/layouts/notebook/page/slots/toc.d.ts +0 -47
- package/dist/layouts/notebook/slots/container.d.ts +0 -5
- package/dist/layouts/notebook/slots/header.d.ts +0 -5
- package/dist/layouts/notebook/slots/sidebar.d.ts +0 -23
- package/dist/layouts/shared/client.d.ts +0 -37
- package/dist/layouts/shared/client.js +0 -85
- package/dist/layouts/shared/index.d.ts +0 -169
- package/dist/layouts/shared/page-actions.d.ts +0 -27
- package/dist/layouts/shared/page-actions.js +0 -199
- package/dist/layouts/shared/slots/language-select.d.ts +0 -12
- package/dist/layouts/shared/slots/search-trigger.d.ts +0 -13
- package/dist/layouts/shared/slots/theme-switch.d.ts +0 -8
- package/dist/legacy/layout.d.ts +0 -29
- package/dist/legacy/layout.js +0 -44
- package/dist/legacy/sidebar.d.ts +0 -14
- package/dist/legacy/sidebar.js +0 -34
- package/dist/mdx.server.d.ts +0 -14
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +0 -30
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +0 -461
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +0 -3
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +0 -6
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +0 -17
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +0 -53
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +0 -25
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +0 -12
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +0 -45
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +0 -10
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +0 -57
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +0 -21
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +0 -14
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +0 -22
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +0 -27
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +0 -31
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +0 -75
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +0 -4
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +0 -7
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +0 -5
- package/dist/og/takumi.d.ts +0 -15
- package/dist/og.d.ts +0 -16
- package/dist/page.d.ts +0 -29
- package/dist/provider/astro.d.ts +0 -29
- package/dist/provider/base.d.ts +0 -48
- package/dist/provider/next.d.ts +0 -16
- package/dist/provider/react-router.d.ts +0 -16
- package/dist/provider/tanstack.d.ts +0 -16
- package/dist/provider/waku.d.ts +0 -16
- package/dist/utils/cn.js +0 -2
- package/dist/utils/merge-refs.js +0 -11
- package/dist/utils/urls.js +0 -15
- package/dist/utils/use-copy-button.d.ts +0 -5
- package/dist/utils/use-footer-items.d.ts +0 -8
- package/dist/utils/use-is-scroll-top.d.ts +0 -6
|
@@ -1,227 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
|
-
import { useTOCItems } from "./index.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
9
|
-
import * as Primitive from "@vx-oss/docs-core/toc";
|
|
10
|
-
//#region src/components/toc/clerk.tsx
|
|
11
|
-
var clerk_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
-
TOCEmpty: () => TOCEmpty,
|
|
13
|
-
TOCItem: () => TOCItem,
|
|
14
|
-
TOCItems: () => TOCItems
|
|
15
|
-
});
|
|
16
|
-
function TOCItems({ ref, className, children, ...props }) {
|
|
17
|
-
const containerRef = useRef(null);
|
|
18
|
-
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 += ` L ${upperX} ${upperBottom} ${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
|
-
setSvg({
|
|
81
|
-
content: output,
|
|
82
|
-
width: w,
|
|
83
|
-
height: h,
|
|
84
|
-
d,
|
|
85
|
-
itemLineLengths: [],
|
|
86
|
-
positions
|
|
87
|
-
});
|
|
88
|
-
}, [items]);
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
const container = containerRef.current;
|
|
91
|
-
if (!container) return;
|
|
92
|
-
const observer = new ResizeObserver(onPrint);
|
|
93
|
-
observer.observe(container);
|
|
94
|
-
onPrint();
|
|
95
|
-
return () => {
|
|
96
|
-
observer.unobserve(container);
|
|
97
|
-
};
|
|
98
|
-
}, [onPrint]);
|
|
99
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
-
ref: mergeRefs(containerRef, ref),
|
|
101
|
-
className: cn("relative flex flex-col", className),
|
|
102
|
-
...props,
|
|
103
|
-
children: [svg && /* @__PURE__ */ jsx(ThumbTrack, { computed: svg }), children]
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function TOCEmpty() {
|
|
107
|
-
const t = useTranslations({ note: "table of contents" });
|
|
108
|
-
return /* @__PURE__ */ jsx("div", {
|
|
109
|
-
className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
|
|
110
|
-
children: t("No Headings")
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function ThumbTrack({ computed }) {
|
|
114
|
-
const ref = useRef(null);
|
|
115
|
-
const tocInfo = Primitive.useTOC();
|
|
116
|
-
function calculate(items) {
|
|
117
|
-
const out = {};
|
|
118
|
-
const startIdx = items.findIndex((item) => item.active);
|
|
119
|
-
if (startIdx === -1) return out;
|
|
120
|
-
const endIdx = items.findLastIndex((item) => item.active);
|
|
121
|
-
out["--track-top"] = `${computed.positions[startIdx][0]}px`;
|
|
122
|
-
out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
|
|
123
|
-
return out;
|
|
124
|
-
}
|
|
125
|
-
Primitive.useTOCListener((items) => {
|
|
126
|
-
const element = ref.current;
|
|
127
|
-
if (!element) return;
|
|
128
|
-
for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
|
|
129
|
-
});
|
|
130
|
-
return /* @__PURE__ */ jsx("div", {
|
|
131
|
-
ref,
|
|
132
|
-
className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
|
|
133
|
-
style: {
|
|
134
|
-
width: computed.width,
|
|
135
|
-
height: computed.height,
|
|
136
|
-
...calculate(tocInfo.get())
|
|
137
|
-
},
|
|
138
|
-
children: /* @__PURE__ */ jsx("svg", {
|
|
139
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
140
|
-
viewBox: `0 0 ${computed.width} ${computed.height}`,
|
|
141
|
-
className: "absolute transition-[clip-path]",
|
|
142
|
-
style: {
|
|
143
|
-
width: computed.width,
|
|
144
|
-
height: computed.height,
|
|
145
|
-
clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))`
|
|
146
|
-
},
|
|
147
|
-
children: computed.content
|
|
148
|
-
})
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
const BASE = 8;
|
|
152
|
-
function getItemOffset(depth) {
|
|
153
|
-
if (depth <= 2) return 20;
|
|
154
|
-
if (depth === 3) return 32;
|
|
155
|
-
return 44;
|
|
156
|
-
}
|
|
157
|
-
function getLineOffset(depth) {
|
|
158
|
-
if (depth <= 2) return BASE;
|
|
159
|
-
if (depth === 3) return 20;
|
|
160
|
-
return 32;
|
|
161
|
-
}
|
|
162
|
-
function TOCItem({ item, ...props }) {
|
|
163
|
-
const items = useTOCItems();
|
|
164
|
-
const { isFirst, isLast, svg } = useMemo(() => {
|
|
165
|
-
const index = items.indexOf(item);
|
|
166
|
-
const isFirst = index === 0;
|
|
167
|
-
const isLast = index === items.length - 1;
|
|
168
|
-
const l1 = getLineOffset(item.depth);
|
|
169
|
-
const l0 = isFirst ? l1 : getLineOffset(items[index - 1].depth);
|
|
170
|
-
const l2 = isLast ? l1 : getLineOffset(items[index + 1].depth);
|
|
171
|
-
return {
|
|
172
|
-
isFirst,
|
|
173
|
-
isLast,
|
|
174
|
-
svg: /* @__PURE__ */ jsxs("svg", {
|
|
175
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
176
|
-
className: cn("absolute -top-1.5 inset-s-0 bottom-0 h-[calc(100%+--spacing(1.5))] -z-1 rtl:-scale-x-100", l1 !== l2 && "h-full bottom-1.5"),
|
|
177
|
-
style: { width: Math.max(l0, l1) + 9 },
|
|
178
|
-
children: [
|
|
179
|
-
l0 !== l1 && /* @__PURE__ */ jsx("path", {
|
|
180
|
-
d: `M ${l0 + .5} 0 L ${l0 + .5} 0 ${l1 + .5} 12`,
|
|
181
|
-
stroke: "black",
|
|
182
|
-
strokeWidth: "1",
|
|
183
|
-
fill: "none",
|
|
184
|
-
className: "stroke-fd-foreground/10"
|
|
185
|
-
}),
|
|
186
|
-
/* @__PURE__ */ jsx("line", {
|
|
187
|
-
x1: l1 + .5,
|
|
188
|
-
y1: l0 === l1 ? "6" : "12",
|
|
189
|
-
x2: l1 + .5,
|
|
190
|
-
y2: "100%",
|
|
191
|
-
strokeWidth: "1",
|
|
192
|
-
className: "stroke-fd-foreground/10"
|
|
193
|
-
}),
|
|
194
|
-
item._step !== void 0 && /* @__PURE__ */ jsxs("g", {
|
|
195
|
-
transform: `translate(${l1 + .5}, ${l1 === l2 ? "3" : "6"})`,
|
|
196
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
197
|
-
cx: "0",
|
|
198
|
-
cy: "50%",
|
|
199
|
-
r: "8",
|
|
200
|
-
className: "fill-fd-muted"
|
|
201
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
202
|
-
x: "0",
|
|
203
|
-
y: "50%",
|
|
204
|
-
textAnchor: "middle",
|
|
205
|
-
alignmentBaseline: "central",
|
|
206
|
-
dominantBaseline: "middle",
|
|
207
|
-
className: "fill-fd-muted-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
|
|
208
|
-
children: item._step
|
|
209
|
-
})]
|
|
210
|
-
})
|
|
211
|
-
]
|
|
212
|
-
})
|
|
213
|
-
};
|
|
214
|
-
}, [items, item]);
|
|
215
|
-
return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
|
|
216
|
-
href: item.url,
|
|
217
|
-
...props,
|
|
218
|
-
className: cn("prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere data-[active=true]:text-fd-primary", isFirst && "pt-0", isLast && "pb-0", props.className),
|
|
219
|
-
style: {
|
|
220
|
-
paddingInlineStart: getItemOffset(item.depth),
|
|
221
|
-
...props.style
|
|
222
|
-
},
|
|
223
|
-
children: [svg, item.title]
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
//#endregion
|
|
227
|
-
export { TOCEmpty, TOCItem, TOCItems, clerk_exports };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/toc/clerk';
|
|
@@ -1,260 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
|
-
import { useTOCItems } from "./index.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
9
|
-
import * as Primitive from "@vx-oss/docs-core/toc";
|
|
10
|
-
//#region src/components/toc/default.tsx
|
|
11
|
-
var default_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
-
TOCEmpty: () => TOCEmpty,
|
|
13
|
-
TOCItem: () => TOCItem,
|
|
14
|
-
TOCItems: () => TOCItems
|
|
15
|
-
});
|
|
16
|
-
function TOCItems({ ref, className, thumbBox = true, children, ...props }) {
|
|
17
|
-
const containerRef = useRef(null);
|
|
18
|
-
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
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
112
|
-
ref: mergeRefs(containerRef, ref),
|
|
113
|
-
className: cn("relative flex flex-col", className),
|
|
114
|
-
...props,
|
|
115
|
-
children: [svg && /* @__PURE__ */ jsx(ThumbTrack, {
|
|
116
|
-
computed: svg,
|
|
117
|
-
thumbBox
|
|
118
|
-
}), children]
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function TOCEmpty() {
|
|
122
|
-
const t = useTranslations({ note: "table of contents" });
|
|
123
|
-
return /* @__PURE__ */ jsx("div", {
|
|
124
|
-
className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
|
|
125
|
-
children: t("No Headings")
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function ThumbTrack({ computed, thumbBox }) {
|
|
129
|
-
const ref = useRef(null);
|
|
130
|
-
const previousRef = useRef(null);
|
|
131
|
-
const tocInfo = Primitive.useTOC();
|
|
132
|
-
function calculate(items) {
|
|
133
|
-
const out = {};
|
|
134
|
-
const startIdx = items.findIndex((item) => item.active);
|
|
135
|
-
if (startIdx === -1) return out;
|
|
136
|
-
const endIdx = items.findLastIndex((item) => item.active);
|
|
137
|
-
out["--track-top"] = `${computed.positions[startIdx][0]}px`;
|
|
138
|
-
out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
|
|
139
|
-
if (thumbBox) {
|
|
140
|
-
let isUp = false;
|
|
141
|
-
if (previousRef.current) {
|
|
142
|
-
const prev = previousRef.current;
|
|
143
|
-
isUp = prev.startIdx > startIdx || prev.endIdx > endIdx || prev.startIdx === startIdx && prev.endIdx === endIdx && prev.isUp;
|
|
144
|
-
}
|
|
145
|
-
previousRef.current = {
|
|
146
|
-
startIdx,
|
|
147
|
-
endIdx,
|
|
148
|
-
isUp
|
|
149
|
-
};
|
|
150
|
-
out["--offset-distance"] = isUp ? `${computed.itemLineLengths[startIdx][0]}px` : `${computed.itemLineLengths[endIdx][1]}px`;
|
|
151
|
-
out["--opacity"] = items[isUp ? startIdx : endIdx].original._step !== void 0 ? "0" : "1";
|
|
152
|
-
}
|
|
153
|
-
return out;
|
|
154
|
-
}
|
|
155
|
-
Primitive.useTOCListener((items) => {
|
|
156
|
-
const element = ref.current;
|
|
157
|
-
if (!element) return;
|
|
158
|
-
for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
|
|
159
|
-
});
|
|
160
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
161
|
-
ref,
|
|
162
|
-
className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
|
|
163
|
-
style: {
|
|
164
|
-
width: computed.width,
|
|
165
|
-
height: computed.height,
|
|
166
|
-
...calculate(tocInfo.get())
|
|
167
|
-
},
|
|
168
|
-
children: [/* @__PURE__ */ jsx("svg", {
|
|
169
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
170
|
-
viewBox: `0 0 ${computed.width} ${computed.height}`,
|
|
171
|
-
className: "absolute transition-[clip-path]",
|
|
172
|
-
style: {
|
|
173
|
-
width: computed.width,
|
|
174
|
-
height: computed.height,
|
|
175
|
-
clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))`
|
|
176
|
-
},
|
|
177
|
-
children: computed.content
|
|
178
|
-
}), thumbBox && /* @__PURE__ */ jsx("div", {
|
|
179
|
-
className: "absolute left-0 size-1 bg-fd-primary rounded-full [offset-distance:var(--offset-distance,0)] opacity-(--opacity,0) transition-[opacity,offset-distance]",
|
|
180
|
-
style: { offsetPath: `path("${computed.d}")` }
|
|
181
|
-
})]
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
const BASE = 8;
|
|
185
|
-
function getItemOffset(depth) {
|
|
186
|
-
if (depth <= 2) return 20;
|
|
187
|
-
if (depth === 3) return 32;
|
|
188
|
-
return 44;
|
|
189
|
-
}
|
|
190
|
-
function getLineOffset(depth) {
|
|
191
|
-
if (depth <= 2) return BASE;
|
|
192
|
-
if (depth === 3) return 16;
|
|
193
|
-
return 24;
|
|
194
|
-
}
|
|
195
|
-
function TOCItem({ item, ...props }) {
|
|
196
|
-
const items = useTOCItems();
|
|
197
|
-
const { isFirst, isLast, svg } = useMemo(() => {
|
|
198
|
-
const index = items.indexOf(item);
|
|
199
|
-
const isFirst = index === 0;
|
|
200
|
-
const isLast = index === items.length - 1;
|
|
201
|
-
const l1 = getLineOffset(item.depth);
|
|
202
|
-
const l0 = isFirst ? l1 : getLineOffset(items[index - 1].depth);
|
|
203
|
-
const l2 = isLast ? l1 : getLineOffset(items[index + 1].depth);
|
|
204
|
-
return {
|
|
205
|
-
isFirst,
|
|
206
|
-
isLast,
|
|
207
|
-
svg: /* @__PURE__ */ jsxs("svg", {
|
|
208
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
209
|
-
className: cn("absolute -top-1.5 inset-s-0 bottom-0 h-[calc(100%+--spacing(1.5))] -z-1 rtl:-scale-x-100", l1 !== l2 && "h-full bottom-1.5"),
|
|
210
|
-
style: { width: Math.max(l0, l1) + 9 },
|
|
211
|
-
children: [
|
|
212
|
-
l0 !== l1 && /* @__PURE__ */ jsx("path", {
|
|
213
|
-
d: `M ${l0 + .5} 0 C ${l0 + .5} 8 ${l1 + .5} 4 ${l1 + .5} 12`,
|
|
214
|
-
stroke: "black",
|
|
215
|
-
strokeWidth: "1",
|
|
216
|
-
fill: "none",
|
|
217
|
-
className: "stroke-fd-foreground/10"
|
|
218
|
-
}),
|
|
219
|
-
/* @__PURE__ */ jsx("line", {
|
|
220
|
-
x1: l1 + .5,
|
|
221
|
-
y1: l0 === l1 ? "6" : "12",
|
|
222
|
-
x2: l1 + .5,
|
|
223
|
-
y2: "100%",
|
|
224
|
-
strokeWidth: "1",
|
|
225
|
-
className: "stroke-fd-foreground/10"
|
|
226
|
-
}),
|
|
227
|
-
item._step !== void 0 && /* @__PURE__ */ jsxs("g", {
|
|
228
|
-
transform: `translate(${l1 + .5}, ${l1 === l2 ? "3" : "6"})`,
|
|
229
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
230
|
-
cx: "0",
|
|
231
|
-
cy: "50%",
|
|
232
|
-
r: "8",
|
|
233
|
-
className: "fill-fd-muted"
|
|
234
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
235
|
-
x: "0",
|
|
236
|
-
y: "50%",
|
|
237
|
-
textAnchor: "middle",
|
|
238
|
-
alignmentBaseline: "central",
|
|
239
|
-
dominantBaseline: "middle",
|
|
240
|
-
className: "fill-fd-muted-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
|
|
241
|
-
children: item._step
|
|
242
|
-
})]
|
|
243
|
-
})
|
|
244
|
-
]
|
|
245
|
-
})
|
|
246
|
-
};
|
|
247
|
-
}, [items, item]);
|
|
248
|
-
return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
|
|
249
|
-
href: item.url,
|
|
250
|
-
...props,
|
|
251
|
-
className: cn("prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere data-[active=true]:text-fd-primary", isFirst && "pt-0", isLast && "pb-0", props.className),
|
|
252
|
-
style: {
|
|
253
|
-
paddingInlineStart: getItemOffset(item.depth),
|
|
254
|
-
...props.style
|
|
255
|
-
},
|
|
256
|
-
children: [svg, item.title]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
//#endregion
|
|
260
|
-
export { TOCEmpty, TOCItem, TOCItems, default_exports };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/toc/default';
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { createContext, use, useRef } from "react";
|
|
7
|
-
import * as Primitive from "@vx-oss/docs-core/toc";
|
|
8
|
-
//#region src/components/toc/index.tsx
|
|
9
|
-
var toc_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
TOCProvider: () => TOCProvider,
|
|
11
|
-
TOCScrollArea: () => TOCScrollArea,
|
|
12
|
-
useActiveAnchor: () => useActiveAnchor,
|
|
13
|
-
useActiveAnchors: () => useActiveAnchors,
|
|
14
|
-
useItems: () => useItems,
|
|
15
|
-
useTOCItems: () => useTOCItems
|
|
16
|
-
});
|
|
17
|
-
const TOCContext = createContext([]);
|
|
18
|
-
function useTOCItems() {
|
|
19
|
-
return use(TOCContext);
|
|
20
|
-
}
|
|
21
|
-
const { useActiveAnchor, useActiveAnchors, useItems } = Primitive;
|
|
22
|
-
function TOCProvider({ toc, children, ...props }) {
|
|
23
|
-
return /* @__PURE__ */ jsx(TOCContext, {
|
|
24
|
-
value: toc,
|
|
25
|
-
children: /* @__PURE__ */ jsx(Primitive.AnchorProvider, {
|
|
26
|
-
toc,
|
|
27
|
-
...props,
|
|
28
|
-
children
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function TOCScrollArea({ ref, className, ...props }) {
|
|
33
|
-
const viewRef = useRef(null);
|
|
34
|
-
return /* @__PURE__ */ jsx("div", {
|
|
35
|
-
ref: mergeRefs(viewRef, ref),
|
|
36
|
-
className: cn("relative min-h-0 text-sm ms-px overflow-auto overscroll-contain [scrollbar-width:none] mask-[linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)] py-3", className),
|
|
37
|
-
...props,
|
|
38
|
-
children: /* @__PURE__ */ jsx(Primitive.ScrollProvider, {
|
|
39
|
-
containerRef: viewRef,
|
|
40
|
-
children: props.children
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { TOCProvider, TOCScrollArea, toc_exports, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/toc';
|
|
@@ -1,117 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
4
|
-
import Link from "@vx-oss/docs-core/link";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { ChevronDown } from "lucide-react";
|
|
7
|
-
import { cva } from "class-variance-authority";
|
|
8
|
-
import { useEffect, useState } from "react";
|
|
9
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
10
|
-
//#region src/components/type-table.tsx
|
|
11
|
-
const fieldVariants = cva("text-fd-muted-foreground not-prose pe-2");
|
|
12
|
-
function TypeTable({ id, type, className, ...props }) {
|
|
13
|
-
const t = useTranslations({ note: "type table" });
|
|
14
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
-
id,
|
|
16
|
-
className: cn("@container flex flex-col p-1 bg-fd-card text-fd-card-foreground rounded-2xl border my-6 text-sm overflow-hidden", className),
|
|
17
|
-
...props,
|
|
18
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
19
|
-
className: "flex font-medium items-center px-3 py-1 not-prose text-fd-muted-foreground",
|
|
20
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
21
|
-
className: "w-1/4",
|
|
22
|
-
children: t("Prop")
|
|
23
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
24
|
-
className: "@max-xl:hidden",
|
|
25
|
-
children: t("Type")
|
|
26
|
-
})]
|
|
27
|
-
}), Object.entries(type).map(([key, value]) => /* @__PURE__ */ jsx(Item, {
|
|
28
|
-
parentId: id,
|
|
29
|
-
name: key,
|
|
30
|
-
item: value
|
|
31
|
-
}, key))]
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function Item({ parentId, name, item: { parameters = [], description, required = false, deprecated, typeDescription, default: defaultValue, type, typeDescriptionLink, returns } }) {
|
|
35
|
-
const t = useTranslations({ note: "type table" });
|
|
36
|
-
const [open, setOpen] = useState(false);
|
|
37
|
-
const id = parentId ? `${parentId}-${name}` : void 0;
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
const hash = window.location.hash;
|
|
40
|
-
if (!id || !hash) return;
|
|
41
|
-
if (`#${id}` === hash) setOpen(true);
|
|
42
|
-
}, [id]);
|
|
43
|
-
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
44
|
-
id,
|
|
45
|
-
open,
|
|
46
|
-
onOpenChange: (v) => {
|
|
47
|
-
if (v && id) window.history.replaceState(null, "", `#${id}`);
|
|
48
|
-
setOpen(v);
|
|
49
|
-
},
|
|
50
|
-
className: cn("rounded-xl border overflow-hidden scroll-m-20 transition-all", open ? "shadow-sm bg-fd-background not-last:mb-2" : "border-transparent"),
|
|
51
|
-
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
52
|
-
className: "relative flex flex-row items-center w-full group text-start px-3 py-2 not-prose hover:bg-fd-accent",
|
|
53
|
-
children: [
|
|
54
|
-
/* @__PURE__ */ jsxs("code", {
|
|
55
|
-
className: cn("text-fd-primary min-w-fit w-1/4 font-mono font-medium pe-2", deprecated && "line-through text-fd-primary/50"),
|
|
56
|
-
children: [name, !required && "?"]
|
|
57
|
-
}),
|
|
58
|
-
typeDescriptionLink ? /* @__PURE__ */ jsx(Link, {
|
|
59
|
-
href: typeDescriptionLink,
|
|
60
|
-
className: "underline @max-xl:hidden",
|
|
61
|
-
children: type
|
|
62
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
63
|
-
className: "@max-xl:hidden",
|
|
64
|
-
children: type
|
|
65
|
-
}),
|
|
66
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "absolute end-2 size-4 text-fd-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
|
|
67
|
-
]
|
|
68
|
-
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
69
|
-
className: "grid grid-cols-[1fr_3fr] gap-y-4 text-sm p-3 overflow-auto fd-scroll-container border-t",
|
|
70
|
-
children: [
|
|
71
|
-
/* @__PURE__ */ jsx("div", {
|
|
72
|
-
className: "text-sm prose col-span-full prose-no-margin empty:hidden",
|
|
73
|
-
children: description
|
|
74
|
-
}),
|
|
75
|
-
typeDescription && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
76
|
-
className: cn(fieldVariants()),
|
|
77
|
-
children: t("Type")
|
|
78
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
79
|
-
className: "my-auto not-prose",
|
|
80
|
-
children: typeDescription
|
|
81
|
-
})] }),
|
|
82
|
-
defaultValue && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
83
|
-
className: cn(fieldVariants()),
|
|
84
|
-
children: t("Default")
|
|
85
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
86
|
-
className: "my-auto not-prose",
|
|
87
|
-
children: defaultValue
|
|
88
|
-
})] }),
|
|
89
|
-
parameters.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
90
|
-
className: cn(fieldVariants()),
|
|
91
|
-
children: t("Parameters")
|
|
92
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
93
|
-
className: "flex flex-col gap-2",
|
|
94
|
-
children: parameters.map((param) => /* @__PURE__ */ jsxs("div", {
|
|
95
|
-
className: "inline-flex items-center flex-wrap gap-1",
|
|
96
|
-
children: [/* @__PURE__ */ jsxs("p", {
|
|
97
|
-
className: "font-medium not-prose text-nowrap",
|
|
98
|
-
children: [param.name, " -"]
|
|
99
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
100
|
-
className: "text-sm prose prose-no-margin",
|
|
101
|
-
children: param.description
|
|
102
|
-
})]
|
|
103
|
-
}, param.name))
|
|
104
|
-
})] }),
|
|
105
|
-
returns && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
106
|
-
className: cn(fieldVariants()),
|
|
107
|
-
children: t("Returns")
|
|
108
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
109
|
-
className: "my-auto text-sm prose prose-no-margin",
|
|
110
|
-
children: returns
|
|
111
|
-
})] })
|
|
112
|
-
]
|
|
113
|
-
}) })]
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
|
-
export { TypeTable };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/type-table';
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { ChevronRight } from "lucide-react";
|
|
5
|
-
import * as Primitive from "@radix-ui/react-accordion";
|
|
6
|
-
//#region src/components/ui/accordion.tsx
|
|
7
|
-
function Accordion({ className, ...props }) {
|
|
8
|
-
return /* @__PURE__ */ jsx(Primitive.Root, {
|
|
9
|
-
className: cn("divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card", className),
|
|
10
|
-
...props
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function AccordionItem({ className, children, ...props }) {
|
|
14
|
-
return /* @__PURE__ */ jsx(Primitive.Item, {
|
|
15
|
-
className: cn("scroll-m-24", className),
|
|
16
|
-
...props,
|
|
17
|
-
children
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function AccordionHeader({ className, children, ...props }) {
|
|
21
|
-
return /* @__PURE__ */ jsx(Primitive.Header, {
|
|
22
|
-
className: cn("not-prose flex flex-row items-center text-fd-card-foreground font-medium has-focus-visible:bg-fd-accent", className),
|
|
23
|
-
...props,
|
|
24
|
-
children
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function AccordionTrigger({ className, children, ...props }) {
|
|
28
|
-
return /* @__PURE__ */ jsxs(Primitive.Trigger, {
|
|
29
|
-
className: cn("group flex flex-1 items-center gap-2 px-3 py-2.5 text-start focus-visible:outline-none", className),
|
|
30
|
-
...props,
|
|
31
|
-
children: [/* @__PURE__ */ jsx(ChevronRight, { className: "size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-90" }), children]
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function AccordionContent({ className, children, ...props }) {
|
|
35
|
-
return /* @__PURE__ */ jsx(Primitive.Content, {
|
|
36
|
-
className: cn("overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down", className),
|
|
37
|
-
...props,
|
|
38
|
-
children
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/ui/accordion';
|