mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
Backport of #9523 to core/1.41.
Cherry-pick of merge commit 83ffaf30 with minor conflict in
`src/locales/en/main.json` (added new i18n keys). Resolved by accepting
incoming keys.
**Original PR:** https://github.com/Comfy-Org/ComfyUI_frontend/pull/9523
**Pipeline ticket:** 15e1f241-efaa-4fe5-88ca-4ccc7bfb3345
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9566-backport-core-1-41-Yet-further-app-fixes-9523-31d6d73d3650815c9c06eee813f0e72e)
by [Unito](https://www.unito.io)
Co-authored-by: AustinMroz <austin@comfy.org>
52 lines
1.5 KiB
Vue
52 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import { remove } from 'es-toolkit'
|
|
import { computed } from 'vue'
|
|
|
|
import type { NodeId } from '@/lib/litegraph/src/LGraphNode'
|
|
import { useAppModeStore } from '@/stores/appModeStore'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
const { id } = defineProps<{ id: string }>()
|
|
|
|
const appModeStore = useAppModeStore()
|
|
const isPromoted = computed(() =>
|
|
appModeStore.selectedOutputs.some(matchesThis)
|
|
)
|
|
|
|
function matchesThis(nodeId: NodeId) {
|
|
return id == nodeId
|
|
}
|
|
function togglePromotion() {
|
|
if (isPromoted.value) remove(appModeStore.selectedOutputs, matchesThis)
|
|
else appModeStore.selectedOutputs.push(id)
|
|
}
|
|
</script>
|
|
<template>
|
|
<div
|
|
:class="
|
|
cn(
|
|
'pointer-events-auto absolute z-1 size-full rounded-2xl ring-5 ring-warning-background/50',
|
|
isPromoted && 'ring-warning-background'
|
|
)
|
|
"
|
|
@click.capture.stop.prevent
|
|
@pointerup.capture.stop.prevent
|
|
@pointermove.capture.stop.prevent
|
|
@pointerdown.capture.stop="togglePromotion"
|
|
@contextmenu.capture.stop.prevent
|
|
>
|
|
<div class="absolute top-0 right-0 size-8">
|
|
<div
|
|
v-if="isPromoted"
|
|
class="absolute -top-1/2 -right-1/2 size-full rounded-lg bg-warning-background p-2"
|
|
>
|
|
<i class="bg-text-foreground icon-[lucide--check] size-full" />
|
|
</div>
|
|
<div
|
|
v-else
|
|
class="absolute -top-1/2 -right-1/2 size-full rounded-lg bg-component-node-background ring-4 ring-warning-background/50 ring-inset"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|