styled-components 6.0.0-alpha.7 → 6.0.0-beta.2

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.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/dist/constructors/constructWithOptions.d.ts +16 -21
  3. package/dist/constructors/css.d.ts +2 -2
  4. package/dist/constructors/styled.d.ts +179 -179
  5. package/dist/models/ComponentStyle.d.ts +1 -0
  6. package/dist/models/StyledComponent.d.ts +1 -1
  7. package/dist/models/StyledNativeComponent.d.ts +2 -2
  8. package/dist/native/index.d.ts +29 -29
  9. package/dist/styled-components-macro.cjs.js +47 -1
  10. package/dist/styled-components-macro.cjs.js.map +1 -1
  11. package/dist/styled-components-macro.esm.js +38 -1
  12. package/dist/styled-components-macro.esm.js.map +1 -1
  13. package/dist/styled-components.browser.cjs.js +1854 -1
  14. package/dist/styled-components.browser.cjs.js.map +1 -1
  15. package/dist/styled-components.browser.esm.js +1829 -1
  16. package/dist/styled-components.browser.esm.js.map +1 -1
  17. package/dist/styled-components.cjs.js +1874 -1
  18. package/dist/styled-components.cjs.js.map +1 -1
  19. package/dist/styled-components.esm.js +1849 -1
  20. package/dist/styled-components.esm.js.map +1 -1
  21. package/dist/styled-components.js +2074 -1
  22. package/dist/styled-components.js.map +1 -1
  23. package/dist/styled-components.min.js +1 -1
  24. package/dist/styled-components.min.js.map +1 -1
  25. package/dist/test/utils.d.ts +178 -178
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/types.d.ts +33 -44
  28. package/dist/utils/generateDisplayName.d.ts +1 -1
  29. package/dist/utils/getComponentName.d.ts +1 -1
  30. package/dist/utils/isStyledComponent.d.ts +1 -1
  31. package/dist/utils/isTag.d.ts +1 -1
  32. package/dist/utils/stylis.d.ts +2 -1
  33. package/native/dist/constructors/constructWithOptions.d.ts +16 -21
  34. package/native/dist/constructors/css.d.ts +2 -2
  35. package/native/dist/constructors/styled.d.ts +179 -179
  36. package/native/dist/models/ComponentStyle.d.ts +1 -0
  37. package/native/dist/models/StyledComponent.d.ts +1 -1
  38. package/native/dist/models/StyledNativeComponent.d.ts +2 -2
  39. package/native/dist/native/index.d.ts +29 -29
  40. package/native/dist/styled-components.native.cjs.js +438 -403
  41. package/native/dist/styled-components.native.cjs.js.map +1 -1
  42. package/native/dist/styled-components.native.esm.js +439 -404
  43. package/native/dist/styled-components.native.esm.js.map +1 -1
  44. package/native/dist/test/utils.d.ts +178 -178
  45. package/native/dist/types.d.ts +33 -44
  46. package/native/dist/utils/generateDisplayName.d.ts +1 -1
  47. package/native/dist/utils/getComponentName.d.ts +1 -1
  48. package/native/dist/utils/isStyledComponent.d.ts +1 -1
  49. package/native/dist/utils/isTag.d.ts +1 -1
  50. package/native/dist/utils/stylis.d.ts +2 -1
  51. package/package.json +8 -8
  52. package/test-utils/setupTestFramework.ts +9 -3
@@ -1,12 +1,13 @@
1
+ import { __spreadArray, __assign } from 'tslib';
1
2
  import React, { useContext, useMemo, createElement } from 'react';
2
3
  import 'shallowequal';
3
- import { prefixer, stringify, serialize, compile, middleware, RULESET } from 'stylis';
4
+ import { prefixer, stringify, middleware, compile, RULESET } from 'stylis';
4
5
  import unitless from '@emotion/unitless';
5
6
  import transformDeclPairs from 'css-to-react-native';
6
7
  import { parse } from 'postcss';
7
8
 
8
- const EMPTY_ARRAY = Object.freeze([]);
9
- const EMPTY_OBJECT = Object.freeze({});
9
+ var EMPTY_ARRAY = Object.freeze([]);
10
+ var EMPTY_OBJECT = Object.freeze({});
10
11
 
11
12
  var errorMap = {
12
13
  '1': 'Cannot create styled-component for component: %s.\n\n',
@@ -28,17 +29,21 @@ var errorMap = {
28
29
  '17': "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",
29
30
  };
30
31
 
31
- const ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
32
+ var ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
32
33
  /**
33
34
  * super basic version of sprintf
34
35
  */
35
- function format(...args) {
36
- let a = args[0];
37
- const b = [];
38
- for (let c = 1, len = args.length; c < len; c += 1) {
36
+ function format() {
37
+ var args = [];
38
+ for (var _i = 0; _i < arguments.length; _i++) {
39
+ args[_i] = arguments[_i];
40
+ }
41
+ var a = args[0];
42
+ var b = [];
43
+ for (var c = 1, len = args.length; c < len; c += 1) {
39
44
  b.push(args[c]);
40
45
  }
41
- b.forEach(d => {
46
+ b.forEach(function (d) {
42
47
  a = a.replace(/%[a-z]/, d);
43
48
  });
44
49
  return a;
@@ -47,23 +52,27 @@ function format(...args) {
47
52
  * Create an error file out of errors.md for development and a simple web link to the full errors
48
53
  * in production mode.
49
54
  */
50
- function throwStyledComponentsError(code, ...interpolations) {
55
+ function throwStyledComponentsError(code) {
56
+ var interpolations = [];
57
+ for (var _i = 1; _i < arguments.length; _i++) {
58
+ interpolations[_i - 1] = arguments[_i];
59
+ }
51
60
  if (process.env.NODE_ENV === 'production') {
52
- return new Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${code} for more information.${interpolations.length > 0 ? ` Args: ${interpolations.join(', ')}` : ''}`);
61
+ return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(code, " for more information.").concat(interpolations.length > 0 ? " Args: ".concat(interpolations.join(', ')) : ''));
53
62
  }
54
63
  else {
55
- return new Error(format(ERRORS[code], ...interpolations).trim());
64
+ return new Error(format.apply(void 0, __spreadArray([ERRORS[code]], interpolations, false)).trim());
56
65
  }
57
66
  }
58
67
 
59
- const SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
68
+ var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
60
69
  'data-styled';
61
- const SC_ATTR_ACTIVE = 'active';
62
- const SC_ATTR_VERSION = 'data-styled-version';
63
- const SC_VERSION = "6.0.0-alpha.7";
64
- const SPLITTER = '/*!sc*/\n';
65
- const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
66
- const DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
70
+ var SC_ATTR_ACTIVE = 'active';
71
+ var SC_ATTR_VERSION = 'data-styled-version';
72
+ var SC_VERSION = "6.0.0-beta.2";
73
+ var SPLITTER = '/*!sc*/\n';
74
+ var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
75
+ var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
67
76
  ? SC_DISABLE_SPEEDY
68
77
  : typeof process !== 'undefined' &&
69
78
  typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
@@ -80,47 +89,44 @@ const DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
80
89
  : process.env.NODE_ENV !== 'production');
81
90
 
82
91
  /** Create a GroupedTag with an underlying Tag implementation */
83
- const makeGroupedTag = (tag) => {
92
+ var makeGroupedTag = function (tag) {
84
93
  return new DefaultGroupedTag(tag);
85
94
  };
86
- const BASE_SIZE = 1 << 9;
87
- const DefaultGroupedTag = class DefaultGroupedTag {
88
- groupSizes;
89
- length;
90
- tag;
91
- constructor(tag) {
95
+ var BASE_SIZE = 1 << 9;
96
+ var DefaultGroupedTag = /** @class */ (function () {
97
+ function DefaultGroupedTag(tag) {
92
98
  this.groupSizes = new Uint32Array(BASE_SIZE);
93
99
  this.length = BASE_SIZE;
94
100
  this.tag = tag;
95
101
  }
96
- indexOfGroup(group) {
97
- let index = 0;
98
- for (let i = 0; i < group; i++) {
102
+ DefaultGroupedTag.prototype.indexOfGroup = function (group) {
103
+ var index = 0;
104
+ for (var i = 0; i < group; i++) {
99
105
  index += this.groupSizes[i];
100
106
  }
101
107
  return index;
102
- }
103
- insertRules(group, rules) {
108
+ };
109
+ DefaultGroupedTag.prototype.insertRules = function (group, rules) {
104
110
  if (group >= this.groupSizes.length) {
105
- const oldBuffer = this.groupSizes;
106
- const oldSize = oldBuffer.length;
107
- let newSize = oldSize;
111
+ var oldBuffer = this.groupSizes;
112
+ var oldSize = oldBuffer.length;
113
+ var newSize = oldSize;
108
114
  while (group >= newSize) {
109
115
  newSize <<= 1;
110
116
  if (newSize < 0) {
111
- throw throwStyledComponentsError(16, `${group}`);
117
+ throw throwStyledComponentsError(16, "".concat(group));
112
118
  }
113
119
  }
114
120
  this.groupSizes = new Uint32Array(newSize);
115
121
  this.groupSizes.set(oldBuffer);
116
122
  this.length = newSize;
117
- for (let i = oldSize; i < newSize; i++) {
123
+ for (var i = oldSize; i < newSize; i++) {
118
124
  this.groupSizes[i] = 0;
119
125
  }
120
126
  }
121
- let ruleIndex = this.indexOfGroup(group + 1);
127
+ var ruleIndex = this.indexOfGroup(group + 1);
122
128
  if (Array.isArray(rules)) {
123
- for (let i = 0, l = rules.length; i < l; i++) {
129
+ for (var i = 0, l = rules.length; i < l; i++) {
124
130
  if (this.tag.insertRule(ruleIndex, rules[i])) {
125
131
  this.groupSizes[group]++;
126
132
  ruleIndex++;
@@ -132,110 +138,115 @@ const DefaultGroupedTag = class DefaultGroupedTag {
132
138
  this.groupSizes[group]++;
133
139
  }
134
140
  }
135
- }
136
- clearGroup(group) {
141
+ };
142
+ DefaultGroupedTag.prototype.clearGroup = function (group) {
137
143
  if (group < this.length) {
138
- const length = this.groupSizes[group];
139
- const startIndex = this.indexOfGroup(group);
140
- const endIndex = startIndex + length;
144
+ var length_1 = this.groupSizes[group];
145
+ var startIndex = this.indexOfGroup(group);
146
+ var endIndex = startIndex + length_1;
141
147
  this.groupSizes[group] = 0;
142
- for (let i = startIndex; i < endIndex; i++) {
148
+ for (var i = startIndex; i < endIndex; i++) {
143
149
  this.tag.deleteRule(startIndex);
144
150
  }
145
151
  }
146
- }
147
- getGroup(group) {
148
- let css = '';
152
+ };
153
+ DefaultGroupedTag.prototype.getGroup = function (group) {
154
+ var css = '';
149
155
  if (group >= this.length || this.groupSizes[group] === 0) {
150
156
  return css;
151
157
  }
152
- const length = this.groupSizes[group];
153
- const startIndex = this.indexOfGroup(group);
154
- const endIndex = startIndex + length;
155
- for (let i = startIndex; i < endIndex; i++) {
156
- css += `${this.tag.getRule(i)}${SPLITTER}`;
158
+ var length = this.groupSizes[group];
159
+ var startIndex = this.indexOfGroup(group);
160
+ var endIndex = startIndex + length;
161
+ for (var i = startIndex; i < endIndex; i++) {
162
+ css += "".concat(this.tag.getRule(i)).concat(SPLITTER);
157
163
  }
158
164
  return css;
159
- }
160
- };
165
+ };
166
+ return DefaultGroupedTag;
167
+ }());
161
168
 
162
- const MAX_SMI = 1 << (31 - 1);
163
- let groupIDRegister = new Map();
164
- let reverseRegister = new Map();
165
- let nextFreeGroup = 1;
166
- const getGroupForId = (id) => {
169
+ var MAX_SMI = 1 << (31 - 1);
170
+ var groupIDRegister = new Map();
171
+ var reverseRegister = new Map();
172
+ var nextFreeGroup = 1;
173
+ var getGroupForId = function (id) {
167
174
  if (groupIDRegister.has(id)) {
168
175
  return groupIDRegister.get(id);
169
176
  }
170
177
  while (reverseRegister.has(nextFreeGroup)) {
171
178
  nextFreeGroup++;
172
179
  }
173
- const group = nextFreeGroup++;
180
+ var group = nextFreeGroup++;
174
181
  if (process.env.NODE_ENV !== 'production' && ((group | 0) < 0 || group > MAX_SMI)) {
175
- throw throwStyledComponentsError(16, `${group}`);
182
+ throw throwStyledComponentsError(16, "".concat(group));
176
183
  }
177
184
  groupIDRegister.set(id, group);
178
185
  reverseRegister.set(group, id);
179
186
  return group;
180
187
  };
181
- const getIdForGroup = (group) => {
188
+ var getIdForGroup = function (group) {
182
189
  return reverseRegister.get(group);
183
190
  };
184
- const setGroupForId = (id, group) => {
191
+ var setGroupForId = function (id, group) {
185
192
  groupIDRegister.set(id, group);
186
193
  reverseRegister.set(group, id);
187
194
  };
188
195
 
189
- const SELECTOR = `style[${SC_ATTR}][${SC_ATTR_VERSION}="${SC_VERSION}"]`;
190
- const MARKER_RE = new RegExp(`^${SC_ATTR}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`);
191
- const outputSheet = (sheet) => {
192
- const tag = sheet.getTag();
193
- const { length } = tag;
194
- let css = '';
195
- for (let group = 0; group < length; group++) {
196
- const id = getIdForGroup(group);
196
+ var SELECTOR = "style[".concat(SC_ATTR, "][").concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\"]");
197
+ var MARKER_RE = new RegExp("^".concat(SC_ATTR, "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)"));
198
+ var outputSheet = function (sheet) {
199
+ var tag = sheet.getTag();
200
+ var length = tag.length;
201
+ var css = '';
202
+ var _loop_1 = function (group) {
203
+ var id = getIdForGroup(group);
197
204
  if (id === undefined)
198
- continue;
199
- const names = sheet.names.get(id);
200
- const rules = tag.getGroup(group);
205
+ return "continue";
206
+ var names = sheet.names.get(id);
207
+ var rules = tag.getGroup(group);
201
208
  if (names === undefined || rules.length === 0)
202
- continue;
203
- const selector = `${SC_ATTR}.g${group}[id="${id}"]`;
204
- let content = '';
209
+ return "continue";
210
+ var selector = "".concat(SC_ATTR, ".g").concat(group, "[id=\"").concat(id, "\"]");
211
+ var content = '';
205
212
  if (names !== undefined) {
206
- names.forEach(name => {
213
+ names.forEach(function (name) {
207
214
  if (name.length > 0) {
208
- content += `${name},`;
215
+ content += "".concat(name, ",");
209
216
  }
210
217
  });
211
218
  }
212
219
  // NOTE: It's easier to collect rules and have the marker
213
220
  // after the actual rules to simplify the rehydration
214
- css += `${rules}${selector}{content:"${content}"}${SPLITTER}`;
221
+ css += "".concat(rules).concat(selector, "{content:\"").concat(content, "\"}").concat(SPLITTER);
222
+ };
223
+ for (var group = 0; group < length; group++) {
224
+ _loop_1(group);
215
225
  }
216
226
  return css;
217
227
  };
218
- const rehydrateNamesFromContent = (sheet, id, content) => {
219
- const names = content.split(',');
220
- let name;
221
- for (let i = 0, l = names.length; i < l; i++) {
228
+ var rehydrateNamesFromContent = function (sheet, id, content) {
229
+ var names = content.split(',');
230
+ var name;
231
+ for (var i = 0, l = names.length; i < l; i++) {
222
232
  // eslint-disable-next-line
223
233
  if ((name = names[i])) {
224
234
  sheet.registerName(id, name);
225
235
  }
226
236
  }
227
237
  };
228
- const rehydrateSheetFromTag = (sheet, style) => {
229
- const parts = (style.textContent ?? '').split(SPLITTER);
230
- const rules = [];
231
- for (let i = 0, l = parts.length; i < l; i++) {
232
- const part = parts[i].trim();
238
+ var rehydrateSheetFromTag = function (sheet, style) {
239
+ var _a;
240
+ var parts = ((_a = style.textContent) !== null && _a !== void 0 ? _a : '').split(SPLITTER);
241
+ var rules = [];
242
+ for (var i = 0, l = parts.length; i < l; i++) {
243
+ var part = parts[i].trim();
233
244
  if (!part)
234
245
  continue;
235
- const marker = part.match(MARKER_RE);
246
+ var marker = part.match(MARKER_RE);
236
247
  if (marker) {
237
- const group = parseInt(marker[1], 10) | 0;
238
- const id = marker[2];
248
+ var group = parseInt(marker[1], 10) | 0;
249
+ var id = marker[2];
239
250
  if (group !== 0) {
240
251
  // Rehydrate componentId to group index mapping
241
252
  setGroupForId(id, group);
@@ -251,10 +262,10 @@ const rehydrateSheetFromTag = (sheet, style) => {
251
262
  }
252
263
  }
253
264
  };
254
- const rehydrateSheet = (sheet) => {
255
- const nodes = document.querySelectorAll(SELECTOR);
256
- for (let i = 0, l = nodes.length; i < l; i++) {
257
- const node = nodes[i];
265
+ var rehydrateSheet = function (sheet) {
266
+ var nodes = document.querySelectorAll(SELECTOR);
267
+ for (var i = 0, l = nodes.length; i < l; i++) {
268
+ var node = nodes[i];
258
269
  if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {
259
270
  rehydrateSheetFromTag(sheet, node);
260
271
  if (node.parentNode) {
@@ -268,13 +279,13 @@ function getNonce() {
268
279
  return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
269
280
  }
270
281
 
271
- const ELEMENT_TYPE = 1;
282
+ var ELEMENT_TYPE = 1;
272
283
  /* Node.ELEMENT_TYPE */
273
284
  /** Find last style element if any inside target */
274
- const findLastStyleTag = (target) => {
275
- const { childNodes } = target;
276
- for (let i = childNodes.length; i >= 0; i--) {
277
- const child = childNodes[i];
285
+ var findLastStyleTag = function (target) {
286
+ var childNodes = target.childNodes;
287
+ for (var i = childNodes.length; i >= 0; i--) {
288
+ var child = childNodes[i];
278
289
  if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
279
290
  return child;
280
291
  }
@@ -282,29 +293,29 @@ const findLastStyleTag = (target) => {
282
293
  return undefined;
283
294
  };
284
295
  /** Create a style element inside `target` or <head> after the last */
285
- const makeStyleTag = (target) => {
286
- const head = document.head;
287
- const parent = target || head;
288
- const style = document.createElement('style');
289
- const prevStyle = findLastStyleTag(parent);
290
- const nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
296
+ var makeStyleTag = function (target) {
297
+ var head = document.head;
298
+ var parent = target || head;
299
+ var style = document.createElement('style');
300
+ var prevStyle = findLastStyleTag(parent);
301
+ var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
291
302
  style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
292
303
  style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
293
- const nonce = getNonce();
304
+ var nonce = getNonce();
294
305
  if (nonce)
295
306
  style.setAttribute('nonce', nonce);
296
307
  parent.insertBefore(style, nextSibling);
297
308
  return style;
298
309
  };
299
310
  /** Get the CSSStyleSheet instance for a given style element */
300
- const getSheet = (tag) => {
311
+ var getSheet = function (tag) {
301
312
  if (tag.sheet) {
302
313
  return tag.sheet;
303
314
  }
304
315
  // Avoid Firefox quirk where the style element might not have a sheet property
305
- const { styleSheets } = document;
306
- for (let i = 0, l = styleSheets.length; i < l; i++) {
307
- const sheet = styleSheets[i];
316
+ var styleSheets = document.styleSheets;
317
+ for (var i = 0, l = styleSheets.length; i < l; i++) {
318
+ var sheet = styleSheets[i];
308
319
  if (sheet.ownerNode === tag) {
309
320
  return sheet;
310
321
  }
@@ -313,7 +324,8 @@ const getSheet = (tag) => {
313
324
  };
314
325
 
315
326
  /** Create a CSSStyleSheet-like tag depending on the environment */
316
- const makeTag = ({ isServer, useCSSOMInjection, target }) => {
327
+ var makeTag = function (_a) {
328
+ var isServer = _a.isServer, useCSSOMInjection = _a.useCSSOMInjection, target = _a.target;
317
329
  if (isServer) {
318
330
  return new VirtualTag(target);
319
331
  }
@@ -324,18 +336,15 @@ const makeTag = ({ isServer, useCSSOMInjection, target }) => {
324
336
  return new TextTag(target);
325
337
  }
326
338
  };
327
- const CSSOMTag = class CSSOMTag {
328
- element;
329
- sheet;
330
- length;
331
- constructor(target) {
332
- const element = (this.element = makeStyleTag(target));
339
+ var CSSOMTag = /** @class */ (function () {
340
+ function CSSOMTag(target) {
341
+ var element = (this.element = makeStyleTag(target));
333
342
  // Avoid Edge bug where empty style elements don't create sheets
334
343
  element.appendChild(document.createTextNode(''));
335
344
  this.sheet = getSheet(element);
336
345
  this.length = 0;
337
346
  }
338
- insertRule(index, rule) {
347
+ CSSOMTag.prototype.insertRule = function (index, rule) {
339
348
  try {
340
349
  this.sheet.insertRule(rule, index);
341
350
  this.length++;
@@ -344,13 +353,13 @@ const CSSOMTag = class CSSOMTag {
344
353
  catch (_error) {
345
354
  return false;
346
355
  }
347
- }
348
- deleteRule(index) {
356
+ };
357
+ CSSOMTag.prototype.deleteRule = function (index) {
349
358
  this.sheet.deleteRule(index);
350
359
  this.length--;
351
- }
352
- getRule(index) {
353
- const rule = this.sheet.cssRules[index];
360
+ };
361
+ CSSOMTag.prototype.getRule = function (index) {
362
+ var rule = this.sheet.cssRules[index];
354
363
  // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
355
364
  if (rule !== undefined && typeof rule.cssText === 'string') {
356
365
  return rule.cssText;
@@ -358,22 +367,20 @@ const CSSOMTag = class CSSOMTag {
358
367
  else {
359
368
  return '';
360
369
  }
361
- }
362
- };
370
+ };
371
+ return CSSOMTag;
372
+ }());
363
373
  /** A Tag that emulates the CSSStyleSheet API but uses text nodes */
364
- const TextTag = class TextTag {
365
- element;
366
- nodes;
367
- length;
368
- constructor(target) {
369
- const element = (this.element = makeStyleTag(target));
374
+ var TextTag = /** @class */ (function () {
375
+ function TextTag(target) {
376
+ var element = (this.element = makeStyleTag(target));
370
377
  this.nodes = element.childNodes;
371
378
  this.length = 0;
372
379
  }
373
- insertRule(index, rule) {
380
+ TextTag.prototype.insertRule = function (index, rule) {
374
381
  if (index <= this.length && index >= 0) {
375
- const node = document.createTextNode(rule);
376
- const refNode = this.nodes[index];
382
+ var node = document.createTextNode(rule);
383
+ var refNode = this.nodes[index];
377
384
  this.element.insertBefore(node, refNode || null);
378
385
  this.length++;
379
386
  return true;
@@ -381,29 +388,28 @@ const TextTag = class TextTag {
381
388
  else {
382
389
  return false;
383
390
  }
384
- }
385
- deleteRule(index) {
391
+ };
392
+ TextTag.prototype.deleteRule = function (index) {
386
393
  this.element.removeChild(this.nodes[index]);
387
394
  this.length--;
388
- }
389
- getRule(index) {
395
+ };
396
+ TextTag.prototype.getRule = function (index) {
390
397
  if (index < this.length) {
391
398
  return this.nodes[index].textContent;
392
399
  }
393
400
  else {
394
401
  return '';
395
402
  }
396
- }
397
- };
403
+ };
404
+ return TextTag;
405
+ }());
398
406
  /** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
399
- const VirtualTag = class VirtualTag {
400
- rules;
401
- length;
402
- constructor(_target) {
407
+ var VirtualTag = /** @class */ (function () {
408
+ function VirtualTag(_target) {
403
409
  this.rules = [];
404
410
  this.length = 0;
405
411
  }
406
- insertRule(index, rule) {
412
+ VirtualTag.prototype.insertRule = function (index, rule) {
407
413
  if (index <= this.length) {
408
414
  this.rules.splice(index, 0, rule);
409
415
  this.length++;
@@ -412,42 +418,33 @@ const VirtualTag = class VirtualTag {
412
418
  else {
413
419
  return false;
414
420
  }
415
- }
416
- deleteRule(index) {
421
+ };
422
+ VirtualTag.prototype.deleteRule = function (index) {
417
423
  this.rules.splice(index, 1);
418
424
  this.length--;
419
- }
420
- getRule(index) {
425
+ };
426
+ VirtualTag.prototype.getRule = function (index) {
421
427
  if (index < this.length) {
422
428
  return this.rules[index];
423
429
  }
424
430
  else {
425
431
  return '';
426
432
  }
427
- }
428
- };
433
+ };
434
+ return VirtualTag;
435
+ }());
429
436
 
430
- let SHOULD_REHYDRATE = IS_BROWSER;
431
- const defaultOptions = {
437
+ var SHOULD_REHYDRATE = IS_BROWSER;
438
+ var defaultOptions = {
432
439
  isServer: !IS_BROWSER,
433
440
  useCSSOMInjection: !DISABLE_SPEEDY,
434
441
  };
435
442
  /** Contains the main stylesheet logic for stringification and caching */
436
- class StyleSheet {
437
- gs;
438
- names;
439
- options;
440
- server;
441
- tag;
442
- /** Register a group ID to give it an index */
443
- static registerId(id) {
444
- return getGroupForId(id);
445
- }
446
- constructor(options = EMPTY_OBJECT, globalStyles = {}, names) {
447
- this.options = {
448
- ...defaultOptions,
449
- ...options,
450
- };
443
+ var StyleSheet = /** @class */ (function () {
444
+ function StyleSheet(options, globalStyles, names) {
445
+ if (options === void 0) { options = EMPTY_OBJECT; }
446
+ if (globalStyles === void 0) { globalStyles = {}; }
447
+ this.options = __assign(__assign({}, defaultOptions), options);
451
448
  this.gs = globalStyles;
452
449
  this.names = new Map(names);
453
450
  this.server = !!options.isServer;
@@ -457,89 +454,103 @@ class StyleSheet {
457
454
  rehydrateSheet(this);
458
455
  }
459
456
  }
460
- reconstructWithOptions(options, withNames = true) {
461
- return new StyleSheet({ ...this.options, ...options }, this.gs, (withNames && this.names) || undefined);
462
- }
463
- allocateGSInstance(id) {
457
+ /** Register a group ID to give it an index */
458
+ StyleSheet.registerId = function (id) {
459
+ return getGroupForId(id);
460
+ };
461
+ StyleSheet.prototype.reconstructWithOptions = function (options, withNames) {
462
+ if (withNames === void 0) { withNames = true; }
463
+ return new StyleSheet(__assign(__assign({}, this.options), options), this.gs, (withNames && this.names) || undefined);
464
+ };
465
+ StyleSheet.prototype.allocateGSInstance = function (id) {
464
466
  return (this.gs[id] = (this.gs[id] || 0) + 1);
465
- }
467
+ };
466
468
  /** Lazily initialises a GroupedTag for when it's actually needed */
467
- getTag() {
469
+ StyleSheet.prototype.getTag = function () {
468
470
  return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));
469
- }
471
+ };
470
472
  /** Check whether a name is known for caching */
471
- hasNameForId(id, name) {
473
+ StyleSheet.prototype.hasNameForId = function (id, name) {
472
474
  return this.names.has(id) && this.names.get(id).has(name);
473
- }
475
+ };
474
476
  /** Mark a group's name as known for caching */
475
- registerName(id, name) {
477
+ StyleSheet.prototype.registerName = function (id, name) {
476
478
  getGroupForId(id);
477
479
  if (!this.names.has(id)) {
478
- const groupNames = new Set();
480
+ var groupNames = new Set();
479
481
  groupNames.add(name);
480
482
  this.names.set(id, groupNames);
481
483
  }
482
484
  else {
483
485
  this.names.get(id).add(name);
484
486
  }
485
- }
487
+ };
486
488
  /** Insert new rules which also marks the name as known */
487
- insertRules(id, name, rules) {
489
+ StyleSheet.prototype.insertRules = function (id, name, rules) {
488
490
  this.registerName(id, name);
489
491
  this.getTag().insertRules(getGroupForId(id), rules);
490
- }
492
+ };
491
493
  /** Clears all cached names for a given group ID */
492
- clearNames(id) {
494
+ StyleSheet.prototype.clearNames = function (id) {
493
495
  if (this.names.has(id)) {
494
496
  this.names.get(id).clear();
495
497
  }
496
- }
498
+ };
497
499
  /** Clears all rules for a given group ID */
498
- clearRules(id) {
500
+ StyleSheet.prototype.clearRules = function (id) {
499
501
  this.getTag().clearGroup(getGroupForId(id));
500
502
  this.clearNames(id);
501
- }
503
+ };
502
504
  /** Clears the entire tag which deletes all rules but not its names */
503
- clearTag() {
505
+ StyleSheet.prototype.clearTag = function () {
504
506
  // NOTE: This does not clear the names, since it's only used during SSR
505
507
  // so that we can continuously output only new rules
506
508
  this.tag = undefined;
507
- }
509
+ };
508
510
  /** Outputs the current sheet as a CSS string with markers for SSR */
509
- toString() {
511
+ StyleSheet.prototype.toString = function () {
510
512
  return outputSheet(this);
511
- }
512
- }
513
+ };
514
+ return StyleSheet;
515
+ }());
513
516
 
514
- const SEED = 5381;
517
+ var SEED = 5381;
515
518
  // When we have separate strings it's useful to run a progressive
516
519
  // version of djb2 where we pretend that we're still looping over
517
520
  // the same string
518
- const phash = (h, x) => {
519
- let i = x.length;
521
+ var phash = function (h, x) {
522
+ var i = x.length;
520
523
  while (i) {
521
524
  h = (h * 33) ^ x.charCodeAt(--i);
522
525
  }
523
526
  return h;
524
527
  };
525
528
  // This is a djb2 hashing function
526
- const hash = (x) => {
529
+ var hash = function (x) {
527
530
  return phash(SEED, x);
528
531
  };
529
532
 
530
- const COMMENT_REGEX = /^\s*\/\/.*$/gm;
531
- const COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
532
- function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, } = EMPTY_OBJECT) {
533
- let _componentId;
534
- let _selector;
535
- let _selectorRegexp;
536
- let _consecutiveSelfRefRegExp;
537
- const selfReferenceReplacer = (match, offset, string) => {
533
+ var COMMENT_REGEX = /^\s*\/\/.*$/gm;
534
+ var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
535
+ /**
536
+ * Serialize stylis output as an array of css strings. It is important that rules are
537
+ * separated when using CSSOM injection.
538
+ */
539
+ function serialize(children, callback) {
540
+ return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
541
+ }
542
+ function createStylisInstance(_a) {
543
+ var _b = _a === void 0 ? EMPTY_OBJECT : _a, _c = _b.options, options = _c === void 0 ? EMPTY_OBJECT : _c, _d = _b.plugins, plugins = _d === void 0 ? EMPTY_ARRAY : _d;
544
+ var _componentId;
545
+ var _selector;
546
+ var _selectorRegexp;
547
+ var _consecutiveSelfRefRegExp;
548
+ var selfReferenceReplacer = function (match, offset, string) {
538
549
  if (
539
550
  // do not replace the first occurrence if it is complex (has a modifier)
540
551
  (offset === 0 ? !COMPLEX_SELECTOR_PREFIX.includes(string[_selector.length]) : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
541
552
  !string.match(_consecutiveSelfRefRegExp)) {
542
- return `.${_componentId}`;
553
+ return ".".concat(_componentId);
543
554
  }
544
555
  return match;
545
556
  };
@@ -555,31 +566,34 @@ function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, }
555
566
  *
556
567
  * https://github.com/thysultan/stylis.js/tree/v4.0.2#abstract-syntax-structure
557
568
  */
558
- const selfReferenceReplacementPlugin = element => {
569
+ var selfReferenceReplacementPlugin = function (element) {
559
570
  if (element.type === RULESET && element.value.includes('&')) {
560
- const props = element.props;
571
+ var props = element.props;
561
572
  props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
562
573
  }
563
574
  };
564
- const stringifyRules = (css, selector = '', prefix = '', componentId = '&') => {
565
- let flatCSS = css.replace(COMMENT_REGEX, '');
575
+ var stringifyRules = function (css, selector, prefix, componentId) {
576
+ if (selector === void 0) { selector = ''; }
577
+ if (prefix === void 0) { prefix = ''; }
578
+ if (componentId === void 0) { componentId = '&'; }
579
+ var flatCSS = css.replace(COMMENT_REGEX, '');
566
580
  // stylis has no concept of state to be passed to plugins
567
581
  // but since JS is single-threaded, we can rely on that to ensure
568
582
  // these properties stay in sync with the current stylis run
569
583
  _componentId = componentId;
570
584
  _selector = selector;
571
- _selectorRegexp = new RegExp(`\\${_selector}\\b`, 'g');
572
- _consecutiveSelfRefRegExp = new RegExp(`(\\${_selector}\\b){2,}`);
573
- const middlewares = plugins.slice();
585
+ _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
586
+ _consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
587
+ var middlewares = plugins.slice();
574
588
  if (options.prefix || options.prefix === undefined) {
575
589
  middlewares.unshift(prefixer);
576
590
  }
577
591
  middlewares.push(selfReferenceReplacementPlugin, stringify);
578
- return serialize(compile(prefix || selector ? `${prefix} ${selector} { ${flatCSS} }` : flatCSS), middleware(middlewares));
592
+ return serialize(compile(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS), middleware(middlewares));
579
593
  };
580
594
  stringifyRules.hash = plugins.length
581
595
  ? plugins
582
- .reduce((acc, plugin) => {
596
+ .reduce(function (acc, plugin) {
583
597
  if (!plugin.name) {
584
598
  throwStyledComponentsError(15);
585
599
  }
@@ -590,35 +604,36 @@ function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, }
590
604
  return stringifyRules;
591
605
  }
592
606
 
593
- const StyleSheetContext = React.createContext(undefined);
607
+ var StyleSheetContext = React.createContext(undefined);
594
608
  StyleSheetContext.Consumer;
595
- const StylisContext = React.createContext(undefined);
609
+ var StylisContext = React.createContext(undefined);
596
610
  StylisContext.Consumer;
597
611
  new StyleSheet();
598
- const mainStylis = createStylisInstance();
612
+ var mainStylis = createStylisInstance();
599
613
 
600
- class Keyframes {
601
- id;
602
- name;
603
- rules;
604
- constructor(name, rules) {
614
+ var Keyframes = /** @class */ (function () {
615
+ function Keyframes(name, rules) {
616
+ var _this = this;
617
+ this.inject = function (styleSheet, stylisInstance) {
618
+ if (stylisInstance === void 0) { stylisInstance = mainStylis; }
619
+ var resolvedName = _this.name + stylisInstance.hash;
620
+ if (!styleSheet.hasNameForId(_this.id, resolvedName)) {
621
+ styleSheet.insertRules(_this.id, resolvedName, stylisInstance(_this.rules, resolvedName, '@keyframes'));
622
+ }
623
+ };
624
+ this.toString = function () {
625
+ throw throwStyledComponentsError(12, String(_this.name));
626
+ };
605
627
  this.name = name;
606
- this.id = `sc-keyframes-${name}`;
628
+ this.id = "sc-keyframes-".concat(name);
607
629
  this.rules = rules;
608
630
  }
609
- inject = (styleSheet, stylisInstance = mainStylis) => {
610
- const resolvedName = this.name + stylisInstance.hash;
611
- if (!styleSheet.hasNameForId(this.id, resolvedName)) {
612
- styleSheet.insertRules(this.id, resolvedName, stylisInstance(this.rules, resolvedName, '@keyframes'));
613
- }
614
- };
615
- toString = () => {
616
- throw throwStyledComponentsError(12, String(this.name));
617
- };
618
- getName(stylisInstance = mainStylis) {
631
+ Keyframes.prototype.getName = function (stylisInstance) {
632
+ if (stylisInstance === void 0) { stylisInstance = mainStylis; }
619
633
  return this.name + stylisInstance.hash;
620
- }
621
- }
634
+ };
635
+ return Keyframes;
636
+ }());
622
637
 
623
638
  // Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
624
639
  function addUnitIfNeeded(name, value) {
@@ -627,7 +642,7 @@ function addUnitIfNeeded(name, value) {
627
642
  return '';
628
643
  }
629
644
  if (typeof value === 'number' && value !== 0 && !(name in unitless)) {
630
- return `${value}px`; // Presumes implicit 'px' suffix for unitless numbers
645
+ return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
631
646
  }
632
647
  return String(value).trim();
633
648
  }
@@ -643,10 +658,10 @@ function getComponentName(target) {
643
658
  * inlined version of
644
659
  * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
645
660
  */
646
- const uppercaseCheck = /([A-Z])/;
647
- const uppercasePattern = /([A-Z])/g;
648
- const msPattern = /^ms-/;
649
- const prefixAndLowerCase = (char) => `-${char.toLowerCase()}`;
661
+ var uppercaseCheck = /([A-Z])/;
662
+ var uppercasePattern = /([A-Z])/g;
663
+ var msPattern = /^ms-/;
664
+ var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
650
665
  /**
651
666
  * Hyphenates a camelcased CSS property name, for example:
652
667
  *
@@ -692,33 +707,35 @@ function isStyledComponent(target) {
692
707
  /**
693
708
  * It's falsish not falsy because 0 is allowed.
694
709
  */
695
- const isFalsish = (chunk) => chunk === undefined || chunk === null || chunk === false || chunk === '';
696
- const objToCssArray = (obj, prevKey) => {
697
- const rules = [];
698
- for (const key in obj) {
710
+ var isFalsish = function (chunk) {
711
+ return chunk === undefined || chunk === null || chunk === false || chunk === '';
712
+ };
713
+ var objToCssArray = function (obj, prevKey) {
714
+ var rules = [];
715
+ for (var key in obj) {
699
716
  if (!obj.hasOwnProperty(key) || isFalsish(obj[key]))
700
717
  continue;
701
718
  if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {
702
- rules.push(`${hyphenateStyleName(key)}:`, obj[key], ';');
719
+ rules.push("".concat(hyphenateStyleName(key), ":"), obj[key], ';');
703
720
  }
704
721
  else if (isPlainObject(obj[key])) {
705
- rules.push(...objToCssArray(obj[key], key));
722
+ rules.push.apply(rules, objToCssArray(obj[key], key));
706
723
  }
707
724
  else {
708
- rules.push(`${hyphenateStyleName(key)}: ${addUnitIfNeeded(key, obj[key])};`);
725
+ rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, obj[key]), ";"));
709
726
  }
710
727
  }
711
- return prevKey ? [`${prevKey} {`, ...rules, '}'] : rules;
728
+ return prevKey ? __spreadArray(__spreadArray(["".concat(prevKey, " {")], rules, true), ['}'], false) : rules;
712
729
  };
713
730
  function flatten(chunk, executionContext, styleSheet, stylisInstance) {
714
731
  if (Array.isArray(chunk)) {
715
- const ruleSet = [];
716
- for (let i = 0, len = chunk.length, result; i < len; i += 1) {
732
+ var ruleSet = [];
733
+ for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
717
734
  result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
718
735
  if (result === '')
719
736
  continue;
720
737
  else if (Array.isArray(result))
721
- ruleSet.push(...result);
738
+ ruleSet.push.apply(ruleSet, result);
722
739
  else
723
740
  ruleSet.push(result);
724
741
  }
@@ -729,22 +746,20 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
729
746
  }
730
747
  /* Handle other components */
731
748
  if (isStyledComponent(chunk)) {
732
- return `.${chunk.styledComponentId}`;
749
+ return ".".concat(chunk.styledComponentId);
733
750
  }
734
751
  /* Either execute or defer the function */
735
752
  if (isFunction(chunk)) {
736
753
  if (isStatelessFunction(chunk) && executionContext) {
737
- const chunkFn = chunk;
738
- const result = chunkFn(executionContext);
754
+ var chunkFn = chunk;
755
+ var result = chunkFn(executionContext);
739
756
  if (process.env.NODE_ENV !== 'production' &&
740
757
  typeof result === 'object' &&
741
758
  !Array.isArray(result) &&
742
759
  !(result instanceof Keyframes) &&
743
760
  !isPlainObject(result)) {
744
761
  // eslint-disable-next-line no-console
745
- console.error(`${getComponentName(
746
- // @ts-expect-error handling unexpected input
747
- chunkFn)} is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.`);
762
+ console.error("".concat(getComponentName(chunkFn), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."));
748
763
  }
749
764
  return flatten(result, executionContext, styleSheet, stylisInstance);
750
765
  }
@@ -764,8 +779,8 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
764
779
  }
765
780
 
766
781
  function interleave(strings, interpolations) {
767
- const result = [strings[0]];
768
- for (let i = 0, len = interpolations.length; i < len; i += 1) {
782
+ var result = [strings[0]];
783
+ for (var i = 0, len = interpolations.length; i < len; i += 1) {
769
784
  result.push(interpolations[i], strings[i + 1]);
770
785
  }
771
786
  return result;
@@ -775,22 +790,25 @@ function interleave(strings, interpolations) {
775
790
  * Used when flattening object styles to determine if we should
776
791
  * expand an array of styles.
777
792
  */
778
- const addTag = (arg) => {
793
+ var addTag = function (arg) {
779
794
  if (Array.isArray(arg)) {
780
795
  // eslint-disable-next-line no-param-reassign
781
796
  arg.isCss = true;
782
797
  }
783
798
  return arg;
784
799
  };
785
- function css(styles, ...interpolations) {
800
+ function css(styles) {
801
+ var interpolations = [];
802
+ for (var _i = 1; _i < arguments.length; _i++) {
803
+ interpolations[_i - 1] = arguments[_i];
804
+ }
786
805
  if (isFunction(styles) || isPlainObject(styles)) {
787
- const styleFunctionOrObject = styles;
788
- return addTag(flatten(interleave(EMPTY_ARRAY, [
789
- styleFunctionOrObject,
790
- ...interpolations,
791
- ])));
806
+ var styleFunctionOrObject = styles;
807
+ return addTag(flatten(interleave(EMPTY_ARRAY, __spreadArray([
808
+ styleFunctionOrObject
809
+ ], interpolations, true))));
792
810
  }
793
- const styleStringArray = styles;
811
+ var styleStringArray = styles;
794
812
  if (interpolations.length === 0 &&
795
813
  styleStringArray.length === 1 &&
796
814
  typeof styleStringArray[0] === 'string') {
@@ -799,7 +817,8 @@ function css(styles, ...interpolations) {
799
817
  return addTag(flatten(interleave(styleStringArray, interpolations)));
800
818
  }
801
819
 
802
- function constructWithOptions(componentConstructor, tag, options = EMPTY_OBJECT) {
820
+ function constructWithOptions(componentConstructor, tag, options) {
821
+ if (options === void 0) { options = EMPTY_OBJECT; }
803
822
  // We trust that the tag is a valid component as long as it isn't falsish
804
823
  // Typically the tag here is a string or function (i.e. class or pure function component)
805
824
  // However a component may also be an object if it uses another utility, e.g. React.memo
@@ -808,30 +827,34 @@ function constructWithOptions(componentConstructor, tag, options = EMPTY_OBJECT)
808
827
  throw throwStyledComponentsError(1, tag);
809
828
  }
810
829
  /* This is callable directly as a template function */
811
- const templateFunction = (initialStyles, ...interpolations) => componentConstructor(tag, options, css(initialStyles, ...interpolations));
830
+ var templateFunction = function (initialStyles) {
831
+ var interpolations = [];
832
+ for (var _i = 1; _i < arguments.length; _i++) {
833
+ interpolations[_i - 1] = arguments[_i];
834
+ }
835
+ return componentConstructor(tag, options, css.apply(void 0, __spreadArray([initialStyles], interpolations, false)));
836
+ };
812
837
  /* Modify/inject new props at runtime */
813
- templateFunction.attrs = (attrs) => constructWithOptions(componentConstructor, tag, {
814
- ...options,
815
- attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean),
816
- });
838
+ templateFunction.attrs = function (attrs) {
839
+ return constructWithOptions(componentConstructor, tag, __assign(__assign({}, options), { attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean) }));
840
+ };
817
841
  /**
818
842
  * If config methods are called, wrap up a new template function and merge options */
819
- templateFunction.withConfig = (config) => constructWithOptions(componentConstructor, tag, {
820
- ...options,
821
- ...config,
822
- });
843
+ templateFunction.withConfig = function (config) {
844
+ return constructWithOptions(componentConstructor, tag, __assign(__assign({}, options), config));
845
+ };
823
846
  return templateFunction;
824
847
  }
825
848
 
826
- const ThemeContext = React.createContext(undefined);
827
- const ThemeConsumer = ThemeContext.Consumer;
849
+ var ThemeContext = React.createContext(undefined);
850
+ var ThemeConsumer = ThemeContext.Consumer;
828
851
  function mergeTheme(theme, outerTheme) {
829
852
  if (!theme) {
830
853
  throw throwStyledComponentsError(14);
831
854
  }
832
855
  if (isFunction(theme)) {
833
- const themeFn = theme;
834
- const mergedTheme = themeFn(outerTheme);
856
+ var themeFn = theme;
857
+ var mergedTheme = themeFn(outerTheme);
835
858
  if (process.env.NODE_ENV !== 'production' &&
836
859
  (mergedTheme === null || Array.isArray(mergedTheme) || typeof mergedTheme !== 'object')) {
837
860
  throw throwStyledComponentsError(7);
@@ -841,32 +864,34 @@ function mergeTheme(theme, outerTheme) {
841
864
  if (Array.isArray(theme) || typeof theme !== 'object') {
842
865
  throw throwStyledComponentsError(8);
843
866
  }
844
- return outerTheme ? { ...outerTheme, ...theme } : theme;
867
+ return outerTheme ? __assign(__assign({}, outerTheme), theme) : theme;
845
868
  }
846
869
  /**
847
870
  * Provide a theme to an entire react component tree via context
848
871
  */
849
872
  function ThemeProvider(props) {
850
- const outerTheme = useContext(ThemeContext);
851
- const themeContext = useMemo(() => mergeTheme(props.theme, outerTheme), [props.theme, outerTheme]);
873
+ var outerTheme = useContext(ThemeContext);
874
+ var themeContext = useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
852
875
  if (!props.children) {
853
876
  return null;
854
877
  }
855
878
  return React.createElement(ThemeContext.Provider, { value: themeContext }, props.children);
856
879
  }
857
880
 
858
- function determineTheme(props, providedTheme, defaultProps = EMPTY_OBJECT) {
881
+ function determineTheme(props, providedTheme, defaultProps) {
882
+ if (defaultProps === void 0) { defaultProps = EMPTY_OBJECT; }
859
883
  return (props.theme !== defaultProps.theme && props.theme) || providedTheme || defaultProps.theme;
860
884
  }
861
885
 
862
- const hasSymbol = typeof Symbol === 'function' && Symbol.for;
886
+ var _a;
887
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
863
888
  // copied from react-is
864
- const REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
865
- const REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
889
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
890
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
866
891
  /**
867
892
  * Adapted from hoist-non-react-statics to avoid the react-is dependency.
868
893
  */
869
- const REACT_STATICS = {
894
+ var REACT_STATICS = {
870
895
  childContextTypes: true,
871
896
  contextType: true,
872
897
  contextTypes: true,
@@ -879,7 +904,7 @@ const REACT_STATICS = {
879
904
  propTypes: true,
880
905
  type: true,
881
906
  };
882
- const KNOWN_STATICS = {
907
+ var KNOWN_STATICS = {
883
908
  name: true,
884
909
  length: true,
885
910
  prototype: true,
@@ -888,14 +913,14 @@ const KNOWN_STATICS = {
888
913
  arguments: true,
889
914
  arity: true,
890
915
  };
891
- const FORWARD_REF_STATICS = {
916
+ var FORWARD_REF_STATICS = {
892
917
  $$typeof: true,
893
918
  render: true,
894
919
  defaultProps: true,
895
920
  displayName: true,
896
921
  propTypes: true,
897
922
  };
898
- const MEMO_STATICS = {
923
+ var MEMO_STATICS = {
899
924
  $$typeof: true,
900
925
  compare: true,
901
926
  defaultProps: true,
@@ -903,13 +928,13 @@ const MEMO_STATICS = {
903
928
  propTypes: true,
904
929
  type: true,
905
930
  };
906
- const TYPE_STATICS = {
907
- [REACT_FORWARD_REF_TYPE]: FORWARD_REF_STATICS,
908
- [REACT_MEMO_TYPE]: MEMO_STATICS,
909
- };
931
+ var TYPE_STATICS = (_a = {},
932
+ _a[REACT_FORWARD_REF_TYPE] = FORWARD_REF_STATICS,
933
+ _a[REACT_MEMO_TYPE] = MEMO_STATICS,
934
+ _a);
910
935
  // adapted from react-is
911
936
  function isMemo(object) {
912
- const $$typeofType = 'type' in object && object.type.$$typeof;
937
+ var $$typeofType = 'type' in object && object.type.$$typeof;
913
938
  return $$typeofType === REACT_MEMO_TYPE;
914
939
  }
915
940
  function getStatics(component) {
@@ -922,34 +947,34 @@ function getStatics(component) {
922
947
  ? TYPE_STATICS[component['$$typeof']]
923
948
  : REACT_STATICS;
924
949
  }
925
- const defineProperty = Object.defineProperty;
926
- const getOwnPropertyNames = Object.getOwnPropertyNames;
927
- const getOwnPropertySymbols = Object.getOwnPropertySymbols;
928
- const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
929
- const getPrototypeOf = Object.getPrototypeOf;
930
- const objectPrototype = Object.prototype;
950
+ var defineProperty = Object.defineProperty;
951
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
952
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
953
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
954
+ var getPrototypeOf = Object.getPrototypeOf;
955
+ var objectPrototype = Object.prototype;
931
956
  function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
932
957
  if (typeof sourceComponent !== 'string') {
933
958
  // don't hoist over string (html) components
934
959
  if (objectPrototype) {
935
- const inheritedComponent = getPrototypeOf(sourceComponent);
960
+ var inheritedComponent = getPrototypeOf(sourceComponent);
936
961
  if (inheritedComponent && inheritedComponent !== objectPrototype) {
937
962
  hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
938
963
  }
939
964
  }
940
- let keys = getOwnPropertyNames(sourceComponent);
965
+ var keys = getOwnPropertyNames(sourceComponent);
941
966
  if (getOwnPropertySymbols) {
942
967
  keys = keys.concat(getOwnPropertySymbols(sourceComponent));
943
968
  }
944
- const targetStatics = getStatics(targetComponent);
945
- const sourceStatics = getStatics(sourceComponent);
946
- for (let i = 0; i < keys.length; ++i) {
947
- const key = keys[i];
969
+ var targetStatics = getStatics(targetComponent);
970
+ var sourceStatics = getStatics(sourceComponent);
971
+ for (var i = 0; i < keys.length; ++i) {
972
+ var key = keys[i];
948
973
  if (!(key in KNOWN_STATICS) &&
949
974
  !(excludelist && excludelist[key]) &&
950
975
  !(sourceStatics && key in sourceStatics) &&
951
976
  !(targetStatics && key in targetStatics)) {
952
- const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
977
+ var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
953
978
  try {
954
979
  // Avoid failures from read-only properties
955
980
  defineProperty(targetComponent, key, descriptor);
@@ -964,31 +989,31 @@ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
964
989
  }
965
990
 
966
991
  function withTheme(Component) {
967
- const WithTheme = React.forwardRef((props, ref) => {
968
- const theme = React.useContext(ThemeContext);
969
- const themeProp = determineTheme(props, theme, Component.defaultProps);
992
+ var WithTheme = React.forwardRef(function (props, ref) {
993
+ var theme = React.useContext(ThemeContext);
994
+ var themeProp = determineTheme(props, theme, Component.defaultProps);
970
995
  if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {
971
996
  // eslint-disable-next-line no-console
972
- console.warn(`[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "${getComponentName(Component)}"`);
997
+ console.warn("[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class \"".concat(getComponentName(Component), "\""));
973
998
  }
974
- return React.createElement(Component, { ...props, theme: themeProp, ref: ref });
999
+ return React.createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
975
1000
  });
976
- WithTheme.displayName = `WithTheme(${getComponentName(Component)})`;
1001
+ WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
977
1002
  return hoistNonReactStatics(WithTheme, Component);
978
1003
  }
979
1004
 
980
- const useTheme = () => useContext(ThemeContext);
1005
+ var useTheme = function () { return useContext(ThemeContext); };
981
1006
 
982
- const AD_REPLACER_R = /(a)(d)/gi;
1007
+ var AD_REPLACER_R = /(a)(d)/gi;
983
1008
  /* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
984
1009
  * counterparts */
985
- const charsLength = 52;
1010
+ var charsLength = 52;
986
1011
  /* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
987
- const getAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
1012
+ var getAlphabeticChar = function (code) { return String.fromCharCode(code + (code > 25 ? 39 : 97)); };
988
1013
  /* input a number, usually a hash and convert it to base-52 */
989
1014
  function generateAlphabeticName(code) {
990
- let name = '';
991
- let x;
1015
+ var name = '';
1016
+ var x;
992
1017
  /* get a char and divide by alphabet-length */
993
1018
  for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {
994
1019
  name = getAlphabeticChar(x % charsLength) + name;
@@ -1000,41 +1025,41 @@ function generateComponentId(str) {
1000
1025
  return generateAlphabeticName(hash(str) >>> 0);
1001
1026
  }
1002
1027
 
1003
- let generated = {};
1028
+ var generated = {};
1004
1029
  /**
1005
1030
  * InlineStyle takes arbitrary CSS and generates a flat object
1006
1031
  */
1007
1032
  function makeInlineStyleClass(styleSheet) {
1008
- const InlineStyle = class InlineStyle {
1009
- rules;
1010
- constructor(rules) {
1033
+ var InlineStyle = /** @class */ (function () {
1034
+ function InlineStyle(rules) {
1011
1035
  this.rules = rules;
1012
1036
  }
1013
- generateStyleObject(executionContext) {
1037
+ InlineStyle.prototype.generateStyleObject = function (executionContext) {
1014
1038
  // keyframes, functions, and component selectors are not allowed for React Native
1015
- const flatCSS = flatten(this.rules, executionContext).join('');
1016
- const hash = generateComponentId(flatCSS);
1039
+ var flatCSS = flatten(this.rules, executionContext).join('');
1040
+ var hash = generateComponentId(flatCSS);
1017
1041
  if (!generated[hash]) {
1018
- const root = parse(flatCSS);
1019
- const declPairs = [];
1020
- root.each(node => {
1042
+ var root = parse(flatCSS);
1043
+ var declPairs_1 = [];
1044
+ root.each(function (node) {
1021
1045
  if (node.type === 'decl') {
1022
- declPairs.push([node.prop, node.value]);
1046
+ declPairs_1.push([node.prop, node.value]);
1023
1047
  }
1024
1048
  else if (process.env.NODE_ENV !== 'production' && node.type !== 'comment') {
1025
1049
  /* eslint-disable no-console */
1026
- console.warn(`Node of type ${node.type} not supported as an inline style`);
1050
+ console.warn("Node of type ".concat(node.type, " not supported as an inline style"));
1027
1051
  }
1028
1052
  });
1029
- const styleObject = transformDeclPairs(declPairs);
1030
- const styles = styleSheet.create({
1053
+ var styleObject = transformDeclPairs(declPairs_1);
1054
+ var styles = styleSheet.create({
1031
1055
  generated: styleObject,
1032
1056
  });
1033
1057
  generated[hash] = styles.generated;
1034
1058
  }
1035
1059
  return generated[hash];
1036
- }
1037
- };
1060
+ };
1061
+ return InlineStyle;
1062
+ }());
1038
1063
  return InlineStyle;
1039
1064
  }
1040
1065
 
@@ -1046,22 +1071,23 @@ function isTag(target) {
1046
1071
  }
1047
1072
 
1048
1073
  function generateDisplayName(target) {
1049
- return isTag(target) ? `styled.${target}` : `Styled(${getComponentName(target)})`;
1074
+ return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
1050
1075
  }
1051
1076
 
1052
- function mixinRecursively(target, source, forceMerge = false) {
1077
+ function mixinRecursively(target, source, forceMerge) {
1078
+ if (forceMerge === void 0) { forceMerge = false; }
1053
1079
  /* only merge into POJOs, Arrays, but for top level objects only
1054
1080
  * allow to merge into anything by passing forceMerge = true */
1055
1081
  if (!forceMerge && !isPlainObject(target) && !Array.isArray(target)) {
1056
1082
  return source;
1057
1083
  }
1058
1084
  if (Array.isArray(source)) {
1059
- for (let key = 0; key < source.length; key++) {
1085
+ for (var key = 0; key < source.length; key++) {
1060
1086
  target[key] = mixinRecursively(target[key], source[key]);
1061
1087
  }
1062
1088
  }
1063
1089
  else if (isPlainObject(source)) {
1064
- for (const key in source) {
1090
+ for (var key in source) {
1065
1091
  target[key] = mixinRecursively(target[key], source[key]);
1066
1092
  }
1067
1093
  }
@@ -1072,23 +1098,30 @@ function mixinRecursively(target, source, forceMerge = false) {
1072
1098
  * If target is not a POJO or an Array, it will get source properties injected via shallow merge
1073
1099
  * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
1074
1100
  */
1075
- function mixinDeep(target = {}, ...sources) {
1076
- for (const source of sources) {
1101
+ function mixinDeep(target) {
1102
+ if (target === void 0) { target = {}; }
1103
+ var sources = [];
1104
+ for (var _i = 1; _i < arguments.length; _i++) {
1105
+ sources[_i - 1] = arguments[_i];
1106
+ }
1107
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
1108
+ var source = sources_1[_a];
1077
1109
  mixinRecursively(target, source, true);
1078
1110
  }
1079
1111
  return target;
1080
1112
  }
1081
1113
 
1082
- function useResolvedAttrs(theme = EMPTY_OBJECT, props, attrs) {
1114
+ function useResolvedAttrs(theme, props, attrs) {
1115
+ if (theme === void 0) { theme = EMPTY_OBJECT; }
1083
1116
  // NOTE: can't memoize this
1084
1117
  // returns [context, resolvedAttrs]
1085
1118
  // where resolvedAttrs is only the things injected by the attrs themselves
1086
- const context = { ...props, theme };
1087
- const resolvedAttrs = {};
1088
- attrs.forEach(attrDef => {
1119
+ var context = __assign(__assign({}, props), { theme: theme });
1120
+ var resolvedAttrs = {};
1121
+ attrs.forEach(function (attrDef) {
1089
1122
  // @ts-expect-error narrowing isn't working properly for some reason
1090
- let resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
1091
- let key;
1123
+ var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
1124
+ var key;
1092
1125
  /* eslint-disable guard-for-in */
1093
1126
  for (key in resolvedAttrDef) {
1094
1127
  // @ts-expect-error bad types
@@ -1098,34 +1131,32 @@ function useResolvedAttrs(theme = EMPTY_OBJECT, props, attrs) {
1098
1131
  });
1099
1132
  return [context, resolvedAttrs];
1100
1133
  }
1101
- // Validator defaults to true if not in HTML/DOM env
1102
- const validAttr = () => true;
1103
1134
  function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1104
- const { attrs: componentAttrs, inlineStyle, defaultProps, shouldForwardProp, target, } = forwardedComponent;
1135
+ var componentAttrs = forwardedComponent.attrs, inlineStyle = forwardedComponent.inlineStyle, defaultProps = forwardedComponent.defaultProps, shouldForwardProp = forwardedComponent.shouldForwardProp, target = forwardedComponent.target;
1105
1136
  // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1106
1137
  // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1107
1138
  // should be an immutable value, but behave for now.
1108
- const theme = determineTheme(props, useContext(ThemeContext), defaultProps);
1109
- const [context, attrs] = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs);
1110
- const generatedStyles = inlineStyle.generateStyleObject(context);
1111
- const refToForward = forwardedRef;
1112
- const elementToBeCreated = attrs.$as || props.$as || attrs.as || props.as || target;
1113
- const computedProps = attrs !== props ? { ...props, ...attrs } : props;
1114
- const propsForElement = {};
1139
+ var theme = determineTheme(props, useContext(ThemeContext), defaultProps);
1140
+ var _a = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs), context = _a[0], attrs = _a[1];
1141
+ var generatedStyles = inlineStyle.generateStyleObject(context);
1142
+ var refToForward = forwardedRef;
1143
+ var elementToBeCreated = attrs.$as || props.$as || attrs.as || props.as || target;
1144
+ var computedProps = attrs !== props ? __assign(__assign({}, props), attrs) : props;
1145
+ var propsForElement = {};
1115
1146
  // eslint-disable-next-line guard-for-in
1116
- for (const key in computedProps) {
1147
+ for (var key in computedProps) {
1117
1148
  if (key[0] === '$' || key === 'as')
1118
1149
  continue;
1119
1150
  else if (key === 'forwardedAs') {
1120
1151
  propsForElement.as = computedProps[key];
1121
1152
  }
1122
- else if (!shouldForwardProp || shouldForwardProp(key, validAttr, elementToBeCreated)) {
1153
+ else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
1123
1154
  propsForElement[key] = computedProps[key];
1124
1155
  }
1125
1156
  }
1126
- propsForElement.style = useMemo(() => {
1157
+ propsForElement.style = useMemo(function () {
1127
1158
  if (typeof props.style === 'function') {
1128
- return (state) => {
1159
+ return function (state) {
1129
1160
  return [generatedStyles].concat(props.style(state));
1130
1161
  };
1131
1162
  }
@@ -1139,39 +1170,42 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1139
1170
  propsForElement.ref = refToForward;
1140
1171
  return createElement(elementToBeCreated, propsForElement);
1141
1172
  }
1142
- var _StyledNativeComponent = (InlineStyle) => {
1143
- const createStyledNativeComponent = (target, options, rules) => {
1144
- const isTargetStyledComp = isStyledComponent(target);
1145
- const styledComponentTarget = target;
1146
- const { displayName = generateDisplayName(target), attrs = EMPTY_ARRAY } = options;
1173
+ var _StyledNativeComponent = (function (InlineStyle) {
1174
+ var createStyledNativeComponent = function (target, options, rules) {
1175
+ var isTargetStyledComp = isStyledComponent(target);
1176
+ var styledComponentTarget = target;
1177
+ var _a = options.displayName, displayName = _a === void 0 ? generateDisplayName(target) : _a, _b = options.attrs, attrs = _b === void 0 ? EMPTY_ARRAY : _b;
1147
1178
  // fold the underlying StyledComponent attrs up (implicit extend)
1148
- const finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1179
+ var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1149
1180
  ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1150
1181
  : attrs;
1151
1182
  // eslint-disable-next-line prefer-destructuring
1152
- let shouldForwardProp = options.shouldForwardProp;
1183
+ var shouldForwardProp = options.shouldForwardProp;
1153
1184
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
1154
- const shouldForwardPropFn = styledComponentTarget.shouldForwardProp;
1185
+ var shouldForwardPropFn_1 = styledComponentTarget.shouldForwardProp;
1155
1186
  if (options.shouldForwardProp) {
1156
- const passedShouldForwardPropFn = options.shouldForwardProp;
1187
+ var passedShouldForwardPropFn_1 = options.shouldForwardProp;
1157
1188
  // compose nested shouldForwardProp calls
1158
- shouldForwardProp = (prop, filterFn, elementToBeCreated) => shouldForwardPropFn(prop, filterFn, elementToBeCreated) &&
1159
- passedShouldForwardPropFn(prop, filterFn, elementToBeCreated);
1189
+ shouldForwardProp = function (prop, elementToBeCreated) {
1190
+ return shouldForwardPropFn_1(prop, elementToBeCreated) &&
1191
+ passedShouldForwardPropFn_1(prop, elementToBeCreated);
1192
+ };
1160
1193
  }
1161
1194
  else {
1162
1195
  // eslint-disable-next-line prefer-destructuring
1163
- shouldForwardProp = shouldForwardPropFn;
1196
+ shouldForwardProp = shouldForwardPropFn_1;
1164
1197
  }
1165
1198
  }
1166
- const forwardRef = (props, ref) =>
1167
- // eslint-disable-next-line react-hooks/rules-of-hooks
1168
- useStyledComponentImpl(WrappedStyledComponent, props, ref);
1199
+ var forwardRef = function (props, ref) {
1200
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1201
+ return useStyledComponentImpl(WrappedStyledComponent, props, ref);
1202
+ };
1169
1203
  forwardRef.displayName = displayName;
1170
1204
  /**
1171
1205
  * forwardRef creates a new interim component, which we'll take advantage of
1172
1206
  * instead of extending ParentComponent to create _another_ interim class
1173
1207
  */
1174
- let WrappedStyledComponent = React.forwardRef(forwardRef);
1208
+ var WrappedStyledComponent = React.forwardRef(forwardRef);
1175
1209
  WrappedStyledComponent.attrs = finalAttrs;
1176
1210
  WrappedStyledComponent.inlineStyle = new InlineStyle(isTargetStyledComp ? styledComponentTarget.inlineStyle.rules.concat(rules) : rules);
1177
1211
  WrappedStyledComponent.displayName = displayName;
@@ -1181,17 +1215,14 @@ var _StyledNativeComponent = (InlineStyle) => {
1181
1215
  // fold the underlying StyledComponent target up since we folded the styles
1182
1216
  WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
1183
1217
  WrappedStyledComponent.withComponent = function withComponent(tag) {
1184
- const newOptions = {
1185
- ...options,
1186
- attrs: finalAttrs,
1187
- };
1218
+ var newOptions = __assign(__assign({}, options), { attrs: finalAttrs });
1188
1219
  return createStyledNativeComponent(tag, newOptions, rules);
1189
1220
  };
1190
1221
  Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
1191
- get() {
1222
+ get: function () {
1192
1223
  return this._foldedDefaultProps;
1193
1224
  },
1194
- set(obj) {
1225
+ set: function (obj) {
1195
1226
  this._foldedDefaultProps = isTargetStyledComp
1196
1227
  ? mixinDeep({}, styledComponentTarget.defaultProps, obj)
1197
1228
  : obj;
@@ -1209,16 +1240,18 @@ var _StyledNativeComponent = (InlineStyle) => {
1209
1240
  return WrappedStyledComponent;
1210
1241
  };
1211
1242
  return createStyledNativeComponent;
1212
- };
1243
+ });
1213
1244
 
1214
1245
  // eslint-disable-next-line @typescript-eslint/no-var-requires
1215
- const reactNative = require('react-native');
1216
- const InlineStyle = makeInlineStyleClass(reactNative.StyleSheet);
1217
- const StyledNativeComponent = _StyledNativeComponent(InlineStyle);
1218
- const baseStyled = (tag) => constructWithOptions(StyledNativeComponent, tag);
1246
+ var reactNative = require('react-native');
1247
+ var InlineStyle = makeInlineStyleClass(reactNative.StyleSheet);
1248
+ var StyledNativeComponent = _StyledNativeComponent(InlineStyle);
1249
+ var baseStyled = function (tag) {
1250
+ return constructWithOptions(StyledNativeComponent, tag);
1251
+ };
1219
1252
  /* React native lazy-requires each of these modules for some reason, so let's
1220
1253
  * assume it's for a good reason and not eagerly load them all */
1221
- const aliases = [
1254
+ var aliases = [
1222
1255
  'ActivityIndicator',
1223
1256
  'Button',
1224
1257
  'DatePickerIOS',
@@ -1244,19 +1277,21 @@ const aliases = [
1244
1277
  'View',
1245
1278
  'VirtualizedList',
1246
1279
  ];
1247
- const styled = baseStyled;
1280
+ var styled = baseStyled;
1248
1281
  /* Define a getter for each alias which simply gets the reactNative component
1249
1282
  * and passes it to styled */
1250
- aliases.forEach(alias => Object.defineProperty(styled, alias, {
1251
- enumerable: true,
1252
- configurable: false,
1253
- get() {
1254
- if (alias in reactNative && reactNative[alias]) {
1255
- return styled(reactNative[alias]);
1256
- }
1257
- throw new Error(`${alias} is not available in the currently-installed version of react-native`);
1258
- },
1259
- }));
1283
+ aliases.forEach(function (alias) {
1284
+ return Object.defineProperty(styled, alias, {
1285
+ enumerable: true,
1286
+ configurable: false,
1287
+ get: function () {
1288
+ if (alias in reactNative && reactNative[alias]) {
1289
+ return styled(reactNative[alias]);
1290
+ }
1291
+ throw new Error("".concat(alias, " is not available in the currently-installed version of react-native"));
1292
+ },
1293
+ });
1294
+ });
1260
1295
 
1261
1296
  export { ThemeConsumer, ThemeContext, ThemeProvider, css, styled as default, isStyledComponent, useTheme, withTheme };
1262
1297
  //# sourceMappingURL=styled-components.native.esm.js.map