@redocly/openapi-docs 3.15.0-next.4 → 3.15.0-next.6

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.
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p,useCallback as f}from"react";import{DownloadIcon as x}from"@redocly/theme/icons/DownloadIcon/DownloadIcon";import{getPathPrefix as g,combineUrls as w}from"@redocly/theme/core/openapi";import{Button as b}from"@redocly/theme/components/Button/Button";import{DocumentIcon as h}from"@redocly/theme/icons/DocumentIcon/DocumentIcon";import{JsonIcon as u}from"@redocly/theme/icons/JsonIcon/JsonIcon";import{FileIcon as v}from"@redocly/theme/icons/FileIcon/FileIcon";import{useTelemetry as y}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";function k({downloadObjects:t}){const l=y(),n=g(),c=f(o=>{switch(o){case"yaml":return e(h,{});case"json":return e(u,{});default:return e(v,{})}},[]);return t?e(C,{children:(t||[]).map(({title:o,url:a,iconType:m})=>{const i=n?w(n,a):a;return s(D,{onClick:()=>{l.sendOpenapiDocsDownloadDefinitionClickedMessage()},children:[s(j,{children:[c(m),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:e(b,{variant:"text",size:"small",icon:e(x,{})})})]},o)})}):e(d,{})}const N=p(k),D=r.div`
1
+ import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p,useCallback as f}from"react";import{DownloadIcon as x}from"@redocly/theme/icons/DownloadIcon/DownloadIcon";import{getPathPrefix as g,combineUrls as w}from"@redocly/theme/core/openapi";import{Button as b}from"@redocly/theme/components/Button/Button";import{DocumentIcon as h}from"@redocly/theme/icons/DocumentIcon/DocumentIcon";import{JsonIcon as u}from"@redocly/theme/icons/JsonIcon/JsonIcon";import{FileIcon as v}from"@redocly/theme/icons/FileIcon/FileIcon";import{useTelemetry as y}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";function k({downloadObjects:t}){const l=y(),n=g(),c=f(o=>{switch(o){case"yaml":return e(h,{});case"json":return e(u,{});default:return e(v,{})}},[]);return t?e(C,{children:(t||[]).map(({title:o,url:a,iconType:m})=>{const i=n?w(n,a):a;return s(j,{onClick:()=>{l.sendDownloadDefinitionClickedMessage()},children:[s(D,{children:[c(m),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:e(b,{variant:"text",size:"small",icon:e(x,{})})})]},o)})}):e(d,{})}const N=p(k),j=r.div`
2
2
  display: flex;
3
3
  align-items: baseline;
4
4
  justify-content: space-between;
@@ -10,7 +10,7 @@ import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p
10
10
  padding-bottom: 0px;
11
11
  border-bottom: none;
12
12
  }
13
- `,j=r.span`
13
+ `,D=r.span`
14
14
  display: flex;
15
15
  width: calc(100% - 25px);
16
16
  gap: var(--spacing-xs);
@@ -1,3 +1,3 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useAtom as m}from"jotai";import{MaximizeIcon as d}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 k=({operationPointer:a,type:e,onPanelToggle:s})=>{const t=f(),[l,r]=m(x(a)),i=u(),p=()=>{const o=!l[e].expandedAll;i.sendOpenapiDocsExpandCollapseAllClickedMessage({isExpanded:o}),r({[e]:{expandedAll:o}}),s?.(o,e==="request"?"request":"responses")};return n(g,{icon:n(d,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:p,children:l[e].expandedAll?t("openapi.collapseAll","Collapse all"):t("openapi.expandAll","Expand all")})},g=A(c)`
1
+ import{jsx as n}from"react/jsx-runtime";import{useAtom as m}from"jotai";import{MaximizeIcon as d}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 k=({operationPointer:a,type:e,onPanelToggle:s})=>{const t=f(),[l,r]=m(x(a)),i=u(),p=()=>{const o=!l[e].expandedAll;i.sendExpandCollapseAllClickedMessage({isExpanded:o}),r({[e]:{expandedAll:o}}),s?.(o,e==="request"?"request":"responses")};return n(g,{icon:n(d,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:p,children:l[e].expandedAll?t("openapi.collapseAll","Collapse all"):t("openapi.expandAll","Expand all")})},g=A(c)`
2
2
  margin-left: auto;
3
3
  `;export{k as ExpandAllButton};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as I}from"react/jsx-runtime";import{useLayoutEffect as T,useRef as A,useState as L,useCallback as S,memo as j,useMemo as D}from"react";import{useAtomValue as E,useSetAtom as H}from"jotai";import{Button as V}from"@redocly/theme/components/Button/Button";import{OverflowMenuVerticalIcon as W}from"@redocly/theme/icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon";import{LanguageDropdown as v}from"./LanguageDropdown.js";import{languageAtom as R,layoutAtom as _}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(),f=A(null),g=E(_),h=H(R),p=e=>{u.sendOpenapiDocsSelectLanguageClickedMessage({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=S(()=>{const e=f?.current?.offsetWidth;if(!e)return;const{newVisibleItems:m,newHiddenItems:r}=q(e,[...o]),c=r.findIndex(b=>b.key===t);c!==-1&&y(m,r,c),i(m),l(r)},[t,o]);T(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[g,t]);const x=D(()=>n.length>=5||s.length?"space-between":"start",[s.length,n.length]);return I(z,{ref:f,children:[I(M,{$justifyContent:x,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(V,{icon:a(W,{}),variant:"text",style:{height:"100%"}}),withArrow:!1,withCheckmark:!1,width:156}):null]})}const se=j($);function q(o,t){let n=0;const i=[],s=[];return t.forEach((l,u)=>{const g=u===t.length-1&&s.length===0?0:B;o&&n+w+g<=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
+ import{jsx as a,jsxs as I}from"react/jsx-runtime";import{useLayoutEffect as T,useRef as A,useState as L,useCallback as S,memo as j,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 v}from"@redocly/theme/icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon";import{LanguageDropdown as D}from"./LanguageDropdown.js";import{languageAtom as R,layoutAtom as _}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(),f=A(null),g=H(_),h=V(R),p=e=>{u.sendSelectLanguageClickedMessage({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=S(()=>{const e=f?.current?.offsetWidth;if(!e)return;const{newVisibleItems:m,newHiddenItems:r}=q(e,[...o]),c=r.findIndex(b=>b.key===t);c!==-1&&y(m,r,c),i(m),l(r)},[t,o]);T(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[g,t]);const x=E(()=>n.length>=5||s.length?"space-between":"start",[s.length,n.length]);return I(z,{ref:f,children:[I(M,{$justifyContent:x,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(D,{activeTab:t,samples:s,onChange:C,trigger:a(W,{icon:a(v,{}),variant:"text",style:{height:"100%"}}),withArrow:!1,withCheckmark:!1,width:156}):null]})}const se=j($);function q(o,t){let n=0;const i=[],s=[];return t.forEach((l,u)=>{const g=u===t.length-1&&s.length===0?0:B;o&&n+w+g<=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 +1 @@
1
- import{jsx as o,jsxs as s,Fragment as C}from"react/jsx-runtime";import{memo as E,useRef as T}from"react";import{LayoutVariant as p}from"@redocly/config";import{useSetAtom as w}from"jotai";import{ThreePanelLayout as A}from"@redocly/theme/layouts/ThreePanelLayout";import{SidebarLogo as I}from"@redocly/theme/components/SidebarLogo/SidebarLogo";import{GlobalStyle as j,useMount as D}from"@redocly/theme/core/openapi";import{StoreProvider as M}from"./Providers.js";import{Overlay as N}from"../Overlay.js";import{RedocWrap as _}from"./styled.js";import{StickyResponsiveSidebar as V}from"../StickySidebar/index.js";import{SideMenu as k}from"../SideMenu/index.js";import{Content as v}from"../Content/index.js";import{useContentItems as B,useUppercase2LowercaseRedirect as K,useTelemetry as F,usePerformanceMetrics as H}from"../../hooks/index.js";import{withRouter as U}from"../../hoc/withRouter.js";import{withStore as Y}from"../../hoc/withStore.js";import{compose as G}from"../../utils/index.js";import{useLicense as W}from"../../hooks/useLicense.js";import{allOperationsAtom as q}from"../../jotai/replay.js";const z=G(U,Y,E)(({licenseKey:m,onLoaded:a,children:e,options:t,layout:i,collapsedSidebar:d,parser:c,withCommonStyles:y})=>{const b=T(null),{isValid:l,licenseInfo:g}=W(m),R=w(q),u=F();K();const{contentItems:h,flatItems:S}=B({parser:c,options:t});H({sendTelemetry:f=>{const r=Object.fromEntries(Object.entries(f).map(([O,x])=>[O.toLowerCase(),x]));u.sendOpenapiDocsPerformanceMetricsMessage({cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb})}}),D(()=>{if(a?.(),u.sendOpenapiDocsViewedMessage({layout:i}),!t.hideReplay){const f=S.filter(r=>r.type==="operation");R(f)}});const{hideSidebar:P,scrollYOffset:L}=t||{},n=c.definition?.info?.["x-logo"];return s(C,{children:[y&&o(j,{}),s(_,{className:"redoc-wrap",ref:b,children:[!l&&o(N,{licenseInfo:g}),!P&&s(V,{scrollYOffset:L,className:"menu-content",collapsedSidebar:!d,children:[o(I,{imageUrl:n?.url,href:n?.href||c.definition?.info?.contact?.url,altText:n?.altText,backgroundColor:n?.backgroundColor}),o(k,{items:l?h:[]})]}),s(A,{className:"api-content",id:"api-content",layout:i===p.THREE_PANEL?p.THREE_PANEL:p.STACKED,collapsedSidebar:d,children:[o(v,{items:l?h:[],routingBasePath:t.routingBasePath}),e]})]})]})});function ue({onLoaded:m,children:a,store:e,withCommonStyles:t,router:i}){return e?.definition?o(M,{...e,children:o(z,{onLoaded:m,basePath:e.options?.routingBasePath,licenseKey:e.options?.licenseKey,disableRouter:e.options?.disableRouter,withCommonStyles:t,router:i,children:a})}):null}export{ue as RedoclyOpenAPIDocs};
1
+ import{jsx as o,jsxs as s,Fragment as E}from"react/jsx-runtime";import{memo as O,useRef as T}from"react";import{LayoutVariant as p}from"@redocly/config";import{useSetAtom as w}from"jotai";import{ThreePanelLayout as A}from"@redocly/theme/layouts/ThreePanelLayout";import{SidebarLogo as I}from"@redocly/theme/components/SidebarLogo/SidebarLogo";import{GlobalStyle as j,useMount as M}from"@redocly/theme/core/openapi";import{StoreProvider as N}from"./Providers.js";import{Overlay as _}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 v}from"../Content/index.js";import{useContentItems as B,useUppercase2LowercaseRedirect as K,useTelemetry as F,usePerformanceMetrics as H}from"../../hooks/index.js";import{withRouter as U}from"../../hoc/withRouter.js";import{withStore as Y}from"../../hoc/withStore.js";import{compose as G}from"../../utils/index.js";import{useLicense as W}from"../../hooks/useLicense.js";import{allOperationsAtom as q}from"../../jotai/replay.js";const z=G(U,Y,O)(({licenseKey:m,onLoaded:a,children:e,options:t,layout:i,collapsedSidebar:d,parser:c,withCommonStyles:y})=>{const b=T(null),{isValid:l,licenseInfo:g}=W(m),R=w(q),u=F();K();const{contentItems:h,flatItems:S}=B({parser:c,options:t});H({sendTelemetry:f=>{const r=Object.fromEntries(Object.entries(f).map(([x,C])=>[x.toLowerCase(),C]));u.sendPerformanceMetricsMessage({cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb})}}),M(()=>{if(a?.(),u.sendViewedMessage({layout:i}),!t.hideReplay){const f=S.filter(r=>r.type==="operation");R(f)}});const{hideSidebar:P,scrollYOffset:L}=t||{},n=c.definition?.info?.["x-logo"];return s(E,{children:[y&&o(j,{}),s(D,{className:"redoc-wrap",ref:b,children:[!l&&o(_,{licenseInfo:g}),!P&&s(V,{scrollYOffset:L,className:"menu-content",collapsedSidebar:!d,children:[o(I,{imageUrl:n?.url,href:n?.href||c.definition?.info?.contact?.url,altText:n?.altText,backgroundColor:n?.backgroundColor}),o(k,{items:l?h:[]})]}),s(A,{className:"api-content",id:"api-content",layout:i===p.THREE_PANEL?p.THREE_PANEL:p.STACKED,collapsedSidebar:d,children:[o(v,{items:l?h:[],routingBasePath:t.routingBasePath}),e]})]})]})});function ue({onLoaded:m,children:a,store:e,withCommonStyles:t,router:i}){return e?.definition?o(N,{...e,children:o(z,{onLoaded:m,basePath:e.options?.routingBasePath,licenseKey:e.options?.licenseKey,disableRouter:e.options?.disableRouter,withCommonStyles:t,router:i,children:a})}):null}export{ue as RedoclyOpenAPIDocs};
@@ -1 +1 @@
1
- import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as J,memo as K,Suspense as W,useCallback as m,useRef as w,useState as H}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=J(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/useConfigureReplay";import{globalOptionsAtom as ne,globalStoreAtom as ae}from"../../jotai/store.js";import{allOperationsAtom as se,replayStateAtom as ie}from"../../jotai/replay.js";import{allOperations as le,getDefaultOperationStore as me}from"../../jotai/operation.js";import{LOADING_STATE as n}from"../../constants.js";import{environmentAtom as pe,userClaimsAtom as ce}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as fe}from"./utils.js";import{useTranslate as ue,useTelemetry as de}from"../../hooks/index.js";import{JsonPointer as ye}from"../../utils/index.js";import{getDefaultCollectorUrl as he}from"../../utils/telemetry.js";import{createTryItOpenEvent as Oe,createTryItSentEvent as Ie}from"../../events/index.js";import{joinWithSeparator as Re}from"../../services/history/helpers.js";function ge({operation:e,corsProxyUrl:L,fullOpenApi:d}){const y=ue(),P=de(),h=w(null),{mockServer:q,oAuth2RedirectURI:E,routingBasePath:c}=p(ne),O=p(se),{parser:I,options:{events:a}}=p(ae),R=p(ce),[s,N]=H(!1),[l,g]=u(ie),[v,A]=u(le),[[,V],S]=u(pe),{config:j,refresh:T}=re({userClaims:R,info:I?.definition.info,operation:{name:e.name,path:e.path,operationId:e.operationId||"",href:e.href,method:e.httpVerb},servers:e.servers},s);Z(h),$(s);const x=m(()=>T(),[T]),k=m(({operations:t,environment:i,environments:f})=>{const _=t.reduce((C,r)=>{r.requestValues.body=r.requestValues.body instanceof URLSearchParams?Object.fromEntries(r.requestValues.body.entries()):r.requestValues.body;const{path:F,method:B}=r.apiPath,b=ye.compile(["paths",F,B]);return C[b]=Q(me(b),r),C},{});A({...v,..._}),S({environment:i,environments:f})},[v,A,S]),D=()=>{if(l!==n.LOADING){if(!s&&(P.sendOpenapiDocsTryItOpenedMessage(),a?.tryItOpen&&e)){const t=Oe({operation:e});a.tryItOpen(t)}N(!s)}l===n.NOT_LOADED&&g(n.LOADING)},G=m(t=>{if(a?.tryItSent&&e){const i=Ie({operation:e,isSuccess:t});a.tryItSent(i)}},[a,e]),U=m(t=>{if(!t)return;const i=O.find(f=>f.operationId===t);return Re(c,i?.href)},[O,c]);return d?z(M,{children:[o(Y,{onClick:D,variant:"primary",iconPosition:"left",icon:l===n.LOADING?o(te,{}):o(ee,{}),children:l===n.LOADING?y("openapi.loading","Loading..."):y("openapi.tryIt","Try it")}),s&&o(W,{children:o(oe,{mountId:"api-content",children:o("div",{ref:h,children:o(X,{activeOperationId:e.operationId||e.pointer,api:d,onRequestChange:k,onClose:D,onLoad:()=>g(n.LOADED),settings:{corsProxyUrl:L,mockServer:q,selectedEnvironment:V,apiId:I?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:E,disableCollectionsTab:!0,storageKey:c,telemetry:{tracerName:"try-it",collectorUrl:he()},convertOperationToReplayValue:fe(R,j),getOperationUrl:U,onRequestReset:x},onRequestSent:G})})})})]}):null}const Me=K(ge);export{Me as Replay};
1
+ import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as J,memo as K,Suspense as W,useCallback as m,useRef as w,useState as H}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=J(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/useConfigureReplay";import{globalOptionsAtom as ne,globalStoreAtom as ae}from"../../jotai/store.js";import{allOperationsAtom as se,replayStateAtom as ie}from"../../jotai/replay.js";import{allOperations as le,getDefaultOperationStore as me}from"../../jotai/operation.js";import{LOADING_STATE as n}from"../../constants.js";import{environmentAtom as pe,userClaimsAtom as ce}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as fe}from"./utils.js";import{useTranslate as ue,useTelemetry as de}from"../../hooks/index.js";import{JsonPointer as ye}from"../../utils/index.js";import{getDefaultCollectorUrl as he}from"../../utils/telemetry.js";import{createTryItOpenEvent as Oe,createTryItSentEvent as Ie}from"../../events/index.js";import{joinWithSeparator as Re}from"../../services/history/helpers.js";function ge({operation:e,corsProxyUrl:L,fullOpenApi:d}){const y=ue(),P=de(),h=w(null),{mockServer:q,oAuth2RedirectURI:E,routingBasePath:c}=p(ne),O=p(se),{parser:I,options:{events:a}}=p(ae),R=p(ce),[s,N]=H(!1),[l,g]=u(ie),[v,A]=u(le),[[,V],S]=u(pe),{config:j,refresh:T}=re({userClaims:R,info:I?.definition.info,operation:{name:e.name,path:e.path,operationId:e.operationId||"",href:e.href,method:e.httpVerb},servers:e.servers},s);Z(h),$(s);const x=m(()=>T(),[T]),k=m(({operations:t,environment:i,environments:f})=>{const _=t.reduce((C,r)=>{r.requestValues.body=r.requestValues.body instanceof URLSearchParams?Object.fromEntries(r.requestValues.body.entries()):r.requestValues.body;const{path:F,method:B}=r.apiPath,b=ye.compile(["paths",F,B]);return C[b]=Q(me(b),r),C},{});A({...v,..._}),S({environment:i,environments:f})},[v,A,S]),D=()=>{if(l!==n.LOADING){if(!s&&(P.sendTryItOpenedMessage(),a?.tryItOpen&&e)){const t=Oe({operation:e});a.tryItOpen(t)}N(!s)}l===n.NOT_LOADED&&g(n.LOADING)},G=m(t=>{if(a?.tryItSent&&e){const i=Ie({operation:e,isSuccess:t});a.tryItSent(i)}},[a,e]),U=m(t=>{if(!t)return;const i=O.find(f=>f.operationId===t);return Re(c,i?.href)},[O,c]);return d?z(M,{children:[o(Y,{onClick:D,variant:"primary",iconPosition:"left",icon:l===n.LOADING?o(te,{}):o(ee,{}),children:l===n.LOADING?y("openapi.loading","Loading..."):y("openapi.tryIt","Try it")}),s&&o(W,{children:o(oe,{mountId:"api-content",children:o("div",{ref:h,children:o(X,{activeOperationId:e.operationId||e.pointer,api:d,onRequestChange:k,onClose:D,onLoad:()=>g(n.LOADED),settings:{corsProxyUrl:L,mockServer:q,selectedEnvironment:V,apiId:I?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:E,disableCollectionsTab:!0,storageKey:c,telemetry:{tracerName:"try-it",collectorUrl:he()},convertOperationToReplayValue:fe(R,j),getOperationUrl:U,onRequestReset:x},onRequestSent:G})})})})]}):null}const Me=K(ge);export{Me as Replay};
@@ -1 +1 @@
1
- import{jsx as c,Fragment as f,jsxs as h}from"react/jsx-runtime";import{memo as u}from"react";import{useAtom as E}from"jotai";import{ExampleSwitch as g,useExampleKey as O}from"../Samples/index.js";import{useActivateExample as j,useTelemetry as C}from"../../hooks/index.js";import{operationStore as d}from"../../jotai/operation.js";function v({mediaType:o,mediaContent:p,renderSample:n}){const r=C(),m=o.operation.pointer,[l,x]=E(d(m)),a=o.examples||{},e=Object.keys(a),i=j(p),{exampleKey:s}=O(o.operation,a);return!e.length||e.length===1?n():h(f,{children:[c(g,{examples:a,exampleKey:s,onChange:t=>{r.sendOpenapiDocsExamplesSwitcherClickedMessage({example:t,numberOfExamples:e.length}),x({...l,activeExampleName:t,activeOneOf:{[m]:e.indexOf(t)},requestValues:{body:null}}),i(t)}}),n(s)]})}const N=u(v);export{N as Example};
1
+ import{jsx as c,Fragment as f,jsxs as h}from"react/jsx-runtime";import{memo as u}from"react";import{useAtom as E}from"jotai";import{ExampleSwitch as g,useExampleKey as O}from"../Samples/index.js";import{useActivateExample as d,useTelemetry as j}from"../../hooks/index.js";import{operationStore as C}from"../../jotai/operation.js";function v({mediaType:o,mediaContent:r,renderSample:m}){const l=j(),n=o.operation.pointer,[p,x]=E(C(n)),a=o.examples||{},e=Object.keys(a),i=d(r),{exampleKey:s}=O(o.operation,a);return!e.length||e.length===1?m():h(f,{children:[c(g,{examples:a,exampleKey:s,onChange:t=>{l.sendExamplesSwitcherClickedMessage({exampleNumber:e.indexOf(t),totalExamples:e.length}),x({...p,activeExampleName:t,activeOneOf:{[n]:e.indexOf(t)},requestValues:{body:null}}),i(t)}}),m(s)]})}const F=u(v);export{F as Example};
@@ -1,4 +1,4 @@
1
- import{jsx as o,jsxs as N}from"react/jsx-runtime";import{memo as T,useCallback as L,useMemo as k}from"react";import{useAtomValue as y,useAtom as O}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 _,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]=O(K),{samples:n}=F(a),{parser:d,options:{events:l,corsProxyUrl:g,hideReplay:E}}=y($),i=!P&&!a.isWebhook&&!E&&!a.hideReplay,t=!!c?.length,u=Q(n,q),j=e=>{R(e),m.sendOpenapiDocsSelectLanguageClickedMessage({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=_({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:C});m.sendCopyCodeSnippetClickedMessage({snippetType:"request",language:e}),l?.codeSamplesCopy?.(s)},[a,m,l,h,C]),x=L(e=>{v?.(e,"request-samples")},[v]),b=()=>N(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:j}),!t&&i&&o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})]}),D=k(()=>{if(i&&t)return o(ae,{children:o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})})},[i,t,a,g,d.definition]),M=k(()=>n.map(e=>e.key===u?o("div",{children:H(e)?o(W,{content:e.requestBodyContent,onCopyClick:f(e),onPanelToggle:x,...p}):o(B,{lang:e.lang,source:e.source,externalSample:e,operation:a,onCopyClick:f(e),...p})},e.key+a.id):null),[u,f,x,a,p,n]);return c&&!n.length?o(w,{className:"panel-request-samples",header:b,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:b,footer:D,isExpandable:!1,children:M}):null}const Ce=T(Z),I=S(U)`
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 U}from"jotai";import{PanelHeader as W}from"@redocly/theme/components/Panel/PanelHeader";import{PayloadSamples as B}from"../PayloadSamples/index.js";import{CodeSample as F}from"./CodeSample.js";import{useCodeSamples as H}from"./useCodeSamples.js";import{isPayloadSample as O}from"../../models/index.js";import{createCodeSampleCopyEvent as _,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]=U(K),{samples:n}=H(a),{parser:d,options:{events:l,corsProxyUrl:g,hideReplay:E}}=y($),i=!P&&!a.isWebhook&&!E&&!a.hideReplay,t=!!c?.length,u=Q(n,q),j=e=>{R(e),m.sendSelectLanguageClickedMessage({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=_({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:C});m.sendCopyCodeSnippetClickedMessage({snippetType:"request",language:e}),l?.codeSamplesCopy?.(s)},[a,m,l,h,C]),x=L(e=>{v?.(e,"request-samples")},[v]),b=()=>D(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:j}),!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:O(e)?o(B,{content:e.requestBodyContent,onCopyClick:f(e),onPanelToggle:x,...p}):o(F,{lang:e.lang,source:e.source,externalSample:e,operation:a,onCopyClick:f(e),...p})},e.key+a.id):null),[u,f,x,a,p,n]);return c&&!n.length?o(w,{className:"panel-request-samples",header:b,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:b,footer:M,isExpandable:!1,children:N}):null}const Ce=T(Z),I=S(W)`
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 n}from"react/jsx-runtime";import{useState as d,useEffect as h}from"react";import{MimeLabel as x,Container as v,Select as S}from"../common/index.js";import{SelectOrLabel as b}from"../SelectOrLabel/index.js";import{normalizeText as g}from"../../utils/index.js";import{useTelemetry as O}from"../../hooks/index.js";const I=({exampleKey:s,examples:o,onChange:m,className:i})=>{const c=O(),t=Object.keys(o),r=s?t.indexOf(s):0,[p,l]=d(r>-1?r:0);h(()=>l(r>-1?r:0),[s,r]);const a=t.map((e,f)=>({value:g(o[e].summary)||e,idx:f})),u=({idx:e})=>{c.sendOpenapiDocsExamplesSwitcherClickedMessage({example:t[e],numberOfExamples:t.length}),l(e),m(t[e])};return a.length<2?null:n(v,{"data-testid":"example-switch",className:i,children:n(b,{Select:S,Label:x,variant:"dark",fullWidth:!0,options:a,value:a[p]?.value,onChange:u})})};export{I as ExampleSwitch};
1
+ import{jsx as n}from"react/jsx-runtime";import{useState as d,useEffect as h}from"react";import{MimeLabel as x,Container as v,Select as S}from"../common/index.js";import{SelectOrLabel as b}from"../SelectOrLabel/index.js";import{normalizeText as g}from"../../utils/index.js";import{useTelemetry as C}from"../../hooks/index.js";const L=({exampleKey:a,examples:s,onChange:m,className:i})=>{const c=C(),r=Object.keys(s),t=a?r.indexOf(a):0,[u,l]=d(t>-1?t:0);h(()=>l(t>-1?t:0),[a,t]);const o=r.map((e,f)=>({value:g(s[e].summary)||e,idx:f})),p=({idx:e})=>{c.sendExamplesSwitcherClickedMessage({exampleNumber:e,totalExamples:r.length}),l(e),m(r[e])};return o.length<2?null:n(v,{"data-testid":"example-switch",className:i,children:n(b,{Select:S,Label:x,variant:"dark",fullWidth:!0,options:o,value:o[u]?.value,onChange:p})})};export{L as ExampleSwitch};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useMemo as f,useCallback as l}from"react";import{useAtom as S,useAtomValue as g}from"jotai";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as y}from"@redocly/theme/components/Dropdown/Dropdown";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as A,Path as C,StyledCopyButton as b,StyledDropdownMenuItem as D}from"./styled.js";import{PanelItem as P}from"../PanelItem/index.js";import{joinWithSeparator as j}from"../../services/index.js";import{getServerDisplayName as x,replaceVariables as V}from"../../utils/index.js";import{environmentAtom as M}from"../../jotai/app.js";import{useActiveWithFallback as E,useTelemetry as N}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as W}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const X=({operation:r,className:h})=>{const n=N(),[[v],i]=S(M),{options:{events:m}}=g(I),s=E(r.servers.map(e=>({...e,key:e.url})),v.server),a=l(e=>{e.stopPropagation()},[]),c=l(e=>()=>{if(r.servers.length!==1&&(i({environment:p(e)}),n.sendOpenapiDocsSwitchServersClickedMessage({server:p(e)}),m?.targetServerSwitch&&e)){const o=W({operation:r,serverUrl:e.url});m.targetServerSwitch(o)}},[r,i,n,m]),u=f(()=>r.servers.map(e=>{const o=j(V(e),r.path);return t(D,{onAction:c(e),children:t(P,{header:x(e),title:o,actions:[t(b,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:e.url===s,withCheckmark:!0})},o)}),[r.servers,r.path,c,a,s]);return t(y,{className:h,trigger:d(A,{variant:"ghost",children:[t(k,{color:r.httpVerb,children:r.httpVerb}),t(C,{children:r.path})]}),withArrow:!0,children:t(w,{children:u})})};export{X as ServerListDropdown};
1
+ import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useMemo as f,useCallback as c}from"react";import{useAtom as S,useAtomValue as g}from"jotai";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as y}from"@redocly/theme/components/Dropdown/Dropdown";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as A,Path as C,StyledCopyButton as b,StyledDropdownMenuItem as P}from"./styled.js";import{PanelItem as j}from"../PanelItem/index.js";import{joinWithSeparator as x}from"../../services/index.js";import{getServerDisplayName as D,replaceVariables as V}from"../../utils/index.js";import{environmentAtom as M}from"../../jotai/app.js";import{useActiveWithFallback as E,useTelemetry as N}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as W}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const X=({operation:e,className:h})=>{const n=N(),[[v],i]=S(M),{options:{events:m}}=g(I),s=E(e.servers.map(r=>({...r,key:r.url})),v.server),a=c(r=>{r.stopPropagation()},[]),l=c(r=>()=>{if(e.servers.length!==1&&(i({environment:p(r)}),n.sendSwitchServersClickedMessage({server:p(r)}),m?.targetServerSwitch&&r)){const o=W({operation:e,serverUrl:r.url});m.targetServerSwitch(o)}},[e,i,n,m]),u=f(()=>e.servers.map(r=>{const o=x(V(r),e.path);return t(P,{onAction:l(r),children:t(j,{header:D(r),title:o,actions:[t(b,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:r.url===s,withCheckmark:!0})},o)}),[e.servers,e.path,l,a,s]);return t(y,{className:h,trigger:d(A,{variant:"ghost",children:[t(k,{color:e.httpVerb,children:e.httpVerb}),t(C,{children:e.path})]}),withArrow:!0,children:t(w,{children:u})})};export{X as ServerListDropdown};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.15.0-next.4",
3
+ "version": "3.15.0-next.6",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@markdoc/markdoc": "0.5.2",
24
- "@redocly/openapi-core": "2.5.1",
24
+ "@redocly/openapi-core": "2.7.0",
25
25
  "deepmerge": "^4.2.2",
26
26
  "dompurify": "3.2.7",
27
27
  "fast-deep-equal": "^3.1.3",
@@ -36,8 +36,8 @@
36
36
  "url-template": "^2.0.8",
37
37
  "util": "~0.12.5",
38
38
  "web-vitals": "3.3.1",
39
- "@redocly/config": "0.36.0",
40
- "@redocly/replay": "0.18.0-next.4"
39
+ "@redocly/config": "0.36.1",
40
+ "@redocly/replay": "0.18.0-next.6"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "29.5.0",
@@ -75,7 +75,7 @@
75
75
  "typescript": "5.9.3",
76
76
  "url": "~0.11.0",
77
77
  "vite": "7.1.9",
78
- "@redocly/theme": "0.59.0-next.3"
78
+ "@redocly/theme": "0.59.0-next.5"
79
79
  },
80
80
  "scripts": {
81
81
  "start": "npm run copy-highlight-hook && vite",