mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 08:36:33 +03:00
chore: update demo bundle for v2.0.0
This commit is contained in:
parent
0bae650546
commit
471d7d1bc1
|
@ -16,14 +16,14 @@ info:
|
|||
[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.
|
||||
It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)
|
||||
tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md).
|
||||
|
||||
# OpenAPI Specification
|
||||
This API is documented in **OpenAPI format** and is based on
|
||||
[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.
|
||||
It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)
|
||||
tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md).
|
||||
|
||||
# Cross-Origin Resource Sharing
|
||||
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).
|
||||
|
|
|
@ -16,14 +16,14 @@ info:
|
|||
[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.
|
||||
It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)
|
||||
tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md).
|
||||
|
||||
# OpenAPI Specification
|
||||
This API is documented in **OpenAPI format** and is based on
|
||||
[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.
|
||||
It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)
|
||||
tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).
|
||||
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md).
|
||||
|
||||
# Cross-Origin Resource Sharing
|
||||
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
`,kr=gr;function Or(e){return t=>{if(t.theme.extensionsHook)return t.theme.extensionsHook(e,t)}}const Sr=kr.div`
|
||||
padding: 20px;
|
||||
color: red;
|
||||
`;class _r extends n.Component{constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e){return this.setState({error:e}),!1}render(){return this.state.error?n.createElement(Sr,null,n.createElement("h1",null,"Something went wrong..."),n.createElement("small",null," ",this.state.error.message," "),n.createElement("p",null,n.createElement("details",null,n.createElement("summary",null,"Stack trace"),n.createElement("pre",null,this.state.error.stack))),n.createElement("small",null," ReDoc Version: ","2.0.0-rc.77")," ",n.createElement("br",null),n.createElement("small",null," Commit: ","9d36b328")):n.createElement(n.Fragment,null,n.Children.only(this.props.children))}}const Er=br`
|
||||
`;class _r extends n.Component{constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e){return this.setState({error:e}),!1}render(){return this.state.error?n.createElement(Sr,null,n.createElement("h1",null,"Something went wrong..."),n.createElement("small",null," ",this.state.error.message," "),n.createElement("p",null,n.createElement("details",null,n.createElement("summary",null,"Stack trace"),n.createElement("pre",null,this.state.error.stack))),n.createElement("small",null," ReDoc Version: ","2.0.0")," ",n.createElement("br",null),n.createElement("small",null," Commit: ","5fb4daa6")):n.createElement(n.Fragment,null,n.Children.only(this.props.children))}}const Er=br`
|
||||
0% {
|
||||
transform: rotate(0deg); }
|
||||
100% {
|
||||
|
@ -1895,7 +1895,7 @@
|
|||
@media (max-width: 699px) {
|
||||
display: none;
|
||||
}
|
||||
`,_x=function(e){const t=(0,n.useRef)(null);return n.createElement("span",null,n.createElement(Sx,{onClick:()=>{t&&t.current&&t.current.click()}},"Upload a file"),n.createElement("input",{type:"file",style:{display:"none"},onChange:t=>{const r=t.target.files[0],n=new FileReader;n.onload=()=>{e.onUpload(Ox(n.result))},n.readAsText(r)},ref:t}))},Ex="openapi.yaml",Px="openapi-3-1.yaml",$x=[{value:Px,label:"Petstore OpenAPI 3.1"},{value:"https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml",label:"Instagram"},{value:"https://api.apis.guru/v2/specs/googleapis.com/calendar/v3/openapi.yaml",label:"Google Calendar"},{value:"https://api.apis.guru/v2/specs/slack.com/1.7.0/openapi.yaml",label:"Slack"},{value:"https://api.apis.guru/v2/specs/zoom.us/2.0.0/openapi.yaml",label:"Zoom.us"},{value:"https://docs.graphhopper.com/openapi.json",label:"GraphHopper"}];class Ax extends n.Component{constructor(e){super(e),this.handleUploadFile=e=>{this.setState({spec:e,specUrl:""})},this.handleChange=e=>{e===Px&&this.setState({cors:!1}),this.setState({specUrl:e}),window.history.pushState(void 0,"",Ix(location.search,"url",e))},this.toggleCors=e=>{const t=e.currentTarget.checked;this.setState({cors:t}),window.history.pushState(void 0,"",Ix(location.search,"nocors",t?void 0:""))};let t=window.location.search.match(/url=([^&]+)/),r=Ex;t&&t.length>1&&(r=decodeURIComponent(t[1])),t=window.location.search.match(/[?&]nocors(&|#|$)/);let n=!0;t&&t.length>1&&(n=!1),this.state={spec:void 0,specUrl:r,dropdownOpen:!1,cors:n}}render(){const{specUrl:e,cors:t}=this.state;let r=e;return e!==Ex&&(r=t?"\\\\cors.redoc.ly/"+new URL(e,window.location.href).href:e),n.createElement(n.Fragment,null,n.createElement(jx,null,n.createElement("a",{href:"."},n.createElement(Tx,{src:"https://github.com/Redocly/redoc/raw/master/docs/images/redoc-logo.png",alt:"Redoc logo"})),n.createElement(Cx,null,n.createElement(_x,{onUpload:this.handleUploadFile}),n.createElement(rw,{placeholder:"URL to a spec to try",options:$x,onChange:this.handleChange,value:e===Ex?"":e}),n.createElement(Rx,{title:"Use CORS proxy"},n.createElement("input",{id:"cors_checkbox",type:"checkbox",onChange:this.toggleCors,checked:t}),n.createElement("label",{htmlFor:"cors_checkbox"},"CORS"))),n.createElement("iframe",{src:"https://ghbtns.com/github-btn.html?user=Redocly&repo=redoc&type=star&count=true&size=large",frameBorder:"0",scrolling:"0",width:"160px",height:"30px"})),n.createElement(Qb,{spec:this.state.spec,specUrl:r,options:{scrollYOffset:"nav",untrustedSpec:!0}}))}}const Cx=He.div`
|
||||
`,_x=function(e){const t=(0,n.useRef)(null);return n.createElement("span",null,n.createElement(Sx,{onClick:()=>{t&&t.current&&t.current.click()}},"Upload a file"),n.createElement("input",{type:"file",style:{display:"none"},onChange:t=>{const r=t.target.files[0],n=new FileReader;n.onload=()=>{e.onUpload(Ox(n.result))},n.readAsText(r)},ref:t}))},Ex="openapi.yaml",Px="openapi-3-1.yaml",$x=[{value:Px,label:"Petstore OpenAPI 3.1"},{value:"https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml",label:"Instagram"},{value:"https://api.apis.guru/v2/specs/googleapis.com/calendar/v3/openapi.yaml",label:"Google Calendar"},{value:"https://api.apis.guru/v2/specs/slack.com/1.7.0/openapi.yaml",label:"Slack"},{value:"https://api.apis.guru/v2/specs/zoom.us/2.0.0/openapi.yaml",label:"Zoom.us"},{value:"https://docs.graphhopper.com/openapi.json",label:"GraphHopper"}];class Ax extends n.Component{constructor(e){super(e),this.handleUploadFile=e=>{this.setState({spec:e,specUrl:""})},this.handleChange=e=>{e===Px&&this.setState({cors:!1}),this.setState({specUrl:e}),window.history.pushState(void 0,"",Ix(location.search,"url",e))},this.toggleCors=e=>{const t=e.currentTarget.checked;this.setState({cors:t}),window.history.pushState(void 0,"",Ix(location.search,"nocors",t?void 0:""))};let t=window.location.search.match(/url=([^&]+)/),r=Ex;t&&t.length>1&&(r=decodeURIComponent(t[1])),t=window.location.search.match(/[?&]nocors(&|#|$)/);let n=!0;t&&t.length>1&&(n=!1),this.state={spec:void 0,specUrl:r,dropdownOpen:!1,cors:n}}render(){const{specUrl:e,cors:t}=this.state;let r=e;return e!==Ex&&(r=t?"\\\\cors.redoc.ly/"+new URL(e,window.location.href).href:e),n.createElement(n.Fragment,null,n.createElement(jx,null,n.createElement("a",{href:"."},n.createElement(Tx,{src:"https://github.com/Redocly/redoc/raw/main/docs/images/redoc-logo.png",alt:"Redoc logo"})),n.createElement(Cx,null,n.createElement(_x,{onUpload:this.handleUploadFile}),n.createElement(rw,{placeholder:"URL to a spec to try",options:$x,onChange:this.handleChange,value:e===Ex?"":e}),n.createElement(Rx,{title:"Use CORS proxy"},n.createElement("input",{id:"cors_checkbox",type:"checkbox",onChange:this.toggleCors,checked:t}),n.createElement("label",{htmlFor:"cors_checkbox"},"CORS"))),n.createElement("iframe",{src:"https://ghbtns.com/github-btn.html?user=Redocly&repo=redoc&type=star&count=true&size=large",frameBorder:"0",scrolling:"0",width:"160px",height:"30px"})),n.createElement(Qb,{spec:this.state.spec,specUrl:r,options:{scrollYOffset:"nav",untrustedSpec:!0}}))}}const Cx=He.div`
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user