@fumadocs/ui 16.4.1 → 16.4.3
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/colors/ocean.css +1 -5
- package/css/colors/vitepress.css +3 -15
- package/dist/cn.d.ts +2 -2
- package/dist/cn.js +3 -1
- package/dist/components/toc/clerk.d.ts +11 -2
- package/dist/components/toc/clerk.d.ts.map +1 -1
- package/dist/components/toc/clerk.js +105 -69
- package/dist/components/toc/clerk.js.map +1 -0
- package/dist/components/toc/default.d.ts +11 -2
- package/dist/components/toc/default.d.ts.map +1 -1
- package/dist/components/toc/default.js +36 -15
- package/dist/components/toc/default.js.map +1 -0
- package/dist/components/toc/index.d.ts +23 -8
- package/dist/components/toc/index.d.ts.map +1 -1
- package/dist/components/toc/index.js +74 -59
- package/dist/components/toc/index.js.map +1 -0
- package/dist/contexts/i18n.d.ts +53 -43
- package/dist/contexts/i18n.d.ts.map +1 -1
- package/dist/contexts/i18n.js +55 -50
- package/dist/contexts/i18n.js.map +1 -0
- package/dist/contexts/search.d.ts +62 -49
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +56 -50
- package/dist/contexts/search.js.map +1 -0
- package/dist/contexts/tree.d.ts +18 -11
- package/dist/contexts/tree.d.ts.map +1 -1
- package/dist/contexts/tree.js +36 -26
- package/dist/contexts/tree.js.map +1 -0
- package/dist/hooks/use-copy-button.d.ts +6 -2
- package/dist/hooks/use-copy-button.d.ts.map +1 -1
- package/dist/hooks/use-copy-button.js +28 -25
- package/dist/hooks/use-copy-button.js.map +1 -0
- package/dist/hooks/use-footer-items.d.ts +7 -2
- package/dist/hooks/use-footer-items.d.ts.map +1 -1
- package/dist/hooks/use-footer-items.js +26 -25
- package/dist/hooks/use-footer-items.js.map +1 -0
- package/dist/hooks/use-is-scroll-top.d.ts +7 -2
- package/dist/hooks/use-is-scroll-top.d.ts.map +1 -1
- package/dist/hooks/use-is-scroll-top.js +23 -16
- package/dist/hooks/use-is-scroll-top.js.map +1 -0
- package/dist/i18n.d.ts +11 -11
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +19 -15
- package/dist/i18n.js.map +1 -0
- package/dist/link-item.d.ts +74 -66
- package/dist/link-item.d.ts.map +1 -1
- package/dist/link-item.js +23 -10
- package/dist/link-item.js.map +1 -0
- package/dist/merge-refs.d.ts +6 -2
- package/dist/merge-refs.d.ts.map +1 -1
- package/dist/merge-refs.js +12 -11
- package/dist/merge-refs.js.map +1 -0
- package/dist/og/next.d.ts +20 -12
- package/dist/og/next.d.ts.map +1 -1
- package/dist/og/next.js +68 -43
- package/dist/og/next.js.map +1 -0
- package/dist/typography/index.d.ts +10 -8
- package/dist/typography/index.d.ts.map +1 -1
- package/dist/typography/index.js +1714 -127
- package/dist/typography/index.js.map +1 -0
- package/dist/typography/styles.d.ts +92 -89
- package/dist/typography/styles.d.ts.map +1 -1
- package/dist/typography/styles.js +337 -423
- package/dist/typography/styles.js.map +1 -0
- package/dist/urls.d.ts +5 -2
- package/dist/urls.d.ts.map +1 -1
- package/dist/urls.js +14 -10
- package/dist/urls.js.map +1 -0
- package/package.json +20 -20
- package/dist/cn.d.ts.map +0 -1
- package/dist/icons.d.ts +0 -50
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js +0 -292
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MouseEventHandler } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-copy-button.d.ts
|
|
4
|
+
declare function useCopyButton(onCopy: () => void | Promise<void>): [checked: boolean, onClick: MouseEventHandler];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { useCopyButton };
|
|
3
7
|
//# sourceMappingURL=use-copy-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-copy-button.d.ts","
|
|
1
|
+
{"version":3,"file":"use-copy-button.d.ts","names":[],"sources":["../../src/hooks/use-copy-button.ts"],"sourcesContent":[],"mappings":";;;iBAGgB,aAAA,sBACO,4CACQ"}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return [checked, onClick];
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-copy-button.ts
|
|
6
|
+
function useCopyButton(onCopy) {
|
|
7
|
+
const [checked, setChecked] = useState(false);
|
|
8
|
+
const callbackRef = useRef(onCopy);
|
|
9
|
+
const timeoutRef = useRef(null);
|
|
10
|
+
callbackRef.current = onCopy;
|
|
11
|
+
const onClick = useCallback(() => {
|
|
12
|
+
if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
|
|
13
|
+
Promise.resolve(callbackRef.current()).then(() => {
|
|
14
|
+
setChecked(true);
|
|
15
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
16
|
+
setChecked(false);
|
|
17
|
+
}, 1500);
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
return () => {
|
|
22
|
+
if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return [checked, onClick];
|
|
27
26
|
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { useCopyButton };
|
|
30
|
+
//# sourceMappingURL=use-copy-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-copy-button.js","names":["onClick: MouseEventHandler"],"sources":["../../src/hooks/use-copy-button.ts"],"sourcesContent":["'use client';\nimport { type MouseEventHandler, useCallback, useEffect, useRef, useState } from 'react';\n\nexport function useCopyButton(\n onCopy: () => void | Promise<void>,\n): [checked: boolean, onClick: MouseEventHandler] {\n const [checked, setChecked] = useState(false);\n const callbackRef = useRef(onCopy);\n const timeoutRef = useRef<number | null>(null);\n\n callbackRef.current = onCopy;\n\n const onClick: MouseEventHandler = useCallback(() => {\n if (timeoutRef.current) window.clearTimeout(timeoutRef.current);\n const res = Promise.resolve(callbackRef.current());\n\n void res.then(() => {\n setChecked(true);\n timeoutRef.current = window.setTimeout(() => {\n setChecked(false);\n }, 1500);\n });\n }, []);\n\n // Avoid updates after being unmounted\n useEffect(() => {\n return () => {\n if (timeoutRef.current) window.clearTimeout(timeoutRef.current);\n };\n }, []);\n\n return [checked, onClick];\n}\n"],"mappings":";;;;;AAGA,SAAgB,cACd,QACgD;CAChD,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAC7C,MAAM,cAAc,OAAO,OAAO;CAClC,MAAM,aAAa,OAAsB,KAAK;AAE9C,aAAY,UAAU;CAEtB,MAAMA,UAA6B,kBAAkB;AACnD,MAAI,WAAW,QAAS,QAAO,aAAa,WAAW,QAAQ;AAG/D,EAFY,QAAQ,QAAQ,YAAY,SAAS,CAAC,CAEzC,WAAW;AAClB,cAAW,KAAK;AAChB,cAAW,UAAU,OAAO,iBAAiB;AAC3C,eAAW,MAAM;MAChB,KAAK;IACR;IACD,EAAE,CAAC;AAGN,iBAAgB;AACd,eAAa;AACX,OAAI,WAAW,QAAS,QAAO,aAAa,WAAW,QAAQ;;IAEhE,EAAE,CAAC;AAEN,QAAO,CAAC,SAAS,QAAQ"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as PageTree from "fumadocs-core/page-tree";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-footer-items.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* @returns a list of page tree items (linear), that you can obtain footer items
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
declare function useFooterItems(): PageTree.Item[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { useFooterItems };
|
|
6
11
|
//# sourceMappingURL=use-footer-items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-footer-items.d.ts","
|
|
1
|
+
{"version":3,"file":"use-footer-items.d.ts","names":[],"sources":["../../src/hooks/use-footer-items.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;iBAAgB,cAAA,CAAA,GAAkB,QAAA,CAAS"}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useTreeContext } from "../contexts/tree.js";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-footer-items.ts
|
|
6
|
+
const footerCache = /* @__PURE__ */ new Map();
|
|
3
7
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
list.push(node);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
for (const child of root.children)
|
|
24
|
-
onNode(child);
|
|
25
|
-
footerCache.set(root.$id, list);
|
|
26
|
-
return list;
|
|
8
|
+
* @returns a list of page tree items (linear), that you can obtain footer items
|
|
9
|
+
*/
|
|
10
|
+
function useFooterItems() {
|
|
11
|
+
const { root } = useTreeContext();
|
|
12
|
+
const cached = footerCache.get(root.$id);
|
|
13
|
+
if (cached) return cached;
|
|
14
|
+
const list = [];
|
|
15
|
+
function onNode(node) {
|
|
16
|
+
if (node.type === "folder") {
|
|
17
|
+
if (node.index) onNode(node.index);
|
|
18
|
+
for (const child of node.children) onNode(child);
|
|
19
|
+
} else if (node.type === "page" && !node.external) list.push(node);
|
|
20
|
+
}
|
|
21
|
+
for (const child of root.children) onNode(child);
|
|
22
|
+
footerCache.set(root.$id, list);
|
|
23
|
+
return list;
|
|
27
24
|
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useFooterItems };
|
|
28
|
+
//# sourceMappingURL=use-footer-items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-footer-items.js","names":["list: PageTree.Item[]"],"sources":["../../src/hooks/use-footer-items.ts"],"sourcesContent":["'use client';\nimport { useTreeContext } from '@/contexts/tree';\nimport type * as PageTree from 'fumadocs-core/page-tree';\n\nconst footerCache = new Map<string, PageTree.Item[]>();\n\n/**\n * @returns a list of page tree items (linear), that you can obtain footer items\n */\nexport function useFooterItems(): PageTree.Item[] {\n const { root } = useTreeContext();\n const cached = footerCache.get(root.$id);\n if (cached) return cached;\n\n const list: PageTree.Item[] = [];\n function onNode(node: PageTree.Node) {\n if (node.type === 'folder') {\n if (node.index) onNode(node.index);\n for (const child of node.children) onNode(child);\n } else if (node.type === 'page' && !node.external) {\n list.push(node);\n }\n }\n\n for (const child of root.children) onNode(child);\n footerCache.set(root.$id, list);\n return list;\n}\n"],"mappings":";;;;;AAIA,MAAM,8BAAc,IAAI,KAA8B;;;;AAKtD,SAAgB,iBAAkC;CAChD,MAAM,EAAE,SAAS,gBAAgB;CACjC,MAAM,SAAS,YAAY,IAAI,KAAK,IAAI;AACxC,KAAI,OAAQ,QAAO;CAEnB,MAAMA,OAAwB,EAAE;CAChC,SAAS,OAAO,MAAqB;AACnC,MAAI,KAAK,SAAS,UAAU;AAC1B,OAAI,KAAK,MAAO,QAAO,KAAK,MAAM;AAClC,QAAK,MAAM,SAAS,KAAK,SAAU,QAAO,MAAM;aACvC,KAAK,SAAS,UAAU,CAAC,KAAK,SACvC,MAAK,KAAK,KAAK;;AAInB,MAAK,MAAM,SAAS,KAAK,SAAU,QAAO,MAAM;AAChD,aAAY,IAAI,KAAK,KAAK,KAAK;AAC/B,QAAO"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/hooks/use-is-scroll-top.d.ts
|
|
2
|
+
declare function useIsScrollTop({
|
|
3
|
+
enabled
|
|
4
|
+
}: {
|
|
5
|
+
enabled?: boolean;
|
|
3
6
|
}): boolean | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useIsScrollTop };
|
|
4
9
|
//# sourceMappingURL=use-is-scroll-top.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-is-scroll-top.d.ts","
|
|
1
|
+
{"version":3,"file":"use-is-scroll-top.d.ts","names":[],"sources":["../../src/hooks/use-is-scroll-top.ts"],"sourcesContent":[],"mappings":";iBAGgB,cAAA;;;EAAA,OAAA,CAAA,EAAA,OAAc"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-is-scroll-top.ts
|
|
6
|
+
function useIsScrollTop({ enabled = true }) {
|
|
7
|
+
const [isTop, setIsTop] = useState();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!enabled) return;
|
|
10
|
+
const listener = () => {
|
|
11
|
+
setIsTop(window.scrollY < 10);
|
|
12
|
+
};
|
|
13
|
+
listener();
|
|
14
|
+
window.addEventListener("scroll", listener);
|
|
15
|
+
return () => {
|
|
16
|
+
window.removeEventListener("scroll", listener);
|
|
17
|
+
};
|
|
18
|
+
}, [enabled]);
|
|
19
|
+
return isTop;
|
|
17
20
|
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useIsScrollTop };
|
|
24
|
+
//# sourceMappingURL=use-is-scroll-top.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-scroll-top.js","names":[],"sources":["../../src/hooks/use-is-scroll-top.ts"],"sourcesContent":["'use client';\nimport { useEffect, useState } from 'react';\n\nexport function useIsScrollTop({ enabled = true }: { enabled?: boolean }) {\n const [isTop, setIsTop] = useState<boolean | undefined>();\n\n useEffect(() => {\n if (!enabled) return;\n\n const listener = () => {\n setIsTop(window.scrollY < 10);\n };\n\n listener();\n window.addEventListener('scroll', listener);\n return () => {\n window.removeEventListener('scroll', listener);\n };\n }, [enabled]);\n\n return isTop;\n}\n"],"mappings":";;;;;AAGA,SAAgB,eAAe,EAAE,UAAU,QAA+B;CACxE,MAAM,CAAC,OAAO,YAAY,UAA+B;AAEzD,iBAAgB;AACd,MAAI,CAAC,QAAS;EAEd,MAAM,iBAAiB;AACrB,YAAS,OAAO,UAAU,GAAG;;AAG/B,YAAU;AACV,SAAO,iBAAiB,UAAU,SAAS;AAC3C,eAAa;AACX,UAAO,oBAAoB,UAAU,SAAS;;IAE/C,CAAC,QAAQ,CAAC;AAEb,QAAO"}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
import { I18nProviderProps, Translations, defaultTranslations } from "./contexts/i18n.js";
|
|
2
|
+
import { I18nConfig } from "fumadocs-core/i18n";
|
|
3
|
+
|
|
4
|
+
//#region src/i18n.d.ts
|
|
5
|
+
declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, options: {
|
|
6
|
+
translations: { [K in Languages]?: Partial<Translations> & {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
} };
|
|
11
9
|
}): {
|
|
12
|
-
|
|
10
|
+
provider(locale?: string): I18nProviderProps;
|
|
13
11
|
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { type I18nProviderProps, type Translations, defaultTranslations, defineI18nUI };
|
|
14
14
|
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","names":[],"sources":["../src/i18n.tsx"],"sourcesContent":[],"mappings":";;;;AAMgB,iBAAA,YAAY,CAAA,kBAAA,MAAA,CAAA,CAAA,MAAA,EAClB,UADkB,CACP,SADO,CAAA,EAAA,OAAA,EAAA;EACP,YAAA,EAAA,QAGT,SAHF,IAGe,OAHf,CAGuB,YAHvB,CAAA,GAAA;IAGE,WAAA,CAAA,EAAA,MAAA;EAAqB,CAAA,EAAR;CAO8B,CAAA,EAAA;EAAiB,QAAA,CAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAAjB,iBAAiB"}
|
package/dist/i18n.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { defaultTranslations } from "./contexts/i18n.js";
|
|
2
|
+
|
|
3
|
+
//#region src/i18n.tsx
|
|
4
|
+
function defineI18nUI(config, options) {
|
|
5
|
+
const { translations } = options;
|
|
6
|
+
return { provider(locale = config.defaultLanguage) {
|
|
7
|
+
return {
|
|
8
|
+
locale,
|
|
9
|
+
translations: translations[locale],
|
|
10
|
+
locales: config.languages.map((locale$1) => ({
|
|
11
|
+
locale: locale$1,
|
|
12
|
+
name: translations[locale$1]?.displayName ?? locale$1
|
|
13
|
+
}))
|
|
14
|
+
};
|
|
15
|
+
} };
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { defaultTranslations, defineI18nUI };
|
|
20
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["locale"],"sources":["../src/i18n.tsx"],"sourcesContent":["import type { I18nProviderProps, Translations } from '@/contexts/i18n';\nimport type { I18nConfig } from 'fumadocs-core/i18n';\n\nexport type { I18nProviderProps, Translations };\nexport { defaultTranslations } from './contexts/i18n';\n\nexport function defineI18nUI<Languages extends string>(\n config: I18nConfig<Languages>,\n options: {\n translations: {\n [K in Languages]?: Partial<Translations> & { displayName?: string };\n };\n },\n) {\n const { translations } = options;\n\n return {\n provider(locale: string = config.defaultLanguage): I18nProviderProps {\n return {\n locale,\n translations: translations[locale as Languages],\n locales: config.languages.map((locale) => ({\n locale,\n name: translations[locale]?.displayName ?? locale,\n })),\n };\n },\n };\n}\n"],"mappings":";;;AAMA,SAAgB,aACd,QACA,SAKA;CACA,MAAM,EAAE,iBAAiB;AAEzB,QAAO,EACL,SAAS,SAAiB,OAAO,iBAAoC;AACnE,SAAO;GACL;GACA,cAAc,aAAa;GAC3B,SAAS,OAAO,UAAU,KAAK,cAAY;IACzC;IACA,MAAM,aAAaA,WAAS,eAAeA;IAC5C,EAAE;GACJ;IAEJ"}
|
package/dist/link-item.d.ts
CHANGED
|
@@ -1,78 +1,86 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/link-item.d.ts
|
|
2
5
|
interface Filterable {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Restrict where the item is displayed
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue 'all'
|
|
10
|
+
*/
|
|
11
|
+
on?: 'menu' | 'nav' | 'all';
|
|
9
12
|
}
|
|
10
13
|
interface WithHref {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
url: string;
|
|
15
|
+
/**
|
|
16
|
+
* When the item is marked as active
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue 'url'
|
|
19
|
+
*/
|
|
20
|
+
active?: 'url' | 'nested-url' | 'none';
|
|
21
|
+
external?: boolean;
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
interface MainItemType extends WithHref, Filterable {
|
|
24
|
+
type?: 'main';
|
|
25
|
+
icon?: ReactNode;
|
|
26
|
+
text: ReactNode;
|
|
27
|
+
description?: ReactNode;
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
interface IconItemType extends WithHref, Filterable {
|
|
30
|
+
type: 'icon';
|
|
31
|
+
/**
|
|
32
|
+
* `aria-label` of icon button
|
|
33
|
+
*/
|
|
34
|
+
label?: string;
|
|
35
|
+
icon: ReactNode;
|
|
36
|
+
text: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* @defaultValue true
|
|
39
|
+
*/
|
|
40
|
+
secondary?: boolean;
|
|
38
41
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
interface ButtonItemType extends WithHref, Filterable {
|
|
43
|
+
type: 'button';
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
text: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* @defaultValue false
|
|
48
|
+
*/
|
|
49
|
+
secondary?: boolean;
|
|
47
50
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Options when displayed on navigation menu
|
|
55
|
-
*/
|
|
56
|
-
menu?: ComponentProps<'a'> & {
|
|
57
|
-
banner?: ReactNode;
|
|
58
|
-
};
|
|
59
|
-
}) | CustomItemType)[];
|
|
51
|
+
interface MenuItemType extends Partial<WithHref>, Filterable {
|
|
52
|
+
type: 'menu';
|
|
53
|
+
icon?: ReactNode;
|
|
54
|
+
text: ReactNode;
|
|
55
|
+
items: ((MainItemType & {
|
|
60
56
|
/**
|
|
61
|
-
*
|
|
57
|
+
* Options when displayed on navigation menu
|
|
62
58
|
*/
|
|
63
|
-
|
|
59
|
+
menu?: ComponentProps<'a'> & {
|
|
60
|
+
banner?: ReactNode;
|
|
61
|
+
};
|
|
62
|
+
}) | CustomItemType)[];
|
|
63
|
+
/**
|
|
64
|
+
* @defaultValue false
|
|
65
|
+
*/
|
|
66
|
+
secondary?: boolean;
|
|
64
67
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
interface CustomItemType extends Filterable {
|
|
69
|
+
type: 'custom';
|
|
70
|
+
/**
|
|
71
|
+
* @defaultValue false
|
|
72
|
+
*/
|
|
73
|
+
secondary?: boolean;
|
|
74
|
+
children: ReactNode;
|
|
72
75
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType;
|
|
77
|
+
declare function LinkItem({
|
|
78
|
+
ref,
|
|
79
|
+
item,
|
|
80
|
+
...props
|
|
81
|
+
}: Omit<ComponentProps<'a'>, 'href'> & {
|
|
82
|
+
item: WithHref;
|
|
83
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { ButtonItemType, CustomItemType, IconItemType, LinkItem, LinkItemType, MainItemType, MenuItemType };
|
|
78
86
|
//# sourceMappingURL=link-item.d.ts.map
|
package/dist/link-item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-item.d.ts","
|
|
1
|
+
{"version":3,"file":"link-item.d.ts","names":[],"sources":["../src/link-item.tsx"],"sourcesContent":[],"mappings":";;;;UAMU,UAAA;;;AAL6C;AAKnC;AAoBpB;EAES,EAAA,CAAA,EAAA,MAAA,GAAA,KAAA,GAAA,KAAA;;UAbC,QAAA,CAeM;EAJsB,GAAA,EAAA,MAAA;EAAU;;AAOhD;;;EAAsC,MAAA,CAAA,EAAA,KAAA,GAAA,YAAA,GAAA,MAAA;EAAU,QAAA,CAAA,EAAA,OAAA;;AAc/B,UArBA,YAAA,SAAqB,QAqBN,EArBgB,UAqBhB,CAAA;EAEvB,IAAA,CAAA,EAAA,MAAA;EACD,IAAA,CAAA,EAtBC,SAsBD;EAHgC,IAAA,EAlBhC,SAkBgC;EAAU,WAAA,CAAA,EAjBlC,SAiBkC;;AAUjC,UAxBA,YAAA,SAAqB,QAwBR,EAxBkB,UAwBlB,CAAA;EAAgB,IAAA,EAAA,MAAA;EAErC;;;EAQM,KAAA,CAAA,EAAA,MAAA;EACI,IAAA,EA7BX,SA6BW;EAGb,IAAA,EA/BE,SA+BF;EAdgC;;;EAuBrB,SAAA,CAAA,EAAA,OAAe;AAShC;AACI,UA3Ca,cAAA,SAAuB,QA2CpC,EA3C8C,UA2C9C,CAAA;EACA,IAAA,EAAA,QAAA;EACA,IAAA,CAAA,EA3CK,SA2CL;EACA,IAAA,EA3CI,SA2CJ;EACA;;AAEJ;EACE,SAAA,CAAA,EAAA,OAAA;;AAGM,UA3CS,YAAA,SAAqB,OA2C9B,CA3CsC,QA2CtC,CAAA,EA3CiD,UA2CjD,CAAA;EAAL,IAAA,EAAA,MAAA;EAA4C,IAAA,CAAA,EAzCtC,SAyCsC;EAAU,IAAA,EAxCjD,SAwCiD;EAAA,KAAA,EAAA,CAAA,CArClD,YAqCkD,GAAA;;;;WAjC1C;eACI;;OAGb;;;;;;UASW,cAAA,SAAuB;;;;;;YAM5B;;KAGA,YAAA,GACR,eACA,eACA,iBACA,eACA;iBAEY,QAAA;;;;GAIb,KAAK;QAAuC;IAAU,kBAAA,CAAA,GAAA,CAAA"}
|
package/dist/link-item.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
|
|
3
|
+
import { isActive } from "./urls.js";
|
|
4
|
+
import { usePathname } from "fumadocs-core/framework";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import Link from "fumadocs-core/link";
|
|
7
|
+
|
|
8
|
+
//#region src/link-item.tsx
|
|
9
|
+
function LinkItem({ ref, item, ...props }) {
|
|
10
|
+
const pathname = usePathname();
|
|
11
|
+
const activeType = item.active ?? "url";
|
|
12
|
+
const active = activeType !== "none" && isActive(item.url, pathname, activeType === "nested-url");
|
|
13
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
14
|
+
ref,
|
|
15
|
+
href: item.url,
|
|
16
|
+
external: item.external,
|
|
17
|
+
...props,
|
|
18
|
+
"data-active": active,
|
|
19
|
+
children: props.children
|
|
20
|
+
});
|
|
12
21
|
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { LinkItem };
|
|
25
|
+
//# sourceMappingURL=link-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-item.js","names":[],"sources":["../src/link-item.tsx"],"sourcesContent":["'use client';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { usePathname } from 'fumadocs-core/framework';\nimport { isActive } from '@/urls';\nimport Link from 'fumadocs-core/link';\n\ninterface Filterable {\n /**\n * Restrict where the item is displayed\n *\n * @defaultValue 'all'\n */\n on?: 'menu' | 'nav' | 'all';\n}\n\ninterface WithHref {\n url: string;\n /**\n * When the item is marked as active\n *\n * @defaultValue 'url'\n */\n active?: 'url' | 'nested-url' | 'none';\n external?: boolean;\n}\n\nexport interface MainItemType extends WithHref, Filterable {\n type?: 'main';\n icon?: ReactNode;\n text: ReactNode;\n description?: ReactNode;\n}\n\nexport interface IconItemType extends WithHref, Filterable {\n type: 'icon';\n /**\n * `aria-label` of icon button\n */\n label?: string;\n icon: ReactNode;\n text: ReactNode;\n /**\n * @defaultValue true\n */\n secondary?: boolean;\n}\n\nexport interface ButtonItemType extends WithHref, Filterable {\n type: 'button';\n icon?: ReactNode;\n text: ReactNode;\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n}\n\nexport interface MenuItemType extends Partial<WithHref>, Filterable {\n type: 'menu';\n icon?: ReactNode;\n text: ReactNode;\n\n items: (\n | (MainItemType & {\n /**\n * Options when displayed on navigation menu\n */\n menu?: ComponentProps<'a'> & {\n banner?: ReactNode;\n };\n })\n | CustomItemType\n )[];\n\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n}\n\nexport interface CustomItemType extends Filterable {\n type: 'custom';\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n children: ReactNode;\n}\n\nexport type LinkItemType =\n | MainItemType\n | IconItemType\n | ButtonItemType\n | MenuItemType\n | CustomItemType;\n\nexport function LinkItem({\n ref,\n item,\n ...props\n}: Omit<ComponentProps<'a'>, 'href'> & { item: WithHref }) {\n const pathname = usePathname();\n const activeType = item.active ?? 'url';\n const active = activeType !== 'none' && isActive(item.url, pathname, activeType === 'nested-url');\n\n return (\n <Link ref={ref} href={item.url} external={item.external} {...props} data-active={active}>\n {props.children}\n </Link>\n );\n}\n"],"mappings":";;;;;;;;AAgGA,SAAgB,SAAS,EACvB,KACA,MACA,GAAG,SACsD;CACzD,MAAM,WAAW,aAAa;CAC9B,MAAM,aAAa,KAAK,UAAU;CAClC,MAAM,SAAS,eAAe,UAAU,SAAS,KAAK,KAAK,UAAU,eAAe,aAAa;AAEjG,QACE,oBAAC;EAAU;EAAK,MAAM,KAAK;EAAK,UAAU,KAAK;EAAU,GAAI;EAAO,eAAa;YAC9E,MAAM;GACF"}
|
package/dist/merge-refs.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/merge-refs.d.ts
|
|
4
|
+
declare function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { mergeRefs };
|
|
3
7
|
//# sourceMappingURL=merge-refs.d.ts.map
|
package/dist/merge-refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-refs.d.ts","
|
|
1
|
+
{"version":3,"file":"merge-refs.d.ts","names":[],"sources":["../src/merge-refs.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,uBAAuB,KAAA,CAAM,IAAI,oBAAoB,KAAA,CAAM,YAAY"}
|
package/dist/merge-refs.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
};
|
|
1
|
+
//#region src/merge-refs.ts
|
|
2
|
+
function mergeRefs(...refs) {
|
|
3
|
+
return (value) => {
|
|
4
|
+
refs.forEach((ref) => {
|
|
5
|
+
if (typeof ref === "function") ref(value);
|
|
6
|
+
else if (ref) ref.current = value;
|
|
7
|
+
});
|
|
8
|
+
};
|
|
12
9
|
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { mergeRefs };
|
|
13
|
+
//# sourceMappingURL=merge-refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-refs.js","names":[],"sources":["../src/merge-refs.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n });\n };\n}\n"],"mappings":";AAEA,SAAgB,UAAa,GAAG,MAA0D;AACxF,SAAQ,UAAU;AAChB,OAAK,SAAS,QAAQ;AACpB,OAAI,OAAO,QAAQ,WACjB,KAAI,MAAM;YACD,IACT,KAAI,UAAU;IAEhB"}
|
package/dist/og/next.d.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
|
+
import { ImageResponse } from "next/og";
|
|
4
|
+
import { ImageResponseOptions } from "next/dist/compiled/@vercel/og/types";
|
|
5
|
+
|
|
6
|
+
//#region src/og/next.d.ts
|
|
4
7
|
interface GenerateProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
primaryColor?: string;
|
|
12
|
+
primaryTextColor?: string;
|
|
13
|
+
site?: ReactNode;
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
declare function generateOGImage(options: GenerateProps & ImageResponseOptions): ImageResponse;
|
|
16
|
+
declare function generate({
|
|
17
|
+
primaryColor,
|
|
18
|
+
primaryTextColor,
|
|
19
|
+
...props
|
|
20
|
+
}: GenerateProps): react_jsx_runtime3.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { generate, generateOGImage };
|
|
15
23
|
//# sourceMappingURL=next.d.ts.map
|
package/dist/og/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","
|
|
1
|
+
{"version":3,"file":"next.d.ts","names":[],"sources":["../../src/og/next.tsx"],"sourcesContent":[],"mappings":";;;;;;UAIU,aAAA;SACD;gBACO;EAFN,IAAA,CAAA,EAGD,SAHc;EACd,YAAA,CAAA,EAAA,MAAA;EACO,gBAAA,CAAA,EAAA,MAAA;EACP,IAAA,CAAA,EAGA,SAHA;;AAGS,iBAGF,eAAA,CAHE,OAAA,EAGuB,aAHvB,GAGuC,oBAHvC,CAAA,EAG8D,aAH9D;AAGF,iBAoBA,QAAA,CApBe;EAAA,YAAA;EAAA,gBAAA;EAAA,GAAA;AAAA,CAAA,EAwB5B,aAxB4B,CAAA,EAwBf,kBAAA,CAAA,GAAA,CAAA,OAxBe"}
|