@redocly/api-docs 0.2.0-next.4 → 0.2.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RedocStandalone.d.ts +38 -0
- package/lib/RedocStandalone.js +1 -0
- package/lib/RedoclyApiDocs.js +1 -1
- package/lib/RedoclyApiDocsStandalone.d.ts +2 -0
- package/lib/adapters/asyncapi/items/overview/content.js +1 -1
- package/lib/adapters/graphql/utils/createApiItem.js +1 -1
- package/lib/adapters/helpers.d.ts +2 -0
- package/lib/adapters/helpers.js +1 -1
- package/lib/adapters/openapi/build-code-sample-source.d.ts +1 -1
- package/lib/adapters/openapi/build-code-sample-source.js +1 -1
- package/lib/adapters/openapi/configure/merge-utils.d.ts +1 -1
- package/lib/adapters/openapi/index.js +1 -1
- package/lib/adapters/openapi/items/operation/content.js +1 -1
- package/lib/adapters/openapi/items/operation/item.js +1 -1
- package/lib/adapters/openapi/items/overview/content.js +1 -1
- package/lib/adapters/openapi/store.js +1 -1
- package/lib/adapters/openapi/utils/merge-mock-server.d.ts +2 -2
- package/lib/adapters/utils/markdoc.d.ts +4 -1
- package/lib/adapters/utils/markdoc.js +1 -1
- package/lib/components/ErrorBoundary.d.ts +4 -2
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/Header/HeaderItem.js +1 -1
- package/lib/components/ItemContent/sections/MessagesSection.js +1 -1
- package/lib/components/Schema/styled.js +4 -4
- package/lib/components/Schema/views/ArrayRenderer.js +1 -1
- package/lib/components/Search/index.d.ts +15 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Security/styled.js +7 -7
- package/lib/components/StickySidebar/FloatingButton.d.ts +1 -0
- package/lib/components/StickySidebar/FloatingButton.js +32 -0
- package/lib/components/StickySidebar/RedoclyAttributionLogo.d.ts +5 -0
- package/lib/components/StickySidebar/RedoclyAttributionLogo.js +1 -0
- package/lib/components/StickySidebar/StickySidebar.js +33 -9
- package/lib/components/common/Breadcrumbs.js +2 -2
- package/lib/components/common/ResponseCodeTabs.js +1 -1
- package/lib/components/common/Tag.js +1 -1
- package/lib/components/common/ViewNested.js +2 -2
- package/lib/components/graphql/GraphQLFieldView.js +1 -1
- package/lib/components/graphql/RequiresScopesModal.js +3 -3
- package/lib/components/graphql/sections/GraphQLArgsSection.js +1 -1
- package/lib/components/panels/ExampleItem/CallbackPayloadItem.js +2 -2
- package/lib/components/panels/ExampleItem/CodeSampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/PayloadExampleItem.js +2 -2
- package/lib/components/panels/ExampleItem/ResponseExampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/SecuritySchemeSelector.d.ts +9 -0
- package/lib/components/panels/ExampleItem/SecuritySchemeSelector.js +1 -0
- package/lib/components/panels/ExampleItem/ServerDropdown.js +1 -1
- package/lib/components/panels/ExampleItem/generate-request-sample.d.ts +28 -0
- package/lib/components/panels/ExampleItem/generate-request-sample.js +1 -0
- package/lib/components/panels/ExampleItem/selectors.d.ts +5 -2
- package/lib/components/panels/ExampleItem/selectors.js +1 -1
- package/lib/components/panels/ExampleItem/styled.d.ts +2 -49
- package/lib/components/panels/ExampleItem/styled.js +11 -5
- package/lib/components/panels/ExampleItem/useActiveServer.d.ts +17 -0
- package/lib/components/panels/ExampleItem/useActiveServer.js +1 -0
- package/lib/components/panels/ExampleItem/useCodeSampleLanguages.d.ts +23 -0
- package/lib/components/panels/ExampleItem/useCodeSampleLanguages.js +1 -0
- package/lib/components/panels/ExampleItem/useReplayRequestState.d.ts +18 -0
- package/lib/components/panels/ExampleItem/useReplayRequestState.js +1 -0
- package/lib/components/panels/ExampleItem/useTryItFooter.d.ts +3 -0
- package/lib/components/panels/ExampleItem/useTryItFooter.js +7 -0
- package/lib/components/panels/GroupPanelItem.js +1 -1
- package/lib/components/panels/McpPanelItem.js +2 -2
- package/lib/components/panels/ServerItem/ServerItem.js +1 -1
- package/lib/components/panels/asyncapi/BrokerItem/BrokerModal.js +1 -1
- package/lib/components/panels/asyncapi/BrokerItem/BrokerPanelItem.js +1 -1
- package/lib/components/panels/shared-panel-styles.js +1 -1
- package/lib/components/pluggable/RedocExample.js +5 -2
- package/lib/hoc/withStoreProvider.js +1 -1
- package/lib/hooks/useInitialTelemetry.d.ts +2 -0
- package/lib/hooks/useInitialTelemetry.js +1 -0
- package/lib/hooks/useScrollSpyUrlSync.js +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +1 -1
- package/lib/jotai/app.d.ts +6 -0
- package/lib/jotai/app.js +1 -1
- package/lib/jotai/examples.js +1 -1
- package/lib/jotai/itemStore.d.ts +1 -0
- package/lib/jotai/itemStore.js +1 -1
- package/lib/options/editionOverrides.d.ts +3 -0
- package/lib/options/editionOverrides.js +1 -0
- package/lib/options/helpers.d.ts +1 -1
- package/lib/options/normalizeOptions.d.ts +1 -1
- package/lib/options/normalizeOptions.js +1 -1
- package/lib/pages/ItemPage.js +4 -2
- package/lib/services/code-samples/apply-env-variables.d.ts +8 -0
- package/lib/services/code-samples/apply-env-variables.js +1 -0
- package/lib/services/code-samples/builder.d.ts +3 -5
- package/lib/services/code-samples/builder.js +1 -1
- package/lib/services/code-samples/discriminator.d.ts +16 -10
- package/lib/services/code-samples/discriminator.js +1 -1
- package/lib/services/code-samples/language-availability.d.ts +4 -0
- package/lib/services/code-samples/language-availability.js +1 -0
- package/lib/services/code-samples/{replay/normalize-servers.d.ts → normalize-servers.d.ts} +1 -1
- package/lib/services/code-samples/normalize-servers.js +1 -0
- package/lib/services/code-samples/replay/from-openapi-document.js +1 -1
- package/lib/services/code-samples/replay/replay-predefined-env.d.ts +1 -2
- package/lib/services/code-samples/replay/replay-predefined-env.js +1 -1
- package/lib/services/code-samples/resolvers.js +1 -1
- package/lib/services/code-samples/server-env.d.ts +3 -0
- package/lib/services/code-samples/server-env.js +1 -0
- package/lib/services/code-samples/source.d.ts +3 -3
- package/lib/services/operation-samples/index.js +1 -1
- package/lib/services/schema/dialects/jsonSchema.d.ts +5 -1
- package/lib/services/schema/dialects/jsonSchema.js +1 -1
- package/lib/services/schema/propertyTreeBuilder.js +1 -1
- package/lib/services/search/indexer.d.ts +9 -0
- package/lib/services/search/indexer.js +1 -0
- package/lib/services/search/types.d.ts +27 -0
- package/lib/services/search/types.js +0 -0
- package/lib/standalone.d.ts +19 -0
- package/lib/standalone.js +2 -0
- package/lib/standaloneThemeConfig.d.ts +3 -0
- package/lib/standaloneThemeConfig.js +1 -0
- package/lib/telemetry/RedocTelemetry.d.ts +3 -0
- package/lib/telemetry/RedocTelemetry.js +1 -1
- package/lib/telemetry/defaults.d.ts +2 -0
- package/lib/telemetry/defaults.js +1 -0
- package/lib/types/code-samples-config.d.ts +68 -0
- package/lib/types/code-samples-config.js +0 -0
- package/lib/types/common.d.ts +1 -1
- package/lib/types/content.d.ts +2 -1
- package/lib/types/edition-config.d.ts +4 -0
- package/lib/types/edition-config.js +0 -0
- package/lib/types/events.d.ts +2 -2
- package/lib/types/openapi.d.ts +2 -1
- package/lib/types/options.d.ts +27 -85
- package/lib/types/store.d.ts +1 -1
- package/lib/utils/deep-link.d.ts +1 -0
- package/lib/utils/deep-link.js +1 -1
- package/lib/utils/extract-extensions.js +1 -1
- package/lib/utils/scroll-anchoring.d.ts +2 -1
- package/lib/utils/x-logo.d.ts +13 -0
- package/lib/utils/x-logo.js +1 -0
- package/package.json +28 -7
- package/lib/services/code-samples/replay/normalize-servers.js +0 -1
|
@@ -7,7 +7,7 @@ import{styled as r}from"styled-components";import{Panel as a}from"@redocly/theme
|
|
|
7
7
|
&&& {
|
|
8
8
|
margin-bottom: var(--spacing-lg);
|
|
9
9
|
}
|
|
10
|
-
`,
|
|
10
|
+
`,g=r.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
13
13
|
justify-content: space-between;
|
|
@@ -18,7 +18,7 @@ import{styled as r}from"styled-components";import{Panel as a}from"@redocly/theme
|
|
|
18
18
|
border-bottom: var(--panel-border, 1px solid var(--border-color-primary));
|
|
19
19
|
border-radius: var(--panel-border-radius, var(--border-radius))
|
|
20
20
|
var(--panel-border-radius, var(--border-radius)) 0 0;
|
|
21
|
-
`,
|
|
21
|
+
`,d=r(e)`
|
|
22
22
|
margin-left: auto;
|
|
23
23
|
font-size: var(--font-size-sm);
|
|
24
24
|
`,v=r.span`
|
|
@@ -53,14 +53,14 @@ import{styled as r}from"styled-components";import{Panel as a}from"@redocly/theme
|
|
|
53
53
|
position: fixed;
|
|
54
54
|
width: 100vw;
|
|
55
55
|
height: 100vh;
|
|
56
|
-
z-index: var(--z-index-popover,
|
|
56
|
+
z-index: var(--z-index-popover, 200);
|
|
57
57
|
left: 0;
|
|
58
58
|
top: 0;
|
|
59
59
|
pointer-events: auto;
|
|
60
60
|
`,y=r.div`
|
|
61
61
|
background: var(--bg-color);
|
|
62
62
|
box-shadow: var(--bg-raised-shadow, 0 8px 32px rgba(0, 0, 0, 0.15));
|
|
63
|
-
border-radius: var(--border-radius-lg
|
|
63
|
+
border-radius: var(--border-radius-lg);
|
|
64
64
|
padding: var(--spacing-lg);
|
|
65
65
|
display: flex;
|
|
66
66
|
flex-direction: column;
|
|
@@ -170,7 +170,7 @@ import{styled as r}from"styled-components";import{Panel as a}from"@redocly/theme
|
|
|
170
170
|
font-size: var(--font-size-sm);
|
|
171
171
|
font-family: var(--font-family-monospaced);
|
|
172
172
|
padding: 0 var(--spacing-xxs);
|
|
173
|
-
border-radius: var(--border-radius);
|
|
173
|
+
border-radius: var(--tag-border-radius);
|
|
174
174
|
background: var(--tag-bg-color, var(--border-color-secondary));
|
|
175
175
|
color: var(--text-color-secondary);
|
|
176
176
|
`,V=r.button`
|
|
@@ -199,7 +199,7 @@ import{styled as r}from"styled-components";import{Panel as a}from"@redocly/theme
|
|
|
199
199
|
transform: ${o=>o.isOpen?"rotate(90deg)":"rotate(0deg)"};
|
|
200
200
|
transition: transform 0.3s ease-in-out;
|
|
201
201
|
`,i=r.div`
|
|
202
|
-
border-radius: var(--border-radius);
|
|
202
|
+
border-radius: var(--tag-border-radius);
|
|
203
203
|
padding: 0 var(--spacing-xxs);
|
|
204
204
|
font-family: var(--font-family-monospaced);
|
|
205
205
|
font-size: var(--font-size-sm);
|
|
@@ -216,4 +216,4 @@ import{styled as r}from"styled-components";import{Panel as a}from"@redocly/theme
|
|
|
216
216
|
display: inline-flex;
|
|
217
217
|
align-items: center;
|
|
218
218
|
gap: var(--spacing-xxs);
|
|
219
|
-
`;export{u as CloseButton,f as Conjunction,A as DeprecatedBadge,T as FlowDescription,F as FlowProperties,S as FlowTitle,k as FlowTitleWrapper,O as FlowTypeBody,L as FlowTypeName,B as FlowTypeSection,R as FlowTypeTag,z as FlowWrapper,h as ModalBackground,w as ModalTitle,y as ModalWrapper,I as OptionalScopesChevron,H as OptionalScopesList,V as OptionalScopesToggle,j as PropertyLabel,P as PropertyRow,$ as PropertyValue,C as SchemeLink,m as SchemeName,b as ScopeInline,N as ScopeTag,M as ScopesLabel,W as ScopesList,D as ScopesSection,
|
|
219
|
+
`;export{u as CloseButton,f as Conjunction,A as DeprecatedBadge,T as FlowDescription,F as FlowProperties,S as FlowTitle,k as FlowTitleWrapper,O as FlowTypeBody,L as FlowTypeName,B as FlowTypeSection,R as FlowTypeTag,z as FlowWrapper,h as ModalBackground,w as ModalTitle,y as ModalWrapper,I as OptionalScopesChevron,H as OptionalScopesList,V as OptionalScopesToggle,j as PropertyLabel,P as PropertyRow,$ as PropertyValue,C as SchemeLink,m as SchemeName,b as ScopeInline,N as ScopeTag,M as ScopesLabel,W as ScopesList,D as ScopesSection,g as SecurityHeader,x as SecurityList,c as SecurityPanel,i as Tag,v as Title,d as ViewDetailsButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FloatingButton: () => React.JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useCallback as n}from"react";import{useAtom as i}from"jotai";import{styled as a}from"styled-components";import{breakpoints as s}from"@redocly/theme/core/openapi";import{MenuIcon as p}from"@redocly/theme/icons/MenuIcon/MenuIcon";import{CloseIcon as l}from"@redocly/theme/icons/CloseIcon/CloseIcon";import{isSidebarOpenedAtom as d}from"../../jotai/app.js";const h=()=>{const[o,r]=i(d),t=n(()=>{r(!o)},[o,r]);return e(m,{type:"button",onClick:t,"aria-label":o?"Close navigation menu":"Open navigation menu","aria-expanded":o,"data-testid":"floating-button",children:o?e(l,{size:"24px"}):e(p,{size:"24px"})})},m=a.button`
|
|
2
|
+
border: none;
|
|
3
|
+
outline: none;
|
|
4
|
+
user-select: none;
|
|
5
|
+
background-color: var(--sidebar-bg-color, #fff);
|
|
6
|
+
color: var(--color-primary-base, var(--color-blueberry-6));
|
|
7
|
+
display: none;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
position: fixed;
|
|
12
|
+
right: 20px;
|
|
13
|
+
bottom: 44px;
|
|
14
|
+
z-index: 100;
|
|
15
|
+
border-radius: 50%;
|
|
16
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
|
|
17
|
+
width: 60px;
|
|
18
|
+
height: 60px;
|
|
19
|
+
padding: 0;
|
|
20
|
+
|
|
21
|
+
svg path {
|
|
22
|
+
fill: var(--color-primary-base, var(--color-blueberry-6));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media screen and (max-width: ${s.small}) {
|
|
26
|
+
display: flex;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@media print {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
`;export{h as FloatingButton};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/** Redocly logo for the community edition's sidebar attribution. Hidden until mounted; removed if the CDN image fails to load. */
|
|
3
|
+
export declare function RedoclyAttributionLogo({ full }: {
|
|
4
|
+
full?: boolean;
|
|
5
|
+
}): ReactElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{useEffect as e,useState as l}from"react";function n({full:t=!1}){const[r,o]=l(!1);return e(()=>{o(!0)},[]),r?s("img",{alt:"redocly logo",onError:()=>o(!1),src:t?"https://cdn.redoc.ly/redoc/logo-mini-full.svg":"https://cdn.redoc.ly/redoc/logo-mini.svg"}):null}export{n as RedoclyAttributionLogo};
|
|
@@ -1,22 +1,46 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{Fragment as f,jsx as d,jsxs as s}from"react/jsx-runtime";import{memo as g,useCallback as b,useEffect as u}from"react";import{styled as x,css as m}from"styled-components";import{useAtom as v}from"jotai";import{breakpoints as c}from"@redocly/theme/core/openapi";import{isSidebarOpenedAtom as w}from"../../jotai/app.js";import{useBodyScrollLock as S}from"../../hooks/useBodyScrollLock.js";import{SidebarActions as y}from"./SidebarActions.js";import{FloatingButton as L}from"./FloatingButton.js";const k=["menu-item-type-group","menu-item-type-drilldown"];function E({className:i,children:l,collapsedSidebar:r=!1}){const[e,a]=v(w);u(()=>{if(!e)return;const t=window.matchMedia(`(min-width: ${c.small})`),o=()=>{t.matches&&a(!1)};return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[e,a]),S(e);const p=b(t=>{if(!e)return;const o=t.target.closest("a");if(!o)return;const n=o.closest('[data-component-name="Menu/MenuItem"]');n&&k.some(h=>n.classList.contains(h))||a(!1)},[e,a]);return s(f,{children:[s(_,{className:i,$collapsedSidebar:r,$open:e,onClick:p,children:[r&&!e?null:l,d(y,{})]}),d(L,{})]})}const z=g(E),_=x.div`
|
|
2
2
|
flex-shrink: 0;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
overflow-x: hidden;
|
|
5
|
-
position: sticky;
|
|
6
5
|
top: var(--navbar-height, 0px);
|
|
7
6
|
height: calc(100vh - var(--navbar-height, 0px));
|
|
8
|
-
|
|
7
|
+
height: calc(100dvh - var(--navbar-height, 0px));
|
|
9
8
|
flex-direction: column;
|
|
10
9
|
background: var(--sidebar-bg-color, #fff);
|
|
11
10
|
border-right: 1px solid var(--sidebar-border-color, #e0e0e0);
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
[data-component-name='SidebarLogo/SidebarLogo'] {
|
|
13
|
+
padding: var(--spacing-md, 16px) var(--spacing-sm, 12px);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-component-name='SidebarLogo/SidebarLogo'] img {
|
|
17
|
+
/* Keep the logo compact inside the full-width mobile drawer. */
|
|
18
|
+
max-width: min(140px, var(--sidebar-logo-max-width, 285px));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Mobile: full-width drawer toggled by the floating hamburger button. */
|
|
22
|
+
position: fixed;
|
|
23
|
+
z-index: 20;
|
|
24
|
+
width: 100%;
|
|
25
|
+
display: ${({$open:i})=>i?"flex":"none"};
|
|
26
|
+
|
|
27
|
+
@media screen and (min-width: ${c.small}) {
|
|
28
|
+
position: sticky;
|
|
29
|
+
z-index: auto;
|
|
30
|
+
display: flex;
|
|
31
|
+
|
|
32
|
+
[data-component-name='SidebarLogo/SidebarLogo'] img {
|
|
33
|
+
max-width: var(--sidebar-logo-max-width, 285px);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${({$collapsedSidebar:i})=>i?m`
|
|
37
|
+
width: auto;
|
|
38
|
+
`:m`
|
|
39
|
+
width: var(--sidebar-width, 260px);
|
|
40
|
+
`}
|
|
41
|
+
}
|
|
18
42
|
|
|
19
43
|
@media print {
|
|
20
44
|
display: none;
|
|
21
45
|
}
|
|
22
|
-
`;export{
|
|
46
|
+
`;export{z as StickySidebar};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as m,jsx as n,jsxs as u}from"react/jsx-runtime";import{Fragment as T,useCallback as E,useLayoutEffect as M,useMemo as z,useRef as B,useState as R}from"react";import{styled as c}from"styled-components";import{Dropdown as _}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as
|
|
1
|
+
import{Fragment as m,jsx as n,jsxs as u}from"react/jsx-runtime";import{Fragment as T,useCallback as E,useLayoutEffect as M,useMemo as z,useRef as B,useState as R}from"react";import{styled as c}from"styled-components";import{Dropdown as _}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as b}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as k}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{Tooltip as D}from"@redocly/theme/components/Tooltip/Tooltip";import{trimText as F}from"@redocly/theme/core/openapi";import{calculateMaxLength as S}from"../../utils/calculateMaxLength.js";const P=25,O=3,j=16;function g({breadcrumb:e,onClick:r,maxLength:t}){const o=e.name.length>t,a=F(e.name,t);return n(D,{tip:e.name,placement:"bottom",disabled:!o,children:n(y,{onClick:()=>r(e.href),children:a})})}function G({breadcrumbs:e,onClick:r,maxLength:t}){const o=e[0],a=e[e.length-1],d=e.slice(1,-1);return u(m,{children:[n(g,{breadcrumb:o,onClick:r,maxLength:t}),n(f,{children:"/"}),n(_,{trigger:n(I,{children:"..."}),closeOnClick:!0,alignment:"end",children:n(b,{children:d.map(i=>n(k,{onAction:()=>r(i.href),children:i.name},i.href))})}),n(f,{children:"/"}),n(g,{breadcrumb:a,onClick:r,maxLength:t})]})}function H({breadcrumbs:e,onClick:r,maxLength:t}){return n(m,{children:e.map((o,a)=>u(T,{children:[n(g,{breadcrumb:o,onClick:r,maxLength:t}),a!==e.length-1&&n(f,{children:"/"})]},o.href))})}function $({breadcrumbs:e,onClick:r}){const t=B(null),o=B(null),[a,d]=R(P),i=e.length>O,x=z(()=>i?[e[0],e[e.length-1]]:e,[e,i]),p=E(()=>{const s=t.current,l=s?.parentElement;if(!s||!l||!o.current)return;const v=getComputedStyle(l),C=parseFloat(v.paddingLeft||"0")+parseFloat(v.paddingRight||"0");let h=l.clientWidth-C;const w=l.parentElement?.querySelector('[data-component-name="PageActions/PageActions"]');if(w){const L=w.getBoundingClientRect().left-s.getBoundingClientRect().left-j;L>0&&(h=Math.min(h,L))}const A=S(x,h,i,o.current);d(A)},[x,i]);return M(()=>{p();const s=new ResizeObserver(p),l=t.current?.parentElement;return l&&s.observe(l),()=>{s.disconnect()}},[p]),e.length?u(m,{children:[n(N,{ref:o,"aria-hidden":"true"}),n(W,{ref:t,"data-component-name":"Breadcrumbs",children:i?n(G,{breadcrumbs:e,onClick:r,maxLength:a}):n(H,{breadcrumbs:e,onClick:r,maxLength:a})})]}):null}const N=c.span`
|
|
2
2
|
position: absolute;
|
|
3
3
|
visibility: hidden;
|
|
4
4
|
white-space: nowrap;
|
|
@@ -19,7 +19,7 @@ import{Fragment as m,jsx as n,jsxs as u}from"react/jsx-runtime";import{Fragment
|
|
|
19
19
|
font-size: var(--font-size-sm);
|
|
20
20
|
line-height: var(--line-height-sm);
|
|
21
21
|
color: var(--text-color-secondary);
|
|
22
|
-
border-radius: var(--border-radius);
|
|
22
|
+
border-radius: var(--breadcrumbs-border-radius);
|
|
23
23
|
cursor: pointer;
|
|
24
24
|
padding: 1px calc(var(--spacing-xxs) / 2);
|
|
25
25
|
overflow: hidden;
|
|
@@ -9,7 +9,7 @@ import{styled as o}from"styled-components";function e(r){return r.startsWith("2"
|
|
|
9
9
|
align-items: center;
|
|
10
10
|
padding: 0 var(--spacing-sm);
|
|
11
11
|
height: 24px;
|
|
12
|
-
border-radius: var(--border-radius);
|
|
12
|
+
border-radius: var(--border-radius-md);
|
|
13
13
|
border: none;
|
|
14
14
|
cursor: pointer;
|
|
15
15
|
font-family: var(--font-family-base);
|
|
@@ -4,7 +4,7 @@ import{styled as r}from"styled-components";const o=r.span`
|
|
|
4
4
|
font-family: var(--font-family-monospaced);
|
|
5
5
|
font-size: var(--font-size-sm);
|
|
6
6
|
line-height: var(--line-height-sm);
|
|
7
|
-
border-radius: var(--border-radius);
|
|
7
|
+
border-radius: var(--tag-border-radius);
|
|
8
8
|
color: var(--text-color-secondary);
|
|
9
9
|
display: inline-flex;
|
|
10
10
|
word-break: var(--code-word-break);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as c,jsx as e,jsxs as l}from"react/jsx-runtime";import{styled as a,css as d}from"styled-components";import{memo as $,useState as j}from"react";import{isUndefined as N}from"@redocly/theme/core/openapi";import{cycleColorsByLevel as C}from"../Schema/utils.js";import{NestedToggleButton as L}from"./NestedToggleButton.js";function S({expandByDefault:r,level:g,expandable:f=!1,expandText:v,hideText:x,hideDivider:h=!1,children:s,expandedAll:i,isNestedArray:
|
|
1
|
+
import{Fragment as c,jsx as e,jsxs as l}from"react/jsx-runtime";import{styled as a,css as d}from"styled-components";import{memo as $,useState as j}from"react";import{isUndefined as N}from"@redocly/theme/core/openapi";import{cycleColorsByLevel as C}from"../Schema/utils.js";import{NestedToggleButton as L}from"./NestedToggleButton.js";function S({expandByDefault:r,level:g,expandable:f=!1,expandText:v,hideText:x,hideDivider:h=!1,children:s,expandedAll:i,isNestedArray:t}){const[b,u]=j((r||t)??!1),o=N(i)?b:i,n=o?C(g):void 0;if(!f)return s;const y=()=>{u(w=>!w)};return t?l(c,{children:[e(_,{children:"Array ["}),e(m,{$isArrayInsideArray:t,className:"view-nested-wrapper",children:e(p,{color:n,children:s})})]}):e(c,{children:l(m,{$divider:!h&&!o,className:"view-nested-wrapper",children:[e(V,{expanded:o,label:o?x||"":v||"",color:n,onClick:y}),o&&e(p,{color:n,children:s})]})})}const I=$(S),V=a(L)`
|
|
2
2
|
margin: var(--spacing-xxs) 0 var(--spacing-xs);
|
|
3
3
|
width: 100%;
|
|
4
4
|
`,p=a.div`
|
|
@@ -22,7 +22,7 @@ import{Fragment as c,jsx as e,jsxs as l}from"react/jsx-runtime";import{styled as
|
|
|
22
22
|
`}
|
|
23
23
|
`,_=a.span`
|
|
24
24
|
padding: 0 var(--spacing-xs);
|
|
25
|
-
border-radius: var(--border-radius);
|
|
25
|
+
border-radius: var(--tag-border-radius);
|
|
26
26
|
border: 1px solid var(--border-color-secondary);
|
|
27
27
|
background-color: var(--bg-color);
|
|
28
28
|
font-size: var(--font-size-sm);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n,jsxs as d}from"react/jsx-runtime";import{useState as $,useEffect as z,memo as J,useMemo as f,useRef as K}from"react";import{useAtomValue as H}from"jotai";import{Admonition as X}from"@redocly/theme/components/Admonition/Admonition";import{FieldWrapper as Y,FieldNameBox as Z,FieldName as ee,ExpandableFieldBody as ne,PanelAnnotation as F,InlineCode as re}from"./styled.js";import{ViewNested as G}from"./ViewNested.js";import{LazyMount as V}from"../common/LazyMount.js";import{GraphQLTypeViewByName as oe}from"./GraphQLTypeView.js";import{GraphQLReturnTypeDetails as te}from"./GraphQLReturnTypeDetails.js";import{GraphQLArgumentsSection as se}from"./GraphQLArgumentsSection.js";import{RequiresScopesButton as ae}from"./RequiresScopesButton.js";import{renderDescription as ie}from"./renderDescription.js";import{Markdown as pe}from"../common/Markdown.js";import{DeepLinkAnchor as me}from"../common/DeepLinkAnchor.js";import{buildGraphqlSuffix as ce,getDeepLinkId as de,isGraphqlDeepLinkAncestor as le}from"../../utils/deep-link.js";import{useDeepLinkUrl as ue}from"../../hooks/useDeepLinkSection.js";import{useSpecTranslate as he}from"../../hooks/useTranslate.js";import{globalOptionsAtom as ge}from"../../jotai/store.js";import{graphqlTypeLookupAtom as fe}from"../../jotai/graphql.js";import{mergeRequiresScopes as xe}from"../../utils/graphql-scopes.js";import{countNamedTypeFields as Le,isGraphqlFieldExpandable as ye}from"../../utils/graphql-type-expansion.js";import{isWithinExpansionLevel as Te}from"../../utils/expansion.js";import{useMarkdownAdapter as Ee}from"../../
|
|
1
|
+
import{jsx as n,jsxs as d}from"react/jsx-runtime";import{useState as $,useEffect as z,memo as J,useMemo as f,useRef as K}from"react";import{useAtomValue as H}from"jotai";import{Admonition as X}from"@redocly/theme/components/Admonition/Admonition";import{FieldWrapper as Y,FieldNameBox as Z,FieldName as ee,ExpandableFieldBody as ne,PanelAnnotation as F,InlineCode as re}from"./styled.js";import{ViewNested as G}from"./ViewNested.js";import{LazyMount as V}from"../common/LazyMount.js";import{GraphQLTypeViewByName as oe}from"./GraphQLTypeView.js";import{GraphQLReturnTypeDetails as te}from"./GraphQLReturnTypeDetails.js";import{GraphQLArgumentsSection as se}from"./GraphQLArgumentsSection.js";import{RequiresScopesButton as ae}from"./RequiresScopesButton.js";import{renderDescription as ie}from"./renderDescription.js";import{Markdown as pe}from"../common/Markdown.js";import{DeepLinkAnchor as me}from"../common/DeepLinkAnchor.js";import{buildGraphqlSuffix as ce,getDeepLinkId as de,isGraphqlDeepLinkAncestor as le}from"../../utils/deep-link.js";import{useDeepLinkUrl as ue}from"../../hooks/useDeepLinkSection.js";import{useSpecTranslate as he}from"../../hooks/useTranslate.js";import{globalOptionsAtom as ge}from"../../jotai/store.js";import{graphqlTypeLookupAtom as fe}from"../../jotai/graphql.js";import{mergeRequiresScopes as xe}from"../../utils/graphql-scopes.js";import{countNamedTypeFields as Le,isGraphqlFieldExpandable as ye}from"../../utils/graphql-type-expansion.js";import{isWithinExpansionLevel as Te}from"../../utils/expansion.js";import{useMarkdownAdapter as Ee}from"../../contexts/markdownAdapter.js";import{useUrlHash as qe}from"../../hooks/useUrlHash.js";const B=72;function ke({field:e,contrast:x,isArgument:t,fieldExpandLevel:s,parentTypeName:r,parentRequiresScopes:l,expanded:a}){const{fieldExpandLevel:M,schemasExpansionLevel:b}=H(ge),L=H(fe),y=Ee(),o=he(),T=s+1,i=r?`${r}.${e.name}`:e.name,u=qe(),E=K(u);u&&(E.current=u);const p=le(E.current,i),m=Te(s,b,0),[I,q]=$(void 0),[Q,k]=$(void 0);z(()=>{q(void 0),k(void 0)},[a]);const h=I??a??(p||m),w=Q??a??(p||m),A=!!e.deprecationReason,D=f(()=>e.deprecationReason?y.parse(e.deprecationReason)??null:null,[e.deprecationReason,y]),U=!!t&&!!e.required,c=e.args??[],v=c.length>0,_=Le(e.type.name,L)*B,j=c.length*B,R=ye(e,s,M,L),C=!R||!h,N=t?r?`arg-${r}-${e.name}`:`arg-${e.name}`:r?`${r}-${e.name}`:e.name,O=c.map(S=>({name:S.name,required:!!S.required})),P=f(()=>l!==void 0?xe(e.requiresScopes,l):null,[e.requiresScopes,l]),W=f(()=>ce({t:t?"argument":"field",path:i,arg:t?e.name:void 0}),[i,t,e.name]),g=ue(W);return n("div",{id:de(g)??N,children:d(Y,{$showBorder:C,children:[d(Z,{children:[g&&n(me,{to:g,label:`link to ${e.name}`,variant:"field"}),n(ee,{$isDeprecated:A,children:e.name}),n(te,{typeRef:e.type,inline:!v,deprecated:A,required:U})]}),e.defaultValue!==void 0&&d(F,{children:[o("defaultValue","Default"),":"," ",n(re,{children:JSON.stringify(e.defaultValue)})]}),e.description&&n(F,{children:ie(e.description)}),D&&n(X,{type:"warning",name:o("deprecationReason","Deprecation reason"),children:n(pe,{source:D})}),R&&d(ne,{$contrast:!x,children:[v&&n(G,{expanded:w,level:s,expandText:o("arguments.show","Show arguments"),collapseText:o("arguments.hide","Hide arguments"),collapsedArgs:O,onClick:()=>k(!w),children:n(V,{forceMount:p||m,estimatedHeight:j,children:n(se,{args:c,fieldExpandLevel:T,parentName:i,expanded:a})})}),n(G,{expanded:h,level:s,expandText:o("returnTypes.show","Show return type"),collapseText:o("returnTypes.hide","Hide return type"),onClick:()=>q(!h),children:n(V,{forceMount:p||m,estimatedHeight:_,children:n(oe,{typeName:e.type.name,contrast:!x,fieldExpandLevel:T,expanded:a,parentPath:i})})})]}),n(ae,{directive:P})]})})}const ze=J(ke);export{ze as GraphQLFieldView};
|
|
@@ -3,14 +3,14 @@ import{jsx as r,jsxs as a}from"react/jsx-runtime";import{useRef as b,memo as u,F
|
|
|
3
3
|
position: fixed;
|
|
4
4
|
width: 100vw;
|
|
5
5
|
height: 100vh;
|
|
6
|
-
z-index: var(--z-index-popover,
|
|
6
|
+
z-index: var(--z-index-popover, 200);
|
|
7
7
|
left: 0;
|
|
8
8
|
top: 0;
|
|
9
9
|
pointer-events: auto;
|
|
10
10
|
`,B=o.div`
|
|
11
11
|
background: var(--bg-color);
|
|
12
12
|
box-shadow: var(--bg-raised-shadow, 0 8px 32px rgba(0, 0, 0, 0.15));
|
|
13
|
-
border-radius: var(--border-radius-lg
|
|
13
|
+
border-radius: var(--border-radius-lg);
|
|
14
14
|
padding: var(--spacing-lg);
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
@@ -58,7 +58,7 @@ import{jsx as r,jsxs as a}from"react/jsx-runtime";import{useRef as b,memo as u,F
|
|
|
58
58
|
line-height: var(--line-height-base);
|
|
59
59
|
font-family: var(--font-family-monospaced);
|
|
60
60
|
padding: 0 var(--spacing-xxs, 4px);
|
|
61
|
-
border-radius: var(--border-radius);
|
|
61
|
+
border-radius: var(--tag-border-radius);
|
|
62
62
|
background: var(--tag-bg-color, var(--border-color-secondary));
|
|
63
63
|
color: var(--text-color-secondary);
|
|
64
64
|
`,T=o.p`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as p,jsx as r,jsxs as u}from"react/jsx-runtime";import{useMemo as v}from"react";import{useAtomValue as s}from"jotai";import{styled as y}from"styled-components";import{Admonition as b}from"@redocly/theme/components/Admonition/Admonition";import{graphqlDirectiveDataAtom as F,graphqlOperationAtom as N,graphqlOperationKey as D,graphqlTypeLookupAtom as E}from"../../../jotai/graphql.js";import{GraphQLFieldView as x}from"../GraphQLFieldView.js";import{renderDescription as R}from"../renderDescription.js";import{Markdown as T}from"../../common/Markdown.js";import{FieldNameBox as S,FieldName as k,PanelAnnotation as q,InlineCode as L}from"../styled.js";import{useSpecTranslate as O}from"../../../hooks/useTranslate.js";import{useCollapsibleEntryKey as w,useExpandableSection as V,useRegisterCollapsibleEntry as j}from"../../../hooks/useExpandableSection.js";import{isGraphqlFieldExpandable as C}from"../../../utils/graphql-type-expansion.js";import{globalOptionsAtom as G}from"../../../jotai/store.js";import{useMarkdownAdapter as M}from"../../../
|
|
1
|
+
import{Fragment as p,jsx as r,jsxs as u}from"react/jsx-runtime";import{useMemo as v}from"react";import{useAtomValue as s}from"jotai";import{styled as y}from"styled-components";import{Admonition as b}from"@redocly/theme/components/Admonition/Admonition";import{graphqlDirectiveDataAtom as F,graphqlOperationAtom as N,graphqlOperationKey as D,graphqlTypeLookupAtom as E}from"../../../jotai/graphql.js";import{GraphQLFieldView as x}from"../GraphQLFieldView.js";import{renderDescription as R}from"../renderDescription.js";import{Markdown as T}from"../../common/Markdown.js";import{FieldNameBox as S,FieldName as k,PanelAnnotation as q,InlineCode as L}from"../styled.js";import{useSpecTranslate as O}from"../../../hooks/useTranslate.js";import{useCollapsibleEntryKey as w,useExpandableSection as V,useRegisterCollapsibleEntry as j}from"../../../hooks/useExpandableSection.js";import{isGraphqlFieldExpandable as C}from"../../../utils/graphql-type-expansion.js";import{globalOptionsAtom as G}from"../../../jotai/store.js";import{useMarkdownAdapter as M}from"../../../contexts/markdownAdapter.js";function ae({node:e}){const{fieldExpandLevel:o}=s(G),d=s(E),a=s(N(D(e.graphqlOperationType,e.graphqlFieldName))),i=!!e.graphqlTypeName&&e.graphqlOperationType==null&&e.graphqlFieldName==null,f=s(F(i?e.graphqlTypeName??"":"")),t=a?.args??null,l=f?.args??null,h=(t?.length?t:l)??null,g=!!h&&h.some(n=>C(n,0,o,d)),m=V(e.variant,g);if(j(w(g?e.variant:void 0),!!m),t&&t.length>0)return r(p,{children:t.map(n=>r(x,{field:n,isArgument:!0,fieldExpandLevel:0,parentTypeName:e.graphqlFieldName,parentRequiresScopes:a?a.requiresScopes??null:void 0,expanded:m},n.name))});if(l&&l.length>0){const n=`@${f?.name}`;return r(p,{children:l.map(A=>r(x,{field:A,isArgument:!0,fieldExpandLevel:0,parentTypeName:n,expanded:m},A.name))})}const c=e.graphqlSchema;return!Array.isArray(c)||c.length===0?r(p,{}):r(p,{children:c.map(n=>r(_,{arg:n},n.name))})}function _({arg:e}){const o=O(),d=!!e.deprecationReason,a=M(),i=v(()=>e.deprecationReason?a.parse(e.deprecationReason)??null:null,[e.deprecationReason,a]);return u(z,{children:[u(S,{children:[r(k,{$isDeprecated:d,children:e.name}),r(B,{children:e.type})]}),e.defaultValue!==void 0&&u(q,{children:[o("defaultValue","Default"),":"," ",r(L,{children:JSON.stringify(e.defaultValue)})]}),e.description!=null&&e.description!==""&&r(q,{children:R(e.description)}),i&&r(b,{type:"warning",name:o("deprecationReason","Deprecation reason"),children:r(T,{source:i})})]})}const z=y.div`
|
|
2
2
|
padding: var(--spacing-base) 0;
|
|
3
3
|
border-bottom: 1px solid var(--border-color-primary);
|
|
4
4
|
`,B=y.span`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Fragment as N,jsx as e,jsxs as y}from"react/jsx-runtime";import{useState as u,useContext as L,useEffect as _,useMemo as g,useCallback as B}from"react";import{styled as F}from"styled-components";import{useAtomValue as K}from"jotai";import{CodeBlockPanel as V,StyledCodeBlock as H}from"../styled.js";import{useResolvedExamples as Y,useExampleEntries as $}from"../../ItemContent/hooks.js";import{useBodySamplingSchemaId as O,useMediaTypeContent as R}from"./hooks.js";import{
|
|
1
|
+
import{Fragment as N,jsx as e,jsxs as y}from"react/jsx-runtime";import{useState as u,useContext as L,useEffect as _,useMemo as g,useCallback as B}from"react";import{styled as F}from"styled-components";import{useAtomValue as K}from"jotai";import{CodeBlockPanel as V,StyledCodeBlock as H}from"../styled.js";import{useResolvedExamples as Y,useExampleEntries as $}from"../../ItemContent/hooks.js";import{useBodySamplingSchemaId as O,useMediaTypeContent as R}from"./hooks.js";import{ExampleDescription as U,ExampleSelector as W,MediaTypeSelector as q,PayloadDisplay as z}from"./selectors.js";import{StyledPanelHeader as G}from"./styled.js";import{ServerDropdown as J}from"./ServerDropdown.js";import{LanguageDropdown as Q}from"../LanguageItem/LanguageDropdown.js";import{itemStoreFieldAtom as X}from"../../../jotai/itemStore.js";import{ItemIdContext as Z}from"../../../hooks/useDeepLinkSection.js";import{getSyntaxHighlightLang as ee}from"../../../utils/languages.js";import{useSpecTranslate as ae}from"../../../hooks/useTranslate.js";import{useCopyCodeTelemetry as te}from"../../../hooks/useCopyCodeTelemetry.js";const m="payload",oe=F.div`
|
|
2
2
|
min-width: 0;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
flex: 1 1 auto;
|
|
5
|
-
`;function
|
|
5
|
+
`;function Ce({node:a}){const x=ae(),h=L(Z)??"",S=K(X({itemId:h,key:"selectedCallback"})),p=a.callbackName,t=a.definitionSamples,C=p!=null&&S===p,{mediaTypes:b,activeMediaType:l,effectiveSchemaId:v,effectiveExampleIds:s,onMediaTypeChange:k}=R(a),E=O(v,l),d=Y(E,s,"response",l),I=$(s),[i,f]=u(0),[n,T]=u(m);_(()=>f(0),[s,l]);const D=d[i]??d[0],P=I[i]?.description,M=g(()=>{const o=[{key:m,lang:"json",title:"Payload"}];if(t)for(const c of t){const A=`x-${c.lang}`;o.push({key:A,lang:c.lang,title:c.label||c.lang})}return o},[t]),r=g(()=>{if(!(n===m||!t))return t.find(o=>`x-${o.lang}`===n)},[n,t]),j=te("response"),w=B(o=>T(o),[]);return C?e(V,{className:"panel-callback-samples",header:()=>y(G,{isExpandable:!1,children:[e(oe,{children:e(J,{servers:a.servers??[],method:(a.httpVerb??"post").toUpperCase(),path:a.path??"Callback"})}),e(Q,{activeTab:n,samples:M,onChange:w})]}),isExpandable:!1,children:r?e(H,{lang:ee(r.lang),source:r.source,header:{className:"code-block-header",controls:{copy:{onClick:j(r.lang)}}}}):y(N,{children:[e(q,{mediaTypes:b,value:l,onChange:k,label:x("contentType","Payload media type")}),e(W,{exampleIds:s,selectedIdx:i,onSelect:f}),e(U,{description:P}),e(z,{payload:D,emptyMessage:"// No callback payload",mediaType:l})]})}):null}export{Ce as CallbackPayloadItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as le,jsx as s,jsxs as j}from"react/jsx-runtime";import{useState as ce,useMemo as T,useCallback as V,useContext as de}from"react";import{useEffect as ue}from"react";import{useAtomValue as I,useSetAtom as ye}from"jotai";import{applyEnvVariables as fe}from"../../../services/code-samples/apply-env-variables.js";import{findExampleIdByKey as he}from"../../../services/code-samples/example-key.js";import{itemStoreAtom as Se,itemStoreFieldAtom as ge}from"../../../jotai/itemStore.js";import{ItemIdContext as xe}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as ve}from"../../../hooks/useTranslate.js";import{CodeBlockPanel as Ce,StyledCodeBlock as Ee}from"../styled.js";import{useResolvedExamples as be}from"../../ItemContent/hooks.js";import{getLangKey as G,getSyntaxHighlightLang as Ie}from"../../../utils/languages.js";import{selectedSecuritySchemeIdxAtom as qe}from"../../../jotai/app.js";import{exampleStoreAtom as Le}from"../../../jotai/examples.js";import{useActiveVariantSchemaId as ke,useSchemaVariantSelection as Te,useMediaTypeContent as Ve}from"./hooks.js";import{isSequentialMediaType as Ae}from"../../../utils/media-type.js";import{isRecord as O}from"../../../adapters/helpers.js";import{updateObjectProperties as Be}from"../../../adapters/openapi/configure/merge-utils.js";import{useCopyCodeTelemetry as $e}from"../../../hooks/useCopyCodeTelemetry.js";import{VariantPicker as Ke,ExampleDescription as Ne,ExampleSelector as Pe,MediaTypeSelector as Ue,PayloadDisplay as Me}from"./selectors.js";import{LanguageDropdown as Re}from"../LanguageItem/LanguageDropdown.js";import{StyledPanelHeader as we}from"./styled.js";import{ServerDropdown as De}from"./ServerDropdown.js";import{globalOptionsAtom as Fe}from"../../../jotai/store.js";import{createLanguageSwitchEvent as je}from"../../../events/languageSwitch.js";import{createCodeSampleCopyEvent as Ge}from"../../../events/codeSampleCopy.js";import{useActiveServer as Oe}from"./useActiveServer.js";import{useCodeSampleLanguages as We,WEBHOOK_LANGUAGE_SAMPLES as W}from"./useCodeSampleLanguages.js";import{useReplayRequestState as _e}from"./useReplayRequestState.js";import{useTryItFooter as He}from"./useTryItFooter.js";import{generateRequestSample as ze}from"./generate-request-sample.js";import{SecuritySchemeSelector as Je}from"./SecuritySchemeSelector.js";function Tt({node:o}){const l=I(Fe),d=ve(),e=o.source,c=I(Le),{mediaTypes:A,activeMediaType:n,effectiveSchemaId:x,effectiveExampleIds:a,onMediaTypeChange:_}=Ve(o),H=o.isWebhook?"response":"request",z=Te(a?.length?void 0:x),J=ke(x),Q=Ae(n)?x:J,B=be(Q,a,H,n),$=de(xe)??"",v=ye(Se($)),X=I(ge({itemId:$,key:"activeExampleKey"})),r=_e(e),Y=He(o);ue(()=>{if(!r.exampleName)return;const t=c[r.exampleName]?.key??r.exampleName;v({activeExampleKey:t})},[r.exampleName,c,v]);const u=`${n}|${a?.join(",")}`,K=he(a,X||void 0,t=>c[t]),N=K?a?.indexOf(K)??-1:-1,[C,P]=ce({contentKey:u,idx:0}),f=N>=0?N:C.contentKey===u?C.idx:0;(C.idx!==f||C.contentKey!==u)&&P({contentKey:u,idx:f});const Z=V(t=>{P({contentKey:u,idx:t});const i=a?.[t],g=i?c[i]?.key:void 0;v({activeExampleKey:g??""})},[u,a,c,v]),h=B[f]??B[0],ee=(a?.length??0)>0||!!x,{languages:S,filteredDefinitionSamples:U,activeLanguage:m,setLanguage:M}=We(o,ee),p=Oe(o),R=I(qe),w=e.securityGroups,E=a?.[f],b=E?c[E]?.key??E:void 0,y=T(()=>{const t=e.requestValues?.serverBody;return(p.specUrl&&t?.[p.specUrl])??e.requestValues?.body},[p.specUrl,e.requestValues?.body,e.requestValues?.serverBody]),te=T(()=>r.displayBody!==void 0?r.displayBody:y!==void 0?h===void 0?y:O(h)&&O(y)?Be(h,y):y:h,[r.displayBody,h,y]),oe=T(()=>{if(m==="payload")return"";const t=U?.find(g=>G(g)===m);if(t)return fe(t.source,e.requestValues,p.specUrl);let i;return i=ze({source:e,activeLanguage:m,serverUrl:p.url,activeServerSpecUrl:p.specUrl,mediaType:n,environment:p.environment[0]??{},harRequestValues:r.harRequestValues,securityGroups:w,securityIdx:R,replayBody:r.body,exampleName:b,options:l,resolvers:r.resolvers,translate:d}),i??`// ${d("unsupportedLanguage","Language is not supported.")}`},[m,U,e,p,d,n,r,w,R,b,l]),q=S.find(t=>t.key===m)??S[0],D=o.definitionSamples?.find(t=>G(t)===m),L=D?.lang??q?.lang,ae=L&&Ie(L),F=$e("request"),re=V(t=>()=>{F(t)(),l.events?.codeSamplesCopy?.(Ge({operation:{id:`${e.method}:${e.path}`,path:e.path,httpVerb:e.method,name:`${e.method.toUpperCase()} ${e.path}`},type:"request",lang:t??"",label:q?.title??"",activeMimeName:n??"",activeExampleName:b}))},[F,l.events,e.method,e.path,q,n,b]),se=V(t=>{M(t);const i=(o.isWebhook?W:S).find(g=>g.key===t);l.events?.codeSamplesLanguageSwitch&&i&&l.events.codeSamplesLanguageSwitch(je({operation:{id:`${e.method}:${e.path}`,path:e.path,httpVerb:e.method,name:`${e.method.toUpperCase()} ${e.path}`},sample:{lang:i.lang,label:i.title}}))},[M,S,o.isWebhook,l.events,e.method,e.path]),ne=e.method,ie=e.path,k=m==="payload",me=!k&&!!D,pe=(a?.length??0)>0;return s(le,{children:j(Ce,{className:"panel-request-samples",footer:Y,header:()=>j(we,{isExpandable:!1,children:[s(De,{servers:o.servers??[],method:ne,path:ie}),s(Re,{activeTab:m,samples:o.isWebhook?W:S,onChange:se})]}),isExpandable:!1,children:[s(Je,{requirements:e.securityGroups}),A.length>1&&s(Ue,{mediaTypes:A,value:n,onChange:_,label:k?d("contentType","Payload media type"):d("contentType","Request media type")}),!me&&!pe&&s(Ke,{selection:z}),s(Pe,{exampleIds:a,selectedIdx:f,onSelect:Z}),s(Ne,{description:c[E??""]?.description}),k?s(Me,{payload:te,emptyMessage:`// ${d("noRequestPayload","No request payload")}`,mediaType:n,snippetType:"request"}):s(Ee,{lang:ae,source:oe,header:{className:"code-block-header",controls:{copy:{onClick:re(L)}}}})]})})}export{Tt as CodeSampleItem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as g,jsx as e,jsxs as
|
|
1
|
+
import{Fragment as g,jsx as e,jsxs as h}from"react/jsx-runtime";import{styled as u}from"styled-components";import{useState as E,useEffect as S}from"react";import{PanelHeader as v}from"@redocly/theme/components/Panel/PanelHeader";import{CodeBlockPanel as I}from"../styled.js";import{useResolvedExamples as T,useExampleEntries as P}from"../../ItemContent/hooks.js";import{useBodySamplingSchemaId as M,useSchemaVariantSelection as b,useMediaTypeContent as j}from"./hooks.js";import{VariantPicker as C,ExampleDescription as D,ExampleSelector as _,MediaTypeSelector as k,PayloadDisplay as w}from"./selectors.js";import{useSpecTranslate as B}from"../../../hooks/useTranslate.js";function J({node:n}){const{mediaTypes:r,activeMediaType:s,effectiveSchemaId:l,effectiveExampleIds:a,onMediaTypeChange:m}=j(n),p=B(),d=b(a?.length?void 0:l),c=M(l,s),t=T(c,a,"response",s),f=P(a),[o,i]=E(0);S(()=>i(0),[a,s]);const x=t[o]??t[0],y=f[o]?.description;return t.length===0?e(g,{}):h(I,{className:"panel-response-samples",header:()=>e(F,{isExpandable:!1,children:n.panelLabel??p("payload","Payload")}),isExpandable:!1,children:[e(k,{mediaTypes:r,value:s,onChange:m,label:p("contentType","Payload media type")}),!a?.length&&e(C,{selection:d}),e(_,{exampleIds:a,selectedIdx:o,onSelect:i}),e(D,{description:y}),e(w,{payload:x,emptyMessage:"// No payload sample",mediaType:s})]})}const F=u(v)`
|
|
2
2
|
font-weight: var(--font-weight-regular);
|
|
3
3
|
padding: var(--spacing-sm) var(--spacing-md) var(--spacing-xs);
|
|
4
|
-
`;export{
|
|
4
|
+
`;export{J as PayloadExampleItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as Z,jsx as a,jsxs as B}from"react/jsx-runtime";import{useState as D,useMemo as H,useCallback as O,useContext as ee}from"react";import{useAtom as te,useAtomValue as M,useSetAtom as oe}from"jotai";import{PanelHeaderTitle as ne}from"@redocly/theme/components/Panel/PanelHeaderTitle";import{CodeBlockPanel as se}from"../styled.js";import{findExampleIdByKey as T}from"../../../services/code-samples/example-key.js";import{useResolvedExamples as ae,useExampleEntries as ie}from"../../ItemContent/hooks.js";import{useBodySamplingSchemaId as de,useSchemaVariantSelection as ce}from"./hooks.js";import{activeMediaTypeAtom as pe}from"../../../jotai/app.js";import{exampleStoreAtom as me}from"../../../jotai/examples.js";import{itemStoreAtom as le,itemStoreFieldAtom as F}from"../../../jotai/itemStore.js";import{ItemIdContext as re}from"../../../hooks/useDeepLinkSection.js";import{VariantPicker as ye,ExampleDescription as fe,ExampleSelector as xe,MediaTypeSelector as ue,PayloadDisplay as he}from"./selectors.js";import{ResponsePanelHeader as Te}from"./styled.js";import{ResponseCodesTabList as Ie,ResponseCodeTab as ve}from"../../common/ResponseCodeTabs.js";import{useSpecTranslate as Ce}from"../../../hooks/useTranslate.js";function Se(n,e,y){if(e===void 0||!n?.length)return;const d=s=>y[s];for(const s of n){for(const[I,v]of Object.entries(s.mediaTypeContent??{}))if(T(v.exampleIds,e,d))return{code:s.code,mediaType:I};if(T(s.exampleIds,e,d))return{code:s.code}}}function Ne({node:n}){const{responseCodes:e}=n,y=Ce(),d=ee(re)??"",s=oe(le(d)),I=M(F({itemId:d,key:"activeResponseCode"})),v=M(F({itemId:d,key:"activeExampleKey"})),c=M(me),p=H(()=>Se(e,n.exampleKey,c),[e,n.exampleKey,c]),f=I||p?.code||e?.[0]?.code,i=e?.find(t=>t.code===f)??e?.[0],m=H(()=>i?.mediaTypeContent?Object.keys(i.mediaTypeContent):i?.mediaTypes??[],[i]),[C,N]=te(pe),[V,_]=D(!1),S=p&&p.code===f&&p.mediaType&&m.includes(p.mediaType)?p.mediaType:void 0,u=!V&&S?S:C&&m.includes(C)?C:S??m[0],R=i?.mediaTypeContent?.[u??""],K=!!e?.length,E=R?.schemaId??i?.schemaId??(K?void 0:n.schemaId),o=R?.exampleIds??i?.exampleIds??(K?void 0:n.exampleIds),G=!e?.length||!!(E||o?.length),g=m.length>0?u??m[0]:"application/json",L=ce(o?.length?void 0:E),U=de(E,g),k=ae(U,o,"response",g),q=ie(o),h=`${f}|${u}|${o?.join(",")}`,b=T(o,v||void 0,t=>c[t]),j=b?o?.indexOf(b)??-1:-1,A=T(o,n.exampleKey,t=>c[t]),P=A?o?.indexOf(A)??-1:-1,[w,$]=D({}),l=w[h],x=j>=0?j:l?.picked?l.idx:P>=0?P:l?.idx??0;if(!l||l.idx!==x){const t=l?.picked??!1;$(r=>({...r,[h]:{idx:x,picked:t}}))}const z=O(t=>{$(Y=>({...Y,[h]:{idx:t,picked:!0}}));const r=o?.[t],X=r?c[r]?.key:void 0;s({activeExampleKey:X??""})},[h,o,c,s]),J=k[x]??k[0],Q=q[x]?.description,W=O(()=>{if(!(!n.headerTitle&&!e?.length))return B(Te,{children:[a(ne,{children:n.headerTitle}),e&&e.length>0&&a(Ie,{children:e.map(t=>{const r=t.code===(f??e[0]?.code);return a(ve,{type:"button",$active:r,$code:t.code,onClick:()=>s({activeResponseCode:t.code}),children:t.code},t.code)})})]})},[e,f,n.headerTitle,s]);return k.length===0&&!e?.length?a(Z,{}):B(se,{className:"panel-response-samples",header:W,isExpandable:!1,children:[a(ue,{mediaTypes:m,value:u,onChange:t=>{_(!0),N(t)},label:y("contentType","Response media type")}),!o?.length&&a(ye,{selection:L}),a(xe,{exampleIds:o,selectedIdx:x,onSelect:z}),a(fe,{description:Q}),a(he,{payload:J,emptyMessage:G?`// ${y("noResponseExample","No response sample")}`:y("noResponseContent","No content"),mediaType:g})]})}export{Ne as ResponseExampleItem};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Picks which OpenAPI `security` AND-group the generated code sample is built
|
|
4
|
+
* against. Renders nothing unless the operation declares more than one group —
|
|
5
|
+
* with a single group there is nothing to choose.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SecuritySchemeSelector({ requirements, }: {
|
|
8
|
+
requirements?: Array<Record<string, string[]>>;
|
|
9
|
+
}): ReactElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useAtom as m}from"jotai";import{selectedSecuritySchemeIdxAtom as n}from"../../../jotai/app.js";import{PanelDropdownSelect as l}from"./selectors.js";import{MediaTypeRow as a}from"./styled.js";function h({requirements:e}){const[c,i]=m(n);return!e||e.length<=1?null:r(a,{children:r(l,{value:String(c),onChange:t=>i(Number(t)),"aria-label":"Security scheme",options:e.map((t,o)=>({key:String(o),value:String(o),label:Object.keys(t).join(" + ")||`Scheme ${o+1}`}))})})}export{h as SecuritySchemeSelector};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as p}from"react/jsx-runtime";import{useCallback as f,useEffect as P,useMemo as g}from"react";import{useAtom as $,useAtomValue as h}from"jotai";import{styled as S}from"styled-components";import{getOperationColor as D}from"@redocly/theme/core/openapi";import{breakpoints as M}from"@redocly/theme/core/openapi";import{Dropdown as V}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as W}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as B}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{CopyButton as I}from"@redocly/theme/components/Buttons/CopyButton";import{environmentAtom as L,savedEnvironmentNameAtom as O}from"../../../jotai/app.js";import{resolveServerUrl as w}from"../../../services/code-samples/
|
|
1
|
+
import{jsx as i,jsxs as p}from"react/jsx-runtime";import{useCallback as f,useEffect as P,useMemo as g}from"react";import{useAtom as $,useAtomValue as h}from"jotai";import{styled as S}from"styled-components";import{getOperationColor as D}from"@redocly/theme/core/openapi";import{breakpoints as M}from"@redocly/theme/core/openapi";import{Dropdown as V}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as W}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as B}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{CopyButton as I}from"@redocly/theme/components/Buttons/CopyButton";import{environmentAtom as L,savedEnvironmentNameAtom as O}from"../../../jotai/app.js";import{resolveServerUrl as w}from"../../../services/code-samples/normalize-servers.js";import{replaceServerVariables as q}from"../../../services/code-samples/server-variables.js";import{getServerEnvName as T}from"../../../utils/environments.js";import{globalOptionsAtom as _}from"../../../jotai/store.js";import{useTelemetry as H}from"../../../hooks/useTelemetry.js";import{createTargetServerSwitchEvent as R}from"../../../events/serverSwitch.js";import{PanelItem as z}from"../../common/PanelItem.js";import{HttpVerb as U,PathLabel as C,PathWrapper as F,StaticPathWrapper as G}from"./styled.js";function J(o="",n="",t="/"){return o.endsWith(t)&&o!==t&&(o=o.slice(0,-t.length)),n.startsWith(t)&&(n=n.slice(t.length)),!o||!n||o===t?o+n:o+t+n}const K=S(B)`
|
|
2
2
|
padding: calc(var(--spacing-unit) * 1.5) var(--spacing-xs) calc(var(--spacing-unit) * 1.5)
|
|
3
3
|
var(--spacing-lg);
|
|
4
4
|
@media screen and (max-width: ${M.large}) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CodeSampleSource } from '../../../services/code-samples/index.js';
|
|
2
|
+
import type { HARBuildResolvers, HARBuildSelections } from '../../../services/code-samples/index.js';
|
|
3
|
+
import type { ApiDocsOptions } from '../../../types/options.js';
|
|
4
|
+
type GenerateRequestSampleParams = {
|
|
5
|
+
source: CodeSampleSource;
|
|
6
|
+
activeLanguage: string;
|
|
7
|
+
serverUrl: string | undefined;
|
|
8
|
+
/** Raw (templated) spec URL of the active server — keys the env-variable overrides. */
|
|
9
|
+
activeServerSpecUrl: string | undefined;
|
|
10
|
+
mediaType: string | undefined;
|
|
11
|
+
environment: HARBuildSelections['environment'];
|
|
12
|
+
harRequestValues: HARBuildSelections['requestValues'];
|
|
13
|
+
securityGroups: CodeSampleSource['securityGroups'];
|
|
14
|
+
securityIdx: number;
|
|
15
|
+
replayBody: unknown;
|
|
16
|
+
exampleName: string | undefined;
|
|
17
|
+
options: ApiDocsOptions;
|
|
18
|
+
resolvers: HARBuildResolvers;
|
|
19
|
+
translate: (key: string, fallback: string) => string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Builds the generated (non-`x-codeSamples`) request sample for the active
|
|
23
|
+
* language. Excluded from the community edition — only spec-provided samples
|
|
24
|
+
* and the payload view render there. Returns `undefined` for languages
|
|
25
|
+
* without a generator.
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateRequestSample({ source, activeLanguage, serverUrl, activeServerSpecUrl, mediaType, environment, harRequestValues, securityGroups, securityIdx, replayBody, exampleName, options, resolvers, translate, }: GenerateRequestSampleParams): string | undefined;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getGeneratorKey as C}from"../../../utils/languages.js";import{buildCodeSampleHAR as O,tryGenerateCodeSample as y}from"../../../services/code-samples/index.js";import{applyEnvVariables as b}from"../../../services/code-samples/apply-env-variables.js";function P({source:l,activeLanguage:n,serverUrl:o,activeServerSpecUrl:d,mediaType:m,environment:p,harRequestValues:i,securityGroups:e,securityIdx:s,replayBody:u,exampleName:S,options:a,resolvers:c,translate:f}){const h=e?.length?Object.keys(e.length>1?e[s]??e[0]:e[0]):void 0,g=O(l,{serverUrl:o,mediaType:m,environment:p,requestValues:i,activeSecuritySchemeIds:h,replayBody:u,exampleName:S},{skipOptionalParameters:a.codeSamples?.skipOptionalParameters,withOAuth2Call:a.codeSamples?.withOAuth2Call,generatedPayloadSamplesMaxDepth:a.generatedSamplesMaxDepth},c),r=a.codeSamples?.languages?.find(k=>k.key===n),t=y(r?C(r):n,g,r?.options);if(t.kind!=="unsupported-language")return t.kind==="error"?(console.error(t.error),`// ${f("failedToGenerateCodeSample","Failed to generate code sample.")}`):b(t.source,l.requestValues,d)}export{P as generateRequestSample};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { ExampleEntry } from '../../../types/store.js';
|
|
2
3
|
import type { SchemaVariantSelection } from './hooks.js';
|
|
3
4
|
export declare function VariantPicker({ selection, label, }: {
|
|
4
5
|
selection?: SchemaVariantSelection;
|
|
@@ -27,10 +28,12 @@ export declare function PanelDropdownSelect({ value, onChange, options, 'aria-la
|
|
|
27
28
|
options: PanelSelectOption[];
|
|
28
29
|
'aria-label'?: string;
|
|
29
30
|
}): ReactElement;
|
|
30
|
-
export declare function
|
|
31
|
+
export declare function ExampleDescription({ description, }: {
|
|
32
|
+
description?: ExampleEntry['description'];
|
|
33
|
+
}): ReactElement | null;
|
|
34
|
+
export declare function PayloadDisplay({ payload, emptyMessage, mediaType, snippetType, }: {
|
|
31
35
|
payload: unknown;
|
|
32
36
|
emptyMessage?: string;
|
|
33
37
|
mediaType?: string;
|
|
34
38
|
snippetType?: 'request' | 'response';
|
|
35
|
-
description?: string;
|
|
36
39
|
}): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{useAtomValue as d}from"jotai";import{exampleStoreAtom as k}from"../../../jotai/examples.js";import{globalOptionsAtom as v,specTypeAtom as w}from"../../../jotai/store.js";import{useTelemetry as D}from"../../../hooks/useTelemetry.js";import{useCopyCodeTelemetry as E}from"../../../hooks/useCopyCodeTelemetry.js";import{MAX_DISPLAYED_STRING_LENGTH as f}from"../../../constants/rendering.js";import{isJsonLikeMediaType as C,isSequentialMediaType as M,langFromMime as h}from"../../../utils/media-type.js";import{StyledCodeBlock as m,StyledJsonViewer as b}from"../styled.js";import{Markdown as N}from"../../common/Markdown.js";import{DisabledMimeSelect as L,ExampleDescriptionWrap as y,SelectDropdownCheckmarkIcon as A,MediaTypeRow as p,SelectDropdownLabel as x,SelectDropdownMenu as j,SelectDropdownMenuItem as B,SelectDropdownTriggerButton as J,StyledSelectDropdown as O}from"./styled.js";import{DefaultMappingOptionLabel as P}from"../../Schema/views/DefaultMappingOptionLabel.js";import{jsonToXml as V}from"../../../utils/xml.js";import{formUrlEncodeValue as _}from"../../../utils/form-urlencoded.js";import{apiSpecType as H}from"../../../types/common.js";function le({selection:e,label:a}){if(!e)return null;const{options:r,activeIdx:c,onSelect:o,kind:n,optionMeta:s}=e,u=a??(n==="discriminator"?"Discriminator":"Variant");return t(p,{children:t(g,{value:String(c),onChange:l=>o(Number(l)),"aria-label":u,options:r.map((l,i)=>{const S=s[i]?.isDefaultMapping?t(P,{label:l.label}):void 0;return{key:l.key,value:String(i),label:l.label,labelNode:S}})})})}function oe({exampleIds:e,selectedIdx:a,onSelect:r}){const c=d(k),o=d(w),n=D();if(!e||e.length<2)return null;const s=u=>{const l=Number(u),i=e[l];o===H.ASYNCAPI?n.sendSwitchExampleClickedMessage([{id:"switchExampleButton",object:"button",uri:"urn:redocly:redoc:ui:button:switchExampleButton",example:i,numberOfExamples:e.length}]):n.sendExamplesSwitcherClickedMessage([{object:"button",id:"examplesSwitcherButton",uri:"urn:redocly:redoc:ui:button:examplesSwitcherButton",exampleNumber:l,totalExamples:e.length}]),r(l)};return t(p,{children:t(g,{value:String(a),onChange:s,"aria-label":"Example",options:e.map((u,l)=>({key:u,value:String(l),label:c[u]?.summary??`Example ${l+1}`}))})})}function ae({mediaTypes:e,value:a,onChange:r,label:c}){return e.length===0?null:e.length===1?t(p,{children:t(L,{value:e[0],"aria-label":c,disabled:!0,children:t("option",{value:e[0],children:e[0]})})}):t(p,{children:t(g,{value:a,onChange:r,"aria-label":c,options:e.map(o=>({value:o,label:o}))})})}function g({value:e,onChange:a,options:r,"aria-label":c}){const o=r.find(n=>n.value===e)??r[0];return t(O,{withArrow:!0,alignment:"start",portalled:!0,trigger:t(J,{variant:"outlined",size:"small",type:"button","aria-label":c,children:t(x,{children:o?.labelNode??o?.label})}),children:t(j,{children:r.map(n=>t(B,{active:n.value===o?.value,onAction:()=>a(n.value),suffix:n.value===o?.value?t(A,{}):void 0,children:t(x,{children:n.labelNode??n.label})},n.key??n.value))})})}function ie({description:e}){return e?t(y,{children:t(N,{source:e})}):null}function ce({payload:e,emptyMessage:a="// No sample",mediaType:r,snippetType:c="response"}){const{jsonSamplesExpandLevel:o}=d(v),n=E(c);if(e==null)return t(m,{lang:"text",source:a,header:{controls:!1}});const s=M(r),u=C(r);if(u&&!s){const i=typeof e=="string"?F(e)??e:e;return t(b,{data:i,expandLevel:o,maxStringLength:f})}if(typeof e=="object"&&e!==null){if(r?.includes("xml")){const i=V(e);return t(m,{lang:"xml",source:i,highlightedHtml:G(i),header:{className:"code-block-header",controls:{copy:{onClick:n("xml")}}}})}if(q(r))return t(m,{lang:"text",source:_(e),header:{className:"code-block-header",controls:{copy:{onClick:n("text")}}}});if(s||r&&!u){const i=JSON.stringify(e,null,2);return t(m,{lang:h(r),source:i,header:{className:"code-block-header",controls:{copy:{onClick:n(h(r))}}}})}return t(b,{data:e,expandLevel:o,maxStringLength:f})}const l=r?h(r):"text";return t(m,{lang:l,source:String(e),maxDisplayLength:f,header:{className:"code-block-header",controls:{copy:{onClick:n(l)}}}})}function q(e){return!!e&&/x-www-form-urlencoded/i.test(e)}function F(e){const a=e.trim();if(!(!a||!/^[{[]/.test(a)))try{return JSON.parse(a)}catch{return}}function G(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}export{ie as ExampleDescription,oe as ExampleSelector,ae as MediaTypeSelector,g as PanelDropdownSelect,ce as PayloadDisplay,le as VariantPicker};
|