@appartmint/util
Advanced tools
Comparing version 1.0.0 to 2.0.0
/** | ||
* A generic item | ||
* @note - this class must be convertable with JSON | ||
* - only add strings, numbers, booleans, arrays, and objects | ||
* | ||
* @remarks | ||
* - this class must be convertable with JSON | ||
* - only add strings, numbers, booleans, arrays, and objects | ||
*/ | ||
@@ -6,0 +8,0 @@ export declare class MintItem { |
/** | ||
* Imports | ||
*/ | ||
import { EMintSide } from '../enums'; | ||
import { EMintSide } from '../enums/side'; | ||
/** | ||
@@ -6,0 +6,0 @@ * Handles the display of elements |
@@ -15,3 +15,2 @@ /** | ||
* @returns - true if the first object is a superset of the second | ||
* @recursive | ||
*/ | ||
@@ -21,3 +20,3 @@ static isSuperset(superset: any, subset: any): boolean; | ||
* Removes object entries by key | ||
* @alias mintObject.removeKeys | ||
* @see mintObject.removeKeys | ||
* @param object - the object to remove entries from | ||
@@ -50,3 +49,3 @@ * @param keys - the keys to remove | ||
/** | ||
* @alias mintObject.filterKeys | ||
* @see mintObject.filterKeys | ||
*/ | ||
@@ -81,3 +80,2 @@ static filter(object: any, keys: string[]): Object; | ||
* Create a deep copy of an object | ||
* @recursive | ||
*/ | ||
@@ -84,0 +82,0 @@ static deepClone(object: any): any; |
2568
dist/js/index.js
@@ -1,14 +0,2 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["mint"] = factory(); | ||
else | ||
root["mint"] = factory(); | ||
})(self, () => { | ||
return /******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ var __webpack_modules__ = ({ | ||
/******/ var __webpack_modules__ = ({ | ||
@@ -19,33 +7,15 @@ /***/ "./src/ts/imports/enums/index.ts": | ||
\***************************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { | ||
enumerable: true, | ||
get: function () { | ||
return m[k]; | ||
} | ||
}; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
} : function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
var __exportStar = this && this.__exportStar || function (m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ EMintSide: () => (/* reexport safe */ _side__WEBPACK_IMPORTED_MODULE_0__.EMintSide) | ||
/* harmony export */ }); | ||
/* harmony import */ var _side__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./side */ "./src/ts/imports/enums/side.ts"); | ||
/** | ||
* Forward all exports from the enums directory | ||
*/ | ||
__exportStar(__webpack_require__(/*! ./side */ "./src/ts/imports/enums/side.ts"), exports); | ||
/***/ }), | ||
@@ -57,10 +27,8 @@ | ||
\**************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.EMintSide = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ EMintSide: () => (/* binding */ EMintSide) | ||
/* harmony export */ }); | ||
/** | ||
@@ -71,9 +39,10 @@ * Side Enum | ||
(function (EMintSide) { | ||
EMintSide[EMintSide["Top"] = 0] = "Top"; | ||
EMintSide[EMintSide["Right"] = 1] = "Right"; | ||
EMintSide[EMintSide["Bottom"] = 2] = "Bottom"; | ||
EMintSide[EMintSide["Left"] = 3] = "Left"; | ||
})(EMintSide = exports.EMintSide || (exports.EMintSide = {})); | ||
EMintSide[EMintSide["Top"] = 0] = "Top"; | ||
EMintSide[EMintSide["Right"] = 1] = "Right"; | ||
EMintSide[EMintSide["Bottom"] = 2] = "Bottom"; | ||
EMintSide[EMintSide["Left"] = 3] = "Left"; | ||
})(EMintSide || (EMintSide = {})); | ||
; | ||
/***/ }), | ||
@@ -85,38 +54,36 @@ | ||
\*********************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ EMintSide: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_0__.EMintSide), | ||
/* harmony export */ MintAsync: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintAsync), | ||
/* harmony export */ MintDisplay: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintDisplay), | ||
/* harmony export */ MintEvent: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintEvent), | ||
/* harmony export */ MintIcon: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintIcon), | ||
/* harmony export */ MintItem: () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_1__.MintItem), | ||
/* harmony export */ MintList: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintList), | ||
/* harmony export */ MintMath: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintMath), | ||
/* harmony export */ MintObject: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintObject), | ||
/* harmony export */ MintScroll: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintScroll), | ||
/* harmony export */ MintSelectors: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintSelectors), | ||
/* harmony export */ MintSettings: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintSettings), | ||
/* harmony export */ MintText: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintText), | ||
/* harmony export */ MintWindow: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_2__.MintWindow), | ||
/* harmony export */ mintColor: () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_1__.mintColor) | ||
/* harmony export */ }); | ||
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enums */ "./src/ts/imports/enums/index.ts"); | ||
/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./models */ "./src/ts/imports/models/index.ts"); | ||
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ "./src/ts/imports/util/index.ts"); | ||
/** | ||
* Forward all imports | ||
*/ | ||
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { | ||
enumerable: true, | ||
get: function () { | ||
return m[k]; | ||
} | ||
}; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
} : function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
var __exportStar = this && this.__exportStar || function (m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
/** | ||
* Exports | ||
*/ | ||
__exportStar(__webpack_require__(/*! ./enums */ "./src/ts/imports/enums/index.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./models */ "./src/ts/imports/models/index.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./util */ "./src/ts/imports/util/index.ts"), exports); | ||
/***/ }), | ||
@@ -128,10 +95,9 @@ | ||
\****************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.mintColor = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), | ||
/* harmony export */ mintColor: () => (/* binding */ mintColor) | ||
/* harmony export */ }); | ||
/** | ||
@@ -141,86 +107,91 @@ * Color | ||
class mintColor { | ||
constructor(args) { | ||
this.r = typeof args.r === 'number' ? Math.max(Math.min(args.r, mintColor.hexBase ** 2 - 1), 0) : 0; | ||
this.g = typeof args.g === 'number' ? Math.max(Math.min(args.g, mintColor.hexBase ** 2 - 1), 0) : 0; | ||
this.b = typeof args.b === 'number' ? Math.max(Math.min(args.b, mintColor.hexBase ** 2 - 1), 0) : 0; | ||
this.a = typeof args.a === 'number' ? Math.max(Math.min(args.a, 1), 0) : 1; | ||
if (typeof args.color === 'string') { | ||
this.stringConstructor(args.color); | ||
static hexBase = 16; | ||
static hexMax = 'FF'; | ||
r; | ||
g; | ||
b; | ||
a; | ||
constructor(args) { | ||
this.r = typeof args.r === 'number' ? Math.max(Math.min(args.r, mintColor.hexBase ** 2 - 1), 0) : 0; | ||
this.g = typeof args.g === 'number' ? Math.max(Math.min(args.g, mintColor.hexBase ** 2 - 1), 0) : 0; | ||
this.b = typeof args.b === 'number' ? Math.max(Math.min(args.b, mintColor.hexBase ** 2 - 1), 0) : 0; | ||
this.a = typeof args.a === 'number' ? Math.max(Math.min(args.a, 1), 0) : 1; | ||
if (typeof args.color === 'string') { | ||
this.stringConstructor(args.color); | ||
} | ||
} | ||
} | ||
/** | ||
* Constructor from a string argument | ||
*/ | ||
stringConstructor(str) { | ||
if (str.startsWith('#')) { | ||
this.hexConstructor(str); | ||
} else { | ||
if (~str.indexOf('linear-gradient')) { | ||
str = str.substring(str.indexOf('linear-gradient'), str.length); | ||
} | ||
this.rgbConstructor(str); | ||
/** | ||
* Constructor from a string argument | ||
*/ | ||
stringConstructor(str) { | ||
if (str.startsWith('#')) { | ||
this.hexConstructor(str); | ||
} | ||
else { | ||
if (~str.indexOf('linear-gradient')) { | ||
str = str.substring(str.indexOf('linear-gradient'), str.length); | ||
} | ||
this.rgbConstructor(str); | ||
} | ||
} | ||
} | ||
/** | ||
* Constructor from a hex argument | ||
*/ | ||
hexConstructor(hex) { | ||
switch (hex.length) { | ||
case 1: | ||
case 5: | ||
case 6: | ||
return; | ||
case 2: | ||
hex = '#' + hex[1] + hex[1] + hex[1] + hex[1] + hex[1] + hex[1] + mintColor.hexMax; | ||
break; | ||
case 3: | ||
hex = '#' + hex[1] + hex[1] + hex[1] + hex[2] + hex[2] + hex[2] + mintColor.hexMax; | ||
break; | ||
case 4: | ||
hex = '#' + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3] + mintColor.hexMax; | ||
break; | ||
case 7: | ||
hex += mintColor.hexMax; | ||
break; | ||
case 8: | ||
hex += hex[hex.length - 1]; | ||
break; | ||
default: | ||
hex = hex.substring(0, 9); | ||
/** | ||
* Constructor from a hex argument | ||
*/ | ||
hexConstructor(hex) { | ||
switch (hex.length) { | ||
case 1: | ||
case 5: | ||
case 6: | ||
return; | ||
case 2: | ||
hex = '#' + hex[1] + hex[1] + hex[1] + hex[1] + hex[1] + hex[1] + mintColor.hexMax; | ||
break; | ||
case 3: | ||
hex = '#' + hex[1] + hex[1] + hex[1] + hex[2] + hex[2] + hex[2] + mintColor.hexMax; | ||
break; | ||
case 4: | ||
hex = '#' + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3] + mintColor.hexMax; | ||
break; | ||
case 7: | ||
hex += mintColor.hexMax; | ||
break; | ||
case 8: | ||
hex += hex[hex.length - 1]; | ||
break; | ||
default: | ||
hex = hex.substring(0, 9); | ||
} | ||
this.r = parseInt(hex.substring(1, 3), mintColor.hexBase); | ||
this.g = parseInt(hex.substring(3, 5), mintColor.hexBase); | ||
this.b = parseInt(hex.substring(5, 7), mintColor.hexBase); | ||
this.a = parseInt(hex.substring(7, 9), mintColor.hexBase) / mintColor.hexBase ** 2; | ||
} | ||
this.r = parseInt(hex.substring(1, 3), mintColor.hexBase); | ||
this.g = parseInt(hex.substring(3, 5), mintColor.hexBase); | ||
this.b = parseInt(hex.substring(5, 7), mintColor.hexBase); | ||
this.a = parseInt(hex.substring(7, 9), mintColor.hexBase) / mintColor.hexBase ** 2; | ||
} | ||
/** | ||
* Constructor from an rgba argument | ||
*/ | ||
rgbConstructor(rgb) { | ||
let match = rgb.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/); | ||
if (match) { | ||
this.r = parseInt(match[1]); | ||
this.g = parseInt(match[2]); | ||
this.b = parseInt(match[3]); | ||
this.a = parseFloat(match[4]); | ||
/** | ||
* Constructor from an rgba argument | ||
*/ | ||
rgbConstructor(rgb) { | ||
let match = rgb.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/); | ||
if (match) { | ||
this.r = parseInt(match[1]); | ||
this.g = parseInt(match[2]); | ||
this.b = parseInt(match[3]); | ||
this.a = parseFloat(match[4]); | ||
} | ||
} | ||
} | ||
/** | ||
* Returns the perceived brightness of the color | ||
*/ | ||
getBrightness() { | ||
if (this.a === 0) { | ||
return 262; | ||
/** | ||
* Returns the perceived brightness of the color | ||
*/ | ||
getBrightness() { | ||
if (this.a === 0) { | ||
return 262; | ||
} | ||
if (!isNaN(this.r) && !isNaN(this.g) && !isNaN(this.b)) { | ||
return Math.round((this.r * 299 + this.g * 587 + this.b * 144) / 1000); | ||
} | ||
return -1; | ||
} | ||
if (!isNaN(this.r) && !isNaN(this.g) && !isNaN(this.b)) { | ||
return Math.round((this.r * 299 + this.g * 587 + this.b * 144) / 1000); | ||
} | ||
return -1; | ||
} | ||
} | ||
exports.mintColor = mintColor; | ||
mintColor.hexBase = 16; | ||
mintColor.hexMax = 'FF'; | ||
exports["default"] = mintColor; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mintColor); | ||
/***/ }), | ||
@@ -232,9 +203,7 @@ | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
__webpack_require__.r(__webpack_exports__); | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
@@ -247,38 +216,26 @@ /***/ }), | ||
\****************************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { | ||
enumerable: true, | ||
get: function () { | ||
return m[k]; | ||
} | ||
}; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
} : function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
var __exportStar = this && this.__exportStar || function (m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintItem: () => (/* reexport safe */ _item__WEBPACK_IMPORTED_MODULE_2__.MintItem), | ||
/* harmony export */ mintColor: () => (/* reexport safe */ _color__WEBPACK_IMPORTED_MODULE_0__.mintColor) | ||
/* harmony export */ }); | ||
/* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./color */ "./src/ts/imports/models/color.ts"); | ||
/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./file */ "./src/ts/imports/models/file.ts"); | ||
/* harmony import */ var _item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./item */ "./src/ts/imports/models/item.ts"); | ||
/* harmony import */ var _minify__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./minify */ "./src/ts/imports/models/minify.ts"); | ||
/* harmony import */ var _page__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./page */ "./src/ts/imports/models/page.ts"); | ||
/* harmony import */ var _recaptcha__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./recaptcha */ "./src/ts/imports/models/recaptcha.ts"); | ||
/** | ||
* Forward all exports from the models directory | ||
*/ | ||
__exportStar(__webpack_require__(/*! ./color */ "./src/ts/imports/models/color.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./file */ "./src/ts/imports/models/file.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./item */ "./src/ts/imports/models/item.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./minify */ "./src/ts/imports/models/minify.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./page */ "./src/ts/imports/models/page.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./recaptcha */ "./src/ts/imports/models/recaptcha.ts"), exports); | ||
/***/ }), | ||
@@ -290,53 +247,80 @@ | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintItem = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintItem: () => (/* binding */ MintItem), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
* A generic item | ||
* @note - this class must be convertable with JSON | ||
* - only add strings, numbers, booleans, arrays, and objects | ||
* | ||
* @remarks | ||
* - this class must be convertable with JSON | ||
* - only add strings, numbers, booleans, arrays, and objects | ||
*/ | ||
class MintItem { | ||
constructor() { | ||
/** | ||
* Item settings | ||
*/ | ||
this.version = 0; | ||
this.priority = 0; | ||
this.price = 0; | ||
this.level = 0; | ||
this.size = 0; | ||
this.num = 0; | ||
this.width = 0; | ||
this.height = 0; | ||
this.active = false; | ||
this.centered = false; | ||
this.disabled = false; | ||
this.private = false; | ||
version = 0; | ||
priority = 0; | ||
price = 0; | ||
level = 0; | ||
size = 0; | ||
num = 0; | ||
width = 0; | ||
height = 0; | ||
active = false; | ||
centered = false; | ||
disabled = false; | ||
private = false; | ||
/** | ||
* Item properties | ||
*/ | ||
id; | ||
slug; | ||
name; | ||
title; | ||
subtitle; | ||
description; | ||
category; | ||
type; | ||
unit; | ||
logo; | ||
icon; | ||
position; | ||
transform; | ||
date; | ||
/** | ||
* Item links | ||
*/ | ||
src; | ||
href; | ||
target; | ||
routerLink; | ||
/** | ||
* Item data | ||
*/ | ||
this.attr = {}; | ||
this.params = {}; | ||
this.options = {}; | ||
this.lists = {}; | ||
attr = {}; | ||
params = {}; | ||
options = {}; | ||
lists = {}; | ||
/** | ||
* Item lists | ||
*/ | ||
this.paragraphs = []; | ||
this.classes = []; | ||
this.items = []; | ||
this.images = []; | ||
this.buttons = []; | ||
} | ||
paragraphs = []; | ||
classes = []; | ||
items = []; | ||
images = []; | ||
buttons = []; | ||
/** | ||
* Item functions | ||
*/ | ||
click; | ||
} | ||
exports.MintItem = MintItem; | ||
; | ||
exports["default"] = MintItem; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintItem); | ||
/***/ }), | ||
@@ -348,9 +332,7 @@ | ||
\*****************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
__webpack_require__.r(__webpack_exports__); | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
@@ -363,9 +345,7 @@ /***/ }), | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
__webpack_require__.r(__webpack_exports__); | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
@@ -378,10 +358,8 @@ /***/ }), | ||
\********************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
__webpack_require__.r(__webpack_exports__); | ||
; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
; | ||
@@ -394,10 +372,9 @@ /***/ }), | ||
\**************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintAsync = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintAsync: () => (/* binding */ MintAsync), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -407,13 +384,13 @@ * Handles asynchronous operations | ||
class MintAsync { | ||
/** | ||
* Wait n milliseconds | ||
*/ | ||
static wait(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
/** | ||
* Wait n milliseconds | ||
*/ | ||
static wait(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
} | ||
exports.MintAsync = MintAsync; | ||
; | ||
exports["default"] = MintAsync; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintAsync); | ||
/***/ }), | ||
@@ -425,15 +402,16 @@ | ||
\****************************************/ | ||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintDisplay = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintDisplay: () => (/* binding */ MintDisplay), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/* harmony import */ var _enums_side__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums/side */ "./src/ts/imports/enums/side.ts"); | ||
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./settings */ "./src/ts/imports/util/settings.ts"); | ||
/** | ||
* Imports | ||
*/ | ||
const enums_1 = __webpack_require__(/*! ../enums */ "./src/ts/imports/enums/index.ts"); | ||
const settings_1 = __webpack_require__(/*! ./settings */ "./src/ts/imports/util/settings.ts"); | ||
/** | ||
@@ -443,68 +421,66 @@ * Handles the display of elements | ||
class MintDisplay { | ||
/** | ||
* Sets the element's height to its `innerHeight`, then to `auto` after a delay | ||
* @param el - the element whose height will be set | ||
* @param delay - the amount of time in milliseconds that the show animation will be active | ||
* @param from - the side that the element is animating from | ||
*/ | ||
static show(el) { | ||
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.MintSettings.delay.default; | ||
let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : enums_1.EMintSide.Top; | ||
if (el) { | ||
el.style.display = ''; | ||
requestAnimationFrame(() => { | ||
if (from === enums_1.EMintSide.Top || from === enums_1.EMintSide.Bottom) { | ||
el.style.height = `${el.scrollHeight}px`; | ||
} else { | ||
el.style.width = `${el.scrollWidth}px`; | ||
/** | ||
* Sets the element's height to its `innerHeight`, then to `auto` after a delay | ||
* @param el - the element whose height will be set | ||
* @param delay - the amount of time in milliseconds that the show animation will be active | ||
* @param from - the side that the element is animating from | ||
*/ | ||
static show(el, delay = _settings__WEBPACK_IMPORTED_MODULE_1__.MintSettings.delay.default, from = _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Top) { | ||
if (el) { | ||
el.style.display = ''; | ||
requestAnimationFrame(() => { | ||
if (from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Top || from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Bottom) { | ||
el.style.height = `${el.scrollHeight}px`; | ||
} | ||
else { | ||
el.style.width = `${el.scrollWidth}px`; | ||
} | ||
setTimeout(() => { | ||
if (from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Top || from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Bottom) { | ||
el.style.height = 'auto'; | ||
} | ||
else { | ||
el.style.width = 'auto'; | ||
} | ||
}, delay); | ||
}); | ||
} | ||
setTimeout(() => { | ||
if (from === enums_1.EMintSide.Top || from === enums_1.EMintSide.Bottom) { | ||
el.style.height = 'auto'; | ||
} else { | ||
el.style.width = 'auto'; | ||
} | ||
}, delay); | ||
}); | ||
} | ||
} | ||
/** | ||
* Sets the element's height to 0 | ||
* @param el - the element whose height will be set | ||
* @param delay - the amount of time in milliseconds that the show animation will be active | ||
* @param from - the side that the element is animating from | ||
*/ | ||
static hide(el) { | ||
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.MintSettings.delay.default; | ||
let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : enums_1.EMintSide.Top; | ||
if (el) { | ||
let height = el.scrollHeight, | ||
width = el.scrollWidth, | ||
transition = el.style.transition; | ||
el.style.transition = ''; | ||
requestAnimationFrame(() => { | ||
if (from === enums_1.EMintSide.Top || from === enums_1.EMintSide.Bottom) { | ||
el.style.height = `${height}px`; | ||
} else { | ||
el.style.width = `${width}px`; | ||
/** | ||
* Sets the element's height to 0 | ||
* @param el - the element whose height will be set | ||
* @param delay - the amount of time in milliseconds that the show animation will be active | ||
* @param from - the side that the element is animating from | ||
*/ | ||
static hide(el, delay = _settings__WEBPACK_IMPORTED_MODULE_1__.MintSettings.delay.default, from = _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Top) { | ||
if (el) { | ||
let height = el.scrollHeight, width = el.scrollWidth, transition = el.style.transition; | ||
el.style.transition = ''; | ||
requestAnimationFrame(() => { | ||
if (from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Top || from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Bottom) { | ||
el.style.height = `${height}px`; | ||
} | ||
else { | ||
el.style.width = `${width}px`; | ||
} | ||
el.style.transition = transition; | ||
requestAnimationFrame(() => { | ||
if (from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Top || from === _enums_side__WEBPACK_IMPORTED_MODULE_0__.EMintSide.Bottom) { | ||
el.style.height = '0'; | ||
} | ||
else { | ||
el.style.width = '0'; | ||
} | ||
}); | ||
}); | ||
setTimeout(() => { | ||
el.style.display = 'none'; | ||
}, delay); | ||
} | ||
el.style.transition = transition; | ||
requestAnimationFrame(() => { | ||
if (from === enums_1.EMintSide.Top || from === enums_1.EMintSide.Bottom) { | ||
el.style.height = '0'; | ||
} else { | ||
el.style.width = '0'; | ||
} | ||
}); | ||
}); | ||
setTimeout(() => { | ||
el.style.display = 'none'; | ||
}, delay); | ||
} | ||
} | ||
} | ||
exports.MintDisplay = MintDisplay; | ||
; | ||
exports["default"] = MintDisplay; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintDisplay); | ||
/***/ }), | ||
@@ -516,16 +492,11 @@ | ||
\**************************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintEvent: () => (/* binding */ MintEvent), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./settings */ "./src/ts/imports/util/settings.ts"); | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintEvent = void 0; | ||
const settings_1 = __importDefault(__webpack_require__(/*! ./settings */ "./src/ts/imports/util/settings.ts")); | ||
/** | ||
@@ -535,93 +506,82 @@ * Event helper functions | ||
class MintEvent { | ||
/** | ||
* Ensures that a function `func` is run only after not being called for `wait` milliseconds | ||
* @param func - the function to debounce | ||
* @param wait - the amount of time to wait before running the function | ||
* @returns - the debounced function | ||
*/ | ||
static debounce(func) { | ||
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default; | ||
let timer; | ||
return function (e) { | ||
if (timer) { | ||
clearTimeout(timer); | ||
} | ||
timer = setTimeout(func, wait, e); | ||
}; | ||
} | ||
/** | ||
* Ensures that a function `func` is run only after not being called for `wait` milliseconds | ||
* @param func - the function to debounce | ||
* @param wait - the amount of time to wait before running the function | ||
* @returns - the debounced function as an EventListener | ||
*/ | ||
static debounceEvent(func) { | ||
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default; | ||
return MintEvent.debounce(func, wait); | ||
} | ||
/** | ||
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls | ||
* @param func - the function to throttle | ||
* @param wait - the amount of time between function calls | ||
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \} | ||
* @returns - the throttled function | ||
*/ | ||
static throttle(func) { | ||
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default; | ||
let options = arguments.length > 2 ? arguments[2] : undefined; | ||
let context, | ||
args, | ||
result, | ||
timeout, | ||
previous = 0, | ||
later = function () { | ||
previous = (options === null || options === void 0 ? void 0 : options.leading) === false ? 0 : new Date().getTime(); | ||
timeout = 0; | ||
result = func.apply(context, args); | ||
if (!timeout) { | ||
context = args = null; | ||
} | ||
}, | ||
throttled = function () { | ||
let now = new Date().getTime(); | ||
if (!previous && (options === null || options === void 0 ? void 0 : options.leading) === false) { | ||
previous = now; | ||
} | ||
let remaining = wait - now + previous; | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0 || remaining > wait) { | ||
if (timeout) { | ||
clearTimeout(timeout); | ||
/** | ||
* Ensures that a function `func` is run only after not being called for `wait` milliseconds | ||
* @param func - the function to debounce | ||
* @param wait - the amount of time to wait before running the function | ||
* @returns - the debounced function | ||
*/ | ||
static debounce(func, wait = _settings__WEBPACK_IMPORTED_MODULE_0__["default"].delay.default) { | ||
let timer; | ||
return function (e) { | ||
if (timer) { | ||
clearTimeout(timer); | ||
} | ||
timer = setTimeout(func, wait, e); | ||
}; | ||
} | ||
/** | ||
* Ensures that a function `func` is run only after not being called for `wait` milliseconds | ||
* @param func - the function to debounce | ||
* @param wait - the amount of time to wait before running the function | ||
* @returns - the debounced function as an EventListener | ||
*/ | ||
static debounceEvent(func, wait = _settings__WEBPACK_IMPORTED_MODULE_0__["default"].delay.default) { | ||
return MintEvent.debounce(func, wait); | ||
} | ||
/** | ||
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls | ||
* @param func - the function to throttle | ||
* @param wait - the amount of time between function calls | ||
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \} | ||
* @returns - the throttled function | ||
*/ | ||
static throttle(func, wait = _settings__WEBPACK_IMPORTED_MODULE_0__["default"].delay.default, options) { | ||
let context, args, result, timeout, previous = 0, later = function () { | ||
previous = options?.leading === false ? 0 : new Date().getTime(); | ||
timeout = 0; | ||
} | ||
previous = now; | ||
result = func.apply(context, args); | ||
if (!timeout) { | ||
context = args = null; | ||
} | ||
} else if (!timeout && (options === null || options === void 0 ? void 0 : options.trailing) !== false) { | ||
timeout = window.setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
return throttled; | ||
} | ||
/** | ||
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls | ||
* @param func - the function to throttle | ||
* @param wait - the amount of time between function calls | ||
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \} | ||
* @returns - the throttled function as an EventListener | ||
*/ | ||
static throttleEvent(func) { | ||
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : settings_1.default.delay.default; | ||
let options = arguments.length > 2 ? arguments[2] : undefined; | ||
return MintEvent.throttle(func, wait, options); | ||
} | ||
result = func.apply(context, args); | ||
if (!timeout) { | ||
context = args = null; | ||
} | ||
}, throttled = function () { | ||
let now = new Date().getTime(); | ||
if (!previous && options?.leading === false) { | ||
previous = now; | ||
} | ||
let remaining = wait - now + previous; | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0 || remaining > wait) { | ||
if (timeout) { | ||
clearTimeout(timeout); | ||
timeout = 0; | ||
} | ||
previous = now; | ||
result = func.apply(context, args); | ||
if (!timeout) { | ||
context = args = null; | ||
} | ||
} | ||
else if (!timeout && options?.trailing !== false) { | ||
timeout = window.setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
return throttled; | ||
} | ||
/** | ||
* Ensures that a function `func` is called at most every `wait` milliseconds with optional leading and trailing calls | ||
* @param func - the function to throttle | ||
* @param wait - the amount of time between function calls | ||
* @param options - leading and trailing options: default = \{ leading: true, trailing, true \} | ||
* @returns - the throttled function as an EventListener | ||
*/ | ||
static throttleEvent(func, wait = _settings__WEBPACK_IMPORTED_MODULE_0__["default"].delay.default, options) { | ||
return MintEvent.throttle(func, wait, options); | ||
} | ||
} | ||
exports.MintEvent = MintEvent; | ||
; | ||
exports["default"] = MintEvent; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintEvent); | ||
/***/ }), | ||
@@ -633,19 +593,14 @@ | ||
\*************************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintIcon = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintIcon: () => (/* binding */ MintIcon), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/* harmony import */ var _object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts"); | ||
/** | ||
* Imports | ||
*/ | ||
const object_1 = __importDefault(__webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts")); | ||
/** | ||
@@ -655,56 +610,59 @@ * Icon helper functions | ||
class MintIcon { | ||
/** | ||
* Appends the given icon to the given selector if there is not already an icon appended | ||
*/ | ||
static append(icon, selector) { | ||
let items = document.querySelectorAll(selector); | ||
items.forEach(item => { | ||
let iconElement = document.createElement('i'); | ||
iconElement.classList.add(...icon.split(' ')); | ||
if (!item.querySelector('i')) { | ||
item.appendChild(iconElement); | ||
} | ||
if (iconElement.classList.contains('fa-up-right-from-square')) { | ||
item.setAttribute('target', '_blank'); | ||
} | ||
}); | ||
} | ||
/** | ||
* Updates the icons | ||
* @param icons - the icons to update | ||
*/ | ||
static update(icons) { | ||
let activeIcons = object_1.default.removeValues(Object.assign(Object.assign({}, this.icons), icons), [false]); | ||
Object.keys(activeIcons).forEach(selector => { | ||
this.append(activeIcons[selector], selector); | ||
}); | ||
} | ||
/** | ||
* Removes the given icon from the given selector | ||
* @param icon - the icon to remove | ||
*/ | ||
static remove(icon, selector) { | ||
let items = document.querySelectorAll(selector); | ||
items.forEach(item => { | ||
let iconElement = item.querySelector('i'); | ||
if (iconElement) { | ||
iconElement.remove(); | ||
} | ||
}); | ||
} | ||
/** | ||
* Default icons | ||
*/ | ||
static icons = { | ||
'a[href^="mailto:"]': 'far fa-envelope', | ||
'a[href^="tel:"]': 'fas fa-phone-flip', | ||
'a[href^="sms:"]': 'far fa-message', | ||
'a[href^="https://maps"]': 'fas fa-map-location-dot', | ||
'a[href^="http"]': 'fas fa-up-right-from-square' | ||
}; | ||
/** | ||
* Appends the given icon to the given selector if there is not already an icon appended | ||
*/ | ||
static append(icon, selector) { | ||
let items = document.querySelectorAll(selector); | ||
items.forEach((item) => { | ||
let iconElement = document.createElement('i'); | ||
iconElement.classList.add(...icon.split(' ')); | ||
if (!item.querySelector('i')) { | ||
item.appendChild(iconElement); | ||
} | ||
if (iconElement.classList.contains('fa-up-right-from-square')) { | ||
item.setAttribute('target', '_blank'); | ||
} | ||
}); | ||
} | ||
/** | ||
* Updates the icons | ||
* @param icons - the icons to update | ||
*/ | ||
static update(icons) { | ||
let activeIcons = _object__WEBPACK_IMPORTED_MODULE_0__["default"].removeValues({ | ||
...this.icons, | ||
...icons | ||
}, [false]); | ||
Object.keys(activeIcons).forEach((selector) => { | ||
this.append(activeIcons[selector], selector); | ||
}); | ||
} | ||
/** | ||
* Removes the given icon from the given selector | ||
* @param icon - the icon to remove | ||
*/ | ||
static remove(icon, selector) { | ||
let items = document.querySelectorAll(selector); | ||
items.forEach((item) => { | ||
let iconElement = item.querySelector('i'); | ||
if (iconElement) { | ||
iconElement.remove(); | ||
} | ||
}); | ||
} | ||
} | ||
exports.MintIcon = MintIcon; | ||
/** | ||
* Default icons | ||
*/ | ||
MintIcon.icons = { | ||
'a[href^="mailto:"]': 'far fa-envelope', | ||
'a[href^="tel:"]': 'fas fa-phone-flip', | ||
'a[href^="sms:"]': 'far fa-message', | ||
'a[href^="https://maps"]': 'fas fa-map-location-dot', | ||
'a[href^="http"]': 'fas fa-up-right-from-square' | ||
}; | ||
; | ||
exports["default"] = MintIcon; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintIcon); | ||
/***/ }), | ||
@@ -716,44 +674,48 @@ | ||
\**************************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { | ||
enumerable: true, | ||
get: function () { | ||
return m[k]; | ||
} | ||
}; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
} : function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
var __exportStar = this && this.__exportStar || function (m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.MintAsync), | ||
/* harmony export */ MintDisplay: () => (/* reexport safe */ _display__WEBPACK_IMPORTED_MODULE_1__.MintDisplay), | ||
/* harmony export */ MintEvent: () => (/* reexport safe */ _event__WEBPACK_IMPORTED_MODULE_2__.MintEvent), | ||
/* harmony export */ MintIcon: () => (/* reexport safe */ _icon__WEBPACK_IMPORTED_MODULE_3__.MintIcon), | ||
/* harmony export */ MintList: () => (/* reexport safe */ _list__WEBPACK_IMPORTED_MODULE_4__.MintList), | ||
/* harmony export */ MintMath: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_5__.MintMath), | ||
/* harmony export */ MintObject: () => (/* reexport safe */ _object__WEBPACK_IMPORTED_MODULE_6__.MintObject), | ||
/* harmony export */ MintScroll: () => (/* reexport safe */ _scroll__WEBPACK_IMPORTED_MODULE_7__.MintScroll), | ||
/* harmony export */ MintSelectors: () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_8__.MintSelectors), | ||
/* harmony export */ MintSettings: () => (/* reexport safe */ _settings__WEBPACK_IMPORTED_MODULE_9__.MintSettings), | ||
/* harmony export */ MintText: () => (/* reexport safe */ _text__WEBPACK_IMPORTED_MODULE_10__.MintText), | ||
/* harmony export */ MintWindow: () => (/* reexport safe */ _window__WEBPACK_IMPORTED_MODULE_11__.MintWindow) | ||
/* harmony export */ }); | ||
/* harmony import */ var _async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./async */ "./src/ts/imports/util/async.ts"); | ||
/* harmony import */ var _display__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./display */ "./src/ts/imports/util/display.ts"); | ||
/* harmony import */ var _event__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./event */ "./src/ts/imports/util/event.ts"); | ||
/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./icon */ "./src/ts/imports/util/icon.ts"); | ||
/* harmony import */ var _list__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./list */ "./src/ts/imports/util/list.ts"); | ||
/* harmony import */ var _math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./math */ "./src/ts/imports/util/math.ts"); | ||
/* harmony import */ var _object__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts"); | ||
/* harmony import */ var _scroll__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./scroll */ "./src/ts/imports/util/scroll.ts"); | ||
/* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./selectors */ "./src/ts/imports/util/selectors.ts"); | ||
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settings */ "./src/ts/imports/util/settings.ts"); | ||
/* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./text */ "./src/ts/imports/util/text.ts"); | ||
/* harmony import */ var _window__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./window */ "./src/ts/imports/util/window.ts"); | ||
/** | ||
* Forward all exports from the util directory | ||
*/ | ||
__exportStar(__webpack_require__(/*! ./async */ "./src/ts/imports/util/async.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./display */ "./src/ts/imports/util/display.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./event */ "./src/ts/imports/util/event.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./icon */ "./src/ts/imports/util/icon.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./list */ "./src/ts/imports/util/list.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./math */ "./src/ts/imports/util/math.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./object */ "./src/ts/imports/util/object.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./scroll */ "./src/ts/imports/util/scroll.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./selectors */ "./src/ts/imports/util/selectors.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./settings */ "./src/ts/imports/util/settings.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./text */ "./src/ts/imports/util/text.ts"), exports); | ||
__exportStar(__webpack_require__(/*! ./window */ "./src/ts/imports/util/window.ts"), exports); | ||
/***/ }), | ||
@@ -765,10 +727,9 @@ | ||
\*************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintList = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintList: () => (/* binding */ MintList), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -778,39 +739,39 @@ * List functions for the util library | ||
class MintList { | ||
/** | ||
* Returns a copy of the provided list with the items in random order | ||
* @param list - the list to shuffle | ||
* @returns - the shuffled list | ||
*/ | ||
static shuffleCopy(list) { | ||
let copy = [...list]; | ||
for (let i = copy.length - 1; i > 0; i--) { | ||
const j = Math.floor(Math.random() * (i + 1)); | ||
[copy[i], copy[j]] = [copy[j], copy[i]]; | ||
/** | ||
* Returns a copy of the provided list with the items in random order | ||
* @param list - the list to shuffle | ||
* @returns - the shuffled list | ||
*/ | ||
static shuffleCopy(list) { | ||
let copy = [...list]; | ||
for (let i = copy.length - 1; i > 0; i--) { | ||
const j = Math.floor(Math.random() * (i + 1)); | ||
[copy[i], copy[j]] = [copy[j], copy[i]]; | ||
} | ||
return copy; | ||
} | ||
return copy; | ||
} | ||
/** | ||
* Filters the array in place based on a test condition and returns the filtered array. | ||
* This method modifies the original array by removing elements that do not pass the test implemented by the provided function. | ||
* | ||
* @template T The type of elements in the array. | ||
* @param {T[]} list The array to filter, which will be modified in place. | ||
* @param {(item: T) => boolean} test A function that tests each element of the array. Return `true` to keep the element, `false` otherwise. | ||
* @returns {T[]} The original array with only the elements that passed the test. | ||
*/ | ||
static filter(list, test) { | ||
let newLength = 0; | ||
for (let i = 0; i < list.length; i++) { | ||
if (test(list[i])) { | ||
list[newLength++] = list[i]; | ||
} | ||
/** | ||
* Filters the array in place based on a test condition and returns the filtered array. | ||
* This method modifies the original array by removing elements that do not pass the test implemented by the provided function. | ||
* | ||
* @template T The type of elements in the array. | ||
* @param {T[]} list The array to filter, which will be modified in place. | ||
* @param {(item: T) => boolean} test A function that tests each element of the array. Return `true` to keep the element, `false` otherwise. | ||
* @returns {T[]} The original array with only the elements that passed the test. | ||
*/ | ||
static filter(list, test) { | ||
let newLength = 0; | ||
for (let i = 0; i < list.length; i++) { | ||
if (test(list[i])) { | ||
list[newLength++] = list[i]; | ||
} | ||
} | ||
list.length = newLength; | ||
return list; | ||
} | ||
list.length = newLength; | ||
return list; | ||
} | ||
} | ||
exports.MintList = MintList; | ||
; | ||
exports["default"] = MintList; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintList); | ||
/***/ }), | ||
@@ -822,10 +783,9 @@ | ||
\*************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintMath = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintMath: () => (/* binding */ MintMath), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -835,19 +795,18 @@ * 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); | ||
} | ||
/** | ||
* 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, min = 0) { | ||
min = Math.ceil(min); | ||
max = Math.floor(max); | ||
return Math.floor(Math.random() * (max - min) + min); | ||
} | ||
} | ||
exports.MintMath = MintMath; | ||
; | ||
exports["default"] = MintMath; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintMath); | ||
/***/ }), | ||
@@ -859,10 +818,9 @@ | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintObject = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintObject: () => (/* binding */ MintObject), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -872,216 +830,210 @@ * 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; | ||
/** | ||
* 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; | ||
} | ||
let isSimilar = true; | ||
keys.forEach((key) => { | ||
if (obj1[key] !== obj2[key]) { | ||
isSimilar = false; | ||
} | ||
}); | ||
return isSimilar; | ||
} | ||
let isSimilar = true; | ||
keys.forEach(key => { | ||
if (obj1[key] !== obj2[key]) { | ||
isSimilar = false; | ||
} | ||
}); | ||
return isSimilar; | ||
} | ||
/** | ||
* 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; | ||
/** | ||
* 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 | ||
*/ | ||
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; | ||
} | ||
// 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; | ||
} | ||
/** | ||
* Removes object entries by key | ||
* @see mintObject.removeKeys | ||
* @param object - the object to remove entries from | ||
* @param keys - the keys to remove | ||
*/ | ||
static remove(object, keys) { | ||
return this.removeKeys(object, keys); | ||
} | ||
// 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; | ||
/** | ||
* Removes object entries by key | ||
* @param object - the object to remove entries from | ||
* @param keys - the keys to remove | ||
*/ | ||
static removeKeys(object, keys) { | ||
return Object.keys(object).reduce((obj, key) => { | ||
if (!keys.includes(key)) { | ||
obj[key] = object[key]; | ||
} | ||
return obj; | ||
}, {}); | ||
} | ||
// 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 by key | ||
* @alias mintObject.removeKeys | ||
* @param object - the object to remove entries from | ||
* @param keys - the keys to remove | ||
*/ | ||
static remove(object, keys) { | ||
return this.removeKeys(object, keys); | ||
} | ||
/** | ||
* Removes object entries by key | ||
* @param object - the object to remove entries from | ||
* @param keys - the keys to remove | ||
*/ | ||
static removeKeys(object, keys) { | ||
return Object.keys(object).reduce((obj, key) => { | ||
if (!keys.includes(key)) { | ||
obj[key] = object[key]; | ||
} | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Removes object entries by value | ||
*/ | ||
static removeValues(object, values) { | ||
return Object.keys(object).reduce((obj, key) => { | ||
if (!values.includes(object[key])) { | ||
obj[key] = object[key]; | ||
} | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by key | ||
*/ | ||
static sort(object, compareFn) { | ||
return this.sortKeys(object, compareFn); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by key | ||
*/ | ||
static sortKeys(object, compareFn) { | ||
return Object.keys(object).sort(compareFn).reduce((obj, key) => { | ||
obj[key] = object[key]; | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by value | ||
*/ | ||
static sortValues(object, compareFn) { | ||
return Object.keys(object).sort((a, b) => compareFn(object[a], object[b])).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; | ||
}, {}); | ||
} | ||
/** | ||
* Update two sets of objects | ||
* @param original - the original object | ||
* @param update - the object to update the original with | ||
* @returns - the original objects with updated data from the update | ||
*/ | ||
static updateArray(original, update) { | ||
let key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id'; | ||
// If there are no originals, push the updates | ||
if (!(update === null || update === void 0 ? void 0 : update.length)) { | ||
update === null || update === void 0 ? void 0 : update.forEach(object => original.push(object)); | ||
// If there are existing objects | ||
} else { | ||
// Create a dictionary of the updated objects | ||
const updateObjects = update.reduce((objects, object) => { | ||
var _a; | ||
return Object.assign(Object.assign({}, objects), { | ||
[(_a = object === null || object === void 0 ? void 0 : object[key]) !== null && _a !== void 0 ? _a : '']: object | ||
}); | ||
}, {}); | ||
// Remove any objects that aren't in the updated objects | ||
const missingObjects = original.filter(object => { | ||
var _a; | ||
return !updateObjects[(_a = object === null || object === void 0 ? void 0 : object[key]) !== null && _a !== void 0 ? _a : '']; | ||
}); | ||
missingObjects === null || missingObjects === void 0 ? void 0 : missingObjects.forEach(object => { | ||
const index = original.indexOf(object); | ||
if (typeof index == 'number' && index !== -1) { | ||
original.splice(index, 1); | ||
/** | ||
* Removes object entries by value | ||
*/ | ||
static removeValues(object, values) { | ||
return Object.keys(object).reduce((obj, key) => { | ||
if (!values.includes(object[key])) { | ||
obj[key] = object[key]; | ||
} | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by key | ||
*/ | ||
static sort(object, compareFn) { | ||
return this.sortKeys(object, compareFn); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by key | ||
*/ | ||
static sortKeys(object, compareFn) { | ||
return Object.keys(object).sort(compareFn).reduce((obj, key) => { | ||
obj[key] = object[key]; | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* Sorts an object's entries alphabetically by value | ||
*/ | ||
static sortValues(object, compareFn) { | ||
return Object.keys(object).sort((a, b) => compareFn(object[a], object[b])).reduce((obj, key) => { | ||
obj[key] = object[key]; | ||
return obj; | ||
}, {}); | ||
} | ||
/** | ||
* @see 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; | ||
}, {}); | ||
} | ||
/** | ||
* Update two sets of objects | ||
* @param original - the original object | ||
* @param update - the object to update the original with | ||
* @returns - the original objects with updated data from the update | ||
*/ | ||
static updateArray(original, update, key = 'id') { | ||
// If there are no originals, push the updates | ||
if (!update?.length) { | ||
update?.forEach((object) => original.push(object)); | ||
// If there are existing objects | ||
} | ||
}); | ||
// Update the existing objects with updates | ||
original.forEach(object => { | ||
var _a, _b; | ||
if (updateObjects[(_a = object === null || object === void 0 ? void 0 : object[key]) !== null && _a !== void 0 ? _a : '']) { | ||
Object.assign(object, updateObjects[(_b = object === null || object === void 0 ? void 0 : object[key]) !== null && _b !== void 0 ? _b : '']); | ||
else { | ||
// Create a dictionary of the updated objects | ||
const updateObjects = update.reduce((objects, object) => ({ | ||
...objects, | ||
[object?.[key] ?? '']: object | ||
}), {}); | ||
// Remove any objects that aren't in the updated objects | ||
const missingObjects = original.filter((object) => !updateObjects[object?.[key] ?? '']); | ||
missingObjects?.forEach((object) => { | ||
const index = original.indexOf(object); | ||
if (typeof index == 'number' && index !== -1) { | ||
original.splice(index, 1); | ||
} | ||
}); | ||
// Update the existing objects with updates | ||
original.forEach((object) => { | ||
if (updateObjects[object?.[key] ?? '']) { | ||
Object.assign(object, updateObjects[object?.[key] ?? '']); | ||
} | ||
}); | ||
} | ||
}); | ||
// Push any new objects | ||
const newObjects = update?.filter((object) => !original.some((existingObject) => existingObject?.[key] === object?.[key])); | ||
newObjects?.forEach(newObject => original.push(newObject)); | ||
} | ||
// Push any new objects | ||
const newObjects = update === null || update === void 0 ? void 0 : update.filter(object => !original.some(existingObject => (existingObject === null || existingObject === void 0 ? void 0 : existingObject[key]) === (object === null || object === void 0 ? void 0 : object[key]))); | ||
newObjects === null || newObjects === void 0 ? void 0 : newObjects.forEach(newObject => original.push(newObject)); | ||
} | ||
/** | ||
* Get an object's key by value | ||
*/ | ||
static getKeyByValue(object, value) { | ||
return Object.keys(object).find(key => object[key] === value); | ||
} | ||
/** | ||
* Create a deep copy of an object | ||
* @recursive | ||
*/ | ||
static deepClone(object) { | ||
// Clone every property | ||
const clone = {}; | ||
for (const key in object) { | ||
// Functions | ||
if (typeof object[key] === 'function') { | ||
clone[key] = object[key].bind(clone); | ||
// Objects | ||
} else if (object[key] && typeof object[key] === 'object') { | ||
clone[key] = this.deepClone(object[key]); | ||
// Primitives | ||
} else { | ||
clone[key] = object[key]; | ||
} | ||
/** | ||
* Get an object's key by value | ||
*/ | ||
static getKeyByValue(object, value) { | ||
return Object.keys(object).find((key) => object[key] === value); | ||
} | ||
return clone; | ||
} | ||
/** | ||
* Create a deep copy of an object | ||
*/ | ||
static deepClone(object) { | ||
// Clone every property | ||
const clone = {}; | ||
for (const key in object) { | ||
// Functions | ||
if (typeof object[key] === 'function') { | ||
clone[key] = object[key].bind(clone); | ||
// Objects | ||
} | ||
else if (object[key] && typeof object[key] === 'object') { | ||
clone[key] = this.deepClone(object[key]); | ||
// Primitives | ||
} | ||
else { | ||
clone[key] = object[key]; | ||
} | ||
} | ||
return clone; | ||
} | ||
} | ||
exports.MintObject = MintObject; | ||
; | ||
exports["default"] = MintObject; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintObject); | ||
/***/ }), | ||
@@ -1093,19 +1045,14 @@ | ||
\***************************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintScroll = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintScroll: () => (/* binding */ MintScroll), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/* harmony import */ var _event__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./event */ "./src/ts/imports/util/event.ts"); | ||
/** | ||
* Imports | ||
*/ | ||
const event_1 = __importDefault(__webpack_require__(/*! ./event */ "./src/ts/imports/util/event.ts")); | ||
/** | ||
@@ -1115,46 +1062,48 @@ * Scroll functions | ||
class MintScroll { | ||
/** | ||
* Scroll to the top of the page | ||
*/ | ||
static toTop() { | ||
window.scrollTo(0, 0); | ||
} | ||
/** | ||
* Scroll to the bottom of the page | ||
*/ | ||
static toBottom() { | ||
window.scrollTo(0, document.body.scrollHeight); | ||
} | ||
/** | ||
* Show visible elements | ||
*/ | ||
static showElements() { | ||
requestAnimationFrame(() => { | ||
let elements = document.querySelectorAll('.mint-fall-in:not(.mint-show)'), | ||
elementsToShow = []; | ||
for (let i = 0; i < elements.length; i++) { | ||
if (elements[i].getBoundingClientRect().top < 0) { | ||
elements[i].classList.add('mint-show'); | ||
} else if (elements[i].getBoundingClientRect().top < window.innerHeight * 3 / 4) { | ||
elementsToShow.push(elements[i]); | ||
} | ||
} | ||
for (let i = 0; i < elementsToShow.length; i++) { | ||
setTimeout(() => { | ||
elementsToShow[i].classList.add('mint-show'); | ||
}, i * 100); | ||
} | ||
}); | ||
} | ||
/** | ||
* Show visible elements on scroll | ||
*/ | ||
static showElementsOnScroll() { | ||
window.addEventListener('scroll', event_1.default.throttleEvent(this.showElements, 200)); | ||
} | ||
/** | ||
* Scroll to the top of the page | ||
*/ | ||
static toTop() { | ||
window.scrollTo(0, 0); | ||
} | ||
; | ||
/** | ||
* Scroll to the bottom of the page | ||
*/ | ||
static toBottom() { | ||
window.scrollTo(0, document.body.scrollHeight); | ||
} | ||
; | ||
/** | ||
* Show visible elements | ||
*/ | ||
static showElements() { | ||
requestAnimationFrame(() => { | ||
let elements = document.querySelectorAll('.mint-fall-in:not(.mint-show)'), elementsToShow = []; | ||
for (let i = 0; i < elements.length; i++) { | ||
if (elements[i].getBoundingClientRect().top < 0) { | ||
elements[i].classList.add('mint-show'); | ||
} | ||
else if (elements[i].getBoundingClientRect().top < window.innerHeight * 3 / 4) { | ||
elementsToShow.push(elements[i]); | ||
} | ||
} | ||
for (let i = 0; i < elementsToShow.length; i++) { | ||
setTimeout(() => { | ||
elementsToShow[i].classList.add('mint-show'); | ||
}, i * 100); | ||
} | ||
}); | ||
} | ||
/** | ||
* Show visible elements on scroll | ||
*/ | ||
static showElementsOnScroll() { | ||
window.addEventListener('scroll', _event__WEBPACK_IMPORTED_MODULE_0__["default"].throttleEvent(this.showElements, 200)); | ||
} | ||
} | ||
exports.MintScroll = MintScroll; | ||
; | ||
exports["default"] = MintScroll; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintScroll); | ||
/***/ }), | ||
@@ -1166,11 +1115,9 @@ | ||
\******************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintSelectors = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintSelectors: () => (/* binding */ MintSelectors), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -1181,163 +1128,163 @@ * CSS-selector helpers | ||
class MintSelectors { | ||
/** | ||
* Adds the library prefix to the beginning of the provided string | ||
* @param base - the string to be prefixed | ||
* @returns - the provided string prefixed with the library name | ||
*/ | ||
static prefix(base) { | ||
base = base.toLowerCase(); | ||
return base.startsWith(this.pre) ? base : `${this.pre}${base}`; | ||
} | ||
/** | ||
* Adds two dashes to the beginning of the provided string | ||
* @param base - the string to be prefixed | ||
* @returns - the provided string prefixed with two dashes | ||
*/ | ||
static cssPrefix(base) { | ||
return `--${this.prefix(base.replace(/^-+/, ''))}`; | ||
} | ||
/** | ||
* Turns the provided string into a CSS variable call | ||
* @param base - the name of the CSS variable to call | ||
* @returns - the CSS variable call for the provided string | ||
*/ | ||
static cssVar(base) { | ||
return `var(${this.cssPrefix(base)})`; | ||
} | ||
/** | ||
* Negates the provided CSS selector | ||
* @param base - the CSS selector to negate | ||
* @returns - the negated CSS selector | ||
*/ | ||
static neg(base) { | ||
return `:not(${base})`; | ||
} | ||
/** | ||
* Generates a class CSS selector | ||
* @param base - the name of the class to generate | ||
* @returns - the generated CSS selector | ||
*/ | ||
static class(base) { | ||
return `.${this.prefix(base)}`; | ||
} | ||
/** | ||
* Generates an id CSS selector | ||
* @param base - the name of the id to generate | ||
* @returns - the generated CSS selector | ||
*/ | ||
static id(base) { | ||
return `#${this.prefix(base)}`; | ||
} | ||
/** | ||
* Generates an aria-controls CSS selector | ||
* @param id - the id of the controlled element | ||
* @returns - the generated CSS selector | ||
*/ | ||
static controls(id) { | ||
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls; | ||
} | ||
/** | ||
* Generates an aria-expanded CSS selector | ||
* @param bool - whether the element is expanded or not | ||
* @returns - the generated CSS selector | ||
*/ | ||
static expanded(bool) { | ||
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded; | ||
} | ||
/** | ||
* Returns a NodeList of HTMLElements within the given element that are focusable | ||
* @param el - the element whose focusable children will be returned | ||
* @returns - the elements within the given element that are focusable | ||
*/ | ||
static getFocusables(el) { | ||
let focusables; | ||
if (el) { | ||
focusables = Array.from(el.querySelectorAll(this.focusable)); | ||
} else { | ||
focusables = Array.from(document.querySelectorAll(this.focusable)); | ||
/** | ||
* The library name that will be added as a prefix | ||
*/ | ||
static lib = 'mint'; | ||
/** | ||
* The prefix built from the library name | ||
*/ | ||
static pre = `${this.lib}-`; | ||
/** | ||
* CSS-selector for disabled elements | ||
*/ | ||
static disabled = '[disabled]'; | ||
/** | ||
* CSS-selector for elements with an aria-controls attribute | ||
*/ | ||
static hasControls = '[aria-controls]'; | ||
/** | ||
* CSS-selector for elements with an aria-expanded attribute | ||
*/ | ||
static hasExpanded = '[aria-expanded]'; | ||
/** | ||
* CSS-selector for elements with an href attribute | ||
*/ | ||
static hasLink = '[href]'; | ||
/** | ||
* CSS-selector for elements with a routerLink attribute | ||
*/ | ||
static hasRouterLink = '[routerLink]'; | ||
/** | ||
* CSS-selector for elements with an id attribute | ||
*/ | ||
static hasId = '[id]'; | ||
/** | ||
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative) | ||
*/ | ||
static notTabbable = '[tabindex^="-"]'; | ||
/** | ||
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative) | ||
*/ | ||
static tabbable = `[tabindex]${this.neg(this.notTabbable)}`; | ||
/** | ||
* CSS-selector for elements that can receive focus | ||
*/ | ||
static focusable = `input${this.neg(this.disabled)}${this.neg(this.notTabbable)}, | ||
select${this.neg(this.disabled)}${this.neg(this.notTabbable)}, | ||
textarea${this.neg(this.disabled)}${this.neg(this.notTabbable)}, | ||
button${this.neg(this.disabled)}${this.neg(this.notTabbable)}, | ||
object${this.neg(this.disabled)}${this.neg(this.notTabbable)}, | ||
a${this.hasLink}, a${this.hasRouterLink}, | ||
area${this.hasLink}, | ||
${this.tabbable}`.replace(/\s/g, ''); | ||
/** | ||
* CSS-selector for submenu buttons | ||
*/ | ||
static subMenuButtons = `button${this.hasControls}`; | ||
/** | ||
* CSS-selector for submenus | ||
*/ | ||
static subMenu = `${this.subMenuButtons} + ul${this.hasId}`; | ||
/** | ||
* Adds the library prefix to the beginning of the provided string | ||
* @param base - the string to be prefixed | ||
* @returns - the provided string prefixed with the library name | ||
*/ | ||
static prefix(base) { | ||
base = base.toLowerCase(); | ||
return base.startsWith(this.pre) ? base : `${this.pre}${base}`; | ||
} | ||
return focusables.filter(el => this.isFocusable(el)); | ||
} | ||
/** | ||
* Returns true if an element is focusable and false if not, | ||
* based on styles (i.e. a parent has display: none;) | ||
* NOTE: Still need to determine what other styles may make an element un-focusable | ||
* @param el - the element | ||
* @returns - true if the element is focusable; false if not | ||
*/ | ||
static isFocusable(el) { | ||
let current = el; | ||
do { | ||
if (window.getComputedStyle(current).getPropertyValue('display').toLowerCase() === 'none') { | ||
return false; | ||
} | ||
current = current.parentElement; | ||
} while (current); | ||
return true; | ||
} | ||
/** | ||
* Adds two dashes to the beginning of the provided string | ||
* @param base - the string to be prefixed | ||
* @returns - the provided string prefixed with two dashes | ||
*/ | ||
static cssPrefix(base) { | ||
return `--${this.prefix(base.replace(/^-+/, ''))}`; | ||
} | ||
/** | ||
* Turns the provided string into a CSS variable call | ||
* @param base - the name of the CSS variable to call | ||
* @returns - the CSS variable call for the provided string | ||
*/ | ||
static cssVar(base) { | ||
return `var(${this.cssPrefix(base)})`; | ||
} | ||
/** | ||
* Negates the provided CSS selector | ||
* @param base - the CSS selector to negate | ||
* @returns - the negated CSS selector | ||
*/ | ||
static neg(base) { | ||
return `:not(${base})`; | ||
} | ||
/** | ||
* Generates a class CSS selector | ||
* @param base - the name of the class to generate | ||
* @returns - the generated CSS selector | ||
*/ | ||
static class(base) { | ||
return `.${this.prefix(base)}`; | ||
} | ||
/** | ||
* Generates an id CSS selector | ||
* @param base - the name of the id to generate | ||
* @returns - the generated CSS selector | ||
*/ | ||
static id(base) { | ||
return `#${this.prefix(base)}`; | ||
} | ||
/** | ||
* Generates an aria-controls CSS selector | ||
* @param id - the id of the controlled element | ||
* @returns - the generated CSS selector | ||
*/ | ||
static controls(id) { | ||
return id ? `[aria-controls="${this.prefix(id)}"]` : this.hasControls; | ||
} | ||
/** | ||
* Generates an aria-expanded CSS selector | ||
* @param bool - whether the element is expanded or not | ||
* @returns - the generated CSS selector | ||
*/ | ||
static expanded(bool) { | ||
return typeof bool === 'boolean' ? `[aria-expanded="${bool}"]` : this.hasExpanded; | ||
} | ||
/** | ||
* Returns a NodeList of HTMLElements within the given element that are focusable | ||
* @param el - the element whose focusable children will be returned | ||
* @returns - the elements within the given element that are focusable | ||
*/ | ||
static getFocusables(el) { | ||
let focusables; | ||
if (el) { | ||
focusables = Array.from(el.querySelectorAll(this.focusable)); | ||
} | ||
else { | ||
focusables = Array.from(document.querySelectorAll(this.focusable)); | ||
} | ||
return focusables.filter((el) => this.isFocusable(el)); | ||
} | ||
/** | ||
* Returns true if an element is focusable and false if not, | ||
* based on styles (i.e. a parent has display: none;) | ||
* NOTE: Still need to determine what other styles may make an element un-focusable | ||
* @param el - the element | ||
* @returns - true if the element is focusable; false if not | ||
*/ | ||
static isFocusable(el) { | ||
let current = el; | ||
do { | ||
if (window.getComputedStyle(current).getPropertyValue('display').toLowerCase() === 'none') { | ||
return false; | ||
} | ||
current = current.parentElement; | ||
} while (current); | ||
return true; | ||
} | ||
} | ||
exports.MintSelectors = MintSelectors; | ||
_a = MintSelectors; | ||
/** | ||
* The library name that will be added as a prefix | ||
*/ | ||
MintSelectors.lib = 'mint'; | ||
/** | ||
* The prefix built from the library name | ||
*/ | ||
MintSelectors.pre = `${_a.lib}-`; | ||
/** | ||
* CSS-selector for disabled elements | ||
*/ | ||
MintSelectors.disabled = '[disabled]'; | ||
/** | ||
* CSS-selector for elements with an aria-controls attribute | ||
*/ | ||
MintSelectors.hasControls = '[aria-controls]'; | ||
/** | ||
* CSS-selector for elements with an aria-expanded attribute | ||
*/ | ||
MintSelectors.hasExpanded = '[aria-expanded]'; | ||
/** | ||
* CSS-selector for elements with an href attribute | ||
*/ | ||
MintSelectors.hasLink = '[href]'; | ||
/** | ||
* CSS-selector for elements with a routerLink attribute | ||
*/ | ||
MintSelectors.hasRouterLink = '[routerLink]'; | ||
/** | ||
* CSS-selector for elements with an id attribute | ||
*/ | ||
MintSelectors.hasId = '[id]'; | ||
/** | ||
* CSS-selector for elements that aren't tabbable (i.e. tabindex is negative) | ||
*/ | ||
MintSelectors.notTabbable = '[tabindex^="-"]'; | ||
/** | ||
* CSS-selector for elements that are tabbable (i.e. tabindex isn't negative) | ||
*/ | ||
MintSelectors.tabbable = `[tabindex]${_a.neg(_a.notTabbable)}`; | ||
/** | ||
* CSS-selector for elements that can receive focus | ||
*/ | ||
MintSelectors.focusable = `input${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)}, | ||
select${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)}, | ||
textarea${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)}, | ||
button${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)}, | ||
object${_a.neg(_a.disabled)}${_a.neg(_a.notTabbable)}, | ||
a${_a.hasLink}, a${_a.hasRouterLink}, | ||
area${_a.hasLink}, | ||
${_a.tabbable}`.replace(/\s/g, ''); | ||
/** | ||
* CSS-selector for submenu buttons | ||
*/ | ||
MintSelectors.subMenuButtons = `button${_a.hasControls}`; | ||
/** | ||
* CSS-selector for submenus | ||
*/ | ||
MintSelectors.subMenu = `${_a.subMenuButtons} + ul${_a.hasId}`; | ||
; | ||
exports["default"] = MintSelectors; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintSelectors); | ||
/***/ }), | ||
@@ -1349,11 +1296,9 @@ | ||
\*****************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintSettings = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintSettings: () => (/* binding */ MintSettings), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -1364,79 +1309,78 @@ * Settings management | ||
class MintSettings { | ||
/** | ||
* Update the provided settings variables | ||
* @param settings - Object of settings variables to update | ||
*/ | ||
static set(settings) { | ||
let newDelay = false; | ||
if (typeof settings.delayBase === 'number') { | ||
this.delayBase = settings.delayBase; | ||
newDelay = true; | ||
/** | ||
* Value added to all delay variables | ||
*/ | ||
static delayBase = 0; | ||
/** | ||
* Value multiplied by delay variable index | ||
*/ | ||
static delayStep = 100; | ||
/** | ||
* Delay variables | ||
*/ | ||
static delay = { | ||
instant: this.delayBase + this.delayStep * 0, | ||
fast: this.delayBase + this.delayStep * 1, | ||
medFast: this.delayBase + this.delayStep * 2, | ||
default: this.delayBase + this.delayStep * 3, | ||
medSlow: this.delayBase + this.delayStep * 4, | ||
slow: this.delayBase + this.delayStep * 5 | ||
}; | ||
/** | ||
* Breakpoint variables | ||
*/ | ||
static break = { | ||
z: 0, | ||
xs: 480, | ||
sm: 768, | ||
md: 1024, | ||
lg: 1200, | ||
xl: 1440 | ||
}; | ||
/** | ||
* Update the provided settings variables | ||
* @param settings - Object of settings variables to update | ||
*/ | ||
static set(settings) { | ||
let newDelay = false; | ||
if (typeof settings.delayBase === 'number') { | ||
this.delayBase = settings.delayBase; | ||
newDelay = true; | ||
} | ||
if (typeof settings.delayStep === 'number') { | ||
this.delayStep = settings.delayStep; | ||
newDelay = true; | ||
} | ||
if (newDelay) { | ||
this.setDelay(); | ||
} | ||
if (settings.delay && Object.keys(settings.delay).length) { | ||
if (Object.values(settings.delay).reduce((prev, next) => prev && typeof next === 'number', true)) { | ||
this.delay = { ...this.delay, ...settings.delay }; | ||
} | ||
} | ||
if (settings.break && Object.keys(settings.break).length) { | ||
if (Object.values(settings.break).reduce((prev, next) => prev && typeof next === 'number', true)) { | ||
this.break = { ...this.break, ...settings.break }; | ||
} | ||
} | ||
} | ||
if (typeof settings.delayStep === 'number') { | ||
this.delayStep = settings.delayStep; | ||
newDelay = true; | ||
/** | ||
* Updates the delay variables based on `this.delayBase` and `this.delayStep` | ||
*/ | ||
static setDelay() { | ||
this.delay = { | ||
instant: this.delayBase + this.delayStep * 0, | ||
fast: this.delayBase + this.delayStep * 1, | ||
medFast: this.delayBase + this.delayStep * 2, | ||
default: this.delayBase + this.delayStep * 3, | ||
medSlow: this.delayBase + this.delayStep * 4, | ||
slow: this.delayBase + this.delayStep * 5 | ||
}; | ||
} | ||
if (newDelay) { | ||
this.setDelay(); | ||
} | ||
if (settings.delay && Object.keys(settings.delay).length) { | ||
if (Object.values(settings.delay).reduce((prev, next) => prev && typeof next === 'number', true)) { | ||
this.delay = Object.assign(Object.assign({}, this.delay), settings.delay); | ||
} | ||
} | ||
if (settings.break && Object.keys(settings.break).length) { | ||
if (Object.values(settings.break).reduce((prev, next) => prev && typeof next === 'number', true)) { | ||
this.break = Object.assign(Object.assign({}, this.break), settings.break); | ||
} | ||
} | ||
} | ||
/** | ||
* Updates the delay variables based on `this.delayBase` and `this.delayStep` | ||
*/ | ||
static setDelay() { | ||
this.delay = { | ||
instant: this.delayBase + this.delayStep * 0, | ||
fast: this.delayBase + this.delayStep * 1, | ||
medFast: this.delayBase + this.delayStep * 2, | ||
default: this.delayBase + this.delayStep * 3, | ||
medSlow: this.delayBase + this.delayStep * 4, | ||
slow: this.delayBase + this.delayStep * 5 | ||
}; | ||
} | ||
} | ||
exports.MintSettings = MintSettings; | ||
_a = MintSettings; | ||
/** | ||
* Value added to all delay variables | ||
*/ | ||
MintSettings.delayBase = 0; | ||
/** | ||
* Value multiplied by delay variable index | ||
*/ | ||
MintSettings.delayStep = 100; | ||
/** | ||
* Delay variables | ||
*/ | ||
MintSettings.delay = { | ||
instant: _a.delayBase + _a.delayStep * 0, | ||
fast: _a.delayBase + _a.delayStep * 1, | ||
medFast: _a.delayBase + _a.delayStep * 2, | ||
default: _a.delayBase + _a.delayStep * 3, | ||
medSlow: _a.delayBase + _a.delayStep * 4, | ||
slow: _a.delayBase + _a.delayStep * 5 | ||
}; | ||
/** | ||
* Breakpoint variables | ||
*/ | ||
MintSettings.break = { | ||
z: 0, | ||
xs: 480, | ||
sm: 768, | ||
md: 1024, | ||
lg: 1200, | ||
xl: 1440 | ||
}; | ||
; | ||
exports["default"] = MintSettings; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintSettings); | ||
/***/ }), | ||
@@ -1448,10 +1392,9 @@ | ||
\*************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintText = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintText: () => (/* binding */ MintText), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -1461,97 +1404,104 @@ * Functions for analyzing and manipulating text. | ||
class MintText { | ||
/** | ||
* Generate a slug from a string | ||
* @param text - The string to slugify | ||
* @returns The slugified string | ||
*/ | ||
static slug(text) { | ||
var _a; | ||
return (_a = text === null || text === void 0 ? void 0 : text.trim().toLowerCase().replace(/'/g, '').replace(/[^\w/-]+/g, '-').replace(/-+/g, '-').replace(/^-+|-+$/g, '').replace(/^\/+|\/+$/g, '')) !== null && _a !== void 0 ? _a : ''; | ||
} | ||
/** | ||
* Generate a title from a slug | ||
* @param slug - The slug to generate a title from | ||
* @returns The title | ||
*/ | ||
static unslug(slug) { | ||
return this.titleCase(slug.replace(/[-/]+/g, ' ')); | ||
} | ||
/** | ||
* Format a phone number | ||
* @param phone - The phone number to format | ||
* @returns The formatted phone number | ||
*/ | ||
static phone(phone) { | ||
var _a, _b; | ||
const given = (_a = phone === null || phone === void 0 ? void 0 : phone.toString().trim()) !== null && _a !== void 0 ? _a : ''; | ||
if (given === '(' || given === '') { | ||
return given; | ||
/** | ||
* Generate a slug from a string | ||
* @param text - The string to slugify | ||
* @returns The slugified string | ||
*/ | ||
static slug(text) { | ||
return text?.trim() | ||
.toLowerCase() | ||
.replace(/'/g, '') | ||
.replace(/[^\w/-]+/g, '-') | ||
.replace(/-+/g, '-') | ||
.replace(/^-+|-+$/g, '') | ||
.replace(/^\/+|\/+$/g, '') ?? ''; | ||
} | ||
let numbers = (_b = given.replace(/\D/g, '')) !== null && _b !== void 0 ? _b : '', | ||
formatted = ''; | ||
if (numbers.length > 10) { | ||
formatted += `+${numbers.slice(0, numbers.length - 10)} `; | ||
numbers = numbers.slice(numbers.length - 10); | ||
/** | ||
* Generate a title from a slug | ||
* @param slug - The slug to generate a title from | ||
* @returns The title | ||
*/ | ||
static unslug(slug) { | ||
return this.titleCase(slug.replace(/[-/]+/g, ' ')); | ||
} | ||
for (var i = 0; i < numbers.length; i++) { | ||
switch (i) { | ||
case 0: | ||
formatted += '('; | ||
break; | ||
case 3: | ||
formatted += ') '; | ||
break; | ||
case 6: | ||
formatted += '-'; | ||
break; | ||
} | ||
formatted += numbers[i]; | ||
/** | ||
* Format a phone number | ||
* @param phone - The phone number to format | ||
* @returns The formatted phone number | ||
*/ | ||
static phone(phone) { | ||
const given = phone?.toString().trim() ?? ''; | ||
if (given === '(' || given === '') { | ||
return given; | ||
} | ||
let numbers = given.replace(/\D/g, '') ?? '', formatted = ''; | ||
if (numbers.length > 10) { | ||
formatted += `+${numbers.slice(0, numbers.length - 10)} `; | ||
numbers = numbers.slice(numbers.length - 10); | ||
} | ||
for (var i = 0; i < numbers.length; i++) { | ||
switch (i) { | ||
case 0: | ||
formatted += '('; | ||
break; | ||
case 3: | ||
formatted += ') '; | ||
break; | ||
case 6: | ||
formatted += '-'; | ||
break; | ||
} | ||
formatted += numbers[i]; | ||
} | ||
switch (given[given.length - 1]) { | ||
case ')': | ||
if (i === 3) { | ||
formatted += ') '; | ||
} | ||
break; | ||
case '-': | ||
if (i === 6) { | ||
formatted += '-'; | ||
} | ||
break; | ||
} | ||
return formatted; | ||
} | ||
switch (given[given.length - 1]) { | ||
case ')': | ||
if (i === 3) { | ||
formatted += ') '; | ||
/** | ||
* Pluralize the given word | ||
*/ | ||
static plural(word) { | ||
if (word.endsWith('ies') || | ||
word.endsWith('es') || | ||
(word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss'))) { | ||
return word; | ||
} | ||
break; | ||
case '-': | ||
if (i === 6) { | ||
formatted += '-'; | ||
if (word.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(word.charAt(word.length - 2))) { | ||
return word.slice(0, -1) + 'ies'; | ||
} | ||
break; | ||
if (word.endsWith('s') || word.endsWith('sh') || word.endsWith('ch') || word.endsWith('x') || word.endsWith('z')) { | ||
return word + 'es'; | ||
} | ||
return word + 's'; | ||
} | ||
return formatted; | ||
} | ||
/** | ||
* Pluralize the given word | ||
*/ | ||
static plural(word) { | ||
if (word.endsWith('ies') || word.endsWith('es') || word.endsWith('s') && !word.endsWith('us') && !word.endsWith('is') && !word.endsWith('ss')) { | ||
return word; | ||
/** | ||
* Capitalize the first letter of the given word | ||
*/ | ||
static titleCase(text) { | ||
return text | ||
.toLowerCase() | ||
.replace(/(?:^|\s)\S/g, a => a.toUpperCase()); | ||
} | ||
if (word.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(word.charAt(word.length - 2))) { | ||
return word.slice(0, -1) + 'ies'; | ||
} | ||
if (word.endsWith('s') || word.endsWith('sh') || word.endsWith('ch') || word.endsWith('x') || word.endsWith('z')) { | ||
return word + 'es'; | ||
} | ||
return word + 's'; | ||
} | ||
/** | ||
* Capitalize the first letter of the given word | ||
*/ | ||
static titleCase(text) { | ||
return text.toLowerCase().replace(/(?:^|\s)\S/g, a => a.toUpperCase()); | ||
} | ||
/** | ||
* Copies the provided text to the clipboard | ||
* @param text - the text to copy | ||
* @returns - true if the text was successfully copied to the clipboard; else false | ||
*/ | ||
static copyText(text) { | ||
let textArea = document.createElement('textarea'); | ||
if (!text || !textArea) { | ||
return false; | ||
} | ||
textArea.value = text; | ||
textArea.style.cssText = ` | ||
/** | ||
* Copies the provided text to the clipboard | ||
* @param text - the text to copy | ||
* @returns - true if the text was successfully copied to the clipboard; else false | ||
*/ | ||
static copyText(text) { | ||
let textArea = document.createElement('textarea'); | ||
if (!text || !textArea) { | ||
return false; | ||
} | ||
textArea.value = text; | ||
textArea.style.cssText = ` | ||
position: fixed; | ||
@@ -1564,23 +1514,23 @@ top: 0; | ||
`; | ||
document.body.appendChild(textArea); | ||
textArea.select(); | ||
textArea.setSelectionRange(0, 99999); | ||
navigator.clipboard.writeText(textArea.value); | ||
document.body.removeChild(textArea); | ||
return true; | ||
} | ||
/** | ||
* Tests the validity of an email address | ||
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression} | ||
* @param text - the string to test | ||
* @returns - true if the given string is an email address; false if not | ||
*/ | ||
static isEmail(text) { | ||
return null !== text.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])+)\])/); | ||
} | ||
document.body.appendChild(textArea); | ||
textArea.select(); | ||
textArea.setSelectionRange(0, 99999); | ||
navigator.clipboard.writeText(textArea.value); | ||
document.body.removeChild(textArea); | ||
return true; | ||
} | ||
/** | ||
* Tests the validity of an email address | ||
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression} | ||
* @param text - the string to test | ||
* @returns - true if the given string is an email address; false if not | ||
*/ | ||
static isEmail(text) { | ||
return null !== text.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])+)\])/); | ||
} | ||
} | ||
exports.MintText = MintText; | ||
; | ||
exports["default"] = MintText; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintText); | ||
/***/ }), | ||
@@ -1592,10 +1542,9 @@ | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.MintWindow = void 0; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ MintWindow: () => (/* binding */ MintWindow), | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/** | ||
@@ -1605,25 +1554,98 @@ * Functions related to the browser window. | ||
class MintWindow { | ||
/** | ||
* Returns the width of the window, including fractional pixels | ||
* @returns the width of the window | ||
*/ | ||
static width() { | ||
const decimal = document.body.getBoundingClientRect().width % 1; | ||
return window.innerWidth + decimal; | ||
} | ||
/** | ||
* Returns the width of the window, including fractional pixels | ||
* @returns the width of the window | ||
*/ | ||
static width() { | ||
const decimal = document.body.getBoundingClientRect().width % 1; | ||
return window.innerWidth + decimal; | ||
} | ||
} | ||
exports.MintWindow = MintWindow; | ||
; | ||
exports["default"] = MintWindow; | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MintWindow); | ||
/***/ }), | ||
/***/ "./src/ts/index.ts": | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
/******/ (() => { | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = (exports) => { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | ||
(() => { | ||
/*!*************************!*\ | ||
!*** ./src/ts/index.ts ***! | ||
\*************************/ | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ EMintSide: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.EMintSide), | ||
/* harmony export */ MintAsync: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintAsync), | ||
/* harmony export */ MintDisplay: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintDisplay), | ||
/* harmony export */ MintEvent: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintEvent), | ||
/* harmony export */ MintIcon: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintIcon), | ||
/* harmony export */ MintItem: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintItem), | ||
/* harmony export */ MintList: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintList), | ||
/* harmony export */ MintMath: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintMath), | ||
/* harmony export */ MintObject: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintObject), | ||
/* harmony export */ MintScroll: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintScroll), | ||
/* harmony export */ MintSelectors: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintSelectors), | ||
/* harmony export */ MintSettings: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintSettings), | ||
/* harmony export */ MintText: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintText), | ||
/* harmony export */ MintWindow: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.MintWindow), | ||
/* harmony export */ mintColor: () => (/* reexport safe */ _imports__WEBPACK_IMPORTED_MODULE_0__.mintColor) | ||
/* harmony export */ }); | ||
/* harmony import */ var _imports__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./imports */ "./src/ts/imports/index.ts"); | ||
/** | ||
@@ -1634,68 +1656,26 @@ * A utility library for web applications. | ||
*/ | ||
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { | ||
enumerable: true, | ||
get: function () { | ||
return m[k]; | ||
} | ||
}; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
} : function (o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
var __exportStar = this && this.__exportStar || function (m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
/** | ||
* Exports | ||
*/ | ||
__exportStar(__webpack_require__(/*! ./imports */ "./src/ts/imports/index.ts"), exports); | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module is referenced by other modules so it can't be inlined | ||
/******/ var __webpack_exports__ = __webpack_require__("./src/ts/index.ts"); | ||
/******/ | ||
/******/ return __webpack_exports__; | ||
/******/ })() | ||
; | ||
}); | ||
})(); | ||
var __webpack_exports__EMintSide = __webpack_exports__.EMintSide; | ||
var __webpack_exports__MintAsync = __webpack_exports__.MintAsync; | ||
var __webpack_exports__MintDisplay = __webpack_exports__.MintDisplay; | ||
var __webpack_exports__MintEvent = __webpack_exports__.MintEvent; | ||
var __webpack_exports__MintIcon = __webpack_exports__.MintIcon; | ||
var __webpack_exports__MintItem = __webpack_exports__.MintItem; | ||
var __webpack_exports__MintList = __webpack_exports__.MintList; | ||
var __webpack_exports__MintMath = __webpack_exports__.MintMath; | ||
var __webpack_exports__MintObject = __webpack_exports__.MintObject; | ||
var __webpack_exports__MintScroll = __webpack_exports__.MintScroll; | ||
var __webpack_exports__MintSelectors = __webpack_exports__.MintSelectors; | ||
var __webpack_exports__MintSettings = __webpack_exports__.MintSettings; | ||
var __webpack_exports__MintText = __webpack_exports__.MintText; | ||
var __webpack_exports__MintWindow = __webpack_exports__.MintWindow; | ||
var __webpack_exports__mintColor = __webpack_exports__.mintColor; | ||
export { __webpack_exports__EMintSide as EMintSide, __webpack_exports__MintAsync as MintAsync, __webpack_exports__MintDisplay as MintDisplay, __webpack_exports__MintEvent as MintEvent, __webpack_exports__MintIcon as MintIcon, __webpack_exports__MintItem as MintItem, __webpack_exports__MintList as MintList, __webpack_exports__MintMath as MintMath, __webpack_exports__MintObject as MintObject, __webpack_exports__MintScroll as MintScroll, __webpack_exports__MintSelectors as MintSelectors, __webpack_exports__MintSettings as MintSettings, __webpack_exports__MintText as MintText, __webpack_exports__MintWindow as MintWindow, __webpack_exports__mintColor as mintColor }; | ||
//# sourceMappingURL=index.js.map |
@@ -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={573:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var a=Object.getOwnPropertyDescriptor(t,i);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,a)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),a=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),a(i(22),t)},22:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.EMintSide=void 0,(i=t.EMintSide||(t.EMintSide={}))[i.Top=0]="Top",i[i.Right=1]="Right",i[i.Bottom=2]="Bottom",i[i.Left=3]="Left"},709:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var a=Object.getOwnPropertyDescriptor(t,i);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,a)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),a=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),a(i(573),t),a(i(231),t),a(i(17),t)},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},822:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},231:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var a=Object.getOwnPropertyDescriptor(t,i);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,a)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),a=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),a(i(54),t),a(i(822),t),a(i(708),t),a(i(753),t),a(i(871),t),a(i(13),t)},708:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MintItem=void 0;class i{constructor(){this.version=0,this.priority=0,this.price=0,this.level=0,this.size=0,this.num=0,this.width=0,this.height=0,this.active=!1,this.centered=!1,this.disabled=!1,this.private=!1,this.attr={},this.params={},this.options={},this.lists={},this.paragraphs=[],this.classes=[],this.items=[],this.images=[],this.buttons=[]}}t.MintItem=i,t.default=i},753:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},13:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},261:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MintAsync=void 0;class i{static wait(e){return new Promise((t=>setTimeout(t,e)))}}t.MintAsync=i,t.default=i},139:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MintDisplay=void 0;const s=i(573),a=i(110);class n{static show(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.MintSettings.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.EMintSide.Top;e&&(e.style.display="",requestAnimationFrame((()=>{i===s.EMintSide.Top||i===s.EMintSide.Bottom?e.style.height=`${e.scrollHeight}px`:e.style.width=`${e.scrollWidth}px`,setTimeout((()=>{i===s.EMintSide.Top||i===s.EMintSide.Bottom?e.style.height="auto":e.style.width="auto"}),t)})))}static hide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.MintSettings.delay.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.EMintSide.Top;if(e){let a=e.scrollHeight,n=e.scrollWidth,r=e.style.transition;e.style.transition="",requestAnimationFrame((()=>{i===s.EMintSide.Top||i===s.EMintSide.Bottom?e.style.height=`${a}px`:e.style.width=`${n}px`,e.style.transition=r,requestAnimationFrame((()=>{i===s.EMintSide.Top||i===s.EMintSide.Bottom?e.style.height="0":e.style.width="0"}))})),setTimeout((()=>{e.style.display="none"}),t)}}}t.MintDisplay=n,t.default=n},376:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MintEvent=void 0;const a=s(i(110));class n{static debounce(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.default.delay.default;return function(s){t&&clearTimeout(t),t=setTimeout(e,i,s)}}static debounceEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.default.delay.default;return n.debounce(e,t)}static throttle(e){let t,i,s,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.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(),n=0,s=e.apply(t,i),n||(t=i=null)};return function(){let a=(new Date).getTime();o||!1!==(null==l?void 0:l.leading)||(o=a);let c=r-a+o;return t=this,i=arguments,c<=0||c>r?(n&&(clearTimeout(n),n=0),o=a,s=e.apply(t,i),n||(t=i=null)):n||!1===(null==l?void 0:l.trailing)||(n=window.setTimeout(d,c)),s}}static throttleEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.default.delay.default,i=arguments.length>2?arguments[2]:void 0;return n.throttle(e,t,i)}}t.MintEvent=n,t.default=n},4:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MintIcon=void 0;const a=s(i(982));class n{static append(e,t){document.querySelectorAll(t).forEach((t=>{let i=document.createElement("i");i.classList.add(...e.split(" ")),t.querySelector("i")||t.appendChild(i),i.classList.contains("fa-up-right-from-square")&&t.setAttribute("target","_blank")}))}static update(e){let t=a.default.removeValues(Object.assign(Object.assign({},this.icons),e),[!1]);Object.keys(t).forEach((e=>{this.append(t[e],e)}))}static remove(e,t){document.querySelectorAll(t).forEach((e=>{let t=e.querySelector("i");t&&t.remove()}))}}t.MintIcon=n,n.icons={'a[href^="mailto:"]':"far fa-envelope",'a[href^="tel:"]':"fas fa-phone-flip",'a[href^="sms:"]':"far fa-message",'a[href^="https://maps"]':"fas fa-map-location-dot",'a[href^="http"]':"fas fa-up-right-from-square"},t.default=n},17:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var a=Object.getOwnPropertyDescriptor(t,i);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,a)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),a=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),a(i(261),t),a(i(139),t),a(i(376),t),a(i(4),t),a(i(718),t),a(i(683),t),a(i(982),t),a(i(85),t),a(i(378),t),a(i(110),t),a(i(226),t),a(i(505),t)},718:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MintList=void 0;class i{static shuffleCopy(e){let t=[...e];for(let e=t.length-1;e>0;e--){const i=Math.floor(Math.random()*(e+1));[t[e],t[i]]=[t[i],t[e]]}return t}static filter(e,t){let i=0;for(let s=0;s<e.length;s++)t(e[s])&&(e[i++]=e[s]);return e.length=i,e}}t.MintList=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);if(i.length!==Object.keys(t).length)return!1;let s=!0;return i.forEach((i=>{e[i]!==t[i]&&(s=!1)})),s}static isSuperset(e,t){let s=!0;if(e===t)return s;try{if(0===Object.keys(t).length)return!s}catch(e){return!s}return Object.keys(t).forEach((a=>{s=s&&i.isSuperset(e[a],t[a])})),s}static remove(e,t){return this.removeKeys(e,t)}static removeKeys(e,t){return Object.keys(e).reduce(((i,s)=>(t.includes(s)||(i[s]=e[s]),i)),{})}static removeValues(e,t){return Object.keys(e).reduce(((i,s)=>(t.includes(e[s])||(i[s]=e[s]),i)),{})}static sort(e,t){return this.sortKeys(e,t)}static sortKeys(e,t){return Object.keys(e).sort(t).reduce(((t,i)=>(t[i]=e[i],t)),{})}static sortValues(e,t){return Object.keys(e).sort(((i,s)=>t(e[i],e[s]))).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,s)=>(t.includes(e[s])&&(i[s]=e[s]),i)),{})}static updateArray(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";if(null==t?void 0:t.length){const s=t.reduce(((e,t)=>{var s;return Object.assign(Object.assign({},e),{[null!==(s=null==t?void 0:t[i])&&void 0!==s?s:""]:t})}),{}),a=e.filter((e=>{var t;return!s[null!==(t=null==e?void 0:e[i])&&void 0!==t?t:""]}));null==a||a.forEach((t=>{const i=e.indexOf(t);"number"==typeof i&&-1!==i&&e.splice(i,1)})),e.forEach((e=>{var t,a;s[null!==(t=null==e?void 0:e[i])&&void 0!==t?t:""]&&Object.assign(e,s[null!==(a=null==e?void 0:e[i])&&void 0!==a?a:""])}))}else null==t||t.forEach((t=>e.push(t)));const s=null==t?void 0:t.filter((t=>!e.some((e=>(null==e?void 0:e[i])===(null==t?void 0:t[i])))));null==s||s.forEach((t=>e.push(t)))}static getKeyByValue(e,t){return Object.keys(e).find((i=>e[i]===t))}static deepClone(e){const t={};for(const i in e)"function"==typeof e[i]?t[i]=e[i].bind(t):e[i]&&"object"==typeof e[i]?t[i]=this.deepClone(e[i]):t[i]=e[i];return t}}t.MintObject=i,t.default=i},85:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MintScroll=void 0;const a=s(i(376));class n{static toTop(){window.scrollTo(0,0)}static toBottom(){window.scrollTo(0,document.body.scrollHeight)}static showElements(){requestAnimationFrame((()=>{let e=document.querySelectorAll(".mint-fall-in:not(.mint-show)"),t=[];for(let i=0;i<e.length;i++)e[i].getBoundingClientRect().top<0?e[i].classList.add("mint-show"):e[i].getBoundingClientRect().top<3*window.innerHeight/4&&t.push(e[i]);for(let e=0;e<t.length;e++)setTimeout((()=>{t[e].classList.add("mint-show")}),100*e)}))}static showElementsOnScroll(){window.addEventListener("scroll",a.default.throttleEvent(this.showElements,200))}}t.MintScroll=n,t.default=n},378:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.MintSelectors=void 0;class s{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 getFocusables(e){let t;return t=e?Array.from(e.querySelectorAll(this.focusable)):Array.from(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=s,i=s,s.lib="mint",s.pre=`${i.lib}-`,s.disabled="[disabled]",s.hasControls="[aria-controls]",s.hasExpanded="[aria-expanded]",s.hasLink="[href]",s.hasRouterLink="[routerLink]",s.hasId="[id]",s.notTabbable='[tabindex^="-"]',s.tabbable=`[tabindex]${i.neg(i.notTabbable)}`,s.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,""),s.subMenuButtons=`button${i.hasControls}`,s.subMenu=`${i.subMenuButtons} + ul${i.hasId}`,t.default=s},110:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.MintSettings=void 0;class s{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)),e.break&&Object.keys(e.break).length&&Object.values(e.break).reduce(((e,t)=>e&&"number"==typeof t),!0)&&(this.break=Object.assign(Object.assign({},this.break),e.break))}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=s,i=s,s.delayBase=0,s.delayStep=100,s.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},s.break={z:0,xs:480,sm:768,md:1024,lg:1200,xl:1440},t.default=s},226:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MintText=void 0;class i{static slug(e){var t;return null!==(t=null==e?void 0:e.trim().toLowerCase().replace(/'/g,"").replace(/[^\w/-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^\/+|\/+$/g,""))&&void 0!==t?t:""}static unslug(e){return this.titleCase(e.replace(/[-/]+/g," "))}static phone(e){var t,i;const s=null!==(t=null==e?void 0:e.toString().trim())&&void 0!==t?t:"";if("("===s||""===s)return s;let a=null!==(i=s.replace(/\D/g,""))&&void 0!==i?i:"",n="";a.length>10&&(n+=`+${a.slice(0,a.length-10)} `,a=a.slice(a.length-10));for(var r=0;r<a.length;r++){switch(r){case 0:n+="(";break;case 3:n+=") ";break;case 6:n+="-"}n+=a[r]}switch(s[s.length-1]){case")":3===r&&(n+=") ");break;case"-":6===r&&(n+="-")}return n}static plural(e){return e.endsWith("ies")||e.endsWith("es")||e.endsWith("s")&&!e.endsWith("us")&&!e.endsWith("is")&&!e.endsWith("ss")?e:e.endsWith("y")&&!["a","e","i","o","u"].includes(e.charAt(e.length-2))?e.slice(0,-1)+"ies":e.endsWith("s")||e.endsWith("sh")||e.endsWith("ch")||e.endsWith("x")||e.endsWith("z")?e+"es":e+"s"}static titleCase(e){return e.toLowerCase().replace(/(?:^|\s)\S/g,(e=>e.toUpperCase()))}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.MintText=i,t.default=i},505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MintWindow=void 0;class i{static width(){const e=document.body.getBoundingClientRect().width%1;return window.innerWidth+e}}t.MintWindow=i,t.default=i},491:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var a=Object.getOwnPropertyDescriptor(t,i);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,a)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),a=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),a(i(709),t)}},t={};return function i(s){var a=t[s];if(void 0!==a)return a.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}(491)})())); | ||
var t,e={d:(t,s)=>{for(var a in s)e.o(s,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:s[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},s={};e.d(s,{N7:()=>t,TQ:()=>r,Jy:()=>o,BT:()=>c,sh:()=>p,c2:()=>i,f$:()=>b,JX:()=>y,E_:()=>d,qS:()=>f,dG:()=>g,a6:()=>n,cQ:()=>m,li:()=>x,Qh:()=>a}),function(t){t[t.Top=0]="Top",t[t.Right=1]="Right",t[t.Bottom=2]="Bottom",t[t.Left=3]="Left"}(t||(t={}));class a{static hexBase=16;static hexMax="FF";r;g;b;a;constructor(t){this.r="number"==typeof t.r?Math.max(Math.min(t.r,a.hexBase**2-1),0):0,this.g="number"==typeof t.g?Math.max(Math.min(t.g,a.hexBase**2-1),0):0,this.b="number"==typeof t.b?Math.max(Math.min(t.b,a.hexBase**2-1),0):0,this.a="number"==typeof t.a?Math.max(Math.min(t.a,1),0):1,"string"==typeof t.color&&this.stringConstructor(t.color)}stringConstructor(t){t.startsWith("#")?this.hexConstructor(t):(~t.indexOf("linear-gradient")&&(t=t.substring(t.indexOf("linear-gradient"),t.length)),this.rgbConstructor(t))}hexConstructor(t){switch(t.length){case 1:case 5:case 6:return;case 2:t="#"+t[1]+t[1]+t[1]+t[1]+t[1]+t[1]+a.hexMax;break;case 3:t="#"+t[1]+t[1]+t[1]+t[2]+t[2]+t[2]+a.hexMax;break;case 4:t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+a.hexMax;break;case 7:t+=a.hexMax;break;case 8:t+=t[t.length-1];break;default:t=t.substring(0,9)}this.r=parseInt(t.substring(1,3),a.hexBase),this.g=parseInt(t.substring(3,5),a.hexBase),this.b=parseInt(t.substring(5,7),a.hexBase),this.a=parseInt(t.substring(7,9),a.hexBase)/a.hexBase**2}rgbConstructor(t){let e=t.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d*)?)\))?/);e&&(this.r=parseInt(e[1]),this.g=parseInt(e[2]),this.b=parseInt(e[3]),this.a=parseFloat(e[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)}}class i{version=0;priority=0;price=0;level=0;size=0;num=0;width=0;height=0;active=!1;centered=!1;disabled=!1;private=!1;id;slug;name;title;subtitle;description;category;type;unit;logo;icon;position;transform;date;src;href;target;routerLink;attr={};params={};options={};lists={};paragraphs=[];classes=[];items=[];images=[];buttons=[];click}class r{static wait(t){return new Promise((e=>setTimeout(e,t)))}}class n{static delayBase=0;static delayStep=100;static 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};static break={z:0,xs:480,sm:768,md:1024,lg:1200,xl:1440};static set(t){let e=!1;"number"==typeof t.delayBase&&(this.delayBase=t.delayBase,e=!0),"number"==typeof t.delayStep&&(this.delayStep=t.delayStep,e=!0),e&&this.setDelay(),t.delay&&Object.keys(t.delay).length&&Object.values(t.delay).reduce(((t,e)=>t&&"number"==typeof e),!0)&&(this.delay={...this.delay,...t.delay}),t.break&&Object.keys(t.break).length&&Object.values(t.break).reduce(((t,e)=>t&&"number"==typeof e),!0)&&(this.break={...this.break,...t.break})}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}}}const l=n;class o{static show(e,s=n.delay.default,a=t.Top){e&&(e.style.display="",requestAnimationFrame((()=>{a===t.Top||a===t.Bottom?e.style.height=`${e.scrollHeight}px`:e.style.width=`${e.scrollWidth}px`,setTimeout((()=>{a===t.Top||a===t.Bottom?e.style.height="auto":e.style.width="auto"}),s)})))}static hide(e,s=n.delay.default,a=t.Top){if(e){let i=e.scrollHeight,r=e.scrollWidth,n=e.style.transition;e.style.transition="",requestAnimationFrame((()=>{a===t.Top||a===t.Bottom?e.style.height=`${i}px`:e.style.width=`${r}px`,e.style.transition=n,requestAnimationFrame((()=>{a===t.Top||a===t.Bottom?e.style.height="0":e.style.width="0"}))})),setTimeout((()=>{e.style.display="none"}),s)}}}class c{static debounce(t,e=l.delay.default){let s;return function(a){s&&clearTimeout(s),s=setTimeout(t,e,a)}}static debounceEvent(t,e=l.delay.default){return c.debounce(t,e)}static throttle(t,e=l.delay.default,s){let a,i,r,n,o=0,c=function(){o=!1===s?.leading?0:(new Date).getTime(),n=0,r=t.apply(a,i),n||(a=i=null)};return function(){let l=(new Date).getTime();o||!1!==s?.leading||(o=l);let h=e-l+o;return a=this,i=arguments,h<=0||h>e?(n&&(clearTimeout(n),n=0),o=l,r=t.apply(a,i),n||(a=i=null)):n||!1===s?.trailing||(n=window.setTimeout(c,h)),r}}static throttleEvent(t,e=l.delay.default,s){return c.throttle(t,e,s)}}const h=c;class d{static isSimilar(t,e){let s=Object.keys(t);if(s.length!==Object.keys(e).length)return!1;let a=!0;return s.forEach((s=>{t[s]!==e[s]&&(a=!1)})),a}static isSuperset(t,e){let s=!0;if(t===e)return s;try{if(0===Object.keys(e).length)return!s}catch(t){return!s}return Object.keys(e).forEach((a=>{s=s&&d.isSuperset(t[a],e[a])})),s}static remove(t,e){return this.removeKeys(t,e)}static removeKeys(t,e){return Object.keys(t).reduce(((s,a)=>(e.includes(a)||(s[a]=t[a]),s)),{})}static removeValues(t,e){return Object.keys(t).reduce(((s,a)=>(e.includes(t[a])||(s[a]=t[a]),s)),{})}static sort(t,e){return this.sortKeys(t,e)}static sortKeys(t,e){return Object.keys(t).sort(e).reduce(((e,s)=>(e[s]=t[s],e)),{})}static sortValues(t,e){return Object.keys(t).sort(((s,a)=>e(t[s],t[a]))).reduce(((e,s)=>(e[s]=t[s],e)),{})}static filter(t,e){return this.filterKeys(t,e)}static filterKeys(t,e){return e.reduce(((e,s)=>(e[s]=t[s],e)),{})}static filterValues(t,e){return Object.keys(t).reduce(((s,a)=>(e.includes(t[a])&&(s[a]=t[a]),s)),{})}static updateArray(t,e,s="id"){if(e?.length){const a=e.reduce(((t,e)=>({...t,[e?.[s]??""]:e})),{}),i=t.filter((t=>!a[t?.[s]??""]));i?.forEach((e=>{const s=t.indexOf(e);"number"==typeof s&&-1!==s&&t.splice(s,1)})),t.forEach((t=>{a[t?.[s]??""]&&Object.assign(t,a[t?.[s]??""])}))}else e?.forEach((e=>t.push(e)));const a=e?.filter((e=>!t.some((t=>t?.[s]===e?.[s]))));a?.forEach((e=>t.push(e)))}static getKeyByValue(t,e){return Object.keys(t).find((s=>t[s]===e))}static deepClone(t){const e={};for(const s in t)"function"==typeof t[s]?e[s]=t[s].bind(e):t[s]&&"object"==typeof t[s]?e[s]=this.deepClone(t[s]):e[s]=t[s];return e}}const u=d;class p{static icons={'a[href^="mailto:"]':"far fa-envelope",'a[href^="tel:"]':"fas fa-phone-flip",'a[href^="sms:"]':"far fa-message",'a[href^="https://maps"]':"fas fa-map-location-dot",'a[href^="http"]':"fas fa-up-right-from-square"};static append(t,e){document.querySelectorAll(e).forEach((e=>{let s=document.createElement("i");s.classList.add(...t.split(" ")),e.querySelector("i")||e.appendChild(s),s.classList.contains("fa-up-right-from-square")&&e.setAttribute("target","_blank")}))}static update(t){let e=u.removeValues({...this.icons,...t},[!1]);Object.keys(e).forEach((t=>{this.append(e[t],t)}))}static remove(t,e){document.querySelectorAll(e).forEach((t=>{let e=t.querySelector("i");e&&e.remove()}))}}class b{static shuffleCopy(t){let e=[...t];for(let t=e.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[e[t],e[s]]=[e[s],e[t]]}return e}static filter(t,e){let s=0;for(let a=0;a<t.length;a++)e(t[a])&&(t[s++]=t[a]);return t.length=s,t}}class y{static randomInt(t,e=0){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e)+e)}}class f{static toTop(){window.scrollTo(0,0)}static toBottom(){window.scrollTo(0,document.body.scrollHeight)}static showElements(){requestAnimationFrame((()=>{let t=document.querySelectorAll(".mint-fall-in:not(.mint-show)"),e=[];for(let s=0;s<t.length;s++)t[s].getBoundingClientRect().top<0?t[s].classList.add("mint-show"):t[s].getBoundingClientRect().top<3*window.innerHeight/4&&e.push(t[s]);for(let t=0;t<e.length;t++)setTimeout((()=>{e[t].classList.add("mint-show")}),100*t)}))}static showElementsOnScroll(){window.addEventListener("scroll",h.throttleEvent(this.showElements,200))}}class g{static lib="mint";static pre=`${this.lib}-`;static disabled="[disabled]";static hasControls="[aria-controls]";static hasExpanded="[aria-expanded]";static hasLink="[href]";static hasRouterLink="[routerLink]";static hasId="[id]";static notTabbable='[tabindex^="-"]';static tabbable=`[tabindex]${this.neg(this.notTabbable)}`;static focusable=`input${this.neg(this.disabled)}${this.neg(this.notTabbable)},\n select${this.neg(this.disabled)}${this.neg(this.notTabbable)},\n textarea${this.neg(this.disabled)}${this.neg(this.notTabbable)},\n button${this.neg(this.disabled)}${this.neg(this.notTabbable)},\n object${this.neg(this.disabled)}${this.neg(this.notTabbable)},\n a${this.hasLink}, a${this.hasRouterLink},\n area${this.hasLink},\n ${this.tabbable}`.replace(/\s/g,"");static subMenuButtons=`button${this.hasControls}`;static subMenu=`${this.subMenuButtons} + ul${this.hasId}`;static prefix(t){return(t=t.toLowerCase()).startsWith(this.pre)?t:`${this.pre}${t}`}static cssPrefix(t){return`--${this.prefix(t.replace(/^-+/,""))}`}static cssVar(t){return`var(${this.cssPrefix(t)})`}static neg(t){return`:not(${t})`}static class(t){return`.${this.prefix(t)}`}static id(t){return`#${this.prefix(t)}`}static controls(t){return t?`[aria-controls="${this.prefix(t)}"]`:this.hasControls}static expanded(t){return"boolean"==typeof t?`[aria-expanded="${t}"]`:this.hasExpanded}static getFocusables(t){let e;return e=t?Array.from(t.querySelectorAll(this.focusable)):Array.from(document.querySelectorAll(this.focusable)),e.filter((t=>this.isFocusable(t)))}static isFocusable(t){let e=t;do{if("none"===window.getComputedStyle(e).getPropertyValue("display").toLowerCase())return!1;e=e.parentElement}while(e);return!0}}class m{static slug(t){return t?.trim().toLowerCase().replace(/'/g,"").replace(/[^\w/-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^\/+|\/+$/g,"")??""}static unslug(t){return this.titleCase(t.replace(/[-/]+/g," "))}static phone(t){const e=t?.toString().trim()??"";if("("===e||""===e)return e;let s=e.replace(/\D/g,"")??"",a="";s.length>10&&(a+=`+${s.slice(0,s.length-10)} `,s=s.slice(s.length-10));for(var i=0;i<s.length;i++){switch(i){case 0:a+="(";break;case 3:a+=") ";break;case 6:a+="-"}a+=s[i]}switch(e[e.length-1]){case")":3===i&&(a+=") ");break;case"-":6===i&&(a+="-")}return a}static plural(t){return t.endsWith("ies")||t.endsWith("es")||t.endsWith("s")&&!t.endsWith("us")&&!t.endsWith("is")&&!t.endsWith("ss")?t:t.endsWith("y")&&!["a","e","i","o","u"].includes(t.charAt(t.length-2))?t.slice(0,-1)+"ies":t.endsWith("s")||t.endsWith("sh")||t.endsWith("ch")||t.endsWith("x")||t.endsWith("z")?t+"es":t+"s"}static titleCase(t){return t.toLowerCase().replace(/(?:^|\s)\S/g,(t=>t.toUpperCase()))}static copyText(t){let e=document.createElement("textarea");return!(!t||!e||(e.value=t,e.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(e),e.select(),e.setSelectionRange(0,99999),navigator.clipboard.writeText(e.value),document.body.removeChild(e),0))}static isEmail(t){return null!==t.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])+)\])/)}}class x{static width(){const t=document.body.getBoundingClientRect().width%1;return window.innerWidth+t}}var w=s.N7,B=s.TQ,S=s.Jy,$=s.BT,M=s.sh,k=s.c2,T=s.f$,v=s.JX,C=s.E_,E=s.qS,O=s.dG,j=s.a6,L=s.cQ,W=s.li,q=s.Qh;export{w as EMintSide,B as MintAsync,S as MintDisplay,$ as MintEvent,M as MintIcon,k as MintItem,T as MintList,v as MintMath,C as MintObject,E as MintScroll,O as MintSelectors,j as MintSettings,L as MintText,W as MintWindow,q as mintColor}; | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@appartmint/util", | ||
"author": "App/Art Mint", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -30,80 +30,35 @@ "description": "App/Art Mint Utility Functions", | ||
], | ||
"directories": { | ||
"dist": "dist", | ||
"doc": "docs", | ||
"src": "src", | ||
"test": "test" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"config": { | ||
"dirs": { | ||
"doc": "docs", | ||
"src": "src", | ||
"scss": "scss", | ||
"dist": "dist" | ||
}, | ||
"webpack": "node_modules/@appartmint/config/dist/js/webpack.config.min.js" | ||
}, | ||
"scripts": { | ||
"upgrade": "npm i -D @appartmint/config@latest && mint-config", | ||
"prepare": "npm-run-all clean bundle", | ||
"preversion": "npm i && npm run test", | ||
"version": "git add -A", | ||
"postversion": "git push && git push --tags && npm run endversion --if-present", | ||
"clean": "cross-var rimraf $npm_package_config_dirs_dist $npm_package_config_dirs_doc", | ||
"postversion": "git push && git push --tags && gh release create v$npm_package_version --generate-notes", | ||
"prepare": "npm-run-all clean bundle", | ||
"clean": "rimraf dist doc", | ||
"clear": "npm run clean", | ||
"bundle": "npm-run-all build build:**", | ||
"build": "cross-var webpack --config $npm_package_config_webpack", | ||
"build": "webpack --config src/config/webpack.config.js", | ||
"build:prod": "cross-env NODE_ENV=production npm run build", | ||
"build:index": "cross-env BUILD_MODE=index npm run build", | ||
"build:index:prod": "cross-env NODE_ENV=production BUILD_MODE=index npm run build", | ||
"build:config": "cross-env BUILD_MODE=config npm run build", | ||
"build:config:prod": "cross-env NODE_ENV=production BUILD_MODE=config npm run build", | ||
"build:tsdoc": "typedoc", | ||
"build:sassdoc": "cross-var \"sassdoc $npm_package_config_dirs_src/$npm_package_config_dirs_scss -p > $npm_package_config_dirs_doc/sassdoc.json\"", | ||
"serve": "cross-var webpack serve --config $npm_package_config_webpack", | ||
"watch": "npm run build -- --watch", | ||
"watch:prod": "cross-env NODE_ENV=production npm run watch", | ||
"watch:tsdoc": "npm run build:tsdoc -- --watch", | ||
"test": "echo-cli \"\\nRun tests here!\\n\"", | ||
"endversion": "echo '\nRemember to update @appartmint/config/src/ts/bin/update.ts with this new version!\n'" | ||
"test": "echo-cli \"\\nRun tests here!\\n\"" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@appartmint/config": "^1.0.1", | ||
"@babel/core": "^7.19.6", | ||
"@babel/preset-env": "^7.19.4", | ||
"babel-loader": "^9.0.1", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"cross-env": "^7.0.3", | ||
"cross-var": "^1.1.0", | ||
"css-loader": "^6.7.1", | ||
"css-loader": "^7.1.2", | ||
"echo-cli": "^2.0.0", | ||
"jasmine-core": "^4.5.0", | ||
"karma": "^6.4.1", | ||
"karma-babel-preprocessor": "^8.0.2", | ||
"karma-chrome-launcher": "^3.1.1", | ||
"karma-jasmine": "^5.1.0", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-typescript-preprocessor": "^0.4.0", | ||
"karma-webpack": "^5.0.0", | ||
"mini-css-extract-plugin": "^2.6.1", | ||
"npm-run-all": "^4.1.5", | ||
"rimraf": "^3.0.2", | ||
"sass": "^1.55.0", | ||
"sass-loader": "^13.1.0", | ||
"sassdoc": "^2.7.4", | ||
"ts-loader": "^9.4.1", | ||
"ts-node": "^10.9.1", | ||
"typedoc": "^0.23.19", | ||
"typescript": "^4.8.4", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-dev-server": "^4.11.1", | ||
"webpack-lowercase-name": "^1.0.4", | ||
"webpack-node-externals": "^3.0.0", | ||
"webpack-remove-empty-scripts": "^1.0.1", | ||
"webpack-shebang-plugin": "^1.1.8" | ||
"rimraf": "^6.0.1", | ||
"sass": "^1.83.1", | ||
"sass-loader": "^16.0.4", | ||
"ts-loader": "^9.5.1", | ||
"typedoc": "^0.27.6", | ||
"typescript": "^5.5.4", | ||
"webpack": "^5.97.1", | ||
"webpack-cli": "^6.0.1" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12
0
263111
2234