@wrksz/docs 0.0.0-stage → 0.1.1
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 +157 -2
- package/dist/agents.d.ts +30 -0
- package/dist/agents.js +70 -0
- package/dist/components/agent-logos.js +90 -0
- package/dist/components/agent-prompt.d.ts +29 -0
- package/dist/components/agent-prompt.js +100 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +26 -0
- package/dist/components/brand.js +32 -0
- package/dist/components/callout.d.ts +24 -0
- package/dist/components/callout.js +58 -0
- package/dist/components/cards.d.ts +26 -0
- package/dist/components/cards.js +48 -0
- package/dist/components/code-body.js +18 -0
- package/dist/components/code-group.d.ts +20 -0
- package/dist/components/code-group.js +41 -0
- package/dist/components/code-tabs.d.ts +30 -0
- package/dist/components/code-tabs.js +49 -0
- package/dist/components/content-tabs.d.ts +14 -0
- package/dist/components/content-tabs.js +27 -0
- package/dist/components/copy-code.js +41 -0
- package/dist/components/deferred-analytics.js +5 -0
- package/dist/components/details.d.ts +20 -0
- package/dist/components/details.js +29 -0
- package/dist/components/heading-link.js +23 -0
- package/dist/components/heading.d.ts +5 -0
- package/dist/components/heading.js +22 -0
- package/dist/components/icons.js +362 -0
- package/dist/components/image.d.ts +27 -0
- package/dist/components/image.js +204 -0
- package/dist/components/inline-text.js +14 -0
- package/dist/components/install.d.ts +22 -0
- package/dist/components/install.js +62 -0
- package/dist/components/mdx-tabs.d.ts +22 -0
- package/dist/components/mdx-tabs.js +30 -0
- package/dist/components/practice.d.ts +41 -0
- package/dist/components/practice.js +99 -0
- package/dist/components/props.d.ts +37 -0
- package/dist/components/props.js +70 -0
- package/dist/components/status.js +35 -0
- package/dist/components/steps.d.ts +18 -0
- package/dist/components/steps.js +23 -0
- package/dist/components/theme-switch.js +31 -0
- package/dist/components/ui/kbd.js +410 -0
- package/dist/components/ui/scroll-area.js +169 -0
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.js +103 -0
- package/dist/components/ui/tabs.js +69 -0
- package/dist/components/ui/toast.js +629 -0
- package/dist/components/ui/tooltip.js +31 -0
- package/dist/components/wrksz-mark.js +12 -0
- package/dist/docs/index.d.ts +8 -0
- package/dist/docs/index.js +8 -0
- package/dist/docs/layout.d.ts +6 -0
- package/dist/docs/layout.js +10 -0
- package/dist/docs/page-actions.d.ts +36 -0
- package/dist/docs/page-actions.js +136 -0
- package/dist/docs/page-footer.d.ts +14 -0
- package/dist/docs/page-footer.js +68 -0
- package/dist/docs/page-header.d.ts +13 -0
- package/dist/docs/page-header.js +57 -0
- package/dist/docs/page.d.ts +16 -0
- package/dist/docs/page.js +38 -0
- package/dist/docs/reading.js +64 -0
- package/dist/docs/shell.js +101 -0
- package/dist/docs/sidebar.js +161 -0
- package/dist/docs/toc-bar.d.ts +12 -0
- package/dist/docs/toc-bar.js +132 -0
- package/dist/docs/toc.d.ts +11 -0
- package/dist/docs/toc.js +127 -0
- package/dist/fonts/Inter-Italic.woff2 +0 -0
- package/dist/fonts/Inter-LICENSE.txt +92 -0
- package/dist/fonts/Inter.woff2 +0 -0
- package/dist/fonts/IoskeleyMono-Bold.woff2 +0 -0
- package/dist/fonts/IoskeleyMono-Italic.woff2 +0 -0
- package/dist/fonts/IoskeleyMono-LICENSE.txt +92 -0
- package/dist/fonts/IoskeleyMono-Regular.woff2 +0 -0
- package/dist/fonts.d.ts +1 -0
- package/dist/fonts.js +38 -0
- package/dist/home/features.d.ts +39 -0
- package/dist/home/features.js +75 -0
- package/dist/home/footer.d.ts +4 -0
- package/dist/home/footer.js +79 -0
- package/dist/home/hero-content.js +102 -0
- package/dist/home/hero-install.js +128 -0
- package/dist/home/hero-stage.d.ts +4 -0
- package/dist/home/hero-stage.js +9 -0
- package/dist/home/hero.d.ts +6 -0
- package/dist/home/hero.js +16 -0
- package/dist/home/home-header.d.ts +1 -0
- package/dist/home/home-header.js +173 -0
- package/dist/home/index.d.ts +7 -0
- package/dist/home/index.js +7 -0
- package/dist/home/layout.d.ts +6 -0
- package/dist/home/layout.js +15 -0
- package/dist/home/reveal.js +31 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/lib/clipboard.js +55 -0
- package/dist/lib/cn.js +1 -0
- package/dist/lib/format.js +9 -0
- package/dist/lib/package-manager-script.js +12 -0
- package/dist/lib/package-manager.js +54 -0
- package/dist/lib/theme-config.js +10 -0
- package/dist/llms.d.ts +34 -0
- package/dist/llms.js +111 -0
- package/dist/next.d.ts +18 -0
- package/dist/next.js +45 -0
- package/dist/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +930 -0
- package/dist/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.ts +81 -0
- package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +80 -0
- package/dist/registry.d.ts +61 -0
- package/dist/registry.js +113 -0
- package/dist/root.d.ts +9 -0
- package/dist/root.js +34 -0
- package/dist/search.d.ts +5 -0
- package/dist/search.js +43 -0
- package/dist/seo/index.d.ts +6 -0
- package/dist/seo/index.js +6 -0
- package/dist/seo/json-ld.d.ts +17 -0
- package/dist/seo/json-ld.js +88 -0
- package/dist/seo/metadata.d.ts +21 -0
- package/dist/seo/metadata.js +75 -0
- package/dist/seo/robots.d.ts +14 -0
- package/dist/seo/robots.js +18 -0
- package/dist/seo/sitemap.d.ts +16 -0
- package/dist/seo/sitemap.js +26 -0
- package/dist/seo/url.d.ts +6 -0
- package/dist/seo/url.js +11 -0
- package/dist/server.js +63 -0
- package/dist/site-context.js +17 -0
- package/dist/site.d.ts +41 -0
- package/dist/site.js +13 -0
- package/dist/source/compile.d.ts +6 -0
- package/dist/source/compile.js +32 -0
- package/dist/source/errors.d.ts +4 -0
- package/dist/source/errors.js +10 -0
- package/dist/source/frontmatter.d.ts +13 -0
- package/dist/source/frontmatter.js +102 -0
- package/dist/source/highlight.js +102 -0
- package/dist/source/index.d.ts +36 -0
- package/dist/source/index.js +102 -0
- package/dist/source/markdown.d.ts +48 -0
- package/dist/source/markdown.js +393 -0
- package/dist/source/prompt.js +33 -0
- package/dist/source/scan.d.ts +8 -0
- package/dist/source/scan.js +64 -0
- package/dist/source/toc.d.ts +5 -0
- package/dist/source/toc.js +28 -0
- package/dist/source/tree.d.ts +29 -0
- package/dist/source/tree.js +91 -0
- package/dist/styles.css +879 -0
- package/dist/typography.d.ts +101 -0
- package/dist/typography.js +232 -0
- package/package.json +84 -4
package/dist/fonts.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import localFont from "next/font/local";
|
|
2
|
+
// src/fonts.ts
|
|
3
|
+
const inter = localFont({
|
|
4
|
+
src: [{
|
|
5
|
+
path: "./fonts/Inter.woff2",
|
|
6
|
+
weight: "100 900",
|
|
7
|
+
style: "normal"
|
|
8
|
+
}, {
|
|
9
|
+
path: "./fonts/Inter-Italic.woff2",
|
|
10
|
+
weight: "100 900",
|
|
11
|
+
style: "italic"
|
|
12
|
+
}],
|
|
13
|
+
variable: "--font-inter",
|
|
14
|
+
display: "swap"
|
|
15
|
+
});
|
|
16
|
+
const ioskeleyMono = localFont({
|
|
17
|
+
src: [
|
|
18
|
+
{
|
|
19
|
+
path: "./fonts/IoskeleyMono-Regular.woff2",
|
|
20
|
+
weight: "400",
|
|
21
|
+
style: "normal"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: "./fonts/IoskeleyMono-Bold.woff2",
|
|
25
|
+
weight: "700",
|
|
26
|
+
style: "normal"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
path: "./fonts/IoskeleyMono-Italic.woff2",
|
|
30
|
+
weight: "400",
|
|
31
|
+
style: "italic"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
variable: "--font-ioskeley-mono",
|
|
35
|
+
display: "swap"
|
|
36
|
+
});
|
|
37
|
+
const fontVariables = `${inter.variable} ${ioskeleyMono.variable}`;
|
|
38
|
+
export { fontVariables };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The features of the project on the home page: a label and a grid of tiles, three across
|
|
4
|
+
* on a wide screen, two on a tablet and one on a phone. They come in one after another when
|
|
5
|
+
* the section scrolls into view, or right after the hero when it is already on screen.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Features>
|
|
9
|
+
* <Feature image={{ src: "/features/toc-light.png", dark: "/features/toc-dark.png" }} title="…">
|
|
10
|
+
* The marker covers every section on screen.
|
|
11
|
+
* </Feature>
|
|
12
|
+
* </Features>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function Features({ label, className, children }: {
|
|
16
|
+
/** The line above the grid. */
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
/** A picture of a feature: one file, or one per theme. */
|
|
22
|
+
export type FeatureImage = {
|
|
23
|
+
src: string;
|
|
24
|
+
dark?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* One tile: a picture of the feature on the card ground, its name and a sentence or two.
|
|
28
|
+
* The picture is an image (`image`, with an optional dark file) or anything drawn in place
|
|
29
|
+
* (`art`, which gets the tile's hover through `group-hover/feature:`). Images fill the tile
|
|
30
|
+
* at its 36:25 ratio, so export them at that size, e.g. 1152 x 800.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Feature({ image, art, title, className, children }: {
|
|
33
|
+
image?: FeatureImage;
|
|
34
|
+
art?: ReactNode;
|
|
35
|
+
title: ReactNode;
|
|
36
|
+
className?: string;
|
|
37
|
+
/** What it does, in a sentence or two. */
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { Reveal } from "./reveal.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/home/features.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The features of the project on the home page: a label and a grid of tiles, three across
|
|
7
|
+
* on a wide screen, two on a tablet and one on a phone. They come in one after another when
|
|
8
|
+
* the section scrolls into view, or right after the hero when it is already on screen.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Features>
|
|
12
|
+
* <Feature image={{ src: "/features/toc-light.png", dark: "/features/toc-dark.png" }} title="…">
|
|
13
|
+
* The marker covers every section on screen.
|
|
14
|
+
* </Feature>
|
|
15
|
+
* </Features>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function Features({ label = "Features", className, children }) {
|
|
19
|
+
return /* @__PURE__ */ jsx("section", {
|
|
20
|
+
"aria-label": typeof label === "string" ? label : void 0,
|
|
21
|
+
className: cn("w-full max-w-4xl pb-24 sm:pb-32", className),
|
|
22
|
+
children: /* @__PURE__ */ jsxs(Reveal, {
|
|
23
|
+
className: "flex flex-col gap-8",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
25
|
+
"data-reveal-item": true,
|
|
26
|
+
className: "text-[0.9375rem] text-fd-muted-foreground",
|
|
27
|
+
children: label
|
|
28
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: "docs-reveal-grid grid gap-x-8 gap-y-12 sm:grid-cols-2 lg:grid-cols-3",
|
|
30
|
+
children
|
|
31
|
+
})]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* One tile: a picture of the feature on the card ground, its name and a sentence or two.
|
|
37
|
+
* The picture is an image (`image`, with an optional dark file) or anything drawn in place
|
|
38
|
+
* (`art`, which gets the tile's hover through `group-hover/feature:`). Images fill the tile
|
|
39
|
+
* at its 36:25 ratio, so export them at that size, e.g. 1152 x 800.
|
|
40
|
+
*/
|
|
41
|
+
function Feature({ image, art, title, className, children }) {
|
|
42
|
+
const picture = "absolute inset-0 size-full object-cover object-top";
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
"data-reveal-item": true,
|
|
45
|
+
className: cn("group/feature flex flex-col", className),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx("div", {
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
className: "relative grid aspect-[36/25] place-items-center overflow-hidden rounded-2xl bg-fd-card select-none",
|
|
50
|
+
children: image ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("img", {
|
|
51
|
+
src: image.src,
|
|
52
|
+
alt: "",
|
|
53
|
+
loading: "lazy",
|
|
54
|
+
decoding: "async",
|
|
55
|
+
className: cn(picture, image.dark && "dark:hidden")
|
|
56
|
+
}), image.dark ? /* @__PURE__ */ jsx("img", {
|
|
57
|
+
src: image.dark,
|
|
58
|
+
alt: "",
|
|
59
|
+
loading: "lazy",
|
|
60
|
+
decoding: "async",
|
|
61
|
+
className: cn(picture, "hidden dark:block")
|
|
62
|
+
}) : null] }) : art
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx("h3", {
|
|
65
|
+
className: "mt-4 text-[0.9375rem] font-medium text-fd-foreground",
|
|
66
|
+
children: title
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ jsx("p", {
|
|
69
|
+
className: "mt-1 text-[0.9375rem] leading-relaxed text-pretty text-fd-muted-foreground",
|
|
70
|
+
children
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export { Feature, Features };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import { WrkszMark } from "../components/wrksz-mark.js";
|
|
3
|
+
import { registryUrl } from "../registry.js";
|
|
4
|
+
import { githubUrl } from "../site.js";
|
|
5
|
+
import { Caption } from "../typography.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/home/footer.tsx
|
|
8
|
+
const YEAR = (/* @__PURE__ */ new Date()).getFullYear();
|
|
9
|
+
const LINK = "w-fit rounded-sm text-fd-foreground outline-none transition-colors duration-200 ease-out hover:text-fd-muted-foreground focus-visible:ring-2 focus-visible:ring-fd-ring";
|
|
10
|
+
const MUTED_LINK = "rounded-sm outline-none transition-colors duration-200 ease-out hover:text-fd-foreground focus-visible:ring-2 focus-visible:ring-fd-ring";
|
|
11
|
+
function external(href) {
|
|
12
|
+
return href.startsWith("http") ? {
|
|
13
|
+
target: "_blank",
|
|
14
|
+
rel: "noopener noreferrer"
|
|
15
|
+
} : {};
|
|
16
|
+
}
|
|
17
|
+
function Footer({ site }) {
|
|
18
|
+
const COLUMNS = [
|
|
19
|
+
{
|
|
20
|
+
label: "Guides",
|
|
21
|
+
links: [{
|
|
22
|
+
label: "Getting started",
|
|
23
|
+
href: "/docs"
|
|
24
|
+
}]
|
|
25
|
+
},
|
|
26
|
+
...site.footer ?? [],
|
|
27
|
+
{
|
|
28
|
+
label: "Project",
|
|
29
|
+
links: [{
|
|
30
|
+
label: "GitHub",
|
|
31
|
+
href: githubUrl(site)
|
|
32
|
+
}, {
|
|
33
|
+
label: site.package.registry.label,
|
|
34
|
+
href: registryUrl(site.package)
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
return /* @__PURE__ */ jsxs("footer", {
|
|
39
|
+
className: "grid w-full max-w-4xl grid-cols-2 gap-x-6 gap-y-10 pt-12 pb-10 text-sm sm:flex sm:items-start sm:gap-16",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Link, {
|
|
42
|
+
href: "/",
|
|
43
|
+
"aria-label": `${site.name} home`,
|
|
44
|
+
className: "col-span-2 w-fit self-start rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-fd-ring sm:me-auto",
|
|
45
|
+
children: /* @__PURE__ */ jsx(WrkszMark, { className: "mt-0.5 h-4 w-7 text-fd-foreground" })
|
|
46
|
+
}),
|
|
47
|
+
COLUMNS.map((column) => /* @__PURE__ */ jsxs("nav", {
|
|
48
|
+
"aria-label": column.label,
|
|
49
|
+
children: [/* @__PURE__ */ jsx(Caption, {
|
|
50
|
+
className: "mb-1",
|
|
51
|
+
children: column.label
|
|
52
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
53
|
+
className: "flex flex-col gap-1",
|
|
54
|
+
children: column.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
|
|
55
|
+
href: link.href,
|
|
56
|
+
...external(link.href),
|
|
57
|
+
className: LINK,
|
|
58
|
+
children: link.label
|
|
59
|
+
}) }, link.href))
|
|
60
|
+
})]
|
|
61
|
+
}, column.label)),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", {
|
|
63
|
+
className: "col-span-2 flex flex-col gap-1 sm:items-end sm:ps-8",
|
|
64
|
+
children: [/* @__PURE__ */ jsx(Caption, { children: "MIT License" }), /* @__PURE__ */ jsxs(Caption, { children: [
|
|
65
|
+
"© ",
|
|
66
|
+
YEAR,
|
|
67
|
+
" ",
|
|
68
|
+
/* @__PURE__ */ jsx("a", {
|
|
69
|
+
href: "https://wrksz.dev",
|
|
70
|
+
...external("https://wrksz.dev"),
|
|
71
|
+
className: MUTED_LINK,
|
|
72
|
+
children: "wrksz.dev"
|
|
73
|
+
})
|
|
74
|
+
] })]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export { Footer };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { ArrowRightIcon, DownloadIcon, GitHubIcon, NpmIcon, PyPIIcon, StarIcon } from "../components/icons.js";
|
|
4
|
+
import { Shortcut } from "../components/ui/kbd.js";
|
|
5
|
+
import { formatCount } from "../lib/format.js";
|
|
6
|
+
import { registryUrl } from "../registry.js";
|
|
7
|
+
import { githubUrl } from "../site.js";
|
|
8
|
+
import { useSite } from "../site-context.js";
|
|
9
|
+
import { Caption, Lead, Title } from "../typography.js";
|
|
10
|
+
import { HeroInstall } from "./hero-install.js";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
// src/home/hero-content.tsx
|
|
13
|
+
const BUTTON = "inline-flex h-9 shrink-0 cursor-pointer items-center gap-2 rounded-[10px] px-3.5 text-sm font-medium whitespace-nowrap outline-none select-none focus-visible:ring-2 focus-visible:ring-fd-ring focus-visible:ring-offset-2 focus-visible:ring-offset-fd-background active:scale-[0.97]";
|
|
14
|
+
const REGISTRY_ICONS = {
|
|
15
|
+
npm: NpmIcon,
|
|
16
|
+
pypi: PyPIIcon
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Gap between the hero's pieces as they come in: the name and lead first, then the picture,
|
|
20
|
+
* the actions and the search hint. The features below pick up after them (`docs-reveal`).
|
|
21
|
+
*/
|
|
22
|
+
const HERO_STEP = 70;
|
|
23
|
+
function enterDelay(ms) {
|
|
24
|
+
return { "--docs-enter-delay": `${ms}ms` };
|
|
25
|
+
}
|
|
26
|
+
function ExternalButton({ href, icon: Icon, label, stat, statIcon: StatIcon }) {
|
|
27
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
28
|
+
href,
|
|
29
|
+
target: "_blank",
|
|
30
|
+
rel: "noopener noreferrer",
|
|
31
|
+
className: `${BUTTON} control-raised group text-fd-foreground`,
|
|
32
|
+
children: [
|
|
33
|
+
Icon ? /* @__PURE__ */ jsx(Icon, { className: "size-4" }) : null,
|
|
34
|
+
label,
|
|
35
|
+
stat != null ? /* @__PURE__ */ jsxs("span", {
|
|
36
|
+
className: "-me-0.5 flex items-center gap-1 border-s border-fd-border ps-2 font-normal text-fd-muted-foreground tabular-nums transition-colors duration-150 group-hover:text-fd-foreground",
|
|
37
|
+
children: [/* @__PURE__ */ jsx(StatIcon, { className: "size-3.5" }), stat]
|
|
38
|
+
}) : null
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function HeroContent({ stars, downloads, art }) {
|
|
43
|
+
const site = useSite();
|
|
44
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
art ? /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: "docs-enter",
|
|
47
|
+
style: enterDelay(HERO_STEP),
|
|
48
|
+
children: art
|
|
49
|
+
}) : null,
|
|
50
|
+
/* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: `docs-enter ${art ? "mt-8 sm:mt-10" : "pt-16 sm:pt-24"}`,
|
|
52
|
+
style: enterDelay(0),
|
|
53
|
+
children: [/* @__PURE__ */ jsx(Title, {
|
|
54
|
+
className: "text-lg leading-snug tracking-normal",
|
|
55
|
+
children: site.package.name
|
|
56
|
+
}), /* @__PURE__ */ jsx(Lead, {
|
|
57
|
+
className: "max-w-xl text-base",
|
|
58
|
+
children: site.description
|
|
59
|
+
})]
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: "docs-enter mt-6 flex flex-wrap items-center gap-2.5",
|
|
63
|
+
style: enterDelay(HERO_STEP * (art ? 2 : 1)),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsxs(Link, {
|
|
66
|
+
href: "/docs",
|
|
67
|
+
className: `${BUTTON} control-ink ps-4 pe-3.5`,
|
|
68
|
+
children: ["Get started", /* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-4" })]
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ jsx(ExternalButton, {
|
|
71
|
+
href: githubUrl(site),
|
|
72
|
+
icon: GitHubIcon,
|
|
73
|
+
label: "GitHub",
|
|
74
|
+
stat: stars != null ? formatCount(stars) : null,
|
|
75
|
+
statIcon: StarIcon
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx(ExternalButton, {
|
|
78
|
+
href: registryUrl(site.package),
|
|
79
|
+
icon: REGISTRY_ICONS[site.package.registry.icon ?? ""],
|
|
80
|
+
label: site.package.registry.label,
|
|
81
|
+
stat: downloads != null ? `${formatCount(downloads)}/wk` : null,
|
|
82
|
+
statIcon: DownloadIcon
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx(HeroInstall, {})
|
|
85
|
+
]
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "docs-enter mt-4 max-sm:hidden",
|
|
89
|
+
style: enterDelay(HERO_STEP * (art ? 3 : 2)),
|
|
90
|
+
children: /* @__PURE__ */ jsxs(Caption, { children: [
|
|
91
|
+
"Press ",
|
|
92
|
+
/* @__PURE__ */ jsx(Shortcut, {
|
|
93
|
+
keys: "mod+k",
|
|
94
|
+
size: "sm",
|
|
95
|
+
className: "mx-0.5 align-middle"
|
|
96
|
+
}),
|
|
97
|
+
" to search the docs."
|
|
98
|
+
] })
|
|
99
|
+
})
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
export { HeroContent };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Menu } from "@base-ui/react/menu";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { copyText, useCopy } from "../lib/clipboard.js";
|
|
5
|
+
import { CheckIcon, ChevronDownIcon, CopyIcon } from "../components/icons.js";
|
|
6
|
+
import { usePackageManager, usePmReady, writePm } from "../lib/package-manager.js";
|
|
7
|
+
import { installCommands } from "../registry.js";
|
|
8
|
+
import { useSite } from "../site-context.js";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/home/hero-install.tsx
|
|
11
|
+
const CHEVRON = "ms-0.5 size-3.5";
|
|
12
|
+
function Parts({ pm, command, trigger }) {
|
|
13
|
+
const rest = command.slice(pm.length).trimStart();
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx("span", {
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
className: "me-[1ch] select-none text-(--code-muted)",
|
|
18
|
+
children: "$"
|
|
19
|
+
}),
|
|
20
|
+
trigger ?? /* @__PURE__ */ jsxs("span", {
|
|
21
|
+
className: "flex items-center gap-0.5 text-(--code-command)",
|
|
22
|
+
children: [pm, /* @__PURE__ */ jsx(ChevronDownIcon, { className: `${CHEVRON} text-fd-muted-foreground` })]
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsx("code", {
|
|
25
|
+
className: "ms-[1ch] whitespace-pre text-(--code-arg)",
|
|
26
|
+
children: rest
|
|
27
|
+
})
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
/** Switches the package manager and copies its command, so picking one is all it takes. */
|
|
31
|
+
async function pickAndCopy(registry, manager, command) {
|
|
32
|
+
writePm(registry, manager);
|
|
33
|
+
await copyText(command, { notify: true });
|
|
34
|
+
}
|
|
35
|
+
function HeroInstall() {
|
|
36
|
+
const field = useRef(null);
|
|
37
|
+
const { package: pkg } = useSite();
|
|
38
|
+
const pm = usePackageManager(pkg.registry);
|
|
39
|
+
const ready = usePmReady();
|
|
40
|
+
const commands = installCommands(pkg.registry, pkg.name);
|
|
41
|
+
const longest = commands.reduce((a, b) => b.command.length > a.command.length ? b : a);
|
|
42
|
+
const command = commands.find((item) => item.manager === pm)?.command ?? "";
|
|
43
|
+
const { copied, copy } = useCopy();
|
|
44
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
ref: field,
|
|
46
|
+
"data-pm-registry": pkg.registry.id,
|
|
47
|
+
"data-pm-ready": ready ? "" : void 0,
|
|
48
|
+
className: "panel-raised flex h-9 max-w-full min-w-0 items-center gap-2 rounded-[10px] ps-3.5 pe-1",
|
|
49
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
50
|
+
className: "grid font-mono text-[13px]",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx("span", {
|
|
53
|
+
"aria-hidden": true,
|
|
54
|
+
className: "invisible col-start-1 row-start-1 flex items-center",
|
|
55
|
+
children: /* @__PURE__ */ jsx(Parts, {
|
|
56
|
+
pm: longest.manager,
|
|
57
|
+
command: longest.command
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
commands.filter((item) => item.manager !== pm).map((item) => /* @__PURE__ */ jsx("span", {
|
|
61
|
+
"aria-hidden": true,
|
|
62
|
+
"data-pm-text": true,
|
|
63
|
+
"data-pm": item.manager,
|
|
64
|
+
className: "invisible col-start-1 row-start-1 flex items-center",
|
|
65
|
+
children: /* @__PURE__ */ jsx(Parts, {
|
|
66
|
+
pm: item.manager,
|
|
67
|
+
command: item.command
|
|
68
|
+
})
|
|
69
|
+
}, item.manager)),
|
|
70
|
+
/* @__PURE__ */ jsx("span", {
|
|
71
|
+
"data-pm-text": true,
|
|
72
|
+
"data-pm": pm,
|
|
73
|
+
className: "col-start-1 row-start-1 flex items-center",
|
|
74
|
+
children: /* @__PURE__ */ jsx(Parts, {
|
|
75
|
+
pm,
|
|
76
|
+
command,
|
|
77
|
+
trigger: /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsxs(Menu.Trigger, {
|
|
78
|
+
"aria-label": `Package manager: ${pm}`,
|
|
79
|
+
className: "group flex items-center gap-0.5 rounded-sm text-(--code-command) outline-none focus-visible:ring-2 focus-visible:ring-fd-ring",
|
|
80
|
+
children: [pm, /* @__PURE__ */ jsx(ChevronDownIcon, { className: `${CHEVRON} text-fd-muted-foreground transition-[color,rotate] duration-150 ease-out group-hover:text-fd-foreground group-data-popup-open:rotate-180 group-data-popup-open:text-fd-foreground` })]
|
|
81
|
+
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
82
|
+
anchor: field,
|
|
83
|
+
side: "bottom",
|
|
84
|
+
align: "start",
|
|
85
|
+
sideOffset: 6,
|
|
86
|
+
className: "z-50",
|
|
87
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
88
|
+
className: "install-menu flex min-w-(--anchor-width) flex-col rounded-[14px] p-1.5 outline-none",
|
|
89
|
+
children: /* @__PURE__ */ jsx(Menu.RadioGroup, {
|
|
90
|
+
value: pm,
|
|
91
|
+
onValueChange: (value) => pickAndCopy(pkg.registry, value, commands.find((item) => item.manager === value)?.command ?? ""),
|
|
92
|
+
children: commands.map((item) => /* @__PURE__ */ jsxs(Menu.RadioItem, {
|
|
93
|
+
value: item.manager,
|
|
94
|
+
closeOnClick: true,
|
|
95
|
+
className: "install-menu-item",
|
|
96
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
97
|
+
className: "flex-1",
|
|
98
|
+
children: item.command
|
|
99
|
+
}), /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
100
|
+
className: "flex",
|
|
101
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
102
|
+
})]
|
|
103
|
+
}, item.manager))
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}) })] })
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
onClick: () => copy(command),
|
|
113
|
+
"aria-label": copied ? "Copied" : "Copy command",
|
|
114
|
+
className: "flex size-7 shrink-0 items-center justify-center rounded-md text-fd-muted-foreground outline-none transition-colors duration-150 hover:bg-fd-accent hover:text-fd-foreground focus-visible:ring-2 focus-visible:ring-fd-ring active:scale-96",
|
|
115
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
116
|
+
className: "swap size-4",
|
|
117
|
+
children: [/* @__PURE__ */ jsx(CopyIcon, {
|
|
118
|
+
"data-active": copied ? void 0 : "",
|
|
119
|
+
className: "size-4"
|
|
120
|
+
}), /* @__PURE__ */ jsx(CheckIcon, {
|
|
121
|
+
"data-active": copied ? "" : void 0,
|
|
122
|
+
className: "size-4"
|
|
123
|
+
})]
|
|
124
|
+
})
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export { HeroInstall };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
// src/home/hero-stage.tsx
|
|
3
|
+
function HeroStage({ children }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", {
|
|
5
|
+
className: "relative h-40 w-full overflow-hidden rounded-2xl bg-fd-card sm:h-52",
|
|
6
|
+
children
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export { HeroStage };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getGitHubStars, getWeeklyDownloads } from "../server.js";
|
|
2
|
+
import { HeroContent } from "./hero-content.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/home/hero.tsx
|
|
5
|
+
async function Hero({ site, art }) {
|
|
6
|
+
const [stars, downloads] = await Promise.all([getGitHubStars(site), getWeeklyDownloads(site)]);
|
|
7
|
+
return /* @__PURE__ */ jsx("section", {
|
|
8
|
+
className: "relative flex w-full max-w-4xl flex-col pt-6 pb-16 sm:pt-8 sm:pb-24",
|
|
9
|
+
children: /* @__PURE__ */ jsx(HeroContent, {
|
|
10
|
+
stars,
|
|
11
|
+
downloads,
|
|
12
|
+
art
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { Hero };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function HomeHeader(): import("react").JSX.Element;
|