@codebolt/litegraph 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +161 -0
- package/dist/CanvasPointer.d.ts +120 -0
- package/dist/ContextMenu.d.ts +41 -0
- package/dist/CurveEditor.d.ts +18 -0
- package/dist/DragAndScale.d.ts +67 -0
- package/dist/LGraph.d.ts +407 -0
- package/dist/LGraphBadge.d.ts +33 -0
- package/dist/LGraphButton.d.ts +27 -0
- package/dist/LGraphCanvas.d.ts +772 -0
- package/dist/LGraphGroup.d.ts +81 -0
- package/dist/LGraphIcon.d.ts +22 -0
- package/dist/LGraphNode.d.ts +883 -0
- package/dist/LLink.d.ts +194 -0
- package/dist/LiteGraphGlobal.d.ts +360 -0
- package/dist/MapProxyHandler.d.ts +13 -0
- package/dist/Reroute.d.ts +185 -0
- package/dist/canvas/FloatingRenderLink.d.ts +55 -0
- package/dist/canvas/InputIndicators.d.ts +45 -0
- package/dist/canvas/LinkConnector.d.ts +165 -0
- package/dist/canvas/MovingInputLink.d.ts +34 -0
- package/dist/canvas/MovingLinkBase.d.ts +55 -0
- package/dist/canvas/MovingOutputLink.d.ts +30 -0
- package/dist/canvas/RenderLink.d.ts +39 -0
- package/dist/canvas/ToInputFromIoNodeLink.d.ts +37 -0
- package/dist/canvas/ToInputRenderLink.d.ts +35 -0
- package/dist/canvas/ToOutputFromIoNodeLink.d.ts +33 -0
- package/dist/canvas/ToOutputFromRerouteLink.d.ts +15 -0
- package/dist/canvas/ToOutputRenderLink.d.ts +32 -0
- package/dist/canvas/measureSlots.d.ts +22 -0
- package/dist/constants.d.ts +9 -0
- package/dist/css/litegraph.css +638 -0
- package/dist/draw.d.ts +65 -0
- package/dist/infrastructure/ConstrainedSize.d.ts +27 -0
- package/dist/infrastructure/CustomEventTarget.d.ts +72 -0
- package/dist/infrastructure/InvalidLinkError.d.ts +3 -0
- package/dist/infrastructure/LGraphCanvasEventMap.d.ts +41 -0
- package/dist/infrastructure/LGraphEventMap.d.ts +43 -0
- package/dist/infrastructure/LinkConnectorEventMap.d.ts +47 -0
- package/dist/infrastructure/NullGraphError.d.ts +3 -0
- package/dist/infrastructure/Rectangle.d.ts +163 -0
- package/dist/infrastructure/RecursionError.d.ts +6 -0
- package/dist/infrastructure/SlotIndexError.d.ts +3 -0
- package/dist/infrastructure/SubgraphEventMap.d.ts +49 -0
- package/dist/infrastructure/SubgraphInputEventMap.d.ts +13 -0
- package/dist/interfaces.d.ts +388 -0
- package/dist/litegraph.d.ts +95 -0
- package/dist/litegraph.es.js +17613 -0
- package/dist/litegraph.es.js.map +1 -0
- package/dist/litegraph.umd.js +3 -0
- package/dist/litegraph.umd.js.map +1 -0
- package/dist/measure.d.ts +168 -0
- package/dist/node/NodeInputSlot.d.ts +20 -0
- package/dist/node/NodeOutputSlot.d.ts +18 -0
- package/dist/node/NodeSlot.d.ts +35 -0
- package/dist/node/SlotBase.d.ts +27 -0
- package/dist/node/slotUtils.d.ts +17 -0
- package/dist/polyfills.d.ts +1 -0
- package/dist/strings.d.ts +22 -0
- package/dist/subgraph/EmptySubgraphInput.d.ts +15 -0
- package/dist/subgraph/EmptySubgraphOutput.d.ts +15 -0
- package/dist/subgraph/ExecutableNodeDTO.d.ts +96 -0
- package/dist/subgraph/Subgraph.d.ts +65 -0
- package/dist/subgraph/SubgraphIONodeBase.d.ts +80 -0
- package/dist/subgraph/SubgraphInput.d.ts +47 -0
- package/dist/subgraph/SubgraphInputNode.d.ts +33 -0
- package/dist/subgraph/SubgraphNode.d.ts +73 -0
- package/dist/subgraph/SubgraphOutput.d.ts +30 -0
- package/dist/subgraph/SubgraphOutputNode.d.ts +31 -0
- package/dist/subgraph/SubgraphSlotBase.d.ts +61 -0
- package/dist/subgraph/subgraphUtils.d.ts +77 -0
- package/dist/types/NodeLike.d.ts +7 -0
- package/dist/types/events.d.ts +64 -0
- package/dist/types/globalEnums.d.ts +130 -0
- package/dist/types/serialisation.d.ts +198 -0
- package/dist/types/utility.d.ts +11 -0
- package/dist/types/widgets.d.ts +209 -0
- package/dist/utils/arrange.d.ts +22 -0
- package/dist/utils/collections.d.ts +38 -0
- package/dist/utils/feedback.d.ts +7 -0
- package/dist/utils/object.d.ts +1 -0
- package/dist/utils/spaceDistribution.d.ts +11 -0
- package/dist/utils/textUtils.d.ts +9 -0
- package/dist/utils/type.d.ts +14 -0
- package/dist/utils/uuid.d.ts +13 -0
- package/dist/utils/widget.d.ts +7 -0
- package/dist/widgets/BaseSteppedWidget.d.ts +34 -0
- package/dist/widgets/BaseWidget.d.ts +125 -0
- package/dist/widgets/BooleanWidget.d.ts +9 -0
- package/dist/widgets/ButtonWidget.d.ts +16 -0
- package/dist/widgets/ComboWidget.d.ts +17 -0
- package/dist/widgets/KnobWidget.d.ts +20 -0
- package/dist/widgets/LegacyWidget.d.ts +14 -0
- package/dist/widgets/NumberWidget.d.ts +18 -0
- package/dist/widgets/SliderWidget.d.ts +20 -0
- package/dist/widgets/TextWidget.d.ts +13 -0
- package/dist/widgets/widgetMap.d.ts +50 -0
- package/package.json +76 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Point } from '../interfaces';
|
|
2
|
+
import { CanvasPointer, LGraphCanvas, LGraphNode, Size } from '../litegraph';
|
|
3
|
+
import { CanvasPointerEvent } from '../types/events';
|
|
4
|
+
import { IBaseWidget } from '../types/widgets';
|
|
5
|
+
export interface DrawWidgetOptions {
|
|
6
|
+
/** The width of the node where this widget will be displayed. */
|
|
7
|
+
width: number;
|
|
8
|
+
/** Synonym for "low quality". */
|
|
9
|
+
showText?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface DrawTruncatingTextOptions extends DrawWidgetOptions {
|
|
12
|
+
/** The canvas context to draw the text on. */
|
|
13
|
+
ctx: CanvasRenderingContext2D;
|
|
14
|
+
/** The amount of padding to add to the left of the text. */
|
|
15
|
+
leftPadding?: number;
|
|
16
|
+
/** The amount of padding to add to the right of the text. */
|
|
17
|
+
rightPadding?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface WidgetEventOptions {
|
|
20
|
+
e: CanvasPointerEvent;
|
|
21
|
+
node: LGraphNode;
|
|
22
|
+
canvas: LGraphCanvas;
|
|
23
|
+
}
|
|
24
|
+
export declare abstract class BaseWidget<TWidget extends IBaseWidget = IBaseWidget> implements IBaseWidget {
|
|
25
|
+
#private;
|
|
26
|
+
/** From node edge to widget edge */
|
|
27
|
+
static margin: number;
|
|
28
|
+
/** From widget edge to tip of arrow button */
|
|
29
|
+
static arrowMargin: number;
|
|
30
|
+
/** Arrow button width */
|
|
31
|
+
static arrowWidth: number;
|
|
32
|
+
/** Absolute minimum display width of widget values */
|
|
33
|
+
static minValueWidth: number;
|
|
34
|
+
/** Minimum gap between label and value */
|
|
35
|
+
static labelValueGap: number;
|
|
36
|
+
computedHeight?: number;
|
|
37
|
+
serialize?: boolean;
|
|
38
|
+
computeLayoutSize?(node: LGraphNode): {
|
|
39
|
+
minHeight: number;
|
|
40
|
+
maxHeight?: number;
|
|
41
|
+
minWidth: number;
|
|
42
|
+
maxWidth?: number;
|
|
43
|
+
};
|
|
44
|
+
/** The node that this widget belongs to. */
|
|
45
|
+
get node(): LGraphNode;
|
|
46
|
+
linkedWidgets?: IBaseWidget[];
|
|
47
|
+
name: string;
|
|
48
|
+
options: TWidget["options"];
|
|
49
|
+
label?: string;
|
|
50
|
+
type: TWidget["type"];
|
|
51
|
+
y: number;
|
|
52
|
+
last_y?: number;
|
|
53
|
+
width?: number;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
computedDisabled?: boolean;
|
|
56
|
+
hidden?: boolean;
|
|
57
|
+
advanced?: boolean;
|
|
58
|
+
tooltip?: string;
|
|
59
|
+
element?: HTMLElement;
|
|
60
|
+
callback?(value: any, canvas?: LGraphCanvas, node?: LGraphNode, pos?: Point, e?: CanvasPointerEvent): void;
|
|
61
|
+
mouse?(event: CanvasPointerEvent, pointerOffset: Point, node: LGraphNode): boolean;
|
|
62
|
+
computeSize?(width?: number): Size;
|
|
63
|
+
onPointerDown?(pointer: CanvasPointer, node: LGraphNode, canvas: LGraphCanvas): boolean;
|
|
64
|
+
get value(): TWidget["value"];
|
|
65
|
+
set value(value: TWidget["value"]);
|
|
66
|
+
constructor(widget: TWidget & {
|
|
67
|
+
node: LGraphNode;
|
|
68
|
+
});
|
|
69
|
+
constructor(widget: TWidget, node: LGraphNode);
|
|
70
|
+
get outline_color(): string;
|
|
71
|
+
get background_color(): string;
|
|
72
|
+
get height(): number;
|
|
73
|
+
get text_color(): string;
|
|
74
|
+
get secondary_text_color(): string;
|
|
75
|
+
get disabledTextColor(): string;
|
|
76
|
+
get displayName(): string;
|
|
77
|
+
get _displayValue(): string;
|
|
78
|
+
get labelBaseline(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Draws the widget
|
|
81
|
+
* @param ctx The canvas context
|
|
82
|
+
* @param options The options for drawing the widget
|
|
83
|
+
* @remarks Not naming this `draw` as `draw` conflicts with the `draw` method in
|
|
84
|
+
* custom widgets.
|
|
85
|
+
*/
|
|
86
|
+
abstract drawWidget(ctx: CanvasRenderingContext2D, options: DrawWidgetOptions): void;
|
|
87
|
+
/**
|
|
88
|
+
* Draws the standard widget shape - elongated capsule. The path of the widget shape is not
|
|
89
|
+
* cleared, and may be used for further drawing.
|
|
90
|
+
* @param ctx The canvas context
|
|
91
|
+
* @param options The options for drawing the widget
|
|
92
|
+
* @remarks Leaves {@link ctx} dirty.
|
|
93
|
+
*/
|
|
94
|
+
protected drawWidgetShape(ctx: CanvasRenderingContext2D, { width, showText }: DrawWidgetOptions): void;
|
|
95
|
+
/**
|
|
96
|
+
* A shared routine for drawing a label and value as text, truncated
|
|
97
|
+
* if they exceed the available width.
|
|
98
|
+
*/
|
|
99
|
+
protected drawTruncatingText({ ctx, width, leftPadding, rightPadding, }: DrawTruncatingTextOptions): void;
|
|
100
|
+
/**
|
|
101
|
+
* Handles the click event for the widget
|
|
102
|
+
* @param options The options for handling the click event
|
|
103
|
+
*/
|
|
104
|
+
abstract onClick(options: WidgetEventOptions): void;
|
|
105
|
+
/**
|
|
106
|
+
* Handles the drag event for the widget
|
|
107
|
+
* @param options The options for handling the drag event
|
|
108
|
+
*/
|
|
109
|
+
onDrag?(options: WidgetEventOptions): void;
|
|
110
|
+
/**
|
|
111
|
+
* Sets the value of the widget
|
|
112
|
+
* @param value The value to set
|
|
113
|
+
* @param options The options for setting the value
|
|
114
|
+
*/
|
|
115
|
+
setValue(value: TWidget["value"], { e, node, canvas }: WidgetEventOptions): void;
|
|
116
|
+
/**
|
|
117
|
+
* Clones the widget.
|
|
118
|
+
* @param node The node that will own the cloned widget.
|
|
119
|
+
* @returns A new widget with the same properties as the original
|
|
120
|
+
* @remarks Subclasses with custom constructors must override this method.
|
|
121
|
+
*
|
|
122
|
+
* Correctly and safely typing this is currently not possible (practical?) in TypeScript 5.8.
|
|
123
|
+
*/
|
|
124
|
+
createCopyForNode(node: LGraphNode): this;
|
|
125
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IBooleanWidget } from '../types/widgets';
|
|
2
|
+
import { BaseWidget, DrawWidgetOptions, WidgetEventOptions } from './BaseWidget';
|
|
3
|
+
export declare class BooleanWidget extends BaseWidget<IBooleanWidget> implements IBooleanWidget {
|
|
4
|
+
type: "toggle";
|
|
5
|
+
drawWidget(ctx: CanvasRenderingContext2D, { width, showText, }: DrawWidgetOptions): void;
|
|
6
|
+
drawLabel(ctx: CanvasRenderingContext2D, x: number): void;
|
|
7
|
+
drawValue(ctx: CanvasRenderingContext2D, x: number): void;
|
|
8
|
+
onClick(options: WidgetEventOptions): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LGraphNode } from '../LGraphNode';
|
|
2
|
+
import { IButtonWidget } from '../types/widgets';
|
|
3
|
+
import { BaseWidget, DrawWidgetOptions, WidgetEventOptions } from './BaseWidget';
|
|
4
|
+
export declare class ButtonWidget extends BaseWidget<IButtonWidget> implements IButtonWidget {
|
|
5
|
+
type: "button";
|
|
6
|
+
clicked: boolean;
|
|
7
|
+
constructor(widget: IButtonWidget, node: LGraphNode);
|
|
8
|
+
/**
|
|
9
|
+
* Draws the widget
|
|
10
|
+
* @param ctx The canvas context
|
|
11
|
+
* @param options The options for drawing the widget
|
|
12
|
+
*/
|
|
13
|
+
drawWidget(ctx: CanvasRenderingContext2D, { width, showText, }: DrawWidgetOptions): void;
|
|
14
|
+
drawLabel(ctx: CanvasRenderingContext2D, x: number): void;
|
|
15
|
+
onClick({ e, node, canvas }: WidgetEventOptions): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WidgetEventOptions } from './BaseWidget';
|
|
2
|
+
import { IComboWidget, IStringComboWidget } from '../types/widgets';
|
|
3
|
+
import { BaseSteppedWidget } from './BaseSteppedWidget';
|
|
4
|
+
export declare class ComboWidget extends BaseSteppedWidget<IStringComboWidget | IComboWidget> implements IComboWidget {
|
|
5
|
+
#private;
|
|
6
|
+
type: "combo";
|
|
7
|
+
get _displayValue(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns `true` if the current value is not the last value in the list.
|
|
10
|
+
* Handles edge case where the value is both the first and last item in the list.
|
|
11
|
+
*/
|
|
12
|
+
canIncrement(): boolean;
|
|
13
|
+
canDecrement(): boolean;
|
|
14
|
+
incrementValue(options: WidgetEventOptions): void;
|
|
15
|
+
decrementValue(options: WidgetEventOptions): void;
|
|
16
|
+
onClick({ e, node, canvas }: WidgetEventOptions): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IKnobWidget } from '../types/widgets';
|
|
2
|
+
import { BaseWidget, DrawWidgetOptions, WidgetEventOptions } from './BaseWidget';
|
|
3
|
+
export declare class KnobWidget extends BaseWidget<IKnobWidget> implements IKnobWidget {
|
|
4
|
+
type: "knob";
|
|
5
|
+
/**
|
|
6
|
+
* Compute the layout size of the widget.
|
|
7
|
+
* @returns The layout size of the widget.
|
|
8
|
+
*/
|
|
9
|
+
computeLayoutSize(): {
|
|
10
|
+
minHeight: number;
|
|
11
|
+
maxHeight?: number;
|
|
12
|
+
minWidth: number;
|
|
13
|
+
maxWidth?: number;
|
|
14
|
+
};
|
|
15
|
+
get height(): number;
|
|
16
|
+
drawWidget(ctx: CanvasRenderingContext2D, { width, showText, }: DrawWidgetOptions): void;
|
|
17
|
+
onClick(): void;
|
|
18
|
+
current_drag_offset: number;
|
|
19
|
+
onDrag(options: WidgetEventOptions): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LGraphNode } from '../LGraphNode';
|
|
2
|
+
import { IBaseWidget } from '../types/widgets';
|
|
3
|
+
import { BaseWidget, DrawWidgetOptions } from './BaseWidget';
|
|
4
|
+
/**
|
|
5
|
+
* Wraps a legacy POJO custom widget, so that all widgets may be called via the same internal interface.
|
|
6
|
+
*
|
|
7
|
+
* Support will eventually be removed.
|
|
8
|
+
* @remarks Expect this class to undergo breaking changes without warning.
|
|
9
|
+
*/
|
|
10
|
+
export declare class LegacyWidget<TWidget extends IBaseWidget = IBaseWidget> extends BaseWidget<TWidget> implements IBaseWidget {
|
|
11
|
+
draw?(ctx: CanvasRenderingContext2D, node: LGraphNode, widget_width: number, y: number, H: number, lowQuality?: boolean): void;
|
|
12
|
+
drawWidget(ctx: CanvasRenderingContext2D, options: DrawWidgetOptions): void;
|
|
13
|
+
onClick(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WidgetEventOptions } from './BaseWidget';
|
|
2
|
+
import { INumericWidget } from '../types/widgets';
|
|
3
|
+
import { BaseSteppedWidget } from './BaseSteppedWidget';
|
|
4
|
+
export declare class NumberWidget extends BaseSteppedWidget<INumericWidget> implements INumericWidget {
|
|
5
|
+
type: "number";
|
|
6
|
+
get _displayValue(): string;
|
|
7
|
+
canIncrement(): boolean;
|
|
8
|
+
canDecrement(): boolean;
|
|
9
|
+
incrementValue(options: WidgetEventOptions): void;
|
|
10
|
+
decrementValue(options: WidgetEventOptions): void;
|
|
11
|
+
setValue(value: number, options: WidgetEventOptions): void;
|
|
12
|
+
onClick({ e, node, canvas }: WidgetEventOptions): void;
|
|
13
|
+
/**
|
|
14
|
+
* Handles drag events for the number widget
|
|
15
|
+
* @param options The options for handling the drag event
|
|
16
|
+
*/
|
|
17
|
+
onDrag({ e, node, canvas }: WidgetEventOptions): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ISliderWidget } from '../types/widgets';
|
|
2
|
+
import { BaseWidget, DrawWidgetOptions, WidgetEventOptions } from './BaseWidget';
|
|
3
|
+
export declare class SliderWidget extends BaseWidget<ISliderWidget> implements ISliderWidget {
|
|
4
|
+
type: "slider";
|
|
5
|
+
marker?: number;
|
|
6
|
+
/**
|
|
7
|
+
* Draws the widget
|
|
8
|
+
* @param ctx The canvas context
|
|
9
|
+
* @param options The options for drawing the widget
|
|
10
|
+
*/
|
|
11
|
+
drawWidget(ctx: CanvasRenderingContext2D, { width, showText, }: DrawWidgetOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* Handles click events for the slider widget
|
|
14
|
+
*/
|
|
15
|
+
onClick(options: WidgetEventOptions): void;
|
|
16
|
+
/**
|
|
17
|
+
* Handles drag events for the slider widget
|
|
18
|
+
*/
|
|
19
|
+
onDrag(options: WidgetEventOptions): false | undefined;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LGraphNode } from '../LGraphNode';
|
|
2
|
+
import { IStringWidget } from '../types/widgets';
|
|
3
|
+
import { BaseWidget, DrawWidgetOptions, WidgetEventOptions } from './BaseWidget';
|
|
4
|
+
export declare class TextWidget extends BaseWidget<IStringWidget> implements IStringWidget {
|
|
5
|
+
constructor(widget: IStringWidget, node: LGraphNode);
|
|
6
|
+
/**
|
|
7
|
+
* Draws the widget
|
|
8
|
+
* @param ctx The canvas context
|
|
9
|
+
* @param options The options for drawing the widget
|
|
10
|
+
*/
|
|
11
|
+
drawWidget(ctx: CanvasRenderingContext2D, { width, showText, }: DrawWidgetOptions): void;
|
|
12
|
+
onClick({ e, node, canvas }: WidgetEventOptions): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LGraphNode } from '../LGraphNode';
|
|
2
|
+
import { IBaseWidget, IBooleanWidget, IButtonWidget, IComboWidget, ICustomWidget, IKnobWidget, INumericWidget, ISliderWidget, IStringWidget, IWidget } from '../types/widgets';
|
|
3
|
+
import { BaseWidget } from './BaseWidget';
|
|
4
|
+
import { BooleanWidget } from './BooleanWidget';
|
|
5
|
+
import { ButtonWidget } from './ButtonWidget';
|
|
6
|
+
import { ComboWidget } from './ComboWidget';
|
|
7
|
+
import { KnobWidget } from './KnobWidget';
|
|
8
|
+
import { LegacyWidget } from './LegacyWidget';
|
|
9
|
+
import { NumberWidget } from './NumberWidget';
|
|
10
|
+
import { SliderWidget } from './SliderWidget';
|
|
11
|
+
import { TextWidget } from './TextWidget';
|
|
12
|
+
export type WidgetTypeMap = {
|
|
13
|
+
button: ButtonWidget;
|
|
14
|
+
toggle: BooleanWidget;
|
|
15
|
+
slider: SliderWidget;
|
|
16
|
+
knob: KnobWidget;
|
|
17
|
+
combo: ComboWidget;
|
|
18
|
+
number: NumberWidget;
|
|
19
|
+
string: TextWidget;
|
|
20
|
+
text: TextWidget;
|
|
21
|
+
custom: LegacyWidget;
|
|
22
|
+
[key: string]: BaseWidget;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Convert a widget POJO to a proper widget instance.
|
|
26
|
+
* @param widget The POJO to convert.
|
|
27
|
+
* @param node The node the widget belongs to.
|
|
28
|
+
* @param wrapLegacyWidgets Whether to wrap legacy widgets in a `LegacyWidget` instance.
|
|
29
|
+
* @returns A concrete widget instance.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toConcreteWidget<TWidget extends IWidget | IBaseWidget>(widget: TWidget, node: LGraphNode, wrapLegacyWidgets?: true): WidgetTypeMap[TWidget["type"]];
|
|
32
|
+
export declare function toConcreteWidget<TWidget extends IWidget | IBaseWidget>(widget: TWidget, node: LGraphNode, wrapLegacyWidgets: false): WidgetTypeMap[TWidget["type"]] | undefined;
|
|
33
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IButtonWidget}. */
|
|
34
|
+
export declare function isButtonWidget(widget: IBaseWidget): widget is IButtonWidget;
|
|
35
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IBooleanWidget}. */
|
|
36
|
+
export declare function isBooleanWidget(widget: IBaseWidget): widget is IBooleanWidget;
|
|
37
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link ISliderWidget}. */
|
|
38
|
+
export declare function isSliderWidget(widget: IBaseWidget): widget is ISliderWidget;
|
|
39
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IKnobWidget}. */
|
|
40
|
+
export declare function isKnobWidget(widget: IBaseWidget): widget is IKnobWidget;
|
|
41
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IComboWidget}. */
|
|
42
|
+
export declare function isComboWidget(widget: IBaseWidget): widget is IComboWidget;
|
|
43
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link INumericWidget}. */
|
|
44
|
+
export declare function isNumberWidget(widget: IBaseWidget): widget is INumericWidget;
|
|
45
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IStringWidget}. */
|
|
46
|
+
export declare function isStringWidget(widget: IBaseWidget): widget is IStringWidget;
|
|
47
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link ITextWidget}. */
|
|
48
|
+
export declare function isTextWidget(widget: IBaseWidget): widget is IStringWidget;
|
|
49
|
+
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link ICustomWidget}. */
|
|
50
|
+
export declare function isCustomWidget(widget: IBaseWidget): widget is ICustomWidget;
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codebolt/litegraph",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.",
|
|
6
|
+
"keywords": ["graph", "node", "editor", "canvas", "blueprint", "visual-programming"],
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/litegraph.umd.js",
|
|
9
|
+
"module": "./dist/litegraph.es.js",
|
|
10
|
+
"types": "./dist/litegraph.d.ts",
|
|
11
|
+
"style": "./dist/css/litegraph.css",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/litegraph.d.ts",
|
|
15
|
+
"import": "./dist/litegraph.es.js",
|
|
16
|
+
"require": "./dist/litegraph.umd.js"
|
|
17
|
+
},
|
|
18
|
+
"./style.css": "./dist/css/litegraph.css",
|
|
19
|
+
"./dist/*": "./dist/*.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"directories": {
|
|
22
|
+
"doc": "doc"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc && vite build",
|
|
26
|
+
"dev": "vite",
|
|
27
|
+
"preview": "vite preview",
|
|
28
|
+
"watch": "vite build --watch",
|
|
29
|
+
"test": "vitest",
|
|
30
|
+
"lint": "eslint",
|
|
31
|
+
"lint:fix": "eslint --fix",
|
|
32
|
+
"lint:ci": "eslint src",
|
|
33
|
+
"format": "prettier --check './src/*.{js,ts,tsx,vue,mts}'",
|
|
34
|
+
"format:fix": "prettier --write './src/*.{js,ts,tsx,vue,mts}'",
|
|
35
|
+
"typecheck": "tsc"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/Comfy-Org/litegraph.js.git"
|
|
40
|
+
},
|
|
41
|
+
"author": "comfyorg",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/Comfy-Org/litegraph.js/issues"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/Comfy-Org/litegraph.js",
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^9.21.0",
|
|
55
|
+
"@stylistic/eslint-plugin": "^2.13.0",
|
|
56
|
+
"@types/eslint__js": "^8.42.3",
|
|
57
|
+
"@types/node": "^22.13.9",
|
|
58
|
+
"eslint": "^9.21.0",
|
|
59
|
+
"eslint-plugin-antfu": "^3.1.0",
|
|
60
|
+
"eslint-plugin-jsdoc": "^50.6.3",
|
|
61
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
62
|
+
"eslint-plugin-unicorn": "^57.0.0",
|
|
63
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
64
|
+
"globals": "^15.12.0",
|
|
65
|
+
"husky": "^9.1.7",
|
|
66
|
+
"jsdom": "^25.0.1",
|
|
67
|
+
"lint-staged": "^15.2.10",
|
|
68
|
+
"prettier": "^3.3.3",
|
|
69
|
+
"ts-node": "^10.9.2",
|
|
70
|
+
"typescript": "^5.8.3",
|
|
71
|
+
"typescript-eslint": "^8.26.0",
|
|
72
|
+
"vite": "^6.3.5",
|
|
73
|
+
"vite-plugin-dts": "^4.5.4",
|
|
74
|
+
"vitest": "^3.1.3"
|
|
75
|
+
}
|
|
76
|
+
}
|