@fumadocs/base-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");
@@ -212,6 +212,7 @@
212
212
  @source inline("component");
213
213
  @source inline("components");
214
214
  @source inline("composedRef");
215
+ @source inline("computed");
215
216
  @source inline("config");
216
217
  @source inline("const");
217
218
  @source inline("container");
@@ -551,6 +552,7 @@
551
552
  @source inline("isWindows");
552
553
  @source inline("it");
553
554
  @source inline("item");
555
+ @source inline("itemLineLengths");
554
556
  @source inline("itemVariants");
555
557
  @source inline("items");
556
558
  @source inline("items-center");
@@ -563,6 +565,7 @@
563
565
  @source inline("key");
564
566
  @source inline("keydown");
565
567
  @source inline("keyof");
568
+ @source inline("l");
566
569
  @source inline("label");
567
570
  @source inline("lang");
568
571
  @source inline("language");
@@ -715,12 +718,15 @@
715
718
  @source inline("of");
716
719
  @source inline("official");
717
720
  @source inline("offset");
721
+ @source inline("offsetDistance");
722
+ @source inline("offsetPath");
718
723
  @source inline("offsetTop");
719
724
  @source inline("on");
720
725
  @source inline("onAnimationEnd");
721
726
  @source inline("onChange");
722
727
  @source inline("onChangeRef");
723
728
  @source inline("onClick");
729
+ @source inline("onContainerResize");
724
730
  @source inline("onCopy");
725
731
  @source inline("onKey");
726
732
  @source inline("onKeyDown");
@@ -795,6 +801,7 @@
795
801
  @source inline("placeholder:text-fd-muted-foreground");
796
802
  @source inline("please");
797
803
  @source inline("pointerType");
804
+ @source inline("positions");
798
805
  @source inline("possible");
799
806
  @source inline("powered");
800
807
  @source inline("pre");
@@ -1055,6 +1062,7 @@
1055
1062
  @source inline("themes");
1056
1063
  @source inline("this");
1057
1064
  @source inline("throw");
1065
+ @source inline("thumbBox");
1058
1066
  @source inline("thumbRef");
1059
1067
  @source inline("tier");
1060
1068
  @source inline("timeoutRef");
@@ -1073,18 +1081,19 @@
1073
1081
  @source inline("top-2.5");
1074
1082
  @source inline("top-4");
1075
1083
  @source inline("top-[calc(50%-var(--t,0px)+var(--b,0px))]");
1084
+ @source inline("topL");
1076
1085
  @source inline("touch");
1077
1086
  @source inline("transform");
1078
1087
  @source inline("transition-[clip-path]");
1079
1088
  @source inline("transition-[height,opacity]");
1080
1089
  @source inline("transition-[height]");
1090
+ @source inline("transition-[offset-distance]");
1081
1091
  @source inline("transition-[opacity,transform,translate]");
1082
1092
  @source inline("transition-[opacity,transform,width,height,scale,translate]");
1083
1093
  @source inline("transition-all");
1084
1094
  @source inline("transition-colors");
1085
1095
  @source inline("transition-opacity");
1086
1096
  @source inline("transition-transform");
1087
- @source inline("translate");
1088
1097
  @source inline("translations");
1089
1098
  @source inline("transparent");
1090
1099
  @source inline("tree");
@@ -1110,7 +1119,6 @@
1110
1119
  @source inline("updated");
1111
1120
  @source inline("updates");
1112
1121
  @source inline("upper");
1113
- @source inline("upperBottom");
1114
1122
  @source inline("upperOffset");
1115
1123
  @source inline("upperX");
1116
1124
  @source inline("url");
@@ -1176,6 +1184,7 @@
1176
1184
  @source inline("when");
1177
1185
  @source inline("where");
1178
1186
  @source inline("whether");
1187
+ @source inline("while");
1179
1188
  @source inline("white");
1180
1189
  @source inline("whitespace-nowrap");
1181
1190
  @source inline("whitespaces");
@@ -1191,6 +1200,7 @@
1191
1200
  @source inline("wrapped");
1192
1201
  @source inline("x");
1193
1202
  @source inline("xmlns");
1203
+ @source inline("y");
1194
1204
  @source inline("you");
1195
1205
  @source inline("your");
1196
1206
  @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 { AnimatePresence, motion } from "motion/react";
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
@@ -1885,6 +1885,11 @@
1885
1885
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1886
1886
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1887
1887
  }
1888
+ .transition-\[offset-distance\] {
1889
+ transition-property: offset-distance;
1890
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1891
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
1892
+ }
1888
1893
  .transition-\[opacity\,transform\,translate\] {
1889
1894
  transition-property: opacity,transform,translate;
1890
1895
  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/base-ui",
3
- "version": "16.7.10",
3
+ "version": "16.7.12",
4
4
  "description": "The Base UI version of Fumadocs UI",
5
5
  "keywords": [
6
6
  "Docs",
@@ -118,10 +118,11 @@
118
118
  "dependencies": {
119
119
  "@base-ui/react": "^1.3.0",
120
120
  "class-variance-authority": "^0.7.1",
121
+ "fuma-cli": "^0.0.3",
121
122
  "lucide-react": "^1.7.0",
122
123
  "motion": "^12.38.0",
123
124
  "next-themes": "^0.4.6",
124
- "react-medium-image-zoom": "^5.4.1",
125
+ "react-medium-image-zoom": "^5.4.3",
125
126
  "react-remove-scroll": "^2.7.2",
126
127
  "rehype-raw": "^7.0.0",
127
128
  "scroll-into-view-if-needed": "^3.1.0",
@@ -134,15 +135,15 @@
134
135
  "@tsdown/css": "^0.21.6",
135
136
  "@types/hast": "^3.0.4",
136
137
  "@types/mdx": "^2.0.13",
137
- "@types/node": "^25.5.0",
138
+ "@types/node": "^25.5.2",
138
139
  "@types/react": "^19.2.14",
139
140
  "@types/react-dom": "^19.2.3",
140
141
  "shiki": "^4.0.2",
141
142
  "tailwindcss": "^4.2.2",
142
- "tsdown": "0.21.6",
143
+ "tsdown": "0.21.7",
143
144
  "unified": "^11.0.5",
144
- "@fumadocs/cli": "1.3.4",
145
- "fumadocs-core": "16.7.10",
145
+ "@fumadocs/cli": "1.3.5",
146
+ "fumadocs-core": "16.7.12",
146
147
  "tsconfig": "0.0.0"
147
148
  },
148
149
  "peerDependencies": {
@@ -153,7 +154,7 @@
153
154
  "react": "^19.2.0",
154
155
  "react-dom": "^19.2.0",
155
156
  "shiki": "*",
156
- "fumadocs-core": "16.7.10"
157
+ "fumadocs-core": "16.7.12"
157
158
  },
158
159
  "peerDependenciesMeta": {
159
160
  "shiki": {