remove all unused (knip pass)

This commit is contained in:
bymyself
2025-09-04 18:02:13 -07:00
parent 73a1feea99
commit b0f2a1d00a
8 changed files with 8 additions and 270 deletions

View File

@@ -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.
*/

View File

@@ -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'

View File

@@ -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
*/

View File

@@ -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
}

View File

@@ -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[]
}

View File

@@ -71,10 +71,3 @@ export const widgetTypeToComponent: Record<string, Component> = {
[WidgetType.TREESELECT]: WidgetTreeSelect,
[WidgetType.MARKDOWN]: WidgetMarkdown
}
/**
* Helper function to get widget component by type
*/
export function getWidgetComponent(type: string): Component | undefined {
return widgetTypeToComponent[type]
}

View File

@@ -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

View File

@@ -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 }
}