UNPKG

framework7

Version:

Full featured mobile HTML framework for building iOS & Android apps

1,569 lines (1,533 loc) 1.83 MB
/** * Framework7 8.3.4 * Full featured mobile HTML framework for building iOS & Android apps * https://framework7.io/ * * Copyright 2014-2024 Vladimir Kharlampidi * * Released under the MIT License * * Released on: September 18, 2024 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Framework7 = factory()); })(this, (function () { 'use strict'; /** * SSR Window 4.0.2 * Better handling for window object in SSR environment * https://github.com/nolimits4web/ssr-window * * Copyright 2021, Vladimir Kharlampidi * * Licensed under MIT * * Released on: December 13, 2021 */ /* eslint-disable no-param-reassign */ function isObject$4(obj) { return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; } function extend$4(target, src) { if (target === void 0) { target = {}; } if (src === void 0) { src = {}; } Object.keys(src).forEach(key => { if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$4(src[key]) && isObject$4(target[key]) && Object.keys(src[key]).length > 0) { extend$4(target[key], src[key]); } }); } const ssrDocument$1 = { body: {}, addEventListener() {}, removeEventListener() {}, activeElement: { blur() {}, nodeName: '' }, querySelector() { return null; }, querySelectorAll() { return []; }, getElementById() { return null; }, createEvent() { return { initEvent() {} }; }, createElement() { return { children: [], childNodes: [], style: {}, setAttribute() {}, getElementsByTagName() { return []; } }; }, createElementNS() { return {}; }, importNode() { return null; }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '' } }; function getDocument$1() { const doc = typeof document !== 'undefined' ? document : {}; extend$4(doc, ssrDocument$1); return doc; } const ssrWindow$1 = { document: ssrDocument$1, navigator: { userAgent: '' }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '' }, history: { replaceState() {}, pushState() {}, go() {}, back() {} }, CustomEvent: function CustomEvent() { return this; }, addEventListener() {}, removeEventListener() {}, getComputedStyle() { return { getPropertyValue() { return ''; } }; }, Image() {}, Date() {}, screen: {}, setTimeout() {}, clearTimeout() {}, matchMedia() { return {}; }, requestAnimationFrame(callback) { if (typeof setTimeout === 'undefined') { callback(); return null; } return setTimeout(callback, 0); }, cancelAnimationFrame(id) { if (typeof setTimeout === 'undefined') { return; } clearTimeout(id); } }; function getWindow$1() { const win = typeof window !== 'undefined' ? window : {}; extend$4(win, ssrWindow$1); return win; } /** * Dom7 4.0.6 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API * https://framework7.io/docs/dom7.html * * Copyright 2023, Vladimir Kharlampidi * * Licensed under MIT * * Released on: February 2, 2023 */ /* eslint-disable no-proto */ function makeReactive(obj) { const proto = obj.__proto__; Object.defineProperty(obj, '__proto__', { get() { return proto; }, set(value) { proto.__proto__ = value; } }); } class Dom7 extends Array { constructor(items) { if (typeof items === 'number') { super(items); } else { super(...(items || [])); makeReactive(this); } } } function arrayFlat(arr) { if (arr === void 0) { arr = []; } const res = []; arr.forEach(el => { if (Array.isArray(el)) { res.push(...arrayFlat(el)); } else { res.push(el); } }); return res; } function arrayFilter(arr, callback) { return Array.prototype.filter.call(arr, callback); } function arrayUnique(arr) { const uniqueArray = []; for (let i = 0; i < arr.length; i += 1) { if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]); } return uniqueArray; } function toCamelCase$1(string) { return string.toLowerCase().replace(/-(.)/g, (match, group) => group.toUpperCase()); } // eslint-disable-next-line function qsa(selector, context) { if (typeof selector !== 'string') { return [selector]; } const a = []; const res = context.querySelectorAll(selector); for (let i = 0; i < res.length; i += 1) { a.push(res[i]); } return a; } function $$1(selector, context) { const window = getWindow$1(); const document = getDocument$1(); let arr = []; if (!context && selector instanceof Dom7) { return selector; } if (!selector) { return new Dom7(arr); } if (typeof selector === 'string') { const html = selector.trim(); if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) { let toCreate = 'div'; if (html.indexOf('<li') === 0) toCreate = 'ul'; if (html.indexOf('<tr') === 0) toCreate = 'tbody'; if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr'; if (html.indexOf('<tbody') === 0) toCreate = 'table'; if (html.indexOf('<option') === 0) toCreate = 'select'; const tempParent = document.createElement(toCreate); tempParent.innerHTML = html; for (let i = 0; i < tempParent.childNodes.length; i += 1) { arr.push(tempParent.childNodes[i]); } } else { arr = qsa(selector.trim(), context || document); } // arr = qsa(selector, document); } else if (selector.nodeType || selector === window || selector === document) { arr.push(selector); } else if (Array.isArray(selector)) { if (selector instanceof Dom7) return selector; arr = selector; } return new Dom7(arrayUnique(arr)); } $$1.fn = Dom7.prototype; // eslint-disable-next-line function addClass() { for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) { classes[_key] = arguments[_key]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { el.classList.add(...classNames); }); return this; } function removeClass() { for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { classes[_key2] = arguments[_key2]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { el.classList.remove(...classNames); }); return this; } function toggleClass() { for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { classes[_key3] = arguments[_key3]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { classNames.forEach(className => { el.classList.toggle(className); }); }); } function hasClass() { for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { classes[_key4] = arguments[_key4]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); return arrayFilter(this, el => { return classNames.filter(className => el.classList.contains(className)).length > 0; }).length > 0; } function attr(attrs, value) { if (arguments.length === 1 && typeof attrs === 'string') { // Get attr if (this[0]) return this[0].getAttribute(attrs); return undefined; } // Set attrs for (let i = 0; i < this.length; i += 1) { if (arguments.length === 2) { // String this[i].setAttribute(attrs, value); } else { // Object for (const attrName in attrs) { this[i][attrName] = attrs[attrName]; this[i].setAttribute(attrName, attrs[attrName]); } } } return this; } function removeAttr(attr) { for (let i = 0; i < this.length; i += 1) { this[i].removeAttribute(attr); } return this; } function prop(props, value) { if (arguments.length === 1 && typeof props === 'string') { // Get prop if (this[0]) return this[0][props]; } else { // Set props for (let i = 0; i < this.length; i += 1) { if (arguments.length === 2) { // String this[i][props] = value; } else { // Object for (const propName in props) { this[i][propName] = props[propName]; } } } return this; } return this; } function data(key, value) { let el; if (typeof value === 'undefined') { el = this[0]; if (!el) return undefined; // Get value if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) { return el.dom7ElementDataStorage[key]; } const dataKey = el.getAttribute(`data-${key}`); if (dataKey) { return dataKey; } return undefined; } // Set value for (let i = 0; i < this.length; i += 1) { el = this[i]; if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {}; el.dom7ElementDataStorage[key] = value; } return this; } function removeData(key) { for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) { el.dom7ElementDataStorage[key] = null; delete el.dom7ElementDataStorage[key]; } } } function dataset() { const el = this[0]; if (!el) return undefined; const dataset = {}; // eslint-disable-line if (el.dataset) { for (const dataKey in el.dataset) { dataset[dataKey] = el.dataset[dataKey]; } } else { for (let i = 0; i < el.attributes.length; i += 1) { const attr = el.attributes[i]; if (attr.name.indexOf('data-') >= 0) { dataset[toCamelCase$1(attr.name.split('data-')[1])] = attr.value; } } } for (const key in dataset) { if (dataset[key] === 'false') dataset[key] = false;else if (dataset[key] === 'true') dataset[key] = true;else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1; } return dataset; } function val(value) { if (typeof value === 'undefined') { // get value const el = this[0]; if (!el) return undefined; if (el.multiple && el.nodeName.toLowerCase() === 'select') { const values = []; for (let i = 0; i < el.selectedOptions.length; i += 1) { values.push(el.selectedOptions[i].value); } return values; } return el.value; } // set value for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (Array.isArray(value) && el.multiple && el.nodeName.toLowerCase() === 'select') { for (let j = 0; j < el.options.length; j += 1) { el.options[j].selected = value.indexOf(el.options[j].value) >= 0; } } else { el.value = value; } } return this; } function value(value) { return this.val(value); } function transform(transform) { for (let i = 0; i < this.length; i += 1) { this[i].style.transform = transform; } return this; } function transition$1(duration) { for (let i = 0; i < this.length; i += 1) { this[i].style.transitionDuration = typeof duration !== 'string' ? `${duration}ms` : duration; } return this; } function on() { for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } let [eventType, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventType, listener, capture] = args; targetSelector = undefined; } if (!capture) capture = false; function handleLiveEvent(e) { const target = e.target; if (!target) return; const eventData = e.target.dom7EventData || []; if (eventData.indexOf(e) < 0) { eventData.unshift(e); } if ($$1(target).is(targetSelector)) listener.apply(target, eventData);else { const parents = $$1(target).parents(); // eslint-disable-line for (let k = 0; k < parents.length; k += 1) { if ($$1(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData); } } } function handleEvent(e) { const eventData = e && e.target ? e.target.dom7EventData || [] : []; if (eventData.indexOf(e) < 0) { eventData.unshift(e); } listener.apply(this, eventData); } const events = eventType.split(' '); let j; for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (!targetSelector) { for (j = 0; j < events.length; j += 1) { const event = events[j]; if (!el.dom7Listeners) el.dom7Listeners = {}; if (!el.dom7Listeners[event]) el.dom7Listeners[event] = []; el.dom7Listeners[event].push({ listener, proxyListener: handleEvent }); el.addEventListener(event, handleEvent, capture); } } else { // Live events for (j = 0; j < events.length; j += 1) { const event = events[j]; if (!el.dom7LiveListeners) el.dom7LiveListeners = {}; if (!el.dom7LiveListeners[event]) el.dom7LiveListeners[event] = []; el.dom7LiveListeners[event].push({ listener, proxyListener: handleLiveEvent }); el.addEventListener(event, handleLiveEvent, capture); } } } return this; } function off() { for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { args[_key6] = arguments[_key6]; } let [eventType, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventType, listener, capture] = args; targetSelector = undefined; } if (!capture) capture = false; const events = eventType.split(' '); for (let i = 0; i < events.length; i += 1) { const event = events[i]; for (let j = 0; j < this.length; j += 1) { const el = this[j]; let handlers; if (!targetSelector && el.dom7Listeners) { handlers = el.dom7Listeners[event]; } else if (targetSelector && el.dom7LiveListeners) { handlers = el.dom7LiveListeners[event]; } if (handlers && handlers.length) { for (let k = handlers.length - 1; k >= 0; k -= 1) { const handler = handlers[k]; if (listener && handler.listener === listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } else if (!listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } } } } } return this; } function once() { const dom = this; for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { args[_key7] = arguments[_key7]; } let [eventName, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventName, listener, capture] = args; targetSelector = undefined; } function onceHandler() { for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { eventArgs[_key8] = arguments[_key8]; } listener.apply(this, eventArgs); dom.off(eventName, targetSelector, onceHandler, capture); if (onceHandler.dom7proxy) { delete onceHandler.dom7proxy; } } onceHandler.dom7proxy = listener; return dom.on(eventName, targetSelector, onceHandler, capture); } function trigger() { const window = getWindow$1(); for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { args[_key9] = arguments[_key9]; } const events = args[0].split(' '); const eventData = args[1]; for (let i = 0; i < events.length; i += 1) { const event = events[i]; for (let j = 0; j < this.length; j += 1) { const el = this[j]; if (window.CustomEvent) { const evt = new window.CustomEvent(event, { detail: eventData, bubbles: true, cancelable: true }); el.dom7EventData = args.filter((data, dataIndex) => dataIndex > 0); el.dispatchEvent(evt); el.dom7EventData = []; delete el.dom7EventData; } } } return this; } function transitionStart$1(callback) { const dom = this; function fireCallBack(e) { if (e.target !== this) return; callback.call(this, e); dom.off('transitionstart', fireCallBack); } if (callback) { dom.on('transitionstart', fireCallBack); } return this; } function transitionEnd$1(callback) { const dom = this; function fireCallBack(e) { if (e.target !== this) return; callback.call(this, e); dom.off('transitionend', fireCallBack); } if (callback) { dom.on('transitionend', fireCallBack); } return this; } function animationEnd(callback) { const dom = this; function fireCallBack(e) { if (e.target !== this) return; callback.call(this, e); dom.off('animationend', fireCallBack); } if (callback) { dom.on('animationend', fireCallBack); } return this; } function width() { const window = getWindow$1(); if (this[0] === window) { return window.innerWidth; } if (this.length > 0) { return parseFloat(this.css('width')); } return null; } function outerWidth(includeMargins) { if (this.length > 0) { if (includeMargins) { const styles = this.styles(); return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left')); } return this[0].offsetWidth; } return null; } function height() { const window = getWindow$1(); if (this[0] === window) { return window.innerHeight; } if (this.length > 0) { return parseFloat(this.css('height')); } return null; } function outerHeight(includeMargins) { if (this.length > 0) { if (includeMargins) { const styles = this.styles(); return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom')); } return this[0].offsetHeight; } return null; } function offset() { if (this.length > 0) { const window = getWindow$1(); const document = getDocument$1(); const el = this[0]; const box = el.getBoundingClientRect(); const body = document.body; const clientTop = el.clientTop || body.clientTop || 0; const clientLeft = el.clientLeft || body.clientLeft || 0; const scrollTop = el === window ? window.scrollY : el.scrollTop; const scrollLeft = el === window ? window.scrollX : el.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; } return null; } function hide() { for (let i = 0; i < this.length; i += 1) { this[i].style.display = 'none'; } return this; } function show() { const window = getWindow$1(); for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (el.style.display === 'none') { el.style.display = ''; } if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') { // Still not visible el.style.display = 'block'; } } return this; } function styles() { const window = getWindow$1(); if (this[0]) return window.getComputedStyle(this[0], null); return {}; } function css(props, value) { const window = getWindow$1(); let i; if (arguments.length === 1) { if (typeof props === 'string') { // .css('width') if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props); } else { // .css({ width: '100px' }) for (i = 0; i < this.length; i += 1) { for (const prop in props) { this[i].style[prop] = props[prop]; } } return this; } } if (arguments.length === 2 && typeof props === 'string') { // .css('width', '100px') for (i = 0; i < this.length; i += 1) { this[i].style[props] = value; } return this; } return this; } function each(callback) { if (!callback) return this; this.forEach((el, index) => { callback.apply(el, [el, index]); }); return this; } function filter(callback) { const result = arrayFilter(this, callback); return $$1(result); } function html(html) { if (typeof html === 'undefined') { return this[0] ? this[0].innerHTML : null; } for (let i = 0; i < this.length; i += 1) { this[i].innerHTML = html; } return this; } function text(text) { if (typeof text === 'undefined') { return this[0] ? this[0].textContent.trim() : null; } for (let i = 0; i < this.length; i += 1) { this[i].textContent = text; } return this; } function is(selector) { const window = getWindow$1(); const document = getDocument$1(); const el = this[0]; let compareWith; let i; if (!el || typeof selector === 'undefined') return false; if (typeof selector === 'string') { if (el.matches) return el.matches(selector); if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector); if (el.msMatchesSelector) return el.msMatchesSelector(selector); compareWith = $$1(selector); for (i = 0; i < compareWith.length; i += 1) { if (compareWith[i] === el) return true; } return false; } if (selector === document) { return el === document; } if (selector === window) { return el === window; } if (selector.nodeType || selector instanceof Dom7) { compareWith = selector.nodeType ? [selector] : selector; for (i = 0; i < compareWith.length; i += 1) { if (compareWith[i] === el) return true; } return false; } return false; } function index() { let child = this[0]; let i; if (child) { i = 0; // eslint-disable-next-line while ((child = child.previousSibling) !== null) { if (child.nodeType === 1) i += 1; } return i; } return undefined; } function eq(index) { if (typeof index === 'undefined') return this; const length = this.length; if (index > length - 1) { return $$1([]); } if (index < 0) { const returnIndex = length + index; if (returnIndex < 0) return $$1([]); return $$1([this[returnIndex]]); } return $$1([this[index]]); } function append() { let newChild; const document = getDocument$1(); for (let k = 0; k < arguments.length; k += 1) { newChild = k < 0 || arguments.length <= k ? undefined : arguments[k]; for (let i = 0; i < this.length; i += 1) { if (typeof newChild === 'string') { const tempDiv = document.createElement('div'); tempDiv.innerHTML = newChild; while (tempDiv.firstChild) { this[i].appendChild(tempDiv.firstChild); } } else if (newChild instanceof Dom7) { for (let j = 0; j < newChild.length; j += 1) { this[i].appendChild(newChild[j]); } } else { this[i].appendChild(newChild); } } } return this; } function appendTo(parent) { $$1(parent).append(this); return this; } function prepend(newChild) { const document = getDocument$1(); let i; let j; for (i = 0; i < this.length; i += 1) { if (typeof newChild === 'string') { const tempDiv = document.createElement('div'); tempDiv.innerHTML = newChild; for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) { this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]); } } else if (newChild instanceof Dom7) { for (j = 0; j < newChild.length; j += 1) { this[i].insertBefore(newChild[j], this[i].childNodes[0]); } } else { this[i].insertBefore(newChild, this[i].childNodes[0]); } } return this; } function prependTo(parent) { $$1(parent).prepend(this); return this; } function insertBefore$1(selector) { const before = $$1(selector); for (let i = 0; i < this.length; i += 1) { if (before.length === 1) { before[0].parentNode.insertBefore(this[i], before[0]); } else if (before.length > 1) { for (let j = 0; j < before.length; j += 1) { before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]); } } } } function insertAfter(selector) { const after = $$1(selector); for (let i = 0; i < this.length; i += 1) { if (after.length === 1) { after[0].parentNode.insertBefore(this[i], after[0].nextSibling); } else if (after.length > 1) { for (let j = 0; j < after.length; j += 1) { after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling); } } } } function next(selector) { if (this.length > 0) { if (selector) { if (this[0].nextElementSibling && $$1(this[0].nextElementSibling).is(selector)) { return $$1([this[0].nextElementSibling]); } return $$1([]); } if (this[0].nextElementSibling) return $$1([this[0].nextElementSibling]); return $$1([]); } return $$1([]); } function nextAll(selector) { const nextEls = []; let el = this[0]; if (!el) return $$1([]); while (el.nextElementSibling) { const next = el.nextElementSibling; // eslint-disable-line if (selector) { if ($$1(next).is(selector)) nextEls.push(next); } else nextEls.push(next); el = next; } return $$1(nextEls); } function prev(selector) { if (this.length > 0) { const el = this[0]; if (selector) { if (el.previousElementSibling && $$1(el.previousElementSibling).is(selector)) { return $$1([el.previousElementSibling]); } return $$1([]); } if (el.previousElementSibling) return $$1([el.previousElementSibling]); return $$1([]); } return $$1([]); } function prevAll(selector) { const prevEls = []; let el = this[0]; if (!el) return $$1([]); while (el.previousElementSibling) { const prev = el.previousElementSibling; // eslint-disable-line if (selector) { if ($$1(prev).is(selector)) prevEls.push(prev); } else prevEls.push(prev); el = prev; } return $$1(prevEls); } function siblings(selector) { return this.nextAll(selector).add(this.prevAll(selector)); } function parent(selector) { const parents = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { if (this[i].parentNode !== null) { if (selector) { if ($$1(this[i].parentNode).is(selector)) parents.push(this[i].parentNode); } else { parents.push(this[i].parentNode); } } } return $$1(parents); } function parents(selector) { const parents = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { let parent = this[i].parentNode; // eslint-disable-line while (parent) { if (selector) { if ($$1(parent).is(selector)) parents.push(parent); } else { parents.push(parent); } parent = parent.parentNode; } } return $$1(parents); } function closest(selector) { let closest = this; // eslint-disable-line if (typeof selector === 'undefined') { return $$1([]); } if (!closest.is(selector)) { closest = closest.parents(selector).eq(0); } return closest; } function find(selector) { const foundElements = []; for (let i = 0; i < this.length; i += 1) { const found = this[i].querySelectorAll(selector); for (let j = 0; j < found.length; j += 1) { foundElements.push(found[j]); } } return $$1(foundElements); } function children(selector) { const children = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { const childNodes = this[i].children; for (let j = 0; j < childNodes.length; j += 1) { if (!selector || $$1(childNodes[j]).is(selector)) { children.push(childNodes[j]); } } } return $$1(children); } function remove() { for (let i = 0; i < this.length; i += 1) { if (this[i].parentNode) this[i].parentNode.removeChild(this[i]); } return this; } function detach() { return this.remove(); } function add() { const dom = this; let i; let j; for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { els[_key10] = arguments[_key10]; } for (i = 0; i < els.length; i += 1) { const toAdd = $$1(els[i]); for (j = 0; j < toAdd.length; j += 1) { dom.push(toAdd[j]); } } return dom; } function empty() { for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (el.nodeType === 1) { for (let j = 0; j < el.childNodes.length; j += 1) { if (el.childNodes[j].parentNode) { el.childNodes[j].parentNode.removeChild(el.childNodes[j]); } } el.textContent = ''; } } return this; } // eslint-disable-next-line function scrollTo() { const window = getWindow$1(); for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { args[_key11] = arguments[_key11]; } let [left, top, duration, easing, callback] = args; if (args.length === 4 && typeof easing === 'function') { callback = easing; [left, top, duration, callback, easing] = args; } if (typeof easing === 'undefined') easing = 'swing'; return this.each(function animate() { const el = this; let currentTop; let currentLeft; let maxTop; let maxLeft; let newTop; let newLeft; let scrollTop; // eslint-disable-line let scrollLeft; // eslint-disable-line let animateTop = top > 0 || top === 0; let animateLeft = left > 0 || left === 0; if (typeof easing === 'undefined') { easing = 'swing'; } if (animateTop) { currentTop = el.scrollTop; if (!duration) { el.scrollTop = top; } } if (animateLeft) { currentLeft = el.scrollLeft; if (!duration) { el.scrollLeft = left; } } if (!duration) return; if (animateTop) { maxTop = el.scrollHeight - el.offsetHeight; newTop = Math.max(Math.min(top, maxTop), 0); } if (animateLeft) { maxLeft = el.scrollWidth - el.offsetWidth; newLeft = Math.max(Math.min(left, maxLeft), 0); } let startTime = null; if (animateTop && newTop === currentTop) animateTop = false; if (animateLeft && newLeft === currentLeft) animateLeft = false; function render(time) { if (time === void 0) { time = new Date().getTime(); } if (startTime === null) { startTime = time; } const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); const easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2; let done; if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop); if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft); if (animateTop && newTop > currentTop && scrollTop >= newTop) { el.scrollTop = newTop; done = true; } if (animateTop && newTop < currentTop && scrollTop <= newTop) { el.scrollTop = newTop; done = true; } if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) { el.scrollLeft = newLeft; done = true; } if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) { el.scrollLeft = newLeft; done = true; } if (done) { if (callback) callback(); return; } if (animateTop) el.scrollTop = scrollTop; if (animateLeft) el.scrollLeft = scrollLeft; window.requestAnimationFrame(render); } window.requestAnimationFrame(render); }); } // scrollTop(top, duration, easing, callback) { function scrollTop() { for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { args[_key12] = arguments[_key12]; } let [top, duration, easing, callback] = args; if (args.length === 3 && typeof easing === 'function') { [top, duration, callback, easing] = args; } const dom = this; if (typeof top === 'undefined') { if (dom.length > 0) return dom[0].scrollTop; return null; } return dom.scrollTo(undefined, top, duration, easing, callback); } function scrollLeft() { for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) { args[_key13] = arguments[_key13]; } let [left, duration, easing, callback] = args; if (args.length === 3 && typeof easing === 'function') { [left, duration, callback, easing] = args; } const dom = this; if (typeof left === 'undefined') { if (dom.length > 0) return dom[0].scrollLeft; return null; } return dom.scrollTo(left, undefined, duration, easing, callback); } // eslint-disable-next-line function animate(initialProps, initialParams) { const window = getWindow$1(); const els = this; const a = { props: Object.assign({}, initialProps), params: Object.assign({ duration: 300, easing: 'swing' // or 'linear' /* Callbacks begin(elements) complete(elements) progress(elements, complete, remaining, start, tweenValue) */ }, initialParams), elements: els, animating: false, que: [], easingProgress(easing, progress) { if (easing === 'swing') { return 0.5 - Math.cos(progress * Math.PI) / 2; } if (typeof easing === 'function') { return easing(progress); } return progress; }, stop() { if (a.frameId) { window.cancelAnimationFrame(a.frameId); } a.animating = false; a.elements.each(el => { const element = el; delete element.dom7AnimateInstance; }); a.que = []; }, done(complete) { a.animating = false; a.elements.each(el => { const element = el; delete element.dom7AnimateInstance; }); if (complete) complete(els); if (a.que.length > 0) { const que = a.que.shift(); a.animate(que[0], que[1]); } }, animate(props, params) { if (a.animating) { a.que.push([props, params]); return a; } const elements = []; // Define & Cache Initials & Units a.elements.each((el, index) => { let initialFullValue; let initialValue; let unit; let finalValue; let finalFullValue; if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a; elements[index] = { container: el }; Object.keys(props).forEach(prop => { initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.'); initialValue = parseFloat(initialFullValue); unit = initialFullValue.replace(initialValue, ''); finalValue = parseFloat(props[prop]); finalFullValue = props[prop] + unit; elements[index][prop] = { initialFullValue, initialValue, unit, finalValue, finalFullValue, currentValue: initialValue }; }); }); let startTime = null; let time; let elementsDone = 0; let propsDone = 0; let done; let began = false; a.animating = true; function render() { time = new Date().getTime(); let progress; let easeProgress; // let el; if (!began) { began = true; if (params.begin) params.begin(els); } if (startTime === null) { startTime = time; } if (params.progress) { // eslint-disable-next-line params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime); } elements.forEach(element => { const el = element; if (done || el.done) return; Object.keys(props).forEach(prop => { if (done || el.done) return; progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0); easeProgress = a.easingProgress(params.easing, progress); const { initialValue, finalValue, unit } = el[prop]; el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue); const currentValue = el[prop].currentValue; if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) { el.container.style[prop] = finalValue + unit; propsDone += 1; if (propsDone === Object.keys(props).length) { el.done = true; elementsDone += 1; } if (elementsDone === elements.length) { done = true; } } if (done) { a.done(params.complete); return; } el.container.style[prop] = currentValue + unit; }); }); if (done) return; // Then call a.frameId = window.requestAnimationFrame(render); } a.frameId = window.requestAnimationFrame(render); return a; } }; if (a.elements.length === 0) { return els; } let animateInstance; for (let i = 0; i < a.elements.length; i += 1) { if (a.elements[i].dom7AnimateInstance) { animateInstance = a.elements[i].dom7AnimateInstance; } else a.elements[i].dom7AnimateInstance = a; } if (!animateInstance) { animateInstance = a; } if (initialProps === 'stop') { animateInstance.stop(); } else { animateInstance.animate(a.props, a.params); } return els; } function stop() { const els = this; for (let i = 0; i < els.length; i += 1) { if (els[i].dom7AnimateInstance) { els[i].dom7AnimateInstance.stop(); } } } const noTrigger = 'resize scroll'.split(' '); function shortcut(name) { function eventHandler() { for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) { args[_key14] = arguments[_key14]; } if (typeof args[0] === 'undefined') { for (let i = 0; i < this.length; i += 1) { if (noTrigger.indexOf(name) < 0) { if (name in this[i]) this[i][name]();else { $$1(this[i]).trigger(name); } } } return this; } return this.on(name, ...args); } return eventHandler; } const click = shortcut('click'); const blur = shortcut('blur'); const focus = shortcut('focus'); const focusin = shortcut('focusin'); const focusout = shortcut('focusout'); const keyup = shortcut('keyup'); const keydown = shortcut('keydown'); const keypress = shortcut('keypress'); const submit = shortcut('submit'); const change = shortcut('change'); const mousedown = shortcut('mousedown'); const mousemove = shortcut('mousemove'); const mouseup = shortcut('mouseup'); const mouseenter = shortcut('mouseenter'); const mouseleave = shortcut('mouseleave'); const mouseout = shortcut('mouseout'); const mouseover = shortcut('mouseover'); const touchstart = shortcut('touchstart'); const touchend = shortcut('touchend'); const touchmove = shortcut('touchmove'); const resize = shortcut('resize'); const scroll = shortcut('scroll'); var methods = /*#__PURE__*/Object.freeze({ __proto__: null, $: $$1, add: add, addClass: addClass, animate: animate, animationEnd: animationEnd, append: append, appendTo: appendTo, attr: attr, blur: blur, change: change, children: children, click: click, closest: closest, css: css, data: data, dataset: dataset, default: $$1, detach: detach, each: each, empty: empty, eq: eq, filter: filter, find: find, focus: focus, focusin: focusin, focusout: focusout, hasClass: hasClass, height: height, hide: hide, html: html, index: index, insertAfter: insertAfter, insertBefore: insertBefore$1, is: is, keydown: keydown, keypress: keypress, keyup: keyup, mousedown: mousedown, mouseenter: mouseenter, mouseleave: mouseleave, mousemove: mousemove, mouseout: mouseout, mouseover: mouseover, mouseup: mouseup, next: next, nextAll: nextAll, off: off, offset: offset, on: on, once: once, outerHeight: outerHeight, outerWidth: outerWidth, parent: parent, parents: parents, prepend: prepend, prependTo: prependTo, prev: prev, prevAll: prevAll, prop: prop, remove: remove, removeAttr: removeAttr, removeClass: removeClass, removeData: removeData, resize: resize, scroll: scroll, scrollLeft: scrollLeft, scrollTo: scrollTo, scrollTop: scrollTop, show: show, siblings: siblings, stop: stop, styles: styles, submit: submit, text: text, toggleClass: toggleClass, touchend: touchend, touchmove: touchmove, touchstart: touchstart, transform: transform, transition: transition$1, transitionEnd: transitionEnd$1, transitionStart: transitionStart$1, trigger: trigger, val: val, value: value, width: width }); // eslint-disable-next-line Object.keys(methods).forEach(methodName => { if (methodName === '$') return; $$1.fn[methodName] = methods[methodName]; }); var $ = $$1; /* eslint-disable */ function signum(num) { return num < 0 ? -1 : 0 === num ? 0 : 1; } function lerp(start, stop, amount) { return (1 - amount) * start + amount * stop; } function clampInt(min, max, input) { return input < min ? min : input > max ? max : input; } function clampDouble(min, max, input) { return input < min ? min : input > max ? max : input; } function sanitizeDegreesDouble(degrees) { return (degrees %= 360) < 0 && (degrees += 360), degrees; } function rotationDirection(from, to) { return sanitizeDegreesDouble(to - from) <= 180 ? 1 : -1; } function differenceDegrees(a, b) { return 180 - Math.abs(Math.abs(a - b) - 180); } function matrixMultiply(row, matrix) { return [row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2], row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2], row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2]]; } const SRGB_TO_XYZ = [[.41233895, .35762064, .18051042], [.2126, .7152, .0722], [.01932141, .11916382, .95034478]], XYZ_TO_SRGB = [[3.2413774792388685, -1.5376652402851851, -.49885366846268053], [-.9691452513005321, 1.8758853451067872, .04156585616912061], [.05562093689691305, -.20395524564742123, 1.0571799111220335]], WHITE_POINT_D65 = [95.047, 100, 108.883]; function argbFromRgb(red, green, blue) { return (255 << 24 | (255 & red) << 16 | (255 & green) << 8 | 255 & blue) >>> 0; } function argbFromLinrgb(linrgb) { return argbFromRgb(delinearized(linrgb[0]), delinearized(linrgb[1]), delinearized(linrgb[2])); } function redFromArgb(argb) { return argb >> 16 & 255; } function greenFromArgb(argb) { return argb >> 8 & 255; } function blueFromArgb(argb) { return 255 & argb; } function argbFromXyz(x, y, z) { const matrix = XYZ_TO_SRGB, linearR = matrix[0][0] * x + matrix[0][1] * y + matrix[0][2] * z, linearG = matrix[1][0] * x + matrix[1][1] * y + matrix[