@croxton/buttery 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buttery.js","names":[],"sources":["../lib/buttery.js"],"sourcesContent":["/**\n * Buttery - scroll animation library\n * Performance focused, lightweight scroll animation library\n *\n * A fork of basicScroll.js by Tobias Reich (@electerious)\n * Created and maintained by Mark Croxton (@croxton)\n *\n * - Uses native scroll-driven animations (ScrollTimeline + Web Animations) when supported,\n * so values update in sync with scrolling without per-frame JavaScript.\n * - Falls back to an event-driven requestAnimationFrame loop otherwise.\n * - Instances with `inside`/`outside` callbacks use the fallback by default (callbacks need JS per frame).\n * - Clamps scrollTop to avoid rubber-band (overscroll) bounce affecting animations\n * - Uses a stable viewport height that doesn't change when the iOS toolbar collapses/expands\n * - Ignores height-only resize events (iOS address bar show/hide) for recalculation\n * - Skips redundant style writes\n */\n\nimport parseUnit from 'parse-unit'\nimport eases from 'eases'\n\nlet instances = []\nlet frameId = null\nlet pendingForce = false\nlet init = false\nlet previousScrollTop = null\nlet maxScrollTop = null\nlet viewportHeight = null\nlet viewportWidth = null\nlet listeners = null\nlet resizeObserver = null\nlet timelineFrameId = null\nlet lastTimelineMax = null\nlet scrollTimeline = null\nlet timelineSupport = null\nlet settings = {\n recalculateOnResize: false,\n timeline: true\n}\n\n// Number of samples used to approximate non-linear easing in timeline keyframes\nconst TIMELINE_SAMPLES = 30\n\n// Last applied style values per instance, used to avoid redundant writes\nconst styleCache = new WeakMap()\n\n// Custom properties registered by this library: name => syntax (null = registered elsewhere)\nconst registeredProperties = new Map()\n\n/**\n * Debounces a function that will be triggered many times.\n * @param {Function} fn\n * @param {Number} duration\n * @returns {Function}\n */\nconst debounce = function(fn, duration) {\n\n let timeout = null\n\n const debounced = (...args) => {\n clearTimeout(timeout)\n timeout = setTimeout(() => fn(...args), duration)\n }\n\n debounced.cancel = () => clearTimeout(timeout)\n\n return debounced\n\n}\n\n/**\n * Returns all active instances that are driven by the JS loop.\n * @param {Array} instances\n * @returns {Array} instances\n */\nconst getLoopInstances = function(instances) {\n\n return instances.filter((instance) => instance != null && instance.isActive() && instance.usesTimeline() === false)\n\n}\n\n/**\n * Returns all tracked instances from an array.\n * @param {Array} instances\n * @returns {Array} instances - Tracked instances.\n */\nconst getTrackedInstances = function(instances) {\n\n return instances.filter((instance) => instance != null && instance.getData().track)\n\n}\n\n/**\n * Checks if native scroll-driven animations can be used.\n * @returns {Boolean}\n */\nexport const supportsTimeline = function() {\n\n if (timelineSupport == null) {\n timelineSupport = typeof window !== 'undefined'\n && typeof window.ScrollTimeline === 'function'\n && typeof window.Animation === 'function'\n && typeof window.KeyframeEffect === 'function'\n && window.CSS != null\n && typeof window.CSS.registerProperty === 'function'\n }\n\n return timelineSupport\n\n}\n\n/**\n * Returns the scrolling element.\n * @returns {Element}\n */\nconst getScrollingElement = function() {\n\n return document.scrollingElement || document.documentElement\n\n}\n\n/**\n * Returns the shared document scroll timeline.\n * @returns {ScrollTimeline}\n */\nconst getScrollTimeline = function() {\n\n if (scrollTimeline == null) {\n scrollTimeline = new ScrollTimeline({\n source: getScrollingElement(),\n axis: 'block'\n })\n }\n\n return scrollTimeline\n\n}\n\n/**\n * Returns the raw number of scrolled pixels.\n * Can be negative or exceed the max scroll position during iOS rubber-band overscroll.\n * Use this for measuring element positions (it stays consistent with getBoundingClientRect).\n * @returns {Number} scrollTop\n */\nconst getRawScrollTop = function() {\n\n return getScrollingElement().scrollTop\n\n}\n\n/**\n * Returns the maximum scrollable distance.\n * @returns {Number}\n */\nconst getMaxScrollTop = function() {\n\n const elem = getScrollingElement()\n\n return Math.max(0, elem.scrollHeight - elem.clientHeight)\n\n}\n\n/**\n * Returns the number of scrolled pixels, clamped to the scrollable range.\n * This prevents iOS rubber-band overscroll from making animations bounce.\n * @returns {Number} scrollTop\n */\nconst getScrollTop = function() {\n\n const scrollTop = getRawScrollTop()\n\n if (scrollTop <= 0) return 0\n\n // Only re-read the (layout dependent) max when it might be stale\n if (maxScrollTop == null || scrollTop > maxScrollTop) maxScrollTop = getMaxScrollTop()\n\n return Math.min(scrollTop, maxScrollTop)\n\n}\n\n/**\n * Returns a stable height of the viewport.\n * documentElement.clientHeight doesn't change when the iOS Safari toolbar\n * collapses/expands, unlike window.innerHeight, so calculated positions stay put.\n * @returns {Number} viewportHeight\n */\nconst getViewportHeight = function() {\n\n if (viewportHeight == null) {\n viewportHeight = document.documentElement.clientHeight || window.innerHeight || window.outerHeight\n }\n\n return viewportHeight\n\n}\n\n/**\n * Returns the width of the viewport.\n * @returns {Number} viewportWidth\n */\nconst getViewportWidth = function() {\n\n return document.documentElement.clientWidth || window.innerWidth\n\n}\n\n/**\n * Checks if a value is absolute.\n * An absolute value must have a value that's not NaN.\n * @param {String|Integer} value\n * @returns {Boolean} isAbsolute\n */\nconst isAbsoluteValue = function(value) {\n\n return isNaN(parseUnit(value)[0]) === false\n\n}\n\n/**\n * Parses an absolute value.\n * @param {String|Integer} value\n * @returns {Object} value - Parsed value.\n */\nconst parseAbsoluteValue = function(value) {\n\n const parsedValue = parseUnit(value)\n\n return {\n value: parsedValue[0],\n unit: parsedValue[1]\n }\n\n}\n\n/**\n * Checks if a value is relative.\n * A relative value must start and end with [a-z] and needs a '-' in the middle.\n * @param {String|Integer} value\n * @returns {Boolean} isRelative\n */\nconst isRelativeValue = function(value) {\n\n return String(value).match(/^[a-z0-9%]+-[a-z0-9%]+$/) !== null\n\n}\n\n/**\n * Returns the property that should be used according to direct.\n * @param {Boolean|Node} direct\n * @param {Object} properties\n * @returns {*}\n */\nconst mapDirectToProperty = function(direct, properties) {\n\n if (direct === true) return properties.elem\n if (direct instanceof HTMLElement) return properties.direct\n\n return properties.global\n\n}\n\n/**\n * Returns the element styles should be applied to.\n * @param {Object} data\n * @returns {?Element}\n */\nconst getElem = function(data) {\n\n return mapDirectToProperty(data.direct, {\n global: document.documentElement,\n elem: data.elem,\n direct: data.direct\n })\n\n}\n\n/**\n * Converts a relative value to an absolute value.\n * @param {String} value\n * @param {Node} elem - Anchor of the relative value.\n * @param {?Integer} scrollTop - Pixels scrolled in document (raw, unclamped).\n * @param {?Integer} vh - Height of the viewport.\n * @returns {String} value - Absolute value.\n */\nconst relativeToAbsoluteValue = function(value, elem, scrollTop = getRawScrollTop(), vh = getViewportHeight()) {\n\n const elemSize = elem.getBoundingClientRect()\n\n const elemAnchor = value.match(/^[a-z0-9%]+/)[0]\n const viewportAnchor = value.match(/[a-z0-9%]+$/)[0]\n\n // Absolute document position of the element\n const elemTop = elemSize.top + scrollTop\n\n let y = 0\n\n if (viewportAnchor.match(/%$/) !== null) {\n const percent = parseFloat(viewportAnchor.replace('%', '')) / 100\n y -= vh * percent\n } else {\n if (viewportAnchor === 'top') y -= 0\n if (viewportAnchor === 'middle') y -= vh / 2\n if (viewportAnchor === 'bottom') y -= vh\n }\n\n if (elemAnchor.match(/%$/) !== null) {\n const percent = parseFloat(elemAnchor.replace('%', '')) / 100\n y += elemTop + elemSize.height * percent\n } else {\n if (elemAnchor === 'top') y += elemTop\n if (elemAnchor === 'middle') y += elemTop + elemSize.height / 2\n if (elemAnchor === 'bottom') y += elemTop + elemSize.height\n }\n\n return `${ y }px`\n\n}\n\n/**\n * Validates data and sets defaults for undefined properties.\n * @param {?Object} data\n * @returns {Object} data - Validated data.\n */\nconst validate = function(data = {}) {\n\n // Copy root object to avoid changes by reference\n data = Object.assign({}, data)\n\n // Remember if callbacks were provided, before defaults are applied\n data.hasCallbacks = data.inside != null || data.outside != null\n\n if (data.inside == null) data.inside = () => {}\n if (data.outside == null) data.outside = () => {}\n if (data.direct == null) data.direct = false\n if (data.track == null) data.track = true\n if (data.props == null) data.props = {}\n if (data.timeline == null) data.timeline = 'auto'\n\n if (data.from == null) throw new Error('Missing property `from`')\n if (data.to == null) throw new Error('Missing property `to`')\n if (typeof data.inside !== 'function') throw new Error('Property `inside` must be undefined or a function')\n if (typeof data.outside !== 'function') throw new Error('Property `outside` must be undefined or a function')\n if (typeof data.direct !== 'boolean' && !(data.direct instanceof HTMLElement)) throw new Error('Property `direct` must be undefined, a boolean or a DOM element/node')\n if (data.direct === true && data.elem == null) throw new Error('Property `elem` is required when `direct` is true')\n if (typeof data.track !== 'boolean') throw new Error('Property `track` must be undefined or a boolean')\n if (typeof data.props !== 'object') throw new Error('Property `props` must be undefined or an object')\n if (data.timeline !== 'auto' && typeof data.timeline !== 'boolean') throw new Error('Property `timeline` must be undefined, a boolean or \\'auto\\'')\n\n if (data.elem == null) {\n\n if (isAbsoluteValue(data.from) === false) throw new Error('Property `from` must be a absolute value when no `elem` has been provided')\n if (isAbsoluteValue(data.to) === false) throw new Error('Property `to` must be a absolute value when no `elem` has been provided')\n\n } else {\n\n if (isRelativeValue(data.from) === true) data.from = relativeToAbsoluteValue(data.from, data.elem)\n if (isRelativeValue(data.to) === true) data.to = relativeToAbsoluteValue(data.to, data.elem)\n\n }\n\n data.from = parseAbsoluteValue(data.from)\n data.to = parseAbsoluteValue(data.to)\n\n // Create a new props object to avoid changes by reference\n data.props = Object.keys(data.props).reduce((acc, key) => {\n\n // Copy prop object to avoid changes by reference\n const prop = Object.assign({}, data.props[key])\n\n if (isAbsoluteValue(prop.from) === false) throw new Error('Property `from` of prop must be a absolute value')\n if (isAbsoluteValue(prop.to) === false) throw new Error('Property `to` of prop must be a absolute value')\n if (prop.via != null && isAbsoluteValue(prop.via) === false) throw new Error('Property `via` of prop must be a absolute value')\n\n prop.from = parseAbsoluteValue(prop.from)\n prop.to = parseAbsoluteValue(prop.to)\n if (prop.via != null) prop.via = parseAbsoluteValue(prop.via)\n\n if (prop.timing == null) prop.timing = eases['linear']\n\n if (typeof prop.timing !== 'string' && typeof prop.timing !== 'function') throw new Error('Property `timing` of prop must be undefined, a string or a function')\n\n if (typeof prop.timing === 'string' && eases[prop.timing] == null) throw new Error('Unknown timing for property `timing` of prop')\n if (typeof prop.timing === 'string') prop.timing = eases[prop.timing]\n\n acc[key] = prop\n\n return acc\n\n }, {})\n\n return data\n\n}\n\n/**\n * Calculates prop values for a given scroll position. Pure: no callbacks, no DOM writes.\n * @param {Object} data - Validated data.\n * @param {Number} scrollTop - Pixels scrolled in document (clamped).\n * @returns {Object} precisePercentage and props\n */\nconst computeProps = function(data, scrollTop) {\n\n // 100% in pixel\n const total = data.to.value - data.from.value\n\n // Pixel scrolled\n const current = scrollTop - data.from.value\n\n // Percent scrolled (guard against division by zero)\n const precisePercentage = total === 0\n ? (current >= 0 ? 100 : 0)\n : current / (total / 100)\n const normalizedPercentage = Math.min(Math.max(precisePercentage, 0), 100)\n\n // All easing functions only remap a time value, and all have the same signature.\n const normalizedTime = normalizedPercentage / 100\n\n const props = {}\n\n for (const key of Object.keys(data.props)) {\n\n const prop = data.props[key]\n\n // Use the unit of from OR to. It's valid to animate from '0' to '100px' and\n // '0' should be treated as 'px', too. Unit will be an empty string when no unit given.\n const unit = prop.from.unit || prop.to.unit\n\n const time = prop.timing(normalizedTime)\n\n let value\n\n if (prop.via != null) {\n const midpoint = 0.5\n\n if (time <= midpoint) {\n const localTime = time / midpoint\n const diff = prop.from.value - prop.via.value\n\n value = prop.from.value - diff * localTime\n } else {\n const localTime = (time - midpoint) / midpoint\n const diff = prop.via.value - prop.to.value\n\n value = prop.via.value - diff * localTime\n }\n } else {\n const diff = prop.from.value - prop.to.value\n\n value = prop.from.value - diff * time\n }\n\n // Round to avoid unprecise values.\n const rounded = Math.round(value * 10000) / 10000\n\n props[key] = rounded + unit\n\n }\n\n return {\n precisePercentage,\n props\n }\n\n}\n\n/**\n * Calculates the props of an instance and executes its callbacks.\n * @param {Object} instance\n * @param {?Integer} scrollTop - Pixels scrolled in document (clamped).\n * @returns {Object} Calculated props and the element to apply styles to.\n */\nconst getProps = function(instance, scrollTop = getScrollTop()) {\n\n const data = instance.getData()\n\n const { precisePercentage, props } = computeProps(data, scrollTop)\n\n // Use precise percentage to check if the viewport is between from and to.\n const isInside = (precisePercentage >= 0 && precisePercentage <= 100)\n\n // Execute callbacks\n if (isInside === true) data.inside(instance, precisePercentage, props)\n else data.outside(instance, precisePercentage, props)\n\n return {\n elem: getElem(data),\n props\n }\n\n}\n\n/**\n * Adds properties to a given style object, skipping values that haven't changed.\n * @param {Node} elem - Styles will be applied to this element.\n * @param {Object} props - Object of props.\n * @param {?Object} cache - Last applied values.\n */\nconst setProps = function(elem, props, cache = null) {\n\n if (elem == null) return\n\n for (const key in props) {\n\n const value = props[key]\n\n if (cache != null) {\n if (cache[key] === value) continue\n cache[key] = value\n }\n\n elem.style.setProperty(key, value)\n\n }\n\n}\n\n/**\n * Returns the style cache of an instance.\n * @param {Object} instance\n * @returns {Object}\n */\nconst getStyleCache = function(instance) {\n\n let cache = styleCache.get(instance)\n\n if (cache == null) {\n cache = {}\n styleCache.set(instance, cache)\n }\n\n return cache\n\n}\n\n/**\n * Returns a subset of props.\n * @param {Object} props\n * @param {Array} keys\n * @returns {Object}\n */\nconst pickProps = function(props, keys) {\n\n return keys.reduce((acc, key) => {\n acc[key] = props[key]\n return acc\n }, {})\n\n}\n\n/**\n * Returns the keys of props whose value actually changes while scrolling.\n * @param {Object} data\n * @returns {Array}\n */\nconst getAnimatedKeys = function(data) {\n\n return Object.keys(data.props).filter((key) => {\n\n const prop = data.props[key]\n const isConstant = prop.from.value === prop.to.value && (prop.via == null || prop.via.value === prop.from.value)\n\n return isConstant === false\n\n })\n\n}\n\n/**\n * Returns the CSS syntax and initial value to register a custom property with.\n * @param {String} unit\n * @returns {Object}\n */\nconst getSyntaxForUnit = function(unit) {\n\n if (unit === '') return { syntax: '<number>', initialValue: '0' }\n if (['deg', 'grad', 'rad', 'turn'].includes(unit)) return { syntax: '<angle>', initialValue: '0deg' }\n if (['s', 'ms'].includes(unit)) return { syntax: '<time>', initialValue: '0s' }\n\n return { syntax: '<length-percentage>', initialValue: '0px' }\n\n}\n\n/**\n * Registers a custom property so it can be interpolated by the animation engine.\n * @param {String} name\n * @param {String} unit\n * @returns {Boolean} Whether the property can be animated smoothly.\n */\nconst registerCustomProperty = function(name, unit) {\n\n const { syntax, initialValue } = getSyntaxForUnit(unit)\n\n if (registeredProperties.has(name)) {\n const existing = registeredProperties.get(name)\n\n // null = registered elsewhere (e.g. @property in CSS), trust it\n return existing === null || existing === syntax\n }\n\n try {\n CSS.registerProperty({ name, syntax, inherits: true, initialValue })\n registeredProperties.set(name, syntax)\n return true\n } catch (error) {\n if (error != null && error.name === 'InvalidModificationError') {\n // Already registered, e.g. with @property in CSS\n registeredProperties.set(name, null)\n return true\n }\n return false\n }\n\n}\n\n/**\n * Converts a CSS property name to a keyframe key.\n * @param {String} key\n * @returns {String}\n */\nconst toKeyframeKey = function(key) {\n\n if (key.startsWith('--')) return key\n\n return key.replace(/-([a-z])/g, (match, char) => char.toUpperCase())\n\n}\n\n/**\n * Checks if an instance can use a native scroll timeline.\n * @param {Object} data\n * @param {Array} animatedKeys\n * @returns {Boolean}\n */\nconst canUseTimeline = function(data, animatedKeys) {\n\n if (settings.timeline === false) return false\n if (data.timeline === false) return false\n\n // Callbacks need to run per frame, which requires the JS loop\n if (data.timeline === 'auto' && data.hasCallbacks === true) return false\n\n if (supportsTimeline() === false) return false\n\n return animatedKeys.every((key) => {\n if (key.startsWith('--') === false) return true\n\n const prop = data.props[key]\n\n return registerCustomProperty(key, prop.from.unit || prop.to.unit)\n })\n\n}\n\n/**\n * Builds keyframes mapped onto the document scroll range (0 → max).\n * Easing and `via` are sampled so the result matches the JS calculation.\n * @param {Object} data\n * @param {Array} keys - Animated prop keys.\n * @param {Number} max - Max scroll distance.\n * @returns {Array} keyframes\n */\nconst buildKeyframes = function(data, keys, max) {\n\n const from = data.from.value\n const to = data.to.value\n\n const isLinear = keys.every((key) => data.props[key].timing === eases['linear'])\n const hasVia = keys.some((key) => data.props[key].via != null)\n const segments = isLinear ? (hasVia ? 2 : 1) : TIMELINE_SAMPLES\n\n const positions = [0, max]\n\n for (let i = 0; i <= segments; i++) {\n positions.push(from + (to - from) * (i / segments))\n }\n\n // Keyframe offsets must be within 0–1, values outside the scroll range are\n // represented by the exact values at the start/end of the scroll range.\n const uniquePositions = [...new Set(positions.filter((position) => position >= 0 && position <= max))]\n .sort((a, b) => a - b)\n\n return uniquePositions.map((position) => {\n\n const { props } = computeProps(data, position)\n const keyframe = { offset: position / max }\n\n for (const key of keys) {\n keyframe[toKeyframeKey(key)] = props[key]\n }\n\n return keyframe\n\n })\n\n}\n\n/**\n * Gets and sets new props of all active loop instances.\n * Runs inside requestAnimationFrame. Make sure it's performant as hell.\n * @param {Boolean} force - Update even when scrollTop hasn't changed.\n */\nconst update = function(force = false) {\n\n const loopInstances = getLoopInstances(instances)\n\n // Only continue when active instances available\n if (loopInstances.length === 0) return\n\n // Read phase\n const scrollTop = getScrollTop()\n\n // Only continue when scrollTop has changed\n if (force === false && previousScrollTop === scrollTop) return\n previousScrollTop = scrollTop\n\n // Calculate everything first, then write, to avoid layout thrashing\n const results = loopInstances.map((instance) => ({\n instance,\n ...getProps(instance, scrollTop)\n }))\n\n // Write phase\n for (const { instance, elem, props } of results) {\n setProps(elem, props, getStyleCache(instance))\n }\n\n}\n\n/**\n * Schedules an update for the next animation frame.\n * Multiple calls within the same frame are batched.\n * @param {Boolean} force\n */\nconst requestUpdate = function(force = false) {\n\n if (init === false) return\n\n pendingForce = pendingForce || force\n\n if (frameId != null) return\n\n frameId = requestAnimationFrame(() => {\n\n const shouldForce = pendingForce\n\n frameId = null\n pendingForce = false\n\n update(shouldForce)\n\n })\n\n}\n\n/**\n * Schedules a keyframe refresh of timeline instances when the scroll range changes.\n */\nconst requestTimelineRefresh = function() {\n\n if (timelineFrameId != null) return\n\n timelineFrameId = requestAnimationFrame(() => {\n\n timelineFrameId = null\n maxScrollTop = null\n\n const max = getMaxScrollTop()\n\n if (max === lastTimelineMax) return\n lastTimelineMax = max\n\n for (const instance of instances) {\n if (instance != null && instance.usesTimeline()) instance.syncTimeline()\n }\n\n })\n\n}\n\n/**\n * Recalculates all tracked instances (e.g. after a layout change).\n */\nconst recalculateAll = function() {\n\n getTrackedInstances(instances).forEach((instance) => instance.calculate())\n\n}\n\n/**\n * Handles resize events.\n * Height-only changes (iOS Safari toolbar collapsing/expanding) don't trigger\n * a recalculation, so animations don't jump while scrolling.\n */\nconst handleResize = debounce(() => {\n\n const width = getViewportWidth()\n\n // The scrollable distance might have changed in any case\n maxScrollTop = null\n requestTimelineRefresh()\n\n if (width === viewportWidth) return\n\n // A real resize (width change / orientation change)\n viewportWidth = width\n viewportHeight = null\n\n if (settings.recalculateOnResize === true) recalculateAll()\n\n requestUpdate(true)\n\n}, 150)\n\n/**\n * Creates a new instance.\n * @param {Object} data\n * @returns {Object} instance\n */\nexport const create = function(data) {\n\n // Store the parsed data\n let _data = null\n\n // Store if instance is started or stopped\n let active = false\n\n // Native scroll-driven animation state\n let timelineMode = false\n let animatedKeys = []\n let animation = null\n let animationTarget = null\n\n // Returns if instance is started or stopped\n const _isActive = () => {\n\n return active\n\n }\n\n // Returns the parsed and calculated data\n const _getData = function() {\n\n return _data\n\n }\n\n // Returns if the instance is driven by a native scroll timeline\n const _usesTimeline = () => {\n\n return timelineMode\n\n }\n\n // Cancels the native animation\n const _cancelAnimation = () => {\n\n if (animation != null) {\n animation.cancel()\n animation = null\n animationTarget = null\n }\n\n }\n\n // Falls back to the JS loop\n const _fallback = () => {\n\n _cancelAnimation()\n timelineMode = false\n styleCache.delete(instance)\n\n if (active) requestUpdate(true)\n\n }\n\n // Creates or refreshes the native animation\n const _syncTimeline = () => {\n\n if (timelineMode === false) return\n\n const elem = getElem(_data)\n\n if (elem == null) return\n\n const cache = getStyleCache(instance)\n const { props } = computeProps(_data, getScrollTop())\n\n // Props that never change are simply set once\n const staticKeys = Object.keys(props).filter((key) => animatedKeys.includes(key) === false)\n setProps(elem, pickProps(props, staticKeys), cache)\n\n // Not started yet: create the animation on start()\n if (active === false && animation == null) return\n\n const max = getMaxScrollTop()\n\n // Nothing to animate, or the page can't scroll\n if (animatedKeys.length === 0 || max <= 0) {\n _cancelAnimation()\n setProps(elem, pickProps(props, animatedKeys), cache)\n return\n }\n\n const keyframes = buildKeyframes(_data, animatedKeys, max)\n\n try {\n\n if (animation != null && animationTarget === elem) {\n animation.effect.setKeyframes(keyframes)\n } else {\n _cancelAnimation()\n\n const effect = new KeyframeEffect(elem, keyframes, {\n fill: 'both',\n easing: 'linear'\n })\n\n animation = new Animation(effect, getScrollTimeline())\n animationTarget = elem\n }\n\n if (active) {\n if (animation.playState !== 'running') animation.play()\n } else {\n animation.pause()\n }\n\n } catch (error) {\n // Something isn't supported after all, use the JS loop instead\n _fallback()\n }\n\n }\n\n // Parses and calculates data\n const _calculate = function() {\n\n // Refresh cached measurements, as layout may have changed\n viewportHeight = null\n maxScrollTop = null\n\n _data = validate(data)\n\n // Styles may have been reset externally, so don't trust the cache\n styleCache.delete(instance)\n\n animatedKeys = getAnimatedKeys(_data)\n timelineMode = canUseTimeline(_data, animatedKeys)\n\n if (timelineMode) _syncTimeline()\n else _cancelAnimation()\n\n }\n\n // Update props\n const _update = () => {\n\n if (timelineMode) {\n\n // The native animation applies the styles, just refresh it\n _syncTimeline()\n\n // Still return props (and run callbacks) for consumers relying on it\n const { props } = getProps(instance)\n\n return props\n\n }\n\n // Get new props\n const { elem, props } = getProps(instance)\n\n // Set new props\n setProps(elem, props, getStyleCache(instance))\n\n return props\n\n }\n\n // Starts to animate\n const _start = () => {\n\n active = true\n\n if (timelineMode) _syncTimeline()\n else requestUpdate(true)\n\n }\n\n // Stops to animate\n const _stop = () => {\n\n active = false\n\n // Freeze the native animation at its current state\n if (animation != null) animation.pause()\n\n }\n\n // Destroys the instance\n const _destroy = () => {\n\n _cancelAnimation()\n\n // Replace instance instead of deleting the item to avoid\n // that the index of other instances changes.\n instances[index] = undefined\n styleCache.delete(instance)\n\n }\n\n // Assign instance to a variable so the instance can be used\n // elsewhere in the current function.\n const instance = {\n isActive: _isActive,\n getData: _getData,\n usesTimeline: _usesTimeline,\n syncTimeline: _syncTimeline,\n calculate: _calculate,\n update: _update,\n start: _start,\n stop: _stop,\n destroy: _destroy\n }\n\n // Store instance in global array and save the index\n const index = instances.push(instance) - 1\n\n // Calculate data for the first time\n instance.calculate()\n\n return instance\n\n}\n\n/**\n * Starts listening for scroll changes.\n * @param {?Object} options\n * @param {?Boolean} options.recalculateOnResize - Recalculate tracked instances when the viewport width changes.\n * @param {?Boolean} options.timeline - Allow native scroll-driven animations (default true).\n */\nexport const mount = function(options = {}) {\n\n // Guard against multiple calls\n if (init) {\n return\n }\n init = true\n\n settings = Object.assign({}, settings, options)\n\n viewportWidth = getViewportWidth()\n viewportHeight = null\n maxScrollTop = null\n previousScrollTop = null\n lastTimelineMax = null\n\n const onScroll = () => requestUpdate(false)\n const onPageShow = () => {\n // Restored from bfcache: positions may be stale\n maxScrollTop = null\n lastTimelineMax = null\n requestTimelineRefresh()\n requestUpdate(true)\n }\n\n listeners = { onScroll, onPageShow }\n\n window.addEventListener('scroll', onScroll, { passive: true })\n window.addEventListener('resize', handleResize, { passive: true })\n window.addEventListener('orientationchange', handleResize, { passive: true })\n window.addEventListener('pageshow', onPageShow)\n\n // React to document height changes (lazy images etc.)\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => {\n maxScrollTop = null\n requestTimelineRefresh()\n })\n resizeObserver.observe(document.documentElement)\n }\n\n // Initial update\n requestUpdate(true)\n\n}\n\n/**\n * Stops listening and cleans up instances that are no longer in the DOM.\n */\nexport const unmount = function() {\n\n if (init === false) {\n return\n }\n\n let instancesInDom = false\n\n for (const instance of instances) {\n // Check element is still in DOM\n if (instance == null) continue\n\n const elem = instance.getData().elem\n\n if (elem == null || document.body.contains(elem) === false) {\n // Destroy instance\n instance.destroy()\n } else {\n instancesInDom = true\n }\n }\n\n // Do we have instances left (have all running instances been destroyed)?\n // If so, it's safe to reset the instances array\n if (instancesInDom === false) {\n instances = []\n }\n\n if (listeners != null) {\n window.removeEventListener('scroll', listeners.onScroll)\n window.removeEventListener('resize', handleResize)\n window.removeEventListener('orientationchange', handleResize)\n window.removeEventListener('pageshow', listeners.onPageShow)\n listeners = null\n }\n\n handleResize.cancel()\n\n if (resizeObserver != null) {\n resizeObserver.disconnect()\n resizeObserver = null\n }\n\n if (frameId != null) {\n cancelAnimationFrame(frameId)\n frameId = null\n }\n\n if (timelineFrameId != null) {\n cancelAnimationFrame(timelineFrameId)\n timelineFrameId = null\n }\n\n pendingForce = false\n previousScrollTop = null\n lastTimelineMax = null\n init = false\n\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAI,YAAY,CAAC;AACjB,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,OAAO;AACX,IAAI,oBAAoB;AACxB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,IAAI,gBAAgB;AACpB,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,IAAI,kBAAkB;AACtB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,IAAI,WAAW;CACb,qBAAqB;CACrB,UAAU;AACZ;AAGA,IAAM,mBAAmB;AAGzB,IAAM,6BAAa,IAAI,QAAQ;AAG/B,IAAM,uCAAuB,IAAI,IAAI;;;;;;;AAQrC,IAAM,WAAW,SAAS,IAAI,UAAU;CAEtC,IAAI,UAAU;CAEd,MAAM,aAAa,GAAG,SAAS;EAC7B,aAAa,OAAO;EACpB,UAAU,iBAAiB,GAAG,GAAG,IAAI,GAAG,QAAQ;CAClD;CAEA,UAAU,eAAe,aAAa,OAAO;CAE7C,OAAO;AAET;;;;;;AAOA,IAAM,mBAAmB,SAAS,WAAW;CAE3C,OAAO,UAAU,QAAQ,aAAa,YAAY,QAAQ,SAAS,SAAS,KAAK,SAAS,aAAa,MAAM,KAAK;AAEpH;;;;;;AAOA,IAAM,sBAAsB,SAAS,WAAW;CAE9C,OAAO,UAAU,QAAQ,aAAa,YAAY,QAAQ,SAAS,QAAQ,CAAC,CAAC,KAAK;AAEpF;;;;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AS,KAAK,SAAS,IAAI,MAAM,OAEnD,SAAS,QAAQ;OAEjB,iBAAiB;CAErB;CAIA,IAAI,mBAAmB,OACrB,YAAY,CAAC;CAGf,IAAI,aAAa,MAAM;EACrB,OAAO,oBAAoB,UAAU,UAAU,QAAQ;EACvD,OAAO,oBAAoB,UAAU,YAAY;EACjD,OAAO,oBAAoB,qBAAqB,YAAY;EAC5D,OAAO,oBAAoB,YAAY,UAAU,UAAU;EAC3D,YAAY;CACd;CAEA,aAAa,OAAO;CAEpB,IAAI,kBAAkB,MAAM;EAC1B,eAAe,WAAW;EAC1B,iBAAiB;CACnB;CAEA,IAAI,WAAW,MAAM;EACnB,qBAAqB,OAAO;EAC5B,UAAU;CACZ;CAEA,IAAI,mBAAmB,MAAM;EAC3B,qBAAqB,eAAe;EACpC,kBAAkB;CACpB;CAEA,eAAe;CACf,oBAAoB;CACpB,kBAAkB;CAClB,OAAO;AAET"}
@@ -0,0 +1,2 @@
1
+ var buttery=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),u=s(((e,t)=>{t.exports=function(e,t){return t||=[0,``],e=String(e),t[0]=parseFloat(e,10),t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||``,t}})),d=s(((e,t)=>{function n(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}t.exports=n})),f=s(((e,t)=>{function n(e){var t=1.70158;return e*e*((t+1)*e-t)}t.exports=n})),p=s(((e,t)=>{function n(e){var t=1.70158;return--e*e*((t+1)*e+t)+1}t.exports=n})),m=s(((e,t)=>{function n(e){var t=4/11,n=8/11,r=9/10,i=4356/361,a=35442/1805,o=16061/1805,s=e*e;return e<t?7.5625*s:e<n?9.075*s-9.9*e+3.4:e<r?i*s-a*e+o:10.8*e*e-20.52*e+10.72}t.exports=n})),ee=s(((e,t)=>{var n=m();function r(e){return e<.5?.5*(1-n(1-e*2)):.5*n(e*2-1)+.5}t.exports=r})),te=s(((e,t)=>{var n=m();function r(e){return 1-n(1-e)}t.exports=r})),ne=s(((e,t)=>{function n(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}t.exports=n})),re=s(((e,t)=>{function n(e){return 1-Math.sqrt(1-e*e)}t.exports=n})),ie=s(((e,t)=>{function n(e){return Math.sqrt(1- --e*e)}t.exports=n})),ae=s(((e,t)=>{function n(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}t.exports=n})),oe=s(((e,t)=>{function n(e){return e*e*e}t.exports=n})),se=s(((e,t)=>{function n(e){var t=e-1;return t*t*t+1}t.exports=n})),ce=s(((e,t)=>{function n(e){return e<.5?.5*Math.sin(13*Math.PI/2*2*e)*2**(10*(2*e-1)):.5*Math.sin(-13*Math.PI/2*(2*e-1+1))*2**(-10*(2*e-1))+1}t.exports=n})),le=s(((e,t)=>{function n(e){return Math.sin(13*e*Math.PI/2)*2**(10*(e-1))}t.exports=n})),ue=s(((e,t)=>{function n(e){return Math.sin(-13*(e+1)*Math.PI/2)*2**(-10*e)+1}t.exports=n})),de=s(((e,t)=>{function n(e){return e===0||e===1?e:e<.5?.5*2**(20*e-10):-.5*2**(10-e*20)+1}t.exports=n})),fe=s(((e,t)=>{function n(e){return e===0?e:2**(10*(e-1))}t.exports=n})),pe=s(((e,t)=>{function n(e){return e===1?e:1-2**(-10*e)}t.exports=n})),me=s(((e,t)=>{function n(e){return e}t.exports=n})),he=s(((e,t)=>{function n(e){return e/=.5,e<1?.5*e*e:(e--,-.5*(e*(e-2)-1))}t.exports=n})),ge=s(((e,t)=>{function n(e){return e*e}t.exports=n})),_e=s(((e,t)=>{function n(e){return-e*(e-2)}t.exports=n})),ve=s(((e,t)=>{function n(e){return e<.5?8*e**4:-8*(e-1)**4+1}t.exports=n})),ye=s(((e,t)=>{function n(e){return e**4}t.exports=n})),be=s(((e,t)=>{function n(e){return(e-1)**3*(1-e)+1}t.exports=n})),xe=s(((e,t)=>{function n(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}t.exports=n})),Se=s(((e,t)=>{function n(e){return e*e*e*e*e}t.exports=n})),Ce=s(((e,t)=>{function n(e){return--e*e*e*e*e+1}t.exports=n})),we=s(((e,t)=>{function n(e){return-.5*(Math.cos(Math.PI*e)-1)}t.exports=n})),Te=s(((e,t)=>{function n(e){var t=Math.cos(e*Math.PI*.5);return Math.abs(t)<1e-14?1:1-t}t.exports=n})),Ee=s(((e,t)=>{function n(e){return Math.sin(e*Math.PI/2)}t.exports=n})),De=s(((e,t)=>{t.exports={backInOut:d(),backIn:f(),backOut:p(),bounceInOut:ee(),bounceIn:te(),bounceOut:m(),circInOut:ne(),circIn:re(),circOut:ie(),cubicInOut:ae(),cubicIn:oe(),cubicOut:se(),elasticInOut:ce(),elasticIn:le(),elasticOut:ue(),expoInOut:de(),expoIn:fe(),expoOut:pe(),linear:me(),quadInOut:he(),quadIn:ge(),quadOut:_e(),quartInOut:ve(),quartIn:ye(),quartOut:be(),quintInOut:xe(),quintIn:Se(),quintOut:Ce(),sineInOut:we(),sineIn:Te(),sineOut:Ee()}})),h=l(u(),1),g=l(De(),1),_=[],v=null,y=!1,b=!1,x=null,S=null,C=null,w=null,T=null,E=null,D=null,O=null,k=null,A=null,j={recalculateOnResize:!1,timeline:!0},Oe=30,M=new WeakMap,N=new Map,ke=function(e,t){let n=null,r=(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)};return r.cancel=()=>clearTimeout(n),r},Ae=function(e){return e.filter(e=>e!=null&&e.isActive()&&e.usesTimeline()===!1)},je=function(e){return e.filter(e=>e!=null&&e.getData().track)},P=function(){return A??=typeof window<`u`&&typeof window.ScrollTimeline==`function`&&typeof window.Animation==`function`&&typeof window.KeyframeEffect==`function`&&window.CSS!=null&&typeof window.CSS.registerProperty==`function`,A},F=function(){return document.scrollingElement||document.documentElement},I=function(){return k??=new ScrollTimeline({source:F(),axis:`block`}),k},L=function(){return F().scrollTop},R=function(){let e=F();return Math.max(0,e.scrollHeight-e.clientHeight)},z=function(){let e=L();return e<=0?0:((S==null||e>S)&&(S=R()),Math.min(e,S))},Me=function(){return C??=document.documentElement.clientHeight||window.innerHeight||window.outerHeight,C},B=function(){return document.documentElement.clientWidth||window.innerWidth},V=function(e){return isNaN((0,h.default)(e)[0])===!1},H=function(e){let t=(0,h.default)(e);return{value:t[0],unit:t[1]}},U=function(e){return String(e).match(/^[a-z0-9%]+-[a-z0-9%]+$/)!==null},Ne=function(e,t){return e===!0?t.elem:e instanceof HTMLElement?t.direct:t.global},W=function(e){return Ne(e.direct,{global:document.documentElement,elem:e.elem,direct:e.direct})},G=function(e,t,n=L(),r=Me()){let i=t.getBoundingClientRect(),a=e.match(/^[a-z0-9%]+/)[0],o=e.match(/[a-z0-9%]+$/)[0],s=i.top+n,c=0;if(o.match(/%$/)!==null){let e=parseFloat(o.replace(`%`,``))/100;c-=r*e}else o===`top`&&(c-=0),o===`middle`&&(c-=r/2),o===`bottom`&&(c-=r);if(a.match(/%$/)!==null){let e=parseFloat(a.replace(`%`,``))/100;c+=s+i.height*e}else a===`top`&&(c+=s),a===`middle`&&(c+=s+i.height/2),a===`bottom`&&(c+=s+i.height);return`${c}px`},Pe=function(e={}){if(e=Object.assign({},e),e.hasCallbacks=e.inside!=null||e.outside!=null,e.inside??(e.inside=()=>{}),e.outside??(e.outside=()=>{}),e.direct??(e.direct=!1),e.track??(e.track=!0),e.props??(e.props={}),e.timeline??(e.timeline=`auto`),e.from==null)throw Error("Missing property `from`");if(e.to==null)throw Error("Missing property `to`");if(typeof e.inside!=`function`)throw Error("Property `inside` must be undefined or a function");if(typeof e.outside!=`function`)throw Error("Property `outside` must be undefined or a function");if(typeof e.direct!=`boolean`&&!(e.direct instanceof HTMLElement))throw Error("Property `direct` must be undefined, a boolean or a DOM element/node");if(e.direct===!0&&e.elem==null)throw Error("Property `elem` is required when `direct` is true");if(typeof e.track!=`boolean`)throw Error("Property `track` must be undefined or a boolean");if(typeof e.props!=`object`)throw Error("Property `props` must be undefined or an object");if(e.timeline!==`auto`&&typeof e.timeline!=`boolean`)throw Error("Property `timeline` must be undefined, a boolean or 'auto'");if(e.elem==null){if(V(e.from)===!1)throw Error("Property `from` must be a absolute value when no `elem` has been provided");if(V(e.to)===!1)throw Error("Property `to` must be a absolute value when no `elem` has been provided")}else U(e.from)===!0&&(e.from=G(e.from,e.elem)),U(e.to)===!0&&(e.to=G(e.to,e.elem));return e.from=H(e.from),e.to=H(e.to),e.props=Object.keys(e.props).reduce((t,n)=>{let r=Object.assign({},e.props[n]);if(V(r.from)===!1)throw Error("Property `from` of prop must be a absolute value");if(V(r.to)===!1)throw Error("Property `to` of prop must be a absolute value");if(r.via!=null&&V(r.via)===!1)throw Error("Property `via` of prop must be a absolute value");if(r.from=H(r.from),r.to=H(r.to),r.via!=null&&(r.via=H(r.via)),r.timing??=g.default.linear,typeof r.timing!=`string`&&typeof r.timing!=`function`)throw Error("Property `timing` of prop must be undefined, a string or a function");if(typeof r.timing==`string`&&g.default[r.timing]==null)throw Error("Unknown timing for property `timing` of prop");return typeof r.timing==`string`&&(r.timing=g.default[r.timing]),t[n]=r,t},{}),e},K=function(e,t){let n=e.to.value-e.from.value,r=t-e.from.value,i=n===0?r>=0?100:0:r/(n/100),a=Math.min(Math.max(i,0),100)/100,o={};for(let t of Object.keys(e.props)){let n=e.props[t],r=n.from.unit||n.to.unit,i=n.timing(a),s;if(n.via!=null){let e=.5;if(i<=e){let t=i/e,r=n.from.value-n.via.value;s=n.from.value-r*t}else{let t=(i-e)/e,r=n.via.value-n.to.value;s=n.via.value-r*t}}else{let e=n.from.value-n.to.value;s=n.from.value-e*i}o[t]=Math.round(s*1e4)/1e4+r}return{precisePercentage:i,props:o}},q=function(e,t=z()){let n=e.getData(),{precisePercentage:r,props:i}=K(n,t);return r>=0&&r<=100?n.inside(e,r,i):n.outside(e,r,i),{elem:W(n),props:i}},J=function(e,t,n=null){if(e!=null)for(let r in t){let i=t[r];if(n!=null){if(n[r]===i)continue;n[r]=i}e.style.setProperty(r,i)}},Y=function(e){let t=M.get(e);return t??(t={},M.set(e,t)),t},X=function(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})},Fe=function(e){return Object.keys(e.props).filter(t=>{let n=e.props[t];return n.from.value!==n.to.value||n.via!=null&&n.via.value!==n.from.value})},Ie=function(e){return e===``?{syntax:`<number>`,initialValue:`0`}:[`deg`,`grad`,`rad`,`turn`].includes(e)?{syntax:`<angle>`,initialValue:`0deg`}:[`s`,`ms`].includes(e)?{syntax:`<time>`,initialValue:`0s`}:{syntax:`<length-percentage>`,initialValue:`0px`}},Le=function(e,t){let{syntax:n,initialValue:r}=Ie(t);if(N.has(e)){let t=N.get(e);return t===null||t===n}try{return CSS.registerProperty({name:e,syntax:n,inherits:!0,initialValue:r}),N.set(e,n),!0}catch(t){return t!=null&&t.name===`InvalidModificationError`&&(N.set(e,null),!0)}},Re=function(e){return e.startsWith(`--`)?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())},ze=function(e,t){return j.timeline===!1||e.timeline===!1||e.timeline===`auto`&&e.hasCallbacks===!0||P()===!1?!1:t.every(t=>{if(t.startsWith(`--`)===!1)return!0;let n=e.props[t];return Le(t,n.from.unit||n.to.unit)})},Be=function(e,t,n){let r=e.from.value,i=e.to.value,a=t.every(t=>e.props[t].timing===g.default.linear),o=t.some(t=>e.props[t].via!=null),s=a?o?2:1:Oe,c=[0,n];for(let e=0;e<=s;e++)c.push(r+(i-r)*(e/s));return[...new Set(c.filter(e=>e>=0&&e<=n))].sort((e,t)=>e-t).map(r=>{let{props:i}=K(e,r),a={offset:r/n};for(let e of t)a[Re(e)]=i[e];return a})},Ve=function(e=!1){let t=Ae(_);if(t.length===0)return;let n=z();if(e===!1&&x===n)return;x=n;let r=t.map(e=>({instance:e,...q(e,n)}));for(let{instance:e,elem:t,props:n}of r)J(t,n,Y(e))},Z=function(e=!1){b!==!1&&(y||=e,v??=requestAnimationFrame(()=>{let e=y;v=null,y=!1,Ve(e)}))},Q=function(){D??=requestAnimationFrame(()=>{D=null,S=null;let e=R();if(e!==O){O=e;for(let e of _)e!=null&&e.usesTimeline()&&e.syncTimeline()}})},He=function(){je(_).forEach(e=>e.calculate())},$=ke(()=>{let e=B();S=null,Q(),e!==w&&(w=e,C=null,j.recalculateOnResize===!0&&He(),Z(!0))},150);return e.create=function(e){let t=null,n=!1,r=!1,i=[],a=null,o=null,s=()=>n,c=function(){return t},l=()=>r,u=()=>{a!=null&&(a.cancel(),a=null,o=null)},d=()=>{u(),r=!1,M.delete(p),n&&Z(!0)},f=()=>{if(r===!1)return;let e=W(t);if(e==null)return;let s=Y(p),{props:c}=K(t,z());if(J(e,X(c,Object.keys(c).filter(e=>i.includes(e)===!1)),s),n===!1&&a==null)return;let l=R();if(i.length===0||l<=0){u(),J(e,X(c,i),s);return}let f=Be(t,i,l);try{if(a!=null&&o===e)a.effect.setKeyframes(f);else{u();let t=new KeyframeEffect(e,f,{fill:`both`,easing:`linear`});a=new Animation(t,I()),o=e}n?a.playState!==`running`&&a.play():a.pause()}catch{d()}},p={isActive:s,getData:c,usesTimeline:l,syncTimeline:f,calculate:function(){C=null,S=null,t=Pe(e),M.delete(p),i=Fe(t),r=ze(t,i),r?f():u()},update:()=>{if(r){f();let{props:e}=q(p);return e}let{elem:e,props:t}=q(p);return J(e,t,Y(p)),t},start:()=>{n=!0,r?f():Z(!0)},stop:()=>{n=!1,a?.pause()},destroy:()=>{u(),_[m]=void 0,M.delete(p)}},m=_.push(p)-1;return p.calculate(),p},e.mount=function(e={}){if(b)return;b=!0,j=Object.assign({},j,e),w=B(),C=null,S=null,x=null,O=null;let t=()=>Z(!1),n=()=>{S=null,O=null,Q(),Z(!0)};T={onScroll:t,onPageShow:n},window.addEventListener(`scroll`,t,{passive:!0}),window.addEventListener(`resize`,$,{passive:!0}),window.addEventListener(`orientationchange`,$,{passive:!0}),window.addEventListener(`pageshow`,n),typeof ResizeObserver<`u`&&(E=new ResizeObserver(()=>{S=null,Q()}),E.observe(document.documentElement)),Z(!0)},e.supportsTimeline=P,e.unmount=function(){if(b===!1)return;let e=!1;for(let t of _){if(t==null)continue;let n=t.getData().elem;n==null||document.body.contains(n)===!1?t.destroy():e=!0}e===!1&&(_=[]),T!=null&&(window.removeEventListener(`scroll`,T.onScroll),window.removeEventListener(`resize`,$),window.removeEventListener(`orientationchange`,$),window.removeEventListener(`pageshow`,T.onPageShow),T=null),$.cancel(),E!=null&&(E.disconnect(),E=null),v!=null&&(cancelAnimationFrame(v),v=null),D!=null&&(cancelAnimationFrame(D),D=null),y=!1,x=null,O=null,b=!1},e})({});
2
+ //# sourceMappingURL=buttery.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buttery.min.js","names":["parseUnit","eases","exports","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__commonJSMin","mod","cb","__copyProps","from","keys","i","n","key","to","except","k","desc","__toESM","isNodeMode","target","require_parse_unit","out","str","require_back_in_out","backInOut","s","t","require_back_in","backIn","require_back_out","backOut","require_bounce_out","bounceOut","a","b","c","ca","cc","t2","require_bounce_in_out","bounceInOut","require_bounce_in","bounceIn","require_circ_in_out","circInOut","require_circ_in","circIn","require_circ_out","circOut","require_cubic_in_out","cubicInOut","require_cubic_in","cubicIn","require_cubic_out","cubicOut","f","require_elastic_in_out","elasticInOut","require_elastic_in","elasticIn","require_elastic_out","elasticOut","require_expo_in_out","expoInOut","require_expo_in","expoIn","require_expo_out","expoOut","require_linear","linear","require_quad_in_out","quadInOut","require_quad_in","quadIn","require_quad_out","quadOut","require_quart_in_out","quarticInOut","require_quart_in","quarticIn","require_quart_out","quarticOut","require_quint_in_out","qinticInOut","require_quint_in","qinticIn","require_quint_out","qinticOut","require_sine_in_out","sineInOut","require_sine_in","sineIn","v","require_sine_out","sineOut","require_eases","\"backInOut\"","\"backIn\"","\"backOut\"","\"bounceInOut\"","\"bounceIn\"","\"bounceOut\"","\"circInOut\"","\"circIn\"","\"circOut\"","\"cubicInOut\"","\"cubicIn\"","\"cubicOut\"","\"elasticInOut\"","\"elasticIn\"","\"elasticOut\"","\"expoInOut\"","\"expoIn\"","\"expoOut\"","\"linear\"","\"quadInOut\"","\"quadIn\"","\"quadOut\"","\"quartInOut\"","\"quartIn\"","\"quartOut\"","\"quintInOut\"","\"quintIn\"","\"quintOut\"","\"sineInOut\"","\"sineIn\"","\"sineOut\"","import_parse_unit","import_eases","instances","frameId","pendingForce","init","previousScrollTop","maxScrollTop","viewportHeight","viewportWidth","listeners","resizeObserver","timelineFrameId","lastTimelineMax","scrollTimeline","timelineSupport","settings","TIMELINE_SAMPLES","styleCache","registeredProperties","debounce","timeout","debounced","args","fn","duration","getLoopInstances","instance","getTrackedInstances","supportsTimeline","getScrollingElement","getScrollTimeline","getRawScrollTop","getMaxScrollTop","elem","getScrollTop","scrollTop","getViewportHeight","getViewportWidth","isAbsoluteValue","value","parseAbsoluteValue","parsedValue","isRelativeValue","mapDirectToProperty","direct","properties","getElem","data","relativeToAbsoluteValue","elemSize","elemAnchor","viewportAnchor","elemTop","y","percent","vh","validate","prop","acc","computeProps","total","current","precisePercentage","normalizedTime","props","unit","time","midpoint","localTime","diff","getProps","setProps","cache","getStyleCache","pickProps","getAnimatedKeys","getSyntaxForUnit","registerCustomProperty","name","existing","syntax","error","toKeyframeKey","char","canUseTimeline","animatedKeys","buildKeyframes","isLinear","hasVia","segments","positions","max","position","keyframe","update","loopInstances","force","results","requestUpdate","shouldForce","requestTimelineRefresh","recalculateAll","handleResize","width","_data","active","timelineMode","animation","animationTarget","_isActive","_getData","_usesTimeline","_cancelAnimation","_fallback","_syncTimeline","keyframes","effect","index","options","onScroll","onPageShow","instancesInDom"],"sources":["../node_modules/parse-unit/index.js","../node_modules/eases/back-in-out.js","../node_modules/eases/back-in.js","../node_modules/eases/back-out.js","../node_modules/eases/bounce-out.js","../node_modules/eases/bounce-in-out.js","../node_modules/eases/bounce-in.js","../node_modules/eases/circ-in-out.js","../node_modules/eases/circ-in.js","../node_modules/eases/circ-out.js","../node_modules/eases/cubic-in-out.js","../node_modules/eases/cubic-in.js","../node_modules/eases/cubic-out.js","../node_modules/eases/elastic-in-out.js","../node_modules/eases/elastic-in.js","../node_modules/eases/elastic-out.js","../node_modules/eases/expo-in-out.js","../node_modules/eases/expo-in.js","../node_modules/eases/expo-out.js","../node_modules/eases/linear.js","../node_modules/eases/quad-in-out.js","../node_modules/eases/quad-in.js","../node_modules/eases/quad-out.js","../node_modules/eases/quart-in-out.js","../node_modules/eases/quart-in.js","../node_modules/eases/quart-out.js","../node_modules/eases/quint-in-out.js","../node_modules/eases/quint-in.js","../node_modules/eases/quint-out.js","../node_modules/eases/sine-in-out.js","../node_modules/eases/sine-in.js","../node_modules/eases/sine-out.js","../node_modules/eases/index.js","../lib/buttery.js"],"sourcesContent":["module.exports = function parseUnit(str, out) {\n if (!out)\n out = [ 0, '' ]\n\n str = String(str)\n var num = parseFloat(str, 10)\n out[0] = num\n out[1] = str.match(/[\\d.\\-\\+]*\\s*(.*)/)[1] || ''\n return out\n}","function backInOut(t) {\n var s = 1.70158 * 1.525\n if ((t *= 2) < 1)\n return 0.5 * (t * t * ((s + 1) * t - s))\n return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2)\n}\n\nmodule.exports = backInOut","function backIn(t) {\n var s = 1.70158\n return t * t * ((s + 1) * t - s)\n}\n\nmodule.exports = backIn","function backOut(t) {\n var s = 1.70158\n return --t * t * ((s + 1) * t + s) + 1\n}\n\nmodule.exports = backOut","function bounceOut(t) {\n var a = 4.0 / 11.0\n var b = 8.0 / 11.0\n var c = 9.0 / 10.0\n\n var ca = 4356.0 / 361.0\n var cb = 35442.0 / 1805.0\n var cc = 16061.0 / 1805.0\n\n var t2 = t * t\n\n return t < a\n ? 7.5625 * t2\n : t < b\n ? 9.075 * t2 - 9.9 * t + 3.4\n : t < c\n ? ca * t2 - cb * t + cc\n : 10.8 * t * t - 20.52 * t + 10.72\n}\n\nmodule.exports = bounceOut","var bounceOut = require('./bounce-out')\n\nfunction bounceInOut(t) {\n return t < 0.5\n ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0))\n : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5\n}\n\nmodule.exports = bounceInOut","var bounceOut = require('./bounce-out')\n\nfunction bounceIn(t) {\n return 1.0 - bounceOut(1.0 - t)\n}\n\nmodule.exports = bounceIn","function circInOut(t) {\n if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - t * t) - 1)\n return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1)\n}\n\nmodule.exports = circInOut","function circIn(t) {\n return 1.0 - Math.sqrt(1.0 - t * t)\n}\n\nmodule.exports = circIn","function circOut(t) {\n return Math.sqrt(1 - ( --t * t ))\n}\n\nmodule.exports = circOut","function cubicInOut(t) {\n return t < 0.5\n ? 4.0 * t * t * t\n : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0\n}\n\nmodule.exports = cubicInOut","function cubicIn(t) {\n return t * t * t\n}\n\nmodule.exports = cubicIn","function cubicOut(t) {\n var f = t - 1.0\n return f * f * f + 1.0\n}\n\nmodule.exports = cubicOut","function elasticInOut(t) {\n return t < 0.5\n ? 0.5 * Math.sin(+13.0 * Math.PI/2 * 2.0 * t) * Math.pow(2.0, 10.0 * (2.0 * t - 1.0))\n : 0.5 * Math.sin(-13.0 * Math.PI/2 * ((2.0 * t - 1.0) + 1.0)) * Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) + 1.0\n}\n\nmodule.exports = elasticInOut","function elasticIn(t) {\n return Math.sin(13.0 * t * Math.PI/2) * Math.pow(2.0, 10.0 * (t - 1.0))\n}\n\nmodule.exports = elasticIn","function elasticOut(t) {\n return Math.sin(-13.0 * (t + 1.0) * Math.PI/2) * Math.pow(2.0, -10.0 * t) + 1.0\n}\n\nmodule.exports = elasticOut","function expoInOut(t) {\n return (t === 0.0 || t === 1.0)\n ? t\n : t < 0.5\n ? +0.5 * Math.pow(2.0, (20.0 * t) - 10.0)\n : -0.5 * Math.pow(2.0, 10.0 - (t * 20.0)) + 1.0\n}\n\nmodule.exports = expoInOut","function expoIn(t) {\n return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0))\n}\n\nmodule.exports = expoIn","function expoOut(t) {\n return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t)\n}\n\nmodule.exports = expoOut","function linear(t) {\n return t\n}\n\nmodule.exports = linear","function quadInOut(t) {\n t /= 0.5\n if (t < 1) return 0.5*t*t\n t--\n return -0.5 * (t*(t-2) - 1)\n}\n\nmodule.exports = quadInOut","function quadIn(t) {\n return t * t\n}\n\nmodule.exports = quadIn","function quadOut(t) {\n return -t * (t - 2.0)\n}\n\nmodule.exports = quadOut","function quarticInOut(t) {\n return t < 0.5\n ? +8.0 * Math.pow(t, 4.0)\n : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0\n}\n\nmodule.exports = quarticInOut","function quarticIn(t) {\n return Math.pow(t, 4.0)\n}\n\nmodule.exports = quarticIn","function quarticOut(t) {\n return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0\n}\n\nmodule.exports = quarticOut","function qinticInOut(t) {\n if ( ( t *= 2 ) < 1 ) return 0.5 * t * t * t * t * t\n return 0.5 * ( ( t -= 2 ) * t * t * t * t + 2 )\n}\n\nmodule.exports = qinticInOut","function qinticIn(t) {\n return t * t * t * t * t\n}\n\nmodule.exports = qinticIn","function qinticOut(t) {\n return --t * t * t * t * t + 1\n}\n\nmodule.exports = qinticOut","function sineInOut(t) {\n return -0.5 * (Math.cos(Math.PI*t) - 1)\n}\n\nmodule.exports = sineInOut","function sineIn (t) {\n var v = Math.cos(t * Math.PI * 0.5)\n if (Math.abs(v) < 1e-14) return 1\n else return 1 - v\n}\n\nmodule.exports = sineIn\n","function sineOut(t) {\n return Math.sin(t * Math.PI/2)\n}\n\nmodule.exports = sineOut","module.exports = {\n\t'backInOut': require('./back-in-out'),\n\t'backIn': require('./back-in'),\n\t'backOut': require('./back-out'),\n\t'bounceInOut': require('./bounce-in-out'),\n\t'bounceIn': require('./bounce-in'),\n\t'bounceOut': require('./bounce-out'),\n\t'circInOut': require('./circ-in-out'),\n\t'circIn': require('./circ-in'),\n\t'circOut': require('./circ-out'),\n\t'cubicInOut': require('./cubic-in-out'),\n\t'cubicIn': require('./cubic-in'),\n\t'cubicOut': require('./cubic-out'),\n\t'elasticInOut': require('./elastic-in-out'),\n\t'elasticIn': require('./elastic-in'),\n\t'elasticOut': require('./elastic-out'),\n\t'expoInOut': require('./expo-in-out'),\n\t'expoIn': require('./expo-in'),\n\t'expoOut': require('./expo-out'),\n\t'linear': require('./linear'),\n\t'quadInOut': require('./quad-in-out'),\n\t'quadIn': require('./quad-in'),\n\t'quadOut': require('./quad-out'),\n\t'quartInOut': require('./quart-in-out'),\n\t'quartIn': require('./quart-in'),\n\t'quartOut': require('./quart-out'),\n\t'quintInOut': require('./quint-in-out'),\n\t'quintIn': require('./quint-in'),\n\t'quintOut': require('./quint-out'),\n\t'sineInOut': require('./sine-in-out'),\n\t'sineIn': require('./sine-in'),\n\t'sineOut': require('./sine-out')\n}","/**\n * Buttery - scroll animation library\n * Performance focused, lightweight scroll animation library\n *\n * A fork of basicScroll.js by Tobias Reich (@electerious)\n * Created and maintained by Mark Croxton (@croxton)\n *\n * - Uses native scroll-driven animations (ScrollTimeline + Web Animations) when supported,\n * so values update in sync with scrolling without per-frame JavaScript.\n * - Falls back to an event-driven requestAnimationFrame loop otherwise.\n * - Instances with `inside`/`outside` callbacks use the fallback by default (callbacks need JS per frame).\n * - Clamps scrollTop to avoid rubber-band (overscroll) bounce affecting animations\n * - Uses a stable viewport height that doesn't change when the iOS toolbar collapses/expands\n * - Ignores height-only resize events (iOS address bar show/hide) for recalculation\n * - Skips redundant style writes\n */\n\nimport parseUnit from 'parse-unit'\nimport eases from 'eases'\n\nlet instances = []\nlet frameId = null\nlet pendingForce = false\nlet init = false\nlet previousScrollTop = null\nlet maxScrollTop = null\nlet viewportHeight = null\nlet viewportWidth = null\nlet listeners = null\nlet resizeObserver = null\nlet timelineFrameId = null\nlet lastTimelineMax = null\nlet scrollTimeline = null\nlet timelineSupport = null\nlet settings = {\n recalculateOnResize: false,\n timeline: true\n}\n\n// Number of samples used to approximate non-linear easing in timeline keyframes\nconst TIMELINE_SAMPLES = 30\n\n// Last applied style values per instance, used to avoid redundant writes\nconst styleCache = new WeakMap()\n\n// Custom properties registered by this library: name => syntax (null = registered elsewhere)\nconst registeredProperties = new Map()\n\n/**\n * Debounces a function that will be triggered many times.\n * @param {Function} fn\n * @param {Number} duration\n * @returns {Function}\n */\nconst debounce = function(fn, duration) {\n\n let timeout = null\n\n const debounced = (...args) => {\n clearTimeout(timeout)\n timeout = setTimeout(() => fn(...args), duration)\n }\n\n debounced.cancel = () => clearTimeout(timeout)\n\n return debounced\n\n}\n\n/**\n * Returns all active instances that are driven by the JS loop.\n * @param {Array} instances\n * @returns {Array} instances\n */\nconst getLoopInstances = function(instances) {\n\n return instances.filter((instance) => instance != null && instance.isActive() && instance.usesTimeline() === false)\n\n}\n\n/**\n * Returns all tracked instances from an array.\n * @param {Array} instances\n * @returns {Array} instances - Tracked instances.\n */\nconst getTrackedInstances = function(instances) {\n\n return instances.filter((instance) => instance != null && instance.getData().track)\n\n}\n\n/**\n * Checks if native scroll-driven animations can be used.\n * @returns {Boolean}\n */\nexport const supportsTimeline = function() {\n\n if (timelineSupport == null) {\n timelineSupport = typeof window !== 'undefined'\n && typeof window.ScrollTimeline === 'function'\n && typeof window.Animation === 'function'\n && typeof window.KeyframeEffect === 'function'\n && window.CSS != null\n && typeof window.CSS.registerProperty === 'function'\n }\n\n return timelineSupport\n\n}\n\n/**\n * Returns the scrolling element.\n * @returns {Element}\n */\nconst getScrollingElement = function() {\n\n return document.scrollingElement || document.documentElement\n\n}\n\n/**\n * Returns the shared document scroll timeline.\n * @returns {ScrollTimeline}\n */\nconst getScrollTimeline = function() {\n\n if (scrollTimeline == null) {\n scrollTimeline = new ScrollTimeline({\n source: getScrollingElement(),\n axis: 'block'\n })\n }\n\n return scrollTimeline\n\n}\n\n/**\n * Returns the raw number of scrolled pixels.\n * Can be negative or exceed the max scroll position during iOS rubber-band overscroll.\n * Use this for measuring element positions (it stays consistent with getBoundingClientRect).\n * @returns {Number} scrollTop\n */\nconst getRawScrollTop = function() {\n\n return getScrollingElement().scrollTop\n\n}\n\n/**\n * Returns the maximum scrollable distance.\n * @returns {Number}\n */\nconst getMaxScrollTop = function() {\n\n const elem = getScrollingElement()\n\n return Math.max(0, elem.scrollHeight - elem.clientHeight)\n\n}\n\n/**\n * Returns the number of scrolled pixels, clamped to the scrollable range.\n * This prevents iOS rubber-band overscroll from making animations bounce.\n * @returns {Number} scrollTop\n */\nconst getScrollTop = function() {\n\n const scrollTop = getRawScrollTop()\n\n if (scrollTop <= 0) return 0\n\n // Only re-read the (layout dependent) max when it might be stale\n if (maxScrollTop == null || scrollTop > maxScrollTop) maxScrollTop = getMaxScrollTop()\n\n return Math.min(scrollTop, maxScrollTop)\n\n}\n\n/**\n * Returns a stable height of the viewport.\n * documentElement.clientHeight doesn't change when the iOS Safari toolbar\n * collapses/expands, unlike window.innerHeight, so calculated positions stay put.\n * @returns {Number} viewportHeight\n */\nconst getViewportHeight = function() {\n\n if (viewportHeight == null) {\n viewportHeight = document.documentElement.clientHeight || window.innerHeight || window.outerHeight\n }\n\n return viewportHeight\n\n}\n\n/**\n * Returns the width of the viewport.\n * @returns {Number} viewportWidth\n */\nconst getViewportWidth = function() {\n\n return document.documentElement.clientWidth || window.innerWidth\n\n}\n\n/**\n * Checks if a value is absolute.\n * An absolute value must have a value that's not NaN.\n * @param {String|Integer} value\n * @returns {Boolean} isAbsolute\n */\nconst isAbsoluteValue = function(value) {\n\n return isNaN(parseUnit(value)[0]) === false\n\n}\n\n/**\n * Parses an absolute value.\n * @param {String|Integer} value\n * @returns {Object} value - Parsed value.\n */\nconst parseAbsoluteValue = function(value) {\n\n const parsedValue = parseUnit(value)\n\n return {\n value: parsedValue[0],\n unit: parsedValue[1]\n }\n\n}\n\n/**\n * Checks if a value is relative.\n * A relative value must start and end with [a-z] and needs a '-' in the middle.\n * @param {String|Integer} value\n * @returns {Boolean} isRelative\n */\nconst isRelativeValue = function(value) {\n\n return String(value).match(/^[a-z0-9%]+-[a-z0-9%]+$/) !== null\n\n}\n\n/**\n * Returns the property that should be used according to direct.\n * @param {Boolean|Node} direct\n * @param {Object} properties\n * @returns {*}\n */\nconst mapDirectToProperty = function(direct, properties) {\n\n if (direct === true) return properties.elem\n if (direct instanceof HTMLElement) return properties.direct\n\n return properties.global\n\n}\n\n/**\n * Returns the element styles should be applied to.\n * @param {Object} data\n * @returns {?Element}\n */\nconst getElem = function(data) {\n\n return mapDirectToProperty(data.direct, {\n global: document.documentElement,\n elem: data.elem,\n direct: data.direct\n })\n\n}\n\n/**\n * Converts a relative value to an absolute value.\n * @param {String} value\n * @param {Node} elem - Anchor of the relative value.\n * @param {?Integer} scrollTop - Pixels scrolled in document (raw, unclamped).\n * @param {?Integer} vh - Height of the viewport.\n * @returns {String} value - Absolute value.\n */\nconst relativeToAbsoluteValue = function(value, elem, scrollTop = getRawScrollTop(), vh = getViewportHeight()) {\n\n const elemSize = elem.getBoundingClientRect()\n\n const elemAnchor = value.match(/^[a-z0-9%]+/)[0]\n const viewportAnchor = value.match(/[a-z0-9%]+$/)[0]\n\n // Absolute document position of the element\n const elemTop = elemSize.top + scrollTop\n\n let y = 0\n\n if (viewportAnchor.match(/%$/) !== null) {\n const percent = parseFloat(viewportAnchor.replace('%', '')) / 100\n y -= vh * percent\n } else {\n if (viewportAnchor === 'top') y -= 0\n if (viewportAnchor === 'middle') y -= vh / 2\n if (viewportAnchor === 'bottom') y -= vh\n }\n\n if (elemAnchor.match(/%$/) !== null) {\n const percent = parseFloat(elemAnchor.replace('%', '')) / 100\n y += elemTop + elemSize.height * percent\n } else {\n if (elemAnchor === 'top') y += elemTop\n if (elemAnchor === 'middle') y += elemTop + elemSize.height / 2\n if (elemAnchor === 'bottom') y += elemTop + elemSize.height\n }\n\n return `${ y }px`\n\n}\n\n/**\n * Validates data and sets defaults for undefined properties.\n * @param {?Object} data\n * @returns {Object} data - Validated data.\n */\nconst validate = function(data = {}) {\n\n // Copy root object to avoid changes by reference\n data = Object.assign({}, data)\n\n // Remember if callbacks were provided, before defaults are applied\n data.hasCallbacks = data.inside != null || data.outside != null\n\n if (data.inside == null) data.inside = () => {}\n if (data.outside == null) data.outside = () => {}\n if (data.direct == null) data.direct = false\n if (data.track == null) data.track = true\n if (data.props == null) data.props = {}\n if (data.timeline == null) data.timeline = 'auto'\n\n if (data.from == null) throw new Error('Missing property `from`')\n if (data.to == null) throw new Error('Missing property `to`')\n if (typeof data.inside !== 'function') throw new Error('Property `inside` must be undefined or a function')\n if (typeof data.outside !== 'function') throw new Error('Property `outside` must be undefined or a function')\n if (typeof data.direct !== 'boolean' && !(data.direct instanceof HTMLElement)) throw new Error('Property `direct` must be undefined, a boolean or a DOM element/node')\n if (data.direct === true && data.elem == null) throw new Error('Property `elem` is required when `direct` is true')\n if (typeof data.track !== 'boolean') throw new Error('Property `track` must be undefined or a boolean')\n if (typeof data.props !== 'object') throw new Error('Property `props` must be undefined or an object')\n if (data.timeline !== 'auto' && typeof data.timeline !== 'boolean') throw new Error('Property `timeline` must be undefined, a boolean or \\'auto\\'')\n\n if (data.elem == null) {\n\n if (isAbsoluteValue(data.from) === false) throw new Error('Property `from` must be a absolute value when no `elem` has been provided')\n if (isAbsoluteValue(data.to) === false) throw new Error('Property `to` must be a absolute value when no `elem` has been provided')\n\n } else {\n\n if (isRelativeValue(data.from) === true) data.from = relativeToAbsoluteValue(data.from, data.elem)\n if (isRelativeValue(data.to) === true) data.to = relativeToAbsoluteValue(data.to, data.elem)\n\n }\n\n data.from = parseAbsoluteValue(data.from)\n data.to = parseAbsoluteValue(data.to)\n\n // Create a new props object to avoid changes by reference\n data.props = Object.keys(data.props).reduce((acc, key) => {\n\n // Copy prop object to avoid changes by reference\n const prop = Object.assign({}, data.props[key])\n\n if (isAbsoluteValue(prop.from) === false) throw new Error('Property `from` of prop must be a absolute value')\n if (isAbsoluteValue(prop.to) === false) throw new Error('Property `to` of prop must be a absolute value')\n if (prop.via != null && isAbsoluteValue(prop.via) === false) throw new Error('Property `via` of prop must be a absolute value')\n\n prop.from = parseAbsoluteValue(prop.from)\n prop.to = parseAbsoluteValue(prop.to)\n if (prop.via != null) prop.via = parseAbsoluteValue(prop.via)\n\n if (prop.timing == null) prop.timing = eases['linear']\n\n if (typeof prop.timing !== 'string' && typeof prop.timing !== 'function') throw new Error('Property `timing` of prop must be undefined, a string or a function')\n\n if (typeof prop.timing === 'string' && eases[prop.timing] == null) throw new Error('Unknown timing for property `timing` of prop')\n if (typeof prop.timing === 'string') prop.timing = eases[prop.timing]\n\n acc[key] = prop\n\n return acc\n\n }, {})\n\n return data\n\n}\n\n/**\n * Calculates prop values for a given scroll position. Pure: no callbacks, no DOM writes.\n * @param {Object} data - Validated data.\n * @param {Number} scrollTop - Pixels scrolled in document (clamped).\n * @returns {Object} precisePercentage and props\n */\nconst computeProps = function(data, scrollTop) {\n\n // 100% in pixel\n const total = data.to.value - data.from.value\n\n // Pixel scrolled\n const current = scrollTop - data.from.value\n\n // Percent scrolled (guard against division by zero)\n const precisePercentage = total === 0\n ? (current >= 0 ? 100 : 0)\n : current / (total / 100)\n const normalizedPercentage = Math.min(Math.max(precisePercentage, 0), 100)\n\n // All easing functions only remap a time value, and all have the same signature.\n const normalizedTime = normalizedPercentage / 100\n\n const props = {}\n\n for (const key of Object.keys(data.props)) {\n\n const prop = data.props[key]\n\n // Use the unit of from OR to. It's valid to animate from '0' to '100px' and\n // '0' should be treated as 'px', too. Unit will be an empty string when no unit given.\n const unit = prop.from.unit || prop.to.unit\n\n const time = prop.timing(normalizedTime)\n\n let value\n\n if (prop.via != null) {\n const midpoint = 0.5\n\n if (time <= midpoint) {\n const localTime = time / midpoint\n const diff = prop.from.value - prop.via.value\n\n value = prop.from.value - diff * localTime\n } else {\n const localTime = (time - midpoint) / midpoint\n const diff = prop.via.value - prop.to.value\n\n value = prop.via.value - diff * localTime\n }\n } else {\n const diff = prop.from.value - prop.to.value\n\n value = prop.from.value - diff * time\n }\n\n // Round to avoid unprecise values.\n const rounded = Math.round(value * 10000) / 10000\n\n props[key] = rounded + unit\n\n }\n\n return {\n precisePercentage,\n props\n }\n\n}\n\n/**\n * Calculates the props of an instance and executes its callbacks.\n * @param {Object} instance\n * @param {?Integer} scrollTop - Pixels scrolled in document (clamped).\n * @returns {Object} Calculated props and the element to apply styles to.\n */\nconst getProps = function(instance, scrollTop = getScrollTop()) {\n\n const data = instance.getData()\n\n const { precisePercentage, props } = computeProps(data, scrollTop)\n\n // Use precise percentage to check if the viewport is between from and to.\n const isInside = (precisePercentage >= 0 && precisePercentage <= 100)\n\n // Execute callbacks\n if (isInside === true) data.inside(instance, precisePercentage, props)\n else data.outside(instance, precisePercentage, props)\n\n return {\n elem: getElem(data),\n props\n }\n\n}\n\n/**\n * Adds properties to a given style object, skipping values that haven't changed.\n * @param {Node} elem - Styles will be applied to this element.\n * @param {Object} props - Object of props.\n * @param {?Object} cache - Last applied values.\n */\nconst setProps = function(elem, props, cache = null) {\n\n if (elem == null) return\n\n for (const key in props) {\n\n const value = props[key]\n\n if (cache != null) {\n if (cache[key] === value) continue\n cache[key] = value\n }\n\n elem.style.setProperty(key, value)\n\n }\n\n}\n\n/**\n * Returns the style cache of an instance.\n * @param {Object} instance\n * @returns {Object}\n */\nconst getStyleCache = function(instance) {\n\n let cache = styleCache.get(instance)\n\n if (cache == null) {\n cache = {}\n styleCache.set(instance, cache)\n }\n\n return cache\n\n}\n\n/**\n * Returns a subset of props.\n * @param {Object} props\n * @param {Array} keys\n * @returns {Object}\n */\nconst pickProps = function(props, keys) {\n\n return keys.reduce((acc, key) => {\n acc[key] = props[key]\n return acc\n }, {})\n\n}\n\n/**\n * Returns the keys of props whose value actually changes while scrolling.\n * @param {Object} data\n * @returns {Array}\n */\nconst getAnimatedKeys = function(data) {\n\n return Object.keys(data.props).filter((key) => {\n\n const prop = data.props[key]\n const isConstant = prop.from.value === prop.to.value && (prop.via == null || prop.via.value === prop.from.value)\n\n return isConstant === false\n\n })\n\n}\n\n/**\n * Returns the CSS syntax and initial value to register a custom property with.\n * @param {String} unit\n * @returns {Object}\n */\nconst getSyntaxForUnit = function(unit) {\n\n if (unit === '') return { syntax: '<number>', initialValue: '0' }\n if (['deg', 'grad', 'rad', 'turn'].includes(unit)) return { syntax: '<angle>', initialValue: '0deg' }\n if (['s', 'ms'].includes(unit)) return { syntax: '<time>', initialValue: '0s' }\n\n return { syntax: '<length-percentage>', initialValue: '0px' }\n\n}\n\n/**\n * Registers a custom property so it can be interpolated by the animation engine.\n * @param {String} name\n * @param {String} unit\n * @returns {Boolean} Whether the property can be animated smoothly.\n */\nconst registerCustomProperty = function(name, unit) {\n\n const { syntax, initialValue } = getSyntaxForUnit(unit)\n\n if (registeredProperties.has(name)) {\n const existing = registeredProperties.get(name)\n\n // null = registered elsewhere (e.g. @property in CSS), trust it\n return existing === null || existing === syntax\n }\n\n try {\n CSS.registerProperty({ name, syntax, inherits: true, initialValue })\n registeredProperties.set(name, syntax)\n return true\n } catch (error) {\n if (error != null && error.name === 'InvalidModificationError') {\n // Already registered, e.g. with @property in CSS\n registeredProperties.set(name, null)\n return true\n }\n return false\n }\n\n}\n\n/**\n * Converts a CSS property name to a keyframe key.\n * @param {String} key\n * @returns {String}\n */\nconst toKeyframeKey = function(key) {\n\n if (key.startsWith('--')) return key\n\n return key.replace(/-([a-z])/g, (match, char) => char.toUpperCase())\n\n}\n\n/**\n * Checks if an instance can use a native scroll timeline.\n * @param {Object} data\n * @param {Array} animatedKeys\n * @returns {Boolean}\n */\nconst canUseTimeline = function(data, animatedKeys) {\n\n if (settings.timeline === false) return false\n if (data.timeline === false) return false\n\n // Callbacks need to run per frame, which requires the JS loop\n if (data.timeline === 'auto' && data.hasCallbacks === true) return false\n\n if (supportsTimeline() === false) return false\n\n return animatedKeys.every((key) => {\n if (key.startsWith('--') === false) return true\n\n const prop = data.props[key]\n\n return registerCustomProperty(key, prop.from.unit || prop.to.unit)\n })\n\n}\n\n/**\n * Builds keyframes mapped onto the document scroll range (0 → max).\n * Easing and `via` are sampled so the result matches the JS calculation.\n * @param {Object} data\n * @param {Array} keys - Animated prop keys.\n * @param {Number} max - Max scroll distance.\n * @returns {Array} keyframes\n */\nconst buildKeyframes = function(data, keys, max) {\n\n const from = data.from.value\n const to = data.to.value\n\n const isLinear = keys.every((key) => data.props[key].timing === eases['linear'])\n const hasVia = keys.some((key) => data.props[key].via != null)\n const segments = isLinear ? (hasVia ? 2 : 1) : TIMELINE_SAMPLES\n\n const positions = [0, max]\n\n for (let i = 0; i <= segments; i++) {\n positions.push(from + (to - from) * (i / segments))\n }\n\n // Keyframe offsets must be within 0–1, values outside the scroll range are\n // represented by the exact values at the start/end of the scroll range.\n const uniquePositions = [...new Set(positions.filter((position) => position >= 0 && position <= max))]\n .sort((a, b) => a - b)\n\n return uniquePositions.map((position) => {\n\n const { props } = computeProps(data, position)\n const keyframe = { offset: position / max }\n\n for (const key of keys) {\n keyframe[toKeyframeKey(key)] = props[key]\n }\n\n return keyframe\n\n })\n\n}\n\n/**\n * Gets and sets new props of all active loop instances.\n * Runs inside requestAnimationFrame. Make sure it's performant as hell.\n * @param {Boolean} force - Update even when scrollTop hasn't changed.\n */\nconst update = function(force = false) {\n\n const loopInstances = getLoopInstances(instances)\n\n // Only continue when active instances available\n if (loopInstances.length === 0) return\n\n // Read phase\n const scrollTop = getScrollTop()\n\n // Only continue when scrollTop has changed\n if (force === false && previousScrollTop === scrollTop) return\n previousScrollTop = scrollTop\n\n // Calculate everything first, then write, to avoid layout thrashing\n const results = loopInstances.map((instance) => ({\n instance,\n ...getProps(instance, scrollTop)\n }))\n\n // Write phase\n for (const { instance, elem, props } of results) {\n setProps(elem, props, getStyleCache(instance))\n }\n\n}\n\n/**\n * Schedules an update for the next animation frame.\n * Multiple calls within the same frame are batched.\n * @param {Boolean} force\n */\nconst requestUpdate = function(force = false) {\n\n if (init === false) return\n\n pendingForce = pendingForce || force\n\n if (frameId != null) return\n\n frameId = requestAnimationFrame(() => {\n\n const shouldForce = pendingForce\n\n frameId = null\n pendingForce = false\n\n update(shouldForce)\n\n })\n\n}\n\n/**\n * Schedules a keyframe refresh of timeline instances when the scroll range changes.\n */\nconst requestTimelineRefresh = function() {\n\n if (timelineFrameId != null) return\n\n timelineFrameId = requestAnimationFrame(() => {\n\n timelineFrameId = null\n maxScrollTop = null\n\n const max = getMaxScrollTop()\n\n if (max === lastTimelineMax) return\n lastTimelineMax = max\n\n for (const instance of instances) {\n if (instance != null && instance.usesTimeline()) instance.syncTimeline()\n }\n\n })\n\n}\n\n/**\n * Recalculates all tracked instances (e.g. after a layout change).\n */\nconst recalculateAll = function() {\n\n getTrackedInstances(instances).forEach((instance) => instance.calculate())\n\n}\n\n/**\n * Handles resize events.\n * Height-only changes (iOS Safari toolbar collapsing/expanding) don't trigger\n * a recalculation, so animations don't jump while scrolling.\n */\nconst handleResize = debounce(() => {\n\n const width = getViewportWidth()\n\n // The scrollable distance might have changed in any case\n maxScrollTop = null\n requestTimelineRefresh()\n\n if (width === viewportWidth) return\n\n // A real resize (width change / orientation change)\n viewportWidth = width\n viewportHeight = null\n\n if (settings.recalculateOnResize === true) recalculateAll()\n\n requestUpdate(true)\n\n}, 150)\n\n/**\n * Creates a new instance.\n * @param {Object} data\n * @returns {Object} instance\n */\nexport const create = function(data) {\n\n // Store the parsed data\n let _data = null\n\n // Store if instance is started or stopped\n let active = false\n\n // Native scroll-driven animation state\n let timelineMode = false\n let animatedKeys = []\n let animation = null\n let animationTarget = null\n\n // Returns if instance is started or stopped\n const _isActive = () => {\n\n return active\n\n }\n\n // Returns the parsed and calculated data\n const _getData = function() {\n\n return _data\n\n }\n\n // Returns if the instance is driven by a native scroll timeline\n const _usesTimeline = () => {\n\n return timelineMode\n\n }\n\n // Cancels the native animation\n const _cancelAnimation = () => {\n\n if (animation != null) {\n animation.cancel()\n animation = null\n animationTarget = null\n }\n\n }\n\n // Falls back to the JS loop\n const _fallback = () => {\n\n _cancelAnimation()\n timelineMode = false\n styleCache.delete(instance)\n\n if (active) requestUpdate(true)\n\n }\n\n // Creates or refreshes the native animation\n const _syncTimeline = () => {\n\n if (timelineMode === false) return\n\n const elem = getElem(_data)\n\n if (elem == null) return\n\n const cache = getStyleCache(instance)\n const { props } = computeProps(_data, getScrollTop())\n\n // Props that never change are simply set once\n const staticKeys = Object.keys(props).filter((key) => animatedKeys.includes(key) === false)\n setProps(elem, pickProps(props, staticKeys), cache)\n\n // Not started yet: create the animation on start()\n if (active === false && animation == null) return\n\n const max = getMaxScrollTop()\n\n // Nothing to animate, or the page can't scroll\n if (animatedKeys.length === 0 || max <= 0) {\n _cancelAnimation()\n setProps(elem, pickProps(props, animatedKeys), cache)\n return\n }\n\n const keyframes = buildKeyframes(_data, animatedKeys, max)\n\n try {\n\n if (animation != null && animationTarget === elem) {\n animation.effect.setKeyframes(keyframes)\n } else {\n _cancelAnimation()\n\n const effect = new KeyframeEffect(elem, keyframes, {\n fill: 'both',\n easing: 'linear'\n })\n\n animation = new Animation(effect, getScrollTimeline())\n animationTarget = elem\n }\n\n if (active) {\n if (animation.playState !== 'running') animation.play()\n } else {\n animation.pause()\n }\n\n } catch (error) {\n // Something isn't supported after all, use the JS loop instead\n _fallback()\n }\n\n }\n\n // Parses and calculates data\n const _calculate = function() {\n\n // Refresh cached measurements, as layout may have changed\n viewportHeight = null\n maxScrollTop = null\n\n _data = validate(data)\n\n // Styles may have been reset externally, so don't trust the cache\n styleCache.delete(instance)\n\n animatedKeys = getAnimatedKeys(_data)\n timelineMode = canUseTimeline(_data, animatedKeys)\n\n if (timelineMode) _syncTimeline()\n else _cancelAnimation()\n\n }\n\n // Update props\n const _update = () => {\n\n if (timelineMode) {\n\n // The native animation applies the styles, just refresh it\n _syncTimeline()\n\n // Still return props (and run callbacks) for consumers relying on it\n const { props } = getProps(instance)\n\n return props\n\n }\n\n // Get new props\n const { elem, props } = getProps(instance)\n\n // Set new props\n setProps(elem, props, getStyleCache(instance))\n\n return props\n\n }\n\n // Starts to animate\n const _start = () => {\n\n active = true\n\n if (timelineMode) _syncTimeline()\n else requestUpdate(true)\n\n }\n\n // Stops to animate\n const _stop = () => {\n\n active = false\n\n // Freeze the native animation at its current state\n if (animation != null) animation.pause()\n\n }\n\n // Destroys the instance\n const _destroy = () => {\n\n _cancelAnimation()\n\n // Replace instance instead of deleting the item to avoid\n // that the index of other instances changes.\n instances[index] = undefined\n styleCache.delete(instance)\n\n }\n\n // Assign instance to a variable so the instance can be used\n // elsewhere in the current function.\n const instance = {\n isActive: _isActive,\n getData: _getData,\n usesTimeline: _usesTimeline,\n syncTimeline: _syncTimeline,\n calculate: _calculate,\n update: _update,\n start: _start,\n stop: _stop,\n destroy: _destroy\n }\n\n // Store instance in global array and save the index\n const index = instances.push(instance) - 1\n\n // Calculate data for the first time\n instance.calculate()\n\n return instance\n\n}\n\n/**\n * Starts listening for scroll changes.\n * @param {?Object} options\n * @param {?Boolean} options.recalculateOnResize - Recalculate tracked instances when the viewport width changes.\n * @param {?Boolean} options.timeline - Allow native scroll-driven animations (default true).\n */\nexport const mount = function(options = {}) {\n\n // Guard against multiple calls\n if (init) {\n return\n }\n init = true\n\n settings = Object.assign({}, settings, options)\n\n viewportWidth = getViewportWidth()\n viewportHeight = null\n maxScrollTop = null\n previousScrollTop = null\n lastTimelineMax = null\n\n const onScroll = () => requestUpdate(false)\n const onPageShow = () => {\n // Restored from bfcache: positions may be stale\n maxScrollTop = null\n lastTimelineMax = null\n requestTimelineRefresh()\n requestUpdate(true)\n }\n\n listeners = { onScroll, onPageShow }\n\n window.addEventListener('scroll', onScroll, { passive: true })\n window.addEventListener('resize', handleResize, { passive: true })\n window.addEventListener('orientationchange', handleResize, { passive: true })\n window.addEventListener('pageshow', onPageShow)\n\n // React to document height changes (lazy images etc.)\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(() => {\n maxScrollTop = null\n requestTimelineRefresh()\n })\n resizeObserver.observe(document.documentElement)\n }\n\n // Initial update\n requestUpdate(true)\n\n}\n\n/**\n * Stops listening and cleans up instances that are no longer in the DOM.\n */\nexport const unmount = function() {\n\n if (init === false) {\n return\n }\n\n let instancesInDom = false\n\n for (const instance of instances) {\n // Check element is still in DOM\n if (instance == null) continue\n\n const elem = instance.getData().elem\n\n if (elem == null || document.body.contains(elem) === false) {\n // Destroy instance\n instance.destroy()\n } else {\n instancesInDom = true\n }\n }\n\n // Do we have instances left (have all running instances been destroyed)?\n // If so, it's safe to reset the instances array\n if (instancesInDom === false) {\n instances = []\n }\n\n if (listeners != null) {\n window.removeEventListener('scroll', listeners.onScroll)\n window.removeEventListener('resize', handleResize)\n window.removeEventListener('orientationchange', handleResize)\n window.removeEventListener('pageshow', listeners.onPageShow)\n listeners = null\n }\n\n handleResize.cancel()\n\n if (resizeObserver != null) {\n resizeObserver.disconnect()\n resizeObserver = null\n }\n\n if (frameId != null) {\n cancelAnimationFrame(frameId)\n frameId = null\n }\n\n if (timelineFrameId != null) {\n cancelAnimationFrame(timelineFrameId)\n timelineFrameId = null\n }\n\n pendingForce = false\n previousScrollTop = null\n lastTimelineMax = null\n init = false\n\n}"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"mappings":"A,oqBAAA,EAAO,QAAU,SAAmB,EAAK,EAAK,CAQ1C,MAPA,CACI0B,IAAM,CAAE,EAAG,EAAG,EAElB,EAAM,OAAOC,CAAG,EAEhB,EAAI,GADM,WAAWA,EAAK,EACf,EACX,EAAI,GAAKA,EAAI,MAAM,mBAAmB,CAAC,CAAC,IAAM,GACvCD,CACX,C,iBCTA,SAASG,EAAU,EAAG,CACpB,IAAIC,EAAI,UAGR,OAFK,GAAK,GAAK,EACN,IAAOC,EAAIA,IAAMD,EAAI,GAAKC,EAAID,IAChC,KAAQ,GAAK,GAAKC,IAAMD,EAAI,GAAKC,EAAID,GAAK,EACnD,CAEA,EAAO,QAAUD,C,iBCPjB,SAASI,EAAO,EAAG,CACjB,IAAIH,EAAI,QACR,OAAOC,EAAIA,IAAMD,EAAI,GAAKC,EAAID,EAChC,CAEA,EAAO,QAAUG,C,iBCLjB,SAASE,EAAQ,EAAG,CAClB,IAAIL,EAAI,QACR,MAAO,EAAEC,EAAIA,IAAMD,EAAI,GAAKC,EAAID,GAAK,CACvC,CAEA,EAAO,QAAUK,C,iBCLjB,SAASE,EAAU,EAAG,CACpB,IAAIC,EAAI,EAAM,GACVC,EAAI,EAAM,GACVC,EAAI,EAAM,GAEVC,EAAK,KAAS,IACd9B,EAAK,MAAU,KACf+B,EAAK,MAAU,KAEfC,EAAKZ,EAAIA,EAEb,OAAOA,EAAIO,EACP,OAASK,EACTZ,EAAIQ,EACF,MAAQI,EAAK,IAAMZ,EAAI,IACvBA,EAAIS,EACFC,EAAKE,EAAKhC,EAAKoB,EAAIW,EACnB,KAAOX,EAAIA,EAAI,MAAQA,EAAI,KACrC,CAEA,EAAO,QAAUM,C,kBCpBjB,IAAIA,EAAAD,EAAA,EAEJ,SAASS,EAAY,E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