@woosh/meep-engine 2.47.14 → 2.47.16
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/build/meep.cjs +66 -54
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +66 -54
- package/package.json +1 -1
- package/src/core/IdPool.js +66 -54
- package/src/core/json/abstractJSONSerializer.js +24 -24
- package/src/core/model/node-graph/NodeGraph.js +23 -6
- package/src/core/model/node-graph/node/NodeInstance.d.ts +4 -0
package/build/meep.cjs
CHANGED
|
@@ -117643,78 +117643,90 @@ class MaxRectanglesPacker {
|
|
|
117643
117643
|
*/
|
|
117644
117644
|
|
|
117645
117645
|
/**
|
|
117646
|
-
*
|
|
117647
|
-
*
|
|
117646
|
+
* Pool of unsigned integer IDs, useful when you don't want to just keep incrementing ID counter and want to re-use IDs after they are no longer needed
|
|
117647
|
+
* Main use case is when your IDs are array indices, having compact IDs lets you use fixed size array even as objects are added and removed as you're able to reuse slots in an efficient manner
|
|
117648
117648
|
*/
|
|
117649
|
-
|
|
117649
|
+
class IdPool {
|
|
117650
117650
|
/**
|
|
117651
117651
|
* @private
|
|
117652
117652
|
* @type {BitSet}
|
|
117653
117653
|
*/
|
|
117654
|
-
|
|
117655
|
-
}
|
|
117654
|
+
#set = new BitSet();
|
|
117656
117655
|
|
|
117657
|
-
/**
|
|
117658
|
-
|
|
117659
|
-
|
|
117660
|
-
|
|
117661
|
-
|
|
117662
|
-
|
|
117656
|
+
/**
|
|
117657
|
+
* Looks up next available ID without reserving it
|
|
117658
|
+
* If you want to also reserve the ID - use {@link get} instead
|
|
117659
|
+
* @returns {number}
|
|
117660
|
+
*/
|
|
117661
|
+
peek() {
|
|
117662
|
+
return this.#set.nextClearBit(0);
|
|
117663
|
+
}
|
|
117663
117664
|
|
|
117664
|
-
|
|
117665
|
+
/**
|
|
117666
|
+
*
|
|
117667
|
+
* @returns {number}
|
|
117668
|
+
*/
|
|
117669
|
+
get() {
|
|
117670
|
+
const id = this.peek();
|
|
117665
117671
|
|
|
117666
|
-
|
|
117667
|
-
};
|
|
117672
|
+
this.#set.set(id, true);
|
|
117668
117673
|
|
|
117669
|
-
|
|
117670
|
-
* Attempt to request a specific ID from the pool.
|
|
117671
|
-
* @param {number} id
|
|
117672
|
-
* @return {boolean} true if request succeeds, false otherwise
|
|
117673
|
-
*/
|
|
117674
|
-
IdPool.prototype.getSpecific = function (id) {
|
|
117675
|
-
if (this.isUsed(id)) {
|
|
117676
|
-
return false;
|
|
117674
|
+
return id;
|
|
117677
117675
|
}
|
|
117678
117676
|
|
|
117679
|
-
|
|
117680
|
-
|
|
117681
|
-
}
|
|
117677
|
+
/**
|
|
117678
|
+
* Attempt to request a specific ID from the pool.
|
|
117679
|
+
* @param {number} id
|
|
117680
|
+
* @return {boolean} true if request succeeds, false otherwise
|
|
117681
|
+
*/
|
|
117682
|
+
getSpecific(id) {
|
|
117683
|
+
if (this.isUsed(id)) {
|
|
117684
|
+
return false;
|
|
117685
|
+
}
|
|
117682
117686
|
|
|
117683
|
-
|
|
117684
|
-
|
|
117685
|
-
|
|
117686
|
-
* @returns {boolean}
|
|
117687
|
-
*/
|
|
117688
|
-
IdPool.prototype.isUsed = function (id) {
|
|
117689
|
-
return this.bitSet.get(id);
|
|
117690
|
-
};
|
|
117687
|
+
this.#set.set(id, true);
|
|
117688
|
+
return true;
|
|
117689
|
+
}
|
|
117691
117690
|
|
|
117692
|
-
/**
|
|
117693
|
-
|
|
117694
|
-
|
|
117695
|
-
|
|
117696
|
-
|
|
117697
|
-
|
|
117691
|
+
/**
|
|
117692
|
+
*
|
|
117693
|
+
* @param {number} id
|
|
117694
|
+
* @returns {boolean}
|
|
117695
|
+
*/
|
|
117696
|
+
isUsed(id) {
|
|
117697
|
+
return this.#set.get(id);
|
|
117698
|
+
}
|
|
117698
117699
|
|
|
117699
|
-
|
|
117700
|
+
/**
|
|
117701
|
+
* Traverse all IDs currently in use
|
|
117702
|
+
* @param {function(id:number)} visitor
|
|
117703
|
+
*/
|
|
117704
|
+
traverseUsed(visitor) {
|
|
117705
|
+
assert.isFunction(visitor, "visitor");
|
|
117700
117706
|
|
|
117701
|
-
|
|
117702
|
-
visitor(i);
|
|
117703
|
-
}
|
|
117707
|
+
const set = this.#set;
|
|
117704
117708
|
|
|
117705
|
-
|
|
117709
|
+
for (let i = set.nextSetBit(0); i !== -1; i = set.nextSetBit(i + 1)) {
|
|
117710
|
+
visitor(i);
|
|
117711
|
+
}
|
|
117706
117712
|
|
|
117707
|
-
|
|
117708
|
-
*
|
|
117709
|
-
* @param {number} id
|
|
117710
|
-
*/
|
|
117711
|
-
IdPool.prototype.release = function (id) {
|
|
117712
|
-
this.bitSet.clear(id);
|
|
117713
|
-
};
|
|
117713
|
+
}
|
|
117714
117714
|
|
|
117715
|
-
|
|
117716
|
-
|
|
117717
|
-
}
|
|
117715
|
+
/**
|
|
117716
|
+
*
|
|
117717
|
+
* @param {number} id
|
|
117718
|
+
*/
|
|
117719
|
+
release(id) {
|
|
117720
|
+
this.#set.clear(id);
|
|
117721
|
+
}
|
|
117722
|
+
|
|
117723
|
+
/**
|
|
117724
|
+
* Release all used IDs
|
|
117725
|
+
*/
|
|
117726
|
+
reset() {
|
|
117727
|
+
this.#set.reset();
|
|
117728
|
+
}
|
|
117729
|
+
}
|
|
117718
117730
|
|
|
117719
117731
|
class AtlasPatch {
|
|
117720
117732
|
constructor() {
|