mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 10:59:53 +00:00
Knip: More Pruning (#5374)
* knip: Don't ignore exports that are only used within a given file * knip: More pruning after rebase * knip: Vite plugin config fix * knip: vitest plugin config * knip: Playwright config, remove unnecessary ignores. * knip: Simplify project file enumeration. * knip: simplify the config file patterns ?(.optional_segment) * knip: tailwind v4 fix * knip: A little more, explain some of the deps. Should be good for this PR. * knip: remove unused disabling of classMembers. It's opt-in, which we should probably do. * knip: floating comments We should probably delete _one_ of these parallell trees, right? * knip: Add additional entrypoints * knip: Restore UserData that's exposed via the types for now. * knip: Add as an entry file even though knip says it's not necessary. * knip: re-export functions used by nodes (h/t @christian-byrne)
This commit is contained in:
@@ -10,7 +10,7 @@ import type { Position } from './types'
|
||||
* - {@link Mouse.move}
|
||||
* - {@link Mouse.up}
|
||||
*/
|
||||
export interface DragOptions {
|
||||
interface DragOptions {
|
||||
button?: 'left' | 'right' | 'middle'
|
||||
clickCount?: number
|
||||
steps?: number
|
||||
|
||||
@@ -134,7 +134,7 @@ export class SubgraphSlotReference {
|
||||
}
|
||||
}
|
||||
|
||||
export class NodeSlotReference {
|
||||
class NodeSlotReference {
|
||||
constructor(
|
||||
readonly type: 'input' | 'output',
|
||||
readonly index: number,
|
||||
@@ -201,7 +201,7 @@ export class NodeSlotReference {
|
||||
}
|
||||
}
|
||||
|
||||
export class NodeWidgetReference {
|
||||
class NodeWidgetReference {
|
||||
constructor(
|
||||
readonly index: number,
|
||||
readonly node: NodeReference
|
||||
|
||||
@@ -2,84 +2,56 @@ import type { KnipConfig } from 'knip'
|
||||
|
||||
const config: KnipConfig = {
|
||||
entry: [
|
||||
'build/**/*.ts',
|
||||
'scripts/**/*.{js,ts}',
|
||||
'{build,scripts}/**/*.{js,ts}',
|
||||
'src/assets/css/style.css',
|
||||
'src/main.ts',
|
||||
'vite.electron.config.mts',
|
||||
'vite.types.config.mts'
|
||||
],
|
||||
project: [
|
||||
'browser_tests/**/*.{js,ts}',
|
||||
'build/**/*.{js,ts,vue}',
|
||||
'scripts/**/*.{js,ts}',
|
||||
'src/**/*.{js,ts,vue}',
|
||||
'tests-ui/**/*.{js,ts,vue}',
|
||||
'*.{js,ts,mts}'
|
||||
'src/scripts/ui/menu/index.ts',
|
||||
'src/types/index.ts'
|
||||
],
|
||||
project: ['**/*.{js,ts,vue}', '*.{js,ts,mts}'],
|
||||
ignoreBinaries: ['only-allow', 'openapi-typescript'],
|
||||
ignoreDependencies: [
|
||||
// Weird importmap things
|
||||
'@iconify/json',
|
||||
'@primeuix/forms',
|
||||
'@primeuix/styled',
|
||||
'@primeuix/utils',
|
||||
'@primevue/icons',
|
||||
'@iconify/json',
|
||||
'tailwindcss',
|
||||
'tailwindcss-primeui', // Need to figure out why tailwind plugin isn't applying
|
||||
// Dev
|
||||
'@trivago/prettier-plugin-sort-imports'
|
||||
],
|
||||
ignore: [
|
||||
// Generated files
|
||||
'dist/**',
|
||||
'types/**',
|
||||
'node_modules/**',
|
||||
// Config files that might not show direct usage
|
||||
'.husky/**',
|
||||
// Temporary or cache files
|
||||
'.vite/**',
|
||||
'coverage/**',
|
||||
// i18n config
|
||||
'.i18nrc.cjs',
|
||||
// Vitest litegraph config
|
||||
'vitest.litegraph.config.ts',
|
||||
// Test setup files
|
||||
'browser_tests/globalSetup.ts',
|
||||
'browser_tests/globalTeardown.ts',
|
||||
'browser_tests/utils/**',
|
||||
// Scripts
|
||||
'scripts/**',
|
||||
// Vite config files
|
||||
'vite.electron.config.mts',
|
||||
'vite.types.config.mts',
|
||||
// Auto generated manager types
|
||||
'src/types/generatedManagerTypes.ts',
|
||||
// Design system components (may not be used immediately)
|
||||
'src/components/button/IconGroup.vue',
|
||||
'src/components/button/MoreButton.vue',
|
||||
'src/components/button/TextButton.vue',
|
||||
'src/components/card/CardTitle.vue',
|
||||
'src/components/card/CardDescription.vue',
|
||||
'src/components/input/SingleSelect.vue',
|
||||
'src/types/comfyRegistryTypes.ts',
|
||||
// Used by a custom node (that should move off of this)
|
||||
'src/scripts/ui/components/splitButton.ts',
|
||||
// Generated file: openapi
|
||||
'src/types/comfyRegistryTypes.ts'
|
||||
'src/scripts/ui/components/splitButton.ts'
|
||||
],
|
||||
ignoreExportsUsedInFile: true,
|
||||
// Vue-specific configuration
|
||||
vue: true,
|
||||
tailwind: true,
|
||||
// Only check for unused files, disable all other rules
|
||||
// TODO: Gradually enable other rules - see https://github.com/Comfy-Org/ComfyUI_frontend/issues/4888
|
||||
rules: {
|
||||
classMembers: 'off'
|
||||
compilers: {
|
||||
// https://github.com/webpro-nl/knip/issues/1008#issuecomment-3207756199
|
||||
css: (text: string) =>
|
||||
[
|
||||
...text.replaceAll('plugin', 'import').matchAll(/(?<=@)import[^;]+/g)
|
||||
].join('\n')
|
||||
},
|
||||
vite: {
|
||||
config: ['vite?(.*).config.mts']
|
||||
},
|
||||
vitest: {
|
||||
config: ['vitest?(.*).config.ts'],
|
||||
entry: [
|
||||
'**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)',
|
||||
'**/__mocks__/**/*.[jt]s?(x)'
|
||||
]
|
||||
},
|
||||
playwright: {
|
||||
config: ['playwright?(.*).config.ts'],
|
||||
entry: ['**/*.@(spec|test).?(c|m)[jt]s?(x)', 'browser_tests/**/*.ts']
|
||||
},
|
||||
tags: [
|
||||
'-knipIgnoreUnusedButUsedByCustomNodes',
|
||||
'-knipIgnoreUnusedButUsedByVueNodesBranch'
|
||||
],
|
||||
// Include dependencies analysis
|
||||
includeEntryExports: true
|
||||
]
|
||||
}
|
||||
|
||||
export default config
|
||||
|
||||
@@ -2,12 +2,12 @@ import { type ComputedRef, computed } from 'vue'
|
||||
|
||||
import { type ComfyCommandImpl } from '@/stores/commandStore'
|
||||
|
||||
export type SubcategoryRule = {
|
||||
type SubcategoryRule = {
|
||||
pattern: string | RegExp
|
||||
subcategory: string
|
||||
}
|
||||
|
||||
export type SubcategoryConfig = {
|
||||
type SubcategoryConfig = {
|
||||
defaultSubcategory: string
|
||||
rules: SubcategoryRule[]
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ function intersect(a: Rect, b: Rect): [number, number, number, number] | null {
|
||||
return [x1, y1, x2 - x1, y2 - y1]
|
||||
}
|
||||
|
||||
export interface ClippingOptions {
|
||||
interface ClippingOptions {
|
||||
margin?: number
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { onUnmounted, ref } from 'vue'
|
||||
|
||||
import type { LGraphCanvas } from '../../lib/litegraph/src/litegraph'
|
||||
|
||||
export interface CanvasTransformSyncOptions {
|
||||
interface CanvasTransformSyncOptions {
|
||||
/**
|
||||
* Whether to automatically start syncing when canvas is available
|
||||
* @default true
|
||||
@@ -10,7 +10,7 @@ export interface CanvasTransformSyncOptions {
|
||||
autoStart?: boolean
|
||||
}
|
||||
|
||||
export interface CanvasTransformSyncCallbacks {
|
||||
interface CanvasTransformSyncCallbacks {
|
||||
/**
|
||||
* Called when sync starts
|
||||
*/
|
||||
|
||||
@@ -19,14 +19,14 @@ export interface NodeState {
|
||||
culled: boolean
|
||||
}
|
||||
|
||||
export interface NodeMetadata {
|
||||
interface NodeMetadata {
|
||||
lastRenderTime: number
|
||||
cachedBounds: DOMRect | null
|
||||
lodLevel: 'high' | 'medium' | 'low'
|
||||
spatialIndex?: QuadTree<string>
|
||||
}
|
||||
|
||||
export interface PerformanceMetrics {
|
||||
interface PerformanceMetrics {
|
||||
fps: number
|
||||
frameTime: number
|
||||
updateTime: number
|
||||
@@ -60,12 +60,12 @@ export interface VueNodeData {
|
||||
}
|
||||
}
|
||||
|
||||
export interface SpatialMetrics {
|
||||
interface SpatialMetrics {
|
||||
queryTime: number
|
||||
nodesInIndex: number
|
||||
}
|
||||
|
||||
export interface GraphNodeManager {
|
||||
interface GraphNodeManager {
|
||||
// Reactive state - safe data extracted from LiteGraph nodes
|
||||
vueNodeData: ReadonlyMap<string, VueNodeData>
|
||||
nodeState: ReadonlyMap<string, NodeState>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useDebounceFn, useEventListener, useThrottleFn } from '@vueuse/core'
|
||||
import { ref } from 'vue'
|
||||
import type { MaybeRefOrGetter } from 'vue'
|
||||
|
||||
export interface TransformSettlingOptions {
|
||||
interface TransformSettlingOptions {
|
||||
/**
|
||||
* Delay in ms before transform is considered "settled" after last interaction
|
||||
* @default 200
|
||||
|
||||
@@ -6,10 +6,7 @@ import { type Ref, ref, watch } from 'vue'
|
||||
|
||||
import type { SimplifiedWidget, WidgetValue } from '@/types/simplifiedWidget'
|
||||
|
||||
export interface UseWidgetValueOptions<
|
||||
T extends WidgetValue = WidgetValue,
|
||||
U = T
|
||||
> {
|
||||
interface UseWidgetValueOptions<T extends WidgetValue = WidgetValue, U = T> {
|
||||
/** The widget configuration from LiteGraph */
|
||||
widget: SimplifiedWidget<T>
|
||||
/** The current value from parent component */
|
||||
@@ -22,10 +19,7 @@ export interface UseWidgetValueOptions<
|
||||
transform?: (value: U) => T
|
||||
}
|
||||
|
||||
export interface UseWidgetValueReturn<
|
||||
T extends WidgetValue = WidgetValue,
|
||||
U = T
|
||||
> {
|
||||
interface UseWidgetValueReturn<T extends WidgetValue = WidgetValue, U = T> {
|
||||
/** Local value for immediate UI updates */
|
||||
localValue: Ref<T>
|
||||
/** Handler for user interactions */
|
||||
|
||||
@@ -35,7 +35,7 @@ const createContainer = () => {
|
||||
const createTimeout = (ms: number) =>
|
||||
new Promise<null>((resolve) => setTimeout(() => resolve(null), ms))
|
||||
|
||||
export const useNodePreview = <T extends MediaElement>(
|
||||
const useNodePreview = <T extends MediaElement>(
|
||||
node: LGraphNode,
|
||||
options: NodePreviewOptions<T>
|
||||
) => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { type ComputedRef, ref } from 'vue'
|
||||
import { useChainCallback } from '@/composables/functional/useChainCallback'
|
||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||
|
||||
export interface UseComputedWithWidgetWatchOptions {
|
||||
interface UseComputedWithWidgetWatchOptions {
|
||||
/**
|
||||
* Names of widgets to observe for changes.
|
||||
* If not provided, all widgets will be observed.
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { components } from '@/types/comfyRegistryTypes'
|
||||
|
||||
type NodePack = components['schemas']['Node']
|
||||
|
||||
export type SelectionState = 'all-installed' | 'none-installed' | 'mixed'
|
||||
type SelectionState = 'all-installed' | 'none-installed' | 'mixed'
|
||||
|
||||
/**
|
||||
* Composable for managing multi-package selection states
|
||||
|
||||
@@ -4,7 +4,7 @@ import { paramsToCacheKey } from '@/utils/formatUtil'
|
||||
|
||||
const DEFAULT_MAX_SIZE = 50
|
||||
|
||||
export interface CachedRequestOptions {
|
||||
interface CachedRequestOptions {
|
||||
/**
|
||||
* Maximum number of items to store in the cache
|
||||
* @default 50
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import { useVersionCompatibilityStore } from '@/stores/versionCompatibilityStore'
|
||||
|
||||
export interface UseFrontendVersionMismatchWarningOptions {
|
||||
interface UseFrontendVersionMismatchWarningOptions {
|
||||
immediate?: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { type Ref, onBeforeUnmount, ref, watch } from 'vue'
|
||||
|
||||
export interface UseIntersectionObserverOptions
|
||||
extends IntersectionObserverInit {
|
||||
interface UseIntersectionObserverOptions extends IntersectionObserverInit {
|
||||
immediate?: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type Ref, computed, ref, shallowRef, watch } from 'vue'
|
||||
|
||||
export interface LazyPaginationOptions {
|
||||
interface LazyPaginationOptions {
|
||||
itemsPerPage?: number
|
||||
initialPage?: number
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { validateComfyWorkflow } from '@/schemas/comfyWorkflowSchema'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import { fixBadLinks } from '@/utils/linkFixer'
|
||||
|
||||
export interface ValidationResult {
|
||||
interface ValidationResult {
|
||||
graphData: ComfyWorkflowJSON | null
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Default colors for node slot types
|
||||
* Mirrors LiteGraph's slot_default_color_by_type
|
||||
*/
|
||||
export const SLOT_TYPE_COLORS: Record<string, string> = {
|
||||
const SLOT_TYPE_COLORS: Record<string, string> = {
|
||||
number: '#AAD',
|
||||
string: '#DCA',
|
||||
boolean: '#DAA',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* All supported image formats that can contain workflow data
|
||||
*/
|
||||
export const IMAGE_WORKFLOW_FORMATS = {
|
||||
const IMAGE_WORKFLOW_FORMATS = {
|
||||
extensions: ['.png', '.webp', '.svg', '.avif'],
|
||||
mimeTypes: ['image/png', 'image/webp', 'image/svg+xml', 'image/avif']
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export const IMAGE_WORKFLOW_FORMATS = {
|
||||
/**
|
||||
* All supported audio formats that can contain workflow data
|
||||
*/
|
||||
export const AUDIO_WORKFLOW_FORMATS = {
|
||||
const AUDIO_WORKFLOW_FORMATS = {
|
||||
extensions: ['.mp3', '.ogg', '.flac'],
|
||||
mimeTypes: ['audio/mpeg', 'audio/ogg', 'audio/flac', 'audio/x-flac']
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export const AUDIO_WORKFLOW_FORMATS = {
|
||||
/**
|
||||
* All supported video formats that can contain workflow data
|
||||
*/
|
||||
export const VIDEO_WORKFLOW_FORMATS = {
|
||||
const VIDEO_WORKFLOW_FORMATS = {
|
||||
extensions: ['.mp4', '.mov', '.m4v', '.webm'],
|
||||
mimeTypes: ['video/mp4', 'video/quicktime', 'video/x-m4v', 'video/webm']
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export const VIDEO_WORKFLOW_FORMATS = {
|
||||
/**
|
||||
* All supported 3D model formats that can contain workflow data
|
||||
*/
|
||||
export const MODEL_WORKFLOW_FORMATS = {
|
||||
const MODEL_WORKFLOW_FORMATS = {
|
||||
extensions: ['.glb'],
|
||||
mimeTypes: ['model/gltf-binary']
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export const MODEL_WORKFLOW_FORMATS = {
|
||||
/**
|
||||
* All supported data formats that directly contain workflow data
|
||||
*/
|
||||
export const DATA_WORKFLOW_FORMATS = {
|
||||
const DATA_WORKFLOW_FORMATS = {
|
||||
extensions: ['.json', '.latent', '.safetensors'],
|
||||
mimeTypes: ['application/json']
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export const DATA_WORKFLOW_FORMATS = {
|
||||
/**
|
||||
* Combines all supported formats into a single object
|
||||
*/
|
||||
export const ALL_WORKFLOW_FORMATS = {
|
||||
const ALL_WORKFLOW_FORMATS = {
|
||||
extensions: [
|
||||
...IMAGE_WORKFLOW_FORMATS.extensions,
|
||||
...AUDIO_WORKFLOW_FORMATS.extensions,
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface CaptureResult {
|
||||
lineart: string
|
||||
}
|
||||
|
||||
export interface BaseManager {
|
||||
interface BaseManager {
|
||||
init(): void
|
||||
dispose(): void
|
||||
reset(): void
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface ImageLayerFilenames {
|
||||
interface ImageLayerFilenames {
|
||||
maskedImage: string
|
||||
paint: string
|
||||
paintedImage: string
|
||||
|
||||
@@ -165,7 +165,7 @@ interface IDialogOptions {
|
||||
}
|
||||
|
||||
/** @inheritdoc {@link LGraphCanvas.state} */
|
||||
export interface LGraphCanvasState {
|
||||
interface LGraphCanvasState {
|
||||
/** {@link Positionable} items are being dragged on the canvas. */
|
||||
draggingItems: boolean
|
||||
/** The canvas itself is being dragged. */
|
||||
|
||||
@@ -94,19 +94,19 @@ export type NodeId = number | string
|
||||
|
||||
export type NodeProperty = string | number | boolean | object
|
||||
|
||||
export interface INodePropertyInfo {
|
||||
interface INodePropertyInfo {
|
||||
name: string
|
||||
type?: string
|
||||
default_value: NodeProperty | undefined
|
||||
}
|
||||
|
||||
export interface IMouseOverData {
|
||||
interface IMouseOverData {
|
||||
inputId?: number
|
||||
outputId?: number
|
||||
overWidget?: IBaseWidget
|
||||
}
|
||||
|
||||
export interface ConnectByTypeOptions {
|
||||
interface ConnectByTypeOptions {
|
||||
/** @deprecated Events */
|
||||
createEventInCase?: boolean
|
||||
/** Allow our wildcard slot to connect to typed slots on remote node. Default: true */
|
||||
@@ -118,12 +118,12 @@ export interface ConnectByTypeOptions {
|
||||
}
|
||||
|
||||
/** Internal type used for type safety when implementing generic checks for inputs & outputs */
|
||||
export interface IGenericLinkOrLinks {
|
||||
interface IGenericLinkOrLinks {
|
||||
links?: INodeOutputSlot['links']
|
||||
link?: INodeInputSlot['link']
|
||||
}
|
||||
|
||||
export interface FindFreeSlotOptions {
|
||||
interface FindFreeSlotOptions {
|
||||
/** Slots matching these types will be ignored. Default: [] */
|
||||
typesNotAccepted?: ISlotType[]
|
||||
/** If true, the slot itself is returned instead of the index. Default: false */
|
||||
|
||||
@@ -44,7 +44,7 @@ import { ToOutputRenderLink } from './ToOutputRenderLink'
|
||||
* References are only held atomically within a function, never passed.
|
||||
* The concrete implementation may be replaced or proxied without side-effects.
|
||||
*/
|
||||
export interface LinkConnectorState {
|
||||
interface LinkConnectorState {
|
||||
/**
|
||||
* The type of slot that links are being connected **to**.
|
||||
* - When `undefined`, no operation is being performed.
|
||||
@@ -68,7 +68,7 @@ type RenderLinkUnion =
|
||||
| ToInputFromIoNodeLink
|
||||
| ToOutputFromIoNodeLink
|
||||
|
||||
export interface LinkConnectorExport {
|
||||
interface LinkConnectorExport {
|
||||
renderLinks: RenderLink[]
|
||||
inputLinks: LLink[]
|
||||
outputLinks: LLink[]
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface IDrawBoundingOptions {
|
||||
lineWidth?: number
|
||||
}
|
||||
|
||||
export interface IDrawTextInAreaOptions {
|
||||
interface IDrawTextInAreaOptions {
|
||||
/** The canvas to draw the text on. */
|
||||
ctx: CanvasRenderingContext2D
|
||||
/** The text to draw. */
|
||||
|
||||
@@ -64,7 +64,7 @@ export interface HasBoundingRect {
|
||||
}
|
||||
|
||||
/** An object containing a set of child objects */
|
||||
export interface Parent<TChild> {
|
||||
interface Parent<TChild> {
|
||||
/** All objects owned by the parent object. */
|
||||
readonly children?: ReadonlySet<TChild>
|
||||
}
|
||||
@@ -210,7 +210,7 @@ export interface LinkSegment {
|
||||
readonly origin_slot: number | undefined
|
||||
}
|
||||
|
||||
export interface IInputOrOutput {
|
||||
interface IInputOrOutput {
|
||||
// If an input, this will be defined
|
||||
input?: INodeInputSlot | null
|
||||
// If an output, this will be defined
|
||||
@@ -273,7 +273,7 @@ export type ReadOnlyTypedArray<T extends TypedArrays | TypedBigIntArrays> =
|
||||
>
|
||||
|
||||
/** Union of property names that are of type Match */
|
||||
export type KeysOfType<T, Match> = Exclude<
|
||||
type KeysOfType<T, Match> = Exclude<
|
||||
{ [P in keyof T]: T[P] extends Match ? P : never }[keyof T],
|
||||
undefined
|
||||
>
|
||||
@@ -445,7 +445,7 @@ export interface IContextMenuValue<
|
||||
): void | boolean
|
||||
}
|
||||
|
||||
export interface IContextMenuSubmenu<TValue = unknown>
|
||||
interface IContextMenuSubmenu<TValue = unknown>
|
||||
extends IContextMenuOptions<TValue> {
|
||||
options: ConstructorParameters<typeof ContextMenu<TValue>>[0]
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { CanvasEventDetail } from './types/events'
|
||||
import type { RenderShape, TitleMode } from './types/globalEnums'
|
||||
|
||||
// Must remain above LiteGraphGlobal (circular dependency due to abstract factory behaviour in `configure`)
|
||||
export { Subgraph, type GraphOrSubgraph } from './subgraph/Subgraph'
|
||||
export { Subgraph } from './subgraph/Subgraph'
|
||||
|
||||
export const LiteGraph = new LiteGraphGlobal()
|
||||
|
||||
@@ -23,7 +23,7 @@ loadPolyfills()
|
||||
/** @deprecated Use {@link Point} instead. */
|
||||
export type Vector2 = Point
|
||||
|
||||
export interface IContextMenuItem {
|
||||
interface IContextMenuItem {
|
||||
content: string
|
||||
callback?: ContextMenuEventListener
|
||||
/** Used as innerHTML for extra child element */
|
||||
@@ -36,7 +36,7 @@ export interface IContextMenuItem {
|
||||
className?: string
|
||||
}
|
||||
|
||||
export type ContextMenuEventListener = (
|
||||
type ContextMenuEventListener = (
|
||||
value: IContextMenuItem,
|
||||
options: IContextMenuOptions,
|
||||
event: MouseEvent,
|
||||
@@ -74,58 +74,38 @@ export interface LGraphNodeConstructor<T extends LGraphNode = LGraphNode> {
|
||||
|
||||
// End backwards compat
|
||||
|
||||
export { InputIndicators } from './canvas/InputIndicators'
|
||||
export { LinkConnector } from './canvas/LinkConnector'
|
||||
export { isOverNodeInput, isOverNodeOutput } from './canvas/measureSlots'
|
||||
export { CanvasPointer } from './CanvasPointer'
|
||||
export * as Constants from './constants'
|
||||
export { SUBGRAPH_INPUT_ID, SUBGRAPH_OUTPUT_ID } from './constants'
|
||||
export { SUBGRAPH_INPUT_ID } from './constants'
|
||||
export { ContextMenu } from './ContextMenu'
|
||||
export { CurveEditor } from './CurveEditor'
|
||||
|
||||
export { DragAndScale } from './DragAndScale'
|
||||
export { LabelPosition, SlotDirection, SlotShape, SlotType } from './draw'
|
||||
export { strokeShape } from './draw'
|
||||
|
||||
export { Rectangle } from './infrastructure/Rectangle'
|
||||
export { RecursionError } from './infrastructure/RecursionError'
|
||||
export type {
|
||||
CanvasColour,
|
||||
ColorOption,
|
||||
ConnectingLink,
|
||||
Direction,
|
||||
IBoundaryNodes,
|
||||
IColorable,
|
||||
IContextMenuOptions,
|
||||
IContextMenuValue,
|
||||
IFoundSlot,
|
||||
IInputOrOutput,
|
||||
INodeFlags,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
INodeSlot,
|
||||
ISlotType,
|
||||
KeysOfType,
|
||||
LinkNetwork,
|
||||
LinkSegment,
|
||||
MethodNames,
|
||||
Point,
|
||||
Positionable,
|
||||
ReadonlyLinkNetwork,
|
||||
ReadOnlyPoint,
|
||||
ReadOnlyRect,
|
||||
Rect,
|
||||
Size
|
||||
} from './interfaces'
|
||||
export { LGraph } from './LGraph'
|
||||
export {
|
||||
BadgePosition,
|
||||
LGraphBadge,
|
||||
type LGraphBadgeOptions
|
||||
} from './LGraphBadge'
|
||||
export { LGraphCanvas, type LGraphCanvasState } from './LGraphCanvas'
|
||||
export { BadgePosition, LGraphBadge } from './LGraphBadge'
|
||||
export { LGraphCanvas } from './LGraphCanvas'
|
||||
export { LGraphGroup } from './LGraphGroup'
|
||||
export { LGraphNode, type NodeId, type NodeProperty } from './LGraphNode'
|
||||
export { LGraphNode, type NodeId } from './LGraphNode'
|
||||
export { COMFY_VUE_NODE_DIMENSIONS } from './LiteGraphGlobal'
|
||||
export { type LinkId, LLink } from './LLink'
|
||||
export { LLink } from './LLink'
|
||||
export { createBounds } from './measure'
|
||||
export { Reroute, type RerouteId } from './Reroute'
|
||||
export {
|
||||
@@ -136,23 +116,18 @@ export {
|
||||
export { SubgraphNode } from './subgraph/SubgraphNode'
|
||||
export type { CanvasPointerEvent } from './types/events'
|
||||
export {
|
||||
CanvasItem,
|
||||
EaseFunction,
|
||||
LGraphEventMode,
|
||||
LinkDirection,
|
||||
LinkMarkerShape,
|
||||
RenderShape,
|
||||
TitleMode
|
||||
RenderShape
|
||||
} from './types/globalEnums'
|
||||
export type {
|
||||
ExportedSubgraph,
|
||||
ExportedSubgraphInstance,
|
||||
ExportedSubgraphIONode,
|
||||
ISerialisedGraph,
|
||||
ISerialisedNode,
|
||||
SerialisableGraph,
|
||||
SerialisableLLink,
|
||||
SubgraphIO
|
||||
SerialisableGraph
|
||||
} from './types/serialisation'
|
||||
export type { IWidget } from './types/widgets'
|
||||
export { isColorable } from './utils/type'
|
||||
@@ -161,19 +136,14 @@ export type { UUID } from './utils/uuid'
|
||||
export { truncateText } from './utils/textUtils'
|
||||
export { getWidgetStep } from './utils/widget'
|
||||
export { distributeSpace, type SpaceRequest } from './utils/spaceDistribution'
|
||||
export { BaseSteppedWidget } from './widgets/BaseSteppedWidget'
|
||||
|
||||
export { BaseWidget } from './widgets/BaseWidget'
|
||||
export { BooleanWidget } from './widgets/BooleanWidget'
|
||||
export { ButtonWidget } from './widgets/ButtonWidget'
|
||||
export { ComboWidget } from './widgets/ComboWidget'
|
||||
export { KnobWidget } from './widgets/KnobWidget'
|
||||
|
||||
export { LegacyWidget } from './widgets/LegacyWidget'
|
||||
export { NumberWidget } from './widgets/NumberWidget'
|
||||
export { SliderWidget } from './widgets/SliderWidget'
|
||||
export { TextWidget } from './widgets/TextWidget'
|
||||
|
||||
export { isComboWidget } from './widgets/widgetMap'
|
||||
// Additional test-specific exports
|
||||
export { LGraphButton, type LGraphButtonOptions } from './LGraphButton'
|
||||
export { LGraphButton } from './LGraphButton'
|
||||
export { MovingOutputLink } from './canvas/MovingOutputLink'
|
||||
export { ToOutputRenderLink } from './canvas/ToOutputRenderLink'
|
||||
export { ToInputFromIoNodeLink } from './canvas/ToInputFromIoNodeLink'
|
||||
|
||||
@@ -18,9 +18,7 @@ type CommonIoSlotProps = SharedIntersection<
|
||||
ISerialisableNodeOutput
|
||||
>
|
||||
|
||||
export function shallowCloneCommonProps(
|
||||
slot: CommonIoSlotProps
|
||||
): CommonIoSlotProps {
|
||||
function shallowCloneCommonProps(slot: CommonIoSlotProps): CommonIoSlotProps {
|
||||
const {
|
||||
color_off,
|
||||
color_on,
|
||||
|
||||
@@ -28,7 +28,7 @@ import type { SubgraphInputNode } from './SubgraphInputNode'
|
||||
import type { SubgraphOutput } from './SubgraphOutput'
|
||||
import type { SubgraphOutputNode } from './SubgraphOutputNode'
|
||||
|
||||
export interface SubgraphSlotDrawOptions {
|
||||
interface SubgraphSlotDrawOptions {
|
||||
ctx: CanvasRenderingContext2D
|
||||
colorContext: DefaultConnectionColors
|
||||
lowQuality?: boolean
|
||||
|
||||
@@ -27,7 +27,7 @@ import { SubgraphInputNode } from './SubgraphInputNode'
|
||||
import type { SubgraphOutput } from './SubgraphOutput'
|
||||
import { SubgraphOutputNode } from './SubgraphOutputNode'
|
||||
|
||||
export interface FilteredItems {
|
||||
interface FilteredItems {
|
||||
nodes: Set<LGraphNode>
|
||||
reroutes: Set<Reroute>
|
||||
groups: Set<LGraphGroup>
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { LGraphNode } from '../LGraphNode'
|
||||
import type { LinkReleaseContextExtended } from '../litegraph'
|
||||
|
||||
/** For Canvas*Event - adds graph space co-ordinates (property names are shipped) */
|
||||
export interface ICanvasPosition {
|
||||
interface ICanvasPosition {
|
||||
/** X co-ordinate of the event, in graph space (NOT canvas space) */
|
||||
canvasX: number
|
||||
/** Y co-ordinate of the event, in graph space (NOT canvas space) */
|
||||
@@ -14,7 +14,7 @@ export interface ICanvasPosition {
|
||||
}
|
||||
|
||||
/** For Canvas*Event */
|
||||
export interface IDeltaPosition {
|
||||
interface IDeltaPosition {
|
||||
deltaX: number
|
||||
deltaY: number
|
||||
}
|
||||
@@ -23,7 +23,7 @@ export interface IDeltaPosition {
|
||||
* Workaround for Firefox returning 0 on offsetX/Y props
|
||||
* See https://github.com/Comfy-Org/litegraph.js/issues/403 for details
|
||||
*/
|
||||
export interface IOffsetWorkaround {
|
||||
interface IOffsetWorkaround {
|
||||
/** See {@link MouseEvent.offsetX}. This workaround is required (2024-12-31) to support Firefox, which always returns 0 */
|
||||
safeOffsetX: number
|
||||
/** See {@link MouseEvent.offsetY}. This workaround is required (2024-12-31) to support Firefox, which always returns 0 */
|
||||
@@ -45,7 +45,7 @@ interface LegacyMouseEvent {
|
||||
export interface CanvasPointerEvent extends PointerEvent, CanvasMouseEvent {}
|
||||
|
||||
/** MouseEvent with canvasX/Y and deltaX/Y properties */
|
||||
export interface CanvasMouseEvent
|
||||
interface CanvasMouseEvent
|
||||
extends MouseEvent,
|
||||
Readonly<CanvasPointerExtensions>,
|
||||
LegacyMouseEvent {}
|
||||
@@ -57,29 +57,29 @@ export type CanvasEventDetail =
|
||||
| EmptyDoubleClickEventDetail
|
||||
| EmptyReleaseEventDetail
|
||||
|
||||
export interface GenericEventDetail {
|
||||
interface GenericEventDetail {
|
||||
subType: 'before-change' | 'after-change'
|
||||
}
|
||||
|
||||
export interface OriginalEvent {
|
||||
interface OriginalEvent {
|
||||
originalEvent: CanvasPointerEvent
|
||||
}
|
||||
|
||||
export interface EmptyReleaseEventDetail extends OriginalEvent {
|
||||
interface EmptyReleaseEventDetail extends OriginalEvent {
|
||||
subType: 'empty-release'
|
||||
linkReleaseContext: LinkReleaseContextExtended
|
||||
}
|
||||
|
||||
export interface EmptyDoubleClickEventDetail extends OriginalEvent {
|
||||
interface EmptyDoubleClickEventDetail extends OriginalEvent {
|
||||
subType: 'empty-double-click'
|
||||
}
|
||||
|
||||
export interface GroupDoubleClickEventDetail extends OriginalEvent {
|
||||
interface GroupDoubleClickEventDetail extends OriginalEvent {
|
||||
subType: 'group-double-click'
|
||||
group: LGraphGroup
|
||||
}
|
||||
|
||||
export interface NodeDoubleClickEventDetail extends OriginalEvent {
|
||||
interface NodeDoubleClickEventDetail extends OriginalEvent {
|
||||
subType: 'node-double-click'
|
||||
node: LGraphNode
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface Serialisable<SerialisableObject> {
|
||||
asSerialisable(): SerialisableObject
|
||||
}
|
||||
|
||||
export interface BaseExportedGraph {
|
||||
interface BaseExportedGraph {
|
||||
/** Unique graph ID. Automatically generated if not provided. */
|
||||
id: UUID
|
||||
/** The revision number of this graph. Not automatically incremented; intended for use by a downstream save function. */
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface IWidgetOptions<TValues = unknown[]> {
|
||||
callback?: IWidget['callback']
|
||||
}
|
||||
|
||||
export interface IWidgetSliderOptions extends IWidgetOptions<number[]> {
|
||||
interface IWidgetSliderOptions extends IWidgetOptions<number[]> {
|
||||
min: number
|
||||
max: number
|
||||
step2: number
|
||||
@@ -38,7 +38,7 @@ export interface IWidgetSliderOptions extends IWidgetOptions<number[]> {
|
||||
marker_color?: CanvasColour
|
||||
}
|
||||
|
||||
export interface IWidgetKnobOptions extends IWidgetOptions<number[]> {
|
||||
interface IWidgetKnobOptions extends IWidgetOptions<number[]> {
|
||||
min: number
|
||||
max: number
|
||||
step2: number
|
||||
@@ -144,7 +144,7 @@ export interface IButtonWidget
|
||||
}
|
||||
|
||||
/** A custom widget - accepts any value and has no built-in special handling */
|
||||
export interface ICustomWidget extends IBaseWidget<string | object, 'custom'> {
|
||||
interface ICustomWidget extends IBaseWidget<string | object, 'custom'> {
|
||||
type: 'custom'
|
||||
value: string | object
|
||||
}
|
||||
@@ -169,7 +169,7 @@ export interface IMarkdownWidget extends IBaseWidget<string, 'markdown'> {
|
||||
}
|
||||
|
||||
/** Image display widget */
|
||||
export interface IImageWidget extends IBaseWidget<string, 'image'> {
|
||||
interface IImageWidget extends IBaseWidget<string, 'image'> {
|
||||
type: 'image'
|
||||
value: string
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface DrawWidgetOptions {
|
||||
showText?: boolean
|
||||
}
|
||||
|
||||
export interface DrawTruncatingTextOptions extends DrawWidgetOptions {
|
||||
interface DrawTruncatingTextOptions extends DrawWidgetOptions {
|
||||
/** The canvas context to draw the text on. */
|
||||
ctx: CanvasRenderingContext2D
|
||||
/** The amount of padding to add to the left of the text. */
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
createTestSubgraphNode
|
||||
} from './subgraphHelpers'
|
||||
|
||||
export interface SubgraphFixtures {
|
||||
interface SubgraphFixtures {
|
||||
/** A minimal subgraph with no inputs, outputs, or nodes */
|
||||
emptySubgraph: Subgraph
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {
|
||||
import type { UUID } from '@/lib/litegraph/src/utils/uuid'
|
||||
import { createUuidv4 } from '@/lib/litegraph/src/utils/uuid'
|
||||
|
||||
export interface TestSubgraphOptions {
|
||||
interface TestSubgraphOptions {
|
||||
id?: UUID
|
||||
name?: string
|
||||
nodeCount?: number
|
||||
@@ -27,20 +27,20 @@ export interface TestSubgraphOptions {
|
||||
outputs?: Array<{ name: string; type: ISlotType }>
|
||||
}
|
||||
|
||||
export interface TestSubgraphNodeOptions {
|
||||
interface TestSubgraphNodeOptions {
|
||||
id?: NodeId
|
||||
pos?: [number, number]
|
||||
size?: [number, number]
|
||||
}
|
||||
|
||||
export interface NestedSubgraphOptions {
|
||||
interface NestedSubgraphOptions {
|
||||
depth?: number
|
||||
nodesPerLevel?: number
|
||||
inputsPerSubgraph?: number
|
||||
outputsPerSubgraph?: number
|
||||
}
|
||||
|
||||
export interface SubgraphStructureExpectation {
|
||||
interface SubgraphStructureExpectation {
|
||||
inputCount?: number
|
||||
outputCount?: number
|
||||
nodeCount?: number
|
||||
@@ -49,7 +49,7 @@ export interface SubgraphStructureExpectation {
|
||||
hasOutputNode?: boolean
|
||||
}
|
||||
|
||||
export interface CapturedEvent<T = unknown> {
|
||||
interface CapturedEvent<T = unknown> {
|
||||
type: string
|
||||
detail: T
|
||||
timestamp: number
|
||||
@@ -422,6 +422,3 @@ export function createEventCapture<T = unknown>(
|
||||
capturedEvents.filter((e) => e.type === type)
|
||||
}
|
||||
}
|
||||
|
||||
// Re-export expect from vitest for convenience
|
||||
export { expect } from 'vitest'
|
||||
|
||||
@@ -58,7 +58,7 @@ export interface LinkRenderContext {
|
||||
disabledPattern?: CanvasPattern | null
|
||||
}
|
||||
|
||||
export interface LinkRenderOptions {
|
||||
interface LinkRenderOptions {
|
||||
color?: CanvasColour
|
||||
flow?: boolean
|
||||
skipBorder?: boolean
|
||||
|
||||
@@ -38,7 +38,7 @@ export interface LinkRenderData {
|
||||
centerAngle?: number
|
||||
}
|
||||
|
||||
export interface RenderStyle {
|
||||
interface RenderStyle {
|
||||
mode: RenderMode
|
||||
connectionWidth: number
|
||||
borderWidth?: number
|
||||
@@ -51,7 +51,7 @@ export interface RenderStyle {
|
||||
highQuality?: boolean
|
||||
}
|
||||
|
||||
export interface RenderColors {
|
||||
interface RenderColors {
|
||||
default: string
|
||||
byType: Record<string, string>
|
||||
highlighted: string
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
|
||||
const logger = log.getLogger('LayoutMutations')
|
||||
|
||||
export interface LayoutMutations {
|
||||
interface LayoutMutations {
|
||||
// Single node operations (synchronous, CRDT-ready)
|
||||
moveNode(nodeId: NodeId, position: Point): void
|
||||
resizeNode(nodeId: NodeId, size: Size): void
|
||||
|
||||
@@ -24,7 +24,7 @@ import { getSlotKey } from './slotIdentifier'
|
||||
* @param isInput Whether this is an input slot
|
||||
* @param position The slot position in graph coordinates
|
||||
*/
|
||||
export function registerSlotLayout(
|
||||
function registerSlotLayout(
|
||||
nodeId: string,
|
||||
slotIndex: number,
|
||||
isInput: boolean,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @TODO Replace this concatenated string with root cause fix
|
||||
*/
|
||||
|
||||
export interface SlotIdentifier {
|
||||
interface SlotIdentifier {
|
||||
nodeId: string
|
||||
index: number
|
||||
isInput: boolean
|
||||
|
||||
@@ -16,7 +16,7 @@ import { layoutStore } from '@/renderer/core/layout/store/layoutStore'
|
||||
* Compute and register slot layouts for a node
|
||||
* @param node LiteGraph node to process
|
||||
*/
|
||||
export function computeAndRegisterSlots(node: LGraphNode): void {
|
||||
function computeAndRegisterSlots(node: LGraphNode): void {
|
||||
const nodeId = String(node.id)
|
||||
const nodeLayout = layoutStore.getNodeLayoutRef(nodeId).value
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ export interface RerouteLayout {
|
||||
/**
|
||||
* Meta-only base for all operations - contains common fields
|
||||
*/
|
||||
export interface OperationMeta {
|
||||
interface OperationMeta {
|
||||
/** Unique operation ID for deduplication */
|
||||
id?: string
|
||||
/** Timestamp for ordering operations */
|
||||
@@ -100,9 +100,9 @@ export interface OperationMeta {
|
||||
/**
|
||||
* Entity-specific base types for proper type discrimination
|
||||
*/
|
||||
export type NodeOpBase = OperationMeta & { entity: 'node'; nodeId: NodeId }
|
||||
export type LinkOpBase = OperationMeta & { entity: 'link'; linkId: LinkId }
|
||||
export type RerouteOpBase = OperationMeta & {
|
||||
type NodeOpBase = OperationMeta & { entity: 'node'; nodeId: NodeId }
|
||||
type LinkOpBase = OperationMeta & { entity: 'link'; linkId: LinkId }
|
||||
type RerouteOpBase = OperationMeta & {
|
||||
entity: 'reroute'
|
||||
rerouteId: RerouteId
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export type RerouteOpBase = OperationMeta & {
|
||||
/**
|
||||
* Operation type discriminator for type narrowing
|
||||
*/
|
||||
export type OperationType =
|
||||
type OperationType =
|
||||
| 'moveNode'
|
||||
| 'resizeNode'
|
||||
| 'setNodeZIndex'
|
||||
@@ -170,7 +170,7 @@ export interface DeleteNodeOperation extends NodeOpBase {
|
||||
/**
|
||||
* Set node visibility operation
|
||||
*/
|
||||
export interface SetNodeVisibilityOperation extends NodeOpBase {
|
||||
interface SetNodeVisibilityOperation extends NodeOpBase {
|
||||
type: 'setNodeVisibility'
|
||||
visible: boolean
|
||||
previousVisible: boolean
|
||||
@@ -179,7 +179,7 @@ export interface SetNodeVisibilityOperation extends NodeOpBase {
|
||||
/**
|
||||
* Batch update operation for atomic multi-property changes
|
||||
*/
|
||||
export interface BatchUpdateOperation extends NodeOpBase {
|
||||
interface BatchUpdateOperation extends NodeOpBase {
|
||||
type: 'batchUpdate'
|
||||
updates: Partial<NodeLayout>
|
||||
previousValues: Partial<NodeLayout>
|
||||
|
||||
@@ -53,12 +53,12 @@ import { computed, reactive, readonly } from 'vue'
|
||||
|
||||
import type { LGraphCanvas } from '@/lib/litegraph/src/litegraph'
|
||||
|
||||
export interface Point {
|
||||
interface Point {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
|
||||
export interface Camera {
|
||||
interface Camera {
|
||||
x: number
|
||||
y: number
|
||||
z: number // scale/zoom
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface Bounds {
|
||||
height: number
|
||||
}
|
||||
|
||||
export interface QuadTreeItem<T> {
|
||||
interface QuadTreeItem<T> {
|
||||
id: string
|
||||
bounds: Bounds
|
||||
data: T
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Spatial bounds calculations for node layouts
|
||||
*/
|
||||
|
||||
export interface SpatialBounds {
|
||||
interface SpatialBounds {
|
||||
minX: number
|
||||
minY: number
|
||||
maxX: number
|
||||
@@ -11,7 +11,7 @@ export interface SpatialBounds {
|
||||
height: number
|
||||
}
|
||||
|
||||
export interface PositionedNode {
|
||||
interface PositionedNode {
|
||||
pos: ArrayLike<number>
|
||||
size: ArrayLike<number>
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface MinimapRenderContext {
|
||||
height: number
|
||||
}
|
||||
|
||||
export interface MinimapRenderSettings {
|
||||
interface MinimapRenderSettings {
|
||||
nodeColors: boolean
|
||||
showLinks: boolean
|
||||
showGroups: boolean
|
||||
|
||||
@@ -35,7 +35,7 @@ export enum LODLevel {
|
||||
FULL = 'full' // zoom > 0.8
|
||||
}
|
||||
|
||||
export interface LODConfig {
|
||||
interface LODConfig {
|
||||
renderWidgets: boolean
|
||||
renderSlots: boolean
|
||||
renderContent: boolean
|
||||
|
||||
@@ -9,7 +9,7 @@ import { api } from '@/scripts/api'
|
||||
const MAX_RETRIES = 5
|
||||
const TIMEOUT = 4096
|
||||
|
||||
export interface CacheEntry<T> {
|
||||
interface CacheEntry<T> {
|
||||
data: T
|
||||
timestamp?: number
|
||||
error?: Error | null
|
||||
|
||||
@@ -130,7 +130,7 @@ export const getComponent = (type: string): Component | null => {
|
||||
return widgets.get(canonicalType)?.component || null
|
||||
}
|
||||
|
||||
export const isSupported = (type: string): boolean => {
|
||||
const isSupported = (type: string): boolean => {
|
||||
const canonicalType = getCanonicalType(type)
|
||||
return widgets.has(canonicalType)
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ const zDeviceStats = z.object({
|
||||
torch_vram_free: z.number()
|
||||
})
|
||||
|
||||
export const zSystemStats = z.object({
|
||||
const zSystemStats = z.object({
|
||||
system: z.object({
|
||||
os: z.string(),
|
||||
python_version: z.string(),
|
||||
|
||||
@@ -100,7 +100,7 @@ export const paletteSchema = z
|
||||
})
|
||||
.passthrough()
|
||||
|
||||
export const completedPaletteSchema = z
|
||||
const completedPaletteSchema = z
|
||||
.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
|
||||
@@ -5,9 +5,9 @@ import { fromZodError } from 'zod-validation-error'
|
||||
// innerNode.id = `${this.node.id}:${i}`
|
||||
// Remove it after GroupNode is redesigned.
|
||||
export const zNodeId = z.union([z.number().int(), z.string()])
|
||||
export const zNodeInputName = z.string()
|
||||
const zNodeInputName = z.string()
|
||||
export type NodeId = z.infer<typeof zNodeId>
|
||||
export const zSlotIndex = z.union([
|
||||
const zSlotIndex = z.union([
|
||||
z.number().int(),
|
||||
z
|
||||
.string()
|
||||
@@ -20,7 +20,7 @@ export const zSlotIndex = z.union([
|
||||
// TODO: Investigate usage of array and number as data type usage in custom nodes.
|
||||
// Known usage:
|
||||
// - https://github.com/rgthree/rgthree-comfy Context Big node is using array as type.
|
||||
export const zDataType = z.union([z.string(), z.array(z.string()), z.number()])
|
||||
const zDataType = z.union([z.string(), z.array(z.string()), z.number()])
|
||||
|
||||
const zVector2 = z.union([
|
||||
z
|
||||
@@ -214,7 +214,7 @@ const zComfyNode = z
|
||||
})
|
||||
.passthrough()
|
||||
|
||||
export const zSubgraphIO = zNodeInput.extend({
|
||||
const zSubgraphIO = zNodeInput.extend({
|
||||
/** Slot ID (internal; never changes once instantiated). */
|
||||
id: z.string().uuid(),
|
||||
/** The data type this slot uses. Unlike nodes, this does not support legacy numeric types. */
|
||||
@@ -274,11 +274,11 @@ const zExtra = z
|
||||
})
|
||||
.passthrough()
|
||||
|
||||
export const zGraphDefinitions = z.object({
|
||||
const zGraphDefinitions = z.object({
|
||||
subgraphs: z.lazy(() => z.array(zSubgraphDefinition))
|
||||
})
|
||||
|
||||
export const zBaseExportableGraph = z.object({
|
||||
const zBaseExportableGraph = z.object({
|
||||
/** Unique graph ID. Automatically generated if not provided. */
|
||||
id: z.string().uuid().optional(),
|
||||
revision: z.number().optional(),
|
||||
@@ -371,13 +371,13 @@ export const zComfyWorkflow1 = zBaseExportableGraph
|
||||
})
|
||||
.passthrough()
|
||||
|
||||
export const zExportedSubgraphIONode = z.object({
|
||||
const zExportedSubgraphIONode = z.object({
|
||||
id: zNodeId,
|
||||
bounding: z.tuple([z.number(), z.number(), z.number(), z.number()]),
|
||||
pinned: z.boolean().optional()
|
||||
})
|
||||
|
||||
export const zExposedWidget = z.object({
|
||||
const zExposedWidget = z.object({
|
||||
id: z.string(),
|
||||
name: z.string()
|
||||
})
|
||||
@@ -414,7 +414,7 @@ interface SubgraphDefinitionBase<
|
||||
}
|
||||
|
||||
/** A subgraph definition `worfklow.definitions.subgraphs` */
|
||||
export const zSubgraphDefinition = zComfyWorkflow1
|
||||
const zSubgraphDefinition = zComfyWorkflow1
|
||||
.extend({
|
||||
/** Unique graph ID. Automatically generated if not provided. */
|
||||
id: z.string().uuid(),
|
||||
@@ -455,7 +455,7 @@ export type WorkflowJSON04 = z.infer<typeof zComfyWorkflow>
|
||||
export type ComfyWorkflowJSON = z.infer<
|
||||
typeof zComfyWorkflow | typeof zComfyWorkflow1
|
||||
>
|
||||
export type SubgraphDefinition = z.infer<typeof zSubgraphDefinition>
|
||||
type SubgraphDefinition = z.infer<typeof zSubgraphDefinition>
|
||||
|
||||
/**
|
||||
* Type guard to check if an object is a SubgraphDefinition.
|
||||
@@ -522,5 +522,5 @@ const zNodeData = z.object({
|
||||
})
|
||||
})
|
||||
|
||||
export const zComfyApiWorkflow = z.record(zNodeId, zNodeData)
|
||||
const zComfyApiWorkflow = z.record(zNodeId, zNodeData)
|
||||
export type ComfyApiWorkflow = z.infer<typeof zComfyApiWorkflow>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
// KeyCombo schema
|
||||
export const zKeyCombo = z.object({
|
||||
const zKeyCombo = z.object({
|
||||
key: z.string(),
|
||||
ctrl: z.boolean().optional(),
|
||||
alt: z.boolean().optional(),
|
||||
|
||||
@@ -207,10 +207,10 @@ export const zComfyNodeDef = z.object({
|
||||
})
|
||||
|
||||
// Export types
|
||||
export type IntInputSpec = z.infer<typeof zIntInputSpec>
|
||||
export type FloatInputSpec = z.infer<typeof zFloatInputSpec>
|
||||
export type BooleanInputSpec = z.infer<typeof zBooleanInputSpec>
|
||||
export type StringInputSpec = z.infer<typeof zStringInputSpec>
|
||||
type IntInputSpec = z.infer<typeof zIntInputSpec>
|
||||
type FloatInputSpec = z.infer<typeof zFloatInputSpec>
|
||||
type BooleanInputSpec = z.infer<typeof zBooleanInputSpec>
|
||||
type StringInputSpec = z.infer<typeof zStringInputSpec>
|
||||
export type ComboInputSpec = z.infer<typeof zComboInputSpec>
|
||||
export type ColorInputSpec = z.infer<typeof zColorInputSpec>
|
||||
export type FileUploadInputSpec = z.infer<typeof zFileUploadInputSpec>
|
||||
|
||||
@@ -34,7 +34,7 @@ export const zBaseInputOptions = z
|
||||
})
|
||||
.passthrough()
|
||||
|
||||
export const zNumericInputOptions = zBaseInputOptions.extend({
|
||||
const zNumericInputOptions = zBaseInputOptions.extend({
|
||||
min: z.number().optional(),
|
||||
max: z.number().optional(),
|
||||
step: z.number().optional(),
|
||||
|
||||
@@ -55,7 +55,7 @@ export interface DOMWidget<T extends HTMLElement, V extends object | string>
|
||||
* - widget: Reference to the widget instance
|
||||
* - onUpdate:modelValue: The update handler for v-model
|
||||
*/
|
||||
export type ComponentWidgetCustomProps = Record<string, unknown>
|
||||
type ComponentWidgetCustomProps = Record<string, unknown>
|
||||
|
||||
/**
|
||||
* Standard props that are handled separately by DomWidget.vue and should be
|
||||
|
||||
@@ -319,7 +319,7 @@ function parseAvifMetadata(buffer: ArrayBuffer): ComfyMetadata {
|
||||
}
|
||||
|
||||
// @ts-expect-error fixme ts strict error
|
||||
export function parseExifData(exifData) {
|
||||
function parseExifData(exifData) {
|
||||
// Check for the correct TIFF header (0x4949 for little-endian or 0x4D4D for big-endian)
|
||||
const isLittleEndian = String.fromCharCode(...exifData.slice(0, 2)) === 'II'
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** @knipIgnoreUnusedButUsedByCustomNodes */
|
||||
export function getFromFlacBuffer(buffer: ArrayBuffer): Record<string, string> {
|
||||
const dataView = new DataView(buffer)
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** @knipIgnoreUnusedButUsedByCustomNodes */
|
||||
export function getFromPngBuffer(buffer: ArrayBuffer) {
|
||||
// Get the PNG data as a Uint8Array
|
||||
const pngData = new Uint8Array(buffer)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { reactive } from 'vue'
|
||||
|
||||
export interface CachedMedia {
|
||||
interface CachedMedia {
|
||||
src: string
|
||||
blob?: Blob
|
||||
objectUrl?: string
|
||||
@@ -9,7 +9,7 @@ export interface CachedMedia {
|
||||
lastAccessed: number
|
||||
}
|
||||
|
||||
export interface MediaCacheOptions {
|
||||
interface MediaCacheOptions {
|
||||
maxSize?: number
|
||||
maxAge?: number // in milliseconds
|
||||
preloadDistance?: number // pixels from viewport
|
||||
@@ -194,7 +194,7 @@ class MediaCacheService {
|
||||
}
|
||||
|
||||
// Global instance
|
||||
export let mediaCacheInstance: MediaCacheService | null = null
|
||||
let mediaCacheInstance: MediaCacheService | null = null
|
||||
|
||||
export function useMediaCache(options?: MediaCacheOptions) {
|
||||
if (!mediaCacheInstance) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
|
||||
import { NodeSourceType, getNodeSource } from '@/types/nodeSource'
|
||||
import { extractCustomNodeName } from '@/utils/nodeHelpUtil'
|
||||
|
||||
export class NodeHelpService {
|
||||
class NodeHelpService {
|
||||
async fetchNodeHelp(node: ComfyNodeDefImpl, locale: string): Promise<string> {
|
||||
const nodeSource = getNodeSource(node.python_module)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ const DEFAULT_ICON = 'pi pi-sort'
|
||||
export const DEFAULT_GROUPING_ID = 'category' as const
|
||||
export const DEFAULT_SORTING_ID = 'original' as const
|
||||
|
||||
export class NodeOrganizationService {
|
||||
class NodeOrganizationService {
|
||||
private readonly groupingStrategies: NodeGroupingStrategy[] = [
|
||||
{
|
||||
id: 'category',
|
||||
|
||||
@@ -14,11 +14,10 @@ const releaseApiClient = axios.create({
|
||||
|
||||
// Use generated types from OpenAPI spec
|
||||
export type ReleaseNote = components['schemas']['ReleaseNote']
|
||||
export type GetReleasesParams =
|
||||
operations['getReleaseNotes']['parameters']['query']
|
||||
type GetReleasesParams = operations['getReleaseNotes']['parameters']['query']
|
||||
|
||||
// Use generated error response type
|
||||
export type ErrorResponse = components['schemas']['ErrorResponse']
|
||||
type ErrorResponse = components['schemas']['ErrorResponse']
|
||||
|
||||
// Release service for fetching release notes
|
||||
export const useReleaseService = () => {
|
||||
|
||||
@@ -31,7 +31,7 @@ import { createNodeLocatorId } from '@/types/nodeIdentification'
|
||||
import { useCanvasStore } from './graphStore'
|
||||
import { ComfyWorkflow, useWorkflowStore } from './workflowStore'
|
||||
|
||||
export interface QueuedPrompt {
|
||||
interface QueuedPrompt {
|
||||
/**
|
||||
* The nodes that are queued to be executed. The key is the node id and the
|
||||
* value is a boolean indicating if the node has been executed.
|
||||
|
||||
@@ -6,9 +6,9 @@ import type { ComfyExtension } from '@/types/comfy'
|
||||
/**
|
||||
* These extensions are always active, even if they are disabled in the setting.
|
||||
*/
|
||||
export const ALWAYS_ENABLED_EXTENSIONS: readonly string[] = []
|
||||
const ALWAYS_ENABLED_EXTENSIONS: readonly string[] = []
|
||||
|
||||
export const ALWAYS_DISABLED_EXTENSIONS: readonly string[] = [
|
||||
const ALWAYS_DISABLED_EXTENSIONS: readonly string[] = [
|
||||
// pysssss.Locking is replaced by pin/unpin in ComfyUI core.
|
||||
// https://github.com/Comfy-Org/litegraph.js/pull/117
|
||||
'pysssss.Locking',
|
||||
|
||||
@@ -41,7 +41,7 @@ type AccessBillingPortalResponse =
|
||||
type AccessBillingPortalReqBody =
|
||||
operations['AccessBillingPortal']['requestBody']
|
||||
|
||||
export class FirebaseAuthStoreError extends Error {
|
||||
class FirebaseAuthStoreError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message)
|
||||
this.name = 'FirebaseAuthStoreError'
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ComfyNodeDefImpl, createDummyFolderNodeDef } from './nodeDefStore'
|
||||
import { buildNodeDefTree } from './nodeDefStore'
|
||||
import { useSettingStore } from './settingStore'
|
||||
|
||||
export const BOOKMARK_SETTING_ID = 'Comfy.NodeLibrary.Bookmarks.V2'
|
||||
const BOOKMARK_SETTING_ID = 'Comfy.NodeLibrary.Bookmarks.V2'
|
||||
|
||||
export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
@@ -224,7 +224,7 @@ export const SYSTEM_NODE_DEFS: Record<string, ComfyNodeDefV1> = {
|
||||
}
|
||||
}
|
||||
|
||||
export interface BuildNodeDefTreeOptions {
|
||||
interface BuildNodeDefTreeOptions {
|
||||
/**
|
||||
* Custom function to extract the tree path from a node definition.
|
||||
* If not provided, uses the default path based on nodeDef.nodePath.
|
||||
|
||||
@@ -18,7 +18,7 @@ import { useExtensionService } from '@/services/extensionService'
|
||||
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
||||
|
||||
// Task type used in the API.
|
||||
export type APITaskType = 'queue' | 'history'
|
||||
type APITaskType = 'queue' | 'history'
|
||||
|
||||
export enum TaskItemDisplayStatus {
|
||||
Running = 'Running',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { computed, ref } from 'vue'
|
||||
|
||||
import { ServerConfig, ServerConfigValue } from '@/constants/serverConfig'
|
||||
|
||||
export type ServerConfigWithValue<T> = ServerConfig<T> & {
|
||||
type ServerConfigWithValue<T> = ServerConfig<T> & {
|
||||
/**
|
||||
* Current value.
|
||||
*/
|
||||
|
||||
@@ -182,7 +182,7 @@ export class UserFile {
|
||||
}
|
||||
}
|
||||
|
||||
export interface LoadedUserFile extends UserFile {
|
||||
interface LoadedUserFile extends UserFile {
|
||||
isLoaded: true
|
||||
originalContent: string
|
||||
content: string
|
||||
|
||||
@@ -148,7 +148,7 @@ export interface LoadedComfyWorkflow extends ComfyWorkflow {
|
||||
* error TS7056: The inferred type of this node exceeds the maximum length the
|
||||
* compiler will serialize. An explicit type annotation is needed.
|
||||
*/
|
||||
export interface WorkflowStore {
|
||||
interface WorkflowStore {
|
||||
activeWorkflow: LoadedComfyWorkflow | null
|
||||
attachWorkflow: (workflow: ComfyWorkflow, openIndex?: number) => void
|
||||
isActive: (workflow: ComfyWorkflow) => boolean
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
|
||||
export type ButtonSize = 'fit-content' | 'sm' | 'md'
|
||||
export type ButtonType = 'primary' | 'secondary' | 'transparent'
|
||||
export type ButtonBorder = boolean
|
||||
type ButtonType = 'primary' | 'secondary' | 'transparent'
|
||||
type ButtonBorder = boolean
|
||||
|
||||
export interface BaseButtonProps {
|
||||
size?: ButtonSize
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { ComfyCommand } from '@/stores/commandStore'
|
||||
import type { BottomPanelExtension } from '@/types/extensionTypes'
|
||||
import type { SettingParams } from '@/types/settingTypes'
|
||||
|
||||
export type Widgets = Record<string, ComfyWidgetConstructor>
|
||||
type Widgets = Record<string, ComfyWidgetConstructor>
|
||||
|
||||
export interface AboutPageBadge {
|
||||
label: string
|
||||
@@ -17,7 +17,7 @@ export interface AboutPageBadge {
|
||||
icon: string
|
||||
}
|
||||
|
||||
export type MenuCommandGroup = {
|
||||
type MenuCommandGroup = {
|
||||
/**
|
||||
* The path to the menu group.
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Component } from 'vue'
|
||||
import type { useDialogService } from '@/services/dialogService'
|
||||
import type { ComfyCommand } from '@/stores/commandStore'
|
||||
|
||||
export interface BaseSidebarTabExtension {
|
||||
interface BaseSidebarTabExtension {
|
||||
id: string
|
||||
title: string
|
||||
icon?: string | Component
|
||||
@@ -12,7 +12,7 @@ export interface BaseSidebarTabExtension {
|
||||
label?: string
|
||||
}
|
||||
|
||||
export interface BaseBottomPanelExtension {
|
||||
interface BaseBottomPanelExtension {
|
||||
id: string
|
||||
title?: string // For extensions that provide static titles
|
||||
titleKey?: string // For core tabs with i18n keys
|
||||
@@ -32,16 +32,14 @@ export interface CustomExtension {
|
||||
destroy?: () => void
|
||||
}
|
||||
|
||||
export type VueSidebarTabExtension = BaseSidebarTabExtension & VueExtension
|
||||
export type CustomSidebarTabExtension = BaseSidebarTabExtension &
|
||||
CustomExtension
|
||||
type VueSidebarTabExtension = BaseSidebarTabExtension & VueExtension
|
||||
type CustomSidebarTabExtension = BaseSidebarTabExtension & CustomExtension
|
||||
export type SidebarTabExtension =
|
||||
| VueSidebarTabExtension
|
||||
| CustomSidebarTabExtension
|
||||
|
||||
export type VueBottomPanelExtension = BaseBottomPanelExtension & VueExtension
|
||||
export type CustomBottomPanelExtension = BaseBottomPanelExtension &
|
||||
CustomExtension
|
||||
type VueBottomPanelExtension = BaseBottomPanelExtension & VueExtension
|
||||
type CustomBottomPanelExtension = BaseBottomPanelExtension & CustomExtension
|
||||
export type BottomPanelExtension =
|
||||
| VueBottomPanelExtension
|
||||
| CustomBottomPanelExtension
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ComputedRef, InjectionKey } from 'vue'
|
||||
|
||||
export interface ImportFailedContext {
|
||||
interface ImportFailedContext {
|
||||
importFailed: ComputedRef<boolean>
|
||||
showImportFailedDialog: () => void
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export type GltfChunkHeader = {
|
||||
chunkTypeIdentifier: number
|
||||
}
|
||||
|
||||
export type GltfExtras = {
|
||||
type GltfExtras = {
|
||||
workflow?: string | object
|
||||
prompt?: string | object
|
||||
[key: string]: any
|
||||
@@ -112,12 +112,12 @@ export type AvifIinfBox = {
|
||||
entries: AvifInfeBox[]
|
||||
}
|
||||
|
||||
export type AvifIlocItemExtent = {
|
||||
type AvifIlocItemExtent = {
|
||||
extent_offset: number
|
||||
extent_length: number
|
||||
}
|
||||
|
||||
export type AvifIlocItem = {
|
||||
type AvifIlocItem = {
|
||||
item_ID: number
|
||||
data_reference_index: number
|
||||
base_offset: number
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { ComboInputOptions, InputSpec } from '@/schemas/nodeDefSchema'
|
||||
* Frontend augmentation for image upload combo inputs.
|
||||
* This extends ComboInputOptions with properties injected by the uploadImage extension.
|
||||
*/
|
||||
export interface ImageUploadComboOptions extends ComboInputOptions {
|
||||
interface ImageUploadComboOptions extends ComboInputOptions {
|
||||
/**
|
||||
* Reference to the associated filename combo widget.
|
||||
* Injected by uploadImage.ts to link upload buttons with their combo widgets.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Settings } from '@/schemas/apiSchema'
|
||||
|
||||
export type SettingInputType =
|
||||
type SettingInputType =
|
||||
| 'boolean'
|
||||
| 'number'
|
||||
| 'slider'
|
||||
@@ -13,7 +13,7 @@ export type SettingInputType =
|
||||
| 'hidden'
|
||||
| 'backgroundImage'
|
||||
|
||||
export type SettingCustomRenderer = (
|
||||
type SettingCustomRenderer = (
|
||||
name: string,
|
||||
setter: (v: any) => void,
|
||||
value: any,
|
||||
|
||||
@@ -83,7 +83,7 @@ export function formatSize(value?: number) {
|
||||
* - filename: 'file'
|
||||
* - suffix: 'txt'
|
||||
*/
|
||||
export function getFilenameDetails(fullFilename: string) {
|
||||
function getFilenameDetails(fullFilename: string) {
|
||||
if (fullFilename.includes('.')) {
|
||||
return {
|
||||
filename: fullFilename.split('.').slice(0, -1).join('.'),
|
||||
@@ -479,7 +479,7 @@ export function formatVersionAnchor(version: string): string {
|
||||
/**
|
||||
* Supported locale types for the application (from OpenAPI schema)
|
||||
*/
|
||||
export type SupportedLocale = NonNullable<
|
||||
type SupportedLocale = NonNullable<
|
||||
operations['getReleaseNotes']['parameters']['query']['locale']
|
||||
>
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ export function getAllNonIoNodesInSubgraph(subgraph: Subgraph): LGraphNode[] {
|
||||
/**
|
||||
* Options for traverseNodesDepthFirst function
|
||||
*/
|
||||
export interface TraverseNodesOptions<T> {
|
||||
interface TraverseNodesOptions<T> {
|
||||
/** Function called for each node during traversal */
|
||||
visitor?: (node: LGraphNode, context: T) => T
|
||||
/** Initial context value */
|
||||
@@ -449,7 +449,7 @@ export function traverseNodesDepthFirst<T = void>(
|
||||
/**
|
||||
* Options for collectFromNodes function
|
||||
*/
|
||||
export interface CollectFromNodesOptions<T, C> {
|
||||
interface CollectFromNodesOptions<T, C> {
|
||||
/** Function that returns data to collect for each node */
|
||||
collector?: (node: LGraphNode, context: C) => T | null
|
||||
/** Function that builds context for child nodes */
|
||||
|
||||
@@ -32,7 +32,7 @@ import type {
|
||||
ISerialisedNode
|
||||
} from '@/lib/litegraph/src/types/serialisation'
|
||||
|
||||
export interface BadLinksData<T = ISerialisedGraph | LGraph> {
|
||||
interface BadLinksData<T = ISerialisedGraph | LGraph> {
|
||||
hasBadLinks: boolean
|
||||
fixed: boolean
|
||||
graph: T
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @param b - The second number.
|
||||
* @returns The GCD of the two numbers.
|
||||
*/
|
||||
export const gcd = (a: number, b: number): number => {
|
||||
const gcd = (a: number, b: number): number => {
|
||||
return b === 0 ? a : gcd(b, a % b)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import clsx, { type ClassArray } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
export type { ClassValue, ClassArray, ClassDictionary } from 'clsx'
|
||||
export type { ClassValue } from 'clsx'
|
||||
|
||||
export function cn(...inputs: ClassArray) {
|
||||
return twMerge(clsx(inputs))
|
||||
|
||||
@@ -129,7 +129,7 @@ export const findNodeByKey = <T extends TreeNode>(
|
||||
* @param node - The node to clone.
|
||||
* @returns A deep clone of the node.
|
||||
*/
|
||||
export function cloneTree<T extends TreeNode>(node: T): T {
|
||||
function cloneTree<T extends TreeNode>(node: T): T {
|
||||
const clone = { ...node }
|
||||
|
||||
// Clone children recursively
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
createTestSubgraphNode
|
||||
} from './subgraphHelpers'
|
||||
|
||||
export interface SubgraphFixtures {
|
||||
interface SubgraphFixtures {
|
||||
/** A minimal subgraph with no inputs, outputs, or nodes */
|
||||
emptySubgraph: Subgraph
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {
|
||||
import type { UUID } from '@/lib/litegraph/src/utils/uuid'
|
||||
import { createUuidv4 } from '@/lib/litegraph/src/utils/uuid'
|
||||
|
||||
export interface TestSubgraphOptions {
|
||||
interface TestSubgraphOptions {
|
||||
id?: UUID
|
||||
name?: string
|
||||
nodeCount?: number
|
||||
@@ -27,20 +27,20 @@ export interface TestSubgraphOptions {
|
||||
outputs?: Array<{ name: string; type: ISlotType }>
|
||||
}
|
||||
|
||||
export interface TestSubgraphNodeOptions {
|
||||
interface TestSubgraphNodeOptions {
|
||||
id?: NodeId
|
||||
pos?: [number, number]
|
||||
size?: [number, number]
|
||||
}
|
||||
|
||||
export interface NestedSubgraphOptions {
|
||||
interface NestedSubgraphOptions {
|
||||
depth?: number
|
||||
nodesPerLevel?: number
|
||||
inputsPerSubgraph?: number
|
||||
outputsPerSubgraph?: number
|
||||
}
|
||||
|
||||
export interface SubgraphStructureExpectation {
|
||||
interface SubgraphStructureExpectation {
|
||||
inputCount?: number
|
||||
outputCount?: number
|
||||
nodeCount?: number
|
||||
@@ -49,7 +49,7 @@ export interface SubgraphStructureExpectation {
|
||||
hasOutputNode?: boolean
|
||||
}
|
||||
|
||||
export interface CapturedEvent<T = unknown> {
|
||||
interface CapturedEvent<T = unknown> {
|
||||
type: string
|
||||
detail: T
|
||||
timestamp: number
|
||||
@@ -422,6 +422,3 @@ export function createEventCapture<T = unknown>(
|
||||
capturedEvents.filter((e) => e.type === type)
|
||||
}
|
||||
}
|
||||
|
||||
// Re-export expect from vitest for convenience
|
||||
export { expect } from 'vitest'
|
||||
|
||||
Reference in New Issue
Block a user