@redocly/openapi-docs 3.12.0-next.16 → 3.12.0-next.17

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 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 k=({operationPointer:a,type:e,onPanelToggle:r})=>{const t=f(),[l,s]=d(x(a)),p=u(),i=()=>{const o=!l[e].expandedAll;p.send({type:"openapi_docs.expand_collapse_all.clicked",payload:{is_expanded:o}}),s({[e]:{expandedAll:o}}),r?.(o,e==="request"?"request":"responses")};return n(g,{icon:n(m,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:i,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 j=({operationPointer:a,type:o,onPanelToggle:r})=>{const t=f(),[l,s]=d(x(a)),p=u(),i=()=>{const e=!l[o].expandedAll;p.send({type:"openapi_docs.expand_collapse_all.clicked",payload:{isExpanded:e}}),s({[o]:{expandedAll:e}}),r?.(e,o==="request"?"request":"responses")};return n(g,{icon:n(m,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:i,children:l[o].expandedAll?t("openapi.collapseAll","Collapse all"):t("openapi.expandAll","Expand all")})},g=A(c)`
2
2
  margin-left: auto;
3
- `;export{k as ExpandAllButton};
3
+ `;export{j as ExpandAllButton};
@@ -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 _}from"../Samples/index.js";import{useActivateExample as d,useTelemetry as j}from"../../hooks/index.js";import{operationStore as y}from"../../jotai/operation.js";function O({mediaType:o,mediaContent:p,renderSample:n}){const r=j(),m=o.operation.pointer,[l,x]=E(y(m)),a=o.examples||{},e=Object.keys(a),i=d(p),{exampleKey:s}=_(o.operation,a);return!e.length||e.length===1?n():h(f,{children:[c(g,{examples:a,exampleKey:s,onChange:t=>{r.send({type:"openapi_docs.examples_switcher.clicked",payload:{example:t,number_of_examples:e.length}}),x({...l,activeExampleName:t,activeOneOf:{[m]:e.indexOf(t)},requestValues:{body:null}}),i(t)}}),n(s)]})}const N=u(O);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 d}from"../Samples/index.js";import{useActivateExample as O,useTelemetry as j}from"../../hooks/index.js";import{operationStore as y}from"../../jotai/operation.js";function _({mediaType:o,mediaContent:p,renderSample:n}){const r=j(),m=o.operation.pointer,[l,x]=E(y(m)),a=o.examples||{},e=Object.keys(a),i=O(p),{exampleKey:s}=d(o.operation,a);return!e.length||e.length===1?n():h(f,{children:[c(g,{examples:a,exampleKey:s,onChange:t=>{r.send({type:"openapi_docs.examples_switcher.clicked",payload:{example:t,numberOfExamples:e.length}}),x({...l,activeExampleName:t,activeOneOf:{[m]:e.indexOf(t)},requestValues:{body:null}}),i(t)}}),n(s)]})}const N=u(_);export{N as Example};
@@ -1,4 +1,4 @@
1
- import{jsx as o,jsxs as D}from"react/jsx-runtime";import{memo as M,useCallback as k,useMemo as A}from"react";import{useAtomValue as y,useAtom as T}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 L}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 v}from"../../styled-components.js";function Z({operation:a,disableFooter:P,onPanelToggle:S,...p}){const c=X(),[{activeLanguage:q,languages:m},R]=T(K),{samples:n}=F(a),{parser:d,options:{events:s,corsProxyUrl:g,hideReplay:_}}=y($),i=!P&&!a.isWebhook&&!_&&!a.hideReplay,t=!!m?.length,u=Q(n,q),E=e=>{R(e),c.send({type:"openapi_docs.select_language.clicked",payload:{language:e}});const r=m?.find(l=>l.key===e);if(s?.codeSamplesLanguageSwitch&&r){const l=V({operation:a,sample:{lang:r.lang,label:r.title}});s.codeSamplesLanguageSwitch(l)}},h=y(J),{activeExampleName:x}=y(Y(a.pointer)),f=k(({lang:e,title:r})=>()=>{const l=O({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:x});c.send({type:"openapi_docs.copy_code_snippet.clicked",payload:{snippet_type:"request",language:e}}),s?.codeSamplesCopy?.(l)},[a,c,s,h,x]),b=k(e=>{S?.(e,"request-samples")},[S]),C=()=>D(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:E}),!t&&i&&o(L,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})]}),j=A(()=>{if(i&&t)return o(ae,{children:o(L,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})})},[i,t,a,g,d.definition]),N=A(()=>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 m&&!n.length?o(w,{className:"panel-request-samples",header:C,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:C,footer:j,isExpandable:!1,children:N}):null}const xe=M(Z),I=v(U)`
1
+ import{jsx as o,jsxs as D}from"react/jsx-runtime";import{memo as T,useCallback as k,useMemo as A}from"react";import{useAtomValue as y,useAtom as M}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 L}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 v}from"../../styled-components.js";function Z({operation:a,disableFooter:P,onPanelToggle:S,...p}){const c=X(),[{activeLanguage:q,languages:m},R]=M(K),{samples:n}=F(a),{parser:d,options:{events:s,corsProxyUrl:g,hideReplay:_}}=y($),i=!P&&!a.isWebhook&&!_&&!a.hideReplay,t=!!m?.length,u=Q(n,q),E=e=>{R(e),c.send({type:"openapi_docs.select_language.clicked",payload:{language:e}});const r=m?.find(l=>l.key===e);if(s?.codeSamplesLanguageSwitch&&r){const l=V({operation:a,sample:{lang:r.lang,label:r.title}});s.codeSamplesLanguageSwitch(l)}},h=y(J),{activeExampleName:x}=y(Y(a.pointer)),f=k(({lang:e,title:r})=>()=>{const l=O({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:x});c.send({type:"openapi_docs.copy_code_snippet.clicked",payload:{snippetType:"request",language:e}}),s?.codeSamplesCopy?.(l)},[a,c,s,h,x]),b=k(e=>{S?.(e,"request-samples")},[S]),C=()=>D(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:E}),!t&&i&&o(L,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})]}),j=A(()=>{if(i&&t)return o(ae,{children:o(L,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})})},[i,t,a,g,d.definition]),N=A(()=>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 m&&!n.length?o(w,{className:"panel-request-samples",header:C,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:C,footer:j,isExpandable:!1,children:N}):null}const xe=T(Z),I=v(U)`
2
2
  flex-wrap: nowrap;
3
3
  ${({withReplay:a})=>a&&"padding: var(--spacing-xs) var(--spacing-sm);"}
4
4
  `,ee=v(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 _,useTranslate as A}from"../../hooks/index.js";import{activeMimeNameAtom as E}from"../../jotai/app.js";import{operationStore as P}from"../../jotai/operation.js";function R({operation:o,activeResponseTab:d,onTabChange:y,onPanelToggle:a}){const m=_(),{events:p}=n(T),f=A(),u=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(P(o.pointer)),C=i(()=>{m.send({type:"openapi_docs.copy_code_snippet.clicked",payload:{snippet_type:"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 u.length?t(N,{className:"panel-response-samples",header:()=>t(g,{tabs:t(x,{tabs:s,activeTab:r,onChange:e=>y(e.key)})}),isExpandable:!1,children:o.responses.map(e=>e.code===r.key?t("div",{children:e?.content?.hasSample?t(h,{content:e.content,onCopyClick:C,onPanelToggle:S}):t(v,{source:f("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 _,useTranslate as A}from"../../hooks/index.js";import{activeMimeNameAtom as E}from"../../jotai/app.js";import{operationStore as P}from"../../jotai/operation.js";function R({operation:o,activeResponseTab:d,onTabChange:y,onPanelToggle:a}){const m=_(),{events:p}=n(T),f=A(),u=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(P(o.pointer)),C=i(()=>{m.send({type:"openapi_docs.copy_code_snippet.clicked",payload:{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 u.length?t(N,{className:"panel-response-samples",header:()=>t(g,{tabs:t(x,{tabs:s,activeTab:r,onChange:e=>y(e.key)})}),isExpandable:!1,children:o.responses.map(e=>e.code===r.key?t("div",{children:e?.content?.hasSample?t(h,{content:e.content,onCopyClick:C,onPanelToggle:S}):t(v,{source:f("openapi.noResponseContent","No content")})},e.code):null)}):null}const J=b(R);export{J as ResponseSamples};
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useState as f,useEffect as h}from"react";import{MimeLabel as x,Container as v,Select as b}from"../common/index.js";import{SelectOrLabel as y}from"../SelectOrLabel/index.js";import{normalizeText as S}from"../../utils/index.js";import{useTelemetry as _}from"../../hooks/index.js";const L=({exampleKey:a,examples:s,onChange:m,className:c})=>{const i=_(),t=Object.keys(s),o=a?t.indexOf(a):0,[p,l]=f(o>-1?o:0);h(()=>l(o>-1?o:0),[a,o]);const r=t.map((e,d)=>({value:S(s[e].summary)||e,idx:d})),u=({idx:e})=>{i.send({type:"openapi_docs.examples_switcher.clicked",payload:{example:t[e],number_of_examples:t.length}}),l(e),m(t[e])};return r.length<2?null:n(v,{"data-testid":"example-switch",className:c,children:n(y,{Select:b,Label:x,variant:"dark",fullWidth:!0,options:r,value:r[p]?.value,onChange:u})})};export{L as ExampleSwitch};
1
+ import{jsx as n}from"react/jsx-runtime";import{useState as f,useEffect as h}from"react";import{MimeLabel as x,Container as v,Select as b}from"../common/index.js";import{SelectOrLabel as y}from"../SelectOrLabel/index.js";import{normalizeText as S}from"../../utils/index.js";import{useTelemetry as g}from"../../hooks/index.js";const I=({exampleKey:a,examples:s,onChange:m,className:c})=>{const i=g(),t=Object.keys(s),o=a?t.indexOf(a):0,[p,l]=f(o>-1?o:0);h(()=>l(o>-1?o:0),[a,o]);const r=t.map((e,d)=>({value:S(s[e].summary)||e,idx:d})),u=({idx:e})=>{i.send({type:"openapi_docs.examples_switcher.clicked",payload:{example:t[e],numberOfExamples:t.length}}),l(e),m(t[e])};return r.length<2?null:n(v,{"data-testid":"example-switch",className:c,children:n(y,{Select:b,Label:x,variant:"dark",fullWidth:!0,options:r,value:r[p]?.value,onChange:u})})};export{I as ExampleSwitch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.12.0-next.16",
3
+ "version": "3.12.0-next.17",
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.0.1",
24
+ "@redocly/openapi-core": "2.0.2",
25
25
  "deepmerge": "^4.2.2",
26
26
  "dompurify": "3.2.6",
27
27
  "fast-deep-equal": "^3.1.3",
@@ -37,7 +37,7 @@
37
37
  "util": "~0.12.5",
38
38
  "web-vitals": "3.3.1",
39
39
  "@redocly/config": "0.26.4",
40
- "@redocly/replay": "0.15.0-next.10"
40
+ "@redocly/replay": "0.15.0-next.11"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "29.5.0",
@@ -74,7 +74,7 @@
74
74
  "typescript": "5.6.2",
75
75
  "url": "~0.11.0",
76
76
  "vite": "^6.3.5",
77
- "@redocly/theme": "0.56.0-next.7"
77
+ "@redocly/theme": "0.56.0-next.8"
78
78
  },
79
79
  "scripts": {
80
80
  "start": "npm run copy-highlight-hook && vite",