Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pluginjs/utils

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pluginjs/utils - npm Package Compare versions

Comparing version 0.2.11 to 0.2.13

170

dist/utils.esm.js

@@ -1,128 +0,1 @@

var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var _extends = Object.assign || function (target) {

@@ -142,14 +15,2 @@ for (var i = 1; i < arguments.length; i++) {

var objectWithoutProperties = function (obj, keys) {

@@ -167,3 +28,3 @@ var target = {};

function fromPairs$1(arr) {
function fromPairs(arr) {
return arr.reduce((r, [k, v]) => _extends({}, r, {

@@ -174,3 +35,3 @@ [k]: v

function mergeWith$1(...args) {
function mergeWith(...args) {
const objs = args.slice(0, -1);

@@ -267,4 +128,3 @@ const customizer = args[args.length - 1];

function filterOffset(obj) {
const { offset } = obj,
result = objectWithoutProperties(obj, ['offset']);
const result = objectWithoutProperties(obj, ['offset']);
return result;

@@ -274,3 +134,3 @@ }

function filterEmptyValues(obj) {
return fromPairs$1(Object.entries(obj).filter(([, v]) => {
return fromPairs(Object.entries(obj).filter(([, v]) => {
const arr = v.filter(i => Boolean(i));

@@ -324,3 +184,3 @@ if (arr.length) {

});
const emptyTransform = fromPairs$1(Array.from(transformKeys).map(key => {
const emptyTransform = fromPairs(Array.from(transformKeys).map(key => {
if (/scale/g.test(key)) {

@@ -336,3 +196,3 @@ return [key, 1];

}
const data = mergeWith$1(...newKeyFrames, customizer);
const data = mergeWith(...newKeyFrames, customizer);
const result = filterOffset(filterEmptyValues(data));

@@ -351,3 +211,3 @@ return result;

}
function isPaintObject(data) {
function isPlainObject(data) {
if (typeof data !== 'object') {

@@ -372,7 +232,7 @@ return false;

function deepMergeTwo(x, y) {
if (isPaintObject(y) && isPaintObject(x) || isPaintObject(x) && Array.isArray(y)) {
return fromPairs(nub(Object.keys(x).concat(Object.keys(y))).map(key => [key, deepMergeTwo(x[key], y[key])]));
if (isPlainObject(y) && isPlainObject(x) || isPlainObject(x) && Array.isArray(y)) {
return fromPairs$1(nub(Object.keys(x).concat(Object.keys(y))).map(key => [key, deepMergeTwo(x[key], y[key])]));
}
if (isPaintObject(y) && typeof x === 'function') {
if (isPlainObject(y) && typeof x === 'function') {
return Object.assign(function (...args) {

@@ -383,7 +243,7 @@ return x.apply(this, args);

if (isPaintObject(y) && Array.isArray(x)) {
if (isPlainObject(y) && Array.isArray(x)) {
return Object.assign([], x, y);
}
if (isPaintObject(x) && typeof y === 'function') {
if (isPlainObject(x) && typeof y === 'function') {
return Object.assign(function (...args) {

@@ -605,3 +465,3 @@ return y.apply(this, args);

function fromPairs(arr) {
function fromPairs$1(arr) {
return arr.reduce((r, [k, v]) => _extends({}, r, {

@@ -611,3 +471,3 @@ [k]: v

}
function mergeWith(obj1, obj2, customizer) {
function mergeWith$1(obj1, obj2, customizer) {
return Object.entries(obj1).reduce((r, [k, v]) => _extends({}, r, {

@@ -618,2 +478,2 @@ [k]: customizer(v, obj2[k])

export { deepClone, nub, deepMerge, curry, compose, getUID, range, reflow, arraysEqual, arrayDiff, arrayIntersect, convertPercentageToFloat, convertFloatToPercentage, convertMatrixToArray, getTime, camelize, getValueByPath, throttle, debounce, fromPairs, mergeWith, mapKeyFramesToAnime as keyframes2Anime };
export { deepClone, nub, isPlainObject, deepMerge, curry, compose, getUID, range, reflow, arraysEqual, arrayDiff, arrayIntersect, convertPercentageToFloat, convertFloatToPercentage, convertMatrixToArray, getTime, camelize, getValueByPath, throttle, debounce, fromPairs$1 as fromPairs, mergeWith$1 as mergeWith, mapKeyFramesToAnime as keyframes2Anime };

1230

dist/utils.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global['@pluginjs/utils'] = {})));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global['@pluginjs/utils'] = {})));
}(this, (function (exports) { 'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
return target;
};
function AsyncGenerator(gen) {
var front, back;
var objectWithoutProperties = function (obj, keys) {
var target = {};
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
function resume(key, arg) {
return target;
};
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
var result = gen[key](arg);
var value = result.value;
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
if (i && _arr.length === i) break;
}
} catch (err) {
settle("throw", err);
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
back = null;
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
}
};
}();
this._invoke = send;
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
if (typeof gen.return !== "function") {
this.return = undefined;
return arr2;
} else {
return Array.from(arr);
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
function fromPairs(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
function mergeWith() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
};
}();
var objs = args.slice(0, -1);
var customizer = args[args.length - 1];
return Object.entries(args[0]).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 1),
k = _ref4[0];
return _extends({}, r, defineProperty({}, k, objs.map(function (obj) {
return obj[k];
}).filter(function (v) {
return Boolean(v) || v === 0;
}).reduce(function (r, i) {
return customizer(r, i);
})));
}, {});
}
var T = {
0: 'X',
1: 'Y',
2: 'Z'
};
function mapTransformToAnime(str) {
var css3dList = ['translate', 'rotate', 'scale'];
return css3dList.filter(function (key) {
var regx = new RegExp(key, 'g');
if (str.match(regx)) {
return true;
}
return false;
}).reduce(function (initialState, key) {
var matrix = str.match(/\(([^()]+)\)/)[1].split(',');
var map = mapMatch(key);
return map(matrix);
}, {});
}
function mapMatch(type) {
switch (type) {
case 'translate':
return mapToTranslate;
case 'rotate':
return mapToRotate;
case 'scale':
return mapToScale;
default:
return function () {
return 'no match!';
};
}
}
function mapToScale(matrix) {
// console.group('scale')
var result = matrix.map(function (value, index) {
var n = parseFloat(value, 10);
var result = defineProperty({}, 'scale' + T[index], n || 0);
// console.log(result)
return result;
});
return result.reduce(mergeObject);
}
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
function mapToTranslate(matrix) {
var result = matrix.map(function (value, index) {
var n = parseFloat(value.slice(0, -2), 10);
var result = defineProperty({}, 'translate' + T[index], n || 0);
return result;
});
} else {
obj[key] = value;
return result.reduce(mergeObject);
}
return obj;
};
function mapToRotate(matrix) {
var value = matrix[matrix.length - 1].slice(0, -3);
var transformType = matrix.slice(0, -1).map(function (n, index) {
if (parseInt(n, 10)) {
return 'rotate' + T[index];
}
return n;
}).filter(isNotEmpty);
return defineProperty({}, transformType[0], parseFloat(value));
}
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function mergeObject(r, i) {
return _extends({}, r, i);
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
function customizer(objValue, srcValue) {
if (Array.isArray(objValue)) {
return objValue.concat(srcValue);
}
return [objValue, srcValue];
}
return target;
};
function isNotEmpty(value) {
if (value) {
return true;
}
return false;
}
function filterOffset(obj) {
var offset = obj.offset,
result = objectWithoutProperties(obj, ['offset']);
return result;
}
function filterEmptyValues(obj) {
return fromPairs(Object.entries(obj).filter(function (_ref6) {
var _ref7 = slicedToArray(_ref6, 2),
v = _ref7[1];
var arr = v.filter(function (i) {
return Boolean(i);
});
if (arr.length) {
return true;
}
return false;
}).map(function (_ref8) {
var _ref9 = slicedToArray(_ref8, 2),
k = _ref9[0],
v = _ref9[1];
var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
var value = v.map(function (i) {
if (i === undefined) {
if (/scale/g.test(k)) {
return 1;
}
return 0;
}
return i;
});
return [k, value];
}));
}
return target;
};
function mapKeyFramesToAnime(keyframes) {
var transformNoneIndex = [];
var transformKeys = new Set();
var newKeyFrames = keyframes.map(function (keyframe, keyframeIndex) {
var transform = keyframe.transform,
newKeyFrame = objectWithoutProperties(keyframe, ['transform']);
if (transform) {
var arr = transform.split(') ').map(function (item, index, arr) {
if (index !== arr.length - 1) {
return item + ')';
}
return item;
}).map(function (value) {
if (/3d/g.test(value)) {
var transformObject = mapTransformToAnime(value);
Object.keys(transformObject).map(function (key) {
return transformKeys.add(key);
});
return transformObject;
}
return value;
}).filter(function (value) {
return typeof value !== 'string';
});
// console.log(arr)
if (!arr.length) {
transformNoneIndex.push(keyframeIndex);
return newKeyFrame;
}
return Object.assign.apply(Object, [{}, newKeyFrame].concat(toConsumableArray(arr)));
}
return newKeyFrame;
});
var emptyTransform = fromPairs(Array.from(transformKeys).map(function (key) {
if (/scale/g.test(key)) {
return [key, 1];
}
return [key, 0];
}));
if (transformNoneIndex.length) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = transformNoneIndex[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var index = _step.value;
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
Object.assign(newKeyFrames[index], emptyTransform);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
if (_d) throw _e;
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
return _arr;
var data = mergeWith.apply(undefined, toConsumableArray(newKeyFrames).concat([customizer]));
var result = filterOffset(filterEmptyValues(data));
return result;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
var deepClone = function deepClone(obj) {
if (typeof obj === 'function') {
return obj;
}
return JSON.parse(JSON.stringify(obj));
};
}();
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
function nub(arr) {
return Array.from(new Set(arr));
}
};
function isPlainObject(data) {
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') {
return false;
}
function fromPairs$1(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
if (data === null) {
return false;
}
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
function mergeWith$1() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var objs = args.slice(0, -1);
var customizer = args[args.length - 1];
return Object.entries(args[0]).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 1),
k = _ref4[0];
return _extends({}, r, defineProperty({}, k, objs.map(function (obj) {
return obj[k];
}).filter(function (v) {
return Boolean(v) || v === 0;
}).reduce(function (r, i) {
return customizer(r, i);
})));
}, {});
}
var T = {
0: 'X',
1: 'Y',
2: 'Z'
};
function mapTransformToAnime(str) {
var css3dList = ['translate', 'rotate', 'scale'];
return css3dList.filter(function (key) {
var regx = new RegExp(key, 'g');
if (str.match(regx)) {
return true;
if (data instanceof Set || data instanceof Map) {
return false;
}
return false;
}).reduce(function (initialState, key) {
var matrix = str.match(/\(([^()]+)\)/)[1].split(',');
var map = mapMatch(key);
return map(matrix);
}, {});
}
function mapMatch(type) {
switch (type) {
case 'translate':
return mapToTranslate;
case 'rotate':
return mapToRotate;
case 'scale':
return mapToScale;
default:
return function () {
return 'no match!';
};
}
}
function mapToScale(matrix) {
// console.group('scale')
var result = matrix.map(function (value, index) {
var n = parseFloat(value, 10);
var result = defineProperty({}, 'scale' + T[index], n || 0);
// console.log(result)
return result;
});
return result.reduce(mergeObject);
}
function mapToTranslate(matrix) {
var result = matrix.map(function (value, index) {
var n = parseFloat(value.slice(0, -2), 10);
var result = defineProperty({}, 'translate' + T[index], n || 0);
return result;
});
return result.reduce(mergeObject);
}
function mapToRotate(matrix) {
var value = matrix[matrix.length - 1].slice(0, -3);
var transformType = matrix.slice(0, -1).map(function (n, index) {
if (parseInt(n, 10)) {
return 'rotate' + T[index];
if (Array.isArray(data)) {
return false;
}
return n;
}).filter(isNotEmpty);
return defineProperty({}, transformType[0], parseFloat(value));
}
function mergeObject(r, i) {
return _extends({}, r, i);
}
function customizer(objValue, srcValue) {
if (Array.isArray(objValue)) {
return objValue.concat(srcValue);
}
return [objValue, srcValue];
}
function isNotEmpty(value) {
if (value) {
return true;
}
return false;
}
function deepMergeTwo(x, y) {
if (isPlainObject(y) && isPlainObject(x) || isPlainObject(x) && Array.isArray(y)) {
return fromPairs$1(nub(Object.keys(x).concat(Object.keys(y))).map(function (key) {
return [key, deepMergeTwo(x[key], y[key])];
}));
}
function filterOffset(obj) {
var offset = obj.offset,
result = objectWithoutProperties(obj, ['offset']);
if (isPlainObject(y) && typeof x === 'function') {
return Object.assign(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return result;
}
return x.apply(this, args);
}, y);
}
function filterEmptyValues(obj) {
return fromPairs$1(Object.entries(obj).filter(function (_ref6) {
var _ref7 = slicedToArray(_ref6, 2),
v = _ref7[1];
var arr = v.filter(function (i) {
return Boolean(i);
});
if (arr.length) {
return true;
if (isPlainObject(y) && Array.isArray(x)) {
return Object.assign([], x, y);
}
return false;
}).map(function (_ref8) {
var _ref9 = slicedToArray(_ref8, 2),
k = _ref9[0],
v = _ref9[1];
var value = v.map(function (i) {
if (i === undefined) {
if (/scale/g.test(k)) {
return 1;
if (isPlainObject(x) && typeof y === 'function') {
return Object.assign(function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return 0;
}
return i;
});
return [k, value];
}));
}
function mapKeyFramesToAnime(keyframes) {
var transformNoneIndex = [];
var transformKeys = new Set();
var newKeyFrames = keyframes.map(function (keyframe, keyframeIndex) {
var transform = keyframe.transform,
newKeyFrame = objectWithoutProperties(keyframe, ['transform']);
return y.apply(this, args);
}, x);
}
if (transform) {
var arr = transform.split(') ').map(function (item, index, arr) {
if (index !== arr.length - 1) {
return item + ')';
}
return item;
}).map(function (value) {
if (/3d/g.test(value)) {
var transformObject = mapTransformToAnime(value);
Object.keys(transformObject).map(function (key) {
return transformKeys.add(key);
});
return transformObject;
}
return value;
}).filter(function (value) {
return typeof value !== 'string';
if (Array.isArray(y) && Array.isArray(x)) {
// return x.concat(y)
return nub(Object.keys(y).concat(Object.keys(x))).map(function (index) {
return deepMergeTwo(x[index], y[index]);
});
// console.log(arr)
if (!arr.length) {
transformNoneIndex.push(keyframeIndex);
return newKeyFrame;
}
return Object.assign.apply(Object, [{}, newKeyFrame].concat(toConsumableArray(arr)));
}
return newKeyFrame;
});
var emptyTransform = fromPairs$1(Array.from(transformKeys).map(function (key) {
if (/scale/g.test(key)) {
return [key, 1];
}
return [key, 0];
}));
if (transformNoneIndex.length) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = transformNoneIndex[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var index = _step.value;
Object.assign(newKeyFrames[index], emptyTransform);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
if (typeof y === 'undefined') {
return x;
}
return y;
}
var data = mergeWith$1.apply(undefined, toConsumableArray(newKeyFrames).concat([customizer]));
var result = filterOffset(filterEmptyValues(data));
return result;
}
var deepClone = function deepClone(obj) {
if (typeof obj === 'function') {
return obj;
function isObject(obj) {
return Object(obj) === obj;
}
return JSON.parse(JSON.stringify(obj));
};
function nub(arr) {
return Array.from(new Set(arr));
}
function isPaintObject(data) {
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') {
return false;
}
function deepMerge() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
if (data === null) {
return false;
return args.filter(isObject).reduce(deepMergeTwo);
}
if (data instanceof Set || data instanceof Map) {
return false;
}
var curry = function curry(fn) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function () {
for (var _len4 = arguments.length, subArgs = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
subArgs[_key4] = arguments[_key4];
}
if (Array.isArray(data)) {
return false;
}
var currylen = fn.currylen || fn.length;
var collect = args.concat(subArgs);
if (collect.length >= currylen) {
return fn.apply(undefined, toConsumableArray(collect));
}
return curry(fn, collect);
};
};
return true;
}
function deepMergeTwo(x, y) {
if (isPaintObject(y) && isPaintObject(x) || isPaintObject(x) && Array.isArray(y)) {
return fromPairs(nub(Object.keys(x).concat(Object.keys(y))).map(function (key) {
return [key, deepMergeTwo(x[key], y[key])];
}));
}
var compose = function compose() {
for (var _len5 = arguments.length, fn = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
fn[_key5] = arguments[_key5];
}
if (isPaintObject(y) && typeof x === 'function') {
return Object.assign(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
var callback = function callback() {
for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
return x.apply(this, args);
}, y);
}
return fn.reduceRight(function (r, i, index) {
if (Array.isArray(r) && index === fn.length - 1) {
return i.apply(undefined, toConsumableArray(r));
}
return i(r);
}, args);
};
callback.currylen = fn[fn.curylen || fn.length - 1].length;
return callback;
};
if (isPaintObject(y) && Array.isArray(x)) {
return Object.assign([], x, y);
}
var MAX_UID = 1000000;
if (isPaintObject(x) && typeof y === 'function') {
return Object.assign(function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return y.apply(this, args);
}, x);
function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix));
return prefix;
}
if (Array.isArray(y) && Array.isArray(x)) {
// return x.concat(y)
return nub(Object.keys(y).concat(Object.keys(x))).map(function (index) {
return deepMergeTwo(x[index], y[index]);
function range(v) {
return Array.from({ length: v }, function (v, i) {
return i;
});
}
if (typeof y === 'undefined') {
return x;
function reflow(element) {
return element.offsetHeight;
}
return y;
}
function isObject(obj) {
return Object(obj) === obj;
}
function deepMerge() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return args.filter(isObject).reduce(deepMergeTwo);
}
var curry = function curry(fn) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function () {
for (var _len4 = arguments.length, subArgs = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
subArgs[_key4] = arguments[_key4];
function arraysEqual(a, b) {
if (a === b) {
return true;
}
var currylen = fn.currylen || fn.length;
var collect = args.concat(subArgs);
if (collect.length >= currylen) {
return fn.apply(undefined, toConsumableArray(collect));
if (a === undefined || b === undefined) {
return false;
}
return curry(fn, collect);
};
};
var compose = function compose() {
for (var _len5 = arguments.length, fn = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
fn[_key5] = arguments[_key5];
}
var callback = function callback() {
for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
if (a.length !== b.length) {
return false;
}
return fn.reduceRight(function (r, i, index) {
if (Array.isArray(r) && index === fn.length - 1) {
return i.apply(undefined, toConsumableArray(r));
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false;
}
return i(r);
}, args);
};
callback.currylen = fn[fn.curylen || fn.length - 1].length;
return callback;
};
var MAX_UID = 1000000;
function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix));
return prefix;
}
function range(v) {
return Array.from({ length: v }, function (v, i) {
return i;
});
}
function reflow(element) {
return element.offsetHeight;
}
function arraysEqual(a, b) {
if (a === b) {
}
return true;
}
if (a === undefined || b === undefined) {
return false;
function arrayDiff(a, b) {
// let t;
// if (a.length < b.length) {
// t = b;
// b = a;
// a = t;
// }
return a.filter(function (n) {
return b.indexOf(n) < 0;
});
}
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false;
function arrayIntersect(a, b) {
var t = void 0;
if (b.length > a.length) {
t = b;
b = a;
a = t;
}
return a.filter(function (n) {
return b.indexOf(n) !== -1;
});
}
return true;
}
function arrayDiff(a, b) {
// let t;
// if (a.length < b.length) {
// t = b;
// b = a;
// a = t;
// }
return a.filter(function (n) {
return b.indexOf(n) < 0;
});
}
function arrayIntersect(a, b) {
var t = void 0;
if (b.length > a.length) {
t = b;
b = a;
a = t;
function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10);
}
return a.filter(function (n) {
return b.indexOf(n) !== -1;
});
}
function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10);
}
function convertFloatToPercentage(n) {
if (n < 0) {
n = 0;
} else if (n > 1) {
n = 1;
function convertFloatToPercentage(n) {
if (n < 0) {
n = 0;
} else if (n > 1) {
n = 1;
}
return parseFloat(n).toFixed(4) * 100 + '%';
}
return parseFloat(n).toFixed(4) * 100 + '%';
}
function convertMatrixToArray(value) {
if (value && value.substr(0, 6) === 'matrix') {
return value.replace(/^.*\((.*)\)$/g, '$1').replace(/px/g, '').split(/, +/);
function convertMatrixToArray(value) {
if (value && value.substr(0, 6) === 'matrix') {
return value.replace(/^.*\((.*)\)$/g, '$1').replace(/px/g, '').split(/, +/);
}
return false;
}
return false;
}
function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {
return window.performance.now();
function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {
return window.performance.now();
}
return Date.now();
}
return Date.now();
}
function camelize(word) {
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
function camelize(word) {
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
word = word.replace(/[_.-\s](\w|$)/g, function (_, x) {
return x.toUpperCase();
});
word = word.replace(/[_.-\s](\w|$)/g, function (_, x) {
return x.toUpperCase();
});
if (first) {
word = word.substring(0, 1).toUpperCase() + word.substring(1);
if (first) {
word = word.substring(0, 1).toUpperCase() + word.substring(1);
}
return word;
}
return word;
}
/* Credit to https://github.com/jonschlinkert/get-value MIT */
function getValueByPath(obj, path) {
if (Object(obj) !== obj || typeof path === 'undefined') {
return obj;
}
/* Credit to https://github.com/jonschlinkert/get-value MIT */
function getValueByPath(obj, path) {
if (Object(obj) !== obj || typeof path === 'undefined') {
return obj;
}
if (path in obj) {
return obj[path];
}
if (path in obj) {
return obj[path];
}
var segs = path.split('.');
var length = segs.length;
if (!length) {
return undefined;
}
var i = -1;
var segs = path.split('.');
var length = segs.length;
if (!length) {
return undefined;
}
var i = -1;
while (obj && ++i < length) {
var key = segs[i];
while (key[key.length - 1] === '\\') {
key = key.slice(0, -1) + '.' + segs[++i];
while (obj && ++i < length) {
var key = segs[i];
while (key[key.length - 1] === '\\') {
key = key.slice(0, -1) + '.' + segs[++i];
}
obj = obj[key];
}
obj = obj[key];
return obj;
}
return obj;
}
/* Throttle execution of a function.
* Especially useful for rate limiting execution of
* handlers on events like resize and scroll. */
function throttle(func, delay) {
var _this = this;
/* Throttle execution of a function.
* Especially useful for rate limiting execution of
* handlers on events like resize and scroll. */
function throttle(func, delay) {
var _this = this;
var running = false;
function resetRunning() {
running = false;
}
var running = false;
function resetRunning() {
running = false;
}
if (delay !== undefined || delay !== null) {
if (delay !== undefined || delay !== null) {
return function () {
for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
args[_key7] = arguments[_key7];
}
var that = _this;
if (running) {
return;
}
running = true;
func.apply(that, args);
window.setTimeout(resetRunning, delay);
};
}
return function () {
for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
args[_key7] = arguments[_key7];
for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
args[_key8] = arguments[_key8];
}

@@ -757,95 +614,80 @@

running = true;
func.apply(that, args);
window.setTimeout(resetRunning, delay);
window.requestAnimationFrame(function () {
func.apply(that, args);
resetRunning();
});
};
}
return function () {
for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
args[_key8] = arguments[_key8];
}
/* Debounce execution of a function.
* Debouncing, unlike throttling, guarantees that a function
* is only executed a single time at the very end. */
function debounce(func) {
var _this2 = this;
var that = _this;
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
if (running) {
return;
}
running = true;
window.requestAnimationFrame(function () {
func.apply(that, args);
resetRunning();
});
};
}
var timer = void 0;
/* Debounce execution of a function.
* Debouncing, unlike throttling, guarantees that a function
* is only executed a single time at the very end. */
function debounce(func) {
var _this2 = this;
return function () {
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
var that = _this2;
if (timer) {
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function () {
func.apply(that, args);
}, delay);
};
}
var timer = void 0;
function fromPairs$1(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
return function () {
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
function mergeWith$1(obj1, obj2, customizer) {
return Object.entries(obj1).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 2),
k = _ref4[0],
v = _ref4[1];
var that = _this2;
if (timer) {
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function () {
func.apply(that, args);
}, delay);
};
}
return _extends({}, r, defineProperty({}, k, customizer(v, obj2[k])));
}, {});
}
function fromPairs(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
exports.deepClone = deepClone;
exports.nub = nub;
exports.isPlainObject = isPlainObject;
exports.deepMerge = deepMerge;
exports.curry = curry;
exports.compose = compose;
exports.getUID = getUID;
exports.range = range;
exports.reflow = reflow;
exports.arraysEqual = arraysEqual;
exports.arrayDiff = arrayDiff;
exports.arrayIntersect = arrayIntersect;
exports.convertPercentageToFloat = convertPercentageToFloat;
exports.convertFloatToPercentage = convertFloatToPercentage;
exports.convertMatrixToArray = convertMatrixToArray;
exports.getTime = getTime;
exports.camelize = camelize;
exports.getValueByPath = getValueByPath;
exports.throttle = throttle;
exports.debounce = debounce;
exports.fromPairs = fromPairs$1;
exports.mergeWith = mergeWith$1;
exports.keyframes2Anime = mapKeyFramesToAnime;
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
function mergeWith(obj1, obj2, customizer) {
return Object.entries(obj1).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 2),
k = _ref4[0],
v = _ref4[1];
Object.defineProperty(exports, '__esModule', { value: true });
return _extends({}, r, defineProperty({}, k, customizer(v, obj2[k])));
}, {});
}
exports.deepClone = deepClone;
exports.nub = nub;
exports.deepMerge = deepMerge;
exports.curry = curry;
exports.compose = compose;
exports.getUID = getUID;
exports.range = range;
exports.reflow = reflow;
exports.arraysEqual = arraysEqual;
exports.arrayDiff = arrayDiff;
exports.arrayIntersect = arrayIntersect;
exports.convertPercentageToFloat = convertPercentageToFloat;
exports.convertFloatToPercentage = convertFloatToPercentage;
exports.convertMatrixToArray = convertMatrixToArray;
exports.getTime = getTime;
exports.camelize = camelize;
exports.getValueByPath = getValueByPath;
exports.throttle = throttle;
exports.debounce = debounce;
exports.fromPairs = fromPairs;
exports.mergeWith = mergeWith;
exports.keyframes2Anime = mapKeyFramesToAnime;
Object.defineProperty(exports, '__esModule', { value: true });
})));

@@ -1,1 +0,1 @@

!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r["@pluginjs/utils"]={})}(this,function(r){"use strict";function n(r){return r.reduce(function(r,n){var t=m(n,2),e=t[0],o=t[1];return d({},r,h({},e,o))},{})}function t(r){return["translate","rotate","scale"].filter(function(n){var t=new RegExp(n,"g");return!!r.match(t)}).reduce(function(n,t){var i=r.match(/\(([^()]+)\)/)[1].split(",");return function(r){switch(r){case"translate":return o;case"rotate":return u;case"scale":return e;default:return function(){return"no match!"}}}(t)(i)},{})}function e(r){return r.map(function(r,n){var t=parseFloat(r,10);return h({},"scale"+A[n],t||0)}).reduce(i)}function o(r){return r.map(function(r,n){var t=parseFloat(r.slice(0,-2),10);return h({},"translate"+A[n],t||0)}).reduce(i)}function u(r){var n=r[r.length-1].slice(0,-3),t=r.slice(0,-1).map(function(r,n){return parseInt(r,10)?"rotate"+A[n]:r}).filter(c);return h({},t[0],parseFloat(n))}function i(r,n){return d({},r,n)}function a(r,n){return Array.isArray(r)?r.concat(n):[r,n]}function c(r){return!!r}function f(r){return Array.from(new Set(r))}function l(r){return"object"===(void 0===r?"undefined":v(r))&&(null!==r&&(!(r instanceof Set||r instanceof Map)&&!Array.isArray(r)))}function s(r,n){return l(n)&&l(r)||l(r)&&Array.isArray(n)?p(f(Object.keys(r).concat(Object.keys(n))).map(function(t){return[t,s(r[t],n[t])]})):l(n)&&"function"==typeof r?Object.assign(function(){for(var n=arguments.length,t=Array(n),e=0;e<n;e++)t[e]=arguments[e];return r.apply(this,t)},n):l(n)&&Array.isArray(r)?Object.assign([],r,n):l(r)&&"function"==typeof n?Object.assign(function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];return n.apply(this,t)},r):Array.isArray(n)&&Array.isArray(r)?f(Object.keys(n).concat(Object.keys(r))).map(function(t){return s(r[t],n[t])}):void 0===n?r:n}function y(r){return Object(r)===r}function p(r){return r.reduce(function(r,n){var t=m(n,2),e=t[0],o=t[1];return d({},r,h({},e,o))},{})}var v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},h=(function(){function r(r){this.value=r}function n(n){function t(o,u){try{var i=n[o](u),a=i.value;a instanceof r?Promise.resolve(a.value).then(function(r){t("next",r)},function(r){t("throw",r)}):e(i.done?"return":"normal",i.value)}catch(r){e("throw",r)}}function e(r,n){switch(r){case"return":o.resolve({value:n,done:!0});break;case"throw":o.reject(n);break;default:o.resolve({value:n,done:!1})}(o=o.next)?t(o.key,o.arg):u=null}var o,u;this._invoke=function(r,n){return new Promise(function(e,i){var a={key:r,arg:n,resolve:e,reject:i,next:null};u?u=u.next=a:(o=u=a,t(r,n))})},"function"!=typeof n.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this}),n.prototype.next=function(r){return this._invoke("next",r)},n.prototype.throw=function(r){return this._invoke("throw",r)},n.prototype.return=function(r){return this._invoke("return",r)}}(),function(r,n,t){return n in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r}),d=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r},g=function(r,n){var t={};for(var e in r)n.indexOf(e)>=0||Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t},m=function(){return function(r,n){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,n){var t=[],e=!0,o=!1,u=void 0;try{for(var i,a=r[Symbol.iterator]();!(e=(i=a.next()).done)&&(t.push(i.value),!n||t.length!==n);e=!0);}catch(r){o=!0,u=r}finally{try{!e&&a.return&&a.return()}finally{if(o)throw u}}return t}(r,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),b=function(r){if(Array.isArray(r)){for(var n=0,t=Array(r.length);n<r.length;n++)t[n]=r[n];return t}return Array.from(r)},A={0:"X",1:"Y",2:"Z"},w=1e6;r.deepClone=function(r){return"function"==typeof r?r:JSON.parse(JSON.stringify(r))},r.nub=f,r.deepMerge=function(){for(var r=arguments.length,n=Array(r),t=0;t<r;t++)n[t]=arguments[t];return n.filter(y).reduce(s)},r.curry=function r(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var e=arguments.length,o=Array(e),u=0;u<e;u++)o[u]=arguments[u];var i=n.currylen||n.length,a=t.concat(o);return a.length>=i?n.apply(void 0,b(a)):r(n,a)}},r.compose=function(){for(var r=arguments.length,n=Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];return n.reduceRight(function(r,t,e){return Array.isArray(r)&&e===n.length-1?t.apply(void 0,b(r)):t(r)},t)};return e.currylen=n[n.curylen||n.length-1].length,e},r.getUID=function(r){do{r+=~~(Math.random()*w)}while(document.getElementById(r));return r},r.range=function(r){return Array.from({length:r},function(r,n){return n})},r.reflow=function(r){return r.offsetHeight},r.arraysEqual=function(r,n){if(r===n)return!0;if(void 0===r||void 0===n)return!1;if(r.length!==n.length)return!1;for(var t=0;t<r.length;++t)if(r[t]!==n[t])return!1;return!0},r.arrayDiff=function(r,n){return r.filter(function(r){return n.indexOf(r)<0})},r.arrayIntersect=function(r,n){var t=void 0;return n.length>r.length&&(t=n,n=r,r=t),r.filter(function(r){return-1!==n.indexOf(r)})},r.convertPercentageToFloat=function(r){return parseFloat(r.slice(0,-1)/100,10)},r.convertFloatToPercentage=function(r){return r<0?r=0:r>1&&(r=1),100*parseFloat(r).toFixed(4)+"%"},r.convertMatrixToArray=function(r){return!(!r||"matrix"!==r.substr(0,6))&&r.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/)},r.getTime=function(){return void 0!==window.performance&&window.performance.now?window.performance.now():Date.now()},r.camelize=function(r){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r=r.replace(/[_.-\s](\w|$)/g,function(r,n){return n.toUpperCase()}),n&&(r=r.substring(0,1).toUpperCase()+r.substring(1)),r},r.getValueByPath=function(r,n){if(Object(r)!==r||void 0===n)return r;if(n in r)return r[n];var t=n.split("."),e=t.length;if(e){for(var o=-1;r&&++o<e;){for(var u=t[o];"\\"===u[u.length-1];)u=u.slice(0,-1)+"."+t[++o];r=r[u]}return r}},r.throttle=function(r,n){function t(){o=!1}var e=this,o=!1;return void 0!==n||null!==n?function(){for(var u=arguments.length,i=Array(u),a=0;a<u;a++)i[a]=arguments[a];var c=e;o||(o=!0,r.apply(c,i),window.setTimeout(t,n))}:function(){for(var n=arguments.length,u=Array(n),i=0;i<n;i++)u[i]=arguments[i];var a=e;o||(o=!0,window.requestAnimationFrame(function(){r.apply(a,u),t()}))}},r.debounce=function(r){var n=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,e=void 0;return function(){for(var o=arguments.length,u=Array(o),i=0;i<o;i++)u[i]=arguments[i];var a=n;e&&(clearTimeout(e),e=null),e=setTimeout(function(){r.apply(a,u)},t)}},r.fromPairs=p,r.mergeWith=function(r,n,t){return Object.entries(r).reduce(function(r,e){var o=m(e,2),u=o[0],i=o[1];return d({},r,h({},u,t(i,n[u])))},{})},r.keyframes2Anime=function(r){var e=[],o=new Set,u=r.map(function(r,n){var u=r.transform,i=g(r,["transform"]);if(u){var a=u.split(") ").map(function(r,n,t){return n!==t.length-1?r+")":r}).map(function(r){if(/3d/g.test(r)){var n=t(r);return Object.keys(n).map(function(r){return o.add(r)}),n}return r}).filter(function(r){return"string"!=typeof r});return a.length?Object.assign.apply(Object,[{},i].concat(b(a))):(e.push(n),i)}return i}),i=n(Array.from(o).map(function(r){return/scale/g.test(r)?[r,1]:[r,0]}));if(e.length){var c=!0,f=!1,l=void 0;try{for(var s,y=e[Symbol.iterator]();!(c=(s=y.next()).done);c=!0){var p=s.value;Object.assign(u[p],i)}}catch(r){f=!0,l=r}finally{try{!c&&y.return&&y.return()}finally{if(f)throw l}}}return function(r){return r.offset,g(r,["offset"])}(function(r){return n(Object.entries(r).filter(function(r){return!!m(r,2)[1].filter(function(r){return Boolean(r)}).length}).map(function(r){var n=m(r,2),t=n[0],e=n[1].map(function(r){return void 0===r?/scale/g.test(t)?1:0:r});return[t,e]}))}(function(){for(var r=arguments.length,n=Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.slice(0,-1),o=n[n.length-1];return Object.entries(n[0]).reduce(function(r,n){var t=m(n,1)[0];return d({},r,h({},t,e.map(function(r){return r[t]}).filter(function(r){return Boolean(r)||0===r}).reduce(function(r,n){return o(r,n)})))},{})}.apply(void 0,b(u).concat([a]))))},Object.defineProperty(r,"__esModule",{value:!0})});
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r["@pluginjs/utils"]={})}(this,function(r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},t=function(r,n,t){return n in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r},e=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r},o=function(r,n){var t={};for(var e in r)n.indexOf(e)>=0||Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t},u=function(){return function(r,n){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,n){var t=[],e=!0,o=!1,u=void 0;try{for(var i,a=r[Symbol.iterator]();!(e=(i=a.next()).done)&&(t.push(i.value),!n||t.length!==n);e=!0);}catch(r){o=!0,u=r}finally{try{!e&&a.return&&a.return()}finally{if(o)throw u}}return t}(r,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(r){if(Array.isArray(r)){for(var n=0,t=Array(r.length);n<r.length;n++)t[n]=r[n];return t}return Array.from(r)};function a(r){return r.reduce(function(r,n){var o=u(n,2),i=o[0],a=o[1];return e({},r,t({},i,a))},{})}var c={0:"X",1:"Y",2:"Z"};function f(r){return["translate","rotate","scale"].filter(function(n){var t=new RegExp(n,"g");return!!r.match(t)}).reduce(function(n,t){var e=r.match(/\(([^()]+)\)/)[1].split(",");return function(r){switch(r){case"translate":return s;case"rotate":return y;case"scale":return l;default:return function(){return"no match!"}}}(t)(e)},{})}function l(r){return r.map(function(r,n){var e=parseFloat(r,10);return t({},"scale"+c[n],e||0)}).reduce(p)}function s(r){return r.map(function(r,n){var e=parseFloat(r.slice(0,-2),10);return t({},"translate"+c[n],e||0)}).reduce(p)}function y(r){var n=r[r.length-1].slice(0,-3),e=r.slice(0,-1).map(function(r,n){return parseInt(r,10)?"rotate"+c[n]:r}).filter(g);return t({},e[0],parseFloat(n))}function p(r,n){return e({},r,n)}function v(r,n){return Array.isArray(r)?r.concat(n):[r,n]}function g(r){return!!r}function d(r){return Array.from(new Set(r))}function h(r){return"object"===(void 0===r?"undefined":n(r))&&(null!==r&&(!(r instanceof Set||r instanceof Map)&&!Array.isArray(r)))}function m(r,n){return h(n)&&h(r)||h(r)&&Array.isArray(n)?O(d(Object.keys(r).concat(Object.keys(n))).map(function(t){return[t,m(r[t],n[t])]})):h(n)&&"function"==typeof r?Object.assign(function(){for(var n=arguments.length,t=Array(n),e=0;e<n;e++)t[e]=arguments[e];return r.apply(this,t)},n):h(n)&&Array.isArray(r)?Object.assign([],r,n):h(r)&&"function"==typeof n?Object.assign(function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];return n.apply(this,t)},r):Array.isArray(n)&&Array.isArray(r)?d(Object.keys(n).concat(Object.keys(r))).map(function(t){return m(r[t],n[t])}):void 0===n?r:n}function b(r){return Object(r)===r}var A=1e6;function O(r){return r.reduce(function(r,n){var o=u(n,2),i=o[0],a=o[1];return e({},r,t({},i,a))},{})}r.deepClone=function(r){return"function"==typeof r?r:JSON.parse(JSON.stringify(r))},r.nub=d,r.isPlainObject=h,r.deepMerge=function(){for(var r=arguments.length,n=Array(r),t=0;t<r;t++)n[t]=arguments[t];return n.filter(b).reduce(m)},r.curry=function r(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var e=arguments.length,o=Array(e),u=0;u<e;u++)o[u]=arguments[u];var a=n.currylen||n.length,c=t.concat(o);return c.length>=a?n.apply(void 0,i(c)):r(n,c)}},r.compose=function(){for(var r=arguments.length,n=Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];return n.reduceRight(function(r,t,e){return Array.isArray(r)&&e===n.length-1?t.apply(void 0,i(r)):t(r)},t)};return e.currylen=n[n.curylen||n.length-1].length,e},r.getUID=function(r){do{r+=~~(Math.random()*A)}while(document.getElementById(r));return r},r.range=function(r){return Array.from({length:r},function(r,n){return n})},r.reflow=function(r){return r.offsetHeight},r.arraysEqual=function(r,n){if(r===n)return!0;if(void 0===r||void 0===n)return!1;if(r.length!==n.length)return!1;for(var t=0;t<r.length;++t)if(r[t]!==n[t])return!1;return!0},r.arrayDiff=function(r,n){return r.filter(function(r){return n.indexOf(r)<0})},r.arrayIntersect=function(r,n){var t=void 0;return n.length>r.length&&(t=n,n=r,r=t),r.filter(function(r){return-1!==n.indexOf(r)})},r.convertPercentageToFloat=function(r){return parseFloat(r.slice(0,-1)/100,10)},r.convertFloatToPercentage=function(r){return r<0?r=0:r>1&&(r=1),100*parseFloat(r).toFixed(4)+"%"},r.convertMatrixToArray=function(r){return!(!r||"matrix"!==r.substr(0,6))&&r.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/)},r.getTime=function(){return void 0!==window.performance&&window.performance.now?window.performance.now():Date.now()},r.camelize=function(r){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r=r.replace(/[_.-\s](\w|$)/g,function(r,n){return n.toUpperCase()}),n&&(r=r.substring(0,1).toUpperCase()+r.substring(1)),r},r.getValueByPath=function(r,n){if(Object(r)!==r||void 0===n)return r;if(n in r)return r[n];var t=n.split("."),e=t.length;if(e){for(var o=-1;r&&++o<e;){for(var u=t[o];"\\"===u[u.length-1];)u=u.slice(0,-1)+"."+t[++o];r=r[u]}return r}},r.throttle=function(r,n){var t=this,e=!1;function o(){e=!1}return void 0!==n||null!==n?function(){for(var u=arguments.length,i=Array(u),a=0;a<u;a++)i[a]=arguments[a];var c=t;e||(e=!0,r.apply(c,i),window.setTimeout(o,n))}:function(){for(var n=arguments.length,u=Array(n),i=0;i<n;i++)u[i]=arguments[i];var a=t;e||(e=!0,window.requestAnimationFrame(function(){r.apply(a,u),o()}))}},r.debounce=function(r){var n=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,e=void 0;return function(){for(var o=arguments.length,u=Array(o),i=0;i<o;i++)u[i]=arguments[i];var a=n;e&&(clearTimeout(e),e=null),e=setTimeout(function(){r.apply(a,u)},t)}},r.fromPairs=O,r.mergeWith=function(r,n,o){return Object.entries(r).reduce(function(r,i){var a=u(i,2),c=a[0],f=a[1];return e({},r,t({},c,o(f,n[c])))},{})},r.keyframes2Anime=function(r){var n=[],c=new Set,l=r.map(function(r,t){var e=r.transform,u=o(r,["transform"]);if(e){var a=e.split(") ").map(function(r,n,t){return n!==t.length-1?r+")":r}).map(function(r){if(/3d/g.test(r)){var n=f(r);return Object.keys(n).map(function(r){return c.add(r)}),n}return r}).filter(function(r){return"string"!=typeof r});return a.length?Object.assign.apply(Object,[{},u].concat(i(a))):(n.push(t),u)}return u}),s=a(Array.from(c).map(function(r){return/scale/g.test(r)?[r,1]:[r,0]}));if(n.length){var y=!0,p=!1,g=void 0;try{for(var d,h=n[Symbol.iterator]();!(y=(d=h.next()).done);y=!0){var m=d.value;Object.assign(l[m],s)}}catch(r){p=!0,g=r}finally{try{!y&&h.return&&h.return()}finally{if(p)throw g}}}var b,A=function(){for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];var i=n.slice(0,-1),a=n[n.length-1];return Object.entries(n[0]).reduce(function(r,n){var o=u(n,1)[0];return e({},r,t({},o,i.map(function(r){return r[o]}).filter(function(r){return Boolean(r)||0===r}).reduce(function(r,n){return a(r,n)})))},{})}.apply(void 0,i(l).concat([v]));return function(r){return r.offset,o(r,["offset"])}((b=A,a(Object.entries(b).filter(function(r){return!!u(r,2)[1].filter(function(r){return Boolean(r)}).length}).map(function(r){var n=u(r,2),t=n[0],e=n[1].map(function(r){return void 0===r?/scale/g.test(t)?1:0:r});return[t,e]}))))},Object.defineProperty(r,"__esModule",{value:!0})});
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global['@pluginjs/utils'] = {})));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global['@pluginjs/utils'] = {})));
}(this, (function (exports) { 'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
return target;
};
function AsyncGenerator(gen) {
var front, back;
var objectWithoutProperties = function (obj, keys) {
var target = {};
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
function resume(key, arg) {
return target;
};
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
var result = gen[key](arg);
var value = result.value;
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
if (i && _arr.length === i) break;
}
} catch (err) {
settle("throw", err);
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
back = null;
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
}
};
}();
this._invoke = send;
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
if (typeof gen.return !== "function") {
this.return = undefined;
return arr2;
} else {
return Array.from(arr);
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
function fromPairs(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
function mergeWith() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
};
}();
var objs = args.slice(0, -1);
var customizer = args[args.length - 1];
return Object.entries(args[0]).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 1),
k = _ref4[0];
return _extends({}, r, defineProperty({}, k, objs.map(function (obj) {
return obj[k];
}).filter(function (v) {
return Boolean(v) || v === 0;
}).reduce(function (r, i) {
return customizer(r, i);
})));
}, {});
}
var T = {
0: 'X',
1: 'Y',
2: 'Z'
};
function mapTransformToAnime(str) {
var css3dList = ['translate', 'rotate', 'scale'];
return css3dList.filter(function (key) {
var regx = new RegExp(key, 'g');
if (str.match(regx)) {
return true;
}
return false;
}).reduce(function (initialState, key) {
var matrix = str.match(/\(([^()]+)\)/)[1].split(',');
var map = mapMatch(key);
return map(matrix);
}, {});
}
function mapMatch(type) {
switch (type) {
case 'translate':
return mapToTranslate;
case 'rotate':
return mapToRotate;
case 'scale':
return mapToScale;
default:
return function () {
return 'no match!';
};
}
}
function mapToScale(matrix) {
// console.group('scale')
var result = matrix.map(function (value, index) {
var n = parseFloat(value, 10);
var result = defineProperty({}, 'scale' + T[index], n || 0);
// console.log(result)
return result;
});
return result.reduce(mergeObject);
}
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
function mapToTranslate(matrix) {
var result = matrix.map(function (value, index) {
var n = parseFloat(value.slice(0, -2), 10);
var result = defineProperty({}, 'translate' + T[index], n || 0);
return result;
});
} else {
obj[key] = value;
return result.reduce(mergeObject);
}
return obj;
};
function mapToRotate(matrix) {
var value = matrix[matrix.length - 1].slice(0, -3);
var transformType = matrix.slice(0, -1).map(function (n, index) {
if (parseInt(n, 10)) {
return 'rotate' + T[index];
}
return n;
}).filter(isNotEmpty);
return defineProperty({}, transformType[0], parseFloat(value));
}
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function mergeObject(r, i) {
return _extends({}, r, i);
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
function customizer(objValue, srcValue) {
if (Array.isArray(objValue)) {
return objValue.concat(srcValue);
}
return [objValue, srcValue];
}
return target;
};
function isNotEmpty(value) {
if (value) {
return true;
}
return false;
}
function filterOffset(obj) {
var offset = obj.offset,
result = objectWithoutProperties(obj, ['offset']);
return result;
}
function filterEmptyValues(obj) {
return fromPairs(Object.entries(obj).filter(function (_ref6) {
var _ref7 = slicedToArray(_ref6, 2),
v = _ref7[1];
var arr = v.filter(function (i) {
return Boolean(i);
});
if (arr.length) {
return true;
}
return false;
}).map(function (_ref8) {
var _ref9 = slicedToArray(_ref8, 2),
k = _ref9[0],
v = _ref9[1];
var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
var value = v.map(function (i) {
if (i === undefined) {
if (/scale/g.test(k)) {
return 1;
}
return 0;
}
return i;
});
return [k, value];
}));
}
return target;
};
function mapKeyFramesToAnime(keyframes) {
var transformNoneIndex = [];
var transformKeys = new Set();
var newKeyFrames = keyframes.map(function (keyframe, keyframeIndex) {
var transform = keyframe.transform,
newKeyFrame = objectWithoutProperties(keyframe, ['transform']);
if (transform) {
var arr = transform.split(') ').map(function (item, index, arr) {
if (index !== arr.length - 1) {
return item + ')';
}
return item;
}).map(function (value) {
if (/3d/g.test(value)) {
var transformObject = mapTransformToAnime(value);
Object.keys(transformObject).map(function (key) {
return transformKeys.add(key);
});
return transformObject;
}
return value;
}).filter(function (value) {
return typeof value !== 'string';
});
// console.log(arr)
if (!arr.length) {
transformNoneIndex.push(keyframeIndex);
return newKeyFrame;
}
return Object.assign.apply(Object, [{}, newKeyFrame].concat(toConsumableArray(arr)));
}
return newKeyFrame;
});
var emptyTransform = fromPairs(Array.from(transformKeys).map(function (key) {
if (/scale/g.test(key)) {
return [key, 1];
}
return [key, 0];
}));
if (transformNoneIndex.length) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = transformNoneIndex[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var index = _step.value;
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
Object.assign(newKeyFrames[index], emptyTransform);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
if (_d) throw _e;
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
return _arr;
var data = mergeWith.apply(undefined, toConsumableArray(newKeyFrames).concat([customizer]));
var result = filterOffset(filterEmptyValues(data));
return result;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
var deepClone = function deepClone(obj) {
if (typeof obj === 'function') {
return obj;
}
return JSON.parse(JSON.stringify(obj));
};
}();
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
function nub(arr) {
return Array.from(new Set(arr));
}
};
function isPlainObject(data) {
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') {
return false;
}
function fromPairs$1(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
if (data === null) {
return false;
}
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
function mergeWith$1() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var objs = args.slice(0, -1);
var customizer = args[args.length - 1];
return Object.entries(args[0]).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 1),
k = _ref4[0];
return _extends({}, r, defineProperty({}, k, objs.map(function (obj) {
return obj[k];
}).filter(function (v) {
return Boolean(v) || v === 0;
}).reduce(function (r, i) {
return customizer(r, i);
})));
}, {});
}
var T = {
0: 'X',
1: 'Y',
2: 'Z'
};
function mapTransformToAnime(str) {
var css3dList = ['translate', 'rotate', 'scale'];
return css3dList.filter(function (key) {
var regx = new RegExp(key, 'g');
if (str.match(regx)) {
return true;
if (data instanceof Set || data instanceof Map) {
return false;
}
return false;
}).reduce(function (initialState, key) {
var matrix = str.match(/\(([^()]+)\)/)[1].split(',');
var map = mapMatch(key);
return map(matrix);
}, {});
}
function mapMatch(type) {
switch (type) {
case 'translate':
return mapToTranslate;
case 'rotate':
return mapToRotate;
case 'scale':
return mapToScale;
default:
return function () {
return 'no match!';
};
}
}
function mapToScale(matrix) {
// console.group('scale')
var result = matrix.map(function (value, index) {
var n = parseFloat(value, 10);
var result = defineProperty({}, 'scale' + T[index], n || 0);
// console.log(result)
return result;
});
return result.reduce(mergeObject);
}
function mapToTranslate(matrix) {
var result = matrix.map(function (value, index) {
var n = parseFloat(value.slice(0, -2), 10);
var result = defineProperty({}, 'translate' + T[index], n || 0);
return result;
});
return result.reduce(mergeObject);
}
function mapToRotate(matrix) {
var value = matrix[matrix.length - 1].slice(0, -3);
var transformType = matrix.slice(0, -1).map(function (n, index) {
if (parseInt(n, 10)) {
return 'rotate' + T[index];
if (Array.isArray(data)) {
return false;
}
return n;
}).filter(isNotEmpty);
return defineProperty({}, transformType[0], parseFloat(value));
}
function mergeObject(r, i) {
return _extends({}, r, i);
}
function customizer(objValue, srcValue) {
if (Array.isArray(objValue)) {
return objValue.concat(srcValue);
}
return [objValue, srcValue];
}
function isNotEmpty(value) {
if (value) {
return true;
}
return false;
}
function deepMergeTwo(x, y) {
if (isPlainObject(y) && isPlainObject(x) || isPlainObject(x) && Array.isArray(y)) {
return fromPairs$1(nub(Object.keys(x).concat(Object.keys(y))).map(function (key) {
return [key, deepMergeTwo(x[key], y[key])];
}));
}
function filterOffset(obj) {
var offset = obj.offset,
result = objectWithoutProperties(obj, ['offset']);
if (isPlainObject(y) && typeof x === 'function') {
return Object.assign(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return result;
}
return x.apply(this, args);
}, y);
}
function filterEmptyValues(obj) {
return fromPairs$1(Object.entries(obj).filter(function (_ref6) {
var _ref7 = slicedToArray(_ref6, 2),
v = _ref7[1];
var arr = v.filter(function (i) {
return Boolean(i);
});
if (arr.length) {
return true;
if (isPlainObject(y) && Array.isArray(x)) {
return Object.assign([], x, y);
}
return false;
}).map(function (_ref8) {
var _ref9 = slicedToArray(_ref8, 2),
k = _ref9[0],
v = _ref9[1];
var value = v.map(function (i) {
if (i === undefined) {
if (/scale/g.test(k)) {
return 1;
if (isPlainObject(x) && typeof y === 'function') {
return Object.assign(function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return 0;
}
return i;
});
return [k, value];
}));
}
function mapKeyFramesToAnime(keyframes) {
var transformNoneIndex = [];
var transformKeys = new Set();
var newKeyFrames = keyframes.map(function (keyframe, keyframeIndex) {
var transform = keyframe.transform,
newKeyFrame = objectWithoutProperties(keyframe, ['transform']);
return y.apply(this, args);
}, x);
}
if (transform) {
var arr = transform.split(') ').map(function (item, index, arr) {
if (index !== arr.length - 1) {
return item + ')';
}
return item;
}).map(function (value) {
if (/3d/g.test(value)) {
var transformObject = mapTransformToAnime(value);
Object.keys(transformObject).map(function (key) {
return transformKeys.add(key);
});
return transformObject;
}
return value;
}).filter(function (value) {
return typeof value !== 'string';
if (Array.isArray(y) && Array.isArray(x)) {
// return x.concat(y)
return nub(Object.keys(y).concat(Object.keys(x))).map(function (index) {
return deepMergeTwo(x[index], y[index]);
});
// console.log(arr)
if (!arr.length) {
transformNoneIndex.push(keyframeIndex);
return newKeyFrame;
}
return Object.assign.apply(Object, [{}, newKeyFrame].concat(toConsumableArray(arr)));
}
return newKeyFrame;
});
var emptyTransform = fromPairs$1(Array.from(transformKeys).map(function (key) {
if (/scale/g.test(key)) {
return [key, 1];
}
return [key, 0];
}));
if (transformNoneIndex.length) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = transformNoneIndex[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var index = _step.value;
Object.assign(newKeyFrames[index], emptyTransform);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
if (typeof y === 'undefined') {
return x;
}
return y;
}
var data = mergeWith$1.apply(undefined, toConsumableArray(newKeyFrames).concat([customizer]));
var result = filterOffset(filterEmptyValues(data));
return result;
}
var deepClone = function deepClone(obj) {
if (typeof obj === 'function') {
return obj;
function isObject(obj) {
return Object(obj) === obj;
}
return JSON.parse(JSON.stringify(obj));
};
function nub(arr) {
return Array.from(new Set(arr));
}
function isPaintObject(data) {
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') {
return false;
}
function deepMerge() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
if (data === null) {
return false;
return args.filter(isObject).reduce(deepMergeTwo);
}
if (data instanceof Set || data instanceof Map) {
return false;
}
var curry = function curry(fn) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function () {
for (var _len4 = arguments.length, subArgs = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
subArgs[_key4] = arguments[_key4];
}
if (Array.isArray(data)) {
return false;
}
var currylen = fn.currylen || fn.length;
var collect = args.concat(subArgs);
if (collect.length >= currylen) {
return fn.apply(undefined, toConsumableArray(collect));
}
return curry(fn, collect);
};
};
return true;
}
function deepMergeTwo(x, y) {
if (isPaintObject(y) && isPaintObject(x) || isPaintObject(x) && Array.isArray(y)) {
return fromPairs(nub(Object.keys(x).concat(Object.keys(y))).map(function (key) {
return [key, deepMergeTwo(x[key], y[key])];
}));
}
var compose = function compose() {
for (var _len5 = arguments.length, fn = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
fn[_key5] = arguments[_key5];
}
if (isPaintObject(y) && typeof x === 'function') {
return Object.assign(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
var callback = function callback() {
for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
return x.apply(this, args);
}, y);
}
return fn.reduceRight(function (r, i, index) {
if (Array.isArray(r) && index === fn.length - 1) {
return i.apply(undefined, toConsumableArray(r));
}
return i(r);
}, args);
};
callback.currylen = fn[fn.curylen || fn.length - 1].length;
return callback;
};
if (isPaintObject(y) && Array.isArray(x)) {
return Object.assign([], x, y);
}
var MAX_UID = 1000000;
if (isPaintObject(x) && typeof y === 'function') {
return Object.assign(function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return y.apply(this, args);
}, x);
function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix));
return prefix;
}
if (Array.isArray(y) && Array.isArray(x)) {
// return x.concat(y)
return nub(Object.keys(y).concat(Object.keys(x))).map(function (index) {
return deepMergeTwo(x[index], y[index]);
function range(v) {
return Array.from({ length: v }, function (v, i) {
return i;
});
}
if (typeof y === 'undefined') {
return x;
function reflow(element) {
return element.offsetHeight;
}
return y;
}
function isObject(obj) {
return Object(obj) === obj;
}
function deepMerge() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return args.filter(isObject).reduce(deepMergeTwo);
}
var curry = function curry(fn) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function () {
for (var _len4 = arguments.length, subArgs = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
subArgs[_key4] = arguments[_key4];
function arraysEqual(a, b) {
if (a === b) {
return true;
}
var currylen = fn.currylen || fn.length;
var collect = args.concat(subArgs);
if (collect.length >= currylen) {
return fn.apply(undefined, toConsumableArray(collect));
if (a === undefined || b === undefined) {
return false;
}
return curry(fn, collect);
};
};
var compose = function compose() {
for (var _len5 = arguments.length, fn = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
fn[_key5] = arguments[_key5];
}
var callback = function callback() {
for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
if (a.length !== b.length) {
return false;
}
return fn.reduceRight(function (r, i, index) {
if (Array.isArray(r) && index === fn.length - 1) {
return i.apply(undefined, toConsumableArray(r));
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false;
}
return i(r);
}, args);
};
callback.currylen = fn[fn.curylen || fn.length - 1].length;
return callback;
};
var MAX_UID = 1000000;
function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix));
return prefix;
}
function range(v) {
return Array.from({ length: v }, function (v, i) {
return i;
});
}
function reflow(element) {
return element.offsetHeight;
}
function arraysEqual(a, b) {
if (a === b) {
}
return true;
}
if (a === undefined || b === undefined) {
return false;
function arrayDiff(a, b) {
// let t;
// if (a.length < b.length) {
// t = b;
// b = a;
// a = t;
// }
return a.filter(function (n) {
return b.indexOf(n) < 0;
});
}
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false;
function arrayIntersect(a, b) {
var t = void 0;
if (b.length > a.length) {
t = b;
b = a;
a = t;
}
return a.filter(function (n) {
return b.indexOf(n) !== -1;
});
}
return true;
}
function arrayDiff(a, b) {
// let t;
// if (a.length < b.length) {
// t = b;
// b = a;
// a = t;
// }
return a.filter(function (n) {
return b.indexOf(n) < 0;
});
}
function arrayIntersect(a, b) {
var t = void 0;
if (b.length > a.length) {
t = b;
b = a;
a = t;
function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10);
}
return a.filter(function (n) {
return b.indexOf(n) !== -1;
});
}
function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10);
}
function convertFloatToPercentage(n) {
if (n < 0) {
n = 0;
} else if (n > 1) {
n = 1;
function convertFloatToPercentage(n) {
if (n < 0) {
n = 0;
} else if (n > 1) {
n = 1;
}
return parseFloat(n).toFixed(4) * 100 + '%';
}
return parseFloat(n).toFixed(4) * 100 + '%';
}
function convertMatrixToArray(value) {
if (value && value.substr(0, 6) === 'matrix') {
return value.replace(/^.*\((.*)\)$/g, '$1').replace(/px/g, '').split(/, +/);
function convertMatrixToArray(value) {
if (value && value.substr(0, 6) === 'matrix') {
return value.replace(/^.*\((.*)\)$/g, '$1').replace(/px/g, '').split(/, +/);
}
return false;
}
return false;
}
function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {
return window.performance.now();
function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {
return window.performance.now();
}
return Date.now();
}
return Date.now();
}
function camelize(word) {
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
function camelize(word) {
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
word = word.replace(/[_.-\s](\w|$)/g, function (_, x) {
return x.toUpperCase();
});
word = word.replace(/[_.-\s](\w|$)/g, function (_, x) {
return x.toUpperCase();
});
if (first) {
word = word.substring(0, 1).toUpperCase() + word.substring(1);
if (first) {
word = word.substring(0, 1).toUpperCase() + word.substring(1);
}
return word;
}
return word;
}
/* Credit to https://github.com/jonschlinkert/get-value MIT */
function getValueByPath(obj, path) {
if (Object(obj) !== obj || typeof path === 'undefined') {
return obj;
}
/* Credit to https://github.com/jonschlinkert/get-value MIT */
function getValueByPath(obj, path) {
if (Object(obj) !== obj || typeof path === 'undefined') {
return obj;
}
if (path in obj) {
return obj[path];
}
if (path in obj) {
return obj[path];
}
var segs = path.split('.');
var length = segs.length;
if (!length) {
return undefined;
}
var i = -1;
var segs = path.split('.');
var length = segs.length;
if (!length) {
return undefined;
}
var i = -1;
while (obj && ++i < length) {
var key = segs[i];
while (key[key.length - 1] === '\\') {
key = key.slice(0, -1) + '.' + segs[++i];
while (obj && ++i < length) {
var key = segs[i];
while (key[key.length - 1] === '\\') {
key = key.slice(0, -1) + '.' + segs[++i];
}
obj = obj[key];
}
obj = obj[key];
return obj;
}
return obj;
}
/* Throttle execution of a function.
* Especially useful for rate limiting execution of
* handlers on events like resize and scroll. */
function throttle(func, delay) {
var _this = this;
/* Throttle execution of a function.
* Especially useful for rate limiting execution of
* handlers on events like resize and scroll. */
function throttle(func, delay) {
var _this = this;
var running = false;
function resetRunning() {
running = false;
}
var running = false;
function resetRunning() {
running = false;
}
if (delay !== undefined || delay !== null) {
if (delay !== undefined || delay !== null) {
return function () {
for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
args[_key7] = arguments[_key7];
}
var that = _this;
if (running) {
return;
}
running = true;
func.apply(that, args);
window.setTimeout(resetRunning, delay);
};
}
return function () {
for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
args[_key7] = arguments[_key7];
for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
args[_key8] = arguments[_key8];
}

@@ -757,95 +614,80 @@

running = true;
func.apply(that, args);
window.setTimeout(resetRunning, delay);
window.requestAnimationFrame(function () {
func.apply(that, args);
resetRunning();
});
};
}
return function () {
for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
args[_key8] = arguments[_key8];
}
/* Debounce execution of a function.
* Debouncing, unlike throttling, guarantees that a function
* is only executed a single time at the very end. */
function debounce(func) {
var _this2 = this;
var that = _this;
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
if (running) {
return;
}
running = true;
window.requestAnimationFrame(function () {
func.apply(that, args);
resetRunning();
});
};
}
var timer = void 0;
/* Debounce execution of a function.
* Debouncing, unlike throttling, guarantees that a function
* is only executed a single time at the very end. */
function debounce(func) {
var _this2 = this;
return function () {
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
var that = _this2;
if (timer) {
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function () {
func.apply(that, args);
}, delay);
};
}
var timer = void 0;
function fromPairs$1(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
return function () {
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
function mergeWith$1(obj1, obj2, customizer) {
return Object.entries(obj1).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 2),
k = _ref4[0],
v = _ref4[1];
var that = _this2;
if (timer) {
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function () {
func.apply(that, args);
}, delay);
};
}
return _extends({}, r, defineProperty({}, k, customizer(v, obj2[k])));
}, {});
}
function fromPairs(arr) {
return arr.reduce(function (r, _ref) {
var _ref2 = slicedToArray(_ref, 2),
k = _ref2[0],
v = _ref2[1];
exports.deepClone = deepClone;
exports.nub = nub;
exports.isPlainObject = isPlainObject;
exports.deepMerge = deepMerge;
exports.curry = curry;
exports.compose = compose;
exports.getUID = getUID;
exports.range = range;
exports.reflow = reflow;
exports.arraysEqual = arraysEqual;
exports.arrayDiff = arrayDiff;
exports.arrayIntersect = arrayIntersect;
exports.convertPercentageToFloat = convertPercentageToFloat;
exports.convertFloatToPercentage = convertFloatToPercentage;
exports.convertMatrixToArray = convertMatrixToArray;
exports.getTime = getTime;
exports.camelize = camelize;
exports.getValueByPath = getValueByPath;
exports.throttle = throttle;
exports.debounce = debounce;
exports.fromPairs = fromPairs$1;
exports.mergeWith = mergeWith$1;
exports.keyframes2Anime = mapKeyFramesToAnime;
return _extends({}, r, defineProperty({}, k, v));
}, {});
}
function mergeWith(obj1, obj2, customizer) {
return Object.entries(obj1).reduce(function (r, _ref3) {
var _ref4 = slicedToArray(_ref3, 2),
k = _ref4[0],
v = _ref4[1];
Object.defineProperty(exports, '__esModule', { value: true });
return _extends({}, r, defineProperty({}, k, customizer(v, obj2[k])));
}, {});
}
exports.deepClone = deepClone;
exports.nub = nub;
exports.deepMerge = deepMerge;
exports.curry = curry;
exports.compose = compose;
exports.getUID = getUID;
exports.range = range;
exports.reflow = reflow;
exports.arraysEqual = arraysEqual;
exports.arrayDiff = arrayDiff;
exports.arrayIntersect = arrayIntersect;
exports.convertPercentageToFloat = convertPercentageToFloat;
exports.convertFloatToPercentage = convertFloatToPercentage;
exports.convertMatrixToArray = convertMatrixToArray;
exports.getTime = getTime;
exports.camelize = camelize;
exports.getValueByPath = getValueByPath;
exports.throttle = throttle;
exports.debounce = debounce;
exports.fromPairs = fromPairs;
exports.mergeWith = mergeWith;
exports.keyframes2Anime = mapKeyFramesToAnime;
Object.defineProperty(exports, '__esModule', { value: true });
})));
{
"name": "@pluginjs/utils",
"title": "Plugin",
"version": "0.2.11",
"version": "0.2.13",
"description": "A workflow for modern frontend development.",

@@ -34,3 +34,3 @@ "author": "Creation Studio Limited",

"dependencies": {
"@pluginjs/feature": "^0.2.11"
"@pluginjs/feature": "^0.2.13"
},

@@ -37,0 +37,0 @@ "category": "core",

@@ -1,2 +0,2 @@

function fromPairs (arr) {
function fromPairs(arr) {
return arr.reduce(

@@ -11,3 +11,3 @@ (r, [k, v]) => ({

function mergeWith (...args) {
function mergeWith(...args) {
const objs = args.slice(0, -1)

@@ -33,3 +33,3 @@ const customizer = args[args.length - 1]

function mapTransformToAnime (str) {
function mapTransformToAnime(str) {
const css3dList = ['translate', 'rotate', 'scale']

@@ -51,3 +51,3 @@ return css3dList

function mapMatch (type) {
function mapMatch(type) {
switch (type) {

@@ -65,3 +65,3 @@ case 'translate':

function mapToScale (matrix) {
function mapToScale(matrix) {
// console.group('scale')

@@ -77,3 +77,3 @@ const result = matrix.map((value, index) => {

function mapToTranslate (matrix) {
function mapToTranslate(matrix) {
const result = matrix.map((value, index) => {

@@ -87,3 +87,3 @@ const n = parseFloat(value.slice(0, -2), 10)

function mapToRotate (matrix) {
function mapToRotate(matrix) {
const value = matrix[matrix.length - 1].slice(0, -3)

@@ -102,3 +102,3 @@ const transformType = matrix

function mergeObject (r, i) {
function mergeObject(r, i) {
return {

@@ -110,3 +110,3 @@ ...r,

function customizer (objValue, srcValue) {
function customizer(objValue, srcValue) {
if (Array.isArray(objValue)) {

@@ -118,3 +118,3 @@ return objValue.concat(srcValue)

function isNotEmpty (value) {
function isNotEmpty(value) {
if (value) {

@@ -126,3 +126,3 @@ return true

function filterOffset (obj) {
function filterOffset(obj) {
const { offset, ...result } = obj

@@ -132,3 +132,3 @@ return result

function filterEmptyValues (obj) {
function filterEmptyValues(obj) {
return fromPairs(

@@ -158,3 +158,3 @@ Object.entries(obj)

export default function mapKeyFramesToAnime (keyframes) {
export default function mapKeyFramesToAnime(keyframes) {
const transformNoneIndex = []

@@ -161,0 +161,0 @@ const transformKeys = new Set()

@@ -9,6 +9,6 @@ import keyframes2Anime from './anime-polyfill'

}
export function nub (arr) {
export function nub(arr) {
return Array.from(new Set(arr))
}
function isPaintObject (data) {
export function isPlainObject(data) {
if (typeof data !== 'object') {

@@ -32,6 +32,6 @@ return false

}
function deepMergeTwo (x, y) {
function deepMergeTwo(x, y) {
if (
isPaintObject(y) && isPaintObject(x) ||
isPaintObject(x) && Array.isArray(y)
(isPlainObject(y) && isPlainObject(x)) ||
(isPlainObject(x) && Array.isArray(y))
) {

@@ -46,4 +46,4 @@ return fromPairs(

if (isPaintObject(y) && typeof x === 'function') {
return Object.assign(function (...args) {
if (isPlainObject(y) && typeof x === 'function') {
return Object.assign(function(...args) {
return x.apply(this, args)

@@ -53,8 +53,8 @@ }, y)

if (isPaintObject(y) && Array.isArray(x)) {
if (isPlainObject(y) && Array.isArray(x)) {
return Object.assign([], x, y)
}
if (isPaintObject(x) && typeof y === 'function') {
return Object.assign(function (...args) {
if (isPlainObject(x) && typeof y === 'function') {
return Object.assign(function(...args) {
return y.apply(this, args)

@@ -76,6 +76,6 @@ }, x)

}
function isObject (obj) {
function isObject(obj) {
return Object(obj) === obj
}
export function deepMerge (...args) {
export function deepMerge(...args) {
return args.filter(isObject).reduce(deepMergeTwo)

@@ -107,3 +107,3 @@ }

export function getUID (prefix) {
export function getUID(prefix) {
do {

@@ -116,11 +116,11 @@ // eslint-disable-next-line no-bitwise

export function range (v) {
export function range(v) {
return Array.from({ length: v }, (v, i) => i)
}
export function reflow (element) {
export function reflow(element) {
return element.offsetHeight
}
export function arraysEqual (a, b) {
export function arraysEqual(a, b) {
if (a === b) {

@@ -144,3 +144,3 @@ return true

export function arrayDiff (a, b) {
export function arrayDiff(a, b) {
// let t;

@@ -155,3 +155,3 @@ // if (a.length < b.length) {

export function arrayIntersect (a, b) {
export function arrayIntersect(a, b) {
let t

@@ -166,7 +166,7 @@ if (b.length > a.length) {

export function convertPercentageToFloat (n) {
export function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10)
}
export function convertFloatToPercentage (n) {
export function convertFloatToPercentage(n) {
if (n < 0) {

@@ -180,3 +180,3 @@ n = 0

export function convertMatrixToArray (value) {
export function convertMatrixToArray(value) {
if (value && value.substr(0, 6) === 'matrix') {

@@ -191,3 +191,3 @@ return value

export function getTime () {
export function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {

@@ -199,3 +199,3 @@ return window.performance.now()

export function camelize (word, first = true) {
export function camelize(word, first = true) {
word = word.replace(/[_.-\s](\w|$)/g, (_, x) => x.toUpperCase())

@@ -210,3 +210,3 @@

/* Credit to https://github.com/jonschlinkert/get-value MIT */
export function getValueByPath (obj, path) {
export function getValueByPath(obj, path) {
if (Object(obj) !== obj || typeof path === 'undefined') {

@@ -240,5 +240,5 @@ return obj

* handlers on events like resize and scroll. */
export function throttle (func, delay) {
export function throttle(func, delay) {
let running = false
function resetRunning () {
function resetRunning() {
running = false

@@ -277,3 +277,3 @@ }

* is only executed a single time at the very end. */
export function debounce (func, delay = 100) {
export function debounce(func, delay = 100) {
let timer

@@ -293,3 +293,3 @@

export function fromPairs (arr) {
export function fromPairs(arr) {
return arr.reduce(

@@ -303,3 +303,3 @@ (r, [k, v]) => ({

}
export function mergeWith (obj1, obj2, customizer) {
export function mergeWith(obj1, obj2, customizer) {
return Object.entries(obj1).reduce(

@@ -306,0 +306,0 @@ (r, [k, v]) => ({

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc