fumadocs-openapi 10.9.1 → 10.10.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.
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { anchorSegments } from "./auto-anchor.js";
3
+ import { createContext, use, useMemo } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/utils/auto-anchor.client.tsx
6
+ const AnchorContext = createContext([]);
7
+ /** Append segment to anchor IDs */
8
+ function AnchorSection({ segments, children }) {
9
+ const v = use(AnchorContext);
10
+ return /* @__PURE__ */ jsx(AnchorContext, {
11
+ value: useMemo(() => [...v, ...segments], [v, segments]),
12
+ children
13
+ });
14
+ }
15
+ function useAnchorId(segments) {
16
+ if (!segments) return null;
17
+ return anchorSegments(...use(AnchorContext), ...segments);
18
+ }
19
+ //#endregion
20
+ export { AnchorSection, useAnchorId };
@@ -0,0 +1,17 @@
1
+ import { slug } from "github-slugger";
2
+ //#region src/utils/auto-anchor.ts
3
+ /** slugify segments, append `\0` to keep segment as-is */
4
+ function anchorSegments(...segs) {
5
+ const mapped = [];
6
+ for (const seg of segs) if (seg.startsWith("\0")) mapped.push(seg.slice(1));
7
+ else if (seg.length > 0) mapped.push(slug(seg));
8
+ return mapped.join(".");
9
+ }
10
+ /**
11
+ * Check if `id1` starts with `id2`
12
+ */
13
+ function anchorIdStartsWith(id1, id2) {
14
+ return id1 === id2 || id1.startsWith(`${id2}.`);
15
+ }
16
+ //#endregion
17
+ export { anchorIdStartsWith, anchorSegments };
@@ -0,0 +1,11 @@
1
+ //#region src/utils/merge-refs.ts
2
+ function mergeRefs(...refs) {
3
+ return (value) => {
4
+ refs.forEach((ref) => {
5
+ if (typeof ref === "function") ref(value);
6
+ else if (ref != null) ref.current = value;
7
+ });
8
+ };
9
+ }
10
+ //#endregion
11
+ export { mergeRefs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.9.1",
3
+ "version": "10.10.0",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -50,7 +50,7 @@
50
50
  "github-slugger": "^2.0.0",
51
51
  "hast-util-to-jsx-runtime": "^2.3.6",
52
52
  "js-yaml": "^4.1.1",
53
- "lucide-react": "^1.16.0",
53
+ "lucide-react": "^1.17.0",
54
54
  "remark": "^15.0.1",
55
55
  "remark-rehype": "^11.1.2",
56
56
  "shiki": "^4.1.0",
@@ -72,12 +72,12 @@
72
72
  "tailwindcss": "^4.3.0",
73
73
  "tsdown": "0.22.0",
74
74
  "xml-js": "^1.6.11",
75
- "fumadocs-core": "16.9.2",
76
- "fumadocs-ui": "16.9.2",
77
- "tsconfig": "0.0.0"
75
+ "fumadocs-core": "16.9.3",
76
+ "tsconfig": "0.0.0",
77
+ "fumadocs-ui": "16.9.3"
78
78
  },
79
79
  "peerDependencies": {
80
- "@scalar/api-client-react": "2.0.1",
80
+ "@scalar/api-client-react": "^2.0.20",
81
81
  "@types/react": "*",
82
82
  "fumadocs-core": "^16.9.0",
83
83
  "fumadocs-ui": "^16.9.0",