mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
Remove entry point import, merge modules (#590)
* Remove unused import in lib entry point * [Refactor] Merge type util modules
This commit is contained in:
@@ -22,7 +22,6 @@ import type {
|
|||||||
ColorOption,
|
ColorOption,
|
||||||
IColorable,
|
IColorable,
|
||||||
} from "./interfaces"
|
} from "./interfaces"
|
||||||
import { isColorable } from "./typeGuards"
|
|
||||||
import type { SlotShape, LabelPosition, SlotDirection, SlotType } from "./draw"
|
import type { SlotShape, LabelPosition, SlotDirection, SlotType } from "./draw"
|
||||||
import type { IWidget } from "./types/widgets"
|
import type { IWidget } from "./types/widgets"
|
||||||
import type { RenderShape, TitleMode } from "./types/globalEnums"
|
import type { RenderShape, TitleMode } from "./types/globalEnums"
|
||||||
@@ -75,8 +74,8 @@ export {
|
|||||||
Size,
|
Size,
|
||||||
ColorOption,
|
ColorOption,
|
||||||
IColorable,
|
IColorable,
|
||||||
isColorable,
|
|
||||||
}
|
}
|
||||||
|
export { isColorable } from "./utils/type"
|
||||||
export { IWidget }
|
export { IWidget }
|
||||||
export { LGraphBadge, BadgePosition }
|
export { LGraphBadge, BadgePosition }
|
||||||
export { SlotShape, LabelPosition, SlotDirection, SlotType }
|
export { SlotShape, LabelPosition, SlotDirection, SlotType }
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import { IColorable } from "@/interfaces"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if an object is an instance of {@link IColorable}.
|
|
||||||
*/
|
|
||||||
export const isColorable = (obj: unknown): obj is IColorable => {
|
|
||||||
return typeof obj === "object" && obj !== null && "setColorOption" in obj && "getColorOption" in obj
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { IColorable } from "@/interfaces"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a plain object to a class instance if it is not already an instance of the class.
|
* Converts a plain object to a class instance if it is not already an instance of the class.
|
||||||
* @param cls The class to convert to
|
* @param cls The class to convert to
|
||||||
@@ -7,3 +9,10 @@
|
|||||||
export function toClass<P, C>(cls: new (plain: P) => C, obj: P | C): C {
|
export function toClass<P, C>(cls: new (plain: P) => C, obj: P | C): C {
|
||||||
return obj instanceof cls ? obj : new cls(obj as P)
|
return obj instanceof cls ? obj : new cls(obj as P)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if an object is an instance of {@link IColorable}.
|
||||||
|
*/
|
||||||
|
export const isColorable = (obj: unknown): obj is IColorable => {
|
||||||
|
return typeof obj === "object" && obj !== null && "setColorOption" in obj && "getColorOption" in obj
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user