@redocly/openapi-docs 3.24.0-next.9 → 3.24.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.
- package/dist/{redocly-openapi-docs.min.AiChatProvider-DcsGB2gP.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +3 -3
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-wCZA4usG.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-jo7fqtSt.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +116 -116
- package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +1 -0
- package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
- package/dist/redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js +1 -0
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-B_f6WR8o.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
- package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js +1 -0
- package/dist/redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js +1 -0
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js +1 -0
- package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
- package/dist/redocly-openapi-docs.min.external-resolver-BkceRyB4.js +2 -0
- package/dist/redocly-openapi-docs.min.index-BCcol5vU.js +1 -0
- package/dist/redocly-openapi-docs.min.index-C6uU_v-b.js +1 -0
- package/dist/redocly-openapi-docs.min.index-CmXZfuiZ.js +7730 -0
- package/dist/redocly-openapi-docs.min.index-DVWw0ICA.js +1 -0
- package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
- package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-C-zlwxhp.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +69 -69
- package/dist/{redocly-openapi-docs.min.lint-graphql-qEh9cZHx.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
- package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
- package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
- package/dist/{redocly-openapi-docs.min.respect-run-hfNPYQ9x.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
- package/dist/redocly-openapi-docs.min.standalone-BPCdJgtH.js +11995 -0
- package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +1 -0
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-DgSsCKMW.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +80 -80
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
- package/lib/components/Callbacks/CallbackOperation.js +1 -1
- package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
- package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
- package/lib/components/Content/useAutoScroll.js +1 -1
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
- package/lib/components/ContentItem/useIsExpanded.js +1 -1
- package/lib/components/ContentItems/ContentItems.js +1 -1
- package/lib/components/ContentItems/VirtualList.js +1 -1
- package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
- package/lib/components/ContentItems/useScrollOnRender.js +1 -1
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
- package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
- package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
- package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
- package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
- package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
- package/lib/components/Overview/__tests__/Overview.test.js +59 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
- package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
- package/lib/components/Replay/__tests__/utils.test.js +526 -0
- package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
- package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
- package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
- package/lib/components/Responses/OperationResponseList.js +1 -1
- package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
- package/lib/components/Schema/Schema.js +1 -1
- package/lib/components/Schema/SubSchema.js +1 -1
- package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
- package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/Schema.test.js +67 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
- package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
- package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
- package/lib/components/Security/__tests__/Security.test.js +38 -0
- package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
- package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
- package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
- package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
- package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
- package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
- package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
- package/lib/components/TagItem/OperationsNavigation.js +1 -1
- package/lib/components/TagItem/TagItem.js +1 -1
- package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
- package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
- package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
- package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
- package/lib/components/__tests__/common/ClearButton.test.js +18 -0
- package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
- package/lib/components/__tests__/common/Dropdown.test.js +52 -0
- package/lib/components/__tests__/mocks/examples.d.ts +4 -0
- package/lib/components/__tests__/mocks/examples.js +115 -0
- package/lib/components/common/LinkToField.js +1 -1
- package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
- package/lib/components/common/__tests__/Dropdown.test.js +129 -0
- package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
- package/lib/components/common/__tests__/LinkToField.test.js +39 -0
- package/lib/components/common/linkify.js +1 -1
- package/lib/hooks/useRouter.js +1 -1
- package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
- package/lib/jotai/__tests__/app.test.d.ts +1 -0
- package/lib/jotai/__tests__/app.test.js +53 -0
- package/lib/models/__tests__/Callback.test.d.ts +1 -0
- package/lib/models/__tests__/Callback.test.js +15 -0
- package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
- package/lib/models/__tests__/FieldModel.test.js +117 -0
- package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
- package/lib/models/__tests__/MediaContent.test.js +105 -0
- package/lib/models/__tests__/Operation.test.d.ts +1 -0
- package/lib/models/__tests__/Operation.test.js +459 -0
- package/lib/models/__tests__/Response.test.d.ts +1 -0
- package/lib/models/__tests__/Response.test.js +221 -0
- package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.circular.test.js +694 -0
- package/lib/models/__tests__/Schema.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.test.js +1395 -0
- package/lib/models/__tests__/example.test.d.ts +1 -0
- package/lib/models/__tests__/example.test.js +90 -0
- package/lib/models/__tests__/group.test.d.ts +1 -0
- package/lib/models/__tests__/group.test.js +52 -0
- package/lib/models/__tests__/helpers.d.ts +5 -0
- package/lib/models/__tests__/helpers.js +62 -0
- package/lib/models/__tests__/request.test.d.ts +1 -0
- package/lib/models/__tests__/request.test.js +119 -0
- package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
- package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
- package/lib/services/__tests__/check.test.d.ts +1 -0
- package/lib/services/__tests__/check.test.js +22 -0
- package/lib/services/__tests__/utils.test.d.ts +1 -0
- package/lib/services/__tests__/utils.test.js +42 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
- package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
- package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
- package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
- package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/config-options/__tests__/helpers.test.js +234 -0
- package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/history/__tests__/helpers.test.js +19 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
- package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
- package/lib/services/menu/__tests__/builder.test.js +307 -0
- package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
- package/lib/services/menu/__tests__/operation.test.js +240 -0
- package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
- package/lib/services/menu/__tests__/tags.test.js +71 -0
- package/lib/telemetry/RedocTelemetry.js +31 -1
- package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
- package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
- package/lib/testProviders.d.ts +6 -0
- package/lib/testProviders.js +14 -0
- package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
- package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
- package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
- package/lib/utils/__tests__/argValuesHelpers.js +56 -0
- package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
- package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
- package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/configure-helpers.test.js +356 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
- package/lib/utils/__tests__/debounce.test.d.ts +1 -0
- package/lib/utils/__tests__/debounce.test.js +54 -0
- package/lib/utils/__tests__/debug.test.d.ts +1 -0
- package/lib/utils/__tests__/debug.test.js +23 -0
- package/lib/utils/__tests__/dom.test.d.ts +1 -0
- package/lib/utils/__tests__/dom.test.js +108 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
- package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
- package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
- package/lib/utils/__tests__/helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/helpers.test.js +174 -0
- package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
- package/lib/utils/__tests__/isMobile.test.js +28 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
- package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
- package/lib/utils/__tests__/local-storage.test.js +48 -0
- package/lib/utils/__tests__/object.test.d.ts +1 -0
- package/lib/utils/__tests__/object.test.js +45 -0
- package/lib/utils/__tests__/openapi.test.d.ts +1 -0
- package/lib/utils/__tests__/openapi.test.js +1378 -0
- package/lib/utils/__tests__/path.test.d.ts +1 -0
- package/lib/utils/__tests__/path.test.js +16 -0
- package/lib/utils/__tests__/queryString.test.d.ts +1 -0
- package/lib/utils/__tests__/queryString.test.js +60 -0
- package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
- package/lib/utils/__tests__/replaceVariables.test.js +46 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
- package/lib/utils/__tests__/sort.test.d.ts +1 -0
- package/lib/utils/__tests__/sort.test.js +16 -0
- package/lib/utils/__tests__/string.test.d.ts +1 -0
- package/lib/utils/__tests__/string.test.js +16 -0
- package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/theme-helpers.test.js +24 -0
- package/lib/utils/__tests__/url.test.d.ts +1 -0
- package/lib/utils/__tests__/url.test.js +134 -0
- package/lib/utils/path.d.ts +1 -1
- package/package.json +12 -12
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-MY79QAeW.js +0 -1
- package/dist/redocly-openapi-docs.min.external-resolver-3KMJv7SC.js +0 -2
- package/dist/redocly-openapi-docs.min.index-BYVMr_la.js +0 -1
- package/dist/redocly-openapi-docs.min.index-CsqzTi3Z.js +0 -7586
- package/dist/redocly-openapi-docs.min.index-D8F7x0S6.js +0 -1
- package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
- package/dist/redocly-openapi-docs.min.standalone-Ci6886Cr.js +0 -12114
- package/dist/redocly-openapi-docs.min.tauri-path-Bs1-AQjc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import util from 'util';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import * as Jotai from 'jotai';
|
|
5
|
+
import { LayoutVariant } from '@redocly/config';
|
|
6
|
+
import { ApiInfo } from '../ApiInfo.js';
|
|
7
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
8
|
+
Object.defineProperty(global, 'TextEncoder', {
|
|
9
|
+
value: util.TextEncoder,
|
|
10
|
+
});
|
|
11
|
+
vi.mock('jotai', async () => ({
|
|
12
|
+
...(await vi.importActual('jotai')),
|
|
13
|
+
useAtomValue: vi.fn(),
|
|
14
|
+
}));
|
|
15
|
+
describe('ApiInfo', () => {
|
|
16
|
+
it('ApiInfo renders correctly', () => {
|
|
17
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
18
|
+
parser: {
|
|
19
|
+
definition: {
|
|
20
|
+
info: {
|
|
21
|
+
downloadFileName: 'downloadFileNameValue',
|
|
22
|
+
summary: ' ',
|
|
23
|
+
description: 'This is a sample server Petstore server.',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
options: {
|
|
28
|
+
downloadDefinitionUrl: 'downloadDefinitionUrlValue',
|
|
29
|
+
expandDefaultServerVariables: true,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
const result = render(_jsx(ApiInfo, { layout: LayoutVariant.THREE_PANEL, item: {
|
|
33
|
+
infoDefinition: {
|
|
34
|
+
info: {
|
|
35
|
+
downloadFileName: 'downloadFileNameValue',
|
|
36
|
+
summary: 'Some summary',
|
|
37
|
+
description: 'This is a sample server Petstore server.',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
} }), {
|
|
41
|
+
wrapper: TestBrowserRouter,
|
|
42
|
+
});
|
|
43
|
+
expect(result).toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=ApiInfo.test.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useLocation as d}from"react-router
|
|
1
|
+
import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useLocation as d}from"react-router";import{useTranslate as b}from"../../hooks/index.js";import{CallbackPanel as f}from"../Panel/index.js";import{CallbackDetails as x}from"./CallbackDetails.js";import{CallbackSummary as u}from"./CallbackSummary.js";import{pathIncludesLink as k}from"../../utils/index.js";import{styled as l}from"../../styled-components.js";const B=({operation:o,operation:{callbackId:a},onExpand:s,selectedCallback:n})=>{const t=b(),i=d();return r(f,{header:({expanded:e,toggle:m})=>r(u,{callback:o,toggle:p=>{m?.(p),s?.(e?null:o)},expanded:e,translate:t}),expanded:n?.callbackId===a||k(i,a),className:"panel-response-callback",children:c(h,{children:[r(x,{operation:o,translate:t}),r(y,{})]})})},h=l.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
.property:last-child {
|
|
4
4
|
border-bottom: none;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
+
import { getCallback } from '../../../models/index.js';
|
|
6
|
+
import { CallbackOperation } from '../CallbackOperation.js';
|
|
7
|
+
import { CallbacksList } from '../CallbacksList.js';
|
|
8
|
+
import { CallbackSummary } from '../CallbackSummary.js';
|
|
9
|
+
import * as simpleCallbackFixture from './fixtures/simple-callback.json';
|
|
10
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
11
|
+
const options = normalizeOptions({});
|
|
12
|
+
describe('Components', () => {
|
|
13
|
+
describe('Callbacks', () => {
|
|
14
|
+
const parser = new OpenAPIParser(simpleCallbackFixture, undefined, options);
|
|
15
|
+
const callback = getCallback(parser, 'Test.Callback', { $ref: '#/components/callbacks/Test' }, '', options, '');
|
|
16
|
+
const renderCallbackOperation = (props = {}) => render(_jsx(CallbackOperation, { operation: callback.operations[0], onExpand: () => { }, selectedCallback: null, ...props }), {
|
|
17
|
+
wrapper: TestBrowserRouter,
|
|
18
|
+
});
|
|
19
|
+
it('should correctly render CallbackView', () => {
|
|
20
|
+
const { getByText } = renderCallbackOperation();
|
|
21
|
+
expect(getByText('testCallback')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
it('should correctly render CallbackTitle', () => {
|
|
24
|
+
const { getByText } = render(_jsx(CallbackSummary, { toggle: () => { }, callback: callback.operations[0], translate: () => '' }), {
|
|
25
|
+
wrapper: TestBrowserRouter,
|
|
26
|
+
});
|
|
27
|
+
expect(getByText('testCallback')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
it('should expand the callback when the summary is clicked', async () => {
|
|
30
|
+
const user = userEvent.setup();
|
|
31
|
+
const onExpand = vi.fn();
|
|
32
|
+
const { getByText, getByTestId, queryByTestId } = renderCallbackOperation({ onExpand });
|
|
33
|
+
expect(queryByTestId('panel-body')).not.toBeInTheDocument();
|
|
34
|
+
await user.click(getByText('testCallback'));
|
|
35
|
+
expect(onExpand).toHaveBeenCalledWith(callback.operations[0]);
|
|
36
|
+
expect(getByTestId('panel-body')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
it('should correctly render CallbacksList', () => {
|
|
39
|
+
const { getByText } = render(_jsx(CallbacksList, { callbacks: [callback], onExpand: () => { }, selectedCallback: null }), {
|
|
40
|
+
wrapper: TestBrowserRouter,
|
|
41
|
+
});
|
|
42
|
+
expect(getByText('testCallback')).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=Callbacks.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { useLocation } from 'react-router';
|
|
3
|
+
import { vi } from 'vitest';
|
|
4
|
+
import { useAutoScroll } from '../useAutoScroll.js';
|
|
5
|
+
vi.mock('react-router', () => ({
|
|
6
|
+
useLocation: vi.fn(),
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('lodash.throttle', () => ({
|
|
9
|
+
default: (fn) => fn,
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('@redocly/theme', async () => {
|
|
12
|
+
const actual = await vi.importActual('@redocly/theme');
|
|
13
|
+
return {
|
|
14
|
+
...actual,
|
|
15
|
+
IS_BROWSER: true,
|
|
16
|
+
useActiveSectionId: vi.fn(() => '/test'),
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
describe('useAutoScroll', () => {
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
vi.useFakeTimers();
|
|
22
|
+
vi.clearAllMocks();
|
|
23
|
+
useAutoScroll.initialPageLoad = true;
|
|
24
|
+
window.history.replaceState = vi.fn();
|
|
25
|
+
window.scrollTo = vi.fn();
|
|
26
|
+
document.getElementById = vi.fn();
|
|
27
|
+
document.querySelector = vi.fn();
|
|
28
|
+
Object.defineProperty(window, 'location', {
|
|
29
|
+
value: { pathname: '', hash: '' },
|
|
30
|
+
writable: true,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
vi.useRealTimers();
|
|
35
|
+
vi.restoreAllMocks();
|
|
36
|
+
});
|
|
37
|
+
test('should processing without toLowerCase', () => {
|
|
38
|
+
const mockLocation = {
|
|
39
|
+
pathname: '/test',
|
|
40
|
+
hash: '#TestHash',
|
|
41
|
+
state: null,
|
|
42
|
+
key: '',
|
|
43
|
+
search: '',
|
|
44
|
+
};
|
|
45
|
+
useLocation.mockReturnValue(mockLocation);
|
|
46
|
+
renderHook(() => useAutoScroll('/'));
|
|
47
|
+
expect(document.getElementById).toHaveBeenCalledWith('TestHash');
|
|
48
|
+
});
|
|
49
|
+
test('should extract and process legacy hash patterns', () => {
|
|
50
|
+
const mockLocation = {
|
|
51
|
+
pathname: '/test',
|
|
52
|
+
hash: '#tag/TestTag',
|
|
53
|
+
state: null,
|
|
54
|
+
key: '',
|
|
55
|
+
search: '',
|
|
56
|
+
};
|
|
57
|
+
useLocation.mockReturnValue(mockLocation);
|
|
58
|
+
renderHook(() => useAutoScroll('/'));
|
|
59
|
+
expect(document.getElementById).toHaveBeenCalledWith('test/testtag');
|
|
60
|
+
});
|
|
61
|
+
test('should scroll to top when on base path without hash', () => {
|
|
62
|
+
const mockLocation = {
|
|
63
|
+
pathname: '/',
|
|
64
|
+
hash: '',
|
|
65
|
+
state: null,
|
|
66
|
+
key: '',
|
|
67
|
+
search: '',
|
|
68
|
+
};
|
|
69
|
+
useLocation.mockReturnValue(mockLocation);
|
|
70
|
+
renderHook(() => useAutoScroll('/'));
|
|
71
|
+
expect(window.scrollTo).toHaveBeenCalledWith(0, 0);
|
|
72
|
+
});
|
|
73
|
+
test('should scroll element into view when found', () => {
|
|
74
|
+
const mockElement = { scrollIntoView: vi.fn() };
|
|
75
|
+
const mockLocation = {
|
|
76
|
+
pathname: '/test',
|
|
77
|
+
hash: '#TestHash',
|
|
78
|
+
state: null,
|
|
79
|
+
key: '',
|
|
80
|
+
search: '',
|
|
81
|
+
};
|
|
82
|
+
useLocation.mockReturnValue(mockLocation);
|
|
83
|
+
document.getElementById.mockReturnValue(mockElement);
|
|
84
|
+
renderHook(() => useAutoScroll('/'));
|
|
85
|
+
expect(mockElement.scrollIntoView).toHaveBeenCalled();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=useAutoScroll.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLocation as p}from"react-router
|
|
1
|
+
import{useLocation as p}from"react-router";import{useEffect as s}from"react";import{addLeadingSlash as d,removeLeadingSlash as l,useActiveSectionId as u}from"@redocly/theme/core/openapi";import{compose as f,encodeBackSlashes as h,tryDecodeURIComponent as w}from"../../utils/index.js";import{IS_BROWSER as S}from"../../utils/dom.js";let m=!0;function v(t){const e=p(),o=t||"/";s(()=>{if(e.pathname===o&&e.hash===""){window.scrollTo(0,0);return}const a=l(e.pathname.replace(o,"")),r=g(e.hash),i=r?c(a+r)||document.querySelector(`[id$="${l(r)}"]`):c(e.hash.replace("#",""))||c(a);i&&i.scrollIntoView()},[e,o]);const n=u(e,!1,!1);s(()=>{if(n&&m){m=!1;return}if(S&&!window.location.pathname.includes(n)&&!window.location.hash.includes(n)){const a=f(d,h)(n);window.history.replaceState({},"",a)}},[n])}function c(t){return document.getElementById(w(t))}function g(t){const e=["#tag","#operation","#paths"];for(const o of e)if(t.includes(o))return t.replace(o,"").toLowerCase();return""}export{c as getElementById,g as getLegacyHash,v as useAutoScroll};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { useLocation } from 'react-router';
|
|
3
|
+
import { useIsExpanded } from '../useIsExpanded.js';
|
|
4
|
+
// Mock react-router
|
|
5
|
+
vi.mock('react-router', () => ({
|
|
6
|
+
useLocation: vi.fn(),
|
|
7
|
+
}));
|
|
8
|
+
const mockUseLocation = useLocation;
|
|
9
|
+
describe('useIsExpanded', () => {
|
|
10
|
+
const mockRoutingBasePath = '/docs';
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
mockUseLocation.mockReset();
|
|
13
|
+
});
|
|
14
|
+
it('should return false for non-tag items', () => {
|
|
15
|
+
mockUseLocation.mockReturnValue({
|
|
16
|
+
pathname: '/docs/pets',
|
|
17
|
+
hash: '',
|
|
18
|
+
state: undefined,
|
|
19
|
+
key: '',
|
|
20
|
+
search: '',
|
|
21
|
+
});
|
|
22
|
+
const item = {
|
|
23
|
+
type: 'operation',
|
|
24
|
+
href: '/pets',
|
|
25
|
+
items: [],
|
|
26
|
+
};
|
|
27
|
+
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
28
|
+
expect(result.current).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
it('should return true when current path matches item href', () => {
|
|
31
|
+
mockUseLocation.mockReturnValue({
|
|
32
|
+
pathname: '/docs/pets',
|
|
33
|
+
hash: '',
|
|
34
|
+
state: undefined,
|
|
35
|
+
key: '',
|
|
36
|
+
search: '',
|
|
37
|
+
});
|
|
38
|
+
const item = {
|
|
39
|
+
type: 'tag',
|
|
40
|
+
href: '/pets',
|
|
41
|
+
items: [{ type: 'operation', href: '/pets/get', items: [] }],
|
|
42
|
+
};
|
|
43
|
+
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
44
|
+
expect(result.current).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
it('should return true when legacy hash matches item href', () => {
|
|
47
|
+
mockUseLocation.mockReturnValue({
|
|
48
|
+
pathname: '/docs',
|
|
49
|
+
hash: '#tag/pets',
|
|
50
|
+
state: undefined,
|
|
51
|
+
key: '',
|
|
52
|
+
search: '',
|
|
53
|
+
});
|
|
54
|
+
const item = {
|
|
55
|
+
type: 'tag',
|
|
56
|
+
href: '/pets',
|
|
57
|
+
items: [],
|
|
58
|
+
};
|
|
59
|
+
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
60
|
+
expect(result.current).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
it('should handle nested items', () => {
|
|
63
|
+
mockUseLocation.mockReturnValue({
|
|
64
|
+
pathname: '/docs/pets/create',
|
|
65
|
+
hash: '',
|
|
66
|
+
state: undefined,
|
|
67
|
+
key: '',
|
|
68
|
+
search: '',
|
|
69
|
+
});
|
|
70
|
+
const item = {
|
|
71
|
+
type: 'tag',
|
|
72
|
+
href: '/pets',
|
|
73
|
+
items: [
|
|
74
|
+
{
|
|
75
|
+
type: 'section',
|
|
76
|
+
href: '/pets',
|
|
77
|
+
items: [
|
|
78
|
+
{
|
|
79
|
+
type: 'section',
|
|
80
|
+
href: '/pets/create',
|
|
81
|
+
items: [],
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
88
|
+
expect(result.current).toBe(true);
|
|
89
|
+
});
|
|
90
|
+
it('should handle encoded URLs', () => {
|
|
91
|
+
mockUseLocation.mockReturnValue({
|
|
92
|
+
pathname: '/docs/user%20profile',
|
|
93
|
+
hash: '',
|
|
94
|
+
state: undefined,
|
|
95
|
+
key: '',
|
|
96
|
+
search: '',
|
|
97
|
+
});
|
|
98
|
+
const item = {
|
|
99
|
+
type: 'tag',
|
|
100
|
+
href: '/user profile',
|
|
101
|
+
items: [],
|
|
102
|
+
};
|
|
103
|
+
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
104
|
+
expect(result.current).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
it('should return false when no matches found', () => {
|
|
107
|
+
mockUseLocation.mockReturnValue({
|
|
108
|
+
pathname: '/docs/users',
|
|
109
|
+
hash: '',
|
|
110
|
+
state: undefined,
|
|
111
|
+
key: '',
|
|
112
|
+
search: '',
|
|
113
|
+
});
|
|
114
|
+
const item = {
|
|
115
|
+
type: 'tag',
|
|
116
|
+
href: '/pets',
|
|
117
|
+
items: [{ type: 'operation', href: '/pets/list', items: [] }],
|
|
118
|
+
};
|
|
119
|
+
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
120
|
+
expect(result.current).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=useIsExpanded.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as a}from"react";import{useLocation as f}from"react-router
|
|
1
|
+
import{useMemo as a}from"react";import{useLocation as f}from"react-router";import{removeLeadingSlash as h}from"@redocly/theme/core/openapi";import{tryDecodeURIComponent as m,normalizePath as l}from"../../utils/index.js";import{getLegacyHash as d}from"../Content/useAutoScroll.js";function v({item:o,routingBasePath:s}){const n=f(),c=a(()=>m(l(n.pathname.replace(s,""))),[n.pathname,s]),p=a(()=>{const e=[],t=i=>{i.forEach(r=>{e.push(r),r.items?.length&&t(r.items)})};return t([o]),e},[o]);return o.type!=="tag"?!1:p.map(e=>e.href).some(e=>{const t=d(n.hash);return[e,m(e)].includes(c)||t&&(e.endsWith(t)||e===h(t))})}export{v as useIsExpanded};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as l,jsx as t,jsxs as f}from"react/jsx-runtime";import{memo as u,useMemo as p}from"react";import{Navigate as c,Route as n,Routes as m}from"react-router
|
|
1
|
+
import{Fragment as l,jsx as t,jsxs as f}from"react/jsx-runtime";import{memo as u,useMemo as p}from"react";import{Navigate as c,Route as n,Routes as m}from"react-router";import{getFirstPageLink as d,getItemsByType as g}from"./helpers.js";import{SectionContent as s}from"../SectionContent/index.js";function h({items:e,root:r=!1}){const{rootItem:o}=g(e),a=!r||o?"/":d(e,"/"),i=p(()=>f(m,{children:[o&&t(n,{path:`${o.href||"/"}*`,element:t(s,{items:e})}),t(n,{path:"*",element:t(c,{to:a,replace:!0})})]}),[o,"/",e,a]);return r&&!e.length?t(m,{children:t(n,{path:"*",element:t(s,{items:e})})}):e.length?t(l,{children:i}):null}const I=u(h);export{I as ContentItems};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as f,jsx as h}from"react/jsx-runtime";import{useCallback as g,memo as M,useEffect as _,useState as x,useMemo as E}from"react";import{useLocation as S}from"react-router
|
|
1
|
+
import{Fragment as f,jsx as h}from"react/jsx-runtime";import{useCallback as g,memo as M,useEffect as _,useState as x,useMemo as E}from"react";import{useLocation as S}from"react-router";import{removeLeadingSlash as r}from"@redocly/theme/core/openapi";const T=3,a=1,b=1e3,F=({items:e=[],renderItem:c,routingBasePath:i})=>{const m=i||"/",u=S(),l=r(u.pathname.replace(m,"")),s=E(()=>{const n=new Map(e.map((t,o)=>[r(t.href),o]));return t=>t?n.get(t):void 0},[e]),I=g(n=>{const t=s(n),o=Math.max(0,t?t-a:0),L=Math.min(e.length,t?t+a+1:T);return{start:o,end:L}},[s,e.length]),[p,d]=x(()=>{const{start:n,end:t}=I(l);return e.slice(n,t)});return _(()=>{const n=setTimeout(()=>{d(e)},b);return()=>clearTimeout(n)},[e]),h(f,{children:p.map(c)})},B=M(F);export{B as VirtualList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Items } from '../Items.js';
|
|
4
|
+
import { TestMemoryRouter } from '../../../testProviders.js';
|
|
5
|
+
vi.mock('../../ContentItem', () => ({
|
|
6
|
+
ContentItem: ({ children, item }) => (_jsxs("div", { "data-testid": `content-item-${item.id}`, children: [item.title, children] })),
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('../VirtualList', () => ({
|
|
9
|
+
VirtualList: ({ items }) => (_jsx("div", { "data-testid": "virtual-list", children: items.map((item) => (_jsx("div", { children: item.title }, item.id))) })),
|
|
10
|
+
}));
|
|
11
|
+
const mockItems = [
|
|
12
|
+
{ id: '1', title: 'Item 1', type: 'group', items: [] },
|
|
13
|
+
{ id: '2', title: 'Item 2', type: 'group', items: [] },
|
|
14
|
+
];
|
|
15
|
+
const mockMixedTypeItems = Array.from({ length: 16 }, (_, i) => ({
|
|
16
|
+
id: `mixed-${i}`,
|
|
17
|
+
title: `Item ${i}`,
|
|
18
|
+
type: i % 2 === 0 ? 'operation' : 'schema',
|
|
19
|
+
items: [],
|
|
20
|
+
}));
|
|
21
|
+
const mockOperationItems = Array.from({ length: 16 }, (_, i) => ({
|
|
22
|
+
id: `op-${i}`,
|
|
23
|
+
title: `Operation ${i}`,
|
|
24
|
+
type: 'operation',
|
|
25
|
+
items: [],
|
|
26
|
+
}));
|
|
27
|
+
describe('Items', () => {
|
|
28
|
+
const renderWithRouter = (component) => {
|
|
29
|
+
return render(_jsx(TestMemoryRouter, { children: component }));
|
|
30
|
+
};
|
|
31
|
+
it('renders null when items array is empty', () => {
|
|
32
|
+
const { container } = renderWithRouter(_jsx(Items, { items: [], routingBasePath: "/docs" }));
|
|
33
|
+
expect(container.firstChild).toBeNull();
|
|
34
|
+
});
|
|
35
|
+
it('renders regular list for less than 10 items', () => {
|
|
36
|
+
renderWithRouter(_jsx(Items, { items: mockItems, routingBasePath: "/docs" }));
|
|
37
|
+
expect(screen.getByTestId('content-item-1')).toBeInTheDocument();
|
|
38
|
+
expect(screen.getByTestId('content-item-2')).toBeInTheDocument();
|
|
39
|
+
expect(screen.queryByTestId('virtual-list')).not.toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
it('renders VirtualList for more than 15 operation items', () => {
|
|
42
|
+
renderWithRouter(_jsx(Items, { items: mockOperationItems, routingBasePath: "/docs" }));
|
|
43
|
+
expect(screen.getByTestId('virtual-list')).toBeInTheDocument();
|
|
44
|
+
expect(screen.queryByTestId('content-item-1')).not.toBeInTheDocument();
|
|
45
|
+
});
|
|
46
|
+
it('renders VirtualList for more than 15 mixed operation and schema items', () => {
|
|
47
|
+
renderWithRouter(_jsx(Items, { items: mockMixedTypeItems, routingBasePath: "/docs" }));
|
|
48
|
+
expect(screen.getByTestId('virtual-list')).toBeInTheDocument();
|
|
49
|
+
expect(screen.queryByTestId('content-item-mixed-0')).not.toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
it('renders nested items correctly', () => {
|
|
52
|
+
const nestedItems = [
|
|
53
|
+
{
|
|
54
|
+
id: '1',
|
|
55
|
+
title: 'Parent',
|
|
56
|
+
type: 'group',
|
|
57
|
+
items: [{ id: '1-1', title: 'Child', type: 'group', items: [] }],
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
renderWithRouter(_jsx(Items, { items: nestedItems, routingBasePath: "/docs" }));
|
|
61
|
+
expect(screen.getByTestId('content-item-1')).toBeInTheDocument();
|
|
62
|
+
expect(screen.getByText('Parent')).toBeInTheDocument();
|
|
63
|
+
expect(screen.getByText('Child')).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=Items.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Routes, Route } from 'react-router';
|
|
4
|
+
import { act } from 'react';
|
|
5
|
+
import { VirtualList } from '../VirtualList.js';
|
|
6
|
+
import { TestMemoryRouter } from '../../../testProviders.js';
|
|
7
|
+
const mockItems = [
|
|
8
|
+
{ href: '/item1', title: 'Item 1' },
|
|
9
|
+
{ href: '/item2', title: 'Item 2' },
|
|
10
|
+
{ href: '/item3', title: 'Item 3' },
|
|
11
|
+
{ href: '/item4', title: 'Item 4' },
|
|
12
|
+
{ href: '/item5', title: 'Item 5' },
|
|
13
|
+
];
|
|
14
|
+
const renderItem = (item) => (_jsx("div", { "data-testid": item.href.replace('/', ''), children: typeof item.title === 'string'
|
|
15
|
+
? String(item.title)
|
|
16
|
+
: String(item.name) }, item.href));
|
|
17
|
+
const renderWithRouter = (initialPath, props) => {
|
|
18
|
+
return render(_jsx(TestMemoryRouter, { initialEntries: [initialPath], children: _jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(VirtualList, { ...props }) }) }) }));
|
|
19
|
+
};
|
|
20
|
+
describe('VirtualList', () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
vi.useFakeTimers();
|
|
23
|
+
});
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
vi.clearAllTimers();
|
|
26
|
+
vi.useRealTimers();
|
|
27
|
+
});
|
|
28
|
+
it('should render empty list when no items provided', () => {
|
|
29
|
+
renderWithRouter('/', {
|
|
30
|
+
items: [],
|
|
31
|
+
renderItem,
|
|
32
|
+
routingBasePath: '/',
|
|
33
|
+
});
|
|
34
|
+
expect(screen.queryByTestId(/item/)).not.toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
it('should initially render first three items when no active item', () => {
|
|
37
|
+
renderWithRouter('/non-existing', {
|
|
38
|
+
items: mockItems,
|
|
39
|
+
renderItem,
|
|
40
|
+
routingBasePath: '/',
|
|
41
|
+
});
|
|
42
|
+
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
44
|
+
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
45
|
+
expect(screen.queryByTestId('item4')).not.toBeInTheDocument();
|
|
46
|
+
expect(screen.queryByTestId('item5')).not.toBeInTheDocument();
|
|
47
|
+
});
|
|
48
|
+
it('should render items around active item', () => {
|
|
49
|
+
renderWithRouter('/item3', {
|
|
50
|
+
items: mockItems,
|
|
51
|
+
renderItem,
|
|
52
|
+
routingBasePath: '/',
|
|
53
|
+
});
|
|
54
|
+
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
56
|
+
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
it('should handle first item selection', () => {
|
|
59
|
+
renderWithRouter('/item1', {
|
|
60
|
+
items: mockItems,
|
|
61
|
+
renderItem,
|
|
62
|
+
routingBasePath: '/',
|
|
63
|
+
});
|
|
64
|
+
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
65
|
+
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
66
|
+
expect(screen.queryByTestId('item3')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
it('should handle last item selection', () => {
|
|
69
|
+
renderWithRouter('/item5', {
|
|
70
|
+
items: mockItems,
|
|
71
|
+
renderItem,
|
|
72
|
+
routingBasePath: '/',
|
|
73
|
+
});
|
|
74
|
+
expect(screen.queryByTestId('item1')).not.toBeInTheDocument();
|
|
75
|
+
expect(screen.queryByTestId('item2')).not.toBeInTheDocument();
|
|
76
|
+
expect(screen.queryByTestId('item3')).not.toBeInTheDocument();
|
|
77
|
+
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
78
|
+
expect(screen.getByTestId('item5')).toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
it('should eventually render all items after timeout', () => {
|
|
81
|
+
renderWithRouter('/item3', {
|
|
82
|
+
items: mockItems,
|
|
83
|
+
renderItem,
|
|
84
|
+
routingBasePath: '/',
|
|
85
|
+
});
|
|
86
|
+
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
87
|
+
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
88
|
+
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
89
|
+
act(() => {
|
|
90
|
+
vi.advanceTimersByTime(1000);
|
|
91
|
+
});
|
|
92
|
+
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
94
|
+
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
95
|
+
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
96
|
+
expect(screen.getByTestId('item5')).toBeInTheDocument();
|
|
97
|
+
});
|
|
98
|
+
it('should handle custom routing base path', () => {
|
|
99
|
+
renderWithRouter('/docs/item1', {
|
|
100
|
+
items: mockItems,
|
|
101
|
+
renderItem,
|
|
102
|
+
routingBasePath: '/docs',
|
|
103
|
+
});
|
|
104
|
+
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
105
|
+
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
106
|
+
expect(screen.queryByTestId('item3')).toBeInTheDocument();
|
|
107
|
+
});
|
|
108
|
+
it('should not re-render if all items are already visible', () => {
|
|
109
|
+
const { rerender } = renderWithRouter('/item1', {
|
|
110
|
+
items: mockItems,
|
|
111
|
+
renderItem,
|
|
112
|
+
routingBasePath: '/',
|
|
113
|
+
});
|
|
114
|
+
act(() => {
|
|
115
|
+
vi.advanceTimersByTime(1000);
|
|
116
|
+
});
|
|
117
|
+
const initialRenderCount = screen.getAllByTestId(/item/).length;
|
|
118
|
+
rerender(_jsx(TestMemoryRouter, { initialEntries: ['/item3'], children: _jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(VirtualList, { items: mockItems, renderItem: renderItem, routingBasePath: "/" }) }) }) }));
|
|
119
|
+
expect(screen.getAllByTestId(/item/).length).toBe(initialRenderCount);
|
|
120
|
+
});
|
|
121
|
+
it('should cleanup on unmount', () => {
|
|
122
|
+
const { unmount } = renderWithRouter('/item1', {
|
|
123
|
+
items: mockItems,
|
|
124
|
+
renderItem,
|
|
125
|
+
routingBasePath: '/',
|
|
126
|
+
});
|
|
127
|
+
unmount();
|
|
128
|
+
expect(() => {
|
|
129
|
+
act(() => {
|
|
130
|
+
vi.runAllTimers();
|
|
131
|
+
});
|
|
132
|
+
}).not.toThrow();
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=VirtualList.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as l,useRef as i}from"react";import{useLocation as s}from"react-router
|
|
1
|
+
import{useEffect as l,useRef as i}from"react";import{useLocation as s}from"react-router";import{removeLeadingSlash as n}from"@redocly/theme/core/openapi";import{getElementById as a}from"../Content/useAutoScroll.js";function m(r,c){const e=i(null),o=s(),f=n(o.pathname.replace(c,""));return l(()=>{if(e.current&&r.href&&n(r.href)===f&&(typeof e?.current?.scrollIntoView=="function"&&e.current.scrollIntoView(),o.hash)){const t=a(o.hash.replace("#","").toLowerCase());t&&t.scrollIntoView()}},[]),e}var w=m;export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
+
import { getSchema } from '../../../models/index.js';
|
|
6
|
+
import { Schema } from '../../Schema/index.js';
|
|
7
|
+
import * as simpleDiscriminatorFixture from './fixtures/simple-discriminator.json';
|
|
8
|
+
import * as discriminatorWithDefaultFixture from '../../../models/__tests__/fixtures/discriminator-with-default-mapping.json';
|
|
9
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
10
|
+
const options = normalizeOptions({});
|
|
11
|
+
vi.mock('jotai', async () => ({
|
|
12
|
+
...(await vi.importActual('jotai')),
|
|
13
|
+
useAtomValue: vi.fn(),
|
|
14
|
+
}));
|
|
15
|
+
describe('DiscriminatorDropdown', () => {
|
|
16
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
17
|
+
const parser = new OpenAPIParser(simpleDiscriminatorFixture, undefined, options);
|
|
18
|
+
const schema = getSchema({
|
|
19
|
+
parser,
|
|
20
|
+
schemaOrRef: { $ref: '#/components/schemas/Pet' },
|
|
21
|
+
pointer: '#/components/schemas/Pet',
|
|
22
|
+
options,
|
|
23
|
+
deps: { operation: { pointer: 'defaultPointer' } },
|
|
24
|
+
});
|
|
25
|
+
describe('discriminator', () => {
|
|
26
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
27
|
+
activeOneOf: {
|
|
28
|
+
'#/components/schemas/Pet': 0,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
it('should correctly render SchemaView', () => {
|
|
32
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
33
|
+
wrapper: TestBrowserRouter,
|
|
34
|
+
});
|
|
35
|
+
expect(getByText('type')).toBeInTheDocument();
|
|
36
|
+
expect(getByText('C̵a̵t̵ (deprecated)')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('discriminator with defaultMapping', () => {
|
|
40
|
+
const parserWithDefault = new OpenAPIParser(discriminatorWithDefaultFixture, undefined, options);
|
|
41
|
+
const schemaWithDefault = getSchema({
|
|
42
|
+
parser: parserWithDefault,
|
|
43
|
+
schemaOrRef: { $ref: '#/components/schemas/Pet' },
|
|
44
|
+
pointer: '#/components/schemas/Pet',
|
|
45
|
+
options,
|
|
46
|
+
deps: { operation: { pointer: 'defaultPointer' } },
|
|
47
|
+
});
|
|
48
|
+
it('schema has correct oneOf structure with defaultMapping', () => {
|
|
49
|
+
expect(schemaWithDefault.oneOf).toHaveLength(3);
|
|
50
|
+
expect(schemaWithDefault.oneOf?.[0].title).toBe('cat');
|
|
51
|
+
expect(schemaWithDefault.oneOf?.[0].isDefaultMapping).toBe(false);
|
|
52
|
+
expect(schemaWithDefault.oneOf?.[1].title).toBe('dog');
|
|
53
|
+
expect(schemaWithDefault.oneOf?.[1].isDefaultMapping).toBe(false);
|
|
54
|
+
expect(schemaWithDefault.oneOf?.[2].title).toBe('Default mapping');
|
|
55
|
+
expect(schemaWithDefault.oneOf?.[2].isDefaultMapping).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it('finds correct defaultMappingIdx', () => {
|
|
58
|
+
const defaultMappingIdx = schemaWithDefault.oneOf?.findIndex((subSchema) => subSchema.isDefaultMapping);
|
|
59
|
+
expect(defaultMappingIdx).toBe(2);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=DiscriminatorDropdown.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|