fumadocs-openapi 10.9.1 → 10.10.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.
- package/css/generated/shared.css +61 -45
- package/dist/_openapi/types.d.ts +27 -1
- package/dist/index.d.ts +5 -4
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +1 -1
- package/dist/playground/client.d.ts +1 -1
- package/dist/requests/generators/all.d.ts +1 -1
- package/dist/requests/generators/all.js +1 -0
- package/dist/scalar/client.js +1 -4
- package/dist/types.d.ts +3 -16
- package/dist/ui/base.d.ts +2 -1
- package/dist/ui/base.js +4 -19
- package/dist/ui/client/index.d.ts +15 -10
- package/dist/ui/components/accordion.js +36 -11
- package/dist/ui/components/dialog.js +29 -32
- package/dist/ui/components/heading.js +22 -0
- package/dist/ui/components/select-tab.js +24 -9
- package/dist/ui/contexts/api.js +1 -7
- package/dist/ui/create-client.d.ts +2 -1
- package/dist/ui/create-client.js +8 -26
- package/dist/ui/operation/client.js +1 -1
- package/dist/ui/operation/index.js +145 -141
- package/dist/ui/operation/request-tabs.js +4 -1
- package/dist/ui/operation/response-tabs.js +4 -1
- package/dist/ui/operation/usage-tabs/index.js +2 -8
- package/dist/ui/schema/client.js +339 -289
- package/dist/utils/auto-anchor.client.js +20 -0
- package/dist/utils/auto-anchor.js +17 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/pages/builder.d.ts +2 -4
- package/dist/utils/pages/preset-auto.d.ts +1 -2
- package/package.json +5 -6
|
@@ -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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OperationItem, WebhookItem } from "../../ui/api-page.js";
|
|
2
2
|
import { OperationObject, PathItemObject, TagObject } from "../../types.js";
|
|
3
3
|
import { NoReference } from "../schema/index.js";
|
|
4
4
|
import { DereferencedDocument } from "../document/dereference.js";
|
|
@@ -82,7 +82,5 @@ interface ExtractedInfo {
|
|
|
82
82
|
tags?: string[];
|
|
83
83
|
})[];
|
|
84
84
|
}
|
|
85
|
-
declare function fromSchema(schemaId: string, processed: DereferencedDocument, config: PagesBuilderConfig): OutputEntry[];
|
|
86
|
-
declare function getPageProps(entry: PageOutput | OperationOutput | WebhookOutput): ApiPageProps;
|
|
87
85
|
//#endregion
|
|
88
|
-
export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput
|
|
86
|
+
export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput };
|
|
@@ -66,6 +66,5 @@ interface BaseConfig {
|
|
|
66
66
|
*/
|
|
67
67
|
slugify?: (name: string) => string;
|
|
68
68
|
}
|
|
69
|
-
declare function createAutoPreset(options: SchemaToPagesOptions): PagesBuilderConfig;
|
|
70
69
|
//#endregion
|
|
71
|
-
export { SchemaToPagesOptions
|
|
70
|
+
export { SchemaToPagesOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.10.1",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -44,13 +44,12 @@
|
|
|
44
44
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
45
45
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
46
46
|
"@radix-ui/react-select": "^2.2.6",
|
|
47
|
-
"@radix-ui/react-slot": "^1.2.4",
|
|
48
47
|
"chokidar": "^5.0.0",
|
|
49
48
|
"class-variance-authority": "^0.7.1",
|
|
50
49
|
"github-slugger": "^2.0.0",
|
|
51
50
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
52
51
|
"js-yaml": "^4.1.1",
|
|
53
|
-
"lucide-react": "^1.
|
|
52
|
+
"lucide-react": "^1.17.0",
|
|
54
53
|
"remark": "^15.0.1",
|
|
55
54
|
"remark-rehype": "^11.1.2",
|
|
56
55
|
"shiki": "^4.1.0",
|
|
@@ -72,12 +71,12 @@
|
|
|
72
71
|
"tailwindcss": "^4.3.0",
|
|
73
72
|
"tsdown": "0.22.0",
|
|
74
73
|
"xml-js": "^1.6.11",
|
|
75
|
-
"fumadocs-core": "16.9.
|
|
76
|
-
"fumadocs-ui": "16.9.
|
|
74
|
+
"fumadocs-core": "16.9.3",
|
|
75
|
+
"fumadocs-ui": "16.9.3",
|
|
77
76
|
"tsconfig": "0.0.0"
|
|
78
77
|
},
|
|
79
78
|
"peerDependencies": {
|
|
80
|
-
"@scalar/api-client-react": "2.0.
|
|
79
|
+
"@scalar/api-client-react": "^2.0.20",
|
|
81
80
|
"@types/react": "*",
|
|
82
81
|
"fumadocs-core": "^16.9.0",
|
|
83
82
|
"fumadocs-ui": "^16.9.0",
|