Socket
Socket
Sign inDemoInstall

@emotion/sheet

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emotion/sheet - npm Package Compare versions

Comparing version 0.6.6 to 0.7.0

dist/index.esm.js

26

dist/index.cjs.js

@@ -46,2 +46,14 @@ 'use strict';

function createStyleElement(options) {
var tag = document.createElement('style');
tag.setAttribute('data-emotion', options.key);
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce);
}
tag.appendChild(document.createTextNode(''));
return tag;
}
var StyleSheet =

@@ -71,13 +83,13 @@ /*#__PURE__*/

if (this.ctr % this.maxLength === 0) {
var _tag = document.createElement('style');
var _tag = createStyleElement(this);
_tag.setAttribute('data-emotion', this.key);
var before;
if (this.nonce !== undefined) {
_tag.setAttribute('nonce', this.nonce);
if (this.tags.length === 0) {
before = this.before;
} else {
before = this.tags[this.tags.length - 1].nextSibling;
}
_tag.appendChild(document.createTextNode(''));
this.container.appendChild(_tag);
this.container.insertBefore(_tag, before);
this.tags.push(_tag);

@@ -84,0 +96,0 @@ }

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.emotionSheet={})}(this,function(e){"use strict";var t=function(){function e(e){void 0===e&&(e={}),this.isSpeedy=void 0===e.speedy||e.speedy,this.maxLength=e.maxLength||this.isSpeedy?65e3:1,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key||"",this.container=e.container||("undefined"!=typeof document?document.head:null)}var t=e.prototype;return t.insert=function(e){if(this.ctr%this.maxLength==0){var t=document.createElement("style");t.setAttribute("data-emotion",this.key),void 0!==this.nonce&&t.setAttribute("nonce",this.nonce),t.appendChild(document.createTextNode("")),this.container.appendChild(t),this.tags.push(t)}var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(n);try{i.insertRule(e,i.cssRules.length)}catch(e){}}else n.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0},e}();e.StyleSheet=t,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.emotionSheet={})}(this,function(e){"use strict";var t=function(){function e(e){void 0===e&&(e={}),this.isSpeedy=void 0===e.speedy||e.speedy,this.maxLength=e.maxLength||this.isSpeedy?65e3:1,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key||"",this.container=e.container||("undefined"!=typeof document?document.head:null)}var t=e.prototype;return t.insert=function(e){if(this.ctr%this.maxLength==0){var t,n=(i=this,(s=document.createElement("style")).setAttribute("data-emotion",i.key),void 0!==i.nonce&&s.setAttribute("nonce",i.nonce),s.appendChild(document.createTextNode("")),s);t=0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling,this.container.insertBefore(n,t),this.tags.push(n)}var i,s,o=this.tags[this.tags.length-1];if(this.isSpeedy){var h=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(o);try{h.insertRule(e,h.cssRules.length)}catch(e){}}else o.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0},e}();e.StyleSheet=t,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=index.min.js.map
{
"name": "@emotion/sheet",
"version": "0.6.6",
"version": "0.7.0",
"description": "emotion's stylesheet",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"module": "dist/index.esm.js",
"types": "types/index.d.ts",

@@ -12,3 +12,3 @@ "license": "MIT",

},
"repository": "https://github.com/emotion-js/next/tree/master/packages/sheet",
"repository": "https://github.com/emotion-js/emotion/tree/master/next-packages/sheet",
"publishConfig": {

@@ -15,0 +15,0 @@ "access": "public"

@@ -51,2 +51,15 @@ // @flow

function createStyleElement(options: {
key: string,
nonce: string | void
}): HTMLStyleElement {
let tag = document.createElement('style')
tag.setAttribute('data-emotion', options.key)
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce)
}
tag.appendChild(document.createTextNode(''))
return tag
}
export class StyleSheet {

@@ -60,2 +73,3 @@ isSpeedy: boolean

nonce: string | void
before: Element | null | void
constructor(options: Options | void) {

@@ -84,9 +98,10 @@ if (options === undefined) options = {}

if (this.ctr % this.maxLength === 0) {
let tag = document.createElement('style')
tag.setAttribute('data-emotion', this.key)
if (this.nonce !== undefined) {
tag.setAttribute('nonce', this.nonce)
let tag = createStyleElement(this)
let before
if (this.tags.length === 0) {
before = this.before
} else {
before = this.tags[this.tags.length - 1].nextSibling
}
tag.appendChild(document.createTextNode(''))
this.container.appendChild(tag)
this.container.insertBefore(tag, before)
this.tags.push(tag)

@@ -93,0 +108,0 @@ }

Sorry, the diff of this file is not supported yet

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