mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
Add import / export sort rules (#612)
- Adds ESLint package - Applies import/export rules to all files - Uses newline delineated grouping, with type-only imports first
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// @ts-strict-ignore
|
||||
import type { CanvasPointerEvent } from "./types/events"
|
||||
|
||||
import { dist2 } from "./measure"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @ts-strict-ignore
|
||||
import type { IContextMenuOptions, IContextMenuValue } from "./interfaces"
|
||||
|
||||
import { LiteGraph } from "./litegraph"
|
||||
|
||||
interface ContextMenuDivElement extends HTMLDivElement {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Point, Rect } from "./interfaces"
|
||||
|
||||
import { clamp, LGraphCanvas } from "./litegraph"
|
||||
import { distance } from "./measure"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// @ts-strict-ignore
|
||||
import type { Point, Rect, Rect32 } from "./interfaces"
|
||||
import type { CanvasMouseEvent } from "./types/events"
|
||||
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import { isInRect } from "./measure"
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type {
|
||||
Dictionary,
|
||||
IContextMenuValue,
|
||||
LinkNetwork,
|
||||
ISlotType,
|
||||
LinkNetwork,
|
||||
LinkSegment,
|
||||
MethodNames,
|
||||
Point,
|
||||
LinkSegment,
|
||||
Positionable,
|
||||
} from "./interfaces"
|
||||
import type {
|
||||
@@ -14,17 +14,18 @@ import type {
|
||||
SerialisableGraph,
|
||||
SerialisableReroute,
|
||||
} from "./types/serialisation"
|
||||
import { Reroute, RerouteId } from "./Reroute"
|
||||
import { LGraphEventMode } from "./types/globalEnums"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
|
||||
import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import { type NodeId, LGraphNode } from "./LGraphNode"
|
||||
import { LGraphNode, type NodeId } from "./LGraphNode"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import { type LinkId, LLink } from "./LLink"
|
||||
import { MapProxyHandler } from "./MapProxyHandler"
|
||||
import { isSortaInsideOctagon } from "./measure"
|
||||
import { getAllNestedItems } from "./utils/collections"
|
||||
import { Reroute, RerouteId } from "./Reroute"
|
||||
import { stringOrEmpty } from "./strings"
|
||||
import { LGraphEventMode } from "./types/globalEnums"
|
||||
import { getAllNestedItems } from "./utils/collections"
|
||||
|
||||
interface IGraphInput {
|
||||
name: string
|
||||
|
||||
@@ -1,42 +1,62 @@
|
||||
// @ts-strict-ignore
|
||||
import type { ContextMenu } from "./ContextMenu"
|
||||
import type {
|
||||
CanvasColour,
|
||||
ColorOption,
|
||||
ConnectingLink,
|
||||
Dictionary,
|
||||
Direction,
|
||||
IBoundaryNodes,
|
||||
IColorable,
|
||||
IContextMenuOptions,
|
||||
INodeSlot,
|
||||
IContextMenuValue,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
INodeSlot,
|
||||
IOptionalSlotData,
|
||||
ISlotType,
|
||||
LinkSegment,
|
||||
NullableProperties,
|
||||
Point,
|
||||
Positionable,
|
||||
ReadOnlyPoint,
|
||||
ReadOnlyRect,
|
||||
Rect,
|
||||
Rect32,
|
||||
Size,
|
||||
IContextMenuValue,
|
||||
ISlotType,
|
||||
ConnectingLink,
|
||||
NullableProperties,
|
||||
Positionable,
|
||||
LinkSegment,
|
||||
ReadOnlyPoint,
|
||||
ReadOnlyRect,
|
||||
ColorOption,
|
||||
IColorable,
|
||||
} from "./interfaces"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
import { LGraphNode, type NodeId } from "./LGraphNode"
|
||||
import type { LGraph } from "./LGraph"
|
||||
import type {
|
||||
CanvasDragEvent,
|
||||
CanvasMouseEvent,
|
||||
CanvasEventDetail,
|
||||
CanvasMouseEvent,
|
||||
CanvasPointerEvent,
|
||||
CanvasPointerExtensions,
|
||||
} from "./types/events"
|
||||
import type { ClipboardItems } from "./types/serialisation"
|
||||
import { LLink, type LinkId } from "./LLink"
|
||||
import type { LGraph } from "./LGraph"
|
||||
import type { ContextMenu } from "./ContextMenu"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
|
||||
import { CanvasPointer } from "./CanvasPointer"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { strokeShape } from "./draw"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import { LGraphNode, type NodeId } from "./LGraphNode"
|
||||
import { LinkReleaseContextExtended, LiteGraph } from "./litegraph"
|
||||
import { type LinkId, LLink } from "./LLink"
|
||||
import {
|
||||
containsRect,
|
||||
createBounds,
|
||||
distance,
|
||||
findPointOnCurve,
|
||||
isInRect,
|
||||
isInRectangle,
|
||||
isPointInRect,
|
||||
overlapBounding,
|
||||
snapPoint,
|
||||
} from "./measure"
|
||||
import { type ConnectionColorContext } from "./NodeSlot"
|
||||
import { Reroute, type RerouteId } from "./Reroute"
|
||||
import { stringOrEmpty, stringOrNull } from "./strings"
|
||||
import {
|
||||
CanvasItem,
|
||||
EaseFunction,
|
||||
@@ -47,28 +67,9 @@ import {
|
||||
RenderShape,
|
||||
TitleMode,
|
||||
} from "./types/globalEnums"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import {
|
||||
distance,
|
||||
overlapBounding,
|
||||
isPointInRect,
|
||||
findPointOnCurve,
|
||||
containsRect,
|
||||
isInRectangle,
|
||||
createBounds,
|
||||
isInRect,
|
||||
snapPoint,
|
||||
} from "./measure"
|
||||
import { strokeShape } from "./draw"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { LinkReleaseContextExtended, LiteGraph } from "./litegraph"
|
||||
import { stringOrEmpty, stringOrNull } from "./strings"
|
||||
import { alignNodes, distributeNodes, getBoundaryNodes } from "./utils/arrange"
|
||||
import { Reroute, type RerouteId } from "./Reroute"
|
||||
import { getAllNestedItems, findFirstNode } from "./utils/collections"
|
||||
import { CanvasPointer } from "./CanvasPointer"
|
||||
import { findFirstNode, getAllNestedItems } from "./utils/collections"
|
||||
import { toClass } from "./utils/type"
|
||||
import { type ConnectionColorContext } from "./NodeSlot"
|
||||
import { WIDGET_TYPE_MAP } from "./widgets/widgetMap"
|
||||
|
||||
interface IShowSearchOptions {
|
||||
|
||||
@@ -10,19 +10,21 @@ import type {
|
||||
} from "./interfaces"
|
||||
import type { LGraph } from "./LGraph"
|
||||
import type { ISerialisedGroup } from "./types/serialisation"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
|
||||
import { NullGraphError } from "@/infrastructure/NullGraphError"
|
||||
|
||||
import { strokeShape } from "./draw"
|
||||
import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import {
|
||||
containsCentre,
|
||||
containsRect,
|
||||
createBounds,
|
||||
isInRectangle,
|
||||
isPointInRect,
|
||||
createBounds,
|
||||
snapPoint,
|
||||
} from "./measure"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { strokeShape } from "./draw"
|
||||
import { NullGraphError } from "@/infrastructure/NullGraphError"
|
||||
|
||||
export interface IGraphGroupFlags extends Record<string, unknown> {
|
||||
pinned?: true
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @ts-strict-ignore
|
||||
import type { DragAndScale } from "./DragAndScale"
|
||||
import type {
|
||||
CanvasColour,
|
||||
ColorOption,
|
||||
@@ -21,28 +22,28 @@ import type {
|
||||
Size,
|
||||
} from "./interfaces"
|
||||
import type { LGraph } from "./LGraph"
|
||||
import type { IBaseWidget, IWidget, TWidgetValue, TWidgetType, IWidgetOptions } from "./types/widgets"
|
||||
import type { ISerialisedNode } from "./types/serialisation"
|
||||
import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import type { CanvasMouseEvent } from "./types/events"
|
||||
import type { DragAndScale } from "./DragAndScale"
|
||||
import type { RerouteId } from "./Reroute"
|
||||
import type { CanvasMouseEvent } from "./types/events"
|
||||
import type { ISerialisedNode } from "./types/serialisation"
|
||||
import type { IBaseWidget, IWidget, IWidgetOptions, TWidgetType, TWidgetValue } from "./types/widgets"
|
||||
|
||||
import { NullGraphError } from "./infrastructure/NullGraphError"
|
||||
import { BadgePosition, LGraphBadge } from "./LGraphBadge"
|
||||
import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import { type LGraphNodeConstructor, LiteGraph } from "./litegraph"
|
||||
import { LLink } from "./LLink"
|
||||
import { createBounds, isInRect, isInRectangle, snapPoint } from "./measure"
|
||||
import { ConnectionColorContext, isINodeInputSlot, isWidgetInputSlot, NodeInputSlot, NodeOutputSlot, serializeSlot, toNodeSlotClass } from "./NodeSlot"
|
||||
import {
|
||||
LGraphEventMode,
|
||||
NodeSlotType,
|
||||
TitleMode,
|
||||
RenderShape,
|
||||
TitleMode,
|
||||
} from "./types/globalEnums"
|
||||
import { BadgePosition, LGraphBadge } from "./LGraphBadge"
|
||||
import { type LGraphNodeConstructor, LiteGraph } from "./litegraph"
|
||||
import { isInRectangle, isInRect, snapPoint, createBounds } from "./measure"
|
||||
import { LLink } from "./LLink"
|
||||
import { ConnectionColorContext, isINodeInputSlot, isWidgetInputSlot, NodeInputSlot, NodeOutputSlot, serializeSlot, toNodeSlotClass } from "./NodeSlot"
|
||||
import { WIDGET_TYPE_MAP } from "./widgets/widgetMap"
|
||||
import { toClass } from "./utils/type"
|
||||
import { LayoutElement } from "./utils/layout"
|
||||
import { distributeSpace } from "./utils/spaceDistribution"
|
||||
import { NullGraphError } from "./infrastructure/NullGraphError"
|
||||
import { toClass } from "./utils/type"
|
||||
import { WIDGET_TYPE_MAP } from "./widgets/widgetMap"
|
||||
|
||||
export type NodeId = number | string
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
CanvasColour,
|
||||
LinkNetwork,
|
||||
ISlotType,
|
||||
LinkNetwork,
|
||||
LinkSegment,
|
||||
} from "./interfaces"
|
||||
import type { NodeId } from "./LGraphNode"
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import { LGraph } from "./LGraph"
|
||||
import { LLink } from "./LLink"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import type { Dictionary, ISlotType, Rect, WhenNullish } from "./interfaces"
|
||||
|
||||
import { ContextMenu } from "./ContextMenu"
|
||||
import { CurveEditor } from "./CurveEditor"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { LabelPosition, SlotDirection, SlotShape, SlotType } from "./draw"
|
||||
import { LGraph } from "./LGraph"
|
||||
import { LGraphCanvas } from "./LGraphCanvas"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { LLink } from "./LLink"
|
||||
import { distance, isInsideRectangle, overlapBounding } from "./measure"
|
||||
import { Reroute } from "./Reroute"
|
||||
import {
|
||||
LGraphEventMode,
|
||||
LinkDirection,
|
||||
@@ -13,11 +19,6 @@ import {
|
||||
RenderShape,
|
||||
TitleMode,
|
||||
} from "./types/globalEnums"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { SlotShape, SlotDirection, SlotType, LabelPosition } from "./draw"
|
||||
import type { Dictionary, ISlotType, Rect, WhenNullish } from "./interfaces"
|
||||
import { distance, isInsideRectangle, overlapBounding } from "./measure"
|
||||
import { Reroute } from "./Reroute"
|
||||
|
||||
/**
|
||||
* The Global Scope. It contains all the registered node classes.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { CanvasColour, ConnectingLink, Dictionary, INodeInputSlot, INodeOutputSlot, INodeSlot, ISlotType, IWidgetInputSlot, Point } from "./interfaces"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
import type { LinkId } from "./LLink"
|
||||
import { LinkDirection, RenderShape } from "./types/globalEnums"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
|
||||
import { LabelPosition, SlotShape, SlotType } from "./draw"
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import { LinkDirection, RenderShape } from "./types/globalEnums"
|
||||
import { ISerialisedNodeOutputSlot } from "./types/serialisation"
|
||||
import { ISerialisedNodeInputSlot } from "./types/serialisation"
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import type {
|
||||
CanvasColour,
|
||||
LinkSegment,
|
||||
LinkNetwork,
|
||||
LinkSegment,
|
||||
Point,
|
||||
Positionable,
|
||||
ReadOnlyRect,
|
||||
} from "./interfaces"
|
||||
import { LLink, type LinkId } from "./LLink"
|
||||
import type { SerialisableReroute, Serialisable } from "./types/serialisation"
|
||||
import { distance } from "./measure"
|
||||
import type { NodeId } from "./LGraphNode"
|
||||
import type { Serialisable, SerialisableReroute } from "./types/serialisation"
|
||||
|
||||
import { type LinkId, LLink } from "./LLink"
|
||||
import { distance } from "./measure"
|
||||
|
||||
export type RerouteId = number
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import type { CanvasColour, Rect } from "./interfaces"
|
||||
|
||||
import { LiteGraph } from "./litegraph"
|
||||
import { LinkDirection, RenderShape, TitleMode } from "./types/globalEnums"
|
||||
|
||||
export enum SlotType {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { ContextMenu } from "./ContextMenu"
|
||||
import type { LGraphNode, NodeId } from "./LGraphNode"
|
||||
import type { LinkDirection, RenderShape } from "./types/globalEnums"
|
||||
import type { LinkId, LLink } from "./LLink"
|
||||
import type { Reroute, RerouteId } from "./Reroute"
|
||||
import type { LinkDirection, RenderShape } from "./types/globalEnums"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
import type { LayoutElement } from "./utils/layout"
|
||||
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import type { Point, ConnectingLink } from "./interfaces"
|
||||
import type { LabelPosition, SlotDirection, SlotShape, SlotType } from "./draw"
|
||||
import type { ConnectingLink, Point } from "./interfaces"
|
||||
import type {
|
||||
INodeSlot,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
CanvasColour,
|
||||
ColorOption,
|
||||
Direction,
|
||||
IBoundaryNodes,
|
||||
IColorable,
|
||||
IContextMenuOptions,
|
||||
IContextMenuValue,
|
||||
IFoundSlot,
|
||||
IInputOrOutput,
|
||||
INodeFlags,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
INodeSlot,
|
||||
IOptionalSlotData,
|
||||
ISlotType,
|
||||
KeysOfType,
|
||||
@@ -19,51 +22,50 @@ import type {
|
||||
Rect,
|
||||
Rect32,
|
||||
Size,
|
||||
ColorOption,
|
||||
IColorable,
|
||||
} from "./interfaces"
|
||||
import type { SlotShape, LabelPosition, SlotDirection, SlotType } from "./draw"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
import type { RenderShape, TitleMode } from "./types/globalEnums"
|
||||
import type { CanvasEventDetail } from "./types/events"
|
||||
import { LiteGraphGlobal } from "./LiteGraphGlobal"
|
||||
import { loadPolyfills } from "./polyfills"
|
||||
import type { RenderShape, TitleMode } from "./types/globalEnums"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
|
||||
import { LGraph } from "./LGraph"
|
||||
import { LGraphCanvas, type LGraphCanvasState } from "./LGraphCanvas"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import { LLink } from "./LLink"
|
||||
import { ContextMenu } from "./ContextMenu"
|
||||
import { CurveEditor } from "./CurveEditor"
|
||||
import { LGraphBadge, BadgePosition } from "./LGraphBadge"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { LGraph } from "./LGraph"
|
||||
import { BadgePosition, LGraphBadge } from "./LGraphBadge"
|
||||
import { LGraphCanvas, type LGraphCanvasState } from "./LGraphCanvas"
|
||||
import { LGraphGroup } from "./LGraphGroup"
|
||||
import { LGraphNode } from "./LGraphNode"
|
||||
import { LiteGraphGlobal } from "./LiteGraphGlobal"
|
||||
import { LLink } from "./LLink"
|
||||
import { loadPolyfills } from "./polyfills"
|
||||
|
||||
export const LiteGraph = new LiteGraphGlobal()
|
||||
export {
|
||||
ContextMenu,
|
||||
CurveEditor,
|
||||
DragAndScale,
|
||||
LGraph,
|
||||
LGraphCanvas,
|
||||
LGraphCanvasState,
|
||||
DragAndScale,
|
||||
LGraphNode,
|
||||
LGraphGroup,
|
||||
LGraphNode,
|
||||
LLink,
|
||||
ContextMenu,
|
||||
CurveEditor,
|
||||
}
|
||||
export {
|
||||
INodeSlot,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
ConnectingLink,
|
||||
CanvasColour,
|
||||
ColorOption,
|
||||
ConnectingLink,
|
||||
Direction,
|
||||
IBoundaryNodes,
|
||||
IColorable,
|
||||
IContextMenuOptions,
|
||||
IContextMenuValue,
|
||||
IFoundSlot,
|
||||
IInputOrOutput,
|
||||
INodeFlags,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
INodeSlot,
|
||||
IOptionalSlotData,
|
||||
ISlotType,
|
||||
KeysOfType,
|
||||
@@ -72,23 +74,21 @@ export {
|
||||
Rect,
|
||||
Rect32,
|
||||
Size,
|
||||
ColorOption,
|
||||
IColorable,
|
||||
}
|
||||
export { isColorable } from "./utils/type"
|
||||
export { IWidget }
|
||||
export { LGraphBadge, BadgePosition }
|
||||
export { SlotShape, LabelPosition, SlotDirection, SlotType }
|
||||
export { CanvasItem, EaseFunction, LinkMarkerShape, LGraphEventMode, RenderShape, TitleMode } from "./types/globalEnums"
|
||||
export { BadgePosition, LGraphBadge }
|
||||
export { LabelPosition, SlotDirection, SlotShape, SlotType }
|
||||
export { CanvasPointer } from "./CanvasPointer"
|
||||
export { strokeShape } from "./draw"
|
||||
export { createBounds } from "./measure"
|
||||
export { Reroute } from "./Reroute"
|
||||
export { CanvasItem, EaseFunction, LGraphEventMode, LinkMarkerShape, RenderShape, TitleMode } from "./types/globalEnums"
|
||||
export type {
|
||||
ISerialisedGraph,
|
||||
SerialisableGraph,
|
||||
SerialisableLLink,
|
||||
ISerialisedGraph,
|
||||
} from "./types/serialisation"
|
||||
export { CanvasPointer } from "./CanvasPointer"
|
||||
export { Reroute } from "./Reroute"
|
||||
export { createBounds } from "./measure"
|
||||
export { strokeShape } from "./draw"
|
||||
|
||||
export function clamp(v: number, a: number, b: number): number {
|
||||
return a > v ? a : b < v ? b : v
|
||||
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
ReadOnlyRect,
|
||||
Rect,
|
||||
} from "./interfaces"
|
||||
|
||||
import { LinkDirection } from "./types/globalEnums"
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* Event interfaces for event extension
|
||||
*/
|
||||
|
||||
import type { LGraphGroup } from "../LGraphGroup"
|
||||
import type { LGraphNode } from "../LGraphNode"
|
||||
import type { ConnectingLink, LinkReleaseContextExtended } from "../litegraph"
|
||||
import type { IWidget } from "./widgets"
|
||||
import type { LGraphNode } from "../LGraphNode"
|
||||
import type { LGraphGroup } from "../LGraphGroup"
|
||||
|
||||
/** For Canvas*Event - adds graph space co-ordinates (property names are shipped) */
|
||||
export interface ICanvasPosition {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type {
|
||||
ISlotType,
|
||||
Dictionary,
|
||||
INodeFlags,
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
ISlotType,
|
||||
Point,
|
||||
Size,
|
||||
} from "../interfaces"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { CanvasColour, Point, Size } from "../interfaces"
|
||||
import type { CanvasPointer, LGraphCanvas, LGraphNode } from "../litegraph"
|
||||
import type { CanvasMouseEvent, CanvasPointerEvent } from "./events"
|
||||
|
||||
import { CanvasColour, Point, Size } from "../interfaces"
|
||||
|
||||
export interface IWidgetOptions<TValue = unknown> extends Record<string, unknown> {
|
||||
on?: string
|
||||
off?: string
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Positionable } from "../interfaces"
|
||||
|
||||
import { LGraphNode } from "@/LGraphNode"
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Point } from "@/interfaces"
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
import type { CanvasPointer, LGraphCanvas, LGraphNode, Size } from "@/litegraph"
|
||||
import type { CanvasMouseEvent, CanvasPointerEvent } from "@/types/events"
|
||||
import type { IBaseWidget, IWidget, IWidgetOptions, TWidgetType, TWidgetValue } from "@/types/widgets"
|
||||
|
||||
import { Point } from "@/interfaces"
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
|
||||
export abstract class BaseWidget implements IBaseWidget {
|
||||
linkedWidgets?: IWidget[]
|
||||
options: IWidgetOptions<unknown>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { IBooleanWidget } from "@/types/widgets"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { IBooleanWidget } from "@/types/widgets"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
export class BooleanWidget extends BaseWidget implements IBooleanWidget {
|
||||
// IBooleanWidget properties
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { IButtonWidget, IWidgetOptions } from "@/types/widgets"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { IButtonWidget, IWidgetOptions } from "@/types/widgets"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
export class ButtonWidget extends BaseWidget implements IButtonWidget {
|
||||
// IButtonWidget properties
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import type { IComboWidget, IWidgetOptions } from "@/types/widgets"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { IComboWidget, IWidgetOptions } from "@/types/widgets"
|
||||
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
export class ComboWidget extends BaseWidget implements IComboWidget {
|
||||
// IComboWidget properties
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { INumericWidget, IWidgetOptions } from "@/types/widgets"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { INumericWidget, IWidgetOptions } from "@/types/widgets"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
export class NumberWidget extends BaseWidget implements INumericWidget {
|
||||
// INumberWidget properties
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import type { ISliderWidget, IWidgetSliderOptions } from "@/types/widgets"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { ISliderWidget, IWidgetSliderOptions } from "@/types/widgets"
|
||||
|
||||
import { clamp } from "@/litegraph"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
export class SliderWidget extends BaseWidget implements ISliderWidget {
|
||||
// ISliderWidget properties
|
||||
declare type: "slider"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { IStringWidget, IWidgetOptions } from "@/types/widgets"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { LGraphNode } from "@/LGraphNode"
|
||||
import type { CanvasMouseEvent } from "@/types/events"
|
||||
import type { LGraphCanvas } from "@/LGraphCanvas"
|
||||
import type { IStringWidget, IWidgetOptions } from "@/types/widgets"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
export class TextWidget extends BaseWidget implements IStringWidget {
|
||||
// IStringWidget properties
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// @ts-strict-ignore
|
||||
import type { IBaseWidget } from "@/types/widgets"
|
||||
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
import { BooleanWidget } from "./BooleanWidget"
|
||||
import { ButtonWidget } from "./ButtonWidget"
|
||||
import { ComboWidget } from "./ComboWidget"
|
||||
import { NumberWidget } from "./NumberWidget"
|
||||
import { SliderWidget } from "./SliderWidget"
|
||||
import { TextWidget } from "./TextWidget"
|
||||
import { BaseWidget } from "./BaseWidget"
|
||||
|
||||
type WidgetConstructor = {
|
||||
new (plain: IBaseWidget): BaseWidget
|
||||
|
||||
Reference in New Issue
Block a user