uiik 1.3.4 → 1.3.5

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/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * uiik v1.3.4
2
+ * uiik v1.3.5
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
@@ -705,7 +705,7 @@ class Splittable extends Uii {
705
705
  con.style.position = "relative";
706
706
  }
707
707
  con.classList.toggle(CLASS_SPLITTABLE, true);
708
- const handleDoms = con.querySelectorAll(this.opts.handle);
708
+ const handleDoms = isString(this.opts.handle) ? con.querySelectorAll(this.opts.handle) : isArray(this.opts.handle) ? this.opts.handle : this.opts.handle ? [this.opts.handle] : [];
709
709
  const children = reject(con.children, c => {
710
710
  if (includes(handleDoms, c))
711
711
  return true;
@@ -747,7 +747,8 @@ class Splittable extends Uii {
747
747
  let domCon = getRootEl(h, con);
748
748
  let domL = domCon.previousElementSibling;
749
749
  let domR = domCon.nextElementSibling;
750
- if (domL && !domL.querySelector(this.opts.handle)) {
750
+ let hasDomLHandle = isString(this.opts.handle) ? domL === null || domL === void 0 ? void 0 : domL.querySelector(this.opts.handle) : domL === null || domL === void 0 ? void 0 : domL.contains(h);
751
+ if (domL && !hasDomLHandle) {
751
752
  dom1 = domL;
752
753
  dom2 = domCon;
753
754
  }
@@ -764,10 +765,16 @@ class Splittable extends Uii {
764
765
  }
765
766
  _Splittable_instances = new WeakSet(), _Splittable_checkDirection = function _Splittable_checkDirection(container) {
766
767
  let dir = 'h';
768
+ let cStyle = window.getComputedStyle(container);
769
+ if (cStyle.display === 'inline-flex')
770
+ return dir;
771
+ if (cStyle.display === 'flex' && cStyle.flexDirection === 'row')
772
+ return dir;
767
773
  const child = container.children[0];
768
774
  let lastY = child.offsetTop;
775
+ let lastH = child.offsetHeight;
769
776
  each(container.children, c => {
770
- if (c.offsetTop != lastY) {
777
+ if (c.offsetTop > lastH + lastY) {
771
778
  dir = 'v';
772
779
  return false;
773
780
  }
@@ -2957,7 +2964,7 @@ function newSortable(container, opts) {
2957
2964
  return new Sortable(container, opts);
2958
2965
  }
2959
2966
 
2960
- var version = "1.3.4";
2967
+ var version = "1.3.5";
2961
2968
  var repository = {
2962
2969
  type: "git",
2963
2970
  url: "https://github.com/holyhigh2/uiik"
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * uiik v1.3.4
2
+ * uiik v1.3.5
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
@@ -702,7 +702,7 @@
702
702
  con.style.position = "relative";
703
703
  }
704
704
  con.classList.toggle(CLASS_SPLITTABLE, true);
705
- const handleDoms = con.querySelectorAll(this.opts.handle);
705
+ const handleDoms = is.isString(this.opts.handle) ? con.querySelectorAll(this.opts.handle) : is.isArray(this.opts.handle) ? this.opts.handle : this.opts.handle ? [this.opts.handle] : [];
706
706
  const children = collection.reject(con.children, c => {
707
707
  if (collection.includes(handleDoms, c))
708
708
  return true;
@@ -744,7 +744,8 @@
744
744
  let domCon = getRootEl(h, con);
745
745
  let domL = domCon.previousElementSibling;
746
746
  let domR = domCon.nextElementSibling;
747
- if (domL && !domL.querySelector(this.opts.handle)) {
747
+ let hasDomLHandle = is.isString(this.opts.handle) ? domL === null || domL === void 0 ? void 0 : domL.querySelector(this.opts.handle) : domL === null || domL === void 0 ? void 0 : domL.contains(h);
748
+ if (domL && !hasDomLHandle) {
748
749
  dom1 = domL;
749
750
  dom2 = domCon;
750
751
  }
@@ -761,10 +762,16 @@
761
762
  }
762
763
  _Splittable_instances = new WeakSet(), _Splittable_checkDirection = function _Splittable_checkDirection(container) {
763
764
  let dir = 'h';
765
+ let cStyle = window.getComputedStyle(container);
766
+ if (cStyle.display === 'inline-flex')
767
+ return dir;
768
+ if (cStyle.display === 'flex' && cStyle.flexDirection === 'row')
769
+ return dir;
764
770
  const child = container.children[0];
765
771
  let lastY = child.offsetTop;
772
+ let lastH = child.offsetHeight;
766
773
  collection.each(container.children, c => {
767
- if (c.offsetTop != lastY) {
774
+ if (c.offsetTop > lastH + lastY) {
768
775
  dir = 'v';
769
776
  return false;
770
777
  }
@@ -2954,7 +2961,7 @@
2954
2961
  return new Sortable(container, opts);
2955
2962
  }
2956
2963
 
2957
- var version = "1.3.4";
2964
+ var version = "1.3.5";
2958
2965
  var repository = {
2959
2966
  type: "git",
2960
2967
  url: "https://github.com/holyhigh2/uiik"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uiik",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
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
@@ -66,7 +66,7 @@ export type SplittableOptions = {
66
66
  ghost?: boolean;
67
67
  ghostClass?: string;
68
68
  ghostTo?: string | HTMLElement;
69
- handle?: string;
69
+ handle?: string | HTMLElement | HTMLElement[];
70
70
  onStart?: (data: {
71
71
  size1: number;
72
72
  size2: number;