@redocly/marketing-pages 0.1.30 → 0.1.31
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/dist/pages/editor/components/Layout/EditorLayout.d.ts +1 -0
- package/dist/pages/editor/components/Layout/EditorLayout.js +2 -2
- package/dist/pages/editor/components/Page.js +3 -3
- package/dist/pages/editor/components/Toolbar.d.ts +2 -1
- package/dist/pages/editor/components/Toolbar.js +8 -8
- package/dist/pages/editor/hooks/useFileOperations.js +1 -1
- package/dist/pages/editor/utils/download.js +1 -1
- package/package.json +7 -6
|
@@ -17,6 +17,7 @@ interface EditorLayoutProps {
|
|
|
17
17
|
onDownloadYaml: () => void;
|
|
18
18
|
onDownloadJson: () => void;
|
|
19
19
|
onToggleFullPreview: () => void;
|
|
20
|
+
isDownloadDisabled: boolean;
|
|
20
21
|
}
|
|
21
22
|
declare const EditorLayout: React.ForwardRefExoticComponent<EditorLayoutProps & React.RefAttributes<any>>;
|
|
22
23
|
export default EditorLayout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"react";import t from"styled-components";import{Panel as n,PanelGroup as
|
|
1
|
+
import e from"react";import t from"styled-components";import{Panel as n,PanelGroup as S,PanelResizeHandle as k}from"react-resizable-panels";import w from"../EditorPanel";import{ProblemsPanel as R}from"../ProblemsPanel";import D from"../Toolbar";const i=e.forwardRef(({value:d,onChange:s,onValidationUpdate:c,hideWarnings:r,onHideWarningsChange:m,isFullPreview:p,gotoPosition:u,parsedErrors:f,onProblemClick:b,onFileLoad:P,onDownloadYaml:E,onDownloadJson:g,onToggleFullPreview:C,isDownloadDisabled:v},y)=>{const[l,a]=e.useState(!0),o=e.useRef(null),z=(x,h)=>{b(x,h),l&&o.current?.expand()};return e.createElement(F,{ref:y,defaultSize:50,minSize:20,collapsible:!0,collapsedSize:0},e.createElement(D,{onFileLoad:P,onDownloadYamlClick:E,onDownloadJsonClick:g,hideWarnings:r,onHideWarningsChange:m,onToggleFullPreview:C,isDownloadDisabled:v}),e.createElement(L,null,e.createElement(S,{direction:"vertical"},e.createElement(n,{defaultSize:95},e.createElement(w,{value:d,onChange:s,onValidationUpdate:c,hideWarnings:r,isFullPreview:p,gotoPosition:u})),e.createElement(k,{className:"resize-handle-horizontal",style:{display:l?"none":"block"}}),e.createElement(n,{ref:o,collapsible:!0,collapsedSize:5,defaultSize:5,minSize:20,onCollapse:a.bind(null,!0),onExpand:a.bind(null,!1)},e.createElement(R,{problems:f,onProblemClick:z,isCollapsed:l,onToggle:()=>{l?o.current?.expand():o.current?.collapse()}})))))});i.displayName="EditorLayout";var U=i;const F=t(n)`
|
|
2
2
|
flex: 2;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
@@ -12,4 +12,4 @@ import e from"react";import t from"styled-components";import{Panel as n,PanelGro
|
|
|
12
12
|
flex: 1;
|
|
13
13
|
min-height: 0;
|
|
14
14
|
display: flex;
|
|
15
|
-
`;export{
|
|
15
|
+
`;export{U as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"react";import m from"styled-components";import{useEditorState as
|
|
1
|
+
import e from"react";import m from"styled-components";import{useEditorState as T}from"../hooks/useEditorState";import{useOpenApiValidation as H}from"../hooks/useOpenApiValidation";import{useFileOperations as W}from"../hooks/useFileOperations";import{PanelGroup as G,PanelResizeHandle as J}from"react-resizable-panels";import Y from"./Layout/PreviewLayout";import I from"./Layout/EditorLayout";function N(){const[p,g]=e.useState(!1),[l,d]=e.useState(!1),r=e.useRef(null);e.useEffect(()=>g(!0),[]);const{value:o,setValue:c,validatedValue:v,setValidatedValue:u,setValidationErrors:t,setFileName:b,parsedErrors:w,hasStructErrors:h,hideWarnings:P,setHideWarnings:k}=T(),{definition:n,hasRenderedOnce:E,setHasRenderedOnce:C}=H({validatedValue:v,hasStructErrors:h}),f=e.useRef(null);e.useEffect(()=>{n&&(f.current=n)},[n]);const F=n||f.current,[y,z]=e.useState(null),a=W({setValue:c,setFileName:b,setHasRenderedOnce:C,setValidationErrors:t}),D=e.useCallback((i,s)=>{t(i),u(s)},[t,u]),x=e.useCallback((i,s)=>{z({line:i,column:s})},[]),R=e.useCallback(()=>a.handleDownloadYaml(o),[a,o]),V=e.useCallback(()=>a.handleDownloadJson(o),[a,o]),L=e.useCallback(()=>d(!0),[]),O=e.useCallback(()=>d(!1),[]);e.useEffect(()=>{r.current&&(l?r.current.collapse():r.current.expand())},[l]);const S=!o||!o.trim();return e.createElement(U,null,e.createElement(A,{direction:"horizontal"},e.createElement(I,{ref:r,value:o,onChange:c,onValidationUpdate:D,hideWarnings:P,onHideWarningsChange:k,isFullPreview:l,gotoPosition:y,parsedErrors:w,onProblemClick:x,onFileLoad:a.handleFileLoad,onDownloadYaml:R,onDownloadJson:V,onToggleFullPreview:L,isDownloadDisabled:S}),e.createElement(J,{className:"resize-handle",style:{display:l?"none":"block"}}),e.createElement(Y,{definition:F,rawValue:o,hasRenderedOnce:E,hasStructErrors:h,onTemplateClick:a.handleTemplateClick,onFileLoad:a.handleFileLoad,isClient:p,isFullPreview:l,onExitFullPreview:O})))}const U=m.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: calc(100vh - var(--navbar-height));
|
|
@@ -9,7 +9,7 @@ import e from"react";import m from"styled-components";import{useEditorState as S
|
|
|
9
9
|
[data-component-name='Layout/PageLayout']:has(&) + div + footer {
|
|
10
10
|
display: none;
|
|
11
11
|
}
|
|
12
|
-
`,
|
|
12
|
+
`,A=m(G)`
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-grow: 1;
|
|
15
15
|
height: 100%;
|
|
@@ -36,4 +36,4 @@ import e from"react";import m from"styled-components";import{useEditorState as S
|
|
|
36
36
|
.resize-handle-horizontal[data-resize-handle-state="hover"] {
|
|
37
37
|
background-color: var(--color-blue-4);
|
|
38
38
|
}
|
|
39
|
-
`;export{
|
|
39
|
+
`;export{N as default};
|
|
@@ -6,6 +6,7 @@ interface ToolbarProps {
|
|
|
6
6
|
hideWarnings: boolean;
|
|
7
7
|
onHideWarningsChange: (hide: boolean) => void;
|
|
8
8
|
onToggleFullPreview?: () => void;
|
|
9
|
+
isDownloadDisabled: boolean;
|
|
9
10
|
}
|
|
10
|
-
export default function Toolbar({ hideWarnings, onHideWarningsChange, onDownloadYamlClick, onDownloadJsonClick, onFileLoad, onToggleFullPreview }: ToolbarProps): React.JSX.Element;
|
|
11
|
+
export default function Toolbar({ hideWarnings, onHideWarningsChange, onDownloadYamlClick, onDownloadJsonClick, onFileLoad, onToggleFullPreview, isDownloadDisabled }: ToolbarProps): React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useRef as
|
|
1
|
+
import e,{useRef as z,useState as m}from"react";import n from"styled-components";import{Button as l}from"@redocly/theme/components/Button/Button";import{Tooltip as s}from"@redocly/theme/components/Tooltip/Tooltip";import{DownloadIcon as g}from"@redocly/theme/icons/DownloadIcon/DownloadIcon";import{ChevronDownIcon as R}from"@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon";import{ViewIcon as A}from"@redocly/theme/icons/ViewIcon/ViewIcon";function B({hideWarnings:v,onHideWarningsChange:y,onDownloadYamlClick:d,onDownloadJsonClick:E,onFileLoad:b,onToggleFullPreview:u,isDownloadDisabled:o}){const f=z(null),[h,i]=m(!1),[w,k]=m(!1);e.useEffect(()=>{k(!0)},[]);const r=!w||o,C=t=>{t.preventDefault(),t.stopPropagation(),f.current?.click()},I=t=>{t?.preventDefault(),t?.stopPropagation(),i(a=>!a)},D=t=>{if(r){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation(),d()},P=t=>{const a=t.target.files?.[0];if(!a)return;const c=new FileReader;c.onload=p=>{const M=p.target?.result;b(M,a.name)},c.onerror=p=>{console.error("Failed to read file!",p)},c.readAsText(a),t.target.value=""};return e.createElement(F,null,e.createElement(O,null,e.createElement("input",{type:"checkbox",checked:v,onChange:t=>y(t.target.checked),id:"hide-warnings"}),"Hide warnings"),e.createElement(T,null,u&&e.createElement(s,{tip:"Enter full preview mode",width:"fit-content"},e.createElement(l,{variant:"text",type:"button",to:void 0,onClick:u,"aria-label":"Enter full preview",icon:e.createElement(A,null)})),e.createElement(s,{tip:"Upload spec",width:"fit-content"},e.createElement(l,{variant:"text",type:"button",to:void 0,icon:e.createElement(g,{style:{transform:"rotate(180deg)"}}),onClick:C,"aria-label":"Upload spec"})),e.createElement(S,{type:"file",ref:f,onChange:P,accept:".yaml,.yml,.json"}),e.createElement(U,null,e.createElement("div",{style:{position:"relative"}},r&&e.createElement("div",{style:{position:"absolute",inset:0,zIndex:10,cursor:"not-allowed"}}),e.createElement(l,{variant:"text",type:"button",to:void 0,onClick:D,iconPosition:"left",icon:e.createElement(g,null),disabled:r,style:{opacity:r?.5:1,pointerEvents:r?"none":"auto"}},"Download")),e.createElement(s,{tip:"Download options",width:"fit-content"},e.createElement(l,{type:"button",to:void 0,icon:e.createElement(R,null),onClick:I,"aria-label":"Download options"})),h&&e.createElement(H,null,e.createElement(x,{onClick:t=>{o||(t.preventDefault(),t.stopPropagation(),d(),i(!1))},style:{opacity:o?.5:1,cursor:o?"not-allowed":"pointer"}},"Download YAML"),e.createElement(x,{onClick:t=>{o||(t.preventDefault(),t.stopPropagation(),E(),i(!1))},style:{opacity:o?.5:1,cursor:o?"not-allowed":"pointer"}},"Download JSON")))))}const F=n.div`
|
|
2
2
|
padding: 6px 12px;
|
|
3
3
|
border-bottom: 1px solid var(--border-color-primary);
|
|
4
4
|
display: flex;
|
|
@@ -6,25 +6,25 @@ import e,{useRef as k,useState as C}from"react";import t from"styled-components"
|
|
|
6
6
|
background-color: var(--bg-color);
|
|
7
7
|
color: var(--text-color-primary);
|
|
8
8
|
gap: 16px;
|
|
9
|
-
`,
|
|
9
|
+
`,O=n.label`
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
gap: 8px;
|
|
13
13
|
font-size: 0.875rem;
|
|
14
14
|
cursor: pointer;
|
|
15
|
-
`,
|
|
15
|
+
`,T=n.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
gap: 8px;
|
|
19
19
|
margin-left: auto; /* Push to far right */
|
|
20
|
-
`,
|
|
20
|
+
`,U=n.div`
|
|
21
21
|
position: relative;
|
|
22
22
|
display: inline-flex;
|
|
23
23
|
align-items: center;
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: row;
|
|
26
26
|
gap: calc(var(--spacing-xxs) / 2);
|
|
27
|
-
`,
|
|
27
|
+
`,H=n.ul`
|
|
28
28
|
position: absolute;
|
|
29
29
|
right: 0;
|
|
30
30
|
top: 100%;
|
|
@@ -38,13 +38,13 @@ import e,{useRef as k,useState as C}from"react";import t from"styled-components"
|
|
|
38
38
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
39
39
|
min-width: 140px;
|
|
40
40
|
z-index: 20;
|
|
41
|
-
`,
|
|
41
|
+
`,x=n.li`
|
|
42
42
|
padding: 6px 12px;
|
|
43
43
|
font-size: 0.875rem;
|
|
44
44
|
cursor: pointer;
|
|
45
45
|
&:hover {
|
|
46
46
|
background-color: var(--bg-color-active, #f5f5f5);
|
|
47
47
|
}
|
|
48
|
-
`,
|
|
48
|
+
`,S=n.input`
|
|
49
49
|
display: none;
|
|
50
|
-
`;export{
|
|
50
|
+
`;export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dump as
|
|
1
|
+
import{dump as w,load as s}from"js-yaml";import{downloadFile as c}from"../utils/download";import{defaultOpenapiTemplate as y}from"../templates/defaultOpenapiTemplate";import{useCallback as i}from"react";function N(d){const{setValue:t,setFileName:l,setHasRenderedOnce:r,setValidationErrors:e}=d,p=i((o,n)=>{t(o),l(n),r(!1),e([])},[t,l,r,e]),m=i(()=>{t(y),r(!1),e([])},[t,r,e]),f=i(o=>{if(!o||!o.trim())return;let n=o;try{if(o.trim().startsWith("{")){const a=JSON.parse(o);n=w(a)}else s(o),n=o}catch{try{s(o),n=o}catch(j){console.error("Invalid content for YAML download",j);return}}c(n,"openapi.yaml","application/x-yaml")},[]),h=i(o=>{if(!(!o||!o.trim()))try{const n=s(o);if(typeof n!="object"||n===null)throw new Error("Parsed content is not an object.");const a=JSON.stringify(n,null,2);c(a,"openapi.json","application/json")}catch(n){console.error("Invalid content for JSON download",n)}},[]);return{handleFileLoad:p,handleTemplateClick:m,handleDownloadYaml:f,handleDownloadJson:h}}export{N as useFileOperations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l=100,a=(t,n,c)=>{const d=new Blob([t],{type:c}),o=URL.createObjectURL(d),e=document.createElement("a");e.href=o,e.download=n,e.target="_blank",e.style.display="none",document.body.appendChild(e),e.click(),setTimeout(()=>{document.body.contains(e)&&document.body.removeChild(e),URL.revokeObjectURL(o)},100)};export{a as downloadFile};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/marketing-pages",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@monaco-editor/react": "^4.7.0",
|
|
27
27
|
"@rebilly/lead-source-tracker": "^2.18.13",
|
|
28
28
|
"@redocly/json-to-json-schema": "^0.0.1",
|
|
29
|
-
"@redocly/openapi-docs": "^3.14.1",
|
|
30
29
|
"@redocly/openapi-language-server": "^0.6.9",
|
|
31
30
|
"@uiw/react-codemirror": "^4.23.12",
|
|
32
31
|
"dayjs": "^1.11.13",
|
|
@@ -54,14 +53,16 @@
|
|
|
54
53
|
"vitest": "^3.1.3"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"react
|
|
59
|
-
"
|
|
56
|
+
"@redocly/openapi-docs": "^3.14.1",
|
|
57
|
+
"react": "^18.3.1",
|
|
58
|
+
"react-dom": "^18.3.1",
|
|
59
|
+
"styled-components": "^5.3.11"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@changesets/cli": "^2.29.5",
|
|
63
63
|
"@markdoc/markdoc": "0.5.1",
|
|
64
64
|
"@redocly/config": "^0.24.0",
|
|
65
|
+
"@redocly/openapi-docs": "^3.14.1",
|
|
65
66
|
"@redocly/theme": "^0.53.0",
|
|
66
67
|
"@shikijs/types": "3.4.0",
|
|
67
68
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"esbuild": "^0.25.4",
|
|
73
74
|
"react": "^18.3.1",
|
|
74
75
|
"react-dom": "^18.3.1",
|
|
75
|
-
"styled-components": "
|
|
76
|
+
"styled-components": "5.3.11",
|
|
76
77
|
"typescript": "^5.8.3"
|
|
77
78
|
},
|
|
78
79
|
"overrides": {
|