styled-components
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.global = exports.toggle = exports.css = undefined; | ||
exports.keyframes = exports.global = exports.toggle = exports.css = undefined; | ||
@@ -25,4 +25,12 @@ var _css = require('./constructors/css'); | ||
var _keyframes = require('./constructors/keyframes'); | ||
var _keyframes2 = _interopRequireDefault(_keyframes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.css = _css2.default; | ||
exports.toggle = _toggle2.default; | ||
exports.global = _global2.default; | ||
exports.keyframes = _keyframes2.default; | ||
/** | ||
@@ -32,5 +40,2 @@ * Export constructors for consumption by users | ||
exports.css = _css2.default; | ||
exports.toggle = _toggle2.default; | ||
exports.global = _global2.default; | ||
exports.default = _styled2.default; |
@@ -9,8 +9,2 @@ 'use strict'; | ||
var _sheet = require('glamor/lib/sheet'); | ||
var _flatten = require('../utils/flatten'); | ||
var _flatten2 = _interopRequireDefault(_flatten); | ||
var _parse = require('../vendor/postcss-safe-parser/parse'); | ||
@@ -20,2 +14,4 @@ | ||
var _sheet = require('../vendor/glamor/sheet'); | ||
var _postcssNested = require('../vendor/postcss-nested'); | ||
@@ -25,2 +21,6 @@ | ||
var _flatten = require('../utils/flatten'); | ||
var _flatten2 = _interopRequireDefault(_flatten); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -33,6 +33,7 @@ | ||
var ComponentStyle = function () { | ||
function ComponentStyle(rules) { | ||
function ComponentStyle(rules, selector) { | ||
_classCallCheck(this, ComponentStyle); | ||
this.rules = rules; | ||
this.selector = selector; | ||
} | ||
@@ -45,2 +46,5 @@ | ||
var flatCSS = (0, _flatten2.default)(this.rules).join(''); | ||
if (this.selector) { | ||
flatCSS = this.selector + ' {' + flatCSS + '\n}'; | ||
} | ||
var root = (0, _parse2.default)(flatCSS); | ||
@@ -47,0 +51,0 @@ (0, _postcssNested2.default)(root); |
@@ -37,3 +37,3 @@ 'use strict'; | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(StyledComponent).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (StyledComponent.__proto__ || Object.getPrototypeOf(StyledComponent)).apply(this, arguments)); | ||
} | ||
@@ -40,0 +40,0 @@ |
@@ -35,3 +35,3 @@ 'use strict'; | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(SafeParser).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (SafeParser.__proto__ || Object.getPrototypeOf(SafeParser)).apply(this, arguments)); | ||
} | ||
@@ -38,0 +38,0 @@ |
@@ -51,3 +51,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AtRule).call(this, defaults)); | ||
var _this = _possibleConstructorReturn(this, (AtRule.__proto__ || Object.getPrototypeOf(AtRule)).call(this, defaults)); | ||
@@ -69,3 +69,3 @@ _this.type = 'atrule'; | ||
return (_get2 = _get(Object.getPrototypeOf(AtRule.prototype), 'append', this)).call.apply(_get2, [this].concat(children)); | ||
return (_get2 = _get(AtRule.prototype.__proto__ || Object.getPrototypeOf(AtRule.prototype), 'append', this)).call.apply(_get2, [this].concat(children)); | ||
} | ||
@@ -83,3 +83,3 @@ }, { | ||
return (_get3 = _get(Object.getPrototypeOf(AtRule.prototype), 'prepend', this)).call.apply(_get3, [this].concat(children)); | ||
return (_get3 = _get(AtRule.prototype.__proto__ || Object.getPrototypeOf(AtRule.prototype), 'prepend', this)).call.apply(_get3, [this].concat(children)); | ||
} | ||
@@ -86,0 +86,0 @@ }, { |
@@ -39,3 +39,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Comment).call(this, defaults)); | ||
var _this = _possibleConstructorReturn(this, (Comment.__proto__ || Object.getPrototypeOf(Comment)).call(this, defaults)); | ||
@@ -42,0 +42,0 @@ _this.type = 'comment'; |
@@ -75,3 +75,3 @@ 'use strict'; | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Container).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments)); | ||
} | ||
@@ -533,3 +533,3 @@ | ||
value: function cleanRaws(keepBetween) { | ||
_get(Object.getPrototypeOf(Container.prototype), 'cleanRaws', this).call(this, keepBetween); | ||
_get(Container.prototype.__proto__ || Object.getPrototypeOf(Container.prototype), 'cleanRaws', this).call(this, keepBetween); | ||
if (this.nodes) { | ||
@@ -672,3 +672,3 @@ var _iteratorNormalCompletion5 = true; | ||
} else { | ||
_get(Object.getPrototypeOf(Container.prototype), 'remove', this).call(this); | ||
_get(Container.prototype.__proto__ || Object.getPrototypeOf(Container.prototype), 'remove', this).call(this); | ||
} | ||
@@ -675,0 +675,0 @@ return this; |
@@ -42,3 +42,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Declaration).call(this, defaults)); | ||
var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this, defaults)); | ||
@@ -45,0 +45,0 @@ _this.type = 'decl'; |
@@ -43,3 +43,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Root).call(this, defaults)); | ||
var _this = _possibleConstructorReturn(this, (Root.__proto__ || Object.getPrototypeOf(Root)).call(this, defaults)); | ||
@@ -60,3 +60,3 @@ _this.type = 'root'; | ||
return _get(Object.getPrototypeOf(Root.prototype), 'removeChild', this).call(this, child); | ||
return _get(Root.prototype.__proto__ || Object.getPrototypeOf(Root.prototype), 'removeChild', this).call(this, child); | ||
} | ||
@@ -66,3 +66,3 @@ }, { | ||
value: function normalize(child, sample, type) { | ||
var nodes = _get(Object.getPrototypeOf(Root.prototype), 'normalize', this).call(this, child); | ||
var nodes = _get(Root.prototype.__proto__ || Object.getPrototypeOf(Root.prototype), 'normalize', this).call(this, child); | ||
@@ -69,0 +69,0 @@ if (sample) { |
@@ -46,3 +46,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Rule).call(this, defaults)); | ||
var _this = _possibleConstructorReturn(this, (Rule.__proto__ || Object.getPrototypeOf(Rule)).call(this, defaults)); | ||
@@ -49,0 +49,0 @@ _this.type = 'rule'; |
{ | ||
"name": "styled-components", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"build": "babel --out-dir lib src", | ||
"build:watch": "npm run build -- --watch", | ||
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min", | ||
"prebuild:lib": "rm -rf lib/*", | ||
"build:lib": "babel --out-dir lib src", | ||
"prebuild:umd": "rm -rf dist/*", | ||
"build:umd": "webpack --config webpack.config.js src/index.js dist/styled-components.js", | ||
"build:umd:min": "cross-env MINIFY_JS=true webpack --config webpack.config.js src/index.js dist/styled-components.min.js", | ||
"build:watch": "npm run build:lib -- --watch", | ||
"test": "mocha \"./src/**/*.test.js\" --require babel-core/register", | ||
@@ -13,3 +18,4 @@ "test:watch": "npm run test -- --watch", | ||
"lint": "eslint src", | ||
"prepublish": "rm -rf lib/* && npm run build" | ||
"prepublish": "npm run build", | ||
"lint-staged": "lint-staged" | ||
}, | ||
@@ -42,9 +48,9 @@ "repository": { | ||
"babel-cli": "^6.14.0", | ||
"babel-core": "^6.13.2", | ||
"babel-eslint": "^6.1.2", | ||
"babel-loader": "^6.2.5", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-flow-strip-types": "^6.14.0", | ||
"babel-preset-es2015": "^6.13.2", | ||
"babel-preset-es2016": "^6.11.3", | ||
"babel-preset-latest": "^6.14.0", | ||
"babel-preset-react": "^6.11.1", | ||
"cross-env": "^3.1.1", | ||
"eslint": "^3.5.0", | ||
@@ -57,9 +63,11 @@ "eslint-config-airbnb": "^11.1.0", | ||
"flow-bin": "^0.32.0", | ||
"lint-staged": "^3.0.3", | ||
"mocha": "^3.0.2", | ||
"proxyquire": "^1.7.10" | ||
"pre-commit": "^1.1.3", | ||
"proxyquire": "^1.7.10", | ||
"webpack": "^1.13.2" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"es2016", | ||
"latest", | ||
"react" | ||
@@ -71,3 +79,10 @@ ], | ||
] | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
}, | ||
"pre-commit": "lint-staged" | ||
} |
@@ -10,5 +10,6 @@ // @flow | ||
import global from './constructors/global' | ||
import keyframes from './constructors/keyframes' | ||
export { css, toggle, global } | ||
export { css, toggle, global, keyframes } | ||
export default styled |
@@ -1,7 +0,8 @@ | ||
import { StyleSheet } from 'glamor/lib/sheet' | ||
// @flow | ||
import parse from '../vendor/postcss-safe-parser/parse' | ||
import { StyleSheet } from '../vendor/glamor/sheet' | ||
import postcssNested from '../vendor/postcss-nested' | ||
import type { RuleSet } from '../types' | ||
import flatten from '../utils/flatten' | ||
import parse from '../vendor/postcss-safe-parser/parse' | ||
import postcssNested from '../vendor/postcss-nested' | ||
@@ -12,5 +13,7 @@ const styleSheet = new StyleSheet({ speedy: false, maxLength: 40 }) | ||
rules: RuleSet | ||
selector: ?string | ||
constructor(rules: RuleSet) { | ||
constructor(rules: RuleSet, selector: ?string) { | ||
this.rules = rules | ||
this.selector = selector | ||
} | ||
@@ -20,3 +23,6 @@ | ||
if (!styleSheet.injected) styleSheet.inject() | ||
const flatCSS = flatten(this.rules).join('') | ||
let flatCSS = flatten(this.rules).join('') | ||
if (this.selector) { | ||
flatCSS = `${this.selector} {${flatCSS}\n}` | ||
} | ||
const root = parse(flatCSS) | ||
@@ -23,0 +29,0 @@ postcssNested(root) |
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
1290999
108
29166
20