@redocly/openapi-docs 3.0.0-alpha.29.alpha.0 → 3.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/console.redocly-openapi-docs.min.js +1 -1
  2. package/dist/oauth2-redirect.js +1 -1
  3. package/dist/redocly-openapi-docs.min.js +784 -743
  4. package/lib/components/ApiInfo/ApiInfo.d.ts +4 -1
  5. package/lib/components/ApiInfo/ApiInfo.js +1 -1
  6. package/lib/components/ContentItem/ContentItem.d.ts +0 -3
  7. package/lib/components/ContentItem/ContentItem.js +1 -1
  8. package/lib/components/ContentItems/ContentItems.d.ts +1 -7
  9. package/lib/components/ContentItems/ContentItems.js +1 -1
  10. package/lib/components/ContentItems/helpers.d.ts +9 -0
  11. package/lib/components/ContentItems/helpers.js +1 -1
  12. package/lib/components/Fields/FieldDetails.js +1 -1
  13. package/lib/components/Fields/styled.d.ts +1 -0
  14. package/lib/components/Fields/styled.js +5 -1
  15. package/lib/components/OperationItem/OperationItem.js +2 -2
  16. package/lib/components/RedoclyOpenAPIDocs/Providers.d.ts +1 -1
  17. package/lib/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  18. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +3 -1
  19. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  20. package/lib/components/RedoclyOpenAPIDocs/styled.d.ts +2 -2
  21. package/lib/components/RedoclyOpenAPIDocs/styled.js +8 -27
  22. package/lib/components/RedoclyOpenAPIDocs/types.d.ts +6 -4
  23. package/lib/components/SchemaDefinition/SchemaDefinition.js +1 -1
  24. package/lib/components/SectionContent/SectionContent.d.ts +1 -2
  25. package/lib/components/SectionContent/SectionContent.js +1 -1
  26. package/lib/components/SideMenu/Actions.d.ts +2 -0
  27. package/lib/components/SideMenu/Actions.js +2 -0
  28. package/lib/components/SideMenu/MenuItem.d.ts +2 -0
  29. package/lib/components/SideMenu/MenuItem.js +1 -1
  30. package/lib/components/SideMenu/MenuItemLink.js +1 -1
  31. package/lib/components/SideMenu/MenuItems.js +1 -1
  32. package/lib/components/SideMenu/styled.d.ts +3 -1
  33. package/lib/components/SideMenu/styled.js +1 -1
  34. package/lib/components/StickySidebar/StickyResponsiveSidebar.d.ts +1 -0
  35. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +6 -6
  36. package/lib/components/TagItems/TagItems.js +1 -1
  37. package/lib/components/common/panels.d.ts +1 -1
  38. package/lib/components/common/panels.js +2 -2
  39. package/lib/components/index.d.ts +1 -3
  40. package/lib/components/index.js +1 -1
  41. package/lib/constants.d.ts +0 -4
  42. package/lib/constants.js +1 -1
  43. package/lib/hoc/types.d.ts +18 -0
  44. package/lib/hoc/withStore.d.ts +3 -0
  45. package/lib/hoc/withStore.js +2 -0
  46. package/lib/models/group.d.ts +1 -1
  47. package/lib/models/group.js +1 -1
  48. package/lib/models/index.d.ts +1 -1
  49. package/lib/models/index.js +1 -1
  50. package/lib/models/types.d.ts +2 -1
  51. package/lib/recoil/app.d.ts +3 -1
  52. package/lib/recoil/app.js +1 -1
  53. package/lib/services/OpenAPIParser.d.ts +0 -1
  54. package/lib/services/OpenAPIParser.js +1 -1
  55. package/lib/services/Options/normalizeOptions.js +1 -1
  56. package/lib/services/Options/types.d.ts +3 -2
  57. package/lib/services/menu/builder.js +1 -1
  58. package/lib/services/menu/markdown.js +1 -1
  59. package/lib/services/menu/tags.js +1 -1
  60. package/lib/services/types.d.ts +1 -0
  61. package/lib/standalone.d.ts +1 -1
  62. package/lib/types/open-api.d.ts +0 -1
  63. package/lib/utils/helpers.js +1 -1
  64. package/lib-esm/components/ApiInfo/ApiInfo.d.ts +4 -1
  65. package/lib-esm/components/ApiInfo/ApiInfo.js +1 -1
  66. package/lib-esm/components/ContentItem/ContentItem.d.ts +0 -3
  67. package/lib-esm/components/ContentItem/ContentItem.js +1 -1
  68. package/lib-esm/components/ContentItems/ContentItems.d.ts +1 -7
  69. package/lib-esm/components/ContentItems/ContentItems.js +1 -1
  70. package/lib-esm/components/ContentItems/helpers.d.ts +9 -0
  71. package/lib-esm/components/ContentItems/helpers.js +1 -1
  72. package/lib-esm/components/Fields/FieldDetails.js +1 -1
  73. package/lib-esm/components/Fields/styled.d.ts +1 -0
  74. package/lib-esm/components/Fields/styled.js +4 -0
  75. package/lib-esm/components/OperationItem/OperationItem.js +2 -2
  76. package/lib-esm/components/RedoclyOpenAPIDocs/Providers.d.ts +1 -1
  77. package/lib-esm/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  78. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +3 -1
  79. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  80. package/lib-esm/components/RedoclyOpenAPIDocs/styled.d.ts +2 -2
  81. package/lib-esm/components/RedoclyOpenAPIDocs/styled.js +32 -51
  82. package/lib-esm/components/RedoclyOpenAPIDocs/types.d.ts +6 -4
  83. package/lib-esm/components/SchemaDefinition/SchemaDefinition.js +1 -1
  84. package/lib-esm/components/SectionContent/SectionContent.d.ts +1 -2
  85. package/lib-esm/components/SectionContent/SectionContent.js +1 -1
  86. package/lib-esm/components/SideMenu/Actions.d.ts +2 -0
  87. package/lib-esm/components/SideMenu/Actions.js +2 -0
  88. package/lib-esm/components/SideMenu/MenuItem.d.ts +2 -0
  89. package/lib-esm/components/SideMenu/MenuItem.js +1 -1
  90. package/lib-esm/components/SideMenu/MenuItemLink.js +1 -1
  91. package/lib-esm/components/SideMenu/MenuItems.js +1 -1
  92. package/lib-esm/components/SideMenu/styled.d.ts +3 -1
  93. package/lib-esm/components/SideMenu/styled.js +1 -1
  94. package/lib-esm/components/StickySidebar/StickyResponsiveSidebar.d.ts +1 -0
  95. package/lib-esm/components/StickySidebar/StickyResponsiveSidebar.js +6 -6
  96. package/lib-esm/components/TagItems/TagItems.js +1 -1
  97. package/lib-esm/components/common/panels.d.ts +1 -1
  98. package/lib-esm/components/common/panels.js +2 -2
  99. package/lib-esm/components/index.d.ts +1 -3
  100. package/lib-esm/components/index.js +1 -1
  101. package/lib-esm/constants.d.ts +0 -4
  102. package/lib-esm/constants.js +1 -1
  103. package/lib-esm/hoc/types.d.ts +18 -0
  104. package/lib-esm/hoc/withStore.d.ts +3 -0
  105. package/lib-esm/hoc/withStore.js +2 -0
  106. package/lib-esm/models/group.d.ts +1 -1
  107. package/lib-esm/models/group.js +1 -1
  108. package/lib-esm/models/index.d.ts +1 -1
  109. package/lib-esm/models/index.js +1 -1
  110. package/lib-esm/models/types.d.ts +2 -1
  111. package/lib-esm/recoil/app.d.ts +3 -1
  112. package/lib-esm/recoil/app.js +1 -1
  113. package/lib-esm/services/OpenAPIParser.d.ts +0 -1
  114. package/lib-esm/services/OpenAPIParser.js +1 -1
  115. package/lib-esm/services/Options/normalizeOptions.js +1 -1
  116. package/lib-esm/services/Options/types.d.ts +3 -2
  117. package/lib-esm/services/menu/builder.js +1 -1
  118. package/lib-esm/services/menu/markdown.js +1 -1
  119. package/lib-esm/services/menu/tags.js +1 -1
  120. package/lib-esm/services/types.d.ts +1 -0
  121. package/lib-esm/standalone.d.ts +1 -1
  122. package/lib-esm/types/open-api.d.ts +0 -1
  123. package/lib-esm/utils/helpers.js +1 -1
  124. package/package.json +3 -3
  125. package/lib/components/ChangeViewButton/ChangeViewButton.d.ts +0 -2
  126. package/lib/components/ChangeViewButton/ChangeViewButton.js +0 -2
  127. package/lib/components/ChangeViewButton/index.d.ts +0 -1
  128. package/lib/components/ChangeViewButton/index.js +0 -2
  129. package/lib/components/ChangeViewButton/styled.d.ts +0 -4
  130. package/lib/components/ChangeViewButton/styled.js +0 -18
  131. package/lib/components/ToggleRightPanelButton/ToggleRightPanelButton.d.ts +0 -2
  132. package/lib/components/ToggleRightPanelButton/ToggleRightPanelButton.js +0 -2
  133. package/lib/components/ToggleRightPanelButton/index.d.ts +0 -1
  134. package/lib/components/ToggleRightPanelButton/index.js +0 -2
  135. package/lib/components/ToggleRightPanelButton/styled.d.ts +0 -4
  136. package/lib/components/ToggleRightPanelButton/styled.js +0 -17
  137. package/lib-esm/components/ChangeViewButton/ChangeViewButton.d.ts +0 -2
  138. package/lib-esm/components/ChangeViewButton/ChangeViewButton.js +0 -2
  139. package/lib-esm/components/ChangeViewButton/index.d.ts +0 -1
  140. package/lib-esm/components/ChangeViewButton/index.js +0 -2
  141. package/lib-esm/components/ChangeViewButton/styled.d.ts +0 -4
  142. package/lib-esm/components/ChangeViewButton/styled.js +0 -18
  143. package/lib-esm/components/ToggleRightPanelButton/ToggleRightPanelButton.d.ts +0 -2
  144. package/lib-esm/components/ToggleRightPanelButton/ToggleRightPanelButton.js +0 -2
  145. package/lib-esm/components/ToggleRightPanelButton/index.d.ts +0 -1
  146. package/lib-esm/components/ToggleRightPanelButton/index.js +0 -2
  147. package/lib-esm/components/ToggleRightPanelButton/styled.d.ts +0 -4
  148. package/lib-esm/components/ToggleRightPanelButton/styled.js +0 -17
@@ -1,4 +1,4 @@
1
- import React from"react";import styled from"styled-components";import{useRecoilValue}from"recoil";import{showRightPanelToggleSelector}from"../../recoil/app";import{SamplesMiddlePanel,Row,Section,SamplesPanel}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown,StyledMarkdownBlock}from"../Markdown";import{DownloadButtonWithLabel}from"../Download";import{RenderHook}from"../RenderHook";import{ApiHeader,InfoSpan,InfoSpanBox,InfoSpanBoxWrap}from"./styled";import{globalStoreSelector}from"../../recoil/store";import{saveTextBeforeHeading}from"../../utils/saveTextBeforeHeading";import{getValueFromMdParsedExtension}from"../../utils/helpers";import{ServerList}from"../Endpoint/ServerList";import{CodePanel}from"../Panel/CodePanel";import{normalizeServers}from"../../utils/openapi";import{mergeInMockServer}from"../../models/operation";export function ApiInfo(){const{options:{markdownHeadingsAnchorLevel:e,hooks:t,hideDownloadButton:o,expandDefaultServerVariables:n,mockServer:a},parser:{definition:r,definitionUrl:l}}=useRecoilValue(globalStoreSelector),c=useRecoilValue(showRightPanelToggleSelector),i=saveTextBeforeHeading(getValueFromMdParsedExtension(null==r?void 0:r.info,"description")||"",e),m=getValueFromMdParsedExtension(null==r?void 0:r.info,"summary")||void 0,s=null==r?void 0:r.info,d=null==r?void 0:r.externalDocs,p=normalizeServers(l,mergeInMockServer(r.servers||[],a));if(!s)return null;const f=s.license&&React.createElement(InfoSpan,null,"License:"," ",s.license.identifier?s.license.identifier:React.createElement("a",{href:s.license.url},s.license.name))||null,u=s.contact&&s.contact.url&&React.createElement(InfoSpan,null,"URL: ",React.createElement("a",{href:s.contact.url},s.contact.url))||null,S=s.contact&&s.contact.email&&React.createElement(InfoSpan,null,s.contact.name||"E-mail",":"," ",React.createElement("a",{href:"mailto:"+s.contact.email},s.contact.email))||null,R=s.termsOfService&&React.createElement(InfoSpan,null,React.createElement("a",{href:s.termsOfService},"Terms of Service"))||null,E=s.version&&React.createElement("span",null,"(",s.version,")")||null;return React.createElement(Section,null,React.createElement(Row,null,React.createElement(SamplesMiddlePanel,{className:"api-info"},React.createElement(ApiHeader,null,s.title," ",E),React.createElement(RenderHook,{Hook:null==t?void 0:t.AfterApiTitle,props:{info:s}}),!o&&React.createElement(DownloadButtonWithLabel,{wrapped:!0}),React.createElement(StyledMarkdownBlock,null,(s.license||s.contact||s.termsOfService)&&React.createElement(InfoSpanBoxWrap,null,React.createElement(InfoSpanBox,null,S," ",u," ",f," ",R))||null),m&&React.createElement(Markdown,{source:m,"data-role":"redoc-summary"}),i&&React.createElement(Markdown,{source:i,"data-role":"redoc-description"}),d&&React.createElement(ExternalDocumentation,{externalDocs:d})),c&&p.length?React.createElement(InfoSamplesPanel,{"data-cy":"samples-block"},React.createElement(CodePanel,{className:"panel-try-it",header:"Servers",expanded:!0},React.createElement(ServerList,{servers:p,path:"/",expandVariables:Boolean(n),hideHostname:!1}))):null))}const InfoSamplesPanel=styled(SamplesPanel)`
1
+ import React from"react";import styled from"styled-components";import{useRecoilValue}from"recoil";import{layoutSelector,showRightPanelToggleSelector}from"../../recoil/app";import{SamplesMiddlePanel,Row,Section,SamplesPanel}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown,StyledMarkdownBlock}from"../Markdown";import{DownloadButtonWithLabel}from"../Download";import{RenderHook}from"../RenderHook";import{ApiHeader,InfoSpan,InfoSpanBox,InfoSpanBoxWrap}from"./styled";import{globalStoreSelector}from"../../recoil/store";import{saveTextBeforeHeading}from"../../utils/saveTextBeforeHeading";import{getValueFromMdParsedExtension}from"../../utils/helpers";import{ServerList}from"../Endpoint/ServerList";import{CodePanel}from"../Panel/CodePanel";import{normalizeServers}from"../../utils/openapi";import{mergeInMockServer}from"../../models/operation";export function ApiInfo({item:{infoDefinition:e}}){const{options:{markdownHeadingsAnchorLevel:t,hooks:o,hideDownloadButton:n,expandDefaultServerVariables:a,mockServer:r,hideInfoSection:l,hideInfoDescription:c},parser:{definition:i,definitionUrl:m}}=useRecoilValue(globalStoreSelector),s=useRecoilValue(showRightPanelToggleSelector),d=useRecoilValue(layoutSelector);if(!e||l)return null;const p=c?null:saveTextBeforeHeading(getValueFromMdParsedExtension(e,"description")||"",t),u=getValueFromMdParsedExtension(e,"summary")||void 0,f=null==i?void 0:i.externalDocs,S=normalizeServers(m,mergeInMockServer(i.servers||[],r)),R=e.license&&React.createElement(InfoSpan,null,"License:"," ",e.license.identifier?e.license.identifier:React.createElement("a",{href:e.license.url},e.license.name))||null,E=e.contact&&e.contact.url&&React.createElement(InfoSpan,null,"URL: ",React.createElement("a",{href:e.contact.url},e.contact.url))||null,v=e.contact&&e.contact.email&&React.createElement(InfoSpan,null,e.contact.name||"E-mail",":"," ",React.createElement("a",{href:"mailto:"+e.contact.email},e.contact.email))||null,h=e.termsOfService&&React.createElement(InfoSpan,null,React.createElement("a",{href:e.termsOfService},"Terms of Service"))||null,g=e.version&&React.createElement("span",null,"(",e.version,")")||null;return React.createElement(Section,null,React.createElement(Row,{layout:d},React.createElement(SamplesMiddlePanel,{className:"api-info"},React.createElement(ApiHeader,null,e.title," ",g),React.createElement(RenderHook,{Hook:null==o?void 0:o.AfterApiTitle,props:{info:e}}),!n&&React.createElement(DownloadButtonWithLabel,{wrapped:!0}),React.createElement(StyledMarkdownBlock,null,(e.license||e.contact||e.termsOfService)&&React.createElement(InfoSpanBoxWrap,null,React.createElement(InfoSpanBox,null,v," ",E," ",R," ",h))||null),u&&React.createElement(Markdown,{source:u,"data-role":"redoc-summary"}),p&&React.createElement(Markdown,{source:p,"data-role":"redoc-description"}),f&&React.createElement(ExternalDocumentation,{externalDocs:f})),s&&S.length?React.createElement(InfoSamplesPanel,{"data-cy":"samples-block"},React.createElement(CodePanel,{className:"panel-try-it",header:"Servers",expanded:!0},React.createElement(ServerList,{servers:S,path:"/",expandVariables:Boolean(a),hideHostname:!1}))):null))}const InfoSamplesPanel=styled(SamplesPanel)`
2
2
  margin-top: calc(var(--h1-font-size) * 1.5);
3
3
  `;
4
4
  //# sourceMappingURL=ApiInfo.js.map
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
- import type { Options, Pagination } from '../../services';
3
2
  import type { ContentItemModel } from '../../models';
4
3
  interface ContentItemProps {
5
4
  item: ContentItemModel;
6
- pagination: Pagination;
7
- showNextButton: Options['showNextButton'];
8
5
  withChildren?: boolean;
9
6
  }
10
7
  export declare const ContentItem: React.NamedExoticComponent<ContentItemProps>;
@@ -1,2 +1,2 @@
1
- import React,{memo}from"react";import{TagItem}from"../TagItem";import{SectionItem}from"../SectionItem";import{OperationItem}from"../OperationItem";import{Section}from"../common";import{ContentItems}from"../ContentItems";const ContentComponentMap={group:null,tag:TagItem,section:SectionItem,schema:TagItem,operation:OperationItem};function ContentItemComponent({item:t,pagination:e,showNextButton:o,withChildren:n=!0}){var m;const i=ContentComponentMap[t.type];return React.createElement(React.Fragment,null,i&&React.createElement(Section,{id:t.id,sectionId:t.id,underlined:"operation"===t.type||"schema"===t.type},React.createElement(i,{item:t})),n&&Boolean(null===(m=t.items)||void 0===m?void 0:m.length)&&React.createElement(ContentItems,{items:t.items,pagination:e,showNextButton:o,showApiInfo:!1}))}export const ContentItem=memo(ContentItemComponent);
1
+ import React,{memo}from"react";import{TagItem}from"../TagItem";import{SectionItem}from"../SectionItem";import{OperationItem}from"../OperationItem";import{Section}from"../common";import{ContentItems}from"../ContentItems";import{ApiInfo}from"../ApiInfo";import{isRootItem}from"../ContentItems/helpers";const ContentComponentMap={group:null,tag:TagItem,section:SectionItem,schema:TagItem,operation:OperationItem,root:ApiInfo};function ContentItemComponent({item:t,withChildren:e=!0}){var o;const n=ContentComponentMap[isRootItem(t)?"root":t.type];return React.createElement(React.Fragment,null,n&&React.createElement(Section,{id:t.id,sectionId:t.id,underlined:"operation"===t.type||"schema"===t.type},React.createElement(n,{item:t})),e&&Boolean(null===(o=t.items)||void 0===o?void 0:o.length)&&React.createElement(ContentItems,{items:t.items}))}export const ContentItem=memo(ContentItemComponent);
2
2
  //# sourceMappingURL=ContentItem.js.map
@@ -1,15 +1,9 @@
1
1
  import React from 'react';
2
- import type { Options } from '../../services';
3
2
  import type { ContentItemModel } from '../../models';
4
- import { Pagination } from '../../services';
5
3
  interface ContentItemsProps {
6
4
  root?: boolean;
7
5
  items: ContentItemModel[];
8
- pagination: Pagination;
9
- showNextButton: Options['showNextButton'];
10
- disablePaginationLoadingAnimation?: Options['disablePaginationLoadingAnimation'];
11
- showApiInfo: boolean;
12
6
  }
13
- declare function ContentItemsComponent({ items, root, pagination, showNextButton, showApiInfo, disablePaginationLoadingAnimation, }: ContentItemsProps): JSX.Element | null;
7
+ declare function ContentItemsComponent({ items, root }: ContentItemsProps): JSX.Element | null;
14
8
  export declare const ContentItems: React.MemoExoticComponent<typeof ContentItemsComponent>;
15
9
  export {};
@@ -1,2 +1,2 @@
1
- import React,{memo,useMemo,useState,useEffect,useCallback}from"react";import{Navigate,Route,Routes}from"react-router-dom";import{Pagination}from"../../services";import{IS_BROWSER}from"../../utils";import{Skeleton}from"../common";import{getNextSectionLink}from"./helpers";import{SectionContent}from"../SectionContent";import{TagItems}from"../TagItems";import{useAutoScroll}from"./useAutoScroll";import{ContentItem}from"../ContentItem";let isInitialHydrate=!0;function ContentItemsComponent({items:e,root:t=!1,pagination:n,showNextButton:o,showApiInfo:a,disablePaginationLoadingAnimation:i}){const[m,r]=useState(IS_BROWSER&&!isInitialHydrate&&!i);useEffect((()=>{const e=setTimeout((()=>{r(!1)}),200);return isInitialHydrate=!1,()=>{clearTimeout(e)}}),[]),useAutoScroll(m);const c=useMemo((()=>e.filter((e=>"group"===e.type))),[e]),l=useMemo((()=>e.filter((e=>"tag"===e.type))),[e]),u=useMemo((()=>e.filter((e=>"operation"===e.type))),[e]),s=useCallback(((e,t)=>null==e?void 0:e.map(((e,a)=>{var i;const m=getNextSectionLink({groupItems:c,groupIdx:t,tagIdx:a});switch(n){case Pagination.Item:return React.createElement(Route,{key:e.id,path:e.id},React.createElement(Route,{index:!0,element:"operation"===e.type?React.createElement(ContentItem,{key:e.id,item:e,pagination:n,showNextButton:o}):React.createElement(TagItems,{tag:e,nextSectionLink:m,pagination:n,showNextButton:o})}),null===(i=e.items)||void 0===i?void 0:i.map((e=>{const i=getNextSectionLink({groupItems:c,groupIdx:t,tagIdx:a});return React.createElement(Route,{key:e.id,path:e.id,element:React.createElement(TagItems,{tag:e,nextSectionLink:i,pagination:n,showNextButton:o})})})));case Pagination.Section:return React.createElement(Route,{key:e.id,path:e.id,element:React.createElement(TagItems,{tag:e,nextSectionLink:m,pagination:n,showNextButton:o})});default:return null}}))),[c,n,o]),p=useMemo((()=>React.createElement(Routes,null,React.createElement(Route,{path:"/",element:React.createElement(SectionContent,{items:e,nextSectionLink:getNextSectionLink({groupItems:c,groupIdx:0,tagIdx:0}),pagination:n,showNextButton:o,showApiInfo:a})}),c.length?c.map(((e,t)=>s(e.items,t))):s(l,0),u.length&&s(u,0),React.createElement(Route,{path:"*",element:React.createElement(Navigate,{to:"/",replace:!0})}))),[c,e,u,n,s,a,o,l]);return t&&!e.length?React.createElement(Routes,null,React.createElement(Route,{path:"*",element:React.createElement(SectionContent,{items:[],pagination:n,showNextButton:o,showApiInfo:a})})):e.length?m?React.createElement("div",{style:{flex:1,width:"100%"}},React.createElement(Skeleton,null)):React.createElement(React.Fragment,null,t?React.createElement(React.Fragment,null,p,n===Pagination.Section&&u.length&&u.map((e=>React.createElement(ContentItem,{key:e.id,item:e,pagination:n,showNextButton:o})))):e.map((e=>React.createElement(ContentItem,{key:e.id,item:e,pagination:n,showNextButton:o})))):null}export const ContentItems=memo(ContentItemsComponent);
1
+ import React,{memo,useMemo,useState,useEffect,useCallback}from"react";import{Navigate,Route,Routes}from"react-router-dom";import{useRecoilValue}from"recoil";import{Pagination}from"../../services";import{IS_BROWSER}from"../../utils";import{Skeleton}from"../common";import{getFirstPageLink,getItemsByType,getNextSectionLink}from"./helpers";import{SectionContent}from"../SectionContent";import{TagItems}from"../TagItems";import{useAutoScroll}from"./useAutoScroll";import{ContentItem}from"../ContentItem";import{globalOptionsSelector}from"../../recoil/store";let isInitialHydrate=!0;function ContentItemsComponent({items:e,root:t=!1}){const{pagination:n,showNextButton:o,disablePaginationLoadingAnimation:a}=useRecoilValue(globalOptionsSelector),[i,m]=useState(IS_BROWSER&&!isInitialHydrate&&!a);useEffect((()=>{const e=setTimeout((()=>{m(!1)}),200);return isInitialHydrate=!1,()=>{clearTimeout(e)}}),[]),useAutoScroll(i);const{groupItems:r,tagItems:c,operationItems:l,rootItem:s}=getItemsByType(e),u=!t||s?"/":getFirstPageLink(e)||"/",g=useCallback(((e,t)=>null==e?void 0:e.map(((e,a)=>{var i;const m=getNextSectionLink({groupItems:r,groupIdx:t,tagIdx:a});switch(n){case Pagination.Item:return React.createElement(Route,{key:e.id,path:e.id},React.createElement(Route,{index:!0,element:"operation"===e.type?React.createElement(ContentItem,{key:e.id,item:e}):React.createElement(TagItems,{tag:e,nextSectionLink:m,pagination:n,showNextButton:o})}),null===(i=e.items)||void 0===i?void 0:i.map((e=>{const i=getNextSectionLink({groupItems:r,groupIdx:t,tagIdx:a});return React.createElement(Route,{key:e.id,path:e.id,element:React.createElement(TagItems,{tag:e,nextSectionLink:i,pagination:n,showNextButton:o})})})));case Pagination.Section:return React.createElement(Route,{key:e.id,path:e.id,element:React.createElement(TagItems,{tag:e,nextSectionLink:m,pagination:n,showNextButton:o})});default:return null}}))),[r,n,o]),p=useMemo((()=>React.createElement(Routes,null,s&&React.createElement(Route,{path:s.href||"/",element:React.createElement(SectionContent,{items:e,nextSectionLink:getNextSectionLink({groupItems:r,groupIdx:0,tagIdx:0}),pagination:n,showNextButton:o})}),r.length?r.map(((e,t)=>g(e.items,t))):g(c,0),l.length&&g(l,0),React.createElement(Route,{path:"*",element:React.createElement(Navigate,{to:u,replace:!0})}))),[s,e,r,n,o,g,c,l,u]);return t&&!e.length?React.createElement(Routes,null,React.createElement(Route,{path:"*",element:React.createElement(SectionContent,{items:e,nextSectionLink:getNextSectionLink({groupItems:r,groupIdx:0,tagIdx:0}),pagination:n,showNextButton:o})})):e.length?i?React.createElement("div",{style:{flex:1,width:"100%"}},React.createElement(Skeleton,null)):React.createElement(React.Fragment,null,t?React.createElement(React.Fragment,null,p,n===Pagination.Section&&!!l.length&&l.map((e=>React.createElement(ContentItem,{key:e.id,item:e})))):e.map((e=>React.createElement(ContentItem,{key:e.id,item:e})))):null}export const ContentItems=memo(ContentItemsComponent);
2
2
  //# sourceMappingURL=ContentItems.js.map
@@ -1,3 +1,4 @@
1
+ import type { IMenuItem } from '../../services/types';
1
2
  import type { ContentItemModel } from '../../models';
2
3
  type GetNextSectionLinkInput = {
3
4
  groupItems: ContentItemModel[];
@@ -8,4 +9,12 @@ export declare function getNextSectionLink({ groupItems, groupIdx, tagIdx }: Get
8
9
  name: string;
9
10
  href?: string;
10
11
  };
12
+ export declare function isRootItem(item: ContentItemModel | IMenuItem): boolean;
13
+ export declare function getItemsByType(items: ContentItemModel[]): {
14
+ groupItems: ContentItemModel[];
15
+ tagItems: ContentItemModel[];
16
+ operationItems: ContentItemModel[];
17
+ rootItem: import("../../models").GroupModel | undefined;
18
+ };
19
+ export declare function getFirstPageLink(items: ContentItemModel[]): string;
11
20
  export {};
@@ -1,2 +1,2 @@
1
- export function getNextSectionLink({groupItems:e,groupIdx:n,tagIdx:t}){var r,i;if(null===(r=e[n])||void 0===r?void 0:r.items[t+1]){const{name:r,href:i}=e[n].items[t+1];return{name:r,href:i}}{const{name:t,href:r}=(null===(i=e[n+1])||void 0===i?void 0:i.items[0])||{};return{name:t,href:r}}}
1
+ import{normalizePath}from"../../services/utils";export function getNextSectionLink({groupItems:e,groupIdx:t,tagIdx:r}){var o,i;if(null===(o=e[t])||void 0===o?void 0:o.items[r+1]){const{name:o,href:i}=e[t].items[r+1];return{name:o,href:i}}{const{name:r,href:o}=(null===(i=e[t+1])||void 0===i?void 0:i.items[0])||{};return{name:r,href:o}}}export function isRootItem(e){return"section"===e.type&&""===e.id&&"/"===e.href}export function getItemsByType(e){const t=[],r=[],o=[];let i;for(const n of e)switch(n.type){case"group":t.push(n);break;case"tag":r.push(n);break;case"operation":o.push(n);break;case"section":isRootItem(n)&&(i=n)}return{groupItems:t,tagItems:r,operationItems:o,rootItem:i}}export function getFirstPageLink(e){for(const t of e){if("group"===t.type)return getFirstPageLink(t.items);if("tag"===t.type){if(!t.description)return normalizePath(getFirstPageLink(t.items));if(t.href)return normalizePath(t.href)}else if("operation"===t.type||"schema"===t.type)return normalizePath(t.href)}return"/"}
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1,2 +1,2 @@
1
- import React,{memo,useState}from"react";import{useRecoilValue}from"recoil";import{PatternLabel,RecursiveLabel,TypeFormat,TypeName,TypePrefix,TypeTitle,ToggleButton,Badge}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown}from"../Markdown";import{l}from"../../services";import{FieldDetail}from"./FieldDetail";import{ConstraintsView}from"./ConstraintsView";import{Extensions}from"./Extensions";import{EnumValues}from"./EnumValues";import{Examples,getSerializedValue}from"./Examples";import{TypeWrapper}from"./styled";import{globalOptionsSelector}from"../../recoil/store";const MAX_PATTERN_LENGTH=45;function FieldDetailsComponent({showExamples:e,field:t,renderDiscriminatorSwitch:a}){const[n,r]=useState(!1),{enumSkipQuotes:o,hideSchemaTitles:i,hideSchemaPattern:c}=useRecoilValue(globalOptionsSelector),{schema:m,description:s,example:p,deprecated:u,examples:E}=t,d=Boolean(o)||"header"===t.in;let R=null;if(e&&(void 0!==p||void 0!==E))if(void 0!==E)R=React.createElement(Examples,{field:t});else{const e=!!t.in;R=React.createElement(FieldDetail,{label:"example",value:getSerializedValue(t,t.example),raw:e})}return React.createElement("div",null,React.createElement(TypeWrapper,null,React.createElement(TypePrefix,null,m.typePrefix),React.createElement(TypeName,null,m.displayType),m.displayFormat&&React.createElement(TypeFormat,null," ","<",m.displayFormat,">"," "),m.contentEncoding&&React.createElement(TypeFormat,null," ","<",m.contentEncoding,">"," "),m.contentMediaType&&React.createElement(TypeFormat,null," ","<",m.contentMediaType,">"," "),m.title&&!i&&React.createElement(TypeTitle,null," (",m.title,") "),React.createElement(ConstraintsView,{constraints:m.constraints}),m.pattern&&!c&&React.createElement(React.Fragment,null,React.createElement(PatternLabel,null,n||m.pattern.length<MAX_PATTERN_LENGTH?m.pattern:`${m.pattern.substr(0,MAX_PATTERN_LENGTH)}...`),m.pattern.length>MAX_PATTERN_LENGTH&&React.createElement(ToggleButton,{onClick:()=>{r(!n)}},n?"Hide pattern":"Show pattern"))," ",m.isCircular&&React.createElement(RecursiveLabel,null,l("recursive"))),u&&React.createElement("div",null,React.createElement(Badge,{deprecated:!0,style:{marginLeft:0}}," ",l("deprecated")," ")),React.createElement(FieldDetail,{raw:d,label:"default",value:m.default}),React.createElement("div",null,React.createElement(Markdown,{source:s})),!a&&React.createElement(EnumValues,{type:m.type,values:m["x-enumDescriptions"]||m.enum})," ",R,React.createElement(Extensions,{extensions:Object.assign(Object.assign({},t.extensions),m.extensions)}),m.externalDocs&&React.createElement(ExternalDocumentation,{externalDocs:m.externalDocs,compact:!0}),null==a?void 0:a(),t.const&&React.createElement(FieldDetail,{label:"const",value:t.const})||null)}export const FieldDetails=memo(FieldDetailsComponent);
1
+ import React,{memo,useState}from"react";import{useRecoilValue}from"recoil";import{PatternLabel,RecursiveLabel,TypeFormat,TypeName,TypePrefix,TypeTitle,ToggleButton,Badge}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown}from"../Markdown";import{l}from"../../services";import{FieldDetail}from"./FieldDetail";import{ConstraintsView}from"./ConstraintsView";import{Extensions}from"./Extensions";import{EnumValues}from"./EnumValues";import{Examples,getSerializedValue}from"./Examples";import{TypeWrapper,FieldDescriptionWrapper}from"./styled";import{globalOptionsSelector}from"../../recoil/store";const MAX_PATTERN_LENGTH=45;function FieldDetailsComponent({showExamples:e,field:t,renderDiscriminatorSwitch:a}){const[n,r]=useState(!1),{enumSkipQuotes:i,hideSchemaTitles:o,hideSchemaPattern:c}=useRecoilValue(globalOptionsSelector),{schema:m,description:s,example:p,deprecated:u,examples:d}=t,E=Boolean(i)||"header"===t.in;let R=null;if(e&&(void 0!==p||void 0!==d))if(void 0!==d)R=React.createElement(Examples,{field:t});else{const e=!!t.in;R=React.createElement(FieldDetail,{label:"example",value:getSerializedValue(t,t.example),raw:e})}return React.createElement("div",null,React.createElement(TypeWrapper,null,React.createElement(TypePrefix,null,m.typePrefix),React.createElement(TypeName,null,m.displayType),m.displayFormat&&React.createElement(TypeFormat,null," ","<",m.displayFormat,">"," "),m.contentEncoding&&React.createElement(TypeFormat,null," ","<",m.contentEncoding,">"," "),m.contentMediaType&&React.createElement(TypeFormat,null," ","<",m.contentMediaType,">"," "),m.title&&!o&&React.createElement(TypeTitle,null," (",m.title,") "),React.createElement(ConstraintsView,{constraints:m.constraints}),m.pattern&&!c&&React.createElement(React.Fragment,null,React.createElement(PatternLabel,null,n||m.pattern.length<MAX_PATTERN_LENGTH?m.pattern:`${m.pattern.substr(0,MAX_PATTERN_LENGTH)}...`),m.pattern.length>MAX_PATTERN_LENGTH&&React.createElement(ToggleButton,{onClick:()=>{r(!n)}},n?"Hide pattern":"Show pattern"))," ",m.isCircular&&React.createElement(RecursiveLabel,null,l("recursive"))),u&&React.createElement("div",null,React.createElement(Badge,{deprecated:!0,style:{marginLeft:0}}," ",l("deprecated")," ")),React.createElement(FieldDetail,{raw:E,label:"default",value:m.default}),React.createElement(FieldDescriptionWrapper,null,React.createElement(Markdown,{source:s})),!a&&React.createElement(EnumValues,{type:m.type,values:m["x-enumDescriptions"]||m.enum})," ",R,React.createElement(Extensions,{extensions:Object.assign(Object.assign({},t.extensions),m.extensions)}),m.externalDocs&&React.createElement(ExternalDocumentation,{externalDocs:m.externalDocs,compact:!0}),null==a?void 0:a(),t.const&&React.createElement(FieldDetail,{label:"const",value:t.const})||null)}export const FieldDetails=memo(FieldDetailsComponent);
2
2
  //# sourceMappingURL=FieldDetails.js.map
@@ -11,3 +11,4 @@ export declare const ExampleDescription: import("styled-components").StyledCompo
11
11
  export declare const ExampleSummary: import("styled-components").StyledComponent<"label", any, {}, never>;
12
12
  export declare const ExampleWrap: import("styled-components").StyledComponent<"div", any, {}, never>;
13
13
  export declare const ExamplesList: import("styled-components").StyledComponent<"div", any, {}, never>;
14
+ export declare const FieldDescriptionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -22,5 +22,9 @@ import styled from"styled-components";import{StyledMarkdownBlock}from"../Markdow
22
22
  `;export const ExamplesList=styled.div`
23
23
  padding-left: 1.5em;
24
24
  margin-bottom: 1em;
25
+ `;export const FieldDescriptionWrapper=styled.div`
26
+ p {
27
+ word-break: break-all;
28
+ }
25
29
  `;
26
30
  //# sourceMappingURL=styled.js.map
@@ -1,4 +1,4 @@
1
- import React,{memo,useCallback}from"react";import styled from"styled-components";import{useRecoilValue,useSetRecoilState}from"recoil";import{H2,useMount,Feedback}from"@redocly/theme";import{Endpoint}from"../Endpoint";import{Row}from"../common/panels";import{Badge,SamplesMiddlePanel,SamplesPanel,ShareLink}from"../common";import{CallbacksList}from"../Callbacks";import{CallbackSamples}from"../CallbackSamples";import{ExternalDocumentation}from"../ExternalDocumentation";import{Extensions}from"../Fields";import{Markdown}from"../Markdown";import{Parameters}from"../Parameters";import{RequestSamples}from"../RequestSamples";import{OperationResponseList}from"../Responses";import{ResponseSamples}from"../ResponseSamples";import{SecurityRequirements}from"../SecurityRequirement";import{ContentPanel}from"../Panel";import{RenderHook}from"../RenderHook";import{l}from"../../services";import{LayoutVariant}from"../../constants";import{creatPanelToggleEvent}from"../../events";import{showRightPanelToggleSelector,layoutSelector}from"../../recoil/app";import{globalStoreSelector}from"../../recoil/store";import{getOperation}from"../../models/operation";import{operationStore}from"../../recoil/operation";const OperationRow=styled(Row)`
1
+ import React,{memo,useCallback}from"react";import styled from"styled-components";import{useRecoilValue,useSetRecoilState}from"recoil";import{H2,useMount,Feedback,LayoutVariant}from"@redocly/theme";import{Endpoint}from"../Endpoint";import{Row}from"../common/panels";import{Badge,SamplesMiddlePanel,SamplesPanel,ShareLink}from"../common";import{CallbacksList}from"../Callbacks";import{CallbackSamples}from"../CallbackSamples";import{ExternalDocumentation}from"../ExternalDocumentation";import{Extensions}from"../Fields";import{Markdown}from"../Markdown";import{Parameters}from"../Parameters";import{RequestSamples}from"../RequestSamples";import{OperationResponseList}from"../Responses";import{ResponseSamples}from"../ResponseSamples";import{SecurityRequirements}from"../SecurityRequirement";import{ContentPanel}from"../Panel";import{RenderHook}from"../RenderHook";import{l}from"../../services";import{creatPanelToggleEvent}from"../../events";import{showRightPanelToggleSelector,layoutSelector}from"../../recoil/app";import{globalStoreSelector}from"../../recoil/store";import{getOperation}from"../../models/operation";import{operationStore}from"../../recoil/operation";const OperationRow=styled(Row)`
2
2
  flex-direction: column;
3
3
  align-items: flex-start;
4
4
  ${H2} {
@@ -8,5 +8,5 @@ import React,{memo,useCallback}from"react";import styled from"styled-components"
8
8
  margin: calc(var(--spacing-unit) * 2) 0;
9
9
  `,Description=styled.div`
10
10
  margin-bottom: calc(var(--spacing-unit) * 4);
11
- `;function OperationItemComponent({item:{operationDefinition:e,parent:t,href:a}}){var o,n,r;const c=useRecoilValue(layoutSelector),s=useRecoilValue(showRightPanelToggleSelector),{parser:i,options:m}=useRecoilValue(globalStoreSelector),{hooks:p,events:d,feedback:u,showWebhookVerb:R,pathInMiddlePanel:S,expandDefaultRequest:E,expandDefaultResponse:k}=m,y=getOperation(i,e,t,m,a),{name:b,description:f,deprecated:g,externalDocs:v,isWebhook:h,httpVerb:P}=y,O=useSetRecoilState(operationStore(y.pointer)),x=c===LayoutVariant.STACKED||!s;useMount((()=>{O((e=>Object.assign(Object.assign({},e),{activeExampleName:y.activeExampleName,activeServer:y.activeServer})))}));const w=!(!f&&!v),C=useCallback((e=>t=>{var a;const o=creatPanelToggleEvent({operation:y,isExpanded:t,panelType:e});null===(a=null==d?void 0:d.panelToggle)||void 0===a||a.call(d,o)}),[d,y]);return React.createElement(OperationRow,{layout:c},React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},React.createElement(RenderHook,{Hook:null==p?void 0:p.BeforeOperation,props:{operation:y}}),React.createElement(H2,null,React.createElement(ShareLink,{to:a}),React.createElement(RenderHook,{Hook:null==p?void 0:p.BeforeOperationSummary,props:{operation:y}}),b,React.createElement(RenderHook,{Hook:null==p?void 0:p.AfterOperationSummary,props:{operation:y}}),g&&React.createElement(Badge,{deprecated:!0},"Deprecated"),h&&React.createElement(React.Fragment,null,React.createElement(Badge,null,"Webhook"),R&&P&&React.createElement(Badge,null,P.toUpperCase()))),S&&!h&&React.createElement(Endpoint,{operation:y}))),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},w&&React.createElement(Description,null,void 0!==f&&React.createElement(Markdown,{source:f}),v&&React.createElement(ExternalDocumentation,{externalDocs:v}),Object.keys(y.extensions||{}).length?React.createElement(Extensions,{extensions:y.extensions}):null)),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},!S&&!h&&React.createElement(Endpoint,{operation:y})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},React.createElement(SecurityRequirements,{securities:y.security}))),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},(null===(o=y.parameters)||void 0===o?void 0:o.length)||y.requestBody?React.createElement(ContentPanel,{header:l("request"),onToggle:C("request"),expanded:E,className:"panel-request-schemas"},React.createElement(Parameters,{parameters:y.parameters,body:y.requestBody})):null),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},React.createElement(RequestSamples,{operation:y})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},(null===(n=y.responses)||void 0===n?void 0:n.length)?React.createElement(ContentPanel,{header:l("responses"),onToggle:C("responses"),expanded:k,className:"panel-response-schemas"},React.createElement(OperationResponseList,{responses:y.responses,operationPointer:y.pointer})):null),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},React.createElement(ResponseSamples,{operation:y})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},(null===(r=y.callbacks)||void 0===r?void 0:r.length)?React.createElement(ContentPanel,{className:"panel-callback-schemas",header:l("callbacks")},React.createElement(CallbacksList,{callbacks:y.callbacks})):null,React.createElement(RenderHook,{Hook:null==p?void 0:p.AfterOperation,props:{operation:y}})),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},React.createElement(CallbackSamples,{callbacks:y.callbacks})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},!1===(null==u?void 0:u.hide)?React.createElement(Feedback,{type:u.type,settings:u.settings,path:y.href}):null)))}export const OperationItem=memo(OperationItemComponent);
11
+ `;function OperationItemComponent({item:{operationDefinition:e,parent:t,href:a}}){var o,n,r;const c=useRecoilValue(layoutSelector),s=useRecoilValue(showRightPanelToggleSelector),{parser:i,options:m}=useRecoilValue(globalStoreSelector),{hooks:p,events:d,feedback:u,showWebhookVerb:R,pathInMiddlePanel:S,expandDefaultRequest:E,expandDefaultResponse:k}=m,b=getOperation(i,e,t,m,a),{name:y,description:f,deprecated:g,externalDocs:v,isWebhook:h,httpVerb:P}=b,O=useSetRecoilState(operationStore(b.pointer)),x=c===LayoutVariant.STACKED||!s;useMount((()=>{O((e=>Object.assign(Object.assign({},e),{activeExampleName:b.activeExampleName,activeServer:b.activeServer})))}));const w=!(!f&&!v),C=useCallback((e=>t=>{var a;const o=creatPanelToggleEvent({operation:b,isExpanded:t,panelType:e});null===(a=null==d?void 0:d.panelToggle)||void 0===a||a.call(d,o)}),[d,b]);return React.createElement(OperationRow,{layout:c},React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},React.createElement(RenderHook,{Hook:null==p?void 0:p.BeforeOperation,props:{operation:b}}),React.createElement(H2,null,React.createElement(ShareLink,{to:a}),React.createElement(RenderHook,{Hook:null==p?void 0:p.BeforeOperationSummary,props:{operation:b}}),y,React.createElement(RenderHook,{Hook:null==p?void 0:p.AfterOperationSummary,props:{operation:b}}),g&&React.createElement(Badge,{deprecated:!0},"Deprecated"),h&&React.createElement(React.Fragment,null,React.createElement(Badge,null,"Webhook"),R&&P&&React.createElement(Badge,null,P.toUpperCase()))),S&&!h&&React.createElement(Endpoint,{operation:b}))),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},w&&React.createElement(Description,null,void 0!==f&&React.createElement(Markdown,{source:f}),v&&React.createElement(ExternalDocumentation,{externalDocs:v}),Object.keys(b.extensions||{}).length?React.createElement(Extensions,{extensions:b.extensions}):null),React.createElement(SecurityRequirements,{securities:b.security})),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},!S&&!h&&React.createElement(Endpoint,{operation:b})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},(null===(o=b.parameters)||void 0===o?void 0:o.length)||b.requestBody?React.createElement(ContentPanel,{header:l("request"),onToggle:C("request"),expanded:E,className:"panel-request-schemas"},React.createElement(Parameters,{parameters:b.parameters,body:b.requestBody})):null),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},React.createElement(RequestSamples,{operation:b})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},(null===(n=b.responses)||void 0===n?void 0:n.length)?React.createElement(ContentPanel,{header:l("responses"),onToggle:C("responses"),expanded:k,className:"panel-response-schemas"},React.createElement(OperationResponseList,{responses:b.responses,operationPointer:b.pointer})):null),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},React.createElement(ResponseSamples,{operation:b})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},(null===(r=b.callbacks)||void 0===r?void 0:r.length)?React.createElement(ContentPanel,{className:"panel-callback-schemas",header:l("callbacks")},React.createElement(CallbacksList,{callbacks:b.callbacks})):null,React.createElement(RenderHook,{Hook:null==p?void 0:p.AfterOperation,props:{operation:b}})),s?React.createElement(SamplesPanel,{"data-cy":"samples-block"},React.createElement(CallbackSamples,{callbacks:b.callbacks})):null),React.createElement(OperationSubRowStyled,{layout:c},React.createElement(SamplesMiddlePanel,{isStacked:x},!1===(null==u?void 0:u.hide)?React.createElement(Feedback,{type:u.type,settings:u.settings,path:b.href}):null)))}export const OperationItem=memo(OperationItemComponent);
12
12
  //# sourceMappingURL=OperationItem.js.map
@@ -4,4 +4,4 @@ import type { ProvidersProps, AppProviderProps, StoreProviderProps } from './typ
4
4
  import type { RecoilRootProps } from 'recoil';
5
5
  export declare const ThemeProviders: ({ options, children, customOptions, }: ProvidersProps) => JSX.Element;
6
6
  export declare const AppProvider: ({ definitions, options, definitionUrl, definition, activeSampleLanguage, children, }: PropsWithChildren<AppProviderProps>) => JSX.Element | null;
7
- export declare const StoreProvider: React.MemoExoticComponent<({ children, options: rawOptions, definitionUrl, definition, activeSampleLanguage, portalOptions, }: RecoilRootProps & StoreProviderProps) => JSX.Element>;
7
+ export declare const StoreProvider: React.MemoExoticComponent<({ children, options: rawOptions, definitionUrl, definition, activeSampleLanguage, portalOptions, _forceRenderInfo, }: RecoilRootProps & StoreProviderProps) => JSX.Element>;
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))((function(n,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function l(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,l)}s((i=i.apply(e,t||[])).next())}))};import{ThemeProvider}from"styled-components";import React,{memo,useEffect,useMemo,useState}from"react";import{Tag}from"@markdoc/markdoc";import{Heading}from"@redocly/theme";import{RecoilRoot}from"recoil";import RecoilNexus from"recoil-nexus";import{normalizeOptions,OpenAPIParser}from"../../services";import{getMarkdownHeaderId,loadMany,loadSingle,useDeepCompareMemoize}from"./utils";import{argValueToBoolean,fromLocalStorage,fromSessionStorage}from"../../utils";import{Loading}from"../Loading";import{defaultTheme}from"../../constants";import{SecurityDefs}from"../SecurityRequirement";import{SchemaDefinition}from"../SchemaDefinition";import{PullRight,RedocResponse}from"../pluggable";import{appLocalStore,appSessionStore,appStore}from"../../recoil/app";import{globalStore}from"../../recoil/store";import{operationStore}from"../../recoil/operation";export const ThemeProviders=({options:e,children:t,customOptions:o={}})=>{const i=Object.assign(Object.assign({},e),o),n=useMemo((()=>({mediaQueries:i.mediaQueries,showAtBreakpoint:i.showAtBreakpoint})),[i.mediaQueries,i.showAtBreakpoint]);return React.createElement(ThemeProvider,{theme:n},t)};export const AppProvider=({definitions:e,options:t,definitionUrl:o,definition:i,activeSampleLanguage:n,children:r})=>{const[,a]=useState(),[l,s]=useState(!0),[p,c]=useState(null);useEffect((()=>{!function(){__awaiter(this,void 0,void 0,(function*(){s(!0);try{c(e?yield loadMany(e):yield loadSingle(i,o,t))}catch(e){a((()=>{throw e}))}}))}()}),[e,i,o,t]);const m=useMemo((()=>{var e,i,r;if(p)return(null===(e=null==t?void 0:t.hooks)||void 0===e?void 0:e.onInit)&&(null===(r=null===(i=t.hooks)||void 0===i?void 0:i.onInit)||void 0===r||r.call(i,{store:{definition:p,options:t,definitionUrl:o,activeSampleLanguage:n}})),{definition:p,options:t,definitionUrl:o,activeSampleLanguage:n}}),useDeepCompareMemoize([p,t,o]));return useEffect((()=>{m&&s(!1)}),[m]),m?l?argValueToBoolean(null==t?void 0:t.hideLoading,!1)?null:React.createElement(Loading,{color:"--loading-spinner-color"}):React.isValidElement(r)?React.cloneElement(r,{store:m}):null:null};const DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],breakpoints:defaultTheme.breakpoints,showAtBreakpoint:defaultTheme.showAtBreakpoint,allowedMdComponents:{tags:{securityDefinitions:{render:"SecurityDefinitions",attributes:{htmlWrap:{type:String,default:!0}}},redocResponse:{render:"RedocResponse",attributes:{pointer:{type:String},hideSamples:{type:Boolean},htmlWrap:{type:String,default:!1}}},pullRight:{render:"PullRight",attributes:{htmlWrap:{type:String,default:!1}}},schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean},htmlWrap:{type:String,default:!1}}}},nodes:{heading:{children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(e,t){const o=e.transformAttributes(t),i=e.transformChildren(t),n="string"==typeof o.id?o.id:getMarkdownHeaderId(i);return new Tag("Heading",Object.assign(Object.assign({},o),{id:n,level:e.attributes.level}),i)}}},components:{SecurityDefinitions:SecurityDefs,SchemaDefinition:SchemaDefinition,RedocResponse:RedocResponse,PullRight:PullRight,Heading:Heading}}};export const StoreProvider=memo((({children:e,options:t,definitionUrl:o,definition:i,activeSampleLanguage:n,portalOptions:r})=>{const a=React.useRef(),l=React.useCallback((()=>{var e;const n=normalizeOptions(Object.assign({},t),DEFAULT_OPTIONS),r=isVersioned(i)?(null===(e=i.versions)||void 0===e?void 0:e.map((({spec:e,id:t,title:o,url:i},r)=>{if(e)return{id:t||`Definition_${r}`,title:o||`Definition_${r}`,url:i,parser:new OpenAPIParser(e,void 0,n)}})).filter(Boolean))||[]:[{url:o,parser:new OpenAPIParser(i,o,n)}];return{options:n,versions:r}}),[i,o,t]);return useEffect((()=>{a.current&&setTimeout((()=>{a.current(globalStore,l())}),0)}),[l,i]),React.createElement(RecoilRoot,{initializeState:({set:e})=>{a.current=e;const t=l(),o=t.options,i=JSON.parse(fromLocalStorage("appLocalStore")||"{}"),s=JSON.parse(fromSessionStorage("appSessionStore")||"{}");if(e(appSessionStore,{showRightPanelToggle:s.showRightPanelToggle||o.showRightPanelToggle,activeVersionIdx:0}),e(appLocalStore,{layout:i.layout||o.layout,activeSampleLanguage:n||i.activeSampleLanguage||o.defaultSampleLanguage}),e(globalStore,t),e(appStore,{isSidebarOpened:!1,tryItOperation:void 0,isLoading:!1,activeMimeName:(null==r?void 0:r.defaultMimeType)||""}),null==r?void 0:r.operation){const{pointer:t,activeExampleName:o,activeServer:i}=r.operation;e(operationStore(t),{activeExampleName:o,activeOneOf:0,activeServer:i,requestValues:{}})}},key:(null==r?void 0:r.definitionId)||"openapi"},React.createElement(RecoilNexus,null),e)}));const isVersioned=e=>"versions"in e;
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))((function(n,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function l(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,l)}s((i=i.apply(e,t||[])).next())}))};import{ThemeProvider}from"styled-components";import React,{memo,useEffect,useMemo,useState}from"react";import{Tag}from"@markdoc/markdoc";import{Heading}from"@redocly/theme";import{RecoilRoot}from"recoil";import RecoilNexus from"recoil-nexus";import{normalizeOptions,OpenAPIParser}from"../../services";import{getMarkdownHeaderId,loadMany,loadSingle,useDeepCompareMemoize}from"./utils";import{argValueToBoolean,fromLocalStorage,fromSessionStorage}from"../../utils";import{Loading}from"../Loading";import{defaultTheme}from"../../constants";import{SecurityDefs}from"../SecurityRequirement";import{SchemaDefinition}from"../SchemaDefinition";import{PullRight,RedocResponse}from"../pluggable";import{appLocalStore,appSessionStore,appStore}from"../../recoil/app";import{globalStore}from"../../recoil/store";import{operationStore}from"../../recoil/operation";export const ThemeProviders=({options:e,children:t,customOptions:o={}})=>{const i=Object.assign(Object.assign({},e),o),n=useMemo((()=>({mediaQueries:i.mediaQueries,showAtBreakpoint:i.showAtBreakpoint})),[i.mediaQueries,i.showAtBreakpoint]);return React.createElement(ThemeProvider,{theme:n},t)};export const AppProvider=({definitions:e,options:t,definitionUrl:o,definition:i,activeSampleLanguage:n,children:r})=>{const[,a]=useState(),[l,s]=useState(!0),[p,c]=useState(null);useEffect((()=>{!function(){__awaiter(this,void 0,void 0,(function*(){s(!0);try{c(e?yield loadMany(e):yield loadSingle(i,o,t))}catch(e){a((()=>{throw e}))}}))}()}),[e,i,o,t]);const d=useMemo((()=>{var e,i,r;if(p)return(null===(e=null==t?void 0:t.hooks)||void 0===e?void 0:e.onInit)&&(null===(r=null===(i=t.hooks)||void 0===i?void 0:i.onInit)||void 0===r||r.call(i,{store:{definition:p,options:t,definitionUrl:o,activeSampleLanguage:n}})),{definition:p,options:t,definitionUrl:o,activeSampleLanguage:n}}),useDeepCompareMemoize([p,t,o]));return useEffect((()=>{d&&s(!1)}),[d]),d?l?argValueToBoolean(null==t?void 0:t.hideLoading,!1)?null:React.createElement(Loading,{color:"--loading-spinner-color"}):React.isValidElement(r)?React.cloneElement(r,{store:d}):null:null};const DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],breakpoints:defaultTheme.breakpoints,showAtBreakpoint:defaultTheme.showAtBreakpoint,allowedMdComponents:{tags:{securityDefinitions:{render:"SecurityDefinitions",attributes:{htmlWrap:{type:String,default:!0}}},redocResponse:{render:"RedocResponse",attributes:{pointer:{type:String},hideSamples:{type:Boolean},htmlWrap:{type:String,default:!1}}},pullRight:{render:"PullRight",attributes:{htmlWrap:{type:String,default:!1}}},schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean},htmlWrap:{type:String,default:!1}}}},nodes:{heading:{children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(e,t){const o=e.transformAttributes(t),i=e.transformChildren(t),n="string"==typeof o.id?o.id:getMarkdownHeaderId(i);return new Tag("Heading",Object.assign(Object.assign({},o),{id:n,level:e.attributes.level}),i)}}},components:{SecurityDefinitions:SecurityDefs,SchemaDefinition:SchemaDefinition,RedocResponse:RedocResponse,PullRight:PullRight,Heading:Heading}}};export const StoreProvider=memo((({children:e,options:t,definitionUrl:o,definition:i,activeSampleLanguage:n,portalOptions:r,_forceRenderInfo:a})=>{const l=React.useRef(),s=React.useCallback((()=>{var e;const n=normalizeOptions(Object.assign(Object.assign({},t),{hideInfoSection:!a&&(null==t?void 0:t.hideInfoSection)}),DEFAULT_OPTIONS),r=isVersioned(i)?(null===(e=i.versions)||void 0===e?void 0:e.map((({spec:e,id:t,title:o,url:i},r)=>{if(e)return{id:t||`Definition_${r}`,title:o||`Definition_${r}`,url:i,parser:new OpenAPIParser(e,void 0,n)}})).filter(Boolean))||[]:[{url:o,parser:new OpenAPIParser(i,o,n)}];return{options:n,versions:r}}),[a,i,o,t]);return useEffect((()=>{l.current&&setTimeout((()=>{l.current(globalStore,s())}),0)}),[s,i]),React.createElement(RecoilRoot,{initializeState:({set:e})=>{l.current=e;const t=s(),o=t.options,i=JSON.parse(fromLocalStorage("appLocalStore")||"{}"),a=JSON.parse(fromSessionStorage("appSessionStore")||"{}");if(e(appSessionStore,{showRightPanelToggle:a.showRightPanelToggle||o.showRightPanelToggle,activeVersionIdx:0}),e(appLocalStore,{layout:i.layout||o.layout,activeSampleLanguage:n||i.activeSampleLanguage||o.defaultSampleLanguage}),e(globalStore,t),e(appStore,{isSidebarOpened:!1,tryItOperation:void 0,isLoading:!1,activeMimeName:(null==r?void 0:r.defaultMimeType)||""}),null==r?void 0:r.operation){const{pointer:t,activeExampleName:o,activeServer:i}=r.operation;e(operationStore(t),{activeExampleName:o,activeOneOf:0,activeServer:i,requestValues:{}})}},key:(null==r?void 0:r.definitionId)||"openapi"},React.createElement(RecoilNexus,null),e)}));const isVersioned=e=>"versions"in e;
2
2
  //# sourceMappingURL=Providers.js.map
@@ -1,4 +1,6 @@
1
1
  import type { PropsWithChildren } from 'react';
2
2
  import type { RedoclyOpenAPIDocsProps, RedoclyOpenAPIDocsStandaloneProps } from './types';
3
- export declare function RedoclyOpenAPIDocs({ onLoaded, _forceRenderInfo, children, store, }: PropsWithChildren<RedoclyOpenAPIDocsProps>): JSX.Element | null;
3
+ export declare function RedoclyOpenAPIDocs({ onLoaded, _forceRenderInfo, children, store, }: PropsWithChildren<Partial<RedoclyOpenAPIDocsProps>> & {
4
+ _forceRenderInfo?: boolean;
5
+ }): JSX.Element | null;
4
6
  export declare function RedoclyOpenAPIDocsStandalone({ definition, definitionUrl, options, activeItemId, activeSampleLanguage, activeDeepLink, }: RedoclyOpenAPIDocsStandaloneProps): JSX.Element;
@@ -1,2 +1,2 @@
1
- import React,{useRef,useCallback,memo}from"react";import{SidebarLogo,GlobalStyle,useMount}from"@redocly/theme";import{useRecoilValue,useRecoilState}from"recoil";import{useLocation}from"react-router-dom";import{LayoutVariant}from"../../constants";import{Search}from"../Search";import{ThemeProviders,AppProvider,StoreProvider}from"./Providers";import{Overlay}from"../Overlay";import{VersionSwitcher}from"../VersionSwitcher";import{BackgroundStub,BackgroundStubFix,ApiContentWrap,ControlsWrap,RedocWrapStyled,CssFixes}from"./styled";import{StickyResponsiveSidebar}from"../StickySidebar";import{DownloadButtonWithLabel}from"../Download";import{ErrorBoundary}from"../ErrorBoundary";import{SideMenu}from"../SideMenu";import{ContentItems}from"../ContentItems";import{ChangeViewButton}from"../ChangeViewButton";import{ToggleRightPanelButton}from"../ToggleRightPanelButton";import{activeVersionIdxSelector,appSessionStore,layoutSelector}from"../../recoil/app";import{globalStore}from"../../recoil/store";import{useContentItems}from"../../hooks";import{withRouter}from"../../hoc/withRouter";import{compose}from"../../utils";import{useLicense}from"../../hooks/useLicense";const RedoclyOpenAPIDocsComponent=compose(withRouter,memo)((({licenseKey:e,onLoaded:o,_forceRenderInfo:t,children:n})=>{var i,r,a,l,c;const s=useRef(null),{pathname:u}=useLocation(),{isValid:m,licenseInfo:d}=useLicense(e);useMount((()=>{null==o||o()}));const{options:{hideDownloadButton:p,hideInfoSection:f,pagination:R,disableSidebar:h,whiteLabel:g,hideLogo:S,hideFab:v,showNextButton:E,scrollYOffset:y,disablePaginationLoadingAnimation:b,routingBasePath:L},options:I,versions:C}=useRecoilValue(globalStore),{showRightPanelToggle:P}=useRecoilValue(appSessionStore),[w,B]=useRecoilState(activeVersionIdxSelector),V=useRecoilValue(layoutSelector),A=useCallback((({idx:e})=>{e&&B(e)}),[B]),k=C[w].parser,{flatItems:x,contentItems:D}=useContentItems({parser:k,options:I});if(!C.length)return null;let T=!f;t&&(T=!0);const O=!T&&null!==p&&!p&&("none"===R||"/"===u||u===L),W=null===(r=null===(i=k.definition)||void 0===i?void 0:i.info)||void 0===r?void 0:r["x-logo"];return React.createElement(ThemeProviders,{options:I},React.createElement(GlobalStyle,null),React.createElement(RedocWrapStyled,{className:"redoc-wrap",ref:s},!m&&React.createElement(Overlay,{licenseInfo:d}),React.createElement(CssFixes,{whiteLabel:g,showRightPanelToggle:P,layout:V}),!h&&React.createElement(StickyResponsiveSidebar,{hideFab:v,scrollYOffset:y,className:"menu-content"},!S&&React.createElement(SidebarLogo,{imageUrl:null==W?void 0:W.url,href:(null==W?void 0:W.href)||(null===(c=null===(l=null===(a=k.definition)||void 0===a?void 0:a.info)||void 0===l?void 0:l.contact)||void 0===c?void 0:c.url),altText:null==W?void 0:W.altText,backgroundColor:null==W?void 0:W.backgroundColor}),C.length>1&&React.createElement(VersionSwitcher,{versions:C,activeVersionIdx:w,onChange:A}),React.createElement(Search,{contentItems:D,flatItems:x,options:I}),React.createElement(SideMenu,{items:m?D:[]})),React.createElement(ApiContentWrap,{className:"api-content",id:"api-content",layout:V===LayoutVariant.THREE_PANEL&&P?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED},P&&V!==LayoutVariant.STACKED&&React.createElement(BackgroundStub,null),O&&React.createElement(DownloadButtonWithLabel,null),React.createElement(ContentItems,{root:!0,items:m?D:[],showNextButton:E,showApiInfo:T,pagination:R,disablePaginationLoadingAnimation:b}),n),React.createElement(ControlsWrap,null,React.createElement(ToggleRightPanelButton,null),React.createElement(ChangeViewButton,null)),P&&V!==LayoutVariant.STACKED&&React.createElement(BackgroundStubFix,null)))}));export function RedoclyOpenAPIDocs({onLoaded:e,_forceRenderInfo:o,children:t,store:n}){var i,r,a;return(null==n?void 0:n.definition)?React.createElement(StoreProvider,Object.assign({},n),React.createElement(RedoclyOpenAPIDocsComponent,{onLoaded:e,_forceRenderInfo:o,basePath:null===(i=n.options)||void 0===i?void 0:i.routingBasePath,licenseKey:null===(r=n.options)||void 0===r?void 0:r.licenseKey,enableRouter:null===(a=n.options)||void 0===a?void 0:a.enableRouter},t)):null}export function RedoclyOpenAPIDocsStandalone({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:i,activeDeepLink:r}){const a=React.createElement(AppProvider,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:i,activeDeepLink:r},React.createElement(RedoclyOpenAPIDocs,null));return t.disableErrorBoundary?a:React.createElement(ErrorBoundary,null,a)}
1
+ import React,{useRef,memo}from"react";import{SidebarLogo,GlobalStyle,useMount,LayoutVariant}from"@redocly/theme";import{Search}from"../Search";import{ThemeProviders,AppProvider,StoreProvider}from"./Providers";import{Overlay}from"../Overlay";import{VersionSwitcher}from"../VersionSwitcher";import{BackgroundStub,BackgroundStubFix,ApiContentWrap,RedocWrapStyled,CssFixes}from"./styled";import{StickyResponsiveSidebar}from"../StickySidebar";import{ErrorBoundary}from"../ErrorBoundary";import{SideMenu}from"../SideMenu";import{ContentItems}from"../ContentItems";import{useContentItems}from"../../hooks";import{withRouter}from"../../hoc/withRouter";import{withStore}from"../../hoc/withStore";import{compose}from"../../utils";import{useLicense}from"../../hooks/useLicense";const RedoclyOpenAPIDocsComponent=compose(withRouter,withStore,memo)((({licenseKey:e,onLoaded:o,children:t,options:n,versions:r,layout:i,showRightPanelToggle:a,activeVersionIdx:l,onChangeActiveVersion:c,collapsedSidebar:s})=>{var d,m,u,p,v;const f=useRef(null),{isValid:R,licenseInfo:S}=useLicense(e);useMount((()=>{null==o||o()}));const{disableSidebar:h,whiteLabel:y,hideLogo:E,hideFab:b,scrollYOffset:g}=n||{},I=r[l].parser,{flatItems:L,contentItems:C}=useContentItems({parser:I,options:n});if(!r.length)return null;const P=null===(m=null===(d=I.definition)||void 0===d?void 0:d.info)||void 0===m?void 0:m["x-logo"];return React.createElement(ThemeProviders,{options:n},React.createElement(GlobalStyle,null),React.createElement(RedocWrapStyled,{className:"redoc-wrap",ref:f},!R&&React.createElement(Overlay,{licenseInfo:S}),React.createElement(CssFixes,{whiteLabel:y,showRightPanelToggle:a,layout:i}),!h&&React.createElement(StickyResponsiveSidebar,{hideFab:b,scrollYOffset:g,className:"menu-content",collapsedSidebar:!s},!E&&React.createElement(SidebarLogo,{imageUrl:null==P?void 0:P.url,href:(null==P?void 0:P.href)||(null===(v=null===(p=null===(u=I.definition)||void 0===u?void 0:u.info)||void 0===p?void 0:p.contact)||void 0===v?void 0:v.url),altText:null==P?void 0:P.altText,backgroundColor:null==P?void 0:P.backgroundColor}),r.length>1&&React.createElement(VersionSwitcher,{versions:r,activeVersionIdx:l,onChange:c}),React.createElement(Search,{contentItems:C,flatItems:L,options:n}),React.createElement(SideMenu,{items:R?C:[]})),React.createElement(ApiContentWrap,{className:"api-content",id:"api-content",layout:i===LayoutVariant.THREE_PANEL&&a?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED,collapsedSidebar:s},a&&i!==LayoutVariant.STACKED&&React.createElement(BackgroundStub,null),React.createElement(ContentItems,{root:!0,items:R?C:[]}),t),a&&i!==LayoutVariant.STACKED&&React.createElement(BackgroundStubFix,null)))}));export function RedoclyOpenAPIDocs({onLoaded:e,_forceRenderInfo:o,children:t,store:n}){var r,i,a;return(null==n?void 0:n.definition)?React.createElement(StoreProvider,Object.assign({},n,{_forceRenderInfo:o}),React.createElement(RedoclyOpenAPIDocsComponent,{onLoaded:e,basePath:null===(r=n.options)||void 0===r?void 0:r.routingBasePath,licenseKey:null===(i=n.options)||void 0===i?void 0:i.licenseKey,enableRouter:null===(a=n.options)||void 0===a?void 0:a.enableRouter,portalOptions:null==n?void 0:n.portalOptions},t)):null}export function RedoclyOpenAPIDocsStandalone({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:i}){const a=React.createElement(AppProvider,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:i},React.createElement(RedoclyOpenAPIDocs,null));return t.disableErrorBoundary?a:React.createElement(ErrorBoundary,null,a)}
2
2
  //# sourceMappingURL=RedoclyOpenAPIDocs.js.map
@@ -1,13 +1,13 @@
1
+ import { LayoutVariant } from '@redocly/theme';
1
2
  import type { FlattenSimpleInterpolation } from 'styled-components';
2
3
  import type { CssFixesProps } from './types';
3
- import { LayoutVariant } from '../../constants';
4
4
  export declare const RedocWrap: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const ApiContentWrap: import("styled-components").StyledComponent<"div", any, {
6
6
  layout?: LayoutVariant | undefined;
7
+ collapsedSidebar?: boolean | undefined;
7
8
  }, never>;
8
9
  export declare const BackgroundStub: import("styled-components").StyledComponent<"div", any, {}, never>;
9
10
  export declare const BackgroundStubFix: import("styled-components").StyledComponent<"div", any, {}, never>;
10
- export declare const ControlsWrap: import("styled-components").StyledComponent<"span", any, {}, never>;
11
11
  export declare const RedocWrapStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
12
12
  export declare const getMarginFixesByName: (variableName: string) => FlattenSimpleInterpolation;
13
13
  export declare const CssFixes: import("styled-components").GlobalStyleComponent<CssFixesProps, import("styled-components").DefaultTheme>;
@@ -1,4 +1,4 @@
1
- import styled,{createGlobalStyle,css}from"styled-components";import{LayoutVariant}from"../../constants";import{SamplesMiddlePanel,SamplesPanel}from"../common/panels";import{NextSectionButtonWrap}from"../NextSectionButton/styled";export const RedocWrap=styled.div`
1
+ import{LayoutVariant}from"@redocly/theme";import styled,{createGlobalStyle,css}from"styled-components";import{SamplesMiddlePanel,SamplesPanel}from"../common/panels";import{NextSectionButtonWrap}from"../NextSectionButton/styled";export const RedocWrap=styled.div`
2
2
  display: flex;
3
3
  position: relative;
4
4
  text-align: left;
@@ -25,23 +25,23 @@ import styled,{createGlobalStyle,css}from"styled-components";import{LayoutVarian
25
25
  margin: 0 auto;
26
26
  width: 100%;
27
27
 
28
- ${({layout:e=LayoutVariant.THREE_PANEL,theme:a})=>css`
29
- max-width: ${e===LayoutVariant.THREE_PANEL?"100%":""};
28
+ ${({layout:a=LayoutVariant.THREE_PANEL,theme:e,collapsedSidebar:t})=>css`
29
+ max-width: ${a===LayoutVariant.THREE_PANEL?"100%":""};
30
30
 
31
- ${a.mediaQueries.small} {
32
- width: calc(100% - var(--sidebar-width));
33
- max-width: var(--layout-${e}-small-max-width);
31
+ ${e.mediaQueries.small} {
32
+ width: ${t?"var(--layout-${layout}-small-max-width)":"calc(100% - var(--sidebar-width))"};
33
+ max-width: var(--layout-${a}-small-max-width);
34
34
  }
35
35
 
36
- ${a.mediaQueries.medium} {
37
- max-width: var(--layout-${e}-medium-max-width);
36
+ ${e.mediaQueries.medium} {
37
+ max-width: var(--layout-${a}-medium-max-width);
38
38
  }
39
39
 
40
- ${a.mediaQueries.large} {
41
- max-width: var(--layout-${e}-large-max-width);
40
+ ${e.mediaQueries.large} {
41
+ max-width: var(--layout-${a}-large-max-width);
42
42
  }
43
43
 
44
- ${a.mediaQueries.print} {
44
+ ${e.mediaQueries.print} {
45
45
  width: 100%;
46
46
  padding: 0;
47
47
  }
@@ -55,20 +55,20 @@ import styled,{createGlobalStyle,css}from"styled-components";import{LayoutVarian
55
55
  left: 0;
56
56
  background: var(--panel-samples-block-background-color);
57
57
 
58
- ${({theme:e})=>css`
59
- ${e.mediaQueries[e.showAtBreakpoint.samplesPanel]} {
58
+ ${({theme:a})=>css`
59
+ ${a.mediaQueries[a.showAtBreakpoint.samplesPanel]} {
60
60
  display: initial;
61
61
  left: calc(100% - var(--panel-samples-width));
62
62
  }
63
63
 
64
- ${e.mediaQueries.print} {
64
+ ${a.mediaQueries.print} {
65
65
  display: none;
66
66
  }
67
67
  `}
68
- `;const getBackgroundStubFixWidth=e=>css`
68
+ `;const getBackgroundStubFixWidth=a=>css`
69
69
  width: calc(
70
70
  (
71
- 100% - min(100% - var(--sidebar-width) - var(--layout-controls-width), var(${e})) -
71
+ 100% - min(100% - var(--sidebar-width) - var(--layout-controls-width), var(${a})) -
72
72
  var(--sidebar-width) + var(--layout-controls-width)
73
73
  ) / 2 + 2px /* 2px to account for rounding errors */
74
74
  );
@@ -81,43 +81,24 @@ import styled,{createGlobalStyle,css}from"styled-components";import{LayoutVarian
81
81
  background: var(--panel-samples-block-background-color);
82
82
  width: 0;
83
83
 
84
- ${({theme:e})=>css`
85
- ${e.mediaQueries[e.showAtBreakpoint.samplesPanel]} {
84
+ ${({theme:a})=>css`
85
+ ${a.mediaQueries[a.showAtBreakpoint.samplesPanel]} {
86
86
  display: initial;
87
87
  ${getBackgroundStubFixWidth("--layout-three-panel-medium-max-width")};
88
88
  }
89
89
 
90
- ${e.mediaQueries.large} {
90
+ ${a.mediaQueries.large} {
91
91
  ${getBackgroundStubFixWidth("--layout-three-panel-large-max-width")};
92
92
  }
93
93
 
94
- ${e.mediaQueries.print} {
95
- display: none;
96
- }
97
- `}
98
- `;export const ControlsWrap=styled.span`
99
- position: sticky;
100
- display: none;
101
- flex-direction: column;
102
- justify-content: space-between;
103
- top: calc(var(--navbar-height) + var(--layout-controls-top-offset));
104
- right: 24px;
105
- height: calc(var(--layout-controls-height) * 2 + var(--spacing-unit) * 2);
106
- z-index: 1;
107
-
108
- ${({theme:e})=>css`
109
- ${e.mediaQueries[e.showAtBreakpoint.samplesPanel]} {
110
- display: flex;
111
- }
112
-
113
- ${e.mediaQueries.print} {
94
+ ${a.mediaQueries.print} {
114
95
  display: none;
115
96
  }
116
97
  `}
117
98
  `;export const RedocWrapStyled=styled(RedocWrap)`
118
99
  background-color: var(--background-color);
119
- `;export const getMarginFixesByName=e=>css`
120
- margin: 0 max(calc((100% - var(--panel-samples-width) - var(${e})) / 2), 0);
100
+ `;export const getMarginFixesByName=a=>css`
101
+ margin: 0 max(calc((100% - var(--panel-samples-width) - var(${a})) / 2), 0);
121
102
  `;export const CssFixes=createGlobalStyle`
122
103
  div[data-section-id]::after {
123
104
  content: " ";
@@ -128,40 +109,40 @@ import styled,{createGlobalStyle,css}from"styled-components";import{LayoutVarian
128
109
  }
129
110
 
130
111
  ${SamplesPanel} {
131
- ${({layout:e})=>{if(e===LayoutVariant.STACKED)return css`
112
+ ${({layout:a})=>{if(a===LayoutVariant.STACKED)return css`
132
113
  width: 100%;
133
114
  padding-left: var(--spacing-horizontal);
134
115
  `}}
135
- ${({showRightPanelToggle:e})=>{if(!e)return css`
136
- ${({theme:e})=>e.mediaQueries[e.showAtBreakpoint.samplesPanel]} {
116
+ ${({showRightPanelToggle:a})=>{if(!a)return css`
117
+ ${({theme:a})=>a.mediaQueries[a.showAtBreakpoint.samplesPanel]} {
137
118
  display: none;
138
119
  }
139
120
  `}}
140
121
  }
141
122
 
142
123
  ${BackgroundStub}, ${BackgroundStubFix} {
143
- ${({showRightPanelToggle:e,layout:a})=>{if(!e&&a===LayoutVariant.STACKED)return css`
144
- ${({theme:e})=>e.mediaQueries[e.showAtBreakpoint.samplesPanel]} {
124
+ ${({showRightPanelToggle:a,layout:e})=>{if(!a&&e===LayoutVariant.STACKED)return css`
125
+ ${({theme:a})=>a.mediaQueries[a.showAtBreakpoint.samplesPanel]} {
145
126
  display: none;
146
127
  }
147
128
  `}}
148
129
  }
149
130
 
150
131
  ${SamplesMiddlePanel}, ${NextSectionButtonWrap} {
151
- ${({showRightPanelToggle:e,layout:a})=>e&&a===LayoutVariant.THREE_PANEL?css`
132
+ ${({showRightPanelToggle:a,layout:e})=>a&&e===LayoutVariant.THREE_PANEL?css`
152
133
  margin: 0;
153
- ${({theme:e})=>e.mediaQueries.small} {
134
+ ${({theme:a})=>a.mediaQueries.small} {
154
135
  ${getMarginFixesByName("--layout-panel-schemas-small-max-width")};
155
136
  }
156
- ${({theme:e})=>e.mediaQueries.medium} {
137
+ ${({theme:a})=>a.mediaQueries.medium} {
157
138
  max-width: var(--layout-panel-schemas-medium-max-width);
158
139
  ${getMarginFixesByName("--layout-panel-schemas-medium-max-width")};
159
140
  }
160
- ${({theme:e})=>e.mediaQueries.large} {
141
+ ${({theme:a})=>a.mediaQueries.large} {
161
142
  max-width: var(--layout-panel-schemas-large-max-width);
162
143
  ${getMarginFixesByName("--layout-panel-schemas-large-max-width")};
163
144
  }
164
- `:a!==LayoutVariant.STACKED&&e?void 0:css`
145
+ `:e!==LayoutVariant.STACKED&&a?void 0:css`
165
146
  width: 100%;
166
147
  padding-right: var(--spacing-horizontal);
167
148
  `};
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
- import type { LayoutVariant } from 'src/constants';
2
+ import type { LayoutVariant } from '@redocly/theme';
3
3
  import type { CodeSampleConfig, Options, RawOptions, SpecVersions } from '../../services';
4
4
  import type { MediaQueries } from '../../utils';
5
5
  import type { OpenAPIDefinition } from '../../types';
6
- import type { RoutingProps } from '../../hoc/types';
6
+ import type { RoutingProps, StoreProps } from '../../hoc/types';
7
7
  import type { OperationModel } from '../../models';
8
8
  export interface ResolvedTheme {
9
9
  mediaQueries: Omit<MediaQueries, 'print'>;
@@ -12,9 +12,8 @@ export interface ResolvedTheme {
12
12
  samplesPanel: keyof Omit<MediaQueries, 'print'>;
13
13
  };
14
14
  }
15
- export interface RedoclyOpenAPIDocsProps extends RoutingProps {
15
+ export interface RedoclyOpenAPIDocsProps extends RoutingProps, StoreProps {
16
16
  onLoaded?: () => void;
17
- _forceRenderInfo?: boolean;
18
17
  store?: StoreProviderProps;
19
18
  licenseKey?: string;
20
19
  }
@@ -26,8 +25,11 @@ export interface StoreProviderProps {
26
25
  portalOptions?: {
27
26
  defaultMimeType?: string;
28
27
  operation?: OperationModel;
28
+ layout?: LayoutVariant;
29
+ showRightPanelToggle?: boolean;
29
30
  definitionId?: string;
30
31
  };
32
+ _forceRenderInfo?: boolean;
31
33
  }
32
34
  export interface ProvidersProps {
33
35
  options: Options;
@@ -1,4 +1,4 @@
1
- import React,{memo,useCallback,useMemo}from"react";import styled from"styled-components";import{PanelBody}from"@redocly/theme";import{useRecoilState,useRecoilValue}from"recoil";import{setRecoil}from"recoil-nexus";import{SamplesMiddlePanel,SamplesPanel,Row,Section}from"../common";import{getMediaType}from"../../models";import{LayoutVariant}from"../../constants";import{MediaTypeSamples}from"../PayloadSamples";import{Schema}from"../Schema";import{Markdown}from"../Markdown";import{CodePanel}from"../Panel";import{layoutSelector,showRightPanelToggleSelector}from"../../recoil/app";import{globalStoreSelector}from"../../recoil/store";import{operationStore}from"../../recoil/operation";const getMediaTypeInfo=(e,o)=>{if(!e)return{};const a={schema:{$ref:e}};return o&&(a.examples={example:{$ref:o}}),a};function SchemaDefinitionComponent({schemaRef:e,exampleRef:o,showReadOnly:a=!0,showWriteOnly:t=!1}){var l,n,i;const r=useRecoilValue(layoutSelector),{parser:m,options:c}=useRecoilValue(globalStoreSelector),s=useRecoilValue(showRightPanelToggleSelector),p=useMemo((()=>getMediaType(m,"json",!1,getMediaTypeInfo(e,o),c,{operation:{pointer:"SchemaDefinitionComponent"}})),[o,c,m,e]),[d,u]=useRecoilState(operationStore(null===(l=p.operation)||void 0===l?void 0:l.pointer)),f=useCallback((e=>{var o;const a=null===(o=p.schema)||void 0===o?void 0:o.oneOf;if(a&&(null==p?void 0:p.examples)&&Object.keys(null==p?void 0:p.examples).includes(e)){const o=a.findIndex((o=>o.title===e));-1!==o&&p.schema&&setRecoil(operationStore(p.schema.deps.operation.pointer),(e=>{var a,t,l;return Object.assign(Object.assign({},e),{activeExampleName:(null===(l=null===(t=null===(a=p.schema)||void 0===a?void 0:a.oneOf)||void 0===t?void 0:t[o])||void 0===l?void 0:l.title)||e.activeExampleName,activeOneOf:o})}))}d.activeExampleName!==e&&u((o=>Object.assign(Object.assign({},o),{activeExampleName:e})))}),[null==p?void 0:p.examples,p.schema,d.activeExampleName,u]);return React.createElement(Section,null,React.createElement(Row,{layout:r},React.createElement(SamplesMiddlePanel,{isStacked:r===LayoutVariant.STACKED||!s},(null===(n=p.schema)||void 0===n?void 0:n.description)&&React.createElement(Description,null,React.createElement(Markdown,{source:null===(i=p.schema)||void 0===i?void 0:i.description})),React.createElement(StyledPanelBody,{className:"panel-default"},React.createElement(Schema,{skipWriteOnly:!t,skipReadOnly:!a,schema:p.schema}))),s?React.createElement(SamplesPanel,null,React.createElement(CodePanel,{className:"panel-response-samples"},React.createElement(MediaTypeSamples,{mediaType:p,onChange:f}))):null))}export const SchemaDefinition=memo(SchemaDefinitionComponent);const Description=styled.div`
1
+ import React,{memo,useCallback,useMemo}from"react";import styled from"styled-components";import{PanelBody,LayoutVariant}from"@redocly/theme";import{useRecoilState,useRecoilValue}from"recoil";import{setRecoil}from"recoil-nexus";import{SamplesMiddlePanel,SamplesPanel,Row,Section}from"../common";import{getMediaType}from"../../models";import{MediaTypeSamples}from"../PayloadSamples";import{Schema}from"../Schema";import{Markdown}from"../Markdown";import{CodePanel}from"../Panel";import{layoutSelector,showRightPanelToggleSelector}from"../../recoil/app";import{globalStoreSelector}from"../../recoil/store";import{operationStore}from"../../recoil/operation";const getMediaTypeInfo=(e,o)=>{if(!e)return{};const a={schema:{$ref:e}};return o&&(a.examples={example:{$ref:o}}),a};function SchemaDefinitionComponent({schemaRef:e,exampleRef:o,showReadOnly:a=!0,showWriteOnly:t=!1}){var l,n,i;const r=useRecoilValue(layoutSelector),{parser:m,options:c}=useRecoilValue(globalStoreSelector),s=useRecoilValue(showRightPanelToggleSelector),p=useMemo((()=>getMediaType(m,"json",!1,getMediaTypeInfo(e,o),c,{operation:{pointer:"SchemaDefinitionComponent"}})),[o,c,m,e]),[d,u]=useRecoilState(operationStore(null===(l=p.operation)||void 0===l?void 0:l.pointer)),S=useCallback((e=>{var o;const a=null===(o=p.schema)||void 0===o?void 0:o.oneOf;if(a&&(null==p?void 0:p.examples)&&Object.keys(null==p?void 0:p.examples).includes(e)){const o=a.findIndex((o=>o.title===e));-1!==o&&p.schema&&setRecoil(operationStore(p.schema.deps.operation.pointer),(e=>{var a,t,l;return Object.assign(Object.assign({},e),{activeExampleName:(null===(l=null===(t=null===(a=p.schema)||void 0===a?void 0:a.oneOf)||void 0===t?void 0:t[o])||void 0===l?void 0:l.title)||e.activeExampleName,activeOneOf:o})}))}d.activeExampleName!==e&&u((o=>Object.assign(Object.assign({},o),{activeExampleName:e})))}),[null==p?void 0:p.examples,p.schema,d.activeExampleName,u]);return React.createElement(Section,null,React.createElement(Row,{layout:r},React.createElement(SamplesMiddlePanel,{isStacked:r===LayoutVariant.STACKED||!s},(null===(n=p.schema)||void 0===n?void 0:n.description)&&React.createElement(Description,null,React.createElement(Markdown,{source:null===(i=p.schema)||void 0===i?void 0:i.description})),React.createElement(StyledPanelBody,{className:"panel-default"},React.createElement(Schema,{skipWriteOnly:!t,skipReadOnly:!a,schema:p.schema}))),s?React.createElement(SamplesPanel,null,React.createElement(CodePanel,{className:"panel-response-samples"},React.createElement(MediaTypeSamples,{mediaType:p,onChange:S}))):null))}export const SchemaDefinition=memo(SchemaDefinitionComponent);const Description=styled.div`
2
2
  margin-bottom: var(--spacing-vertical);
3
3
  `,StyledPanelBody=styled(PanelBody)`
4
4
  --panel-schemas-body-padding: var(--panel-body-padding);
@@ -9,8 +9,7 @@ interface SectionContentProps {
9
9
  name: string;
10
10
  href?: string;
11
11
  };
12
- showApiInfo: boolean;
13
12
  showNextButton: Options['showNextButton'];
14
13
  }
15
- export declare function SectionContent({ items, pagination, nextSectionLink, showNextButton, showApiInfo, }: SectionContentProps): JSX.Element;
14
+ export declare function SectionContent({ items, pagination, nextSectionLink, showNextButton, }: SectionContentProps): JSX.Element;
16
15
  export {};
@@ -1,2 +1,2 @@
1
- import React,{useMemo}from"react";import{ApiInfo}from"../ApiInfo";import{ContentItem}from"../ContentItem";import{NextSectionButton}from"../NextSectionButton";import{Pagination}from"../../services";export function SectionContent({items:t,pagination:e,nextSectionLink:n,showNextButton:o,showApiInfo:i}){const a=useMemo((()=>e===Pagination.None?t:null==t?void 0:t.filter((t=>"section"===t.type))),[t,e]);return React.createElement(React.Fragment,null,i&&React.createElement(ApiInfo,null),a&&a.map((t=>React.createElement(ContentItem,{key:t.id,item:t,pagination:e,showNextButton:o}))),o&&n&&React.createElement(NextSectionButton,{href:n.href||"",label:n.name,pagination:e}))}
1
+ import React,{useMemo}from"react";import{ContentItem}from"../ContentItem";import{NextSectionButton}from"../NextSectionButton";import{Pagination}from"../../services";export function SectionContent({items:t,pagination:e,nextSectionLink:n,showNextButton:o}){const i=useMemo((()=>e===Pagination.None?t:null==t?void 0:t.filter((t=>"section"===t.type))),[t,e]);return React.createElement(React.Fragment,null,i.map((t=>React.createElement(ContentItem,{key:t.id,item:t}))),o&&n&&React.createElement(NextSectionButton,{href:n.href||"",label:n.name,pagination:e}))}
2
2
  //# sourceMappingURL=SectionContent.js.map
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Actions: () => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from"react";import{useRecoilState,useRecoilValue}from"recoil";import{SidebarActions,LayoutVariant}from"@redocly/theme";import{collapsedSidebarSelector,layoutSelector,showRightPanelToggleSelector}from"../../recoil/app";import{globalOptionsSelector}from"../../recoil/store";export const Actions=()=>{const{showChangeLayoutButton:e,showRightPanelToggle:o}=useRecoilValue(globalOptionsSelector),[t,a]=useRecoilState(layoutSelector),[l,i]=useRecoilState(showRightPanelToggleSelector),[c,r]=useRecoilState(collapsedSidebarSelector);return React.createElement(React.Fragment,null,React.createElement("div",{"data-component-name":"Sidebar/Actions",style:{position:"sticky",top:"calc(100vh - var(--layout-controls-height) - 20px)"}},React.createElement(SidebarActions,{showChangeLayoutButton:e,showRightPanelToggle:l,layout:t,initialShowRightPanelToggle:o,onChangeRightPanelViewClick:()=>i((e=>!e)),onChangeViewClick:()=>a(t===LayoutVariant.STACKED?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED),collapsedSidebar:c,onChangeCollapseSidebarClick:()=>r((e=>!e)),isOpenapiDocs:!0})))};
2
+ //# sourceMappingURL=Actions.js.map
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ExtendedMenuItem } from './types';
3
+ import { Pagination } from '../../services';
3
4
  interface MenuItemProps {
4
5
  active?: boolean;
5
6
  item: ExtendedMenuItem;
7
+ pagination?: Pagination;
6
8
  onClick?: () => void;
7
9
  }
8
10
  export declare const MenuItem: React.NamedExoticComponent<React.PropsWithChildren<MenuItemProps>>;
@@ -1,2 +1,2 @@
1
- import React,{memo,useCallback}from"react";import{Badge}from"@redocly/theme";import{MenuItemLi,MenuItemTitle}from"./styled";import{MenuItems}from"./MenuItems";import{MenuItemLink}from"./MenuItemLink";import{MenuOperationItemContent}from"./MenuOperationItemContent";import{ShelfIcon}from"../icons";import{encodeBackSlashes}from"../../utils";import{useMenuItemExpanded}from"./hooks";function MenuItemComponent({item:e,children:t,onClick:n}){var m;const[o,i]=useMenuItemExpanded(e),a=useCallback((()=>{e.href&&e.hasActiveSubItem||i(!o)}),[o,e.href,e.hasActiveSubItem,i]),c=(null===(m=e.items)||void 0===m?void 0:m.length)>0,r=encodeBackSlashes(e.href);return React.createElement(MenuItemLi,{depth:e.depth,"data-item-id":e.id,onClick:n},"operation"===e.type?React.createElement(MenuOperationItemContent,{item:e,to:r,active:e.active},t):React.createElement(MenuItemLink,{to:r,depth:e.depth,type:e.type,hasChildren:c,active:e.active,onClick:a},e.depth>0&&c&&React.createElement(ShelfIcon,{direction:o?"down":"right"})||null,e.isSchema?React.createElement(Badge,{type:"schema"},"schema"):null,React.createElement(MenuItemTitle,{title:e.name},e.name,t)),c&&React.createElement(MenuItems,{expanded:o,items:e.items}))}export const MenuItem=memo(MenuItemComponent);
1
+ import React,{memo,useCallback}from"react";import{Badge}from"@redocly/theme";import{Pagination}from"../../services";import{MenuItemLi,MenuItemTitle}from"./styled";import{MenuItems}from"./MenuItems";import{MenuItemLink}from"./MenuItemLink";import{MenuOperationItemContent}from"./MenuOperationItemContent";import{ShelfIcon}from"../icons";import{encodeBackSlashes}from"../../utils";import{useMenuItemExpanded}from"./hooks";function MenuItemComponent({item:e,children:t,onClick:n,pagination:m}){var i;const[o,a]=useMenuItemExpanded(e),c="tag"!==e.type||e.description||m!==Pagination.Item?encodeBackSlashes(e.href):"",r=useCallback((()=>{c&&e.hasActiveSubItem||a(!o)}),[c,e.hasActiveSubItem,a,o]),l=(null===(i=e.items)||void 0===i?void 0:i.length)>0;return React.createElement(MenuItemLi,{depth:e.depth,"data-item-id":e.id,onClick:n},"operation"===e.type?React.createElement(MenuOperationItemContent,{item:e,to:c,active:e.active},t):React.createElement(MenuItemLink,{to:c,depth:e.depth,type:e.type,hasChildren:l,active:e.active,onClick:r},e.depth>0&&l&&React.createElement(ShelfIcon,{direction:o?"down":"right"})||null,e.isSchema?React.createElement(Badge,{type:"schema"},"schema"):null,React.createElement(MenuItemTitle,{title:e.name},e.name,t)),l&&React.createElement(MenuItems,{expanded:o,items:e.items}))}export const MenuItem=memo(MenuItemComponent);
2
2
  //# sourceMappingURL=MenuItem.js.map
@@ -1,2 +1,2 @@
1
- import React,{memo}from"react";import{StyledMenuItemLink,MenuItemLabel}from"./styled";function MenuItemLinkComponent({href:e,children:t,to:n,hasChildren:m,deprecated:r,depth:c,active:o,type:a,onClick:i}){return n?React.createElement(StyledMenuItemLink,{$active:o,$hasChildren:m,type:a,deprecated:r,depth:c,to:n,onClick:i},t):React.createElement(MenuItemLabel,{type:a,active:o,deprecated:r,depth:c,href:e},t)}export const MenuItemLink=memo(MenuItemLinkComponent);
1
+ import React,{memo}from"react";import{StyledMenuItemLink,MenuItemLabel}from"./styled";function MenuItemLinkComponent({href:e,children:t,to:n,hasChildren:m,deprecated:r,depth:c,active:i,type:o,onClick:a}){return n?React.createElement(StyledMenuItemLink,{$active:i,$hasChildren:m,type:o,deprecated:r,depth:c,to:n,onClick:a},t):React.createElement(MenuItemLabel,{type:o,active:i,deprecated:r,depth:c,href:e,$hasChildren:m,onClick:a},t)}export const MenuItemLink=memo(MenuItemLinkComponent);
2
2
  //# sourceMappingURL=MenuItemLink.js.map
@@ -1,2 +1,2 @@
1
- import React,{memo}from"react";import{MenuItem}from"./MenuItem";import{MenuItemUl}from"./styled";import{MenuExternalLink}from"./MenuItemEternalLink";function MenuItemsComponents({items:e,root:t,className:n,linksBefore:m=[],linksAfter:r=[],expanded:a=!0,style:i}){return React.createElement(MenuItemUl,{className:n,style:i,expanded:a,role:t?"navigation":void 0},m.map((e=>React.createElement(MenuExternalLink,{key:JSON.stringify(e),link:e}))),e.map((e=>React.createElement(MenuItem,{key:e.id,item:e}))),r.map((e=>React.createElement(MenuExternalLink,{key:JSON.stringify(e),link:e}))))}export const MenuItems=memo(MenuItemsComponents);
1
+ import React,{memo}from"react";import{useRecoilValue}from"recoil";import{MenuItem}from"./MenuItem";import{MenuItemUl}from"./styled";import{MenuExternalLink}from"./MenuItemEternalLink";import{globalOptionsSelector}from"../../recoil/store";import{Pagination}from"../../services";import{isRootItem}from"../ContentItems/helpers";function MenuItemsComponents({items:e,root:t,className:n,linksBefore:o=[],linksAfter:i=[],expanded:m=!0,style:r}){const{pagination:a,hideInfoSection:l}=useRecoilValue(globalOptionsSelector);return React.createElement(MenuItemUl,{className:n,style:r,expanded:m,role:t?"navigation":void 0},o.map((e=>React.createElement(MenuExternalLink,{key:JSON.stringify(e),link:e}))),e.map((e=>l&&a===Pagination.None&&isRootItem(e)?null:React.createElement(MenuItem,{key:e.id,item:e,pagination:a}))),i.map((e=>React.createElement(MenuExternalLink,{key:JSON.stringify(e),link:e}))))}export const MenuItems=memo(MenuItemsComponents);
2
2
  //# sourceMappingURL=MenuItems.js.map
@@ -8,13 +8,15 @@ export declare const MenuItemLi: import("styled-components").StyledComponent<"li
8
8
  export declare const StyledMenuItemLink: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>>, any, {
9
9
  role: "menuitem";
10
10
  className: `-depth${number} ` | `-depth${number} active`;
11
+ 'data-cy': string;
11
12
  } & Omit<import("./types").MenuItemLinkProps, "active" | "hasChildren"> & {
12
13
  $active: boolean;
13
14
  $hasChildren: boolean | undefined;
14
- }, "className" | "role">;
15
+ }, "className" | "role" | "data-cy">;
15
16
  export declare const MenuItemLabel: import("styled-components").StyledComponent<any, any, {
16
17
  role: "menuitem";
17
18
  className: `-depth${number} ` | `-depth${number} active`;
19
+ 'data-cy': string;
18
20
  } & Omit<import("./types").MenuItemLinkProps, "active" | "hasChildren"> & {
19
21
  $active: boolean;
20
22
  $hasChildren: boolean | undefined;
@@ -13,7 +13,7 @@ import styled from"styled-components";import{Link}from"react-router-dom";import{
13
13
  text-overflow: ellipsis;
14
14
  padding: 0;
15
15
  ${({depth:e})=>0===e?"margin-top: 10px":""};
16
- `;export const StyledMenuItemLink=styled(Link).attrs((({depth:e,$active:r})=>({role:"menuitem",className:`-depth${e} ${r?"active":""}`})))`
16
+ `;export const StyledMenuItemLink=styled(Link).attrs((({depth:e,$active:r,to:i})=>({role:"menuitem",className:`-depth${e} ${r?"active":""}`,"data-cy":i})))`
17
17
  cursor: pointer;
18
18
  position: relative;
19
19
  margin: ${({depth:e})=>`1px 0 1px calc( var(--sidebar-offset-left) + var(--sidebar-item-nested-offset) * ${e>0?e-1:e})`};