fumadocs-ui 10.0.1 → 10.0.2

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.
@@ -13,14 +13,23 @@ var ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /*
13
13
  className: twMerge("overflow-hidden", className),
14
14
  ...props,
15
15
  children: [
16
- /* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "size-full rounded-[inherit]", children }),
16
+ children,
17
17
  /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {}),
18
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
19
18
  /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
20
19
  ]
21
20
  }
22
21
  ));
23
22
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
23
+ var ScrollViewport = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
24
+ ScrollAreaPrimitive.Viewport,
25
+ {
26
+ ref,
27
+ className: twMerge("size-full rounded-[inherit]", className),
28
+ ...props,
29
+ children
30
+ }
31
+ ));
32
+ ScrollViewport.displayName = ScrollAreaPrimitive.Viewport.displayName;
24
33
  var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
25
34
  ScrollAreaPrimitive.Scrollbar,
26
35
  {
@@ -39,5 +48,7 @@ var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...prop
39
48
  ScrollBar.displayName = ScrollAreaPrimitive.Scrollbar.displayName;
40
49
 
41
50
  export {
42
- ScrollArea
51
+ ScrollArea,
52
+ ScrollViewport,
53
+ ScrollBar
43
54
  };
@@ -1,6 +1,8 @@
1
1
  import {
2
- ScrollArea
3
- } from "./chunk-N7GXEVOA.js";
2
+ ScrollArea,
3
+ ScrollBar,
4
+ ScrollViewport
5
+ } from "./chunk-VYTHQTZE.js";
4
6
  import {
5
7
  useCopyButton
6
8
  } from "./chunk-24NYFO7H.js";
@@ -56,7 +58,10 @@ var CodeBlock = forwardRef(
56
58
  onCopy
57
59
  }
58
60
  ),
59
- /* @__PURE__ */ jsx(ScrollArea, { ref: areaRef, children: props.children })
61
+ /* @__PURE__ */ jsxs(ScrollArea, { ref: areaRef, children: [
62
+ /* @__PURE__ */ jsx(ScrollViewport, { children: props.children }),
63
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
64
+ ] })
60
65
  ]
61
66
  }
62
67
  );
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  CodeBlock,
4
4
  Pre
5
- } from "../chunk-Q3BC4RGT.js";
6
- import "../chunk-N7GXEVOA.js";
5
+ } from "../chunk-ZDIJ7KSY.js";
6
+ import "../chunk-VYTHQTZE.js";
7
7
  import "../chunk-24NYFO7H.js";
8
8
  import "../chunk-7GZKFBAP.js";
9
9
  import "../chunk-TK3TM3MR.js";
@@ -7,8 +7,9 @@ import {
7
7
  useTreeContext
8
8
  } from "./chunk-C4PI62MH.js";
9
9
  import {
10
- ScrollArea
11
- } from "./chunk-N7GXEVOA.js";
10
+ ScrollArea,
11
+ ScrollViewport
12
+ } from "./chunk-VYTHQTZE.js";
12
13
  import {
13
14
  Popover,
14
15
  PopoverContent,
@@ -338,11 +339,11 @@ function Sidebar({
338
339
  "max-md:fixed max-md:inset-0 max-md:z-40 max-md:bg-background/80 max-md:pt-16 max-md:backdrop-blur-md max-md:data-[open=false]:hidden"
339
340
  ),
340
341
  children: /* @__PURE__ */ jsxs3(SidebarContext.Provider, { value: context, children: [
341
- /* @__PURE__ */ jsx3(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-8 pb-10 pt-4 max-md:px-4 md:pr-3 md:pt-10", children: [
342
+ /* @__PURE__ */ jsx3(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx3(ScrollViewport, { children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-8 pb-10 pt-4 max-md:px-4 md:pr-3 md:pt-10", children: [
342
343
  banner,
343
344
  items.length > 0 && /* @__PURE__ */ jsx3("div", { className: "lg:hidden", children: items.map((item) => /* @__PURE__ */ jsx3(BaseItem, { item, nested: true }, item.url)) }),
344
345
  /* @__PURE__ */ jsx3(NodeList, { items: root.children })
345
- ] }) }),
346
+ ] }) }) }),
346
347
  /* @__PURE__ */ jsxs3(
347
348
  "div",
348
349
  {
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  CodeBlock,
4
4
  Pre
5
- } from "./chunk-Q3BC4RGT.js";
6
- import "./chunk-N7GXEVOA.js";
5
+ } from "./chunk-ZDIJ7KSY.js";
6
+ import "./chunk-VYTHQTZE.js";
7
7
  import "./chunk-24NYFO7H.js";
8
8
  import "./chunk-7GZKFBAP.js";
9
9
  import "./chunk-TK3TM3MR.js";
@@ -2,6 +2,10 @@
2
2
  import {
3
3
  useTreeContext
4
4
  } from "./chunk-C4PI62MH.js";
5
+ import {
6
+ ScrollArea,
7
+ ScrollViewport
8
+ } from "./chunk-VYTHQTZE.js";
5
9
  import "./chunk-7F2LGCS6.js";
6
10
  import {
7
11
  useI18n
@@ -12,7 +16,7 @@ import {
12
16
  import "./chunk-6C3VEZWH.js";
13
17
 
14
18
  // src/page.client.tsx
15
- import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
19
+ import { useEffect as useEffect2, useMemo, useState } from "react";
16
20
  import { cva } from "class-variance-authority";
17
21
  import { ChevronLeftIcon, ChevronRightIcon as ChevronRightIcon2 } from "lucide-react";
18
22
  import Link2 from "next/link";
@@ -21,41 +25,35 @@ import { usePathname as usePathname2 } from "next/navigation";
21
25
  // src/components/toc.tsx
22
26
  import { TextIcon } from "lucide-react";
23
27
  import * as Primitive from "fumadocs-core/toc";
24
- import { useEffect, useRef, useState } from "react";
28
+ import { useEffect, useRef } from "react";
25
29
  import { jsx, jsxs } from "react/jsx-runtime";
26
30
  function TOCItems({ items }) {
27
31
  const { text } = useI18n();
28
- const [pos, setPos] = useState();
29
- return /* @__PURE__ */ jsxs(
30
- Primitive.TOCProvider,
31
- {
32
- toc: items,
33
- className: "relative overflow-hidden pt-4 text-sm first:pt-0",
34
- children: [
35
- /* @__PURE__ */ jsxs("h3", { className: "mb-4 inline-flex items-center gap-2", children: [
36
- /* @__PURE__ */ jsx(TextIcon, { className: "size-4" }),
37
- text.toc
38
- ] }),
39
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 border-l-2 text-muted-foreground", children: [
40
- /* @__PURE__ */ jsx(
41
- "div",
42
- {
43
- role: "none",
44
- className: twMerge(
45
- "absolute left-0 border-l-2 transition-all",
46
- pos && "border-primary"
47
- ),
48
- style: {
49
- top: pos?.[0],
50
- height: pos?.[1]
51
- }
52
- }
53
- ),
54
- items.map((item) => /* @__PURE__ */ jsx(TOCItem2, { item, setMarker: setPos }, item.url))
55
- ] })
56
- ]
57
- }
58
- );
32
+ const containerRef = useRef(null);
33
+ const markerRef = useRef(null);
34
+ const setPos = ([top, height]) => {
35
+ const element = markerRef.current;
36
+ if (!element)
37
+ return;
38
+ element.style.setProperty("top", `${top}px`);
39
+ element.style.setProperty("height", `${height}px`);
40
+ element.style.setProperty("display", `block`);
41
+ };
42
+ return /* @__PURE__ */ jsx(ScrollArea, { className: "pt-4 text-sm first:pt-0", children: /* @__PURE__ */ jsx(ScrollViewport, { className: "relative", ref: containerRef, children: /* @__PURE__ */ jsxs(Primitive.TOCScrollProvider, { containerRef, toc: items, children: [
43
+ /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ role: "none",
47
+ ref: markerRef,
48
+ className: "absolute left-0 hidden border-l-2 border-primary transition-all"
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsxs("h3", { className: "mb-4 inline-flex items-center gap-2", children: [
52
+ /* @__PURE__ */ jsx(TextIcon, { className: "size-4" }),
53
+ text.toc
54
+ ] }),
55
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 border-l-2 text-muted-foreground", children: items.map((item) => /* @__PURE__ */ jsx(TOCItem2, { item, setMarker: setPos }, item.url)) })
56
+ ] }) }) });
59
57
  }
60
58
  function TOCItem2({
61
59
  item,
@@ -124,7 +122,7 @@ function Breadcrumb() {
124
122
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
125
123
  function LastUpdate(props) {
126
124
  const { text } = useI18n();
127
- const [date, setDate] = useState2("");
125
+ const [date, setDate] = useState("");
128
126
  useEffect2(() => {
129
127
  setDate(props.date.toLocaleDateString());
130
128
  }, [props.date]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "10.0.1",
3
+ "version": "10.0.2",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -97,7 +97,7 @@
97
97
  "react-medium-image-zoom": "^5.1.10",
98
98
  "tailwind-merge": "^2.2.1",
99
99
  "tailwindcss": "^3.4.1",
100
- "fumadocs-core": "10.0.1"
100
+ "fumadocs-core": "10.0.2"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@algolia/client-search": "^4.22.1",