@usecross/docs 0.1.0
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/dist/index.d.ts +178 -0
- package/dist/index.js +616 -0
- package/dist/index.js.map +1 -0
- package/dist/ssr.d.ts +21 -0
- package/dist/ssr.js +27 -0
- package/dist/ssr.js.map +1 -0
- package/dist/types-Vodb50Bj.d.ts +91 -0
- package/package.json +71 -0
- package/src/app.tsx +46 -0
- package/src/components/CodeBlock.tsx +87 -0
- package/src/components/DocsLayout.tsx +178 -0
- package/src/components/DocsPage.tsx +19 -0
- package/src/components/HomePage.tsx +434 -0
- package/src/components/Markdown.tsx +93 -0
- package/src/components/Sidebar.tsx +37 -0
- package/src/components/index.ts +6 -0
- package/src/index.ts +49 -0
- package/src/lib/shiki.ts +59 -0
- package/src/lib/utils.ts +9 -0
- package/src/ssr.tsx +39 -0
- package/src/styles.css +128 -0
- package/src/tailwind.preset.cjs +118 -0
- package/src/types.ts +91 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
// src/components/CodeBlock.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
// src/lib/utils.ts
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/lib/shiki.ts
|
|
12
|
+
import { createHighlighterCore } from "shiki/core";
|
|
13
|
+
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
14
|
+
var highlighterPromise = null;
|
|
15
|
+
var defaultLangs = [
|
|
16
|
+
import("shiki/langs/python.mjs"),
|
|
17
|
+
import("shiki/langs/javascript.mjs"),
|
|
18
|
+
import("shiki/langs/typescript.mjs"),
|
|
19
|
+
import("shiki/langs/tsx.mjs"),
|
|
20
|
+
import("shiki/langs/jsx.mjs"),
|
|
21
|
+
import("shiki/langs/bash.mjs"),
|
|
22
|
+
import("shiki/langs/shellscript.mjs"),
|
|
23
|
+
import("shiki/langs/json.mjs"),
|
|
24
|
+
import("shiki/langs/html.mjs"),
|
|
25
|
+
import("shiki/langs/css.mjs"),
|
|
26
|
+
import("shiki/langs/yaml.mjs"),
|
|
27
|
+
import("shiki/langs/toml.mjs"),
|
|
28
|
+
import("shiki/langs/markdown.mjs")
|
|
29
|
+
];
|
|
30
|
+
var defaultTheme = import("shiki/themes/github-dark-dimmed.mjs");
|
|
31
|
+
function getHighlighter() {
|
|
32
|
+
if (!highlighterPromise) {
|
|
33
|
+
highlighterPromise = createHighlighterCore({
|
|
34
|
+
themes: [defaultTheme],
|
|
35
|
+
langs: defaultLangs,
|
|
36
|
+
engine: createJavaScriptRegexEngine()
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return highlighterPromise;
|
|
40
|
+
}
|
|
41
|
+
function configureHighlighter(options) {
|
|
42
|
+
if (highlighterPromise) {
|
|
43
|
+
console.warn("configureHighlighter called after highlighter was created");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
highlighterPromise = createHighlighterCore({
|
|
47
|
+
themes: [options.theme ?? defaultTheme],
|
|
48
|
+
langs: options.langs ?? defaultLangs,
|
|
49
|
+
engine: createJavaScriptRegexEngine()
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/components/CodeBlock.tsx
|
|
54
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
55
|
+
function CodeBlock({
|
|
56
|
+
code,
|
|
57
|
+
language = "python",
|
|
58
|
+
filename,
|
|
59
|
+
showLineNumbers = false,
|
|
60
|
+
theme = "github-dark-dimmed",
|
|
61
|
+
className
|
|
62
|
+
}) {
|
|
63
|
+
const [html, setHtml] = useState("");
|
|
64
|
+
const [copied, setCopied] = useState(false);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
async function highlight() {
|
|
67
|
+
const highlighter = await getHighlighter();
|
|
68
|
+
const langs = highlighter.getLoadedLanguages();
|
|
69
|
+
const lang = langs.includes(language) ? language : "text";
|
|
70
|
+
const highlighted = highlighter.codeToHtml(code.trim(), {
|
|
71
|
+
lang,
|
|
72
|
+
theme
|
|
73
|
+
});
|
|
74
|
+
setHtml(highlighted);
|
|
75
|
+
}
|
|
76
|
+
highlight();
|
|
77
|
+
}, [code, language, theme]);
|
|
78
|
+
const copyToClipboard = async () => {
|
|
79
|
+
await navigator.clipboard.writeText(code.trim());
|
|
80
|
+
setCopied(true);
|
|
81
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("group relative overflow-hidden rounded-lg bg-[#24292f] not-prose", className), children: [
|
|
84
|
+
filename && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-b border-slate-700 bg-slate-900 px-4 py-2 text-sm text-slate-400", children: [
|
|
85
|
+
/* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx(
|
|
86
|
+
"path",
|
|
87
|
+
{
|
|
88
|
+
strokeLinecap: "round",
|
|
89
|
+
strokeLinejoin: "round",
|
|
90
|
+
strokeWidth: 2,
|
|
91
|
+
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
92
|
+
}
|
|
93
|
+
) }),
|
|
94
|
+
filename
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"button",
|
|
98
|
+
{
|
|
99
|
+
onClick: copyToClipboard,
|
|
100
|
+
className: "absolute right-2 top-2 z-10 rounded-md bg-slate-700/50 px-2 py-1 text-xs text-slate-400 opacity-0 transition-opacity hover:bg-slate-600 hover:text-white group-hover:opacity-100",
|
|
101
|
+
children: copied ? "Copied!" : "Copy"
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
html ? /* @__PURE__ */ jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: cn(
|
|
108
|
+
"overflow-x-auto text-sm [&_pre]:!m-0 [&_pre]:!bg-transparent [&_code]:!p-4",
|
|
109
|
+
showLineNumbers && "[&_code]:grid [&_code]:grid-cols-[auto_1fr]"
|
|
110
|
+
),
|
|
111
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
112
|
+
}
|
|
113
|
+
) : /* @__PURE__ */ jsx("pre", { className: "shiki overflow-x-auto !m-0 !bg-transparent", children: /* @__PURE__ */ jsx("code", { className: "block p-4 text-sm leading-relaxed text-gray-300", children: code.trim() }) })
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
function InlineCode({ children }) {
|
|
117
|
+
return /* @__PURE__ */ jsx("code", { className: "rounded bg-slate-100 px-1.5 py-0.5 text-sm font-medium text-slate-800", children });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/components/DocsLayout.tsx
|
|
121
|
+
import { Head, Link as Link2, usePage } from "@inertiajs/react";
|
|
122
|
+
import { useState as useState2 } from "react";
|
|
123
|
+
|
|
124
|
+
// src/components/Sidebar.tsx
|
|
125
|
+
import { Link } from "@inertiajs/react";
|
|
126
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
127
|
+
function Sidebar({ nav, currentPath, className }) {
|
|
128
|
+
return /* @__PURE__ */ jsx2("nav", { className: cn("space-y-8", className), children: nav.map((section) => /* @__PURE__ */ jsxs2("div", { children: [
|
|
129
|
+
/* @__PURE__ */ jsx2("h3", { className: "mb-3 text-xs font-mono uppercase tracking-widest text-gray-500", children: section.title }),
|
|
130
|
+
/* @__PURE__ */ jsx2("ul", { className: "space-y-1 border-l-2 border-gray-200", children: section.items.map((item) => /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsx2(
|
|
131
|
+
Link,
|
|
132
|
+
{
|
|
133
|
+
href: item.href,
|
|
134
|
+
className: cn(
|
|
135
|
+
"block border-l-2 py-1.5 pl-4 text-sm transition-colors -ml-0.5",
|
|
136
|
+
currentPath === item.href ? "border-primary-500 text-black font-bold" : "border-transparent text-gray-600 hover:border-black hover:text-black"
|
|
137
|
+
),
|
|
138
|
+
children: item.title
|
|
139
|
+
}
|
|
140
|
+
) }, item.href)) })
|
|
141
|
+
] }, section.title)) });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/components/DocsLayout.tsx
|
|
145
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
146
|
+
function MobileMenuButton({ onClick, isOpen }) {
|
|
147
|
+
return /* @__PURE__ */ jsxs3(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
onClick,
|
|
151
|
+
className: "inline-flex items-center justify-center p-2 -ml-2 text-black hover:text-primary-500 lg:hidden",
|
|
152
|
+
"aria-expanded": isOpen,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: isOpen ? "Close menu" : "Open menu" }),
|
|
155
|
+
isOpen ? /* @__PURE__ */ jsx3("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx3("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ jsx3("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx3("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h16M4 18h16" }) })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function GitHubIcon() {
|
|
161
|
+
return /* @__PURE__ */ jsx3("svg", { className: "w-6 h-6", fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
|
|
162
|
+
"path",
|
|
163
|
+
{
|
|
164
|
+
fillRule: "evenodd",
|
|
165
|
+
d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",
|
|
166
|
+
clipRule: "evenodd"
|
|
167
|
+
}
|
|
168
|
+
) });
|
|
169
|
+
}
|
|
170
|
+
function DocsLayout({
|
|
171
|
+
children,
|
|
172
|
+
title,
|
|
173
|
+
description: _description,
|
|
174
|
+
logo,
|
|
175
|
+
logoInverted,
|
|
176
|
+
logoUrl: propLogoUrl,
|
|
177
|
+
logoInvertedUrl: propLogoInvertedUrl,
|
|
178
|
+
githubUrl: propGithubUrl,
|
|
179
|
+
navLinks: propNavLinks,
|
|
180
|
+
footer
|
|
181
|
+
}) {
|
|
182
|
+
const sharedProps = usePage().props;
|
|
183
|
+
const { nav, currentPath } = sharedProps;
|
|
184
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState2(false);
|
|
185
|
+
const logoUrl = propLogoUrl ?? sharedProps.logoUrl;
|
|
186
|
+
const logoInvertedUrl = propLogoInvertedUrl ?? sharedProps.logoInvertedUrl;
|
|
187
|
+
const githubUrl = propGithubUrl ?? sharedProps.githubUrl;
|
|
188
|
+
const navLinks = propNavLinks ?? sharedProps.navLinks ?? [];
|
|
189
|
+
const headerLogo = logoInverted || logo || (logoInvertedUrl ? /* @__PURE__ */ jsx3("img", { src: logoInvertedUrl, alt: "Logo", className: "h-8" }) : logoUrl ? /* @__PURE__ */ jsx3("img", { src: logoUrl, alt: "Logo", className: "h-8" }) : null);
|
|
190
|
+
const footerLogoUrl = sharedProps.footerLogoUrl || logoUrl;
|
|
191
|
+
const footerLogo = logo || (footerLogoUrl ? /* @__PURE__ */ jsx3("img", { src: footerLogoUrl, alt: "Logo", className: "h-6" }) : null);
|
|
192
|
+
return /* @__PURE__ */ jsxs3("div", { className: "min-h-screen bg-white flex flex-col", children: [
|
|
193
|
+
/* @__PURE__ */ jsx3(Head, { title }),
|
|
194
|
+
/* @__PURE__ */ jsx3("nav", { className: "fixed w-full z-50 bg-white border-b border-gray-200", children: /* @__PURE__ */ jsx3("div", { className: "px-4 lg:px-10", children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-between h-16 items-center", children: [
|
|
195
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
196
|
+
/* @__PURE__ */ jsx3(MobileMenuButton, { onClick: () => setMobileMenuOpen(!mobileMenuOpen), isOpen: mobileMenuOpen }),
|
|
197
|
+
headerLogo ? /* @__PURE__ */ jsx3(Link2, { href: "/", className: "flex items-center", children: headerLogo }) : /* @__PURE__ */ jsx3(Link2, { href: "/", className: "font-bold text-lg", children: "Docs" })
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-8", children: [
|
|
200
|
+
navLinks.map((link) => /* @__PURE__ */ jsx3(
|
|
201
|
+
Link2,
|
|
202
|
+
{
|
|
203
|
+
href: link.href,
|
|
204
|
+
className: "text-black font-medium hover:text-primary-500 transition-colors",
|
|
205
|
+
children: link.label
|
|
206
|
+
},
|
|
207
|
+
link.href
|
|
208
|
+
)),
|
|
209
|
+
githubUrl && /* @__PURE__ */ jsx3(
|
|
210
|
+
"a",
|
|
211
|
+
{
|
|
212
|
+
href: githubUrl,
|
|
213
|
+
target: "_blank",
|
|
214
|
+
rel: "noopener noreferrer",
|
|
215
|
+
className: "text-black hover:text-primary-500 transition-colors",
|
|
216
|
+
children: /* @__PURE__ */ jsx3(GitHubIcon, {})
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
] })
|
|
220
|
+
] }) }) }),
|
|
221
|
+
mobileMenuOpen && /* @__PURE__ */ jsxs3("div", { className: "fixed inset-0 z-40 lg:hidden", children: [
|
|
222
|
+
/* @__PURE__ */ jsx3("div", { className: "fixed inset-0 bg-black/50", onClick: () => setMobileMenuOpen(false) }),
|
|
223
|
+
/* @__PURE__ */ jsx3("div", { className: "fixed inset-y-0 left-0 w-72 overflow-y-auto bg-white px-4 lg:px-10 py-6 pt-20 border-r border-gray-200", children: /* @__PURE__ */ jsx3(Sidebar, { nav, currentPath }) })
|
|
224
|
+
] }),
|
|
225
|
+
/* @__PURE__ */ jsx3("div", { className: "bg-white pt-16 w-full flex-1", children: /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-12", children: [
|
|
226
|
+
/* @__PURE__ */ jsx3("aside", { className: "hidden lg:block lg:col-span-3 xl:col-span-2 border-r border-gray-200 min-h-[calc(100vh-4rem)]", children: /* @__PURE__ */ jsx3("nav", { className: "sticky top-16 px-4 lg:px-10 py-6 max-h-[calc(100vh-4rem)] overflow-y-auto", children: /* @__PURE__ */ jsx3(Sidebar, { nav, currentPath }) }) }),
|
|
227
|
+
/* @__PURE__ */ jsx3("main", { className: "col-span-12 lg:col-span-9 xl:col-span-10 p-4 lg:px-10 lg:py-6", children: /* @__PURE__ */ jsx3("article", { className: "prose prose-lg max-w-3xl prose-headings:font-bold prose-headings:tracking-tight prose-h1:text-3xl prose-h1:mb-4 prose-h2:text-2xl prose-h2:mt-10 first:prose-h2:mt-0 prose-h3:text-xl prose-a:text-primary-600 prose-a:no-underline hover:prose-a:underline prose-code:bg-gray-100 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none", children }) })
|
|
228
|
+
] }) }),
|
|
229
|
+
footer || /* @__PURE__ */ jsx3("footer", { className: "border-t border-gray-200 py-8", children: /* @__PURE__ */ jsxs3("div", { className: "px-4 lg:px-10 flex flex-col md:flex-row justify-between items-center gap-6", children: [
|
|
230
|
+
footerLogo && /* @__PURE__ */ jsx3(Link2, { href: "/", children: footerLogo }),
|
|
231
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-8 text-sm text-gray-600", children: [
|
|
232
|
+
navLinks.map((link) => /* @__PURE__ */ jsx3(Link2, { href: link.href, className: "hover:text-black transition-colors", children: link.label }, link.href)),
|
|
233
|
+
githubUrl && /* @__PURE__ */ jsx3(
|
|
234
|
+
"a",
|
|
235
|
+
{
|
|
236
|
+
href: githubUrl,
|
|
237
|
+
target: "_blank",
|
|
238
|
+
rel: "noopener noreferrer",
|
|
239
|
+
className: "hover:text-black transition-colors",
|
|
240
|
+
children: "GitHub"
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] })
|
|
244
|
+
] }) })
|
|
245
|
+
] });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/components/Markdown.tsx
|
|
249
|
+
import ReactMarkdown from "react-markdown";
|
|
250
|
+
import remarkGfm from "remark-gfm";
|
|
251
|
+
import rehypeRaw from "rehype-raw";
|
|
252
|
+
import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
|
|
253
|
+
function Markdown({ content, components }) {
|
|
254
|
+
return /* @__PURE__ */ jsx4(
|
|
255
|
+
ReactMarkdown,
|
|
256
|
+
{
|
|
257
|
+
remarkPlugins: [remarkGfm],
|
|
258
|
+
rehypePlugins: [rehypeRaw],
|
|
259
|
+
components: {
|
|
260
|
+
// Override pre to avoid double wrapping with CodeBlock
|
|
261
|
+
pre({ children }) {
|
|
262
|
+
return /* @__PURE__ */ jsx4(Fragment, { children });
|
|
263
|
+
},
|
|
264
|
+
// Custom code block rendering with syntax highlighting
|
|
265
|
+
code({ node, className, children, ...props }) {
|
|
266
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
267
|
+
const isInline = !match && !className;
|
|
268
|
+
if (isInline) {
|
|
269
|
+
return /* @__PURE__ */ jsx4(
|
|
270
|
+
"code",
|
|
271
|
+
{
|
|
272
|
+
className: "rounded bg-gray-100 px-1.5 py-0.5 text-sm font-medium text-gray-800 dark:bg-gray-800 dark:text-gray-200",
|
|
273
|
+
...props,
|
|
274
|
+
children
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
const meta = node?.data?.meta || "";
|
|
279
|
+
const titleMatch = /title="([^"]+)"/.exec(meta);
|
|
280
|
+
const filename = titleMatch ? titleMatch[1] : void 0;
|
|
281
|
+
const showLineNumbers = meta.includes("showLineNumbers");
|
|
282
|
+
return /* @__PURE__ */ jsx4(
|
|
283
|
+
CodeBlock,
|
|
284
|
+
{
|
|
285
|
+
code: String(children).replace(/\n$/, ""),
|
|
286
|
+
language: match ? match[1] : "text",
|
|
287
|
+
filename,
|
|
288
|
+
showLineNumbers
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
},
|
|
292
|
+
// Custom link styling
|
|
293
|
+
a({ href, children }) {
|
|
294
|
+
const isExternal = href?.startsWith("http");
|
|
295
|
+
return /* @__PURE__ */ jsx4(
|
|
296
|
+
"a",
|
|
297
|
+
{
|
|
298
|
+
href,
|
|
299
|
+
className: "text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",
|
|
300
|
+
...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
301
|
+
children
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
},
|
|
305
|
+
// Tables
|
|
306
|
+
table({ children }) {
|
|
307
|
+
return /* @__PURE__ */ jsx4("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsx4("table", { className: "w-full text-left text-sm", children }) });
|
|
308
|
+
},
|
|
309
|
+
th({ children }) {
|
|
310
|
+
return /* @__PURE__ */ jsx4("th", { className: "border-b border-gray-200 bg-gray-50 px-4 py-2 font-semibold dark:border-gray-700 dark:bg-gray-800", children });
|
|
311
|
+
},
|
|
312
|
+
td({ children }) {
|
|
313
|
+
return /* @__PURE__ */ jsx4("td", { className: "border-b border-gray-200 px-4 py-2 dark:border-gray-700", children });
|
|
314
|
+
},
|
|
315
|
+
// Allow component overrides
|
|
316
|
+
...components
|
|
317
|
+
},
|
|
318
|
+
children: content
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// src/components/DocsPage.tsx
|
|
324
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
325
|
+
function DocsPage({ content, ...layoutProps }) {
|
|
326
|
+
return /* @__PURE__ */ jsx5(DocsLayout, { title: content?.title ?? "", description: content?.description, ...layoutProps, children: /* @__PURE__ */ jsx5(Markdown, { content: content?.body ?? "" }) });
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/components/HomePage.tsx
|
|
330
|
+
import { Head as Head2, Link as Link3 } from "@inertiajs/react";
|
|
331
|
+
import { createContext, useContext, useState as useState3 } from "react";
|
|
332
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
333
|
+
var HomePageContext = createContext(null);
|
|
334
|
+
function useHomePage() {
|
|
335
|
+
const context = useContext(HomePageContext);
|
|
336
|
+
if (!context) {
|
|
337
|
+
throw new Error("HomePage sub-components must be used within <HomePage>");
|
|
338
|
+
}
|
|
339
|
+
return context;
|
|
340
|
+
}
|
|
341
|
+
function InstallCommand({ command }) {
|
|
342
|
+
const [copied, setCopied] = useState3(false);
|
|
343
|
+
const copyToClipboard = async () => {
|
|
344
|
+
await navigator.clipboard.writeText(command);
|
|
345
|
+
setCopied(true);
|
|
346
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
347
|
+
};
|
|
348
|
+
return /* @__PURE__ */ jsxs4(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
onClick: copyToClipboard,
|
|
352
|
+
className: "group relative flex items-center bg-black border border-black px-4 h-14 font-mono text-sm text-white hover:bg-white hover:text-black transition-colors cursor-pointer",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ jsx6("span", { className: "text-primary-500 mr-2", children: "$" }),
|
|
355
|
+
/* @__PURE__ */ jsx6("span", { children: command }),
|
|
356
|
+
/* @__PURE__ */ jsx6(
|
|
357
|
+
"svg",
|
|
358
|
+
{
|
|
359
|
+
className: `ml-4 w-4 h-4 transition ${copied ? "text-green-400" : "opacity-50 group-hover:opacity-100"}`,
|
|
360
|
+
fill: "none",
|
|
361
|
+
stroke: "currentColor",
|
|
362
|
+
viewBox: "0 0 24 24",
|
|
363
|
+
children: /* @__PURE__ */ jsx6(
|
|
364
|
+
"path",
|
|
365
|
+
{
|
|
366
|
+
strokeLinecap: "round",
|
|
367
|
+
strokeLinejoin: "round",
|
|
368
|
+
strokeWidth: 2,
|
|
369
|
+
d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ jsx6(
|
|
375
|
+
"span",
|
|
376
|
+
{
|
|
377
|
+
className: `absolute -top-8 left-1/2 -translate-x-1/2 bg-black text-white text-xs py-1 px-2 rounded transition-opacity duration-300 whitespace-nowrap ${copied ? "opacity-100" : "opacity-0"}`,
|
|
378
|
+
children: "Copied!"
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
function GitHubIcon2() {
|
|
386
|
+
return /* @__PURE__ */ jsx6("svg", { className: "w-6 h-6", fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(
|
|
387
|
+
"path",
|
|
388
|
+
{
|
|
389
|
+
fillRule: "evenodd",
|
|
390
|
+
d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",
|
|
391
|
+
clipRule: "evenodd"
|
|
392
|
+
}
|
|
393
|
+
) });
|
|
394
|
+
}
|
|
395
|
+
function DefaultLogo() {
|
|
396
|
+
const { title, logoUrl } = useHomePage();
|
|
397
|
+
if (logoUrl) {
|
|
398
|
+
return /* @__PURE__ */ jsx6(Link3, { href: "/", className: "flex items-center", children: /* @__PURE__ */ jsx6("img", { src: logoUrl, alt: title, className: "h-8" }) });
|
|
399
|
+
}
|
|
400
|
+
return /* @__PURE__ */ jsx6(Link3, { href: "/", className: "font-bold text-lg", children: title });
|
|
401
|
+
}
|
|
402
|
+
function HomeHeader({ renderLogo } = {}) {
|
|
403
|
+
const { navLinks, githubUrl } = useHomePage();
|
|
404
|
+
return /* @__PURE__ */ jsx6("nav", { className: "fixed w-full z-50 bg-white border-b border-gray-200", children: /* @__PURE__ */ jsx6("div", { className: "px-4 lg:px-10", children: /* @__PURE__ */ jsxs4("div", { className: "flex justify-between h-16 items-center", children: [
|
|
405
|
+
renderLogo ? renderLogo() : /* @__PURE__ */ jsx6(DefaultLogo, {}),
|
|
406
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-8", children: [
|
|
407
|
+
navLinks.map((link) => /* @__PURE__ */ jsx6(
|
|
408
|
+
Link3,
|
|
409
|
+
{
|
|
410
|
+
href: link.href,
|
|
411
|
+
className: "text-black font-medium hover:text-primary-500 transition-colors",
|
|
412
|
+
children: link.label
|
|
413
|
+
},
|
|
414
|
+
link.href
|
|
415
|
+
)),
|
|
416
|
+
githubUrl && /* @__PURE__ */ jsx6(
|
|
417
|
+
"a",
|
|
418
|
+
{
|
|
419
|
+
href: githubUrl,
|
|
420
|
+
target: "_blank",
|
|
421
|
+
rel: "noopener noreferrer",
|
|
422
|
+
className: "text-black hover:text-primary-500 transition-colors",
|
|
423
|
+
children: /* @__PURE__ */ jsx6(GitHubIcon2, {})
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
] })
|
|
427
|
+
] }) }) });
|
|
428
|
+
}
|
|
429
|
+
function HomeHero() {
|
|
430
|
+
const { title, tagline, description, ctaText, ctaHref, installCommand, heroLogoUrl } = useHomePage();
|
|
431
|
+
return /* @__PURE__ */ jsx6("section", { className: "pt-16", children: /* @__PURE__ */ jsx6("div", { className: "px-4 lg:px-10 py-16 lg:py-24", children: /* @__PURE__ */ jsxs4("div", { className: "max-w-4xl", children: [
|
|
432
|
+
/* @__PURE__ */ jsx6("div", { className: "mb-4 text-sm font-mono uppercase tracking-widest text-gray-500", children: tagline }),
|
|
433
|
+
heroLogoUrl ? /* @__PURE__ */ jsx6("h1", { className: "mb-6 lg:mb-8", children: /* @__PURE__ */ jsx6(
|
|
434
|
+
"img",
|
|
435
|
+
{
|
|
436
|
+
src: heroLogoUrl,
|
|
437
|
+
alt: title,
|
|
438
|
+
className: "h-auto w-auto max-w-[580px]"
|
|
439
|
+
}
|
|
440
|
+
) }) : /* @__PURE__ */ jsx6("h1", { className: "text-5xl lg:text-7xl font-bold tracking-tight mb-6", children: title }),
|
|
441
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xl lg:text-2xl text-gray-700 max-w-2xl leading-relaxed mb-8", children: description }),
|
|
442
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row gap-3", children: [
|
|
443
|
+
/* @__PURE__ */ jsx6(
|
|
444
|
+
Link3,
|
|
445
|
+
{
|
|
446
|
+
href: ctaHref,
|
|
447
|
+
className: "inline-flex items-center justify-center px-8 h-14 bg-black text-white font-bold text-lg hover:bg-primary-500 transition-colors border border-black",
|
|
448
|
+
children: ctaText
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
installCommand && /* @__PURE__ */ jsx6(InstallCommand, { command: installCommand })
|
|
452
|
+
] })
|
|
453
|
+
] }) }) });
|
|
454
|
+
}
|
|
455
|
+
function HomeFeatureItem({ feature, index, totalFeatures }) {
|
|
456
|
+
return /* @__PURE__ */ jsxs4(
|
|
457
|
+
"div",
|
|
458
|
+
{
|
|
459
|
+
className: `p-4 lg:p-10 border-b sm:border-b border-gray-200 ${index % 2 === 0 ? "sm:border-r" : ""} ${index >= totalFeatures - 2 ? "sm:border-b-0" : ""} ${index === totalFeatures - 1 && totalFeatures % 2 === 1 ? "border-b-0" : ""}`,
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ jsx6("div", { className: "text-5xl font-bold text-primary-500 mb-4", children: String(index + 1).padStart(2, "0") }),
|
|
462
|
+
/* @__PURE__ */ jsx6("h3", { className: "text-xl font-bold mb-2", children: feature.title }),
|
|
463
|
+
/* @__PURE__ */ jsx6("p", { className: "text-gray-600", children: feature.description })
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
function HomeFeatures({ renderFeature } = {}) {
|
|
469
|
+
const { title, features } = useHomePage();
|
|
470
|
+
if (features.length === 0) {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
return /* @__PURE__ */ jsx6("section", { className: "border-t border-gray-200", children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-12", children: [
|
|
474
|
+
/* @__PURE__ */ jsxs4("div", { className: "col-span-12 lg:col-span-4 p-4 lg:p-10 border-b lg:border-b-0 lg:border-r border-gray-200", children: [
|
|
475
|
+
/* @__PURE__ */ jsx6("div", { className: "text-sm font-mono uppercase tracking-widest text-gray-500 mb-4", children: "Features" }),
|
|
476
|
+
/* @__PURE__ */ jsxs4("h2", { className: "text-4xl lg:text-5xl font-bold tracking-tight", children: [
|
|
477
|
+
"Why ",
|
|
478
|
+
title,
|
|
479
|
+
"?"
|
|
480
|
+
] })
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ jsx6("div", { className: "col-span-12 lg:col-span-8 grid grid-cols-1 sm:grid-cols-2", children: features.map(
|
|
483
|
+
(feature, index) => renderFeature ? /* @__PURE__ */ jsx6("div", { children: renderFeature(feature, index, HomeFeatureItem) }, index) : /* @__PURE__ */ jsx6(
|
|
484
|
+
HomeFeatureItem,
|
|
485
|
+
{
|
|
486
|
+
feature,
|
|
487
|
+
index,
|
|
488
|
+
totalFeatures: features.length
|
|
489
|
+
},
|
|
490
|
+
index
|
|
491
|
+
)
|
|
492
|
+
) })
|
|
493
|
+
] }) });
|
|
494
|
+
}
|
|
495
|
+
function HomeCTA() {
|
|
496
|
+
const { ctaHref } = useHomePage();
|
|
497
|
+
return /* @__PURE__ */ jsx6("section", { className: "border-t border-gray-200", children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-12 items-center", children: [
|
|
498
|
+
/* @__PURE__ */ jsxs4("div", { className: "col-span-12 lg:col-span-8 p-4 lg:p-10", children: [
|
|
499
|
+
/* @__PURE__ */ jsx6("h2", { className: "text-4xl lg:text-6xl font-bold tracking-tight mb-4", children: "Ready to start?" }),
|
|
500
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xl text-gray-600 mb-8 max-w-2xl", children: "Get up and running in minutes. Check out our documentation to learn more." }),
|
|
501
|
+
/* @__PURE__ */ jsx6(
|
|
502
|
+
Link3,
|
|
503
|
+
{
|
|
504
|
+
href: ctaHref,
|
|
505
|
+
className: "inline-flex items-center justify-center px-8 py-4 bg-primary-500 text-white font-bold text-lg hover:bg-black transition-colors border border-primary-500 hover:border-black",
|
|
506
|
+
children: "Read the Docs"
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
] }),
|
|
510
|
+
/* @__PURE__ */ jsx6(
|
|
511
|
+
Link3,
|
|
512
|
+
{
|
|
513
|
+
href: ctaHref,
|
|
514
|
+
className: "col-span-12 lg:col-span-4 h-full bg-primary-500 hidden lg:flex items-center justify-center p-4 lg:p-10 hover:bg-black transition-colors min-h-[200px]",
|
|
515
|
+
children: /* @__PURE__ */ jsx6("div", { className: "text-white text-8xl font-bold", children: "\u2192" })
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
] }) });
|
|
519
|
+
}
|
|
520
|
+
function HomeFooter() {
|
|
521
|
+
const { title, logoUrl, footerLogoUrl, navLinks, githubUrl } = useHomePage();
|
|
522
|
+
return /* @__PURE__ */ jsx6("footer", { className: "border-t border-gray-200 py-8", children: /* @__PURE__ */ jsxs4("div", { className: "px-4 lg:px-10 flex flex-col md:flex-row justify-between items-center gap-6", children: [
|
|
523
|
+
(footerLogoUrl || logoUrl) && /* @__PURE__ */ jsx6(Link3, { href: "/", children: /* @__PURE__ */ jsx6("img", { src: footerLogoUrl || logoUrl, alt: title, className: "h-6" }) }),
|
|
524
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-8 text-sm text-gray-600", children: [
|
|
525
|
+
navLinks.map((link) => /* @__PURE__ */ jsx6(Link3, { href: link.href, className: "hover:text-black transition-colors", children: link.label }, link.href)),
|
|
526
|
+
githubUrl && /* @__PURE__ */ jsx6(
|
|
527
|
+
"a",
|
|
528
|
+
{
|
|
529
|
+
href: githubUrl,
|
|
530
|
+
target: "_blank",
|
|
531
|
+
rel: "noopener noreferrer",
|
|
532
|
+
className: "hover:text-black transition-colors",
|
|
533
|
+
children: "GitHub"
|
|
534
|
+
}
|
|
535
|
+
)
|
|
536
|
+
] })
|
|
537
|
+
] }) });
|
|
538
|
+
}
|
|
539
|
+
function DefaultHomeLayout() {
|
|
540
|
+
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
541
|
+
/* @__PURE__ */ jsx6(HomeHeader, {}),
|
|
542
|
+
/* @__PURE__ */ jsx6(HomeHero, {}),
|
|
543
|
+
/* @__PURE__ */ jsx6(HomeFeatures, {}),
|
|
544
|
+
/* @__PURE__ */ jsx6(HomeCTA, {}),
|
|
545
|
+
/* @__PURE__ */ jsx6(HomeFooter, {})
|
|
546
|
+
] });
|
|
547
|
+
}
|
|
548
|
+
function HomePage({
|
|
549
|
+
children,
|
|
550
|
+
navLinks = [],
|
|
551
|
+
...props
|
|
552
|
+
}) {
|
|
553
|
+
const contextValue = {
|
|
554
|
+
...props,
|
|
555
|
+
navLinks
|
|
556
|
+
};
|
|
557
|
+
return /* @__PURE__ */ jsx6(HomePageContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs4("div", { className: "min-h-screen bg-white", children: [
|
|
558
|
+
/* @__PURE__ */ jsx6(Head2, { title: props.title }),
|
|
559
|
+
children || /* @__PURE__ */ jsx6(DefaultHomeLayout, {})
|
|
560
|
+
] }) });
|
|
561
|
+
}
|
|
562
|
+
HomePage.Header = HomeHeader;
|
|
563
|
+
HomePage.Hero = HomeHero;
|
|
564
|
+
HomePage.Features = HomeFeatures;
|
|
565
|
+
HomePage.Feature = HomeFeatureItem;
|
|
566
|
+
HomePage.CTA = HomeCTA;
|
|
567
|
+
HomePage.Footer = HomeFooter;
|
|
568
|
+
|
|
569
|
+
// src/app.tsx
|
|
570
|
+
import { createInertiaApp } from "@inertiajs/react";
|
|
571
|
+
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
572
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
573
|
+
function createDocsApp(config) {
|
|
574
|
+
const { pages, title } = config;
|
|
575
|
+
if (typeof window !== "undefined") {
|
|
576
|
+
window.history.scrollRestoration = "manual";
|
|
577
|
+
window.scrollTo(0, 0);
|
|
578
|
+
}
|
|
579
|
+
createInertiaApp({
|
|
580
|
+
title: title ?? ((pageTitle) => pageTitle ? `${pageTitle}` : "Documentation"),
|
|
581
|
+
resolve: (name) => {
|
|
582
|
+
const page = pages[name];
|
|
583
|
+
if (!page) {
|
|
584
|
+
throw new Error(`Page component "${name}" not found`);
|
|
585
|
+
}
|
|
586
|
+
return page;
|
|
587
|
+
},
|
|
588
|
+
setup({ el, App, props }) {
|
|
589
|
+
if (el.hasChildNodes()) {
|
|
590
|
+
hydrateRoot(el, /* @__PURE__ */ jsx7(App, { ...props }));
|
|
591
|
+
} else {
|
|
592
|
+
createRoot(el).render(/* @__PURE__ */ jsx7(App, { ...props }));
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
export {
|
|
598
|
+
CodeBlock,
|
|
599
|
+
DocsLayout,
|
|
600
|
+
DocsPage,
|
|
601
|
+
HomeCTA,
|
|
602
|
+
HomeFeatureItem,
|
|
603
|
+
HomeFeatures,
|
|
604
|
+
HomeFooter,
|
|
605
|
+
HomeHeader,
|
|
606
|
+
HomeHero,
|
|
607
|
+
HomePage,
|
|
608
|
+
InlineCode,
|
|
609
|
+
Markdown,
|
|
610
|
+
Sidebar,
|
|
611
|
+
cn,
|
|
612
|
+
configureHighlighter,
|
|
613
|
+
createDocsApp,
|
|
614
|
+
getHighlighter
|
|
615
|
+
};
|
|
616
|
+
//# sourceMappingURL=index.js.map
|