@redocly/openapi-docs 3.18.0-next.0 → 3.18.0-next.10
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/dist/redocly-openapi-docs.min.js +3098 -2529
- package/lib/components/Callbacks/CallbackDetails.js +2 -2
- package/lib/components/ExpandAllButton/ExpandAllButton.js +2 -2
- package/lib/components/Language/LanguageList.js +1 -1
- package/lib/components/OperationItem/OperationItem.js +10 -6
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
- package/lib/components/Request/RequestDetails.js +8 -2
- package/lib/components/RequestSamples/Example.js +1 -1
- package/lib/components/RequestSamples/RequestSamples.js +1 -1
- package/lib/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib/components/Responses/OperationResponseList.js +2 -1
- package/lib/components/Responses/styled.js +4 -2
- package/lib/components/Samples/ExampleSwitch.js +1 -1
- package/lib/components/Schema/Schema.js +1 -1
- package/lib/components/SchemaDefinition/SchemaDefinition.js +5 -2
- package/lib/components/SectionContent/SectionContent.js +7 -5
- package/lib/components/SectionItem/SectionItem.js +1 -1
- package/lib/components/Security/OAuthScopes.d.ts +3 -3
- package/lib/components/Security/OAuthScopes.js +12 -11
- package/lib/components/Security/RequiredScopes.d.ts +6 -0
- package/lib/components/Security/RequiredScopes.js +17 -0
- package/lib/components/Security/RequiredScopesList.d.ts +14 -0
- package/lib/components/Security/RequiredScopesList.js +13 -0
- package/lib/components/Security/ScopeTagWithTooltip.d.ts +17 -0
- package/lib/components/Security/ScopeTagWithTooltip.js +33 -0
- package/lib/components/Security/Security.js +1 -1
- package/lib/components/Security/SecurityButton.js +14 -14
- package/lib/components/Security/SecurityFlow.js +18 -5
- package/lib/components/ServerListDropdown/ServerListDropdown.js +1 -1
- package/lib/components/TagItem/TagItem.js +50 -37
- package/lib/components/ViewNested/ViewNested.js +7 -7
- package/lib/components/common/Dropdown/Dropdown.d.ts +2 -2
- package/lib/components/common/Dropdown/Dropdown.js +44 -10
- package/lib/components/common/OperationItemTitle.js +8 -6
- package/lib/components/common/SchemaSelection/SchemaSelection.js +1 -1
- package/lib/components/common/Select/Select.js +1 -1
- package/lib/components/common/Select/styled.d.ts +0 -1
- package/lib/components/common/Select/styled.js +19 -63
- package/lib/components/common/Select/types.d.ts +0 -3
- package/lib/components/common/styled.js +4 -4
- package/lib/icons/CSharpIcon/CSharpIcon.d.ts +2 -1
- package/lib/icons/CSharpIcon/CSharpIcon.js +1 -1
- package/lib/icons/CurlIcon/CurlIcon.d.ts +3 -2
- package/lib/icons/CurlIcon/CurlIcon.js +2 -2
- package/lib/icons/GOIcon/GOIcon.d.ts +2 -1
- package/lib/icons/GOIcon/GOIcon.js +1 -1
- package/lib/icons/JavaIcon/JavaIcon.d.ts +2 -1
- package/lib/icons/JavaIcon/JavaIcon.js +1 -1
- package/lib/icons/JavaScriptIcon/JavaScriptIcon.d.ts +2 -1
- package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +1 -1
- package/lib/icons/NodeJSIcon/NodeJSIcon.d.ts +2 -1
- package/lib/icons/NodeJSIcon/NodeJSIcon.js +1 -1
- package/lib/icons/PHPIcon/PHPIcon.d.ts +2 -1
- package/lib/icons/PHPIcon/PHPIcon.js +1 -1
- package/lib/icons/PythonIcon/PythonIcon.d.ts +2 -1
- package/lib/icons/PythonIcon/PythonIcon.js +1 -1
- package/lib/icons/RIcon/RIcon.d.ts +2 -1
- package/lib/icons/RIcon/RIcon.js +1 -1
- package/lib/icons/RubyIcon/RubyIcon.d.ts +2 -1
- package/lib/icons/RubyIcon/RubyIcon.js +1 -1
- package/lib/models/request.js +1 -1
- package/lib/models/response.js +1 -1
- package/lib/models/schema.js +2 -2
- package/lib/services/menu/tags.js +2 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -1
- package/lib/types/oauth2-types.d.ts +4 -0
- package/lib/types/oauth2-types.js +0 -0
- package/lib/types/open-api.d.ts +5 -0
- package/lib/utils/openapi.d.ts +3 -0
- package/lib/utils/openapi.js +1 -1
- package/lib/utils/security-scope.d.ts +5 -0
- package/lib/utils/security-scope.js +1 -0
- package/package.json +18 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as l,jsxs as s,Fragment as t}from"react/jsx-runtime";import{memo as r,useCallback as m}from"react";import{LinkIcon as p}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{OperationResponseList as d}from"../Responses/index.js";import{RequestDetails as k}from"../Request/RequestDetails.js";import{LinkToField as a}from"../common/LinkToField.js";import{makeDeepLink as c}from"../../services/index.js";import{styled as b}from"../../styled-components.js";function
|
|
1
|
+
import{jsx as l,jsxs as s,Fragment as t}from"react/jsx-runtime";import{memo as r,useCallback as m}from"react";import{LinkIcon as p}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{OperationResponseList as d}from"../Responses/index.js";import{RequestDetails as k}from"../Request/RequestDetails.js";import{LinkToField as a}from"../common/LinkToField.js";import{makeDeepLink as c}from"../../services/index.js";import{styled as b}from"../../styled-components.js";function h({operation:e,translate:i}){const n=m(o=>s(f,{children:[l(a,{to:c(e.id,`${e.callbackId}/callback-response&c=${o.key}`)}),i("openapi.callbackResponse","Callback Response")]}),[e.callbackId,e.id,i]);return s(t,{children:[l(k,{operation:e,title:s(t,{children:[l(a,{to:c(e.id,`${e.callbackId}/callback-request`)}),i("openapi.callbackRequest","Callback Request")]})}),e.responses?.length?l(d,{responses:e.responses,operationId:e.id,operationPointer:e.pointer,callbackId:e.callbackId,renderTitle:n}):null]})}const j=r(h),f=b.h4`
|
|
2
2
|
position: relative;
|
|
3
|
-
font-size: var(--font-size
|
|
3
|
+
font-size: var(--h4-font-size);
|
|
4
4
|
font-weight: var(--h4-font-weight);
|
|
5
5
|
line-height: var(--h4-line-height);
|
|
6
6
|
padding: 0;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";import{useAtom as
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{useAtom as d}from"jotai";import{MaximizeIcon as m}from"@redocly/theme/icons/MaximizeIcon/MaximizeIcon";import{Button as c}from"@redocly/theme/components/Button/Button";import{operationStore as x}from"../../jotai/operation.js";import{useTelemetry as u,useTranslate as f}from"../../hooks/index.js";import{styled as A}from"../../styled-components.js";const _=({operationPointer:a,type:e,onPanelToggle:s})=>{const l=f(),[t,r]=d(x(a)),i=u(),p=()=>{const o=!t[e].expandedAll;i.sendExpandCollapseAllClickedMessage([{id:`expand-collapse-${e}-panel`,object:"expand_collapse_all",uri:window.location.href,isExpanded:o}]),r({[e]:{expandedAll:o}}),s?.(o,e==="request"?"request":"responses")};return n(g,{icon:n(m,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:p,children:t[e].expandedAll?l("openapi.collapseAll","Collapse all"):l("openapi.expandAll","Expand all")})},g=A(c)`
|
|
2
2
|
margin-left: auto;
|
|
3
|
-
`;export{
|
|
3
|
+
`;export{_ as ExpandAllButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as I}from"react/jsx-runtime";import{useLayoutEffect as T,useRef as
|
|
1
|
+
import{jsx as a,jsxs as I}from"react/jsx-runtime";import{useLayoutEffect as T,useRef as j,useState as L,useCallback as A,memo as S,useMemo as E}from"react";import{useAtomValue as H,useSetAtom as V}from"jotai";import{Button as W}from"@redocly/theme/components/Button/Button";import{OverflowMenuVerticalIcon as _}from"@redocly/theme/icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon";import{LanguageDropdown as v}from"./LanguageDropdown.js";import{languageAtom as D,layoutAtom as R}from"../../jotai/app.js";import{LanguageListContainer as M,LanguageListItem as O,Container as z}from"./styled.js";import{LanguageItem as G}from"./LanguageItem.js";import{DROPDOWN_TRIGGER_WIDTH as B,ITEM_WIDTH as w}from"./constants.js";import{LanguageListSkeleton as N}from"../common/Skeleton/LanguageListSkeleton.js";import{useTelemetry as P}from"../../hooks/index.js";function $({languages:o,activeLanguage:t}){const[n,i]=L([]),[s,l]=L([]),u=P(),g=j(null),f=H(R),h=V(D),p=e=>{u.sendSelectLanguageClickedMessage([{object:"select_language",language:e}])},k=e=>{h(e),p(e)},C=e=>{const m=s.findIndex(r=>r.key===e);if(m!==-1){const r=[...s],c=[...n];y(c,r,m),i(c),l(r),p(e),h(e)}},d=A(()=>{const e=g?.current?.offsetWidth;if(!e)return;const{newVisibleItems:m,newHiddenItems:r}=q(e,[...o]),c=r.findIndex(x=>x.key===t);c!==-1&&y(m,r,c),i(m),l(r)},[t,o]);T(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[f,t]);const b=E(()=>n.length>=5||s.length?"space-between":"start",[s.length,n.length]);return I(z,{ref:g,children:[I(M,{$justifyContent:b,children:[!n.length&&a(N,{}),n.map(e=>a(O,{onClick:()=>k(e.key),active:t===e.key,children:a(G,{item:e,withIcon:!0})},e.key))]}),s.length?a(v,{activeTab:t,samples:s,onChange:C,trigger:a(W,{icon:a(_,{}),variant:"text",style:{height:"100%"}}),withArrow:!1,withCheckmark:!1,width:156}):null]})}const se=S($);function q(o,t){let n=0;const i=[],s=[];return t.forEach((l,u)=>{const f=u===t.length-1&&s.length===0?0:B;o&&n+w+f<=o?(i.push(l),n+=w):s.push(l)}),{newVisibleItems:i,newHiddenItems:s}}function y(o,t,n){const i=o[o.length-1];i&&(o[o.length-1]=t[n],t[n]=i)}export{se as LanguageList};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K,useState as
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K,useState as L,useCallback as j,useMemo as W}from"react";import{useAtomValue as g}from"jotai";import{LayoutVariant as $}from"@redocly/config";import{AfterOpenApiOperation as z}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiOperation";import{BeforeOpenApiOperation as G}from"@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation";import{PageActions as J}from"@redocly/theme/components/PageActions/PageActions";import{Feedback as Q}from"@redocly/theme/components/Feedback/Feedback";import{SamplesMiddlePanel as s,SamplesPanel as U,ShareLink as X,Row as f,CustomBadges as Y}from"../common/index.js";import{CallbacksList as Z}from"../Callbacks/index.js";import{CallbackSamples as ee}from"../CallbackSamples/index.js";import{RequestSamples as ae}from"../RequestSamples/index.js";import{OperationResponseList as te}from"../Responses/index.js";import{ResponseSamples as oe}from"../ResponseSamples/index.js";import{makeDeepLink as ne,joinWithSeparator as se}from"../../services/index.js";import{layoutAtom as re,userClaimsAtom as ie}from"../../jotai/app.js";import{globalOptionsAtom as le,globalStoreAtom as ce}from"../../jotai/store.js";import{getOperation as pe}from"../../models/operation.js";import{RenderHook as B}from"../RenderHook/index.js";import{Heading as de,HeadingWrapper as me,Title as ge}from"../common/OperationItemTitle.js";import{LinkToField as ke}from"../common/LinkToField.js";import{RequestDetails as be}from"../Request/RequestDetails.js";import{StyledBadge as H}from"../common/Badges.js";import{useTranslate as he}from"../../hooks/index.js";import{styled as i}from"../../styled-components.js";import{createPanelToggleEvent as ue}from"../../events/index.js";import{SchemaCatalogLink as fe}from"../SchemaCatalogLink/SchemaCatalogLink.js";function Se({item:{operationDefinition:v,parent:x,href:b}}){const r=he(),{parser:y,options:l}=g(ce),{events:C}=g(le),T=g(ie),n=g(re),[c,I]=L(),{unstable_hooks:O,feedback:p}=l,a=W(()=>pe(y,v,x,l,b,void 0,T),[b,v,l,x,y,T]),{name:R,deprecated:_,isWebhook:q,badges:D}=a||{},o=n===$.STACKED,A=p?.type||"sentiment",P=p?.hide!==!0,h=se(l.routingBasePath,a.href),[u,E]=L(null),w=j(m=>{c!==m&&I(m)},[c]),d=j((m,F)=>{if(!F)return;const N=ue({operation:a,isExpanded:m,panelType:F});C?.panelToggle?.(N)},[C,a]),M=W(()=>P?e(ve,{children:e(Q,{type:A,settings:p.settings,path:h})}):null,[P,A,p.settings,h]);return t(xe,{layout:n,children:[e(k,{layout:n,children:t(s,{isStacked:o,children:[e(B,{Hook:G||O?.BeforeOperation,props:{operation:a}}),t(me,{children:[t(de,{"data-testid":"operation-item-header",children:[e(X,{to:b,"aria-label":`link to ${R}`}),e(Y,{badges:D,children:R}),_&&e(H,{deprecated:!0,children:r("openapi.badges.deprecated","Deprecated")}),q&&e(H,{children:r("openapi.badges.webhook","Webhook")})]}),e(J,{pageSlug:h})]})]})}),e(s,{isStacked:o,children:e(fe,{schemaRef:"#"+a.pointer})}),t(k,{layout:n,children:[e(s,{isStacked:o,children:e(be,{operation:a,translate:r,onPanelToggle:d})}),e(S,{isStacked:o,"data-testid":"samples-block",className:"panel-container-request-samples",children:e(ae,{operation:a,onPanelToggle:d})})]}),t(k,{layout:n,children:[e(s,{isStacked:o,children:a.responses?.length?e(te,{responses:a.responses,operationId:a.id,operationPointer:a.pointer,callbackId:a.callbackId,activeResponseTab:c,onTabChange:w,onPanelToggle:d}):null}),e(S,{isStacked:o,"data-testid":"samples-block",className:"panel-container-response-samples",children:e(oe,{operation:a,activeResponseTab:c,onTabChange:w,onPanelToggle:d})})]}),t(ye,{layout:n,children:[t(s,{isStacked:o,children:[a.callbacks?.length?t(V,{children:[t(ge,{children:[e(ke,{to:ne(a.id,"callbacks")}),r("openapi.callbacks","Callbacks")]}),e(Z,{callbacks:a.callbacks,onExpand:E,selectedCallback:u})]}):null,e(B,{Hook:z||O?.AfterOperation,props:{operation:a}})]}),u?e(S,{isStacked:o,"data-testid":"samples-block",children:e(ee,{callback:u,translate:r})}):null]}),e(k,{layout:n,children:e(s,{isStacked:o,fullWidth:!0,children:M})})]})}const Ue=K(Se),S=i(U)`
|
|
2
2
|
margin-left: auto;
|
|
3
3
|
--code-block-padding: var(--spacing-xs) 0 var(--spacing-xs) 20px;
|
|
4
|
-
`,ve=
|
|
4
|
+
`,ve=i.div`
|
|
5
5
|
& > div {
|
|
6
6
|
flex: 1 1 auto;
|
|
7
7
|
display: flex;
|
|
@@ -12,10 +12,14 @@ import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K
|
|
|
12
12
|
width: 100%;
|
|
13
13
|
max-width: var(--feedback-width);
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,xe=i(f)`
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
align-items: flex-start;
|
|
18
18
|
padding: var(--spacing-base) 0 calc(var(--spacing-xl) + var(--spacing-xs));
|
|
19
|
-
`,i
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
`,k=i(f)`
|
|
20
|
+
&& {
|
|
21
|
+
margin: calc(var(--spacing-unit) * 2) 0;
|
|
22
|
+
}
|
|
23
|
+
`,ye=i(f)`
|
|
24
|
+
margin-top: var(--spacing-xl);
|
|
25
|
+
`;export{Ue as OperationItem,S as OperationSamplesPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as s,Fragment as
|
|
1
|
+
import{jsx as t,jsxs as s,Fragment as x}from"react/jsx-runtime";import{memo as C,useRef as O,useEffect as T}from"react";import{LayoutVariant as d}from"@redocly/config";import{useSetAtom as j}from"jotai";import{ThreePanelLayout as A}from"@redocly/theme/layouts/ThreePanelLayout";import{SidebarLogo as I}from"@redocly/theme/components/SidebarLogo/SidebarLogo";import{GlobalStyle as M,useMount as _}from"@redocly/theme/core/openapi";import{StoreProvider as N}from"./Providers.js";import{Overlay as v}from"../Overlay.js";import{RedocWrap as D}from"./styled.js";import{StickyResponsiveSidebar as V}from"../StickySidebar/index.js";import{SideMenu as k}from"../SideMenu/index.js";import{Content as B}from"../Content/index.js";import{useContentItems as K,useUppercase2LowercaseRedirect as F,useTelemetry as H,usePerformanceMetrics as U}from"../../hooks/index.js";import{withRouter as Y}from"../../hoc/withRouter.js";import{withStore as G}from"../../hoc/withStore.js";import{compose as W}from"../../utils/index.js";import{useLicense as q}from"../../hooks/useLicense.js";import{allOperationsAtom as z}from"../../jotai/replay.js";const J=W(Y,G,C)(({licenseKey:m,onLoaded:a,children:e,options:o,layout:i,collapsedSidebar:u,parser:c,withCommonStyles:g})=>{const R=O(null),{isValid:l,licenseInfo:S}=q(m),h=j(z),y=H();F();const{contentItems:b,flatItems:f}=K({parser:c,options:o});U({sendTelemetry:p=>{const r=Object.fromEntries(Object.entries(p).map(([E,w])=>[E.toLowerCase(),w]));y.sendPerformanceMetricsMessage([{object:"metrics",cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb}])}}),T(()=>{if(!o.hideReplay&&f.length>0){const p=f.filter(r=>r.type==="operation");h(p)}},[f,o.hideReplay,h]),_(()=>{a?.(),y.sendViewedMessage([{object:"view_stats",layout:i}])});const{hideSidebar:P,scrollYOffset:L}=o||{},n=c.definition?.info?.["x-logo"];return s(x,{children:[g&&t(M,{}),s(D,{className:"redoc-wrap",ref:R,children:[!l&&t(v,{licenseInfo:S}),!P&&s(V,{scrollYOffset:L,className:"menu-content",collapsedSidebar:!u,children:[t(I,{imageUrl:n?.url,href:n?.href||c.definition?.info?.contact?.url,altText:n?.altText,backgroundColor:n?.backgroundColor}),t(k,{items:l?b:[]})]}),s(A,{className:"api-content",id:"api-content",layout:i===d.THREE_PANEL?d.THREE_PANEL:d.STACKED,collapsedSidebar:u,children:[t(B,{items:l?b:[],routingBasePath:o.routingBasePath}),e]})]})]})});function he({onLoaded:m,children:a,store:e,withCommonStyles:o,router:i}){return e?.definition?t(N,{...e,children:t(J,{onLoaded:m,basePath:e.options?.routingBasePath,licenseKey:e.options?.licenseKey,disableRouter:e.options?.disableRouter,withCommonStyles:o,router:i,children:a})}):null}export{he as RedoclyOpenAPIDocs};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as o,Fragment as T}from"react/jsx-runtime";import{memo as j,useMemo as k}from"react";import{useAtomValue as A}from"jotai";import{Title as P}from"../common/OperationItemTitle.js";import{LinkToField as y}from"../common/LinkToField.js";import{makeDeepLink as D}from"../../services/index.js";import{Description as E}from"../OperationItem/Description.js";import{Security as F}from"../Security/index.js";import{hasNestedFields as M}from"../../utils/index.js";import{ExpandAllButton as N}from"../ExpandAllButton/index.js";import{RequestParameters as b}from"../RequestParameters/index.js";import{activeMimeNameAtom as C}from"../../jotai/app.js";import{getActiveMediaType as _}from"../../models/mediaContent.js";import{styled as n}from"../../styled-components.js";import{Extensions as w}from"../common/Extensions.js";function I({operation:{id:i,description:s,externalDocs:m,parameters:r,requestBody:t,pointer:u,security:f,extensions:a,callbackId:d},title:x,translate:h,onPanelToggle:g}){const p=A(C),v=k(()=>{const c=r.some(({schema:l})=>!l.isPrimitive&&!l.isCircular);if(!t?.content||c)return c;const{schema:R}=_(t.content,p)||{};return M(R)},[p,r,t?.content]),q=Object.keys(a||{}).length>0;return o(T,{children:[o(L,{children:[o(H,{children:[o(O,{children:[i&&e(y,{to:D(i,"request")}),x||h?.("openapi.request","Request"),v&&e(N,{operationPointer:u,type:"request",onPanelToggle:g})]}),e(E,{description:s||m?s:void 0,externalDocs:m})]}),q&&e(w,{extensions:a}),e(F,{securities:f})]}),e(b,{parameters:r,body:t,operationId:i,callbackId:d})]})}const L=n.div`
|
|
2
2
|
width: 100%;
|
|
3
|
-
`,
|
|
3
|
+
`,H=n.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--spacing-xs);
|
|
7
|
+
`,O=n(P)`
|
|
8
|
+
margin: 0;
|
|
9
|
+
`,te=j(I);export{te as RequestDetails};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as h,Fragment as u,jsxs as E}from"react/jsx-runtime";import{memo as O}from"react";import{useAtom as g}from"jotai";import{ExampleSwitch as v,useExampleKey as j}from"../Samples/index.js";import{useActivateExample as w,useTelemetry as K}from"../../hooks/index.js";import{operationStore as b}from"../../jotai/operation.js";function C({mediaType:e,mediaContent:l,renderSample:r}){const m=K(),p=e.operation.pointer,[n,i]=g(b(p)),s=e.examples||e.formExamples||{},t=Object.keys(s),x=w(l),{exampleKey:c}=j(e.operation,s),a=t[n.activeOneOf[e?.examplesPointer||e.operation.pointer]]||c;return!t.length||t.length===1?r():E(u,{children:[h(v,{examples:s,exampleKey:a,onChange:o=>{const f=e.examplesPointer&&e.examplesPointer.startsWith(e.operation.pointer)?e.examplesPointer:e.operation.pointer;m.sendExamplesSwitcherClickedMessage([{id:"examples-switcher-request-body",uri:window.location.href,object:"examples_switcher",exampleNumber:t.indexOf(o),totalExamples:t.length}]),i({...n,activeExampleName:o,activeOneOf:{...n.activeOneOf,[f]:t.indexOf(o)},requestValues:{body:null}}),x(o)}}),r(a)]})}const M=O(C);export{M as Example};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as o,jsxs as D}from"react/jsx-runtime";import{memo as T,useCallback as L,useMemo as k}from"react";import{useAtomValue as y,useAtom as
|
|
1
|
+
import{jsx as o,jsxs as D}from"react/jsx-runtime";import{memo as T,useCallback as L,useMemo as k}from"react";import{useAtomValue as y,useAtom as _}from"jotai";import{PanelHeader as U}from"@redocly/theme/components/Panel/PanelHeader";import{PayloadSamples as W}from"../PayloadSamples/index.js";import{CodeSample as B}from"./CodeSample.js";import{useCodeSamples as F}from"./useCodeSamples.js";import{isPayloadSample as H}from"../../models/index.js";import{createCodeSampleCopyEvent as O,createLanguageSwitchEvent as V}from"../../events/index.js";import{globalStoreAtom as $}from"../../jotai/store.js";import{ServerListDropdown as z}from"../ServerListDropdown/index.js";import{LanguageDropdown as G}from"../Language/index.js";import{activeMimeNameAtom as J,languageAtom as K}from"../../jotai/app.js";import{Replay as A}from"../Replay/index.js";import{CodeBlockPanel as w}from"../common/index.js";import{useActiveWithFallback as Q,useTelemetry as X}from"../../hooks/index.js";import{operationStore as Y}from"../../jotai/operation.js";import{styled as S}from"../../styled-components.js";function Z({operation:a,disableFooter:P,onPanelToggle:v,...p}){const m=X(),[{activeLanguage:q,languages:c},R]=_(K),{samples:n}=F(a),{parser:d,options:{events:l,corsProxyUrl:g,hideReplay:j}}=y($),i=!P&&!a.isWebhook&&!j&&!a.hideReplay,t=!!c?.length,u=Q(n,q),E=e=>{R(e),m.sendSelectLanguageClickedMessage([{object:"select_language",language:e}]);const r=c?.find(s=>s.key===e);if(l?.codeSamplesLanguageSwitch&&r){const s=V({operation:a,sample:{lang:r.lang,label:r.title}});l.codeSamplesLanguageSwitch(s)}},h=y(J),{activeExampleName:C}=y(Y(a.pointer)),f=L(({lang:e,title:r})=>()=>{const s=O({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:C});m.sendCopyCodeSnippetClickedMessage([{object:"code_snippet",snippetType:"request",language:e}]),l?.codeSamplesCopy?.(s)},[a,m,l,h,C]),b=L(e=>{v?.(e,"request-samples")},[v]),x=()=>D(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:E}),!t&&i&&o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})]}),M=k(()=>{if(i&&t)return o(ae,{children:o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})})},[i,t,a,g,d.definition]),N=k(()=>n.map(e=>e.key===u?o("div",{children:H(e)?o(W,{content:e.requestBodyContent,onCopyClick:f(e),onPanelToggle:b,...p}):o(B,{lang:e.lang,source:e.source,externalSample:e,operation:a,onCopyClick:f(e),...p})},e.key+a.id):null),[u,f,b,a,p,n]);return c&&!n.length?o(w,{className:"panel-request-samples",header:x,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:x,footer:M,isExpandable:!1,children:N}):null}const Ce=T(Z),I=S(U)`
|
|
2
2
|
flex-wrap: nowrap;
|
|
3
3
|
${({withReplay:a})=>a&&"padding: var(--spacing-xs) var(--spacing-sm);"}
|
|
4
4
|
`,ee=S(z)`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{memo as b,useCallback as i}from"react";import{useAtomValue as n}from"jotai";import{PayloadSamples as h,StyledCodeBlock as v}from"../PayloadSamples/index.js";import{createCodeSampleCopyEvent as k}from"../../events/index.js";import{globalOptionsAtom as T}from"../../jotai/store.js";import{Summary as g}from"./Summary.js";import{Tabs as x}from"../Tabs/index.js";import{CodeBlockPanel as N}from"../common/index.js";import{useTelemetry as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{memo as b,useCallback as i}from"react";import{useAtomValue as n}from"jotai";import{PayloadSamples as h,StyledCodeBlock as v}from"../PayloadSamples/index.js";import{createCodeSampleCopyEvent as k}from"../../events/index.js";import{globalOptionsAtom as T}from"../../jotai/store.js";import{Summary as g}from"./Summary.js";import{Tabs as x}from"../Tabs/index.js";import{CodeBlockPanel as N}from"../common/index.js";import{useTelemetry as j,useTranslate as A}from"../../hooks/index.js";import{activeMimeNameAtom as E}from"../../jotai/app.js";import{operationStore as M}from"../../jotai/operation.js";function P({operation:o,activeResponseTab:d,onTabChange:f,onPanelToggle:a}){const m=j(),{events:p}=n(T),y=A(),C=o.responses.filter(e=>e.content?.hasSample??!1),s=o.responses.map(({code:e})=>({key:e,title:e})),r=s?.find(({key:e})=>e===d)||s?.[0],l=n(E),{activeExampleName:c}=n(M(o.pointer)),u=i(()=>{m.sendCopyCodeSnippetClickedMessage([{object:"code_snippet",snippetType:"response"}]);const e=k({operation:o,type:"response",activeMimeName:l,activeExampleName:c});p?.codeSamplesCopy?.(e)},[m,o,p,l,c]),S=i(e=>{a?.(e,"response-samples")},[a]);return C.length?t(N,{className:"panel-response-samples",header:()=>t(g,{tabs:t(x,{tabs:s,activeTab:r,onChange:e=>f(e.key)})}),isExpandable:!1,children:o.responses.map(e=>e.code===r.key?t("div",{"data-testid":"response-payload-sample",children:e?.content?.hasSample?t(h,{content:e.content,onCopyClick:u,onPanelToggle:S}):t(v,{source:y("openapi.noResponseContent","No content")})},e.code):null)}):null}const J=b(P);export{J as ResponseSamples};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{jsx as n,jsxs as
|
|
1
|
+
import{jsx as n,jsxs as s,Fragment as v}from"react/jsx-runtime";import{memo as A,useMemo as L}from"react";import{useLocation as j}from"react-router-dom";import{useAtomValue as w}from"jotai";import{Tabs as F,useTabsState as M}from"../Tabs/index.js";import{ResponseDetails as C}from"./ResponseDetails.js";import{makeDeepLink as N}from"../../services/index.js";import{Row as R,StyledTitle as _}from"./styled.js";import{LinkToField as B}from"../common/LinkToField.js";import{pathIncludesLink as c,hasNestedFields as D}from"../../utils/index.js";import{ExpandAllButton as E}from"../ExpandAllButton/index.js";import{useTranslate as P}from"../../hooks/index.js";import{getActiveMediaType as S}from"../../models/index.js";import{activeMimeNameAtom as $}from"../../jotai/app.js";import{styled as I}from"../../styled-components.js";const oe=A(({responses:i,renderTitle:f,operationId:a,operationPointer:d,activeResponseTab:m,onTabChange:u,callbackId:g,onPanelToggle:h})=>{const p=j(),T=P(),l=w($),r=i.map(({code:e})=>({key:e,title:e})),b=r.find(({key:e})=>e===m||c(p,a)&&c(p,`c=${e}`)),{activeTab:k,handleTabChange:x}=M({tabs:r,defaultTab:b?.key,onChange:u}),o=r.find(e=>e.key===(m||k)),t=i.find(e=>e.code===o?.key),y=L(()=>{if(!t?.content)return!1;const{schema:e}=S(t?.content,l)||{};return D(e)},[l,t?.content]);return o?s(v,{children:[s(O,{children:[f?.(o)||s(_,{children:[n(B,{to:N(a,`response&c=${o.key}`)}),T("openapi.responses","Responses")]}),n(F,{tabs:r,activeTab:o,onChange:x}),y&&n(E,{type:"response",operationPointer:d,onPanelToggle:h})]}),t?n("div",{children:n(C,{response:t,operationId:a,callbackId:g})},t.code):null]}):null}),O=I(R)`
|
|
2
2
|
flex-wrap: wrap;
|
|
3
3
|
gap: var(--spacing-unit);
|
|
4
|
+
margin-top: var(--spacing-xl);
|
|
4
5
|
`;export{oe as OperationResponseList};
|
|
@@ -15,8 +15,10 @@ import{Title as t}from"../common/OperationItemTitle.js";import{Markdown as e}fro
|
|
|
15
15
|
align-items: center;
|
|
16
16
|
margin-top: var(--spacing-base);
|
|
17
17
|
`,l=i(t)`
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
&& {
|
|
19
|
+
margin: 0 var(--spacing-sm) 0 0;
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
20
22
|
`,g=i(e)`
|
|
21
23
|
margin-top: var(--spacing-xs);
|
|
22
24
|
`;export{n as HeadersCaption,p as Row,g as StyledDescription,s as StyledHeadersProperties,l as StyledTitle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{useState as d,useEffect as p}from"react";import{MimeLabel as h,Container as x,Select as v}from"../common/index.js";import{SelectOrLabel as S}from"../SelectOrLabel/index.js";import{normalizeText as b}from"../../utils/index.js";const O=({exampleKey:o,examples:n,onChange:l,className:c})=>{const a=Object.keys(n),t=o?a.indexOf(o):0,[m,s]=d(t>-1?t:0);p(()=>s(t>-1?t:0),[o,t]);const r=a.map((e,f)=>({value:b(n[e].summary)||e,idx:f})),u=({idx:e})=>{s(e),l(a[e])};return r.length<2?null:i(x,{"data-testid":"example-switch",className:c,children:i(S,{Select:v,Label:h,variant:"dark",fullWidth:!0,options:r,value:r[m]?.value,onChange:u})})};export{O as ExampleSwitch};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{memo as S}from"react";import{useAtomValue as g}from"jotai";import{useLocation as I}from"react-router-dom";import{ArraySchema as b}from"./ArraySchema.js";import{ObjectSchema as p}from"./ObjectSchema.js";import{OneOfSchema as C}from"./OneOfSchema.js";import{RecursiveSchema as s}from"./RecursiveSchema.js";import{operationStore as j}from"../../jotai/operation.js";import{FieldDetails as A}from"../PropertyDetails/index.js";import{pathIncludesLink as L}from"../../utils/index.js";import{styled as P}from"../../styled-components.js";function k({schema:e,onDiscriminatorChange:u,onOneOfChange:n,...i}){const{activeOneOf:d}=g(j(e?.operationPointer||"")),h=I();if(!e)return null;const{type:t,oneOf:o,discriminatorProp:f,isCircular:O}=e;if(O)return r(s,{schema:e});if(f!==void 0){if(!o||!o.length)return console.warn(`Looks like you are using discriminator wrong: you don't have any definition inherited from the ${e.title}`),null;const m=o.findIndex((N,y)=>L(h,`d=${y}`)),l=m===-1?0:m,x=d[e.pointer]!==void 0?d[e.pointer]:l,a=o[x];return a?.isCircular?r(s,{schema:a}):r(p,{...i,schema:a,discriminator:{fieldName:f,parentSchema:e,activeOneOfIdx:l,onChange:u},onOneOfChange:n})}if(o!==void 0&&o.length
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{memo as S}from"react";import{useAtomValue as g}from"jotai";import{useLocation as I}from"react-router-dom";import{ArraySchema as b}from"./ArraySchema.js";import{ObjectSchema as p}from"./ObjectSchema.js";import{OneOfSchema as C}from"./OneOfSchema.js";import{RecursiveSchema as s}from"./RecursiveSchema.js";import{operationStore as j}from"../../jotai/operation.js";import{FieldDetails as A}from"../PropertyDetails/index.js";import{pathIncludesLink as L}from"../../utils/index.js";import{styled as P}from"../../styled-components.js";function k({schema:e,onDiscriminatorChange:u,onOneOfChange:n,...i}){const{activeOneOf:d}=g(j(e?.operationPointer||"")),h=I();if(!e)return null;const{type:t,oneOf:o,discriminatorProp:f,isCircular:O}=e;if(O)return r(s,{schema:e});if(f!==void 0){if(!o||!o.length)return console.warn(`Looks like you are using discriminator wrong: you don't have any definition inherited from the ${e.title}`),null;const m=o.findIndex((N,y)=>L(h,`d=${y}`)),l=m===-1?0:m,x=d[e.pointer]!==void 0?d[e.pointer]:l,a=o[x];return a?.isCircular?r(s,{schema:a}):r(p,{...i,schema:a,discriminator:{fieldName:f,parentSchema:e,activeOneOfIdx:l,onChange:u},onOneOfChange:n})}if(o!==void 0&&o.length>=1)return r(C,{...i,schema:e,onChange:n});const c=Array.isArray(t)?t:[t];if(c.includes("object")){if(e.fields?.length)return r(p,{...i,schema:e,onOneOfChange:n})}else if(c.includes("array"))return r(b,{...i,schema:e,onOneOfChange:n});const v={schema:e,name:"",description:i.oneOfLevel?"":e.description,required:!1,deprecated:!1};return r(w,{children:r(A,{field:v,fieldParentsName:i.fieldParentsName})})}const H=S(k),w=P.div`
|
|
2
2
|
width: 100%;
|
|
3
3
|
padding: var(--spacing-xxs) 0;
|
|
4
4
|
border-bottom: 1px solid var(--border-color-primary);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import{jsx as o,jsxs as S}from"react/jsx-runtime";import{memo as C,useCallback as
|
|
1
|
+
import{jsx as o,jsxs as S}from"react/jsx-runtime";import{memo as C,useCallback as k,useMemo as A}from"react";import{LayoutVariant as j}from"@redocly/config";import{useAtom as D,useAtomValue as x}from"jotai";import{useWriteAtom as N}from"../../jotai/use-write-atom.js";import{SamplesMiddlePanel as T,SamplesPanel as E,Row as P,Section as b,CodeBlockPanel as w}from"../common/index.js";import{getMediaType as I}from"../../models/index.js";import{MediaTypeSamples as L}from"../PayloadSamples/index.js";import{Schema as V}from"../Schema/index.js";import{Markdown as W}from"../Markdown/index.js";import{layoutAtom as _}from"../../jotai/app.js";import{globalStoreAtom as $}from"../../jotai/store.js";import{operationStore as O}from"../../jotai/operation.js";import{styled as g}from"../../styled-components.js";import{SchemaCatalogLink as B}from"../SchemaCatalogLink/SchemaCatalogLink.js";const K=(t,i)=>{if(!t)return{};const n={schema:{$ref:t}};return i&&(n.examples={example:{$ref:i}}),n};function q({schemaRef:t,exampleRef:i,showReadOnly:n=!0,showWriteOnly:v=!1}){const s=x(_),{parser:c,options:p}=x($),l=N(),e=A(()=>I(c,"json",!1,K(t,i),p,{operation:{pointer:"SchemaDefinitionComponent"}}),[i,p,c,t]),[d,f]=D(O(e.operation?.pointer)),y=k(r=>{if(!e.schema)return;const a=e.schema,u=a.oneOf;if(u&&e?.examples&&Object.keys(e?.examples).includes(r)){const m=u.findIndex(M=>M.title===r);m!==-1&&a&&l(O(a.operationPointer),{activeExampleName:a.oneOf?.[m]?.title,activeOneOf:{[a.pointer]:m}})}d.activeExampleName!==r&&f({activeExampleName:r})},[e?.examples,e.schema,d.activeExampleName,f,l]),h=s===j.STACKED;return o(b,{className:"schema-definition",children:S(P,{layout:s,children:[S(F,{isStacked:h,children:[t&&o(B,{schemaRef:t}),e.schema?.description&&o(z,{children:o(W,{source:e.schema?.description})}),o(V,{skipWriteOnly:!v,skipReadOnly:!n,schema:e.schema,level:1})]}),o(E,{isStacked:h,children:o(w,{className:"panel-response-samples",children:o(L,{mediaType:e,onChange:y})})})]})})}const re=C(q),z=g.div`
|
|
2
2
|
margin-bottom: var(--spacing-vertical);
|
|
3
|
-
|
|
3
|
+
`,F=g(T)`
|
|
4
|
+
padding-left: 0;
|
|
5
|
+
padding-right: 0;
|
|
6
|
+
`;export{re as SchemaDefinition};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as m,Fragment as x}from"react/jsx-runtime";import{useMemo as p}from"react";import{useAtomValue as d}from"jotai";import{LayoutVariant as c}from"@redocly/config";import{breakpoints as S}from"@redocly/theme/core/openapi";import{OpenApiHeader as u}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader";import{PageFooter as k}from"../PageFooter/index.js";import{globalOptionsAtom as b}from"../../jotai/store.js";import{RenderHook as w}from"../RenderHook/index.js";import{RightPanel as y}from"../RightPanel/index.js";import{layoutAtom as C}from"../../jotai/app.js";import{Row as B,SamplesMiddlePanel as R,SamplesPanel as j}from"../common/index.js";import{Items as f}from"../ContentItems/Items.js";import{ContentItem as g}from"../ContentItem/index.js";import{styled as l}from"../../styled-components.js";function J({items:e,hideFooterAndHeader:n}){const{unstable_hooks:{MiddlePanelHeader:a},routingBasePath:i}=d(b),s=d(C),o=s===c.STACKED,P=p(()=>n?null:t(h,{isStacked:o,children:t(k,{})}),[n,o]),v=p(()=>n||!u&&!a?null:t(h,{isStacked:o,children:a?t(w,{Hook:a,props:void 0}):t(u,{})}),[a,n,o]);return e.length===0?null:m(x,{children:[v,m(A,{layout:s,children:[t(M,{layout:s,children:e.filter(({type:r})=>r==="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id))}),t(_,{isStacked:o,tabIndex:0,children:t(y,{item:e[0]})})]}),e.filter(({type:r})=>r!=="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id)),P]})}const h=l(R)`
|
|
2
2
|
align-self: flex-start;
|
|
3
3
|
padding-top: var(--panel-gap-vertical);
|
|
4
4
|
padding-bottom: var(--panel-gap-vertical);
|
|
5
|
-
`,
|
|
5
|
+
`,M=l.div`
|
|
6
6
|
width: 100%;
|
|
7
7
|
|
|
8
|
-
@media screen and (min-width: ${
|
|
8
|
+
@media screen and (min-width: ${S.large}) {
|
|
9
9
|
width: ${({layout:e})=>e===c.STACKED?"100%":"calc(100% - var(--panel-samples-width))"};
|
|
10
10
|
}
|
|
11
|
-
`,_=
|
|
11
|
+
`,_=l(j)`
|
|
12
12
|
margin: var(--spacing-base) 0;
|
|
13
|
-
|
|
13
|
+
`,A=l(B)`
|
|
14
|
+
padding-bottom: var(--spacing-xl);
|
|
15
|
+
`;export{_ as RightPanelContainer,M as SectionContainer,J as SectionContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as l,jsxs as p}from"react/jsx-runtime";import{memo as d}from"react";import{LayoutVariant as
|
|
1
|
+
import{jsx as t,Fragment as l,jsxs as p}from"react/jsx-runtime";import{memo as d}from"react";import{LayoutVariant as f}from"@redocly/config";import{SamplesMiddlePanel as a,Row as u}from"../common/index.js";import{Markdown as h}from"../Markdown/index.js";import{ExternalDocumentation as x}from"../ExternalDocumentation/index.js";function S({item:o,layout:s}){const{externalDocs:r,ast:i,description:c}=o,e=s===f.STACKED,n=!o.parent||o.parent.type!=="tag";return p(l,{children:[t(h,{ast:i,source:c,htmlWrap:m=>t(a,{fullWidth:n,isStacked:e,children:m})}),r&&t(u,{children:t(a,{compact:!0,fullWidth:n,isStacked:e,children:t(x,{externalDocs:r})})})]})}const _=d(S);export{_ as SectionItem};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
-
import type { OpenAPISecurityScheme } from '../../types/index.js';
|
|
3
2
|
import type { SecurityRequirement } from '../../models/index.js';
|
|
4
|
-
type
|
|
3
|
+
import type { OAuth2Flow, OAuth2Flows } from '../../types/index.js';
|
|
5
4
|
interface OAuthScopesMainProps {
|
|
6
5
|
id: string;
|
|
7
6
|
securities: SecurityRequirement[];
|
|
8
|
-
|
|
7
|
+
flow?: OAuth2Flow;
|
|
8
|
+
flows?: OAuth2Flows;
|
|
9
9
|
}
|
|
10
10
|
export declare const OAuthScopes: import("react").NamedExoticComponent<PropsWithChildren<OAuthScopesMainProps>>;
|
|
11
11
|
export {};
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as c,Fragment as g}from"react/jsx-runtime";import{memo as f,useState as u}from"react";import{ChevronRightIcon as S}from"@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon";import{Markdown as h}from"../Markdown/index.js";import{SecuritySchemeItem as l}from"./SecuritySchemeItem.js";import{Tag as v}from"./styled.js";import{useTranslate as x}from"../../hooks/index.js";import{getOptionalScopes as y,getRequiredScopes as O}from"./helper.js";import{styled as t}from"../../styled-components.js";import{ScopeTagWithTooltip as b}from"./ScopeTagWithTooltip.js";import{RequiredScopesList as w}from"./RequiredScopesList.js";import{normalizeScopes as C}from"../../utils/security-scope.js";const j=24;function q({id:e,securities:n,flow:a,flows:r}){const i=O(e,n);return a?o(z,{flow:a,requiredScopes:i}):o(I,{children:o(w,{schemeId:e,securities:n,flows:r})})}function z({flow:e,requiredScopes:n}){const a=x(),[r,i]=u(!1),m=Object.keys(e.scopes||{}),d=C(n),p=y(d,m);return p.length===0?null:c(g,{children:[o(l,{label:c(R,{onClick:()=>{i(s=>!s)},children:[a(r?"openapi.hideOptionalScopes":"openapi.showOptionalScopes",r?"Hide optional scopes":"Show optional scopes"),o(_,{isOpen:r,children:o(S,{size:"var(--font-size-base)",color:"var(--tree-content-color-default)"})})]}),value:" "}),o(T,{isOpen:r,children:p.map(s=>o(l,{label:o(b,{className:"tag-grey",text:s,maxChars:j,TagComponent:A,compact:!0}),value:o(W,{children:o(h,{source:e.scopes[s]||""})})},s))})]})}const A=t(v)`
|
|
2
2
|
font-family: var(--font-family-base);
|
|
3
3
|
font-size: var(--font-size-base);
|
|
4
|
-
line-height: var(--line-height-base);
|
|
5
4
|
align-self: flex-start;
|
|
6
5
|
padding: 0 var(--spacing-xs);
|
|
7
6
|
border: var(--tag-border-width) var(--tag-border-style) var(--tag-bg-color);
|
|
8
7
|
border-radius: var(--tag-border-radius);
|
|
9
|
-
|
|
8
|
+
color: var(--color-warm-grey-8);
|
|
9
|
+
`,R=t.div`
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
display: flex;
|
|
12
12
|
gap: var(--spacing-xxs);
|
|
13
13
|
align-items: center;
|
|
14
14
|
user-select: none;
|
|
15
|
-
`,
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-wrap: wrap;
|
|
18
|
-
gap: var(--spacing-xxs);
|
|
19
|
-
word-break: normal;
|
|
20
|
-
`,z=i.div`
|
|
15
|
+
`,T=t.div`
|
|
21
16
|
max-height: ${e=>e.isOpen?"1000px":"0"};
|
|
22
17
|
opacity: ${e=>e.isOpen?"1":"0"};
|
|
23
18
|
overflow: hidden;
|
|
24
19
|
transition:
|
|
25
20
|
max-height 0.5s ease-in-out,
|
|
26
21
|
opacity 0.5s ease-in-out;
|
|
27
|
-
`,
|
|
22
|
+
`,_=t.span`
|
|
28
23
|
display: inline-flex;
|
|
29
24
|
align-items: center;
|
|
30
25
|
justify-content: center;
|
|
31
26
|
transform: ${e=>e.isOpen?"rotate(90deg)":"rotate(0deg)"};
|
|
32
27
|
transition: transform 0.5s ease-in-out;
|
|
33
|
-
`,
|
|
28
|
+
`,I=t.div`
|
|
29
|
+
margin-top: var(--spacing-xs);
|
|
30
|
+
`,W=t.div`
|
|
31
|
+
p {
|
|
32
|
+
margin-bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
`,G=f(q);export{G as OAuthScopes};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{styled as o}from"../../styled-components.js";import{normalizeScopes as m}from"../../utils/security-scope.js";import{useTranslate as g}from"../../hooks/index.js";import{ScopeTagWithTooltip as c}from"./ScopeTagWithTooltip.js";const l=4,S=32;function j({scopes:d}){const t=g(),s=m(d);if(s.length===0)return null;const h=s.slice(0,l),a=s.slice(l),n=a.length;return r(x,{children:[e(p,{children:"("}),r(u,{children:[t("openapi.requiredScopes","Required scopes"),":"," "]}),r(f,{children:[h.map(i=>e(c,{className:"tag-grey",text:i,maxChars:S},i)),n>0&&e(c,{arrowPosition:"left",className:"tag-grey",text:`+${n}`,tip:e(v,{children:a.map(i=>e("div",{children:i},i))}),ariaLabel:t("openapi.showMoreScopes",`Show ${n} more scopes`)})]}),e(p,{children:")"})]})}const x=o.span`
|
|
2
|
+
display: inline;
|
|
3
|
+
margin-left: var(--spacing-xxs);
|
|
4
|
+
`,u=o.span`
|
|
5
|
+
color: var(--color-warm-grey-8);
|
|
6
|
+
line-height: var(--line-height-base);
|
|
7
|
+
`,f=o.span`
|
|
8
|
+
display: inline;
|
|
9
|
+
padding: 0 var(--spacing-xxs);
|
|
10
|
+
`,v=o.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--spacing-xxs);
|
|
14
|
+
`,p=o.span`
|
|
15
|
+
color: var(--text-color-description);
|
|
16
|
+
line-height: var(--line-height-base);
|
|
17
|
+
`;export{j as RequiredScopes};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { SecurityRequirement } from '../../models/index.js';
|
|
3
|
+
import type { OAuth2Flows } from '../../types/index.js';
|
|
4
|
+
interface RequiredScopesListProps {
|
|
5
|
+
schemeId: string;
|
|
6
|
+
securities: SecurityRequirement[];
|
|
7
|
+
flows?: OAuth2Flows;
|
|
8
|
+
TagComponent?: ComponentType<{
|
|
9
|
+
className?: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare function RequiredScopesList({ schemeId, securities, flows, TagComponent, }: RequiredScopesListProps): ReactElement | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{jsx as r,Fragment as g,jsxs as u}from"react/jsx-runtime";import{SecuritySchemeItem as s}from"./SecuritySchemeItem.js";import{useTranslate as f}from"../../hooks/index.js";import{getRequiredScopes as S}from"./helper.js";import{normalizeScopes as b,buildScopeDescriptionIndex as v}from"../../utils/security-scope.js";import{ScopeTagWithTooltip as x}from"./ScopeTagWithTooltip.js";import{Tag as h}from"./styled.js";import{Markdown as y}from"../Markdown/index.js";import{styled as i}from"../../styled-components.js";const T=24;function A({schemeId:n,securities:m,flows:o,TagComponent:c=q}){const p=f(),l=S(n,m),t=b(l);if(t.length===0)return null;const a=o?v(o):null,d=!!a;return u(g,{children:[r(s,{label:p("openapi.requiredScopes","Required scopes"),value:" "}),t.map(e=>r(s,{label:r(x,{className:"tag-grey",text:e,maxChars:T,TagComponent:c,compact:!0}),value:d?r(_,{children:r(y,{source:a?.get(e)||""})}):" "},e))]})}const _=i.div`
|
|
2
|
+
p {
|
|
3
|
+
margin-bottom: 0;
|
|
4
|
+
}
|
|
5
|
+
`,q=i(h)`
|
|
6
|
+
font-family: var(--font-family-base);
|
|
7
|
+
font-size: var(--font-size-base);
|
|
8
|
+
align-self: flex-start;
|
|
9
|
+
padding: 0 var(--spacing-xs);
|
|
10
|
+
border: var(--tag-border-width) var(--tag-border-style) var(--tag-bg-color);
|
|
11
|
+
border-radius: var(--tag-border-radius);
|
|
12
|
+
color: var(--color-warm-grey-8);
|
|
13
|
+
`;export{A as RequiredScopesList};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
2
|
+
type TagComponentProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
interface ScopeTagWithTooltipProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
text: string;
|
|
9
|
+
maxChars?: number;
|
|
10
|
+
tip?: string | ReactNode;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
TagComponent?: ComponentType<TagComponentProps>;
|
|
13
|
+
arrowPosition?: 'left' | 'right' | 'center';
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function ScopeTagWithTooltip({ className, text, maxChars, tip, ariaLabel, TagComponent, arrowPosition, compact, }: ScopeTagWithTooltipProps): ReactElement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{css as l}from"styled-components";import{Tooltip as h}from"@redocly/theme/components/Tooltip/Tooltip";import{styled as a}from"../../styled-components.js";import{getVisibleScopeLabel as b,isScopeTruncated as v}from"../../utils/security-scope.js";import{Tag as g}from"./styled.js";function k({className:i,text:r,maxChars:n=32,tip:s,ariaLabel:f,TagComponent:t=g,arrowPosition:u="center",compact:o=!1}){const c=b(r,n),d=s===void 0&&v(r,n)?r:s;return d?e(m,{$compact:o,children:e(h,{placement:"bottom",arrowPosition:u,tip:d,children:e(T,{role:"button",tabIndex:0,"aria-label":f??r,children:e(t,{className:i,children:e(p,{$compact:o,children:c})})})})}):e(m,{$compact:o,children:e(t,{className:i,children:e(p,{$compact:o,children:c})})})}const p=a.span`
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
font-family: var(--font-family-base);
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
text-overflow: ellipsis;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
max-width: 16rem;
|
|
8
|
+
color: var(--color-warm-grey-8);
|
|
9
|
+
${({$compact:i})=>!i&&l`
|
|
10
|
+
&&& {
|
|
11
|
+
font-size: var(--font-size-sm);
|
|
12
|
+
}
|
|
13
|
+
`}
|
|
14
|
+
`,T=a.span`
|
|
15
|
+
cursor: default;
|
|
16
|
+
|
|
17
|
+
&:focus-visible {
|
|
18
|
+
outline: 1px solid var(--link-color-primary);
|
|
19
|
+
border-radius: var(--border-radius-md);
|
|
20
|
+
}
|
|
21
|
+
`,m=a.span`
|
|
22
|
+
display: inline-block;
|
|
23
|
+
vertical-align: baseline;
|
|
24
|
+
line-height: var(--line-height-base);
|
|
25
|
+
${({$compact:i})=>i?l`
|
|
26
|
+
margin: 0;
|
|
27
|
+
`:l`
|
|
28
|
+
margin: calc(var(--spacing-unit) / 2) var(--spacing-xxs) calc(var(--spacing-unit) / 2) 0;
|
|
29
|
+
&:last-child {
|
|
30
|
+
margin-right: 0;
|
|
31
|
+
}
|
|
32
|
+
`}
|
|
33
|
+
`;export{k as ScopeTagWithTooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,Fragment as f,jsxs as y}from"react/jsx-runtime";import{useState as h,useRef as C}from"react";import{Portal as b}from"@redocly/theme/components/Portal/Portal";import{useModalScrollLock as w}from"@redocly/theme/core/openapi";import{SecurityButton as M}from"./SecurityButton.js";import{SecurityModal as S}from"./SecurityModal.js";import{useTelemetry as g}from"../../hooks/index.js";function _({securities:t}){const[i,c]=h(!1),l=g(),e=C(null);if(w(i),!t.length)return null;const m=()=>{const o=t.flatMap(s=>s.schemes),n=[...new Set(o.map(s=>s.type))],u=o.length,a=n.length>1,p=Date.now();e.current={securityTypes:n,schemesCount:u,isCombined:a,modalOpenTime:p},l.sendViewSecurityDetailsClickedMessage({id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:n,schemesCount:u,isCombined:a}),c(!0)},d=()=>{if(e.current){const o=Date.now()-e.current.modalOpenTime;l.sendViewSecurityDetailsClosedMessage({id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:e.current.securityTypes,schemesCount:e.current.schemesCount,isCombined:e.current.isCombined,timeInModalMs:o}),e.current=null}c(!1)};return y(f,{children:[r(M,{securities:t,onClick:m}),i&&r(b,{mountId:"api-content",children:r(S,{securities:t,onClose:d})})]})}export{_ as Security};
|
|
1
|
+
import{jsx as r,Fragment as f,jsxs as y}from"react/jsx-runtime";import{useState as h,useRef as C}from"react";import{Portal as b}from"@redocly/theme/components/Portal/Portal";import{useModalScrollLock as w}from"@redocly/theme/core/openapi";import{SecurityButton as M}from"./SecurityButton.js";import{SecurityModal as S}from"./SecurityModal.js";import{useTelemetry as g}from"../../hooks/index.js";function _({securities:t}){const[i,c]=h(!1),l=g(),e=C(null);if(w(i),!t.length)return null;const m=()=>{const o=t.flatMap(s=>s.schemes),n=[...new Set(o.map(s=>s.type))],u=o.length,a=n.length>1,p=Date.now();e.current={securityTypes:n,schemesCount:u,isCombined:a,modalOpenTime:p},l.sendViewSecurityDetailsClickedMessage([{id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:n,schemesCount:u,isCombined:a}]),c(!0)},d=()=>{if(e.current){const o=Date.now()-e.current.modalOpenTime;l.sendViewSecurityDetailsClosedMessage([{id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:e.current.securityTypes,schemesCount:e.current.schemesCount,isCombined:e.current.isCombined,timeInModalMs:o}]),e.current=null}c(!1)};return y(f,{children:[r(M,{securities:t,onClick:m}),i&&r(b,{mountId:"api-content",children:r(S,{securities:t,onClose:d})})]})}export{_ as Security};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
${({deprecated:a})=>a&&
|
|
3
|
-
display: flex;
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Fragment as d}from"react";import{SecurityIcon as v}from"@redocly/theme/icons/SecurityIcon/SecurityIcon";import{Panel as u}from"@redocly/theme/components/Panel/Panel";import{Button as b}from"@redocly/theme/components/Button/Button";import{Tooltip as y}from"@redocly/theme/components/Tooltip/Tooltip";import{WarningFilledIcon as x}from"@redocly/theme/icons/WarningFilledIcon/WarningFilledIcon";import{useTranslate as w}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";import{deprecatedCss as S}from"../common/index.js";import{RequiredScopes as j}from"./RequiredScopes.js";function W({securities:a,onClick:m}){const o=w();return e(T,{header:()=>i(B,{children:[e(v,{}),e(D,{children:o("openapi.security","Security")}),e(C,{onClick:m,variant:"link",children:o("openapi.viewSecurityDetails","View details")})]}),isExpandable:!1,children:e(H,{children:a.map((t,n)=>{const s=a.length>1&&t.schemes.length>1,h=t.schemes.map(({id:l,scopes:g,deprecated:c=!1},f)=>i(d,{children:[i(k,{deprecated:c,children:[l,c&&e(y,{tip:o("openapi.badges.deprecated","Deprecated"),children:e(x,{color:"var(--badge-deprecated-bg-color)"})})]}),e(j,{scopes:g}),f<t.schemes.length-1&&e(p,{children:" and "})]},l));return i(d,{children:[s?"(":"",h,s?")":"",n<a.length-1&&e(p,{children:" or "})]},n)})})})}const k=r.span`
|
|
2
|
+
${({deprecated:a})=>a&&S}
|
|
3
|
+
display: inline-flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
gap: var(--spacing-xxs);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`,j=e(u)`
|
|
6
|
+
font-weight: var(--font-weight-medium);
|
|
7
|
+
`,T=r(u)`
|
|
9
8
|
margin-top: var(--spacing-base);
|
|
10
9
|
border: var(--panel-border);
|
|
11
10
|
border-radius: var(--panel-border-radius);
|
|
12
|
-
`,
|
|
11
|
+
`,B=r.div`
|
|
13
12
|
display: flex;
|
|
14
13
|
align-items: center;
|
|
15
14
|
justify-content: space-between;
|
|
@@ -19,19 +18,20 @@ import{jsx as r,jsxs as o}from"react/jsx-runtime";import{Fragment as d}from"reac
|
|
|
19
18
|
background-color: var(--layer-color);
|
|
20
19
|
border-bottom: var(--panel-border);
|
|
21
20
|
border-radius: var(--panel-border-radius) var(--panel-border-radius) 0 0;
|
|
22
|
-
`,
|
|
21
|
+
`,C=r(b)`
|
|
23
22
|
margin-left: auto;
|
|
24
23
|
font-size: var(--font-size-sm);
|
|
25
|
-
`,
|
|
24
|
+
`,D=r.span`
|
|
26
25
|
font-family: var(--font-family-base);
|
|
27
26
|
font-weight: var(--font-weight-medium);
|
|
28
27
|
color: var(--text-color-primary);
|
|
29
|
-
`,
|
|
30
|
-
|
|
31
|
-
text-overflow: ellipsis;
|
|
28
|
+
`,H=r.div`
|
|
29
|
+
display: block;
|
|
32
30
|
overflow: hidden;
|
|
33
31
|
padding: var(--spacing-xs) var(--spacing-sm);
|
|
34
32
|
color: var(--text-color-primary);
|
|
35
|
-
|
|
33
|
+
line-height: var(--line-height-base);
|
|
34
|
+
`,p=r.span`
|
|
36
35
|
color: var(--text-color-description);
|
|
37
|
-
|
|
36
|
+
line-height: var(--line-height-base);
|
|
37
|
+
`;export{W as SecurityButton};
|
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import{jsx as e,
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as p}from"react/jsx-runtime";import{Badge as z}from"@redocly/theme/components/Badge/Badge";import{SecuritySchemeItem as n}from"./SecuritySchemeItem.js";import{titleize as A}from"../../utils/index.js";import{OAuthFlow as L}from"./OAuthFlow.js";import{StyledLink as v,Tag as O}from"./styled.js";import{Markdown as _}from"../Markdown/index.js";import{useTranslate as w}from"../../hooks/index.js";import{OAuthScopes as b}from"./OAuthScopes.js";import{styled as o}from"../../styled-components.js";import{RequiredScopesList as g}from"./RequiredScopesList.js";const j=["authorizationCode","clientCredentials","implicit","password","deviceAuthorization"];function k({flowType:l,flow:m,schemeId:h,securities:a}){const c=w();return r(p,{children:[e(n,{label:r(H,{className:"tag-grey",children:[e(N,{children:c("openapi.flowType","Flow type")})," ",e(P,{children:l})]}),value:e("span",{})}),r(C,{children:[e(L,{flow:m}),e(b,{id:h,securities:a,flow:m})]})]})}function V({type:l,bearerFormat:m,name:h,flows:a,openIdConnectUrl:c,description:y,id:t,securities:s,in:x,deprecated:T=!1,oauth2MetadataUrl:f}){const i=w();if(!l||!t)return null;const F={http:r(p,{children:[e(n,{label:i("openapi.httpAuthorizationScheme","HTTP Authorization Scheme"),value:l}),e(n,{label:i("openapi.bearerFormat","Bearer Format"),value:m}),e(g,{schemeId:t,securities:s,flows:a})]}),apiKey:r(p,{children:[e(n,{label:`${A(x||"")} ${i("openapi.parameterName","parameter name")}:`,value:h}),e(g,{schemeId:t,securities:s,flows:a})]}),oauth2:r(p,{children:[a&&Object.entries(a).filter(d=>{const[u,S]=d;return!!S&&j.includes(u)}).map(([d,u])=>e(k,{flowType:d,flow:u,schemeId:t,securities:s},d)),e(b,{id:t,securities:s,flows:a})]}),openIdConnect:r(p,{children:[e(n,{label:i("openapi.connectUrl","Connect URL"),value:c&&e(v,{target:"_blank",rel:"noopener noreferrer",href:c,children:c})}),e(g,{schemeId:t,securities:s,flows:a})]})};return r(W,{children:[r(I,{children:[e(R,{children:t}),T&&e(z,{deprecated:!0,children:i("openapi.badges.deprecated","Deprecated")})]}),e(_,{source:y}),f&&e(n,{label:i("openapi.oauth2MetadataUrl","OAuth2 Metadata URL"),value:e(v,{target:"_blank",rel:"noopener noreferrer",href:f,children:f})}),e(B,{children:F[l]||null})]})}const I=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--spacing-xxs);
|
|
5
5
|
margin: 0 0 var(--spacing-xs);
|
|
6
|
-
`,
|
|
6
|
+
`,W=o.div`
|
|
7
7
|
background: var(--layer-color);
|
|
8
8
|
padding: var(--spacing-base);
|
|
9
9
|
border-radius: var(--border-radius);
|
|
10
10
|
border: 1px solid var(--border-color-secondary);
|
|
11
11
|
width: 100%;
|
|
12
12
|
margin-top: var(--spacing-base);
|
|
13
|
-
`,
|
|
13
|
+
`,B=o.div`
|
|
14
14
|
width: 100%;
|
|
15
15
|
margin-top: var(--spacing-md);
|
|
16
|
-
`,
|
|
16
|
+
`,R=o.p`
|
|
17
17
|
font-size: var(--font-size-base);
|
|
18
18
|
margin: 0;
|
|
19
19
|
text-transform: capitalize;
|
|
20
20
|
font-weight: var(--font-weight-semibold);
|
|
21
|
-
|
|
21
|
+
`,C=o.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
padding-left: var(--spacing-xs);
|
|
25
|
+
margin-bottom: var(--spacing-xxs);
|
|
26
|
+
`,H=o(O)`
|
|
27
|
+
color: var(--color-warm-grey-8);
|
|
28
|
+
font-family: var(--font-family-base);
|
|
29
|
+
`,N=o.span`
|
|
30
|
+
font-weight: var(--font-weight-regular);
|
|
31
|
+
`,P=o.span`
|
|
32
|
+
color: var(--color-warm-grey-11);
|
|
33
|
+
font-weight: var(--font-weight-medium);
|
|
34
|
+
`;export{V as SecurityFlow};
|