@appartmint/util
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -9,4 +9,5 @@ /** | ||
*/ | ||
export { mintColor } from './imports/color'; | ||
export { mintSide } from './imports/enum'; | ||
export { mintColor } from './imports/models/color'; | ||
export { mintItem } from './imports/models/item'; | ||
export { mintDisplay } from './imports/util/display'; | ||
@@ -13,0 +14,0 @@ export { mintEvent } from './imports/util/event'; |
@@ -15,6 +15,6 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/***/ "./src/ts/imports/color.ts": | ||
/*!*********************************!*\ | ||
!*** ./src/ts/imports/color.ts ***! | ||
\*********************************/ | ||
/***/ "./src/ts/imports/enum.ts": | ||
/*!********************************!*\ | ||
!*** ./src/ts/imports/enum.ts ***! | ||
\********************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
@@ -27,2 +27,28 @@ | ||
})); | ||
exports.mintSide = void 0; | ||
/** | ||
* Side Enum | ||
*/ | ||
var mintSide; | ||
(function (mintSide) { | ||
mintSide[mintSide["Top"] = 0] = "Top"; | ||
mintSide[mintSide["Right"] = 1] = "Right"; | ||
mintSide[mintSide["Bottom"] = 2] = "Bottom"; | ||
mintSide[mintSide["Left"] = 3] = "Left"; | ||
})(mintSide = exports.mintSide || (exports.mintSide = {})); | ||
; | ||
/***/ }), | ||
/***/ "./src/ts/imports/models/color.ts": | ||
/*!****************************************!*\ | ||
!*** ./src/ts/imports/models/color.ts ***! | ||
\****************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintColor = void 0; | ||
@@ -119,6 +145,6 @@ /** | ||
/***/ "./src/ts/imports/enum.ts": | ||
/*!********************************!*\ | ||
!*** ./src/ts/imports/enum.ts ***! | ||
\********************************/ | ||
/***/ "./src/ts/imports/models/item.ts": | ||
/*!***************************************!*\ | ||
!*** ./src/ts/imports/models/item.ts ***! | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
@@ -131,14 +157,32 @@ | ||
})); | ||
exports.mintSide = void 0; | ||
exports.mintItem = void 0; | ||
/** | ||
* Side Enum | ||
* A generic item | ||
*/ | ||
var mintSide; | ||
(function (mintSide) { | ||
mintSide[mintSide["Top"] = 0] = "Top"; | ||
mintSide[mintSide["Right"] = 1] = "Right"; | ||
mintSide[mintSide["Bottom"] = 2] = "Bottom"; | ||
mintSide[mintSide["Left"] = 3] = "Left"; | ||
})(mintSide = exports.mintSide || (exports.mintSide = {})); | ||
class mintItem { | ||
constructor() { | ||
/** | ||
* Item settings | ||
*/ | ||
this.version = 0; | ||
this.priority = 0; | ||
this.centered = false; | ||
this.disabled = false; | ||
/** | ||
* Item data | ||
*/ | ||
this.queryParams = {}; | ||
this.attributes = {}; | ||
/** | ||
* Item lists | ||
*/ | ||
this.classes = []; | ||
this.buttons = []; | ||
this.images = []; | ||
this.children = []; | ||
} | ||
} | ||
exports.mintItem = mintItem; | ||
; | ||
exports["default"] = mintItem; | ||
@@ -415,7 +459,14 @@ /***/ }), | ||
})); | ||
exports["default"] = exports.mintUtil = exports.mintSettings = exports.mintSelectors = exports.mintWindow = exports.mintText = exports.mintObject = exports.mintMath = exports.mintEvent = exports.mintDisplay = exports.mintSide = exports.mintColor = void 0; | ||
exports["default"] = exports.mintUtil = exports.mintSettings = exports.mintSelectors = exports.mintWindow = exports.mintText = exports.mintObject = exports.mintMath = exports.mintEvent = exports.mintDisplay = exports.mintItem = exports.mintColor = exports.mintSide = void 0; | ||
/** | ||
* Exports | ||
*/ | ||
var color_1 = __webpack_require__(/*! ./imports/color */ "./src/ts/imports/color.ts"); | ||
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts"); | ||
Object.defineProperty(exports, "mintSide", ({ | ||
enumerable: true, | ||
get: function () { | ||
return enum_1.mintSide; | ||
} | ||
})); | ||
var color_1 = __webpack_require__(/*! ./imports/models/color */ "./src/ts/imports/models/color.ts"); | ||
Object.defineProperty(exports, "mintColor", ({ | ||
@@ -427,7 +478,7 @@ enumerable: true, | ||
})); | ||
var enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts"); | ||
Object.defineProperty(exports, "mintSide", ({ | ||
var item_1 = __webpack_require__(/*! ./imports/models/item */ "./src/ts/imports/models/item.ts"); | ||
Object.defineProperty(exports, "mintItem", ({ | ||
enumerable: true, | ||
get: function () { | ||
return enum_1.mintSide; | ||
return item_1.mintItem; | ||
} | ||
@@ -784,2 +835,3 @@ })); | ||
}; | ||
; | ||
exports["default"] = mintSettings; | ||
@@ -810,8 +862,2 @@ | ||
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts"); | ||
const display_1 = __importDefault(__webpack_require__(/*! ./imports/util/display */ "./src/ts/imports/util/display.ts")); | ||
const event_1 = __importDefault(__webpack_require__(/*! ./imports/util/event */ "./src/ts/imports/util/event.ts")); | ||
const math_1 = __importDefault(__webpack_require__(/*! ./imports/util/math */ "./src/ts/imports/util/math.ts")); | ||
const object_1 = __importDefault(__webpack_require__(/*! ./imports/util/object */ "./src/ts/imports/util/object.ts")); | ||
const text_1 = __importDefault(__webpack_require__(/*! ./imports/util/text */ "./src/ts/imports/util/text.ts")); | ||
const window_1 = __importDefault(__webpack_require__(/*! ./imports/util/window */ "./src/ts/imports/util/window.ts")); | ||
const settings_1 = __importDefault(__webpack_require__(/*! ./settings */ "./src/ts/settings.ts")); | ||
@@ -824,23 +870,2 @@ /** | ||
/** | ||
* Sub-utility functions | ||
*/ | ||
static get display() { | ||
return display_1.default; | ||
} | ||
static get event() { | ||
return event_1.default; | ||
} | ||
static get math() { | ||
return math_1.default; | ||
} | ||
static get object() { | ||
return object_1.default; | ||
} | ||
static get text() { | ||
return text_1.default; | ||
} | ||
static get window() { | ||
return window_1.default; | ||
} | ||
/** | ||
* Returns the width of the window, including fractional pixels | ||
@@ -847,0 +872,0 @@ * @returns the width of the window |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mint=t():e.mint=t()}(self,(()=>(()=>{"use strict";var e={731:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintColor=void 0;class i{constructor(e){this.r="number"==typeof e.r?Math.max(Math.min(e.r,i.hexBase**2-1),0):0,this.g="number"==typeof e.g?Math.max(Math.min(e.g,i.hexBase**2-1),0):0,this.b="number"==typeof e.b?Math.max(Math.min(e.b,i.hexBase**2-1),0):0,this.a="number"==typeof e.a?Math.max(Math.min(e.a,1),0):1,"string"==typeof e.color&&this.stringConstructor(e.color)}stringConstructor(e){e.startsWith("#")?this.hexConstructor(e):(~e.indexOf("linear-gradient")&&(e=e.substring(e.indexOf("linear-gradient"),e.length)),this.rgbConstructor(e))}hexConstructor(e){switch(e.length){case 1:case 5:case 6:return;case 2:e="#"+e[1]+e[1]+e[1]+e[1]+e[1]+e[1]+i.hexMax;break;case 3:e="#"+e[1]+e[1]+e[1]+e[2]+e[2]+e[2]+i.hexMax;break;case 4:e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+i.hexMax;break;case 7:e+=i.hexMax;break;case 8:e+=e[e.length-1];break;default:e=e.substring(0,9)}this.r=parseInt(e.substring(1,3),i.hexBase),this.g=parseInt(e.substring(3,5),i.hexBase),this.b=parseInt(e.substring(5,7),i.hexBase),this.a=parseInt(e.substring(7,9),i.hexBase)/i.hexBase**2}rgbConstructor(e){let t=e.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);t&&(this.r=parseInt(t[1]),this.g=parseInt(t[2]),this.b=parseInt(t[3]),this.a=parseFloat(t[4]))}getBrightness(){return 0===this.a?262:isNaN(this.r)||isNaN(this.g)||isNaN(this.b)?-1:Math.round((299*this.r+587*this.g+144*this.b)/1e3)}}t.mintColor=i,i.hexBase=16,i.hexMax="FF",t.default=i},64:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSide=void 0,(i=t.mintSide||(t.mintSide={}))[i.Top=0]="Top",i[i.Right=1]="Right",i[i.Bottom=2]="Bottom",i[i.Left=3]="Left"},139:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintDisplay=void 0;class i{}t.mintDisplay=i,t.default=i},376:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintEvent=void 0;class i{}t.mintEvent=i,t.default=i},683:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintMath=void 0;class i{static randomInt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t)+t)}}t.mintMath=i,t.default=i},982:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintObject=void 0;class i{static isSimilar(e,t){let i=Object.keys(e);return i.length===Object.keys(t).length&&(i.forEach((i=>{if(e[i]!==t[i])return!1})),!0)}static isSuperset(e,t){let a=!0;if(e===t)return a;try{if(0===Object.keys(t).length)return!a}catch(e){return!a}return Object.keys(t).forEach((n=>{a=a&&i.isSuperset(e[n],t[n])})),a}static remove(e,t){return Object.keys(e).reduce(((i,a)=>(t.includes(a)||(i[a]=e[a]),i)),{})}static sort(e){return Object.keys(e).sort().reduce(((t,i)=>(t[i]=e[i],t)),{})}static filter(e,t){return this.filterKeys(e,t)}static filterKeys(e,t){return t.reduce(((t,i)=>(t[i]=e[i],t)),{})}static filterValues(e,t){return Object.keys(e).reduce(((i,a)=>(t.includes(e[a])&&(i[a]=e[a]),i)),{})}}t.mintObject=i,t.default=i},226:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintText=void 0;class i{}t.mintText=i,t.default=i},505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintWindow=void 0;class i{}t.mintWindow=i,t.default=i},491:function(e,t,i){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.mintUtil=t.mintSettings=t.mintSelectors=t.mintWindow=t.mintText=t.mintObject=t.mintMath=t.mintEvent=t.mintDisplay=t.mintSide=t.mintColor=void 0;var n=i(731);Object.defineProperty(t,"mintColor",{enumerable:!0,get:function(){return n.mintColor}});var r=i(64);Object.defineProperty(t,"mintSide",{enumerable:!0,get:function(){return r.mintSide}});var s=i(139);Object.defineProperty(t,"mintDisplay",{enumerable:!0,get:function(){return s.mintDisplay}});var l=i(376);Object.defineProperty(t,"mintEvent",{enumerable:!0,get:function(){return l.mintEvent}});var o=i(683);Object.defineProperty(t,"mintMath",{enumerable:!0,get:function(){return o.mintMath}});var d=i(982);Object.defineProperty(t,"mintObject",{enumerable:!0,get:function(){return d.mintObject}});var u=i(226);Object.defineProperty(t,"mintText",{enumerable:!0,get:function(){return u.mintText}});var c=i(505);Object.defineProperty(t,"mintWindow",{enumerable:!0,get:function(){return c.mintWindow}});var h=i(565);Object.defineProperty(t,"mintSelectors",{enumerable:!0,get:function(){return h.mintSelectors}});var f=i(750);Object.defineProperty(t,"mintSettings",{enumerable:!0,get:function(){return f.mintSettings}});var m=i(427);Object.defineProperty(t,"mintUtil",{enumerable:!0,get:function(){return m.mintUtil}}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a(m).default}})},565:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSelectors=void 0;class a{static prefix(e){return(e=e.toLowerCase()).startsWith(this.pre)?e:`${this.pre}${e}`}static cssPrefix(e){return`--${this.prefix(e.replace(/^-+/,""))}`}static cssVar(e){return`var(${this.cssPrefix(e)})`}static neg(e){return`:not(${e})`}static class(e){return`.${this.prefix(e)}`}static id(e){return`#${this.prefix(e)}`}static controls(e){return e?`[aria-controls="${this.prefix(e)}"]`:this.hasControls}static expanded(e){return"boolean"==typeof e?`[aria-expanded="${e}"]`:this.hasExpanded}static getId(e){var t;return null!==(t=this.ids[null!=e?e:-1])&&void 0!==t?t:""}static getClass(e,t){var i,a;return t?null!==(i=this.classes[t][null!=e?e:-1])&&void 0!==i?i:"":null!==(a=this.classes[null!=e?e:-1])&&void 0!==a?a:""}static getFocusables(e){let t;return t=e?[...e.querySelectorAll(this.focusable)]:[...document.querySelectorAll(this.focusable)],t.filter((e=>this.isFocusable(e)))}static isFocusable(e){let t=e;do{if("none"===window.getComputedStyle(t).getPropertyValue("display").toLowerCase())return!1;t=t.parentElement}while(t);return!0}}t.mintSelectors=a,i=a,a.lib="mint",a.pre=`${i.lib}-`,a.disabled="[disabled]",a.hasControls="[aria-controls]",a.hasExpanded="[aria-expanded]",a.hasLink="[href]",a.hasRouterLink="[routerLink]",a.hasId="[id]",a.notTabbable='[tabindex^="-"]',a.tabbable=`[tabindex]${i.neg(i.notTabbable)}`,a.focusable=`input${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n select${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n textarea${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n button${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n object${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n a${i.hasLink}, a${i.hasRouterLink},\n area${i.hasLink},\n ${i.tabbable}`.replace(/\s/g,""),a.classes={sides:{top:i.prefix("top"),right:i.prefix("right"),bottom:i.prefix("bottom"),left:i.prefix("left")}},t.default=a},750:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSettings=void 0;class a{static set(e){let t=!1;"number"==typeof e.delayBase&&(this.delayBase=e.delayBase,t=!0),"number"==typeof e.delayStep&&(this.delayStep=e.delayStep,t=!0),t&&this.setDelay(),e.delay&&Object.keys(e.delay).length&&Object.values(e.delay).reduce(((e,t)=>e&&"number"==typeof t),!0)&&(this.delay=Object.assign(Object.assign({},this.delay),e.delay))}static setDelay(){this.delay={instant:this.delayBase+0*this.delayStep,fast:this.delayBase+1*this.delayStep,medFast:this.delayBase+2*this.delayStep,default:this.delayBase+3*this.delayStep,medSlow:this.delayBase+4*this.delayStep,slow:this.delayBase+5*this.delayStep}}}t.mintSettings=a,i=a,a.delayBase=0,a.delayStep=100,a.delay={instant:i.delayBase+0*i.delayStep,fast:i.delayBase+1*i.delayStep,medFast:i.delayBase+2*i.delayStep,default:i.delayBase+3*i.delayStep,medSlow:i.delayBase+4*i.delayStep,slow:i.delayBase+5*i.delayStep},t.default=a},427:function(e,t,i){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.mintUtil=void 0;const n=i(64),r=a(i(139)),s=a(i(376)),l=a(i(683)),o=a(i(982)),d=a(i(226)),u=a(i(505)),c=a(i(750));class h{static get display(){return r.default}static get event(){return s.default}static get math(){return l.default}static get object(){return o.default}static get text(){return d.default}static get window(){return u.default}static windowWidth(){let e=document.getElementsByTagName("body")[0].getBoundingClientRect().width%1;return window.innerWidth+e}static debounce(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default;return function(a){t&&clearTimeout(t),t=setTimeout(e,i,a)}}static debounceEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default;return h.debounce(e,t)}static throttle(e){let t,i,a,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,s=arguments.length>2?arguments[2]:void 0,l=0,o=function(){l=!1===(null==s?void 0:s.leading)?0:(new Date).getTime(),n=0,a=e.apply(t,i),n||(t=i=null)};return function(){let d=(new Date).getTime();l||!1!==(null==s?void 0:s.leading)||(l=d);let u=r-d+l;return t=this,i=arguments,u<=0||u>r?(n&&(clearTimeout(n),n=0),l=d,a=e.apply(t,i),n||(t=i=null)):n||!1===(null==s?void 0:s.trailing)||(n=window.setTimeout(o,u)),a}}static throttleEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,i=arguments.length>2?arguments[2]:void 0;return h.throttle(e,t,i)}static show(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.mintSide.Top;e&&(e.style.display="",requestAnimationFrame((()=>{i===n.mintSide.Top||i===n.mintSide.Bottom?e.style.height=`${e.scrollHeight}px`:e.style.width=`${e.scrollWidth}px`,setTimeout((()=>{i===n.mintSide.Top||i===n.mintSide.Bottom?e.style.height="auto":e.style.width="auto"}),t)})))}static hide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.mintSide.Top;if(e){let a=e.scrollHeight,r=e.scrollWidth,s=e.style.transition;e.style.transition="",requestAnimationFrame((()=>{i===n.mintSide.Top||i===n.mintSide.Bottom?e.style.height=`${a}px`:e.style.width=`${r}px`,e.style.transition=s,requestAnimationFrame((()=>{i===n.mintSide.Top||i===n.mintSide.Bottom?e.style.height="0":e.style.width="0"}))})),setTimeout((()=>{e.style.display="none"}),t)}}static copyText(e){let t=document.createElement("textarea");return!(!e||!t||(t.value=e,t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n transform: translate(-100%, -100%);\n opacity: 0;\n z-index: -1;\n ",document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),navigator.clipboard.writeText(t.value),document.body.removeChild(t),0))}static isEmail(e){return null!==e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}}t.mintUtil=h,t.default=h}},t={};return function i(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,i),r.exports}(491)})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mint=t():e.mint=t()}(self,(()=>(()=>{"use strict";var e={64:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSide=void 0,(i=t.mintSide||(t.mintSide={}))[i.Top=0]="Top",i[i.Right=1]="Right",i[i.Bottom=2]="Bottom",i[i.Left=3]="Left"},54:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintColor=void 0;class i{constructor(e){this.r="number"==typeof e.r?Math.max(Math.min(e.r,i.hexBase**2-1),0):0,this.g="number"==typeof e.g?Math.max(Math.min(e.g,i.hexBase**2-1),0):0,this.b="number"==typeof e.b?Math.max(Math.min(e.b,i.hexBase**2-1),0):0,this.a="number"==typeof e.a?Math.max(Math.min(e.a,1),0):1,"string"==typeof e.color&&this.stringConstructor(e.color)}stringConstructor(e){e.startsWith("#")?this.hexConstructor(e):(~e.indexOf("linear-gradient")&&(e=e.substring(e.indexOf("linear-gradient"),e.length)),this.rgbConstructor(e))}hexConstructor(e){switch(e.length){case 1:case 5:case 6:return;case 2:e="#"+e[1]+e[1]+e[1]+e[1]+e[1]+e[1]+i.hexMax;break;case 3:e="#"+e[1]+e[1]+e[1]+e[2]+e[2]+e[2]+i.hexMax;break;case 4:e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+i.hexMax;break;case 7:e+=i.hexMax;break;case 8:e+=e[e.length-1];break;default:e=e.substring(0,9)}this.r=parseInt(e.substring(1,3),i.hexBase),this.g=parseInt(e.substring(3,5),i.hexBase),this.b=parseInt(e.substring(5,7),i.hexBase),this.a=parseInt(e.substring(7,9),i.hexBase)/i.hexBase**2}rgbConstructor(e){let t=e.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);t&&(this.r=parseInt(t[1]),this.g=parseInt(t[2]),this.b=parseInt(t[3]),this.a=parseFloat(t[4]))}getBrightness(){return 0===this.a?262:isNaN(this.r)||isNaN(this.g)||isNaN(this.b)?-1:Math.round((299*this.r+587*this.g+144*this.b)/1e3)}}t.mintColor=i,i.hexBase=16,i.hexMax="FF",t.default=i},708:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintItem=void 0;class i{constructor(){this.version=0,this.priority=0,this.centered=!1,this.disabled=!1,this.queryParams={},this.attributes={},this.classes=[],this.buttons=[],this.images=[],this.children=[]}}t.mintItem=i,t.default=i},139:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintDisplay=void 0;class i{}t.mintDisplay=i,t.default=i},376:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintEvent=void 0;class i{}t.mintEvent=i,t.default=i},683:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintMath=void 0;class i{static randomInt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t)+t)}}t.mintMath=i,t.default=i},982:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintObject=void 0;class i{static isSimilar(e,t){let i=Object.keys(e);return i.length===Object.keys(t).length&&(i.forEach((i=>{if(e[i]!==t[i])return!1})),!0)}static isSuperset(e,t){let n=!0;if(e===t)return n;try{if(0===Object.keys(t).length)return!n}catch(e){return!n}return Object.keys(t).forEach((a=>{n=n&&i.isSuperset(e[a],t[a])})),n}static remove(e,t){return Object.keys(e).reduce(((i,n)=>(t.includes(n)||(i[n]=e[n]),i)),{})}static sort(e){return Object.keys(e).sort().reduce(((t,i)=>(t[i]=e[i],t)),{})}static filter(e,t){return this.filterKeys(e,t)}static filterKeys(e,t){return t.reduce(((t,i)=>(t[i]=e[i],t)),{})}static filterValues(e,t){return Object.keys(e).reduce(((i,n)=>(t.includes(e[n])&&(i[n]=e[n]),i)),{})}}t.mintObject=i,t.default=i},226:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintText=void 0;class i{}t.mintText=i,t.default=i},505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintWindow=void 0;class i{}t.mintWindow=i,t.default=i},491:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.mintUtil=t.mintSettings=t.mintSelectors=t.mintWindow=t.mintText=t.mintObject=t.mintMath=t.mintEvent=t.mintDisplay=t.mintItem=t.mintColor=t.mintSide=void 0;var a=i(64);Object.defineProperty(t,"mintSide",{enumerable:!0,get:function(){return a.mintSide}});var r=i(54);Object.defineProperty(t,"mintColor",{enumerable:!0,get:function(){return r.mintColor}});var s=i(708);Object.defineProperty(t,"mintItem",{enumerable:!0,get:function(){return s.mintItem}});var l=i(139);Object.defineProperty(t,"mintDisplay",{enumerable:!0,get:function(){return l.mintDisplay}});var o=i(376);Object.defineProperty(t,"mintEvent",{enumerable:!0,get:function(){return o.mintEvent}});var d=i(683);Object.defineProperty(t,"mintMath",{enumerable:!0,get:function(){return d.mintMath}});var u=i(982);Object.defineProperty(t,"mintObject",{enumerable:!0,get:function(){return u.mintObject}});var c=i(226);Object.defineProperty(t,"mintText",{enumerable:!0,get:function(){return c.mintText}});var h=i(505);Object.defineProperty(t,"mintWindow",{enumerable:!0,get:function(){return h.mintWindow}});var m=i(565);Object.defineProperty(t,"mintSelectors",{enumerable:!0,get:function(){return m.mintSelectors}});var b=i(750);Object.defineProperty(t,"mintSettings",{enumerable:!0,get:function(){return b.mintSettings}});var f=i(427);Object.defineProperty(t,"mintUtil",{enumerable:!0,get:function(){return f.mintUtil}}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n(f).default}})},565:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSelectors=void 0;class n{static prefix(e){return(e=e.toLowerCase()).startsWith(this.pre)?e:`${this.pre}${e}`}static cssPrefix(e){return`--${this.prefix(e.replace(/^-+/,""))}`}static cssVar(e){return`var(${this.cssPrefix(e)})`}static neg(e){return`:not(${e})`}static class(e){return`.${this.prefix(e)}`}static id(e){return`#${this.prefix(e)}`}static controls(e){return e?`[aria-controls="${this.prefix(e)}"]`:this.hasControls}static expanded(e){return"boolean"==typeof e?`[aria-expanded="${e}"]`:this.hasExpanded}static getId(e){var t;return null!==(t=this.ids[null!=e?e:-1])&&void 0!==t?t:""}static getClass(e,t){var i,n;return t?null!==(i=this.classes[t][null!=e?e:-1])&&void 0!==i?i:"":null!==(n=this.classes[null!=e?e:-1])&&void 0!==n?n:""}static getFocusables(e){let t;return t=e?[...e.querySelectorAll(this.focusable)]:[...document.querySelectorAll(this.focusable)],t.filter((e=>this.isFocusable(e)))}static isFocusable(e){let t=e;do{if("none"===window.getComputedStyle(t).getPropertyValue("display").toLowerCase())return!1;t=t.parentElement}while(t);return!0}}t.mintSelectors=n,i=n,n.lib="mint",n.pre=`${i.lib}-`,n.disabled="[disabled]",n.hasControls="[aria-controls]",n.hasExpanded="[aria-expanded]",n.hasLink="[href]",n.hasRouterLink="[routerLink]",n.hasId="[id]",n.notTabbable='[tabindex^="-"]',n.tabbable=`[tabindex]${i.neg(i.notTabbable)}`,n.focusable=`input${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n select${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n textarea${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n button${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n object${i.neg(i.disabled)}${i.neg(i.notTabbable)},\n a${i.hasLink}, a${i.hasRouterLink},\n area${i.hasLink},\n ${i.tabbable}`.replace(/\s/g,""),n.classes={sides:{top:i.prefix("top"),right:i.prefix("right"),bottom:i.prefix("bottom"),left:i.prefix("left")}},t.default=n},750:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSettings=void 0;class n{static set(e){let t=!1;"number"==typeof e.delayBase&&(this.delayBase=e.delayBase,t=!0),"number"==typeof e.delayStep&&(this.delayStep=e.delayStep,t=!0),t&&this.setDelay(),e.delay&&Object.keys(e.delay).length&&Object.values(e.delay).reduce(((e,t)=>e&&"number"==typeof t),!0)&&(this.delay=Object.assign(Object.assign({},this.delay),e.delay))}static setDelay(){this.delay={instant:this.delayBase+0*this.delayStep,fast:this.delayBase+1*this.delayStep,medFast:this.delayBase+2*this.delayStep,default:this.delayBase+3*this.delayStep,medSlow:this.delayBase+4*this.delayStep,slow:this.delayBase+5*this.delayStep}}}t.mintSettings=n,i=n,n.delayBase=0,n.delayStep=100,n.delay={instant:i.delayBase+0*i.delayStep,fast:i.delayBase+1*i.delayStep,medFast:i.delayBase+2*i.delayStep,default:i.delayBase+3*i.delayStep,medSlow:i.delayBase+4*i.delayStep,slow:i.delayBase+5*i.delayStep},t.default=n},427:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.mintUtil=void 0;const a=i(64),r=n(i(750));class s{static windowWidth(){let e=document.getElementsByTagName("body")[0].getBoundingClientRect().width%1;return window.innerWidth+e}static debounce(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default.delay.default;return function(n){t&&clearTimeout(t),t=setTimeout(e,i,n)}}static debounceEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default.delay.default;return s.debounce(e,t)}static throttle(e){let t,i,n,a,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default.delay.default,l=arguments.length>2?arguments[2]:void 0,o=0,d=function(){o=!1===(null==l?void 0:l.leading)?0:(new Date).getTime(),a=0,n=e.apply(t,i),a||(t=i=null)};return function(){let r=(new Date).getTime();o||!1!==(null==l?void 0:l.leading)||(o=r);let u=s-r+o;return t=this,i=arguments,u<=0||u>s?(a&&(clearTimeout(a),a=0),o=r,n=e.apply(t,i),a||(t=i=null)):a||!1===(null==l?void 0:l.trailing)||(a=window.setTimeout(d,u)),n}}static throttleEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default.delay.default,i=arguments.length>2?arguments[2]:void 0;return s.throttle(e,t,i)}static show(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.mintSide.Top;e&&(e.style.display="",requestAnimationFrame((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height=`${e.scrollHeight}px`:e.style.width=`${e.scrollWidth}px`,setTimeout((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height="auto":e.style.width="auto"}),t)})))}static hide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.mintSide.Top;if(e){let n=e.scrollHeight,r=e.scrollWidth,s=e.style.transition;e.style.transition="",requestAnimationFrame((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height=`${n}px`:e.style.width=`${r}px`,e.style.transition=s,requestAnimationFrame((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height="0":e.style.width="0"}))})),setTimeout((()=>{e.style.display="none"}),t)}}static copyText(e){let t=document.createElement("textarea");return!(!e||!t||(t.value=e,t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n transform: translate(-100%, -100%);\n opacity: 0;\n z-index: -1;\n ",document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),navigator.clipboard.writeText(t.value),document.body.removeChild(t),0))}static isEmail(e){return null!==e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}}t.mintUtil=s,t.default=s}},t={};return function i(n){var a=t[n];if(void 0!==a)return a.exports;var r=t[n]={exports:{}};return e[n].call(r.exports,r,r.exports,i),r.exports}(491)})())); | ||
//# sourceMappingURL=index.min.js.map |
@@ -90,2 +90,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}; | ||
; | ||
exports["default"] = mintSettings; | ||
@@ -92,0 +93,0 @@ })(); |
@@ -5,8 +5,2 @@ /** | ||
import { mintSide } from './imports/enum'; | ||
import mintDisplay from './imports/util/display'; | ||
import mintEvent from './imports/util/event'; | ||
import mintMath from './imports/util/math'; | ||
import mintObject from './imports/util/object'; | ||
import mintText from './imports/util/text'; | ||
import mintWindow from './imports/util/window'; | ||
/** | ||
@@ -18,11 +12,2 @@ * Utility functions | ||
/** | ||
* Sub-utility functions | ||
*/ | ||
static get display(): mintDisplay; | ||
static get event(): mintEvent; | ||
static get math(): mintMath; | ||
static get object(): mintObject; | ||
static get text(): mintText; | ||
static get window(): mintWindow; | ||
/** | ||
* Returns the width of the window, including fractional pixels | ||
@@ -29,0 +14,0 @@ * @returns the width of the window |
@@ -41,249 +41,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/***/ "./src/ts/imports/util/display.ts": | ||
/*!****************************************!*\ | ||
!*** ./src/ts/imports/util/display.ts ***! | ||
\****************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintDisplay = void 0; | ||
/** | ||
* Handles the display of elements | ||
*/ | ||
class mintDisplay {} | ||
exports.mintDisplay = mintDisplay; | ||
; | ||
exports["default"] = mintDisplay; | ||
/***/ }), | ||
/***/ "./src/ts/imports/util/event.ts": | ||
/*!**************************************!*\ | ||
!*** ./src/ts/imports/util/event.ts ***! | ||
\**************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintEvent = void 0; | ||
/** | ||
* Event helper functions | ||
*/ | ||
class mintEvent {} | ||
exports.mintEvent = mintEvent; | ||
; | ||
exports["default"] = mintEvent; | ||
/***/ }), | ||
/***/ "./src/ts/imports/util/math.ts": | ||
/*!*************************************!*\ | ||
!*** ./src/ts/imports/util/math.ts ***! | ||
\*************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintMath = void 0; | ||
/** | ||
* Math functions for the util library | ||
*/ | ||
class mintMath { | ||
/** | ||
* Get a random integer between min and max | ||
* @param max Maximum value to return | ||
* @param min Minimum value to return (default is 0) | ||
* @returns a random integer between min and max | ||
*/ | ||
static randomInt(max) { | ||
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
min = Math.ceil(min); | ||
max = Math.floor(max); | ||
return Math.floor(Math.random() * (max - min) + min); | ||
} | ||
} | ||
exports.mintMath = mintMath; | ||
; | ||
exports["default"] = mintMath; | ||
/***/ }), | ||
/***/ "./src/ts/imports/util/object.ts": | ||
/*!***************************************!*\ | ||
!*** ./src/ts/imports/util/object.ts ***! | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintObject = void 0; | ||
/** | ||
* Object functions for the util library | ||
*/ | ||
class mintObject { | ||
/** | ||
* Returns true if the provided objects have the same entries | ||
*/ | ||
static isSimilar(obj1, obj2) { | ||
let keys = Object.keys(obj1); | ||
if (keys.length !== Object.keys(obj2).length) { | ||
return false; | ||
} | ||
keys.forEach(key => { | ||
if (obj1[key] !== obj2[key]) { | ||
return false; | ||
} | ||
}); | ||
return true; | ||
} | ||
/** | ||
* Returns true if the first object has at least the same | ||
* entries as the second object | ||
* @param superset - the object to check | ||
* @param subset - the object whose entries are required | ||
* @returns - true if the first object is a superset of the second | ||
* @recursive | ||
*/ | ||
static isSuperset(superset, subset) { | ||
let isSuperset = true; | ||
// Base case - if the objects are equal, it is a superset | ||
if (superset === subset) { | ||
return isSuperset; | ||
} | ||
// If the subset isn't an object or array, and doesn't | ||
// satisfy the base case, it isn't a superset | ||
try { | ||
if (Object.keys(subset).length === 0) { | ||
return !isSuperset; | ||
} | ||
} | ||
// If the subset is null or undefined, and doesn't satisfy | ||
// the base case, it isn't a superset | ||
// TODO: Check if other exceptions could occur | ||
catch (e) { | ||
return !isSuperset; | ||
} | ||
// If the children of the subset are subsets of the | ||
// respective children of the superset, it is a superset | ||
Object.keys(subset).forEach(key => { | ||
isSuperset = isSuperset && mintObject.isSuperset(superset[key], subset[key]); | ||
}); | ||
return isSuperset; | ||
} | ||
/** | ||
* Removes object entries | ||
*/ | ||
static remove(object, keys) { | ||
return Object.keys(object).reduce((obj, key) => { | ||
if (!keys.includes(key)) { | ||
obj[key] = object[key]; | ||
} | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by key | ||
*/ | ||
static sort(object) { | ||
return Object.keys(object).sort().reduce((obj, key) => { | ||
obj[key] = object[key]; | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* @alias mintObject.filterKeys | ||
*/ | ||
static filter(object, keys) { | ||
return this.filterKeys(object, keys); | ||
} | ||
/** | ||
* Filters an object by its keys | ||
* @param object - the object to filter | ||
* @param keys - the keys to keep | ||
* @returns - the filtered object | ||
*/ | ||
static filterKeys(object, keys) { | ||
return keys.reduce((obj, key) => { | ||
obj[key] = object[key]; | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Filters an object by its values | ||
* @param object - the object to filter | ||
* @param values - the values to keep | ||
* @returns - the filtered object | ||
*/ | ||
static filterValues(object, values) { | ||
return Object.keys(object).reduce((obj, key) => { | ||
if (values.includes(object[key])) { | ||
obj[key] = object[key]; | ||
} | ||
return obj; | ||
}, {}); | ||
} | ||
} | ||
exports.mintObject = mintObject; | ||
; | ||
exports["default"] = mintObject; | ||
/***/ }), | ||
/***/ "./src/ts/imports/util/text.ts": | ||
/*!*************************************!*\ | ||
!*** ./src/ts/imports/util/text.ts ***! | ||
\*************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintText = void 0; | ||
/** | ||
* Functions for analyzing and manipulating text. | ||
*/ | ||
class mintText {} | ||
exports.mintText = mintText; | ||
; | ||
exports["default"] = mintText; | ||
/***/ }), | ||
/***/ "./src/ts/imports/util/window.ts": | ||
/*!***************************************!*\ | ||
!*** ./src/ts/imports/util/window.ts ***! | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintWindow = void 0; | ||
/** | ||
* Functions related to the browser window. | ||
*/ | ||
class mintWindow {} | ||
exports.mintWindow = mintWindow; | ||
; | ||
exports["default"] = mintWindow; | ||
/***/ }), | ||
/***/ "./src/ts/settings.ts": | ||
@@ -365,2 +118,3 @@ /*!****************************!*\ | ||
}; | ||
; | ||
exports["default"] = mintSettings; | ||
@@ -391,8 +145,2 @@ | ||
const enum_1 = __webpack_require__(/*! ./imports/enum */ "./src/ts/imports/enum.ts"); | ||
const display_1 = __importDefault(__webpack_require__(/*! ./imports/util/display */ "./src/ts/imports/util/display.ts")); | ||
const event_1 = __importDefault(__webpack_require__(/*! ./imports/util/event */ "./src/ts/imports/util/event.ts")); | ||
const math_1 = __importDefault(__webpack_require__(/*! ./imports/util/math */ "./src/ts/imports/util/math.ts")); | ||
const object_1 = __importDefault(__webpack_require__(/*! ./imports/util/object */ "./src/ts/imports/util/object.ts")); | ||
const text_1 = __importDefault(__webpack_require__(/*! ./imports/util/text */ "./src/ts/imports/util/text.ts")); | ||
const window_1 = __importDefault(__webpack_require__(/*! ./imports/util/window */ "./src/ts/imports/util/window.ts")); | ||
const settings_1 = __importDefault(__webpack_require__(/*! ./settings */ "./src/ts/settings.ts")); | ||
@@ -405,23 +153,2 @@ /** | ||
/** | ||
* Sub-utility functions | ||
*/ | ||
static get display() { | ||
return display_1.default; | ||
} | ||
static get event() { | ||
return event_1.default; | ||
} | ||
static get math() { | ||
return math_1.default; | ||
} | ||
static get object() { | ||
return object_1.default; | ||
} | ||
static get text() { | ||
return text_1.default; | ||
} | ||
static get window() { | ||
return window_1.default; | ||
} | ||
/** | ||
* Returns the width of the window, including fractional pixels | ||
@@ -428,0 +155,0 @@ * @returns the width of the window |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mintUtil=t():e.mintUtil=t()}(this,(()=>(()=>{"use strict";var e={64:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSide=void 0,(i=t.mintSide||(t.mintSide={}))[i.Top=0]="Top",i[i.Right=1]="Right",i[i.Bottom=2]="Bottom",i[i.Left=3]="Left"},139:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintDisplay=void 0;class i{}t.mintDisplay=i,t.default=i},376:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintEvent=void 0;class i{}t.mintEvent=i,t.default=i},683:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintMath=void 0;class i{static randomInt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t)+t)}}t.mintMath=i,t.default=i},982:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintObject=void 0;class i{static isSimilar(e,t){let i=Object.keys(e);return i.length===Object.keys(t).length&&(i.forEach((i=>{if(e[i]!==t[i])return!1})),!0)}static isSuperset(e,t){let a=!0;if(e===t)return a;try{if(0===Object.keys(t).length)return!a}catch(e){return!a}return Object.keys(t).forEach((l=>{a=a&&i.isSuperset(e[l],t[l])})),a}static remove(e,t){return Object.keys(e).reduce(((i,a)=>(t.includes(a)||(i[a]=e[a]),i)),{})}static sort(e){return Object.keys(e).sort().reduce(((t,i)=>(t[i]=e[i],t)),{})}static filter(e,t){return this.filterKeys(e,t)}static filterKeys(e,t){return t.reduce(((t,i)=>(t[i]=e[i],t)),{})}static filterValues(e,t){return Object.keys(e).reduce(((i,a)=>(t.includes(e[a])&&(i[a]=e[a]),i)),{})}}t.mintObject=i,t.default=i},226:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintText=void 0;class i{}t.mintText=i,t.default=i},505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mintWindow=void 0;class i{}t.mintWindow=i,t.default=i},750:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSettings=void 0;class a{static set(e){let t=!1;"number"==typeof e.delayBase&&(this.delayBase=e.delayBase,t=!0),"number"==typeof e.delayStep&&(this.delayStep=e.delayStep,t=!0),t&&this.setDelay(),e.delay&&Object.keys(e.delay).length&&Object.values(e.delay).reduce(((e,t)=>e&&"number"==typeof t),!0)&&(this.delay=Object.assign(Object.assign({},this.delay),e.delay))}static setDelay(){this.delay={instant:this.delayBase+0*this.delayStep,fast:this.delayBase+1*this.delayStep,medFast:this.delayBase+2*this.delayStep,default:this.delayBase+3*this.delayStep,medSlow:this.delayBase+4*this.delayStep,slow:this.delayBase+5*this.delayStep}}}t.mintSettings=a,i=a,a.delayBase=0,a.delayStep=100,a.delay={instant:i.delayBase+0*i.delayStep,fast:i.delayBase+1*i.delayStep,medFast:i.delayBase+2*i.delayStep,default:i.delayBase+3*i.delayStep,medSlow:i.delayBase+4*i.delayStep,slow:i.delayBase+5*i.delayStep},t.default=a},427:function(e,t,i){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.mintUtil=void 0;const l=i(64),d=a(i(139)),n=a(i(376)),s=a(i(683)),o=a(i(982)),r=a(i(226)),u=a(i(505)),c=a(i(750));class y{static get display(){return d.default}static get event(){return n.default}static get math(){return s.default}static get object(){return o.default}static get text(){return r.default}static get window(){return u.default}static windowWidth(){let e=document.getElementsByTagName("body")[0].getBoundingClientRect().width%1;return window.innerWidth+e}static debounce(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default;return function(a){t&&clearTimeout(t),t=setTimeout(e,i,a)}}static debounceEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default;return y.debounce(e,t)}static throttle(e){let t,i,a,l,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,n=arguments.length>2?arguments[2]:void 0,s=0,o=function(){s=!1===(null==n?void 0:n.leading)?0:(new Date).getTime(),l=0,a=e.apply(t,i),l||(t=i=null)};return function(){let r=(new Date).getTime();s||!1!==(null==n?void 0:n.leading)||(s=r);let u=d-r+s;return t=this,i=arguments,u<=0||u>d?(l&&(clearTimeout(l),l=0),s=r,a=e.apply(t,i),l||(t=i=null)):l||!1===(null==n?void 0:n.trailing)||(l=window.setTimeout(o,u)),a}}static throttleEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,i=arguments.length>2?arguments[2]:void 0;return y.throttle(e,t,i)}static show(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.mintSide.Top;e&&(e.style.display="",requestAnimationFrame((()=>{i===l.mintSide.Top||i===l.mintSide.Bottom?e.style.height=`${e.scrollHeight}px`:e.style.width=`${e.scrollWidth}px`,setTimeout((()=>{i===l.mintSide.Top||i===l.mintSide.Bottom?e.style.height="auto":e.style.width="auto"}),t)})))}static hide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.mintSide.Top;if(e){let a=e.scrollHeight,d=e.scrollWidth,n=e.style.transition;e.style.transition="",requestAnimationFrame((()=>{i===l.mintSide.Top||i===l.mintSide.Bottom?e.style.height=`${a}px`:e.style.width=`${d}px`,e.style.transition=n,requestAnimationFrame((()=>{i===l.mintSide.Top||i===l.mintSide.Bottom?e.style.height="0":e.style.width="0"}))})),setTimeout((()=>{e.style.display="none"}),t)}}static copyText(e){let t=document.createElement("textarea");return!(!e||!t||(t.value=e,t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n transform: translate(-100%, -100%);\n opacity: 0;\n z-index: -1;\n ",document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),navigator.clipboard.writeText(t.value),document.body.removeChild(t),0))}static isEmail(e){return null!==e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}}t.mintUtil=y,t.default=y}},t={},i=function i(a){var l=t[a];if(void 0!==l)return l.exports;var d=t[a]={exports:{}};return e[a].call(d.exports,d,d.exports,i),d.exports}(427);return i.default})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mintUtil=t():e.mintUtil=t()}(this,(()=>(()=>{"use strict";var e={64:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSide=void 0,(i=t.mintSide||(t.mintSide={}))[i.Top=0]="Top",i[i.Right=1]="Right",i[i.Bottom=2]="Bottom",i[i.Left=3]="Left"},750:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.mintSettings=void 0;class l{static set(e){let t=!1;"number"==typeof e.delayBase&&(this.delayBase=e.delayBase,t=!0),"number"==typeof e.delayStep&&(this.delayStep=e.delayStep,t=!0),t&&this.setDelay(),e.delay&&Object.keys(e.delay).length&&Object.values(e.delay).reduce(((e,t)=>e&&"number"==typeof t),!0)&&(this.delay=Object.assign(Object.assign({},this.delay),e.delay))}static setDelay(){this.delay={instant:this.delayBase+0*this.delayStep,fast:this.delayBase+1*this.delayStep,medFast:this.delayBase+2*this.delayStep,default:this.delayBase+3*this.delayStep,medSlow:this.delayBase+4*this.delayStep,slow:this.delayBase+5*this.delayStep}}}t.mintSettings=l,i=l,l.delayBase=0,l.delayStep=100,l.delay={instant:i.delayBase+0*i.delayStep,fast:i.delayBase+1*i.delayStep,medFast:i.delayBase+2*i.delayStep,default:i.delayBase+3*i.delayStep,medSlow:i.delayBase+4*i.delayStep,slow:i.delayBase+5*i.delayStep},t.default=l},427:function(e,t,i){var l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.mintUtil=void 0;const a=i(64),d=l(i(750));class n{static windowWidth(){let e=document.getElementsByTagName("body")[0].getBoundingClientRect().width%1;return window.innerWidth+e}static debounce(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default.delay.default;return function(l){t&&clearTimeout(t),t=setTimeout(e,i,l)}}static debounceEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default.delay.default;return n.debounce(e,t)}static throttle(e){let t,i,l,a,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default.delay.default,s=arguments.length>2?arguments[2]:void 0,o=0,y=function(){o=!1===(null==s?void 0:s.leading)?0:(new Date).getTime(),a=0,l=e.apply(t,i),a||(t=i=null)};return function(){let d=(new Date).getTime();o||!1!==(null==s?void 0:s.leading)||(o=d);let u=n-d+o;return t=this,i=arguments,u<=0||u>n?(a&&(clearTimeout(a),a=0),o=d,l=e.apply(t,i),a||(t=i=null)):a||!1===(null==s?void 0:s.trailing)||(a=window.setTimeout(y,u)),l}}static throttleEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default.delay.default,i=arguments.length>2?arguments[2]:void 0;return n.throttle(e,t,i)}static show(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.mintSide.Top;e&&(e.style.display="",requestAnimationFrame((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height=`${e.scrollHeight}px`:e.style.width=`${e.scrollWidth}px`,setTimeout((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height="auto":e.style.width="auto"}),t)})))}static hide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.mintSide.Top;if(e){let l=e.scrollHeight,d=e.scrollWidth,n=e.style.transition;e.style.transition="",requestAnimationFrame((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height=`${l}px`:e.style.width=`${d}px`,e.style.transition=n,requestAnimationFrame((()=>{i===a.mintSide.Top||i===a.mintSide.Bottom?e.style.height="0":e.style.width="0"}))})),setTimeout((()=>{e.style.display="none"}),t)}}static copyText(e){let t=document.createElement("textarea");return!(!e||!t||(t.value=e,t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n transform: translate(-100%, -100%);\n opacity: 0;\n z-index: -1;\n ",document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),navigator.clipboard.writeText(t.value),document.body.removeChild(t),0))}static isEmail(e){return null!==e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}}t.mintUtil=n,t.default=n}},t={},i=function i(l){var a=t[l];if(void 0!==a)return a.exports;var d=t[l]={exports:{}};return e[l].call(d.exports,d,d.exports,i),d.exports}(427);return i.default})())); | ||
//# sourceMappingURL=util.min.js.map |
{ | ||
"name": "@appartmint/util", | ||
"author": "App/Art Mint", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"license": "MIT", | ||
@@ -62,3 +62,3 @@ "description": "App/Art Mint Utility Functions", | ||
"build:tsdoc": "typedoc", | ||
"build:sassdoc": "sassdoc $npm_package_config_dirs_src/$npm_package_config_dirs_scss -p > $npm_package_config_dirs_doc/sassdoc.json", | ||
"build:sassdoc": "./node_modules/.bin/sassdoc $npm_package_config_dirs_src/$npm_package_config_dirs_scss -p > $npm_package_config_dirs_doc/sassdoc.json", | ||
"serve": "webpack serve --config $npm_package_config_webpack", | ||
@@ -65,0 +65,0 @@ "watch": "npm run build -- --watch", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
46
289382
2220