@emotion/sheet
Advanced tools
Comparing version 0.9.3 to 0.10.0-next.0
# @emotion/sheet | ||
## 0.10.0-next.0 | ||
### Minor Changes | ||
- [`4a891bf6`](https://github.com/emotion-js/emotion/commit/4a891bf6a30e3bb37f8f32031fa75a571c637d9c) [#1473](https://github.com/emotion-js/emotion/pull/1473) Thanks [@jcharry](https://github.com/jcharry)! - Accept new `prepend` option to allow for adding style tags at the beginning of the specified DOM container. | ||
## 0.9.3 | ||
@@ -7,2 +13,2 @@ | ||
- [c0eb604d](https://github.com/emotion-js/emotion/commit/c0eb604d) [#1419](https://github.com/emotion-js/emotion/pulls/1419) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Update build tool | ||
- [c0eb604d](https://github.com/emotion-js/emotion/commit/c0eb604d) [#1419](https://github.com/emotion-js/emotion/pull/1419) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Update build tool |
@@ -68,2 +68,3 @@ 'use strict'; | ||
this.container = options.container; | ||
this.prepend = options.prepend; | ||
this.before = null; | ||
@@ -84,3 +85,3 @@ } | ||
if (this.tags.length === 0) { | ||
before = this.before; | ||
before = this.prepend ? this.container.firstChild : this.before; | ||
} else { | ||
@@ -87,0 +88,0 @@ before = this.tags[this.tags.length - 1].nextSibling; |
@@ -64,2 +64,3 @@ /* | ||
this.container = options.container; | ||
this.prepend = options.prepend; | ||
this.before = null; | ||
@@ -80,3 +81,3 @@ } | ||
if (this.tags.length === 0) { | ||
before = this.before; | ||
before = this.prepend ? this.container.firstChild : this.before; | ||
} else { | ||
@@ -83,0 +84,0 @@ before = this.tags[this.tags.length - 1].nextSibling; |
@@ -68,2 +68,3 @@ 'use strict'; | ||
this.container = options.container; | ||
this.prepend = options.prepend; | ||
this.before = null; | ||
@@ -84,3 +85,3 @@ } | ||
if (this.tags.length === 0) { | ||
before = this.before; | ||
before = this.prepend ? this.container.firstChild : this.before; | ||
} else { | ||
@@ -87,0 +88,0 @@ before = this.tags[this.tags.length - 1].nextSibling; |
@@ -22,3 +22,3 @@ "use strict"; | ||
this.nonce = options.nonce, this.key = options.key, this.container = options.container, | ||
this.before = null; | ||
this.prepend = options.prepend, this.before = null; | ||
} | ||
@@ -29,3 +29,3 @@ var _proto = StyleSheet.prototype; | ||
var before, _tag = createStyleElement(this); | ||
before = 0 === this.tags.length ? this.before : this.tags[this.tags.length - 1].nextSibling, | ||
before = 0 === this.tags.length ? this.prepend ? this.container.firstChild : this.before : this.tags[this.tags.length - 1].nextSibling, | ||
this.container.insertBefore(_tag, before), this.tags.push(_tag); | ||
@@ -43,5 +43,5 @@ } | ||
}, _proto.flush = function() { | ||
this.tags.forEach(function(tag) { | ||
this.tags.forEach((function(tag) { | ||
return tag.parentNode.removeChild(tag); | ||
}), this.tags = [], this.ctr = 0; | ||
})), this.tags = [], this.ctr = 0; | ||
}, StyleSheet; | ||
@@ -48,0 +48,0 @@ }(); |
@@ -64,2 +64,3 @@ /* | ||
this.container = options.container; | ||
this.prepend = options.prepend; | ||
this.before = null; | ||
@@ -80,3 +81,3 @@ } | ||
if (this.tags.length === 0) { | ||
before = this.before; | ||
before = this.prepend ? this.container.firstChild : this.before; | ||
} else { | ||
@@ -83,0 +84,0 @@ before = this.tags[this.tags.length - 1].nextSibling; |
{ | ||
"name": "@emotion/sheet", | ||
"version": "0.9.3", | ||
"version": "0.10.0-next.0", | ||
"description": "emotion's stylesheet", | ||
@@ -28,2 +28,2 @@ "main": "dist/sheet.cjs.js", | ||
} | ||
} | ||
} |
@@ -46,3 +46,4 @@ // @flow | ||
container: HTMLElement, | ||
speedy?: boolean | ||
speedy?: boolean, | ||
prepend?: boolean | ||
} | ||
@@ -70,2 +71,3 @@ | ||
nonce: string | void | ||
prepend: boolean | void | ||
before: Element | null | ||
@@ -83,2 +85,3 @@ constructor(options: Options) { | ||
this.container = options.container | ||
this.prepend = options.prepend | ||
this.before = null | ||
@@ -94,3 +97,3 @@ } | ||
if (this.tags.length === 0) { | ||
before = this.before | ||
before = this.prepend ? this.container.firstChild : this.before | ||
} else { | ||
@@ -97,0 +100,0 @@ before = this.tags[this.tags.length - 1].nextSibling |
@@ -9,2 +9,3 @@ // Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> | ||
speedy?: boolean | ||
prepend?: boolean | ||
} | ||
@@ -11,0 +12,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Options, StyleSheet } from '@emotion/sheet' | ||
import { StyleSheet } from '@emotion/sheet' | ||
@@ -47,7 +47,2 @@ new StyleSheet({ | ||
styleSheet.insert('.name{ color: black; }', undefined as any) | ||
// $ExpectError | ||
styleSheet.insert( | ||
'.name{ color: black; }', | ||
...((undefined as any) as Array<any>) | ||
) | ||
@@ -54,0 +49,0 @@ styleSheet.flush() |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
29239
712
1