@fumadocs/base-ui 16.7.15 → 16.8.0

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.
@@ -15,7 +15,6 @@
15
15
  @source inline("--anchor-width");
16
16
  @source inline("--available-height");
17
17
  @source inline("--available-width");
18
- @source inline("--b");
19
18
  @source inline("--callout-color");
20
19
  @source inline("--collapsible-panel-height");
21
20
  @source inline("--color-fd-");
@@ -33,7 +32,6 @@
33
32
  @source inline("--shiki-dark-bg");
34
33
  @source inline("--shiki-light-bg");
35
34
  @source inline("--spacing");
36
- @source inline("--t");
37
35
  @source inline("--track-bottom");
38
36
  @source inline("--track-top");
39
37
  @source inline("--transform-origin");
@@ -165,9 +163,7 @@
165
163
  @source inline("bottom-1.5");
166
164
  @source inline("bound");
167
165
  @source inline("boundary");
168
- @source inline("box");
169
166
  @source inline("box-border");
170
- @source inline("boxRef");
171
167
  @source inline("breaking");
172
168
  @source inline("button");
173
169
  @source inline("buttonVariants");
@@ -344,6 +340,7 @@
344
340
  @source inline("display");
345
341
  @source inline("displayName");
346
342
  @source inline("displayed");
343
+ @source inline("distance");
347
344
  @source inline("div");
348
345
  @source inline("divide-fd-border");
349
346
  @source inline("divide-x");
@@ -466,8 +463,6 @@
466
463
  @source inline("group-data-[open]:rotate-180");
467
464
  @source inline("group-data-[panel-open]:rotate-90");
468
465
  @source inline("group-data-active:bg-fd-primary");
469
- @source inline("group-first:[--t:--spacing(0.75)]");
470
- @source inline("group-last:[--b:--spacing(0.75)]");
471
466
  @source inline("groupListeners");
472
467
  @source inline("guides");
473
468
  @source inline("h");
@@ -549,6 +544,8 @@
549
544
  @source inline("invisible");
550
545
  @source inline("is");
551
546
  @source inline("isActive");
547
+ @source inline("isFirst");
548
+ @source inline("isLast");
552
549
  @source inline("isLoading");
553
550
  @source inline("isOpen");
554
551
  @source inline("isTabActive");
@@ -678,6 +675,7 @@
678
675
  @source inline("my-4");
679
676
  @source inline("my-6");
680
677
  @source inline("my-auto");
678
+ @source inline("n");
681
679
  @source inline("name");
682
680
  @source inline("namespace");
683
681
  @source inline("nav");
@@ -745,7 +743,6 @@
745
743
  @source inline("onSelectCallback");
746
744
  @source inline("onTagChange");
747
745
  @source inline("onTagChangeCallback");
748
- @source inline("onUpdate");
749
746
  @source inline("onValueChange");
750
747
  @source inline("only");
751
748
  @source inline("opacity-(--opacity,0)");
@@ -762,6 +759,7 @@
762
759
  @source inline("origin-(--transform-origin)");
763
760
  @source inline("original");
764
761
  @source inline("other");
762
+ @source inline("out");
765
763
  @source inline("outer");
766
764
  @source inline("outline");
767
765
  @source inline("outline-none");
@@ -794,6 +792,7 @@
794
792
  @source inline("path");
795
793
  @source inline("pathname");
796
794
  @source inline("paths");
795
+ @source inline("pb-0");
797
796
  @source inline("pb-2");
798
797
  @source inline("pe-2");
799
798
  @source inline("peer");
@@ -1020,7 +1019,6 @@
1020
1019
  @source inline("supposed");
1021
1020
  @source inline("sure");
1022
1021
  @source inline("svg");
1023
- @source inline("svgRef");
1024
1022
  @source inline("switch");
1025
1023
  @source inline("system");
1026
1024
  @source inline("t");
@@ -1086,8 +1084,6 @@
1086
1084
  @source inline("top-2");
1087
1085
  @source inline("top-2.5");
1088
1086
  @source inline("top-4");
1089
- @source inline("top-[calc(50%-var(--t,0px)+var(--b,0px))]");
1090
- @source inline("topL");
1091
1087
  @source inline("touch");
1092
1088
  @source inline("transform");
1093
1089
  @source inline("transition-[clip-path]");
package/css/lib/shiki.css CHANGED
@@ -95,3 +95,14 @@
95
95
  font-style: var(--shiki-dark-font-style);
96
96
  }
97
97
  }
98
+
99
+ /* inline code */
100
+ code.shiki span {
101
+ color: var(--shiki-light);
102
+ font-style: var(--shiki-light-font-style);
103
+ }
104
+
105
+ .dark code.shiki span {
106
+ color: var(--shiki-dark);
107
+ font-style: var(--shiki-dark-font-style);
108
+ }
@@ -10,6 +10,7 @@ declare function TOCItems({
10
10
  ref,
11
11
  className,
12
12
  thumbBox,
13
+ children,
13
14
  ...props
14
15
  }: TOCItemsProps): _$react_jsx_runtime0.JSX.Element;
15
16
  declare function TOCEmpty(): _$react_jsx_runtime0.JSX.Element;
@@ -5,7 +5,7 @@ import { cn } from "../../utils/cn.js";
5
5
  import { mergeRefs } from "../../utils/merge-refs.js";
6
6
  import { useTOCItems } from "./index.js";
7
7
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import * as Primitive from "fumadocs-core/toc";
10
10
  //#region src/components/toc/clerk.tsx
11
11
  var clerk_exports = /* @__PURE__ */ __exportAll({
@@ -13,7 +13,7 @@ var clerk_exports = /* @__PURE__ */ __exportAll({
13
13
  TOCItem: () => TOCItem,
14
14
  TOCItems: () => TOCItems
15
15
  });
16
- function TOCItems({ ref, className, thumbBox = true, ...props }) {
16
+ function TOCItems({ ref, className, thumbBox = true, children, ...props }) {
17
17
  const containerRef = useRef(null);
18
18
  const items = useTOCItems();
19
19
  const [svg, setSvg] = useState(null);
@@ -78,12 +78,12 @@ function TOCItems({ ref, className, thumbBox = true, ...props }) {
78
78
  if (thumbBox) {
79
79
  const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
80
80
  path.setAttribute("d", d);
81
- let l = 0;
82
- for (const [top, bottom] of positions) {
83
- while (path.getPointAtLength(l).y < top) l++;
84
- const topL = l;
85
- while (path.getPointAtLength(l).y < bottom) l++;
86
- itemLineLengths.push([topL, l]);
81
+ const n = path.getTotalLength();
82
+ for (let i = 0; i < positions.length; i++) {
83
+ const [top, bottom] = positions[i];
84
+ let l = i > 0 ? itemLineLengths[i - 1][1] + (top - positions[i - 1][1]) : top;
85
+ while (l < n && path.getPointAtLength(l).y < top) l++;
86
+ itemLineLengths.push([l, l + bottom - top]);
87
87
  }
88
88
  }
89
89
  setSvg({
@@ -105,14 +105,15 @@ function TOCItems({ ref, className, thumbBox = true, ...props }) {
105
105
  observer.unobserve(container);
106
106
  };
107
107
  }, [onPrint]);
108
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsx(ThumbTrack, {
109
- computed: svg,
110
- thumbBox
111
- }), /* @__PURE__ */ jsx("div", {
108
+ return /* @__PURE__ */ jsxs("div", {
112
109
  ref: mergeRefs(containerRef, ref),
113
- className: cn("flex flex-col", className),
114
- ...props
115
- })] });
110
+ className: cn("relative flex flex-col", className),
111
+ ...props,
112
+ children: [svg && /* @__PURE__ */ jsx(ThumbTrack, {
113
+ computed: svg,
114
+ thumbBox
115
+ }), children]
116
+ });
116
117
  }
117
118
  function TOCEmpty() {
118
119
  const { text } = useI18n();
@@ -122,20 +123,17 @@ function TOCEmpty() {
122
123
  });
123
124
  }
124
125
  function ThumbTrack({ computed, thumbBox }) {
125
- const svgRef = useRef(null);
126
- const boxRef = useRef(null);
126
+ const ref = useRef(null);
127
127
  const previousRef = useRef(null);
128
128
  const tocInfo = Primitive.useTOC();
129
- const onUpdate = useCallback((items) => {
130
- const svg = svgRef.current;
131
- if (!svg) return;
129
+ function calculate(items) {
130
+ const out = {};
132
131
  const startIdx = items.findIndex((item) => item.active);
133
- if (startIdx === -1) return;
132
+ if (startIdx === -1) return out;
134
133
  const endIdx = items.findLastIndex((item) => item.active);
135
- svg.style.setProperty("--track-top", `${computed.positions[startIdx][0]}px`);
136
- svg.style.setProperty("--track-bottom", `${computed.positions[endIdx][1]}px`);
137
- const box = boxRef.current;
138
- if (box) {
134
+ out["--track-top"] = `${computed.positions[startIdx][0]}px`;
135
+ out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
136
+ if (thumbBox) {
139
137
  let isUp = false;
140
138
  if (previousRef.current) {
141
139
  const prev = previousRef.current;
@@ -146,22 +144,25 @@ function ThumbTrack({ computed, thumbBox }) {
146
144
  endIdx,
147
145
  isUp
148
146
  };
149
- box.style.setProperty("--offset-distance", isUp ? `${computed.itemLineLengths[startIdx][0]}px` : `${computed.itemLineLengths[endIdx][1]}px`);
150
- box.style.setProperty("--opacity", items[isUp ? startIdx : endIdx].original._step !== void 0 ? "0" : "1");
147
+ out["--offset-distance"] = isUp ? `${computed.itemLineLengths[startIdx][0]}px` : `${computed.itemLineLengths[endIdx][1]}px`;
148
+ out["--opacity"] = items[isUp ? startIdx : endIdx].original._step !== void 0 ? "0" : "1";
151
149
  }
152
- }, [computed]);
153
- Primitive.useTOCListener(onUpdate);
154
- useEffect(() => {
155
- onUpdate(tocInfo.get());
156
- }, [onUpdate, tocInfo]);
150
+ return out;
151
+ }
152
+ Primitive.useTOCListener((items) => {
153
+ const element = ref.current;
154
+ if (!element) return;
155
+ for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
156
+ });
157
157
  return /* @__PURE__ */ jsxs("div", {
158
+ ref,
158
159
  className: "absolute top-0 inset-s-0",
159
160
  style: {
160
161
  width: computed.width,
161
- height: computed.height
162
+ height: computed.height,
163
+ ...calculate(tocInfo.get())
162
164
  },
163
165
  children: [/* @__PURE__ */ jsx("svg", {
164
- ref: svgRef,
165
166
  xmlns: "http://www.w3.org/2000/svg",
166
167
  viewBox: `0 0 ${computed.width} ${computed.height}`,
167
168
  className: "absolute transition-[clip-path]",
@@ -172,7 +173,6 @@ function ThumbTrack({ computed, thumbBox }) {
172
173
  },
173
174
  children: computed.content
174
175
  }), thumbBox && /* @__PURE__ */ jsx("div", {
175
- ref: boxRef,
176
176
  className: "absolute size-1 bg-fd-primary rounded-full [offset-distance:var(--offset-distance,0)] opacity-(--opacity,0) transition-[opacity,offset-distance]",
177
177
  style: { offsetPath: `path("${computed.d}")` }
178
178
  })]
@@ -191,11 +191,13 @@ function getLineOffset(depth) {
191
191
  }
192
192
  function TOCItem({ item, ...props }) {
193
193
  const items = useTOCItems();
194
- const { lowerOffset, offset, upperOffset } = useMemo(() => {
194
+ const { lowerOffset, offset, upperOffset, isFirst, isLast } = useMemo(() => {
195
195
  const index = items.indexOf(item);
196
196
  const offset = getLineOffset(item.depth);
197
197
  return {
198
198
  offset,
199
+ isFirst: index === 0,
200
+ isLast: index === items.length - 1,
199
201
  upperOffset: index > 0 ? getLineOffset(items[index - 1].depth) : offset,
200
202
  lowerOffset: index + 1 < items.length ? getLineOffset(items[index + 1].depth) : offset
201
203
  };
@@ -203,7 +205,7 @@ function TOCItem({ item, ...props }) {
203
205
  return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
204
206
  href: item.url,
205
207
  ...props,
206
- 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),
208
+ 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 data-[active=true]:text-fd-primary", isFirst && "pt-0", isLast && "pb-0", props.className),
207
209
  style: {
208
210
  paddingInlineStart: getItemOffset(item.depth),
209
211
  ...props.style
@@ -231,8 +233,11 @@ function TOCItem({ item, ...props }) {
231
233
  style: { insetInlineStart: offset }
232
234
  }),
233
235
  item._step !== void 0 && /* @__PURE__ */ jsx("div", {
234
- 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)]",
235
- style: { insetInlineStart: offset },
236
+ className: "absolute flex items-center justify-center -translate-1/2 -z-1 size-4 font-mono font-medium text-xs bg-fd-muted text-fd-muted-foreground rounded-full leading-none",
237
+ style: {
238
+ top: `calc(50% + ${(isFirst ? -.75 : 0) + (isLast ? .75 : 0)} * var(--spacing))`,
239
+ insetInlineStart: offset
240
+ },
236
241
  children: item._step
237
242
  }),
238
243
  item.title
@@ -55,23 +55,27 @@ function TOCItems({ ref, className, ...props }) {
55
55
  function TocThumb({ computed }) {
56
56
  const ref = useRef(null);
57
57
  const tocInfo = Primitive.useTOC();
58
- const onUpdate = useCallback((items) => {
59
- const element = ref.current;
60
- if (!element) return;
58
+ function calculate(items) {
59
+ const out = {};
61
60
  const startIdx = items.findIndex((item) => item.active);
62
- if (startIdx === -1) return;
61
+ if (startIdx === -1) return out;
63
62
  const endIdx = items.findLastIndex((item) => item.active);
64
- element.style.setProperty("--track-top", `${computed.positions[startIdx][0]}px`);
65
- element.style.setProperty("--track-bottom", `${computed.positions[endIdx][1]}px`);
66
- }, [computed]);
67
- Primitive.useTOCListener(onUpdate);
68
- useEffect(() => {
69
- onUpdate(tocInfo.get());
70
- }, [onUpdate, tocInfo]);
63
+ out["--track-top"] = `${computed.positions[startIdx][0]}px`;
64
+ out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
65
+ return out;
66
+ }
67
+ Primitive.useTOCListener((items) => {
68
+ const element = ref.current;
69
+ if (!element) return;
70
+ for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
71
+ });
71
72
  return /* @__PURE__ */ jsx("div", {
72
73
  ref,
73
74
  className: "absolute inset-y-0 inset-s-0 bg-fd-primary w-px transition-[clip-path]",
74
- style: { clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))` }
75
+ style: {
76
+ clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))`,
77
+ ...calculate(tocInfo.get())
78
+ }
75
79
  });
76
80
  }
77
81
  function TOCEmpty() {
@@ -6,7 +6,7 @@ import * as _$_base_ui_react0 from "@base-ui/react";
6
6
  //#region src/components/ui/navigation-menu.d.ts
7
7
  type NavigationMenuContentProps = NavigationMenu$1.Content.Props;
8
8
  type NavigationMenuTriggerProps = NavigationMenu$1.Trigger.Props;
9
- declare const NavigationMenu: React$1.ForwardRefExoticComponent<Omit<_$_base_ui_react0.NavigationMenuRootProps, "ref"> & React$1.RefAttributes<HTMLElement>>;
9
+ declare const NavigationMenu: <Value = any>(props: NavigationMenu$1.Root.Props<Value>) => React$1.JSX.Element;
10
10
  declare const NavigationMenuList: React$1.ForwardRefExoticComponent<Omit<_$_base_ui_react0.NavigationMenuListProps, "ref"> & React$1.RefAttributes<HTMLUListElement>>;
11
11
  declare function NavigationMenuItem({
12
12
  className,
@@ -4,7 +4,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
4
4
 
5
5
  //#region src/layouts/home/slots/header.d.ts
6
6
  declare const navItemVariants: (props?: ({
7
- variant?: "icon" | "main" | "button" | null | undefined;
7
+ variant?: "button" | "main" | "icon" | null | undefined;
8
8
  } & _$class_variance_authority_types0.ClassProp) | undefined) => string;
9
9
  declare function Header(props: ComponentProps<'header'>): _$react_jsx_runtime0.JSX.Element;
10
10
  //#endregion
package/dist/style.css CHANGED
@@ -358,9 +358,6 @@
358
358
  .top-\[calc\(--spacing\(4\)\+var\(--fd-docs-row-3\)\)\] {
359
359
  top: calc(calc(var(--spacing) * 4) + var(--fd-docs-row-3));
360
360
  }
361
- .top-\[calc\(50\%-var\(--t\,0px\)\+var\(--b\,0px\)\)\] {
362
- top: calc(50% - var(--t,0px) + var(--b,0px));
363
- }
364
361
  .right-2 {
365
362
  right: calc(var(--spacing) * 2);
366
363
  }
@@ -920,6 +917,9 @@
920
917
  .hidden {
921
918
  display: none;
922
919
  }
920
+ .inline {
921
+ display: inline;
922
+ }
923
923
  .inline-flex {
924
924
  display: inline-flex;
925
925
  }
@@ -1675,6 +1675,9 @@
1675
1675
  .pr-\(--removed-body-scroll-bar-size\,0\) {
1676
1676
  padding-right: var(--removed-body-scroll-bar-size,0);
1677
1677
  }
1678
+ .pb-0 {
1679
+ padding-bottom: calc(var(--spacing) * 0);
1680
+ }
1678
1681
  .pb-1\.5 {
1679
1682
  padding-bottom: calc(var(--spacing) * 1.5);
1680
1683
  }
@@ -2084,16 +2087,6 @@
2084
2087
  margin-bottom: calc(var(--spacing) * 2);
2085
2088
  }
2086
2089
  }
2087
- .group-first\:\[--t\:--spacing\(0\.75\)\] {
2088
- &:is(:where(.group):first-child *) {
2089
- --t: calc(var(--spacing) * 0.75);
2090
- }
2091
- }
2092
- .group-last\:\[--b\:--spacing\(0\.75\)\] {
2093
- &:is(:where(.group):last-child *) {
2094
- --b: calc(var(--spacing) * 0.75);
2095
- }
2096
- }
2097
2090
  .group-data-active\:bg-fd-primary {
2098
2091
  &:is(:where(.group)[data-active] *) {
2099
2092
  background-color: var(--color-fd-primary);
@@ -3243,6 +3236,14 @@
3243
3236
  font-style: var(--shiki-dark-font-style);
3244
3237
  }
3245
3238
  }
3239
+ code.shiki span {
3240
+ color: var(--shiki-light);
3241
+ font-style: var(--shiki-light-font-style);
3242
+ }
3243
+ .dark code.shiki span {
3244
+ color: var(--shiki-dark);
3245
+ font-style: var(--shiki-dark-font-style);
3246
+ }
3246
3247
  @layer base {
3247
3248
  body {
3248
3249
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fumadocs/base-ui",
3
- "version": "16.7.15",
3
+ "version": "16.8.0",
4
4
  "description": "The Base UI version of Fumadocs UI",
5
5
  "keywords": [
6
6
  "Docs",
@@ -116,7 +116,7 @@
116
116
  "access": "public"
117
117
  },
118
118
  "dependencies": {
119
- "@base-ui/react": "^1.3.0",
119
+ "@base-ui/react": "^1.4.0",
120
120
  "class-variance-authority": "^0.7.1",
121
121
  "lucide-react": "^1.8.0",
122
122
  "motion": "^12.38.0",
@@ -131,7 +131,7 @@
131
131
  },
132
132
  "devDependencies": {
133
133
  "@tailwindcss/cli": "^4.2.2",
134
- "@tsdown/css": "^0.21.6",
134
+ "@tsdown/css": "^0.21.8",
135
135
  "@types/hast": "^3.0.4",
136
136
  "@types/mdx": "^2.0.13",
137
137
  "@types/node": "^25.6.0",
@@ -140,11 +140,11 @@
140
140
  "fuma-cli": "^0.0.5",
141
141
  "react-medium-image-zoom": "^5.4.3",
142
142
  "tailwindcss": "^4.2.2",
143
- "tsdown": "0.21.7",
143
+ "tsdown": "0.21.8",
144
144
  "unified": "^11.0.5",
145
- "@fumadocs/cli": "1.3.7",
146
- "fumadocs-core": "16.7.15",
147
- "tsconfig": "0.0.0"
145
+ "tsconfig": "0.0.0",
146
+ "fumadocs-core": "16.8.0",
147
+ "@fumadocs/cli": "1.3.8"
148
148
  },
149
149
  "peerDependencies": {
150
150
  "@takumi-rs/image-response": "*",
@@ -153,7 +153,7 @@
153
153
  "next": "16.x.x",
154
154
  "react": "^19.2.0",
155
155
  "react-dom": "^19.2.0",
156
- "fumadocs-core": "16.7.15"
156
+ "fumadocs-core": "16.8.0"
157
157
  },
158
158
  "peerDependenciesMeta": {
159
159
  "next": {