@fumadocs/api-docs 0.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 (179) hide show
  1. package/LICENSE +21 -0
  2. package/css/generated/shared.css +1 -0
  3. package/css/preset.css +1 -0
  4. package/dist/.translations/index.d.ts +28 -0
  5. package/dist/.translations/keys.js +28 -0
  6. package/dist/_virtual/_rolldown/runtime.js +4 -0
  7. package/dist/auto-anchor/client.d.ts +16 -0
  8. package/dist/auto-anchor/client.js +20 -0
  9. package/dist/auto-anchor/index.d.ts +9 -0
  10. package/dist/auto-anchor/index.js +17 -0
  11. package/dist/codegen.d.ts +38 -0
  12. package/dist/codegen.js +35 -0
  13. package/dist/components/accordion.d.ts +22 -0
  14. package/dist/components/accordion.js +67 -0
  15. package/dist/components/dialog.d.ts +39 -0
  16. package/dist/components/dialog.js +61 -0
  17. package/dist/components/input.d.ts +8 -0
  18. package/dist/components/input.js +17 -0
  19. package/dist/components/playground/inputs.d.ts +50 -0
  20. package/dist/components/playground/inputs.js +426 -0
  21. package/dist/components/playground/schema.d.ts +66 -0
  22. package/dist/components/playground/schema.js +144 -0
  23. package/dist/components/schema/client.d.ts +17 -0
  24. package/dist/components/schema/client.js +415 -0
  25. package/dist/components/schema/index.d.ts +102 -0
  26. package/dist/components/schema/index.js +276 -0
  27. package/dist/components/select-tab.d.ts +33 -0
  28. package/dist/components/select-tab.js +56 -0
  29. package/dist/components/select.d.ts +16 -0
  30. package/dist/components/select.js +72 -0
  31. package/dist/components/spinner.d.ts +7 -0
  32. package/dist/components/spinner.js +14 -0
  33. package/dist/i18n.d.ts +7 -0
  34. package/dist/i18n.js +7 -0
  35. 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 +239 -0
  36. 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 +187 -0
  37. 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.d.ts +157 -0
  38. 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 +136 -0
  39. 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 +41 -0
  40. 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.d.ts +166 -0
  41. 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 +124 -0
  42. 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 +109 -0
  43. 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 +30 -0
  44. 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 +46 -0
  45. 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 +36 -0
  46. 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 +49 -0
  47. 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.d.ts +96 -0
  48. 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 +242 -0
  49. 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.d.ts +190 -0
  50. 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 +247 -0
  51. 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.d.ts +134 -0
  52. 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 +210 -0
  53. 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 +100 -0
  54. 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 +41 -0
  55. 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 +112 -0
  56. 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/types/index.d.ts +133 -0
  57. 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 +8 -0
  58. 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.d.ts +34 -0
  59. 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 +146 -0
  60. 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 +5 -0
  61. 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 +18 -0
  62. 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 +11 -0
  63. 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 +99 -0
  64. 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 +30 -0
  65. 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 +315 -0
  66. package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
  67. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +110 -0
  68. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +138 -0
  69. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +674 -0
  70. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +141 -0
  71. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +102 -0
  72. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +223 -0
  73. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +28 -0
  74. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +18 -0
  75. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +133 -0
  76. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +61 -0
  77. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +146 -0
  78. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +23 -0
  79. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +48 -0
  80. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +172 -0
  81. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +31 -0
  82. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +433 -0
  83. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +113 -0
  84. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +72 -0
  85. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +583 -0
  86. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +18 -0
  87. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +42 -0
  88. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +50 -0
  89. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +20 -0
  90. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +51 -0
  91. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +16 -0
  92. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +36 -0
  93. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +19 -0
  94. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +85 -0
  95. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +59 -0
  96. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +12 -0
  97. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
  98. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +12 -0
  99. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +16 -0
  100. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +57 -0
  101. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +96 -0
  102. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +29 -0
  103. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +16 -0
  104. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +89 -0
  105. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +87 -0
  106. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +16 -0
  107. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +62 -0
  108. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +60 -0
  109. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +59 -0
  110. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +34 -0
  111. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +31 -0
  112. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +51 -0
  113. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +61 -0
  114. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +17 -0
  115. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +52 -0
  116. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +41 -0
  117. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +17 -0
  118. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +130 -0
  119. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +14 -0
  120. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +22 -0
  121. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +112 -0
  122. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +101 -0
  123. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +14 -0
  124. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +35 -0
  125. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +46 -0
  126. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +45 -0
  127. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +22 -0
  128. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +20 -0
  129. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +15 -0
  130. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
  131. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +10 -0
  132. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +23 -0
  133. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +19 -0
  134. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +13 -0
  135. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +46 -0
  136. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +59 -0
  137. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +27 -0
  138. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +17 -0
  139. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +49 -0
  140. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +48 -0
  141. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +18 -0
  142. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +28 -0
  143. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
  144. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +47 -0
  145. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +28 -0
  146. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +27 -0
  147. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +38 -0
  148. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +72 -0
  149. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +70 -0
  150. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +33 -0
  151. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +236 -0
  152. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +187 -0
  153. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +282 -0
  154. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +78 -0
  155. package/dist/schema/bundle.d.ts +2 -0
  156. package/dist/schema/bundle.js +2 -0
  157. package/dist/schema/dereference.d.ts +19 -0
  158. package/dist/schema/dereference.js +49 -0
  159. package/dist/schema/index.d.ts +21 -0
  160. package/dist/schema/index.js +0 -0
  161. package/dist/schema/merge.d.ts +12 -0
  162. package/dist/schema/merge.js +156 -0
  163. package/dist/schema/ref.d.ts +20 -0
  164. package/dist/schema/ref.js +43 -0
  165. package/dist/schema/resolve-ref.d.ts +4 -0
  166. package/dist/schema/resolve-ref.js +11 -0
  167. package/dist/schema/sample.d.ts +12 -0
  168. package/dist/schema/sample.js +442 -0
  169. package/dist/schema/to-string.d.ts +10 -0
  170. package/dist/schema/to-string.js +51 -0
  171. package/dist/utils/cn.js +2 -0
  172. package/dist/utils/deep-equal.js +21 -0
  173. package/dist/utils/id-to-title.d.ts +4 -0
  174. package/dist/utils/id-to-title.js +12 -0
  175. package/dist/utils/is-plain-object.js +8 -0
  176. package/dist/utils/merge-refs.js +11 -0
  177. package/dist/utils/url.d.ts +5 -0
  178. package/dist/utils/url.js +13 -0
  179. package/package.json +105 -0
@@ -0,0 +1,276 @@
1
+ "use client";
2
+ import { mergeAllOf } from "../../schema/merge.js";
3
+ import { schemaToString } from "../../schema/to-string.js";
4
+ import { SchemaUI } from "./client.js";
5
+ import { useMemo } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { useTranslations } from "@fuma-translate/react";
8
+ //#region src/components/schema/index.tsx
9
+ function Schema({ client, root, readOnly, writeOnly, resolver, showExample, renderMarkdown }) {
10
+ const t = useTranslations({ note: "schema UI" });
11
+ const generated = useMemo(() => {
12
+ return generateSchemaUI({
13
+ root,
14
+ resolver,
15
+ readOnly,
16
+ writeOnly,
17
+ showExample,
18
+ renderMarkdown,
19
+ labels: {
20
+ default: t("Default"),
21
+ match: t("Match"),
22
+ format: t("Format"),
23
+ multipleOf: t("Multiple Of"),
24
+ range: t("Range"),
25
+ length: t("Length"),
26
+ properties: t("Properties"),
27
+ items: t("Items"),
28
+ valueIn: t("Value in"),
29
+ example: t("Example")
30
+ }
31
+ });
32
+ }, [
33
+ root,
34
+ readOnly,
35
+ writeOnly,
36
+ resolver,
37
+ showExample,
38
+ renderMarkdown,
39
+ t
40
+ ]);
41
+ return /* @__PURE__ */ jsx(SchemaUI, {
42
+ ...client,
43
+ generated
44
+ });
45
+ }
46
+ function generateSchemaUI({ root, resolver, renderMarkdown, readOnly = false, writeOnly = false, showExample = false, labels }) {
47
+ const refs = {};
48
+ function generateInfoTags(schema) {
49
+ const fields = [];
50
+ if (schema.default !== void 0) fields.push({
51
+ label: labels.default,
52
+ value: JSON.stringify(schema.default)
53
+ });
54
+ if (schema.pattern) fields.push({
55
+ label: labels.match,
56
+ value: schema.pattern
57
+ });
58
+ if (schema.format) fields.push({
59
+ label: labels.format,
60
+ value: schema.format
61
+ });
62
+ if (schema.multipleOf) fields.push({
63
+ label: labels.multipleOf,
64
+ value: schema.multipleOf.toString()
65
+ });
66
+ let range = formatRange("value", schema.minimum, schema.exclusiveMinimum, schema.maximum, schema.exclusiveMaximum);
67
+ if (range) fields.push({
68
+ label: labels.range,
69
+ value: range
70
+ });
71
+ range = formatRange("length", schema.minLength, void 0, schema.maxLength, void 0);
72
+ if (range) fields.push({
73
+ label: labels.length,
74
+ value: range
75
+ });
76
+ range = formatRange("properties", schema.minProperties, void 0, schema.maxProperties, void 0);
77
+ if (range) fields.push({
78
+ label: labels.properties,
79
+ value: range
80
+ });
81
+ range = formatRange("items", schema.minItems, void 0, schema.maxItems, void 0);
82
+ if (range) fields.push({
83
+ label: labels.items,
84
+ value: range
85
+ });
86
+ if (schema.enum) fields.push({
87
+ label: labels.valueIn,
88
+ value: schema.enum.map((value) => JSON.stringify(value)).join(" | ")
89
+ });
90
+ if (showExample && schema.examples) for (const example of schema.examples) fields.push({
91
+ label: labels.example,
92
+ value: JSON.stringify(example, null, 2)
93
+ });
94
+ return fields;
95
+ }
96
+ let _counter = 0;
97
+ const autoIds = /* @__PURE__ */ new WeakMap();
98
+ function getSchemaId(schema) {
99
+ if (typeof schema === "boolean") return String(schema);
100
+ const rawRef = resolver(schema).$ref;
101
+ if (rawRef) return rawRef;
102
+ const prev = autoIds.get(schema);
103
+ if (prev) return prev;
104
+ const generated = `__${_counter++}`;
105
+ autoIds.set(schema, generated);
106
+ return generated;
107
+ }
108
+ function isVisible(schema) {
109
+ if (typeof schema === "boolean") return true;
110
+ if (schema.writeOnly) return writeOnly;
111
+ if (schema.readOnly) return readOnly;
112
+ return true;
113
+ }
114
+ function base(schema) {
115
+ if (typeof schema === "boolean") {
116
+ const name = schema ? "any" : "never";
117
+ return {
118
+ typeName: name,
119
+ aliasName: name
120
+ };
121
+ }
122
+ return {
123
+ description: schema.description ? renderMarkdown(schema.description) : void 0,
124
+ infoTags: generateInfoTags(schema),
125
+ typeName: schemaToString(schema, resolver),
126
+ aliasName: schemaToString(schema, resolver, 1),
127
+ deprecated: schema.deprecated
128
+ };
129
+ }
130
+ function scanRefs(id, schema) {
131
+ if (id in refs) return;
132
+ if (typeof schema === "boolean") {
133
+ refs[id] = {
134
+ type: "primitive",
135
+ ...base(schema)
136
+ };
137
+ return;
138
+ }
139
+ if (Array.isArray(schema.type)) {
140
+ const out = {
141
+ type: "or",
142
+ items: [],
143
+ ...base(schema)
144
+ };
145
+ refs[id] = out;
146
+ for (const type of schema.type) {
147
+ const key = `${id}_type:${type}`;
148
+ scanRefs(key, {
149
+ ...schema,
150
+ type
151
+ });
152
+ out.items.push({
153
+ name: type,
154
+ $type: key
155
+ });
156
+ }
157
+ return;
158
+ }
159
+ if (schema.oneOf && schema.anyOf) {
160
+ const out = {
161
+ type: "and",
162
+ items: [],
163
+ ...base(schema)
164
+ };
165
+ refs[id] = out;
166
+ for (const omit of ["anyOf", "oneOf"]) {
167
+ const $type = `${id}_omit:${omit}`;
168
+ scanRefs($type, {
169
+ ...schema,
170
+ [omit]: void 0
171
+ });
172
+ out.items.push({
173
+ name: refs[$type].aliasName,
174
+ $type
175
+ });
176
+ }
177
+ return;
178
+ }
179
+ const union = schema.oneOf ?? schema.anyOf;
180
+ if (union) {
181
+ const out = {
182
+ type: "or",
183
+ items: [],
184
+ ...base(schema)
185
+ };
186
+ refs[id] = out;
187
+ for (const item of union) {
188
+ if (!item || typeof item !== "object" || !isVisible(item)) continue;
189
+ const itemId = getSchemaId(item);
190
+ const key = `${id}_extends:${itemId}`;
191
+ scanRefs(key, {
192
+ ...schema,
193
+ oneOf: void 0,
194
+ anyOf: void 0,
195
+ ...item,
196
+ properties: {
197
+ ...schema.properties,
198
+ ...item.properties
199
+ }
200
+ });
201
+ out.items.push({
202
+ $type: key,
203
+ name: refs[itemId]?.aliasName ?? schemaToString(item, resolver, 1)
204
+ });
205
+ }
206
+ return;
207
+ }
208
+ if (schema.allOf) {
209
+ scanRefs(id, mergeAllOf(schema));
210
+ return;
211
+ }
212
+ if (schema.type === "object") {
213
+ const out = {
214
+ type: "object",
215
+ props: [],
216
+ ...base(schema)
217
+ };
218
+ refs[id] = out;
219
+ const { properties = {}, patternProperties, additionalProperties } = schema;
220
+ const props = Object.entries(properties);
221
+ if (patternProperties) props.push(...Object.entries(patternProperties));
222
+ for (const [key, prop] of props) {
223
+ if (!prop || !isVisible(prop)) continue;
224
+ const $type = getSchemaId(prop);
225
+ scanRefs($type, prop);
226
+ out.props.push({
227
+ $type,
228
+ name: key,
229
+ required: schema.required?.includes(key) ?? false
230
+ });
231
+ }
232
+ if (additionalProperties && isVisible(additionalProperties)) {
233
+ const $type = getSchemaId(additionalProperties);
234
+ scanRefs($type, additionalProperties);
235
+ out.props.push({
236
+ $type,
237
+ name: "[key: string]",
238
+ required: false
239
+ });
240
+ }
241
+ return;
242
+ }
243
+ if (schema.type === "array") {
244
+ const items = schema.items ?? true;
245
+ const $type = getSchemaId(items);
246
+ refs[id] = {
247
+ type: "array",
248
+ item: { $type },
249
+ ...base(schema)
250
+ };
251
+ scanRefs($type, items);
252
+ return;
253
+ }
254
+ refs[id] = {
255
+ type: "primitive",
256
+ ...base(schema)
257
+ };
258
+ }
259
+ const $root = getSchemaId(root);
260
+ scanRefs($root, root);
261
+ return {
262
+ refs,
263
+ $root
264
+ };
265
+ }
266
+ function formatRange(value, min, exclusiveMin, max, exclusiveMax) {
267
+ const out = [];
268
+ if (min !== void 0) out.push(`${min} <=`);
269
+ else if (exclusiveMin !== void 0) out.push(`${exclusiveMin} <`);
270
+ out.push(value);
271
+ if (max !== void 0) out.push(`<= ${max}`);
272
+ else if (exclusiveMax !== void 0) out.push(`< ${exclusiveMax}`);
273
+ if (out.length > 1) return out.join(" ");
274
+ }
275
+ //#endregion
276
+ export { Schema, generateSchemaUI };
@@ -0,0 +1,33 @@
1
+ import { SelectTrigger } from "./select.js";
2
+ import { ComponentProps, ReactNode } from "react";
3
+
4
+ //#region src/components/select-tab.d.ts
5
+ declare function SelectTabs({
6
+ defaultValue,
7
+ children
8
+ }: {
9
+ defaultValue?: string;
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
12
+ declare function SelectTab({
13
+ value,
14
+ anchorSegments,
15
+ ...props
16
+ }: ComponentProps<'div'> & {
17
+ value: string; /** define the tab as an anchor section */
18
+ anchorSegments?: string[];
19
+ }): import("react").JSX.Element | undefined;
20
+ declare function SelectTabTrigger({
21
+ items,
22
+ className,
23
+ placeholder,
24
+ ...props
25
+ }: ComponentProps<typeof SelectTrigger> & {
26
+ placeholder?: ReactNode;
27
+ items: {
28
+ label: ReactNode;
29
+ value: string;
30
+ }[];
31
+ }): import("react").JSX.Element;
32
+ //#endregion
33
+ export { SelectTab, SelectTabTrigger, SelectTabs };
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { anchorIdStartsWith } from "../auto-anchor/index.js";
3
+ import { AnchorSection, useAnchorId } from "../auto-anchor/client.js";
4
+ import { cn } from "../utils/cn.js";
5
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
6
+ import { createContext, use, useEffect, useMemo, useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/select-tab.tsx
9
+ const Context = createContext(null);
10
+ function SelectTabs({ defaultValue, children }) {
11
+ const [value, setValue] = useState(defaultValue ?? null);
12
+ return /* @__PURE__ */ jsx(Context, {
13
+ value: useMemo(() => ({
14
+ value,
15
+ setValue
16
+ }), [value]),
17
+ children
18
+ });
19
+ }
20
+ function SelectTab({ value, anchorSegments, ...props }) {
21
+ const { value: currentValue, setValue } = use(Context);
22
+ const id = useAnchorId(anchorSegments ?? false);
23
+ useEffect(() => {
24
+ if (id && anchorIdStartsWith(window.location.hash.slice(1), id)) setValue(value);
25
+ }, [
26
+ id,
27
+ value,
28
+ setValue
29
+ ]);
30
+ if (value !== currentValue) return;
31
+ const content = /* @__PURE__ */ jsx("div", { ...props });
32
+ return anchorSegments ? /* @__PURE__ */ jsx(AnchorSection, {
33
+ segments: anchorSegments,
34
+ children: content
35
+ }) : content;
36
+ }
37
+ function SelectTabTrigger({ items, className, placeholder, ...props }) {
38
+ const { value, setValue } = use(Context);
39
+ return /* @__PURE__ */ jsxs(Select, {
40
+ value: value ?? "",
41
+ onValueChange: setValue,
42
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
43
+ className: cn("not-prose w-fit min-w-0 *:min-w-0", className),
44
+ ...props,
45
+ children: /* @__PURE__ */ jsx(SelectValue, {
46
+ placeholder,
47
+ children: value && items.find((item) => item.value === value)?.label
48
+ })
49
+ }), /* @__PURE__ */ jsx(SelectContent, { children: items.map(({ label, value }) => /* @__PURE__ */ jsx(SelectItem, {
50
+ value,
51
+ children: label
52
+ }, value)) })]
53
+ });
54
+ }
55
+ //#endregion
56
+ export { SelectTab, SelectTabTrigger, SelectTabs };
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import * as SelectPrimitive from "@radix-ui/react-select";
3
+
4
+ //#region src/components/select.d.ts
5
+ declare const Select: React.FC<SelectPrimitive.SelectProps>;
6
+ declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
7
+ declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
8
+ declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
9
+ declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
+ declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
+ declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ //#endregion
16
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
@@ -0,0 +1,72 @@
1
+ import { cn } from "../utils/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Check, ChevronDown, ChevronUp } from "lucide-react";
5
+ import * as SelectPrimitive from "@radix-ui/react-select";
6
+ //#region src/components/select.tsx
7
+ const Select = SelectPrimitive.Root;
8
+ const SelectGroup = SelectPrimitive.Group;
9
+ const SelectValue = SelectPrimitive.Value;
10
+ const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
11
+ ref,
12
+ className: cn("flex items-center w-full rounded-md border p-2 gap-2 text-start text-sm text-fd-secondary-foreground bg-fd-secondary hover:bg-fd-accent focus:outline-none focus:ring focus:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50 data-placeholder:text-fd-muted-foreground", className),
13
+ ...props,
14
+ children: [children, /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
15
+ asChild: true,
16
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground shrink-0" })
17
+ })]
18
+ }));
19
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
20
+ const SelectScrollUpButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
21
+ ref,
22
+ className: cn("flex items-center justify-center py-1", className),
23
+ ...props,
24
+ children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" })
25
+ }));
26
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
27
+ const SelectScrollDownButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
28
+ ref,
29
+ className: cn("flex items-center justify-center py-1", className),
30
+ ...props,
31
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
32
+ }));
33
+ SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
34
+ const SelectContent = forwardRef(({ className, children, position, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
35
+ ref,
36
+ className: cn("z-50 overflow-hidden rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-md", className),
37
+ position,
38
+ ...props,
39
+ children: [
40
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
41
+ /* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
42
+ className: "p-1",
43
+ children
44
+ }),
45
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
46
+ ]
47
+ }) }));
48
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
49
+ const SelectLabel = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Label, {
50
+ ref,
51
+ className: cn("py-1.5 pe-2 ps-6 text-sm font-semibold", className),
52
+ ...props
53
+ }));
54
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
55
+ const SelectItem = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
56
+ ref,
57
+ className: cn("flex select-none flex-row items-center rounded-md py-1.5 px-2 text-sm outline-none focus:bg-fd-accent focus:text-fd-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
58
+ ...props,
59
+ children: [/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }), /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, {
60
+ className: "ms-auto",
61
+ children: /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-fd-primary" })
62
+ })]
63
+ }));
64
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
65
+ const SelectSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Separator, {
66
+ ref,
67
+ className: cn("my-1 h-px bg-fd-muted", className),
68
+ ...props
69
+ }));
70
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
71
+ //#endregion
72
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
@@ -0,0 +1,7 @@
1
+ //#region src/components/spinner.d.ts
2
+ declare function Spinner({
3
+ className,
4
+ ...props
5
+ }: React.ComponentProps<'svg'>): import("react").JSX.Element;
6
+ //#endregion
7
+ export { Spinner };
@@ -0,0 +1,14 @@
1
+ import { cn } from "../utils/cn.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Loader2Icon } from "lucide-react";
4
+ //#region src/components/spinner.tsx
5
+ function Spinner({ className, ...props }) {
6
+ return /* @__PURE__ */ jsx(Loader2Icon, {
7
+ role: "status",
8
+ "aria-label": "Loading",
9
+ className: cn("size-4 animate-spin", className),
10
+ ...props
11
+ });
12
+ }
13
+ //#endregion
14
+ export { Spinner };
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Translations } from "./.translations/index.js";
2
+ import { TranslationExtension } from "fumadocs-core/i18n";
3
+
4
+ //#region src/i18n.d.ts
5
+ declare function apiDocsTranslations(): TranslationExtension<keyof Translations>;
6
+ //#endregion
7
+ export { type Translations, apiDocsTranslations };
package/dist/i18n.js ADDED
@@ -0,0 +1,7 @@
1
+ import keys_default from "./.translations/keys.js";
2
+ //#region src/i18n.ts
3
+ function apiDocsTranslations() {
4
+ return { keys: keys_default };
5
+ }
6
+ //#endregion
7
+ export { apiDocsTranslations };