@redocly/openapi-docs 3.11.0 → 3.12.0-next.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.
@@ -1,13 +1,11 @@
1
1
  import type { PropsWithChildren } from 'react';
2
2
  import type { OpenAPISecurityScheme } from '../../types/index.js';
3
3
  import type { SecurityRequirement } from '../../models/index.js';
4
- export interface OAuthOptionalScopesProps {
5
- flow: OpenAPISecurityScheme['flows'][keyof OpenAPISecurityScheme['flows']];
6
- }
7
- export interface OAuthRequiredScopesProps {
4
+ type Flow = OpenAPISecurityScheme['flows'];
5
+ interface OAuthScopesMainProps {
8
6
  id: string;
9
7
  securities: SecurityRequirement[];
10
- flow: OpenAPISecurityScheme['flows'][keyof OpenAPISecurityScheme['flows']];
8
+ flows?: Flow;
11
9
  }
12
- export declare const OAuthOptionalScopes: import("react").NamedExoticComponent<PropsWithChildren<OAuthOptionalScopesProps>>;
13
- export declare const OAuthRequiredScopes: import("react").NamedExoticComponent<PropsWithChildren<OAuthRequiredScopesProps>>;
10
+ export declare const OAuthScopes: import("react").NamedExoticComponent<PropsWithChildren<OAuthScopesMainProps>>;
11
+ export {};
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as c,Fragment as d}from"react/jsx-runtime";import{memo as m,useState as f}from"react";import{ChevronRightIcon as v}from"@redocly/theme";import{Markdown as g}from"../Markdown/index.js";import{SecuritySchemeItem as i}from"./SecuritySchemeItem.js";import{Tag as S}from"./styled.js";import{useTranslate as u}from"../../hooks/index.js";import{getRequiredScopes as x}from"./helper.js";import{styled as s}from"../../styled-components.js";function b({flow:o}){const a=Object.keys(o?.scopes||{}),p=u(),[t,l]=f(!1);return a.length?c(d,{children:[e(i,{label:c(O,{onClick:()=>{l(r=>!r)},children:[p(t?"openapi.hideOptionalScopes":"openapi.showOptionalScopes",t?"Hide optional scopes":"Show optional scopes"),e(q,{isOpen:t,children:e(v,{size:"var(--font-size-base)",color:"var(--tree-content-color-default)"})})]}),value:" "}),e(j,{isOpen:t,children:a.map(r=>e(i,{label:e(h,{className:"tag-grey",children:r}),value:e(g,{source:o?.scopes[r]||""})},r))})]}):null}function y({id:o,securities:a,flow:p}){const t=x(o,a),l=u();return t.length?c(d,{children:[e(i,{label:l("openapi.requiredScopes","Required scopes"),value:" "}),e(w,{children:t.map(n=>e(i,{label:e(h,{className:"tag-grey",children:n}),value:e(g,{source:p?.scopes[n]||""})},n))})]}):null}const h=s(S)`
1
+ import{jsx as r,Fragment as p,jsxs as c}from"react/jsx-runtime";import{memo as S,useState as v}from"react";import{ChevronRightIcon as b}from"@redocly/theme";import{Markdown as d}from"../Markdown/index.js";import{SecuritySchemeItem as a}from"./SecuritySchemeItem.js";import{Tag as m}from"./styled.js";import{useTranslate as l}from"../../hooks/index.js";import{getOptionalScopes as O,getRequiredScopes as x}from"./helper.js";import{styled as i}from"../../styled-components.js";function y({id:e,securities:t,flows:n}){const o=x(e,t);return c(p,{children:[r(w,{flows:n,requiredScopes:o}),r(q,{flows:n,requiredScopes:o})]})}function q({flows:e,requiredScopes:t}){return e&&Object.keys(e).map(n=>r(j,{flow:e[n],requiredScopes:t},n))}function j({flow:e,requiredScopes:t}){const n=l(),[o,h]=v(!1),f=Object.keys(e?.scopes||{}),u=O(t,f);return u.length===0?null:c(p,{children:[r(a,{label:c(A,{onClick:()=>{h(s=>!s)},children:[n(o?"openapi.hideOptionalScopes":"openapi.showOptionalScopes",o?"Hide optional scopes":"Show optional scopes"),r(C,{isOpen:o,children:r(b,{size:"var(--font-size-base)",color:"var(--tree-content-color-default)"})})]}),value:" "}),r(z,{isOpen:o,children:u.map(s=>r(a,{label:r(g,{className:"tag-grey",children:s}),value:r(d,{source:e?.scopes[s]||""})},s))})]})}function w({requiredScopes:e,flows:t}){const n=l();return e.length===0?null:t&&Object.keys(t).length>0?Object.keys(t).map(o=>r(k,{flow:t[o],requiredScopes:e},o)):r(a,{label:n("openapi.requiredScopes","Required scopes"),value:r(R,{children:e.map(o=>r(m,{className:"tag-grey",children:o},o))})})}function k({flow:e,requiredScopes:t}){const n=l();return c(p,{children:[r(a,{label:n("openapi.requiredScopes","Required scopes"),value:" "}),t.map(o=>r(a,{label:r(g,{className:"tag-grey",children:o}),value:r(d,{source:e?.scopes[o]||""})},o))]})}const g=i(m)`
2
2
  font-family: var(--font-family-base);
3
3
  font-size: var(--font-size-base);
4
4
  line-height: var(--line-height-base);
@@ -6,28 +6,28 @@ import{jsx as e,jsxs as c,Fragment as d}from"react/jsx-runtime";import{memo as m
6
6
  padding: 0 var(--spacing-xs);
7
7
  border: var(--tag-border-width) var(--tag-border-style) var(--tag-bg-color);
8
8
  border-radius: var(--tag-border-radius);
9
- `,O=s.div`
9
+ `,A=i.div`
10
10
  cursor: pointer;
11
11
  display: flex;
12
12
  gap: var(--spacing-xxs);
13
13
  align-items: center;
14
14
  user-select: none;
15
- `,w=s.div`
15
+ `,R=i.div`
16
16
  display: flex;
17
17
  flex-wrap: wrap;
18
18
  gap: var(--spacing-xxs);
19
19
  word-break: normal;
20
- `,j=s.div`
21
- max-height: ${o=>o.isOpen?"1000px":"0"};
22
- opacity: ${o=>o.isOpen?"1":"0"};
20
+ `,z=i.div`
21
+ max-height: ${e=>e.isOpen?"1000px":"0"};
22
+ opacity: ${e=>e.isOpen?"1":"0"};
23
23
  overflow: hidden;
24
24
  transition:
25
25
  max-height 0.5s ease-in-out,
26
26
  opacity 0.5s ease-in-out;
27
- `,q=s.span`
27
+ `,C=i.span`
28
28
  display: inline-flex;
29
29
  align-items: center;
30
30
  justify-content: center;
31
- transform: ${o=>o.isOpen?"rotate(90deg)":"rotate(0deg)"};
31
+ transform: ${e=>e.isOpen?"rotate(90deg)":"rotate(0deg)"};
32
32
  transition: transform 0.5s ease-in-out;
33
- `,F=m(b),H=m(y);export{F as OAuthOptionalScopes,H as OAuthRequiredScopes};
33
+ `,B=S(y);export{B as OAuthScopes};
@@ -1,16 +1,16 @@
1
- import{jsx as e,Fragment as s,jsxs as n}from"react/jsx-runtime";import{SecuritySchemeItem as t}from"./SecuritySchemeItem.js";import{titleize as S}from"../../utils/index.js";import{OAuthFlow as x}from"./OAuthFlow.js";import{StyledLink as j}from"./styled.js";import{Markdown as k}from"../Markdown/index.js";import{useTranslate as y}from"../../hooks/index.js";import{OAuthRequiredScopes as F,OAuthOptionalScopes as O}from"./OAuthScopes.js";import{styled as m}from"../../styled-components.js";function M({type:i,bearerFormat:l,name:d,flows:r,openIdConnectUrl:p,description:u,id:c,securities:h,in:b}){const o=y();if(!i||!c)return null;const v={http:n(s,{children:[e(t,{label:o("openapi.httpAuthorizationScheme","HTTP Authorization Scheme"),value:i}),e(t,{label:o("openapi.bearerFormat","Bearer Format"),value:l})]}),apiKey:e(t,{label:`${S(b||"")} ${o("openapi.parameterName","parameter name")}:`,value:d}),oauth2:n(s,{children:[e(t,{label:o("openapi.flowType","Flow type"),value:i}),r&&Object.keys(r).map(a=>e(x,{flow:r[a]},a))]}),openIdConnect:e(t,{label:o("openapi.connectUrl","Connect URL"),value:p&&e(j,{target:"_blank",rel:"noopener noreferrer",href:p,children:p})})},f=r&&Object.keys(r).map(a=>e(F,{id:c,securities:h,flow:r[a]},a)),g=r&&Object.keys(r).map(a=>e(O,{flow:r[a]},a));return n(z,{children:[e(A,{children:c}),e(k,{source:u}),n(T,{children:[v[i]||null,f,g]})]})}const z=m.div`
1
+ import{jsx as r,Fragment as p,jsxs as i}from"react/jsx-runtime";import{SecuritySchemeItem as a}from"./SecuritySchemeItem.js";import{titleize as v}from"../../utils/index.js";import{OAuthFlow as g}from"./OAuthFlow.js";import{StyledLink as w}from"./styled.js";import{Markdown as x}from"../Markdown/index.js";import{useTranslate as S}from"../../hooks/index.js";import{OAuthScopes as y}from"./OAuthScopes.js";import{styled as m}from"../../styled-components.js";function K({type:o,bearerFormat:c,name:d,flows:t,openIdConnectUrl:n,description:h,id:l,securities:u,in:f}){const e=S();if(!o||!l)return null;const b={http:i(p,{children:[r(a,{label:e("openapi.httpAuthorizationScheme","HTTP Authorization Scheme"),value:o}),r(a,{label:e("openapi.bearerFormat","Bearer Format"),value:c})]}),apiKey:r(a,{label:`${v(f||"")} ${e("openapi.parameterName","parameter name")}:`,value:d}),oauth2:i(p,{children:[r(a,{label:e("openapi.flowType","Flow type"),value:o}),t&&Object.keys(t).map(s=>r(g,{flow:t[s]},s))]}),openIdConnect:r(a,{label:e("openapi.connectUrl","Connect URL"),value:n&&r(w,{target:"_blank",rel:"noopener noreferrer",href:n,children:n})})};return i(F,{children:[r(T,{children:l}),r(x,{source:h}),i(z,{children:[b[o]||null,r(y,{id:l,securities:u,flows:t})]})]})}const F=m.div`
2
2
  background: var(--layer-color);
3
3
  padding: var(--spacing-base);
4
4
  border-radius: var(--border-radius);
5
5
  border: 1px solid var(--border-color-secondary);
6
6
  width: 100%;
7
7
  margin-top: var(--spacing-base);
8
- `,T=m.div`
8
+ `,z=m.div`
9
9
  width: 100%;
10
10
  margin-top: var(--spacing-md);
11
- `,A=m.p`
11
+ `,T=m.p`
12
12
  font-size: var(--font-size-base);
13
13
  margin: 0 0 var(--spacing-xs);
14
14
  text-transform: capitalize;
15
15
  font-weight: var(--font-weight-semibold);
16
- `;export{M as SecurityFlow};
16
+ `;export{K as SecurityFlow};
@@ -1,2 +1,3 @@
1
1
  import type { SecurityRequirement } from '../../models/index.js';
2
2
  export declare function getRequiredScopes(id: string, securities: SecurityRequirement[]): string[];
3
+ export declare function getOptionalScopes(requiredScopes: string[], allScopes: string[]): string[];
@@ -1 +1 @@
1
- function n(e,o){const r=new Set;return o.forEach(({schemes:c})=>{c.forEach(({id:a,scopes:f})=>{a===e&&f.forEach(t=>r.add(t))})}),Array.from(r)}export{n as getRequiredScopes};
1
+ function f(r,o){const e=new Set;return o.forEach(({schemes:t})=>{t.forEach(({id:c,scopes:n})=>{c===r&&n.forEach(a=>e.add(a))})}),Array.from(e)}function i(r,o){const e=new Set(r);return o.filter(t=>!e.has(t))}export{i as getOptionalScopes,f as getRequiredScopes};
@@ -3,7 +3,7 @@ export { SecurityButton } from './SecurityButton.js';
3
3
  export { SecurityFlow } from './SecurityFlow.js';
4
4
  export { SecuritySchemeItem } from './SecuritySchemeItem.js';
5
5
  export { OAuthFlow } from './OAuthFlow.js';
6
- export { OAuthOptionalScopes, OAuthRequiredScopes } from './OAuthScopes.js';
6
+ export { OAuthScopes } from './OAuthScopes.js';
7
7
  export { SecurityModal } from './SecurityModal.js';
8
8
  export { Divider } from './Divider.js';
9
9
  export * from './helper.js';
@@ -1 +1 @@
1
- import{Security as e}from"./Security.js";import{SecurityButton as p}from"./SecurityButton.js";import{SecurityFlow as f}from"./SecurityFlow.js";import{SecuritySchemeItem as x}from"./SecuritySchemeItem.js";import{OAuthFlow as c}from"./OAuthFlow.js";import{OAuthOptionalScopes as y,OAuthRequiredScopes as h}from"./OAuthScopes.js";import{SecurityModal as O}from"./SecurityModal.js";import{Divider as A}from"./Divider.js";export*from"./helper.js";export*from"./styled.js";export{A as Divider,c as OAuthFlow,y as OAuthOptionalScopes,h as OAuthRequiredScopes,e as Security,p as SecurityButton,f as SecurityFlow,O as SecurityModal,x as SecuritySchemeItem};
1
+ import{Security as e}from"./Security.js";import{SecurityButton as m}from"./SecurityButton.js";import{SecurityFlow as f}from"./SecurityFlow.js";import{SecuritySchemeItem as u}from"./SecuritySchemeItem.js";import{OAuthFlow as i}from"./OAuthFlow.js";import{OAuthScopes as y}from"./OAuthScopes.js";import{SecurityModal as l}from"./SecurityModal.js";import{Divider as w}from"./Divider.js";export*from"./helper.js";export*from"./styled.js";export{w as Divider,i as OAuthFlow,y as OAuthScopes,e as Security,m as SecurityButton,f as SecurityFlow,l as SecurityModal,u as SecuritySchemeItem};
@@ -1,4 +1,3 @@
1
1
  export declare const Select: any;
2
2
  export declare const SimpleSelect: any;
3
- export declare const CollapsingSelect: any;
4
3
  export declare const Arrow: any;
@@ -1,4 +1,4 @@
1
- import{css as t}from"styled-components";import{ChevronDownIcon as a}from"@redocly/theme";import{Select as i}from"./Select.js";import{styled as r}from"../../../styled-components.js";const e=t`
1
+ import{css as n}from"styled-components";import{ChevronDownIcon as t}from"@redocly/theme";import{Select as i}from"./Select.js";import{styled as e}from"../../../styled-components.js";const r=n`
2
2
  background-color: var(--panel-samples-dropdown-bg-color);
3
3
  border: var(--panel-samples-dropdown-border);
4
4
  color: var(--panel-samples-dropdown-color);
@@ -8,7 +8,7 @@ import{css as t}from"styled-components";import{ChevronDownIcon as a}from"@redocl
8
8
  &:focus-within {
9
9
  box-shadow: none;
10
10
  }
11
- `,n=r(i)`
11
+ `,a=e(i)`
12
12
  box-sizing: border-box;
13
13
  outline: none;
14
14
  display: inline-block;
@@ -43,7 +43,7 @@ import{css as t}from"styled-components";import{ChevronDownIcon as a}from"@redocl
43
43
  box-shadow: none;
44
44
  }
45
45
 
46
- ${({variant:o})=>o==="dark"?e:""};
46
+ ${({variant:o})=>o==="dark"?r:""};
47
47
  }
48
48
 
49
49
  .dropdown-select {
@@ -62,9 +62,9 @@ import{css as t}from"styled-components";import{ChevronDownIcon as a}from"@redocl
62
62
  font-size: var(--font-size-base);
63
63
  font-family: inherit;
64
64
  padding: var(--docs-dropdown-padding);
65
- ${({variant:o})=>o==="dark"?e:""};
65
+ ${({variant:o})=>o==="dark"?r:""};
66
66
  }
67
- `,c=r(n)`
67
+ `,c=e(a)`
68
68
  svg {
69
69
  top: 60%;
70
70
  transform: translateY(-60%);
@@ -82,29 +82,8 @@ import{css as t}from"styled-components";import{ChevronDownIcon as a}from"@redocl
82
82
  box-shadow: none;
83
83
  }
84
84
  }
85
- `,b=r(n)`
86
- svg {
87
- top: 60%;
88
- transform: translateY(-60%);
89
- }
90
- label {
91
- ${e};
92
-
93
- border-radius: var(--border-radius-lg);
94
- margin-left: 5px;
95
- transition: none;
96
- min-width: auto;
97
- background-color: ${({active:o})=>o?"var(--panel-samples-tabs-bg-color-active)":"var(--bg-color-raised)"};
98
- & {
99
- &[open],
100
- &:focus-within,
101
- &:hover {
102
- background-color: var(--bg-color-tonal);
103
- }
104
- }
105
- }
106
- `,h=r(a)`
85
+ `,h=e(t)`
107
86
  position: absolute;
108
87
  right: 10px;
109
88
  top: 10px;
110
- `;export{h as Arrow,b as CollapsingSelect,n as Select,c as SimpleSelect};
89
+ `;export{h as Arrow,a as Select,c as SimpleSelect};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.11.0",
3
+ "version": "3.12.0-next.0",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -14,7 +14,7 @@
14
14
  "npm": ">=10.0.0"
15
15
  },
16
16
  "peerDependencies": {
17
- "@redocly/theme": ">=0.55.0-next.0",
17
+ "@redocly/theme": ">=0.56.0-next.0",
18
18
  "react": "^19.1.0",
19
19
  "react-dom": "^19.1.0",
20
20
  "styled-components": "^4.1.1 || ^5.3.11 || ^6.0.0"
@@ -36,8 +36,8 @@
36
36
  "url-template": "^2.0.8",
37
37
  "util": "~0.12.5",
38
38
  "web-vitals": "3.3.1",
39
- "@redocly/replay": "0.14.0",
40
- "@redocly/config": "0.26.2"
39
+ "@redocly/config": "0.26.2",
40
+ "@redocly/replay": "0.15.0-next.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "29.5.0",
@@ -74,7 +74,7 @@
74
74
  "typescript": "5.6.2",
75
75
  "url": "~0.11.0",
76
76
  "vite": "^6.3.5",
77
- "@redocly/theme": "0.55.0"
77
+ "@redocly/theme": "0.56.0-next.0"
78
78
  },
79
79
  "scripts": {
80
80
  "start": "npm run copy-highlight-hook && vite",