fix gallery carousel height, fix spotlight up/down arrow

Beta
This commit is contained in:
Weixuan Fu
2024-03-28 22:37:25 +08:00
committed by GitHub
18 changed files with 47 additions and 43 deletions
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{r as l,j as S}from"./input.js";import{app as s}from"/scripts/app.js";import{a7 as C,j as D,aq as j,n as W,T as _,ar as x,E as w,as as I,C as r,p as d,at as L}from"./App---qNWxTB.js";import{u as R}from"./useDebounceFn-ld478fd0.js";import"/scripts/api.js";function F(){const{isDirty:h,setIsDirty:k,setRoute:g,saveCurWorkflow:y}=l.useContext(C),p=l.useRef(h),[m,E]=l.useState(!1);D();const v=l.useRef(null);l.useEffect(()=>{p.current=h},[h]),l.useEffect(()=>{var i,c;const n=t=>{var u;if(document.visibilityState==="hidden")return;const e=I(t);if(e)switch(t.preventDefault(),window.dispatchEvent(new CustomEvent(x,{detail:{shortcutType:e}})),e){case w.SAVE:y();break;case w.SAVE_AS:g("saveAsModal");break;case w.openSpotlightSearch:g("spotlightSearch");break}else(u=t.target)!=null&&u.matches("input, textarea")&&Object.keys(s.canvas.selected_nodes??{}).length&&f()},a=s.canvas.onAfterChange;s.graph.onAfterChange=function(){a==null||a.apply(this,arguments),f()};const o=s.graph.onConfigure;return s.graph.onConfigure=function(){o==null||o.apply(this,arguments),setTimeout(()=>{var e,u;j(s.graph.serialize(),JSON.parse(((u=(e=r)==null?void 0:e.curWorkflow)==null?void 0:u.json)??"{}"))||f()},1e3)},document.addEventListener("click",t=>{Object.keys(s.canvas.selected_nodes??{}).length&&(s.canvas.node_over!=null||s.canvas.node_capturing_input!=null||s.canvas.node_widget!=null)&&f()}),document.addEventListener("keydown",n),(c=(i=d)==null?void 0:i.settings)!=null&&c.autoSave&&d.settings.autoSaveDuration&&(v.current=setInterval(()=>{T()},d.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",n),v.current&&clearInterval(v.current)}},[]);const T=async()=>{var a,o,i,c,t,e;if((o=(a=r)==null?void 0:a.curWorkflow)!=null&&o.saveLock||!((c=(i=r)==null?void 0:i.curWorkflow)!=null&&c.id)||!p.current)return;const n=JSON.stringify(s.graph.serialize());await((t=r)==null?void 0:t.updateFlow(r.curWorkflow.id,{json:n})),(e=L)==null||e.create({workflowID:r.curWorkflow.id,isAutoSave:!0,json:n}),k(!1)},b=async()=>{var n,a,o,i,c,t,e;(a=(n=r)==null?void 0:n.curWorkflow)!=null&&a.saveLock||p.current||(k(!0),(i=(o=d)==null?void 0:o.settings)!=null&&i.autoSave&&((t=(c=r)==null?void 0:c.curWorkflow)!=null&&t.id)&&!m&&(await((e=r)==null?void 0:e.latestVersionCheck())||E(!0)))},[f,A]=R(b,900);return m?S.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:S.jsx(_,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{F as default};
import{r as l,j as S}from"./input.js";import{app as s}from"/scripts/app.js";import{a7 as C,j as D,aq as j,n as W,T as _,ar as x,E as w,as as I,C as r,p as d,at as L}from"./App-qTGbKed5.js";import{u as R}from"./useDebounceFn-ld478fd0.js";import"/scripts/api.js";function F(){const{isDirty:h,setIsDirty:k,setRoute:g,saveCurWorkflow:y}=l.useContext(C),p=l.useRef(h),[m,E]=l.useState(!1);D();const v=l.useRef(null);l.useEffect(()=>{p.current=h},[h]),l.useEffect(()=>{var i,c;const n=t=>{var u;if(document.visibilityState==="hidden")return;const e=I(t);if(e)switch(t.preventDefault(),window.dispatchEvent(new CustomEvent(x,{detail:{shortcutType:e}})),e){case w.SAVE:y();break;case w.SAVE_AS:g("saveAsModal");break;case w.openSpotlightSearch:g("spotlightSearch");break}else(u=t.target)!=null&&u.matches("input, textarea")&&Object.keys(s.canvas.selected_nodes??{}).length&&f()},a=s.canvas.onAfterChange;s.graph.onAfterChange=function(){a==null||a.apply(this,arguments),f()};const o=s.graph.onConfigure;return s.graph.onConfigure=function(){o==null||o.apply(this,arguments),setTimeout(()=>{var e,u;j(s.graph.serialize(),JSON.parse(((u=(e=r)==null?void 0:e.curWorkflow)==null?void 0:u.json)??"{}"))||f()},1e3)},document.addEventListener("click",t=>{Object.keys(s.canvas.selected_nodes??{}).length&&(s.canvas.node_over!=null||s.canvas.node_capturing_input!=null||s.canvas.node_widget!=null)&&f()}),document.addEventListener("keydown",n),(c=(i=d)==null?void 0:i.settings)!=null&&c.autoSave&&d.settings.autoSaveDuration&&(v.current=setInterval(()=>{T()},d.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",n),v.current&&clearInterval(v.current)}},[]);const T=async()=>{var a,o,i,c,t,e;if((o=(a=r)==null?void 0:a.curWorkflow)!=null&&o.saveLock||!((c=(i=r)==null?void 0:i.curWorkflow)!=null&&c.id)||!p.current)return;const n=JSON.stringify(s.graph.serialize());await((t=r)==null?void 0:t.updateFlow(r.curWorkflow.id,{json:n})),(e=L)==null||e.create({workflowID:r.curWorkflow.id,isAutoSave:!0,json:n}),k(!1)},b=async()=>{var n,a,o,i,c,t,e;(a=(n=r)==null?void 0:n.curWorkflow)!=null&&a.saveLock||p.current||(k(!0),(i=(o=d)==null?void 0:o.settings)!=null&&i.autoSave&&((t=(c=r)==null?void 0:c.curWorkflow)!=null&&t.id)&&!m&&(await((e=r)==null?void 0:e.latestVersionCheck())||E(!0)))},[f,A]=R(b,900);return m?S.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:S.jsx(_,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{F as default};
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{h as a}from"./App---qNWxTB.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I};
import{h as a}from"./App-qTGbKed5.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I};
@@ -1 +1 @@
import{h as a}from"./App---qNWxTB.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I};
import{h as a}from"./App-qTGbKed5.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{f as x,j as l,g as i,h as b,l as C,o as E,n as I,r as f,ae as P}from"./input.js";import{a0 as z}from"./App---qNWxTB.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S};
import{f as x,j as l,g as i,h as b,l as C,o as E,n as I,r as f,ae as P}from"./input.js";import{a0 as z}from"./App-qTGbKed5.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S};
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{k as t}from"./App---qNWxTB.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V};
import{k as t}from"./App-qTGbKed5.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V};
+2 -2
View File
@@ -679,10 +679,10 @@ Error generating stack: `+i.message+`
}
${fB}
`}),Lw=document.createElement("div");document.body.append(Lw);const pB=Ar.lazy(()=>Jk(()=>import("./App---qNWxTB.js").then(e=>e.aU),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),mB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},vB=Mz({zIndices:mB});bd.createRoot(Lw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(HD,{resetCSS:!1,disableGlobalStyle:!0,theme:vB,children:[E.jsx(hB,{scope:".workspace_manager"}),E.jsx(NP,{initialColorMode:"dark"}),E.jsx(dB,{children:E.jsx(S.Suspense,{children:E.jsx(pB,{})})})]})}));const Yf=document.body,gB={attributes:!0,attributeFilter:["class"]},yB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Yf.classList)o.includes("chakra")&&Yf.classList.remove(o)},bB=new MutationObserver(yB);bB.observe(Yf,gB);export{$B as $,IB as A,zB as B,DB as C,FB as D,zP as E,lr as F,ii as G,CB as H,Xa as I,Dp as J,PB as K,Ya as L,ww as M,Mw as N,$w as O,Na as P,Rw as Q,Fw as R,zw as S,Aw as T,zp as U,Pb as V,LB as W,is as X,Ar as Y,wB as Z,Jk as _,MB as a,Iu as a0,vL as a1,rL as a2,mL as a3,Wf as a4,Ra as a5,wP as a6,SB as a7,Hn as a8,Uh as a9,xP as aa,xB as ab,lB as ac,uB as ad,_B as ae,mn as b,RB as c,d3 as d,ka as e,pt as f,_e as g,Be as h,Dx as i,E as j,EB as k,eS as l,Bf as m,Rv as n,Ou as o,Nu as p,kB as q,S as r,$i as s,Xf as t,VP as u,hw as v,TB as w,Kt as x,Cg as y,mO as z};
`}),Lw=document.createElement("div");document.body.append(Lw);const pB=Ar.lazy(()=>Jk(()=>import("./App-qTGbKed5.js").then(e=>e.aT),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),mB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},vB=Mz({zIndices:mB});bd.createRoot(Lw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(HD,{resetCSS:!1,disableGlobalStyle:!0,theme:vB,children:[E.jsx(hB,{scope:".workspace_manager"}),E.jsx(NP,{initialColorMode:"dark"}),E.jsx(dB,{children:E.jsx(S.Suspense,{children:E.jsx(pB,{})})})]})}));const Yf=document.body,gB={attributes:!0,attributeFilter:["class"]},yB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Yf.classList)o.includes("chakra")&&Yf.classList.remove(o)},bB=new MutationObserver(yB);bB.observe(Yf,gB);export{$B as $,IB as A,zB as B,DB as C,FB as D,zP as E,lr as F,ii as G,CB as H,Xa as I,Dp as J,PB as K,Ya as L,ww as M,Mw as N,$w as O,Na as P,Rw as Q,Fw as R,zw as S,Aw as T,zp as U,Pb as V,LB as W,is as X,Ar as Y,wB as Z,Jk as _,MB as a,Iu as a0,vL as a1,rL as a2,mL as a3,Wf as a4,Ra as a5,wP as a6,SB as a7,Hn as a8,Uh as a9,xP as aa,xB as ab,lB as ac,uB as ad,_B as ae,mn as b,RB as c,d3 as d,ka as e,pt as f,_e as g,Be as h,Dx as i,E as j,EB as k,eS as l,Bf as m,Rv as n,Ou as o,Nu as p,kB as q,S as r,$i as s,Xf as t,VP as u,hw as v,TB as w,Kt as x,Cg as y,mO as z};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = ["workspace_web/App---qNWxTB.js","workspace_web/assets/App-JXePnJiV.css"]
__vite__mapDeps.viteFileDeps = ["workspace_web/App-qTGbKed5.js","workspace_web/assets/App-JXePnJiV.css"]
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
+13 -10
View File
@@ -194,7 +194,19 @@ export default function SpotlightSearch() {
};
const keydownListener = (event: KeyboardEvent) => {
keyRef.current.lastPressedKey = event.key.toUpperCase();
const key = event.key.toUpperCase();
keyRef.current.lastPressedKey = key;
switch (key) {
case "ARROWDOWN":
changeSelectIndex(1);
break;
case "ARROWUP":
changeSelectIndex(-1);
break;
case "ENTER":
onOpen(renderDataSourceRef.current[selectIndexRef.current]);
break;
}
};
const shortcutTrigger = (event: CustomEvent) => {
@@ -202,15 +214,6 @@ export default function SpotlightSearch() {
case EShortcutKeys.openSpotlightSearch:
changeSelectIndex(1);
break;
case EOtherKeys.ArrowDown:
changeSelectIndex(1);
break;
case EOtherKeys.ArrowUp:
changeSelectIndex(-1);
break;
case EOtherKeys.Enter:
onOpen(renderDataSourceRef.current[selectIndexRef.current]);
break;
}
};
@@ -21,17 +21,18 @@ export function GalleryCarouselImageViewer({ mediaList }: MetaDataInfoProps) {
flex={1}
gap={2}
>
<Carousel
media={mediaList.map((v) => ({
id: v.id,
imageUrl: `/workspace/view_media?filename=${v.localPath}`,
}))}
currentNum={mediaList?.findIndex((p) => p.id === curMedia?.id) ?? 0}
setMediaAct={(newMedia) =>
setCurMedia(mediaList?.find((v) => v.id === newMedia.id) ?? null)
}
/>
<div style={{ height: "56vh" }}>
<Carousel
media={mediaList.map((v) => ({
id: v.id,
imageUrl: `/workspace/view_media?filename=${v.localPath}`,
}))}
currentNum={mediaList?.findIndex((p) => p.id === curMedia?.id) ?? 0}
setMediaAct={(newMedia) =>
setCurMedia(mediaList?.find((v) => v.id === newMedia.id) ?? null)
}
/>
</div>
<Flex wrap={"wrap"}>
{mediaList?.map((media) => (
<Box