styled-components 5.2.1 → 5.3.11
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/README.md +187 -0
- package/dist/styled-components-macro.cjs.js +1 -1
- package/dist/styled-components-macro.cjs.js.map +1 -1
- package/dist/styled-components-macro.esm.js +1 -1
- package/dist/styled-components-macro.esm.js.map +1 -1
- 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 +1 -1
- 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/native/dist/base.d.ts +12 -0
- package/native/dist/constants.d.ts +8 -0
- package/native/dist/constructors/constructWithOptions.d.ts +40 -0
- package/native/dist/constructors/createGlobalStyle.d.ts +3 -0
- package/native/dist/constructors/css.d.ts +4 -0
- package/native/dist/constructors/keyframes.d.ts +3 -0
- package/native/dist/constructors/styled.d.ts +181 -0
- package/native/dist/hoc/withTheme.d.ts +3 -0
- package/native/dist/hoc/withTheme.spec.d.ts +1 -0
- package/native/dist/index-standalone.d.ts +2 -0
- package/native/dist/index.d.ts +4 -0
- package/native/dist/macro/index.d.ts +2 -0
- package/native/dist/models/ComponentStyle.d.ts +15 -0
- package/native/dist/models/GlobalStyle.d.ts +11 -0
- package/native/dist/models/InlineStyle.d.ts +6 -0
- package/native/dist/models/Keyframes.d.ts +11 -0
- package/native/dist/models/ServerStyleSheet.d.ts +15 -0
- package/native/dist/models/StyleSheetManager.d.ts +64 -0
- package/native/dist/models/StyledComponent.d.ts +3 -0
- package/native/dist/models/StyledNativeComponent.d.ts +3 -0
- package/native/dist/models/ThemeProvider.d.ts +40 -0
- package/native/dist/native/index.d.ts +36 -0
- package/native/dist/secretInternals.d.ts +5 -0
- package/native/dist/sheet/GroupIDAllocator.d.ts +4 -0
- package/native/dist/sheet/GroupedTag.d.ts +11 -0
- package/native/dist/sheet/Rehydration.d.ts +3 -0
- package/native/dist/sheet/Sheet.d.ts +40 -0
- package/native/dist/sheet/Tag.d.ts +54 -0
- package/native/dist/sheet/dom.d.ts +4 -0
- package/native/dist/sheet/index.d.ts +1 -0
- package/native/dist/sheet/types.d.ts +34 -0
- package/native/dist/styled-components.native.cjs.js +84 -61
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +84 -61
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/globals.d.ts +2 -0
- package/native/dist/test/types.d.ts +9 -0
- package/native/dist/test/utils.d.ts +187 -0
- package/native/dist/test/veryLargeUnionType.d.ts +1 -0
- package/native/dist/types.d.ts +153 -0
- package/native/dist/utils/addUnitIfNeeded.d.ts +1 -0
- package/native/dist/utils/checkDynamicCreation.d.ts +1 -0
- package/native/dist/utils/createWarnTooManyClasses.d.ts +3 -0
- package/native/dist/utils/determineTheme.d.ts +4 -0
- package/native/dist/utils/domElements.d.ts +2 -0
- package/native/dist/utils/empties.d.ts +3 -0
- package/native/dist/utils/error.d.ts +5 -0
- package/native/dist/utils/errors.d.ts +20 -0
- package/native/dist/utils/escape.d.ts +5 -0
- package/native/dist/utils/flatten.d.ts +4 -0
- package/native/dist/utils/generateAlphabeticName.d.ts +1 -0
- package/native/dist/utils/generateComponentId.d.ts +1 -0
- package/native/dist/utils/generateDisplayName.d.ts +2 -0
- package/native/dist/utils/getComponentName.d.ts +2 -0
- package/native/dist/utils/hash.d.ts +3 -0
- package/native/dist/utils/hoist.d.ts +51 -0
- package/native/dist/utils/hyphenateStyleName.d.ts +14 -0
- package/native/dist/utils/interleave.d.ts +2 -0
- package/native/dist/utils/isFunction.d.ts +1 -0
- package/native/dist/utils/isPlainObject.d.ts +1 -0
- package/native/dist/utils/isStatelessFunction.d.ts +1 -0
- package/native/dist/utils/isStaticRules.d.ts +2 -0
- package/native/dist/utils/isStyledComponent.d.ts +2 -0
- package/native/dist/utils/isTag.d.ts +2 -0
- package/native/dist/utils/joinStrings.d.ts +5 -0
- package/native/dist/utils/mixinDeep.d.ts +6 -0
- package/native/dist/utils/nonce.d.ts +1 -0
- package/native/dist/utils/stylis.d.ts +10 -0
- package/package.json +4 -4
- package/primitives/dist/styled-components-primitives.cjs.js +84 -61
- package/primitives/dist/styled-components-primitives.cjs.js.map +1 -1
- package/primitives/dist/styled-components-primitives.esm.js +84 -61
- package/primitives/dist/styled-components-primitives.esm.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isStatelessFunction(test: any): test is Function;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arrays & POJOs merged recursively, other objects and value types are overridden
|
|
3
|
+
* If target is not a POJO or an Array, it will get source properties injected via shallow merge
|
|
4
|
+
* Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
|
|
5
|
+
*/
|
|
6
|
+
export default function mixinDeep(target: any, ...sources: any[]): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getNonce(): string | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Middleware } from 'stylis';
|
|
2
|
+
import { Stringifier } from '../types';
|
|
3
|
+
export type ICreateStylisInstance = {
|
|
4
|
+
options?: {
|
|
5
|
+
namespace?: string;
|
|
6
|
+
prefix?: boolean;
|
|
7
|
+
};
|
|
8
|
+
plugins?: Middleware[];
|
|
9
|
+
};
|
|
10
|
+
export default function createStylisInstance({ options, plugins, }?: ICreateStylisInstance): Stringifier;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styled-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.11",
|
|
4
4
|
"description": "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress",
|
|
5
5
|
"main": "dist/styled-components.cjs.js",
|
|
6
6
|
"jsnext:main": "dist/styled-components.esm.js",
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@babel/helper-module-imports": "^7.0.0",
|
|
67
67
|
"@babel/traverse": "^7.4.5",
|
|
68
|
-
"@emotion/is-prop-valid": "^
|
|
68
|
+
"@emotion/is-prop-valid": "^1.1.0",
|
|
69
69
|
"@emotion/stylis": "^0.8.4",
|
|
70
70
|
"@emotion/unitless": "^0.7.4",
|
|
71
|
-
"babel-plugin-styled-components": ">= 1",
|
|
71
|
+
"babel-plugin-styled-components": ">= 1.12.0",
|
|
72
72
|
"css-to-react-native": "^3.0.0",
|
|
73
73
|
"hoist-non-react-statics": "^3.0.0",
|
|
74
74
|
"shallowequal": "^1.1.0",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"react-dom": "^16.8.6",
|
|
99
99
|
"react-frame-component": "^4.0.2",
|
|
100
100
|
"react-is": "^16.8.6",
|
|
101
|
-
"react-native": "^0.
|
|
101
|
+
"react-native": "^0.63.4",
|
|
102
102
|
"react-primitives": "^0.8.0",
|
|
103
103
|
"react-test-renderer": "^16.8.6",
|
|
104
104
|
"rollup": "^1.13.1",
|
|
@@ -15,7 +15,7 @@ var unitless = _interopDefault(require('@emotion/unitless'));
|
|
|
15
15
|
var supportsColor = _interopDefault(require('supports-color'));
|
|
16
16
|
var hoist = _interopDefault(require('hoist-non-react-statics'));
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
//
|
|
19
19
|
|
|
20
20
|
/* eslint-disable no-bitwise */
|
|
21
21
|
var AD_REPLACER_R = /(a)(d)/gi;
|
|
@@ -43,7 +43,7 @@ function generateAlphabeticName(code) {
|
|
|
43
43
|
return (getAlphabeticChar(x % charsLength) + name).replace(AD_REPLACER_R, '$1-$2');
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
//
|
|
47
47
|
|
|
48
48
|
/* eslint-disable */
|
|
49
49
|
var SEED = 5381; // When we have separate strings it's useful to run a progressive
|
|
@@ -64,34 +64,34 @@ var hash = function hash(x) {
|
|
|
64
64
|
return phash(SEED, x);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
//
|
|
67
|
+
//
|
|
68
68
|
var generateComponentId = (function (str) {
|
|
69
69
|
return generateAlphabeticName(hash(str) >>> 0);
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
//
|
|
73
73
|
function getComponentName(target) {
|
|
74
74
|
return (process.env.NODE_ENV !== 'production' ? typeof target === 'string' && target : false) || // $FlowFixMe
|
|
75
75
|
target.displayName || // $FlowFixMe
|
|
76
76
|
target.name || 'Component';
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
//
|
|
79
|
+
//
|
|
80
80
|
function isFunction(test) {
|
|
81
81
|
return typeof test === 'function';
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
//
|
|
84
|
+
//
|
|
85
85
|
function isStatelessFunction(test) {
|
|
86
86
|
return typeof test === 'function' && !(test.prototype && test.prototype.isReactComponent);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
//
|
|
89
|
+
//
|
|
90
90
|
var isPlainObject = (function (x) {
|
|
91
91
|
return x !== null && typeof x === 'object' && (x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' && !reactIs.typeOf(x);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
//
|
|
94
|
+
//
|
|
95
95
|
function isStyledComponent(target) {
|
|
96
96
|
return target && typeof target.styledComponentId === 'string';
|
|
97
97
|
}
|
|
@@ -151,16 +151,16 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
151
151
|
return target;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
//
|
|
155
|
-
var SC_ATTR = typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
|
|
154
|
+
//
|
|
155
|
+
var SC_ATTR = typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
|
|
156
156
|
var SC_ATTR_ACTIVE = 'active';
|
|
157
157
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
158
|
-
var SC_VERSION = "5.
|
|
158
|
+
var SC_VERSION = "5.3.11";
|
|
159
159
|
var SPLITTER = '/*!sc*/\n';
|
|
160
160
|
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
161
|
-
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== '' ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process
|
|
161
|
+
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env !== 'undefined' ? typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== '' ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' && process.env.SC_DISABLE_SPEEDY !== '' ? process.env.SC_DISABLE_SPEEDY === 'false' ? false : process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== 'production' : false); // Shared empty execution context when generating static styles
|
|
162
162
|
|
|
163
|
-
//
|
|
163
|
+
//
|
|
164
164
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
165
165
|
var EMPTY_OBJECT = Object.freeze({});
|
|
166
166
|
|
|
@@ -184,7 +184,7 @@ var errorMap = {
|
|
|
184
184
|
"17": "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n"
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
-
//
|
|
187
|
+
//
|
|
188
188
|
var ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
|
|
189
189
|
/**
|
|
190
190
|
* super basic version of sprintf
|
|
@@ -221,7 +221,7 @@ function throwStyledComponentsError(code) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
//
|
|
224
|
+
//
|
|
225
225
|
/** Create a GroupedTag with an underlying Tag implementation */
|
|
226
226
|
|
|
227
227
|
var makeGroupedTag = function makeGroupedTag(tag) {
|
|
@@ -315,7 +315,7 @@ var DefaultGroupedTag = /*#__PURE__*/function () {
|
|
|
315
315
|
return DefaultGroupedTag;
|
|
316
316
|
}();
|
|
317
317
|
|
|
318
|
-
//
|
|
318
|
+
//
|
|
319
319
|
var MAX_SMI = 1 << 31 - 1;
|
|
320
320
|
var groupIDRegister = new Map();
|
|
321
321
|
var reverseRegister = new Map();
|
|
@@ -343,11 +343,15 @@ var getIdForGroup = function getIdForGroup(group) {
|
|
|
343
343
|
return reverseRegister.get(group);
|
|
344
344
|
};
|
|
345
345
|
var setGroupForId = function setGroupForId(id, group) {
|
|
346
|
+
if (group >= nextFreeGroup) {
|
|
347
|
+
nextFreeGroup = group + 1;
|
|
348
|
+
}
|
|
349
|
+
|
|
346
350
|
groupIDRegister.set(id, group);
|
|
347
351
|
reverseRegister.set(group, id);
|
|
348
352
|
};
|
|
349
353
|
|
|
350
|
-
//
|
|
354
|
+
//
|
|
351
355
|
var SELECTOR = "style[" + SC_ATTR + "][" + SC_ATTR_VERSION + "=\"" + SC_VERSION + "\"]";
|
|
352
356
|
var MARKER_RE = new RegExp("^" + SC_ATTR + "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)");
|
|
353
357
|
var outputSheet = function outputSheet(sheet) {
|
|
@@ -360,7 +364,7 @@ var outputSheet = function outputSheet(sheet) {
|
|
|
360
364
|
if (id === undefined) continue;
|
|
361
365
|
var names = sheet.names.get(id);
|
|
362
366
|
var rules = tag.getGroup(group);
|
|
363
|
-
if (names
|
|
367
|
+
if (!names || !rules || !names.size) continue;
|
|
364
368
|
var selector = SC_ATTR + ".g" + group + "[id=\"" + id + "\"]";
|
|
365
369
|
var content = '';
|
|
366
370
|
|
|
@@ -393,7 +397,7 @@ var rehydrateNamesFromContent = function rehydrateNamesFromContent(sheet, id, co
|
|
|
393
397
|
};
|
|
394
398
|
|
|
395
399
|
var rehydrateSheetFromTag = function rehydrateSheetFromTag(sheet, style) {
|
|
396
|
-
var parts = style.
|
|
400
|
+
var parts = (style.textContent || '').split(SPLITTER);
|
|
397
401
|
var rules = [];
|
|
398
402
|
|
|
399
403
|
for (var i = 0, l = parts.length; i < l; i++) {
|
|
@@ -437,14 +441,14 @@ var rehydrateSheet = function rehydrateSheet(sheet) {
|
|
|
437
441
|
}
|
|
438
442
|
};
|
|
439
443
|
|
|
440
|
-
//
|
|
444
|
+
//
|
|
441
445
|
|
|
442
446
|
/* eslint-disable camelcase, no-undef */
|
|
443
447
|
var getNonce = function getNonce() {
|
|
444
448
|
return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
|
|
445
449
|
};
|
|
446
450
|
|
|
447
|
-
//
|
|
451
|
+
//
|
|
448
452
|
var ELEMENT_TYPE = 1;
|
|
449
453
|
/* Node.ELEMENT_TYPE */
|
|
450
454
|
|
|
@@ -502,7 +506,7 @@ var getSheet = function getSheet(tag) {
|
|
|
502
506
|
return undefined;
|
|
503
507
|
};
|
|
504
508
|
|
|
505
|
-
//
|
|
509
|
+
//
|
|
506
510
|
/** Create a CSSStyleSheet-like tag depending on the environment */
|
|
507
511
|
|
|
508
512
|
var makeTag = function makeTag(_ref) {
|
|
@@ -654,9 +658,10 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
654
658
|
|
|
655
659
|
this.options = _extends({}, defaultOptions, {}, options);
|
|
656
660
|
this.gs = globalStyles;
|
|
657
|
-
this.names = new Map(names);
|
|
661
|
+
this.names = new Map(names);
|
|
662
|
+
this.server = !!options.isServer; // We rehydrate only once and use the sheet that is created first
|
|
658
663
|
|
|
659
|
-
if (!this.
|
|
664
|
+
if (!this.server && IS_BROWSER && SHOULD_REHYDRATE) {
|
|
660
665
|
SHOULD_REHYDRATE = false;
|
|
661
666
|
rehydrateSheet(this);
|
|
662
667
|
}
|
|
@@ -843,7 +848,7 @@ function createStylisInstance(_temp) {
|
|
|
843
848
|
|
|
844
849
|
var selfReferenceReplacer = function selfReferenceReplacer(match, offset, string) {
|
|
845
850
|
if ( // do not replace the first occurrence if it is complex (has a modifier)
|
|
846
|
-
(offset === 0 ?
|
|
851
|
+
(offset === 0 ? COMPLEX_SELECTOR_PREFIX.indexOf(string[_selector.length]) === -1 : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
|
|
847
852
|
!string.match(_consecutiveSelfRefRegExp)) {
|
|
848
853
|
return "." + _componentId;
|
|
849
854
|
}
|
|
@@ -901,7 +906,7 @@ function createStylisInstance(_temp) {
|
|
|
901
906
|
return stringifyRules;
|
|
902
907
|
}
|
|
903
908
|
|
|
904
|
-
//
|
|
909
|
+
//
|
|
905
910
|
var StyleSheetContext = React__default.createContext();
|
|
906
911
|
var StyleSheetConsumer = StyleSheetContext.Consumer;
|
|
907
912
|
var StylisContext = React__default.createContext();
|
|
@@ -909,7 +914,7 @@ var StylisConsumer = StylisContext.Consumer;
|
|
|
909
914
|
var masterSheet = new StyleSheet();
|
|
910
915
|
var masterStylis = createStylisInstance();
|
|
911
916
|
|
|
912
|
-
//
|
|
917
|
+
//
|
|
913
918
|
|
|
914
919
|
var Keyframes = /*#__PURE__*/function () {
|
|
915
920
|
function Keyframes(name, rules) {
|
|
@@ -949,7 +954,7 @@ var Keyframes = /*#__PURE__*/function () {
|
|
|
949
954
|
return Keyframes;
|
|
950
955
|
}();
|
|
951
956
|
|
|
952
|
-
//
|
|
957
|
+
//
|
|
953
958
|
|
|
954
959
|
/**
|
|
955
960
|
* inlined version of
|
|
@@ -984,7 +989,7 @@ function hyphenateStyleName(string) {
|
|
|
984
989
|
return uppercaseCheck.test(string) ? string.replace(uppercasePattern, prefixAndLowerCase).replace(msPattern, '-ms-') : string;
|
|
985
990
|
}
|
|
986
991
|
|
|
987
|
-
//
|
|
992
|
+
//
|
|
988
993
|
|
|
989
994
|
function addUnitIfNeeded(name, value) {
|
|
990
995
|
// https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/133
|
|
@@ -993,14 +998,14 @@ function addUnitIfNeeded(name, value) {
|
|
|
993
998
|
return '';
|
|
994
999
|
}
|
|
995
1000
|
|
|
996
|
-
if (typeof value === 'number' && value !== 0 && !(name in unitless)) {
|
|
997
|
-
return value + "px"; // Presumes implicit 'px' suffix for unitless numbers
|
|
1001
|
+
if (typeof value === 'number' && value !== 0 && !(name in unitless) && !name.startsWith('--')) {
|
|
1002
|
+
return value + "px"; // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
|
|
998
1003
|
}
|
|
999
1004
|
|
|
1000
1005
|
return String(value).trim();
|
|
1001
1006
|
}
|
|
1002
1007
|
|
|
1003
|
-
//
|
|
1008
|
+
//
|
|
1004
1009
|
/**
|
|
1005
1010
|
* It's falsish not falsy because 0 is allowed.
|
|
1006
1011
|
*/
|
|
@@ -1015,10 +1020,10 @@ var objToCssArray = function objToCssArray(obj, prevKey) {
|
|
|
1015
1020
|
for (var key in obj) {
|
|
1016
1021
|
if (!obj.hasOwnProperty(key) || isFalsish(obj[key])) continue;
|
|
1017
1022
|
|
|
1018
|
-
if (
|
|
1019
|
-
rules.push.apply(rules, objToCssArray(obj[key], key));
|
|
1020
|
-
} else if (isFunction(obj[key])) {
|
|
1023
|
+
if (Array.isArray(obj[key]) && obj[key].isCss || isFunction(obj[key])) {
|
|
1021
1024
|
rules.push(hyphenateStyleName(key) + ":", obj[key], ';');
|
|
1025
|
+
} else if (isPlainObject(obj[key])) {
|
|
1026
|
+
rules.push.apply(rules, objToCssArray(obj[key], key));
|
|
1022
1027
|
} else {
|
|
1023
1028
|
rules.push(hyphenateStyleName(key) + ": " + addUnitIfNeeded(key, obj[key]) + ";");
|
|
1024
1029
|
}
|
|
@@ -1075,7 +1080,7 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
|
|
|
1075
1080
|
return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
|
|
1076
1081
|
}
|
|
1077
1082
|
|
|
1078
|
-
//
|
|
1083
|
+
//
|
|
1079
1084
|
var printed = {};
|
|
1080
1085
|
function warnOnce(message) {
|
|
1081
1086
|
if (printed[message]) return;
|
|
@@ -1083,7 +1088,7 @@ function warnOnce(message) {
|
|
|
1083
1088
|
if (typeof console !== 'undefined' && console.warn) console.warn(message);
|
|
1084
1089
|
}
|
|
1085
1090
|
|
|
1086
|
-
//
|
|
1091
|
+
//
|
|
1087
1092
|
var SINGLE_QUOTE = "'".charCodeAt(0);
|
|
1088
1093
|
var DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
1089
1094
|
var BACKSLASH = '\\'.charCodeAt(0);
|
|
@@ -1354,7 +1359,7 @@ function tokenize(input, options) {
|
|
|
1354
1359
|
return tokens;
|
|
1355
1360
|
}
|
|
1356
1361
|
|
|
1357
|
-
//
|
|
1362
|
+
//
|
|
1358
1363
|
var HIGHLIGHT_THEME = {
|
|
1359
1364
|
brackets: [36, 39],
|
|
1360
1365
|
// cyan
|
|
@@ -1632,7 +1637,7 @@ var CssSyntaxError = /*#__PURE__*/function () {
|
|
|
1632
1637
|
return CssSyntaxError;
|
|
1633
1638
|
}();
|
|
1634
1639
|
|
|
1635
|
-
//
|
|
1640
|
+
//
|
|
1636
1641
|
|
|
1637
1642
|
/* eslint-disable valid-jsdoc */
|
|
1638
1643
|
var defaultRaw = {
|
|
@@ -1978,7 +1983,7 @@ var Stringifier = /*#__PURE__*/function () {
|
|
|
1978
1983
|
return Stringifier;
|
|
1979
1984
|
}();
|
|
1980
1985
|
|
|
1981
|
-
//
|
|
1986
|
+
//
|
|
1982
1987
|
function stringify(node, builder) {
|
|
1983
1988
|
var str = new Stringifier(builder);
|
|
1984
1989
|
str.stringify(node);
|
|
@@ -2789,7 +2794,7 @@ var Comment = /*#__PURE__*/function (_Node) {
|
|
|
2789
2794
|
return Comment;
|
|
2790
2795
|
}(Node);
|
|
2791
2796
|
|
|
2792
|
-
//
|
|
2797
|
+
//
|
|
2793
2798
|
|
|
2794
2799
|
var Parser = /*#__PURE__*/function () {
|
|
2795
2800
|
function Parser(input) {
|
|
@@ -3315,7 +3320,7 @@ var Parser = /*#__PURE__*/function () {
|
|
|
3315
3320
|
return Parser;
|
|
3316
3321
|
}();
|
|
3317
3322
|
|
|
3318
|
-
//
|
|
3323
|
+
//
|
|
3319
3324
|
function parse(css, opts) {
|
|
3320
3325
|
if (opts && opts.safe) {
|
|
3321
3326
|
throw new Error('Option safe was removed. ' + 'Use parser: require("postcss-safe-parser")');
|
|
@@ -4271,7 +4276,7 @@ var AtRule = /*#__PURE__*/function (_Container) {
|
|
|
4271
4276
|
return AtRule;
|
|
4272
4277
|
}(Container);
|
|
4273
4278
|
|
|
4274
|
-
//
|
|
4279
|
+
//
|
|
4275
4280
|
|
|
4276
4281
|
/**
|
|
4277
4282
|
* Contains helpers for safely splitting lists of CSS values,
|
|
@@ -4464,7 +4469,7 @@ var Rule = /*#__PURE__*/function (_Container) {
|
|
|
4464
4469
|
return Rule;
|
|
4465
4470
|
}(Container);
|
|
4466
4471
|
|
|
4467
|
-
//
|
|
4472
|
+
//
|
|
4468
4473
|
|
|
4469
4474
|
/**
|
|
4470
4475
|
* Represents a plugin’s warning. It can be created using {@link Node#warn}.
|
|
@@ -5147,7 +5152,7 @@ var LazyResult = /*#__PURE__*/function () {
|
|
|
5147
5152
|
return LazyResult;
|
|
5148
5153
|
}();
|
|
5149
5154
|
|
|
5150
|
-
//
|
|
5155
|
+
//
|
|
5151
5156
|
/**
|
|
5152
5157
|
* @callback builder
|
|
5153
5158
|
* @param {string} part - part of generated CSS connected to this node
|
|
@@ -5738,7 +5743,7 @@ var SafeParser = /*#__PURE__*/function (_Parser) {
|
|
|
5738
5743
|
return SafeParser;
|
|
5739
5744
|
}(Parser);
|
|
5740
5745
|
|
|
5741
|
-
//
|
|
5746
|
+
//
|
|
5742
5747
|
function safeParse(css, opts) {
|
|
5743
5748
|
var input = new Input(css, opts);
|
|
5744
5749
|
var parser = new SafeParser(input);
|
|
@@ -5747,7 +5752,7 @@ function safeParse(css, opts) {
|
|
|
5747
5752
|
return parser.root;
|
|
5748
5753
|
}
|
|
5749
5754
|
|
|
5750
|
-
//
|
|
5755
|
+
//
|
|
5751
5756
|
var generated = {};
|
|
5752
5757
|
/*
|
|
5753
5758
|
InlineStyle takes arbitrary CSS and generates a flat object
|
|
@@ -5862,7 +5867,7 @@ function mixinDeep(target) {
|
|
|
5862
5867
|
return target;
|
|
5863
5868
|
}
|
|
5864
5869
|
|
|
5865
|
-
//
|
|
5870
|
+
//
|
|
5866
5871
|
var determineTheme = (function (props, providedTheme, defaultProps) {
|
|
5867
5872
|
if (defaultProps === void 0) {
|
|
5868
5873
|
defaultProps = EMPTY_OBJECT;
|
|
@@ -5871,12 +5876,12 @@ var determineTheme = (function (props, providedTheme, defaultProps) {
|
|
|
5871
5876
|
return props.theme !== defaultProps.theme && props.theme || providedTheme || defaultProps.theme;
|
|
5872
5877
|
});
|
|
5873
5878
|
|
|
5874
|
-
//
|
|
5879
|
+
//
|
|
5875
5880
|
function isTag(target) {
|
|
5876
5881
|
return typeof target === 'string' && (process.env.NODE_ENV !== 'production' ? target.charAt(0) === target.charAt(0).toLowerCase() : true);
|
|
5877
5882
|
}
|
|
5878
5883
|
|
|
5879
|
-
//
|
|
5884
|
+
//
|
|
5880
5885
|
function generateDisplayName(target) {
|
|
5881
5886
|
return isTag(target) ? "styled." + target : "Styled(" + getComponentName(target) + ")";
|
|
5882
5887
|
}
|
|
@@ -5959,9 +5964,10 @@ var StyledNativeComponent = /*#__PURE__*/function (_Component) {
|
|
|
5959
5964
|
forwardedComponent = _this2$props.forwardedComponent,
|
|
5960
5965
|
forwardedAs = _this2$props.forwardedAs,
|
|
5961
5966
|
forwardedRef = _this2$props.forwardedRef,
|
|
5967
|
+
testID = _this2$props.testID,
|
|
5962
5968
|
_this2$props$style = _this2$props.style,
|
|
5963
5969
|
style = _this2$props$style === void 0 ? [] : _this2$props$style,
|
|
5964
|
-
props = _objectWithoutPropertiesLoose(_this2$props, ["$as", "as", "forwardedComponent", "forwardedAs", "forwardedRef", "style"]);
|
|
5970
|
+
props = _objectWithoutPropertiesLoose(_this2$props, ["$as", "as", "forwardedComponent", "forwardedAs", "forwardedRef", "testID", "style"]);
|
|
5965
5971
|
|
|
5966
5972
|
var defaultProps = forwardedComponent.defaultProps,
|
|
5967
5973
|
target = forwardedComponent.target,
|
|
@@ -5985,7 +5991,10 @@ var StyledNativeComponent = /*#__PURE__*/function (_Component) {
|
|
|
5985
5991
|
}
|
|
5986
5992
|
}
|
|
5987
5993
|
|
|
5988
|
-
propsForElement.style =
|
|
5994
|
+
propsForElement.style = typeof style === 'function' ? function (state) {
|
|
5995
|
+
return [generatedStyles].concat(style(state));
|
|
5996
|
+
} : [generatedStyles].concat(style);
|
|
5997
|
+
propsForElement.testID = testID || propsForElement.testID;
|
|
5989
5998
|
if (forwardedRef) propsForElement.ref = forwardedRef;
|
|
5990
5999
|
if (forwardedAs) propsForElement.as = forwardedAs;
|
|
5991
6000
|
return React.createElement(elementToBeRendered, propsForElement);
|
|
@@ -6067,9 +6076,9 @@ var _StyledNativeComponent = (function (InlineStyle) {
|
|
|
6067
6076
|
if (isTargetStyledComp && target.shouldForwardProp) {
|
|
6068
6077
|
if (shouldForwardProp) {
|
|
6069
6078
|
// compose nested shouldForwardProp calls
|
|
6070
|
-
shouldForwardProp = function shouldForwardProp(prop, filterFn) {
|
|
6079
|
+
shouldForwardProp = function shouldForwardProp(prop, filterFn, elementToBeCreated) {
|
|
6071
6080
|
return (// $FlowFixMe
|
|
6072
|
-
target.shouldForwardProp(prop, filterFn) && options.shouldForwardProp(prop, filterFn)
|
|
6081
|
+
target.shouldForwardProp(prop, filterFn, elementToBeCreated) && options.shouldForwardProp(prop, filterFn, elementToBeCreated)
|
|
6073
6082
|
);
|
|
6074
6083
|
};
|
|
6075
6084
|
} else {
|
|
@@ -6140,7 +6149,7 @@ var _StyledNativeComponent = (function (InlineStyle) {
|
|
|
6140
6149
|
return createStyledNativeComponent;
|
|
6141
6150
|
});
|
|
6142
6151
|
|
|
6143
|
-
//
|
|
6152
|
+
//
|
|
6144
6153
|
var interleave = (function (strings, interpolations) {
|
|
6145
6154
|
var result = [strings[0]];
|
|
6146
6155
|
|
|
@@ -6151,7 +6160,21 @@ var interleave = (function (strings, interpolations) {
|
|
|
6151
6160
|
return result;
|
|
6152
6161
|
});
|
|
6153
6162
|
|
|
6154
|
-
//
|
|
6163
|
+
//
|
|
6164
|
+
/**
|
|
6165
|
+
* Used when flattening object styles to determine if we should
|
|
6166
|
+
* expand an array of styles.
|
|
6167
|
+
*/
|
|
6168
|
+
|
|
6169
|
+
var addTag = function addTag(arg) {
|
|
6170
|
+
if (Array.isArray(arg)) {
|
|
6171
|
+
// eslint-disable-next-line no-param-reassign
|
|
6172
|
+
arg.isCss = true;
|
|
6173
|
+
}
|
|
6174
|
+
|
|
6175
|
+
return arg;
|
|
6176
|
+
};
|
|
6177
|
+
|
|
6155
6178
|
function css(styles) {
|
|
6156
6179
|
for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
6157
6180
|
interpolations[_key - 1] = arguments[_key];
|
|
@@ -6159,16 +6182,16 @@ function css(styles) {
|
|
|
6159
6182
|
|
|
6160
6183
|
if (isFunction(styles) || isPlainObject(styles)) {
|
|
6161
6184
|
// $FlowFixMe
|
|
6162
|
-
return flatten(interleave(EMPTY_ARRAY, [styles].concat(interpolations)));
|
|
6185
|
+
return addTag(flatten(interleave(EMPTY_ARRAY, [styles].concat(interpolations))));
|
|
6163
6186
|
}
|
|
6164
6187
|
|
|
6165
|
-
if (interpolations.length === 0 && styles.length === 1 && typeof styles[0] ===
|
|
6188
|
+
if (interpolations.length === 0 && styles.length === 1 && typeof styles[0] === 'string') {
|
|
6166
6189
|
// $FlowFixMe
|
|
6167
6190
|
return styles;
|
|
6168
6191
|
} // $FlowFixMe
|
|
6169
6192
|
|
|
6170
6193
|
|
|
6171
|
-
return flatten(interleave(styles, interpolations));
|
|
6194
|
+
return addTag(flatten(interleave(styles, interpolations)));
|
|
6172
6195
|
}
|
|
6173
6196
|
|
|
6174
6197
|
function constructWithOptions(componentConstructor, tag, options) {
|
|
@@ -6233,13 +6256,13 @@ var withTheme = (function (Component) {
|
|
|
6233
6256
|
return WithTheme;
|
|
6234
6257
|
});
|
|
6235
6258
|
|
|
6236
|
-
//
|
|
6259
|
+
//
|
|
6237
6260
|
|
|
6238
6261
|
var useTheme = function useTheme() {
|
|
6239
6262
|
return React.useContext(ThemeContext);
|
|
6240
6263
|
};
|
|
6241
6264
|
|
|
6242
|
-
//
|
|
6265
|
+
//
|
|
6243
6266
|
|
|
6244
6267
|
var InlineStyle = _InlineStyle(reactPrimitives.StyleSheet);
|
|
6245
6268
|
|