@openremote/or-rules 1.8.0-snapshot.20250725120001 → 1.8.0-snapshot.20250725123024
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/README.md +30 -30
- package/custom-elements.json +13 -13
- package/dist/umd/index.bundle.js +4744 -4744
- package/dist/umd/index.bundle.js.map +1 -1
- package/lib/flow-viewer/components/confirmation-dialog.js +24 -61
- package/lib/flow-viewer/components/connection-container.js +1 -35
- package/lib/flow-viewer/components/connection-line.js +28 -117
- package/lib/flow-viewer/components/context-menu.js +45 -140
- package/lib/flow-viewer/components/editor-workspace.js +20 -282
- package/lib/flow-viewer/components/flow-editor.js +47 -160
- package/lib/flow-viewer/components/flow-node-socket.js +31 -146
- package/lib/flow-viewer/components/flow-node.js +29 -192
- package/lib/flow-viewer/components/internal-picker.js +54 -271
- package/lib/flow-viewer/components/node-menu-item.js +32 -132
- package/lib/flow-viewer/components/node-panel.js +60 -104
- package/lib/flow-viewer/components/notification-dialog.js +23 -55
- package/lib/flow-viewer/components/popup-modal.js +54 -113
- package/lib/flow-viewer/components/rule-browser.js +30 -119
- package/lib/flow-viewer/components/selectable-element.js +1 -71
- package/lib/flow-viewer/components/selection-box.js +15 -119
- package/lib/flow-viewer/components/top-bar.js +49 -116
- package/lib/flow-viewer/components/workspace-contextmenu-options.js +5 -128
- package/lib/flow-viewer/components/writable-dropdown.js +5 -51
- package/lib/flow-viewer/converters/node-converter.js +1 -10
- package/lib/flow-viewer/flow-viewer.js +1 -19
- package/lib/flow-viewer/models/camera.js +1 -2
- package/lib/flow-viewer/models/context-menu-button.js +1 -2
- package/lib/flow-viewer/models/light-node-collection.js +1 -2
- package/lib/flow-viewer/models/status.js +1 -8
- package/lib/flow-viewer/node-structure/copy.machine.js +1 -34
- package/lib/flow-viewer/node-structure/identity.assigner.js +1 -10
- package/lib/flow-viewer/node-structure/identity.dom.link.js +1 -4
- package/lib/flow-viewer/node-structure/index.js +1 -5
- package/lib/flow-viewer/node-structure/socket.type.matcher.js +1 -50
- package/lib/flow-viewer/node-structure/utils.js +1 -109
- package/lib/flow-viewer/services/copy-paste-manager.js +1 -59
- package/lib/flow-viewer/services/exporter.js +1 -67
- package/lib/flow-viewer/services/input.js +1 -80
- package/lib/flow-viewer/services/integration.js +1 -27
- package/lib/flow-viewer/services/modal.js +8 -29
- package/lib/flow-viewer/services/project.js +1 -222
- package/lib/flow-viewer/services/shortcuts.js +1 -63
- package/lib/flow-viewer/styles/editor-workspace-style.js +53 -55
- package/lib/flow-viewer/styles/flow-node-style.js +93 -95
- package/lib/flow-viewer/styles/picker-styles.js +29 -31
- package/lib/flow-viewer/utils.js +1 -49
- package/lib/index.js +56 -953
- package/lib/json-viewer/forms/or-rule-form-alarm.js +18 -91
- package/lib/json-viewer/forms/or-rule-form-email-message.js +12 -51
- package/lib/json-viewer/forms/or-rule-form-localized.js +43 -269
- package/lib/json-viewer/forms/or-rule-form-push-notification.js +63 -152
- package/lib/json-viewer/forms/or-rule-form-webhook.js +101 -296
- package/lib/json-viewer/modals/or-rule-alarm-modal.js +17 -173
- package/lib/json-viewer/modals/or-rule-notification-modal.js +11 -196
- package/lib/json-viewer/modals/or-rule-radial-modal.js +17 -142
- package/lib/json-viewer/modals/or-rule-webhook-modal.js +8 -78
- package/lib/json-viewer/or-rule-action-alarm.js +5 -97
- package/lib/json-viewer/or-rule-action-attribute.js +33 -235
- package/lib/json-viewer/or-rule-action-notification.js +56 -465
- package/lib/json-viewer/or-rule-action-webhook.js +18 -49
- package/lib/json-viewer/or-rule-asset-query.js +126 -849
- package/lib/json-viewer/or-rule-condition.js +29 -216
- package/lib/json-viewer/or-rule-json-viewer.js +34 -393
- package/lib/json-viewer/or-rule-then-otherwise.js +113 -609
- package/lib/json-viewer/or-rule-trigger-query.js +57 -227
- package/lib/json-viewer/or-rule-when.js +126 -343
- package/lib/or-rule-group-viewer.js +12 -106
- package/lib/or-rule-text-viewer.js +22 -133
- package/lib/or-rule-tree.js +57 -601
- package/lib/or-rule-validity.js +62 -373
- package/lib/or-rule-viewer.js +81 -361
- package/lib/style.js +64 -89
- package/package.json +11 -11
|
@@ -1,222 +1 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter)
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { EventEmitter } from "events";
|
|
11
|
-
import { input } from "../components/flow-editor";
|
|
12
|
-
import { NodeUtilities } from "../node-structure";
|
|
13
|
-
import { SocketTypeMatcher } from "../node-structure/socket.type.matcher";
|
|
14
|
-
export class Project extends EventEmitter {
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
this.nodes = [];
|
|
18
|
-
this.connections = [];
|
|
19
|
-
this.existingFlowRuleId = -1;
|
|
20
|
-
this.existingFlowRuleName = null;
|
|
21
|
-
this.existingFlowRuleDesc = null;
|
|
22
|
-
this.isInUnsavedState = false;
|
|
23
|
-
this.isConnecting = false;
|
|
24
|
-
this.history = [];
|
|
25
|
-
this.historyIndex = 0;
|
|
26
|
-
this.startConnectionDrag = (e, socket, isInputNode) => {
|
|
27
|
-
this.connectionStartSocket = null;
|
|
28
|
-
this.connectionEndSocket = null;
|
|
29
|
-
if (isInputNode) {
|
|
30
|
-
this.connectionEndSocket = socket;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.connectionStartSocket = socket;
|
|
34
|
-
}
|
|
35
|
-
this.isConnecting = true;
|
|
36
|
-
this.emit("connectionstart", e, socket);
|
|
37
|
-
};
|
|
38
|
-
this.connectionDragging = (e) => {
|
|
39
|
-
this.emit("connecting", e);
|
|
40
|
-
};
|
|
41
|
-
this.endConnectionDrag = (e, socket, isInputNode) => {
|
|
42
|
-
if (!this.isConnecting) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (isInputNode) {
|
|
46
|
-
this.connectionEndSocket = socket;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
this.connectionStartSocket = socket;
|
|
50
|
-
}
|
|
51
|
-
this.isConnecting = false;
|
|
52
|
-
this.emit("connectionend", e, socket);
|
|
53
|
-
if (this.connectionEndSocket && this.connectionStartSocket) {
|
|
54
|
-
this.createConnection(this.connectionStartSocket.id, this.connectionEndSocket.id);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
this.setMaxListeners(1024);
|
|
58
|
-
}
|
|
59
|
-
get isCurrentlyConnecting() {
|
|
60
|
-
return this.isConnecting;
|
|
61
|
-
}
|
|
62
|
-
set unsavedState(state) {
|
|
63
|
-
this.isInUnsavedState = state;
|
|
64
|
-
this.emit("unsavedstateset", state);
|
|
65
|
-
}
|
|
66
|
-
get unsavedState() {
|
|
67
|
-
return this.isInUnsavedState;
|
|
68
|
-
}
|
|
69
|
-
setCurrentProject(id, name, desc) {
|
|
70
|
-
this.unsavedState = false;
|
|
71
|
-
this.existingFlowRuleId = id;
|
|
72
|
-
this.existingFlowRuleName = name;
|
|
73
|
-
this.existingFlowRuleDesc = desc;
|
|
74
|
-
this.history = [];
|
|
75
|
-
this.emit("projectset", id);
|
|
76
|
-
}
|
|
77
|
-
notifyChange() {
|
|
78
|
-
this.unsavedState = true;
|
|
79
|
-
this.emit("changed");
|
|
80
|
-
}
|
|
81
|
-
createUndoSnapshot() {
|
|
82
|
-
this.history = this.history.splice(0, this.historyIndex + 1);
|
|
83
|
-
this.history.push(JSON.parse(JSON.stringify(this.toNodeCollection("", ""))));
|
|
84
|
-
this.historyIndex = this.history.length - 1;
|
|
85
|
-
}
|
|
86
|
-
undo() {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
if (this.history.length === 0 || this.historyIndex === -1) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (this.historyIndex === this.history.length - 1) {
|
|
92
|
-
this.history.push(JSON.parse(JSON.stringify(this.toNodeCollection("", ""))));
|
|
93
|
-
}
|
|
94
|
-
yield this.fromNodeCollection(this.history[this.historyIndex]);
|
|
95
|
-
this.historyIndex--;
|
|
96
|
-
this.notifyChange();
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
redo() {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
if (this.history.length === 0 || this.historyIndex >= (this.history.length - 2)) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
this.historyIndex++;
|
|
105
|
-
yield this.fromNodeCollection(this.history[this.historyIndex + 1]);
|
|
106
|
-
this.notifyChange();
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
fromNodeCollection(collection) {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
yield this.clear();
|
|
112
|
-
collection.nodes.forEach((node) => {
|
|
113
|
-
this.addNode(node);
|
|
114
|
-
});
|
|
115
|
-
collection.connections.forEach((conn) => {
|
|
116
|
-
this.createConnection(conn.from, conn.to);
|
|
117
|
-
});
|
|
118
|
-
this.emit("nodecollectionloaded", collection);
|
|
119
|
-
this.unsavedState = false;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
toNodeCollection(name, description) {
|
|
123
|
-
return {
|
|
124
|
-
name,
|
|
125
|
-
description,
|
|
126
|
-
connections: this.connections,
|
|
127
|
-
nodes: this.nodes
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
clear() {
|
|
131
|
-
return __awaiter(this, arguments, void 0, function* (alsoResetProject = false) {
|
|
132
|
-
input.clearSelection();
|
|
133
|
-
this.nodes.forEach((n) => {
|
|
134
|
-
this.removeNode(n);
|
|
135
|
-
});
|
|
136
|
-
this.nodes = [];
|
|
137
|
-
this.connections = [];
|
|
138
|
-
this.unsavedState = !alsoResetProject;
|
|
139
|
-
if (alsoResetProject) {
|
|
140
|
-
this.setCurrentProject(-1, null, null);
|
|
141
|
-
}
|
|
142
|
-
this.emit("cleared");
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
addNode(node) {
|
|
146
|
-
if (this.nodes.filter((n) => n.id === node.id).length > 0) {
|
|
147
|
-
throw new Error("Node with identical identity already exists in the project");
|
|
148
|
-
}
|
|
149
|
-
this.nodes.push(node);
|
|
150
|
-
this.emit("nodeadded", node);
|
|
151
|
-
}
|
|
152
|
-
removeNode(node) {
|
|
153
|
-
input.clearSelection();
|
|
154
|
-
this.connections.filter((c) => {
|
|
155
|
-
const from = NodeUtilities.getSocketFromID(c.from, this.nodes);
|
|
156
|
-
const to = NodeUtilities.getSocketFromID(c.to, this.nodes);
|
|
157
|
-
return from.nodeId === node.id || to.nodeId === node.id;
|
|
158
|
-
}).forEach((c) => {
|
|
159
|
-
this.removeConnection(c);
|
|
160
|
-
});
|
|
161
|
-
this.nodes.filter((n) => n.id === node.id).forEach((n) => {
|
|
162
|
-
this.nodes.splice(this.nodes.indexOf(n), 1);
|
|
163
|
-
this.emit("noderemoved", n);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
removeConnection(connection) {
|
|
167
|
-
input.clearSelection();
|
|
168
|
-
this.connections.filter((c) => c.from === connection.from && c.to === connection.to).forEach((c) => {
|
|
169
|
-
const index = this.connections.indexOf(c);
|
|
170
|
-
if (index === -1) {
|
|
171
|
-
console.warn("attempt to delete nonexistent connection");
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
this.connections.splice(index, 1);
|
|
175
|
-
this.emit("connectionremoved", c);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
isValidConnection(connection) {
|
|
180
|
-
const fromSocket = NodeUtilities.getSocketFromID(connection.from, this.nodes);
|
|
181
|
-
const toSocket = NodeUtilities.getSocketFromID(connection.to, this.nodes);
|
|
182
|
-
if (!fromSocket ||
|
|
183
|
-
!toSocket) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
return !(!SocketTypeMatcher.match(fromSocket.type, toSocket.type) ||
|
|
187
|
-
fromSocket.id === toSocket.id ||
|
|
188
|
-
fromSocket.nodeId === toSocket.nodeId);
|
|
189
|
-
}
|
|
190
|
-
createConnection(fromSocket, toSocket) {
|
|
191
|
-
const connection = {
|
|
192
|
-
from: fromSocket,
|
|
193
|
-
to: toSocket
|
|
194
|
-
};
|
|
195
|
-
if (!(this.isValidConnection(connection))) {
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
// If the type contains _ARRAY, then assume that we allow multiple nodes to connect to that socket.
|
|
199
|
-
if (!((NodeUtilities.getSocketFromID(connection.to, this.nodes).type).includes("_ARRAY"))) {
|
|
200
|
-
for (const c of this.connections.filter((j) => j.to === toSocket)) {
|
|
201
|
-
// TODO: this.connections should contain the types of the other nodes, so that we only remove
|
|
202
|
-
this.removeConnection(c);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
this.connections.push(connection);
|
|
206
|
-
this.emit("connectioncreated", fromSocket, toSocket);
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
removeInvalidConnections() {
|
|
210
|
-
for (const c of this.connections.map(c => this.enrichConnection(c)).filter(j => !this.isValidConnection(j))) {
|
|
211
|
-
this.removeConnection(c);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
enrichConnection(c) {
|
|
215
|
-
var _a, _b;
|
|
216
|
-
return {
|
|
217
|
-
from: (_a = NodeUtilities.getSocketFromID(c.from, this.nodes)) === null || _a === void 0 ? void 0 : _a.id,
|
|
218
|
-
to: (_b = NodeUtilities.getSocketFromID(c.to, this.nodes)) === null || _b === void 0 ? void 0 : _b.id
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
//# sourceMappingURL=project.js.map
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,s){function h(t){try{c(n.next(t))}catch(t){s(t)}}function r(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(h,r)}c((n=n.apply(t,e||[])).next())})};import{EventEmitter as t}from"events";import{input as e}from"../components/flow-editor";import{NodeUtilities as i}from"../node-structure";import{SocketTypeMatcher as n}from"../node-structure/socket.type.matcher";export class Project extends t{constructor(){super(),this.nodes=[],this.connections=[],this.existingFlowRuleId=-1,this.existingFlowRuleName=null,this.existingFlowRuleDesc=null,this.isInUnsavedState=!1,this.isConnecting=!1,this.history=[],this.historyIndex=0,this.startConnectionDrag=(t,e,i)=>{this.connectionStartSocket=null,this.connectionEndSocket=null,i?this.connectionEndSocket=e:this.connectionStartSocket=e,this.isConnecting=!0,this.emit("connectionstart",t,e)},this.connectionDragging=t=>{this.emit("connecting",t)},this.endConnectionDrag=(t,e,i)=>{this.isConnecting&&(i?this.connectionEndSocket=e:this.connectionStartSocket=e,this.isConnecting=!1,this.emit("connectionend",t,e),this.connectionEndSocket&&this.connectionStartSocket&&this.createConnection(this.connectionStartSocket.id,this.connectionEndSocket.id))},this.setMaxListeners(1024)}get isCurrentlyConnecting(){return this.isConnecting}set unsavedState(t){this.isInUnsavedState=t,this.emit("unsavedstateset",t)}get unsavedState(){return this.isInUnsavedState}setCurrentProject(t,e,i){this.unsavedState=!1,this.existingFlowRuleId=t,this.existingFlowRuleName=e,this.existingFlowRuleDesc=i,this.history=[],this.emit("projectset",t)}notifyChange(){this.unsavedState=!0,this.emit("changed")}createUndoSnapshot(){this.history=this.history.splice(0,this.historyIndex+1),this.history.push(JSON.parse(JSON.stringify(this.toNodeCollection("","")))),this.historyIndex=this.history.length-1}undo(){return __awaiter(this,void 0,void 0,function*(){0!==this.history.length&&-1!==this.historyIndex&&(this.historyIndex===this.history.length-1&&this.history.push(JSON.parse(JSON.stringify(this.toNodeCollection("","")))),yield this.fromNodeCollection(this.history[this.historyIndex]),this.historyIndex--,this.notifyChange())})}redo(){return __awaiter(this,void 0,void 0,function*(){0===this.history.length||this.historyIndex>=this.history.length-2||(this.historyIndex++,yield this.fromNodeCollection(this.history[this.historyIndex+1]),this.notifyChange())})}fromNodeCollection(t){return __awaiter(this,void 0,void 0,function*(){yield this.clear(),t.nodes.forEach(t=>{this.addNode(t)}),t.connections.forEach(t=>{this.createConnection(t.from,t.to)}),this.emit("nodecollectionloaded",t),this.unsavedState=!1})}toNodeCollection(t,e){return{name:t,description:e,connections:this.connections,nodes:this.nodes}}clear(){return __awaiter(this,arguments,void 0,function*(t=!1){e.clearSelection(),this.nodes.forEach(t=>{this.removeNode(t)}),this.nodes=[],this.connections=[],this.unsavedState=!t,t&&this.setCurrentProject(-1,null,null),this.emit("cleared")})}addNode(t){if(this.nodes.filter(e=>e.id===t.id).length>0)throw Error("Node with identical identity already exists in the project");this.nodes.push(t),this.emit("nodeadded",t)}removeNode(t){e.clearSelection(),this.connections.filter(e=>{let n=i.getSocketFromID(e.from,this.nodes),o=i.getSocketFromID(e.to,this.nodes);return n.nodeId===t.id||o.nodeId===t.id}).forEach(t=>{this.removeConnection(t)}),this.nodes.filter(e=>e.id===t.id).forEach(t=>{this.nodes.splice(this.nodes.indexOf(t),1),this.emit("noderemoved",t)})}removeConnection(t){e.clearSelection(),this.connections.filter(e=>e.from===t.from&&e.to===t.to).forEach(t=>{let e=this.connections.indexOf(t);-1===e?console.warn("attempt to delete nonexistent connection"):(this.connections.splice(e,1),this.emit("connectionremoved",t))})}isValidConnection(t){let e=i.getSocketFromID(t.from,this.nodes),o=i.getSocketFromID(t.to,this.nodes);return!!e&&!!o&&!(!n.match(e.type,o.type)||e.id===o.id||e.nodeId===o.nodeId)}createConnection(t,e){let n={from:t,to:e};if(!this.isValidConnection(n))return!1;if(!i.getSocketFromID(n.to,this.nodes).type.includes("_ARRAY"))for(let t of this.connections.filter(t=>t.to===e))this.removeConnection(t);return this.connections.push(n),this.emit("connectioncreated",t,e),!0}removeInvalidConnections(){for(let t of this.connections.map(t=>this.enrichConnection(t)).filter(t=>!this.isValidConnection(t)))this.removeConnection(t)}enrichConnection(t){var e,n;return{from:null==(e=i.getSocketFromID(t.from,this.nodes))?void 0:e.id,to:null==(n=i.getSocketFromID(t.to,this.nodes))?void 0:n.id}}}
|
|
@@ -1,63 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ConnectionLine } from "../components/connection-line";
|
|
3
|
-
import { input, project } from "../components/flow-editor";
|
|
4
|
-
export class Shortcuts {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.actions = [
|
|
7
|
-
{
|
|
8
|
-
keys: ["Delete", "Backspace"],
|
|
9
|
-
action: () => {
|
|
10
|
-
project.createUndoSnapshot();
|
|
11
|
-
const selectedNodes = input.selected.filter((s) => s instanceof FlowNode && s.selected && !s.frozen);
|
|
12
|
-
const selectedConnections = input.selected.filter((s) => s instanceof ConnectionLine && s.selected);
|
|
13
|
-
selectedConnections.forEach((n) => project.removeConnection(n.connection));
|
|
14
|
-
selectedNodes.forEach((n) => project.removeNode(n.node));
|
|
15
|
-
project.notifyChange();
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
keys: ["KeyA"],
|
|
20
|
-
requireCtrl: true,
|
|
21
|
-
action: () => {
|
|
22
|
-
if (input.selected.length > 0) {
|
|
23
|
-
input.clearSelection(true);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
input.selectables.forEach((s) => {
|
|
27
|
-
input.select(s, true);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
keys: ["KeyZ"],
|
|
34
|
-
requireCtrl: true,
|
|
35
|
-
action: () => {
|
|
36
|
-
project.undo();
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
keys: ["KeyY"],
|
|
41
|
-
requireCtrl: true,
|
|
42
|
-
action: () => {
|
|
43
|
-
project.redo();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
];
|
|
47
|
-
window.addEventListener("keydown", (e) => {
|
|
48
|
-
if (!(document.activeElement instanceof HTMLBodyElement)) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
this.actions.forEach((a) => {
|
|
52
|
-
if (!a.keys.includes(e.key) && !a.keys.includes(e.code)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (a.requireCtrl && !e.ctrlKey) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
a.action();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=shortcuts.js.map
|
|
1
|
+
import{FlowNode as e}from"../components/flow-node";import{ConnectionLine as o}from"../components/connection-line";import{input as t,project as n}from"../components/flow-editor";export class Shortcuts{constructor(){this.actions=[{keys:["Delete","Backspace"],action:()=>{n.createUndoSnapshot();let c=t.selected.filter(o=>o instanceof e&&o.selected&&!o.frozen);t.selected.filter(e=>e instanceof o&&e.selected).forEach(e=>n.removeConnection(e.connection)),c.forEach(e=>n.removeNode(e.node)),n.notifyChange()}},{keys:["KeyA"],requireCtrl:!0,action:()=>{t.selected.length>0?t.clearSelection(!0):t.selectables.forEach(e=>{t.select(e,!0)})}},{keys:["KeyZ"],requireCtrl:!0,action:()=>{n.undo()}},{keys:["KeyY"],requireCtrl:!0,action:()=>{n.redo()}}],window.addEventListener("keydown",e=>{document.activeElement instanceof HTMLBodyElement&&this.actions.forEach(o=>{(o.keys.includes(e.key)||o.keys.includes(e.code))&&(!o.requireCtrl||e.ctrlKey)&&o.action()})})}}
|
|
@@ -1,55 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
stroke
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
`;
|
|
55
|
-
//# sourceMappingURL=editor-workspace-style.js.map
|
|
1
|
+
import{css as o}from"lit";export const EditorWorkspaceStyle=o`
|
|
2
|
+
:host{
|
|
3
|
+
background: whitesmoke;
|
|
4
|
+
position: relative;
|
|
5
|
+
display: block;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0 0 4px inset;
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.view-options{
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 0;
|
|
14
|
+
top: 0;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.button{
|
|
20
|
+
padding: 10px;
|
|
21
|
+
margin: 10px;
|
|
22
|
+
cursor:pointer;
|
|
23
|
+
background: rgba(0,0,0,0.02);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
or-mwc-input[type=button]
|
|
27
|
+
{
|
|
28
|
+
margin: 10px;
|
|
29
|
+
color: inherit;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.button:hover{
|
|
33
|
+
background: rgba(0,0,0,0.04);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.button:active{
|
|
37
|
+
background: rgba(0,0,0,0.06);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
svg, connection-container {
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
position: absolute;
|
|
43
|
+
display: block;
|
|
44
|
+
right: 0;
|
|
45
|
+
top: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
bottom: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
stroke-width: 4px;
|
|
51
|
+
stroke: rgb(80,80,80);
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
@@ -1,95 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
min-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
grid-template-
|
|
11
|
-
grid-template-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:
|
|
22
|
-
min-
|
|
23
|
-
|
|
24
|
-
grid-template-
|
|
25
|
-
grid-template-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
justify-content:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
border-radius:
|
|
54
|
-
border-bottom-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
margin-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
`;
|
|
95
|
-
//# sourceMappingURL=flow-node-style.js.map
|
|
1
|
+
import{css as t}from"lit";export const FlowNodeStyle=t`
|
|
2
|
+
:host{
|
|
3
|
+
white-space: nowrap;
|
|
4
|
+
min-width: 80px;
|
|
5
|
+
min-height: 80px;
|
|
6
|
+
background: rgba(200,200,200, 0.85);
|
|
7
|
+
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: auto auto auto;
|
|
10
|
+
grid-template-rows: auto 1fr;
|
|
11
|
+
grid-template-areas:
|
|
12
|
+
"title title title"
|
|
13
|
+
"input internal output";
|
|
14
|
+
|
|
15
|
+
position: absolute;
|
|
16
|
+
border-radius: var(--roundness);
|
|
17
|
+
transform-origin: 0 0;
|
|
18
|
+
z-index: 0;
|
|
19
|
+
}
|
|
20
|
+
:host([minimal]){
|
|
21
|
+
min-width: 60px;
|
|
22
|
+
min-height: 60px;
|
|
23
|
+
grid-template-columns: var(--socket-display-size) 1fr var(--socket-display-size);
|
|
24
|
+
grid-template-rows: auto;
|
|
25
|
+
grid-template-areas:
|
|
26
|
+
"input title output";
|
|
27
|
+
}
|
|
28
|
+
.socket-side{
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
justify-content: space-evenly;
|
|
33
|
+
}
|
|
34
|
+
.inputs{
|
|
35
|
+
grid-area: input;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
}
|
|
38
|
+
.inputs flow-node-socket{
|
|
39
|
+
transform: translateX(calc(var(--socket-size) / -2));
|
|
40
|
+
}
|
|
41
|
+
.outputs{
|
|
42
|
+
grid-area: output;
|
|
43
|
+
align-items: flex-end;
|
|
44
|
+
}
|
|
45
|
+
.outputs flow-node-socket{
|
|
46
|
+
transform: translateX(calc(var(--socket-size) / 2));
|
|
47
|
+
}
|
|
48
|
+
.title{
|
|
49
|
+
grid-area: title;
|
|
50
|
+
padding: 3px 6px 3px 6px;
|
|
51
|
+
background: rgb(180,180,180);
|
|
52
|
+
border-radius: inherit;
|
|
53
|
+
border-bottom-left-radius: 0;
|
|
54
|
+
border-bottom-right-radius: 0;
|
|
55
|
+
color: white;
|
|
56
|
+
cursor: grab;
|
|
57
|
+
}
|
|
58
|
+
.title.input{
|
|
59
|
+
background: var(--input-color);
|
|
60
|
+
text-align: right;
|
|
61
|
+
}
|
|
62
|
+
.title.processor{
|
|
63
|
+
background: var(--processor-color);
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
.title.output{
|
|
67
|
+
background: var(--output-color);
|
|
68
|
+
text-align: left;
|
|
69
|
+
}
|
|
70
|
+
.title.minimal{
|
|
71
|
+
background: transparent;
|
|
72
|
+
font-size: 20px;
|
|
73
|
+
line-height: 50%;
|
|
74
|
+
display: table;
|
|
75
|
+
padding: 15px 0 15px 0;
|
|
76
|
+
text-align: center;
|
|
77
|
+
margin-top: auto;
|
|
78
|
+
margin-bottom: auto;
|
|
79
|
+
}
|
|
80
|
+
.title.minimal[singlechar]{
|
|
81
|
+
font-size: 32px;
|
|
82
|
+
}
|
|
83
|
+
.lock-icon{
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 0px;
|
|
86
|
+
right: 0px;
|
|
87
|
+
color: rgba(255,255,255,0.8);
|
|
88
|
+
transform: scale(.7);
|
|
89
|
+
}
|
|
90
|
+
.lock-icon.input{
|
|
91
|
+
left: 0;
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
min-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`;
|
|
31
|
-
//# sourceMappingURL=picker-styles.js.map
|
|
1
|
+
import{css as t}from"lit";export const PickerStyle=t`
|
|
2
|
+
input{
|
|
3
|
+
border: 0;
|
|
4
|
+
height: max-content;
|
|
5
|
+
}
|
|
6
|
+
textarea {
|
|
7
|
+
min-width: 150px;
|
|
8
|
+
min-height: 37px;
|
|
9
|
+
}
|
|
10
|
+
input[type=number] {
|
|
11
|
+
padding: 11px 10px;
|
|
12
|
+
}
|
|
13
|
+
textarea, input[type=text], select{
|
|
14
|
+
font-family: inherit;
|
|
15
|
+
padding: 10px;
|
|
16
|
+
border-radius: var(--roundness);
|
|
17
|
+
width: fit-content;
|
|
18
|
+
border: none;
|
|
19
|
+
}
|
|
20
|
+
.attribute-label{
|
|
21
|
+
padding: 5px;
|
|
22
|
+
background: rgba(0,0,0,0.05);
|
|
23
|
+
text-align: center;
|
|
24
|
+
border-radius: var(--roundness);
|
|
25
|
+
font-size: 110%;
|
|
26
|
+
color: rgb(76, 76, 76);
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
}
|
|
29
|
+
`;
|