styled-components
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -11,5 +11,5 @@ 'use strict'; | ||
var _element = require('./element'); | ||
var _StyledComponent = require('../models/StyledComponent'); | ||
var _element2 = _interopRequireDefault(_element); | ||
var _StyledComponent2 = _interopRequireDefault(_StyledComponent); | ||
@@ -25,3 +25,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return (0, _element2.default)(tag, _css2.default.apply(undefined, [strings].concat(interpolations))); | ||
return (0, _StyledComponent2.default)(tag, _css2.default.apply(undefined, [strings].concat(interpolations))); | ||
}; | ||
@@ -28,0 +28,0 @@ }; |
@@ -15,5 +15,5 @@ 'use strict'; | ||
var _element = require('../element'); | ||
var _StyledComponent = require('../../models/StyledComponent'); | ||
var _element2 = _interopRequireDefault(_element); | ||
var _StyledComponent2 = _interopRequireDefault(_StyledComponent); | ||
@@ -31,3 +31,3 @@ var _css = require('../css'); | ||
var tagName = 'div'; | ||
(0, _expect2.default)((0, _styled2.default)(tagName)(_templateObject)).toEqual((0, _element2.default)(tagName, (0, _css2.default)('background-color: blue'))); | ||
(0, _expect2.default)((0, _styled2.default)(tagName)(_templateObject)).toEqual((0, _StyledComponent2.default)(tagName, (0, _css2.default)('background-color: blue'))); | ||
}); | ||
@@ -38,3 +38,3 @@ | ||
var bgColor = 'blue'; | ||
(0, _expect2.default)((0, _styled2.default)(tagName)(_templateObject2, bgColor)).toEqual((0, _element2.default)(tagName, (0, _css2.default)(_templateObject2, bgColor))); | ||
(0, _expect2.default)((0, _styled2.default)(tagName)(_templateObject2, bgColor)).toEqual((0, _StyledComponent2.default)(tagName, (0, _css2.default)(_templateObject2, bgColor))); | ||
}); | ||
@@ -47,3 +47,3 @@ | ||
}; | ||
(0, _expect2.default)((0, _styled2.default)(tagName)('' + styles)).toEqual((0, _element2.default)(tagName, (0, _css2.default)(_templateObject3, styles))); | ||
(0, _expect2.default)((0, _styled2.default)(tagName)('' + styles)).toEqual((0, _StyledComponent2.default)(tagName, (0, _css2.default)(_templateObject3, styles))); | ||
}); | ||
@@ -50,0 +50,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.toggle = exports.css = undefined; | ||
exports.inherit = exports.define = exports.toggle = exports.css = undefined; | ||
@@ -21,2 +21,10 @@ var _css = require('./constructors/css'); | ||
var _define = require('./constructors/define'); | ||
var _define2 = _interopRequireDefault(_define); | ||
var _inherit = require('./constructors/inherit'); | ||
var _inherit2 = _interopRequireDefault(_inherit); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -26,2 +34,4 @@ | ||
exports.toggle = _toggle2.default; | ||
exports.define = _define2.default; | ||
exports.inherit = _inherit2.default; | ||
/** | ||
@@ -28,0 +38,0 @@ * Export constructors for consumption by users |
@@ -19,3 +19,3 @@ 'use strict'; | ||
var _parse = require('../vendor/postcss/parse'); | ||
var _parse = require('../vendor/postcss-safe-parser/parse'); | ||
@@ -36,4 +36,3 @@ var _parse2 = _interopRequireDefault(_parse); | ||
var styleSheet = new _sheet.StyleSheet(); | ||
styleSheet.inject(); | ||
var styleSheet = new _sheet.StyleSheet({ speedy: false, maxLength: 40 }); | ||
var inserted = {}; | ||
@@ -64,2 +63,3 @@ | ||
value: function injectStyles(executionContext) { | ||
if (!styleSheet.injected) styleSheet.inject(); | ||
var flatCSS = (0, _flatten2.default)(this.rules, executionContext).join(''); | ||
@@ -66,0 +66,0 @@ var hash = (0, _hash2.default)(flatCSS); |
{ | ||
"name": "styled-components", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "", | ||
@@ -34,3 +34,3 @@ "main": "lib/index.js", | ||
"lodash": "^4.15.0", | ||
"react": "^15.3.0", | ||
"react": "^15.3.2", | ||
"supports-color": "^3.1.2" | ||
@@ -37,0 +37,0 @@ }, |
// @flow | ||
import css from './css' | ||
import element from './element' | ||
import styledComponent from '../models/StyledComponent' | ||
import type { Interpolation } from '../types' | ||
@@ -9,3 +9,3 @@ | ||
(strings: Array<string>, ...interpolations: Array<Interpolation>) => | ||
element(tag, css(strings, ...interpolations)) | ||
styledComponent(tag, css(strings, ...interpolations)) | ||
@@ -12,0 +12,0 @@ export default styled |
import expect from 'expect' | ||
import styled from '../styled' | ||
import element from '../element' | ||
import styledComponent from '../../models/StyledComponent' | ||
import css from '../css' | ||
@@ -10,3 +10,3 @@ | ||
expect(styled(tagName)`background-color: blue;`) | ||
.toEqual(element(tagName, css('background-color: blue'))) | ||
.toEqual(styledComponent(tagName, css('background-color: blue'))) | ||
}) | ||
@@ -18,3 +18,3 @@ | ||
expect(styled(tagName)`background-color: ${bgColor};`) | ||
.toEqual(element(tagName, css`background-color: ${bgColor};`)) | ||
.toEqual(styledComponent(tagName, css`background-color: ${bgColor};`)) | ||
}) | ||
@@ -27,3 +27,3 @@ | ||
} | ||
expect(styled(tagName)(`${styles}`)).toEqual(element(tagName, css`${styles}`)) | ||
expect(styled(tagName)(`${styles}`)).toEqual(styledComponent(tagName, css`${styles}`)) | ||
}) | ||
@@ -30,0 +30,0 @@ |
@@ -9,7 +9,7 @@ // @flow | ||
import styled from './constructors/styled' | ||
import define from './constructors/define' | ||
import inherit from './constructors/inherit' | ||
export { | ||
css, toggle, | ||
} | ||
export { css, toggle, define, inherit } | ||
export default styled |
@@ -7,8 +7,7 @@ // @flow | ||
import flatten from '../utils/flatten' | ||
import parse from '../vendor/postcss/parse' | ||
import parse from '../vendor/postcss-safe-parser/parse' | ||
import postcssNested from '../vendor/postcss-nested' | ||
import toEmoji from '../utils/toEmoji' | ||
const styleSheet = new StyleSheet() | ||
styleSheet.inject() | ||
const styleSheet = new StyleSheet({ speedy: false, maxLength: 40 }) | ||
const inserted = {} | ||
@@ -34,2 +33,3 @@ | ||
injectStyles(executionContext: Array<any>) { | ||
if (!styleSheet.injected) styleSheet.inject() | ||
const flatCSS = flatten(this.rules, executionContext).join('') | ||
@@ -36,0 +36,0 @@ const hash = hashStr(flatCSS) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
439303
100
11444
Updatedreact@^15.3.2