diff --git a/src/lib/litegraph/src/LiteGraphGlobal.ts b/src/lib/litegraph/src/LiteGraphGlobal.ts index 1f706e33f..a7c1140ae 100644 --- a/src/lib/litegraph/src/LiteGraphGlobal.ts +++ b/src/lib/litegraph/src/LiteGraphGlobal.ts @@ -44,12 +44,6 @@ export const COMFY_VUE_NODE_DIMENSIONS = { } } as const -/** - * Type for component height keys - */ -export type ComponentHeightKey = - keyof typeof COMFY_VUE_NODE_DIMENSIONS.components - /** * The Global Scope. It contains all the registered node classes. */ diff --git a/src/lib/litegraph/src/litegraph.ts b/src/lib/litegraph/src/litegraph.ts index 15d4751c4..5be28a413 100644 --- a/src/lib/litegraph/src/litegraph.ts +++ b/src/lib/litegraph/src/litegraph.ts @@ -135,10 +135,7 @@ export { export { LGraphCanvas, type LGraphCanvasState } from './LGraphCanvas' export { LGraphGroup } from './LGraphGroup' export { LGraphNode, type NodeId, type NodeProperty } from './LGraphNode' -export { - COMFY_VUE_NODE_DIMENSIONS, - type ComponentHeightKey -} from './LiteGraphGlobal' +export { COMFY_VUE_NODE_DIMENSIONS } from './LiteGraphGlobal' export { type LinkId, LLink } from './LLink' export { createBounds } from './measure' export { Reroute, type RerouteId } from './Reroute' diff --git a/src/renderer/core/layout/constants.ts b/src/renderer/core/layout/constants.ts index 1fa10cdb2..cc1de914e 100644 --- a/src/renderer/core/layout/constants.ts +++ b/src/renderer/core/layout/constants.ts @@ -37,18 +37,6 @@ export const PERFORMANCE_CONFIG = { BATCH_UPDATE_DELAY: 4 } as const -/** - * Default values for node layout - */ -export const NODE_DEFAULTS = { - /** Default node size when not specified */ - SIZE: { width: 200, height: 100 }, - /** Default z-index for new nodes */ - Z_INDEX: 0, - /** Default visibility state */ - VISIBLE: true -} as const - /** * Actor and source identifiers */ diff --git a/src/renderer/core/layout/slots/SlotIdentifier.ts b/src/renderer/core/layout/slots/SlotIdentifier.ts index 00bb8b2b3..df1f64fc2 100644 --- a/src/renderer/core/layout/slots/SlotIdentifier.ts +++ b/src/renderer/core/layout/slots/SlotIdentifier.ts @@ -38,39 +38,3 @@ export function getSlotKey( return `${nodeIdOrIdentifier}-${isInput ? 'in' : 'out'}-${index}` } - -/** - * Parse a slot key back into its components - */ -export function parseSlotKey(key: string): SlotIdentifier | null { - const match = key.match(/^(.+)-(in|out)-(\d+)$/) - if (!match) return null - - return { - nodeId: match[1], - isInput: match[2] === 'in', - index: parseInt(match[3], 10) - } -} - -/** - * Check if a key represents an input slot - */ -export function isInputSlotKey(key: string): boolean { - return key.includes('-in-') -} - -/** - * Check if a key represents an output slot - */ -export function isOutputSlotKey(key: string): boolean { - return key.includes('-out-') -} - -/** - * Get the node ID from a slot key - */ -export function getNodeIdFromSlotKey(key: string): string | null { - const parsed = parseSlotKey(key) - return parsed?.nodeId ?? null -} diff --git a/src/renderer/core/layout/types.ts b/src/renderer/core/layout/types.ts index cdd3e55a2..8ff25ea25 100644 --- a/src/renderer/core/layout/types.ts +++ b/src/renderer/core/layout/types.ts @@ -31,12 +31,9 @@ export interface Bounds { height: number } -// ID types for type safety export type NodeId = string -export type SlotId = string -export type ConnectionId = string -export type LinkId = number // Aligned with Litegraph's numeric LinkId -export type RerouteId = number // Aligned with Litegraph's numeric RerouteId +export type LinkId = number +export type RerouteId = number // Layout data structures export interface NodeLayout { @@ -84,16 +81,6 @@ export interface RerouteLayout { bounds: Bounds } -export interface ConnectionLayout { - id: ConnectionId - sourceSlot: SlotId - targetSlot: SlotId - // Control points for curved connections - controlPoints?: Point[] -} - -// CRDT Operation Types - /** * Meta-only base for all operations - contains common fields */ @@ -259,140 +246,6 @@ export type LayoutOperation = | DeleteRerouteOperation | MoveRerouteOperation -// Legacy alias for compatibility -export type AnyLayoutOperation = LayoutOperation - -/** - * Type guards for operations - */ -export const isOperationMeta = (op: unknown): op is OperationMeta => { - return ( - typeof op === 'object' && - op !== null && - 'timestamp' in op && - 'actor' in op && - 'source' in op && - 'type' in op - ) -} - -/** - * Entity-specific helper functions - */ -export const isNodeOperation = (op: LayoutOperation): boolean => { - return 'entity' in op && (op as any).entity === 'node' -} - -export const isLinkOperation = (op: LayoutOperation): boolean => { - return 'entity' in op && (op as any).entity === 'link' -} - -export const isRerouteOperation = (op: LayoutOperation): boolean => { - return 'entity' in op && (op as any).entity === 'reroute' -} - -export const isMoveNodeOperation = ( - op: LayoutOperation -): op is MoveNodeOperation => op.type === 'moveNode' - -export const isResizeNodeOperation = ( - op: LayoutOperation -): op is ResizeNodeOperation => op.type === 'resizeNode' - -export const isCreateNodeOperation = ( - op: LayoutOperation -): op is CreateNodeOperation => op.type === 'createNode' - -export const isDeleteNodeOperation = ( - op: LayoutOperation -): op is DeleteNodeOperation => op.type === 'deleteNode' - -export const isSetNodeVisibilityOperation = ( - op: LayoutOperation -): op is SetNodeVisibilityOperation => op.type === 'setNodeVisibility' - -export const isBatchUpdateOperation = ( - op: LayoutOperation -): op is BatchUpdateOperation => op.type === 'batchUpdate' - -export const isCreateLinkOperation = ( - op: LayoutOperation -): op is CreateLinkOperation => op.type === 'createLink' - -export const isDeleteLinkOperation = ( - op: LayoutOperation -): op is DeleteLinkOperation => op.type === 'deleteLink' - -export const isCreateRerouteOperation = ( - op: LayoutOperation -): op is CreateRerouteOperation => op.type === 'createReroute' - -export const isDeleteRerouteOperation = ( - op: LayoutOperation -): op is DeleteRerouteOperation => op.type === 'deleteReroute' - -export const isMoveRerouteOperation = ( - op: LayoutOperation -): op is MoveRerouteOperation => op.type === 'moveReroute' - -/** - * Helper function to get affected node IDs from any operation - * Useful for change notifications and cache invalidation - */ -export const getAffectedNodeIds = (op: LayoutOperation): NodeId[] => { - switch (op.type) { - case 'moveNode': - case 'resizeNode': - case 'setNodeZIndex': - case 'createNode': - case 'deleteNode': - case 'setNodeVisibility': - case 'batchUpdate': - return [(op as NodeOpBase).nodeId] - case 'createLink': { - const createLink = op as CreateLinkOperation - return [createLink.sourceNodeId, createLink.targetNodeId] - } - case 'deleteLink': - // Link deletion doesn't directly affect nodes - return [] - case 'createReroute': - case 'deleteReroute': - case 'moveReroute': - // Reroute operations don't directly affect nodes - return [] - default: - return [] - } -} - -/** - * Operation application interface - */ -export interface OperationApplicator< - T extends LayoutOperation = LayoutOperation -> { - canApply(operation: T): boolean - apply(operation: T): void - reverse(operation: T): void -} - -/** - * Operation serialization for network/storage - */ -export interface OperationSerializer { - serialize(operation: LayoutOperation): string - deserialize(data: string): LayoutOperation -} - -/** - * Conflict resolution strategy - */ -export interface ConflictResolver { - resolve(op1: LayoutOperation, op2: LayoutOperation): LayoutOperation[] -} - -// Change notification types export interface LayoutChange { type: 'create' | 'update' | 'delete' nodeIds: NodeId[] @@ -467,11 +320,3 @@ export interface LayoutStore { getCurrentSource(): LayoutSource getCurrentActor(): string } - -// CRDT-ready operation log (for future CRDT integration) -export interface OperationLog { - operations: LayoutOperation[] - addOperation(operation: LayoutOperation): void - getOperationsSince(timestamp: number): LayoutOperation[] - getOperationsByActor(actor: string): LayoutOperation[] -} diff --git a/src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts b/src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts index 2778d95f4..3257e8c35 100644 --- a/src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts +++ b/src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts @@ -71,10 +71,3 @@ export const widgetTypeToComponent: Record = { [WidgetType.TREESELECT]: WidgetTreeSelect, [WidgetType.MARKDOWN]: WidgetMarkdown } - -/** - * Helper function to get widget component by type - */ -export function getWidgetComponent(type: string): Component | undefined { - return widgetTypeToComponent[type] -} diff --git a/src/utils/widgetPropFilter.ts b/src/utils/widgetPropFilter.ts index 9456da6b9..af2bac794 100644 --- a/src/utils/widgetPropFilter.ts +++ b/src/utils/widgetPropFilter.ts @@ -27,11 +27,11 @@ export const PANEL_EXCLUDED_PROPS = [ 'overlayClass' ] as const -export const IMAGE_EXCLUDED_PROPS = [ - ...STANDARD_EXCLUDED_PROPS, - 'imageClass', - 'imageStyle' -] as const +// export const IMAGE_EXCLUDED_PROPS = [ +// ...STANDARD_EXCLUDED_PROPS, +// 'imageClass', +// 'imageStyle' +// ] as const export const GALLERIA_EXCLUDED_PROPS = [ ...STANDARD_EXCLUDED_PROPS, @@ -49,11 +49,6 @@ export const BADGE_EXCLUDED_PROPS = [ 'badgeClass' ] as const -export const LABEL_EXCLUDED_PROPS = [ - ...PANEL_EXCLUDED_PROPS, - 'labelStyle' -] as const - /** * Filters widget props by excluding specified properties * @param props - The props object to filter diff --git a/tests-ui/tests/helpers/nodeTestHelpers.ts b/tests-ui/tests/helpers/nodeTestHelpers.ts index c8b980399..a3fe3c6bf 100644 --- a/tests-ui/tests/helpers/nodeTestHelpers.ts +++ b/tests-ui/tests/helpers/nodeTestHelpers.ts @@ -1,31 +1,3 @@ -// Simple mock objects for testing Vue node components -export function createMockWidget(overrides: any = {}) { - return { - name: 'test_widget', - type: 'number', - value: 0, - options: {}, - callback: null, - ...overrides - } -} - -// Create mock VueNodeData for testing -export function createMockVueNodeData(overrides: any = {}) { - return { - id: 'node-1', - type: 'TestNode', - title: 'Test Node', - mode: 0, - selected: false, - executing: false, - widgets: [], - inputs: [], - outputs: [], - ...overrides - } -} - // Create a mock canvas context for transform testing export function createMockCanvasContext() { return { @@ -64,13 +36,3 @@ export function createBounds( height } } - -// Helper to create a position -export function createPosition(x: number, y: number) { - return { x, y } -} - -// Helper to create a size -export function createSize(width: number, height: number) { - return { width, height } -}