@zyzgroup/core-web 0.1.8 → 0.1.10

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 (109) hide show
  1. package/dist/zyzgroup_core_web.iife.js +5 -5
  2. package/dist/zyzgroup_core_web.iife.js.map +1 -1
  3. package/dist/zyzgroup_core_web.js +34 -28
  4. package/dist/zyzgroup_core_web.js.map +1 -1
  5. package/dist/zyzgroup_core_web.umd.cjs +5 -5
  6. package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
  7. package/package.json +1 -1
  8. package/types/dom/DOMEventBus.d.ts +4 -4
  9. package/types/dom/DOMEventBus.d.ts.map +1 -1
  10. package/types/dom/DOMParse.d.ts +2 -2
  11. package/types/dom/DOMParse.d.ts.map +1 -1
  12. package/types/hooks/useDragDrop.d.ts +6 -1
  13. package/types/hooks/useDragDrop.d.ts.map +1 -1
  14. package/types/math/Shape.d.ts +2 -2
  15. package/types/math/Shape.d.ts.map +1 -1
  16. package/types/math/core/Box2.d.ts.map +1 -0
  17. package/types/math/{math/math → core}/Box3.d.ts +2 -2
  18. package/types/math/core/Box3.d.ts.map +1 -0
  19. package/types/math/{math/core → core}/BufferAttribute.d.ts +2 -2
  20. package/types/math/core/BufferAttribute.d.ts.map +1 -0
  21. package/types/math/core/Color.d.ts.map +1 -0
  22. package/types/math/core/ColorManagement.d.ts.map +1 -0
  23. package/types/math/core/Cylindrical.d.ts.map +1 -0
  24. package/types/math/core/Euler.d.ts.map +1 -0
  25. package/types/math/{math/math → core}/Frustum.d.ts +1 -1
  26. package/types/math/core/Frustum.d.ts.map +1 -0
  27. package/types/math/core/Layers.d.ts.map +1 -0
  28. package/types/math/core/Line3.d.ts.map +1 -0
  29. package/types/math/core/Matrix.d.ts.map +1 -0
  30. package/types/math/core/Matrix2.d.ts.map +1 -0
  31. package/types/math/core/Matrix3.d.ts.map +1 -0
  32. package/types/math/core/Matrix4.d.ts.map +1 -0
  33. package/types/math/{math/core → core}/Object3D.d.ts +10 -7
  34. package/types/math/core/Object3D.d.ts.map +1 -0
  35. package/types/math/core/Plane.d.ts.map +1 -0
  36. package/types/math/core/Quaternion.d.ts.map +1 -0
  37. package/types/math/core/Ray.d.ts.map +1 -0
  38. package/types/math/core/Sphere.d.ts.map +1 -0
  39. package/types/math/core/Spherical.d.ts.map +1 -0
  40. package/types/math/core/SphericalHarmonics3.d.ts.map +1 -0
  41. package/types/math/core/Triangle.d.ts.map +1 -0
  42. package/types/math/core/Vector.d.ts.map +1 -0
  43. package/types/math/{math/math → core}/Vector2.d.ts +1 -1
  44. package/types/math/core/Vector2.d.ts.map +1 -0
  45. package/types/math/{math/math → core}/Vector3.d.ts +1 -1
  46. package/types/math/core/Vector3.d.ts.map +1 -0
  47. package/types/math/core/Vector4.d.ts.map +1 -0
  48. package/types/math/{math → core}/constants.d.ts.map +1 -1
  49. package/types/math/core/index.d.ts +9 -0
  50. package/types/math/core/index.d.ts.map +1 -0
  51. package/types/math/index.d.ts +1 -1
  52. package/types/math/index.d.ts.map +1 -1
  53. package/types/math/math/cameras/Camera.d.ts +0 -11
  54. package/types/math/math/cameras/Camera.d.ts.map +1 -1
  55. package/types/math/math/controls/Controls.d.ts +0 -24
  56. package/types/math/math/controls/Controls.d.ts.map +1 -1
  57. package/types/math/math/core/GLBufferAttribute.d.ts +0 -18
  58. package/types/math/math/core/GLBufferAttribute.d.ts.map +1 -1
  59. package/types/math/math/core/BufferAttribute.d.ts.map +0 -1
  60. package/types/math/math/core/EventDispatcher.d.ts +0 -14
  61. package/types/math/math/core/EventDispatcher.d.ts.map +0 -1
  62. package/types/math/math/core/Layers.d.ts.map +0 -1
  63. package/types/math/math/core/Object3D.d.ts.map +0 -1
  64. package/types/math/math/index.d.ts +0 -10
  65. package/types/math/math/index.d.ts.map +0 -1
  66. package/types/math/math/math/Box2.d.ts.map +0 -1
  67. package/types/math/math/math/Box3.d.ts.map +0 -1
  68. package/types/math/math/math/Color.d.ts.map +0 -1
  69. package/types/math/math/math/ColorManagement.d.ts.map +0 -1
  70. package/types/math/math/math/Cylindrical.d.ts.map +0 -1
  71. package/types/math/math/math/Euler.d.ts.map +0 -1
  72. package/types/math/math/math/Frustum.d.ts.map +0 -1
  73. package/types/math/math/math/Line3.d.ts.map +0 -1
  74. package/types/math/math/math/Matrix.d.ts.map +0 -1
  75. package/types/math/math/math/Matrix2.d.ts.map +0 -1
  76. package/types/math/math/math/Matrix3.d.ts.map +0 -1
  77. package/types/math/math/math/Matrix4.d.ts.map +0 -1
  78. package/types/math/math/math/Plane.d.ts.map +0 -1
  79. package/types/math/math/math/Quaternion.d.ts.map +0 -1
  80. package/types/math/math/math/Ray.d.ts.map +0 -1
  81. package/types/math/math/math/Sphere.d.ts.map +0 -1
  82. package/types/math/math/math/Spherical.d.ts.map +0 -1
  83. package/types/math/math/math/SphericalHarmonics3.d.ts.map +0 -1
  84. package/types/math/math/math/Triangle.d.ts.map +0 -1
  85. package/types/math/math/math/Vector.d.ts.map +0 -1
  86. package/types/math/math/math/Vector2.d.ts.map +0 -1
  87. package/types/math/math/math/Vector3.d.ts.map +0 -1
  88. package/types/math/math/math/Vector4.d.ts.map +0 -1
  89. /package/types/math/{math/math → core}/Box2.d.ts +0 -0
  90. /package/types/math/{math/math → core}/Color.d.ts +0 -0
  91. /package/types/math/{math/math → core}/ColorManagement.d.ts +0 -0
  92. /package/types/math/{math/math → core}/Cylindrical.d.ts +0 -0
  93. /package/types/math/{math/math → core}/Euler.d.ts +0 -0
  94. /package/types/math/{math/core → core}/Layers.d.ts +0 -0
  95. /package/types/math/{math/math → core}/Line3.d.ts +0 -0
  96. /package/types/math/{math/math → core}/Matrix.d.ts +0 -0
  97. /package/types/math/{math/math → core}/Matrix2.d.ts +0 -0
  98. /package/types/math/{math/math → core}/Matrix3.d.ts +0 -0
  99. /package/types/math/{math/math → core}/Matrix4.d.ts +0 -0
  100. /package/types/math/{math/math → core}/Plane.d.ts +0 -0
  101. /package/types/math/{math/math → core}/Quaternion.d.ts +0 -0
  102. /package/types/math/{math/math → core}/Ray.d.ts +0 -0
  103. /package/types/math/{math/math → core}/Sphere.d.ts +0 -0
  104. /package/types/math/{math/math → core}/Spherical.d.ts +0 -0
  105. /package/types/math/{math/math → core}/SphericalHarmonics3.d.ts +0 -0
  106. /package/types/math/{math/math → core}/Triangle.d.ts +0 -0
  107. /package/types/math/{math/math → core}/Vector.d.ts +0 -0
  108. /package/types/math/{math/math → core}/Vector4.d.ts +0 -0
  109. /package/types/math/{math → core}/constants.d.ts +0 -0
@@ -446,18 +446,20 @@ class ks {
446
446
  constructor() {
447
447
  this.events = {};
448
448
  }
449
- on(t, e) {
450
- return this.events[t] || (this.events[t] = []), this.events[t].push(e), this;
451
- }
452
- addListener(t, e) {
453
- return this.on(t, e), this;
449
+ has(t, e) {
450
+ return this.events[t] !== void 0 && this.events[t].indexOf(e) !== -1;
454
451
  }
455
452
  prependListener(t, e) {
456
453
  return this.events[t] || (this.events[t] = []), this.events[t].unshift(e), this;
457
454
  }
455
+ addListener(t, e) {
456
+ return this.events[t] || (this.events[t] = []), this.events[t].push(e), this;
457
+ }
458
+ on(t, e) {
459
+ return this.addListener(t, e), this;
460
+ }
458
461
  removeListener(t, e) {
459
- if (this.events[t])
460
- return this.events[t] = this.events[t].filter((s) => s !== e), this;
462
+ return this.events[t] && (this.events[t] = this.events[t].filter((s) => s !== e)), this;
461
463
  }
462
464
  off(t, e) {
463
465
  return this.removeListener(t, e), this;
@@ -466,8 +468,8 @@ class ks {
466
468
  return t ? this.events[t] = [] : this.events = {}, this;
467
469
  }
468
470
  emit(t, ...e) {
469
- return this.events[t] && this.events[t].forEach((s) => {
470
- s(...e);
471
+ return this.events[t] && this.events[t].slice(0).forEach((i) => {
472
+ i(...e);
471
473
  }), this;
472
474
  }
473
475
  once(t, e) {
@@ -7865,30 +7867,30 @@ function Hu(n, t) {
7865
7867
  s != "" && n.removeAttribute(s);
7866
7868
  });
7867
7869
  }
7868
- function $u(n) {
7870
+ function $u(n, t) {
7869
7871
  zn(n, "draggable", "true");
7870
- const t = [];
7871
- return t.push(
7872
+ const e = [];
7873
+ return e.push(
7872
7874
  K(
7873
7875
  n,
7874
7876
  "dragstart",
7875
- (e) => {
7876
- ue(e), Ac(e);
7877
- const s = e.dataTransfer;
7878
- s && (s.effectAllowed = "move", s.setData("text/plain", "some-data"));
7877
+ (s) => {
7878
+ ue(s), Ac(s);
7879
+ const i = s.dataTransfer;
7880
+ i && (i.effectAllowed = "move", i.setData("text/plain", "some-data")), t?.onStart?.(s);
7879
7881
  },
7880
7882
  !0
7881
7883
  )
7882
- ), t.push(
7883
- K(n, "drag", (e) => {
7884
- ue(e);
7884
+ ), e.push(
7885
+ K(n, "drag", (s) => {
7886
+ ue(s), t?.onDrag?.(s);
7885
7887
  })
7886
- ), t.push(
7887
- K(n, "dragend", (e) => {
7888
- ue(e);
7888
+ ), e.push(
7889
+ K(n, "dragend", (s) => {
7890
+ ue(s), t?.onEnd?.(s);
7889
7891
  })
7890
7892
  ), () => {
7891
- t.forEach((e) => e());
7893
+ e.forEach((s) => s());
7892
7894
  };
7893
7895
  }
7894
7896
  function Wu(n, t) {
@@ -7901,7 +7903,7 @@ function Wu(n, t) {
7901
7903
  K(n, "dragover", (s) => {
7902
7904
  ue(s);
7903
7905
  const i = s.dataTransfer;
7904
- i && (i.dropEffect = "move");
7906
+ i && (i.dropEffect = "move"), t?.onOver?.(s);
7905
7907
  })
7906
7908
  ), e.push(
7907
7909
  K(n, "dragleave", (s) => {
@@ -7911,7 +7913,11 @@ function Wu(n, t) {
7911
7913
  K(n, "drop", (s) => {
7912
7914
  ue(s);
7913
7915
  const i = s.dataTransfer;
7914
- i && t?.onDrop?.(s, [...i.files]);
7916
+ if (!i) {
7917
+ t?.onDrop?.(s, []);
7918
+ return;
7919
+ }
7920
+ t?.onDrop?.(s, [...i.files]);
7915
7921
  })
7916
7922
  ), () => {
7917
7923
  e.forEach((s) => s());
@@ -11629,7 +11635,7 @@ class sd extends ks {
11629
11635
  }, tt = (D) => {
11630
11636
  this.emit("dragend", D);
11631
11637
  }, kt = (D) => {
11632
- D.dataTransfer, this.emit("drop", D, D.dataTransfer?.files);
11638
+ D.dataTransfer, this.emit("drop", D, D.dataTransfer?.files || null);
11633
11639
  };
11634
11640
  this.container.addEventListener("mousedown", t, !1), this.container.addEventListener("mouseup", e, !1), this.container.addEventListener("mousemove", s, !1), this.container.addEventListener("mouseover", i, !1), this.container.addEventListener("mouseout", r, !1), this.container.addEventListener("mouseenter", o, !1), this.container.addEventListener("mouseleave", a, !1), this.container.addEventListener("click", h, !1), this.container.addEventListener("dblclick", c, !1), this.container.addEventListener("wheel", l, !1), this.container.addEventListener("contextmenu", f, !1), this.container.addEventListener("touchstart", g, !1), this.container.addEventListener("touchend", x, !1), this.container.addEventListener("touchcancel", y, !1), this.container.addEventListener("touchmove", E, !1), this.container.addEventListener("pointerdown", v, !1), this.container.addEventListener("pointerup", b, !1), this.container.addEventListener("pointercancel", w, !1), this.container.addEventListener("pointermove", m, !1), this.hammer.on("pan", p), this.hammer.on("panstart", P), this.hammer.on("panmove", S), this.hammer.on("panend", O), this.hammer.on("pancancel", z), this.hammer.on("panleft", G), this.hammer.on("panright", J), this.hammer.on("panup", Z), this.hammer.on("pandown", it), this.hammer.on("pinch", Tt), this.hammer.on("press", dt), this.hammer.on("rotate", ye), this.hammer.on("swipe", Ht), this.hammer.on("swipeleft", ie), this.hammer.on("swiperight", we), this.hammer.on("swipeup", L), this.hammer.on("swipedown", M), this.hammer.on("tap", F), document.addEventListener("pointerdown", V, !1), this.container instanceof HTMLInputElement && this.container.addEventListener("change", ot, !1), this.container.addEventListener("dragstart", At, !1), this.container.addEventListener("dragover", Ze, !1), this.container.addEventListener("dragenter", Ke, !1), this.container.addEventListener("dragend", tt, !1), this.container.addEventListener("drop", kt, !1);
11635
11641
  const W = () => {
@@ -12578,7 +12584,7 @@ class nd {
12578
12584
  }), this.app.on("tap", () => {
12579
12585
  for (const r of this.shapes)
12580
12586
  if (this.currentMouseInShape == r) {
12581
- r.emit("clicked");
12587
+ r.emit("clicked", r);
12582
12588
  let o = r.parent;
12583
12589
  for (; o; )
12584
12590
  o.emit("clicked", r), o = o.parent;
@@ -15470,7 +15476,7 @@ class am {
15470
15476
  }), this.app.on("tap", () => {
15471
15477
  for (const s of this.shapes)
15472
15478
  if (this.currentMouseInShape == s) {
15473
- s.emit("clicked");
15479
+ s.emit("clicked", s);
15474
15480
  let i = s.parent;
15475
15481
  for (; i; )
15476
15482
  i.emit("clicked", s), i = i.parent;