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:
filtered
2025-02-26 20:21:33 +11:00
committed by GitHub
parent 9ded97d189
commit 5cdd0581fa
31 changed files with 201 additions and 145 deletions

View File

@@ -4,6 +4,7 @@ import tseslint from "typescript-eslint"
import stylistic from "@stylistic/eslint-plugin"
import jsdoc from "eslint-plugin-jsdoc"
import unusedImports from "eslint-plugin-unused-imports"
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort"
export default tseslint.config(
{ files: ["**/*.{js,mjs,ts,mts}"] },
@@ -207,4 +208,21 @@ export default tseslint.config(
"unused-imports/no-unused-vars": "error",
},
},
// Sort imports
{
plugins: {
"simple-import-sort": eslintPluginSimpleImportSort,
},
rules: {
"simple-import-sort/imports": [
"error",
{
// The default grouping, but with type imports first as a separate group.
groups: [["^.*\\u0000$"], ["^\\u0000"], ["^node:"], ["^@?\\w"], ["^"], ["^\\."]],
},
],
"simple-import-sort/exports": "error",
},
},
)

11
package-lock.json generated
View File

@@ -15,6 +15,7 @@
"@types/node": "^22.1.0",
"eslint": "^9.14.0",
"eslint-plugin-jsdoc": "^50.6.3",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^15.12.0",
"husky": "^9.1.7",
@@ -2841,6 +2842,16 @@
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
}
},
"node_modules/eslint-plugin-simple-import-sort": {
"version": "12.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz",
"integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"eslint": ">=5.0.0"
}
},
"node_modules/eslint-plugin-unused-imports": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz",

View File

@@ -52,6 +52,7 @@
"@types/node": "^22.1.0",
"eslint": "^9.14.0",
"eslint-plugin-jsdoc": "^50.6.3",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^15.12.0",
"husky": "^9.1.7",

View File

@@ -1,5 +1,6 @@
// @ts-strict-ignore
import type { CanvasPointerEvent } from "./types/events"
import { dist2 } from "./measure"
/**

View File

@@ -1,5 +1,6 @@
// @ts-strict-ignore
import type { IContextMenuOptions, IContextMenuValue } from "./interfaces"
import { LiteGraph } from "./litegraph"
interface ContextMenuDivElement extends HTMLDivElement {

View File

@@ -1,4 +1,5 @@
import type { Point, Rect } from "./interfaces"
import { clamp, LGraphCanvas } from "./litegraph"
import { distance } from "./measure"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
import type {
CanvasColour,
LinkNetwork,
ISlotType,
LinkNetwork,
LinkSegment,
} from "./interfaces"
import type { NodeId } from "./LGraphNode"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,6 +5,7 @@ import type {
ReadOnlyRect,
Rect,
} from "./interfaces"
import { LinkDirection } from "./types/globalEnums"
/**

View File

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

View File

@@ -1,9 +1,9 @@
import type {
ISlotType,
Dictionary,
INodeFlags,
INodeInputSlot,
INodeOutputSlot,
ISlotType,
Point,
Size,
} from "../interfaces"

View File

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

View File

@@ -1,4 +1,5 @@
import type { Positionable } from "../interfaces"
import { LGraphNode } from "@/LGraphNode"
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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