uiik 1.3.2 → 1.3.3
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 +22 -9
- package/index.js +24 -10
- package/package.json +2 -2
- package/utils.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* uiik v1.3.
|
|
2
|
+
* uiik v1.3.3
|
|
3
3
|
* A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
|
|
4
4
|
* https://github.com/holyhigh2/uiik
|
|
5
|
-
* c) 2021-
|
|
5
|
+
* c) 2021-2025 @holyhigh2 may be freely distributed under the MIT license
|
|
6
6
|
*/
|
|
7
|
-
import { isDefined, isNumber, isNaN, isString, isArrayLike, isElement, isEmpty, isArray, isFunction, isBoolean, isUndefined } from 'myfx/is';
|
|
8
7
|
import { find, map, toArray, each, reject, includes, some, flatMap, size } from 'myfx/collection';
|
|
8
|
+
import { isDefined, isNumber, isNaN, isString, isArrayLike, isElement, isEmpty, isBlank, isArray, isFunction, isBoolean, isUndefined } from 'myfx/is';
|
|
9
9
|
import { get, assign, merge } from 'myfx/object';
|
|
10
|
-
import { split, test } from 'myfx/string';
|
|
11
10
|
import { compact, findIndex } from 'myfx/array';
|
|
11
|
+
import { split, test } from 'myfx/string';
|
|
12
12
|
import { closest } from 'myfx/tree';
|
|
13
13
|
import { alphaId } from 'myfx/utils';
|
|
14
14
|
|
|
@@ -486,6 +486,13 @@ function parseOxy(ox, oy, w, h, el) {
|
|
|
486
486
|
function normalizeVector(x, y) {
|
|
487
487
|
let len = Math.sqrt(x * x + y * y);
|
|
488
488
|
return { x: x / len, y: y / len };
|
|
489
|
+
}
|
|
490
|
+
function isVisible(el) {
|
|
491
|
+
let rect = el.getBoundingClientRect();
|
|
492
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
489
496
|
}
|
|
490
497
|
|
|
491
498
|
var _Uii_listeners;
|
|
@@ -693,7 +700,7 @@ class Splittable extends Uii {
|
|
|
693
700
|
_Splittable_instances.add(this);
|
|
694
701
|
each(this.ele, con => {
|
|
695
702
|
const pos = window.getComputedStyle(con).position;
|
|
696
|
-
if (pos === "static") {
|
|
703
|
+
if (pos === "static" || isBlank(pos)) {
|
|
697
704
|
con.style.position = "relative";
|
|
698
705
|
}
|
|
699
706
|
con.classList.toggle(CLASS_SPLITTABLE, true);
|
|
@@ -766,7 +773,7 @@ _Splittable_instances = new WeakSet(), _Splittable_checkDirection = function _Sp
|
|
|
766
773
|
});
|
|
767
774
|
return dir;
|
|
768
775
|
}, _Splittable_bindHandle = function _Splittable_bindHandle(minSizeAry, stickyAry, opts, dir, dom1, dom2, handle) {
|
|
769
|
-
var _a;
|
|
776
|
+
var _a, _b;
|
|
770
777
|
const handleSize = opts.handleSize;
|
|
771
778
|
if (!handle) {
|
|
772
779
|
handle = document.createElement('div');
|
|
@@ -774,6 +781,12 @@ _Splittable_instances = new WeakSet(), _Splittable_checkDirection = function _Sp
|
|
|
774
781
|
if (!opts.inside) {
|
|
775
782
|
initPos = (dir === 'v' ? dom2.offsetTop : dom2.offsetLeft);
|
|
776
783
|
}
|
|
784
|
+
if (!isVisible(dom2)) {
|
|
785
|
+
(_a = dom2.parentElement) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', () => {
|
|
786
|
+
initPos = (dir === 'v' ? dom2.offsetTop : dom2.offsetLeft);
|
|
787
|
+
handle.style.left = initPos - handleSize / 2 + 'px';
|
|
788
|
+
}, { once: true });
|
|
789
|
+
}
|
|
777
790
|
const sensorHCss = `width:${handleSize}px;height:100%;top:0;left:${initPos - handleSize / 2}px;z-index:9;`;
|
|
778
791
|
const sensorVCss = `height:${handleSize}px;width:100%;left:0;top:${initPos - handleSize / 2}px;z-index:9;`;
|
|
779
792
|
handle.style.cssText =
|
|
@@ -781,7 +794,7 @@ _Splittable_instances = new WeakSet(), _Splittable_checkDirection = function _Sp
|
|
|
781
794
|
if (opts.inside) {
|
|
782
795
|
dom2.appendChild(handle);
|
|
783
796
|
}
|
|
784
|
-
(
|
|
797
|
+
(_b = dom2.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(handle, dom2);
|
|
785
798
|
}
|
|
786
799
|
handle.style.cursor = dir === 'v' ? 's-resize' : 'e-resize';
|
|
787
800
|
handle.dataset.cursor = handle.style.cursor;
|
|
@@ -2934,7 +2947,7 @@ function newSortable(container, opts) {
|
|
|
2934
2947
|
return new Sortable(container, opts);
|
|
2935
2948
|
}
|
|
2936
2949
|
|
|
2937
|
-
var version = "1.3.
|
|
2950
|
+
var version = "1.3.3";
|
|
2938
2951
|
var repository = {
|
|
2939
2952
|
type: "git",
|
|
2940
2953
|
url: "https://github.com/holyhigh2/uiik"
|
|
@@ -2967,4 +2980,4 @@ var index = {
|
|
|
2967
2980
|
newSortable
|
|
2968
2981
|
};
|
|
2969
2982
|
|
|
2970
|
-
export { CollisionDetector, DRAGGING_RULE, Draggable, Droppable, EDGE_THRESHOLD, ONE_ANG, ONE_RAD, Resizable, Rotatable, Selectable, Sortable, Splittable, THRESHOLD, Uii, UiiTransform, VERSION, calcVertex, index as default, getBox, getCenterXy, getCenterXySVG, getMatrixInfo, getPointInContainer, getPointOffset, getRectCenter, getRectInContainer, getStyleSize, getStyleXy, getTranslate, getVertex, isSVGEl, lockPage, moveBy, moveTo, newCollisionDetector, newDraggable, newDroppable, newResizable, newRotatable, newSelectable, newSortable, newSplittable, normalizeVector, parseOxy, restoreCursor, rotateTo, saveCursor, setCursor, transformMoveTo, unlockPage, wrapper };
|
|
2983
|
+
export { CollisionDetector, DRAGGING_RULE, Draggable, Droppable, EDGE_THRESHOLD, ONE_ANG, ONE_RAD, Resizable, Rotatable, Selectable, Sortable, Splittable, THRESHOLD, Uii, UiiTransform, VERSION, calcVertex, index as default, getBox, getCenterXy, getCenterXySVG, getMatrixInfo, getPointInContainer, getPointOffset, getRectCenter, getRectInContainer, getStyleSize, getStyleXy, getTranslate, getVertex, isSVGEl, isVisible, lockPage, moveBy, moveTo, newCollisionDetector, newDraggable, newDroppable, newResizable, newRotatable, newSelectable, newSortable, newSplittable, normalizeVector, parseOxy, restoreCursor, rotateTo, saveCursor, setCursor, transformMoveTo, unlockPage, wrapper };
|
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* uiik v1.3.
|
|
2
|
+
* uiik v1.3.3
|
|
3
3
|
* A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
|
|
4
4
|
* https://github.com/holyhigh2/uiik
|
|
5
|
-
* c) 2021-
|
|
5
|
+
* c) 2021-2025 @holyhigh2 may be freely distributed under the MIT license
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
8
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('myfx/
|
|
9
|
-
typeof define === 'function' && define.amd ? define(['exports', 'myfx/
|
|
10
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.
|
|
11
|
-
})(this, (function (exports,
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('myfx/collection'), require('myfx/is'), require('myfx/object'), require('myfx/array'), require('myfx/string'), require('myfx/tree'), require('myfx/utils')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', 'myfx/collection', 'myfx/is', 'myfx/object', 'myfx/array', 'myfx/string', 'myfx/tree', 'myfx/utils'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.collection, global.is, global.object, global.array, global.string, global.tree, global.utils));
|
|
11
|
+
})(this, (function (exports, collection, is, object, array, string, tree, utils) { 'use strict';
|
|
12
12
|
|
|
13
13
|
/******************************************************************************
|
|
14
14
|
Copyright (c) Microsoft Corporation.
|
|
@@ -484,6 +484,13 @@
|
|
|
484
484
|
function normalizeVector(x, y) {
|
|
485
485
|
let len = Math.sqrt(x * x + y * y);
|
|
486
486
|
return { x: x / len, y: y / len };
|
|
487
|
+
}
|
|
488
|
+
function isVisible(el) {
|
|
489
|
+
let rect = el.getBoundingClientRect();
|
|
490
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
return true;
|
|
487
494
|
}
|
|
488
495
|
|
|
489
496
|
var _Uii_listeners;
|
|
@@ -691,7 +698,7 @@
|
|
|
691
698
|
_Splittable_instances.add(this);
|
|
692
699
|
collection.each(this.ele, con => {
|
|
693
700
|
const pos = window.getComputedStyle(con).position;
|
|
694
|
-
if (pos === "static") {
|
|
701
|
+
if (pos === "static" || is.isBlank(pos)) {
|
|
695
702
|
con.style.position = "relative";
|
|
696
703
|
}
|
|
697
704
|
con.classList.toggle(CLASS_SPLITTABLE, true);
|
|
@@ -764,7 +771,7 @@
|
|
|
764
771
|
});
|
|
765
772
|
return dir;
|
|
766
773
|
}, _Splittable_bindHandle = function _Splittable_bindHandle(minSizeAry, stickyAry, opts, dir, dom1, dom2, handle) {
|
|
767
|
-
var _a;
|
|
774
|
+
var _a, _b;
|
|
768
775
|
const handleSize = opts.handleSize;
|
|
769
776
|
if (!handle) {
|
|
770
777
|
handle = document.createElement('div');
|
|
@@ -772,6 +779,12 @@
|
|
|
772
779
|
if (!opts.inside) {
|
|
773
780
|
initPos = (dir === 'v' ? dom2.offsetTop : dom2.offsetLeft);
|
|
774
781
|
}
|
|
782
|
+
if (!isVisible(dom2)) {
|
|
783
|
+
(_a = dom2.parentElement) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', () => {
|
|
784
|
+
initPos = (dir === 'v' ? dom2.offsetTop : dom2.offsetLeft);
|
|
785
|
+
handle.style.left = initPos - handleSize / 2 + 'px';
|
|
786
|
+
}, { once: true });
|
|
787
|
+
}
|
|
775
788
|
const sensorHCss = `width:${handleSize}px;height:100%;top:0;left:${initPos - handleSize / 2}px;z-index:9;`;
|
|
776
789
|
const sensorVCss = `height:${handleSize}px;width:100%;left:0;top:${initPos - handleSize / 2}px;z-index:9;`;
|
|
777
790
|
handle.style.cssText =
|
|
@@ -779,7 +792,7 @@
|
|
|
779
792
|
if (opts.inside) {
|
|
780
793
|
dom2.appendChild(handle);
|
|
781
794
|
}
|
|
782
|
-
(
|
|
795
|
+
(_b = dom2.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(handle, dom2);
|
|
783
796
|
}
|
|
784
797
|
handle.style.cursor = dir === 'v' ? 's-resize' : 'e-resize';
|
|
785
798
|
handle.dataset.cursor = handle.style.cursor;
|
|
@@ -2932,7 +2945,7 @@
|
|
|
2932
2945
|
return new Sortable(container, opts);
|
|
2933
2946
|
}
|
|
2934
2947
|
|
|
2935
|
-
var version = "1.3.
|
|
2948
|
+
var version = "1.3.3";
|
|
2936
2949
|
var repository = {
|
|
2937
2950
|
type: "git",
|
|
2938
2951
|
url: "https://github.com/holyhigh2/uiik"
|
|
@@ -2996,6 +3009,7 @@
|
|
|
2996
3009
|
exports.getTranslate = getTranslate;
|
|
2997
3010
|
exports.getVertex = getVertex;
|
|
2998
3011
|
exports.isSVGEl = isSVGEl;
|
|
3012
|
+
exports.isVisible = isVisible;
|
|
2999
3013
|
exports.lockPage = lockPage;
|
|
3000
3014
|
exports.moveBy = moveBy;
|
|
3001
3015
|
exports.moveTo = moveTo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uiik",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"doc": "npx typedoc"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"myfx":">=1.1.0"
|
|
35
|
+
"myfx": ">=1.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/core": "^7.12.3",
|
package/utils.d.ts
CHANGED