fumadocs-openapi 10.10.2 → 11.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 (234) hide show
  1. package/css/generated/shared.css +1 -1151
  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 -409
  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,45 +1,49 @@
1
1
  "use client";
2
- import { getPreferredType } from "../utils/schema/index.js";
3
- import { joinURL, resolveRequestData, resolveServerUrl, withBase } from "../utils/url.js";
4
- import { useStorageKey } from "../ui/client/storage-key.js";
5
- import { useApiContext, useServerContext } from "../ui/contexts/api.js";
6
- import { useTranslations } from "../ui/client/i18n.js";
2
+ import { getPreferredType } from "../utils/schema.js";
3
+ import { useStorageKey } from "../utils/storage-key.js";
4
+ import { useRenderContext, useServerContext } from "../ui/contexts/api.js";
7
5
  import { cn } from "../utils/cn.js";
8
6
  import { DefaultResultDisplay } from "./components/result-display.js";
7
+ import { pathnameFromRequest } from "../requests/generators/index.js";
9
8
  import { MethodLabel } from "../ui/components/method-label.js";
10
9
  import { useQuery } from "../utils/use-query.js";
11
10
  import { encodeRequestData } from "../requests/media/encode.js";
12
- import { dereferenceSwallow } from "../utils/schema/dereference.js";
13
- import { SchemaProvider, anyFields, useResolvedSchema } from "./schema.js";
14
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/components/select.js";
15
- import { labelVariants } from "../ui/components/input.js";
16
11
  import ServerSelect from "./components/server-select.js";
17
- import { FieldInput, FieldSet, JsonInput, ObjectInput } from "./components/inputs.js";
18
- import { useOperationContext } from "../ui/operation/client.js";
12
+ import { useOperationContext } from "../ui/operation/context.js";
19
13
  import { useAuth } from "./auth.js";
20
14
  import { OAuthDialog, OAuthDialogContent, OAuthDialogTrigger } from "./components/oauth-dialog.js";
21
- import { Spinner } from "./components/spinner.js";
15
+ import { dereferenceShallow } from "@fumadocs/api-docs/schema/dereference";
22
16
  import { Fragment, useEffect, useMemo, useRef, useState } from "react";
23
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
24
18
  import { ChevronDown, LoaderCircle } from "lucide-react";
19
+ import { useTranslations } from "@fuma-translate/react";
25
20
  import { buttonVariants } from "fumadocs-ui/components/ui/button";
26
21
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "fumadocs-ui/components/ui/collapsible";
22
+ import { SchemaProvider, anyFields, useResolvedSchema } from "@fumadocs/api-docs/components/playground/schema";
23
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@fumadocs/api-docs/components/select";
24
+ import { labelVariants } from "@fumadocs/api-docs/components/input";
27
25
  import { StfProvider, useDataEngine, useFieldValue, useListener, useStf } from "@fumari/stf";
26
+ import { joinURL, resolveServerUrl } from "@fumadocs/api-docs/utils/url";
28
27
  import { arrayStartsWith, objectGet, objectSet, stringifyFieldKey } from "@fumari/stf/lib/utils";
28
+ import { FieldInput, FieldSet, JsonInput, ObjectInput } from "@fumadocs/api-docs/components/playground/inputs";
29
29
  import { useOnChange } from "fumadocs-core/utils/use-on-change";
30
+ import { Spinner } from "@fumadocs/api-docs/components/spinner";
30
31
  //#region src/playground/client.tsx
31
- function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly, readOnly, deprecated, ...rest }) {
32
- const t = useTranslations();
32
+ function PlaygroundClient({ route, method, operation, pathItem, writeOnly, readOnly, ...rest }) {
33
+ const t = useTranslations({ note: "playground" });
34
+ const ctx = useRenderContext();
35
+ const { bundled, dereferenced } = ctx.schema;
33
36
  const { parameters, body } = useMemo(() => {
34
- const operation = doc.paths[route][method];
35
- const parameters = operation.parameters?.map((param) => dereferenceSwallow(param, doc)) ?? [];
37
+ const parameters = [];
38
+ if (operation.parameters) for (const p of operation.parameters) parameters.push(dereferenceShallow(p, bundled));
39
+ if (pathItem.parameters) for (const p of pathItem.parameters) parameters.push(dereferenceShallow(p, bundled));
36
40
  let body;
37
41
  if (operation.requestBody) {
38
- const content = dereferenceSwallow(operation.requestBody, doc).content;
42
+ const content = dereferenceShallow(operation.requestBody, bundled).content;
39
43
  const mediaType = content ? getPreferredType(content) : void 0;
40
44
  if (content && mediaType) body = {
41
45
  mediaType,
42
- schema: dereferenceSwallow(content[mediaType], doc).schema ?? true
46
+ schema: dereferenceShallow(content[mediaType], bundled).schema ?? true
43
47
  };
44
48
  }
45
49
  return {
@@ -47,13 +51,27 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
47
51
  parameters
48
52
  };
49
53
  }, [
50
- doc,
51
- route,
52
- method
54
+ bundled,
55
+ operation,
56
+ pathItem
53
57
  ]);
58
+ const securityEntries = useMemo(() => {
59
+ const result = [];
60
+ const security = operation.security ?? dereferenced.security ?? [];
61
+ if (security.length === 0) return result;
62
+ for (const map of security) {
63
+ const list = [];
64
+ for (const [key, scopes] of Object.entries(map)) list.push({
65
+ id: key,
66
+ scopes
67
+ });
68
+ if (list.length > 0) result.push(list);
69
+ }
70
+ return result;
71
+ }, [dereferenced, operation.security]);
54
72
  const { example: exampleId, examples, setExampleData } = useOperationContext();
55
73
  const { server } = useServerContext();
56
- const { mediaAdapters, client: { playground: { components: { ResultDisplay = DefaultResultDisplay, CollapsiblePanel = DefaultCollapsiblePanel } = {}, requestTimeout, fetchOptions = { requestTimeout }, renderBodyField } = {} } } = useApiContext();
74
+ const { mediaAdapters, playground: { components: { ResultDisplay = DefaultResultDisplay, CollapsiblePanel = DefaultCollapsiblePanel } = {}, fetchOptions, renderBodyField } = {} } = useRenderContext();
57
75
  const defaultValues = useMemo(() => {
58
76
  const requestData = examples.find((example) => example.id === exampleId)?.data;
59
77
  return {
@@ -65,10 +83,10 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
65
83
  };
66
84
  }, [examples, exampleId]);
67
85
  const stf = useStf({ defaultValues });
68
- const { inputs, requirementId, setRequirementId, mapInputs, initAuthInputs } = useAuthInputs(stf.dataEngine, securities);
86
+ const { inputs, requirementId, setRequirementId, mapInputs, initAuthInputs } = useAuthInputs(stf.dataEngine, securityEntries);
69
87
  const testQuery = useQuery(async (input) => {
70
88
  const fetcher = await import("./fetcher.js").then((mod) => mod.createBrowserFetcher(mediaAdapters, {
71
- proxyUrl,
89
+ proxyUrl: ctx.proxyUrl,
72
90
  ...fetchOptions
73
91
  }));
74
92
  const encoded = encodeRequestData({
@@ -76,7 +94,7 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
76
94
  method,
77
95
  bodyMediaType: body?.mediaType
78
96
  }, mediaAdapters, parameters);
79
- return fetcher.fetch(joinURL(withBase(server ? resolveServerUrl(server.url, server.variables) : "/", window.location.origin), resolveRequestData(route, encoded)), encoded);
97
+ return fetcher.fetch(joinURL(new URL(server ? resolveServerUrl(server.url, server.variables) : "/", window.location.origin).href, pathnameFromRequest(route, encoded)), encoded);
80
98
  });
81
99
  const timerRef = useRef(null);
82
100
  const stfSync = useRef(false);
@@ -112,7 +130,7 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
112
130
  return /* @__PURE__ */ jsx(StfProvider, {
113
131
  value: stf,
114
132
  children: /* @__PURE__ */ jsx(SchemaProvider, {
115
- doc,
133
+ docRoot: bundled,
116
134
  writeOnly,
117
135
  readOnly,
118
136
  children: /* @__PURE__ */ jsxs("form", {
@@ -130,7 +148,7 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
130
148
  /* @__PURE__ */ jsx(MethodLabel, { children: method }),
131
149
  /* @__PURE__ */ jsx(Route, {
132
150
  route,
133
- className: cn("flex-1", deprecated && "line-through")
151
+ className: cn("flex-1", operation.deprecated && "line-through")
134
152
  }),
135
153
  /* @__PURE__ */ jsx("button", {
136
154
  type: "submit",
@@ -139,7 +157,7 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
139
157
  size: "sm"
140
158
  }), "w-14 py-1.5"),
141
159
  disabled: testQuery.isLoading,
142
- children: testQuery.isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }) : t.send
160
+ children: testQuery.isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }) : t("Send")
143
161
  })
144
162
  ]
145
163
  }),
@@ -147,8 +165,8 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
147
165
  data: testQuery.data,
148
166
  reset: testQuery.reset
149
167
  }) : null,
150
- securities.length > 0 && /* @__PURE__ */ jsx(SecurityRequirements, {
151
- securities,
168
+ securityEntries.length > 0 && /* @__PURE__ */ jsx(SecurityRequirements, {
169
+ securities: securityEntries,
152
170
  securityId: requirementId,
153
171
  setSecurityId: setRequirementId,
154
172
  children: inputs.map((input) => /* @__PURE__ */ jsx(Fragment, { children: input.children }, stringifyFieldKey(input.fieldName)))
@@ -156,7 +174,7 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
156
174
  /* @__PURE__ */ jsx(ParametersForm, { parameters }),
157
175
  body && /* @__PURE__ */ jsx(CollapsiblePanel, {
158
176
  "data-type": "body",
159
- title: t.body,
177
+ title: t("Body"),
160
178
  children: renderBodyField ? renderBodyField("body", body) : /* @__PURE__ */ jsx(BodyInput, { field: body.schema })
161
179
  })
162
180
  ]
@@ -165,21 +183,21 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
165
183
  });
166
184
  }
167
185
  function SecurityRequirements({ securities, setSecurityId, securityId, children }) {
168
- const t = useTranslations();
186
+ const t = useTranslations({ note: "playground" });
169
187
  const { isLoading, error } = useAuth();
170
188
  const defaultOpen = isLoading || error != null;
171
189
  const [open, setOpen] = useState(defaultOpen);
172
- const { CollapsiblePanel = DefaultCollapsiblePanel } = useApiContext().client.playground?.components ?? {};
190
+ const { CollapsiblePanel = DefaultCollapsiblePanel } = useRenderContext().playground?.components ?? {};
173
191
  useOnChange(defaultOpen, () => {
174
192
  if (defaultOpen) setOpen(true);
175
193
  });
176
194
  return /* @__PURE__ */ jsxs(CollapsiblePanel, {
177
- title: /* @__PURE__ */ jsxs(Fragment$1, { children: [t.authorization, isLoading && /* @__PURE__ */ jsxs("span", {
195
+ title: /* @__PURE__ */ jsxs(Fragment$1, { children: [t("Authorization"), isLoading && /* @__PURE__ */ jsxs("span", {
178
196
  className: "border-s ps-2 inline-flex items-center gap-1.5 text-fd-muted-foreground text-xs font-mono",
179
197
  children: [
180
198
  /* @__PURE__ */ jsx(Spinner, {}),
181
199
  " ",
182
- t.fetchingToken
200
+ t("Fetching token...")
183
201
  ]
184
202
  })] }),
185
203
  "data-type": "authorization",
@@ -190,7 +208,7 @@ function SecurityRequirements({ securities, setSecurityId, securityId, children
190
208
  className: "p-2 border rounded-lg bg-fd-secondary",
191
209
  children: [/* @__PURE__ */ jsx("p", {
192
210
  className: "text-fd-muted-foreground font-medium mb-1",
193
- children: t.fetchTokenError
211
+ children: t("Failed to fetch token")
194
212
  }), /* @__PURE__ */ jsx("p", { children: String(error) })]
195
213
  }),
196
214
  /* @__PURE__ */ jsxs(Select, {
@@ -206,11 +224,12 @@ function SecurityRequirements({ securities, setSecurityId, securityId, children
206
224
  });
207
225
  }
208
226
  function SecurityRequirement({ requirement }) {
209
- const { schemes } = useApiContext();
227
+ const schemes = useRenderContext().schema.dereferenced.components?.securitySchemes;
210
228
  return /* @__PURE__ */ jsx("div", {
211
229
  className: "flex flex-col gap-2 max-w-[600px]",
212
230
  children: requirement.map((item) => {
213
- const scheme = schemes[item.id];
231
+ const scheme = schemes?.[item.id];
232
+ if (!scheme) return;
214
233
  return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
215
234
  className: cn("font-mono font-medium", scheme.deprecated && "text-fd-muted-foreground line-through"),
216
235
  children: item.id
@@ -228,7 +247,7 @@ const ParamTypes = [
228
247
  "query"
229
248
  ];
230
249
  function ParameterItem({ type, parameters }) {
231
- const { renderParameterField } = useApiContext().client.playground ?? {};
250
+ const { renderParameterField } = useRenderContext().playground ?? {};
232
251
  return parameters.map((field) => {
233
252
  const fieldName = [type, field.name];
234
253
  if (renderParameterField) return renderParameterField(fieldName, field);
@@ -243,13 +262,13 @@ function ParameterItem({ type, parameters }) {
243
262
  });
244
263
  }
245
264
  function ParametersForm({ parameters }) {
246
- const { components: { CollapsiblePanel = DefaultCollapsiblePanel } = {} } = useApiContext().client.playground ?? {};
247
- const t = useTranslations();
265
+ const { components: { CollapsiblePanel = DefaultCollapsiblePanel } = {} } = useRenderContext().playground ?? {};
266
+ const t = useTranslations({ note: "playground" });
248
267
  const displayNames = {
249
- header: t.header,
250
- cookie: t.cookies,
251
- query: t.query,
252
- path: t.path
268
+ header: t("Header"),
269
+ cookie: t("Cookies"),
270
+ query: t("Query"),
271
+ path: t("Path")
253
272
  };
254
273
  return ParamTypes.map((type) => {
255
274
  const items = parameters.filter((v) => v.in === type);
@@ -267,7 +286,7 @@ function ParametersForm({ parameters }) {
267
286
  function BodyInput({ field: _field }) {
268
287
  const field = useResolvedSchema(_field);
269
288
  const [isJson, setIsJson] = useState(false);
270
- const t = useTranslations();
289
+ const t = useTranslations({ note: "playground" });
271
290
  if (field.format === "binary") return /* @__PURE__ */ jsx(FieldSet, {
272
291
  field,
273
292
  fieldName: ["body"],
@@ -281,7 +300,7 @@ function BodyInput({ field: _field }) {
281
300
  })),
282
301
  onClick: () => setIsJson(false),
283
302
  type: "button",
284
- children: t.closeJsonEditor
303
+ children: t("Close JSON Editor")
285
304
  }), /* @__PURE__ */ jsx(JsonInput, { fieldName: ["body"] })] });
286
305
  return /* @__PURE__ */ jsx(FieldSet, {
287
306
  field,
@@ -296,25 +315,27 @@ function BodyInput({ field: _field }) {
296
315
  className: "p-2"
297
316
  })),
298
317
  onClick: () => setIsJson(true),
299
- children: t.openJsonEditor
318
+ children: t("Open JSON Editor")
300
319
  })
301
320
  });
302
321
  }
303
322
  function useAuthInputs(engine, requirements) {
304
323
  const authCtx = useAuth();
305
324
  const storageKeys = useStorageKey();
306
- const t = useTranslations();
307
- const { schemes, client: { playground: { transformAuthInputs } = {} } } = useApiContext();
325
+ const t = useTranslations({ note: "playground" });
326
+ const ctx = useRenderContext();
327
+ const schemes = ctx.schema.dereferenced.components?.securitySchemes;
328
+ const { transformAuthInputs } = ctx.playground ?? {};
308
329
  const [requirementId, setRequirementId] = useState(() => {
309
- if (requirements.length === 0) return -1;
330
+ if (!schemes || requirements.length === 0) return -1;
310
331
  const idx = requirements.findIndex((s) => s.every((item) => !schemes[item.id].deprecated));
311
332
  return idx !== -1 ? idx : 0;
312
333
  });
313
334
  const requirement = requirementId === -1 ? null : requirements[requirementId];
314
335
  let inputs = useMemo(() => {
315
- if (!requirement) return [];
336
+ if (!requirement || !schemes) return [];
316
337
  return requirement.map((item) => {
317
- const scheme = schemes[item.id];
338
+ const scheme = schemes?.[item.id];
318
339
  if (scheme.type === "http" && scheme.scheme === "basic") {
319
340
  const fieldName = ["header", "Authorization"];
320
341
  return {
@@ -365,7 +386,7 @@ function useAuthInputs(engine, requirements) {
365
386
  storageKey: storageKeys.AuthField(item.id),
366
387
  defaultValue: "Bearer ",
367
388
  children: /* @__PURE__ */ jsx(FieldSet, {
368
- name: `${t.authorization} (${t.header})`,
389
+ name: `${t("Authorization")} (${t("Header")})`,
369
390
  fieldName,
370
391
  field: { type: "string" }
371
392
  })
@@ -392,12 +413,12 @@ function useAuthInputs(engine, requirements) {
392
413
  defaultValue: "",
393
414
  storageKey: storageKeys.AuthField(item.id),
394
415
  children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FieldSet, {
395
- name: `${t.authorization} (${t.header})`,
416
+ name: `${t("Authorization")} (${t("Header")})`,
396
417
  fieldName,
397
418
  field: { type: "string" }
398
419
  }), /* @__PURE__ */ jsx("p", {
399
420
  className: "text-fd-muted-foreground text-xs",
400
- children: t.openIdUnsupported
421
+ children: t("OpenID Connect is not supported at the moment, you can still set an access token here.")
401
422
  })] })
402
423
  };
403
424
  });
@@ -466,13 +487,13 @@ function useAuthInputs(engine, requirements) {
466
487
  function OAuth2Input({ fieldName, security }) {
467
488
  const [open, setOpen] = useState(false);
468
489
  const engine = useDataEngine();
469
- const t = useTranslations();
490
+ const t = useTranslations({ note: "playground" });
470
491
  return /* @__PURE__ */ jsxs("fieldset", {
471
492
  className: "flex flex-col gap-2",
472
493
  children: [/* @__PURE__ */ jsx("label", {
473
494
  htmlFor: stringifyFieldKey(fieldName),
474
495
  className: cn(labelVariants()),
475
- children: t.accessToken
496
+ children: t("Access Token")
476
497
  }), /* @__PURE__ */ jsxs("div", {
477
498
  className: "flex gap-2",
478
499
  children: [/* @__PURE__ */ jsx(FieldInput, {
@@ -488,7 +509,7 @@ function OAuth2Input({ fieldName, security }) {
488
509
  size: "sm",
489
510
  color: "secondary"
490
511
  })),
491
- children: t.authorize
512
+ children: t("Authorize")
492
513
  }), /* @__PURE__ */ jsx(OAuthDialogContent, {
493
514
  setOpen,
494
515
  schemeId: security.id,
@@ -1,53 +1,53 @@
1
- import { useApiContext } from "../../ui/contexts/api.js";
2
- import { useTranslations } from "../../ui/client/i18n.js";
1
+ import { useRenderContext } from "../../ui/contexts/api.js";
3
2
  import { cn } from "../../utils/cn.js";
4
3
  import { useQuery } from "../../utils/use-query.js";
5
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
6
- import { Input, labelVariants } from "../../ui/components/input.js";
7
- import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "../../ui/components/dialog.js";
8
4
  import { useAuth } from "../auth.js";
9
5
  import { useMemo, useState } from "react";
10
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { useTranslations } from "@fuma-translate/react";
11
8
  import { buttonVariants } from "fumadocs-ui/components/ui/button";
9
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@fumadocs/api-docs/components/select";
10
+ import { Input, labelVariants } from "@fumadocs/api-docs/components/input";
11
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@fumadocs/api-docs/components/dialog";
12
12
  //#region src/playground/components/oauth-dialog.tsx
13
13
  const OAuthDialog = Dialog;
14
14
  function OAuthDialogContent(props) {
15
- const t = useTranslations();
16
- return /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t.authorization }), /* @__PURE__ */ jsx(DialogDescription, { children: t.obtainAccessToken })] }), /* @__PURE__ */ jsx(Content, { ...props })] });
15
+ const t = useTranslations({ note: "OAuth dialog" });
16
+ return /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("Authorization") }), /* @__PURE__ */ jsx(DialogDescription, { children: t("Obtain the access token for API.") })] }), /* @__PURE__ */ jsx(Content, { ...props })] });
17
17
  }
18
18
  function Content({ schemeId, scopes, setToken, setOpen }) {
19
- const { schemes } = useApiContext();
19
+ const schemes = useRenderContext().schema.dereferenced.components?.securitySchemes;
20
20
  const tokenInfo = useAuth().store[schemeId];
21
- const scheme = schemes[schemeId];
21
+ const scheme = schemes?.[schemeId];
22
22
  if (!scheme || scheme.type !== "oauth2") throw new Error("unexpected schemaId: must be type oauth2");
23
23
  const [type, setType] = useState(() => {
24
24
  return Object.keys(scheme.flows)[0];
25
25
  });
26
- const t = useTranslations();
26
+ const t = useTranslations({ note: "OAuth dialog" });
27
27
  const allFlows = useMemo(() => ({
28
28
  password: {
29
- name: t.resourceOwnerPassword,
30
- description: t.resourceOwnerPasswordDesc,
29
+ name: t("Resource Owner Password Flow"),
30
+ description: t("Authenticate using username and password."),
31
31
  supported: true
32
32
  },
33
33
  clientCredentials: {
34
- name: t.clientCredentials,
35
- description: t.clientCredentialsDesc,
34
+ name: t("Client Credentials"),
35
+ description: t("Intended for the server-to-server authentication."),
36
36
  supported: true
37
37
  },
38
38
  authorizationCode: {
39
- name: t.authorizationCode,
40
- description: t.authorizationCodeDesc,
39
+ name: t("Authorization code"),
40
+ description: t("Authenticate with 3rd party services"),
41
41
  supported: true
42
42
  },
43
43
  implicit: {
44
- name: t.implicit,
45
- description: t.implicitDesc,
44
+ name: t("Implicit"),
45
+ description: t("Retrieve the access token directly."),
46
46
  supported: true
47
47
  },
48
48
  deviceAuthorization: {
49
- name: t.deviceAuthorization,
50
- description: t.deviceAuthorizationDesc,
49
+ name: t("Device Authorization"),
50
+ description: t("Authenticate with device."),
51
51
  supported: false
52
52
  }
53
53
  }), [t]);
@@ -138,7 +138,7 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
138
138
  /* @__PURE__ */ jsxs(Select, {
139
139
  value: type ?? "",
140
140
  onValueChange: setType,
141
- children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t.oauthFlowPlaceholder }) }), /* @__PURE__ */ jsx(SelectContent, { children: Object.keys(scheme.flows).map((key) => {
141
+ children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Select a flow") }) }), /* @__PURE__ */ jsx(SelectContent, { children: Object.keys(scheme.flows).map((key) => {
142
142
  const { name, description } = allFlows[key];
143
143
  return /* @__PURE__ */ jsxs(SelectItem, {
144
144
  value: key,
@@ -158,16 +158,16 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
158
158
  /* @__PURE__ */ jsx("label", {
159
159
  htmlFor: "client_id",
160
160
  className: cn(labelVariants()),
161
- children: t.clientId
161
+ children: t("Client ID")
162
162
  }),
163
163
  /* @__PURE__ */ jsx("p", {
164
164
  className: "text-fd-muted-foreground text-sm",
165
- children: t.clientIdHint
165
+ children: t("The client ID of your OAuth application.")
166
166
  }),
167
167
  /* @__PURE__ */ jsx(Input, {
168
168
  id: "client_id",
169
169
  name: "clientId",
170
- placeholder: t.inputPlaceholder,
170
+ placeholder: t("Enter value"),
171
171
  type: "text",
172
172
  autoComplete: "off",
173
173
  disabled: isLoading,
@@ -182,16 +182,16 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
182
182
  /* @__PURE__ */ jsx("label", {
183
183
  htmlFor: "client_secret",
184
184
  className: cn(labelVariants()),
185
- children: t.clientSecret
185
+ children: t("Client Secret")
186
186
  }),
187
187
  /* @__PURE__ */ jsx("p", {
188
188
  className: "text-fd-muted-foreground text-sm",
189
- children: t.clientSecretHint
189
+ children: t("The client secret of your OAuth application.")
190
190
  }),
191
191
  /* @__PURE__ */ jsx(Input, {
192
192
  id: "client_secret",
193
193
  name: "clientSecret",
194
- placeholder: t.inputPlaceholder,
194
+ placeholder: t("Enter value"),
195
195
  type: "password",
196
196
  autoComplete: "off",
197
197
  disabled: isLoading,
@@ -205,11 +205,11 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
205
205
  children: [/* @__PURE__ */ jsx("label", {
206
206
  htmlFor: "username",
207
207
  className: cn(labelVariants()),
208
- children: t.usernameField
208
+ children: t("Username")
209
209
  }), /* @__PURE__ */ jsx(Input, {
210
210
  id: "username",
211
211
  name: "username",
212
- placeholder: t.inputPlaceholder,
212
+ placeholder: t("Enter value"),
213
213
  type: "text",
214
214
  autoComplete: "off",
215
215
  disabled: isLoading,
@@ -221,11 +221,11 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
221
221
  children: [/* @__PURE__ */ jsx("label", {
222
222
  htmlFor: "password",
223
223
  className: cn(labelVariants()),
224
- children: t.clientSecret
224
+ children: t("Password")
225
225
  }), /* @__PURE__ */ jsx(Input, {
226
226
  id: "password",
227
227
  name: "password",
228
- placeholder: t.inputPlaceholder,
228
+ placeholder: t("Enter value"),
229
229
  type: "password",
230
230
  autoComplete: "off",
231
231
  disabled: isLoading,
@@ -239,10 +239,10 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
239
239
  }) : null, /* @__PURE__ */ jsx("button", {
240
240
  type: "submit",
241
241
  className: cn(buttonVariants({ color: "primary" })),
242
- children: t.submit
242
+ children: t("Submit")
243
243
  })] }) : /* @__PURE__ */ jsx("p", {
244
244
  className: "text-fd-muted-foreground bg-fd-muted p-2 rounded-lg border",
245
- children: t.unsupported
245
+ children: t("Unsupported")
246
246
  })
247
247
  ]
248
248
  });
@@ -1,6 +1,5 @@
1
1
  import { FetchResult } from "../fetcher.js";
2
2
  import { ComponentProps } from "react";
3
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
3
 
5
4
  //#region src/playground/components/result-display.d.ts
6
5
  interface ResultDisplayProps extends ComponentProps<'div'> {
@@ -11,6 +10,6 @@ declare function DefaultResultDisplay({
11
10
  data,
12
11
  reset,
13
12
  ...rest
14
- }: ResultDisplayProps): _$react_jsx_runtime0.JSX.Element;
13
+ }: ResultDisplayProps): import("react").JSX.Element;
15
14
  //#endregion
16
15
  export { DefaultResultDisplay, ResultDisplayProps };
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- import { useTranslations } from "../../ui/client/i18n.js";
3
2
  import { useStatusInfo } from "../status-info.js";
4
3
  import { cn } from "../../utils/cn.js";
5
4
  import { ClientCodeBlock } from "../../ui/components/codeblock.js";
@@ -7,14 +6,14 @@ import { require_fast_content_type_parse } from "../../node_modules/.pnpm/fast-c
7
6
  import { useEffect, useMemo, useState } from "react";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
8
  import { CircleX } from "lucide-react";
10
- import { renderTranslation } from "fumadocs-core/i18n";
9
+ import { useTranslations } from "@fuma-translate/react";
11
10
  import { buttonVariants } from "fumadocs-ui/components/ui/button";
12
11
  import { cva } from "class-variance-authority";
13
12
  //#region src/playground/components/result-display.tsx
14
13
  var import_fast_content_type_parse = require_fast_content_type_parse();
15
14
  const panelVariants = cva("flex flex-col gap-2 mt-2 px-3 py-2 border-y bg-fd-secondary text-fd-secondary-foreground");
16
15
  function DefaultResultDisplay({ data, reset, ...rest }) {
17
- const t = useTranslations();
16
+ const t = useTranslations({ note: "playground result display" });
18
17
  if (data.type === "client_error") return /* @__PURE__ */ jsxs("div", {
19
18
  ...rest,
20
19
  className: cn(panelVariants(), rest.className),
@@ -24,7 +23,7 @@ function DefaultResultDisplay({ data, reset, ...rest }) {
24
23
  /* @__PURE__ */ jsx(CircleX, { className: "size-4 text-red-500" }),
25
24
  /* @__PURE__ */ jsx("p", {
26
25
  className: "text-sm font-medium me-auto",
27
- children: t.statusClientError
26
+ children: t("Client Error")
28
27
  }),
29
28
  /* @__PURE__ */ jsx("button", {
30
29
  type: "button",
@@ -33,7 +32,7 @@ function DefaultResultDisplay({ data, reset, ...rest }) {
33
32
  variant: "outline"
34
33
  })),
35
34
  onClick: () => reset(),
36
- children: t.close
35
+ children: t("Close")
37
36
  })
38
37
  ]
39
38
  }), /* @__PURE__ */ jsx("p", { children: data.message })]
@@ -60,7 +59,7 @@ function getTextFormat(mime) {
60
59
  return null;
61
60
  }
62
61
  function ResponseResult({ data, reset, ...rest }) {
63
- const t = useTranslations();
62
+ const t = useTranslations({ note: "playground result display" });
64
63
  const statusInfo = useStatusInfo(data.status);
65
64
  const { parameters, type } = useMemo(() => (0, import_fast_content_type_parse.safeParse)(data.headers.get("Content-Type") ?? "text/plain"), [data.headers]);
66
65
  let content;
@@ -77,7 +76,7 @@ function ResponseResult({ data, reset, ...rest }) {
77
76
  });
78
77
  else content = /* @__PURE__ */ jsx("p", {
79
78
  className: "p-2 border rounded-lg bg-fd-card text-fd-card-foreground",
80
- children: renderTranslation(t.statusBinaryBody, { length: String(data.body.byteLength) })
79
+ children: t("Binary response body, {length} bytes", { variables: { length: String(data.body.byteLength) } })
81
80
  });
82
81
  }
83
82
  return /* @__PURE__ */ jsxs("div", {
@@ -106,7 +105,7 @@ function ResponseResult({ data, reset, ...rest }) {
106
105
  variant: "outline"
107
106
  })),
108
107
  onClick: () => reset(),
109
- children: t.close
108
+ children: t("Close")
110
109
  })
111
110
  ]
112
111
  }), content]
@@ -1,21 +1,21 @@
1
1
  "use client";
2
- import { resolveServerUrl, withBase } from "../../utils/url.js";
3
2
  import { useServerContext } from "../../ui/contexts/api.js";
4
- import { useTranslations } from "../../ui/client/i18n.js";
5
3
  import { cn } from "../../utils/cn.js";
6
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
7
- import { Input, labelVariants } from "../../ui/components/input.js";
8
- import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "../../ui/components/dialog.js";
9
4
  import { useEffect, useRef, useState } from "react";
10
5
  import { jsx, jsxs } from "react/jsx-runtime";
11
6
  import { EditIcon } from "lucide-react";
7
+ import { useTranslations } from "@fuma-translate/react";
8
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@fumadocs/api-docs/components/select";
9
+ import { Input, labelVariants } from "@fumadocs/api-docs/components/input";
10
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@fumadocs/api-docs/components/dialog";
12
11
  import { StfProvider, useFieldValue, useListener, useStf } from "@fumari/stf";
12
+ import { resolveServerUrl } from "@fumadocs/api-docs/utils/url";
13
13
  //#region src/playground/components/server-select.tsx
14
14
  function ServerSelect(props) {
15
15
  const { servers, server, setServer, setServerVariables } = useServerContext();
16
16
  const [open, setOpen] = useState(false);
17
17
  const [isMounted, setIsMounted] = useState(false);
18
- const t = useTranslations();
18
+ const t = useTranslations({ note: "playground server select" });
19
19
  useEffect(() => {
20
20
  setIsMounted(true);
21
21
  }, []);
@@ -30,16 +30,16 @@ function ServerSelect(props) {
30
30
  children: [
31
31
  /* @__PURE__ */ jsx("span", {
32
32
  className: "px-2 py-0.5 -ms-2 font-medium rounded-lg border bg-fd-secondary text-fd-secondary-foreground shadow-sm",
33
- children: server?.name ?? t.serverUrl
33
+ children: server?.name ?? t("Server URL")
34
34
  }),
35
35
  /* @__PURE__ */ jsx("code", {
36
36
  className: "truncate min-w-0 flex-1",
37
- children: isMounted ? withBase(server ? resolveServerUrl(server.url, server.variables) : "/", window.location.origin) : t.loading
37
+ children: isMounted ? new URL(server ? resolveServerUrl(server.url, server.variables) : "/", window.location.origin).href : t("loading...")
38
38
  }),
39
39
  /* @__PURE__ */ jsx(EditIcon, { className: "size-4" })
40
40
  ]
41
41
  }), /* @__PURE__ */ jsxs(DialogContent, { children: [
42
- /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t.serverUrl }), /* @__PURE__ */ jsx(DialogDescription, { children: t.serverUrlDescription })] }),
42
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("Server URL") }), /* @__PURE__ */ jsx(DialogDescription, { children: t("The base URL of your API endpoint.") })] }),
43
43
  /* @__PURE__ */ jsxs(Select, {
44
44
  value: server?.url,
45
45
  onValueChange: setServer,
@@ -100,7 +100,7 @@ function ServerSelectContent({ defaultValues, onChange, schema }) {
100
100
  });
101
101
  }
102
102
  function Field({ fieldName, variable }) {
103
- const t = useTranslations();
103
+ const t = useTranslations({ note: "playground server select" });
104
104
  const [value, setValue] = useFieldValue([fieldName], { compute(currentValue) {
105
105
  return typeof currentValue === "string" ? currentValue : void 0;
106
106
  } });
@@ -119,7 +119,7 @@ function Field({ fieldName, variable }) {
119
119
  id: fieldName,
120
120
  value,
121
121
  onChange: (e) => setValue(e.target.value),
122
- placeholder: t.serverUrlFieldPlaceholder
122
+ placeholder: t("Enter Value")
123
123
  });
124
124
  }
125
125
  //#endregion