@redocly/reference-docs 2.31.0 → 2.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/bin/cli/commands/redocly-docs-cli.min.js +101 -88
  2. package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +1 -1
  3. package/dist/console.redocly-reference-docs.min.js +120 -120
  4. package/dist/oauth2-redirect.js +1 -1
  5. package/dist/redocly-reference-docs.min.js +586 -573
  6. package/lib/components/Endpoint/Endpoint.js +1 -1
  7. package/lib/components/Endpoint/ServerList.d.ts +1 -1
  8. package/lib/components/Endpoint/ServerList.js +1 -1
  9. package/lib/components/Endpoint/types.d.ts +1 -2
  10. package/lib/components/Panel/ContentPanel.js +1 -1
  11. package/lib/components/Panel/Description.d.ts +1 -0
  12. package/lib/components/Panel/Description.js +2 -0
  13. package/lib/components/Panel/PanelComponent.js +1 -1
  14. package/lib/components/Panel/index.d.ts +1 -0
  15. package/lib/components/Panel/index.js +1 -1
  16. package/lib/components/Samples/SamplesTabs.d.ts +3 -1
  17. package/lib/components/Samples/SamplesTabs.js +1 -1
  18. package/lib/components/console/AuthPanel.d.ts +1 -1
  19. package/lib/components/console/Console.d.ts +1 -1
  20. package/lib/components/console/Console.js +1 -1
  21. package/lib/components/console/ConsoleLazy.js +1 -1
  22. package/lib/components/console/OAuth2Flow.d.ts +2 -2
  23. package/lib/components/console/OAuth2TokenInput.d.ts +1 -1
  24. package/lib/components/console/OpenIDConnect.d.ts +1 -1
  25. package/lib/components/console/OpenIDConnect.js +1 -1
  26. package/lib/components/console/ServersDropdown/ServersDropdown.d.ts +3 -0
  27. package/lib/components/console/ServersDropdown/ServersDropdown.js +2 -0
  28. package/lib/components/console/ServersDropdown/index.d.ts +1 -0
  29. package/lib/components/console/ServersDropdown/index.js +2 -0
  30. package/lib/components/console/ServersDropdown/types.d.ts +5 -0
  31. package/lib/components/console/ServersDropdown/types.js +2 -0
  32. package/lib/hooks/index.d.ts +1 -0
  33. package/lib/hooks/index.js +1 -1
  34. package/lib/hooks/useDimensions.d.ts +1 -0
  35. package/lib/hooks/useDimensions.js +2 -0
  36. package/lib/index.d.ts +1 -1
  37. package/lib/oauth2-redirect-page/handler/helpers.d.ts +1 -0
  38. package/lib/oauth2-redirect-page/handler/helpers.js +1 -1
  39. package/lib/redoc-lib/src/common-elements/samples.js +1 -1
  40. package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +0 -1
  41. package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.js +1 -1
  42. package/lib/redoc-lib/src/components/Callbacks/CallbackDetails.js +1 -1
  43. package/lib/redoc-lib/src/components/JsonViewer/style.js +1 -1
  44. package/lib/redoc-lib/src/components/Operation/Operation.js +1 -1
  45. package/lib/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
  46. package/lib/redoc-lib/src/components/Responses/Response.d.ts +2 -5
  47. package/lib/redoc-lib/src/components/Responses/Response.js +1 -1
  48. package/lib/redoc-lib/src/components/Responses/ResponseDetails.d.ts +3 -8
  49. package/lib/redoc-lib/src/components/Responses/ResponseDetails.js +1 -1
  50. package/lib/redoc-lib/src/components/Responses/ResponseHeaders.d.ts +3 -9
  51. package/lib/redoc-lib/src/components/Responses/ResponseHeaders.js +1 -1
  52. package/lib/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -5
  53. package/lib/redoc-lib/src/components/Responses/ResponsesList.d.ts +3 -8
  54. package/lib/redoc-lib/src/components/Responses/ResponsesList.js +1 -1
  55. package/lib/redoc-lib/src/components/Responses/index.d.ts +1 -0
  56. package/lib/redoc-lib/src/components/Responses/index.js +2 -0
  57. package/{lib-esm/redoc-lib/src/components/Responses/styled.elements.d.ts → lib/redoc-lib/src/components/Responses/styled.d.ts} +1 -0
  58. package/lib/redoc-lib/src/components/Responses/styled.js +2 -0
  59. package/lib/redoc-lib/src/components/Responses/types.d.ts +12 -0
  60. package/lib/redoc-lib/src/components/Responses/types.js +2 -0
  61. package/lib/redoc-lib/src/components/SecurityRequirement/SecurityRequirementPanelDescription.js +1 -1
  62. package/lib/redoc-lib/src/components/SourceCode/SourceCode.d.ts +3 -5
  63. package/lib/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
  64. package/lib/redoc-lib/src/services/models/Schema.js +1 -1
  65. package/lib/redoc-lib/src/theme.d.ts +9 -0
  66. package/lib/redoc-lib/src/theme.js +1 -1
  67. package/lib/services/OpenIDConnect.d.ts +1 -1
  68. package/lib/services/code-samples/generator.js +1 -1
  69. package/lib/services/extendTheme.d.ts +1 -1
  70. package/lib/standalone.js +1 -1
  71. package/lib/types.d.ts +11 -0
  72. package/lib/utils.d.ts +2 -12
  73. package/lib/utils.js +1 -1
  74. package/lib-esm/components/Endpoint/Endpoint.js +1 -1
  75. package/lib-esm/components/Endpoint/ServerList.d.ts +1 -1
  76. package/lib-esm/components/Endpoint/ServerList.js +1 -1
  77. package/lib-esm/components/Endpoint/types.d.ts +1 -2
  78. package/lib-esm/components/Panel/ContentPanel.js +1 -1
  79. package/lib-esm/components/Panel/Description.d.ts +1 -0
  80. package/lib-esm/components/Panel/Description.js +2 -0
  81. package/lib-esm/components/Panel/PanelComponent.js +1 -1
  82. package/lib-esm/components/Panel/index.d.ts +1 -0
  83. package/lib-esm/components/Panel/index.js +1 -1
  84. package/lib-esm/components/Samples/SamplesTabs.d.ts +3 -1
  85. package/lib-esm/components/Samples/SamplesTabs.js +1 -1
  86. package/lib-esm/components/console/AuthPanel.d.ts +1 -1
  87. package/lib-esm/components/console/Console.d.ts +1 -1
  88. package/lib-esm/components/console/Console.js +1 -1
  89. package/lib-esm/components/console/ConsoleLazy.js +1 -1
  90. package/lib-esm/components/console/OAuth2Flow.d.ts +2 -2
  91. package/lib-esm/components/console/OAuth2TokenInput.d.ts +1 -1
  92. package/lib-esm/components/console/OpenIDConnect.d.ts +1 -1
  93. package/lib-esm/components/console/OpenIDConnect.js +1 -1
  94. package/lib-esm/components/console/ServersDropdown/ServersDropdown.d.ts +3 -0
  95. package/lib-esm/components/console/ServersDropdown/ServersDropdown.js +2 -0
  96. package/lib-esm/components/console/ServersDropdown/index.d.ts +1 -0
  97. package/lib-esm/components/console/ServersDropdown/index.js +2 -0
  98. package/lib-esm/components/console/ServersDropdown/types.d.ts +5 -0
  99. package/lib-esm/components/console/ServersDropdown/types.js +2 -0
  100. package/lib-esm/hooks/index.d.ts +1 -0
  101. package/lib-esm/hooks/index.js +1 -1
  102. package/lib-esm/hooks/useDimensions.d.ts +1 -0
  103. package/lib-esm/hooks/useDimensions.js +2 -0
  104. package/lib-esm/index.d.ts +1 -1
  105. package/lib-esm/oauth2-redirect-page/handler/helpers.d.ts +1 -0
  106. package/lib-esm/oauth2-redirect-page/handler/helpers.js +1 -1
  107. package/lib-esm/redoc-lib/src/common-elements/samples.js +1 -1
  108. package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +0 -1
  109. package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.js +1 -1
  110. package/lib-esm/redoc-lib/src/components/Callbacks/CallbackDetails.js +1 -1
  111. package/lib-esm/redoc-lib/src/components/JsonViewer/style.js +1 -1
  112. package/lib-esm/redoc-lib/src/components/Operation/Operation.js +1 -1
  113. package/lib-esm/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
  114. package/lib-esm/redoc-lib/src/components/Responses/Response.d.ts +2 -5
  115. package/lib-esm/redoc-lib/src/components/Responses/Response.js +1 -1
  116. package/lib-esm/redoc-lib/src/components/Responses/ResponseDetails.d.ts +3 -8
  117. package/lib-esm/redoc-lib/src/components/Responses/ResponseDetails.js +1 -1
  118. package/lib-esm/redoc-lib/src/components/Responses/ResponseHeaders.d.ts +3 -9
  119. package/lib-esm/redoc-lib/src/components/Responses/ResponseHeaders.js +1 -1
  120. package/lib-esm/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -5
  121. package/lib-esm/redoc-lib/src/components/Responses/ResponsesList.d.ts +3 -8
  122. package/lib-esm/redoc-lib/src/components/Responses/ResponsesList.js +1 -1
  123. package/lib-esm/redoc-lib/src/components/Responses/index.d.ts +1 -0
  124. package/lib-esm/redoc-lib/src/components/Responses/index.js +2 -0
  125. package/{lib/redoc-lib/src/components/Responses/styled.elements.d.ts → lib-esm/redoc-lib/src/components/Responses/styled.d.ts} +1 -0
  126. package/lib-esm/redoc-lib/src/components/Responses/styled.js +2 -0
  127. package/lib-esm/redoc-lib/src/components/Responses/types.d.ts +12 -0
  128. package/lib-esm/redoc-lib/src/components/Responses/types.js +2 -0
  129. package/lib-esm/redoc-lib/src/components/SecurityRequirement/SecurityRequirementPanelDescription.js +1 -1
  130. package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.d.ts +3 -5
  131. package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
  132. package/lib-esm/redoc-lib/src/services/models/Schema.js +1 -1
  133. package/lib-esm/redoc-lib/src/theme.d.ts +9 -0
  134. package/lib-esm/redoc-lib/src/theme.js +1 -1
  135. package/lib-esm/services/OpenIDConnect.d.ts +1 -1
  136. package/lib-esm/services/code-samples/generator.js +1 -1
  137. package/lib-esm/services/extendTheme.d.ts +1 -1
  138. package/lib-esm/standalone.js +1 -1
  139. package/lib-esm/types.d.ts +11 -0
  140. package/lib-esm/utils.d.ts +2 -12
  141. package/lib-esm/utils.js +1 -1
  142. package/package.json +2 -1
  143. package/lib/components/console/ServerDropdown.d.ts +0 -24
  144. package/lib/components/console/ServerDropdown.js +0 -2
  145. package/lib/redoc-lib/src/components/Responses/styled.elements.js +0 -2
  146. package/lib-esm/components/console/ServerDropdown.d.ts +0 -24
  147. package/lib-esm/components/console/ServerDropdown.js +0 -2
  148. package/lib-esm/redoc-lib/src/components/Responses/styled.elements.js +0 -2
@@ -1,3 +1,4 @@
1
+ import type { Typography } from '../../services/extendTheme';
1
2
  declare const defaultTheme: ThemeInterface;
2
3
  export default defaultTheme;
3
4
  export declare function resolveTheme(theme: ThemeInterface): ResolvedThemeInterface;
@@ -174,6 +175,13 @@ export interface ResolvedThemeInterface {
174
175
  panels: {
175
176
  borderRadius: string;
176
177
  backgroundColor: string;
178
+ title: Typography & {
179
+ fontFamily: MediaValue;
180
+ };
181
+ subTitle: Typography & {
182
+ fontFamily: MediaValue;
183
+ };
184
+ iconColor: string;
177
185
  };
178
186
  layoutControls: {
179
187
  top: string;
@@ -213,6 +221,7 @@ export interface ResolvedThemeInterface {
213
221
  };
214
222
  codeBlock: {
215
223
  backgroundColor: string;
224
+ maxHeight: string;
216
225
  };
217
226
  layout: {
218
227
  showDarkRightPanel?: boolean;
@@ -1,2 +1,2 @@
1
- var _a,_b;import{darken,lighten,readableColor,transparentize}from"polished";import{ZERO_BREAKPOINT}from"./utils/media-css";var defaultTheme={spacing:{unit:5,sectionHorizontal:function(r){return 8*r.spacing.unit},sectionVertical:function(r){return 4*r.spacing.unit}},breakpoints:{small:"50rem",medium:"85rem",large:"105rem"},colors:{tonalOffset:.2,primary:{main:"#0065FB",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.primary.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.primary.main)},contrastText:function(r){var o=r.colors;return readableColor(o.primary.main)}},secondary:{main:"#E4E7EB",light:"#F5F7FA",dark:"#E4E7EB",contrastText:"#3E4C59"},accent:{main:"#59C3FF",light:"#b3dcf3",dark:"#033B73",contrastText:"#ffffff"},success:{main:"#41DE50",light:function(r){var o=r.colors;return lighten(2*o.tonalOffset,o.success.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.success.main)},contrastText:function(r){var o=r.colors;return readableColor(o.success.main)}},warning:{main:"#ffa500",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.warning.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.warning.main)},contrastText:"#ffffff"},error:{main:"#FF6161",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.error.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.error.main)},contrastText:"#ffffff"},text:{primary:"#1F2933",secondary:"#7b8794",light:"#F5F7FA"},border:{dark:"#616E7C",light:"#E4E7EB"},responses:{success:{borderColor:"#B1E996",backgroundColor:"#F6FFF4",tabTextColor:function(r){return r.colors.responses.success.borderColor}},error:{borderColor:"#FFC9C9",backgroundColor:"#FFF4F4",tabTextColor:function(r){return r.colors.responses.error.borderColor}},redirect:{borderColor:function(r){return r.colors.warning.main},backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.redirect.borderColor)},tabTextColor:function(r){return r.colors.responses.redirect.borderColor}},info:{borderColor:"#87ceeb",backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.info.borderColor)},tabTextColor:function(r){return r.colors.responses.info.borderColor}}},http:{get:"#3A9601",post:"#0065FB",put:"#93527B",options:"#947014",patch:"#bf581d",delete:"#C83637",basic:"#707070",link:"#07818F",head:"#A23DAD"}},schema:{linesColor:function(r){return r.colors.border.light},defaultDetailsWidth:"70%",typeNameColor:function(r){return r.colors.text.secondary},typeTitleColor:function(r){return r.schema.typeNameColor},requireLabelColor:"#FF0000",labelsTextSize:"0.9em",nestingSpacing:"1em",nestedBackground:function(r){return r.colors.secondary.light},nestedAlternativeBackground:"#ffffff",caretColor:function(r){return r.colors.text.primary},caretSize:"9px"},typography:{fontSize:"14px",lineHeight:"1.5em",fontWeightRegular:"400",fontWeightBold:"600",fontWeightLight:"300",fontFamily:"Source Sans Pro, sans-serif",smoothing:"antialiased",optimizeSpeed:!0,headings:{fontFamily:function(r){return r.typography.fontFamily},fontWeight:"700",lineHeight:"1.6em"},code:{fontSize:"13px",fontFamily:"Source Code Pro, monospace",lineHeight:function(r){return r.typography.lineHeight},fontWeight:function(r){return r.typography.fontWeightRegular},color:"#e53935",backgroundColor:"rgba(38, 50, 56, 0.05)",wrap:!1},links:{color:function(r){return r.colors.primary.main},visited:function(r){return r.typography.links.color},hover:function(r){var o=r.typography;return lighten(.2,o.links.color)},textDecoration:"auto",hoverTextDecoration:"auto"},fieldName:{fontSize:function(r){return r.typography.code.fontSize},fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.code.fontWeight}}},sidebar:{separatorLabelColor:function(r){return r.sidebar.textColor},separatorLineColor:"#DADADA",caretColor:function(r){return r.sidebar.textColor},caretSize:function(r){return r.sidebar.spacing.unit},spacing:{unit:8,paddingHorizontal:function(r){return r.sidebar.spacing.unit},paddingVertical:function(r){return r.sidebar.spacing.unit},offsetTop:function(r){return 2*r.sidebar.spacing.unit},offsetLeft:function(r){return 2*r.sidebar.spacing.unit},offsetNesting:function(r){return 2*r.sidebar.spacing.unit}},borderRadius:"4px",fontFamily:function(r){return r.typography.fontFamily},fontSize:function(r){return r.typography.fontSize},showAtBreakpoint:"small",width:"285px",backgroundColor:"#fff",rightLineColor:function(r){return r.colors.border.light},textColor:function(r){return r.colors.text.primary},activeTextColor:function(r){return r.sidebar.textColor},activeBgColor:function(r){return r.colors.border.light}},components:{buttons:{borderRadius:function(r){return r.shape.borderRadius},hoverStyle:"",fontWeight:function(r){return r.typography.fontWeightBold},boxShadow:"none",hoverBoxShadow:"0px 0px 12px 0px rgba(0, 0, 0, 0.1)",fontFamily:"inherit",sizes:{small:{fontSize:"12px",padding:"8px 10px",minWidth:"90px"},medium:{fontSize:"14px",padding:"8px 20px",minWidth:"120px"},large:{fontSize:"14px",padding:"12px 24px",minWidth:"150px"},xlarge:{fontSize:"16px",padding:"20px 24px",minWidth:"200px"}}},httpBadges:{borderRadius:"16px",fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.fontWeightBold},color:function(r){return r.colors.text.light},sizes:{medium:{fontSize:"12px",lineHeight:"20px"},small:{fontSize:"8px",lineHeight:"15px"}}},tryItButton:{fullWidth:!1},tryItSendButton:{fullWidth:!1},panels:{borderRadius:"8px",backgroundColor:"#fff"},layoutControls:{top:"20px",width:"36px",height:"36px"}},logo:{maxHeight:function(r){return r.sidebar.width},maxWidth:function(r){return r.sidebar.width},gutter:"2px"},fab:{backgroundColor:"#f2f2f2",color:"#0065FB"},rightPanel:{showAtBreakpoint:"medium",backgroundColor:"#1F2933",panelBackgroundColor:"#52606D",panelControlsBackgroundColor:"#323F4B",width:"37.5%",textColor:"#ffffff"},codeBlock:{backgroundColor:function(r){return r.rightPanel.panelControlsBackgroundColor}},shape:{borderRadius:"4px"},layout:{showDarkRightPanel:!1,stacked:{maxWidth:(_a={},_a[ZERO_BREAKPOINT]="",_a.small="90%",_a.medium="75%",_a.large="1200px",_a)},"three-panel":{middlePanelMaxWidth:"none",maxWidth:(_b={},_b[ZERO_BREAKPOINT]="100%",_b.small="100%",_b.medium="100%",_b.large="1800px",_b)}}};export default defaultTheme;export function resolveTheme(r){var o={},t=0,n=function(e,i){Object.keys(e).forEach((function(a){var l=(i?i+".":"")+a,c=e[a];"function"==typeof c?Object.defineProperty(e,a,{get:function(){if(!o[l]){if(++t>1e3)throw new Error("Theme probably contains circular dependency at "+l+": "+c.toString());o[l]=c(r)}return o[l]},enumerable:!0}):"object"==typeof c&&n(c,l)}))};return n(r,""),JSON.parse(JSON.stringify(r))}
1
+ var _a,_b;import{darken,lighten,readableColor,transparentize}from"polished";import{ZERO_BREAKPOINT}from"./utils/media-css";var defaultTheme={spacing:{unit:5,sectionHorizontal:function(r){return 8*r.spacing.unit},sectionVertical:function(r){return 4*r.spacing.unit}},breakpoints:{small:"50rem",medium:"85rem",large:"105rem"},colors:{tonalOffset:.2,primary:{main:"#0065FB",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.primary.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.primary.main)},contrastText:function(r){var o=r.colors;return readableColor(o.primary.main)}},secondary:{main:"#E4E7EB",light:"#F5F7FA",dark:"#E4E7EB",contrastText:"#3E4C59"},accent:{main:"#59C3FF",light:"#b3dcf3",dark:"#033B73",contrastText:"#ffffff"},success:{main:"#41DE50",light:function(r){var o=r.colors;return lighten(2*o.tonalOffset,o.success.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.success.main)},contrastText:function(r){var o=r.colors;return readableColor(o.success.main)}},warning:{main:"#ffa500",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.warning.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.warning.main)},contrastText:"#ffffff"},error:{main:"#FF6161",light:function(r){var o=r.colors;return lighten(o.tonalOffset,o.error.main)},dark:function(r){var o=r.colors;return darken(o.tonalOffset,o.error.main)},contrastText:"#ffffff"},text:{primary:"#1F2933",secondary:"#7b8794",light:"#F5F7FA"},border:{dark:"#616E7C",light:"#E4E7EB"},responses:{success:{borderColor:"#B1E996",backgroundColor:"#F6FFF4",tabTextColor:function(r){return r.colors.responses.success.borderColor}},error:{borderColor:"#FFC9C9",backgroundColor:"#FFF4F4",tabTextColor:function(r){return r.colors.responses.error.borderColor}},redirect:{borderColor:function(r){return r.colors.warning.main},backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.redirect.borderColor)},tabTextColor:function(r){return r.colors.responses.redirect.borderColor}},info:{borderColor:"#87ceeb",backgroundColor:function(r){var o=r.colors;return transparentize(.9,o.responses.info.borderColor)},tabTextColor:function(r){return r.colors.responses.info.borderColor}}},http:{get:"#3A9601",post:"#0065FB",put:"#93527B",options:"#947014",patch:"#bf581d",delete:"#C83637",basic:"#707070",link:"#07818F",head:"#A23DAD"}},schema:{linesColor:function(r){return r.colors.border.light},defaultDetailsWidth:"70%",typeNameColor:function(r){return r.colors.text.secondary},typeTitleColor:function(r){return r.schema.typeNameColor},requireLabelColor:"#FF0000",labelsTextSize:"0.9em",nestingSpacing:"1em",nestedBackground:function(r){return r.colors.secondary.light},nestedAlternativeBackground:"#ffffff",caretColor:function(r){return r.colors.text.primary},caretSize:"9px"},typography:{fontSize:"14px",lineHeight:"1.5em",fontWeightRegular:"400",fontWeightBold:"600",fontWeightLight:"300",fontFamily:"Source Sans Pro, sans-serif",smoothing:"antialiased",optimizeSpeed:!0,headings:{fontFamily:function(r){return r.typography.fontFamily},fontWeight:"700",lineHeight:"1.6em"},code:{fontSize:"13px",fontFamily:"Source Code Pro, monospace",lineHeight:function(r){return r.typography.lineHeight},fontWeight:function(r){return r.typography.fontWeightRegular},color:"#e53935",backgroundColor:"rgba(38, 50, 56, 0.05)",wrap:!1},links:{color:function(r){return r.colors.primary.main},visited:function(r){return r.typography.links.color},hover:function(r){var o=r.typography;return lighten(.2,o.links.color)},textDecoration:"auto",hoverTextDecoration:"auto"},fieldName:{fontSize:function(r){return r.typography.code.fontSize},fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.code.fontWeight}}},sidebar:{separatorLabelColor:function(r){return r.sidebar.textColor},separatorLineColor:"#DADADA",caretColor:function(r){return r.sidebar.textColor},caretSize:function(r){return r.sidebar.spacing.unit},spacing:{unit:8,paddingHorizontal:function(r){return r.sidebar.spacing.unit},paddingVertical:function(r){return r.sidebar.spacing.unit},offsetTop:function(r){return 2*r.sidebar.spacing.unit},offsetLeft:function(r){return 2*r.sidebar.spacing.unit},offsetNesting:function(r){return 2*r.sidebar.spacing.unit}},borderRadius:"4px",fontFamily:function(r){return r.typography.fontFamily},fontSize:function(r){return r.typography.fontSize},showAtBreakpoint:"small",width:"285px",backgroundColor:"#fff",rightLineColor:function(r){return r.colors.border.light},textColor:function(r){return r.colors.text.primary},activeTextColor:function(r){return r.sidebar.textColor},activeBgColor:function(r){return r.colors.border.light}},components:{buttons:{borderRadius:function(r){return r.shape.borderRadius},hoverStyle:"",fontWeight:function(r){return r.typography.fontWeightBold},boxShadow:"none",hoverBoxShadow:"0px 0px 12px 0px rgba(0, 0, 0, 0.1)",fontFamily:"inherit",sizes:{small:{fontSize:"12px",padding:"8px 10px",minWidth:"90px"},medium:{fontSize:"14px",padding:"8px 20px",minWidth:"120px"},large:{fontSize:"14px",padding:"12px 24px",minWidth:"150px"},xlarge:{fontSize:"16px",padding:"20px 24px",minWidth:"200px"}}},httpBadges:{borderRadius:"16px",fontFamily:function(r){return r.typography.code.fontFamily},fontWeight:function(r){return r.typography.fontWeightBold},color:function(r){return r.colors.text.light},sizes:{medium:{fontSize:"12px",lineHeight:"20px"},small:{fontSize:"8px",lineHeight:"15px"}}},tryItButton:{fullWidth:!1},tryItSendButton:{fullWidth:!1},panels:{borderRadius:"8px",backgroundColor:"#fff",title:{fontSize:"18px",fontWeight:function(r){return r.typography.headings.fontWeight},fontFamily:function(r){return r.typography.fontFamily},lineHeight:"18px",color:"#1F2933",transform:""},subTitle:{fontSize:"0.9em",fontWeight:"normal",fontFamily:function(r){return r.typography.fontFamily},lineHeight:"18px",color:"#1F2933",transform:""},iconColor:"#1F2933"},layoutControls:{top:"20px",width:"36px",height:"36px"}},logo:{maxHeight:function(r){return r.sidebar.width},maxWidth:function(r){return r.sidebar.width},gutter:"2px"},fab:{backgroundColor:"#f2f2f2",color:"#0065FB"},rightPanel:{showAtBreakpoint:"medium",backgroundColor:"#1F2933",panelBackgroundColor:"#52606D",panelControlsBackgroundColor:"#323F4B",width:"37.5%",textColor:"#ffffff"},codeBlock:{backgroundColor:function(r){return r.rightPanel.panelControlsBackgroundColor},maxHeight:"auto"},shape:{borderRadius:"4px"},layout:{showDarkRightPanel:!1,stacked:{maxWidth:(_a={},_a[ZERO_BREAKPOINT]="",_a.small="90%",_a.medium="75%",_a.large="1200px",_a)},"three-panel":{middlePanelMaxWidth:"none",maxWidth:(_b={},_b[ZERO_BREAKPOINT]="100%",_b.small="100%",_b.medium="100%",_b.large="1800px",_b)}}};export default defaultTheme;export function resolveTheme(r){var o={},t=0,n=function(e,i){Object.keys(e).forEach((function(a){var l=(i?i+".":"")+a,f=e[a];"function"==typeof f?Object.defineProperty(e,a,{get:function(){if(!o[l]){if(++t>1e3)throw new Error("Theme probably contains circular dependency at "+l+": "+f.toString());o[l]=f(r)}return o[l]},enumerable:!0}):"object"==typeof f&&n(f,l)}))};return n(r,""),JSON.parse(JSON.stringify(r))}
2
2
  //# sourceMappingURL=theme.js.map
@@ -21,7 +21,7 @@ export interface ProviderMetadata {
21
21
  request_object_signing_alg_values_supported?: string[];
22
22
  request_object_encryption_alg_values_supported?: string[];
23
23
  request_object_encryption_enc_values_supported?: string[];
24
- token_endpoint_auth_methods_supported?: string[];
24
+ token_endpoint_auth_methods_supported?: string[] | string;
25
25
  token_endpoint_auth_signing_alg_values_supported?: string[];
26
26
  display_values_supported?: string[];
27
27
  claim_types_supported?: string[];
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{toJS}from"mobx";import{deleteEmptyArrayItem,isArrayOfObjects,serializeParameterValue}from"../../redoc-lib";import{getSecurityDetails,getParameterValue}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../types";import{HTTPSnippet}from"./httpsnippet";function mapOperationToHAR(e,a){var t,r,i,n,s,o,l,u,p,d,c=a.exampleName,m=void 0===c?"":c,v=a.skipOptionalParameters,h=void 0!==v&&v,f=a.withOAuth2Call,y=void 0!==f&&f,g=a.spec,O=a.generatedPayloadSamplesMaxDepth,_=void 0===O?8:O,S=a.pathParams,T=void 0===S?{}:S,C=a.properties,E=void 0===C?{}:C,b=getSecurityData(null===(t=e.security)||void 0===t?void 0:t[0],y),A=b.securityHeaders,P=b.securityCookies,w=b.securityQueries,D=b.securityOAuth2ExtraCalls,R=b.basicAuth,k=null===(i=null===(r=e.requestBody)||void 0===r?void 0:r.content)||void 0===i?void 0:i.active,q={skipNonRequired:h,skipReadOnly:!0,maxSampleDepth:_},H={path:toJS(null===(n=null==e?void 0:e.requestValues)||void 0===n?void 0:n.path),cookie:toJS(null===(s=null==e?void 0:e.requestValues)||void 0===s?void 0:s.cookie),header:toJS(null===(o=null==e?void 0:e.requestValues)||void 0===o?void 0:o.header),query:toJS(null===(l=null==e?void 0:e.requestValues)||void 0===l?void 0:l.query),body:toJS(null===(u=null==e?void 0:e.requestValues)||void 0===u?void 0:u.body)},x=!1,M=e.parameters.filter((function(e){return"header"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){var a;return{name:e.name,value:(null===(a=H.header)||void 0===a?void 0:a[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g))}})).map((function(e){return(null==k?void 0:k.name)&&"content-type"===e.name.toLowerCase()&&(x=!0,e.value=k.name),e})).concat(A);!x&&(null==k?void 0:k.name)&&M.unshift({name:"Content-Type",value:null==k?void 0:k.name});var N=e.parameters.filter((function(e){return"cookie"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g)))})).reduce((function(e,a){for(var t,r=0,i=Object.entries(a);r<i.length;r++){var n=i[r],s=n[0],o=n[1];e.push({name:s,value:String((null===(t=H.cookie)||void 0===t?void 0:t[s])||o)})}return e}),[]).concat(P),z=e.parameters.filter((function(e){return"query"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g)))})).reduce((function(e,a){for(var t,r,i,n=0,s=Object.entries(a);n<s.length;n++){var o=s[n],l=o[0],u=o[1];e.push({name:l,value:isArrayOfObjects(null===(t=H.query)||void 0===t?void 0:t[l])&&JSON.stringify(deleteEmptyArrayItem(null===(r=H.query)||void 0===r?void 0:r[l]))||String((null===(i=H.query)||void 0===i?void 0:i[l])||u)})}return e}),[]).concat(w),U=(null===(p=e.activeServer)||void 0===p?void 0:p.url.replace(/\/$/,""))+"/"+e.path.replace(/^\//,""),V=e.parameters.filter((function(e){return"path"===e.in})).reduce((function(e,a){var t,r=a.in,i=a.name;return e[i]=(null===(t=H.path)||void 0===t?void 0:t[i])||T[i]||getParameterValue(r,i),e}),{}),j=null===(d=null==k?void 0:k.examples)||void 0===d?void 0:d[m],J=(null==k?void 0:k.examples)||{},I=Object.values(J)[0],L=H.body||(null==j?void 0:j.value)||(null==I?void 0:I.value)||(null==k?void 0:k.schema)&&Sampler.sample(null==k?void 0:k.schema.rawSchema,q,g),Y=null==k?void 0:k.name.toLowerCase(),Q="",K=[];switch(normalizeMimeType(Y)){case MediaTypes.JSON:Q=JSON.stringify(getDataRequest(L,E));break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:Q=stringifyQueryString(getDataRequest(L,E)),K=objectToHarParams(getDataRequest(L,E));break;default:Q=String(L||"")}var B=Q?{mimeType:(null==k?void 0:k.name)||MediaTypes.OCTET_STREAM,text:Q,params:K}:void 0;return{method:e.httpVerb,url:U,httpVersion:"HTTP/1.1",cookies:N,headers:M,queryString:z,postData:B,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:D,basicAuth:R,pathParameters:V,serverVariables:e.activeServer.variables}}var defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:__assign(__assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:__assign(__assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:__assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:__assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:__assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:__assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:__assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:__assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:__assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:__assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:__assign({},defaultOptions)}};export function getCodeSample(e){var a=e.lang,t=e.operation,r=e.exampleName,i=e.pathParams,n=e.properties,s=e.options,o=void 0===s?{}:s;try{var l=mapOperationToHAR(t,{exampleName:r,pathParams:i,properties:n,skipOptionalParameters:o.skipOptionalParameters,withOAuth2Call:o.withOAuth2Call,spec:o.spec,generatedPayloadSamplesMaxDepth:o.generatedPayloadSamplesMaxDepth}),u=new HTTPSnippet(l);return langToSnippetConfig[a]?u.convert(langToSnippetConfig[a].code,langToSnippetConfig[a].defaultTarget,__assign(__assign({},langToSnippetConfig[a].defaultOptions),o)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,a){for(var t,r,i,n,s={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0},o=0,l=(null==e?void 0:e.schemes)||[];o<l.length;o++){var u=l[o],p=getSecurityDetails(u.id);switch(u.type){case"openIdConnect":null===(t=s.securityHeaders)||void 0===t||t.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":var d=p.token?(p.token.token_type||"Bearer")+" "+p.token.access_token:"Bearer <YOUR_TOKEN_HERE>";u.flows.clientCredentials&&a?s.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(u.flows.clientCredentials,u.scopes,p)):u.flows.password&&a&&s.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(u.flows.password,u.scopes,p)),null===(r=s.securityHeaders)||void 0===r||r.push({name:"Authorization",value:d});break;case"apiKey":var c=p.raw||"YOUR_API_KEY_HERE";"header"===u.in&&(null===(i=s.securityHeaders)||void 0===i||i.push({name:u.name,value:c})),"cookie"===u.in&&s.securityCookies.push({name:u.name,value:c}),"query"===u.in&&s.securityQueries.push({name:u.name,value:c});break;case"http":"basic"===u.scheme?s.basicAuth={username:p.username||"<username>",password:p.password||"<password>"}:null===(n=s.securityHeaders)||void 0===n||n.push({name:"Authorization",value:capitalizeFirst(u.scheme||"bearer")+" <YOUR_"+(u.bearerFormat||"TOKEN")+"_HERE>"})}}return s}function getOAuth2PasswordCallHar(e,a,t){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:t.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:t.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:t.username||"<username>"},{name:"password",value:t.password||"<password>"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,a,t){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:t.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:t.client_secret||"YOUR_CLIENT_SECRET"},a.length?{name:"scope",value:a.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,a){if(e){if("object"==typeof e)return merge(e,a,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),a,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e){for(var a=[],t=0,r=Object.entries(e);t<r.length;t++){var i=r[t],n=i[0],s=i[1];a.push({name:n,value:String(s)})}return a}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
1
+ import{__assign}from"tslib";import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{toJS}from"mobx";import{deleteEmptyArrayItem,isArrayOfObjects,serializeParameterValue}from"../../redoc-lib";import{getSecurityDetails,getParameterValue}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../types";import{l}from"../../redoc-lib/src/services/Labels";import{HTTPSnippet}from"./httpsnippet";import StringUtility from"./httpsnippet/helpers/string-utility";function mapOperationToHAR(e,t){var a,r,i,n,s,o,l,u,p,d,c=t.exampleName,m=void 0===c?"":c,v=t.skipOptionalParameters,h=void 0!==v&&v,f=t.withOAuth2Call,y=void 0!==f&&f,g=t.spec,O=t.generatedPayloadSamplesMaxDepth,S=void 0===O?8:O,_=t.pathParams,T=void 0===_?{}:_,C=t.properties,E=void 0===C?{}:C,b=getSecurityData(null===(a=e.security)||void 0===a?void 0:a[0],y),A=b.securityHeaders,P=b.securityCookies,w=b.securityQueries,D=b.securityOAuth2ExtraCalls,R=b.basicAuth,k=null===(i=null===(r=e.requestBody)||void 0===r?void 0:r.content)||void 0===i?void 0:i.active,q={skipNonRequired:h,skipReadOnly:!0,maxSampleDepth:S},H={path:toJS(null===(n=null==e?void 0:e.requestValues)||void 0===n?void 0:n.path),cookie:toJS(null===(s=null==e?void 0:e.requestValues)||void 0===s?void 0:s.cookie),header:toJS(null===(o=null==e?void 0:e.requestValues)||void 0===o?void 0:o.header),query:toJS(null===(l=null==e?void 0:e.requestValues)||void 0===l?void 0:l.query),body:toJS(null===(u=null==e?void 0:e.requestValues)||void 0===u?void 0:u.body)},x=!1,M=e.parameters.filter((function(e){return"header"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){var t;return{name:e.name,value:(null===(t=H.header)||void 0===t?void 0:t[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g))}})).map((function(e){return(null==k?void 0:k.name)&&"content-type"===e.name.toLowerCase()&&(x=!0,e.value=k.name),e})).concat(A);!x&&(null==k?void 0:k.name)&&M.unshift({name:"Content-Type",value:null==k?void 0:k.name});var N=e.parameters.filter((function(e){return"cookie"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g)))})).reduce((function(e,t){for(var a,r=0,i=Object.entries(t);r<i.length;r++){var n=i[r],s=n[0],o=n[1];e.push({name:s,value:String((null===(a=H.cookie)||void 0===a?void 0:a[s])||o)})}return e}),[]).concat(P),U=e.parameters.filter((function(e){return"query"===e.in})).filter((function(e){return!(h&&!e.required)})).map((function(e){return parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,q,g)))})).reduce((function(e,t){for(var a,r,i,n=0,s=Object.entries(t);n<s.length;n++){var o=s[n],l=o[0],u=o[1];e.push({name:l,value:isArrayOfObjects(null===(a=H.query)||void 0===a?void 0:a[l])&&JSON.stringify(deleteEmptyArrayItem(null===(r=H.query)||void 0===r?void 0:r[l]))||String((null===(i=H.query)||void 0===i?void 0:i[l])||u)})}return e}),[]).concat(w),z=(null===(p=e.activeServer)||void 0===p?void 0:p.url.replace(/\/$/,""))+"/"+e.path.replace(/^\//,""),V=e.parameters.filter((function(e){return"path"===e.in})).reduce((function(e,t){var a,r=t.in,i=t.name;return e[i]=(null===(a=H.path)||void 0===a?void 0:a[i])||T[i]||getParameterValue(r,i),e}),{}),j=null===(d=null==k?void 0:k.examples)||void 0===d?void 0:d[m],I=(null==k?void 0:k.examples)||{},J=Object.values(I)[0],L=H.body||(null==j?void 0:j.value)||(null==J?void 0:J.value)||(null==k?void 0:k.schema)&&Sampler.sample(null==k?void 0:k.schema.rawSchema,q,g),Y=null==k?void 0:k.name.toLowerCase(),Q="",B=[];switch(normalizeMimeType(Y)){case MediaTypes.JSON:Q=JSON.stringify(getDataRequest(L,E));break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:Q=stringifyQueryString(getDataRequest(L,E)),B=objectToHarParams(getDataRequest(L,E));break;default:Q=String(L||"")}var K=Q?{mimeType:(null==k?void 0:k.name)||MediaTypes.OCTET_STREAM,text:Q,params:B}:void 0;return{method:e.httpVerb,url:z,httpVersion:"HTTP/1.1",cookies:N,headers:M,queryString:U,postData:K,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:D,basicAuth:R,pathParameters:V,serverVariables:e.activeServer.variables}}var defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:__assign(__assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:__assign(__assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:__assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:__assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:__assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:__assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:__assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:__assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:__assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:__assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:__assign({},defaultOptions)}};export function getCodeSample(e){var t=e.lang,a=e.operation,r=e.exampleName,i=e.pathParams,n=e.properties,s=e.options,o=void 0===s?{}:s;try{var l=mapOperationToHAR(a,{exampleName:r,pathParams:i,properties:n,skipOptionalParameters:o.skipOptionalParameters,withOAuth2Call:o.withOAuth2Call,spec:o.spec,generatedPayloadSamplesMaxDepth:o.generatedPayloadSamplesMaxDepth}),u=new HTTPSnippet(l);return langToSnippetConfig[t]?u.convert(langToSnippetConfig[t].code,langToSnippetConfig[t].defaultTarget,__assign(__assign({},langToSnippetConfig[t].defaultOptions),o)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t){for(var a,r,i,n,s={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0},o=0,u=(null==e?void 0:e.schemes)||[];o<u.length;o++){var p=u[o],d=getSecurityDetails(p.id);switch(p.type){case"openIdConnect":null===(a=s.securityHeaders)||void 0===a||a.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":var c=d.token?(d.token.token_type||"Bearer")+" "+d.token.access_token:"Bearer <YOUR_TOKEN_HERE>";p.flows.clientCredentials&&t?s.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(p.flows.clientCredentials,p.scopes,d)):p.flows.password&&t&&s.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(p.flows.password,p.scopes,d)),null===(r=s.securityHeaders)||void 0===r||r.push({name:"Authorization",value:c});break;case"apiKey":var m=d.raw||"YOUR_API_KEY_HERE";"header"===p.in&&(null===(i=s.securityHeaders)||void 0===i||i.push({name:p.name,value:m})),"cookie"===p.in&&s.securityCookies.push({name:p.name,value:m}),"query"===p.in&&s.securityQueries.push({name:p.name,value:m});break;case"http":"basic"===p.scheme?s.basicAuth={username:d.username||"<"+StringUtility.toSnakeCase(l("tryItAuthBasicUsername"))+">",password:d.password||"<"+StringUtility.toSnakeCase(l("tryItAuthBasicPassword"))+">"}:null===(n=s.securityHeaders)||void 0===n||n.push({name:"Authorization",value:capitalizeFirst(p.scheme||"bearer")+" <YOUR_"+(p.bearerFormat||"TOKEN")+"_HERE>"})}}return s}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:a.username||"<username>"},{name:"password",value:a.password||"<password>"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,t){if(e){if("object"==typeof e)return merge(e,t,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),t,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e){for(var t=[],a=0,r=Object.entries(e);a<r.length;a++){var i=r[a],n=i[0],s=i[1];t.push({name:n,value:String(s)})}return t}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
2
2
  //# sourceMappingURL=generator.js.map
@@ -1,7 +1,7 @@
1
1
  import type { ResolvedThemeInterface, MediaValue } from '../redoc-lib';
2
2
  import type { RedocProRawOptions } from './ProStore';
3
3
  export declare function extendTheme(options: RedocProRawOptions): RedocProRawOptions;
4
- interface Typography {
4
+ export interface Typography {
5
5
  fontSize?: MediaValue;
6
6
  fontWeight?: string | number;
7
7
  fontFamily?: MediaValue | ((theme: ProTheme) => string);
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";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*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}function getJsUrl(){var e;if(!IS_BROWSER)return"";var r=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+r+'"><\/script>'),(null===(e=document.getElementById("dummy"+r))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
1
+ import{__assign}from"tslib";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*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore,getJsUrl}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
2
2
  //# sourceMappingURL=standalone.js.map
@@ -12,3 +12,14 @@ export declare enum MediaTypes {
12
12
  JSON = "application/json",
13
13
  XML = "application/xml"
14
14
  }
15
+ export declare type SecurityDetails = {
16
+ password?: string;
17
+ username?: string;
18
+ token?: {
19
+ token_type?: string;
20
+ access_token: string;
21
+ };
22
+ client_id?: string;
23
+ client_secret?: string;
24
+ scopes?: string;
25
+ };
@@ -1,4 +1,5 @@
1
1
  import type { ProStore } from './services/ProStore';
2
+ import type { SecurityDetails } from './types';
2
3
  export declare const getGlobalStore: () => ProStore;
3
4
  export declare const setGlobalStore: (store: ProStore) => ProStore;
4
5
  export declare function debounce<T extends unknown>(fn: (...args: T[]) => void, threshold: number, leading?: boolean): (...args: T[]) => void;
@@ -8,18 +9,6 @@ export declare function setParameterValue(_in: string, name: string, value: Gene
8
9
  export declare function getParameterValue(_in: string, name: string): string | null;
9
10
  export declare function toLocalStorage(key: string, value: string): void;
10
11
  export declare function fromLocalStorage<T extends string>(key: string): T;
11
- export declare function useDimensions(node?: HTMLElement | null): [DOMRect | null];
12
- export declare type SecurityDetails = {
13
- password?: string;
14
- username?: string;
15
- token?: {
16
- token_type?: string;
17
- access_token: string;
18
- };
19
- client_id?: string;
20
- client_secret?: string;
21
- scopes?: string;
22
- };
23
12
  export declare function escapeFormId(id: string): string;
24
13
  export declare function unescapeFormId(id: string): string;
25
14
  export declare function setSecurityDetails(name: string, details: SecurityDetails | string): void;
@@ -38,3 +27,4 @@ export declare function get<T>(object: GenericObject, path: string | Array<strin
38
27
  export declare function joinStringFactory(separator: string): (...args: (string | undefined)[]) => string;
39
28
  export declare const dottedString: (...args: (string | undefined)[]) => string;
40
29
  export declare function getWindowReferenceOptions<T>(option: string): T | null;
30
+ export declare function getJsUrl(): string;
package/lib-esm/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- import*as React from"react";import{IS_BROWSER}from"./redoc-lib/src/utils/";var _store;export var getGlobalStore=function(){return _store};export var setGlobalStore=function(e){return _store=e};export function debounce(e,t,o){var r,n=0;return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];function s(){n>1&&e.apply(void 0,i),n=0,r=null}n++,r?clearTimeout(r):o&&e.apply(void 0,i),r=setTimeout(s,t)}}export function toSessionStorage(e,t){IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}export function fromSessionStorage(e){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}export function setParameterValue(e,t,o){toSessionStorage(e+"."+t,JSON.stringify(o))}export function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}export function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}export function fromLocalStorage(e){return IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}export function useDimensions(e){var t=React.useState(null),o=t[0],r=t[1];return React.useLayoutEffect((function(){if(e){var t=function(){return window.requestAnimationFrame((function(){return r(e.getBoundingClientRect())}))};return t(),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}}}),[e]),[o]}export function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}export function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}export function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}export function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}export function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),o=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:o&&JSON.parse(o)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}export function getSecurityDetailsOptions(e,t){var o=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!o)return null;var r=JSON.parse(o);return r&&Array.isArray(r)?r.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}export function get(e,t,o){return"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:o}),e)}export function joinStringFactory(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return t.filter(Boolean).join(e)}}export var 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}
1
+ import{IS_BROWSER}from"./redoc-lib/src/utils/";var _store;export var getGlobalStore=function(){return _store};export var setGlobalStore=function(e){return _store=e};export function debounce(e,t,r){var o,n=0;return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];function s(){n>1&&e.apply(void 0,i),n=0,o=null}n++,o?clearTimeout(o):r&&e.apply(void 0,i),o=setTimeout(s,t)}}export function toSessionStorage(e,t){IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}export function fromSessionStorage(e){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}export function setParameterValue(e,t,r){toSessionStorage(e+"."+t,JSON.stringify(r))}export function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}export function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}export function fromLocalStorage(e){return IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}export function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}export function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}export function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}export function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}export function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),r=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:r&&JSON.parse(r)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}export function getSecurityDetailsOptions(e,t){var r=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!r)return null;var o=JSON.parse(r);return o&&Array.isArray(o)?o.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}export function get(e,t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:r}),e)}export function joinStringFactory(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter(Boolean).join(e)}}export var 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"";var 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""}}
2
2
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reference-docs",
3
- "version": "2.31.0",
3
+ "version": "2.32.1",
4
4
  "description": "Redocly Reference Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -105,6 +105,7 @@
105
105
  "@types/dompurify": "^2.0.2",
106
106
  "@types/enzyme-to-json": "^1.5.3",
107
107
  "@types/jest": "^25.1.4",
108
+ "@types/jest-when": "^3.5.2",
108
109
  "@types/json-pointer": "^1.0.30",
109
110
  "@types/mark.js": "^8.11.5",
110
111
  "@types/marked": "^4.0.1",
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import type { OperationModel, Server } from '../../redoc-lib';
3
- import type { DropdownOption } from '../common/Dropdown';
4
- export interface ServerDropdownProps {
5
- operation: OperationModel;
6
- onChange: (server: Server) => void;
7
- }
8
- export interface ServerDropdownState {
9
- activeIdx: number;
10
- variables?: {
11
- [name: string]: string;
12
- };
13
- }
14
- export declare class ServerChooser extends React.Component<ServerDropdownProps, ServerDropdownState> {
15
- state: {
16
- activeIdx: number;
17
- variables: {};
18
- };
19
- static getDerivedStateFromProps(props: ServerDropdownProps): ServerDropdownState;
20
- handleServerChange: (option: DropdownOption) => void;
21
- handleVariableChange: (name: string, rawValue: string) => void;
22
- componentDidMount(): void;
23
- render(): JSX.Element;
24
- }
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServerChooser=void 0;var tslib_1=require("tslib"),React=(0,tslib_1.__importStar)(require("react")),mobx_react_1=require("mobx-react"),redoc_lib_1=require("../../redoc-lib"),utils_1=require("../../utils"),form_1=require("../common/form"),Dropdown_1=require("../common/Dropdown"),utils_2=require("./utils"),ServerVariable_1=(0,tslib_1.__importDefault)(require("./ServerVariable")),ServerChooser=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(r,"state",{enumerable:!0,configurable:!0,writable:!0,value:{activeIdx:0,variables:{}}}),Object.defineProperty(r,"handleServerChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=r.props.operation.servers.find((function(r){return r.url===e.serverUrl})),a=(0,utils_2.getDefaultOrStoredVariables)(t);r.props.onChange({url:e.serverUrl||"",variables:a}),(0,utils_1.toSessionStorage)("serverUrl",e.serverUrl||""),r.setState({variables:a})}}),Object.defineProperty(r,"handleVariableChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t){var a,i=r.props.operation.servers[r.state.activeIdx],l=t||""===t?t:(0,utils_2.getDefaultOrStoredVariables)(i)[e],n=(0,tslib_1.__assign)((0,tslib_1.__assign)({},r.state.variables),((a={})[e]=l,a));r.setState({variables:n}),(0,utils_2.updateVariablesStorage)(e,l),r.props.onChange((0,tslib_1.__assign)((0,tslib_1.__assign)({},i),{variables:n}))}}),r}return(0,tslib_1.__extends)(r,e),Object.defineProperty(r,"getDerivedStateFromProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.operation,t=(0,utils_1.fromSessionStorage)("serverUrl"),a=r.servers.findIndex((function(e){return e.url===t}));return{activeIdx:a<0?0:a}}}),Object.defineProperty(r.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(0,utils_2.getServerWithVariables)(this.props.operation.servers,this.state.activeIdx);this.props.onChange(e),this.setState({variables:e.variables})}}),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,r=this.state.activeIdx,t=this.props.operation.servers.map((function(r,t){return{idx:t,serverUrl:r.url,value:"\n "+(0,utils_2.expandDefaultServerVariables)((0,utils_2.expandVariables)(r.url,e.state.variables),r.variables)+"\n - "+(r.description||"Default")+"\n "}})),a=Object.keys(this.state.variables);return React.createElement(ServerDropdownWrap,null,React.createElement(form_1.FormLabel,{htmlFor:"server"},"Target server: "),React.createElement(form_1.FormControl,null,React.createElement(Dropdown_1.Dropdown,{variant:"dark",value:t[r].value,options:t,fullWidth:!0,onChange:this.handleServerChange})),a.length?a.map((function(r){var t,a=null===(t=e.props.operation.servers[e.state.activeIdx].variables)||void 0===t?void 0:t[r];if(a)return React.createElement(ServerVariable_1.default,{key:r,name:r,value:e.state.variables[r],defaultValue:a.default,onChange:function(t){return e.handleVariableChange(r,t)},variableEnum:a.enum,description:a.description})})):null)}}),r=(0,tslib_1.__decorate)([mobx_react_1.observer],r)}(React.Component);exports.ServerChooser=ServerChooser;var templateObject_1,ServerDropdownWrap=redoc_lib_1.styled.div(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(["\n margin-top: 20px;\n"],["\n margin-top: 20px;\n"])));
2
- //# sourceMappingURL=ServerDropdown.js.map
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wrapper=exports.HeadersCaption=void 0;var templateObject_1,templateObject_2,tslib_1=require("tslib"),common_elements_1=require("../../common-elements"),styled_components_1=(0,tslib_1.__importDefault)(require("../../styled-components"));exports.HeadersCaption=(0,styled_components_1.default)(common_elements_1.FieldsGroupHeader.withComponent("caption"))(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"],["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"]))),exports.Wrapper=styled_components_1.default.div(templateObject_2||(templateObject_2=(0,tslib_1.__makeTemplateObject)(["\n margin-bottom: 1em;\n"],["\n margin-bottom: 1em;\n"])));
2
- //# sourceMappingURL=styled.elements.js.map
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import type { OperationModel, Server } from '../../redoc-lib';
3
- import type { DropdownOption } from '../common/Dropdown';
4
- export interface ServerDropdownProps {
5
- operation: OperationModel;
6
- onChange: (server: Server) => void;
7
- }
8
- export interface ServerDropdownState {
9
- activeIdx: number;
10
- variables?: {
11
- [name: string]: string;
12
- };
13
- }
14
- export declare class ServerChooser extends React.Component<ServerDropdownProps, ServerDropdownState> {
15
- state: {
16
- activeIdx: number;
17
- variables: {};
18
- };
19
- static getDerivedStateFromProps(props: ServerDropdownProps): ServerDropdownState;
20
- handleServerChange: (option: DropdownOption) => void;
21
- handleVariableChange: (name: string, rawValue: string) => void;
22
- componentDidMount(): void;
23
- render(): JSX.Element;
24
- }
@@ -1,2 +0,0 @@
1
- import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{observer}from"mobx-react";import{styled}from"../../redoc-lib";import{fromSessionStorage,toSessionStorage}from"../../utils";import{FormControl,FormLabel}from"../common/form";import{Dropdown}from"../common/Dropdown";import{expandDefaultServerVariables,expandVariables,getServerWithVariables,getDefaultOrStoredVariables,updateVariablesStorage}from"./utils";import ServerVariable from"./ServerVariable";var ServerChooser=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(r,"state",{enumerable:!0,configurable:!0,writable:!0,value:{activeIdx:0,variables:{}}}),Object.defineProperty(r,"handleServerChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var a=r.props.operation.servers.find((function(r){return r.url===e.serverUrl})),t=getDefaultOrStoredVariables(a);r.props.onChange({url:e.serverUrl||"",variables:t}),toSessionStorage("serverUrl",e.serverUrl||""),r.setState({variables:t})}}),Object.defineProperty(r,"handleVariableChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e,a){var t,o=r.props.operation.servers[r.state.activeIdx],n=a||""===a?a:getDefaultOrStoredVariables(o)[e],i=__assign(__assign({},r.state.variables),((t={})[e]=n,t));r.setState({variables:i}),updateVariablesStorage(e,n),r.props.onChange(__assign(__assign({},o),{variables:i}))}}),r}return __extends(r,e),Object.defineProperty(r,"getDerivedStateFromProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.operation,a=fromSessionStorage("serverUrl"),t=r.servers.findIndex((function(e){return e.url===a}));return{activeIdx:t<0?0:t}}}),Object.defineProperty(r.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=getServerWithVariables(this.props.operation.servers,this.state.activeIdx);this.props.onChange(e),this.setState({variables:e.variables})}}),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,r=this.state.activeIdx,a=this.props.operation.servers.map((function(r,a){return{idx:a,serverUrl:r.url,value:"\n "+expandDefaultServerVariables(expandVariables(r.url,e.state.variables),r.variables)+"\n - "+(r.description||"Default")+"\n "}})),t=Object.keys(this.state.variables);return React.createElement(ServerDropdownWrap,null,React.createElement(FormLabel,{htmlFor:"server"},"Target server: "),React.createElement(FormControl,null,React.createElement(Dropdown,{variant:"dark",value:a[r].value,options:a,fullWidth:!0,onChange:this.handleServerChange})),t.length?t.map((function(r){var a,t=null===(a=e.props.operation.servers[e.state.activeIdx].variables)||void 0===a?void 0:a[r];if(t)return React.createElement(ServerVariable,{key:r,name:r,value:e.state.variables[r],defaultValue:t.default,onChange:function(a){return e.handleVariableChange(r,a)},variableEnum:t.enum,description:t.description})})):null)}}),r=__decorate([observer],r)}(React.Component);export{ServerChooser};var templateObject_1,ServerDropdownWrap=styled.div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n margin-top: 20px;\n"],["\n margin-top: 20px;\n"])));
2
- //# sourceMappingURL=ServerDropdown.js.map
@@ -1,2 +0,0 @@
1
- import{__makeTemplateObject}from"tslib";import{FieldsGroupHeader}from"../../common-elements";import styled from"../../styled-components";export var HeadersCaption=styled(FieldsGroupHeader.withComponent("caption"))(templateObject_1||(templateObject_1=__makeTemplateObject(["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"],["\n text-align: left;\n margin-top: 1em;\n caption-side: top;\n"])));export var Wrapper=styled.div(templateObject_2||(templateObject_2=__makeTemplateObject(["\n margin-bottom: 1em;\n"],["\n margin-bottom: 1em;\n"])));var templateObject_1,templateObject_2;
2
- //# sourceMappingURL=styled.elements.js.map