{"size": 2041, "ext": "js", "max_stars_repo_path": "src/Text/styles.js", "max_stars_repo_name": "jaredlunde/styled-curls", "max_stars_repo_stars_event_min_datetime": "2018-11-20T19:17:29.000Z", "max_stars_repo_stars_event_max_datetime": "2019-02-27T17:43:57.000Z", "max_issues_repo_path": "src/Text/styles.js", "max_issues_repo_name": "jaredlunde/styled-curls", "max_issues_repo_issues_event_min_datetime": "2019-12-29T20:43:23.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-16T18:07:11.000Z", "max_forks_repo_path": "src/Text/styles.js", "max_forks_repo_name": "jaredLunde/styled-curls", "max_forks_repo_forks_event_min_datetime": "2019-09-22T10:41:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-22T10:41:02.000Z"}
{"max_stars_count": 2, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 19.0747663551, "max_line_length": 89, "alphanum_fraction": 0.5805977462}
import {css} from '@emotion/core'
import {colorize, memoTheme, memoValue, unit, get} from '../utils'
import * as dT from './defaultTheme'

export const weight = {
  '100': css`
    font-weight: 100;
  `,
  '200': css`
    font-weight: 200;
  `,
  '300': css`
    font-weight: 300;
  `,
  '400': css`
    font-weight: 400;
  `,
  '500': css`
    font-weight: 500;
  `,
  '600': css`
    font-weight: 600;
  `,
  '700': css`
    font-weight: 700;
  `,
  '800': css`
    font-weight: 800;
  `,
  '900': css`
    font-weight: 900;
  `,
}

export const size = memoTheme((size, theme) => {
  let scale = get(theme.text, 'scale', dT),
    fontSize = scale[size],
    typeOfFontSize = typeof fontSize

  if (typeOfFontSize === 'function') fontSize = fontSize(theme)
  else if (typeOfFontSize !== 'object')
    fontSize = css`
      font-size: ${unit(fontSize, get(theme.text, 'sizeUnit', dT))};
    `

  const isLeg = get(theme.text, 'legible', dT).indexOf(size) > -1
  return css`
    ${fontSize};
    ${optimizeFor[isLeg ? 'legibility' : 'speed']};
    ${isLeg && antialias};
  `
})

export const family = memoTheme(
  (v, t) =>
    css`
      font-family: ${get(t.text, 'families', dT)[v] || v};
    `
)

export const lineHeight = memoValue(
  v =>
    css`
      line-height: ${v};
    `
)

export const color = (v, t) => colorize('color', v, t) // colorize implements nullIfFalse

export const aligned = {
  left: css`
    text-align: left;
  `,
  center: css`
    text-align: center;
  `,
  right: css`
    text-align: right;
  `,
  justified: css`
    text-align: justify;
  `,
  inherit: css`
    text-align: inherit;
  `,
}

export const optimizeFor = {
    speed: css`
      text-rendering: speed;
    `,
    legibility: css`
      text-rendering: optimizeLegibility;
    `,
  },
  antialias = css`
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
  `,
  ellipsis = css`
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-x: hidden;
  `
