@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,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/components/ui/button.tsx
|
|
3
|
-
const variants = {
|
|
4
|
-
primary: "bg-fd-primary text-fd-primary-foreground hover:bg-fd-primary/80 disabled:bg-fd-secondary disabled:text-fd-secondary-foreground",
|
|
5
|
-
outline: "border hover:bg-fd-accent hover:text-fd-accent-foreground",
|
|
6
|
-
ghost: "hover:bg-fd-accent hover:text-fd-accent-foreground",
|
|
7
|
-
secondary: "border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
8
|
-
};
|
|
9
|
-
const buttonVariants = cva("inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring", { variants: {
|
|
10
|
-
variant: variants,
|
|
11
|
-
color: variants,
|
|
12
|
-
size: {
|
|
13
|
-
sm: "gap-1 px-2 py-1.5 text-xs",
|
|
14
|
-
icon: "p-1.5 [&_svg]:size-5",
|
|
15
|
-
"icon-sm": "p-1.5 [&_svg]:size-4.5",
|
|
16
|
-
"icon-xs": "p-1 [&_svg]:size-4"
|
|
17
|
-
}
|
|
18
|
-
} });
|
|
19
|
-
//#endregion
|
|
20
|
-
export { buttonVariants };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/ui/button';
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
import * as Primitive from "@radix-ui/react-collapsible";
|
|
6
|
-
//#region src/components/ui/collapsible.tsx
|
|
7
|
-
const Collapsible = Primitive.Root;
|
|
8
|
-
const CollapsibleTrigger = Primitive.CollapsibleTrigger;
|
|
9
|
-
function CollapsibleContent({ children, ...props }) {
|
|
10
|
-
const [mounted, setMounted] = useState(false);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
setMounted(true);
|
|
13
|
-
}, []);
|
|
14
|
-
return /* @__PURE__ */ jsx(Primitive.CollapsibleContent, {
|
|
15
|
-
...props,
|
|
16
|
-
className: cn("overflow-hidden", mounted && "data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down", props.className),
|
|
17
|
-
children
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/ui/collapsible';
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import "react";
|
|
5
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
6
|
-
//#region src/components/ui/popover.tsx
|
|
7
|
-
const Popover = PopoverPrimitive.Root;
|
|
8
|
-
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
9
|
-
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
10
|
-
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
|
|
11
|
-
align,
|
|
12
|
-
sideOffset,
|
|
13
|
-
side: "bottom",
|
|
14
|
-
className: cn("z-50 origin-(--radix-popover-content-transform-origin) overflow-y-auto max-h-(--radix-popover-content-available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in", className),
|
|
15
|
-
...props
|
|
16
|
-
}) });
|
|
17
|
-
}
|
|
18
|
-
const PopoverClose = PopoverPrimitive.PopoverClose;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/ui/popover';
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import "react";
|
|
4
|
-
import * as Primitive from "@radix-ui/react-scroll-area";
|
|
5
|
-
//#region src/components/ui/scroll-area.tsx
|
|
6
|
-
function ScrollArea({ className, children, ...props }) {
|
|
7
|
-
return /* @__PURE__ */ jsxs(Primitive.Root, {
|
|
8
|
-
type: "scroll",
|
|
9
|
-
className: cn("overflow-hidden", className),
|
|
10
|
-
...props,
|
|
11
|
-
children: [
|
|
12
|
-
children,
|
|
13
|
-
/* @__PURE__ */ jsx(Primitive.Corner, {}),
|
|
14
|
-
/* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
|
|
15
|
-
]
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function ScrollViewport({ className, children, ...props }) {
|
|
19
|
-
return /* @__PURE__ */ jsx(Primitive.Viewport, {
|
|
20
|
-
className: cn("size-full rounded-[inherit]", className),
|
|
21
|
-
...props,
|
|
22
|
-
children
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
26
|
-
return /* @__PURE__ */ jsx(Primitive.Scrollbar, {
|
|
27
|
-
orientation,
|
|
28
|
-
className: cn("flex select-none data-[state=hidden]:animate-fd-fade-out", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", className),
|
|
29
|
-
...props,
|
|
30
|
-
children: /* @__PURE__ */ jsx(Primitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-fd-border" })
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { ScrollArea, ScrollBar, ScrollViewport };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/ui/scroll-area';
|
|
@@ -1,102 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createContext, use, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import * as Primitive from "@radix-ui/react-tabs";
|
|
6
|
-
//#region src/components/ui/tabs.tsx
|
|
7
|
-
const listeners = /* @__PURE__ */ new Map();
|
|
8
|
-
const TabsContext = createContext(null);
|
|
9
|
-
function useTabContext() {
|
|
10
|
-
const ctx = use(TabsContext);
|
|
11
|
-
if (!ctx) throw new Error("You must wrap your component in <Tabs>");
|
|
12
|
-
return ctx;
|
|
13
|
-
}
|
|
14
|
-
const TabsList = Primitive.TabsList;
|
|
15
|
-
const TabsTrigger = Primitive.TabsTrigger;
|
|
16
|
-
function Tabs({ ref, groupId, persist = false, updateAnchor = false, defaultValue, value: _value, onValueChange: _onValueChange, ...props }) {
|
|
17
|
-
const tabsRef = useRef(null);
|
|
18
|
-
const valueToIdMap = useMemo(() => /* @__PURE__ */ new Map(), []);
|
|
19
|
-
const panels = useMemo(() => /* @__PURE__ */ new Map(), []);
|
|
20
|
-
const [value, setValue] = _value === void 0 ? useState(defaultValue) : [_value, useEffectEvent((v) => _onValueChange?.(v))];
|
|
21
|
-
useLayoutEffect(() => {
|
|
22
|
-
if (!groupId) return;
|
|
23
|
-
let previous = sessionStorage.getItem(groupId);
|
|
24
|
-
if (persist) previous ??= localStorage.getItem(groupId);
|
|
25
|
-
if (previous) setValue(previous);
|
|
26
|
-
const groupListeners = listeners.get(groupId) ?? /* @__PURE__ */ new Set();
|
|
27
|
-
groupListeners.add(setValue);
|
|
28
|
-
listeners.set(groupId, groupListeners);
|
|
29
|
-
return () => {
|
|
30
|
-
groupListeners.delete(setValue);
|
|
31
|
-
};
|
|
32
|
-
}, [
|
|
33
|
-
groupId,
|
|
34
|
-
persist,
|
|
35
|
-
setValue
|
|
36
|
-
]);
|
|
37
|
-
useLayoutEffect(() => {
|
|
38
|
-
const openFromHash = () => {
|
|
39
|
-
const hash = window.location.hash.slice(1);
|
|
40
|
-
if (!hash) return;
|
|
41
|
-
for (const [value, id] of valueToIdMap.entries()) if (id === hash) {
|
|
42
|
-
setValue(value);
|
|
43
|
-
tabsRef.current?.scrollIntoView();
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const target = document.getElementById(hash);
|
|
47
|
-
if (!target) return;
|
|
48
|
-
for (const [value, panel] of panels.entries()) {
|
|
49
|
-
if (!panel.contains(target)) continue;
|
|
50
|
-
setValue(value);
|
|
51
|
-
requestAnimationFrame(() => target.scrollIntoView());
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
openFromHash();
|
|
56
|
-
window.addEventListener("hashchange", openFromHash);
|
|
57
|
-
return () => window.removeEventListener("hashchange", openFromHash);
|
|
58
|
-
}, [
|
|
59
|
-
setValue,
|
|
60
|
-
valueToIdMap,
|
|
61
|
-
panels
|
|
62
|
-
]);
|
|
63
|
-
return /* @__PURE__ */ jsx(Primitive.Tabs, {
|
|
64
|
-
ref: mergeRefs(ref, tabsRef),
|
|
65
|
-
value,
|
|
66
|
-
onValueChange: (v) => {
|
|
67
|
-
if (updateAnchor) {
|
|
68
|
-
const id = valueToIdMap.get(v);
|
|
69
|
-
if (id) window.history.replaceState(null, "", `#${id}`);
|
|
70
|
-
}
|
|
71
|
-
if (groupId) {
|
|
72
|
-
const groupListeners = listeners.get(groupId);
|
|
73
|
-
if (groupListeners) for (const listener of groupListeners) listener(v);
|
|
74
|
-
sessionStorage.setItem(groupId, v);
|
|
75
|
-
if (persist) localStorage.setItem(groupId, v);
|
|
76
|
-
} else setValue(v);
|
|
77
|
-
},
|
|
78
|
-
...props,
|
|
79
|
-
children: /* @__PURE__ */ jsx(TabsContext, {
|
|
80
|
-
value: useMemo(() => ({
|
|
81
|
-
valueToIdMap,
|
|
82
|
-
panels
|
|
83
|
-
}), [valueToIdMap, panels]),
|
|
84
|
-
children: props.children
|
|
85
|
-
})
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function TabsContent({ value, ref, ...props }) {
|
|
89
|
-
const { valueToIdMap, panels } = useTabContext();
|
|
90
|
-
if (props.id) valueToIdMap.set(value, props.id);
|
|
91
|
-
return /* @__PURE__ */ jsx(Primitive.TabsContent, {
|
|
92
|
-
ref: mergeRefs(ref, (element) => {
|
|
93
|
-
if (element) panels.set(value, element);
|
|
94
|
-
else panels.delete(value);
|
|
95
|
-
}),
|
|
96
|
-
value,
|
|
97
|
-
...props,
|
|
98
|
-
children: props.children
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/ui/tabs';
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { usePathname, useRouter } from "@vx-oss/docs-core/framework";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createContext, use, useMemo, useRef } from "react";
|
|
5
|
-
import { TranslationProvider } from "@fuma-translate/react";
|
|
6
|
-
//#region src/contexts/i18n.tsx
|
|
7
|
-
const LocaleContext = createContext({});
|
|
8
|
-
function useI18n() {
|
|
9
|
-
return use(LocaleContext);
|
|
10
|
-
}
|
|
11
|
-
const Empty = {};
|
|
12
|
-
function I18nProvider({ locales = [], locale, onLocaleChange, children, translations = Empty }) {
|
|
13
|
-
const router = useRouter();
|
|
14
|
-
const pathname = usePathname();
|
|
15
|
-
const onChange = (value) => {
|
|
16
|
-
if (onLocaleChange) return onLocaleChange(value);
|
|
17
|
-
const segments = pathname.split("/").filter((v) => v.length > 0);
|
|
18
|
-
if (segments.length === 0 || segments[0] !== locale) segments.unshift(value);
|
|
19
|
-
else segments[0] = value;
|
|
20
|
-
router.push(`/${segments.join("/")}`);
|
|
21
|
-
};
|
|
22
|
-
const onChangeRef = useRef(onChange);
|
|
23
|
-
onChangeRef.current = onChange;
|
|
24
|
-
return /* @__PURE__ */ jsx(LocaleContext, {
|
|
25
|
-
value: useMemo(() => ({
|
|
26
|
-
locale,
|
|
27
|
-
locales,
|
|
28
|
-
onChange: (v) => onChangeRef.current(v)
|
|
29
|
-
}), [locale, locales]),
|
|
30
|
-
children: /* @__PURE__ */ jsx(TranslationProvider, {
|
|
31
|
-
translations,
|
|
32
|
-
children
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { I18nProvider, useI18n };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/contexts/i18n';
|
package/dist/contexts/search.js
CHANGED
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Suspense, createContext, lazy, use, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
4
|
-
//#region src/contexts/search.tsx
|
|
5
|
-
const SearchContext = createContext({
|
|
6
|
-
enabled: false,
|
|
7
|
-
open: false,
|
|
8
|
-
hotKey: [],
|
|
9
|
-
setOpenSearch: () => void 0
|
|
10
|
-
});
|
|
11
|
-
function useSearchContext() {
|
|
12
|
-
return use(SearchContext);
|
|
13
|
-
}
|
|
14
|
-
function MetaOrControl() {
|
|
15
|
-
const [key, setKey] = useState("⌘");
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (/Windows|Linux/i.test(window.navigator.userAgent)) setKey("Ctrl");
|
|
18
|
-
}, []);
|
|
19
|
-
return key;
|
|
20
|
-
}
|
|
21
|
-
const DEFAULT_HOT_KEYS = [{
|
|
22
|
-
key: (e) => e.metaKey || e.ctrlKey,
|
|
23
|
-
display: /* @__PURE__ */ jsx(MetaOrControl, {})
|
|
24
|
-
}, {
|
|
25
|
-
key: "k",
|
|
26
|
-
display: "K"
|
|
27
|
-
}];
|
|
28
|
-
const DefaultSearchDialog = lazy(() => import("../components/dialog/search-default.js"));
|
|
29
|
-
function SearchProvider({ SearchDialog = DefaultSearchDialog, children, preload = true, options, hotKey = DEFAULT_HOT_KEYS, links }) {
|
|
30
|
-
const [isOpen, setIsOpen] = useState(preload ? false : void 0);
|
|
31
|
-
const onKeyDown = useEffectEvent((e) => {
|
|
32
|
-
if (hotKey.every((v) => typeof v.key === "string" ? e.key === v.key : v.key(e))) {
|
|
33
|
-
setIsOpen((open) => !open);
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
window.addEventListener("keydown", onKeyDown);
|
|
39
|
-
return () => {
|
|
40
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
41
|
-
};
|
|
42
|
-
}, []);
|
|
43
|
-
return /* @__PURE__ */ jsxs(SearchContext, {
|
|
44
|
-
value: useMemo(() => ({
|
|
45
|
-
enabled: true,
|
|
46
|
-
open: isOpen ?? false,
|
|
47
|
-
hotKey,
|
|
48
|
-
setOpenSearch: setIsOpen
|
|
49
|
-
}), [isOpen, hotKey]),
|
|
50
|
-
children: [/* @__PURE__ */ jsx(Suspense, {
|
|
51
|
-
fallback: null,
|
|
52
|
-
children: isOpen !== void 0 && /* @__PURE__ */ jsx(SearchDialog, {
|
|
53
|
-
open: isOpen,
|
|
54
|
-
onOpenChange: setIsOpen,
|
|
55
|
-
links,
|
|
56
|
-
...options
|
|
57
|
-
})
|
|
58
|
-
}), children]
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Show children only when search is enabled via React Context
|
|
63
|
-
*/
|
|
64
|
-
function SearchOnly({ children }) {
|
|
65
|
-
if (useSearchContext().enabled) return children;
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
export { SearchOnly, SearchProvider, useSearchContext };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/contexts/search';
|
package/dist/contexts/tree.js
CHANGED
|
@@ -1,91 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createContext, use, useMemo, useRef } from "react";
|
|
5
|
-
import * as PageTree from "@vx-oss/docs-core/page-tree";
|
|
6
|
-
import { searchPath } from "@vx-oss/docs-core/breadcrumb";
|
|
7
|
-
//#region src/contexts/tree.tsx
|
|
8
|
-
const TreeContext = createContext(null);
|
|
9
|
-
const PathContext = createContext([]);
|
|
10
|
-
function TreeContextProvider({ tree: rawTree, children }) {
|
|
11
|
-
const nextIdRef = useRef(0);
|
|
12
|
-
const pathname = usePathname();
|
|
13
|
-
const tree = useMemo(() => rawTree, [rawTree.$id]);
|
|
14
|
-
const path = useMemo(() => {
|
|
15
|
-
return searchPath(tree.children, pathname) ?? (tree.fallback ? searchPath(tree.fallback.children, pathname) : null) ?? [];
|
|
16
|
-
}, [tree, pathname]);
|
|
17
|
-
const root = path.findLast((item) => item.type === "folder" && item.root) ?? tree;
|
|
18
|
-
root.$id ??= String(nextIdRef.current++);
|
|
19
|
-
return /* @__PURE__ */ jsx(TreeContext, {
|
|
20
|
-
value: useMemo(() => ({
|
|
21
|
-
root,
|
|
22
|
-
full: tree
|
|
23
|
-
}), [root, tree]),
|
|
24
|
-
children: /* @__PURE__ */ jsx(PathContext, {
|
|
25
|
-
value: path,
|
|
26
|
-
children
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function useTreePath() {
|
|
31
|
-
return use(PathContext);
|
|
32
|
-
}
|
|
33
|
-
function useTreeContext() {
|
|
34
|
-
const ctx = use(TreeContext);
|
|
35
|
-
if (!ctx) throw new Error("You must wrap this component under <DocsLayout />");
|
|
36
|
-
return ctx;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Group tabs by the root folders on the current page's path (outermost first): each tab is
|
|
40
|
-
* matched to its root folder, linking to the projection of current page when possible.
|
|
41
|
-
*
|
|
42
|
-
* Tabs not bound to the page tree are appended to the group of `root: true` folders.
|
|
43
|
-
*/
|
|
44
|
-
function useTabsGroups(tabs) {
|
|
45
|
-
const { full: tree } = useTreeContext();
|
|
46
|
-
const path = use(PathContext);
|
|
47
|
-
return useMemo(() => {
|
|
48
|
-
const out = [];
|
|
49
|
-
const last = path[path.length - 1];
|
|
50
|
-
const page = last?.type === "page" ? last : void 0;
|
|
51
|
-
let scope = tree.fallback && !tree.children.includes(path[0]) ? tree.fallback : tree;
|
|
52
|
-
for (const node of path) {
|
|
53
|
-
if (node.type !== "folder" || !node.root) continue;
|
|
54
|
-
const group = {
|
|
55
|
-
active: node,
|
|
56
|
-
options: []
|
|
57
|
-
};
|
|
58
|
-
collectTabs(scope, node, page, tabs, group.options);
|
|
59
|
-
if (group.options.length > 0) out.push(group);
|
|
60
|
-
scope = node;
|
|
61
|
-
}
|
|
62
|
-
const custom = tabs.filter((tab) => !tab.$folder);
|
|
63
|
-
if (custom.length > 0) {
|
|
64
|
-
const group = out.findLast((group) => group.active?.root === true);
|
|
65
|
-
if (group) group.options.push(...custom);
|
|
66
|
-
else out.push({ options: custom });
|
|
67
|
-
}
|
|
68
|
-
return out;
|
|
69
|
-
}, [
|
|
70
|
-
tabs,
|
|
71
|
-
tree,
|
|
72
|
-
path
|
|
73
|
-
]);
|
|
74
|
-
}
|
|
75
|
-
/** collect the tabs of root folders with the same type as `active` within a scope */
|
|
76
|
-
function collectTabs(scope, active, page, tabs, out) {
|
|
77
|
-
for (const node of scope.children) {
|
|
78
|
-
if (node.type !== "folder") continue;
|
|
79
|
-
if (node.root === active.root) {
|
|
80
|
-
const tab = tabs.find((tab) => tab.$folder && (tab.$folder === node || tab.$folder.$id === node.$id));
|
|
81
|
-
if (!tab) continue;
|
|
82
|
-
const projection = page && PageTree.findProjection(active, node, page);
|
|
83
|
-
out.push(projection ? {
|
|
84
|
-
...tab,
|
|
85
|
-
url: projection.url
|
|
86
|
-
} : tab);
|
|
87
|
-
} else if (!node.root) collectTabs(node, active, page, tabs, out);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
export { TreeContextProvider, useTabsGroups, useTreeContext, useTreePath };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/contexts/tree';
|
package/dist/i18n.js
CHANGED
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/i18n.tsx
|
|
3
|
-
function uiTranslations() {
|
|
4
|
-
return { keys: keys_default };
|
|
5
|
-
}
|
|
6
|
-
function i18nProvider(translations, lang) {
|
|
7
|
-
const t = translations.extend(uiTranslations());
|
|
8
|
-
if ("config" in t) {
|
|
9
|
-
const { defaultLanguage, languages } = t.config;
|
|
10
|
-
const locale = lang ?? defaultLanguage;
|
|
11
|
-
return {
|
|
12
|
-
locale: lang,
|
|
13
|
-
translations: t.get(locale) ?? t.get(defaultLanguage),
|
|
14
|
-
locales: languages.map((code) => ({
|
|
15
|
-
locale: code,
|
|
16
|
-
name: t.get(code).displayName ?? "English"
|
|
17
|
-
}))
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return { translations: t.get() };
|
|
21
|
-
}
|
|
22
|
-
function defineI18nUI(config, localeTranslations = {}) {
|
|
23
|
-
return {
|
|
24
|
-
...config,
|
|
25
|
-
provider(locale = config.defaultLanguage) {
|
|
26
|
-
return {
|
|
27
|
-
locale,
|
|
28
|
-
translations: localeTranslations[locale],
|
|
29
|
-
locales: config.languages.map((code) => ({
|
|
30
|
-
locale: code,
|
|
31
|
-
name: localeTranslations[code]?.displayName ?? code
|
|
32
|
-
}))
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { defineI18nUI, i18nProvider, uiTranslations };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/i18n';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui';
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { LayoutBody, useDocsLayout } from "./client.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
//#region src/layouts/docs/index.tsx
|
|
6
|
-
function DocsLayout({ tree, sidebar: { tabs: _tabs, tabMode: _tabMode, ...sidebarProps } = {}, tabs: layoutTabs = _tabs, tabMode = _tabMode, children, ...props }) {
|
|
7
|
-
const tabs = useMemo(() => {
|
|
8
|
-
if (Array.isArray(layoutTabs)) return layoutTabs;
|
|
9
|
-
if (typeof layoutTabs === "object") return getLayoutTabs(tree, layoutTabs);
|
|
10
|
-
if (layoutTabs !== false) return getLayoutTabs(tree);
|
|
11
|
-
return [];
|
|
12
|
-
}, [tree, layoutTabs]);
|
|
13
|
-
return /* @__PURE__ */ jsx(LayoutBody, {
|
|
14
|
-
tree,
|
|
15
|
-
tabs,
|
|
16
|
-
tabMode,
|
|
17
|
-
sidebar: sidebarProps,
|
|
18
|
-
...props,
|
|
19
|
-
children
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { DocsLayout, useDocsLayout };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/docs';
|
|
@@ -1,124 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { cn } from "../../../utils/cn.js";
|
|
4
|
-
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
-
import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
6
|
-
import { Footer } from "./slots/footer.js";
|
|
7
|
-
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
8
|
-
import { Container } from "./slots/container.js";
|
|
9
|
-
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { Edit } from "lucide-react";
|
|
12
|
-
import { createContext, use, useEffect, useState } from "react";
|
|
13
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
14
|
-
//#region src/layouts/docs/page/index.tsx
|
|
15
|
-
var page_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
-
DocsBody: () => DocsBody,
|
|
17
|
-
DocsDescription: () => DocsDescription,
|
|
18
|
-
DocsPage: () => DocsPage,
|
|
19
|
-
DocsTitle: () => DocsTitle,
|
|
20
|
-
EditOnGitHub: () => EditOnGitHub,
|
|
21
|
-
MarkdownCopyButton: () => MarkdownCopyButton,
|
|
22
|
-
PageBreadcrumb: () => Breadcrumb,
|
|
23
|
-
PageFooter: () => Footer,
|
|
24
|
-
PageLastUpdate: () => PageLastUpdate,
|
|
25
|
-
ViewOptionsPopover: () => ViewOptionsPopover,
|
|
26
|
-
useDocsPage: () => useDocsPage
|
|
27
|
-
});
|
|
28
|
-
const PageContext = createContext(null);
|
|
29
|
-
function useDocsPage() {
|
|
30
|
-
const context = use(PageContext);
|
|
31
|
-
if (!context) throw new Error("Please use page components under <DocsPage /> (`@vx-oss/docs-react/layouts/docs/page`).");
|
|
32
|
-
return context;
|
|
33
|
-
}
|
|
34
|
-
function DocsPage({ full = false, tableOfContent: { enabled: tocEnabled = !full, single, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, breadcrumb: { enabled: breadcrumbEnabled = true, ...breadcrumb } = {}, footer: { enabled: footerEnabled = true, ...footer } = {}, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
|
|
35
|
-
tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
|
|
36
|
-
const slots = {
|
|
37
|
-
breadcrumb: defaultSlots.breadcrumb ?? Breadcrumb,
|
|
38
|
-
footer: defaultSlots.footer ?? Footer,
|
|
39
|
-
toc: defaultSlots.toc ?? {
|
|
40
|
-
provider: TOCProvider,
|
|
41
|
-
main: TOC,
|
|
42
|
-
popover: TOCPopover
|
|
43
|
-
},
|
|
44
|
-
container: defaultSlots.container ?? Container
|
|
45
|
-
};
|
|
46
|
-
return /* @__PURE__ */ jsx(PageContext, {
|
|
47
|
-
value: {
|
|
48
|
-
full,
|
|
49
|
-
slots
|
|
50
|
-
},
|
|
51
|
-
children: /* @__PURE__ */ jsxs(slots.toc.provider, {
|
|
52
|
-
single,
|
|
53
|
-
toc: tocEnabled || tocPopoverEnabled ? toc : [],
|
|
54
|
-
children: [
|
|
55
|
-
tocPopoverEnabled && (tocPopoverProps.component ?? /* @__PURE__ */ jsx(slots.toc.popover, { ...tocPopoverProps })),
|
|
56
|
-
/* @__PURE__ */ jsxs(slots.container, {
|
|
57
|
-
...containerProps,
|
|
58
|
-
children: [
|
|
59
|
-
breadcrumbEnabled && (breadcrumb.component ?? /* @__PURE__ */ jsx(slots.breadcrumb, { ...breadcrumb })),
|
|
60
|
-
children,
|
|
61
|
-
footerEnabled && (footer.component ?? /* @__PURE__ */ jsx(slots.footer, { ...footer }))
|
|
62
|
-
]
|
|
63
|
-
}),
|
|
64
|
-
tocEnabled && (tocProps.component ?? /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps }))
|
|
65
|
-
]
|
|
66
|
-
})
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function EditOnGitHub(props) {
|
|
70
|
-
const t = useTranslations({ note: "edit page" });
|
|
71
|
-
return /* @__PURE__ */ jsx("a", {
|
|
72
|
-
target: "_blank",
|
|
73
|
-
rel: "noreferrer noopener",
|
|
74
|
-
...props,
|
|
75
|
-
className: cn(buttonVariants({
|
|
76
|
-
color: "secondary",
|
|
77
|
-
size: "sm"
|
|
78
|
-
}), "gap-1.5 not-prose", props.className),
|
|
79
|
-
children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), t("Edit on GitHub")] })
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Add typography styles
|
|
84
|
-
*/
|
|
85
|
-
function DocsBody({ children, className, ...props }) {
|
|
86
|
-
return /* @__PURE__ */ jsx("div", {
|
|
87
|
-
...props,
|
|
88
|
-
className: cn("prose flex-1", className),
|
|
89
|
-
children
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function DocsDescription({ children, className, ...props }) {
|
|
93
|
-
if (children === void 0) return null;
|
|
94
|
-
return /* @__PURE__ */ jsx("p", {
|
|
95
|
-
...props,
|
|
96
|
-
className: cn("mb-8 text-lg text-fd-muted-foreground", className),
|
|
97
|
-
children
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function DocsTitle({ children, className, ...props }) {
|
|
101
|
-
return /* @__PURE__ */ jsx("h1", {
|
|
102
|
-
...props,
|
|
103
|
-
className: cn("text-[1.75em] font-semibold", className),
|
|
104
|
-
children
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function PageLastUpdate({ date: value, ...props }) {
|
|
108
|
-
const t = useTranslations({ note: "page footer" });
|
|
109
|
-
const [date, setDate] = useState("");
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
setDate(value.toLocaleDateString());
|
|
112
|
-
}, [value]);
|
|
113
|
-
return /* @__PURE__ */ jsxs("p", {
|
|
114
|
-
...props,
|
|
115
|
-
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
116
|
-
children: [
|
|
117
|
-
t("Last updated on"),
|
|
118
|
-
" ",
|
|
119
|
-
date
|
|
120
|
-
]
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
|
-
export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, page_exports, useDocsPage };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/docs/page';
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../../../utils/cn.js";
|
|
3
|
-
import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
|
|
4
|
-
import Link from "@vx-oss/docs-core/link";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { ChevronRight } from "lucide-react";
|
|
7
|
-
import { Fragment as Fragment$1, useMemo } from "react";
|
|
8
|
-
import { getBreadcrumbItemsFromPath } from "@vx-oss/docs-core/breadcrumb";
|
|
9
|
-
//#region src/layouts/docs/page/slots/breadcrumb.tsx
|
|
10
|
-
function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
11
|
-
const path = useTreePath();
|
|
12
|
-
const { root } = useTreeContext();
|
|
13
|
-
const items = useMemo(() => {
|
|
14
|
-
return getBreadcrumbItemsFromPath(root, path, {
|
|
15
|
-
includePage,
|
|
16
|
-
includeSeparator,
|
|
17
|
-
includeRoot
|
|
18
|
-
});
|
|
19
|
-
}, [
|
|
20
|
-
includePage,
|
|
21
|
-
includeRoot,
|
|
22
|
-
includeSeparator,
|
|
23
|
-
path,
|
|
24
|
-
root
|
|
25
|
-
]);
|
|
26
|
-
if (items.length === 0) return null;
|
|
27
|
-
return /* @__PURE__ */ jsx("div", {
|
|
28
|
-
...props,
|
|
29
|
-
className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
|
|
30
|
-
children: items.map((item, i) => {
|
|
31
|
-
const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
|
|
32
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
33
|
-
href: item.url,
|
|
34
|
-
className: cn(className, "transition-opacity hover:opacity-80"),
|
|
35
|
-
children: item.name
|
|
36
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
37
|
-
className,
|
|
38
|
-
children: item.name
|
|
39
|
-
})] }, i);
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { Breadcrumb };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/docs/page/slots/breadcrumb';
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../../../../utils/cn.js";
|
|
3
|
-
import { useDocsPage } from "../index.js";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
//#region src/layouts/docs/page/slots/container.tsx
|
|
6
|
-
function Container(props) {
|
|
7
|
-
const { full } = useDocsPage();
|
|
8
|
-
return /* @__PURE__ */ jsx("main", {
|
|
9
|
-
className: "grid [grid-area:main] justify-items-center",
|
|
10
|
-
"data-layout-main": "",
|
|
11
|
-
children: /* @__PURE__ */ jsx("article", {
|
|
12
|
-
id: "nd-page",
|
|
13
|
-
"data-layout-content": "",
|
|
14
|
-
"data-full": full,
|
|
15
|
-
...props,
|
|
16
|
-
className: cn("flex flex-col min-w-0 w-full max-w-[900px] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14", full && "max-w-[1168px]", props.className),
|
|
17
|
-
children: props.children
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { Container };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/layouts/docs/page/slots/container';
|