Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-scroll-parallax

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-scroll-parallax - npm Package Compare versions

Comparing version 3.0.0-alpha.13 to 3.0.0-alpha.14

4

dist/components/Parallax/types.d.ts

@@ -148,2 +148,6 @@ import { RootMarginShape, ValidEasingPresets } from 'parallax-controller';

/**
* Will start the animation at initial element position if the element is positioned inside the view when scroll is at zero
*/
shouldStartAnimationInitialInView?: boolean;
/**
* Optionally pass additional class names to be added to the outermost parallax element.

@@ -150,0 +154,0 @@ */

@@ -86,2 +86,3 @@ 'use strict';

rootMargin: props.rootMargin,
shouldStartAnimationInitialInView: props.shouldStartAnimationInitialInView,
onProgressChange: props.onProgressChange,

@@ -88,0 +89,0 @@ onEnter: props.onEnter,

2

dist/react-scroll-parallax.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,a=require("parallax-controller"),n=r.createContext(null);function o(){var e=t.useContext(n);if("undefined"==typeof window)return null;if(!e)throw new Error("Could not find `react-scroll-parallax` context value. Please ensure the component is wrapped in a <ParallaxProvider>");return e}function l(e){var n=o(),l=t.useRef(),s=t.useRef();function i(){var t,r=void 0!==e.speed,a=e.translateX,o=e.translateY;return r&&"horizontal"==(null==n?void 0:n.scrollAxis)&&(a=[10*(e.speed||0)+"px",-10*(e.speed||0)+"px"]),r&&"vertical"==(null==n?void 0:n.scrollAxis)&&(o=[10*(e.speed||0)+"px",-10*(e.speed||0)+"px"]),{elInner:l.current,elOuter:s.current,props:(t={disabled:e.disabled,translateX:a,translateY:o,rotate:e.rotate,rotateX:e.rotateX,rotateY:e.rotateY,rotateZ:e.rotateZ,scale:e.scale,scaleX:e.scaleX,scaleY:e.scaleY,scaleZ:e.scaleZ,opacity:e.opacity,easing:e.easing,rootMargin:e.rootMargin,onProgressChange:e.onProgressChange,onEnter:e.onEnter,onExit:e.onExit},Object.keys(t).forEach((function(e){return void 0===t[e]?delete t[e]:{}})),t)}}!function(e){t.useEffect((function(){if(!("undefined"==typeof window||e||e instanceof a.ParallaxController))throw new Error("Must wrap your application's <Parallax /> components in a <ParallaxProvider />.")}),[e])}(n);var c=t.useState(),u=c[0],p=c[1];return t.useEffect((function(){var e=null==n?void 0:n.createElement(i());return p(e),function(){e&&(null==n||n.removeElementById(e.id))}}),[]),t.useEffect((function(){u&&(e.disabled?null==n||n.resetElementStyles(u):null==n||n.updateElementPropsById(u.id,i().props))}),[e.disabled,e.translateX,e.translateY,e.rotate,e.rotateX,e.rotateY,e.rotateZ,e.scale,e.scaleX,e.scaleY,e.scaleZ,e.speed,e.opacity,e.easing,e.rootMargin,e.onProgressChange,e.onEnter,e.onExit]),r.createElement(e.tagOuter,{className:"parallax-outer"+(e.className?" "+e.className:""),ref:s,style:e.styleOuter},r.createElement(e.tagInner,{className:"parallax-inner",ref:l,style:e.styleInner},e.children))}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l.defaultProps={disabled:!1,tagInner:"div",tagOuter:"div"};var c={position:"relative",overflow:"hidden",width:"100%",height:"50vh"},u={position:"absolute",top:0,right:0,bottom:0,left:0},p=function(e){var t=e.children,a=e.className,n=e.layers,o=e.disabled;return r.createElement("div",{style:s({},c,e.style),className:"parallax-banner"+(a?" "+a:"")},n.map((function(e,t){var a=e.speed,n=e.children,i=e.expanded,c=void 0===i||i,p=e.image,d=e.props,f=void 0===d?{}:d,v=f.style||{},x=f.className||"";delete f.style,delete f.className;var y="parallax-banner-layer-"+t+(x?" "+x:""),h=c?{top:10*Math.abs(a)*-1+"px",bottom:10*Math.abs(a)*-1+"px"}:{};return r.createElement(l,{key:"layer-"+t,speed:a,styleInner:u,styleOuter:u,disabled:o},r.createElement("div",Object.assign({className:y,style:s({},p?{backgroundImage:"url("+p+")",backgroundPosition:"center",backgroundSize:"cover"}:{},u,h,v)},f),n))})),t)};p.defaultProps={disabled:!1};var d=function(e){var t,o;function l(t){var r;return(r=e.call(this,t)||this).controller="undefined"==typeof window?null:a.ParallaxController.init({scrollAxis:t.scrollAxis,scrollContainer:t.scrollContainer}),r}o=e,(t=l).prototype=Object.create(o.prototype),t.prototype.constructor=t,i(t,o);var s=l.prototype;return s.componentDidUpdate=function(e){e.scrollContainer!==this.props.scrollContainer&&this.controller.updateScrollContainer(this.props.scrollContainer)},s.componentWillUnmount=function(){this.controller=this.controller.destroy()},s.render=function(){return r.createElement(n.Provider,{value:this.controller},this.props.children)},l}(t.Component);d.defaultProps={scrollAxis:a.ScrollAxis.vertical},exports.Parallax=l,exports.ParallaxBanner=p,exports.ParallaxContext=n,exports.ParallaxProvider=d,exports.useController=o;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,a=require("parallax-controller"),n=r.createContext(null);function o(){var e=t.useContext(n);if("undefined"==typeof window)return null;if(!e)throw new Error("Could not find `react-scroll-parallax` context value. Please ensure the component is wrapped in a <ParallaxProvider>");return e}function l(e){var n=o(),l=t.useRef(),s=t.useRef();function i(){var t,r=void 0!==e.speed,a=e.translateX,o=e.translateY;return r&&"horizontal"==(null==n?void 0:n.scrollAxis)&&(a=[10*(e.speed||0)+"px",-10*(e.speed||0)+"px"]),r&&"vertical"==(null==n?void 0:n.scrollAxis)&&(o=[10*(e.speed||0)+"px",-10*(e.speed||0)+"px"]),{elInner:l.current,elOuter:s.current,props:(t={disabled:e.disabled,translateX:a,translateY:o,rotate:e.rotate,rotateX:e.rotateX,rotateY:e.rotateY,rotateZ:e.rotateZ,scale:e.scale,scaleX:e.scaleX,scaleY:e.scaleY,scaleZ:e.scaleZ,opacity:e.opacity,easing:e.easing,rootMargin:e.rootMargin,shouldStartAnimationInitialInView:e.shouldStartAnimationInitialInView,onProgressChange:e.onProgressChange,onEnter:e.onEnter,onExit:e.onExit},Object.keys(t).forEach((function(e){return void 0===t[e]?delete t[e]:{}})),t)}}!function(e){t.useEffect((function(){if(!("undefined"==typeof window||e||e instanceof a.ParallaxController))throw new Error("Must wrap your application's <Parallax /> components in a <ParallaxProvider />.")}),[e])}(n);var c=t.useState(),u=c[0],d=c[1];return t.useEffect((function(){var e=null==n?void 0:n.createElement(i());return d(e),function(){e&&(null==n||n.removeElementById(e.id))}}),[]),t.useEffect((function(){u&&(e.disabled?null==n||n.resetElementStyles(u):null==n||n.updateElementPropsById(u.id,i().props))}),[e.disabled,e.translateX,e.translateY,e.rotate,e.rotateX,e.rotateY,e.rotateZ,e.scale,e.scaleX,e.scaleY,e.scaleZ,e.speed,e.opacity,e.easing,e.rootMargin,e.onProgressChange,e.onEnter,e.onExit]),r.createElement(e.tagOuter,{className:"parallax-outer"+(e.className?" "+e.className:""),ref:s,style:e.styleOuter},r.createElement(e.tagInner,{className:"parallax-inner",ref:l,style:e.styleInner},e.children))}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l.defaultProps={disabled:!1,tagInner:"div",tagOuter:"div"};var c={position:"relative",overflow:"hidden",width:"100%",height:"50vh"},u={position:"absolute",top:0,right:0,bottom:0,left:0},d=function(e){var t=e.children,a=e.className,n=e.layers,o=e.disabled;return r.createElement("div",{style:s({},c,e.style),className:"parallax-banner"+(a?" "+a:"")},n.map((function(e,t){var a=e.speed,n=e.children,i=e.expanded,c=void 0===i||i,d=e.image,p=e.props,f=void 0===p?{}:p,v=f.style||{},x=f.className||"";delete f.style,delete f.className;var y="parallax-banner-layer-"+t+(x?" "+x:""),h=c?{top:10*Math.abs(a)*-1+"px",bottom:10*Math.abs(a)*-1+"px"}:{};return r.createElement(l,{key:"layer-"+t,speed:a,styleInner:u,styleOuter:u,disabled:o},r.createElement("div",Object.assign({className:y,style:s({},d?{backgroundImage:"url("+d+")",backgroundPosition:"center",backgroundSize:"cover"}:{},u,h,v)},f),n))})),t)};d.defaultProps={disabled:!1};var p=function(e){var t,o;function l(t){var r;return(r=e.call(this,t)||this).controller="undefined"==typeof window?null:a.ParallaxController.init({scrollAxis:t.scrollAxis,scrollContainer:t.scrollContainer}),r}o=e,(t=l).prototype=Object.create(o.prototype),t.prototype.constructor=t,i(t,o);var s=l.prototype;return s.componentDidUpdate=function(e){e.scrollContainer!==this.props.scrollContainer&&this.controller.updateScrollContainer(this.props.scrollContainer)},s.componentWillUnmount=function(){this.controller=this.controller.destroy()},s.render=function(){return r.createElement(n.Provider,{value:this.controller},this.props.children)},l}(t.Component);p.defaultProps={scrollAxis:a.ScrollAxis.vertical},exports.Parallax=l,exports.ParallaxBanner=d,exports.ParallaxContext=n,exports.ParallaxProvider=p,exports.useController=o;
//# sourceMappingURL=react-scroll-parallax.cjs.production.min.js.map

@@ -79,2 +79,3 @@ import React, { useContext, useEffect, useRef, useState, Component } from 'react';

rootMargin: props.rootMargin,
shouldStartAnimationInitialInView: props.shouldStartAnimationInitialInView,
onProgressChange: props.onProgressChange,

@@ -81,0 +82,0 @@ onEnter: props.onEnter,

{
"name": "react-scroll-parallax",
"version": "3.0.0-alpha.13",
"version": "3.0.0-alpha.14",
"description": "React components to create parallax scroll effects for banners, images or any other DOM elements.",

@@ -77,3 +77,3 @@ "repository": {

"dependencies": {
"parallax-controller": "^0.1.29"
"parallax-controller": "^0.1.30"
},

@@ -80,0 +80,0 @@ "devDependencies": {

@@ -151,2 +151,6 @@ import { RootMarginShape, ValidEasingPresets } from 'parallax-controller';

/**
* Will start the animation at initial element position if the element is positioned inside the view when scroll is at zero
*/
shouldStartAnimationInitialInView?: boolean;
/**
* Optionally pass additional class names to be added to the outermost parallax element.

@@ -153,0 +157,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc