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

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 (200) hide show
  1. package/dist/console.redocly-openapi-docs.min.js +100 -98
  2. package/dist/oauth2-redirect.js +1 -1
  3. package/dist/redocly-openapi-docs.min.js +1021 -1027
  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/OperationParameters/OperationParameters.js +1 -1
  17. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -1
  18. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  19. package/lib/components/RedoclyOpenAPIDocs/index.d.ts +0 -1
  20. package/lib/components/RedoclyOpenAPIDocs/index.js +1 -1
  21. package/lib/components/RedoclyOpenAPIDocs/styled.d.ts +2 -2
  22. package/lib/components/RedoclyOpenAPIDocs/styled.js +8 -27
  23. package/lib/components/RedoclyOpenAPIDocs/types.d.ts +5 -4
  24. package/lib/components/RedoclyOpenAPIDocs/utils.js +1 -1
  25. package/lib/components/SchemaDefinition/SchemaDefinition.js +1 -1
  26. package/lib/components/SectionContent/SectionContent.d.ts +1 -2
  27. package/lib/components/SectionContent/SectionContent.js +1 -1
  28. package/lib/components/SideMenu/Actions.d.ts +2 -0
  29. package/lib/components/SideMenu/Actions.js +2 -0
  30. package/lib/components/SideMenu/MenuItem.d.ts +2 -0
  31. package/lib/components/SideMenu/MenuItem.js +1 -1
  32. package/lib/components/SideMenu/MenuItemLink.js +1 -1
  33. package/lib/components/SideMenu/MenuItems.js +1 -1
  34. package/lib/components/SideMenu/styled.d.ts +3 -1
  35. package/lib/components/SideMenu/styled.js +1 -1
  36. package/lib/components/StickySidebar/StickyResponsiveSidebar.d.ts +1 -0
  37. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +6 -6
  38. package/lib/components/TagItems/TagItems.js +1 -1
  39. package/lib/components/common/panels.d.ts +1 -1
  40. package/lib/components/common/panels.js +2 -2
  41. package/lib/components/index.d.ts +1 -3
  42. package/lib/components/index.js +1 -1
  43. package/lib/components/rightPanel/Console/Console.js +1 -1
  44. package/lib/components/rightPanel/Console/shallowCopyForTryIt.d.ts +2 -0
  45. package/lib/components/rightPanel/Console/shallowCopyForTryIt.js +2 -0
  46. package/lib/components/rightPanel/ParameterArray.js +3 -1
  47. package/lib/components/rightPanel/utils.d.ts +0 -1
  48. package/lib/components/rightPanel/utils.js +1 -1
  49. package/lib/constants.d.ts +1 -4
  50. package/lib/constants.js +1 -1
  51. package/lib/hoc/types.d.ts +18 -0
  52. package/lib/hoc/withStore.d.ts +3 -0
  53. package/lib/hoc/withStore.js +2 -0
  54. package/lib/index.d.ts +12 -8
  55. package/lib/index.js +1 -1
  56. package/lib/models/group.d.ts +1 -1
  57. package/lib/models/group.js +1 -1
  58. package/lib/models/index.d.ts +1 -1
  59. package/lib/models/index.js +1 -1
  60. package/lib/models/operation.js +1 -1
  61. package/lib/models/types.d.ts +2 -1
  62. package/lib/recoil/app.d.ts +3 -1
  63. package/lib/recoil/app.js +1 -1
  64. package/lib/services/OpenAPIParser.d.ts +0 -1
  65. package/lib/services/OpenAPIParser.js +1 -1
  66. package/lib/services/Options/normalizeOptions.js +1 -1
  67. package/lib/services/Options/types.d.ts +3 -2
  68. package/lib/services/code-samples/generator.js +1 -1
  69. package/lib/services/history/helpers.js +1 -1
  70. package/lib/services/menu/builder.js +1 -1
  71. package/lib/services/menu/markdown.js +1 -1
  72. package/lib/services/menu/operation.js +1 -1
  73. package/lib/services/menu/tags.js +1 -1
  74. package/lib/services/search/DeepSearchStore.js +1 -1
  75. package/lib/services/types.d.ts +1 -0
  76. package/lib/services/utils.d.ts +0 -1
  77. package/lib/services/utils.js +1 -1
  78. package/lib/standalone.d.ts +1 -1
  79. package/lib/standalone.js +1 -1
  80. package/lib/types/open-api.d.ts +0 -1
  81. package/lib/utils/helpers.js +1 -1
  82. package/lib/utils/index.d.ts +0 -1
  83. package/lib/utils/index.js +1 -1
  84. package/lib/utils/loadAndBundleSpec.d.ts +0 -2
  85. package/lib/utils/loadAndBundleSpec.js +1 -1
  86. package/lib/utils/openapi.d.ts +4 -1
  87. package/lib/utils/openapi.js +1 -1
  88. package/lib/utils/path.d.ts +2 -1
  89. package/lib/utils/path.js +1 -1
  90. package/lib-esm/components/ApiInfo/ApiInfo.d.ts +4 -1
  91. package/lib-esm/components/ApiInfo/ApiInfo.js +1 -1
  92. package/lib-esm/components/ContentItem/ContentItem.d.ts +0 -3
  93. package/lib-esm/components/ContentItem/ContentItem.js +1 -1
  94. package/lib-esm/components/ContentItems/ContentItems.d.ts +1 -7
  95. package/lib-esm/components/ContentItems/ContentItems.js +1 -1
  96. package/lib-esm/components/ContentItems/helpers.d.ts +9 -0
  97. package/lib-esm/components/ContentItems/helpers.js +1 -1
  98. package/lib-esm/components/Fields/FieldDetails.js +1 -1
  99. package/lib-esm/components/Fields/styled.d.ts +1 -0
  100. package/lib-esm/components/Fields/styled.js +4 -0
  101. package/lib-esm/components/OperationItem/OperationItem.js +2 -2
  102. package/lib-esm/components/OperationParameters/OperationParameters.js +1 -1
  103. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -1
  104. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  105. package/lib-esm/components/RedoclyOpenAPIDocs/index.d.ts +0 -1
  106. package/lib-esm/components/RedoclyOpenAPIDocs/index.js +1 -1
  107. package/lib-esm/components/RedoclyOpenAPIDocs/styled.d.ts +2 -2
  108. package/lib-esm/components/RedoclyOpenAPIDocs/styled.js +32 -51
  109. package/lib-esm/components/RedoclyOpenAPIDocs/types.d.ts +5 -4
  110. package/lib-esm/components/RedoclyOpenAPIDocs/utils.js +1 -1
  111. package/lib-esm/components/SchemaDefinition/SchemaDefinition.js +1 -1
  112. package/lib-esm/components/SectionContent/SectionContent.d.ts +1 -2
  113. package/lib-esm/components/SectionContent/SectionContent.js +1 -1
  114. package/lib-esm/components/SideMenu/Actions.d.ts +2 -0
  115. package/lib-esm/components/SideMenu/Actions.js +2 -0
  116. package/lib-esm/components/SideMenu/MenuItem.d.ts +2 -0
  117. package/lib-esm/components/SideMenu/MenuItem.js +1 -1
  118. package/lib-esm/components/SideMenu/MenuItemLink.js +1 -1
  119. package/lib-esm/components/SideMenu/MenuItems.js +1 -1
  120. package/lib-esm/components/SideMenu/styled.d.ts +3 -1
  121. package/lib-esm/components/SideMenu/styled.js +1 -1
  122. package/lib-esm/components/StickySidebar/StickyResponsiveSidebar.d.ts +1 -0
  123. package/lib-esm/components/StickySidebar/StickyResponsiveSidebar.js +6 -6
  124. package/lib-esm/components/TagItems/TagItems.js +1 -1
  125. package/lib-esm/components/common/panels.d.ts +1 -1
  126. package/lib-esm/components/common/panels.js +2 -2
  127. package/lib-esm/components/index.d.ts +1 -3
  128. package/lib-esm/components/index.js +1 -1
  129. package/lib-esm/components/rightPanel/Console/Console.js +1 -1
  130. package/lib-esm/components/rightPanel/Console/shallowCopyForTryIt.d.ts +2 -0
  131. package/lib-esm/components/rightPanel/Console/shallowCopyForTryIt.js +2 -0
  132. package/lib-esm/components/rightPanel/ParameterArray.js +3 -1
  133. package/lib-esm/components/rightPanel/utils.d.ts +0 -1
  134. package/lib-esm/components/rightPanel/utils.js +1 -1
  135. package/lib-esm/constants.d.ts +1 -4
  136. package/lib-esm/constants.js +1 -1
  137. package/lib-esm/hoc/types.d.ts +18 -0
  138. package/lib-esm/hoc/withStore.d.ts +3 -0
  139. package/lib-esm/hoc/withStore.js +2 -0
  140. package/lib-esm/index.d.ts +12 -8
  141. package/lib-esm/index.js +1 -1
  142. package/lib-esm/models/group.d.ts +1 -1
  143. package/lib-esm/models/group.js +1 -1
  144. package/lib-esm/models/index.d.ts +1 -1
  145. package/lib-esm/models/index.js +1 -1
  146. package/lib-esm/models/operation.js +1 -1
  147. package/lib-esm/models/types.d.ts +2 -1
  148. package/lib-esm/recoil/app.d.ts +3 -1
  149. package/lib-esm/recoil/app.js +1 -1
  150. package/lib-esm/services/OpenAPIParser.d.ts +0 -1
  151. package/lib-esm/services/OpenAPIParser.js +1 -1
  152. package/lib-esm/services/Options/normalizeOptions.js +1 -1
  153. package/lib-esm/services/Options/types.d.ts +3 -2
  154. package/lib-esm/services/code-samples/generator.js +1 -1
  155. package/lib-esm/services/history/helpers.js +1 -1
  156. package/lib-esm/services/menu/builder.js +1 -1
  157. package/lib-esm/services/menu/markdown.js +1 -1
  158. package/lib-esm/services/menu/operation.js +1 -1
  159. package/lib-esm/services/menu/tags.js +1 -1
  160. package/lib-esm/services/search/DeepSearchStore.js +1 -1
  161. package/lib-esm/services/types.d.ts +1 -0
  162. package/lib-esm/services/utils.d.ts +0 -1
  163. package/lib-esm/services/utils.js +1 -1
  164. package/lib-esm/standalone.d.ts +1 -1
  165. package/lib-esm/standalone.js +1 -1
  166. package/lib-esm/types/open-api.d.ts +0 -1
  167. package/lib-esm/utils/helpers.js +1 -1
  168. package/lib-esm/utils/index.d.ts +0 -1
  169. package/lib-esm/utils/index.js +1 -1
  170. package/lib-esm/utils/loadAndBundleSpec.d.ts +0 -2
  171. package/lib-esm/utils/loadAndBundleSpec.js +1 -1
  172. package/lib-esm/utils/openapi.d.ts +4 -1
  173. package/lib-esm/utils/openapi.js +1 -1
  174. package/lib-esm/utils/path.d.ts +2 -1
  175. package/lib-esm/utils/path.js +1 -1
  176. package/package.json +9 -10
  177. package/lib/components/ChangeViewButton/ChangeViewButton.d.ts +0 -2
  178. package/lib/components/ChangeViewButton/ChangeViewButton.js +0 -2
  179. package/lib/components/ChangeViewButton/index.d.ts +0 -1
  180. package/lib/components/ChangeViewButton/index.js +0 -2
  181. package/lib/components/ChangeViewButton/styled.d.ts +0 -4
  182. package/lib/components/ChangeViewButton/styled.js +0 -18
  183. package/lib/components/ToggleRightPanelButton/ToggleRightPanelButton.d.ts +0 -2
  184. package/lib/components/ToggleRightPanelButton/ToggleRightPanelButton.js +0 -2
  185. package/lib/components/ToggleRightPanelButton/index.d.ts +0 -1
  186. package/lib/components/ToggleRightPanelButton/index.js +0 -2
  187. package/lib/components/ToggleRightPanelButton/styled.d.ts +0 -4
  188. package/lib/components/ToggleRightPanelButton/styled.js +0 -17
  189. package/lib-esm/components/ChangeViewButton/ChangeViewButton.d.ts +0 -2
  190. package/lib-esm/components/ChangeViewButton/ChangeViewButton.js +0 -2
  191. package/lib-esm/components/ChangeViewButton/index.d.ts +0 -1
  192. package/lib-esm/components/ChangeViewButton/index.js +0 -2
  193. package/lib-esm/components/ChangeViewButton/styled.d.ts +0 -4
  194. package/lib-esm/components/ChangeViewButton/styled.js +0 -18
  195. package/lib-esm/components/ToggleRightPanelButton/ToggleRightPanelButton.d.ts +0 -2
  196. package/lib-esm/components/ToggleRightPanelButton/ToggleRightPanelButton.js +0 -2
  197. package/lib-esm/components/ToggleRightPanelButton/index.d.ts +0 -1
  198. package/lib-esm/components/ToggleRightPanelButton/index.js +0 -2
  199. package/lib-esm/components/ToggleRightPanelButton/styled.d.ts +0 -4
  200. package/lib-esm/components/ToggleRightPanelButton/styled.js +0 -17
@@ -1,2 +1,2 @@
1
- import{getGroup}from"../../models";import{GROUP_DEPTH}from"../../constants";import{alphabeticallyByProp,getValueFromMdParsedExtension,isOperationName,JsonPointer}from"../../utils";import{getOperationsItems}from"./operation";import{addMarkdownItems}from"./markdown";export function getTagsItems(e,t,n,o,a){let s;if(s=void 0===o?Object.keys(t):o.tags,!Array.isArray(s))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const i=s.map((e=>t[e]?(t[e].used=!0,t[e]):(console.warn(`Non-existing tag "${e}" is added to the group "${null==o?void 0:o.name}"`),null))),r=[];for(const t of i){if(!t)continue;const o=getGroup("tag",t,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},n);if(o.depth=GROUP_DEPTH+1,""===t.name){const e=[...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(void 0,t,o.depth+1,a)];r.push(...e);continue}const s=getTagRelatedSchema({definition:e.definition,tag:t,parent:o,schemaDefinitionsTagName:a.schemaDefinitionsTagName,options:{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel}});o.items=[...s,...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(o,t,o.depth+1,a)],r.push(o)}return a.sortTagsAlphabetically&&r.sort(alphabeticallyByProp("name")),r}export function getTagGroupsItems(e,t,n,o,a){const s=[];for(const i of n){const n=getGroup("group",i,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},t);n.depth=GROUP_DEPTH,n.items=getTagsItems(e,o,n,i,a),s.push(n)}return s}function getTagRelatedSchema({definition:e,tag:t,parent:n,schemaDefinitionsTagName:o,options:a}){var s;const i=o?[o]:[];return Object.entries((null===(s=e.components)||void 0===s?void 0:s.schemas)||{}).map((([e,o])=>{if(!(o["x-tags"]||i).includes(t.name))return null;const s=getGroup("schema",{name:e,"x-displayName":`${o.title||e}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${e}" /%}`,isSchema:!0,level:2},a,n);return s.depth=n.depth+1,s})).filter(Boolean)}export function getTagsWithOperations(e,t){const{definition:n}=e,o={},a=n["x-webhooks"]||n.webhooks;for(const e of t||[])o[e.name]=Object.assign(Object.assign({},e),{operations:[]});return n.paths&&getTags(e,n.paths,o),a&&getTags(e,a,o,!0),o}function getTags(e,t,n,o){for(const a of Object.keys(t||{})){const s=t[a],i=Object.keys(s).filter(isOperationName);for(const t of i){const i=s[t];if(s.$ref){const{resolved:t}=e.deref(s);getTags(e,{[a]:t},n,o);continue}let r=null==i?void 0:i.tags;r&&r.length||(r=[""]);for(const e of r){let r=n[e];void 0===r&&(r={name:e,operations:[]},n[e]=r),r["x-traitTag"]||r.operations.push(Object.assign(Object.assign({},i),{pathName:a,pointer:JsonPointer.compile(["paths",a,t]),httpVerb:t,pathParameters:s.parameters||[],pathServers:s.servers,isWebhook:!!o}))}}}}
1
+ import{getTagOrGroup}from"../../models/group";import{GROUP_DEPTH}from"../../constants";import{alphabeticallyByProp,getValueFromMdParsedExtension,isOperationName,JsonPointer}from"../../utils";import{getOperationsItems}from"./operation";import{addMarkdownItems}from"./markdown";export function getTagsItems(e,t,n,o,a){let s;if(s=void 0===o?Object.keys(t):o.tags,!Array.isArray(s))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const i=s.map((e=>t[e]?(t[e].used=!0,t[e]):(console.warn(`Non-existing tag "${e}" is added to the group "${null==o?void 0:o.name}"`),null))),r=[];for(const t of i){if(!t)continue;const o=getTagOrGroup("tag",t,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},n);if(o.depth=GROUP_DEPTH+1,""===t.name){const e=[...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(void 0,t,o.depth+1,a)];r.push(...e);continue}const s=getTagRelatedSchema({definition:e.definition,tag:t,parent:o,schemaDefinitionsTagName:a.schemaDefinitionsTagName,options:{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel}});o.items=[...s,...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(o,t,o.depth+1,a)],r.push(o)}return a.sortTagsAlphabetically&&r.sort(alphabeticallyByProp("name")),r}export function getTagGroupsItems(e,t,n,o,a){const s=[];for(const i of n){const n=getTagOrGroup("group",i,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},t);n.depth=GROUP_DEPTH,n.items=getTagsItems(e,o,n,i,a),s.push(n)}return s}function getTagRelatedSchema({definition:e,tag:t,parent:n,schemaDefinitionsTagName:o,options:a}){var s;const i=o?[o]:[];return Object.entries((null===(s=e.components)||void 0===s?void 0:s.schemas)||{}).map((([e,o])=>{if(!(o["x-tags"]||i).includes(t.name))return null;const s=getTagOrGroup("schema",{name:e,"x-displayName":`${o.title||e}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${e}" /%}`,isSchema:!0,level:2},a,n);return s.depth=n.depth+1,s})).filter(Boolean)}export function getTagsWithOperations(e,t){const{definition:n}=e,o={},a=n["x-webhooks"]||n.webhooks;for(const e of t||[])o[e.name]=Object.assign(Object.assign({},e),{operations:[]});return n.paths&&getTags(e,n.paths,o),a&&getTags(e,a,o,!0),o}function getTags(e,t,n,o){for(const a of Object.keys(t||{})){const s=t[a],i=Object.keys(s).filter(isOperationName);for(const t of i){const i=s[t];if(s.$ref){const{resolved:t}=e.deref(s);getTags(e,{[a]:t},n,o);continue}let r=null==i?void 0:i.tags;r&&r.length||(r=[""]);for(const e of r){let r=n[e];void 0===r&&(r={name:e,operations:[]},n[e]=r),r["x-traitTag"]||r.operations.push(Object.assign(Object.assign({},i),{pathName:a,pointer:JsonPointer.compile(["paths",a,t]),httpVerb:t,pathParameters:s.parameters||[],pathServers:s.servers,isWebhook:!!o}))}}}}
2
2
  //# sourceMappingURL=tags.js.map
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(i,a){function s(e){try{c(r.next(e))}catch(e){a(e)}}function n(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,n)}c((r=r.apply(e,t||[])).next())}))};import{getRecoil}from"recoil-nexus";import{SearchStore}from"./SearchStore";import{DEFAULT_SEARCH_MAX_DEPTH}from"../../constants";import{globalStoreSelector}from"../../recoil/store";import{getActiveMediaType,getOperation}from"../../models";import{operationStore}from"../../recoil/operation";import{normalizeText}from"../../utils";function removeMarkdown(e){return normalizeText(e).replace(/\[(.*?)][[(].*?[\])]/g,"$1")}export class DeepSearchStore extends SearchStore{constructor(e){super(),Object.defineProperty(this,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(this,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(this,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_SEARCH_MAX_DEPTH}),e.searchOperationTitleBoost&&(this.operationTitleBoost=e.searchOperationTitleBoost),e.searchTagTitleBoost&&(this.tagTitleBoost=e.searchTagTitleBoost),e.searchFieldLevelBoost&&(this.fieldLevelBoost=e.searchFieldLevelBoost),"path-only"===e.searchMode&&(this.pathOnly=!0),e.searchMaxDepth&&(this.searchMaxDepth=e.searchMaxDepth)}indexItems(e){const t=e=>{e&&e.forEach((e=>{if("operation"===e.type&&this.pathOnly){const t=e;this.add(t.path,"",{menuId:t.id,boost:this.operationTitleBoost})}else{if("group"===e.type||this.pathOnly||(this.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?this.operationTitleBoost:this.tagTitleBoost}),e.description&&this.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){const t=e.operationDefinition,{parser:o,options:r}=getRecoil(globalStoreSelector),i=getOperation(o,t,void 0,r,e.href);for(const t of i.parameters||[])this.add(t.name,removeMarkdown(t.description),{menuId:e.id,place:"parameters",path:[t.name]});const a=i.requestBody&&i.requestBody.content&&getActiveMediaType(i.requestBody.content).schema;this.indexSchema(a,e.id,"request fields"),i.responses.forEach((t=>{const o=t.content&&getActiveMediaType(t.content).schema;o&&this.indexSchema(o,e.id,`response ${t.code} fields`)}))}t(e.items)}}))};t(e),this.searchWorker.done()}indexSchema(e,t,o,r=[],i=0){if(!e)return;if(i>this.searchMaxDepth||e.isCircular)return;const{activeOneOf:a}=getRecoil(operationStore(e.deps.operation.pointer));if((e=e.oneOf&&e.oneOf[a]||e).fields)for(const a of e.fields){const e=r.concat([a.name]);"additionalProperties"!==a.kind&&(this.add(a.name,removeMarkdown(a.description),{menuId:t,place:o,path:e,boost:Math.pow(this.fieldLevelBoost,i)}),this.indexSchema(a.schema,t,o,e,i+1))}e.items&&this.indexSchema(e.items,t,o,r,i+1)}add(e,t,o){this.searchWorker.add(e,t,o)}search(e){return __awaiter(this,void 0,void 0,(function*(){return yield this.searchWorker.search(e)}))}toJS(){return __awaiter(this,void 0,void 0,(function*(){return this.searchWorker.toJS()}))}dispose(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(i,a){function s(e){try{c(r.next(e))}catch(e){a(e)}}function n(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,n)}c((r=r.apply(e,t||[])).next())}))};import{getRecoil}from"recoil-nexus";import{SearchStore}from"./SearchStore";import{DEFAULT_SEARCH_MAX_DEPTH}from"../../constants";import{globalStoreSelector}from"../../recoil/store";import{getActiveMediaType}from"../../models/mediaContent";import{getOperation}from"../../models/operation";import{operationStore}from"../../recoil/operation";import{normalizeText}from"../../utils";function removeMarkdown(e){return normalizeText(e).replace(/\[(.*?)][[(].*?[\])]/g,"$1")}export class DeepSearchStore extends SearchStore{constructor(e){super(),Object.defineProperty(this,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(this,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(this,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_SEARCH_MAX_DEPTH}),e.searchOperationTitleBoost&&(this.operationTitleBoost=e.searchOperationTitleBoost),e.searchTagTitleBoost&&(this.tagTitleBoost=e.searchTagTitleBoost),e.searchFieldLevelBoost&&(this.fieldLevelBoost=e.searchFieldLevelBoost),"path-only"===e.searchMode&&(this.pathOnly=!0),e.searchMaxDepth&&(this.searchMaxDepth=e.searchMaxDepth)}indexItems(e){const t=e=>{e&&e.forEach((e=>{if("operation"===e.type&&this.pathOnly){const t=e;this.add(t.path,"",{menuId:t.id,boost:this.operationTitleBoost})}else{if("group"===e.type||this.pathOnly||(this.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?this.operationTitleBoost:this.tagTitleBoost}),e.description&&this.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){const t=e.operationDefinition,{parser:o,options:r}=getRecoil(globalStoreSelector),i=getOperation(o,t,void 0,r,e.href);for(const t of i.parameters||[])this.add(t.name,removeMarkdown(t.description),{menuId:e.id,place:"parameters",path:[t.name]});const a=i.requestBody&&i.requestBody.content&&getActiveMediaType(i.requestBody.content).schema;this.indexSchema(a,e.id,"request fields"),i.responses.forEach((t=>{const o=t.content&&getActiveMediaType(t.content).schema;o&&this.indexSchema(o,e.id,`response ${t.code} fields`)}))}t(e.items)}}))};t(e),this.searchWorker.done()}indexSchema(e,t,o,r=[],i=0){if(!e)return;if(i>this.searchMaxDepth||e.isCircular)return;const{activeOneOf:a}=getRecoil(operationStore(e.deps.operation.pointer));if((e=e.oneOf&&e.oneOf[a]||e).fields)for(const a of e.fields){const e=r.concat([a.name]);"additionalProperties"!==a.kind&&(this.add(a.name,removeMarkdown(a.description),{menuId:t,place:o,path:e,boost:Math.pow(this.fieldLevelBoost,i)}),this.indexSchema(a.schema,t,o,e,i+1))}e.items&&this.indexSchema(e.items,t,o,r,i+1)}add(e,t,o){this.searchWorker.add(e,t,o)}search(e){return __awaiter(this,void 0,void 0,(function*(){return yield this.searchWorker.search(e)}))}toJS(){return __awaiter(this,void 0,void 0,(function*(){return this.searchWorker.toJS()}))}dispose(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}
2
2
  //# sourceMappingURL=DeepSearchStore.js.map
@@ -46,6 +46,7 @@ export interface IMenuItem {
46
46
  isSchema?: boolean;
47
47
  httpVerb?: string;
48
48
  path?: string;
49
+ definition?: OpenAPIDefinition;
49
50
  }
50
51
  export type TagInfo = OpenAPITag & {
51
52
  operations: ExtendedOpenAPIOperation[];
@@ -1,4 +1,3 @@
1
- export declare function normalizePath(path: string): string;
2
1
  /**
3
2
  * Compare mime-types ignoring charset or other params (application/json;charset=UTF-8)
4
3
  * @param a
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}s((n=n.apply(e,t||[])).next())}))};import merge from"deepmerge";import{isMergeableObject,isObject}from"../utils";export function normalizePath(e){return e.startsWith("/")||(e="/"+e),e.endsWith("/")&&(e=e.slice(0,-1)),e}export function isSameMime(e,t){return!(!e||!t)&&normalizeMimeType(e)===normalizeMimeType(t)}export function normalizeMimeType(e){if(!e)return;const t=e.split(";")[0].toLowerCase(),[r,n]=t.split("/");if(void 0===n)return r;return`${r}/${n.split("+").pop()}`}export function unescapeServerVariables(e){const t=new RegExp("%7B","g"),r=new RegExp("%7D","g");return e.replace(t,"{").replace(r,"}").replace("///","//")}export function arrayMergeStrategy(e,t){if(!e.length||!hasObjectOrArray(e))return t;const r=e.filter((e=>Object.keys(e).length>0));return t.forEach((function(t,n){isMergeableObject(t)?r[n]=merge(e[n],t,{arrayMerge:arrayMergeStrategy}):Array.isArray(t)?r.push(t):r[n]=t})),r}const hasObjectOrArray=e=>e.some((e=>isObject(e)&&Object.keys(e).length>0));export function isEmptyObject(e){return!!e&&0===Object.keys(e).length}export const cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;export function randString(e=32){let t="";for(;t.length<e;)t+=Math.random().toString(32).substring(2);return t.substring(0,e)}export function encodeState(e){const t=Object.assign({randomStr:randString()},e);return btoa(JSON.stringify(t))}export function sha256(e){return __awaiter(this,void 0,void 0,(function*(){const t=(new TextEncoder).encode(e);return null==cryptoLib?void 0:cryptoLib.subtle.digest("SHA-256",t)}))}export function base64UrlEncode(e){if(e)return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export function deepClone(e){if("object"!=typeof e||null===e)return e;const t=Array.isArray(e)?[]:{};for(const r in e){const n=e[r];t[r]=deepClone(n)}return t}
1
+ var __awaiter=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}s((n=n.apply(e,r||[])).next())}))};import merge from"deepmerge";import{isMergeableObject,isObject}from"../utils/helpers";export function isSameMime(e,r){return!(!e||!r)&&normalizeMimeType(e)===normalizeMimeType(r)}export function normalizeMimeType(e){if(!e)return;const r=e.split(";")[0].toLowerCase(),[t,n]=r.split("/");if(void 0===n)return t;return`${t}/${n.split("+").pop()}`}export function unescapeServerVariables(e){const r=new RegExp("%7B","g"),t=new RegExp("%7D","g");return e.replace(r,"{").replace(t,"}").replace("///","//")}export function arrayMergeStrategy(e,r){if(!e.length||!hasObjectOrArray(e))return r;const t=e.filter((e=>Object.keys(e).length>0));return r.forEach((function(r,n){isMergeableObject(r)?t[n]=merge(e[n],r,{arrayMerge:arrayMergeStrategy}):Array.isArray(r)?t.push(r):t[n]=r})),t}const hasObjectOrArray=e=>e.some((e=>isObject(e)&&Object.keys(e).length>0));export function isEmptyObject(e){return!!e&&0===Object.keys(e).length}export const cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;export function randString(e=32){let r="";for(;r.length<e;)r+=Math.random().toString(32).substring(2);return r.substring(0,e)}export function encodeState(e){const r=Object.assign({randomStr:randString()},e);return btoa(JSON.stringify(r))}export function sha256(e){return __awaiter(this,void 0,void 0,(function*(){const r=(new TextEncoder).encode(e);return null==cryptoLib?void 0:cryptoLib.subtle.digest("SHA-256",r)}))}export function base64UrlEncode(e){if(e)return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export function deepClone(e){if("object"!=typeof e||null===e)return e;const r=Array.isArray(e)?[]:{};for(const t in e){const n=e[t];r[t]=deepClone(n)}return r}
2
2
  //# sourceMappingURL=utils.js.map
@@ -16,7 +16,7 @@ import 'url-polyfill';
16
16
  import type { OpenAPIDefinition } from './types';
17
17
  import type { RawOptions } from './services/Options/types';
18
18
  import type { StoreProviderProps } from './components';
19
- import type { LayoutVariant } from './constants';
19
+ import type { LayoutVariant } from '@redocly/theme';
20
20
  import type { SpecVersions } from './services/types';
21
21
  export { setSecurityDetails, setParameterValue, setSecurityDetailsVariants } from './utils';
22
22
  export declare function toggleLayout(layout?: LayoutVariant): void;
@@ -1,2 +1,2 @@
1
- import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{setRecoil,getRecoil}from"recoil-nexus";import{querySelector,IS_BROWSER,getJsUrl}from"./utils";import{RedoclyOpenAPIDocs,RedoclyOpenAPIDocsStandalone,RedoclyOpenAPIDocsMultiStandalone}from"./components";import{appLocalStore,appSessionStore}from"./recoil/app";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){const t=getRecoil(appLocalStore);setRecoil(appLocalStore,Object.assign(Object.assign({},t),{layout:e}))}export function toggleRightPanel(e){const t=getRecoil(appSessionStore);setRecoil(appSessionStore,Object.assign(Object.assign({},t),{showRightPanelToggle:e}))}const url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){const t={},o=e.attributes;for(let e=0;e<o.length;e++){const r=o[e];t[r.name]=r.value}return t}function parseOptionsFromElement(e){const t=attributesMap(e),o={};for(const e in t){o[e.replace(/-(.)/g,((e,t)=>t.toUpperCase()))]=t[e]}return o}export function hydrate(e,t=document.querySelector("redoc")){hydrateComponent(React.createElement(RedoclyOpenAPIDocs,{store:e}),t)}export function init(e,t={},o=querySelector("redoc"),r){if(null===o)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');let n,i;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyOpenAPIDocsMultiStandalone,{definitions:e,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r):("string"==typeof e?n=e:"object"==typeof e&&(i=e),render(React.createElement(RedoclyOpenAPIDocsStandalone,{definition:i,definitionUrl:n,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r))}export function setPublicPath(e){__webpack_public_path__=e}export const version=__REDOCLY_API_REFERENCE_VERSION__;export const revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){const e=querySelector("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&init(t,{},e)}IS_BROWSER&&setPublicPath(__dirname),autoInit();
1
+ import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{setRecoil,getRecoil}from"recoil-nexus";import{querySelector,IS_BROWSER,getJsUrl}from"./utils";import{RedoclyOpenAPIDocs,RedoclyOpenAPIDocsStandalone}from"./components";import{RedoclyOpenAPIDocsMultiStandalone}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsMultiStandalone";import{appLocalStore,appSessionStore}from"./recoil/app";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){const t=getRecoil(appLocalStore);setRecoil(appLocalStore,Object.assign(Object.assign({},t),{layout:e}))}export function toggleRightPanel(e){const t=getRecoil(appSessionStore);setRecoil(appSessionStore,Object.assign(Object.assign({},t),{showRightPanelToggle:e}))}const url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){const t={},o=e.attributes;for(let e=0;e<o.length;e++){const r=o[e];t[r.name]=r.value}return t}function parseOptionsFromElement(e){const t=attributesMap(e),o={};for(const e in t){o[e.replace(/-(.)/g,((e,t)=>t.toUpperCase()))]=t[e]}return o}export function hydrate(e,t=document.querySelector("redoc")){hydrateComponent(React.createElement(RedoclyOpenAPIDocs,{store:e}),t)}export function init(e,t={},o=querySelector("redoc"),r){if(null===o)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');let n,i;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyOpenAPIDocsMultiStandalone,{definitions:e,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r):("string"==typeof e?n=e:"object"==typeof e&&(i=e),render(React.createElement(RedoclyOpenAPIDocsStandalone,{definition:i,definitionUrl:n,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r))}export function setPublicPath(e){__webpack_public_path__=e}export const version=__REDOCLY_API_REFERENCE_VERSION__;export const revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){const e=querySelector("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&init(t,{},e)}IS_BROWSER&&setPublicPath(__dirname),autoInit();
2
2
  //# sourceMappingURL=standalone.js.map
@@ -37,7 +37,6 @@ export interface XLogo {
37
37
  }
38
38
  export interface XMetadata {
39
39
  apiId?: string;
40
- [key: string]: unknown;
41
40
  }
42
41
  export interface OpenAPIServer extends ParsedDescription {
43
42
  url: string;
@@ -1,2 +1,2 @@
1
- import slugify from"slugify";import{format,parse}from"url";import{ZERO_BREAKPOINT}from"./media-css";import{isNamedDefinition}from"./openapi";import{JsonPointer}from"./JsonPointer";import{IS_BROWSER}from"./dom";import{isString}from"./typeGuards";export function mapWithLast(e,t){const r=[];for(let n=0;n<e.length-1;n++)r.push(t(e[n],!1));return 0!==e.length&&r.push(t(e[e.length-1],!0)),r}export function mapValues(e,t){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n,e));return r}export function flattenByProp(e,t){const r=[],n=e=>{for(const o of e)r.push(o),o[t]&&n(o[t])};return n(e),r}export function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}export function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}export function appendToMdHeading(e,t,r){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(e))return e.replace(o,`$1\n\n${r}\n$4`);{const n=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return`${e}${n}# ${t}\n\n${r}`}}export const mergeObjects=(e,...t)=>{if(!t.length)return e;const r=t.shift();return void 0===r?e:(isMergeableObject(e)&&isMergeableObject(r)&&Object.keys(r).forEach((t=>{isMergeableObject(r[t])?(e[t]||(e[t]={}),["string","number"].includes(typeof e[t])&&(r[t][ZERO_BREAKPOINT]||0===r[t][ZERO_BREAKPOINT]||console.warn(`Theme resolver: using default value of "${e[t]}" for "${t}". This is not recommended. Prefer adding default value by providing "${ZERO_BREAKPOINT}" property to ${JSON.stringify(r[t])}.`),e[t]={[ZERO_BREAKPOINT]:e[t]}),mergeObjects(e[t],r[t])):e[t]=r[t]})),mergeObjects(e,...t))};export const isObject=e=>null!==e&&"object"==typeof e;export const isArrayOfObjects=e=>Array.isArray(e)&&e.some((e=>isObject(e)));export const deleteEmptyArrayItem=e=>e.filter((e=>!!e));export const isMergeableObject=e=>isObject(e)&&!Array.isArray(e);export function safeSlugify(e){return slugify(e)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}export function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}export function resolveUrl(e,t){let r;if(t.startsWith("//")){const{protocol:n}=parse(e);r=`${n||"https:"}${t}`}else if(isAbsoluteUrl(t))r=t;else if(t.startsWith("/")){const n=parse(e);r=format(Object.assign(Object.assign({},n),{pathname:t}))}else r=stripTrailingSlash(e)+"/"+t;return stripTrailingSlash(r)}export function getBasePath(e){try{return parseURL(e).pathname}catch(t){return e}}export function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}export function removeQueryStringAndHash(e){try{const t=parseURL(e);return t.search="",t.hash="",t.toString()}catch(t){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}export function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,10)))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}export function sanitizeItemId(e){return e&&e.replace(/#/g,"_")}export function useSchemaTitle(e,t){return t||isNamedDefinition(e)&&JsonPointer.baseName(e)||""}export function get(e={},t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce(((e,t)=>e&&e[t]?e[t]:r),e)}export function joinStringFactory(e){return(...t)=>t.filter(Boolean).join(e)}export const dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";const t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${t}"><\/script>`),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}export const normalizeText=e=>isString(e)?e:null==e?void 0:e.raw;export const getValueFromMdParsedExtension=(e,t)=>e[`x-parsed-md-${t}`]||e[t];
1
+ import slugify from"slugify";import{format,parse}from"url";import{ZERO_BREAKPOINT}from"./media-css";import{isNamedDefinition}from"./openapi";import{JsonPointer}from"./JsonPointer";import{IS_BROWSER}from"./dom";import{isString}from"./typeGuards";export function mapWithLast(e,t){const r=[];for(let n=0;n<e.length-1;n++)r.push(t(e[n],!1));return 0!==e.length&&r.push(t(e[e.length-1],!0)),r}export function mapValues(e,t){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n,e));return r}export function flattenByProp(e,t){const r=[],n=e=>{for(const o of e)r.push(o),o[t]&&n(o[t])};return n(e),r}export function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}export function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}export function appendToMdHeading(e,t,r){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(e))return e.replace(o,`$1\n\n${r}\n$4`);{const n=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return`${e}${n}# ${t}\n\n${r}`}}export const mergeObjects=(e,...t)=>{if(!t.length)return e;const r=t.shift();return void 0===r?e:(isMergeableObject(e)&&isMergeableObject(r)&&Object.keys(r).forEach((t=>{isMergeableObject(r[t])?(e[t]||(e[t]={}),["string","number"].includes(typeof e[t])&&(r[t][ZERO_BREAKPOINT]||0===r[t][ZERO_BREAKPOINT]||console.warn(`Theme resolver: using default value of "${e[t]}" for "${t}". This is not recommended. Prefer adding default value by providing "${ZERO_BREAKPOINT}" property to ${JSON.stringify(r[t])}.`),e[t]={[ZERO_BREAKPOINT]:e[t]}),mergeObjects(e[t],r[t])):e[t]=r[t]})),mergeObjects(e,...t))};export const isObject=e=>null!==e&&"object"==typeof e;export const isArrayOfObjects=e=>Array.isArray(e)&&e.some((e=>isObject(e)));export const deleteEmptyArrayItem=e=>e.filter((e=>!!e));export const isMergeableObject=e=>isObject(e)&&!Array.isArray(e);export function safeSlugify(e){return slugify(e)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}export function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}export function resolveUrl(e,t){let r;if(t.startsWith("//")){const{protocol:n}=parse(e);r=`${n||"https:"}${t}`}else if(isAbsoluteUrl(t))r=t;else if(t.startsWith("/")){const n=parse(e);r=format(Object.assign(Object.assign({},n),{pathname:t}))}else r=stripTrailingSlash(e)+"/"+t;return stripTrailingSlash(r)}export function getBasePath(e){try{return parseURL(e).pathname}catch(t){return e}}export function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}export function removeQueryStringAndHash(e){try{const t=parseURL(e);return t.search="",t.hash="",t.toString()}catch(t){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}export function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,10)))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}export function sanitizeItemId(e){return e&&e.replace(/#/g,"_")}export function useSchemaTitle(e,t){return t||isNamedDefinition(e)&&JsonPointer.baseName(e)||""}export function get(e={},t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce(((e,t)=>e&&e[t]?e[t]:r),e)}export function joinStringFactory(e){return(...t)=>t.filter(Boolean).join(e)}export const dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";const t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${t}"><\/script>`),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}export const normalizeText=e=>isString(e)?e:null==e?void 0:e.raw;export const getValueFromMdParsedExtension=(e,t)=>{const r=e[`x-parsed-md-${t}`]||e[t];if("x-enumDescriptions"!==t)return r;let n={};for(const e in r)e.startsWith("x-parsed-md")||(n[e]=r[`x-parsed-md-${e}`]||r[e]);return Object.keys(n).length?n:r};
2
2
  //# sourceMappingURL=helpers.js.map
@@ -2,7 +2,6 @@ export * from './JsonPointer';
2
2
  export * from './openapi';
3
3
  export * from './helpers';
4
4
  export * from './highlight';
5
- export * from './loadAndBundleSpec';
6
5
  export * from './dom';
7
6
  export * from './debug';
8
7
  export * from './sort';
@@ -1,2 +1,2 @@
1
- export*from"./JsonPointer";export*from"./openapi";export*from"./helpers";export*from"./highlight";export*from"./loadAndBundleSpec";export*from"./dom";export*from"./debug";export*from"./sort";export*from"./argValuesHelpers";export*from"./media-css";export*from"./theme-helpers";export*from"./debounce";export*from"./security-details";export*from"./session-storage";export*from"./local-storage";export*from"./parameters";export*from"./string";export*from"./test-utils";export*from"./typeGuards";export*from"./compose";export*from"./saveTextBeforeHeading";export*from"./path";
1
+ export*from"./JsonPointer";export*from"./openapi";export*from"./helpers";export*from"./highlight";export*from"./dom";export*from"./debug";export*from"./sort";export*from"./argValuesHelpers";export*from"./media-css";export*from"./theme-helpers";export*from"./debounce";export*from"./security-details";export*from"./session-storage";export*from"./local-storage";export*from"./parameters";export*from"./string";export*from"./test-utils";export*from"./typeGuards";export*from"./compose";export*from"./saveTextBeforeHeading";export*from"./path";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,3 @@
1
- import type { Document } from '@redocly/openapi-core';
2
1
  import type { OpenAPIDefinition } from '../types';
3
2
  export declare function loadAndBundleDefinition(specUrlOrObject: GenericObject | string): Promise<OpenAPIDefinition>;
4
- export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
5
3
  export declare function convertSwagger2OpenAPI(spec: GenericObject): Promise<OpenAPIDefinition>;
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,o,t){return new(o||(o=Promise))((function(r,i){function c(e){try{u(t.next(e))}catch(e){i(e)}}function a(e){try{u(t.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}u((t=t.apply(e,n||[])).next())}))};import{bundle}from"@redocly/openapi-core/lib/bundle";import{Config}from"@redocly/openapi-core/lib/config/config";import{convertObj}from"swagger2openapi";import{IS_BROWSER}from"./dom";export function loadAndBundleDefinition(e){return __awaiter(this,void 0,void 0,(function*(){const n=new Config({}),o={config:n,base:IS_BROWSER?window.location.href:process.cwd()};IS_BROWSER&&(n.resolve.http.customFetch=global.fetch),"object"==typeof e&&null!==e?o.doc=createParsedDocument(e):o.ref=e;const{bundle:{parsed:t}}=yield bundle(o);return void 0!==t.swagger?convertSwagger2OpenAPI(t):t}))}export function createParsedDocument(e){return{source:{absoluteRef:""},parsed:e}}export function convertSwagger2OpenAPI(e){return e.paths||(e.paths={}),new Promise(((n,o)=>convertObj(e,{patch:!0,warnOnly:!0,text:"{}",anchors:!0},((e,t)=>{if(e)return o(e);n(null==t?void 0:t.openapi)}))))}
1
+ var __awaiter=this&&this.__awaiter||function(e,n,o,t){return new(o||(o=Promise))((function(r,i){function c(e){try{p(t.next(e))}catch(e){i(e)}}function a(e){try{p(t.throw(e))}catch(e){i(e)}}function p(e){var n;e.done?r(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}p((t=t.apply(e,n||[])).next())}))};import{bundle}from"@redocly/openapi-core/lib/bundle";import{Config}from"@redocly/openapi-core/lib/config/config";import{convertObj}from"swagger2openapi";import{createParsedDocument}from"./openapi";import{IS_BROWSER}from"./dom";export function loadAndBundleDefinition(e){return __awaiter(this,void 0,void 0,(function*(){const n=new Config({}),o={config:n,base:IS_BROWSER?window.location.href:process.cwd()};IS_BROWSER&&(n.resolve.http.customFetch=global.fetch),"object"==typeof e&&null!==e?o.doc=createParsedDocument(e):o.ref=e;const{bundle:{parsed:t}}=yield bundle(o);return void 0!==t.swagger?convertSwagger2OpenAPI(t):t}))}export function convertSwagger2OpenAPI(e){return e.paths||(e.paths={}),new Promise(((n,o)=>convertObj(e,{patch:!0,warnOnly:!0,text:"{}",anchors:!0},((e,t)=>{if(e)return o(e);n(null==t?void 0:t.openapi)}))))}
2
2
  //# sourceMappingURL=loadAndBundleSpec.js.map
@@ -1,12 +1,14 @@
1
+ import type { Document } from '@redocly/openapi-core';
1
2
  import type { OpenAPIEncoding, OpenAPIMediaType, OpenAPIParameterStyle, OpenAPIRequestBody, OpenAPIResponse, OpenAPISchema, OpenAPIServer, Referenced } from '../types';
2
3
  import type { ExtendedOpenAPIOperation, OpenAPIParser } from '../services';
3
4
  import type { FieldModel, GroupModel } from '../models';
4
5
  import { OpenAPIParameter } from '../types';
6
+ import { Pagination } from '../services';
5
7
  export declare function isStatusCode(statusCode: string): boolean;
6
8
  export declare function getStatusCodeType(statusCode: string | number, defaultAsError?: boolean): string;
7
9
  export declare function isOperationName(key: string): boolean;
8
10
  export declare function getOperationName(operation: ExtendedOpenAPIOperation): string;
9
- export declare function getOperationId(operation: ExtendedOpenAPIOperation, parent?: GroupModel): string;
11
+ export declare function getOperationId(operation: ExtendedOpenAPIOperation, pagination: Pagination, parent?: GroupModel): string;
10
12
  export declare function detectType(schema: OpenAPISchema): string;
11
13
  export declare function isPrimitiveType(schema: OpenAPISchema, type?: string | string[] | undefined): boolean;
12
14
  export declare function isJsonLike(contentType: string): boolean;
@@ -41,3 +43,4 @@ export declare function pluralizeType(displayType: string): string;
41
43
  export declare function getContentWithLegacyExamples(info: OpenAPIRequestBody | OpenAPIResponse): {
42
44
  [mime: string]: OpenAPIMediaType;
43
45
  } | undefined;
46
+ export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
@@ -1,2 +1,2 @@
1
- import{dirname}from"path";import UrlTemplate from"url-template";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl,sanitizeItemId,normalizeText,getValueFromMdParsedExtension}from"./helpers";import{MediaTypes}from"../constants";import{JsonPointer}from"./JsonPointer";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r=!1){if("default"===e)return r?"error":"success";let t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}const operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationName(e){const{operationId:r,pathName:t}=e,i=normalizeText(getValueFromMdParsedExtension(e,"description"));return normalizeText(getValueFromMdParsedExtension(e,"summary"))||r||i&&i.substring(0,50)||t||"<no summary>"}export function getOperationId(e,r){return sanitizeItemId(void 0!==e.operationId?"operation/"+e.operationId:void 0!==r?r.id+e.pointer:e.pointer)}const schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;const r=Object.keys(schemaKeywordTypes);for(const t of r){const r=schemaKeywordTypes[t];if(void 0!==e[t])return r}return"any"}export function isPrimitiveType(e,r=e.type){if(e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;let t=!0;const i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((e=>e.toString())).join(t):"object"==typeof e?Object.keys(e).map((r=>`${r}${t}${e[r]}`)).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((t=>e[t]?`${r}[${t}]=${e[t]}`:void 0)).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){const i="__redoc_param_name__",n=r?"*":"";return UrlTemplate.parse(`{?${i}${n}}`).expand({[i]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){const t=e?"*":"",i="__redoc_param_name__",n=UrlTemplate.parse(`{${i}${t}}`);return decodeURIComponent(n.expand({[i]:r}))}export function urlFormEncodePayload(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((t=>{const i=e[t],{style:n="form",explode:o=!0}=r[t]||{};switch(n){case"form":return serializeFormValue(t,o,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+n),""}})).join("&")}function serializePathParameter(e,r,t,i){const n=t?"*":"";let o="";"label"===r?o=".":"matrix"===r&&(o=";");const a="__redoc_param_name__";return UrlTemplate.parse(`{${o}${a}${n}}`).expand({[a]:i}).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){const n=n=>{switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("%20")}`:(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("|")}`:(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((e=>n(e)))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}export function serializeParameterValue(e,r){const{name:t,style:i,explode:n=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return`${t}=${serializeParameterValueWithMime(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return serializePathParameter(t,i,n,r);case"query":return serializeQueryParameter(t,i,n,r);case"header":return serializeHeaderParameter(i,n,r);case"cookie":return serializeCookieParameter(t,i,n,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}const DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0===e)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function humanizeRangeConstraint(e,r,t){let i;return void 0!==r&&void 0!==t?i=r===t?`= ${r} ${e}`:`[ ${r} .. ${t} ] ${e}`:void 0!==t?i=`<= ${t} ${e}`:void 0!==r&&(i=1===r?"non-empty":`>= ${r} ${e}`),i}export function humanizeNumberRange(e){var r,t;const i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,o="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,a="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?`${o?"( ":"[ "}${i} .. ${n}${a?" )":" ]"}`:void 0!==n?`${a?"< ":"<= "}${n}`:void 0!==i?`${o?"> ":">= "}${i}`:void 0}export function humanizeConstraints(e){const r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);const i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);const n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);const o=humanizeMultipleOfConstraint(e.multipleOf);void 0!==o&&r.push(o);const a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r=[]){const t=[],i=[],n=[];return e.forEach((e=>{e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort(((e,t)=>r.indexOf(e.name)-r.indexOf(t.name))),[...i,...n,...t]}export function sortByField(e,r){return[...e].sort(((e,t)=>e[r].localeCompare(t[r])))}export function mergeParams(e,r=[],t=[],{pathPointer:i,operationPointer:n}){const o={};t.forEach((r=>{({resolved:r}=e.deref(r)),o[r.name+"_"+r.in]=!0}));return[...r.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(i,["parameters",String(r)])}))).filter((({paramOrRef:r})=>(({resolved:r}=e.deref(r)),!o[r.name+"_"+r.in]))),...t.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(n,["parameters",String(r)])})))]}export function mergeSimilarMediaTypes(e){const r={};return Object.keys(e).forEach((t=>{const i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=Object.assign(Object.assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r={}){return e.replace(/(?:{)([\w-.]+)(?:})/g,((e,t)=>r[t]&&r[t].default||e))}export function normalizeServers(e,r){const t=void 0===e?removeQueryStringAndHash((()=>{if(!IS_BROWSER)return"";const e=window.location.href;return e.endsWith(".html")?dirname(e):e})()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((e=>{return Object.assign(Object.assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export const shortenHTTPVerb=e=>({delete:"del",options:"opts"}[e]||e);export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0,"x-tokenEndpointAuthMethod":!0,"x-feedback":!0}||e.startsWith("x-parsed-md-")}export function extractExtensions(e,r){return Object.keys(e).filter((e=>!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1)).reduce(((r,t)=>(r[t]=e[t],r)),{})}export function pluralizeType(e){return e.split(" or ").map((e=>e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2"))).join(" or ")}export function getContentWithLegacyExamples(e){let r=e.content;const t=e["x-examples"],i=e["x-example"];if(t){r=Object.assign({},r);for(const e of Object.keys(t)){const i=t[e];r[e]=Object.assign(Object.assign({},r[e]),{examples:i})}}else if(i){r=Object.assign({},r);for(const e of Object.keys(i)){const t=i[e];r[e]=Object.assign(Object.assign({},r[e]),{example:t})}}return r}
1
+ import{dirname}from"path";import UrlTemplate from"url-template";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl,sanitizeItemId,normalizeText,getValueFromMdParsedExtension}from"./helpers";import{DEFAULT_TAG_SLUG,MediaTypes}from"../constants";import{JsonPointer}from"./JsonPointer";import{joinWithSeparator,Pagination}from"../services";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r=!1){if("default"===e)return r?"error":"success";let t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}const operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationName(e){const{operationId:r,pathName:t}=e,i=normalizeText(getValueFromMdParsedExtension(e,"description"));return normalizeText(getValueFromMdParsedExtension(e,"summary"))||r||i&&i.substring(0,50)||t||"<no summary>"}export function getOperationId(e,r,t){var i;return r===Pagination.None&&(null==t?void 0:t.id)?joinWithSeparator(t.id,sanitizeItemId(e.operationId?e.operationId:pointerToId(e.pointer))):(null===(i=e.tags)||void 0===i?void 0:i.length)?sanitizeItemId(e.operationId?e.operationId:pointerToId(e.pointer)):sanitizeItemId(e.operationId?joinWithSeparator(DEFAULT_TAG_SLUG,e.operationId):pointerToId(e.pointer))}function pointerToId(e){return(null==e?void 0:e.startsWith("/"))?e.slice(1,e.length):e}const schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;const r=Object.keys(schemaKeywordTypes);for(const t of r){const r=schemaKeywordTypes[t];if(void 0!==e[t])return r}return"any"}export function isPrimitiveType(e,r=e.type){if(e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;let t=!0;const i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((e=>e.toString())).join(t):"object"==typeof e?Object.keys(e).map((r=>`${r}${t}${e[r]}`)).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((t=>e[t]?`${r}[${t}]=${e[t]}`:void 0)).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){const i="__redoc_param_name__",n=r?"*":"";return UrlTemplate.parse(`{?${i}${n}}`).expand({[i]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){const t=e?"*":"",i="__redoc_param_name__",n=UrlTemplate.parse(`{${i}${t}}`);return decodeURIComponent(n.expand({[i]:r}))}export function urlFormEncodePayload(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((t=>{const i=e[t],{style:n="form",explode:o=!0}=r[t]||{};switch(n){case"form":return serializeFormValue(t,o,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+n),""}})).join("&")}function serializePathParameter(e,r,t,i){const n=t?"*":"";let o="";"label"===r?o=".":"matrix"===r&&(o=";");const a="__redoc_param_name__";return UrlTemplate.parse(`{${o}${a}${n}}`).expand({[a]:i}).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){const n=n=>{switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("%20")}`:(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("|")}`:(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((e=>n(e)))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}export function serializeParameterValue(e,r){const{name:t,style:i,explode:n=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return`${t}=${serializeParameterValueWithMime(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return serializePathParameter(t,i,n,r);case"query":return serializeQueryParameter(t,i,n,r);case"header":return serializeHeaderParameter(i,n,r);case"cookie":return serializeCookieParameter(t,i,n,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}const DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0===e)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function humanizeRangeConstraint(e,r,t){let i;return void 0!==r&&void 0!==t?i=r===t?`= ${r} ${e}`:`[ ${r} .. ${t} ] ${e}`:void 0!==t?i=`<= ${t} ${e}`:void 0!==r&&(i=1===r?"non-empty":`>= ${r} ${e}`),i}export function humanizeNumberRange(e){var r,t;const i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,o="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,a="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?`${o?"( ":"[ "}${i} .. ${n}${a?" )":" ]"}`:void 0!==n?`${a?"< ":"<= "}${n}`:void 0!==i?`${o?"> ":">= "}${i}`:void 0}export function humanizeConstraints(e){const r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);const i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);const n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);const o=humanizeMultipleOfConstraint(e.multipleOf);void 0!==o&&r.push(o);const a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r=[]){const t=[],i=[],n=[];return e.forEach((e=>{e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort(((e,t)=>r.indexOf(e.name)-r.indexOf(t.name))),[...i,...n,...t]}export function sortByField(e,r){return[...e].sort(((e,t)=>e[r].localeCompare(t[r])))}export function mergeParams(e,r=[],t=[],{pathPointer:i,operationPointer:n}){const o={};t.forEach((r=>{({resolved:r}=e.deref(r)),o[r.name+"_"+r.in]=!0}));return[...r.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(i,["parameters",String(r)])}))).filter((({paramOrRef:r})=>(({resolved:r}=e.deref(r)),!o[r.name+"_"+r.in]))),...t.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(n,["parameters",String(r)])})))]}export function mergeSimilarMediaTypes(e){const r={};return Object.keys(e).forEach((t=>{const i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=Object.assign(Object.assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r={}){return e.replace(/(?:{)([\w-.]+)(?:})/g,((e,t)=>r[t]&&r[t].default||e))}export function normalizeServers(e,r){const t=void 0===e?removeQueryStringAndHash((()=>{if(!IS_BROWSER)return"";const e=window.location.href;return e.endsWith(".html")?dirname(e):e})()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((e=>{return Object.assign(Object.assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export const shortenHTTPVerb=e=>({delete:"del",options:"opts"}[e]||e);export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0,"x-tokenEndpointAuthMethod":!0,"x-feedback":!0}||e.startsWith("x-parsed-md-")}export function extractExtensions(e,r){return Object.keys(e).filter((e=>!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1)).reduce(((r,t)=>(r[t]=e[t],r)),{})}export function pluralizeType(e){return e.split(" or ").map((e=>e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2"))).join(" or ")}export function getContentWithLegacyExamples(e){let r=e.content;const t=e["x-examples"],i=e["x-example"];if(t){r=Object.assign({},r);for(const e of Object.keys(t)){const i=t[e];r[e]=Object.assign(Object.assign({},r[e]),{examples:i})}}else if(i){r=Object.assign({},r);for(const e of Object.keys(i)){const t=i[e];r[e]=Object.assign(Object.assign({},r[e]),{example:t})}}return r}export function createParsedDocument(e){return{source:{absoluteRef:""},parsed:e}}
2
2
  //# sourceMappingURL=openapi.js.map
@@ -1,4 +1,5 @@
1
1
  import type { Location } from 'react-router-dom';
2
2
  export declare function pathIncludesLink(location: Location, link?: string): boolean;
3
3
  export declare function pathMatchedLink(location: Location, link?: string): boolean;
4
- export declare function normalizeHashPath(link: string): string;
4
+ export declare function normalizePath(path: string): string;
5
+ export declare function normalizeHashPath(path: string): string;
@@ -1,2 +1,2 @@
1
- export function pathIncludesLink(e,n){return!!n&&decodeURIComponent(e.pathname+e.hash).includes(n)}export function pathMatchedLink(e,n=""){return decodeURIComponent(e.pathname)===n||decodeURIComponent(e.hash)===n||decodeURIComponent(e.pathname+e.hash)===n}export function normalizeHashPath(e){return e.startsWith("#")?`/${e}`:e}
1
+ export function pathIncludesLink(t,e){return!!e&&decodeURIComponent(t.pathname+t.hash).includes(e)}export function pathMatchedLink(t,e=""){return decodeURIComponent(t.pathname)===e||decodeURIComponent(t.hash)===e||decodeURIComponent(t.pathname+t.hash)===e}export function normalizePath(t){return t.startsWith("/")||(t="/"+t),t.endsWith("/")&&(t=t.slice(0,-1)),t}export function normalizeHashPath(t){return t.startsWith("#")?normalizePath(t):t}
2
2
  //# sourceMappingURL=path.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.0.0-alpha.29.alpha.0",
3
+ "version": "3.0.0-alpha.31",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -14,6 +14,13 @@
14
14
  "bin": {
15
15
  "openapi-docs": "bin.js"
16
16
  },
17
+ "peerDependencies": {
18
+ "@redocly/theme": ">=0.9.4",
19
+ "core-js": "^3.1.4",
20
+ "react": "^16.8.4 || ^17.0.0",
21
+ "react-dom": "^16.8.4 || ^17.0.0",
22
+ "styled-components": "^4.1.1 || ^5.1.1"
23
+ },
17
24
  "dependencies": {
18
25
  "@markdoc/markdoc": "0.1.13",
19
26
  "@redocly/openapi-core": "^1.0.0-beta.123",
@@ -56,13 +63,6 @@
56
63
  "url-template": "^2.0.8",
57
64
  "yargs": "^17.3.0"
58
65
  },
59
- "peerDependencies": {
60
- "@redocly/theme": "^0.9.12-alpha.0",
61
- "core-js": "^3.1.4",
62
- "react": "^16.8.4 || ^17.0.0",
63
- "react-dom": "^16.8.4 || ^17.0.0",
64
- "styled-components": "^4.1.1 || ^5.1.1"
65
- },
66
66
  "devDependencies": {
67
67
  "react": "^17.0.2",
68
68
  "react-dom": "^17.0.2",
@@ -106,7 +106,6 @@
106
106
  "json-schema": "^0.4.0",
107
107
  "outdent": "^0.8.0",
108
108
  "react-hot-loader": "^4.12.18",
109
- "react-test-renderer": "^17.0.2",
110
109
  "string-replace-loader": "^3.1.0",
111
110
  "style-loader": "^1.0.1",
112
111
  "terser": "^5.6.1",
@@ -120,7 +119,7 @@
120
119
  "webpack-dev-server": "^4.9.3",
121
120
  "workerize-loader": "github:redocly/workerize-loader#webpack-5-dist",
122
121
  "js-yaml": "4.1.0",
123
- "@redocly/theme": "0.9.12-alpha.0"
122
+ "@redocly/theme": "0.9.14"
124
123
  },
125
124
  "nx": {
126
125
  "namedInputs": {
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const ChangeViewButton: () => JSX.Element | null;
@@ -1,2 +0,0 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChangeViewButton=void 0;const react_1=__importDefault(require("react")),recoil_1=require("recoil"),theme_1=require("@redocly/theme"),store_1=require("../../recoil/store"),app_1=require("../../recoil/app"),constants_1=require("../../constants"),styled_1=require("./styled"),ChangeViewButton=()=>{const{showChangeLayoutButton:e}=(0,recoil_1.useRecoilValue)(store_1.globalOptionsSelector),t=(0,recoil_1.useRecoilValue)(app_1.showRightPanelToggleSelector),[l,o]=(0,recoil_1.useRecoilState)(app_1.layoutSelector);return e&&t?react_1.default.createElement(theme_1.Tooltip,{tip:"Change layout",placement:"left"},react_1.default.createElement(styled_1.StyledChangeViewButton,{onClick:()=>{o(l)}},l===constants_1.LayoutVariant.STACKED?react_1.default.createElement(styled_1.ChangeViewSvgRow,null):react_1.default.createElement(styled_1.ChangeViewSvgColumn,null))):null};exports.ChangeViewButton=ChangeViewButton;
2
- //# sourceMappingURL=ChangeViewButton.js.map
@@ -1 +0,0 @@
1
- export * from './ChangeViewButton';
@@ -1,2 +0,0 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./ChangeViewButton"),exports);
2
- //# sourceMappingURL=index.js.map
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledChangeViewButton: import("styled-components").StyledComponent<"a", any, {}, never>;
3
- export declare const ChangeViewSvgRow: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
4
- export declare const ChangeViewSvgColumn: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
@@ -1,18 +0,0 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChangeViewSvgColumn=exports.ChangeViewSvgRow=exports.StyledChangeViewButton=void 0;const react_1=__importDefault(require("react")),styled_components_1=__importDefault(require("styled-components"));exports.StyledChangeViewButton=styled_components_1.default.a`
2
- display: flex;
3
- position: relative;
4
- justify-content: center;
5
- align-items: center;
6
- cursor: pointer;
7
- z-index: 1;
8
- /* Rectangle 201 */
9
- height: var(--layout-controls-height);
10
- width: var(--layout-controls-width);
11
- background: var(--color-emphasis-100);
12
- border-radius: var(--border-radius);
13
- `,exports.ChangeViewSvgRow=(0,styled_components_1.default)((()=>react_1.default.createElement("svg",{width:"20",height:"16",viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},react_1.default.createElement("line",{x1:"1",y1:"4",x2:"8",y2:"4",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),react_1.default.createElement("line",{x1:"1",y1:"8",x2:"8",y2:"8",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),react_1.default.createElement("line",{x1:"1",y1:"12",x2:"8",y2:"12",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),react_1.default.createElement("rect",{x:"11",width:"9",height:"16",rx:"1",fill:"var(--color-emphasis-400)"}))))`
14
- position: absolute;
15
- `,exports.ChangeViewSvgColumn=(0,styled_components_1.default)((()=>react_1.default.createElement("svg",{width:"15",height:"20",viewBox:"0 0 15 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},react_1.default.createElement("line",{x1:"13.2858",y1:"5.28564",x2:"1.00005",y2:"5.28564",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),react_1.default.createElement("line",{x1:"13.2858",y1:"1",x2:"1.00005",y2:"0.999998",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),react_1.default.createElement("rect",{x:"14.2858",y:"20",width:"14.2857",height:"11.4286",rx:"1",transform:"rotate(-180 14.2858 20)",fill:"var(--color-emphasis-400)"}))))`
16
- position: absolute;
17
- `;
18
- //# sourceMappingURL=styled.js.map
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function ToggleRightPanelButton(): JSX.Element | null;
@@ -1,2 +0,0 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToggleRightPanelButton=void 0;const react_1=__importDefault(require("react")),theme_1=require("@redocly/theme"),recoil_1=require("recoil"),constants_1=require("../../constants"),app_1=require("../../recoil/app"),store_1=require("../../recoil/store"),styled_1=require("./styled");function ToggleRightPanelButton(){const e=(0,recoil_1.useRecoilValue)(store_1.globalOptionsSelector),[t,l]=(0,recoil_1.useRecoilState)(app_1.showRightPanelToggleSelector),o=(0,recoil_1.useRecoilValue)(app_1.layoutSelector)===constants_1.LayoutVariant.THREE_PANEL;return e.showRightPanelToggle&&o?react_1.default.createElement(theme_1.Tooltip,{tip:""+(t?"Hide samples":"Show samples"),placement:"left"},react_1.default.createElement(styled_1.StyledToggleRightPanelButton,{onClick:()=>{l(!t)}},t?react_1.default.createElement(styled_1.HideRightPanelSVG,null):react_1.default.createElement(styled_1.ShowRightPanelSVG,null))):null}exports.ToggleRightPanelButton=ToggleRightPanelButton;
2
- //# sourceMappingURL=ToggleRightPanelButton.js.map
@@ -1 +0,0 @@
1
- export * from './ToggleRightPanelButton';
@@ -1,2 +0,0 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./ToggleRightPanelButton"),exports);
2
- //# sourceMappingURL=index.js.map
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const HideRightPanelSVG: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
3
- export declare const StyledToggleRightPanelButton: import("styled-components").StyledComponent<"a", any, {}, never>;
4
- export declare const ShowRightPanelSVG: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
@@ -1,17 +0,0 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShowRightPanelSVG=exports.StyledToggleRightPanelButton=exports.HideRightPanelSVG=void 0;const react_1=__importDefault(require("react")),styled_components_1=__importDefault(require("styled-components"));exports.HideRightPanelSVG=(0,styled_components_1.default)((()=>react_1.default.createElement("svg",{width:"15",height:"10",viewBox:"0 0 15 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},react_1.default.createElement("path",{d:"M12.5858 5L9.29289 1.70711C8.90237 1.31658 8.90237 0.683417 9.29289 0.292893C9.68342 -0.097631 10.3166 -0.0976309 10.7071 0.292893L14.7071 4.29289C15.0976 4.68342 15.0976 5.31658 14.7071 5.70711L10.7071 9.70711C10.3166 10.0976 9.68342 10.0976 9.29289 9.70711C8.90237 9.31658 8.90237 8.68342 9.29289 8.29289L12.5858 5Z",fill:"var(--color-emphasis-400)"}),react_1.default.createElement("path",{d:"M13 5C13 5.55229 12.5523 6 12 6L4 6C3.44772 6 3 5.55228 3 5C3 4.44771 3.44772 4 4 4L12 4C12.5523 4 13 4.44772 13 5Z",fill:"var(--color-emphasis-400)"}),react_1.default.createElement("rect",{width:"2",height:"10",rx:"1",fill:"var(--color-emphasis-400)"}))))`
2
- position: absolute;
3
- `,exports.StyledToggleRightPanelButton=styled_components_1.default.a`
4
- display: flex;
5
- justify-content: center;
6
- align-items: center;
7
- cursor: pointer;
8
- z-index: 1;
9
- /* Rectangle 201 */
10
- height: var(--layout-controls-height);
11
- width: var(--layout-controls-width);
12
- background: var(--color-emphasis-100);
13
- border-radius: var(--border-radius);
14
- `,exports.ShowRightPanelSVG=(0,styled_components_1.default)((()=>react_1.default.createElement("svg",{width:"15",height:"10",viewBox:"0 0 15 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},react_1.default.createElement("path",{d:"M2.41421 5L5.70711 8.29289C6.09763 8.68342 6.09763 9.31658 5.7071 9.70711C5.31658 10.0976 4.68342 10.0976 4.29289 9.70711L0.292892 5.70711C-0.0976321 5.31658 -0.0976319 4.68342 0.292893 4.29289L4.29289 0.292894C4.68342 -0.0976302 5.31658 -0.09763 5.70711 0.292894C6.09763 0.683418 6.09763 1.31658 5.70711 1.70711L2.41421 5Z",fill:"var(--color-emphasis-400)"}),react_1.default.createElement("path",{d:"M2 5C2 4.44772 2.44771 4 3 4L11 4C11.5523 4 12 4.44772 12 5C12 5.55229 11.5523 6 11 6L3 6C2.44771 6 2 5.55228 2 5Z",fill:"var(--color-emphasis-400)"}),react_1.default.createElement("rect",{x:"15",y:"10",width:"2",height:"10",rx:"1",transform:"rotate(-180 15 10)",fill:"var(--color-emphasis-400)"}))))`
15
- position: absolute;
16
- `;
17
- //# sourceMappingURL=styled.js.map
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const ChangeViewButton: () => JSX.Element | null;
@@ -1,2 +0,0 @@
1
- import React from"react";import{useRecoilValue,useRecoilState}from"recoil";import{Tooltip}from"@redocly/theme";import{globalOptionsSelector}from"../../recoil/store";import{showRightPanelToggleSelector,layoutSelector}from"../../recoil/app";import{LayoutVariant}from"../../constants";import{StyledChangeViewButton,ChangeViewSvgRow,ChangeViewSvgColumn}from"./styled";export const ChangeViewButton=()=>{const{showChangeLayoutButton:e}=useRecoilValue(globalOptionsSelector),t=useRecoilValue(showRightPanelToggleSelector),[o,l]=useRecoilState(layoutSelector);return e&&t?React.createElement(Tooltip,{tip:"Change layout",placement:"left"},React.createElement(StyledChangeViewButton,{onClick:()=>{l(o)}},o===LayoutVariant.STACKED?React.createElement(ChangeViewSvgRow,null):React.createElement(ChangeViewSvgColumn,null))):null};
2
- //# sourceMappingURL=ChangeViewButton.js.map
@@ -1 +0,0 @@
1
- export * from './ChangeViewButton';
@@ -1,2 +0,0 @@
1
- export*from"./ChangeViewButton";
2
- //# sourceMappingURL=index.js.map
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledChangeViewButton: import("styled-components").StyledComponent<"a", any, {}, never>;
3
- export declare const ChangeViewSvgRow: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
4
- export declare const ChangeViewSvgColumn: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
@@ -1,18 +0,0 @@
1
- import React from"react";import styled from"styled-components";export const StyledChangeViewButton=styled.a`
2
- display: flex;
3
- position: relative;
4
- justify-content: center;
5
- align-items: center;
6
- cursor: pointer;
7
- z-index: 1;
8
- /* Rectangle 201 */
9
- height: var(--layout-controls-height);
10
- width: var(--layout-controls-width);
11
- background: var(--color-emphasis-100);
12
- border-radius: var(--border-radius);
13
- `;export const ChangeViewSvgRow=styled((()=>React.createElement("svg",{width:"20",height:"16",viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("line",{x1:"1",y1:"4",x2:"8",y2:"4",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("line",{x1:"1",y1:"8",x2:"8",y2:"8",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("line",{x1:"1",y1:"12",x2:"8",y2:"12",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("rect",{x:"11",width:"9",height:"16",rx:"1",fill:"var(--color-emphasis-400)"}))))`
14
- position: absolute;
15
- `;export const ChangeViewSvgColumn=styled((()=>React.createElement("svg",{width:"15",height:"20",viewBox:"0 0 15 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("line",{x1:"13.2858",y1:"5.28564",x2:"1.00005",y2:"5.28564",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("line",{x1:"13.2858",y1:"1",x2:"1.00005",y2:"0.999998",stroke:"var(--color-emphasis-400)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("rect",{x:"14.2858",y:"20",width:"14.2857",height:"11.4286",rx:"1",transform:"rotate(-180 14.2858 20)",fill:"var(--color-emphasis-400)"}))))`
16
- position: absolute;
17
- `;
18
- //# sourceMappingURL=styled.js.map
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function ToggleRightPanelButton(): JSX.Element | null;
@@ -1,2 +0,0 @@
1
- import React from"react";import{Tooltip}from"@redocly/theme";import{useRecoilState,useRecoilValue}from"recoil";import{LayoutVariant}from"../../constants";import{layoutSelector,showRightPanelToggleSelector}from"../../recoil/app";import{globalOptionsSelector}from"../../recoil/store";import{StyledToggleRightPanelButton,HideRightPanelSVG,ShowRightPanelSVG}from"./styled";export function ToggleRightPanelButton(){const e=useRecoilValue(globalOptionsSelector),[t,o]=useRecoilState(showRightPanelToggleSelector),l=useRecoilValue(layoutSelector)===LayoutVariant.THREE_PANEL;return e.showRightPanelToggle&&l?React.createElement(Tooltip,{tip:""+(t?"Hide samples":"Show samples"),placement:"left"},React.createElement(StyledToggleRightPanelButton,{onClick:()=>{o(!t)}},t?React.createElement(HideRightPanelSVG,null):React.createElement(ShowRightPanelSVG,null))):null}
2
- //# sourceMappingURL=ToggleRightPanelButton.js.map
@@ -1 +0,0 @@
1
- export * from './ToggleRightPanelButton';
@@ -1,2 +0,0 @@
1
- export*from"./ToggleRightPanelButton";
2
- //# sourceMappingURL=index.js.map
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const HideRightPanelSVG: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
3
- export declare const StyledToggleRightPanelButton: import("styled-components").StyledComponent<"a", any, {}, never>;
4
- export declare const ShowRightPanelSVG: import("styled-components").StyledComponent<() => JSX.Element, any, {}, never>;
@@ -1,17 +0,0 @@
1
- import React from"react";import styled from"styled-components";export const HideRightPanelSVG=styled((()=>React.createElement("svg",{width:"15",height:"10",viewBox:"0 0 15 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M12.5858 5L9.29289 1.70711C8.90237 1.31658 8.90237 0.683417 9.29289 0.292893C9.68342 -0.097631 10.3166 -0.0976309 10.7071 0.292893L14.7071 4.29289C15.0976 4.68342 15.0976 5.31658 14.7071 5.70711L10.7071 9.70711C10.3166 10.0976 9.68342 10.0976 9.29289 9.70711C8.90237 9.31658 8.90237 8.68342 9.29289 8.29289L12.5858 5Z",fill:"var(--color-emphasis-400)"}),React.createElement("path",{d:"M13 5C13 5.55229 12.5523 6 12 6L4 6C3.44772 6 3 5.55228 3 5C3 4.44771 3.44772 4 4 4L12 4C12.5523 4 13 4.44772 13 5Z",fill:"var(--color-emphasis-400)"}),React.createElement("rect",{width:"2",height:"10",rx:"1",fill:"var(--color-emphasis-400)"}))))`
2
- position: absolute;
3
- `;export const StyledToggleRightPanelButton=styled.a`
4
- display: flex;
5
- justify-content: center;
6
- align-items: center;
7
- cursor: pointer;
8
- z-index: 1;
9
- /* Rectangle 201 */
10
- height: var(--layout-controls-height);
11
- width: var(--layout-controls-width);
12
- background: var(--color-emphasis-100);
13
- border-radius: var(--border-radius);
14
- `;export const ShowRightPanelSVG=styled((()=>React.createElement("svg",{width:"15",height:"10",viewBox:"0 0 15 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M2.41421 5L5.70711 8.29289C6.09763 8.68342 6.09763 9.31658 5.7071 9.70711C5.31658 10.0976 4.68342 10.0976 4.29289 9.70711L0.292892 5.70711C-0.0976321 5.31658 -0.0976319 4.68342 0.292893 4.29289L4.29289 0.292894C4.68342 -0.0976302 5.31658 -0.09763 5.70711 0.292894C6.09763 0.683418 6.09763 1.31658 5.70711 1.70711L2.41421 5Z",fill:"var(--color-emphasis-400)"}),React.createElement("path",{d:"M2 5C2 4.44772 2.44771 4 3 4L11 4C11.5523 4 12 4.44772 12 5C12 5.55229 11.5523 6 11 6L3 6C2.44771 6 2 5.55228 2 5Z",fill:"var(--color-emphasis-400)"}),React.createElement("rect",{x:"15",y:"10",width:"2",height:"10",rx:"1",transform:"rotate(-180 15 10)",fill:"var(--color-emphasis-400)"}))))`
15
- position: absolute;
16
- `;
17
- //# sourceMappingURL=styled.js.map