styled-components 6.0.0-beta.5 → 6.0.0-beta.7
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 +2 -2
- package/dist/constructors/constructWithOptions.d.ts +2 -2
- package/dist/constructors/styled.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/models/StyleSheetManager.d.ts +38 -13
- package/dist/native/index.d.ts +27 -27
- package/dist/styled-components-macro.cjs.js +2 -7
- package/dist/styled-components-macro.cjs.js.map +1 -1
- package/dist/styled-components.browser.cjs.js +36 -40
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +17 -16
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +35 -39
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +17 -16
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +33 -131
- 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 +15 -5
- package/dist/utils/stylis.d.ts +3 -3
- package/native/dist/base.d.ts +2 -2
- package/native/dist/constructors/constructWithOptions.d.ts +2 -2
- package/native/dist/constructors/styled.d.ts +1 -1
- package/native/dist/index.d.ts +2 -2
- package/native/dist/models/StyleSheetManager.d.ts +38 -13
- package/native/dist/native/index.d.ts +27 -27
- package/native/dist/styled-components.native.cjs.js +24 -25
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +13 -9
- 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 +15 -5
- package/native/dist/utils/stylis.d.ts +3 -3
- package/package.json +32 -33
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __spreadArray, __assign
|
|
2
|
-
import React, { useRef, useState,
|
|
1
|
+
import { __spreadArray, __assign } from 'tslib';
|
|
2
|
+
import React, { useRef, useState, useMemo, useEffect, useContext, useDebugValue, createElement } from 'react';
|
|
3
3
|
import shallowequal from 'shallowequal';
|
|
4
4
|
import { prefixer, stringify, middleware, compile, RULESET } from 'stylis';
|
|
5
5
|
import unitless from '@emotion/unitless';
|
|
@@ -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.7";
|
|
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'
|
|
@@ -1016,7 +1016,11 @@ function createStylisInstance(_a) {
|
|
|
1016
1016
|
props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
|
|
1017
1017
|
}
|
|
1018
1018
|
};
|
|
1019
|
-
var stringifyRules = function (css, selector,
|
|
1019
|
+
var stringifyRules = function (css, selector,
|
|
1020
|
+
/**
|
|
1021
|
+
* This "prefix" referes to a _selector_ prefix.
|
|
1022
|
+
*/
|
|
1023
|
+
prefix, componentId) {
|
|
1020
1024
|
if (selector === void 0) { selector = ''; }
|
|
1021
1025
|
if (prefix === void 0) { prefix = ''; }
|
|
1022
1026
|
if (componentId === void 0) { componentId = '&'; }
|
|
@@ -1029,11 +1033,16 @@ function createStylisInstance(_a) {
|
|
|
1029
1033
|
_selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
|
|
1030
1034
|
_consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
|
|
1031
1035
|
var middlewares = plugins.slice();
|
|
1036
|
+
/**
|
|
1037
|
+
* Enables automatic vendor-prefixing for styles.
|
|
1038
|
+
*/
|
|
1032
1039
|
if (options.prefix || options.prefix === undefined) {
|
|
1033
1040
|
middlewares.unshift(prefixer);
|
|
1034
1041
|
}
|
|
1035
1042
|
middlewares.push(selfReferenceReplacementPlugin, stringify);
|
|
1036
|
-
return serialize(compile(
|
|
1043
|
+
return serialize(compile(options.namespace || prefix || selector
|
|
1044
|
+
? "".concat(options.namespace ? options.namespace + ' ' : '').concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }")
|
|
1045
|
+
: flatCSS), middleware(middlewares));
|
|
1037
1046
|
};
|
|
1038
1047
|
stringifyRules.hash = plugins.length
|
|
1039
1048
|
? plugins
|
|
@@ -1079,10 +1088,10 @@ function StyleSheetManager(props) {
|
|
|
1079
1088
|
}, [props.disableCSSOMInjection, props.sheet, props.target]);
|
|
1080
1089
|
var stylis = useMemo(function () {
|
|
1081
1090
|
return createStylisInstance({
|
|
1082
|
-
options: { prefix: !props.disableVendorPrefixes },
|
|
1091
|
+
options: { namespace: props.namespace, prefix: !props.disableVendorPrefixes },
|
|
1083
1092
|
plugins: plugins,
|
|
1084
1093
|
});
|
|
1085
|
-
}, [props.disableVendorPrefixes, plugins]);
|
|
1094
|
+
}, [props.disableVendorPrefixes, props.namespace, plugins]);
|
|
1086
1095
|
useEffect(function () {
|
|
1087
1096
|
if (!shallowequal(plugins, props.stylisPlugins))
|
|
1088
1097
|
setPlugins(props.stylisPlugins);
|
|
@@ -1494,13 +1503,6 @@ function createStyledComponent(target, options, rules) {
|
|
|
1494
1503
|
WrappedStyledComponent.styledComponentId = styledComponentId;
|
|
1495
1504
|
// fold the underlying StyledComponent target up since we folded the styles
|
|
1496
1505
|
WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
|
|
1497
|
-
WrappedStyledComponent.withComponent = function withComponent(tag) {
|
|
1498
|
-
var previousComponentId = options.componentId, optionsToCopy = __rest(options, ["componentId"]);
|
|
1499
|
-
var newComponentId = previousComponentId &&
|
|
1500
|
-
"".concat(previousComponentId, "-").concat(isTag(tag) ? tag : escape(getComponentName(tag)));
|
|
1501
|
-
var newOptions = __assign(__assign({}, optionsToCopy), { attrs: finalAttrs, componentId: newComponentId });
|
|
1502
|
-
return createStyledComponent(tag, newOptions, rules);
|
|
1503
|
-
};
|
|
1504
1506
|
Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
|
|
1505
1507
|
get: function () {
|
|
1506
1508
|
return this._foldedDefaultProps;
|
|
@@ -1527,7 +1529,6 @@ function createStyledComponent(target, options, rules) {
|
|
|
1527
1529
|
shouldForwardProp: true,
|
|
1528
1530
|
styledComponentId: true,
|
|
1529
1531
|
target: true,
|
|
1530
|
-
withComponent: true,
|
|
1531
1532
|
});
|
|
1532
1533
|
}
|
|
1533
1534
|
return WrappedStyledComponent;
|
|
@@ -1814,5 +1815,5 @@ if (process.env.NODE_ENV !== 'production' &&
|
|
|
1814
1815
|
window['__styled-components-init__'] += 1;
|
|
1815
1816
|
}
|
|
1816
1817
|
|
|
1817
|
-
export { ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, __PRIVATE__, createGlobalStyle, css, styled as default, isStyledComponent, keyframes, useTheme, SC_VERSION as version, withTheme };
|
|
1818
|
+
export { ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, __PRIVATE__, createGlobalStyle, css, styled as default, isStyledComponent, keyframes, styled, useTheme, SC_VERSION as version, withTheme };
|
|
1818
1819
|
//# sourceMappingURL=styled-components.browser.esm.js.map
|