jss-isolate
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -14,10 +14,10 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ // Create a new module (and put it into the cache) | ||
@@ -29,23 +29,23 @@ /******/ var module = installedModules[moduleId] = { | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
@@ -60,17 +60,17 @@ /******/ return __webpack_require__(0); | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.default = jssIsolate; | ||
exports['default'] = jssIsolate; | ||
var _reset = __webpack_require__(1); | ||
var _reset2 = _interopRequireDefault(_reset); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var debounce = function debounce(fn) { | ||
@@ -82,3 +82,3 @@ var timeoutId = void 0; | ||
} | ||
clearTimeout(timeoutId); | ||
@@ -90,14 +90,14 @@ timeoutId = setTimeout(function () { | ||
}; | ||
var setSelector = debounce(function (rule, selectors) { | ||
rule.selector = selectors.join(',\n'); | ||
}); | ||
function jssIsolate() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var sheet = void 0; | ||
var resetRule = void 0; | ||
var selectors = []; | ||
return function (rule) { | ||
@@ -118,3 +118,3 @@ if (rule.type !== 'regular') return; | ||
}); | ||
var mergedReset = options.reset ? _extends({}, _reset2.default, options.reset) : _reset2.default; | ||
var mergedReset = options.reset ? _extends({}, _reset2['default'], options.reset) : _reset2['default']; | ||
resetRule = sheet.addRule('reset', mergedReset); | ||
@@ -135,7 +135,7 @@ sheet.attach(); | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = { | ||
exports['default'] = { | ||
'border-collapse': 'separate', | ||
@@ -172,2 +172,3 @@ 'border-spacing': '0', | ||
}); | ||
; | ||
; | ||
//# sourceMappingURL=jss-isolate.js.map |
@@ -1,1 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jssIsolate=t():e.jssIsolate=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=void 0,o=void 0,n=[];return function(r){if("regular"===r.type&&r.options.sheet!==t&&r.options.sheet.options.isolate!==!1&&(!r.options.parent||"keyframe"!==r.options.parent.type)){if(r.style&&r.style.isolate===!1)return void delete r.style.isolate;if(!t&&r.options.jss){t=r.options.jss.createStyleSheet({},{link:!0,meta:"jss-isolate"});var s=e.reset?i({},a["default"],e.reset):a["default"];o=t.addRule("reset",s),t.attach()}n.indexOf(r.selector)===-1&&n.push(r.selector),u(o,n)}}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e};t["default"]=r;var s=o(1),a=n(s),l=function(e){var t=void 0;return function(){for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];clearTimeout(t),t=setTimeout(function(){return e.apply(void 0,n)})}},u=l(function(e,t){e.selector=t.join(",\n")})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={"border-collapse":"separate","border-spacing":"0","caption-side":"top",cursor:"auto",direction:"ltr","empty-cells":"show","font-family":"serif","font-size":"medium","font-style":"normal","font-variant":"normal","font-weight":"normal","font-stretch":"normal","line-height":"normal",hyphens:"none","letter-spacing":"normal","list-style":"disc outside none","tab-size":"8","text-align":"left","text-align-last":"auto","text-indent":"0","text-shadow":"none","text-transform":"none",visibility:"visible","white-space":"normal",widows:"2","word-spacing":"normal"}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jssIsolate=t():e.jssIsolate=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=void 0,o=void 0,n=[];return function(r){if("regular"===r.type&&r.options.sheet!==t&&r.options.sheet.options.isolate!==!1&&(!r.options.parent||"keyframe"!==r.options.parent.type)){if(r.style&&r.style.isolate===!1)return void delete r.style.isolate;if(!t&&r.options.jss){t=r.options.jss.createStyleSheet({},{link:!0,meta:"jss-isolate"});var s=e.reset?i({},a.default,e.reset):a.default;o=t.addRule("reset",s),t.attach()}n.indexOf(r.selector)===-1&&n.push(r.selector),u(o,n)}}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e};t.default=r;var s=o(1),a=n(s),l=function(e){var t=void 0;return function(){for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];clearTimeout(t),t=setTimeout(function(){return e.apply(void 0,n)})}},u=l(function(e,t){e.selector=t.join(",\n")})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={"border-collapse":"separate","border-spacing":"0","caption-side":"top",cursor:"auto",direction:"ltr","empty-cells":"show","font-family":"serif","font-size":"medium","font-style":"normal","font-variant":"normal","font-weight":"normal","font-stretch":"normal","line-height":"normal",hyphens:"none","letter-spacing":"normal","list-style":"disc outside none","tab-size":"8","text-align":"left","text-align-last":"auto","text-indent":"0","text-shadow":"none","text-transform":"none",visibility:"visible","white-space":"normal",widows:"2","word-spacing":"normal"}}])}); | ||
//# sourceMappingURL=jss-isolate.min.js.map |
@@ -9,3 +9,3 @@ 'use strict'; | ||
exports.default = jssIsolate; | ||
exports['default'] = jssIsolate; | ||
@@ -16,3 +16,3 @@ var _reset = require('./reset'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -38,3 +38,3 @@ var debounce = function debounce(fn) { | ||
function jssIsolate() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -60,3 +60,3 @@ var sheet = void 0; | ||
}); | ||
var mergedReset = options.reset ? _extends({}, _reset2.default, options.reset) : _reset2.default; | ||
var mergedReset = options.reset ? _extends({}, _reset2['default'], options.reset) : _reset2['default']; | ||
resetRule = sheet.addRule('reset', mergedReset); | ||
@@ -63,0 +63,0 @@ sheet.attach(); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.default = { | ||
exports['default'] = { | ||
'border-collapse': 'separate', | ||
@@ -9,0 +9,0 @@ 'border-spacing': '0', |
{ | ||
"name": "jss-isolate", | ||
"description": "True rules isolation through automatic inheritable properties reset.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -11,5 +11,8 @@ "name": "Maksim Koretskiy", | ||
"type": "git", | ||
"url": "git@github.com:jsstyles/jss-isolate.git" | ||
"url": "git@github.com:cssinjs/jss-isolate.git" | ||
}, | ||
"keywords": [ | ||
"cssinnjs", | ||
"css-in-js", | ||
"css in js", | ||
"jss", | ||
@@ -22,31 +25,52 @@ "plugin", | ||
"scripts": { | ||
"all": "npm run lint && npm run build", | ||
"test": "opener ./test/index.html", | ||
"build": "npm run clean && npm run build:lib && npm run build:max && npm run build:min", | ||
"clean": "rimraf ./lib/*", | ||
"all": "npm run lint && npm run test && npm run build", | ||
"build": "npm run clean && npm run build:lib && npm run build:tests && npm run build:dist", | ||
"build:lib": "babel src --out-dir lib", | ||
"build:max": "NODE_ENV=development webpack src/index.js dist/jss-isolate.js", | ||
"build:min": "NODE_ENV=production webpack src/index.js dist/jss-isolate.min.js", | ||
"build:watch": "npm run build:max -- -w", | ||
"build:tests": "npm run build:tests:lib && npm run build:tests:local", | ||
"build:tests:lib": "cross-env NODE_ENV=test babel src --out-dir tests", | ||
"build:tests:local": "cross-env NODE_ENV=test webpack src/index.test.js tmp/tests.js", | ||
"build:dist": "npm run build:dist:max && npm run build:dist:min", | ||
"build:dist:max": "cross-env NODE_ENV=development webpack src/index.js dist/jss-isolate.js", | ||
"build:dist:min": "cross-env NODE_ENV=production webpack src/index.js dist/jss-isolate.min.js", | ||
"clean": "rimraf {lib,dist,tests,tmp}/*", | ||
"lint": "eslint ./src", | ||
"prepublish": "npm run all && git push --tags" | ||
"lint:staged": "lint-staged", | ||
"test": "cross-env NODE_ENV=test karma start --single-run ", | ||
"test:watch": "cross-env NODE_ENV=test karma start", | ||
"prepublish": "npm run all" | ||
}, | ||
"license": "MIT", | ||
"main": "./lib/index.js", | ||
"main": "lib/index.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.5.1", | ||
"babel-core": "^6.5.1", | ||
"babel-eslint": "^6.1.2", | ||
"babel-eslint": "^7.1.0", | ||
"babel-loader": "^6.2.4", | ||
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0", | ||
"babel-plugin-transform-es3-property-literals": "^6.8.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"eslint": "^2.8.0", | ||
"eslint-config-airbnb": "^8.0.0", | ||
"eslint-config-jss": "^1.1.0", | ||
"eslint-plugin-import": "^1.12.0", | ||
"eslint-plugin-jsx-a11y": "^1.5.5", | ||
"eslint-plugin-react": "^5.0.1", | ||
"jss": "^5.2.0", | ||
"opener": "^1.4.1", | ||
"qunitjs": "^1.21.0", | ||
"cross-env": "^3.1.3", | ||
"es5-shim": "^4.5.9", | ||
"eslint": "^3.9.1", | ||
"eslint-config-airbnb": "^12.0.0", | ||
"eslint-config-jss": "^2.4.0", | ||
"eslint-plugin-import": "^2.1.0", | ||
"eslint-plugin-jsx-a11y": "^2.2.3", | ||
"eslint-plugin-react": "^6.5.0", | ||
"expect.js": "^0.3.1", | ||
"jss": "^5.5.2", | ||
"karma": "^1.1.1", | ||
"karma-benchmark": "^0.6.0", | ||
"karma-benchmark-reporter": "^0.1.1", | ||
"karma-browserstack-launcher": "^1.0.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-mocha": "^1.1.1", | ||
"karma-mocha-reporter": "^2.2.0", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^1.8.0", | ||
"lint-staged": "^3.0.3", | ||
"mocha": "^3.0.2", | ||
"pre-commit": "^1.1.3", | ||
"rimraf": "^2.5.4", | ||
@@ -56,4 +80,11 @@ "webpack": "^1.13.1" | ||
"peerDependencies": { | ||
"jss": "^5.2.0" | ||
} | ||
"jss": "^5.5.6" | ||
}, | ||
"lint-staged": { | ||
"./src/*.js": [ | ||
"eslint", | ||
"git add" | ||
] | ||
}, | ||
"pre-commit": "lint:staged" | ||
} |
@@ -12,2 +12,6 @@ ![JSS logo](https://avatars1.githubusercontent.com/u/9503099?v=3&s=60) | ||
Make sure you read [how to use | ||
plugins](https://github.com/cssinjs/jss/blob/master/docs/setup.md#setup-with-plugins) | ||
in general. | ||
[Demo](http://cssinjs.github.io/examples/index.html#plugin-jss-isolate) - | ||
@@ -18,3 +22,2 @@ [JSS](https://github.com/cssinjs/jss) | ||
## Usage example | ||
@@ -24,23 +27,24 @@ | ||
import jss from 'jss' | ||
import jssIsolate from 'jss-isolate' | ||
import preset from 'jss-preset-default' | ||
import isolate from 'jss-isolate' | ||
jss.use(jssIsolate()) | ||
jss.setup(preset()).use(isolate()) | ||
const sheet = jss.createStyleSheet({ | ||
// All atRules will be ignored in reset. | ||
'@font-face': { | ||
'font-family': 'MyHelvetica', | ||
src: 'local("Helvetica")', | ||
}, | ||
title: { | ||
'font-size': '20px', | ||
background: '#f00', | ||
}, | ||
link: { | ||
'font-size': '12px', | ||
}, | ||
article: { | ||
margin: '20px 10px 30px', | ||
isolate: false // This rule will be ignored in reset. | ||
} | ||
// All atRules will be ignored in reset. | ||
'@font-face': { | ||
fontFamily: 'MyHelvetica', | ||
src: 'local("Helvetica")', | ||
}, | ||
title: { | ||
fontSize: 20, | ||
background: '#f00', | ||
}, | ||
link: { | ||
fontSize: 12, | ||
}, | ||
article: { | ||
isolate: false, // This rule will be ignored in reset. | ||
margin: '20px 10px 30px' | ||
} | ||
}) | ||
@@ -75,3 +79,3 @@ | ||
```javascript | ||
jss.use(jssIsolate({ | ||
jss.use(isolate({ | ||
reset: { | ||
@@ -87,2 +91,6 @@ boxSizing: 'border-box' | ||
## Issues | ||
File a bug against [cssinjs/jss prefixed with \[jss-isolate\]](https://github.com/cssinjs/jss/issues/new?title=[jss-isolate]%20). | ||
## Run tests | ||
@@ -89,0 +97,0 @@ |
'use strict' | ||
var webpack = require('webpack') | ||
const webpack = require('webpack') | ||
var plugins = [ | ||
const plugins = [ | ||
new webpack.DefinePlugin({ | ||
@@ -14,3 +14,7 @@ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), | ||
if (process.env.NODE_ENV === 'production') { | ||
plugins.push(new webpack.optimize.UglifyJsPlugin()) | ||
plugins.push(new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
})) | ||
} | ||
@@ -23,3 +27,3 @@ | ||
}, | ||
plugins: plugins, | ||
plugins, | ||
module: { | ||
@@ -33,3 +37,4 @@ loaders: [ | ||
] | ||
} | ||
}, | ||
devtool: 'source-map' | ||
} |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
51307
21
725
101
33
1