-
Notifications
You must be signed in to change notification settings - Fork 491
feat: Vue widget registration for custom extensions #7749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughAdds extension-provided Vue widgets with registry precedence over core widgets, exposes the Vue runtime to extensions via window.Vue, passes a new display hint through widget options and lookups, updates schemas/types to accept string display hints, and registers extension Vue widgets during extension loading. Changes
Sequence Diagram(s)sequenceDiagram
actor Extension
participant ExtSvc as ExtensionService
participant Registry as WidgetRegistry
participant Renderer as NodeWidgets (Renderer)
participant Component as WidgetComponent
Extension->>ExtSvc: registerExtension()
ExtSvc->>Extension: call getCustomVueWidgets(app)?
Note right of Extension: returns VueWidgets (sync|async)
Extension-->>ExtSvc: VueWidgets
ExtSvc->>Registry: registerVueWidgets(widgets)
Registry->>Registry: store extension widgets & aliases (higher precedence)
Note over Renderer,Registry: Later, during node render
Renderer->>Registry: getComponent(type, name, display?)
alt Extension widget matches (type or alias or display)
Registry-->>Renderer: extension Component
else Core widget matches
Registry-->>Renderer: core Component
else No match
Registry-->>Renderer: null (falls back to DOM/legacy)
end
Renderer->>Component: render with props (including display, precision)
Possibly related PRs
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright Tests:
|
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 01/13/2026, 07:57:16 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 3.32 MB (baseline 3.32 MB) • 🔴 +1.28 kBMain entry bundles and manifests
Status: 3 added / 3 removed Graph Workspace — 1.04 MB (baseline 1.04 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 6.63 kB (baseline 6.63 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 1 added / 1 removed Panels & Settings — 372 kB (baseline 372 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 6 added / 6 removed UI Components — 200 kB (baseline 200 kB) • ⚪ 0 BReusable component library chunks
Status: 9 added / 9 removed Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 BStores, services, APIs, and repositories
Status: 3 added / 3 removed Utilities & Hooks — 1.41 kB (baseline 1.41 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 1 added / 1 removed Vendor & Third-Party — 9.26 MB (baseline 9.19 MB) • 🔴 +63.7 kBExternal libraries and shared vendor chunks
Status: 6 added / 6 removed Other — 5.25 MB (baseline 5.25 MB) • ⚪ 0 BBundles that do not match a named category
Status: 21 added / 21 removed |
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (11)
src/main.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/types/comfy.tssrc/types/litegraph-augmentation.d.tssrc/utils/vueExtensionApi.ts
🧰 Additional context used
📓 Path-based instructions (14)
src/**/*.{vue,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{vue,ts}: Leverage VueUse functions for performance-enhancing styles
Implement proper error handling
Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
src/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/*.{ts,tsx,vue}: Sanitize HTML with DOMPurify to prevent XSS attacks
Avoid using @ts-expect-error; use proper TypeScript types instead
Use es-toolkit for utility functions instead of other utility libraries
Implement proper TypeScript types throughout the codebase
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Follow Vue 3 composition API style guide
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,vue}: Use TypeScript exclusively; do not write new JavaScript code
Use sorted and grouped imports organized by plugin/source
Enforce ESLint rules including Vue + TypeScript rules, disallow floating promises, disallow unused imports, and restrict i18n raw text in templates
Do not useanytype oras anytype assertions; fix the underlying type issue instead
Write code that is expressive and self-documenting; avoid redundant comments and clean as you go
Keep functions short and functional; minimize nesting and follow the arrow anti-pattern
Avoid mutable state; prefer immutability and assignment at point of declaration
Use function declarations instead of function expressions when possible
Use es-toolkit for utility functions
Implement proper error handling in code
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
**/*.{ts,tsx,vue,js,jsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Prettier formatting with 2-space indentation, single quotes, no trailing semicolons, and 80-character line width
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Minimize the surface area (exported values) of each module and composable
Files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
src/**/{services,composables}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/{services,composables}/**/*.{ts,tsx}: Useapi.apiURL()for backend endpoints instead of constructing URLs directly
Useapi.fileURL()for static file access instead of constructing URLs directly
Files:
src/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
src/**/{composables,components}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Clean up subscriptions in state management to prevent memory leaks
Files:
src/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
src/**/{components,composables}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Use vue-i18n for ALL user-facing strings by adding them to
src/locales/en/main.json
Files:
src/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
**/**/use[A-Z]*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Name composables using the pattern
useXyz.ts
Files:
src/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
src/**/*.vue
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.vue: Use the Vue 3 Composition API instead of the Options API when writing Vue components (exception: when overriding or extending PrimeVue components for compatibility)
Use setup() function for component logic
Utilize ref and reactive for reactive state
Implement computed properties with computed()
Use watch and watchEffect for side effects
Implement lifecycle hooks with onMounted, onUpdated, etc.
Utilize provide/inject for dependency injection
Use vue 3.5 style of default prop declaration
Use Tailwind CSS for styling
Implement proper props and emits definitions
Utilize Vue 3's Teleport component when needed
Use Suspense for async components
Follow Vue 3 style guide and naming conventions
Files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
**/*.vue
📄 CodeRabbit inference engine (AGENTS.md)
**/*.vue: Use Vue 3.5+ with TypeScript in.vuefiles, exclusively using Composition API with<script setup lang="ts">syntax
Use Tailwind 4 for styling in Vue components; avoid<style>blocks
Name Vue components using PascalCase (e.g.,MenuHamburger.vue)
Use Vue 3.5 TypeScript-style default prop declaration with reactive props destructuring; do not usewithDefaultsor runtime props declaration
Prefercomputed()overrefwithwatchwhen deriving values
PreferuseModelover separately defining prop and emit for two-way binding
Usevue-i18nin composition API for string literals; place new translation entries insrc/locales/en/main.json
Usecn()utility function from@/utils/tailwindUtilfor merging Tailwind class names; do not use:class="[]"syntax
Do not use thedark:Tailwind variant; use semantic values from thestyle.csstheme instead (e.g.,bg-node-component-surface)
Do not use!importantor the!important prefix for Tailwind classes; find and correct interfering!importantclasses instead
Avoid new usage of PrimeVue components; use VueUse, shadcn/vue, or Reka UI instead
Leverage VueUse functions for performance-enhancing styles in Vue components
Implement proper props and emits definitions in Vue components
Utilize Vue 3's Teleport component when needed
Use Suspense for async components
Follow Vue 3 style guide and naming conventions
Files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.test.ts: Use unit/component tests intests-ui/orsrc/**/*.test.tswith Vitest framework
For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Do not write change detector tests or tests dependent on non-behavioral features like utility classes or styles
Aim for behavioral coverage of critical and new features in unit tests
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
🧠 Learnings (43)
📚 Learning: 2025-12-09T03:39:54.501Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7169
File: src/platform/remote/comfyui/jobs/jobTypes.ts:1-107
Timestamp: 2025-12-09T03:39:54.501Z
Learning: In the ComfyUI_frontend project, Zod is on v3.x. Do not suggest Zod v4 standalone validators (z.uuid, z.ulid, z.cuid2, z.nanoid) until an upgrade to Zod 4 is performed. When reviewing TypeScript files (e.g., src/platform/remote/comfyui/jobs/jobTypes.ts) validate against Zod 3 capabilities and avoid introducing v4-specific features; flag any proposal to upgrade or incorporate v4-only validators and propose staying with compatible 3.x patterns.
Applied to files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
📚 Learning: 2025-12-13T11:03:11.264Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7416
File: src/stores/imagePreviewStore.ts:5-7
Timestamp: 2025-12-13T11:03:11.264Z
Learning: In the ComfyUI_frontend repository, lint rules require keeping 'import type' statements separate from non-type imports, even if importing from the same module. Do not suggest consolidating them into a single import statement. Ensure type imports remain on their own line (import type { ... } from 'module') and regular imports stay on separate lines.
Applied to files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
📚 Learning: 2025-12-17T00:40:09.635Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.stories.ts:45-55
Timestamp: 2025-12-17T00:40:09.635Z
Learning: Prefer pure function declarations over function expressions (e.g., use function foo() { ... } instead of const foo = () => { ... }) for pure functions in the repository. Function declarations are more functional-leaning, offer better hoisting clarity, and can improve readability and tooling consistency. Apply this guideline across TypeScript files in Comfy-Org/ComfyUI_frontend, including story and UI component code, except where a function expression is semantically required (e.g., callbacks, higher-order functions with closures).
Applied to files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
📚 Learning: 2025-12-11T12:25:15.470Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7358
File: src/components/dialog/content/signin/SignUpForm.vue:45-54
Timestamp: 2025-12-11T12:25:15.470Z
Learning: This repository uses CI automation to format code (pnpm format). Do not include manual formatting suggestions in code reviews for Comfy-Org/ComfyUI_frontend. If formatting issues are detected, rely on the CI formatter or re-run pnpm format. Focus reviews on correctness, readability, performance, accessibility, and maintainability rather than style formatting.
Applied to files:
src/types/litegraph-augmentation.d.tssrc/schemas/nodeDefSchema.tssrc/services/extensionService.tssrc/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.tssrc/utils/vueExtensionApi.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/extensions/vueNodes/widgets/composables/useIntWidget.tssrc/types/comfy.ts
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.{vue,ts,js} : Use existing VueUse composables (such as useElementHover) instead of manually managing event listeners
Applied to files:
src/services/extensionService.tssrc/types/comfy.ts
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.vue : Use defineExpose only for imperative operations (such as form.validate(), modal.open())
Applied to files:
src/utils/vueExtensionApi.tssrc/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.vue : Use Vue 3.5+ with TypeScript in `.vue` files, exclusively using Composition API with `<script setup lang="ts">` syntax
Applied to files:
src/utils/vueExtensionApi.tssrc/main.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{ts,tsx,vue} : Use es-toolkit for utility functions instead of other utility libraries
Applied to files:
src/utils/vueExtensionApi.tssrc/main.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.{ts,tsx,vue} : Use es-toolkit for utility functions
Applied to files:
src/utils/vueExtensionApi.tssrc/main.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.vue : Use Vue 3.5 TypeScript-style default prop declaration with reactive props destructuring; do not use `withDefaults` or runtime props declaration
Applied to files:
src/utils/vueExtensionApi.tssrc/main.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.{ts,tsx,vue} : Use function declarations instead of function expressions when possible
Applied to files:
src/utils/vueExtensionApi.ts
📚 Learning: 2025-11-24T19:47:02.860Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T19:47:02.860Z
Learning: Applies to src/**/*.{vue,ts} : Leverage VueUse functions for performance-enhancing styles
Applied to files:
src/utils/vueExtensionApi.tssrc/main.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.{ts,tsx} : Minimize the surface area (exported values) of each module and composable
Applied to files:
src/utils/vueExtensionApi.tssrc/main.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{vue,ts,tsx} : Follow Vue 3 composition API style guide
Applied to files:
src/utils/vueExtensionApi.tssrc/types/comfy.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{ts,tsx,vue} : Implement proper TypeScript types throughout the codebase
Applied to files:
src/utils/vueExtensionApi.ts
📚 Learning: 2025-12-09T03:49:52.828Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 6300
File: src/platform/updates/components/WhatsNewPopup.vue:5-13
Timestamp: 2025-12-09T03:49:52.828Z
Learning: In Vue files across the ComfyUI_frontend repo, when a button is needed, prefer the repo's common button components from src/components/button/ (IconButton.vue, TextButton.vue, IconTextButton.vue) over plain HTML <button> elements. These components wrap PrimeVue with the project’s design system styling. Use only the common button components for consistency and theming, and import them from src/components/button/ as needed.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-09T21:40:12.361Z
Learnt from: benceruleanlu
Repo: Comfy-Org/ComfyUI_frontend PR: 7297
File: src/components/actionbar/ComfyActionbar.vue:33-43
Timestamp: 2025-12-09T21:40:12.361Z
Learning: In Vue single-file components, allow inline Tailwind CSS class strings for static classes and avoid extracting them into computed properties solely for readability. Prefer keeping static class names inline for simplicity and performance. For dynamic or conditional classes, use Vue bindings (e.g., :class) to compose classes.
Applies to all Vue files in the repository (e.g., src/**/*.vue) where Tailwind utilities are used for static styling.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-16T22:26:49.463Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.vue:17-17
Timestamp: 2025-12-16T22:26:49.463Z
Learning: In Vue 3.5+ with <script setup>, when using defineProps<Props>() with partial destructuring (e.g., const { as = 'button', class: customClass = '' } = defineProps<Props>() ), props that are not destructured (e.g., variant, size) stay accessible by name in the template scope. This pattern is valid: you can destructure only a subset of props for convenience while referencing the remaining props directly in template expressions. Apply this guideline to Vue components across the codebase (all .vue files).
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-22T21:36:08.369Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: src/platform/cloud/subscription/components/PricingTable.vue:185-201
Timestamp: 2025-12-22T21:36:08.369Z
Learning: In Vue components, avoid creating single-use variants for common UI components (e.g., Button and other shared components). Aim for reusable variants that cover multiple use cases. It’s acceptable to temporarily mix variant props with inline Tailwind classes when a styling need is unique to one place, but plan and consolidate into shared, reusable variants as patterns emerge across the codebase.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-11T03:55:51.755Z
Learnt from: simula-r
Repo: Comfy-Org/ComfyUI_frontend PR: 7252
File: src/renderer/extensions/vueNodes/components/ImagePreview.vue:151-158
Timestamp: 2025-12-11T03:55:51.755Z
Learning: In Vue components under src/renderer/extensions/vueNodes (e.g., ImagePreview.vue and LGraphNode.vue), implement image gallery keyboard navigation so that it responds to the node's focus state rather than requiring focus inside the image preview wrapper. Achieve this by wiring keyEvent handling at the node focus level and injecting or propagating key events (arrow keys) to the gallery when the node is focused/selected. This improves accessibility and aligns navigation with node-level focus behavior.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-18T02:07:38.870Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7598
File: src/components/sidebar/tabs/AssetsSidebarTab.vue:131-131
Timestamp: 2025-12-18T02:07:38.870Z
Learning: Tailwind CSS v4 safe utilities (e.g., items-center-safe, justify-*-safe, place-*-safe) are allowed in Vue components under src/ and in story files. Do not flag these specific safe variants as invalid when reviewing code in src/**/*.vue or related stories.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-18T21:15:46.862Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7603
File: src/components/queue/QueueOverlayHeader.vue:49-59
Timestamp: 2025-12-18T21:15:46.862Z
Learning: In the ComfyUI_frontend repository, for Vue components, do not add aria-label to buttons that have visible text content (e.g., buttons containing <span> text). The visible text provides the accessible name. Use aria-label only for elements without visible labels (e.g., icon-only buttons). If a button has no visible label, provide a clear aria-label or associate with an aria-labelledby describing its action.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-12-21T01:06:02.786Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: src/components/graph/selectionToolbox/ColorPickerButton.vue:15-18
Timestamp: 2025-12-21T01:06:02.786Z
Learning: In Comfy-Org/ComfyUI_frontend, in Vue component files, when a filled icon is required (e.g., 'pi pi-circle-fill'), you may mix PrimeIcons with Lucide icons since Lucide lacks filled variants. This mixed usage is acceptable when one icon library does not provide an equivalent filled icon. Apply consistently across Vue components in the src directory where icons are used, and document the rationale when a mixed approach is chosen.
Applied to files:
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Write tests for new features
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Mock external dependencies in tests
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{test,spec}.{ts,tsx} : Use provided test helpers `createTestSubgraph` and `createTestSubgraphNode` from `./fixtures/subgraphHelpers` for consistent subgraph test setup
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Follow existing test patterns in the codebase
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Always prefer vitest mock functions over writing verbose manual mocks
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Use existing test utilities rather than writing custom utilities
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Use unit/component tests in `tests-ui/` or `src/**/*.test.ts` with Vitest framework
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-22T21:36:38.905Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: tests-ui/tests/platform/cloud/subscription/components/SubscriptionPanel.test.ts:189-194
Timestamp: 2025-12-22T21:36:38.905Z
Learning: In the Comfy-Org/ComfyUI_frontend repository test files: Do not stub primitive UI components or customized primitive components (e.g., Button). Instead, import and register the real components in test setup. This ensures tests accurately reflect production behavior and component API usage.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Do not write change detector tests or tests dependent on non-behavioral features like utility classes or styles
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:09.318Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .cursor/rules/unit-test.mdc:0-0
Timestamp: 2025-11-24T19:48:09.318Z
Learning: Applies to test/**/*.{test,spec}.{js,ts,jsx,tsx} : Mocks should be cleanly written and easy to understand, with reusable mocks where possible
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:09.318Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .cursor/rules/unit-test.mdc:0-0
Timestamp: 2025-11-24T19:48:09.318Z
Learning: Applies to test/**/*.{test,spec}.{js,ts,jsx,tsx} : Prefer the use of `test.extend` over loose variables; import `test as baseTest` from `vitest`
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Check tests-ui/README.md for test guidelines
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-10T03:09:13.807Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7303
File: src/components/topbar/CurrentUserPopover.test.ts:199-205
Timestamp: 2025-12-10T03:09:13.807Z
Learning: In test files, prefer selecting or asserting on accessible properties (text content, aria-label, role, accessible name) over data-testid attributes. This ensures tests validate actual user-facing behavior and accessibility, reducing reliance on implementation details like test IDs.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/{components,composables}/**/*.{ts,tsx,vue} : Use vue-i18n for ALL user-facing strings by adding them to `src/locales/en/main.json`
Applied to files:
src/main.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.{ts,tsx,vue} : Use sorted and grouped imports organized by plugin/source
Applied to files:
src/main.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.vue : Implement proper props and emits definitions in Vue components
Applied to files:
src/main.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/types/comfy.ts
📚 Learning: 2025-12-09T03:50:03.127Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 6300
File: src/platform/updates/components/WhatsNewPopup.vue:5-13
Timestamp: 2025-12-09T03:50:03.127Z
Learning: In the Comfy-Org/ComfyUI_frontend repository, when avoiding PrimeVue components, prefer using the repo's common button components from src/components/button/ (IconButton.vue, TextButton.vue, IconTextButton.vue) rather than plain HTML buttons. These components wrap PrimeVue with custom design system styling.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/types/comfy.ts
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.vue : Define proper props and emits definitions in Vue components
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/types/comfy.ts
📚 Learning: 2025-12-06T02:11:00.385Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7137
File: src/components/rightSidePanel/RightSidePanel.vue:174-180
Timestamp: 2025-12-06T02:11:00.385Z
Learning: PrimeVue components have poor TypeScript typing, so type assertions (like `as RightSidePanelTab`) may be necessary when handling emitted events or prop values from PrimeVue components like TabList.
Applied to files:
src/types/comfy.ts
🧬 Code graph analysis (3)
src/services/extensionService.ts (2)
src/scripts/app.ts (1)
app(1765-1765)src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts (1)
registerVueWidgets(187-196)
src/main.ts (1)
src/utils/vueExtensionApi.ts (1)
exposeVueApi(17-19)
src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts (1)
src/types/comfy.ts (1)
VueWidgetDefinition(23-32)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: lint-and-format
- GitHub Check: collect
- GitHub Check: setup
- GitHub Check: test
🔇 Additional comments (22)
src/main.ts (1)
15-18: LGTM! Early Vue API exposure for extensions.The positioning of
exposeVueApi()before CSS imports and other initialization ensures that external extensions can access Vue utilities during their initialization phase. The explanatory comment clearly communicates the intent.src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts (1)
66-67: LGTM! Display hint integration for integer widgets.The addition of the
displayproperty to widget options enables custom widget rendering based on hints from Python node definitions. This aligns with the broader Vue widget extension system introduced in this PR.src/types/litegraph-augmentation.d.ts (1)
44-48: LGTM! Well-documented display hint property.The optional
displayproperty is appropriately typed as a string to allow flexible extension-defined values. The documentation clearly explains its purpose for custom widget rendering by extensions.src/schemas/nodeDefSchema.ts (1)
45-50: LGTM! Flexible display hint validation for extensibility.The change from a restrictive enum to a string type appropriately balances type safety with extensibility. The documentation clearly lists built-in values while allowing extensions to register custom display types, which aligns with the PR's goal of supporting custom Vue widgets.
src/utils/vueExtensionApi.ts (1)
1-19: Verify the intended API surface for external extensions.The implementation exposes the entire Vue namespace via
import * as Vue from 'vue', making all Vue APIs available to extensions throughwindow.Vue. While this provides maximum flexibility, it also exposes a large API surface.Consider documenting:
- Which Vue APIs extensions are expected to use (e.g.,
h,defineComponent,ref,computedas shown in the comment)- Security/compatibility implications of global Vue exposure
- Whether selective exports would be more appropriate for stability
Do you want to:
- Maintain the current approach (full Vue namespace exposure) with additional documentation?
- Restrict to a curated subset of Vue APIs for better control?
The usage example in the documentation is helpful. Consider expanding it to mention version compatibility expectations.
src/renderer/extensions/vueNodes/components/NodeWidgets.vue (1)
154-156: LGTM! Safe display hint parameter addition.The optional chaining for
widget.options?.displaysafely passes the display hint to component resolution while maintaining backward compatibility. The existing fallback logic toWidgetDOMorWidgetLegacyremains intact.src/types/comfy.ts (2)
1-1: LGTM! Proper type-only import.The type-only import of
Componentfrom Vue follows the repository's pattern of keeping type imports separate from non-type imports.Based on learnings.
181-188: LGTM! Well-documented extension hook.The
getCustomVueWidgetsmethod follows the existing pattern ofgetCustomWidgetsand includes clear documentation about its purpose, precedence behavior, and return type. The async/sync union return type provides flexibility for extension developers.src/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.ts (1)
75-76: LGTM! Display and precision properties correctly added.The addition of
precisionanddisplayto widget options properly extends the widget configuration to support:
- Explicit rounding precision for float values (derived from settings or step calculation)
- Custom display hints for Vue widget lookup (enabling extension widget override via the registry)
These properties integrate correctly with the widget registry's
getComponent(type, name, displayHint?)signature introduced in this PR.src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts (7)
1-21: LGTM! Well-structured test setup.The test structure follows best practices:
- Proper separation of type and value imports per lint rules
- Mock components use object literals to avoid Vue linter issues (appropriate for unit tests)
afterEachcleanup ensures isolated test execution
23-57: LGTM! Comprehensive registration tests.The test cases appropriately cover:
- Single widget registration and retrieval
- Batch registration of multiple widgets
- Alias support with multiple aliases per widget
All assertions correctly use
toBefor component reference equality.
59-123: LGTM! Thorough component lookup tests.The test suite comprehensively validates:
- Core widget retrieval by type and alias
- Extension widget precedence over core widgets (critical PR feature)
- Display hint resolution with both direct type and alias matches
- Graceful fallback when display hint has no match
All test cases validate essential behavioral aspects of the new lookup system.
125-147: LGTM! Clear behavior correctly validated.Tests appropriately verify:
- Extension widgets are removed after clearing
- Core widgets remain unaffected
This separation is essential for the extension system's isolation.
149-173: LGTM! Essential widget classification tests are complete.Test coverage includes:
- Essential core widgets (int, float, combo, boolean)
- Non-essential core widgets (button, color)
- Unknown types
- Extension widgets (correctly return false as they don't inherit essential status)
175-195: LGTM! Rendering logic tests are complete.Tests validate all combinations of the rendering conditions:
- Presence/absence of
typecanvasOnlyflag values (true, false, undefined)
197-218: LGTM! Expansion logic tests are thorough.Tests validate:
- All expanding types (textarea, markdown, load3D)
- Case-insensitive alias resolution (uppercase variants)
- Non-expanding types correctly return false
src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts (6)
8-8: LGTM! Clean separation of core and extension widget storage.The refactoring properly:
- Separates immutable core widgets from mutable extension widgets
- Maintains separate alias maps for each category
- Documents the distinction with clear comments
- Follows type import conventions
This separation is essential for the extension precedence logic.
Also applies to: 168-181
183-196: LGTM! Registration API is well-designed.The function correctly:
- Documents extension widget precedence in JSDoc
- Accepts type-safe widget definitions
- Handles optional aliases with nullish coalescing
- Allows overwriting previous registrations (expected behavior for extensions)
198-204: LGTM! Cleanup function is straightforward.The function correctly clears both extension widget maps, ensuring complete cleanup for testing and potential hot-reload scenarios without affecting core widgets.
206-208: LGTM! Alias resolution correctly prioritizes extensions.The precedence chain
extensionAliasMap → coreAliasMap → typeensures extension aliases override core aliases, which is the intended behavior for the extension system.
245-248: LGTM! Essential check correctly limited to core widgets.The function properly:
- Checks only
coreWidgetsfor essential status- Returns false for extension widgets (which don't have an essential property)
- Uses
getCanonicalTypefor alias resolution before lookupThis ensures extension widgets cannot be marked as essential, maintaining the integrity of the core widget classification.
210-243: Current implementation is correct; displayHint already falls back to type-based resolution.When a
displayHintdoesn't match an extension widget, the function continues to type-based resolution. This means a display hint for an unknown widget will correctly fall back to the core widget for that type. The existing test (widgetRegistry.test.ts:117-120) validates this behavior—getComponent('int', 'test', 'unknown_display')returns the coreintwidget, not null.The current design is intentional:
displayHintallows extensions to override widget rendering, but if no extension widget matches, the normal type-based precedence (extensionWidgets→coreWidgets) applies. No changes needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
🧰 Additional context used
📓 Path-based instructions (8)
src/**/*.{vue,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{vue,ts}: Leverage VueUse functions for performance-enhancing styles
Implement proper error handling
Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
src/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/*.{ts,tsx,vue}: Sanitize HTML with DOMPurify to prevent XSS attacks
Avoid using @ts-expect-error; use proper TypeScript types instead
Use es-toolkit for utility functions instead of other utility libraries
Implement proper TypeScript types throughout the codebase
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Follow Vue 3 composition API style guide
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,vue}: Use TypeScript exclusively; do not write new JavaScript code
Use sorted and grouped imports organized by plugin/source
Enforce ESLint rules including Vue + TypeScript rules, disallow floating promises, disallow unused imports, and restrict i18n raw text in templates
Do not useanytype oras anytype assertions; fix the underlying type issue instead
Write code that is expressive and self-documenting; avoid redundant comments and clean as you go
Keep functions short and functional; minimize nesting and follow the arrow anti-pattern
Avoid mutable state; prefer immutability and assignment at point of declaration
Use function declarations instead of function expressions when possible
Use es-toolkit for utility functions
Implement proper error handling in code
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
**/*.{ts,tsx,vue,js,jsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Prettier formatting with 2-space indentation, single quotes, no trailing semicolons, and 80-character line width
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.test.ts: Use unit/component tests intests-ui/orsrc/**/*.test.tswith Vitest framework
For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Do not write change detector tests or tests dependent on non-behavioral features like utility classes or styles
Aim for behavioral coverage of critical and new features in unit tests
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Minimize the surface area (exported values) of each module and composable
Files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
🧠 Learnings (17)
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Write tests for new features
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Mock external dependencies in tests
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Always prefer vitest mock functions over writing verbose manual mocks
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Follow existing test patterns in the codebase
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Use unit/component tests in `tests-ui/` or `src/**/*.test.ts` with Vitest framework
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Use existing test utilities rather than writing custom utilities
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{test,spec}.{ts,tsx} : Use provided test helpers `createTestSubgraph` and `createTestSubgraphNode` from `./fixtures/subgraphHelpers` for consistent subgraph test setup
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-22T21:36:38.905Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: tests-ui/tests/platform/cloud/subscription/components/SubscriptionPanel.test.ts:189-194
Timestamp: 2025-12-22T21:36:38.905Z
Learning: In the Comfy-Org/ComfyUI_frontend repository test files: Do not stub primitive UI components or customized primitive components (e.g., Button). Instead, import and register the real components in test setup. This ensures tests accurately reflect production behavior and component API usage.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Check tests-ui/README.md for test guidelines
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:09.318Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .cursor/rules/unit-test.mdc:0-0
Timestamp: 2025-11-24T19:48:09.318Z
Learning: Applies to test/**/*.{test,spec}.{js,ts,jsx,tsx} : Mocks should be cleanly written and easy to understand, with reusable mocks where possible
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-11-24T19:48:09.318Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .cursor/rules/unit-test.mdc:0-0
Timestamp: 2025-11-24T19:48:09.318Z
Learning: Applies to test/**/*.{test,spec}.{js,ts,jsx,tsx} : Prefer the use of `test.extend` over loose variables; import `test as baseTest` from `vitest`
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-09T03:39:54.501Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7169
File: src/platform/remote/comfyui/jobs/jobTypes.ts:1-107
Timestamp: 2025-12-09T03:39:54.501Z
Learning: In the ComfyUI_frontend project, Zod is on v3.x. Do not suggest Zod v4 standalone validators (z.uuid, z.ulid, z.cuid2, z.nanoid) until an upgrade to Zod 4 is performed. When reviewing TypeScript files (e.g., src/platform/remote/comfyui/jobs/jobTypes.ts) validate against Zod 3 capabilities and avoid introducing v4-specific features; flag any proposal to upgrade or incorporate v4-only validators and propose staying with compatible 3.x patterns.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-13T11:03:11.264Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7416
File: src/stores/imagePreviewStore.ts:5-7
Timestamp: 2025-12-13T11:03:11.264Z
Learning: In the ComfyUI_frontend repository, lint rules require keeping 'import type' statements separate from non-type imports, even if importing from the same module. Do not suggest consolidating them into a single import statement. Ensure type imports remain on their own line (import type { ... } from 'module') and regular imports stay on separate lines.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-17T00:40:09.635Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.stories.ts:45-55
Timestamp: 2025-12-17T00:40:09.635Z
Learning: Prefer pure function declarations over function expressions (e.g., use function foo() { ... } instead of const foo = () => { ... }) for pure functions in the repository. Function declarations are more functional-leaning, offer better hoisting clarity, and can improve readability and tooling consistency. Apply this guideline across TypeScript files in Comfy-Org/ComfyUI_frontend, including story and UI component code, except where a function expression is semantically required (e.g., callbacks, higher-order functions with closures).
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-10T03:09:13.807Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7303
File: src/components/topbar/CurrentUserPopover.test.ts:199-205
Timestamp: 2025-12-10T03:09:13.807Z
Learning: In test files, prefer selecting or asserting on accessible properties (text content, aria-label, role, accessible name) over data-testid attributes. This ensures tests validate actual user-facing behavior and accessibility, reducing reliance on implementation details like test IDs.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
📚 Learning: 2025-12-11T12:25:15.470Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7358
File: src/components/dialog/content/signin/SignUpForm.vue:45-54
Timestamp: 2025-12-11T12:25:15.470Z
Learning: This repository uses CI automation to format code (pnpm format). Do not include manual formatting suggestions in code reviews for Comfy-Org/ComfyUI_frontend. If formatting issues are detected, rely on the CI formatter or re-run pnpm format. Focus reviews on correctness, readability, performance, accessibility, and maintainability rather than style formatting.
Applied to files:
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
🧬 Code graph analysis (1)
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts (1)
src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts (6)
clearExtensionWidgets(201-204)registerVueWidgets(187-196)getComponent(210-243)isEssential(245-248)shouldRenderAsVue(250-252)shouldExpand(256-261)
🔇 Additional comments (7)
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts (7)
17-20: LGTM! Proper test isolation.The
afterEachhook correctly clears extension widgets between tests, ensuring test isolation and preventing interdependencies.
58-122: LGTM! Comprehensive getComponent test coverage.This test block thoroughly validates the component resolution logic, including:
- Unknown type handling
- Core widget retrieval
- Extension widget precedence over core widgets
- Alias resolution with proper precedence
- Display hint matching and fallback behavior
The tests correctly verify the precedence chain: displayHint → extension widgets → core widgets.
124-146: LGTM! Clear separation verified.The tests correctly verify that
clearExtensionWidgetsonly affects extension widgets without impacting core widget registrations, ensuring proper isolation between the two widget sources.
148-172: LGTM! Essential widget logic validated.The tests properly verify that:
- Core widgets maintain their essential/non-essential status
- Unknown types safely return false
- Extension widgets are not marked as essential (correct default behavior)
174-194: LGTM! Rendering decision logic validated.The tests comprehensively cover the
shouldRenderAsVuelogic, verifying that widgets are correctly identified for Vue rendering based on the presence of a type and thecanvasOnlyflag.
196-217: LGTM! Expansion logic validated with case handling.The tests properly verify the
shouldExpandbehavior for all expanding types (textarea, markdown, load3D) and include both lowercase and uppercase variants, confirming that canonical type resolution works correctly.
13-15: Consider usingmarkRawfor mock components.While the current approach works for testing the registry's storage/retrieval logic, using Vue's
markRawwould be more type-safe and avoid the type assertion:import { markRaw } from 'vue' const MockComponent = markRaw({ name: 'MockComponent' }) as Component const MockComponent2 = markRaw({ name: 'MockComponent2' }) as ComponentThis ensures the objects are properly treated as non-reactive Vue components while maintaining type safety.
⛔ Skipped due to learnings
Learnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-12-21T06:04:12.548Z Learning: Applies to **/*.test.ts : For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test filesLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: tests-ui/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:48:03.270Z Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Always prefer vitest mock functions over writing verbose manual mocksLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: .cursor/rules/unit-test.mdc:0-0 Timestamp: 2025-11-24T19:48:09.318Z Learning: Applies to test/**/*.{test,spec}.{js,ts,jsx,tsx} : Mocks should be cleanly written and easy to understand, with reusable mocks where possibleLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: tests-ui/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:48:03.270Z Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Mock external dependencies in testsLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-12-21T06:04:12.548Z Learning: Applies to **/*.test.ts : Use unit/component tests in `tests-ui/` or `src/**/*.test.ts` with Vitest frameworkLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: tests-ui/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:48:03.270Z Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Write tests for new featuresLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: .cursor/rules/unit-test.mdc:0-0 Timestamp: 2025-11-24T19:48:09.318Z Learning: Applies to test/**/*.{test,spec}.{js,ts,jsx,tsx} : Prefer the use of `test.extend` over loose variables; import `test as baseTest` from `vitest`Learnt from: DrJKL Repo: Comfy-Org/ComfyUI_frontend PR: 7649 File: tests-ui/tests/platform/cloud/subscription/components/SubscriptionPanel.test.ts:189-194 Timestamp: 2025-12-22T21:36:38.905Z Learning: In the Comfy-Org/ComfyUI_frontend repository test files: Do not stub primitive UI components or customized primitive components (e.g., Button). Instead, import and register the real components in test setup. This ensures tests accurately reflect production behavior and component API usage.Learnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: tests-ui/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:48:03.270Z Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Follow existing test patterns in the codebaseLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: src/lib/litegraph/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:47:56.371Z Learning: Applies to src/lib/litegraph/**/*.{test,spec}.{ts,tsx} : Use provided test helpers `createTestSubgraph` and `createTestSubgraphNode` from `./fixtures/subgraphHelpers` for consistent subgraph test setupLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: src/components/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:47:45.616Z Learning: Applies to src/components/**/*.vue : Use provide/inject for dependency injection in Vue componentsLearnt from: CR Repo: Comfy-Org/ComfyUI_frontend PR: 0 File: src/components/CLAUDE.md:0-0 Timestamp: 2025-11-24T19:47:45.616Z Learning: Applies to src/components/**/*.vue : Define proper props and emits definitions in Vue components
src/renderer/extensions/vueNodes/widgets/registry/__tests__/widgetRegistry.test.ts
Show resolved
Hide resolved
| } | ||
|
|
||
| export function exposeVueApi(): void { | ||
| window.Vue = Vue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this solution could work properly, but as my https://github.com/jtydhr88/ComfyUI_frontend_vue_basic is official example for extension developer, we need to make sure this sure this solution can work with example.
Or I will suggest we skip this change in this PR and work on it in another PR.
- Remove nested if check in getCustomVueWidgets registration by capturing method reference before async IIFE - Export VueWidgets type for use by external extension code
Summary
getCustomVueWidgets()extension hook for registering Vue SFC widgetswindow.Vuefor extension developersdisplayfield in Python input definitions for custom widget type hintsTest plan
widgetRegistry.test.ts)test_vue_widget_nodeextension┆Issue is synchronized with this Notion page by Unito