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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{jsx as e,Fragment as m,jsxs as c}from"react/jsx-runtime";import{memo as f}from"react";import{useAtomValue as u}from"jotai";import{joinWithSeparator as x}from"../../services/index.js";import{TagItem as p}from"../TagItem/index.js";import{OperationItem as y}from"../OperationItem/index.js";import{Section as I}from"../common/index.js";import{useIsExpanded as g}from"./useIsExpanded.js";import{SectionItem as C}from"../SectionItem/index.js";import h from"../ContentItems/useScrollOnRender.js";import{isRootItem as j}from"../ContentItems/helpers.js";import{ApiInfo as S}from"../ApiInfo/index.js";import{layoutAtom as A}from"../../jotai/app.js";const E={group:null,tag:p,section:C,schema:p,operation:y,root:S};function _({item:o,routingBasePath:t,children:s,layout:a}){const r=E[j(o)?"root":o.type],i=o.type==="tag"&&o.items.length>0,n=g({item:o,routingBasePath:t});let d=h(o,t);const l=u(A);return c(m,{children:[r&&e(I,{id:o.id,ref:d,sectionId:x(t,o.id),underlined:o.type==="operation"||o.type==="schema",expanded:i&&!n,children:e(r,{item:o,routingBasePath:t,isExpanded:n,layout:a||l})}),(n||o.type!=="tag")&&!!o.items?.length&&e(m,{children:s})]})}const D=f(_);export{D as ContentItem};
1
+ import{jsx as e,Fragment as m,jsxs as f}from"react/jsx-runtime";import{memo as u}from"react";import{useAtomValue as x}from"jotai";import{joinWithSeparator as y}from"../../services/index.js";import{TagItem as p}from"../TagItem/index.js";import{OperationItem as I}from"../OperationItem/index.js";import{Section as g}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 S}from"../ContentItems/helpers.js";import{ApiInfo as A}from"../ApiInfo/index.js";import{layoutAtom as E}from"../../jotai/app.js";const R={group:null,tag:p,section:h,schema:p,operation:I,root:A};function _({item:o,routingBasePath:t,children:s,layout:a}){const i=S(o),r=R[i?"root":o.type],d=o.type==="tag"&&o.items.length>0,n=C({item:o,routingBasePath:t});let c=j(o,t);const l=x(E);return f(m,{children:[r&&e(g,{id:o.id,ref:c,sectionId:y(t,o.id),underlined:o.type==="operation"||o.type==="schema",expanded:d&&!n,children:e(r,{item:o,routingBasePath:t,isExpanded:n,layout:a||l})}),(n||o.type!=="tag")&&!!o.items?.length&&e(m,{children:s})]})}const G=u(_);export{G as ContentItem};
@@ -0,0 +1,3 @@
1
+ export declare function ErrorPage({ description }: {
2
+ description: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import{jsx as e,jsxs as r,Fragment as i}from"react/jsx-runtime";import t from"styled-components";import{GlobalStyle as a}from"@redocly/theme/core/openapi";function f({description:o}){return console.error(o),r(i,{children:[e(a,{}),r(n,{children:[e(l,{children:";("}),e(s,{children:"Something went wrong..."}),r(g,{children:["Please check the console for get more details or"," ",e("a",{target:"_blank",rel:"noopener noreferrer",href:"https://redocly.com/docs/redoc",children:"documentation"}),"."]})]})]})}const n=t.div`
2
+ height: 100vh;
3
+ max-width: var(--page-404-max-width);
4
+ display: flex;
5
+ flex-direction: column;
6
+ justify-content: center;
7
+ margin: var(--page-404-margin-vertical) var(--page-404-margin-horizontal);
8
+ font-family: var(--page-404-font-family);
9
+ gap: var(--page-404-gap);
10
+ `,l=t.div`
11
+ color: var(--page-404-status-text-color);
12
+ font-size: var(--page-404-status-font-size);
13
+ line-height: var(--page-404-status-line-height);
14
+ font-weight: var(--page-404-status-font-weight);
15
+ `,s=t.div`
16
+ color: var(--page-404-title-text-color);
17
+ font-size: var(--page-404-title-font-size);
18
+ line-height: var(--page-404-title-line-height);
19
+ font-weight: var(--page-404-title-font-weight);
20
+ `,g=t.div`
21
+ color: var(--page-404-description-text-color);
22
+ font-size: var(--page-404-description-font-size);
23
+ line-height: var(--page-404-description-line-height);
24
+ font-weight: var(--page-404-description-font-weight);
25
+ `;export{f as ErrorPage};
@@ -1 +1 @@
1
- import{jsx as p}from"react/jsx-runtime";import{cloneElement as w,isValidElement as v,useEffect as g,useMemo as x,useState as a}from"react";import{Loading as A}from"@redocly/theme/components/Loaders/Loading";import{useDeepCompareMemoize as D,fixSpec as L}from"./utils.js";import{argValueToBoolean as O}from"../../utils/index.js";import{RedoclyOpenAPIDocs as B}from"./RedoclyOpenAPIDocs.js";import{loadAndBundleDefinition as u,loadOpenapiConfig as E}from"../../utils/loadAndBundleSpec.js";async function C(e,o,t){let n;if(t?.skipBundle){if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');n=e}else n=await u(e||o);try{L(n)}catch{}return n}function z(e,o){return e.endsWith(".md")?u({openapi:"3.0.0",info:{title:o||"",version:"1.0",description:{$ref:e}},paths:{}}):u(e)}const I=({options:e,definitionUrl:o,definition:t,activeSampleLanguage:n,children:r})=>{const[,l]=a(),[s,f]=a(!0),[d,h]=a(null),[m,y]=a(e||{});g(()=>{async function S(){f(!0);try{const c=await E();y({...e,...c}),h(await C(t,o,e))}catch(c){l(()=>{throw c})}}S()},[t,o,e]);const i=x(()=>{if(d)return{definition:d,options:m,definitionUrl:o,activeSampleLanguage:n}},D([d,o,m]));return g(()=>{i&&f(!1)},[i]),i?s?O(e?.hideLoading,!1)?null:p(A,{color:"--loading-spinner-color"}):v(r)?w(r,{store:i}):null:null};function T({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:l,router:s}){return p(I,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:l,children:p(B,{withCommonStyles:!0,router:s})})}export{I as AppProvider,T as RedoclyOpenAPIDocsStandalone,z as loadAndBundleSpecOrMd,C as loadSingle};
1
+ import{jsx as s}from"react/jsx-runtime";import{cloneElement as w,isValidElement as x,useEffect as g,useMemo as A,useState as c}from"react";import{Loading as O}from"@redocly/theme/components/Loaders/Loading";import{useDeepCompareMemoize as D,fixSpec as E}from"./utils.js";import{argValueToBoolean as L}from"../../utils/index.js";import{RedoclyOpenAPIDocs as P}from"./RedoclyOpenAPIDocs.js";import{loadAndBundleDefinition as u,loadOpenapiConfig as B}from"../../utils/loadAndBundleSpec.js";import{ErrorPage as I}from"./Error.js";async function k(e,o,t){let n;if(t?.skipBundle){if(!e)throw new Error('spec must be specified when using "skipBundleAndConvert"');n=e}else n=await u(e||o);try{E(n)}catch{}return n}function _(e,o){return e.endsWith(".md")?u({openapi:"3.0.0",info:{title:o||"",version:"1.0",description:{$ref:e}},paths:{}}):u(e)}const C=({options:e,definitionUrl:o,definition:t,activeSampleLanguage:n,children:r})=>{const[i,l]=c(),[h,f]=c(!0),[d,y]=c(null),[m,S]=c(e||{});g(()=>{async function v(){f(!0);try{const p=await B();S({...e,...p}),y(await k(t,o,e))}catch(p){l(p.message)}}v()},[t,o,e]);const a=A(()=>{if(d)return{definition:d,options:m,definitionUrl:o,activeSampleLanguage:n}},D([d,o,m]));return g(()=>{a&&f(!1)},[a]),i?s(I,{description:i||"Please check path to your OpenAPI description"}):a?h?L(e?.hideLoading,!1)?null:s(O,{color:"--loading-spinner-color"}):x(r)?w(r,{store:a}):null:null};function $({definition:e,definitionUrl:o,options:t={},activeItemId:n,activeSampleLanguage:r,activeDeepLink:i,router:l}){return s(C,{definition:e,definitionUrl:o,options:t,activeItemId:n,activeSampleLanguage:r,activeDeepLink:i,children:s(P,{withCommonStyles:!0,router:l||"hash"})})}export{C as AppProvider,$ as RedoclyOpenAPIDocsStandalone,_ as loadAndBundleSpecOrMd,k as loadSingle};
@@ -0,0 +1,4 @@
1
+ import { type ReactElement } from 'react';
2
+ export declare const ServerDescriptionTooltip: ({ description, }: {
3
+ description?: string;
4
+ }) => ReactElement;
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{useEffect as s,useState as i}from"react";import{Button as a}from"@redocly/theme/components/Button/Button";import{Tooltip as m}from"@redocly/theme/components/Tooltip/Tooltip";import{InformationIcon as c}from"@redocly/theme/icons/InformationIcon/InformationIcon";const v=({description:n})=>{const[o,e]=i(!1);return s(()=>{const r=()=>{o&&e(!1)};if(o)return document.addEventListener("touchmove",r,{passive:!0}),()=>{document.removeEventListener("touchmove",r)}},[o]),t(m,{tip:n,placement:"bottom",arrowPosition:"left",isOpen:o,children:t(a,{size:"small",variant:"ghost",icon:t(c,{}),"data-testid":"server-item-description-tooltip",onClick:()=>e(!0),onBlur:()=>e(!1),onFocus:()=>e(!0),onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),onTouchCancel:()=>e(!1)})})};export{v as ServerDescriptionTooltip};
@@ -1,4 +1,4 @@
1
- import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@redocly/theme/components/Buttons/CopyButton";import{PanelItemDescription as x,Title as f}from"../PanelItem/index.js";import{ViewNested as u}from"../ViewNested/index.js";import{Tag as y}from"../common/index.js";import{Markdown as w}from"../Markdown/index.js";import{styled as e}from"../../styled-components.js";const V=({servers:h,path:b,translate:r})=>i(j,{children:h.map(o=>{const a=o.url+b,d=Object.keys(o.variables||{}).length,p=d===1?"variable":"variables",l=`${d||""} ${r(`openapi.${p}`,p)}`;return t("div",{children:[i(x,{children:o.description}),t(k,{children:[i(f,{suppressHydrationWarning:!0,children:a}),i(v,{data:a},a)]}),o.variables&&i(u,{expandText:`${r("openapi.actions.show","Show")} ${l}`,hideText:`${r("openapi.actions.hide","Hide")} ${l}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i(S,{children:Object.entries(o.variables||{}).map(([c,n])=>t(T,{children:[i(z,{children:c}),t(s,{children:[r("openapi.default","Default")," ",i(g,{children:n.default})]}),i($,{source:n.description}),n.enum&&t(s,{children:[r("openapi.enum","Enum")," ",i(D,{children:n.enum.map(m=>i(g,{children:m},m))})]})]},c))})})]},o.url)})}),j=e.div`
1
+ import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as x}from"@redocly/theme/components/Buttons/CopyButton";import{getServerDisplayName as b}from"../../utils/helpers.js";import{PanelItemDescription as u,Title as y}from"../PanelItem/index.js";import{ViewNested as w}from"../ViewNested/index.js";import{Tag as S}from"../common/index.js";import{Markdown as T}from"../Markdown/index.js";import{styled as e}from"../../styled-components.js";import{ServerDescriptionTooltip as j}from"./ServerDescriptionTooltip.js";const q=({servers:h,path:f,translate:r})=>i(D,{children:h.map(t=>{const a=t.url+f,p=Object.keys(t.variables||{}).length,d=p===1?"variable":"variables",l=`${p||""} ${r(`openapi.${d}`,d)}`,v=!!t.name&&!!t.description;return o("div",{children:[o(L,{children:[i(u,{"data-testid":"server-panel-item-name",children:b(t)}),v&&i(j,{description:t.description})]}),o(O,{children:[i(y,{suppressHydrationWarning:!0,children:a}),i(x,{data:a},a)]}),t.variables&&i(w,{expandText:`${r("openapi.actions.show","Show")} ${l}`,hideText:`${r("openapi.actions.hide","Hide")} ${l}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i($,{children:Object.entries(t.variables||{}).map(([c,n])=>o(z,{children:[i(k,{children:c}),o(s,{children:[r("openapi.default","Default")," ",i(g,{children:n.default})]}),i(W,{source:n.description}),n.enum&&o(s,{children:[r("openapi.enum","Enum")," ",i(C,{children:n.enum.map(m=>i(g,{children:m},m))})]})]},c))})})]},t.url)})}),D=e.div`
2
2
  & > div {
3
3
  border-bottom: 1px solid var(--border-color-secondary);
4
4
  margin-bottom: var(--spacing-xs);
@@ -10,7 +10,7 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
10
10
  margin-bottom: 0;
11
11
  padding-bottom: 0;
12
12
  }
13
- `,S=e.div`
13
+ `,$=e.div`
14
14
  padding-left: var(--spacing-xxs);
15
15
  & > div {
16
16
  border-bottom: 1px solid var(--border-color-secondary);
@@ -28,11 +28,11 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
28
28
  margin-bottom: 0;
29
29
  padding-bottom: 0;
30
30
  }
31
- `,T=e.div`
31
+ `,z=e.div`
32
32
  display: flex;
33
33
  flex-direction: column;
34
34
  flex-wrap: wrap;
35
- `,$=e(w)`
35
+ `,W=e(T)`
36
36
  font-size: var(--font-size-sm);
37
37
  line-height: var(--line-height-sm);
38
38
  color: var(--text-color-primary);
@@ -42,18 +42,23 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{CopyButton as v}from"@r
42
42
  font-size: var(--font-size-sm);
43
43
  line-height: var(--line-height-sm);
44
44
  color: var(--text-color-primary);
45
- `,z=e(s)`
45
+ `,k=e(s)`
46
46
  padding-bottom: var(--spacing-xxs);
47
47
  font-weight: var(--font-weight-semibold);
48
- `,D=e.span`
48
+ `,C=e.span`
49
49
  display: flex;
50
50
  gap: var(--spacing-xxs);
51
51
  flex-wrap: wrap;
52
- `,g=e(y)`
52
+ `,g=e(S)`
53
53
  font-size: var(--font-size-sm);
54
54
  line-height: var(--line-height-sm);
55
- `,k=e.div`
55
+ `,L=e.div`
56
+ display: flex;
57
+ justify-content: start;
58
+ align-items: center;
59
+ gap: var(--spacing-xxs);
60
+ `,O=e.div`
56
61
  display: flex;
57
62
  justify-content: space-between;
58
63
  align-items: center;
59
- `;export{V as ServerList};
64
+ `;export{q as ServerList};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as d}from"react/jsx-runtime";import{useMemo as f,useCallback as l}from"react";import{useAtom as S,useAtomValue as g}from"jotai";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as y}from"@redocly/theme/components/Dropdown/Dropdown";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as A,Path as C,StyledCopyButton as b,StyledDropdownMenuItem as P}from"./styled.js";import{PanelItem as j}from"../PanelItem/index.js";import{joinWithSeparator as x}from"../../services/index.js";import{replaceVariables as D}from"../../utils/index.js";import{environmentAtom as V}from"../../jotai/app.js";import{useActiveWithFallback as M,useTelemetry as E}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as W}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const R=({operation:t,className:h})=>{const m=E(),[[u],i]=S(V),{options:{events:n}}=g(I),s=M(t.servers.map(r=>({...r,key:r.url})),u.server),c=l(r=>{r.stopPropagation()},[]),a=l(r=>()=>{if(t.servers.length!==1&&(i({environment:p(r)}),m.sendOpenapiDocsSwitchServersClickedMessage({server:p(r)}),n?.targetServerSwitch&&r)){const o=W({operation:t,serverUrl:r.url});n.targetServerSwitch(o)}},[t,i,m,n]),v=f(()=>t.servers.map(r=>{const o=x(D(r),t.path);return e(P,{onAction:a(r),children:e(j,{header:r.description,title:o,actions:[e(b,{data:o,toasterPlacement:"left",onCopyClick:c},o)],active:r.url===s,withCheckmark:!0})},o)}),[t.servers,t.path,a,c,s]);return e(y,{className:h,trigger:d(A,{variant:"ghost",children:[e(k,{color:t.httpVerb,children:t.httpVerb}),e(C,{children:t.path})]}),withArrow:!0,children:e(w,{children:v})})};export{R as ServerListDropdown};
1
+ import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useMemo as f,useCallback as l}from"react";import{useAtom as S,useAtomValue as g}from"jotai";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as y}from"@redocly/theme/components/Dropdown/Dropdown";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as A,Path as C,StyledCopyButton as b,StyledDropdownMenuItem as D}from"./styled.js";import{PanelItem as P}from"../PanelItem/index.js";import{joinWithSeparator as j}from"../../services/index.js";import{getServerDisplayName as x,replaceVariables as V}from"../../utils/index.js";import{environmentAtom as M}from"../../jotai/app.js";import{useActiveWithFallback as E,useTelemetry as N}from"../../hooks/index.js";import{getServerEnvName as p}from"../../utils/environments.js";import{createTargetServerSwitchEvent as W}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const X=({operation:r,className:h})=>{const n=N(),[[v],i]=S(M),{options:{events:m}}=g(I),s=E(r.servers.map(e=>({...e,key:e.url})),v.server),a=l(e=>{e.stopPropagation()},[]),c=l(e=>()=>{if(r.servers.length!==1&&(i({environment:p(e)}),n.sendOpenapiDocsSwitchServersClickedMessage({server:p(e)}),m?.targetServerSwitch&&e)){const o=W({operation:r,serverUrl:e.url});m.targetServerSwitch(o)}},[r,i,n,m]),u=f(()=>r.servers.map(e=>{const o=j(V(e),r.path);return t(D,{onAction:c(e),children:t(P,{header:x(e),title:o,actions:[t(b,{data:o,toasterPlacement:"left",onCopyClick:a},o)],active:e.url===s,withCheckmark:!0})},o)}),[r.servers,r.path,c,a,s]);return t(y,{className:h,trigger:d(A,{variant:"ghost",children:[t(k,{color:r.httpVerb,children:r.httpVerb}),t(C,{children:r.path})]}),withArrow:!0,children:t(w,{children:u})})};export{X as ServerListDropdown};
package/lib/standalone.js CHANGED
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as v,setSecurityDetailsVariants as V}from"./utils/security-details.js";import{setParameterValue as D}from"./utils/parameters.js";function _(t){const o={},e=t.attributes;for(let r=0;r<e.length;r++){const n=e[r];o[n.name]=n.value}return o}function d(t){const o=_(t),e={};for(const r in o){const n=r.replace(/-(.)/g,(c,s)=>s.toUpperCase());e[n]=o[r]}return e}function N(t,o=document.querySelector("redoc")){m(o,i(l,{store:t}))}function E(t,o={},e=a("redoc")){if(e===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,...n}=o;let c,s;typeof t=="string"?c=t:typeof t=="object"&&(s=t),u(e).render(p(f,{definition:s,definitionUrl:c,options:{...n,...d(e)},router:r??"history"},["Loading..."]))}const b=__REDOCLY_API_REFERENCE_VERSION__,C=__REDOCLY_API_REFERENCE_REVISION__;function R(){const t=a("redoc");if(!t)return;const o=t.getAttribute("spec-url");o&&E(o,{},t)}R();export{N as hydrate,E as init,C as revision,D as setParameterValue,v as setSecurityDetails,V as setSecurityDetailsVariants,b as version};
1
+ import{jsx as i}from"react/jsx-runtime";import{createElement as p}from"react";import{createRoot as u,hydrateRoot as m}from"react-dom/client";import{querySelector as a}from"./utils/dom.js";import{RedoclyOpenAPIDocs as l}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js";import{RedoclyOpenAPIDocsStandalone as f}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js";import{setSecurityDetails as v,setSecurityDetailsVariants as V}from"./utils/security-details.js";import{setParameterValue as D}from"./utils/parameters.js";function _(t){const e={},o=t.attributes;for(let r=0;r<o.length;r++){const n=o[r];e[n.name]=n.value}return e}function d(t){const e=_(t),o={};for(const r in e){const n=r.replace(/-(.)/g,(c,s)=>s.toUpperCase());o[n]=e[r]}return o}function N(t,e=document.querySelector("redoc")){m(e,i(l,{store:t}))}function E(t,e={},o=a("redoc")){if(o===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');const{router:r,...n}=e;let c,s;typeof t=="string"?c=t:typeof t=="object"&&(s=t),u(o).render(p(f,{definition:s,definitionUrl:c,options:{...n,...d(o)},router:r??"hash"},["Loading..."]))}const b=__REDOCLY_API_REFERENCE_VERSION__,C=__REDOCLY_API_REFERENCE_REVISION__;function R(){const t=a("redoc");if(!t)return;const e=t.getAttribute("spec-url");e&&E(e,{},t)}R();export{N as hydrate,E as init,C as revision,D as setParameterValue,v as setSecurityDetails,V as setSecurityDetailsVariants,b as version};
@@ -47,6 +47,7 @@ export interface XSEO {
47
47
  export interface OpenAPIServer extends ParsedDescription {
48
48
  url: string;
49
49
  description?: string;
50
+ name?: string;
50
51
  variables?: OpenAPIServerVariables;
51
52
  }
52
53
  export interface OpenAPIServerVariables {
@@ -1,3 +1,4 @@
1
+ import type { OpenAPIServer } from '../types/open-api';
1
2
  /**
2
3
  * Maps over array passing `isLast` bool to iterator as the second argument
3
4
  */
@@ -42,5 +43,6 @@ export declare function getWindowReferenceOptions<T>(option: string): T | null;
42
43
  export declare function getJsUrl(): string;
43
44
  export declare const normalizeText: (text?: string | GenericObject) => string;
44
45
  export declare const getValueFromMdParsedExtension: (item: GenericObject, key: "description" | "summary" | "x-summary" | "x-enumDescriptions") => any;
46
+ export declare function getServerDisplayName(server: OpenAPIServer): string | undefined;
45
47
  export declare function isLastInArray(arr: Array<unknown>, index: number): boolean;
46
48
  export declare function isLastProperty(obj: object, key: string): boolean;
@@ -1,12 +1,12 @@
1
- import{isObject as i,isString as a}from"@redocly/theme/core/openapi";import{isNamedDefinition as f}from"./openapi.js";import{JsonPointer as l}from"./JsonPointer.js";import{urlParse as u}from"./url.js";import{IS_BROWSER as c}from"./dom.js";function O(r,t){const e=[];for(let n=0;n<r.length-1;n++)e.push(t(r[n],!1));return r.length!==0&&e.push(t(r[r.length-1],!0)),e}function y(r,t){const e={};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=t(r[n],n,r));return e}function A(r,t){const e=[],n=o=>{for(const s of o)e.push(s),s[t]&&n(s[t])};return n(r),e}function p(r){return r.endsWith("/")?r.substring(0,r.length-1):r}function b(r){return!isNaN(parseFloat(r))&&isFinite(r)}function E(r,t,e){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(r))return r.replace(o,`$1
1
+ import{isObject as i,isString as a}from"@redocly/theme/core/openapi";import{isNamedDefinition as f}from"./openapi.js";import{JsonPointer as l}from"./JsonPointer.js";import{urlParse as u}from"./url.js";import{IS_BROWSER as c}from"./dom.js";function O(r,e){const t=[];for(let n=0;n<r.length-1;n++)t.push(e(r[n],!1));return r.length!==0&&t.push(e(r[r.length-1],!0)),t}function y(r,e){const t={};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=e(r[n],n,r));return t}function A(r,e){const t=[],n=o=>{for(const s of o)t.push(s),s[e]&&n(s[e])};return n(r),t}function p(r){return r.endsWith("/")?r.substring(0,r.length-1):r}function b(r){return!isNaN(parseFloat(r))&&isFinite(r)}function E(r,e,t){const n=new RegExp(`(^|\\n)#\\s?${e}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${e}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(r))return r.replace(o,`$1
2
2
 
3
- ${e}
3
+ ${t}
4
4
  $4`);{const s=r===""||r.endsWith(`
5
5
 
6
6
  `)?"":r.endsWith(`
7
7
  `)?`
8
8
  `:`
9
9
 
10
- `;return`${r}${s}# ${t}
10
+ `;return`${r}${s}# ${e}
11
11
 
12
- ${e}`}}const R=r=>Array.isArray(r)&&r.some(t=>i(t)),W=r=>r.filter(t=>!!t),C=r=>i(r)&&!Array.isArray(r);function d(r){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(r)}function I(r,t){let e;if(t.startsWith("//"))e=`${u(r,!0)?.protocol||"https:"}${t}`;else if(d(t))e=t;else if(!t.startsWith("/"))e=p(r)+"/"+t;else{const n=u(r);n?(n.pathname=t,e=n.toString()):e=t}return p(e)}function L(r){return r.charAt(0).toUpperCase()+r.slice(1)}function M(r){try{if(!r)return"";const t=new URL(r);return t.search="",t.hash="",t.toString()}catch{return r}}function N(r){return r.replace(/["\\]/g,"\\$&")}function P(r){return r.replace(/&#(\d+);/g,(t,e)=>String.fromCharCode(parseInt(e,10))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}function T(r){return r&&r.replace(/#/g,"_").toLowerCase()}function j(r,t){return t||f(r)&&l.baseName(r)||""}function z(r={},t,e){return typeof t=="string"&&(t=t.split(".")),t.reduce((n,o)=>n&&n[o]?n[o]:e,r)}function x(r){return(...t)=>t.filter(Boolean).join(r)}const D=x(".");function F(r){return c?window?.REFERENCE_DOCS_OPTIONS?.[r]:null}function _(){if(!c)return"";const r=+new Date+Math.random();try{return(!document.currentScript||!(document.currentScript.async||document.currentScript.defer))&&document.write(`<script id="dummy${r}"></script>`),(document.getElementById("dummy"+r)?.previousSibling).src}catch{return""}}const B=r=>a(r)?r:r?.raw,H=(r,t)=>{const e=r?.[`x-parsed-md-${t}`]||r?.[t];if(!e)return;if(!r?.[`x-parsed-md-${t}`]&&t!=="x-enumDescriptions")return r?.[t];if(t!=="x-enumDescriptions")return g(r,t);let n={};for(const o in e)o.startsWith("x-parsed-md")||(n[o]=e?.[`x-parsed-md-${o}`]||e?.[o]);return Object.keys(n).length?n:e};function g(r,t){const e=r?.[`x-parsed-md-${t}`]||r?.[t];return e?.raw?e:{result:e?.result||r?.[t]?.result||r?.[t],raw:r?.[t]}}function U(r,t){return t===r.length-1}function V(r,t){const e=Object.keys(r);return e.indexOf(t)===e.length-1}export{E as appendToMdHeading,W as deleteEmptyArrayItem,D as dottedString,N as escapeHTMLAttrChars,A as flattenByProp,z as get,_ as getJsUrl,H as getValueFromMdParsedExtension,F as getWindowReferenceOptions,d as isAbsoluteUrl,R as isArrayOfObjects,U as isLastInArray,V as isLastProperty,C as isMergeableObject,b as isNumeric,x as joinStringFactory,y as mapValues,O as mapWithLast,B as normalizeText,M as removeQueryStringAndHash,I as resolveUrl,T as sanitizeItemId,p as stripTrailingSlash,L as titleize,P as unescapeHTMLChars,j as useSchemaTitle};
12
+ ${t}`}}const R=r=>Array.isArray(r)&&r.some(e=>i(e)),W=r=>r.filter(e=>!!e),C=r=>i(r)&&!Array.isArray(r);function d(r){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(r)}function I(r,e){let t;if(e.startsWith("//"))t=`${u(r,!0)?.protocol||"https:"}${e}`;else if(d(e))t=e;else if(!e.startsWith("/"))t=p(r)+"/"+e;else{const n=u(r);n?(n.pathname=e,t=n.toString()):t=e}return p(t)}function N(r){return r.charAt(0).toUpperCase()+r.slice(1)}function L(r){try{if(!r)return"";const e=new URL(r);return e.search="",e.hash="",e.toString()}catch{return r}}function M(r){return r.replace(/["\\]/g,"\\$&")}function P(r){return r.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(parseInt(t,10))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}function T(r){return r&&r.replace(/#/g,"_").toLowerCase()}function j(r,e){return e||f(r)&&l.baseName(r)||""}function z(r={},e,t){return typeof e=="string"&&(e=e.split(".")),e.reduce((n,o)=>n&&n[o]?n[o]:t,r)}function x(r){return(...e)=>e.filter(Boolean).join(r)}const D=x(".");function F(r){return c?window?.REFERENCE_DOCS_OPTIONS?.[r]:null}function _(){if(!c)return"";const r=+new Date+Math.random();try{return(!document.currentScript||!(document.currentScript.async||document.currentScript.defer))&&document.write(`<script id="dummy${r}"></script>`),(document.getElementById("dummy"+r)?.previousSibling).src}catch{return""}}const B=r=>a(r)?r:r?.raw,H=(r,e)=>{const t=r?.[`x-parsed-md-${e}`]||r?.[e];if(!t)return;if(!r?.[`x-parsed-md-${e}`]&&e!=="x-enumDescriptions")return r?.[e];if(e!=="x-enumDescriptions")return m(r,e);let n={};for(const o in t)o.startsWith("x-parsed-md")||(n[o]=t?.[`x-parsed-md-${o}`]||t?.[o]);return Object.keys(n).length?n:t};function U(r){return r.name||r.description}function m(r,e){const t=r?.[`x-parsed-md-${e}`]||r?.[e];return t?.raw?t:{result:t?.result||r?.[e]?.result||r?.[e],raw:r?.[e]}}function V(r,e){return e===r.length-1}function v(r,e){const t=Object.keys(r);return t.indexOf(e)===t.length-1}export{E as appendToMdHeading,W as deleteEmptyArrayItem,D as dottedString,M as escapeHTMLAttrChars,A as flattenByProp,z as get,_ as getJsUrl,U as getServerDisplayName,H as getValueFromMdParsedExtension,F as getWindowReferenceOptions,d as isAbsoluteUrl,R as isArrayOfObjects,V as isLastInArray,v as isLastProperty,C as isMergeableObject,b as isNumeric,x as joinStringFactory,y as mapValues,O as mapWithLast,B as normalizeText,L as removeQueryStringAndHash,I as resolveUrl,T as sanitizeItemId,p as stripTrailingSlash,N as titleize,P as unescapeHTMLChars,j as useSchemaTitle};
@@ -1 +1 @@
1
- import{bundle as a,loadConfig as r}from"@redocly/openapi-core";import{combineUrls as s}from"@redocly/theme/core/openapi";import{convertSwagger2OpenAPI as c}from"./convertSwagger2OpenAPI.js";import{IS_BROWSER as t}from"./dom.js";import{REDOCLY_CONFIG_FILE as f}from"../constants.js";async function w(){const o=t?window.location.origin:typeof globalThis.process<"u"?globalThis.process.cwd():"";try{return(await r({configPath:s(o,f)}))?.resolvedConfig.openapi||{}}catch(n){return console.warn("Error loading redocly.yaml",n),{}}}async function b(o){const n=await r(),e={config:n,base:t?window.location.origin:typeof globalThis.process<"u"?globalThis.process.cwd():""};t&&(n.resolve.http.customFetch=globalThis.fetch),typeof o=="object"&&o!==null?e.doc=l(o):e.ref=o;const{bundle:{parsed:i}}=await a(e);return i.swagger!==void 0?c(i):i}function l(o){return{source:{absoluteRef:""},parsed:o}}export{b as loadAndBundleDefinition,w as loadOpenapiConfig};
1
+ import{bundle as a,loadConfig as r}from"@redocly/openapi-core";import{combineUrls as s}from"@redocly/theme/core/openapi";import{convertSwagger2OpenAPI as c}from"./convertSwagger2OpenAPI.js";import{IS_BROWSER as t}from"./dom.js";import{REDOCLY_CONFIG_FILE as f}from"../constants.js";async function w(){const o=t?window.location.origin:typeof globalThis.process<"u"?globalThis.process.cwd():"";try{return(await r({configPath:s(o,f)}))?.resolvedConfig.openapi||{}}catch{return{}}}async function b(o){const n=await r(),e={config:n,base:t?window.location.origin:typeof globalThis.process<"u"?globalThis.process.cwd():""};t&&(n.resolve.http.customFetch=globalThis.fetch),typeof o=="object"&&o!==null?e.doc=d(o):e.ref=o;const{bundle:{parsed:i}}=await a(e);return i.swagger!==void 0?c(i):i}function d(o){return{source:{absoluteRef:""},parsed:o}}export{b as loadAndBundleDefinition,w as loadOpenapiConfig};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.14.0-next.13",
3
+ "version": "3.14.0-next.14",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -37,7 +37,7 @@
37
37
  "util": "~0.12.5",
38
38
  "web-vitals": "3.3.1",
39
39
  "@redocly/config": "0.35.0",
40
- "@redocly/replay": "0.17.0-next.12"
40
+ "@redocly/replay": "0.17.0-next.13"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "29.5.0",
@@ -75,7 +75,7 @@
75
75
  "typescript": "5.6.2",
76
76
  "url": "~0.11.0",
77
77
  "vite": "6.3.6",
78
- "@redocly/theme": "0.58.0-next.9"
78
+ "@redocly/theme": "0.58.0-next.10"
79
79
  },
80
80
  "scripts": {
81
81
  "start": "npm run copy-highlight-hook && vite",