@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.
Files changed (98) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +161 -0
  3. package/dist/CanvasPointer.d.ts +120 -0
  4. package/dist/ContextMenu.d.ts +41 -0
  5. package/dist/CurveEditor.d.ts +18 -0
  6. package/dist/DragAndScale.d.ts +67 -0
  7. package/dist/LGraph.d.ts +407 -0
  8. package/dist/LGraphBadge.d.ts +33 -0
  9. package/dist/LGraphButton.d.ts +27 -0
  10. package/dist/LGraphCanvas.d.ts +772 -0
  11. package/dist/LGraphGroup.d.ts +81 -0
  12. package/dist/LGraphIcon.d.ts +22 -0
  13. package/dist/LGraphNode.d.ts +883 -0
  14. package/dist/LLink.d.ts +194 -0
  15. package/dist/LiteGraphGlobal.d.ts +360 -0
  16. package/dist/MapProxyHandler.d.ts +13 -0
  17. package/dist/Reroute.d.ts +185 -0
  18. package/dist/canvas/FloatingRenderLink.d.ts +55 -0
  19. package/dist/canvas/InputIndicators.d.ts +45 -0
  20. package/dist/canvas/LinkConnector.d.ts +165 -0
  21. package/dist/canvas/MovingInputLink.d.ts +34 -0
  22. package/dist/canvas/MovingLinkBase.d.ts +55 -0
  23. package/dist/canvas/MovingOutputLink.d.ts +30 -0
  24. package/dist/canvas/RenderLink.d.ts +39 -0
  25. package/dist/canvas/ToInputFromIoNodeLink.d.ts +37 -0
  26. package/dist/canvas/ToInputRenderLink.d.ts +35 -0
  27. package/dist/canvas/ToOutputFromIoNodeLink.d.ts +33 -0
  28. package/dist/canvas/ToOutputFromRerouteLink.d.ts +15 -0
  29. package/dist/canvas/ToOutputRenderLink.d.ts +32 -0
  30. package/dist/canvas/measureSlots.d.ts +22 -0
  31. package/dist/constants.d.ts +9 -0
  32. package/dist/css/litegraph.css +638 -0
  33. package/dist/draw.d.ts +65 -0
  34. package/dist/infrastructure/ConstrainedSize.d.ts +27 -0
  35. package/dist/infrastructure/CustomEventTarget.d.ts +72 -0
  36. package/dist/infrastructure/InvalidLinkError.d.ts +3 -0
  37. package/dist/infrastructure/LGraphCanvasEventMap.d.ts +41 -0
  38. package/dist/infrastructure/LGraphEventMap.d.ts +43 -0
  39. package/dist/infrastructure/LinkConnectorEventMap.d.ts +47 -0
  40. package/dist/infrastructure/NullGraphError.d.ts +3 -0
  41. package/dist/infrastructure/Rectangle.d.ts +163 -0
  42. package/dist/infrastructure/RecursionError.d.ts +6 -0
  43. package/dist/infrastructure/SlotIndexError.d.ts +3 -0
  44. package/dist/infrastructure/SubgraphEventMap.d.ts +49 -0
  45. package/dist/infrastructure/SubgraphInputEventMap.d.ts +13 -0
  46. package/dist/interfaces.d.ts +388 -0
  47. package/dist/litegraph.d.ts +95 -0
  48. package/dist/litegraph.es.js +17613 -0
  49. package/dist/litegraph.es.js.map +1 -0
  50. package/dist/litegraph.umd.js +3 -0
  51. package/dist/litegraph.umd.js.map +1 -0
  52. package/dist/measure.d.ts +168 -0
  53. package/dist/node/NodeInputSlot.d.ts +20 -0
  54. package/dist/node/NodeOutputSlot.d.ts +18 -0
  55. package/dist/node/NodeSlot.d.ts +35 -0
  56. package/dist/node/SlotBase.d.ts +27 -0
  57. package/dist/node/slotUtils.d.ts +17 -0
  58. package/dist/polyfills.d.ts +1 -0
  59. package/dist/strings.d.ts +22 -0
  60. package/dist/subgraph/EmptySubgraphInput.d.ts +15 -0
  61. package/dist/subgraph/EmptySubgraphOutput.d.ts +15 -0
  62. package/dist/subgraph/ExecutableNodeDTO.d.ts +96 -0
  63. package/dist/subgraph/Subgraph.d.ts +65 -0
  64. package/dist/subgraph/SubgraphIONodeBase.d.ts +80 -0
  65. package/dist/subgraph/SubgraphInput.d.ts +47 -0
  66. package/dist/subgraph/SubgraphInputNode.d.ts +33 -0
  67. package/dist/subgraph/SubgraphNode.d.ts +73 -0
  68. package/dist/subgraph/SubgraphOutput.d.ts +30 -0
  69. package/dist/subgraph/SubgraphOutputNode.d.ts +31 -0
  70. package/dist/subgraph/SubgraphSlotBase.d.ts +61 -0
  71. package/dist/subgraph/subgraphUtils.d.ts +77 -0
  72. package/dist/types/NodeLike.d.ts +7 -0
  73. package/dist/types/events.d.ts +64 -0
  74. package/dist/types/globalEnums.d.ts +130 -0
  75. package/dist/types/serialisation.d.ts +198 -0
  76. package/dist/types/utility.d.ts +11 -0
  77. package/dist/types/widgets.d.ts +209 -0
  78. package/dist/utils/arrange.d.ts +22 -0
  79. package/dist/utils/collections.d.ts +38 -0
  80. package/dist/utils/feedback.d.ts +7 -0
  81. package/dist/utils/object.d.ts +1 -0
  82. package/dist/utils/spaceDistribution.d.ts +11 -0
  83. package/dist/utils/textUtils.d.ts +9 -0
  84. package/dist/utils/type.d.ts +14 -0
  85. package/dist/utils/uuid.d.ts +13 -0
  86. package/dist/utils/widget.d.ts +7 -0
  87. package/dist/widgets/BaseSteppedWidget.d.ts +34 -0
  88. package/dist/widgets/BaseWidget.d.ts +125 -0
  89. package/dist/widgets/BooleanWidget.d.ts +9 -0
  90. package/dist/widgets/ButtonWidget.d.ts +16 -0
  91. package/dist/widgets/ComboWidget.d.ts +17 -0
  92. package/dist/widgets/KnobWidget.d.ts +20 -0
  93. package/dist/widgets/LegacyWidget.d.ts +14 -0
  94. package/dist/widgets/NumberWidget.d.ts +18 -0
  95. package/dist/widgets/SliderWidget.d.ts +20 -0
  96. package/dist/widgets/TextWidget.d.ts +13 -0
  97. package/dist/widgets/widgetMap.d.ts +50 -0
  98. package/package.json +76 -0
@@ -0,0 +1,81 @@
1
+ import { ColorOption, IColorable, IContextMenuValue, IPinnable, Point, Positionable, Size } from './interfaces';
2
+ import { LGraph } from './LGraph';
3
+ import { ISerialisedGroup } from './types/serialisation';
4
+ import { LGraphCanvas } from './LGraphCanvas';
5
+ import { LGraphNode } from './LGraphNode';
6
+ export interface IGraphGroupFlags extends Record<string, unknown> {
7
+ pinned?: true;
8
+ }
9
+ export declare class LGraphGroup implements Positionable, IPinnable, IColorable {
10
+ static minWidth: number;
11
+ static minHeight: number;
12
+ static resizeLength: number;
13
+ static padding: number;
14
+ static defaultColour: string;
15
+ id: number;
16
+ color?: string;
17
+ title: string;
18
+ font?: string;
19
+ font_size: number;
20
+ _bounding: Float32Array;
21
+ _pos: Point;
22
+ _size: Size;
23
+ /** @deprecated See {@link _children} */
24
+ _nodes: LGraphNode[];
25
+ _children: Set<Positionable>;
26
+ graph?: LGraph;
27
+ flags: IGraphGroupFlags;
28
+ selected?: boolean;
29
+ constructor(title?: string, id?: number);
30
+ /** @inheritdoc {@link IColorable.setColorOption} */
31
+ setColorOption(colorOption: ColorOption | null): void;
32
+ /** @inheritdoc {@link IColorable.getColorOption} */
33
+ getColorOption(): ColorOption | null;
34
+ /** Position of the group, as x,y co-ordinates in graph space */
35
+ get pos(): Point;
36
+ set pos(v: Point);
37
+ /** Size of the group, as width,height in graph units */
38
+ get size(): Size;
39
+ set size(v: Size);
40
+ get boundingRect(): Float32Array<ArrayBufferLike>;
41
+ get nodes(): LGraphNode[];
42
+ get titleHeight(): number;
43
+ get children(): ReadonlySet<Positionable>;
44
+ get pinned(): boolean;
45
+ /**
46
+ * Prevents the group being accidentally moved or resized by mouse interaction.
47
+ * Toggles pinned state if no value is provided.
48
+ */
49
+ pin(value?: boolean): void;
50
+ unpin(): void;
51
+ configure(o: ISerialisedGroup): void;
52
+ serialize(): ISerialisedGroup;
53
+ /**
54
+ * Draws the group on the canvas
55
+ * @param graphCanvas
56
+ * @param ctx
57
+ */
58
+ draw(graphCanvas: LGraphCanvas, ctx: CanvasRenderingContext2D): void;
59
+ resize(width: number, height: number): boolean;
60
+ move(deltaX: number, deltaY: number, skipChildren?: boolean): void;
61
+ /** @inheritdoc */
62
+ snapToGrid(snapTo: number): boolean;
63
+ recomputeInsideNodes(): void;
64
+ /**
65
+ * Resizes and moves the group to neatly fit all given {@link objects}.
66
+ * @param objects All objects that should be inside the group
67
+ * @param padding Value in graph units to add to all sides of the group. Default: 10
68
+ */
69
+ resizeTo(objects: Iterable<Positionable>, padding?: number): void;
70
+ /**
71
+ * Add nodes to the group and adjust the group's position and size accordingly
72
+ * @param nodes The nodes to add to the group
73
+ * @param padding The padding around the group
74
+ */
75
+ addNodes(nodes: LGraphNode[], padding?: number): void;
76
+ getMenuOptions(): (IContextMenuValue<string> | IContextMenuValue<string | null> | null)[];
77
+ isPointInTitlebar(x: number, y: number): boolean;
78
+ isInResize(x: number, y: number): boolean;
79
+ isPointInside: (x: number, y: number) => boolean;
80
+ setDirtyCanvas: (dirty_foreground: boolean, dirty_background?: boolean) => void;
81
+ }
@@ -0,0 +1,22 @@
1
+ export interface LGraphIconOptions {
2
+ unicode: string;
3
+ fontFamily?: string;
4
+ color?: string;
5
+ bgColor?: string;
6
+ fontSize?: number;
7
+ circlePadding?: number;
8
+ xOffset?: number;
9
+ yOffset?: number;
10
+ }
11
+ export declare class LGraphIcon {
12
+ unicode: string;
13
+ fontFamily: string;
14
+ color: string;
15
+ bgColor?: string;
16
+ fontSize: number;
17
+ circlePadding: number;
18
+ xOffset: number;
19
+ yOffset: number;
20
+ constructor({ unicode, fontFamily, color, bgColor, fontSize, circlePadding, xOffset, yOffset, }: LGraphIconOptions);
21
+ draw(ctx: CanvasRenderingContext2D, x: number, y: number): void;
22
+ }