@woosh/meep-engine 2.98.0 → 2.98.2

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 (49) hide show
  1. package/build/meep.cjs +59 -72
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +59 -72
  4. package/package.json +1 -1
  5. package/src/core/collection/set/compute_set_difference.d.ts.map +1 -1
  6. package/src/core/collection/set/compute_set_difference.js +8 -0
  7. package/src/core/collection/set/compute_set_difference.spec.d.ts +2 -0
  8. package/src/core/collection/set/compute_set_difference.spec.d.ts.map +1 -0
  9. package/src/core/collection/set/compute_set_difference.spec.js +45 -0
  10. package/src/core/collection/set/compute_set_intersection.d.ts +1 -0
  11. package/src/core/collection/set/compute_set_intersection.d.ts.map +1 -1
  12. package/src/core/collection/set/compute_set_intersection.js +9 -0
  13. package/src/core/collection/set/compute_set_intersection.spec.d.ts +2 -0
  14. package/src/core/collection/set/compute_set_intersection.spec.d.ts.map +1 -0
  15. package/src/core/collection/set/compute_set_intersection.spec.js +45 -0
  16. package/src/core/collection/set/set_remove.d.ts +2 -0
  17. package/src/core/collection/set/set_remove.d.ts.map +1 -1
  18. package/src/core/collection/set/set_remove.js +2 -0
  19. package/src/core/color/oklab/XYZ.spec.d.ts +2 -0
  20. package/src/core/color/oklab/XYZ.spec.d.ts.map +1 -0
  21. package/src/core/color/oklab/XYZ.spec.js +17 -0
  22. package/src/core/color/oklab/oklab_to_xyz.d.ts +9 -0
  23. package/src/core/color/oklab/oklab_to_xyz.d.ts.map +1 -0
  24. package/src/core/color/oklab/oklab_to_xyz.js +32 -0
  25. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts +2 -0
  26. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts.map +1 -0
  27. package/src/core/color/oklab/oklab_to_xyz.spec.js +31 -0
  28. package/src/core/color/oklab/xyz_to_oklab.d.ts +8 -0
  29. package/src/core/color/oklab/xyz_to_oklab.d.ts.map +1 -0
  30. package/src/core/color/oklab/xyz_to_oklab.js +29 -0
  31. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts +2 -0
  32. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts.map +1 -0
  33. package/src/core/color/oklab/xyz_to_oklab.spec.js +31 -0
  34. package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
  35. package/src/core/color/sRGB/linear_to_sRGB.js +16 -5
  36. package/src/core/color/sRGB/sRGB_to_linear.d.ts.map +1 -1
  37. package/src/core/color/sRGB/sRGB_to_linear.js +17 -5
  38. package/src/core/color/xyz/rgb_to_xyz.d.ts +1 -0
  39. package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
  40. package/src/core/color/xyz/rgb_to_xyz.js +4 -3
  41. package/src/core/color/xyz/xyz_to_rgb.d.ts +1 -1
  42. package/src/core/color/xyz/xyz_to_rgb.js +4 -4
  43. package/src/core/events/signal/Signal.d.ts.map +1 -1
  44. package/src/core/events/signal/Signal.js +21 -53
  45. package/src/core/events/signal/SignalFlags.d.ts +0 -1
  46. package/src/core/events/signal/SignalFlags.js +1 -6
  47. package/src/core/color/hsluv/HSLuv.d.ts +0 -13
  48. package/src/core/color/hsluv/HSLuv.d.ts.map +0 -1
  49. package/src/core/color/hsluv/HSLuv.js +0 -187
package/build/meep.cjs CHANGED
@@ -890,6 +890,13 @@ function m4_multiply(out, a, b) {
890
890
  out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
891
891
  }
892
892
 
893
+ const SignalFlags = {
894
+ /**
895
+ * If set - signal will not invoke handlers when dispatched
896
+ */
897
+ Silent: 1
898
+ };
899
+
893
900
  /**
894
901
  *
895
902
  * @enum {number}
@@ -968,18 +975,6 @@ class SignalHandler {
968
975
  */
969
976
  SignalHandler.prototype.isSignalHandler = true;
970
977
 
971
- const SignalFlags = {
972
- /**
973
- * If set - signal will not invoke handlers when dispatched
974
- */
975
- Silent: 1,
976
- /**
977
- * Is set at the start of the dispatch and cleared at the end
978
- * @deprecated
979
- */
980
- Dispatching: 2
981
- };
982
-
983
978
  /**
984
979
  *
985
980
  * @author Alex Goldring
@@ -989,6 +984,7 @@ const SignalFlags = {
989
984
 
990
985
  /**
991
986
  * Common dispatch stack
987
+ * @readonly
992
988
  * @type {SignalHandler[]}
993
989
  */
994
990
  const dispatch_stack = [];
@@ -1001,40 +997,17 @@ let dispatch_stack_top = 0;
1001
997
  */
1002
998
  class Signal {
1003
999
  /**
1004
- * Event dispatcher dedicated to single event type
1005
- * @constructor
1006
- */
1007
- constructor() {
1008
- /**
1009
- * @private
1010
- * @type {SignalHandler[]}
1011
- */
1012
- this.handlers = [];
1013
-
1014
- /**
1015
- * Internal flag bitmask
1016
- * @private
1017
- * @type {number}
1018
- */
1019
- this.flags = 0;
1020
- }
1021
-
1022
- /**
1023
- * @deprecated
1024
- * @returns {boolean}
1000
+ * @private
1001
+ * @type {SignalHandler[]}
1025
1002
  */
1026
- get dispatching() {
1027
- return this.getFlag(SignalFlags.Dispatching);
1028
- }
1003
+ handlers = [];
1029
1004
 
1030
1005
  /**
1031
- * @deprecated
1032
- * @param {boolean} v
1006
+ * Internal flag bitmask
1007
+ * @private
1008
+ * @type {number}
1033
1009
  */
1034
- set dispatching(v) {
1035
- this.writeFlag(SignalFlags.Dispatching, v);
1036
- }
1037
-
1010
+ flags = 0;
1038
1011
 
1039
1012
  /**
1040
1013
  *
@@ -1096,14 +1069,15 @@ class Signal {
1096
1069
 
1097
1070
 
1098
1071
  /**
1099
- *
1100
- * @param {function} h
1072
+ * Checks if a given signal handler is present or not
1073
+ * @param {function} handler
1074
+ * @param {*} [thisArg] if not present, will not be considered
1101
1075
  * @returns {boolean}
1102
1076
  */
1103
- contains(h) {
1077
+ contains(handler, thisArg) {
1104
1078
  const handlers = this.handlers;
1105
1079
 
1106
- const i = findSignalHandlerIndexByHandle(handlers, h);
1080
+ const i = findSignalHandlerIndexByHandle(handlers, handler, thisArg);
1107
1081
 
1108
1082
  return i !== -1;
1109
1083
  }
@@ -1125,7 +1099,7 @@ class Signal {
1125
1099
  }
1126
1100
 
1127
1101
  /**
1128
- *
1102
+ * Handler will only be run once, it will be removed automatically after the first execution
1129
1103
  * @param {function} h
1130
1104
  * @param {*} [context]
1131
1105
  */
@@ -1172,7 +1146,9 @@ class Signal {
1172
1146
  }
1173
1147
 
1174
1148
  /**
1175
- * Remove all handlers
1149
+ * Remove all handlers.
1150
+ * Please note that this will remove even all handlers, irrespective of where they were added from.
1151
+ * For most use cases, prefer to use {@link remove} method instead, or make use of {@link SignalBinding} if you need to keep track of multiple handlers
1176
1152
  */
1177
1153
  removeAll() {
1178
1154
  const handlers = this.handlers;
@@ -1180,6 +1156,7 @@ class Signal {
1180
1156
  }
1181
1157
 
1182
1158
  /**
1159
+ * NOTE: because of polymorphic call-site nature of this method, it's always better for performance to use monomorphic methods like `send0`, `send1` etc.
1183
1160
  * @param {...*} args
1184
1161
  */
1185
1162
  dispatch(...args) {
@@ -1188,13 +1165,8 @@ class Signal {
1188
1165
  return;
1189
1166
  }
1190
1167
 
1191
- //mark dispatch process
1192
- this.setFlag(SignalFlags.Dispatching);
1193
-
1194
1168
  dispatchViaProxy(this.handlers, args);
1195
1169
 
1196
- //mark end of dispatch process
1197
- this.clearFlag(SignalFlags.Dispatching);
1198
1170
  }
1199
1171
 
1200
1172
  /**
@@ -1560,14 +1532,6 @@ class Signal {
1560
1532
  dispatch_stack_top = stack_pointer;
1561
1533
  }
1562
1534
 
1563
- /**
1564
- * @deprecated do not use
1565
- * @returns {boolean}
1566
- */
1567
- isDispatching() {
1568
- return this.getFlag(SignalFlags.Dispatching);
1569
- }
1570
-
1571
1535
  /**
1572
1536
  *
1573
1537
  * @param {Signal} other
@@ -1598,7 +1562,7 @@ Signal.prototype.isSignal = true;
1598
1562
  *
1599
1563
  * @param {SignalHandler[]} handlers
1600
1564
  * @param {function} f
1601
- * @param thisArg
1565
+ * @param {*} [thisArg]
1602
1566
  * @returns {number} index of the handler, or -1 if not found
1603
1567
  */
1604
1568
  function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
@@ -53633,7 +53597,11 @@ function rgb2uint24(r, g, b) {
53633
53597
  }
53634
53598
 
53635
53599
  function convert(c) {
53636
- return (c < 0.0031308) ? c * 12.92 : 1.055 * (Math.pow(c, 0.41666)) - 0.055;
53600
+ if (c < 0.0031308) {
53601
+ return c * 12.92;
53602
+ } else {
53603
+ return 1.055 * (Math.pow(c, 0.4166666666666667)) - 0.055;
53604
+ }
53637
53605
  }
53638
53606
 
53639
53607
  /**
@@ -53643,10 +53611,17 @@ function convert(c) {
53643
53611
  * @param {number[]|ArrayLike<number>} input
53644
53612
  * @param {number} input_offset
53645
53613
  */
53646
- function linear_to_sRGB(output, output_offset, input, input_offset) {
53647
- output[output_offset] = convert(input[input_offset]);
53648
- output[output_offset + 1] = convert(input[input_offset + 1]);
53649
- output[output_offset + 2] = convert(input[input_offset + 2]);
53614
+ function linear_to_sRGB(
53615
+ output, output_offset,
53616
+ input, input_offset
53617
+ ) {
53618
+ const r = input[input_offset];
53619
+ const g = input[input_offset + 1];
53620
+ const b = input[input_offset + 2];
53621
+
53622
+ output[output_offset] = convert(r);
53623
+ output[output_offset + 1] = convert(g);
53624
+ output[output_offset + 2] = convert(b);
53650
53625
  }
53651
53626
 
53652
53627
  /**
@@ -53655,7 +53630,11 @@ function linear_to_sRGB(output, output_offset, input, input_offset) {
53655
53630
  * @return {number|number}
53656
53631
  */
53657
53632
  function convert_channel_sRGB_to_linear(c) {
53658
- return (c < 0.04045) ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
53633
+ if (c < 0.04045) {
53634
+ return c * 0.0773993808;
53635
+ } else {
53636
+ return Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
53637
+ }
53659
53638
  }
53660
53639
 
53661
53640
  /**
@@ -53665,10 +53644,18 @@ function convert_channel_sRGB_to_linear(c) {
53665
53644
  * @param {number[]} input
53666
53645
  * @param {number} input_offset
53667
53646
  */
53668
- function sRGB_to_linear(output, output_offset, input, input_offset) {
53669
- output[output_offset] = convert_channel_sRGB_to_linear(input[input_offset]);
53670
- output[output_offset + 1] = convert_channel_sRGB_to_linear(input[input_offset + 1]);
53671
- output[output_offset + 2] = convert_channel_sRGB_to_linear(input[input_offset + 2]);
53647
+ function sRGB_to_linear(
53648
+ output, output_offset,
53649
+ input, input_offset
53650
+ ) {
53651
+
53652
+ const sR = input[input_offset];
53653
+ const sG = input[input_offset + 1];
53654
+ const sB = input[input_offset + 2];
53655
+
53656
+ output[output_offset] = convert_channel_sRGB_to_linear(sR);
53657
+ output[output_offset + 1] = convert_channel_sRGB_to_linear(sG);
53658
+ output[output_offset + 2] = convert_channel_sRGB_to_linear(sB);
53672
53659
  }
53673
53660
 
53674
53661
  /**