fumadocs-openapi 10.9.0 → 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.
Files changed (29) hide show
  1. package/css/generated/shared.css +64 -44
  2. package/dist/index.d.ts +2 -2
  3. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +1 -1
  4. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +1 -1
  5. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +1 -1
  6. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +1 -1
  7. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +1 -1
  8. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +1 -1
  9. package/dist/scalar/client.js +1 -4
  10. package/dist/server/index.d.ts +2 -9
  11. package/dist/server/index.js +9 -9
  12. package/dist/types.d.ts +1 -4
  13. package/dist/ui/base.d.ts +1 -0
  14. package/dist/ui/base.js +1 -17
  15. package/dist/ui/components/accordion.js +36 -11
  16. package/dist/ui/components/dialog.js +29 -32
  17. package/dist/ui/components/heading.js +14 -0
  18. package/dist/ui/components/select-tab.js +24 -9
  19. package/dist/ui/create-client.js +0 -17
  20. package/dist/ui/operation/client.js +1 -1
  21. package/dist/ui/operation/index.js +145 -141
  22. package/dist/ui/schema/client.js +339 -289
  23. package/dist/utils/auto-anchor.client.js +20 -0
  24. package/dist/utils/auto-anchor.js +17 -0
  25. package/dist/utils/document/process.js +1 -1
  26. package/dist/utils/merge-refs.js +11 -0
  27. package/dist/utils/pages/builder.d.ts +1 -3
  28. package/dist/utils/pages/builder.js +1 -9
  29. package/package.json +12 -12
@@ -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 };
@@ -1,5 +1,5 @@
1
1
  import { bundle } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js";
2
- import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.7/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
2
+ import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
3
3
  import { fetchUrls } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js";
4
4
  import { readFiles } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js";
5
5
  import "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js";
@@ -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,5 +1,4 @@
1
1
  import { ApiPageProps, OperationItem, WebhookItem } from "../../ui/api-page.js";
2
- import { OpenAPIServer } from "../../server/index.js";
3
2
  import { OperationObject, PathItemObject, TagObject } from "../../types.js";
4
3
  import { NoReference } from "../schema/index.js";
5
4
  import { DereferencedDocument } from "../document/dereference.js";
@@ -83,8 +82,7 @@ interface ExtractedInfo {
83
82
  tags?: string[];
84
83
  })[];
85
84
  }
86
- declare function fromServer(server: OpenAPIServer, config: PagesBuilderConfig): Promise<Record<string, OutputEntry[]>>;
87
85
  declare function fromSchema(schemaId: string, processed: DereferencedDocument, config: PagesBuilderConfig): OutputEntry[];
88
86
  declare function getPageProps(entry: PageOutput | OperationOutput | WebhookOutput): ApiPageProps;
89
87
  //#endregion
90
- export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, fromServer, getPageProps };
88
+ export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, getPageProps };
@@ -1,14 +1,6 @@
1
1
  import { idToTitle } from "../id-to-title.js";
2
2
  import { getTagDisplayName, methodKeys } from "../schema/index.js";
3
3
  //#region src/utils/pages/builder.ts
4
- async function fromServer(server, config) {
5
- const schemas = await server.getSchemas();
6
- const generated = {};
7
- const entries = Object.entries(schemas);
8
- if (entries.length === 0) throw new Error("No input files found.");
9
- for (const [id, schema] of entries) generated[id] = fromSchema(id, schema, config);
10
- return generated;
11
- }
12
4
  function fromSchema(schemaId, processed, config) {
13
5
  const files = [];
14
6
  const { toPages } = config;
@@ -117,4 +109,4 @@ function getPageProps(entry) {
117
109
  };
118
110
  }
119
111
  //#endregion
120
- export { fromSchema, fromServer, getPageProps };
112
+ export { fromSchema, getPageProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.9.0",
3
+ "version": "10.10.0",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -50,34 +50,34 @@
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
- "shiki": "^4.0.2",
56
+ "shiki": "^4.1.0",
57
57
  "tailwind-merge": "^3.6.0",
58
58
  "@fumari/stf": "1.0.5"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@fastify/deepmerge": "^3.2.1",
62
- "@scalar/api-client-react": "2.0.1",
62
+ "@scalar/api-client-react": "2.0.20",
63
63
  "@scalar/json-magic": "^0.12.14",
64
- "@scalar/openapi-upgrader": "^0.2.7",
64
+ "@scalar/openapi-upgrader": "^0.2.8",
65
65
  "@tailwindcss/oxide": "^4.3.0",
66
66
  "@types/js-yaml": "^4.0.9",
67
- "@types/node": "25.8.0",
68
- "@types/react": "^19.2.14",
67
+ "@types/node": "25.9.1",
68
+ "@types/react": "^19.2.15",
69
69
  "ajv": "^8.20.0",
70
70
  "fast-content-type-parse": "^3.0.0",
71
71
  "json-schema-typed": "^8.0.2",
72
72
  "tailwindcss": "^4.3.0",
73
73
  "tsdown": "0.22.0",
74
74
  "xml-js": "^1.6.11",
75
- "fumadocs-core": "16.9.0",
76
- "fumadocs-ui": "16.9.0",
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",
@@ -100,7 +100,7 @@
100
100
  "@fastify/deepmerge": "3.2.1",
101
101
  "@scalar/helpers": "0.8.0",
102
102
  "@scalar/json-magic": "0.12.14",
103
- "@scalar/openapi-upgrader": "0.2.7",
103
+ "@scalar/openapi-upgrader": "0.2.8",
104
104
  "ajv": "8.20.0",
105
105
  "fast-content-type-parse": "3.0.0",
106
106
  "fast-deep-equal": "3.1.3",