styled-components 6.0.0-beta.14 → 6.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.d.ts +1 -1
- package/dist/constructors/constructWithOptions.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/native/index.d.ts +24 -24
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +15 -13
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +1 -1
- package/dist/styled-components.min.js.map +1 -1
- package/dist/test/types.d.ts +9 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +15 -17
- package/native/dist/base.d.ts +1 -1
- package/native/dist/constructors/constructWithOptions.d.ts +2 -2
- package/native/dist/index.d.ts +1 -1
- package/native/dist/native/index.d.ts +24 -24
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/types.d.ts +9 -1
- package/native/dist/types.d.ts +15 -17
- package/package.json +2 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
'data-styled';
|
|
9
9
|
var SC_ATTR_ACTIVE = 'active';
|
|
10
10
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
11
|
-
var SC_VERSION = "6.0.0-beta.
|
|
11
|
+
var SC_VERSION = "6.0.0-beta.15";
|
|
12
12
|
var SPLITTER = '/*!sc*/\n';
|
|
13
13
|
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
14
14
|
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
|
|
@@ -607,7 +607,6 @@
|
|
|
607
607
|
};
|
|
608
608
|
|
|
609
609
|
var COMMENT_REGEX = /^\s*\/\/.*$/gm;
|
|
610
|
-
var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
|
|
611
610
|
/**
|
|
612
611
|
* Serialize stylis output as an array of css strings. It is important that rules are
|
|
613
612
|
* separated when using CSSOM injection.
|
|
@@ -637,7 +636,7 @@
|
|
|
637
636
|
return "".concat(namespace, " ").concat(prop);
|
|
638
637
|
});
|
|
639
638
|
}
|
|
640
|
-
if (Array.isArray(rule.children)) {
|
|
639
|
+
if (Array.isArray(rule.children) && rule.type !== '@keyframes') {
|
|
641
640
|
rule.children = recursivelySetNamepace(rule.children, namespace);
|
|
642
641
|
}
|
|
643
642
|
return rule;
|
|
@@ -648,12 +647,18 @@
|
|
|
648
647
|
var _componentId;
|
|
649
648
|
var _selector;
|
|
650
649
|
var _selectorRegexp;
|
|
651
|
-
var _consecutiveSelfRefRegExp;
|
|
652
650
|
var selfReferenceReplacer = function (match, offset, string) {
|
|
653
651
|
if (
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
652
|
+
/**
|
|
653
|
+
* We only want to refer to the static class directly in the following scenarios:
|
|
654
|
+
*
|
|
655
|
+
* 1. The selector is alone on the line `& { color: red; }`
|
|
656
|
+
* 2. The selector is part of a self-reference selector `& + & { color: red; }`
|
|
657
|
+
*/
|
|
658
|
+
string === _selector ||
|
|
659
|
+
(string.startsWith(_selector) &&
|
|
660
|
+
string.endsWith(_selector) &&
|
|
661
|
+
string.replaceAll(_selector, '').length > 0)) {
|
|
657
662
|
return ".".concat(_componentId);
|
|
658
663
|
}
|
|
659
664
|
return match;
|
|
@@ -697,7 +702,6 @@
|
|
|
697
702
|
_componentId = componentId;
|
|
698
703
|
_selector = selector;
|
|
699
704
|
_selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
|
|
700
|
-
_consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
|
|
701
705
|
var flatCSS = css.replace(COMMENT_REGEX, '');
|
|
702
706
|
var compiled = ne(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS);
|
|
703
707
|
if (options.namespace) {
|
|
@@ -839,8 +843,8 @@
|
|
|
839
843
|
if (value == null || typeof value === 'boolean' || value === '') {
|
|
840
844
|
return '';
|
|
841
845
|
}
|
|
842
|
-
if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys)) {
|
|
843
|
-
return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
|
|
846
|
+
if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys) && !name.startsWith('--')) {
|
|
847
|
+
return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
|
|
844
848
|
}
|
|
845
849
|
return String(value).trim();
|
|
846
850
|
}
|
|
@@ -1848,9 +1852,7 @@
|
|
|
1848
1852
|
: options.componentId || componentId;
|
|
1849
1853
|
// fold the underlying StyledComponent attrs up (implicit extend)
|
|
1850
1854
|
var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
|
|
1851
|
-
? styledComponentTarget.attrs
|
|
1852
|
-
.concat(attrs)
|
|
1853
|
-
.filter(Boolean)
|
|
1855
|
+
? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
|
|
1854
1856
|
: attrs;
|
|
1855
1857
|
var shouldForwardProp = options.shouldForwardProp;
|
|
1856
1858
|
if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
|