From b80414c2b11fb570648dc1be5ed57cbed647b22d Mon Sep 17 00:00:00 2001 From: Nathan Blair Date: Mon, 23 May 2022 08:03:37 -0500 Subject: [PATCH] build v4.1.3 --- dist/esm/constants.d.ts | 1 + dist/esm/pushInLayer.d.ts | 10 +++++++--- dist/esm/pushin.js | 34 ++++++++++++++++++++++++++++++++-- dist/esm/pushin.js.map | 2 +- dist/pushin.css | 5 +++++ dist/pushin.min.css | 2 +- dist/umd/pushin.js | 34 ++++++++++++++++++++++++++++++++-- dist/umd/pushin.js.map | 2 +- dist/umd/pushin.min.js | 2 +- 9 files changed, 81 insertions(+), 11 deletions(-) diff --git a/dist/esm/constants.d.ts b/dist/esm/constants.d.ts index 0b992ee..5532a18 100644 --- a/dist/esm/constants.d.ts +++ b/dist/esm/constants.d.ts @@ -4,3 +4,4 @@ export declare const PUSH_IN_SPEED_DATA_ATTRIBUTE = "pushinSpeed"; export declare const PUSH_IN_TO_DATA_ATTRIBUTE = "pushinTo"; export declare const PUSH_IN_FROM_DATA_ATTRIBUTE = "pushinFrom"; export declare const PUSH_IN_DEFAULT_BREAKPOINTS: number[]; +export declare const PUSH_IN_LAYER_INDEX_ATTRIBUTE = "data-pushin-layer-index"; diff --git a/dist/esm/pushInLayer.d.ts b/dist/esm/pushInLayer.d.ts index 1bc6104..641c08a 100644 --- a/dist/esm/pushInLayer.d.ts +++ b/dist/esm/pushInLayer.d.ts @@ -1,13 +1,13 @@ import { PushInScene } from './pushInScene'; -import { LayerOptions } from './types'; +import { LayerOptions, LayerParams } from './types'; export declare class PushInLayer { private element; private index; - private scene; + scene: PushInScene; private options; + params: LayerParams; private originalScale; private ref; - private params; constructor(element: HTMLElement, index: number, scene: PushInScene, options: LayerOptions | null); /** * Get all inpoints for the layer. @@ -65,4 +65,8 @@ export declare class PushInLayer { * as the user scrolls. */ setLayerStyle(): void; + /** + * Set a css class depending on current opacity. + */ + setLayerVisibility(): void; } diff --git a/dist/esm/pushin.js b/dist/esm/pushin.js index eccad5d..ddc0578 100644 --- a/dist/esm/pushin.js +++ b/dist/esm/pushin.js @@ -1,4 +1,4 @@ -/* Pushin.js - v4.1.2 +/* Pushin.js - v4.1.3 Author: Nathan Blair (https://natehub.net) License: MIT */ const DEFAULT_SPEED = 8; @@ -11,6 +11,7 @@ const PUSH_IN_SPEED_DATA_ATTRIBUTE = 'pushinSpeed'; const PUSH_IN_TO_DATA_ATTRIBUTE = 'pushinTo'; const PUSH_IN_FROM_DATA_ATTRIBUTE = 'pushinFrom'; const PUSH_IN_DEFAULT_BREAKPOINTS = [768, 1440, 1920]; +const PUSH_IN_LAYER_INDEX_ATTRIBUTE = 'data-pushin-layer-index'; class PushInLayer { constructor(element, index, scene, options) { @@ -23,6 +24,9 @@ class PushInLayer { const speed = this.getSpeed(this.element); this.originalScale = this.getElementScaleX(element); this.ref = { inpoints, outpoints, speed }; + this.element.setAttribute('data-pushin-layer-index', this.index.toString()); + // Set tabindex so we can sync scrolling with screenreaders + this.element.setAttribute('tabindex', '0'); this.params = { inpoint: this.getInpoint(inpoints), outpoint: this.getOutpoint(outpoints), @@ -198,6 +202,17 @@ class PushInLayer { } this.element.style.opacity = opacity.toString(); } + /** + * Set a css class depending on current opacity. + */ + setLayerVisibility() { + if (parseFloat(this.element.style.opacity) > 0.1) { + this.element.classList.add('pushin-layer--visible'); + } + else { + this.element.classList.remove('pushin-layer--visible'); + } + } } class PushInScene { @@ -374,6 +389,18 @@ class PushIn { }; window.addEventListener('resize', onResize); this.cleanupFns.push(() => window.removeEventListener('resize', onResize)); + const onFocus = (event) => { + const target = event.target; + if ('hasAttribute' in target && + target.hasAttribute(PUSH_IN_LAYER_INDEX_ATTRIBUTE)) { + const index = parseInt(target.getAttribute(PUSH_IN_LAYER_INDEX_ATTRIBUTE), 10); + const layer = this.scene.layers[index]; + if (layer) { + window.scrollTo(0, layer.params.inpoint + layer.scene.transitionLength); + } + } + }; + window.addEventListener('focus', onFocus, true); } /** * Animation effect, mimicking a camera dolly on the webpage. @@ -388,7 +415,10 @@ class PushIn { * Show or hide layers and set their scale, depending on if active. */ toggleLayers() { - this.scene.layers.forEach(layer => layer.setLayerStyle()); + this.scene.layers.forEach(layer => { + layer.setLayerStyle(); + layer.setLayerVisibility(); + }); } /** * Set the default container height based on a few factors: diff --git a/dist/esm/pushin.js.map b/dist/esm/pushin.js.map index 1a11619..dbf03fb 100644 --- a/dist/esm/pushin.js.map +++ b/dist/esm/pushin.js.map @@ -1 +1 @@ -{"version":3,"file":"pushin.js","sources":["../../src/constants.ts","../../src/pushInLayer.ts","../../src/pushInScene.ts","../../src/pushin.ts","../../src/helpers.ts"],"sourcesContent":[null,null,null,null,null],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B;AACA;AACO,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;AAEtE;AACA;AACO,MAAM,4BAA4B,GAAG,aAAa,CAAC;AAEnD,MAAM,yBAAyB,GAAG,UAAU,CAAC;AAC7C,MAAM,2BAA2B,GAAG,YAAY,CAAC;AAEjD,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;;MCH/C,WAAW,CAAA;AAKtB,IAAA,WAAA,CACU,OAAoB,EACpB,KAAa,EACb,KAAkB,EAClB,OAA4B,EAAA;QAH5B,IAAO,CAAA,OAAA,GAAP,OAAO,CAAa;QACpB,IAAK,CAAA,KAAA,GAAL,KAAK,CAAQ;QACb,IAAK,CAAA,KAAA,GAAL,KAAK,CAAa;QAClB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAqB;AAEpC,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5D,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/D,MAAM,KAAK,GAAG,IAAI,C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CAAC;AAEjE,QAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,QAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QAE9C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KAC7C;AACF;;AClLD;;;AAGG;AACH,MAAM,WAAW,GAAG,CAAC,OAAuB,KAAc;IACxD,MAAM,aAAa,GAAG,OAAO,KAAA,IAAA,IAAP,OAAO,KAAP,KAAA,CAAA,GAAA,OAAO,GAAI,EAAE,CAAC;IAEpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAc,SAAS,CAAC,CAAC;IACnE,MAAM,SAAS,GAAa,EAAE,CAAC;AAC/B,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACpD,QAAQ,CAAC,KAAK,EAAE,CAAC;AAEjB,QAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1B,KAAA;AAED,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,IAAA,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;AAClC;;;;"} \ No newline at end of file +{"version":3,"file":"pushin.js","sources":["../../src/constants.ts","../../src/pushInLayer.ts","../../src/pushInScene.ts","../../src/pushin.ts","../../src/helpers.ts"],"sourcesContent":[null,null,null,null,null],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B;AACA;AACO,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;AAEtE;AACA;AACO,MAAM,4BAA4B,GAAG,aAAa,CAAC;AAEnD,MAAM,yBAAyB,GAAG,UAAU,CAAC;AAC7C,MAAM,2BAA2B,GAAG,YAA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CAAC,CAAC;QACpD,QAAQ,CAAC,KAAK,EAAE,CAAC;AAEjB,QAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1B,KAAA;AAED,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,IAAA,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;AAClC;;;;"} \ No newline at end of file diff --git a/dist/pushin.css b/dist/pushin.css index 960c007..a964e5f 100644 --- a/dist/pushin.css +++ b/dist/pushin.css @@ -16,11 +16,16 @@ justify-content: center; left: 0; opacity: 0; + pointer-events: none; position: absolute; top: 0; width: 100%; } +.pushin-layer--visible * { + pointer-events: auto; +} + /* Debug */ .pushin-debug { background-color: white; diff --git a/dist/pushin.min.css b/dist/pushin.min.css index a68084f..0bd3af6 100644 --- a/dist/pushin.min.css +++ b/dist/pushin.min.css @@ -1 +1 @@ -.pushin{position:relative}.pushin-scene{height:100vh;left:0;position:fixed;width:100%;top:0}.pushin-layer{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;left:0;opacity:0;position:absolute;top:0;width:100%}.pushin-debug{background-color:#fff;border:0;border-bottom:1px;box-shadow:-2px 8px 19px 2px rgba(0,0,0,.26);padding:1em;position:fixed;top:0;width:100%;-webkit-box-shadow:-2px 8px 19px 2px rgba(0,0,0,.26)}@media (min-width:768px){.pushin-debug{border:1px solid #000;border-radius:15px 0 0 15px;border-right:0;right:0;top:50px;width:250px}}.pushin-debug__title{font-weight:700} \ No newline at end of file +.pushin{position:relative}.pushin-scene{height:100vh;left:0;position:fixed;width:100%;top:0}.pushin-layer{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%}.pushin-layer--visible *{pointer-events:auto}.pushin-debug{background-color:#fff;border:0;border-bottom:1px;box-shadow:-2px 8px 19px 2px rgba(0,0,0,.26);padding:1em;position:fixed;top:0;width:100%;-webkit-box-shadow:-2px 8px 19px 2px rgba(0,0,0,.26)}@media (min-width:768px){.pushin-debug{border:1px solid #000;border-radius:15px 0 0 15px;border-right:0;right:0;top:50px;width:250px}}.pushin-debug__title{font-weight:700} \ No newline at end of file diff --git a/dist/umd/pushin.js b/dist/umd/pushin.js index 5f2f17b..cf3d857 100644 --- a/dist/umd/pushin.js +++ b/dist/umd/pushin.js @@ -1,4 +1,4 @@ -/* Pushin.js - v4.1.2 +/* Pushin.js - v4.1.3 Author: Nathan Blair (https://natehub.net) License: MIT */ (function (global, factory) { @@ -17,6 +17,7 @@ License: MIT */ const PUSH_IN_TO_DATA_ATTRIBUTE = 'pushinTo'; const PUSH_IN_FROM_DATA_ATTRIBUTE = 'pushinFrom'; const PUSH_IN_DEFAULT_BREAKPOINTS = [768, 1440, 1920]; + const PUSH_IN_LAYER_INDEX_ATTRIBUTE = 'data-pushin-layer-index'; class PushInLayer { constructor(element, index, scene, options) { @@ -29,6 +30,9 @@ License: MIT */ const speed = this.getSpeed(this.element); this.originalScale = this.getElementScaleX(element); this.ref = { inpoints, outpoints, speed }; + this.element.setAttribute('data-pushin-layer-index', this.index.toString()); + // Set tabindex so we can sync scrolling with screenreaders + this.element.setAttribute('tabindex', '0'); this.params = { inpoint: this.getInpoint(inpoints), outpoint: this.getOutpoint(outpoints), @@ -204,6 +208,17 @@ License: MIT */ } this.element.style.opacity = opacity.toString(); } + /** + * Set a css class depending on current opacity. + */ + setLayerVisibility() { + if (parseFloat(this.element.style.opacity) > 0.1) { + this.element.classList.add('pushin-layer--visible'); + } + else { + this.element.classList.remove('pushin-layer--visible'); + } + } } class PushInScene { @@ -380,6 +395,18 @@ License: MIT */ }; window.addEventListener('resize', onResize); this.cleanupFns.push(() => window.removeEventListener('resize', onResize)); + const onFocus = (event) => { + const target = event.target; + if ('hasAttribute' in target && + target.hasAttribute(PUSH_IN_LAYER_INDEX_ATTRIBUTE)) { + const index = parseInt(target.getAttribute(PUSH_IN_LAYER_INDEX_ATTRIBUTE), 10); + const layer = this.scene.layers[index]; + if (layer) { + window.scrollTo(0, layer.params.inpoint + layer.scene.transitionLength); + } + } + }; + window.addEventListener('focus', onFocus, true); } /** * Animation effect, mimicking a camera dolly on the webpage. @@ -394,7 +421,10 @@ License: MIT */ * Show or hide layers and set their scale, depending on if active. */ toggleLayers() { - this.scene.layers.forEach(layer => layer.setLayerStyle()); + this.scene.layers.forEach(layer => { + layer.setLayerStyle(); + layer.setLayerVisibility(); + }); } /** * Set the default container height based on a few factors: diff --git a/dist/umd/pushin.js.map b/dist/umd/pushin.js.map index e7a4689..5e42318 100644 --- a/dist/umd/pushin.js.map +++ b/dist/umd/pushin.js.map @@ -1 +1 @@ -{"version":3,"file":"pushin.js","sources":["../../src/constants.ts","../../src/pushInLayer.ts","../../src/pushInScene.ts","../../src/pushin.ts","../../src/helpers.ts"],"sourcesContent":["export const DEFAULT_SPEED = 8;\n\n// The data attribute which may be defined on the elemenet in the following way:\n// `
`.\nexport const PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE = 'pushinBreakpoints';\n\n// The data attribute which may be defined on the elemenet in the following way:\n// `
`.\nexport const PUSH_IN_SPEED_DATA_ATTRIBUTE = 'pushinSpeed';\n\nexport const PUSH_IN_TO_DATA_ATTRIBUTE = 'pushinTo';\nexport const PUSH_IN_FROM_DATA_ATTRIBUTE = 'pushinFrom';\n\nexport const PUSH_IN_DEFAULT_BREAKPOINTS = [768, 1440, 1920];\n","import {\n DEFAULT_SPEED,\n PUSH_IN_TO_DATA_ATTRIBUTE,\n PUSH_IN_FROM_DATA_ATTRIBUTE,\n PUSH_IN_SPEED_DATA_ATTRIBUTE,\n} from './constants';\nimport { PushInScene } from './pushInScene';\n\nimport { LayerOptions, LayerRef, LayerParams } from './types';\n\nexport class PushInLayer {\n private originalScale: number;\n private ref: LayerRef;\n private params: LayerParams;\n\n constructor(\n private element: HTMLElement,\n private index: number,\n private scene: PushInScene,\n private options: LayerOptions | null\n ) {\n const inpoints = this.getInpoints(this.element, this.index);\n const outpoints = this.getOutpoints(this.element, inpoints[0]);\n const speed = this.getSpeed(this.element);\n\n this.originalScale = this.getElementScaleX(element);\n this.ref = { inpoints, outpoints, speed };\n\n this.params = {\n inpoint: this.getInpoint(inpoints),\n outpoint: this.getOutpoint(outpoints),\n speed,\n };\n }\n\n /**\n * Get all inpoints for the layer.\n */\n private getInpoints(element: HTMLElement, index: number): number[] {\n let inpoints = [this.scene.getTop()];\n if (element.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]) {\n inpoints = element.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]!.split(',').map(\n inpoint => parseInt(inpoint.trim(), 10)\n );\n } else if (this.options?.inpoints) {\n inpoints = this.options.inpoints;\n } else if (index === 0) {\n inpoints = this.scene.getInpoints();\n } else if (index > 0) {\n // Set default for middle layers if none provided\n const { outpoint } = this.scene.layers[index - 1].params;\n inpoints = [outpoint - this.scene.speedDelta];\n }\n\n return inpoints;\n }\n\n /**\n * Get all outpoints for the layer.\n */\n private getOutpoints(element: HTMLElement, inpoint: number): number[] {\n let outpoints = [inpoint + this.scene.layerDepth];\n\n if (element.dataset[PUSH_IN_TO_DATA_ATTRIBUTE]) {\n const values = element.dataset[PUSH_IN_TO_DATA_ATTRIBUTE]!.split(',');\n outpoints = values.map(value => parseInt(value.trim(), 10));\n } else if (this.options?.outpoints) {\n outpoints = this.options.outpoints;\n }\n\n return outpoints;\n }\n\n /**\n * Get the push-in speed for the layer.\n */\n private getSpeed(element: HTMLElement): number {\n let speed: number | null = null;\n\n if (element.dataset[PUSH_IN_SPEED_DATA_ATTRIBUTE]) {\n speed = parseInt(element.dataset[PUSH_IN_SPEED_DATA_ATTRIBUTE]!, 10);\n if (Number.isNaN(speed)) {\n speed = DEFAULT_SPEED;\n }\n } else if (this.options?.speed) {\n speed = this.options.speed;\n }\n\n return speed || DEFAULT_SPEED;\n }\n\n /**\n * Set the z-index of each layer so they overlap correctly.\n */\n setZIndex(total: number): void {\n this.element.style.zIndex = (total - this.index).toString();\n }\n\n /**\n * Reset all the layer parameters.\n *\n * This is used if the window is resized\n * and things need to be recalculated.\n */\n resetLayerParams(): void {\n this.params = {\n inpoint: this.getInpoint(this.ref.inpoints),\n outpoint: this.getOutpoint(this.ref.outpoints),\n speed: this.ref.speed,\n };\n }\n\n /**\n * Get the initial scale of the element at time of DOM load.\n */\n private getElementScaleX(element: HTMLElement): number {\n const transform = window\n .getComputedStyle(element)\n .getPropertyValue('transform');\n\n let scaleX = 1;\n if (transform && transform !== 'none') {\n const match = transform.match(/[matrix|scale]\\(([\\d,.\\s]+)/);\n if (match && match[1]) {\n const matrix = match[1].split(', ');\n scaleX = parseFloat(matrix[0]);\n }\n }\n\n return scaleX;\n }\n\n /**\n * Whether or not a layer should currently be zooming.\n */\n private isActive(): boolean {\n const { inpoint } = this.params;\n const { outpoint } = this.params;\n return (\n this.scene.pushin.scrollY >= inpoint &&\n this.scene.pushin.scrollY <= outpoint\n );\n }\n\n /**\n * Get the current inpoint for a layer,\n * depending on window breakpoint.\n */\n private getInpoint(inpoints: number[]): number {\n const { breakpoints } = this.scene.options;\n return inpoints[this.scene.getBreakpointIndex(breakpoints)] || inpoints[0];\n }\n\n /**\n * Get the current outpoint for a layer,\n * depending on window breakpoint.\n */\n private getOutpoint(outpoints: number[]): number {\n const { breakpoints } = this.scene.options;\n return (\n outpoints[this.scene.getBreakpointIndex(breakpoints)] || outpoints[0]\n );\n }\n\n /**\n * Get the scaleX value for the layer.\n */\n private getScaleValue(layer: PushInLayer): number {\n const distance = this.scene.pushin.scrollY - layer.params.inpoint;\n const speed = Math.min(layer.params.speed, 100) / 100;\n const delta = (distance * speed) / 100;\n\n return Math.max(layer.originalScale + delta, 0);\n }\n\n /**\n * Set element scale.\n */\n private setScale({ style }: HTMLElement, value: number): void {\n const scaleString = `scale(${value})`;\n style.webkitTransform = scaleString;\n (style as unknown as { mozTransform: string }).mozTransform = scaleString;\n (style as unknown as { msTransform: string }).msTransform = scaleString;\n (style as unknown as { oTransform: string }).oTransform = scaleString;\n style.transform = scaleString;\n }\n\n /**\n * Set CSS styles to control the effect on each layer.\n *\n * This will control the scale and opacity of the layer\n * as the user scrolls.\n */\n setLayerStyle(): void {\n let opacity = 0;\n const isFirst = this.index === 0;\n const isLast = this.index + 1 === this.scene.layers.length;\n const { inpoint } = this.params;\n const { outpoint } = this.params;\n\n if (isFirst && this.scene.pushin.scrollY < inpoint) {\n opacity = 1;\n } else if (isLast && this.scene.pushin.scrollY > outpoint) {\n opacity = 1;\n } else if (this.isActive()) {\n this.setScale(this.element, this.getScaleValue(this));\n\n let inpointDistance =\n Math.max(\n Math.min(\n this.scene.pushin.scrollY - inpoint,\n this.scene.transitionLength\n ),\n 0\n ) / this.scene.transitionLength;\n\n // Set opacity to 1 if its the first layer and it is active (no fading in here)\n if (isFirst) {\n inpointDistance = 1;\n }\n\n let outpointDistance =\n Math.max(\n Math.min(\n outpoint - this.scene.pushin.scrollY,\n this.scene.transitionLength\n ),\n 0\n ) / this.scene.transitionLength;\n\n // Set opacity to 1 if its the last layer and it is active (no fading out)\n if (isLast) {\n outpointDistance = 1;\n }\n\n opacity = Math.min(inpointDistance, outpointDistance);\n }\n\n this.element.style.opacity = opacity.toString();\n }\n}\n","import {\n PUSH_IN_FROM_DATA_ATTRIBUTE,\n PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE,\n PUSH_IN_DEFAULT_BREAKPOINTS,\n} from './constants';\nimport { PushInLayer } from './pushInLayer';\nimport { PushIn } from './pushin';\n\nimport { LayerOptions, SceneOptions } from './types';\n\nexport class PushInScene {\n private container: HTMLElement;\n public layers: PushInLayer[];\n public speedDelta: number;\n public transitionLength: number;\n public layerDepth: number;\n public options: SceneOptions;\n\n constructor(public pushin: PushIn) {\n const container =\n this.pushin.container.querySelector('.pushin-scene');\n\n if (container) {\n this.container = container;\n } else {\n this.container = document.createElement('div');\n this.container.classList.add('pushin-scene');\n\n this.container.innerHTML = this.pushin.container.innerHTML;\n this.pushin.container.innerHTML = '';\n this.pushin.container.appendChild(this.container);\n this.pushin.cleanupFns.push(() => {\n this.pushin.container.innerHTML = this.container.innerHTML;\n });\n }\n\n this.options = pushin.sceneOptions;\n\n this.speedDelta = this.options?.speedDelta || 100;\n this.layerDepth = this.options?.layerDepth || 1000;\n this.transitionLength = this.options?.transitionLength || 200;\n\n this.layers = [];\n\n this.setBreakpoints();\n this.getLayers();\n }\n\n /**\n * Set breakpoints for responsive design settings.\n */\n private setBreakpoints(): void {\n if (this.options?.breakpoints.length === 0) {\n this.options.breakpoints = [...PUSH_IN_DEFAULT_BREAKPOINTS];\n }\n\n if (this.container.dataset[PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE]) {\n this.options!.breakpoints = this.container.dataset[\n PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE\n ]!.split(',').map(breakpoint => parseInt(breakpoint.trim(), 10));\n }\n\n // Always include break point 0 for anything under first breakpoint\n this.options!.breakpoints.unshift(0);\n }\n\n /**\n * Find all layers on the page and store them with their parameters\n */\n private getLayers(): void {\n const layers = Array.from(\n this.container.getElementsByClassName('pushin-layer')\n );\n\n for (let index = 0; index < layers.length; index++) {\n const element = layers[index];\n let options = {};\n if (this.options?.layers && this.options.layers.length > index) {\n options = this!.options.layers[index];\n }\n\n const layer = new PushInLayer(element, index, this, options);\n this.layers.push(layer);\n\n layer.setZIndex(layers.length);\n }\n }\n\n /**\n * Get the array index of the current window breakpoint.\n */\n getBreakpointIndex(breakpoints: number[]): number {\n const searchIndex = breakpoints\n .reverse()\n .findIndex(bp => bp <= window.innerWidth);\n return searchIndex === -1 ? 0 : breakpoints.length - 1 - searchIndex;\n }\n\n getTop() {\n return this.container.getBoundingClientRect().top;\n }\n\n getInpoints(): number[] {\n let inpoints = [this.getTop()];\n\n if (this.container.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]) {\n const pushInFrom = (\n this.container.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]\n );\n inpoints.push(parseInt(pushInFrom, 10));\n } else if (this.options?.inpoints?.length > 0) {\n inpoints = this.options.inpoints;\n }\n\n return inpoints;\n }\n}\n","import { PushInScene } from './pushInScene';\nimport { PushInLayer } from './pushInLayer';\n\nimport { PushInOptions, SceneOptions } from './types';\n\n/**\n * PushIn object\n *\n * Once new object is created, it will initialize itself and\n * bind events to begin interacting with dom.\n */\nexport class PushIn {\n private scene!: PushInScene;\n private pushinDebug?: HTMLElement;\n public sceneOptions: SceneOptions;\n\n public scrollY = 0;\n\n private readonly layers: PushInLayer[] = [];\n private readonly debug: boolean;\n\n private lastAnimationFrameId = -1;\n public cleanupFns: VoidFunction[] = [];\n\n constructor(public container: HTMLElement, options?: PushInOptions) {\n this.debug = options?.debug ?? false;\n\n this.sceneOptions = { breakpoints: [], inpoints: [] };\n if (options?.scene) {\n Object.assign(this.sceneOptions, options.scene);\n }\n if (options?.layers) {\n Object.assign(this.sceneOptions, options.layers);\n }\n }\n\n /**\n * Initialize the object to start everything up.\n */\n start(): void {\n this.scrollY = this.getScrollY();\n\n if (this.debug) {\n this.showDebugger();\n }\n\n if (this.container) {\n this.scene = new PushInScene(this);\n\n this.setScrollLength();\n\n if (typeof window !== 'undefined') {\n this.bindEvents();\n }\n\n // Set layer initial state\n this.toggleLayers();\n } else {\n // eslint-disable-next-line no-console\n console.error(\n 'No container element provided to pushIn.js. Effect will not be applied.'\n );\n }\n }\n\n /**\n * Does all necessary cleanups by removing event listeners.\n */\n destroy(): void {\n cancelAnimationFrame(this.lastAnimationFrameId);\n\n while (this.cleanupFns.length) {\n this.cleanupFns.pop()!();\n }\n }\n\n /**\n * If there is a window object,\n * get the current scroll position.\n *\n * Otherwise default to 0.\n */\n private getScrollY(): number {\n return typeof window !== 'undefined' ? window.scrollY : 0;\n }\n\n /**\n * Bind event listeners to watch for page load and user interaction.\n */\n bindEvents(): void {\n const onScroll = () => {\n this.scrollY = this.getScrollY();\n this.dolly();\n\n if (this.pushinDebug) {\n const content = this.pushinDebug?.querySelector(\n '.pushin-debug__content'\n );\n if (content) {\n content!.textContent = `Scroll position: ${Math.round(\n this.scrollY\n )}px`;\n }\n }\n };\n window.addEventListener('scroll', onScroll);\n this.cleanupFns.push(() => window.removeEventListener('scroll', onScroll));\n\n let resizeTimeout: number;\n const onResize = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = window.setTimeout(() => {\n this.scene.layers.forEach(layer => layer.resetLayerParams());\n this.setScrollLength();\n this.toggleLayers();\n }, 300);\n };\n window.addEventListener('resize', onResize);\n this.cleanupFns.push(() => window.removeEventListener('resize', onResize));\n }\n\n /**\n * Animation effect, mimicking a camera dolly on the webpage.\n */\n private dolly(): void {\n cancelAnimationFrame(this.lastAnimationFrameId);\n\n this.lastAnimationFrameId = requestAnimationFrame(() => {\n this.toggleLayers();\n });\n }\n\n /**\n * Show or hide layers and set their scale, depending on if active.\n */\n private toggleLayers(): void {\n this.scene.layers.forEach(layer => layer.setLayerStyle());\n }\n\n /**\n * Set the default container height based on a few factors:\n * 1. Number of layers present\n * 2. The transition length between layers\n * 3. The length of scrolling time during each layer\n *\n * If this calculation is smaller than the container's current height,\n * the current height will be used instead.\n */\n private setScrollLength(): void {\n const containerHeight = getComputedStyle(this.container).height.replace(\n 'px',\n ''\n );\n\n const transitions = (this.scene.layers.length - 1) * this.scene.speedDelta;\n const scrollLength =\n this.scene.layers.length *\n (this.scene.layerDepth + this.scene.transitionLength);\n\n this.container.style.height = `${Math.max(\n parseFloat(containerHeight),\n scrollLength - transitions\n )}px`;\n }\n\n /**\n * Show a debugging tool appended to the frontend of the page.\n * Can be used to determine best \"pushin-from\" and \"pushin-to\" values.\n */\n private showDebugger(): void {\n this.pushinDebug = document.createElement('div');\n this.pushinDebug.classList.add('pushin-debug');\n\n const scrollTitle = document.createElement('p');\n scrollTitle.innerText = 'Pushin.js Debugger';\n scrollTitle.classList.add('pushin-debug__title');\n\n const debuggerContent = document.createElement('div');\n debuggerContent.classList.add('pushin-debug__content');\n debuggerContent.innerText = `Scroll position: ${this.scrollY}px`;\n\n this.pushinDebug.appendChild(scrollTitle);\n this.pushinDebug.appendChild(debuggerContent);\n\n document.body.appendChild(this.pushinDebug);\n }\n}\n","import { PushIn } from './pushin';\nimport { PushInOptions } from './types';\n\ndeclare global {\n interface Window {\n pushInStart(options?: PushInOptions | string): void;\n }\n}\n\n/**\n * Helper function: Set up and start push-in effect on all elements\n * matching the provided selector.\n */\nconst pushInStart = (options?: PushInOptions): PushIn[] => {\n const pushInOptions = options ?? {};\n\n const elements = document.querySelectorAll('.pushin');\n const instances: PushIn[] = [];\n for (const element of elements) {\n const instance = new PushIn(element, pushInOptions);\n instance.start();\n\n instances.push(instance);\n }\n\n return instances;\n};\n\nif (typeof window !== 'undefined') {\n window.pushInStart = pushInStart;\n}\n"],"names":[],"mappings":";;;;;;;;;IAAO,MAAM,aAAa,GAAG,CAAC,CAAC;IAE/B;IACA;IACO,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IAEtE;IACA;IACO,MAAM,4BAA4B,GAAG,aAAa,CAAC;IAEnD,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAC7C,MAAM,2BAA2B,GAAG,YAAY,CAAC;IAEjD,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;;UCH/C,WAAW,CAAA;IAKtB,IAAA,WAAA,CACU,OAAoB,EACpB,KAAa,EACb,KAAkB,EAClB,OAA4B,EAAA;YAH5B,IAAO,CAAA,OAAA,GAAP,OAAO,CAAa;YACpB,IAAK,CAAA,KAAA,GAAL,KAAK,CAAQ;YACb,IAAK,CAAA,KAAA,GAAL,KAAK,CAAa;YAClB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAqB;IAEpC,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO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AAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACvD,eAAe,CAAC,SAAS,GAAG,CAAA,iBAAA,EAAoB,IAAI,CAAC,OAAO,IAAI,CAAC;IAEjE,QAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC1C,QAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YAE9C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC7C;IACF;;IClLD;;;IAGG;IACH,MAAM,WAAW,GAAG,CAAC,OAAuB,KAAc;QACxD,MAAM,aAAa,GAAG,OAAO,KAAA,IAAA,IAAP,OAAO,KAAP,KAAA,CAAA,GAAA,OAAO,GAAI,EAAE,CAAC;QAEpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAc,SAAS,CAAC,CAAC;QACnE,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACpD,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEjB,QAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAA;IAED,IAAA,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,IAAA,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;IAClC;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"pushin.js","sources":["../../src/constants.ts","../../src/pushInLayer.ts","../../src/pushInScene.ts","../../src/pushin.ts","../../src/helpers.ts"],"sourcesContent":["export const DEFAULT_SPEED = 8;\n\n// The data attribute which may be defined on the elemenet in the following way:\n// `
`.\nexport const PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE = 'pushinBreakpoints';\n\n// The data attribute which may be defined on the elemenet in the following way:\n// `
`.\nexport const PUSH_IN_SPEED_DATA_ATTRIBUTE = 'pushinSpeed';\n\nexport const PUSH_IN_TO_DATA_ATTRIBUTE = 'pushinTo';\nexport const PUSH_IN_FROM_DATA_ATTRIBUTE = 'pushinFrom';\n\nexport const PUSH_IN_DEFAULT_BREAKPOINTS = [768, 1440, 1920];\n\nexport const PUSH_IN_LAYER_INDEX_ATTRIBUTE = 'data-pushin-layer-index';\n","import {\n DEFAULT_SPEED,\n PUSH_IN_TO_DATA_ATTRIBUTE,\n PUSH_IN_FROM_DATA_ATTRIBUTE,\n PUSH_IN_SPEED_DATA_ATTRIBUTE,\n} from './constants';\nimport { PushInScene } from './pushInScene';\n\nimport { LayerOptions, LayerRef, LayerParams } from './types';\n\nexport class PushInLayer {\n public params: LayerParams;\n private originalScale: number;\n private ref: LayerRef;\n\n constructor(\n private element: HTMLElement,\n private index: number,\n public scene: PushInScene,\n private options: LayerOptions | null\n ) {\n const inpoints = this.getInpoints(this.element, this.index);\n const outpoints = this.getOutpoints(this.element, inpoints[0]);\n const speed = this.getSpeed(this.element);\n\n this.originalScale = this.getElementScaleX(element);\n this.ref = { inpoints, outpoints, speed };\n\n this.element.setAttribute('data-pushin-layer-index', this.index.toString());\n\n // Set tabindex so we can sync scrolling with screenreaders\n this.element.setAttribute('tabindex', '0');\n\n this.params = {\n inpoint: this.getInpoint(inpoints),\n outpoint: this.getOutpoint(outpoints),\n speed,\n };\n }\n\n /**\n * Get all inpoints for the layer.\n */\n private getInpoints(element: HTMLElement, index: number): number[] {\n let inpoints = [this.scene.getTop()];\n if (element.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]) {\n inpoints = element.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]!.split(',').map(\n inpoint => parseInt(inpoint.trim(), 10)\n );\n } else if (this.options?.inpoints) {\n inpoints = this.options.inpoints;\n } else if (index === 0) {\n inpoints = this.scene.getInpoints();\n } else if (index > 0) {\n // Set default for middle layers if none provided\n const { outpoint } = this.scene.layers[index - 1].params;\n inpoints = [outpoint - this.scene.speedDelta];\n }\n\n return inpoints;\n }\n\n /**\n * Get all outpoints for the layer.\n */\n private getOutpoints(element: HTMLElement, inpoint: number): number[] {\n let outpoints = [inpoint + this.scene.layerDepth];\n\n if (element.dataset[PUSH_IN_TO_DATA_ATTRIBUTE]) {\n const values = element.dataset[PUSH_IN_TO_DATA_ATTRIBUTE]!.split(',');\n outpoints = values.map(value => parseInt(value.trim(), 10));\n } else if (this.options?.outpoints) {\n outpoints = this.options.outpoints;\n }\n\n return outpoints;\n }\n\n /**\n * Get the push-in speed for the layer.\n */\n private getSpeed(element: HTMLElement): number {\n let speed: number | null = null;\n\n if (element.dataset[PUSH_IN_SPEED_DATA_ATTRIBUTE]) {\n speed = parseInt(element.dataset[PUSH_IN_SPEED_DATA_ATTRIBUTE]!, 10);\n if (Number.isNaN(speed)) {\n speed = DEFAULT_SPEED;\n }\n } else if (this.options?.speed) {\n speed = this.options.speed;\n }\n\n return speed || DEFAULT_SPEED;\n }\n\n /**\n * Set the z-index of each layer so they overlap correctly.\n */\n setZIndex(total: number): void {\n this.element.style.zIndex = (total - this.index).toString();\n }\n\n /**\n * Reset all the layer parameters.\n *\n * This is used if the window is resized\n * and things need to be recalculated.\n */\n resetLayerParams(): void {\n this.params = {\n inpoint: this.getInpoint(this.ref.inpoints),\n outpoint: this.getOutpoint(this.ref.outpoints),\n speed: this.ref.speed,\n };\n }\n\n /**\n * Get the initial scale of the element at time of DOM load.\n */\n private getElementScaleX(element: HTMLElement): number {\n const transform = window\n .getComputedStyle(element)\n .getPropertyValue('transform');\n\n let scaleX = 1;\n if (transform && transform !== 'none') {\n const match = transform.match(/[matrix|scale]\\(([\\d,.\\s]+)/);\n if (match && match[1]) {\n const matrix = match[1].split(', ');\n scaleX = parseFloat(matrix[0]);\n }\n }\n\n return scaleX;\n }\n\n /**\n * Whether or not a layer should currently be zooming.\n */\n private isActive(): boolean {\n const { inpoint } = this.params;\n const { outpoint } = this.params;\n return (\n this.scene.pushin.scrollY >= inpoint &&\n this.scene.pushin.scrollY <= outpoint\n );\n }\n\n /**\n * Get the current inpoint for a layer,\n * depending on window breakpoint.\n */\n private getInpoint(inpoints: number[]): number {\n const { breakpoints } = this.scene.options;\n return inpoints[this.scene.getBreakpointIndex(breakpoints)] || inpoints[0];\n }\n\n /**\n * Get the current outpoint for a layer,\n * depending on window breakpoint.\n */\n private getOutpoint(outpoints: number[]): number {\n const { breakpoints } = this.scene.options;\n return (\n outpoints[this.scene.getBreakpointIndex(breakpoints)] || outpoints[0]\n );\n }\n\n /**\n * Get the scaleX value for the layer.\n */\n private getScaleValue(layer: PushInLayer): number {\n const distance = this.scene.pushin.scrollY - layer.params.inpoint;\n const speed = Math.min(layer.params.speed, 100) / 100;\n const delta = (distance * speed) / 100;\n\n return Math.max(layer.originalScale + delta, 0);\n }\n\n /**\n * Set element scale.\n */\n private setScale({ style }: HTMLElement, value: number): void {\n const scaleString = `scale(${value})`;\n style.webkitTransform = scaleString;\n (style as unknown as { mozTransform: string }).mozTransform = scaleString;\n (style as unknown as { msTransform: string }).msTransform = scaleString;\n (style as unknown as { oTransform: string }).oTransform = scaleString;\n style.transform = scaleString;\n }\n\n /**\n * Set CSS styles to control the effect on each layer.\n *\n * This will control the scale and opacity of the layer\n * as the user scrolls.\n */\n setLayerStyle(): void {\n let opacity = 0;\n const isFirst = this.index === 0;\n const isLast = this.index + 1 === this.scene.layers.length;\n const { inpoint } = this.params;\n const { outpoint } = this.params;\n\n if (isFirst && this.scene.pushin.scrollY < inpoint) {\n opacity = 1;\n } else if (isLast && this.scene.pushin.scrollY > outpoint) {\n opacity = 1;\n } else if (this.isActive()) {\n this.setScale(this.element, this.getScaleValue(this));\n\n let inpointDistance =\n Math.max(\n Math.min(\n this.scene.pushin.scrollY - inpoint,\n this.scene.transitionLength\n ),\n 0\n ) / this.scene.transitionLength;\n\n // Set opacity to 1 if its the first layer and it is active (no fading in here)\n if (isFirst) {\n inpointDistance = 1;\n }\n\n let outpointDistance =\n Math.max(\n Math.min(\n outpoint - this.scene.pushin.scrollY,\n this.scene.transitionLength\n ),\n 0\n ) / this.scene.transitionLength;\n\n // Set opacity to 1 if its the last layer and it is active (no fading out)\n if (isLast) {\n outpointDistance = 1;\n }\n\n opacity = Math.min(inpointDistance, outpointDistance);\n }\n\n this.element.style.opacity = opacity.toString();\n }\n\n /**\n * Set a css class depending on current opacity.\n */\n setLayerVisibility() {\n if (parseFloat(this.element.style.opacity) > 0.1) {\n this.element.classList.add('pushin-layer--visible');\n } else {\n this.element.classList.remove('pushin-layer--visible');\n }\n }\n}\n","import {\n PUSH_IN_FROM_DATA_ATTRIBUTE,\n PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE,\n PUSH_IN_DEFAULT_BREAKPOINTS,\n} from './constants';\nimport { PushInLayer } from './pushInLayer';\nimport { PushIn } from './pushin';\n\nimport { LayerOptions, SceneOptions } from './types';\n\nexport class PushInScene {\n private container: HTMLElement;\n public layers: PushInLayer[];\n public speedDelta: number;\n public transitionLength: number;\n public layerDepth: number;\n public options: SceneOptions;\n\n constructor(public pushin: PushIn) {\n const container =\n this.pushin.container.querySelector('.pushin-scene');\n\n if (container) {\n this.container = container;\n } else {\n this.container = document.createElement('div');\n this.container.classList.add('pushin-scene');\n\n this.container.innerHTML = this.pushin.container.innerHTML;\n this.pushin.container.innerHTML = '';\n this.pushin.container.appendChild(this.container);\n this.pushin.cleanupFns.push(() => {\n this.pushin.container.innerHTML = this.container.innerHTML;\n });\n }\n\n this.options = pushin.sceneOptions;\n\n this.speedDelta = this.options?.speedDelta || 100;\n this.layerDepth = this.options?.layerDepth || 1000;\n this.transitionLength = this.options?.transitionLength || 200;\n\n this.layers = [];\n\n this.setBreakpoints();\n this.getLayers();\n }\n\n /**\n * Set breakpoints for responsive design settings.\n */\n private setBreakpoints(): void {\n if (this.options?.breakpoints.length === 0) {\n this.options.breakpoints = [...PUSH_IN_DEFAULT_BREAKPOINTS];\n }\n\n if (this.container.dataset[PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE]) {\n this.options!.breakpoints = this.container.dataset[\n PUSH_IN_BREAKPOINTS_DATA_ATTRIBUTE\n ]!.split(',').map(breakpoint => parseInt(breakpoint.trim(), 10));\n }\n\n // Always include break point 0 for anything under first breakpoint\n this.options!.breakpoints.unshift(0);\n }\n\n /**\n * Find all layers on the page and store them with their parameters\n */\n private getLayers(): void {\n const layers = Array.from(\n this.container.getElementsByClassName('pushin-layer')\n );\n\n for (let index = 0; index < layers.length; index++) {\n const element = layers[index];\n let options = {};\n if (this.options?.layers && this.options.layers.length > index) {\n options = this!.options.layers[index];\n }\n\n const layer = new PushInLayer(element, index, this, options);\n this.layers.push(layer);\n\n layer.setZIndex(layers.length);\n }\n }\n\n /**\n * Get the array index of the current window breakpoint.\n */\n getBreakpointIndex(breakpoints: number[]): number {\n const searchIndex = breakpoints\n .reverse()\n .findIndex(bp => bp <= window.innerWidth);\n return searchIndex === -1 ? 0 : breakpoints.length - 1 - searchIndex;\n }\n\n getTop() {\n return this.container.getBoundingClientRect().top;\n }\n\n getInpoints(): number[] {\n let inpoints = [this.getTop()];\n\n if (this.container.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]) {\n const pushInFrom = (\n this.container.dataset[PUSH_IN_FROM_DATA_ATTRIBUTE]\n );\n inpoints.push(parseInt(pushInFrom, 10));\n } else if (this.options?.inpoints?.length > 0) {\n inpoints = this.options.inpoints;\n }\n\n return inpoints;\n }\n}\n","import { PushInScene } from './pushInScene';\nimport { PushInLayer } from './pushInLayer';\n\nimport { PushInOptions, SceneOptions } from './types';\n\nimport { PUSH_IN_LAYER_INDEX_ATTRIBUTE } from './constants';\n\n/**\n * PushIn object\n *\n * Once new object is created, it will initialize itself and\n * bind events to begin interacting with dom.\n */\nexport class PushIn {\n private scene!: PushInScene;\n private pushinDebug?: HTMLElement;\n public sceneOptions: SceneOptions;\n\n public scrollY = 0;\n\n private readonly layers: PushInLayer[] = [];\n private readonly debug: boolean;\n\n private lastAnimationFrameId = -1;\n public cleanupFns: VoidFunction[] = [];\n\n constructor(public container: HTMLElement, options?: PushInOptions) {\n this.debug = options?.debug ?? false;\n\n this.sceneOptions = { breakpoints: [], inpoints: [] };\n if (options?.scene) {\n Object.assign(this.sceneOptions, options.scene);\n }\n if (options?.layers) {\n Object.assign(this.sceneOptions, options.layers);\n }\n }\n\n /**\n * Initialize the object to start everything up.\n */\n start(): void {\n this.scrollY = this.getScrollY();\n\n if (this.debug) {\n this.showDebugger();\n }\n\n if (this.container) {\n this.scene = new PushInScene(this);\n\n this.setScrollLength();\n\n if (typeof window !== 'undefined') {\n this.bindEvents();\n }\n\n // Set layer initial state\n this.toggleLayers();\n } else {\n // eslint-disable-next-line no-console\n console.error(\n 'No container element provided to pushIn.js. Effect will not be applied.'\n );\n }\n }\n\n /**\n * Does all necessary cleanups by removing event listeners.\n */\n destroy(): void {\n cancelAnimationFrame(this.lastAnimationFrameId);\n\n while (this.cleanupFns.length) {\n this.cleanupFns.pop()!();\n }\n }\n\n /**\n * If there is a window object,\n * get the current scroll position.\n *\n * Otherwise default to 0.\n */\n private getScrollY(): number {\n return typeof window !== 'undefined' ? window.scrollY : 0;\n }\n\n /**\n * Bind event listeners to watch for page load and user interaction.\n */\n bindEvents(): void {\n const onScroll = () => {\n this.scrollY = this.getScrollY();\n this.dolly();\n\n if (this.pushinDebug) {\n const content = this.pushinDebug?.querySelector(\n '.pushin-debug__content'\n );\n if (content) {\n content!.textContent = `Scroll position: ${Math.round(\n this.scrollY\n )}px`;\n }\n }\n };\n window.addEventListener('scroll', onScroll);\n this.cleanupFns.push(() => window.removeEventListener('scroll', onScroll));\n\n let resizeTimeout: number;\n const onResize = () => {\n clearTimeout(resizeTimeout);\n\n resizeTimeout = window.setTimeout(() => {\n this.scene.layers.forEach(layer => layer.resetLayerParams());\n this.setScrollLength();\n this.toggleLayers();\n }, 300);\n };\n window.addEventListener('resize', onResize);\n this.cleanupFns.push(() => window.removeEventListener('resize', onResize));\n\n const onFocus = (event: FocusEvent) => {\n const target = event.target;\n if (\n 'hasAttribute' in target &&\n target.hasAttribute(PUSH_IN_LAYER_INDEX_ATTRIBUTE)\n ) {\n const index = parseInt(\n target!.getAttribute(PUSH_IN_LAYER_INDEX_ATTRIBUTE),\n 10\n );\n const layer = this.scene.layers[index];\n if (layer) {\n window.scrollTo(\n 0,\n layer.params.inpoint + layer!.scene!.transitionLength\n );\n }\n }\n };\n window.addEventListener('focus', onFocus, true);\n }\n\n /**\n * Animation effect, mimicking a camera dolly on the webpage.\n */\n private dolly(): void {\n cancelAnimationFrame(this.lastAnimationFrameId);\n\n this.lastAnimationFrameId = requestAnimationFrame(() => {\n this.toggleLayers();\n });\n }\n\n /**\n * Show or hide layers and set their scale, depending on if active.\n */\n private toggleLayers(): void {\n this.scene.layers.forEach(layer => {\n layer.setLayerStyle();\n layer.setLayerVisibility();\n });\n }\n\n /**\n * Set the default container height based on a few factors:\n * 1. Number of layers present\n * 2. The transition length between layers\n * 3. The length of scrolling time during each layer\n *\n * If this calculation is smaller than the container's current height,\n * the current height will be used instead.\n */\n private setScrollLength(): void {\n const containerHeight = getComputedStyle(this.container).height.replace(\n 'px',\n ''\n );\n\n const transitions = (this.scene.layers.length - 1) * this.scene.speedDelta;\n const scrollLength =\n this.scene.layers.length *\n (this.scene.layerDepth + this.scene.transitionLength);\n\n this.container.style.height = `${Math.max(\n parseFloat(containerHeight),\n scrollLength - transitions\n )}px`;\n }\n\n /**\n * Show a debugging tool appended to the frontend of the page.\n * Can be used to determine best \"pushin-from\" and \"pushin-to\" values.\n */\n private showDebugger(): void {\n this.pushinDebug = document.createElement('div');\n this.pushinDebug.classList.add('pushin-debug');\n\n const scrollTitle = document.createElement('p');\n scrollTitle.innerText = 'Pushin.js Debugger';\n scrollTitle.classList.add('pushin-debug__title');\n\n const debuggerContent = document.createElement('div');\n debuggerContent.classList.add('pushin-debug__content');\n debuggerContent.innerText = `Scroll position: ${this.scrollY}px`;\n\n this.pushinDebug.appendChild(scrollTitle);\n this.pushinDebug.appendChild(debuggerContent);\n\n document.body.appendChild(this.pushinDebug);\n }\n}\n","import { PushIn } from './pushin';\nimport { PushInOptions } from './types';\n\ndeclare global {\n interface Window {\n pushInStart(options?: PushInOptions | string): void;\n }\n}\n\n/**\n * Helper function: Set up and start push-in effect on all elements\n * matching the provided selector.\n */\nconst pushInStart = (options?: PushInOptions): PushIn[] => {\n const pushInOptions = options ?? {};\n\n const elements = document.querySelectorAll('.pushin');\n const instances: PushIn[] = [];\n for (const element of elements) {\n const instance = new PushIn(element, pushInOptions);\n instance.start();\n\n instances.push(instance);\n }\n\n return instances;\n};\n\nif (typeof window !== 'undefined') {\n window.pushInStart = pushInStart;\n}\n"],"names":[],"mappings":";;;;;;;;;IAAO,MAAM,aAAa,GAAG,CAAC,CAAC;IAE/B;IACA;IACO,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IAEtE;IACA;IACO,MAAM,4BAA4B,GAAG,aAAa,CAAC;IAEnD,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAC7C,MAAM,2BAA2B,GAAG,YAAY,CAAC;IAEjD,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAEtD,MAAM,6BAA6B,GAAG,yBAAyB;;UCLzD,WAAW,CAAA;IAKtB,IAAA,WAAA,CACU,OAAoB,EACpB,KAAa,EACd,KAAkB,EACjB,OAA4B,EAAA;YAH5B,IAAO,CAAA,OAAA,GAAP,OAAO,CAAa;YACpB,IAAK,CAAA,KAAA,GAAL,KAAK,CAAQ;YACd,IAAK,CAAA,KAAA,GAAL,KAAK,CAAa;YACjB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAqB;IAEpC,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,QAAA,MAAM,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AC,CAAC;IACtD,QAAA,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACvD,eAAe,CAAC,SAAS,GAAG,CAAA,iBAAA,EAAoB,IAAI,CAAC,OAAO,IAAI,CAAC;IAEjE,QAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC1C,QAAA,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YAE9C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC7C;IACF;;IC5MD;;;IAGG;IACH,MAAM,WAAW,GAAG,CAAC,OAAuB,KAAc;QACxD,MAAM,aAAa,GAAG,OAAO,KAAA,IAAA,IAAP,OAAO,KAAP,KAAA,CAAA,GAAA,OAAO,GAAI,EAAE,CAAC;QAEpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAc,SAAS,CAAC,CAAC;QACnE,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACpD,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEjB,QAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAA;IAED,IAAA,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,IAAA,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;IAClC;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/umd/pushin.min.js b/dist/umd/pushin.min.js index 3aea62c..bf59616 100644 --- a/dist/umd/pushin.min.js +++ b/dist/umd/pushin.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pushin={})}(this,(function(t){"use strict";const e=[768,1440,1920];class s{constructor(t,e,s,n){this.element=t,this.index=e,this.scene=s,this.options=n;const i=this.getInpoints(this.element,this.index),o=this.getOutpoints(this.element,i[0]),h=this.getSpeed(this.element);this.originalScale=this.getElementScaleX(t),this.ref={inpoints:i,outpoints:o,speed:h},this.params={inpoint:this.getInpoint(i),outpoint:this.getOutpoint(o),speed:h}}getInpoints(t,e){var s;let n=[this.scene.getTop()];if(t.dataset.pushinFrom)n=t.dataset.pushinFrom.split(",").map((t=>parseInt(t.trim(),10)));else if(null===(s=this.options)||void 0===s?void 0:s.inpoints)n=this.options.inpoints;else if(0===e)n=this.scene.getInpoints();else if(e>0){const{outpoint:t}=this.scene.layers[e-1].params;n=[t-this.scene.speedDelta]}return n}getOutpoints(t,e){var s;let n=[e+this.scene.layerDepth];if(t.dataset.pushinTo){n=t.dataset.pushinTo.split(",").map((t=>parseInt(t.trim(),10)))}else(null===(s=this.options)||void 0===s?void 0:s.outpoints)&&(n=this.options.outpoints);return n}getSpeed(t){var e;let s=null;return t.dataset.pushinSpeed?(s=parseInt(t.dataset.pushinSpeed,10),Number.isNaN(s)&&(s=8)):(null===(e=this.options)||void 0===e?void 0:e.speed)&&(s=this.options.speed),s||8}setZIndex(t){this.element.style.zIndex=(t-this.index).toString()}resetLayerParams(){this.params={inpoint:this.getInpoint(this.ref.inpoints),outpoint:this.getOutpoint(this.ref.outpoints),speed:this.ref.speed}}getElementScaleX(t){const e=window.getComputedStyle(t).getPropertyValue("transform");let s=1;if(e&&"none"!==e){const t=e.match(/[matrix|scale]\(([\d,.\s]+)/);if(t&&t[1]){const e=t[1].split(", ");s=parseFloat(e[0])}}return s}isActive(){const{inpoint:t}=this.params,{outpoint:e}=this.params;return this.scene.pushin.scrollY>=t&&this.scene.pushin.scrollY<=e}getInpoint(t){const{breakpoints:e}=this.scene.options;return t[this.scene.getBreakpointIndex(e)]||t[0]}getOutpoint(t){const{breakpoints:e}=this.scene.options;return t[this.scene.getBreakpointIndex(e)]||t[0]}getScaleValue(t){const e=(this.scene.pushin.scrollY-t.params.inpoint)*(Math.min(t.params.speed,100)/100)/100;return Math.max(t.originalScale+e,0)}setScale({style:t},e){const s=`scale(${e})`;t.webkitTransform=s,t.mozTransform=s,t.msTransform=s,t.oTransform=s,t.transform=s}setLayerStyle(){let t=0;const e=0===this.index,s=this.index+1===this.scene.layers.length,{inpoint:n}=this.params,{outpoint:i}=this.params;if(e&&this.scene.pushin.scrollYi)t=1;else if(this.isActive()){this.setScale(this.element,this.getScaleValue(this));let o=Math.max(Math.min(this.scene.pushin.scrollY-n,this.scene.transitionLength),0)/this.scene.transitionLength;e&&(o=1);let h=Math.max(Math.min(i-this.scene.pushin.scrollY,this.scene.transitionLength),0)/this.scene.transitionLength;s&&(h=1),t=Math.min(o,h)}this.element.style.opacity=t.toString()}}class n{constructor(t){var e,s,n;this.pushin=t;const i=this.pushin.container.querySelector(".pushin-scene");i?this.container=i:(this.container=document.createElement("div"),this.container.classList.add("pushin-scene"),this.container.innerHTML=this.pushin.container.innerHTML,this.pushin.container.innerHTML="",this.pushin.container.appendChild(this.container),this.pushin.cleanupFns.push((()=>{this.pushin.container.innerHTML=this.container.innerHTML}))),this.options=t.sceneOptions,this.speedDelta=(null===(e=this.options)||void 0===e?void 0:e.speedDelta)||100,this.layerDepth=(null===(s=this.options)||void 0===s?void 0:s.layerDepth)||1e3,this.transitionLength=(null===(n=this.options)||void 0===n?void 0:n.transitionLength)||200,this.layers=[],this.setBreakpoints(),this.getLayers()}setBreakpoints(){var t;0===(null===(t=this.options)||void 0===t?void 0:t.breakpoints.length)&&(this.options.breakpoints=[...e]),this.container.dataset.pushinBreakpoints&&(this.options.breakpoints=this.container.dataset.pushinBreakpoints.split(",").map((t=>parseInt(t.trim(),10)))),this.options.breakpoints.unshift(0)}getLayers(){var t;const e=Array.from(this.container.getElementsByClassName("pushin-layer"));for(let n=0;nn&&(o=this.options.layers[n]);const h=new s(i,n,this,o);this.layers.push(h),h.setZIndex(e.length)}}getBreakpointIndex(t){const e=t.reverse().findIndex((t=>t<=window.innerWidth));return-1===e?0:t.length-1-e}getTop(){return this.container.getBoundingClientRect().top}getInpoints(){var t,e;let s=[this.getTop()];if(this.container.dataset.pushinFrom){const t=this.container.dataset.pushinFrom;s.push(parseInt(t,10))}else(null===(e=null===(t=this.options)||void 0===t?void 0:t.inpoints)||void 0===e?void 0:e.length)>0&&(s=this.options.inpoints);return s}}class i{constructor(t,e){var s;this.container=t,this.scrollY=0,this.layers=[],this.lastAnimationFrameId=-1,this.cleanupFns=[],this.debug=null!==(s=null==e?void 0:e.debug)&&void 0!==s&&s,this.sceneOptions={breakpoints:[],inpoints:[]},(null==e?void 0:e.scene)&&Object.assign(this.sceneOptions,e.scene),(null==e?void 0:e.layers)&&Object.assign(this.sceneOptions,e.layers)}start(){this.scrollY=this.getScrollY(),this.debug&&this.showDebugger(),this.container?(this.scene=new n(this),this.setScrollLength(),"undefined"!=typeof window&&this.bindEvents(),this.toggleLayers()):console.error("No container element provided to pushIn.js. Effect will not be applied.")}destroy(){for(cancelAnimationFrame(this.lastAnimationFrameId);this.cleanupFns.length;)this.cleanupFns.pop()()}getScrollY(){return"undefined"!=typeof window?window.scrollY:0}bindEvents(){const t=()=>{var t;if(this.scrollY=this.getScrollY(),this.dolly(),this.pushinDebug){const e=null===(t=this.pushinDebug)||void 0===t?void 0:t.querySelector(".pushin-debug__content");e&&(e.textContent=`Scroll position: ${Math.round(this.scrollY)}px`)}};let e;window.addEventListener("scroll",t),this.cleanupFns.push((()=>window.removeEventListener("scroll",t)));const s=()=>{clearTimeout(e),e=window.setTimeout((()=>{this.scene.layers.forEach((t=>t.resetLayerParams())),this.setScrollLength(),this.toggleLayers()}),300)};window.addEventListener("resize",s),this.cleanupFns.push((()=>window.removeEventListener("resize",s)))}dolly(){cancelAnimationFrame(this.lastAnimationFrameId),this.lastAnimationFrameId=requestAnimationFrame((()=>{this.toggleLayers()}))}toggleLayers(){this.scene.layers.forEach((t=>t.setLayerStyle()))}setScrollLength(){const t=getComputedStyle(this.container).height.replace("px",""),e=(this.scene.layers.length-1)*this.scene.speedDelta,s=this.scene.layers.length*(this.scene.layerDepth+this.scene.transitionLength);this.container.style.height=`${Math.max(parseFloat(t),s-e)}px`}showDebugger(){this.pushinDebug=document.createElement("div"),this.pushinDebug.classList.add("pushin-debug");const t=document.createElement("p");t.innerText="Pushin.js Debugger",t.classList.add("pushin-debug__title");const e=document.createElement("div");e.classList.add("pushin-debug__content"),e.innerText=`Scroll position: ${this.scrollY}px`,this.pushinDebug.appendChild(t),this.pushinDebug.appendChild(e),document.body.appendChild(this.pushinDebug)}}const o=t=>{const e=null!=t?t:{},s=document.querySelectorAll(".pushin"),n=[];for(const t of s){const s=new i(t,e);s.start(),n.push(s)}return n};"undefined"!=typeof window&&(window.pushInStart=o),t.PushIn=i,Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pushin={})}(this,(function(t){"use strict";const e=[768,1440,1920],s="data-pushin-layer-index";class i{constructor(t,e,s,i){this.element=t,this.index=e,this.scene=s,this.options=i;const n=this.getInpoints(this.element,this.index),o=this.getOutpoints(this.element,n[0]),r=this.getSpeed(this.element);this.originalScale=this.getElementScaleX(t),this.ref={inpoints:n,outpoints:o,speed:r},this.element.setAttribute("data-pushin-layer-index",this.index.toString()),this.element.setAttribute("tabindex","0"),this.params={inpoint:this.getInpoint(n),outpoint:this.getOutpoint(o),speed:r}}getInpoints(t,e){var s;let i=[this.scene.getTop()];if(t.dataset.pushinFrom)i=t.dataset.pushinFrom.split(",").map((t=>parseInt(t.trim(),10)));else if(null===(s=this.options)||void 0===s?void 0:s.inpoints)i=this.options.inpoints;else if(0===e)i=this.scene.getInpoints();else if(e>0){const{outpoint:t}=this.scene.layers[e-1].params;i=[t-this.scene.speedDelta]}return i}getOutpoints(t,e){var s;let i=[e+this.scene.layerDepth];if(t.dataset.pushinTo){i=t.dataset.pushinTo.split(",").map((t=>parseInt(t.trim(),10)))}else(null===(s=this.options)||void 0===s?void 0:s.outpoints)&&(i=this.options.outpoints);return i}getSpeed(t){var e;let s=null;return t.dataset.pushinSpeed?(s=parseInt(t.dataset.pushinSpeed,10),Number.isNaN(s)&&(s=8)):(null===(e=this.options)||void 0===e?void 0:e.speed)&&(s=this.options.speed),s||8}setZIndex(t){this.element.style.zIndex=(t-this.index).toString()}resetLayerParams(){this.params={inpoint:this.getInpoint(this.ref.inpoints),outpoint:this.getOutpoint(this.ref.outpoints),speed:this.ref.speed}}getElementScaleX(t){const e=window.getComputedStyle(t).getPropertyValue("transform");let s=1;if(e&&"none"!==e){const t=e.match(/[matrix|scale]\(([\d,.\s]+)/);if(t&&t[1]){const e=t[1].split(", ");s=parseFloat(e[0])}}return s}isActive(){const{inpoint:t}=this.params,{outpoint:e}=this.params;return this.scene.pushin.scrollY>=t&&this.scene.pushin.scrollY<=e}getInpoint(t){const{breakpoints:e}=this.scene.options;return t[this.scene.getBreakpointIndex(e)]||t[0]}getOutpoint(t){const{breakpoints:e}=this.scene.options;return t[this.scene.getBreakpointIndex(e)]||t[0]}getScaleValue(t){const e=(this.scene.pushin.scrollY-t.params.inpoint)*(Math.min(t.params.speed,100)/100)/100;return Math.max(t.originalScale+e,0)}setScale({style:t},e){const s=`scale(${e})`;t.webkitTransform=s,t.mozTransform=s,t.msTransform=s,t.oTransform=s,t.transform=s}setLayerStyle(){let t=0;const e=0===this.index,s=this.index+1===this.scene.layers.length,{inpoint:i}=this.params,{outpoint:n}=this.params;if(e&&this.scene.pushin.scrollYn)t=1;else if(this.isActive()){this.setScale(this.element,this.getScaleValue(this));let o=Math.max(Math.min(this.scene.pushin.scrollY-i,this.scene.transitionLength),0)/this.scene.transitionLength;e&&(o=1);let r=Math.max(Math.min(n-this.scene.pushin.scrollY,this.scene.transitionLength),0)/this.scene.transitionLength;s&&(r=1),t=Math.min(o,r)}this.element.style.opacity=t.toString()}setLayerVisibility(){parseFloat(this.element.style.opacity)>.1?this.element.classList.add("pushin-layer--visible"):this.element.classList.remove("pushin-layer--visible")}}class n{constructor(t){var e,s,i;this.pushin=t;const n=this.pushin.container.querySelector(".pushin-scene");n?this.container=n:(this.container=document.createElement("div"),this.container.classList.add("pushin-scene"),this.container.innerHTML=this.pushin.container.innerHTML,this.pushin.container.innerHTML="",this.pushin.container.appendChild(this.container),this.pushin.cleanupFns.push((()=>{this.pushin.container.innerHTML=this.container.innerHTML}))),this.options=t.sceneOptions,this.speedDelta=(null===(e=this.options)||void 0===e?void 0:e.speedDelta)||100,this.layerDepth=(null===(s=this.options)||void 0===s?void 0:s.layerDepth)||1e3,this.transitionLength=(null===(i=this.options)||void 0===i?void 0:i.transitionLength)||200,this.layers=[],this.setBreakpoints(),this.getLayers()}setBreakpoints(){var t;0===(null===(t=this.options)||void 0===t?void 0:t.breakpoints.length)&&(this.options.breakpoints=[...e]),this.container.dataset.pushinBreakpoints&&(this.options.breakpoints=this.container.dataset.pushinBreakpoints.split(",").map((t=>parseInt(t.trim(),10)))),this.options.breakpoints.unshift(0)}getLayers(){var t;const e=Array.from(this.container.getElementsByClassName("pushin-layer"));for(let s=0;ss&&(o=this.options.layers[s]);const r=new i(n,s,this,o);this.layers.push(r),r.setZIndex(e.length)}}getBreakpointIndex(t){const e=t.reverse().findIndex((t=>t<=window.innerWidth));return-1===e?0:t.length-1-e}getTop(){return this.container.getBoundingClientRect().top}getInpoints(){var t,e;let s=[this.getTop()];if(this.container.dataset.pushinFrom){const t=this.container.dataset.pushinFrom;s.push(parseInt(t,10))}else(null===(e=null===(t=this.options)||void 0===t?void 0:t.inpoints)||void 0===e?void 0:e.length)>0&&(s=this.options.inpoints);return s}}class o{constructor(t,e){var s;this.container=t,this.scrollY=0,this.layers=[],this.lastAnimationFrameId=-1,this.cleanupFns=[],this.debug=null!==(s=null==e?void 0:e.debug)&&void 0!==s&&s,this.sceneOptions={breakpoints:[],inpoints:[]},(null==e?void 0:e.scene)&&Object.assign(this.sceneOptions,e.scene),(null==e?void 0:e.layers)&&Object.assign(this.sceneOptions,e.layers)}start(){this.scrollY=this.getScrollY(),this.debug&&this.showDebugger(),this.container?(this.scene=new n(this),this.setScrollLength(),"undefined"!=typeof window&&this.bindEvents(),this.toggleLayers()):console.error("No container element provided to pushIn.js. Effect will not be applied.")}destroy(){for(cancelAnimationFrame(this.lastAnimationFrameId);this.cleanupFns.length;)this.cleanupFns.pop()()}getScrollY(){return"undefined"!=typeof window?window.scrollY:0}bindEvents(){const t=()=>{var t;if(this.scrollY=this.getScrollY(),this.dolly(),this.pushinDebug){const e=null===(t=this.pushinDebug)||void 0===t?void 0:t.querySelector(".pushin-debug__content");e&&(e.textContent=`Scroll position: ${Math.round(this.scrollY)}px`)}};let e;window.addEventListener("scroll",t),this.cleanupFns.push((()=>window.removeEventListener("scroll",t)));const i=()=>{clearTimeout(e),e=window.setTimeout((()=>{this.scene.layers.forEach((t=>t.resetLayerParams())),this.setScrollLength(),this.toggleLayers()}),300)};window.addEventListener("resize",i),this.cleanupFns.push((()=>window.removeEventListener("resize",i)));window.addEventListener("focus",(t=>{const e=t.target;if("hasAttribute"in e&&e.hasAttribute(s)){const t=parseInt(e.getAttribute(s),10),i=this.scene.layers[t];i&&window.scrollTo(0,i.params.inpoint+i.scene.transitionLength)}}),!0)}dolly(){cancelAnimationFrame(this.lastAnimationFrameId),this.lastAnimationFrameId=requestAnimationFrame((()=>{this.toggleLayers()}))}toggleLayers(){this.scene.layers.forEach((t=>{t.setLayerStyle(),t.setLayerVisibility()}))}setScrollLength(){const t=getComputedStyle(this.container).height.replace("px",""),e=(this.scene.layers.length-1)*this.scene.speedDelta,s=this.scene.layers.length*(this.scene.layerDepth+this.scene.transitionLength);this.container.style.height=`${Math.max(parseFloat(t),s-e)}px`}showDebugger(){this.pushinDebug=document.createElement("div"),this.pushinDebug.classList.add("pushin-debug");const t=document.createElement("p");t.innerText="Pushin.js Debugger",t.classList.add("pushin-debug__title");const e=document.createElement("div");e.classList.add("pushin-debug__content"),e.innerText=`Scroll position: ${this.scrollY}px`,this.pushinDebug.appendChild(t),this.pushinDebug.appendChild(e),document.body.appendChild(this.pushinDebug)}}const r=t=>{const e=null!=t?t:{},s=document.querySelectorAll(".pushin"),i=[];for(const t of s){const s=new o(t,e);s.start(),i.push(s)}return i};"undefined"!=typeof window&&(window.pushInStart=r),t.PushIn=o,Object.defineProperty(t,"__esModule",{value:!0})}));