uiik 1.3.5 → 1.3.6

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/detector.d.ts CHANGED
@@ -12,4 +12,4 @@ export declare class CollisionDetector {
12
12
  getInclusions(): Array<HTMLElement>;
13
13
  getInclusions(x1: number, y1: number, x2: number, y2: number): Array<HTMLElement>;
14
14
  }
15
- export declare function newCollisionDetector(el: string | HTMLElement, targets: (() => Array<HTMLElement>) | string | HTMLElement | Array<HTMLElement> | NodeList | HTMLCollection, opts?: CollisionDetectorOptions): CollisionDetector;
15
+ export declare function newCollisionDetector(el: string | HTMLElement, targets: (() => Array<HTMLElement>) | string | HTMLElement | Array<HTMLElement> | NodeList | HTMLCollection | NodeListOf<Element>, opts?: CollisionDetectorOptions): CollisionDetector;
package/draggable.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { DraggableOptions, Uii } from "./types";
2
2
  export declare class Draggable extends Uii {
3
3
  #private;
4
- constructor(els: string | HTMLElement | Array<string | HTMLElement>, opts?: DraggableOptions);
4
+ constructor(els: string | HTMLElement | Array<string | HTMLElement> | NodeListOf<Element>, opts?: DraggableOptions);
5
5
  bindEvent(bindTarget: Element, opts: DraggableOptions, handleMap: WeakMap<Element, Element>): void;
6
6
  onOptionChanged(opts: Record<string, any>): void;
7
7
  }
8
- export declare function newDraggable(els: string | HTMLElement | Array<string | HTMLElement>, opts?: DraggableOptions): Draggable;
8
+ export declare function newDraggable(els: string | HTMLElement | Array<string | HTMLElement> | NodeListOf<Element>, opts?: DraggableOptions): Draggable;
package/droppable.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { DroppableOptions, Uii } from "./types";
2
2
  export declare class Droppable extends Uii {
3
3
  #private;
4
- constructor(el: string | HTMLElement | Array<string | HTMLElement>, opts?: DroppableOptions);
4
+ constructor(el: string | HTMLElement | Array<string | HTMLElement> | NodeListOf<Element>, opts?: DroppableOptions);
5
5
  bindEvent(droppable: HTMLElement, opts: DroppableOptions): void;
6
6
  active(target: HTMLElement): void;
7
7
  deactive(target: HTMLElement): void;
8
8
  }
9
- export declare function newDroppable(els: string | HTMLElement | Array<string | HTMLElement>, opts?: DroppableOptions): Droppable;
9
+ export declare function newDroppable(els: string | HTMLElement | Array<string | HTMLElement> | NodeListOf<Element>, opts?: DroppableOptions): Droppable;
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * uiik v1.3.5
2
+ * uiik v1.3.6
3
3
  * A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
4
4
  * https://github.com/holyhigh2/uiik
5
5
  * c) 2021-2025 @holyhigh2 may be freely distributed under the MIT license
@@ -1779,7 +1779,7 @@ class Draggable extends Uii {
1779
1779
  let ghostParent = ghostTo ? (isString(ghostTo) ? document.querySelector(ghostTo) : ghostTo) : dragDom.parentNode;
1780
1780
  ghostParent === null || ghostParent === void 0 ? void 0 : ghostParent.appendChild(ghostNode);
1781
1781
  transform = wrapper(ghostNode, opts.useTransform);
1782
- onClone && onClone({ clone: ghostNode }, ev);
1782
+ onClone && onClone({ clone: ghostNode, draggable: dragDom }, ev);
1783
1783
  }
1784
1784
  else {
1785
1785
  transform = wrapper(dragDom, opts.useTransform);
@@ -1790,9 +1790,11 @@ class Draggable extends Uii {
1790
1790
  dragDom.classList.toggle(CLASS_DRAGGABLE_ACTIVE, true);
1791
1791
  onStart &&
1792
1792
  onStart({ draggable: dragDom, x: startPointXy.x, y: startPointXy.y, transform }, ev);
1793
- const customEv = new Event("uii-dragactive", {
1793
+ const customEv = new CustomEvent("uii-dragactive", {
1794
1794
  bubbles: true,
1795
+ composed: true,
1795
1796
  cancelable: false,
1797
+ detail: { target: dragDom }
1796
1798
  });
1797
1799
  dragDom.dispatchEvent(customEv);
1798
1800
  });
@@ -1987,9 +1989,13 @@ class Draggable extends Uii {
1987
1989
  ? false
1988
1990
  : true;
1989
1991
  }
1990
- const customEv = new Event("uii-dragdeactive", {
1992
+ const customEv = new CustomEvent("uii-dragdeactive", {
1991
1993
  bubbles: true,
1994
+ composed: true,
1992
1995
  cancelable: false,
1996
+ detail: {
1997
+ target: dragDom
1998
+ }
1993
1999
  });
1994
2000
  dragDom.dispatchEvent(customEv);
1995
2001
  if (ghost) {
@@ -2152,13 +2158,15 @@ class Droppable extends Uii {
2152
2158
  }
2153
2159
  _Droppable_active = new WeakMap();
2154
2160
  document.addEventListener("uii-dragactive", (e) => {
2161
+ let { target } = e.detail;
2155
2162
  each(Droppables, dpb => {
2156
- dpb.active(e.target);
2163
+ dpb.active(target);
2157
2164
  });
2158
2165
  });
2159
2166
  document.addEventListener("uii-dragdeactive", (e) => {
2167
+ let { target } = e.detail;
2160
2168
  each(Droppables, dpb => {
2161
- dpb.deactive(e.target);
2169
+ dpb.deactive(target);
2162
2170
  });
2163
2171
  });
2164
2172
  function newDroppable(els, opts) {
@@ -2964,7 +2972,7 @@ function newSortable(container, opts) {
2964
2972
  return new Sortable(container, opts);
2965
2973
  }
2966
2974
 
2967
- var version = "1.3.5";
2975
+ var version = "1.3.6";
2968
2976
  var repository = {
2969
2977
  type: "git",
2970
2978
  url: "https://github.com/holyhigh2/uiik"
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * uiik v1.3.5
2
+ * uiik v1.3.6
3
3
  * A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
4
4
  * https://github.com/holyhigh2/uiik
5
5
  * c) 2021-2025 @holyhigh2 may be freely distributed under the MIT license
@@ -1776,7 +1776,7 @@
1776
1776
  let ghostParent = ghostTo ? (is.isString(ghostTo) ? document.querySelector(ghostTo) : ghostTo) : dragDom.parentNode;
1777
1777
  ghostParent === null || ghostParent === void 0 ? void 0 : ghostParent.appendChild(ghostNode);
1778
1778
  transform = wrapper(ghostNode, opts.useTransform);
1779
- onClone && onClone({ clone: ghostNode }, ev);
1779
+ onClone && onClone({ clone: ghostNode, draggable: dragDom }, ev);
1780
1780
  }
1781
1781
  else {
1782
1782
  transform = wrapper(dragDom, opts.useTransform);
@@ -1787,9 +1787,11 @@
1787
1787
  dragDom.classList.toggle(CLASS_DRAGGABLE_ACTIVE, true);
1788
1788
  onStart &&
1789
1789
  onStart({ draggable: dragDom, x: startPointXy.x, y: startPointXy.y, transform }, ev);
1790
- const customEv = new Event("uii-dragactive", {
1790
+ const customEv = new CustomEvent("uii-dragactive", {
1791
1791
  bubbles: true,
1792
+ composed: true,
1792
1793
  cancelable: false,
1794
+ detail: { target: dragDom }
1793
1795
  });
1794
1796
  dragDom.dispatchEvent(customEv);
1795
1797
  });
@@ -1984,9 +1986,13 @@
1984
1986
  ? false
1985
1987
  : true;
1986
1988
  }
1987
- const customEv = new Event("uii-dragdeactive", {
1989
+ const customEv = new CustomEvent("uii-dragdeactive", {
1988
1990
  bubbles: true,
1991
+ composed: true,
1989
1992
  cancelable: false,
1993
+ detail: {
1994
+ target: dragDom
1995
+ }
1990
1996
  });
1991
1997
  dragDom.dispatchEvent(customEv);
1992
1998
  if (ghost) {
@@ -2149,13 +2155,15 @@
2149
2155
  }
2150
2156
  _Droppable_active = new WeakMap();
2151
2157
  document.addEventListener("uii-dragactive", (e) => {
2158
+ let { target } = e.detail;
2152
2159
  collection.each(Droppables, dpb => {
2153
- dpb.active(e.target);
2160
+ dpb.active(target);
2154
2161
  });
2155
2162
  });
2156
2163
  document.addEventListener("uii-dragdeactive", (e) => {
2164
+ let { target } = e.detail;
2157
2165
  collection.each(Droppables, dpb => {
2158
- dpb.deactive(e.target);
2166
+ dpb.deactive(target);
2159
2167
  });
2160
2168
  });
2161
2169
  function newDroppable(els, opts) {
@@ -2961,7 +2969,7 @@
2961
2969
  return new Sortable(container, opts);
2962
2970
  }
2963
2971
 
2964
- var version = "1.3.5";
2972
+ var version = "1.3.6";
2965
2973
  var repository = {
2966
2974
  type: "git",
2967
2975
  url: "https://github.com/holyhigh2/uiik"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uiik",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",
package/types.d.ts CHANGED
@@ -143,6 +143,7 @@ export type DraggableOptions = {
143
143
  }, event: MouseEvent) => boolean | void;
144
144
  onClone?: (data: {
145
145
  clone: HTMLElement | SVGGraphicsElement;
146
+ draggable: HTMLElement | SVGGraphicsElement;
146
147
  }, event: MouseEvent) => void;
147
148
  onSnap?: (data: {
148
149
  el: HTMLElement | SVGGraphicsElement;