fumadocs-openapi 10.10.3 → 11.0.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.
Files changed (234) hide show
  1. package/css/generated/shared.css +1 -1159
  2. package/css/preset.css +1 -0
  3. package/dist/.translations/index.d.ts +80 -0
  4. package/dist/.translations/keys.js +80 -0
  5. package/dist/_virtual/_rolldown/runtime.js +1 -10
  6. package/dist/generate-file.d.ts +0 -4
  7. package/dist/generate-file.js +4 -5
  8. package/dist/i18n.d.ts +5 -100
  9. package/dist/i18n.js +8 -108
  10. package/dist/index.d.ts +4 -4
  11. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +1 -1
  12. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +1 -1
  13. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +1 -1
  14. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +1 -1
  15. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +1 -1
  16. package/dist/playground/auth.js +4 -4
  17. package/dist/playground/client.d.ts +12 -21
  18. package/dist/playground/client.js +80 -59
  19. package/dist/playground/components/oauth-dialog.js +33 -33
  20. package/dist/playground/components/result-display.d.ts +1 -2
  21. package/dist/playground/components/result-display.js +7 -8
  22. package/dist/playground/components/server-select.js +11 -11
  23. package/dist/playground/status-info.js +29 -37
  24. package/dist/requests/generators/csharp.js +3 -3
  25. package/dist/requests/generators/curl.js +2 -2
  26. package/dist/requests/generators/go.js +2 -2
  27. package/dist/requests/generators/index.d.ts +28 -41
  28. package/dist/requests/generators/index.js +18 -35
  29. package/dist/requests/generators/java.js +2 -2
  30. package/dist/requests/generators/javascript.js +2 -2
  31. package/dist/requests/generators/python.js +2 -2
  32. package/dist/scalar/client.js +3 -2
  33. package/dist/scalar/index.d.ts +2 -2
  34. package/dist/scalar/index.js +10 -9
  35. package/dist/server/index.d.ts +23 -27
  36. package/dist/server/index.js +42 -38
  37. package/dist/server/proxy.d.ts +0 -6
  38. package/dist/server/proxy.js +2 -4
  39. package/dist/{_openapi/types.d.ts → types/openapi.d.ts} +127 -136
  40. package/dist/types.d.ts +14 -18
  41. package/dist/ui/base.d.ts +15 -162
  42. package/dist/ui/base.js +148 -107
  43. package/dist/ui/components/codeblock.js +6 -14
  44. package/dist/ui/components/heading.js +8 -4
  45. package/dist/ui/components/markdown.js +12 -0
  46. package/dist/ui/contexts/api.js +8 -26
  47. package/dist/ui/index.d.ts +204 -7
  48. package/dist/ui/index.js +10 -15
  49. package/dist/ui/operation/context.js +48 -0
  50. package/dist/ui/operation/index.js +168 -126
  51. package/dist/ui/operation/request-tabs.d.ts +10 -5
  52. package/dist/ui/operation/request-tabs.js +35 -22
  53. package/dist/ui/operation/response-tabs.d.ts +5 -2
  54. package/dist/ui/operation/response-tabs.js +22 -15
  55. package/dist/ui/operation/usage-tabs.js +144 -0
  56. package/dist/utils/document/dereference.d.ts +1 -1
  57. package/dist/utils/document/dereference.js +5 -8
  58. package/dist/utils/document/load.js +17 -0
  59. package/dist/utils/get-example-requests.d.ts +13 -0
  60. package/dist/{ui/operation → utils}/get-example-requests.js +31 -20
  61. package/dist/utils/pages/builder.d.ts +38 -10
  62. package/dist/utils/pages/builder.js +12 -10
  63. package/dist/utils/pages/preset-auto.d.ts +1 -2
  64. package/dist/utils/pages/preset-auto.js +15 -15
  65. package/dist/utils/pages/to-static-data.js +5 -4
  66. package/dist/utils/pages/to-text.d.ts +1 -0
  67. package/dist/utils/pages/to-text.js +21 -11
  68. package/dist/utils/remove-undefined.js +14 -9
  69. package/dist/utils/schema.d.ts +2 -0
  70. package/dist/utils/{schema/index.js → schema.js} +3 -30
  71. package/dist/{ui/client → utils}/storage-key.js +3 -3
  72. package/package.json +16 -29
  73. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js +0 -239
  74. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
  75. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
  76. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js +0 -41
  77. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
  78. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js +0 -109
  79. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
  80. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js +0 -46
  81. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
  82. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js +0 -49
  83. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js +0 -242
  84. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js +0 -247
  85. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js +0 -210
  86. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js +0 -100
  87. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js +0 -41
  88. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -112
  89. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js +0 -8
  90. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js +0 -146
  91. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
  92. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js +0 -18
  93. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js +0 -11
  94. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js +0 -99
  95. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js +0 -30
  96. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +0 -315
  97. package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +0 -108
  98. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +0 -110
  99. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +0 -138
  100. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +0 -674
  101. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +0 -141
  102. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +0 -102
  103. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +0 -223
  104. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +0 -28
  105. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +0 -18
  106. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +0 -133
  107. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +0 -61
  108. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +0 -146
  109. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +0 -23
  110. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -48
  111. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +0 -172
  112. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +0 -31
  113. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +0 -433
  114. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +0 -113
  115. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +0 -72
  116. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +0 -583
  117. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +0 -18
  118. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +0 -42
  119. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +0 -50
  120. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +0 -20
  121. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +0 -51
  122. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +0 -16
  123. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +0 -36
  124. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +0 -19
  125. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +0 -85
  126. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +0 -59
  127. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +0 -12
  128. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +0 -25
  129. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +0 -12
  130. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +0 -16
  131. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -57
  132. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -96
  133. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -29
  134. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -16
  135. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -89
  136. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -87
  137. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +0 -16
  138. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -62
  139. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -60
  140. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -59
  141. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -34
  142. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -31
  143. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -51
  144. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -61
  145. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -17
  146. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -52
  147. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -41
  148. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -17
  149. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +0 -130
  150. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +0 -14
  151. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +0 -22
  152. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +0 -112
  153. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -101
  154. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -14
  155. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +0 -35
  156. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +0 -46
  157. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +0 -45
  158. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +0 -22
  159. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +0 -20
  160. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +0 -15
  161. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
  162. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +0 -10
  163. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +0 -23
  164. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +0 -19
  165. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +0 -13
  166. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +0 -46
  167. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +0 -59
  168. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +0 -27
  169. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +0 -17
  170. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -49
  171. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +0 -48
  172. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +0 -18
  173. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -28
  174. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -33
  175. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -47
  176. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -28
  177. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -27
  178. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -38
  179. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +0 -72
  180. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -70
  181. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +0 -33
  182. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +0 -236
  183. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +0 -187
  184. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +0 -282
  185. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +0 -78
  186. package/dist/playground/components/inputs.js +0 -419
  187. package/dist/playground/components/spinner.js +0 -15
  188. package/dist/playground/schema.d.ts +0 -15
  189. package/dist/playground/schema.js +0 -144
  190. package/dist/ui/api-page.d.ts +0 -31
  191. package/dist/ui/api-page.js +0 -59
  192. package/dist/ui/client/boundary.d.ts +0 -11
  193. package/dist/ui/client/boundary.js +0 -17
  194. package/dist/ui/client/boundary.lazy.js +0 -19
  195. package/dist/ui/client/full.js +0 -13
  196. package/dist/ui/client/i18n.js +0 -16
  197. package/dist/ui/client/index.d.ts +0 -42
  198. package/dist/ui/client/index.js +0 -7
  199. package/dist/ui/components/accordion.js +0 -67
  200. package/dist/ui/components/codeblock.d.ts +0 -14
  201. package/dist/ui/components/dialog.js +0 -56
  202. package/dist/ui/components/input.js +0 -17
  203. package/dist/ui/components/select-tab.js +0 -56
  204. package/dist/ui/components/select.js +0 -71
  205. package/dist/ui/contexts/api.d.ts +0 -29
  206. package/dist/ui/create-client.d.ts +0 -26
  207. package/dist/ui/create-client.js +0 -125
  208. package/dist/ui/operation/client.js +0 -78
  209. package/dist/ui/operation/get-example-requests.d.ts +0 -11
  210. package/dist/ui/operation/usage-tabs/client.d.ts +0 -14
  211. package/dist/ui/operation/usage-tabs/client.js +0 -91
  212. package/dist/ui/operation/usage-tabs/index.js +0 -54
  213. package/dist/ui/schema/client.d.ts +0 -18
  214. package/dist/ui/schema/client.js +0 -410
  215. package/dist/ui/schema/index.d.ts +0 -61
  216. package/dist/ui/schema/index.js +0 -256
  217. package/dist/utils/auto-anchor.client.js +0 -20
  218. package/dist/utils/auto-anchor.js +0 -17
  219. package/dist/utils/deep-equal.js +0 -21
  220. package/dist/utils/document/process.d.ts +0 -6
  221. package/dist/utils/document/process.js +0 -18
  222. package/dist/utils/id-to-title.js +0 -12
  223. package/dist/utils/is-plain-object.js +0 -8
  224. package/dist/utils/merge-refs.js +0 -11
  225. package/dist/utils/schema/dereference.js +0 -45
  226. package/dist/utils/schema/index.d.ts +0 -18
  227. package/dist/utils/schema/merge.js +0 -156
  228. package/dist/utils/schema/pick.js +0 -44
  229. package/dist/utils/schema/ref.js +0 -35
  230. package/dist/utils/schema/resolve-ref.js +0 -11
  231. package/dist/utils/schema/sample.js +0 -442
  232. package/dist/utils/schema/to-string.d.ts +0 -1
  233. package/dist/utils/schema/to-string.js +0 -53
  234. package/dist/utils/url.js +0 -39
@@ -1,22 +1,28 @@
1
- import { idToTitle } from "../../utils/id-to-title.js";
2
- import { createMethod, methodKeys } from "../../utils/schema/index.js";
3
- import { isMediaTypeSupported } from "../../requests/media/resolve-adapter.js";
4
- import "../../requests/media/adapter.js";
5
- import { I18nLabel } from "../client/i18n.js";
1
+ "use client";
2
+ import { methodKeys } from "../../utils/schema.js";
3
+ import { ServerProvider, useRenderContext } from "../contexts/api.js";
6
4
  import { cn } from "../../utils/cn.js";
7
5
  import { Badge, MethodLabel } from "../components/method-label.js";
8
- import { CopyTypeScriptPanel, OperationProvider } from "./client.js";
9
- import { Schema } from "../schema/index.js";
10
- import { AnchorSection } from "../../utils/auto-anchor.client.js";
11
- import { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions } from "../components/accordion.js";
12
- import { UsageTabs } from "./usage-tabs/index.js";
6
+ import { isMediaTypeSupported } from "../../requests/media/resolve-adapter.js";
7
+ import "../../requests/media/adapter.js";
8
+ import { OperationProvider } from "./context.js";
9
+ import PlaygroundClient from "../../playground/client.js";
10
+ import { Markdown } from "../components/markdown.js";
11
+ import { UsageTabs } from "./usage-tabs.js";
13
12
  import { RequestTabs } from "./request-tabs.js";
14
- import { getExampleRequests } from "./get-example-requests.js";
15
- import { SelectTab, SelectTabTrigger, SelectTabs } from "../components/select-tab.js";
13
+ import { getExampleRequests } from "../../utils/get-example-requests.js";
16
14
  import { Heading } from "../components/heading.js";
15
+ import { idToTitle } from "@fumadocs/api-docs/utils/id-to-title";
17
16
  import { Fragment, use, useMemo } from "react";
18
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
18
+ import { Check, Copy } from "lucide-react";
19
+ import { useTranslations } from "@fuma-translate/react";
20
+ import { buttonVariants } from "fumadocs-ui/components/ui/button";
21
+ import { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions } from "@fumadocs/api-docs/components/accordion";
22
+ import { SelectTab, SelectTabTrigger, SelectTabs } from "@fumadocs/api-docs/components/select-tab";
19
23
  import { Callout } from "fumadocs-ui/components/callout";
24
+ import { AnchorSection } from "@fumadocs/api-docs/auto-anchor/client";
25
+ import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
20
26
  //#region src/ui/operation/index.tsx
21
27
  const paramTypeKeys = [
22
28
  "path",
@@ -24,22 +30,33 @@ const paramTypeKeys = [
24
30
  "header",
25
31
  "cookie"
26
32
  ];
27
- function Operation({ type = "operation", path, method, ctx, showTitle, showDescription, headingLevel = 2 }) {
33
+ function Operation({ type = "operation", path, operation, pathItem, method, showTitle, showDescription, headingLevel = 2 }) {
34
+ const t = useTranslations({ note: "operation page" });
35
+ const ctx = useRenderContext();
28
36
  const { schema: { dereferenced } } = ctx;
29
- const body = method.requestBody;
37
+ const body = operation.requestBody;
30
38
  let headNode = null;
31
- const descriptionNode = showDescription && method.description && ctx.renderMarkdown(method.description);
39
+ const operationDescription = operation.description ?? pathItem.description;
40
+ const descriptionNode = showDescription && operationDescription && /* @__PURE__ */ jsx(Markdown, { md: operationDescription });
32
41
  let bodyNode = null;
33
42
  let authNode = null;
34
43
  let responseNode = null;
35
44
  let callbacksNode = null;
36
- const exampleRequests = useMemo(() => getExampleRequests(path, method, ctx), [
45
+ const exampleRequests = useMemo(() => getExampleRequests({
46
+ path,
47
+ operation,
48
+ method,
49
+ pathItem,
50
+ ctx
51
+ }), [
37
52
  ctx,
53
+ operation,
38
54
  method,
55
+ pathItem,
39
56
  path
40
57
  ]);
41
58
  if (showTitle) {
42
- const title = method.summary || (method.operationId ? idToTitle(method.operationId) : path);
59
+ const title = operation.summary || pathItem.summary || (operation.operationId ? idToTitle(operation.operationId) : path);
43
60
  headNode = /* @__PURE__ */ jsxs("div", {
44
61
  className: "flex gap-2 items-center justify-between",
45
62
  children: [/* @__PURE__ */ jsx(Heading, {
@@ -47,16 +64,16 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
47
64
  depth: headingLevel,
48
65
  className: "my-0!",
49
66
  children: title
50
- }), method.deprecated && /* @__PURE__ */ jsx(Badge, {
67
+ }), operation.deprecated && /* @__PURE__ */ jsx(Badge, {
51
68
  color: "yellow",
52
69
  className: "text-xs not-prose",
53
- children: /* @__PURE__ */ jsx(I18nLabel, { label: "deprecated" })
70
+ children: t("Deprecated")
54
71
  })]
55
72
  });
56
73
  headingLevel++;
57
- } else if (method.deprecated) headNode = /* @__PURE__ */ jsx(Callout, {
74
+ } else if (operation.deprecated) headNode = /* @__PURE__ */ jsx(Callout, {
58
75
  type: "warn",
59
- title: /* @__PURE__ */ jsx(I18nLabel, { label: "deprecated" }),
76
+ title: t("Deprecated"),
60
77
  className: "mt-0!"
61
78
  });
62
79
  const contentTypes = body?.content ? Object.entries(body.content) : null;
@@ -77,7 +94,7 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
77
94
  id: "request-body",
78
95
  depth: headingLevel,
79
96
  className: "my-0!",
80
- children: /* @__PURE__ */ jsx(I18nLabel, { label: "titleRequestBody" })
97
+ children: t("Request Body")
81
98
  }), contentTypes.length > 1 ? /* @__PURE__ */ jsx(SelectTabTrigger, {
82
99
  items,
83
100
  className: "font-medium"
@@ -86,7 +103,7 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
86
103
  children: items[0].label
87
104
  })]
88
105
  }),
89
- body.description && ctx.renderMarkdown(body.description),
106
+ body?.description && /* @__PURE__ */ jsx(Markdown, { md: body.description }),
90
107
  contentTypes.map(([type, content]) => {
91
108
  if (!isMediaTypeSupported(type, ctx.mediaAdapters)) throw new Error(`Media type ${type} is not supported (in ${path})`);
92
109
  return /* @__PURE__ */ jsx(SelectTab, {
@@ -94,41 +111,42 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
94
111
  value: type,
95
112
  children: /* @__PURE__ */ jsx(RequestBodyContentItem, {
96
113
  content,
97
- method,
98
- ctx
114
+ operation,
115
+ method
99
116
  })
100
117
  }, type);
101
118
  })
102
119
  ]
103
120
  });
104
121
  }
105
- if (method.responses && ctx.showResponseSchema !== false) {
106
- const statuses = Object.keys(method.responses);
122
+ if (operation.responses && ctx.showResponseSchema !== false) {
123
+ const statuses = Object.keys(operation.responses);
107
124
  responseNode = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Heading, {
108
125
  id: "response-body",
109
126
  depth: headingLevel,
110
- children: /* @__PURE__ */ jsx(I18nLabel, { label: "titleResponseBody" })
127
+ children: t("Response Body")
111
128
  }), /* @__PURE__ */ jsx(Accordions, {
112
129
  type: "multiple",
113
130
  children: statuses.map((status) => /* @__PURE__ */ jsx(ResponseAccordion, {
114
131
  status,
115
- operation: method,
116
- ctx
132
+ operation
117
133
  }, status))
118
134
  })] });
119
135
  }
136
+ const parameters = [...operation.parameters ?? [], ...pathItem.parameters ?? []];
120
137
  const parameterNode = paramTypeKeys.map((type) => {
121
- const params = method.parameters?.filter((param) => param.in === type);
138
+ const params = parameters.filter((param) => param.in === type);
122
139
  if (!params || params.length === 0) return;
140
+ const parameterLabel = type === "path" ? t("Path Parameters") : type === "query" ? t("Query Parameters") : type === "header" ? t("Header Parameters") : t("Cookie Parameters");
123
141
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Heading, {
124
142
  id: `parameters-${type}`,
125
143
  depth: headingLevel,
126
- children: /* @__PURE__ */ jsx(I18nLabel, { label: `${type}Parameters` })
144
+ children: parameterLabel
127
145
  }), /* @__PURE__ */ jsx(AnchorSection, {
128
146
  segments: ["parameters", type],
129
147
  children: /* @__PURE__ */ jsx("div", {
130
148
  className: "flex flex-col",
131
- children: params.map((param) => param.schema != null && /* @__PURE__ */ jsx(Schema, {
149
+ children: params.map((param) => param.schema != null && /* @__PURE__ */ jsx(ctx.SchemaUI, {
132
150
  client: {
133
151
  name: param.name,
134
152
  required: param.required
@@ -138,14 +156,13 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
138
156
  description: param.description ?? param.schema?.description,
139
157
  deprecated: (param.deprecated ?? false) || (param.schema?.deprecated ?? false)
140
158
  } : param.schema,
141
- readOnly: method.method === "get",
142
- writeOnly: method.method !== "get",
143
- ctx
159
+ readOnly: method === "get",
160
+ writeOnly: method !== "get"
144
161
  }, param.name))
145
162
  })
146
163
  })] }, type);
147
164
  });
148
- const securities = (method.security ?? dereferenced.security ?? []).filter((v) => Object.keys(v).length > 0);
165
+ const securities = (operation.security ?? dereferenced.security ?? []).filter((v) => Object.keys(v).length > 0);
149
166
  if (type === "operation" && securities.length > 0) {
150
167
  const securitySchemes = dereferenced.components?.securitySchemes;
151
168
  const items = securities.map((security, i) => {
@@ -178,7 +195,7 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
178
195
  id: "authorization",
179
196
  depth: headingLevel,
180
197
  className: "my-0!",
181
- children: /* @__PURE__ */ jsx(I18nLabel, { label: "authorization" })
198
+ children: t("Authorization")
182
199
  }), items.length > 1 ? /* @__PURE__ */ jsx(SelectTabTrigger, { items }) : /* @__PURE__ */ jsx("div", {
183
200
  className: "not-prose",
184
201
  children: items[0].label
@@ -190,15 +207,14 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
190
207
  if (!scheme) return;
191
208
  return /* @__PURE__ */ jsx(AuthScheme, {
192
209
  scheme,
193
- scopes,
194
- ctx
210
+ scopes
195
211
  }, key);
196
212
  })
197
213
  }, i))]
198
214
  });
199
215
  }
200
216
  const webhookCallbacks = [];
201
- for (const [name, callbacks] of Object.entries(method.callbacks ?? {})) for (const [path, callback] of Object.entries(callbacks)) for (const method of methodKeys) {
217
+ for (const [name, callbacks] of Object.entries(operation.callbacks ?? {})) for (const [path, callback] of Object.entries(callbacks)) for (const method of methodKeys) {
202
218
  if (!callback[method]) continue;
203
219
  webhookCallbacks.push({
204
220
  name,
@@ -211,7 +227,7 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
211
227
  if (webhookCallbacks.length > 0) callbacksNode = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Heading, {
212
228
  id: "callbacks",
213
229
  depth: headingLevel,
214
- children: /* @__PURE__ */ jsx(I18nLabel, { label: "titleCallbacks" })
230
+ children: t("Callbacks")
215
231
  }), /* @__PURE__ */ jsx(Accordions, {
216
232
  type: "multiple",
217
233
  children: webhookCallbacks.map((item, i) => /* @__PURE__ */ jsxs(AccordionItem, {
@@ -222,26 +238,27 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
222
238
  item.path,
223
239
  item.method
224
240
  ],
225
- children: [/* @__PURE__ */ jsxs(AccordionHeader, {
226
- className: "flex-col gap-3",
227
- children: [/* @__PURE__ */ jsx(AccordionTrigger, {
228
- className: "font-mono",
241
+ children: [/* @__PURE__ */ jsx(AccordionHeader, { children: /* @__PURE__ */ jsx(AccordionTrigger, {
242
+ className: "gap-3",
243
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
244
+ className: "font-mono mb-2",
229
245
  children: item.name
230
246
  }), /* @__PURE__ */ jsxs("div", {
231
- className: "flex items-center gap-2 text-xs ps-4.5",
247
+ className: "flex items-center gap-2 text-xs",
232
248
  children: [/* @__PURE__ */ jsx(MethodLabel, { children: item.method }), /* @__PURE__ */ jsx("code", {
233
249
  className: "text-fd-muted-foreground",
234
250
  children: item.path
235
251
  })]
236
- })]
237
- }), /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx("div", {
238
- className: "border p-3 ps-4.5 mb-2 @container prose-no-margin rounded-xl",
252
+ })] })
253
+ }) }), /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx("div", {
254
+ className: "border p-3 mb-2 @container prose-no-margin rounded-2xl",
239
255
  children: /* @__PURE__ */ jsx(Operation, {
240
256
  type: "webhook",
241
257
  path,
242
258
  headingLevel: headingLevel + 1,
243
- method: createMethod(item.method, item.callback, item.operation),
244
- ctx
259
+ method: item.method,
260
+ pathItem: item.callback,
261
+ operation: item.operation
245
262
  })
246
263
  }) })]
247
264
  }, i))
@@ -269,7 +286,31 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
269
286
  })]
270
287
  });
271
288
  };
272
- const playgroundEnabled = ctx.playground?.enabled ?? true;
289
+ let apiPlayground;
290
+ if (ctx.playground?.enabled ?? true) apiPlayground = ctx.playground?.render ? ctx.playground.render({
291
+ path,
292
+ method,
293
+ operation,
294
+ pathItem,
295
+ ctx
296
+ }) : /* @__PURE__ */ jsx(PlaygroundClient, {
297
+ operation,
298
+ pathItem,
299
+ route: path,
300
+ method,
301
+ writeOnly: true,
302
+ readOnly: false
303
+ });
304
+ else apiPlayground = /* @__PURE__ */ jsxs("div", {
305
+ className: "flex flex-row items-center gap-2.5 p-3 rounded-xl border bg-fd-card text-fd-card-foreground not-prose",
306
+ children: [/* @__PURE__ */ jsx(MethodLabel, {
307
+ className: "text-xs",
308
+ children: method
309
+ }), /* @__PURE__ */ jsx("code", {
310
+ className: cn("flex-1 overflow-auto text-nowrap text-[0.8125rem] text-fd-muted-foreground", operation.deprecated && "line-through"),
311
+ children: path
312
+ })]
313
+ });
273
314
  let content = renderOperationLayout({
274
315
  header: headNode,
275
316
  description: descriptionNode,
@@ -278,33 +319,26 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
278
319
  callbacks: callbacksNode,
279
320
  parameters: parameterNode,
280
321
  responses: responseNode,
281
- apiPlayground: playgroundEnabled ? ctx.playground?.render?.({
282
- path,
283
- method,
284
- ctx
285
- }) : /* @__PURE__ */ jsxs("div", {
286
- className: "flex flex-row items-center gap-2.5 p-3 rounded-xl border bg-fd-card text-fd-card-foreground not-prose",
287
- children: [/* @__PURE__ */ jsx(MethodLabel, {
288
- className: "text-xs",
289
- children: method.method
290
- }), /* @__PURE__ */ jsx("code", {
291
- className: cn("flex-1 overflow-auto text-nowrap text-[0.8125rem] text-fd-muted-foreground", method.deprecated && "line-through"),
292
- children: path
293
- })]
294
- }),
322
+ apiPlayground,
295
323
  apiExample: /* @__PURE__ */ jsx(UsageTabs, {
296
324
  method,
297
- ctx
325
+ operation,
326
+ pathItem
298
327
  })
299
- }, ctx, method);
328
+ }, {
329
+ operation,
330
+ method,
331
+ pathItem,
332
+ ctx
333
+ });
300
334
  content = /* @__PURE__ */ jsx(OperationProvider, {
301
- defaultExampleId: method["x-exclusiveCodeSample"] ?? method["x-selectedCodeSample"],
335
+ defaultExampleId: operation["x-exclusiveCodeSample"] ?? operation["x-selectedCodeSample"],
302
336
  route: path,
303
337
  examples: exampleRequests,
304
338
  children: content
305
339
  });
306
- if (method.servers) content = /* @__PURE__ */ jsx(ctx.clientBoundary.ServerProvider, {
307
- servers: method.servers,
340
+ if (operation.servers || pathItem.servers) content = /* @__PURE__ */ jsx(ServerProvider, {
341
+ servers: operation.servers ?? pathItem.servers,
308
342
  children: content
309
343
  });
310
344
  return content;
@@ -338,44 +372,40 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
338
372
  requests: /* @__PURE__ */ jsx(RequestTabs, {
339
373
  examples: exampleRequests,
340
374
  path,
341
- operation: method,
342
- ctx
375
+ method,
376
+ pathItem,
377
+ operation
343
378
  })
344
379
  });
345
380
  }
346
381
  }
347
- function RequestBodyContentItem({ content, method, ctx }) {
382
+ function RequestBodyContentItem({ content, method, operation }) {
383
+ const ctx = useRenderContext();
348
384
  let ts = useMemo(() => {
349
385
  if (!content.schema || !ctx.generateTypeScriptDefinitions) return;
350
386
  return ctx.generateTypeScriptDefinitions(content.schema, {
351
- operation: method,
352
387
  readOnly: false,
353
388
  writeOnly: true,
354
- ...ctx
389
+ ctx
355
390
  });
356
- }, [
357
- content.schema,
358
- ctx,
359
- method
360
- ]);
391
+ }, [content.schema, ctx]);
361
392
  if (ts instanceof Promise) ts = use(ts);
362
393
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [ts && /* @__PURE__ */ jsx(CopyTypeScriptPanel, {
363
394
  name: "request body",
364
395
  code: ts,
365
396
  className: "my-4 last:mb-0"
366
- }), content.schema && /* @__PURE__ */ jsx(Schema, {
397
+ }), content.schema && /* @__PURE__ */ jsx(ctx.SchemaUI, {
367
398
  client: {
368
399
  name: "body",
369
400
  as: "body",
370
- required: method.requestBody?.required
401
+ required: operation.requestBody?.required
371
402
  },
372
403
  root: content.schema,
373
- readOnly: method.method === "get",
374
- writeOnly: method.method !== "get",
375
- ctx
404
+ readOnly: method === "get",
405
+ writeOnly: method !== "get"
376
406
  })] });
377
407
  }
378
- function ResponseAccordion({ status, operation, ctx }) {
408
+ function ResponseAccordion({ status, operation }) {
379
409
  const response = operation.responses[status];
380
410
  const contentTypes = response.content ? Object.entries(response.content) : [];
381
411
  const items = contentTypes.map(([key]) => ({
@@ -395,71 +425,58 @@ function ResponseAccordion({ status, operation, ctx }) {
395
425
  className: "font-mono",
396
426
  children: status
397
427
  }), items.length === 1 ? /* @__PURE__ */ jsx("p", {
398
- className: "text-fd-muted-foreground not-prose",
428
+ className: "text-fd-muted-foreground not-prose py-2",
399
429
  children: items[0].label
400
- }) : items.length > 0 && /* @__PURE__ */ jsx(SelectTabTrigger, { items })] }), /* @__PURE__ */ jsxs(AccordionContent, {
430
+ }) : items.length > 0 && /* @__PURE__ */ jsx(SelectTabTrigger, {
431
+ items,
432
+ className: "my-1.5 py-1"
433
+ })] }), /* @__PURE__ */ jsxs(AccordionContent, {
401
434
  className: "ps-4.5 pe-3 border rounded-xl",
402
435
  children: [response.description && /* @__PURE__ */ jsx("div", {
403
436
  className: "prose-no-margin mt-3 mb-2",
404
- children: ctx.renderMarkdown(response.description)
437
+ children: /* @__PURE__ */ jsx(Markdown, { md: response.description })
405
438
  }), contentTypes.map(([type, item]) => /* @__PURE__ */ jsx(SelectTab, {
406
439
  value: type,
407
440
  anchorSegments: [type],
408
- children: /* @__PURE__ */ jsx(RepsonseAccordionItem, {
409
- type,
410
- status,
411
- item,
412
- operation,
413
- ctx
414
- })
441
+ children: /* @__PURE__ */ jsx(RepsonseAccordionItem, { item })
415
442
  }, type))]
416
443
  })]
417
444
  })
418
445
  });
419
446
  }
420
- function RepsonseAccordionItem({ type, status, operation, item: { schema }, ctx }) {
447
+ function RepsonseAccordionItem({ item: { schema } }) {
448
+ const ctx = useRenderContext();
421
449
  let ts = useMemo(() => {
422
450
  if (!schema || !ctx.generateTypeScriptDefinitions) return;
423
451
  return ctx.generateTypeScriptDefinitions(schema, {
424
452
  readOnly: true,
425
453
  writeOnly: false,
426
- operation,
427
- _internal_legacy: {
428
- statusCode: status,
429
- contentType: type
430
- },
431
- ...ctx
454
+ ctx
432
455
  });
433
- }, [
434
- ctx,
435
- operation,
436
- schema,
437
- status,
438
- type
439
- ]);
456
+ }, [ctx, schema]);
440
457
  if (ts instanceof Promise) ts = use(ts);
441
458
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [ts && /* @__PURE__ */ jsx(CopyTypeScriptPanel, {
442
459
  name: "response body",
443
460
  code: ts,
444
461
  className: "mb-2"
445
- }), schema && /* @__PURE__ */ jsx(Schema, {
462
+ }), schema && /* @__PURE__ */ jsx(ctx.SchemaUI, {
446
463
  client: {
447
464
  name: "response",
448
465
  as: "body"
449
466
  },
450
467
  root: schema,
451
- readOnly: true,
452
- ctx
468
+ readOnly: true
453
469
  })] });
454
470
  }
455
- function AuthScheme({ scheme, scopes, ctx }) {
471
+ function AuthScheme({ scheme, scopes }) {
472
+ const t = useTranslations({ note: "security scheme" });
456
473
  if (scheme.type === "http" || scheme.type === "oauth2") return /* @__PURE__ */ jsxs(AuthProperty, {
457
- name: /* @__PURE__ */ jsx(I18nLabel, { label: "authorization" }),
458
- type: scheme.type === "http" && scheme.scheme === "basic" ? /* @__PURE__ */ jsx(I18nLabel, { label: "authBasicTokenExample" }) : /* @__PURE__ */ jsx(I18nLabel, { label: "authBearerTokenExample" }),
474
+ name: t("Authorization"),
475
+ type: scheme.type === "http" && scheme.scheme === "basic" ? t("Basic <token>") : t("Bearer <token>"),
459
476
  deprecated: scheme.deprecated,
460
477
  scopes,
461
- children: [scheme.description && ctx.renderMarkdown(scheme.description), /* @__PURE__ */ jsxs("p", { children: [
462
- /* @__PURE__ */ jsx(I18nLabel, { label: "authTokenIn" }),
478
+ children: [scheme.description && /* @__PURE__ */ jsx(Markdown, { md: scheme.description }), /* @__PURE__ */ jsxs("p", { children: [
479
+ t("In"),
463
480
  ": ",
464
481
  /* @__PURE__ */ jsx("code", { children: "header" })
465
482
  ] })]
@@ -469,21 +486,22 @@ function AuthScheme({ scheme, scopes, ctx }) {
469
486
  type: "<token>",
470
487
  deprecated: scheme.deprecated,
471
488
  scopes,
472
- children: [scheme.description && ctx.renderMarkdown(scheme.description), /* @__PURE__ */ jsxs("p", { children: [
473
- /* @__PURE__ */ jsx(I18nLabel, { label: "authTokenIn" }),
489
+ children: [scheme.description && /* @__PURE__ */ jsx(Markdown, { md: scheme.description }), /* @__PURE__ */ jsxs("p", { children: [
490
+ t("In"),
474
491
  ": ",
475
492
  /* @__PURE__ */ jsx("code", { children: scheme.in })
476
493
  ] })]
477
494
  });
478
495
  if (scheme.type === "openIdConnect") return /* @__PURE__ */ jsx(AuthProperty, {
479
- name: /* @__PURE__ */ jsx(I18nLabel, { label: "openIdConnect" }),
496
+ name: t("OpenID Connect"),
480
497
  type: "<token>",
481
498
  deprecated: scheme.deprecated,
482
499
  scopes,
483
- children: scheme.description && ctx.renderMarkdown(scheme.description)
500
+ children: scheme.description && /* @__PURE__ */ jsx(Markdown, { md: scheme.description })
484
501
  });
485
502
  }
486
503
  function AuthProperty({ name, type, deprecated = false, scopes = [], className, ...props }) {
504
+ const t = useTranslations({ note: "security scheme" });
487
505
  return /* @__PURE__ */ jsxs("div", {
488
506
  className: cn("text-sm border-t my-4 first:border-t-0", className),
489
507
  children: [/* @__PURE__ */ jsxs("div", {
@@ -500,18 +518,42 @@ function AuthProperty({ name, type, deprecated = false, scopes = [], className,
500
518
  deprecated && /* @__PURE__ */ jsx(Badge, {
501
519
  color: "red",
502
520
  className: "text-xs",
503
- children: /* @__PURE__ */ jsx(I18nLabel, { label: "deprecated" })
521
+ children: t("Deprecated")
504
522
  })
505
523
  ]
506
524
  }), /* @__PURE__ */ jsxs("div", {
507
525
  className: "prose-no-margin pt-2.5 empty:hidden",
508
526
  children: [props.children, scopes.length > 0 && /* @__PURE__ */ jsxs("p", { children: [
509
- /* @__PURE__ */ jsx(I18nLabel, { label: "authScope" }),
527
+ t("Scope"),
510
528
  ": ",
511
529
  /* @__PURE__ */ jsx("code", { children: scopes.join(", ") })
512
530
  ] })]
513
531
  })]
514
532
  });
515
533
  }
534
+ function CopyTypeScriptPanel({ name, code, className }) {
535
+ const [isChecked, onCopy] = useCopyButton(() => {
536
+ navigator.clipboard.writeText(code);
537
+ });
538
+ const t = useTranslations({ note: "TypeScript definitions" });
539
+ return /* @__PURE__ */ jsxs("div", {
540
+ className: cn("flex items-start justify-between gap-2 bg-fd-card text-fd-card-foreground border rounded-xl p-3 not-prose", className),
541
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
542
+ className: "font-medium text-sm mb-2",
543
+ children: t("TypeScript Definitions")
544
+ }), /* @__PURE__ */ jsx("p", {
545
+ className: "text-xs text-fd-muted-foreground",
546
+ children: t("Use the {name} type in TypeScript.", { variables: { name } })
547
+ })] }), /* @__PURE__ */ jsxs("button", {
548
+ onClick: onCopy,
549
+ className: cn(buttonVariants({
550
+ color: "secondary",
551
+ className: "p-2 gap-2",
552
+ size: "sm"
553
+ })),
554
+ children: [isChecked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" }), t("Copy")]
555
+ })]
556
+ });
557
+ }
516
558
  //#endregion
517
559
  export { Operation };
@@ -1,10 +1,15 @@
1
- import { MethodInformation, RenderContext } from "../../types.js";
2
- import { NoReference } from "../../utils/schema/index.js";
1
+ import { ExampleRequestItem } from "../../utils/get-example-requests.js";
2
+ import { HttpMethods, OperationObject, PathItemObject } from "../../types.js";
3
3
  import { ReactNode } from "react";
4
+ import { NoReference } from "@fumadocs/api-docs/schema";
5
+
4
6
  //#region src/ui/operation/request-tabs.d.ts
5
- interface RequestTabsRenderContext extends RenderContext {
7
+ interface RequestTabsRenderOptions {
6
8
  route: string;
7
- operation: NoReference<MethodInformation>;
9
+ items: ExampleRequestItem[];
10
+ method: HttpMethods;
11
+ pathItem: NoReference<PathItemObject>;
12
+ operation: NoReference<OperationObject>;
8
13
  }
9
14
  //#endregion
10
- export { RequestTabsRenderContext };
15
+ export { RequestTabsRenderOptions };