fumadocs-ui 16.7.3 → 16.7.5

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.
@@ -39,7 +39,6 @@
39
39
  @source inline("[grid-area:toc]");
40
40
  @source inline("a");
41
41
  @source inline("absolute");
42
- @source inline("active");
43
42
  @source inline("after");
44
43
  @source inline("all");
45
44
  @source inline("always");
@@ -223,6 +222,7 @@
223
222
  @source inline("inset-0");
224
223
  @source inline("inset-y-0");
225
224
  @source inline("inset-y-2");
225
+ @source inline("instanceof");
226
226
  @source inline("interface");
227
227
  @source inline("invisible");
228
228
  @source inline("isActive");
@@ -300,6 +300,8 @@
300
300
  @source inline("of");
301
301
  @source inline("on");
302
302
  @source inline("onClick");
303
+ @source inline("onClickItem");
304
+ @source inline("onClickOutside");
303
305
  @source inline("onOpenChange");
304
306
  @source inline("opacity-0");
305
307
  @source inline("open");
@@ -364,6 +366,7 @@
364
366
  @source inline("searchTrigger");
365
367
  @source inline("secondary");
366
368
  @source inline("selected");
369
+ @source inline("selectedIdx");
367
370
  @source inline("setDate");
368
371
  @source inline("setOpen");
369
372
  @source inline("shadow-lg");
@@ -17,7 +17,6 @@
17
17
  @source inline("[grid-area:main]");
18
18
  @source inline("a");
19
19
  @source inline("absolute");
20
- @source inline("active");
21
20
  @source inline("after");
22
21
  @source inline("align");
23
22
  @source inline("all");
@@ -43,7 +43,6 @@
43
43
  @source inline("[grid-area:toc]");
44
44
  @source inline("a");
45
45
  @source inline("absolute");
46
- @source inline("active");
47
46
  @source inline("after");
48
47
  @source inline("all");
49
48
  @source inline("always");
@@ -240,6 +239,7 @@
240
239
  @source inline("inset-0");
241
240
  @source inline("inset-y-0");
242
241
  @source inline("inset-y-2");
242
+ @source inline("instanceof");
243
243
  @source inline("interface");
244
244
  @source inline("invisible");
245
245
  @source inline("isActive");
@@ -331,6 +331,8 @@
331
331
  @source inline("of");
332
332
  @source inline("on");
333
333
  @source inline("onClick");
334
+ @source inline("onClickItem");
335
+ @source inline("onClickOutside");
334
336
  @source inline("onOpenChange");
335
337
  @source inline("onPointerEnter");
336
338
  @source inline("onPointerLeave");
@@ -104,8 +104,7 @@
104
104
  @source inline("at");
105
105
  @source inline("attribute");
106
106
  @source inline("await");
107
- @source inline("b1");
108
- @source inline("b2");
107
+ @source inline("b0");
109
108
  @source inline("backdrop-blur-lg");
110
109
  @source inline("backdrop-blur-xs");
111
110
  @source inline("background");
@@ -137,7 +136,6 @@
137
136
  @source inline("bg-fd-primary/10");
138
137
  @source inline("bg-fd-secondary");
139
138
  @source inline("bg-fd-secondary/50");
140
- @source inline("bg-linear-to-t");
141
139
  @source inline("bg-transparent");
142
140
  @source inline("bind");
143
141
  @source inline("binded");
@@ -291,7 +289,6 @@
291
289
  @source inline("defineI18nUI");
292
290
  @source inline("defined");
293
291
  @source inline("delay");
294
- @source inline("delay-25");
295
292
  @source inline("dependencies");
296
293
  @source inline("depends");
297
294
  @source inline("deprecated");
@@ -332,6 +329,7 @@
332
329
  @source inline("enabled");
333
330
  @source inline("end");
334
331
  @source inline("end-2");
332
+ @source inline("endIdx");
335
333
  @source inline("endpoint");
336
334
  @source inline("environment");
337
335
  @source inline("equal");
@@ -430,7 +428,6 @@
430
428
  @source inline("guides");
431
429
  @source inline("h");
432
430
  @source inline("h-(--fd-animated-height)");
433
- @source inline("h-(--fd-height)");
434
431
  @source inline("h-(--radix-navigation-menu-viewport-height)");
435
432
  @source inline("h-1.5");
436
433
  @source inline("h-9.5");
@@ -464,7 +461,6 @@
464
461
  @source inline("hover:bg-fd-accent");
465
462
  @source inline("hover:bg-fd-accent/80");
466
463
  @source inline("hover:bg-fd-primary/80");
467
- @source inline("hover:delay-0");
468
464
  @source inline("hover:text-fd-accent-foreground");
469
465
  @source inline("hovered");
470
466
  @source inline("href");
@@ -477,7 +473,6 @@
477
473
  @source inline("iconClass");
478
474
  @source inline("id");
479
475
  @source inline("idea");
480
- @source inline("ids");
481
476
  @source inline("idx");
482
477
  @source inline("if");
483
478
  @source inline("if-needed");
@@ -494,6 +489,7 @@
494
489
  @source inline("inputType");
495
490
  @source inline("insert");
496
491
  @source inline("inset-0");
492
+ @source inline("inset-s-0");
497
493
  @source inline("inset-x-0");
498
494
  @source inline("inset-x-2");
499
495
  @source inline("inset-y-0");
@@ -508,6 +504,7 @@
508
504
  @source inline("isActive");
509
505
  @source inline("isLoading");
510
506
  @source inline("isOpen");
507
+ @source inline("isStart");
511
508
  @source inline("isTabActive");
512
509
  @source inline("isWindows");
513
510
  @source inline("it");
@@ -530,6 +527,7 @@
530
527
  @source inline("languages");
531
528
  @source inline("last:pb-0");
532
529
  @source inline("last:rounded-b-xl");
530
+ @source inline("lastInactiveIdx");
533
531
  @source inline("lastUpdate");
534
532
  @source inline("layer");
535
533
  @source inline("layout");
@@ -685,6 +683,7 @@
685
683
  @source inline("onPointerLeave");
686
684
  @source inline("onPointerMove");
687
685
  @source inline("onPrint");
686
+ @source inline("onResize");
688
687
  @source inline("onSearchChange");
689
688
  @source inline("onSearchChangeCallback");
690
689
  @source inline("onSelect");
@@ -850,7 +849,6 @@
850
849
  @source inline("round");
851
850
  @source inline("rounded-2xl");
852
851
  @source inline("rounded-[inherit]");
853
- @source inline("rounded-e-full");
854
852
  @source inline("rounded-full");
855
853
  @source inline("rounded-lg");
856
854
  @source inline("rounded-md");
@@ -868,6 +866,7 @@
868
866
  @source inline("scroll-m-20");
869
867
  @source inline("scroll-m-24");
870
868
  @source inline("scroll-m-28");
869
+ @source inline("scroll-m-4");
871
870
  @source inline("scrollIntoView");
872
871
  @source inline("scrollMode");
873
872
  @source inline("scrollY");
@@ -940,9 +939,9 @@
940
939
  @source inline("specific");
941
940
  @source inline("src");
942
941
  @source inline("stars");
943
- @source inline("start-0");
944
942
  @source inline("start-3");
945
943
  @source inline("start-6");
944
+ @source inline("startIdx");
946
945
  @source inline("state");
947
946
  @source inline("static");
948
947
  @source inline("sticky");
@@ -963,11 +962,9 @@
963
962
  @source inline("supposed");
964
963
  @source inline("sure");
965
964
  @source inline("svg");
966
- @source inline("svgRef");
967
965
  @source inline("switch");
968
966
  @source inline("system");
969
967
  @source inline("t");
970
- @source inline("t2");
971
968
  @source inline("tab");
972
969
  @source inline("tabIndex");
973
970
  @source inline("table");
@@ -1022,7 +1019,6 @@
1022
1019
  @source inline("tocNoHeadings");
1023
1020
  @source inline("toolbar");
1024
1021
  @source inline("top");
1025
- @source inline("top-(--fd-top)");
1026
1022
  @source inline("top-0");
1027
1023
  @source inline("top-1.5");
1028
1024
  @source inline("top-1/2");
@@ -1033,14 +1029,12 @@
1033
1029
  @source inline("transform");
1034
1030
  @source inline("transition-[clip-path]");
1035
1031
  @source inline("transition-[height]");
1036
- @source inline("transition-[top,height]");
1037
1032
  @source inline("transition-[width,height]");
1038
1033
  @source inline("transition-all");
1039
1034
  @source inline("transition-colors");
1040
1035
  @source inline("transition-opacity");
1041
1036
  @source inline("transition-transform");
1042
1037
  @source inline("translate");
1043
- @source inline("translate-y-1/2");
1044
1038
  @source inline("translations");
1045
1039
  @source inline("transparent");
1046
1040
  @source inline("tree");
@@ -1072,12 +1066,12 @@
1072
1066
  @source inline("urls");
1073
1067
  @source inline("usage");
1074
1068
  @source inline("use");
1075
- @source inline("useActiveAnchors");
1076
1069
  @source inline("useCopyButton");
1077
1070
  @source inline("useDocsSearch");
1078
1071
  @source inline("useI18n");
1079
1072
  @source inline("useId");
1080
1073
  @source inline("useIsDocsLayout");
1074
+ @source inline("useItems");
1081
1075
  @source inline("useMediaQuery");
1082
1076
  @source inline("useMemo");
1083
1077
  @source inline("useOnChange");
@@ -1106,7 +1100,6 @@
1106
1100
  @source inline("variants");
1107
1101
  @source inline("vertical");
1108
1102
  @source inline("via");
1109
- @source inline("via-fd-primary");
1110
1103
  @source inline("viewBox");
1111
1104
  @source inline("viewRef");
1112
1105
  @source inline("viewport");
@@ -1,5 +1,6 @@
1
1
  import { ComponentProps } from "react";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as Primitive from "fumadocs-core/toc";
3
4
 
4
5
  //#region src/components/toc/clerk.d.ts
5
6
  declare function TOCItems({
@@ -7,5 +8,12 @@ declare function TOCItems({
7
8
  className,
8
9
  ...props
9
10
  }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
11
+ declare function TOCEmpty(): react_jsx_runtime0.JSX.Element;
12
+ declare function TOCItem({
13
+ item,
14
+ ...props
15
+ }: Primitive.TOCItemProps & {
16
+ item: Primitive.TOCItemType;
17
+ }): react_jsx_runtime0.JSX.Element;
10
18
  //#endregion
11
- export { TOCItems };
19
+ export { TOCEmpty, TOCItem, TOCItems };
@@ -1,62 +1,61 @@
1
1
  "use client";
2
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
3
  import { useI18n } from "../../contexts/i18n.js";
3
4
  import { cn } from "../../utils/cn.js";
4
5
  import { mergeRefs } from "../../utils/merge-refs.js";
5
6
  import { TocThumb, useTOCItems } from "./index.js";
6
- import { useEffect, useRef, useState } from "react";
7
+ import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
7
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
9
  import * as Primitive from "fumadocs-core/toc";
9
10
  //#region src/components/toc/clerk.tsx
11
+ var clerk_exports = /* @__PURE__ */ __exportAll({
12
+ TOCEmpty: () => TOCEmpty,
13
+ TOCItem: () => TOCItem,
14
+ TOCItems: () => TOCItems
15
+ });
10
16
  function TOCItems({ ref, className, ...props }) {
11
17
  const containerRef = useRef(null);
12
18
  const items = useTOCItems();
13
- const { text } = useI18n();
14
- const svgRef = useRef(null);
15
19
  const [svg, setSvg] = useState();
16
- useEffect(() => {
17
- if (!containerRef.current) return;
20
+ const onResize = useEffectEvent(() => {
18
21
  const container = containerRef.current;
19
- function onResize() {
20
- if (container.clientHeight === 0) return;
21
- let w = 0, h = 0, b1 = 0, d = "";
22
- for (let i = 0; i < items.length; i++) {
23
- const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
24
- if (!element) continue;
25
- const styles = getComputedStyle(element);
26
- const offset = getLineOffset(items[i].depth) + 1, t2 = element.offsetTop + parseFloat(styles.paddingTop), b2 = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
27
- w = Math.max(offset, w);
28
- h = Math.max(h, b2);
29
- if (i === 0) d += ` M${offset} ${t2} L${offset} ${b2}`;
30
- else {
31
- const pOffset = getLineOffset(items[i - 1].depth) + 1;
32
- d += ` C ${pOffset} ${t2 - 4} ${offset} ${b1 + 4} ${offset} ${t2} L${offset} ${b2}`;
33
- }
34
- b1 = b2;
35
- }
36
- w += 1;
37
- if (!svgRef.current || svgRef.current.d !== d) {
38
- svgRef.current = {
39
- d,
40
- width: w,
41
- height: h
42
- };
43
- setSvg(svgRef.current);
22
+ if (!container || container.clientHeight === 0) return;
23
+ let w = 0;
24
+ let h = 0;
25
+ let b0 = 0;
26
+ let d = "";
27
+ for (let i = 0; i < items.length; i++) {
28
+ const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
29
+ if (!element) continue;
30
+ const styles = getComputedStyle(element);
31
+ const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
32
+ w = Math.max(offset, w);
33
+ h = Math.max(h, bottom);
34
+ if (i === 0) d += ` M${offset} ${top} L${offset} ${bottom}`;
35
+ else {
36
+ const pOffset = getLineOffset(items[i - 1].depth) + 1;
37
+ d += ` C ${pOffset} ${top - 4} ${offset} ${b0 + 4} ${offset} ${top} L${offset} ${bottom}`;
44
38
  }
39
+ b0 = bottom;
45
40
  }
41
+ setSvg({
42
+ d,
43
+ width: w + 1,
44
+ height: h
45
+ });
46
+ });
47
+ useEffect(() => {
48
+ if (!containerRef.current) return;
46
49
  const observer = new ResizeObserver(onResize);
47
50
  onResize();
48
- observer.observe(container);
51
+ observer.observe(containerRef.current);
49
52
  return () => {
50
53
  observer.disconnect();
51
54
  };
52
- }, [items]);
53
- if (items.length === 0) return /* @__PURE__ */ jsx("div", {
54
- className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
55
- children: text.tocNoHeadings
56
- });
55
+ }, []);
57
56
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsxs(TocThumb, {
58
57
  containerRef,
59
- className: "absolute top-0 start-0",
58
+ className: "absolute top-0 inset-s-0",
60
59
  style: {
61
60
  width: svg.width,
62
61
  height: svg.height
@@ -64,7 +63,7 @@ function TOCItems({ ref, className, ...props }) {
64
63
  children: [/* @__PURE__ */ jsx("svg", {
65
64
  xmlns: "http://www.w3.org/2000/svg",
66
65
  viewBox: `0 0 ${svg.width} ${svg.height}`,
67
- className: "absolute inset-0 transition-[clip-path] delay-25",
66
+ className: "absolute transition-[clip-path]",
68
67
  style: {
69
68
  width: svg.width,
70
69
  height: svg.height,
@@ -80,22 +79,33 @@ function TOCItems({ ref, className, ...props }) {
80
79
  }), /* @__PURE__ */ jsx("div", {
81
80
  ref: mergeRefs(containerRef, ref),
82
81
  className: cn("flex flex-col", className),
83
- ...props,
84
- children: items.map((item, i) => /* @__PURE__ */ jsx(TOCItem, {
85
- item,
86
- upper: items[i - 1]?.depth,
87
- lower: items[i + 1]?.depth
88
- }, item.url))
82
+ ...props
89
83
  })] });
90
84
  }
85
+ function TOCEmpty() {
86
+ const { text } = useI18n();
87
+ return /* @__PURE__ */ jsx("div", {
88
+ className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
89
+ children: text.tocNoHeadings
90
+ });
91
+ }
91
92
  function ThumbBox() {
92
- const items = useTOCItems();
93
- const ids = Primitive.useActiveAnchors();
94
- const item = items.findLast((item) => ids.includes(item.url.slice(1)));
95
- if (!item) return;
93
+ const items = Primitive.useItems();
94
+ let startIdx = -1;
95
+ let endIdx = -1;
96
+ let lastInactiveIdx = -1;
97
+ for (let i = 0; i < items.length; i++) {
98
+ const item = items[i];
99
+ if (item.active) {
100
+ if (startIdx === -1) startIdx = i;
101
+ endIdx = i;
102
+ } else if (lastInactiveIdx === -1 || items[lastInactiveIdx].t < item.t) lastInactiveIdx = i;
103
+ }
104
+ if (startIdx === -1) return;
105
+ const isStart = endIdx < lastInactiveIdx;
96
106
  return /* @__PURE__ */ jsx("div", {
97
- className: "absolute size-1 bg-fd-primary rounded-full delay-25 transition-transform",
98
- style: { translate: `calc(${getLineOffset(item.depth)}px - 1.25px) calc(var(--fd-top) + var(--fd-height))` }
107
+ className: "absolute size-1 bg-fd-primary rounded-full transition-transform",
108
+ style: { translate: `calc(${getLineOffset(items[isStart ? startIdx : endIdx].original.depth)}px - 1.25px) ${isStart ? "var(--fd-top)" : "calc(var(--fd-top) + var(--fd-height))"}` }
99
109
  });
100
110
  }
101
111
  function getItemOffset(depth) {
@@ -108,12 +118,25 @@ function getLineOffset(depth) {
108
118
  if (depth === 3) return 10;
109
119
  return 20;
110
120
  }
111
- function TOCItem({ item, upper = item.depth, lower = item.depth }) {
112
- const offset = getLineOffset(item.depth), upperOffset = getLineOffset(upper), lowerOffset = getLineOffset(lower);
121
+ function TOCItem({ item, ...props }) {
122
+ const items = useTOCItems();
123
+ const { lowerOffset, offset, upperOffset } = useMemo(() => {
124
+ const index = items.indexOf(item);
125
+ const offset = getLineOffset(item.depth);
126
+ return {
127
+ offset,
128
+ upperOffset: index > 0 ? getLineOffset(items[index - 1].depth) : offset,
129
+ lowerOffset: index + 1 < items.length ? getLineOffset(items[index + 1].depth) : offset
130
+ };
131
+ }, [items, item]);
113
132
  return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
114
133
  href: item.url,
115
- style: { paddingInlineStart: getItemOffset(item.depth) },
116
- className: "prose relative py-1.5 text-sm text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
134
+ ...props,
135
+ className: cn("prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary", props.className),
136
+ style: {
137
+ paddingInlineStart: getItemOffset(item.depth),
138
+ ...props.style
139
+ },
117
140
  children: [
118
141
  offset !== upperOffset && /* @__PURE__ */ jsx("svg", {
119
142
  xmlns: "http://www.w3.org/2000/svg",
@@ -141,4 +164,4 @@ function TOCItem({ item, upper = item.depth, lower = item.depth }) {
141
164
  });
142
165
  }
143
166
  //#endregion
144
- export { TOCItems };
167
+ export { TOCEmpty, TOCItem, TOCItems, clerk_exports };
@@ -1,5 +1,6 @@
1
1
  import { ComponentProps } from "react";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as Primitive from "fumadocs-core/toc";
3
4
 
4
5
  //#region src/components/toc/default.d.ts
5
6
  declare function TOCItems({
@@ -7,5 +8,12 @@ declare function TOCItems({
7
8
  className,
8
9
  ...props
9
10
  }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
11
+ declare function TOCEmpty(): react_jsx_runtime0.JSX.Element;
12
+ declare function TOCItem({
13
+ item,
14
+ ...props
15
+ }: Primitive.TOCItemProps & {
16
+ item: Primitive.TOCItemType;
17
+ }): react_jsx_runtime0.JSX.Element;
10
18
  //#endregion
11
- export { TOCItems };
19
+ export { TOCEmpty, TOCItem, TOCItems };
@@ -1,38 +1,47 @@
1
1
  "use client";
2
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
3
  import { useI18n } from "../../contexts/i18n.js";
3
4
  import { cn } from "../../utils/cn.js";
4
5
  import { mergeRefs } from "../../utils/merge-refs.js";
5
- import { TocThumb, useTOCItems } from "./index.js";
6
+ import { TocThumb } from "./index.js";
6
7
  import { useRef } from "react";
7
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import * as Primitive from "fumadocs-core/toc";
9
10
  //#region src/components/toc/default.tsx
11
+ var default_exports = /* @__PURE__ */ __exportAll({
12
+ TOCEmpty: () => TOCEmpty,
13
+ TOCItem: () => TOCItem,
14
+ TOCItems: () => TOCItems
15
+ });
10
16
  function TOCItems({ ref, className, ...props }) {
11
17
  const containerRef = useRef(null);
12
- const items = useTOCItems();
18
+ return /* @__PURE__ */ jsxs("div", {
19
+ className: "relative",
20
+ children: [/* @__PURE__ */ jsx(TocThumb, {
21
+ containerRef,
22
+ className: "absolute inset-y-0 inset-s-0 bg-fd-primary w-px transition-[clip-path]",
23
+ style: { 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)))" }
24
+ }), /* @__PURE__ */ jsx("div", {
25
+ ref: mergeRefs(ref, containerRef),
26
+ className: cn("flex flex-col border-s border-fd-foreground/10", className),
27
+ ...props
28
+ })]
29
+ });
30
+ }
31
+ function TOCEmpty() {
13
32
  const { text } = useI18n();
14
- if (items.length === 0) return /* @__PURE__ */ jsx("div", {
33
+ return /* @__PURE__ */ jsx("div", {
15
34
  className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
16
35
  children: text.tocNoHeadings
17
36
  });
18
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(TocThumb, {
19
- containerRef,
20
- align: "center",
21
- className: "absolute top-(--fd-top) h-(--fd-height) w-px bg-linear-to-t via-fd-primary transition-[top,height] delay-25",
22
- children: [/* @__PURE__ */ jsx("div", { className: "absolute top-0 -translate-y-1/2 size-1 rounded-e-full bg-fd-primary" }), /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 translate-y-1/2 size-1 rounded-e-full bg-fd-primary" })]
23
- }), /* @__PURE__ */ jsx("div", {
24
- ref: mergeRefs(ref, containerRef),
25
- className: cn("flex flex-col border-s border-fd-foreground/10", className),
26
- ...props,
27
- children: items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))
28
- })] });
29
37
  }
30
- function TOCItem({ item }) {
38
+ function TOCItem({ item, ...props }) {
31
39
  return /* @__PURE__ */ jsx(Primitive.TOCItem, {
32
40
  href: item.url,
33
- className: cn("prose py-1.5 text-sm text-fd-muted-foreground transition-colors delay-25 wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary hover:text-fd-accent-foreground hover:delay-0", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8"),
41
+ ...props,
42
+ className: cn("prose py-1.5 text-sm text-fd-muted-foreground scroll-m-4 transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary hover:text-fd-accent-foreground", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8", props.className),
34
43
  children: item.title
35
44
  });
36
45
  }
37
46
  //#endregion
38
- export { TOCItems };
47
+ export { TOCEmpty, TOCItem, TOCItems, default_exports };
@@ -5,7 +5,7 @@ import * as Primitive from "fumadocs-core/toc";
5
5
  //#region src/components/toc/index.d.ts
6
6
  declare function useTOCItems(): Primitive.TOCItemType[];
7
7
  type TOCProviderProps = Primitive.AnchorProviderProps;
8
- declare const useActiveAnchor: typeof Primitive.useActiveAnchor, useActiveAnchors: typeof Primitive.useActiveAnchors;
8
+ declare const useActiveAnchor: typeof Primitive.useActiveAnchor, useActiveAnchors: typeof Primitive.useActiveAnchors, useItems: typeof Primitive.useItems;
9
9
  declare function TOCProvider({
10
10
  toc,
11
11
  children,
@@ -26,4 +26,4 @@ declare function TocThumb({
26
26
  ...props
27
27
  }: TocThumbProps): react_jsx_runtime0.JSX.Element;
28
28
  //#endregion
29
- export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useTOCItems };
29
+ export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
@@ -13,13 +13,14 @@ var toc_exports = /* @__PURE__ */ __exportAll({
13
13
  TocThumb: () => TocThumb,
14
14
  useActiveAnchor: () => useActiveAnchor,
15
15
  useActiveAnchors: () => useActiveAnchors,
16
+ useItems: () => useItems,
16
17
  useTOCItems: () => useTOCItems
17
18
  });
18
19
  const TOCContext = createContext([]);
19
20
  function useTOCItems() {
20
21
  return use(TOCContext);
21
22
  }
22
- const { useActiveAnchor, useActiveAnchors } = Primitive;
23
+ const { useActiveAnchor, useActiveAnchors, useItems } = Primitive;
23
24
  function TOCProvider({ toc, children, ...props }) {
24
25
  return /* @__PURE__ */ jsx(TOCContext, {
25
26
  value: toc,
@@ -103,4 +104,4 @@ function TocThumb({ containerRef, align = "end", ...props }) {
103
104
  });
104
105
  }
105
106
  //#endregion
106
- export { TOCProvider, TOCScrollArea, TocThumb, toc_exports, useActiveAnchor, useActiveAnchors, useTOCItems };
107
+ export { TOCProvider, TOCScrollArea, TocThumb, toc_exports, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
5
5
  declare const buttonVariants: (props?: ({
6
6
  variant?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
7
7
  color?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
8
- size?: "sm" | "icon" | "icon-sm" | "icon-xs" | null | undefined;
8
+ size?: "icon" | "sm" | "icon-sm" | "icon-xs" | null | undefined;
9
9
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
10
10
  type ButtonProps = VariantProps<typeof buttonVariants>;
11
11
  //#endregion
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { I18nLabel, useI18n } from "../../../../contexts/i18n.js";
3
3
  import { cn } from "../../../../utils/cn.js";
4
- import { TOCProvider as TOCProvider$1, TOCScrollArea, useActiveAnchor, useTOCItems } from "../../../../components/toc/index.js";
5
- import { TOCItems } from "../../../../components/toc/default.js";
6
- import { TOCItems as TOCItems$1 } from "../../../../components/toc/clerk.js";
4
+ import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
5
+ import { default_exports } from "../../../../components/toc/default.js";
6
+ import { clerk_exports } from "../../../../components/toc/clerk.js";
7
7
  import { useTreePath } from "../../../../contexts/tree.js";
8
8
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
9
9
  import { useDocsLayout } from "../../client.js";
@@ -15,7 +15,9 @@ 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 }) {
18
+ function TOC({ container, header, footer, style = "normal" }) {
19
+ const items = useTOCItems();
20
+ const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
19
21
  return /* @__PURE__ */ jsxs("div", {
20
22
  id: "nd-toc",
21
23
  ...container,
@@ -27,37 +29,29 @@ function TOC({ container, header, footer, style }) {
27
29
  className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
28
30
  children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(I18nLabel, { label: "toc" })]
29
31
  }),
30
- /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
32
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
31
33
  footer
32
34
  ]
33
35
  });
34
36
  }
35
37
  const TocPopoverContext = createContext(null);
36
- function TOCPopover({ container, trigger, content, header, footer, style }) {
37
- return /* @__PURE__ */ jsxs(PageTOCPopover, {
38
- ...container,
39
- children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsx(PageTOCPopoverContent, {
40
- ...content,
41
- children: /* @__PURE__ */ jsxs("div", { children: [
42
- header,
43
- /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
44
- footer
45
- ] })
46
- })]
47
- });
48
- }
49
- function PageTOCPopover({ className, children, ...rest }) {
38
+ function TOCPopover({ container, trigger, content, header, footer, style = "normal" }) {
39
+ const items = useTOCItems();
50
40
  const ref = useRef(null);
51
41
  const [open, setOpen] = useState(false);
52
42
  const { isNavTransparent } = useDocsLayout();
53
- const onClick = useEffectEvent((e) => {
54
- if (!open) return;
43
+ const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
44
+ const onClickOutside = useEffectEvent((e) => {
45
+ if (!open || !(e.target instanceof HTMLElement)) return;
55
46
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
56
47
  });
48
+ const onClickItem = () => {
49
+ setOpen(false);
50
+ };
57
51
  useEffect(() => {
58
- window.addEventListener("click", onClick);
52
+ window.addEventListener("click", onClickOutside);
59
53
  return () => {
60
- window.removeEventListener("click", onClick);
54
+ window.removeEventListener("click", onClickOutside);
61
55
  };
62
56
  }, []);
63
57
  return /* @__PURE__ */ jsx(TocPopoverContext, {
@@ -69,12 +63,22 @@ function PageTOCPopover({ className, children, ...rest }) {
69
63
  open,
70
64
  onOpenChange: setOpen,
71
65
  "data-toc-popover": "",
72
- className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", className),
73
- ...rest,
74
- children: /* @__PURE__ */ jsx("header", {
66
+ ...container,
67
+ className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
68
+ children: /* @__PURE__ */ jsxs("header", {
75
69
  ref,
76
70
  className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
77
- children
71
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
72
+ ...content,
73
+ children: [
74
+ 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))] }) }),
79
+ footer
80
+ ]
81
+ })]
78
82
  })
79
83
  })
80
84
  });
@@ -82,18 +86,17 @@ function PageTOCPopover({ className, children, ...rest }) {
82
86
  function PageTOCPopoverTrigger({ className, ...props }) {
83
87
  const { text } = useI18n();
84
88
  const { open } = use(TocPopoverContext);
85
- const items = useTOCItems();
86
- const active = useActiveAnchor();
87
- const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
89
+ const items = useItems();
90
+ const selectedIdx = items.findIndex((item) => item.active);
88
91
  const path = useTreePath().at(-1);
89
- const showItem = selected !== -1 && !open;
92
+ const showItem = selectedIdx !== -1 && !open;
90
93
  return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
91
94
  className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
92
95
  "data-toc-popover-trigger": "",
93
96
  ...props,
94
97
  children: [
95
98
  /* @__PURE__ */ jsx(ProgressCircle, {
96
- value: (selected + 1) / Math.max(1, items.length),
99
+ value: (selectedIdx + 1) / Math.max(1, items.length),
97
100
  max: 1,
98
101
  className: cn("shrink-0", open && "text-fd-primary")
99
102
  }),
@@ -104,7 +107,7 @@ function PageTOCPopoverTrigger({ className, ...props }) {
104
107
  children: path?.name ?? text.toc
105
108
  }), /* @__PURE__ */ jsx("span", {
106
109
  className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
107
- children: items[selected]?.title
110
+ children: items[selectedIdx]?.original.title
108
111
  })]
109
112
  }),
110
113
  /* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
@@ -153,8 +156,10 @@ function PageTOCPopoverContent(props) {
153
156
  return /* @__PURE__ */ jsx(CollapsibleContent, {
154
157
  "data-toc-popover-content": "",
155
158
  ...props,
156
- className: cn("flex flex-col px-4 max-h-[50vh] md:px-6", props.className),
157
- children: props.children
159
+ children: /* @__PURE__ */ jsx("div", {
160
+ className: "flex flex-col px-4 max-h-[50vh] md:px-6",
161
+ children: props.children
162
+ })
158
163
  });
159
164
  }
160
165
  //#endregion
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { useI18n } from "../../../../contexts/i18n.js";
3
3
  import { cn } from "../../../../utils/cn.js";
4
- import { TOCScrollArea, toc_exports, useActiveAnchor, useTOCItems } from "../../../../components/toc/index.js";
5
- import { TOCItems } from "../../../../components/toc/default.js";
6
- import { TOCItems as TOCItems$1 } from "../../../../components/toc/clerk.js";
4
+ import { TOCScrollArea, toc_exports, useItems, useTOCItems } from "../../../../components/toc/index.js";
5
+ import { default_exports } from "../../../../components/toc/default.js";
6
+ import { clerk_exports } from "../../../../components/toc/clerk.js";
7
7
  import { useTreePath } from "../../../../contexts/tree.js";
8
8
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
9
9
  import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
@@ -14,16 +14,18 @@ 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 }) {
17
+ function TOC({ container, trigger, content, header, footer, style = "normal" }) {
18
+ const items = useTOCItems();
19
+ const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
18
20
  return /* @__PURE__ */ jsxs(PageTOCPopover, {
19
21
  ...container,
20
- children: [/* @__PURE__ */ jsx(PageTOCPopoverContent, {
22
+ children: [/* @__PURE__ */ jsxs(PageTOCPopoverContent, {
21
23
  ...content,
22
- children: /* @__PURE__ */ jsxs("div", { children: [
24
+ children: [
23
25
  header,
24
- /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
26
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
25
27
  footer
26
- ] })
28
+ ]
27
29
  }), /* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger })]
28
30
  });
29
31
  }
@@ -72,9 +74,8 @@ function PageTOCPopoverPhysical({ className, children, ...rest }) {
72
74
  function PageTOCPopoverTrigger({ className, ...props }) {
73
75
  const { text } = useI18n();
74
76
  const { open } = use(TocPopoverContext);
75
- const items = useTOCItems();
76
- const active = useActiveAnchor();
77
- const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
77
+ const items = useItems();
78
+ const selectedIdx = items.findIndex((item) => item.active);
78
79
  const path = useTreePath().at(-1);
79
80
  const spanProps = {
80
81
  transition: { duration: .1 },
@@ -98,16 +99,16 @@ function PageTOCPopoverTrigger({ className, ...props }) {
98
99
  ...props,
99
100
  children: [
100
101
  /* @__PURE__ */ jsx(ProgressCircle, {
101
- value: (selected + 1) / Math.max(1, items.length),
102
+ value: (selectedIdx + 1) / Math.max(1, items.length),
102
103
  max: 1,
103
104
  className: cn("shrink-0", open && "text-fd-primary")
104
105
  }),
105
106
  /* @__PURE__ */ jsx(AnimatePresence, {
106
107
  mode: "wait",
107
- children: items[selected] && selected !== -1 && !open ? /* @__PURE__ */ jsx(motion.span, {
108
+ children: items[selectedIdx] && !open ? /* @__PURE__ */ jsx(motion.span, {
108
109
  ...spanProps,
109
- children: items[selected].title
110
- }, selected) : path ? /* @__PURE__ */ jsx(motion.span, {
110
+ children: items[selectedIdx].original.title
111
+ }, selectedIdx) : path ? /* @__PURE__ */ jsx(motion.span, {
111
112
  ...spanProps,
112
113
  children: path.name
113
114
  }, path.$id ?? ":pathId") : /* @__PURE__ */ jsx(motion.span, {
@@ -161,8 +162,10 @@ function PageTOCPopoverContent(props) {
161
162
  return /* @__PURE__ */ jsx(CollapsibleContent, {
162
163
  "data-toc-popover-content": "",
163
164
  ...props,
164
- className: cn("flex flex-col px-2 max-h-[50vh]", props.className),
165
- children: props.children
165
+ children: /* @__PURE__ */ jsx("div", {
166
+ className: "flex flex-col px-2 max-h-[50vh]",
167
+ children: props.children
168
+ })
166
169
  });
167
170
  }
168
171
  //#endregion
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
5
5
 
6
6
  //#region src/layouts/home/slots/header.d.ts
7
7
  declare const navItemVariants: (props?: ({
8
- variant?: "icon" | "button" | "main" | null | undefined;
8
+ variant?: "icon" | "main" | "button" | null | undefined;
9
9
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
10
10
  declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | react_jsx_runtime0.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined>;
11
11
  //#endregion
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { I18nLabel, useI18n } from "../../../../contexts/i18n.js";
3
3
  import { cn } from "../../../../utils/cn.js";
4
- import { TOCProvider as TOCProvider$1, TOCScrollArea, useActiveAnchor, useTOCItems } from "../../../../components/toc/index.js";
5
- import { TOCItems } from "../../../../components/toc/default.js";
6
- import { TOCItems as TOCItems$1 } from "../../../../components/toc/clerk.js";
4
+ import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
5
+ import { default_exports } from "../../../../components/toc/default.js";
6
+ import { clerk_exports } from "../../../../components/toc/clerk.js";
7
7
  import { useTreePath } from "../../../../contexts/tree.js";
8
8
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
9
9
  import { useNotebookLayout } from "../../client.js";
@@ -14,7 +14,9 @@ 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 }) {
17
+ function TOC({ container, header, footer, style = "normal" }) {
18
+ const items = useTOCItems();
19
+ const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
18
20
  return /* @__PURE__ */ jsxs("div", {
19
21
  id: "nd-toc",
20
22
  ...container,
@@ -26,37 +28,29 @@ function TOC({ container, header, footer, style }) {
26
28
  className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
27
29
  children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(I18nLabel, { label: "toc" })]
28
30
  }),
29
- /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
31
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, { children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))] }) }),
30
32
  footer
31
33
  ]
32
34
  });
33
35
  }
34
36
  const TocPopoverContext = createContext(null);
35
- function TOCPopover({ container, trigger, content, header, footer, style }) {
36
- return /* @__PURE__ */ jsxs(PageTOCPopover, {
37
- ...container,
38
- children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsx(PageTOCPopoverContent, {
39
- ...content,
40
- children: /* @__PURE__ */ jsxs("div", { children: [
41
- header,
42
- /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
43
- footer
44
- ] })
45
- })]
46
- });
47
- }
48
- function PageTOCPopover({ className, children, ...rest }) {
37
+ function TOCPopover({ container, trigger, content, header, footer, style = "normal" }) {
38
+ const items = useTOCItems();
49
39
  const ref = useRef(null);
50
40
  const [open, setOpen] = useState(false);
51
41
  const { isNavTransparent } = useNotebookLayout();
52
- const onClick = useEffectEvent((e) => {
53
- if (!open) return;
42
+ const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
43
+ const onClickOutside = useEffectEvent((e) => {
44
+ if (!open || !(e.target instanceof HTMLElement)) return;
54
45
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
55
46
  });
47
+ const onClickItem = () => {
48
+ setOpen(false);
49
+ };
56
50
  useEffect(() => {
57
- window.addEventListener("click", onClick);
51
+ window.addEventListener("click", onClickOutside);
58
52
  return () => {
59
- window.removeEventListener("click", onClick);
53
+ window.removeEventListener("click", onClickOutside);
60
54
  };
61
55
  }, []);
62
56
  return /* @__PURE__ */ jsx(TocPopoverContext, {
@@ -68,12 +62,22 @@ function PageTOCPopover({ className, children, ...rest }) {
68
62
  open,
69
63
  onOpenChange: setOpen,
70
64
  "data-toc-popover": "",
71
- className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", className),
72
- ...rest,
73
- children: /* @__PURE__ */ jsx("header", {
65
+ ...container,
66
+ className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
67
+ children: /* @__PURE__ */ jsxs("header", {
74
68
  ref,
75
69
  className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
76
- children
70
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
71
+ ...content,
72
+ children: [
73
+ 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))] }) }),
78
+ footer
79
+ ]
80
+ })]
77
81
  })
78
82
  })
79
83
  });
@@ -81,18 +85,17 @@ function PageTOCPopover({ className, children, ...rest }) {
81
85
  function PageTOCPopoverTrigger({ className, ...props }) {
82
86
  const { text } = useI18n();
83
87
  const { open } = use(TocPopoverContext);
84
- const items = useTOCItems();
85
- const active = useActiveAnchor();
86
- const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
88
+ const items = useItems();
89
+ const selectedIdx = items.findIndex((item) => item.active);
87
90
  const path = useTreePath().at(-1);
88
- const showItem = selected !== -1 && !open;
91
+ const showItem = selectedIdx !== -1 && !open;
89
92
  return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
90
93
  className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
91
94
  "data-toc-popover-trigger": "",
92
95
  ...props,
93
96
  children: [
94
97
  /* @__PURE__ */ jsx(ProgressCircle, {
95
- value: (selected + 1) / Math.max(1, items.length),
98
+ value: (selectedIdx + 1) / Math.max(1, items.length),
96
99
  max: 1,
97
100
  className: cn("shrink-0", open && "text-fd-primary")
98
101
  }),
@@ -103,7 +106,7 @@ function PageTOCPopoverTrigger({ className, ...props }) {
103
106
  children: path?.name ?? text.toc
104
107
  }), /* @__PURE__ */ jsx("span", {
105
108
  className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
106
- children: items[selected]?.title
109
+ children: items[selectedIdx]?.original.title
107
110
  })]
108
111
  }),
109
112
  /* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
@@ -152,8 +155,10 @@ function PageTOCPopoverContent(props) {
152
155
  return /* @__PURE__ */ jsx(CollapsibleContent, {
153
156
  "data-toc-popover-content": "",
154
157
  ...props,
155
- className: cn("flex flex-col px-4 max-h-[50vh] md:px-6", props.className),
156
- children: props.children
158
+ children: /* @__PURE__ */ jsx("div", {
159
+ className: "flex flex-col px-4 max-h-[50vh] md:px-6",
160
+ children: props.children
161
+ })
157
162
  });
158
163
  }
159
164
  //#endregion
package/dist/style.css CHANGED
@@ -314,6 +314,9 @@
314
314
  .inset-y-2 {
315
315
  inset-block: calc(var(--spacing) * 2);
316
316
  }
317
+ .inset-s-0 {
318
+ inset-inline-start: calc(var(--spacing) * 0);
319
+ }
317
320
  .start {
318
321
  inset-inline-start: var(--spacing);
319
322
  }
@@ -350,9 +353,6 @@
350
353
  .top-\(--fd-docs-row-3\) {
351
354
  top: var(--fd-docs-row-3);
352
355
  }
353
- .top-\(--fd-top\) {
354
- top: var(--fd-top);
355
- }
356
356
  .top-0 {
357
357
  top: calc(var(--spacing) * 0);
358
358
  }
@@ -984,9 +984,6 @@
984
984
  .h-\(--fd-header-height\) {
985
985
  height: var(--fd-header-height);
986
986
  }
987
- .h-\(--fd-height\) {
988
- height: var(--fd-height);
989
- }
990
987
  .h-\(--fd-toc-popover-height\) {
991
988
  height: var(--fd-toc-popover-height);
992
989
  }
@@ -1188,10 +1185,6 @@
1188
1185
  --tw-translate-y: -100%;
1189
1186
  translate: var(--tw-translate-x) var(--tw-translate-y);
1190
1187
  }
1191
- .translate-y-1\/2 {
1192
- --tw-translate-y: calc(1 / 2 * 100%);
1193
- translate: var(--tw-translate-x) var(--tw-translate-y);
1194
- }
1195
1188
  .translate-y-full {
1196
1189
  --tw-translate-y: 100%;
1197
1190
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -1211,6 +1204,9 @@
1211
1204
  .animate-pulse {
1212
1205
  animation: var(--animate-pulse);
1213
1206
  }
1207
+ .scroll-m-4 {
1208
+ scroll-margin: calc(var(--spacing) * 4);
1209
+ }
1214
1210
  .scroll-m-20 {
1215
1211
  scroll-margin: calc(var(--spacing) * 20);
1216
1212
  }
@@ -1367,10 +1363,6 @@
1367
1363
  .rounded-xl {
1368
1364
  border-radius: var(--radius-xl);
1369
1365
  }
1370
- .rounded-e-full {
1371
- border-start-end-radius: calc(infinity * 1px);
1372
- border-end-end-radius: calc(infinity * 1px);
1373
- }
1374
1366
  .border {
1375
1367
  border-style: var(--tw-border-style);
1376
1368
  border-width: 1px;
@@ -1500,18 +1492,6 @@
1500
1492
  .bg-transparent {
1501
1493
  background-color: transparent;
1502
1494
  }
1503
- .bg-linear-to-t {
1504
- --tw-gradient-position: to top;
1505
- @supports (background-image: linear-gradient(in lab, red, red)) {
1506
- --tw-gradient-position: to top in oklab;
1507
- }
1508
- background-image: linear-gradient(var(--tw-gradient-stops));
1509
- }
1510
- .via-fd-primary {
1511
- --tw-gradient-via: var(--color-fd-primary);
1512
- --tw-gradient-via-stops: var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);
1513
- --tw-gradient-stops: var(--tw-gradient-via-stops);
1514
- }
1515
1495
  .mask-\[linear-gradient\(to_bottom\,transparent\,white_--spacing\(14\)\,white_calc\(100\%---spacing\(14\)\)\,transparent\)\] {
1516
1496
  mask-image: linear-gradient(to bottom,transparent,white calc(var(--spacing) * 14),white calc(100% - calc(var(--spacing) * 14)),transparent);
1517
1497
  }
@@ -1895,11 +1875,6 @@
1895
1875
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1896
1876
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1897
1877
  }
1898
- .transition-\[top\,height\] {
1899
- transition-property: top,height;
1900
- transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1901
- transition-duration: var(--tw-duration, var(--default-transition-duration));
1902
- }
1903
1878
  .transition-\[width\,height\] {
1904
1879
  transition-property: width,height;
1905
1880
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -1930,9 +1905,6 @@
1930
1905
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1931
1906
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1932
1907
  }
1933
- .delay-25 {
1934
- transition-delay: 25ms;
1935
- }
1936
1908
  .duration-100 {
1937
1909
  --tw-duration: 100ms;
1938
1910
  transition-duration: 100ms;
@@ -2283,13 +2255,6 @@
2283
2255
  }
2284
2256
  }
2285
2257
  }
2286
- .hover\:delay-0 {
2287
- &:hover {
2288
- @media (hover: hover) {
2289
- transition-delay: 0ms;
2290
- }
2291
- }
2292
- }
2293
2258
  .focus-visible\:ring-2 {
2294
2259
  &:focus-visible {
2295
2260
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
@@ -3122,48 +3087,6 @@
3122
3087
  inherits: false;
3123
3088
  initial-value: 0;
3124
3089
  }
3125
- @property --tw-gradient-position {
3126
- syntax: "*";
3127
- inherits: false;
3128
- }
3129
- @property --tw-gradient-from {
3130
- syntax: "<color>";
3131
- inherits: false;
3132
- initial-value: #0000;
3133
- }
3134
- @property --tw-gradient-via {
3135
- syntax: "<color>";
3136
- inherits: false;
3137
- initial-value: #0000;
3138
- }
3139
- @property --tw-gradient-to {
3140
- syntax: "<color>";
3141
- inherits: false;
3142
- initial-value: #0000;
3143
- }
3144
- @property --tw-gradient-stops {
3145
- syntax: "*";
3146
- inherits: false;
3147
- }
3148
- @property --tw-gradient-via-stops {
3149
- syntax: "*";
3150
- inherits: false;
3151
- }
3152
- @property --tw-gradient-from-position {
3153
- syntax: "<length-percentage>";
3154
- inherits: false;
3155
- initial-value: 0%;
3156
- }
3157
- @property --tw-gradient-via-position {
3158
- syntax: "<length-percentage>";
3159
- inherits: false;
3160
- initial-value: 50%;
3161
- }
3162
- @property --tw-gradient-to-position {
3163
- syntax: "<length-percentage>";
3164
- inherits: false;
3165
- initial-value: 100%;
3166
- }
3167
3090
  @property --tw-leading {
3168
3091
  syntax: "*";
3169
3092
  inherits: false;
@@ -3511,15 +3434,6 @@
3511
3434
  --tw-skew-y: initial;
3512
3435
  --tw-divide-x-reverse: 0;
3513
3436
  --tw-divide-y-reverse: 0;
3514
- --tw-gradient-position: initial;
3515
- --tw-gradient-from: #0000;
3516
- --tw-gradient-via: #0000;
3517
- --tw-gradient-to: #0000;
3518
- --tw-gradient-stops: initial;
3519
- --tw-gradient-via-stops: initial;
3520
- --tw-gradient-from-position: 0%;
3521
- --tw-gradient-via-position: 50%;
3522
- --tw-gradient-to-position: 100%;
3523
3437
  --tw-leading: initial;
3524
3438
  --tw-font-weight: initial;
3525
3439
  --tw-shadow: 0 0 #0000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "16.7.3",
3
+ "version": "16.7.5",
4
4
  "description": "The Radix UI version of Fumadocs UI",
5
5
  "keywords": [
6
6
  "Docs",
@@ -157,9 +157,9 @@
157
157
  "tailwindcss": "^4.2.2",
158
158
  "tsdown": "0.21.4",
159
159
  "unified": "^11.0.5",
160
- "@fumadocs/cli": "1.3.1",
160
+ "@fumadocs/cli": "1.3.2",
161
161
  "eslint-config-custom": "0.0.0",
162
- "fumadocs-core": "16.7.3",
162
+ "fumadocs-core": "16.7.5",
163
163
  "tsconfig": "0.0.0"
164
164
  },
165
165
  "peerDependencies": {
@@ -170,7 +170,7 @@
170
170
  "react": "^19.2.0",
171
171
  "react-dom": "^19.2.0",
172
172
  "shiki": "*",
173
- "fumadocs-core": "16.7.3"
173
+ "fumadocs-core": "16.7.5"
174
174
  },
175
175
  "peerDependenciesMeta": {
176
176
  "next": {