{"version":3,"file":"glamorous.umd.tiny.js","sources":["../src/constants.js","../src/react-compat.js","../src/with-theme.js","../src/get-glamor-classname.js","../src/create-glamorous.js","../src/tiny.js"],"sourcesContent":["/* istanbul ignore next */\nimport preval from 'preval.macro'\n\nexport const CHANNEL = '__glamorous__'\nexport const isPreact = preval`module.exports = process.env.BUILD_PREACT === 'true'`\n","import React from 'react'\nimport codegen from 'codegen.macro'\nimport {isPreact} from './constants'\n\nlet PropTypes\n\n/* istanbul ignore next */\nif (isPreact) {\n  if (!React.PropTypes) {\n    PropTypes = () => PropTypes\n    const allTypes = [\n      'array',\n      'bool',\n      'func',\n      'number',\n      'object',\n      'string',\n      'symbol',\n      'any',\n      'arrayOf',\n      'element',\n      'instanceOf',\n      'node',\n      'objectOf',\n      'oneOf',\n      'oneOfType',\n      'shape',\n      'exact',\n    ]\n    allTypes.forEach(type => {\n      PropTypes[type] = PropTypes\n    })\n  }\n  // copied from preact-compat\n  /* eslint-disable no-eq-null, eqeqeq, consistent-return */\n  if (!React.Children) {\n    const Children = {\n      map(children, fn, ctx) {\n        if (children == null) {\n          return null\n        }\n        children = Children.toArray(children)\n        if (ctx && ctx !== children) {\n          fn = fn.bind(ctx)\n        }\n        return children.map(fn)\n      },\n      forEach(children, fn, ctx) {\n        if (children == null) {\n          return null\n        }\n        children = Children.toArray(children)\n        if (ctx && ctx !== children) {\n          fn = fn.bind(ctx)\n        }\n        children.forEach(fn)\n      },\n      count(children) {\n        return (children && children.length) || 0\n      },\n      only(children) {\n        children = Children.toArray(children)\n        if (children.length !== 1) {\n          throw new Error('Children.only() expects only one child.')\n        }\n        return children[0]\n      },\n      toArray(children) {\n        if (children == null) {\n          return []\n        }\n        return [].concat(children)\n      },\n    }\n    React.Children = Children\n  }\n  /* eslint-enable no-eq-null, eqeqeq, consistent-return */\n} else if (parseFloat(React.version.slice(0, 4)) >= 15.5) {\n  /* istanbul ignore next */\n  try {\n    PropTypes = codegen`\n      if (process.env.BUILD_FORMAT === 'umd') {\n        module.exports = \"(typeof window !== 'undefined' ? window : global).PropTypes\"\n      } else {\n        module.exports = \"require('prop-types')\"\n      }\n    `\n    /* istanbul ignore next */\n  } catch (error) {\n    // ignore\n  }\n}\n/* istanbul ignore next */\nPropTypes = PropTypes || React.PropTypes\n\nexport {PropTypes}\n\n/*\neslint\n  import/no-mutable-exports:0,\n  import/prefer-default-export:0,\n  react/no-deprecated:0\n */\n","import React from 'react'\n\nimport {CHANNEL} from './constants'\nimport {PropTypes} from './react-compat'\n\nfunction generateWarningMessage(Comp) {\n  const componentName = Comp.displayName || Comp.name || 'FunctionComponent'\n  // eslint-disable-next-line max-len\n  return `glamorous warning: Expected component called \"${componentName}\" which uses withTheme to be within a ThemeProvider but none was found.`\n}\n\nexport default function withTheme(\n  ComponentToTheme,\n  {noWarn = false, createElement = true} = {},\n) {\n  class ThemedComponent extends React.Component {\n    static propTypes = {\n      theme: PropTypes.object,\n    }\n    warned = noWarn\n    state = {theme: {}}\n    setTheme = theme => this.setState({theme})\n\n    // eslint-disable-next-line complexity\n    componentWillMount() {\n      if (!this.context[CHANNEL]) {\n        if (process.env.NODE_ENV !== 'production' && !this.warned) {\n          this.warned = true\n          // eslint-disable-next-line no-console\n          console.warn(generateWarningMessage(ComponentToTheme))\n        }\n      }\n      const {theme} = this.props\n      if (this.context[CHANNEL]) {\n        // if a theme is provided via props,\n        // it takes precedence over context\n        this.setTheme(theme ? theme : this.context[CHANNEL].getState())\n      } else {\n        this.setTheme(theme || {})\n      }\n    }\n\n    componentWillReceiveProps(nextProps) {\n      if (this.props.theme !== nextProps.theme) {\n        this.setTheme(nextProps.theme)\n      }\n    }\n\n    componentDidMount() {\n      if (this.context[CHANNEL] && !this.props.theme) {\n        // subscribe to future theme changes\n        this.subscriptionId = this.context[CHANNEL].subscribe(this.setTheme)\n      }\n    }\n\n    componentWillUnmount() {\n      // cleanup subscription\n      this.subscriptionId &&\n        this.context[CHANNEL].unsubscribe(this.subscriptionId)\n    }\n\n    render() {\n      if (createElement) {\n        return <ComponentToTheme {...this.props} {...this.state} />\n      } else {\n        // this allows us to effectively use the GlamorousComponent\n        // as our `render` method without going through lifecycle hooks.\n        // Also allows us to forward the context in the scenario where\n        // a user wants to add more context.\n        // eslint-disable-next-line babel/new-cap\n        return ComponentToTheme.call(\n          this,\n          {...this.props, ...this.state},\n          this.context,\n        )\n      }\n    }\n  }\n\n  const defaultContextTypes = {\n    [CHANNEL]: PropTypes.object,\n  }\n\n  let userDefinedContextTypes = null\n\n  // configure the contextTypes to be settable by the user,\n  // however also retaining the glamorous channel.\n  Object.defineProperty(ThemedComponent, 'contextTypes', {\n    enumerable: true,\n    configurable: true,\n    set(value) {\n      userDefinedContextTypes = value\n    },\n    get() {\n      // if the user has provided a contextTypes definition,\n      // merge the default context types with the provided ones.\n      if (userDefinedContextTypes) {\n        return {\n          ...defaultContextTypes,\n          ...userDefinedContextTypes,\n        }\n      }\n      return defaultContextTypes\n    },\n  })\n\n  return ThemedComponent\n}\n","import {css} from 'glamor'\n/**\n * This function takes a className string and gets all the\n * associated glamor styles. It's used to merge glamor styles\n * from a className to make sure that specificity is not\n * a problem when passing a className to a component.\n * @param {String} [className=''] the className string\n * @return {Object} { glamorStyles, glamorlessClassName }\n *   - glamorStyles is an array of all the glamor styles objects\n *   - glamorlessClassName is the rest of the className string\n *     without the glamor classNames\n */\nfunction extractGlamorStyles(className) {\n  const glamorlessClassName = []\n  const glamorStyles = []\n  className\n    .toString()\n    .split(' ')\n    .forEach(name => {\n      if (name.indexOf('css-') === 0) {\n        const style = buildGlamorSrcFromClassName(name)\n        glamorStyles.push(style)\n      } else {\n        glamorlessClassName.push(name)\n      }\n    })\n\n  return {glamorlessClassName, glamorStyles}\n}\n\n/** Glamor's css function returns an object with the shape\n *\n * {\n *   [`data-css-${hash}`]: '',\n *   toString() { return `css-${hash}` }\n * }\n *\n * Whenever glamor's build function encounters an object with\n * this shape it just pulls the resulting styles from the cache.\n *\n * note: the toString method is not needed to qualify the shape\n **/\nfunction buildGlamorSrcFromClassName(className) {\n  return {[`data-${className}`]: ''}\n}\n\nexport default getGlamorClassName\n\nfunction getGlamorClassName({\n  styles,\n  props,\n  cssOverrides,\n  cssProp,\n  context,\n  displayName,\n}) {\n  const {mappedArgs, nonGlamorClassNames} = handleStyles(\n    [...styles, props.className, cssOverrides, cssProp],\n    props,\n    context,\n  )\n  // eslint-disable-next-line max-len\n  const isDev = process.env.NODE_ENV === 'development' || !process.env.NODE_ENV\n  const devRules = isDev ? {label: displayName} : null\n  const glamorClassName = css(devRules, ...mappedArgs).toString()\n  const extras = nonGlamorClassNames.join(' ').trim()\n  return `${glamorClassName} ${extras}`.trim()\n}\n\n// this next function is on a \"hot\" code-path\n// so it's pretty complex to make sure it's fast.\n// eslint-disable-next-line complexity\nfunction handleStyles(styles, props, context) {\n  let current\n  const mappedArgs = []\n  const nonGlamorClassNames = []\n  for (let i = 0; i < styles.length; i++) {\n    current = styles[i]\n    if (typeof current === 'function') {\n      const result = current(props, context)\n      if (typeof result === 'string') {\n        const {glamorStyles, glamorlessClassName} = extractGlamorStyles(result)\n        mappedArgs.push(...glamorStyles)\n        nonGlamorClassNames.push(...glamorlessClassName)\n      } else {\n        mappedArgs.push(result)\n      }\n    } else if (typeof current === 'string') {\n      const {glamorStyles, glamorlessClassName} = extractGlamorStyles(current)\n      mappedArgs.push(...glamorStyles)\n      nonGlamorClassNames.push(...glamorlessClassName)\n    } else if (Array.isArray(current)) {\n      const recursed = handleStyles(current, props, context)\n      mappedArgs.push(...recursed.mappedArgs)\n      nonGlamorClassNames.push(...recursed.nonGlamorClassNames)\n    } else {\n      mappedArgs.push(current)\n    }\n  }\n  return {mappedArgs, nonGlamorClassNames}\n}\n","/*\n * This is a relatively small abstraction that's ripe for open sourcing.\n * Documentation is in the README.md\n */\nimport React from 'react'\nimport {PropTypes} from './react-compat'\nimport withTheme from './with-theme'\nimport getGlamorClassName from './get-glamor-classname'\n\nexport default createGlamorous\n\nfunction createGlamorous(splitProps) {\n  return glamorous\n\n  /**\n   * This is the main export and the function that people\n   * interact with most directly.\n   *\n   * It accepts a component which can be a string or\n   * a React Component and returns\n   * a \"glamorousComponentFactory\"\n   * @param {String|ReactComponent} comp the component to render\n   * @param {Object} options helpful info for the GlamorousComponents\n   * @return {Function} the glamorousComponentFactory\n   */\n  function glamorous(comp, config = {}) {\n    const {\n      rootEl,\n      displayName,\n      shouldClassNameUpdate,\n      filterProps = [],\n      forwardProps = [],\n      propsAreCssOverrides = comp.propsAreCssOverrides,\n      withProps: basePropsToApply,\n    } = config\n    Object.assign(glamorousComponentFactory, {withConfig})\n    return glamorousComponentFactory\n\n    function withConfig(newConfig) {\n      return glamorous(comp, {...config, ...newConfig})\n    }\n\n    /**\n     * This returns a React Component that renders the comp (closure)\n     * with a className based on the given glamor styles object(s)\n     * @param {...Object|Function} styles the styles to create with glamor.\n     *   If any of these are functions, they are invoked with the component\n     *   props and the return value is used.\n     * @return {ReactComponent} the ReactComponent function\n     */\n    function glamorousComponentFactory(...styles) {\n      /**\n       * This is a component which will render the comp (closure)\n       * with the glamorous styles (closure). Forwards any valid\n       * props to the underlying component.\n       */\n      const GlamorousComponent = withTheme(\n        function GlamorousInnerComponent(props, context) {\n          props = getPropsToApply(\n            GlamorousComponent.propsToApply,\n            {},\n            props,\n            context,\n          )\n          const updateClassName = shouldUpdate(props, context, this.previous)\n\n          if (shouldClassNameUpdate) {\n            this.previous = {props, context}\n          }\n\n          const {toForward, cssOverrides, cssProp} = splitProps(\n            props,\n            GlamorousComponent,\n          )\n\n          // create className to apply\n          this.className = updateClassName\n            ? getGlamorClassName({\n                styles: GlamorousComponent.styles,\n                props,\n                cssOverrides,\n                cssProp,\n                context,\n                displayName: GlamorousComponent.displayName,\n              })\n            : this.className\n\n          return React.createElement(GlamorousComponent.comp, {\n            // if innerRef is forwarded we don't want to apply it here\n            ref: 'innerRef' in toForward ? undefined : props.innerRef,\n            ...toForward,\n            className: this.className,\n          })\n        },\n        {noWarn: true, createElement: false},\n      )\n\n      GlamorousComponent.propTypes = {\n        // className accepts an object due to glamor's css function\n        // returning an object with a toString method that gives the className\n        className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n        cssOverrides: PropTypes.object,\n        innerRef: PropTypes.func,\n        glam: PropTypes.object,\n      }\n\n      function withComponent(newComp, options = {}) {\n        const {\n          forwardProps: fwp,\n          filterProps: flp,\n          ...componentProperties\n        } = GlamorousComponent\n        return glamorous(\n          {\n            ...componentProperties,\n            comp: newComp,\n            rootEl: getRootEl(newComp),\n          },\n          {\n            // allows the forwardProps and filterProps to be overridden\n            forwardProps: fwp,\n            filterProps: flp,\n            ...options,\n          },\n        )()\n      }\n\n      function withProps(...propsToApply) {\n        return glamorous(GlamorousComponent, {withProps: propsToApply})()\n      }\n\n      function shouldUpdate(props, context, previous) {\n        // exiting early so components which do not use this\n        // optimization are not penalized by hanging onto\n        // references to previous props and context\n        if (!shouldClassNameUpdate) {\n          return true\n        }\n        let update = true\n        if (previous) {\n          if (\n            !shouldClassNameUpdate(\n              previous.props,\n              props,\n              previous.context,\n              context,\n            )\n          ) {\n            update = false\n          }\n        }\n\n        return update\n      }\n\n      Object.assign(\n        GlamorousComponent,\n        getGlamorousComponentMetadata({\n          comp,\n          styles,\n          rootEl,\n          filterProps,\n          forwardProps,\n          displayName,\n          propsToApply: basePropsToApply,\n        }),\n        {\n          isGlamorousComponent: true,\n          propsAreCssOverrides,\n          withComponent,\n          withProps,\n          withConfig,\n        },\n      )\n      return GlamorousComponent\n    }\n  }\n\n  function getGlamorousComponentMetadata({\n    comp,\n    styles,\n    rootEl,\n    filterProps,\n    forwardProps,\n    displayName,\n    propsToApply: basePropsToApply,\n  }) {\n    const componentsComp = comp.comp ? comp.comp : comp\n    const propsToApply = comp.propsToApply\n      ? [...comp.propsToApply, ...arrayify(basePropsToApply)]\n      : arrayify(basePropsToApply)\n    return {\n      // join styles together (for anyone doing: glamorous(glamorous.a({}), {}))\n      styles: when(comp.styles, styles),\n      // keep track of the ultimate rootEl to render (we never\n      // actually render anything but\n      // the base component, even when people wrap a glamorous\n      // component in glamorous\n      comp: componentsComp,\n      rootEl: rootEl || getRootEl(comp),\n      // join forwardProps and filterProps\n      // (for anyone doing: glamorous(glamorous.a({}), {}))\n      forwardProps: when(comp.forwardProps, forwardProps),\n      filterProps: when(comp.filterProps, filterProps),\n      // set the displayName to something that's slightly more\n      // helpful than `GlamorousComponent` :)\n      displayName: displayName || `glamorous(${getDisplayName(comp)})`,\n      // these are props that should be applied to the component at render time\n      propsToApply,\n    }\n  }\n}\n\n/**\n * reduces the propsToApply given to a single props object\n * @param {Array} propsToApply an array of propsToApply objects:\n *   - object\n *   - array of propsToApply items\n *   - function that accepts the accumulated props and the context\n * @param {Object} accumulator an object to apply props onto\n * @param {Object} props the props that should ultimately take precedence\n * @param {*} context the context object\n * @return {Object} the reduced props\n */\nfunction getPropsToApply(propsToApply, accumulator, props, context) {\n  // using forEach rather than reduce here because the reduce solution\n  // effectively did the same thing because we manipulate the `accumulator`\n  propsToApply.forEach(propsToApplyItem => {\n    if (typeof propsToApplyItem === 'function') {\n      return Object.assign(\n        accumulator,\n        propsToApplyItem(Object.assign({}, accumulator, props), context),\n      )\n    } else if (Array.isArray(propsToApplyItem)) {\n      return Object.assign(\n        accumulator,\n        getPropsToApply(propsToApplyItem, accumulator, props, context),\n      )\n    }\n    return Object.assign(accumulator, propsToApplyItem)\n  })\n  // props wins\n  return Object.assign(accumulator, props)\n}\n\nfunction arrayify(x = []) {\n  return Array.isArray(x) ? x : [x]\n}\n\nfunction when(comp, prop) {\n  return comp ? comp.concat(prop) : prop\n}\n\nfunction getRootEl(comp) {\n  return comp.rootEl ? comp.rootEl : comp.comp || comp\n}\n\nfunction getDisplayName(comp) {\n  return typeof comp === 'string'\n    ? comp\n    : comp.displayName || comp.name || 'unknown'\n}\n","/* eslint no-unused-vars:0 */\nimport createGlamorous from './create-glamorous'\n\nfunction splitProps(\n  {\n    css: cssProp,\n    innerRef,\n    // these are plucked off\n    theme, // because they\n    className, // should never\n    glam, // be forwarded\n    // to the lower\n    // component ever\n    ...rest\n  },\n  {forwardProps},\n) {\n  // forward innerRef if user wishes to do so\n  if (innerRef !== undefined && forwardProps.indexOf('innerRef') !== -1) {\n    rest.innerRef = innerRef\n  }\n  return {toForward: rest, cssProp}\n}\n\nconst glamorous = createGlamorous(splitProps)\n\nexport default glamorous\n"],"names":["CHANNEL","isPreact","PropTypes","React","forEach","type","Children","children","fn","ctx","toArray","bind","map","length","Error","concat","parseFloat","version","slice","error","generateWarningMessage","Comp","componentName","displayName","name","withTheme","ComponentToTheme","noWarn","createElement","ThemedComponent","warned","state","theme","setTheme","setState","context","warn","props","getState","nextProps","subscriptionId","subscribe","unsubscribe","call","Component","propTypes","object","defaultContextTypes","userDefinedContextTypes","defineProperty","value","extractGlamorStyles","className","glamorlessClassName","glamorStyles","toString","split","indexOf","style","buildGlamorSrcFromClassName","push","getGlamorClassName","styles","cssOverrides","cssProp","handleStyles","mappedArgs","nonGlamorClassNames","devRules","label","glamorClassName","css","extras","join","trim","current","i","result","Array","isArray","recursed","createGlamorous","splitProps","glamorous","comp","config","rootEl","shouldClassNameUpdate","filterProps","forwardProps","propsAreCssOverrides","basePropsToApply","withProps","assign","glamorousComponentFactory","withConfig","newConfig","GlamorousComponent","getPropsToApply","propsToApply","updateClassName","shouldUpdate","previous","toForward","undefined","innerRef","oneOfType","string","func","update","getGlamorousComponentMetadata","newComp","options","fwp","flp","componentProperties","getRootEl","componentsComp","arrayify","when","getDisplayName","accumulator","propsToApplyItem","Object","x","prop","glam","rest"],"mappings":";;;;;;;;AAGO,IAAMA,UAAU,eAAhB;;AACP,AAAO,IAAMC,WAJL,KAID;;ACAP,IAAIC,mBAAJ;;;AAGA,IAAID,QAAJ,EAAc;MACR,CAACE,MAAMD,SAAX,EAAsB;iBACR;aAAMA,UAAN;KAAZ;;KAEE,OADe,EAEf,MAFe,EAGf,MAHe,EAIf,QAJe,EAKf,QALe,EAMf,QANe,EAOf,QAPe,EA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