@redocly/openapi-docs 3.15.0-rc.6 → 3.15.0

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 (72) hide show
  1. package/dist/redocly-openapi-docs.min.js +4324 -3482
  2. package/lib/components/ApiInfo/ApiInfo.js +1 -1
  3. package/lib/components/ApiInfo/Metadata.js +1 -1
  4. package/lib/components/ContentItem/ContentItem.js +1 -1
  5. package/lib/components/Discriminator/DefaultMappingOption.d.ts +5 -0
  6. package/lib/components/Discriminator/DefaultMappingOption.js +15 -0
  7. package/lib/components/Discriminator/Discriminator.js +16 -2
  8. package/lib/components/Download/DownloadSpecification.js +2 -2
  9. package/lib/components/ExpandAllButton/ExpandAllButton.js +1 -1
  10. package/lib/components/Language/LanguageList.js +1 -1
  11. package/lib/components/McpOverview/McpOverview.js +3 -7
  12. package/lib/components/McpTool/McpTool.d.ts +1 -1
  13. package/lib/components/McpTool/McpTool.js +1 -1
  14. package/lib/components/McpTool/index.d.ts +0 -2
  15. package/lib/components/McpTool/index.js +1 -1
  16. package/lib/components/Overview/Overview.js +1 -1
  17. package/lib/components/PanelItem/styled.js +5 -9
  18. package/lib/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  19. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  20. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +1 -1
  21. package/lib/components/RedoclyOpenAPIDocs/styled.js +6 -2
  22. package/lib/components/RedoclyOpenAPIDocs/types.d.ts +3 -0
  23. package/lib/components/Replay/Replay.js +1 -1
  24. package/lib/components/RequestSamples/Example.js +1 -1
  25. package/lib/components/RequestSamples/RequestSamples.js +1 -1
  26. package/lib/components/RightPanel/RightPanel.js +1 -5
  27. package/lib/components/Samples/ExampleSwitch.js +1 -1
  28. package/lib/components/SchemaCatalogLink/tests/SchemaCatalogLink.test.js +1 -1
  29. package/lib/components/SectionContent/SectionContent.js +4 -4
  30. package/lib/components/ServerList/ServerList.js +11 -11
  31. package/lib/components/ServerListDropdown/ServerListDropdown.js +1 -1
  32. package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
  33. package/lib/components/TagItem/OperationsNavigation.js +2 -2
  34. package/lib/components/TagItem/TagItem.js +6 -7
  35. package/lib/components/common/Dropdown/Dropdown.d.ts +3 -3
  36. package/lib/components/common/Dropdown/Dropdown.js +9 -9
  37. package/lib/components/common/Fields/fields.js +3 -5
  38. package/lib/components/common/SchemaSelection/SchemaSelection.d.ts +2 -2
  39. package/lib/components/common/SchemaSelection/SchemaSelection.js +1 -1
  40. package/lib/hooks/index.d.ts +1 -1
  41. package/lib/hooks/index.js +1 -1
  42. package/lib/hooks/useRouter.js +1 -1
  43. package/lib/icons/DefaultMappingIcon/DefaultMappingIcon.d.ts +4 -0
  44. package/lib/icons/DefaultMappingIcon/DefaultMappingIcon.js +8 -0
  45. package/lib/icons/DefaultMappingIcon/index.d.ts +1 -0
  46. package/lib/icons/DefaultMappingIcon/index.js +1 -0
  47. package/lib/index.d.ts +0 -1
  48. package/lib/index.js +1 -1
  49. package/lib/models/group.js +1 -1
  50. package/lib/models/mediaType.js +1 -1
  51. package/lib/models/schema.d.ts +2 -1
  52. package/lib/models/schema.js +2 -2
  53. package/lib/models/types.d.ts +2 -0
  54. package/lib/services/menu/builder.js +1 -1
  55. package/lib/services/menu/markdown.js +1 -1
  56. package/lib/services/menu/tags.js +2 -4
  57. package/lib/services/types.d.ts +2 -7
  58. package/lib/standalone.js +1 -1
  59. package/lib/types/open-api.d.ts +3 -13
  60. package/lib/utils/loadAndBundleSpec.js +1 -1
  61. package/lib/utils/mcp.d.ts +1 -1
  62. package/lib/utils/mcp.js +1 -1
  63. package/lib/utils/menu.js +1 -1
  64. package/lib/utils/openapi.js +1 -1
  65. package/lib/utils/string.js +1 -1
  66. package/package.json +11 -9
  67. package/lib/components/McpTool/McpPrompt.d.ts +0 -6
  68. package/lib/components/McpTool/McpPrompt.js +0 -9
  69. package/lib/components/McpTool/McpResource.d.ts +0 -7
  70. package/lib/components/McpTool/McpResource.js +0 -14
  71. package/lib/components/RedoclyOpenAPIDocs/Error.d.ts +0 -3
  72. package/lib/components/RedoclyOpenAPIDocs/Error.js +0 -25
@@ -1 +1 @@
1
- import{jsx as r,jsxs as s}from"react/jsx-runtime";import{useAtomValue as D}from"jotai";import{LayoutVariant as g}from"@redocly/config";import{AfterOpenApiTitle as h}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle";import{AfterOpenApiDescription as k}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiDescription";import{PageActions as S}from"@redocly/theme/components/PageActions/PageActions";import{SamplesMiddlePanel as H,Row as M}from"../common/index.js";import{ExternalDocumentation as T}from"../ExternalDocumentation/index.js";import{Markdown as m}from"../Markdown/index.js";import{ApiHeader as j}from"./styled.js";import{globalStoreAtom as y}from"../../jotai/store.js";import{saveTextBeforeHeading as P}from"../../utils/saveTextBeforeHeading.js";import{getValueFromMdParsedExtension as p}from"../../utils/helpers.js";import{RenderHook as f}from"../RenderHook/index.js";import{Metadata as v}from"./Metadata.js";import{useTranslate as E}from"../../hooks/index.js";function z({item:l,layout:t}){const c=E(),{options:{unstable_hooks:e,hideInfoMetadata:d,routingBasePath:u},parser:{definition:A}}=D(y),o=l.infoDefinition;if(!o)return null;const i=P(p(o,"description")||""),a=p(o,"summary")||void 0,n=A?.externalDocs||o?.externalDocs,x=t===g.STACKED;return r(M,{layout:t,children:s(H,{fullWidth:!0,className:"api-info",isStacked:x,children:[s(j,{children:[(o.title||"")+(o.version?` (${o.version})`:""),r(S,{pageSlug:u})]}),r(f,{Hook:h||e?.AfterApiTitle,props:{info:o}}),a&&r(m,{source:a,"data-role":"redoc-summary"}),i&&r(m,{source:i,"data-role":"redoc-description"}),r(f,{Hook:k||e?.AfterOpenApiDescription,props:{info:o}}),n&&r(T,{externalDocs:n}),!d&&r(v,{metadata:o["x-metadata"],translate:c})]})})}export{z as ApiInfo};
1
+ import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useAtomValue as A}from"jotai";import{LayoutVariant as g}from"@redocly/config";import{AfterOpenApiTitle as h}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle";import{PageActions as D}from"@redocly/theme/components/PageActions/PageActions";import{SamplesMiddlePanel as k,Row as S}from"../common/index.js";import{ExternalDocumentation as M}from"../ExternalDocumentation/index.js";import{Markdown as s}from"../Markdown/index.js";import{ApiHeader as T}from"./styled.js";import{globalStoreAtom as j}from"../../jotai/store.js";import{saveTextBeforeHeading as y}from"../../utils/saveTextBeforeHeading.js";import{getValueFromMdParsedExtension as m}from"../../utils/helpers.js";import{RenderHook as H}from"../RenderHook/index.js";import{Metadata as P}from"./Metadata.js";import{useTranslate as v}from"../../hooks/index.js";function $({item:p,layout:r}){const l=v(),{options:{unstable_hooks:d,hideInfoMetadata:f,routingBasePath:c},parser:{definition:u}}=A(j),o=p.infoDefinition;if(!o)return null;const e=y(m(o,"description")||""),i=m(o,"summary")||void 0,a=u?.externalDocs||o?.externalDocs,x=r===g.STACKED;return t(S,{layout:r,children:n(k,{fullWidth:!0,className:"api-info",isStacked:x,children:[n(T,{children:[(o.title||"")+(o.version?` (${o.version})`:""),t(D,{pageSlug:c})]}),t(H,{Hook:h||d?.AfterApiTitle,props:{info:o}}),i&&t(s,{source:i,"data-role":"redoc-summary"}),e&&t(s,{source:e,"data-role":"redoc-description"}),a&&t(M,{externalDocs:a}),!f&&t(P,{metadata:o["x-metadata"],translate:l})]})})}export{$ as ApiInfo};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useMemo as c}from"react";import{Markdown as d}from"@redocly/theme/components/Markdown/Markdown";import{H3 as p}from"@redocly/theme/components/Typography/H3";import{isNotNull as a}from"@redocly/theme/core/openapi";import{isAbsoluteUrl as s}from"../../utils/helpers.js";const f=["title","description"];function m([t,r]){return f.includes(t)?null:Array.isArray(r)?{key:t,value:r.filter(o=>typeof o!="object").join(", ")}:typeof r=="object"?null:{key:t,value:r}}function y({metadata:t,translate:r}){const o=c(()=>Object.entries(t||{}).map(m).filter(a),[t]);return t?n(d,{children:[e(p,{children:r("openapi.info.metadata.title","Metadata")}),n("table",{className:"md",children:[e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:r("openapi.key","Key")}),e("th",{scope:"col",children:r("openapi.value","Value")})]})}),e("tbody",{children:o.map(({key:l,value:i})=>n("tr",{children:[e("td",{children:l}),e("td",{children:typeof i=="string"&&s(i)?e("a",{href:i,target:"_blank",rel:"noreferrer",children:i}):String(i)})]},l))})]})]}):null}export{y as Metadata};
1
+ import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useMemo as c}from"react";import{Markdown as d}from"@redocly/theme/components/Markdown/Markdown";import{H3 as a}from"@redocly/theme/components/Typography/H3";import{isNotNull as p}from"@redocly/theme/core/openapi";const s=["title","description"];function f([e,r]){return s.includes(e)?null:Array.isArray(r)?{key:e,value:r.filter(n=>typeof n!="object").join(", ")}:typeof r=="object"?null:{key:e,value:r}}function b({metadata:e,translate:r}){const n=c(()=>Object.entries(e||{}).map(f).filter(p),[e]);return e?i(d,{children:[t(a,{children:r("openapi.info.metadata.title","Metadata")}),i("table",{className:"md",children:[t("thead",{children:i("tr",{children:[t("th",{scope:"col",children:r("openapi.key","Key")}),t("th",{scope:"col",children:r("openapi.value","Value")})]})}),t("tbody",{children:n.map(({key:o,value:l})=>i("tr",{children:[t("td",{children:o}),t("td",{children:`${l}`})]},o))})]})]}):null}export{b as Metadata};
@@ -1 +1 @@
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 e}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 E}from"../SectionItem/index.js";import h from"../ContentItems/useScrollOnRender.js";import{isRootItem as j}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:e,section:E,schema:o=>t(e,{...o,item:o.item,isExpanded:!0}),operation:g,tool:o=>t(e,{...o,item:o.item,isExpanded:!0}),rsrc:o=>t(e,{...o,item:o.item,isExpanded:!0}),prompt:o=>t(e,{...o,item:o.item,isExpanded:!0}),root:R};function b({item:o,routingBasePath:n,children:p,layout:s}){const a=j(o),m=_[a?"root":o.type],d=o.type==="tag"&&o.items.length>0,r=C({item:o,routingBasePath:n});let l=h(o,n);const c=x(S);return f(i,{children:[m&&t(y,{id:o.id,ref:l,sectionId:I(n,o.id),underlined:A(o),expanded:d&&!r,children:t(m,{item:o,routingBasePath:n,isExpanded:r,layout:s||c})}),(r||o.type!=="tag")&&!!o.items?.length&&t(i,{children:p})]})}const J=u(b);export{J 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};
@@ -0,0 +1,5 @@
1
+ import type { ReactElement } from 'react';
2
+ export interface DefaultMappingOptionProps {
3
+ label: string;
4
+ }
5
+ export declare function DefaultMappingOption({ label }: DefaultMappingOptionProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ import{jsx as e,jsxs as p}from"react/jsx-runtime";import{Tooltip as o}from"@redocly/theme/components/Tooltip/Tooltip";import{DefaultMappingIcon as r}from"../../icons/DefaultMappingIcon/DefaultMappingIcon.js";import{useTranslate as a}from"../../hooks/index.js";import{styled as i}from"../../styled-components.js";function g({label:t}){const n=a();return e(o,{tip:n("openapi.discriminator.defaultMappingTooltip","OpenAPI 3.2: defaultMapping used when other mappings don't match."),placement:"bottom",children:p(s,{children:[e(l,{children:e(r,{})}),e(m,{children:t})]})})}const s=i.div`
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 4px;
5
+ min-width: 0;
6
+ `,l=i.div`
7
+ flex-shrink: 0;
8
+ display: flex;
9
+ align-items: center;
10
+ `,m=i.span`
11
+ overflow: hidden;
12
+ text-overflow: ellipsis;
13
+ white-space: nowrap;
14
+ min-width: 0;
15
+ `;export{g as DefaultMappingOption};
@@ -1,5 +1,19 @@
1
- import{jsx as r,jsxs as l}from"react/jsx-runtime";import{memo as p,useMemo as c}from"react";import{strikethroughText as d}from"../../utils/index.js";import{SchemaSelection as a}from"../common/SchemaSelection/SchemaSelection.js";import{SelectionTitle as f}from"../common/index.js";import{styled as u}from"../../styled-components.js";function x({activeOneOfIdx:t,parent:e,onChange:n,translate:o}){const m=c(()=>(e.oneOf||[]).map((i,s)=>({label:i.schema.deprecated?`${d(i.title)} (${o("openapi.badges.deprecated","deprecated").toLowerCase()})`:i.title,value:s})),[e.oneOf,o]);return e.oneOf===void 0?null:l(h,{children:[r(f,{children:o("openapi.discriminator","Discriminator")}),r(a,{options:m,pointer:e.operationPointer,onChange:n,schema:e,defaultOneOfIdx:t})]})}const y=p(x),h=u.div`
1
+ import{jsx as n,jsxs as s}from"react/jsx-runtime";import{memo as c,useMemo as d}from"react";import{strikethroughText as f}from"../../utils/index.js";import{SchemaSelection as g}from"../common/SchemaSelection/SchemaSelection.js";import{SelectionTitle as u}from"../common/index.js";import{styled as t}from"../../styled-components.js";import{DefaultMappingOption as x}from"./DefaultMappingOption.js";function D({activeOneOfIdx:a,parent:e,onChange:p,translate:i}){const m=d(()=>(e.oneOf||[]).map((o,r)=>{const l=o.schema.deprecated?`${f(o.title)} (${i("openapi.badges.deprecated","deprecated").toLowerCase()})`:o.title;return o.isDefaultMapping?{label:i("openapi.discriminator.defaultMapping","Default mapping"),value:r,element:n(x,{label:i("openapi.discriminator.defaultMapping","Default mapping")}),...e.oneOf&&e.oneOf.length>1?{divider:n(v,{})}:{}}:{label:l,value:r}}),[e.oneOf,i]);return e.oneOf===void 0?null:s(h,{children:[n(u,{children:i("openapi.discriminator","Discriminator")}),n(g,{options:m,pointer:e.operationPointer,onChange:p,schema:e,defaultOneOfIdx:a})]})}const C=c(D),h=t.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  align-items: flex-start;
5
- `;export{y as Discriminator};
5
+ `,v=t.span`
6
+ background-color: var(--border-color-primary);
7
+ display: block;
8
+ align-self: stretch;
9
+
10
+ [data-component-name='Dropdown/DropdownMenu'] & {
11
+ height: 1px;
12
+ margin: calc(var(--spacing-xxs) / 2) var(--spacing-xxs);
13
+ }
14
+
15
+ [data-component-name='Segmented/Segmented'] & {
16
+ width: 1px;
17
+ margin: var(--spacing-xxs) calc(var(--spacing-xxs) / 2);
18
+ }
19
+ `;export{C as Discriminator};
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p,useCallback as f}from"react";import{DownloadIcon as x}from"@redocly/theme/icons/DownloadIcon/DownloadIcon";import{getPathPrefix as g,combineUrls as w}from"@redocly/theme/core/openapi";import{Button as b}from"@redocly/theme/components/Button/Button";import{DocumentIcon as h}from"@redocly/theme/icons/DocumentIcon/DocumentIcon";import{JsonIcon as u}from"@redocly/theme/icons/JsonIcon/JsonIcon";import{FileIcon as v}from"@redocly/theme/icons/FileIcon/FileIcon";import{useTelemetry as y}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";function k({downloadObjects:t}){const l=y(),n=g(),c=f(o=>{switch(o){case"yaml":return e(h,{});case"json":return e(u,{});default:return e(v,{})}},[]);return t?e(C,{children:(t||[]).map(({title:o,url:a,iconType:m})=>{const i=n?w(n,a):a;return s(D,{onClick:()=>{l.sendOpenapiDocsDownloadDefinitionClickedMessage()},children:[s(j,{children:[c(m),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:e(b,{variant:"text",size:"small",icon:e(x,{})})})]},o)})}):e(d,{})}const N=p(k),D=r.div`
1
+ import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p,useCallback as f}from"react";import{DownloadIcon as x}from"@redocly/theme/icons/DownloadIcon/DownloadIcon";import{getPathPrefix as g,combineUrls as w}from"@redocly/theme/core/openapi";import{Button as b}from"@redocly/theme/components/Button/Button";import{DocumentIcon as h}from"@redocly/theme/icons/DocumentIcon/DocumentIcon";import{JsonIcon as u}from"@redocly/theme/icons/JsonIcon/JsonIcon";import{FileIcon as v}from"@redocly/theme/icons/FileIcon/FileIcon";import{useTelemetry as y}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";function k({downloadObjects:t}){const l=y(),n=g(),c=f(o=>{switch(o){case"yaml":return e(h,{});case"json":return e(u,{});default:return e(v,{})}},[]);return t?e(C,{children:(t||[]).map(({title:o,url:a,iconType:m})=>{const i=n?w(n,a):a;return s(j,{onClick:()=>{l.sendDownloadDefinitionClickedMessage()},children:[s(D,{children:[c(m),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:e(b,{variant:"text",size:"small",icon:e(x,{})})})]},o)})}):e(d,{})}const N=p(k),j=r.div`
2
2
  display: flex;
3
3
  align-items: baseline;
4
4
  justify-content: space-between;
@@ -10,7 +10,7 @@ import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p
10
10
  padding-bottom: 0px;
11
11
  border-bottom: none;
12
12
  }
13
- `,j=r.span`
13
+ `,D=r.span`
14
14
  display: flex;
15
15
  width: calc(100% - 25px);
16
16
  gap: var(--spacing-xs);
@@ -1,3 +1,3 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useAtom as m}from"jotai";import{MaximizeIcon as d}from"@redocly/theme/icons/MaximizeIcon/MaximizeIcon";import{Button as c}from"@redocly/theme/components/Button/Button";import{operationStore as x}from"../../jotai/operation.js";import{useTelemetry as u,useTranslate as f}from"../../hooks/index.js";import{styled as A}from"../../styled-components.js";const k=({operationPointer:a,type:e,onPanelToggle:s})=>{const t=f(),[l,r]=m(x(a)),i=u(),p=()=>{const o=!l[e].expandedAll;i.sendOpenapiDocsExpandCollapseAllClickedMessage({isExpanded:o}),r({[e]:{expandedAll:o}}),s?.(o,e==="request"?"request":"responses")};return n(g,{icon:n(d,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:p,children:l[e].expandedAll?t("openapi.collapseAll","Collapse all"):t("openapi.expandAll","Expand all")})},g=A(c)`
1
+ import{jsx as n}from"react/jsx-runtime";import{useAtom as m}from"jotai";import{MaximizeIcon as d}from"@redocly/theme/icons/MaximizeIcon/MaximizeIcon";import{Button as c}from"@redocly/theme/components/Button/Button";import{operationStore as x}from"../../jotai/operation.js";import{useTelemetry as u,useTranslate as f}from"../../hooks/index.js";import{styled as A}from"../../styled-components.js";const k=({operationPointer:a,type:e,onPanelToggle:s})=>{const t=f(),[l,r]=m(x(a)),i=u(),p=()=>{const o=!l[e].expandedAll;i.sendExpandCollapseAllClickedMessage({isExpanded:o}),r({[e]:{expandedAll:o}}),s?.(o,e==="request"?"request":"responses")};return n(g,{icon:n(d,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:p,children:l[e].expandedAll?t("openapi.collapseAll","Collapse all"):t("openapi.expandAll","Expand all")})},g=A(c)`
2
2
  margin-left: auto;
3
3
  `;export{k as ExpandAllButton};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as I}from"react/jsx-runtime";import{useLayoutEffect as T,useRef as A,useState as L,useCallback as S,memo as j,useMemo as D}from"react";import{useAtomValue as E,useSetAtom as H}from"jotai";import{Button as V}from"@redocly/theme/components/Button/Button";import{OverflowMenuVerticalIcon as W}from"@redocly/theme/icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon";import{LanguageDropdown as v}from"./LanguageDropdown.js";import{languageAtom as R,layoutAtom as _}from"../../jotai/app.js";import{LanguageListContainer as M,LanguageListItem as O,Container as z}from"./styled.js";import{LanguageItem as G}from"./LanguageItem.js";import{DROPDOWN_TRIGGER_WIDTH as B,ITEM_WIDTH as w}from"./constants.js";import{LanguageListSkeleton as N}from"../common/Skeleton/LanguageListSkeleton.js";import{useTelemetry as P}from"../../hooks/index.js";function $({languages:o,activeLanguage:t}){const[n,i]=L([]),[s,l]=L([]),u=P(),f=A(null),g=E(_),h=H(R),p=e=>{u.sendOpenapiDocsSelectLanguageClickedMessage({language:e})},k=e=>{h(e),p(e)},C=e=>{const m=s.findIndex(r=>r.key===e);if(m!==-1){const r=[...s],c=[...n];y(c,r,m),i(c),l(r),p(e),h(e)}},d=S(()=>{const e=f?.current?.offsetWidth;if(!e)return;const{newVisibleItems:m,newHiddenItems:r}=q(e,[...o]),c=r.findIndex(b=>b.key===t);c!==-1&&y(m,r,c),i(m),l(r)},[t,o]);T(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[g,t]);const x=D(()=>n.length>=5||s.length?"space-between":"start",[s.length,n.length]);return I(z,{ref:f,children:[I(M,{$justifyContent:x,children:[!n.length&&a(N,{}),n.map(e=>a(O,{onClick:()=>k(e.key),active:t===e.key,children:a(G,{item:e,withIcon:!0})},e.key))]}),s.length?a(v,{activeTab:t,samples:s,onChange:C,trigger:a(V,{icon:a(W,{}),variant:"text",style:{height:"100%"}}),withArrow:!1,withCheckmark:!1,width:156}):null]})}const se=j($);function q(o,t){let n=0;const i=[],s=[];return t.forEach((l,u)=>{const g=u===t.length-1&&s.length===0?0:B;o&&n+w+g<=o?(i.push(l),n+=w):s.push(l)}),{newVisibleItems:i,newHiddenItems:s}}function y(o,t,n){const i=o[o.length-1];i&&(o[o.length-1]=t[n],t[n]=i)}export{se as LanguageList};
1
+ import{jsx as a,jsxs as I}from"react/jsx-runtime";import{useLayoutEffect as T,useRef as A,useState as L,useCallback as S,memo as j,useMemo as E}from"react";import{useAtomValue as H,useSetAtom as V}from"jotai";import{Button as W}from"@redocly/theme/components/Button/Button";import{OverflowMenuVerticalIcon as v}from"@redocly/theme/icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon";import{LanguageDropdown as D}from"./LanguageDropdown.js";import{languageAtom as R,layoutAtom as _}from"../../jotai/app.js";import{LanguageListContainer as M,LanguageListItem as O,Container as z}from"./styled.js";import{LanguageItem as G}from"./LanguageItem.js";import{DROPDOWN_TRIGGER_WIDTH as B,ITEM_WIDTH as w}from"./constants.js";import{LanguageListSkeleton as N}from"../common/Skeleton/LanguageListSkeleton.js";import{useTelemetry as P}from"../../hooks/index.js";function $({languages:o,activeLanguage:t}){const[n,i]=L([]),[s,l]=L([]),u=P(),f=A(null),g=H(_),h=V(R),p=e=>{u.sendSelectLanguageClickedMessage({language:e})},k=e=>{h(e),p(e)},C=e=>{const m=s.findIndex(r=>r.key===e);if(m!==-1){const r=[...s],c=[...n];y(c,r,m),i(c),l(r),p(e),h(e)}},d=S(()=>{const e=f?.current?.offsetWidth;if(!e)return;const{newVisibleItems:m,newHiddenItems:r}=q(e,[...o]),c=r.findIndex(b=>b.key===t);c!==-1&&y(m,r,c),i(m),l(r)},[t,o]);T(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[g,t]);const x=E(()=>n.length>=5||s.length?"space-between":"start",[s.length,n.length]);return I(z,{ref:f,children:[I(M,{$justifyContent:x,children:[!n.length&&a(N,{}),n.map(e=>a(O,{onClick:()=>k(e.key),active:t===e.key,children:a(G,{item:e,withIcon:!0})},e.key))]}),s.length?a(D,{activeTab:t,samples:s,onChange:C,trigger:a(W,{icon:a(v,{}),variant:"text",style:{height:"100%"}}),withArrow:!1,withCheckmark:!1,width:156}):null]})}const se=j($);function q(o,t){let n=0;const i=[],s=[];return t.forEach((l,u)=>{const g=u===t.length-1&&s.length===0?0:B;o&&n+w+g<=o?(i.push(l),n+=w):s.push(l)}),{newVisibleItems:i,newHiddenItems:s}}function y(o,t,n){const i=o[o.length-1];i&&(o[o.length-1]=t[n],t[n]=i)}export{se as LanguageList};
@@ -1,15 +1,11 @@
1
- import{jsx as t,jsxs as s,Fragment as c}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 P,PAGE_ACTIONS_MCP as E}from"../../utils/mcp.js";import{PanelItem as r}from"../PanelItem/PanelItem.js";import{Item as C,PanelItemsList as _,Title as j}from"../PanelItem/styled.js";import{useTranslate as x}from"../../hooks/index.js";import{styled as n}from"../../styled-components.js";function F({mcpInfo:e,mcpServers:a}){const o=x();function m(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.listChanged}function d(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.subscribe}return s(A,{children:[e?.protocolVersion&&t(r,{header:o("openapi.mcp.protocolVersion","Protocol version"),title:e.protocolVersion}),e?.capabilities&&t(r,{header:o("openapi.mcp.capabilities","Capabilities"),title:t(c,{children:f.map(i=>e?.capabilities[i]?s(p,{size:"small",icon:t(g,{}),children:[i,m(i)?" (list changed)":"",d(i)?" (subscribe)":""]},i):null)})}),e?.capabilities[P]&&t(r,{header:o("openapi.mcp.experimentalCapabilities","Experimental capabilities"),title:t(L,{children:Object.entries(e?.capabilities.experimental||{}).map(([i,l])=>s(b.Fragment,{children:[s("span",{children:[i,":"]}),t(p,{children:typeof l=="object"?JSON.stringify(l):String(l)})]},i))})}),t(r,{header:o("openapi.mcp.endpoint","Endpoint"),title:t(c,{children:a[0]?.url}),actions:[t(h,{data:a[0]?.url},"NewTabButton")]}),!!a[0]?.url&&t(r,{title:t(T,{children:t(u,{actions:E,mcpUrl:a[0]?.url})})})]})}const A=n(_)`
2
- ${C}, ${j} {
3
- overflow: visible;
4
- }
5
- `,T=n.div`
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`
6
2
  & button {
7
3
  width: 100%;
8
4
  }
9
5
  > div {
10
6
  padding: 0;
11
7
  }
12
- `,L=n.div`
8
+ `,x=c.div`
13
9
  display: grid;
14
10
  grid-template-columns: 1fr 2fr;
15
11
  gap: 10px;
@@ -17,4 +13,4 @@ import{jsx as t,jsxs as s,Fragment as c}from"react/jsx-runtime";import*as b from
17
13
  > * {
18
14
  justify-self: start;
19
15
  }
20
- `;export{F as McpOverview};
16
+ `;export{O as McpOverview};
@@ -1,5 +1,5 @@
1
1
  interface McpToolProps {
2
- name: string;
2
+ toolName: string;
3
3
  id: string;
4
4
  }
5
5
  export declare const McpTool: import("react").NamedExoticComponent<McpToolProps>;
@@ -1,4 +1,4 @@
1
- import{jsxs as a,jsx as n}from"react/jsx-runtime";import{memo as M,useCallback as g,useMemo as c}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({name:t,id:m}){const{parser:i}=s(f),o=w(),e=c(()=>(i.definition["x-mcp"]?.tools||[]).find(r=>r.name===t),[i,t]),l=c(()=>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:l&&n(_,{securities:l})}),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:l}){const{parser:p,options:r}=s(f),u=s(L),d=u===k.STACKED,T=c(()=>C({parser:p,info:{"application/json":{schema:t}},isRequestType:!1,options:r,data:{operation:{pointer:"McpTool"}}}),[r,p,t]),y=c(()=>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]}),l,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)`
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
2
  margin: calc(var(--spacing-unit) * 2) 0;
3
3
 
4
4
  & + & {
@@ -1,3 +1 @@
1
1
  export * from './McpTool.js';
2
- export * from './McpResource.js';
3
- export * from './McpPrompt.js';
@@ -1 +1 @@
1
- export*from"./McpTool.js";export*from"./McpResource.js";export*from"./McpPrompt.js";
1
+ export*from"./McpTool.js";
@@ -1 +1 @@
1
- import{jsx as t,jsxs as h,Fragment as b}from"react/jsx-runtime";import{useAtomValue as f}from"jotai";import{CopyButton as v}from"@redocly/theme/components/Buttons/CopyButton";import{NewTabButton as c}from"@redocly/theme/components/Buttons/NewTabButton";import{EmailButton as B}from"@redocly/theme/components/Buttons/EmailButton";import{AdditionalOverviewInfo as O}from"@redocly/theme/components/OpenApiDocs/hooks/AdditionalOverviewInfo";import{PanelItem as a,PanelItemDescription as l,PanelItemsList as _}from"../PanelItem/index.js";import{globalStoreAtom as g}from"../../jotai/store.js";import{RenderHook as w}from"../RenderHook/RenderHook.js";function E({info:e,translate:n}){const{options:o}=f(g),{unstable_hooks:i}=o||{},m=e.contact&&e.contact.url&&t(a,{header:t(l,{children:n("openapi.info.contact.url","URL")}),title:t("a",{href:e.contact.url,target:"_blank",rel:"noreferrer",children:e.contact.url}),actions:[t(c,{data:e.contact.url},"NewTabButton")]})||null,s=e.contact&&e.contact.email&&t(a,{header:t(l,{children:e.contact.name||n("openapi.info.contact.name","E-mail")}),title:t("a",{href:"mailto:"+e.contact.email,children:e.contact.email}),actions:[t(v,{data:e.contact.email},"CopyButton"),t(B,{data:e.contact.email},"EmailButton")]})||null,u=e.license&&t(a,{header:t(l,{children:n("openapi.info.license","License")}),title:e.license.identifier?e.license.identifier:t("a",{href:e.license.url,target:"_blank",rel:"noreferrer",children:e.license.name}),actions:[t(c,{data:e.license.url||""},"NewTabButton")]})||null,p=e.termsOfService&&t(a,{title:t("a",{href:e.termsOfService,target:"_blank",rel:"noreferrer",children:n("openapi.info.termsOfService","Terms of Service")}),actions:[t(c,{data:e.termsOfService},e.termsOfService)]})||null,d=e["x-links"]?.map(r=>t(a,{header:t(l,{children:r.name}),title:t("a",{href:r.url,target:"_blank",rel:"noreferrer",children:r.url}),actions:[t(c,{data:r.url},"NewTabButton")]},r.url))||null;return t(b,{children:h(_,{children:[m,s,u,p,d,t(w,{Hook:O||i?.AfterOpenApiInfo,props:{info:e}})]})})}export{E as Overview};
1
+ import{jsx as t,jsxs as s,Fragment as u}from"react/jsx-runtime";import{CopyButton as d}from"@redocly/theme/components/Buttons/CopyButton";import{NewTabButton as c}from"@redocly/theme/components/Buttons/NewTabButton";import{EmailButton as p}from"@redocly/theme/components/Buttons/EmailButton";import{PanelItem as a,PanelItemDescription as n,PanelItemsList as h}from"../PanelItem/index.js";function _({info:e,translate:r}){const l=e.contact&&e.contact.url&&t(a,{header:t(n,{children:r("openapi.info.contact.url","URL")}),title:t("a",{href:e.contact.url,target:"_blank",rel:"noreferrer",children:e.contact.url}),actions:[t(c,{data:e.contact.url},"NewTabButton")]})||null,i=e.contact&&e.contact.email&&t(a,{header:t(n,{children:e.contact.name||r("openapi.info.contact.name","E-mail")}),title:t("a",{href:"mailto:"+e.contact.email,children:e.contact.email}),actions:[t(d,{data:e.contact.email},"CopyButton"),t(p,{data:e.contact.email},"EmailButton")]})||null,o=e.license&&t(a,{header:t(n,{children:r("openapi.info.license","License")}),title:e.license.identifier?e.license.identifier:t("a",{href:e.license.url,target:"_blank",rel:"noreferrer",children:e.license.name}),actions:[t(c,{data:e.license.url||""},"NewTabButton")]})||null,m=e.termsOfService&&t(a,{title:t("a",{href:e.termsOfService,target:"_blank",rel:"noreferrer",children:r("openapi.info.termsOfService","Terms of Service")}),actions:[t(c,{data:e.termsOfService},e.termsOfService)]})||null;return t(u,{children:s(h,{children:[l,i,o,m]})})}export{_ as Overview};
@@ -1,11 +1,11 @@
1
- import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{styled as t}from"../../styled-components.js";const a=t.span`
1
+ import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{styled as t}from"../../styled-components.js";const r=t.span`
2
2
  display: flex;
3
3
  justify-content: space-between;
4
4
  align-items: center;
5
5
  padding: 0;
6
6
  position: relative;
7
7
  width: 100%;
8
- `,r=t.span`
8
+ `,a=t.span`
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  justify-content: flex-start;
@@ -16,7 +16,7 @@ import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"
16
16
  color: var(--menu-content-title-color);
17
17
  font-size: var(--h6-font-size);
18
18
  line-height: var(--line-height-xsm);
19
- `,l=t.p`
19
+ `,l=t.div`
20
20
  margin: 0;
21
21
  color: var(--text-color-secondary);
22
22
  font-size: var(--font-size-base);
@@ -44,14 +44,10 @@ import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"
44
44
  font-size: var(--font-size-base);
45
45
  line-height: var(--line-height-base);
46
46
  font-weight: var(--font-weight-medium);
47
- display: flex;
48
- align-items: center;
49
- gap: var(--spacing-xs);
50
- justify-content: flex-start;
51
- `,x=t(o)`
47
+ `,m=t(o)`
52
48
  width: 14px;
53
49
  height: 14px;
54
50
  position: absolute;
55
51
  left: -18px;
56
52
  bottom: 3px;
57
- `;export{p as ActionsWrap,s as Header,r as Item,d as PanelItemDescription,a as PanelItemWrap,c as PanelItemsList,x as StyledCheckmarkIcon,l as Title};
53
+ `;export{p as ActionsWrap,s as Header,a as Item,d as PanelItemDescription,r as PanelItemWrap,c as PanelItemsList,m as StyledCheckmarkIcon,l as Title};
@@ -1 +1 @@
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 M}from"@redocly/config";import{createStore as E,Provider as O}from"jotai";import{html as A}from"@redocly/theme/markdoc/tags/html";import{Heading as P}from"@redocly/theme/markdoc/components/Heading/Heading";import{normalizeOptions as N,OpenAPIParser as R}from"../../services/index.js";import{SchemaDefinition as T}from"../SchemaDefinition/index.js";import{McpTool as D,McpResource as j,McpPrompt as k}from"../McpTool/index.js";import{getMarkdownHeaderId as x}from"./utils.js";import{mergeInMockServer as C}from"../../models/operation.js";import{normalizeServers as H}from"../../utils/index.js";import{appStore as I,appStoreOverrideAtom as L,layoutAtom as l,allowedEnvironmentsAtom as V,environmentAtom as z,userClaimsAtom as _}from"../../jotai/app.js";import{mapObject as h}from"../../utils/object.js";import{getServerEnvName as q}from"../../utils/environments.js";import{globalStoreAtom as B}from"../../jotai/store.js";import{getDefaultOperationStore as F,operationStore as W}from"../../jotai/operation.js";const G={ignoreNamedSchemas:["java.io.ObjectStreamField"],maxDisplayedEnumValues:10,markdocOptions:{tags:{html:A.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:{name:{type:String},id:{type:String}}},mcpResource:{render:"McpResource",attributes:{name:{type:String},id:{type:String}}},mcpPrompt:{render:"McpPrompt",attributes:{name:{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:T,McpTool:D,McpResource:j,McpPrompt:k,Heading:P}}},pe=v(({children:n,options:i,definitionUrl:t,definition:m,withState:e})=>{const p=g(()=>{const r=N(i,G),o=new R(m,t,r);return{options:r,parser:o}},[m,t,i]),a=b(()=>{const r=E(),o=p();r.set(B,o);const c=H(o.parser.definitionUrl,C(o.parser.definition?.servers||[],o.options.mockServer));r.sub(I,()=>{}),r.set(l,o.options?.layout||M.THREE_PANEL);const u=Object.fromEntries(c.map(s=>[q(s),{server:s.url,...h(s.variables||{},f=>f.default||"")}]));if(r.set(z,{environments:u}),r.set(_,e?.userClaims||{}),r.set(V,e?.allowedEnvironments),e&&r.set(L,{activeMimeName:e.activeMimeName,userClaims:e.userClaims,environment:e.environment,environments:e.environments}),e?.operation){const s=F(e.operation.pointer,e.operation.state.requestValues,e.operation.state.activeExampleName);r.set(W(e.operation.pointer),s)}return r},[p,e]);return y(()=>{e?.layout&&a.set(l,e?.layout)},[a,e?.layout]),d(O,{store:a,children:n})});export{pe 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 o,jsxs as s,Fragment as C}from"react/jsx-runtime";import{memo as E,useRef as T}from"react";import{LayoutVariant as p}from"@redocly/config";import{useSetAtom as w}from"jotai";import{ThreePanelLayout as A}from"@redocly/theme/layouts/ThreePanelLayout";import{SidebarLogo as I}from"@redocly/theme/components/SidebarLogo/SidebarLogo";import{GlobalStyle as j,useMount as D}from"@redocly/theme/core/openapi";import{StoreProvider as M}from"./Providers.js";import{Overlay as N}from"../Overlay.js";import{RedocWrap as _}from"./styled.js";import{StickyResponsiveSidebar as V}from"../StickySidebar/index.js";import{SideMenu as k}from"../SideMenu/index.js";import{Content as v}from"../Content/index.js";import{useContentItems as B,useUppercase2LowercaseRedirect as K,useTelemetry as F,usePerformanceMetrics as H}from"../../hooks/index.js";import{withRouter as U}from"../../hoc/withRouter.js";import{withStore as Y}from"../../hoc/withStore.js";import{compose as G}from"../../utils/index.js";import{useLicense as W}from"../../hooks/useLicense.js";import{allOperationsAtom as q}from"../../jotai/replay.js";const z=G(U,Y,E)(({licenseKey:m,onLoaded:a,children:e,options:t,layout:i,collapsedSidebar:d,parser:c,withCommonStyles:y})=>{const b=T(null),{isValid:l,licenseInfo:g}=W(m),R=w(q),u=F();K();const{contentItems:h,flatItems:S}=B({parser:c,options:t});H({sendTelemetry:f=>{const r=Object.fromEntries(Object.entries(f).map(([O,x])=>[O.toLowerCase(),x]));u.sendOpenapiDocsPerformanceMetricsMessage({cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb})}}),D(()=>{if(a?.(),u.sendOpenapiDocsViewedMessage({layout:i}),!t.hideReplay){const f=S.filter(r=>r.type==="operation");R(f)}});const{hideSidebar:P,scrollYOffset:L}=t||{},n=c.definition?.info?.["x-logo"];return s(C,{children:[y&&o(j,{}),s(_,{className:"redoc-wrap",ref:b,children:[!l&&o(N,{licenseInfo:g}),!P&&s(V,{scrollYOffset:L,className:"menu-content",collapsedSidebar:!d,children:[o(I,{imageUrl:n?.url,href:n?.href||c.definition?.info?.contact?.url,altText:n?.altText,backgroundColor:n?.backgroundColor}),o(k,{items:l?h:[]})]}),s(A,{className:"api-content",id:"api-content",layout:i===p.THREE_PANEL?p.THREE_PANEL:p.STACKED,collapsedSidebar:d,children:[o(v,{items:l?h:[],routingBasePath:t.routingBasePath}),e]})]})]})});function ue({onLoaded:m,children:a,store:e,withCommonStyles:t,router:i}){return e?.definition?o(M,{...e,children:o(z,{onLoaded:m,basePath:e.options?.routingBasePath,licenseKey:e.options?.licenseKey,disableRouter:e.options?.disableRouter,withCommonStyles:t,router:i,children:a})}):null}export{ue as RedoclyOpenAPIDocs};
1
+ import{jsx as 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 +1 @@
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
+ import{jsx as u}from"react/jsx-runtime";import{cloneElement as w,isValidElement as x,useEffect as g,useMemo as A,useState as a}from"react";import{Loading as D}from"@redocly/theme/components/Loaders/Loading";import{useDeepCompareMemoize as L,fixSpec as O}from"./utils.js";import{argValueToBoolean as B}from"../../utils/index.js";import{RedoclyOpenAPIDocs as E}from"./RedoclyOpenAPIDocs.js";import{loadAndBundleDefinition as p,loadOpenapiConfig as C}from"../../utils/loadAndBundleSpec.js";async function I(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 p(e||o);try{O(n)}catch{}return n}function T(e,o){return e.endsWith(".md")?p({openapi:"3.0.0",info:{title:o||"",version:"1.0",description:{$ref:e}},paths:{}}):p(e)}const k=({options:e,definitionUrl:o,definition:t,activeSampleLanguage:n,children:r})=>{const[s,l]=a(),[h,f]=a(!0),[d,y]=a(null),[m,S]=a(e||{});g(()=>{async function v(){f(!0);try{const c=await C();S({...e,...c}),y(await I(t,o,e))}catch(c){l(c.message)}}v()},[t,o,e]);const i=A(()=>{if(d)return{definition:d,options:m,definitionUrl:o,activeSampleLanguage:n}},L([d,o,m]));return g(()=>{i&&f(!1)},[i]),s||!i?null:h?B(e?.hideLoading,!1)?null:u(D,{color:"--loading-spinner-color"}):x(r)?w(r,{store:i}):null};function W({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:s,router:l}){return u(k,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:s,children:u(E,{withCommonStyles:!0,router:l||"hash"})})}export{k as AppProvider,W as RedoclyOpenAPIDocsStandalone,T as loadAndBundleSpecOrMd,I as loadSingle};
@@ -1,4 +1,4 @@
1
- import{styled as t}from"../../styled-components.js";const e=t.div`
1
+ import{styled as o}from"../../styled-components.js";const i=o.div`
2
2
  display: flex;
3
3
  position: relative;
4
4
  text-align: left;
@@ -13,9 +13,13 @@ import{styled as t}from"../../styled-components.js";const e=t.div`
13
13
  font-weight: var(--font-weight-regular);
14
14
  color: var(--text-color-primary);
15
15
  -webkit-font-text-smoothing: var(--text-smoothing);
16
+ margin-top: ${({$offset:t})=>t||0}px;
16
17
 
17
18
  * {
18
19
  box-sizing: border-box;
19
20
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
20
21
  }
21
- `;export{e as RedocWrap};
22
+ [id] {
23
+ scroll-margin-top: ${({$offset:t})=>t||0}px;
24
+ }
25
+ `;export{i as RedocWrap};
@@ -29,6 +29,7 @@ export interface StoreProviderProps {
29
29
  }
30
30
  export interface AppProviderProps {
31
31
  definitionUrl?: string;
32
+ disableTelemetry?: boolean;
32
33
  definition?: GenericObject;
33
34
  options?: RedocConfig;
34
35
  activeItemId?: string;
@@ -41,9 +42,11 @@ export interface AppProviderProps {
41
42
  export interface RedoclyOpenAPIDocsStandaloneProps {
42
43
  definition?: GenericObject;
43
44
  definitionUrl?: string;
45
+ disableTelemetry?: boolean;
44
46
  options?: RedocConfig;
45
47
  activeItemId?: string;
46
48
  activeSampleLanguage?: CodeSampleConfig['lang'];
47
49
  activeDeepLink?: string;
48
50
  router?: 'hash' | 'history';
51
+ typeOfUsage?: 'html' | 'cli' | 'react' | 'docker';
49
52
  }
@@ -1 +1 @@
1
- import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as J,memo as K,Suspense as W,useCallback as m,useRef as w,useState as H}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=J(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/useConfigureReplay";import{globalOptionsAtom as ne,globalStoreAtom as ae}from"../../jotai/store.js";import{allOperationsAtom as se,replayStateAtom as ie}from"../../jotai/replay.js";import{allOperations as le,getDefaultOperationStore as me}from"../../jotai/operation.js";import{LOADING_STATE as n}from"../../constants.js";import{environmentAtom as pe,userClaimsAtom as ce}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as fe}from"./utils.js";import{useTranslate as ue,useTelemetry as de}from"../../hooks/index.js";import{JsonPointer as ye}from"../../utils/index.js";import{getDefaultCollectorUrl as he}from"../../utils/telemetry.js";import{createTryItOpenEvent as Oe,createTryItSentEvent as Ie}from"../../events/index.js";import{joinWithSeparator as Re}from"../../services/history/helpers.js";function ge({operation:e,corsProxyUrl:L,fullOpenApi:d}){const y=ue(),P=de(),h=w(null),{mockServer:q,oAuth2RedirectURI:E,routingBasePath:c}=p(ne),O=p(se),{parser:I,options:{events:a}}=p(ae),R=p(ce),[s,N]=H(!1),[l,g]=u(ie),[v,A]=u(le),[[,V],S]=u(pe),{config:j,refresh:T}=re({userClaims:R,info:I?.definition.info,operation:{name:e.name,path:e.path,operationId:e.operationId||"",href:e.href,method:e.httpVerb},servers:e.servers},s);Z(h),$(s);const x=m(()=>T(),[T]),k=m(({operations:t,environment:i,environments:f})=>{const _=t.reduce((C,r)=>{r.requestValues.body=r.requestValues.body instanceof URLSearchParams?Object.fromEntries(r.requestValues.body.entries()):r.requestValues.body;const{path:F,method:B}=r.apiPath,b=ye.compile(["paths",F,B]);return C[b]=Q(me(b),r),C},{});A({...v,..._}),S({environment:i,environments:f})},[v,A,S]),D=()=>{if(l!==n.LOADING){if(!s&&(P.sendOpenapiDocsTryItOpenedMessage(),a?.tryItOpen&&e)){const t=Oe({operation:e});a.tryItOpen(t)}N(!s)}l===n.NOT_LOADED&&g(n.LOADING)},G=m(t=>{if(a?.tryItSent&&e){const i=Ie({operation:e,isSuccess:t});a.tryItSent(i)}},[a,e]),U=m(t=>{if(!t)return;const i=O.find(f=>f.operationId===t);return Re(c,i?.href)},[O,c]);return d?z(M,{children:[o(Y,{onClick:D,variant:"primary",iconPosition:"left",icon:l===n.LOADING?o(te,{}):o(ee,{}),children:l===n.LOADING?y("openapi.loading","Loading..."):y("openapi.tryIt","Try it")}),s&&o(W,{children:o(oe,{mountId:"api-content",children:o("div",{ref:h,children:o(X,{activeOperationId:e.operationId||e.pointer,api:d,onRequestChange:k,onClose:D,onLoad:()=>g(n.LOADED),settings:{corsProxyUrl:L,mockServer:q,selectedEnvironment:V,apiId:I?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:E,disableCollectionsTab:!0,storageKey:c,telemetry:{tracerName:"try-it",collectorUrl:he()},convertOperationToReplayValue:fe(R,j),getOperationUrl:U,onRequestReset:x},onRequestSent:G})})})})]}):null}const Me=K(ge);export{Me as Replay};
1
+ import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as J,memo as K,Suspense as W,useCallback as m,useRef as w,useState as H}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=J(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/useConfigureReplay";import{globalOptionsAtom as ne,globalStoreAtom as ae}from"../../jotai/store.js";import{allOperationsAtom as se,replayStateAtom as ie}from"../../jotai/replay.js";import{allOperations as le,getDefaultOperationStore as me}from"../../jotai/operation.js";import{LOADING_STATE as n}from"../../constants.js";import{environmentAtom as pe,userClaimsAtom as ce}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as fe}from"./utils.js";import{useTranslate as ue,useTelemetry as de}from"../../hooks/index.js";import{JsonPointer as ye}from"../../utils/index.js";import{getDefaultCollectorUrl as he}from"../../utils/telemetry.js";import{createTryItOpenEvent as Oe,createTryItSentEvent as Ie}from"../../events/index.js";import{joinWithSeparator as Re}from"../../services/history/helpers.js";function ge({operation:e,corsProxyUrl:L,fullOpenApi:d}){const y=ue(),P=de(),h=w(null),{mockServer:q,oAuth2RedirectURI:E,routingBasePath:c}=p(ne),O=p(se),{parser:I,options:{events:a}}=p(ae),R=p(ce),[s,N]=H(!1),[l,g]=u(ie),[v,A]=u(le),[[,V],S]=u(pe),{config:j,refresh:T}=re({userClaims:R,info:I?.definition.info,operation:{name:e.name,path:e.path,operationId:e.operationId||"",href:e.href,method:e.httpVerb},servers:e.servers},s);Z(h),$(s);const x=m(()=>T(),[T]),k=m(({operations:t,environment:i,environments:f})=>{const _=t.reduce((C,r)=>{r.requestValues.body=r.requestValues.body instanceof URLSearchParams?Object.fromEntries(r.requestValues.body.entries()):r.requestValues.body;const{path:F,method:B}=r.apiPath,b=ye.compile(["paths",F,B]);return C[b]=Q(me(b),r),C},{});A({...v,..._}),S({environment:i,environments:f})},[v,A,S]),D=()=>{if(l!==n.LOADING){if(!s&&(P.sendTryItOpenedMessage(),a?.tryItOpen&&e)){const t=Oe({operation:e});a.tryItOpen(t)}N(!s)}l===n.NOT_LOADED&&g(n.LOADING)},G=m(t=>{if(a?.tryItSent&&e){const i=Ie({operation:e,isSuccess:t});a.tryItSent(i)}},[a,e]),U=m(t=>{if(!t)return;const i=O.find(f=>f.operationId===t);return Re(c,i?.href)},[O,c]);return d?z(M,{children:[o(Y,{onClick:D,variant:"primary",iconPosition:"left",icon:l===n.LOADING?o(te,{}):o(ee,{}),children:l===n.LOADING?y("openapi.loading","Loading..."):y("openapi.tryIt","Try it")}),s&&o(W,{children:o(oe,{mountId:"api-content",children:o("div",{ref:h,children:o(X,{activeOperationId:e.operationId||e.pointer,api:d,onRequestChange:k,onClose:D,onLoad:()=>g(n.LOADED),settings:{corsProxyUrl:L,mockServer:q,selectedEnvironment:V,apiId:I?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:E,disableCollectionsTab:!0,storageKey:c,telemetry:{tracerName:"try-it",collectorUrl:he()},convertOperationToReplayValue:fe(R,j),getOperationUrl:U,onRequestReset:x},onRequestSent:G})})})})]}):null}const Me=K(ge);export{Me as Replay};
@@ -1 +1 @@
1
- import{jsx as c,Fragment as f,jsxs as h}from"react/jsx-runtime";import{memo as u}from"react";import{useAtom as E}from"jotai";import{ExampleSwitch as g,useExampleKey as O}from"../Samples/index.js";import{useActivateExample as j,useTelemetry as C}from"../../hooks/index.js";import{operationStore as d}from"../../jotai/operation.js";function v({mediaType:o,mediaContent:p,renderSample:n}){const r=C(),m=o.operation.pointer,[l,x]=E(d(m)),a=o.examples||{},e=Object.keys(a),i=j(p),{exampleKey:s}=O(o.operation,a);return!e.length||e.length===1?n():h(f,{children:[c(g,{examples:a,exampleKey:s,onChange:t=>{r.sendOpenapiDocsExamplesSwitcherClickedMessage({example:t,numberOfExamples:e.length}),x({...l,activeExampleName:t,activeOneOf:{[m]:e.indexOf(t)},requestValues:{body:null}}),i(t)}}),n(s)]})}const N=u(v);export{N as Example};
1
+ import{jsx as c,Fragment as f,jsxs as h}from"react/jsx-runtime";import{memo as u}from"react";import{useAtom as E}from"jotai";import{ExampleSwitch as g,useExampleKey as O}from"../Samples/index.js";import{useActivateExample as d,useTelemetry as j}from"../../hooks/index.js";import{operationStore as C}from"../../jotai/operation.js";function v({mediaType:o,mediaContent:r,renderSample:m}){const l=j(),n=o.operation.pointer,[p,x]=E(C(n)),a=o.examples||{},e=Object.keys(a),i=d(r),{exampleKey:s}=O(o.operation,a);return!e.length||e.length===1?m():h(f,{children:[c(g,{examples:a,exampleKey:s,onChange:t=>{l.sendExamplesSwitcherClickedMessage({exampleNumber:e.indexOf(t),totalExamples:e.length}),x({...p,activeExampleName:t,activeOneOf:{[n]:e.indexOf(t)},requestValues:{body:null}}),i(t)}}),m(s)]})}const F=u(v);export{F as Example};
@@ -1,4 +1,4 @@
1
- import{jsx as o,jsxs as N}from"react/jsx-runtime";import{memo as T,useCallback as L,useMemo as k}from"react";import{useAtomValue as y,useAtom as O}from"jotai";import{PanelHeader as U}from"@redocly/theme/components/Panel/PanelHeader";import{PayloadSamples as W}from"../PayloadSamples/index.js";import{CodeSample as B}from"./CodeSample.js";import{useCodeSamples as F}from"./useCodeSamples.js";import{isPayloadSample as H}from"../../models/index.js";import{createCodeSampleCopyEvent as _,createLanguageSwitchEvent as V}from"../../events/index.js";import{globalStoreAtom as $}from"../../jotai/store.js";import{ServerListDropdown as z}from"../ServerListDropdown/index.js";import{LanguageDropdown as G}from"../Language/index.js";import{activeMimeNameAtom as J,languageAtom as K}from"../../jotai/app.js";import{Replay as A}from"../Replay/index.js";import{CodeBlockPanel as w}from"../common/index.js";import{useActiveWithFallback as Q,useTelemetry as X}from"../../hooks/index.js";import{operationStore as Y}from"../../jotai/operation.js";import{styled as S}from"../../styled-components.js";function Z({operation:a,disableFooter:P,onPanelToggle:v,...p}){const m=X(),[{activeLanguage:q,languages:c},R]=O(K),{samples:n}=F(a),{parser:d,options:{events:l,corsProxyUrl:g,hideReplay:E}}=y($),i=!P&&!a.isWebhook&&!E&&!a.hideReplay,t=!!c?.length,u=Q(n,q),j=e=>{R(e),m.sendOpenapiDocsSelectLanguageClickedMessage({language:e});const r=c?.find(s=>s.key===e);if(l?.codeSamplesLanguageSwitch&&r){const s=V({operation:a,sample:{lang:r.lang,label:r.title}});l.codeSamplesLanguageSwitch(s)}},h=y(J),{activeExampleName:C}=y(Y(a.pointer)),f=L(({lang:e,title:r})=>()=>{const s=_({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:C});m.sendCopyCodeSnippetClickedMessage({snippetType:"request",language:e}),l?.codeSamplesCopy?.(s)},[a,m,l,h,C]),x=L(e=>{v?.(e,"request-samples")},[v]),b=()=>N(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:j}),!t&&i&&o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})]}),D=k(()=>{if(i&&t)return o(ae,{children:o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})})},[i,t,a,g,d.definition]),M=k(()=>n.map(e=>e.key===u?o("div",{children:H(e)?o(W,{content:e.requestBodyContent,onCopyClick:f(e),onPanelToggle:x,...p}):o(B,{lang:e.lang,source:e.source,externalSample:e,operation:a,onCopyClick:f(e),...p})},e.key+a.id):null),[u,f,x,a,p,n]);return c&&!n.length?o(w,{className:"panel-request-samples",header:b,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:b,footer:D,isExpandable:!1,children:M}):null}const Ce=T(Z),I=S(U)`
1
+ import{jsx as o,jsxs as D}from"react/jsx-runtime";import{memo as T,useCallback as L,useMemo as k}from"react";import{useAtomValue as y,useAtom as U}from"jotai";import{PanelHeader as W}from"@redocly/theme/components/Panel/PanelHeader";import{PayloadSamples as B}from"../PayloadSamples/index.js";import{CodeSample as F}from"./CodeSample.js";import{useCodeSamples as H}from"./useCodeSamples.js";import{isPayloadSample as O}from"../../models/index.js";import{createCodeSampleCopyEvent as _,createLanguageSwitchEvent as V}from"../../events/index.js";import{globalStoreAtom as $}from"../../jotai/store.js";import{ServerListDropdown as z}from"../ServerListDropdown/index.js";import{LanguageDropdown as G}from"../Language/index.js";import{activeMimeNameAtom as J,languageAtom as K}from"../../jotai/app.js";import{Replay as A}from"../Replay/index.js";import{CodeBlockPanel as w}from"../common/index.js";import{useActiveWithFallback as Q,useTelemetry as X}from"../../hooks/index.js";import{operationStore as Y}from"../../jotai/operation.js";import{styled as S}from"../../styled-components.js";function Z({operation:a,disableFooter:P,onPanelToggle:v,...p}){const m=X(),[{activeLanguage:q,languages:c},R]=U(K),{samples:n}=H(a),{parser:d,options:{events:l,corsProxyUrl:g,hideReplay:E}}=y($),i=!P&&!a.isWebhook&&!E&&!a.hideReplay,t=!!c?.length,u=Q(n,q),j=e=>{R(e),m.sendSelectLanguageClickedMessage({language:e});const r=c?.find(s=>s.key===e);if(l?.codeSamplesLanguageSwitch&&r){const s=V({operation:a,sample:{lang:r.lang,label:r.title}});l.codeSamplesLanguageSwitch(s)}},h=y(J),{activeExampleName:C}=y(Y(a.pointer)),f=L(({lang:e,title:r})=>()=>{const s=_({operation:a,label:r,lang:e,type:"request",activeMimeName:h,activeExampleName:C});m.sendCopyCodeSnippetClickedMessage({snippetType:"request",language:e}),l?.codeSamplesCopy?.(s)},[a,m,l,h,C]),x=L(e=>{v?.(e,"request-samples")},[v]),b=()=>D(I,{isExpandable:!1,withReplay:!t&&i,children:[o(ee,{operation:a}),t&&o(G,{activeTab:u,samples:n,onChange:j}),!t&&i&&o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})]}),M=k(()=>{if(i&&t)return o(ae,{children:o(A,{operation:a,corsProxyUrl:g,fullOpenApi:d.definition})})},[i,t,a,g,d.definition]),N=k(()=>n.map(e=>e.key===u?o("div",{children:O(e)?o(B,{content:e.requestBodyContent,onCopyClick:f(e),onPanelToggle:x,...p}):o(F,{lang:e.lang,source:e.source,externalSample:e,operation:a,onCopyClick:f(e),...p})},e.key+a.id):null),[u,f,x,a,p,n]);return c&&!n.length?o(w,{className:"panel-request-samples",header:b,isExpandable:!1,expanded:!1}):n.length?o(w,{className:"panel-request-samples",header:b,footer:M,isExpandable:!1,children:N}):null}const Ce=T(Z),I=S(W)`
2
2
  flex-wrap: nowrap;
3
3
  ${({withReplay:a})=>a&&"padding: var(--spacing-xs) var(--spacing-sm);"}
4
4
  `,ee=S(z)`
@@ -1,5 +1 @@
1
- import{jsx as e,Fragment as L,jsxs as S}from"react/jsx-runtime";import{useAtomValue as f}from"jotai";import{Panel as a}from"@redocly/theme/components/Panel/Panel";import{Markdown as b}from"@redocly/theme/components/Markdown/Markdown";import{DownloadSpecification as I}from"../Download/index.js";import{Overview as P}from"../Overview/index.js";import{ServerList as j}from"../ServerList/index.js";import{globalStoreAtom as O}from"../../jotai/store.js";import{normalizeServers as v}from"../../utils/index.js";import{LanguageList as M}from"../Language/index.js";import{mergeInMockServer as k}from"../../models/operation.js";import{languageAtom as y}from"../../jotai/app.js";import{useTranslate as D}from"../../hooks/index.js";import{styled as E}from"../../styled-components.js";import{PanelItemsList as N}from"../PanelItem/styled.js";import{useDownloadInfo as A}from"../Download/useDownloadInfo.js";import{McpOverview as _}from"../McpOverview/McpOverview.js";const ee=({item:{infoDefinition:n}})=>{const r=D(),{options:{hideDownloadButtons:g,downloadUrls:h,mockServer:u},parser:{definition:o,definitionUrl:t}}=f(O),{languages:i,activeLanguage:w}=f(y),l=A({downloadUrls:h}),m=v(t,k(o.servers||[],u)).sort((d,c)=>d["x-isLive"]&&!c["x-isLive"]?-1:!d["x-isLive"]&&c["x-isLive"]?1:0),s=o?.["x-mcp"],x=v(t,s?.servers||o.servers||[]),p=!(Object.keys(o.paths||{}).length>0)&&s;return S(L,{children:[!g&&l&&e(a,{className:"panel-download",header:r("openapi.download.description.title","Download OpenAPI description"),isExpandable:!1,children:e(I,{downloadObjects:l})}),n&&e(F,{className:"panel-overview",header:r("openapi.info.title","Overview"),isExpandable:!1,children:e(b,{children:e(P,{info:n,translate:r})})}),!!s&&e(a,{className:"panel-download",header:r("openapi.mcp.title","MCP server"),isExpandable:!1,children:e(_,{mcpInfo:s,mcpServers:x})}),!!i?.length&&!p&&e(a,{className:"panel-language-list",header:r("openapi.languages.title","Languages"),isExpandable:!1,children:e(M,{languages:i,activeLanguage:w})}),!!m.length&&!p&&e(a,{className:"panel-servers-list",header:r("openapi.servers.title","Servers"),isExpandable:!1,children:e(j,{servers:m,path:"/",translate:r})})]})},F=E(a)`
2
- &:has(${N}:empty) {
3
- display: none;
4
- }
5
- `;export{ee 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:g,mockServer:v},parser:{definition:s,definitionUrl:t}}=c(I),{languages:i,activeLanguage:h}=c(P),l=D({downloadUrls:g}),p=d(t,M(s.servers||[],v)),n=s?.["x-mcp"],w=d(t,n?.servers||s.servers||[]),m=!(Object.keys(s.paths||{}).length>0)&&n;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})}),!!n&&e(r,{className:"panel-download",header:a("openapi.mcp.title","MCP server"),isExpandable:!1,children:e(E,{mcpInfo:n,mcpServers:w})}),(o?.license||o?.contact||o?.termsOfService)&&e(r,{className:"panel-mcp-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};
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useState as d,useEffect as h}from"react";import{MimeLabel as x,Container as v,Select as S}from"../common/index.js";import{SelectOrLabel as b}from"../SelectOrLabel/index.js";import{normalizeText as g}from"../../utils/index.js";import{useTelemetry as O}from"../../hooks/index.js";const I=({exampleKey:s,examples:o,onChange:m,className:i})=>{const c=O(),t=Object.keys(o),r=s?t.indexOf(s):0,[p,l]=d(r>-1?r:0);h(()=>l(r>-1?r:0),[s,r]);const a=t.map((e,f)=>({value:g(o[e].summary)||e,idx:f})),u=({idx:e})=>{c.sendOpenapiDocsExamplesSwitcherClickedMessage({example:t[e],numberOfExamples:t.length}),l(e),m(t[e])};return a.length<2?null:n(v,{"data-testid":"example-switch",className:i,children:n(b,{Select:S,Label:x,variant:"dark",fullWidth:!0,options:a,value:a[p]?.value,onChange:u})})};export{I as ExampleSwitch};
1
+ import{jsx as n}from"react/jsx-runtime";import{useState as d,useEffect as h}from"react";import{MimeLabel as x,Container as v,Select as S}from"../common/index.js";import{SelectOrLabel as b}from"../SelectOrLabel/index.js";import{normalizeText as g}from"../../utils/index.js";import{useTelemetry as C}from"../../hooks/index.js";const L=({exampleKey:a,examples:s,onChange:m,className:i})=>{const c=C(),r=Object.keys(s),t=a?r.indexOf(a):0,[u,l]=d(t>-1?t:0);h(()=>l(t>-1?t:0),[a,t]);const o=r.map((e,f)=>({value:g(s[e].summary)||e,idx:f})),p=({idx:e})=>{c.sendExamplesSwitcherClickedMessage({exampleNumber:e,totalExamples:r.length}),l(e),m(r[e])};return o.length<2?null:n(v,{"data-testid":"example-switch",className:i,children:n(b,{Select:S,Label:x,variant:"dark",fullWidth:!0,options:o,value:o[u]?.value,onChange:p})})};export{L as ExampleSwitch};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{render as s}from"@testing-library/react";import*as o from"jotai";import{SchemaCatalogLink as a}from"../SchemaCatalogLink";jest.mock("jotai",()=>({...jest.requireActual("jotai"),useAtomValue:jest.fn()})),describe("SchemaCatalogLink",()=>{it("should render correctly",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should not render if x-schema-catalog-link is not defined",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()})});
1
+ import{jsx as t}from"react/jsx-runtime";import{render as s,fireEvent as l}from"@testing-library/react";import*as o from"jotai";import{SchemaCatalogLink as a}from"../SchemaCatalogLink";jest.mock("jotai",()=>({...jest.requireActual("jotai"),useAtomValue:jest.fn()})),jest.mock("../../../utils/dom",()=>({...jest.requireActual("../../../utils/dom"),IS_BROWSER:!0})),describe("SchemaCatalogLink",()=>{beforeEach(()=>{jest.clearAllMocks(),jest.useFakeTimers(),Object.defineProperty(global,"navigator",{value:{clipboard:{writeText:jest.fn()}},writable:!0})}),afterEach(()=>{jest.useRealTimers()}),it("should render correctly",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should not render if x-schema-catalog-link is not defined",()=>{jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should render correctly on server",()=>{jest.mock("../../../utils/dom",()=>({...jest.requireActual("../../../utils/dom"),IS_BROWSER:jest.fn().mockReturnValue(!1)})),jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const e=s(t(a,{schemaRef:"#/components/schemas/test"}));expect(e.baseElement).toMatchSnapshot()}),it("should copy link to clipboard when copy button is clicked",async()=>{jest.mock("../../../utils/dom",()=>({...jest.requireActual("../../../utils/dom"),IS_BROWSER:jest.fn().mockReturnValue(!0)})),jest.spyOn(o,"useAtomValue").mockReturnValue({parser:{definition:{"x-schema-catalog-link":"/_bundle/test.yaml"}}});const{getByRole:e,findByText:n}=s(t(a,{schemaRef:"#/components/schemas/test"})),c=e("button");l.click(c),expect(await n("Copied!")).toBeDefined()})});
@@ -1,13 +1,13 @@
1
- import{jsx as t,jsxs as m,Fragment as S}from"react/jsx-runtime";import{useMemo as p}from"react";import{useAtomValue as d}from"jotai";import{LayoutVariant as c}from"@redocly/config";import{breakpoints as k}from"@redocly/theme/core/openapi";import{OpenApiHeader as u}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader";import{PageFooter as v}from"../PageFooter/index.js";import{globalOptionsAtom as y}from"../../jotai/store.js";import{RenderHook as b}from"../RenderHook/index.js";import{RightPanel as C}from"../RightPanel/index.js";import{layoutAtom as w}from"../../jotai/app.js";import{Row as B,SamplesMiddlePanel as j,SamplesPanel as I}from"../common/index.js";import{Items as f}from"../ContentItems/Items.js";import{ContentItem as g}from"../ContentItem/index.js";import{styled as s}from"../../styled-components.js";function G({items:e,hideFooterAndHeader:n}){const{unstable_hooks:{MiddlePanelHeader:a},routingBasePath:i}=d(y),l=d(w),o=l===c.STACKED,P=p(()=>n?null:t(h,{isStacked:o,children:t(v,{})}),[n,o]),x=p(()=>n||!u&&!a?null:t(h,{isStacked:o,children:a?t(b,{Hook:a,props:void 0}):t(u,{})}),[a,n,o]);return e.length===0?null:m(S,{children:[x,m(B,{layout:l,style:{zIndex:1},children:[t(M,{layout:l,children:e.filter(({type:r})=>r==="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id))}),t(R,{isStacked:o,tabIndex:0,children:t(C,{item:e[0]})})]}),e.filter(({type:r})=>r!=="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id)),P]})}const h=s(j)`
1
+ import{jsx as t,jsxs as s,Fragment as x}from"react/jsx-runtime";import{useMemo as p}from"react";import{useAtomValue as d}from"jotai";import{LayoutVariant as c}from"@redocly/config";import{breakpoints as k}from"@redocly/theme/core/openapi";import{OpenApiHeader as u}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader";import{PageFooter as v}from"../PageFooter/index.js";import{globalOptionsAtom as b}from"../../jotai/store.js";import{RenderHook as y}from"../RenderHook/index.js";import{RightPanel as C}from"../RightPanel/index.js";import{layoutAtom as w}from"../../jotai/app.js";import{Row as B,SamplesMiddlePanel as j,SamplesPanel as M}from"../common/index.js";import{Items as f}from"../ContentItems/Items.js";import{ContentItem as g}from"../ContentItem/index.js";import{styled as m}from"../../styled-components.js";function G({items:e,hideFooterAndHeader:n}){const{unstable_hooks:{MiddlePanelHeader:a},routingBasePath:i}=d(b),l=d(w),o=l===c.STACKED,P=p(()=>n?null:t(h,{isStacked:o,children:t(v,{})}),[n,o]),S=p(()=>n||!u&&!a?null:t(h,{isStacked:o,children:a?t(y,{Hook:a,props:void 0}):t(u,{})}),[a,n,o]);return e.length===0?null:s(x,{children:[S,s(B,{layout:l,children:[t(R,{layout:l,children:e.filter(({type:r})=>r==="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id))}),t(_,{isStacked:o,tabIndex:0,children:t(C,{item:e[0]})})]}),e.filter(({type:r})=>r!=="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id)),P]})}const h=m(j)`
2
2
  align-self: flex-start;
3
3
  padding-top: var(--panel-gap-vertical);
4
4
  padding-bottom: var(--panel-gap-vertical);
5
- `,M=s.div`
5
+ `,R=m.div`
6
6
  width: 100%;
7
7
 
8
8
  @media screen and (min-width: ${k.large}) {
9
9
  width: ${({layout:e})=>e===c.STACKED?"100%":"calc(100% - var(--panel-samples-width))"};
10
10
  }
11
- `,R=s(I)`
11
+ `,_=m(M)`
12
12
  margin: var(--spacing-base) 0;
13
- `;export{R as RightPanelContainer,M as SectionContainer,G as SectionContent};
13
+ `;export{_ as RightPanelContainer,R as SectionContainer,G as SectionContent};
@@ -1,4 +1,4 @@
1
- import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as u}from"@redocly/theme/components/Buttons/CopyButton";import{CheckmarkFilledIcon as y}from"@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon";import{getServerDisplayName as w}from"../../utils/helpers.js";import{PanelItemDescription as h,Title as S}from"../PanelItem/index.js";import{ViewNested as T}from"../ViewNested/index.js";import{Tag as l}from"../common/index.js";import{Markdown as j}from"../Markdown/index.js";import{styled as t}from"../../styled-components.js";import{ServerDescriptionTooltip as D}from"./ServerDescriptionTooltip.js";const A=({servers:v,path:f,translate:n})=>i($,{children:v.map(e=>{const s=e.url+f,d=Object.keys(e.variables||{}).length,c=d===1?"variable":"variables",m=`${d||""} ${n(`openapi.${c}`,c)}`,b=!!e.name&&!!e.description;return o("div",{children:[o(W,{children:[o(h,{"data-testid":"server-panel-item-name",children:[w(e),e["x-isLive"]&&o(l,{className:"tag-green",children:[i(y,{}),"Live"]})]}),b&&i(D,{description:e.description}),e["x-labels"]?.length&&i(h,{style:{margin:"var(--spacing-xs) 0"},children:e["x-labels"]?.map(r=>o(l,{className:`tag-${r.color}`,children:[r.label,": ",r.value]},r.value))})||null]}),o(I,{children:[i(S,{suppressHydrationWarning:!0,children:s}),i(u,{data:s},s)]}),e.variables&&i(T,{expandText:`${n("openapi.actions.show","Show")} ${m}`,hideText:`${n("openapi.actions.hide","Hide")} ${m}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i(z,{children:Object.entries(e.variables||{}).map(([r,a])=>o(k,{children:[i(C,{children:r}),o(p,{children:[n("openapi.default","Default")," ",i(x,{children:a.default})]}),i(L,{source:a.description}),a.enum&&o(p,{children:[n("openapi.enum","Enum")," ",i(N,{children:a.enum.map(g=>i(x,{children:g},g))})]})]},r))})})]},e.url)})}),$=t.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 o}from"react/jsx-runtime";import{CopyButton as u}from"@r
10
10
  margin-bottom: 0;
11
11
  padding-bottom: 0;
12
12
  }
13
- `,z=t.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,37 +28,37 @@ import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as u}from"@r
28
28
  margin-bottom: 0;
29
29
  padding-bottom: 0;
30
30
  }
31
- `,k=t.div`
31
+ `,z=e.div`
32
32
  display: flex;
33
33
  flex-direction: column;
34
34
  flex-wrap: wrap;
35
- `,L=t(j)`
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);
39
- `,p=t.span`
39
+ `,s=e.span`
40
40
  display: flex;
41
41
  gap: var(--spacing-xxs);
42
42
  font-size: var(--font-size-sm);
43
43
  line-height: var(--line-height-sm);
44
44
  color: var(--text-color-primary);
45
- `,C=t(p)`
45
+ `,k=e(s)`
46
46
  padding-bottom: var(--spacing-xxs);
47
47
  font-weight: var(--font-weight-semibold);
48
- `,N=t.span`
48
+ `,C=e.span`
49
49
  display: flex;
50
50
  gap: var(--spacing-xxs);
51
51
  flex-wrap: wrap;
52
- `,x=t(l)`
52
+ `,g=e(S)`
53
53
  font-size: var(--font-size-sm);
54
54
  line-height: var(--line-height-sm);
55
- `,W=t.div`
55
+ `,L=e.div`
56
56
  display: flex;
57
57
  justify-content: start;
58
58
  align-items: center;
59
59
  gap: var(--spacing-xxs);
60
- `,I=t.div`
60
+ `,O=e.div`
61
61
  display: flex;
62
62
  justify-content: space-between;
63
63
  align-items: center;
64
- `;export{A as ServerList};
64
+ `;export{q as ServerList};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useMemo as f,useCallback as l}from"react";import{useAtom as S,useAtomValue as g}from"jotai";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as y}from"@redocly/theme/components/Dropdown/Dropdown";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as A,Path as C,StyledCopyButton as b,StyledDropdownMenuItem as D}from"./styled.js";import{PanelItem as P}from"../PanelItem/index.js";import{joinWithSeparator as j}from"../../services/index.js";import{getServerDisplayName as x,replaceVariables as V}from"../../utils/index.js";import{environmentAtom as M}from"../../jotai/app.js";import{useActiveWithFallback as E,useTelemetry as N}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as W}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const X=({operation:r,className:h})=>{const n=N(),[[v],i]=S(M),{options:{events:m}}=g(I),s=E(r.servers.map(e=>({...e,key:e.url})),v.server),a=l(e=>{e.stopPropagation()},[]),c=l(e=>()=>{if(r.servers.length!==1&&(i({environment:p(e)}),n.sendOpenapiDocsSwitchServersClickedMessage({server:p(e)}),m?.targetServerSwitch&&e)){const o=W({operation:r,serverUrl:e.url});m.targetServerSwitch(o)}},[r,i,n,m]),u=f(()=>r.servers.map(e=>{const o=j(V(e),r.path);return t(D,{onAction:c(e),children:t(P,{header:x(e),title:o,actions:[t(b,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:e.url===s,withCheckmark:!0})},o)}),[r.servers,r.path,c,a,s]);return t(y,{className:h,trigger:d(A,{variant:"ghost",children:[t(k,{color:r.httpVerb,children:r.httpVerb}),t(C,{children:r.path})]}),withArrow:!0,children:t(w,{children:u})})};export{X as ServerListDropdown};
1
+ import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useMemo as f,useCallback as c}from"react";import{useAtom as S,useAtomValue as g}from"jotai";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as y}from"@redocly/theme/components/Dropdown/Dropdown";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as A,Path as C,StyledCopyButton as b,StyledDropdownMenuItem as P}from"./styled.js";import{PanelItem as j}from"../PanelItem/index.js";import{joinWithSeparator as x}from"../../services/index.js";import{getServerDisplayName as D,replaceVariables as V}from"../../utils/index.js";import{environmentAtom as M}from"../../jotai/app.js";import{useActiveWithFallback as E,useTelemetry as N}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as W}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const X=({operation:e,className:h})=>{const n=N(),[[v],i]=S(M),{options:{events:m}}=g(I),s=E(e.servers.map(r=>({...r,key:r.url})),v.server),a=c(r=>{r.stopPropagation()},[]),l=c(r=>()=>{if(e.servers.length!==1&&(i({environment:p(r)}),n.sendSwitchServersClickedMessage({server:p(r)}),m?.targetServerSwitch&&r)){const o=W({operation:e,serverUrl:r.url});m.targetServerSwitch(o)}},[e,i,n,m]),u=f(()=>e.servers.map(r=>{const o=x(V(r),e.path);return t(P,{onAction:l(r),children:t(j,{header:D(r),title:o,actions:[t(b,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:r.url===s,withCheckmark:!0})},o)}),[e.servers,e.path,l,a,s]);return t(y,{className:h,trigger:d(A,{variant:"ghost",children:[t(k,{color:e.httpVerb,children:e.httpVerb}),t(C,{children:e.path})]}),withArrow:!0,children:t(w,{children:u})})};export{X as ServerListDropdown};
@@ -1 +1 @@
1
- import{useMemo as d}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 d(()=>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 l(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 b(o,r="",t,s){return(o.items||[]).some(i=>l(i,r,t,s)||b(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=l(e,s,n,i),m=b(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"tool":case"rsrc":case"prompt":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
+ 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};