styled-components 6.0.0-beta.3 → 6.0.0-beta.4
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 +8 -14
- package/dist/constructors/createGlobalStyle.d.ts +1 -1
- package/dist/constructors/css.d.ts +4 -4
- package/dist/constructors/styled.d.ts +1 -1
- package/dist/native/index.d.ts +25 -25
- package/dist/styled-components.browser.cjs.js +38 -44
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +38 -44
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +38 -44
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +38 -44
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +38 -44
- 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/utils.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +22 -14
- package/dist/utils/flatten.d.ts +1 -1
- package/dist/utils/interleave.d.ts +1 -1
- package/dist/utils/joinStrings.d.ts +1 -1
- package/dist/utils/mixinDeep.d.ts +1 -2
- package/native/dist/base.d.ts +1 -1
- package/native/dist/constructors/constructWithOptions.d.ts +8 -14
- package/native/dist/constructors/createGlobalStyle.d.ts +1 -1
- package/native/dist/constructors/css.d.ts +4 -4
- package/native/dist/constructors/styled.d.ts +1 -1
- package/native/dist/native/index.d.ts +25 -25
- package/native/dist/styled-components.native.cjs.js +15 -21
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +15 -21
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +1 -1
- package/native/dist/types.d.ts +22 -14
- package/native/dist/utils/flatten.d.ts +1 -1
- package/native/dist/utils/interleave.d.ts +1 -1
- package/native/dist/utils/joinStrings.d.ts +1 -1
- package/native/dist/utils/mixinDeep.d.ts +1 -2
- package/package.json +3 -3
- package/test-utils/index.ts +10 -6
- package/native/dist/base.d.ts.map +0 -1
- package/native/dist/constants.d.ts.map +0 -1
- package/native/dist/constructors/constructWithOptions.d.ts.map +0 -1
- package/native/dist/constructors/createGlobalStyle.d.ts.map +0 -1
- package/native/dist/constructors/css.d.ts.map +0 -1
- package/native/dist/constructors/keyframes.d.ts.map +0 -1
- package/native/dist/constructors/styled.d.ts.map +0 -1
- package/native/dist/dist/base.d.ts +0 -18
- package/native/dist/dist/base.d.ts.map +0 -1
- package/native/dist/dist/constants.d.ts +0 -9
- package/native/dist/dist/constants.d.ts.map +0 -1
- package/native/dist/dist/constructors/constructWithOptions.d.ts +0 -20
- package/native/dist/dist/constructors/constructWithOptions.d.ts.map +0 -1
- package/native/dist/dist/constructors/createGlobalStyle.d.ts +0 -4
- package/native/dist/dist/constructors/createGlobalStyle.d.ts.map +0 -1
- package/native/dist/dist/constructors/css.d.ts +0 -5
- package/native/dist/dist/constructors/css.d.ts.map +0 -1
- package/native/dist/dist/constructors/keyframes.d.ts +0 -4
- package/native/dist/dist/constructors/keyframes.d.ts.map +0 -1
- package/native/dist/dist/constructors/styled.d.ts +0 -186
- package/native/dist/dist/constructors/styled.d.ts.map +0 -1
- package/native/dist/dist/hoc/withTheme.d.ts +0 -4
- package/native/dist/dist/hoc/withTheme.d.ts.map +0 -1
- package/native/dist/dist/hoc/withTheme.spec.d.ts +0 -2
- package/native/dist/dist/hoc/withTheme.spec.d.ts.map +0 -1
- package/native/dist/dist/hooks/useTheme.d.ts +0 -4
- package/native/dist/dist/hooks/useTheme.d.ts.map +0 -1
- package/native/dist/dist/index-standalone.d.ts +0 -3
- package/native/dist/dist/index-standalone.d.ts.map +0 -1
- package/native/dist/dist/index.d.ts +0 -4
- package/native/dist/dist/index.d.ts.map +0 -1
- package/native/dist/dist/macro/index.d.ts +0 -3
- package/native/dist/dist/macro/index.d.ts.map +0 -1
- package/native/dist/dist/macro/test/babel.config.d.ts +0 -1
- package/native/dist/dist/macro/test/babel.config.d.ts.map +0 -1
- package/native/dist/dist/models/ComponentStyle.d.ts +0 -16
- package/native/dist/dist/models/ComponentStyle.d.ts.map +0 -1
- package/native/dist/dist/models/GlobalStyle.d.ts +0 -12
- package/native/dist/dist/models/GlobalStyle.d.ts.map +0 -1
- package/native/dist/dist/models/InlineStyle.d.ts +0 -7
- package/native/dist/dist/models/InlineStyle.d.ts.map +0 -1
- package/native/dist/dist/models/Keyframes.d.ts +0 -12
- package/native/dist/dist/models/Keyframes.d.ts.map +0 -1
- package/native/dist/dist/models/ServerStyleSheet.d.ts +0 -16
- package/native/dist/dist/models/ServerStyleSheet.d.ts.map +0 -1
- package/native/dist/dist/models/StyleSheetManager.d.ts +0 -22
- package/native/dist/dist/models/StyleSheetManager.d.ts.map +0 -1
- package/native/dist/dist/models/StyledComponent.d.ts +0 -4
- package/native/dist/dist/models/StyledComponent.d.ts.map +0 -1
- package/native/dist/dist/models/StyledNativeComponent.d.ts +0 -4
- package/native/dist/dist/models/StyledNativeComponent.d.ts.map +0 -1
- package/native/dist/dist/models/ThemeProvider.d.ts +0 -18
- package/native/dist/dist/models/ThemeProvider.d.ts.map +0 -1
- package/native/dist/dist/native/index.d.ts +0 -65
- package/native/dist/dist/native/index.d.ts.map +0 -1
- package/native/dist/dist/primitives/index.d.ts +0 -23
- package/native/dist/dist/primitives/index.d.ts.map +0 -1
- package/native/dist/dist/secretInternals.d.ts +0 -6
- package/native/dist/dist/secretInternals.d.ts.map +0 -1
- package/native/dist/dist/sheet/GroupIDAllocator.d.ts +0 -5
- package/native/dist/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
- package/native/dist/dist/sheet/GroupedTag.d.ts +0 -12
- package/native/dist/dist/sheet/GroupedTag.d.ts.map +0 -1
- package/native/dist/dist/sheet/Rehydration.d.ts +0 -4
- package/native/dist/dist/sheet/Rehydration.d.ts.map +0 -1
- package/native/dist/dist/sheet/Sheet.d.ts +0 -41
- package/native/dist/dist/sheet/Sheet.d.ts.map +0 -1
- package/native/dist/dist/sheet/Tag.d.ts +0 -55
- package/native/dist/dist/sheet/Tag.d.ts.map +0 -1
- package/native/dist/dist/sheet/dom.d.ts +0 -5
- package/native/dist/dist/sheet/dom.d.ts.map +0 -1
- package/native/dist/dist/sheet/index.d.ts +0 -2
- package/native/dist/dist/sheet/index.d.ts.map +0 -1
- package/native/dist/dist/sheet/types.d.ts +0 -35
- package/native/dist/dist/sheet/types.d.ts.map +0 -1
- package/native/dist/dist/test/globals.d.ts +0 -3
- package/native/dist/dist/test/globals.d.ts.map +0 -1
- package/native/dist/dist/test/utils.d.ts +0 -192
- package/native/dist/dist/test/utils.d.ts.map +0 -1
- package/native/dist/dist/types.d.ts +0 -121
- package/native/dist/dist/types.d.ts.map +0 -1
- package/native/dist/dist/utils/addUnitIfNeeded.d.ts +0 -2
- package/native/dist/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
- package/native/dist/dist/utils/checkDynamicCreation.d.ts +0 -2
- package/native/dist/dist/utils/checkDynamicCreation.d.ts.map +0 -1
- package/native/dist/dist/utils/createWarnTooManyClasses.d.ts +0 -4
- package/native/dist/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
- package/native/dist/dist/utils/determineTheme.d.ts +0 -3
- package/native/dist/dist/utils/determineTheme.d.ts.map +0 -1
- package/native/dist/dist/utils/domElements.d.ts +0 -3
- package/native/dist/dist/utils/domElements.d.ts.map +0 -1
- package/native/dist/dist/utils/empties.d.ts +0 -4
- package/native/dist/dist/utils/empties.d.ts.map +0 -1
- package/native/dist/dist/utils/error.d.ts +0 -6
- package/native/dist/dist/utils/error.d.ts.map +0 -1
- package/native/dist/dist/utils/errors.d.ts +0 -21
- package/native/dist/dist/utils/errors.d.ts.map +0 -1
- package/native/dist/dist/utils/escape.d.ts +0 -6
- package/native/dist/dist/utils/escape.d.ts.map +0 -1
- package/native/dist/dist/utils/flatten.d.ts +0 -5
- package/native/dist/dist/utils/flatten.d.ts.map +0 -1
- package/native/dist/dist/utils/generateAlphabeticName.d.ts +0 -2
- package/native/dist/dist/utils/generateAlphabeticName.d.ts.map +0 -1
- package/native/dist/dist/utils/generateComponentId.d.ts +0 -2
- package/native/dist/dist/utils/generateComponentId.d.ts.map +0 -1
- package/native/dist/dist/utils/generateDisplayName.d.ts +0 -3
- package/native/dist/dist/utils/generateDisplayName.d.ts.map +0 -1
- package/native/dist/dist/utils/getComponentName.d.ts +0 -3
- package/native/dist/dist/utils/getComponentName.d.ts.map +0 -1
- package/native/dist/dist/utils/hash.d.ts +0 -4
- package/native/dist/dist/utils/hash.d.ts.map +0 -1
- package/native/dist/dist/utils/hoist.d.ts +0 -52
- package/native/dist/dist/utils/hoist.d.ts.map +0 -1
- package/native/dist/dist/utils/hyphenateStyleName.d.ts +0 -15
- package/native/dist/dist/utils/hyphenateStyleName.d.ts.map +0 -1
- package/native/dist/dist/utils/interleave.d.ts +0 -3
- package/native/dist/dist/utils/interleave.d.ts.map +0 -1
- package/native/dist/dist/utils/isFunction.d.ts +0 -2
- package/native/dist/dist/utils/isFunction.d.ts.map +0 -1
- package/native/dist/dist/utils/isPlainObject.d.ts +0 -2
- package/native/dist/dist/utils/isPlainObject.d.ts.map +0 -1
- package/native/dist/dist/utils/isStatelessFunction.d.ts +0 -2
- package/native/dist/dist/utils/isStatelessFunction.d.ts.map +0 -1
- package/native/dist/dist/utils/isStaticRules.d.ts +0 -3
- package/native/dist/dist/utils/isStaticRules.d.ts.map +0 -1
- package/native/dist/dist/utils/isStyledComponent.d.ts +0 -3
- package/native/dist/dist/utils/isStyledComponent.d.ts.map +0 -1
- package/native/dist/dist/utils/isTag.d.ts +0 -3
- package/native/dist/dist/utils/isTag.d.ts.map +0 -1
- package/native/dist/dist/utils/joinStrings.d.ts +0 -5
- package/native/dist/dist/utils/joinStrings.d.ts.map +0 -1
- package/native/dist/dist/utils/mixinDeep.d.ts +0 -8
- package/native/dist/dist/utils/mixinDeep.d.ts.map +0 -1
- package/native/dist/dist/utils/nonce.d.ts +0 -2
- package/native/dist/dist/utils/nonce.d.ts.map +0 -1
- package/native/dist/dist/utils/stylis.d.ts +0 -10
- package/native/dist/dist/utils/stylis.d.ts.map +0 -1
- package/native/dist/hoc/withTheme.d.ts.map +0 -1
- package/native/dist/hoc/withTheme.spec.d.ts.map +0 -1
- package/native/dist/hooks/useTheme.d.ts.map +0 -1
- package/native/dist/index-standalone.d.ts.map +0 -1
- package/native/dist/index.d.ts.map +0 -1
- package/native/dist/macro/index.d.ts.map +0 -1
- package/native/dist/macro/test/babel.config.d.ts +0 -1
- package/native/dist/macro/test/babel.config.d.ts.map +0 -1
- package/native/dist/models/ComponentStyle.d.ts.map +0 -1
- package/native/dist/models/GlobalStyle.d.ts.map +0 -1
- package/native/dist/models/InlineStyle.d.ts.map +0 -1
- package/native/dist/models/Keyframes.d.ts.map +0 -1
- package/native/dist/models/ServerStyleSheet.d.ts.map +0 -1
- package/native/dist/models/StyleSheetManager.d.ts.map +0 -1
- package/native/dist/models/StyledComponent.d.ts.map +0 -1
- package/native/dist/models/StyledNativeComponent.d.ts.map +0 -1
- package/native/dist/models/ThemeProvider.d.ts.map +0 -1
- package/native/dist/native/index.d.ts.map +0 -1
- package/native/dist/primitives/index.d.ts +0 -23
- package/native/dist/primitives/index.d.ts.map +0 -1
- package/native/dist/secretInternals.d.ts.map +0 -1
- package/native/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
- package/native/dist/sheet/GroupedTag.d.ts.map +0 -1
- package/native/dist/sheet/Rehydration.d.ts.map +0 -1
- package/native/dist/sheet/Sheet.d.ts.map +0 -1
- package/native/dist/sheet/Tag.d.ts.map +0 -1
- package/native/dist/sheet/dom.d.ts.map +0 -1
- package/native/dist/sheet/index.d.ts.map +0 -1
- package/native/dist/sheet/types.d.ts.map +0 -1
- package/native/dist/test/globals.d.ts.map +0 -1
- package/native/dist/test/utils.d.ts.map +0 -1
- package/native/dist/types.d.ts.map +0 -1
- package/native/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
- package/native/dist/utils/checkDynamicCreation.d.ts.map +0 -1
- package/native/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
- package/native/dist/utils/determineTheme.d.ts.map +0 -1
- package/native/dist/utils/domElements.d.ts.map +0 -1
- package/native/dist/utils/empties.d.ts.map +0 -1
- package/native/dist/utils/error.d.ts.map +0 -1
- package/native/dist/utils/errors.d.ts.map +0 -1
- package/native/dist/utils/escape.d.ts.map +0 -1
- package/native/dist/utils/flatten.d.ts.map +0 -1
- package/native/dist/utils/generateAlphabeticName.d.ts.map +0 -1
- package/native/dist/utils/generateComponentId.d.ts.map +0 -1
- package/native/dist/utils/generateDisplayName.d.ts.map +0 -1
- package/native/dist/utils/getComponentName.d.ts.map +0 -1
- package/native/dist/utils/hash.d.ts.map +0 -1
- package/native/dist/utils/hoist.d.ts.map +0 -1
- package/native/dist/utils/hyphenateStyleName.d.ts.map +0 -1
- package/native/dist/utils/interleave.d.ts.map +0 -1
- package/native/dist/utils/isFunction.d.ts.map +0 -1
- package/native/dist/utils/isPlainObject.d.ts.map +0 -1
- package/native/dist/utils/isStatelessFunction.d.ts.map +0 -1
- package/native/dist/utils/isStaticRules.d.ts.map +0 -1
- package/native/dist/utils/isStyledComponent.d.ts.map +0 -1
- package/native/dist/utils/isTag.d.ts.map +0 -1
- package/native/dist/utils/joinStrings.d.ts.map +0 -1
- package/native/dist/utils/mixinDeep.d.ts.map +0 -1
- package/native/dist/utils/nonce.d.ts.map +0 -1
- package/native/dist/utils/stylis.d.ts.map +0 -1
|
@@ -8,7 +8,7 @@ var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR
|
|
|
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.4";
|
|
12
12
|
var SPLITTER = '/*!sc*/\n';
|
|
13
13
|
var IS_BROWSER = typeof undefined !== 'undefined' ;
|
|
14
14
|
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
|
|
@@ -437,8 +437,12 @@ function isStyledComponent(target) {
|
|
|
437
437
|
/**
|
|
438
438
|
* Convenience function for joining strings to form className chains
|
|
439
439
|
*/
|
|
440
|
-
function joinStrings(
|
|
441
|
-
|
|
440
|
+
function joinStrings() {
|
|
441
|
+
var args = [];
|
|
442
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
443
|
+
args[_i] = arguments[_i];
|
|
444
|
+
}
|
|
445
|
+
return args.filter(Boolean).join(' ');
|
|
442
446
|
}
|
|
443
447
|
|
|
444
448
|
function isPlainObject(x) {
|
|
@@ -477,7 +481,6 @@ function mixinRecursively(target, source, forceMerge) {
|
|
|
477
481
|
* Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
|
|
478
482
|
*/
|
|
479
483
|
function mixinDeep(target) {
|
|
480
|
-
if (target === void 0) { target = {}; }
|
|
481
484
|
var sources = [];
|
|
482
485
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
483
486
|
sources[_i - 1] = arguments[_i];
|
|
@@ -1189,21 +1192,18 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
|
|
|
1189
1192
|
var ruleSet = [];
|
|
1190
1193
|
for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
|
|
1191
1194
|
result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
|
|
1192
|
-
if (result ===
|
|
1195
|
+
if (result.length === 0)
|
|
1193
1196
|
continue;
|
|
1194
|
-
|
|
1195
|
-
ruleSet.push.apply(ruleSet, result);
|
|
1196
|
-
else
|
|
1197
|
-
ruleSet.push(result);
|
|
1197
|
+
ruleSet.push.apply(ruleSet, result);
|
|
1198
1198
|
}
|
|
1199
1199
|
return ruleSet;
|
|
1200
1200
|
}
|
|
1201
1201
|
if (isFalsish(chunk)) {
|
|
1202
|
-
return
|
|
1202
|
+
return [];
|
|
1203
1203
|
}
|
|
1204
1204
|
/* Handle other components */
|
|
1205
1205
|
if (isStyledComponent(chunk)) {
|
|
1206
|
-
return ".".concat(chunk.styledComponentId);
|
|
1206
|
+
return [".".concat(chunk.styledComponentId)];
|
|
1207
1207
|
}
|
|
1208
1208
|
/* Either execute or defer the function */
|
|
1209
1209
|
if (isFunction(chunk)) {
|
|
@@ -1220,19 +1220,21 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
|
|
|
1220
1220
|
}
|
|
1221
1221
|
return flatten(result, executionContext, styleSheet, stylisInstance);
|
|
1222
1222
|
}
|
|
1223
|
-
else
|
|
1224
|
-
return chunk;
|
|
1223
|
+
else {
|
|
1224
|
+
return [chunk];
|
|
1225
|
+
}
|
|
1225
1226
|
}
|
|
1226
1227
|
if (chunk instanceof Keyframes) {
|
|
1227
1228
|
if (styleSheet) {
|
|
1228
1229
|
chunk.inject(styleSheet, stylisInstance);
|
|
1229
|
-
return chunk.getName(stylisInstance);
|
|
1230
|
+
return [chunk.getName(stylisInstance)];
|
|
1231
|
+
}
|
|
1232
|
+
else {
|
|
1233
|
+
return [chunk];
|
|
1230
1234
|
}
|
|
1231
|
-
else
|
|
1232
|
-
return chunk;
|
|
1233
1235
|
}
|
|
1234
1236
|
/* Handle objects */
|
|
1235
|
-
return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
|
|
1237
|
+
return isPlainObject(chunk) ? objToCssArray(chunk) : [chunk.toString()];
|
|
1236
1238
|
}
|
|
1237
1239
|
|
|
1238
1240
|
function isStaticRules(rules) {
|
|
@@ -1395,18 +1397,14 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
|
|
|
1395
1397
|
var theme = determineTheme(props, useContext(ThemeContext), defaultProps) || EMPTY_OBJECT;
|
|
1396
1398
|
var context = componentAttrs.reduce(function (p, attrDef) {
|
|
1397
1399
|
var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(p) : attrDef;
|
|
1398
|
-
var key;
|
|
1399
1400
|
/* eslint-disable guard-for-in */
|
|
1400
|
-
for (key in resolvedAttrDef) {
|
|
1401
|
+
for (var key in resolvedAttrDef) {
|
|
1401
1402
|
// @ts-expect-error bad types
|
|
1402
1403
|
p[key] =
|
|
1403
1404
|
key === 'className'
|
|
1404
|
-
?
|
|
1405
|
-
joinStrings(p[key], resolvedAttrDef[key])
|
|
1405
|
+
? joinStrings(p[key], resolvedAttrDef[key])
|
|
1406
1406
|
: key === 'style'
|
|
1407
|
-
?
|
|
1408
|
-
__assign(__assign({}, p[key]), resolvedAttrDef[key]) : // @ts-expect-error bad types
|
|
1409
|
-
resolvedAttrDef[key];
|
|
1407
|
+
? __assign(__assign({}, p[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
|
|
1410
1408
|
}
|
|
1411
1409
|
/* eslint-enable guard-for-in */
|
|
1412
1410
|
return p;
|
|
@@ -1415,22 +1413,21 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
|
|
|
1415
1413
|
var refToForward = forwardedRef;
|
|
1416
1414
|
var elementToBeCreated = context.as || target;
|
|
1417
1415
|
var isTargetTag = isTag(elementToBeCreated);
|
|
1416
|
+
var propsForElement = {};
|
|
1418
1417
|
// eslint-disable-next-line guard-for-in
|
|
1419
1418
|
for (var key in context) {
|
|
1420
|
-
// @ts-expect-error
|
|
1421
|
-
if (key
|
|
1422
|
-
|
|
1419
|
+
// @ts-expect-error for..in iterates strings instead of keyof
|
|
1420
|
+
if (context[key] === undefined) ;
|
|
1421
|
+
else if (key[0] === '$' || key === 'as' || key === 'theme') ;
|
|
1423
1422
|
else if (key === 'forwardedAs') {
|
|
1424
|
-
|
|
1425
|
-
context[key] = undefined;
|
|
1423
|
+
propsForElement.as = context.forwardedAs;
|
|
1426
1424
|
}
|
|
1427
|
-
else if (shouldForwardProp
|
|
1428
|
-
//
|
|
1429
|
-
|
|
1430
|
-
context[key] = undefined;
|
|
1425
|
+
else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
|
|
1426
|
+
// @ts-expect-error for..in iterates strings instead of keyof
|
|
1427
|
+
propsForElement[key] = context[key];
|
|
1431
1428
|
}
|
|
1432
1429
|
}
|
|
1433
|
-
|
|
1430
|
+
propsForElement[
|
|
1434
1431
|
// handle custom elements which React doesn't properly alias
|
|
1435
1432
|
isTargetTag &&
|
|
1436
1433
|
domElements.indexOf(elementToBeCreated) === -1
|
|
@@ -1439,9 +1436,8 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
|
|
|
1439
1436
|
.concat(styledComponentId, generatedClassName !== styledComponentId ? generatedClassName : '', context.className || '')
|
|
1440
1437
|
.filter(Boolean)
|
|
1441
1438
|
.join(' ');
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
return createElement(elementToBeCreated, context);
|
|
1439
|
+
propsForElement.ref = refToForward;
|
|
1440
|
+
return createElement(elementToBeCreated, propsForElement);
|
|
1445
1441
|
}
|
|
1446
1442
|
function createStyledComponent(target, options, rules) {
|
|
1447
1443
|
var isTargetStyledComp = isStyledComponent(target);
|
|
@@ -1453,7 +1449,9 @@ function createStyledComponent(target, options, rules) {
|
|
|
1453
1449
|
: options.componentId || componentId;
|
|
1454
1450
|
// fold the underlying StyledComponent attrs up (implicit extend)
|
|
1455
1451
|
var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
|
|
1456
|
-
? styledComponentTarget.attrs
|
|
1452
|
+
? styledComponentTarget.attrs
|
|
1453
|
+
.concat(attrs)
|
|
1454
|
+
.filter(Boolean)
|
|
1457
1455
|
: attrs;
|
|
1458
1456
|
var shouldForwardProp = options.shouldForwardProp;
|
|
1459
1457
|
if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
|
|
@@ -1548,11 +1546,7 @@ function interleave(strings, interpolations) {
|
|
|
1548
1546
|
* expand an array of styles.
|
|
1549
1547
|
*/
|
|
1550
1548
|
var addTag = function (arg) {
|
|
1551
|
-
|
|
1552
|
-
// eslint-disable-next-line no-param-reassign
|
|
1553
|
-
arg.isCss = true;
|
|
1554
|
-
}
|
|
1555
|
-
return arg;
|
|
1549
|
+
return Object.assign(arg, { isCss: true });
|
|
1556
1550
|
};
|
|
1557
1551
|
function css(styles) {
|
|
1558
1552
|
var interpolations = [];
|
|
@@ -1569,7 +1563,7 @@ function css(styles) {
|
|
|
1569
1563
|
if (interpolations.length === 0 &&
|
|
1570
1564
|
styleStringArray.length === 1 &&
|
|
1571
1565
|
typeof styleStringArray[0] === 'string') {
|
|
1572
|
-
return styleStringArray;
|
|
1566
|
+
return flatten(styleStringArray);
|
|
1573
1567
|
}
|
|
1574
1568
|
return addTag(flatten(interleave(styleStringArray, interpolations)));
|
|
1575
1569
|
}
|