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