react-native-web-headroom
Version:
React Native Web Headroom
3 lines (2 loc) • 6.05 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("glamor")):"function"==typeof define&&define.amd?define(["react","glamor"],e):t.glamorous=e(t.React,t.Glamor)}(this,function(t,e){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var r="__glamorous__",o=void 0;if(parseFloat(t.version.slice(0,4))>=15.5)try{o=("undefined"!=typeof window?window:global).PropTypes}catch(t){}o=o||t.PropTypes;var n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},a=function(t,e){var r={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return r},p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};function c(t){var e=[],r=[];return t.toString().split(" ").forEach(function(t){if(0===t.indexOf("css-")){var o=((n={})["data-"+t]="",n);r.push(o)}else e.push(t);var n}),{glamorlessClassName:e,glamorStyles:r}}function l(t){var r=t.styles,o=t.props,n=t.cssOverrides,s=t.cssProp,i=t.context,a=(t.displayName,function t(e,r,o){var n=void 0;var s=[];var i=[];for(var a=0;a<e.length;a++){for(n=e[a];"function"==typeof n;)n=n(r,o);if("string"==typeof n){var p=c(n),l=p.glamorStyles,u=p.glamorlessClassName;s.push.apply(s,l),i.push.apply(i,u)}else if(Array.isArray(n)){var f=t(n,r,o);s.push.apply(s,f.mappedArgs),i.push.apply(i,f.nonGlamorClassNames)}else s.push(n)}return{mappedArgs:s,nonGlamorClassNames:i}}([].concat(r,[o.className,n,s]),o,i)),p=a.mappedArgs,l=a.nonGlamorClassNames;return(e.css.apply(void 0,[null].concat(p)).toString()+" "+l.join(" ").trim()).trim()}function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(t)?t:[t]}function f(t,e){return t?t.concat(e):e}function m(t){return t.rootEl?t.rootEl:t.comp||t}return function(e){return function c(h){var d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},y=d.rootEl,v=d.displayName,g=d.shouldClassNameUpdate,b=d.filterProps,w=void 0===b?[]:b,P=d.forwardProps,O=void 0===P?[]:P,A=d.propsAreCssOverrides,N=void 0===A?h.propsAreCssOverrides:A,j=d.withProps;return Object.assign(E,{withConfig:x}),E;function x(t){return c(h,s({},d,t))}function E(){for(var d=arguments.length,b=Array(d),P=0;P<d;P++)b[P]=arguments[P];var A=function(e){var a,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=c.noWarn,u=void 0!==l&&l,f=c.createElement,m=void 0===f||f,h=function(o){function a(){var t,e;n(this,a);for(var r=arguments.length,s=Array(r),i=0;i<r;i++)s[i]=arguments[i];return t=e=p(this,o.call.apply(o,[this].concat(s))),e.warned=u,e.state={theme:{}},e.setTheme=function(t){return e.setState({theme:t})},p(e,t)}return i(a,o),a.prototype.componentWillMount=function(){this.context[r];var t=this.props.theme;this.context[r]?this.setTheme(t||this.context[r].getState()):this.setTheme(t||{})},a.prototype.componentWillReceiveProps=function(t){this.props.theme!==t.theme&&this.setTheme(t.theme)},a.prototype.componentDidMount=function(){this.context[r]&&!this.props.theme&&(this.subscriptionId=this.context[r].subscribe(this.setTheme))},a.prototype.componentWillUnmount=function(){this.subscriptionId&&this.context[r].unsubscribe(this.subscriptionId)},a.prototype.render=function(){return m?t.createElement(e,s({},this.props,this.state)):e.call(this,s({},this.props,this.state),this.context)},a}(t.Component),d=((a={})[r]=o.object,a),y=null;return Object.defineProperty(h,"contextTypes",{enumerable:!0,configurable:!0,set:function(t){y=t},get:function(){return y?s({},d,y):d}}),h}(function(r,o){var n=function(t,e,r){if(!g)return!0;var o=!0;return r&&(g(r.props,t,r.context,e)||(o=!1)),o}(r=function t(e,r,o,n){return e.forEach(function(e){return"function"==typeof e?Object.assign(r,e(Object.assign({},r,o),n)):Array.isArray(e)?Object.assign(r,t(e,r,o,n)):Object.assign(r,e)}),Object.assign(r,o)}(A.propsToApply,{},r,o),o,this.previous);g&&(this.previous={props:r,context:o});var i=e(r,A),a=i.toForward,p=i.cssOverrides,c=i.cssProp;return this.className=n?l({styles:A.styles,props:r,cssOverrides:p,cssProp:c,context:o,displayName:A.displayName}):this.className,t.createElement(A.comp,s({ref:"innerRef"in a?void 0:r.innerRef},a,{className:this.className}))},{noWarn:!0,createElement:!1});return Object.assign(A,function(t){var e=t.comp,r=t.styles,o=t.rootEl,n=t.filterProps,s=t.forwardProps,i=t.displayName,a=t.propsToApply,p=e.comp?e.comp:e,c=e.propsToApply?[].concat(e.propsToApply,u(a)):u(a);return{styles:f(e.styles,r),comp:p,rootEl:o||m(e),forwardProps:f(e.forwardProps,s),filterProps:f(e.filterProps,n),displayName:i||"glamorous("+function(t){return"string"==typeof t?t:t.displayName||t.name||"unknown"}(e)+")",propsToApply:c}}({comp:h,styles:b,rootEl:y,filterProps:w,forwardProps:O,displayName:v,propsToApply:j}),{isGlamorousComponent:!0,propsAreCssOverrides:N,withComponent:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=A.forwardProps,o=A.filterProps,n=a(A,["forwardProps","filterProps"]);return c(s({},n,{comp:t,rootEl:m(t)}),s({forwardProps:r,filterProps:o},e))()},withProps:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return c(A,{withProps:e})()},withConfig:x}),A}}}(function(t,e){var r=e.forwardProps,o=t.css,n=t.innerRef,s=(t.theme,t.className,t.glam,a(t,["css","innerRef","theme","className","glam"]));return void 0!==n&&-1!==r.indexOf("innerRef")&&(s.innerRef=n),{toForward:s,cssProp:o}})});
//# sourceMappingURL=glamorous.umd.min.tiny.js.map