onedocs 0.1.7 → 0.1.8
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/components/install-block.d.ts +9 -2
- package/dist/components/install-block.d.ts.map +1 -1
- package/dist/components/install-block.js +23 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layouts/home.d.ts +3 -2
- package/dist/layouts/home.d.ts.map +1 -1
- package/dist/layouts/home.js +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
export interface HighlightedInstallCommands {
|
|
3
|
+
npm: string;
|
|
4
|
+
yarn: string;
|
|
5
|
+
pnpm: string;
|
|
6
|
+
bun: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function highlightInstallCommands(packageName: string): Promise<HighlightedInstallCommands>;
|
|
2
9
|
interface InstallBlockProps {
|
|
3
10
|
title?: string;
|
|
4
11
|
description?: string;
|
|
5
|
-
|
|
12
|
+
commands: HighlightedInstallCommands;
|
|
6
13
|
children?: ReactNode;
|
|
7
14
|
}
|
|
8
|
-
export declare function InstallBlock({ title, description,
|
|
15
|
+
export declare function InstallBlock({ title, description, commands, children, }: InstallBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
9
16
|
export {};
|
|
10
17
|
//# sourceMappingURL=install-block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-block.d.ts","sourceRoot":"","sources":["../../src/components/install-block.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install-block.d.ts","sourceRoot":"","sources":["../../src/components/install-block.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAmBvG;AAED,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,0BAA0B,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,GACT,EAAE,iBAAiB,2CA8BnB"}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { CodeBlock, Pre } from "fumadocs-ui/components/codeblock";
|
|
4
|
+
import { highlight } from "fumadocs-core/highlight";
|
|
5
|
+
import { renderToString } from "react-dom/server";
|
|
6
|
+
export async function highlightInstallCommands(packageName) {
|
|
7
|
+
const highlightCode = async (code) => {
|
|
8
|
+
const rendered = await highlight(code, {
|
|
9
|
+
lang: "bash",
|
|
10
|
+
components: {
|
|
11
|
+
pre: (props) => _jsx(Pre, { ...props }),
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
return renderToString(_jsx(CodeBlock, { className: "!my-0 !border-0 !shadow-none", children: rendered }));
|
|
15
|
+
};
|
|
16
|
+
const [npm, yarn, pnpm, bun] = await Promise.all([
|
|
17
|
+
highlightCode(`npm i ${packageName}`),
|
|
18
|
+
highlightCode(`yarn add ${packageName}`),
|
|
19
|
+
highlightCode(`pnpm add ${packageName}`),
|
|
20
|
+
highlightCode(`bun add ${packageName}`),
|
|
21
|
+
]);
|
|
22
|
+
return { npm, yarn, pnpm, bun };
|
|
23
|
+
}
|
|
24
|
+
export function InstallBlock({ title, description, commands, children, }) {
|
|
25
|
+
return (_jsxs("div", { children: [title && (_jsx("h1", { className: "mb-4 text-4xl font-bold tracking-tight md:text-5xl lg:text-6xl", children: title })), description && (_jsx("p", { className: "text-fd-muted-foreground mb-6 text-balance", children: description })), _jsxs(Tabs, { groupId: "pm", items: ["npm", "yarn", "pnpm", "bun"], className: "!mb-0", children: [_jsx(Tab, { value: "npm", className: "!p-0 !py-0 !px-0", children: _jsx("div", { dangerouslySetInnerHTML: { __html: commands.npm } }) }), _jsx(Tab, { value: "yarn", className: "!p-0 !py-0 !px-0", children: _jsx("div", { dangerouslySetInnerHTML: { __html: commands.yarn } }) }), _jsx(Tab, { value: "pnpm", className: "!p-0 !py-0 !px-0", children: _jsx("div", { dangerouslySetInnerHTML: { __html: commands.pnpm } }) }), _jsx(Tab, { value: "bun", className: "!p-0 !py-0 !px-0", children: _jsx("div", { dangerouslySetInnerHTML: { __html: commands.bun } }) })] }), children && (_jsx("div", { className: "mt-6", children: children }))] }));
|
|
6
26
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { createBaseOptions } from "./layouts/shared";
|
|
|
6
6
|
export { defineConfig } from "./config";
|
|
7
7
|
export type { OnedocsConfig } from "./config";
|
|
8
8
|
export { createSource, loader } from "./source";
|
|
9
|
-
export { InstallBlock } from "./components/install-block";
|
|
9
|
+
export { InstallBlock, highlightInstallCommands, type HighlightedInstallCommands } from "./components/install-block";
|
|
10
10
|
export { Button } from "./components/button";
|
|
11
11
|
export { Logo } from "./components/logo";
|
|
12
12
|
export { GitHubIcon } from "./components/icons";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,O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@ export { HomeLayout, HomePage } from "./layouts/home";
|
|
|
5
5
|
export { createBaseOptions } from "./layouts/shared";
|
|
6
6
|
export { defineConfig } from "./config";
|
|
7
7
|
export { createSource, loader } from "./source";
|
|
8
|
-
export { InstallBlock } from "./components/install-block";
|
|
8
|
+
export { InstallBlock, highlightInstallCommands } from "./components/install-block";
|
|
9
9
|
export { Button } from "./components/button";
|
|
10
10
|
export { Logo } from "./components/logo";
|
|
11
11
|
export { GitHubIcon } from "./components/icons";
|
package/dist/layouts/home.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OnedocsConfig } from "../config";
|
|
2
|
+
import { type HighlightedInstallCommands } from "../components/install-block";
|
|
2
3
|
interface HomeLayoutProps {
|
|
3
4
|
config: OnedocsConfig;
|
|
4
5
|
children?: React.ReactNode;
|
|
@@ -6,9 +7,9 @@ interface HomeLayoutProps {
|
|
|
6
7
|
export declare function HomeLayout({ config, children }: HomeLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
interface HomePageProps {
|
|
8
9
|
config: OnedocsConfig;
|
|
9
|
-
|
|
10
|
+
installCommands?: HighlightedInstallCommands;
|
|
10
11
|
children?: React.ReactNode;
|
|
11
12
|
}
|
|
12
|
-
export declare function HomePage({ config,
|
|
13
|
+
export declare function HomePage({ config, installCommands, children }: HomePageProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
|
14
15
|
//# sourceMappingURL=home.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAgB,KAAK,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAG5F,UAAU,eAAe;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAI/D;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,aAAa,2CA6F5E"}
|
package/dist/layouts/home.js
CHANGED
|
@@ -6,10 +6,10 @@ import { Button } from "../components/button";
|
|
|
6
6
|
export function HomeLayout({ config, children }) {
|
|
7
7
|
return (_jsx(FumaHomeLayout, { ...createBaseOptions(config), children: children }));
|
|
8
8
|
}
|
|
9
|
-
export function HomePage({ config,
|
|
9
|
+
export function HomePage({ config, installCommands, children }) {
|
|
10
10
|
const { homepage } = config;
|
|
11
11
|
const heroLeft = homepage?.hero?.left;
|
|
12
12
|
const heroRight = homepage?.hero?.right;
|
|
13
13
|
const currentYear = new Date().getFullYear();
|
|
14
|
-
return (_jsx(HomeLayout, { config: config, children: _jsxs("main", { className: "flex-1 flex flex-col min-h-[calc(100vh-var(--fd-nav-height))]", children: [_jsxs("div", { className: "flex-1 flex flex-col relative mx-auto w-full max-w-(--fd-layout-width)", children: [_jsx("div", { className: "absolute inset-0 border-x pointer-events-none" }), _jsxs("div", { className: "relative", children: [_jsx("section", { id: "hero", children: _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-4", children: [_jsx("div", { className: "lg:col-span-2 p-6 lg:p-12", children: heroLeft ? (heroLeft) : (_jsxs(_Fragment, { children: [_jsx("h1", { className: "text-left text-4xl font-medium leading-tight text-fd-foreground sm:text-5xl", children: homepage?.hero?.title ?? config.title }), _jsx("p", { className: "text-left max-w-xl leading-normal text-fd-muted-foreground sm:text-lg sm:leading-normal text-balance mt-4", children: homepage?.hero?.description ?? config.description }), _jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-end gap-4 mt-8 w-full", children: [
|
|
14
|
+
return (_jsx(HomeLayout, { config: config, children: _jsxs("main", { className: "flex-1 flex flex-col min-h-[calc(100vh-var(--fd-nav-height))]", children: [_jsxs("div", { className: "flex-1 flex flex-col relative mx-auto w-full max-w-(--fd-layout-width)", children: [_jsx("div", { className: "absolute inset-0 border-x pointer-events-none" }), _jsxs("div", { className: "relative", children: [_jsx("section", { id: "hero", children: _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-4", children: [_jsx("div", { className: "lg:col-span-2 p-6 lg:p-12", children: heroLeft ? (heroLeft) : (_jsxs(_Fragment, { children: [_jsx("h1", { className: "text-left text-4xl font-medium leading-tight text-fd-foreground sm:text-5xl", children: homepage?.hero?.title ?? config.title }), _jsx("p", { className: "text-left max-w-xl leading-normal text-fd-muted-foreground sm:text-lg sm:leading-normal text-balance mt-4", children: homepage?.hero?.description ?? config.description }), _jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-end gap-4 mt-8 w-full", children: [installCommands && (_jsx("div", { className: "flex-1", children: _jsx(InstallBlock, { commands: installCommands }) })), _jsx(Button, { href: homepage?.hero?.cta?.href ?? "/docs", children: homepage?.hero?.cta?.label ?? "Get Started" })] })] })) }), _jsx("div", { className: "lg:col-span-2 hidden lg:block", children: heroRight ? (_jsx("div", { className: "flex h-full items-center p-6 lg:p-12", children: heroRight })) : null })] }) }), homepage?.features && homepage.features.length > 0 && (_jsx("section", { id: "features", children: _jsx("div", { className: "border-y", children: _jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 [&>*]:border-b [&>*:nth-last-child(-n+1)]:border-b-0 sm:[&>*:nth-last-child(-n+2)]:border-b-0 lg:[&>*:nth-last-child(-n+4)]:border-b-0", children: homepage.features.map((feature) => (_jsxs("div", { className: "flex flex-col gap-y-2 items-start justify-start py-8 px-6 transition-colors hover:bg-fd-secondary/20 sm:border-r sm:[&:nth-child(2n)]:border-r-0 lg:[&:nth-child(2n)]:border-r lg:[&:nth-child(4n)]:border-r-0", children: [feature.icon && (_jsx("div", { className: "bg-fd-primary/10 p-2 rounded-lg mb-2", children: feature.icon })), _jsx("h3", { className: "text-base font-medium text-fd-card-foreground", children: feature.title }), _jsx("p", { className: "text-sm text-fd-muted-foreground", children: feature.description })] }, feature.title))) }) }) }))] }), children && (_jsx("div", { className: "flex-1 flex items-center justify-center", children: children }))] }), _jsx("footer", { className: "relative mx-auto w-full max-w-(--fd-layout-width)", children: _jsx("div", { className: "border-x border-t px-6 py-4", children: _jsxs("p", { className: "text-sm text-fd-muted-foreground", children: ["\u00A9 ", currentYear, " ", config.title] }) }) })] }) }));
|
|
15
15
|
}
|