@woosh/meep-engine 2.102.0 → 2.104.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.
Files changed (71) hide show
  1. package/build/meep.cjs +57 -40
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +57 -40
  4. package/package.json +1 -1
  5. package/src/core/geom/2d/circle/Circle.d.ts +0 -8
  6. package/src/core/geom/2d/circle/Circle.d.ts.map +1 -1
  7. package/src/core/geom/2d/circle/Circle.js +85 -85
  8. package/src/core/geom/ConicRay.d.ts +3 -1
  9. package/src/core/geom/ConicRay.d.ts.map +1 -1
  10. package/src/core/geom/ConicRay.js +7 -5
  11. package/src/core/geom/Vector1.d.ts.map +1 -1
  12. package/src/core/geom/Vector1.js +3 -0
  13. package/src/core/geom/Vector2.d.ts.map +1 -1
  14. package/src/core/geom/Vector2.js +6 -3
  15. package/src/core/geom/Vector3.js +1 -1
  16. package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts +2 -0
  17. package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts.map +1 -0
  18. package/src/core/geom/vec3/v3_angle_cos_between.spec.js +124 -0
  19. package/src/core/geom/vec3/v3_distance_above_plane.d.ts +13 -4
  20. package/src/core/geom/vec3/v3_distance_sqr.d.ts +12 -1
  21. package/src/core/geom/vec3/v3_length.d.ts +9 -1
  22. package/src/core/lang/reactive/compileReactiveExpression.d.ts.map +1 -1
  23. package/src/core/lang/reactive/compileReactiveExpression.js +1 -3
  24. package/src/core/lang/reactive/pegjs/ReactivePegCompiler.d.ts.map +1 -1
  25. package/src/core/lang/reactive/pegjs/ReactivePegCompiler.js +11 -5
  26. package/src/core/math/PI_RECIPROCAL.d.ts +6 -0
  27. package/src/core/math/PI_RECIPROCAL.d.ts.map +1 -0
  28. package/src/core/math/PI_RECIPROCAL.js +5 -0
  29. package/src/core/math/newton_solver_1d.d.ts +4 -3
  30. package/src/core/math/newton_solver_1d.d.ts.map +1 -1
  31. package/src/core/math/newton_solver_1d.js +4 -3
  32. package/src/core/math/physics/brdf/D_GGX.d.ts.map +1 -1
  33. package/src/core/math/physics/brdf/D_GGX.js +4 -1
  34. package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
  35. package/src/core/math/physics/brdf/brdf_burley.js +5 -1
  36. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.d.ts.map +1 -1
  37. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.js +3 -3
  38. package/src/core/primitives/strings/insert_after.spec.d.ts +2 -0
  39. package/src/core/primitives/strings/insert_after.spec.d.ts.map +1 -0
  40. package/src/core/primitives/strings/insert_after.spec.js +16 -0
  41. package/src/core/primitives/strings/insert_before.spec.d.ts +2 -0
  42. package/src/core/primitives/strings/insert_before.spec.d.ts.map +1 -0
  43. package/src/core/primitives/strings/insert_before.spec.js +16 -0
  44. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  45. package/src/core/process/executor/ConcurrentExecutor.js +10 -4
  46. package/src/core/time/current_time_in_seconds.d.ts.map +1 -1
  47. package/src/core/time/current_time_in_seconds.js +1 -1
  48. package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +1 -1
  49. package/src/engine/animation/curve/compute_curve_aabb.js +19 -16
  50. package/src/engine/ecs/fow/FogOfWar.d.ts.map +1 -1
  51. package/src/engine/ecs/fow/FogOfWar.js +10 -10
  52. package/src/engine/ecs/fow/FogOfWar.spec.js +5 -6
  53. package/src/engine/google/loadGTAG.d.ts +7 -0
  54. package/src/engine/google/loadGTAG.d.ts.map +1 -0
  55. package/src/engine/google/loadGTAG.js +32 -0
  56. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.d.ts.map +1 -1
  57. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +6 -1
  58. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.d.ts.map +1 -1
  59. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +17 -1
  60. package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
  61. package/src/engine/input/devices/PointerDevice.js +15 -5
  62. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts +2 -1
  63. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts.map +1 -1
  64. package/src/engine/metrics/GoogleAnalyticsMetrics.js +4 -39
  65. package/src/engine/notify/NotificationLog.d.ts +1 -2
  66. package/src/engine/notify/NotificationLog.d.ts.map +1 -1
  67. package/src/engine/notify/NotificationLog.js +33 -32
  68. package/src/core/lang/reactive/nearley/Reactive.ne +0 -87
  69. package/src/engine/compression/CompressionService.d.ts +0 -19
  70. package/src/engine/compression/CompressionService.d.ts.map +0 -1
  71. package/src/engine/compression/CompressionService.js +0 -144
package/build/meep.cjs CHANGED
@@ -2478,7 +2478,7 @@ let Vector3$1 = class Vector3 {
2478
2478
  }
2479
2479
 
2480
2480
  /**
2481
- * @param {number} [squaredError=0.01]
2481
+ * @param {number} [squaredError]
2482
2482
  * @return {boolean}
2483
2483
  */
2484
2484
  isNormalized(squaredError = 0.01) {
@@ -47474,10 +47474,8 @@ function v2_dot(x0, y0, x1, y1) {
47474
47474
  class Vector2 {
47475
47475
  /**
47476
47476
  *
47477
- * @param {number} [x=0
47477
+ * @param {number} [x=0]
47478
47478
  * @param {number} [y=0]
47479
- * @property {number} x
47480
- * @property {number} y
47481
47479
  * @constructor
47482
47480
  */
47483
47481
  constructor(x = 0, y = 0) {
@@ -50398,6 +50396,7 @@ class Vector1 extends Number {
50398
50396
  * @param {number} x
50399
50397
  */
50400
50398
  setSilent(x) {
50399
+
50401
50400
  this.x = x;
50402
50401
  }
50403
50402
 
@@ -83406,7 +83405,7 @@ class ModuleRegistry {
83406
83405
  * @param {TaskGroup|Task} t
83407
83406
  * @returns {boolean}
83408
83407
  */
83409
- function isGroup(t) {
83408
+ function isGroupTask(t) {
83410
83409
  return t.children instanceof Array;
83411
83410
  }
83412
83411
 
@@ -83414,7 +83413,12 @@ function isGroup(t) {
83414
83413
  * @class
83415
83414
  */
83416
83415
  class ConcurrentExecutor {
83416
+ /**
83417
+ * How many time-slice cycles have been executed this far. This is a monotonically increasing counter
83418
+ * @type {number}
83419
+ */
83417
83420
  #cycle_count = 0;
83421
+
83418
83422
  /**
83419
83423
  * Handle of the last scheduled `setTimeout`
83420
83424
  * @type {number}
@@ -83526,7 +83530,7 @@ class ConcurrentExecutor {
83526
83530
  const child = children[i];
83527
83531
  child.on.completed.add(subTaskCompleted);
83528
83532
  child.on.failed.add(subTaskFailed);
83529
- if (isGroup(child)) {
83533
+ if (isGroupTask(child)) {
83530
83534
  this.runGroup(child);
83531
83535
  } else {
83532
83536
  this.run(child);
@@ -83549,7 +83553,7 @@ class ConcurrentExecutor {
83549
83553
  for (let i = 0; i < n; i++) {
83550
83554
  const child = children[i];
83551
83555
 
83552
- if (isGroup(child)) {
83556
+ if (isGroupTask(child)) {
83553
83557
  this.removeGroup(child);
83554
83558
  } else {
83555
83559
  this.removeTask(child);
@@ -83646,7 +83650,7 @@ class ConcurrentExecutor {
83646
83650
  }
83647
83651
 
83648
83652
  /**
83649
- * Go through unresolved queue and move tasks who's dependencies have been completed to ready queue or fail them
83653
+ * Go through unresolved queue and move tasks whose dependencies have been completed to ready queue or fail them
83650
83654
  */
83651
83655
  resolveTasks() {
83652
83656
  const queueUnresolved = this.queueUnresolved;
@@ -83683,6 +83687,7 @@ class ConcurrentExecutor {
83683
83687
  /**
83684
83688
  *
83685
83689
  * @param {Task} task
83690
+ * @returns {boolean}
83686
83691
  */
83687
83692
  contains(task) {
83688
83693
  if (this.queueUnresolved.indexOf(task) !== -1) {
@@ -91416,6 +91421,12 @@ class PointerDevice {
91416
91421
  */
91417
91422
  #target = null;
91418
91423
 
91424
+ /**
91425
+ *
91426
+ * @type {Element|null}
91427
+ */
91428
+ #domElement = null;
91429
+
91419
91430
  /**
91420
91431
  * @private
91421
91432
  * @type {boolean}
@@ -91469,7 +91480,7 @@ class PointerDevice {
91469
91480
  *
91470
91481
  * @type {EventTarget}
91471
91482
  */
91472
- this.domElement = domElement;
91483
+ this.#domElement = domElement;
91473
91484
 
91474
91485
 
91475
91486
  this.#touchStart.add((param0, param1, param2) => {
@@ -91638,9 +91649,9 @@ class PointerDevice {
91638
91649
  *
91639
91650
  * @param {Element} el
91640
91651
  */
91641
- setTargetElement(el) {
91652
+ set domElement(el) {
91642
91653
 
91643
- if (this.#target === el) {
91654
+ if (this.#domElement === el) {
91644
91655
  // no change
91645
91656
  return;
91646
91657
  }
@@ -91652,7 +91663,7 @@ class PointerDevice {
91652
91663
  this.stop();
91653
91664
  }
91654
91665
 
91655
- this.#target = el;
91666
+ this.#domElement = el;
91656
91667
 
91657
91668
  if (was_running) {
91658
91669
  // restart to maintain original state
@@ -91660,6 +91671,10 @@ class PointerDevice {
91660
91671
  }
91661
91672
  }
91662
91673
 
91674
+ get domElement() {
91675
+ return this.#domElement;
91676
+ }
91677
+
91663
91678
  /**
91664
91679
  *
91665
91680
  * @param {Vector2} result
@@ -91679,7 +91694,7 @@ class PointerDevice {
91679
91694
 
91680
91695
  // console.warn("PointerDevice.start");
91681
91696
 
91682
- const domElement = this.domElement;
91697
+ const domElement = this.#domElement;
91683
91698
 
91684
91699
  domElement.addEventListener(MouseEvents.Move, this.#eventHandlerMouseMove);
91685
91700
  domElement.addEventListener(MouseEvents.Up, this.#eventHandlerMouseUp);
@@ -96213,6 +96228,7 @@ const source = typeof performance === "undefined" ? Date : performance;
96213
96228
  * @returns {number}
96214
96229
  */
96215
96230
  function current_time_in_seconds() {
96231
+ // time source produces value in milliseconds, we need to scale to seconds
96216
96232
  return source.now() * 1e-3;
96217
96233
  }
96218
96234
 
@@ -102717,50 +102733,51 @@ Notification.prototype.isNotification = true;
102717
102733
  */
102718
102734
 
102719
102735
 
102720
- function NotificationLog() {
102736
+ class NotificationLog {
102721
102737
  /**
102722
102738
  * @readonly
102723
102739
  * @type {List<Notification>}
102724
102740
  */
102725
- this.elements = new List();
102741
+ elements = new List();
102726
102742
 
102727
102743
  /**
102728
102744
  * Once number of entries in the log reaches this amount, the earliest entries will be removed to make space for new ones
102729
102745
  * @type {number}
102730
102746
  */
102731
- this.maxLength = 1000;
102732
- }
102747
+ maxLength = 1000;
102733
102748
 
102734
- /**
102735
- *
102736
- * @param {{}} options See Notification.constructor for details
102737
- * @returns {Notification}
102738
- */
102739
- NotificationLog.prototype.add = function (options) {
102740
- const notification = new Notification(options);
102749
+ /**
102750
+ *
102751
+ * @param {{}} options See {@link Notification.constructor} for details
102752
+ * @returns {Notification}
102753
+ */
102754
+ add(options) {
102755
+ const notification = new Notification(options);
102741
102756
 
102742
- this.addNotification(notification);
102757
+ this.addNotification(notification);
102743
102758
 
102744
- return notification;
102745
- };
102759
+ return notification;
102760
+ }
102746
102761
 
102747
- /**
102748
- *
102749
- * @param {Notification} notification
102750
- */
102751
- NotificationLog.prototype.addNotification = function (notification) {
102762
+ /**
102763
+ *
102764
+ * @param {Notification} notification
102765
+ */
102766
+ addNotification(notification) {
102752
102767
 
102753
- // Crop notification log to size
102754
- const length = this.elements.length;
102768
+ // Crop notification log to size
102769
+ const length = this.elements.length;
102755
102770
 
102756
- const target = this.maxLength - 1;
102771
+ const target = this.maxLength - 1;
102757
102772
 
102758
- if (length > target) {
102759
- this.elements.crop(length - target, length);
102760
- }
102773
+ if (length > target) {
102774
+ // too many elements, drop some
102775
+ this.elements.crop(length - target, length);
102776
+ }
102761
102777
 
102762
- this.elements.add(notification);
102763
- };
102778
+ this.elements.add(notification);
102779
+ }
102780
+ }
102764
102781
 
102765
102782
  class LogDisplay {
102766
102783
  /**