mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
fix: type error
This commit is contained in:
@@ -93,7 +93,8 @@ const currentColor = computed(() =>
|
||||
currentColorOption.value
|
||||
? isLightTheme.value
|
||||
? colorOptions.value.find(
|
||||
(option) => option.value.dark === currentColorOption.value?.bgcolor
|
||||
(option: NodeColorOption) =>
|
||||
option.value.dark === currentColorOption.value?.bgcolor
|
||||
)?.value.light
|
||||
: currentColorOption.value?.bgcolor
|
||||
: null
|
||||
@@ -102,7 +103,7 @@ const currentColor = computed(() =>
|
||||
const localizedCurrentColorName = computed(() => {
|
||||
if (!currentColorOption.value?.bgcolor) return null
|
||||
const colorOption = colorOptions.value.find(
|
||||
(option) =>
|
||||
(option: NodeColorOption) =>
|
||||
option.value.dark === currentColorOption.value?.bgcolor ||
|
||||
option.value.light === currentColorOption.value?.bgcolor
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useWorkflowStore } from '@/platform/workflow/management/stores/workflow
|
||||
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
||||
|
||||
import { useCanvasRefresh } from './useCanvasRefresh'
|
||||
import type { NodeColorOption } from './useNodeColorOptions'
|
||||
import type { MenuOption } from './useMoreOptionsMenu'
|
||||
import { useNodeCustomization } from './useNodeCustomization'
|
||||
|
||||
@@ -65,7 +66,7 @@ export function useGroupMenuOptions() {
|
||||
label: t('contextMenu.Color'),
|
||||
icon: 'icon-[lucide--palette]',
|
||||
hasSubmenu: true,
|
||||
submenu: colorOptions.value.map((colorOption) => ({
|
||||
submenu: colorOptions.value.map((colorOption: NodeColorOption) => ({
|
||||
label:
|
||||
typeof colorOption.localizedName === 'function'
|
||||
? colorOption.localizedName()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { ComputedRef } from 'vue'
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
@@ -30,7 +29,7 @@ export interface NodeColorOption {
|
||||
/**
|
||||
* Configuration for useNodeColorOptions composable
|
||||
*/
|
||||
export interface UseNodeColorOptionsConfig {
|
||||
interface UseNodeColorOptionsConfig {
|
||||
/**
|
||||
* Whether to include ring color variants for UI elements like borders
|
||||
* @default false
|
||||
@@ -56,18 +55,6 @@ export interface UseNodeColorOptionsConfig {
|
||||
localizedNameAsFunction?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type for useNodeColorOptions composable
|
||||
*/
|
||||
export interface UseNodeColorOptionsReturn {
|
||||
colorOptions: ComputedRef<NodeColorOption[]>
|
||||
NO_COLOR_OPTION: ComputedRef<NodeColorOption>
|
||||
getColorValue: (color: string) => ColorVariants
|
||||
applyColorToItems: (items: IColorable[], colorName: string) => void
|
||||
getCurrentColorName: (items: IColorable[]) => string | null
|
||||
isLightTheme: ComputedRef<boolean>
|
||||
}
|
||||
|
||||
/**
|
||||
* Composable for managing node color options with flexible configuration.
|
||||
* Consolidates color picker logic across SetNodeColor, ColorPickerButton, and useNodeCustomization.
|
||||
@@ -87,9 +74,7 @@ export interface UseNodeColorOptionsReturn {
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export function useNodeColorOptions(
|
||||
config: UseNodeColorOptionsConfig = {}
|
||||
): UseNodeColorOptionsReturn {
|
||||
export function useNodeColorOptions(config: UseNodeColorOptionsConfig = {}) {
|
||||
const {
|
||||
includeRingColors = false,
|
||||
lightnessAdjustments = {},
|
||||
|
||||
@@ -95,8 +95,9 @@ export function useNodeCustomization() {
|
||||
if (!currentColorName) return null
|
||||
|
||||
return (
|
||||
colorOptions.value.find((option) => option.name === currentColorName) ??
|
||||
NO_COLOR_OPTION.value
|
||||
colorOptions.value.find(
|
||||
(option: NodeColorOption) => option.name === currentColorName
|
||||
) ?? NO_COLOR_OPTION.value
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import type { NodeColorOption } from './useNodeColorOptions'
|
||||
import type { MenuOption } from './useMoreOptionsMenu'
|
||||
import { useNodeCustomization } from './useNodeCustomization'
|
||||
import { useSelectedNodeActions } from './useSelectedNodeActions'
|
||||
@@ -29,7 +30,7 @@ export function useNodeMenuOptions() {
|
||||
)
|
||||
|
||||
const colorSubmenu = computed(() => {
|
||||
return colorOptions.value.map((colorOption) => ({
|
||||
return colorOptions.value.map((colorOption: NodeColorOption) => ({
|
||||
label:
|
||||
typeof colorOption.localizedName === 'function'
|
||||
? colorOption.localizedName()
|
||||
|
||||
Reference in New Issue
Block a user