@cpfr/tootframes 1.0.9
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 +20 -0
- package/README.md +63 -0
- package/dist/Button.d.ts +5 -0
- package/dist/Color.d.ts +79 -0
- package/dist/ColorPicker.d.ts +71 -0
- package/dist/Dialog.d.ts +18 -0
- package/dist/DockContainer.d.ts +82 -0
- package/dist/Dropdown.d.ts +9 -0
- package/dist/FakeClipboard.d.ts +16 -0
- package/dist/Image.d.ts +7 -0
- package/dist/Label.d.ts +7 -0
- package/dist/ListBox.d.ts +23 -0
- package/dist/ListView.d.ts +59 -0
- package/dist/Math.d.ts +23 -0
- package/dist/Menu.d.ts +28 -0
- package/dist/MenuBar.d.ts +10 -0
- package/dist/MessageDialog.d.ts +32 -0
- package/dist/NodeEditor.d.ts +183 -0
- package/dist/Panel.d.ts +10 -0
- package/dist/ROOT.d.ts +3 -0
- package/dist/TreeView.d.ts +37 -0
- package/dist/UndoHistory.d.ts +28 -0
- package/dist/Widget.d.ts +19 -0
- package/dist/dragAndDrop.d.ts +22 -0
- package/dist/main.d.ts +23 -0
- package/dist/tootframes.esm.js +2 -0
- package/dist/tootframes.esm.js.map +1 -0
- package/dist/tootframes.js +2 -0
- package/dist/tootframes.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Widget } from './Widget';
|
|
2
|
+
import { Vector2 } from './Math';
|
|
3
|
+
import { Draggable, DragInfo } from './dragAndDrop';
|
|
4
|
+
import { Menu } from './Menu';
|
|
5
|
+
import { UndoHistory } from './UndoHistory';
|
|
6
|
+
declare enum DragMode {
|
|
7
|
+
None = 0,
|
|
8
|
+
MoveNodes = 1,
|
|
9
|
+
MoveSelectedNodes = 2,
|
|
10
|
+
Select = 3,
|
|
11
|
+
MoveViewport = 4
|
|
12
|
+
}
|
|
13
|
+
declare class ConnectionSettingsBeforeDragging {
|
|
14
|
+
fromOutput: NodePort;
|
|
15
|
+
toInput: NodePort;
|
|
16
|
+
constructor(fromOutput: NodePort, toInput: NodePort);
|
|
17
|
+
}
|
|
18
|
+
declare class NodeEditorClipboardData {
|
|
19
|
+
nodes: NodeClipboardData[];
|
|
20
|
+
connections: NodeConnectionClipboardData[];
|
|
21
|
+
constructor(nodes: NodeClipboardData[], connections: NodeConnectionClipboardData[]);
|
|
22
|
+
}
|
|
23
|
+
declare class NodeConnectionClipboardData {
|
|
24
|
+
fromNodeIndex: number;
|
|
25
|
+
fromOutputIndex: number;
|
|
26
|
+
toNodeIndex: number;
|
|
27
|
+
toInputIndex: number;
|
|
28
|
+
constructor(fromNodeIndex: number, fromOutputIndex: number, toNodeIndex: number, toInputIndex: number);
|
|
29
|
+
}
|
|
30
|
+
declare class NodePortClipboardData {
|
|
31
|
+
name: string;
|
|
32
|
+
allowMultipleConnectionsForOutput: boolean;
|
|
33
|
+
canConnectCheck: (other: NodePort) => boolean;
|
|
34
|
+
allowMultipleConnections?: boolean;
|
|
35
|
+
constructor(name: string, allowMultipleConnectionsForOutput: boolean, canConnectCheck: (other: NodePort) => boolean, allowMultipleConnections?: boolean);
|
|
36
|
+
}
|
|
37
|
+
export declare class NodeClipboardData {
|
|
38
|
+
title: string;
|
|
39
|
+
inputs: NodePortClipboardData[];
|
|
40
|
+
outputs: NodePortClipboardData[];
|
|
41
|
+
pos: Vector2;
|
|
42
|
+
data: any;
|
|
43
|
+
constructor(title: string, inputs: NodePortClipboardData[], outputs: NodePortClipboardData[], pos: Vector2);
|
|
44
|
+
}
|
|
45
|
+
declare class NodeEditorViewport {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
zoom: number;
|
|
49
|
+
constructor(x: number, y: number, zoom: number);
|
|
50
|
+
getPixelPos(): Vector2;
|
|
51
|
+
getPixelPosFromPos(x: number, y: number): Vector2;
|
|
52
|
+
getPosFromPixelPos(pixelX: number, pixelY: number): Vector2;
|
|
53
|
+
}
|
|
54
|
+
declare class NodeEditor extends Widget {
|
|
55
|
+
_undoHistory: UndoHistory;
|
|
56
|
+
private _svg;
|
|
57
|
+
private _nodes;
|
|
58
|
+
_viewport: NodeEditorViewport;
|
|
59
|
+
private _zoomWithoutCtrl;
|
|
60
|
+
_addArrowHeads: boolean;
|
|
61
|
+
private _defineCtrlShortcuts;
|
|
62
|
+
_targetInput?: NodePort;
|
|
63
|
+
_targetOutput?: NodePort;
|
|
64
|
+
_targetNode?: Node;
|
|
65
|
+
_dragStart: Vector2;
|
|
66
|
+
private _viewportDragStart;
|
|
67
|
+
_dragMode: DragMode;
|
|
68
|
+
private _selectRect;
|
|
69
|
+
contextMenu: Menu;
|
|
70
|
+
_draggedConnection?: NodeConnection;
|
|
71
|
+
protected _hasFocus: boolean;
|
|
72
|
+
_connectionSettingsBeforeDragging: ConnectionSettingsBeforeDragging;
|
|
73
|
+
_selectedNodes: Node[];
|
|
74
|
+
_nodeSelectedCallback: (selectedNode: Node) => void;
|
|
75
|
+
_nodeDeselectedCallback: (deselectedNode: Node) => void;
|
|
76
|
+
_nodeAddedCallback: (addedNode: Node) => void;
|
|
77
|
+
_nodeRemovedCallback: (removedNode: Node) => void;
|
|
78
|
+
_previouslySelectedNodes: any[];
|
|
79
|
+
_connections: any;
|
|
80
|
+
constructor(nodeSelectedCallback?: (selectedNode: Node) => void, nodeDeselectedCallback?: (deselectedNode: Node) => void, nodeAddedCallback?: (addedNode: Node) => void, nodeRemovedCallback?: (removedNode: Node) => void, zoomWithoutCtrl?: boolean, addArrowHeads?: boolean, defineCtrlShortcuts?: boolean, undoHistory?: UndoHistory);
|
|
81
|
+
onCopy(): void;
|
|
82
|
+
onCut(): void;
|
|
83
|
+
onPaste(fromContextMenu: boolean): void;
|
|
84
|
+
canPaste(): boolean;
|
|
85
|
+
overridableCopy(data: NodeEditorClipboardData): void;
|
|
86
|
+
overridablePaste(): NodeEditorClipboardData;
|
|
87
|
+
copy(): void;
|
|
88
|
+
cut(): void;
|
|
89
|
+
paste(useContextMenu: boolean): void;
|
|
90
|
+
_applyZoom(newZoom: number, x?: number, y?: number): void;
|
|
91
|
+
useArrowHeads(useArrowHeads: boolean): void;
|
|
92
|
+
zoomWithoutCtrl(zoomWithoutCtrl: boolean): void;
|
|
93
|
+
_addConnection(connection: NodeConnection): void;
|
|
94
|
+
_removeConnection(connection: NodeConnection): void;
|
|
95
|
+
_removeSelectedNodes(): void;
|
|
96
|
+
onAttached(): void;
|
|
97
|
+
getSelectedNodes(): Node[];
|
|
98
|
+
clear(): void;
|
|
99
|
+
_createNodeForPaste(data: NodeClipboardData): Node;
|
|
100
|
+
_getNodesCopyData(): NodeEditorClipboardData;
|
|
101
|
+
_paste(data: NodeEditorClipboardData, pixelPos: Vector2): void;
|
|
102
|
+
_onNodesPasted(pastedNodes: Node[]): void;
|
|
103
|
+
removeNode(node: Node): void;
|
|
104
|
+
addNode(node: Node): void;
|
|
105
|
+
addNodeWithUndo(node: Node, actionName: string): void;
|
|
106
|
+
getNodes(): Node[];
|
|
107
|
+
connect(output: NodePort, input: NodePort): void;
|
|
108
|
+
disconnect(output: NodePort, input: NodePort): void;
|
|
109
|
+
onDragStart(mouseEvt: MouseEvent): boolean;
|
|
110
|
+
onDragNodesStarted(): void;
|
|
111
|
+
onDragging(dragInfo: DragInfo): void;
|
|
112
|
+
onDragEnd(mouseEvt: MouseEvent): void;
|
|
113
|
+
intersection(rect1: DOMRect, rect2: DOMRect): boolean;
|
|
114
|
+
deselectAllWithUndo(): void;
|
|
115
|
+
selectAllWithUndo(): void;
|
|
116
|
+
deselectAll(): void;
|
|
117
|
+
selectAll(): void;
|
|
118
|
+
}
|
|
119
|
+
declare class NodeConnection {
|
|
120
|
+
_fromOutput: NodePort;
|
|
121
|
+
_toInput: NodePort;
|
|
122
|
+
_path: SVGPathElement;
|
|
123
|
+
constructor(fromOutput: NodePort, toInput: NodePort);
|
|
124
|
+
setUseArrowHead(useArrowHead: boolean): void;
|
|
125
|
+
update(x?: number, y?: number): void;
|
|
126
|
+
}
|
|
127
|
+
export declare class NodePort {
|
|
128
|
+
_node: Node;
|
|
129
|
+
_name: string;
|
|
130
|
+
_isInput: boolean;
|
|
131
|
+
_allowMultipleConnectionsForOutput: boolean;
|
|
132
|
+
_canConnectCheck: (source: NodePort) => boolean;
|
|
133
|
+
_bullet: HTMLSpanElement;
|
|
134
|
+
constructor(node: Node, name: string, isInput: boolean, canConnectCheck?: (source: NodePort) => boolean, allowMultipleConnectionsForOutput?: boolean);
|
|
135
|
+
createInput(): HTMLSpanElement;
|
|
136
|
+
createOutput(): HTMLSpanElement;
|
|
137
|
+
isInput(): boolean;
|
|
138
|
+
isOutput(): boolean;
|
|
139
|
+
}
|
|
140
|
+
declare class Node extends Widget {
|
|
141
|
+
_connectionDragging: Draggable;
|
|
142
|
+
private _title;
|
|
143
|
+
_pos: Vector2;
|
|
144
|
+
_connections: NodeConnection[];
|
|
145
|
+
_inputs: NodePort[];
|
|
146
|
+
_outputs: NodePort[];
|
|
147
|
+
_inputsElement: HTMLDivElement;
|
|
148
|
+
_contentsElement: HTMLDivElement;
|
|
149
|
+
_outputsElement: HTMLDivElement;
|
|
150
|
+
_dragEditorPixelStartX: number;
|
|
151
|
+
_dragEditorPixelStartY: number;
|
|
152
|
+
_editor: NodeEditor;
|
|
153
|
+
_dragEditorStartX: number;
|
|
154
|
+
_dragEditorStartY: number;
|
|
155
|
+
_wasActuallyDragged: boolean;
|
|
156
|
+
constructor(title: string);
|
|
157
|
+
_mapNodePort(nodePort: NodePort): NodePortClipboardData;
|
|
158
|
+
_copy(): NodeClipboardData;
|
|
159
|
+
_onConnectionAdded(connection: NodeConnection): void;
|
|
160
|
+
_onConnectionRemoved(connection: NodeConnection): void;
|
|
161
|
+
_removeDraggedConnection(connection: NodeConnection): void;
|
|
162
|
+
onAttached(): void;
|
|
163
|
+
_getViewport(): NodeEditorViewport;
|
|
164
|
+
setPixelPos(x: number, y: number): void;
|
|
165
|
+
getPixelPos(): Vector2;
|
|
166
|
+
setPos(x: number, y: number): void;
|
|
167
|
+
getPos(): Vector2;
|
|
168
|
+
getTitle(): string;
|
|
169
|
+
setTitle(title: string): void;
|
|
170
|
+
addInput(name: string, canConnectCheck?: (other: NodePort) => boolean): NodePort;
|
|
171
|
+
addOutput(name: string, canConnectCheck?: (other: NodePort) => boolean, allowMultipleConnections?: boolean): NodePort;
|
|
172
|
+
addConnection(nodeConnection: NodeConnection): void;
|
|
173
|
+
removeConnection(nodeConnection: NodeConnection): void;
|
|
174
|
+
onDragStart(mouseEvt: MouseEvent): boolean;
|
|
175
|
+
onDragStarted(): void;
|
|
176
|
+
onDragEnd(mouseEvt: MouseEvent): void;
|
|
177
|
+
isSelected(): boolean;
|
|
178
|
+
select(): void;
|
|
179
|
+
deselect(): void;
|
|
180
|
+
selectSingle(): void;
|
|
181
|
+
update(): void;
|
|
182
|
+
}
|
|
183
|
+
export { NodeEditor, Node, NodeConnection };
|
package/dist/Panel.d.ts
ADDED
package/dist/ROOT.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Widget } from './Widget';
|
|
2
|
+
import { Menu } from './Menu';
|
|
3
|
+
declare class TreeView<T> extends Widget {
|
|
4
|
+
items: TreeViewItem<T>[];
|
|
5
|
+
clickHandler: (evt: MouseEvent, item: TreeViewItem<T>, previouslySelectedItem?: TreeViewItem<T>) => void;
|
|
6
|
+
_focusedItem: TreeViewItem<T>;
|
|
7
|
+
constructor(clickHandler?: (evt: MouseEvent, item: TreeViewItem<T>, previouslySelectedItem?: TreeViewItem<T>) => void);
|
|
8
|
+
addItem(label: string, data: T, clickHandler: (evt: MouseEvent, item: TreeViewItem<T>, previouslySelectedItem?: TreeViewItem<T>) => void, doubleClickHandler?: (evt: MouseEvent, item: TreeViewItem<T>) => void, contextMenu?: Menu): TreeViewItem<T>;
|
|
9
|
+
removeItem(item: TreeViewItem<T>): void;
|
|
10
|
+
clear(): void;
|
|
11
|
+
getItems(): TreeViewItem<T>[];
|
|
12
|
+
deselectAll(): void;
|
|
13
|
+
getSelectedItem(): TreeViewItem<T>;
|
|
14
|
+
getFocusedItem(): TreeViewItem<T>;
|
|
15
|
+
_sortFunction(a: TreeViewItem<T>, b: TreeViewItem<T>): number;
|
|
16
|
+
sortItems(): void;
|
|
17
|
+
}
|
|
18
|
+
declare class TreeViewItem<T> extends Widget {
|
|
19
|
+
children: TreeViewItem<T>[];
|
|
20
|
+
label: string;
|
|
21
|
+
expander: HTMLSpanElement;
|
|
22
|
+
labelElement: HTMLSpanElement;
|
|
23
|
+
childrenElement: HTMLDivElement;
|
|
24
|
+
contextMenu?: Menu;
|
|
25
|
+
parentItem?: TreeViewItem<T>;
|
|
26
|
+
data: T;
|
|
27
|
+
constructor(label: string, data: T, clickHandler?: (evt: MouseEvent, item: TreeViewItem<T>, previouslySelectedItem?: TreeViewItem<T>) => void, doubleClickHandler?: (evt: MouseEvent, item: TreeViewItem<T>) => void, contextMenu?: Menu);
|
|
28
|
+
addChildItem(item: TreeViewItem<T>): TreeViewItem<T>;
|
|
29
|
+
addChild(label: string, data: T, clickHandler?: (evt: MouseEvent, item: TreeViewItem<T>, previouslySelectedItem?: TreeViewItem<T>) => void, doubleClickHandler?: (evt: MouseEvent, item: TreeViewItem<T>) => void, contextMenu?: Menu): TreeViewItem<T>;
|
|
30
|
+
removeChild(child: TreeViewItem<T>): void;
|
|
31
|
+
sortChildren(): void;
|
|
32
|
+
deselect(): void;
|
|
33
|
+
select(): void;
|
|
34
|
+
setFocus(hasFocus: boolean): void;
|
|
35
|
+
_getIfSelected(): TreeViewItem<T>;
|
|
36
|
+
}
|
|
37
|
+
export { TreeView, TreeViewItem };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare enum UdoableActionCategory {
|
|
2
|
+
ModifyData = 1,
|
|
3
|
+
ModifyView = 2
|
|
4
|
+
}
|
|
5
|
+
declare class UndoHistory {
|
|
6
|
+
private _history;
|
|
7
|
+
private _currentIndex;
|
|
8
|
+
private _idCounter;
|
|
9
|
+
private _onChangedCallback;
|
|
10
|
+
constructor(onChangedCallback?: (history: UndoableCommand[], index: number) => void);
|
|
11
|
+
add(cmd: UndoableCommand): void;
|
|
12
|
+
undo(): void;
|
|
13
|
+
redo(): void;
|
|
14
|
+
canUndo(): boolean;
|
|
15
|
+
canRedo(): boolean;
|
|
16
|
+
wasDataModifiedSinceVersion(versionId: number): boolean;
|
|
17
|
+
getCurrentCommand(): UndoableCommand;
|
|
18
|
+
}
|
|
19
|
+
declare class UndoableCommand {
|
|
20
|
+
id: number;
|
|
21
|
+
title: string;
|
|
22
|
+
do: () => void;
|
|
23
|
+
undo: () => void;
|
|
24
|
+
category: UdoableActionCategory;
|
|
25
|
+
constructor(title: string, doAction: () => void, undoAction: () => void, category: UdoableActionCategory);
|
|
26
|
+
wasDataModified(): boolean;
|
|
27
|
+
}
|
|
28
|
+
export { UndoHistory, UndoableCommand, UdoableActionCategory };
|
package/dist/Widget.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DragInfo } from "./dragAndDrop";
|
|
2
|
+
interface IDraggable {
|
|
3
|
+
element: HTMLElement;
|
|
4
|
+
onDragStart(mouseEvt: MouseEvent): boolean;
|
|
5
|
+
onDragEnd(mouseEvt: MouseEvent): void;
|
|
6
|
+
onDragging(dragInfo: DragInfo): void;
|
|
7
|
+
}
|
|
8
|
+
declare class Widget implements IDraggable {
|
|
9
|
+
element: HTMLElement;
|
|
10
|
+
parentWidget?: Widget;
|
|
11
|
+
constructor(element?: HTMLElement);
|
|
12
|
+
onDragStart(mouseEvt: MouseEvent): boolean;
|
|
13
|
+
onDragEnd(mouseEvt: MouseEvent): void;
|
|
14
|
+
onDragging(dragInfo: DragInfo): void;
|
|
15
|
+
onAttached(): void;
|
|
16
|
+
isAttached(): boolean;
|
|
17
|
+
onResize(): void;
|
|
18
|
+
}
|
|
19
|
+
export { Widget, IDraggable };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Vector2 } from './Math';
|
|
2
|
+
import { IDraggable } from './Widget';
|
|
3
|
+
type DragInfo = {
|
|
4
|
+
mouseEvent: MouseEvent;
|
|
5
|
+
rect: DOMRect;
|
|
6
|
+
posWithOffsetToParentConsidered: Vector2;
|
|
7
|
+
posRelativeToElement: Vector2;
|
|
8
|
+
posRelativeToDragStart: Vector2;
|
|
9
|
+
};
|
|
10
|
+
declare let currentMousePos: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
declare function getDragStart(draggable: IDraggable, dragStartMethod?: (draggable: IDraggable, evt: MouseEvent) => boolean): (evt: MouseEvent) => void;
|
|
15
|
+
declare class Draggable implements IDraggable {
|
|
16
|
+
element: HTMLElement;
|
|
17
|
+
onDragStart: (mouseEvt: MouseEvent) => boolean;
|
|
18
|
+
onDragging: (ragInfo: DragInfo) => void;
|
|
19
|
+
onDragEnd: (mouseEvt: MouseEvent) => void;
|
|
20
|
+
constructor(element: HTMLElement, onDragStart: (mouseEvt: MouseEvent) => boolean, onDragging: (dragInfo: DragInfo) => void, onDragEnd: (mouseEvt: MouseEvent) => void);
|
|
21
|
+
}
|
|
22
|
+
export { getDragStart, currentMousePos, Draggable, DragInfo };
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./style.scss";
|
|
2
|
+
export * from './Math';
|
|
3
|
+
export * from './Color';
|
|
4
|
+
export * from './ColorPicker';
|
|
5
|
+
export * from './Widget';
|
|
6
|
+
export * from './Panel';
|
|
7
|
+
export * from './Button';
|
|
8
|
+
export * from './Dropdown';
|
|
9
|
+
export * from './ListBox';
|
|
10
|
+
export * from './ListView';
|
|
11
|
+
export * from './TreeView';
|
|
12
|
+
export * from './ROOT';
|
|
13
|
+
export * from './Menu';
|
|
14
|
+
export * from './MenuBar';
|
|
15
|
+
export * from './Label';
|
|
16
|
+
export * from './Image';
|
|
17
|
+
export * from './DockContainer';
|
|
18
|
+
export * from './Dialog';
|
|
19
|
+
export * from './MessageDialog';
|
|
20
|
+
export * from './NodeEditor';
|
|
21
|
+
export * from './UndoHistory';
|
|
22
|
+
export * from './FakeClipboard';
|
|
23
|
+
export { currentMousePos } from './dragAndDrop';
|