fumadocs-openapi 9.7.3 → 10.0.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 (148) hide show
  1. package/dist/generate-file.d.ts +3 -4
  2. package/dist/generate-file.d.ts.map +1 -1
  3. package/dist/generate-file.js +4 -34
  4. package/dist/playground/client.d.ts +43 -22
  5. package/dist/playground/client.d.ts.map +1 -1
  6. package/dist/playground/client.js +68 -63
  7. package/dist/playground/{inputs.d.ts → components/inputs.d.ts} +1 -1
  8. package/dist/playground/components/inputs.d.ts.map +1 -0
  9. package/dist/playground/{inputs.js → components/inputs.js} +7 -7
  10. package/dist/playground/components/oauth-dialog.d.ts.map +1 -0
  11. package/dist/playground/components/server-select.d.ts.map +1 -0
  12. package/dist/{ui → playground/components}/server-select.js +6 -7
  13. package/dist/playground/index.d.ts +1 -4
  14. package/dist/playground/index.d.ts.map +1 -1
  15. package/dist/playground/index.js +5 -3
  16. package/dist/playground/lazy.d.ts +2 -0
  17. package/dist/playground/lazy.d.ts.map +1 -0
  18. package/dist/playground/lazy.js +3 -0
  19. package/dist/requests/generators/index.d.ts +2 -2
  20. package/dist/requests/generators/index.d.ts.map +1 -1
  21. package/dist/requests/generators/index.js +6 -0
  22. package/dist/requests/media/adapter.d.ts +0 -6
  23. package/dist/requests/media/adapter.d.ts.map +1 -1
  24. package/dist/scalar/index.d.ts +5 -0
  25. package/dist/scalar/index.d.ts.map +1 -1
  26. package/dist/scalar/index.js +14 -0
  27. package/dist/server/create.d.ts +11 -59
  28. package/dist/server/create.d.ts.map +1 -1
  29. package/dist/server/create.js +5 -14
  30. package/dist/server/source-api.d.ts +1 -1
  31. package/dist/server/source-api.d.ts.map +1 -1
  32. package/dist/server/source-api.js +1 -1
  33. package/dist/types.d.ts +12 -4
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/ui/api-page.d.ts +145 -0
  36. package/dist/ui/api-page.d.ts.map +1 -0
  37. package/dist/ui/api-page.js +120 -0
  38. package/dist/ui/client/index.d.ts +29 -0
  39. package/dist/ui/client/index.d.ts.map +1 -0
  40. package/dist/ui/client/index.js +4 -0
  41. package/dist/ui/client/storage-key.d.ts +9 -0
  42. package/dist/ui/client/storage-key.d.ts.map +1 -0
  43. package/dist/ui/client/storage-key.js +12 -0
  44. package/dist/ui/components/method-label.d.ts +1 -1
  45. package/dist/ui/contexts/api.d.ts +12 -10
  46. package/dist/ui/contexts/api.d.ts.map +1 -1
  47. package/dist/ui/contexts/api.js +53 -37
  48. package/dist/ui/contexts/api.lazy.d.ts +2 -0
  49. package/dist/ui/contexts/api.lazy.d.ts.map +1 -0
  50. package/dist/ui/contexts/api.lazy.js +3 -0
  51. package/dist/ui/contexts/operation.d.ts +20 -0
  52. package/dist/ui/contexts/operation.d.ts.map +1 -0
  53. package/dist/ui/contexts/operation.js +48 -0
  54. package/dist/ui/contexts/operation.lazy.d.ts +2 -0
  55. package/dist/ui/contexts/operation.lazy.d.ts.map +1 -0
  56. package/dist/ui/contexts/operation.lazy.js +3 -0
  57. package/dist/ui/index.d.ts +1 -8
  58. package/dist/ui/index.d.ts.map +1 -1
  59. package/dist/ui/index.js +1 -26
  60. package/dist/ui/{select-tabs.d.ts → operation/client.d.ts} +5 -2
  61. package/dist/ui/operation/client.d.ts.map +1 -0
  62. package/dist/ui/{client.js → operation/client.js} +18 -1
  63. package/dist/ui/operation/example-panel/client.d.ts +4 -0
  64. package/dist/ui/operation/example-panel/client.d.ts.map +1 -0
  65. package/dist/ui/operation/example-panel/client.js +50 -0
  66. package/dist/ui/operation/example-panel/index.d.ts +58 -0
  67. package/dist/ui/operation/example-panel/index.d.ts.map +1 -0
  68. package/dist/ui/operation/example-panel/index.js +140 -0
  69. package/dist/ui/operation/example-panel/lazy.d.ts +3 -0
  70. package/dist/ui/operation/example-panel/lazy.d.ts.map +1 -0
  71. package/dist/ui/operation/example-panel/lazy.js +4 -0
  72. package/dist/ui/operation/get-request-data.d.ts.map +1 -0
  73. package/dist/ui/operation/index.d.ts +11 -0
  74. package/dist/ui/operation/index.d.ts.map +1 -0
  75. package/dist/{render → ui}/operation/index.js +50 -24
  76. package/dist/ui/schema/client.d.ts +11 -0
  77. package/dist/ui/schema/client.d.ts.map +1 -0
  78. package/dist/{render → ui}/schema/client.js +22 -12
  79. package/dist/{render/schema/server.d.ts → ui/schema/index.d.ts} +5 -4
  80. package/dist/ui/schema/index.d.ts.map +1 -0
  81. package/dist/{render/schema/server.js → ui/schema/index.js} +11 -5
  82. package/dist/ui/schema/lazy.d.ts +2 -0
  83. package/dist/ui/schema/lazy.d.ts.map +1 -0
  84. package/dist/ui/schema/lazy.js +3 -0
  85. package/dist/utils/get-typescript-schema.d.ts +3 -2
  86. package/dist/utils/get-typescript-schema.d.ts.map +1 -1
  87. package/dist/utils/get-typescript-schema.js +12 -7
  88. package/dist/utils/lazy.d.ts +5 -0
  89. package/dist/utils/lazy.d.ts.map +1 -0
  90. package/dist/utils/lazy.js +12 -0
  91. package/dist/utils/pages/builder.d.ts +1 -1
  92. package/dist/utils/pages/builder.d.ts.map +1 -1
  93. package/dist/utils/pages/to-body.d.ts +2 -3
  94. package/dist/utils/pages/to-body.d.ts.map +1 -1
  95. package/dist/utils/pages/to-body.js +7 -7
  96. package/dist/utils/pages/to-text.d.ts.map +1 -1
  97. package/dist/utils/process-document.d.ts +1 -0
  98. package/dist/utils/process-document.d.ts.map +1 -1
  99. package/dist/utils/process-document.js +7 -2
  100. package/package.json +18 -14
  101. package/dist/playground/auth/oauth-dialog.d.ts.map +0 -1
  102. package/dist/playground/inputs.d.ts.map +0 -1
  103. package/dist/render/api-page.d.ts +0 -33
  104. package/dist/render/api-page.d.ts.map +0 -1
  105. package/dist/render/api-page.js +0 -59
  106. package/dist/render/codeblock.d.ts +0 -9
  107. package/dist/render/codeblock.d.ts.map +0 -1
  108. package/dist/render/codeblock.js +0 -14
  109. package/dist/render/heading.d.ts +0 -4
  110. package/dist/render/heading.d.ts.map +0 -1
  111. package/dist/render/heading.js +0 -6
  112. package/dist/render/markdown.d.ts +0 -5
  113. package/dist/render/markdown.d.ts.map +0 -1
  114. package/dist/render/markdown.js +0 -31
  115. package/dist/render/operation/api-example.d.ts +0 -30
  116. package/dist/render/operation/api-example.d.ts.map +0 -1
  117. package/dist/render/operation/api-example.js +0 -103
  118. package/dist/render/operation/get-request-data.d.ts.map +0 -1
  119. package/dist/render/operation/index.d.ts +0 -27
  120. package/dist/render/operation/index.d.ts.map +0 -1
  121. package/dist/render/renderer.d.ts +0 -79
  122. package/dist/render/renderer.d.ts.map +0 -1
  123. package/dist/render/renderer.js +0 -25
  124. package/dist/render/schema/client.d.ts +0 -18
  125. package/dist/render/schema/client.d.ts.map +0 -1
  126. package/dist/render/schema/index.d.ts +0 -7
  127. package/dist/render/schema/index.d.ts.map +0 -1
  128. package/dist/render/schema/index.js +0 -11
  129. package/dist/render/schema/server.d.ts.map +0 -1
  130. package/dist/render/schema/ui.d.ts +0 -16
  131. package/dist/render/schema/ui.d.ts.map +0 -1
  132. package/dist/render/schema/ui.js +0 -14
  133. package/dist/ui/client.d.ts +0 -4
  134. package/dist/ui/client.d.ts.map +0 -1
  135. package/dist/ui/contexts/code-example.d.ts +0 -24
  136. package/dist/ui/contexts/code-example.d.ts.map +0 -1
  137. package/dist/ui/contexts/code-example.js +0 -97
  138. package/dist/ui/lazy.d.ts +0 -16
  139. package/dist/ui/lazy.d.ts.map +0 -1
  140. package/dist/ui/lazy.js +0 -22
  141. package/dist/ui/select-tabs.d.ts.map +0 -1
  142. package/dist/ui/select-tabs.js +0 -20
  143. package/dist/ui/server-select.d.ts.map +0 -1
  144. /package/dist/playground/{auth → components}/oauth-dialog.d.ts +0 -0
  145. /package/dist/playground/{auth → components}/oauth-dialog.js +0 -0
  146. /package/dist/{ui → playground/components}/server-select.d.ts +0 -0
  147. /package/dist/{render → ui}/operation/get-request-data.d.ts +0 -0
  148. /package/dist/{render → ui}/operation/get-request-data.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "9.7.3",
3
+ "version": "10.0.0",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -22,13 +22,17 @@
22
22
  "types": "./dist/ui/index.d.ts"
23
23
  },
24
24
  "./ui/client": {
25
- "import": "./dist/ui/client.js",
26
- "types": "./dist/ui/client.d.ts"
25
+ "import": "./dist/ui/client/index.js",
26
+ "types": "./dist/ui/client/index.d.ts"
27
27
  },
28
28
  "./playground": {
29
29
  "import": "./dist/playground/index.js",
30
30
  "types": "./dist/playground/index.d.ts"
31
31
  },
32
+ "./playground/client": {
33
+ "import": "./dist/playground/client.js",
34
+ "types": "./dist/playground/client.d.ts"
35
+ },
32
36
  "./scalar": {
33
37
  "import": "./dist/scalar/index.js",
34
38
  "types": "./dist/scalar/index.d.ts"
@@ -45,13 +49,13 @@
45
49
  "css"
46
50
  ],
47
51
  "dependencies": {
48
- "@fumari/json-schema-to-typescript": "^1.1.3",
52
+ "@fumari/json-schema-to-typescript": "^2.0.0",
49
53
  "@radix-ui/react-accordion": "^1.2.12",
50
54
  "@radix-ui/react-dialog": "^1.1.15",
51
55
  "@radix-ui/react-select": "^2.2.6",
52
- "@radix-ui/react-slot": "^1.2.3",
53
- "@scalar/json-magic": "^0.6.1",
54
- "@scalar/openapi-parser": "0.22.3",
56
+ "@radix-ui/react-slot": "^1.2.4",
57
+ "@scalar/json-magic": "^0.7.0",
58
+ "@scalar/openapi-parser": "0.23.0",
55
59
  "ajv": "^8.17.1",
56
60
  "class-variance-authority": "^0.7.1",
57
61
  "github-slugger": "^2.0.0",
@@ -60,18 +64,18 @@
60
64
  "js-yaml": "^4.1.0",
61
65
  "next-themes": "^0.4.6",
62
66
  "openapi-sampler": "^1.6.2",
63
- "react-hook-form": "^7.65.0",
67
+ "react-hook-form": "^7.66.0",
64
68
  "remark": "^15.0.1",
65
69
  "remark-rehype": "^11.1.2",
66
70
  "tinyglobby": "^0.2.15",
67
71
  "xml-js": "^1.6.11",
68
- "fumadocs-core": "16.0.7",
69
- "fumadocs-ui": "16.0.7"
72
+ "fumadocs-core": "16.0.8",
73
+ "fumadocs-ui": "16.0.8"
70
74
  },
71
75
  "devDependencies": {
72
- "@scalar/api-client-react": "^1.3.46",
76
+ "@scalar/api-client-react": "^1.3.48",
73
77
  "@types/js-yaml": "^4.0.9",
74
- "@types/node": "24.9.2",
78
+ "@types/node": "24.10.0",
75
79
  "@types/openapi-sampler": "^1.0.3",
76
80
  "@types/react": "^19.2.2",
77
81
  "json-schema-typed": "^8.0.1",
@@ -84,8 +88,8 @@
84
88
  "peerDependencies": {
85
89
  "@scalar/api-client-react": "*",
86
90
  "@types/react": "*",
87
- "react": "18.x.x || 19.x.x",
88
- "react-dom": "18.x.x || 19.x.x"
91
+ "react": "^19.2.0",
92
+ "react-dom": "^19.2.0"
89
93
  },
90
94
  "peerDependenciesMeta": {
91
95
  "@types/react": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-dialog.d.ts","sourceRoot":"","sources":["../../../src/playground/auth/oauth-dialog.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAa5D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAC,oBAAoB,CAAC;IACzC,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAuCD,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,GACR,EAAE,eAAe,2CAwSjB;AAED,eAAO,MAAM,kBAAkB,mJAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/playground/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAkDxD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAAC,KAAK,CAAC,uDAwCxB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CA8B7D;AA6FD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,UAAU,EACV,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,uDAoGA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAS,EACT,QAAQ,EACR,WAAkB,EAClB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,kDA4KA"}
@@ -1,33 +0,0 @@
1
- import type { RenderContext } from '../types.js';
2
- import type { OpenAPIV3_1 } from 'openapi-types';
3
- import { type ProcessedDocument } from '../utils/process-document.js';
4
- import type { SharedOpenAPIOptions } from '../server/index.js';
5
- export interface ApiPageProps extends SharedOpenAPIOptions {
6
- document: Promise<ProcessedDocument> | string | ProcessedDocument;
7
- hasHead: boolean;
8
- /**
9
- * An array of operations
10
- */
11
- operations?: OperationItem[];
12
- webhooks?: WebhookItem[];
13
- }
14
- export interface WebhookItem {
15
- /**
16
- * webhook name in `webhooks`
17
- */
18
- name: string;
19
- method: OpenAPIV3_1.HttpMethods;
20
- }
21
- export interface OperationItem {
22
- /**
23
- * the path of operation in `paths`
24
- */
25
- path: string;
26
- /**
27
- * the HTTP method of operation
28
- */
29
- method: OpenAPIV3_1.HttpMethods;
30
- }
31
- export declare function APIPage(props: ApiPageProps): Promise<import("react/jsx-runtime").JSX.Element>;
32
- export declare function getContext(schema: ProcessedDocument, options?: SharedOpenAPIOptions): Promise<RenderContext>;
33
- //# sourceMappingURL=api-page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-page.d.ts","sourceRoot":"","sources":["../../src/render/api-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,WAAW,YAAa,SAAQ,oBAAoB;IACxD,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAClE,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAE7B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC;CACjC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,oDAgEhD;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CA0BxB"}
@@ -1,59 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Slugger from 'github-slugger';
3
- import { Operation } from '../render/operation/index.js';
4
- import { createMethod } from '../utils/schema.js';
5
- import { createRenders } from '../render/renderer.js';
6
- import { processDocumentCached, } from '../utils/process-document.js';
7
- import { defaultAdapters } from '../requests/media/adapter.js';
8
- export async function APIPage(props) {
9
- const { operations, hasHead = true, webhooks } = props;
10
- const processed = typeof props.document === 'string'
11
- ? await processDocumentCached(props.document)
12
- : await props.document;
13
- const ctx = await getContext(processed, props);
14
- const { dereferenced } = processed;
15
- return (_jsxs(ctx.renderer.Root, { ctx: ctx, children: [operations?.map((item) => {
16
- const pathItem = dereferenced.paths?.[item.path];
17
- if (!pathItem)
18
- throw new Error(`[Fumadocs OpenAPI] Path not found in OpenAPI schema: ${item.path}`);
19
- const operation = pathItem[item.method];
20
- if (!operation)
21
- throw new Error(`[Fumadocs OpenAPI] Method ${item.method} not found in operation: ${item.path}`);
22
- const method = createMethod(item.method, pathItem, operation);
23
- return (_jsx(Operation, { method: method, path: item.path, ctx: ctx, hasHead: hasHead }, `${item.path}:${item.method}`));
24
- }), webhooks?.map((item) => {
25
- const webhook = dereferenced.webhooks?.[item.name];
26
- if (!webhook)
27
- throw new Error(`[Fumadocs OpenAPI] Webhook not found in OpenAPI schema: ${item.name}`);
28
- const hook = webhook[item.method];
29
- if (!hook)
30
- throw new Error(`[Fumadocs OpenAPI] Method ${item.method} not found in webhook: ${item.name}`);
31
- const method = createMethod(item.method, webhook, hook);
32
- return (_jsx(Operation, { type: "webhook", method: method, ctx: ctx, path: `/${item.name}`, hasHead: hasHead }, `${item.name}:${item.method}`));
33
- })] }));
34
- }
35
- export async function getContext(schema, options = {}) {
36
- const document = schema.dereferenced;
37
- const servers = document.servers && document.servers.length > 0
38
- ? document.servers
39
- : [{ url: '/' }];
40
- return {
41
- schema,
42
- proxyUrl: options.proxyUrl,
43
- disablePlayground: options.disablePlayground,
44
- showResponseSchema: options.showResponseSchema,
45
- renderer: {
46
- ...createRenders(),
47
- ...options.renderer,
48
- },
49
- shikiOptions: options.shikiOptions,
50
- generateTypeScriptSchema: options.generateTypeScriptSchema,
51
- generateCodeSamples: options.generateCodeSamples,
52
- servers,
53
- mediaAdapters: {
54
- ...defaultAdapters,
55
- ...options.mediaAdapters,
56
- },
57
- slugger: new Slugger(),
58
- };
59
- }
@@ -1,9 +0,0 @@
1
- import { type HTMLAttributes } from 'react';
2
- import type { RenderContext } from '../types.js';
3
- export interface CodeBlockProps extends HTMLAttributes<HTMLElement> {
4
- code: string;
5
- lang: string;
6
- ctx: RenderContext;
7
- }
8
- export declare function CodeBlock({ code, lang, ctx, ...rest }: CodeBlockProps): Promise<import("react/jsx-runtime").JSX.Element>;
9
- //# sourceMappingURL=codeblock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/render/codeblock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,WAAW,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,aAAa,CAAC;CACpB;AAED,wBAAsB,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,oDAc3E"}
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as Base from 'fumadocs-ui/components/codeblock';
3
- import { highlight } from 'fumadocs-core/highlight';
4
- import { cn } from 'fumadocs-ui/utils/cn';
5
- export async function CodeBlock({ code, lang, ctx, ...rest }) {
6
- const rendered = await highlight(code, {
7
- lang,
8
- ...ctx.shikiOptions,
9
- components: {
10
- pre: (props) => _jsx(Base.Pre, { ...props }),
11
- },
12
- });
13
- return (_jsx(Base.CodeBlock, { className: cn('my-0', rest.className), children: rendered }));
14
- }
@@ -1,4 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { RenderContext } from '../types.js';
3
- export declare function heading(depth: number, text: string, ctx: RenderContext, children?: ReactNode): ReactNode;
4
- //# sourceMappingURL=heading.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/render/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,OAAO,CACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,aAAa,EAClB,QAAQ,GAAE,SAAgB,GACzB,SAAS,CAQX"}
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Heading } from 'fumadocs-ui/components/heading';
3
- export function heading(depth, text, ctx, children = text) {
4
- const id = ctx.slugger.slug(text);
5
- return (_jsx(Heading, { id: id, as: `h${depth.toString()}`, children: children }, id));
6
- }
@@ -1,5 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- export declare function Markdown({ text }: {
3
- text: string;
4
- }): Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
5
- //# sourceMappingURL=markdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/render/markdown.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAkC1C,wBAAsB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,uFAMxD"}
@@ -1,31 +0,0 @@
1
- import { rehypeCode, remarkGfm, remarkImage, } from 'fumadocs-core/mdx-plugins';
2
- import defaultMdxComponents from 'fumadocs-ui/mdx';
3
- import { remark } from 'remark';
4
- import remarkRehype from 'remark-rehype';
5
- import { toJsxRuntime } from 'hast-util-to-jsx-runtime';
6
- import * as JsxRuntime from 'react/jsx-runtime';
7
- const processor = remark()
8
- .use(remarkGfm)
9
- .use(remarkImage, { useImport: false })
10
- .use(remarkRehype)
11
- .use(rehypeCode, {
12
- langs: [],
13
- lazy: true,
14
- })
15
- .use(rehypeReact);
16
- function rehypeReact() {
17
- this.compiler = (tree, file) => {
18
- return toJsxRuntime(tree, {
19
- development: false,
20
- filePath: file.path,
21
- ...JsxRuntime,
22
- components: defaultMdxComponents,
23
- });
24
- };
25
- }
26
- export async function Markdown({ text }) {
27
- const out = await processor.process({
28
- value: text,
29
- });
30
- return out.result;
31
- }
@@ -1,30 +0,0 @@
1
- import type { MethodInformation, RenderContext } from '../../types.js';
2
- import { type ReactNode } from 'react';
3
- import { type CodeSample } from '../../render/operation/index.js';
4
- import type { RawRequestData, RequestData } from '../../requests/types.js';
5
- interface CustomProperty {
6
- 'x-codeSamples'?: CodeSample[];
7
- 'x-selectedCodeSample'?: string;
8
- 'x-exclusiveCodeSample'?: string;
9
- }
10
- interface CodeExampleItem {
11
- key: string;
12
- name: string;
13
- description?: string;
14
- data: RawRequestData;
15
- encoded: RequestData;
16
- }
17
- export declare function APIExampleProvider({ examples, method, children, route, }: {
18
- examples: CodeExampleItem[];
19
- method: MethodInformation & CustomProperty;
20
- route: string;
21
- children: ReactNode;
22
- }): import("react/jsx-runtime").JSX.Element;
23
- export declare function getAPIExamples(path: string, method: MethodInformation, ctx: RenderContext): CodeExampleItem[];
24
- export declare function APIExample({ method, examples, ctx, }: {
25
- examples: CodeExampleItem[];
26
- method: MethodInformation & CustomProperty;
27
- ctx: RenderContext;
28
- }): Promise<import("react/jsx-runtime").JSX.Element>;
29
- export {};
30
- //# sourceMappingURL=api-example.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-example.d.ts","sourceRoot":"","sources":["../../../src/render/operation/api-example.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAM3D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpE,UAAU,cAAc;IACtB,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;IAC/B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAYA;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,aAAa,GACjB,eAAe,EAAE,CA0CnB;AAED,wBAAsB,UAAU,CAAC,EAC/B,MAAM,EACN,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC;IAC3C,GAAG,EAAE,aAAa,CAAC;CACpB,oDAmCA"}
@@ -1,103 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Markdown } from '../../render/markdown.js';
3
- import { CodeBlock } from '../../render/codeblock.js';
4
- import { CodeExample, CodeExampleProvider } from '../../ui/lazy.js';
5
- import { getPreferredType } from '../../utils/schema.js';
6
- import { getRequestData } from '../../render/operation/get-request-data.js';
7
- import { sample } from 'openapi-sampler';
8
- import { defaultSamples } from '../../requests/generators/index.js';
9
- import { encodeRequestData } from '../../requests/media/encode.js';
10
- export function APIExampleProvider({ examples, method, children, route, }) {
11
- const exclusiveSampleKey = method['x-exclusiveCodeSample'];
12
- return (_jsx(CodeExampleProvider, { initialKey: exclusiveSampleKey, route: route, examples: examples, children: children }));
13
- }
14
- export function getAPIExamples(path, method, ctx) {
15
- const media = method.requestBody
16
- ? getPreferredType(method.requestBody.content)
17
- : null;
18
- const bodyOfType = media ? method.requestBody?.content[media] : null;
19
- if (bodyOfType?.examples) {
20
- const result = [];
21
- for (const [key, value] of Object.entries(bodyOfType.examples)) {
22
- const data = getRequestData(path, method, key, ctx);
23
- result.push({
24
- key,
25
- name: value.summary ?? key,
26
- description: value.description,
27
- data,
28
- encoded: encodeRequestData(data, ctx.mediaAdapters, method.parameters ?? []),
29
- });
30
- }
31
- if (result.length > 0)
32
- return result;
33
- }
34
- const data = getRequestData(path, method, null, ctx);
35
- return [
36
- {
37
- key: '_default',
38
- name: 'Default',
39
- description: bodyOfType?.schema?.description,
40
- data,
41
- encoded: encodeRequestData(data, ctx.mediaAdapters, method.parameters ?? []),
42
- },
43
- ];
44
- }
45
- export async function APIExample({ method, examples, ctx, }) {
46
- const renderer = ctx.renderer;
47
- const generators = dedupe([
48
- ...defaultSamples,
49
- ...(ctx.generateCodeSamples ? await ctx.generateCodeSamples(method) : []),
50
- ...(method['x-codeSamples'] ?? []),
51
- ]).filter((generator) => generator.source !== false);
52
- const exclusiveSampleKey = method['x-exclusiveCodeSample'];
53
- return (_jsxs(renderer.APIExample, { children: [examples.length > 1 && !exclusiveSampleKey && (_jsx(renderer.CodeExampleSelector, { items: examples.map((sample) => ({
54
- title: sample.name,
55
- description: sample.description ? (_jsx(Markdown, { text: sample.description })) : null,
56
- value: sample.key,
57
- })) })), generators.length > 0 && (_jsx(renderer.Requests, { items: generators.map((s) => s.label ?? s.lang), children: generators.map((generator, i) => (_jsx(renderer.Request, { name: generator.label ?? generator.lang, children: _jsx(CodeExample, { ...generator }) }, i))) })), _jsx(ResponseTabs, { operation: method, ctx: ctx })] }));
58
- }
59
- /**
60
- * Remove duplicated labels
61
- */
62
- function dedupe(samples) {
63
- const set = new Set();
64
- const out = [];
65
- for (let i = samples.length - 1; i >= 0; i--) {
66
- const item = samples[i];
67
- if (item.label) {
68
- if (set.has(item.label))
69
- continue;
70
- set.add(item.label);
71
- }
72
- out.unshift(item);
73
- }
74
- return out;
75
- }
76
- function ResponseTabs({ operation, ctx, }) {
77
- const { renderer } = ctx;
78
- if (!operation.responses)
79
- return null;
80
- async function renderResponse(code) {
81
- const response = operation.responses?.[code];
82
- const media = response?.content ? getPreferredType(response.content) : null;
83
- const responseOfType = media ? response?.content?.[media] : null;
84
- let slot = 'Empty';
85
- if (responseOfType?.examples) {
86
- const values = [];
87
- const children = Object.entries(responseOfType.examples).map(([key, sample]) => {
88
- const title = sample?.summary ?? `Example ${key}`;
89
- values.push(title);
90
- return (_jsxs(renderer.ResponseType, { label: title, children: [sample?.description && _jsx(Markdown, { text: sample.description }), _jsx(CodeBlock, { lang: "json", code: JSON.stringify(sample.value, null, 2), ctx: ctx })] }, key));
91
- });
92
- slot = (_jsx(renderer.ResponseTypes, { defaultValue: values[0], children: children }));
93
- }
94
- else if (responseOfType?.example || responseOfType?.schema) {
95
- slot = (_jsx(CodeBlock, { lang: "json", code: JSON.stringify(responseOfType.example ?? sample(responseOfType.schema), null, 2), ctx: ctx }));
96
- }
97
- return _jsx(renderer.Response, { value: code, children: slot });
98
- }
99
- const codes = Object.keys(operation.responses);
100
- if (codes.length === 0)
101
- return null;
102
- return (_jsx(renderer.Responses, { items: codes, children: codes.map((code) => renderResponse(code)) }));
103
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-request-data.d.ts","sourceRoot":"","sources":["../../../src/render/operation/get-request-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,IAAI,EAAE,aAAa,GAClB,cAAc,CAwEhB"}
@@ -1,27 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- import type { MethodInformation, RenderContext } from '../../types.js';
3
- import { type SampleGenerator } from '../../requests/types.js';
4
- export interface CodeSample<T = unknown> {
5
- lang: string;
6
- label?: string;
7
- /**
8
- * either:
9
- * - code
10
- * - a function imported from a file with "use client" directive
11
- * - false (disabled)
12
- */
13
- source?: string | SampleGenerator<T> | false;
14
- /**
15
- * Pass extra context to client-side source generator
16
- */
17
- serverContext?: T;
18
- }
19
- export declare function Operation({ type, path, method, ctx, hasHead, headingLevel, }: {
20
- type?: 'webhook' | 'operation';
21
- path: string;
22
- method: MethodInformation;
23
- ctx: RenderContext;
24
- hasHead?: boolean;
25
- headingLevel?: number;
26
- }): ReactElement;
27
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/operation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAEV,iBAAiB,EACjB,aAAa,EAEd,MAAM,SAAS,CAAC;AAiBjB,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAaxD,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAE7C;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC;CACnB;AASD,wBAAgB,SAAS,CAAC,EACxB,IAAkB,EAClB,IAAI,EACJ,MAAM,EACN,GAAG,EACH,OAAO,EACP,YAAgB,GACjB,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,aAAa,CAAC;IAEnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,YAAY,CAiNf"}
@@ -1,79 +0,0 @@
1
- import type { ComponentType, ReactNode } from 'react';
2
- import type { RenderContext } from '../types.js';
3
- import { type APIPlaygroundProps } from '../playground/index.js';
4
- export interface ResponsesProps {
5
- items: string[];
6
- children: ReactNode;
7
- }
8
- export interface ResponseProps {
9
- value: string;
10
- children: ReactNode;
11
- }
12
- export interface APIInfoProps {
13
- method: string;
14
- route: string;
15
- head: ReactNode;
16
- children: ReactNode;
17
- }
18
- export interface PropertyProps {
19
- name: string;
20
- type: ReactNode;
21
- required?: boolean;
22
- deprecated?: boolean;
23
- children?: ReactNode;
24
- nested?: boolean;
25
- }
26
- export interface ObjectCollapsibleProps {
27
- name: string;
28
- children: ReactNode;
29
- }
30
- export interface RequestProps {
31
- name: string;
32
- children: ReactNode;
33
- }
34
- export interface SamplesProps {
35
- items: {
36
- title: string;
37
- description?: ReactNode;
38
- value: string;
39
- }[];
40
- }
41
- export interface ResponseTypeProps {
42
- label: string;
43
- children: ReactNode;
44
- }
45
- export interface RootProps {
46
- ctx: RenderContext;
47
- children: ReactNode;
48
- }
49
- export interface Renderer {
50
- Root: ComponentType<RootProps>;
51
- API: ComponentType<{
52
- children: ReactNode;
53
- }>;
54
- APIInfo: ComponentType<APIInfoProps>;
55
- APIExample: ComponentType<{
56
- children: ReactNode;
57
- }>;
58
- Responses: ComponentType<ResponsesProps>;
59
- Response: ComponentType<ResponseProps>;
60
- CodeExampleSelector: ComponentType<SamplesProps>;
61
- Requests: ComponentType<{
62
- items: string[];
63
- children: ReactNode;
64
- }>;
65
- Request: ComponentType<RequestProps>;
66
- ResponseTypes: ComponentType<{
67
- defaultValue?: string;
68
- children: ReactNode;
69
- }>;
70
- ResponseType: ComponentType<ResponseTypeProps>;
71
- /**
72
- * Collapsible to show object schemas
73
- */
74
- ObjectCollapsible: ComponentType<ObjectCollapsibleProps>;
75
- Property: ComponentType<PropertyProps>;
76
- APIPlayground: ComponentType<APIPlaygroundProps>;
77
- }
78
- export declare function createRenders(): Renderer;
79
- //# sourceMappingURL=renderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/render/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAStE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,SAAS,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/B,GAAG,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAC5C,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,UAAU,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAEnD,SAAS,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACzC,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,mBAAmB,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAClE,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,aAAa,EAAE,aAAa,CAAC;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAC7E,YAAY,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAE/C;;OAEG;IACH,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;IACzD,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAClD;AAED,wBAAgB,aAAa,IAAI,QAAQ,CA0DxC"}
@@ -1,25 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
3
- import { AccordionContent, AccordionHeader, AccordionItem, Accordions, AccordionTrigger, } from '../ui/components/accordion.js';
4
- import { API, APIExample, APIInfo, ObjectCollapsible, Property, Root, } from '../ui/index.js';
5
- import { APIPlayground } from '../playground/index.js';
6
- import { CodeExampleSelector } from '../ui/lazy.js';
7
- import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, } from 'fumadocs-ui/components/codeblock';
8
- export function createRenders() {
9
- return {
10
- Root,
11
- API,
12
- APIInfo: ({ children, head }) => (_jsxs(APIInfo, { children: [head, children] })),
13
- APIExample,
14
- Responses: (props) => (_jsx(Tabs, { ...props, groupId: "fumadocs_openapi_responses" })),
15
- Response: Tab,
16
- ResponseTypes: (props) => (_jsx(Accordions, { type: "single", className: "pt-2", defaultValue: props.defaultValue, children: props.children })),
17
- ResponseType: (props) => (_jsxs(AccordionItem, { value: props.label, children: [_jsx(AccordionHeader, { children: _jsx(AccordionTrigger, { children: props.label }) }), _jsx(AccordionContent, { className: "prose-no-margin", children: props.children })] })),
18
- Property,
19
- ObjectCollapsible,
20
- Requests: ({ items, children }) => (_jsxs(CodeBlockTabs, { groupId: "fumadocs_openapi_requests", defaultValue: items[0], children: [_jsx(CodeBlockTabsList, { children: items.map((item) => (_jsx(CodeBlockTabsTrigger, { value: item, children: item }, item))) }), children] })),
21
- CodeExampleSelector,
22
- Request: (props) => (_jsx(CodeBlockTab, { value: props.name, children: props.children })),
23
- APIPlayground,
24
- };
25
- }
@@ -1,18 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { SchemaUIData } from '../../render/schema/server.js';
3
- interface DataContextType extends SchemaUIData {
4
- readOnly?: boolean;
5
- writeOnly?: boolean;
6
- }
7
- export declare function SchemaUIProvider(props: {
8
- value: DataContextType;
9
- children: ReactNode;
10
- }): import("react/jsx-runtime").JSX.Element;
11
- export interface SchemaUIProps {
12
- name: string;
13
- required?: boolean;
14
- as?: 'property' | 'body';
15
- }
16
- export declare function SchemaUI({ name, required, as, }: SchemaUIProps): import("react/jsx-runtime").JSX.Element;
17
- export {};
18
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/render/schema/client.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAUvE,UAAU,eAAgB,SAAQ,YAAY;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA2BD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAEA;AAUD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,QAAgB,EAChB,EAAe,GAChB,EAAE,aAAa,2CAiBf"}
@@ -1,7 +0,0 @@
1
- import { type SchemaUIOptions } from '../../render/schema/server.js';
2
- import { type SchemaUIProps } from '../../render/schema/client.js';
3
- export declare function Schema(props: SchemaUIOptions & SchemaUIProps & {
4
- readOnly?: boolean;
5
- writeOnly?: boolean;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/schema/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,MAAM,CACpB,KAAK,EAAE,eAAe,GACpB,aAAa,GAAG;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,2CAeJ"}
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { generateSchemaUI } from '../../render/schema/server.js';
3
- import { SchemaUI, SchemaUIProvider, } from '../../render/schema/client.js';
4
- export function Schema(props) {
5
- const data = generateSchemaUI(props);
6
- return (_jsx(SchemaUIProvider, { value: {
7
- ...data,
8
- readOnly: props.readOnly,
9
- writeOnly: props.writeOnly,
10
- }, children: _jsx(SchemaUI, { name: props.name, required: props.required, as: props.as }) }));
11
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/render/schema/server.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IAEvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAElB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAChC,CACI;IACE,IAAI,EAAE,WAAW,CAAC;CACnB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC;KACnB,EAAE,CAAC;CACL,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,GACD;IACE,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL,CACJ,CAAC;AAEJ,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,aAAa,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC;AAED,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,YAAY,CAoP7E"}
@@ -1,16 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export declare function ObjectCollapsible(props: {
3
- name: string;
4
- children: ReactNode;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- export interface PropertyProps {
7
- name: ReactNode;
8
- type: ReactNode;
9
- required?: boolean;
10
- deprecated?: boolean;
11
- nested?: boolean;
12
- children?: ReactNode;
13
- className?: string;
14
- }
15
- export declare function Property({ name, type, required, deprecated, nested, ...props }: PropertyProps): import("react/jsx-runtime").JSX.Element;
16
- //# sourceMappingURL=ui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/render/schema/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAiBA;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,MAAc,EACd,GAAG,KAAK,EACT,EAAE,aAAa,2CAoCf"}