@redocly/openapi-docs 3.14.0-next.13 → 3.14.0-next.15

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.
Files changed (44) hide show
  1. package/dist/redocly-openapi-docs.min.js +2163 -2093
  2. package/lib/components/ContentItem/ContentItem.js +1 -1
  3. package/lib/components/ContentItems/Items.js +1 -1
  4. package/lib/components/ContentItems/helpers.js +1 -1
  5. package/lib/components/McpOverview/McpOverview.d.ts +5 -0
  6. package/lib/components/McpOverview/McpOverview.js +16 -0
  7. package/lib/components/McpOverview/index.d.ts +1 -0
  8. package/lib/components/McpOverview/index.js +1 -0
  9. package/lib/components/McpTool/McpTool.d.ts +6 -0
  10. package/lib/components/McpTool/McpTool.js +9 -0
  11. package/lib/components/McpTool/index.d.ts +1 -0
  12. package/lib/components/McpTool/index.js +1 -0
  13. package/lib/components/PanelItem/styled.js +1 -0
  14. package/lib/components/RedoclyOpenAPIDocs/Error.d.ts +3 -0
  15. package/lib/components/RedoclyOpenAPIDocs/Error.js +25 -0
  16. package/lib/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  17. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +1 -1
  18. package/lib/components/RightPanel/RightPanel.js +1 -1
  19. package/lib/components/SectionItem/SectionItem.d.ts +1 -1
  20. package/lib/components/ServerList/ServerDescriptionTooltip.d.ts +4 -0
  21. package/lib/components/ServerList/ServerDescriptionTooltip.js +1 -0
  22. package/lib/components/ServerList/ServerList.js +14 -9
  23. package/lib/components/ServerListDropdown/ServerListDropdown.js +1 -1
  24. package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
  25. package/lib/components/TagItem/OperationNavigationItems.js +3 -3
  26. package/lib/components/TagItem/OperationsNavigation.js +2 -2
  27. package/lib/components/TagItem/TagItem.js +17 -7
  28. package/lib/components/TagItem/types.d.ts +2 -2
  29. package/lib/models/group.js +1 -1
  30. package/lib/models/types.d.ts +2 -0
  31. package/lib/services/menu/builder.js +1 -1
  32. package/lib/services/menu/tags.d.ts +1 -0
  33. package/lib/services/menu/tags.js +2 -1
  34. package/lib/services/types.d.ts +1 -1
  35. package/lib/standalone.js +1 -1
  36. package/lib/types/open-api.d.ts +47 -0
  37. package/lib/utils/helpers.d.ts +2 -0
  38. package/lib/utils/helpers.js +4 -4
  39. package/lib/utils/loadAndBundleSpec.js +1 -1
  40. package/lib/utils/mcp.d.ts +3 -0
  41. package/lib/utils/mcp.js +1 -0
  42. package/lib/utils/menu.d.ts +2 -0
  43. package/lib/utils/menu.js +1 -0
  44. package/package.json +4 -4
@@ -1 +1 @@
1
- import{jsx as e,Fragment as m,jsxs as c}from"react/jsx-runtime";import{memo as f}from"react";import{useAtomValue as u}from"jotai";import{joinWithSeparator as x}from"../../services/index.js";import{TagItem as p}from"../TagItem/index.js";import{OperationItem as y}from"../OperationItem/index.js";import{Section as I}from"../common/index.js";import{useIsExpanded as g}from"./useIsExpanded.js";import{SectionItem as C}from"../SectionItem/index.js";import h from"../ContentItems/useScrollOnRender.js";import{isRootItem as j}from"../ContentItems/helpers.js";import{ApiInfo as S}from"../ApiInfo/index.js";import{layoutAtom as A}from"../../jotai/app.js";const E={group:null,tag:p,section:C,schema:p,operation:y,root:S};function _({item:o,routingBasePath:t,children:s,layout:a}){const r=E[j(o)?"root":o.type],i=o.type==="tag"&&o.items.length>0,n=g({item:o,routingBasePath:t});let d=h(o,t);const l=u(A);return c(m,{children:[r&&e(I,{id:o.id,ref:d,sectionId:x(t,o.id),underlined:o.type==="operation"||o.type==="schema",expanded:i&&!n,children:e(r,{item:o,routingBasePath:t,isExpanded:n,layout:a||l})}),(n||o.type!=="tag")&&!!o.items?.length&&e(m,{children:s})]})}const D=f(_);export{D as ContentItem};
1
+ import{jsx as t,Fragment as i,jsxs as f}from"react/jsx-runtime";import{memo as u}from"react";import{useAtomValue as x}from"jotai";import{joinWithSeparator as I}from"../../services/index.js";import{TagItem as r}from"../TagItem/index.js";import{OperationItem as g}from"../OperationItem/index.js";import{Section as y}from"../common/index.js";import{useIsExpanded as C}from"./useIsExpanded.js";import{SectionItem as h}from"../SectionItem/index.js";import j from"../ContentItems/useScrollOnRender.js";import{isRootItem as E}from"../ContentItems/helpers.js";import{ApiInfo as R}from"../ApiInfo/index.js";import{layoutAtom as S}from"../../jotai/app.js";import{isRenderableMenuItem as A}from"../../utils/menu.js";const _={group:null,tag:r,section:h,schema:o=>t(r,{...o,item:o.item,isExpanded:!0}),operation:g,mcp:o=>t(r,{...o,item:o.item,isExpanded:!0}),root:R};function b({item:o,routingBasePath:e,children:p,layout:s}){const a=E(o),m=_[a?"root":o.type],d=o.type==="tag"&&o.items.length>0,n=C({item:o,routingBasePath:e});let l=j(o,e);const c=x(S);return f(i,{children:[m&&t(y,{id:o.id,ref:l,sectionId:I(e,o.id),underlined:A(o),expanded:d&&!n,children:t(m,{item:o,routingBasePath:e,isExpanded:n,layout:s||c})}),(n||o.type!=="tag")&&!!o.items?.length&&t(i,{children:p})]})}const J=u(b);export{J as ContentItem};
@@ -1 +1 @@
1
- import{jsx as r,Fragment as m}from"react/jsx-runtime";import{memo as i,useCallback as a}from"react";import{ContentItem as p}from"../ContentItem/index.js";import{VirtualList as s}from"./VirtualList.js";function c({items:t,routingBasePath:n}){const o=a(e=>r(p,{item:e,routingBasePath:n,children:e.items.length>0&&r(s,{items:e.items,renderItem:o,routingBasePath:n})},e.id),[n]);if(!t.length)return null;const l=t.length>15&&t.every(e=>e.type==="operation"||e.type==="schema");return r(m,{children:l?r(s,{items:t,renderItem:o,routingBasePath:n}):r(m,{children:t.map(o)})})}const I=i(c);export{I as Items};
1
+ import{jsx as t,Fragment as o}from"react/jsx-runtime";import{memo as l,useCallback as a}from"react";import{ContentItem as d}from"../ContentItem/index.js";import{VirtualList as s}from"./VirtualList.js";import{isRenderableMenuItem as u}from"../../utils/menu.js";function c({items:r,routingBasePath:n}){const m=a(e=>t(d,{item:e,routingBasePath:n,children:e.items.length>0&&t(s,{items:e.items,renderItem:m,routingBasePath:n})},e.id),[n]);if(!r.length)return null;const i=r.length>15&&r.every(e=>u(e));return t(o,{children:i?t(s,{items:r,renderItem:m,routingBasePath:n}):t(o,{children:r.map(m)})})}const x=l(c);export{x as Items};
@@ -1 +1 @@
1
- import{normalizePath as s}from"../../utils/index.js";function c(t){return t.type==="section"&&t.id===""}function f(t){const r=[],e=[],n=[];let i;for(const o of t)switch(o.type){case"group":r.push(o);break;case"tag":e.push(o);break;case"operation":n.push(o);break;case"section":c(o)&&(i=o);break}return{groupItems:r,tagItems:e,operationItems:n,rootItem:i}}function p(t,r){for(const e of t){if(e.type==="group")return p(e.items,r);if(e.type==="tag"){if(!e.description)return s(p(e.items,r));if(e.href)return s(e.href)}else if(e.type==="operation"||e.type==="schema")return s(e.href)}return r}export{p as getFirstPageLink,f as getItemsByType,c as isRootItem};
1
+ import{normalizePath as n}from"../../utils/index.js";import{isRenderableMenuItem as f}from"../../utils/menu.js";function c(t){return t.type==="section"&&t.id===""}function m(t){const r=[],e=[],s=[];let i;for(const o of t)switch(o.type){case"group":r.push(o);break;case"tag":e.push(o);break;case"operation":s.push(o);break;case"section":c(o)&&(i=o);break}return{groupItems:r,tagItems:e,operationItems:s,rootItem:i}}function p(t,r){for(const e of t){if(e.type==="group")return p(e.items,r);if(e.type==="tag"){if(!e.description)return n(p(e.items,r));if(e.href)return n(e.href)}else if(f(e))return n(e.href)}return r}export{p as getFirstPageLink,m as getItemsByType,c as isRootItem};
@@ -0,0 +1,5 @@
1
+ import type { OpenAPIMcp, OpenAPIServer } from '../../types/open-api.js';
2
+ export declare function McpOverview({ mcpInfo, mcpServers, }: {
3
+ mcpInfo: OpenAPIMcp;
4
+ mcpServers: OpenAPIServer[];
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import{jsx as t,jsxs as o,Fragment as l}from"react/jsx-runtime";import*as b from"react";import{NewTabButton as h}from"@redocly/theme/components/Buttons/NewTabButton";import{PageActions as u}from"@redocly/theme/components/PageActions/PageActions";import{Tag as p}from"@redocly/theme/components/Tag/Tag";import{CheckmarkIcon as g}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{MCP_SERVER_CAPABILITIES as f,MCP_SERVER_EXPERIMENTAL_CAPABILITIES as E,PAGE_ACTIONS_MCP as P}from"../../utils/mcp.js";import{PanelItem as r}from"../PanelItem/PanelItem.js";import{PanelItemsList as C}from"../PanelItem/styled.js";import{useTranslate as _}from"../../hooks/index.js";import{styled as c}from"../../styled-components.js";function O({mcpInfo:e,mcpServers:s}){const a=_();function d(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.listChanged}function m(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.subscribe}return o(C,{children:[e?.protocolVersion&&t(r,{header:a("openapi.mcp.protocolVersion","Protocol version"),title:e.protocolVersion}),e?.capabilities&&t(r,{header:a("openapi.mcp.capabilities","Capabilities"),title:t(l,{children:f.map(i=>e?.capabilities[i]?o(p,{size:"small",icon:t(g,{}),children:[i,d(i)?" (list changed)":"",m(i)?" (subscribe)":""]},i):null)})}),e?.capabilities[E]&&t(r,{header:a("openapi.mcp.experimentalCapabilities","Experimental capabilities"),title:t(x,{children:Object.entries(e?.capabilities.experimental||{}).map(([i,n])=>o(b.Fragment,{children:[o("span",{children:[i,":"]}),t(p,{children:typeof n=="object"?JSON.stringify(n):String(n)})]},i))})}),t(r,{header:a("openapi.mcp.endpoint","Endpoint"),title:t(l,{children:s[0]?.url}),actions:[t(h,{data:s[0]?.url},"NewTabButton")]}),t(r,{title:t(j,{children:t(u,{actions:P,mcpUrl:s[0]?.url})})})]})}const j=c.div`
2
+ & button {
3
+ width: 100%;
4
+ }
5
+ > div {
6
+ padding: 0;
7
+ }
8
+ `,x=c.div`
9
+ display: grid;
10
+ grid-template-columns: 1fr 2fr;
11
+ gap: 10px;
12
+
13
+ > * {
14
+ justify-self: start;
15
+ }
16
+ `;export{O as McpOverview};
@@ -0,0 +1 @@
1
+ export * from './McpOverview.js';
@@ -0,0 +1 @@
1
+ export*from"./McpOverview.js";
@@ -0,0 +1,6 @@
1
+ interface McpToolProps {
2
+ toolName: string;
3
+ id: string;
4
+ }
5
+ export declare const McpTool: import("react").NamedExoticComponent<McpToolProps>;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ import{jsxs as a,jsx as n}from"react/jsx-runtime";import{memo as M,useCallback as g,useMemo as l}from"react";import{useAtomValue as s}from"jotai";import{LayoutVariant as k}from"@redocly/config";import{getMediaContent as C,getSecurity as j}from"../../models/index.js";import{globalStoreAtom as f}from"../../jotai/store.js";import{Section as P,Row as b,SamplesMiddlePanel as v,SamplesPanel as A,CodeBlockPanel as E}from"../common/index.js";import{Schema as R}from"../Schema/index.js";import{getSchema as F}from"../../models/schema.js";import{layoutAtom as L}from"../../jotai/app.js";import{MediaTypeSamples as O}from"../PayloadSamples/MediaTypeSamples.js";import{useTranslate as w}from"../../hooks/index.js";import{Title as D}from"../common/OperationItemTitle.js";import{LinkToField as I}from"../common/LinkToField.js";import{makeDeepLink as V}from"../../services/index.js";import{Security as _}from"../Security/Security.js";import{styled as h}from"../../styled-components.js";function q({toolName:t,id:m}){const{parser:i}=s(f),o=w(),e=l(()=>(i.definition["x-mcp"]?.tools||[]).find(r=>r.name===t),[i,t]),c=l(()=>e?j(e.security,i):null,[i,e]);return e?a(P,{children:[n(S,{id:m,type:"input",schema:e.inputSchema,title:o("openapi.mcp.inputSchema","Input schema"),exampleTitle:o("openapi.mcp.inputExample","Input example"),children:c&&n(_,{securities:c})}),e.outputSchema&&n(S,{id:m,type:"output",schema:e.outputSchema,title:o("openapi.mcp.outputSchema","Output schema"),exampleTitle:o("openapi.mcp.outputExample","Output example")})]}):a("div",{children:["Tool not found: ",t]})}function S({schema:t,title:m,exampleTitle:i,id:o,type:e,children:c}){const{parser:p,options:r}=s(f),u=s(L),d=u===k.STACKED,T=l(()=>C({parser:p,info:{"application/json":{schema:t}},isRequestType:!1,options:r,data:{operation:{pointer:"McpTool"}}}),[r,p,t]),y=l(()=>t&&F({parser:p,schemaOrRef:t,pointer:"#",options:r,deps:{operation:{pointer:o},parentFieldFullPath:e+"-schema"}}),[r,p,t,o,e]),x=g(()=>{},[]);return a(B,{layout:u,children:[n(K,{isStacked:d,children:a("div",{children:[a(D,{children:[o&&n(I,{to:V(o,e)}),m]}),c,n(R,{schema:y})]})}),n(A,{isStacked:d,children:n(E,{className:"panel-response-samples",header:i,children:n(O,{mediaType:T.mediaTypes[0],onChange:x})})})]})}const B=h(b)`
2
+ margin: calc(var(--spacing-unit) * 2) 0;
3
+
4
+ & + & {
5
+ margin-top: calc(var(--spacing-base) * 2);
6
+ }
7
+ `,K=h(v)`
8
+ padding-left: 0;
9
+ `,re=M(q);export{re as McpTool};
@@ -0,0 +1 @@
1
+ export * from './McpTool.js';
@@ -0,0 +1 @@
1
+ export*from"./McpTool.js";
@@ -10,6 +10,7 @@ import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"
10
10
  flex-direction: column;
11
11
  justify-content: flex-start;
12
12
  overflow: hidden;
13
+ flex: 1;
13
14
  `,s=t.span`
14
15
  text-align: left;
15
16
  color: var(--menu-content-title-color);
@@ -0,0 +1,3 @@
1
+ export declare function ErrorPage({ description }: {
2
+ description: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import{jsx as e,jsxs as r,Fragment as i}from"react/jsx-runtime";import t from"styled-components";import{GlobalStyle as a}from"@redocly/theme/core/openapi";function f({description:o}){return console.error(o),r(i,{children:[e(a,{}),r(n,{children:[e(l,{children:";("}),e(s,{children:"Something went wrong..."}),r(g,{children:["Please check the console for get more details or"," ",e("a",{target:"_blank",rel:"noopener noreferrer",href:"https://redocly.com/docs/redoc",children:"documentation"}),"."]})]})]})}const n=t.div`
2
+ height: 100vh;
3
+ max-width: var(--page-404-max-width);
4
+ display: flex;
5
+ flex-direction: column;
6
+ justify-content: center;
7
+ margin: var(--page-404-margin-vertical) var(--page-404-margin-horizontal);
8
+ font-family: var(--page-404-font-family);
9
+ gap: var(--page-404-gap);
10
+ `,l=t.div`
11
+ color: var(--page-404-status-text-color);
12
+ font-size: var(--page-404-status-font-size);
13
+ line-height: var(--page-404-status-line-height);
14
+ font-weight: var(--page-404-status-font-weight);
15
+ `,s=t.div`
16
+ color: var(--page-404-title-text-color);
17
+ font-size: var(--page-404-title-font-size);
18
+ line-height: var(--page-404-title-line-height);
19
+ font-weight: var(--page-404-title-font-weight);
20
+ `,g=t.div`
21
+ color: var(--page-404-description-text-color);
22
+ font-size: var(--page-404-description-font-size);
23
+ line-height: var(--page-404-description-line-height);
24
+ font-weight: var(--page-404-description-font-weight);
25
+ `;export{f as ErrorPage};
@@ -1 +1 @@
1
- import{jsx as d}from"react/jsx-runtime";import{memo as v,useCallback as b,useEffect as g,useMemo as y}from"react";import E from"@markdoc/markdoc";import{LayoutVariant as O}from"@redocly/config";import{createStore as S,Provider as A}from"jotai";import{html as N}from"@redocly/theme/markdoc/tags/html";import{Heading as D}from"@redocly/theme/markdoc/components/Heading/Heading";import{normalizeOptions as j,OpenAPIParser as k}from"../../services/index.js";import{SchemaDefinition as x}from"../SchemaDefinition/index.js";import{getMarkdownHeaderId as C}from"./utils.js";import{mergeInMockServer as P}from"../../models/operation.js";import{normalizeServers as M}from"../../utils/index.js";import{appStore as H,appStoreOverrideAtom as I,layoutAtom as p,allowedEnvironmentsAtom as L,environmentAtom as R,userClaimsAtom as T}from"../../jotai/app.js";import{mapObject as V}from"../../utils/object.js";import{getServerEnvName as z}from"../../utils/environments.js";import{globalStoreAtom as _}from"../../jotai/store.js";import{getDefaultOperationStore as h,operationStore as q}from"../../jotai/operation.js";const B={ignoreNamedSchemas:["java.io.ObjectStreamField"],maxDisplayedEnumValues:10,markdocOptions:{tags:{html:N.schema,schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean},htmlWrap:{type:String,default:!1}}}},nodes:{heading:{children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(n,m){const t=n.transformAttributes(m),i=n.transformChildren(m),e=typeof t.id=="string"?t.id:C(i);return new E.Tag("Heading",{...t,id:e,level:n.attributes.level},i)}}},components:{SchemaDefinition:x,Heading:D}}},me=v(({children:n,options:m,definitionUrl:t,definition:i,withState:e})=>{const l=b(()=>{const r=j(m,B),o=new k(i,t,r);return{options:r,parser:o}},[i,t,m]),a=y(()=>{const r=S(),o=l();r.set(_,o);const f=M(o.parser.definitionUrl,P(o.parser.definition?.servers||[],o.options.mockServer));r.sub(H,()=>{}),r.set(p,o.options?.layout||O.THREE_PANEL);const u=Object.fromEntries(f.map(s=>[z(s),{server:s.url,...V(s.variables||{},c=>c.default||"")}]));if(r.set(R,{environments:u}),r.set(T,e?.userClaims||{}),r.set(L,e?.allowedEnvironments),e&&r.set(I,{activeMimeName:e.activeMimeName,userClaims:e.userClaims,environment:e.environment,environments:e.environments}),e?.operation){const s=h(e.operation.pointer,e.operation.state.requestValues,e.operation.state.activeExampleName);r.set(q(e.operation.pointer),s)}return r},[l,e]);return g(()=>{e?.layout&&a.set(p,e?.layout)},[a,e?.layout]),d(A,{store:a,children:n})});export{me as StoreProvider};
1
+ import{jsx as d}from"react/jsx-runtime";import{memo as v,useCallback as g,useEffect as y,useMemo as b}from"react";import S from"@markdoc/markdoc";import{LayoutVariant as E}from"@redocly/config";import{createStore as O,Provider as A}from"jotai";import{html as N}from"@redocly/theme/markdoc/tags/html";import{Heading as M}from"@redocly/theme/markdoc/components/Heading/Heading";import{normalizeOptions as T,OpenAPIParser as D}from"../../services/index.js";import{SchemaDefinition as j}from"../SchemaDefinition/index.js";import{McpTool as k}from"../McpTool/index.js";import{getMarkdownHeaderId as x}from"./utils.js";import{mergeInMockServer as C}from"../../models/operation.js";import{normalizeServers as P}from"../../utils/index.js";import{appStore as H,appStoreOverrideAtom as I,layoutAtom as p,allowedEnvironmentsAtom as L,environmentAtom as R,userClaimsAtom as V}from"../../jotai/app.js";import{mapObject as z}from"../../utils/object.js";import{getServerEnvName as _}from"../../utils/environments.js";import{globalStoreAtom as h}from"../../jotai/store.js";import{getDefaultOperationStore as q,operationStore as B}from"../../jotai/operation.js";const F={ignoreNamedSchemas:["java.io.ObjectStreamField"],maxDisplayedEnumValues:10,markdocOptions:{tags:{html:N.schema,schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean},htmlWrap:{type:String,default:!1}}},mcpTool:{render:"McpTool",attributes:{toolName:{type:String},id:{type:String}}}},nodes:{heading:{children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(n,i){const t=n.transformAttributes(i),m=n.transformChildren(i),e=typeof t.id=="string"?t.id:x(m);return new S.Tag("Heading",{...t,id:e,level:n.attributes.level},m)}}},components:{SchemaDefinition:j,McpTool:k,Heading:M}}},se=v(({children:n,options:i,definitionUrl:t,definition:m,withState:e})=>{const l=g(()=>{const r=T(i,F),o=new D(m,t,r);return{options:r,parser:o}},[m,t,i]),a=b(()=>{const r=O(),o=l();r.set(h,o);const c=P(o.parser.definitionUrl,C(o.parser.definition?.servers||[],o.options.mockServer));r.sub(H,()=>{}),r.set(p,o.options?.layout||E.THREE_PANEL);const f=Object.fromEntries(c.map(s=>[_(s),{server:s.url,...z(s.variables||{},u=>u.default||"")}]));if(r.set(R,{environments:f}),r.set(V,e?.userClaims||{}),r.set(L,e?.allowedEnvironments),e&&r.set(I,{activeMimeName:e.activeMimeName,userClaims:e.userClaims,environment:e.environment,environments:e.environments}),e?.operation){const s=q(e.operation.pointer,e.operation.state.requestValues,e.operation.state.activeExampleName);r.set(B(e.operation.pointer),s)}return r},[l,e]);return y(()=>{e?.layout&&a.set(p,e?.layout)},[a,e?.layout]),d(A,{store:a,children:n})});export{se as StoreProvider};
@@ -1 +1 @@
1
- import{jsx as p}from"react/jsx-runtime";import{cloneElement as w,isValidElement as v,useEffect as g,useMemo as x,useState as a}from"react";import{Loading as A}from"@redocly/theme/components/Loaders/Loading";import{useDeepCompareMemoize as D,fixSpec as L}from"./utils.js";import{argValueToBoolean as O}from"../../utils/index.js";import{RedoclyOpenAPIDocs as B}from"./RedoclyOpenAPIDocs.js";import{loadAndBundleDefinition as u,loadOpenapiConfig as E}from"../../utils/loadAndBundleSpec.js";async function C(e,o,t){let n;if(t?.skipBundle){if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');n=e}else n=await u(e||o);try{L(n)}catch{}return n}function z(e,o){return e.endsWith(".md")?u({openapi:"3.0.0",info:{title:o||"",version:"1.0",description:{$ref:e}},paths:{}}):u(e)}const I=({options:e,definitionUrl:o,definition:t,activeSampleLanguage:n,children:r})=>{const[,l]=a(),[s,f]=a(!0),[d,h]=a(null),[m,y]=a(e||{});g(()=>{async function S(){f(!0);try{const c=await E();y({...e,...c}),h(await C(t,o,e))}catch(c){l(()=>{throw c})}}S()},[t,o,e]);const i=x(()=>{if(d)return{definition:d,options:m,definitionUrl:o,activeSampleLanguage:n}},D([d,o,m]));return g(()=>{i&&f(!1)},[i]),i?s?O(e?.hideLoading,!1)?null:p(A,{color:"--loading-spinner-color"}):v(r)?w(r,{store:i}):null:null};function T({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:l,router:s}){return p(I,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:l,children:p(B,{withCommonStyles:!0,router:s})})}export{I as AppProvider,T as RedoclyOpenAPIDocsStandalone,z as loadAndBundleSpecOrMd,C as loadSingle};
1
+ import{jsx as s}from"react/jsx-runtime";import{cloneElement as w,isValidElement as x,useEffect as g,useMemo as A,useState as c}from"react";import{Loading as O}from"@redocly/theme/components/Loaders/Loading";import{useDeepCompareMemoize as D,fixSpec as E}from"./utils.js";import{argValueToBoolean as L}from"../../utils/index.js";import{RedoclyOpenAPIDocs as P}from"./RedoclyOpenAPIDocs.js";import{loadAndBundleDefinition as u,loadOpenapiConfig as B}from"../../utils/loadAndBundleSpec.js";import{ErrorPage as I}from"./Error.js";async function k(e,o,t){let n;if(t?.skipBundle){if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');n=e}else n=await u(e||o);try{E(n)}catch{}return n}function _(e,o){return e.endsWith(".md")?u({openapi:"3.0.0",info:{title:o||"",version:"1.0",description:{$ref:e}},paths:{}}):u(e)}const C=({options:e,definitionUrl:o,definition:t,activeSampleLanguage:n,children:r})=>{const[i,l]=c(),[h,f]=c(!0),[d,y]=c(null),[m,S]=c(e||{});g(()=>{async function v(){f(!0);try{const p=await B();S({...e,...p}),y(await k(t,o,e))}catch(p){l(p.message)}}v()},[t,o,e]);const a=A(()=>{if(d)return{definition:d,options:m,definitionUrl:o,activeSampleLanguage:n}},D([d,o,m]));return g(()=>{a&&f(!1)},[a]),i?s(I,{description:i||"Please check path to your OpenAPI description"}):a?h?L(e?.hideLoading,!1)?null:s(O,{color:"--loading-spinner-color"}):x(r)?w(r,{store:a}):null:null};function $({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:i,router:l}){return s(C,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:i,children:s(P,{withCommonStyles:!0,router:l||"hash"})})}export{C as AppProvider,$ as RedoclyOpenAPIDocsStandalone,_ as loadAndBundleSpecOrMd,k as loadSingle};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as f,jsxs as v}from"react/jsx-runtime";import{useAtomValue as i}from"jotai";import{Panel as o}from"@redocly/theme/components/Panel/Panel";import{Markdown as h}from"@redocly/theme/components/Markdown/Markdown";import{DownloadSpecification as u}from"../Download/index.js";import{Overview as w}from"../Overview/index.js";import{ServerList as x}from"../ServerList/index.js";import{globalStoreAtom as S}from"../../jotai/store.js";import{normalizeServers as b}from"../../utils/index.js";import{LanguageList as j}from"../Language/index.js";import{mergeInMockServer as L}from"../../models/operation.js";import{languageAtom as O}from"../../jotai/app.js";import{useTranslate as D}from"../../hooks/index.js";import{useDownloadInfo as k}from"../Download/useDownloadInfo.js";const W=({item:{infoDefinition:r}})=>{const a=D(),{options:{hideDownloadButtons:l,downloadUrls:m,mockServer:p},parser:{definition:d,definitionUrl:c}}=i(S),{languages:n,activeLanguage:g}=i(O),s=k({downloadUrls:m}),t=b(c,L(d.servers||[],p));return v(f,{children:[!l&&s&&e(o,{className:"panel-download",header:a("openapi.download.description.title","Download OpenAPI description"),isExpandable:!1,children:e(u,{downloadObjects:s})}),(r?.license||r?.contact||r?.termsOfService)&&e(o,{className:"panel-overview",header:a("openapi.info.title","Overview"),isExpandable:!1,children:e(h,{children:e(w,{info:r,translate:a})})}),!!n?.length&&e(o,{className:"panel-language-list",header:a("openapi.languages.title","Languages"),isExpandable:!1,children:e(j,{languages:n,activeLanguage:g})}),!!t.length&&e(o,{className:"panel-servers-list",header:a("openapi.servers.title","Servers"),isExpandable:!1,children:e(x,{servers:t,path:"/",translate:a})})]})};export{W as RightPanel};
1
+ import{jsx as e,Fragment as u,jsxs as x}from"react/jsx-runtime";import{useAtomValue as c}from"jotai";import{Panel as r}from"@redocly/theme/components/Panel/Panel";import{Markdown as S}from"@redocly/theme/components/Markdown/Markdown";import{DownloadSpecification as b}from"../Download/index.js";import{Overview as O}from"../Overview/index.js";import{ServerList as j}from"../ServerList/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";import{normalizeServers as d}from"../../utils/index.js";import{LanguageList as L}from"../Language/index.js";import{mergeInMockServer as M}from"../../models/operation.js";import{languageAtom as P}from"../../jotai/app.js";import{useTranslate as k}from"../../hooks/index.js";import{useDownloadInfo as D}from"../Download/useDownloadInfo.js";import{McpOverview as E}from"../McpOverview/McpOverview.js";const J=({item:{infoDefinition:o}})=>{const a=k(),{options:{hideDownloadButtons:f,downloadUrls:v,mockServer:g},parser:{definition:n,definitionUrl:t}}=c(I),{languages:i,activeLanguage:h}=c(P),l=D({downloadUrls:v}),p=d(t,M(n.servers||[],g)),s=n?.["x-mcp"],w=d(t,s?.servers||[]),m=!(Object.keys(n.paths||{}).length>0)&&s;return x(u,{children:[!f&&l&&e(r,{className:"panel-download",header:a("openapi.download.description.title","Download OpenAPI description"),isExpandable:!1,children:e(b,{downloadObjects:l})}),!!s&&e(r,{className:"panel-mcp-overview",header:a("openapi.mcp.title","MCP server"),isExpandable:!1,children:e(E,{mcpInfo:s,mcpServers:w})}),(o?.license||o?.contact||o?.termsOfService)&&e(r,{className:"panel-overview",header:a("openapi.info.title","Overview"),isExpandable:!1,children:e(S,{children:e(O,{info:o,translate:a})})}),!!i?.length&&!m&&e(r,{className:"panel-language-list",header:a("openapi.languages.title","Languages"),isExpandable:!1,children:e(L,{languages:i,activeLanguage:h})}),!!p.length&&!m&&e(r,{className:"panel-servers-list",header:a("openapi.servers.title","Servers"),isExpandable:!1,children:e(j,{servers:p,path:"/",translate:a})})]})};export{J as RightPanel};
@@ -2,6 +2,6 @@ import { LayoutVariant } from '@redocly/config';
2
2
  import type { GroupModel } from '../../models/index.js';
3
3
  export interface SectionItemProps {
4
4
  item: GroupModel;
5
- layout: LayoutVariant;
5
+ layout?: LayoutVariant;
6
6
  }
7
7
  export declare const SectionItem: import("react").NamedExoticComponent<SectionItemProps>;
@@ -0,0 +1,4 @@
1
+ import { type ReactElement } from 'react';
2
+ export declare const ServerDescriptionTooltip: ({ description, }: {
3
+ description?: string;
4
+ }) => ReactElement;
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{useEffect as s,useState as i}from"react";import{Button as a}from"@redocly/theme/components/Button/Button";import{Tooltip as m}from"@redocly/theme/components/Tooltip/Tooltip";import{InformationIcon as c}from"@redocly/theme/icons/InformationIcon/InformationIcon";const v=({description:n})=>{const[o,e]=i(!1);return s(()=>{const r=()=>{o&&e(!1)};if(o)return document.addEventListener("touchmove",r,{passive:!0}),()=>{document.removeEventListener("touchmove",r)}},[o]),t(m,{tip:n,placement:"bottom",arrowPosition:"left",isOpen:o,children:t(a,{size:"small",variant:"ghost",icon:t(c,{}),"data-testid":"server-item-description-tooltip",onClick:()=>e(!0),onBlur:()=>e(!1),onFocus:()=>e(!0),onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),onTouchCancel:()=>e(!1)})})};export{v as ServerDescriptionTooltip};
@@ -1,4 +1,4 @@
1
- import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@redocly/theme/components/Buttons/CopyButton";import{PanelItemDescription as x,Title as f}from"../PanelItem/index.js";import{ViewNested as u}from"../ViewNested/index.js";import{Tag as y}from"../common/index.js";import{Markdown as w}from"../Markdown/index.js";import{styled as e}from"../../styled-components.js";const V=({servers:h,path:b,translate:r})=>i(j,{children:h.map(o=>{const a=o.url+b,d=Object.keys(o.variables||{}).length,p=d===1?"variable":"variables",l=`${d||""} ${r(`openapi.${p}`,p)}`;return t("div",{children:[i(x,{children:o.description}),t(k,{children:[i(f,{suppressHydrationWarning:!0,children:a}),i(v,{data:a},a)]}),o.variables&&i(u,{expandText:`${r("openapi.actions.show","Show")} ${l}`,hideText:`${r("openapi.actions.hide","Hide")} ${l}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i(S,{children:Object.entries(o.variables||{}).map(([c,n])=>t(T,{children:[i(z,{children:c}),t(s,{children:[r("openapi.default","Default")," ",i(g,{children:n.default})]}),i($,{source:n.description}),n.enum&&t(s,{children:[r("openapi.enum","Enum")," ",i(D,{children:n.enum.map(m=>i(g,{children:m},m))})]})]},c))})})]},o.url)})}),j=e.div`
1
+ import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as x}from"@redocly/theme/components/Buttons/CopyButton";import{getServerDisplayName as b}from"../../utils/helpers.js";import{PanelItemDescription as u,Title as y}from"../PanelItem/index.js";import{ViewNested as w}from"../ViewNested/index.js";import{Tag as S}from"../common/index.js";import{Markdown as T}from"../Markdown/index.js";import{styled as e}from"../../styled-components.js";import{ServerDescriptionTooltip as j}from"./ServerDescriptionTooltip.js";const q=({servers:h,path:f,translate:r})=>i(D,{children:h.map(t=>{const a=t.url+f,p=Object.keys(t.variables||{}).length,d=p===1?"variable":"variables",l=`${p||""} ${r(`openapi.${d}`,d)}`,v=!!t.name&&!!t.description;return o("div",{children:[o(L,{children:[i(u,{"data-testid":"server-panel-item-name",children:b(t)}),v&&i(j,{description:t.description})]}),o(O,{children:[i(y,{suppressHydrationWarning:!0,children:a}),i(x,{data:a},a)]}),t.variables&&i(w,{expandText:`${r("openapi.actions.show","Show")} ${l}`,hideText:`${r("openapi.actions.hide","Hide")} ${l}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i($,{children:Object.entries(t.variables||{}).map(([c,n])=>o(z,{children:[i(k,{children:c}),o(s,{children:[r("openapi.default","Default")," ",i(g,{children:n.default})]}),i(W,{source:n.description}),n.enum&&o(s,{children:[r("openapi.enum","Enum")," ",i(C,{children:n.enum.map(m=>i(g,{children:m},m))})]})]},c))})})]},t.url)})}),D=e.div`
2
2
  & > div {
3
3
  border-bottom: 1px solid var(--border-color-secondary);
4
4
  margin-bottom: var(--spacing-xs);
@@ -10,7 +10,7 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
10
10
  margin-bottom: 0;
11
11
  padding-bottom: 0;
12
12
  }
13
- `,S=e.div`
13
+ `,$=e.div`
14
14
  padding-left: var(--spacing-xxs);
15
15
  & > div {
16
16
  border-bottom: 1px solid var(--border-color-secondary);
@@ -28,11 +28,11 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
28
28
  margin-bottom: 0;
29
29
  padding-bottom: 0;
30
30
  }
31
- `,T=e.div`
31
+ `,z=e.div`
32
32
  display: flex;
33
33
  flex-direction: column;
34
34
  flex-wrap: wrap;
35
- `,$=e(w)`
35
+ `,W=e(T)`
36
36
  font-size: var(--font-size-sm);
37
37
  line-height: var(--line-height-sm);
38
38
  color: var(--text-color-primary);
@@ -42,18 +42,23 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
42
42
  font-size: var(--font-size-sm);
43
43
  line-height: var(--line-height-sm);
44
44
  color: var(--text-color-primary);
45
- `,z=e(s)`
45
+ `,k=e(s)`
46
46
  padding-bottom: var(--spacing-xxs);
47
47
  font-weight: var(--font-weight-semibold);
48
- `,D=e.span`
48
+ `,C=e.span`
49
49
  display: flex;
50
50
  gap: var(--spacing-xxs);
51
51
  flex-wrap: wrap;
52
- `,g=e(y)`
52
+ `,g=e(S)`
53
53
  font-size: var(--font-size-sm);
54
54
  line-height: var(--line-height-sm);
55
- `,k=e.div`
55
+ `,L=e.div`
56
+ display: flex;
57
+ justify-content: start;
58
+ align-items: center;
59
+ gap: var(--spacing-xxs);
60
+ `,O=e.div`
56
61
  display: flex;
57
62
  justify-content: space-between;
58
63
  align-items: center;
59
- `;export{V as ServerList};
64
+ `;export{q as ServerList};
@@ -1 +1 @@
1
- import{jsx as e,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 P}from"./styled.js";import{PanelItem as j}from"../PanelItem/index.js";import{joinWithSeparator as x}from"../../services/index.js";import{replaceVariables as D}from"../../utils/index.js";import{environmentAtom as V}from"../../jotai/app.js";import{useActiveWithFallback as M,useTelemetry as E}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 R=({operation:t,className:h})=>{const m=E(),[[u],i]=S(V),{options:{events:n}}=g(I),s=M(t.servers.map(r=>({...r,key:r.url})),u.server),c=l(r=>{r.stopPropagation()},[]),a=l(r=>()=>{if(t.servers.length!==1&&(i({environment:p(r)}),m.sendOpenapiDocsSwitchServersClickedMessage({server:p(r)}),n?.targetServerSwitch&&r)){const o=W({operation:t,serverUrl:r.url});n.targetServerSwitch(o)}},[t,i,m,n]),v=f(()=>t.servers.map(r=>{const o=x(D(r),t.path);return e(P,{onAction:a(r),children:e(j,{header:r.description,title:o,actions:[e(b,{data:o,toasterPlacement:"left",onCopyClick:c},o)],active:r.url===s,withCheckmark:!0})},o)}),[t.servers,t.path,a,c,s]);return e(y,{className:h,trigger:d(A,{variant:"ghost",children:[e(k,{color:t.httpVerb,children:t.httpVerb}),e(C,{children:t.path})]}),withArrow:!0,children:e(w,{children:v})})};export{R as ServerListDropdown};
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 +1 @@
1
- import{useMemo as h}from"react";import{useLocation as l}from"react-router-dom";import{useActiveSectionId as I}from"@redocly/theme/core/openapi";import{pathMatchedLink as k}from"../../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as A}from"../../../constants.js";import{joinWithSeparator as y}from"../../../services/history/helpers.js";function O({items:r,routingBasePath:n}){const t=l(),s=I(t,!1,!1);return h(()=>S(r,s,t,n),[s,r,t,n])}function S(r,n="",t,s){const o=[];return c({contentItems:r,sidebarItems:o,activeItemId:n,location:t,routingBasePath:s}),o}function b(r,n="",t,s){return r.href?n&&s?y(s,r.id)===n:n&&!s?r.id===n:k(t,r.href):!1}function d(r,n="",t,s){return(r.items||[]).some(i=>b(i,n,t,s)||d(i,n,t,s))}function c(r){const{contentItems:n,sidebarItems:t,activeItemId:s,location:o,routingBasePath:i}=r;let p=!0;for(const e of n){const m=b(e,s,o,i),a=d(e,s,o,i);switch(e.type){case"group":t.push({type:"separator",label:e.name,active:m,hasActiveSubItem:a}),c({...r,contentItems:e.items,sidebarItems:t});break;case"tag":const f={type:"group",label:e.name,items:[],link:e.href,active:m,hasActiveSubItem:a,modified:!0};t.push(f),c({contentItems:e.items,sidebarItems:f.items||[],activeItemId:s,location:o,routingBasePath:i});break;case"operation":case"schema":e.isWebhook&&p&&e.parent.name!==A&&(t.push({type:"separator",label:"Webhooks",variant:"secondary"}),p=!1),t.push({type:"link",label:e.name,httpVerb:e.type==="schema"?"schema":e.httpVerb,link:e.href,badges:e.badges,active:m,hasActiveSubItem:a,modified:!0,deprecated:e.deprecated});break;case"section":if(e.depth===-1)continue;const u={type:e.items.length?"group":"link",label:e.name,link:e.href,items:[],active:m,hasActiveSubItem:a,modified:!0};t.push(u),e.items.length&&c({contentItems:e.items,sidebarItems:u.items,activeItemId:s,location:o,routingBasePath:i});break}}}export{O as useMenuItems};
1
+ import{useMemo as l}from"react";import{useLocation as h}from"react-router-dom";import{useActiveSectionId as I}from"@redocly/theme/core/openapi";import{pathMatchedLink as k}from"../../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as A}from"../../../constants.js";import{joinWithSeparator as y}from"../../../services/history/helpers.js";function O({items:o,routingBasePath:r}){const t=h(),s=I(t,!1,!1);return l(()=>S(o,s,t,r),[s,o,t,r])}function S(o,r="",t,s){const n=[];return c({contentItems:o,sidebarItems:n,activeItemId:r,location:t,routingBasePath:s}),n}function b(o,r="",t,s){return o.href?r&&s?y(s,o.id)===r:r&&!s?o.id===r:k(t,o.href):!1}function d(o,r="",t,s){return(o.items||[]).some(i=>b(i,r,t,s)||d(i,r,t,s))}function c(o){const{contentItems:r,sidebarItems:t,activeItemId:s,location:n,routingBasePath:i}=o;let p=!0;for(const e of r){const a=b(e,s,n,i),m=d(e,s,n,i);switch(e.type){case"group":t.push({type:"separator",label:e.name,active:a,hasActiveSubItem:m}),c({...o,contentItems:e.items,sidebarItems:t});break;case"tag":const f={type:"group",label:e.name,items:[],link:e.href,active:a,hasActiveSubItem:m,modified:!0};t.push(f),c({contentItems:e.items,sidebarItems:f.items||[],activeItemId:s,location:n,routingBasePath:i});break;case"operation":case"schema":case"mcp":e.isWebhook&&p&&e.parent.name!==A&&(t.push({type:"separator",label:"Webhooks",variant:"secondary"}),p=!1),t.push({type:"link",label:e.name,httpVerb:e.type=="operation"?e.httpVerb:e.type,link:e.href,badges:e.badges,active:a,hasActiveSubItem:m,modified:!0,deprecated:e.deprecated});break;case"section":if(e.depth===-1)continue;const u={type:e.items.length?"group":"link",label:e.name,link:e.href,items:[],active:a,hasActiveSubItem:m,modified:!0};t.push(u),e.items.length&&c({contentItems:e.items,sidebarItems:u.items,activeItemId:s,location:n,routingBasePath:i});break}}}export{O as useMenuItems};
@@ -1,10 +1,10 @@
1
- import{jsx as e,jsxs as i,Fragment as b}from"react/jsx-runtime";import{memo as x}from"react";import{joinWithSeparator as u}from"../../services/index.js";import{encodeBackSlashes as w}from"../../utils/index.js";import{HttpVerb as y,NavigationBadge as n}from"../common/index.js";import{styled as r}from"../../styled-components.js";import{StyledButton as j}from"./styled.js";function z({title:s,items:l,onClick:c,routingBasePath:p,translate:d}){return i(b,{children:[e(k,{children:s}),l.map(({id:h,href:m,httpVerb:o,path:g,deprecated:a,badges:f})=>e(B,{variant:"outlined",size:"large",onClick:()=>c(u(p,w(m))),children:i("span",{children:[e(y,{color:a?"http-deprecated":o,children:o}),e(I,{children:g}),a&&e(n,{deprecated:!0,children:d("openapi.badges.deprecated","Deprecated")}),f?.map(({name:t,color:v})=>e(n,{color:v,children:t},t))]})},h))]})}const D=x(z),k=r.span`
1
+ import{jsx as r,jsxs as i,Fragment as x}from"react/jsx-runtime";import{memo as u}from"react";import{joinWithSeparator as y}from"../../services/index.js";import{encodeBackSlashes as w}from"../../utils/index.js";import{HttpVerb as j,NavigationBadge as s}from"../common/index.js";import{styled as t}from"../../styled-components.js";import{StyledButton as z}from"./styled.js";function k({title:p,items:c,onClick:l,routingBasePath:d,translate:h}){return i(x,{children:[r(B,{children:p}),c.map(e=>{const{id:g,href:f,deprecated:o,badges:m}=e,v=e.type==="operation"?e.path:e.name,a=e.type==="operation"?e.httpVerb:e.type;return r(I,{variant:"outlined",size:"large",onClick:()=>l(y(d,w(f))),children:i("span",{children:[r(j,{color:o?"http-deprecated":a,children:a}),r(N,{children:v}),o&&r(s,{deprecated:!0,children:h("openapi.badges.deprecated","Deprecated")}),m?.map(({name:n,color:b})=>r(s,{color:b,children:n},n))]})},g)})]})}const D=u(k),B=t.span`
2
2
  font-size: var(--font-size-base);
3
3
  line-height: var(--line-height-base);
4
4
  font-weight: var(--font-weight-bold);
5
5
  color: var(--text-color-primary);
6
6
  margin: var(--spacing-sm) 0 var(--spacing-xxs) 0;
7
- `,B=r(j)`
7
+ `,I=t(z)`
8
8
  border-radius: var(--border-radius);
9
9
  background: var(--bg-color);
10
10
  justify-content: space-between;
@@ -24,7 +24,7 @@ import{jsx as e,jsxs as i,Fragment as b}from"react/jsx-runtime";import{memo as x
24
24
  content: '→';
25
25
  line-height: var(--line-height-base);
26
26
  }
27
- `,I=r.span`
27
+ `,N=t.span`
28
28
  font-family: var(--font-family-base);
29
29
  font-size: var(--font-size-base);
30
30
  line-height: var(--line-height-base);
@@ -1,6 +1,6 @@
1
- import{jsx as h,jsxs as d}from"react/jsx-runtime";import{useMemo as w,memo as y,useState as S,useCallback as C}from"react";import{useNavigate as O}from"react-router-dom";import{LayoutVariant as A}from"@redocly/config";import{useAtomValue as N}from"jotai/index";import{SamplesPanel as j}from"../common/index.js";import{layoutAtom as E}from"../../jotai/app.js";import{OperationNavigationItems as f}from"./OperationNavigationItems.js";import{StyledButton as W}from"./styled.js";import{useTranslate as B}from"../../hooks/index.js";import{styled as I}from"../../styled-components.js";const r=8;function P({items:l,routingBasePath:p}){const o=B(),[n,g]=S(!1),m=O(),k=N(E)===A.STACKED,{operations:a,webhooks:s,count:c}=w(()=>{const t=l.filter(e=>e.type==="operation"),x=n?t:t.slice(0,r),{operations:v,webhooks:b}=x.reduce((e,i)=>(i.isWebhook?e.webhooks.push(i):e.operations.push(i),e),{operations:[],webhooks:[]});return{operations:v,webhooks:b,count:!n&&t.length>r?t.length-r:0}},[n,l]),u=C(t=>m(t),[m]);return!a.length&&!s.length?null:d(T,{isStacked:k,"data-testid":"operation-navigation-list",children:[a.length>0&&h(f,{items:a,onClick:u,routingBasePath:p,translate:o,title:o("openapi.operations","Operations")}),s.length>0&&h(f,{items:s,onClick:u,routingBasePath:p,translate:o,title:o("openapi.webhooks","Webhooks")}),!n&&!!c&&d(W,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>g(!0),children:[o("openapi.actions.show","Show")," ",c," ",o("openapi.actions.more","more"),"..."]})]})}const H=y(P),T=I(j)`
1
+ import{jsx as r,jsxs as k}from"react/jsx-runtime";import{useMemo as O,memo as M,useState as A,useCallback as N}from"react";import{useNavigate as j}from"react-router-dom";import{LayoutVariant as E}from"@redocly/config";import{useAtomValue as I}from"jotai/index";import{SamplesPanel as P}from"../common/index.js";import{layoutAtom as W}from"../../jotai/app.js";import{OperationNavigationItems as l}from"./OperationNavigationItems.js";import{StyledButton as B}from"./styled.js";import{useTranslate as _}from"../../hooks/index.js";import{styled as R}from"../../styled-components.js";import{isRenderableMenuItem as V}from"../../utils/menu.js";const p=8;function z({items:m,routingBasePath:n}){const o=_(),[a,x]=A(!1),c=j(),C=I(W)===E.STACKED,{operations:h,webhooks:u,schemas:f,mcpTools:d,showMoreCount:g,totalCount:y}=O(()=>{const e=m.filter(s=>V(s)),w=a?e:e.slice(0,p),{operations:b,webhooks:v,schemas:S,mcpTools:T}=w.reduce((s,t)=>(t.type==="operation"&&t.isWebhook?s.webhooks.push(t):t.type==="operation"?s.operations.push(t):t.type==="schema"?s.schemas.push(t):t.type==="mcp"&&s.mcpTools.push(t),s),{operations:[],webhooks:[],schemas:[],mcpTools:[]});return{operations:b,schemas:S,mcpTools:T,webhooks:v,showMoreCount:!a&&e.length>p?e.length-p:0,totalCount:e.length}},[a,m]),i=N(e=>c(e),[c]);return y?k(D,{isStacked:C,"data-testid":"operation-navigation-list",children:[f.length>0&&r(l,{items:f,onClick:i,routingBasePath:n,translate:o,title:o("openapi.schemas","Schemas")}),d.length>0&&r(l,{items:d,onClick:i,routingBasePath:n,translate:o,title:o("openapi.mcp.tools","MCP Tools")}),h.length>0&&r(l,{items:h,onClick:i,routingBasePath:n,translate:o,title:o("openapi.operations","Operations")}),u.length>0&&r(l,{items:u,onClick:i,routingBasePath:n,translate:o,title:o("openapi.webhooks","Webhooks")}),!a&&!!g&&k(B,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>x(!0),children:[o("openapi.actions.show","Show")," ",g," ",o("openapi.actions.more","more"),"..."]})]}):null}const oo=M(z),D=R(P)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--spacing-xxs);
5
5
  padding-top: var(--spacing-xxl);
6
- `;export{H as OperationsNavigation,P as OperationsNavigationComponent};
6
+ `;export{oo as OperationsNavigation,z as OperationsNavigationComponent};
@@ -1,23 +1,33 @@
1
- import{jsx as a,jsxs as o}from"react/jsx-runtime";import{memo as h,useCallback as v}from"react";import{useNavigate as x}from"react-router-dom";import{useAtomValue as b}from"jotai";import{LayoutVariant as k}from"@redocly/config";import{breakpoints as S}from"@redocly/theme/core/openapi";import{Button as y}from"@redocly/theme/components/Button/Button";import{PageActions as w}from"@redocly/theme/components/PageActions/PageActions";import{H2 as j}from"@redocly/theme/components/Typography/H2";import{LinkIcon as C}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{joinWithSeparator as A}from"../../services/history/helpers.js";import{Row as I,SamplesMiddlePanel as T,ShareLink as $}from"../common/index.js";import{Markdown as B}from"../Markdown/index.js";import{OperationsNavigation as L}from"./OperationsNavigation.js";import{layoutAtom as W}from"../../jotai/app.js";import{useTranslate as H}from"../../hooks/index.js";import{styled as n}from"../../styled-components.js";function M({item:t,routingBasePath:m="",isExpanded:e}){const l=H(),{description:d,name:s,href:g}=t,p=x(),c=b(W),i=A(m,t.href),u=v(()=>{p(i)},[p,i]),r=!!t.items.length,f=c===k.STACKED;return o(N,{expanded:e,children:[o(I,{layout:c,children:[o(T,{fullWidth:!r,isStacked:f,children:[o(V,{children:[a($,{to:g,"aria-label":`link to ${s}`}),s,a(w,{pageSlug:i})]}),a(B,{source:d})]}),r&&a(L,{items:t.items,routingBasePath:m})]}),r&&!e&&o(P,{type:"button",variant:"text",size:"medium",onClick:u,children:["+ ",l("openapi.actions.show","Show")]})]})}const ot=h(M),N=n.div`
1
+ import{jsx as a,jsxs as t}from"react/jsx-runtime";import{memo as u,useCallback as v}from"react";import{useNavigate as x}from"react-router-dom";import{useAtomValue as k}from"jotai";import{LayoutVariant as b}from"@redocly/config";import{Markdown as S}from"@redocly/theme/components/Markdown/Markdown";import{breakpoints as w}from"@redocly/theme/core/openapi";import{Button as y}from"@redocly/theme/components/Button/Button";import{PageActions as M}from"@redocly/theme/components/PageActions/PageActions";import{H2 as T}from"@redocly/theme/components/Typography/H2";import{LinkIcon as $}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{joinWithSeparator as j}from"../../services/history/helpers.js";import{Row as C,SamplesMiddlePanel as I,SamplesPanel as A,ShareLink as P}from"../common/index.js";import{Markdown as W}from"../Markdown/index.js";import{OperationsNavigation as B}from"./OperationsNavigation.js";import{layoutAtom as L}from"../../jotai/app.js";import{useTranslate as D}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";function H({item:o,routingBasePath:e="",isExpanded:m}){const l=D(),{description:c,name:s,href:g}=o,p=x(),d=k(L),i=j(e,o.href),f=v(()=>{p(i)},[p,i]),n=!!o.items.length,h=d===b.STACKED;return t(N,{expanded:m,children:[t(C,{layout:d,children:[t(I,{fullWidth:!n,isStacked:h,children:[t(_,{children:[a(P,{to:g,"aria-label":`link to ${s}`}),s,a(M,{pageSlug:i})]}),a(W,{source:c})]}),n&&a(B,{items:o.items,routingBasePath:e})]}),n&&!m&&t(V,{type:"button",variant:"text",size:"medium",onClick:f,children:["+ ",l("openapi.actions.show","Show")]})]})}const no=u(H),N=r.div`
2
2
  padding-top: var(--spacing-lg);
3
- padding-bottom: ${({expanded:t})=>t?"var(--spacing-xxl)":""};
4
- `,P=n(y)`
3
+ padding-bottom: ${({expanded:o})=>o?"var(--spacing-xxl)":""};
4
+
5
+ /*
6
+ Markdoc components inside markdown that use SamplesPanel should not have padding.
7
+ E.g. SchemaDefinition, McpTool
8
+ padding is added by the TagItem itself
9
+ */
10
+ ${S} ${A} {
11
+ padding-left: 0;
12
+ padding-right: 0;
13
+ }
14
+ `,V=r(y)`
5
15
  margin: var(--spacing-md) var(--spacing-xl) var(--spacing-xxs);
6
16
  width: calc(100% - var(--spacing-xl) * 2);
7
17
 
8
- @media screen and (min-width: ${S.medium}) {
18
+ @media screen and (min-width: ${w.medium}) {
9
19
  --button-margin-md: calc(var(--spacing-xl) * 2);
10
20
 
11
21
  margin-left: var(--button-margin-md);
12
22
  margin-right: var(--button-margin-md);
13
23
  width: calc(100% - var(--button-margin-md) * 2);
14
24
  }
15
- `,V=n(j)`
25
+ `,_=r(T)`
16
26
  display: flex;
17
27
  :hover {
18
- ${C} {
28
+ ${$} {
19
29
  opacity: 1;
20
30
  visibility: visible;
21
31
  }
22
32
  }
23
- `;export{ot as TagItem,M as TagItemComponent};
33
+ `;export{no as TagItem,H as TagItemComponent};
@@ -1,5 +1,5 @@
1
- import type { OperationMenuItem } from '../../models/index.js';
1
+ import type { GroupModel, OperationMenuItem } from '../../models/index.js';
2
2
  export type OperationsNavigationProps = {
3
- items: OperationMenuItem[];
3
+ items: (OperationMenuItem | GroupModel)[];
4
4
  routingBasePath: string;
5
5
  };
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{joinWithSeparator as x}from"../services/index.js";import{getValueFromMdParsedExtension as S,safeSlugify as o}from"../utils/index.js";import{getHref as v}from"../services/menu/operation.js";import{saveTextBeforeHeading as C}from"../utils/saveTextBeforeHeading.js";function B(n,e,i){let s;i?.id&&n==="schema"?s=x(i.id,o(e.name)):s=e.id||o(e.name);const t=e["x-displayName"]||e.name,c=e.level||1,d=e.isSchema,f=e.ast||void 0,l=C(S(e,"description")||""),a=e.items||[],h=e.externalDocs;return{id:s.toLowerCase(),type:n,parent:i,name:t,level:c,depth:0,isSchema:d,description:l,items:a,ast:f,externalDocs:h,href:v({id:s}),[m]:e[m]||i?.[m]}}export{B as getTagOrGroup};
1
+ import{REDOCLY_TEAMS_RBAC as n}from"@redocly/config";import{joinWithSeparator as x}from"../services/index.js";import{getValueFromMdParsedExtension as S,safeSlugify as o}from"../utils/index.js";import{getHref as v}from"../services/menu/operation.js";import{saveTextBeforeHeading as C}from"../utils/saveTextBeforeHeading.js";function B(m,e,i){let s;i?.id&&(m==="schema"||m==="mcp")?s=x(i.id,o(e.name)):s=e.id||o(e.name);const t=e["x-displayName"]||e.name,c=e.level||1,d=e.isSchema,f=e.ast||void 0,l=C(S(e,"description")||""),a=e.items||[],h=e.externalDocs;return{id:s.toLowerCase(),type:m,parent:i,name:t,level:c,depth:0,isSchema:d,description:l,items:a,ast:f,externalDocs:h,href:v({id:s}),[n]:e[n]||i?.[n]}}export{B as getTagOrGroup};
@@ -185,6 +185,8 @@ export type GroupModel = {
185
185
  description?: string | GenericObject;
186
186
  isSchema?: boolean;
187
187
  type: MenuItemGroupType;
188
+ deprecated?: boolean;
189
+ badges?: OpenAPIXBadges[];
188
190
  items: ContentItemModel[];
189
191
  ast?: Node[];
190
192
  parent?: GroupModel;
@@ -1 +1 @@
1
- import{getTagGroupsItems as r,getTagsItems as d,getTagsWithOperations as c}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as p,getValueFromMdParsedExtension as h}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as u}from"../../constants.js";function l(t,n){const{definition:e}=t,{schemaDefinitionsTagName:i}=n,s=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[]}],o=[...e.tags||[]];o.some(a=>a.name===u)||o.push({name:u}),!o.find(a=>a?.name===i)&&i&&o.push({name:i});const f=c(t,o),m=e["x-tagGroups"];return s.push(...g(h(e.info,"description")||"",void 0,1)),m&&m.length>0?s.push(...r(t,void 0,m,f,n)):s.push(...d(t,f,void 0,void 0,n)),s}function E(t,n){const e=l(t,n),i=p(e||[],"items");return{contentItems:e,flatItems:i}}export{E as buildContentItems,l as buildMenuStructure};
1
+ import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function O(o,s){const e=x(o,s),i=h(e||[],"items");return{contentItems:e,flatItems:i}}export{O as buildContentItems,x as buildMenuStructure};
@@ -25,3 +25,4 @@ export declare function getTagGroupsItems(parser: OpenAPIParser, parent: GroupMo
25
25
  * collects tags and maps each tag to list of operations belonging to this tag
26
26
  */
27
27
  export declare function getTagsWithOperations(parser: OpenAPIParser, explicitTags: OpenAPITag[]): TagsInfoMap;
28
+ export declare function capitalize(input: string): string;
@@ -1 +1,2 @@
1
- import{getTagOrGroup as u}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as h,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as l,isOperationName as x,JsonPointer as y}from"../../utils/index.js";import{getOperationsItems as T}from"./operation.js";import{addMarkdownItems as O}from"./markdown.js";function b(c,i,s,n,r){let e;if(n===void 0?e=Object.keys(i):e=n.tags,!Array.isArray(e))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=e.map(t=>i[t]?(i[t].used=!0,i[t]):(console.warn(`Non-existing tag "${t}" is added to the group "${n?.name}"`),null)),a=[];for(const t of f){if(!t)continue;const o=u("tag",t,s);if(o.depth=g+1,t.name===""){const m=[...O(l(t,"description")||"",o,o.depth+1),...T(void 0,t,o.depth+1)];a.push(...m);continue}const p=k({definition:c.definition,tag:t,parent:o,schemaDefinitionsTagName:r.schemaDefinitionsTagName});o.items=[...p,...O(l(t,"description")||"",o,o.depth+1),...T(o,t,o.depth+1)],a.push(o)}return a.filter(({name:t,items:o})=>t!==h||o.length>0)}function G(c,i,s,n,r){const e=[];for(const f of s){const a=u("group",f,i);a.depth=g,a.items=b(c,n,a,f,r),e.push(a)}return e}function k({definition:c,tag:i,parent:s,schemaDefinitionsTagName:n}){const r=n?[n]:[];return Object.entries(c.components?.schemas||{}).map(([e,f])=>{if(!(f["x-tags"]||r).includes(i.name))return null;const t=u("schema",{name:e,"x-displayName":`${f.title||e}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${e}" /%}`,isSchema:!0,level:2},s);return t.depth=s.depth+1,t}).filter(Boolean)}function I(c,i){const{definition:s}=c,n={},r=s["x-webhooks"]||s.webhooks;for(const e of i||[])n[e.name]={...e,operations:[]};return s.paths&&d(c,s.paths,n),r&&d(c,r,n,!0),n}function d(c,i,s,n){for(const r of Object.keys(i||{})){const e=i[r],f=Object.keys(e).filter(x);for(const a of f){const t=e[a];if(e.$ref){const{resolved:p}=c.deref(e);d(c,{[r]:p},s,n);continue}let o=t?.tags;(!o||!o.length)&&(o=n?[h]:[""]);for(const p of o){let m=s[p];m===void 0&&(m={name:p,operations:[]},s[p]=m),!m["x-traitTag"]&&m.operations.push({...t,pathName:r,pointer:y.compile(["paths",r,a]),httpVerb:a,pathParameters:e.parameters||[],pathServers:e.servers,isWebhook:!!n})}}}}export{G as getTagGroupsItems,b as getTagsItems,I as getTagsWithOperations};
1
+ import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as l,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as $,safeSlugify as N}from"../../utils/index.js";import{getOperationsItems as T}from"./operation.js";import{addMarkdownItems as x}from"./markdown.js";import{joinWithSeparator as b}from"../history/helpers.js";const y=["tools"];function k(s,c,o,e,a){let t;if(e===void 0?t=Object.keys(c):t=e.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=t.map(n=>c[n]?(c[n].used=!0,c[n]):(console.warn(`Non-existing tag "${n}" is added to the group "${e?.name}"`),null)),i=[];for(const n of f){if(!n)continue;const r=d("tag",n,o);if(r.depth=g+1,n.name===""){const P=[...x(h(n,"description")||"",r,r.depth+1),...T(void 0,n,r.depth+1)];i.push(...P);continue}const p=v({definition:s.definition,tag:n,parent:r,schemaDefinitionsTagName:a.schemaDefinitionsTagName}),m=w(s.definition,n,r);r.items=[...p,...m,...x(h(n,"description")||"",r,r.depth+1),...T(r,n,r.depth+1)],i.push(r)}return i.filter(({name:n,items:r})=>n!==l||r.length>0)}function R(s,c,o,e,a){const t=[];for(const f of o){const i=d("group",f,c);i.depth=g,i.items=k(s,e,i,f,a),t.push(i)}return t}function v({definition:s,tag:c,parent:o,schemaDefinitionsTagName:e}){const a=e?[e]:[];return Object.entries(s.components?.schemas||{}).map(([t,f])=>{if(!(f["x-tags"]||a).includes(c.name))return null;const n=d("schema",{name:t,"x-displayName":`${f.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},o);return n.depth=o.depth+1,n}).filter(Boolean)}function w(s,c,o){const e=[];for(const a of y)if(s["x-mcp"]?.[a]){const t=O(a),f=[t];for(const i of s["x-mcp"]?.[a]||[])if((i.tags?.length?i.tags:f).includes(c.name)){const r=b(o.id,N(i.name)),p=d("mcp",{name:i.name,"x-displayName":i.title||i.name,description:`${i.description||""}
2
+ {% mcp${t.slice(0,-1)} toolName="${i.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(s,c){const{definition:o}=s,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&u(s,o.paths,e),a&&u(s,a,e,!0),t&&E(t,e),e}function E(s,c){for(const o of y)if(s[o])for(const e of s[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function u(s,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const i of f){const n=t[i];if(t.$ref){const{resolved:p}=s.deref(t);u(s,{[a]:p},o,e);continue}let r=n?.tags;(!r||!r.length)&&(r=e?[l]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...n,pathName:a,pointer:$.compile(["paths",a,i]),httpVerb:i,pathParameters:t.parameters||[],pathServers:t.servers,isWebhook:!!e})}}}}function O(s){return s.charAt(0).toUpperCase()+s.slice(1)}export{O as capitalize,R as getTagGroupsItems,k as getTagsItems,U as getTagsWithOperations};
@@ -17,7 +17,7 @@ export type ExternalLinkSeparator = {
17
17
  separator?: string;
18
18
  separatorLine?: boolean;
19
19
  };
20
- export type MenuItemGroupType = 'group' | 'tag' | 'section' | 'schema';
20
+ export type MenuItemGroupType = 'group' | 'tag' | 'section' | 'schema' | 'mcp';
21
21
  export type MenuItemType = MenuItemGroupType | 'operation';
22
22
  /** Generic interface for MenuItems */
23
23
  export interface IMenuItem {
package/lib/standalone.js CHANGED
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as v,setSecurityDetailsVariants as V}from"./utils/security-details.js";import{setParameterValue as D}from"./utils/parameters.js";function _(t){const o={},e=t.attributes;for(let r=0;r<e.length;r++){const n=e[r];o[n.name]=n.value}return o}function d(t){const o=_(t),e={};for(const r in o){const n=r.replace(/-(.)/g,(c,s)=>s.toUpperCase());e[n]=o[r]}return e}function N(t,o=document.querySelector("redoc")){m(o,i(l,{store:t}))}function E(t,o={},e=a("redoc")){if(e===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,...n}=o;let c,s;typeof t=="string"?c=t:typeof t=="object"&&(s=t),u(e).render(p(f,{definition:s,definitionUrl:c,options:{...n,...d(e)},router:r??"history"},["Loading..."]))}const b=__REDOCLY_API_REFERENCE_VERSION__,C=__REDOCLY_API_REFERENCE_REVISION__;function R(){const t=a("redoc");if(!t)return;const o=t.getAttribute("spec-url");o&&E(o,{},t)}R();export{N as hydrate,E as init,C as revision,D as setParameterValue,v as setSecurityDetails,V as setSecurityDetailsVariants,b as version};
1
+ import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as v,setSecurityDetailsVariants as V}from"./utils/security-details.js";import{setParameterValue as D}from"./utils/parameters.js";function _(t){const e={},o=t.attributes;for(let r=0;r<o.length;r++){const n=o[r];e[n.name]=n.value}return e}function d(t){const e=_(t),o={};for(const r in e){const n=r.replace(/-(.)/g,(c,s)=>s.toUpperCase());o[n]=e[r]}return o}function N(t,e=document.querySelector("redoc")){m(e,i(l,{store:t}))}function E(t,e={},o=a("redoc")){if(o===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,...n}=e;let c,s;typeof t=="string"?c=t:typeof t=="object"&&(s=t),u(o).render(p(f,{definition:s,definitionUrl:c,options:{...n,...d(o)},router:r??"hash"},["Loading..."]))}const b=__REDOCLY_API_REFERENCE_VERSION__,C=__REDOCLY_API_REFERENCE_REVISION__;function R(){const t=a("redoc");if(!t)return;const e=t.getAttribute("spec-url");e&&E(e,{},t)}R();export{N as hydrate,E as init,C as revision,D as setParameterValue,v as setSecurityDetails,V as setSecurityDetailsVariants,b as version};
@@ -10,6 +10,7 @@ export interface OpenAPIDefinition {
10
10
  tags?: OpenAPITag[];
11
11
  externalDocs?: OpenAPIExternalDocumentation;
12
12
  webhooks?: OpenAPIPaths;
13
+ 'x-mcp'?: OpenAPIMcp;
13
14
  'x-webhooks'?: OpenAPIPaths;
14
15
  'x-tagGroups'?: Array<{
15
16
  name: string;
@@ -47,6 +48,7 @@ export interface XSEO {
47
48
  export interface OpenAPIServer extends ParsedDescription {
48
49
  url: string;
49
50
  description?: string;
51
+ name?: string;
50
52
  variables?: OpenAPIServerVariables;
51
53
  }
52
54
  export interface OpenAPIServerVariables {
@@ -383,3 +385,48 @@ export interface ParsedDescription {
383
385
  export interface ParsedDescriptionWithSummary extends ParsedDescription {
384
386
  'x-parsed-md-summary'?: GenericObject;
385
387
  }
388
+ export interface OpenAPIMcp {
389
+ protocolVersion: string;
390
+ capabilities: {
391
+ [key: string]: boolean | {
392
+ listChanged?: boolean;
393
+ subscribe?: boolean;
394
+ [key: string]: unknown;
395
+ };
396
+ };
397
+ servers: OpenAPIServer[];
398
+ tools: McpTool[];
399
+ resources: McpResource[];
400
+ prompts: McpPrompt[];
401
+ }
402
+ export interface McpTool {
403
+ name: string;
404
+ title?: string;
405
+ description?: string;
406
+ inputSchema: OpenAPISchema;
407
+ outputSchema?: OpenAPISchema;
408
+ security?: OpenAPISecurityRequirement[];
409
+ tags?: string[];
410
+ 'x-badges'?: OpenAPIXBadges[];
411
+ }
412
+ export interface McpResource {
413
+ name: string;
414
+ title?: string;
415
+ description?: string;
416
+ uri: string;
417
+ mimeType: string;
418
+ security?: OpenAPISecurityRequirement[];
419
+ tags?: string[];
420
+ 'x-badges'?: OpenAPIXBadges[];
421
+ }
422
+ export interface McpPrompt {
423
+ name: string;
424
+ title?: string;
425
+ description: string;
426
+ arguments: McpPromptArgument[];
427
+ }
428
+ export interface McpPromptArgument {
429
+ name: string;
430
+ description: string;
431
+ required: boolean;
432
+ }
@@ -1,3 +1,4 @@
1
+ import type { OpenAPIServer } from '../types/open-api';
1
2
  /**
2
3
  * Maps over array passing `isLast` bool to iterator as the second argument
3
4
  */
@@ -42,5 +43,6 @@ export declare function getWindowReferenceOptions<T>(option: string): T | null;
42
43
  export declare function getJsUrl(): string;
43
44
  export declare const normalizeText: (text?: string | GenericObject) => string;
44
45
  export declare const getValueFromMdParsedExtension: (item: GenericObject, key: "description" | "summary" | "x-summary" | "x-enumDescriptions") => any;
46
+ export declare function getServerDisplayName(server: OpenAPIServer): string | undefined;
45
47
  export declare function isLastInArray(arr: Array<unknown>, index: number): boolean;
46
48
  export declare function isLastProperty(obj: object, key: string): boolean;