@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.
Files changed (73) hide show
  1. package/css/colors/ocean.css +1 -5
  2. package/css/colors/vitepress.css +3 -15
  3. package/dist/cn.d.ts +2 -2
  4. package/dist/cn.js +3 -1
  5. package/dist/components/toc/clerk.d.ts +11 -2
  6. package/dist/components/toc/clerk.d.ts.map +1 -1
  7. package/dist/components/toc/clerk.js +105 -69
  8. package/dist/components/toc/clerk.js.map +1 -0
  9. package/dist/components/toc/default.d.ts +11 -2
  10. package/dist/components/toc/default.d.ts.map +1 -1
  11. package/dist/components/toc/default.js +36 -15
  12. package/dist/components/toc/default.js.map +1 -0
  13. package/dist/components/toc/index.d.ts +23 -8
  14. package/dist/components/toc/index.d.ts.map +1 -1
  15. package/dist/components/toc/index.js +74 -59
  16. package/dist/components/toc/index.js.map +1 -0
  17. package/dist/contexts/i18n.d.ts +53 -43
  18. package/dist/contexts/i18n.d.ts.map +1 -1
  19. package/dist/contexts/i18n.js +55 -50
  20. package/dist/contexts/i18n.js.map +1 -0
  21. package/dist/contexts/search.d.ts +62 -49
  22. package/dist/contexts/search.d.ts.map +1 -1
  23. package/dist/contexts/search.js +56 -50
  24. package/dist/contexts/search.js.map +1 -0
  25. package/dist/contexts/tree.d.ts +18 -11
  26. package/dist/contexts/tree.d.ts.map +1 -1
  27. package/dist/contexts/tree.js +36 -26
  28. package/dist/contexts/tree.js.map +1 -0
  29. package/dist/hooks/use-copy-button.d.ts +6 -2
  30. package/dist/hooks/use-copy-button.d.ts.map +1 -1
  31. package/dist/hooks/use-copy-button.js +28 -25
  32. package/dist/hooks/use-copy-button.js.map +1 -0
  33. package/dist/hooks/use-footer-items.d.ts +7 -2
  34. package/dist/hooks/use-footer-items.d.ts.map +1 -1
  35. package/dist/hooks/use-footer-items.js +26 -25
  36. package/dist/hooks/use-footer-items.js.map +1 -0
  37. package/dist/hooks/use-is-scroll-top.d.ts +7 -2
  38. package/dist/hooks/use-is-scroll-top.d.ts.map +1 -1
  39. package/dist/hooks/use-is-scroll-top.js +23 -16
  40. package/dist/hooks/use-is-scroll-top.js.map +1 -0
  41. package/dist/i18n.d.ts +11 -11
  42. package/dist/i18n.d.ts.map +1 -1
  43. package/dist/i18n.js +19 -15
  44. package/dist/i18n.js.map +1 -0
  45. package/dist/link-item.d.ts +74 -66
  46. package/dist/link-item.d.ts.map +1 -1
  47. package/dist/link-item.js +23 -10
  48. package/dist/link-item.js.map +1 -0
  49. package/dist/merge-refs.d.ts +6 -2
  50. package/dist/merge-refs.d.ts.map +1 -1
  51. package/dist/merge-refs.js +12 -11
  52. package/dist/merge-refs.js.map +1 -0
  53. package/dist/og/next.d.ts +20 -12
  54. package/dist/og/next.d.ts.map +1 -1
  55. package/dist/og/next.js +68 -43
  56. package/dist/og/next.js.map +1 -0
  57. package/dist/typography/index.d.ts +10 -8
  58. package/dist/typography/index.d.ts.map +1 -1
  59. package/dist/typography/index.js +1714 -127
  60. package/dist/typography/index.js.map +1 -0
  61. package/dist/typography/styles.d.ts +92 -89
  62. package/dist/typography/styles.d.ts.map +1 -1
  63. package/dist/typography/styles.js +337 -423
  64. package/dist/typography/styles.js.map +1 -0
  65. package/dist/urls.d.ts +5 -2
  66. package/dist/urls.d.ts.map +1 -1
  67. package/dist/urls.js +14 -10
  68. package/dist/urls.js.map +1 -0
  69. package/package.json +20 -20
  70. package/dist/cn.d.ts.map +0 -1
  71. package/dist/icons.d.ts +0 -50
  72. package/dist/icons.d.ts.map +0 -1
  73. package/dist/icons.js +0 -292
@@ -1,3 +1,7 @@
1
- import { type MouseEventHandler } from 'react';
2
- export declare function useCopyButton(onCopy: () => void | Promise<void>): [checked: boolean, onClick: MouseEventHandler];
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","sourceRoot":"","sources":["../../src/hooks/use-copy-button.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CA2BhD"}
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
- import { useCallback, useEffect, useRef, useState, } from 'react';
3
- export function useCopyButton(onCopy) {
4
- const [checked, setChecked] = useState(false);
5
- const callbackRef = useRef(onCopy);
6
- const timeoutRef = useRef(null);
7
- callbackRef.current = onCopy;
8
- const onClick = useCallback(() => {
9
- if (timeoutRef.current)
10
- window.clearTimeout(timeoutRef.current);
11
- const res = Promise.resolve(callbackRef.current());
12
- void res.then(() => {
13
- setChecked(true);
14
- timeoutRef.current = window.setTimeout(() => {
15
- setChecked(false);
16
- }, 1500);
17
- });
18
- }, []);
19
- // Avoid updates after being unmounted
20
- useEffect(() => {
21
- return () => {
22
- if (timeoutRef.current)
23
- window.clearTimeout(timeoutRef.current);
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 type * as PageTree from 'fumadocs-core/page-tree';
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
- export declare function useFooterItems(): PageTree.Item[];
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","sourceRoot":"","sources":["../../src/hooks/use-footer-items.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAIzD;;GAEG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAAC,IAAI,EAAE,CAkBhD"}
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
- import { useTreeContext } from '../contexts/tree.js';
2
- const footerCache = new Map();
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
- * @returns a list of page tree items (linear), that you can obtain footer items
5
- */
6
- export function useFooterItems() {
7
- const { root } = useTreeContext();
8
- const cached = footerCache.get(root.$id);
9
- if (cached)
10
- return cached;
11
- const list = [];
12
- function onNode(node) {
13
- if (node.type === 'folder') {
14
- if (node.index)
15
- onNode(node.index);
16
- for (const child of node.children)
17
- onNode(child);
18
- }
19
- else if (node.type === 'page' && !node.external) {
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
- export declare function useIsScrollTop({ enabled }: {
2
- enabled?: boolean;
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","sourceRoot":"","sources":["../../src/hooks/use-is-scroll-top.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,EAAE,OAAc,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,uBAkBvE"}
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
- import { useEffect, useState } from 'react';
2
- export function useIsScrollTop({ enabled = true }) {
3
- const [isTop, setIsTop] = useState();
4
- useEffect(() => {
5
- if (!enabled)
6
- return;
7
- const listener = () => {
8
- setIsTop(window.scrollY < 10);
9
- };
10
- listener();
11
- window.addEventListener('scroll', listener);
12
- return () => {
13
- window.removeEventListener('scroll', listener);
14
- };
15
- }, [enabled]);
16
- return isTop;
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 type { I18nProviderProps, Translations } from './contexts/i18n.js';
2
- import type { I18nConfig } from 'fumadocs-core/i18n';
3
- export type { I18nProviderProps, Translations };
4
- export { defaultTranslations } from './contexts/i18n.js';
5
- export declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, options: {
6
- translations: {
7
- [K in Languages]?: Partial<Translations> & {
8
- displayName?: string;
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
- provider(locale?: string): I18nProviderProps;
10
+ provider(locale?: string): I18nProviderProps;
13
11
  };
12
+ //#endregion
13
+ export { type I18nProviderProps, type Translations, defaultTranslations, defineI18nUI };
14
14
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,wBAAgB,YAAY,CAAC,SAAS,SAAS,MAAM,EACnD,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,EAC7B,OAAO,EAAE;IACP,YAAY,EAAE;SACX,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;YAAE,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE;KACpE,CAAC;CACH;sBAKkB,MAAM,GAA4B,iBAAiB;EAWvE"}
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
- export { defaultTranslations } from './contexts/i18n.js';
2
- export function defineI18nUI(config, options) {
3
- const { translations } = options;
4
- return {
5
- provider(locale = config.defaultLanguage) {
6
- return {
7
- locale,
8
- translations: translations[locale],
9
- locales: config.languages.map((locale) => ({
10
- locale,
11
- name: translations[locale]?.displayName ?? locale,
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
@@ -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"}
@@ -1,78 +1,86 @@
1
- import type { ComponentProps, ReactNode } from 'react';
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
- * Restrict where the item is displayed
5
- *
6
- * @defaultValue 'all'
7
- */
8
- on?: 'menu' | 'nav' | 'all';
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
- url: string;
12
- /**
13
- * When the item is marked as active
14
- *
15
- * @defaultValue 'url'
16
- */
17
- active?: 'url' | 'nested-url' | 'none';
18
- external?: boolean;
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
- export interface MainItemType extends WithHref, Filterable {
21
- type?: 'main';
22
- icon?: ReactNode;
23
- text: ReactNode;
24
- description?: ReactNode;
23
+ interface MainItemType extends WithHref, Filterable {
24
+ type?: 'main';
25
+ icon?: ReactNode;
26
+ text: ReactNode;
27
+ description?: ReactNode;
25
28
  }
26
- export interface IconItemType extends WithHref, Filterable {
27
- type: 'icon';
28
- /**
29
- * `aria-label` of icon button
30
- */
31
- label?: string;
32
- icon: ReactNode;
33
- text: ReactNode;
34
- /**
35
- * @defaultValue true
36
- */
37
- secondary?: boolean;
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
- export interface ButtonItemType extends WithHref, Filterable {
40
- type: 'button';
41
- icon?: ReactNode;
42
- text: ReactNode;
43
- /**
44
- * @defaultValue false
45
- */
46
- secondary?: boolean;
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
- export interface MenuItemType extends Partial<WithHref>, Filterable {
49
- type: 'menu';
50
- icon?: ReactNode;
51
- text: ReactNode;
52
- items: ((MainItemType & {
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
- * @defaultValue false
57
+ * Options when displayed on navigation menu
62
58
  */
63
- secondary?: boolean;
59
+ menu?: ComponentProps<'a'> & {
60
+ banner?: ReactNode;
61
+ };
62
+ }) | CustomItemType)[];
63
+ /**
64
+ * @defaultValue false
65
+ */
66
+ secondary?: boolean;
64
67
  }
65
- export interface CustomItemType extends Filterable {
66
- type: 'custom';
67
- /**
68
- * @defaultValue false
69
- */
70
- secondary?: boolean;
71
- children: ReactNode;
68
+ interface CustomItemType extends Filterable {
69
+ type: 'custom';
70
+ /**
71
+ * @defaultValue false
72
+ */
73
+ secondary?: boolean;
74
+ children: ReactNode;
72
75
  }
73
- export type LinkItemType = MainItemType | IconItemType | ButtonItemType | MenuItemType | CustomItemType;
74
- export declare function LinkItem({ ref, item, ...props }: Omit<ComponentProps<'a'>, 'href'> & {
75
- item: WithHref;
76
- }): import("react/jsx-runtime").JSX.Element;
77
- export {};
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
@@ -1 +1 @@
1
- {"version":3,"file":"link-item.d.ts","sourceRoot":"","sources":["../src/link-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,UAAU,UAAU;IAClB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CAC7B;AAED,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,UAAU;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,UAAU;IACxD,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ,EAAE,UAAU;IAC1D,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAEhB,KAAK,EAAE,CACH,CAAC,YAAY,GAAG;QACd;;WAEG;QACH,IAAI,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG;YAC3B,MAAM,CAAC,EAAE,SAAS,CAAC;SACpB,CAAC;KACH,CAAC,GACF,cAAc,CACjB,EAAE,CAAC;IAEJ;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,cAAc,CAAC;AAEnB,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,2CAkBxD"}
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
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { usePathname } from 'fumadocs-core/framework';
4
- import { isActive } from './urls.js';
5
- import Link from 'fumadocs-core/link';
6
- export function LinkItem({ ref, item, ...props }) {
7
- const pathname = usePathname();
8
- const activeType = item.active ?? 'url';
9
- const active = activeType !== 'none' &&
10
- isActive(item.url, pathname, activeType === 'nested-url');
11
- return (_jsx(Link, { ref: ref, href: item.url, external: item.external, ...props, "data-active": active, children: props.children }));
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"}
@@ -1,3 +1,7 @@
1
- import type * as React from 'react';
2
- export declare function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T>;
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
@@ -1 +1 @@
1
- {"version":3,"file":"merge-refs.d.ts","sourceRoot":"","sources":["../src/merge-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,wBAAgB,SAAS,CAAC,CAAC,EACzB,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,GACpC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAUtB"}
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"}
@@ -1,12 +1,13 @@
1
- export function mergeRefs(...refs) {
2
- return (value) => {
3
- refs.forEach((ref) => {
4
- if (typeof ref === 'function') {
5
- ref(value);
6
- }
7
- else if (ref) {
8
- ref.current = value;
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 { ImageResponse } from 'next/og';
2
- import type { ReactNode } from 'react';
3
- import type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types';
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
- title: ReactNode;
6
- description?: ReactNode;
7
- icon?: ReactNode;
8
- primaryColor?: string;
9
- primaryTextColor?: string;
10
- site?: ReactNode;
8
+ title: ReactNode;
9
+ description?: ReactNode;
10
+ icon?: ReactNode;
11
+ primaryColor?: string;
12
+ primaryTextColor?: string;
13
+ site?: ReactNode;
11
14
  }
12
- export declare function generateOGImage(options: GenerateProps & ImageResponseOptions): ImageResponse;
13
- export declare function generate({ primaryColor, primaryTextColor, ...props }: GenerateProps): import("react/jsx-runtime").JSX.Element;
14
- export {};
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
@@ -1 +1 @@
1
- {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/og/next.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,UAAU,aAAa;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,aAAa,GAAG,oBAAoB,GAC5C,aAAa,CA0Bf;AAED,wBAAgB,QAAQ,CAAC,EACvB,YAAsC,EACtC,gBAAqC,EACrC,GAAG,KAAK,EACT,EAAE,aAAa,2CAqDf"}
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"}