@pluginjs/utils
Advanced tools
Comparing version 0.2.20 to 0.5.0
@@ -1,29 +0,63 @@ | ||
var _extends = Object.assign || function (target) { | ||
function _defineProperty(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; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
}; | ||
} | ||
var objectWithoutProperties = function (obj, keys) { | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (var i in obj) { | ||
if (keys.indexOf(i) >= 0) continue; | ||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
target[i] = obj[i]; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
}; | ||
} | ||
function fromPairs(arr) { | ||
return arr.reduce((r, [k, v]) => _extends({}, r, { | ||
return arr.reduce((r, [k, v]) => _objectSpread({}, r, { | ||
[k]: v | ||
@@ -36,3 +70,3 @@ }), {}); | ||
const customizer = args[args.length - 1]; | ||
return Object.entries(args[0]).reduce((r, [k]) => _extends({}, r, { | ||
return Object.entries(args[0]).reduce((r, [k]) => _objectSpread({}, r, { | ||
[k]: objs.map(obj => obj[k]).filter(v => Boolean(v) || v === 0).reduce((r, i) => customizer(r, i)) | ||
@@ -52,5 +86,7 @@ }), {}); | ||
const regx = new RegExp(key, 'g'); | ||
if (str.match(regx)) { | ||
return true; | ||
} | ||
return false; | ||
@@ -68,6 +104,9 @@ }).reduce((initialState, key) => { | ||
return mapToTranslate; | ||
case 'rotate': | ||
return mapToRotate; | ||
case 'scale': | ||
return mapToScale; | ||
default: | ||
@@ -82,5 +121,7 @@ return () => 'no match!'; | ||
const n = parseFloat(value, 10); | ||
const result = { [`scale${T[index]}`]: n || 0 | ||
// console.log(result) | ||
};return result; | ||
const result = { | ||
[`scale${T[index]}`]: n || 0 // console.log(result) | ||
}; | ||
return result; | ||
}); | ||
@@ -93,3 +134,5 @@ return result.reduce(mergeObject); | ||
const n = parseFloat(value.slice(0, -2), 10); | ||
const result = { [`translate${T[index]}`]: n || 0 }; | ||
const result = { | ||
[`translate${T[index]}`]: n || 0 | ||
}; | ||
return result; | ||
@@ -106,9 +149,12 @@ }); | ||
} | ||
return n; | ||
}).filter(isNotEmpty); | ||
return { [transformType[0]]: parseFloat(value) }; | ||
return { | ||
[transformType[0]]: parseFloat(value) | ||
}; | ||
} | ||
function mergeObject(r, i) { | ||
return _extends({}, r, i); | ||
return _objectSpread({}, r, i); | ||
} | ||
@@ -120,2 +166,3 @@ | ||
} | ||
return [objValue, srcValue]; | ||
@@ -128,2 +175,3 @@ } | ||
} | ||
return false; | ||
@@ -133,3 +181,5 @@ } | ||
function filterOffset(obj) { | ||
const result = objectWithoutProperties(obj, ['offset']); | ||
const offset = obj.offset, | ||
result = _objectWithoutProperties(obj, ["offset"]); | ||
return result; | ||
@@ -141,5 +191,7 @@ } | ||
const arr = v.filter(i => Boolean(i)); | ||
if (arr.length) { | ||
return true; | ||
} | ||
return false; | ||
@@ -152,4 +204,6 @@ }).map(([k, v]) => { | ||
} | ||
return 0; | ||
} | ||
return i; | ||
@@ -165,4 +219,5 @@ }); | ||
const newKeyFrames = keyframes.map((keyframe, keyframeIndex) => { | ||
const { transform } = keyframe, | ||
newKeyFrame = objectWithoutProperties(keyframe, ['transform']); | ||
const transform = keyframe.transform, | ||
newKeyFrame = _objectWithoutProperties(keyframe, ["transform"]); | ||
if (transform) { | ||
@@ -173,2 +228,3 @@ const arr = transform.split(') ').map((item, index, arr) => { | ||
} | ||
return item; | ||
@@ -181,5 +237,6 @@ }).map(value => { | ||
} | ||
return value; | ||
}).filter(value => typeof value !== 'string'); | ||
// console.log(arr) | ||
}).filter(value => typeof value !== 'string'); // console.log(arr) | ||
if (!arr.length) { | ||
@@ -189,4 +246,6 @@ transformNoneIndex.push(keyframeIndex); | ||
} | ||
return Object.assign({}, newKeyFrame, ...arr); | ||
} | ||
return newKeyFrame; | ||
@@ -198,4 +257,6 @@ }); | ||
} | ||
return [key, 0]; | ||
})); | ||
if (transformNoneIndex.length) { | ||
@@ -206,2 +267,3 @@ for (const index of transformNoneIndex) { | ||
} | ||
const data = mergeWith(...newKeyFrames, customizer); | ||
@@ -216,2 +278,3 @@ const result = filterOffset(filterEmptyValues(data)); | ||
} | ||
return JSON.parse(JSON.stringify(obj)); | ||
@@ -241,2 +304,3 @@ }; | ||
} | ||
function deepMergeTwo(x, y) { | ||
@@ -271,20 +335,23 @@ if (isPlainObject(y) && isPlainObject(x) || isPlainObject(x) && Array.isArray(y)) { | ||
} | ||
return y; | ||
} | ||
function isObject(obj) { | ||
return Object(obj) === obj; | ||
} | ||
function deepMerge(...args) { | ||
return args.filter(isObject).reduce(deepMergeTwo); | ||
} | ||
const curry = (fn, args = []) => (...subArgs) => { | ||
const currylen = fn.currylen || fn.length; | ||
const collect = args.concat(subArgs); | ||
if (collect.length >= currylen) { | ||
return fn(...collect); | ||
} | ||
return curry(fn, collect); | ||
}; | ||
const compose = (...fn) => { | ||
@@ -295,10 +362,10 @@ const callback = (...args) => fn.reduceRight((r, i, index) => { | ||
} | ||
return i(r); | ||
}, args); | ||
callback.currylen = fn[fn.curylen || fn.length - 1].length; | ||
return callback; | ||
}; | ||
const MAX_UID = 1000000; | ||
function getUID(prefix) { | ||
@@ -309,13 +376,13 @@ do { | ||
} while (document.getElementById(prefix)); | ||
return prefix; | ||
} | ||
function range(v) { | ||
return Array.from({ length: v }, (v, i) => i); | ||
return Array.from({ | ||
length: v | ||
}, (v, i) => i); | ||
} | ||
function reflow(element) { | ||
return element.offsetHeight; | ||
} | ||
function arraysEqual(a, b) { | ||
@@ -325,5 +392,7 @@ if (a === b) { | ||
} | ||
if (a === undefined || b === undefined) { | ||
return false; | ||
} | ||
if (a.length !== b.length) { | ||
@@ -338,5 +407,5 @@ return false; | ||
} | ||
return true; | ||
} | ||
function arrayDiff(a, b) { | ||
@@ -351,5 +420,5 @@ // let t; | ||
} | ||
function arrayIntersect(a, b) { | ||
let t; | ||
if (b.length > a.length) { | ||
@@ -360,9 +429,8 @@ t = b; | ||
} | ||
return a.filter(n => b.indexOf(n) !== -1); | ||
} | ||
function convertPercentageToFloat(n) { | ||
return parseFloat(n.slice(0, -1) / 100, 10); | ||
} | ||
function convertFloatToPercentage(n) { | ||
@@ -374,5 +442,5 @@ if (n < 0) { | ||
} | ||
return `${parseFloat(n).toFixed(4) * 100}%`; | ||
} | ||
function convertMatrixToArray(value) { | ||
@@ -382,5 +450,5 @@ if (value && value.substr(0, 6) === 'matrix') { | ||
} | ||
return false; | ||
} | ||
function getTime() { | ||
@@ -390,5 +458,5 @@ if (typeof window.performance !== 'undefined' && window.performance.now) { | ||
} | ||
return Date.now(); | ||
} | ||
function camelize(word, first = true) { | ||
@@ -400,6 +468,7 @@ word = word.replace(/[_.-\s](\w|$)/g, (_, x) => x.toUpperCase()); | ||
} | ||
return word; | ||
} | ||
/* Credit to https://github.com/jonschlinkert/get-value MIT */ | ||
/* Credit to https://github.com/jonschlinkert/get-value MIT */ | ||
function getValueByPath(obj, path) { | ||
@@ -416,5 +485,7 @@ if (Object(obj) !== obj || typeof path === 'undefined') { | ||
const length = segs.length; | ||
if (!length) { | ||
return undefined; | ||
} | ||
let i = -1; | ||
@@ -424,15 +495,19 @@ | ||
let key = segs[i]; | ||
while (key[key.length - 1] === '\\') { | ||
key = `${key.slice(0, -1)}.${segs[++i]}`; | ||
} | ||
obj = obj[key]; | ||
} | ||
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) { | ||
let running = false; | ||
function resetRunning() { | ||
@@ -449,2 +524,3 @@ running = false; | ||
} | ||
running = true; | ||
@@ -462,2 +538,3 @@ func.apply(that, args); | ||
} | ||
running = true; | ||
@@ -470,11 +547,11 @@ window.requestAnimationFrame(() => { | ||
} | ||
/* 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, delay = 100) { | ||
let timer; | ||
return (...args) => { | ||
const that = this; | ||
if (timer) { | ||
@@ -484,2 +561,3 @@ clearTimeout(timer); | ||
} | ||
timer = setTimeout(() => { | ||
@@ -490,5 +568,4 @@ func.apply(that, args); | ||
} | ||
function fromPairs$1(arr) { | ||
return arr.reduce((r, [k, v]) => _extends({}, r, { | ||
return arr.reduce((r, [k, v]) => _objectSpread({}, r, { | ||
[k]: v | ||
@@ -498,3 +575,3 @@ }), {}); | ||
function mergeWith$1(obj1, obj2, customizer) { | ||
return Object.entries(obj1).reduce((r, [k, v]) => _extends({}, r, { | ||
return Object.entries(obj1).reduce((r, [k, v]) => _objectSpread({}, r, { | ||
[k]: customizer(v, obj2[k]) | ||
@@ -501,0 +578,0 @@ }), {}); |
1007
dist/utils.js
@@ -1,692 +0,569 @@ | ||
(function (global, factory) { | ||
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'; | ||
'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; | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
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; | ||
} | ||
function _defineProperty(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; | ||
}; | ||
return obj; | ||
} | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
return target; | ||
}; | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
var objectWithoutProperties = function (obj, keys) { | ||
var target = {}; | ||
return target; | ||
} | ||
for (var i in obj) { | ||
if (keys.indexOf(i) >= 0) continue; | ||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
target[i] = obj[i]; | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
}; | ||
return target; | ||
} | ||
var slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
function fromPairs(arr) { | ||
return arr.reduce((r, [k, v]) => _objectSpread({}, r, { | ||
[k]: v | ||
}), {}); | ||
} | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
function mergeWith(...args) { | ||
const objs = args.slice(0, -1); | ||
const customizer = args[args.length - 1]; | ||
return Object.entries(args[0]).reduce((r, [k]) => _objectSpread({}, r, { | ||
[k]: objs.map(obj => obj[k]).filter(v => Boolean(v) || v === 0).reduce((r, i) => customizer(r, i)) | ||
}), {}); | ||
} | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"]) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
const T = { | ||
0: 'X', | ||
1: 'Y', | ||
2: 'Z' | ||
}; | ||
return _arr; | ||
function mapTransformToAnime(str) { | ||
const css3dList = ['translate', 'rotate', 'scale']; | ||
return css3dList.filter(key => { | ||
const regx = new RegExp(key, 'g'); | ||
if (str.match(regx)) { | ||
return true; | ||
} | ||
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"); | ||
} | ||
}; | ||
}(); | ||
return false; | ||
}).reduce((initialState, key) => { | ||
const matrix = str.match(/\(([^()]+)\)/)[1].split(','); | ||
const map = mapMatch(key); | ||
return map(matrix); | ||
}, {}); | ||
} | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
function mapMatch(type) { | ||
switch (type) { | ||
case 'translate': | ||
return mapToTranslate; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
case 'rotate': | ||
return mapToRotate; | ||
function fromPairs(arr) { | ||
return arr.reduce(function (r, _ref) { | ||
var _ref2 = slicedToArray(_ref, 2), | ||
k = _ref2[0], | ||
v = _ref2[1]; | ||
case 'scale': | ||
return mapToScale; | ||
return _extends({}, r, defineProperty({}, k, v)); | ||
}, {}); | ||
default: | ||
return () => 'no match!'; | ||
} | ||
} | ||
function mergeWith() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
function mapToScale(matrix) { | ||
// console.group('scale') | ||
const result = matrix.map((value, index) => { | ||
const n = parseFloat(value, 10); | ||
const result = { | ||
[`scale${T[index]}`]: n || 0 // console.log(result) | ||
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 result; | ||
}); | ||
return result.reduce(mergeObject); | ||
} | ||
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); | ||
}))); | ||
}, {}); | ||
} | ||
function mapToTranslate(matrix) { | ||
const result = matrix.map((value, index) => { | ||
const n = parseFloat(value.slice(0, -2), 10); | ||
const result = { | ||
[`translate${T[index]}`]: n || 0 | ||
}; | ||
return result; | ||
}); | ||
return result.reduce(mergeObject); | ||
} | ||
var T = { | ||
0: 'X', | ||
1: 'Y', | ||
2: 'Z' | ||
function mapToRotate(matrix) { | ||
const value = matrix[matrix.length - 1].slice(0, -3); | ||
const transformType = matrix.slice(0, -1).map((n, index) => { | ||
if (parseInt(n, 10)) { | ||
return `rotate${T[index]}`; | ||
} | ||
return n; | ||
}).filter(isNotEmpty); | ||
return { | ||
[transformType[0]]: parseFloat(value) | ||
}; | ||
} | ||
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 mergeObject(r, i) { | ||
return _objectSpread({}, r, i); | ||
} | ||
function mapMatch(type) { | ||
switch (type) { | ||
case 'translate': | ||
return mapToTranslate; | ||
case 'rotate': | ||
return mapToRotate; | ||
case 'scale': | ||
return mapToScale; | ||
default: | ||
return function () { | ||
return 'no match!'; | ||
}; | ||
} | ||
function customizer(objValue, srcValue) { | ||
if (Array.isArray(objValue)) { | ||
return objValue.concat(srcValue); | ||
} | ||
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); | ||
} | ||
return [objValue, srcValue]; | ||
} | ||
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 isNotEmpty(value) { | ||
if (value) { | ||
return true; | ||
} | ||
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)); | ||
} | ||
return false; | ||
} | ||
function mergeObject(r, i) { | ||
return _extends({}, r, i); | ||
} | ||
function filterOffset(obj) { | ||
const offset = obj.offset, | ||
result = _objectWithoutProperties(obj, ["offset"]); | ||
function customizer(objValue, srcValue) { | ||
if (Array.isArray(objValue)) { | ||
return objValue.concat(srcValue); | ||
} | ||
return [objValue, srcValue]; | ||
} | ||
return result; | ||
} | ||
function isNotEmpty(value) { | ||
if (value) { | ||
function filterEmptyValues(obj) { | ||
return fromPairs(Object.entries(obj).filter(([, v]) => { | ||
const arr = v.filter(i => Boolean(i)); | ||
if (arr.length) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
}).map(([k, v]) => { | ||
const value = v.map(i => { | ||
if (i === undefined) { | ||
if (/scale/g.test(k)) { | ||
return 1; | ||
} | ||
function filterOffset(obj) { | ||
var offset = obj.offset, | ||
result = objectWithoutProperties(obj, ['offset']); | ||
return 0; | ||
} | ||
return result; | ||
} | ||
return i; | ||
}); | ||
return [k, value]; | ||
})); | ||
} | ||
function filterEmptyValues(obj) { | ||
return fromPairs(Object.entries(obj).filter(function (_ref6) { | ||
var _ref7 = slicedToArray(_ref6, 2), | ||
v = _ref7[1]; | ||
function mapKeyFramesToAnime(keyframes) { | ||
const transformNoneIndex = []; | ||
const transformKeys = new Set(); | ||
const newKeyFrames = keyframes.map((keyframe, keyframeIndex) => { | ||
const transform = keyframe.transform, | ||
newKeyFrame = _objectWithoutProperties(keyframe, ["transform"]); | ||
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]; | ||
if (transform) { | ||
const arr = transform.split(') ').map((item, index, arr) => { | ||
if (index !== arr.length - 1) { | ||
return `${item})`; | ||
} | ||
var value = v.map(function (i) { | ||
if (i === undefined) { | ||
if (/scale/g.test(k)) { | ||
return 1; | ||
} | ||
return 0; | ||
return item; | ||
}).map(value => { | ||
if (/3d/g.test(value)) { | ||
const transformObject = mapTransformToAnime(value); | ||
Object.keys(transformObject).map(key => transformKeys.add(key)); | ||
return transformObject; | ||
} | ||
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 value; | ||
}).filter(value => typeof value !== 'string'); // console.log(arr) | ||
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))); | ||
if (!arr.length) { | ||
transformNoneIndex.push(keyframeIndex); | ||
return newKeyFrame; | ||
} | ||
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; | ||
return Object.assign({}, newKeyFrame, ...arr); | ||
} | ||
Object.assign(newKeyFrames[index], emptyTransform); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return newKeyFrame; | ||
}); | ||
const emptyTransform = fromPairs(Array.from(transformKeys).map(key => { | ||
if (/scale/g.test(key)) { | ||
return [key, 1]; | ||
} | ||
var data = mergeWith.apply(undefined, toConsumableArray(newKeyFrames).concat([customizer])); | ||
var result = filterOffset(filterEmptyValues(data)); | ||
return result; | ||
} | ||
var deepClone = function deepClone(obj) { | ||
if (typeof obj === 'function') { | ||
return obj; | ||
return [key, 0]; | ||
})); | ||
if (transformNoneIndex.length) { | ||
for (const index of transformNoneIndex) { | ||
Object.assign(newKeyFrames[index], emptyTransform); | ||
} | ||
return JSON.parse(JSON.stringify(obj)); | ||
}; | ||
function nub(arr) { | ||
return Array.from(new Set(arr)); | ||
} | ||
function isPlainObject(data) { | ||
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') { | ||
return false; | ||
} | ||
if (data === null) { | ||
return false; | ||
} | ||
const data = mergeWith(...newKeyFrames, customizer); | ||
const result = filterOffset(filterEmptyValues(data)); | ||
return result; | ||
} | ||
if (data instanceof Set || data instanceof Map) { | ||
return false; | ||
} | ||
const deepClone = obj => { | ||
if (typeof obj === 'function') { | ||
return obj; | ||
} | ||
if (Array.isArray(data)) { | ||
return false; | ||
} | ||
return JSON.parse(JSON.stringify(obj)); | ||
}; | ||
function nub(arr) { | ||
return Array.from(new Set(arr)); | ||
} | ||
function isPlainObject(data) { | ||
if (typeof data !== 'object') { | ||
return false; | ||
} | ||
return true; | ||
if (data === null) { | ||
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])]; | ||
})); | ||
} | ||
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]; | ||
} | ||
if (data instanceof Set || data instanceof Map) { | ||
return false; | ||
} | ||
return x.apply(this, args); | ||
}, y); | ||
} | ||
if (Array.isArray(data)) { | ||
return false; | ||
} | ||
if (isPlainObject(y) && Array.isArray(x)) { | ||
return Object.assign([], x, y); | ||
} | ||
return true; | ||
} | ||
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]; | ||
} | ||
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(key => [key, deepMergeTwo(x[key], y[key])])); | ||
} | ||
return y.apply(this, args); | ||
}, x); | ||
} | ||
if (isPlainObject(y) && typeof x === 'function') { | ||
return Object.assign(function (...args) { | ||
return x.apply(this, args); | ||
}, y); | ||
} | ||
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]); | ||
}); | ||
} | ||
if (isPlainObject(y) && Array.isArray(x)) { | ||
return Object.assign([], x, y); | ||
} | ||
if (typeof y === 'undefined') { | ||
return x; | ||
} | ||
return y; | ||
if (isPlainObject(x) && typeof y === 'function') { | ||
return Object.assign(function (...args) { | ||
return y.apply(this, args); | ||
}, x); | ||
} | ||
function isObject(obj) { | ||
return Object(obj) === obj; | ||
if (Array.isArray(y) && Array.isArray(x)) { | ||
// return x.concat(y) | ||
return nub(Object.keys(y).concat(Object.keys(x))).map(index => deepMergeTwo(x[index], y[index])); | ||
} | ||
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); | ||
if (typeof y === 'undefined') { | ||
return x; | ||
} | ||
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]; | ||
} | ||
return y; | ||
} | ||
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); | ||
}; | ||
}; | ||
function isObject(obj) { | ||
return Object(obj) === obj; | ||
} | ||
var compose = function compose() { | ||
for (var _len5 = arguments.length, fn = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
fn[_key5] = arguments[_key5]; | ||
function deepMerge(...args) { | ||
return args.filter(isObject).reduce(deepMergeTwo); | ||
} | ||
const curry = (fn, args = []) => (...subArgs) => { | ||
const currylen = fn.currylen || fn.length; | ||
const collect = args.concat(subArgs); | ||
if (collect.length >= currylen) { | ||
return fn(...collect); | ||
} | ||
return curry(fn, collect); | ||
}; | ||
const compose = (...fn) => { | ||
const callback = (...args) => fn.reduceRight((r, i, index) => { | ||
if (Array.isArray(r) && index === fn.length - 1) { | ||
return i(...r); | ||
} | ||
var callback = function callback() { | ||
for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { | ||
args[_key6] = arguments[_key6]; | ||
} | ||
return i(r); | ||
}, args); | ||
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; | ||
}; | ||
callback.currylen = fn[fn.curylen || fn.length - 1].length; | ||
return callback; | ||
}; | ||
const 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)); | ||
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; | ||
return prefix; | ||
} | ||
function range(v) { | ||
return Array.from({ | ||
length: v | ||
}, (v, i) => i); | ||
} | ||
function reflow(element) { | ||
return element.offsetHeight; | ||
} | ||
function arraysEqual(a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
function range(v) { | ||
return Array.from({ length: v }, function (v, i) { | ||
return i; | ||
}); | ||
if (a === undefined || b === undefined) { | ||
return false; | ||
} | ||
function reflow(element) { | ||
return element.offsetHeight; | ||
if (a.length !== b.length) { | ||
return false; | ||
} | ||
function arraysEqual(a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
if (a === undefined || b === undefined) { | ||
for (let i = 0; i < a.length; ++i) { | ||
if (a[i] !== b[i]) { | ||
return false; | ||
} | ||
if (a.length !== b.length) { | ||
return false; | ||
} | ||
} | ||
for (var i = 0; i < a.length; ++i) { | ||
if (a[i] !== b[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
return true; | ||
} | ||
function arrayDiff(a, b) { | ||
// let t; | ||
// if (a.length < b.length) { | ||
// t = b; | ||
// b = a; | ||
// a = t; | ||
// } | ||
return a.filter(n => b.indexOf(n) < 0); | ||
} | ||
function arrayIntersect(a, b) { | ||
let t; | ||
if (b.length > a.length) { | ||
t = b; | ||
b = a; | ||
a = t; | ||
} | ||
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; | ||
}); | ||
return a.filter(n => 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 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 `${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 convertPercentageToFloat(n) { | ||
return parseFloat(n.slice(0, -1) / 100, 10); | ||
return false; | ||
} | ||
function getTime() { | ||
if (typeof window.performance !== 'undefined' && window.performance.now) { | ||
return window.performance.now(); | ||
} | ||
function convertFloatToPercentage(n) { | ||
if (n < 0) { | ||
n = 0; | ||
} else if (n > 1) { | ||
n = 1; | ||
} | ||
return parseFloat(n).toFixed(4) * 100 + '%'; | ||
return Date.now(); | ||
} | ||
function camelize(word, first = true) { | ||
word = word.replace(/[_.-\s](\w|$)/g, (_, x) => x.toUpperCase()); | ||
if (first) { | ||
word = word.substring(0, 1).toUpperCase() + word.substring(1); | ||
} | ||
function convertMatrixToArray(value) { | ||
if (value && value.substr(0, 6) === 'matrix') { | ||
return value.replace(/^.*\((.*)\)$/g, '$1').replace(/px/g, '').split(/, +/); | ||
} | ||
return false; | ||
return word; | ||
} | ||
/* Credit to https://github.com/jonschlinkert/get-value MIT */ | ||
function getValueByPath(obj, path) { | ||
if (Object(obj) !== obj || typeof path === 'undefined') { | ||
return obj; | ||
} | ||
function getTime() { | ||
if (typeof window.performance !== 'undefined' && window.performance.now) { | ||
return window.performance.now(); | ||
} | ||
return Date.now(); | ||
if (path in obj) { | ||
return obj[path]; | ||
} | ||
function camelize(word) { | ||
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
const segs = path.split('.'); | ||
const length = segs.length; | ||
word = word.replace(/[_.-\s](\w|$)/g, function (_, x) { | ||
return x.toUpperCase(); | ||
}); | ||
if (first) { | ||
word = word.substring(0, 1).toUpperCase() + word.substring(1); | ||
} | ||
return word; | ||
if (!length) { | ||
return undefined; | ||
} | ||
/* Credit to https://github.com/jonschlinkert/get-value MIT */ | ||
function getValueByPath(obj, path) { | ||
if (Object(obj) !== obj || typeof path === 'undefined') { | ||
return obj; | ||
} | ||
let i = -1; | ||
if (path in obj) { | ||
return obj[path]; | ||
} | ||
while (obj && ++i < length) { | ||
let key = segs[i]; | ||
var segs = path.split('.'); | ||
var length = segs.length; | ||
if (!length) { | ||
return undefined; | ||
while (key[key.length - 1] === '\\') { | ||
key = `${key.slice(0, -1)}.${segs[++i]}`; | ||
} | ||
var i = -1; | ||
while (obj && ++i < length) { | ||
var key = segs[i]; | ||
while (key[key.length - 1] === '\\') { | ||
key = key.slice(0, -1) + '.' + segs[++i]; | ||
} | ||
obj = obj[key]; | ||
} | ||
return obj; | ||
obj = obj[key]; | ||
} | ||
/* 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; | ||
return obj; | ||
} | ||
/* Throttle execution of a function. | ||
* Especially useful for rate limiting execution of | ||
* handlers on events like resize and scroll. */ | ||
var running = false; | ||
function resetRunning() { | ||
running = false; | ||
} | ||
function throttle(func, delay) { | ||
let running = false; | ||
if (delay !== undefined || delay !== null) { | ||
return function () { | ||
for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { | ||
args[_key7] = arguments[_key7]; | ||
} | ||
function resetRunning() { | ||
running = false; | ||
} | ||
var that = _this; | ||
if (delay !== undefined || delay !== null) { | ||
return (...args) => { | ||
const that = this; | ||
if (running) { | ||
return; | ||
} | ||
running = true; | ||
func.apply(that, args); | ||
window.setTimeout(resetRunning, delay); | ||
}; | ||
} | ||
return function () { | ||
for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { | ||
args[_key8] = arguments[_key8]; | ||
} | ||
var that = _this; | ||
if (running) { | ||
return; | ||
} | ||
running = true; | ||
window.requestAnimationFrame(function () { | ||
func.apply(that, args); | ||
resetRunning(); | ||
}); | ||
func.apply(that, args); | ||
window.setTimeout(resetRunning, delay); | ||
}; | ||
} | ||
/* 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 (...args) => { | ||
const that = this; | ||
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100; | ||
if (running) { | ||
return; | ||
} | ||
var timer = void 0; | ||
running = true; | ||
window.requestAnimationFrame(() => { | ||
func.apply(that, args); | ||
resetRunning(); | ||
}); | ||
}; | ||
} | ||
/* Debounce execution of a function. | ||
* Debouncing, unlike throttling, guarantees that a function | ||
* is only executed a single time at the very end. */ | ||
return function () { | ||
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { | ||
args[_key9] = arguments[_key9]; | ||
} | ||
function debounce(func, delay = 100) { | ||
let timer; | ||
return (...args) => { | ||
const that = this; | ||
var that = _this2; | ||
if (timer) { | ||
clearTimeout(timer); | ||
timer = null; | ||
} | ||
timer = setTimeout(function () { | ||
func.apply(that, args); | ||
}, delay); | ||
}; | ||
} | ||
if (timer) { | ||
clearTimeout(timer); | ||
timer = null; | ||
} | ||
function fromPairs$1(arr) { | ||
return arr.reduce(function (r, _ref) { | ||
var _ref2 = slicedToArray(_ref, 2), | ||
k = _ref2[0], | ||
v = _ref2[1]; | ||
timer = setTimeout(() => { | ||
func.apply(that, args); | ||
}, delay); | ||
}; | ||
} | ||
function fromPairs$1(arr) { | ||
return arr.reduce((r, [k, v]) => _objectSpread({}, r, { | ||
[k]: v | ||
}), {}); | ||
} | ||
function mergeWith$1(obj1, obj2, customizer) { | ||
return Object.entries(obj1).reduce((r, [k, v]) => _objectSpread({}, r, { | ||
[k]: customizer(v, obj2[k]) | ||
}), {}); | ||
} | ||
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]; | ||
return _extends({}, r, defineProperty({}, k, customizer(v, obj2[k]))); | ||
}, {}); | ||
} | ||
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; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
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; |
{ | ||
"name": "@pluginjs/utils", | ||
"title": "Plugin", | ||
"version": "0.2.20", | ||
"version": "0.5.0", | ||
"description": "A workflow for modern frontend development.", | ||
"author": "Creation Studio Limited", | ||
"homepage": "https://github.com/amazingSurge/plugin.js", | ||
"license": "GPL-v3", | ||
"main": "dist/utils.js", | ||
"license": "GPL-3.0", | ||
"main": "dist/utils.umd.js", | ||
"files": [ | ||
@@ -16,7 +16,10 @@ "dist", | ||
"start": "gulp plugin", | ||
"build": "npm run prestart && gulp build", | ||
"build": "plugin build", | ||
"deploy": "gulp deploy", | ||
"deploy:prepare": "gulp deploy:prepare", | ||
"test": "gulp test", | ||
"new": "cp -r ./plugins/sample ./plugins/$Component" | ||
"test": "jest", | ||
"new": "cp -r ./plugins/sample ./plugins/$Component", | ||
"build:js": "plugin script build-js", | ||
"build:scss": "plugin script build-scss", | ||
"build:md": "plugin script build-md" | ||
}, | ||
@@ -38,6 +41,22 @@ "repository": { | ||
"category": "core", | ||
"min": "dist/utils.min.js", | ||
"standalone": "dist/utils.standalone.js", | ||
"module": "dist/utils.esm.js", | ||
"dev-main": "src/main.js" | ||
"source": "src/main.js", | ||
"cjs": "dist/utils.cjs.js", | ||
"jest": { | ||
"setupTestFrameworkScriptFile": "jest-extended", | ||
"verbose": true, | ||
"testPathIgnorePatterns": [ | ||
"fixtures" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@pluginjs/cli": "^0.5.18", | ||
"babel-jest": "^23.0.1", | ||
"jest": "^23.1.0", | ||
"jest-extended": "^0.7.2", | ||
"rollup": "^0.59.2", | ||
"rollup-plugin-babel": "^4.0.0-beta.4", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-node-resolve": "^3.3.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53
56598
8
7
1959