fumadocs-ui 16.7.10 → 16.7.12

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.
@@ -255,6 +255,7 @@
255
255
  @source inline("length");
256
256
  @source inline("link");
257
257
  @source inline("linkItems");
258
+ @source inline("list");
258
259
  @source inline("lucide-react");
259
260
  @source inline("main");
260
261
  @source inline("max");
@@ -273,6 +273,7 @@
273
273
  @source inline("lg:layout:[--fd-header-height:--spacing(24)]");
274
274
  @source inline("link");
275
275
  @source inline("linkItems");
276
+ @source inline("list");
276
277
  @source inline("lucide-react");
277
278
  @source inline("main");
278
279
  @source inline("max");
@@ -210,6 +210,7 @@
210
210
  @source inline("component");
211
211
  @source inline("components");
212
212
  @source inline("composedRef");
213
+ @source inline("computed");
213
214
  @source inline("config");
214
215
  @source inline("const");
215
216
  @source inline("container");
@@ -522,6 +523,7 @@
522
523
  @source inline("isWindows");
523
524
  @source inline("it");
524
525
  @source inline("item");
526
+ @source inline("itemLineLengths");
525
527
  @source inline("itemVariants");
526
528
  @source inline("items");
527
529
  @source inline("items-center");
@@ -533,6 +535,7 @@
533
535
  @source inline("key");
534
536
  @source inline("keydown");
535
537
  @source inline("keyof");
538
+ @source inline("l");
536
539
  @source inline("label");
537
540
  @source inline("lang");
538
541
  @source inline("language");
@@ -682,11 +685,14 @@
682
685
  @source inline("of");
683
686
  @source inline("official");
684
687
  @source inline("offset");
688
+ @source inline("offsetDistance");
689
+ @source inline("offsetPath");
685
690
  @source inline("offsetTop");
686
691
  @source inline("on");
687
692
  @source inline("onChange");
688
693
  @source inline("onChangeRef");
689
694
  @source inline("onClick");
695
+ @source inline("onContainerResize");
690
696
  @source inline("onCopy");
691
697
  @source inline("onKey");
692
698
  @source inline("onKeyDown");
@@ -762,6 +768,7 @@
762
768
  @source inline("placeholder:text-fd-muted-foreground");
763
769
  @source inline("please");
764
770
  @source inline("pointerType");
771
+ @source inline("positions");
765
772
  @source inline("possible");
766
773
  @source inline("powered");
767
774
  @source inline("pre");
@@ -1021,6 +1028,7 @@
1021
1028
  @source inline("themes");
1022
1029
  @source inline("this");
1023
1030
  @source inline("throw");
1031
+ @source inline("thumbBox");
1024
1032
  @source inline("thumbRef");
1025
1033
  @source inline("tier");
1026
1034
  @source inline("timeoutRef");
@@ -1039,16 +1047,17 @@
1039
1047
  @source inline("top-3");
1040
1048
  @source inline("top-4");
1041
1049
  @source inline("top-[calc(50%-var(--t,0px)+var(--b,0px))]");
1050
+ @source inline("topL");
1042
1051
  @source inline("touch");
1043
1052
  @source inline("transform");
1044
1053
  @source inline("transition-[clip-path]");
1045
1054
  @source inline("transition-[height]");
1055
+ @source inline("transition-[offset-distance]");
1046
1056
  @source inline("transition-[width,height]");
1047
1057
  @source inline("transition-all");
1048
1058
  @source inline("transition-colors");
1049
1059
  @source inline("transition-opacity");
1050
1060
  @source inline("transition-transform");
1051
- @source inline("translate");
1052
1061
  @source inline("translations");
1053
1062
  @source inline("transparent");
1054
1063
  @source inline("tree");
@@ -1074,7 +1083,6 @@
1074
1083
  @source inline("updated");
1075
1084
  @source inline("updates");
1076
1085
  @source inline("upper");
1077
- @source inline("upperBottom");
1078
1086
  @source inline("upperOffset");
1079
1087
  @source inline("upperX");
1080
1088
  @source inline("url");
@@ -1139,6 +1147,7 @@
1139
1147
  @source inline("when");
1140
1148
  @source inline("where");
1141
1149
  @source inline("whether");
1150
+ @source inline("while");
1142
1151
  @source inline("white");
1143
1152
  @source inline("whitespace-nowrap");
1144
1153
  @source inline("whitespaces");
@@ -1154,6 +1163,7 @@
1154
1163
  @source inline("wrapped");
1155
1164
  @source inline("x");
1156
1165
  @source inline("xmlns");
1166
+ @source inline("y");
1157
1167
  @source inline("you");
1158
1168
  @source inline("your");
1159
1169
  @source inline("z-2");
@@ -3,11 +3,15 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import * as Primitive from "fumadocs-core/toc";
4
4
 
5
5
  //#region src/components/toc/clerk.d.ts
6
+ interface TOCItemsProps extends ComponentProps<'div'> {
7
+ thumbBox?: boolean;
8
+ }
6
9
  declare function TOCItems({
7
10
  ref,
8
11
  className,
12
+ thumbBox,
9
13
  ...props
10
- }: ComponentProps<'div'>): _$react_jsx_runtime0.JSX.Element;
14
+ }: TOCItemsProps): _$react_jsx_runtime0.JSX.Element;
11
15
  declare function TOCEmpty(): _$react_jsx_runtime0.JSX.Element;
12
16
  declare function TOCItem({
13
17
  item,
@@ -16,4 +20,4 @@ declare function TOCItem({
16
20
  item: Primitive.TOCItemType;
17
21
  }): _$react_jsx_runtime0.JSX.Element;
18
22
  //#endregion
19
- export { TOCEmpty, TOCItem, TOCItems };
23
+ export { TOCEmpty, TOCItem, TOCItems, TOCItemsProps };
@@ -4,7 +4,7 @@ import { useI18n } from "../../contexts/i18n.js";
4
4
  import { cn } from "../../utils/cn.js";
5
5
  import { mergeRefs } from "../../utils/merge-refs.js";
6
6
  import { TocThumb, useTOCItems } from "./index.js";
7
- import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import * as Primitive from "fumadocs-core/toc";
10
10
  //#region src/components/toc/clerk.tsx
@@ -13,29 +13,41 @@ var clerk_exports = /* @__PURE__ */ __exportAll({
13
13
  TOCItem: () => TOCItem,
14
14
  TOCItems: () => TOCItems
15
15
  });
16
- function TOCItems({ ref, className, ...props }) {
16
+ function TOCItems({ ref, className, thumbBox = true, ...props }) {
17
17
  const containerRef = useRef(null);
18
18
  const items = useTOCItems();
19
- const [svg, setSvg] = useState();
20
- const onResize = useEffectEvent(() => {
19
+ const [svg, setSvg] = useState(null);
20
+ const onPrint = useCallback(() => {
21
21
  const container = containerRef.current;
22
22
  if (!container || container.clientHeight === 0) return;
23
+ if (items.length === 0) {
24
+ setSvg(null);
25
+ return;
26
+ }
23
27
  let w = 0;
24
28
  let h = 0;
25
- let upperBottom = 0;
26
- let upperX = 0;
27
29
  let d = "";
30
+ const positions = [];
28
31
  const output = [];
29
32
  for (let i = 0; i < items.length; i++) {
30
33
  const item = items[i];
31
34
  const element = container.querySelector(`a[href="#${item.url.slice(1)}"]`);
32
35
  if (!element) continue;
33
36
  const styles = getComputedStyle(element);
34
- const x = getLineOffset(item.depth) + .5, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
37
+ const x = getLineOffset(item.depth) + .5;
38
+ const top = element.offsetTop + parseFloat(styles.paddingTop);
39
+ const bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
35
40
  w = Math.max(x + 8, w);
36
41
  h = Math.max(h, bottom);
37
42
  if (i === 0) d += ` M${x} ${top} L${x} ${bottom}`;
38
- else d += ` C ${upperX} ${top - 4} ${x} ${upperBottom + 4} ${x} ${top} L${x} ${bottom}`;
43
+ else {
44
+ const [, upperBottom, upperX] = i > 0 ? positions[i - 1] : [
45
+ 0,
46
+ 0,
47
+ 0
48
+ ];
49
+ d += ` C ${upperX} ${top - 4} ${x} ${upperBottom + 4} ${x} ${top} L${x} ${bottom}`;
50
+ }
39
51
  if (item._step !== void 0) output.push(/* @__PURE__ */ jsx("circle", {
40
52
  cx: x,
41
53
  cy: (top + bottom) / 2,
@@ -50,8 +62,11 @@ function TOCItems({ ref, className, ...props }) {
50
62
  className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono",
51
63
  children: item._step
52
64
  }, `${i}-text`));
53
- upperX = x;
54
- upperBottom = bottom;
65
+ positions.push([
66
+ top,
67
+ bottom,
68
+ x
69
+ ]);
55
70
  }
56
71
  output.unshift(/* @__PURE__ */ jsx("path", {
57
72
  d,
@@ -59,23 +74,32 @@ function TOCItems({ ref, className, ...props }) {
59
74
  strokeWidth: "1",
60
75
  fill: "none"
61
76
  }, "path"));
77
+ const itemLineLengths = [];
78
+ if (thumbBox) {
79
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
80
+ path.setAttribute("d", d);
81
+ let l = 0;
82
+ for (const [top, bottom] of positions) {
83
+ while (path.getPointAtLength(l).y < top) l++;
84
+ const topL = l;
85
+ while (path.getPointAtLength(l).y < bottom) l++;
86
+ itemLineLengths.push([topL, l]);
87
+ }
88
+ }
62
89
  setSvg({
63
90
  content: output,
64
91
  width: w,
65
- height: h
92
+ height: h,
93
+ d,
94
+ itemLineLengths
66
95
  });
67
- });
96
+ }, [items, thumbBox]);
68
97
  useEffect(() => {
69
- if (!containerRef.current) return;
70
- const observer = new ResizeObserver(onResize);
71
- onResize();
72
- observer.observe(containerRef.current);
73
- return () => {
74
- observer.disconnect();
75
- };
76
- }, []);
98
+ onPrint();
99
+ }, [onPrint]);
77
100
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsxs(TocThumb, {
78
101
  containerRef,
102
+ onContainerResize: onPrint,
79
103
  className: "absolute top-0 inset-s-0",
80
104
  style: {
81
105
  width: svg.width,
@@ -91,7 +115,7 @@ function TOCItems({ ref, className, ...props }) {
91
115
  clipPath: `polygon(0 var(--fd-top), 100% var(--fd-top), 100% calc(var(--fd-top) + var(--fd-height)), 0 calc(var(--fd-top) + var(--fd-height)))`
92
116
  },
93
117
  children: svg.content
94
- }), /* @__PURE__ */ jsx(ThumbBox, {})]
118
+ }), thumbBox && /* @__PURE__ */ jsx(ThumbBox, { computed: svg })]
95
119
  }), /* @__PURE__ */ jsx("div", {
96
120
  ref: mergeRefs(containerRef, ref),
97
121
  className: cn("flex flex-col", className),
@@ -105,12 +129,12 @@ function TOCEmpty() {
105
129
  children: text.tocNoHeadings
106
130
  });
107
131
  }
108
- function ThumbBox() {
132
+ function ThumbBox({ computed }) {
109
133
  const items = Primitive.useItems();
110
134
  const previousRef = useRef(null);
111
135
  const startIdx = items.findIndex((item) => item.active);
112
- const endIdx = items.findLastIndex((item) => item.active);
113
136
  if (startIdx === -1) return;
137
+ const endIdx = items.findLastIndex((item) => item.active);
114
138
  let isUp = false;
115
139
  if (previousRef.current) {
116
140
  const prev = previousRef.current;
@@ -121,12 +145,12 @@ function ThumbBox() {
121
145
  endIdx,
122
146
  isUp
123
147
  };
124
- const original = items[isUp ? startIdx : endIdx].original;
125
148
  return /* @__PURE__ */ jsx("div", {
126
- className: "absolute size-1 bg-fd-primary rounded-full transition-transform",
149
+ className: "absolute size-1 bg-fd-primary rounded-full transition-[offset-distance]",
127
150
  style: {
128
- translate: `${getLineOffset(original.depth) - 1.5}px calc(${isUp ? "var(--fd-top)" : "var(--fd-top) + var(--fd-height)"} - 1.5px)`,
129
- scale: original._step !== void 0 ? "0" : "1"
151
+ offsetPath: `path("${computed.d}")`,
152
+ offsetDistance: isUp ? computed.itemLineLengths[startIdx][0] : computed.itemLineLengths[endIdx][1],
153
+ scale: items[isUp ? startIdx : endIdx].original._step !== void 0 ? "0" : "1"
130
154
  }
131
155
  });
132
156
  }
@@ -3,11 +3,12 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import * as Primitive from "fumadocs-core/toc";
4
4
 
5
5
  //#region src/components/toc/default.d.ts
6
+ type TOCItemsProps = ComponentProps<'div'>;
6
7
  declare function TOCItems({
7
8
  ref,
8
9
  className,
9
10
  ...props
10
- }: ComponentProps<'div'>): _$react_jsx_runtime0.JSX.Element;
11
+ }: TOCItemsProps): _$react_jsx_runtime0.JSX.Element;
11
12
  declare function TOCEmpty(): _$react_jsx_runtime0.JSX.Element;
12
13
  declare function TOCItem({
13
14
  item,
@@ -16,4 +17,4 @@ declare function TOCItem({
16
17
  item: Primitive.TOCItemType;
17
18
  }): _$react_jsx_runtime0.JSX.Element;
18
19
  //#endregion
19
- export { TOCEmpty, TOCItem, TOCItems };
20
+ export { TOCEmpty, TOCItem, TOCItems, TOCItemsProps };
@@ -18,9 +18,11 @@ declare function TOCScrollArea({
18
18
  }: ComponentProps<'div'>): _$react_jsx_runtime0.JSX.Element;
19
19
  interface TocThumbProps extends ComponentProps<'div'> {
20
20
  containerRef: RefObject<HTMLElement | null>;
21
+ onContainerResize?: () => void;
21
22
  }
22
23
  declare function TocThumb({
23
24
  containerRef,
25
+ onContainerResize,
24
26
  ...props
25
27
  }: TocThumbProps): _$react_jsx_runtime0.JSX.Element;
26
28
  //#endregion
@@ -43,7 +43,7 @@ function TOCScrollArea({ ref, className, ...props }) {
43
43
  })
44
44
  });
45
45
  }
46
- function TocThumb({ containerRef, ...props }) {
46
+ function TocThumb({ containerRef, onContainerResize, ...props }) {
47
47
  const thumbRef = useRef(null);
48
48
  const active = useActiveAnchors();
49
49
  function update(info) {
@@ -74,14 +74,15 @@ function TocThumb({ containerRef, ...props }) {
74
74
  height: lower - upper
75
75
  };
76
76
  }
77
- const onPrint = useEffectEvent(() => {
77
+ const onResize = useEffectEvent(() => {
78
78
  const result = calc(active);
79
79
  if (result) update(result);
80
+ onContainerResize?.();
80
81
  });
81
82
  useEffect(() => {
82
83
  if (!containerRef.current) return;
83
84
  const container = containerRef.current;
84
- const observer = new ResizeObserver(onPrint);
85
+ const observer = new ResizeObserver(onResize);
85
86
  observer.observe(container);
86
87
  return () => {
87
88
  observer.disconnect();
@@ -35,20 +35,20 @@ interface FooterOptions extends FooterProps {
35
35
  */
36
36
  component?: ReactNode;
37
37
  }
38
- interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
38
+ type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
39
39
  enabled?: boolean;
40
40
  /**
41
41
  * @deprecated use `slots.toc` instead.
42
42
  */
43
43
  component?: ReactNode;
44
- }
45
- interface TableOfContentPopoverOptions extends TOCPopoverProps {
44
+ };
45
+ type TableOfContentPopoverOptions = TOCPopoverProps & {
46
46
  enabled?: boolean;
47
47
  /**
48
48
  * @deprecated use `slots.tocPopover` instead.
49
49
  */
50
50
  component?: ReactNode;
51
- }
51
+ };
52
52
  interface DocsPageSlots {
53
53
  toc: {
54
54
  provider: FC<TOCProviderProps>;
@@ -1,3 +1,5 @@
1
+ import { TOCItemsProps } from "../../../../components/toc/clerk.js";
2
+ import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
1
3
  import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
2
4
  import { ComponentProps, ReactNode } from "react";
3
5
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
@@ -5,7 +7,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
7
  //#region src/layouts/docs/page/slots/toc.d.ts
6
8
  type TOCProviderProps = TOCProviderProps$1;
7
9
  declare function TOCProvider(props: TOCProviderProps): _$react_jsx_runtime0.JSX.Element;
8
- interface TOCProps {
10
+ type TOCProps = {
9
11
  container?: ComponentProps<'div'>;
10
12
  /**
11
13
  * Custom content in TOC container, before the main TOC
@@ -15,18 +17,21 @@ interface TOCProps {
15
17
  * Custom content in TOC container, after the main TOC
16
18
  */
17
19
  footer?: ReactNode;
18
- /**
19
- * @defaultValue 'normal'
20
- */
21
- style?: 'normal' | 'clerk';
22
- }
20
+ } & ({
21
+ style?: 'normal';
22
+ list?: TOCItemsProps$1;
23
+ } | {
24
+ style: 'clerk';
25
+ list?: TOCItemsProps;
26
+ });
23
27
  declare function TOC({
24
28
  container,
25
29
  header,
26
30
  footer,
27
- style
31
+ style,
32
+ list
28
33
  }: TOCProps): _$react_jsx_runtime0.JSX.Element;
29
- interface TOCPopoverProps {
34
+ type TOCPopoverProps = {
30
35
  container?: ComponentProps<'div'>;
31
36
  trigger?: ComponentProps<'button'>;
32
37
  content?: ComponentProps<'div'>;
@@ -38,18 +43,21 @@ interface TOCPopoverProps {
38
43
  * Custom content in TOC container, after the main TOC
39
44
  */
40
45
  footer?: ReactNode;
41
- /**
42
- * @defaultValue 'normal'
43
- */
44
- style?: 'normal' | 'clerk';
45
- }
46
+ } & ({
47
+ style?: 'normal';
48
+ list?: TOCItemsProps$1;
49
+ } | {
50
+ style: 'clerk';
51
+ list?: TOCItemsProps;
52
+ });
46
53
  declare function TOCPopover({
47
54
  container,
48
55
  trigger,
49
56
  content,
50
57
  header,
51
58
  footer,
52
- style
59
+ style,
60
+ list
53
61
  }: TOCPopoverProps): _$react_jsx_runtime0.JSX.Element;
54
62
  //#endregion
55
63
  export { TOC, TOCPopover, TOCPopoverProps, TOCProps, TOCProvider, TOCProviderProps };
@@ -15,7 +15,7 @@ import { ChevronDown, Text } from "lucide-react";
15
15
  function TOCProvider(props) {
16
16
  return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
17
17
  }
18
- function TOC({ container, header, footer, style = "normal" }) {
18
+ function TOC({ container, header, footer, style = "normal", list }) {
19
19
  const items = useTOCItems();
20
20
  const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
21
21
  return /* @__PURE__ */ jsxs("div", {
@@ -29,13 +29,16 @@ function TOC({ container, header, footer, style = "normal" }) {
29
29
  className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
30
30
  children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(I18nLabel, { label: "toc" })]
31
31
  }),
32
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
32
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
33
+ ...list,
34
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
35
+ }) }),
33
36
  footer
34
37
  ]
35
38
  });
36
39
  }
37
40
  const TocPopoverContext = createContext(null);
38
- function TOCPopover({ container, trigger, content, header, footer, style = "normal" }) {
41
+ function TOCPopover({ container, trigger, content, header, footer, style = "normal", list }) {
39
42
  const items = useTOCItems();
40
43
  const ref = useRef(null);
41
44
  const [open, setOpen] = useState(false);
@@ -72,10 +75,13 @@ function TOCPopover({ container, trigger, content, header, footer, style = "norm
72
75
  ...content,
73
76
  children: [
74
77
  header,
75
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
76
- item,
77
- onClick: onClickItem
78
- }, item.url))] }) }),
78
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
79
+ ...list,
80
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
81
+ item,
82
+ onClick: onClickItem
83
+ }, item.url))]
84
+ }) }),
79
85
  footer
80
86
  ]
81
87
  })]
@@ -15,19 +15,18 @@ interface DocsPageProps extends ComponentProps<'article'> {
15
15
  * @defaultValue false
16
16
  */
17
17
  full?: boolean;
18
- children?: ReactNode;
19
18
  slots?: Partial<DocsPageSlots>;
20
19
  footer?: FooterOptions;
21
20
  breadcrumb?: BreadcrumbOptions;
22
21
  tableOfContent?: TableOfContentOptions;
23
22
  }
24
- interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
23
+ type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
25
24
  enabled?: boolean;
26
25
  /**
27
26
  * @deprecated use `slots.toc` instead.
28
27
  */
29
28
  component?: ReactNode;
30
- }
29
+ };
31
30
  interface BreadcrumbOptions extends BreadcrumbProps {
32
31
  enabled?: boolean;
33
32
  /**
@@ -1,3 +1,5 @@
1
+ import { TOCItemsProps } from "../../../../components/toc/clerk.js";
2
+ import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
1
3
  import { TOCProvider as TOCProvider$1, TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
2
4
  import { ComponentProps, ReactNode } from "react";
3
5
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
@@ -5,7 +7,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
7
  //#region src/layouts/flux/page/slots/toc.d.ts
6
8
  type TOCProviderProps = TOCProviderProps$1;
7
9
  declare const TOCProvider: typeof TOCProvider$1;
8
- interface TOCProps {
10
+ type TOCProps = {
9
11
  container?: ComponentProps<'div'>;
10
12
  trigger?: ComponentProps<'button'>;
11
13
  content?: ComponentProps<'div'>;
@@ -17,18 +19,21 @@ interface TOCProps {
17
19
  * Custom content in TOC container, after the main TOC
18
20
  */
19
21
  footer?: ReactNode;
20
- /**
21
- * @defaultValue 'normal'
22
- */
23
- style?: 'normal' | 'clerk';
24
- }
22
+ } & ({
23
+ style?: 'normal';
24
+ list?: TOCItemsProps$1;
25
+ } | {
26
+ style: 'clerk';
27
+ list?: TOCItemsProps;
28
+ });
25
29
  declare function TOC({
26
30
  container,
27
31
  trigger,
28
32
  content,
29
33
  header,
30
34
  footer,
31
- style
35
+ style,
36
+ list
32
37
  }: TOCProps): _$react_jsx_runtime0.JSX.Element;
33
38
  //#endregion
34
39
  export { TOC, TOCProps, TOCProvider, TOCProviderProps };
@@ -14,7 +14,7 @@ import { createPortal } from "react-dom";
14
14
  //#region src/layouts/flux/page/slots/toc.tsx
15
15
  const TocPopoverContext = createContext(null);
16
16
  const { TOCProvider } = toc_exports;
17
- function TOC({ container, trigger, content, header, footer, style = "normal" }) {
17
+ function TOC({ container, trigger, content, header, footer, style = "normal", list }) {
18
18
  const items = useTOCItems();
19
19
  const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
20
20
  return /* @__PURE__ */ jsxs(PageTOCPopover, {
@@ -23,7 +23,10 @@ function TOC({ container, trigger, content, header, footer, style = "normal" })
23
23
  ...content,
24
24
  children: [
25
25
  header,
26
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
26
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
27
+ ...list,
28
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
29
+ }) }),
27
30
  footer
28
31
  ]
29
32
  }), /* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger })]
@@ -35,20 +35,20 @@ interface FooterOptions extends FooterProps {
35
35
  */
36
36
  component?: ReactNode;
37
37
  }
38
- interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
38
+ type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
39
39
  enabled?: boolean;
40
40
  /**
41
41
  * @deprecated use `slots.toc` instead.
42
42
  */
43
43
  component?: ReactNode;
44
- }
45
- interface TableOfContentPopoverOptions extends TOCPopoverProps {
44
+ };
45
+ type TableOfContentPopoverOptions = TOCPopoverProps & {
46
46
  enabled?: boolean;
47
47
  /**
48
48
  * @deprecated use `slots.tocPopover` instead.
49
49
  */
50
50
  component?: ReactNode;
51
- }
51
+ };
52
52
  interface DocsPageSlots {
53
53
  toc: {
54
54
  provider: FC<TOCProviderProps>;
@@ -1,3 +1,5 @@
1
+ import { TOCItemsProps } from "../../../../components/toc/clerk.js";
2
+ import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
1
3
  import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
2
4
  import { ComponentProps, ReactNode } from "react";
3
5
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
@@ -5,7 +7,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
7
  //#region src/layouts/notebook/page/slots/toc.d.ts
6
8
  type TOCProviderProps = TOCProviderProps$1;
7
9
  declare function TOCProvider(props: TOCProviderProps): _$react_jsx_runtime0.JSX.Element;
8
- interface TOCProps {
10
+ type TOCProps = {
9
11
  container?: ComponentProps<'div'>;
10
12
  /**
11
13
  * Custom content in TOC container, before the main TOC
@@ -15,18 +17,21 @@ interface TOCProps {
15
17
  * Custom content in TOC container, after the main TOC
16
18
  */
17
19
  footer?: ReactNode;
18
- /**
19
- * @defaultValue 'normal'
20
- */
21
- style?: 'normal' | 'clerk';
22
- }
20
+ } & ({
21
+ style?: 'normal';
22
+ list?: TOCItemsProps$1;
23
+ } | {
24
+ style: 'clerk';
25
+ list?: TOCItemsProps;
26
+ });
23
27
  declare function TOC({
24
28
  container,
25
29
  header,
26
30
  footer,
27
- style
31
+ style,
32
+ list
28
33
  }: TOCProps): _$react_jsx_runtime0.JSX.Element;
29
- interface TOCPopoverProps {
34
+ type TOCPopoverProps = {
30
35
  container?: ComponentProps<'div'>;
31
36
  trigger?: ComponentProps<'button'>;
32
37
  content?: ComponentProps<'div'>;
@@ -38,18 +43,21 @@ interface TOCPopoverProps {
38
43
  * Custom content in TOC container, after the main TOC
39
44
  */
40
45
  footer?: ReactNode;
41
- /**
42
- * @defaultValue 'normal'
43
- */
44
- style?: 'normal' | 'clerk';
45
- }
46
+ } & ({
47
+ style?: 'normal';
48
+ list?: TOCItemsProps$1;
49
+ } | {
50
+ style: 'clerk';
51
+ list?: TOCItemsProps;
52
+ });
46
53
  declare function TOCPopover({
47
54
  container,
48
55
  trigger,
49
56
  content,
50
57
  header,
51
58
  footer,
52
- style
59
+ style,
60
+ list
53
61
  }: TOCPopoverProps): _$react_jsx_runtime0.JSX.Element;
54
62
  //#endregion
55
63
  export { TOC, TOCPopover, TOCPopoverProps, TOCProps, TOCProvider, TOCProviderProps };
@@ -14,7 +14,7 @@ import { ChevronDown, Text } from "lucide-react";
14
14
  function TOCProvider(props) {
15
15
  return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
16
16
  }
17
- function TOC({ container, header, footer, style = "normal" }) {
17
+ function TOC({ container, header, footer, style = "normal", list }) {
18
18
  const items = useTOCItems();
19
19
  const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
20
20
  return /* @__PURE__ */ jsxs("div", {
@@ -28,13 +28,16 @@ function TOC({ container, header, footer, style = "normal" }) {
28
28
  className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
29
29
  children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(I18nLabel, { label: "toc" })]
30
30
  }),
31
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
31
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
32
+ ...list,
33
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
34
+ }) }),
32
35
  footer
33
36
  ]
34
37
  });
35
38
  }
36
39
  const TocPopoverContext = createContext(null);
37
- function TOCPopover({ container, trigger, content, header, footer, style = "normal" }) {
40
+ function TOCPopover({ container, trigger, content, header, footer, style = "normal", list }) {
38
41
  const items = useTOCItems();
39
42
  const ref = useRef(null);
40
43
  const [open, setOpen] = useState(false);
@@ -71,10 +74,13 @@ function TOCPopover({ container, trigger, content, header, footer, style = "norm
71
74
  ...content,
72
75
  children: [
73
76
  header,
74
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
75
- item,
76
- onClick: onClickItem
77
- }, item.url))] }) }),
77
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
78
+ ...list,
79
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
80
+ item,
81
+ onClick: onClickItem
82
+ }, item.url))]
83
+ }) }),
78
84
  footer
79
85
  ]
80
86
  })]
package/dist/style.css CHANGED
@@ -1894,6 +1894,11 @@
1894
1894
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1895
1895
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1896
1896
  }
1897
+ .transition-\[offset-distance\] {
1898
+ transition-property: offset-distance;
1899
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1900
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
1901
+ }
1897
1902
  .transition-\[opacity\,translate\,color\] {
1898
1903
  transition-property: opacity,translate,color;
1899
1904
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "16.7.10",
3
+ "version": "16.7.12",
4
4
  "description": "The Radix UI version of Fumadocs UI",
5
5
  "keywords": [
6
6
  "Docs",
@@ -135,10 +135,11 @@
135
135
  "@radix-ui/react-slot": "^1.2.4",
136
136
  "@radix-ui/react-tabs": "^1.1.13",
137
137
  "class-variance-authority": "^0.7.1",
138
+ "fuma-cli": "^0.0.3",
138
139
  "lucide-react": "^1.7.0",
139
140
  "motion": "^12.38.0",
140
141
  "next-themes": "^0.4.6",
141
- "react-medium-image-zoom": "^5.4.1",
142
+ "react-medium-image-zoom": "^5.4.3",
142
143
  "react-remove-scroll": "^2.7.2",
143
144
  "rehype-raw": "^7.0.0",
144
145
  "scroll-into-view-if-needed": "^3.1.0",
@@ -151,15 +152,15 @@
151
152
  "@tsdown/css": "^0.21.6",
152
153
  "@types/hast": "^3.0.4",
153
154
  "@types/mdx": "^2.0.13",
154
- "@types/node": "^25.5.0",
155
+ "@types/node": "^25.5.2",
155
156
  "@types/react": "^19.2.14",
156
157
  "@types/react-dom": "^19.2.3",
157
158
  "shiki": "^4.0.2",
158
159
  "tailwindcss": "^4.2.2",
159
- "tsdown": "0.21.6",
160
+ "tsdown": "0.21.7",
160
161
  "unified": "^11.0.5",
161
- "@fumadocs/cli": "1.3.4",
162
- "fumadocs-core": "16.7.10",
162
+ "@fumadocs/cli": "1.3.5",
163
+ "fumadocs-core": "16.7.12",
163
164
  "tsconfig": "0.0.0"
164
165
  },
165
166
  "peerDependencies": {
@@ -170,7 +171,7 @@
170
171
  "react": "^19.2.0",
171
172
  "react-dom": "^19.2.0",
172
173
  "shiki": "*",
173
- "fumadocs-core": "16.7.10"
174
+ "fumadocs-core": "16.7.12"
174
175
  },
175
176
  "peerDependenciesMeta": {
176
177
  "next": {