@redocly/reference-docs 2.2.1 → 2.3.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli/commands/redocly-docs-cli.min.js +46 -46
- package/dist/console.redocly-reference-docs.min.js +6 -6
- package/dist/oauth2-redirect.js +2 -2
- package/dist/redocly-reference-docs.min.js +18 -18
- package/lib/components/Endpoint/Endpoint.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/Panel/ResponsePanel.js +1 -1
- package/lib/components/RedoclyReferenceDocs.js +1 -1
- package/lib/components/Search/ProSearchBox.js +1 -1
- package/lib/components/Search/SearchField.js +1 -1
- package/lib/components/StoreProvider.js +1 -1
- package/lib/components/console/CodemirrorInput.d.ts +1 -0
- package/lib/components/console/CodemirrorInput.js +1 -1
- package/lib/components/console/RequestBody.js +1 -1
- package/lib/components/console/ServerDropdown.js +1 -1
- package/lib/redoc-lib/src/common-elements/PrismDiv.js +1 -1
- package/lib/redoc-lib/src/common-elements/dropdown.d.ts +2 -0
- package/lib/redoc-lib/src/common-elements/icons.js +1 -1
- package/lib/redoc-lib/src/common-elements/samples.js +1 -1
- package/lib/redoc-lib/src/components/ContentItems/ContentItems.js +1 -1
- package/lib/redoc-lib/src/components/Markdown/SanitizedMdBlock.js +1 -1
- package/lib/redoc-lib/src/components/Markdown/styled.elements.d.ts +4 -0
- package/lib/redoc-lib/src/components/Markdown/styled.elements.js +1 -1
- package/lib/redoc-lib/src/components/Operation/Operation.d.ts +1 -1
- package/lib/redoc-lib/src/components/Operation/Operation.js +1 -1
- package/lib/redoc-lib/src/components/Schema/ObjectSchema.js +1 -1
- package/lib/redoc-lib/src/components/SearchBox/SearchBox.js +1 -1
- package/lib/redoc-lib/src/components/SideMenu/MenuItem.js +1 -1
- package/lib/redoc-lib/src/components/SideMenu/MenuItems.js +1 -1
- package/lib/redoc-lib/src/components/SideMenu/styled.elements.js +1 -1
- package/lib/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
- package/lib/redoc-lib/src/services/Labels.d.ts +1 -0
- package/lib/redoc-lib/src/services/Labels.js +1 -1
- package/lib/redoc-lib/src/services/MenuBuilder.d.ts +10 -1
- package/lib/redoc-lib/src/services/MenuBuilder.js +1 -1
- package/lib/redoc-lib/src/services/RedocNormalizedOptions.d.ts +18 -1
- package/lib/redoc-lib/src/services/RedocNormalizedOptions.js +1 -1
- package/lib/redoc-lib/src/services/models/Operation.d.ts +3 -0
- package/lib/redoc-lib/src/services/models/Operation.js +1 -1
- package/lib/redoc-lib/src/utils/openapi.d.ts +1 -0
- package/lib/redoc-lib/src/utils/openapi.js +1 -1
- package/lib/services/ProMenu.js +1 -1
- package/lib/services/ProStore.d.ts +8 -26
- package/lib/services/ProStore.js +1 -1
- package/lib/services/history/ProHashHistoryService.js +1 -1
- package/lib/services/history/PushStateHistoryService.js +1 -1
- package/lib/services/store-types.d.ts +4 -2
- package/lib/services/store-types.js +1 -1
- package/lib/standalone.d.ts +4 -0
- package/lib/standalone.js +1 -1
- package/lib-esm/components/Endpoint/Endpoint.js +1 -1
- package/lib-esm/components/Overlay.js +1 -1
- package/lib-esm/components/Panel/ResponsePanel.js +1 -1
- package/lib-esm/components/RedoclyReferenceDocs.js +1 -1
- package/lib-esm/components/Search/ProSearchBox.js +1 -1
- package/lib-esm/components/Search/SearchField.js +1 -1
- package/lib-esm/components/StoreProvider.js +1 -1
- package/lib-esm/components/console/CodemirrorInput.d.ts +1 -0
- package/lib-esm/components/console/CodemirrorInput.js +1 -1
- package/lib-esm/components/console/RequestBody.js +1 -1
- package/lib-esm/components/console/ServerDropdown.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/PrismDiv.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/dropdown.d.ts +2 -0
- package/lib-esm/redoc-lib/src/common-elements/icons.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/samples.js +1 -1
- package/lib-esm/redoc-lib/src/components/ContentItems/ContentItems.js +1 -1
- package/lib-esm/redoc-lib/src/components/Markdown/SanitizedMdBlock.js +1 -1
- package/lib-esm/redoc-lib/src/components/Markdown/styled.elements.d.ts +4 -0
- package/lib-esm/redoc-lib/src/components/Markdown/styled.elements.js +1 -1
- package/lib-esm/redoc-lib/src/components/Operation/Operation.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/Operation/Operation.js +1 -1
- package/lib-esm/redoc-lib/src/components/Schema/ObjectSchema.js +1 -1
- package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.js +1 -1
- package/lib-esm/redoc-lib/src/components/SideMenu/MenuItem.js +1 -1
- package/lib-esm/redoc-lib/src/components/SideMenu/MenuItems.js +1 -1
- package/lib-esm/redoc-lib/src/components/SideMenu/styled.elements.js +1 -1
- package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
- package/lib-esm/redoc-lib/src/services/Labels.d.ts +1 -0
- package/lib-esm/redoc-lib/src/services/Labels.js +1 -1
- package/lib-esm/redoc-lib/src/services/MenuBuilder.d.ts +10 -1
- package/lib-esm/redoc-lib/src/services/MenuBuilder.js +1 -1
- package/lib-esm/redoc-lib/src/services/RedocNormalizedOptions.d.ts +18 -1
- package/lib-esm/redoc-lib/src/services/RedocNormalizedOptions.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/Operation.d.ts +3 -0
- package/lib-esm/redoc-lib/src/services/models/Operation.js +1 -1
- package/lib-esm/redoc-lib/src/utils/openapi.d.ts +1 -0
- package/lib-esm/redoc-lib/src/utils/openapi.js +1 -1
- package/lib-esm/services/ProMenu.js +1 -1
- package/lib-esm/services/ProStore.d.ts +8 -26
- package/lib-esm/services/ProStore.js +1 -1
- package/lib-esm/services/history/ProHashHistoryService.js +1 -1
- package/lib-esm/services/history/PushStateHistoryService.js +1 -1
- package/lib-esm/services/store-types.d.ts +4 -2
- package/lib-esm/services/store-types.js +1 -1
- package/lib-esm/standalone.d.ts +4 -0
- package/lib-esm/standalone.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IValueDidChange } from 'mobx';
|
|
2
|
-
import {
|
|
2
|
+
import { MarkerService, OperationModel, RedocNormalizedOptions, RedocRawOptions, SearchStore, SpecStore } from '../redoc-lib';
|
|
3
3
|
import { ProMenu } from './ProMenu';
|
|
4
4
|
import { SearchResultMeta } from './SearchStore';
|
|
5
5
|
import { ThemeExtension } from './extendTheme';
|
|
@@ -31,7 +31,9 @@ export declare type RedocProUserOptionsExt = {
|
|
|
31
31
|
whiteLabel?: boolean;
|
|
32
32
|
disableErrorBoundary?: boolean;
|
|
33
33
|
hideInfoSection?: boolean;
|
|
34
|
+
hideTagInfo?: boolean;
|
|
34
35
|
pagination?: Pagination;
|
|
36
|
+
markdownItemsPagination?: MarkdownItemsPagination;
|
|
35
37
|
showNextButton?: boolean;
|
|
36
38
|
disableSidebar?: boolean;
|
|
37
39
|
skipBundleAndConvert?: boolean;
|
|
@@ -66,9 +68,7 @@ export declare type RedocProUserOptionsExt = {
|
|
|
66
68
|
};
|
|
67
69
|
searchMaxDepth?: number;
|
|
68
70
|
};
|
|
69
|
-
declare type RedocProOptionsInternalExt = RedocProUserOptionsExt
|
|
70
|
-
markdownItemsPagination?: MarkdownItemsPagination;
|
|
71
|
-
};
|
|
71
|
+
declare type RedocProOptionsInternalExt = RedocProUserOptionsExt;
|
|
72
72
|
export declare type RedocProRawOptions = RedocRawOptions & RedocProUserOptionsExt;
|
|
73
73
|
export declare type RedocProNormalizedOptions = RedocNormalizedOptions & Normalized<RedocProOptionsInternalExt>;
|
|
74
74
|
export interface ProStoreState {
|
|
@@ -86,26 +86,6 @@ export interface ProStoreState {
|
|
|
86
86
|
searchIndexPath?: string;
|
|
87
87
|
searchIndexExport?: string;
|
|
88
88
|
}
|
|
89
|
-
export declare class NestingGroup implements IMenuItem {
|
|
90
|
-
id: string;
|
|
91
|
-
absoluteIdx?: number;
|
|
92
|
-
name: string;
|
|
93
|
-
description?: string;
|
|
94
|
-
type: 'group';
|
|
95
|
-
linkable: boolean;
|
|
96
|
-
items: ContentItemModel[];
|
|
97
|
-
parent?: NestingGroup;
|
|
98
|
-
externalDocs?: OpenAPIExternalDocumentation;
|
|
99
|
-
active: boolean;
|
|
100
|
-
expanded: boolean;
|
|
101
|
-
depth: number;
|
|
102
|
-
level: number;
|
|
103
|
-
constructor(id: string, items: ContentItemModel[], name?: string, linkable?: boolean);
|
|
104
|
-
activate(): void;
|
|
105
|
-
expand(): void;
|
|
106
|
-
collapse(): void;
|
|
107
|
-
deactivate(): void;
|
|
108
|
-
}
|
|
109
89
|
export declare class ProStore {
|
|
110
90
|
rawOptions: RedocProRawOptions;
|
|
111
91
|
options: RedocProNormalizedOptions;
|
|
@@ -126,14 +106,16 @@ export declare class ProStore {
|
|
|
126
106
|
constructor(spec: any | Array<{
|
|
127
107
|
title: string;
|
|
128
108
|
url: string;
|
|
129
|
-
}>, specUrl?: string, options?: RedocProRawOptions,
|
|
109
|
+
}>, specUrl?: string, options?: RedocProRawOptions, ssrHydrate?: boolean);
|
|
130
110
|
initProOptions(options: RedocProRawOptions): void;
|
|
131
111
|
initSearch(options: RedocProNormalizedOptions, createIndex: boolean): void;
|
|
132
112
|
onDidMount(): void;
|
|
133
113
|
toggleRightPanel(value?: boolean): void;
|
|
134
|
-
|
|
114
|
+
disableRightPanel(): void;
|
|
115
|
+
enableRightPanel(): void;
|
|
135
116
|
disableConsole(): void;
|
|
136
117
|
enableConsole(): void;
|
|
118
|
+
toggleLayout(layout?: LayoutVariant): void;
|
|
137
119
|
tryItOut(operation?: OperationModel): void;
|
|
138
120
|
setActiveSampleLanguage(language: string): void;
|
|
139
121
|
activateSampleLanguage: import("lodash").DebouncedFunc<(language: string) => void>;
|
package/lib/services/ProStore.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),lodash_1=require("lodash"),redoc_lib_1=require("../redoc-lib"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),pluggable_1=require("../components/pluggable"),MultipleSpecsStore_1=require("./MultipleSpecsStore"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_1=require("./utils"),utils_2=require("../utils"),store_types_1=require("./store-types"),global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var r=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=r})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}exports.NestingGroup=NestingGroup;var ProStore=function(){function e(e,t,i,o){var r=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new redoc_lib_1.MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:store_types_1.LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dereferencedRawSpec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prevDerefKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:(0,lodash_1.debounce)((function(e){return r.setActiveSampleLanguage(e)}),500)}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(r.menu.items=[],r.menu.flatItems=r.menu.flatItems.slice(0,1),r.menu.renderItems=[])})));var n=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,n||a):new history_1.ProHashHistoryService(this.options,n||a);this.definition=n?new MultipleSpecsStore_1.MultipleSpecsStore(e,this.options):a?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadSpecUrl&&(this.definition.info.downloadLink=i.downloadSpecUrl,this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return r.updateMarkOnMenu(e.newValue)}))})),(0,utils_2.setGlobalStore)(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,r,n;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(r=this.rawOptions.showChangeLayoutButton)||void 0===r||r,this.options.layout=this.rawOptions.layout||store_types_1.LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(n=this.rawOptions)||void 0===n?void 0:n.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser";break;default:this.options.pagination="none",this.options.routingStrategy="hash"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SearchStore_1.SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,r,n=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=n.versions[t.newValue]._searchIndexName;if(redoc_lib_1.IS_BROWSER&&a){var s=n.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(r=i.search)||void 0===r||r.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),redoc_lib_1.IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=(0,utils_2.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_2.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_2.fromStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,(0,utils_2.toStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_2.toLocalStorage)("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,(0,utils_2.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,r,n;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var a,s,l,p,u,c,d,h,b;return(0,tslib_1.__generator)(this,(function(f){switch(f.label){case 0:return(a=e+"/"+t.path+"/"+t.httpVerb)===this.prevDerefKey&&this.dereferencedRawSpec?[2,this.dereferencedRawSpec]:(this.dereferencedRawSpec=void 0,this.prevDerefKey=a,s=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,l=JSON.parse(JSON.stringify(s)),p=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(l)),{components:l.components,paths:(h={},h[t.path]=(b={},b[t.httpVerb]=null===(o=null===(i=l.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],b.parameters=null===(n=null===(r=l.paths)||void 0===r?void 0:r[t.path])||void 0===n?void 0:n.parameters,b),h)}),u=new openapi_core_1.Config({}),c=(0,redoc_lib_1.createParsedDocument)(p),d={config:u,doc:c,dereference:!0},[4,(0,openapi_core_1.bundle)(d)]);case 1:return f.sent(),this.dereferencedRawSpec=l,[2,l]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,r=i;o<r.length;o++){var n=r[o];if("operation"===n.type)for(var a=0,s=n.responses;a<s.length;a++){var l=s[a];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===n.type&&t(n.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.observe)(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);(0,utils_2.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var r=o.menu.flatItems[o.menu.activeItemIdx];if(r&&o.menu.activate(r,!1),!o.options.disableSearch){var n=new URL(window.location.href);n.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:n.pathname+(n.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(n.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore_1.MultipleSpecsStore||this.definition instanceof VersionedSpecStore_1.VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),r=[],n=i;n<o;n++){var a;(a=this.menu.getElementAt(n))&&(a&&r.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&r.push(a));this.marker.addOnly(r),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
1
|
+
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),lodash_1=require("lodash"),redoc_lib_1=require("../redoc-lib"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),pluggable_1=require("../components/pluggable"),MultipleSpecsStore_1=require("./MultipleSpecsStore"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_1=require("./utils"),utils_2=require("../utils"),store_types_1=require("./store-types"),global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!1),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new redoc_lib_1.MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:store_types_1.LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dereferencedRawSpec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prevDerefKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:(0,lodash_1.debounce)((function(e){return n.setActiveSampleLanguage(e)}),500)}),(0,mobx_1.makeObservable)(this),(0,utils_2.setGlobalStore)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r||a):new history_1.ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore_1.MultipleSpecsStore(e,this.options):a?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadSpecUrl&&(this.definition.info.downloadLink=i.downloadSpecUrl,this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,s),"hash"===i.routingStrategy&&o?setTimeout((function(){return n.menu.initOnHistory()})):this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,!o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))}))}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||store_types_1.LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.hideTagInfo=!!this.rawOptions.hideTagInfo,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser";break;default:this.options.pagination="none",this.options.routingStrategy="hash"}this.options.markdownItemsPagination=e.markdownItemsPagination||"none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SearchStore_1.SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),redoc_lib_1.IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=(0,utils_2.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_2.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_2.fromStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,(0,utils_2.toStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"disableRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.showRightPanel=!1,this.options.showRightPanelToggle=!1}}),Object.defineProperty(e.prototype,"enableRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showRightPanelToggle=!0;var e=(0,utils_2.fromStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_2.toLocalStorage)("layoutVariant",e)}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,(0,utils_2.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var a,s,l,p,u,h,c,d,b;return(0,tslib_1.__generator)(this,(function(g){switch(g.label){case 0:return(a=e+"/"+t.path+"/"+t.httpVerb)===this.prevDerefKey&&this.dereferencedRawSpec?[2,this.dereferencedRawSpec]:(this.dereferencedRawSpec=void 0,this.prevDerefKey=a,s=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,l=JSON.parse(JSON.stringify(s)),p=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(l)),{components:l.components,paths:(d={},d[t.path]=(b={},b[t.httpVerb]=null===(o=null===(i=l.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],b.parameters=null===(r=null===(n=l.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,b),d)}),u=new openapi_core_1.Config({}),h=(0,redoc_lib_1.createParsedDocument)(p),c={config:u,doc:h,dereference:!0},[4,(0,openapi_core_1.bundle)(c)]);case 1:return g.sent(),this.dereferencedRawSpec=l,[2,l]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.observe)(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!0);(0,utils_2.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&"hash"!==o.options.routingStrategy&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore_1.MultipleSpecsStore||this.definition instanceof VersionedSpecStore_1.VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
2
2
|
//# sourceMappingURL=ProStore.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProHashHistoryService=void 0;var tslib_1=require("tslib"),decko_1=require("decko"),eventemitter3_1=require("eventemitter3"),redoc_lib_1=require("../../redoc-lib"),helpers_1=require("./helpers"),ProHashHistoryService=function(){function e(e,t){var r=this;Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"multiSpec",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emiter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"basePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:function(){r._emiter.emit("popstate",r.currentId)}});var i=e.routingBasePath||"";this.basePath=i.endsWith("/")?i.substring(0,i.length-1):i,this.basePath.startsWith("/")&&(this.basePath=this.basePath.substring(1)),this._emiter=new eventemitter3_1.EventEmitter,this.bind()}return Object.defineProperty(e.prototype,"currentId",{get:function(){if(!redoc_lib_1.IS_BROWSER)return"";var e=decodeURIComponent(window.location.hash.substr(1)),t=window.location.pathname.substring(1);return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProHashHistoryService=void 0;var tslib_1=require("tslib"),decko_1=require("decko"),eventemitter3_1=require("eventemitter3"),redoc_lib_1=require("../../redoc-lib"),helpers_1=require("./helpers"),ProHashHistoryService=function(){function e(e,t){var r=this;Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"multiSpec",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emiter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"basePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:function(){r._emiter.emit("popstate",r.currentId)}});var i=e.routingBasePath||"";this.basePath=i.endsWith("/")?i.substring(0,i.length-1):i,this.basePath.startsWith("/")&&(this.basePath=this.basePath.substring(1)),this._emiter=new eventemitter3_1.EventEmitter,this.bind()}return Object.defineProperty(e.prototype,"currentId",{get:function(){if(!redoc_lib_1.IS_BROWSER)return"";var e=decodeURIComponent(window.location.hash.substr(1)),t=window.location.pathname.substring(1);return(t.startsWith(this.basePath+"/")||t===this.basePath)&&(t=t.substring(this.basePath.length+1)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),e&&e.startsWith("operation/")?this.multiSpec?t.split("/")[0]+"/"+e:e:t?t+(e?"/"+e:""):e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"makeUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r="";return redoc_lib_1.IS_BROWSER&&(r=window.location.search),(e.startsWith("/")?"/"+(this.basePath?this.basePath+"/":"")+e.substring(1):e)+r+(t?"#"+t:"")}}),Object.defineProperty(e.prototype,"linkForId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)return"";if(""===e)return this.makeUrl("","");var t="";return this.multiSpec&&(t="/"+e.split("/")[0],e=e.split("/").slice(1).join("/")),this.makeUrl(t,e)}}),Object.defineProperty(e.prototype,"generateDeepLink",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t)return t+this.options.deepLinkPrefix+e}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._emiter.addListener("popstate",e);return function(){return t.removeListener("popstate",e)}}}),Object.defineProperty(e.prototype,"bind",{enumerable:!1,configurable:!0,writable:!0,value:function(){redoc_lib_1.IS_BROWSER&&(window.addEventListener("popstate",this.emit,!1),window.addEventListener("hashchange",this.emit,!1))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){redoc_lib_1.IS_BROWSER&&(window.removeEventListener("popstate",this.emit),window.removeEventListener("hashchange",this.emit))}}),Object.defineProperty(e.prototype,"replace",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),t)return this.replaceDebounced(e);this.replaceNow(e,t)}}),Object.defineProperty(e.prototype,"replaceForField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;if(void 0===t&&(t=!1),redoc_lib_1.IS_BROWSER&&e){var i,n=new URL(e,window.location.href);i=n,t?window.history.replaceState(null,"",i):(window.history.pushState(null,"",i),r.emit())}}}),Object.defineProperty(e.prototype,"replaceNow",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),redoc_lib_1.IS_BROWSER&&null!=e&&!(0,helpers_1.isSameHash)(e,this.currentId)){var r=new URL(this.linkForId(e),window.location.href);t?redoc_lib_1.IS_BROWSER&&window.history.replaceState(null,"",r.href):redoc_lib_1.IS_BROWSER&&(window.history.pushState(null,"",r.href),this.emit())}}}),Object.defineProperty(e.prototype,"replaceDebounced",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.replaceNow(e,!0)}}),(0,tslib_1.__decorate)([decko_1.bind],e.prototype,"replace",null),(0,tslib_1.__decorate)([decko_1.bind],e.prototype,"replaceForField",null),(0,tslib_1.__decorate)([decko_1.bind,decko_1.debounce],e.prototype,"replaceDebounced",null),e}();exports.ProHashHistoryService=ProHashHistoryService;
|
|
2
2
|
//# sourceMappingURL=ProHashHistoryService.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushStateHistoryService=void 0;var tslib_1=require("tslib"),decko_1=require("decko"),eventemitter3_1=require("eventemitter3"),redoc_lib_1=require("../../redoc-lib"),helpers_1=require("./helpers"),PushStateHistoryService=function(){function e(e,t){var i=this;Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"multispec",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emiter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"basePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"markdownItemsPagination",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pagination",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:function(){i._emiter.emit("popstate",i.currentId)}});var r=e.routingBasePath;this.markdownItemsPagination=e.markdownItemsPagination,this.pagination=e.pagination,this.basePath=r.endsWith("/")?r.substring(0,r.length-1):r,this.basePath.startsWith("/")&&(this.basePath=this.basePath.substring(1)),this._emiter=new eventemitter3_1.EventEmitter,this.bind()}return Object.defineProperty(e.prototype,"currentId",{get:function(){if(!redoc_lib_1.IS_BROWSER)return"";var e=decodeURIComponent(window.location.hash.substr(1)),t=window.location.pathname.substring(1);return t.startsWith(this.basePath+"/")&&(t=t.substring(this.basePath.length+1)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),e&&e.startsWith("operation/")?(0,helpers_1.joinWithSeparator)(t,e,"/"):t?"item"===this.pagination&&e.startsWith(this.options.deepLinkPrefix)?(0,helpers_1.joinWithSeparator)(t,e,this.options.deepLinkPrefix):(0,helpers_1.joinWithSeparator)(t,e,"/"):e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"makeUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,r="";return redoc_lib_1.IS_BROWSER&&(r=window.location.search),i=e.startsWith("/")?"/"+(0,helpers_1.joinWithSeparator)(this.basePath,e.substring(1),"/"):e,(0,helpers_1.joinWithSeparator)(i+r,t,"#")}}),Object.defineProperty(e.prototype,"generateDeepLink",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return t?t+("item"===this.options.pagination?"#":"")+this.options.deepLinkPrefix+e:null}}),Object.defineProperty(e.prototype,"linkForId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e&&(e=""),""===e)return this.makeUrl("/","");var t="";if(this.multispec&&(t="/"+e.split("/")[0],e=e.split("/").slice(1).join("/")),e.startsWith("operation/")){if(this.multispec&&redoc_lib_1.IS_BROWSER){var i=window.location.pathname.substring(1);i.startsWith(this.basePath)&&(i=i.substring(this.basePath.length)).startsWith("/")&&(i=i.substring(1));var r="/"+i.split("/")[0];return t===r?this.makeUrl("",e):this.makeUrl(i.replace(r,t),e)}return this.makeUrl("",e)}var n,o=t,a="";if(e.startsWith("section/")||!e){var s=(e||"").split("/")[1];s&&"section"===this.markdownItemsPagination?(o=t+"/section/"+s,a=e):(o=t+"/",a=e)}if(e.startsWith("group/")){var l=e.match(/group\/(.*)\/(paths\/.*\/\w+|operation\/[^/]*)/);if(l)o=t+"/group/"+l[1],a=l[2]||"";else o=t+"/"+e,a=""}"section"===this.pagination&&e.startsWith("tag/")&&(o=t+"/"+(n=e.split("/")).slice(0,2).join("/"),a=n.slice(2).join("/"));"item"===this.pagination&&e.startsWith("tag/")&&(o=t+"/"+e,"section"===(n=e.split("/"))[2]&&(o=t+"/"+n.slice(0,2).join("/"),a=n.slice(2).join("/")));return this.makeUrl(o,a)}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._emiter.addListener("popstate",e);return function(){return t.removeListener("popstate",e)}}}),Object.defineProperty(e.prototype,"bind",{enumerable:!1,configurable:!0,writable:!0,value:function(){redoc_lib_1.IS_BROWSER&&window.addEventListener("popstate",this.emit,!1)}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){redoc_lib_1.IS_BROWSER&&window.removeEventListener("popstate",this.emit)}}),Object.defineProperty(e.prototype,"replace",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),t)return this.replaceDebounced(e);this.replaceNow(e,t)}}),Object.defineProperty(e.prototype,"replaceForField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),redoc_lib_1.IS_BROWSER&&e){var i,r=new URL(e,window.location.href);i=r,t&&window.history.replaceState(null,"",i),window.history.pushState(null,"",i),this.emit()}}}),Object.defineProperty(e.prototype,"replaceNow",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),redoc_lib_1.IS_BROWSER&&null!=e&&!(0,helpers_1.isSameHash)(e,this.currentId)){var i=new URL(this.linkForId(e),window.location.href);t?redoc_lib_1.IS_BROWSER&&window.history.replaceState(null,"",i.href):redoc_lib_1.IS_BROWSER&&(window.history.pushState(null,"",i.href),this.emit())}}}),Object.defineProperty(e.prototype,"replaceDebounced",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.replaceNow(e,!0)}}),(0,tslib_1.__decorate)([decko_1.bind],e.prototype,"replace",null),(0,tslib_1.__decorate)([decko_1.bind],e.prototype,"replaceForField",null),(0,tslib_1.__decorate)([decko_1.bind,decko_1.debounce],e.prototype,"replaceDebounced",null),e}();exports.PushStateHistoryService=PushStateHistoryService;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushStateHistoryService=void 0;var tslib_1=require("tslib"),decko_1=require("decko"),eventemitter3_1=require("eventemitter3"),redoc_lib_1=require("../../redoc-lib"),helpers_1=require("./helpers"),PushStateHistoryService=function(){function e(e,t){var i=this;Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"multispec",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emiter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"basePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"markdownItemsPagination",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pagination",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:function(){i._emiter.emit("popstate",i.currentId)}});var r=e.routingBasePath;this.markdownItemsPagination=e.markdownItemsPagination,this.pagination=e.pagination,this.basePath=r.endsWith("/")?r.substring(0,r.length-1):r,this.basePath.startsWith("/")&&(this.basePath=this.basePath.substring(1)),this._emiter=new eventemitter3_1.EventEmitter,this.bind()}return Object.defineProperty(e.prototype,"currentId",{get:function(){if(!redoc_lib_1.IS_BROWSER)return"";var e=decodeURIComponent(window.location.hash.substr(1)),t=decodeURIComponent(window.location.pathname.substring(1));return t.startsWith(this.basePath+"/")&&(t=t.substring(this.basePath.length+1)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),e&&e.startsWith("operation/")?(0,helpers_1.joinWithSeparator)(t,e,"/"):t?"item"===this.pagination&&e.startsWith(this.options.deepLinkPrefix)?(0,helpers_1.joinWithSeparator)(t,e,this.options.deepLinkPrefix):(0,helpers_1.joinWithSeparator)(t,e,"/"):e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"makeUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,r="";return redoc_lib_1.IS_BROWSER&&(r=window.location.search),i=e.startsWith("/")?"/"+(0,helpers_1.joinWithSeparator)(this.basePath,e.substring(1),"/"):e,(0,helpers_1.joinWithSeparator)(i+r,t,"#")}}),Object.defineProperty(e.prototype,"generateDeepLink",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return t?t+("item"===this.options.pagination?"#":"")+this.options.deepLinkPrefix+e:null}}),Object.defineProperty(e.prototype,"linkForId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e&&(e=""),""===e)return this.makeUrl("/","");var t="";if(this.multispec&&(t="/"+e.split("/")[0],e=e.split("/").slice(1).join("/")),e.startsWith("operation/")){if(this.multispec&&redoc_lib_1.IS_BROWSER){var i=window.location.pathname.substring(1);i.startsWith(this.basePath)&&(i=i.substring(this.basePath.length)).startsWith("/")&&(i=i.substring(1));var r="/"+i.split("/")[0];return t===r?this.makeUrl("",e):this.makeUrl(i.replace(r,t),e)}return this.makeUrl("",e)}var n,o=t,a="";if(e.startsWith("section/")||!e){var s=(e||"").split("/")[1];s&&"section"===this.markdownItemsPagination?(o=t+"/section/"+s,a=e):(o=t+"/",a=e)}if(e.startsWith("group/")){var l=e.match(/group\/(.*)\/(paths\/.*\/\w+|operation\/[^/]*)/);if(l)o=t+"/group/"+l[1],a=l[2]||"";else o=t+"/"+e,a=""}"section"===this.pagination&&e.startsWith("tag/")&&(o=t+"/"+(n=e.split("/")).slice(0,2).join("/"),a=n.slice(2).join("/"));"item"===this.pagination&&e.startsWith("tag/")&&(o=t+"/"+e,"section"===(n=e.split("/"))[2]&&(o=t+"/"+n.slice(0,2).join("/"),a=n.slice(2).join("/")));return this.makeUrl(o,a)}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._emiter.addListener("popstate",e);return function(){return t.removeListener("popstate",e)}}}),Object.defineProperty(e.prototype,"bind",{enumerable:!1,configurable:!0,writable:!0,value:function(){redoc_lib_1.IS_BROWSER&&window.addEventListener("popstate",this.emit,!1)}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){redoc_lib_1.IS_BROWSER&&window.removeEventListener("popstate",this.emit)}}),Object.defineProperty(e.prototype,"replace",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),t)return this.replaceDebounced(e);this.replaceNow(e,t)}}),Object.defineProperty(e.prototype,"replaceForField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),redoc_lib_1.IS_BROWSER&&e){var i,r=new URL(e,window.location.href);i=r,t&&window.history.replaceState(null,"",i),window.history.pushState(null,"",i),this.emit()}}}),Object.defineProperty(e.prototype,"replaceNow",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!1),redoc_lib_1.IS_BROWSER&&null!=e&&!(0,helpers_1.isSameHash)(e,this.currentId)){var i=new URL(this.linkForId(e),window.location.href);t?redoc_lib_1.IS_BROWSER&&window.history.replaceState(null,"",i.href):redoc_lib_1.IS_BROWSER&&(window.history.pushState(null,"",i.href),this.emit())}}}),Object.defineProperty(e.prototype,"replaceDebounced",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.replaceNow(e,!0)}}),(0,tslib_1.__decorate)([decko_1.bind],e.prototype,"replace",null),(0,tslib_1.__decorate)([decko_1.bind],e.prototype,"replaceForField",null),(0,tslib_1.__decorate)([decko_1.bind,decko_1.debounce],e.prototype,"replaceDebounced",null),e}();exports.PushStateHistoryService=PushStateHistoryService;
|
|
2
2
|
//# sourceMappingURL=PushStateHistoryService.js.map
|
|
@@ -8,12 +8,13 @@ export declare enum AnalyticsEventType {
|
|
|
8
8
|
OperationServerExpanded = "OperationServerExpanded",
|
|
9
9
|
PanelToggle = "PanelToggle",
|
|
10
10
|
TryItOpen = "TryItOpen",
|
|
11
|
+
LoadingCompleted = "LoadingCompleted",
|
|
11
12
|
TryItSent = "TryItSent"
|
|
12
13
|
}
|
|
13
14
|
export interface AnalyticsEvent {
|
|
14
15
|
eventType: AnalyticsEventType;
|
|
15
|
-
resource: 'Redocly_CodeSample' | 'Redocly_Operation' | 'Redocly_OperationTryIt';
|
|
16
|
-
action: 'LanguageSwitched' | 'PanelToggled' | 'Opened' | 'NavigatedOverrideLink' | 'Sent' | 'ValidationFailed';
|
|
16
|
+
resource: 'Redocly_CodeSample' | 'Redocly_Operation' | 'Redocly_OperationTryIt' | 'Redocly_ReferenceDocs';
|
|
17
|
+
action: 'LanguageSwitched' | 'PanelToggled' | 'Opened' | 'NavigatedOverrideLink' | 'Sent' | 'ValidationFailed' | 'Loaded';
|
|
17
18
|
operationId?: string;
|
|
18
19
|
operationPath: string;
|
|
19
20
|
operationHttpVerb: string;
|
|
@@ -38,5 +39,6 @@ export declare type Events = {
|
|
|
38
39
|
tryItOpen?: (event: TryItOpenedEvent) => void;
|
|
39
40
|
tryItSent?: (event: TryItOpenedEvent) => void;
|
|
40
41
|
panelToggle?: (event: PanelToggleEvent) => void;
|
|
42
|
+
loadingCompleted?: (event: Pick<AnalyticsEvent, 'action' | 'eventType' | 'resource'>) => void;
|
|
41
43
|
};
|
|
42
44
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var LayoutVariant,AnalyticsEventType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.AnalyticsEventType=exports.LayoutVariant=void 0,function(e){e.STACKED="stacked",e.THREE_PANEL="three-panel"}(LayoutVariant=exports.LayoutVariant||(exports.LayoutVariant={})),function(e){e.CodeSampleLanguageSwitched="CodeSampleLanguageSwitched",e.CodeSampleCopied="CodeSampleCopied",e.OperationServerExpanded="OperationServerExpanded",e.PanelToggle="PanelToggle",e.TryItOpen="TryItOpen",e.TryItSent="TryItSent"}(AnalyticsEventType=exports.AnalyticsEventType||(exports.AnalyticsEventType={}));
|
|
1
|
+
"use strict";var LayoutVariant,AnalyticsEventType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.AnalyticsEventType=exports.LayoutVariant=void 0,function(e){e.STACKED="stacked",e.THREE_PANEL="three-panel"}(LayoutVariant=exports.LayoutVariant||(exports.LayoutVariant={})),function(e){e.CodeSampleLanguageSwitched="CodeSampleLanguageSwitched",e.CodeSampleCopied="CodeSampleCopied",e.OperationServerExpanded="OperationServerExpanded",e.PanelToggle="PanelToggle",e.TryItOpen="TryItOpen",e.LoadingCompleted="LoadingCompleted",e.TryItSent="TryItSent"}(AnalyticsEventType=exports.AnalyticsEventType||(exports.AnalyticsEventType={}));
|
|
2
2
|
//# sourceMappingURL=store-types.js.map
|
package/lib/standalone.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ import { LayoutVariant } from './services/store-types';
|
|
|
18
18
|
export { setSecurityDetails, setParameterValue, setSecurityDetailsVariants } from './utils';
|
|
19
19
|
export declare function toggleLayout(layout?: LayoutVariant): void;
|
|
20
20
|
export declare function toggleRightPanel(value?: boolean): void;
|
|
21
|
+
export declare function disableRightPanel(): void;
|
|
22
|
+
export declare function enableRightPanel(): void;
|
|
23
|
+
export declare function disableConsole(): void;
|
|
24
|
+
export declare function enableConsole(): void;
|
|
21
25
|
export declare function hydrate(state: ProStoreState, element?: Element | null): void;
|
|
22
26
|
export declare function init(definitionOrDefinitionUrl: string | any, options?: RedocProRawOptions, element?: Element | null, callback?: () => void): void;
|
|
23
27
|
export declare function setPublicPath(path: string): void;
|
package/lib/standalone.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.revision=exports.version=exports.setPublicPath=exports.init=exports.hydrate=exports.toggleRightPanel=exports.toggleLayout=exports.setSecurityDetailsVariants=exports.setParameterValue=exports.setSecurityDetails=void 0;var tslib_1=require("tslib");require("core-js/es/array/find-index"),require("core-js/es/array/find"),require("core-js/es/array/includes"),require("core-js/es/map"),require("core-js/es/number/is-integer"),require("core-js/es/object/assign"),require("core-js/es/object/entries"),require("core-js/es/object/is"),require("core-js/es/object/values"),require("core-js/es/promise"),require("core-js/es/string/ends-with"),require("core-js/es/string/starts-with"),require("core-js/es/symbol"),require("unfetch/polyfill/index"),require("url-polyfill");var path_1=require("path"),React=(0,tslib_1.__importStar)(require("react")),react_dom_1=require("react-dom"),redoc_lib_1=require("./redoc-lib"),ProStore_1=require("./services/ProStore"),store_types_1=require("./services/store-types"),RedoclyReferenceDocs_1=require("./components/RedoclyReferenceDocs"),utils_1=require("./utils"),utils_2=require("./utils");function toggleLayout(e){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.revision=exports.version=exports.setPublicPath=exports.init=exports.hydrate=exports.enableConsole=exports.disableConsole=exports.enableRightPanel=exports.disableRightPanel=exports.toggleRightPanel=exports.toggleLayout=exports.setSecurityDetailsVariants=exports.setParameterValue=exports.setSecurityDetails=void 0;var tslib_1=require("tslib");require("core-js/es/array/find-index"),require("core-js/es/array/find"),require("core-js/es/array/includes"),require("core-js/es/map"),require("core-js/es/number/is-integer"),require("core-js/es/object/assign"),require("core-js/es/object/entries"),require("core-js/es/object/is"),require("core-js/es/object/values"),require("core-js/es/promise"),require("core-js/es/string/ends-with"),require("core-js/es/string/starts-with"),require("core-js/es/symbol"),require("unfetch/polyfill/index"),require("url-polyfill");var path_1=require("path"),React=(0,tslib_1.__importStar)(require("react")),react_dom_1=require("react-dom"),redoc_lib_1=require("./redoc-lib"),ProStore_1=require("./services/ProStore"),store_types_1=require("./services/store-types"),RedoclyReferenceDocs_1=require("./components/RedoclyReferenceDocs"),utils_1=require("./utils"),utils_2=require("./utils");function toggleLayout(e){var t=(0,utils_1.getGlobalStore)();t&&t.toggleLayout((null!=e?e:t.layout===store_types_1.LayoutVariant.STACKED)?store_types_1.LayoutVariant.THREE_PANEL:store_types_1.LayoutVariant.STACKED)}function toggleRightPanel(e){var t=(0,utils_1.getGlobalStore)();t&&t.toggleRightPanel(e)}function disableRightPanel(){var e=(0,utils_1.getGlobalStore)();e&&(e.showRightPanel=!1,e.options.showRightPanelToggle=!1)}function enableRightPanel(){var e=(0,utils_1.getGlobalStore)();if(e){e.options.showRightPanelToggle=!0;var t=(0,utils_1.fromStorage)("showRightPanelToggleState");t?e.toggleRightPanel("true"===t):e.toggleRightPanel(!0)}}function disableConsole(){var e=(0,utils_1.getGlobalStore)();e&&e.disableConsole()}function enableConsole(){var e=(0,utils_1.getGlobalStore)();e&&e.enableConsole()}Object.defineProperty(exports,"setSecurityDetails",{enumerable:!0,get:function(){return utils_2.setSecurityDetails}}),Object.defineProperty(exports,"setParameterValue",{enumerable:!0,get:function(){return utils_2.setParameterValue}}),Object.defineProperty(exports,"setSecurityDetailsVariants",{enumerable:!0,get:function(){return utils_2.setSecurityDetailsVariants}}),exports.toggleLayout=toggleLayout,exports.toggleRightPanel=toggleRightPanel,exports.disableRightPanel=disableRightPanel,exports.enableRightPanel=enableRightPanel,exports.disableConsole=disableConsole,exports.enableConsole=enableConsole;var url=getJsUrl(),__dirname=url?(0,path_1.dirname)(url)+"/":"";function attributesMap(e){for(var t={},r=e.attributes,o=0;o<r.length;o++){var i=r[o];t[i.name]=i.value}return t}function parseOptionsFromElement(e){var t=attributesMap(e),r={};for(var o in t){r[o.replace(/-(.)/g,(function(e,t){return t.toUpperCase()}))]=t[o]}return r}function hydrate(e,t){void 0===t&&(t=document.querySelector("redoc"));var r=ProStore_1.ProStore.fromJS(e);(0,react_dom_1.hydrate)(React.createElement(RedoclyReferenceDocs_1.RedoclyReferenceDocs,{store:r}),t)}function init(e,t,r,o){if(void 0===t&&(t={}),void 0===r&&(r=(0,redoc_lib_1.querySelector)("redoc")),null===r)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,s;Array.isArray(e)||e&&e.versions?(0,react_dom_1.render)(React.createElement(RedoclyReferenceDocs_1.RedoclyReferenceDocsMultiStandalone,{definitions:e,options:(0,tslib_1.__assign)((0,tslib_1.__assign)({},t),parseOptionsFromElement(r))},["Loading..."]),r,o):("string"==typeof e?i=e:"object"==typeof e&&(s=e),(0,react_dom_1.render)(React.createElement(RedoclyReferenceDocs_1.RedoclyReferenceDocsStandalone,{definition:s,definitionUrl:i,options:(0,tslib_1.__assign)((0,tslib_1.__assign)({},t),parseOptionsFromElement(r))},["Loading..."]),r,o))}function setPublicPath(e){__webpack_public_path__=e}function autoInit(){var e=(0,redoc_lib_1.querySelector)("redoc");if(e){var t=e.getAttribute("spec-url");t&&init(t,{},e)}}function getJsUrl(){var e;if(!redoc_lib_1.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""}}exports.hydrate=hydrate,exports.init=init,exports.setPublicPath=setPublicPath,exports.version=__REDOCLY_API_REFERENCE_VERSION__,exports.revision=__REDOCLY_API_REFERENCE_REVISION__,redoc_lib_1.IS_BROWSER&&setPublicPath(__dirname),autoInit();
|
|
2
2
|
//# sourceMappingURL=standalone.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React,{useState}from"react";import{OptionsConsumer}from"../../redoc-lib/src/components/OptionsProvider";import{StoreConsumer,StoreContext}from"../../redoc-lib/src/components/StoreBuilder";import{Console}from"../console/ConsoleLazy";import{CodePanel}from"../Panel";import{ServerList}from"./ServerList";import{Summary}from"./Summary";import{useContext}from"react";import{AnalyticsEventType}from"../../services/store-types";export var Endpoint=function(e){var t=e.operation,o=e.hideHostname,r=useState(!1),n=r[0],a=r[1],i=useContext(StoreContext),l=function(){var e,o;a(!n),null===(o=null===(e=null==i?void 0:i.options.events)||void 0===e?void 0:e.tryItOpen)||void 0===o||o.call(e,{eventType:AnalyticsEventType.TryItOpen,resource:"Redocly_OperationTryIt",action:(null==i?void 0:i.options.unstable_tryItButtonOverride)?"NavigatedOverrideLink":"Opened",operationId:t.operationId,operationPath:t.path,operationHttpVerb:t.httpVerb,operationSummary:t.description})}
|
|
1
|
+
import React,{useState}from"react";import{OptionsConsumer}from"../../redoc-lib/src/components/OptionsProvider";import{StoreConsumer,StoreContext}from"../../redoc-lib/src/components/StoreBuilder";import{Console}from"../console/ConsoleLazy";import{CodePanel}from"../Panel";import{ServerList}from"./ServerList";import{Summary}from"./Summary";import{useContext}from"react";import{AnalyticsEventType}from"../../services/store-types";export var Endpoint=function(e){var t=e.operation,o=e.hideHostname,r=useState(!1),n=r[0],a=r[1],i=useContext(StoreContext),l=function(){var e,o;a(!n),null===(o=null===(e=null==i?void 0:i.options.events)||void 0===e?void 0:e.tryItOpen)||void 0===o||o.call(e,{eventType:AnalyticsEventType.TryItOpen,resource:"Redocly_OperationTryIt",action:(null==i?void 0:i.options.unstable_tryItButtonOverride)?"NavigatedOverrideLink":"Opened",operationId:t.operationId,operationPath:t.path,operationHttpVerb:t.httpVerb,operationSummary:t.description})},s=function(e){var o=e.toggle,r=e.expanded;return React.createElement(Summary,{operation:t,expanded:r,toggle:o,showConsole:!!(null==i?void 0:i.options.showConsole),onToggleConsole:l,tryItOverride:null==i?void 0:i.options.unstable_tryItButtonOverride})};return React.createElement(React.Fragment,null,n?React.createElement(StoreConsumer,null,(function(e){return React.createElement(Console,{store:e,operation:t,onClose:l})})):React.createElement(OptionsConsumer,null,(function(e){return React.createElement(CodePanel,{header:s,collapsed:!e.expandServers},React.createElement(ServerList,{operation:t,expandVariables:e.expandDefaultServerVariables,hideHostname:o||e.hideHostname}))})))};
|
|
2
2
|
//# sourceMappingURL=Endpoint.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter,__generator,__makeTemplateObject}from"tslib";import*as React from"react";import{styled}from"../redoc-lib";var INVALID_KEY="Invalid license key",INVALID_KEY_MISSING=INVALID_KEY+": missing key",EXPIRED="Invalid license key: expired",TRIAL_EXPIRED=EXPIRED,INVALID_HOST="Invalid license key: host not allowed";export var Overlay=function(e){var n=e.l,t=React.useState(null),a=t[0],i=t[1],
|
|
1
|
+
import{__awaiter,__generator,__makeTemplateObject}from"tslib";import*as React from"react";import{StoreContext,styled}from"../redoc-lib";var INVALID_KEY="Invalid license key",INVALID_KEY_MISSING=INVALID_KEY+": missing key",EXPIRED="Invalid license key: expired",TRIAL_EXPIRED=EXPIRED,INVALID_HOST="Invalid license key: host not allowed";export var Overlay=function(e){var n=e.l,t=React.useState(null),a=t[0],i=t[1],r=React.useState(-1),l=r[0],o=r[1],c=React.useState(!1),s=c[0],d=c[1],m=React.useContext(StoreContext);if(React.useEffect((function(){__awaiter(void 0,void 0,void 0,(function(){var e,t;return __generator(this,(function(a){switch(a.label){case 0:return[4,n];case 1:return(e=a.sent()).local?(d(!0),[2]):(e.valid?e.allowed?e.expired&&i(e.t?EXPIRED:TRIAL_EXPIRED):i(INVALID_HOST):i(!1===e.valid?INVALID_KEY+(e.cryptoMissing?": works only with https":""):INVALID_KEY_MISSING),e.t&&o(Math.ceil(((null!==(t=null==e?void 0:e.e)&&void 0!==t?t:0)-Date.now()/1e3)/60/60/24)),[2])}}))}))}),[n]),s)return React.createElement(TrialWrap,null,React.createElement("a",{href:"https://redoc.ly"},"Redocly API reference docs")," preview");if(!a&&l>-1)return React.createElement(TrialWrap,null," Trial version: ",l," days remaining ");var p=(null==m?void 0:m.options.customLicenseErrorMessage)?React.createElement("div",{dangerouslySetInnerHTML:{__html:m.options.customLicenseErrorMessage}}):React.createElement(React.Fragment,null,a," ",React.createElement("br",null),React.createElement("small",null,"Please contact ",React.createElement("a",{href:"mailto:team@redoc.ly"},"team@redoc.ly")," to remedy the problem."," "));return a?React.createElement(Flash,null,React.createElement("span",null,p)):null};var templateObject_1,templateObject_2,TrialWrap=styled.div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n padding: 10px 40px;\n position: fixed;\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: orange;\n z-index: 10;\n opacity: 0.6;\n\n > a,\n a:visited {\n color: orange;\n }\n"],["\n padding: 10px 40px;\n position: fixed;\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: orange;\n z-index: 10;\n opacity: 0.6;\n\n > a,\n a:visited {\n color: orange;\n }\n"]))),Flash=styled.div(templateObject_2||(templateObject_2=__makeTemplateObject(["\n font-size: 1.5em;\n position: fixed;\n z-index: 100;\n background: rgba(38, 50, 56, 0.93);\n margin: 0;\n padding: 1em;\n width: 100%;\n color: white;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n\n text-align: center;\n box-sizing: border-box;\n\n > span {\n display: inline-block;\n line-height: 1.5;\n }\n\n a,\n a:hover,\n a:visited {\n color: white;\n }\n"],["\n font-size: 1.5em;\n position: fixed;\n z-index: 100;\n background: rgba(38, 50, 56, 0.93);\n margin: 0;\n padding: 1em;\n width: 100%;\n color: white;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n\n text-align: center;\n box-sizing: border-box;\n\n > span {\n display: inline-block;\n line-height: 1.5;\n }\n\n a,\n a:hover,\n a:visited {\n color: white;\n }\n"])));
|
|
2
2
|
//# sourceMappingURL=Overlay.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject}from"tslib";import styled from"../../redoc-lib/src/styled-components";import{FieldsGroupHeader,ShelfIcon}from"../../redoc-lib/src/common-elements";import{Panel}from"./Panel";import{Header}from"./Header";import{Trigger}from"./Trigger";import{Title}from"./Title";export var ResponsePanel=styled(Panel)(templateObject_1||(templateObject_1=__makeTemplateObject(["\n border: 1px solid ",";\n background-color: ",";\n\n > "," {\n padding: 10px 20px;\n font-size: 14px;\n line-height: 20px;\n\n "," {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: normal;\n color: ",";\n\n span +
|
|
1
|
+
import{__makeTemplateObject}from"tslib";import styled from"../../redoc-lib/src/styled-components";import{FieldsGroupHeader,ShelfIcon}from"../../redoc-lib/src/common-elements";import{StyledMarkdownSpan}from"../../redoc-lib/src/components/Markdown/styled.elements";import{Panel}from"./Panel";import{Header}from"./Header";import{Trigger}from"./Trigger";import{Title}from"./Title";export var ResponsePanel=styled(Panel)(templateObject_1||(templateObject_1=__makeTemplateObject(["\n border: 1px solid ",";\n background-color: ",";\n\n > "," {\n padding: 10px 20px;\n font-size: 14px;\n line-height: 20px;\n white-space: normal;\n\n "," {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: normal;\n color: ",";\n\n > span + "," > p:first-child {\n margin-left: 4px;\n display: inline;\n }\n }\n\n "," {\n flex: 1;\n max-width: 100%;\n justify-content: space-between;\n }\n\n "," {\n fill: ",";\n }\n }\n\n "," {\n &:first-child {\n margin-top: 0;\n }\n }\n"],["\n border: 1px solid ",";\n background-color: ",";\n\n > "," {\n padding: 10px 20px;\n font-size: 14px;\n line-height: 20px;\n white-space: normal;\n\n "," {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: normal;\n color: ",";\n\n > span + "," > p:first-child {\n margin-left: 4px;\n display: inline;\n }\n }\n\n "," {\n flex: 1;\n max-width: 100%;\n justify-content: space-between;\n }\n\n "," {\n fill: ",";\n }\n }\n\n "," {\n &:first-child {\n margin-top: 0;\n }\n }\n"])),(function(n){var e=n.theme,r=n.type;return e.colors.responses[r].borderColor}),(function(n){var e=n.theme,r=n.type;return e.colors.responses[r].backgroundColor}),Header,Title,(function(n){var e=n.theme,r=n.type;return e.colors.responses[r].color||e.colors.text.primary}),StyledMarkdownSpan,Trigger,ShelfIcon,(function(n){return n.theme.colors.text.primary}),FieldsGroupHeader);var templateObject_1;
|
|
2
2
|
//# sourceMappingURL=ResponsePanel.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{observer}from"mobx-react";import{configure,reaction}from"mobx";import{ApiInfo,ApiLogo,argValueToBoolean,ContentItems,createGlobalStyle,ErrorBoundary,Loading,mediaCSS,MiddlePanel,RedocNormalizedOptions,RightPanel,SideMenu,StickyResponsiveSidebar,ZERO_BREAKPOINT}from"../redoc-lib";import{ProSearchBox,SearchField}from"./Search";import{ContinueButton}from"./NextSectionButton";import{ProStoreProvider}from"./StoreProvider";import{LayoutVariant}from"../services/store-types";import{Console}from"./console/ConsoleLazy";import{MultipleSpecsStore}from"../services/MultipleSpecsStore";import{ProProviders}from"./ProProviders";import{Overlay}from"./Overlay";import{VersionedSpecStore}from"../services/VersionedSpecStore";import{VersionSwitcher}from"./VersionSwitcher";import{BackgroundStub,BackgroundStubFix,RedocWrap,ApiContentWrap,NextSectionButtonWrap,ToggleRightPanelButton,ChangeViewButton,ControlsWrap}from"./styled.elements";configure({useProxies:"ifavailable"});export var CssFixes=createGlobalStyle(templateObject_1||(templateObject_1=__makeTemplateObject(['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"],['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"])),RightPanel,(function(e){var t,n=e.theme,o=e.showRightPanel,r=e.layout;return mediaCSS({width:r===LayoutVariant.STACKED?"100%":"",paddingLeft:r===LayoutVariant.STACKED?n.spacing.sectionHorizontal:"",display:o?"":(t={},t[ZERO_BREAKPOINT]="",t[n.rightPanel.showAtBreakpoint]="none",t)})}),BackgroundStub,BackgroundStubFix,(function(e){var t,n=e.theme,o=e.showRightPanel,r=e.layout;return mediaCSS({display:o&&r!==LayoutVariant.STACKED?"":(t={},t[ZERO_BREAKPOINT]="",t[n.rightPanel.showAtBreakpoint]="none",t)})}),MiddlePanel,NextSectionButtonWrap,(function(e){var t,n=e.theme,o=e.showRightPanel,r=e.layout;return mediaCSS({paddingRight:r===LayoutVariant.STACKED?n.spacing.sectionHorizontal:"",width:o&&r===LayoutVariant.THREE_PANEL?"":(t={},t[ZERO_BREAKPOINT]="",t[n.rightPanel.showAtBreakpoint]="100%",t)})}),ApiContentWrap,(function(e){var t,n,o=e.theme,r=e.showRightPanel,a=e.layout;return mediaCSS({width:(t={},t[ZERO_BREAKPOINT]="none",t.small="calc(100% - "+o.sidebar.width+")",t),maxWidth:__assign((n={},n[ZERO_BREAKPOINT]="",n),o.layout[a===LayoutVariant.THREE_PANEL&&r?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED].maxWidth)})}));var RedoclyReferenceDocs=function(e){function t(t){var n=e.call(this,t)||this;return Object.defineProperty(n,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_updatedItems",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(n,"rootElementRef",{enumerable:!0,configurable:!0,writable:!0,value:React.createRef()}),Object.defineProperty(n,"handleClose",{enumerable:!0,configurable:!0,writable:!0,value:function(){return n.props.store.tryItOut()}}),n.state={searchPopUpShown:!1,searchPopUpValue:""},n}return __extends(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.props.store.onDidMount(),this._observer=reaction((function(){return e.props.store.menu.renderItems}),(function(){e._updatedItems=!0}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._updatedItems&&(this._updatedItems=!1,this.props.store.menu.scrollToActive())}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.props.store.dispose(),this._observer()}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props.store,n=t.definition,o=t.menu,r=t.options,a=t.search,i=t.marker,
|
|
1
|
+
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{observer}from"mobx-react";import{configure,reaction}from"mobx";import{ApiInfo,ApiLogo,argValueToBoolean,ContentItems,createGlobalStyle,ErrorBoundary,Loading,mediaCSS,MiddlePanel,RedocNormalizedOptions,RightPanel,SideMenu,StickyResponsiveSidebar,ZERO_BREAKPOINT}from"../redoc-lib";import{ProSearchBox,SearchField}from"./Search";import{ContinueButton}from"./NextSectionButton";import{ProStoreProvider}from"./StoreProvider";import{LayoutVariant}from"../services/store-types";import{Console}from"./console/ConsoleLazy";import{MultipleSpecsStore}from"../services/MultipleSpecsStore";import{ProProviders}from"./ProProviders";import{Overlay}from"./Overlay";import{VersionedSpecStore}from"../services/VersionedSpecStore";import{VersionSwitcher}from"./VersionSwitcher";import{BackgroundStub,BackgroundStubFix,RedocWrap,ApiContentWrap,NextSectionButtonWrap,ToggleRightPanelButton,ChangeViewButton,ControlsWrap}from"./styled.elements";configure({useProxies:"ifavailable"});export var CssFixes=createGlobalStyle(templateObject_1||(templateObject_1=__makeTemplateObject(['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"],['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"])),RightPanel,(function(e){var t,n=e.theme,o=e.showRightPanel,r=e.layout;return mediaCSS({width:r===LayoutVariant.STACKED?"100%":"",paddingLeft:r===LayoutVariant.STACKED?n.spacing.sectionHorizontal:"",display:o?"":(t={},t[ZERO_BREAKPOINT]="",t[n.rightPanel.showAtBreakpoint]="none",t)})}),BackgroundStub,BackgroundStubFix,(function(e){var t,n=e.theme,o=e.showRightPanel,r=e.layout;return mediaCSS({display:o&&r!==LayoutVariant.STACKED?"":(t={},t[ZERO_BREAKPOINT]="",t[n.rightPanel.showAtBreakpoint]="none",t)})}),MiddlePanel,NextSectionButtonWrap,(function(e){var t,n=e.theme,o=e.showRightPanel,r=e.layout;return mediaCSS({paddingRight:r===LayoutVariant.STACKED?n.spacing.sectionHorizontal:"",width:o&&r===LayoutVariant.THREE_PANEL?"":(t={},t[ZERO_BREAKPOINT]="",t[n.rightPanel.showAtBreakpoint]="100%",t)})}),ApiContentWrap,(function(e){var t,n,o=e.theme,r=e.showRightPanel,a=e.layout;return mediaCSS({width:(t={},t[ZERO_BREAKPOINT]="none",t.small="calc(100% - "+o.sidebar.width+")",t),maxWidth:__assign((n={},n[ZERO_BREAKPOINT]="",n),o.layout[a===LayoutVariant.THREE_PANEL&&r?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED].maxWidth)})}));var RedoclyReferenceDocs=function(e){function t(t){var n=e.call(this,t)||this;return Object.defineProperty(n,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_updatedItems",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(n,"rootElementRef",{enumerable:!0,configurable:!0,writable:!0,value:React.createRef()}),Object.defineProperty(n,"handleClose",{enumerable:!0,configurable:!0,writable:!0,value:function(){return n.props.store.tryItOut()}}),n.state={searchPopUpShown:!1,searchPopUpValue:""},n}return __extends(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.props.store.onDidMount(),this._observer=reaction((function(){return e.props.store.menu.renderItems}),(function(){e._updatedItems=!0}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._updatedItems&&(this._updatedItems=!1,this.props.store.menu.scrollToActive())}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this.props.store.dispose(),null===(e=this._observer)||void 0===e||e.call(this)}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props.store,n=t.definition,o=t.menu,r=t.options,a=t.search,i=t.marker,l=this.props.store,c=o.renderItems,s=!r.hideInfoSection&&("none"===r.pagination||l.menu.activeRenderItemIdx<=0);return s&&"none"!==r.pagination&&r.disableSidebar&&c[0]&&"section"!==c[0].type&&(s=!1),n instanceof MultipleSpecsStore&&(s=!1),this.props._forceRenderInfo&&(s=!0),React.createElement(ProProviders,{store:l},React.createElement(RedocWrap,{className:"redoc-wrap",ref:this.rootElementRef},React.createElement(Overlay,{l:l.l}),React.createElement(CssFixes,{whiteLabel:r.whiteLabel,showRightPanel:l.showRightPanel,layout:l.layout}),l.tryItOperation&&React.createElement(Console,{rootElement:this.rootElementRef.current,store:l,operation:l.tryItOperation,onClose:this.handleClose,specIdx:l.tryItOperation.specIdx}),!r.disableSidebar&&React.createElement(StickyResponsiveSidebar,{menu:o,className:"menu-content"},!l.options.hideLogo&&React.createElement(ApiLogo,{info:n.info}),n instanceof VersionedSpecStore&&React.createElement(VersionSwitcher,{spec:n,onChange:function(e){n.changeVersion(e.idx),o.updateItemsByVersionChange(!0),l.tryItOut(void 0)}}),!l.options.disableSearch&&React.createElement(SearchField,{showPopUp:function(){return e.setState({searchPopUpShown:!0})},searchValue:this.state.searchPopUpValue,marker:i,setSearchValue:function(t){return e.setState({searchPopUpValue:t})}}),React.createElement(SideMenu,{menu:o})),React.createElement(ApiContentWrap,{className:(l.isLoading?"loading ":"")+"api-content",layout:l.layout===LayoutVariant.THREE_PANEL&&l.showRightPanel?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED},r.theme.layout.showDarkRightPanel&&l.showRightPanel&&l.layout!==LayoutVariant.STACKED&&React.createElement(BackgroundStub,null),s&&React.createElement(ApiInfo,{store:l}),React.createElement(ContentItems,{items:c,store:l}),r.showNextButton&&React.createElement(ContinueButton,{pagination:r.pagination,menu:o}),this.props.children),React.createElement(ControlsWrap,null,React.createElement(ToggleRightPanelButton,{store:l,isVisible:l.layout===LayoutVariant.THREE_PANEL}),React.createElement(ChangeViewButton,{store:l,isVisible:l.showRightPanel})),React.createElement(ProSearchBox,{search:a,marker:i,menu:o,onActivate:o.activateAndScroll.bind(o),options:r,shown:this.state.searchPopUpShown,hidePopUp:function(){return e.setState({searchPopUpShown:!1})},showPopUp:function(){return e.setState({searchPopUpShown:!0})},setSearchValue:function(t){return e.setState({searchPopUpValue:t})},searchValue:this.state.searchPopUpValue}),r.theme.layout.showDarkRightPanel&&l.showRightPanel&&l.layout!==LayoutVariant.STACKED&&React.createElement(BackgroundStubFix,null)))}}),t=__decorate([observer],t)}(React.Component);export{RedoclyReferenceDocs};export function RedoclyReferenceDocsStandalone(e){var t=e.definition,n=e.definitionUrl,o=e.options,r=void 0===o?{}:o,a=e.activeItemId,i=e.activeSampleLanguage,l=e.activeDeepLink,c=argValueToBoolean(r.hideLoading,!1),s=new RedocNormalizedOptions(r),u=React.createElement(ProStoreProvider,{definition:t,definitionUrl:n,options:r,activeItemId:a,activeSampleLanguage:i,activeDeepLink:l},(function(e){var t=e.loading,n=e.store;return t?c?null:React.createElement(Loading,{color:s.theme.colors.primary.main}):React.createElement(RedoclyReferenceDocs,{store:n})}));return r.disableErrorBoundary?u:React.createElement(ErrorBoundary,null,u)}var templateObject_1,RedoclyReferenceDocsMultiStandalone=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props,t=e.definitions,n=e.options,o=void 0===n?{}:n,r=argValueToBoolean(o.hideLoading,!1),a=new RedocNormalizedOptions(o);return React.createElement(ErrorBoundary,null,React.createElement(ProStoreProvider,{definitions:t,options:o},(function(e){var t=e.loading,n=e.store;return t?r?null:React.createElement(Loading,{color:a.theme.colors.primary.main}):React.createElement(RedoclyReferenceDocs,{store:n})})))}}),t}(React.Component);export{RedoclyReferenceDocsMultiStandalone};
|
|
2
2
|
//# sourceMappingURL=RedoclyReferenceDocs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__extends}from"tslib";import*as React from"react";import hotkeys from"hotkeys-js";import{debounce}from"../../utils";import{PerfectScrollbarWrap}from"../../redoc-lib/src/common-elements/perfect-scrollbar";import{MenuItemPro}from"./MenuItemProSearch";import{SearchPopUpBG,SearchPopUpWrap,SearchPopUpHeader,TextContainer,SearchResultsBox,SearchResultsItems,ButtonClose,ButtonClear,CrossIcon,SearchIcon,SearchInput}from"./styled";function expandDeep(e,t){if(e)for(var r=function(e){var r=t.find((function(t){return t.name===e}));if(!r)return"break";r.expand(),t=getFields(r.schema)},a=0,n=e;a<n.length;a++){if("break"===r(n[a]))break}}function getFields(e){return e?e.oneOf?getFields(e.oneOf[e.activeOneOf]):e.items?getFields(e.items):e.fields||[]:[]}function enhanceResults(e,t){var r={};e.forEach((function(e){var a=e.meta,n=e.score,o=a.menuId,l=r[o];if(n=a.boost?n*a.boost:n,l){if(l.score=Math.max(n,l.score),a.place&&l.count++,a.place){var i=l.places.find((function(e){return e.place===a.place}));i&&a.path?i.paths.find((function(e){var t;return(e&&e.join("->"))===(null===(t=a.path)||void 0===t?void 0:t.join("->"))}))||i.paths.push(a.path):l.places.push({place:a.place,paths:[a.path]})}}else r[o]={item:t(o),places:a.place?[{place:a.place,paths:[a.path]}]:[],score:n,count:a.place?1:0}}));var a=Object.keys(r).map((function(e){return r[e]}));return a.forEach((function(e,t){return e.index=t})),a.sort((function(e,t){return t.score-e.score})),a}function expandResults(e){for(var t=function(t){if("request fields"===t.place)for(var r=e.item.requestBody,a=getFields(r&&r.content&&r.content.active&&r.content.active.schema),n=0,o=t.paths;n<o.length;n++){if(!(u=o[n]))return{value:void 0};expandDeep(u.slice(0,u.length-1),a)}else if(t.place.startsWith("response ")){var l=t.place.split(" ")[1],i=e.item.responses.find((function(e){return e.code===l}));i&&(i.expanded=!0);a=getFields(i&&i.content&&i.content.active&&i.content.active.schema);for(var c=0,s=t.paths;c<s.length;c++){var u;if(!(u=s[c]))return{value:void 0};expandDeep(u.slice(0,u.length-1),a)}}},r=0,a=e.places;r<a.length;r++){var n=t(a[r]);if("object"==typeof n)return n.value}}var ProSearchBox=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"activeItemRef",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"prevCancel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"loadingTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"inputRef",{enumerable:!0,configurable:!0,writable:!0,value:React.createRef()}),Object.defineProperty(r,"clear",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.setState({results:null,term:"",activeItemIdx:-1}),r.props.setSearchValue(""),r.props.marker.unmark()}}),Object.defineProperty(r,"handleKeyDown",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(27===e.keyCode&&r.inputRef.current&&(r.inputRef.current.blur(),r.props.hidePopUp()),r.state.results&&(27===e.keyCode&&r.clear(),40===e.keyCode&&(r.setState({activeItemIdx:Math.min(r.state.activeItemIdx+1,r.state.results.length-1)}),e.preventDefault()),38===e.keyCode&&(r.setState({activeItemIdx:Math.max(0,r.state.activeItemIdx-1)}),e.preventDefault()),13===e.keyCode)){var t=r.state.results[r.state.activeItemIdx];t&&r.onActivate(t)}}}),Object.defineProperty(r,"_queryWorker",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e,t){r.props.search.search(e).then((function(e){t(e)}))}),200,!0)}),Object.defineProperty(r,"search",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.target.value;if(t.length<3)return r.clearResults(t),void r.props.setSearchValue("");r.updateSearchTerm(t),r.prevCancel&&r.prevCancel(),r.prevCancel=r.queryWorker(t)}}),Object.defineProperty(r,"onActivate",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(r.props.hidePopUp(),r.props.onActivate(e.item),r.props.options.searchAutoExpand)try{expandResults(e)}catch(e){console.warn("Failed to autoexpand schema:",e.message)}}}),Object.defineProperty(r,"closeByWrapper",{enumerable:!0,configurable:!0,writable:!0,value:function(e){"search"===e.target.getAttribute("role")&&(r.clear(),r.props.hidePopUp())}}),Object.defineProperty(r,"closeByButton",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.clear(),r.props.hidePopUp()}}),r.state={results:null,term:"",activeItemIdx:-1,loading:!1},r}return __extends(t,e),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.props,r=t.search,a=t.shown,n=t.searchValue,o=e.search!==r,l=!e.shown&&a&&!n&&this.state.term;(o||l)&&this.clearResults("")}}),Object.defineProperty(t.prototype,"clearResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.setState({results:null,term:e,loading:!1}),this.props.marker.unmark()}}),Object.defineProperty(t.prototype,"setResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.setState({results:enhanceResults(e,this.props.menu.getItemById),loading:!1})}}),Object.defineProperty(t.prototype,"updateSearchTerm",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.setState({term:e}),this.props.setSearchValue(e),this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.loadingTimer=setTimeout((function(){t.setState({loading:!0})}),500),this.props.marker.mark(e)}}),Object.defineProperty(t.prototype,"queryWorker",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=!1;return this._queryWorker(e,(function(a){e.length<3&&t.clearResults(e),r||t.state.term===e&&t.setResults(a)})),function(){r=!0}}}),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.props.options.ctrlFHijack&&hotkeys("cmd+f,ctrl+f",(function(t){return t.preventDefault(),t.stopPropagation(),e.props.options.disableSearch||e.props.showPopUp(),!1}))}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){hotkeys.unbind("cmd+f,ctrl+f")}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.state,r=t.activeItemIdx,a=t.loading,n=t.results,o=this.props,
|
|
1
|
+
import{__extends}from"tslib";import*as React from"react";import hotkeys from"hotkeys-js";import{debounce}from"../../utils";import{PerfectScrollbarWrap}from"../../redoc-lib/src/common-elements/perfect-scrollbar";import{MenuItemPro}from"./MenuItemProSearch";import{SearchPopUpBG,SearchPopUpWrap,SearchPopUpHeader,TextContainer,SearchResultsBox,SearchResultsItems,ButtonClose,ButtonClear,CrossIcon,SearchIcon,SearchInput}from"./styled";import{l}from"../../redoc-lib/src/services/Labels";function expandDeep(e,t){if(e)for(var r=function(e){var r=t.find((function(t){return t.name===e}));if(!r)return"break";r.expand(),t=getFields(r.schema)},a=0,n=e;a<n.length;a++){if("break"===r(n[a]))break}}function getFields(e){return e?e.oneOf?getFields(e.oneOf[e.activeOneOf]):e.items?getFields(e.items):e.fields||[]:[]}function enhanceResults(e,t){var r={};e.forEach((function(e){var a=e.meta,n=e.score,o=a.menuId,l=r[o];if(n=a.boost?n*a.boost:n,l){if(l.score=Math.max(n,l.score),a.place&&l.count++,a.place){var i=l.places.find((function(e){return e.place===a.place}));i&&a.path?i.paths.find((function(e){var t;return(e&&e.join("->"))===(null===(t=a.path)||void 0===t?void 0:t.join("->"))}))||i.paths.push(a.path):l.places.push({place:a.place,paths:[a.path]})}}else r[o]={item:t(o),places:a.place?[{place:a.place,paths:[a.path]}]:[],score:n,count:a.place?1:0}}));var a=Object.keys(r).map((function(e){return r[e]}));return a.forEach((function(e,t){return e.index=t})),a.sort((function(e,t){return t.score-e.score})),a}function expandResults(e){for(var t=function(t){if("request fields"===t.place)for(var r=e.item.requestBody,a=getFields(r&&r.content&&r.content.active&&r.content.active.schema),n=0,o=t.paths;n<o.length;n++){if(!(u=o[n]))return{value:void 0};expandDeep(u.slice(0,u.length-1),a)}else if(t.place.startsWith("response ")){var l=t.place.split(" ")[1],i=e.item.responses.find((function(e){return e.code===l}));i&&(i.expanded=!0);a=getFields(i&&i.content&&i.content.active&&i.content.active.schema);for(var c=0,s=t.paths;c<s.length;c++){var u;if(!(u=s[c]))return{value:void 0};expandDeep(u.slice(0,u.length-1),a)}}},r=0,a=e.places;r<a.length;r++){var n=t(a[r]);if("object"==typeof n)return n.value}}var ProSearchBox=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"activeItemRef",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"prevCancel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"loadingTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"inputRef",{enumerable:!0,configurable:!0,writable:!0,value:React.createRef()}),Object.defineProperty(r,"clear",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.setState({results:null,term:"",activeItemIdx:-1}),r.props.setSearchValue(""),r.props.marker.unmark()}}),Object.defineProperty(r,"handleKeyDown",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(27===e.keyCode&&r.inputRef.current&&(r.inputRef.current.blur(),r.props.hidePopUp()),r.state.results&&(27===e.keyCode&&r.clear(),40===e.keyCode&&(r.setState({activeItemIdx:Math.min(r.state.activeItemIdx+1,r.state.results.length-1)}),e.preventDefault()),38===e.keyCode&&(r.setState({activeItemIdx:Math.max(0,r.state.activeItemIdx-1)}),e.preventDefault()),13===e.keyCode)){var t=r.state.results[r.state.activeItemIdx];t&&r.onActivate(t)}}}),Object.defineProperty(r,"_queryWorker",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e,t){r.props.search.search(e).then((function(e){t(e)}))}),200,!0)}),Object.defineProperty(r,"search",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.target.value;if(t.length<3)return r.clearResults(t),void r.props.setSearchValue("");r.updateSearchTerm(t),r.prevCancel&&r.prevCancel(),r.prevCancel=r.queryWorker(t)}}),Object.defineProperty(r,"onActivate",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(r.props.hidePopUp(),r.props.onActivate(e.item),r.props.options.searchAutoExpand)try{expandResults(e)}catch(e){console.warn("Failed to autoexpand schema:",e.message)}}}),Object.defineProperty(r,"closeByWrapper",{enumerable:!0,configurable:!0,writable:!0,value:function(e){"search"===e.target.getAttribute("role")&&(r.clear(),r.props.hidePopUp())}}),Object.defineProperty(r,"closeByButton",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.clear(),r.props.hidePopUp()}}),r.state={results:null,term:"",activeItemIdx:-1,loading:!1},r}return __extends(t,e),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.props,r=t.search,a=t.shown,n=t.searchValue,o=e.search!==r,l=!e.shown&&a&&!n&&this.state.term;(o||l)&&this.clearResults("")}}),Object.defineProperty(t.prototype,"clearResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.setState({results:null,term:e,loading:!1}),this.props.marker.unmark()}}),Object.defineProperty(t.prototype,"setResults",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.setState({results:enhanceResults(e,this.props.menu.getItemById),loading:!1})}}),Object.defineProperty(t.prototype,"updateSearchTerm",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.setState({term:e}),this.props.setSearchValue(e),this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.loadingTimer=setTimeout((function(){t.setState({loading:!0})}),500),this.props.marker.mark(e)}}),Object.defineProperty(t.prototype,"queryWorker",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=!1;return this._queryWorker(e,(function(a){e.length<3&&t.clearResults(e),r||t.state.term===e&&t.setResults(a)})),function(){r=!0}}}),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.props.options.ctrlFHijack&&hotkeys("cmd+f,ctrl+f",(function(t){return t.preventDefault(),t.stopPropagation(),e.props.options.disableSearch||e.props.showPopUp(),!1}))}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){hotkeys.unbind("cmd+f,ctrl+f")}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.state,r=t.activeItemIdx,a=t.loading,n=t.results,o=this.props,i=o.shown,c=o.menu;return i?React.createElement(SearchPopUpBG,{role:"search",onClick:this.closeByWrapper},React.createElement(SearchPopUpWrap,null,React.createElement(SearchPopUpHeader,null,React.createElement(SearchInput,{ref:this.inputRef,value:this.state.term,onKeyDown:this.handleKeyDown,placeholder:l("search")+"...",type:"text",onChange:this.search,autoFocus:!0}),React.createElement(SearchIcon,null),this.state.term&&React.createElement(ButtonClear,{onClick:this.clear},"Clear"),React.createElement(ButtonClose,{onClick:this.closeByButton},React.createElement(CrossIcon,null))),React.createElement(SearchResultsBox,{"data-role":"search:results"},a&&React.createElement(TextContainer,null,"Loading..."),!a&&!(null==n?void 0:n.length)&&React.createElement(TextContainer,null,"No results found"),(null==n?void 0:n.length)?React.createElement(PerfectScrollbarWrap,{options:{wheelPropagation:!1}},React.createElement(SearchResultsItems,null,n.slice(0,50).map((function(t,a){return React.createElement(MenuItemPro,{key:t.index+t.item.id,result:t,active:a===r,onActivate:e.onActivate,term:e.state.term,history:c.history})})))):null))):null}}),t}(React.PureComponent);export{ProSearchBox};
|
|
2
2
|
//# sourceMappingURL=ProSearchBox.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as React from"react";import{SearchFieldWrap,SearchIcon,ButtonClear,CrossIcon}from"./styled";export var SearchField=function(e){var
|
|
1
|
+
import*as React from"react";import{SearchFieldWrap,SearchIcon,ButtonClear,CrossIcon}from"./styled";import{l}from"../../redoc-lib/src/services/Labels";export var SearchField=function(e){var r=e.showPopUp,a=e.searchValue,t=e.marker,c=e.setSearchValue,o=!!a;return React.createElement(SearchFieldWrap,{onClick:r},React.createElement("span",null),a||l("search"),React.createElement(SearchIcon,null),o&&React.createElement(ButtonClear,{onClick:function(e){e.stopPropagation(),t.unmark(),c("")}},React.createElement(CrossIcon,null)))};
|
|
2
2
|
//# sourceMappingURL=SearchField.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a;import{__awaiter,__generator}from"tslib";import*as React from"react";import{loadAndBundleDefinition}from"../redoc-lib";import{ProStore}from"../services/ProStore";import slugify from"slugify";import isDeepEqual from"fast-deep-equal";import{FakeHistoryService}from"../services";export var Provider=(_a=React.createContext(void 0),_a.Provider),Consumer=_a.Consumer;export var ProStoreProvider=function(e){var t=e.definitions,n=e.options,r=e.definitionUrl,i=e.definition,o=e.activeItemId,a=e.activeSampleLanguage,s=e.activeDeepLink,
|
|
1
|
+
var _a;import{__awaiter,__generator}from"tslib";import*as React from"react";import{loadAndBundleDefinition}from"../redoc-lib";import{ProStore}from"../services/ProStore";import slugify from"slugify";import isDeepEqual from"fast-deep-equal";import{FakeHistoryService,AnalyticsEventType}from"../services";export var Provider=(_a=React.createContext(void 0),_a.Provider),Consumer=_a.Consumer;export var ProStoreProvider=function(e){var t=e.definitions,n=e.options,r=e.definitionUrl,i=e.definition,o=e.activeItemId,a=e.activeSampleLanguage,s=e.activeDeepLink,c=e.children,u=React.useState()[1],l=React.useState(!0),d=l[0],f=l[1],p=React.useState(null),v=p[0],m=p[1];React.useEffect((function(){!function(){__awaiter(this,void 0,void 0,(function(){var e,o,a;return __generator(this,(function(s){switch(s.label){case 0:f(!0),s.label=1;case 1:return s.trys.push([1,6,,7]),e=m,t?[4,loadMany(t)]:[3,3];case 2:return o=s.sent(),[3,5];case 3:return[4,loadSingle(i,r,n)];case 4:o=s.sent(),s.label=5;case 5:return e.apply(void 0,[o]),[3,7];case 6:return a=s.sent(),u((function(){throw a})),[3,7];case 7:return[2]}}))}))}()}),[t,i,r,n]);var h=React.useMemo((function(){var e,t,i;if(v){var o=new ProStore(v,r,n);return(null===(e=o.options.hooks)||void 0===e?void 0:e.onInit)&&(null===(i=null===(t=o.options.hooks)||void 0===t?void 0:t.onInit)||void 0===i||i.call(t,{store:o})),o}}),useDeepCompareMemoize([v,n]));return React.useEffect((function(){var e,t;if(h)return f(!1),null===(t=(e=h.options.events).loadingCompleted)||void 0===t||t.call(e,{eventType:AnalyticsEventType.LoadingCompleted,action:"Loaded",resource:"Redocly_ReferenceDocs"}),function(){return h.dispose()}}),[h]),React.useEffect((function(){var e;if(h&&o){var t=(null==o?void 0:o.split(h.options.deepLinkPrefix)[0])||(null===(e=h.menu.flatItems[h.menu.activeItemIdx])||void 0===e?void 0:e.id),n=h.menu.flatItems.find((function(e){return e.id===t})),r=s?t+h.options.deepLinkPrefix+s:void 0;r&&h.menu.history instanceof FakeHistoryService&&h.menu.history.replaceForField(r),h.menu.activateAndScroll(n,!0,!1,r)}}),[o,s,h]),React.useEffect((function(){h&&a&&h.setActiveSampleLanguage(a)}),[a,h]),c({loading:d,store:h})};function fixSpec(e){for(var t=e.components&&e.components.securitySchemes||{},n=0,r=Object.keys(t);n<r.length;n++){var i=t[r[n]];i["x-type"]&&(i.type=i["x-type"]),i["x-scheme"]&&(i.scheme=i["x-scheme"])}}function loadMany(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,loadSpecs(e||[])];case 1:return t.sent(),[2,e]}}))}))}function loadSingle(e,t,n){return __awaiter(this,void 0,void 0,(function(){var r,i,o,a;return __generator(this,(function(s){switch(s.label){case 0:if(!(null==n?void 0:n.skipBundleAndConvert))return[3,1];if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');return r=e,[3,3];case 1:return[4,loadAndBundleDefinition(e||t)];case 2:r=s.sent(),s.label=3;case 3:if(!(i=null==n?void 0:n.unstable_externalDescription))return[3,8];s.label=4;case 4:return s.trys.push([4,7,,8]),[4,fetch(i)];case 5:return[4,s.sent().text()];case 6:return o=s.sent(),r.info.description=o,[3,8];case 7:return a=s.sent(),console.warn("Failed to load external description from "+i+": "+a.message),[3,8];case 8:try{fixSpec(r)}catch(e){}return[2,r]}}))}))}function loadAndBundleSpecOrMd(e,t){return e.endsWith(".md")?loadAndBundleDefinition({openapi:"3.0.0",info:{title:t||"",version:"1.0",description:{$ref:e}},paths:{}}):loadAndBundleDefinition(e)}export function loadSpecs(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l,d,f,p;return __generator(this,(function(v){switch(v.label){case 0:if(!Array.isArray(e))return[3,8];t=0,n=e,v.label=1;case 1:return t<n.length?((r=n[t]).id=r.id||slugify(r.title),r.url?(i=r,[4,loadAndBundleSpecOrMd(r.url,r.title)]):[3,3]):[3,8];case 2:return i.definition=v.sent(),[3,7];case 3:o=0,a=r.items||[],v.label=4;case 4:return o<a.length?(s=a[o]).url?(c=s,[4,loadAndBundleSpecOrMd(s.url,r.title)]):[3,6]:[3,7];case 5:c.definition=v.sent(),v.label=6;case 6:return o++,[3,4];case 7:return t++,[3,1];case 8:if(u=e.versions,!Array.isArray(u))return[3,12];l=0,d=u,v.label=9;case 9:return l<d.length?(f=d[l]).url?(p=f,[4,loadAndBundleSpecOrMd(f.url)]):[3,11]:[3,12];case 10:p.spec=v.sent(),v.label=11;case 11:return l++,[3,9];case 12:return[2]}}))}))}function useDeepCompareMemoize(e){var t=React.useRef(),n=React.useRef(0);return isDeepEqual(e,t.current)||(t.current=e,n.current+=1),[n.current]}
|
|
2
2
|
//# sourceMappingURL=StoreProvider.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{createGlobalStyle}from"../../redoc-lib";import{asField}from"informed";import{Controlled as CodeMirror}from"react-codemirror2";import"./codemirror-helpers";var templateObject_1,CodeMirrorStyles=createGlobalStyle(templateObject_1||(templateObject_1=__makeTemplateObject(["\n .cm-s-material.CodeMirror {\n background-color: ","!important;\n color: ","!important;\n font-family: ",";\n line-height: 18px;\n padding: 10px;\n }\n\n .CodeMirror-lint-mark-error {\n background-size: 4px;\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAAVUlEQVR42mNgQAL/GRjigPg/EP8FYntkCX4gtoVKgvE/BoabcEVAhj6S5DUgfgFl/wFJ2gPxL6iuT1DF+kD2R5AYA5KRj6CS/FAMYvszIBltz4AFAAD9fz0YtLg13wAAAABJRU5ErkJggg==') !important;\n }\n\n .cm-s-material.CodeMirror-focused div.CodeMirror-selected {\n background: rgba(255, 255, 255, 0.3) !important;\n }\n\n .cm-s-material .CodeMirror-code .cm-string.cm-property {\n color: #9EFAA7;\n }\n\n .cm-s-material .CodeMirror-code .cm-string {\n color: #FEE39E;\n }\n\n .cm-s-material .CodeMirror-code .cm-atom {\n color: ",";\n }\n\n div .cm-s-material .CodeMirror-matchingbracket {\n outline: 1px solid grey;\n text-decoration: none;\n }\n\n .react-codemirror2 {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: ",";\n border-bottom-left-radius: ",";\n overflow: hidden;\n\n flex: 1;\n }\n\n .CodeMirror {\n flex: 1;\n max-height: 65vh !important; /* it fixes performance bug if we pass big data to CodeMirror */\n border-radius: ",";\n }\n"],["\n .cm-s-material.CodeMirror {\n background-color: ","!important;\n color: ","!important;\n font-family: ",";\n line-height: 18px;\n padding: 10px;\n }\n\n .CodeMirror-lint-mark-error {\n background-size: 4px;\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAAVUlEQVR42mNgQAL/GRjigPg/EP8FYntkCX4gtoVKgvE/BoabcEVAhj6S5DUgfgFl/wFJ2gPxL6iuT1DF+kD2R5AYA5KRj6CS/FAMYvszIBltz4AFAAD9fz0YtLg13wAAAABJRU5ErkJggg==') !important;\n }\n\n .cm-s-material.CodeMirror-focused div.CodeMirror-selected {\n background: rgba(255, 255, 255, 0.3) !important;\n }\n\n .cm-s-material .CodeMirror-code .cm-string.cm-property {\n color: #9EFAA7;\n }\n\n .cm-s-material .CodeMirror-code .cm-string {\n color: #FEE39E;\n }\n\n .cm-s-material .CodeMirror-code .cm-atom {\n color: ",";\n }\n\n div .cm-s-material .CodeMirror-matchingbracket {\n outline: 1px solid grey;\n text-decoration: none;\n }\n\n .react-codemirror2 {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: ",";\n border-bottom-left-radius: ",";\n overflow: hidden;\n\n flex: 1;\n }\n\n .CodeMirror {\n flex: 1;\n max-height: 65vh !important; /* it fixes performance bug if we pass big data to CodeMirror */\n border-radius: ",";\n }\n"])),(function(e){return e.theme.rightPanel.panelControlsBackgroundColor}),(function(e){return e.theme.colors.text.light}),(function(e){return e.theme.typography.code.fontFamily}),(function(e){return e.theme.colors.text.light}),(function(e){return e.theme.components.panels.borderRadius}),(function(e){return e.theme.components.panels.borderRadius}),(function(e){return e.theme.components.panels.borderRadius})),CodemirrorInput=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(r,"editor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_onKeyUp",{enumerable:!0,configurable:!0,writable:!0,value:function(e,
|
|
1
|
+
import{__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{createGlobalStyle}from"../../redoc-lib";import{asField}from"informed";import{Controlled as CodeMirror}from"react-codemirror2";import"codemirror/mode/xml/xml";import"./codemirror-helpers";var templateObject_1,CodeMirrorStyles=createGlobalStyle(templateObject_1||(templateObject_1=__makeTemplateObject(["\n .cm-s-material.CodeMirror {\n background-color: ","!important;\n color: ","!important;\n font-family: ",";\n line-height: 18px;\n padding: 10px;\n }\n\n .CodeMirror-lint-mark-error {\n background-size: 4px;\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAAVUlEQVR42mNgQAL/GRjigPg/EP8FYntkCX4gtoVKgvE/BoabcEVAhj6S5DUgfgFl/wFJ2gPxL6iuT1DF+kD2R5AYA5KRj6CS/FAMYvszIBltz4AFAAD9fz0YtLg13wAAAABJRU5ErkJggg==') !important;\n }\n\n .cm-s-material.CodeMirror-focused div.CodeMirror-selected {\n background: rgba(255, 255, 255, 0.3) !important;\n }\n\n .cm-s-material .CodeMirror-code .cm-string.cm-property {\n color: #9EFAA7;\n }\n\n .cm-s-material .CodeMirror-code .cm-string {\n color: #FEE39E;\n }\n\n .cm-s-material .CodeMirror-code .cm-tag {\n color: #9efaa7;\n }\n\n .cm-s-material .CodeMirror-code .cm-atom {\n color: ",";\n }\n\n div .cm-s-material .CodeMirror-matchingbracket {\n outline: 1px solid grey;\n text-decoration: none;\n }\n\n .react-codemirror2 {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: ",";\n border-bottom-left-radius: ",";\n overflow: hidden;\n\n flex: 1;\n }\n\n .CodeMirror {\n flex: 1;\n max-height: 65vh !important; /* it fixes performance bug if we pass big data to CodeMirror */\n border-radius: ",";\n }\n"],["\n .cm-s-material.CodeMirror {\n background-color: ","!important;\n color: ","!important;\n font-family: ",";\n line-height: 18px;\n padding: 10px;\n }\n\n .CodeMirror-lint-mark-error {\n background-size: 4px;\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAAVUlEQVR42mNgQAL/GRjigPg/EP8FYntkCX4gtoVKgvE/BoabcEVAhj6S5DUgfgFl/wFJ2gPxL6iuT1DF+kD2R5AYA5KRj6CS/FAMYvszIBltz4AFAAD9fz0YtLg13wAAAABJRU5ErkJggg==') !important;\n }\n\n .cm-s-material.CodeMirror-focused div.CodeMirror-selected {\n background: rgba(255, 255, 255, 0.3) !important;\n }\n\n .cm-s-material .CodeMirror-code .cm-string.cm-property {\n color: #9EFAA7;\n }\n\n .cm-s-material .CodeMirror-code .cm-string {\n color: #FEE39E;\n }\n\n .cm-s-material .CodeMirror-code .cm-tag {\n color: #9efaa7;\n }\n\n .cm-s-material .CodeMirror-code .cm-atom {\n color: ",";\n }\n\n div .cm-s-material .CodeMirror-matchingbracket {\n outline: 1px solid grey;\n text-decoration: none;\n }\n\n .react-codemirror2 {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: ",";\n border-bottom-left-radius: ",";\n overflow: hidden;\n\n flex: 1;\n }\n\n .CodeMirror {\n flex: 1;\n max-height: 65vh !important; /* it fixes performance bug if we pass big data to CodeMirror */\n border-radius: ",";\n }\n"])),(function(e){return e.theme.rightPanel.panelControlsBackgroundColor}),(function(e){return e.theme.colors.text.light}),(function(e){return e.theme.typography.code.fontFamily}),(function(e){return e.theme.colors.text.light}),(function(e){return e.theme.components.panels.borderRadius}),(function(e){return e.theme.components.panels.borderRadius}),(function(e){return e.theme.components.panels.borderRadius})),CodemirrorInput=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(r,"editor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_onKeyUp",{enumerable:!0,configurable:!0,writable:!0,value:function(e,o){/^[a-zA-Z0-9_":]$/.test(o.key)&&r.editor.execCommand("autocomplete")}}),Object.defineProperty(r,"initEditor",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.editor=e,e.on("keyup",r._onKeyUp)}}),Object.defineProperty(r,"refreshEditor",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.editor.refresh()}}),r}return __extends(r,e),Object.defineProperty(r.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;setTimeout((function(){e.editor.refresh()}),0),document.addEventListener("click",this.refreshEditor)}}),Object.defineProperty(r.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){document.removeEventListener("click",this.refreshEditor)}}),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,r=this.props.fieldState.value,o=this.props.fieldApi,t=o.setValue,n=o.setTouched,i=o.setError,a=this.props,c=a.onChange,l=a.onBlur,d=a.forwardedRef;return React.createElement(React.Fragment,null,React.createElement(CodeMirrorStyles,null),React.createElement(CodeMirror,{editorDidMount:this.initEditor,value:r||"",ref:d||void 0,onBeforeChange:function(e,r,o){t(o),c&&c(o)},onBlur:function(e){n(),l&&l(e)},options:{mode:this.props.mode||"application/json",theme:"material",matchBrackets:!0,autoCloseBrackets:!0,tabSize:2,foldGutter:!0,extraKeys:{"Cmd-Space":function(){return e.editor.showHint({completeSingle:!0})},"Ctrl-Space":function(){return e.editor.showHint({completeSingle:!0})}},hintOptions:{id:this.props.id,completeSingle:!1,schema:this.props.schema},lint:{id:this.props.id,schema:this.props.schema,setError:i}}}))}}),r}(React.Component);export{CodemirrorInput};export default asField(CodemirrorInput);
|
|
2
2
|
//# sourceMappingURL=CodemirrorInput.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _this=this;import{__assign,__awaiter,__generator,__rest}from"tslib";import*as React from"react";import{useEffect}from"react";import{observer}from"mobx-react";import merge from"deepmerge";import{DropdownOrLabel,Dropdown,MediaTypesSwitch}from"../../redoc-lib";import CodemirrorInput from"./CodemirrorInput";import{RequestMimeLabel}from"./RequestMimeLabel";import{ExampleSwitch,useExampleKey}from"../Samples";import{arrayMerge}from"../../services/utils";import{RequestBodyForm}from"./RequestBodyForm";import{isRootFileUpload}from"../common/FileUpload/helper";import{MediaTypes}from"../../models";export var RequestBody=observer((function(e){var r,o,t=e.properties,a=void 0===t?{}:t,
|
|
1
|
+
var _this=this;import{__assign,__awaiter,__generator,__rest}from"tslib";import*as React from"react";import{useEffect}from"react";import{observer}from"mobx-react";import merge from"deepmerge";import{DropdownOrLabel,Dropdown,MediaTypesSwitch,isXmlLike}from"../../redoc-lib";import{FormControl}from"../common/form";import CodemirrorInput from"./CodemirrorInput";import{RequestMimeLabel}from"./RequestMimeLabel";import{ExampleSwitch,useExampleKey}from"../Samples";import{arrayMerge}from"../../services/utils";import{RequestBodyForm}from"./RequestBodyForm";import{isRootFileUpload}from"../common/FileUpload/helper";import{MediaTypes}from"../../models";export var RequestBody=observer((function(e){var r,o,t=e.properties,a=void 0===t?{}:t,n=__rest(e,["properties"]),i=React.useCallback((function(e){var r,o=n.body.content;if(!o||!o.hasSample)return"";var t=null===(r=o.active)||void 0===r?void 0:r.examples;if(!(null==t?void 0:t[e]))return"";var i=merge(null==t?void 0:t[e].value,a,{arrayMerge:arrayMerge});return JSON.stringify(i,null,2)}),[a,n.body.content]),m=null===(o=null===(r=n.body.content)||void 0===r?void 0:r.operation)||void 0===o?void 0:o.activeExampleName,l=function(e){var r,o;null===(o=null===(r=n.body.content)||void 0===r?void 0:r.operation)||void 0===o||o.activateExampleName(e),n.console.formApi.setValue("body",i(e))},d=function(e){if(!e)return"";if("application/x-www-form-urlencoded"===e.mime||isXmlLike(e.mime))return e.value;var r=merge(e.value,a,{arrayMerge:arrayMerge});return JSON.stringify(r,null,2)},c=function(e,r){return __awaiter(void 0,void 0,void 0,(function(){var o;return __generator(this,(function(t){return o=n.console.formApi,(0,o.setValue)("body."+e,r),[2]}))}))};useEffect((function(){m&&n.console.formApi.setValue("body",i(m))}),[m,i,n.console.formApi]);var p=n.validate,s=n.body;return React.createElement(React.Fragment,null,React.createElement(MediaTypesSwitch,{content:s.content,renderDropdown:function(e){return React.createElement(FormControl,null,React.createElement(DropdownOrLabel,__assign({},e,{variant:"dark",fullWidth:!0,Label:RequestMimeLabel,Dropdown:Dropdown})))}},(function(e){var r,o=e.examples||{},t=Object.keys(o);n.resolvedBody&&(r=(n.resolvedBody.content[e.name]||{}).schema);var a=isRootFileUpload(r,e.name)||e.name===MediaTypes.MULTIPART||e.name===MediaTypes.URL_ENCODED,i=useExampleKey(e.operation,o).exampleKey,m=o[i];return React.createElement(React.Fragment,null,t.length&&1!==t.length&&React.createElement(ExampleSwitch,{examples:o,onChange:l,exampleKey:i})||null,a?React.createElement(RequestBodyForm,{schema:r,mediaType:e,onChange:c.bind(_this)}):React.createElement(CodemirrorInput,{id:"body"+n.id,field:"body",initialValue:d(m),schema:r,mode:e.name,validate:p}))})))}));
|
|
2
2
|
//# sourceMappingURL=RequestBody.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{Dropdown,styled}from"../../redoc-lib";import{observer}from"mobx-react";import{fromStorage,toStorage}from"../../utils";import ServerVariable from"./ServerVariable";import{FormControl
|
|
1
|
+
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import*as React from"react";import{Dropdown,styled}from"../../redoc-lib";import{observer}from"mobx-react";import{fromStorage,toStorage}from"../../utils";import ServerVariable from"./ServerVariable";import{FormControl}from"../common/form";var ServerDropdownWrap=styled.div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n margin-top: 20px;\n"],["\n margin-top: 20px;\n"]))),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,"handleChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var a=r.props.operation.servers.find((function(r){return r.url===e.serverUrl})),t=a&&getVariables(a)||{};r.props.onChange({url:e.serverUrl,variables:t}),toStorage("serverUrl",e.serverUrl),r.setState({variables:t})}}),Object.defineProperty(r,"handleVariableChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e,a){var t,n,o=__assign(__assign({},r.state.variables),((t={})[e]=a,t));r.setState({variables:o});var i=fromStorage("variables"),s=i&&JSON.parse(i)||{};toStorage("variables",JSON.stringify(__assign(__assign({},s),((n={})[e]=a,n))));var l=r.props.operation.servers[r.state.activeIdx];r.props.onChange(__assign(__assign({},l),{variables:o}))}}),r}return __extends(r,e),Object.defineProperty(r,"getDerivedStateFromProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.operation,a=fromStorage("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=this.props.operation.servers[this.state.activeIdx],r=getVariables(e);this.props.onChange(__assign(__assign({},e),{variables:r})),this.setState({variables:r})}}),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){return{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(FormControl,null,React.createElement(Dropdown,{prefix:"Target server: ",variant:"dark",value:a[r].value,options:a,onChange:this.handleChange})),t.length?t.map((function(r){var a=e.props.operation.servers[e.state.activeIdx].variables[r];return React.createElement(ServerVariable,{key:r,name:r,value:e.state.variables[r],defaultValue:a.default,onChange:function(a){return e.handleVariableChange(r,a)},variableEnum:a.enum,description:a.description})})):null)}}),r=__decorate([observer],r)}(React.Component);export{ServerChooser};var templateObject_1,pathTemplateRegExp=/(?:{)(\w+)(?:})/g;export function expandVariables(e,r){return void 0===r&&(r={}),e.replace(pathTemplateRegExp,(function(e,a){return r[a]||e}))}function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(pathTemplateRegExp,(function(e,a){return r[a]&&r[a].default||e}))}function getVariables(e){if(!e.variables)return{};var r=fromStorage("variables"),a=r&&JSON.parse(r)||{},t={};return Object.keys(e.variables).forEach((function(r){t[r]=e.variables[r].default||"",Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])})),__assign({},t)}
|
|
2
2
|
//# sourceMappingURL=ServerDropdown.js.map
|