Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config: KnipConfig = {
'tests-ui/**/*.{js,ts,vue}',
'*.{js,ts,mts}'
],
ignoreBinaries: ['only-allow', 'openapi-typescript'],
ignoreDependencies: [
'@primeuix/forms',
'@primeuix/styled',
Expand Down Expand Up @@ -59,7 +60,11 @@ const config: KnipConfig = {
'src/components/button/TextButton.vue',
'src/components/card/CardTitle.vue',
'src/components/card/CardDescription.vue',
'src/components/input/SingleSelect.vue'
'src/components/input/SingleSelect.vue',
// Used by a custom node (that should move off of this)
'src/scripts/ui/components/splitButton.ts',
// Generated file: openapi
'src/types/comfyRegistryTypes.ts'
],
ignoreExportsUsedInFile: true,
// Vue-specific configuration
Expand All @@ -68,15 +73,12 @@ const config: KnipConfig = {
// 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: {
binaries: 'off',
classMembers: 'off',
duplicates: 'off',
enumMembers: 'off',
exports: 'off',
nsExports: 'off',
nsTypes: 'off',
types: 'off'
classMembers: 'off'
},
tags: [
'-knipIgnoreUnusedButUsedByCustomNodes',
'-knipIgnoreUnusedButUsedByVueNodesBranch'
],
// Include dependencies analysis
includeEntryExports: true
}
Expand Down
3 changes: 2 additions & 1 deletion src/composables/useTemplateFiltering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { type Ref, computed, ref } from 'vue'

import type { TemplateInfo } from '@/types/workflowTemplateTypes'

export interface TemplateFilterOptions {
// @ts-expect-error unused (To be used later?)
interface TemplateFilterOptions {
searchQuery?: string
}

Expand Down
27 changes: 0 additions & 27 deletions src/constants/serverConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
AutoLaunch,
CrossAttentionMethod,
CudaMalloc,
FloatingPointPrecision,
Expand All @@ -20,32 +19,6 @@ export interface ServerConfig<T> extends FormItem {
getValue?: (value: T) => Record<string, ServerConfigValue>
}

export const WEB_ONLY_CONFIG_ITEMS: ServerConfig<any>[] = [
// Launch behavior
{
id: 'auto-launch',
name: 'Automatically opens in the browser on startup',
category: ['Launch'],
type: 'combo',
options: Object.values(AutoLaunch),
defaultValue: AutoLaunch.Auto,
getValue: (value: AutoLaunch) => {
switch (value) {
case AutoLaunch.Auto:
return {}
case AutoLaunch.Enable:
return {
['auto-launch']: true
}
case AutoLaunch.Disable:
return {
['disable-auto-launch']: true
}
}
}
}
]

export const SERVER_CONFIG_ITEMS: ServerConfig<any>[] = [
// Network settings
{
Expand Down
9 changes: 0 additions & 9 deletions src/extensions/core/load3d/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,3 @@ export interface LoaderManagerInterface {
dispose(): void
loadModel(url: string, originalFileName?: string): Promise<void>
}

export interface RecordingManagerInterface extends BaseManager {
startRecording(): Promise<void>
stopRecording(): void
hasRecording(): boolean
getRecordingDuration(): number
exportRecording(filename?: string): void
clearRecording(): void
}
1 change: 1 addition & 0 deletions src/extensions/core/widgetInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ function getConfig(this: LGraphNode, widgetName: string) {
* @param node The node to convert the widget to an input slot for.
* @param widget The widget to convert to an input slot.
* @returns The input slot that was converted from the widget or undefined if the widget is not found.
* @knipIgnoreUnusedButUsedByCustomNodes
*/
export function convertToInput(
node: LGraphNode,
Expand Down
9 changes: 2 additions & 7 deletions src/lib/litegraph/src/draw.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Rectangle } from './infrastructure/Rectangle'
import type { CanvasColour, Rect } from './interfaces'
import { LiteGraph } from './litegraph'
import { LinkDirection, RenderShape, TitleMode } from './types/globalEnums'
import { RenderShape, TitleMode } from './types/globalEnums'

const ELLIPSIS = '\u2026'
const TWO_DOT_LEADER = '\u2025'
Expand All @@ -22,12 +22,7 @@ export enum SlotShape {
}

/** @see LinkDirection */
export enum SlotDirection {
Up = LinkDirection.UP,
Right = LinkDirection.RIGHT,
Down = LinkDirection.DOWN,
Left = LinkDirection.LEFT
}
export enum SlotDirection {}

export enum LabelPosition {
Left = 'left',
Expand Down
3 changes: 0 additions & 3 deletions src/lib/litegraph/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ export type KeysOfType<T, Match> = Exclude<
undefined
>

/** A new type that contains only the properties of T that are of type Match */
export type PickByType<T, Match> = { [P in keyof T]: Extract<T[P], Match> }

/** The names of all (optional) methods and functions in T */
export type MethodNames<T> = KeysOfType<T, ((...args: any) => any) | undefined>

Expand Down
13 changes: 1 addition & 12 deletions src/lib/litegraph/src/litegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ContextMenu } from './ContextMenu'
import type { LGraphNode } from './LGraphNode'
import { LiteGraphGlobal } from './LiteGraphGlobal'
import type { ConnectingLink, Point } from './interfaces'
import type { IContextMenuOptions, INodeSlot, Size } from './interfaces'
import type { IContextMenuOptions, Size } from './interfaces'
import { loadPolyfills } from './polyfills'
import type { CanvasEventDetail } from './types/events'
import type { RenderShape, TitleMode } from './types/globalEnums'
Expand All @@ -22,8 +22,6 @@ loadPolyfills()
// Definitions by: NateScarlet <https://github.com/NateScarlet>
/** @deprecated Use {@link Point} instead. */
export type Vector2 = Point
/** @deprecated Use {@link Rect} instead. */
export type Vector4 = [number, number, number, number]

export interface IContextMenuItem {
content: string
Expand All @@ -46,14 +44,6 @@ export type ContextMenuEventListener = (
node: LGraphNode
) => boolean | void

export interface LinkReleaseContext {
node_to?: LGraphNode
node_from?: LGraphNode
slot_from: INodeSlot
type_filter_in?: string
type_filter_out?: string
}

export interface LinkReleaseContextExtended {
links: ConnectingLink[]
}
Expand Down Expand Up @@ -117,7 +107,6 @@ export type {
LinkNetwork,
LinkSegment,
MethodNames,
PickByType,
Point,
Positionable,
ReadonlyLinkNetwork,
Expand Down
4 changes: 0 additions & 4 deletions src/lib/litegraph/src/node/slotUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ export function isINodeInputSlot(slot: INodeSlot): slot is INodeInputSlot {
return 'link' in slot
}

export function isINodeOutputSlot(slot: INodeSlot): slot is INodeOutputSlot {
return 'links' in slot
}

/**
* Type guard: Whether this input slot is attached to a widget.
* @param slot The slot to check.
Expand Down
3 changes: 0 additions & 3 deletions src/lib/litegraph/src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export interface CanvasMouseEvent
Readonly<CanvasPointerExtensions>,
LegacyMouseEvent {}

/** DragEvent with canvasX/Y and deltaX/Y properties */
export interface CanvasDragEvent extends DragEvent, CanvasPointerExtensions {}

export type CanvasEventDetail =
| GenericEventDetail
| GroupDoubleClickEventDetail
Expand Down
3 changes: 0 additions & 3 deletions src/lib/litegraph/src/types/globalEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ export enum LGraphEventMode {
}

export enum EaseFunction {
LINEAR = 'linear',
EASE_IN_QUAD = 'easeInQuad',
EASE_OUT_QUAD = 'easeOutQuad',
EASE_IN_OUT_QUAD = 'easeInOutQuad'
}

Expand Down
14 changes: 0 additions & 14 deletions src/lib/litegraph/src/types/serialisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,6 @@ export interface ISerialisedGroup {
flags?: IGraphGroupFlags
}

export type TClipboardLink = [
targetRelativeIndex: number,
originSlot: number,
nodeRelativeIndex: number,
targetSlot: number,
targetNodeId: NodeId
]

/** Items copied from the canvas */
export interface ClipboardItems {
nodes?: ISerialisedNode[]
Expand All @@ -196,12 +188,6 @@ export interface ClipboardItems {
subgraphs?: ExportedSubgraph[]
}

/** @deprecated */
export interface IClipboardContents {
nodes?: ISerialisedNode[]
links?: TClipboardLink[]
}

export interface SerialisableReroute {
id: RerouteId
parentId?: RerouteId
Expand Down
16 changes: 1 addition & 15 deletions src/lib/litegraph/src/utils/collections.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type { LinkId } from '@/lib/litegraph/src/LLink'
import { parseSlotTypes } from '@/lib/litegraph/src/strings'

import type { ConnectingLink, ISlotType, Positionable } from '../interfaces'
import type { ISlotType, Positionable } from '../interfaces'

/**
* Creates a flat set of all positionable items by recursively iterating through all child items.
Expand Down Expand Up @@ -45,19 +44,6 @@ export function findFirstNode(
}
}

/** @returns `true` if the provided link ID is currently being dragged. */
export function isDraggingLink(
linkId: LinkId,
connectingLinks: ConnectingLink[] | null | undefined
): ConnectingLink | undefined {
if (connectingLinks == null) return

for (const connectingLink of connectingLinks) {
if (connectingLink.link == null) continue
if (linkId === connectingLink.link.id) return connectingLink
}
}

type FreeSlotResult<T extends { type: ISlotType }> =
| { index: number; slot: T }
| undefined
Expand Down
47 changes: 0 additions & 47 deletions src/lib/litegraph/src/widgets/widgetMap.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type {
IBaseWidget,
IBooleanWidget,
IButtonWidget,
IComboWidget,
ICustomWidget,
IKnobWidget,
INumericWidget,
ISliderWidget,
IStringWidget,
IWidget,
TWidgetType
} from '@/lib/litegraph/src/types/widgets'
Expand Down Expand Up @@ -130,49 +123,9 @@ export function toConcreteWidget<TWidget extends IWidget | IBaseWidget>(

// #region Type Guards

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IButtonWidget}. */
export function isButtonWidget(widget: IBaseWidget): widget is IButtonWidget {
return widget.type === 'button'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IBooleanWidget}. */
export function isBooleanWidget(widget: IBaseWidget): widget is IBooleanWidget {
return widget.type === 'toggle'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link ISliderWidget}. */
export function isSliderWidget(widget: IBaseWidget): widget is ISliderWidget {
return widget.type === 'slider'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IKnobWidget}. */
export function isKnobWidget(widget: IBaseWidget): widget is IKnobWidget {
return widget.type === 'knob'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IComboWidget}. */
export function isComboWidget(widget: IBaseWidget): widget is IComboWidget {
return widget.type === 'combo'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link INumericWidget}. */
export function isNumberWidget(widget: IBaseWidget): widget is INumericWidget {
return widget.type === 'number'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IStringWidget}. */
export function isStringWidget(widget: IBaseWidget): widget is IStringWidget {
return widget.type === 'string'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link ITextWidget}. */
export function isTextWidget(widget: IBaseWidget): widget is IStringWidget {
return widget.type === 'text'
}

/** Type guard: Narrow **from {@link IBaseWidget}** to {@link ICustomWidget}. */
export function isCustomWidget(widget: IBaseWidget): widget is ICustomWidget {
return widget.type === 'custom'
}

// #endregion Type Guards
Loading
Loading