diff --git a/site/bun.lock b/site/bun.lock index 14754fa..4f13e47 100644 --- a/site/bun.lock +++ b/site/bun.lock @@ -6,6 +6,7 @@ "name": "site", "dependencies": { "@orama/orama": "^3.1.18", + "@thepowderworks/fumadocs": "github:PowderworksCode/docs", "cnfast": "^0.0.8", "fumadocs-core": "16.11.1", "fumadocs-mdx": "15.1.0", @@ -30,6 +31,9 @@ }, }, }, + "trustedDependencies": [ + "@thepowderworks/fumadocs", + ], "packages": { "@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="], @@ -345,6 +349,8 @@ "@tailwindcss/postcss": ["@tailwindcss/postcss@4.3.2", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.3.2", "@tailwindcss/oxide": "4.3.2", "postcss": "^8.5.15", "tailwindcss": "4.3.2" } }, "sha512-rjVWYCa7Ngbi5AarT6k8TkxUG3Wl1QKzHdIZVsjZSzf36Jmo2IKZt/NHRAwly8oDkbBOH0YTu+CHuf9jPxMc+g=="], + "@thepowderworks/fumadocs": ["@thepowderworks/fumadocs@github:PowderworksCode/docs#c830471", { "peerDependencies": { "@orama/orama": "^3.1.18", "fumadocs-core": "16.11.1", "fumadocs-ui": "16.11.1", "next": ">=16.2.0 <17", "react": ">=19.2.0 <20", "react-dom": ">=19.2.0 <20" } }, "PowderworksCode-docs-c830471", "sha512-GoiAIW9SPM0qbQa4y6gMBSte5X2MX2umEQEuK3yj/nwpS0/uVNVjMsKFDnhu9B7uZCx/scbvCeFN+9qs5ZtMKw=="], + "@types/debug": ["@types/debug@4.1.13", "", { "dependencies": { "@types/ms": "*" } }, "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw=="], "@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="], diff --git a/site/package.json b/site/package.json index c4d7c27..2b0f366 100644 --- a/site/package.json +++ b/site/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "@orama/orama": "^3.1.18", + "@thepowderworks/fumadocs": "github:PowderworksCode/docs", "cnfast": "^0.0.8", "fumadocs-core": "16.11.1", "fumadocs-mdx": "15.1.0", @@ -35,5 +36,8 @@ "tailwindcss": "^4.3.1", "typescript": "^6.0.3", "wrangler": "^4.123.0" - } + }, + "trustedDependencies": [ + "@thepowderworks/fumadocs" + ] } diff --git a/site/src/app/global.css b/site/src/app/global.css index 488ce0e..ad2d6d5 100644 --- a/site/src/app/global.css +++ b/site/src/app/global.css @@ -2,6 +2,21 @@ @import "fumadocs-ui/css/neutral.css"; @import "fumadocs-ui/css/preset.css"; +/* The shared package's nav markup uses these class names; keep them styled + * here in this site's own visual language instead of importing the fleet + * theme's paper-and-flame palette. */ +.pw-nav-title { + display: inline-flex; + align-items: center; + gap: 0.5rem; +} + +.pw-nav-mark { + width: 1.375rem; + height: 1.375rem; + border-radius: 0.125rem; +} + html { scrollbar-gutter: stable; } diff --git a/site/src/components/mdx.tsx b/site/src/components/mdx.tsx index 62ce6e5..4673c25 100644 --- a/site/src/components/mdx.tsx +++ b/site/src/components/mdx.tsx @@ -1,14 +1,14 @@ -import defaultMdxComponents from "fumadocs-ui/mdx"; import type { MDXComponents } from "mdx/types"; +import { + getPowderworksMDXComponents, + useMDXComponents as usePowderworksMDXComponents, +} from "@thepowderworks/fumadocs/mdx"; export function getMDXComponents(components?: MDXComponents) { - return { - ...defaultMdxComponents, - ...components, - } satisfies MDXComponents; + return getPowderworksMDXComponents(components); } -export const useMDXComponents = getMDXComponents; +export const useMDXComponents = usePowderworksMDXComponents; declare global { type MDXProvidedComponents = ReturnType; diff --git a/site/src/components/provider.tsx b/site/src/components/provider.tsx index e01398d..5421461 100644 --- a/site/src/components/provider.tsx +++ b/site/src/components/provider.tsx @@ -1,15 +1,19 @@ "use client"; -import { RootProvider } from "fumadocs-ui/provider/next"; + +import { PowderworksProvider } from "@thepowderworks/fumadocs/provider"; import type { ReactNode } from "react"; import SearchDialog from "@/components/search"; +import { translations } from "@/lib/i18n"; export function Provider({ children }: { children: ReactNode }) { return ( - {children} - + ); } diff --git a/site/src/components/search.tsx b/site/src/components/search.tsx index 30685d0..ab93d4d 100644 --- a/site/src/components/search.tsx +++ b/site/src/components/search.tsx @@ -1,54 +1,10 @@ -// Search dialog over the static Orama index. Supported languages: -// https://docs.orama.com/docs/orama-js/supported-languages "use client"; -import { create } from "@orama/orama"; -import { useDocsSearch } from "fumadocs-core/search/client"; -import { oramaStaticClient } from "fumadocs-core/search/client/orama-static"; -import { - SearchDialog, - SearchDialogClose, - SearchDialogContent, - SearchDialogHeader, - SearchDialogIcon, - SearchDialogInput, - SearchDialogList, - SearchDialogOverlay, - type SharedProps, -} from "fumadocs-ui/components/dialog/search"; -import { useI18n } from "fumadocs-ui/contexts/i18n"; - -function initOrama() { - return create({ - schema: { _: "string" }, - language: "english", - }); -} -export default function DefaultSearchDialog(props: SharedProps) { - const { locale } = useI18n(); - const { search, setSearch, query } = useDocsSearch({ - client: oramaStaticClient({ - initOrama, - locale, - }), - }); +import { + PowderworksSearchDialog, + type PowderworksSearchProps, +} from "@thepowderworks/fumadocs/search"; - return ( - - - - - - - - - - - - ); +export default function SearchDialog(props: PowderworksSearchProps) { + return ; } diff --git a/site/src/lib/i18n.ts b/site/src/lib/i18n.ts new file mode 100644 index 0000000..714c654 --- /dev/null +++ b/site/src/lib/i18n.ts @@ -0,0 +1,7 @@ +import { definePowderworksI18n } from "@thepowderworks/fumadocs/i18n"; +import { site } from "./site"; + +export const { translations } = definePowderworksI18n( + site.locales, + site.defaultLocale, +); diff --git a/site/src/lib/layout.shared.tsx b/site/src/lib/layout.shared.tsx index 291f217..4bec478 100644 --- a/site/src/lib/layout.shared.tsx +++ b/site/src/lib/layout.shared.tsx @@ -1,26 +1,12 @@ +import { createPowderworksBaseOptions } from "@thepowderworks/fumadocs/layout"; import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared"; -import { appName, gitConfig } from "./shared"; +import { site } from "./site"; export function baseOptions( links: BaseLayoutProps["links"] = [], ): BaseLayoutProps { return { - nav: { - title: ( - - - {appName} - - ), - }, + ...createPowderworksBaseOptions(site, site.defaultLocale), links, - githubUrl: `https://github.com/${gitConfig.user}/${gitConfig.repo}`, }; } diff --git a/site/src/lib/site.ts b/site/src/lib/site.ts new file mode 100644 index 0000000..33699db --- /dev/null +++ b/site/src/lib/site.ts @@ -0,0 +1,11 @@ +import { definePowderworksSite } from "@thepowderworks/fumadocs/config"; + +export const site = definePowderworksSite({ + name: "Straitjacket", + description: "A secret scanner, but for slop.", + repository: "PowderworksCode/straitjacket", + siteUrl: "https://straitjacket.dev", + mark: { src: "/strait-face.png", alt: "Straitjacket" }, + locales: [{ code: "en", name: "English", searchLanguage: "english" }], + defaultLocale: "en", +});