@woosh/meep-engine 2.94.8 → 2.95.0
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/package.json +1 -1
- package/src/core/collection/array/array_deduplicate.d.ts +8 -0
- package/src/core/collection/array/array_deduplicate.d.ts.map +1 -0
- package/src/core/collection/array/array_deduplicate.js +9 -0
- package/src/core/collection/array/array_deduplicate.spec.d.ts +2 -0
- package/src/core/collection/array/array_deduplicate.spec.d.ts.map +1 -0
- package/src/core/collection/array/array_deduplicate.spec.js +11 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +37 -17
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_deduplicate.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_deduplicate.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sDAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_deduplicate.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_deduplicate.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { array_deduplicate } from "./array_deduplicate.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
expect(array_deduplicate([])).toEqual([]);
|
|
5
|
+
expect(array_deduplicate([1])).toEqual([1]);
|
|
6
|
+
expect(array_deduplicate([1, 2])).toEqual([1, 2]);
|
|
7
|
+
expect(array_deduplicate([1, 2, 2])).toEqual([1, 2]);
|
|
8
|
+
expect(array_deduplicate([1, 2, 1])).toEqual([1, 2]);
|
|
9
|
+
expect(array_deduplicate([1, 1, 2])).toEqual([1, 2]);
|
|
10
|
+
expect(array_deduplicate([1, 2])).toEqual([1, 2]);
|
|
11
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeInstance.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/NodeInstance.js"],"names":[],"mappings":"AAcA;IAEI;;;OAGG;IACH,IAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,6BAAmB;IAEnB;;;OAGG;IACH,WAFU,yBAAyB,EAAE,CAEtB;IAEf;;;OAGG;IACH,gBAAgB;IAEhB;;;OAGG;IACH,qBAAmB;IAEnB;;;OAGG;IACH,aAFU,gBAAgB,CAED;IAEzB;;;;;;OAMG;IACH,wBAFU,MAAM,CAEE;IAElB;;OAEG;IACH;QACI;;;WAGG;mCADO,OAAO,MAAM,WAAO;QAG9B;;;WAGG;iCADO,OAAO,MAAM,MAAI;QAG3B;;;WAGG;mCADO,OAAO,MAAM,MAAI;
|
|
1
|
+
{"version":3,"file":"NodeInstance.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/NodeInstance.js"],"names":[],"mappings":"AAcA;IAEI;;;OAGG;IACH,IAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,6BAAmB;IAEnB;;;OAGG;IACH,WAFU,yBAAyB,EAAE,CAEtB;IAEf;;;OAGG;IACH,gBAAgB;IAEhB;;;OAGG;IACH,qBAAmB;IAEnB;;;OAGG;IACH,aAFU,gBAAgB,CAED;IAEzB;;;;;;OAMG;IACH,wBAFU,MAAM,CAEE;IAElB;;OAEG;IACH;QACI;;;WAGG;mCADO,OAAO,MAAM,WAAO;QAG9B;;;WAGG;iCADO,OAAO,MAAM,MAAI;QAG3B;;;WAGG;mCADO,OAAO,MAAM,MAAI;QAI3B;;;;WAIG;qCADO,wCAAwC;MAGpD;IAEF;;;;;;OAMG;IACH,yBALW,MAAM,aACN,aAAa,UACb,YAAY,GACV,MAAM,CAsBlB;IAED;;;OAGG;IACH,gDAEC;IAED;;;OAGG;IACH,+CAEC;IAGD;;;OAGG;IACH,mCAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;;OAIG;IACH,mBAHW,MAAM,oBAKhB;IAED;;;;OAIG;IACH,mBAHW,MAAM,OAKhB;IAED;;;;OAIG;IACH,yBAHW,MAAM,KAOhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,oBAmChB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,OAAO,CAkBnB;IAED;;;OAGG;IACH,uCAQC;IAED,wBAIC;IAED;;;OAGG;IACH,mDAqCC;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,yBAAyB,GAAC,SAAS,CAe/C;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;IAED,mBAEC;IAIL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CAPpC;0CArVyC,gCAAgC;iBAHzD,kCAAkC;mBAChC,kCAAkC;8BAGvB,oBAAoB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {assert} from "../../../assert.js";
|
|
2
|
-
import {isArrayEqual} from "../../../collection/array/isArrayEqual.js";
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
import { isArrayEqual } from "../../../collection/array/isArrayEqual.js";
|
|
3
3
|
import List from "../../../collection/list/List.js";
|
|
4
4
|
import Signal from "../../../events/signal/Signal.js";
|
|
5
|
-
import {objectDeepEquals} from "../../object/objectDeepEquals.js";
|
|
6
|
-
import {NodeInstancePortReference} from "./NodeInstancePortReference.js";
|
|
7
|
-
import {PortDirection} from "./PortDirection.js";
|
|
5
|
+
import { objectDeepEquals } from "../../object/objectDeepEquals.js";
|
|
6
|
+
import { NodeInstancePortReference } from "./NodeInstancePortReference.js";
|
|
7
|
+
import { PortDirection } from "./PortDirection.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -78,6 +78,13 @@ export class NodeInstance {
|
|
|
78
78
|
* @type {Signal<string, *>}
|
|
79
79
|
*/
|
|
80
80
|
parameterRemoved: new Signal(),
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* fires: (newDescription:NodeDescription, oldDescription:NodeDescription|null)
|
|
84
|
+
* @readonly
|
|
85
|
+
* @type {Signal<NodeDescription, NodeDescription>}
|
|
86
|
+
*/
|
|
87
|
+
descriptionChanged: new Signal()
|
|
81
88
|
};
|
|
82
89
|
|
|
83
90
|
/**
|
|
@@ -256,32 +263,45 @@ export class NodeInstance {
|
|
|
256
263
|
|
|
257
264
|
/**
|
|
258
265
|
*
|
|
259
|
-
* @param {NodeDescription}
|
|
266
|
+
* @param {NodeDescription} description
|
|
260
267
|
*/
|
|
261
|
-
setDescription(
|
|
262
|
-
|
|
268
|
+
setDescription(description) {
|
|
269
|
+
assert.defined(description, 'description');
|
|
270
|
+
assert.isObject(description, 'description');
|
|
271
|
+
assert.equal(description.isNodeDescription, true, 'description.isNodeDescription !== true');
|
|
272
|
+
|
|
273
|
+
if (!this.connections.isEmpty()) {
|
|
274
|
+
throw new Error("Node is has connections, can only change description for unconnected nodes");
|
|
275
|
+
}
|
|
263
276
|
|
|
264
|
-
|
|
277
|
+
const old_description = this.description;
|
|
278
|
+
|
|
279
|
+
this.description = description;
|
|
280
|
+
|
|
281
|
+
description.configureNode(this);
|
|
265
282
|
|
|
266
283
|
//generate endpoints
|
|
267
|
-
this.endpoints =
|
|
268
|
-
|
|
284
|
+
this.endpoints = description.getPorts()
|
|
285
|
+
.map((port, port_index) => {
|
|
286
|
+
const endpoint = new NodeInstancePortReference();
|
|
269
287
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
288
|
+
endpoint.id = port_index;
|
|
289
|
+
endpoint.port = port;
|
|
290
|
+
endpoint.instance = this;
|
|
273
291
|
|
|
274
|
-
|
|
275
|
-
|
|
292
|
+
return endpoint;
|
|
293
|
+
});
|
|
276
294
|
|
|
277
295
|
//clear parameters
|
|
278
296
|
this.clearParameters();
|
|
279
297
|
|
|
280
298
|
// TODO address parameters in NodeDescription as well
|
|
281
299
|
//populate parameter defaults
|
|
282
|
-
|
|
300
|
+
description.parameters.forEach(pd => {
|
|
283
301
|
this.parameters[pd.id] = pd.defaultValue;
|
|
284
302
|
});
|
|
303
|
+
|
|
304
|
+
this.on.descriptionChanged.send2(description, old_description);
|
|
285
305
|
}
|
|
286
306
|
|
|
287
307
|
/**
|