@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,126 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { buttonVariants } from "./ui/button.js";
|
|
4
|
-
import { useCopyButton } from "../utils/use-copy-button.js";
|
|
5
|
-
import { mergeRefs } from "../utils/merge-refs.js";
|
|
6
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { Check, Clipboard } from "lucide-react";
|
|
9
|
-
import { createContext, use, useMemo, useRef } from "react";
|
|
10
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
11
|
-
//#region src/components/codeblock.tsx
|
|
12
|
-
const TabsContext = createContext(null);
|
|
13
|
-
function Pre(props) {
|
|
14
|
-
return /* @__PURE__ */ jsx("pre", {
|
|
15
|
-
...props,
|
|
16
|
-
className: cn("min-w-full w-max *:flex *:flex-col", props.className),
|
|
17
|
-
children: props.children
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function CodeBlock({ ref, title, allowCopy = true, keepBackground = false, icon, viewportProps = {}, children, Actions = (props) => /* @__PURE__ */ jsx("div", {
|
|
21
|
-
...props,
|
|
22
|
-
className: cn("empty:hidden", props.className)
|
|
23
|
-
}), ...props }) {
|
|
24
|
-
const inTab = use(TabsContext) !== null;
|
|
25
|
-
const areaRef = useRef(null);
|
|
26
|
-
if (allowCopy === "true") allowCopy = true;
|
|
27
|
-
else if (allowCopy === "false") allowCopy = false;
|
|
28
|
-
return /* @__PURE__ */ jsxs("figure", {
|
|
29
|
-
ref,
|
|
30
|
-
dir: "ltr",
|
|
31
|
-
...props,
|
|
32
|
-
tabIndex: -1,
|
|
33
|
-
className: cn(inTab ? "bg-fd-secondary -mx-px -mb-px last:rounded-b-xl" : "my-4 bg-fd-card rounded-xl", keepBackground && "bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)", "shiki relative border shadow-sm not-prose overflow-hidden text-sm", props.className),
|
|
34
|
-
children: [title ? /* @__PURE__ */ jsxs("div", {
|
|
35
|
-
className: "flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4",
|
|
36
|
-
children: [
|
|
37
|
-
typeof icon === "string" ? /* @__PURE__ */ jsx("div", {
|
|
38
|
-
className: "[&_svg]:size-3.5",
|
|
39
|
-
dangerouslySetInnerHTML: { __html: icon }
|
|
40
|
-
}) : icon,
|
|
41
|
-
/* @__PURE__ */ jsx("figcaption", {
|
|
42
|
-
className: "flex-1 truncate",
|
|
43
|
-
children: title
|
|
44
|
-
}),
|
|
45
|
-
Actions({
|
|
46
|
-
className: "-me-2",
|
|
47
|
-
children: allowCopy && /* @__PURE__ */ jsx(CopyButton, { containerRef: areaRef })
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
}) : Actions({
|
|
51
|
-
className: "absolute top-3 right-2 z-2 backdrop-blur-lg rounded-lg text-fd-muted-foreground",
|
|
52
|
-
children: allowCopy && /* @__PURE__ */ jsx(CopyButton, { containerRef: areaRef })
|
|
53
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
54
|
-
ref: areaRef,
|
|
55
|
-
...viewportProps,
|
|
56
|
-
role: "region",
|
|
57
|
-
tabIndex: 0,
|
|
58
|
-
className: cn("text-[0.8125rem] py-3.5 overflow-auto max-h-[600px] fd-scroll-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring", viewportProps.className),
|
|
59
|
-
style: {
|
|
60
|
-
"--padding-right": !title ? "calc(var(--spacing) * 8)" : void 0,
|
|
61
|
-
counterSet: props["data-line-numbers"] ? `line ${Number(props["data-line-numbers-start"] ?? 1) - 1}` : void 0,
|
|
62
|
-
...viewportProps.style
|
|
63
|
-
},
|
|
64
|
-
children
|
|
65
|
-
})]
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function CopyButton({ className, containerRef, ...props }) {
|
|
69
|
-
const t = useTranslations({ note: "code block" });
|
|
70
|
-
const [checked, onClick] = useCopyButton(() => {
|
|
71
|
-
const pre = containerRef.current?.getElementsByTagName("pre").item(0);
|
|
72
|
-
if (!pre) return;
|
|
73
|
-
const clone = pre.cloneNode(true);
|
|
74
|
-
clone.querySelectorAll(".nd-copy-ignore").forEach((node) => {
|
|
75
|
-
node.replaceWith("\n");
|
|
76
|
-
});
|
|
77
|
-
navigator.clipboard.writeText(clone.textContent ?? "");
|
|
78
|
-
});
|
|
79
|
-
return /* @__PURE__ */ jsx("button", {
|
|
80
|
-
type: "button",
|
|
81
|
-
"data-checked": checked || void 0,
|
|
82
|
-
className: cn(buttonVariants({
|
|
83
|
-
className: "hover:text-fd-accent-foreground data-checked:text-fd-accent-foreground",
|
|
84
|
-
size: "icon-xs"
|
|
85
|
-
}), className),
|
|
86
|
-
"aria-label": checked ? t("Copied Text", { note: "aria-label" }) : t("Copy Text", { note: "aria-label" }),
|
|
87
|
-
onClick,
|
|
88
|
-
...props,
|
|
89
|
-
children: checked ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Clipboard, {})
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function CodeBlockTabs({ ref, ...props }) {
|
|
93
|
-
const containerRef = useRef(null);
|
|
94
|
-
const nested = use(TabsContext) !== null;
|
|
95
|
-
return /* @__PURE__ */ jsx(Tabs, {
|
|
96
|
-
ref: mergeRefs(containerRef, ref),
|
|
97
|
-
...props,
|
|
98
|
-
className: cn("bg-fd-card rounded-xl border", !nested && "my-4", props.className),
|
|
99
|
-
children: /* @__PURE__ */ jsx(TabsContext, {
|
|
100
|
-
value: useMemo(() => ({
|
|
101
|
-
containerRef,
|
|
102
|
-
nested
|
|
103
|
-
}), [nested]),
|
|
104
|
-
children: props.children
|
|
105
|
-
})
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function CodeBlockTabsList(props) {
|
|
109
|
-
return /* @__PURE__ */ jsx(TabsList, {
|
|
110
|
-
...props,
|
|
111
|
-
className: cn("flex flex-row px-2 overflow-x-auto text-fd-muted-foreground", props.className),
|
|
112
|
-
children: props.children
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function CodeBlockTabsTrigger({ children, ...props }) {
|
|
116
|
-
return /* @__PURE__ */ jsxs(TabsTrigger, {
|
|
117
|
-
...props,
|
|
118
|
-
className: cn("relative group inline-flex text-sm font-medium text-nowrap items-center transition-colors gap-2 px-2 py-1.5 hover:text-fd-accent-foreground data-[state=active]:text-fd-primary [&_svg]:size-3.5", props.className),
|
|
119
|
-
children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-x-2 bottom-0 h-px group-data-[state=active]:bg-fd-primary" }), children]
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
function CodeBlockTab(props) {
|
|
123
|
-
return /* @__PURE__ */ jsx(TabsContent, { ...props });
|
|
124
|
-
}
|
|
125
|
-
//#endregion
|
|
126
|
-
export { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/codeblock';
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { CodeBlock, Pre } from "./codeblock.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { highlight } from "@vx-oss/docs-core/highlight";
|
|
5
|
-
//#region src/components/codeblock.rsc.tsx
|
|
6
|
-
async function ServerCodeBlock({ code, codeblock, ...options }) {
|
|
7
|
-
return await highlight(code, {
|
|
8
|
-
defaultColor: false,
|
|
9
|
-
...options,
|
|
10
|
-
components: {
|
|
11
|
-
pre: (props) => /* @__PURE__ */ jsx(CodeBlock, {
|
|
12
|
-
...props,
|
|
13
|
-
...codeblock,
|
|
14
|
-
className: cn("my-0", props.className, codeblock?.className),
|
|
15
|
-
children: /* @__PURE__ */ jsx(Pre, { children: props.children })
|
|
16
|
-
}),
|
|
17
|
-
...options.components
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { ServerCodeBlock };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/codeblock.rsc';
|
|
@@ -1,64 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem } from "./search.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useMemo, useState } from "react";
|
|
6
|
-
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
7
|
-
import { useDocsSearch } from "@vx-oss/docs-core/search/client";
|
|
8
|
-
import { algoliaClient } from "@vx-oss/docs-core/search/client/algolia";
|
|
9
|
-
//#region src/components/dialog/search-algolia.tsx
|
|
10
|
-
function AlgoliaSearchDialog({ searchOptions, tags = [], defaultTag, showAlgolia = false, allowClear = false, links = [], footer, ...props }) {
|
|
11
|
-
const [tag, setTag] = useState(defaultTag);
|
|
12
|
-
const { locale } = useI18n();
|
|
13
|
-
const { search, setSearch, query } = useDocsSearch({ client: algoliaClient({
|
|
14
|
-
tag,
|
|
15
|
-
locale,
|
|
16
|
-
...searchOptions
|
|
17
|
-
}) });
|
|
18
|
-
const defaultItems = useMemo(() => {
|
|
19
|
-
if (links.length === 0) return null;
|
|
20
|
-
return links.map(([name, link]) => ({
|
|
21
|
-
type: "page",
|
|
22
|
-
id: name,
|
|
23
|
-
content: name,
|
|
24
|
-
url: link
|
|
25
|
-
}));
|
|
26
|
-
}, [links]);
|
|
27
|
-
useOnChange(defaultTag, (v) => {
|
|
28
|
-
setTag(v);
|
|
29
|
-
});
|
|
30
|
-
const label = showAlgolia && /* @__PURE__ */ jsx(AlgoliaTitle, {});
|
|
31
|
-
return /* @__PURE__ */ jsxs(SearchDialog, {
|
|
32
|
-
search,
|
|
33
|
-
onSearchChange: setSearch,
|
|
34
|
-
isLoading: query.isLoading,
|
|
35
|
-
...props,
|
|
36
|
-
children: [
|
|
37
|
-
/* @__PURE__ */ jsx(SearchDialogOverlay, {}),
|
|
38
|
-
/* @__PURE__ */ jsxs(SearchDialogContent, { children: [/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
|
|
39
|
-
/* @__PURE__ */ jsx(SearchDialogIcon, {}),
|
|
40
|
-
/* @__PURE__ */ jsx(SearchDialogInput, {}),
|
|
41
|
-
/* @__PURE__ */ jsx(SearchDialogClose, {})
|
|
42
|
-
] }), /* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : defaultItems })] }),
|
|
43
|
-
/* @__PURE__ */ jsxs(SearchDialogFooter, { children: [tags.length > 0 ? /* @__PURE__ */ jsxs(TagsList, {
|
|
44
|
-
tag,
|
|
45
|
-
onTagChange: setTag,
|
|
46
|
-
allowClear,
|
|
47
|
-
children: [tags.map((tag) => /* @__PURE__ */ jsx(TagsListItem, {
|
|
48
|
-
value: tag.value,
|
|
49
|
-
children: tag.name
|
|
50
|
-
}, tag.value)), label]
|
|
51
|
-
}) : label, footer] })
|
|
52
|
-
]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function AlgoliaTitle() {
|
|
56
|
-
return /* @__PURE__ */ jsx("a", {
|
|
57
|
-
href: "https://algolia.com",
|
|
58
|
-
rel: "noreferrer noopener",
|
|
59
|
-
className: "ms-auto text-xs text-fd-muted-foreground",
|
|
60
|
-
children: "Search powered by Algolia"
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
|
-
export { AlgoliaSearchDialog as default };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/dialog/search-algolia';
|
|
2
|
+
export { default } from '@vx-oss/docs-vezham-ui/components/dialog/search-algolia';
|
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem } from "./search.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { use, useMemo, useState } from "react";
|
|
6
|
-
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
7
|
-
import { useDocsSearch } from "@vx-oss/docs-core/search/client";
|
|
8
|
-
import { fetchClient } from "@vx-oss/docs-core/search/client/fetch";
|
|
9
|
-
//#region src/components/dialog/search-default.tsx
|
|
10
|
-
let STATIC;
|
|
11
|
-
function DefaultSearchDialog({ type, defaultTag, tags = [], api, delayMs, allowClear = false, links = [], footer, ...props }) {
|
|
12
|
-
const { locale } = useI18n();
|
|
13
|
-
const [tag, setTag] = useState(defaultTag);
|
|
14
|
-
let client;
|
|
15
|
-
if (type === "static") client = use(STATIC ??= import("@vx-oss/docs-core/search/client/orama-static")).staticClient({
|
|
16
|
-
from: api,
|
|
17
|
-
locale,
|
|
18
|
-
tag
|
|
19
|
-
});
|
|
20
|
-
else client = fetchClient({
|
|
21
|
-
api,
|
|
22
|
-
locale,
|
|
23
|
-
tag
|
|
24
|
-
});
|
|
25
|
-
const { search, setSearch, query } = useDocsSearch({
|
|
26
|
-
client,
|
|
27
|
-
delayMs
|
|
28
|
-
});
|
|
29
|
-
const defaultItems = useMemo(() => {
|
|
30
|
-
if (links.length === 0) return null;
|
|
31
|
-
return links.map(([name, link]) => ({
|
|
32
|
-
type: "page",
|
|
33
|
-
id: name,
|
|
34
|
-
content: name,
|
|
35
|
-
url: link
|
|
36
|
-
}));
|
|
37
|
-
}, [links]);
|
|
38
|
-
useOnChange(defaultTag, (v) => {
|
|
39
|
-
setTag(v);
|
|
40
|
-
});
|
|
41
|
-
return /* @__PURE__ */ jsxs(SearchDialog, {
|
|
42
|
-
search,
|
|
43
|
-
onSearchChange: setSearch,
|
|
44
|
-
isLoading: query.isLoading,
|
|
45
|
-
...props,
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ jsx(SearchDialogOverlay, {}),
|
|
48
|
-
/* @__PURE__ */ jsxs(SearchDialogContent, { children: [/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
|
|
49
|
-
/* @__PURE__ */ jsx(SearchDialogIcon, {}),
|
|
50
|
-
/* @__PURE__ */ jsx(SearchDialogInput, {}),
|
|
51
|
-
/* @__PURE__ */ jsx(SearchDialogClose, {})
|
|
52
|
-
] }), /* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : defaultItems })] }),
|
|
53
|
-
/* @__PURE__ */ jsxs(SearchDialogFooter, { children: [tags.length > 0 && /* @__PURE__ */ jsx(TagsList, {
|
|
54
|
-
tag,
|
|
55
|
-
onTagChange: setTag,
|
|
56
|
-
allowClear,
|
|
57
|
-
children: tags.map((tag) => /* @__PURE__ */ jsx(TagsListItem, {
|
|
58
|
-
value: tag.value,
|
|
59
|
-
children: tag.name
|
|
60
|
-
}, tag.value))
|
|
61
|
-
}), footer] })
|
|
62
|
-
]
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
export { DefaultSearchDialog as default };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/dialog/search-default';
|
|
2
|
+
export { default } from '@vx-oss/docs-vezham-ui/components/dialog/search-default';
|
|
@@ -1,69 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem } from "./search.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useMemo, useState } from "react";
|
|
6
|
-
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
7
|
-
import { useDocsSearch } from "@vx-oss/docs-core/search/client";
|
|
8
|
-
import { oramaCloudClient } from "@vx-oss/docs-core/search/client/orama-cloud";
|
|
9
|
-
//#region src/components/dialog/search-orama.tsx
|
|
10
|
-
/**
|
|
11
|
-
* Orama Cloud integration
|
|
12
|
-
*/
|
|
13
|
-
function OramaSearchDialog({ client, searchOptions, tags = [], defaultTag, showOrama = true, allowClear = false, index, footer, links = [], ...props }) {
|
|
14
|
-
const { locale } = useI18n();
|
|
15
|
-
const [tag, setTag] = useState(defaultTag);
|
|
16
|
-
const { search, setSearch, query } = useDocsSearch({ client: oramaCloudClient({
|
|
17
|
-
client,
|
|
18
|
-
index,
|
|
19
|
-
params: searchOptions,
|
|
20
|
-
locale,
|
|
21
|
-
tag
|
|
22
|
-
}) });
|
|
23
|
-
const defaultItems = useMemo(() => {
|
|
24
|
-
if (links.length === 0) return null;
|
|
25
|
-
return links.map(([name, link]) => ({
|
|
26
|
-
type: "page",
|
|
27
|
-
id: name,
|
|
28
|
-
content: name,
|
|
29
|
-
url: link
|
|
30
|
-
}));
|
|
31
|
-
}, [links]);
|
|
32
|
-
useOnChange(defaultTag, (v) => {
|
|
33
|
-
setTag(v);
|
|
34
|
-
});
|
|
35
|
-
const label = showOrama && /* @__PURE__ */ jsx(Label, {});
|
|
36
|
-
return /* @__PURE__ */ jsxs(SearchDialog, {
|
|
37
|
-
search,
|
|
38
|
-
onSearchChange: setSearch,
|
|
39
|
-
isLoading: query.isLoading,
|
|
40
|
-
...props,
|
|
41
|
-
children: [/* @__PURE__ */ jsx(SearchDialogOverlay, {}), /* @__PURE__ */ jsxs(SearchDialogContent, { children: [
|
|
42
|
-
/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
|
|
43
|
-
/* @__PURE__ */ jsx(SearchDialogIcon, {}),
|
|
44
|
-
/* @__PURE__ */ jsx(SearchDialogInput, {}),
|
|
45
|
-
/* @__PURE__ */ jsx(SearchDialogClose, {})
|
|
46
|
-
] }),
|
|
47
|
-
/* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : defaultItems }),
|
|
48
|
-
/* @__PURE__ */ jsxs(SearchDialogFooter, { children: [tags.length > 0 ? /* @__PURE__ */ jsxs(TagsList, {
|
|
49
|
-
tag,
|
|
50
|
-
onTagChange: setTag,
|
|
51
|
-
allowClear,
|
|
52
|
-
children: [tags.map((tag) => /* @__PURE__ */ jsx(TagsListItem, {
|
|
53
|
-
value: tag.value,
|
|
54
|
-
children: tag.name
|
|
55
|
-
}, tag.value)), label]
|
|
56
|
-
}) : label, footer] })
|
|
57
|
-
] })]
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function Label() {
|
|
61
|
-
return /* @__PURE__ */ jsx("a", {
|
|
62
|
-
href: "https://orama.com",
|
|
63
|
-
rel: "noreferrer noopener",
|
|
64
|
-
className: "ms-auto text-xs text-fd-muted-foreground",
|
|
65
|
-
children: "Search powered by Orama"
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
export { OramaSearchDialog as default };
|
|
1
|
+
export * from '@vx-oss/docs-vezham-ui/components/dialog/search-orama';
|
|
2
|
+
export { default } from '@vx-oss/docs-vezham-ui/components/dialog/search-orama';
|