@redocly/openapi-docs 3.18.0-next.7 → 3.18.0-next.9

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,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.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)`
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{k as ExpandAllButton};
3
+ `;export{_ 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 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
+ 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 +1 @@
1
- import{jsx as t,jsxs as s,Fragment as C}from"react/jsx-runtime";import{memo as O,useRef as T,useEffect as w}from"react";import{LayoutVariant as d}from"@redocly/config";import{useSetAtom as A}from"jotai";import{ThreePanelLayout as I}from"@redocly/theme/layouts/ThreePanelLayout";import{SidebarLogo as j}from"@redocly/theme/components/SidebarLogo/SidebarLogo";import{GlobalStyle as M,useMount as N}from"@redocly/theme/core/openapi";import{StoreProvider as _}from"./Providers.js";import{Overlay as D}from"../Overlay.js";import{RedocWrap as V}from"./styled.js";import{StickyResponsiveSidebar as k}from"../StickySidebar/index.js";import{SideMenu as v}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,O)(({licenseKey:m,onLoaded:a,children:e,options:o,layout:i,collapsedSidebar:u,parser:c,withCommonStyles:g})=>{const R=T(null),{isValid:l,licenseInfo:S}=q(m),h=A(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,x])=>[E.toLowerCase(),x]));y.sendPerformanceMetricsMessage({cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb})}}),w(()=>{if(!o.hideReplay&&f.length>0){const p=f.filter(r=>r.type==="operation");h(p)}},[f,o.hideReplay,h]),N(()=>{a?.(),y.sendViewedMessage({layout:i})});const{hideSidebar:P,scrollYOffset:L}=o||{},n=c.definition?.info?.["x-logo"];return s(C,{children:[g&&t(M,{}),s(V,{className:"redoc-wrap",ref:R,children:[!l&&t(D,{licenseInfo:S}),!P&&s(k,{scrollYOffset:L,className:"menu-content",collapsedSidebar:!u,children:[t(j,{imageUrl:n?.url,href:n?.href||c.definition?.info?.contact?.url,altText:n?.altText,backgroundColor:n?.backgroundColor}),t(v,{items:l?b:[]})]}),s(I,{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(_,{...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
+ 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 +1 @@
1
- import{jsx as E,Fragment as h,jsxs as u}from"react/jsx-runtime";import{memo as O}from"react";import{useAtom as g}from"jotai";import{ExampleSwitch as v,useExampleKey as K}from"../Samples/index.js";import{useActivateExample as j,useTelemetry as C}from"../../hooks/index.js";import{operationStore as P}from"../../jotai/operation.js";function b({mediaType:e,mediaContent:m,renderSample:a}){const l=C(),p=e.operation.pointer,[n,x]=g(P(p)),s=e.examples||e.formExamples||{},t=Object.keys(s),i=j(m),{exampleKey:c}=K(e.operation,s),r=t[n.activeOneOf[e?.examplesPointer||e.operation.pointer]]||c;return!t.length||t.length===1?a():u(h,{children:[E(v,{examples:s,exampleKey:r,onChange:o=>{const f=e.examplesPointer&&e.examplesPointer.startsWith(e.operation.pointer)?e.examplesPointer:e.operation.pointer;l.sendExamplesSwitcherClickedMessage({exampleNumber:t.indexOf(o),totalExamples:t.length}),x({...n,activeExampleName:o,activeOneOf:{...n.activeOneOf,[f]:t.indexOf(o)},requestValues:{body:null}}),i(o)}}),a(r)]})}const M=O(b);export{M as Example};
1
+ import{jsx as h,Fragment as E,jsxs as u}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 K,useTelemetry as C}from"../../hooks/index.js";import{operationStore as b}from"../../jotai/operation.js";function P({mediaType:e,mediaContent:m,renderSample:a}){const l=C(),p=e.operation.pointer,[n,x]=g(b(p)),s=e.examples||e.formExamples||{},t=Object.keys(s),i=K(m),{exampleKey:c}=j(e.operation,s),r=t[n.activeOneOf[e?.examplesPointer||e.operation.pointer]]||c;return!t.length||t.length===1?a():u(E,{children:[h(v,{examples:s,exampleKey:r,onChange:o=>{const f=e.examplesPointer&&e.examplesPointer.startsWith(e.operation.pointer)?e.examplesPointer:e.operation.pointer;l.sendExamplesSwitcherClickedMessage([{object:"examples_switcher",exampleNumber:t.indexOf(o),totalExamples:t.length}]),x({...n,activeExampleName:o,activeOneOf:{...n.activeOneOf,[f]:t.indexOf(o)},requestValues:{body:null}}),i(o)}}),a(r)]})}const M=O(P);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 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)`
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 A,useTranslate as E}from"../../hooks/index.js";import{activeMimeNameAtom as M}from"../../jotai/app.js";import{operationStore as P}from"../../jotai/operation.js";function R({operation:o,activeResponseTab:d,onTabChange:f,onPanelToggle:a}){const m=A(),{events:r}=n(T),y=E(),C=o.responses.filter(e=>e.content?.hasSample??!1),s=o.responses.map(({code:e})=>({key:e,title:e})),p=s?.find(({key:e})=>e===d)||s?.[0],l=n(M),{activeExampleName:c}=n(P(o.pointer)),u=i(()=>{m.sendCopyCodeSnippetClickedMessage({snippetType:"response"});const e=k({operation:o,type:"response",activeMimeName:l,activeExampleName:c});r?.codeSamplesCopy?.(e)},[m,o,r,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:p,onChange:e=>f(e.key)})}),isExpandable:!1,children:o.responses.map(e=>e.code===p.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(R);export{J as ResponseSamples};
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 +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 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
+ import{jsx as m}from"react/jsx-runtime";import{useState as d,useEffect as h}from"react";import{MimeLabel as x,Container as b,Select as v}from"../common/index.js";import{SelectOrLabel as S}from"../SelectOrLabel/index.js";import{normalizeText as g}from"../../utils/index.js";import{useTelemetry as j}from"../../hooks/index.js";const L=({exampleKey:s,examples:o,onChange:n,className:c})=>{const i=j(),r=Object.keys(o),t=s?r.indexOf(s):0,[p,l]=d(t>-1?t:0);h(()=>l(t>-1?t:0),[s,t]);const a=r.map((e,f)=>({value:g(o[e].summary)||e,idx:f})),u=({idx:e})=>{i.sendExamplesSwitcherClickedMessage([{object:"examples_switcher",exampleNumber:e,totalExamples:r.length}]),l(e),n(r[e])};return a.length<2?null:m(b,{"data-testid":"example-switch",className:c,children:m(S,{Select:v,Label:x,variant:"dark",fullWidth:!0,options:a,value:a[p]?.value,onChange:u})})};export{L 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)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`
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 +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 +1 @@
1
- import{jsx as e,jsxs as f}from"react/jsx-runtime";import{useMemo as S,useCallback as c}from"react";import{useAtom as g,useAtomValue as w}from"jotai";import{DropdownMenu as y}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as A}from"@redocly/theme/components/Dropdown/Dropdown";import{getOperationColor as C}from"@redocly/theme/core/openapi";import{HttpVerb as b}from"../common/index.js";import{PathWrapper as k,Path as P,StyledCopyButton as V,StyledDropdownMenuItem as j}from"./styled.js";import{PanelItem as x}from"../PanelItem/index.js";import{joinWithSeparator as D}from"../../services/index.js";import{getServerDisplayName as M,replaceVariables as E}from"../../utils/index.js";import{environmentAtom as N}from"../../jotai/app.js";import{useActiveWithFallback as O,useTelemetry as W}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as I}from"../../events/index.js";import{globalStoreAtom as T}from"../../jotai/store.js";const $=({operation:r,className:h})=>{const n=W(),[[d],m]=g(N),{options:{events:i}}=w(T),s=O(r.servers.map(t=>({...t,key:t.url})),d.server),a=c(t=>{t.stopPropagation()},[]),l=c(t=>()=>{if(r.servers.length!==1&&(m({environment:p(t)}),n.sendSwitchServersClickedMessage({server:p(t)}),i?.targetServerSwitch&&t)){const o=I({operation:r,serverUrl:t.url});i.targetServerSwitch(o)}},[r,m,n,i]),v=S(()=>r.servers.map(t=>{const o=D(E(t),r.path);return e(j,{onAction:l(t),children:e(x,{header:M(t),title:o,actions:[e(V,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:t.url===s,withCheckmark:!0})},o)}),[r.servers,r.path,l,a,s]),u=C({isAdditionalOperation:r.isAdditionalOperation,httpVerb:r.httpVerb});return e(A,{className:h,trigger:f(k,{variant:"ghost",children:[e(b,{color:u,children:r.httpVerb}),e(P,{children:r.path})]}),withArrow:!0,children:e(y,{children:v})})};export{$ as ServerListDropdown};
1
+ import{jsx as e,jsxs as f}from"react/jsx-runtime";import{useMemo as S,useCallback as c}from"react";import{useAtom as g,useAtomValue as w}from"jotai";import{DropdownMenu as y}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as A}from"@redocly/theme/components/Dropdown/Dropdown";import{getOperationColor as C}from"@redocly/theme/core/openapi";import{HttpVerb as b}from"../common/index.js";import{PathWrapper as k,Path as j,StyledCopyButton as P,StyledDropdownMenuItem as V}from"./styled.js";import{PanelItem as x}from"../PanelItem/index.js";import{joinWithSeparator as D}from"../../services/index.js";import{getServerDisplayName as M,replaceVariables as E}from"../../utils/index.js";import{environmentAtom as N}from"../../jotai/app.js";import{useActiveWithFallback as O,useTelemetry as W}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as _}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const $=({operation:r,className:h})=>{const n=W(),[[d],m]=g(N),{options:{events:i}}=w(I),s=O(r.servers.map(t=>({...t,key:t.url})),d.server),a=c(t=>{t.stopPropagation()},[]),l=c(t=>()=>{if(r.servers.length!==1&&(m({environment:p(t)}),n.sendSwitchServersClickedMessage([{object:"switch_servers",server:p(t)}]),i?.targetServerSwitch&&t)){const o=_({operation:r,serverUrl:t.url});i.targetServerSwitch(o)}},[r,m,n,i]),v=S(()=>r.servers.map(t=>{const o=D(E(t),r.path);return e(V,{onAction:l(t),children:e(x,{header:M(t),title:o,actions:[e(P,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:t.url===s,withCheckmark:!0})},o)}),[r.servers,r.path,l,a,s]),u=C({isAdditionalOperation:r.isAdditionalOperation,httpVerb:r.httpVerb});return e(A,{className:h,trigger:f(k,{variant:"ghost",children:[e(b,{color:u,children:r.httpVerb}),e(j,{children:r.path})]}),withArrow:!0,children:e(y,{children:v})})};export{$ as ServerListDropdown};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.18.0-next.7",
3
+ "version": "3.18.0-next.9",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@markdoc/markdoc": "0.5.2",
24
- "@redocly/openapi-core": "0.0.0-snapshot.1769511679",
24
+ "@redocly/openapi-core": "2.15.1",
25
25
  "deepmerge": "^4.2.2",
26
26
  "dompurify": "3.2.7",
27
27
  "fast-deep-equal": "^3.1.3",
28
- "fast-xml-parser": "5.2.5",
28
+ "fast-xml-parser": "5.3.4",
29
29
  "jotai": "^2.12.5",
30
30
  "jotai-family": "^1.0.1",
31
31
  "json-pointer": "^0.6.2",
@@ -39,7 +39,7 @@
39
39
  "util": "~0.12.5",
40
40
  "web-vitals": "3.3.1",
41
41
  "@redocly/config": "0.41.4",
42
- "@redocly/replay": "0.21.0-next.7"
42
+ "@redocly/replay": "0.21.0-next.9"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@shikijs/transformers": "3.21.0",
@@ -72,7 +72,7 @@
72
72
  "url": "~0.11.0",
73
73
  "vite": "7.2.6",
74
74
  "vitest": "4.0.10",
75
- "@redocly/theme": "0.62.0-next.5"
75
+ "@redocly/theme": "0.62.0-next.6"
76
76
  },
77
77
  "scripts": {
78
78
  "start": "pnpm run copy-highlight-hook && vite",
@@ -83,8 +83,7 @@
83
83
  "prepare:community-source-only": "pnpm run prepare:community-source --ignore /src/* private-readme.md",
84
84
  "prepare:community-dependencies": "pnpx tsx scripts/prepare-community-dependencies.ts",
85
85
  "apply:community-source": "pnpx tsx scripts/apply-changes-from-community-source.ts",
86
- "test": "pnpm run prepare:community-source && pnpm run test:redoc && vitest run",
87
- "test:redoc": "cd redoc && npm install ../../theme ../../redocly-config --no-save && npm run lint && npm run unit",
86
+ "test": "vitest run",
88
87
  "unit": "vitest run",
89
88
  "unit:update": "vitest run -u",
90
89
  "unit:watch": "vitest",