fumadocs-ui 11.1.0 → 11.1.1

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.
@@ -63,9 +63,9 @@ var Accordion = forwardRef(({ title, className, id, children, ...props }, ref) =
63
63
  AccordionPrimitive.Header,
64
64
  {
65
65
  id,
66
- className: "not-prose flex flex-row items-center text-start font-medium text-foreground",
66
+ className: "not-prose flex flex-row items-center font-medium text-foreground",
67
67
  children: [
68
- /* @__PURE__ */ jsxs(AccordionPrimitive.Trigger, { className: "flex flex-1 items-center gap-2 p-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
68
+ /* @__PURE__ */ jsxs(AccordionPrimitive.Trigger, { className: "flex flex-1 items-center gap-2 p-4 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
69
69
  /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-4 text-muted-foreground transition-transform duration-200 group-data-[state=open]/accordion:rotate-90" }),
70
70
  title
71
71
  ] }),
@@ -57,25 +57,27 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
57
57
 
58
58
  // src/components/tabs.tsx
59
59
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
60
- var valueMap = /* @__PURE__ */ new Map();
61
60
  var listeners = /* @__PURE__ */ new Map();
62
- function add(id, listener) {
63
- if (listeners.has(id)) {
64
- listeners.get(id)?.add(listener);
65
- } else {
66
- listeners.set(id, /* @__PURE__ */ new Set([listener]));
67
- }
61
+ function addChangeListener(id, listener) {
62
+ const list = listeners.get(id) ?? [];
63
+ list.push(listener);
64
+ listeners.set(id, list);
68
65
  }
69
- function remove(id, listener) {
70
- listeners.get(id)?.delete(listener);
66
+ function removeChangeListener(id, listener) {
67
+ const list = listeners.get(id) ?? [];
68
+ listeners.set(
69
+ id,
70
+ list.filter((item) => item !== listener)
71
+ );
71
72
  }
72
73
  function update(id, v, persist) {
73
- valueMap.set(id, v);
74
74
  listeners.get(id)?.forEach((item) => {
75
- item();
75
+ item(v);
76
76
  });
77
77
  if (persist)
78
78
  localStorage.setItem(id, v);
79
+ else
80
+ sessionStorage.setItem(id, v);
79
81
  }
80
82
  function Tabs2({
81
83
  id,
@@ -89,20 +91,16 @@ function Tabs2({
89
91
  useEffect(() => {
90
92
  if (!id)
91
93
  return;
92
- const onUpdate = () => {
93
- const current = valueMap.get(id);
94
- if (current && values.includes(current))
95
- setValue(current);
94
+ const onUpdate = (v) => {
95
+ if (values.includes(v))
96
+ setValue(v);
96
97
  };
97
- if (persist) {
98
- const previous = localStorage.getItem(id);
99
- if (previous)
100
- update(id, previous, persist);
101
- }
102
- add(id, onUpdate);
103
- onUpdate();
98
+ const previous = persist ? localStorage.getItem(id) : sessionStorage.getItem(id);
99
+ if (previous)
100
+ onUpdate(previous);
101
+ addChangeListener(id, onUpdate);
104
102
  return () => {
105
- remove(id, onUpdate);
103
+ removeChangeListener(id, onUpdate);
106
104
  };
107
105
  }, [id, persist, values]);
108
106
  const onValueChange = (v) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "11.1.0",
3
+ "version": "11.1.1",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -92,16 +92,16 @@
92
92
  "@tailwindcss/typography": "^0.5.13",
93
93
  "class-variance-authority": "^0.7.0",
94
94
  "cmdk": "^1.0.0",
95
- "lucide-react": "^0.376.0",
95
+ "lucide-react": "^0.378.0",
96
96
  "next-themes": "^0.3.0",
97
- "react-medium-image-zoom": "^5.1.11",
97
+ "react-medium-image-zoom": "^5.2.3",
98
98
  "tailwind-merge": "^2.3.0",
99
- "fumadocs-core": "11.1.0"
99
+ "fumadocs-core": "11.1.1"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@algolia/client-search": "^4.23.3",
103
103
  "@next/eslint-plugin-next": "^14.2.3",
104
- "@types/react": "^18.3.1",
104
+ "@types/react": "^18.3.2",
105
105
  "@types/react-dom": "^18.3.0",
106
106
  "algoliasearch": "^4.23.3",
107
107
  "next": "^14.2.3",