Comparing version 3.5.0 to 3.6.0
@@ -1039,3 +1039,5 @@ 'use strict'; | ||
rootEl = _ref.rootEl, | ||
displayName = _ref.displayName; | ||
displayName = _ref.displayName, | ||
_ref$forwardProps = _ref.forwardProps, | ||
forwardProps = _ref$forwardProps === undefined ? [] : _ref$forwardProps; | ||
@@ -1161,3 +1163,9 @@ return glamorousComponentFactory; | ||
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({ comp: comp, styles: styles, rootEl: rootEl, displayName: displayName })); | ||
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({ | ||
comp: comp, | ||
styles: styles, | ||
rootEl: rootEl, | ||
forwardProps: forwardProps, | ||
displayName: displayName | ||
})); | ||
return GlamorousComponent; | ||
@@ -1171,2 +1179,3 @@ } | ||
rootEl = _ref3.rootEl, | ||
forwardProps = _ref3.forwardProps, | ||
displayName = _ref3.displayName; | ||
@@ -1184,2 +1193,3 @@ | ||
rootEl: rootEl || componentsComp, | ||
forwardProps: forwardProps, | ||
// set the displayName to something that's slightly more | ||
@@ -1256,3 +1266,4 @@ // helpful than `GlamorousComponent` :) | ||
var propsAreCssOverrides = _ref5.propsAreCssOverrides, | ||
rootEl = _ref5.rootEl; | ||
rootEl = _ref5.rootEl, | ||
forwardProps = _ref5.forwardProps; | ||
var _ref4$css = _ref4.css, | ||
@@ -1273,3 +1284,3 @@ cssOverrides = _ref4$css === undefined ? {} : _ref4$css, | ||
return Object.keys(rest).reduce(function (split, propName) { | ||
if (shouldForwardProperty$1(rootEl, propName)) { | ||
if (forwardProps.indexOf(propName) !== -1 || shouldForwardProperty$1(rootEl, propName)) { | ||
split.toForward[propName] = rest[propName]; | ||
@@ -1276,0 +1287,0 @@ } else if (propsAreCssOverrides) { |
@@ -1034,3 +1034,5 @@ import React, { Component } from 'react'; | ||
rootEl = _ref.rootEl, | ||
displayName = _ref.displayName; | ||
displayName = _ref.displayName, | ||
_ref$forwardProps = _ref.forwardProps, | ||
forwardProps = _ref$forwardProps === undefined ? [] : _ref$forwardProps; | ||
@@ -1156,3 +1158,9 @@ return glamorousComponentFactory; | ||
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({ comp: comp, styles: styles, rootEl: rootEl, displayName: displayName })); | ||
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({ | ||
comp: comp, | ||
styles: styles, | ||
rootEl: rootEl, | ||
forwardProps: forwardProps, | ||
displayName: displayName | ||
})); | ||
return GlamorousComponent; | ||
@@ -1166,2 +1174,3 @@ } | ||
rootEl = _ref3.rootEl, | ||
forwardProps = _ref3.forwardProps, | ||
displayName = _ref3.displayName; | ||
@@ -1179,2 +1188,3 @@ | ||
rootEl: rootEl || componentsComp, | ||
forwardProps: forwardProps, | ||
// set the displayName to something that's slightly more | ||
@@ -1251,3 +1261,4 @@ // helpful than `GlamorousComponent` :) | ||
var propsAreCssOverrides = _ref5.propsAreCssOverrides, | ||
rootEl = _ref5.rootEl; | ||
rootEl = _ref5.rootEl, | ||
forwardProps = _ref5.forwardProps; | ||
var _ref4$css = _ref4.css, | ||
@@ -1268,3 +1279,3 @@ cssOverrides = _ref4$css === undefined ? {} : _ref4$css, | ||
return Object.keys(rest).reduce(function (split, propName) { | ||
if (shouldForwardProperty$1(rootEl, propName)) { | ||
if (forwardProps.indexOf(propName) !== -1 || shouldForwardProperty$1(rootEl, propName)) { | ||
split.toForward[propName] = rest[propName]; | ||
@@ -1271,0 +1282,0 @@ } else if (propsAreCssOverrides) { |
@@ -1039,3 +1039,5 @@ (function (global, factory) { | ||
rootEl = _ref.rootEl, | ||
displayName = _ref.displayName; | ||
displayName = _ref.displayName, | ||
_ref$forwardProps = _ref.forwardProps, | ||
forwardProps = _ref$forwardProps === undefined ? [] : _ref$forwardProps; | ||
@@ -1161,3 +1163,9 @@ return glamorousComponentFactory; | ||
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({ comp: comp, styles: styles, rootEl: rootEl, displayName: displayName })); | ||
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({ | ||
comp: comp, | ||
styles: styles, | ||
rootEl: rootEl, | ||
forwardProps: forwardProps, | ||
displayName: displayName | ||
})); | ||
return GlamorousComponent; | ||
@@ -1171,2 +1179,3 @@ } | ||
rootEl = _ref3.rootEl, | ||
forwardProps = _ref3.forwardProps, | ||
displayName = _ref3.displayName; | ||
@@ -1184,2 +1193,3 @@ | ||
rootEl: rootEl || componentsComp, | ||
forwardProps: forwardProps, | ||
// set the displayName to something that's slightly more | ||
@@ -1256,3 +1266,4 @@ // helpful than `GlamorousComponent` :) | ||
var propsAreCssOverrides = _ref5.propsAreCssOverrides, | ||
rootEl = _ref5.rootEl; | ||
rootEl = _ref5.rootEl, | ||
forwardProps = _ref5.forwardProps; | ||
var _ref4$css = _ref4.css, | ||
@@ -1273,3 +1284,3 @@ cssOverrides = _ref4$css === undefined ? {} : _ref4$css, | ||
return Object.keys(rest).reduce(function (split, propName) { | ||
if (shouldForwardProperty$1(rootEl, propName)) { | ||
if (forwardProps.indexOf(propName) !== -1 || shouldForwardProperty$1(rootEl, propName)) { | ||
split.toForward[propName] = rest[propName]; | ||
@@ -1276,0 +1287,0 @@ } else if (propsAreCssOverrides) { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("glamor")):"function"==typeof define&&define.amd?define(["react","glamor"],t):e.glamorous=t(e.React,e.Glamor)}(this,function(e,t){"use strict";function n(e){return null==e||"function"!=typeof e&&"object"!=typeof e}function o(e,t,o,r){var a=n(r)?r:o(r);if(!t.has(a)){var i=e.call(this,r);return t.set(a,i),i}return t.get(a)}function r(e,t,n){var o=Array.prototype.slice.call(arguments,3),r=n(o);if(!t.has(r)){var a=e.apply(this,o);return t.set(r,a),a}return t.get(r)}function a(e,t){var n=1===e.length?o:r;return n=n.bind(this,e,t.cache.create(),t.serializer)}function i(){return JSON.stringify(arguments)}function s(){this.cache=Object.create(null)}function u(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){var o=e[t]||(e[t]=[]);o.splice(o.indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).map(function(e){e(n)}),(e["*"]||[]).map(function(e){e(t,n)})}}}function l(e,t){void 0===t&&(t="__brcast__");var n=u(),o=e;return{getState:function(){return o},setState:function(e){o=e,n.emit(t,o)},subscribe:function(e){return n.on(t,e),function(){n.off(t,e)}}}}function c(e){return'glamorous warning: Expected component called "'+e+'" which uses withTheme to be within a ThemeProvider but none was found.'}function p(t){var n=function(e){function n(){var e,t,o,r;Xe(this,n);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return t=o=Qe(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(i))),o.state={theme:{}},o.setTheme=function(e){return o.setState({theme:e})},r=t,Qe(o,r)}return Je(n,e),Ke(n,[{key:"componentWillMount",value:function(){if(!this.context[tt])return void("production"!==process.env.NODE_ENV&&console.warn(c(t.displayName||t.name||"Stateless Function")));this.setState({theme:this.context[tt].getState()})}},{key:"componentDidMount",value:function(){this.context[tt]&&(this.unsubscribe=this.context[tt].subscribe(this.setTheme))}},{key:"componentWillUnmount",value:function(){this.unsubscribe&&this.unsubscribe()}},{key:"render",value:function(){return v.createElement(t,Ze({},this.props,this.state))}}]),n}(e.Component);return n.contextTypes=Ye({},tt,Ge.object),n}function d(n){function o(){for(var o=arguments.length,r=Array(o),s=0;s<o;s++)r[s]=arguments[s];var u=function(e){function n(){var e,t,o,r;Xe(this,n);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return t=o=Qe(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(i))),o.state={theme:null},o.setTheme=function(e){return o.setState({theme:e})},r=t,Qe(o,r)}return Je(n,e),Ke(n,[{key:"componentWillMount",value:function(){var e=this.props.theme;this.context[tt]?this.setTheme(e||this.context[tt].getState()):this.setTheme(e||{})}},{key:"componentWillReceiveProps",value:function(e){this.props.theme!==e.theme&&this.setTheme(e.theme)}},{key:"componentDidMount",value:function(){this.context[tt]&&!this.props.theme&&(this.unsubscribe=this.context[tt].subscribe(this.setTheme))}},{key:"componentWillUnmount",value:function(){this.unsubscribe&&this.unsubscribe()}},{key:"render",value:function(){var e=this,o=this.props,r=o.className,a=$e(o,["className"]),i=g(a,n),s=i.toForward,u=i.cssOverrides,l=n.styles.map(function(t){return"function"==typeof t?t(e.props,Ze({},e.state.theme)):t}),c=m(r),p=c.glamorStyles,d=c.glamorlessClassName,h=t.css.apply(void 0,et(l).concat(et(p),[u])).toString(),f=b(d,h);return v.createElement(n.comp,Ze({className:f},s))}}]),n}(e.Component);return u.propTypes={className:Ge.string,cssOverrides:Ge.object,theme:Ge.object},u.contextTypes=Ye({},tt,Ge.object),Object.assign(u,h({comp:n,styles:r,rootEl:a,displayName:i})),u}var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.rootEl,i=r.displayName;return o}function h(e){var t=e.comp,n=e.styles,o=e.rootEl,r=e.displayName,a=t.comp?t.comp:t;return{styles:t.styles?t.styles.concat(n):n,comp:a,rootEl:o||a,displayName:r||"glamorous("+f(t)+")"}}function f(e){return"string"==typeof e?e:e.displayName||e.name||"unknown"}function m(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().split(" ").reduce(function(e,n){if(0===n.indexOf("css-")){var o=n.slice("css-".length),r=t.styleSheet.registered[o].style;e.glamorStyles.push(r)}else e.glamorlessClassName=b(e.glamorlessClassName,n);return e},{glamorlessClassName:"",glamorStyles:[]})}function g(e,t){var n=t.propsAreCssOverrides,o=t.rootEl,r=e.css,a=void 0===r?{}:r,i=$e(e,["css"]),s={toForward:{},cssOverrides:{}};return n||(s.cssOverrides=a,"string"==typeof o)?Object.keys(i).reduce(function(e,t){return Ie(o,t)?e.toForward[t]=i[t]:n&&(e.cssOverrides[t]=i[t]),e},s):(s.toForward=i,s)}function y(e){return e.slice(0,1).toUpperCase()+e.slice(1)}function b(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}var v="default"in e?e.default:e;s.prototype.has=function(e){return e in this.cache},s.prototype.get=function(e){return this.cache[e]},s.prototype.set=function(e,t){this.cache[e]=t};var C={create:function(){return new s}},k=["coords","download","href","name","rel","shape","target","type"],x=["title"],O=["alt","height","name","width"],w=["alt","coords","download","href","rel","shape","target","type"],S=["controls","loop","muted","preload","src"],T=["href","target"],D=["size"],E=["dir"],M=["cite"],P=["disabled","form","name","type","value"],F=["height","width"],j=["span","width"],A=["span","width"],L=["value"],_=["cite"],R=["open"],z=["title"],N=["open"],U=["height","src","type","width"],q=["disabled","form","name"],W=["size"],I=["accept","action","method","name","target"],B=["name","scrolling","src"],H=["cols","rows"],V=["profile"],G=["size","width"],X=["manifest"],K=["height","name","sandbox","scrolling","src","width"],Y=["alt","height","name","sizes","src","width"],Z=["accept","alt","autoCapitalize","autoCorrect","checked","defaultChecked","defaultValue","disabled","form","height","list","max","min","multiple","name","onChange","pattern","placeholder","required","size","src","step","title","type","value","width"],J=["cite"],$=["challenge","disabled","form","name"],Q=["form"],ee=["type","value"],te=["color","href","integrity","media","nonce","rel","scope","sizes","target","title","type"],ne=["name"],oe=["label","type"],re=["checked","default","disabled","icon","label","title","type"],ae=["content","name"],ie=["high","low","max","min","optimum","value"],se=["data","form","height","name","type","width"],ue=["reversed","start","type"],le=["disabled","label"],ce=["disabled","label","selected","value"],pe=["form","name"],de=["name","type","value"],he=["width"],fe=["max","value"],me=["cite"],ge=["async","defer","integrity","nonce","src","type"],ye=["defaultValue","disabled","form","multiple","name","onChange","required","size","value"],be=["name"],ve=["media","sizes","src","type"],Ce=["media","nonce","title","type"],ke=["summary","width"],xe=["headers","height","scope","width"],Oe=["autoCapitalize","autoCorrect","cols","defaultValue","disabled","form","name","onChange","placeholder","required","rows","value","wrap"],we=["headers","height","scope","width"],Se=["default","kind","label","src"],Te=["type"],De=["controls","height","loop","muted","poster","preload","src","width"],Ee=["accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baseProfile","baselineShift","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","color","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","height","horizAdvX","horizOriginX","ideographic","imageRendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","vHanging","vIdeographic","vMathematical","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","viewBox","viewTarget","visibility","width","widths","wordSpacing","writingMode","x","x1","x2","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlSpace","xmlns","xmlnsXlink","y","y1","y2","yChannelSelector","z","zoomAndPan"],Me={a:k,abbr:x,applet:O,area:w,audio:S,base:T,basefont:D,bdo:E,blockquote:M,button:P,canvas:F,col:j,colgroup:A,data:L,del:_,details:R,dfn:z,dialog:N,embed:U,fieldset:q,font:W,form:I,frame:B,frameset:H,head:V,hr:G,html:X,iframe:K,img:Y,input:Z,ins:J,keygen:$,label:Q,li:ee,link:te,map:ne,menu:oe,menuitem:re,meta:ae,meter:ie,object:se,ol:ue,optgroup:le,option:ce,output:pe,param:de,pre:he,progress:fe,q:me,script:ge,select:ye,slot:be,source:ve,style:Ce,table:ke,td:xe,textarea:Oe,th:we,track:Se,ul:Te,video:De,svg:Ee,"*":["className","dangerouslySetInnerHTML","dir","draggable","hidden","htmlFor","id","is","itemID","itemProp","itemRef","itemScope","itemType","lang","style","suppressContentEditableWarning","title"]},Pe=Object.freeze({a:k,abbr:x,applet:O,area:w,audio:S,base:T,basefont:D,bdo:E,blockquote:M,button:P,canvas:F,col:j,colgroup:A,data:L,del:_,details:R,dfn:z,dialog:N,embed:U,fieldset:q,font:W,form:I,frame:B,frameset:H,head:V,hr:G,html:X,iframe:K,img:Y,input:Z,ins:J,keygen:$,label:Q,li:ee,link:te,map:ne,menu:oe,menuitem:re,meta:ae,meter:ie,object:se,ol:ue,optgroup:le,option:ce,output:pe,param:de,pre:he,progress:fe,q:me,script:ge,select:ye,slot:be,source:ve,style:Ce,table:ke,td:xe,textarea:Oe,th:we,track:Se,ul:Te,video:De,svg:Ee,default:Me}),Fe=Pe&&Me||Pe,je=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=Fe,e.exports=Fe}),Ae=function(e){return e&&e.__esModule?e.default:e}(je),Le=["children","dangerouslySetInnerHTML","key","ref","autoFocus","defaultValue","valueLink","defaultChecked","checkedLink","innerHTML","suppressContentEditableWarning","onFocusIn","onFocusOut","className","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onSubmit","onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onLoad","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onCopyCapture","onCutCapture","onPasteCapture","onCompositionEndCapture","onCompositionStartCapture","onCompositionUpdateCapture","onKeyDownCapture","onKeyPressCapture","onKeyUpCapture","onFocusCapture","onBlurCapture","onChangeCapture","onInputCapture","onSubmitCapture","onClickCapture","onContextMenuCapture","onDoubleClickCapture","onDragCapture","onDragEndCapture","onDragEnterCapture","onDragExitCapture","onDragLeaveCapture","onDragOverCapture","onDragStartCapture","onDropCapture","onMouseDownCapture","onMouseEnterCapture","onMouseLeaveCapture","onMouseMoveCapture","onMouseOutCapture","onMouseOverCapture","onMouseUpCapture","onSelectCapture","onTouchCancelCapture","onTouchEndCapture","onTouchMoveCapture","onTouchStartCapture","onScrollCapture","onWheelCapture","onAbortCapture","onCanPlayCapture","onCanPlayThroughCapture","onDurationChangeCapture","onEmptiedCapture","onEncryptedCapture","onEndedCapture","onErrorCapture","onLoadedDataCapture","onLoadedMetadataCapture","onLoadStartCapture","onPauseCapture","onPlayCapture","onPlayingCapture","onProgressCapture","onRateChangeCapture","onSeekedCapture","onSeekingCapture","onStalledCapture","onSuspendCapture","onTimeUpdateCapture","onVolumeChangeCapture","onWaitingCapture","onLoadCapture","onAnimationStartCapture","onAnimationEndCapture","onAnimationIterationCapture","onTransitionEndCapture"],_e=Ae["*"],Re=["color","height","width"],ze=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),Ne=function(e,t){var n=Ae[t];return-1!==_e.indexOf(e)||void 0!==n&&-1!==n.indexOf(e)},Ue=function(e){return-1!==Re.indexOf(e)},qe=function(e){return-1!==Le.indexOf(e)},We=function(e,t){return"string"!=typeof e||(Ne(t,e)||qe(t)||ze(t.toLowerCase()))&&("svg"===e||!Ue(t))},Ie=function(e,t){var n=t&&t.cache?t.cache:C,o=t&&t.serializer?t.serializer:i;return(t&&t.strategy?t.strategy:a)(e,{cache:n,serializer:o})}(We),Be=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"],He=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","animation","audio","canvas","circle","clipPath","color-profile","cursor","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","handler","hatch","hatchpath","hkern","iframe","image","line","linearGradient","listener","marker","mask","mesh","meshgradient","meshpatch","meshrow","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","prefetch","radialGradient","rect","script","set","solidColor","solidcolor","stop","style","svg","switch","symbol","tbreak","text","textArea","textPath","title","tref","tspan","unknown","use","video","view","vkern"],Ve=Be.concat(He).filter(function(e,t,n){return n.indexOf(e)===t}),Ge=void 0;if("15.5"===v.version.slice(0,4))try{Ge=require("prop-types")}catch(e){}Ge=Ge||v.PropTypes;var Xe=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ke=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),Ye=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},Ze=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Je=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},$e=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},Qe=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},et=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},tt="__glamorous__",nt=function(e){function t(){var e,n,o,r;Xe(this,t);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return n=o=Qe(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),o.broadcast=l(o.props.theme),o.setOuterTheme=function(e){o.outerTheme=e},r=n,Qe(o,r)}return Je(t,e),Ke(t,[{key:"getTheme",value:function(e){var t=e||this.props.theme;return Ze({},this.outerTheme,t)}},{key:"getChildContext",value:function(){return Ye({},tt,this.broadcast)}},{key:"componentDidMount",value:function(){this.context[tt]&&(this.unsubscribe=this.context[tt].subscribe(this.setOuterTheme))}},{key:"componentWillMount",value:function(){this.context[tt]&&(this.setOuterTheme(this.context[tt].getState()),this.broadcast.setState(this.getTheme()))}},{key:"componentWillReceiveProps",value:function(e){this.props.theme!==e.theme&&this.broadcast.setState(this.getTheme(e.theme))}},{key:"componentWillUnmount",value:function(){this.unsubscribe&&this.unsubscribe()}},{key:"render",value:function(){return this.props.children?v.Children.only(this.props.children):null}}]),t}(e.Component);nt.childContextTypes=Ye({},tt,Ge.object.isRequired),nt.contextTypes=Ye({},tt,Ge.object),nt.propTypes={theme:Ge.object.isRequired,children:Ge.node},Object.assign(d,Ve.reduce(function(e,t){return e[t]=d(t),e},{})),Object.assign(d,Ve.reduce(function(e,t){var n=y(t);return e[n]=d[t](),e[n].displayName="glamorous."+n,e[n].propsAreCssOverrides=!0,e},{}));var ot=Object.freeze({default:d,ThemeProvider:nt,withTheme:p}),rt=d;return Object.assign(rt,Object.keys(ot).reduce(function(e,t){return"default"!==t&&(e[t]=ot[t]),e},{})),rt}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("glamor")):"function"==typeof define&&define.amd?define(["react","glamor"],t):e.glamorous=t(e.React,e.Glamor)}(this,function(e,t){"use strict";function n(e){return null==e||"function"!=typeof e&&"object"!=typeof e}function o(e,t,o,r){var a=n(r)?r:o(r);if(!t.has(a)){var i=e.call(this,r);return t.set(a,i),i}return t.get(a)}function r(e,t,n){var o=Array.prototype.slice.call(arguments,3),r=n(o);if(!t.has(r)){var a=e.apply(this,o);return t.set(r,a),a}return t.get(r)}function a(e,t){var n=1===e.length?o:r;return n=n.bind(this,e,t.cache.create(),t.serializer)}function i(){return JSON.stringify(arguments)}function s(){this.cache=Object.create(null)}function u(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){var o=e[t]||(e[t]=[]);o.splice(o.indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).map(function(e){e(n)}),(e["*"]||[]).map(function(e){e(t,n)})}}}function l(e,t){void 0===t&&(t="__brcast__");var n=u(),o=e;return{getState:function(){return o},setState:function(e){o=e,n.emit(t,o)},subscribe:function(e){return n.on(t,e),function(){n.off(t,e)}}}}function c(e){return'glamorous warning: Expected component called "'+e+'" which uses withTheme to be within a ThemeProvider but none was found.'}function p(t){var n=function(e){function n(){var e,t,o,r;Xe(this,n);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return t=o=Qe(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(i))),o.state={theme:{}},o.setTheme=function(e){return o.setState({theme:e})},r=t,Qe(o,r)}return Je(n,e),Ke(n,[{key:"componentWillMount",value:function(){if(!this.context[tt])return void("production"!==process.env.NODE_ENV&&console.warn(c(t.displayName||t.name||"Stateless Function")));this.setState({theme:this.context[tt].getState()})}},{key:"componentDidMount",value:function(){this.context[tt]&&(this.unsubscribe=this.context[tt].subscribe(this.setTheme))}},{key:"componentWillUnmount",value:function(){this.unsubscribe&&this.unsubscribe()}},{key:"render",value:function(){return v.createElement(t,Ze({},this.props,this.state))}}]),n}(e.Component);return n.contextTypes=Ye({},tt,Ge.object),n}function d(n){function o(){for(var o=arguments.length,r=Array(o),s=0;s<o;s++)r[s]=arguments[s];var l=function(e){function n(){var e,t,o,r;Xe(this,n);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return t=o=Qe(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(i))),o.state={theme:null},o.setTheme=function(e){return o.setState({theme:e})},r=t,Qe(o,r)}return Je(n,e),Ke(n,[{key:"componentWillMount",value:function(){var e=this.props.theme;this.context[tt]?this.setTheme(e||this.context[tt].getState()):this.setTheme(e||{})}},{key:"componentWillReceiveProps",value:function(e){this.props.theme!==e.theme&&this.setTheme(e.theme)}},{key:"componentDidMount",value:function(){this.context[tt]&&!this.props.theme&&(this.unsubscribe=this.context[tt].subscribe(this.setTheme))}},{key:"componentWillUnmount",value:function(){this.unsubscribe&&this.unsubscribe()}},{key:"render",value:function(){var e=this,o=this.props,r=o.className,a=$e(o,["className"]),i=g(a,n),s=i.toForward,u=i.cssOverrides,l=n.styles.map(function(t){return"function"==typeof t?t(e.props,Ze({},e.state.theme)):t}),c=m(r),p=c.glamorStyles,d=c.glamorlessClassName,h=t.css.apply(void 0,et(l).concat(et(p),[u])).toString(),f=b(d,h);return v.createElement(n.comp,Ze({className:f},s))}}]),n}(e.Component);return l.propTypes={className:Ge.string,cssOverrides:Ge.object,theme:Ge.object},l.contextTypes=Ye({},tt,Ge.object),Object.assign(l,h({comp:n,styles:r,rootEl:a,forwardProps:u,displayName:i})),l}var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.rootEl,i=r.displayName,s=r.forwardProps,u=void 0===s?[]:s;return o}function h(e){var t=e.comp,n=e.styles,o=e.rootEl,r=e.forwardProps,a=e.displayName,i=t.comp?t.comp:t;return{styles:t.styles?t.styles.concat(n):n,comp:i,rootEl:o||i,forwardProps:r,displayName:a||"glamorous("+f(t)+")"}}function f(e){return"string"==typeof e?e:e.displayName||e.name||"unknown"}function m(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().split(" ").reduce(function(e,n){if(0===n.indexOf("css-")){var o=n.slice("css-".length),r=t.styleSheet.registered[o].style;e.glamorStyles.push(r)}else e.glamorlessClassName=b(e.glamorlessClassName,n);return e},{glamorlessClassName:"",glamorStyles:[]})}function g(e,t){var n=t.propsAreCssOverrides,o=t.rootEl,r=t.forwardProps,a=e.css,i=void 0===a?{}:a,s=$e(e,["css"]),u={toForward:{},cssOverrides:{}};return n||(u.cssOverrides=i,"string"==typeof o)?Object.keys(s).reduce(function(e,t){return-1!==r.indexOf(t)||Ie(o,t)?e.toForward[t]=s[t]:n&&(e.cssOverrides[t]=s[t]),e},u):(u.toForward=s,u)}function y(e){return e.slice(0,1).toUpperCase()+e.slice(1)}function b(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}var v="default"in e?e.default:e;s.prototype.has=function(e){return e in this.cache},s.prototype.get=function(e){return this.cache[e]},s.prototype.set=function(e,t){this.cache[e]=t};var C={create:function(){return new s}},k=["coords","download","href","name","rel","shape","target","type"],x=["title"],w=["alt","height","name","width"],O=["alt","coords","download","href","rel","shape","target","type"],S=["controls","loop","muted","preload","src"],T=["href","target"],P=["size"],D=["dir"],E=["cite"],M=["disabled","form","name","type","value"],F=["height","width"],j=["span","width"],A=["span","width"],L=["value"],_=["cite"],R=["open"],z=["title"],N=["open"],U=["height","src","type","width"],q=["disabled","form","name"],W=["size"],I=["accept","action","method","name","target"],B=["name","scrolling","src"],H=["cols","rows"],V=["profile"],G=["size","width"],X=["manifest"],K=["height","name","sandbox","scrolling","src","width"],Y=["alt","height","name","sizes","src","width"],Z=["accept","alt","autoCapitalize","autoCorrect","checked","defaultChecked","defaultValue","disabled","form","height","list","max","min","multiple","name","onChange","pattern","placeholder","required","size","src","step","title","type","value","width"],J=["cite"],$=["challenge","disabled","form","name"],Q=["form"],ee=["type","value"],te=["color","href","integrity","media","nonce","rel","scope","sizes","target","title","type"],ne=["name"],oe=["label","type"],re=["checked","default","disabled","icon","label","title","type"],ae=["content","name"],ie=["high","low","max","min","optimum","value"],se=["data","form","height","name","type","width"],ue=["reversed","start","type"],le=["disabled","label"],ce=["disabled","label","selected","value"],pe=["form","name"],de=["name","type","value"],he=["width"],fe=["max","value"],me=["cite"],ge=["async","defer","integrity","nonce","src","type"],ye=["defaultValue","disabled","form","multiple","name","onChange","required","size","value"],be=["name"],ve=["media","sizes","src","type"],Ce=["media","nonce","title","type"],ke=["summary","width"],xe=["headers","height","scope","width"],we=["autoCapitalize","autoCorrect","cols","defaultValue","disabled","form","name","onChange","placeholder","required","rows","value","wrap"],Oe=["headers","height","scope","width"],Se=["default","kind","label","src"],Te=["type"],Pe=["controls","height","loop","muted","poster","preload","src","width"],De=["accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baseProfile","baselineShift","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","color","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","height","horizAdvX","horizOriginX","ideographic","imageRendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","vHanging","vIdeographic","vMathematical","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","viewBox","viewTarget","visibility","width","widths","wordSpacing","writingMode","x","x1","x2","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlSpace","xmlns","xmlnsXlink","y","y1","y2","yChannelSelector","z","zoomAndPan"],Ee={a:k,abbr:x,applet:w,area:O,audio:S,base:T,basefont:P,bdo:D,blockquote:E,button:M,canvas:F,col:j,colgroup:A,data:L,del:_,details:R,dfn:z,dialog:N,embed:U,fieldset:q,font:W,form:I,frame:B,frameset:H,head:V,hr:G,html:X,iframe:K,img:Y,input:Z,ins:J,keygen:$,label:Q,li:ee,link:te,map:ne,menu:oe,menuitem:re,meta:ae,meter:ie,object:se,ol:ue,optgroup:le,option:ce,output:pe,param:de,pre:he,progress:fe,q:me,script:ge,select:ye,slot:be,source:ve,style:Ce,table:ke,td:xe,textarea:we,th:Oe,track:Se,ul:Te,video:Pe,svg:De,"*":["className","dangerouslySetInnerHTML","dir","draggable","hidden","htmlFor","id","is","itemID","itemProp","itemRef","itemScope","itemType","lang","style","suppressContentEditableWarning","title"]},Me=Object.freeze({a:k,abbr:x,applet:w,area:O,audio:S,base:T,basefont:P,bdo:D,blockquote:E,button:M,canvas:F,col:j,colgroup:A,data:L,del:_,details:R,dfn:z,dialog:N,embed:U,fieldset:q,font:W,form:I,frame:B,frameset:H,head:V,hr:G,html:X,iframe:K,img:Y,input:Z,ins:J,keygen:$,label:Q,li:ee,link:te,map:ne,menu:oe,menuitem:re,meta:ae,meter:ie,object:se,ol:ue,optgroup:le,option:ce,output:pe,param:de,pre:he,progress:fe,q:me,script:ge,select:ye,slot:be,source:ve,style:Ce,table:ke,td:xe,textarea:we,th:Oe,track:Se,ul:Te,video:Pe,svg:De,default:Ee}),Fe=Me&&Ee||Me,je=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=Fe,e.exports=Fe}),Ae=function(e){return e&&e.__esModule?e.default:e}(je),Le=["children","dangerouslySetInnerHTML","key","ref","autoFocus","defaultValue","valueLink","defaultChecked","checkedLink","innerHTML","suppressContentEditableWarning","onFocusIn","onFocusOut","className","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onSubmit","onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onLoad","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onCopyCapture","onCutCapture","onPasteCapture","onCompositionEndCapture","onCompositionStartCapture","onCompositionUpdateCapture","onKeyDownCapture","onKeyPressCapture","onKeyUpCapture","onFocusCapture","onBlurCapture","onChangeCapture","onInputCapture","onSubmitCapture","onClickCapture","onContextMenuCapture","onDoubleClickCapture","onDragCapture","onDragEndCapture","onDragEnterCapture","onDragExitCapture","onDragLeaveCapture","onDragOverCapture","onDragStartCapture","onDropCapture","onMouseDownCapture","onMouseEnterCapture","onMouseLeaveCapture","onMouseMoveCapture","onMouseOutCapture","onMouseOverCapture","onMouseUpCapture","onSelectCapture","onTouchCancelCapture","onTouchEndCapture","onTouchMoveCapture","onTouchStartCapture","onScrollCapture","onWheelCapture","onAbortCapture","onCanPlayCapture","onCanPlayThroughCapture","onDurationChangeCapture","onEmptiedCapture","onEncryptedCapture","onEndedCapture","onErrorCapture","onLoadedDataCapture","onLoadedMetadataCapture","onLoadStartCapture","onPauseCapture","onPlayCapture","onPlayingCapture","onProgressCapture","onRateChangeCapture","onSeekedCapture","onSeekingCapture","onStalledCapture","onSuspendCapture","onTimeUpdateCapture","onVolumeChangeCapture","onWaitingCapture","onLoadCapture","onAnimationStartCapture","onAnimationEndCapture","onAnimationIterationCapture","onTransitionEndCapture"],_e=Ae["*"],Re=["color","height","width"],ze=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),Ne=function(e,t){var n=Ae[t];return-1!==_e.indexOf(e)||void 0!==n&&-1!==n.indexOf(e)},Ue=function(e){return-1!==Re.indexOf(e)},qe=function(e){return-1!==Le.indexOf(e)},We=function(e,t){return"string"!=typeof e||(Ne(t,e)||qe(t)||ze(t.toLowerCase()))&&("svg"===e||!Ue(t))},Ie=function(e,t){var n=t&&t.cache?t.cache:C,o=t&&t.serializer?t.serializer:i;return(t&&t.strategy?t.strategy:a)(e,{cache:n,serializer:o})}(We),Be=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"],He=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","animation","audio","canvas","circle","clipPath","color-profile","cursor","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","handler","hatch","hatchpath","hkern","iframe","image","line","linearGradient","listener","marker","mask","mesh","meshgradient","meshpatch","meshrow","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","prefetch","radialGradient","rect","script","set","solidColor","solidcolor","stop","style","svg","switch","symbol","tbreak","text","textArea","textPath","title","tref","tspan","unknown","use","video","view","vkern"],Ve=Be.concat(He).filter(function(e,t,n){return n.indexOf(e)===t}),Ge=void 0;if("15.5"===v.version.slice(0,4))try{Ge=require("prop-types")}catch(e){}Ge=Ge||v.PropTypes;var Xe=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ke=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),Ye=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},Ze=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Je=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},$e=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},Qe=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},et=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},tt="__glamorous__",nt=function(e){function t(){var e,n,o,r;Xe(this,t);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return n=o=Qe(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),o.broadcast=l(o.props.theme),o.setOuterTheme=function(e){o.outerTheme=e},r=n,Qe(o,r)}return Je(t,e),Ke(t,[{key:"getTheme",value:function(e){var t=e||this.props.theme;return Ze({},this.outerTheme,t)}},{key:"getChildContext",value:function(){return Ye({},tt,this.broadcast)}},{key:"componentDidMount",value:function(){this.context[tt]&&(this.unsubscribe=this.context[tt].subscribe(this.setOuterTheme))}},{key:"componentWillMount",value:function(){this.context[tt]&&(this.setOuterTheme(this.context[tt].getState()),this.broadcast.setState(this.getTheme()))}},{key:"componentWillReceiveProps",value:function(e){this.props.theme!==e.theme&&this.broadcast.setState(this.getTheme(e.theme))}},{key:"componentWillUnmount",value:function(){this.unsubscribe&&this.unsubscribe()}},{key:"render",value:function(){return this.props.children?v.Children.only(this.props.children):null}}]),t}(e.Component);nt.childContextTypes=Ye({},tt,Ge.object.isRequired),nt.contextTypes=Ye({},tt,Ge.object),nt.propTypes={theme:Ge.object.isRequired,children:Ge.node},Object.assign(d,Ve.reduce(function(e,t){return e[t]=d(t),e},{})),Object.assign(d,Ve.reduce(function(e,t){var n=y(t);return e[n]=d[t](),e[n].displayName="glamorous."+n,e[n].propsAreCssOverrides=!0,e},{}));var ot=Object.freeze({default:d,ThemeProvider:nt,withTheme:p}),rt=d;return Object.assign(rt,Object.keys(ot).reduce(function(e,t){return"default"!==t&&(e[t]=ot[t]),e},{})),rt}); | ||
//# sourceMappingURL=glamorous.umd.min.js.map |
{ | ||
"name": "glamorous", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "React component styling solved", | ||
@@ -31,6 +31,6 @@ "main": "dist/glamorous.cjs.js", | ||
"brcast": "^1.1.6", | ||
"fast-memoize": "^2.2.7", | ||
"html-tag-names": "^1.1.1", | ||
"svg-tag-names": "^1.1.0", | ||
"react-html-attributes": "^1.2.1", | ||
"fast-memoize": "^2.2.7" | ||
"svg-tag-names": "^1.1.0" | ||
}, | ||
@@ -55,4 +55,4 @@ "peerDependencies": { | ||
"cz-conventional-changelog": "^2.0.0", | ||
"enzyme": "^2.8.0", | ||
"enzyme-to-json": "^1.5.0", | ||
"enzyme": "^2.8.1", | ||
"enzyme-to-json": "^1.5.1", | ||
"eslint": "^3.17.0", | ||
@@ -69,6 +69,7 @@ "eslint-config-kentcdodds": "^12.0.0", | ||
"prettier-eslint-cli": "^3.1.2", | ||
"prop-types": "^15.5.6", | ||
"react": "^15.5.3", | ||
"prop-types": "^15.5.8", | ||
"react": "^15.5.4", | ||
"react-addons-test-utils": "^15.5.1", | ||
"react-dom": "^15.5.3", | ||
"react-dom": "^15.5.4", | ||
"react-test-renderer": "^15.5.4", | ||
"rollup": "^0.41.6", | ||
@@ -75,0 +76,0 @@ "rollup-plugin-babel": "^2.7.1", |
131
README.md
@@ -17,3 +17,3 @@ <img src="https://github.com/paypal/glamorous/raw/master/other/glamorous.png" alt="glamorous logo" title="glamorous" align="right" width="150" height="150" /> | ||
[](#contributors) | ||
[](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -248,3 +248,3 @@ [![Chat][chat-badge]][chat] | ||
const staticStyles = {color: 'green'} | ||
const dynamicStyles = props => {fontSize: props.size === 'big' ? 32 : 24} | ||
const dynamicStyles = props => ({fontSize: props.size === 'big' ? 32 : 24}) | ||
const MyDynamicallyStyledDiv = glamorous.div(staticStyles, dynamicStyles) | ||
@@ -296,2 +296,108 @@ ``` | ||
### glamorous API | ||
The `glamorous` function allows you to create your own | ||
`glamorousComponentFactory` (see [above](#glamorouscomponentfactory)) for any | ||
component you have. For [example](https://codesandbox.io/s/g5kDAyB9): | ||
```jsx | ||
const MyComponent = props => <div {...props} /> | ||
const myGlamorousComponentFactory = glamorous(MyComponent) | ||
const MyGlamorousComponent = myGlamorousComponentFactory({/* styles */}) | ||
<MyGlamorousComponent id="i-am-forwarded-to-the-div" /> | ||
``` | ||
You can also provide a few options to help glamorous know how to handle your | ||
component: | ||
#### displayName | ||
The `displayName` of a React component is used by React in the | ||
[React DevTools][react-devtools] and is really handy for debugging React | ||
applications. Glamorous will do its best to give a good `displayName` for your | ||
component, but, for the example above, the best it can do is: | ||
`glamorous(MyComponent)`. If you want to specify a `displayName`, you can do | ||
so with this property. For [example](https://codesandbox.io/s/P3Lyw5j2): | ||
```jsx | ||
const MyComponent = props => <div {...props} /> | ||
const myGlamorousComponentFactory = glamorous( | ||
MyComponent, | ||
{displayName: 'MyGlamorousComponent'} | ||
) | ||
``` | ||
And now all components created by the `myGlamorousComponentFactory` will have | ||
the `displayName` of `MyGlamorousComponent`. | ||
> Tip: you can also monkey-patch the `displayName` onto the components that you | ||
> create from your component factory. There's currently an effort to make | ||
> [a babel plugin][babel-plugin] that will do this for you to give you even | ||
> better `displayName`s | ||
#### rootEl | ||
React has an [Unknown Prop Warning][unknown-prop-warning] that it logs when you | ||
pass spurious props to DOM elements: (i.e. `<div big={true} />`). Because you | ||
can style your components using props, glamorous needs to filter out the props | ||
you pass so it doesn't forward these on to the underlying DOM element. However, | ||
if you create your own factory using a custom component, glamorous will just | ||
forward all the props (because the component may actually need them and | ||
glamorous has no way of knowing). But in some cases, the component may be | ||
spreading all of the props onto the root element that it renders. For these | ||
cases, you can tell glamorous which element is being rendered and glamorous will | ||
apply the same logic for which props to forward that it does for the built-in | ||
factories. For [example](https://codesandbox.io/s/P18oV4kD2): | ||
```jsx | ||
const MyComponent = props => <div {...props} /> | ||
const myGlamorousComponentFactory = glamorous( | ||
MyComponent, | ||
{rootEl: 'div'} | ||
) | ||
const MyGlamorousComponent = myGlamorousComponentFactory(big => ({ | ||
fontSize: big ? 36 : 24, | ||
})) | ||
<MyGlamorousComponent big={true} id="room423" /> | ||
// this will render: | ||
// <div id="room423" /> | ||
// with {fontSize: 36} | ||
// big is not forwarded to MyComponent because the `rootEl` is a div and `big` | ||
// is not a valid attribute for a `div` however `id` will be forwarded because | ||
// `id` is a valid prop | ||
``` | ||
#### forwardProps | ||
There are some cases where you're making a `glamorousComponentFactory` out of | ||
a custom component that spreads _some_ of the properties across an underlying | ||
DOM element, but not all of them. In this case you should use `rootEl` to | ||
forward only the right props to be spread on the DOM element, but you can also | ||
use `forwardProps` to specify extra props that should be forwarded. For | ||
[example](https://codesandbox.io/s/GZEo8jOyy): | ||
```jsx | ||
const MyComponent = ({shouldRender, ...rest}) => ( | ||
shouldRender ? <div {...rest} /> : null | ||
) | ||
const MyStyledComponent = glamorous(MyComponent, { | ||
forwardProps: ['shouldRender'], | ||
rootEl: 'div', | ||
})(big => ({ | ||
fontSize: big ? 36 : 24, | ||
})) | ||
<MyStyledComponent shouldRender={true} big={false} id="hello" /> | ||
// this will render: | ||
// <div id="hello" /> | ||
// with {fontSize: 24} | ||
// `shouldRender` will be forwarded to `MyComponent` because it is included in | ||
// `forwardProps`. `big` will not be forwarded to `MyComponent` because `rootEl` | ||
// is a `div` and that's not a valid prop for a `div`, but it _will_ be used in | ||
// the styles object function that determines the `fontSize`. Finally `id` will | ||
// be forwarded to `MyComponent` because it is a valid prop for a `div`. | ||
``` | ||
### Theming | ||
@@ -404,3 +510,3 @@ | ||
render() { | ||
const {children, theme: {color}} = this.props; | ||
const {children, theme: {main: {color}}} = this.props; | ||
return <h3 style={{color}}>{children}</h3>; | ||
@@ -430,3 +536,3 @@ } | ||
<details> | ||
<summary>pseudo-class</summary> | ||
<summary>pseudo-class</summary> | ||
@@ -446,3 +552,3 @@ ```javascript | ||
<details> | ||
<summary>pseudo-element</summary> | ||
<summary>pseudo-element</summary> | ||
@@ -472,3 +578,3 @@ ```jsx | ||
<details> | ||
<summary>Relational CSS Selectors</summary> | ||
<summary>Relational CSS Selectors</summary> | ||
@@ -493,3 +599,3 @@ ```jsx | ||
<details> | ||
<summary>Animations</summary> | ||
<summary>Animations</summary> | ||
@@ -520,3 +626,3 @@ ```jsx | ||
<details> | ||
<summary>Media Queries</summary> | ||
<summary>Media Queries</summary> | ||
@@ -568,3 +674,3 @@ ```jsx | ||
If you need help, please fork [this codepen][help-pen] and bring it up in | ||
If you need help, please fork [this CodeSandbox][help-sandbox] and bring it up in | ||
[the chat][chat] | ||
@@ -580,3 +686,3 @@ | ||
| [<img src="https://avatars1.githubusercontent.com/u/417268?v=3" width="100px;"/><br /><sub>Pavithra Kodmad</sub>](https://github.com/pksjce)<br />💡 | [<img src="https://avatars0.githubusercontent.com/u/82070?v=3" width="100px;"/><br /><sub>Alessandro Arnodo</sub>](http://alessandro.arnodo.net)<br />[💻](https://github.com/paypal/glamorous/commits?author=vesparny) [📖](https://github.com/paypal/glamorous/commits?author=vesparny) [⚠️](https://github.com/paypal/glamorous/commits?author=vesparny) | [<img src="https://avatars1.githubusercontent.com/u/105127?v=3" width="100px;"/><br /><sub>Jason Miller</sub>](https://jasonformat.com)<br />👀 | [<img src="https://avatars0.githubusercontent.com/u/1295580?v=3" width="100px;"/><br /><sub>Kyle Welch</sub>](http://www.krwelch.com)<br />👀 💡 | [<img src="https://avatars0.githubusercontent.com/u/1634922?v=3" width="100px;"/><br /><sub>Javi Velasco</sub>](http://javivelasco.com)<br />👀 | [<img src="https://avatars1.githubusercontent.com/u/6886061?v=3" width="100px;"/><br /><sub>Brandon Dail</sub>](https://twitter.com/aweary)<br />👀 | [<img src="https://avatars2.githubusercontent.com/u/1714673?v=3" width="100px;"/><br /><sub>Jason Brown</sub>](http://browniefed.com)<br />👀 | | ||
| [<img src="https://avatars3.githubusercontent.com/u/25375401?v=3" width="100px;"/><br /><sub>jackyho112</sub>](https://github.com/jackyho112)<br />[💻](https://github.com/paypal/glamorous/commits?author=jackyho112) [⚠️](https://github.com/paypal/glamorous/commits?author=jackyho112) | | ||
| [<img src="https://avatars3.githubusercontent.com/u/25375401?v=3" width="100px;"/><br /><sub>jackyho112</sub>](https://github.com/jackyho112)<br />[💻](https://github.com/paypal/glamorous/commits?author=jackyho112) [⚠️](https://github.com/paypal/glamorous/commits?author=jackyho112) | [<img src="https://avatars0.githubusercontent.com/u/3629876?v=3" width="100px;"/><br /><sub>Kurtis Kemple</sub>](https://twitter.com/kurtiskemple)<br />[💻](https://github.com/paypal/glamorous/commits?author=kkemple) [⚠️](https://github.com/paypal/glamorous/commits?author=kkemple) [📖](https://github.com/paypal/glamorous/commits?author=kkemple) | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -637,2 +743,5 @@ | ||
[glamor-ssr]: https://github.com/threepointone/glamor/blob/5e7d988211330b8e2fca5bb8da78e35051444efd/docs/server.md | ||
[help-pen]: http://kcd.im/glamorous-help | ||
[help-sandbox]: http://kcd.im/glamorous-help | ||
[react-devtools]: https://github.com/facebook/react-devtools | ||
[babel-plugin]: https://github.com/paypal/glamorous/issues/29 | ||
[unknown-prop-warning]: https://facebook.github.io/react/warnings/unknown-prop.html |
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
278851
3549
736
42