mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Remove Tailwind `@apply` from Vue styles across `src/` and `apps/desktop-ui/src/` to align with Tailwind v4 guidance, replacing usages with template utilities or native CSS while preserving behavior. ## Changes - **What**: - Batch 1: migrated low-risk template/style utility bundles out of `@apply`. - Batch 2: converted PrimeVue/`:deep()` override `@apply` blocks to native CSS declarations. - Batch 3: converted `src/components/node/NodeHelpContent.vue` markdown styling from `@apply` to native CSS/token-based declarations. - Batch 4: converted final desktop pseudo-element `@apply` styles and removed stale `@reference` directives no longer required. - Verified `rg -n "^\s*@apply\b" src apps -g "*.vue"` has no real CSS `@apply` directives remaining (only known template false-positive event binding in `NodeSearchContent.vue`). ## Review Focus - Visual parity in components that previously depended on `@apply` in `:deep()` selectors and markdown content: - topbar tabs/popovers, dialogs, breadcrumb, terminal overrides - desktop install/dialog/update/maintenance surfaces - node help markdown rendering - Confirm no regressions from removal of now-unneeded `@reference` directives. ## Screenshots (if applicable) - No new screenshots included in this PR. - Screenshot Playwright suite was run with `--grep="@screenshot"` and reports baseline diffs in this environment (164 passed, 39 failed, 3 skipped) plus a teardown `EPERM` restore error on local path `C:\Users\DrJKL\ComfyUI\LTXV\user`. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9146-fix-eradicate-tailwind-apply-usage-in-vue-styles-3116d73d3650813d8642e0bada13df32) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
116 lines
2.9 KiB
Vue
116 lines
2.9 KiB
Vue
<template>
|
|
<div
|
|
ref="rootEl"
|
|
class="relative overflow-hidden h-full w-full bg-neutral-900"
|
|
>
|
|
<div class="p-terminal rounded-none h-full w-full p-2">
|
|
<div ref="terminalEl" class="h-full terminal-host" />
|
|
</div>
|
|
<Button
|
|
v-tooltip.left="{
|
|
value: tooltipText,
|
|
showDelay: 300
|
|
}"
|
|
icon="pi pi-copy"
|
|
severity="secondary"
|
|
size="small"
|
|
:class="
|
|
cn('absolute top-2 right-8 transition-opacity', {
|
|
'opacity-0 pointer-events-none select-none': !isHovered
|
|
})
|
|
"
|
|
:aria-label="tooltipText"
|
|
@click="handleCopy"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useElementHover, useEventListener } from '@vueuse/core'
|
|
import type { IDisposable } from '@xterm/xterm'
|
|
import Button from 'primevue/button'
|
|
import type { Ref } from 'vue'
|
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import { useTerminal } from '@/composables/bottomPanelTabs/useTerminal'
|
|
import { electronAPI, isElectron } from '@/utils/envUtil'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
const { t } = useI18n()
|
|
|
|
const emit = defineEmits<{
|
|
created: [ReturnType<typeof useTerminal>, Ref<HTMLElement | undefined>]
|
|
unmounted: []
|
|
}>()
|
|
const terminalEl = ref<HTMLElement | undefined>()
|
|
const rootEl = ref<HTMLElement | undefined>()
|
|
const hasSelection = ref(false)
|
|
|
|
const isHovered = useElementHover(rootEl)
|
|
|
|
const terminalData = useTerminal(terminalEl)
|
|
emit('created', terminalData, ref(rootEl))
|
|
|
|
const { terminal } = terminalData
|
|
let selectionDisposable: IDisposable | undefined
|
|
|
|
const tooltipText = computed(() => {
|
|
return hasSelection.value
|
|
? t('serverStart.copySelectionTooltip')
|
|
: t('serverStart.copyAllTooltip')
|
|
})
|
|
|
|
const handleCopy = async () => {
|
|
const existingSelection = terminal.getSelection()
|
|
const shouldSelectAll = !existingSelection
|
|
if (shouldSelectAll) terminal.selectAll()
|
|
|
|
const selectedText = shouldSelectAll
|
|
? terminal.getSelection()
|
|
: existingSelection
|
|
|
|
if (selectedText) {
|
|
await navigator.clipboard.writeText(selectedText)
|
|
|
|
if (shouldSelectAll) {
|
|
terminal.clearSelection()
|
|
}
|
|
}
|
|
}
|
|
|
|
const showContextMenu = (event: MouseEvent) => {
|
|
event.preventDefault()
|
|
electronAPI()?.showContextMenu({ type: 'text' })
|
|
}
|
|
|
|
if (isElectron()) {
|
|
useEventListener(terminalEl, 'contextmenu', showContextMenu)
|
|
}
|
|
|
|
onMounted(() => {
|
|
selectionDisposable = terminal.onSelectionChange(() => {
|
|
hasSelection.value = terminal.hasSelection()
|
|
})
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
selectionDisposable?.dispose()
|
|
emit('unmounted')
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
/* xterm renders its internal DOM outside Vue templates, so :deep selectors are
|
|
* required to style those generated nodes.
|
|
*/
|
|
:deep(.p-terminal) .xterm {
|
|
overflow: hidden;
|
|
}
|
|
|
|
:deep(.p-terminal) .xterm-screen {
|
|
overflow: hidden;
|
|
background-color: var(--color-neutral-900);
|
|
}
|
|
</style>
|