fumadocs-openapi 10.10.3 → 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.
- package/css/generated/shared.css +1 -1159
- package/css/preset.css +1 -0
- package/dist/.translations/index.d.ts +80 -0
- package/dist/.translations/keys.js +80 -0
- package/dist/_virtual/_rolldown/runtime.js +1 -10
- package/dist/generate-file.d.ts +0 -4
- package/dist/generate-file.js +4 -5
- package/dist/i18n.d.ts +5 -100
- package/dist/i18n.js +8 -108
- package/dist/index.d.ts +4 -4
- 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
- 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
- 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
- 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
- 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
- package/dist/playground/auth.js +4 -4
- package/dist/playground/client.d.ts +12 -21
- package/dist/playground/client.js +80 -59
- package/dist/playground/components/oauth-dialog.js +33 -33
- package/dist/playground/components/result-display.d.ts +1 -2
- package/dist/playground/components/result-display.js +7 -8
- package/dist/playground/components/server-select.js +11 -11
- package/dist/playground/status-info.js +29 -37
- package/dist/requests/generators/csharp.js +3 -3
- package/dist/requests/generators/curl.js +2 -2
- package/dist/requests/generators/go.js +2 -2
- package/dist/requests/generators/index.d.ts +28 -41
- package/dist/requests/generators/index.js +18 -35
- package/dist/requests/generators/java.js +2 -2
- package/dist/requests/generators/javascript.js +2 -2
- package/dist/requests/generators/python.js +2 -2
- package/dist/scalar/client.js +3 -2
- package/dist/scalar/index.d.ts +2 -2
- package/dist/scalar/index.js +10 -9
- package/dist/server/index.d.ts +23 -27
- package/dist/server/index.js +42 -38
- package/dist/server/proxy.d.ts +0 -6
- package/dist/server/proxy.js +2 -4
- package/dist/{_openapi/types.d.ts → types/openapi.d.ts} +127 -136
- package/dist/types.d.ts +14 -18
- package/dist/ui/base.d.ts +15 -162
- package/dist/ui/base.js +148 -107
- package/dist/ui/components/codeblock.js +6 -14
- package/dist/ui/components/heading.js +8 -4
- package/dist/ui/components/markdown.js +12 -0
- package/dist/ui/contexts/api.js +8 -26
- package/dist/ui/index.d.ts +204 -7
- package/dist/ui/index.js +10 -15
- package/dist/ui/operation/context.js +48 -0
- package/dist/ui/operation/index.js +168 -126
- package/dist/ui/operation/request-tabs.d.ts +10 -5
- package/dist/ui/operation/request-tabs.js +35 -22
- package/dist/ui/operation/response-tabs.d.ts +5 -2
- package/dist/ui/operation/response-tabs.js +22 -15
- package/dist/ui/operation/usage-tabs.js +144 -0
- package/dist/utils/document/dereference.d.ts +1 -1
- package/dist/utils/document/dereference.js +5 -8
- package/dist/utils/document/load.js +17 -0
- package/dist/utils/get-example-requests.d.ts +13 -0
- package/dist/{ui/operation → utils}/get-example-requests.js +31 -20
- package/dist/utils/pages/builder.d.ts +38 -10
- package/dist/utils/pages/builder.js +12 -10
- package/dist/utils/pages/preset-auto.d.ts +1 -2
- package/dist/utils/pages/preset-auto.js +15 -15
- package/dist/utils/pages/to-static-data.js +5 -4
- package/dist/utils/pages/to-text.d.ts +1 -0
- package/dist/utils/pages/to-text.js +21 -11
- package/dist/utils/remove-undefined.js +14 -9
- package/dist/utils/schema.d.ts +2 -0
- package/dist/utils/{schema/index.js → schema.js} +3 -30
- package/dist/{ui/client → utils}/storage-key.js +3 -3
- package/package.json +15 -28
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +0 -108
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +0 -110
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +0 -138
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +0 -674
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +0 -141
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +0 -102
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +0 -223
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +0 -28
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +0 -18
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +0 -133
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +0 -61
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +0 -146
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +0 -23
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -48
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +0 -172
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +0 -31
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +0 -433
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +0 -113
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +0 -72
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +0 -583
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +0 -18
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +0 -42
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +0 -50
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +0 -20
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +0 -51
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +0 -36
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +0 -19
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +0 -85
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +0 -59
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +0 -12
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +0 -25
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +0 -12
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -57
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -96
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -29
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -89
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -87
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +0 -16
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -62
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -60
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -59
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -34
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -31
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -51
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -61
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -17
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -52
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -41
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -17
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +0 -130
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +0 -14
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +0 -22
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +0 -112
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -101
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -14
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +0 -35
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +0 -46
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +0 -45
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +0 -22
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +0 -20
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +0 -15
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +0 -10
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +0 -23
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +0 -19
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +0 -13
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +0 -46
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +0 -59
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +0 -27
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +0 -17
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -49
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +0 -48
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +0 -18
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -28
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -33
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -47
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -28
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -27
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -38
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +0 -72
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -70
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +0 -33
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +0 -236
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +0 -187
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +0 -282
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +0 -78
- package/dist/playground/components/inputs.js +0 -419
- package/dist/playground/components/spinner.js +0 -15
- package/dist/playground/schema.d.ts +0 -15
- package/dist/playground/schema.js +0 -144
- package/dist/ui/api-page.d.ts +0 -31
- package/dist/ui/api-page.js +0 -59
- package/dist/ui/client/boundary.d.ts +0 -11
- package/dist/ui/client/boundary.js +0 -17
- package/dist/ui/client/boundary.lazy.js +0 -19
- package/dist/ui/client/full.js +0 -13
- package/dist/ui/client/i18n.js +0 -16
- package/dist/ui/client/index.d.ts +0 -42
- package/dist/ui/client/index.js +0 -7
- package/dist/ui/components/accordion.js +0 -67
- package/dist/ui/components/codeblock.d.ts +0 -14
- package/dist/ui/components/dialog.js +0 -56
- package/dist/ui/components/input.js +0 -17
- package/dist/ui/components/select-tab.js +0 -56
- package/dist/ui/components/select.js +0 -71
- package/dist/ui/contexts/api.d.ts +0 -29
- package/dist/ui/create-client.d.ts +0 -26
- package/dist/ui/create-client.js +0 -125
- package/dist/ui/operation/client.js +0 -78
- package/dist/ui/operation/get-example-requests.d.ts +0 -11
- package/dist/ui/operation/usage-tabs/client.d.ts +0 -14
- package/dist/ui/operation/usage-tabs/client.js +0 -91
- package/dist/ui/operation/usage-tabs/index.js +0 -54
- package/dist/ui/schema/client.d.ts +0 -18
- package/dist/ui/schema/client.js +0 -410
- package/dist/ui/schema/index.d.ts +0 -61
- package/dist/ui/schema/index.js +0 -256
- package/dist/utils/auto-anchor.client.js +0 -20
- package/dist/utils/auto-anchor.js +0 -17
- package/dist/utils/deep-equal.js +0 -21
- package/dist/utils/document/process.d.ts +0 -6
- package/dist/utils/document/process.js +0 -18
- package/dist/utils/id-to-title.js +0 -12
- package/dist/utils/is-plain-object.js +0 -8
- package/dist/utils/merge-refs.js +0 -11
- package/dist/utils/schema/dereference.js +0 -45
- package/dist/utils/schema/index.d.ts +0 -18
- package/dist/utils/schema/merge.js +0 -156
- package/dist/utils/schema/pick.js +0 -44
- package/dist/utils/schema/ref.js +0 -35
- package/dist/utils/schema/resolve-ref.js +0 -11
- package/dist/utils/schema/sample.js +0 -442
- package/dist/utils/schema/to-string.d.ts +0 -1
- package/dist/utils/schema/to-string.js +0 -53
- package/dist/utils/url.js +0 -39
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { ApiProvider, ServerProvider } from "../contexts/api.js";
|
|
4
|
-
import PlaygroundClient from "../../playground/client.js";
|
|
5
|
-
import { UsageTab, UsageTabsSelector } from "../operation/usage-tabs/client.js";
|
|
6
|
-
import { SchemaUI } from "../schema/client.js";
|
|
7
|
-
//#region src/ui/client/boundary.tsx
|
|
8
|
-
var boundary_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
-
ApiProvider: () => ApiProvider,
|
|
10
|
-
PlaygroundClient: () => PlaygroundClient,
|
|
11
|
-
SchemaUI: () => SchemaUI,
|
|
12
|
-
ServerProvider: () => ServerProvider,
|
|
13
|
-
UsageTab: () => UsageTab,
|
|
14
|
-
UsageTabsSelector: () => UsageTabsSelector
|
|
15
|
-
});
|
|
16
|
-
//#endregion
|
|
17
|
-
export { boundary_exports };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { lazy } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
//#region src/ui/client/boundary.lazy.tsx
|
|
5
|
-
const ApiProvider = wrapLazy(() => import("../contexts/api.js").then((mod) => ({ default: mod.ApiProvider })));
|
|
6
|
-
const ServerProvider = wrapLazy(() => import("../contexts/api.js").then((mod) => ({ default: mod.ServerProvider })));
|
|
7
|
-
const UsageTabsSelector = wrapLazy(() => import("../operation/usage-tabs/client.js").then((mod) => ({ default: mod.UsageTabsSelector })));
|
|
8
|
-
const UsageTab = wrapLazy(() => import("../operation/usage-tabs/client.js").then((mod) => ({ default: mod.UsageTab })));
|
|
9
|
-
const SchemaUI = wrapLazy(() => import("../schema/client.js").then((mod) => ({ default: mod.SchemaUI })));
|
|
10
|
-
const PlaygroundClient = wrapLazy(() => import("../../playground/client.js"));
|
|
11
|
-
const PlaygroundAuthProvider = wrapLazy(() => import("../../playground/auth.js").then((mod) => ({ default: mod.AuthProvider })));
|
|
12
|
-
function wrapLazy(load) {
|
|
13
|
-
const V = lazy(load);
|
|
14
|
-
return function wrapper(props) {
|
|
15
|
-
return /* @__PURE__ */ jsx(V, { ...props });
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { ApiProvider, PlaygroundAuthProvider, PlaygroundClient, SchemaUI, ServerProvider, UsageTab, UsageTabsSelector };
|
package/dist/ui/client/full.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ClientCodeBlockProvider } from "../components/codeblock.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { defaultShikiFactory } from "fumadocs-core/highlight/shiki/full";
|
|
5
|
-
//#region src/ui/client/full.tsx
|
|
6
|
-
function FullProvider({ children }) {
|
|
7
|
-
return /* @__PURE__ */ jsx(ClientCodeBlockProvider, {
|
|
8
|
-
factory: defaultShikiFactory,
|
|
9
|
-
children
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { FullProvider };
|
package/dist/ui/client/i18n.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { defaultTranslations } from "../../i18n.js";
|
|
3
|
-
import { renderTranslation } from "fumadocs-core/i18n";
|
|
4
|
-
import { useTranslations } from "fumadocs-ui/contexts/i18n";
|
|
5
|
-
//#region src/ui/client/i18n.ts
|
|
6
|
-
function useTranslations$1() {
|
|
7
|
-
return useTranslations("openapi") ?? defaultTranslations;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Renders a translated string. Use in server components so the label is resolved on the client from the current locale.
|
|
11
|
-
*/
|
|
12
|
-
function I18nLabel({ label, replacements }) {
|
|
13
|
-
return renderTranslation(useTranslations$1()[label], replacements);
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { I18nLabel, useTranslations$1 as useTranslations };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { MediaAdapter } from "../../requests/media/adapter.js";
|
|
2
|
-
import { PlaygroundClientOptions } from "../../playground/client.js";
|
|
3
|
-
import { CodeUsageGeneratorRegistry } from "../../requests/generators/index.js";
|
|
4
|
-
import { ExampleRequestItem } from "../operation/get-example-requests.js";
|
|
5
|
-
import { ComponentProps, FC } from "react";
|
|
6
|
-
|
|
7
|
-
//#region src/ui/client/index.d.ts
|
|
8
|
-
interface APIPageClientOptions {
|
|
9
|
-
playground?: PlaygroundClientOptions;
|
|
10
|
-
operation?: {
|
|
11
|
-
APIExampleSelector?: FC<{
|
|
12
|
-
items: ExampleRequestItem[];
|
|
13
|
-
value: string | undefined;
|
|
14
|
-
onValueChange: (id: string) => void;
|
|
15
|
-
}>;
|
|
16
|
-
};
|
|
17
|
-
components?: {
|
|
18
|
-
Heading?: FC<ComponentProps<'h1'> & {
|
|
19
|
-
id: string;
|
|
20
|
-
depth: number;
|
|
21
|
-
}>;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Set a prefix for `localStorage` keys.
|
|
25
|
-
*
|
|
26
|
-
* Useful when using multiple OpenAPI instances to prevent state conflicts.
|
|
27
|
-
*
|
|
28
|
-
* @defaultValue `fumadocs-openapi-`
|
|
29
|
-
*/
|
|
30
|
-
storageKeyPrefix?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Support other media types (for client-side serialization)
|
|
33
|
-
*/
|
|
34
|
-
mediaAdapters?: Record<string, MediaAdapter>;
|
|
35
|
-
/**
|
|
36
|
-
* generate code usage examples
|
|
37
|
-
*/
|
|
38
|
-
codeUsages?: CodeUsageGeneratorRegistry;
|
|
39
|
-
}
|
|
40
|
-
declare function defineClientConfig(options?: APIPageClientOptions): APIPageClientOptions;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { APIPageClientOptions, defineClientConfig };
|
package/dist/ui/client/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { anchorIdStartsWith } from "../../utils/auto-anchor.js";
|
|
4
|
-
import { AnchorSection, useAnchorId } from "../../utils/auto-anchor.client.js";
|
|
5
|
-
import { createContext, use, useEffect, useMemo, useState } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { ChevronRight } from "lucide-react";
|
|
8
|
-
import * as Primitive from "@radix-ui/react-accordion";
|
|
9
|
-
//#region src/ui/components/accordion.tsx
|
|
10
|
-
const Context = createContext(null);
|
|
11
|
-
function Accordions({ type, defaultValue, ...props }) {
|
|
12
|
-
const [value, setValue] = useState(() => type === "multiple" ? defaultValue ?? [] : defaultValue ?? "");
|
|
13
|
-
return /* @__PURE__ */ jsx(Context, {
|
|
14
|
-
value: useMemo(() => ({
|
|
15
|
-
type,
|
|
16
|
-
setValue
|
|
17
|
-
}), [type]),
|
|
18
|
-
children: /* @__PURE__ */ jsx(Primitive.Root, {
|
|
19
|
-
type,
|
|
20
|
-
value,
|
|
21
|
-
onValueChange: setValue,
|
|
22
|
-
...props
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function AccordionItem({ value, className, anchorSegments, ...props }) {
|
|
27
|
-
const ctx = use(Context);
|
|
28
|
-
const id = useAnchorId(anchorSegments ?? false);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (id && anchorIdStartsWith(window.location.hash.slice(1), id)) ctx.setValue(ctx.type === "single" ? value : [value]);
|
|
31
|
-
}, [
|
|
32
|
-
value,
|
|
33
|
-
id,
|
|
34
|
-
ctx
|
|
35
|
-
]);
|
|
36
|
-
const content = /* @__PURE__ */ jsx(Primitive.Item, {
|
|
37
|
-
value,
|
|
38
|
-
className: cn("scroll-m-20 border-b last:border-b-0", className),
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
return anchorSegments ? /* @__PURE__ */ jsx(AnchorSection, {
|
|
42
|
-
segments: anchorSegments,
|
|
43
|
-
children: content
|
|
44
|
-
}) : content;
|
|
45
|
-
}
|
|
46
|
-
function AccordionContent(props) {
|
|
47
|
-
return /* @__PURE__ */ jsx(Primitive.Content, {
|
|
48
|
-
...props,
|
|
49
|
-
className: cn("overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down", props.className)
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function AccordionHeader(props) {
|
|
53
|
-
return /* @__PURE__ */ jsx(Primitive.Header, {
|
|
54
|
-
...props,
|
|
55
|
-
className: cn("not-prose flex py-2 text-fd-foreground font-medium", props.className),
|
|
56
|
-
children: props.children
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function AccordionTrigger(props) {
|
|
60
|
-
return /* @__PURE__ */ jsxs(Primitive.Trigger, {
|
|
61
|
-
...props,
|
|
62
|
-
className: cn("flex flex-1 items-center gap-1 text-start group/accordion focus-visible:outline-none", props.className),
|
|
63
|
-
children: [/* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 text-fd-muted-foreground shrink-0 transition-transform group-focus-visible/accordion:text-fd-primary group-data-[state=open]/accordion:rotate-90" }), props.children]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
export { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
-
import { ShikiFactory } from "fumadocs-core/highlight/shiki";
|
|
4
|
-
|
|
5
|
-
//#region src/ui/components/codeblock.d.ts
|
|
6
|
-
declare function ClientCodeBlockProvider({
|
|
7
|
-
factory,
|
|
8
|
-
children
|
|
9
|
-
}: {
|
|
10
|
-
factory: ShikiFactory;
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
}): _$react_jsx_runtime0.JSX.Element;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { ClientCodeBlockProvider };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useTranslations } from "../client/i18n.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { X } from "lucide-react";
|
|
6
|
-
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
7
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
8
|
-
//#region src/ui/components/dialog.tsx
|
|
9
|
-
const Dialog = DialogPrimitive.Root;
|
|
10
|
-
const DialogTrigger = DialogPrimitive.Trigger;
|
|
11
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
12
|
-
function DialogOverlay({ className, ref, ...props }) {
|
|
13
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
14
|
-
ref,
|
|
15
|
-
className: cn("fixed inset-0 z-50 bg-black/30 backdrop-blur-sm data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", className),
|
|
16
|
-
...props
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function DialogContent({ className, children, ref, ...props }) {
|
|
20
|
-
const t = useTranslations();
|
|
21
|
-
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
22
|
-
ref,
|
|
23
|
-
className: cn("fixed left-1/2 top-1/2 z-50 flex flex-col gap-4 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border bg-fd-popover p-4 shadow-lg rounded-xl duration-200 data-[state=open]:animate-fd-dialog-in data-[state=closed]:animate-fd-dialog-out focus-visible:outline-none", className),
|
|
24
|
-
...props,
|
|
25
|
-
children: [children, /* @__PURE__ */ jsx(DialogPrimitive.Close, {
|
|
26
|
-
"aria-label": t.close,
|
|
27
|
-
className: cn(buttonVariants({
|
|
28
|
-
size: "icon-sm",
|
|
29
|
-
color: "ghost"
|
|
30
|
-
}), "absolute end-2 top-2 text-fd-muted-foreground/70"),
|
|
31
|
-
children: /* @__PURE__ */ jsx(X, {})
|
|
32
|
-
})]
|
|
33
|
-
})] });
|
|
34
|
-
}
|
|
35
|
-
function DialogHeader({ className, ...props }) {
|
|
36
|
-
return /* @__PURE__ */ jsx("div", {
|
|
37
|
-
className: cn("flex flex-col gap-1.5 text-center sm:text-start", className),
|
|
38
|
-
...props
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function DialogTitle({ className, ref, ...props }) {
|
|
42
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
43
|
-
ref,
|
|
44
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
45
|
-
...props
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function DialogDescription({ className, ref, ...props }) {
|
|
49
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
50
|
-
ref,
|
|
51
|
-
className: cn("text-sm text-fd-muted-foreground", className),
|
|
52
|
-
...props
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
export { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { cn } from "../../utils/cn.js";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { cva } from "class-variance-authority";
|
|
5
|
-
//#region src/ui/components/input.tsx
|
|
6
|
-
const labelVariants = cva("text-xs font-medium text-fd-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
7
|
-
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
8
|
-
return /* @__PURE__ */ jsx("input", {
|
|
9
|
-
type,
|
|
10
|
-
className: cn("flex h-9 w-full rounded-md border bg-fd-secondary px-2 py-1.5 text-[0.8125rem] text-fd-secondary-foreground transition-colors placeholder:text-fd-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
11
|
-
ref,
|
|
12
|
-
...props
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
Input.displayName = "Input";
|
|
16
|
-
//#endregion
|
|
17
|
-
export { Input, labelVariants };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
4
|
-
import { anchorIdStartsWith } from "../../utils/auto-anchor.js";
|
|
5
|
-
import { AnchorSection, useAnchorId } from "../../utils/auto-anchor.client.js";
|
|
6
|
-
import { createContext, use, useEffect, useMemo, useState } from "react";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
//#region src/ui/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 };
|
|
@@ -1,71 +0,0 @@
|
|
|
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/ui/components/select.tsx
|
|
7
|
-
const Select = SelectPrimitive.Root;
|
|
8
|
-
const SelectValue = SelectPrimitive.Value;
|
|
9
|
-
const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
|
|
10
|
-
ref,
|
|
11
|
-
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),
|
|
12
|
-
...props,
|
|
13
|
-
children: [children, /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
|
|
14
|
-
asChild: true,
|
|
15
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground shrink-0" })
|
|
16
|
-
})]
|
|
17
|
-
}));
|
|
18
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
19
|
-
const SelectScrollUpButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
|
|
20
|
-
ref,
|
|
21
|
-
className: cn("flex items-center justify-center py-1", className),
|
|
22
|
-
...props,
|
|
23
|
-
children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" })
|
|
24
|
-
}));
|
|
25
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
26
|
-
const SelectScrollDownButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
|
|
27
|
-
ref,
|
|
28
|
-
className: cn("flex items-center justify-center py-1", className),
|
|
29
|
-
...props,
|
|
30
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
|
|
31
|
-
}));
|
|
32
|
-
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
33
|
-
const SelectContent = forwardRef(({ className, children, position, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
|
|
34
|
-
ref,
|
|
35
|
-
className: cn("z-50 overflow-hidden rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-md", className),
|
|
36
|
-
position,
|
|
37
|
-
...props,
|
|
38
|
-
children: [
|
|
39
|
-
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
40
|
-
/* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
|
|
41
|
-
className: "p-1",
|
|
42
|
-
children
|
|
43
|
-
}),
|
|
44
|
-
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
45
|
-
]
|
|
46
|
-
}) }));
|
|
47
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
48
|
-
const SelectLabel = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Label, {
|
|
49
|
-
ref,
|
|
50
|
-
className: cn("py-1.5 pe-2 ps-6 text-sm font-semibold", className),
|
|
51
|
-
...props
|
|
52
|
-
}));
|
|
53
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
54
|
-
const SelectItem = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
55
|
-
ref,
|
|
56
|
-
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),
|
|
57
|
-
...props,
|
|
58
|
-
children: [/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }), /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, {
|
|
59
|
-
className: "ms-auto",
|
|
60
|
-
children: /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-fd-primary" })
|
|
61
|
-
})]
|
|
62
|
-
}));
|
|
63
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
64
|
-
const SelectSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Separator, {
|
|
65
|
-
ref,
|
|
66
|
-
className: cn("my-1 h-px bg-fd-muted", className),
|
|
67
|
-
...props
|
|
68
|
-
}));
|
|
69
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
70
|
-
//#endregion
|
|
71
|
-
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { APIPageClientOptions } from "../client/index.js";
|
|
2
|
-
import { RenderContext, SecuritySchemeObject, ServerObject } from "../../types.js";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
//#region src/ui/contexts/api.d.ts
|
|
7
|
-
interface InheritFromContext extends Pick<RenderContext, 'shikiOptions'> {
|
|
8
|
-
client: APIPageClientOptions;
|
|
9
|
-
}
|
|
10
|
-
interface ApiProviderProps extends InheritFromContext {
|
|
11
|
-
schemes: Record<string, SecuritySchemeObject>;
|
|
12
|
-
}
|
|
13
|
-
declare function ApiProvider({
|
|
14
|
-
children,
|
|
15
|
-
shikiOptions,
|
|
16
|
-
client,
|
|
17
|
-
schemes
|
|
18
|
-
}: ApiProviderProps & {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
}): _$react_jsx_runtime0.JSX.Element;
|
|
21
|
-
declare function ServerProvider({
|
|
22
|
-
servers,
|
|
23
|
-
children
|
|
24
|
-
}: {
|
|
25
|
-
servers?: ServerObject[];
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
}): _$react_jsx_runtime0.JSX.Element;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { ApiProvider, ServerProvider };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { APIPageClientOptions } from "./client/index.js";
|
|
2
|
-
import { ApiPageProps } from "./api-page.js";
|
|
3
|
-
import { CreateAPIPageOptions } from "./base.js";
|
|
4
|
-
import { Document } from "../types.js";
|
|
5
|
-
import { FC } from "react";
|
|
6
|
-
|
|
7
|
-
//#region src/ui/create-client.d.ts
|
|
8
|
-
interface ClientApiPageProps extends Omit<ApiPageProps, 'document'> {
|
|
9
|
-
payload: ClientApiPagePayload;
|
|
10
|
-
}
|
|
11
|
-
interface ClientApiPagePayload {
|
|
12
|
-
bundled: Document;
|
|
13
|
-
proxyUrl?: string;
|
|
14
|
-
}
|
|
15
|
-
type CreateClientAPIPageOptions = Partial<Omit<CreateAPIPageOptions, 'generateTypeScriptSchema' | 'client'> & Omit<APIPageClientOptions, 'mediaAdapters' | 'codeUsages'>>;
|
|
16
|
-
/**
|
|
17
|
-
* Create `<APIPage />` for non-RSC environment, note that this may be unstable, and doesn't support the full set of features.
|
|
18
|
-
*/
|
|
19
|
-
declare function createClientAPIPage({
|
|
20
|
-
shiki,
|
|
21
|
-
shikiOptions,
|
|
22
|
-
generateTypeScriptDefinitions,
|
|
23
|
-
...options
|
|
24
|
-
}?: CreateClientAPIPageOptions): FC<ClientApiPageProps>;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { ClientApiPagePayload, ClientApiPageProps, CreateClientAPIPageOptions, createClientAPIPage };
|
package/dist/ui/create-client.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { parseSecurities } from "../utils/schema/index.js";
|
|
3
|
-
import { defaultAdapters } from "../requests/media/adapter.js";
|
|
4
|
-
import { createCodeUsageGeneratorRegistry } from "../requests/generators/index.js";
|
|
5
|
-
import { registerDefault } from "../requests/generators/all.js";
|
|
6
|
-
import { ClientCodeBlock, ClientCodeBlockProvider } from "./components/codeblock.js";
|
|
7
|
-
import { AuthProvider } from "../playground/auth.js";
|
|
8
|
-
import { dereferenceDocument } from "../utils/document/dereference.js";
|
|
9
|
-
import { APIPage } from "./api-page.js";
|
|
10
|
-
import { boundary_exports } from "./client/boundary.js";
|
|
11
|
-
import { Children, useMemo } from "react";
|
|
12
|
-
import * as JsxRuntime from "react/jsx-runtime";
|
|
13
|
-
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
import { remarkGfm } from "fumadocs-core/mdx-plugins/remark-gfm";
|
|
15
|
-
import defaultMdxComponents from "fumadocs-ui/mdx";
|
|
16
|
-
import { remark } from "remark";
|
|
17
|
-
import remarkRehype from "remark-rehype";
|
|
18
|
-
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
19
|
-
import { compile } from "@fumari/json-schema-ts";
|
|
20
|
-
import { defaultShikiFactory } from "fumadocs-core/highlight/shiki/full";
|
|
21
|
-
//#region src/ui/create-client.tsx
|
|
22
|
-
/**
|
|
23
|
-
* Create `<APIPage />` for non-RSC environment, note that this may be unstable, and doesn't support the full set of features.
|
|
24
|
-
*/
|
|
25
|
-
function createClientAPIPage({ shiki = defaultShikiFactory, shikiOptions = { themes: {
|
|
26
|
-
light: "github-light",
|
|
27
|
-
dark: "github-dark"
|
|
28
|
-
} }, generateTypeScriptDefinitions = (schema, ctx) => {
|
|
29
|
-
if (typeof schema !== "object") return;
|
|
30
|
-
try {
|
|
31
|
-
return compile(schema, {
|
|
32
|
-
name: "Response",
|
|
33
|
-
readOnly: ctx.readOnly,
|
|
34
|
-
writeOnly: ctx.writeOnly,
|
|
35
|
-
getSchemaId: ctx.schema.getRawRef
|
|
36
|
-
});
|
|
37
|
-
} catch (e) {
|
|
38
|
-
console.warn("Failed to generate typescript schema:", e);
|
|
39
|
-
}
|
|
40
|
-
}, ...options } = {}) {
|
|
41
|
-
let processor;
|
|
42
|
-
const mdxComponents = {
|
|
43
|
-
...defaultMdxComponents,
|
|
44
|
-
img: void 0,
|
|
45
|
-
pre: MarkdownPre
|
|
46
|
-
};
|
|
47
|
-
function createMarkdownProcessor() {
|
|
48
|
-
function rehypeReact() {
|
|
49
|
-
this.compiler = (tree, file) => {
|
|
50
|
-
return toJsxRuntime(tree, {
|
|
51
|
-
development: false,
|
|
52
|
-
filePath: file.path,
|
|
53
|
-
...JsxRuntime,
|
|
54
|
-
components: mdxComponents
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return remark().use(remarkGfm).use(remarkRehype).use(rehypeReact);
|
|
59
|
-
}
|
|
60
|
-
function renderPlaygroundDefault({ method, path, ctx }) {
|
|
61
|
-
return /* @__PURE__ */ jsx(ctx.clientBoundary.PlaygroundClient, {
|
|
62
|
-
route: path,
|
|
63
|
-
securities: parseSecurities(method, ctx.schema.dereferenced),
|
|
64
|
-
method: method.method,
|
|
65
|
-
doc: ctx.schema.bundled,
|
|
66
|
-
proxyUrl: ctx.proxyUrl,
|
|
67
|
-
writeOnly: true,
|
|
68
|
-
readOnly: false,
|
|
69
|
-
deprecated: method.deprecated
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function renderPlaygroundProviderDefault({ children }) {
|
|
73
|
-
return /* @__PURE__ */ jsx(AuthProvider, { children });
|
|
74
|
-
}
|
|
75
|
-
return function ClientAPIPage({ payload, ...props }) {
|
|
76
|
-
const processed = useMemo(() => dereferenceDocument(payload.bundled), [payload.bundled]);
|
|
77
|
-
const ctx = useMemo(() => ({
|
|
78
|
-
schema: processed,
|
|
79
|
-
proxyUrl: payload.proxyUrl,
|
|
80
|
-
shiki,
|
|
81
|
-
shikiOptions,
|
|
82
|
-
generateTypeScriptDefinitions,
|
|
83
|
-
clientBoundary: boundary_exports,
|
|
84
|
-
client: options,
|
|
85
|
-
...options,
|
|
86
|
-
codeUsages: options.codeUsages ?? registerDefault(createCodeUsageGeneratorRegistry()),
|
|
87
|
-
mediaAdapters: {
|
|
88
|
-
...defaultAdapters,
|
|
89
|
-
...options.mediaAdapters
|
|
90
|
-
},
|
|
91
|
-
playground: {
|
|
92
|
-
...options.playground,
|
|
93
|
-
provider: options.playground?.provider ?? renderPlaygroundProviderDefault,
|
|
94
|
-
render: options.playground?.render ?? renderPlaygroundDefault
|
|
95
|
-
},
|
|
96
|
-
renderMarkdown(text) {
|
|
97
|
-
if (options.renderMarkdown) return options.renderMarkdown(text);
|
|
98
|
-
processor ??= createMarkdownProcessor();
|
|
99
|
-
return processor.processSync({ value: text }).result;
|
|
100
|
-
},
|
|
101
|
-
renderCodeBlock(props) {
|
|
102
|
-
if (options.renderCodeBlock) return options.renderCodeBlock(props);
|
|
103
|
-
return /* @__PURE__ */ jsx(ClientCodeBlock, { ...props });
|
|
104
|
-
}
|
|
105
|
-
}), [payload.proxyUrl, processed]);
|
|
106
|
-
return /* @__PURE__ */ jsx(ClientCodeBlockProvider, {
|
|
107
|
-
factory: shiki,
|
|
108
|
-
children: /* @__PURE__ */ jsx(APIPage, {
|
|
109
|
-
...props,
|
|
110
|
-
ctx
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function MarkdownPre(props) {
|
|
116
|
-
const codeProps = Children.only(props.children).props;
|
|
117
|
-
const content = codeProps.children;
|
|
118
|
-
if (typeof content !== "string") return null;
|
|
119
|
-
return /* @__PURE__ */ jsx(ClientCodeBlock, {
|
|
120
|
-
lang: codeProps.className?.split(" ").find((v) => v.startsWith("language-"))?.slice(9) ?? "text",
|
|
121
|
-
code: content.trimEnd()
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
export { createClientAPIPage };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useTranslations } from "../client/i18n.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { createContext, use, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Check, Copy } from "lucide-react";
|
|
7
|
-
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
8
|
-
import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
9
|
-
//#region src/ui/operation/client.tsx
|
|
10
|
-
const OperationContext = createContext(null);
|
|
11
|
-
function OperationProvider({ route, examples, defaultExampleId, children }) {
|
|
12
|
-
const [example, setExample] = useState(() => defaultExampleId ?? examples.at(0)?.id);
|
|
13
|
-
const listeners = useRef([]);
|
|
14
|
-
return /* @__PURE__ */ jsx(OperationContext, {
|
|
15
|
-
value: useMemo(() => ({
|
|
16
|
-
example,
|
|
17
|
-
route,
|
|
18
|
-
setExample(newKey) {
|
|
19
|
-
const example = examples.find((example) => example.id === newKey);
|
|
20
|
-
if (!example) return;
|
|
21
|
-
setExample(newKey);
|
|
22
|
-
for (const listener of listeners.current) listener(example.data, example.encoded);
|
|
23
|
-
},
|
|
24
|
-
examples,
|
|
25
|
-
setExampleData(data, encoded) {
|
|
26
|
-
for (const item of examples) if (item.id === example) {
|
|
27
|
-
item.data = data;
|
|
28
|
-
item.encoded = encoded;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
for (const listener of listeners.current) listener(data, encoded);
|
|
32
|
-
},
|
|
33
|
-
removeListener(listener) {
|
|
34
|
-
listeners.current = listeners.current.filter((item) => item !== listener);
|
|
35
|
-
},
|
|
36
|
-
addListener(listener) {
|
|
37
|
-
const active = examples.find((item) => item.id === example);
|
|
38
|
-
listener(active.data, active.encoded);
|
|
39
|
-
listeners.current.push(listener);
|
|
40
|
-
}
|
|
41
|
-
}), [
|
|
42
|
-
example,
|
|
43
|
-
route,
|
|
44
|
-
examples
|
|
45
|
-
]),
|
|
46
|
-
children
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function useOperationContext() {
|
|
50
|
-
return use(OperationContext);
|
|
51
|
-
}
|
|
52
|
-
function CopyTypeScriptPanel({ name, code, className }) {
|
|
53
|
-
const [isChecked, onCopy] = useCopyButton(() => {
|
|
54
|
-
navigator.clipboard.writeText(code);
|
|
55
|
-
});
|
|
56
|
-
const t = useTranslations();
|
|
57
|
-
const useTypeText = t.useTypeInTypeScript.replace("{name}", name);
|
|
58
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
-
className: cn("flex items-start justify-between gap-2 bg-fd-card text-fd-card-foreground border rounded-xl p-3 not-prose", className),
|
|
60
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
61
|
-
className: "font-medium text-sm mb-2",
|
|
62
|
-
children: t.typeScriptDefinitions
|
|
63
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
64
|
-
className: "text-xs text-fd-muted-foreground",
|
|
65
|
-
children: useTypeText
|
|
66
|
-
})] }), /* @__PURE__ */ jsxs("button", {
|
|
67
|
-
onClick: onCopy,
|
|
68
|
-
className: cn(buttonVariants({
|
|
69
|
-
color: "secondary",
|
|
70
|
-
className: "p-2 gap-2",
|
|
71
|
-
size: "sm"
|
|
72
|
-
})),
|
|
73
|
-
children: [isChecked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" }), t.copy]
|
|
74
|
-
})]
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { CopyTypeScriptPanel, OperationProvider, useOperationContext };
|