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,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAEjE,IAAI,KAAK,GAAW,MAAM,CAAC,WAAW,CAAC;QACvC,IAAI,MAAM,GAAW,MAAM,CAAC,YAAY,CAAC;QACzC,IAAI,SAAS,GAAW,MAAM,CAAC,SAAS,CAAC;QACzC,IAAI,UAAU,GAAW,MAAM,CAAC,UAAU,CAAC;QAE3C,8BAA8B;QAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YAC1B,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;YACrC,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;YAClC,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,WAAW,CAAC;YACzC,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;SAC3C;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,GAAM,KAAK,OAAI,CAAC;QAC/C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,GAAM,MAAM,OAAI,CAAC;QACjD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,eAAa,UAAU,WAAM,SAAS,QAAK,CAAC;QAElF,UAAU,CAAC;YACV,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC1B,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACF,eAAC;AAAD,CAAC;AAQD,aAAa;AACb,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;;;;;;;UCjN3B;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;UCrBA;UACA;UACA;UACA","file":"lavalamp.js","sourcesContent":["/**\n * Lava Lamp\n * http://lavalamp.magicmediamuse.com/\n *\n * Author\n * Richard Hung\n * http://www.magicmediamuse.com/\n *\n * Version\n * 2.0.0\n *\n * Copyright (c) 2021 Richard Hung.\n *\n * License\n * Lava Lamp by Richard Hung is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.\n * http://creativecommons.org/licenses/by-nc/3.0/deed.en_US\n */\n\nimport {ISettings} from \"../types\";\n\nclass Lavalamp {\n\twrapper: HTMLElement;\n\tlavalampObject: HTMLDivElement;\n\tsettings: ISettings;\n\tchildren: NodeListOf;\n\tactiveElement: HTMLElement;\n\tisAnimating: boolean;\n\tisFocused: boolean;\n\tisHovered: boolean;\n\n\t/**\n\t * Initialize lavalamp plugin on DOM.\n\t * Assign values to plugin variables.\n\t * Create lavalamp object div element and bind all applicable event listeners.\n\t *\n\t * @param wrapper HTML element of the direct parent wrapper\n\t * @param customSettings\n\t */\n\tconstructor(wrapper: HTMLElement, customSettings: ISettings) {\n\t\tconst defaultSettings: ISettings = {\n\t\t\teasing: 'ease', // Easing transition\n\t\t\tduration: 700, // Duration of animation\n\t\t\tmargins: false, // Whether or not to include margins\n\t\t\tsetOnClick: false, // Whether or not to set the new active element on click\n\t\t\tinitActiveQuery: '.active', // Initial query selector for the active element\n\t\t\tenableHover: true, // lavalamp moves with hover instead of click\n\t\t\tdelayOn: 0, // Delay time on hover\n\t\t\tdelayOff: 0, // Delay time off hover\n\t\t\tenableFocus: false, // Animate on element focus\n\t\t\tdeepFocus: false, // Animate on descendant focus\n\t\t};\n\t\tthis.settings = {...defaultSettings, ...customSettings};\n\n\t\t// Initialize classes and declare properties\n\t\tthis.wrapper = wrapper;\n\t\tthis.wrapper.classList.add(\"lavalamp\");\n\t\tfor (let i = 0; i < this.wrapper.children.length; i++) {\n\t\t\tthis.wrapper.children[i].classList.add(\"lavalamp__item\");\n\t\t}\n\t\tthis.children = wrapper.querySelectorAll(\".lavalamp__item\");\n\t\tthis.activeElement = wrapper.querySelector(this.settings.initActiveQuery);\n\n\t\t// Create lavalamp object\n\t\tthis.lavalampObject = document.createElement('div');\n\t\tthis.lavalampObject.classList.add(\"lavalamp__object\");\n\t\tthis.lavalampObject.style.transitionDuration = `${this.settings.duration / 1000}s`;\n\t\tthis.wrapper.prepend(this.lavalampObject);\n\n\t\t// Bind hover events\n\t\tif (this.settings.enableHover) {\n\t\t\tthis.children.forEach((element: HTMLElement) => {\n\t\t\t\telement.addEventListener(\"mouseenter\", this.mouseEnter.bind(this));\n\t\t\t\telement.addEventListener(\"mouseleave\", this.mouseLeave.bind(this));\n\t\t\t});\n\t\t}\n\n\t\t// Bind focus events\n\t\tif (this.settings.deepFocus) {\n\t\t\tthis.wrapper.querySelectorAll(\"*\").forEach((element: HTMLElement) => {\n\t\t\t\telement.addEventListener(\"focusin\", this.focusIn.bind(this));\n\t\t\t\telement.addEventListener(\"focusout\", this.focusOut.bind(this));\n\t\t\t});\n\t\t} else if (this.settings.enableFocus) {\n\t\t\tthis.children.forEach((element: HTMLElement) => {\n\t\t\t\telement.addEventListener(\"focusin\", this.focusIn.bind(this));\n\t\t\t\telement.addEventListener(\"focusout\", this.focusOut.bind(this));\n\t\t\t});\n\t\t}\n\n\t\t// Bind set on click event\n\t\tif (this.settings.setOnClick) {\n\t\t\tthis.children.forEach((element: HTMLElement) => {\n\t\t\t\telement.addEventListener(\"mousedown\", this.setOnClick.bind(this));\n\t\t\t});\n\t\t}\n\n\t\t// Initial reposition of lavalamp element\n\t\twindow.addEventListener('DOMContentLoaded', () => {\n\t\t\tthis.reposition(this.activeElement);\n\t\t});\n\n\t}\n\n\t/**\n\t * Event that gets triggered on mousedown when `setOnClick` option is true\n\t */\n\tsetOnClick(e: MouseEvent) {\n\t\tthis.activeElement = e.target as HTMLElement;\n\t\tthis.reposition(e.target as HTMLElement);\n\t}\n\n\t/**\n\t * Event that gets triggered on mouseenter when `enableHover` option is true\n\t */\n\tmouseEnter(e: MouseEvent) {\n\t\tthis.isHovered = true;\n\t\tsetTimeout(() => {\n\t\t\t// If element is still being hovered and is not focused\n\t\t\tif (this.isHovered && !this.isFocused) {\n\t\t\t\tthis.reposition(e.target as HTMLElement);\n\t\t\t}\n\t\t}, this.settings.delayOn);\n\t}\n\n\t/**\n\t * Event that gets triggered on mouseLeave when `enableHover` option is true\n\t */\n\tmouseLeave() {\n\t\tthis.isHovered = false;\n\t\tsetTimeout(() => {\n\t\t\t// If element is not being hovered and is not focused\n\t\t\tif (!this.isHovered && !this.isFocused) {\n\t\t\t\tthis.reposition(this.activeElement);\n\t\t\t}\n\t\t}, this.settings.delayOff);\n\t}\n\n\t/**\n\t * Event that gets triggered on focusIn when `enableFocus` or `deepFocus` option is true\n\t */\n\tfocusIn(e: FocusEvent) {\n\t\tthis.isFocused = true;\n\n\t\tlet lavalampItem: HTMLElement = e.target as HTMLElement;\n\n\t\t// If deep focus, get closest lavalamp item\n\t\tif (!lavalampItem.classList.contains(\"lavalamp__item\")) {\n\t\t\tlavalampItem = lavalampItem.closest(\".lavalamp__item\");\n\t\t}\n\n\t\tsetTimeout(() => {\n\t\t\tthis.reposition(lavalampItem);\n\t\t}, this.settings.delayOn);\n\t}\n\n\t/**\n\t * Event that gets triggered on focusOut when `enableFocus` or `deepFocus` option is true\n\t */\n\tfocusOut() {\n\t\tthis.isFocused = false;\n\t\tsetTimeout(() => {\n\t\t\tthis.reposition(this.activeElement);\n\t\t}, this.settings.delayOff);\n\t}\n\n\t/**\n\t * Main function that calculates width / height as well as the top / left position of current active element.\n\t * Also sets the lavalamp object to specified size and position.\n\t *\n\t * @param target HTML element that the lavalamp object should reposition to\n\t */\n\treposition(target: HTMLElement): void {\n\t\tconst style: CSSStyleDeclaration = window.getComputedStyle(target);\n\t\tconst marginTop: number = parseFloat(style.marginLeft) || 0;\n\t\tconst marginLeft: number = parseFloat(style.marginLeft) || 0;\n\t\tconst marginRight: number = parseFloat(style.marginRight) || 0;\n\t\tconst marginBottom: number = parseFloat(style.marginBottom) || 0;\n\n\t\tlet width: number = target.offsetWidth;\n\t\tlet height: number = target.offsetHeight;\n\t\tlet offsetTop: number = target.offsetTop;\n\t\tlet offsetLeft: number = target.offsetLeft;\n\n\t\t// Add margins to calculations\n\t\tif (this.settings.margins) {\n\t\t\toffsetLeft = offsetLeft - marginLeft;\n\t\t\toffsetTop = offsetTop - marginTop;\n\t\t\twidth = width + marginLeft + marginRight;\n\t\t\theight = height + marginTop + marginBottom;\n\t\t}\n\n\t\tthis.isAnimating = true;\n\t\tthis.lavalampObject.style.width = `${width}px`;\n\t\tthis.lavalampObject.style.height = `${height}px`;\n\t\tthis.lavalampObject.style.transform = `translate(${offsetLeft}px,${offsetTop}px)`;\n\n\t\tsetTimeout(() => {\n\t\t\tthis.isAnimating = false;\n\t\t}, this.settings.duration);\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tLavalamp: Lavalamp;\n\t}\n}\n\n// @ts-ignore\nwindow.Lavalamp = Lavalamp;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module\n// This entry module is referenced by other modules so it can't be inlined\n__webpack_require__(\"./src/lavalamp.class.ts\");\n"],"sourceRoot":""}