mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user