fumadocs-ui 16.7.6 → 16.7.7

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.
@@ -42,6 +42,7 @@
42
42
  @source inline("after");
43
43
  @source inline("all");
44
44
  @source inline("always");
45
+ @source inline("an");
45
46
  @source inline("and");
46
47
  @source inline("aria-label");
47
48
  @source inline("aria-valuemax");
@@ -50,6 +51,7 @@
50
51
  @source inline("article");
51
52
  @source inline("as");
52
53
  @source inline("aside");
54
+ @source inline("attribute");
53
55
  @source inline("auto");
54
56
  @source inline("available");
55
57
  @source inline("backdrop-blur-sm");
@@ -107,6 +109,7 @@
107
109
  @source inline("cva");
108
110
  @source inline("cx");
109
111
  @source inline("cy");
112
+ @source inline("data");
110
113
  @source inline("data-[active=true]:before:absolute");
111
114
  @source inline("data-[active=true]:before:bg-fd-primary");
112
115
  @source inline("data-[active=true]:before:content-['']");
@@ -116,6 +119,7 @@
116
119
  @source inline("data-[active=true]:bg-fd-primary/10");
117
120
  @source inline("data-[active=true]:hover:transition-colors");
118
121
  @source inline("data-[active=true]:text-fd-primary");
122
+ @source inline("data-[column-changed=true]:transition-[grid-template-columns]");
119
123
  @source inline("data-[state=closed]:animate-fd-fade-out");
120
124
  @source inline("data-[state=closed]:animate-fd-sidebar-out");
121
125
  @source inline("data-[state=open]:animate-fd-fade-in");
@@ -124,6 +128,7 @@
124
128
  @source inline("data-[state=open]:text-fd-accent-foreground");
125
129
  @source inline("data-[transparent=false]:bg-fd-background/80");
126
130
  @source inline("data-collapsed");
131
+ @source inline("data-column-changed");
127
132
  @source inline("data-full");
128
133
  @source inline("data-hovered");
129
134
  @source inline("data-sidebar-collapsed");
@@ -223,9 +228,11 @@
223
228
  @source inline("inset-y-0");
224
229
  @source inline("inset-y-2");
225
230
  @source inline("instanceof");
231
+ @source inline("instant");
226
232
  @source inline("interface");
227
233
  @source inline("invisible");
228
234
  @source inline("isActive");
235
+ @source inline("isCollapseChanged");
229
236
  @source inline("isNavTransparent");
230
237
  @source inline("isTop");
231
238
  @source inline("item");
@@ -303,6 +310,7 @@
303
310
  @source inline("onClickItem");
304
311
  @source inline("onClickOutside");
305
312
  @source inline("onOpenChange");
313
+ @source inline("only");
306
314
  @source inline("opacity-0");
307
315
  @source inline("open");
308
316
  @source inline("option");
@@ -328,6 +336,7 @@
328
336
  @source inline("popover");
329
337
  @source inline("prefetch");
330
338
  @source inline("previous");
339
+ @source inline("previousCollapsed");
331
340
  @source inline("previousPage");
332
341
  @source inline("progress");
333
342
  @source inline("progressbar");
@@ -367,8 +376,10 @@
367
376
  @source inline("secondary");
368
377
  @source inline("selected");
369
378
  @source inline("selectedIdx");
379
+ @source inline("set");
370
380
  @source inline("setDate");
371
381
  @source inline("setOpen");
382
+ @source inline("setPreviousCollapsed");
372
383
  @source inline("shadow-lg");
373
384
  @source inline("showItem");
374
385
  @source inline("shrink-0");
@@ -434,7 +445,6 @@
434
445
  @source inline("top-(--fd-docs-row-2)");
435
446
  @source inline("top-[calc(--spacing(4)+var(--fd-docs-row-3))]");
436
447
  @source inline("transform");
437
- @source inline("transition-[grid-template-columns]");
438
448
  @source inline("transition-[opacity,translate,color]");
439
449
  @source inline("transition-[opacity,translate]");
440
450
  @source inline("transition-[width,inset-block,translate,background-color]");
@@ -480,6 +490,7 @@
480
490
  @source inline("w-4");
481
491
  @source inline("w-[85%]");
482
492
  @source inline("w-full");
493
+ @source inline("will");
483
494
  @source inline("wrap-anywhere");
484
495
  @source inline("xl:hidden");
485
496
  @source inline("xl:layout:[--fd-toc-width:268px]");
@@ -46,6 +46,7 @@
46
46
  @source inline("after");
47
47
  @source inline("all");
48
48
  @source inline("always");
49
+ @source inline("an");
49
50
  @source inline("and");
50
51
  @source inline("aria-label");
51
52
  @source inline("aria-valuemax");
@@ -54,6 +55,7 @@
54
55
  @source inline("article");
55
56
  @source inline("as");
56
57
  @source inline("aside");
58
+ @source inline("attribute");
57
59
  @source inline("auto");
58
60
  @source inline("auto-cols-auto");
59
61
  @source inline("auto-rows-auto");
@@ -115,6 +117,7 @@
115
117
  @source inline("cva");
116
118
  @source inline("cx");
117
119
  @source inline("cy");
120
+ @source inline("data");
118
121
  @source inline("data-[active=true]:before:absolute");
119
122
  @source inline("data-[active=true]:before:bg-fd-primary");
120
123
  @source inline("data-[active=true]:before:content-['']");
@@ -125,6 +128,7 @@
125
128
  @source inline("data-[active=true]:hover:transition-colors");
126
129
  @source inline("data-[active=true]:text-fd-primary");
127
130
  @source inline("data-[collapsed=false]:hidden");
131
+ @source inline("data-[column-changed=true]:transition-[grid-template-columns]");
128
132
  @source inline("data-[state=closed]:animate-fd-fade-out");
129
133
  @source inline("data-[state=closed]:animate-fd-sidebar-out");
130
134
  @source inline("data-[state=open]:animate-fd-fade-in");
@@ -133,6 +137,7 @@
133
137
  @source inline("data-[state=open]:text-fd-accent-foreground");
134
138
  @source inline("data-[transparent=false]:bg-fd-background/80");
135
139
  @source inline("data-collapsed");
140
+ @source inline("data-column-changed");
136
141
  @source inline("data-full");
137
142
  @source inline("data-header-body");
138
143
  @source inline("data-header-tabs");
@@ -240,9 +245,11 @@
240
245
  @source inline("inset-y-0");
241
246
  @source inline("inset-y-2");
242
247
  @source inline("instanceof");
248
+ @source inline("instant");
243
249
  @source inline("interface");
244
250
  @source inline("invisible");
245
251
  @source inline("isActive");
252
+ @source inline("isCollapseChanged");
246
253
  @source inline("isLayoutTabActive");
247
254
  @source inline("isNavTransparent");
248
255
  @source inline("isSelected");
@@ -336,6 +343,7 @@
336
343
  @source inline("onOpenChange");
337
344
  @source inline("onPointerEnter");
338
345
  @source inline("onPointerLeave");
346
+ @source inline("only");
339
347
  @source inline("ontouchstart");
340
348
  @source inline("opacity-0");
341
349
  @source inline("open");
@@ -362,6 +370,7 @@
362
370
  @source inline("popover");
363
371
  @source inline("prefetch");
364
372
  @source inline("previous");
373
+ @source inline("previousCollapsed");
365
374
  @source inline("previousPage");
366
375
  @source inline("progress");
367
376
  @source inline("progressbar");
@@ -403,8 +412,10 @@
403
412
  @source inline("secondary");
404
413
  @source inline("selected");
405
414
  @source inline("selectedIdx");
415
+ @source inline("set");
406
416
  @source inline("setDate");
407
417
  @source inline("setOpen");
418
+ @source inline("setPreviousCollapsed");
408
419
  @source inline("shadow-lg");
409
420
  @source inline("showItem");
410
421
  @source inline("showLayoutTabs");
@@ -472,7 +483,6 @@
472
483
  @source inline("top-(--fd-docs-row-3)");
473
484
  @source inline("touch");
474
485
  @source inline("transform");
475
- @source inline("transition-[grid-template-columns]");
476
486
  @source inline("transition-[opacity,translate,color]");
477
487
  @source inline("transition-[opacity,translate]");
478
488
  @source inline("transition-[width,inset-block,translate,background-color]");
@@ -516,6 +526,7 @@
516
526
  @source inline("w-4");
517
527
  @source inline("w-[85%]");
518
528
  @source inline("w-full");
529
+ @source inline("will");
519
530
  @source inline("window");
520
531
  @source inline("wrap-anywhere");
521
532
  @source inline("xl:hidden");
@@ -14,6 +14,7 @@
14
14
  @source inline("*:has-[+:last-child[data-empty=true]]:border-b-0");
15
15
  @source inline("*:last:border-b-0");
16
16
  @source inline("*:rounded-full");
17
+ @source inline("--b");
17
18
  @source inline("--callout-color");
18
19
  @source inline("--color-fd-");
19
20
  @source inline("--color-fd-muted");
@@ -29,14 +30,19 @@
29
30
  @source inline("--shiki-dark-bg");
30
31
  @source inline("--shiki-light-bg");
31
32
  @source inline("--spacing");
33
+ @source inline("--t");
34
+ @source inline("-circle");
32
35
  @source inline("-mb-px");
33
36
  @source inline("-me-0.5");
34
37
  @source inline("-me-2");
35
38
  @source inline("-mx-px");
36
39
  @source inline("-rotate-90");
40
+ @source inline("-text");
37
41
  @source inline("-top-1.5");
42
+ @source inline("-translate-1/2");
38
43
  @source inline("-translate-x-1/2");
39
44
  @source inline("-translate-y-1/2");
45
+ @source inline("-z-1");
40
46
  @source inline("@container");
41
47
  @source inline("@defaultValue");
42
48
  @source inline("@deprecated");
@@ -77,6 +83,7 @@
77
83
  @source inline("algolia");
78
84
  @source inline("align");
79
85
  @source inline("alignItems");
86
+ @source inline("alignmentBaseline");
80
87
  @source inline("all");
81
88
  @source inline("allowClear");
82
89
  @source inline("allowCopy");
@@ -104,7 +111,6 @@
104
111
  @source inline("at");
105
112
  @source inline("attribute");
106
113
  @source inline("await");
107
- @source inline("b0");
108
114
  @source inline("backdrop-blur-lg");
109
115
  @source inline("backdrop-blur-xs");
110
116
  @source inline("background");
@@ -166,6 +172,7 @@
166
172
  @source inline("can");
167
173
  @source inline("case");
168
174
  @source inline("center");
175
+ @source inline("central");
169
176
  @source inline("change");
170
177
  @source inline("changeLayout");
171
178
  @source inline("changes");
@@ -223,6 +230,8 @@
223
230
  @source inline("custom");
224
231
  @source inline("customise");
225
232
  @source inline("cva");
233
+ @source inline("cx");
234
+ @source inline("cy");
226
235
  @source inline("d");
227
236
  @source inline("dangerouslySetInnerHTML");
228
237
  @source inline("dark");
@@ -313,6 +322,7 @@
313
322
  @source inline("divide-x");
314
323
  @source inline("divide-y");
315
324
  @source inline("documented");
325
+ @source inline("dominantBaseline");
316
326
  @source inline("don");
317
327
  @source inline("drawer");
318
328
  @source inline("duration-100");
@@ -327,7 +337,6 @@
327
337
  @source inline("en");
328
338
  @source inline("enableSystem");
329
339
  @source inline("enabled");
330
- @source inline("end");
331
340
  @source inline("end-2");
332
341
  @source inline("endIdx");
333
342
  @source inline("endpoint");
@@ -355,6 +364,8 @@
355
364
  @source inline("file");
356
365
  @source inline("fill");
357
366
  @source inline("fill-(--callout-color)");
367
+ @source inline("fill-fd-primary");
368
+ @source inline("fill-fd-primary-foreground");
358
369
  @source inline("filter");
359
370
  @source inline("filters");
360
371
  @source inline("finally");
@@ -424,6 +435,8 @@
424
435
  @source inline("group-data-[state=active]:bg-fd-primary");
425
436
  @source inline("group-data-[state=open]:rotate-180");
426
437
  @source inline("group-data-[state=open]:rotate-90");
438
+ @source inline("group-first:[--t:--spacing(0.75)]");
439
+ @source inline("group-last:[--b:--spacing(0.75)]");
427
440
  @source inline("groupListeners");
428
441
  @source inline("guides");
429
442
  @source inline("h");
@@ -504,8 +517,8 @@
504
517
  @source inline("isActive");
505
518
  @source inline("isLoading");
506
519
  @source inline("isOpen");
507
- @source inline("isStart");
508
520
  @source inline("isTabActive");
521
+ @source inline("isUp");
509
522
  @source inline("isWindows");
510
523
  @source inline("it");
511
524
  @source inline("item");
@@ -527,7 +540,6 @@
527
540
  @source inline("languages");
528
541
  @source inline("last:pb-0");
529
542
  @source inline("last:rounded-b-xl");
530
- @source inline("lastInactiveIdx");
531
543
  @source inline("lastUpdate");
532
544
  @source inline("layer");
533
545
  @source inline("layout");
@@ -604,6 +616,7 @@
604
616
  @source inline("mergeRefs");
605
617
  @source inline("message");
606
618
  @source inline("metaKey");
619
+ @source inline("middle");
607
620
  @source inline("min-h-0");
608
621
  @source inline("min-w-0");
609
622
  @source inline("min-w-[240px]");
@@ -727,7 +740,6 @@
727
740
  @source inline("p-2");
728
741
  @source inline("p-3");
729
742
  @source inline("p-4");
730
- @source inline("pOffset");
731
743
  @source inline("padding");
732
744
  @source inline("paddingInlineStart");
733
745
  @source inline("page");
@@ -763,6 +775,7 @@
763
775
  @source inline("prev");
764
776
  @source inline("previous");
765
777
  @source inline("previousPage");
778
+ @source inline("previousRef");
766
779
  @source inline("primary");
767
780
  @source inline("primaryColor");
768
781
  @source inline("primaryTextColor");
@@ -860,6 +873,7 @@
860
873
  @source inline("rtl:rotate-180");
861
874
  @source inline("rtl:rotate-90");
862
875
  @source inline("s");
876
+ @source inline("scale");
863
877
  @source inline("scope");
864
878
  @source inline("scroll");
865
879
  @source inline("scroll-into-view-if-needed");
@@ -998,6 +1012,7 @@
998
1012
  @source inline("text-start");
999
1013
  @source inline("text-xs");
1000
1014
  @source inline("text/plain");
1015
+ @source inline("textAnchor");
1001
1016
  @source inline("textContent");
1002
1017
  @source inline("that");
1003
1018
  @source inline("the");
@@ -1025,6 +1040,7 @@
1025
1040
  @source inline("top-2.5");
1026
1041
  @source inline("top-3");
1027
1042
  @source inline("top-4");
1043
+ @source inline("top-[calc(50%-var(--t,0px)+var(--b,0px))]");
1028
1044
  @source inline("touch");
1029
1045
  @source inline("transform");
1030
1046
  @source inline("transition-[clip-path]");
@@ -1060,7 +1076,9 @@
1060
1076
  @source inline("updated");
1061
1077
  @source inline("updates");
1062
1078
  @source inline("upper");
1079
+ @source inline("upperBottom");
1063
1080
  @source inline("upperOffset");
1081
+ @source inline("upperX");
1064
1082
  @source inline("url");
1065
1083
  @source inline("urlOrPath");
1066
1084
  @source inline("urls");
@@ -1136,8 +1154,8 @@
1136
1154
  @source inline("wrapElement");
1137
1155
  @source inline("wrapInSuspense");
1138
1156
  @source inline("wrapped");
1157
+ @source inline("x");
1139
1158
  @source inline("xmlns");
1140
- @source inline("y");
1141
1159
  @source inline("you");
1142
1160
  @source inline("your");
1143
1161
  @source inline("z-2");
@@ -22,25 +22,46 @@ function TOCItems({ ref, className, ...props }) {
22
22
  if (!container || container.clientHeight === 0) return;
23
23
  let w = 0;
24
24
  let h = 0;
25
- let b0 = 0;
25
+ let upperBottom = 0;
26
+ let upperX = 0;
26
27
  let d = "";
28
+ const output = [];
27
29
  for (let i = 0; i < items.length; i++) {
28
- const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
30
+ const item = items[i];
31
+ const element = container.querySelector(`a[href="#${item.url.slice(1)}"]`);
29
32
  if (!element) continue;
30
33
  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);
34
+ const x = getLineOffset(item.depth) + .5, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
35
+ w = Math.max(x + 8, w);
33
36
  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}`;
38
- }
39
- b0 = bottom;
37
+ 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}`;
39
+ if (item._step !== void 0) output.push(/* @__PURE__ */ jsx("circle", {
40
+ cx: x,
41
+ cy: (top + bottom) / 2,
42
+ r: "8",
43
+ className: "fill-fd-primary"
44
+ }, `${i}-circle`), /* @__PURE__ */ jsx("text", {
45
+ x,
46
+ y: (top + bottom) / 2,
47
+ textAnchor: "middle",
48
+ alignmentBaseline: "central",
49
+ dominantBaseline: "middle",
50
+ className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono",
51
+ children: item._step
52
+ }, `${i}-text`));
53
+ upperX = x;
54
+ upperBottom = bottom;
40
55
  }
41
- setSvg({
56
+ output.unshift(/* @__PURE__ */ jsx("path", {
42
57
  d,
43
- width: w + 1,
58
+ className: "stroke-fd-primary",
59
+ strokeWidth: "1",
60
+ fill: "none"
61
+ }, "path"));
62
+ setSvg({
63
+ content: output,
64
+ width: w,
44
65
  height: h
45
66
  });
46
67
  });
@@ -69,12 +90,7 @@ function TOCItems({ ref, className, ...props }) {
69
90
  height: svg.height,
70
91
  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)))`
71
92
  },
72
- children: /* @__PURE__ */ jsx("path", {
73
- d: svg.d,
74
- className: "stroke-fd-primary",
75
- strokeWidth: "1",
76
- fill: "none"
77
- })
93
+ children: svg.content
78
94
  }), /* @__PURE__ */ jsx(ThumbBox, {})]
79
95
  }), /* @__PURE__ */ jsx("div", {
80
96
  ref: mergeRefs(containerRef, ref),
@@ -91,32 +107,39 @@ function TOCEmpty() {
91
107
  }
92
108
  function ThumbBox() {
93
109
  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
- }
110
+ const previousRef = useRef(null);
111
+ const startIdx = items.findIndex((item) => item.active);
112
+ const endIdx = items.findLastIndex((item) => item.active);
104
113
  if (startIdx === -1) return;
105
- const isStart = endIdx < lastInactiveIdx;
114
+ let isUp = false;
115
+ if (previousRef.current) {
116
+ const prev = previousRef.current;
117
+ isUp = prev.startIdx > startIdx || prev.endIdx > endIdx || prev.startIdx === startIdx && prev.endIdx === endIdx && prev.isUp;
118
+ }
119
+ previousRef.current = {
120
+ startIdx,
121
+ endIdx,
122
+ isUp
123
+ };
124
+ const original = items[isUp ? startIdx : endIdx].original;
106
125
  return /* @__PURE__ */ jsx("div", {
107
126
  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))"}` }
127
+ 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"
130
+ }
109
131
  });
110
132
  }
133
+ const a = 8;
111
134
  function getItemOffset(depth) {
112
- if (depth <= 2) return 14;
113
- if (depth === 3) return 26;
114
- return 36;
135
+ if (depth <= 2) return 12 + a;
136
+ if (depth === 3) return 24 + a;
137
+ return 36 + a;
115
138
  }
116
139
  function getLineOffset(depth) {
117
- if (depth <= 2) return 2;
118
- if (depth === 3) return 10;
119
- return 20;
140
+ if (depth <= 2) return a;
141
+ if (depth === 3) return 8 + a;
142
+ return 16 + a;
120
143
  }
121
144
  function TOCItem({ item, ...props }) {
122
145
  const items = useTOCItems();
@@ -132,7 +155,7 @@ function TOCItem({ item, ...props }) {
132
155
  return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
133
156
  href: item.url,
134
157
  ...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),
158
+ className: cn("group 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
159
  style: {
137
160
  paddingInlineStart: getItemOffset(item.depth),
138
161
  ...props.style
@@ -141,7 +164,7 @@ function TOCItem({ item, ...props }) {
141
164
  offset !== upperOffset && /* @__PURE__ */ jsx("svg", {
142
165
  xmlns: "http://www.w3.org/2000/svg",
143
166
  viewBox: `${Math.min(offset, upperOffset)} 0 ${Math.abs(upperOffset - offset)} 12`,
144
- className: "absolute -top-1.5",
167
+ className: "absolute -top-1.5 -z-1",
145
168
  style: {
146
169
  width: Math.abs(upperOffset - offset) + 1,
147
170
  height: 12,
@@ -156,9 +179,14 @@ function TOCItem({ item, ...props }) {
156
179
  })
157
180
  }),
158
181
  /* @__PURE__ */ jsx("div", {
159
- className: cn("absolute inset-y-0 w-px bg-fd-foreground/10", offset !== upperOffset && "top-1.5", offset !== lowerOffset && "bottom-1.5"),
182
+ className: cn("absolute inset-y-0 w-px bg-fd-foreground/10 -z-1", offset !== upperOffset && "top-1.5", offset !== lowerOffset && "bottom-1.5"),
160
183
  style: { insetInlineStart: offset }
161
184
  }),
185
+ item._step !== void 0 && /* @__PURE__ */ jsx("div", {
186
+ className: "absolute flex items-center justify-center -translate-1/2 -z-1 top-[calc(50%-var(--t,0px)+var(--b,0px))] size-4 font-mono font-medium text-xs bg-fd-muted text-fd-muted-foreground rounded-full leading-none group-first:[--t:--spacing(0.75)] group-last:[--b:--spacing(0.75)]",
187
+ style: { insetInlineStart: offset },
188
+ children: item._step
189
+ }),
162
190
  item.title
163
191
  ]
164
192
  });
@@ -18,11 +18,9 @@ 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
- align?: 'center' | 'end';
22
21
  }
23
22
  declare function TocThumb({
24
23
  containerRef,
25
- align,
26
24
  ...props
27
25
  }: TocThumbProps): react_jsx_runtime0.JSX.Element;
28
26
  //#endregion
@@ -43,7 +43,7 @@ function TOCScrollArea({ ref, className, ...props }) {
43
43
  })
44
44
  });
45
45
  }
46
- function TocThumb({ containerRef, align = "end", ...props }) {
46
+ function TocThumb({ containerRef, ...props }) {
47
47
  const thumbRef = useRef(null);
48
48
  const active = useActiveAnchors();
49
49
  function update(info) {
@@ -65,15 +65,9 @@ function TocThumb({ containerRef, align = "end", ...props }) {
65
65
  for (const item of active) {
66
66
  const element = container.querySelector(`a[href="#${item}"]`);
67
67
  if (!element) continue;
68
- if (align === "center") {
69
- const y = element.offsetTop + element.clientHeight / 2;
70
- upper = Math.min(upper, y);
71
- lower = Math.max(lower, y);
72
- } else {
73
- const styles = getComputedStyle(element);
74
- upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
75
- lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
76
- }
68
+ const styles = getComputedStyle(element);
69
+ upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
70
+ lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
77
71
  }
78
72
  return {
79
73
  top: upper,
@@ -3,7 +3,6 @@ import { LayoutTab, LinkItemType } from "../shared/index.js";
3
3
  import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
4
4
  import { DocsLayoutProps } from "./index.js";
5
5
  import { ComponentProps, FC } from "react";
6
-
7
6
  //#region src/layouts/docs/client.d.ts
8
7
  interface DocsSlots extends BaseSlots {
9
8
  container: FC<ComponentProps<'div'>>;
@@ -2,14 +2,21 @@
2
2
  import { cn } from "../../../utils/cn.js";
3
3
  import { useDocsLayout } from "../client.js";
4
4
  import "../index.js";
5
+ import { useEffect, useState } from "react";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  //#region src/layouts/docs/slots/container.tsx
7
8
  function Container(props) {
8
9
  const { slots } = useDocsLayout();
9
- const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
10
+ const { collapsed } = slots.sidebar.useSidebar();
11
+ const [previousCollapsed, setPreviousCollapsed] = useState(collapsed);
12
+ const isCollapseChanged = previousCollapsed !== collapsed;
13
+ useEffect(() => {
14
+ if (isCollapseChanged) setPreviousCollapsed(collapsed);
15
+ }, [collapsed, isCollapseChanged]);
10
16
  return /* @__PURE__ */ jsx("div", {
11
17
  id: "nd-docs-layout",
12
18
  "data-sidebar-collapsed": collapsed,
19
+ "data-column-changed": isCollapseChanged,
13
20
  ...props,
14
21
  style: {
15
22
  gridTemplate: `"sidebar sidebar header toc toc"
@@ -21,7 +28,7 @@ function Container(props) {
21
28
  "--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
22
29
  ...props.style
23
30
  },
24
- className: cn("grid transition-[grid-template-columns] overflow-x-clip min-h-(--fd-docs-height) [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px]", props.className),
31
+ className: cn("grid overflow-x-clip min-h-(--fd-docs-height) [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px] data-[column-changed=true]:transition-[grid-template-columns]", props.className),
25
32
  children: props.children
26
33
  });
27
34
  }
@@ -3,7 +3,6 @@ import { LayoutTab, LinkItemType } from "../shared/index.js";
3
3
  import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
4
4
  import { DocsLayoutProps } from "./index.js";
5
5
  import { ComponentProps, FC } from "react";
6
-
7
6
  //#region src/layouts/notebook/client.d.ts
8
7
  interface DocsSlots extends BaseSlots {
9
8
  container: FC<ComponentProps<'div'>>;
@@ -1,15 +1,22 @@
1
1
  "use client";
2
2
  import { cn } from "../../../utils/cn.js";
3
3
  import { useNotebookLayout } from "../client.js";
4
+ import { useEffect, useState } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  //#region src/layouts/notebook/slots/container.tsx
6
7
  function Container(props) {
7
8
  const { props: { nav }, slots } = useNotebookLayout();
8
9
  const pageCol = "calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-col) - var(--fd-toc-width))";
9
10
  const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
11
+ const [previousCollapsed, setPreviousCollapsed] = useState(collapsed);
12
+ const isCollapseChanged = previousCollapsed !== collapsed;
13
+ useEffect(() => {
14
+ if (isCollapseChanged) setPreviousCollapsed(collapsed);
15
+ }, [collapsed, isCollapseChanged]);
10
16
  return /* @__PURE__ */ jsx("div", {
11
17
  id: "nd-notebook-layout",
12
18
  "data-sidebar-collapsed": collapsed,
19
+ "data-column-changed": isCollapseChanged,
13
20
  ...props,
14
21
  style: {
15
22
  gridTemplate: nav?.mode === "top" ? `". header header header ."
@@ -23,7 +30,7 @@ function Container(props) {
23
30
  "--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
24
31
  ...props.style
25
32
  },
26
- className: cn("grid overflow-x-clip min-h-(--fd-docs-height) transition-[grid-template-columns] auto-cols-auto auto-rows-auto [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px]", props.className),
33
+ className: cn("grid overflow-x-clip min-h-(--fd-docs-height) auto-cols-auto auto-rows-auto [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px] data-[column-changed=true]:transition-[grid-template-columns]", props.className),
27
34
  children: props.children
28
35
  });
29
36
  }
package/dist/style.css CHANGED
@@ -332,9 +332,6 @@
332
332
  .start-6 {
333
333
  inset-inline-start: calc(var(--spacing) * 6);
334
334
  }
335
- .end {
336
- inset-inline-end: var(--spacing);
337
- }
338
335
  .end-0 {
339
336
  inset-inline-end: calc(var(--spacing) * 0);
340
337
  }
@@ -374,6 +371,9 @@
374
371
  .top-\[calc\(--spacing\(4\)\+var\(--fd-docs-row-3\)\)\] {
375
372
  top: calc(calc(var(--spacing) * 4) + var(--fd-docs-row-3));
376
373
  }
374
+ .top-\[calc\(50\%-var\(--t\,0px\)\+var\(--b\,0px\)\)\] {
375
+ top: calc(50% - var(--t,0px) + var(--b,0px));
376
+ }
377
377
  .right-2 {
378
378
  right: calc(var(--spacing) * 2);
379
379
  }
@@ -389,6 +389,9 @@
389
389
  .left-1\/2 {
390
390
  left: calc(1 / 2 * 100%);
391
391
  }
392
+ .-z-1 {
393
+ z-index: calc(1 * -1);
394
+ }
392
395
  .z-2 {
393
396
  z-index: 2;
394
397
  }
@@ -1161,6 +1164,11 @@
1161
1164
  .origin-\[top_center\] {
1162
1165
  transform-origin: top center;
1163
1166
  }
1167
+ .-translate-1\/2 {
1168
+ --tw-translate-x: calc(calc(1 / 2 * 100%) * -1);
1169
+ --tw-translate-y: calc(calc(1 / 2 * 100%) * -1);
1170
+ translate: var(--tw-translate-x) var(--tw-translate-y);
1171
+ }
1164
1172
  .-translate-x-\(--fd-sidebar-width\) {
1165
1173
  --tw-translate-x: calc(var(--fd-sidebar-width) * -1);
1166
1174
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -1507,6 +1515,12 @@
1507
1515
  .fill-\(--callout-color\) {
1508
1516
  fill: var(--callout-color);
1509
1517
  }
1518
+ .fill-fd-primary {
1519
+ fill: var(--color-fd-primary);
1520
+ }
1521
+ .fill-fd-primary-foreground {
1522
+ fill: var(--color-fd-primary-foreground);
1523
+ }
1510
1524
  .stroke-current\/25 {
1511
1525
  stroke: currentcolor;
1512
1526
  @supports (color: color-mix(in lab, red, red)) {
@@ -1855,11 +1869,6 @@
1855
1869
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1856
1870
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1857
1871
  }
1858
- .transition-\[grid-template-columns\] {
1859
- transition-property: grid-template-columns;
1860
- transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1861
- transition-duration: var(--tw-duration, var(--default-transition-duration));
1862
- }
1863
1872
  .transition-\[height\] {
1864
1873
  transition-property: height;
1865
1874
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -2065,6 +2074,16 @@
2065
2074
  margin-bottom: calc(var(--spacing) * 2);
2066
2075
  }
2067
2076
  }
2077
+ .group-first\:\[--t\:--spacing\(0\.75\)\] {
2078
+ &:is(:where(.group):first-child *) {
2079
+ --t: calc(var(--spacing) * 0.75);
2080
+ }
2081
+ }
2082
+ .group-last\:\[--b\:--spacing\(0\.75\)\] {
2083
+ &:is(:where(.group):last-child *) {
2084
+ --b: calc(var(--spacing) * 0.75);
2085
+ }
2086
+ }
2068
2087
  .group-data-\[state\=active\]\:bg-fd-primary {
2069
2088
  &:is(:where(.group)[data-state="active"] *) {
2070
2089
  background-color: var(--color-fd-primary);
@@ -2403,6 +2422,13 @@
2403
2422
  display: none;
2404
2423
  }
2405
2424
  }
2425
+ .data-\[column-changed\=true\]\:transition-\[grid-template-columns\] {
2426
+ &[data-column-changed="true"] {
2427
+ transition-property: grid-template-columns;
2428
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
2429
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
2430
+ }
2431
+ }
2406
2432
  .\*\:data-\[empty\=true\]\:border-b-0 {
2407
2433
  :is(& > *) {
2408
2434
  &[data-empty="true"] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "16.7.6",
3
+ "version": "16.7.7",
4
4
  "description": "The Radix UI version of Fumadocs UI",
5
5
  "keywords": [
6
6
  "Docs",
@@ -159,7 +159,7 @@
159
159
  "unified": "^11.0.5",
160
160
  "@fumadocs/cli": "1.3.2",
161
161
  "eslint-config-custom": "0.0.0",
162
- "fumadocs-core": "16.7.6",
162
+ "fumadocs-core": "16.7.7",
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.6"
173
+ "fumadocs-core": "16.7.7"
174
174
  },
175
175
  "peerDependenciesMeta": {
176
176
  "next": {