Comparing version 5.1.3 to 5.1.4
@@ -0,1 +1,7 @@ | ||
### 5.1.2 - 2020-03-23 | ||
#### 🐞 Fixes | ||
- Will no longer attempt to flush global styles when SSRing. | ||
### 5.1.1 - 2020-02-06 | ||
@@ -2,0 +8,0 @@ |
@@ -257,3 +257,9 @@ import deepMerge from 'extend'; | ||
_proto.getFlushedStyles = function getFlushedStyles$1() { | ||
return getFlushedStyles(this.getStyleElement()); | ||
var element = this.getStyleElement(); | ||
if (element) { | ||
return getFlushedStyles(element); | ||
} | ||
return ''; | ||
}; | ||
@@ -266,2 +272,6 @@ | ||
if (typeof document === 'undefined') { | ||
return null; | ||
} | ||
this.element = document.createElement('style'); | ||
@@ -277,4 +287,6 @@ this.element.type = 'text/css'; | ||
_proto.injectRule = function injectRule(rule) { | ||
this.getStyleElement(); | ||
this.sheet.insertRule(rule, this.sheet.cssRules.length); | ||
if (this.getStyleElement()) { | ||
this.sheet.insertRule(rule, this.sheet.cssRules.length); | ||
} | ||
return this; | ||
@@ -284,3 +296,8 @@ }; | ||
_proto.injectStatements = function injectStatements(css) { | ||
this.getStyleElement().textContent += css; | ||
var element = this.getStyleElement(); | ||
if (element) { | ||
element.textContent += css; | ||
} | ||
return this; | ||
@@ -290,4 +307,8 @@ }; | ||
_proto.purgeStyles = function purgeStyles$1() { | ||
purgeStyles(this.getStyleElement()); | ||
var element = this.getStyleElement(); | ||
if (element) { | ||
purgeStyles(element); | ||
} | ||
return this; | ||
@@ -774,3 +795,5 @@ }; | ||
_proto.applyGlobalStyles = function applyGlobalStyles(baseOptions) { | ||
if (typeof document !== 'undefined') { | ||
var hasDocument = typeof document !== 'undefined'; | ||
if (hasDocument) { | ||
document.documentElement.setAttribute('dir', this.aesthetic.options.rtl ? 'rtl' : 'ltr'); | ||
@@ -796,3 +819,7 @@ } | ||
this.transformStyles(Object.values(parsedSheet), options); | ||
this.flushStyles(GLOBAL_STYLE_NAME); | ||
if (hasDocument) { | ||
this.flushStyles(GLOBAL_STYLE_NAME); | ||
} | ||
return this; | ||
@@ -799,0 +826,0 @@ }; |
@@ -263,3 +263,9 @@ 'use strict'; | ||
_proto.getFlushedStyles = function getFlushedStyles() { | ||
return aestheticUtils.getFlushedStyles(this.getStyleElement()); | ||
var element = this.getStyleElement(); | ||
if (element) { | ||
return aestheticUtils.getFlushedStyles(element); | ||
} | ||
return ''; | ||
}; | ||
@@ -272,2 +278,6 @@ | ||
if (typeof document === 'undefined') { | ||
return null; | ||
} | ||
this.element = document.createElement('style'); | ||
@@ -283,4 +293,6 @@ this.element.type = 'text/css'; | ||
_proto.injectRule = function injectRule(rule) { | ||
this.getStyleElement(); | ||
this.sheet.insertRule(rule, this.sheet.cssRules.length); | ||
if (this.getStyleElement()) { | ||
this.sheet.insertRule(rule, this.sheet.cssRules.length); | ||
} | ||
return this; | ||
@@ -290,3 +302,8 @@ }; | ||
_proto.injectStatements = function injectStatements(css) { | ||
this.getStyleElement().textContent += css; | ||
var element = this.getStyleElement(); | ||
if (element) { | ||
element.textContent += css; | ||
} | ||
return this; | ||
@@ -296,4 +313,8 @@ }; | ||
_proto.purgeStyles = function purgeStyles() { | ||
aestheticUtils.purgeStyles(this.getStyleElement()); | ||
var element = this.getStyleElement(); | ||
if (element) { | ||
aestheticUtils.purgeStyles(element); | ||
} | ||
return this; | ||
@@ -780,3 +801,5 @@ }; | ||
_proto.applyGlobalStyles = function applyGlobalStyles(baseOptions) { | ||
if (typeof document !== 'undefined') { | ||
var hasDocument = typeof document !== 'undefined'; | ||
if (hasDocument) { | ||
document.documentElement.setAttribute('dir', this.aesthetic.options.rtl ? 'rtl' : 'ltr'); | ||
@@ -802,3 +825,7 @@ } | ||
this.transformStyles(Object.values(parsedSheet), options); | ||
this.flushStyles(GLOBAL_STYLE_NAME); | ||
if (hasDocument) { | ||
this.flushStyles(GLOBAL_STYLE_NAME); | ||
} | ||
return this; | ||
@@ -805,0 +832,0 @@ }; |
@@ -5,3 +5,3 @@ export default class StyleSheetManager { | ||
getFlushedStyles(): string; | ||
getStyleElement(): HTMLStyleElement; | ||
getStyleElement(): HTMLStyleElement | null; | ||
injectRule(rule: string): this; | ||
@@ -8,0 +8,0 @@ injectStatements(css: string): this; |
{ | ||
"name": "aesthetic", | ||
"version": "5.1.3", | ||
"version": "5.1.4", | ||
"description": "Aesthetic is a powerful type-safe, framework agnostic, CSS-in-JS library for styling components through the use of adapters.", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"aesthetic-utils": "^3.0.1", | ||
"aesthetic-utils": "^3.0.2", | ||
"csstype": "^2.6.9", | ||
@@ -42,3 +42,3 @@ "extend": "^3.0.2", | ||
}, | ||
"gitHead": "49404fc03a8f67e9a23b5151701f79f170d4207b" | ||
"gitHead": "ca0d2988084fdc788239899a16de8ec42b49465a" | ||
} |
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
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
158470
3724
Updatedaesthetic-utils@^3.0.2