UNPKG

fumadocs-core

Version:

The React.js library for building a documentation website

46 lines (45 loc) • 1.16 kB
"use client"; import { FrameworkProvider } from "./index.js"; import { useMemo, useRef } from "react"; import { jsx } from "react/jsx-runtime"; import { Link, useRouter } from "waku/router/client"; // src/framework/waku.tsx const framework = { usePathname() { return useRouter().path; }, useParams() { console.warn("[Fumadocs] useParams() is not supported on Waku"); return useMemo(() => ({}), []); }, useRouter() { const router = useRouter(); const routerRef = useRef(router); routerRef.current = router; return useMemo(() => ({ push(url) { return routerRef.current.push(url); }, refresh() { return routerRef.current.reload(); } }), []); }, Link({ href, prefetch = true, ...props }) { return /* @__PURE__ */ jsx(Link, { to: href, unstable_prefetchOnEnter: prefetch ? { mode: "once" } : void 0, ...props, children: props.children }); } }; function WakuProvider({ children, Link: CustomLink, Image: CustomImage }) { return /* @__PURE__ */ jsx(FrameworkProvider, { ...framework, Link: CustomLink ?? framework.Link, Image: CustomImage ?? framework.Image, children }); } export { WakuProvider };