opin-ui 0.0.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/README.md +5 -0
- package/css/aspen.css +39 -0
- package/css/black.css +39 -0
- package/css/catppuccin.css +49 -0
- package/css/dusk.css +47 -0
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +1 -0
- package/css/generated/flux.css +1 -0
- package/css/generated/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +314 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +108 -0
- package/css/neutral.css +7 -0
- package/css/ocean.css +44 -0
- package/css/preset-legacy.css +43 -0
- package/css/preset.css +11 -0
- package/css/purple.css +39 -0
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -0
- package/css/solar.css +75 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +65 -0
- package/dist/.translations/index.d.ts +49 -0
- package/dist/.translations/keys.js +49 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +23 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +33 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +41 -0
- package/dist/components/callout.js +53 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +38 -0
- package/dist/components/codeblock.d.ts +61 -0
- package/dist/components/codeblock.js +173 -0
- package/dist/components/codeblock.rsc.d.ts +20 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +36 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +36 -0
- package/dist/components/dialog/search-default.js +58 -0
- package/dist/components/dialog/search-orama.d.ts +43 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +112 -0
- package/dist/components/dialog/search.js +350 -0
- package/dist/components/dynamic-codeblock.core.d.ts +34 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +9 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +34 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +35 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +13 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +23 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +14 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +131 -0
- package/dist/components/sidebar/base.js +274 -0
- package/dist/components/sidebar/link-item.d.ts +22 -0
- package/dist/components/sidebar/link-item.js +38 -0
- package/dist/components/sidebar/page-tree.d.ts +28 -0
- package/dist/components/sidebar/page-tree.js +71 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +16 -0
- package/dist/components/sidebar/tabs/dropdown.js +71 -0
- package/dist/components/sidebar/tabs/index.d.ts +11 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +15 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +49 -0
- package/dist/components/tabs.js +88 -0
- package/dist/components/toc/clerk.d.ts +20 -0
- package/dist/components/toc/clerk.js +226 -0
- package/dist/components/toc/default.d.ts +23 -0
- package/dist/components/toc/default.js +259 -0
- package/dist/components/toc/index.d.ts +19 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +43 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +30 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +15 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +30 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +15 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +22 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +36 -0
- package/dist/components/ui/tabs.js +77 -0
- package/dist/contexts/i18n.d.ts +41 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +73 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +20 -0
- package/dist/contexts/tree.js +38 -0
- package/dist/i18n.d.ts +16 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +34 -0
- package/dist/layouts/docs/client.js +92 -0
- package/dist/layouts/docs/index.d.ts +44 -0
- package/dist/layouts/docs/index.js +22 -0
- package/dist/layouts/docs/page/index.d.ts +115 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +6 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +22 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +62 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +6 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +6 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +29 -0
- package/dist/layouts/docs/slots/sidebar.js +326 -0
- package/dist/layouts/flux/index.d.ts +73 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +102 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +6 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +22 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +38 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +6 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +22 -0
- package/dist/layouts/flux/slots/sidebar.js +237 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +16 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
- package/dist/layouts/home/index.d.ts +28 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +10 -0
- package/dist/layouts/home/navbar.js +34 -0
- package/dist/layouts/home/not-found.d.ts +7 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/slots/container.d.ts +6 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +9 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +36 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +37 -0
- package/dist/layouts/notebook/index.js +22 -0
- package/dist/layouts/notebook/page/index.d.ts +115 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +22 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +62 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +6 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +30 -0
- package/dist/layouts/notebook/slots/sidebar.js +298 -0
- package/dist/layouts/shared/client.d.ts +44 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +178 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +35 -0
- package/dist/layouts/shared/page-actions.js +195 -0
- package/dist/layouts/shared/slots/language-select.d.ts +18 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +22 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +13 -0
- package/dist/layouts/shared/slots/theme-switch.js +65 -0
- package/dist/legacy/layout.d.ts +36 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +17 -0
- package/dist/legacy/sidebar.js +33 -0
- package/dist/mdx.d.ts +45 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +15 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/index.d.ts +2 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +8 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +55 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +22 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +35 -0
- package/dist/page.js +33 -0
- package/dist/provider/base.d.ts +49 -0
- package/dist/provider/base.js +32 -0
- package/dist/provider/next.d.ts +20 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +20 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +20 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +20 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3534 -0
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +6 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +9 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +8 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +200 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Airplay, Moon, Sun } from "lucide-react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
+
import { useTheme } from "next-themes";
|
|
9
|
+
//#region src/layouts/shared/slots/theme-switch.tsx
|
|
10
|
+
const itemVariants = cva("size-6.5 p-1.5 text-fd-muted-foreground", { variants: { active: {
|
|
11
|
+
true: "bg-fd-accent text-fd-accent-foreground",
|
|
12
|
+
false: "text-fd-muted-foreground"
|
|
13
|
+
} } });
|
|
14
|
+
const full = [
|
|
15
|
+
["light", Sun],
|
|
16
|
+
["dark", Moon],
|
|
17
|
+
["system", Airplay]
|
|
18
|
+
];
|
|
19
|
+
function ThemeSwitch({ className, mode = "light-dark", ...props }) {
|
|
20
|
+
const { setTheme, theme, resolvedTheme } = useTheme();
|
|
21
|
+
const [mounted, setMounted] = useState(false);
|
|
22
|
+
const t = useTranslations({ note: "theme switcher" });
|
|
23
|
+
const themeAriaLabels = {
|
|
24
|
+
light: t("Light", { note: "aria-label" }),
|
|
25
|
+
dark: t("Dark", { note: "aria-label" }),
|
|
26
|
+
system: t("System", { note: "aria-label" })
|
|
27
|
+
};
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setMounted(true);
|
|
30
|
+
}, []);
|
|
31
|
+
const container = cn("inline-flex items-center rounded-full border p-1 overflow-hidden *:rounded-full", className);
|
|
32
|
+
if (mode === "light-dark") {
|
|
33
|
+
const value = mounted ? resolvedTheme : null;
|
|
34
|
+
return /* @__PURE__ */ jsx("button", {
|
|
35
|
+
className: container,
|
|
36
|
+
"aria-label": t("Toggle Theme", { note: "aria-label" }),
|
|
37
|
+
onClick: () => setTheme(value === "light" ? "dark" : "light"),
|
|
38
|
+
"data-theme-toggle": "",
|
|
39
|
+
children: full.map(([key, Icon]) => {
|
|
40
|
+
if (key === "system") return;
|
|
41
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
42
|
+
fill: "currentColor",
|
|
43
|
+
className: cn(itemVariants({ active: value === key }))
|
|
44
|
+
}, key);
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const value = mounted ? theme : null;
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: container,
|
|
51
|
+
"data-theme-toggle": "",
|
|
52
|
+
...props,
|
|
53
|
+
children: full.map(([key, Icon]) => /* @__PURE__ */ jsx("button", {
|
|
54
|
+
"aria-label": themeAriaLabels[key],
|
|
55
|
+
className: cn(itemVariants({ active: value === key })),
|
|
56
|
+
onClick: () => setTheme(key),
|
|
57
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
58
|
+
className: "size-full",
|
|
59
|
+
fill: "currentColor"
|
|
60
|
+
})
|
|
61
|
+
}, key))
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { ThemeSwitch };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/legacy/layout.d.ts
|
|
4
|
+
interface PageStyles {
|
|
5
|
+
tocNav?: string;
|
|
6
|
+
toc?: string;
|
|
7
|
+
page?: string;
|
|
8
|
+
article?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function usePageStyles(): PageStyles;
|
|
11
|
+
declare function StylesProvider({
|
|
12
|
+
children,
|
|
13
|
+
...value
|
|
14
|
+
}: PageStyles & {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
interface NavProviderProps {
|
|
18
|
+
/**
|
|
19
|
+
* Use transparent background
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue none
|
|
22
|
+
*/
|
|
23
|
+
transparentMode?: 'always' | 'top' | 'none';
|
|
24
|
+
}
|
|
25
|
+
interface NavContextType {
|
|
26
|
+
isTransparent: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare function NavProvider({
|
|
29
|
+
transparentMode,
|
|
30
|
+
children
|
|
31
|
+
}: NavProviderProps & {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
declare function useNav(): NavContextType;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { NavProvider, NavProviderProps, PageStyles, StylesProvider, useNav, usePageStyles };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use, useEffect, useMemo, useState } from "react";
|
|
4
|
+
//#region src/legacy/layout.tsx
|
|
5
|
+
/**
|
|
6
|
+
* applied styles to different layout components in `Page` from layouts
|
|
7
|
+
*/
|
|
8
|
+
const StylesContext = createContext({
|
|
9
|
+
tocNav: "xl:hidden",
|
|
10
|
+
toc: "max-xl:hidden"
|
|
11
|
+
});
|
|
12
|
+
function usePageStyles() {
|
|
13
|
+
return use(StylesContext);
|
|
14
|
+
}
|
|
15
|
+
function StylesProvider({ children, ...value }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(StylesContext.Provider, {
|
|
17
|
+
value,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const NavContext = createContext({ isTransparent: false });
|
|
22
|
+
function NavProvider({ transparentMode = "none", children }) {
|
|
23
|
+
const [transparent, setTransparent] = useState(transparentMode !== "none");
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (transparentMode !== "top") return;
|
|
26
|
+
const listener = () => {
|
|
27
|
+
setTransparent(window.scrollY < 10);
|
|
28
|
+
};
|
|
29
|
+
listener();
|
|
30
|
+
window.addEventListener("scroll", listener);
|
|
31
|
+
return () => {
|
|
32
|
+
window.removeEventListener("scroll", listener);
|
|
33
|
+
};
|
|
34
|
+
}, [transparentMode]);
|
|
35
|
+
return /* @__PURE__ */ jsx(NavContext, {
|
|
36
|
+
value: useMemo(() => ({ isTransparent: transparent }), [transparent]),
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function useNav() {
|
|
41
|
+
return use(NavContext);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { NavProvider, StylesProvider, useNav, usePageStyles };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Dispatch, ReactNode, RefObject, SetStateAction } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/legacy/sidebar.d.ts
|
|
4
|
+
declare function useSidebar(): {
|
|
5
|
+
open: boolean;
|
|
6
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
7
|
+
collapsed: boolean;
|
|
8
|
+
setCollapsed: Dispatch<SetStateAction<boolean>>;
|
|
9
|
+
closeOnRedirect: RefObject<boolean>;
|
|
10
|
+
};
|
|
11
|
+
declare function SidebarProvider({
|
|
12
|
+
children
|
|
13
|
+
}: {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SidebarProvider, useSidebar };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePathname } from "fumadocs-core/framework";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
6
|
+
//#region src/legacy/sidebar.tsx
|
|
7
|
+
const SidebarContext = createContext(null);
|
|
8
|
+
function useSidebar() {
|
|
9
|
+
const ctx = use(SidebarContext);
|
|
10
|
+
if (!ctx) throw new Error("the component must be wrapped under <SidebarProvider /> (opin-ui/legacy/sidebar)");
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
function SidebarProvider({ children }) {
|
|
14
|
+
const [open, setOpen] = useState(false);
|
|
15
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
16
|
+
const closeOnRedirect = useRef(true);
|
|
17
|
+
useOnChange(usePathname(), () => {
|
|
18
|
+
if (closeOnRedirect.current) setOpen(false);
|
|
19
|
+
else closeOnRedirect.current = true;
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ jsx(SidebarContext, {
|
|
22
|
+
value: useMemo(() => ({
|
|
23
|
+
closeOnRedirect,
|
|
24
|
+
collapsed,
|
|
25
|
+
open,
|
|
26
|
+
setCollapsed,
|
|
27
|
+
setOpen
|
|
28
|
+
}), [open, collapsed]),
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { SidebarProvider, useSidebar };
|
package/dist/mdx.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from "./components/callout.js";
|
|
2
|
+
import { Card, Cards } from "./components/card.js";
|
|
3
|
+
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from "./components/codeblock.js";
|
|
4
|
+
import { createRelativeLink as createRelativeLink$1 } from "./mdx.server.js";
|
|
5
|
+
import React, { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/mdx.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* global types for MDX.js
|
|
10
|
+
*/
|
|
11
|
+
declare module 'mdx/types.js' {
|
|
12
|
+
namespace JSX {
|
|
13
|
+
type Element = React.JSX.Element;
|
|
14
|
+
type ElementClass = React.JSX.ElementClass;
|
|
15
|
+
type ElementType = React.JSX.ElementType;
|
|
16
|
+
type IntrinsicElements = React.JSX.IntrinsicElements;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare function Image(props: ImgHTMLAttributes<HTMLImageElement>): React.JSX.Element;
|
|
20
|
+
declare function Table(props: TableHTMLAttributes<HTMLTableElement>): React.JSX.Element;
|
|
21
|
+
declare const defaultMdxComponents: {
|
|
22
|
+
CodeBlockTab: typeof CodeBlockTab;
|
|
23
|
+
CodeBlockTabs: typeof CodeBlockTabs;
|
|
24
|
+
CodeBlockTabsList: typeof CodeBlockTabsList;
|
|
25
|
+
CodeBlockTabsTrigger: typeof CodeBlockTabsTrigger;
|
|
26
|
+
pre: (props: HTMLAttributes<HTMLPreElement>) => React.JSX.Element;
|
|
27
|
+
Card: typeof Card;
|
|
28
|
+
Cards: typeof Cards;
|
|
29
|
+
a: FC<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
30
|
+
img: typeof Image;
|
|
31
|
+
h1: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
32
|
+
h2: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
33
|
+
h3: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
34
|
+
h4: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
35
|
+
h5: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
36
|
+
h6: (props: HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
|
|
37
|
+
table: typeof Table;
|
|
38
|
+
Callout: typeof Callout;
|
|
39
|
+
CalloutContainer: typeof CalloutContainer;
|
|
40
|
+
CalloutTitle: typeof CalloutTitle;
|
|
41
|
+
CalloutDescription: typeof CalloutDescription;
|
|
42
|
+
};
|
|
43
|
+
declare const createRelativeLink: typeof createRelativeLink$1;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
package/dist/mdx.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cn } from "./utils/cn.js";
|
|
2
|
+
import { Card, Cards } from "./components/card.js";
|
|
3
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from "./components/callout.js";
|
|
4
|
+
import { Heading } from "./components/heading.js";
|
|
5
|
+
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "./components/codeblock.js";
|
|
6
|
+
import Link from "fumadocs-core/link";
|
|
7
|
+
import { Image } from "fumadocs-core/framework";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
//#region src/mdx.tsx
|
|
10
|
+
function Image$1(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Image, {
|
|
12
|
+
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px",
|
|
13
|
+
...props,
|
|
14
|
+
className: cn("rounded-lg", props.className)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function Table(props) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "relative overflow-auto prose-no-margin my-6",
|
|
20
|
+
children: /* @__PURE__ */ jsx("table", { ...props })
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const defaultMdxComponents = {
|
|
24
|
+
CodeBlockTab,
|
|
25
|
+
CodeBlockTabs,
|
|
26
|
+
CodeBlockTabsList,
|
|
27
|
+
CodeBlockTabsTrigger,
|
|
28
|
+
pre: (props) => /* @__PURE__ */ jsx(CodeBlock, {
|
|
29
|
+
...props,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Pre, { children: props.children })
|
|
31
|
+
}),
|
|
32
|
+
Card,
|
|
33
|
+
Cards,
|
|
34
|
+
a: Link,
|
|
35
|
+
img: Image$1,
|
|
36
|
+
h1: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
37
|
+
as: "h1",
|
|
38
|
+
...props
|
|
39
|
+
}),
|
|
40
|
+
h2: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
41
|
+
as: "h2",
|
|
42
|
+
...props
|
|
43
|
+
}),
|
|
44
|
+
h3: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
45
|
+
as: "h3",
|
|
46
|
+
...props
|
|
47
|
+
}),
|
|
48
|
+
h4: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
49
|
+
as: "h4",
|
|
50
|
+
...props
|
|
51
|
+
}),
|
|
52
|
+
h5: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
53
|
+
as: "h5",
|
|
54
|
+
...props
|
|
55
|
+
}),
|
|
56
|
+
h6: (props) => /* @__PURE__ */ jsx(Heading, {
|
|
57
|
+
as: "h6",
|
|
58
|
+
...props
|
|
59
|
+
}),
|
|
60
|
+
table: Table,
|
|
61
|
+
Callout,
|
|
62
|
+
CalloutContainer,
|
|
63
|
+
CalloutTitle,
|
|
64
|
+
CalloutDescription
|
|
65
|
+
};
|
|
66
|
+
const createRelativeLink = () => {
|
|
67
|
+
throw new Error("`createRelativeLink` is only supported in Node.js environment");
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import defaultMdxComponents from "./mdx.js";
|
|
2
|
+
import { ComponentProps, FC } from "react";
|
|
3
|
+
import { LoaderConfig, LoaderOutput, Page } from "fumadocs-core/source";
|
|
4
|
+
|
|
5
|
+
//#region src/mdx.server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Extend the default Link component to resolve relative file paths in `href`.
|
|
8
|
+
*
|
|
9
|
+
* @param page the current page
|
|
10
|
+
* @param source the source object
|
|
11
|
+
* @param OverrideLink The component to override from
|
|
12
|
+
*/
|
|
13
|
+
declare function createRelativeLink<C extends LoaderConfig>(source: LoaderOutput<C>, page: Page | C['page'], OverrideLink?: FC<ComponentProps<'a'>>): FC<ComponentProps<'a'>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import defaultMdxComponents from "./mdx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/mdx.server.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Extend the default Link component to resolve relative file paths in `href`.
|
|
6
|
+
*
|
|
7
|
+
* @param page the current page
|
|
8
|
+
* @param source the source object
|
|
9
|
+
* @param OverrideLink The component to override from
|
|
10
|
+
*/
|
|
11
|
+
function createRelativeLink(source, page, OverrideLink = defaultMdxComponents.a) {
|
|
12
|
+
return async function RelativeLink({ href, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(OverrideLink, {
|
|
14
|
+
href: href ? source.resolveHref(href, page) : href,
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.bun/react-medium-image-zoom@5.4.8+7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts
|
|
4
|
+
type ModalState = 'LOADED' | 'LOADING' | 'UNLOADED' | 'UNLOADING';
|
|
5
|
+
interface ControlledProps {
|
|
6
|
+
a11yNameButtonUnzoom?: string;
|
|
7
|
+
a11yNameButtonZoom?: string;
|
|
8
|
+
canSwipeToUnzoom?: boolean;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
classDialog?: string;
|
|
11
|
+
IconUnzoom?: React.ElementType;
|
|
12
|
+
IconZoom?: React.ElementType;
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
isZoomed: boolean;
|
|
15
|
+
onZoomChange?: (value: boolean, data: {
|
|
16
|
+
event: React.SyntheticEvent | Event;
|
|
17
|
+
}) => void;
|
|
18
|
+
swipeToUnzoomThreshold?: number;
|
|
19
|
+
wrapElement?: 'div' | 'span';
|
|
20
|
+
ZoomContent?: (data: {
|
|
21
|
+
buttonUnzoom: React.ReactElement<HTMLButtonElement>;
|
|
22
|
+
img: React.ReactElement | null;
|
|
23
|
+
isZoomImgLoaded: boolean;
|
|
24
|
+
modalState: ModalState;
|
|
25
|
+
onUnzoom: (e: Event) => void;
|
|
26
|
+
}) => React.ReactElement;
|
|
27
|
+
zoomImg?: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
28
|
+
zoomMargin?: number;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ControlledProps };
|