@redocly/openapi-docs 3.12.0-rc.7 → 3.12.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.js +2153 -1963
- package/lib/components/ApiInfo/ApiInfo.js +29 -1
- package/lib/components/ApiInfo/Metadata.js +29 -1
- package/lib/components/ApiInfo/index.js +2 -1
- package/lib/components/ApiInfo/styled.js +17 -8
- package/lib/components/CallbackSamples/CallbackSamples.js +25 -4
- package/lib/components/CallbackSamples/index.js +2 -1
- package/lib/components/Callbacks/CallbackDetails.js +17 -3
- package/lib/components/Callbacks/CallbackOperation.js +24 -3
- package/lib/components/Callbacks/CallbackSummary.js +19 -3
- package/lib/components/Callbacks/CallbacksList.js +16 -1
- package/lib/components/Callbacks/index.js +4 -1
- package/lib/components/Callbacks/styled.js +6 -3
- package/lib/components/Content/Content.js +10 -1
- package/lib/components/Content/index.js +2 -1
- package/lib/components/Content/useAutoScroll.js +50 -1
- package/lib/components/ContentItem/ContentItem.js +31 -1
- package/lib/components/ContentItem/index.js +2 -1
- package/lib/components/ContentItem/useIsExpanded.js +33 -1
- package/lib/components/ContentItems/ContentItems.js +19 -1
- package/lib/components/ContentItems/Items.js +13 -1
- package/lib/components/ContentItems/VirtualList.js +35 -1
- package/lib/components/ContentItems/helpers.js +49 -1
- package/lib/components/ContentItems/index.js +2 -1
- package/lib/components/ContentItems/useScrollOnRender.js +26 -1
- package/lib/components/Discriminator/Discriminator.js +27 -2
- package/lib/components/Discriminator/index.js +2 -1
- package/lib/components/Download/DownloadSpecification.js +46 -4
- package/lib/components/Download/index.js +2 -1
- package/lib/components/Download/types.js +2 -0
- package/lib/components/Download/useDownloadInfo.js +42 -1
- package/lib/components/ErrorBoundary/ErrorBoundary.js +22 -2
- package/lib/components/ErrorBoundary/index.js +2 -1
- package/lib/components/ExpandAllButton/ExpandAllButton.js +31 -2
- package/lib/components/ExpandAllButton/index.js +2 -1
- package/lib/components/ExternalDocumentation/ExternalDocumentation.js +18 -4
- package/lib/components/ExternalDocumentation/index.js +2 -1
- package/lib/components/Language/LanguageDropdown.js +21 -1
- package/lib/components/Language/LanguageItem.js +33 -1
- package/lib/components/Language/LanguageList.js +93 -1
- package/lib/components/Language/_tests_/LanguageDropdown.test.js +23 -1
- package/lib/components/Language/constants.js +3 -1
- package/lib/components/Language/index.js +4 -1
- package/lib/components/Language/styled.js +29 -15
- package/lib/components/Markdown/Markdown.js +64 -1
- package/lib/components/Markdown/index.js +3 -1
- package/lib/components/Markdown/types.js +2 -0
- package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +51 -1
- package/lib/components/MediaTypeSwitch/index.js +2 -1
- package/lib/components/OperationItem/Description.d.ts +1 -4
- package/lib/components/OperationItem/Description.js +9 -1
- package/lib/components/OperationItem/OperationItem.js +70 -5
- package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
- package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
- package/lib/components/OperationItem/index.js +2 -1
- package/lib/components/OperationItem/types.js +2 -0
- package/lib/components/Overlay.js +48 -3
- package/lib/components/Overview/Overview.js +20 -1
- package/lib/components/Overview/index.js +2 -1
- package/lib/components/PageFooter/PageFooter.js +19 -1
- package/lib/components/PageFooter/index.js +2 -1
- package/lib/components/Panel/ResponsePanel.js +12 -6
- package/lib/components/Panel/Trigger.js +4 -2
- package/lib/components/Panel/index.js +3 -1
- package/lib/components/PanelItem/PanelItem.js +6 -1
- package/lib/components/PanelItem/index.js +3 -1
- package/lib/components/PanelItem/styled.js +20 -10
- package/lib/components/PayloadSamples/Example.js +6 -1
- package/lib/components/PayloadSamples/ExampleValue.js +30 -1
- package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
- package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
- package/lib/components/PayloadSamples/index.js +7 -1
- package/lib/components/PayloadSamples/styled.js +9 -4
- package/lib/components/PayloadSamples/types.js +2 -0
- package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
- package/lib/components/PropertyDetails/EnumValues.js +37 -1
- package/lib/components/PropertyDetails/Examples.js +26 -1
- package/lib/components/PropertyDetails/Extensions.js +17 -2
- package/lib/components/PropertyDetails/FieldDetail.js +15 -2
- package/lib/components/PropertyDetails/FieldDetails.js +51 -6
- package/lib/components/PropertyDetails/Pattern.js +21 -1
- package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
- package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
- package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
- package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
- package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
- package/lib/components/PropertyDetails/index.js +4 -1
- package/lib/components/PropertyDetails/styled.js +15 -7
- package/lib/components/PropertyDetails/types.js +2 -0
- package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
- package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
- package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
- package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
- package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
- package/lib/components/RenderHook/RenderHook.js +17 -1
- package/lib/components/RenderHook/index.js +2 -1
- package/lib/components/Replay/EmbeddedReplay.js +41 -3
- package/lib/components/Replay/Replay.js +99 -1
- package/lib/components/Replay/index.js +3 -1
- package/lib/components/Replay/utils.js +208 -1
- package/lib/components/Request/RequestDetails.js +33 -2
- package/lib/components/Request/types.js +2 -0
- package/lib/components/RequestParameters/Body.js +8 -1
- package/lib/components/RequestParameters/ParametersGroup.js +19 -4
- package/lib/components/RequestParameters/RequestParameters.js +40 -1
- package/lib/components/RequestParameters/index.js +4 -1
- package/lib/components/RequestSamples/CodeSample.js +55 -2
- package/lib/components/RequestSamples/Example.js +37 -1
- package/lib/components/RequestSamples/RequestSamples.js +89 -5
- package/lib/components/RequestSamples/index.js +3 -1
- package/lib/components/RequestSamples/useCodeSamples.js +92 -1
- package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
- package/lib/components/ResponseSamples/Summary.js +9 -1
- package/lib/components/ResponseSamples/index.js +2 -1
- package/lib/components/Responses/OperationResponseList.js +42 -2
- package/lib/components/Responses/ResponseDetails.js +18 -1
- package/lib/components/Responses/ResponseHeaders.js +15 -1
- package/lib/components/Responses/index.js +6 -1
- package/lib/components/Responses/styled.js +14 -6
- package/lib/components/Responses/types.js +2 -0
- package/lib/components/RightPanel/RightPanel.js +21 -1
- package/lib/components/RightPanel/index.js +2 -1
- package/lib/components/Samples/ExampleSwitch.js +33 -1
- package/lib/components/Samples/index.js +3 -1
- package/lib/components/Samples/use-example-key.js +12 -1
- package/lib/components/Schema/ArraySchema.js +45 -1
- package/lib/components/Schema/ObjectSchema.js +29 -1
- package/lib/components/Schema/OneOfSchema.js +47 -3
- package/lib/components/Schema/RecursiveSchema.js +10 -1
- package/lib/components/Schema/Schema.js +63 -2
- package/lib/components/Schema/SubSchema.js +20 -1
- package/lib/components/Schema/helpers.js +16 -1
- package/lib/components/Schema/index.js +5 -1
- package/lib/components/Schema/types.js +2 -0
- package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
- package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
- package/lib/components/SchemaDefinition/index.js +2 -1
- package/lib/components/SectionContent/SectionContent.js +49 -6
- package/lib/components/SectionContent/index.js +2 -1
- package/lib/components/SectionItem/SectionItem.js +14 -1
- package/lib/components/SectionItem/index.js +2 -1
- package/lib/components/Security/Divider.js +9 -2
- package/lib/components/Security/OAuthFlow.js +11 -1
- package/lib/components/Security/OAuthScopes.js +59 -9
- package/lib/components/Security/Security.js +15 -1
- package/lib/components/Security/SecurityButton.js +31 -7
- package/lib/components/Security/SecurityFlow.js +28 -4
- package/lib/components/Security/SecurityModal.js +34 -5
- package/lib/components/Security/SecuritySchemeItem.js +15 -4
- package/lib/components/Security/helper.js +16 -1
- package/lib/components/Security/index.js +11 -1
- package/lib/components/Security/styled.js +6 -3
- package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
- package/lib/components/SelectOrLabel/index.js +2 -1
- package/lib/components/ServerList/ServerList.js +36 -10
- package/lib/components/ServerList/index.js +2 -1
- package/lib/components/ServerList/types.js +2 -0
- package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
- package/lib/components/ServerListDropdown/index.js +2 -1
- package/lib/components/ServerListDropdown/styled.js +15 -6
- package/lib/components/SideMenu/SideMenu.js +13 -2
- package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
- package/lib/components/SideMenu/index.js +2 -1
- package/lib/components/SideMenu/types.js +2 -0
- package/lib/components/StickySidebar/SidebarActions.js +14 -2
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
- package/lib/components/StickySidebar/index.js +2 -1
- package/lib/components/Tabs/Tabs.js +16 -5
- package/lib/components/Tabs/index.js +3 -1
- package/lib/components/Tabs/useTabsState.js +22 -1
- package/lib/components/TagItem/OperationNavigationItems.js +18 -4
- package/lib/components/TagItem/OperationsNavigation.js +46 -2
- package/lib/components/TagItem/TagItem.js +41 -8
- package/lib/components/TagItem/index.js +2 -1
- package/lib/components/TagItem/styled.js +5 -2
- package/lib/components/TagItem/types.js +2 -0
- package/lib/components/ViewNested/ViewNested.js +42 -9
- package/lib/components/ViewNested/index.js +2 -1
- package/lib/components/common/Badges.js +21 -5
- package/lib/components/common/BodyContent/BodyContent.js +31 -4
- package/lib/components/common/BodyContent/index.js +2 -1
- package/lib/components/common/ClearButton/ClearButton.js +5 -1
- package/lib/components/common/ClearButton/index.js +3 -1
- package/lib/components/common/ClearButton/styled.js +5 -2
- package/lib/components/common/ClearButton/types.js +2 -0
- package/lib/components/common/CodeBlockPanel.js +7 -3
- package/lib/components/common/ConstraintsView.js +14 -2
- package/lib/components/common/Dropdown/Dropdown.js +22 -4
- package/lib/components/common/Dropdown/index.js +2 -1
- package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
- package/lib/components/common/ExpandableExample/index.js +2 -1
- package/lib/components/common/Extensions.js +17 -2
- package/lib/components/common/Fields/fields-layout.js +76 -51
- package/lib/components/common/Fields/fields.js +39 -17
- package/lib/components/common/Fields/index.js +3 -1
- package/lib/components/common/LinkToField.js +33 -6
- package/lib/components/common/OperationItemTitle.d.ts +1 -0
- package/lib/components/common/OperationItemTitle.js +16 -5
- package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
- package/lib/components/common/SchemaSelection/index.js +2 -1
- package/lib/components/common/Select/Select.js +21 -1
- package/lib/components/common/Select/index.js +3 -1
- package/lib/components/common/Select/styled.js +17 -9
- package/lib/components/common/Select/types.js +2 -0
- package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
- package/lib/components/common/Skeleton/Skeleton.js +15 -5
- package/lib/components/common/Skeleton/index.js +3 -1
- package/lib/components/common/headers.js +4 -2
- package/lib/components/common/index.js +14 -1
- package/lib/components/common/linkify.js +28 -4
- package/lib/components/common/mixins.js +4 -2
- package/lib/components/common/panels.js +58 -33
- package/lib/components/common/schema.js +16 -8
- package/lib/components/common/styled.js +15 -7
- package/lib/components/index.js +25 -1
- package/lib/components/pluggable/RedocExample.js +20 -1
- package/lib/components/pluggable/RedocSchema.js +22 -1
- package/lib/components/pluggable/index.js +3 -1
- package/lib/components/pluggable/styled.components.js +9 -4
- package/lib/constants.js +30 -1
- package/lib/empty.js +7 -1
- package/lib/events/codeSampleCopy.js +19 -1
- package/lib/events/creator.js +5 -1
- package/lib/events/index.js +8 -1
- package/lib/events/languageSwitch.js +18 -1
- package/lib/events/panelToggle.js +16 -1
- package/lib/events/serverSwitch.js +13 -1
- package/lib/events/tryItOpen.js +12 -1
- package/lib/events/tryItSent.js +12 -1
- package/lib/events/types.js +11 -1
- package/lib/hoc/types.js +2 -0
- package/lib/hoc/utils.js +4 -1
- package/lib/hoc/withRouter.js +17 -1
- package/lib/hoc/withStore.js +28 -1
- package/lib/hooks/index.js +9 -1
- package/lib/hooks/useActivateExample.js +35 -1
- package/lib/hooks/useActiveWithFallback.js +12 -1
- package/lib/hooks/useContentItems.js +10 -1
- package/lib/hooks/useLicense.js +17 -1
- package/lib/hooks/usePerformanceMetrics.js +26 -1
- package/lib/hooks/useRouter.js +17 -1
- package/lib/hooks/useTelemetry.js +5 -1
- package/lib/hooks/useTranslate.js +6 -1
- package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
- package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
- package/lib/icons/CSharpIcon/index.js +2 -1
- package/lib/icons/CurlIcon/CurlIcon.js +8 -2
- package/lib/icons/CurlIcon/index.js +2 -1
- package/lib/icons/GOIcon/GOIcon.js +7 -1
- package/lib/icons/GOIcon/index.js +2 -1
- package/lib/icons/JavaIcon/JavaIcon.js +7 -1
- package/lib/icons/JavaIcon/index.js +2 -1
- package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
- package/lib/icons/JavaScriptIcon/index.js +2 -1
- package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
- package/lib/icons/NodeJSIcon/index.js +2 -1
- package/lib/icons/PHPIcon/PHPIcon.js +7 -1
- package/lib/icons/PHPIcon/index.js +2 -1
- package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
- package/lib/icons/PayloadIcon/index.js +2 -1
- package/lib/icons/PythonIcon/PythonIcon.js +7 -1
- package/lib/icons/PythonIcon/index.js +2 -1
- package/lib/icons/RIcon/RIcon.js +7 -1
- package/lib/icons/RIcon/index.js +2 -1
- package/lib/icons/RubyIcon/RubyIcon.js +7 -1
- package/lib/icons/RubyIcon/index.js +2 -1
- package/lib/index.js +49 -1
- package/lib/jotai/app.js +113 -1
- package/lib/jotai/operation.js +28 -1
- package/lib/jotai/replay.js +5 -1
- package/lib/jotai/store.js +8 -1
- package/lib/jotai/use-write-atom.js +9 -1
- package/lib/models/callback.js +28 -1
- package/lib/models/code-sample-options.js +2 -0
- package/lib/models/example.js +17 -1
- package/lib/models/field.js +109 -1
- package/lib/models/group.js +38 -1
- package/lib/models/index.js +14 -1
- package/lib/models/mediaContent.js +26 -1
- package/lib/models/mediaType.js +153 -1
- package/lib/models/operation.js +166 -1
- package/lib/models/request.js +25 -1
- package/lib/models/response.js +46 -1
- package/lib/models/schema.js +474 -2
- package/lib/models/security.js +84 -1
- package/lib/models/tab.js +2 -0
- package/lib/models/types.js +2 -0
- package/lib/services/OpenAPIParser.js +321 -1
- package/lib/services/check.js +104 -1
- package/lib/services/code-samples/constants.js +16 -1
- package/lib/services/code-samples/generator.js +540 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-builder.d.ts +5 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
- package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +2 -2
- package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
- package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
- package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
- package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
- package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
- package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
- package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
- package/lib/services/code-samples/httpsnippet/index.js +166 -1
- package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
- package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
- package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
- package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
- package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
- package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
- package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
- package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
- package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
- package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
- package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
- package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
- package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
- package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
- package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
- package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
- package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
- package/lib/services/code-samples/index.js +3 -1
- package/lib/services/code-samples/types.js +2 -0
- package/lib/services/config-options/helpers.js +49 -1
- package/lib/services/config-options/index.js +3 -1
- package/lib/services/config-options/normalizeOptions.js +83 -1
- package/lib/services/config-options/types.js +2 -0
- package/lib/services/history/helpers.js +63 -1
- package/lib/services/history/index.js +2 -1
- package/lib/services/index.js +9 -1
- package/lib/services/menu/builder.js +47 -1
- package/lib/services/menu/index.js +2 -1
- package/lib/services/menu/markdown.js +93 -1
- package/lib/services/menu/operation.js +50 -1
- package/lib/services/menu/tags.js +166 -1
- package/lib/services/types.d.ts +0 -3
- package/lib/services/types.js +2 -0
- package/lib/services/utils.js +83 -1
- package/lib/standalone.js +68 -1
- package/lib/styled-components.js +6 -1
- package/lib/types/app.js +2 -0
- package/lib/types/index.js +4 -1
- package/lib/types/open-api.d.ts +1 -0
- package/lib/types/open-api.js +2 -0
- package/lib/types/security.js +2 -0
- package/lib/utils/JsonPointer.js +84 -1
- package/lib/utils/areArraysEqual.js +4 -1
- package/lib/utils/argValuesHelpers.js +35 -1
- package/lib/utils/compose.js +2 -1
- package/lib/utils/configure-helpers.js +223 -1
- package/lib/utils/convertSwagger2OpenAPI.js +14 -1
- package/lib/utils/cookies.js +73 -1
- package/lib/utils/debounce.js +22 -1
- package/lib/utils/debug.js +11 -1
- package/lib/utils/dom.js +65 -1
- package/lib/utils/environments.js +13 -1
- package/lib/utils/helpers.js +222 -12
- package/lib/utils/index.js +25 -1
- package/lib/utils/isMobile.js +13 -1
- package/lib/utils/loadAndBundleSpec.js +32 -1
- package/lib/utils/local-storage.js +12 -1
- package/lib/utils/object.js +31 -1
- package/lib/utils/openapi.js +592 -1
- package/lib/utils/parameters.js +13 -1
- package/lib/utils/path.js +22 -1
- package/lib/utils/queryString.js +60 -1
- package/lib/utils/replaceVariables.js +14 -1
- package/lib/utils/saveTextBeforeHeading.js +35 -1
- package/lib/utils/security-details.js +49 -1
- package/lib/utils/session-storage.js +12 -1
- package/lib/utils/simplifyAstStructure.js +22 -1
- package/lib/utils/sort.js +21 -1
- package/lib/utils/string.js +65 -1
- package/lib/utils/telemetry.js +7 -1
- package/lib/utils/test-utils.js +26 -1
- package/lib/utils/theme-helpers.js +24 -3
- package/lib/utils/url.js +38 -1
- package/package.json +5 -5
|
@@ -1 +1,64 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
3
|
+
import markdoc from '@markdoc/markdoc';
|
|
4
|
+
import { useAtomValue } from 'jotai';
|
|
5
|
+
import DOMPurify from 'dompurify';
|
|
6
|
+
import { isString } from '@redocly/theme/core/openapi';
|
|
7
|
+
import { Markdown as MarkdownWrapper } from '@redocly/theme/components/Markdown/Markdown';
|
|
8
|
+
import { globalOptionsAtom } from '../../jotai/store.js';
|
|
9
|
+
const TAGS_NOT_TO_WRAP = ['OpenApiResponse', 'OpenApiRequestBody'];
|
|
10
|
+
export const Markdown = ({ source, ast, htmlWrap, markdocOptions: markdocOptionsProps, ...props }) => {
|
|
11
|
+
const options = useAtomValue(globalOptionsAtom);
|
|
12
|
+
if (!source && !ast) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const markdocOptions = Object.keys(options?.markdocOptions || {}).length
|
|
16
|
+
? options?.markdocOptions
|
|
17
|
+
: markdocOptionsProps;
|
|
18
|
+
const config = markdocOptions && {
|
|
19
|
+
tags: markdocOptions?.tags,
|
|
20
|
+
nodes: markdocOptions?.nodes,
|
|
21
|
+
partials: markdocOptions?.partials,
|
|
22
|
+
variables: markdocOptions?.variables,
|
|
23
|
+
functions: markdocOptions?.functions,
|
|
24
|
+
};
|
|
25
|
+
const components = markdocOptions && {
|
|
26
|
+
components: markdocOptions?.components,
|
|
27
|
+
};
|
|
28
|
+
let nodes;
|
|
29
|
+
if (source) {
|
|
30
|
+
if (isString(source)) {
|
|
31
|
+
const sanitizeSource = options?.unstable_hooks?.sanitize
|
|
32
|
+
? options.unstable_hooks?.sanitize?.(source)
|
|
33
|
+
: options?.sanitize
|
|
34
|
+
? DOMPurify.sanitize(source)
|
|
35
|
+
: source;
|
|
36
|
+
const ast = markdoc.parse(sanitizeSource);
|
|
37
|
+
nodes = markdoc.transform(ast, config);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const ast = markdoc.Ast.fromJSON(typeof source.result === 'object' ? JSON.stringify(source.result) : source.result);
|
|
41
|
+
if (Array.isArray(ast)) {
|
|
42
|
+
nodes = markdoc.transform(ast, config);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
nodes = markdoc.transform(ast, config);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (ast) {
|
|
50
|
+
nodes = markdoc.transform(ast, config);
|
|
51
|
+
}
|
|
52
|
+
const htmlRender = (content) => {
|
|
53
|
+
const html = markdoc.renderers.react(content, React, components);
|
|
54
|
+
return _jsx(MarkdownWrapper, { ...props, children: html, as: "div" });
|
|
55
|
+
};
|
|
56
|
+
if (!htmlWrap) {
|
|
57
|
+
return htmlRender(nodes);
|
|
58
|
+
}
|
|
59
|
+
const shouldWrap = (node) => node.attributes?.htmlWrap !== false && !TAGS_NOT_TO_WRAP.includes(node?.name);
|
|
60
|
+
const render = (wrap, content) => (wrap ? htmlWrap(htmlRender(content)) : htmlRender(content));
|
|
61
|
+
nodes = Array.isArray(nodes) ? nodes : nodes.children;
|
|
62
|
+
return (_jsx(_Fragment, { children: nodes.map((item, index) => (_jsx(Fragment, { children: render(shouldWrap(item), item) }, item?.attributes?.id || index))) }));
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=Markdown.js.map
|
|
@@ -1 +1,51 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useRef } from 'react';
|
|
3
|
+
import { useAtom } from 'jotai';
|
|
4
|
+
import { SelectLabel, SelectWrapper } from '../PayloadSamples/index.js';
|
|
5
|
+
import { Container } from '../common/index.js';
|
|
6
|
+
import { activeMimeNameAtom } from '../../jotai/app.js';
|
|
7
|
+
import { getActiveMediaType } from '../../models/index.js';
|
|
8
|
+
import { useTranslate } from '../../hooks/index.js';
|
|
9
|
+
function Wrapper({ children, withLabel, innerRef, translate, }) {
|
|
10
|
+
if (!children) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return withLabel ? (_jsxs(SelectWrapper, { ref: innerRef, children: [_jsx(SelectLabel, { children: translate('openapi.contentType', 'Content type') }), children] })) : (_jsx(Container, { ref: innerRef, children: children }));
|
|
14
|
+
}
|
|
15
|
+
function MediaTypesSwitchComponent({ content, withLabel, renderSelect, children, }) {
|
|
16
|
+
const translate = useTranslate();
|
|
17
|
+
const [activeMimeName, setActiveMimeName] = useAtom(activeMimeNameAtom);
|
|
18
|
+
const switchMedia = useCallback(({ value }) => {
|
|
19
|
+
/* istanbul ignore next (this can never happen, just to make ts happy, this is callback) */
|
|
20
|
+
if (!content || !ref.current)
|
|
21
|
+
return null;
|
|
22
|
+
const initialOffset = ref.current.getBoundingClientRect().y;
|
|
23
|
+
setActiveMimeName(value);
|
|
24
|
+
requestAnimationFrame(() => {
|
|
25
|
+
/* istanbul ignore next (this can never happen, just to make ts happy, this is callback) */
|
|
26
|
+
if (!ref.current || initialOffset == null)
|
|
27
|
+
return;
|
|
28
|
+
const updatedOffset = ref.current.getBoundingClientRect().y;
|
|
29
|
+
window.scrollBy(0, updatedOffset - initialOffset); // TODO: refactor to use ScrollService (make it singleton)
|
|
30
|
+
});
|
|
31
|
+
}, [content, setActiveMimeName]);
|
|
32
|
+
const ref = useRef(null);
|
|
33
|
+
if (!content || !content.mediaTypes || !content.mediaTypes.length) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const options = content.mediaTypes.map((mime, idx) => {
|
|
37
|
+
return {
|
|
38
|
+
value: mime.name,
|
|
39
|
+
idx,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
const active = getActiveMediaType(content, activeMimeName);
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx(Wrapper, { innerRef: ref, withLabel: withLabel, translate: translate, children: renderSelect({
|
|
44
|
+
value: active.name,
|
|
45
|
+
options,
|
|
46
|
+
onChange: switchMedia,
|
|
47
|
+
ariaLabel: 'Content type',
|
|
48
|
+
}) }), children(active)] }));
|
|
49
|
+
}
|
|
50
|
+
export const MediaTypesSwitch = memo(MediaTypesSwitchComponent);
|
|
51
|
+
//# sourceMappingURL=MediaTypesSwitch.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { MediaTypesSwitch } from './MediaTypesSwitch.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -2,9 +2,6 @@ import type { OpenAPIExternalDocumentation } from '../../types/index.js';
|
|
|
2
2
|
interface DescriptionProps {
|
|
3
3
|
description?: string | GenericObject;
|
|
4
4
|
externalDocs?: OpenAPIExternalDocumentation;
|
|
5
|
-
extensions: {
|
|
6
|
-
[p: string]: string | Record<string, unknown>;
|
|
7
|
-
};
|
|
8
5
|
}
|
|
9
|
-
export declare function Description({ description, externalDocs
|
|
6
|
+
export declare function Description({ description, externalDocs }: DescriptionProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
7
|
export {};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Markdown } from '../Markdown/index.js';
|
|
3
|
+
import { ExternalDocumentation } from '../ExternalDocumentation/index.js';
|
|
4
|
+
export function Description({ description, externalDocs }) {
|
|
5
|
+
if (!description)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(Markdown, { source: description }), externalDocs && _jsx(ExternalDocumentation, { externalDocs: externalDocs })] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Description.js.map
|
|
@@ -1,7 +1,69 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import { useAtomValue } from 'jotai';
|
|
4
|
+
import { LayoutVariant } from '@redocly/config';
|
|
5
|
+
import { AfterOpenApiOperation } from '@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiOperation';
|
|
6
|
+
import { BeforeOpenApiOperation } from '@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation';
|
|
7
|
+
import { PageActions } from '@redocly/theme/components/PageActions/PageActions';
|
|
8
|
+
import { Feedback } from '@redocly/theme/components/Feedback/Feedback';
|
|
9
|
+
import { SamplesMiddlePanel, SamplesPanel, ShareLink, Row, CustomBadges } from '../common/index.js';
|
|
10
|
+
import { CallbacksList } from '../Callbacks/index.js';
|
|
11
|
+
import { CallbackSamples } from '../CallbackSamples/index.js';
|
|
12
|
+
import { RequestSamples } from '../RequestSamples/index.js';
|
|
13
|
+
import { OperationResponseList } from '../Responses/index.js';
|
|
14
|
+
import { ResponseSamples } from '../ResponseSamples/index.js';
|
|
15
|
+
import { makeDeepLink, joinWithSeparator } from '../../services/index.js';
|
|
16
|
+
import { layoutAtom, userClaimsAtom } from '../../jotai/app.js';
|
|
17
|
+
import { globalOptionsAtom, globalStoreAtom } from '../../jotai/store.js';
|
|
18
|
+
import { getOperation } from '../../models/operation.js';
|
|
19
|
+
import { RenderHook } from '../RenderHook/index.js';
|
|
20
|
+
import { Heading, HeadingWrapper, Title } from '../common/OperationItemTitle.js';
|
|
21
|
+
import { LinkToField } from '../common/LinkToField.js';
|
|
22
|
+
import { RequestDetails } from '../Request/RequestDetails.js';
|
|
23
|
+
import { StyledBadge } from '../common/Badges.js';
|
|
24
|
+
import { useTranslate } from '../../hooks/index.js';
|
|
25
|
+
import { styled } from '../../styled-components.js';
|
|
26
|
+
import { createPanelToggleEvent } from '../../events/index.js';
|
|
27
|
+
function OperationItemComponent({ item: { operationDefinition, parent, href }, }) {
|
|
28
|
+
const translate = useTranslate();
|
|
29
|
+
const { parser, options } = useAtomValue(globalStoreAtom);
|
|
30
|
+
const { events } = useAtomValue(globalOptionsAtom);
|
|
31
|
+
const userClaims = useAtomValue(userClaimsAtom);
|
|
32
|
+
const layout = useAtomValue(layoutAtom);
|
|
33
|
+
const [activeResponseTab, setActiveResponseTab] = useState();
|
|
34
|
+
const { unstable_hooks, feedback } = options;
|
|
35
|
+
const operation = useMemo(() => getOperation(parser, operationDefinition, parent, options, href, undefined, userClaims), [href, operationDefinition, options, parent, parser, userClaims]);
|
|
36
|
+
const { name: summary, deprecated, isWebhook, badges } = operation || {};
|
|
37
|
+
const isStacked = layout === LayoutVariant.STACKED;
|
|
38
|
+
const feedbackType = feedback?.type || 'sentiment';
|
|
39
|
+
const displayFeedback = feedback?.hide !== true;
|
|
40
|
+
const operationSlug = joinWithSeparator(options.routingBasePath, operation.href);
|
|
41
|
+
const [selectedCallback, setSelectedCallback] = useState(null);
|
|
42
|
+
const handleActiveResponseChange = useCallback((tab) => {
|
|
43
|
+
if (activeResponseTab !== tab) {
|
|
44
|
+
setActiveResponseTab(tab);
|
|
45
|
+
}
|
|
46
|
+
}, [activeResponseTab]);
|
|
47
|
+
const handlePanelToggle = useCallback((isExpanded, panelType) => {
|
|
48
|
+
if (!panelType) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const event = createPanelToggleEvent({
|
|
52
|
+
operation,
|
|
53
|
+
isExpanded,
|
|
54
|
+
panelType,
|
|
55
|
+
});
|
|
56
|
+
events?.panelToggle?.(event);
|
|
57
|
+
}, [events, operation]);
|
|
58
|
+
const renderFeedback = useMemo(() => displayFeedback ? (_jsx(FeedbackWrapper, { children: _jsx(Feedback, { type: feedbackType, settings: feedback.settings, path: operationSlug }) })) : null, [displayFeedback, feedbackType, feedback.settings, operationSlug]);
|
|
59
|
+
return (_jsxs(OperationRow, { layout: layout, children: [_jsx(OperationSubRowStyled, { layout: layout, children: _jsxs(SamplesMiddlePanel, { isStacked: isStacked, children: [_jsx(RenderHook, { Hook: BeforeOpenApiOperation || unstable_hooks?.BeforeOperation, props: { operation } }), _jsxs(HeadingWrapper, { children: [_jsxs(Heading, { "data-testid": "operation-item-header", children: [_jsx(ShareLink, { to: href, "aria-label": `link to ${summary}` }), _jsx(CustomBadges, { badges: badges, children: summary }), deprecated && (_jsx(StyledBadge, { deprecated: true, children: translate('openapi.badges.deprecated', 'Deprecated') })), isWebhook && (_jsx(StyledBadge, { children: translate('openapi.badges.webhook', 'Webhook') }))] }), _jsx(PageActions, { pageSlug: operationSlug })] })] }) }), _jsxs(OperationSubRowStyled, { layout: layout, children: [_jsx(SamplesMiddlePanel, { isStacked: isStacked, children: _jsx(RequestDetails, { operation: operation, translate: translate, onPanelToggle: handlePanelToggle }) }), _jsx(OperationSamplesPanel, { isStacked: isStacked, "data-testid": "samples-block", className: "panel-container-request-samples", children: _jsx(RequestSamples, { operation: operation, onPanelToggle: handlePanelToggle }) })] }), _jsxs(OperationSubRowStyled, { layout: layout, children: [_jsx(SamplesMiddlePanel, { isStacked: isStacked, children: operation.responses?.length ? (_jsx(OperationResponseList, { responses: operation.responses, operationId: operation.id, operationPointer: operation.pointer, callbackId: operation.callbackId, activeResponseTab: activeResponseTab, onTabChange: handleActiveResponseChange, onPanelToggle: handlePanelToggle })) : null }), _jsx(OperationSamplesPanel, { isStacked: isStacked, "data-testid": "samples-block", className: "panel-container-response-samples", children: _jsx(ResponseSamples, { operation: operation, activeResponseTab: activeResponseTab, onTabChange: handleActiveResponseChange, onPanelToggle: handlePanelToggle }) })] }), _jsxs(OperationSubRowStyled, { layout: layout, children: [_jsxs(SamplesMiddlePanel, { isStacked: isStacked, children: [operation.callbacks?.length ? (_jsxs(_Fragment, { children: [_jsxs(Title, { children: [_jsx(LinkToField, { to: makeDeepLink(operation.id, 'callbacks') }), translate('openapi.callbacks', 'Callbacks')] }), _jsx(CallbacksList, { callbacks: operation.callbacks, onExpand: setSelectedCallback, selectedCallback: selectedCallback })] })) : null, _jsx(RenderHook, { Hook: AfterOpenApiOperation || unstable_hooks?.AfterOperation, props: { operation } })] }), selectedCallback ? (_jsx(OperationSamplesPanel, { isStacked: isStacked, "data-testid": "samples-block", children: _jsx(CallbackSamples, { callback: selectedCallback, translate: translate }) })) : null] }), _jsx(OperationSubRowStyled, { layout: layout, children: _jsx(SamplesMiddlePanel, { isStacked: isStacked, fullWidth: true, children: renderFeedback }) })] }));
|
|
60
|
+
}
|
|
61
|
+
export const OperationItem = memo(OperationItemComponent);
|
|
62
|
+
export const OperationSamplesPanel = styled(SamplesPanel) `
|
|
2
63
|
margin-left: auto;
|
|
3
64
|
--code-block-padding: var(--spacing-xs) 0 var(--spacing-xs) 20px;
|
|
4
|
-
|
|
65
|
+
`;
|
|
66
|
+
const FeedbackWrapper = styled.div `
|
|
5
67
|
& > div {
|
|
6
68
|
flex: 1 1 auto;
|
|
7
69
|
display: flex;
|
|
@@ -12,10 +74,13 @@ import{jsx as e,jsxs as t,Fragment as N}from"react/jsx-runtime";import{memo as V
|
|
|
12
74
|
width: 100%;
|
|
13
75
|
max-width: var(--feedback-width);
|
|
14
76
|
}
|
|
15
|
-
|
|
77
|
+
`;
|
|
78
|
+
const OperationRow = styled(Row) `
|
|
16
79
|
flex-direction: column;
|
|
17
80
|
align-items: flex-start;
|
|
18
81
|
padding: var(--spacing-base) 0 calc(var(--spacing-xl) + var(--spacing-xs));
|
|
19
|
-
|
|
82
|
+
`;
|
|
83
|
+
const OperationSubRowStyled = styled(Row) `
|
|
20
84
|
margin: calc(var(--spacing-unit) * 2) 0;
|
|
21
|
-
`;
|
|
85
|
+
`;
|
|
86
|
+
//# sourceMappingURL=OperationItem.js.map
|
|
@@ -1 +1,70 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
4
|
+
import { OperationItem } from '../OperationItem';
|
|
5
|
+
import { normalizeOptions } from '../../../services';
|
|
6
|
+
import spec from './fixtures/petstore.json';
|
|
7
|
+
import definition from './fixtures/operationDefinition.json';
|
|
8
|
+
import { environmentAtom } from '../../../jotai/app';
|
|
9
|
+
import { globalStoreAtom } from '../../../jotai/store';
|
|
10
|
+
import { allOperationsAtom } from '../../../jotai/replay';
|
|
11
|
+
import { MockIntersectionObserver } from './__mocks__/mock-intersection-observer';
|
|
12
|
+
jest.mock('jotai', () => ({
|
|
13
|
+
...jest.requireActual('jotai'),
|
|
14
|
+
useAtomValue: jest.fn((a) => {
|
|
15
|
+
if (a === globalStoreAtom) {
|
|
16
|
+
return {
|
|
17
|
+
parser: {
|
|
18
|
+
definition: spec,
|
|
19
|
+
},
|
|
20
|
+
options: normalizeOptions({
|
|
21
|
+
codeSamples: {
|
|
22
|
+
languages: [{ lang: 'curl', label: 'curl' }],
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (a === environmentAtom) {
|
|
28
|
+
return [{}, ''];
|
|
29
|
+
}
|
|
30
|
+
if (a === allOperationsAtom) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
return {};
|
|
34
|
+
}),
|
|
35
|
+
useAtom: jest.fn((a) => {
|
|
36
|
+
if (a === environmentAtom) {
|
|
37
|
+
return [[{ server: {} }], jest.fn()];
|
|
38
|
+
}
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
activeOneOf: { '/paths/~1pet/post': 0 },
|
|
42
|
+
requestValues: {},
|
|
43
|
+
request: { expandedFields: {} },
|
|
44
|
+
response: { expandedFields: {} },
|
|
45
|
+
activeLanguage: 'curl',
|
|
46
|
+
},
|
|
47
|
+
jest.fn(),
|
|
48
|
+
];
|
|
49
|
+
}),
|
|
50
|
+
}));
|
|
51
|
+
describe('OperationItem', () => {
|
|
52
|
+
beforeAll(() => {
|
|
53
|
+
window.IntersectionObserver = MockIntersectionObserver;
|
|
54
|
+
});
|
|
55
|
+
it('should render badges with correct position', () => {
|
|
56
|
+
const { getByTestId } = render(_jsx(OperationItem, { item: {
|
|
57
|
+
operationDefinition: definition,
|
|
58
|
+
parent: undefined,
|
|
59
|
+
href: 'test',
|
|
60
|
+
} }), {
|
|
61
|
+
wrapper: BrowserRouter,
|
|
62
|
+
});
|
|
63
|
+
const parentElement = getByTestId('operation-item-header');
|
|
64
|
+
const childNodes = parentElement.childNodes;
|
|
65
|
+
expect(childNodes[1].textContent).toBe('Alpha');
|
|
66
|
+
expect(childNodes[3].textContent).toBe('Beta');
|
|
67
|
+
expect(childNodes[4].textContent).toBe('Gamma');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=OperationItem.test.js.map
|
|
@@ -1 +1,40 @@
|
|
|
1
|
-
class
|
|
1
|
+
export class MockIntersectionObserver {
|
|
2
|
+
root;
|
|
3
|
+
rootMargin;
|
|
4
|
+
thresholds;
|
|
5
|
+
viewPort;
|
|
6
|
+
entries;
|
|
7
|
+
callback;
|
|
8
|
+
constructor(callback, options) {
|
|
9
|
+
this.viewPort = options?.root ? options.root : window;
|
|
10
|
+
this.entries = [];
|
|
11
|
+
this.root = null;
|
|
12
|
+
this.rootMargin = '0px';
|
|
13
|
+
this.thresholds = [1];
|
|
14
|
+
this.callback = callback;
|
|
15
|
+
this.viewPort.addEventListener('scroll', this.intersect);
|
|
16
|
+
}
|
|
17
|
+
intersect = () => {
|
|
18
|
+
this.entries.map((entry) => {
|
|
19
|
+
entry.isIntersecting = this.isInViewPort(entry.target);
|
|
20
|
+
});
|
|
21
|
+
this.callback(this.entries, this);
|
|
22
|
+
};
|
|
23
|
+
isInViewPort(target) {
|
|
24
|
+
return target.id !== 'toc-0';
|
|
25
|
+
}
|
|
26
|
+
observe(target) {
|
|
27
|
+
this.entries.push({ isIntersecting: false, target });
|
|
28
|
+
}
|
|
29
|
+
unobserve(target) {
|
|
30
|
+
this.entries = this.entries.filter((ob) => ob.target !== target);
|
|
31
|
+
}
|
|
32
|
+
disconnect() {
|
|
33
|
+
this.viewPort.removeEventListener('scroll', this.intersect);
|
|
34
|
+
this.entries = [];
|
|
35
|
+
}
|
|
36
|
+
takeRecords() {
|
|
37
|
+
return this.entries;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=mock-intersection-observer.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { OperationItem } from './OperationItem.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,47 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { styled } from '../styled-components.js';
|
|
4
|
+
const INVALID_KEY = 'Invalid license key';
|
|
5
|
+
const INVALID_KEY_MISSING = INVALID_KEY + ': missing key';
|
|
6
|
+
const EXPIRED = 'Invalid license key: expired';
|
|
7
|
+
const TRIAL_EXPIRED = EXPIRED;
|
|
8
|
+
const INVALID_HOST = 'Invalid license key: host not allowed';
|
|
9
|
+
export const Overlay = ({ licenseInfo }) => {
|
|
10
|
+
const [m, setM] = useState(null); // error message
|
|
11
|
+
const [exp, setExp] = useState(-1); // expires in
|
|
12
|
+
const [local, setLocal] = useState(false); // local preview?
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (licenseInfo.local) {
|
|
15
|
+
setLocal(true);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!licenseInfo.valid) {
|
|
19
|
+
setM(licenseInfo.valid === false
|
|
20
|
+
? INVALID_KEY + (licenseInfo.cryptoMissing ? ': works only with https' : '')
|
|
21
|
+
: INVALID_KEY_MISSING);
|
|
22
|
+
}
|
|
23
|
+
else if (!licenseInfo.allowed) {
|
|
24
|
+
setM(INVALID_HOST);
|
|
25
|
+
}
|
|
26
|
+
else if (licenseInfo.expired) {
|
|
27
|
+
setM(licenseInfo.t ? EXPIRED : TRIAL_EXPIRED);
|
|
28
|
+
}
|
|
29
|
+
if (licenseInfo.t) {
|
|
30
|
+
setExp(Math.ceil(((licenseInfo?.e ?? 0) - Date.now() / 1000) / 60 / 60 / 24));
|
|
31
|
+
}
|
|
32
|
+
}, [licenseInfo]);
|
|
33
|
+
if (local) {
|
|
34
|
+
return (_jsxs(TrialWrap, { children: [_jsx("a", { href: "https://redoc.ly", children: "Redocly API reference docs" }), " preview"] }));
|
|
35
|
+
}
|
|
36
|
+
if (!m && exp > -1) {
|
|
37
|
+
return _jsxs(TrialWrap, { children: [" Trial version: ", exp, " days remaining "] });
|
|
38
|
+
}
|
|
39
|
+
if (m) {
|
|
40
|
+
return (_jsx(Flash, { children: _jsxs("span", { children: [m, " ", _jsx("br", {}), _jsxs("small", { children: ["Please contact ", _jsx("a", { href: "mailto:team@redoc.ly", children: "team@redoc.ly" }), " to remedy the problem.", ' '] })] }) }));
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
const TrialWrap = styled.div `
|
|
2
45
|
padding: 10px 40px;
|
|
3
46
|
position: fixed;
|
|
4
47
|
text-align: right;
|
|
@@ -12,7 +55,8 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useState as o,useEffect
|
|
|
12
55
|
a:visited {
|
|
13
56
|
color: orange;
|
|
14
57
|
}
|
|
15
|
-
|
|
58
|
+
`;
|
|
59
|
+
const Flash = styled.div `
|
|
16
60
|
font-size: 1.5em;
|
|
17
61
|
position: fixed;
|
|
18
62
|
z-index: var(--z-index-raised);
|
|
@@ -39,4 +83,5 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useState as o,useEffect
|
|
|
39
83
|
a:visited {
|
|
40
84
|
color: white;
|
|
41
85
|
}
|
|
42
|
-
`;
|
|
86
|
+
`;
|
|
87
|
+
//# sourceMappingURL=Overlay.js.map
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { CopyButton } from '@redocly/theme/components/Buttons/CopyButton';
|
|
3
|
+
import { NewTabButton } from '@redocly/theme/components/Buttons/NewTabButton';
|
|
4
|
+
import { EmailButton } from '@redocly/theme/components/Buttons/EmailButton';
|
|
5
|
+
import { PanelItem, PanelItemDescription, PanelItemsList } from '../PanelItem/index.js';
|
|
6
|
+
export function Overview({ info, translate }) {
|
|
7
|
+
const website = (info.contact && info.contact.url && (_jsx(PanelItem, { header: _jsx(PanelItemDescription, { children: translate('openapi.info.contact.url', 'URL') }), title: _jsx("a", { href: info.contact.url, target: "_blank", rel: "noreferrer", children: info.contact.url }), actions: [_jsx(NewTabButton, { data: info.contact.url }, "NewTabButton")] }))) ||
|
|
8
|
+
null;
|
|
9
|
+
const email = (info.contact && info.contact.email && (_jsx(PanelItem, { header: _jsx(PanelItemDescription, { children: info.contact.name || translate('openapi.info.contact.name', 'E-mail') }), title: _jsx("a", { href: 'mailto:' + info.contact.email, children: info.contact.email }), actions: [
|
|
10
|
+
_jsx(CopyButton, { data: info.contact.email }, "CopyButton"),
|
|
11
|
+
_jsx(EmailButton, { data: info.contact.email }, "EmailButton"),
|
|
12
|
+
] }))) ||
|
|
13
|
+
null;
|
|
14
|
+
const license = (info.license && (_jsx(PanelItem, { header: _jsx(PanelItemDescription, { children: translate('openapi.info.license', 'License') }), title: info.license.identifier ? (info.license.identifier) : (_jsx("a", { href: info.license.url, target: "_blank", rel: "noreferrer", children: info.license.name })), actions: [_jsx(NewTabButton, { data: info.license.url || '' }, "NewTabButton")] }))) ||
|
|
15
|
+
null;
|
|
16
|
+
const terms = (info.termsOfService && (_jsx(PanelItem, { title: _jsx("a", { href: info.termsOfService, target: "_blank", rel: "noreferrer", children: translate('openapi.info.termsOfService', 'Terms of Service') }), actions: [_jsx(NewTabButton, { data: info.termsOfService }, info.termsOfService)] }))) ||
|
|
17
|
+
null;
|
|
18
|
+
return (_jsx(_Fragment, { children: _jsxs(PanelItemsList, { children: [website, email, license, terms] }) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Overview.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { Overview } from './Overview.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useAtomValue } from 'jotai';
|
|
4
|
+
import { OpenApiFooter } from '@redocly/theme/components/OpenApiDocs/hooks/OpenApiFooter';
|
|
5
|
+
import { globalOptionsAtom } from '../../jotai/store.js';
|
|
6
|
+
import { RenderHook } from '../RenderHook/index.js';
|
|
7
|
+
export function PageFooterComponent() {
|
|
8
|
+
const { unstable_hooks: { MiddlePanelFooter }, } = useAtomValue(globalOptionsAtom);
|
|
9
|
+
switch (true) {
|
|
10
|
+
case Boolean(MiddlePanelFooter):
|
|
11
|
+
return _jsx(RenderHook, { Hook: MiddlePanelFooter, props: undefined });
|
|
12
|
+
case Boolean(OpenApiFooter):
|
|
13
|
+
return _jsx(OpenApiFooter, {});
|
|
14
|
+
default:
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export const PageFooter = memo(PageFooterComponent);
|
|
19
|
+
//# sourceMappingURL=PageFooter.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { PageFooter } from './PageFooter.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import{Panel
|
|
2
|
-
|
|
1
|
+
import { Panel } from '@redocly/theme/components/Panel/Panel';
|
|
2
|
+
import { FieldsGroupHeader } from '../common/headers.js';
|
|
3
|
+
import { Trigger } from './Trigger.js';
|
|
4
|
+
import { styled } from '../../styled-components.js';
|
|
5
|
+
export const StyledResponsePanel = styled(Panel) `
|
|
6
|
+
${FieldsGroupHeader} {
|
|
3
7
|
&:first-child {
|
|
4
8
|
margin-top: 0;
|
|
5
9
|
}
|
|
6
10
|
}
|
|
7
11
|
|
|
8
|
-
${
|
|
12
|
+
${Trigger} {
|
|
9
13
|
flex: 1;
|
|
10
14
|
max-width: 100%;
|
|
11
15
|
justify-content: space-between;
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
`;
|
|
18
|
+
export const CallbackPanel = styled(StyledResponsePanel) `
|
|
14
19
|
border-bottom: 1px solid var(--border-color-primary);
|
|
15
20
|
&:not(:last-child) {
|
|
16
21
|
margin-bottom: 0;
|
|
17
22
|
border-radius: 0;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
${
|
|
25
|
+
${Trigger} {
|
|
21
26
|
max-width: calc(100% - 9px - var(--spacing-unit)); /* shelf icon size and small padding */
|
|
22
27
|
justify-content: flex-start;
|
|
23
28
|
}
|
|
24
|
-
`;
|
|
29
|
+
`;
|
|
30
|
+
//# sourceMappingURL=ResponsePanel.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import{styled
|
|
1
|
+
import { styled } from '../../styled-components.js';
|
|
2
|
+
export const Trigger = styled.div `
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
align-items: center;
|
|
4
5
|
white-space: nowrap;
|
|
5
6
|
overflow: hidden;
|
|
6
7
|
text-overflow: ellipsis;
|
|
7
|
-
`;
|
|
8
|
+
`;
|
|
9
|
+
//# sourceMappingURL=Trigger.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PanelItemWrap, Item, Header, Title, ActionsWrap, StyledCheckmarkIcon } from './styled.js';
|
|
3
|
+
export const PanelItem = ({ header, title, actions, active, withCheckmark }) => {
|
|
4
|
+
return (_jsxs(PanelItemWrap, { children: [_jsxs(Item, { children: [header && (typeof header === 'string' ? _jsx(Header, { children: header }) : header), _jsxs(Title, { active: active, suppressHydrationWarning: true, children: [withCheckmark && active && _jsx(StyledCheckmarkIcon, {}), " ", title] })] }), _jsx(ActionsWrap, { children: actions?.map((action) => action) })] }));
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=PanelItem.js.map
|