fumadocs-ui 16.4.1 → 16.4.2
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/css/preset.css +2 -4
- package/dist/_virtual/rolldown_runtime.js +36 -0
- package/dist/components/accordion.d.ts +24 -7
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +65 -38
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/banner.d.ts +33 -22
- package/dist/components/banner.d.ts.map +1 -1
- package/dist/components/banner.js +63 -47
- package/dist/components/banner.js.map +1 -0
- package/dist/components/callout.d.ts +41 -17
- package/dist/components/callout.d.ts.map +1 -1
- package/dist/components/callout.js +57 -28
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.d.ts +19 -9
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +39 -8
- package/dist/components/card.js.map +1 -0
- package/dist/components/codeblock.d.ts +61 -40
- package/dist/components/codeblock.d.ts.map +1 -1
- package/dist/components/codeblock.js +116 -58
- package/dist/components/codeblock.js.map +1 -0
- package/dist/components/dialog/search-algolia.d.ts +37 -23
- package/dist/components/dialog/search-algolia.d.ts.map +1 -1
- package/dist/components/dialog/search-algolia.js +64 -31
- package/dist/components/dialog/search-algolia.js.map +1 -0
- package/dist/components/dialog/search-default.d.ts +42 -27
- package/dist/components/dialog/search-default.d.ts.map +1 -1
- package/dist/components/dialog/search-default.js +64 -38
- package/dist/components/dialog/search-default.js.map +1 -0
- package/dist/components/dialog/search-orama.d.ts +41 -25
- package/dist/components/dialog/search-orama.d.ts.map +1 -1
- package/dist/components/dialog/search-orama.js +68 -35
- package/dist/components/dialog/search-orama.js.map +1 -0
- package/dist/components/dialog/search.d.ts +103 -64
- package/dist/components/dialog/search.d.ts.map +1 -1
- package/dist/components/dialog/search.js +264 -185
- package/dist/components/dialog/search.js.map +1 -0
- package/dist/components/dynamic-codeblock.d.ts +30 -19
- package/dist/components/dynamic-codeblock.d.ts.map +1 -1
- package/dist/components/dynamic-codeblock.js +60 -27
- package/dist/components/dynamic-codeblock.js.map +1 -0
- package/dist/components/files.d.ts +32 -16
- package/dist/components/files.d.ts.map +1 -1
- package/dist/components/files.js +40 -14
- package/dist/components/files.js.map +1 -0
- package/dist/components/github-info.d.ts +18 -7
- package/dist/components/github-info.d.ts.map +1 -1
- package/dist/components/github-info.js +63 -48
- package/dist/components/github-info.js.map +1 -0
- package/dist/components/heading.d.ts +11 -4
- package/dist/components/heading.d.ts.map +1 -1
- package/dist/components/heading.js +28 -8
- package/dist/components/heading.js.map +1 -0
- package/dist/components/image-zoom-CtfZieBH.css +80 -0
- package/dist/components/image-zoom-CtfZieBH.css.map +1 -0
- package/dist/components/image-zoom.d.ts +23 -14
- package/dist/components/image-zoom.d.ts.map +1 -1
- package/dist/components/image-zoom.js +32 -19
- package/dist/components/image-zoom.js.map +1 -0
- package/dist/components/image-zoom2.js +1 -0
- package/dist/components/inline-toc.d.ts +14 -6
- package/dist/components/inline-toc.d.ts.map +1 -1
- package/dist/components/inline-toc.js +28 -8
- package/dist/components/inline-toc.js.map +1 -0
- package/dist/components/sidebar/base.d.ts +102 -65
- package/dist/components/sidebar/base.d.ts.map +1 -1
- package/dist/components/sidebar/base.js +256 -180
- package/dist/components/sidebar/base.js.map +1 -0
- package/dist/components/sidebar/link-item.d.ts +23 -10
- package/dist/components/sidebar/link-item.d.ts.map +1 -1
- package/dist/components/sidebar/link-item.js +32 -12
- package/dist/components/sidebar/link-item.js.map +1 -0
- package/dist/components/sidebar/page-tree.d.ts +28 -17
- package/dist/components/sidebar/page-tree.d.ts.map +1 -1
- package/dist/components/sidebar/page-tree.js +57 -33
- package/dist/components/sidebar/page-tree.js.map +1 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +18 -9
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +1 -1
- package/dist/components/sidebar/tabs/dropdown.js +75 -31
- package/dist/components/sidebar/tabs/dropdown.js.map +1 -0
- package/dist/components/sidebar/tabs/index.d.ts +24 -18
- package/dist/components/sidebar/tabs/index.d.ts.map +1 -1
- package/dist/components/sidebar/tabs/index.js +45 -45
- package/dist/components/sidebar/tabs/index.js.map +1 -0
- package/dist/components/steps.d.ts +16 -7
- package/dist/components/steps.d.ts.map +1 -1
- package/dist/components/steps.js +17 -5
- package/dist/components/steps.js.map +1 -0
- package/dist/components/tabs.d.ts +49 -28
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +88 -51
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/toc/clerk.d.ts +1 -2
- package/dist/components/toc/clerk.js +12 -1
- package/dist/components/toc/clerk.js.map +1 -0
- package/dist/components/toc/default.d.ts +1 -2
- package/dist/components/toc/default.js +12 -1
- package/dist/components/toc/default.js.map +1 -0
- package/dist/components/toc/index.d.ts +1 -2
- package/dist/components/toc/index.js +12 -1
- package/dist/components/toc/index.js.map +1 -0
- package/dist/components/type-table.d.ts +36 -29
- package/dist/components/type-table.d.ts.map +1 -1
- package/dist/components/type-table.js +106 -25
- package/dist/components/type-table.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +31 -7
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +40 -14
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/button.d.ts +12 -7
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +21 -18
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +12 -8
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +21 -11
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +8 -5
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +36 -9
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/popover.d.ts +6 -3
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +19 -6
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +7 -4
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +33 -7
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +37 -19
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +75 -73
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/contexts/i18n.d.ts +1 -2
- package/dist/contexts/i18n.js +12 -1
- package/dist/contexts/i18n.js.map +1 -0
- package/dist/contexts/search.d.ts +7 -1
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +12 -1
- package/dist/contexts/search.js.map +1 -0
- package/dist/contexts/tree.d.ts +1 -2
- package/dist/contexts/tree.js +12 -1
- package/dist/contexts/tree.js.map +1 -0
- package/dist/i18n.d.ts +1 -2
- package/dist/i18n.js +3 -1
- package/dist/layouts/docs/client.d.ts +30 -13
- package/dist/layouts/docs/client.d.ts.map +1 -1
- package/dist/layouts/docs/client.js +61 -34
- package/dist/layouts/docs/client.js.map +1 -0
- package/dist/layouts/docs/index.d.ts +57 -33
- package/dist/layouts/docs/index.d.ts.map +1 -1
- package/dist/layouts/docs/index.js +178 -68
- package/dist/layouts/docs/index.js.map +1 -0
- package/dist/layouts/docs/page/client.d.ts +43 -21
- package/dist/layouts/docs/page/client.d.ts.map +1 -1
- package/dist/layouts/docs/page/client.js +213 -105
- package/dist/layouts/docs/page/client.js.map +1 -0
- package/dist/layouts/docs/page/index.d.ts +82 -46
- package/dist/layouts/docs/page/index.d.ts.map +1 -1
- package/dist/layouts/docs/page/index.js +98 -45
- package/dist/layouts/docs/page/index.js.map +1 -0
- package/dist/layouts/docs/sidebar.d.ts +57 -16
- package/dist/layouts/docs/sidebar.d.ts.map +1 -1
- package/dist/layouts/docs/sidebar.js +135 -82
- package/dist/layouts/docs/sidebar.js.map +1 -0
- package/dist/layouts/home/client.d.ts +18 -5
- package/dist/layouts/home/client.d.ts.map +1 -1
- package/dist/layouts/home/client.js +252 -103
- package/dist/layouts/home/client.js.map +1 -0
- package/dist/layouts/home/index.d.ts +15 -10
- package/dist/layouts/home/index.d.ts.map +1 -1
- package/dist/layouts/home/index.js +24 -7
- package/dist/layouts/home/index.js.map +1 -0
- package/dist/layouts/home/navbar.d.ts +13 -6
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/home/navbar.js +34 -12
- package/dist/layouts/home/navbar.js.map +1 -0
- package/dist/layouts/notebook/client.d.ts +44 -20
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js +148 -93
- package/dist/layouts/notebook/client.js.map +1 -0
- package/dist/layouts/notebook/index.d.ts +34 -30
- package/dist/layouts/notebook/index.d.ts.map +1 -1
- package/dist/layouts/notebook/index.js +216 -90
- package/dist/layouts/notebook/index.js.map +1 -0
- package/dist/layouts/notebook/page/client.d.ts +43 -21
- package/dist/layouts/notebook/page/client.d.ts.map +1 -1
- package/dist/layouts/notebook/page/client.js +213 -105
- package/dist/layouts/notebook/page/client.js.map +1 -0
- package/dist/layouts/notebook/page/index.d.ts +82 -46
- package/dist/layouts/notebook/page/index.d.ts.map +1 -1
- package/dist/layouts/notebook/page/index.js +98 -45
- package/dist/layouts/notebook/page/index.js.map +1 -0
- package/dist/layouts/notebook/sidebar.d.ts +62 -20
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -1
- package/dist/layouts/notebook/sidebar.js +130 -88
- package/dist/layouts/notebook/sidebar.js.map +1 -0
- package/dist/layouts/shared/index.d.ts +62 -50
- package/dist/layouts/shared/index.d.ts.map +1 -1
- package/dist/layouts/shared/index.js +36 -20
- package/dist/layouts/shared/index.js.map +1 -0
- package/dist/layouts/shared/language-toggle.d.ts +9 -4
- package/dist/layouts/shared/language-toggle.d.ts.map +1 -1
- package/dist/layouts/shared/language-toggle.js +44 -21
- package/dist/layouts/shared/language-toggle.js.map +1 -0
- package/dist/layouts/shared/search-toggle.d.ts +20 -8
- package/dist/layouts/shared/search-toggle.d.ts.map +1 -1
- package/dist/layouts/shared/search-toggle.js +53 -24
- package/dist/layouts/shared/search-toggle.js.map +1 -0
- package/dist/layouts/shared/theme-toggle.d.ts +13 -4
- package/dist/layouts/shared/theme-toggle.d.ts.map +1 -1
- package/dist/layouts/shared/theme-toggle.js +58 -34
- package/dist/layouts/shared/theme-toggle.js.map +1 -0
- package/dist/mdx.d.ts +34 -29
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +68 -34
- package/dist/mdx.js.map +1 -0
- package/dist/mdx.server.d.ts +9 -5
- package/dist/mdx.server.d.ts.map +1 -1
- package/dist/mdx.server.js +21 -13
- package/dist/mdx.server.js.map +1 -0
- package/dist/og.d.ts +1 -2
- package/dist/og.js +3 -1
- package/dist/page.d.ts +30 -20
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +34 -18
- package/dist/page.js.map +1 -0
- package/dist/provider/base.d.ts +43 -33
- package/dist/provider/base.d.ts.map +1 -1
- package/dist/provider/base.js +37 -17
- package/dist/provider/base.js.map +1 -0
- package/dist/provider/next.d.ts +20 -12
- package/dist/provider/next.d.ts.map +1 -1
- package/dist/provider/next.js +19 -5
- package/dist/provider/next.js.map +1 -0
- package/dist/provider/react-router.d.ts +20 -12
- package/dist/provider/react-router.d.ts.map +1 -1
- package/dist/provider/react-router.js +19 -5
- package/dist/provider/react-router.js.map +1 -0
- package/dist/provider/tanstack.d.ts +20 -12
- package/dist/provider/tanstack.d.ts.map +1 -1
- package/dist/provider/tanstack.js +19 -5
- package/dist/provider/tanstack.js.map +1 -0
- package/dist/provider/waku.d.ts +20 -12
- package/dist/provider/waku.d.ts.map +1 -1
- package/dist/provider/waku.js +19 -5
- package/dist/provider/waku.js.map +1 -0
- package/dist/style.css +11 -13
- package/dist/utils/use-copy-button.d.ts +1 -2
- package/dist/utils/use-copy-button.js +3 -1
- package/dist/utils/use-footer-items.d.ts +1 -2
- package/dist/utils/use-footer-items.js +3 -1
- package/dist/utils/use-is-scroll-top.d.ts +1 -2
- package/dist/utils/use-is-scroll-top.js +3 -1
- package/package.json +51 -52
- package/dist/components/toc/clerk.d.ts.map +0 -1
- package/dist/components/toc/default.d.ts.map +0 -1
- package/dist/components/toc/index.d.ts.map +0 -1
- package/dist/contexts/i18n.d.ts.map +0 -1
- package/dist/contexts/tree.d.ts.map +0 -1
- package/dist/i18n.d.ts.map +0 -1
- package/dist/og.d.ts.map +0 -1
- package/dist/utils/use-copy-button.d.ts.map +0 -1
- package/dist/utils/use-footer-items.d.ts.map +0 -1
- package/dist/utils/use-is-scroll-top.d.ts.map +0 -1
|
@@ -1,33 +1,66 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import { CodeBlock, Pre } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
import { CodeBlock, Pre } from "./codeblock.js";
|
|
4
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Suspense, createContext, use, useDeferredValue, useId } from "react";
|
|
7
|
+
import { useShiki } from "fumadocs-core/highlight/client";
|
|
8
|
+
|
|
9
|
+
//#region src/components/dynamic-codeblock.tsx
|
|
10
|
+
const PropsContext = createContext(void 0);
|
|
8
11
|
function DefaultPre(props) {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const extraProps = use(PropsContext);
|
|
13
|
+
return /* @__PURE__ */ jsx(CodeBlock, {
|
|
14
|
+
...props,
|
|
15
|
+
...extraProps,
|
|
16
|
+
className: cn("my-0", props.className, extraProps?.className),
|
|
17
|
+
children: /* @__PURE__ */ jsx(Pre, { children: props.children })
|
|
18
|
+
});
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function DynamicCodeBlock({ lang, code, codeblock, options, wrapInSuspense = true }) {
|
|
21
|
+
const id = useId();
|
|
22
|
+
const shikiOptions = {
|
|
23
|
+
lang,
|
|
24
|
+
...options,
|
|
25
|
+
components: {
|
|
26
|
+
pre: DefaultPre,
|
|
27
|
+
...options?.components
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const children = /* @__PURE__ */ jsx(PropsContext, {
|
|
31
|
+
value: codeblock,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Internal, {
|
|
33
|
+
id,
|
|
34
|
+
...useDeferredValue({
|
|
35
|
+
code,
|
|
36
|
+
options: shikiOptions
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
if (wrapInSuspense) return /* @__PURE__ */ jsx(Suspense, {
|
|
41
|
+
fallback: /* @__PURE__ */ jsx(Placeholder, {
|
|
42
|
+
code,
|
|
43
|
+
components: shikiOptions.components
|
|
44
|
+
}),
|
|
45
|
+
children
|
|
46
|
+
});
|
|
47
|
+
return children;
|
|
26
48
|
}
|
|
27
|
-
function Placeholder({ code, components = {}
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
function Placeholder({ code, components = {} }) {
|
|
50
|
+
const { pre: Pre$1 = "pre", code: Code = "code" } = components;
|
|
51
|
+
return /* @__PURE__ */ jsx(Pre$1, { children: /* @__PURE__ */ jsx(Code, { children: code.split("\n").map((line, i) => /* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: "line",
|
|
53
|
+
children: line
|
|
54
|
+
}, i)) }) });
|
|
30
55
|
}
|
|
31
|
-
function Internal({ id, code, options
|
|
32
|
-
|
|
56
|
+
function Internal({ id, code, options }) {
|
|
57
|
+
return useShiki(code, options, [
|
|
58
|
+
id,
|
|
59
|
+
options.lang,
|
|
60
|
+
code
|
|
61
|
+
]);
|
|
33
62
|
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { DynamicCodeBlock };
|
|
66
|
+
//# sourceMappingURL=dynamic-codeblock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-codeblock.js","names":["Pre"],"sources":["../../src/components/dynamic-codeblock.tsx"],"sourcesContent":["'use client';\nimport { CodeBlock, type CodeBlockProps, Pre } from '@/components/codeblock';\nimport type {\n HighlightOptions,\n HighlightOptionsCommon,\n HighlightOptionsThemes,\n} from 'fumadocs-core/highlight';\nimport { useShiki } from 'fumadocs-core/highlight/client';\nimport { cn } from '@fumadocs/ui/cn';\nimport {\n type ComponentProps,\n createContext,\n type FC,\n Suspense,\n use,\n useDeferredValue,\n useId,\n} from 'react';\n\nexport interface DynamicCodeblockProps {\n lang: string;\n code: string;\n /**\n * Extra props for the underlying `<CodeBlock />` component.\n *\n * Ignored if you defined your own `pre` component in `options.components`.\n */\n codeblock?: CodeBlockProps;\n /**\n * Wrap in React `<Suspense />` and provide a fallback.\n *\n * @defaultValue true\n */\n wrapInSuspense?: boolean;\n options?: Omit<HighlightOptionsCommon, 'lang'> & HighlightOptionsThemes;\n}\n\nconst PropsContext = createContext<CodeBlockProps | undefined>(undefined);\n\nfunction DefaultPre(props: ComponentProps<'pre'>) {\n const extraProps = use(PropsContext);\n\n return (\n <CodeBlock\n {...props}\n {...extraProps}\n className={cn('my-0', props.className, extraProps?.className)}\n >\n <Pre>{props.children}</Pre>\n </CodeBlock>\n );\n}\n\nexport function DynamicCodeBlock({\n lang,\n code,\n codeblock,\n options,\n wrapInSuspense = true,\n}: DynamicCodeblockProps) {\n const id = useId();\n const shikiOptions = {\n lang,\n ...options,\n components: {\n pre: DefaultPre,\n ...options?.components,\n },\n } satisfies HighlightOptions;\n\n const children = (\n <PropsContext value={codeblock}>\n <Internal id={id} {...useDeferredValue({ code, options: shikiOptions })} />\n </PropsContext>\n );\n\n if (wrapInSuspense)\n return (\n <Suspense fallback={<Placeholder code={code} components={shikiOptions.components} />}>\n {children}\n </Suspense>\n );\n\n return children;\n}\n\nfunction Placeholder({\n code,\n components = {},\n}: {\n code: string;\n components: HighlightOptions['components'];\n}) {\n const { pre: Pre = 'pre', code: Code = 'code' } = components as Record<string, FC>;\n\n return (\n <Pre>\n <Code>\n {code.split('\\n').map((line, i) => (\n <span key={i} className=\"line\">\n {line}\n </span>\n ))}\n </Code>\n </Pre>\n );\n}\n\nfunction Internal({ id, code, options }: { id: string; code: string; options: HighlightOptions }) {\n return useShiki(code, options, [id, options.lang, code]);\n}\n"],"mappings":";;;;;;;;;AAqCA,MAAM,eAAe,cAA0C,OAAU;AAEzE,SAAS,WAAW,OAA8B;CAChD,MAAM,aAAa,IAAI,aAAa;AAEpC,QACE,oBAAC;EACC,GAAI;EACJ,GAAI;EACJ,WAAW,GAAG,QAAQ,MAAM,WAAW,YAAY,UAAU;YAE7D,oBAAC,iBAAK,MAAM,WAAe;GACjB;;AAIhB,SAAgB,iBAAiB,EAC/B,MACA,MACA,WACA,SACA,iBAAiB,QACO;CACxB,MAAM,KAAK,OAAO;CAClB,MAAM,eAAe;EACnB;EACA,GAAG;EACH,YAAY;GACV,KAAK;GACL,GAAG,SAAS;GACb;EACF;CAED,MAAM,WACJ,oBAAC;EAAa,OAAO;YACnB,oBAAC;GAAa;GAAI,GAAI,iBAAiB;IAAE;IAAM,SAAS;IAAc,CAAC;IAAI;GAC9D;AAGjB,KAAI,eACF,QACE,oBAAC;EAAS,UAAU,oBAAC;GAAkB;GAAM,YAAY,aAAa;IAAc;EACjF;GACQ;AAGf,QAAO;;AAGT,SAAS,YAAY,EACnB,MACA,aAAa,EAAE,IAId;CACD,MAAM,EAAE,KAAKA,QAAM,OAAO,MAAM,OAAO,WAAW;AAElD,QACE,oBAACA,mBACC,oBAAC,kBACE,KAAK,MAAM,KAAK,CAAC,KAAK,MAAM,MAC3B,oBAAC;EAAa,WAAU;YACrB;IADQ,EAEJ,CACP,GACG,GACH;;AAIV,SAAS,SAAS,EAAE,IAAI,MAAM,WAAoE;AAChG,QAAO,SAAS,MAAM,SAAS;EAAC;EAAI,QAAQ;EAAM;EAAK,CAAC"}
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/files.d.ts
|
|
4
|
+
declare function Files({
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}: HTMLAttributes<HTMLDivElement>): React.ReactElement;
|
|
8
|
+
interface FileProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
name: string;
|
|
10
|
+
icon?: ReactNode;
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
interface FolderProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
name: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Open folder by default
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue false
|
|
19
|
+
*/
|
|
20
|
+
defaultOpen?: boolean;
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
declare function File({
|
|
23
|
+
name,
|
|
24
|
+
icon,
|
|
25
|
+
className,
|
|
26
|
+
...rest
|
|
27
|
+
}: FileProps): React.ReactElement;
|
|
28
|
+
declare function Folder({
|
|
29
|
+
name,
|
|
30
|
+
defaultOpen,
|
|
31
|
+
...props
|
|
32
|
+
}: FolderProps): React.ReactElement;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { File, FileProps, Files, Folder, FolderProps };
|
|
19
35
|
//# sourceMappingURL=files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","
|
|
1
|
+
{"version":3,"file":"files.d.ts","names":[],"sources":["../../src/components/files.tsx"],"sourcesContent":[],"mappings":";;;iBAYgB,KAAA;;;GAA+B,eAAe,kBAAkB,KAAA,CAAM;UAQrE,SAAA,SAAkB,eAAe;EARlC,IAAA,EAAA,MAAK;EAAG,IAAA,CAAA,EAUf,SAVe;;AAAuB,UAa9B,WAAA,SAAoB,cAbU,CAaK,cAbL,CAAA,CAAA;EAAiC,IAAM,EAAA,MAAA;EAAY,QAAA,CAAA,EAAA,OAAA;EAQjF;;;;;EAKA,WAAA,CAAA,EAAY,OAAA;AAa7B;AACE,iBADc,IAAA,CACd;EAAA,IAAA;EAAA,IAAA;EAAA,SAAA;EAAA,GAAA;AAAA,CAAA,EAIC,SAJD,CAAA,EAIa,KAAA,CAAM,YAJnB;AACA,iBAYc,MAAA,CAZd;EAAA,IAAA;EAAA,WAAA;EAAA,GAAA;AAAA,CAAA,EAY8D,WAZ9D,CAAA,EAY4E,KAAA,CAAM,YAZlF"}
|
package/dist/components/files.js
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
|
|
3
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
4
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { File as File$1, Folder as Folder$1, FolderOpen } from "lucide-react";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
|
|
10
|
+
//#region src/components/files.tsx
|
|
11
|
+
const itemVariants = cva("flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4");
|
|
12
|
+
function Files({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
className: cn("not-prose rounded-md border bg-fd-card p-2", className),
|
|
15
|
+
...props,
|
|
16
|
+
children: props.children
|
|
17
|
+
});
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
function File({ name, icon = /* @__PURE__ */ jsx(File$1, {}), className, ...rest }) {
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: cn(itemVariants({ className })),
|
|
22
|
+
...rest,
|
|
23
|
+
children: [icon, name]
|
|
24
|
+
});
|
|
14
25
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
function Folder({ name, defaultOpen = false, ...props }) {
|
|
27
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
29
|
+
open,
|
|
30
|
+
onOpenChange: setOpen,
|
|
31
|
+
...props,
|
|
32
|
+
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
33
|
+
className: cn(itemVariants({ className: "w-full" })),
|
|
34
|
+
children: [open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(Folder$1, {}), name]
|
|
35
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
|
|
36
|
+
className: "ms-2 flex flex-col border-l ps-2",
|
|
37
|
+
children: props.children
|
|
38
|
+
}) })]
|
|
39
|
+
});
|
|
18
40
|
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { File, Files, Folder };
|
|
44
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","names":["FileIcon","FolderIcon"],"sources":["../../src/components/files.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { File as FileIcon, Folder as FolderIcon, FolderOpen } from 'lucide-react';\nimport { type HTMLAttributes, type ReactNode, useState } from 'react';\nimport { cn } from '@fumadocs/ui/cn';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/collapsible';\n\nconst itemVariants = cva(\n 'flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4',\n);\n\nexport function Files({ className, ...props }: HTMLAttributes<HTMLDivElement>): React.ReactElement {\n return (\n <div className={cn('not-prose rounded-md border bg-fd-card p-2', className)} {...props}>\n {props.children}\n </div>\n );\n}\n\nexport interface FileProps extends HTMLAttributes<HTMLDivElement> {\n name: string;\n icon?: ReactNode;\n}\n\nexport interface FolderProps extends HTMLAttributes<HTMLDivElement> {\n name: string;\n\n disabled?: boolean;\n\n /**\n * Open folder by default\n *\n * @defaultValue false\n */\n defaultOpen?: boolean;\n}\n\nexport function File({\n name,\n icon = <FileIcon />,\n className,\n ...rest\n}: FileProps): React.ReactElement {\n return (\n <div className={cn(itemVariants({ className }))} {...rest}>\n {icon}\n {name}\n </div>\n );\n}\n\nexport function Folder({ name, defaultOpen = false, ...props }: FolderProps): React.ReactElement {\n const [open, setOpen] = useState(defaultOpen);\n\n return (\n <Collapsible open={open} onOpenChange={setOpen} {...props}>\n <CollapsibleTrigger className={cn(itemVariants({ className: 'w-full' }))}>\n {open ? <FolderOpen /> : <FolderIcon />}\n {name}\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"ms-2 flex flex-col border-l ps-2\">{props.children}</div>\n </CollapsibleContent>\n </Collapsible>\n );\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAM,eAAe,IACnB,oIACD;AAED,SAAgB,MAAM,EAAE,WAAW,GAAG,SAA6D;AACjG,QACE,oBAAC;EAAI,WAAW,GAAG,8CAA8C,UAAU;EAAE,GAAI;YAC9E,MAAM;GACH;;AAsBV,SAAgB,KAAK,EACnB,MACA,OAAO,oBAACA,WAAW,EACnB,WACA,GAAG,QAC6B;AAChC,QACE,qBAAC;EAAI,WAAW,GAAG,aAAa,EAAE,WAAW,CAAC,CAAC;EAAE,GAAI;aAClD,MACA;GACG;;AAIV,SAAgB,OAAO,EAAE,MAAM,cAAc,OAAO,GAAG,SAA0C;CAC/F,MAAM,CAAC,MAAM,WAAW,SAAS,YAAY;AAE7C,QACE,qBAAC;EAAkB;EAAM,cAAc;EAAS,GAAI;aAClD,qBAAC;GAAmB,WAAW,GAAG,aAAa,EAAE,WAAW,UAAU,CAAC,CAAC;cACrE,OAAO,oBAAC,eAAa,GAAG,oBAACC,aAAa,EACtC;IACkB,EACrB,oBAAC,gCACC,oBAAC;GAAI,WAAU;aAAoC,MAAM;IAAe,GACrD;GACT"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as react_jsx_runtime41 from "react/jsx-runtime";
|
|
2
|
+
import { AnchorHTMLAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/github-info.d.ts
|
|
5
|
+
declare function GithubInfo({
|
|
6
|
+
repo,
|
|
7
|
+
owner,
|
|
8
|
+
token,
|
|
9
|
+
baseUrl,
|
|
10
|
+
...props
|
|
11
|
+
}: AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
12
|
+
owner: string;
|
|
13
|
+
repo: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
}): Promise<react_jsx_runtime41.JSX.Element>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GithubInfo };
|
|
8
19
|
//# sourceMappingURL=github-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-info.d.ts","
|
|
1
|
+
{"version":3,"file":"github-info.d.ts","names":[],"sources":["../../src/components/github-info.tsx"],"sourcesContent":[],"mappings":";;;;iBAwCsB,UAAA;;;;;;GAMnB,qBAAqB;;;EANF,KAAA,CAAA,EAAA,MAAU;EAC9B,OAAA,CAAA,EAAA,MAAA;CACA,CAAA,EASD,OATC,CASD,mBAAA,CAAA,GAAA,CAAA,OAAA,CATC"}
|
|
@@ -1,53 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Star } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
stars: data.stargazers_count,
|
|
24
|
-
forks: data.forks_count,
|
|
25
|
-
};
|
|
1
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Star } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/github-info.tsx
|
|
6
|
+
async function getRepoStarsAndForks(owner, repo, token, baseUrl = "https://api.github.com") {
|
|
7
|
+
const endpoint = `${baseUrl}/repos/${owner}/${repo}`;
|
|
8
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
9
|
+
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
10
|
+
const response = await fetch(endpoint, {
|
|
11
|
+
headers,
|
|
12
|
+
next: { revalidate: 60 }
|
|
13
|
+
});
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
const message = await response.text();
|
|
16
|
+
throw new Error(`Failed to fetch repository data: ${message}`);
|
|
17
|
+
}
|
|
18
|
+
const data = await response.json();
|
|
19
|
+
return {
|
|
20
|
+
stars: data.stargazers_count,
|
|
21
|
+
forks: data.forks_count
|
|
22
|
+
};
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
async function GithubInfo({ repo, owner, token, baseUrl, ...props }) {
|
|
25
|
+
const { stars } = await getRepoStarsAndForks(owner, repo, token, baseUrl);
|
|
26
|
+
const humanizedStars = humanizeNumber(stars);
|
|
27
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
28
|
+
href: `https://github.com/${owner}/${repo}`,
|
|
29
|
+
rel: "noreferrer noopener",
|
|
30
|
+
target: "_blank",
|
|
31
|
+
...props,
|
|
32
|
+
className: cn("flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors lg:flex-row lg:items-center hover:text-fd-accent-foreground hover:bg-fd-accent", props.className),
|
|
33
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
34
|
+
className: "flex items-center gap-2 truncate",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
37
|
+
fill: "currentColor",
|
|
38
|
+
viewBox: "0 0 24 24",
|
|
39
|
+
className: "size-3.5",
|
|
40
|
+
children: [/* @__PURE__ */ jsx("title", { children: "GitHub" }), /* @__PURE__ */ jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })]
|
|
41
|
+
}),
|
|
42
|
+
owner,
|
|
43
|
+
"/",
|
|
44
|
+
repo
|
|
45
|
+
]
|
|
46
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
47
|
+
className: "flex text-xs items-center gap-1 text-fd-muted-foreground",
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Star, { className: "size-3" }), humanizedStars]
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
31
51
|
}
|
|
32
52
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
* Converts a number to a human-readable string with K suffix for thousands
|
|
54
|
+
* @example 1500 -> "1.5K", 1000000 -> "1000000"
|
|
55
|
+
*/
|
|
36
56
|
function humanizeNumber(num) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const formattedValue = value.endsWith('.0') ? value.slice(0, -2) : value;
|
|
45
|
-
return `${formattedValue}K`;
|
|
46
|
-
}
|
|
47
|
-
if (num < 1000000) {
|
|
48
|
-
// For numbers between 10,000 and 999,999, show as whole K (e.g., 10K, 999K)
|
|
49
|
-
return `${Math.floor(num / 1000)}K`;
|
|
50
|
-
}
|
|
51
|
-
// For 1,000,000 and above, just return the number
|
|
52
|
-
return num.toString();
|
|
57
|
+
if (num < 1e3) return num.toString();
|
|
58
|
+
if (num < 1e5) {
|
|
59
|
+
const value = (num / 1e3).toFixed(1);
|
|
60
|
+
return `${value.endsWith(".0") ? value.slice(0, -2) : value}K`;
|
|
61
|
+
}
|
|
62
|
+
if (num < 1e6) return `${Math.floor(num / 1e3)}K`;
|
|
63
|
+
return num.toString();
|
|
53
64
|
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { GithubInfo };
|
|
68
|
+
//# sourceMappingURL=github-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-info.js","names":[],"sources":["../../src/components/github-info.tsx"],"sourcesContent":["import { cn } from '@fumadocs/ui/cn';\nimport { Star } from 'lucide-react';\nimport { type AnchorHTMLAttributes } from 'react';\n\nasync function getRepoStarsAndForks(\n owner: string,\n repo: string,\n token?: string,\n baseUrl: string = 'https://api.github.com',\n): Promise<{\n stars: number;\n forks: number;\n}> {\n const endpoint = `${baseUrl}/repos/${owner}/${repo}`;\n const headers = new Headers({\n 'Content-Type': 'application/json',\n });\n\n if (token) headers.set('Authorization', `Bearer ${token}`);\n\n const response = await fetch(endpoint, {\n headers,\n next: {\n revalidate: 60,\n },\n } as RequestInit);\n\n if (!response.ok) {\n const message = await response.text();\n\n throw new Error(`Failed to fetch repository data: ${message}`);\n }\n\n const data = await response.json();\n return {\n stars: data.stargazers_count,\n forks: data.forks_count,\n };\n}\n\nexport async function GithubInfo({\n repo,\n owner,\n token,\n baseUrl,\n ...props\n}: AnchorHTMLAttributes<HTMLAnchorElement> & {\n owner: string;\n repo: string;\n token?: string;\n baseUrl?: string;\n}) {\n const { stars } = await getRepoStarsAndForks(owner, repo, token, baseUrl);\n const humanizedStars = humanizeNumber(stars);\n\n return (\n <a\n href={`https://github.com/${owner}/${repo}`}\n rel=\"noreferrer noopener\"\n target=\"_blank\"\n {...props}\n className={cn(\n 'flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors lg:flex-row lg:items-center hover:text-fd-accent-foreground hover:bg-fd-accent',\n props.className,\n )}\n >\n <p className=\"flex items-center gap-2 truncate\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" className=\"size-3.5\">\n <title>GitHub</title>\n <path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\" />\n </svg>\n {owner}/{repo}\n </p>\n <p className=\"flex text-xs items-center gap-1 text-fd-muted-foreground\">\n <Star className=\"size-3\" />\n {humanizedStars}\n </p>\n </a>\n );\n}\n\n/**\n * Converts a number to a human-readable string with K suffix for thousands\n * @example 1500 -> \"1.5K\", 1000000 -> \"1000000\"\n */\nfunction humanizeNumber(num: number): string {\n if (num < 1000) {\n return num.toString();\n }\n\n if (num < 100000) {\n // For numbers between 1,000 and 99,999, show with one decimal (e.g., 1.5K)\n const value = (num / 1000).toFixed(1);\n // Remove trailing .0 if present\n const formattedValue = value.endsWith('.0') ? value.slice(0, -2) : value;\n\n return `${formattedValue}K`;\n }\n\n if (num < 1000000) {\n // For numbers between 10,000 and 999,999, show as whole K (e.g., 10K, 999K)\n return `${Math.floor(num / 1000)}K`;\n }\n\n // For 1,000,000 and above, just return the number\n return num.toString();\n}\n"],"mappings":";;;;;AAIA,eAAe,qBACb,OACA,MACA,OACA,UAAkB,0BAIjB;CACD,MAAM,WAAW,GAAG,QAAQ,SAAS,MAAM,GAAG;CAC9C,MAAM,UAAU,IAAI,QAAQ,EAC1B,gBAAgB,oBACjB,CAAC;AAEF,KAAI,MAAO,SAAQ,IAAI,iBAAiB,UAAU,QAAQ;CAE1D,MAAM,WAAW,MAAM,MAAM,UAAU;EACrC;EACA,MAAM,EACJ,YAAY,IACb;EACF,CAAgB;AAEjB,KAAI,CAAC,SAAS,IAAI;EAChB,MAAM,UAAU,MAAM,SAAS,MAAM;AAErC,QAAM,IAAI,MAAM,oCAAoC,UAAU;;CAGhE,MAAM,OAAO,MAAM,SAAS,MAAM;AAClC,QAAO;EACL,OAAO,KAAK;EACZ,OAAO,KAAK;EACb;;AAGH,eAAsB,WAAW,EAC/B,MACA,OACA,OACA,SACA,GAAG,SAMF;CACD,MAAM,EAAE,UAAU,MAAM,qBAAqB,OAAO,MAAM,OAAO,QAAQ;CACzE,MAAM,iBAAiB,eAAe,MAAM;AAE5C,QACE,qBAAC;EACC,MAAM,sBAAsB,MAAM,GAAG;EACrC,KAAI;EACJ,QAAO;EACP,GAAI;EACJ,WAAW,GACT,uKACA,MAAM,UACP;aAED,qBAAC;GAAE,WAAU;;IACX,qBAAC;KAAI,MAAK;KAAe,SAAQ;KAAY,WAAU;gBACrD,oBAAC,qBAAM,WAAc,EACrB,oBAAC,UAAK,GAAE,6sBAA6sB;MACjtB;IACL;IAAM;IAAE;;IACP,EACJ,qBAAC;GAAE,WAAU;cACX,oBAAC,QAAK,WAAU,WAAW,EAC1B;IACC;GACF;;;;;;AAQR,SAAS,eAAe,KAAqB;AAC3C,KAAI,MAAM,IACR,QAAO,IAAI,UAAU;AAGvB,KAAI,MAAM,KAAQ;EAEhB,MAAM,SAAS,MAAM,KAAM,QAAQ,EAAE;AAIrC,SAAO,GAFgB,MAAM,SAAS,KAAK,GAAG,MAAM,MAAM,GAAG,GAAG,GAAG,MAE1C;;AAG3B,KAAI,MAAM,IAER,QAAO,GAAG,KAAK,MAAM,MAAM,IAAK,CAAC;AAInC,QAAO,IAAI,UAAU"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/heading.d.ts
|
|
2
4
|
type Types = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
3
5
|
type HeadingProps<T extends Types> = Omit<ComponentPropsWithoutRef<T>, 'as'> & {
|
|
4
|
-
|
|
6
|
+
as?: T;
|
|
5
7
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
declare function Heading<T extends Types = 'h1'>({
|
|
9
|
+
as,
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: HeadingProps<T>): React.ReactElement;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Heading };
|
|
8
15
|
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","
|
|
1
|
+
{"version":3,"file":"heading.d.ts","names":[],"sources":["../../src/components/heading.tsx"],"sourcesContent":[],"mappings":";;;KAIK,KAAA;KACA,uBAAuB,SAAS,KAAK,yBAAyB;EAD9D,EAAA,CAAA,EAEE,CAFF;AAAK,CAAA;AACkB,iBAIZ,OAJY,CAAA,UAIM,KAJN,GAAA,IAAA,CAAA,CAAA;EAAA,EAAA;EAAA,SAAA;EAAA,GAAA;AAAA,CAAA,EAQzB,YARyB,CAQZ,CARY,CAAA,CAAA,EAQP,KAAA,CAAM,YARC"}
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Link } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/heading.tsx
|
|
6
|
+
function Heading({ as, className, ...props }) {
|
|
7
|
+
const As = as ?? "h1";
|
|
8
|
+
if (!props.id) return /* @__PURE__ */ jsx(As, {
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
return /* @__PURE__ */ jsxs(As, {
|
|
13
|
+
className: cn("flex scroll-m-28 flex-row items-center gap-2", className),
|
|
14
|
+
...props,
|
|
15
|
+
children: [/* @__PURE__ */ jsx("a", {
|
|
16
|
+
"data-card": "",
|
|
17
|
+
href: `#${props.id}`,
|
|
18
|
+
className: "peer",
|
|
19
|
+
children: props.children
|
|
20
|
+
}), /* @__PURE__ */ jsx(Link, {
|
|
21
|
+
"aria-hidden": true,
|
|
22
|
+
className: "size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
9
25
|
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Heading };
|
|
29
|
+
//# sourceMappingURL=heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.js","names":[],"sources":["../../src/components/heading.tsx"],"sourcesContent":["import { Link } from 'lucide-react';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport { cn } from '@fumadocs/ui/cn';\n\ntype Types = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\ntype HeadingProps<T extends Types> = Omit<ComponentPropsWithoutRef<T>, 'as'> & {\n as?: T;\n};\n\nexport function Heading<T extends Types = 'h1'>({\n as,\n className,\n ...props\n}: HeadingProps<T>): React.ReactElement {\n const As = as ?? 'h1';\n\n if (!props.id) return <As className={className} {...props} />;\n\n return (\n <As className={cn('flex scroll-m-28 flex-row items-center gap-2', className)} {...props}>\n <a data-card=\"\" href={`#${props.id}`} className=\"peer\">\n {props.children}\n </a>\n <Link\n aria-hidden\n className=\"size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100\"\n />\n </As>\n );\n}\n"],"mappings":";;;;;AASA,SAAgB,QAAgC,EAC9C,IACA,WACA,GAAG,SACmC;CACtC,MAAM,KAAK,MAAM;AAEjB,KAAI,CAAC,MAAM,GAAI,QAAO,oBAAC;EAAc;EAAW,GAAI;GAAS;AAE7D,QACE,qBAAC;EAAG,WAAW,GAAG,gDAAgD,UAAU;EAAE,GAAI;aAChF,oBAAC;GAAE,aAAU;GAAG,MAAM,IAAI,MAAM;GAAM,WAAU;aAC7C,MAAM;IACL,EACJ,oBAAC;GACC;GACA,WAAU;IACV;GACC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[data-rmiz] {
|
|
2
|
+
display: block;
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[data-rmiz-ghost] {
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
position: absolute;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[data-rmiz-btn-zoom],
|
|
12
|
+
[data-rmiz-btn-unzoom] {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-rmiz-content='found'] img {
|
|
17
|
+
cursor: zoom-in;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-rmiz-modal][open] {
|
|
21
|
+
width: 100vw /* fallback */;
|
|
22
|
+
width: 100dvw;
|
|
23
|
+
|
|
24
|
+
height: 100vh /* fallback */;
|
|
25
|
+
height: 100dvh;
|
|
26
|
+
|
|
27
|
+
background-color: transparent;
|
|
28
|
+
max-width: none;
|
|
29
|
+
max-height: none;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
position: fixed;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-rmiz-modal]:focus-visible {
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[data-rmiz-modal-overlay] {
|
|
41
|
+
transition: background-color 0.3s;
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[data-rmiz-modal-overlay='visible'] {
|
|
47
|
+
background-color: var(--color-fd-background);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[data-rmiz-modal-overlay='hidden'] {
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[data-rmiz-modal-content] {
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
position: relative;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[data-rmiz-modal]::backdrop {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[data-rmiz-modal-img] {
|
|
65
|
+
cursor: zoom-out;
|
|
66
|
+
image-rendering: high-quality;
|
|
67
|
+
transform-origin: 0 0;
|
|
68
|
+
transition: transform 0.3s;
|
|
69
|
+
position: absolute;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media (prefers-reduced-motion: reduce) {
|
|
73
|
+
[data-rmiz-modal-overlay],
|
|
74
|
+
[data-rmiz-modal-img] {
|
|
75
|
+
transition-duration: 0.01ms !important;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/*# sourceMappingURL=image-zoom-CtfZieBH.css.map*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-zoom-CtfZieBH.css","names":[],"sources":["../../src/components/image-zoom.css"],"sourcesContent":["[data-rmiz] {\n display: block;\n position: relative;\n}\n\n[data-rmiz-ghost] {\n pointer-events: none;\n position: absolute;\n}\n\n[data-rmiz-btn-zoom],\n[data-rmiz-btn-unzoom] {\n display: none;\n}\n\n[data-rmiz-content='found'] img {\n cursor: zoom-in;\n}\n\n[data-rmiz-modal][open] {\n width: 100vw /* fallback */;\n width: 100dvw;\n\n height: 100vh /* fallback */;\n height: 100dvh;\n\n background-color: transparent;\n max-width: none;\n max-height: none;\n margin: 0;\n padding: 0;\n position: fixed;\n overflow: hidden;\n}\n\n[data-rmiz-modal]:focus-visible {\n outline: none;\n}\n\n[data-rmiz-modal-overlay] {\n transition: background-color 0.3s;\n position: absolute;\n inset: 0;\n}\n\n[data-rmiz-modal-overlay='visible'] {\n background-color: var(--color-fd-background);\n}\n\n[data-rmiz-modal-overlay='hidden'] {\n background-color: transparent;\n}\n\n[data-rmiz-modal-content] {\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n[data-rmiz-modal]::backdrop {\n display: none;\n}\n\n[data-rmiz-modal-img] {\n cursor: zoom-out;\n image-rendering: high-quality;\n transform-origin: 0 0;\n transition: transform 0.3s;\n position: absolute;\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-rmiz-modal-overlay],\n [data-rmiz-modal-img] {\n transition-duration: 0.01ms !important;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { ImageProps } from "fumadocs-core/framework";
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
import { UncontrolledProps } from "react-medium-image-zoom";
|
|
5
|
+
|
|
6
|
+
//#region src/components/image-zoom.d.ts
|
|
7
|
+
type ImageZoomProps = ImageProps & {
|
|
8
|
+
/**
|
|
9
|
+
* Image props when zoom in
|
|
10
|
+
*/
|
|
11
|
+
zoomInProps?: ComponentProps<'img'>;
|
|
12
|
+
/**
|
|
13
|
+
* Props for `react-medium-image-zoom`
|
|
14
|
+
*/
|
|
15
|
+
rmiz?: UncontrolledProps;
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
declare function ImageZoom({
|
|
18
|
+
zoomInProps,
|
|
19
|
+
children,
|
|
20
|
+
rmiz,
|
|
21
|
+
...props
|
|
22
|
+
}: ImageZoomProps): react_jsx_runtime3.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ImageZoom, ImageZoomProps };
|
|
16
25
|
//# sourceMappingURL=image-zoom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-zoom.d.ts","
|
|
1
|
+
{"version":3,"file":"image-zoom.d.ts","names":[],"sources":["../../src/components/image-zoom.tsx"],"sourcesContent":[],"mappings":";;;;;;KAOY,cAAA,GAAiB;;AAA7B;;EAIgB,WAAA,CAAA,EAAA,cAAA,CAAA,KAAA,CAAA;EAKP;;AAeT;EAA4B,IAAA,CAAA,EAfnB,iBAemB;CAAa;AAAU,iBAAnC,SAAA,CAAmC;EAAA,WAAA;EAAA,QAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAAkB,cAAlB,CAAA,EAAgC,kBAAA,CAAA,GAAA,CAAA,OAAhC"}
|