fumadocs-ui 14.5.2 → 14.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAaf,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,KAAK,iBAAiB,GAAG,WAAW,GAClC,gBAAgB,GAChB,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IACjC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAElC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEJ,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAoCnB"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAaf,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,KAAK,iBAAiB,GAAG,WAAW,GAClC,gBAAgB,GAChB,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IACjC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAElC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEJ,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAoCnB"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { FileText, Hash, Loader2, SearchIcon, Text } from 'lucide-react';
4
4
  import { useRouter } from 'next/navigation';
5
- import { useMemo, useEffect, useState, useRef, } from 'react';
5
+ import { useMemo, useEffect, useState, useRef, useCallback, } from 'react';
6
6
  import { useI18n } from '../../contexts/i18n';
7
7
  import { cn } from '../../utils/cn';
8
8
  import { useSearchContext } from '../../contexts/search';
@@ -86,14 +86,11 @@ function LoadingIndicator({ isLoading }) {
86
86
  return (_jsxs("div", { className: "relative size-4", children: [_jsx(Loader2, { className: cn('absolute size-full animate-spin text-fd-primary transition-opacity', !isLoading && 'opacity-0') }), _jsx(SearchIcon, { className: cn('absolute size-full text-fd-muted-foreground transition-opacity', isLoading && 'opacity-0') })] }));
87
87
  }
88
88
  function CommandItem({ active, onActiveChange, value, ...props }) {
89
- const ref = useRef(null);
90
- useEffect(() => {
91
- const element = ref.current;
92
- if (active === value && element) {
93
- element.scrollIntoView({
94
- block: 'nearest',
95
- });
96
- }
97
- }, [active, value]);
98
- return (_jsx("button", { ref: ref, type: "button", "aria-selected": active === value, onPointerMove: () => onActiveChange(value), ...props, className: cn('flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-fd-accent aria-selected:text-fd-accent-foreground', props.className), children: props.children }));
89
+ return (_jsx("button", { ref: useCallback((element) => {
90
+ if (active === value && element) {
91
+ element.scrollIntoView({
92
+ block: 'nearest',
93
+ });
94
+ }
95
+ }, [active, value]), type: "button", "aria-selected": active === value, onPointerMove: () => onActiveChange(value), ...props, className: cn('flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-fd-accent aria-selected:text-fd-accent-foreground', props.className), children: props.children }));
99
96
  }
@@ -2,6 +2,7 @@ import type { HTMLAttributes } from 'react';
2
2
  export interface TagItem {
3
3
  name: string;
4
4
  value: string | undefined;
5
+ props?: HTMLAttributes<HTMLButtonElement>;
5
6
  }
6
7
  export interface TagsListProps extends HTMLAttributes<HTMLDivElement> {
7
8
  tag?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"tag-list.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/tag-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,cAAc,CAAC;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAaD,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,aAAa,2CA0Bf"}
1
+ {"version":3,"file":"tag-list.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/tag-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,KAAK,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,cAAc,CAAC;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAaD,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,aAAa,2CA+Bf"}
@@ -9,12 +9,12 @@ const itemVariants = cva('rounded-md border px-2 py-0.5 text-xs font-medium text
9
9
  },
10
10
  });
11
11
  export function TagsList({ tag, onTagChange, items, allowClear, ...props }) {
12
- return (_jsxs("div", { ...props, className: cn('flex flex-row items-center gap-1', props.className), children: [items.map((item) => (_jsx("button", { type: "button", className: cn(itemVariants({ active: tag === item.value })), onClick: () => {
12
+ return (_jsxs("div", { ...props, className: cn('flex flex-row items-center gap-1', props.className), children: [items.map((item) => (_jsx("button", { type: "button", "data-active": tag === item.value, className: cn(itemVariants({ active: tag === item.value }), item.props?.className), onClick: () => {
13
13
  if (tag === item.value && allowClear) {
14
14
  onTagChange(undefined);
15
15
  }
16
16
  else {
17
17
  onTagChange(item.value);
18
18
  }
19
- }, tabIndex: -1, children: item.name }, item.value))), props.children] }));
19
+ }, tabIndex: -1, ...item.props, children: item.name }, item.value))), props.children] }));
20
20
  }
@@ -1,4 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
+ import type { PageTree } from 'fumadocs-core/server';
2
3
  export interface Option {
3
4
  /**
4
5
  * Redirect URL of the folder, usually the index page
@@ -7,6 +8,10 @@ export interface Option {
7
8
  icon?: ReactNode;
8
9
  title: ReactNode;
9
10
  description?: ReactNode;
11
+ /**
12
+ * Detect from page tree nodes
13
+ */
14
+ folder?: PageTree.Folder;
10
15
  props?: HTMLAttributes<HTMLElement>;
11
16
  }
12
17
  export declare function RootToggle({ options, ...props }: {
@@ -1 +1 @@
1
- {"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ/E,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE;IACD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,iBAAiB,CAAC,2CA+CpC"}
1
+ {"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAO/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC;IAEzB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE;IACD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,iBAAiB,CAAC,2CAqDpC"}
@@ -8,13 +8,17 @@ import { cn } from '../../utils/cn';
8
8
  import { isActive } from '../../utils/is-active';
9
9
  import { useSidebar } from '../../contexts/sidebar';
10
10
  import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
11
+ import { useTreePath } from '../../contexts/tree';
11
12
  export function RootToggle({ options, ...props }) {
12
13
  const [open, setOpen] = useState(false);
13
14
  const { closeOnRedirect } = useSidebar();
14
15
  const pathname = usePathname();
16
+ const path = useTreePath();
15
17
  const selected = useMemo(() => {
16
- return options.find((item) => isActive(item.url, pathname, true));
17
- }, [options, pathname]);
18
+ return options.findLast((item) => item.folder
19
+ ? path.includes(item.folder)
20
+ : isActive(item.url, pathname, true));
21
+ }, [path, options, pathname]);
18
22
  const onClick = () => {
19
23
  closeOnRedirect.current = false;
20
24
  setOpen(false);
@@ -6,7 +6,7 @@ import { buttonVariants } from '../../components/ui/button';
6
6
  import { getSidebarTabs } from '../../utils/get-sidebar-tabs';
7
7
  export function SidebarLinkItem({ item }) {
8
8
  if (item.type === 'menu')
9
- return (_jsxs(SidebarFolder, { level: 1, children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(SidebarLinkItem, { item: child }, i))) })] }));
9
+ return (_jsxs(SidebarFolder, { children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(SidebarLinkItem, { item: child }, i))) })] }));
10
10
  if (item.type === 'button') {
11
11
  return (_jsxs(BaseLinkItem, { item: item, className: cn(buttonVariants({
12
12
  color: 'secondary',
@@ -29,10 +29,9 @@ export declare function SidebarSeparator(props: HTMLAttributes<HTMLParagraphElem
29
29
  export declare function SidebarItem({ icon, ...props }: LinkProps & {
30
30
  icon?: ReactNode;
31
31
  }): import("react/jsx-runtime").JSX.Element;
32
- export declare function SidebarFolder({ level, defaultOpen, ...props }: {
32
+ export declare function SidebarFolder({ defaultOpen, ...props }: {
33
33
  children: ReactNode;
34
34
  defaultOpen?: boolean;
35
- level: number;
36
35
  }): import("react/jsx-runtime").JSX.Element;
37
36
  export declare function SidebarFolderTrigger(props: CollapsibleTriggerProps): import("react/jsx-runtime").JSX.Element;
38
37
  export declare function SidebarFolderLink(props: LinkProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EA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;CAAE,2CAuC3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAYlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAYlE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,2CAYrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,2CAY3E;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,SAAS,GAAG;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,2CAiBA;AAED,wBAAgB,aAAa,CAAC,EAC5B,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CAgBA;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAelE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,2CAiCjD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAQlE;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAwB/C;AAgBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzC,eA0CA"}
@@ -87,11 +87,9 @@ export function SidebarItem({ icon, ...props }) {
87
87
  const { prefetch } = useInternalContext();
88
88
  return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active })), prefetch: prefetch, children: [icon ?? (props.external ? _jsx(ExternalLink, {}) : null), props.children] }));
89
89
  }
90
- export function SidebarFolder({ level, defaultOpen, ...props }) {
91
- const { defaultOpenLevel } = useInternalContext();
92
- const shouldExtend = defaultOpen ?? defaultOpenLevel >= level;
93
- const [open, setOpen] = useState(shouldExtend);
94
- useOnChange(shouldExtend, (v) => {
90
+ export function SidebarFolder({ defaultOpen = false, ...props }) {
91
+ const [open, setOpen] = useState(defaultOpen);
92
+ useOnChange(defaultOpen, (v) => {
95
93
  if (v)
96
94
  setOpen(v);
97
95
  });
@@ -143,8 +141,8 @@ function useInternalContext() {
143
141
  export function SidebarPageTree(props) {
144
142
  const { root } = useTreeContext();
145
143
  return useMemo(() => {
144
+ const { Separator, Item, Folder } = props.components ?? {};
146
145
  function renderSidebarList(items, level) {
147
- const { Separator, Item, Folder } = props.components ?? {};
148
146
  return items.map((item, i) => {
149
147
  const id = `${item.type}_${i.toString()}`;
150
148
  switch (item.type) {
@@ -154,8 +152,8 @@ export function SidebarPageTree(props) {
154
152
  return _jsx(SidebarSeparator, { children: item.name }, id);
155
153
  case 'folder':
156
154
  if (Folder)
157
- return _jsx(Folder, { item: item, level: level + 1 }, id);
158
- return (_jsx(PageTreeFolder, { item: item, level: level + 1, children: renderSidebarList(item.children, level + 1) }, id));
155
+ return _jsx(Folder, { item: item, level: level }, id);
156
+ return (_jsx(PageTreeFolder, { item: item, level: level, children: renderSidebarList(item.children, level + 1) }, id));
159
157
  default:
160
158
  if (Item)
161
159
  return _jsx(Item, { item: item }, item.url);
@@ -163,10 +161,11 @@ export function SidebarPageTree(props) {
163
161
  }
164
162
  });
165
163
  }
166
- return renderSidebarList(root.children, 0);
164
+ return renderSidebarList(root.children, 1);
167
165
  }, [root, props.components]);
168
166
  }
169
167
  function PageTreeFolder({ item, children, level, }) {
168
+ const { defaultOpenLevel } = useInternalContext();
170
169
  const path = useTreePath();
171
- return (_jsxs(SidebarFolder, { defaultOpen: item.defaultOpen || path.includes(item), level: level + 1, children: [item.index ? (_jsxs(SidebarFolderLink, { href: item.index.url, external: item.index.external, children: [item.icon, item.name] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.name] })), _jsx(SidebarFolderContent, { children: children })] }));
170
+ return (_jsxs(SidebarFolder, { defaultOpen: (item.defaultOpen ?? defaultOpenLevel >= level) || path.includes(item), children: [item.index ? (_jsxs(SidebarFolderLink, { href: item.index.url, external: item.index.external, children: [item.icon, item.name] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.name] })), _jsx(SidebarFolderContent, { children: children })] }));
172
171
  }
package/dist/page.d.ts CHANGED
@@ -75,7 +75,7 @@ export declare function DocsCategory({ page, from, tree: forcedTree, ...props }:
75
75
  page: Page;
76
76
  from: LoaderOutput<LoaderConfig>;
77
77
  tree?: PageTree.Root;
78
- }): ReactNode;
78
+ }): import("react/jsx-runtime").JSX.Element | null;
79
79
  /**
80
80
  * For separate MDX page
81
81
  */
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAEL,KAAK,WAAW,EAKhB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAWvE,KAAK,qBAAqB,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,GAC/D,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEJ,KAAK,4BAA4B,GAAG,IAA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,GAAG,MAAM,CAAC;IAEpC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,QAAQ,CAAC,EACvB,GAAQ,EACR,UAAe,EACf,IAAY,EACZ,MAAW,EACX,qBAAqB,EAAE,EACrB,OAAO,EAAE,iBAAwB,EACjC,SAAS,EAAE,iBAAiB,EAC5B,GAAG,iBAAiB,EAChB,EACN,cAAc,EAAE,EAEd,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,UAAU,EACT,EACN,GAAG,KAAK,EACT,EAAE,aAAa,GAAG,SAAS,CAuF3B;AA+BD;;GAEG;AACH,eAAO,MAAM,QAAQ,2HAKnB,CAAC;AAIH,eAAO,MAAM,eAAe,uIAgB1B,CAAC;AAIH,eAAO,MAAM,SAAS,mIAapB,CAAC;AAwBH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,IAAI,EACJ,IAAI,EAAE,UAAU,EAChB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC;CACtB,kDAiCA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAM5E"}
package/dist/page.js CHANGED
@@ -13,13 +13,18 @@ import { I18nLabel } from './contexts/i18n';
13
13
  import ClerkTOCItems from './components/layout/toc-clerk';
14
14
  export function DocsPage({ toc = [], breadcrumb = {}, full = false, footer = {}, tableOfContentPopover: { enabled: tocPopoverEnabled = true, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: {
15
15
  // disable TOC on full mode, you can still enable it with `enabled` option.
16
- enabled: tocEnabled = !full, component: tocReplace, ...tocOptions } = {}, ...props }) {
16
+ enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
17
+ tocEnabled ?? (tocEnabled = !full &&
18
+ (toc.length > 0 ||
19
+ tocOptions.footer !== undefined ||
20
+ tocOptions.header !== undefined));
21
+ const fullWidth = full && !tocEnabled;
17
22
  return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs(PageContainer, { id: "nd-page", style: {
18
- '--fd-toc-width': tocEnabled ? undefined : '0px',
23
+ '--fd-toc-width': fullWidth ? '0px' : undefined,
19
24
  }, children: [replaceOrDefault({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsx(PageHeader, { id: "nd-tocnav", children: _jsxs(TocPopover, { children: [_jsx(TocPopoverTrigger, { className: "size-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc, isMenu: true })) : (_jsx(TOCItems, { items: toc, isMenu: true })), tocPopoverOptions.footer] })] }) }), {
20
25
  items: toc,
21
26
  ...tocPopoverOptions,
22
- }), _jsxs("article", { className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-10 md:px-7 md:pt-12', tocEnabled ? 'max-w-[860px]' : 'max-w-[1120px]'), children: [replaceOrDefault(breadcrumb, _jsx(Breadcrumb, { includePage: breadcrumb.full, ...breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(footer, _jsx(Footer, { items: footer.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { id: "nd-toc", children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
27
+ }), _jsxs("article", { className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-10 md:px-7 md:pt-12', fullWidth ? 'max-w-[1120px]' : 'max-w-[860px]'), children: [replaceOrDefault(breadcrumb, _jsx(Breadcrumb, { includePage: breadcrumb.full, ...breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(footer, _jsx(Footer, { items: footer.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { id: "nd-toc", children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
23
28
  items: toc,
24
29
  ...tocOptions,
25
30
  }, _jsx("div", { role: "none", className: "flex-1" }))] }));
@@ -78,7 +83,6 @@ export function DocsCategory({ page, from, tree: forcedTree, ...props }) {
78
83
  return (_jsx(Cards, { ...props, children: items.map((item) => (_jsx(Card, { title: item.data.title, description: item.data.description ??
79
84
  'No Description', href: item.url }, item.url))) }));
80
85
  }
81
- DocsBody.displayName = 'DocsBody';
82
86
  /**
83
87
  * For separate MDX page
84
88
  */
package/dist/style.css CHANGED
@@ -2188,12 +2188,12 @@ body {
2188
2188
 
2189
2189
  from {
2190
2190
  opacity: 1;
2191
- transform: scale(1) translateY(0);
2191
+ transform: translateY(0);
2192
2192
  }
2193
2193
 
2194
2194
  to {
2195
2195
  opacity: 0;
2196
- transform: scale(0.95) translateY(-10px);
2196
+ transform: translateY(-4px);
2197
2197
  }
2198
2198
  }
2199
2199
 
@@ -2296,7 +2296,7 @@ body {
2296
2296
 
2297
2297
  from {
2298
2298
  opacity: 0;
2299
- transform: scale(0.95) translateY(-10px);
2299
+ transform: scale(0.98) translateY(-4px);
2300
2300
  }
2301
2301
 
2302
2302
  to {
@@ -1,8 +1,7 @@
1
1
  import type { CSSRuleObject, PresetsConfig } from 'tailwindcss/types/config';
2
2
  import { presets } from './theme/colors';
3
3
  import { type Options as TypographyOptions, typography } from './theme/typography';
4
- import type { StyleOptions } from './theme/typography/styles';
5
- export interface DocsUIOptions extends Pick<StyleOptions, 'disableRoundedTable'> {
4
+ export interface DocsUIOptions extends Pick<TypographyOptions, 'disableRoundedTable'> {
6
5
  /**
7
6
  * Prefix to the variable name of colors
8
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind-plugin.d.ts","sourceRoot":"","sources":["../src/tailwind-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EACL,KAAK,OAAO,IAAI,iBAAiB,EACjC,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,YAAY,EAAE,qBAAqB,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;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AAM,CAAC;IAEnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,OAAO,GAAG,MAAM,CAAC;IAEvC,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAED,KAAK,IAAI,GACL,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,kBAAkB,GAClB,SAAS,GACT,oBAAoB,GACpB,MAAM,GACN,iBAAiB,GACjB,QAAQ,GACR,SAAS,GACT,oBAAoB,GACpB,WAAW,GACX,sBAAsB,GACtB,QAAQ,GACR,mBAAmB,GACnB,MAAM,CAAC;AAEX,KAAK,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAElC,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAkDD,eAAO,MAAM,MAAM;;;cApHH,CAAC;;;CAwQhB,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,aAAa,CAWvE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
@@ -29,12 +29,12 @@ export const animations = {
29
29
  to: { transform: 'scale(0.95) translateY(-50%, 0)', opacity: '0' },
30
30
  },
31
31
  'fd-popover-in': {
32
- from: { opacity: '0', transform: 'scale(0.95) translateY(-10px)' },
32
+ from: { opacity: '0', transform: 'scale(0.98) translateY(-4px)' },
33
33
  to: { opacity: '1', transform: 'scale(1) translateY(0)' },
34
34
  },
35
35
  'fd-popover-out': {
36
- from: { opacity: '1', transform: 'scale(1) translateY(0)' },
37
- to: { opacity: '0', transform: 'scale(0.95) translateY(-10px)' },
36
+ from: { opacity: '1', transform: 'translateY(0)' },
37
+ to: { opacity: '0', transform: 'translateY(-4px)' },
38
38
  },
39
39
  'fd-fade-in': {
40
40
  from: { opacity: '0' },
@@ -1,6 +1,9 @@
1
- import * as styles from './styles';
2
- export interface Options extends styles.StyleOptions {
1
+ export interface Options {
3
2
  className?: string;
3
+ /**
4
+ * Disable custom table styles
5
+ */
6
+ disableRoundedTable?: boolean;
4
7
  }
5
8
  export declare const typography: {
6
9
  (options: Options): {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/typography/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAKnC,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,YAAY;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmJD,eAAO,MAAM,UAAU;;;cApJlB,CAAC;;;CAqLL,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/typography/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,OAAO;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAmJD,eAAO,MAAM,UAAU;;;cA1JH,CAAC;;;CAsMpB,CAAC"}
@@ -32,7 +32,7 @@ function configToCss(config = {}, { className, modifier, prefix }) {
32
32
  }
33
33
  return [k, v];
34
34
  }
35
- const css = 'css' in config ? config.css : [];
35
+ const css = config.css ?? [];
36
36
  return Object.fromEntries(Object.entries(merge({}, ...(Array.isArray(css) ? css : [css]))).map(([k, v]) => updateSelector(k, v)));
37
37
  }
38
38
  const parseSelector = parser();
@@ -119,7 +119,15 @@ export const typography = plugin.withOptions(({ className = 'prose', ...styleOpt
119
119
  })})`);
120
120
  }
121
121
  addComponents({
122
- [`.${className}`]: configToCss(modifiers.DEFAULT(styleOptions), {
122
+ [`.${className}`]: configToCss({
123
+ ...modifiers.DEFAULT,
124
+ css: [
125
+ ...(modifiers.DEFAULT.css ?? []),
126
+ styleOptions.disableRoundedTable
127
+ ? modifiers.normalTable
128
+ : modifiers.roundedTable,
129
+ ],
130
+ }, {
123
131
  className,
124
132
  modifier: 'DEFAULT',
125
133
  prefix,
@@ -1,486 +1,87 @@
1
- export interface StyleOptions {
2
- /**
3
- * Disable custom table styles
4
- */
5
- disableRoundedTable?: boolean;
6
- }
7
- export declare const DEFAULT: ({ disableRoundedTable }: StyleOptions) => {
8
- css: ({
9
- '--tw-prose-body': string;
10
- '--tw-prose-headings': string;
11
- '--tw-prose-lead': string;
12
- '--tw-prose-links': string;
13
- '--tw-prose-bold': string;
14
- '--tw-prose-counters': string;
15
- '--tw-prose-bullets': string;
16
- '--tw-prose-hr': string;
17
- '--tw-prose-quotes': string;
18
- '--tw-prose-quote-borders': string;
19
- '--tw-prose-captions': string;
20
- '--tw-prose-code': string;
21
- '--tw-prose-th-borders': string;
22
- '--tw-prose-td-borders': string;
23
- '--tw-prose-kbd': string;
24
- '--tw-prose-kbd-shadows': string;
25
- } | {
26
- table: {
27
- borderCollapse: string;
28
- borderSpacing: string;
29
- '@apply bg-fd-card rounded-lg border overflow-hidden': string;
30
- };
31
- th: {
32
- textAlign: string;
33
- '@apply p-2.5 border-s bg-fd-muted': string;
34
- };
35
- 'th:first-child': {
36
- '@apply border-s-0': string;
37
- };
38
- 'th:not(tr:last-child *), td:not(tr:last-child *)': {
39
- '@apply border-b': string;
40
- };
41
- td: {
42
- textAlign: string;
43
- '@apply border-s p-2.5': string;
44
- };
45
- 'td:first-child': {
46
- '@apply border-s-0': string;
47
- };
48
- 'tfoot th, tfoot td': {
49
- borderTopWidth: string;
50
- borderTopColor: string;
51
- };
52
- 'thead th, thead td': {
53
- borderBottomWidth: string;
54
- borderBottomColor: string;
55
- };
56
- } | {
57
- thead: {
58
- borderBottomWidth: string;
59
- borderBottomColor: string;
60
- };
61
- 'thead th': {
62
- verticalAlign: string;
63
- paddingInlineEnd: string;
64
- paddingBottom: string;
65
- paddingInlineStart: string;
66
- };
67
- 'thead th:first-child': {
68
- paddingInlineStart: string;
69
- };
70
- 'thead th:last-child': {
71
- paddingInlineEnd: string;
72
- };
73
- 'tbody td, tfoot td': {
74
- paddingTop: string;
75
- paddingInlineEnd: string;
76
- paddingBottom: string;
77
- paddingInlineStart: string;
78
- };
79
- 'tbody td:first-child, tfoot td:first-child': {
80
- paddingInlineStart: string;
81
- };
82
- 'tbody td:last-child, tfoot td:last-child': {
83
- paddingInlineEnd: string;
84
- };
85
- 'tbody tr': {
86
- borderBottomWidth: string;
87
- borderBottomColor: string;
88
- };
89
- 'tbody tr:last-child': {
90
- borderBottomWidth: string;
91
- };
92
- 'tbody td': {
93
- verticalAlign: string;
94
- };
95
- tfoot: {
96
- borderTopWidth: string;
97
- borderTopColor: string;
98
- };
99
- 'tfoot td': {
100
- verticalAlign: string;
101
- };
102
- 'th, td': {
103
- textAlign: string;
104
- };
105
- } | {
106
- color: string;
107
- maxWidth: string;
108
- fontSize: string;
109
- lineHeight: string;
110
- '[class~="lead"]': {
111
- fontSize: string;
112
- lineHeight: string;
113
- marginTop: string;
114
- marginBottom: string;
115
- color: string;
116
- };
117
- ul: {
118
- paddingInlineStart: string;
119
- listStyleType: string;
120
- marginTop: string;
121
- marginBottom: string;
122
- };
123
- li: {
124
- marginTop: string;
125
- marginBottom: string;
126
- };
127
- 'ol > li': {
128
- paddingInlineStart: string;
129
- };
130
- 'ul > li': {
131
- paddingInlineStart: string;
132
- };
133
- '> ul > li p': {
134
- marginTop: string;
135
- marginBottom: string;
136
- };
137
- '> ul > li > p:first-child': {
138
- marginTop: string;
139
- };
140
- '> ul > li > p:last-child': {
141
- marginBottom: string;
142
- };
143
- '> ol > li > p:first-child': {
144
- marginTop: string;
145
- };
146
- '> ol > li > p:last-child': {
147
- marginBottom: string;
148
- };
149
- 'ul ul, ul ol, ol ul, ol ol': {
150
- marginTop: string;
151
- marginBottom: string;
152
- };
153
- dl: {
154
- marginTop: string;
155
- marginBottom: string;
156
- };
157
- dt: {
158
- color: string;
159
- fontWeight: string;
160
- marginTop: string;
161
- };
162
- dd: {
163
- marginTop: string;
164
- paddingInlineStart: string;
165
- };
166
- hr: {
167
- borderColor: string;
168
- borderTopWidth: number;
169
- marginTop: string;
170
- marginBottom: string;
171
- };
172
- p: {
173
- marginTop: string;
174
- marginBottom: string;
175
- };
176
- strong: {
177
- color: string;
178
- fontWeight: string;
179
- };
180
- 'a strong': {
181
- color: string;
182
- };
183
- 'blockquote strong': {
184
- color: string;
185
- };
186
- 'thead th strong': {
187
- color: string;
188
- };
189
- ol: {
190
- listStyleType: string;
191
- marginTop: string;
192
- marginBottom: string;
193
- paddingInlineStart: string;
194
- };
195
- 'ol[type="A"]': {
196
- listStyleType: string;
197
- };
198
- 'ol[type="a"]': {
199
- listStyleType: string;
200
- };
201
- 'ol[type="A" s]': {
202
- listStyleType: string;
203
- };
204
- 'ol[type="a" s]': {
205
- listStyleType: string;
206
- };
207
- 'ol[type="I"]': {
208
- listStyleType: string;
209
- };
210
- 'ol[type="i"]': {
211
- listStyleType: string;
212
- };
213
- 'ol[type="I" s]': {
214
- listStyleType: string;
215
- };
216
- 'ol[type="i" s]': {
217
- listStyleType: string;
218
- };
219
- 'ol[type="1"]': {
220
- listStyleType: string;
221
- };
222
- 'ol > li::marker': {
223
- fontWeight: string;
224
- color: string;
225
- };
226
- 'ul > li::marker': {
227
- color: string;
228
- };
229
- blockquote: {
230
- marginTop: string;
231
- marginBottom: string;
232
- paddingInlineStart: string;
233
- fontWeight: string;
234
- fontStyle: string;
235
- color: string;
236
- borderInlineStartWidth: string;
237
- borderInlineStartColor: string;
238
- quotes: string;
239
- };
240
- 'blockquote p:first-of-type::before': {
241
- content: string;
242
- };
243
- 'blockquote p:last-of-type::after': {
244
- content: string;
245
- };
246
- h1: {
247
- color: string;
248
- fontWeight: string;
249
- fontSize: string;
250
- marginTop: string;
251
- marginBottom: string;
252
- lineHeight: string;
253
- };
254
- 'h1 strong': {
255
- fontWeight: string;
256
- color: string;
257
- };
258
- h2: {
259
- color: string;
260
- fontSize: string;
261
- marginTop: string;
262
- marginBottom: string;
263
- lineHeight: string;
264
- fontWeight: string;
265
- };
266
- 'h2 strong': {
267
- fontWeight: string;
268
- color: string;
269
- };
270
- h3: {
271
- color: string;
272
- fontWeight: string;
273
- fontSize: string;
274
- marginTop: string;
275
- marginBottom: string;
276
- lineHeight: string;
277
- };
278
- 'h3 strong': {
279
- fontWeight: string;
280
- color: string;
281
- };
282
- h4: {
283
- color: string;
284
- fontWeight: string;
285
- marginTop: string;
286
- marginBottom: string;
287
- lineHeight: string;
288
- };
289
- 'h4 strong': {
290
- fontWeight: string;
291
- color: string;
292
- };
293
- 'hr + *': {
294
- marginTop: string;
295
- };
296
- 'h2 + *': {
297
- marginTop: string;
298
- };
299
- 'h3 + *': {
300
- marginTop: string;
301
- };
302
- 'h4 + *': {
303
- marginTop: string;
304
- };
305
- img: {
306
- marginTop: string;
307
- marginBottom: string;
308
- };
309
- picture: {
310
- display: string;
311
- marginTop: string;
312
- marginBottom: string;
313
- };
314
- 'picture > img': {
315
- marginTop: string;
316
- marginBottom: string;
317
- };
318
- video: {
319
- marginTop: string;
320
- marginBottom: string;
321
- };
322
- kbd: {
323
- fontSize: string;
324
- borderRadius: string;
325
- paddingTop: string;
326
- paddingInlineEnd: string;
327
- paddingBottom: string;
328
- paddingInlineStart: string;
329
- fontWeight: string;
330
- fontFamily: string;
331
- color: string;
332
- boxShadow: string;
333
- };
334
- code: {
335
- padding: string;
336
- border: string;
337
- fontSize: string;
338
- borderColor: string;
339
- borderRadius: string;
340
- fontWeight: string;
341
- background: string;
342
- color: string;
343
- };
344
- 'a code': {
345
- color: string;
346
- };
347
- 'h1 code': {
348
- color: string;
349
- };
350
- 'h2 code': {
351
- color: string;
352
- fontSize: string;
353
- };
354
- 'h3 code': {
355
- color: string;
356
- fontSize: string;
357
- };
358
- 'h4 code': {
359
- color: string;
360
- };
361
- 'blockquote code': {
362
- color: string;
363
- };
364
- 'thead th code': {
365
- color: string;
366
- };
367
- table: {
368
- fontSize: string;
369
- lineHeight: string;
370
- width: string;
371
- tableLayout: string;
372
- marginTop: string;
373
- marginBottom: string;
374
- };
375
- 'thead th': {
376
- color: string;
377
- fontWeight: string;
378
- };
379
- figure: {
380
- marginTop: string;
381
- marginBottom: string;
382
- };
383
- 'figure > *': {
384
- marginTop: string;
385
- marginBottom: string;
386
- };
387
- figcaption: {
388
- color: string;
389
- fontSize: string;
390
- lineHeight: string;
391
- marginTop: string;
392
- };
393
- 'a:not([data-card])': {
394
- color: string;
395
- transition: string;
396
- fontWeight: string;
397
- textDecoration: string;
398
- textUnderlineOffset: string;
399
- textDecorationColor: string;
400
- };
401
- 'a:not([data-card]):hover': {
402
- opacity: string;
403
- };
404
- '> :first-child'?: undefined;
405
- '> :last-child'?: undefined;
406
- } | {
407
- '> :first-child': {
408
- marginTop: string;
409
- };
410
- '> :last-child': {
411
- marginBottom: string;
412
- };
413
- color?: undefined;
414
- maxWidth?: undefined;
415
- fontSize?: undefined;
416
- lineHeight?: undefined;
417
- '[class~="lead"]'?: undefined;
418
- ul?: undefined;
419
- li?: undefined;
420
- 'ol > li'?: undefined;
421
- 'ul > li'?: undefined;
422
- '> ul > li p'?: undefined;
423
- '> ul > li > p:first-child'?: undefined;
424
- '> ul > li > p:last-child'?: undefined;
425
- '> ol > li > p:first-child'?: undefined;
426
- '> ol > li > p:last-child'?: undefined;
427
- 'ul ul, ul ol, ol ul, ol ol'?: undefined;
428
- dl?: undefined;
429
- dt?: undefined;
430
- dd?: undefined;
431
- hr?: undefined;
432
- p?: undefined;
433
- strong?: undefined;
434
- 'a strong'?: undefined;
435
- 'blockquote strong'?: undefined;
436
- 'thead th strong'?: undefined;
437
- ol?: undefined;
438
- 'ol[type="A"]'?: undefined;
439
- 'ol[type="a"]'?: undefined;
440
- 'ol[type="A" s]'?: undefined;
441
- 'ol[type="a" s]'?: undefined;
442
- 'ol[type="I"]'?: undefined;
443
- 'ol[type="i"]'?: undefined;
444
- 'ol[type="I" s]'?: undefined;
445
- 'ol[type="i" s]'?: undefined;
446
- 'ol[type="1"]'?: undefined;
447
- 'ol > li::marker'?: undefined;
448
- 'ul > li::marker'?: undefined;
449
- blockquote?: undefined;
450
- 'blockquote p:first-of-type::before'?: undefined;
451
- 'blockquote p:last-of-type::after'?: undefined;
452
- h1?: undefined;
453
- 'h1 strong'?: undefined;
454
- h2?: undefined;
455
- 'h2 strong'?: undefined;
456
- h3?: undefined;
457
- 'h3 strong'?: undefined;
458
- h4?: undefined;
459
- 'h4 strong'?: undefined;
460
- 'hr + *'?: undefined;
461
- 'h2 + *'?: undefined;
462
- 'h3 + *'?: undefined;
463
- 'h4 + *'?: undefined;
464
- img?: undefined;
465
- picture?: undefined;
466
- 'picture > img'?: undefined;
467
- video?: undefined;
468
- kbd?: undefined;
469
- code?: undefined;
470
- 'a code'?: undefined;
471
- 'h1 code'?: undefined;
472
- 'h2 code'?: undefined;
473
- 'h3 code'?: undefined;
474
- 'h4 code'?: undefined;
475
- 'blockquote code'?: undefined;
476
- 'thead th code'?: undefined;
477
- table?: undefined;
478
- 'thead th'?: undefined;
479
- figure?: undefined;
480
- 'figure > *'?: undefined;
481
- figcaption?: undefined;
482
- 'a:not([data-card])'?: undefined;
483
- 'a:not([data-card]):hover'?: undefined;
484
- })[];
1
+ export declare const roundedTable: {
2
+ table: {
3
+ borderCollapse: string;
4
+ borderSpacing: string;
5
+ '@apply bg-fd-card rounded-lg border overflow-hidden': string;
6
+ };
7
+ th: {
8
+ textAlign: string;
9
+ '@apply p-2.5 border-s bg-fd-muted': string;
10
+ };
11
+ 'th:first-child': {
12
+ '@apply border-s-0': string;
13
+ };
14
+ 'th:not(tr:last-child *), td:not(tr:last-child *)': {
15
+ '@apply border-b': string;
16
+ };
17
+ td: {
18
+ textAlign: string;
19
+ '@apply border-s p-2.5': string;
20
+ };
21
+ 'td:first-child': {
22
+ '@apply border-s-0': string;
23
+ };
24
+ 'tfoot th, tfoot td': {
25
+ borderTopWidth: string;
26
+ borderTopColor: string;
27
+ };
28
+ 'thead th, thead td': {
29
+ borderBottomWidth: string;
30
+ borderBottomColor: string;
31
+ };
32
+ };
33
+ export declare const normalTable: {
34
+ thead: {
35
+ borderBottomWidth: string;
36
+ borderBottomColor: string;
37
+ };
38
+ 'thead th': {
39
+ verticalAlign: string;
40
+ paddingInlineEnd: string;
41
+ paddingBottom: string;
42
+ paddingInlineStart: string;
43
+ };
44
+ 'thead th:first-child': {
45
+ paddingInlineStart: string;
46
+ };
47
+ 'thead th:last-child': {
48
+ paddingInlineEnd: string;
49
+ };
50
+ 'tbody td, tfoot td': {
51
+ paddingTop: string;
52
+ paddingInlineEnd: string;
53
+ paddingBottom: string;
54
+ paddingInlineStart: string;
55
+ };
56
+ 'tbody td:first-child, tfoot td:first-child': {
57
+ paddingInlineStart: string;
58
+ };
59
+ 'tbody td:last-child, tfoot td:last-child': {
60
+ paddingInlineEnd: string;
61
+ };
62
+ 'tbody tr': {
63
+ borderBottomWidth: string;
64
+ borderBottomColor: string;
65
+ };
66
+ 'tbody tr:last-child': {
67
+ borderBottomWidth: string;
68
+ };
69
+ 'tbody td': {
70
+ verticalAlign: string;
71
+ };
72
+ tfoot: {
73
+ borderTopWidth: string;
74
+ borderTopColor: string;
75
+ };
76
+ 'tfoot td': {
77
+ verticalAlign: string;
78
+ };
79
+ 'th, td': {
80
+ textAlign: string;
81
+ };
485
82
  };
83
+ export interface Config {
84
+ css?: Record<string, string | Record<string, string>>[];
85
+ }
86
+ export declare const DEFAULT: Config;
486
87
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/theme/typography/styles.ts"],"names":[],"mappings":"AAsHA,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,OAAO,4BAA6B,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8T3D,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/theme/typography/styles.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDvB,CAAC;AAEF,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;CACzD;AAED,eAAO,MAAM,OAAO,EAAE,MA6TrB,CAAC"}
@@ -28,7 +28,7 @@ const colors = {
28
28
  '--tw-prose-kbd': `theme('colors.fd-foreground')`,
29
29
  '--tw-prose-kbd-shadows': `theme('colors.fd-primary.DEFAULT / 50%')`,
30
30
  };
31
- const roundedTable = {
31
+ export const roundedTable = {
32
32
  table: {
33
33
  borderCollapse: 'separate',
34
34
  borderSpacing: '0',
@@ -60,7 +60,7 @@ const roundedTable = {
60
60
  borderBottomColor: 'var(--tw-prose-th-borders)',
61
61
  },
62
62
  };
63
- const normalTable = {
63
+ export const normalTable = {
64
64
  thead: {
65
65
  borderBottomWidth: '1px',
66
66
  borderBottomColor: 'var(--tw-prose-th-borders)',
@@ -110,7 +110,7 @@ const normalTable = {
110
110
  textAlign: 'start',
111
111
  },
112
112
  };
113
- export const DEFAULT = ({ disableRoundedTable }) => ({
113
+ export const DEFAULT = {
114
114
  css: [
115
115
  {
116
116
  color: 'var(--tw-prose-body)',
@@ -175,7 +175,7 @@ export const DEFAULT = ({ disableRoundedTable }) => ({
175
175
  },
176
176
  hr: {
177
177
  borderColor: 'var(--tw-prose-hr)',
178
- borderTopWidth: 1,
178
+ borderTopWidth: '1px',
179
179
  marginTop: em(48, 16),
180
180
  marginBottom: em(48, 16),
181
181
  },
@@ -421,6 +421,5 @@ export const DEFAULT = ({ disableRoundedTable }) => ({
421
421
  marginBottom: '0',
422
422
  },
423
423
  },
424
- disableRoundedTable ? normalTable : roundedTable,
425
424
  ],
426
- });
425
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtE;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,EACvB,EAAE,SAAS,EAAE,GAAE,UAAe,GAC7B,MAAM,EAAE,CAqBV"}
1
+ {"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtE;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,EACvB,EAAE,SAAS,EAAE,GAAE,UAAe,GAC7B,MAAM,EAAE,CA0BV"}
@@ -1,16 +1,20 @@
1
1
  export function getSidebarTabs(pageTree, { transform } = {}) {
2
2
  const options = [];
3
3
  function traverse(node) {
4
- if (node.type === 'folder' && node.root && node.index) {
5
- const option = {
6
- url: node.index.url,
7
- title: node.name,
8
- icon: node.icon,
9
- description: node.description,
10
- };
11
- const mapped = transform ? transform(option, node) : option;
12
- if (mapped)
13
- options.push(mapped);
4
+ if (node.type === 'folder' && node.root) {
5
+ const index = node.index ?? node.children.at(0);
6
+ if (index?.type === 'page') {
7
+ const option = {
8
+ url: index.url,
9
+ title: node.name,
10
+ icon: node.icon,
11
+ folder: node,
12
+ description: node.description,
13
+ };
14
+ const mapped = transform ? transform(option, node) : option;
15
+ if (mapped)
16
+ options.push(mapped);
17
+ }
14
18
  }
15
19
  if (node.type === 'folder')
16
20
  node.children.forEach(traverse);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "14.5.2",
3
+ "version": "14.5.3",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -68,7 +68,7 @@
68
68
  "postcss-selector-parser": "^7.0.0",
69
69
  "react-medium-image-zoom": "^5.2.11",
70
70
  "tailwind-merge": "^2.5.4",
71
- "fumadocs-core": "14.5.2"
71
+ "fumadocs-core": "14.5.3"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@next/eslint-plugin-next": "^15.0.3",