@fumadocs/base-ui 16.7.1 → 16.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/css/generated/docs.css +5 -9
  2. package/css/generated/flux.css +3 -6
  3. package/css/generated/home.css +28 -14
  4. package/css/generated/notebook.css +5 -5
  5. package/css/generated/shared.css +63 -10
  6. package/dist/components/sidebar/base.js +1 -2
  7. package/dist/components/tabs.d.ts +9 -4
  8. package/dist/components/tabs.js +12 -13
  9. package/dist/components/toc/clerk.js +65 -29
  10. package/dist/components/toc/default.js +5 -3
  11. package/dist/components/toc/index.d.ts +4 -2
  12. package/dist/components/toc/index.js +46 -19
  13. package/dist/components/ui/collapsible.js +1 -1
  14. package/dist/components/ui/navigation-menu.d.ts +24 -12
  15. package/dist/components/ui/navigation-menu.js +47 -32
  16. package/dist/components/ui/popover.d.ts +7 -1
  17. package/dist/components/ui/popover.js +13 -13
  18. package/dist/components/ui/scroll-area.d.ts +15 -4
  19. package/dist/components/ui/scroll-area.js +26 -27
  20. package/dist/layouts/docs/client.d.ts +3 -3
  21. package/dist/layouts/docs/client.js +19 -22
  22. package/dist/layouts/docs/index.d.ts +1 -1
  23. package/dist/layouts/docs/page/index.d.ts +91 -3
  24. package/dist/layouts/docs/page/index.js +67 -7
  25. package/dist/layouts/docs/page/slots/breadcrumb.js +1 -0
  26. package/dist/layouts/docs/page/slots/container.js +2 -1
  27. package/dist/layouts/docs/page/slots/footer.js +1 -0
  28. package/dist/layouts/docs/page/slots/toc.js +3 -3
  29. package/dist/layouts/docs/slots/container.js +1 -0
  30. package/dist/layouts/docs/slots/header.js +1 -0
  31. package/dist/layouts/docs/slots/sidebar.js +9 -19
  32. package/dist/layouts/flux/index.d.ts +4 -4
  33. package/dist/layouts/flux/index.js +8 -11
  34. package/dist/layouts/flux/page/index.d.ts +79 -3
  35. package/dist/layouts/flux/page/index.js +61 -7
  36. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
  37. package/dist/layouts/flux/page/slots/container.js +2 -1
  38. package/dist/layouts/flux/page/slots/footer.js +1 -0
  39. package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
  40. package/dist/layouts/flux/page/slots/toc.js +6 -5
  41. package/dist/layouts/flux/slots/container.js +1 -0
  42. package/dist/layouts/flux/slots/sidebar.js +8 -13
  43. package/dist/layouts/home/index.d.ts +3 -3
  44. package/dist/layouts/home/index.js +11 -8
  45. package/dist/layouts/home/navbar.d.ts +2 -4
  46. package/dist/layouts/home/navbar.js +6 -9
  47. package/dist/layouts/home/slots/container.js +1 -0
  48. package/dist/layouts/home/slots/header.d.ts +2 -3
  49. package/dist/layouts/home/slots/header.js +125 -115
  50. package/dist/layouts/notebook/client.d.ts +3 -3
  51. package/dist/layouts/notebook/client.js +14 -17
  52. package/dist/layouts/notebook/index.d.ts +1 -1
  53. package/dist/layouts/notebook/page/index.d.ts +91 -3
  54. package/dist/layouts/notebook/page/index.js +67 -7
  55. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
  56. package/dist/layouts/notebook/page/slots/container.js +2 -1
  57. package/dist/layouts/notebook/page/slots/footer.js +1 -0
  58. package/dist/layouts/notebook/page/slots/toc.js +3 -3
  59. package/dist/layouts/notebook/slots/container.js +1 -0
  60. package/dist/layouts/notebook/slots/sidebar.js +9 -19
  61. package/dist/layouts/shared/client.d.ts +6 -6
  62. package/dist/layouts/shared/client.js +4 -4
  63. package/dist/layouts/shared/index.d.ts +3 -3
  64. package/dist/layouts/shared/page-actions.d.ts +2 -2
  65. package/dist/layouts/shared/page-actions.js +3 -3
  66. package/dist/page.d.ts +1 -2
  67. package/dist/page.js +1 -2
  68. package/dist/style.css +302 -60
  69. package/package.json +3 -3
  70. package/dist/layouts/docs/page/client.d.ts +0 -98
  71. package/dist/layouts/docs/page/client.js +0 -110
  72. package/dist/layouts/flux/page/client.d.ts +0 -82
  73. package/dist/layouts/flux/page/client.js +0 -94
  74. package/dist/layouts/notebook/page/client.d.ts +0 -98
  75. package/dist/layouts/notebook/page/client.js +0 -110
@@ -14,6 +14,7 @@
14
14
  @source inline("--accordion-panel-height");
15
15
  @source inline("--anchor-width");
16
16
  @source inline("--available-height");
17
+ @source inline("--available-width");
17
18
  @source inline("--callout-color");
18
19
  @source inline("--collapsible-panel-height");
19
20
  @source inline("--color-fd-");
@@ -25,6 +26,9 @@
25
26
  @source inline("--fd-height");
26
27
  @source inline("--fd-top");
27
28
  @source inline("--padding-right");
29
+ @source inline("--popup-height");
30
+ @source inline("--popup-width");
31
+ @source inline("--positioner-height");
28
32
  @source inline("--shiki-dark-bg");
29
33
  @source inline("--shiki-light-bg");
30
34
  @source inline("--spacing");
@@ -96,7 +100,10 @@
96
100
  @source inline("at");
97
101
  @source inline("attribute");
98
102
  @source inline("await");
103
+ @source inline("b1");
104
+ @source inline("b2");
99
105
  @source inline("backdrop-blur-lg");
106
+ @source inline("backdrop-blur-md");
100
107
  @source inline("backdrop-blur-xs");
101
108
  @source inline("background");
102
109
  @source inline("background-position");
@@ -110,6 +117,8 @@
110
117
  @source inline("based");
111
118
  @source inline("be");
112
119
  @source inline("before");
120
+ @source inline("before:absolute");
121
+ @source inline("before:content-['']");
113
122
  @source inline("behaviour");
114
123
  @source inline("being");
115
124
  @source inline("bg-(--callout-color)/50");
@@ -123,10 +132,12 @@
123
132
  @source inline("bg-fd-overlay");
124
133
  @source inline("bg-fd-popover");
125
134
  @source inline("bg-fd-popover/60");
135
+ @source inline("bg-fd-popover/80");
126
136
  @source inline("bg-fd-primary");
127
137
  @source inline("bg-fd-primary/10");
128
138
  @source inline("bg-fd-secondary");
129
139
  @source inline("bg-fd-secondary/50");
140
+ @source inline("bg-linear-to-t");
130
141
  @source inline("bg-transparent");
131
142
  @source inline("bind");
132
143
  @source inline("black");
@@ -147,6 +158,7 @@
147
158
  @source inline("bottom-1.5");
148
159
  @source inline("bound");
149
160
  @source inline("boundary");
161
+ @source inline("box-border");
150
162
  @source inline("breaking");
151
163
  @source inline("button");
152
164
  @source inline("buttonVariants");
@@ -173,6 +185,7 @@
173
185
  @source inline("client-side");
174
186
  @source inline("clientHeight");
175
187
  @source inline("clientWidth");
188
+ @source inline("clipPath");
176
189
  @source inline("clone");
177
190
  @source inline("close");
178
191
  @source inline("closeOnRedirect");
@@ -183,6 +196,7 @@
183
196
  @source inline("collapsed");
184
197
  @source inline("collapsible");
185
198
  @source inline("collection");
199
+ @source inline("collisionPadding");
186
200
  @source inline("color");
187
201
  @source inline("colors");
188
202
  @source inline("column");
@@ -213,6 +227,7 @@
213
227
  @source inline("custom");
214
228
  @source inline("customise");
215
229
  @source inline("cva");
230
+ @source inline("d");
216
231
  @source inline("dangerouslySetInnerHTML");
217
232
  @source inline("dark");
218
233
  @source inline("dark:bg-(--shiki-dark-bg)");
@@ -221,9 +236,26 @@
221
236
  @source inline("data-[active]:border-fd-primary");
222
237
  @source inline("data-[active]:text-fd-primary");
223
238
  @source inline("data-[closed]:animate-fd-popover-out");
239
+ @source inline("data-[ending-style]:easing-[ease]");
224
240
  @source inline("data-[ending-style]:h-0");
225
241
  @source inline("data-[inactive]:hidden");
226
242
  @source inline("data-[open]:animate-fd-popover-in");
243
+ @source inline("data-[side=bottom]:before:h-2.5");
244
+ @source inline("data-[side=bottom]:before:left-0");
245
+ @source inline("data-[side=bottom]:before:right-0");
246
+ @source inline("data-[side=bottom]:before:top-[-10px]");
247
+ @source inline("data-[side=left]:before:bottom-0");
248
+ @source inline("data-[side=left]:before:right-[-10px]");
249
+ @source inline("data-[side=left]:before:top-0");
250
+ @source inline("data-[side=left]:before:w-2.5");
251
+ @source inline("data-[side=right]:before:bottom-0");
252
+ @source inline("data-[side=right]:before:left-[-10px]");
253
+ @source inline("data-[side=right]:before:top-0");
254
+ @source inline("data-[side=right]:before:w-2.5");
255
+ @source inline("data-[side=top]:before:bottom-[-10px]");
256
+ @source inline("data-[side=top]:before:h-2.5");
257
+ @source inline("data-[side=top]:before:left-0");
258
+ @source inline("data-[side=top]:before:right-0");
227
259
  @source inline("data-[starting-style]:h-0");
228
260
  @source inline("data-[state=open]:bg-fd-accent");
229
261
  @source inline("data-[state=open]:text-fd-accent-foreground");
@@ -238,9 +270,13 @@
238
270
  @source inline("data-empty");
239
271
  @source inline("data-ending-style:data-[activation-direction=left]:translate-x-1/2");
240
272
  @source inline("data-ending-style:data-[activation-direction=right]:-translate-x-1/2");
273
+ @source inline("data-ending-style:duration-150");
274
+ @source inline("data-ending-style:h-0");
241
275
  @source inline("data-ending-style:opacity-0");
276
+ @source inline("data-ending-style:scale-90");
242
277
  @source inline("data-hidden");
243
278
  @source inline("data-icon");
279
+ @source inline("data-instant:transition-none");
244
280
  @source inline("data-line-numbers");
245
281
  @source inline("data-line-numbers-start");
246
282
  @source inline("data-open:animate-fd-dialog-in");
@@ -251,7 +287,9 @@
251
287
  @source inline("data-search-full");
252
288
  @source inline("data-starting-style:data-[activation-direction=left]:-translate-x-1/2");
253
289
  @source inline("data-starting-style:data-[activation-direction=right]:translate-x-1/2");
290
+ @source inline("data-starting-style:h-0");
254
291
  @source inline("data-starting-style:opacity-0");
292
+ @source inline("data-starting-style:scale-90");
255
293
  @source inline("data-state");
256
294
  @source inline("data-theme-toggle");
257
295
  @source inline("date");
@@ -276,6 +314,7 @@
276
314
  @source inline("defineI18nUI");
277
315
  @source inline("defined");
278
316
  @source inline("delay");
317
+ @source inline("delay-25");
279
318
  @source inline("dependencies");
280
319
  @source inline("depends");
281
320
  @source inline("deprecated");
@@ -306,7 +345,6 @@
306
345
  @source inline("duration-200");
307
346
  @source inline("duration-400");
308
347
  @source inline("ease-(--easing)");
309
- @source inline("ease-linear");
310
348
  @source inline("ease-out");
311
349
  @source inline("editOnGithub");
312
350
  @source inline("element");
@@ -317,6 +355,7 @@
317
355
  @source inline("en");
318
356
  @source inline("enableSystem");
319
357
  @source inline("enabled");
358
+ @source inline("end");
320
359
  @source inline("end-2");
321
360
  @source inline("endpoint");
322
361
  @source inline("environment");
@@ -370,7 +409,6 @@
370
409
  @source inline("footerCache");
371
410
  @source inline("for");
372
411
  @source inline("forks");
373
- @source inline("forwardRef");
374
412
  @source inline("found");
375
413
  @source inline("fragment");
376
414
  @source inline("framework");
@@ -421,6 +459,8 @@
421
459
  @source inline("h-(--collapsible-panel-height)");
422
460
  @source inline("h-(--fd-animated-height)");
423
461
  @source inline("h-(--fd-height)");
462
+ @source inline("h-(--popup-height)");
463
+ @source inline("h-(--positioner-height)");
424
464
  @source inline("h-1.5");
425
465
  @source inline("h-9.5");
426
466
  @source inline("h-full");
@@ -453,6 +493,7 @@
453
493
  @source inline("hover:bg-fd-accent");
454
494
  @source inline("hover:bg-fd-accent/80");
455
495
  @source inline("hover:bg-fd-primary/80");
496
+ @source inline("hover:delay-0");
456
497
  @source inline("hover:text-fd-accent-foreground");
457
498
  @source inline("hovered");
458
499
  @source inline("hovering");
@@ -466,6 +507,7 @@
466
507
  @source inline("iconClass");
467
508
  @source inline("id");
468
509
  @source inline("idea");
510
+ @source inline("ids");
469
511
  @source inline("idx");
470
512
  @source inline("if");
471
513
  @source inline("if-needed");
@@ -482,6 +524,7 @@
482
524
  @source inline("inputType");
483
525
  @source inline("insert");
484
526
  @source inline("inset-0");
527
+ @source inline("inset-s-0");
485
528
  @source inline("inset-x-2");
486
529
  @source inline("inset-y-0");
487
530
  @source inline("insetInlineStart");
@@ -524,6 +567,7 @@
524
567
  @source inline("lazy");
525
568
  @source inline("leading-none");
526
569
  @source inline("leaving");
570
+ @source inline("left");
527
571
  @source inline("left-1/2");
528
572
  @source inline("length");
529
573
  @source inline("let");
@@ -556,6 +600,7 @@
556
600
  @source inline("mark");
557
601
  @source inline("markdownUrl");
558
602
  @source inline("marked");
603
+ @source inline("mask-[linear-gradient(to_bottom,transparent,white_12px,white_calc(100%-12px),transparent)]");
559
604
  @source inline("mask-[linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)]");
560
605
  @source inline("mask-[linear-gradient(to_bottom,white,white_30px,transparent_80px)]");
561
606
  @source inline("maskComposite");
@@ -569,6 +614,7 @@
569
614
  @source inline("max-md:border");
570
615
  @source inline("max-md:p-1.5");
571
616
  @source inline("max-md:rounded-md");
617
+ @source inline("max-w-(--available-width)");
572
618
  @source inline("max-w-[1400px]");
573
619
  @source inline("max-w-[98vw]");
574
620
  @source inline("max-w-full");
@@ -716,6 +762,7 @@
716
762
  @source inline("p-2");
717
763
  @source inline("p-3");
718
764
  @source inline("p-4");
765
+ @source inline("pOffset");
719
766
  @source inline("padding");
720
767
  @source inline("paddingInlineStart");
721
768
  @source inline("page");
@@ -831,6 +878,7 @@
831
878
  @source inline("results");
832
879
  @source inline("return");
833
880
  @source inline("revalidate");
881
+ @source inline("right");
834
882
  @source inline("right-2");
835
883
  @source inline("role");
836
884
  @source inline("root");
@@ -838,7 +886,7 @@
838
886
  @source inline("round");
839
887
  @source inline("rounded-2xl");
840
888
  @source inline("rounded-[inherit]");
841
- @source inline("rounded-e-sm");
889
+ @source inline("rounded-e-full");
842
890
  @source inline("rounded-full");
843
891
  @source inline("rounded-lg");
844
892
  @source inline("rounded-md");
@@ -847,7 +895,6 @@
847
895
  @source inline("router");
848
896
  @source inline("row");
849
897
  @source inline("rtl");
850
- @source inline("rtl:-scale-x-100");
851
898
  @source inline("rtl:rotate-180");
852
899
  @source inline("rtl:rotate-90");
853
900
  @source inline("s");
@@ -909,6 +956,7 @@
909
956
  @source inline("simple");
910
957
  @source inline("since");
911
958
  @source inline("size");
959
+ @source inline("size-1");
912
960
  @source inline("size-3");
913
961
  @source inline("size-3.5");
914
962
  @source inline("size-4");
@@ -927,7 +975,6 @@
927
975
  @source inline("specific");
928
976
  @source inline("src");
929
977
  @source inline("stars");
930
- @source inline("start-0");
931
978
  @source inline("start-3");
932
979
  @source inline("start-6");
933
980
  @source inline("state");
@@ -937,7 +984,7 @@
937
984
  @source inline("string");
938
985
  @source inline("stroke");
939
986
  @source inline("stroke-fd-foreground/10");
940
- @source inline("stroke-width");
987
+ @source inline("stroke-fd-primary");
941
988
  @source inline("strokeLinecap");
942
989
  @source inline("strokeLinejoin");
943
990
  @source inline("strokeWidth");
@@ -950,9 +997,11 @@
950
997
  @source inline("supposed");
951
998
  @source inline("sure");
952
999
  @source inline("svg");
1000
+ @source inline("svgRef");
953
1001
  @source inline("switch");
954
1002
  @source inline("system");
955
1003
  @source inline("t");
1004
+ @source inline("t2");
956
1005
  @source inline("tab");
957
1006
  @source inline("tabIndex");
958
1007
  @source inline("table");
@@ -1016,13 +1065,18 @@
1016
1065
  @source inline("top-4");
1017
1066
  @source inline("touch");
1018
1067
  @source inline("transform");
1068
+ @source inline("transition-[clip-path]");
1069
+ @source inline("transition-[height,opacity]");
1019
1070
  @source inline("transition-[height]");
1020
1071
  @source inline("transition-[opacity,transform,translate]");
1072
+ @source inline("transition-[opacity,transform,width,height,scale,translate]");
1021
1073
  @source inline("transition-[top,height]");
1022
1074
  @source inline("transition-all");
1023
1075
  @source inline("transition-colors");
1024
1076
  @source inline("transition-opacity");
1025
1077
  @source inline("transition-transform");
1078
+ @source inline("translate");
1079
+ @source inline("translate-y-1/2");
1026
1080
  @source inline("translations");
1027
1081
  @source inline("transparent");
1028
1082
  @source inline("tree");
@@ -1088,6 +1142,7 @@
1088
1142
  @source inline("variants");
1089
1143
  @source inline("vertical");
1090
1144
  @source inline("via");
1145
+ @source inline("via-fd-primary");
1091
1146
  @source inline("viewBox");
1092
1147
  @source inline("viewRef");
1093
1148
  @source inline("viewport");
@@ -1096,6 +1151,7 @@
1096
1151
  @source inline("void");
1097
1152
  @source inline("w");
1098
1153
  @source inline("w-(--anchor-width)");
1154
+ @source inline("w-(--popup-width)");
1099
1155
  @source inline("w-0");
1100
1156
  @source inline("w-0.5");
1101
1157
  @source inline("w-1.5");
@@ -1124,11 +1180,8 @@
1124
1180
  @source inline("wrapElement");
1125
1181
  @source inline("wrapInSuspense");
1126
1182
  @source inline("wrapped");
1127
- @source inline("x1");
1128
- @source inline("x2");
1129
1183
  @source inline("xmlns");
1130
- @source inline("y1");
1131
- @source inline("y2");
1184
+ @source inline("y");
1132
1185
  @source inline("you");
1133
1186
  @source inline("your");
1134
1187
  @source inline("z-2");
@@ -140,8 +140,7 @@ function SidebarViewport({ className, ...props }) {
140
140
  className: (s) => cn("min-h-0 flex-1", typeof className === "function" ? className(s) : className),
141
141
  ...props,
142
142
  children: /* @__PURE__ */ jsx(ScrollViewport, {
143
- className: "p-4 overscroll-contain",
144
- style: { maskImage: "linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)" },
143
+ className: "p-4 overscroll-contain mask-[linear-gradient(to_bottom,transparent,white_12px,white_calc(100%-12px),transparent)]",
145
144
  children: props.children
146
145
  })
147
146
  });
@@ -1,8 +1,7 @@
1
- import { Tabs as Tabs$1, TabsContent as TabsContent$1 } from "./ui/tabs.js";
1
+ import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
2
2
  import * as React$1 from "react";
3
3
  import { ComponentProps, ReactNode } from "react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
- import * as _base_ui_react0 from "@base-ui/react";
6
5
 
7
6
  //#region src/components/tabs.d.ts
8
7
  interface TabsProps extends Omit<ComponentProps<typeof Tabs$1>, 'value' | 'onValueChange'> {
@@ -21,8 +20,14 @@ interface TabsProps extends Omit<ComponentProps<typeof Tabs$1>, 'value' | 'onVal
21
20
  */
22
21
  label?: ReactNode;
23
22
  }
24
- declare const TabsList: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.TabsListProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
25
- declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.TabsTabProps, "ref"> & React$1.RefAttributes<HTMLElement>, "ref"> & React$1.RefAttributes<HTMLElement>>;
23
+ declare function TabsList({
24
+ className,
25
+ ...props
26
+ }: React$1.ComponentPropsWithRef<typeof TabsList$1>): react_jsx_runtime0.JSX.Element;
27
+ declare function TabsTrigger({
28
+ className,
29
+ ...props
30
+ }: React$1.ComponentPropsWithRef<typeof TabsTrigger$1>): react_jsx_runtime0.JSX.Element;
26
31
  declare function Tabs({
27
32
  ref,
28
33
  className,
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
4
- import * as React$1 from "react";
5
4
  import { createContext, useContext, useEffect, useId, useMemo, useState } from "react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
7
6
  //#region src/components/tabs.tsx
@@ -11,18 +10,18 @@ function useTabContext() {
11
10
  if (!ctx) throw new Error("You must wrap your component in <Tabs>");
12
11
  return ctx;
13
12
  }
14
- const TabsList = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsList$1, {
15
- ref,
16
- ...props,
17
- className: (s) => cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", typeof className === "function" ? className(s) : className)
18
- }));
19
- TabsList.displayName = "TabsList";
20
- const TabsTrigger = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsTrigger$1, {
21
- ref,
22
- ...props,
23
- className: (s) => cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[active]:border-fd-primary data-[active]:text-fd-primary", typeof className === "function" ? className(s) : className)
24
- }));
25
- TabsTrigger.displayName = "TabsTrigger";
13
+ function TabsList({ className, ...props }) {
14
+ return /* @__PURE__ */ jsx(TabsList$1, {
15
+ ...props,
16
+ className: (s) => cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", typeof className === "function" ? className(s) : className)
17
+ });
18
+ }
19
+ function TabsTrigger({ className, ...props }) {
20
+ return /* @__PURE__ */ jsx(TabsTrigger$1, {
21
+ ...props,
22
+ className: (s) => cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[active]:border-fd-primary data-[active]:text-fd-primary", typeof className === "function" ? className(s) : className)
23
+ });
24
+ }
26
25
  function Tabs({ ref, className, items, label, defaultIndex = 0, defaultValue = items ? escapeValue(items[defaultIndex]) : void 0, ...props }) {
27
26
  const [value, setValue] = useState(defaultValue);
28
27
  const collection = useMemo(() => [], []);
@@ -11,29 +11,37 @@ function TOCItems({ ref, className, ...props }) {
11
11
  const containerRef = useRef(null);
12
12
  const items = useTOCItems();
13
13
  const { text } = useI18n();
14
+ const svgRef = useRef(null);
14
15
  const [svg, setSvg] = useState();
15
16
  useEffect(() => {
16
17
  if (!containerRef.current) return;
17
18
  const container = containerRef.current;
18
19
  function onResize() {
19
20
  if (container.clientHeight === 0) return;
20
- let w = 0, h = 0;
21
- const d = [];
21
+ let w = 0, h = 0, b1 = 0, d = "";
22
22
  for (let i = 0; i < items.length; i++) {
23
23
  const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
24
24
  if (!element) continue;
25
25
  const styles = getComputedStyle(element);
26
- const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
26
+ const offset = getLineOffset(items[i].depth) + 1, t2 = element.offsetTop + parseFloat(styles.paddingTop), b2 = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
27
27
  w = Math.max(offset, w);
28
- h = Math.max(h, bottom);
29
- d.push(`${i === 0 ? "M" : "L"}${offset} ${top}`);
30
- d.push(`L${offset} ${bottom}`);
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);
31
44
  }
32
- setSvg({
33
- path: d.join(" "),
34
- width: w + 1,
35
- height: h
36
- });
37
45
  }
38
46
  const observer = new ResizeObserver(onResize);
39
47
  onResize();
@@ -46,17 +54,29 @@ function TOCItems({ ref, className, ...props }) {
46
54
  className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
47
55
  children: text.tocNoHeadings
48
56
  });
49
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsx("div", {
50
- className: "absolute start-0 top-0 rtl:-scale-x-100",
57
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsxs(TocThumb, {
58
+ containerRef,
59
+ className: "absolute top-0 inset-s-0",
51
60
  style: {
52
61
  width: svg.width,
53
- height: svg.height,
54
- maskImage: `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`)}")`
62
+ height: svg.height
55
63
  },
56
- children: /* @__PURE__ */ jsx(TocThumb, {
57
- containerRef,
58
- className: "absolute w-full top-(--fd-top) h-(--fd-height) bg-fd-primary transition-[top,height]"
59
- })
64
+ children: [/* @__PURE__ */ jsx("svg", {
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ viewBox: `0 0 ${svg.width} ${svg.height}`,
67
+ className: "absolute inset-0 transition-[clip-path] delay-25",
68
+ style: {
69
+ width: svg.width,
70
+ height: svg.height,
71
+ 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)))`
72
+ },
73
+ children: /* @__PURE__ */ jsx("path", {
74
+ d: svg.d,
75
+ className: "stroke-fd-primary",
76
+ strokeWidth: "1",
77
+ fill: "none"
78
+ })
79
+ }), /* @__PURE__ */ jsx(ThumbBox, {})]
60
80
  }), /* @__PURE__ */ jsx("div", {
61
81
  ref: mergeRefs(containerRef, ref),
62
82
  className: cn("flex flex-col", className),
@@ -68,13 +88,25 @@ function TOCItems({ ref, className, ...props }) {
68
88
  }, item.url))
69
89
  })] });
70
90
  }
91
+ 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;
96
+ 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))` }
99
+ });
100
+ }
71
101
  function getItemOffset(depth) {
72
102
  if (depth <= 2) return 14;
73
103
  if (depth === 3) return 26;
74
104
  return 36;
75
105
  }
76
106
  function getLineOffset(depth) {
77
- return depth >= 3 ? 10 : 0;
107
+ if (depth <= 2) return 2;
108
+ if (depth === 3) return 10;
109
+ return 20;
78
110
  }
79
111
  function TOCItem({ item, upper = item.depth, lower = item.depth }) {
80
112
  const offset = getLineOffset(item.depth), upperOffset = getLineOffset(upper), lowerOffset = getLineOffset(lower);
@@ -85,15 +117,19 @@ function TOCItem({ item, upper = item.depth, lower = item.depth }) {
85
117
  children: [
86
118
  offset !== upperOffset && /* @__PURE__ */ jsx("svg", {
87
119
  xmlns: "http://www.w3.org/2000/svg",
88
- viewBox: "0 0 16 16",
89
- className: "absolute -top-1.5 start-0 size-4 rtl:-scale-x-100",
90
- children: /* @__PURE__ */ jsx("line", {
91
- x1: upperOffset,
92
- y1: "0",
93
- x2: offset,
94
- y2: "12",
95
- className: "stroke-fd-foreground/10",
96
- strokeWidth: "1"
120
+ viewBox: `${Math.min(offset, upperOffset)} 0 ${Math.abs(upperOffset - offset)} 12`,
121
+ className: "absolute -top-1.5",
122
+ style: {
123
+ width: Math.abs(upperOffset - offset) + 1,
124
+ height: 12,
125
+ insetInlineStart: Math.min(offset, upperOffset)
126
+ },
127
+ children: /* @__PURE__ */ jsx("path", {
128
+ d: `M ${upperOffset} 0 C ${upperOffset} 8 ${offset} 4 ${offset} 12`,
129
+ stroke: "black",
130
+ strokeWidth: "1",
131
+ fill: "none",
132
+ className: "stroke-fd-foreground/10"
97
133
  })
98
134
  }),
99
135
  /* @__PURE__ */ jsx("div", {
@@ -15,9 +15,11 @@ function TOCItems({ ref, className, ...props }) {
15
15
  className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
16
16
  children: text.tocNoHeadings
17
17
  });
18
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(TocThumb, {
18
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(TocThumb, {
19
19
  containerRef,
20
- className: "absolute top-(--fd-top) h-(--fd-height) w-0.5 rounded-e-sm bg-fd-primary transition-[top,height] ease-linear"
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" })]
21
23
  }), /* @__PURE__ */ jsx("div", {
22
24
  ref: mergeRefs(ref, containerRef),
23
25
  className: cn("flex flex-col border-s border-fd-foreground/10", className),
@@ -28,7 +30,7 @@ function TOCItems({ ref, className, ...props }) {
28
30
  function TOCItem({ item }) {
29
31
  return /* @__PURE__ */ jsx(Primitive.TOCItem, {
30
32
  href: item.url,
31
- className: cn("prose py-1.5 text-sm text-fd-muted-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8"),
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"),
32
34
  children: item.title
33
35
  });
34
36
  }
@@ -16,12 +16,14 @@ declare function TOCScrollArea({
16
16
  className,
17
17
  ...props
18
18
  }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
19
- interface RefProps {
19
+ interface TocThumbProps extends ComponentProps<'div'> {
20
20
  containerRef: RefObject<HTMLElement | null>;
21
+ align?: 'center' | 'end';
21
22
  }
22
23
  declare function TocThumb({
23
24
  containerRef,
25
+ align,
24
26
  ...props
25
- }: ComponentProps<'div'> & RefProps): react_jsx_runtime0.JSX.Element;
27
+ }: TocThumbProps): react_jsx_runtime0.JSX.Element;
26
28
  //#endregion
27
29
  export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useTOCItems };