Square Library modal thumbs and add stage previous/next.
This commit is contained in:
@@ -413,6 +413,37 @@
|
|||||||
border-color: var(--amber);
|
border-color: var(--amber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stage-nav {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 4;
|
||||||
|
display: grid;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #000a;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 28px;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-nav:hover {
|
||||||
|
border-color: var(--amber);
|
||||||
|
color: var(--amber);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-nav-prev {
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-nav-next {
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.filmstrip {
|
.filmstrip {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,6 +218,21 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-if="family.length > 1"
|
||||||
|
type="button"
|
||||||
|
class="stage-nav stage-nav-prev"
|
||||||
|
aria-label="Previous"
|
||||||
|
@click.stop="stepFamily(-1)"
|
||||||
|
>‹</button>
|
||||||
|
<button
|
||||||
|
v-if="family.length > 1"
|
||||||
|
type="button"
|
||||||
|
class="stage-nav stage-nav-next"
|
||||||
|
aria-label="Next"
|
||||||
|
@click.stop="stepFamily(1)"
|
||||||
|
>›</button>
|
||||||
|
|
||||||
<template v-if="selected && isHidden(selected)">
|
<template v-if="selected && isHidden(selected)">
|
||||||
<p class="placeholder-still">{{ selected.kind==='track' ? 'Track loaded · preview hidden' : selected.role==='input' ? 'Still loaded · preview hidden' : 'Output hidden' }}</p>
|
<p class="placeholder-still">{{ selected.kind==='track' ? 'Track loaded · preview hidden' : selected.role==='input' ? 'Still loaded · preview hidden' : 'Output hidden' }}</p>
|
||||||
</template>
|
</template>
|
||||||
@@ -440,7 +455,7 @@ const studioQueue=ref<any[]>([])
|
|||||||
const liveMusic=ref<Record<string,any>>({})
|
const liveMusic=ref<Record<string,any>>({})
|
||||||
const negativeDraft=ref('')
|
const negativeDraft=ref('')
|
||||||
const libraryOpen=ref(false)
|
const libraryOpen=ref(false)
|
||||||
const previewForcedHidden=ref<Set<string>>(new Set())
|
const eyeOpen=ref(!xaigen)
|
||||||
const form=reactive<any>({mode:'generate',engine:'flux',enhancePrompt:readStoredEnhancePrompt(),turbo:readStoredTurbo(),imageStyles:{positive:[],negative:readStoredNegatives()},lockFace:true,lockOutfit:true,hideInput:xaigen,folderId:'',identityStillId:'',imageAId:'',imageBId:'',maskId:'',startClipId:'',endStillId:'',guides:[],photos:[],promptSections:sectionsFrom({}),settings:{aspect:'auto',fps:24,steps:24,cfg:4,seed:null,seedMode:'random',duration:5,turbo:true,loraStack:[]}})
|
const form=reactive<any>({mode:'generate',engine:'flux',enhancePrompt:readStoredEnhancePrompt(),turbo:readStoredTurbo(),imageStyles:{positive:[],negative:readStoredNegatives()},lockFace:true,lockOutfit:true,hideInput:xaigen,folderId:'',identityStillId:'',imageAId:'',imageBId:'',maskId:'',startClipId:'',endStillId:'',guides:[],photos:[],promptSections:sectionsFrom({}),settings:{aspect:'auto',fps:24,steps:24,cfg:4,seed:null,seedMode:'random',duration:5,turbo:true,loraStack:[]}})
|
||||||
const promptArea=ref<HTMLTextAreaElement|null>(null)
|
const promptArea=ref<HTMLTextAreaElement|null>(null)
|
||||||
const promptCaret=ref({start:0,end:0})
|
const promptCaret=ref({start:0,end:0})
|
||||||
@@ -798,30 +813,31 @@ function isHidden(asset:any){
|
|||||||
const input=asset.role==='input'
|
const input=asset.role==='input'
|
||||||
return input?classicHideInput.value:classicHideOutput.value
|
return input?classicHideInput.value:classicHideOutput.value
|
||||||
}
|
}
|
||||||
if(xaigen) return previewHidden(asset,revealed.value,xaigen)
|
// Session chrome: eye gates the stage preview across neighbors.
|
||||||
return previewForcedHidden.value.has(asset.id)
|
return !eyeOpen.value
|
||||||
}
|
}
|
||||||
function pickerThumbHidden(asset:any){
|
function pickerThumbHidden(asset:any){
|
||||||
if(pickerRevealAll.value)return false
|
if(pickerRevealAll.value)return false
|
||||||
return isHidden(asset)
|
if(!asset?.id)return false
|
||||||
|
if(isClassic.value)return classicHideInput.value
|
||||||
|
if(xaigen) return previewHidden(asset,revealed.value,xaigen)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
function slotHidden(id:string){
|
function slotHidden(id:string){
|
||||||
if(!xaigen || !id)return false
|
if(!xaigen || !id)return false
|
||||||
if(isClassic.value)return classicHideInput.value
|
if(isClassic.value)return classicHideInput.value
|
||||||
return !revealed.value.has(id)
|
return !revealed.value.has(id)
|
||||||
}
|
}
|
||||||
function toggleReveal(id:string){
|
function toggleReveal(_id?:string){
|
||||||
if(!id)return
|
eyeOpen.value=!eyeOpen.value
|
||||||
if(xaigen){
|
}
|
||||||
const next=new Set(revealed.value)
|
function stepFamily(delta:number){
|
||||||
if(next.has(id))next.delete(id);else next.add(id)
|
const list=family.value
|
||||||
revealed.value=next
|
if(list.length < 2)return
|
||||||
if(import.meta.client)localStorage.setItem(`studio2-revealed:${form.folderId}`,JSON.stringify([...next]))
|
const i=list.findIndex((a:any)=>a.id===selected.value?.id)
|
||||||
return
|
const from=i < 0 ? 0 : i
|
||||||
}
|
const next=list[(from + delta + list.length) % list.length]
|
||||||
const next=new Set(previewForcedHidden.value)
|
if(next) selectOutput(next)
|
||||||
if(next.has(id))next.delete(id);else next.add(id)
|
|
||||||
previewForcedHidden.value=next
|
|
||||||
}
|
}
|
||||||
function onLibraryUseAsPhoto(item:any){
|
function onLibraryUseAsPhoto(item:any){
|
||||||
if(item)selectOutput(item)
|
if(item)selectOutput(item)
|
||||||
@@ -839,14 +855,25 @@ function onLibraryDelete(item:any){
|
|||||||
if(item)selectOutput(item)
|
if(item)selectOutput(item)
|
||||||
void deleteOutput()
|
void deleteOutput()
|
||||||
}
|
}
|
||||||
function onLibraryHotkey(e:KeyboardEvent){
|
function onStageHotkey(e:KeyboardEvent){
|
||||||
if(e.key!=='l' && e.key!=='L')return
|
|
||||||
if(e.metaKey||e.ctrlKey||e.altKey)return
|
if(e.metaKey||e.ctrlKey||e.altKey)return
|
||||||
const t=e.target as HTMLElement|null
|
const t=e.target as HTMLElement|null
|
||||||
if(t && (t.tagName==='INPUT'||t.tagName==='TEXTAREA'||t.isContentEditable))return
|
if(t && (t.tagName==='INPUT'||t.tagName==='TEXTAREA'||t.isContentEditable))return
|
||||||
if(libraryOpen.value||picker.value)return
|
if(libraryOpen.value||picker.value)return
|
||||||
|
if(e.key==='l' || e.key==='L'){
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
libraryOpen.value=true
|
libraryOpen.value=true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(e.key==='ArrowLeft'){
|
||||||
|
e.preventDefault()
|
||||||
|
stepFamily(-1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(e.key==='ArrowRight'){
|
||||||
|
e.preventDefault()
|
||||||
|
stepFamily(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function closePicker(){
|
function closePicker(){
|
||||||
const key=picker.value
|
const key=picker.value
|
||||||
@@ -1022,11 +1049,11 @@ onMounted(async()=>{
|
|||||||
if(asset){selected.value={...asset,kind:route.query.clip?'clip':route.query.track?'track':'still'};if(route.query.use==='1'&&selected.value.kind!=='track')restore(selected.value);if(xaigen)toggleReveal(asset.id)}
|
if(asset){selected.value={...asset,kind:route.query.clip?'clip':route.query.track?'track':'still'};if(route.query.use==='1'&&selected.value.kind!=='track')restore(selected.value);if(xaigen)toggleReveal(asset.id)}
|
||||||
if(route.query.task==='music')form.mode='music'
|
if(route.query.task==='music')form.mode='music'
|
||||||
const poll=async()=>{try{await refresh();const health=await $fetch<any>('/api/health');healthState.value=health}catch(e:any){healthState.value=null;error.value=e.data?.statusMessage||e.message}if(!disposed)timer=setTimeout(poll,3000)};void poll()
|
const poll=async()=>{try{await refresh();const health=await $fetch<any>('/api/health');healthState.value=health}catch(e:any){healthState.value=null;error.value=e.data?.statusMessage||e.message}if(!disposed)timer=setTimeout(poll,3000)};void poll()
|
||||||
if(import.meta.client)window.addEventListener('keydown',onLibraryHotkey)
|
if(import.meta.client)window.addEventListener('keydown',onStageHotkey)
|
||||||
})
|
})
|
||||||
onBeforeUnmount(()=>{
|
onBeforeUnmount(()=>{
|
||||||
disposed=true;clearTimeout(timer);clearInterval(clock)
|
disposed=true;clearTimeout(timer);clearInterval(clock)
|
||||||
if(import.meta.client)window.removeEventListener('keydown',onLibraryHotkey)
|
if(import.meta.client)window.removeEventListener('keydown',onStageHotkey)
|
||||||
})
|
})
|
||||||
|
|
||||||
function randomizeSeed(){form.settings.seedMode='random';form.settings.seed=randomSeed()}
|
function randomizeSeed(){form.settings.seedMode='random';form.settings.seed=randomSeed()}
|
||||||
@@ -1078,6 +1105,7 @@ const mobileCtx=computed(()=>({
|
|||||||
toggleReveal,
|
toggleReveal,
|
||||||
chooseTask,
|
chooseTask,
|
||||||
selectOutput,
|
selectOutput,
|
||||||
|
stepFamily,
|
||||||
deleteOutput,
|
deleteOutput,
|
||||||
queue,
|
queue,
|
||||||
upload,
|
upload,
|
||||||
|
|||||||
@@ -54,20 +54,20 @@
|
|||||||
<article
|
<article
|
||||||
v-for="entry in entries"
|
v-for="entry in entries"
|
||||||
:key="entry.key"
|
:key="entry.key"
|
||||||
class="library-thumb group relative cursor-pointer overflow-hidden rounded-2xl border bg-zinc-950"
|
class="lib-modal-tile"
|
||||||
:class="entry.key === focusedKey ? 'border-amber-300 ring-2 ring-amber-300/70' : 'border-white/10'"
|
:data-active="entry.key === focusedKey ? 'true' : undefined"
|
||||||
@click="pickEntry(entry)"
|
@click="pickEntry(entry)"
|
||||||
>
|
>
|
||||||
<div class="relative aspect-[4/5] bg-zinc-900">
|
<div class="lib-modal-media">
|
||||||
<div
|
<div
|
||||||
v-if="entry.kind === 'track'"
|
v-if="entry.kind === 'track'"
|
||||||
class="flex h-full w-full items-end gap-0.5 bg-zinc-900 px-4 py-8"
|
class="lib-modal-track"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
v-for="n in 16"
|
v-for="n in 16"
|
||||||
:key="n"
|
:key="n"
|
||||||
class="flex-1 rounded-full bg-amber-400/70"
|
class="lib-modal-bar"
|
||||||
:style="{ height: `${20 + ((n * 17) % 60)}%` }"
|
:style="{ height: `${20 + ((n * 17) % 60)}%` }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -77,16 +77,15 @@
|
|||||||
alt=""
|
alt=""
|
||||||
decoding="async"
|
decoding="async"
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="h-full w-full object-cover"
|
|
||||||
>
|
>
|
||||||
<span v-else class="block h-full w-full bg-zinc-800" />
|
<span v-else class="lib-modal-fallback" />
|
||||||
<span class="absolute left-2 top-2 rounded-md bg-black/60 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-zinc-200">
|
<span class="lib-modal-kind">
|
||||||
{{ entry.kind === 'clip' ? 'Video' : entry.kind === 'track' ? 'Music' : 'Image' }}
|
{{ entry.kind === 'clip' ? 'Video' : entry.kind === 'track' ? 'Music' : 'Image' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="px-2.5 py-2">
|
<div class="lib-modal-caption">
|
||||||
<p class="truncate text-xs font-medium text-zinc-100">{{ entry.name }}</p>
|
<p class="lib-modal-name">{{ entry.name }}</p>
|
||||||
<p class="truncate text-[11px] text-zinc-500">{{ cardMeta(entry) }}</p>
|
<p class="lib-modal-meta">{{ cardMeta(entry) }}</p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
@@ -435,11 +434,90 @@ onBeforeUnmount(() => {
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||||
gap: 10px;
|
gap: 8px;
|
||||||
align-content: start;
|
align-content: start;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 14px 16px;
|
padding: 14px 16px;
|
||||||
}
|
}
|
||||||
|
.lib-modal-tile {
|
||||||
|
display: flex;
|
||||||
|
min-height: 120px;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 2px solid #2a2a2e;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #0b0b0d;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.lib-modal-tile[data-active='true'] {
|
||||||
|
border-color: #f5a524;
|
||||||
|
box-shadow: 0 0 0 2px #f5a524;
|
||||||
|
}
|
||||||
|
.lib-modal-media {
|
||||||
|
position: relative;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
min-height: 120px;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #18181b;
|
||||||
|
}
|
||||||
|
.lib-modal-media > img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
.lib-modal-fallback {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #27272a;
|
||||||
|
}
|
||||||
|
.lib-modal-track {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 2px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
.lib-modal-bar {
|
||||||
|
flex: 1;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(245, 165, 36, 0.7);
|
||||||
|
}
|
||||||
|
.lib-modal-kind {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
left: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #000a;
|
||||||
|
padding: 2px 6px;
|
||||||
|
color: #e4e4e7;
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
.lib-modal-caption {
|
||||||
|
padding: 6px 8px 8px;
|
||||||
|
}
|
||||||
|
.lib-modal-name {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #f4f4f5;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.lib-modal-meta {
|
||||||
|
margin: 2px 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #71717a;
|
||||||
|
font-size: 11px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
.lib-modal-empty {
|
.lib-modal-empty {
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
color: #9a9588;
|
color: #9a9588;
|
||||||
|
|||||||
@@ -65,6 +65,20 @@
|
|||||||
<img :src="ctx.isHidden(ctx.selected) ? '/icons/display/eye-off.svg' : '/icons/display/eye.svg'" alt="" width="20" height="20">
|
<img :src="ctx.isHidden(ctx.selected) ? '/icons/display/eye-off.svg' : '/icons/display/eye.svg'" alt="" width="20" height="20">
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
v-if="(ctx.family || []).length > 1"
|
||||||
|
type="button"
|
||||||
|
class="m-nav m-nav-prev"
|
||||||
|
aria-label="Previous"
|
||||||
|
@click.stop="ctx.stepFamily(-1)"
|
||||||
|
>‹</button>
|
||||||
|
<button
|
||||||
|
v-if="(ctx.family || []).length > 1"
|
||||||
|
type="button"
|
||||||
|
class="m-nav m-nav-next"
|
||||||
|
aria-label="Next"
|
||||||
|
@click.stop="ctx.stepFamily(1)"
|
||||||
|
>›</button>
|
||||||
<template v-if="ctx.selected && ctx.isHidden(ctx.selected)">
|
<template v-if="ctx.selected && ctx.isHidden(ctx.selected)">
|
||||||
<p class="m-muted">{{ ctx.selected.kind==='track' ? 'Track loaded · preview hidden' : 'Preview hidden' }}</p>
|
<p class="m-muted">{{ ctx.selected.kind==='track' ? 'Track loaded · preview hidden' : 'Preview hidden' }}</p>
|
||||||
</template>
|
</template>
|
||||||
@@ -440,6 +454,24 @@ watch(() => props.ctx.form.mode, () => { sheet.value = '' })
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: #000a;
|
background: #000a;
|
||||||
}
|
}
|
||||||
|
.m-nav {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 4;
|
||||||
|
display: grid;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #000a;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 28px;
|
||||||
|
line-height: 1;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
.m-nav-prev { left: 8px; }
|
||||||
|
.m-nav-next { right: 8px; }
|
||||||
.m-dock {
|
.m-dock {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr) 120px;
|
grid-template-columns: repeat(4, 1fr) 120px;
|
||||||
|
|||||||
Reference in New Issue
Block a user