@vx-oss/docs-react 1.0.3
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/LICENSE +21 -0
- package/README.md +5 -0
- package/css/aspen.css +39 -0
- package/css/black.css +39 -0
- package/css/catppuccin.css +49 -0
- package/css/dusk.css +47 -0
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +1 -0
- package/css/generated/flux.css +1 -0
- package/css/generated/glass.css +1 -0
- package/css/generated/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +296 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +108 -0
- package/css/neutral.css +7 -0
- package/css/ocean.css +44 -0
- package/css/preset-legacy.css +43 -0
- package/css/preset.css +11 -0
- package/css/purple.css +39 -0
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -0
- package/css/solar.css +65 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +72 -0
- package/dist/.translations/index.d.ts +55 -0
- package/dist/.translations/keys.js +55 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +10 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +25 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +21 -0
- package/dist/components/callout.js +60 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +39 -0
- package/dist/components/codeblock.d.ts +45 -0
- package/dist/components/codeblock.js +126 -0
- package/dist/components/codeblock.rsc.d.ts +15 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +27 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +29 -0
- package/dist/components/dialog/search-default.js +66 -0
- package/dist/components/dialog/search-orama.d.ts +32 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +76 -0
- package/dist/components/dialog/search.js +351 -0
- package/dist/components/dynamic-codeblock.core.d.ts +26 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +8 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +21 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +20 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +9 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +18 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +10 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +85 -0
- package/dist/components/sidebar/base.js +277 -0
- package/dist/components/sidebar/link-item.d.ts +12 -0
- package/dist/components/sidebar/link-item.js +37 -0
- package/dist/components/sidebar/page-tree.d.ts +20 -0
- package/dist/components/sidebar/page-tree.js +69 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +15 -0
- package/dist/components/sidebar/tabs/dropdown.js +83 -0
- package/dist/components/sidebar/tabs/index.d.ts +8 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +10 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +33 -0
- package/dist/components/tabs.js +95 -0
- package/dist/components/toc/clerk.d.ts +11 -0
- package/dist/components/toc/clerk.js +227 -0
- package/dist/components/toc/default.d.ts +13 -0
- package/dist/components/toc/default.js +260 -0
- package/dist/components/toc/index.d.ts +10 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +37 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +10 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +11 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +9 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +23 -0
- package/dist/components/ui/tabs.js +102 -0
- package/dist/contexts/i18n.d.ts +34 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +64 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +29 -0
- package/dist/contexts/tree.js +91 -0
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +33 -0
- package/dist/layouts/docs/client.js +94 -0
- package/dist/layouts/docs/index.d.ts +32 -0
- package/dist/layouts/docs/index.js +23 -0
- package/dist/layouts/docs/page/index.d.ts +76 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +5 -0
- package/dist/layouts/docs/page/slots/container.js +22 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +16 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +47 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +5 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +5 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +22 -0
- package/dist/layouts/docs/slots/sidebar.js +268 -0
- package/dist/layouts/flux/index.d.ts +61 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +67 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +5 -0
- package/dist/layouts/flux/page/slots/container.js +22 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +16 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +29 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +5 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +16 -0
- package/dist/layouts/flux/slots/sidebar.js +243 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +10 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +88 -0
- package/dist/layouts/glass/index.d.ts +39 -0
- package/dist/layouts/glass/index.js +70 -0
- package/dist/layouts/glass/layout-tabs.js +54 -0
- package/dist/layouts/glass/page/index.d.ts +31 -0
- package/dist/layouts/glass/page/index.js +92 -0
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/glass/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/glass/page/slots/footer.d.ts +16 -0
- package/dist/layouts/glass/page/slots/footer.js +56 -0
- package/dist/layouts/glass/page/slots/toc.d.ts +19 -0
- package/dist/layouts/glass/page/slots/toc.js +108 -0
- package/dist/layouts/glass/slots/header.d.ts +6 -0
- package/dist/layouts/glass/slots/header.js +68 -0
- package/dist/layouts/glass/slots/sidebar.d.ts +21 -0
- package/dist/layouts/glass/slots/sidebar.js +267 -0
- package/dist/layouts/home/index.d.ts +27 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +9 -0
- package/dist/layouts/home/navbar.js +34 -0
- package/dist/layouts/home/not-found.d.ts +7 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/slots/container.d.ts +5 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +8 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +35 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +26 -0
- package/dist/layouts/notebook/index.js +23 -0
- package/dist/layouts/notebook/page/index.d.ts +76 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/page/slots/container.js +22 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +16 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +47 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +5 -0
- package/dist/layouts/notebook/slots/header.js +204 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +23 -0
- package/dist/layouts/notebook/slots/sidebar.js +240 -0
- package/dist/layouts/shared/client.d.ts +37 -0
- package/dist/layouts/shared/client.js +85 -0
- package/dist/layouts/shared/index.d.ts +169 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +27 -0
- package/dist/layouts/shared/page-actions.js +199 -0
- package/dist/layouts/shared/slots/language-select.d.ts +12 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +13 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +8 -0
- package/dist/layouts/shared/slots/theme-switch.js +70 -0
- package/dist/legacy/layout.d.ts +29 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +14 -0
- package/dist/legacy/sidebar.js +34 -0
- package/dist/mdx.d.ts +44 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +14 -0
- package/dist/mdx.server.js +20 -0
- 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 +30 -0
- 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 +461 -0
- 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 +3 -0
- 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 +6 -0
- 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 +17 -0
- 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 +53 -0
- 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 +25 -0
- 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 +12 -0
- 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 +45 -0
- 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 +10 -0
- 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 +57 -0
- 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 +21 -0
- 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 +14 -0
- 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 +22 -0
- 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 +27 -0
- 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 +31 -0
- 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 +75 -0
- 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 +4 -0
- 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 +7 -0
- 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 +5 -0
- package/dist/og/takumi.d.ts +15 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +16 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +29 -0
- package/dist/page.js +33 -0
- package/dist/provider/astro.d.ts +29 -0
- package/dist/provider/astro.js +20 -0
- package/dist/provider/base.d.ts +48 -0
- package/dist/provider/base.js +73 -0
- package/dist/provider/next.d.ts +16 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +16 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +16 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +16 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3640 -0
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +5 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +8 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +6 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +212 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../components/ui/button.js";
|
|
4
|
+
import { useCopyButton } from "../../utils/use-copy-button.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
|
|
6
|
+
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Check, ChevronDown, Copy, ExternalLinkIcon, TextIcon } from "lucide-react";
|
|
9
|
+
import { useMemo, useState } from "react";
|
|
10
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
11
|
+
//#region src/layouts/shared/page-actions.tsx
|
|
12
|
+
const cache = /* @__PURE__ */ new Map();
|
|
13
|
+
/**
|
|
14
|
+
* see https://fumadocs.dev/docs/integrations/llms#page-actions to customize.
|
|
15
|
+
*/
|
|
16
|
+
function MarkdownCopyButton({ markdownUrl, ...props }) {
|
|
17
|
+
const t = useTranslations({ note: "page actions" });
|
|
18
|
+
const [isLoading, setLoading] = useState(false);
|
|
19
|
+
const [checked, onClick] = useCopyButton(async () => {
|
|
20
|
+
const cached = cache.get(markdownUrl);
|
|
21
|
+
if (cached) return navigator.clipboard.writeText(await cached);
|
|
22
|
+
setLoading(true);
|
|
23
|
+
try {
|
|
24
|
+
const promise = fetch(withBasePath(markdownUrl)).then((res) => res.text());
|
|
25
|
+
cache.set(markdownUrl, promise);
|
|
26
|
+
await navigator.clipboard.write([new ClipboardItem({ "text/plain": promise })]);
|
|
27
|
+
} finally {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
32
|
+
disabled: isLoading,
|
|
33
|
+
onClick,
|
|
34
|
+
...props,
|
|
35
|
+
className: cn(buttonVariants({
|
|
36
|
+
color: "secondary",
|
|
37
|
+
size: "sm",
|
|
38
|
+
className: "gap-2 [&_svg]:size-3.5 [&_svg]:text-fd-muted-foreground"
|
|
39
|
+
}), props.className),
|
|
40
|
+
children: [checked ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}), props.children ?? t("Copy Markdown")]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* see https://fumadocs.dev/docs/integrations/llms#page-actions to customize.
|
|
45
|
+
*/
|
|
46
|
+
function ViewOptionsPopover({ markdownUrl, githubUrl, ...props }) {
|
|
47
|
+
const pathname = usePathname();
|
|
48
|
+
const t = useTranslations({ note: "page actions" });
|
|
49
|
+
const items = useMemo(() => {
|
|
50
|
+
const pageUrl = typeof window === "undefined" ? pathname : new URL(pathname, window.location.origin);
|
|
51
|
+
const q = t("Read {url}, I want to ask questions about it.", { variables: { url: String(pageUrl) } });
|
|
52
|
+
return [
|
|
53
|
+
githubUrl && {
|
|
54
|
+
title: t("Open in GitHub"),
|
|
55
|
+
href: githubUrl,
|
|
56
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
57
|
+
fill: "currentColor",
|
|
58
|
+
role: "img",
|
|
59
|
+
viewBox: "0 0 24 24",
|
|
60
|
+
children: [/* @__PURE__ */ jsx("title", { children: "GitHub" }), /* @__PURE__ */ jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })]
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
markdownUrl && {
|
|
64
|
+
title: t("View as Markdown"),
|
|
65
|
+
href: withBasePath(markdownUrl),
|
|
66
|
+
icon: /* @__PURE__ */ jsx(TextIcon, {})
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: t("Open in Scira AI"),
|
|
70
|
+
href: `https://scira.ai/?${new URLSearchParams({ q })}`,
|
|
71
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
72
|
+
width: "910",
|
|
73
|
+
height: "934",
|
|
74
|
+
viewBox: "0 0 910 934",
|
|
75
|
+
fill: "none",
|
|
76
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx("title", { children: "Scira AI" }),
|
|
79
|
+
/* @__PURE__ */ jsx("path", {
|
|
80
|
+
d: "M647.664 197.775C569.13 189.049 525.5 145.419 516.774 66.8849C508.048 145.419 464.418 189.049 385.884 197.775C464.418 206.501 508.048 250.131 516.774 328.665C525.5 250.131 569.13 206.501 647.664 197.775Z",
|
|
81
|
+
fill: "currentColor",
|
|
82
|
+
stroke: "currentColor",
|
|
83
|
+
strokeWidth: "8",
|
|
84
|
+
strokeLinejoin: "round"
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ jsx("path", {
|
|
87
|
+
d: "M516.774 304.217C510.299 275.491 498.208 252.087 480.335 234.214C462.462 216.341 439.058 204.251 410.333 197.775C439.059 191.3 462.462 179.209 480.335 161.336C498.208 143.463 510.299 120.06 516.774 91.334C523.25 120.059 535.34 143.463 553.213 161.336C571.086 179.209 594.49 191.3 623.216 197.775C594.49 204.251 571.086 216.341 553.213 234.214C535.34 252.087 523.25 275.491 516.774 304.217Z",
|
|
88
|
+
fill: "currentColor",
|
|
89
|
+
stroke: "currentColor",
|
|
90
|
+
strokeWidth: "8",
|
|
91
|
+
strokeLinejoin: "round"
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx("path", {
|
|
94
|
+
d: "M857.5 508.116C763.259 497.644 710.903 445.288 700.432 351.047C689.961 445.288 637.605 497.644 543.364 508.116C637.605 518.587 689.961 570.943 700.432 665.184C710.903 570.943 763.259 518.587 857.5 508.116Z",
|
|
95
|
+
stroke: "currentColor",
|
|
96
|
+
strokeWidth: "20",
|
|
97
|
+
strokeLinejoin: "round"
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx("path", {
|
|
100
|
+
d: "M700.432 615.957C691.848 589.05 678.575 566.357 660.383 548.165C642.191 529.973 619.499 516.7 592.593 508.116C619.499 499.533 642.191 486.258 660.383 468.066C678.575 449.874 691.848 427.181 700.432 400.274C709.015 427.181 722.289 449.874 740.481 468.066C758.673 486.258 781.365 499.533 808.271 508.116C781.365 516.7 758.673 529.973 740.481 548.165C722.289 566.357 709.015 589.05 700.432 615.957Z",
|
|
101
|
+
stroke: "currentColor",
|
|
102
|
+
strokeWidth: "20",
|
|
103
|
+
strokeLinejoin: "round"
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx("path", {
|
|
106
|
+
d: "M889.949 121.237C831.049 114.692 798.326 81.9698 791.782 23.0692C785.237 81.9698 752.515 114.692 693.614 121.237C752.515 127.781 785.237 160.504 791.782 219.404C798.326 160.504 831.049 127.781 889.949 121.237Z",
|
|
107
|
+
fill: "currentColor",
|
|
108
|
+
stroke: "currentColor",
|
|
109
|
+
strokeWidth: "8",
|
|
110
|
+
strokeLinejoin: "round"
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx("path", {
|
|
113
|
+
d: "M791.782 196.795C786.697 176.937 777.869 160.567 765.16 147.858C752.452 135.15 736.082 126.322 716.226 121.237C736.082 116.152 752.452 107.324 765.16 94.6152C777.869 81.9065 786.697 65.5368 791.782 45.6797C796.867 65.5367 805.695 81.9066 818.403 94.6152C831.112 107.324 847.481 116.152 867.338 121.237C847.481 126.322 831.112 135.15 818.403 147.858C805.694 160.567 796.867 176.937 791.782 196.795Z",
|
|
114
|
+
fill: "currentColor",
|
|
115
|
+
stroke: "currentColor",
|
|
116
|
+
strokeWidth: "8",
|
|
117
|
+
strokeLinejoin: "round"
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ jsx("path", {
|
|
120
|
+
d: "M760.632 764.337C720.719 814.616 669.835 855.1 611.872 882.692C553.91 910.285 490.404 924.255 426.213 923.533C362.022 922.812 298.846 907.419 241.518 878.531C184.19 849.643 134.228 808.026 95.4548 756.863C56.6815 705.7 30.1238 646.346 17.8129 583.343C5.50207 520.339 7.76433 455.354 24.4266 393.359C41.089 331.364 71.7099 274.001 113.947 225.658C156.184 177.315 208.919 139.273 268.117 114.442",
|
|
121
|
+
stroke: "currentColor",
|
|
122
|
+
strokeWidth: "30",
|
|
123
|
+
strokeLinecap: "round",
|
|
124
|
+
strokeLinejoin: "round"
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: t("Open in ChatGPT"),
|
|
131
|
+
href: `https://chatgpt.com/?${new URLSearchParams({
|
|
132
|
+
prompt: q,
|
|
133
|
+
hints: "search"
|
|
134
|
+
})}`,
|
|
135
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
136
|
+
role: "img",
|
|
137
|
+
viewBox: "0 0 24 24",
|
|
138
|
+
fill: "currentColor",
|
|
139
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
140
|
+
children: [/* @__PURE__ */ jsx("title", { children: "OpenAI" }), /* @__PURE__ */ jsx("path", { d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" })]
|
|
141
|
+
})
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: t("Open in Claude"),
|
|
145
|
+
href: `https://claude.ai/new?${new URLSearchParams({ q })}`,
|
|
146
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
147
|
+
fill: "currentColor",
|
|
148
|
+
role: "img",
|
|
149
|
+
viewBox: "0 0 24 24",
|
|
150
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
151
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Anthropic" }), /* @__PURE__ */ jsx("path", { d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" })]
|
|
152
|
+
})
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: t("Open in Cursor"),
|
|
156
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
157
|
+
fill: "currentColor",
|
|
158
|
+
role: "img",
|
|
159
|
+
viewBox: "0 0 24 24",
|
|
160
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
161
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Cursor" }), /* @__PURE__ */ jsx("path", { d: "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23" })]
|
|
162
|
+
}),
|
|
163
|
+
href: `https://cursor.com/link/prompt?${new URLSearchParams({ text: q })}`
|
|
164
|
+
}
|
|
165
|
+
].filter((v) => !!v);
|
|
166
|
+
}, [
|
|
167
|
+
githubUrl,
|
|
168
|
+
markdownUrl,
|
|
169
|
+
pathname,
|
|
170
|
+
t
|
|
171
|
+
]);
|
|
172
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
173
|
+
...props,
|
|
174
|
+
className: cn(buttonVariants({
|
|
175
|
+
color: "secondary",
|
|
176
|
+
size: "sm"
|
|
177
|
+
}), "gap-2 data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground", props.className),
|
|
178
|
+
children: [props.children ?? t("Open"), /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 text-fd-muted-foreground" })]
|
|
179
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
180
|
+
className: "flex flex-col",
|
|
181
|
+
children: items.map((item) => /* @__PURE__ */ jsxs("a", {
|
|
182
|
+
href: item.href,
|
|
183
|
+
rel: "noreferrer noopener",
|
|
184
|
+
target: "_blank",
|
|
185
|
+
className: "text-sm p-2 rounded-lg inline-flex items-center gap-2 hover:text-fd-accent-foreground hover:bg-fd-accent [&_svg]:size-4",
|
|
186
|
+
children: [
|
|
187
|
+
item.icon,
|
|
188
|
+
item.title,
|
|
189
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { className: "text-fd-muted-foreground size-3.5 ms-auto" })
|
|
190
|
+
]
|
|
191
|
+
}, item.href))
|
|
192
|
+
})] });
|
|
193
|
+
}
|
|
194
|
+
function withBasePath(href) {
|
|
195
|
+
if (href.match(/^\w+:/) || href.startsWith("//")) return href;
|
|
196
|
+
return (typeof import.meta.env !== "undefined" && typeof import.meta.env.BASE_URL === "string" ? import.meta.env.BASE_URL.replace(/\/$/, "") : "") + href;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
export { MarkdownCopyButton, ViewOptionsPopover };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
//#region src/layouts/shared/slots/language-select.d.ts
|
|
5
|
+
interface LanguageSelectProps extends ComponentProps<'button'> {
|
|
6
|
+
variant?: VariantProps<typeof buttonVariants>['variant'];
|
|
7
|
+
}
|
|
8
|
+
declare function LanguageSelect({ className, variant, children, ...rest }: LanguageSelectProps): React.ReactElement;
|
|
9
|
+
type LanguageSelectTextProps = ComponentProps<'span'>;
|
|
10
|
+
declare function LanguageSelectText(props: LanguageSelectTextProps): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { LanguageSelect, LanguageSelectProps, LanguageSelectText, LanguageSelectTextProps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { useI18n } from "../../../contexts/i18n.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
+
//#region src/layouts/shared/slots/language-select.tsx
|
|
9
|
+
function LanguageSelect({ className, variant = "ghost", children, ...rest }) {
|
|
10
|
+
const context = useI18n();
|
|
11
|
+
const t = useTranslations({ note: "language switcher" });
|
|
12
|
+
if (!context.locales) throw new Error("Missing `<I18nProvider />`");
|
|
13
|
+
const chooseLanguage = t("Choose a language");
|
|
14
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
15
|
+
"aria-label": t("Choose a language", { note: "aria-label" }),
|
|
16
|
+
className: cn(buttonVariants({ variant }), "gap-1.5 p-1.5 data-[state=open]:bg-fd-accent", className),
|
|
17
|
+
...rest,
|
|
18
|
+
children
|
|
19
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
20
|
+
className: "flex flex-col gap-0.5 p-1",
|
|
21
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
22
|
+
className: "p-2 text-xs font-medium text-fd-muted-foreground",
|
|
23
|
+
children: chooseLanguage
|
|
24
|
+
}), context.locales.map((item) => /* @__PURE__ */ jsx("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
className: cn("px-2 py-1.5 text-start text-sm rounded-lg transition-colors", item.locale === context.locale ? "bg-fd-primary/10 text-fd-primary" : "text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"),
|
|
27
|
+
onClick: () => {
|
|
28
|
+
context.onChange?.(item.locale);
|
|
29
|
+
},
|
|
30
|
+
children: item.name
|
|
31
|
+
}, item.locale))]
|
|
32
|
+
})] });
|
|
33
|
+
}
|
|
34
|
+
function LanguageSelectText(props) {
|
|
35
|
+
const { locales, locale } = useI18n();
|
|
36
|
+
const text = locales?.find((item) => item.locale === locale)?.name;
|
|
37
|
+
return /* @__PURE__ */ jsx("span", {
|
|
38
|
+
...props,
|
|
39
|
+
children: text
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { LanguageSelect, LanguageSelectText };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonProps } from "../../../components/ui/button.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
//#region src/layouts/shared/slots/search-trigger.d.ts
|
|
4
|
+
interface SearchTriggerProps extends Omit<ComponentProps<'button'>, 'color'>, ButtonProps {
|
|
5
|
+
hideIfDisabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function SearchTrigger({ hideIfDisabled, size, color, ...props }: SearchTriggerProps): import("react").JSX.Element | null;
|
|
8
|
+
interface FullSearchTriggerProps extends ComponentProps<'button'> {
|
|
9
|
+
hideIfDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function FullSearchTrigger({ hideIfDisabled, ...props }: FullSearchTriggerProps): import("react").JSX.Element | null;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { FullSearchTrigger, FullSearchTriggerProps, SearchTrigger, SearchTriggerProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { useSearchContext } from "../../../contexts/search.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Search } from "lucide-react";
|
|
7
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
+
//#region src/layouts/shared/slots/search-trigger.tsx
|
|
9
|
+
function SearchTrigger({ hideIfDisabled, size = "icon-sm", color = "ghost", ...props }) {
|
|
10
|
+
const { setOpenSearch, enabled } = useSearchContext();
|
|
11
|
+
const t = useTranslations({ note: "search trigger" });
|
|
12
|
+
if (hideIfDisabled && !enabled) return null;
|
|
13
|
+
return /* @__PURE__ */ jsx("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
className: cn(buttonVariants({
|
|
16
|
+
size,
|
|
17
|
+
color
|
|
18
|
+
}), props.className),
|
|
19
|
+
"data-search": "",
|
|
20
|
+
"aria-label": t("Open Search", { note: "aria-label" }),
|
|
21
|
+
onClick: () => {
|
|
22
|
+
setOpenSearch(true);
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ jsx(Search, {})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function FullSearchTrigger({ hideIfDisabled, ...props }) {
|
|
28
|
+
const { enabled, hotKey, setOpenSearch } = useSearchContext();
|
|
29
|
+
const t = useTranslations({ note: "search trigger" });
|
|
30
|
+
if (hideIfDisabled && !enabled) return null;
|
|
31
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
32
|
+
type: "button",
|
|
33
|
+
"data-search-full": "",
|
|
34
|
+
...props,
|
|
35
|
+
className: cn("inline-flex items-center gap-2 rounded-lg border bg-fd-secondary/50 p-1.5 ps-2 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground", props.className),
|
|
36
|
+
onClick: () => {
|
|
37
|
+
setOpenSearch(true);
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Search, { className: "size-4" }),
|
|
41
|
+
t("Search"),
|
|
42
|
+
/* @__PURE__ */ jsx("div", {
|
|
43
|
+
className: "ms-auto inline-flex gap-0.5",
|
|
44
|
+
children: hotKey.map((k, i) => /* @__PURE__ */ jsx("kbd", {
|
|
45
|
+
className: "rounded-md border bg-fd-background px-1.5",
|
|
46
|
+
children: k.display
|
|
47
|
+
}, i))
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { FullSearchTrigger, SearchTrigger };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/layouts/shared/slots/theme-switch.d.ts
|
|
3
|
+
interface ThemeSwitchProps extends ComponentProps<'div'> {
|
|
4
|
+
mode?: 'light-dark' | 'light-dark-system';
|
|
5
|
+
}
|
|
6
|
+
declare function ThemeSwitch({ className, mode, ...props }: ThemeSwitchProps): import("react").JSX.Element;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ThemeSwitch, ThemeSwitchProps };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Airplay, Moon, Sun } from "lucide-react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
+
import { useTheme } from "next-themes";
|
|
9
|
+
import { flushSync } from "react-dom";
|
|
10
|
+
//#region src/layouts/shared/slots/theme-switch.tsx
|
|
11
|
+
const itemVariants = cva("size-6.5 p-1.5 text-fd-muted-foreground", { variants: { active: {
|
|
12
|
+
true: "bg-fd-accent text-fd-accent-foreground",
|
|
13
|
+
false: "text-fd-muted-foreground"
|
|
14
|
+
} } });
|
|
15
|
+
const full = [
|
|
16
|
+
["light", Sun],
|
|
17
|
+
["dark", Moon],
|
|
18
|
+
["system", Airplay]
|
|
19
|
+
];
|
|
20
|
+
function ThemeSwitch({ className, mode = "light-dark", ...props }) {
|
|
21
|
+
const { setTheme, theme, resolvedTheme } = useTheme();
|
|
22
|
+
const [mounted, setMounted] = useState(false);
|
|
23
|
+
const t = useTranslations({ note: "theme switcher" });
|
|
24
|
+
const themeAriaLabels = {
|
|
25
|
+
light: t("Light", { note: "aria-label" }),
|
|
26
|
+
dark: t("Dark", { note: "aria-label" }),
|
|
27
|
+
system: t("System", { note: "aria-label" })
|
|
28
|
+
};
|
|
29
|
+
const handleThemeChange = (newTheme) => {
|
|
30
|
+
if (document?.startViewTransition) document.startViewTransition(() => flushSync(() => setTheme(newTheme)));
|
|
31
|
+
else setTheme(newTheme);
|
|
32
|
+
};
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setMounted(true);
|
|
35
|
+
}, []);
|
|
36
|
+
const container = cn("inline-flex items-center rounded-full border p-1 overflow-hidden *:rounded-full", className);
|
|
37
|
+
if (mode === "light-dark") {
|
|
38
|
+
const value = mounted ? resolvedTheme : null;
|
|
39
|
+
return /* @__PURE__ */ jsx("button", {
|
|
40
|
+
className: container,
|
|
41
|
+
"aria-label": t("Toggle Theme", { note: "aria-label" }),
|
|
42
|
+
onClick: () => handleThemeChange(value === "light" ? "dark" : "light"),
|
|
43
|
+
"data-theme-toggle": "",
|
|
44
|
+
children: full.map(([key, Icon]) => {
|
|
45
|
+
if (key === "system") return;
|
|
46
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
47
|
+
fill: "currentColor",
|
|
48
|
+
className: cn(itemVariants({ active: value === key }))
|
|
49
|
+
}, key);
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const value = mounted ? theme : null;
|
|
54
|
+
return /* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: container,
|
|
56
|
+
"data-theme-toggle": "",
|
|
57
|
+
...props,
|
|
58
|
+
children: full.map(([key, Icon]) => /* @__PURE__ */ jsx("button", {
|
|
59
|
+
"aria-label": themeAriaLabels[key],
|
|
60
|
+
className: cn(itemVariants({ active: value === key })),
|
|
61
|
+
onClick: () => handleThemeChange(key),
|
|
62
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
63
|
+
className: "size-full",
|
|
64
|
+
fill: "currentColor"
|
|
65
|
+
})
|
|
66
|
+
}, key))
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { ThemeSwitch };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/legacy/layout.d.ts
|
|
3
|
+
interface PageStyles {
|
|
4
|
+
tocNav?: string;
|
|
5
|
+
toc?: string;
|
|
6
|
+
page?: string;
|
|
7
|
+
article?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function usePageStyles(): PageStyles;
|
|
10
|
+
declare function StylesProvider({ children, ...value }: PageStyles & {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
interface NavProviderProps {
|
|
14
|
+
/**
|
|
15
|
+
* Use transparent background
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue none
|
|
18
|
+
*/
|
|
19
|
+
transparentMode?: 'always' | 'top' | 'none';
|
|
20
|
+
}
|
|
21
|
+
interface NavContextType {
|
|
22
|
+
isTransparent: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare function NavProvider({ transparentMode, children }: NavProviderProps & {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
declare function useNav(): NavContextType;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { NavProvider, NavProviderProps, PageStyles, StylesProvider, useNav, usePageStyles };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use, useEffect, useMemo, useState } from "react";
|
|
4
|
+
//#region src/legacy/layout.tsx
|
|
5
|
+
/**
|
|
6
|
+
* applied styles to different layout components in `Page` from layouts
|
|
7
|
+
*/
|
|
8
|
+
const StylesContext = createContext({
|
|
9
|
+
tocNav: "xl:hidden",
|
|
10
|
+
toc: "max-xl:hidden"
|
|
11
|
+
});
|
|
12
|
+
function usePageStyles() {
|
|
13
|
+
return use(StylesContext);
|
|
14
|
+
}
|
|
15
|
+
function StylesProvider({ children, ...value }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(StylesContext.Provider, {
|
|
17
|
+
value,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const NavContext = createContext({ isTransparent: false });
|
|
22
|
+
function NavProvider({ transparentMode = "none", children }) {
|
|
23
|
+
const [transparent, setTransparent] = useState(transparentMode !== "none");
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (transparentMode !== "top") return;
|
|
26
|
+
const listener = () => {
|
|
27
|
+
setTransparent(window.scrollY < 10);
|
|
28
|
+
};
|
|
29
|
+
listener();
|
|
30
|
+
window.addEventListener("scroll", listener);
|
|
31
|
+
return () => {
|
|
32
|
+
window.removeEventListener("scroll", listener);
|
|
33
|
+
};
|
|
34
|
+
}, [transparentMode]);
|
|
35
|
+
return /* @__PURE__ */ jsx(NavContext, {
|
|
36
|
+
value: useMemo(() => ({ isTransparent: transparent }), [transparent]),
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function useNav() {
|
|
41
|
+
return use(NavContext);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { NavProvider, StylesProvider, useNav, usePageStyles };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dispatch, ReactNode, RefObject, SetStateAction } from "react";
|
|
2
|
+
//#region src/legacy/sidebar.d.ts
|
|
3
|
+
declare function useSidebar(): {
|
|
4
|
+
open: boolean;
|
|
5
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
collapsed: boolean;
|
|
7
|
+
setCollapsed: Dispatch<SetStateAction<boolean>>;
|
|
8
|
+
closeOnRedirect: RefObject<boolean>;
|
|
9
|
+
};
|
|
10
|
+
declare function SidebarProvider({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SidebarProvider, useSidebar };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
6
|
+
//#region src/legacy/sidebar.tsx
|
|
7
|
+
const SidebarContext = createContext(null);
|
|
8
|
+
function useSidebar() {
|
|
9
|
+
const ctx = use(SidebarContext);
|
|
10
|
+
if (!ctx) throw new Error("the component must be wrapped under <SidebarProvider /> (@vx-oss/docs-react/legacy/sidebar)");
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
function SidebarProvider({ children }) {
|
|
14
|
+
const [open, setOpen] = useState(false);
|
|
15
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
16
|
+
const closeOnRedirect = useRef(true);
|
|
17
|
+
const pathname = usePathname();
|
|
18
|
+
useOnChange(pathname, () => {
|
|
19
|
+
if (closeOnRedirect.current) setOpen(false);
|
|
20
|
+
else closeOnRedirect.current = true;
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx(SidebarContext, {
|
|
23
|
+
value: useMemo(() => ({
|
|
24
|
+
closeOnRedirect,
|
|
25
|
+
collapsed,
|
|
26
|
+
open,
|
|
27
|
+
setCollapsed,
|
|
28
|
+
setOpen
|
|
29
|
+
}), [open, collapsed]),
|
|
30
|
+
children
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { SidebarProvider, useSidebar };
|
package/dist/mdx.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from "./components/callout.js";
|
|
2
|
+
import { Card, Cards } from "./components/card.js";
|
|
3
|
+
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from "./components/codeblock.js";
|
|
4
|
+
import { createRelativeLink as createRelativeLink$1 } from "./mdx.server.js";
|
|
5
|
+
import React, { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from "react";
|
|
6
|
+
//#region src/mdx.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* global types for MDX.js
|
|
9
|
+
*/
|
|
10
|
+
declare module 'mdx/types.js' {
|
|
11
|
+
namespace JSX {
|
|
12
|
+
type Element = React.JSX.Element;
|
|
13
|
+
type ElementClass = React.JSX.ElementClass;
|
|
14
|
+
type ElementType = React.JSX.ElementType;
|
|
15
|
+
type IntrinsicElements = React.JSX.IntrinsicElements;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare function Image(props: ImgHTMLAttributes<HTMLImageElement>): React.JSX.Element;
|
|
19
|
+
declare function Table(props: TableHTMLAttributes<HTMLTableElement>): React.JSX.Element;
|
|
20
|
+
declare const defaultMdxComponents: {
|
|
21
|
+
CodeBlockTab: typeof CodeBlockTab;
|
|
22
|
+
CodeBlockTabs: typeof CodeBlockTabs;
|
|
23
|
+
CodeBlockTabsList: typeof CodeBlockTabsList;
|
|
24
|
+
CodeBlockTabsTrigger: typeof CodeBlockTabsTrigger;
|
|
25
|
+
pre: (props: HTMLAttributes<HTMLPreElement>) => React.JSX.Element;
|
|
26
|
+
Card: typeof Card;
|
|
27
|
+
Cards: typeof Cards;
|
|
28
|
+
a: FC<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
29
|
+
img: typeof Image;
|
|
30
|
+
h1: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
31
|
+
h2: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
32
|
+
h3: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
33
|
+
h4: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
34
|
+
h5: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
35
|
+
h6: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
36
|
+
table: typeof Table;
|
|
37
|
+
Callout: typeof Callout;
|
|
38
|
+
CalloutContainer: typeof CalloutContainer;
|
|
39
|
+
CalloutTitle: typeof CalloutTitle;
|
|
40
|
+
CalloutDescription: typeof CalloutDescription;
|
|
41
|
+
};
|
|
42
|
+
declare const createRelativeLink: typeof createRelativeLink$1;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
package/dist/mdx.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cn } from "./utils/cn.js";
|
|
2
|
+
import { Card, Cards } from "./components/card.js";
|
|
3
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from "./components/callout.js";
|
|
4
|
+
import { Heading } from "./components/heading.js";
|
|
5
|
+
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "./components/codeblock.js";
|
|
6
|
+
import Link from "@vx-oss/docs-core/link";
|
|
7
|
+
import { Image } from "@vx-oss/docs-core/framework";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
//#region src/mdx.tsx
|
|
10
|
+
function Image$1(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Image, {
|
|
12
|
+
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px",
|
|
13
|
+
...props,
|
|
14
|
+
className: cn("rounded-lg", props.className)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function Table(props) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "relative overflow-auto prose-no-margin my-6",
|
|
20
|
+
children: /* @__PURE__ */ jsx("table", { ...props })
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const defaultMdxComponents = {
|
|
24
|
+
CodeBlockTab,
|
|
25
|
+
CodeBlockTabs,
|
|
26
|
+
CodeBlockTabsList,
|
|
27
|
+
CodeBlockTabsTrigger,
|
|
28
|
+
pre: (props) => /* @__PURE__ */ jsx(CodeBlock, {
|
|
29
|
+
...props,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Pre, { children: props.children })
|
|
31
|
+
}),
|
|
32
|
+
Card,
|
|
33
|
+
Cards,
|
|
34
|
+
a: Link,
|
|
35
|
+
img: Image$1,
|
|
36
|
+
h1: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
37
|
+
as: "h1",
|
|
38
|
+
...props
|
|
39
|
+
}),
|
|
40
|
+
h2: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
41
|
+
as: "h2",
|
|
42
|
+
...props
|
|
43
|
+
}),
|
|
44
|
+
h3: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
45
|
+
as: "h3",
|
|
46
|
+
...props
|
|
47
|
+
}),
|
|
48
|
+
h4: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
49
|
+
as: "h4",
|
|
50
|
+
...props
|
|
51
|
+
}),
|
|
52
|
+
h5: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
53
|
+
as: "h5",
|
|
54
|
+
...props
|
|
55
|
+
}),
|
|
56
|
+
h6: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
57
|
+
as: "h6",
|
|
58
|
+
...props
|
|
59
|
+
}),
|
|
60
|
+
table: Table,
|
|
61
|
+
Callout,
|
|
62
|
+
CalloutContainer,
|
|
63
|
+
CalloutTitle,
|
|
64
|
+
CalloutDescription
|
|
65
|
+
};
|
|
66
|
+
const createRelativeLink = () => {
|
|
67
|
+
throw new Error("`createRelativeLink` is only supported in Node.js environment");
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import defaultMdxComponents from "./mdx.js";
|
|
2
|
+
import { ComponentProps, FC } from "react";
|
|
3
|
+
import { LoaderConfig, LoaderOutput, Page } from "@vx-oss/docs-core/source";
|
|
4
|
+
//#region src/mdx.server.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Extend the default Link component to resolve relative file paths in `href`.
|
|
7
|
+
*
|
|
8
|
+
* @param page the current page
|
|
9
|
+
* @param source the source object
|
|
10
|
+
* @param OverrideLink The component to override from
|
|
11
|
+
*/
|
|
12
|
+
declare function createRelativeLink<C extends LoaderConfig>(source: LoaderOutput<C>, page: Page | C['page'], OverrideLink?: FC<ComponentProps<'a'>>): FC<ComponentProps<'a'>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { createRelativeLink, defaultMdxComponents as default };
|