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