-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathComponents.js.map
1 lines (1 loc) · 3.27 KB
/
Components.js.map
1
{"version":3,"sources":["src/Components.js"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;;;;;;;;;;;AAEO,IAAM,sCAAe,SAAf,YAAe,CAAC,SAAD;AAAA;AAAA;;AAC3B,0BAAe;AAAA;;AAAA;;AAEd,SAAK,KAAL,GAAa,EAAC,MAAM,IAAP,EAAb;AAFc;AAGd;;AAJ0B;AAAA;AAAA,uCAMN;AACpB,QAAI,KAAK,mBAAS,WAAT,CAAqB,IAArB,CAAT;AACA,SAAK,QAAL,CAAc;AACb,WAAM,gBAAS,MAAT,CAAgB,EAAhB,EAAoB,KAAK,KAAL,CAAW,eAA/B;AADO,KAAd;AAGA;AAX0B;AAAA;AAAA,4BAajB;AACT,WAAQ,8BAAC,SAAD,eAAe,KAAK,KAApB,IAA2B,cAAc,KAAK,KAAL,CAAW,IAApD,IAAR;AACA;AAf0B;;AAAA;AAAA,GAA0C,gBAAM,SAAhD;AAAA,CAArB;;IAkBM,Y,WAAA,Y;;;;;;;;;;;qCAEQ,Y,EAAc;AAAA;;AACjC,OAAI,KAAK,mBAAS,WAAT,CAAqB,IAArB,CAAT;AACA,OAAI,KAAK,KAAL,CAAW,KAAf,EAAsB;AACrB,iBAAa,GAAb,CAAiB,EAAjB,EAAqB,KAAK,KAAL,CAAW,KAAhC;AACA,IAFD,MAEO;AACN,QAAI,UAAU;AACb,YAAO,EADM;AAEb,UAAK,EAFQ;AAGb,aAAQ;AAHK,KAAd;AAKA,WAAO,IAAP,CAAY,KAAK,KAAjB,EAAwB,OAAxB,CAAgC,UAAC,IAAD,EAAU;AACzC,SAAI,WAAW,KAAK,KAAL,CAAW,GAAX,CAAf;AACA,SAAI,UAAU,SAAS,CAAT,CAAd;AACA,SAAI,WAAW,SAAS,CAAT,CAAf;;AAEA,aAAQ,OAAR;AACC,WAAK,OAAL;AACA,WAAK,KAAL;AACA,WAAK,QAAL;AACC,eAAQ,OAAR,IAAmB,QAAQ,OAAR,KAAoB,EAAvC;AACA,eAAQ,OAAR,EAAiB,QAAjB,IAA6B,OAAK,KAAL,CAAW,IAAX,CAA7B;AALF;AAOA,KAZD;AAaA,iBAAa,GAAb,CAAiB,EAAjB,EAAqB,OAArB;AACA;AACD;;;sCAEoB;AACpB,OAAI,KAAK,KAAL,CAAW,YAAf,EAA6B;AAC5B,SAAK,kBAAL,CAAwB,KAAK,KAAL,CAAW,YAAnC;AACA;AACD;;;4CAE0B,Q,EAAU;AACpC,OAAI,SAAS,YAAT,IAAyB,CAAC,KAAK,KAAL,CAAW,YAAzC,EAAuD;AACtD,SAAK,kBAAL,CAAwB,SAAS,YAAjC;AACA;AACD;;;2BAES;AACT,UAAQ;AAAA;AAAA,MAAK,WAAW,KAAK,KAAL,CAAW,SAAX,IAAwB,EAAxC,EAA4C,0BAA5C;AACN,SAAK,KAAL,CAAW;AADL,IAAR;AAGA;;;;EA7CgC,gBAAM,S","file":"Components.js","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport parallax from './index';\n\nexport const ParallaxRoot = (Component) => class ParallaxRoot extends React.Component {\n\tconstructor () {\n\t\tsuper();\n\t\tthis.state = {root: null};\n\t}\n\n\tcomponentDidMount () {\n\t\tvar el = ReactDOM.findDOMNode(this);\n\t\tthis.setState({\n\t\t\troot: parallax.create(el, this.props.parallaxOffsets)\n\t\t});\n\t}\n\n\trender () {\n\t\treturn (<Component {...this.props} parallaxRoot={this.state.root} />);\n\t}\n};\n\nexport class ParallaxItem extends React.Component {\n\n\tinitializeParallax (parallaxRoot) {\n\t\tvar el = ReactDOM.findDOMNode(this);\n\t\tif (this.props.speed) {\n\t\t\tparallaxRoot.add(el, this.props.speed);\n\t\t} else {\n\t\t\tvar options = {\n\t\t\t\tstart: {},\n\t\t\t\tend: {},\n\t\t\t\teasing: {}\n\t\t\t};\n\t\t\tObject.keys(this.props).forEach((prop) => {\n\t\t\t\tvar keyArray = prop.split('-');\n\t\t\t\tvar mainKey = keyArray[0];\n\t\t\t\tvar childKey = keyArray[1];\n\n\t\t\t\tswitch (mainKey) {\n\t\t\t\t\tcase 'start':\n\t\t\t\t\tcase 'end':\n\t\t\t\t\tcase 'easing':\n\t\t\t\t\t\toptions[mainKey] = options[mainKey] || {};\n\t\t\t\t\t\toptions[mainKey][childKey] = this.props[prop];\n\t\t\t\t}\n\t\t\t});\n\t\t\tparallaxRoot.add(el, options);\n\t\t}\n\t}\n\n\tcomponentDidMount () {\n\t\tif (this.props.parallaxRoot) {\n\t\t\tthis.initializeParallax(this.props.parallaxRoot);\n\t\t}\n\t}\n\n\tcomponentWillReceiveProps (newProps) {\n\t\tif (newProps.parallaxRoot && !this.props.parallaxRoot) {\n\t\t\tthis.initializeParallax(newProps.parallaxRoot);\n\t\t}\n\t}\n\n\trender () {\n\t\treturn (<div className={this.props.className || ''} data-parallax-item>\n\t\t\t{this.props.children}\n\t\t</div>);\n\t}\n}\n"]}