mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 14:45:36 +00:00
*PR Created by the Glary-Bot Agent* --- ## Summary - Replace all `cn` / `ClassValue` imports from the `@/utils/tailwindUtil` re-export shim with direct imports from `@comfyorg/tailwind-utils` across 198 source files in `src/` and 3 in `apps/desktop-ui/` - Delete both shim files (`src/utils/tailwindUtil.ts` and `apps/desktop-ui/src/utils/tailwindUtil.ts`) - Add explicit `@comfyorg/tailwind-utils` dependency to `apps/desktop-ui/package.json` - Update documentation references in `AGENTS.md`, `docs/guidance/design-standards.md`, and `docs/guidance/vue-components.md` Fixes #11288 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11453-refactor-migrate-cn-imports-from-utils-tailwindUtil-shim-to-comfyorg-tailwind-utils--3486d73d365081ec92cce91fbf88e6e4) by [Unito](https://www.unito.io) --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
1.7 KiB
1.7 KiB
globs
| globs | |
|---|---|
|
Vue Component Conventions
Applies to all .vue files anywhere in the codebase.
Vue 3 Composition API
- Use
<script setup lang="ts">for component logic - Destructure props (Vue 3.5 style with defaults) like
const { color = 'blue' } = defineProps<...>() - Use
ref/reactivefor state - Use
computed()for derived state - Use lifecycle hooks:
onMounted,onUpdated, etc.
Component Communication
- Prefer
emit/@event-namefor state changes (promotes loose coupling) - Use
defineExposeonly for imperative operations (form.validate(),modal.open()) - Proper props and emits definitions
VueUse Composables
Prefer VueUse composables over manual event handling:
useElementHoverinstead of manual mouseover/mouseout listenersuseIntersectionObserverfor visibility detection instead of scroll handlersuseFocusTrapfor modal/dialog focus managementuseEventListenerfor auto-cleanup event listeners
Prefer Vue native options when available:
defineModelinstead ofuseVModelfor two-way binding with props
Styling
- Use inline Tailwind CSS only (no
<style>blocks) - Use
cn()from@comfyorg/tailwind-utilsfor conditional classes - Refer to packages/design-system/src/css/style.css for design tokens and tailwind configuration
- Exception: when third-party libraries render runtime DOM outside Vue templates
(for example xterm internals inside PrimeVue terminal wrappers), scoped
:deep()selectors are allowed. Add a brief inline comment explaining why the exception is required.
Best Practices
- Extract complex conditionals to
computed - In unmounted hooks, implement cleanup for async operations