Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jss

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jss - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

bower.json
{
"name": "jsstyles",
"description": "Composable and reusable style sheets.",
"version": "2.1.0",
"version": "2.1.1",
"author": {

@@ -6,0 +6,0 @@ "name": "Oleg Slobodskoi",

@@ -8,2 +8,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jss=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var StyleSheet=require("./StyleSheet");var Rule=require("./Rule");var PluginsRegistry=require("./PluginsRegistry");function Jss(){this.plugins=new PluginsRegistry}module.exports=Jss;Jss.prototype.create=function(){return new Jss};Jss.prototype.createStyleSheet=function(rules,options){if(!options)options={};options.jss=this;var sheet=new StyleSheet(rules,options);return sheet};Jss.prototype.createRule=function(selector,style,options){if(typeof selector=="object"){options=style;style=selector;selector=null}if(!options)options={};options.jss=this;var rule=new Rule(selector,style,options);this.plugins.run(rule);return rule};Jss.prototype.use=function(fn){this.plugins.use(fn)}},{"./PluginsRegistry":2,"./Rule":3,"./StyleSheet":4}],2:[function(require,module,exports){"use strict";function PluginsRegistry(){this.registry=[]}module.exports=PluginsRegistry;PluginsRegistry.prototype.use=function(fn){this.registry.push(fn)};PluginsRegistry.prototype.run=function(rule){for(var i=0;i<this.registry.length;i++){this.registry[i](rule)}}},{}],3:[function(require,module,exports){"use strict";var uid=0;var toString=Object.prototype.toString;function Rule(selector,style,options){this.id=Rule.uid++;this.options=options||{};if(this.options.named==null)this.options.named=true;if(selector){this.selector=selector;this.isAtRule=selector[0]=="@"}else{this.isAtRule=false;this.className=Rule.NAMESPACE_PREFIX+"-"+this.id;this.selector="."+this.className}this.style=style;this.CSSRule=null;this.rules=null;this.jss=this.options.jss;this.extractAtRules()}module.exports=Rule;Rule.NAMESPACE_PREFIX="jss";Rule.INDENTATION=" ";Rule.uid=0;Rule.prototype.prop=function(name,value){if(value!=null){if(!this.style)this.style={};this.style[name]=value;if(this.CSSRule)this.CSSRule.style[name]=value;return this}if(this.style)value=this.style[name];if(value==null&&this.CSSRule){value=this.CSSRule.style[name];this.style[name]=value}return value};Rule.prototype.addChild=function(selector,style,options){if(!this.children)this.children={};this.children[selector]={style:style,options:options};return this};Rule.prototype.extractAtRules=function(){if(!this.isAtRule||!this.style)return;if(!this.rules)this.rules={};for(var name in this.style){var style=this.style[name];if(typeof style=="string")break;var selector=this.options.named?undefined:name;this.rules[name]=this.jss.createRule(selector,style,this.options);delete this.style[name]}};Rule.prototype.applyTo=function(element){for(var prop in this.style){var value=this.style[prop];if(toString.call(value)=="[object Array]"){for(var i=0;i<value.length;i++){element.style[prop]=value[i]}}else{element.style[prop]=value}}return this};Rule.prototype.toString=function(options){var style=this.style;if(this.isAtRule&&!this.style&&!this.rules)return this.selector+";";if(!options)options={};if(options.indentationLevel==null)options.indentationLevel=0;var str=indent(options.indentationLevel,this.selector+" {");for(var prop in style){var value=style[prop];if(toString.call(value)=="[object Array]"){for(var i=0;i<value.length;i++){str+="\n"+indent(options.indentationLevel+1,prop+": "+value[i]+";")}}else{str+="\n"+indent(options.indentationLevel+1,prop+": "+value+";")}}for(var name in this.rules){var ruleStr=this.rules[name].toString({indentationLevel:options.indentationLevel+1});str+="\n"+indent(options.indentationLevel,ruleStr)}str+="\n"+indent(options.indentationLevel,"}");return str};Rule.prototype.toJSON=function(){var style={};for(var prop in this.style){var value=this.style[prop];var type=typeof value;if(type=="string"||type=="number"){style[prop]=value}}return style};function indent(level,str){var indentStr="";for(var i=0;i<level;i++)indentStr+=Rule.INDENTATION;return indentStr+str}},{}],4:[function(require,module,exports){"use strict";var Rule=require("./Rule");function StyleSheet(rules,options){this.options=options||{};if(this.options.named==null)this.options.named=true;this.element=null;this.attached=false;this.media=this.options.media;this.type=this.options.type;this.title=this.options.title;this.rules={};this.classes={};this.deployed=false;this.linked=false;this.jss=this.options.jss;if(typeof document!="undefined"){this.element=this.createElement()}for(var key in rules){this.createRules(key,rules[key])}}StyleSheet.ATTRIBUTES=["title","type","media"];module.exports=StyleSheet;StyleSheet.prototype.attach=function(){if(this.attached)return this;if(!this.deployed){this.deploy();this.deployed=true}document.head.appendChild(this.element);if(!this.linked&&this.options.link){this.link();this.linked=true}this.attached=true;return this};StyleSheet.prototype.detach=function(){if(!this.attached)return this;this.element.parentNode.removeChild(this.element);this.attached=false;return this};StyleSheet.prototype.deploy=function(){this.element.innerHTML="\n"+this.toString()+"\n";return this};StyleSheet.prototype.link=function(){var CSSRuleList=this.element.sheet.cssRules;var rules=this.rules;for(var i=0;i<CSSRuleList.length;i++){var CSSRule=CSSRuleList[i];var rule=rules[CSSRule.selectorText];if(rule)rule.CSSRule=CSSRule}return this};StyleSheet.prototype.addRule=function(key,style){var rules=this.createRules(key,style);if(this.deployed){var sheet=this.element.sheet;for(var i=0;i<rules.length;i++){var nextIndex=sheet.cssRules.length;var rule=rules[i];sheet.insertRule(rule.toString(),nextIndex);if(this.options.link)rule.CSSRule=sheet.cssRules[nextIndex]}}else{this.deploy()}return rules};StyleSheet.prototype.addRules=function(rules){for(var key in rules){this.addRule(key,rules[key])}return this};StyleSheet.prototype.getRule=function(key){return this.rules[key]};StyleSheet.prototype.toString=function(){var str="";var rules=this.rules;var stringified={};for(var key in rules){var rule=rules[key];if(stringified[rule.id])continue;if(str)str+="\n";str+=rules[key].toString();stringified[rule.id]=true}return str};StyleSheet.prototype.createRules=function(key,style,options){var rules=[];var selector,name;if(!options)options={};var named=this.options.named;if(options.named!=null)named=options.named;if(named)name=key;else selector=key;var rule=this.jss.createRule(selector,style,{sheet:this,named:named,name:name});rules.push(rule);this.rules[rule.selector]=rule;if(name){this.rules[name]=rule;this.classes[name]=rule.className}for(key in rule.children){rules.push(this.createRules(key,rule.children[key].style,rule.children[key].options))}return rules};StyleSheet.prototype.createElement=function(){var element=document.createElement("style");StyleSheet.ATTRIBUTES.forEach(function(name){if(this[name])element.setAttribute(name,this[name])},this);return element}},{"./Rule":3}],5:[function(require,module,exports){"use strict";/**

*/
var StyleSheet=require("./StyleSheet");var Rule=require("./Rule");var Jss=require("./Jss");module.exports=exports=new Jss;exports.StyleSheet=StyleSheet;exports.Rule=Rule;exports.Jss=Jss},{"./Jss":1,"./Rule":3,"./StyleSheet":4}]},{},[5])(5)});
var StyleSheet=require("./StyleSheet");var Rule=require("./Rule");var Jss=require("./Jss");module.exports=exports=new Jss;exports.StyleSheet=StyleSheet;exports.Rule=Rule;exports.Jss=Jss},{"./Jss":1,"./Rule":3,"./StyleSheet":4}]},{},[5])(5)});

@@ -0,1 +1,5 @@

## 2.1.1 / 2015-07-20
- remove browser field from package.json, it makes webpack use dist version instead of src.
## 2.1.0 / 2015-07-18

@@ -2,0 +6,0 @@

{
"name": "jss",
"description": "Composable and reusable style sheets.",
"version": "2.1.0",
"version": "2.1.1",
"author": {

@@ -29,4 +29,3 @@ "name": "Oleg Slobodskoi",

],
"main": "index.js",
"browser": "dist/jss.js",
"main": "./lib/index.js",
"engines": {

@@ -33,0 +32,0 @@ "node": ">=0.8.0"

@@ -101,5 +101,5 @@ ## Composable and reusable style sheets.

```javascript
var jss = require('jss').create()
jss.use(somePlugin)
jss.createStyleSheet(...)
var jss = require('jss').create()
jss.use(somePlugin)
jss.createStyleSheet(...)
```

@@ -106,0 +106,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc